| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835 |
- /* @preserve
- * The MIT License (MIT)
- *
- * Copyright (c) 2013-2015 Petka Antonov
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
- /**
- * bluebird build version 3.4.6
- * Features enabled: core
- * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each
- */
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
- "use strict";
- var firstLineError;
- try {throw new Error(); } catch (e) {firstLineError = e;}
- var schedule = _dereq_("./schedule");
- var Queue = _dereq_("./queue");
- var util = _dereq_("./util");
- function Async() {
- this._customScheduler = false;
- this._isTickUsed = false;
- this._lateQueue = new Queue(16);
- this._normalQueue = new Queue(16);
- this._haveDrainedQueues = false;
- this._trampolineEnabled = true;
- var self = this;
- this.drainQueues = function () {
- self._drainQueues();
- };
- this._schedule = schedule;
- }
- Async.prototype.setScheduler = function(fn) {
- var prev = this._schedule;
- this._schedule = fn;
- this._customScheduler = true;
- return prev;
- };
- Async.prototype.hasCustomScheduler = function() {
- return this._customScheduler;
- };
- Async.prototype.enableTrampoline = function() {
- this._trampolineEnabled = true;
- };
- Async.prototype.disableTrampolineIfNecessary = function() {
- if (util.hasDevTools) {
- this._trampolineEnabled = false;
- }
- };
- Async.prototype.haveItemsQueued = function () {
- return this._isTickUsed || this._haveDrainedQueues;
- };
- Async.prototype.fatalError = function(e, isNode) {
- if (isNode) {
- process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
- "\n");
- process.exit(2);
- } else {
- this.throwLater(e);
- }
- };
- Async.prototype.throwLater = function(fn, arg) {
- if (arguments.length === 1) {
- arg = fn;
- fn = function () { throw arg; };
- }
- if (typeof setTimeout !== "undefined") {
- setTimeout(function() {
- fn(arg);
- }, 0);
- } else try {
- this._schedule(function() {
- fn(arg);
- });
- } catch (e) {
- throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
- }
- };
- function AsyncInvokeLater(fn, receiver, arg) {
- this._lateQueue.push(fn, receiver, arg);
- this._queueTick();
- }
- function AsyncInvoke(fn, receiver, arg) {
- this._normalQueue.push(fn, receiver, arg);
- this._queueTick();
- }
- function AsyncSettlePromises(promise) {
- this._normalQueue._pushOne(promise);
- this._queueTick();
- }
- if (!util.hasDevTools) {
- Async.prototype.invokeLater = AsyncInvokeLater;
- Async.prototype.invoke = AsyncInvoke;
- Async.prototype.settlePromises = AsyncSettlePromises;
- } else {
- Async.prototype.invokeLater = function (fn, receiver, arg) {
- if (this._trampolineEnabled) {
- AsyncInvokeLater.call(this, fn, receiver, arg);
- } else {
- this._schedule(function() {
- setTimeout(function() {
- fn.call(receiver, arg);
- }, 100);
- });
- }
- };
- Async.prototype.invoke = function (fn, receiver, arg) {
- if (this._trampolineEnabled) {
- AsyncInvoke.call(this, fn, receiver, arg);
- } else {
- this._schedule(function() {
- fn.call(receiver, arg);
- });
- }
- };
- Async.prototype.settlePromises = function(promise) {
- if (this._trampolineEnabled) {
- AsyncSettlePromises.call(this, promise);
- } else {
- this._schedule(function() {
- promise._settlePromises();
- });
- }
- };
- }
- Async.prototype.invokeFirst = function (fn, receiver, arg) {
- this._normalQueue.unshift(fn, receiver, arg);
- this._queueTick();
- };
- Async.prototype._drainQueue = function(queue) {
- while (queue.length() > 0) {
- var fn = queue.shift();
- if (typeof fn !== "function") {
- fn._settlePromises();
- continue;
- }
- var receiver = queue.shift();
- var arg = queue.shift();
- fn.call(receiver, arg);
- }
- };
- Async.prototype._drainQueues = function () {
- this._drainQueue(this._normalQueue);
- this._reset();
- this._haveDrainedQueues = true;
- this._drainQueue(this._lateQueue);
- };
- Async.prototype._queueTick = function () {
- if (!this._isTickUsed) {
- this._isTickUsed = true;
- this._schedule(this.drainQueues);
- }
- };
- Async.prototype._reset = function () {
- this._isTickUsed = false;
- };
- module.exports = Async;
- module.exports.firstLineError = firstLineError;
- },{"./queue":17,"./schedule":18,"./util":21}],2:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
- var calledBind = false;
- var rejectThis = function(_, e) {
- this._reject(e);
- };
- var targetRejected = function(e, context) {
- context.promiseRejectionQueued = true;
- context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
- };
- var bindingResolved = function(thisArg, context) {
- if (((this._bitField & 50397184) === 0)) {
- this._resolveCallback(context.target);
- }
- };
- var bindingRejected = function(e, context) {
- if (!context.promiseRejectionQueued) this._reject(e);
- };
- Promise.prototype.bind = function (thisArg) {
- if (!calledBind) {
- calledBind = true;
- Promise.prototype._propagateFrom = debug.propagateFromFunction();
- Promise.prototype._boundValue = debug.boundValueFunction();
- }
- var maybePromise = tryConvertToPromise(thisArg);
- var ret = new Promise(INTERNAL);
- ret._propagateFrom(this, 1);
- var target = this._target();
- ret._setBoundTo(maybePromise);
- if (maybePromise instanceof Promise) {
- var context = {
- promiseRejectionQueued: false,
- promise: ret,
- target: target,
- bindingPromise: maybePromise
- };
- target._then(INTERNAL, targetRejected, undefined, ret, context);
- maybePromise._then(
- bindingResolved, bindingRejected, undefined, ret, context);
- ret._setOnCancel(maybePromise);
- } else {
- ret._resolveCallback(target);
- }
- return ret;
- };
- Promise.prototype._setBoundTo = function (obj) {
- if (obj !== undefined) {
- this._bitField = this._bitField | 2097152;
- this._boundTo = obj;
- } else {
- this._bitField = this._bitField & (~2097152);
- }
- };
- Promise.prototype._isBound = function () {
- return (this._bitField & 2097152) === 2097152;
- };
- Promise.bind = function (thisArg, value) {
- return Promise.resolve(value).bind(thisArg);
- };
- };
- },{}],3:[function(_dereq_,module,exports){
- "use strict";
- var old;
- if (typeof Promise !== "undefined") old = Promise;
- function noConflict() {
- try { if (Promise === bluebird) Promise = old; }
- catch (e) {}
- return bluebird;
- }
- var bluebird = _dereq_("./promise")();
- bluebird.noConflict = noConflict;
- module.exports = bluebird;
- },{"./promise":15}],4:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(Promise, PromiseArray, apiRejection, debug) {
- var util = _dereq_("./util");
- var tryCatch = util.tryCatch;
- var errorObj = util.errorObj;
- var async = Promise._async;
- Promise.prototype["break"] = Promise.prototype.cancel = function() {
- if (!debug.cancellation()) return this._warn("cancellation is disabled");
- var promise = this;
- var child = promise;
- while (promise._isCancellable()) {
- if (!promise._cancelBy(child)) {
- if (child._isFollowing()) {
- child._followee().cancel();
- } else {
- child._cancelBranched();
- }
- break;
- }
- var parent = promise._cancellationParent;
- if (parent == null || !parent._isCancellable()) {
- if (promise._isFollowing()) {
- promise._followee().cancel();
- } else {
- promise._cancelBranched();
- }
- break;
- } else {
- if (promise._isFollowing()) promise._followee().cancel();
- promise._setWillBeCancelled();
- child = promise;
- promise = parent;
- }
- }
- };
- Promise.prototype._branchHasCancelled = function() {
- this._branchesRemainingToCancel--;
- };
- Promise.prototype._enoughBranchesHaveCancelled = function() {
- return this._branchesRemainingToCancel === undefined ||
- this._branchesRemainingToCancel <= 0;
- };
- Promise.prototype._cancelBy = function(canceller) {
- if (canceller === this) {
- this._branchesRemainingToCancel = 0;
- this._invokeOnCancel();
- return true;
- } else {
- this._branchHasCancelled();
- if (this._enoughBranchesHaveCancelled()) {
- this._invokeOnCancel();
- return true;
- }
- }
- return false;
- };
- Promise.prototype._cancelBranched = function() {
- if (this._enoughBranchesHaveCancelled()) {
- this._cancel();
- }
- };
- Promise.prototype._cancel = function() {
- if (!this._isCancellable()) return;
- this._setCancelled();
- async.invoke(this._cancelPromises, this, undefined);
- };
- Promise.prototype._cancelPromises = function() {
- if (this._length() > 0) this._settlePromises();
- };
- Promise.prototype._unsetOnCancel = function() {
- this._onCancelField = undefined;
- };
- Promise.prototype._isCancellable = function() {
- return this.isPending() && !this._isCancelled();
- };
- Promise.prototype.isCancellable = function() {
- return this.isPending() && !this.isCancelled();
- };
- Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
- if (util.isArray(onCancelCallback)) {
- for (var i = 0; i < onCancelCallback.length; ++i) {
- this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
- }
- } else if (onCancelCallback !== undefined) {
- if (typeof onCancelCallback === "function") {
- if (!internalOnly) {
- var e = tryCatch(onCancelCallback).call(this._boundValue());
- if (e === errorObj) {
- this._attachExtraTrace(e.e);
- async.throwLater(e.e);
- }
- }
- } else {
- onCancelCallback._resultCancelled(this);
- }
- }
- };
- Promise.prototype._invokeOnCancel = function() {
- var onCancelCallback = this._onCancel();
- this._unsetOnCancel();
- async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
- };
- Promise.prototype._invokeInternalOnCancel = function() {
- if (this._isCancellable()) {
- this._doInvokeOnCancel(this._onCancel(), true);
- this._unsetOnCancel();
- }
- };
- Promise.prototype._resultCancelled = function() {
- this.cancel();
- };
- };
- },{"./util":21}],5:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(NEXT_FILTER) {
- var util = _dereq_("./util");
- var getKeys = _dereq_("./es5").keys;
- var tryCatch = util.tryCatch;
- var errorObj = util.errorObj;
- function catchFilter(instances, cb, promise) {
- return function(e) {
- var boundTo = promise._boundValue();
- predicateLoop: for (var i = 0; i < instances.length; ++i) {
- var item = instances[i];
- if (item === Error ||
- (item != null && item.prototype instanceof Error)) {
- if (e instanceof item) {
- return tryCatch(cb).call(boundTo, e);
- }
- } else if (typeof item === "function") {
- var matchesPredicate = tryCatch(item).call(boundTo, e);
- if (matchesPredicate === errorObj) {
- return matchesPredicate;
- } else if (matchesPredicate) {
- return tryCatch(cb).call(boundTo, e);
- }
- } else if (util.isObject(e)) {
- var keys = getKeys(item);
- for (var j = 0; j < keys.length; ++j) {
- var key = keys[j];
- if (item[key] != e[key]) {
- continue predicateLoop;
- }
- }
- return tryCatch(cb).call(boundTo, e);
- }
- }
- return NEXT_FILTER;
- };
- }
- return catchFilter;
- };
- },{"./es5":10,"./util":21}],6:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(Promise) {
- var longStackTraces = false;
- var contextStack = [];
- Promise.prototype._promiseCreated = function() {};
- Promise.prototype._pushContext = function() {};
- Promise.prototype._popContext = function() {return null;};
- Promise._peekContext = Promise.prototype._peekContext = function() {};
- function Context() {
- this._trace = new Context.CapturedTrace(peekContext());
- }
- Context.prototype._pushContext = function () {
- if (this._trace !== undefined) {
- this._trace._promiseCreated = null;
- contextStack.push(this._trace);
- }
- };
- Context.prototype._popContext = function () {
- if (this._trace !== undefined) {
- var trace = contextStack.pop();
- var ret = trace._promiseCreated;
- trace._promiseCreated = null;
- return ret;
- }
- return null;
- };
- function createContext() {
- if (longStackTraces) return new Context();
- }
- function peekContext() {
- var lastIndex = contextStack.length - 1;
- if (lastIndex >= 0) {
- return contextStack[lastIndex];
- }
- return undefined;
- }
- Context.CapturedTrace = null;
- Context.create = createContext;
- Context.deactivateLongStackTraces = function() {};
- Context.activateLongStackTraces = function() {
- var Promise_pushContext = Promise.prototype._pushContext;
- var Promise_popContext = Promise.prototype._popContext;
- var Promise_PeekContext = Promise._peekContext;
- var Promise_peekContext = Promise.prototype._peekContext;
- var Promise_promiseCreated = Promise.prototype._promiseCreated;
- Context.deactivateLongStackTraces = function() {
- Promise.prototype._pushContext = Promise_pushContext;
- Promise.prototype._popContext = Promise_popContext;
- Promise._peekContext = Promise_PeekContext;
- Promise.prototype._peekContext = Promise_peekContext;
- Promise.prototype._promiseCreated = Promise_promiseCreated;
- longStackTraces = false;
- };
- longStackTraces = true;
- Promise.prototype._pushContext = Context.prototype._pushContext;
- Promise.prototype._popContext = Context.prototype._popContext;
- Promise._peekContext = Promise.prototype._peekContext = peekContext;
- Promise.prototype._promiseCreated = function() {
- var ctx = this._peekContext();
- if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
- };
- };
- return Context;
- };
- },{}],7:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(Promise, Context) {
- var getDomain = Promise._getDomain;
- var async = Promise._async;
- var Warning = _dereq_("./errors").Warning;
- var util = _dereq_("./util");
- var canAttachTrace = util.canAttachTrace;
- var unhandledRejectionHandled;
- var possiblyUnhandledRejection;
- var bluebirdFramePattern =
- /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
- var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
- var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
- var stackFramePattern = null;
- var formatStack = null;
- var indentStackFrames = false;
- var printWarning;
- var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
- (true ||
- util.env("BLUEBIRD_DEBUG") ||
- util.env("NODE_ENV") === "development"));
- var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
- (debugging || util.env("BLUEBIRD_WARNINGS")));
- var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
- (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
- var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
- (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
- Promise.prototype.suppressUnhandledRejections = function() {
- var target = this._target();
- target._bitField = ((target._bitField & (~1048576)) |
- 524288);
- };
- Promise.prototype._ensurePossibleRejectionHandled = function () {
- if ((this._bitField & 524288) !== 0) return;
- this._setRejectionIsUnhandled();
- async.invokeLater(this._notifyUnhandledRejection, this, undefined);
- };
- Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
- fireRejectionEvent("rejectionHandled",
- unhandledRejectionHandled, undefined, this);
- };
- Promise.prototype._setReturnedNonUndefined = function() {
- this._bitField = this._bitField | 268435456;
- };
- Promise.prototype._returnedNonUndefined = function() {
- return (this._bitField & 268435456) !== 0;
- };
- Promise.prototype._notifyUnhandledRejection = function () {
- if (this._isRejectionUnhandled()) {
- var reason = this._settledValue();
- this._setUnhandledRejectionIsNotified();
- fireRejectionEvent("unhandledRejection",
- possiblyUnhandledRejection, reason, this);
- }
- };
- Promise.prototype._setUnhandledRejectionIsNotified = function () {
- this._bitField = this._bitField | 262144;
- };
- Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
- this._bitField = this._bitField & (~262144);
- };
- Promise.prototype._isUnhandledRejectionNotified = function () {
- return (this._bitField & 262144) > 0;
- };
- Promise.prototype._setRejectionIsUnhandled = function () {
- this._bitField = this._bitField | 1048576;
- };
- Promise.prototype._unsetRejectionIsUnhandled = function () {
- this._bitField = this._bitField & (~1048576);
- if (this._isUnhandledRejectionNotified()) {
- this._unsetUnhandledRejectionIsNotified();
- this._notifyUnhandledRejectionIsHandled();
- }
- };
- Promise.prototype._isRejectionUnhandled = function () {
- return (this._bitField & 1048576) > 0;
- };
- Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
- return warn(message, shouldUseOwnTrace, promise || this);
- };
- Promise.onPossiblyUnhandledRejection = function (fn) {
- var domain = getDomain();
- possiblyUnhandledRejection =
- typeof fn === "function" ? (domain === null ?
- fn : util.domainBind(domain, fn))
- : undefined;
- };
- Promise.onUnhandledRejectionHandled = function (fn) {
- var domain = getDomain();
- unhandledRejectionHandled =
- typeof fn === "function" ? (domain === null ?
- fn : util.domainBind(domain, fn))
- : undefined;
- };
- var disableLongStackTraces = function() {};
- Promise.longStackTraces = function () {
- if (async.haveItemsQueued() && !config.longStackTraces) {
- throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
- }
- if (!config.longStackTraces && longStackTracesIsSupported()) {
- var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
- var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
- config.longStackTraces = true;
- disableLongStackTraces = function() {
- if (async.haveItemsQueued() && !config.longStackTraces) {
- throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
- }
- Promise.prototype._captureStackTrace = Promise_captureStackTrace;
- Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
- Context.deactivateLongStackTraces();
- async.enableTrampoline();
- config.longStackTraces = false;
- };
- Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
- Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
- Context.activateLongStackTraces();
- async.disableTrampolineIfNecessary();
- }
- };
- Promise.hasLongStackTraces = function () {
- return config.longStackTraces && longStackTracesIsSupported();
- };
- var fireDomEvent = (function() {
- try {
- if (typeof CustomEvent === "function") {
- var event = new CustomEvent("CustomEvent");
- util.global.dispatchEvent(event);
- return function(name, event) {
- var domEvent = new CustomEvent(name.toLowerCase(), {
- detail: event,
- cancelable: true
- });
- return !util.global.dispatchEvent(domEvent);
- };
- } else if (typeof Event === "function") {
- var event = new Event("CustomEvent");
- util.global.dispatchEvent(event);
- return function(name, event) {
- var domEvent = new Event(name.toLowerCase(), {
- cancelable: true
- });
- domEvent.detail = event;
- return !util.global.dispatchEvent(domEvent);
- };
- } else {
- var event = document.createEvent("CustomEvent");
- event.initCustomEvent("testingtheevent", false, true, {});
- util.global.dispatchEvent(event);
- return function(name, event) {
- var domEvent = document.createEvent("CustomEvent");
- domEvent.initCustomEvent(name.toLowerCase(), false, true,
- event);
- return !util.global.dispatchEvent(domEvent);
- };
- }
- } catch (e) {}
- return function() {
- return false;
- };
- })();
- var fireGlobalEvent = (function() {
- if (util.isNode) {
- return function() {
- return process.emit.apply(process, arguments);
- };
- } else {
- if (!util.global) {
- return function() {
- return false;
- };
- }
- return function(name) {
- var methodName = "on" + name.toLowerCase();
- var method = util.global[methodName];
- if (!method) return false;
- method.apply(util.global, [].slice.call(arguments, 1));
- return true;
- };
- }
- })();
- function generatePromiseLifecycleEventObject(name, promise) {
- return {promise: promise};
- }
- var eventToObjectGenerator = {
- promiseCreated: generatePromiseLifecycleEventObject,
- promiseFulfilled: generatePromiseLifecycleEventObject,
- promiseRejected: generatePromiseLifecycleEventObject,
- promiseResolved: generatePromiseLifecycleEventObject,
- promiseCancelled: generatePromiseLifecycleEventObject,
- promiseChained: function(name, promise, child) {
- return {promise: promise, child: child};
- },
- warning: function(name, warning) {
- return {warning: warning};
- },
- unhandledRejection: function (name, reason, promise) {
- return {reason: reason, promise: promise};
- },
- rejectionHandled: generatePromiseLifecycleEventObject
- };
- var activeFireEvent = function (name) {
- var globalEventFired = false;
- try {
- globalEventFired = fireGlobalEvent.apply(null, arguments);
- } catch (e) {
- async.throwLater(e);
- globalEventFired = true;
- }
- var domEventFired = false;
- try {
- domEventFired = fireDomEvent(name,
- eventToObjectGenerator[name].apply(null, arguments));
- } catch (e) {
- async.throwLater(e);
- domEventFired = true;
- }
- return domEventFired || globalEventFired;
- };
- Promise.config = function(opts) {
- opts = Object(opts);
- if ("longStackTraces" in opts) {
- if (opts.longStackTraces) {
- Promise.longStackTraces();
- } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
- disableLongStackTraces();
- }
- }
- if ("warnings" in opts) {
- var warningsOption = opts.warnings;
- config.warnings = !!warningsOption;
- wForgottenReturn = config.warnings;
- if (util.isObject(warningsOption)) {
- if ("wForgottenReturn" in warningsOption) {
- wForgottenReturn = !!warningsOption.wForgottenReturn;
- }
- }
- }
- if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
- if (async.haveItemsQueued()) {
- throw new Error(
- "cannot enable cancellation after promises are in use");
- }
- Promise.prototype._clearCancellationData =
- cancellationClearCancellationData;
- Promise.prototype._propagateFrom = cancellationPropagateFrom;
- Promise.prototype._onCancel = cancellationOnCancel;
- Promise.prototype._setOnCancel = cancellationSetOnCancel;
- Promise.prototype._attachCancellationCallback =
- cancellationAttachCancellationCallback;
- Promise.prototype._execute = cancellationExecute;
- propagateFromFunction = cancellationPropagateFrom;
- config.cancellation = true;
- }
- if ("monitoring" in opts) {
- if (opts.monitoring && !config.monitoring) {
- config.monitoring = true;
- Promise.prototype._fireEvent = activeFireEvent;
- } else if (!opts.monitoring && config.monitoring) {
- config.monitoring = false;
- Promise.prototype._fireEvent = defaultFireEvent;
- }
- }
- };
- function defaultFireEvent() { return false; }
- Promise.prototype._fireEvent = defaultFireEvent;
- Promise.prototype._execute = function(executor, resolve, reject) {
- try {
- executor(resolve, reject);
- } catch (e) {
- return e;
- }
- };
- Promise.prototype._onCancel = function () {};
- Promise.prototype._setOnCancel = function (handler) { ; };
- Promise.prototype._attachCancellationCallback = function(onCancel) {
- ;
- };
- Promise.prototype._captureStackTrace = function () {};
- Promise.prototype._attachExtraTrace = function () {};
- Promise.prototype._clearCancellationData = function() {};
- Promise.prototype._propagateFrom = function (parent, flags) {
- ;
- ;
- };
- function cancellationExecute(executor, resolve, reject) {
- var promise = this;
- try {
- executor(resolve, reject, function(onCancel) {
- if (typeof onCancel !== "function") {
- throw new TypeError("onCancel must be a function, got: " +
- util.toString(onCancel));
- }
- promise._attachCancellationCallback(onCancel);
- });
- } catch (e) {
- return e;
- }
- }
- function cancellationAttachCancellationCallback(onCancel) {
- if (!this._isCancellable()) return this;
- var previousOnCancel = this._onCancel();
- if (previousOnCancel !== undefined) {
- if (util.isArray(previousOnCancel)) {
- previousOnCancel.push(onCancel);
- } else {
- this._setOnCancel([previousOnCancel, onCancel]);
- }
- } else {
- this._setOnCancel(onCancel);
- }
- }
- function cancellationOnCancel() {
- return this._onCancelField;
- }
- function cancellationSetOnCancel(onCancel) {
- this._onCancelField = onCancel;
- }
- function cancellationClearCancellationData() {
- this._cancellationParent = undefined;
- this._onCancelField = undefined;
- }
- function cancellationPropagateFrom(parent, flags) {
- if ((flags & 1) !== 0) {
- this._cancellationParent = parent;
- var branchesRemainingToCancel = parent._branchesRemainingToCancel;
- if (branchesRemainingToCancel === undefined) {
- branchesRemainingToCancel = 0;
- }
- parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
- }
- if ((flags & 2) !== 0 && parent._isBound()) {
- this._setBoundTo(parent._boundTo);
- }
- }
- function bindingPropagateFrom(parent, flags) {
- if ((flags & 2) !== 0 && parent._isBound()) {
- this._setBoundTo(parent._boundTo);
- }
- }
- var propagateFromFunction = bindingPropagateFrom;
- function boundValueFunction() {
- var ret = this._boundTo;
- if (ret !== undefined) {
- if (ret instanceof Promise) {
- if (ret.isFulfilled()) {
- return ret.value();
- } else {
- return undefined;
- }
- }
- }
- return ret;
- }
- function longStackTracesCaptureStackTrace() {
- this._trace = new CapturedTrace(this._peekContext());
- }
- function longStackTracesAttachExtraTrace(error, ignoreSelf) {
- if (canAttachTrace(error)) {
- var trace = this._trace;
- if (trace !== undefined) {
- if (ignoreSelf) trace = trace._parent;
- }
- if (trace !== undefined) {
- trace.attachExtraTrace(error);
- } else if (!error.__stackCleaned__) {
- var parsed = parseStackAndMessage(error);
- util.notEnumerableProp(error, "stack",
- parsed.message + "\n" + parsed.stack.join("\n"));
- util.notEnumerableProp(error, "__stackCleaned__", true);
- }
- }
- }
- function checkForgottenReturns(returnValue, promiseCreated, name, promise,
- parent) {
- if (returnValue === undefined && promiseCreated !== null &&
- wForgottenReturn) {
- if (parent !== undefined && parent._returnedNonUndefined()) return;
- if ((promise._bitField & 65535) === 0) return;
- if (name) name = name + " ";
- var handlerLine = "";
- var creatorLine = "";
- if (promiseCreated._trace) {
- var traceLines = promiseCreated._trace.stack.split("\n");
- var stack = cleanStack(traceLines);
- for (var i = stack.length - 1; i >= 0; --i) {
- var line = stack[i];
- if (!nodeFramePattern.test(line)) {
- var lineMatches = line.match(parseLinePattern);
- if (lineMatches) {
- handlerLine = "at " + lineMatches[1] +
- ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
- }
- break;
- }
- }
- if (stack.length > 0) {
- var firstUserLine = stack[0];
- for (var i = 0; i < traceLines.length; ++i) {
- if (traceLines[i] === firstUserLine) {
- if (i > 0) {
- creatorLine = "\n" + traceLines[i - 1];
- }
- break;
- }
- }
- }
- }
- var msg = "a promise was created in a " + name +
- "handler " + handlerLine + "but was not returned from it, " +
- "see http://goo.gl/rRqMUw" +
- creatorLine;
- promise._warn(msg, true, promiseCreated);
- }
- }
- function deprecated(name, replacement) {
- var message = name +
- " is deprecated and will be removed in a future version.";
- if (replacement) message += " Use " + replacement + " instead.";
- return warn(message);
- }
- function warn(message, shouldUseOwnTrace, promise) {
- if (!config.warnings) return;
- var warning = new Warning(message);
- var ctx;
- if (shouldUseOwnTrace) {
- promise._attachExtraTrace(warning);
- } else if (config.longStackTraces && (ctx = Promise._peekContext())) {
- ctx.attachExtraTrace(warning);
- } else {
- var parsed = parseStackAndMessage(warning);
- warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
- }
- if (!activeFireEvent("warning", warning)) {
- formatAndLogError(warning, "", true);
- }
- }
- function reconstructStack(message, stacks) {
- for (var i = 0; i < stacks.length - 1; ++i) {
- stacks[i].push("From previous event:");
- stacks[i] = stacks[i].join("\n");
- }
- if (i < stacks.length) {
- stacks[i] = stacks[i].join("\n");
- }
- return message + "\n" + stacks.join("\n");
- }
- function removeDuplicateOrEmptyJumps(stacks) {
- for (var i = 0; i < stacks.length; ++i) {
- if (stacks[i].length === 0 ||
- ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
- stacks.splice(i, 1);
- i--;
- }
- }
- }
- function removeCommonRoots(stacks) {
- var current = stacks[0];
- for (var i = 1; i < stacks.length; ++i) {
- var prev = stacks[i];
- var currentLastIndex = current.length - 1;
- var currentLastLine = current[currentLastIndex];
- var commonRootMeetPoint = -1;
- for (var j = prev.length - 1; j >= 0; --j) {
- if (prev[j] === currentLastLine) {
- commonRootMeetPoint = j;
- break;
- }
- }
- for (var j = commonRootMeetPoint; j >= 0; --j) {
- var line = prev[j];
- if (current[currentLastIndex] === line) {
- current.pop();
- currentLastIndex--;
- } else {
- break;
- }
- }
- current = prev;
- }
- }
- function cleanStack(stack) {
- var ret = [];
- for (var i = 0; i < stack.length; ++i) {
- var line = stack[i];
- var isTraceLine = " (No stack trace)" === line ||
- stackFramePattern.test(line);
- var isInternalFrame = isTraceLine && shouldIgnore(line);
- if (isTraceLine && !isInternalFrame) {
- if (indentStackFrames && line.charAt(0) !== " ") {
- line = " " + line;
- }
- ret.push(line);
- }
- }
- return ret;
- }
- function stackFramesAsArray(error) {
- var stack = error.stack.replace(/\s+$/g, "").split("\n");
- for (var i = 0; i < stack.length; ++i) {
- var line = stack[i];
- if (" (No stack trace)" === line || stackFramePattern.test(line)) {
- break;
- }
- }
- if (i > 0) {
- stack = stack.slice(i);
- }
- return stack;
- }
- function parseStackAndMessage(error) {
- var stack = error.stack;
- var message = error.toString();
- stack = typeof stack === "string" && stack.length > 0
- ? stackFramesAsArray(error) : [" (No stack trace)"];
- return {
- message: message,
- stack: cleanStack(stack)
- };
- }
- function formatAndLogError(error, title, isSoft) {
- if (typeof console !== "undefined") {
- var message;
- if (util.isObject(error)) {
- var stack = error.stack;
- message = title + formatStack(stack, error);
- } else {
- message = title + String(error);
- }
- if (typeof printWarning === "function") {
- printWarning(message, isSoft);
- } else if (typeof console.log === "function" ||
- typeof console.log === "object") {
- console.log(message);
- }
- }
- }
- function fireRejectionEvent(name, localHandler, reason, promise) {
- var localEventFired = false;
- try {
- if (typeof localHandler === "function") {
- localEventFired = true;
- if (name === "rejectionHandled") {
- localHandler(promise);
- } else {
- localHandler(reason, promise);
- }
- }
- } catch (e) {
- async.throwLater(e);
- }
- if (name === "unhandledRejection") {
- if (!activeFireEvent(name, reason, promise) && !localEventFired) {
- formatAndLogError(reason, "Unhandled rejection ");
- }
- } else {
- activeFireEvent(name, promise);
- }
- }
- function formatNonError(obj) {
- var str;
- if (typeof obj === "function") {
- str = "[function " +
- (obj.name || "anonymous") +
- "]";
- } else {
- str = obj && typeof obj.toString === "function"
- ? obj.toString() : util.toString(obj);
- var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
- if (ruselessToString.test(str)) {
- try {
- var newStr = JSON.stringify(obj);
- str = newStr;
- }
- catch(e) {
- }
- }
- if (str.length === 0) {
- str = "(empty array)";
- }
- }
- return ("(<" + snip(str) + ">, no stack trace)");
- }
- function snip(str) {
- var maxChars = 41;
- if (str.length < maxChars) {
- return str;
- }
- return str.substr(0, maxChars - 3) + "...";
- }
- function longStackTracesIsSupported() {
- return typeof captureStackTrace === "function";
- }
- var shouldIgnore = function() { return false; };
- var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
- function parseLineInfo(line) {
- var matches = line.match(parseLineInfoRegex);
- if (matches) {
- return {
- fileName: matches[1],
- line: parseInt(matches[2], 10)
- };
- }
- }
- function setBounds(firstLineError, lastLineError) {
- if (!longStackTracesIsSupported()) return;
- var firstStackLines = firstLineError.stack.split("\n");
- var lastStackLines = lastLineError.stack.split("\n");
- var firstIndex = -1;
- var lastIndex = -1;
- var firstFileName;
- var lastFileName;
- for (var i = 0; i < firstStackLines.length; ++i) {
- var result = parseLineInfo(firstStackLines[i]);
- if (result) {
- firstFileName = result.fileName;
- firstIndex = result.line;
- break;
- }
- }
- for (var i = 0; i < lastStackLines.length; ++i) {
- var result = parseLineInfo(lastStackLines[i]);
- if (result) {
- lastFileName = result.fileName;
- lastIndex = result.line;
- break;
- }
- }
- if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
- firstFileName !== lastFileName || firstIndex >= lastIndex) {
- return;
- }
- shouldIgnore = function(line) {
- if (bluebirdFramePattern.test(line)) return true;
- var info = parseLineInfo(line);
- if (info) {
- if (info.fileName === firstFileName &&
- (firstIndex <= info.line && info.line <= lastIndex)) {
- return true;
- }
- }
- return false;
- };
- }
- function CapturedTrace(parent) {
- this._parent = parent;
- this._promisesCreated = 0;
- var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
- captureStackTrace(this, CapturedTrace);
- if (length > 32) this.uncycle();
- }
- util.inherits(CapturedTrace, Error);
- Context.CapturedTrace = CapturedTrace;
- CapturedTrace.prototype.uncycle = function() {
- var length = this._length;
- if (length < 2) return;
- var nodes = [];
- var stackToIndex = {};
- for (var i = 0, node = this; node !== undefined; ++i) {
- nodes.push(node);
- node = node._parent;
- }
- length = this._length = i;
- for (var i = length - 1; i >= 0; --i) {
- var stack = nodes[i].stack;
- if (stackToIndex[stack] === undefined) {
- stackToIndex[stack] = i;
- }
- }
- for (var i = 0; i < length; ++i) {
- var currentStack = nodes[i].stack;
- var index = stackToIndex[currentStack];
- if (index !== undefined && index !== i) {
- if (index > 0) {
- nodes[index - 1]._parent = undefined;
- nodes[index - 1]._length = 1;
- }
- nodes[i]._parent = undefined;
- nodes[i]._length = 1;
- var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
- if (index < length - 1) {
- cycleEdgeNode._parent = nodes[index + 1];
- cycleEdgeNode._parent.uncycle();
- cycleEdgeNode._length =
- cycleEdgeNode._parent._length + 1;
- } else {
- cycleEdgeNode._parent = undefined;
- cycleEdgeNode._length = 1;
- }
- var currentChildLength = cycleEdgeNode._length + 1;
- for (var j = i - 2; j >= 0; --j) {
- nodes[j]._length = currentChildLength;
- currentChildLength++;
- }
- return;
- }
- }
- };
- CapturedTrace.prototype.attachExtraTrace = function(error) {
- if (error.__stackCleaned__) return;
- this.uncycle();
- var parsed = parseStackAndMessage(error);
- var message = parsed.message;
- var stacks = [parsed.stack];
- var trace = this;
- while (trace !== undefined) {
- stacks.push(cleanStack(trace.stack.split("\n")));
- trace = trace._parent;
- }
- removeCommonRoots(stacks);
- removeDuplicateOrEmptyJumps(stacks);
- util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
- util.notEnumerableProp(error, "__stackCleaned__", true);
- };
- var captureStackTrace = (function stackDetection() {
- var v8stackFramePattern = /^\s*at\s*/;
- var v8stackFormatter = function(stack, error) {
- if (typeof stack === "string") return stack;
- if (error.name !== undefined &&
- error.message !== undefined) {
- return error.toString();
- }
- return formatNonError(error);
- };
- if (typeof Error.stackTraceLimit === "number" &&
- typeof Error.captureStackTrace === "function") {
- Error.stackTraceLimit += 6;
- stackFramePattern = v8stackFramePattern;
- formatStack = v8stackFormatter;
- var captureStackTrace = Error.captureStackTrace;
- shouldIgnore = function(line) {
- return bluebirdFramePattern.test(line);
- };
- return function(receiver, ignoreUntil) {
- Error.stackTraceLimit += 6;
- captureStackTrace(receiver, ignoreUntil);
- Error.stackTraceLimit -= 6;
- };
- }
- var err = new Error();
- if (typeof err.stack === "string" &&
- err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
- stackFramePattern = /@/;
- formatStack = v8stackFormatter;
- indentStackFrames = true;
- return function captureStackTrace(o) {
- o.stack = new Error().stack;
- };
- }
- var hasStackAfterThrow;
- try { throw new Error(); }
- catch(e) {
- hasStackAfterThrow = ("stack" in e);
- }
- if (!("stack" in err) && hasStackAfterThrow &&
- typeof Error.stackTraceLimit === "number") {
- stackFramePattern = v8stackFramePattern;
- formatStack = v8stackFormatter;
- return function captureStackTrace(o) {
- Error.stackTraceLimit += 6;
- try { throw new Error(); }
- catch(e) { o.stack = e.stack; }
- Error.stackTraceLimit -= 6;
- };
- }
- formatStack = function(stack, error) {
- if (typeof stack === "string") return stack;
- if ((typeof error === "object" ||
- typeof error === "function") &&
- error.name !== undefined &&
- error.message !== undefined) {
- return error.toString();
- }
- return formatNonError(error);
- };
- return null;
- })([]);
- if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
- printWarning = function (message) {
- console.warn(message);
- };
- if (util.isNode && process.stderr.isTTY) {
- printWarning = function(message, isSoft) {
- var color = isSoft ? "\u001b[33m" : "\u001b[31m";
- console.warn(color + message + "\u001b[0m\n");
- };
- } else if (!util.isNode && typeof (new Error().stack) === "string") {
- printWarning = function(message, isSoft) {
- console.warn("%c" + message,
- isSoft ? "color: darkorange" : "color: red");
- };
- }
- }
- var config = {
- warnings: warnings,
- longStackTraces: false,
- cancellation: false,
- monitoring: false
- };
- if (longStackTraces) Promise.longStackTraces();
- return {
- longStackTraces: function() {
- return config.longStackTraces;
- },
- warnings: function() {
- return config.warnings;
- },
- cancellation: function() {
- return config.cancellation;
- },
- monitoring: function() {
- return config.monitoring;
- },
- propagateFromFunction: function() {
- return propagateFromFunction;
- },
- boundValueFunction: function() {
- return boundValueFunction;
- },
- checkForgottenReturns: checkForgottenReturns,
- setBounds: setBounds,
- warn: warn,
- deprecated: deprecated,
- CapturedTrace: CapturedTrace,
- fireDomEvent: fireDomEvent,
- fireGlobalEvent: fireGlobalEvent
- };
- };
- },{"./errors":9,"./util":21}],8:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(Promise) {
- function returner() {
- return this.value;
- }
- function thrower() {
- throw this.reason;
- }
- Promise.prototype["return"] =
- Promise.prototype.thenReturn = function (value) {
- if (value instanceof Promise) value.suppressUnhandledRejections();
- return this._then(
- returner, undefined, undefined, {value: value}, undefined);
- };
- Promise.prototype["throw"] =
- Promise.prototype.thenThrow = function (reason) {
- return this._then(
- thrower, undefined, undefined, {reason: reason}, undefined);
- };
- Promise.prototype.catchThrow = function (reason) {
- if (arguments.length <= 1) {
- return this._then(
- undefined, thrower, undefined, {reason: reason}, undefined);
- } else {
- var _reason = arguments[1];
- var handler = function() {throw _reason;};
- return this.caught(reason, handler);
- }
- };
- Promise.prototype.catchReturn = function (value) {
- if (arguments.length <= 1) {
- if (value instanceof Promise) value.suppressUnhandledRejections();
- return this._then(
- undefined, returner, undefined, {value: value}, undefined);
- } else {
- var _value = arguments[1];
- if (_value instanceof Promise) _value.suppressUnhandledRejections();
- var handler = function() {return _value;};
- return this.caught(value, handler);
- }
- };
- };
- },{}],9:[function(_dereq_,module,exports){
- "use strict";
- var es5 = _dereq_("./es5");
- var Objectfreeze = es5.freeze;
- var util = _dereq_("./util");
- var inherits = util.inherits;
- var notEnumerableProp = util.notEnumerableProp;
- function subError(nameProperty, defaultMessage) {
- function SubError(message) {
- if (!(this instanceof SubError)) return new SubError(message);
- notEnumerableProp(this, "message",
- typeof message === "string" ? message : defaultMessage);
- notEnumerableProp(this, "name", nameProperty);
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, this.constructor);
- } else {
- Error.call(this);
- }
- }
- inherits(SubError, Error);
- return SubError;
- }
- var _TypeError, _RangeError;
- var Warning = subError("Warning", "warning");
- var CancellationError = subError("CancellationError", "cancellation error");
- var TimeoutError = subError("TimeoutError", "timeout error");
- var AggregateError = subError("AggregateError", "aggregate error");
- try {
- _TypeError = TypeError;
- _RangeError = RangeError;
- } catch(e) {
- _TypeError = subError("TypeError", "type error");
- _RangeError = subError("RangeError", "range error");
- }
- var methods = ("join pop push shift unshift slice filter forEach some " +
- "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
- for (var i = 0; i < methods.length; ++i) {
- if (typeof Array.prototype[methods[i]] === "function") {
- AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
- }
- }
- es5.defineProperty(AggregateError.prototype, "length", {
- value: 0,
- configurable: false,
- writable: true,
- enumerable: true
- });
- AggregateError.prototype["isOperational"] = true;
- var level = 0;
- AggregateError.prototype.toString = function() {
- var indent = Array(level * 4 + 1).join(" ");
- var ret = "\n" + indent + "AggregateError of:" + "\n";
- level++;
- indent = Array(level * 4 + 1).join(" ");
- for (var i = 0; i < this.length; ++i) {
- var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
- var lines = str.split("\n");
- for (var j = 0; j < lines.length; ++j) {
- lines[j] = indent + lines[j];
- }
- str = lines.join("\n");
- ret += str + "\n";
- }
- level--;
- return ret;
- };
- function OperationalError(message) {
- if (!(this instanceof OperationalError))
- return new OperationalError(message);
- notEnumerableProp(this, "name", "OperationalError");
- notEnumerableProp(this, "message", message);
- this.cause = message;
- this["isOperational"] = true;
- if (message instanceof Error) {
- notEnumerableProp(this, "message", message.message);
- notEnumerableProp(this, "stack", message.stack);
- } else if (Error.captureStackTrace) {
- Error.captureStackTrace(this, this.constructor);
- }
- }
- inherits(OperationalError, Error);
- var errorTypes = Error["__BluebirdErrorTypes__"];
- if (!errorTypes) {
- errorTypes = Objectfreeze({
- CancellationError: CancellationError,
- TimeoutError: TimeoutError,
- OperationalError: OperationalError,
- RejectionError: OperationalError,
- AggregateError: AggregateError
- });
- es5.defineProperty(Error, "__BluebirdErrorTypes__", {
- value: errorTypes,
- writable: false,
- enumerable: false,
- configurable: false
- });
- }
- module.exports = {
- Error: Error,
- TypeError: _TypeError,
- RangeError: _RangeError,
- CancellationError: errorTypes.CancellationError,
- OperationalError: errorTypes.OperationalError,
- TimeoutError: errorTypes.TimeoutError,
- AggregateError: errorTypes.AggregateError,
- Warning: Warning
- };
- },{"./es5":10,"./util":21}],10:[function(_dereq_,module,exports){
- var isES5 = (function(){
- "use strict";
- return this === undefined;
- })();
- if (isES5) {
- module.exports = {
- freeze: Object.freeze,
- defineProperty: Object.defineProperty,
- getDescriptor: Object.getOwnPropertyDescriptor,
- keys: Object.keys,
- names: Object.getOwnPropertyNames,
- getPrototypeOf: Object.getPrototypeOf,
- isArray: Array.isArray,
- isES5: isES5,
- propertyIsWritable: function(obj, prop) {
- var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
- return !!(!descriptor || descriptor.writable || descriptor.set);
- }
- };
- } else {
- var has = {}.hasOwnProperty;
- var str = {}.toString;
- var proto = {}.constructor.prototype;
- var ObjectKeys = function (o) {
- var ret = [];
- for (var key in o) {
- if (has.call(o, key)) {
- ret.push(key);
- }
- }
- return ret;
- };
- var ObjectGetDescriptor = function(o, key) {
- return {value: o[key]};
- };
- var ObjectDefineProperty = function (o, key, desc) {
- o[key] = desc.value;
- return o;
- };
- var ObjectFreeze = function (obj) {
- return obj;
- };
- var ObjectGetPrototypeOf = function (obj) {
- try {
- return Object(obj).constructor.prototype;
- }
- catch (e) {
- return proto;
- }
- };
- var ArrayIsArray = function (obj) {
- try {
- return str.call(obj) === "[object Array]";
- }
- catch(e) {
- return false;
- }
- };
- module.exports = {
- isArray: ArrayIsArray,
- keys: ObjectKeys,
- names: ObjectKeys,
- defineProperty: ObjectDefineProperty,
- getDescriptor: ObjectGetDescriptor,
- freeze: ObjectFreeze,
- getPrototypeOf: ObjectGetPrototypeOf,
- isES5: isES5,
- propertyIsWritable: function() {
- return true;
- }
- };
- }
- },{}],11:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(Promise, tryConvertToPromise) {
- var util = _dereq_("./util");
- var CancellationError = Promise.CancellationError;
- var errorObj = util.errorObj;
- function PassThroughHandlerContext(promise, type, handler) {
- this.promise = promise;
- this.type = type;
- this.handler = handler;
- this.called = false;
- this.cancelPromise = null;
- }
- PassThroughHandlerContext.prototype.isFinallyHandler = function() {
- return this.type === 0;
- };
- function FinallyHandlerCancelReaction(finallyHandler) {
- this.finallyHandler = finallyHandler;
- }
- FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
- checkCancel(this.finallyHandler);
- };
- function checkCancel(ctx, reason) {
- if (ctx.cancelPromise != null) {
- if (arguments.length > 1) {
- ctx.cancelPromise._reject(reason);
- } else {
- ctx.cancelPromise._cancel();
- }
- ctx.cancelPromise = null;
- return true;
- }
- return false;
- }
- function succeed() {
- return finallyHandler.call(this, this.promise._target()._settledValue());
- }
- function fail(reason) {
- if (checkCancel(this, reason)) return;
- errorObj.e = reason;
- return errorObj;
- }
- function finallyHandler(reasonOrValue) {
- var promise = this.promise;
- var handler = this.handler;
- if (!this.called) {
- this.called = true;
- var ret = this.isFinallyHandler()
- ? handler.call(promise._boundValue())
- : handler.call(promise._boundValue(), reasonOrValue);
- if (ret !== undefined) {
- promise._setReturnedNonUndefined();
- var maybePromise = tryConvertToPromise(ret, promise);
- if (maybePromise instanceof Promise) {
- if (this.cancelPromise != null) {
- if (maybePromise._isCancelled()) {
- var reason =
- new CancellationError("late cancellation observer");
- promise._attachExtraTrace(reason);
- errorObj.e = reason;
- return errorObj;
- } else if (maybePromise.isPending()) {
- maybePromise._attachCancellationCallback(
- new FinallyHandlerCancelReaction(this));
- }
- }
- return maybePromise._then(
- succeed, fail, undefined, this, undefined);
- }
- }
- }
- if (promise.isRejected()) {
- checkCancel(this);
- errorObj.e = reasonOrValue;
- return errorObj;
- } else {
- checkCancel(this);
- return reasonOrValue;
- }
- }
- Promise.prototype._passThrough = function(handler, type, success, fail) {
- if (typeof handler !== "function") return this.then();
- return this._then(success,
- fail,
- undefined,
- new PassThroughHandlerContext(this, type, handler),
- undefined);
- };
- Promise.prototype.lastly =
- Promise.prototype["finally"] = function (handler) {
- return this._passThrough(handler,
- 0,
- finallyHandler,
- finallyHandler);
- };
- Promise.prototype.tap = function (handler) {
- return this._passThrough(handler, 1, finallyHandler);
- };
- return PassThroughHandlerContext;
- };
- },{"./util":21}],12:[function(_dereq_,module,exports){
- "use strict";
- module.exports =
- function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,
- getDomain) {
- var util = _dereq_("./util");
- var canEvaluate = util.canEvaluate;
- var tryCatch = util.tryCatch;
- var errorObj = util.errorObj;
- var reject;
- if (!true) {
- if (canEvaluate) {
- var thenCallback = function(i) {
- return new Function("value", "holder", " \n\
- 'use strict'; \n\
- holder.pIndex = value; \n\
- holder.checkFulfillment(this); \n\
- ".replace(/Index/g, i));
- };
- var promiseSetter = function(i) {
- return new Function("promise", "holder", " \n\
- 'use strict'; \n\
- holder.pIndex = promise; \n\
- ".replace(/Index/g, i));
- };
- var generateHolderClass = function(total) {
- var props = new Array(total);
- for (var i = 0; i < props.length; ++i) {
- props[i] = "this.p" + (i+1);
- }
- var assignment = props.join(" = ") + " = null;";
- var cancellationCode= "var promise;\n" + props.map(function(prop) {
- return " \n\
- promise = " + prop + "; \n\
- if (promise instanceof Promise) { \n\
- promise.cancel(); \n\
- } \n\
- ";
- }).join("\n");
- var passedArguments = props.join(", ");
- var name = "Holder$" + total;
- var code = "return function(tryCatch, errorObj, Promise, async) { \n\
- 'use strict'; \n\
- function [TheName](fn) { \n\
- [TheProperties] \n\
- this.fn = fn; \n\
- this.asyncNeeded = true; \n\
- this.now = 0; \n\
- } \n\
- \n\
- [TheName].prototype._callFunction = function(promise) { \n\
- promise._pushContext(); \n\
- var ret = tryCatch(this.fn)([ThePassedArguments]); \n\
- promise._popContext(); \n\
- if (ret === errorObj) { \n\
- promise._rejectCallback(ret.e, false); \n\
- } else { \n\
- promise._resolveCallback(ret); \n\
- } \n\
- }; \n\
- \n\
- [TheName].prototype.checkFulfillment = function(promise) { \n\
- var now = ++this.now; \n\
- if (now === [TheTotal]) { \n\
- if (this.asyncNeeded) { \n\
- async.invoke(this._callFunction, this, promise); \n\
- } else { \n\
- this._callFunction(promise); \n\
- } \n\
- \n\
- } \n\
- }; \n\
- \n\
- [TheName].prototype._resultCancelled = function() { \n\
- [CancellationCode] \n\
- }; \n\
- \n\
- return [TheName]; \n\
- }(tryCatch, errorObj, Promise, async); \n\
- ";
- code = code.replace(/\[TheName\]/g, name)
- .replace(/\[TheTotal\]/g, total)
- .replace(/\[ThePassedArguments\]/g, passedArguments)
- .replace(/\[TheProperties\]/g, assignment)
- .replace(/\[CancellationCode\]/g, cancellationCode);
- return new Function("tryCatch", "errorObj", "Promise", "async", code)
- (tryCatch, errorObj, Promise, async);
- };
- var holderClasses = [];
- var thenCallbacks = [];
- var promiseSetters = [];
- for (var i = 0; i < 8; ++i) {
- holderClasses.push(generateHolderClass(i + 1));
- thenCallbacks.push(thenCallback(i + 1));
- promiseSetters.push(promiseSetter(i + 1));
- }
- reject = function (reason) {
- this._reject(reason);
- };
- }}
- Promise.join = function () {
- var last = arguments.length - 1;
- var fn;
- if (last > 0 && typeof arguments[last] === "function") {
- fn = arguments[last];
- if (!true) {
- if (last <= 8 && canEvaluate) {
- var ret = new Promise(INTERNAL);
- ret._captureStackTrace();
- var HolderClass = holderClasses[last - 1];
- var holder = new HolderClass(fn);
- var callbacks = thenCallbacks;
- for (var i = 0; i < last; ++i) {
- var maybePromise = tryConvertToPromise(arguments[i], ret);
- if (maybePromise instanceof Promise) {
- maybePromise = maybePromise._target();
- var bitField = maybePromise._bitField;
- ;
- if (((bitField & 50397184) === 0)) {
- maybePromise._then(callbacks[i], reject,
- undefined, ret, holder);
- promiseSetters[i](maybePromise, holder);
- holder.asyncNeeded = false;
- } else if (((bitField & 33554432) !== 0)) {
- callbacks[i].call(ret,
- maybePromise._value(), holder);
- } else if (((bitField & 16777216) !== 0)) {
- ret._reject(maybePromise._reason());
- } else {
- ret._cancel();
- }
- } else {
- callbacks[i].call(ret, maybePromise, holder);
- }
- }
- if (!ret._isFateSealed()) {
- if (holder.asyncNeeded) {
- var domain = getDomain();
- if (domain !== null) {
- holder.fn = util.domainBind(domain, holder.fn);
- }
- }
- ret._setAsyncGuaranteed();
- ret._setOnCancel(holder);
- }
- return ret;
- }
- }
- }
- var args = [].slice.call(arguments);;
- if (fn) args.pop();
- var ret = new PromiseArray(args).promise();
- return fn !== undefined ? ret.spread(fn) : ret;
- };
- };
- },{"./util":21}],13:[function(_dereq_,module,exports){
- "use strict";
- module.exports =
- function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
- var util = _dereq_("./util");
- var tryCatch = util.tryCatch;
- Promise.method = function (fn) {
- if (typeof fn !== "function") {
- throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
- }
- return function () {
- var ret = new Promise(INTERNAL);
- ret._captureStackTrace();
- ret._pushContext();
- var value = tryCatch(fn).apply(this, arguments);
- var promiseCreated = ret._popContext();
- debug.checkForgottenReturns(
- value, promiseCreated, "Promise.method", ret);
- ret._resolveFromSyncValue(value);
- return ret;
- };
- };
- Promise.attempt = Promise["try"] = function (fn) {
- if (typeof fn !== "function") {
- return apiRejection("expecting a function but got " + util.classString(fn));
- }
- var ret = new Promise(INTERNAL);
- ret._captureStackTrace();
- ret._pushContext();
- var value;
- if (arguments.length > 1) {
- debug.deprecated("calling Promise.try with more than 1 argument");
- var arg = arguments[1];
- var ctx = arguments[2];
- value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
- : tryCatch(fn).call(ctx, arg);
- } else {
- value = tryCatch(fn)();
- }
- var promiseCreated = ret._popContext();
- debug.checkForgottenReturns(
- value, promiseCreated, "Promise.try", ret);
- ret._resolveFromSyncValue(value);
- return ret;
- };
- Promise.prototype._resolveFromSyncValue = function (value) {
- if (value === util.errorObj) {
- this._rejectCallback(value.e, false);
- } else {
- this._resolveCallback(value, true);
- }
- };
- };
- },{"./util":21}],14:[function(_dereq_,module,exports){
- "use strict";
- var util = _dereq_("./util");
- var maybeWrapAsError = util.maybeWrapAsError;
- var errors = _dereq_("./errors");
- var OperationalError = errors.OperationalError;
- var es5 = _dereq_("./es5");
- function isUntypedError(obj) {
- return obj instanceof Error &&
- es5.getPrototypeOf(obj) === Error.prototype;
- }
- var rErrorKey = /^(?:name|message|stack|cause)$/;
- function wrapAsOperationalError(obj) {
- var ret;
- if (isUntypedError(obj)) {
- ret = new OperationalError(obj);
- ret.name = obj.name;
- ret.message = obj.message;
- ret.stack = obj.stack;
- var keys = es5.keys(obj);
- for (var i = 0; i < keys.length; ++i) {
- var key = keys[i];
- if (!rErrorKey.test(key)) {
- ret[key] = obj[key];
- }
- }
- return ret;
- }
- util.markAsOriginatingFromRejection(obj);
- return obj;
- }
- function nodebackForPromise(promise, multiArgs) {
- return function(err, value) {
- if (promise === null) return;
- if (err) {
- var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
- promise._attachExtraTrace(wrapped);
- promise._reject(wrapped);
- } else if (!multiArgs) {
- promise._fulfill(value);
- } else {
- var args = [].slice.call(arguments, 1);;
- promise._fulfill(args);
- }
- promise = null;
- };
- }
- module.exports = nodebackForPromise;
- },{"./errors":9,"./es5":10,"./util":21}],15:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function() {
- var makeSelfResolutionError = function () {
- return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a");
- };
- var reflectHandler = function() {
- return new Promise.PromiseInspection(this._target());
- };
- var apiRejection = function(msg) {
- return Promise.reject(new TypeError(msg));
- };
- function Proxyable() {}
- var UNDEFINED_BINDING = {};
- var util = _dereq_("./util");
- var getDomain;
- if (util.isNode) {
- getDomain = function() {
- var ret = process.domain;
- if (ret === undefined) ret = null;
- return ret;
- };
- } else {
- getDomain = function() {
- return null;
- };
- }
- util.notEnumerableProp(Promise, "_getDomain", getDomain);
- var es5 = _dereq_("./es5");
- var Async = _dereq_("./async");
- var async = new Async();
- es5.defineProperty(Promise, "_async", {value: async});
- var errors = _dereq_("./errors");
- var TypeError = Promise.TypeError = errors.TypeError;
- Promise.RangeError = errors.RangeError;
- var CancellationError = Promise.CancellationError = errors.CancellationError;
- Promise.TimeoutError = errors.TimeoutError;
- Promise.OperationalError = errors.OperationalError;
- Promise.RejectionError = errors.OperationalError;
- Promise.AggregateError = errors.AggregateError;
- var INTERNAL = function(){};
- var APPLY = {};
- var NEXT_FILTER = {};
- var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL);
- var PromiseArray =
- _dereq_("./promise_array")(Promise, INTERNAL,
- tryConvertToPromise, apiRejection, Proxyable);
- var Context = _dereq_("./context")(Promise);
- /*jshint unused:false*/
- var createContext = Context.create;
- var debug = _dereq_("./debuggability")(Promise, Context);
- var CapturedTrace = debug.CapturedTrace;
- var PassThroughHandlerContext =
- _dereq_("./finally")(Promise, tryConvertToPromise);
- var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER);
- var nodebackForPromise = _dereq_("./nodeback");
- var errorObj = util.errorObj;
- var tryCatch = util.tryCatch;
- function check(self, executor) {
- if (typeof executor !== "function") {
- throw new TypeError("expecting a function but got " + util.classString(executor));
- }
- if (self.constructor !== Promise) {
- throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
- }
- }
- function Promise(executor) {
- this._bitField = 0;
- this._fulfillmentHandler0 = undefined;
- this._rejectionHandler0 = undefined;
- this._promise0 = undefined;
- this._receiver0 = undefined;
- if (executor !== INTERNAL) {
- check(this, executor);
- this._resolveFromExecutor(executor);
- }
- this._promiseCreated();
- this._fireEvent("promiseCreated", this);
- }
- Promise.prototype.toString = function () {
- return "[object Promise]";
- };
- Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
- var len = arguments.length;
- if (len > 1) {
- var catchInstances = new Array(len - 1),
- j = 0, i;
- for (i = 0; i < len - 1; ++i) {
- var item = arguments[i];
- if (util.isObject(item)) {
- catchInstances[j++] = item;
- } else {
- return apiRejection("expecting an object but got " +
- "A catch statement predicate " + util.classString(item));
- }
- }
- catchInstances.length = j;
- fn = arguments[i];
- return this.then(undefined, catchFilter(catchInstances, fn, this));
- }
- return this.then(undefined, fn);
- };
- Promise.prototype.reflect = function () {
- return this._then(reflectHandler,
- reflectHandler, undefined, this, undefined);
- };
- Promise.prototype.then = function (didFulfill, didReject) {
- if (debug.warnings() && arguments.length > 0 &&
- typeof didFulfill !== "function" &&
- typeof didReject !== "function") {
- var msg = ".then() only accepts functions but was passed: " +
- util.classString(didFulfill);
- if (arguments.length > 1) {
- msg += ", " + util.classString(didReject);
- }
- this._warn(msg);
- }
- return this._then(didFulfill, didReject, undefined, undefined, undefined);
- };
- Promise.prototype.done = function (didFulfill, didReject) {
- var promise =
- this._then(didFulfill, didReject, undefined, undefined, undefined);
- promise._setIsFinal();
- };
- Promise.prototype.spread = function (fn) {
- if (typeof fn !== "function") {
- return apiRejection("expecting a function but got " + util.classString(fn));
- }
- return this.all()._then(fn, undefined, undefined, APPLY, undefined);
- };
- Promise.prototype.toJSON = function () {
- var ret = {
- isFulfilled: false,
- isRejected: false,
- fulfillmentValue: undefined,
- rejectionReason: undefined
- };
- if (this.isFulfilled()) {
- ret.fulfillmentValue = this.value();
- ret.isFulfilled = true;
- } else if (this.isRejected()) {
- ret.rejectionReason = this.reason();
- ret.isRejected = true;
- }
- return ret;
- };
- Promise.prototype.all = function () {
- if (arguments.length > 0) {
- this._warn(".all() was passed arguments but it does not take any");
- }
- return new PromiseArray(this).promise();
- };
- Promise.prototype.error = function (fn) {
- return this.caught(util.originatesFromRejection, fn);
- };
- Promise.getNewLibraryCopy = module.exports;
- Promise.is = function (val) {
- return val instanceof Promise;
- };
- Promise.fromNode = Promise.fromCallback = function(fn) {
- var ret = new Promise(INTERNAL);
- ret._captureStackTrace();
- var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
- : false;
- var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
- if (result === errorObj) {
- ret._rejectCallback(result.e, true);
- }
- if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
- return ret;
- };
- Promise.all = function (promises) {
- return new PromiseArray(promises).promise();
- };
- Promise.cast = function (obj) {
- var ret = tryConvertToPromise(obj);
- if (!(ret instanceof Promise)) {
- ret = new Promise(INTERNAL);
- ret._captureStackTrace();
- ret._setFulfilled();
- ret._rejectionHandler0 = obj;
- }
- return ret;
- };
- Promise.resolve = Promise.fulfilled = Promise.cast;
- Promise.reject = Promise.rejected = function (reason) {
- var ret = new Promise(INTERNAL);
- ret._captureStackTrace();
- ret._rejectCallback(reason, true);
- return ret;
- };
- Promise.setScheduler = function(fn) {
- if (typeof fn !== "function") {
- throw new TypeError("expecting a function but got " + util.classString(fn));
- }
- return async.setScheduler(fn);
- };
- Promise.prototype._then = function (
- didFulfill,
- didReject,
- _, receiver,
- internalData
- ) {
- var haveInternalData = internalData !== undefined;
- var promise = haveInternalData ? internalData : new Promise(INTERNAL);
- var target = this._target();
- var bitField = target._bitField;
- if (!haveInternalData) {
- promise._propagateFrom(this, 3);
- promise._captureStackTrace();
- if (receiver === undefined &&
- ((this._bitField & 2097152) !== 0)) {
- if (!((bitField & 50397184) === 0)) {
- receiver = this._boundValue();
- } else {
- receiver = target === this ? undefined : this._boundTo;
- }
- }
- this._fireEvent("promiseChained", this, promise);
- }
- var domain = getDomain();
- if (!((bitField & 50397184) === 0)) {
- var handler, value, settler = target._settlePromiseCtx;
- if (((bitField & 33554432) !== 0)) {
- value = target._rejectionHandler0;
- handler = didFulfill;
- } else if (((bitField & 16777216) !== 0)) {
- value = target._fulfillmentHandler0;
- handler = didReject;
- target._unsetRejectionIsUnhandled();
- } else {
- settler = target._settlePromiseLateCancellationObserver;
- value = new CancellationError("late cancellation observer");
- target._attachExtraTrace(value);
- handler = didReject;
- }
- async.invoke(settler, target, {
- handler: domain === null ? handler
- : (typeof handler === "function" &&
- util.domainBind(domain, handler)),
- promise: promise,
- receiver: receiver,
- value: value
- });
- } else {
- target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
- }
- return promise;
- };
- Promise.prototype._length = function () {
- return this._bitField & 65535;
- };
- Promise.prototype._isFateSealed = function () {
- return (this._bitField & 117506048) !== 0;
- };
- Promise.prototype._isFollowing = function () {
- return (this._bitField & 67108864) === 67108864;
- };
- Promise.prototype._setLength = function (len) {
- this._bitField = (this._bitField & -65536) |
- (len & 65535);
- };
- Promise.prototype._setFulfilled = function () {
- this._bitField = this._bitField | 33554432;
- this._fireEvent("promiseFulfilled", this);
- };
- Promise.prototype._setRejected = function () {
- this._bitField = this._bitField | 16777216;
- this._fireEvent("promiseRejected", this);
- };
- Promise.prototype._setFollowing = function () {
- this._bitField = this._bitField | 67108864;
- this._fireEvent("promiseResolved", this);
- };
- Promise.prototype._setIsFinal = function () {
- this._bitField = this._bitField | 4194304;
- };
- Promise.prototype._isFinal = function () {
- return (this._bitField & 4194304) > 0;
- };
- Promise.prototype._unsetCancelled = function() {
- this._bitField = this._bitField & (~65536);
- };
- Promise.prototype._setCancelled = function() {
- this._bitField = this._bitField | 65536;
- this._fireEvent("promiseCancelled", this);
- };
- Promise.prototype._setWillBeCancelled = function() {
- this._bitField = this._bitField | 8388608;
- };
- Promise.prototype._setAsyncGuaranteed = function() {
- if (async.hasCustomScheduler()) return;
- this._bitField = this._bitField | 134217728;
- };
- Promise.prototype._receiverAt = function (index) {
- var ret = index === 0 ? this._receiver0 : this[
- index * 4 - 4 + 3];
- if (ret === UNDEFINED_BINDING) {
- return undefined;
- } else if (ret === undefined && this._isBound()) {
- return this._boundValue();
- }
- return ret;
- };
- Promise.prototype._promiseAt = function (index) {
- return this[
- index * 4 - 4 + 2];
- };
- Promise.prototype._fulfillmentHandlerAt = function (index) {
- return this[
- index * 4 - 4 + 0];
- };
- Promise.prototype._rejectionHandlerAt = function (index) {
- return this[
- index * 4 - 4 + 1];
- };
- Promise.prototype._boundValue = function() {};
- Promise.prototype._migrateCallback0 = function (follower) {
- var bitField = follower._bitField;
- var fulfill = follower._fulfillmentHandler0;
- var reject = follower._rejectionHandler0;
- var promise = follower._promise0;
- var receiver = follower._receiverAt(0);
- if (receiver === undefined) receiver = UNDEFINED_BINDING;
- this._addCallbacks(fulfill, reject, promise, receiver, null);
- };
- Promise.prototype._migrateCallbackAt = function (follower, index) {
- var fulfill = follower._fulfillmentHandlerAt(index);
- var reject = follower._rejectionHandlerAt(index);
- var promise = follower._promiseAt(index);
- var receiver = follower._receiverAt(index);
- if (receiver === undefined) receiver = UNDEFINED_BINDING;
- this._addCallbacks(fulfill, reject, promise, receiver, null);
- };
- Promise.prototype._addCallbacks = function (
- fulfill,
- reject,
- promise,
- receiver,
- domain
- ) {
- var index = this._length();
- if (index >= 65535 - 4) {
- index = 0;
- this._setLength(0);
- }
- if (index === 0) {
- this._promise0 = promise;
- this._receiver0 = receiver;
- if (typeof fulfill === "function") {
- this._fulfillmentHandler0 =
- domain === null ? fulfill : util.domainBind(domain, fulfill);
- }
- if (typeof reject === "function") {
- this._rejectionHandler0 =
- domain === null ? reject : util.domainBind(domain, reject);
- }
- } else {
- var base = index * 4 - 4;
- this[base + 2] = promise;
- this[base + 3] = receiver;
- if (typeof fulfill === "function") {
- this[base + 0] =
- domain === null ? fulfill : util.domainBind(domain, fulfill);
- }
- if (typeof reject === "function") {
- this[base + 1] =
- domain === null ? reject : util.domainBind(domain, reject);
- }
- }
- this._setLength(index + 1);
- return index;
- };
- Promise.prototype._proxy = function (proxyable, arg) {
- this._addCallbacks(undefined, undefined, arg, proxyable, null);
- };
- Promise.prototype._resolveCallback = function(value, shouldBind) {
- if (((this._bitField & 117506048) !== 0)) return;
- if (value === this)
- return this._rejectCallback(makeSelfResolutionError(), false);
- var maybePromise = tryConvertToPromise(value, this);
- if (!(maybePromise instanceof Promise)) return this._fulfill(value);
- if (shouldBind) this._propagateFrom(maybePromise, 2);
- var promise = maybePromise._target();
- if (promise === this) {
- this._reject(makeSelfResolutionError());
- return;
- }
- var bitField = promise._bitField;
- if (((bitField & 50397184) === 0)) {
- var len = this._length();
- if (len > 0) promise._migrateCallback0(this);
- for (var i = 1; i < len; ++i) {
- promise._migrateCallbackAt(this, i);
- }
- this._setFollowing();
- this._setLength(0);
- this._setFollowee(promise);
- } else if (((bitField & 33554432) !== 0)) {
- this._fulfill(promise._value());
- } else if (((bitField & 16777216) !== 0)) {
- this._reject(promise._reason());
- } else {
- var reason = new CancellationError("late cancellation observer");
- promise._attachExtraTrace(reason);
- this._reject(reason);
- }
- };
- Promise.prototype._rejectCallback =
- function(reason, synchronous, ignoreNonErrorWarnings) {
- var trace = util.ensureErrorObject(reason);
- var hasStack = trace === reason;
- if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
- var message = "a promise was rejected with a non-error: " +
- util.classString(reason);
- this._warn(message, true);
- }
- this._attachExtraTrace(trace, synchronous ? hasStack : false);
- this._reject(reason);
- };
- Promise.prototype._resolveFromExecutor = function (executor) {
- var promise = this;
- this._captureStackTrace();
- this._pushContext();
- var synchronous = true;
- var r = this._execute(executor, function(value) {
- promise._resolveCallback(value);
- }, function (reason) {
- promise._rejectCallback(reason, synchronous);
- });
- synchronous = false;
- this._popContext();
- if (r !== undefined) {
- promise._rejectCallback(r, true);
- }
- };
- Promise.prototype._settlePromiseFromHandler = function (
- handler, receiver, value, promise
- ) {
- var bitField = promise._bitField;
- if (((bitField & 65536) !== 0)) return;
- promise._pushContext();
- var x;
- if (receiver === APPLY) {
- if (!value || typeof value.length !== "number") {
- x = errorObj;
- x.e = new TypeError("cannot .spread() a non-array: " +
- util.classString(value));
- } else {
- x = tryCatch(handler).apply(this._boundValue(), value);
- }
- } else {
- x = tryCatch(handler).call(receiver, value);
- }
- var promiseCreated = promise._popContext();
- bitField = promise._bitField;
- if (((bitField & 65536) !== 0)) return;
- if (x === NEXT_FILTER) {
- promise._reject(value);
- } else if (x === errorObj) {
- promise._rejectCallback(x.e, false);
- } else {
- debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
- promise._resolveCallback(x);
- }
- };
- Promise.prototype._target = function() {
- var ret = this;
- while (ret._isFollowing()) ret = ret._followee();
- return ret;
- };
- Promise.prototype._followee = function() {
- return this._rejectionHandler0;
- };
- Promise.prototype._setFollowee = function(promise) {
- this._rejectionHandler0 = promise;
- };
- Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
- var isPromise = promise instanceof Promise;
- var bitField = this._bitField;
- var asyncGuaranteed = ((bitField & 134217728) !== 0);
- if (((bitField & 65536) !== 0)) {
- if (isPromise) promise._invokeInternalOnCancel();
- if (receiver instanceof PassThroughHandlerContext &&
- receiver.isFinallyHandler()) {
- receiver.cancelPromise = promise;
- if (tryCatch(handler).call(receiver, value) === errorObj) {
- promise._reject(errorObj.e);
- }
- } else if (handler === reflectHandler) {
- promise._fulfill(reflectHandler.call(receiver));
- } else if (receiver instanceof Proxyable) {
- receiver._promiseCancelled(promise);
- } else if (isPromise || promise instanceof PromiseArray) {
- promise._cancel();
- } else {
- receiver.cancel();
- }
- } else if (typeof handler === "function") {
- if (!isPromise) {
- handler.call(receiver, value, promise);
- } else {
- if (asyncGuaranteed) promise._setAsyncGuaranteed();
- this._settlePromiseFromHandler(handler, receiver, value, promise);
- }
- } else if (receiver instanceof Proxyable) {
- if (!receiver._isResolved()) {
- if (((bitField & 33554432) !== 0)) {
- receiver._promiseFulfilled(value, promise);
- } else {
- receiver._promiseRejected(value, promise);
- }
- }
- } else if (isPromise) {
- if (asyncGuaranteed) promise._setAsyncGuaranteed();
- if (((bitField & 33554432) !== 0)) {
- promise._fulfill(value);
- } else {
- promise._reject(value);
- }
- }
- };
- Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
- var handler = ctx.handler;
- var promise = ctx.promise;
- var receiver = ctx.receiver;
- var value = ctx.value;
- if (typeof handler === "function") {
- if (!(promise instanceof Promise)) {
- handler.call(receiver, value, promise);
- } else {
- this._settlePromiseFromHandler(handler, receiver, value, promise);
- }
- } else if (promise instanceof Promise) {
- promise._reject(value);
- }
- };
- Promise.prototype._settlePromiseCtx = function(ctx) {
- this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
- };
- Promise.prototype._settlePromise0 = function(handler, value, bitField) {
- var promise = this._promise0;
- var receiver = this._receiverAt(0);
- this._promise0 = undefined;
- this._receiver0 = undefined;
- this._settlePromise(promise, handler, receiver, value);
- };
- Promise.prototype._clearCallbackDataAtIndex = function(index) {
- var base = index * 4 - 4;
- this[base + 2] =
- this[base + 3] =
- this[base + 0] =
- this[base + 1] = undefined;
- };
- Promise.prototype._fulfill = function (value) {
- var bitField = this._bitField;
- if (((bitField & 117506048) >>> 16)) return;
- if (value === this) {
- var err = makeSelfResolutionError();
- this._attachExtraTrace(err);
- return this._reject(err);
- }
- this._setFulfilled();
- this._rejectionHandler0 = value;
- if ((bitField & 65535) > 0) {
- if (((bitField & 134217728) !== 0)) {
- this._settlePromises();
- } else {
- async.settlePromises(this);
- }
- }
- };
- Promise.prototype._reject = function (reason) {
- var bitField = this._bitField;
- if (((bitField & 117506048) >>> 16)) return;
- this._setRejected();
- this._fulfillmentHandler0 = reason;
- if (this._isFinal()) {
- return async.fatalError(reason, util.isNode);
- }
- if ((bitField & 65535) > 0) {
- async.settlePromises(this);
- } else {
- this._ensurePossibleRejectionHandled();
- }
- };
- Promise.prototype._fulfillPromises = function (len, value) {
- for (var i = 1; i < len; i++) {
- var handler = this._fulfillmentHandlerAt(i);
- var promise = this._promiseAt(i);
- var receiver = this._receiverAt(i);
- this._clearCallbackDataAtIndex(i);
- this._settlePromise(promise, handler, receiver, value);
- }
- };
- Promise.prototype._rejectPromises = function (len, reason) {
- for (var i = 1; i < len; i++) {
- var handler = this._rejectionHandlerAt(i);
- var promise = this._promiseAt(i);
- var receiver = this._receiverAt(i);
- this._clearCallbackDataAtIndex(i);
- this._settlePromise(promise, handler, receiver, reason);
- }
- };
- Promise.prototype._settlePromises = function () {
- var bitField = this._bitField;
- var len = (bitField & 65535);
- if (len > 0) {
- if (((bitField & 16842752) !== 0)) {
- var reason = this._fulfillmentHandler0;
- this._settlePromise0(this._rejectionHandler0, reason, bitField);
- this._rejectPromises(len, reason);
- } else {
- var value = this._rejectionHandler0;
- this._settlePromise0(this._fulfillmentHandler0, value, bitField);
- this._fulfillPromises(len, value);
- }
- this._setLength(0);
- }
- this._clearCancellationData();
- };
- Promise.prototype._settledValue = function() {
- var bitField = this._bitField;
- if (((bitField & 33554432) !== 0)) {
- return this._rejectionHandler0;
- } else if (((bitField & 16777216) !== 0)) {
- return this._fulfillmentHandler0;
- }
- };
- function deferResolve(v) {this.promise._resolveCallback(v);}
- function deferReject(v) {this.promise._rejectCallback(v, false);}
- Promise.defer = Promise.pending = function() {
- debug.deprecated("Promise.defer", "new Promise");
- var promise = new Promise(INTERNAL);
- return {
- promise: promise,
- resolve: deferResolve,
- reject: deferReject
- };
- };
- util.notEnumerableProp(Promise,
- "_makeSelfResolutionError",
- makeSelfResolutionError);
- _dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection,
- debug);
- _dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug);
- _dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug);
- _dereq_("./direct_resolve")(Promise);
- _dereq_("./synchronous_inspection")(Promise);
- _dereq_("./join")(
- Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
- Promise.Promise = Promise;
- Promise.version = "3.4.6";
-
- util.toFastProperties(Promise);
- util.toFastProperties(Promise.prototype);
- function fillTypes(value) {
- var p = new Promise(INTERNAL);
- p._fulfillmentHandler0 = value;
- p._rejectionHandler0 = value;
- p._promise0 = value;
- p._receiver0 = value;
- }
- // Complete slack tracking, opt out of field-type tracking and
- // stabilize map
- fillTypes({a: 1});
- fillTypes({b: 2});
- fillTypes({c: 3});
- fillTypes(1);
- fillTypes(function(){});
- fillTypes(undefined);
- fillTypes(false);
- fillTypes(new Promise(INTERNAL));
- debug.setBounds(Async.firstLineError, util.lastLineError);
- return Promise;
- };
- },{"./async":1,"./bind":2,"./cancel":4,"./catch_filter":5,"./context":6,"./debuggability":7,"./direct_resolve":8,"./errors":9,"./es5":10,"./finally":11,"./join":12,"./method":13,"./nodeback":14,"./promise_array":16,"./synchronous_inspection":19,"./thenables":20,"./util":21}],16:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(Promise, INTERNAL, tryConvertToPromise,
- apiRejection, Proxyable) {
- var util = _dereq_("./util");
- var isArray = util.isArray;
- function toResolutionValue(val) {
- switch(val) {
- case -2: return [];
- case -3: return {};
- }
- }
- function PromiseArray(values) {
- var promise = this._promise = new Promise(INTERNAL);
- if (values instanceof Promise) {
- promise._propagateFrom(values, 3);
- }
- promise._setOnCancel(this);
- this._values = values;
- this._length = 0;
- this._totalResolved = 0;
- this._init(undefined, -2);
- }
- util.inherits(PromiseArray, Proxyable);
- PromiseArray.prototype.length = function () {
- return this._length;
- };
- PromiseArray.prototype.promise = function () {
- return this._promise;
- };
- PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
- var values = tryConvertToPromise(this._values, this._promise);
- if (values instanceof Promise) {
- values = values._target();
- var bitField = values._bitField;
- ;
- this._values = values;
- if (((bitField & 50397184) === 0)) {
- this._promise._setAsyncGuaranteed();
- return values._then(
- init,
- this._reject,
- undefined,
- this,
- resolveValueIfEmpty
- );
- } else if (((bitField & 33554432) !== 0)) {
- values = values._value();
- } else if (((bitField & 16777216) !== 0)) {
- return this._reject(values._reason());
- } else {
- return this._cancel();
- }
- }
- values = util.asArray(values);
- if (values === null) {
- var err = apiRejection(
- "expecting an array or an iterable object but got " + util.classString(values)).reason();
- this._promise._rejectCallback(err, false);
- return;
- }
- if (values.length === 0) {
- if (resolveValueIfEmpty === -5) {
- this._resolveEmptyArray();
- }
- else {
- this._resolve(toResolutionValue(resolveValueIfEmpty));
- }
- return;
- }
- this._iterate(values);
- };
- PromiseArray.prototype._iterate = function(values) {
- var len = this.getActualLength(values.length);
- this._length = len;
- this._values = this.shouldCopyValues() ? new Array(len) : this._values;
- var result = this._promise;
- var isResolved = false;
- var bitField = null;
- for (var i = 0; i < len; ++i) {
- var maybePromise = tryConvertToPromise(values[i], result);
- if (maybePromise instanceof Promise) {
- maybePromise = maybePromise._target();
- bitField = maybePromise._bitField;
- } else {
- bitField = null;
- }
- if (isResolved) {
- if (bitField !== null) {
- maybePromise.suppressUnhandledRejections();
- }
- } else if (bitField !== null) {
- if (((bitField & 50397184) === 0)) {
- maybePromise._proxy(this, i);
- this._values[i] = maybePromise;
- } else if (((bitField & 33554432) !== 0)) {
- isResolved = this._promiseFulfilled(maybePromise._value(), i);
- } else if (((bitField & 16777216) !== 0)) {
- isResolved = this._promiseRejected(maybePromise._reason(), i);
- } else {
- isResolved = this._promiseCancelled(i);
- }
- } else {
- isResolved = this._promiseFulfilled(maybePromise, i);
- }
- }
- if (!isResolved) result._setAsyncGuaranteed();
- };
- PromiseArray.prototype._isResolved = function () {
- return this._values === null;
- };
- PromiseArray.prototype._resolve = function (value) {
- this._values = null;
- this._promise._fulfill(value);
- };
- PromiseArray.prototype._cancel = function() {
- if (this._isResolved() || !this._promise._isCancellable()) return;
- this._values = null;
- this._promise._cancel();
- };
- PromiseArray.prototype._reject = function (reason) {
- this._values = null;
- this._promise._rejectCallback(reason, false);
- };
- PromiseArray.prototype._promiseFulfilled = function (value, index) {
- this._values[index] = value;
- var totalResolved = ++this._totalResolved;
- if (totalResolved >= this._length) {
- this._resolve(this._values);
- return true;
- }
- return false;
- };
- PromiseArray.prototype._promiseCancelled = function() {
- this._cancel();
- return true;
- };
- PromiseArray.prototype._promiseRejected = function (reason) {
- this._totalResolved++;
- this._reject(reason);
- return true;
- };
- PromiseArray.prototype._resultCancelled = function() {
- if (this._isResolved()) return;
- var values = this._values;
- this._cancel();
- if (values instanceof Promise) {
- values.cancel();
- } else {
- for (var i = 0; i < values.length; ++i) {
- if (values[i] instanceof Promise) {
- values[i].cancel();
- }
- }
- }
- };
- PromiseArray.prototype.shouldCopyValues = function () {
- return true;
- };
- PromiseArray.prototype.getActualLength = function (len) {
- return len;
- };
- return PromiseArray;
- };
- },{"./util":21}],17:[function(_dereq_,module,exports){
- "use strict";
- function arrayMove(src, srcIndex, dst, dstIndex, len) {
- for (var j = 0; j < len; ++j) {
- dst[j + dstIndex] = src[j + srcIndex];
- src[j + srcIndex] = void 0;
- }
- }
- function Queue(capacity) {
- this._capacity = capacity;
- this._length = 0;
- this._front = 0;
- }
- Queue.prototype._willBeOverCapacity = function (size) {
- return this._capacity < size;
- };
- Queue.prototype._pushOne = function (arg) {
- var length = this.length();
- this._checkCapacity(length + 1);
- var i = (this._front + length) & (this._capacity - 1);
- this[i] = arg;
- this._length = length + 1;
- };
- Queue.prototype._unshiftOne = function(value) {
- var capacity = this._capacity;
- this._checkCapacity(this.length() + 1);
- var front = this._front;
- var i = (((( front - 1 ) &
- ( capacity - 1) ) ^ capacity ) - capacity );
- this[i] = value;
- this._front = i;
- this._length = this.length() + 1;
- };
- Queue.prototype.unshift = function(fn, receiver, arg) {
- this._unshiftOne(arg);
- this._unshiftOne(receiver);
- this._unshiftOne(fn);
- };
- Queue.prototype.push = function (fn, receiver, arg) {
- var length = this.length() + 3;
- if (this._willBeOverCapacity(length)) {
- this._pushOne(fn);
- this._pushOne(receiver);
- this._pushOne(arg);
- return;
- }
- var j = this._front + length - 3;
- this._checkCapacity(length);
- var wrapMask = this._capacity - 1;
- this[(j + 0) & wrapMask] = fn;
- this[(j + 1) & wrapMask] = receiver;
- this[(j + 2) & wrapMask] = arg;
- this._length = length;
- };
- Queue.prototype.shift = function () {
- var front = this._front,
- ret = this[front];
- this[front] = undefined;
- this._front = (front + 1) & (this._capacity - 1);
- this._length--;
- return ret;
- };
- Queue.prototype.length = function () {
- return this._length;
- };
- Queue.prototype._checkCapacity = function (size) {
- if (this._capacity < size) {
- this._resizeTo(this._capacity << 1);
- }
- };
- Queue.prototype._resizeTo = function (capacity) {
- var oldCapacity = this._capacity;
- this._capacity = capacity;
- var front = this._front;
- var length = this._length;
- var moveItemsCount = (front + length) & (oldCapacity - 1);
- arrayMove(this, 0, this, oldCapacity, moveItemsCount);
- };
- module.exports = Queue;
- },{}],18:[function(_dereq_,module,exports){
- "use strict";
- var util = _dereq_("./util");
- var schedule;
- var noAsyncScheduler = function() {
- throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
- };
- var NativePromise = util.getNativePromise();
- if (util.isNode && typeof MutationObserver === "undefined") {
- var GlobalSetImmediate = global.setImmediate;
- var ProcessNextTick = process.nextTick;
- schedule = util.isRecentNode
- ? function(fn) { GlobalSetImmediate.call(global, fn); }
- : function(fn) { ProcessNextTick.call(process, fn); };
- } else if (typeof NativePromise === "function" &&
- typeof NativePromise.resolve === "function") {
- var nativePromise = NativePromise.resolve();
- schedule = function(fn) {
- nativePromise.then(fn);
- };
- } else if ((typeof MutationObserver !== "undefined") &&
- !(typeof window !== "undefined" &&
- window.navigator &&
- (window.navigator.standalone || window.cordova))) {
- schedule = (function() {
- var div = document.createElement("div");
- var opts = {attributes: true};
- var toggleScheduled = false;
- var div2 = document.createElement("div");
- var o2 = new MutationObserver(function() {
- div.classList.toggle("foo");
- toggleScheduled = false;
- });
- o2.observe(div2, opts);
- var scheduleToggle = function() {
- if (toggleScheduled) return;
- toggleScheduled = true;
- div2.classList.toggle("foo");
- };
- return function schedule(fn) {
- var o = new MutationObserver(function() {
- o.disconnect();
- fn();
- });
- o.observe(div, opts);
- scheduleToggle();
- };
- })();
- } else if (typeof setImmediate !== "undefined") {
- schedule = function (fn) {
- setImmediate(fn);
- };
- } else if (typeof setTimeout !== "undefined") {
- schedule = function (fn) {
- setTimeout(fn, 0);
- };
- } else {
- schedule = noAsyncScheduler;
- }
- module.exports = schedule;
- },{"./util":21}],19:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(Promise) {
- function PromiseInspection(promise) {
- if (promise !== undefined) {
- promise = promise._target();
- this._bitField = promise._bitField;
- this._settledValueField = promise._isFateSealed()
- ? promise._settledValue() : undefined;
- }
- else {
- this._bitField = 0;
- this._settledValueField = undefined;
- }
- }
- PromiseInspection.prototype._settledValue = function() {
- return this._settledValueField;
- };
- var value = PromiseInspection.prototype.value = function () {
- if (!this.isFulfilled()) {
- throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
- }
- return this._settledValue();
- };
- var reason = PromiseInspection.prototype.error =
- PromiseInspection.prototype.reason = function () {
- if (!this.isRejected()) {
- throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
- }
- return this._settledValue();
- };
- var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
- return (this._bitField & 33554432) !== 0;
- };
- var isRejected = PromiseInspection.prototype.isRejected = function () {
- return (this._bitField & 16777216) !== 0;
- };
- var isPending = PromiseInspection.prototype.isPending = function () {
- return (this._bitField & 50397184) === 0;
- };
- var isResolved = PromiseInspection.prototype.isResolved = function () {
- return (this._bitField & 50331648) !== 0;
- };
- PromiseInspection.prototype.isCancelled = function() {
- return (this._bitField & 8454144) !== 0;
- };
- Promise.prototype.__isCancelled = function() {
- return (this._bitField & 65536) === 65536;
- };
- Promise.prototype._isCancelled = function() {
- return this._target().__isCancelled();
- };
- Promise.prototype.isCancelled = function() {
- return (this._target()._bitField & 8454144) !== 0;
- };
- Promise.prototype.isPending = function() {
- return isPending.call(this._target());
- };
- Promise.prototype.isRejected = function() {
- return isRejected.call(this._target());
- };
- Promise.prototype.isFulfilled = function() {
- return isFulfilled.call(this._target());
- };
- Promise.prototype.isResolved = function() {
- return isResolved.call(this._target());
- };
- Promise.prototype.value = function() {
- return value.call(this._target());
- };
- Promise.prototype.reason = function() {
- var target = this._target();
- target._unsetRejectionIsUnhandled();
- return reason.call(target);
- };
- Promise.prototype._value = function() {
- return this._settledValue();
- };
- Promise.prototype._reason = function() {
- this._unsetRejectionIsUnhandled();
- return this._settledValue();
- };
- Promise.PromiseInspection = PromiseInspection;
- };
- },{}],20:[function(_dereq_,module,exports){
- "use strict";
- module.exports = function(Promise, INTERNAL) {
- var util = _dereq_("./util");
- var errorObj = util.errorObj;
- var isObject = util.isObject;
- function tryConvertToPromise(obj, context) {
- if (isObject(obj)) {
- if (obj instanceof Promise) return obj;
- var then = getThen(obj);
- if (then === errorObj) {
- if (context) context._pushContext();
- var ret = Promise.reject(then.e);
- if (context) context._popContext();
- return ret;
- } else if (typeof then === "function") {
- if (isAnyBluebirdPromise(obj)) {
- var ret = new Promise(INTERNAL);
- obj._then(
- ret._fulfill,
- ret._reject,
- undefined,
- ret,
- null
- );
- return ret;
- }
- return doThenable(obj, then, context);
- }
- }
- return obj;
- }
- function doGetThen(obj) {
- return obj.then;
- }
- function getThen(obj) {
- try {
- return doGetThen(obj);
- } catch (e) {
- errorObj.e = e;
- return errorObj;
- }
- }
- var hasProp = {}.hasOwnProperty;
- function isAnyBluebirdPromise(obj) {
- try {
- return hasProp.call(obj, "_promise0");
- } catch (e) {
- return false;
- }
- }
- function doThenable(x, then, context) {
- var promise = new Promise(INTERNAL);
- var ret = promise;
- if (context) context._pushContext();
- promise._captureStackTrace();
- if (context) context._popContext();
- var synchronous = true;
- var result = util.tryCatch(then).call(x, resolve, reject);
- synchronous = false;
- if (promise && result === errorObj) {
- promise._rejectCallback(result.e, true, true);
- promise = null;
- }
- function resolve(value) {
- if (!promise) return;
- promise._resolveCallback(value);
- promise = null;
- }
- function reject(reason) {
- if (!promise) return;
- promise._rejectCallback(reason, synchronous, true);
- promise = null;
- }
- return ret;
- }
- return tryConvertToPromise;
- };
- },{"./util":21}],21:[function(_dereq_,module,exports){
- "use strict";
- var es5 = _dereq_("./es5");
- var canEvaluate = typeof navigator == "undefined";
- var errorObj = {e: {}};
- var tryCatchTarget;
- var globalObject = typeof self !== "undefined" ? self :
- typeof window !== "undefined" ? window :
- typeof global !== "undefined" ? global :
- this !== undefined ? this : null;
- function tryCatcher() {
- try {
- var target = tryCatchTarget;
- tryCatchTarget = null;
- return target.apply(this, arguments);
- } catch (e) {
- errorObj.e = e;
- return errorObj;
- }
- }
- function tryCatch(fn) {
- tryCatchTarget = fn;
- return tryCatcher;
- }
- var inherits = function(Child, Parent) {
- var hasProp = {}.hasOwnProperty;
- function T() {
- this.constructor = Child;
- this.constructor$ = Parent;
- for (var propertyName in Parent.prototype) {
- if (hasProp.call(Parent.prototype, propertyName) &&
- propertyName.charAt(propertyName.length-1) !== "$"
- ) {
- this[propertyName + "$"] = Parent.prototype[propertyName];
- }
- }
- }
- T.prototype = Parent.prototype;
- Child.prototype = new T();
- return Child.prototype;
- };
- function isPrimitive(val) {
- return val == null || val === true || val === false ||
- typeof val === "string" || typeof val === "number";
- }
- function isObject(value) {
- return typeof value === "function" ||
- typeof value === "object" && value !== null;
- }
- function maybeWrapAsError(maybeError) {
- if (!isPrimitive(maybeError)) return maybeError;
- return new Error(safeToString(maybeError));
- }
- function withAppended(target, appendee) {
- var len = target.length;
- var ret = new Array(len + 1);
- var i;
- for (i = 0; i < len; ++i) {
- ret[i] = target[i];
- }
- ret[i] = appendee;
- return ret;
- }
- function getDataPropertyOrDefault(obj, key, defaultValue) {
- if (es5.isES5) {
- var desc = Object.getOwnPropertyDescriptor(obj, key);
- if (desc != null) {
- return desc.get == null && desc.set == null
- ? desc.value
- : defaultValue;
- }
- } else {
- return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
- }
- }
- function notEnumerableProp(obj, name, value) {
- if (isPrimitive(obj)) return obj;
- var descriptor = {
- value: value,
- configurable: true,
- enumerable: false,
- writable: true
- };
- es5.defineProperty(obj, name, descriptor);
- return obj;
- }
- function thrower(r) {
- throw r;
- }
- var inheritedDataKeys = (function() {
- var excludedPrototypes = [
- Array.prototype,
- Object.prototype,
- Function.prototype
- ];
- var isExcludedProto = function(val) {
- for (var i = 0; i < excludedPrototypes.length; ++i) {
- if (excludedPrototypes[i] === val) {
- return true;
- }
- }
- return false;
- };
- if (es5.isES5) {
- var getKeys = Object.getOwnPropertyNames;
- return function(obj) {
- var ret = [];
- var visitedKeys = Object.create(null);
- while (obj != null && !isExcludedProto(obj)) {
- var keys;
- try {
- keys = getKeys(obj);
- } catch (e) {
- return ret;
- }
- for (var i = 0; i < keys.length; ++i) {
- var key = keys[i];
- if (visitedKeys[key]) continue;
- visitedKeys[key] = true;
- var desc = Object.getOwnPropertyDescriptor(obj, key);
- if (desc != null && desc.get == null && desc.set == null) {
- ret.push(key);
- }
- }
- obj = es5.getPrototypeOf(obj);
- }
- return ret;
- };
- } else {
- var hasProp = {}.hasOwnProperty;
- return function(obj) {
- if (isExcludedProto(obj)) return [];
- var ret = [];
- /*jshint forin:false */
- enumeration: for (var key in obj) {
- if (hasProp.call(obj, key)) {
- ret.push(key);
- } else {
- for (var i = 0; i < excludedPrototypes.length; ++i) {
- if (hasProp.call(excludedPrototypes[i], key)) {
- continue enumeration;
- }
- }
- ret.push(key);
- }
- }
- return ret;
- };
- }
- })();
- var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
- function isClass(fn) {
- try {
- if (typeof fn === "function") {
- var keys = es5.names(fn.prototype);
- var hasMethods = es5.isES5 && keys.length > 1;
- var hasMethodsOtherThanConstructor = keys.length > 0 &&
- !(keys.length === 1 && keys[0] === "constructor");
- var hasThisAssignmentAndStaticMethods =
- thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
- if (hasMethods || hasMethodsOtherThanConstructor ||
- hasThisAssignmentAndStaticMethods) {
- return true;
- }
- }
- return false;
- } catch (e) {
- return false;
- }
- }
- function toFastProperties(obj) {
- /*jshint -W027,-W055,-W031*/
- function FakeConstructor() {}
- FakeConstructor.prototype = obj;
- var l = 8;
- while (l--) new FakeConstructor();
- return obj;
- eval(obj);
- }
- var rident = /^[a-z$_][a-z$_0-9]*$/i;
- function isIdentifier(str) {
- return rident.test(str);
- }
- function filledRange(count, prefix, suffix) {
- var ret = new Array(count);
- for(var i = 0; i < count; ++i) {
- ret[i] = prefix + i + suffix;
- }
- return ret;
- }
- function safeToString(obj) {
- try {
- return obj + "";
- } catch (e) {
- return "[no string representation]";
- }
- }
- function isError(obj) {
- return obj !== null &&
- typeof obj === "object" &&
- typeof obj.message === "string" &&
- typeof obj.name === "string";
- }
- function markAsOriginatingFromRejection(e) {
- try {
- notEnumerableProp(e, "isOperational", true);
- }
- catch(ignore) {}
- }
- function originatesFromRejection(e) {
- if (e == null) return false;
- return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
- e["isOperational"] === true);
- }
- function canAttachTrace(obj) {
- return isError(obj) && es5.propertyIsWritable(obj, "stack");
- }
- var ensureErrorObject = (function() {
- if (!("stack" in new Error())) {
- return function(value) {
- if (canAttachTrace(value)) return value;
- try {throw new Error(safeToString(value));}
- catch(err) {return err;}
- };
- } else {
- return function(value) {
- if (canAttachTrace(value)) return value;
- return new Error(safeToString(value));
- };
- }
- })();
- function classString(obj) {
- return {}.toString.call(obj);
- }
- function copyDescriptors(from, to, filter) {
- var keys = es5.names(from);
- for (var i = 0; i < keys.length; ++i) {
- var key = keys[i];
- if (filter(key)) {
- try {
- es5.defineProperty(to, key, es5.getDescriptor(from, key));
- } catch (ignore) {}
- }
- }
- }
- var asArray = function(v) {
- if (es5.isArray(v)) {
- return v;
- }
- return null;
- };
- if (typeof Symbol !== "undefined" && Symbol.iterator) {
- var ArrayFrom = typeof Array.from === "function" ? function(v) {
- return Array.from(v);
- } : function(v) {
- var ret = [];
- var it = v[Symbol.iterator]();
- var itResult;
- while (!((itResult = it.next()).done)) {
- ret.push(itResult.value);
- }
- return ret;
- };
- asArray = function(v) {
- if (es5.isArray(v)) {
- return v;
- } else if (v != null && typeof v[Symbol.iterator] === "function") {
- return ArrayFrom(v);
- }
- return null;
- };
- }
- var isNode = typeof process !== "undefined" &&
- classString(process).toLowerCase() === "[object process]";
- function env(key, def) {
- return isNode ? process.env[key] : def;
- }
- function getNativePromise() {
- if (typeof Promise === "function") {
- try {
- var promise = new Promise(function(){});
- if ({}.toString.call(promise) === "[object Promise]") {
- return Promise;
- }
- } catch (e) {}
- }
- }
- function domainBind(self, cb) {
- return self.bind(cb);
- }
- var ret = {
- isClass: isClass,
- isIdentifier: isIdentifier,
- inheritedDataKeys: inheritedDataKeys,
- getDataPropertyOrDefault: getDataPropertyOrDefault,
- thrower: thrower,
- isArray: es5.isArray,
- asArray: asArray,
- notEnumerableProp: notEnumerableProp,
- isPrimitive: isPrimitive,
- isObject: isObject,
- isError: isError,
- canEvaluate: canEvaluate,
- errorObj: errorObj,
- tryCatch: tryCatch,
- inherits: inherits,
- withAppended: withAppended,
- maybeWrapAsError: maybeWrapAsError,
- toFastProperties: toFastProperties,
- filledRange: filledRange,
- toString: safeToString,
- canAttachTrace: canAttachTrace,
- ensureErrorObject: ensureErrorObject,
- originatesFromRejection: originatesFromRejection,
- markAsOriginatingFromRejection: markAsOriginatingFromRejection,
- classString: classString,
- copyDescriptors: copyDescriptors,
- hasDevTools: typeof chrome !== "undefined" && chrome &&
- typeof chrome.loadTimes === "function",
- isNode: isNode,
- env: env,
- global: globalObject,
- getNativePromise: getNativePromise,
- domainBind: domainBind
- };
- ret.isRecentNode = ret.isNode && (function() {
- var version = process.versions.node.split(".").map(Number);
- return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
- })();
- if (ret.isNode) ret.toFastProperties(process);
- try {throw new Error(); } catch (e) {ret.lastLineError = e;}
- module.exports = ret;
- },{"./es5":10}]},{},[3])(3)
- }); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }
- /*
- RequireJS 2.2.0 Copyright jQuery Foundation and other contributors.
- Released under MIT license, http://github.com/requirejs/requirejs/LICENSE
- */
- var requirejs,require,define;
- (function(ga){function ka(b,c,d,g){return g||""}function K(b){return"[object Function]"===Q.call(b)}function L(b){return"[object Array]"===Q.call(b)}function y(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function X(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));--d);}}function x(b,c){return la.call(b,c)}function e(b,c){return x(b,c)&&b[c]}function D(b,c){for(var d in b)if(x(b,d)&&c(b[d],d))break}function Y(b,c,d,g){c&&D(c,function(c,e){if(d||!x(b,e))!g||"object"!==
- typeof c||!c||L(c)||K(c)||c instanceof RegExp?b[e]=c:(b[e]||(b[e]={}),Y(b[e],c,d,g))});return b}function z(b,c){return function(){return c.apply(b,arguments)}}function ha(b){throw b;}function ia(b){if(!b)return b;var c=ga;y(b.split("."),function(b){c=c[b]});return c}function F(b,c,d,g){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=g;d&&(c.originalError=d);return c}function ma(b){function c(a,n,b){var h,k,f,c,d,l,g,r;n=n&&n.split("/");var q=p.map,m=q&&q["*"];
- if(a){a=a.split("/");k=a.length-1;p.nodeIdCompat&&U.test(a[k])&&(a[k]=a[k].replace(U,""));"."===a[0].charAt(0)&&n&&(k=n.slice(0,n.length-1),a=k.concat(a));k=a;for(f=0;f<k.length;f++)c=k[f],"."===c?(k.splice(f,1),--f):".."===c&&0!==f&&(1!==f||".."!==k[2])&&".."!==k[f-1]&&0<f&&(k.splice(f-1,2),f-=2);a=a.join("/")}if(b&&q&&(n||m)){k=a.split("/");f=k.length;a:for(;0<f;--f){d=k.slice(0,f).join("/");if(n)for(c=n.length;0<c;--c)if(b=e(q,n.slice(0,c).join("/")))if(b=e(b,d)){h=b;l=f;break a}!g&&m&&e(m,d)&&
- (g=e(m,d),r=f)}!h&&g&&(h=g,l=r);h&&(k.splice(0,l,h),a=k.join("/"))}return(h=e(p.pkgs,a))?h:a}function d(a){E&&y(document.getElementsByTagName("script"),function(n){if(n.getAttribute("data-requiremodule")===a&&n.getAttribute("data-requirecontext")===l.contextName)return n.parentNode.removeChild(n),!0})}function m(a){var n=e(p.paths,a);if(n&&L(n)&&1<n.length)return n.shift(),l.require.undef(a),l.makeRequire(null,{skipMap:!0})([a]),!0}function r(a){var n,b=a?a.indexOf("!"):-1;-1<b&&(n=a.substring(0,
- b),a=a.substring(b+1,a.length));return[n,a]}function q(a,n,b,h){var k,f,d=null,g=n?n.name:null,p=a,q=!0,m="";a||(q=!1,a="_@r"+(Q+=1));a=r(a);d=a[0];a=a[1];d&&(d=c(d,g,h),f=e(v,d));a&&(d?m=f&&f.normalize?f.normalize(a,function(a){return c(a,g,h)}):-1===a.indexOf("!")?c(a,g,h):a:(m=c(a,g,h),a=r(m),d=a[0],m=a[1],b=!0,k=l.nameToUrl(m)));b=!d||f||b?"":"_unnormalized"+(T+=1);return{prefix:d,name:m,parentMap:n,unnormalized:!!b,url:k,originalName:p,isDefine:q,id:(d?d+"!"+m:m)+b}}function u(a){var b=a.id,
- c=e(t,b);c||(c=t[b]=new l.Module(a));return c}function w(a,b,c){var h=a.id,k=e(t,h);if(!x(v,h)||k&&!k.defineEmitComplete)if(k=u(a),k.error&&"error"===b)c(k.error);else k.on(b,c);else"defined"===b&&c(v[h])}function A(a,b){var c=a.requireModules,h=!1;if(b)b(a);else if(y(c,function(b){if(b=e(t,b))b.error=a,b.events.error&&(h=!0,b.emit("error",a))}),!h)g.onError(a)}function B(){V.length&&(y(V,function(a){var b=a[0];"string"===typeof b&&(l.defQueueMap[b]=!0);G.push(a)}),V=[])}function C(a){delete t[a];
- delete Z[a]}function J(a,b,c){var h=a.map.id;a.error?a.emit("error",a.error):(b[h]=!0,y(a.depMaps,function(h,f){var d=h.id,g=e(t,d);!g||a.depMatched[f]||c[d]||(e(b,d)?(a.defineDep(f,v[d]),a.check()):J(g,b,c))}),c[h]=!0)}function H(){var a,b,c=(a=1E3*p.waitSeconds)&&l.startTime+a<(new Date).getTime(),h=[],k=[],f=!1,g=!0;if(!aa){aa=!0;D(Z,function(a){var l=a.map,e=l.id;if(a.enabled&&(l.isDefine||k.push(a),!a.error))if(!a.inited&&c)m(e)?f=b=!0:(h.push(e),d(e));else if(!a.inited&&a.fetched&&l.isDefine&&
- (f=!0,!l.prefix))return g=!1});if(c&&h.length)return a=F("timeout","Load timeout for modules: "+h,null,h),a.contextName=l.contextName,A(a);g&&y(k,function(a){J(a,{},{})});c&&!b||!f||!E&&!ja||ba||(ba=setTimeout(function(){ba=0;H()},50));aa=!1}}function I(a){x(v,a[0])||u(q(a[0],null,!0)).init(a[1],a[2])}function O(a){a=a.currentTarget||a.srcElement;var b=l.onScriptLoad;a.detachEvent&&!ca?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=l.onScriptError;a.detachEvent&&!ca||a.removeEventListener("error",
- b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function P(){var a;for(B();G.length;){a=G.shift();if(null===a[0])return A(F("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));I(a)}l.defQueueMap={}}var aa,da,l,R,ba,p={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},t={},Z={},ea={},G=[],v={},W={},fa={},Q=1,T=1;R={require:function(a){return a.require?a.require:a.require=l.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?
- v[a.map.id]=a.exports:a.exports=v[a.map.id]={}},module:function(a){return a.module?a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){return e(p.config,a.map.id)||{}},exports:a.exports||(a.exports={})}}};da=function(a){this.events=e(ea,a.id)||{};this.map=a;this.shim=e(p.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};da.prototype={init:function(a,b,c,h){h=h||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&
- (c=z(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=c;this.inited=!0;this.ignore=h.ignore;h.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,--this.depCount,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;l.startTime=(new Date).getTime();var a=this.map;if(this.shim)l.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],z(this,function(){return a.prefix?this.callPlugin():
- this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=this.map.url;W[a]||(W[a]=!0,l.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var h=this.exports,k=this.factory;if(!this.inited)x(l.defQueueMap,c)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(K(k)){if(this.events.error&&this.map.isDefine||g.onError!==
- ha)try{h=l.execCb(c,k,b,h)}catch(d){a=d}else h=l.execCb(c,k,b,h);this.map.isDefine&&void 0===h&&((b=this.module)?h=b.exports:this.usingExports&&(h=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",A(this.error=a)}else h=k;this.exports=h;if(this.map.isDefine&&!this.ignore&&(v[c]=h,g.onResourceLoad)){var f=[];y(this.depMaps,function(a){f.push(a.normalizedMap||a)});g.onResourceLoad(l,this.map,f)}C(c);
- this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var a=this.map,b=a.id,d=q(a.prefix);this.depMaps.push(d);w(d,"defined",z(this,function(h){var k,f,d=e(fa,this.map.id),M=this.map.name,r=this.map.parentMap?this.map.parentMap.name:null,m=l.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(h.normalize&&(M=h.normalize(M,function(a){return c(a,r,!0)})||
- ""),f=q(a.prefix+"!"+M,this.map.parentMap),w(f,"defined",z(this,function(a){this.map.normalizedMap=f;this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),h=e(t,f.id)){this.depMaps.push(f);if(this.events.error)h.on("error",z(this,function(a){this.emit("error",a)}));h.enable()}}else d?(this.map.url=l.nameToUrl(d),this.load()):(k=z(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),k.error=z(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];D(t,function(a){0===
- a.map.id.indexOf(b+"_unnormalized")&&C(a.map.id)});A(a)}),k.fromText=z(this,function(h,c){var d=a.name,f=q(d),M=S;c&&(h=c);M&&(S=!1);u(f);x(p.config,b)&&(p.config[d]=p.config[b]);try{g.exec(h)}catch(e){return A(F("fromtexteval","fromText eval for "+b+" failed: "+e,e,[b]))}M&&(S=!0);this.depMaps.push(f);l.completeLoad(d);m([d],k)}),h.load(a.name,m,k,p))}));l.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){Z[this.map.id]=this;this.enabling=this.enabled=!0;y(this.depMaps,z(this,function(a,
- b){var c,h;if("string"===typeof a){a=q(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=e(R,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;w(a,"defined",z(this,function(a){this.undefed||(this.defineDep(b,a),this.check())}));this.errback?w(a,"error",z(this,this.errback)):this.events.error&&w(a,"error",z(this,function(a){this.emit("error",a)}))}c=a.id;h=t[c];x(R,c)||!h||h.enabled||l.enable(a,this)}));D(this.pluginMaps,z(this,function(a){var b=e(t,a.id);
- b&&!b.enabled&&l.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){y(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};l={config:p,contextName:b,registry:t,defined:v,urlFetched:W,defQueue:G,defQueueMap:{},Module:da,makeModuleMap:q,nextTick:g.nextTick,onError:A,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");if("string"===typeof a.urlArgs){var b=
- a.urlArgs;a.urlArgs=function(a,c){return(-1===c.indexOf("?")?"?":"&")+b}}var c=p.shim,h={paths:!0,bundles:!0,config:!0,map:!0};D(a,function(a,b){h[b]?(p[b]||(p[b]={}),Y(p[b],a,!0,!0)):p[b]=a});a.bundles&&D(a.bundles,function(a,b){y(a,function(a){a!==b&&(fa[a]=b)})});a.shim&&(D(a.shim,function(a,b){L(a)&&(a={deps:a});!a.exports&&!a.init||a.exportsFn||(a.exportsFn=l.makeShimExports(a));c[b]=a}),p.shim=c);a.packages&&y(a.packages,function(a){var b;a="string"===typeof a?{name:a}:a;b=a.name;a.location&&
- (p.paths[b]=a.location);p.pkgs[b]=a.name+"/"+(a.main||"main").replace(na,"").replace(U,"")});D(t,function(a,b){a.inited||a.map.unnormalized||(a.map=q(b,null,!0))});(a.deps||a.callback)&&l.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ga,arguments));return b||a.exports&&ia(a.exports)}},makeRequire:function(a,n){function m(c,d,f){var e,r;n.enableBuildCallback&&d&&K(d)&&(d.__requireJsBuild=!0);if("string"===typeof c){if(K(d))return A(F("requireargs",
- "Invalid require call"),f);if(a&&x(R,c))return R[c](t[a.id]);if(g.get)return g.get(l,c,a,m);e=q(c,a,!1,!0);e=e.id;return x(v,e)?v[e]:A(F("notloaded",'Module name "'+e+'" has not been loaded yet for context: '+b+(a?"":". Use require([])")))}P();l.nextTick(function(){P();r=u(q(null,a));r.skipMap=n.skipMap;r.init(c,d,f,{enabled:!0});H()});return m}n=n||{};Y(m,{isBrowser:E,toUrl:function(b){var d,f=b.lastIndexOf("."),g=b.split("/")[0];-1!==f&&("."!==g&&".."!==g||1<f)&&(d=b.substring(f,b.length),b=b.substring(0,
- f));return l.nameToUrl(c(b,a&&a.id,!0),d,!0)},defined:function(b){return x(v,q(b,a,!1,!0).id)},specified:function(b){b=q(b,a,!1,!0).id;return x(v,b)||x(t,b)}});a||(m.undef=function(b){B();var c=q(b,a,!0),f=e(t,b);f.undefed=!0;d(b);delete v[b];delete W[c.url];delete ea[b];X(G,function(a,c){a[0]===b&&G.splice(c,1)});delete l.defQueueMap[b];f&&(f.events.defined&&(ea[b]=f.events),C(b))});return m},enable:function(a){e(t,a.id)&&u(a).enable()},completeLoad:function(a){var b,c,d=e(p.shim,a)||{},g=d.exports;
- for(B();G.length;){c=G.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===a&&(b=!0);I(c)}l.defQueueMap={};c=e(t,a);if(!b&&!x(v,a)&&c&&!c.inited)if(!p.enforceDefine||g&&ia(g))I([a,d.deps||[],d.exportsFn]);else return m(a)?void 0:A(F("nodefine","No define call for "+a,null,[a]));H()},nameToUrl:function(a,b,c){var d,k,f,m;(d=e(p.pkgs,a))&&(a=d);if(d=e(fa,a))return l.nameToUrl(d,b,c);if(g.jsExtRegExp.test(a))d=a+(b||"");else{d=p.paths;k=a.split("/");for(f=k.length;0<f;--f)if(m=k.slice(0,f).join("/"),
- m=e(d,m)){L(m)&&(m=m[0]);k.splice(0,f,m);break}d=k.join("/");d+=b||(/^data\:|^blob\:|\?/.test(d)||c?"":".js");d=("/"===d.charAt(0)||d.match(/^[\w\+\.\-]+:/)?"":p.baseUrl)+d}return p.urlArgs&&!/^blob\:/.test(d)?d+p.urlArgs(a,d):d},load:function(a,b){g.load(l,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||oa.test((a.currentTarget||a.srcElement).readyState))N=null,a=O(a),l.completeLoad(a.id)},onScriptError:function(a){var b=O(a);if(!m(b.id)){var c=[];
- D(t,function(a,d){0!==d.indexOf("_@r")&&y(a.depMaps,function(a){if(a.id===b.id)return c.push(d),!0})});return A(F("scripterror",'Script error for "'+b.id+(c.length?'", needed by: '+c.join(", "):'"'),a,[b.id]))}}};l.require=l.makeRequire();return l}function pa(){if(N&&"interactive"===N.readyState)return N;X(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b});return N}var g,B,C,H,O,I,N,P,u,T,qa=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ra=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
- U=/\.js$/,na=/^\.\//;B=Object.prototype;var Q=B.toString,la=B.hasOwnProperty,E=!("undefined"===typeof window||"undefined"===typeof navigator||!window.document),ja=!E&&"undefined"!==typeof importScripts,oa=E&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,ca="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),J={},w={},V=[],S=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(K(requirejs))return;w=requirejs;requirejs=void 0}"undefined"===typeof require||
- K(require)||(w=require,require=void 0);g=requirejs=function(b,c,d,m){var r,q="_";L(b)||"string"===typeof b||(r=b,L(c)?(b=c,c=d,d=m):b=[]);r&&r.context&&(q=r.context);(m=e(J,q))||(m=J[q]=g.s.newContext(q));r&&m.configure(r);return m.require(b,c,d)};g.config=function(b){return g(b)};g.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=g);g.version="2.2.0";g.jsExtRegExp=/^\/|:|\?|\.js$/;g.isBrowser=E;B=g.s={contexts:J,newContext:ma};g({});y(["toUrl",
- "undef","defined","specified"],function(b){g[b]=function(){var c=J._;return c.require[b].apply(c,arguments)}});E&&(C=B.head=document.getElementsByTagName("head")[0],H=document.getElementsByTagName("base")[0])&&(C=B.head=H.parentNode);g.onError=ha;g.createNode=function(b,c,d){c=b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};g.load=function(b,c,d){var m=b&&b.config||
- {},e;if(E){e=g.createNode(m,c,d);e.setAttribute("data-requirecontext",b.contextName);e.setAttribute("data-requiremodule",c);!e.attachEvent||e.attachEvent.toString&&0>e.attachEvent.toString().indexOf("[native code")||ca?(e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)):(S=!0,e.attachEvent("onreadystatechange",b.onScriptLoad));e.src=d;if(m.onNodeCreated)m.onNodeCreated(e,m,c,d);P=e;H?C.insertBefore(e,H):C.appendChild(e);P=null;return e}if(ja)try{setTimeout(function(){},
- 0),importScripts(d),b.completeLoad(c)}catch(q){b.onError(F("importscripts","importScripts failed for "+c+" at "+d,q,[c]))}};E&&!w.skipDataMain&&X(document.getElementsByTagName("script"),function(b){C||(C=b.parentNode);if(O=b.getAttribute("data-main"))return u=O,w.baseUrl||-1!==u.indexOf("!")||(I=u.split("/"),u=I.pop(),T=I.length?I.join("/")+"/":"./",w.baseUrl=T),u=u.replace(U,""),g.jsExtRegExp.test(u)&&(u=O),w.deps=w.deps?w.deps.concat(u):[u],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&
- (d=c,c=b,b=null);L(c)||(d=c,c=null);!c&&K(d)&&(c=[],d.length&&(d.toString().replace(qa,ka).replace(ra,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));S&&(e=P||pa())&&(b||(b=e.getAttribute("data-requiremodule")),g=J[e.getAttribute("data-requirecontext")]);g?(g.defQueue.push([b,c,d]),g.defQueueMap[b]=!0):V.push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(w)}})(this);
- requirejs.config({"baseUrl":"src/","paths":{"text":"../scripts/text","aurelia-dependency-injection":"../node_modules/aurelia-dependency-injection/dist/amd/aurelia-dependency-injection","aurelia-binding":"../node_modules/aurelia-binding/dist/amd/aurelia-binding","aurelia-bootstrapper":"../node_modules/aurelia-bootstrapper/dist/amd/aurelia-bootstrapper","aurelia-event-aggregator":"../node_modules/aurelia-event-aggregator/dist/amd/aurelia-event-aggregator","aurelia-framework":"../node_modules/aurelia-framework/dist/amd/aurelia-framework","aurelia-metadata":"../node_modules/aurelia-metadata/dist/amd/aurelia-metadata","aurelia-pal":"../node_modules/aurelia-pal/dist/amd/aurelia-pal","aurelia-history-browser":"../node_modules/aurelia-history-browser/dist/amd/aurelia-history-browser","aurelia-history":"../node_modules/aurelia-history/dist/amd/aurelia-history","aurelia-loader":"../node_modules/aurelia-loader/dist/amd/aurelia-loader","aurelia-polyfills":"../node_modules/aurelia-polyfills/dist/amd/aurelia-polyfills","aurelia-loader-default":"../node_modules/aurelia-loader-default/dist/amd/aurelia-loader-default","aurelia-logging":"../node_modules/aurelia-logging/dist/amd/aurelia-logging","aurelia-route-recognizer":"../node_modules/aurelia-route-recognizer/dist/amd/aurelia-route-recognizer","aurelia-router":"../node_modules/aurelia-router/dist/amd/aurelia-router","aurelia-logging-console":"../node_modules/aurelia-logging-console/dist/amd/aurelia-logging-console","aurelia-path":"../node_modules/aurelia-path/dist/amd/aurelia-path","aurelia-pal-browser":"../node_modules/aurelia-pal-browser/dist/amd/aurelia-pal-browser","aurelia-task-queue":"../node_modules/aurelia-task-queue/dist/amd/aurelia-task-queue","aurelia-templating":"../node_modules/aurelia-templating/dist/amd/aurelia-templating","aurelia-templating-binding":"../node_modules/aurelia-templating-binding/dist/amd/aurelia-templating-binding","jquery":"../node_modules/jquery/dist/jquery","app-bundle":"../scripts/app-bundle"},"packages":[{"name":"aurelia-templating-resources","location":"../node_modules/aurelia-templating-resources/dist/amd","main":"aurelia-templating-resources"},{"name":"aurelia-templating-router","location":"../node_modules/aurelia-templating-router/dist/amd","main":"aurelia-templating-router"},{"name":"bootstrap","location":"../node_modules/bootstrap/dist","main":"js/bootstrap.min"},{"name":"nprogress","location":"../node_modules/nprogress","main":"nprogress"},{"name":"aurelia-testing","location":"../node_modules/aurelia-testing/dist/amd","main":"aurelia-testing"}],"stubModules":["text"],"shim":{"bootstrap":{"deps":["jquery"],"exports":"$"}},"bundles":{"app-bundle":["app","environment","main","src/sample.js","resources/index"]}});
- define('text',{});
- define('aurelia-dependency-injection',['exports', 'aurelia-metadata', 'aurelia-pal'], function (exports, _aureliaMetadata, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Container = exports.InvocationHandler = exports._emptyParameters = exports.SingletonRegistration = exports.TransientRegistration = exports.FactoryInvoker = exports.NewInstance = exports.Factory = exports.StrategyResolver = exports.Parent = exports.Optional = exports.All = exports.Lazy = exports.resolver = undefined;
- exports.getDecoratorDependencies = getDecoratorDependencies;
- exports.lazy = lazy;
- exports.all = all;
- exports.optional = optional;
- exports.parent = parent;
- exports.factory = factory;
- exports.newInstance = newInstance;
- exports.invoker = invoker;
- exports.factory = factory;
- exports.registration = registration;
- exports.transient = transient;
- exports.singleton = singleton;
- exports.autoinject = autoinject;
- exports.inject = inject;
-
- var _dec, _class, _dec2, _class3, _dec3, _class5, _dec4, _class7, _dec5, _class9, _dec6, _class11, _dec7, _class13, _classInvokers;
- var resolver = exports.resolver = _aureliaMetadata.protocol.create('aurelia:resolver', function (target) {
- if (!(typeof target.get === 'function')) {
- return 'Resolvers must implement: get(container: Container, key: any): any';
- }
- return true;
- });
- var Lazy = exports.Lazy = (_dec = resolver(), _dec(_class = function () {
- function Lazy(key) {
-
- this._key = key;
- }
- Lazy.prototype.get = function get(container) {
- var _this = this;
- return function () {
- return container.get(_this._key);
- };
- };
- Lazy.of = function of(key) {
- return new Lazy(key);
- };
- return Lazy;
- }()) || _class);
- var All = exports.All = (_dec2 = resolver(), _dec2(_class3 = function () {
- function All(key) {
-
- this._key = key;
- }
- All.prototype.get = function get(container) {
- return container.getAll(this._key);
- };
- All.of = function of(key) {
- return new All(key);
- };
- return All;
- }()) || _class3);
- var Optional = exports.Optional = (_dec3 = resolver(), _dec3(_class5 = function () {
- function Optional(key) {
- var checkParent = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
-
- this._key = key;
- this._checkParent = checkParent;
- }
- Optional.prototype.get = function get(container) {
- if (container.hasResolver(this._key, this._checkParent)) {
- return container.get(this._key);
- }
- return null;
- };
- Optional.of = function of(key) {
- var checkParent = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
- return new Optional(key, checkParent);
- };
- return Optional;
- }()) || _class5);
- var Parent = exports.Parent = (_dec4 = resolver(), _dec4(_class7 = function () {
- function Parent(key) {
-
- this._key = key;
- }
- Parent.prototype.get = function get(container) {
- return container.parent ? container.parent.get(this._key) : null;
- };
- Parent.of = function of(key) {
- return new Parent(key);
- };
- return Parent;
- }()) || _class7);
- var StrategyResolver = exports.StrategyResolver = (_dec5 = resolver(), _dec5(_class9 = function () {
- function StrategyResolver(strategy, state) {
-
- this.strategy = strategy;
- this.state = state;
- }
- StrategyResolver.prototype.get = function get(container, key) {
- switch (this.strategy) {
- case 0:
- return this.state;
- case 1:
- var singleton = container.invoke(this.state);
- this.state = singleton;
- this.strategy = 0;
- return singleton;
- case 2:
- return container.invoke(this.state);
- case 3:
- return this.state(container, key, this);
- case 4:
- return this.state[0].get(container, key);
- case 5:
- return container.get(this.state);
- default:
- throw new Error('Invalid strategy: ' + this.strategy);
- }
- };
- return StrategyResolver;
- }()) || _class9);
- var Factory = exports.Factory = (_dec6 = resolver(), _dec6(_class11 = function () {
- function Factory(key) {
-
- this._key = key;
- }
- Factory.prototype.get = function get(container) {
- var _this2 = this;
- return function () {
- for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
- rest[_key] = arguments[_key];
- }
- return container.invoke(_this2._key, rest);
- };
- };
- Factory.of = function of(key) {
- return new Factory(key);
- };
- return Factory;
- }()) || _class11);
- var NewInstance = exports.NewInstance = (_dec7 = resolver(), _dec7(_class13 = function () {
- function NewInstance(key) {
-
- this.key = key;
- this.asKey = key;
- }
- NewInstance.prototype.get = function get(container) {
- var instance = container.invoke(this.key);
- container.registerInstance(this.asKey, instance);
- return instance;
- };
- NewInstance.prototype.as = function as(key) {
- this.asKey = key;
- return this;
- };
- NewInstance.of = function of(key) {
- return new NewInstance(key);
- };
- return NewInstance;
- }()) || _class13);
- function getDecoratorDependencies(target, name) {
- var dependencies = target.inject;
- if (typeof dependencies === 'function') {
- throw new Error('Decorator ' + name + ' cannot be used with "inject()". Please use an array instead.');
- }
- if (!dependencies) {
- dependencies = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, target).slice();
- target.inject = dependencies;
- }
- return dependencies;
- }
- function lazy(keyValue) {
- return function (target, key, index) {
- var params = getDecoratorDependencies(target, 'lazy');
- params[index] = Lazy.of(keyValue);
- };
- }
- function all(keyValue) {
- return function (target, key, index) {
- var params = getDecoratorDependencies(target, 'all');
- params[index] = All.of(keyValue);
- };
- }
- function optional() {
- var checkParentOrTarget = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
- var deco = function deco(checkParent) {
- return function (target, key, index) {
- var params = getDecoratorDependencies(target, 'optional');
- params[index] = Optional.of(params[index], checkParent);
- };
- };
- if (typeof checkParentOrTarget === 'boolean') {
- return deco(checkParentOrTarget);
- }
- return deco(true);
- }
- function parent(target, key, index) {
- var params = getDecoratorDependencies(target, 'parent');
- params[index] = Parent.of(params[index]);
- }
- function factory(keyValue, asValue) {
- return function (target, key, index) {
- var params = getDecoratorDependencies(target, 'factory');
- var factory = Factory.of(keyValue);
- params[index] = asValue ? factory.as(asValue) : factory;
- };
- }
- function newInstance(asKeyOrTarget) {
- var deco = function deco(asKey) {
- return function (target, key, index) {
- var params = getDecoratorDependencies(target, 'newInstance');
- params[index] = NewInstance.of(params[index]);
- if (!!asKey) {
- params[index].as(asKey);
- }
- };
- };
- if (arguments.length === 1) {
- return deco(asKeyOrTarget);
- }
- return deco();
- }
- function invoker(value) {
- return function (target) {
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.invoker, value, target);
- };
- }
- function factory(potentialTarget) {
- var deco = function deco(target) {
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.invoker, FactoryInvoker.instance, target);
- };
- return potentialTarget ? deco(potentialTarget) : deco;
- }
- var FactoryInvoker = exports.FactoryInvoker = function () {
- function FactoryInvoker() {
-
- }
- FactoryInvoker.prototype.invoke = function invoke(container, fn, dependencies) {
- var i = dependencies.length;
- var args = new Array(i);
- while (i--) {
- args[i] = container.get(dependencies[i]);
- }
- return fn.apply(undefined, args);
- };
- FactoryInvoker.prototype.invokeWithDynamicDependencies = function invokeWithDynamicDependencies(container, fn, staticDependencies, dynamicDependencies) {
- var i = staticDependencies.length;
- var args = new Array(i);
- while (i--) {
- args[i] = container.get(staticDependencies[i]);
- }
- if (dynamicDependencies !== undefined) {
- args = args.concat(dynamicDependencies);
- }
- return fn.apply(undefined, args);
- };
- return FactoryInvoker;
- }();
- FactoryInvoker.instance = new FactoryInvoker();
- function registration(value) {
- return function (target) {
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.registration, value, target);
- };
- }
- function transient(key) {
- return registration(new TransientRegistration(key));
- }
- function singleton(keyOrRegisterInChild) {
- var registerInChild = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
- return registration(new SingletonRegistration(keyOrRegisterInChild, registerInChild));
- }
- var TransientRegistration = exports.TransientRegistration = function () {
- function TransientRegistration(key) {
-
- this._key = key;
- }
- TransientRegistration.prototype.registerResolver = function registerResolver(container, key, fn) {
- return container.registerTransient(this._key || key, fn);
- };
- return TransientRegistration;
- }();
- var SingletonRegistration = exports.SingletonRegistration = function () {
- function SingletonRegistration(keyOrRegisterInChild) {
- var registerInChild = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
-
- if (typeof keyOrRegisterInChild === 'boolean') {
- this._registerInChild = keyOrRegisterInChild;
- } else {
- this._key = keyOrRegisterInChild;
- this._registerInChild = registerInChild;
- }
- }
- SingletonRegistration.prototype.registerResolver = function registerResolver(container, key, fn) {
- return this._registerInChild ? container.registerSingleton(this._key || key, fn) : container.root.registerSingleton(this._key || key, fn);
- };
- return SingletonRegistration;
- }();
- var badKeyError = 'key/value cannot be null or undefined. Are you trying to inject/register something that doesn\'t exist with DI?';
- var _emptyParameters = exports._emptyParameters = Object.freeze([]);
- _aureliaMetadata.metadata.registration = 'aurelia:registration';
- _aureliaMetadata.metadata.invoker = 'aurelia:invoker';
- var resolverDecorates = resolver.decorates;
- var InvocationHandler = exports.InvocationHandler = function () {
- function InvocationHandler(fn, invoker, dependencies) {
-
- this.fn = fn;
- this.invoker = invoker;
- this.dependencies = dependencies;
- }
- InvocationHandler.prototype.invoke = function invoke(container, dynamicDependencies) {
- return dynamicDependencies !== undefined ? this.invoker.invokeWithDynamicDependencies(container, this.fn, this.dependencies, dynamicDependencies) : this.invoker.invoke(container, this.fn, this.dependencies);
- };
- return InvocationHandler;
- }();
- function invokeWithDynamicDependencies(container, fn, staticDependencies, dynamicDependencies) {
- var i = staticDependencies.length;
- var args = new Array(i);
- while (i--) {
- args[i] = container.get(staticDependencies[i]);
- }
- if (dynamicDependencies !== undefined) {
- args = args.concat(dynamicDependencies);
- }
- return Reflect.construct(fn, args);
- }
- var classInvokers = (_classInvokers = {}, _classInvokers[0] = {
- invoke: function invoke(container, Type) {
- return new Type();
- },
- invokeWithDynamicDependencies: invokeWithDynamicDependencies
- }, _classInvokers[1] = {
- invoke: function invoke(container, Type, deps) {
- return new Type(container.get(deps[0]));
- },
- invokeWithDynamicDependencies: invokeWithDynamicDependencies
- }, _classInvokers[2] = {
- invoke: function invoke(container, Type, deps) {
- return new Type(container.get(deps[0]), container.get(deps[1]));
- },
- invokeWithDynamicDependencies: invokeWithDynamicDependencies
- }, _classInvokers[3] = {
- invoke: function invoke(container, Type, deps) {
- return new Type(container.get(deps[0]), container.get(deps[1]), container.get(deps[2]));
- },
- invokeWithDynamicDependencies: invokeWithDynamicDependencies
- }, _classInvokers[4] = {
- invoke: function invoke(container, Type, deps) {
- return new Type(container.get(deps[0]), container.get(deps[1]), container.get(deps[2]), container.get(deps[3]));
- },
- invokeWithDynamicDependencies: invokeWithDynamicDependencies
- }, _classInvokers[5] = {
- invoke: function invoke(container, Type, deps) {
- return new Type(container.get(deps[0]), container.get(deps[1]), container.get(deps[2]), container.get(deps[3]), container.get(deps[4]));
- },
- invokeWithDynamicDependencies: invokeWithDynamicDependencies
- }, _classInvokers.fallback = {
- invoke: invokeWithDynamicDependencies,
- invokeWithDynamicDependencies: invokeWithDynamicDependencies
- }, _classInvokers);
- function getDependencies(f) {
- if (!f.hasOwnProperty('inject')) {
- return [];
- }
- if (typeof f.inject === 'function') {
- return f.inject();
- }
- return f.inject;
- }
- var Container = exports.Container = function () {
- function Container(configuration) {
-
- if (configuration === undefined) {
- configuration = {};
- }
- this._configuration = configuration;
- this._onHandlerCreated = configuration.onHandlerCreated;
- this._handlers = configuration.handlers || (configuration.handlers = new Map());
- this._resolvers = new Map();
- this.root = this;
- this.parent = null;
- }
- Container.prototype.makeGlobal = function makeGlobal() {
- Container.instance = this;
- return this;
- };
- Container.prototype.setHandlerCreatedCallback = function setHandlerCreatedCallback(onHandlerCreated) {
- this._onHandlerCreated = onHandlerCreated;
- this._configuration.onHandlerCreated = onHandlerCreated;
- };
- Container.prototype.registerInstance = function registerInstance(key, instance) {
- return this.registerResolver(key, new StrategyResolver(0, instance === undefined ? key : instance));
- };
- Container.prototype.registerSingleton = function registerSingleton(key, fn) {
- return this.registerResolver(key, new StrategyResolver(1, fn === undefined ? key : fn));
- };
- Container.prototype.registerTransient = function registerTransient(key, fn) {
- return this.registerResolver(key, new StrategyResolver(2, fn === undefined ? key : fn));
- };
- Container.prototype.registerHandler = function registerHandler(key, handler) {
- return this.registerResolver(key, new StrategyResolver(3, handler));
- };
- Container.prototype.registerAlias = function registerAlias(originalKey, aliasKey) {
- return this.registerResolver(aliasKey, new StrategyResolver(5, originalKey));
- };
- Container.prototype.registerResolver = function registerResolver(key, resolver) {
- if (key === null || key === undefined) {
- throw new Error(badKeyError);
- }
- var allResolvers = this._resolvers;
- var result = allResolvers.get(key);
- if (result === undefined) {
- allResolvers.set(key, resolver);
- } else if (result.strategy === 4) {
- result.state.push(resolver);
- } else {
- allResolvers.set(key, new StrategyResolver(4, [result, resolver]));
- }
- return resolver;
- };
- Container.prototype.autoRegister = function autoRegister(key, fn) {
- fn = fn === undefined ? key : fn;
- if (typeof fn === 'function') {
- var _registration = _aureliaMetadata.metadata.get(_aureliaMetadata.metadata.registration, fn);
- if (_registration === undefined) {
- return this.registerResolver(key, new StrategyResolver(1, fn));
- }
- return _registration.registerResolver(this, key, fn);
- }
- return this.registerResolver(key, new StrategyResolver(0, fn));
- };
- Container.prototype.autoRegisterAll = function autoRegisterAll(fns) {
- var i = fns.length;
- while (i--) {
- this.autoRegister(fns[i]);
- }
- };
- Container.prototype.unregister = function unregister(key) {
- this._resolvers.delete(key);
- };
- Container.prototype.hasResolver = function hasResolver(key) {
- var checkParent = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
- if (key === null || key === undefined) {
- throw new Error(badKeyError);
- }
- return this._resolvers.has(key) || checkParent && this.parent !== null && this.parent.hasResolver(key, checkParent);
- };
- Container.prototype.get = function get(key) {
- if (key === null || key === undefined) {
- throw new Error(badKeyError);
- }
- if (key === Container) {
- return this;
- }
- if (resolverDecorates(key)) {
- return key.get(this, key);
- }
- var resolver = this._resolvers.get(key);
- if (resolver === undefined) {
- if (this.parent === null) {
- return this.autoRegister(key).get(this, key);
- }
- return this.parent._get(key);
- }
- return resolver.get(this, key);
- };
- Container.prototype._get = function _get(key) {
- var resolver = this._resolvers.get(key);
- if (resolver === undefined) {
- if (this.parent === null) {
- return this.autoRegister(key).get(this, key);
- }
- return this.parent._get(key);
- }
- return resolver.get(this, key);
- };
- Container.prototype.getAll = function getAll(key) {
- if (key === null || key === undefined) {
- throw new Error(badKeyError);
- }
- var resolver = this._resolvers.get(key);
- if (resolver === undefined) {
- if (this.parent === null) {
- return _emptyParameters;
- }
- return this.parent.getAll(key);
- }
- if (resolver.strategy === 4) {
- var state = resolver.state;
- var i = state.length;
- var results = new Array(i);
- while (i--) {
- results[i] = state[i].get(this, key);
- }
- return results;
- }
- return [resolver.get(this, key)];
- };
- Container.prototype.createChild = function createChild() {
- var child = new Container(this._configuration);
- child.root = this.root;
- child.parent = this;
- return child;
- };
- Container.prototype.invoke = function invoke(fn, dynamicDependencies) {
- try {
- var _handler = this._handlers.get(fn);
- if (_handler === undefined) {
- _handler = this._createInvocationHandler(fn);
- this._handlers.set(fn, _handler);
- }
- return _handler.invoke(this, dynamicDependencies);
- } catch (e) {
- throw new _aureliaPal.AggregateError('Error invoking ' + fn.name + '. Check the inner error for details.', e, true);
- }
- };
- Container.prototype._createInvocationHandler = function _createInvocationHandler(fn) {
- var dependencies = void 0;
- if (fn.inject === undefined) {
- dependencies = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, fn) || _emptyParameters;
- } else {
- dependencies = [];
- var ctor = fn;
- while (typeof ctor === 'function') {
- var _dependencies;
- (_dependencies = dependencies).push.apply(_dependencies, getDependencies(ctor));
- ctor = Object.getPrototypeOf(ctor);
- }
- }
- var invoker = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.invoker, fn) || classInvokers[dependencies.length] || classInvokers.fallback;
- var handler = new InvocationHandler(fn, invoker, dependencies);
- return this._onHandlerCreated !== undefined ? this._onHandlerCreated(handler) : handler;
- };
- return Container;
- }();
- function autoinject(potentialTarget) {
- var deco = function deco(target) {
- var previousInject = target.inject;
- var autoInject = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, target) || _emptyParameters;
- if (!previousInject) {
- target.inject = autoInject;
- } else {
- for (var i = 0; i++; i < autoInject.length) {
- if (!previousInject[i]) {
- previousInject[i] = autoInject[i];
- }
- }
- }
- };
- return potentialTarget ? deco(potentialTarget) : deco;
- }
- function inject() {
- for (var _len2 = arguments.length, rest = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- rest[_key2] = arguments[_key2];
- }
- return function (target, key, descriptor) {
- if (typeof descriptor === 'number' && rest.length === 1) {
- var params = target.inject;
- if (typeof params === 'function') {
- throw new Error('Decorator inject cannot be used with "inject()". Please use an array instead.');
- }
- if (!params) {
- params = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, target).slice();
- target.inject = params;
- }
- params[descriptor] = rest[0];
- return;
- }
- if (descriptor) {
- var _fn = descriptor.value;
- _fn.inject = rest;
- } else {
- target.inject = rest;
- }
- };
- }
- });
- define('aurelia-binding',['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aurelia-metadata'], function (exports, _aureliaLogging, _aureliaPal, _aureliaTaskQueue, _aureliaMetadata) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getSetObserver = exports.BindingEngine = exports.NameExpression = exports.Listener = exports.ListenerExpression = exports.BindingBehaviorResource = exports.ValueConverterResource = exports.Call = exports.CallExpression = exports.Binding = exports.BindingExpression = exports.ObjectObservationAdapter = exports.ObserverLocator = exports.SVGAnalyzer = exports.presentationAttributes = exports.presentationElements = exports.elements = exports.ComputedExpression = exports.ClassObserver = exports.SelectValueObserver = exports.CheckedObserver = exports.ValueAttributeObserver = exports.StyleObserver = exports.DataAttributeObserver = exports.dataAttributeAccessor = exports.XLinkAttributeObserver = exports.SetterObserver = exports.PrimitiveObserver = exports.propertyAccessor = exports.DirtyCheckProperty = exports.DirtyChecker = exports.EventManager = exports.getMapObserver = exports.ParserImplementation = exports.Parser = exports.Scanner = exports.Lexer = exports.Token = exports.bindingMode = exports.ExpressionCloner = exports.Unparser = exports.LiteralObject = exports.LiteralArray = exports.LiteralString = exports.LiteralPrimitive = exports.PrefixNot = exports.Binary = exports.CallFunction = exports.CallMember = exports.CallScope = exports.AccessKeyed = exports.AccessMember = exports.AccessScope = exports.AccessThis = exports.Conditional = exports.Assign = exports.ValueConverter = exports.BindingBehavior = exports.Chain = exports.Expression = exports.getArrayObserver = exports.CollectionLengthObserver = exports.ModifyCollectionObserver = exports.ExpressionObserver = exports.sourceContext = undefined;
- exports.camelCase = camelCase;
- exports.createOverrideContext = createOverrideContext;
- exports.getContextFor = getContextFor;
- exports.createScopeForTest = createScopeForTest;
- exports.connectable = connectable;
- exports.enqueueBindingConnect = enqueueBindingConnect;
- exports.subscriberCollection = subscriberCollection;
- exports.calcSplices = calcSplices;
- exports.mergeSplice = mergeSplice;
- exports.projectArraySplices = projectArraySplices;
- exports.getChangeRecords = getChangeRecords;
- exports.cloneExpression = cloneExpression;
- exports.hasDeclaredDependencies = hasDeclaredDependencies;
- exports.declarePropertyDependencies = declarePropertyDependencies;
- exports.computedFrom = computedFrom;
- exports.createComputedObserver = createComputedObserver;
- exports.valueConverter = valueConverter;
- exports.bindingBehavior = bindingBehavior;
- exports.observable = observable;
- var LogManager = _interopRequireWildcard(_aureliaLogging);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
- };
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- function _possibleConstructorReturn(self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
- }
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
- }
-
- var _dec, _dec2, _class, _dec3, _class2, _dec4, _class3, _dec5, _class5, _dec6, _class7, _dec7, _class8, _dec8, _class9, _dec9, _class10, _class11, _temp, _dec10, _class12, _class13, _temp2;
- var map = Object.create(null);
- function camelCase(name) {
- if (name in map) {
- return map[name];
- }
- var result = name.charAt(0).toLowerCase() + name.slice(1).replace(/[_.-](\w|$)/g, function (_, x) {
- return x.toUpperCase();
- });
- map[name] = result;
- return result;
- }
- function createOverrideContext(bindingContext, parentOverrideContext) {
- return {
- bindingContext: bindingContext,
- parentOverrideContext: parentOverrideContext || null
- };
- }
- function getContextFor(name, scope, ancestor) {
- var oc = scope.overrideContext;
- if (ancestor) {
- while (ancestor && oc) {
- ancestor--;
- oc = oc.parentOverrideContext;
- }
- if (ancestor || !oc) {
- return undefined;
- }
- return name in oc ? oc : oc.bindingContext;
- }
- while (oc && !(name in oc) && !(oc.bindingContext && name in oc.bindingContext)) {
- oc = oc.parentOverrideContext;
- }
- if (oc) {
- return name in oc ? oc : oc.bindingContext;
- }
- return scope.bindingContext || scope.overrideContext;
- }
- function createScopeForTest(bindingContext, parentBindingContext) {
- if (parentBindingContext) {
- return {
- bindingContext: bindingContext,
- overrideContext: createOverrideContext(bindingContext, createOverrideContext(parentBindingContext))
- };
- }
- return {
- bindingContext: bindingContext,
- overrideContext: createOverrideContext(bindingContext)
- };
- }
- var sourceContext = exports.sourceContext = 'Binding:source';
- var slotNames = [];
- var versionSlotNames = [];
- for (var i = 0; i < 100; i++) {
- slotNames.push('_observer' + i);
- versionSlotNames.push('_observerVersion' + i);
- }
- function addObserver(observer) {
- var observerSlots = this._observerSlots === undefined ? 0 : this._observerSlots;
- var i = observerSlots;
- while (i-- && this[slotNames[i]] !== observer) {}
- if (i === -1) {
- i = 0;
- while (this[slotNames[i]]) {
- i++;
- }
- this[slotNames[i]] = observer;
- observer.subscribe(sourceContext, this);
- if (i === observerSlots) {
- this._observerSlots = i + 1;
- }
- }
- if (this._version === undefined) {
- this._version = 0;
- }
- this[versionSlotNames[i]] = this._version;
- }
- function observeProperty(obj, propertyName) {
- var observer = this.observerLocator.getObserver(obj, propertyName);
- addObserver.call(this, observer);
- }
- function observeArray(array) {
- var observer = this.observerLocator.getArrayObserver(array);
- addObserver.call(this, observer);
- }
- function unobserve(all) {
- var i = this._observerSlots;
- while (i--) {
- if (all || this[versionSlotNames[i]] !== this._version) {
- var observer = this[slotNames[i]];
- this[slotNames[i]] = null;
- if (observer) {
- observer.unsubscribe(sourceContext, this);
- }
- }
- }
- }
- function connectable() {
- return function (target) {
- target.prototype.observeProperty = observeProperty;
- target.prototype.observeArray = observeArray;
- target.prototype.unobserve = unobserve;
- target.prototype.addObserver = addObserver;
- };
- }
- var bindings = new Map();
- var minimumImmediate = 100;
- var frameBudget = 15;
- var isFlushRequested = false;
- var immediate = 0;
- function flush(animationFrameStart) {
- var i = 0;
- var keys = bindings.keys();
- var item = void 0;
- while (item = keys.next()) {
- if (item.done) {
- break;
- }
- var binding = item.value;
- bindings.delete(binding);
- binding.connect(true);
- i++;
- if (i % 100 === 0 && _aureliaPal.PLATFORM.performance.now() - animationFrameStart > frameBudget) {
- break;
- }
- }
- if (bindings.size) {
- _aureliaPal.PLATFORM.requestAnimationFrame(flush);
- } else {
- isFlushRequested = false;
- immediate = 0;
- }
- }
- function enqueueBindingConnect(binding) {
- if (immediate < minimumImmediate) {
- immediate++;
- binding.connect(false);
- } else {
- bindings.set(binding);
- }
- if (!isFlushRequested) {
- isFlushRequested = true;
- _aureliaPal.PLATFORM.requestAnimationFrame(flush);
- }
- }
- function addSubscriber(context, callable) {
- if (this.hasSubscriber(context, callable)) {
- return false;
- }
- if (!this._context0) {
- this._context0 = context;
- this._callable0 = callable;
- return true;
- }
- if (!this._context1) {
- this._context1 = context;
- this._callable1 = callable;
- return true;
- }
- if (!this._context2) {
- this._context2 = context;
- this._callable2 = callable;
- return true;
- }
- if (!this._contextsRest) {
- this._contextsRest = [context];
- this._callablesRest = [callable];
- return true;
- }
- this._contextsRest.push(context);
- this._callablesRest.push(callable);
- return true;
- }
- function removeSubscriber(context, callable) {
- if (this._context0 === context && this._callable0 === callable) {
- this._context0 = null;
- this._callable0 = null;
- return true;
- }
- if (this._context1 === context && this._callable1 === callable) {
- this._context1 = null;
- this._callable1 = null;
- return true;
- }
- if (this._context2 === context && this._callable2 === callable) {
- this._context2 = null;
- this._callable2 = null;
- return true;
- }
- var rest = this._contextsRest;
- var index = void 0;
- if (!rest || !rest.length || (index = rest.indexOf(context)) === -1 || this._callablesRest[index] !== callable) {
- return false;
- }
- rest.splice(index, 1);
- this._callablesRest.splice(index, 1);
- return true;
- }
- var arrayPool1 = [];
- var arrayPool2 = [];
- var poolUtilization = [];
- function callSubscribers(newValue, oldValue) {
- var context0 = this._context0;
- var callable0 = this._callable0;
- var context1 = this._context1;
- var callable1 = this._callable1;
- var context2 = this._context2;
- var callable2 = this._callable2;
- var length = this._contextsRest ? this._contextsRest.length : 0;
- var contextsRest = void 0;
- var callablesRest = void 0;
- var poolIndex = void 0;
- var i = void 0;
- if (length) {
- poolIndex = poolUtilization.length;
- while (poolIndex-- && poolUtilization[poolIndex]) {}
- if (poolIndex < 0) {
- poolIndex = poolUtilization.length;
- contextsRest = [];
- callablesRest = [];
- poolUtilization.push(true);
- arrayPool1.push(contextsRest);
- arrayPool2.push(callablesRest);
- } else {
- poolUtilization[poolIndex] = true;
- contextsRest = arrayPool1[poolIndex];
- callablesRest = arrayPool2[poolIndex];
- }
- i = length;
- while (i--) {
- contextsRest[i] = this._contextsRest[i];
- callablesRest[i] = this._callablesRest[i];
- }
- }
- if (context0) {
- if (callable0) {
- callable0.call(context0, newValue, oldValue);
- } else {
- context0(newValue, oldValue);
- }
- }
- if (context1) {
- if (callable1) {
- callable1.call(context1, newValue, oldValue);
- } else {
- context1(newValue, oldValue);
- }
- }
- if (context2) {
- if (callable2) {
- callable2.call(context2, newValue, oldValue);
- } else {
- context2(newValue, oldValue);
- }
- }
- if (length) {
- for (i = 0; i < length; i++) {
- var callable = callablesRest[i];
- var context = contextsRest[i];
- if (callable) {
- callable.call(context, newValue, oldValue);
- } else {
- context(newValue, oldValue);
- }
- contextsRest[i] = null;
- callablesRest[i] = null;
- }
- poolUtilization[poolIndex] = false;
- }
- }
- function hasSubscribers() {
- return !!(this._context0 || this._context1 || this._context2 || this._contextsRest && this._contextsRest.length);
- }
- function hasSubscriber(context, callable) {
- var has = this._context0 === context && this._callable0 === callable || this._context1 === context && this._callable1 === callable || this._context2 === context && this._callable2 === callable;
- if (has) {
- return true;
- }
- var index = void 0;
- var contexts = this._contextsRest;
- if (!contexts || (index = contexts.length) === 0) {
- return false;
- }
- var callables = this._callablesRest;
- while (index--) {
- if (contexts[index] === context && callables[index] === callable) {
- return true;
- }
- }
- return false;
- }
- function subscriberCollection() {
- return function (target) {
- target.prototype.addSubscriber = addSubscriber;
- target.prototype.removeSubscriber = removeSubscriber;
- target.prototype.callSubscribers = callSubscribers;
- target.prototype.hasSubscribers = hasSubscribers;
- target.prototype.hasSubscriber = hasSubscriber;
- };
- }
- var ExpressionObserver = exports.ExpressionObserver = (_dec = connectable(), _dec2 = subscriberCollection(), _dec(_class = _dec2(_class = function () {
- function ExpressionObserver(scope, expression, observerLocator, lookupFunctions) {
-
- this.scope = scope;
- this.expression = expression;
- this.observerLocator = observerLocator;
- this.lookupFunctions = lookupFunctions;
- }
- ExpressionObserver.prototype.getValue = function getValue() {
- return this.expression.evaluate(this.scope, this.lookupFunctions);
- };
- ExpressionObserver.prototype.setValue = function setValue(newValue) {
- this.expression.assign(this.scope, newValue);
- };
- ExpressionObserver.prototype.subscribe = function subscribe(context, callable) {
- var _this = this;
- if (!this.hasSubscribers()) {
- this.oldValue = this.expression.evaluate(this.scope, this.lookupFunctions);
- this.expression.connect(this, this.scope);
- }
- this.addSubscriber(context, callable);
- if (arguments.length === 1 && context instanceof Function) {
- return {
- dispose: function dispose() {
- _this.unsubscribe(context, callable);
- }
- };
- }
- };
- ExpressionObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
- if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
- this.unobserve(true);
- this.oldValue = undefined;
- }
- };
- ExpressionObserver.prototype.call = function call() {
- var newValue = this.expression.evaluate(this.scope, this.lookupFunctions);
- var oldValue = this.oldValue;
- if (newValue !== oldValue) {
- this.oldValue = newValue;
- this.callSubscribers(newValue, oldValue);
- }
- this._version++;
- this.expression.connect(this, this.scope);
- this.unobserve(false);
- };
- return ExpressionObserver;
- }()) || _class) || _class);
- function isIndex(s) {
- return +s === s >>> 0;
- }
- function toNumber(s) {
- return +s;
- }
- function newSplice(index, removed, addedCount) {
- return {
- index: index,
- removed: removed,
- addedCount: addedCount
- };
- }
- var EDIT_LEAVE = 0;
- var EDIT_UPDATE = 1;
- var EDIT_ADD = 2;
- var EDIT_DELETE = 3;
- function ArraySplice() {}
- ArraySplice.prototype = {
- calcEditDistances: function calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd) {
- var rowCount = oldEnd - oldStart + 1;
- var columnCount = currentEnd - currentStart + 1;
- var distances = new Array(rowCount);
- var north = void 0;
- var west = void 0;
- for (var _i = 0; _i < rowCount; ++_i) {
- distances[_i] = new Array(columnCount);
- distances[_i][0] = _i;
- }
- for (var j = 0; j < columnCount; ++j) {
- distances[0][j] = j;
- }
- for (var _i2 = 1; _i2 < rowCount; ++_i2) {
- for (var _j = 1; _j < columnCount; ++_j) {
- if (this.equals(current[currentStart + _j - 1], old[oldStart + _i2 - 1])) {
- distances[_i2][_j] = distances[_i2 - 1][_j - 1];
- } else {
- north = distances[_i2 - 1][_j] + 1;
- west = distances[_i2][_j - 1] + 1;
- distances[_i2][_j] = north < west ? north : west;
- }
- }
- }
- return distances;
- },
- spliceOperationsFromEditDistances: function spliceOperationsFromEditDistances(distances) {
- var i = distances.length - 1;
- var j = distances[0].length - 1;
- var current = distances[i][j];
- var edits = [];
- while (i > 0 || j > 0) {
- if (i === 0) {
- edits.push(EDIT_ADD);
- j--;
- continue;
- }
- if (j === 0) {
- edits.push(EDIT_DELETE);
- i--;
- continue;
- }
- var northWest = distances[i - 1][j - 1];
- var west = distances[i - 1][j];
- var north = distances[i][j - 1];
- var min = void 0;
- if (west < north) {
- min = west < northWest ? west : northWest;
- } else {
- min = north < northWest ? north : northWest;
- }
- if (min === northWest) {
- if (northWest === current) {
- edits.push(EDIT_LEAVE);
- } else {
- edits.push(EDIT_UPDATE);
- current = northWest;
- }
- i--;
- j--;
- } else if (min === west) {
- edits.push(EDIT_DELETE);
- i--;
- current = west;
- } else {
- edits.push(EDIT_ADD);
- j--;
- current = north;
- }
- }
- edits.reverse();
- return edits;
- },
- calcSplices: function calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd) {
- var prefixCount = 0;
- var suffixCount = 0;
- var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
- if (currentStart === 0 && oldStart === 0) {
- prefixCount = this.sharedPrefix(current, old, minLength);
- }
- if (currentEnd === current.length && oldEnd === old.length) {
- suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
- }
- currentStart += prefixCount;
- oldStart += prefixCount;
- currentEnd -= suffixCount;
- oldEnd -= suffixCount;
- if (currentEnd - currentStart === 0 && oldEnd - oldStart === 0) {
- return [];
- }
- if (currentStart === currentEnd) {
- var _splice = newSplice(currentStart, [], 0);
- while (oldStart < oldEnd) {
- _splice.removed.push(old[oldStart++]);
- }
- return [_splice];
- } else if (oldStart === oldEnd) {
- return [newSplice(currentStart, [], currentEnd - currentStart)];
- }
- var ops = this.spliceOperationsFromEditDistances(this.calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
- var splice = undefined;
- var splices = [];
- var index = currentStart;
- var oldIndex = oldStart;
- for (var _i3 = 0; _i3 < ops.length; ++_i3) {
- switch (ops[_i3]) {
- case EDIT_LEAVE:
- if (splice) {
- splices.push(splice);
- splice = undefined;
- }
- index++;
- oldIndex++;
- break;
- case EDIT_UPDATE:
- if (!splice) {
- splice = newSplice(index, [], 0);
- }
- splice.addedCount++;
- index++;
- splice.removed.push(old[oldIndex]);
- oldIndex++;
- break;
- case EDIT_ADD:
- if (!splice) {
- splice = newSplice(index, [], 0);
- }
- splice.addedCount++;
- index++;
- break;
- case EDIT_DELETE:
- if (!splice) {
- splice = newSplice(index, [], 0);
- }
- splice.removed.push(old[oldIndex]);
- oldIndex++;
- break;
- }
- }
- if (splice) {
- splices.push(splice);
- }
- return splices;
- },
- sharedPrefix: function sharedPrefix(current, old, searchLength) {
- for (var _i4 = 0; _i4 < searchLength; ++_i4) {
- if (!this.equals(current[_i4], old[_i4])) {
- return _i4;
- }
- }
- return searchLength;
- },
- sharedSuffix: function sharedSuffix(current, old, searchLength) {
- var index1 = current.length;
- var index2 = old.length;
- var count = 0;
- while (count < searchLength && this.equals(current[--index1], old[--index2])) {
- count++;
- }
- return count;
- },
- calculateSplices: function calculateSplices(current, previous) {
- return this.calcSplices(current, 0, current.length, previous, 0, previous.length);
- },
- equals: function equals(currentValue, previousValue) {
- return currentValue === previousValue;
- }
- };
- var arraySplice = new ArraySplice();
- function calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd) {
- return arraySplice.calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd);
- }
- function intersect(start1, end1, start2, end2) {
- if (end1 < start2 || end2 < start1) {
- return -1;
- }
- if (end1 === start2 || end2 === start1) {
- return 0;
- }
- if (start1 < start2) {
- if (end1 < end2) {
- return end1 - start2;
- }
- return end2 - start2;
- }
- if (end2 < end1) {
- return end2 - start1;
- }
- return end1 - start1;
- }
- function mergeSplice(splices, index, removed, addedCount) {
- var splice = newSplice(index, removed, addedCount);
- var inserted = false;
- var insertionOffset = 0;
- for (var _i5 = 0; _i5 < splices.length; _i5++) {
- var current = splices[_i5];
- current.index += insertionOffset;
- if (inserted) {
- continue;
- }
- var intersectCount = intersect(splice.index, splice.index + splice.removed.length, current.index, current.index + current.addedCount);
- if (intersectCount >= 0) {
- splices.splice(_i5, 1);
- _i5--;
- insertionOffset -= current.addedCount - current.removed.length;
- splice.addedCount += current.addedCount - intersectCount;
- var deleteCount = splice.removed.length + current.removed.length - intersectCount;
- if (!splice.addedCount && !deleteCount) {
- inserted = true;
- } else {
- var currentRemoved = current.removed;
- if (splice.index < current.index) {
- var prepend = splice.removed.slice(0, current.index - splice.index);
- Array.prototype.push.apply(prepend, currentRemoved);
- currentRemoved = prepend;
- }
- if (splice.index + splice.removed.length > current.index + current.addedCount) {
- var append = splice.removed.slice(current.index + current.addedCount - splice.index);
- Array.prototype.push.apply(currentRemoved, append);
- }
- splice.removed = currentRemoved;
- if (current.index < splice.index) {
- splice.index = current.index;
- }
- }
- } else if (splice.index < current.index) {
- inserted = true;
- splices.splice(_i5, 0, splice);
- _i5++;
- var offset = splice.addedCount - splice.removed.length;
- current.index += offset;
- insertionOffset += offset;
- }
- }
- if (!inserted) {
- splices.push(splice);
- }
- }
- function createInitialSplices(array, changeRecords) {
- var splices = [];
- for (var _i6 = 0; _i6 < changeRecords.length; _i6++) {
- var record = changeRecords[_i6];
- switch (record.type) {
- case 'splice':
- mergeSplice(splices, record.index, record.removed.slice(), record.addedCount);
- break;
- case 'add':
- case 'update':
- case 'delete':
- if (!isIndex(record.name)) {
- continue;
- }
- var index = toNumber(record.name);
- if (index < 0) {
- continue;
- }
- mergeSplice(splices, index, [record.oldValue], record.type === 'delete' ? 0 : 1);
- break;
- default:
- console.error('Unexpected record type: ' + JSON.stringify(record));
- break;
- }
- }
- return splices;
- }
- function projectArraySplices(array, changeRecords) {
- var splices = [];
- createInitialSplices(array, changeRecords).forEach(function (splice) {
- if (splice.addedCount === 1 && splice.removed.length === 1) {
- if (splice.removed[0] !== array[splice.index]) {
- splices.push(splice);
- }
- return;
- }
- splices = splices.concat(calcSplices(array, splice.index, splice.index + splice.addedCount, splice.removed, 0, splice.removed.length));
- });
- return splices;
- }
- function newRecord(type, object, key, oldValue) {
- return {
- type: type,
- object: object,
- key: key,
- oldValue: oldValue
- };
- }
- function getChangeRecords(map) {
- var entries = new Array(map.size);
- var keys = map.keys();
- var i = 0;
- var item = void 0;
- while (item = keys.next()) {
- if (item.done) {
- break;
- }
- entries[i] = newRecord('added', map, item.value);
- i++;
- }
- return entries;
- }
- var ModifyCollectionObserver = exports.ModifyCollectionObserver = (_dec3 = subscriberCollection(), _dec3(_class2 = function () {
- function ModifyCollectionObserver(taskQueue, collection) {
-
- this.taskQueue = taskQueue;
- this.queued = false;
- this.changeRecords = null;
- this.oldCollection = null;
- this.collection = collection;
- this.lengthPropertyName = collection instanceof Map || collection instanceof Set ? 'size' : 'length';
- }
- ModifyCollectionObserver.prototype.subscribe = function subscribe(context, callable) {
- this.addSubscriber(context, callable);
- };
- ModifyCollectionObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
- this.removeSubscriber(context, callable);
- };
- ModifyCollectionObserver.prototype.addChangeRecord = function addChangeRecord(changeRecord) {
- if (!this.hasSubscribers() && !this.lengthObserver) {
- return;
- }
- if (changeRecord.type === 'splice') {
- var index = changeRecord.index;
- var arrayLength = changeRecord.object.length;
- if (index > arrayLength) {
- index = arrayLength - changeRecord.addedCount;
- } else if (index < 0) {
- index = arrayLength + changeRecord.removed.length + index - changeRecord.addedCount;
- }
- if (index < 0) {
- index = 0;
- }
- changeRecord.index = index;
- }
- if (this.changeRecords === null) {
- this.changeRecords = [changeRecord];
- } else {
- this.changeRecords.push(changeRecord);
- }
- if (!this.queued) {
- this.queued = true;
- this.taskQueue.queueMicroTask(this);
- }
- };
- ModifyCollectionObserver.prototype.flushChangeRecords = function flushChangeRecords() {
- if (this.changeRecords && this.changeRecords.length || this.oldCollection) {
- this.call();
- }
- };
- ModifyCollectionObserver.prototype.reset = function reset(oldCollection) {
- this.oldCollection = oldCollection;
- if (this.hasSubscribers() && !this.queued) {
- this.queued = true;
- this.taskQueue.queueMicroTask(this);
- }
- };
- ModifyCollectionObserver.prototype.getLengthObserver = function getLengthObserver() {
- return this.lengthObserver || (this.lengthObserver = new CollectionLengthObserver(this.collection));
- };
- ModifyCollectionObserver.prototype.call = function call() {
- var changeRecords = this.changeRecords;
- var oldCollection = this.oldCollection;
- var records = void 0;
- this.queued = false;
- this.changeRecords = [];
- this.oldCollection = null;
- if (this.hasSubscribers()) {
- if (oldCollection) {
- if (this.collection instanceof Map || this.collection instanceof Set) {
- records = getChangeRecords(oldCollection);
- } else {
- records = calcSplices(this.collection, 0, this.collection.length, oldCollection, 0, oldCollection.length);
- }
- } else {
- if (this.collection instanceof Map || this.collection instanceof Set) {
- records = changeRecords;
- } else {
- records = projectArraySplices(this.collection, changeRecords);
- }
- }
- this.callSubscribers(records);
- }
- if (this.lengthObserver) {
- this.lengthObserver.call(this.collection[this.lengthPropertyName]);
- }
- };
- return ModifyCollectionObserver;
- }()) || _class2);
- var CollectionLengthObserver = exports.CollectionLengthObserver = (_dec4 = subscriberCollection(), _dec4(_class3 = function () {
- function CollectionLengthObserver(collection) {
-
- this.collection = collection;
- this.lengthPropertyName = collection instanceof Map || collection instanceof Set ? 'size' : 'length';
- this.currentValue = collection[this.lengthPropertyName];
- }
- CollectionLengthObserver.prototype.getValue = function getValue() {
- return this.collection[this.lengthPropertyName];
- };
- CollectionLengthObserver.prototype.setValue = function setValue(newValue) {
- this.collection[this.lengthPropertyName] = newValue;
- };
- CollectionLengthObserver.prototype.subscribe = function subscribe(context, callable) {
- this.addSubscriber(context, callable);
- };
- CollectionLengthObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
- this.removeSubscriber(context, callable);
- };
- CollectionLengthObserver.prototype.call = function call(newValue) {
- var oldValue = this.currentValue;
- this.callSubscribers(newValue, oldValue);
- this.currentValue = newValue;
- };
- return CollectionLengthObserver;
- }()) || _class3);
- var pop = Array.prototype.pop;
- var push = Array.prototype.push;
- var reverse = Array.prototype.reverse;
- var shift = Array.prototype.shift;
- var sort = Array.prototype.sort;
- var splice = Array.prototype.splice;
- var unshift = Array.prototype.unshift;
- Array.prototype.pop = function () {
- var notEmpty = this.length > 0;
- var methodCallResult = pop.apply(this, arguments);
- if (notEmpty && this.__array_observer__ !== undefined) {
- this.__array_observer__.addChangeRecord({
- type: 'delete',
- object: this,
- name: this.length,
- oldValue: methodCallResult
- });
- }
- return methodCallResult;
- };
- Array.prototype.push = function () {
- var methodCallResult = push.apply(this, arguments);
- if (this.__array_observer__ !== undefined) {
- this.__array_observer__.addChangeRecord({
- type: 'splice',
- object: this,
- index: this.length - arguments.length,
- removed: [],
- addedCount: arguments.length
- });
- }
- return methodCallResult;
- };
- Array.prototype.reverse = function () {
- var oldArray = void 0;
- if (this.__array_observer__ !== undefined) {
- this.__array_observer__.flushChangeRecords();
- oldArray = this.slice();
- }
- var methodCallResult = reverse.apply(this, arguments);
- if (this.__array_observer__ !== undefined) {
- this.__array_observer__.reset(oldArray);
- }
- return methodCallResult;
- };
- Array.prototype.shift = function () {
- var notEmpty = this.length > 0;
- var methodCallResult = shift.apply(this, arguments);
- if (notEmpty && this.__array_observer__ !== undefined) {
- this.__array_observer__.addChangeRecord({
- type: 'delete',
- object: this,
- name: 0,
- oldValue: methodCallResult
- });
- }
- return methodCallResult;
- };
- Array.prototype.sort = function () {
- var oldArray = void 0;
- if (this.__array_observer__ !== undefined) {
- this.__array_observer__.flushChangeRecords();
- oldArray = this.slice();
- }
- var methodCallResult = sort.apply(this, arguments);
- if (this.__array_observer__ !== undefined) {
- this.__array_observer__.reset(oldArray);
- }
- return methodCallResult;
- };
- Array.prototype.splice = function () {
- var methodCallResult = splice.apply(this, arguments);
- if (this.__array_observer__ !== undefined) {
- this.__array_observer__.addChangeRecord({
- type: 'splice',
- object: this,
- index: arguments[0],
- removed: methodCallResult,
- addedCount: arguments.length > 2 ? arguments.length - 2 : 0
- });
- }
- return methodCallResult;
- };
- Array.prototype.unshift = function () {
- var methodCallResult = unshift.apply(this, arguments);
- if (this.__array_observer__ !== undefined) {
- this.__array_observer__.addChangeRecord({
- type: 'splice',
- object: this,
- index: 0,
- removed: [],
- addedCount: arguments.length
- });
- }
- return methodCallResult;
- };
- function _getArrayObserver(taskQueue, array) {
- return ModifyArrayObserver.for(taskQueue, array);
- }
- exports.getArrayObserver = _getArrayObserver;
- var ModifyArrayObserver = function (_ModifyCollectionObse) {
- _inherits(ModifyArrayObserver, _ModifyCollectionObse);
- function ModifyArrayObserver(taskQueue, array) {
-
- return _possibleConstructorReturn(this, _ModifyCollectionObse.call(this, taskQueue, array));
- }
- ModifyArrayObserver.for = function _for(taskQueue, array) {
- if (!('__array_observer__' in array)) {
- Reflect.defineProperty(array, '__array_observer__', {
- value: ModifyArrayObserver.create(taskQueue, array),
- enumerable: false, configurable: false
- });
- }
- return array.__array_observer__;
- };
- ModifyArrayObserver.create = function create(taskQueue, array) {
- return new ModifyArrayObserver(taskQueue, array);
- };
- return ModifyArrayObserver;
- }(ModifyCollectionObserver);
- var Expression = exports.Expression = function () {
- function Expression() {
-
- this.isChain = false;
- this.isAssignable = false;
- }
- Expression.prototype.evaluate = function evaluate(scope, lookupFunctions, args) {
- throw new Error('Binding expression "' + this + '" cannot be evaluated.');
- };
- Expression.prototype.assign = function assign(scope, value, lookupFunctions) {
- throw new Error('Binding expression "' + this + '" cannot be assigned to.');
- };
- Expression.prototype.toString = function toString() {
- return Unparser.unparse(this);
- };
- return Expression;
- }();
- var Chain = exports.Chain = function (_Expression) {
- _inherits(Chain, _Expression);
- function Chain(expressions) {
-
- var _this3 = _possibleConstructorReturn(this, _Expression.call(this));
- _this3.expressions = expressions;
- _this3.isChain = true;
- return _this3;
- }
- Chain.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- var result = void 0;
- var expressions = this.expressions;
- var last = void 0;
- for (var _i7 = 0, length = expressions.length; _i7 < length; ++_i7) {
- last = expressions[_i7].evaluate(scope, lookupFunctions);
- if (last !== null) {
- result = last;
- }
- }
- return result;
- };
- Chain.prototype.accept = function accept(visitor) {
- return visitor.visitChain(this);
- };
- return Chain;
- }(Expression);
- var BindingBehavior = exports.BindingBehavior = function (_Expression2) {
- _inherits(BindingBehavior, _Expression2);
- function BindingBehavior(expression, name, args) {
-
- var _this4 = _possibleConstructorReturn(this, _Expression2.call(this));
- _this4.expression = expression;
- _this4.name = name;
- _this4.args = args;
- return _this4;
- }
- BindingBehavior.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- return this.expression.evaluate(scope, lookupFunctions);
- };
- BindingBehavior.prototype.assign = function assign(scope, value, lookupFunctions) {
- return this.expression.assign(scope, value, lookupFunctions);
- };
- BindingBehavior.prototype.accept = function accept(visitor) {
- return visitor.visitBindingBehavior(this);
- };
- BindingBehavior.prototype.connect = function connect(binding, scope) {
- this.expression.connect(binding, scope);
- };
- BindingBehavior.prototype.bind = function bind(binding, scope, lookupFunctions) {
- if (this.expression.expression && this.expression.bind) {
- this.expression.bind(binding, scope, lookupFunctions);
- }
- var behavior = lookupFunctions.bindingBehaviors(this.name);
- if (!behavior) {
- throw new Error('No BindingBehavior named "' + this.name + '" was found!');
- }
- var behaviorKey = 'behavior-' + this.name;
- if (binding[behaviorKey]) {
- throw new Error('A binding behavior named "' + this.name + '" has already been applied to "' + this.expression + '"');
- }
- binding[behaviorKey] = behavior;
- behavior.bind.apply(behavior, [binding, scope].concat(evalList(scope, this.args, binding.lookupFunctions)));
- };
- BindingBehavior.prototype.unbind = function unbind(binding, scope) {
- var behaviorKey = 'behavior-' + this.name;
- binding[behaviorKey].unbind(binding, scope);
- binding[behaviorKey] = null;
- if (this.expression.expression && this.expression.unbind) {
- this.expression.unbind(binding, scope);
- }
- };
- return BindingBehavior;
- }(Expression);
- var ValueConverter = exports.ValueConverter = function (_Expression3) {
- _inherits(ValueConverter, _Expression3);
- function ValueConverter(expression, name, args, allArgs) {
-
- var _this5 = _possibleConstructorReturn(this, _Expression3.call(this));
- _this5.expression = expression;
- _this5.name = name;
- _this5.args = args;
- _this5.allArgs = allArgs;
- return _this5;
- }
- ValueConverter.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- var converter = lookupFunctions.valueConverters(this.name);
- if (!converter) {
- throw new Error('No ValueConverter named "' + this.name + '" was found!');
- }
- if ('toView' in converter) {
- return converter.toView.apply(converter, evalList(scope, this.allArgs, lookupFunctions));
- }
- return this.allArgs[0].evaluate(scope, lookupFunctions);
- };
- ValueConverter.prototype.assign = function assign(scope, value, lookupFunctions) {
- var converter = lookupFunctions.valueConverters(this.name);
- if (!converter) {
- throw new Error('No ValueConverter named "' + this.name + '" was found!');
- }
- if ('fromView' in converter) {
- value = converter.fromView.apply(converter, [value].concat(evalList(scope, this.args, lookupFunctions)));
- }
- return this.allArgs[0].assign(scope, value, lookupFunctions);
- };
- ValueConverter.prototype.accept = function accept(visitor) {
- return visitor.visitValueConverter(this);
- };
- ValueConverter.prototype.connect = function connect(binding, scope) {
- var expressions = this.allArgs;
- var i = expressions.length;
- while (i--) {
- expressions[i].connect(binding, scope);
- }
- };
- return ValueConverter;
- }(Expression);
- var Assign = exports.Assign = function (_Expression4) {
- _inherits(Assign, _Expression4);
- function Assign(target, value) {
-
- var _this6 = _possibleConstructorReturn(this, _Expression4.call(this));
- _this6.target = target;
- _this6.value = value;
- return _this6;
- }
- Assign.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- return this.target.assign(scope, this.value.evaluate(scope, lookupFunctions));
- };
- Assign.prototype.accept = function accept(vistor) {
- vistor.visitAssign(this);
- };
- Assign.prototype.connect = function connect(binding, scope) {};
- return Assign;
- }(Expression);
- var Conditional = exports.Conditional = function (_Expression5) {
- _inherits(Conditional, _Expression5);
- function Conditional(condition, yes, no) {
-
- var _this7 = _possibleConstructorReturn(this, _Expression5.call(this));
- _this7.condition = condition;
- _this7.yes = yes;
- _this7.no = no;
- return _this7;
- }
- Conditional.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- return !!this.condition.evaluate(scope) ? this.yes.evaluate(scope) : this.no.evaluate(scope);
- };
- Conditional.prototype.accept = function accept(visitor) {
- return visitor.visitConditional(this);
- };
- Conditional.prototype.connect = function connect(binding, scope) {
- this.condition.connect(binding, scope);
- if (this.condition.evaluate(scope)) {
- this.yes.connect(binding, scope);
- } else {
- this.no.connect(binding, scope);
- }
- };
- return Conditional;
- }(Expression);
- var AccessThis = exports.AccessThis = function (_Expression6) {
- _inherits(AccessThis, _Expression6);
- function AccessThis(ancestor) {
-
- var _this8 = _possibleConstructorReturn(this, _Expression6.call(this));
- _this8.ancestor = ancestor;
- return _this8;
- }
- AccessThis.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- var oc = scope.overrideContext;
- var i = this.ancestor;
- while (i-- && oc) {
- oc = oc.parentOverrideContext;
- }
- return i < 1 && oc ? oc.bindingContext : undefined;
- };
- AccessThis.prototype.accept = function accept(visitor) {
- return visitor.visitAccessThis(this);
- };
- AccessThis.prototype.connect = function connect(binding, scope) {};
- return AccessThis;
- }(Expression);
- var AccessScope = exports.AccessScope = function (_Expression7) {
- _inherits(AccessScope, _Expression7);
- function AccessScope(name, ancestor) {
-
- var _this9 = _possibleConstructorReturn(this, _Expression7.call(this));
- _this9.name = name;
- _this9.ancestor = ancestor;
- _this9.isAssignable = true;
- return _this9;
- }
- AccessScope.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- var context = getContextFor(this.name, scope, this.ancestor);
- return context[this.name];
- };
- AccessScope.prototype.assign = function assign(scope, value) {
- var context = getContextFor(this.name, scope, this.ancestor);
- return context ? context[this.name] = value : undefined;
- };
- AccessScope.prototype.accept = function accept(visitor) {
- return visitor.visitAccessScope(this);
- };
- AccessScope.prototype.connect = function connect(binding, scope) {
- var context = getContextFor(this.name, scope, this.ancestor);
- binding.observeProperty(context, this.name);
- };
- return AccessScope;
- }(Expression);
- var AccessMember = exports.AccessMember = function (_Expression8) {
- _inherits(AccessMember, _Expression8);
- function AccessMember(object, name) {
-
- var _this10 = _possibleConstructorReturn(this, _Expression8.call(this));
- _this10.object = object;
- _this10.name = name;
- _this10.isAssignable = true;
- return _this10;
- }
- AccessMember.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- var instance = this.object.evaluate(scope, lookupFunctions);
- return instance === null || instance === undefined ? instance : instance[this.name];
- };
- AccessMember.prototype.assign = function assign(scope, value) {
- var instance = this.object.evaluate(scope);
- if (instance === null || instance === undefined) {
- instance = {};
- this.object.assign(scope, instance);
- }
- instance[this.name] = value;
- return value;
- };
- AccessMember.prototype.accept = function accept(visitor) {
- return visitor.visitAccessMember(this);
- };
- AccessMember.prototype.connect = function connect(binding, scope) {
- this.object.connect(binding, scope);
- var obj = this.object.evaluate(scope);
- if (obj) {
- binding.observeProperty(obj, this.name);
- }
- };
- return AccessMember;
- }(Expression);
- var AccessKeyed = exports.AccessKeyed = function (_Expression9) {
- _inherits(AccessKeyed, _Expression9);
- function AccessKeyed(object, key) {
-
- var _this11 = _possibleConstructorReturn(this, _Expression9.call(this));
- _this11.object = object;
- _this11.key = key;
- _this11.isAssignable = true;
- return _this11;
- }
- AccessKeyed.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- var instance = this.object.evaluate(scope, lookupFunctions);
- var lookup = this.key.evaluate(scope, lookupFunctions);
- return getKeyed(instance, lookup);
- };
- AccessKeyed.prototype.assign = function assign(scope, value) {
- var instance = this.object.evaluate(scope);
- var lookup = this.key.evaluate(scope);
- return setKeyed(instance, lookup, value);
- };
- AccessKeyed.prototype.accept = function accept(visitor) {
- return visitor.visitAccessKeyed(this);
- };
- AccessKeyed.prototype.connect = function connect(binding, scope) {
- this.object.connect(binding, scope);
- var obj = this.object.evaluate(scope);
- if (obj instanceof Object) {
- this.key.connect(binding, scope);
- var key = this.key.evaluate(scope);
- if (key !== null && key !== undefined && !(Array.isArray(obj) && typeof key === 'number')) {
- binding.observeProperty(obj, key);
- }
- }
- };
- return AccessKeyed;
- }(Expression);
- var CallScope = exports.CallScope = function (_Expression10) {
- _inherits(CallScope, _Expression10);
- function CallScope(name, args, ancestor) {
-
- var _this12 = _possibleConstructorReturn(this, _Expression10.call(this));
- _this12.name = name;
- _this12.args = args;
- _this12.ancestor = ancestor;
- return _this12;
- }
- CallScope.prototype.evaluate = function evaluate(scope, lookupFunctions, mustEvaluate) {
- var args = evalList(scope, this.args, lookupFunctions);
- var context = getContextFor(this.name, scope, this.ancestor);
- var func = getFunction(context, this.name, mustEvaluate);
- if (func) {
- return func.apply(context, args);
- }
- return undefined;
- };
- CallScope.prototype.accept = function accept(visitor) {
- return visitor.visitCallScope(this);
- };
- CallScope.prototype.connect = function connect(binding, scope) {
- var args = this.args;
- var i = args.length;
- while (i--) {
- args[i].connect(binding, scope);
- }
- };
- return CallScope;
- }(Expression);
- var CallMember = exports.CallMember = function (_Expression11) {
- _inherits(CallMember, _Expression11);
- function CallMember(object, name, args) {
-
- var _this13 = _possibleConstructorReturn(this, _Expression11.call(this));
- _this13.object = object;
- _this13.name = name;
- _this13.args = args;
- return _this13;
- }
- CallMember.prototype.evaluate = function evaluate(scope, lookupFunctions, mustEvaluate) {
- var instance = this.object.evaluate(scope, lookupFunctions);
- var args = evalList(scope, this.args, lookupFunctions);
- var func = getFunction(instance, this.name, mustEvaluate);
- if (func) {
- return func.apply(instance, args);
- }
- return undefined;
- };
- CallMember.prototype.accept = function accept(visitor) {
- return visitor.visitCallMember(this);
- };
- CallMember.prototype.connect = function connect(binding, scope) {
- this.object.connect(binding, scope);
- var obj = this.object.evaluate(scope);
- if (getFunction(obj, this.name, false)) {
- var args = this.args;
- var _i8 = args.length;
- while (_i8--) {
- args[_i8].connect(binding, scope);
- }
- }
- };
- return CallMember;
- }(Expression);
- var CallFunction = exports.CallFunction = function (_Expression12) {
- _inherits(CallFunction, _Expression12);
- function CallFunction(func, args) {
-
- var _this14 = _possibleConstructorReturn(this, _Expression12.call(this));
- _this14.func = func;
- _this14.args = args;
- return _this14;
- }
- CallFunction.prototype.evaluate = function evaluate(scope, lookupFunctions, mustEvaluate) {
- var func = this.func.evaluate(scope, lookupFunctions);
- if (typeof func === 'function') {
- return func.apply(null, evalList(scope, this.args, lookupFunctions));
- }
- if (!mustEvaluate && (func === null || func === undefined)) {
- return undefined;
- }
- throw new Error(this.func + ' is not a function');
- };
- CallFunction.prototype.accept = function accept(visitor) {
- return visitor.visitCallFunction(this);
- };
- CallFunction.prototype.connect = function connect(binding, scope) {
- this.func.connect(binding, scope);
- var func = this.func.evaluate(scope);
- if (typeof func === 'function') {
- var args = this.args;
- var _i9 = args.length;
- while (_i9--) {
- args[_i9].connect(binding, scope);
- }
- }
- };
- return CallFunction;
- }(Expression);
- var Binary = exports.Binary = function (_Expression13) {
- _inherits(Binary, _Expression13);
- function Binary(operation, left, right) {
-
- var _this15 = _possibleConstructorReturn(this, _Expression13.call(this));
- _this15.operation = operation;
- _this15.left = left;
- _this15.right = right;
- return _this15;
- }
- Binary.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- var left = this.left.evaluate(scope);
- switch (this.operation) {
- case '&&':
- return left && this.right.evaluate(scope);
- case '||':
- return left || this.right.evaluate(scope);
- }
- var right = this.right.evaluate(scope);
- switch (this.operation) {
- case '==':
- return left == right;
- case '===':
- return left === right;
- case '!=':
- return left != right;
- case '!==':
- return left !== right;
- }
- if (left === null || right === null || left === undefined || right === undefined) {
- switch (this.operation) {
- case '+':
- if (left !== null && left !== undefined) return left;
- if (right !== null && right !== undefined) return right;
- return 0;
- case '-':
- if (left !== null && left !== undefined) return left;
- if (right !== null && right !== undefined) return 0 - right;
- return 0;
- }
- return null;
- }
- switch (this.operation) {
- case '+':
- return autoConvertAdd(left, right);
- case '-':
- return left - right;
- case '*':
- return left * right;
- case '/':
- return left / right;
- case '%':
- return left % right;
- case '<':
- return left < right;
- case '>':
- return left > right;
- case '<=':
- return left <= right;
- case '>=':
- return left >= right;
- case '^':
- return left ^ right;
- }
- throw new Error('Internal error [' + this.operation + '] not handled');
- };
- Binary.prototype.accept = function accept(visitor) {
- return visitor.visitBinary(this);
- };
- Binary.prototype.connect = function connect(binding, scope) {
- this.left.connect(binding, scope);
- var left = this.left.evaluate(scope);
- if (this.operation === '&&' && !left || this.operation === '||' && left) {
- return;
- }
- this.right.connect(binding, scope);
- };
- return Binary;
- }(Expression);
- var PrefixNot = exports.PrefixNot = function (_Expression14) {
- _inherits(PrefixNot, _Expression14);
- function PrefixNot(operation, expression) {
-
- var _this16 = _possibleConstructorReturn(this, _Expression14.call(this));
- _this16.operation = operation;
- _this16.expression = expression;
- return _this16;
- }
- PrefixNot.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- return !this.expression.evaluate(scope);
- };
- PrefixNot.prototype.accept = function accept(visitor) {
- return visitor.visitPrefix(this);
- };
- PrefixNot.prototype.connect = function connect(binding, scope) {
- this.expression.connect(binding, scope);
- };
- return PrefixNot;
- }(Expression);
- var LiteralPrimitive = exports.LiteralPrimitive = function (_Expression15) {
- _inherits(LiteralPrimitive, _Expression15);
- function LiteralPrimitive(value) {
-
- var _this17 = _possibleConstructorReturn(this, _Expression15.call(this));
- _this17.value = value;
- return _this17;
- }
- LiteralPrimitive.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- return this.value;
- };
- LiteralPrimitive.prototype.accept = function accept(visitor) {
- return visitor.visitLiteralPrimitive(this);
- };
- LiteralPrimitive.prototype.connect = function connect(binding, scope) {};
- return LiteralPrimitive;
- }(Expression);
- var LiteralString = exports.LiteralString = function (_Expression16) {
- _inherits(LiteralString, _Expression16);
- function LiteralString(value) {
-
- var _this18 = _possibleConstructorReturn(this, _Expression16.call(this));
- _this18.value = value;
- return _this18;
- }
- LiteralString.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- return this.value;
- };
- LiteralString.prototype.accept = function accept(visitor) {
- return visitor.visitLiteralString(this);
- };
- LiteralString.prototype.connect = function connect(binding, scope) {};
- return LiteralString;
- }(Expression);
- var LiteralArray = exports.LiteralArray = function (_Expression17) {
- _inherits(LiteralArray, _Expression17);
- function LiteralArray(elements) {
-
- var _this19 = _possibleConstructorReturn(this, _Expression17.call(this));
- _this19.elements = elements;
- return _this19;
- }
- LiteralArray.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- var elements = this.elements;
- var result = [];
- for (var _i10 = 0, length = elements.length; _i10 < length; ++_i10) {
- result[_i10] = elements[_i10].evaluate(scope, lookupFunctions);
- }
- return result;
- };
- LiteralArray.prototype.accept = function accept(visitor) {
- return visitor.visitLiteralArray(this);
- };
- LiteralArray.prototype.connect = function connect(binding, scope) {
- var length = this.elements.length;
- for (var _i11 = 0; _i11 < length; _i11++) {
- this.elements[_i11].connect(binding, scope);
- }
- };
- return LiteralArray;
- }(Expression);
- var LiteralObject = exports.LiteralObject = function (_Expression18) {
- _inherits(LiteralObject, _Expression18);
- function LiteralObject(keys, values) {
-
- var _this20 = _possibleConstructorReturn(this, _Expression18.call(this));
- _this20.keys = keys;
- _this20.values = values;
- return _this20;
- }
- LiteralObject.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- var instance = {};
- var keys = this.keys;
- var values = this.values;
- for (var _i12 = 0, length = keys.length; _i12 < length; ++_i12) {
- instance[keys[_i12]] = values[_i12].evaluate(scope, lookupFunctions);
- }
- return instance;
- };
- LiteralObject.prototype.accept = function accept(visitor) {
- return visitor.visitLiteralObject(this);
- };
- LiteralObject.prototype.connect = function connect(binding, scope) {
- var length = this.keys.length;
- for (var _i13 = 0; _i13 < length; _i13++) {
- this.values[_i13].connect(binding, scope);
- }
- };
- return LiteralObject;
- }(Expression);
- var evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0]];
- function evalList(scope, list, lookupFunctions) {
- var length = list.length;
- for (var cacheLength = evalListCache.length; cacheLength <= length; ++cacheLength) {
- evalListCache.push([]);
- }
- var result = evalListCache[length];
- for (var _i14 = 0; _i14 < length; ++_i14) {
- result[_i14] = list[_i14].evaluate(scope, lookupFunctions);
- }
- return result;
- }
- function autoConvertAdd(a, b) {
- if (a !== null && b !== null) {
- if (typeof a === 'string' && typeof b !== 'string') {
- return a + b.toString();
- }
- if (typeof a !== 'string' && typeof b === 'string') {
- return a.toString() + b;
- }
- return a + b;
- }
- if (a !== null) {
- return a;
- }
- if (b !== null) {
- return b;
- }
- return 0;
- }
- function getFunction(obj, name, mustExist) {
- var func = obj === null || obj === undefined ? null : obj[name];
- if (typeof func === 'function') {
- return func;
- }
- if (!mustExist && (func === null || func === undefined)) {
- return null;
- }
- throw new Error(name + ' is not a function');
- }
- function getKeyed(obj, key) {
- if (Array.isArray(obj)) {
- return obj[parseInt(key, 10)];
- } else if (obj) {
- return obj[key];
- } else if (obj === null || obj === undefined) {
- return undefined;
- }
- return obj[key];
- }
- function setKeyed(obj, key, value) {
- if (Array.isArray(obj)) {
- var index = parseInt(key, 10);
- if (obj.length <= index) {
- obj.length = index + 1;
- }
- obj[index] = value;
- } else {
- obj[key] = value;
- }
- return value;
- }
- var Unparser = exports.Unparser = function () {
- function Unparser(buffer) {
-
- this.buffer = buffer;
- }
- Unparser.unparse = function unparse(expression) {
- var buffer = [];
- var visitor = new Unparser(buffer);
- expression.accept(visitor);
- return buffer.join('');
- };
- Unparser.prototype.write = function write(text) {
- this.buffer.push(text);
- };
- Unparser.prototype.writeArgs = function writeArgs(args) {
- this.write('(');
- for (var _i15 = 0, length = args.length; _i15 < length; ++_i15) {
- if (_i15 !== 0) {
- this.write(',');
- }
- args[_i15].accept(this);
- }
- this.write(')');
- };
- Unparser.prototype.visitChain = function visitChain(chain) {
- var expressions = chain.expressions;
- for (var _i16 = 0, length = expression.length; _i16 < length; ++_i16) {
- if (_i16 !== 0) {
- this.write(';');
- }
- expressions[_i16].accept(this);
- }
- };
- Unparser.prototype.visitBindingBehavior = function visitBindingBehavior(behavior) {
- var args = behavior.args;
- behavior.expression.accept(this);
- this.write('&' + behavior.name);
- for (var _i17 = 0, length = args.length; _i17 < length; ++_i17) {
- this.write(':');
- args[_i17].accept(this);
- }
- };
- Unparser.prototype.visitValueConverter = function visitValueConverter(converter) {
- var args = converter.args;
- converter.expression.accept(this);
- this.write('|' + converter.name);
- for (var _i18 = 0, length = args.length; _i18 < length; ++_i18) {
- this.write(':');
- args[_i18].accept(this);
- }
- };
- Unparser.prototype.visitAssign = function visitAssign(assign) {
- assign.target.accept(this);
- this.write('=');
- assign.value.accept(this);
- };
- Unparser.prototype.visitConditional = function visitConditional(conditional) {
- conditional.condition.accept(this);
- this.write('?');
- conditional.yes.accept(this);
- this.write(':');
- conditional.no.accept(this);
- };
- Unparser.prototype.visitAccessThis = function visitAccessThis(access) {
- if (access.ancestor === 0) {
- this.write('$this');
- return;
- }
- this.write('$parent');
- var i = access.ancestor - 1;
- while (i--) {
- this.write('.$parent');
- }
- };
- Unparser.prototype.visitAccessScope = function visitAccessScope(access) {
- var i = access.ancestor;
- while (i--) {
- this.write('$parent.');
- }
- this.write(access.name);
- };
- Unparser.prototype.visitAccessMember = function visitAccessMember(access) {
- access.object.accept(this);
- this.write('.' + access.name);
- };
- Unparser.prototype.visitAccessKeyed = function visitAccessKeyed(access) {
- access.object.accept(this);
- this.write('[');
- access.key.accept(this);
- this.write(']');
- };
- Unparser.prototype.visitCallScope = function visitCallScope(call) {
- var i = call.ancestor;
- while (i--) {
- this.write('$parent.');
- }
- this.write(call.name);
- this.writeArgs(call.args);
- };
- Unparser.prototype.visitCallFunction = function visitCallFunction(call) {
- call.func.accept(this);
- this.writeArgs(call.args);
- };
- Unparser.prototype.visitCallMember = function visitCallMember(call) {
- call.object.accept(this);
- this.write('.' + call.name);
- this.writeArgs(call.args);
- };
- Unparser.prototype.visitPrefix = function visitPrefix(prefix) {
- this.write('(' + prefix.operation);
- prefix.expression.accept(this);
- this.write(')');
- };
- Unparser.prototype.visitBinary = function visitBinary(binary) {
- binary.left.accept(this);
- this.write(binary.operation);
- binary.right.accept(this);
- };
- Unparser.prototype.visitLiteralPrimitive = function visitLiteralPrimitive(literal) {
- this.write('' + literal.value);
- };
- Unparser.prototype.visitLiteralArray = function visitLiteralArray(literal) {
- var elements = literal.elements;
- this.write('[');
- for (var _i19 = 0, length = elements.length; _i19 < length; ++_i19) {
- if (_i19 !== 0) {
- this.write(',');
- }
- elements[_i19].accept(this);
- }
- this.write(']');
- };
- Unparser.prototype.visitLiteralObject = function visitLiteralObject(literal) {
- var keys = literal.keys;
- var values = literal.values;
- this.write('{');
- for (var _i20 = 0, length = keys.length; _i20 < length; ++_i20) {
- if (_i20 !== 0) {
- this.write(',');
- }
- this.write('\'' + keys[_i20] + '\':');
- values[_i20].accept(this);
- }
- this.write('}');
- };
- Unparser.prototype.visitLiteralString = function visitLiteralString(literal) {
- var escaped = literal.value.replace(/'/g, "\'");
- this.write('\'' + escaped + '\'');
- };
- return Unparser;
- }();
- var ExpressionCloner = exports.ExpressionCloner = function () {
- function ExpressionCloner() {
-
- }
- ExpressionCloner.prototype.cloneExpressionArray = function cloneExpressionArray(array) {
- var clonedArray = [];
- var i = array.length;
- while (i--) {
- clonedArray[i] = array[i].accept(this);
- }
- return clonedArray;
- };
- ExpressionCloner.prototype.visitChain = function visitChain(chain) {
- return new Chain(this.cloneExpressionArray(chain.expressions));
- };
- ExpressionCloner.prototype.visitBindingBehavior = function visitBindingBehavior(behavior) {
- return new BindingBehavior(behavior.expression.accept(this), behavior.name, this.cloneExpressionArray(behavior.args));
- };
- ExpressionCloner.prototype.visitValueConverter = function visitValueConverter(converter) {
- return new ValueConverter(converter.expression.accept(this), converter.name, this.cloneExpressionArray(converter.args));
- };
- ExpressionCloner.prototype.visitAssign = function visitAssign(assign) {
- return new Assign(assign.target.accept(this), assign.value.accept(this));
- };
- ExpressionCloner.prototype.visitConditional = function visitConditional(conditional) {
- return new Conditional(conditional.condition.accept(this), conditional.yes.accept(this), conditional.no.accept(this));
- };
- ExpressionCloner.prototype.visitAccessThis = function visitAccessThis(access) {
- return new AccessThis(access.ancestor);
- };
- ExpressionCloner.prototype.visitAccessScope = function visitAccessScope(access) {
- return new AccessScope(access.name, access.ancestor);
- };
- ExpressionCloner.prototype.visitAccessMember = function visitAccessMember(access) {
- return new AccessMember(access.object.accept(this), access.name);
- };
- ExpressionCloner.prototype.visitAccessKeyed = function visitAccessKeyed(access) {
- return new AccessKeyed(access.object.accept(this), access.key.accept(this));
- };
- ExpressionCloner.prototype.visitCallScope = function visitCallScope(call) {
- return new CallScope(call.name, this.cloneExpressionArray(call.args), call.ancestor);
- };
- ExpressionCloner.prototype.visitCallFunction = function visitCallFunction(call) {
- return new CallFunction(call.func.accept(this), this.cloneExpressionArray(call.args));
- };
- ExpressionCloner.prototype.visitCallMember = function visitCallMember(call) {
- return new CallMember(call.object.accept(this), call.name, this.cloneExpressionArray(call.args));
- };
- ExpressionCloner.prototype.visitPrefix = function visitPrefix(prefix) {
- return new PrefixNot(prefix.operation, prefix.expression.accept(this));
- };
- ExpressionCloner.prototype.visitBinary = function visitBinary(binary) {
- return new Binary(binary.operation, binary.left.accept(this), binary.right.accept(this));
- };
- ExpressionCloner.prototype.visitLiteralPrimitive = function visitLiteralPrimitive(literal) {
- return new LiteralPrimitive(literal);
- };
- ExpressionCloner.prototype.visitLiteralArray = function visitLiteralArray(literal) {
- return new LiteralArray(this.cloneExpressionArray(literal.elements));
- };
- ExpressionCloner.prototype.visitLiteralObject = function visitLiteralObject(literal) {
- return new LiteralObject(literal.keys, this.cloneExpressionArray(literal.values));
- };
- ExpressionCloner.prototype.visitLiteralString = function visitLiteralString(literal) {
- return new LiteralString(literal.value);
- };
- return ExpressionCloner;
- }();
- function cloneExpression(expression) {
- var visitor = new ExpressionCloner();
- return expression.accept(visitor);
- }
- var bindingMode = exports.bindingMode = {
- oneTime: 0,
- oneWay: 1,
- twoWay: 2
- };
- var Token = exports.Token = function () {
- function Token(index, text) {
-
- this.index = index;
- this.text = text;
- }
- Token.prototype.withOp = function withOp(op) {
- this.opKey = op;
- return this;
- };
- Token.prototype.withGetterSetter = function withGetterSetter(key) {
- this.key = key;
- return this;
- };
- Token.prototype.withValue = function withValue(value) {
- this.value = value;
- return this;
- };
- Token.prototype.toString = function toString() {
- return 'Token(' + this.text + ')';
- };
- return Token;
- }();
- var Lexer = exports.Lexer = function () {
- function Lexer() {
-
- }
- Lexer.prototype.lex = function lex(text) {
- var scanner = new Scanner(text);
- var tokens = [];
- var token = scanner.scanToken();
- while (token) {
- tokens.push(token);
- token = scanner.scanToken();
- }
- return tokens;
- };
- return Lexer;
- }();
- var Scanner = exports.Scanner = function () {
- function Scanner(input) {
-
- this.input = input;
- this.length = input.length;
- this.peek = 0;
- this.index = -1;
- this.advance();
- }
- Scanner.prototype.scanToken = function scanToken() {
- while (this.peek <= $SPACE) {
- if (++this.index >= this.length) {
- this.peek = $EOF;
- return null;
- }
- this.peek = this.input.charCodeAt(this.index);
- }
- if (isIdentifierStart(this.peek)) {
- return this.scanIdentifier();
- }
- if (isDigit(this.peek)) {
- return this.scanNumber(this.index);
- }
- var start = this.index;
- switch (this.peek) {
- case $PERIOD:
- this.advance();
- return isDigit(this.peek) ? this.scanNumber(start) : new Token(start, '.');
- case $LPAREN:
- case $RPAREN:
- case $LBRACE:
- case $RBRACE:
- case $LBRACKET:
- case $RBRACKET:
- case $COMMA:
- case $COLON:
- case $SEMICOLON:
- return this.scanCharacter(start, String.fromCharCode(this.peek));
- case $SQ:
- case $DQ:
- return this.scanString();
- case $PLUS:
- case $MINUS:
- case $STAR:
- case $SLASH:
- case $PERCENT:
- case $CARET:
- case $QUESTION:
- return this.scanOperator(start, String.fromCharCode(this.peek));
- case $LT:
- case $GT:
- case $BANG:
- case $EQ:
- return this.scanComplexOperator(start, $EQ, String.fromCharCode(this.peek), '=');
- case $AMPERSAND:
- return this.scanComplexOperator(start, $AMPERSAND, '&', '&');
- case $BAR:
- return this.scanComplexOperator(start, $BAR, '|', '|');
- case $NBSP:
- while (isWhitespace(this.peek)) {
- this.advance();
- }
- return this.scanToken();
- }
- var character = String.fromCharCode(this.peek);
- this.error('Unexpected character [' + character + ']');
- return null;
- };
- Scanner.prototype.scanCharacter = function scanCharacter(start, text) {
- assert(this.peek === text.charCodeAt(0));
- this.advance();
- return new Token(start, text);
- };
- Scanner.prototype.scanOperator = function scanOperator(start, text) {
- assert(this.peek === text.charCodeAt(0));
- assert(OPERATORS.indexOf(text) !== -1);
- this.advance();
- return new Token(start, text).withOp(text);
- };
- Scanner.prototype.scanComplexOperator = function scanComplexOperator(start, code, one, two) {
- assert(this.peek === one.charCodeAt(0));
- this.advance();
- var text = one;
- if (this.peek === code) {
- this.advance();
- text += two;
- }
- if (this.peek === code) {
- this.advance();
- text += two;
- }
- assert(OPERATORS.indexOf(text) !== -1);
- return new Token(start, text).withOp(text);
- };
- Scanner.prototype.scanIdentifier = function scanIdentifier() {
- assert(isIdentifierStart(this.peek));
- var start = this.index;
- this.advance();
- while (isIdentifierPart(this.peek)) {
- this.advance();
- }
- var text = this.input.substring(start, this.index);
- var result = new Token(start, text);
- if (OPERATORS.indexOf(text) !== -1) {
- result.withOp(text);
- } else {
- result.withGetterSetter(text);
- }
- return result;
- };
- Scanner.prototype.scanNumber = function scanNumber(start) {
- assert(isDigit(this.peek));
- var simple = this.index === start;
- this.advance();
- while (true) {
- if (!isDigit(this.peek)) {
- if (this.peek === $PERIOD) {
- simple = false;
- } else if (isExponentStart(this.peek)) {
- this.advance();
- if (isExponentSign(this.peek)) {
- this.advance();
- }
- if (!isDigit(this.peek)) {
- this.error('Invalid exponent', -1);
- }
- simple = false;
- } else {
- break;
- }
- }
- this.advance();
- }
- var text = this.input.substring(start, this.index);
- var value = simple ? parseInt(text, 10) : parseFloat(text);
- return new Token(start, text).withValue(value);
- };
- Scanner.prototype.scanString = function scanString() {
- assert(this.peek === $SQ || this.peek === $DQ);
- var start = this.index;
- var quote = this.peek;
- this.advance();
- var buffer = void 0;
- var marker = this.index;
- while (this.peek !== quote) {
- if (this.peek === $BACKSLASH) {
- if (!buffer) {
- buffer = [];
- }
- buffer.push(this.input.substring(marker, this.index));
- this.advance();
- var _unescaped = void 0;
- if (this.peek === $u) {
- var hex = this.input.substring(this.index + 1, this.index + 5);
- if (!/[A-Z0-9]{4}/.test(hex)) {
- this.error('Invalid unicode escape [\\u' + hex + ']');
- }
- _unescaped = parseInt(hex, 16);
- for (var _i21 = 0; _i21 < 5; ++_i21) {
- this.advance();
- }
- } else {
- _unescaped = unescape(this.peek);
- this.advance();
- }
- buffer.push(String.fromCharCode(_unescaped));
- marker = this.index;
- } else if (this.peek === $EOF) {
- this.error('Unterminated quote');
- } else {
- this.advance();
- }
- }
- var last = this.input.substring(marker, this.index);
- this.advance();
- var text = this.input.substring(start, this.index);
- var unescaped = last;
- if (buffer !== null && buffer !== undefined) {
- buffer.push(last);
- unescaped = buffer.join('');
- }
- return new Token(start, text).withValue(unescaped);
- };
- Scanner.prototype.advance = function advance() {
- if (++this.index >= this.length) {
- this.peek = $EOF;
- } else {
- this.peek = this.input.charCodeAt(this.index);
- }
- };
- Scanner.prototype.error = function error(message) {
- var offset = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
- var position = this.index + offset;
- throw new Error('Lexer Error: ' + message + ' at column ' + position + ' in expression [' + this.input + ']');
- };
- return Scanner;
- }();
- var OPERATORS = ['undefined', 'null', 'true', 'false', '+', '-', '*', '/', '%', '^', '=', '==', '===', '!=', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?'];
- var $EOF = 0;
- var $TAB = 9;
- var $LF = 10;
- var $VTAB = 11;
- var $FF = 12;
- var $CR = 13;
- var $SPACE = 32;
- var $BANG = 33;
- var $DQ = 34;
- var $$ = 36;
- var $PERCENT = 37;
- var $AMPERSAND = 38;
- var $SQ = 39;
- var $LPAREN = 40;
- var $RPAREN = 41;
- var $STAR = 42;
- var $PLUS = 43;
- var $COMMA = 44;
- var $MINUS = 45;
- var $PERIOD = 46;
- var $SLASH = 47;
- var $COLON = 58;
- var $SEMICOLON = 59;
- var $LT = 60;
- var $EQ = 61;
- var $GT = 62;
- var $QUESTION = 63;
- var $0 = 48;
- var $9 = 57;
- var $A = 65;
- var $E = 69;
- var $Z = 90;
- var $LBRACKET = 91;
- var $BACKSLASH = 92;
- var $RBRACKET = 93;
- var $CARET = 94;
- var $_ = 95;
- var $a = 97;
- var $e = 101;
- var $f = 102;
- var $n = 110;
- var $r = 114;
- var $t = 116;
- var $u = 117;
- var $v = 118;
- var $z = 122;
- var $LBRACE = 123;
- var $BAR = 124;
- var $RBRACE = 125;
- var $NBSP = 160;
- function isWhitespace(code) {
- return code >= $TAB && code <= $SPACE || code === $NBSP;
- }
- function isIdentifierStart(code) {
- return $a <= code && code <= $z || $A <= code && code <= $Z || code === $_ || code === $$;
- }
- function isIdentifierPart(code) {
- return $a <= code && code <= $z || $A <= code && code <= $Z || $0 <= code && code <= $9 || code === $_ || code === $$;
- }
- function isDigit(code) {
- return $0 <= code && code <= $9;
- }
- function isExponentStart(code) {
- return code === $e || code === $E;
- }
- function isExponentSign(code) {
- return code === $MINUS || code === $PLUS;
- }
- function unescape(code) {
- switch (code) {
- case $n:
- return $LF;
- case $f:
- return $FF;
- case $r:
- return $CR;
- case $t:
- return $TAB;
- case $v:
- return $VTAB;
- default:
- return code;
- }
- }
- function assert(condition, message) {
- if (!condition) {
- throw message || 'Assertion failed';
- }
- }
- var EOF = new Token(-1, null);
- var Parser = exports.Parser = function () {
- function Parser() {
-
- this.cache = {};
- this.lexer = new Lexer();
- }
- Parser.prototype.parse = function parse(input) {
- input = input || '';
- return this.cache[input] || (this.cache[input] = new ParserImplementation(this.lexer, input).parseChain());
- };
- return Parser;
- }();
- var ParserImplementation = exports.ParserImplementation = function () {
- function ParserImplementation(lexer, input) {
-
- this.index = 0;
- this.input = input;
- this.tokens = lexer.lex(input);
- }
- ParserImplementation.prototype.parseChain = function parseChain() {
- var isChain = false;
- var expressions = [];
- while (this.optional(';')) {
- isChain = true;
- }
- while (this.index < this.tokens.length) {
- if (this.peek.text === ')' || this.peek.text === '}' || this.peek.text === ']') {
- this.error('Unconsumed token ' + this.peek.text);
- }
- var expr = this.parseBindingBehavior();
- expressions.push(expr);
- while (this.optional(';')) {
- isChain = true;
- }
- if (isChain) {
- this.error('Multiple expressions are not allowed.');
- }
- }
- return expressions.length === 1 ? expressions[0] : new Chain(expressions);
- };
- ParserImplementation.prototype.parseBindingBehavior = function parseBindingBehavior() {
- var result = this.parseValueConverter();
- while (this.optional('&')) {
- var name = this.peek.text;
- var args = [];
- this.advance();
- while (this.optional(':')) {
- args.push(this.parseExpression());
- }
- result = new BindingBehavior(result, name, args);
- }
- return result;
- };
- ParserImplementation.prototype.parseValueConverter = function parseValueConverter() {
- var result = this.parseExpression();
- while (this.optional('|')) {
- var name = this.peek.text;
- var args = [];
- this.advance();
- while (this.optional(':')) {
- args.push(this.parseExpression());
- }
- result = new ValueConverter(result, name, args, [result].concat(args));
- }
- return result;
- };
- ParserImplementation.prototype.parseExpression = function parseExpression() {
- var start = this.peek.index;
- var result = this.parseConditional();
- while (this.peek.text === '=') {
- if (!result.isAssignable) {
- var end = this.index < this.tokens.length ? this.peek.index : this.input.length;
- var _expression = this.input.substring(start, end);
- this.error('Expression ' + _expression + ' is not assignable');
- }
- this.expect('=');
- result = new Assign(result, this.parseConditional());
- }
- return result;
- };
- ParserImplementation.prototype.parseConditional = function parseConditional() {
- var start = this.peek.index;
- var result = this.parseLogicalOr();
- if (this.optional('?')) {
- var yes = this.parseExpression();
- if (!this.optional(':')) {
- var end = this.index < this.tokens.length ? this.peek.index : this.input.length;
- var _expression2 = this.input.substring(start, end);
- this.error('Conditional expression ' + _expression2 + ' requires all 3 expressions');
- }
- var no = this.parseExpression();
- result = new Conditional(result, yes, no);
- }
- return result;
- };
- ParserImplementation.prototype.parseLogicalOr = function parseLogicalOr() {
- var result = this.parseLogicalAnd();
- while (this.optional('||')) {
- result = new Binary('||', result, this.parseLogicalAnd());
- }
- return result;
- };
- ParserImplementation.prototype.parseLogicalAnd = function parseLogicalAnd() {
- var result = this.parseEquality();
- while (this.optional('&&')) {
- result = new Binary('&&', result, this.parseEquality());
- }
- return result;
- };
- ParserImplementation.prototype.parseEquality = function parseEquality() {
- var result = this.parseRelational();
- while (true) {
- if (this.optional('==')) {
- result = new Binary('==', result, this.parseRelational());
- } else if (this.optional('!=')) {
- result = new Binary('!=', result, this.parseRelational());
- } else if (this.optional('===')) {
- result = new Binary('===', result, this.parseRelational());
- } else if (this.optional('!==')) {
- result = new Binary('!==', result, this.parseRelational());
- } else {
- return result;
- }
- }
- };
- ParserImplementation.prototype.parseRelational = function parseRelational() {
- var result = this.parseAdditive();
- while (true) {
- if (this.optional('<')) {
- result = new Binary('<', result, this.parseAdditive());
- } else if (this.optional('>')) {
- result = new Binary('>', result, this.parseAdditive());
- } else if (this.optional('<=')) {
- result = new Binary('<=', result, this.parseAdditive());
- } else if (this.optional('>=')) {
- result = new Binary('>=', result, this.parseAdditive());
- } else {
- return result;
- }
- }
- };
- ParserImplementation.prototype.parseAdditive = function parseAdditive() {
- var result = this.parseMultiplicative();
- while (true) {
- if (this.optional('+')) {
- result = new Binary('+', result, this.parseMultiplicative());
- } else if (this.optional('-')) {
- result = new Binary('-', result, this.parseMultiplicative());
- } else {
- return result;
- }
- }
- };
- ParserImplementation.prototype.parseMultiplicative = function parseMultiplicative() {
- var result = this.parsePrefix();
- while (true) {
- if (this.optional('*')) {
- result = new Binary('*', result, this.parsePrefix());
- } else if (this.optional('%')) {
- result = new Binary('%', result, this.parsePrefix());
- } else if (this.optional('/')) {
- result = new Binary('/', result, this.parsePrefix());
- } else {
- return result;
- }
- }
- };
- ParserImplementation.prototype.parsePrefix = function parsePrefix() {
- if (this.optional('+')) {
- return this.parsePrefix();
- } else if (this.optional('-')) {
- return new Binary('-', new LiteralPrimitive(0), this.parsePrefix());
- } else if (this.optional('!')) {
- return new PrefixNot('!', this.parsePrefix());
- }
- return this.parseAccessOrCallMember();
- };
- ParserImplementation.prototype.parseAccessOrCallMember = function parseAccessOrCallMember() {
- var result = this.parsePrimary();
- while (true) {
- if (this.optional('.')) {
- var name = this.peek.text;
- this.advance();
- if (this.optional('(')) {
- var args = this.parseExpressionList(')');
- this.expect(')');
- if (result instanceof AccessThis) {
- result = new CallScope(name, args, result.ancestor);
- } else {
- result = new CallMember(result, name, args);
- }
- } else {
- if (result instanceof AccessThis) {
- result = new AccessScope(name, result.ancestor);
- } else {
- result = new AccessMember(result, name);
- }
- }
- } else if (this.optional('[')) {
- var key = this.parseExpression();
- this.expect(']');
- result = new AccessKeyed(result, key);
- } else if (this.optional('(')) {
- var _args = this.parseExpressionList(')');
- this.expect(')');
- result = new CallFunction(result, _args);
- } else {
- return result;
- }
- }
- };
- ParserImplementation.prototype.parsePrimary = function parsePrimary() {
- if (this.optional('(')) {
- var result = this.parseExpression();
- this.expect(')');
- return result;
- } else if (this.optional('null')) {
- return new LiteralPrimitive(null);
- } else if (this.optional('undefined')) {
- return new LiteralPrimitive(undefined);
- } else if (this.optional('true')) {
- return new LiteralPrimitive(true);
- } else if (this.optional('false')) {
- return new LiteralPrimitive(false);
- } else if (this.optional('[')) {
- var elements = this.parseExpressionList(']');
- this.expect(']');
- return new LiteralArray(elements);
- } else if (this.peek.text === '{') {
- return this.parseObject();
- } else if (this.peek.key !== null && this.peek.key !== undefined) {
- return this.parseAccessOrCallScope();
- } else if (this.peek.value !== null && this.peek.value !== undefined) {
- var value = this.peek.value;
- this.advance();
- return value instanceof String || typeof value === 'string' ? new LiteralString(value) : new LiteralPrimitive(value);
- } else if (this.index >= this.tokens.length) {
- throw new Error('Unexpected end of expression: ' + this.input);
- } else {
- this.error('Unexpected token ' + this.peek.text);
- }
- };
- ParserImplementation.prototype.parseAccessOrCallScope = function parseAccessOrCallScope() {
- var name = this.peek.key;
- this.advance();
- if (name === '$this') {
- return new AccessThis(0);
- }
- var ancestor = 0;
- while (name === '$parent') {
- ancestor++;
- if (this.optional('.')) {
- name = this.peek.key;
- this.advance();
- } else if (this.peek === EOF || this.peek.text === '(' || this.peek.text === '[' || this.peek.text === '}') {
- return new AccessThis(ancestor);
- } else {
- this.error('Unexpected token ' + this.peek.text);
- }
- }
- if (this.optional('(')) {
- var args = this.parseExpressionList(')');
- this.expect(')');
- return new CallScope(name, args, ancestor);
- }
- return new AccessScope(name, ancestor);
- };
- ParserImplementation.prototype.parseObject = function parseObject() {
- var keys = [];
- var values = [];
- this.expect('{');
- if (this.peek.text !== '}') {
- do {
- var peek = this.peek;
- var value = peek.value;
- keys.push(typeof value === 'string' ? value : peek.text);
- this.advance();
- if (peek.key && (this.peek.text === ',' || this.peek.text === '}')) {
- --this.index;
- values.push(this.parseAccessOrCallScope());
- } else {
- this.expect(':');
- values.push(this.parseExpression());
- }
- } while (this.optional(','));
- }
- this.expect('}');
- return new LiteralObject(keys, values);
- };
- ParserImplementation.prototype.parseExpressionList = function parseExpressionList(terminator) {
- var result = [];
- if (this.peek.text !== terminator) {
- do {
- result.push(this.parseExpression());
- } while (this.optional(','));
- }
- return result;
- };
- ParserImplementation.prototype.optional = function optional(text) {
- if (this.peek.text === text) {
- this.advance();
- return true;
- }
- return false;
- };
- ParserImplementation.prototype.expect = function expect(text) {
- if (this.peek.text === text) {
- this.advance();
- } else {
- this.error('Missing expected ' + text);
- }
- };
- ParserImplementation.prototype.advance = function advance() {
- this.index++;
- };
- ParserImplementation.prototype.error = function error(message) {
- var location = this.index < this.tokens.length ? 'at column ' + (this.tokens[this.index].index + 1) + ' in' : 'at the end of the expression';
- throw new Error('Parser Error: ' + message + ' ' + location + ' [' + this.input + ']');
- };
- _createClass(ParserImplementation, [{
- key: 'peek',
- get: function get() {
- return this.index < this.tokens.length ? this.tokens[this.index] : EOF;
- }
- }]);
- return ParserImplementation;
- }();
- var mapProto = Map.prototype;
- function _getMapObserver(taskQueue, map) {
- return ModifyMapObserver.for(taskQueue, map);
- }
- exports.getMapObserver = _getMapObserver;
- var ModifyMapObserver = function (_ModifyCollectionObse2) {
- _inherits(ModifyMapObserver, _ModifyCollectionObse2);
- function ModifyMapObserver(taskQueue, map) {
-
- return _possibleConstructorReturn(this, _ModifyCollectionObse2.call(this, taskQueue, map));
- }
- ModifyMapObserver.for = function _for(taskQueue, map) {
- if (!('__map_observer__' in map)) {
- Reflect.defineProperty(map, '__map_observer__', {
- value: ModifyMapObserver.create(taskQueue, map),
- enumerable: false, configurable: false
- });
- }
- return map.__map_observer__;
- };
- ModifyMapObserver.create = function create(taskQueue, map) {
- var observer = new ModifyMapObserver(taskQueue, map);
- var proto = mapProto;
- if (proto.add !== map.add || proto.delete !== map.delete || proto.clear !== map.clear) {
- proto = {
- add: map.add,
- delete: map.delete,
- clear: map.clear
- };
- }
- map.set = function () {
- var hasValue = map.has(arguments[0]);
- var type = hasValue ? 'update' : 'add';
- var oldValue = map.get(arguments[0]);
- var methodCallResult = proto.set.apply(map, arguments);
- if (!hasValue || oldValue !== map.get(arguments[0])) {
- observer.addChangeRecord({
- type: type,
- object: map,
- key: arguments[0],
- oldValue: oldValue
- });
- }
- return methodCallResult;
- };
- map.delete = function () {
- var hasValue = map.has(arguments[0]);
- var oldValue = map.get(arguments[0]);
- var methodCallResult = proto.delete.apply(map, arguments);
- if (hasValue) {
- observer.addChangeRecord({
- type: 'delete',
- object: map,
- key: arguments[0],
- oldValue: oldValue
- });
- }
- return methodCallResult;
- };
- map.clear = function () {
- var methodCallResult = proto.clear.apply(map, arguments);
- observer.addChangeRecord({
- type: 'clear',
- object: map
- });
- return methodCallResult;
- };
- return observer;
- };
- return ModifyMapObserver;
- }(ModifyCollectionObserver);
- function findOriginalEventTarget(event) {
- return event.path && event.path[0] || event.deepPath && event.deepPath[0] || event.target;
- }
- function interceptStopPropagation(event) {
- event.standardStopPropagation = event.stopPropagation;
- event.stopPropagation = function () {
- this.propagationStopped = true;
- this.standardStopPropagation();
- };
- }
- function handleDelegatedEvent(event) {
- var interceptInstalled = false;
- event.propagationStopped = false;
- var target = findOriginalEventTarget(event);
- while (target && !event.propagationStopped) {
- if (target.delegatedCallbacks) {
- var callback = target.delegatedCallbacks[event.type];
- if (callback) {
- if (!interceptInstalled) {
- interceptStopPropagation(event);
- interceptInstalled = true;
- }
- callback(event);
- }
- }
- target = target.parentNode;
- }
- }
- var DelegateHandlerEntry = function () {
- function DelegateHandlerEntry(eventName) {
-
- this.eventName = eventName;
- this.count = 0;
- }
- DelegateHandlerEntry.prototype.increment = function increment() {
- this.count++;
- if (this.count === 1) {
- _aureliaPal.DOM.addEventListener(this.eventName, handleDelegatedEvent, false);
- }
- };
- DelegateHandlerEntry.prototype.decrement = function decrement() {
- this.count--;
- if (this.count === 0) {
- _aureliaPal.DOM.removeEventListener(this.eventName, handleDelegatedEvent);
- }
- };
- return DelegateHandlerEntry;
- }();
- var DefaultEventStrategy = function () {
- function DefaultEventStrategy() {
-
- this.delegatedHandlers = {};
- }
- DefaultEventStrategy.prototype.subscribe = function subscribe(target, targetEvent, callback, delegate) {
- var _this22 = this;
- if (delegate) {
- var _ret = function () {
- var delegatedHandlers = _this22.delegatedHandlers;
- var handlerEntry = delegatedHandlers[targetEvent] || (delegatedHandlers[targetEvent] = new DelegateHandlerEntry(targetEvent));
- var delegatedCallbacks = target.delegatedCallbacks || (target.delegatedCallbacks = {});
- handlerEntry.increment();
- delegatedCallbacks[targetEvent] = callback;
- return {
- v: function v() {
- handlerEntry.decrement();
- delegatedCallbacks[targetEvent] = null;
- }
- };
- }();
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
- }
- target.addEventListener(targetEvent, callback, false);
- return function () {
- target.removeEventListener(targetEvent, callback);
- };
- };
- return DefaultEventStrategy;
- }();
- var EventManager = exports.EventManager = function () {
- function EventManager() {
-
- this.elementHandlerLookup = {};
- this.eventStrategyLookup = {};
- this.registerElementConfig({
- tagName: 'input',
- properties: {
- value: ['change', 'input'],
- checked: ['change', 'input'],
- files: ['change', 'input']
- }
- });
- this.registerElementConfig({
- tagName: 'textarea',
- properties: {
- value: ['change', 'input']
- }
- });
- this.registerElementConfig({
- tagName: 'select',
- properties: {
- value: ['change']
- }
- });
- this.registerElementConfig({
- tagName: 'content editable',
- properties: {
- value: ['change', 'input', 'blur', 'keyup', 'paste']
- }
- });
- this.registerElementConfig({
- tagName: 'scrollable element',
- properties: {
- scrollTop: ['scroll'],
- scrollLeft: ['scroll']
- }
- });
- this.defaultEventStrategy = new DefaultEventStrategy();
- }
- EventManager.prototype.registerElementConfig = function registerElementConfig(config) {
- var tagName = config.tagName.toLowerCase();
- var properties = config.properties;
- var propertyName = void 0;
- this.elementHandlerLookup[tagName] = {};
- for (propertyName in properties) {
- if (properties.hasOwnProperty(propertyName)) {
- this.registerElementPropertyConfig(tagName, propertyName, properties[propertyName]);
- }
- }
- };
- EventManager.prototype.registerElementPropertyConfig = function registerElementPropertyConfig(tagName, propertyName, events) {
- this.elementHandlerLookup[tagName][propertyName] = this.createElementHandler(events);
- };
- EventManager.prototype.createElementHandler = function createElementHandler(events) {
- return {
- subscribe: function subscribe(target, callback) {
- events.forEach(function (changeEvent) {
- target.addEventListener(changeEvent, callback, false);
- });
- return function () {
- events.forEach(function (changeEvent) {
- target.removeEventListener(changeEvent, callback);
- });
- };
- }
- };
- };
- EventManager.prototype.registerElementHandler = function registerElementHandler(tagName, handler) {
- this.elementHandlerLookup[tagName.toLowerCase()] = handler;
- };
- EventManager.prototype.registerEventStrategy = function registerEventStrategy(eventName, strategy) {
- this.eventStrategyLookup[eventName] = strategy;
- };
- EventManager.prototype.getElementHandler = function getElementHandler(target, propertyName) {
- var tagName = void 0;
- var lookup = this.elementHandlerLookup;
- if (target.tagName) {
- tagName = target.tagName.toLowerCase();
- if (lookup[tagName] && lookup[tagName][propertyName]) {
- return lookup[tagName][propertyName];
- }
- if (propertyName === 'textContent' || propertyName === 'innerHTML') {
- return lookup['content editable'].value;
- }
- if (propertyName === 'scrollTop' || propertyName === 'scrollLeft') {
- return lookup['scrollable element'][propertyName];
- }
- }
- return null;
- };
- EventManager.prototype.addEventListener = function addEventListener(target, targetEvent, callback, delegate) {
- return (this.eventStrategyLookup[targetEvent] || this.defaultEventStrategy).subscribe(target, targetEvent, callback, delegate);
- };
- return EventManager;
- }();
- var DirtyChecker = exports.DirtyChecker = function () {
- function DirtyChecker() {
-
- this.tracked = [];
- this.checkDelay = 120;
- }
- DirtyChecker.prototype.addProperty = function addProperty(property) {
- var tracked = this.tracked;
- tracked.push(property);
- if (tracked.length === 1) {
- this.scheduleDirtyCheck();
- }
- };
- DirtyChecker.prototype.removeProperty = function removeProperty(property) {
- var tracked = this.tracked;
- tracked.splice(tracked.indexOf(property), 1);
- };
- DirtyChecker.prototype.scheduleDirtyCheck = function scheduleDirtyCheck() {
- var _this23 = this;
- setTimeout(function () {
- return _this23.check();
- }, this.checkDelay);
- };
- DirtyChecker.prototype.check = function check() {
- var tracked = this.tracked;
- var i = tracked.length;
- while (i--) {
- var current = tracked[i];
- if (current.isDirty()) {
- current.call();
- }
- }
- if (tracked.length) {
- this.scheduleDirtyCheck();
- }
- };
- return DirtyChecker;
- }();
- var DirtyCheckProperty = exports.DirtyCheckProperty = (_dec5 = subscriberCollection(), _dec5(_class5 = function () {
- function DirtyCheckProperty(dirtyChecker, obj, propertyName) {
-
- this.dirtyChecker = dirtyChecker;
- this.obj = obj;
- this.propertyName = propertyName;
- }
- DirtyCheckProperty.prototype.getValue = function getValue() {
- return this.obj[this.propertyName];
- };
- DirtyCheckProperty.prototype.setValue = function setValue(newValue) {
- this.obj[this.propertyName] = newValue;
- };
- DirtyCheckProperty.prototype.call = function call() {
- var oldValue = this.oldValue;
- var newValue = this.getValue();
- this.callSubscribers(newValue, oldValue);
- this.oldValue = newValue;
- };
- DirtyCheckProperty.prototype.isDirty = function isDirty() {
- return this.oldValue !== this.obj[this.propertyName];
- };
- DirtyCheckProperty.prototype.subscribe = function subscribe(context, callable) {
- if (!this.hasSubscribers()) {
- this.oldValue = this.getValue();
- this.dirtyChecker.addProperty(this);
- }
- this.addSubscriber(context, callable);
- };
- DirtyCheckProperty.prototype.unsubscribe = function unsubscribe(context, callable) {
- if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
- this.dirtyChecker.removeProperty(this);
- }
- };
- return DirtyCheckProperty;
- }()) || _class5);
- var logger = LogManager.getLogger('property-observation');
- var propertyAccessor = exports.propertyAccessor = {
- getValue: function getValue(obj, propertyName) {
- return obj[propertyName];
- },
- setValue: function setValue(value, obj, propertyName) {
- obj[propertyName] = value;
- }
- };
- var PrimitiveObserver = exports.PrimitiveObserver = function () {
- function PrimitiveObserver(primitive, propertyName) {
-
- this.doNotCache = true;
- this.primitive = primitive;
- this.propertyName = propertyName;
- }
- PrimitiveObserver.prototype.getValue = function getValue() {
- return this.primitive[this.propertyName];
- };
- PrimitiveObserver.prototype.setValue = function setValue() {
- var type = _typeof(this.primitive);
- throw new Error('The ' + this.propertyName + ' property of a ' + type + ' (' + this.primitive + ') cannot be assigned.');
- };
- PrimitiveObserver.prototype.subscribe = function subscribe() {};
- PrimitiveObserver.prototype.unsubscribe = function unsubscribe() {};
- return PrimitiveObserver;
- }();
- var SetterObserver = exports.SetterObserver = (_dec6 = subscriberCollection(), _dec6(_class7 = function () {
- function SetterObserver(taskQueue, obj, propertyName) {
-
- this.taskQueue = taskQueue;
- this.obj = obj;
- this.propertyName = propertyName;
- this.queued = false;
- this.observing = false;
- }
- SetterObserver.prototype.getValue = function getValue() {
- return this.obj[this.propertyName];
- };
- SetterObserver.prototype.setValue = function setValue(newValue) {
- this.obj[this.propertyName] = newValue;
- };
- SetterObserver.prototype.getterValue = function getterValue() {
- return this.currentValue;
- };
- SetterObserver.prototype.setterValue = function setterValue(newValue) {
- var oldValue = this.currentValue;
- if (oldValue !== newValue) {
- if (!this.queued) {
- this.oldValue = oldValue;
- this.queued = true;
- this.taskQueue.queueMicroTask(this);
- }
- this.currentValue = newValue;
- }
- };
- SetterObserver.prototype.call = function call() {
- var oldValue = this.oldValue;
- var newValue = this.currentValue;
- this.queued = false;
- this.callSubscribers(newValue, oldValue);
- };
- SetterObserver.prototype.subscribe = function subscribe(context, callable) {
- if (!this.observing) {
- this.convertProperty();
- }
- this.addSubscriber(context, callable);
- };
- SetterObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
- this.removeSubscriber(context, callable);
- };
- SetterObserver.prototype.convertProperty = function convertProperty() {
- this.observing = true;
- this.currentValue = this.obj[this.propertyName];
- this.setValue = this.setterValue;
- this.getValue = this.getterValue;
- if (!Reflect.defineProperty(this.obj, this.propertyName, {
- configurable: true,
- enumerable: this.propertyName in this.obj ? this.obj.propertyIsEnumerable(this.propertyName) : true,
- get: this.getValue.bind(this),
- set: this.setValue.bind(this)
- })) {
- logger.warn('Cannot observe property \'' + this.propertyName + '\' of object', this.obj);
- }
- };
- return SetterObserver;
- }()) || _class7);
- var XLinkAttributeObserver = exports.XLinkAttributeObserver = function () {
- function XLinkAttributeObserver(element, propertyName, attributeName) {
-
- this.element = element;
- this.propertyName = propertyName;
- this.attributeName = attributeName;
- }
- XLinkAttributeObserver.prototype.getValue = function getValue() {
- return this.element.getAttributeNS('http://www.w3.org/1999/xlink', this.attributeName);
- };
- XLinkAttributeObserver.prototype.setValue = function setValue(newValue) {
- return this.element.setAttributeNS('http://www.w3.org/1999/xlink', this.attributeName, newValue);
- };
- XLinkAttributeObserver.prototype.subscribe = function subscribe() {
- throw new Error('Observation of a "' + this.element.nodeName + '" element\'s "' + this.propertyName + '" property is not supported.');
- };
- return XLinkAttributeObserver;
- }();
- var dataAttributeAccessor = exports.dataAttributeAccessor = {
- getValue: function getValue(obj, propertyName) {
- return obj.getAttribute(propertyName);
- },
- setValue: function setValue(value, obj, propertyName) {
- return obj.setAttribute(propertyName, value);
- }
- };
- var DataAttributeObserver = exports.DataAttributeObserver = function () {
- function DataAttributeObserver(element, propertyName) {
-
- this.element = element;
- this.propertyName = propertyName;
- }
- DataAttributeObserver.prototype.getValue = function getValue() {
- return this.element.getAttribute(this.propertyName);
- };
- DataAttributeObserver.prototype.setValue = function setValue(newValue) {
- return this.element.setAttribute(this.propertyName, newValue);
- };
- DataAttributeObserver.prototype.subscribe = function subscribe() {
- throw new Error('Observation of a "' + this.element.nodeName + '" element\'s "' + this.propertyName + '" property is not supported.');
- };
- return DataAttributeObserver;
- }();
- var StyleObserver = exports.StyleObserver = function () {
- function StyleObserver(element, propertyName) {
-
- this.element = element;
- this.propertyName = propertyName;
- this.styles = null;
- this.version = 0;
- }
- StyleObserver.prototype.getValue = function getValue() {
- return this.element.style.cssText;
- };
- StyleObserver.prototype.setValue = function setValue(newValue) {
- var styles = this.styles || {};
- var style = void 0;
- var version = this.version;
- if (newValue !== null && newValue !== undefined) {
- if (newValue instanceof Object) {
- for (style in newValue) {
- if (newValue.hasOwnProperty(style)) {
- styles[style] = version;
- this.element.style[style] = newValue[style];
- }
- }
- } else if (newValue.length) {
- var rx = /\s*([\w\-]+)\s*:\s*((?:(?:[\w\-]+\(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[\w\-]+\(\s*(?:^"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^\)]*)\),?|[^\)]*)\),?|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^;]*),?\s*)+);?/g;
- var pair = void 0;
- while ((pair = rx.exec(newValue)) !== null) {
- style = pair[1];
- if (!style) {
- continue;
- }
- styles[style] = version;
- this.element.style[style] = pair[2];
- }
- }
- }
- this.styles = styles;
- this.version += 1;
- if (version === 0) {
- return;
- }
- version -= 1;
- for (style in styles) {
- if (!styles.hasOwnProperty(style) || styles[style] !== version) {
- continue;
- }
- this.element.style[style] = '';
- }
- };
- StyleObserver.prototype.subscribe = function subscribe() {
- throw new Error('Observation of a "' + this.element.nodeName + '" element\'s "' + this.propertyName + '" property is not supported.');
- };
- return StyleObserver;
- }();
- var ValueAttributeObserver = exports.ValueAttributeObserver = (_dec7 = subscriberCollection(), _dec7(_class8 = function () {
- function ValueAttributeObserver(element, propertyName, handler) {
-
- this.element = element;
- this.propertyName = propertyName;
- this.handler = handler;
- if (propertyName === 'files') {
- this.setValue = function () {};
- }
- }
- ValueAttributeObserver.prototype.getValue = function getValue() {
- return this.element[this.propertyName];
- };
- ValueAttributeObserver.prototype.setValue = function setValue(newValue) {
- newValue = newValue === undefined || newValue === null ? '' : newValue;
- if (this.element[this.propertyName] !== newValue) {
- this.element[this.propertyName] = newValue;
- this.notify();
- }
- };
- ValueAttributeObserver.prototype.notify = function notify() {
- var oldValue = this.oldValue;
- var newValue = this.getValue();
- this.callSubscribers(newValue, oldValue);
- this.oldValue = newValue;
- };
- ValueAttributeObserver.prototype.subscribe = function subscribe(context, callable) {
- if (!this.hasSubscribers()) {
- this.oldValue = this.getValue();
- this.disposeHandler = this.handler.subscribe(this.element, this.notify.bind(this));
- }
- this.addSubscriber(context, callable);
- };
- ValueAttributeObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
- if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
- this.disposeHandler();
- this.disposeHandler = null;
- }
- };
- return ValueAttributeObserver;
- }()) || _class8);
- var checkedArrayContext = 'CheckedObserver:array';
- var checkedValueContext = 'CheckedObserver:value';
- var CheckedObserver = exports.CheckedObserver = (_dec8 = subscriberCollection(), _dec8(_class9 = function () {
- function CheckedObserver(element, handler, observerLocator) {
-
- this.element = element;
- this.handler = handler;
- this.observerLocator = observerLocator;
- }
- CheckedObserver.prototype.getValue = function getValue() {
- return this.value;
- };
- CheckedObserver.prototype.setValue = function setValue(newValue) {
- if (this.value === newValue) {
- return;
- }
- if (this.arrayObserver) {
- this.arrayObserver.unsubscribe(checkedArrayContext, this);
- this.arrayObserver = null;
- }
- if (this.element.type === 'checkbox' && Array.isArray(newValue)) {
- this.arrayObserver = this.observerLocator.getArrayObserver(newValue);
- this.arrayObserver.subscribe(checkedArrayContext, this);
- }
- this.oldValue = this.value;
- this.value = newValue;
- this.synchronizeElement();
- this.notify();
- if (!this.initialSync) {
- this.initialSync = true;
- this.observerLocator.taskQueue.queueMicroTask(this);
- }
- };
- CheckedObserver.prototype.call = function call(context, splices) {
- this.synchronizeElement();
- if (!this.valueObserver) {
- this.valueObserver = this.element.__observers__.model || this.element.__observers__.value;
- if (this.valueObserver) {
- this.valueObserver.subscribe(checkedValueContext, this);
- }
- }
- };
- CheckedObserver.prototype.synchronizeElement = function synchronizeElement() {
- var value = this.value;
- var element = this.element;
- var elementValue = element.hasOwnProperty('model') ? element.model : element.value;
- var isRadio = element.type === 'radio';
- var matcher = element.matcher || function (a, b) {
- return a === b;
- };
- element.checked = isRadio && !!matcher(value, elementValue) || !isRadio && value === true || !isRadio && Array.isArray(value) && value.findIndex(function (item) {
- return !!matcher(item, elementValue);
- }) !== -1;
- };
- CheckedObserver.prototype.synchronizeValue = function synchronizeValue() {
- var value = this.value;
- var element = this.element;
- var elementValue = element.hasOwnProperty('model') ? element.model : element.value;
- var index = void 0;
- var matcher = element.matcher || function (a, b) {
- return a === b;
- };
- if (element.type === 'checkbox') {
- if (Array.isArray(value)) {
- index = value.findIndex(function (item) {
- return !!matcher(item, elementValue);
- });
- if (element.checked && index === -1) {
- value.push(elementValue);
- } else if (!element.checked && index !== -1) {
- value.splice(index, 1);
- }
- return;
- }
- value = element.checked;
- } else if (element.checked) {
- value = elementValue;
- } else {
- return;
- }
- this.oldValue = this.value;
- this.value = value;
- this.notify();
- };
- CheckedObserver.prototype.notify = function notify() {
- var oldValue = this.oldValue;
- var newValue = this.value;
- this.callSubscribers(newValue, oldValue);
- };
- CheckedObserver.prototype.subscribe = function subscribe(context, callable) {
- if (!this.hasSubscribers()) {
- this.disposeHandler = this.handler.subscribe(this.element, this.synchronizeValue.bind(this, false));
- }
- this.addSubscriber(context, callable);
- };
- CheckedObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
- if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
- this.disposeHandler();
- this.disposeHandler = null;
- }
- };
- CheckedObserver.prototype.unbind = function unbind() {
- if (this.arrayObserver) {
- this.arrayObserver.unsubscribe(checkedArrayContext, this);
- this.arrayObserver = null;
- }
- if (this.valueObserver) {
- this.valueObserver.unsubscribe(checkedValueContext, this);
- }
- };
- return CheckedObserver;
- }()) || _class9);
- var selectArrayContext = 'SelectValueObserver:array';
- var SelectValueObserver = exports.SelectValueObserver = (_dec9 = subscriberCollection(), _dec9(_class10 = function () {
- function SelectValueObserver(element, handler, observerLocator) {
-
- this.element = element;
- this.handler = handler;
- this.observerLocator = observerLocator;
- }
- SelectValueObserver.prototype.getValue = function getValue() {
- return this.value;
- };
- SelectValueObserver.prototype.setValue = function setValue(newValue) {
- if (newValue !== null && newValue !== undefined && this.element.multiple && !Array.isArray(newValue)) {
- throw new Error('Only null or Array instances can be bound to a multi-select.');
- }
- if (this.value === newValue) {
- return;
- }
- if (this.arrayObserver) {
- this.arrayObserver.unsubscribe(selectArrayContext, this);
- this.arrayObserver = null;
- }
- if (Array.isArray(newValue)) {
- this.arrayObserver = this.observerLocator.getArrayObserver(newValue);
- this.arrayObserver.subscribe(selectArrayContext, this);
- }
- this.oldValue = this.value;
- this.value = newValue;
- this.synchronizeOptions();
- this.notify();
- if (!this.initialSync) {
- this.initialSync = true;
- this.observerLocator.taskQueue.queueMicroTask(this);
- }
- };
- SelectValueObserver.prototype.call = function call(context, splices) {
- this.synchronizeOptions();
- };
- SelectValueObserver.prototype.synchronizeOptions = function synchronizeOptions() {
- var value = this.value;
- var clear = void 0;
- var isArray = void 0;
- if (value === null || value === undefined) {
- clear = true;
- } else if (Array.isArray(value)) {
- isArray = true;
- }
- var options = this.element.options;
- var i = options.length;
- var matcher = this.element.matcher || function (a, b) {
- return a === b;
- };
- var _loop = function _loop() {
- var option = options.item(i);
- if (clear) {
- option.selected = false;
- return 'continue';
- }
- var optionValue = option.hasOwnProperty('model') ? option.model : option.value;
- if (isArray) {
- option.selected = value.findIndex(function (item) {
- return !!matcher(optionValue, item);
- }) !== -1;
- return 'continue';
- }
- option.selected = !!matcher(optionValue, value);
- };
- while (i--) {
- var _ret2 = _loop();
- if (_ret2 === 'continue') continue;
- }
- };
- SelectValueObserver.prototype.synchronizeValue = function synchronizeValue() {
- var _this24 = this;
- var options = this.element.options;
- var count = 0;
- var value = [];
- for (var _i22 = 0, ii = options.length; _i22 < ii; _i22++) {
- var _option = options.item(_i22);
- if (!_option.selected) {
- continue;
- }
- value.push(_option.hasOwnProperty('model') ? _option.model : _option.value);
- count++;
- }
- if (this.element.multiple) {
- if (Array.isArray(this.value)) {
- var _ret3 = function () {
- var matcher = _this24.element.matcher || function (a, b) {
- return a === b;
- };
- var i = 0;
- var _loop2 = function _loop2() {
- var a = _this24.value[i];
- if (value.findIndex(function (b) {
- return matcher(a, b);
- }) === -1) {
- _this24.value.splice(i, 1);
- } else {
- i++;
- }
- };
- while (i < _this24.value.length) {
- _loop2();
- }
- i = 0;
- var _loop3 = function _loop3() {
- var a = value[i];
- if (_this24.value.findIndex(function (b) {
- return matcher(a, b);
- }) === -1) {
- _this24.value.push(a);
- }
- i++;
- };
- while (i < value.length) {
- _loop3();
- }
- return {
- v: void 0
- };
- }();
- if ((typeof _ret3 === 'undefined' ? 'undefined' : _typeof(_ret3)) === "object") return _ret3.v;
- }
- } else {
- if (count === 0) {
- value = null;
- } else {
- value = value[0];
- }
- }
- if (value !== this.value) {
- this.oldValue = this.value;
- this.value = value;
- this.notify();
- }
- };
- SelectValueObserver.prototype.notify = function notify() {
- var oldValue = this.oldValue;
- var newValue = this.value;
- this.callSubscribers(newValue, oldValue);
- };
- SelectValueObserver.prototype.subscribe = function subscribe(context, callable) {
- if (!this.hasSubscribers()) {
- this.disposeHandler = this.handler.subscribe(this.element, this.synchronizeValue.bind(this, false));
- }
- this.addSubscriber(context, callable);
- };
- SelectValueObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
- if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
- this.disposeHandler();
- this.disposeHandler = null;
- }
- };
- SelectValueObserver.prototype.bind = function bind() {
- var _this25 = this;
- this.domObserver = _aureliaPal.DOM.createMutationObserver(function () {
- _this25.synchronizeOptions();
- _this25.synchronizeValue();
- });
- this.domObserver.observe(this.element, { childList: true, subtree: true });
- };
- SelectValueObserver.prototype.unbind = function unbind() {
- this.domObserver.disconnect();
- this.domObserver = null;
- if (this.arrayObserver) {
- this.arrayObserver.unsubscribe(selectArrayContext, this);
- this.arrayObserver = null;
- }
- };
- return SelectValueObserver;
- }()) || _class10);
- var ClassObserver = exports.ClassObserver = function () {
- function ClassObserver(element) {
-
- this.element = element;
- this.doNotCache = true;
- this.value = '';
- this.version = 0;
- }
- ClassObserver.prototype.getValue = function getValue() {
- return this.value;
- };
- ClassObserver.prototype.setValue = function setValue(newValue) {
- var nameIndex = this.nameIndex || {};
- var version = this.version;
- var names = void 0;
- var name = void 0;
- if (newValue !== null && newValue !== undefined && newValue.length) {
- names = newValue.split(/\s+/);
- for (var _i23 = 0, length = names.length; _i23 < length; _i23++) {
- name = names[_i23];
- if (name === '') {
- continue;
- }
- nameIndex[name] = version;
- this.element.classList.add(name);
- }
- }
- this.value = newValue;
- this.nameIndex = nameIndex;
- this.version += 1;
- if (version === 0) {
- return;
- }
- version -= 1;
- for (name in nameIndex) {
- if (!nameIndex.hasOwnProperty(name) || nameIndex[name] !== version) {
- continue;
- }
- this.element.classList.remove(name);
- }
- };
- ClassObserver.prototype.subscribe = function subscribe() {
- throw new Error('Observation of a "' + this.element.nodeName + '" element\'s "class" property is not supported.');
- };
- return ClassObserver;
- }();
- function hasDeclaredDependencies(descriptor) {
- return !!(descriptor && descriptor.get && descriptor.get.dependencies);
- }
- function declarePropertyDependencies(ctor, propertyName, dependencies) {
- var descriptor = Object.getOwnPropertyDescriptor(ctor.prototype, propertyName);
- descriptor.get.dependencies = dependencies;
- }
- function computedFrom() {
- for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
- rest[_key] = arguments[_key];
- }
- return function (target, key, descriptor) {
- descriptor.get.dependencies = rest;
- return descriptor;
- };
- }
- var ComputedExpression = exports.ComputedExpression = function (_Expression19) {
- _inherits(ComputedExpression, _Expression19);
- function ComputedExpression(name, dependencies) {
-
- var _this26 = _possibleConstructorReturn(this, _Expression19.call(this));
- _this26.name = name;
- _this26.dependencies = dependencies;
- _this26.isAssignable = true;
- return _this26;
- }
- ComputedExpression.prototype.evaluate = function evaluate(scope, lookupFunctions) {
- return scope.bindingContext[this.name];
- };
- ComputedExpression.prototype.assign = function assign(scope, value) {
- scope.bindingContext[this.name] = value;
- };
- ComputedExpression.prototype.accept = function accept(visitor) {
- throw new Error('not implemented');
- };
- ComputedExpression.prototype.connect = function connect(binding, scope) {
- var dependencies = this.dependencies;
- var i = dependencies.length;
- while (i--) {
- dependencies[i].connect(binding, scope);
- }
- };
- return ComputedExpression;
- }(Expression);
- function createComputedObserver(obj, propertyName, descriptor, observerLocator) {
- var dependencies = descriptor.get.dependencies;
- if (!(dependencies instanceof ComputedExpression)) {
- var _i24 = dependencies.length;
- while (_i24--) {
- dependencies[_i24] = observerLocator.parser.parse(dependencies[_i24]);
- }
- dependencies = descriptor.get.dependencies = new ComputedExpression(propertyName, dependencies);
- }
- var scope = { bindingContext: obj, overrideContext: createOverrideContext(obj) };
- return new ExpressionObserver(scope, dependencies, observerLocator);
- }
- var elements = exports.elements = {
- a: ['class', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'target', 'transform', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- altGlyph: ['class', 'dx', 'dy', 'externalResourcesRequired', 'format', 'glyphRef', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'rotate', 'style', 'systemLanguage', 'x', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- altGlyphDef: ['id', 'xml:base', 'xml:lang', 'xml:space'],
- altGlyphItem: ['id', 'xml:base', 'xml:lang', 'xml:space'],
- animate: ['accumulate', 'additive', 'attributeName', 'attributeType', 'begin', 'by', 'calcMode', 'dur', 'end', 'externalResourcesRequired', 'fill', 'from', 'id', 'keySplines', 'keyTimes', 'max', 'min', 'onbegin', 'onend', 'onload', 'onrepeat', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'systemLanguage', 'to', 'values', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- animateColor: ['accumulate', 'additive', 'attributeName', 'attributeType', 'begin', 'by', 'calcMode', 'dur', 'end', 'externalResourcesRequired', 'fill', 'from', 'id', 'keySplines', 'keyTimes', 'max', 'min', 'onbegin', 'onend', 'onload', 'onrepeat', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'systemLanguage', 'to', 'values', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- animateMotion: ['accumulate', 'additive', 'begin', 'by', 'calcMode', 'dur', 'end', 'externalResourcesRequired', 'fill', 'from', 'id', 'keyPoints', 'keySplines', 'keyTimes', 'max', 'min', 'onbegin', 'onend', 'onload', 'onrepeat', 'origin', 'path', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'rotate', 'systemLanguage', 'to', 'values', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- animateTransform: ['accumulate', 'additive', 'attributeName', 'attributeType', 'begin', 'by', 'calcMode', 'dur', 'end', 'externalResourcesRequired', 'fill', 'from', 'id', 'keySplines', 'keyTimes', 'max', 'min', 'onbegin', 'onend', 'onload', 'onrepeat', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'systemLanguage', 'to', 'type', 'values', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- circle: ['class', 'cx', 'cy', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'r', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
- clipPath: ['class', 'clipPathUnits', 'externalResourcesRequired', 'id', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
- 'color-profile': ['id', 'local', 'name', 'rendering-intent', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- cursor: ['externalResourcesRequired', 'id', 'requiredExtensions', 'requiredFeatures', 'systemLanguage', 'x', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- defs: ['class', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
- desc: ['class', 'id', 'style', 'xml:base', 'xml:lang', 'xml:space'],
- ellipse: ['class', 'cx', 'cy', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'rx', 'ry', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
- feBlend: ['class', 'height', 'id', 'in', 'in2', 'mode', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feColorMatrix: ['class', 'height', 'id', 'in', 'result', 'style', 'type', 'values', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feComponentTransfer: ['class', 'height', 'id', 'in', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feComposite: ['class', 'height', 'id', 'in', 'in2', 'k1', 'k2', 'k3', 'k4', 'operator', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feConvolveMatrix: ['bias', 'class', 'divisor', 'edgeMode', 'height', 'id', 'in', 'kernelMatrix', 'kernelUnitLength', 'order', 'preserveAlpha', 'result', 'style', 'targetX', 'targetY', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feDiffuseLighting: ['class', 'diffuseConstant', 'height', 'id', 'in', 'kernelUnitLength', 'result', 'style', 'surfaceScale', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feDisplacementMap: ['class', 'height', 'id', 'in', 'in2', 'result', 'scale', 'style', 'width', 'x', 'xChannelSelector', 'xml:base', 'xml:lang', 'xml:space', 'y', 'yChannelSelector'],
- feDistantLight: ['azimuth', 'elevation', 'id', 'xml:base', 'xml:lang', 'xml:space'],
- feFlood: ['class', 'height', 'id', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feFuncA: ['amplitude', 'exponent', 'id', 'intercept', 'offset', 'slope', 'tableValues', 'type', 'xml:base', 'xml:lang', 'xml:space'],
- feFuncB: ['amplitude', 'exponent', 'id', 'intercept', 'offset', 'slope', 'tableValues', 'type', 'xml:base', 'xml:lang', 'xml:space'],
- feFuncG: ['amplitude', 'exponent', 'id', 'intercept', 'offset', 'slope', 'tableValues', 'type', 'xml:base', 'xml:lang', 'xml:space'],
- feFuncR: ['amplitude', 'exponent', 'id', 'intercept', 'offset', 'slope', 'tableValues', 'type', 'xml:base', 'xml:lang', 'xml:space'],
- feGaussianBlur: ['class', 'height', 'id', 'in', 'result', 'stdDeviation', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feImage: ['class', 'externalResourcesRequired', 'height', 'id', 'preserveAspectRatio', 'result', 'style', 'width', 'x', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feMerge: ['class', 'height', 'id', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feMergeNode: ['id', 'xml:base', 'xml:lang', 'xml:space'],
- feMorphology: ['class', 'height', 'id', 'in', 'operator', 'radius', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feOffset: ['class', 'dx', 'dy', 'height', 'id', 'in', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- fePointLight: ['id', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y', 'z'],
- feSpecularLighting: ['class', 'height', 'id', 'in', 'kernelUnitLength', 'result', 'specularConstant', 'specularExponent', 'style', 'surfaceScale', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feSpotLight: ['id', 'limitingConeAngle', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'specularExponent', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y', 'z'],
- feTile: ['class', 'height', 'id', 'in', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- feTurbulence: ['baseFrequency', 'class', 'height', 'id', 'numOctaves', 'result', 'seed', 'stitchTiles', 'style', 'type', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- filter: ['class', 'externalResourcesRequired', 'filterRes', 'filterUnits', 'height', 'id', 'primitiveUnits', 'style', 'width', 'x', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- font: ['class', 'externalResourcesRequired', 'horiz-adv-x', 'horiz-origin-x', 'horiz-origin-y', 'id', 'style', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'xml:base', 'xml:lang', 'xml:space'],
- 'font-face': ['accent-height', 'alphabetic', 'ascent', 'bbox', 'cap-height', 'descent', 'font-family', 'font-size', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'hanging', 'id', 'ideographic', 'mathematical', 'overline-position', 'overline-thickness', 'panose-1', 'slope', 'stemh', 'stemv', 'strikethrough-position', 'strikethrough-thickness', 'underline-position', 'underline-thickness', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'widths', 'x-height', 'xml:base', 'xml:lang', 'xml:space'],
- 'font-face-format': ['id', 'string', 'xml:base', 'xml:lang', 'xml:space'],
- 'font-face-name': ['id', 'name', 'xml:base', 'xml:lang', 'xml:space'],
- 'font-face-src': ['id', 'xml:base', 'xml:lang', 'xml:space'],
- 'font-face-uri': ['id', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- foreignObject: ['class', 'externalResourcesRequired', 'height', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- g: ['class', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
- glyph: ['arabic-form', 'class', 'd', 'glyph-name', 'horiz-adv-x', 'id', 'lang', 'orientation', 'style', 'unicode', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'xml:base', 'xml:lang', 'xml:space'],
- glyphRef: ['class', 'dx', 'dy', 'format', 'glyphRef', 'id', 'style', 'x', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- hkern: ['g1', 'g2', 'id', 'k', 'u1', 'u2', 'xml:base', 'xml:lang', 'xml:space'],
- image: ['class', 'externalResourcesRequired', 'height', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'preserveAspectRatio', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'width', 'x', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- line: ['class', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'x1', 'x2', 'xml:base', 'xml:lang', 'xml:space', 'y1', 'y2'],
- linearGradient: ['class', 'externalResourcesRequired', 'gradientTransform', 'gradientUnits', 'id', 'spreadMethod', 'style', 'x1', 'x2', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y1', 'y2'],
- marker: ['class', 'externalResourcesRequired', 'id', 'markerHeight', 'markerUnits', 'markerWidth', 'orient', 'preserveAspectRatio', 'refX', 'refY', 'style', 'viewBox', 'xml:base', 'xml:lang', 'xml:space'],
- mask: ['class', 'externalResourcesRequired', 'height', 'id', 'maskContentUnits', 'maskUnits', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- metadata: ['id', 'xml:base', 'xml:lang', 'xml:space'],
- 'missing-glyph': ['class', 'd', 'horiz-adv-x', 'id', 'style', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'xml:base', 'xml:lang', 'xml:space'],
- mpath: ['externalResourcesRequired', 'id', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- path: ['class', 'd', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'pathLength', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
- pattern: ['class', 'externalResourcesRequired', 'height', 'id', 'patternContentUnits', 'patternTransform', 'patternUnits', 'preserveAspectRatio', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'viewBox', 'width', 'x', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- polygon: ['class', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'points', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
- polyline: ['class', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'points', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
- radialGradient: ['class', 'cx', 'cy', 'externalResourcesRequired', 'fx', 'fy', 'gradientTransform', 'gradientUnits', 'id', 'r', 'spreadMethod', 'style', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- rect: ['class', 'externalResourcesRequired', 'height', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'rx', 'ry', 'style', 'systemLanguage', 'transform', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- script: ['externalResourcesRequired', 'id', 'type', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- set: ['attributeName', 'attributeType', 'begin', 'dur', 'end', 'externalResourcesRequired', 'fill', 'id', 'max', 'min', 'onbegin', 'onend', 'onload', 'onrepeat', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'systemLanguage', 'to', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- stop: ['class', 'id', 'offset', 'style', 'xml:base', 'xml:lang', 'xml:space'],
- style: ['id', 'media', 'title', 'type', 'xml:base', 'xml:lang', 'xml:space'],
- svg: ['baseProfile', 'class', 'contentScriptType', 'contentStyleType', 'externalResourcesRequired', 'height', 'id', 'onabort', 'onactivate', 'onclick', 'onerror', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onresize', 'onscroll', 'onunload', 'onzoom', 'preserveAspectRatio', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'version', 'viewBox', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y', 'zoomAndPan'],
- switch: ['class', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
- symbol: ['class', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'preserveAspectRatio', 'style', 'viewBox', 'xml:base', 'xml:lang', 'xml:space'],
- text: ['class', 'dx', 'dy', 'externalResourcesRequired', 'id', 'lengthAdjust', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'rotate', 'style', 'systemLanguage', 'textLength', 'transform', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- textPath: ['class', 'externalResourcesRequired', 'id', 'lengthAdjust', 'method', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'spacing', 'startOffset', 'style', 'systemLanguage', 'textLength', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
- title: ['class', 'id', 'style', 'xml:base', 'xml:lang', 'xml:space'],
- tref: ['class', 'dx', 'dy', 'externalResourcesRequired', 'id', 'lengthAdjust', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'rotate', 'style', 'systemLanguage', 'textLength', 'x', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- tspan: ['class', 'dx', 'dy', 'externalResourcesRequired', 'id', 'lengthAdjust', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'rotate', 'style', 'systemLanguage', 'textLength', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- use: ['class', 'externalResourcesRequired', 'height', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'width', 'x', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space', 'y'],
- view: ['externalResourcesRequired', 'id', 'preserveAspectRatio', 'viewBox', 'viewTarget', 'xml:base', 'xml:lang', 'xml:space', 'zoomAndPan'],
- vkern: ['g1', 'g2', 'id', 'k', 'u1', 'u2', 'xml:base', 'xml:lang', 'xml:space']
- };
- var presentationElements = exports.presentationElements = {
- 'a': true,
- 'altGlyph': true,
- 'animate': true,
- 'animateColor': true,
- 'circle': true,
- 'clipPath': true,
- 'defs': true,
- 'ellipse': true,
- 'feBlend': true,
- 'feColorMatrix': true,
- 'feComponentTransfer': true,
- 'feComposite': true,
- 'feConvolveMatrix': true,
- 'feDiffuseLighting': true,
- 'feDisplacementMap': true,
- 'feFlood': true,
- 'feGaussianBlur': true,
- 'feImage': true,
- 'feMerge': true,
- 'feMorphology': true,
- 'feOffset': true,
- 'feSpecularLighting': true,
- 'feTile': true,
- 'feTurbulence': true,
- 'filter': true,
- 'font': true,
- 'foreignObject': true,
- 'g': true,
- 'glyph': true,
- 'glyphRef': true,
- 'image': true,
- 'line': true,
- 'linearGradient': true,
- 'marker': true,
- 'mask': true,
- 'missing-glyph': true,
- 'path': true,
- 'pattern': true,
- 'polygon': true,
- 'polyline': true,
- 'radialGradient': true,
- 'rect': true,
- 'stop': true,
- 'svg': true,
- 'switch': true,
- 'symbol': true,
- 'text': true,
- 'textPath': true,
- 'tref': true,
- 'tspan': true,
- 'use': true
- };
- var presentationAttributes = exports.presentationAttributes = {
- 'alignment-baseline': true,
- 'baseline-shift': true,
- 'clip-path': true,
- 'clip-rule': true,
- 'clip': true,
- 'color-interpolation-filters': true,
- 'color-interpolation': true,
- 'color-profile': true,
- 'color-rendering': true,
- 'color': true,
- 'cursor': true,
- 'direction': true,
- 'display': true,
- 'dominant-baseline': true,
- 'enable-background': true,
- 'fill-opacity': true,
- 'fill-rule': true,
- 'fill': true,
- 'filter': true,
- 'flood-color': true,
- 'flood-opacity': true,
- 'font-family': true,
- 'font-size-adjust': true,
- 'font-size': true,
- 'font-stretch': true,
- 'font-style': true,
- 'font-variant': true,
- 'font-weight': true,
- 'glyph-orientation-horizontal': true,
- 'glyph-orientation-vertical': true,
- 'image-rendering': true,
- 'kerning': true,
- 'letter-spacing': true,
- 'lighting-color': true,
- 'marker-end': true,
- 'marker-mid': true,
- 'marker-start': true,
- 'mask': true,
- 'opacity': true,
- 'overflow': true,
- 'pointer-events': true,
- 'shape-rendering': true,
- 'stop-color': true,
- 'stop-opacity': true,
- 'stroke-dasharray': true,
- 'stroke-dashoffset': true,
- 'stroke-linecap': true,
- 'stroke-linejoin': true,
- 'stroke-miterlimit': true,
- 'stroke-opacity': true,
- 'stroke-width': true,
- 'stroke': true,
- 'text-anchor': true,
- 'text-decoration': true,
- 'text-rendering': true,
- 'unicode-bidi': true,
- 'visibility': true,
- 'word-spacing': true,
- 'writing-mode': true
- };
- function createElement(html) {
- var div = _aureliaPal.DOM.createElement('div');
- div.innerHTML = html;
- return div.firstChild;
- }
- var SVGAnalyzer = exports.SVGAnalyzer = function () {
- function SVGAnalyzer() {
-
- if (createElement('<svg><altGlyph /></svg>').firstElementChild.nodeName === 'altglyph' && elements.altGlyph) {
- elements.altglyph = elements.altGlyph;
- delete elements.altGlyph;
- elements.altglyphdef = elements.altGlyphDef;
- delete elements.altGlyphDef;
- elements.altglyphitem = elements.altGlyphItem;
- delete elements.altGlyphItem;
- elements.glyphref = elements.glyphRef;
- delete elements.glyphRef;
- }
- }
- SVGAnalyzer.prototype.isStandardSvgAttribute = function isStandardSvgAttribute(nodeName, attributeName) {
- return presentationElements[nodeName] && presentationAttributes[attributeName] || elements[nodeName] && elements[nodeName].indexOf(attributeName) !== -1;
- };
- return SVGAnalyzer;
- }();
- var ObserverLocator = exports.ObserverLocator = (_temp = _class11 = function () {
- function ObserverLocator(taskQueue, eventManager, dirtyChecker, svgAnalyzer, parser) {
-
- this.taskQueue = taskQueue;
- this.eventManager = eventManager;
- this.dirtyChecker = dirtyChecker;
- this.svgAnalyzer = svgAnalyzer;
- this.parser = parser;
- this.adapters = [];
- this.logger = LogManager.getLogger('observer-locator');
- }
- ObserverLocator.prototype.getObserver = function getObserver(obj, propertyName) {
- var observersLookup = obj.__observers__;
- var observer = void 0;
- if (observersLookup && propertyName in observersLookup) {
- return observersLookup[propertyName];
- }
- observer = this.createPropertyObserver(obj, propertyName);
- if (!observer.doNotCache) {
- if (observersLookup === undefined) {
- observersLookup = this.getOrCreateObserversLookup(obj);
- }
- observersLookup[propertyName] = observer;
- }
- return observer;
- };
- ObserverLocator.prototype.getOrCreateObserversLookup = function getOrCreateObserversLookup(obj) {
- return obj.__observers__ || this.createObserversLookup(obj);
- };
- ObserverLocator.prototype.createObserversLookup = function createObserversLookup(obj) {
- var value = {};
- if (!Reflect.defineProperty(obj, '__observers__', {
- enumerable: false,
- configurable: false,
- writable: false,
- value: value
- })) {
- this.logger.warn('Cannot add observers to object', obj);
- }
- return value;
- };
- ObserverLocator.prototype.addAdapter = function addAdapter(adapter) {
- this.adapters.push(adapter);
- };
- ObserverLocator.prototype.getAdapterObserver = function getAdapterObserver(obj, propertyName, descriptor) {
- for (var _i25 = 0, ii = this.adapters.length; _i25 < ii; _i25++) {
- var adapter = this.adapters[_i25];
- var observer = adapter.getObserver(obj, propertyName, descriptor);
- if (observer) {
- return observer;
- }
- }
- return null;
- };
- ObserverLocator.prototype.createPropertyObserver = function createPropertyObserver(obj, propertyName) {
- var descriptor = void 0;
- var handler = void 0;
- var xlinkResult = void 0;
- if (!(obj instanceof Object)) {
- return new PrimitiveObserver(obj, propertyName);
- }
- if (obj instanceof _aureliaPal.DOM.Element) {
- if (propertyName === 'class') {
- return new ClassObserver(obj);
- }
- if (propertyName === 'style' || propertyName === 'css') {
- return new StyleObserver(obj, propertyName);
- }
- handler = this.eventManager.getElementHandler(obj, propertyName);
- if (propertyName === 'value' && obj.tagName.toLowerCase() === 'select') {
- return new SelectValueObserver(obj, handler, this);
- }
- if (propertyName === 'checked' && obj.tagName.toLowerCase() === 'input') {
- return new CheckedObserver(obj, handler, this);
- }
- if (handler) {
- return new ValueAttributeObserver(obj, propertyName, handler);
- }
- xlinkResult = /^xlink:(.+)$/.exec(propertyName);
- if (xlinkResult) {
- return new XLinkAttributeObserver(obj, propertyName, xlinkResult[1]);
- }
- if (/^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
- return new DataAttributeObserver(obj, propertyName);
- }
- }
- descriptor = Object.getPropertyDescriptor(obj, propertyName);
- if (hasDeclaredDependencies(descriptor)) {
- return createComputedObserver(obj, propertyName, descriptor, this);
- }
- if (descriptor) {
- var existingGetterOrSetter = descriptor.get || descriptor.set;
- if (existingGetterOrSetter) {
- if (existingGetterOrSetter.getObserver) {
- return existingGetterOrSetter.getObserver(obj);
- }
- var adapterObserver = this.getAdapterObserver(obj, propertyName, descriptor);
- if (adapterObserver) {
- return adapterObserver;
- }
- return new DirtyCheckProperty(this.dirtyChecker, obj, propertyName);
- }
- }
- if (obj instanceof Array) {
- if (propertyName === 'length') {
- return this.getArrayObserver(obj).getLengthObserver();
- }
- return new DirtyCheckProperty(this.dirtyChecker, obj, propertyName);
- } else if (obj instanceof Map) {
- if (propertyName === 'size') {
- return this.getMapObserver(obj).getLengthObserver();
- }
- return new DirtyCheckProperty(this.dirtyChecker, obj, propertyName);
- } else if (obj instanceof Set) {
- if (propertyName === 'size') {
- return this.getSetObserver(obj).getLengthObserver();
- }
- return new DirtyCheckProperty(this.dirtyChecker, obj, propertyName);
- }
- return new SetterObserver(this.taskQueue, obj, propertyName);
- };
- ObserverLocator.prototype.getAccessor = function getAccessor(obj, propertyName) {
- if (obj instanceof _aureliaPal.DOM.Element) {
- if (propertyName === 'class' || propertyName === 'style' || propertyName === 'css' || propertyName === 'value' && (obj.tagName.toLowerCase() === 'input' || obj.tagName.toLowerCase() === 'select') || propertyName === 'checked' && obj.tagName.toLowerCase() === 'input' || propertyName === 'model' && obj.tagName.toLowerCase() === 'input' || /^xlink:.+$/.exec(propertyName)) {
- return this.getObserver(obj, propertyName);
- }
- if (/^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
- return dataAttributeAccessor;
- }
- }
- return propertyAccessor;
- };
- ObserverLocator.prototype.getArrayObserver = function getArrayObserver(array) {
- return _getArrayObserver(this.taskQueue, array);
- };
- ObserverLocator.prototype.getMapObserver = function getMapObserver(map) {
- return _getMapObserver(this.taskQueue, map);
- };
- ObserverLocator.prototype.getSetObserver = function getSetObserver(set) {
- return _getSetObserver(this.taskQueue, set);
- };
- return ObserverLocator;
- }(), _class11.inject = [_aureliaTaskQueue.TaskQueue, EventManager, DirtyChecker, SVGAnalyzer, Parser], _temp);
- var ObjectObservationAdapter = exports.ObjectObservationAdapter = function () {
- function ObjectObservationAdapter() {
-
- }
- ObjectObservationAdapter.prototype.getObserver = function getObserver(object, propertyName, descriptor) {
- throw new Error('BindingAdapters must implement getObserver(object, propertyName).');
- };
- return ObjectObservationAdapter;
- }();
- var BindingExpression = exports.BindingExpression = function () {
- function BindingExpression(observerLocator, targetProperty, sourceExpression, mode, lookupFunctions, attribute) {
-
- this.observerLocator = observerLocator;
- this.targetProperty = targetProperty;
- this.sourceExpression = sourceExpression;
- this.mode = mode;
- this.lookupFunctions = lookupFunctions;
- this.attribute = attribute;
- this.discrete = false;
- }
- BindingExpression.prototype.createBinding = function createBinding(target) {
- return new Binding(this.observerLocator, this.sourceExpression, target, this.targetProperty, this.mode, this.lookupFunctions);
- };
- return BindingExpression;
- }();
- var targetContext = 'Binding:target';
- var Binding = exports.Binding = (_dec10 = connectable(), _dec10(_class12 = function () {
- function Binding(observerLocator, sourceExpression, target, targetProperty, mode, lookupFunctions) {
-
- this.observerLocator = observerLocator;
- this.sourceExpression = sourceExpression;
- this.target = target;
- this.targetProperty = targetProperty;
- this.mode = mode;
- this.lookupFunctions = lookupFunctions;
- }
- Binding.prototype.updateTarget = function updateTarget(value) {
- this.targetObserver.setValue(value, this.target, this.targetProperty);
- };
- Binding.prototype.updateSource = function updateSource(value) {
- this.sourceExpression.assign(this.source, value, this.lookupFunctions);
- };
- Binding.prototype.call = function call(context, newValue, oldValue) {
- if (!this.isBound) {
- return;
- }
- if (context === sourceContext) {
- oldValue = this.targetObserver.getValue(this.target, this.targetProperty);
- newValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions);
- if (newValue !== oldValue) {
- this.updateTarget(newValue);
- }
- if (this.mode !== bindingMode.oneTime) {
- this._version++;
- this.sourceExpression.connect(this, this.source);
- this.unobserve(false);
- }
- return;
- }
- if (context === targetContext) {
- if (newValue !== this.sourceExpression.evaluate(this.source, this.lookupFunctions)) {
- this.updateSource(newValue);
- }
- return;
- }
- throw new Error('Unexpected call context ' + context);
- };
- Binding.prototype.bind = function bind(source) {
- if (this.isBound) {
- if (this.source === source) {
- return;
- }
- this.unbind();
- }
- this.isBound = true;
- this.source = source;
- if (this.sourceExpression.bind) {
- this.sourceExpression.bind(this, source, this.lookupFunctions);
- }
- var mode = this.mode;
- if (!this.targetObserver) {
- var method = mode === bindingMode.twoWay ? 'getObserver' : 'getAccessor';
- this.targetObserver = this.observerLocator[method](this.target, this.targetProperty);
- }
- if ('bind' in this.targetObserver) {
- this.targetObserver.bind();
- }
- var value = this.sourceExpression.evaluate(source, this.lookupFunctions);
- this.updateTarget(value);
- if (mode === bindingMode.oneWay) {
- enqueueBindingConnect(this);
- } else if (mode === bindingMode.twoWay) {
- this.sourceExpression.connect(this, source);
- this.targetObserver.subscribe(targetContext, this);
- }
- };
- Binding.prototype.unbind = function unbind() {
- if (!this.isBound) {
- return;
- }
- this.isBound = false;
- if (this.sourceExpression.unbind) {
- this.sourceExpression.unbind(this, this.source);
- }
- this.source = null;
- if ('unbind' in this.targetObserver) {
- this.targetObserver.unbind();
- }
- if (this.targetObserver.unsubscribe) {
- this.targetObserver.unsubscribe(targetContext, this);
- }
- this.unobserve(true);
- };
- Binding.prototype.connect = function connect(evaluate) {
- if (!this.isBound) {
- return;
- }
- if (evaluate) {
- var value = this.sourceExpression.evaluate(this.source, this.lookupFunctions);
- this.updateTarget(value);
- }
- this.sourceExpression.connect(this, this.source);
- };
- return Binding;
- }()) || _class12);
- var CallExpression = exports.CallExpression = function () {
- function CallExpression(observerLocator, targetProperty, sourceExpression, lookupFunctions) {
-
- this.observerLocator = observerLocator;
- this.targetProperty = targetProperty;
- this.sourceExpression = sourceExpression;
- this.lookupFunctions = lookupFunctions;
- }
- CallExpression.prototype.createBinding = function createBinding(target) {
- return new Call(this.observerLocator, this.sourceExpression, target, this.targetProperty, this.lookupFunctions);
- };
- return CallExpression;
- }();
- var Call = exports.Call = function () {
- function Call(observerLocator, sourceExpression, target, targetProperty, lookupFunctions) {
-
- this.sourceExpression = sourceExpression;
- this.target = target;
- this.targetProperty = observerLocator.getObserver(target, targetProperty);
- this.lookupFunctions = lookupFunctions;
- }
- Call.prototype.callSource = function callSource($event) {
- var overrideContext = this.source.overrideContext;
- Object.assign(overrideContext, $event);
- overrideContext.$event = $event;
- var mustEvaluate = true;
- var result = this.sourceExpression.evaluate(this.source, this.lookupFunctions, mustEvaluate);
- delete overrideContext.$event;
- for (var prop in $event) {
- delete overrideContext[prop];
- }
- return result;
- };
- Call.prototype.bind = function bind(source) {
- var _this27 = this;
- if (this.isBound) {
- if (this.source === source) {
- return;
- }
- this.unbind();
- }
- this.isBound = true;
- this.source = source;
- if (this.sourceExpression.bind) {
- this.sourceExpression.bind(this, source, this.lookupFunctions);
- }
- this.targetProperty.setValue(function ($event) {
- return _this27.callSource($event);
- });
- };
- Call.prototype.unbind = function unbind() {
- if (!this.isBound) {
- return;
- }
- this.isBound = false;
- if (this.sourceExpression.unbind) {
- this.sourceExpression.unbind(this, this.source);
- }
- this.source = null;
- this.targetProperty.setValue(null);
- };
- return Call;
- }();
- var ValueConverterResource = exports.ValueConverterResource = function () {
- function ValueConverterResource(name) {
-
- this.name = name;
- }
- ValueConverterResource.convention = function convention(name) {
- if (name.endsWith('ValueConverter')) {
- return new ValueConverterResource(camelCase(name.substring(0, name.length - 14)));
- }
- };
- ValueConverterResource.prototype.initialize = function initialize(container, target) {
- this.instance = container.get(target);
- };
- ValueConverterResource.prototype.register = function register(registry, name) {
- registry.registerValueConverter(name || this.name, this.instance);
- };
- ValueConverterResource.prototype.load = function load(container, target) {};
- return ValueConverterResource;
- }();
- function valueConverter(nameOrTarget) {
- if (nameOrTarget === undefined || typeof nameOrTarget === 'string') {
- return function (target) {
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ValueConverterResource(nameOrTarget), target);
- };
- }
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ValueConverterResource(), nameOrTarget);
- }
- var BindingBehaviorResource = exports.BindingBehaviorResource = function () {
- function BindingBehaviorResource(name) {
-
- this.name = name;
- }
- BindingBehaviorResource.convention = function convention(name) {
- if (name.endsWith('BindingBehavior')) {
- return new BindingBehaviorResource(camelCase(name.substring(0, name.length - 15)));
- }
- };
- BindingBehaviorResource.prototype.initialize = function initialize(container, target) {
- this.instance = container.get(target);
- };
- BindingBehaviorResource.prototype.register = function register(registry, name) {
- registry.registerBindingBehavior(name || this.name, this.instance);
- };
- BindingBehaviorResource.prototype.load = function load(container, target) {};
- return BindingBehaviorResource;
- }();
- function bindingBehavior(nameOrTarget) {
- if (nameOrTarget === undefined || typeof nameOrTarget === 'string') {
- return function (target) {
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new BindingBehaviorResource(nameOrTarget), target);
- };
- }
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new BindingBehaviorResource(), nameOrTarget);
- }
- var ListenerExpression = exports.ListenerExpression = function () {
- function ListenerExpression(eventManager, targetEvent, sourceExpression, delegate, preventDefault, lookupFunctions) {
-
- this.eventManager = eventManager;
- this.targetEvent = targetEvent;
- this.sourceExpression = sourceExpression;
- this.delegate = delegate;
- this.discrete = true;
- this.preventDefault = preventDefault;
- this.lookupFunctions = lookupFunctions;
- }
- ListenerExpression.prototype.createBinding = function createBinding(target) {
- return new Listener(this.eventManager, this.targetEvent, this.delegate, this.sourceExpression, target, this.preventDefault, this.lookupFunctions);
- };
- return ListenerExpression;
- }();
- var Listener = exports.Listener = function () {
- function Listener(eventManager, targetEvent, delegate, sourceExpression, target, preventDefault, lookupFunctions) {
-
- this.eventManager = eventManager;
- this.targetEvent = targetEvent;
- this.delegate = delegate;
- this.sourceExpression = sourceExpression;
- this.target = target;
- this.preventDefault = preventDefault;
- this.lookupFunctions = lookupFunctions;
- }
- Listener.prototype.callSource = function callSource(event) {
- var overrideContext = this.source.overrideContext;
- overrideContext.$event = event;
- var mustEvaluate = true;
- var result = this.sourceExpression.evaluate(this.source, this.lookupFunctions, mustEvaluate);
- delete overrideContext.$event;
- if (result !== true && this.preventDefault) {
- event.preventDefault();
- }
- return result;
- };
- Listener.prototype.bind = function bind(source) {
- var _this28 = this;
- if (this.isBound) {
- if (this.source === source) {
- return;
- }
- this.unbind();
- }
- this.isBound = true;
- this.source = source;
- if (this.sourceExpression.bind) {
- this.sourceExpression.bind(this, source, this.lookupFunctions);
- }
- this._disposeListener = this.eventManager.addEventListener(this.target, this.targetEvent, function (event) {
- return _this28.callSource(event);
- }, this.delegate);
- };
- Listener.prototype.unbind = function unbind() {
- if (!this.isBound) {
- return;
- }
- this.isBound = false;
- if (this.sourceExpression.unbind) {
- this.sourceExpression.unbind(this, this.source);
- }
- this.source = null;
- this._disposeListener();
- this._disposeListener = null;
- };
- return Listener;
- }();
- function getAU(element) {
- var au = element.au;
- if (au === undefined) {
- throw new Error('No Aurelia APIs are defined for the element: "' + element.tagName + '".');
- }
- return au;
- }
- var NameExpression = exports.NameExpression = function () {
- function NameExpression(sourceExpression, apiName, lookupFunctions) {
-
- this.sourceExpression = sourceExpression;
- this.apiName = apiName;
- this.lookupFunctions = lookupFunctions;
- this.discrete = true;
- }
- NameExpression.prototype.createBinding = function createBinding(target) {
- return new NameBinder(this.sourceExpression, NameExpression.locateAPI(target, this.apiName), this.lookupFunctions);
- };
- NameExpression.locateAPI = function locateAPI(element, apiName) {
- switch (apiName) {
- case 'element':
- return element;
- case 'controller':
- return getAU(element).controller;
- case 'view-model':
- return getAU(element).controller.viewModel;
- case 'view':
- return getAU(element).controller.view;
- default:
- var target = getAU(element)[apiName];
- if (target === undefined) {
- throw new Error('Attempted to reference "' + apiName + '", but it was not found amongst the target\'s API.');
- }
- return target.viewModel;
- }
- };
- return NameExpression;
- }();
- var NameBinder = function () {
- function NameBinder(sourceExpression, target, lookupFunctions) {
-
- this.sourceExpression = sourceExpression;
- this.target = target;
- this.lookupFunctions = lookupFunctions;
- }
- NameBinder.prototype.bind = function bind(source) {
- if (this.isBound) {
- if (this.source === source) {
- return;
- }
- this.unbind();
- }
- this.isBound = true;
- this.source = source;
- if (this.sourceExpression.bind) {
- this.sourceExpression.bind(this, source, this.lookupFunctions);
- }
- this.sourceExpression.assign(this.source, this.target, this.lookupFunctions);
- };
- NameBinder.prototype.unbind = function unbind() {
- if (!this.isBound) {
- return;
- }
- this.isBound = false;
- this.sourceExpression.assign(this.source, null, this.lookupFunctions);
- if (this.sourceExpression.unbind) {
- this.sourceExpression.unbind(this, this.source);
- }
- this.source = null;
- };
- return NameBinder;
- }();
- var LookupFunctions = {
- bindingBehaviors: function bindingBehaviors(name) {
- return null;
- },
- valueConverters: function valueConverters(name) {
- return null;
- }
- };
- var BindingEngine = exports.BindingEngine = (_temp2 = _class13 = function () {
- function BindingEngine(observerLocator, parser) {
-
- this.observerLocator = observerLocator;
- this.parser = parser;
- }
- BindingEngine.prototype.createBindingExpression = function createBindingExpression(targetProperty, sourceExpression) {
- var mode = arguments.length <= 2 || arguments[2] === undefined ? bindingMode.oneWay : arguments[2];
- var lookupFunctions = arguments.length <= 3 || arguments[3] === undefined ? LookupFunctions : arguments[3];
- return new BindingExpression(this.observerLocator, targetProperty, this.parser.parse(sourceExpression), mode, lookupFunctions);
- };
- BindingEngine.prototype.propertyObserver = function propertyObserver(obj, propertyName) {
- var _this29 = this;
- return {
- subscribe: function subscribe(callback) {
- var observer = _this29.observerLocator.getObserver(obj, propertyName);
- observer.subscribe(callback);
- return {
- dispose: function dispose() {
- return observer.unsubscribe(callback);
- }
- };
- }
- };
- };
- BindingEngine.prototype.collectionObserver = function collectionObserver(collection) {
- var _this30 = this;
- return {
- subscribe: function subscribe(callback) {
- var observer = void 0;
- if (collection instanceof Array) {
- observer = _this30.observerLocator.getArrayObserver(collection);
- } else if (collection instanceof Map) {
- observer = _this30.observerLocator.getMapObserver(collection);
- } else if (collection instanceof Set) {
- observer = _this30.observerLocator.getSetObserver(collection);
- } else {
- throw new Error('collection must be an instance of Array, Map or Set.');
- }
- observer.subscribe(callback);
- return {
- dispose: function dispose() {
- return observer.unsubscribe(callback);
- }
- };
- }
- };
- };
- BindingEngine.prototype.expressionObserver = function expressionObserver(bindingContext, expression) {
- var scope = { bindingContext: bindingContext, overrideContext: createOverrideContext(bindingContext) };
- return new ExpressionObserver(scope, this.parser.parse(expression), this.observerLocator, LookupFunctions);
- };
- BindingEngine.prototype.parseExpression = function parseExpression(expression) {
- return this.parser.parse(expression);
- };
- BindingEngine.prototype.registerAdapter = function registerAdapter(adapter) {
- this.observerLocator.addAdapter(adapter);
- };
- return BindingEngine;
- }(), _class13.inject = [ObserverLocator, Parser], _temp2);
- var setProto = Set.prototype;
- function _getSetObserver(taskQueue, set) {
- return ModifySetObserver.for(taskQueue, set);
- }
- exports.getSetObserver = _getSetObserver;
- var ModifySetObserver = function (_ModifyCollectionObse3) {
- _inherits(ModifySetObserver, _ModifyCollectionObse3);
- function ModifySetObserver(taskQueue, set) {
-
- return _possibleConstructorReturn(this, _ModifyCollectionObse3.call(this, taskQueue, set));
- }
- ModifySetObserver.for = function _for(taskQueue, set) {
- if (!('__set_observer__' in set)) {
- Reflect.defineProperty(set, '__set_observer__', {
- value: ModifySetObserver.create(taskQueue, set),
- enumerable: false, configurable: false
- });
- }
- return set.__set_observer__;
- };
- ModifySetObserver.create = function create(taskQueue, set) {
- var observer = new ModifySetObserver(taskQueue, set);
- var proto = setProto;
- if (proto.add !== set.add || proto.delete !== set.delete || proto.clear !== set.clear) {
- proto = {
- add: set.add,
- delete: set.delete,
- clear: set.clear
- };
- }
- set.add = function () {
- var type = 'add';
- var oldSize = set.size;
- var methodCallResult = proto.add.apply(set, arguments);
- var hasValue = set.size === oldSize;
- if (!hasValue) {
- observer.addChangeRecord({
- type: type,
- object: set,
- value: Array.from(set).pop()
- });
- }
- return methodCallResult;
- };
- set.delete = function () {
- var hasValue = set.has(arguments[0]);
- var methodCallResult = proto.delete.apply(set, arguments);
- if (hasValue) {
- observer.addChangeRecord({
- type: 'delete',
- object: set,
- value: arguments[0]
- });
- }
- return methodCallResult;
- };
- set.clear = function () {
- var methodCallResult = proto.clear.apply(set, arguments);
- observer.addChangeRecord({
- type: 'clear',
- object: set
- });
- return methodCallResult;
- };
- return observer;
- };
- return ModifySetObserver;
- }(ModifyCollectionObserver);
- function observable(targetOrConfig, key, descriptor) {
- function deco(target, key, descriptor, config) {
- if (key === undefined) {
- target = target.prototype;
- key = typeof config === 'string' ? config : config.name;
- }
- var innerPropertyName = '_' + key;
- var callbackName = config && config.changeHandler || key + 'Changed';
- if (descriptor) {
- if (typeof descriptor.initializer === 'function') {
- target[innerPropertyName] = descriptor.initializer();
- }
- } else {
- descriptor = {};
- }
- delete descriptor.writable;
- delete descriptor.initializer;
- descriptor.get = function () {
- return this[innerPropertyName];
- };
- descriptor.set = function (newValue) {
- var oldValue = this[innerPropertyName];
- this[innerPropertyName] = newValue;
- if (this[callbackName]) {
- this[callbackName](newValue, oldValue, key);
- }
- };
- descriptor.get.dependencies = [innerPropertyName];
- Reflect.defineProperty(target, key, descriptor);
- }
- if (key === undefined) {
- return function (t, k, d) {
- return deco(t, k, d, targetOrConfig);
- };
- }
- return deco(targetOrConfig, key, descriptor);
- }
- });
- define('aurelia-bootstrapper',['exports', 'aurelia-pal', 'aurelia-pal-browser', 'aurelia-polyfills'], function (exports, _aureliaPal, _aureliaPalBrowser) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.bootstrap = bootstrap;
- var bootstrapQueue = [];
- var sharedLoader = null;
- var Aurelia = null;
- function onBootstrap(callback) {
- return new Promise(function (resolve, reject) {
- if (sharedLoader) {
- resolve(callback(sharedLoader));
- } else {
- bootstrapQueue.push(function () {
- try {
- resolve(callback(sharedLoader));
- } catch (e) {
- reject(e);
- }
- });
- }
- });
- }
- function ready(global) {
- return new Promise(function (resolve, reject) {
- if (global.document.readyState === 'complete') {
- resolve(global.document);
- } else {
- global.document.addEventListener('DOMContentLoaded', completed);
- global.addEventListener('load', completed);
- }
- function completed() {
- global.document.removeEventListener('DOMContentLoaded', completed);
- global.removeEventListener('load', completed);
- resolve(global.document);
- }
- });
- }
- function createLoader() {
- if (_aureliaPal.PLATFORM.Loader) {
- return Promise.resolve(new _aureliaPal.PLATFORM.Loader());
- }
- if (window.System && typeof window.System.import === 'function') {
- return System.normalize('aurelia-bootstrapper').then(function (bootstrapperName) {
- return System.normalize('aurelia-loader-default', bootstrapperName);
- }).then(function (loaderName) {
- return System.import(loaderName).then(function (m) {
- return new m.DefaultLoader();
- });
- });
- }
- if (typeof window.require === 'function') {
- return new Promise(function (resolve, reject) {
- return require(['aurelia-loader-default'], function (m) {
- return resolve(new m.DefaultLoader());
- }, reject);
- });
- }
- return Promise.reject('No PLATFORM.Loader is defined and there is neither a System API (ES6) or a Require API (AMD) globally available to load your app.');
- }
- function preparePlatform(loader) {
- return loader.normalize('aurelia-bootstrapper').then(function (bootstrapperName) {
- return loader.normalize('aurelia-framework', bootstrapperName).then(function (frameworkName) {
- loader.map('aurelia-framework', frameworkName);
- return Promise.all([loader.normalize('aurelia-dependency-injection', frameworkName).then(function (diName) {
- return loader.map('aurelia-dependency-injection', diName);
- }), loader.normalize('aurelia-router', bootstrapperName).then(function (routerName) {
- return loader.map('aurelia-router', routerName);
- }), loader.normalize('aurelia-logging-console', bootstrapperName).then(function (loggingConsoleName) {
- return loader.map('aurelia-logging-console', loggingConsoleName);
- })]).then(function () {
- return loader.loadModule(frameworkName).then(function (m) {
- return Aurelia = m.Aurelia;
- });
- });
- });
- });
- }
- function handleApp(loader, appHost) {
- var moduleId = appHost.getAttribute('aurelia-app') || appHost.getAttribute('data-aurelia-app');
- return config(loader, appHost, moduleId);
- }
- function config(loader, appHost, configModuleId) {
- var aurelia = new Aurelia(loader);
- aurelia.host = appHost;
- aurelia.configModuleId = configModuleId || null;
- if (configModuleId) {
- return loader.loadModule(configModuleId).then(function (customConfig) {
- return customConfig.configure(aurelia);
- });
- }
- aurelia.use.standardConfiguration().developmentLogging();
- return aurelia.start().then(function () {
- return aurelia.setRoot();
- });
- }
- function run() {
- return ready(window).then(function (doc) {
- (0, _aureliaPalBrowser.initialize)();
- var appHost = doc.querySelectorAll('[aurelia-app],[data-aurelia-app]');
- return createLoader().then(function (loader) {
- return preparePlatform(loader).then(function () {
- for (var i = 0, ii = appHost.length; i < ii; ++i) {
- handleApp(loader, appHost[i]).catch(console.error.bind(console));
- }
- sharedLoader = loader;
- for (var _i = 0, _ii = bootstrapQueue.length; _i < _ii; ++_i) {
- bootstrapQueue[_i]();
- }
- bootstrapQueue = null;
- });
- });
- });
- }
- function bootstrap(configure) {
- return onBootstrap(function (loader) {
- var aurelia = new Aurelia(loader);
- return configure(aurelia);
- });
- }
- run();
- });
- define('aurelia-event-aggregator',['exports', 'aurelia-logging'], function (exports, _aureliaLogging) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EventAggregator = undefined;
- exports.includeEventsIn = includeEventsIn;
- exports.configure = configure;
- var LogManager = _interopRequireWildcard(_aureliaLogging);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
-
- var logger = LogManager.getLogger('event-aggregator');
- var Handler = function () {
- function Handler(messageType, callback) {
-
- this.messageType = messageType;
- this.callback = callback;
- }
- Handler.prototype.handle = function handle(message) {
- if (message instanceof this.messageType) {
- this.callback.call(null, message);
- }
- };
- return Handler;
- }();
- var EventAggregator = exports.EventAggregator = function () {
- function EventAggregator() {
-
- this.eventLookup = {};
- this.messageHandlers = [];
- }
- EventAggregator.prototype.publish = function publish(event, data) {
- var subscribers = void 0;
- var i = void 0;
- if (!event) {
- throw new Error('Event was invalid.');
- }
- if (typeof event === 'string') {
- subscribers = this.eventLookup[event];
- if (subscribers) {
- subscribers = subscribers.slice();
- i = subscribers.length;
- try {
- while (i--) {
- subscribers[i](data, event);
- }
- } catch (e) {
- logger.error(e);
- }
- }
- } else {
- subscribers = this.messageHandlers.slice();
- i = subscribers.length;
- try {
- while (i--) {
- subscribers[i].handle(event);
- }
- } catch (e) {
- logger.error(e);
- }
- }
- };
- EventAggregator.prototype.subscribe = function subscribe(event, callback) {
- var handler = void 0;
- var subscribers = void 0;
- if (!event) {
- throw new Error('Event channel/type was invalid.');
- }
- if (typeof event === 'string') {
- handler = callback;
- subscribers = this.eventLookup[event] || (this.eventLookup[event] = []);
- } else {
- handler = new Handler(event, callback);
- subscribers = this.messageHandlers;
- }
- subscribers.push(handler);
- return {
- dispose: function dispose() {
- var idx = subscribers.indexOf(handler);
- if (idx !== -1) {
- subscribers.splice(idx, 1);
- }
- }
- };
- };
- EventAggregator.prototype.subscribeOnce = function subscribeOnce(event, callback) {
- var sub = this.subscribe(event, function (a, b) {
- sub.dispose();
- return callback(a, b);
- });
- return sub;
- };
- return EventAggregator;
- }();
- function includeEventsIn(obj) {
- var ea = new EventAggregator();
- obj.subscribeOnce = function (event, callback) {
- return ea.subscribeOnce(event, callback);
- };
- obj.subscribe = function (event, callback) {
- return ea.subscribe(event, callback);
- };
- obj.publish = function (event, data) {
- ea.publish(event, data);
- };
- return ea;
- }
- function configure(config) {
- config.instance(EventAggregator, includeEventsIn(config.aurelia));
- }
- });
- define('aurelia-framework',['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-metadata', 'aurelia-templating', 'aurelia-loader', 'aurelia-task-queue', 'aurelia-path', 'aurelia-pal', 'aurelia-logging'], function (exports, _aureliaDependencyInjection, _aureliaBinding, _aureliaMetadata, _aureliaTemplating, _aureliaLoader, _aureliaTaskQueue, _aureliaPath, _aureliaPal, _aureliaLogging) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.LogManager = exports.FrameworkConfiguration = exports.Aurelia = undefined;
- Object.keys(_aureliaDependencyInjection).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _aureliaDependencyInjection[key];
- }
- });
- });
- Object.keys(_aureliaBinding).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _aureliaBinding[key];
- }
- });
- });
- Object.keys(_aureliaMetadata).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _aureliaMetadata[key];
- }
- });
- });
- Object.keys(_aureliaTemplating).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _aureliaTemplating[key];
- }
- });
- });
- Object.keys(_aureliaLoader).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _aureliaLoader[key];
- }
- });
- });
- Object.keys(_aureliaTaskQueue).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _aureliaTaskQueue[key];
- }
- });
- });
- Object.keys(_aureliaPath).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _aureliaPath[key];
- }
- });
- });
- Object.keys(_aureliaPal).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function () {
- return _aureliaPal[key];
- }
- });
- });
- var TheLogManager = _interopRequireWildcard(_aureliaLogging);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
-
- function preventActionlessFormSubmit() {
- _aureliaPal.DOM.addEventListener('submit', function (evt) {
- var target = evt.target;
- var action = target.action;
- if (target.tagName.toLowerCase() === 'form' && !action) {
- evt.preventDefault();
- }
- });
- }
- var Aurelia = exports.Aurelia = function () {
- function Aurelia(loader, container, resources) {
-
- this.loader = loader || new _aureliaPal.PLATFORM.Loader();
- this.container = container || new _aureliaDependencyInjection.Container().makeGlobal();
- this.resources = resources || new _aureliaTemplating.ViewResources();
- this.use = new FrameworkConfiguration(this);
- this.logger = TheLogManager.getLogger('aurelia');
- this.hostConfigured = false;
- this.host = null;
- this.use.instance(Aurelia, this);
- this.use.instance(_aureliaLoader.Loader, this.loader);
- this.use.instance(_aureliaTemplating.ViewResources, this.resources);
- }
- Aurelia.prototype.start = function start() {
- var _this = this;
- if (this.started) {
- return Promise.resolve(this);
- }
- this.started = true;
- this.logger.info('Aurelia Starting');
- return this.use.apply().then(function () {
- preventActionlessFormSubmit();
- if (!_this.container.hasResolver(_aureliaTemplating.BindingLanguage)) {
- var message = 'You must configure Aurelia with a BindingLanguage implementation.';
- _this.logger.error(message);
- throw new Error(message);
- }
- _this.logger.info('Aurelia Started');
- var evt = _aureliaPal.DOM.createCustomEvent('aurelia-started', { bubbles: true, cancelable: true });
- _aureliaPal.DOM.dispatchEvent(evt);
- return _this;
- });
- };
- Aurelia.prototype.enhance = function enhance() {
- var _this2 = this;
- var bindingContext = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
- var applicationHost = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
- this._configureHost(applicationHost || _aureliaPal.DOM.querySelectorAll('body')[0]);
- return new Promise(function (resolve) {
- var engine = _this2.container.get(_aureliaTemplating.TemplatingEngine);
- _this2.root = engine.enhance({ container: _this2.container, element: _this2.host, resources: _this2.resources, bindingContext: bindingContext });
- _this2.root.attached();
- _this2._onAureliaComposed();
- resolve(_this2);
- });
- };
- Aurelia.prototype.setRoot = function setRoot() {
- var _this3 = this;
- var root = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
- var applicationHost = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
- var instruction = {};
- if (this.root && this.root.viewModel && this.root.viewModel.router) {
- this.root.viewModel.router.deactivate();
- this.root.viewModel.router.reset();
- }
- this._configureHost(applicationHost);
- var engine = this.container.get(_aureliaTemplating.TemplatingEngine);
- var transaction = this.container.get(_aureliaTemplating.CompositionTransaction);
- delete transaction.initialComposition;
- if (!root) {
- if (this.configModuleId) {
- root = (0, _aureliaPath.relativeToFile)('./app', this.configModuleId);
- } else {
- root = 'app';
- }
- }
- instruction.viewModel = root;
- instruction.container = instruction.childContainer = this.container;
- instruction.viewSlot = this.hostSlot;
- instruction.host = this.host;
- return engine.compose(instruction).then(function (r) {
- _this3.root = r;
- instruction.viewSlot.attached();
- _this3._onAureliaComposed();
- return _this3;
- });
- };
- Aurelia.prototype._configureHost = function _configureHost(applicationHost) {
- if (this.hostConfigured) {
- return;
- }
- applicationHost = applicationHost || this.host;
- if (!applicationHost || typeof applicationHost === 'string') {
- this.host = _aureliaPal.DOM.getElementById(applicationHost || 'applicationHost');
- } else {
- this.host = applicationHost;
- }
- if (!this.host) {
- throw new Error('No applicationHost was specified.');
- }
- this.hostConfigured = true;
- this.host.aurelia = this;
- this.hostSlot = new _aureliaTemplating.ViewSlot(this.host, true);
- this.hostSlot.transformChildNodesIntoView();
- this.container.registerInstance(_aureliaPal.DOM.boundary, this.host);
- };
- Aurelia.prototype._onAureliaComposed = function _onAureliaComposed() {
- var evt = _aureliaPal.DOM.createCustomEvent('aurelia-composed', { bubbles: true, cancelable: true });
- setTimeout(function () {
- return _aureliaPal.DOM.dispatchEvent(evt);
- }, 1);
- };
- return Aurelia;
- }();
- var logger = TheLogManager.getLogger('aurelia');
- var extPattern = /\.[^/.]+$/;
- function runTasks(config, tasks) {
- var current = void 0;
- var next = function next() {
- current = tasks.shift();
- if (current) {
- return Promise.resolve(current(config)).then(next);
- }
- return Promise.resolve();
- };
- return next();
- }
- function loadPlugin(config, loader, info) {
- logger.debug('Loading plugin ' + info.moduleId + '.');
- config.resourcesRelativeTo = info.resourcesRelativeTo;
- var id = info.moduleId;
- if (info.resourcesRelativeTo.length > 1) {
- return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) {
- return _loadPlugin(normalizedId);
- });
- }
- return _loadPlugin(id);
- function _loadPlugin(moduleId) {
- return loader.loadModule(moduleId).then(function (m) {
- if ('configure' in m) {
- return Promise.resolve(m.configure(config, info.config || {})).then(function () {
- config.resourcesRelativeTo = null;
- logger.debug('Configured plugin ' + info.moduleId + '.');
- });
- }
- config.resourcesRelativeTo = null;
- logger.debug('Loaded plugin ' + info.moduleId + '.');
- });
- }
- }
- function loadResources(aurelia, resourcesToLoad, appResources) {
- var viewEngine = aurelia.container.get(_aureliaTemplating.ViewEngine);
- return Promise.all(Object.keys(resourcesToLoad).map(function (n) {
- return _normalize(resourcesToLoad[n]);
- })).then(function (loads) {
- var names = [];
- var importIds = [];
- loads.forEach(function (l) {
- names.push(undefined);
- importIds.push(l.importId);
- });
- return viewEngine.importViewResources(importIds, names, appResources);
- });
- function _normalize(load) {
- var moduleId = load.moduleId;
- var ext = getExt(moduleId);
- if (isOtherResource(moduleId)) {
- moduleId = removeExt(moduleId);
- }
- return aurelia.loader.normalize(moduleId, load.relativeTo).then(function (normalized) {
- return {
- name: load.moduleId,
- importId: isOtherResource(load.moduleId) ? addOriginalExt(normalized, ext) : normalized
- };
- });
- }
- function isOtherResource(name) {
- var ext = getExt(name);
- if (!ext) return false;
- if (ext === '') return false;
- if (ext === '.js' || ext === '.ts') return false;
- return true;
- }
- function removeExt(name) {
- return name.replace(extPattern, '');
- }
- function addOriginalExt(normalized, ext) {
- return removeExt(normalized) + '.' + ext;
- }
- }
- function getExt(name) {
- var match = name.match(extPattern);
- if (match && match.length > 0) {
- return match[0].split('.')[1];
- }
- }
- function assertProcessed(plugins) {
- if (plugins.processed) {
- throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.');
- }
- }
- var FrameworkConfiguration = function () {
- function FrameworkConfiguration(aurelia) {
- var _this4 = this;
-
- this.aurelia = aurelia;
- this.container = aurelia.container;
- this.info = [];
- this.processed = false;
- this.preTasks = [];
- this.postTasks = [];
- this.resourcesToLoad = {};
- this.preTask(function () {
- return aurelia.loader.normalize('aurelia-bootstrapper').then(function (name) {
- return _this4.bootstrapperName = name;
- });
- });
- this.postTask(function () {
- return loadResources(aurelia, _this4.resourcesToLoad, aurelia.resources);
- });
- }
- FrameworkConfiguration.prototype.instance = function instance(type, _instance) {
- this.container.registerInstance(type, _instance);
- return this;
- };
- FrameworkConfiguration.prototype.singleton = function singleton(type, implementation) {
- this.container.registerSingleton(type, implementation);
- return this;
- };
- FrameworkConfiguration.prototype.transient = function transient(type, implementation) {
- this.container.registerTransient(type, implementation);
- return this;
- };
- FrameworkConfiguration.prototype.preTask = function preTask(task) {
- assertProcessed(this);
- this.preTasks.push(task);
- return this;
- };
- FrameworkConfiguration.prototype.postTask = function postTask(task) {
- assertProcessed(this);
- this.postTasks.push(task);
- return this;
- };
- FrameworkConfiguration.prototype.feature = function feature(plugin, config) {
- if (getExt(plugin)) {
- return this.plugin({ moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: config || {} });
- }
- return this.plugin({ moduleId: plugin + '/index', resourcesRelativeTo: [plugin, ''], config: config || {} });
- };
- FrameworkConfiguration.prototype.globalResources = function globalResources(resources) {
- assertProcessed(this);
- var toAdd = Array.isArray(resources) ? resources : arguments;
- var resource = void 0;
- var resourcesRelativeTo = this.resourcesRelativeTo || ['', ''];
- for (var i = 0, ii = toAdd.length; i < ii; ++i) {
- resource = toAdd[i];
- if (typeof resource !== 'string') {
- throw new Error('Invalid resource path [' + resource + ']. Resources must be specified as relative module IDs.');
- }
- var parent = resourcesRelativeTo[0];
- var grandParent = resourcesRelativeTo[1];
- var name = resource;
- if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') {
- name = (0, _aureliaPath.join)(parent, resource);
- }
- this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent };
- }
- return this;
- };
- FrameworkConfiguration.prototype.globalName = function globalName(resourcePath, newName) {
- assertProcessed(this);
- this.resourcesToLoad[resourcePath] = { moduleId: newName, relativeTo: '' };
- return this;
- };
- FrameworkConfiguration.prototype.plugin = function plugin(_plugin, config) {
- assertProcessed(this);
- if (typeof _plugin === 'string') {
- return this.plugin({ moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: config || {} });
- }
- this.info.push(_plugin);
- return this;
- };
- FrameworkConfiguration.prototype._addNormalizedPlugin = function _addNormalizedPlugin(name, config) {
- var _this5 = this;
- var plugin = { moduleId: name, resourcesRelativeTo: [name, ''], config: config || {} };
- this.plugin(plugin);
- this.preTask(function () {
- var relativeTo = [name, _this5.bootstrapperName];
- plugin.moduleId = name;
- plugin.resourcesRelativeTo = relativeTo;
- return Promise.resolve();
- });
- return this;
- };
- FrameworkConfiguration.prototype.defaultBindingLanguage = function defaultBindingLanguage() {
- return this._addNormalizedPlugin('aurelia-templating-binding');
- };
- FrameworkConfiguration.prototype.router = function router() {
- return this._addNormalizedPlugin('aurelia-templating-router');
- };
- FrameworkConfiguration.prototype.history = function history() {
- return this._addNormalizedPlugin('aurelia-history-browser');
- };
- FrameworkConfiguration.prototype.defaultResources = function defaultResources() {
- return this._addNormalizedPlugin('aurelia-templating-resources');
- };
- FrameworkConfiguration.prototype.eventAggregator = function eventAggregator() {
- return this._addNormalizedPlugin('aurelia-event-aggregator');
- };
- FrameworkConfiguration.prototype.basicConfiguration = function basicConfiguration() {
- return this.defaultBindingLanguage().defaultResources().eventAggregator();
- };
- FrameworkConfiguration.prototype.standardConfiguration = function standardConfiguration() {
- return this.basicConfiguration().history().router();
- };
- FrameworkConfiguration.prototype.developmentLogging = function developmentLogging() {
- var _this6 = this;
- this.preTask(function () {
- return _this6.aurelia.loader.normalize('aurelia-logging-console', _this6.bootstrapperName).then(function (name) {
- return _this6.aurelia.loader.loadModule(name).then(function (m) {
- TheLogManager.addAppender(new m.ConsoleAppender());
- TheLogManager.setLevel(TheLogManager.logLevel.debug);
- });
- });
- });
- return this;
- };
- FrameworkConfiguration.prototype.apply = function apply() {
- var _this7 = this;
- if (this.processed) {
- return Promise.resolve();
- }
- return runTasks(this, this.preTasks).then(function () {
- var loader = _this7.aurelia.loader;
- var info = _this7.info;
- var current = void 0;
- var next = function next() {
- current = info.shift();
- if (current) {
- return loadPlugin(_this7, loader, current).then(next);
- }
- _this7.processed = true;
- return Promise.resolve();
- };
- return next().then(function () {
- return runTasks(_this7, _this7.postTasks);
- });
- });
- };
- return FrameworkConfiguration;
- }();
- exports.FrameworkConfiguration = FrameworkConfiguration;
- var LogManager = exports.LogManager = TheLogManager;
- });
- define('aurelia-metadata',['exports', 'aurelia-pal'], function (exports, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Origin = exports.metadata = undefined;
- exports.decorators = decorators;
- exports.deprecated = deprecated;
- exports.mixin = mixin;
- exports.protocol = protocol;
- var _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
-
- var metadata = exports.metadata = {
- resource: 'aurelia:resource',
- paramTypes: 'design:paramtypes',
- propertyType: 'design:type',
- properties: 'design:properties',
- get: function get(metadataKey, target, targetKey) {
- if (!target) {
- return undefined;
- }
- var result = metadata.getOwn(metadataKey, target, targetKey);
- return result === undefined ? metadata.get(metadataKey, Object.getPrototypeOf(target), targetKey) : result;
- },
- getOwn: function getOwn(metadataKey, target, targetKey) {
- if (!target) {
- return undefined;
- }
- return Reflect.getOwnMetadata(metadataKey, target, targetKey);
- },
- define: function define(metadataKey, metadataValue, target, targetKey) {
- Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey);
- },
- getOrCreateOwn: function getOrCreateOwn(metadataKey, Type, target, targetKey) {
- var result = metadata.getOwn(metadataKey, target, targetKey);
- if (result === undefined) {
- result = new Type();
- Reflect.defineMetadata(metadataKey, result, target, targetKey);
- }
- return result;
- }
- };
- var originStorage = new Map();
- var unknownOrigin = Object.freeze({ moduleId: undefined, moduleMember: undefined });
- var Origin = exports.Origin = function () {
- function Origin(moduleId, moduleMember) {
-
- this.moduleId = moduleId;
- this.moduleMember = moduleMember;
- }
- Origin.get = function get(fn) {
- var origin = originStorage.get(fn);
- if (origin === undefined) {
- _aureliaPal.PLATFORM.eachModule(function (key, value) {
- for (var name in value) {
- var exp = value[name];
- if (exp === fn) {
- originStorage.set(fn, origin = new Origin(key, name));
- return true;
- }
- }
- if (value === fn) {
- originStorage.set(fn, origin = new Origin(key, 'default'));
- return true;
- }
- return false;
- });
- }
- return origin || unknownOrigin;
- };
- Origin.set = function set(fn, origin) {
- originStorage.set(fn, origin);
- };
- return Origin;
- }();
- function decorators() {
- for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
- rest[_key] = arguments[_key];
- }
- var applicator = function applicator(target, key, descriptor) {
- var i = rest.length;
- if (key) {
- descriptor = descriptor || {
- value: target[key],
- writable: true,
- configurable: true,
- enumerable: true
- };
- while (i--) {
- descriptor = rest[i](target, key, descriptor) || descriptor;
- }
- Object.defineProperty(target, key, descriptor);
- } else {
- while (i--) {
- target = rest[i](target) || target;
- }
- }
- return target;
- };
- applicator.on = applicator;
- return applicator;
- }
- function deprecated(optionsOrTarget, maybeKey, maybeDescriptor) {
- function decorator(target, key, descriptor) {
- var methodSignature = target.constructor.name + '#' + key;
- var options = maybeKey ? {} : optionsOrTarget || {};
- var message = 'DEPRECATION - ' + methodSignature;
- if (typeof descriptor.value !== 'function') {
- throw new SyntaxError('Only methods can be marked as deprecated.');
- }
- if (options.message) {
- message += ' - ' + options.message;
- }
- return _extends({}, descriptor, {
- value: function deprecationWrapper() {
- if (options.error) {
- throw new Error(message);
- } else {
- console.warn(message);
- }
- return descriptor.value.apply(this, arguments);
- }
- });
- }
- return maybeKey ? decorator(optionsOrTarget, maybeKey, maybeDescriptor) : decorator;
- }
- function mixin(behavior) {
- var instanceKeys = Object.keys(behavior);
- function _mixin(possible) {
- var decorator = function decorator(target) {
- var resolvedTarget = typeof target === 'function' ? target.prototype : target;
- var i = instanceKeys.length;
- while (i--) {
- var property = instanceKeys[i];
- Object.defineProperty(resolvedTarget, property, {
- value: behavior[property],
- writable: true
- });
- }
- };
- return possible ? decorator(possible) : decorator;
- }
- return _mixin;
- }
- function alwaysValid() {
- return true;
- }
- function noCompose() {}
- function ensureProtocolOptions(options) {
- if (options === undefined) {
- options = {};
- } else if (typeof options === 'function') {
- options = {
- validate: options
- };
- }
- if (!options.validate) {
- options.validate = alwaysValid;
- }
- if (!options.compose) {
- options.compose = noCompose;
- }
- return options;
- }
- function createProtocolValidator(validate) {
- return function (target) {
- var result = validate(target);
- return result === true;
- };
- }
- function createProtocolAsserter(name, validate) {
- return function (target) {
- var result = validate(target);
- if (result !== true) {
- throw new Error(result || name + ' was not correctly implemented.');
- }
- };
- }
- function protocol(name, options) {
- options = ensureProtocolOptions(options);
- var result = function result(target) {
- var resolvedTarget = typeof target === 'function' ? target.prototype : target;
- options.compose(resolvedTarget);
- result.assert(resolvedTarget);
- Object.defineProperty(resolvedTarget, 'protocol:' + name, {
- enumerable: false,
- configurable: false,
- writable: false,
- value: true
- });
- };
- result.validate = createProtocolValidator(options.validate);
- result.assert = createProtocolAsserter(name, options.validate);
- return result;
- }
- protocol.create = function (name, options) {
- options = ensureProtocolOptions(options);
- var hidden = 'protocol:' + name;
- var result = function result(target) {
- var decorator = protocol(name, options);
- return target ? decorator(target) : decorator;
- };
- result.decorates = function (obj) {
- return obj[hidden] === true;
- };
- result.validate = createProtocolValidator(options.validate);
- result.assert = createProtocolAsserter(name, options.validate);
- return result;
- };
- });
- define('aurelia-pal',['exports'], function (exports) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.AggregateError = AggregateError;
- exports.initializePAL = initializePAL;
- function AggregateError(message, innerError, skipIfAlreadyAggregate) {
- if (innerError) {
- if (innerError.innerError && skipIfAlreadyAggregate) {
- return innerError;
- }
- var separator = '\n------------------------------------------------\n';
- message += separator + 'Inner Error:\n';
- if (typeof innerError === 'string') {
- message += 'Message: ' + innerError;
- } else {
- if (innerError.message) {
- message += 'Message: ' + innerError.message;
- } else {
- message += 'Unknown Inner Error Type. Displaying Inner Error as JSON:\n ' + JSON.stringify(innerError, null, ' ');
- }
- if (innerError.stack) {
- message += '\nInner Error Stack:\n' + innerError.stack;
- message += '\nEnd Inner Error Stack';
- }
- }
- message += separator;
- }
- var e = new Error(message);
- if (innerError) {
- e.innerError = innerError;
- }
- return e;
- }
- var FEATURE = exports.FEATURE = {};
- var PLATFORM = exports.PLATFORM = {
- noop: function noop() {},
- eachModule: function eachModule() {}
- };
- PLATFORM.global = function () {
- if (typeof self !== 'undefined') {
- return self;
- }
- if (typeof global !== 'undefined') {
- return global;
- }
- return new Function('return this')();
- }();
- var DOM = exports.DOM = {};
- function initializePAL(callback) {
- if (typeof Object.getPropertyDescriptor !== 'function') {
- Object.getPropertyDescriptor = function (subject, name) {
- var pd = Object.getOwnPropertyDescriptor(subject, name);
- var proto = Object.getPrototypeOf(subject);
- while (typeof pd === 'undefined' && proto !== null) {
- pd = Object.getOwnPropertyDescriptor(proto, name);
- proto = Object.getPrototypeOf(proto);
- }
- return pd;
- };
- }
- callback(PLATFORM, FEATURE, DOM);
- }
- });
- define('aurelia-history-browser',['exports', 'aurelia-pal', 'aurelia-history'], function (exports, _aureliaPal, _aureliaHistory) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BrowserHistory = exports.DefaultLinkHandler = exports.LinkHandler = undefined;
- exports.configure = configure;
- var _class, _temp;
- function _possibleConstructorReturn(self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
- }
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
- }
-
- var LinkHandler = exports.LinkHandler = function () {
- function LinkHandler() {
-
- }
- LinkHandler.prototype.activate = function activate(history) {};
- LinkHandler.prototype.deactivate = function deactivate() {};
- return LinkHandler;
- }();
- var DefaultLinkHandler = exports.DefaultLinkHandler = function (_LinkHandler) {
- _inherits(DefaultLinkHandler, _LinkHandler);
- function DefaultLinkHandler() {
-
- var _this = _possibleConstructorReturn(this, _LinkHandler.call(this));
- _this.handler = function (e) {
- var _DefaultLinkHandler$g = DefaultLinkHandler.getEventInfo(e);
- var shouldHandleEvent = _DefaultLinkHandler$g.shouldHandleEvent;
- var href = _DefaultLinkHandler$g.href;
- if (shouldHandleEvent) {
- e.preventDefault();
- _this.history.navigate(href);
- }
- };
- return _this;
- }
- DefaultLinkHandler.prototype.activate = function activate(history) {
- if (history._hasPushState) {
- this.history = history;
- _aureliaPal.DOM.addEventListener('click', this.handler, true);
- }
- };
- DefaultLinkHandler.prototype.deactivate = function deactivate() {
- _aureliaPal.DOM.removeEventListener('click', this.handler);
- };
- DefaultLinkHandler.getEventInfo = function getEventInfo(event) {
- var info = {
- shouldHandleEvent: false,
- href: null,
- anchor: null
- };
- var target = DefaultLinkHandler.findClosestAnchor(event.target);
- if (!target || !DefaultLinkHandler.targetIsThisWindow(target)) {
- return info;
- }
- if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
- return info;
- }
- var href = target.getAttribute('href');
- info.anchor = target;
- info.href = href;
- var leftButtonClicked = event.which === 1;
- var isRelative = href && !(href.charAt(0) === '#' || /^[a-z]+:/i.test(href));
- info.shouldHandleEvent = leftButtonClicked && isRelative;
- return info;
- };
- DefaultLinkHandler.findClosestAnchor = function findClosestAnchor(el) {
- while (el) {
- if (el.tagName === 'A') {
- return el;
- }
- el = el.parentNode;
- }
- };
- DefaultLinkHandler.targetIsThisWindow = function targetIsThisWindow(target) {
- var targetWindow = target.getAttribute('target');
- var win = _aureliaPal.PLATFORM.global;
- return !targetWindow || targetWindow === win.name || targetWindow === '_self' || targetWindow === 'top' && win === win.top;
- };
- return DefaultLinkHandler;
- }(LinkHandler);
- function configure(config) {
- config.singleton(_aureliaHistory.History, BrowserHistory);
- config.transient(LinkHandler, DefaultLinkHandler);
- }
- var BrowserHistory = exports.BrowserHistory = (_temp = _class = function (_History) {
- _inherits(BrowserHistory, _History);
- function BrowserHistory(linkHandler) {
-
- var _this2 = _possibleConstructorReturn(this, _History.call(this));
- _this2._isActive = false;
- _this2._checkUrlCallback = _this2._checkUrl.bind(_this2);
- _this2.location = _aureliaPal.PLATFORM.location;
- _this2.history = _aureliaPal.PLATFORM.history;
- _this2.linkHandler = linkHandler;
- return _this2;
- }
- BrowserHistory.prototype.activate = function activate(options) {
- if (this._isActive) {
- throw new Error('History has already been activated.');
- }
- var wantsPushState = !!options.pushState;
- this._isActive = true;
- this.options = Object.assign({}, { root: '/' }, this.options, options);
- this.root = ('/' + this.options.root + '/').replace(rootStripper, '/');
- this._wantsHashChange = this.options.hashChange !== false;
- this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState);
- var eventName = void 0;
- if (this._hasPushState) {
- eventName = 'popstate';
- } else if (this._wantsHashChange) {
- eventName = 'hashchange';
- }
- _aureliaPal.PLATFORM.addEventListener(eventName, this._checkUrlCallback);
- if (this._wantsHashChange && wantsPushState) {
- var loc = this.location;
- var atRoot = loc.pathname.replace(/[^\/]$/, '$&/') === this.root;
- if (!this._hasPushState && !atRoot) {
- this.fragment = this._getFragment(null, true);
- this.location.replace(this.root + this.location.search + '#' + this.fragment);
- return true;
- } else if (this._hasPushState && atRoot && loc.hash) {
- this.fragment = this._getHash().replace(routeStripper, '');
- this.history.replaceState({}, _aureliaPal.DOM.title, this.root + this.fragment + loc.search);
- }
- }
- if (!this.fragment) {
- this.fragment = this._getFragment();
- }
- this.linkHandler.activate(this);
- if (!this.options.silent) {
- return this._loadUrl();
- }
- };
- BrowserHistory.prototype.deactivate = function deactivate() {
- _aureliaPal.PLATFORM.removeEventListener('popstate', this._checkUrlCallback);
- _aureliaPal.PLATFORM.removeEventListener('hashchange', this._checkUrlCallback);
- this._isActive = false;
- this.linkHandler.deactivate();
- };
- BrowserHistory.prototype.getAbsoluteRoot = function getAbsoluteRoot() {
- var origin = createOrigin(this.location.protocol, this.location.hostname, this.location.port);
- return '' + origin + this.root;
- };
- BrowserHistory.prototype.navigate = function navigate(fragment) {
- var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
- var _ref$trigger = _ref.trigger;
- var trigger = _ref$trigger === undefined ? true : _ref$trigger;
- var _ref$replace = _ref.replace;
- var replace = _ref$replace === undefined ? false : _ref$replace;
- if (fragment && absoluteUrl.test(fragment)) {
- this.location.href = fragment;
- return true;
- }
- if (!this._isActive) {
- return false;
- }
- fragment = this._getFragment(fragment || '');
- if (this.fragment === fragment && !replace) {
- return false;
- }
- this.fragment = fragment;
- var url = this.root + fragment;
- if (fragment === '' && url !== '/') {
- url = url.slice(0, -1);
- }
- if (this._hasPushState) {
- url = url.replace('//', '/');
- this.history[replace ? 'replaceState' : 'pushState']({}, _aureliaPal.DOM.title, url);
- } else if (this._wantsHashChange) {
- updateHash(this.location, fragment, replace);
- } else {
- return this.location.assign(url);
- }
- if (trigger) {
- return this._loadUrl(fragment);
- }
- };
- BrowserHistory.prototype.navigateBack = function navigateBack() {
- this.history.back();
- };
- BrowserHistory.prototype.setTitle = function setTitle(title) {
- _aureliaPal.DOM.title = title;
- };
- BrowserHistory.prototype._getHash = function _getHash() {
- return this.location.hash.substr(1);
- };
- BrowserHistory.prototype._getFragment = function _getFragment(fragment, forcePushState) {
- var root = void 0;
- if (!fragment) {
- if (this._hasPushState || !this._wantsHashChange || forcePushState) {
- fragment = this.location.pathname + this.location.search;
- root = this.root.replace(trailingSlash, '');
- if (!fragment.indexOf(root)) {
- fragment = fragment.substr(root.length);
- }
- } else {
- fragment = this._getHash();
- }
- }
- return '/' + fragment.replace(routeStripper, '');
- };
- BrowserHistory.prototype._checkUrl = function _checkUrl() {
- var current = this._getFragment();
- if (current !== this.fragment) {
- this._loadUrl();
- }
- };
- BrowserHistory.prototype._loadUrl = function _loadUrl(fragmentOverride) {
- var fragment = this.fragment = this._getFragment(fragmentOverride);
- return this.options.routeHandler ? this.options.routeHandler(fragment) : false;
- };
- return BrowserHistory;
- }(_aureliaHistory.History), _class.inject = [LinkHandler], _temp);
- var routeStripper = /^#?\/*|\s+$/g;
- var rootStripper = /^\/+|\/+$/g;
- var trailingSlash = /\/$/;
- var absoluteUrl = /^([a-z][a-z0-9+\-.]*:)?\/\//i;
- function updateHash(location, fragment, replace) {
- if (replace) {
- var _href = location.href.replace(/(javascript:|#).*$/, '');
- location.replace(_href + '#' + fragment);
- } else {
- location.hash = '#' + fragment;
- }
- }
- function createOrigin(protocol, hostname, port) {
- return protocol + '//' + hostname + (port ? ':' + port : '');
- }
- });
- define('aurelia-history',['exports'], function (exports) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- function mi(name) {
- throw new Error('History must implement ' + name + '().');
- }
- var History = exports.History = function () {
- function History() {
-
- }
- History.prototype.activate = function activate(options) {
- mi('activate');
- };
- History.prototype.deactivate = function deactivate() {
- mi('deactivate');
- };
- History.prototype.getAbsoluteRoot = function getAbsoluteRoot() {
- mi('getAbsoluteRoot');
- };
- History.prototype.navigate = function navigate(fragment, options) {
- mi('navigate');
- };
- History.prototype.navigateBack = function navigateBack() {
- mi('navigateBack');
- };
- History.prototype.setTitle = function setTitle(title) {
- mi('setTitle');
- };
- return History;
- }();
- });
- define('aurelia-loader',['exports', 'aurelia-path', 'aurelia-metadata'], function (exports, _aureliaPath, _aureliaMetadata) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Loader = exports.TemplateRegistryEntry = exports.TemplateDependency = undefined;
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
-
- var TemplateDependency = exports.TemplateDependency = function TemplateDependency(src, name) {
-
- this.src = src;
- this.name = name;
- };
- var TemplateRegistryEntry = exports.TemplateRegistryEntry = function () {
- function TemplateRegistryEntry(address) {
-
- this.templateIsLoaded = false;
- this.factoryIsReady = false;
- this.resources = null;
- this.dependencies = null;
- this.address = address;
- this.onReady = null;
- this._template = null;
- this._factory = null;
- }
- TemplateRegistryEntry.prototype.addDependency = function addDependency(src, name) {
- var finalSrc = typeof src === 'string' ? (0, _aureliaPath.relativeToFile)(src, this.address) : _aureliaMetadata.Origin.get(src).moduleId;
- this.dependencies.push(new TemplateDependency(finalSrc, name));
- };
- _createClass(TemplateRegistryEntry, [{
- key: 'template',
- get: function get() {
- return this._template;
- },
- set: function set(value) {
- var address = this.address;
- var requires = void 0;
- var current = void 0;
- var src = void 0;
- var dependencies = void 0;
- this._template = value;
- this.templateIsLoaded = true;
- requires = value.content.querySelectorAll('require');
- dependencies = this.dependencies = new Array(requires.length);
- for (var i = 0, ii = requires.length; i < ii; ++i) {
- current = requires[i];
- src = current.getAttribute('from');
- if (!src) {
- throw new Error('<require> element in ' + address + ' has no "from" attribute.');
- }
- dependencies[i] = new TemplateDependency((0, _aureliaPath.relativeToFile)(src, address), current.getAttribute('as'));
- if (current.parentNode) {
- current.parentNode.removeChild(current);
- }
- }
- }
- }, {
- key: 'factory',
- get: function get() {
- return this._factory;
- },
- set: function set(value) {
- this._factory = value;
- this.factoryIsReady = true;
- }
- }]);
- return TemplateRegistryEntry;
- }();
- var Loader = exports.Loader = function () {
- function Loader() {
-
- this.templateRegistry = {};
- }
- Loader.prototype.map = function map(id, source) {
- throw new Error('Loaders must implement map(id, source).');
- };
- Loader.prototype.normalizeSync = function normalizeSync(moduleId, relativeTo) {
- throw new Error('Loaders must implement normalizeSync(moduleId, relativeTo).');
- };
- Loader.prototype.normalize = function normalize(moduleId, relativeTo) {
- throw new Error('Loaders must implement normalize(moduleId: string, relativeTo: string): Promise<string>.');
- };
- Loader.prototype.loadModule = function loadModule(id) {
- throw new Error('Loaders must implement loadModule(id).');
- };
- Loader.prototype.loadAllModules = function loadAllModules(ids) {
- throw new Error('Loader must implement loadAllModules(ids).');
- };
- Loader.prototype.loadTemplate = function loadTemplate(url) {
- throw new Error('Loader must implement loadTemplate(url).');
- };
- Loader.prototype.loadText = function loadText(url) {
- throw new Error('Loader must implement loadText(url).');
- };
- Loader.prototype.applyPluginToUrl = function applyPluginToUrl(url, pluginName) {
- throw new Error('Loader must implement applyPluginToUrl(url, pluginName).');
- };
- Loader.prototype.addPlugin = function addPlugin(pluginName, implementation) {
- throw new Error('Loader must implement addPlugin(pluginName, implementation).');
- };
- Loader.prototype.getOrCreateTemplateRegistryEntry = function getOrCreateTemplateRegistryEntry(address) {
- return this.templateRegistry[address] || (this.templateRegistry[address] = new TemplateRegistryEntry(address));
- };
- return Loader;
- }();
- });
- define('aurelia-polyfills',['aurelia-pal'], function (_aureliaPal) {
- 'use strict';
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
- };
- (function (Object, GOPS) {
- 'use strict';
- if (GOPS in Object) return;
- var setDescriptor,
- G = _aureliaPal.PLATFORM.global,
- id = 0,
- random = '' + Math.random(),
- prefix = '__\x01symbol:',
- prefixLength = prefix.length,
- internalSymbol = '__\x01symbol@@' + random,
- DP = 'defineProperty',
- DPies = 'defineProperties',
- GOPN = 'getOwnPropertyNames',
- GOPD = 'getOwnPropertyDescriptor',
- PIE = 'propertyIsEnumerable',
- gOPN = Object[GOPN],
- gOPD = Object[GOPD],
- create = Object.create,
- keys = Object.keys,
- defineProperty = Object[DP],
- $defineProperties = Object[DPies],
- descriptor = gOPD(Object, GOPN),
- ObjectProto = Object.prototype,
- hOP = ObjectProto.hasOwnProperty,
- pIE = ObjectProto[PIE],
- toString = ObjectProto.toString,
- indexOf = Array.prototype.indexOf || function (v) {
- for (var i = this.length; i-- && this[i] !== v;) {}
- return i;
- },
- addInternalIfNeeded = function addInternalIfNeeded(o, uid, enumerable) {
- if (!hOP.call(o, internalSymbol)) {
- defineProperty(o, internalSymbol, {
- enumerable: false,
- configurable: false,
- writable: false,
- value: {}
- });
- }
- o[internalSymbol]['@@' + uid] = enumerable;
- },
- createWithSymbols = function createWithSymbols(proto, descriptors) {
- var self = create(proto);
- gOPN(descriptors).forEach(function (key) {
- if (propertyIsEnumerable.call(descriptors, key)) {
- $defineProperty(self, key, descriptors[key]);
- }
- });
- return self;
- },
- copyAsNonEnumerable = function copyAsNonEnumerable(descriptor) {
- var newDescriptor = create(descriptor);
- newDescriptor.enumerable = false;
- return newDescriptor;
- },
- get = function get() {},
- onlyNonSymbols = function onlyNonSymbols(name) {
- return name != internalSymbol && !hOP.call(source, name);
- },
- onlySymbols = function onlySymbols(name) {
- return name != internalSymbol && hOP.call(source, name);
- },
- propertyIsEnumerable = function propertyIsEnumerable(key) {
- var uid = '' + key;
- return onlySymbols(uid) ? hOP.call(this, uid) && this[internalSymbol]['@@' + uid] : pIE.call(this, key);
- },
- setAndGetSymbol = function setAndGetSymbol(uid) {
- var descriptor = {
- enumerable: false,
- configurable: true,
- get: get,
- set: function set(value) {
- setDescriptor(this, uid, {
- enumerable: false,
- configurable: true,
- writable: true,
- value: value
- });
- addInternalIfNeeded(this, uid, true);
- }
- };
- defineProperty(ObjectProto, uid, descriptor);
- return source[uid] = defineProperty(Object(uid), 'constructor', sourceConstructor);
- },
- _Symbol = function _Symbol2(description) {
- if (this && this !== G) {
- throw new TypeError('Symbol is not a constructor');
- }
- return setAndGetSymbol(prefix.concat(description || '', random, ++id));
- },
- source = create(null),
- sourceConstructor = { value: _Symbol },
- sourceMap = function sourceMap(uid) {
- return source[uid];
- },
- $defineProperty = function defineProp(o, key, descriptor) {
- var uid = '' + key;
- if (onlySymbols(uid)) {
- setDescriptor(o, uid, descriptor.enumerable ? copyAsNonEnumerable(descriptor) : descriptor);
- addInternalIfNeeded(o, uid, !!descriptor.enumerable);
- } else {
- defineProperty(o, key, descriptor);
- }
- return o;
- },
- $getOwnPropertySymbols = function getOwnPropertySymbols(o) {
- var cof = toString.call(o);
- o = cof === '[object String]' ? o.split('') : Object(o);
- return gOPN(o).filter(onlySymbols).map(sourceMap);
- };
- descriptor.value = $defineProperty;
- defineProperty(Object, DP, descriptor);
- descriptor.value = $getOwnPropertySymbols;
- defineProperty(Object, GOPS, descriptor);
- descriptor.value = function getOwnPropertyNames(o) {
- return gOPN(o).filter(onlyNonSymbols);
- };
- defineProperty(Object, GOPN, descriptor);
- descriptor.value = function defineProperties(o, descriptors) {
- var symbols = $getOwnPropertySymbols(descriptors);
- if (symbols.length) {
- keys(descriptors).concat(symbols).forEach(function (uid) {
- if (propertyIsEnumerable.call(descriptors, uid)) {
- $defineProperty(o, uid, descriptors[uid]);
- }
- });
- } else {
- $defineProperties(o, descriptors);
- }
- return o;
- };
- defineProperty(Object, DPies, descriptor);
- descriptor.value = propertyIsEnumerable;
- defineProperty(ObjectProto, PIE, descriptor);
- descriptor.value = _Symbol;
- defineProperty(G, 'Symbol', descriptor);
- descriptor.value = function (key) {
- var uid = prefix.concat(prefix, key, random);
- return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid);
- };
- defineProperty(_Symbol, 'for', descriptor);
- descriptor.value = function (symbol) {
- return hOP.call(source, symbol) ? symbol.slice(prefixLength * 2, -random.length) : void 0;
- };
- defineProperty(_Symbol, 'keyFor', descriptor);
- descriptor.value = function getOwnPropertyDescriptor(o, key) {
- var descriptor = gOPD(o, key);
- if (descriptor && onlySymbols(key)) {
- descriptor.enumerable = propertyIsEnumerable.call(o, key);
- }
- return descriptor;
- };
- defineProperty(Object, GOPD, descriptor);
- descriptor.value = function (proto, descriptors) {
- return arguments.length === 1 ? create(proto) : createWithSymbols(proto, descriptors);
- };
- defineProperty(Object, 'create', descriptor);
- descriptor.value = function () {
- var str = toString.call(this);
- return str === '[object String]' && onlySymbols(this) ? '[object Symbol]' : str;
- };
- defineProperty(ObjectProto, 'toString', descriptor);
- try {
- setDescriptor = create(defineProperty({}, prefix, {
- get: function get() {
- return defineProperty(this, prefix, { value: false })[prefix];
- }
- }))[prefix] || defineProperty;
- } catch (o_O) {
- setDescriptor = function setDescriptor(o, key, descriptor) {
- var protoDescriptor = gOPD(ObjectProto, key);
- delete ObjectProto[key];
- defineProperty(o, key, descriptor);
- defineProperty(ObjectProto, key, protoDescriptor);
- };
- }
- })(Object, 'getOwnPropertySymbols');
- (function (O, S) {
- var dP = O.defineProperty,
- ObjectProto = O.prototype,
- toString = ObjectProto.toString,
- toStringTag = 'toStringTag',
- descriptor;
- ['iterator', 'match', 'replace', 'search', 'split', 'hasInstance', 'isConcatSpreadable', 'unscopables', 'species', 'toPrimitive', toStringTag].forEach(function (name) {
- if (!(name in Symbol)) {
- dP(Symbol, name, { value: Symbol(name) });
- switch (name) {
- case toStringTag:
- descriptor = O.getOwnPropertyDescriptor(ObjectProto, 'toString');
- descriptor.value = function () {
- var str = toString.call(this),
- tst = typeof this === 'undefined' || this === null ? undefined : this[Symbol.toStringTag];
- return typeof tst === 'undefined' ? str : '[object ' + tst + ']';
- };
- dP(ObjectProto, 'toString', descriptor);
- break;
- }
- }
- });
- })(Object, Symbol);
- (function (Si, AP, SP) {
- function returnThis() {
- return this;
- }
- if (!AP[Si]) AP[Si] = function () {
- var i = 0,
- self = this,
- iterator = {
- next: function next() {
- var done = self.length <= i;
- return done ? { done: done } : { done: done, value: self[i++] };
- }
- };
- iterator[Si] = returnThis;
- return iterator;
- };
- if (!SP[Si]) SP[Si] = function () {
- var fromCodePoint = String.fromCodePoint,
- self = this,
- i = 0,
- length = self.length,
- iterator = {
- next: function next() {
- var done = length <= i,
- c = done ? '' : fromCodePoint(self.codePointAt(i));
- i += c.length;
- return done ? { done: done } : { done: done, value: c };
- }
- };
- iterator[Si] = returnThis;
- return iterator;
- };
- })(Symbol.iterator, Array.prototype, String.prototype);
- Number.isNaN = Number.isNaN || function (value) {
- return value !== value;
- };
- Number.isFinite = Number.isFinite || function (value) {
- return typeof value === "number" && isFinite(value);
- };
- if (!String.prototype.endsWith || function () {
- try {
- return !"ab".endsWith("a", 1);
- } catch (e) {
- return true;
- }
- }()) {
- String.prototype.endsWith = function (searchString, position) {
- var subjectString = this.toString();
- if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
- position = subjectString.length;
- }
- position -= searchString.length;
- var lastIndex = subjectString.indexOf(searchString, position);
- return lastIndex !== -1 && lastIndex === position;
- };
- }
- if (!String.prototype.startsWith || function () {
- try {
- return !"ab".startsWith("b", 1);
- } catch (e) {
- return true;
- }
- }()) {
- String.prototype.startsWith = function (searchString, position) {
- position = position || 0;
- return this.substr(position, searchString.length) === searchString;
- };
- }
- if (!Array.from) {
- Array.from = function () {
- var toInteger = function toInteger(it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? Math.floor : Math.ceil)(it);
- };
- var toLength = function toLength(it) {
- return it > 0 ? Math.min(toInteger(it), 0x1fffffffffffff) : 0;
- };
- var iterCall = function iterCall(iter, fn, a1, a2) {
- try {
- fn(a1, a2);
- } catch (E) {
- if (typeof iter.return == 'function') iter.return();
- throw E;
- }
- };
- return function from(arrayLike) {
- var O = Object(arrayLike),
- C = typeof this == 'function' ? this : Array,
- aLen = arguments.length,
- mapfn = aLen > 1 ? arguments[1] : undefined,
- mapping = mapfn !== undefined,
- index = 0,
- iterFn = O[Symbol.iterator],
- length,
- result,
- step,
- iterator;
- if (mapping) mapfn = mapfn.bind(aLen > 2 ? arguments[2] : undefined);
- if (iterFn != undefined && !Array.isArray(arrayLike)) {
- for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
- result[index] = mapping ? iterCall(mapfn, step.value, index) : step.value;
- }
- } else {
- length = toLength(O.length);
- for (result = new C(length); length > index; index++) {
- result[index] = mapping ? mapfn(O[index], index) : O[index];
- }
- }
- result.length = index;
- return result;
- };
- }();
- }
- if (!Array.prototype.find) {
- Object.defineProperty(Array.prototype, 'find', {
- configurable: true,
- writable: true,
- enumerable: false,
- value: function value(predicate) {
- if (this === null) {
- throw new TypeError('Array.prototype.find called on null or undefined');
- }
- if (typeof predicate !== 'function') {
- throw new TypeError('predicate must be a function');
- }
- var list = Object(this);
- var length = list.length >>> 0;
- var thisArg = arguments[1];
- var value;
- for (var i = 0; i < length; i++) {
- value = list[i];
- if (predicate.call(thisArg, value, i, list)) {
- return value;
- }
- }
- return undefined;
- }
- });
- }
- if (!Array.prototype.findIndex) {
- Object.defineProperty(Array.prototype, 'findIndex', {
- configurable: true,
- writable: true,
- enumerable: false,
- value: function value(predicate) {
- if (this === null) {
- throw new TypeError('Array.prototype.findIndex called on null or undefined');
- }
- if (typeof predicate !== 'function') {
- throw new TypeError('predicate must be a function');
- }
- var list = Object(this);
- var length = list.length >>> 0;
- var thisArg = arguments[1];
- var value;
- for (var i = 0; i < length; i++) {
- value = list[i];
- if (predicate.call(thisArg, value, i, list)) {
- return i;
- }
- }
- return -1;
- }
- });
- }
- if (!Array.prototype.includes) {
- Object.defineProperty(Array.prototype, 'includes', {
- configurable: true,
- writable: true,
- enumerable: false,
- value: function value(searchElement) {
- var O = Object(this);
- var len = parseInt(O.length) || 0;
- if (len === 0) {
- return false;
- }
- var n = parseInt(arguments[1]) || 0;
- var k;
- if (n >= 0) {
- k = n;
- } else {
- k = len + n;
- if (k < 0) {
- k = 0;
- }
- }
- var currentElement;
- while (k < len) {
- currentElement = O[k];
- if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) {
- return true;
- }
- k++;
- }
- return false;
- }
- });
- }
- (function () {
- var needsFix = false;
- try {
- var s = Object.keys('a');
- needsFix = s.length !== 1 || s[0] !== '0';
- } catch (e) {
- needsFix = true;
- }
- if (needsFix) {
- 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 (obj === undefined || obj === null) {
- throw TypeError('Cannot convert undefined or null to object');
- }
- obj = Object(obj);
- 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;
- };
- }();
- }
- })();
- (function (O) {
- if ('assign' in O) {
- return;
- }
- O.defineProperty(O, 'assign', {
- configurable: true,
- writable: true,
- value: function () {
- var gOPS = O.getOwnPropertySymbols,
- pIE = O.propertyIsEnumerable,
- filterOS = gOPS ? function (self) {
- return gOPS(self).filter(pIE, self);
- } : function () {
- return Array.prototype;
- };
- return function assign(where) {
- if (gOPS && !(where instanceof O)) {
- console.warn('problematic Symbols', where);
- }
- function set(keyOrSymbol) {
- where[keyOrSymbol] = arg[keyOrSymbol];
- }
- for (var i = 1, ii = arguments.length; i < ii; ++i) {
- var arg = arguments[i];
- if (arg === null || arg === undefined) {
- continue;
- }
- O.keys(arg).concat(filterOS(arg)).forEach(set);
- }
- return where;
- };
- }()
- });
- })(Object);
- (function (global) {
- var i;
- var defineProperty = Object.defineProperty,
- is = function is(a, b) {
- return a === b || a !== a && b !== b;
- };
- if (typeof WeakMap == 'undefined') {
- global.WeakMap = createCollection({
- 'delete': sharedDelete,
- clear: sharedClear,
- get: sharedGet,
- has: mapHas,
- set: sharedSet
- }, true);
- }
- if (typeof Map == 'undefined' || typeof new Map().values !== 'function' || !new Map().values().next) {
- var _createCollection;
- global.Map = createCollection((_createCollection = {
- 'delete': sharedDelete,
- has: mapHas,
- get: sharedGet,
- set: sharedSet,
- keys: sharedKeys,
- values: sharedValues,
- entries: mapEntries,
- forEach: sharedForEach,
- clear: sharedClear
- }, _createCollection[Symbol.iterator] = mapEntries, _createCollection));
- }
- if (typeof Set == 'undefined' || typeof new Set().values !== 'function' || !new Set().values().next) {
- var _createCollection2;
- global.Set = createCollection((_createCollection2 = {
- has: setHas,
- add: sharedAdd,
- 'delete': sharedDelete,
- clear: sharedClear,
- keys: sharedValues,
- values: sharedValues,
- entries: setEntries,
- forEach: sharedForEach
- }, _createCollection2[Symbol.iterator] = sharedValues, _createCollection2));
- }
- if (typeof WeakSet == 'undefined') {
- global.WeakSet = createCollection({
- 'delete': sharedDelete,
- add: sharedAdd,
- clear: sharedClear,
- has: setHas
- }, true);
- }
- function createCollection(proto, objectOnly) {
- function Collection(a) {
- if (!this || this.constructor !== Collection) return new Collection(a);
- this._keys = [];
- this._values = [];
- this._itp = [];
- this.objectOnly = objectOnly;
- if (a) init.call(this, a);
- }
- if (!objectOnly) {
- defineProperty(proto, 'size', {
- get: sharedSize
- });
- }
- proto.constructor = Collection;
- Collection.prototype = proto;
- return Collection;
- }
- function init(a) {
- var i;
- if (this.add) a.forEach(this.add, this);else a.forEach(function (a) {
- this.set(a[0], a[1]);
- }, this);
- }
- function sharedDelete(key) {
- if (this.has(key)) {
- this._keys.splice(i, 1);
- this._values.splice(i, 1);
- this._itp.forEach(function (p) {
- if (i < p[0]) p[0]--;
- });
- }
- return -1 < i;
- };
- function sharedGet(key) {
- return this.has(key) ? this._values[i] : undefined;
- }
- function has(list, key) {
- if (this.objectOnly && key !== Object(key)) throw new TypeError("Invalid value used as weak collection key");
- if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);) {} else i = list.indexOf(key);
- return -1 < i;
- }
- function setHas(value) {
- return has.call(this, this._values, value);
- }
- function mapHas(value) {
- return has.call(this, this._keys, value);
- }
- function sharedSet(key, value) {
- this.has(key) ? this._values[i] = value : this._values[this._keys.push(key) - 1] = value;
- return this;
- }
- function sharedAdd(value) {
- if (!this.has(value)) this._values.push(value);
- return this;
- }
- function sharedClear() {
- (this._keys || 0).length = this._values.length = 0;
- }
- function sharedKeys() {
- return sharedIterator(this._itp, this._keys);
- }
- function sharedValues() {
- return sharedIterator(this._itp, this._values);
- }
- function mapEntries() {
- return sharedIterator(this._itp, this._keys, this._values);
- }
- function setEntries() {
- return sharedIterator(this._itp, this._values, this._values);
- }
- function sharedIterator(itp, array, array2) {
- var _ref;
- var p = [0],
- done = false;
- itp.push(p);
- return _ref = {}, _ref[Symbol.iterator] = function () {
- return this;
- }, _ref.next = function next() {
- var v,
- k = p[0];
- if (!done && k < array.length) {
- v = array2 ? [array[k], array2[k]] : array[k];
- p[0]++;
- } else {
- done = true;
- itp.splice(itp.indexOf(p), 1);
- }
- return { done: done, value: v };
- }, _ref;
- }
- function sharedSize() {
- return this._values.length;
- }
- function sharedForEach(callback, context) {
- var it = this.entries();
- for (;;) {
- var r = it.next();
- if (r.done) break;
- callback.call(context, r.value[1], r.value[0], this);
- }
- }
- })(_aureliaPal.PLATFORM.global);
- var emptyMetadata = Object.freeze({});
- var metadataContainerKey = '__metadata__';
- var bind = Function.prototype.bind;
- if (typeof _aureliaPal.PLATFORM.global.Reflect === 'undefined') {
- _aureliaPal.PLATFORM.global.Reflect = {};
- }
- if (typeof Reflect.getOwnMetadata !== 'function') {
- Reflect.getOwnMetadata = function (metadataKey, target, targetKey) {
- if (target.hasOwnProperty(metadataContainerKey)) {
- return (target[metadataContainerKey][targetKey] || emptyMetadata)[metadataKey];
- }
- };
- }
- if (typeof Reflect.defineMetadata !== 'function') {
- Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) {
- var metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {};
- var targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {});
- targetContainer[metadataKey] = metadataValue;
- };
- }
- if (typeof Reflect.metadata !== 'function') {
- Reflect.metadata = function (metadataKey, metadataValue) {
- return function (target, targetKey) {
- Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey);
- };
- };
- }
- if (typeof Reflect.defineProperty !== 'function') {
- Reflect.defineProperty = function (target, propertyKey, descriptor) {
- if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' ? target === null : typeof target !== 'function') {
- throw new TypeError('Reflect.defineProperty called on non-object');
- }
- try {
- Object.defineProperty(target, propertyKey, descriptor);
- return true;
- } catch (e) {
- return false;
- }
- };
- }
- if (typeof Reflect.construct !== 'function') {
- Reflect.construct = function (Target, args) {
- if (args) {
- switch (args.length) {
- case 0:
- return new Target();
- case 1:
- return new Target(args[0]);
- case 2:
- return new Target(args[0], args[1]);
- case 3:
- return new Target(args[0], args[1], args[2]);
- case 4:
- return new Target(args[0], args[1], args[2], args[3]);
- }
- }
- var a = [null];
- a.push.apply(a, args);
- return new (bind.apply(Target, a))();
- };
- }
- if (typeof Reflect.ownKeys !== 'function') {
- Reflect.ownKeys = function (o) {
- return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o));
- };
- }
- });
- define('aurelia-loader-default',['exports', 'aurelia-loader', 'aurelia-pal', 'aurelia-metadata'], function (exports, _aureliaLoader, _aureliaPal, _aureliaMetadata) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.DefaultLoader = exports.TextTemplateLoader = undefined;
- function _possibleConstructorReturn(self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
- }
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
- }
-
- var TextTemplateLoader = exports.TextTemplateLoader = function () {
- function TextTemplateLoader() {
-
- }
- TextTemplateLoader.prototype.loadTemplate = function loadTemplate(loader, entry) {
- return loader.loadText(entry.address).then(function (text) {
- entry.template = _aureliaPal.DOM.createTemplateFromMarkup(text);
- });
- };
- return TextTemplateLoader;
- }();
- function ensureOriginOnExports(executed, name) {
- var target = executed;
- var key = void 0;
- var exportedValue = void 0;
- if (target.__useDefault) {
- target = target['default'];
- }
- _aureliaMetadata.Origin.set(target, new _aureliaMetadata.Origin(name, 'default'));
- for (key in target) {
- exportedValue = target[key];
- if (typeof exportedValue === 'function') {
- _aureliaMetadata.Origin.set(exportedValue, new _aureliaMetadata.Origin(name, key));
- }
- }
- return executed;
- }
- var DefaultLoader = exports.DefaultLoader = function (_Loader) {
- _inherits(DefaultLoader, _Loader);
- function DefaultLoader() {
-
- var _this = _possibleConstructorReturn(this, _Loader.call(this));
- _this.textPluginName = 'text';
- _this.moduleRegistry = Object.create(null);
- _this.useTemplateLoader(new TextTemplateLoader());
- var that = _this;
- _this.addPlugin('template-registry-entry', {
- 'fetch': function fetch(address) {
- var entry = that.getOrCreateTemplateRegistryEntry(address);
- return entry.templateIsLoaded ? entry : that.templateLoader.loadTemplate(that, entry).then(function (x) {
- return entry;
- });
- }
- });
- return _this;
- }
- DefaultLoader.prototype.useTemplateLoader = function useTemplateLoader(templateLoader) {
- this.templateLoader = templateLoader;
- };
- DefaultLoader.prototype.loadAllModules = function loadAllModules(ids) {
- var loads = [];
- for (var i = 0, ii = ids.length; i < ii; ++i) {
- loads.push(this.loadModule(ids[i]));
- }
- return Promise.all(loads);
- };
- DefaultLoader.prototype.loadTemplate = function loadTemplate(url) {
- return this._import(this.applyPluginToUrl(url, 'template-registry-entry'));
- };
- DefaultLoader.prototype.loadText = function loadText(url) {
- return this._import(this.applyPluginToUrl(url, this.textPluginName)).then(function (textOrModule) {
- if (typeof textOrModule === 'string') {
- return textOrModule;
- }
- return textOrModule['default'];
- });
- };
- return DefaultLoader;
- }(_aureliaLoader.Loader);
- _aureliaPal.PLATFORM.Loader = DefaultLoader;
- if (!_aureliaPal.PLATFORM.global.System || !_aureliaPal.PLATFORM.global.System.import) {
- if (_aureliaPal.PLATFORM.global.requirejs && requirejs.s && requirejs.s.contexts && requirejs.s.contexts._ && requirejs.s.contexts._.defined) {
- _aureliaPal.PLATFORM.eachModule = function (callback) {
- var defined = requirejs.s.contexts._.defined;
- for (var key in defined) {
- try {
- if (callback(key, defined[key])) return;
- } catch (e) {}
- }
- };
- } else {
- _aureliaPal.PLATFORM.eachModule = function (callback) {};
- }
- DefaultLoader.prototype._import = function (moduleId) {
- return new Promise(function (resolve, reject) {
- require([moduleId], resolve, reject);
- });
- };
- DefaultLoader.prototype.loadModule = function (id) {
- var _this2 = this;
- var existing = this.moduleRegistry[id];
- if (existing !== undefined) {
- return Promise.resolve(existing);
- }
- return new Promise(function (resolve, reject) {
- require([id], function (m) {
- _this2.moduleRegistry[id] = m;
- resolve(ensureOriginOnExports(m, id));
- }, reject);
- });
- };
- DefaultLoader.prototype.map = function (id, source) {};
- DefaultLoader.prototype.normalize = function (moduleId, relativeTo) {
- return Promise.resolve(moduleId);
- };
- DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) {
- return moduleId;
- };
- DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) {
- return pluginName + '!' + url;
- };
- DefaultLoader.prototype.addPlugin = function (pluginName, implementation) {
- var nonAnonDefine = define;
- nonAnonDefine(pluginName, [], {
- 'load': function load(name, req, onload) {
- var result = implementation.fetch(name);
- Promise.resolve(result).then(onload);
- }
- });
- };
- } else {
- _aureliaPal.PLATFORM.eachModule = function (callback) {
- var modules = System._loader.modules;
- for (var key in modules) {
- try {
- if (callback(key, modules[key].module)) return;
- } catch (e) {}
- }
- };
- System.set('text', System.newModule({
- 'translate': function translate(load) {
- return 'module.exports = "' + load.source.replace(/(["\\])/g, '\\$1').replace(/[\f]/g, '\\f').replace(/[\b]/g, '\\b').replace(/[\n]/g, '\\n').replace(/[\t]/g, '\\t').replace(/[\r]/g, '\\r').replace(/[\u2028]/g, '\\u2028').replace(/[\u2029]/g, '\\u2029') + '";';
- }
- }));
- DefaultLoader.prototype._import = function (moduleId) {
- return System.import(moduleId);
- };
- DefaultLoader.prototype.loadModule = function (id) {
- var _this3 = this;
- return System.normalize(id).then(function (newId) {
- var existing = _this3.moduleRegistry[newId];
- if (existing !== undefined) {
- return Promise.resolve(existing);
- }
- return System.import(newId).then(function (m) {
- _this3.moduleRegistry[newId] = m;
- return ensureOriginOnExports(m, newId);
- });
- });
- };
- DefaultLoader.prototype.map = function (id, source) {
- System.map[id] = source;
- };
- DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) {
- return System.normalizeSync(moduleId, relativeTo);
- };
- DefaultLoader.prototype.normalize = function (moduleId, relativeTo) {
- return System.normalize(moduleId, relativeTo);
- };
- DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) {
- return url + '!' + pluginName;
- };
- DefaultLoader.prototype.addPlugin = function (pluginName, implementation) {
- System.set(pluginName, System.newModule({
- 'fetch': function fetch(load, _fetch) {
- var result = implementation.fetch(load.address);
- return Promise.resolve(result).then(function (x) {
- load.metadata.result = x;
- return '';
- });
- },
- 'instantiate': function instantiate(load) {
- return load.metadata.result;
- }
- }));
- };
- }
- });
- define('aurelia-logging',['exports'], function (exports) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getLogger = getLogger;
- exports.addAppender = addAppender;
- exports.setLevel = setLevel;
-
- var logLevel = exports.logLevel = {
- none: 0,
- error: 1,
- warn: 2,
- info: 3,
- debug: 4
- };
- var loggers = {};
- var currentLevel = logLevel.none;
- var appenders = [];
- var slice = Array.prototype.slice;
- var loggerConstructionKey = {};
- function log(logger, level, args) {
- var i = appenders.length;
- var current = void 0;
- args = slice.call(args);
- args.unshift(logger);
- while (i--) {
- current = appenders[i];
- current[level].apply(current, args);
- }
- }
- function debug() {
- if (currentLevel < 4) {
- return;
- }
- log(this, 'debug', arguments);
- }
- function info() {
- if (currentLevel < 3) {
- return;
- }
- log(this, 'info', arguments);
- }
- function warn() {
- if (currentLevel < 2) {
- return;
- }
- log(this, 'warn', arguments);
- }
- function error() {
- if (currentLevel < 1) {
- return;
- }
- log(this, 'error', arguments);
- }
- function connectLogger(logger) {
- logger.debug = debug;
- logger.info = info;
- logger.warn = warn;
- logger.error = error;
- }
- function createLogger(id) {
- var logger = new Logger(id, loggerConstructionKey);
- if (appenders.length) {
- connectLogger(logger);
- }
- return logger;
- }
- function getLogger(id) {
- return loggers[id] || (loggers[id] = createLogger(id));
- }
- function addAppender(appender) {
- appenders.push(appender);
- if (appenders.length === 1) {
- for (var key in loggers) {
- connectLogger(loggers[key]);
- }
- }
- }
- function setLevel(level) {
- currentLevel = level;
- }
- var Logger = exports.Logger = function () {
- function Logger(id, key) {
-
- if (key !== loggerConstructionKey) {
- throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.');
- }
- this.id = id;
- }
- Logger.prototype.debug = function debug(message) {};
- Logger.prototype.info = function info(message) {};
- Logger.prototype.warn = function warn(message) {};
- Logger.prototype.error = function error(message) {};
- return Logger;
- }();
- });
- define('aurelia-route-recognizer',['exports', 'aurelia-path'], function (exports, _aureliaPath) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.RouteRecognizer = exports.EpsilonSegment = exports.StarSegment = exports.DynamicSegment = exports.StaticSegment = exports.State = undefined;
-
- var State = exports.State = function () {
- function State(charSpec) {
-
- this.charSpec = charSpec;
- this.nextStates = [];
- }
- State.prototype.get = function get(charSpec) {
- for (var _iterator = this.nextStates, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
- var _ref;
- if (_isArray) {
- if (_i >= _iterator.length) break;
- _ref = _iterator[_i++];
- } else {
- _i = _iterator.next();
- if (_i.done) break;
- _ref = _i.value;
- }
- var child = _ref;
- var isEqual = child.charSpec.validChars === charSpec.validChars && child.charSpec.invalidChars === charSpec.invalidChars;
- if (isEqual) {
- return child;
- }
- }
- return undefined;
- };
- State.prototype.put = function put(charSpec) {
- var state = this.get(charSpec);
- if (state) {
- return state;
- }
- state = new State(charSpec);
- this.nextStates.push(state);
- if (charSpec.repeat) {
- state.nextStates.push(state);
- }
- return state;
- };
- State.prototype.match = function match(ch) {
- var nextStates = this.nextStates;
- var results = [];
- for (var i = 0, l = nextStates.length; i < l; i++) {
- var child = nextStates[i];
- var charSpec = child.charSpec;
- if (charSpec.validChars !== undefined) {
- if (charSpec.validChars.indexOf(ch) !== -1) {
- results.push(child);
- }
- } else if (charSpec.invalidChars !== undefined) {
- if (charSpec.invalidChars.indexOf(ch) === -1) {
- results.push(child);
- }
- }
- }
- return results;
- };
- return State;
- }();
- var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
- var escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');
- var StaticSegment = exports.StaticSegment = function () {
- function StaticSegment(string, caseSensitive) {
-
- this.string = string;
- this.caseSensitive = caseSensitive;
- }
- StaticSegment.prototype.eachChar = function eachChar(callback) {
- var s = this.string;
- for (var i = 0, ii = s.length; i < ii; ++i) {
- var ch = s[i];
- callback({ validChars: this.caseSensitive ? ch : ch.toUpperCase() + ch.toLowerCase() });
- }
- };
- StaticSegment.prototype.regex = function regex() {
- return this.string.replace(escapeRegex, '\\$1');
- };
- StaticSegment.prototype.generate = function generate() {
- return this.string;
- };
- return StaticSegment;
- }();
- var DynamicSegment = exports.DynamicSegment = function () {
- function DynamicSegment(name) {
-
- this.name = name;
- }
- DynamicSegment.prototype.eachChar = function eachChar(callback) {
- callback({ invalidChars: '/', repeat: true });
- };
- DynamicSegment.prototype.regex = function regex() {
- return '([^/]+)';
- };
- DynamicSegment.prototype.generate = function generate(params, consumed) {
- consumed[this.name] = true;
- return params[this.name];
- };
- return DynamicSegment;
- }();
- var StarSegment = exports.StarSegment = function () {
- function StarSegment(name) {
-
- this.name = name;
- }
- StarSegment.prototype.eachChar = function eachChar(callback) {
- callback({ invalidChars: '', repeat: true });
- };
- StarSegment.prototype.regex = function regex() {
- return '(.+)';
- };
- StarSegment.prototype.generate = function generate(params, consumed) {
- consumed[this.name] = true;
- return params[this.name];
- };
- return StarSegment;
- }();
- var EpsilonSegment = exports.EpsilonSegment = function () {
- function EpsilonSegment() {
-
- }
- EpsilonSegment.prototype.eachChar = function eachChar() {};
- EpsilonSegment.prototype.regex = function regex() {
- return '';
- };
- EpsilonSegment.prototype.generate = function generate() {
- return '';
- };
- return EpsilonSegment;
- }();
- var RouteRecognizer = exports.RouteRecognizer = function () {
- function RouteRecognizer() {
-
- this.rootState = new State();
- this.names = {};
- }
- RouteRecognizer.prototype.add = function add(route) {
- var _this = this;
- if (Array.isArray(route)) {
- route.forEach(function (r) {
- return _this.add(r);
- });
- return undefined;
- }
- var currentState = this.rootState;
- var regex = '^';
- var types = { statics: 0, dynamics: 0, stars: 0 };
- var names = [];
- var routeName = route.handler.name;
- var isEmpty = true;
- var segments = parse(route.path, names, types, route.caseSensitive);
- for (var i = 0, ii = segments.length; i < ii; i++) {
- var segment = segments[i];
- if (segment instanceof EpsilonSegment) {
- continue;
- }
- isEmpty = false;
- currentState = currentState.put({ validChars: '/' });
- regex += '/';
- currentState = addSegment(currentState, segment);
- regex += segment.regex();
- }
- if (isEmpty) {
- currentState = currentState.put({ validChars: '/' });
- regex += '/';
- }
- var handlers = [{ handler: route.handler, names: names }];
- if (routeName) {
- var routeNames = Array.isArray(routeName) ? routeName : [routeName];
- for (var _i2 = 0; _i2 < routeNames.length; _i2++) {
- this.names[routeNames[_i2]] = {
- segments: segments,
- handlers: handlers
- };
- }
- }
- currentState.handlers = handlers;
- currentState.regex = new RegExp(regex + '$', route.caseSensitive ? '' : 'i');
- currentState.types = types;
- return currentState;
- };
- RouteRecognizer.prototype.handlersFor = function handlersFor(name) {
- var route = this.names[name];
- if (!route) {
- throw new Error('There is no route named ' + name);
- }
- return [].concat(route.handlers);
- };
- RouteRecognizer.prototype.hasRoute = function hasRoute(name) {
- return !!this.names[name];
- };
- RouteRecognizer.prototype.generate = function generate(name, params) {
- var route = this.names[name];
- if (!route) {
- throw new Error('There is no route named ' + name);
- }
- var handler = route.handlers[0].handler;
- if (handler.generationUsesHref) {
- return handler.href;
- }
- var routeParams = Object.assign({}, params);
- var segments = route.segments;
- var consumed = {};
- var output = '';
- for (var i = 0, l = segments.length; i < l; i++) {
- var segment = segments[i];
- if (segment instanceof EpsilonSegment) {
- continue;
- }
- output += '/';
- var segmentValue = segment.generate(routeParams, consumed);
- if (segmentValue === null || segmentValue === undefined) {
- throw new Error('A value is required for route parameter \'' + segment.name + '\' in route \'' + name + '\'.');
- }
- output += segmentValue;
- }
- if (output.charAt(0) !== '/') {
- output = '/' + output;
- }
- for (var param in consumed) {
- delete routeParams[param];
- }
- var queryString = (0, _aureliaPath.buildQueryString)(routeParams);
- output += queryString ? '?' + queryString : '';
- return output;
- };
- RouteRecognizer.prototype.recognize = function recognize(path) {
- var states = [this.rootState];
- var queryParams = {};
- var isSlashDropped = false;
- var normalizedPath = path;
- var queryStart = normalizedPath.indexOf('?');
- if (queryStart !== -1) {
- var queryString = normalizedPath.substr(queryStart + 1, normalizedPath.length);
- normalizedPath = normalizedPath.substr(0, queryStart);
- queryParams = (0, _aureliaPath.parseQueryString)(queryString);
- }
- normalizedPath = decodeURI(normalizedPath);
- if (normalizedPath.charAt(0) !== '/') {
- normalizedPath = '/' + normalizedPath;
- }
- var pathLen = normalizedPath.length;
- if (pathLen > 1 && normalizedPath.charAt(pathLen - 1) === '/') {
- normalizedPath = normalizedPath.substr(0, pathLen - 1);
- isSlashDropped = true;
- }
- for (var i = 0, l = normalizedPath.length; i < l; i++) {
- states = recognizeChar(states, normalizedPath.charAt(i));
- if (!states.length) {
- break;
- }
- }
- var solutions = [];
- for (var _i3 = 0, _l = states.length; _i3 < _l; _i3++) {
- if (states[_i3].handlers) {
- solutions.push(states[_i3]);
- }
- }
- states = sortSolutions(solutions);
- var state = solutions[0];
- if (state && state.handlers) {
- if (isSlashDropped && state.regex.source.slice(-5) === '(.+)$') {
- normalizedPath = normalizedPath + '/';
- }
- return findHandler(state, normalizedPath, queryParams);
- }
- return undefined;
- };
- return RouteRecognizer;
- }();
- var RecognizeResults = function RecognizeResults(queryParams) {
-
- this.splice = Array.prototype.splice;
- this.slice = Array.prototype.slice;
- this.push = Array.prototype.push;
- this.length = 0;
- this.queryParams = queryParams || {};
- };
- function parse(route, names, types, caseSensitive) {
- var normalizedRoute = route;
- if (route.charAt(0) === '/') {
- normalizedRoute = route.substr(1);
- }
- var results = [];
- var splitRoute = normalizedRoute.split('/');
- for (var i = 0, ii = splitRoute.length; i < ii; ++i) {
- var segment = splitRoute[i];
- var match = segment.match(/^:([^\/]+)$/);
- if (match) {
- results.push(new DynamicSegment(match[1]));
- names.push(match[1]);
- types.dynamics++;
- continue;
- }
- match = segment.match(/^\*([^\/]+)$/);
- if (match) {
- results.push(new StarSegment(match[1]));
- names.push(match[1]);
- types.stars++;
- } else if (segment === '') {
- results.push(new EpsilonSegment());
- } else {
- results.push(new StaticSegment(segment, caseSensitive));
- types.statics++;
- }
- }
- return results;
- }
- function sortSolutions(states) {
- return states.sort(function (a, b) {
- if (a.types.stars !== b.types.stars) {
- return a.types.stars - b.types.stars;
- }
- if (a.types.stars) {
- if (a.types.statics !== b.types.statics) {
- return b.types.statics - a.types.statics;
- }
- if (a.types.dynamics !== b.types.dynamics) {
- return b.types.dynamics - a.types.dynamics;
- }
- }
- if (a.types.dynamics !== b.types.dynamics) {
- return a.types.dynamics - b.types.dynamics;
- }
- if (a.types.statics !== b.types.statics) {
- return b.types.statics - a.types.statics;
- }
- return 0;
- });
- }
- function recognizeChar(states, ch) {
- var nextStates = [];
- for (var i = 0, l = states.length; i < l; i++) {
- var state = states[i];
- nextStates.push.apply(nextStates, state.match(ch));
- }
- return nextStates;
- }
- function findHandler(state, path, queryParams) {
- var handlers = state.handlers;
- var regex = state.regex;
- var captures = path.match(regex);
- var currentCapture = 1;
- var result = new RecognizeResults(queryParams);
- for (var i = 0, l = handlers.length; i < l; i++) {
- var _handler = handlers[i];
- var _names = _handler.names;
- var _params = {};
- for (var j = 0, m = _names.length; j < m; j++) {
- _params[_names[j]] = captures[currentCapture++];
- }
- result.push({ handler: _handler.handler, params: _params, isDynamic: !!_names.length });
- }
- return result;
- }
- function addSegment(currentState, segment) {
- var state = currentState;
- segment.eachChar(function (ch) {
- state = state.put(ch);
- });
- return state;
- }
- });
- define('aurelia-router',['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-dependency-injection', 'aurelia-history', 'aurelia-event-aggregator'], function (exports, _aureliaLogging, _aureliaRouteRecognizer, _aureliaDependencyInjection, _aureliaHistory, _aureliaEventAggregator) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.AppRouter = exports.PipelineProvider = exports.LoadRouteStep = exports.RouteLoader = exports.ActivateNextStep = exports.DeactivatePreviousStep = exports.CanActivateNextStep = exports.CanDeactivatePreviousStep = exports.Router = exports.BuildNavigationPlanStep = exports.activationStrategy = exports.RouterConfiguration = exports.RedirectToRoute = exports.Redirect = exports.NavModel = exports.NavigationInstruction = exports.CommitChangesStep = exports.Pipeline = exports.pipelineStatus = undefined;
- exports._normalizeAbsolutePath = _normalizeAbsolutePath;
- exports._createRootedPath = _createRootedPath;
- exports._resolveUrl = _resolveUrl;
- exports.isNavigationCommand = isNavigationCommand;
- exports._buildNavigationPlan = _buildNavigationPlan;
- var LogManager = _interopRequireWildcard(_aureliaLogging);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
- function _possibleConstructorReturn(self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
- }
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
- }
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
- };
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
-
- function _normalizeAbsolutePath(path, hasPushState) {
- var absolute = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];
- if (!hasPushState && path[0] !== '#') {
- path = '#' + path;
- }
- if (hasPushState && absolute) {
- path = path.substring(1, path.length);
- }
- return path;
- }
- function _createRootedPath(fragment, baseUrl, hasPushState, absolute) {
- if (isAbsoluteUrl.test(fragment)) {
- return fragment;
- }
- var path = '';
- if (baseUrl.length && baseUrl[0] !== '/') {
- path += '/';
- }
- path += baseUrl;
- if ((!path.length || path[path.length - 1] !== '/') && fragment[0] !== '/') {
- path += '/';
- }
- if (path.length && path[path.length - 1] === '/' && fragment[0] === '/') {
- path = path.substring(0, path.length - 1);
- }
- return _normalizeAbsolutePath(path + fragment, hasPushState, absolute);
- }
- function _resolveUrl(fragment, baseUrl, hasPushState) {
- if (isRootedPath.test(fragment)) {
- return _normalizeAbsolutePath(fragment, hasPushState);
- }
- return _createRootedPath(fragment, baseUrl, hasPushState);
- }
- var isRootedPath = /^#?\//;
- var isAbsoluteUrl = /^([a-z][a-z0-9+\-.]*:)?\/\//i;
- var pipelineStatus = exports.pipelineStatus = {
- completed: 'completed',
- canceled: 'canceled',
- rejected: 'rejected',
- running: 'running'
- };
- var Pipeline = exports.Pipeline = function () {
- function Pipeline() {
-
- this.steps = [];
- }
- Pipeline.prototype.addStep = function addStep(step) {
- var run = void 0;
- if (typeof step === 'function') {
- run = step;
- } else if (typeof step.getSteps === 'function') {
- var steps = step.getSteps();
- for (var i = 0, l = steps.length; i < l; i++) {
- this.addStep(steps[i]);
- }
- return this;
- } else {
- run = step.run.bind(step);
- }
- this.steps.push(run);
- return this;
- };
- Pipeline.prototype.run = function run(instruction) {
- var index = -1;
- var steps = this.steps;
- function next() {
- index++;
- if (index < steps.length) {
- var currentStep = steps[index];
- try {
- return currentStep(instruction, next);
- } catch (e) {
- return next.reject(e);
- }
- } else {
- return next.complete();
- }
- }
- next.complete = createCompletionHandler(next, pipelineStatus.completed);
- next.cancel = createCompletionHandler(next, pipelineStatus.canceled);
- next.reject = createCompletionHandler(next, pipelineStatus.rejected);
- return next();
- };
- return Pipeline;
- }();
- function createCompletionHandler(next, status) {
- return function (output) {
- return Promise.resolve({ status: status, output: output, completed: status === pipelineStatus.completed });
- };
- }
- var CommitChangesStep = exports.CommitChangesStep = function () {
- function CommitChangesStep() {
-
- }
- CommitChangesStep.prototype.run = function run(navigationInstruction, next) {
- return navigationInstruction._commitChanges(true).then(function () {
- navigationInstruction._updateTitle();
- return next();
- });
- };
- return CommitChangesStep;
- }();
- var NavigationInstruction = exports.NavigationInstruction = function () {
- function NavigationInstruction(init) {
-
- this.plan = null;
- this.options = {};
- Object.assign(this, init);
- this.params = this.params || {};
- this.viewPortInstructions = {};
- var ancestorParams = [];
- var current = this;
- do {
- var currentParams = Object.assign({}, current.params);
- if (current.config && current.config.hasChildRouter) {
- delete currentParams[current.getWildCardName()];
- }
- ancestorParams.unshift(currentParams);
- current = current.parentInstruction;
- } while (current);
- var allParams = Object.assign.apply(Object, [{}, this.queryParams].concat(ancestorParams));
- this.lifecycleArgs = [allParams, this.config, this];
- }
- NavigationInstruction.prototype.getAllInstructions = function getAllInstructions() {
- var instructions = [this];
- for (var key in this.viewPortInstructions) {
- var childInstruction = this.viewPortInstructions[key].childNavigationInstruction;
- if (childInstruction) {
- instructions.push.apply(instructions, childInstruction.getAllInstructions());
- }
- }
- return instructions;
- };
- NavigationInstruction.prototype.getAllPreviousInstructions = function getAllPreviousInstructions() {
- return this.getAllInstructions().map(function (c) {
- return c.previousInstruction;
- }).filter(function (c) {
- return c;
- });
- };
- NavigationInstruction.prototype.addViewPortInstruction = function addViewPortInstruction(viewPortName, strategy, moduleId, component) {
- var viewportInstruction = this.viewPortInstructions[viewPortName] = {
- name: viewPortName,
- strategy: strategy,
- moduleId: moduleId,
- component: component,
- childRouter: component.childRouter,
- lifecycleArgs: this.lifecycleArgs.slice()
- };
- return viewportInstruction;
- };
- NavigationInstruction.prototype.getWildCardName = function getWildCardName() {
- var wildcardIndex = this.config.route.lastIndexOf('*');
- return this.config.route.substr(wildcardIndex + 1);
- };
- NavigationInstruction.prototype.getWildcardPath = function getWildcardPath() {
- var wildcardName = this.getWildCardName();
- var path = this.params[wildcardName] || '';
- if (this.queryString) {
- path += '?' + this.queryString;
- }
- return path;
- };
- NavigationInstruction.prototype.getBaseUrl = function getBaseUrl() {
- if (!this.params) {
- return this.fragment;
- }
- var wildcardName = this.getWildCardName();
- var path = this.params[wildcardName] || '';
- if (!path) {
- return this.fragment;
- }
- path = encodeURI(path);
- return this.fragment.substr(0, this.fragment.lastIndexOf(path));
- };
- NavigationInstruction.prototype._commitChanges = function _commitChanges(waitToSwap) {
- var _this = this;
- var router = this.router;
- router.currentInstruction = this;
- if (this.previousInstruction) {
- this.previousInstruction.config.navModel.isActive = false;
- }
- this.config.navModel.isActive = true;
- router._refreshBaseUrl();
- router.refreshNavigation();
- var loads = [];
- var delaySwaps = [];
- var _loop = function _loop(viewPortName) {
- var viewPortInstruction = _this.viewPortInstructions[viewPortName];
- var viewPort = router.viewPorts[viewPortName];
- if (!viewPort) {
- throw new Error('There was no router-view found in the view for ' + viewPortInstruction.moduleId + '.');
- }
- if (viewPortInstruction.strategy === activationStrategy.replace) {
- if (waitToSwap) {
- delaySwaps.push({ viewPort: viewPort, viewPortInstruction: viewPortInstruction });
- }
- loads.push(viewPort.process(viewPortInstruction, waitToSwap).then(function (x) {
- if (viewPortInstruction.childNavigationInstruction) {
- return viewPortInstruction.childNavigationInstruction._commitChanges();
- }
- return undefined;
- }));
- } else {
- if (viewPortInstruction.childNavigationInstruction) {
- loads.push(viewPortInstruction.childNavigationInstruction._commitChanges(waitToSwap));
- }
- }
- };
- for (var viewPortName in this.viewPortInstructions) {
- _loop(viewPortName);
- }
- return Promise.all(loads).then(function () {
- delaySwaps.forEach(function (x) {
- return x.viewPort.swap(x.viewPortInstruction);
- });
- return null;
- }).then(function () {
- return prune(_this);
- });
- };
- NavigationInstruction.prototype._updateTitle = function _updateTitle() {
- var title = this._buildTitle();
- if (title) {
- this.router.history.setTitle(title);
- }
- };
- NavigationInstruction.prototype._buildTitle = function _buildTitle() {
- var separator = arguments.length <= 0 || arguments[0] === undefined ? ' | ' : arguments[0];
- var title = this.config.navModel.title || '';
- var childTitles = [];
- for (var viewPortName in this.viewPortInstructions) {
- var _viewPortInstruction = this.viewPortInstructions[viewPortName];
- if (_viewPortInstruction.childNavigationInstruction) {
- var childTitle = _viewPortInstruction.childNavigationInstruction._buildTitle(separator);
- if (childTitle) {
- childTitles.push(childTitle);
- }
- }
- }
- if (childTitles.length) {
- title = childTitles.join(separator) + (title ? separator : '') + title;
- }
- if (this.router.title) {
- title += (title ? separator : '') + this.router.title;
- }
- return title;
- };
- return NavigationInstruction;
- }();
- function prune(instruction) {
- instruction.previousInstruction = null;
- instruction.plan = null;
- }
- var NavModel = exports.NavModel = function () {
- function NavModel(router, relativeHref) {
-
- this.isActive = false;
- this.title = null;
- this.href = null;
- this.relativeHref = null;
- this.settings = {};
- this.config = null;
- this.router = router;
- this.relativeHref = relativeHref;
- }
- NavModel.prototype.setTitle = function setTitle(title) {
- this.title = title;
- if (this.isActive) {
- this.router.updateTitle();
- }
- };
- return NavModel;
- }();
- function isNavigationCommand(obj) {
- return obj && typeof obj.navigate === 'function';
- }
- var Redirect = exports.Redirect = function () {
- function Redirect(url) {
- var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
-
- this.url = url;
- this.options = Object.assign({ trigger: true, replace: true }, options);
- this.shouldContinueProcessing = false;
- }
- Redirect.prototype.setRouter = function setRouter(router) {
- this.router = router;
- };
- Redirect.prototype.navigate = function navigate(appRouter) {
- var navigatingRouter = this.options.useAppRouter ? appRouter : this.router || appRouter;
- navigatingRouter.navigate(this.url, this.options);
- };
- return Redirect;
- }();
- var RedirectToRoute = exports.RedirectToRoute = function () {
- function RedirectToRoute(route) {
- var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
- var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
-
- this.route = route;
- this.params = params;
- this.options = Object.assign({ trigger: true, replace: true }, options);
- this.shouldContinueProcessing = false;
- }
- RedirectToRoute.prototype.setRouter = function setRouter(router) {
- this.router = router;
- };
- RedirectToRoute.prototype.navigate = function navigate(appRouter) {
- var navigatingRouter = this.options.useAppRouter ? appRouter : this.router || appRouter;
- navigatingRouter.navigateToRoute(this.route, this.params, this.options);
- };
- return RedirectToRoute;
- }();
- var RouterConfiguration = exports.RouterConfiguration = function () {
- function RouterConfiguration() {
-
- this.instructions = [];
- this.options = {};
- this.pipelineSteps = [];
- }
- RouterConfiguration.prototype.addPipelineStep = function addPipelineStep(name, step) {
- this.pipelineSteps.push({ name: name, step: step });
- return this;
- };
- RouterConfiguration.prototype.addAuthorizeStep = function addAuthorizeStep(step) {
- return this.addPipelineStep('authorize', step);
- };
- RouterConfiguration.prototype.addPreActivateStep = function addPreActivateStep(step) {
- return this.addPipelineStep('preActivate', step);
- };
- RouterConfiguration.prototype.addPreRenderStep = function addPreRenderStep(step) {
- return this.addPipelineStep('preRender', step);
- };
- RouterConfiguration.prototype.addPostRenderStep = function addPostRenderStep(step) {
- return this.addPipelineStep('postRender', step);
- };
- RouterConfiguration.prototype.map = function map(route) {
- if (Array.isArray(route)) {
- route.forEach(this.map.bind(this));
- return this;
- }
- return this.mapRoute(route);
- };
- RouterConfiguration.prototype.mapRoute = function mapRoute(config) {
- this.instructions.push(function (router) {
- var routeConfigs = [];
- if (Array.isArray(config.route)) {
- for (var i = 0, ii = config.route.length; i < ii; ++i) {
- var current = Object.assign({}, config);
- current.route = config.route[i];
- routeConfigs.push(current);
- }
- } else {
- routeConfigs.push(Object.assign({}, config));
- }
- var navModel = void 0;
- for (var _i = 0, _ii = routeConfigs.length; _i < _ii; ++_i) {
- var _routeConfig = routeConfigs[_i];
- _routeConfig.settings = _routeConfig.settings || {};
- if (!navModel) {
- navModel = router.createNavModel(_routeConfig);
- }
- router.addRoute(_routeConfig, navModel);
- }
- });
- return this;
- };
- RouterConfiguration.prototype.mapUnknownRoutes = function mapUnknownRoutes(config) {
- this.unknownRouteConfig = config;
- return this;
- };
- RouterConfiguration.prototype.exportToRouter = function exportToRouter(router) {
- var instructions = this.instructions;
- for (var i = 0, ii = instructions.length; i < ii; ++i) {
- instructions[i](router);
- }
- if (this.title) {
- router.title = this.title;
- }
- if (this.unknownRouteConfig) {
- router.handleUnknownRoutes(this.unknownRouteConfig);
- }
- router.options = this.options;
- var pipelineSteps = this.pipelineSteps;
- if (pipelineSteps.length) {
- if (!router.isRoot) {
- throw new Error('Pipeline steps can only be added to the root router');
- }
- var pipelineProvider = router.pipelineProvider;
- for (var _i2 = 0, _ii2 = pipelineSteps.length; _i2 < _ii2; ++_i2) {
- var _pipelineSteps$_i = pipelineSteps[_i2];
- var _name = _pipelineSteps$_i.name;
- var step = _pipelineSteps$_i.step;
- pipelineProvider.addStep(_name, step);
- }
- }
- };
- return RouterConfiguration;
- }();
- var activationStrategy = exports.activationStrategy = {
- noChange: 'no-change',
- invokeLifecycle: 'invoke-lifecycle',
- replace: 'replace'
- };
- var BuildNavigationPlanStep = exports.BuildNavigationPlanStep = function () {
- function BuildNavigationPlanStep() {
-
- }
- BuildNavigationPlanStep.prototype.run = function run(navigationInstruction, next) {
- return _buildNavigationPlan(navigationInstruction).then(function (plan) {
- navigationInstruction.plan = plan;
- return next();
- }).catch(next.cancel);
- };
- return BuildNavigationPlanStep;
- }();
- function _buildNavigationPlan(instruction, forceLifecycleMinimum) {
- var prev = instruction.previousInstruction;
- var config = instruction.config;
- var plan = {};
- if ('redirect' in config) {
- var redirectLocation = _resolveUrl(config.redirect, getInstructionBaseUrl(instruction));
- if (instruction.queryString) {
- redirectLocation += '?' + instruction.queryString;
- }
- return Promise.reject(new Redirect(redirectLocation));
- }
- if (prev) {
- var newParams = hasDifferentParameterValues(prev, instruction);
- var pending = [];
- var _loop2 = function _loop2(viewPortName) {
- var prevViewPortInstruction = prev.viewPortInstructions[viewPortName];
- var nextViewPortConfig = config.viewPorts[viewPortName];
- if (!nextViewPortConfig) throw new Error('Invalid Route Config: Configuration for viewPort "' + viewPortName + '" was not found for route: "' + instruction.config.route + '."');
- var viewPortPlan = plan[viewPortName] = {
- name: viewPortName,
- config: nextViewPortConfig,
- prevComponent: prevViewPortInstruction.component,
- prevModuleId: prevViewPortInstruction.moduleId
- };
- if (prevViewPortInstruction.moduleId !== nextViewPortConfig.moduleId) {
- viewPortPlan.strategy = activationStrategy.replace;
- } else if ('determineActivationStrategy' in prevViewPortInstruction.component.viewModel) {
- var _prevViewPortInstruct;
- viewPortPlan.strategy = (_prevViewPortInstruct = prevViewPortInstruction.component.viewModel).determineActivationStrategy.apply(_prevViewPortInstruct, instruction.lifecycleArgs);
- } else if (config.activationStrategy) {
- viewPortPlan.strategy = config.activationStrategy;
- } else if (newParams || forceLifecycleMinimum) {
- viewPortPlan.strategy = activationStrategy.invokeLifecycle;
- } else {
- viewPortPlan.strategy = activationStrategy.noChange;
- }
- if (viewPortPlan.strategy !== activationStrategy.replace && prevViewPortInstruction.childRouter) {
- var path = instruction.getWildcardPath();
- var task = prevViewPortInstruction.childRouter._createNavigationInstruction(path, instruction).then(function (childInstruction) {
- viewPortPlan.childNavigationInstruction = childInstruction;
- return _buildNavigationPlan(childInstruction, viewPortPlan.strategy === activationStrategy.invokeLifecycle).then(function (childPlan) {
- childInstruction.plan = childPlan;
- });
- });
- pending.push(task);
- }
- };
- for (var viewPortName in prev.viewPortInstructions) {
- _loop2(viewPortName);
- }
- return Promise.all(pending).then(function () {
- return plan;
- });
- }
- for (var _viewPortName in config.viewPorts) {
- plan[_viewPortName] = {
- name: _viewPortName,
- strategy: activationStrategy.replace,
- config: instruction.config.viewPorts[_viewPortName]
- };
- }
- return Promise.resolve(plan);
- }
- function hasDifferentParameterValues(prev, next) {
- var prevParams = prev.params;
- var nextParams = next.params;
- var nextWildCardName = next.config.hasChildRouter ? next.getWildCardName() : null;
- for (var key in nextParams) {
- if (key === nextWildCardName) {
- continue;
- }
- if (prevParams[key] !== nextParams[key]) {
- return true;
- }
- }
- for (var _key in prevParams) {
- if (_key === nextWildCardName) {
- continue;
- }
- if (prevParams[_key] !== nextParams[_key]) {
- return true;
- }
- }
- if (!next.options.compareQueryParams) {
- return false;
- }
- var prevQueryParams = prev.queryParams;
- var nextQueryParams = next.queryParams;
- for (var _key2 in nextQueryParams) {
- if (prevQueryParams[_key2] !== nextQueryParams[_key2]) {
- return true;
- }
- }
- for (var _key3 in prevQueryParams) {
- if (prevQueryParams[_key3] !== nextQueryParams[_key3]) {
- return true;
- }
- }
- return false;
- }
- function getInstructionBaseUrl(instruction) {
- var instructionBaseUrlParts = [];
- instruction = instruction.parentInstruction;
- while (instruction) {
- instructionBaseUrlParts.unshift(instruction.getBaseUrl());
- instruction = instruction.parentInstruction;
- }
- instructionBaseUrlParts.unshift('/');
- return instructionBaseUrlParts.join('');
- }
- var Router = exports.Router = function () {
- function Router(container, history) {
-
- this.parent = null;
- this.options = {};
- this.container = container;
- this.history = history;
- this.reset();
- }
- Router.prototype.reset = function reset() {
- var _this2 = this;
- this.viewPorts = {};
- this.routes = [];
- this.baseUrl = '';
- this.isConfigured = false;
- this.isNavigating = false;
- this.navigation = [];
- this.currentInstruction = null;
- this._fallbackOrder = 100;
- this._recognizer = new _aureliaRouteRecognizer.RouteRecognizer();
- this._childRecognizer = new _aureliaRouteRecognizer.RouteRecognizer();
- this._configuredPromise = new Promise(function (resolve) {
- _this2._resolveConfiguredPromise = resolve;
- });
- };
- Router.prototype.registerViewPort = function registerViewPort(viewPort, name) {
- name = name || 'default';
- this.viewPorts[name] = viewPort;
- };
- Router.prototype.ensureConfigured = function ensureConfigured() {
- return this._configuredPromise;
- };
- Router.prototype.configure = function configure(callbackOrConfig) {
- var _this3 = this;
- this.isConfigured = true;
- var result = callbackOrConfig;
- var config = void 0;
- if (typeof callbackOrConfig === 'function') {
- config = new RouterConfiguration();
- result = callbackOrConfig(config);
- }
- return Promise.resolve(result).then(function (c) {
- if (c && c.exportToRouter) {
- config = c;
- }
- config.exportToRouter(_this3);
- _this3.isConfigured = true;
- _this3._resolveConfiguredPromise();
- });
- };
- Router.prototype.navigate = function navigate(fragment, options) {
- if (!this.isConfigured && this.parent) {
- return this.parent.navigate(fragment, options);
- }
- return this.history.navigate(_resolveUrl(fragment, this.baseUrl, this.history._hasPushState), options);
- };
- Router.prototype.navigateToRoute = function navigateToRoute(route, params, options) {
- var path = this.generate(route, params);
- return this.navigate(path, options);
- };
- Router.prototype.navigateBack = function navigateBack() {
- this.history.navigateBack();
- };
- Router.prototype.createChild = function createChild(container) {
- var childRouter = new Router(container || this.container.createChild(), this.history);
- childRouter.parent = this;
- return childRouter;
- };
- Router.prototype.generate = function generate(name, params) {
- var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
- var hasRoute = this._recognizer.hasRoute(name);
- if ((!this.isConfigured || !hasRoute) && this.parent) {
- return this.parent.generate(name, params);
- }
- if (!hasRoute) {
- throw new Error('A route with name \'' + name + '\' could not be found. Check that `name: \'' + name + '\'` was specified in the route\'s config.');
- }
- var path = this._recognizer.generate(name, params);
- var rootedPath = _createRootedPath(path, this.baseUrl, this.history._hasPushState, options.absolute);
- return options.absolute ? '' + this.history.getAbsoluteRoot() + rootedPath : rootedPath;
- };
- Router.prototype.createNavModel = function createNavModel(config) {
- var navModel = new NavModel(this, 'href' in config ? config.href : config.route);
- navModel.title = config.title;
- navModel.order = config.nav;
- navModel.href = config.href;
- navModel.settings = config.settings;
- navModel.config = config;
- return navModel;
- };
- Router.prototype.addRoute = function addRoute(config, navModel) {
- validateRouteConfig(config, this.routes);
- if (!('viewPorts' in config) && !config.navigationStrategy) {
- config.viewPorts = {
- 'default': {
- moduleId: config.moduleId,
- view: config.view
- }
- };
- }
- if (!navModel) {
- navModel = this.createNavModel(config);
- }
- this.routes.push(config);
- var path = config.route;
- if (path.charAt(0) === '/') {
- path = path.substr(1);
- }
- var caseSensitive = config.caseSensitive === true;
- var state = this._recognizer.add({ path: path, handler: config, caseSensitive: caseSensitive });
- if (path) {
- var _settings = config.settings;
- delete config.settings;
- var withChild = JSON.parse(JSON.stringify(config));
- config.settings = _settings;
- withChild.route = path + '/*childRoute';
- withChild.hasChildRouter = true;
- this._childRecognizer.add({
- path: withChild.route,
- handler: withChild,
- caseSensitive: caseSensitive
- });
- withChild.navModel = navModel;
- withChild.settings = config.settings;
- }
- config.navModel = navModel;
- if ((navModel.order || navModel.order === 0) && this.navigation.indexOf(navModel) === -1) {
- if (!navModel.href && navModel.href !== '' && (state.types.dynamics || state.types.stars)) {
- throw new Error('Invalid route config for "' + config.route + '" : dynamic routes must specify an "href:" to be included in the navigation model.');
- }
- if (typeof navModel.order !== 'number') {
- navModel.order = ++this._fallbackOrder;
- }
- this.navigation.push(navModel);
- this.navigation = this.navigation.sort(function (a, b) {
- return a.order - b.order;
- });
- }
- };
- Router.prototype.hasRoute = function hasRoute(name) {
- return !!(this._recognizer.hasRoute(name) || this.parent && this.parent.hasRoute(name));
- };
- Router.prototype.hasOwnRoute = function hasOwnRoute(name) {
- return this._recognizer.hasRoute(name);
- };
- Router.prototype.handleUnknownRoutes = function handleUnknownRoutes(config) {
- var _this4 = this;
- if (!config) {
- throw new Error('Invalid unknown route handler');
- }
- this.catchAllHandler = function (instruction) {
- return _this4._createRouteConfig(config, instruction).then(function (c) {
- instruction.config = c;
- return instruction;
- });
- };
- };
- Router.prototype.updateTitle = function updateTitle() {
- if (this.parent) {
- return this.parent.updateTitle();
- }
- this.currentInstruction._updateTitle();
- return undefined;
- };
- Router.prototype.refreshNavigation = function refreshNavigation() {
- var nav = this.navigation;
- for (var i = 0, length = nav.length; i < length; i++) {
- var current = nav[i];
- if (!current.config.href) {
- current.href = _createRootedPath(current.relativeHref, this.baseUrl, this.history._hasPushState);
- } else {
- current.href = _normalizeAbsolutePath(current.config.href, this.history._hasPushState);
- }
- }
- };
- Router.prototype._refreshBaseUrl = function _refreshBaseUrl() {
- if (this.parent) {
- var baseUrl = this.parent.currentInstruction.getBaseUrl();
- this.baseUrl = this.parent.baseUrl + baseUrl;
- }
- };
- Router.prototype._createNavigationInstruction = function _createNavigationInstruction() {
- var url = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
- var parentInstruction = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
- var fragment = url;
- var queryString = '';
- var queryIndex = url.indexOf('?');
- if (queryIndex !== -1) {
- fragment = url.substr(0, queryIndex);
- queryString = url.substr(queryIndex + 1);
- }
- var results = this._recognizer.recognize(url);
- if (!results || !results.length) {
- results = this._childRecognizer.recognize(url);
- }
- var instructionInit = {
- fragment: fragment,
- queryString: queryString,
- config: null,
- parentInstruction: parentInstruction,
- previousInstruction: this.currentInstruction,
- router: this,
- options: {
- compareQueryParams: this.options.compareQueryParams
- }
- };
- if (results && results.length) {
- var first = results[0];
- var _instruction = new NavigationInstruction(Object.assign({}, instructionInit, {
- params: first.params,
- queryParams: first.queryParams || results.queryParams,
- config: first.config || first.handler
- }));
- if (typeof first.handler === 'function') {
- return evaluateNavigationStrategy(_instruction, first.handler, first);
- } else if (first.handler && 'navigationStrategy' in first.handler) {
- return evaluateNavigationStrategy(_instruction, first.handler.navigationStrategy, first.handler);
- }
- return Promise.resolve(_instruction);
- } else if (this.catchAllHandler) {
- var _instruction2 = new NavigationInstruction(Object.assign({}, instructionInit, {
- params: { path: fragment },
- queryParams: results && results.queryParams,
- config: null }));
- return evaluateNavigationStrategy(_instruction2, this.catchAllHandler);
- }
- return Promise.reject(new Error('Route not found: ' + url));
- };
- Router.prototype._createRouteConfig = function _createRouteConfig(config, instruction) {
- var _this5 = this;
- return Promise.resolve(config).then(function (c) {
- if (typeof c === 'string') {
- return { moduleId: c };
- } else if (typeof c === 'function') {
- return c(instruction);
- }
- return c;
- }).then(function (c) {
- return typeof c === 'string' ? { moduleId: c } : c;
- }).then(function (c) {
- c.route = instruction.params.path;
- validateRouteConfig(c, _this5.routes);
- if (!c.navModel) {
- c.navModel = _this5.createNavModel(c);
- }
- return c;
- });
- };
- _createClass(Router, [{
- key: 'isRoot',
- get: function get() {
- return !this.parent;
- }
- }]);
- return Router;
- }();
- function validateRouteConfig(config, routes) {
- if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) !== 'object') {
- throw new Error('Invalid Route Config');
- }
- if (typeof config.route !== 'string') {
- var _name2 = config.name || '(no name)';
- throw new Error('Invalid Route Config for "' + _name2 + '": You must specify a "route:" pattern.');
- }
- if (!('redirect' in config || config.moduleId || config.navigationStrategy || config.viewPorts)) {
- throw new Error('Invalid Route Config for "' + config.route + '": You must specify a "moduleId:", "redirect:", "navigationStrategy:", or "viewPorts:".');
- }
- }
- function evaluateNavigationStrategy(instruction, evaluator, context) {
- return Promise.resolve(evaluator.call(context, instruction)).then(function () {
- if (!('viewPorts' in instruction.config)) {
- instruction.config.viewPorts = {
- 'default': {
- moduleId: instruction.config.moduleId
- }
- };
- }
- return instruction;
- });
- }
- var CanDeactivatePreviousStep = exports.CanDeactivatePreviousStep = function () {
- function CanDeactivatePreviousStep() {
-
- }
- CanDeactivatePreviousStep.prototype.run = function run(navigationInstruction, next) {
- return processDeactivatable(navigationInstruction.plan, 'canDeactivate', next);
- };
- return CanDeactivatePreviousStep;
- }();
- var CanActivateNextStep = exports.CanActivateNextStep = function () {
- function CanActivateNextStep() {
-
- }
- CanActivateNextStep.prototype.run = function run(navigationInstruction, next) {
- return processActivatable(navigationInstruction, 'canActivate', next);
- };
- return CanActivateNextStep;
- }();
- var DeactivatePreviousStep = exports.DeactivatePreviousStep = function () {
- function DeactivatePreviousStep() {
-
- }
- DeactivatePreviousStep.prototype.run = function run(navigationInstruction, next) {
- return processDeactivatable(navigationInstruction.plan, 'deactivate', next, true);
- };
- return DeactivatePreviousStep;
- }();
- var ActivateNextStep = exports.ActivateNextStep = function () {
- function ActivateNextStep() {
-
- }
- ActivateNextStep.prototype.run = function run(navigationInstruction, next) {
- return processActivatable(navigationInstruction, 'activate', next, true);
- };
- return ActivateNextStep;
- }();
- function processDeactivatable(plan, callbackName, next, ignoreResult) {
- var infos = findDeactivatable(plan, callbackName);
- var i = infos.length;
- function inspect(val) {
- if (ignoreResult || shouldContinue(val)) {
- return iterate();
- }
- return next.cancel(val);
- }
- function iterate() {
- if (i--) {
- try {
- var viewModel = infos[i];
- var _result = viewModel[callbackName]();
- return processPotential(_result, inspect, next.cancel);
- } catch (error) {
- return next.cancel(error);
- }
- }
- return next();
- }
- return iterate();
- }
- function findDeactivatable(plan, callbackName) {
- var list = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
- for (var viewPortName in plan) {
- var _viewPortPlan = plan[viewPortName];
- var prevComponent = _viewPortPlan.prevComponent;
- if ((_viewPortPlan.strategy === activationStrategy.invokeLifecycle || _viewPortPlan.strategy === activationStrategy.replace) && prevComponent) {
- var viewModel = prevComponent.viewModel;
- if (callbackName in viewModel) {
- list.push(viewModel);
- }
- }
- if (_viewPortPlan.childNavigationInstruction) {
- findDeactivatable(_viewPortPlan.childNavigationInstruction.plan, callbackName, list);
- } else if (prevComponent) {
- addPreviousDeactivatable(prevComponent, callbackName, list);
- }
- }
- return list;
- }
- function addPreviousDeactivatable(component, callbackName, list) {
- var childRouter = component.childRouter;
- if (childRouter && childRouter.currentInstruction) {
- var viewPortInstructions = childRouter.currentInstruction.viewPortInstructions;
- for (var viewPortName in viewPortInstructions) {
- var _viewPortInstruction2 = viewPortInstructions[viewPortName];
- var prevComponent = _viewPortInstruction2.component;
- var prevViewModel = prevComponent.viewModel;
- if (callbackName in prevViewModel) {
- list.push(prevViewModel);
- }
- addPreviousDeactivatable(prevComponent, callbackName, list);
- }
- }
- }
- function processActivatable(navigationInstruction, callbackName, next, ignoreResult) {
- var infos = findActivatable(navigationInstruction, callbackName);
- var length = infos.length;
- var i = -1;
- function inspect(val, router) {
- if (ignoreResult || shouldContinue(val, router)) {
- return iterate();
- }
- return next.cancel(val);
- }
- function iterate() {
- i++;
- if (i < length) {
- try {
- var _ret3 = function () {
- var _current$viewModel;
- var current = infos[i];
- var result = (_current$viewModel = current.viewModel)[callbackName].apply(_current$viewModel, current.lifecycleArgs);
- return {
- v: processPotential(result, function (val) {
- return inspect(val, current.router);
- }, next.cancel)
- };
- }();
- if ((typeof _ret3 === 'undefined' ? 'undefined' : _typeof(_ret3)) === "object") return _ret3.v;
- } catch (error) {
- return next.cancel(error);
- }
- }
- return next();
- }
- return iterate();
- }
- function findActivatable(navigationInstruction, callbackName) {
- var list = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
- var router = arguments[3];
- var plan = navigationInstruction.plan;
- Object.keys(plan).filter(function (viewPortName) {
- var viewPortPlan = plan[viewPortName];
- var viewPortInstruction = navigationInstruction.viewPortInstructions[viewPortName];
- var viewModel = viewPortInstruction.component.viewModel;
- if ((viewPortPlan.strategy === activationStrategy.invokeLifecycle || viewPortPlan.strategy === activationStrategy.replace) && callbackName in viewModel) {
- list.push({
- viewModel: viewModel,
- lifecycleArgs: viewPortInstruction.lifecycleArgs,
- router: router
- });
- }
- if (viewPortPlan.childNavigationInstruction) {
- findActivatable(viewPortPlan.childNavigationInstruction, callbackName, list, viewPortInstruction.component.childRouter || router);
- }
- });
- return list;
- }
- function shouldContinue(output, router) {
- if (output instanceof Error) {
- return false;
- }
- if (isNavigationCommand(output)) {
- if (typeof output.setRouter === 'function') {
- output.setRouter(router);
- }
- return !!output.shouldContinueProcessing;
- }
- if (output === undefined) {
- return true;
- }
- return output;
- }
- var SafeSubscription = function () {
- function SafeSubscription(subscriptionFunc) {
-
- this._subscribed = true;
- this._subscription = subscriptionFunc(this);
- if (!this._subscribed) this.unsubscribe();
- }
- SafeSubscription.prototype.unsubscribe = function unsubscribe() {
- if (this._subscribed && this._subscription) this._subscription.unsubscribe();
- this._subscribed = false;
- };
- _createClass(SafeSubscription, [{
- key: 'subscribed',
- get: function get() {
- return this._subscribed;
- }
- }]);
- return SafeSubscription;
- }();
- function processPotential(obj, resolve, reject) {
- if (obj && typeof obj.then === 'function') {
- return Promise.resolve(obj).then(resolve).catch(reject);
- }
- if (obj && typeof obj.subscribe === 'function') {
- var _ret4 = function () {
- var obs = obj;
- return {
- v: new SafeSubscription(function (sub) {
- return obs.subscribe({
- next: function next() {
- if (sub.subscribed) {
- sub.unsubscribe();
- resolve(obj);
- }
- },
- error: function error(_error) {
- if (sub.subscribed) {
- sub.unsubscribe();
- reject(_error);
- }
- },
- complete: function complete() {
- if (sub.subscribed) {
- sub.unsubscribe();
- resolve(obj);
- }
- }
- });
- })
- };
- }();
- if ((typeof _ret4 === 'undefined' ? 'undefined' : _typeof(_ret4)) === "object") return _ret4.v;
- }
- try {
- return resolve(obj);
- } catch (error) {
- return reject(error);
- }
- }
- var RouteLoader = exports.RouteLoader = function () {
- function RouteLoader() {
-
- }
- RouteLoader.prototype.loadRoute = function loadRoute(router, config, navigationInstruction) {
- throw Error('Route loaders must implement "loadRoute(router, config, navigationInstruction)".');
- };
- return RouteLoader;
- }();
- var LoadRouteStep = exports.LoadRouteStep = function () {
- LoadRouteStep.inject = function inject() {
- return [RouteLoader];
- };
- function LoadRouteStep(routeLoader) {
-
- this.routeLoader = routeLoader;
- }
- LoadRouteStep.prototype.run = function run(navigationInstruction, next) {
- return loadNewRoute(this.routeLoader, navigationInstruction).then(next).catch(next.cancel);
- };
- return LoadRouteStep;
- }();
- function loadNewRoute(routeLoader, navigationInstruction) {
- var toLoad = determineWhatToLoad(navigationInstruction);
- var loadPromises = toLoad.map(function (current) {
- return loadRoute(routeLoader, current.navigationInstruction, current.viewPortPlan);
- });
- return Promise.all(loadPromises);
- }
- function determineWhatToLoad(navigationInstruction) {
- var toLoad = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
- var plan = navigationInstruction.plan;
- for (var viewPortName in plan) {
- var _viewPortPlan2 = plan[viewPortName];
- if (_viewPortPlan2.strategy === activationStrategy.replace) {
- toLoad.push({ viewPortPlan: _viewPortPlan2, navigationInstruction: navigationInstruction });
- if (_viewPortPlan2.childNavigationInstruction) {
- determineWhatToLoad(_viewPortPlan2.childNavigationInstruction, toLoad);
- }
- } else {
- var _viewPortInstruction3 = navigationInstruction.addViewPortInstruction(viewPortName, _viewPortPlan2.strategy, _viewPortPlan2.prevModuleId, _viewPortPlan2.prevComponent);
- if (_viewPortPlan2.childNavigationInstruction) {
- _viewPortInstruction3.childNavigationInstruction = _viewPortPlan2.childNavigationInstruction;
- determineWhatToLoad(_viewPortPlan2.childNavigationInstruction, toLoad);
- }
- }
- }
- return toLoad;
- }
- function loadRoute(routeLoader, navigationInstruction, viewPortPlan) {
- var moduleId = viewPortPlan.config.moduleId;
- return loadComponent(routeLoader, navigationInstruction, viewPortPlan.config).then(function (component) {
- var viewPortInstruction = navigationInstruction.addViewPortInstruction(viewPortPlan.name, viewPortPlan.strategy, moduleId, component);
- var childRouter = component.childRouter;
- if (childRouter) {
- var path = navigationInstruction.getWildcardPath();
- return childRouter._createNavigationInstruction(path, navigationInstruction).then(function (childInstruction) {
- viewPortPlan.childNavigationInstruction = childInstruction;
- return _buildNavigationPlan(childInstruction).then(function (childPlan) {
- childInstruction.plan = childPlan;
- viewPortInstruction.childNavigationInstruction = childInstruction;
- return loadNewRoute(routeLoader, childInstruction);
- });
- });
- }
- return undefined;
- });
- }
- function loadComponent(routeLoader, navigationInstruction, config) {
- var router = navigationInstruction.router;
- var lifecycleArgs = navigationInstruction.lifecycleArgs;
- return routeLoader.loadRoute(router, config, navigationInstruction).then(function (component) {
- var viewModel = component.viewModel;
- var childContainer = component.childContainer;
- component.router = router;
- component.config = config;
- if ('configureRouter' in viewModel) {
- var _ret5 = function () {
- var childRouter = childContainer.getChildRouter();
- component.childRouter = childRouter;
- return {
- v: childRouter.configure(function (c) {
- return viewModel.configureRouter.apply(viewModel, [c, childRouter].concat(lifecycleArgs));
- }).then(function () {
- return component;
- })
- };
- }();
- if ((typeof _ret5 === 'undefined' ? 'undefined' : _typeof(_ret5)) === "object") return _ret5.v;
- }
- return component;
- });
- }
- var PipelineSlot = function () {
- function PipelineSlot(container, name, alias) {
-
- this.steps = [];
- this.container = container;
- this.slotName = name;
- this.slotAlias = alias;
- }
- PipelineSlot.prototype.getSteps = function getSteps() {
- var _this6 = this;
- return this.steps.map(function (x) {
- return _this6.container.get(x);
- });
- };
- return PipelineSlot;
- }();
- var PipelineProvider = exports.PipelineProvider = function () {
- PipelineProvider.inject = function inject() {
- return [_aureliaDependencyInjection.Container];
- };
- function PipelineProvider(container) {
-
- this.container = container;
- this.steps = [BuildNavigationPlanStep, CanDeactivatePreviousStep, LoadRouteStep, this._createPipelineSlot('authorize'), CanActivateNextStep, this._createPipelineSlot('preActivate', 'modelbind'), DeactivatePreviousStep, ActivateNextStep, this._createPipelineSlot('preRender', 'precommit'), CommitChangesStep, this._createPipelineSlot('postRender', 'postcomplete')];
- }
- PipelineProvider.prototype.createPipeline = function createPipeline() {
- var _this7 = this;
- var pipeline = new Pipeline();
- this.steps.forEach(function (step) {
- return pipeline.addStep(_this7.container.get(step));
- });
- return pipeline;
- };
- PipelineProvider.prototype._findStep = function _findStep(name) {
- return this.steps.find(function (x) {
- return x.slotName === name || x.slotAlias === name;
- });
- };
- PipelineProvider.prototype.addStep = function addStep(name, step) {
- var found = this._findStep(name);
- if (found) {
- if (!found.steps.includes(step)) {
- found.steps.push(step);
- }
- } else {
- throw new Error('Invalid pipeline slot name: ' + name + '.');
- }
- };
- PipelineProvider.prototype.removeStep = function removeStep(name, step) {
- var slot = this._findStep(name);
- if (slot) {
- slot.steps.splice(slot.steps.indexOf(step), 1);
- }
- };
- PipelineProvider.prototype._clearSteps = function _clearSteps() {
- var name = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
- var slot = this._findStep(name);
- if (slot) {
- slot.steps = [];
- }
- };
- PipelineProvider.prototype.reset = function reset() {
- this._clearSteps('authorize');
- this._clearSteps('preActivate');
- this._clearSteps('preRender');
- this._clearSteps('postRender');
- };
- PipelineProvider.prototype._createPipelineSlot = function _createPipelineSlot(name, alias) {
- return new PipelineSlot(this.container, name, alias);
- };
- return PipelineProvider;
- }();
- var logger = LogManager.getLogger('app-router');
- var AppRouter = exports.AppRouter = function (_Router) {
- _inherits(AppRouter, _Router);
- AppRouter.inject = function inject() {
- return [_aureliaDependencyInjection.Container, _aureliaHistory.History, PipelineProvider, _aureliaEventAggregator.EventAggregator];
- };
- function AppRouter(container, history, pipelineProvider, events) {
-
- var _this8 = _possibleConstructorReturn(this, _Router.call(this, container, history));
- _this8.pipelineProvider = pipelineProvider;
- _this8.events = events;
- return _this8;
- }
- AppRouter.prototype.reset = function reset() {
- _Router.prototype.reset.call(this);
- this.maxInstructionCount = 10;
- if (!this._queue) {
- this._queue = [];
- } else {
- this._queue.length = 0;
- }
- };
- AppRouter.prototype.loadUrl = function loadUrl(url) {
- var _this9 = this;
- return this._createNavigationInstruction(url).then(function (instruction) {
- return _this9._queueInstruction(instruction);
- }).catch(function (error) {
- logger.error(error);
- restorePreviousLocation(_this9);
- });
- };
- AppRouter.prototype.registerViewPort = function registerViewPort(viewPort, name) {
- var _this10 = this;
- _Router.prototype.registerViewPort.call(this, viewPort, name);
- if (!this.isActive) {
- var _ret6 = function () {
- var viewModel = _this10._findViewModel(viewPort);
- if ('configureRouter' in viewModel) {
- if (!_this10.isConfigured) {
- var _ret7 = function () {
- var resolveConfiguredPromise = _this10._resolveConfiguredPromise;
- _this10._resolveConfiguredPromise = function () {};
- return {
- v: {
- v: _this10.configure(function (config) {
- return viewModel.configureRouter(config, _this10);
- }).then(function () {
- _this10.activate();
- resolveConfiguredPromise();
- })
- }
- };
- }();
- if ((typeof _ret7 === 'undefined' ? 'undefined' : _typeof(_ret7)) === "object") return _ret7.v;
- }
- } else {
- _this10.activate();
- }
- }();
- if ((typeof _ret6 === 'undefined' ? 'undefined' : _typeof(_ret6)) === "object") return _ret6.v;
- } else {
- this._dequeueInstruction();
- }
- return Promise.resolve();
- };
- AppRouter.prototype.activate = function activate(options) {
- if (this.isActive) {
- return;
- }
- this.isActive = true;
- this.options = Object.assign({ routeHandler: this.loadUrl.bind(this) }, this.options, options);
- this.history.activate(this.options);
- this._dequeueInstruction();
- };
- AppRouter.prototype.deactivate = function deactivate() {
- this.isActive = false;
- this.history.deactivate();
- };
- AppRouter.prototype._queueInstruction = function _queueInstruction(instruction) {
- var _this11 = this;
- return new Promise(function (resolve) {
- instruction.resolve = resolve;
- _this11._queue.unshift(instruction);
- _this11._dequeueInstruction();
- });
- };
- AppRouter.prototype._dequeueInstruction = function _dequeueInstruction() {
- var _this12 = this;
- var instructionCount = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];
- return Promise.resolve().then(function () {
- if (_this12.isNavigating && !instructionCount) {
- return undefined;
- }
- var instruction = _this12._queue.shift();
- _this12._queue.length = 0;
- if (!instruction) {
- return undefined;
- }
- _this12.isNavigating = true;
- instruction.previousInstruction = _this12.currentInstruction;
- if (!instructionCount) {
- _this12.events.publish('router:navigation:processing', { instruction: instruction });
- } else if (instructionCount === _this12.maxInstructionCount - 1) {
- logger.error(instructionCount + 1 + ' navigation instructions have been attempted without success. Restoring last known good location.');
- restorePreviousLocation(_this12);
- return _this12._dequeueInstruction(instructionCount + 1);
- } else if (instructionCount > _this12.maxInstructionCount) {
- throw new Error('Maximum navigation attempts exceeded. Giving up.');
- }
- var pipeline = _this12.pipelineProvider.createPipeline();
- return pipeline.run(instruction).then(function (result) {
- return processResult(instruction, result, instructionCount, _this12);
- }).catch(function (error) {
- return { output: error instanceof Error ? error : new Error(error) };
- }).then(function (result) {
- return resolveInstruction(instruction, result, !!instructionCount, _this12);
- });
- });
- };
- AppRouter.prototype._findViewModel = function _findViewModel(viewPort) {
- if (this.container.viewModel) {
- return this.container.viewModel;
- }
- if (viewPort.container) {
- var container = viewPort.container;
- while (container) {
- if (container.viewModel) {
- this.container.viewModel = container.viewModel;
- return container.viewModel;
- }
- container = container.parent;
- }
- }
- return undefined;
- };
- return AppRouter;
- }(Router);
- function processResult(instruction, result, instructionCount, router) {
- if (!(result && 'completed' in result && 'output' in result)) {
- result = result || {};
- result.output = new Error('Expected router pipeline to return a navigation result, but got [' + JSON.stringify(result) + '] instead.');
- }
- var finalResult = null;
- if (isNavigationCommand(result.output)) {
- result.output.navigate(router);
- } else {
- finalResult = result;
- if (!result.completed) {
- if (result.output instanceof Error) {
- logger.error(result.output);
- }
- restorePreviousLocation(router);
- }
- }
- return router._dequeueInstruction(instructionCount + 1).then(function (innerResult) {
- return finalResult || innerResult || result;
- });
- }
- function resolveInstruction(instruction, result, isInnerInstruction, router) {
- instruction.resolve(result);
- if (!isInnerInstruction) {
- router.isNavigating = false;
- var eventArgs = { instruction: instruction, result: result };
- var eventName = void 0;
- if (result.output instanceof Error) {
- eventName = 'error';
- } else if (!result.completed) {
- eventName = 'canceled';
- } else {
- var _queryString = instruction.queryString ? '?' + instruction.queryString : '';
- router.history.previousLocation = instruction.fragment + _queryString;
- eventName = 'success';
- }
- router.events.publish('router:navigation:' + eventName, eventArgs);
- router.events.publish('router:navigation:complete', eventArgs);
- }
- return result;
- }
- function restorePreviousLocation(router) {
- var previousLocation = router.history.previousLocation;
- if (previousLocation) {
- router.navigate(router.history.previousLocation, { trigger: false, replace: true });
- } else {
- logger.error('Router navigation failed, and no previous location could be restored.');
- }
- }
- });
- define('aurelia-logging-console',['exports', 'aurelia-logging'], function (exports, _aureliaLogging) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ConsoleAppender = undefined;
-
- var ConsoleAppender = exports.ConsoleAppender = function () {
- function ConsoleAppender() {
-
- }
- ConsoleAppender.prototype.debug = function debug(logger) {
- var _console;
- for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- rest[_key - 1] = arguments[_key];
- }
- (_console = console).debug.apply(_console, ['DEBUG [' + logger.id + ']'].concat(rest));
- };
- ConsoleAppender.prototype.info = function info(logger) {
- var _console2;
- for (var _len2 = arguments.length, rest = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- rest[_key2 - 1] = arguments[_key2];
- }
- (_console2 = console).info.apply(_console2, ['INFO [' + logger.id + ']'].concat(rest));
- };
- ConsoleAppender.prototype.warn = function warn(logger) {
- var _console3;
- for (var _len3 = arguments.length, rest = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
- rest[_key3 - 1] = arguments[_key3];
- }
- (_console3 = console).warn.apply(_console3, ['WARN [' + logger.id + ']'].concat(rest));
- };
- ConsoleAppender.prototype.error = function error(logger) {
- var _console4;
- for (var _len4 = arguments.length, rest = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
- rest[_key4 - 1] = arguments[_key4];
- }
- (_console4 = console).error.apply(_console4, ['ERROR [' + logger.id + ']'].concat(rest));
- };
- return ConsoleAppender;
- }();
- });
- define('aurelia-path',['exports'], function (exports) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.relativeToFile = relativeToFile;
- exports.join = join;
- exports.buildQueryString = buildQueryString;
- exports.parseQueryString = parseQueryString;
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
- };
- function trimDots(ary) {
- for (var i = 0; i < ary.length; ++i) {
- var part = ary[i];
- if (part === '.') {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === '..') {
- if (i === 0 || i === 1 && ary[2] === '..' || ary[i - 1] === '..') {
- continue;
- } else if (i > 0) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
- function relativeToFile(name, file) {
- var fileParts = file && file.split('/');
- var nameParts = name.trim().split('/');
- if (nameParts[0].charAt(0) === '.' && fileParts) {
- var normalizedBaseParts = fileParts.slice(0, fileParts.length - 1);
- nameParts.unshift.apply(nameParts, normalizedBaseParts);
- }
- trimDots(nameParts);
- return nameParts.join('/');
- }
- function join(path1, path2) {
- if (!path1) {
- return path2;
- }
- if (!path2) {
- return path1;
- }
- var schemeMatch = path1.match(/^([^/]*?:)\//);
- var scheme = schemeMatch && schemeMatch.length > 0 ? schemeMatch[1] : '';
- path1 = path1.substr(scheme.length);
- var urlPrefix = void 0;
- if (path1.indexOf('///') === 0 && scheme === 'file:') {
- urlPrefix = '///';
- } else if (path1.indexOf('//') === 0) {
- urlPrefix = '//';
- } else if (path1.indexOf('/') === 0) {
- urlPrefix = '/';
- } else {
- urlPrefix = '';
- }
- var trailingSlash = path2.slice(-1) === '/' ? '/' : '';
- var url1 = path1.split('/');
- var url2 = path2.split('/');
- var url3 = [];
- for (var i = 0, ii = url1.length; i < ii; ++i) {
- if (url1[i] === '..') {
- url3.pop();
- } else if (url1[i] === '.' || url1[i] === '') {
- continue;
- } else {
- url3.push(url1[i]);
- }
- }
- for (var _i = 0, _ii = url2.length; _i < _ii; ++_i) {
- if (url2[_i] === '..') {
- url3.pop();
- } else if (url2[_i] === '.' || url2[_i] === '') {
- continue;
- } else {
- url3.push(url2[_i]);
- }
- }
- return scheme + urlPrefix + url3.join('/') + trailingSlash;
- }
- var encode = encodeURIComponent;
- var encodeKey = function encodeKey(k) {
- return encode(k).replace('%24', '$');
- };
- function buildParam(key, value) {
- var result = [];
- if (value === null || value === undefined) {
- return result;
- }
- if (Array.isArray(value)) {
- for (var i = 0, l = value.length; i < l; i++) {
- var arrayKey = key + '[' + (_typeof(value[i]) === 'object' && value[i] !== null ? i : '') + ']';
- result = result.concat(buildParam(arrayKey, value[i]));
- }
- } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
- for (var propertyName in value) {
- result = result.concat(buildParam(key + '[' + propertyName + ']', value[propertyName]));
- }
- } else {
- result.push(encodeKey(key) + '=' + encode(value));
- }
- return result;
- }
- function buildQueryString(params) {
- var pairs = [];
- var keys = Object.keys(params || {}).sort();
- for (var i = 0, len = keys.length; i < len; i++) {
- var key = keys[i];
- pairs = pairs.concat(buildParam(key, params[key]));
- }
- if (pairs.length === 0) {
- return '';
- }
- return pairs.join('&');
- }
- function processScalarParam(existedParam, value, isPrimitive) {
- if (Array.isArray(existedParam)) {
- existedParam.push(value);
- return existedParam;
- }
- if (existedParam !== undefined) {
- return isPrimitive ? value : [existedParam, value];
- }
- return value;
- }
- function parseComplexParam(queryParams, keys, value) {
- var currentParams = queryParams;
- var keysLastIndex = keys.length - 1;
- for (var j = 0; j <= keysLastIndex; j++) {
- var key = keys[j] === '' ? currentParams.length : keys[j];
- if (j < keysLastIndex) {
- currentParams = currentParams[key] = currentParams[key] || (isNaN(keys[j + 1]) ? {} : []);
- } else {
- currentParams = currentParams[key] = value;
- }
- }
- }
- function parseQueryString(queryString) {
- var queryParams = {};
- if (!queryString || typeof queryString !== 'string') {
- return queryParams;
- }
- var query = queryString;
- if (query.charAt(0) === '?') {
- query = query.substr(1);
- }
- var pairs = query.replace(/\+/g, ' ').split('&');
- for (var i = 0; i < pairs.length; i++) {
- var pair = pairs[i].split('=');
- var key = decodeURIComponent(pair[0]);
- var isPrimitive = false;
- if (!key) {
- continue;
- }
- var keys = key.split('][');
- var keysLastIndex = keys.length - 1;
- if (/\[/.test(keys[0]) && /\]$/.test(keys[keysLastIndex])) {
- keys[keysLastIndex] = keys[keysLastIndex].replace(/\]$/, '');
- keys = keys.shift().split('[').concat(keys);
- keysLastIndex = keys.length - 1;
- } else {
- isPrimitive = true;
- keysLastIndex = 0;
- }
- if (pair.length >= 2) {
- var value = pair[1] ? decodeURIComponent(pair[1]) : '';
- if (keysLastIndex) {
- parseComplexParam(queryParams, keys, value);
- } else {
- queryParams[key] = processScalarParam(queryParams[key], value, isPrimitive);
- }
- } else {
- queryParams[key] = true;
- }
- }
- return queryParams;
- }
- });
- define('aurelia-pal-browser',['exports', 'aurelia-pal'], function (exports, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports._DOM = exports._FEATURE = exports._PLATFORM = undefined;
- exports._ensureFunctionName = _ensureFunctionName;
- exports._ensureClassList = _ensureClassList;
- exports._ensurePerformance = _ensurePerformance;
- exports._ensureCustomEvent = _ensureCustomEvent;
- exports._ensureElementMatches = _ensureElementMatches;
- exports._ensureHTMLTemplateElement = _ensureHTMLTemplateElement;
- exports.initialize = initialize;
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
- };
- var _PLATFORM = exports._PLATFORM = {
- location: window.location,
- history: window.history,
- addEventListener: function addEventListener(eventName, callback, capture) {
- this.global.addEventListener(eventName, callback, capture);
- },
- removeEventListener: function removeEventListener(eventName, callback, capture) {
- this.global.removeEventListener(eventName, callback, capture);
- },
- performance: window.performance,
- requestAnimationFrame: function requestAnimationFrame(callback) {
- return this.global.requestAnimationFrame(callback);
- }
- };
- function _ensureFunctionName() {
- function test() {}
- if (!test.name) {
- Object.defineProperty(Function.prototype, 'name', {
- get: function get() {
- var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];
- Object.defineProperty(this, 'name', { value: name });
- return name;
- }
- });
- }
- }
- function _ensureClassList() {
- if (!('classList' in document.createElement('_')) || document.createElementNS && !('classList' in document.createElementNS('http://www.w3.org/2000/svg', 'g'))) {
- (function () {
- var protoProp = 'prototype';
- var strTrim = String.prototype.trim;
- var arrIndexOf = Array.prototype.indexOf;
- var emptyArray = [];
- var DOMEx = function DOMEx(type, message) {
- this.name = type;
- this.code = DOMException[type];
- this.message = message;
- };
- var checkTokenAndGetIndex = function checkTokenAndGetIndex(classList, token) {
- if (token === '') {
- throw new DOMEx('SYNTAX_ERR', 'An invalid or illegal string was specified');
- }
- if (/\s/.test(token)) {
- throw new DOMEx('INVALID_CHARACTER_ERR', 'String contains an invalid character');
- }
- return arrIndexOf.call(classList, token);
- };
- var ClassList = function ClassList(elem) {
- var trimmedClasses = strTrim.call(elem.getAttribute('class') || '');
- var classes = trimmedClasses ? trimmedClasses.split(/\s+/) : emptyArray;
- for (var i = 0, ii = classes.length; i < ii; ++i) {
- this.push(classes[i]);
- }
- this._updateClassName = function () {
- elem.setAttribute('class', this.toString());
- };
- };
- var classListProto = ClassList[protoProp] = [];
- DOMEx[protoProp] = Error[protoProp];
- classListProto.item = function (i) {
- return this[i] || null;
- };
- classListProto.contains = function (token) {
- token += '';
- return checkTokenAndGetIndex(this, token) !== -1;
- };
- classListProto.add = function () {
- var tokens = arguments;
- var i = 0;
- var ii = tokens.length;
- var token = void 0;
- var updated = false;
- do {
- token = tokens[i] + '';
- if (checkTokenAndGetIndex(this, token) === -1) {
- this.push(token);
- updated = true;
- }
- } while (++i < ii);
- if (updated) {
- this._updateClassName();
- }
- };
- classListProto.remove = function () {
- var tokens = arguments;
- var i = 0;
- var ii = tokens.length;
- var token = void 0;
- var updated = false;
- var index = void 0;
- do {
- token = tokens[i] + '';
- index = checkTokenAndGetIndex(this, token);
- while (index !== -1) {
- this.splice(index, 1);
- updated = true;
- index = checkTokenAndGetIndex(this, token);
- }
- } while (++i < ii);
- if (updated) {
- this._updateClassName();
- }
- };
- classListProto.toggle = function (token, force) {
- token += '';
- var result = this.contains(token);
- var method = result ? force !== true && 'remove' : force !== false && 'add';
- if (method) {
- this[method](token);
- }
- if (force === true || force === false) {
- return force;
- }
- return !result;
- };
- classListProto.toString = function () {
- return this.join(' ');
- };
- Object.defineProperty(Element.prototype, 'classList', {
- get: function get() {
- return new ClassList(this);
- },
- enumerable: true,
- configurable: true
- });
- })();
- } else {
- var testElement = document.createElement('_');
- testElement.classList.add('c1', 'c2');
- if (!testElement.classList.contains('c2')) {
- var createMethod = function createMethod(method) {
- var original = DOMTokenList.prototype[method];
- DOMTokenList.prototype[method] = function (token) {
- for (var i = 0, ii = arguments.length; i < ii; ++i) {
- token = arguments[i];
- original.call(this, token);
- }
- };
- };
- createMethod('add');
- createMethod('remove');
- }
- testElement.classList.toggle('c3', false);
- if (testElement.classList.contains('c3')) {
- (function () {
- var _toggle = DOMTokenList.prototype.toggle;
- DOMTokenList.prototype.toggle = function (token, force) {
- if (1 in arguments && !this.contains(token) === !force) {
- return force;
- }
- return _toggle.call(this, token);
- };
- })();
- }
- testElement = null;
- }
- }
- function _ensurePerformance() {
- // @license http://opensource.org/licenses/MIT
- if ('performance' in window === false) {
- window.performance = {};
- }
- if ('now' in window.performance === false) {
- (function () {
- var nowOffset = Date.now();
- if (performance.timing && performance.timing.navigationStart) {
- nowOffset = performance.timing.navigationStart;
- }
- window.performance.now = function now() {
- return Date.now() - nowOffset;
- };
- })();
- }
- _PLATFORM.performance = window.performance;
- }
- function _ensureCustomEvent() {
- if (!window.CustomEvent || typeof window.CustomEvent !== 'function') {
- var _CustomEvent = function _CustomEvent(event, params) {
- params = params || {
- bubbles: false,
- cancelable: false,
- detail: undefined
- };
- var evt = document.createEvent('CustomEvent');
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
- return evt;
- };
- _CustomEvent.prototype = window.Event.prototype;
- window.CustomEvent = _CustomEvent;
- }
- }
- function _ensureElementMatches() {
- if (Element && !Element.prototype.matches) {
- var proto = Element.prototype;
- proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector;
- }
- }
- var _FEATURE = exports._FEATURE = {};
- _FEATURE.shadowDOM = function () {
- return !!HTMLElement.prototype.attachShadow;
- }();
- _FEATURE.scopedCSS = function () {
- return 'scoped' in document.createElement('style');
- }();
- _FEATURE.htmlTemplateElement = function () {
- return 'content' in document.createElement('template');
- }();
- _FEATURE.mutationObserver = function () {
- return !!(window.MutationObserver || window.WebKitMutationObserver);
- }();
- function _ensureHTMLTemplateElement() {
- function isSVGTemplate(el) {
- return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg';
- }
- function fixSVGTemplateElement(el) {
- var template = el.ownerDocument.createElement('template');
- var attrs = el.attributes;
- var length = attrs.length;
- var attr = void 0;
- el.parentNode.insertBefore(template, el);
- while (length-- > 0) {
- attr = attrs[length];
- template.setAttribute(attr.name, attr.value);
- el.removeAttribute(attr.name);
- }
- el.parentNode.removeChild(el);
- return fixHTMLTemplateElement(template);
- }
- function fixHTMLTemplateElement(template) {
- var content = template.content = document.createDocumentFragment();
- var child = void 0;
- while (child = template.firstChild) {
- content.appendChild(child);
- }
- return template;
- }
- function fixHTMLTemplateElementRoot(template) {
- var content = fixHTMLTemplateElement(template).content;
- var childTemplates = content.querySelectorAll('template');
- for (var i = 0, ii = childTemplates.length; i < ii; ++i) {
- var child = childTemplates[i];
- if (isSVGTemplate(child)) {
- fixSVGTemplateElement(child);
- } else {
- fixHTMLTemplateElement(child);
- }
- }
- return template;
- }
- if (_FEATURE.htmlTemplateElement) {
- _FEATURE.ensureHTMLTemplateElement = function (template) {
- return template;
- };
- } else {
- _FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot;
- }
- }
- var shadowPoly = window.ShadowDOMPolyfill || null;
- var _DOM = exports._DOM = {
- Element: Element,
- SVGElement: SVGElement,
- boundary: 'aurelia-dom-boundary',
- addEventListener: function addEventListener(eventName, callback, capture) {
- document.addEventListener(eventName, callback, capture);
- },
- removeEventListener: function removeEventListener(eventName, callback, capture) {
- document.removeEventListener(eventName, callback, capture);
- },
- adoptNode: function adoptNode(node) {
- return document.adoptNode(node, true);
- },
- createElement: function createElement(tagName) {
- return document.createElement(tagName);
- },
- createTextNode: function createTextNode(text) {
- return document.createTextNode(text);
- },
- createComment: function createComment(text) {
- return document.createComment(text);
- },
- createDocumentFragment: function createDocumentFragment() {
- return document.createDocumentFragment();
- },
- createMutationObserver: function createMutationObserver(callback) {
- return new (window.MutationObserver || window.WebKitMutationObserver)(callback);
- },
- createCustomEvent: function createCustomEvent(eventType, options) {
- return new window.CustomEvent(eventType, options);
- },
- dispatchEvent: function dispatchEvent(evt) {
- document.dispatchEvent(evt);
- },
- getComputedStyle: function getComputedStyle(element) {
- return window.getComputedStyle(element);
- },
- getElementById: function getElementById(id) {
- return document.getElementById(id);
- },
- querySelectorAll: function querySelectorAll(query) {
- return document.querySelectorAll(query);
- },
- nextElementSibling: function nextElementSibling(element) {
- if (element.nextElementSibling) {
- return element.nextElementSibling;
- }
- do {
- element = element.nextSibling;
- } while (element && element.nodeType !== 1);
- return element;
- },
- createTemplateFromMarkup: function createTemplateFromMarkup(markup) {
- var parser = document.createElement('div');
- parser.innerHTML = markup;
- var temp = parser.firstElementChild;
- if (!temp || temp.nodeName !== 'TEMPLATE') {
- throw new Error('Template markup must be wrapped in a <template> element e.g. <template> <!-- markup here --> </template>');
- }
- return _FEATURE.ensureHTMLTemplateElement(temp);
- },
- appendNode: function appendNode(newNode, parentNode) {
- (parentNode || document.body).appendChild(newNode);
- },
- replaceNode: function replaceNode(newNode, node, parentNode) {
- if (node.parentNode) {
- node.parentNode.replaceChild(newNode, node);
- } else if (shadowPoly !== null) {
- shadowPoly.unwrap(parentNode).replaceChild(shadowPoly.unwrap(newNode), shadowPoly.unwrap(node));
- } else {
- parentNode.replaceChild(newNode, node);
- }
- },
- removeNode: function removeNode(node, parentNode) {
- if (node.parentNode) {
- node.parentNode.removeChild(node);
- } else if (parentNode) {
- if (shadowPoly !== null) {
- shadowPoly.unwrap(parentNode).removeChild(shadowPoly.unwrap(node));
- } else {
- parentNode.removeChild(node);
- }
- }
- },
- injectStyles: function injectStyles(styles, destination, prepend) {
- var node = document.createElement('style');
- node.innerHTML = styles;
- node.type = 'text/css';
- destination = destination || document.head;
- if (prepend && destination.childNodes.length > 0) {
- destination.insertBefore(node, destination.childNodes[0]);
- } else {
- destination.appendChild(node);
- }
- return node;
- }
- };
- var isInitialized = false;
- function initialize() {
- if (isInitialized) {
- return;
- }
- isInitialized = true;
- _ensureCustomEvent();
- _ensureFunctionName();
- _ensureHTMLTemplateElement();
- _ensureElementMatches();
- _ensureClassList();
- _ensurePerformance();
- (0, _aureliaPal.initializePAL)(function (platform, feature, dom) {
- Object.assign(platform, _PLATFORM);
- Object.assign(feature, _FEATURE);
- Object.assign(dom, _DOM);
- (function (global) {
- global.console = global.console || {};
- var con = global.console;
- var prop = void 0;
- var method = void 0;
- var empty = {};
- var dummy = function dummy() {};
- var properties = 'memory'.split(',');
- var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');
- while (prop = properties.pop()) {
- if (!con[prop]) con[prop] = empty;
- }while (method = methods.pop()) {
- if (!con[method]) con[method] = dummy;
- }
- })(platform.global);
- if (platform.global.console && _typeof(console.log) === 'object') {
- ['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) {
- console[method] = this.bind(console[method], console);
- }, Function.prototype.call);
- }
- Object.defineProperty(dom, 'title', {
- get: function get() {
- return document.title;
- },
- set: function set(value) {
- document.title = value;
- }
- });
- Object.defineProperty(dom, 'activeElement', {
- get: function get() {
- return document.activeElement;
- }
- });
- Object.defineProperty(platform, 'XMLHttpRequest', {
- get: function get() {
- return platform.global.XMLHttpRequest;
- }
- });
- });
- }
- });
- define('aurelia-task-queue',['exports', 'aurelia-pal'], function (exports, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.TaskQueue = undefined;
-
- var hasSetImmediate = typeof setImmediate === 'function';
- function makeRequestFlushFromMutationObserver(flush) {
- var toggle = 1;
- var observer = _aureliaPal.DOM.createMutationObserver(flush);
- var node = _aureliaPal.DOM.createTextNode('');
- observer.observe(node, { characterData: true });
- return function requestFlush() {
- toggle = -toggle;
- node.data = toggle;
- };
- }
- function makeRequestFlushFromTimer(flush) {
- return function requestFlush() {
- var timeoutHandle = setTimeout(handleFlushTimer, 0);
- var intervalHandle = setInterval(handleFlushTimer, 50);
- function handleFlushTimer() {
- clearTimeout(timeoutHandle);
- clearInterval(intervalHandle);
- flush();
- }
- };
- }
- function onError(error, task) {
- if ('onError' in task) {
- task.onError(error);
- } else if (hasSetImmediate) {
- setImmediate(function () {
- throw error;
- });
- } else {
- setTimeout(function () {
- throw error;
- }, 0);
- }
- }
- var TaskQueue = exports.TaskQueue = function () {
- function TaskQueue() {
- var _this = this;
-
- this.microTaskQueue = [];
- this.microTaskQueueCapacity = 1024;
- this.taskQueue = [];
- if (_aureliaPal.FEATURE.mutationObserver) {
- this.requestFlushMicroTaskQueue = makeRequestFlushFromMutationObserver(function () {
- return _this.flushMicroTaskQueue();
- });
- } else {
- this.requestFlushMicroTaskQueue = makeRequestFlushFromTimer(function () {
- return _this.flushMicroTaskQueue();
- });
- }
- this.requestFlushTaskQueue = makeRequestFlushFromTimer(function () {
- return _this.flushTaskQueue();
- });
- }
- TaskQueue.prototype.queueMicroTask = function queueMicroTask(task) {
- if (this.microTaskQueue.length < 1) {
- this.requestFlushMicroTaskQueue();
- }
- this.microTaskQueue.push(task);
- };
- TaskQueue.prototype.queueTask = function queueTask(task) {
- if (this.taskQueue.length < 1) {
- this.requestFlushTaskQueue();
- }
- this.taskQueue.push(task);
- };
- TaskQueue.prototype.flushTaskQueue = function flushTaskQueue() {
- var queue = this.taskQueue;
- var index = 0;
- var task = void 0;
- this.taskQueue = [];
- try {
- while (index < queue.length) {
- task = queue[index];
- task.call();
- index++;
- }
- } catch (error) {
- onError(error, task);
- }
- };
- TaskQueue.prototype.flushMicroTaskQueue = function flushMicroTaskQueue() {
- var queue = this.microTaskQueue;
- var capacity = this.microTaskQueueCapacity;
- var index = 0;
- var task = void 0;
- try {
- while (index < queue.length) {
- task = queue[index];
- task.call();
- index++;
- if (index > capacity) {
- for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
- queue[scan] = queue[scan + index];
- }
- queue.length -= index;
- index = 0;
- }
- }
- } catch (error) {
- onError(error, task);
- }
- queue.length = 0;
- };
- return TaskQueue;
- }();
- });
- define('aurelia-templating-resources/aurelia-templating-resources',['exports', './compose', './if', './with', './repeat', './show', './hide', './sanitize-html', './replaceable', './focus', 'aurelia-templating', './css-resource', './html-sanitizer', './binding-mode-behaviors', './throttle-binding-behavior', './debounce-binding-behavior', './signal-binding-behavior', './binding-signaler', './update-trigger-binding-behavior', './abstract-repeater', './repeat-strategy-locator', './html-resource-plugin', './null-repeat-strategy', './array-repeat-strategy', './map-repeat-strategy', './set-repeat-strategy', './number-repeat-strategy', './repeat-utilities', './analyze-view-factory', './aurelia-hide-style'], function (exports, _compose, _if, _with, _repeat, _show, _hide, _sanitizeHtml, _replaceable, _focus, _aureliaTemplating, _cssResource, _htmlSanitizer, _bindingModeBehaviors, _throttleBindingBehavior, _debounceBindingBehavior, _signalBindingBehavior, _bindingSignaler, _updateTriggerBindingBehavior, _abstractRepeater, _repeatStrategyLocator, _htmlResourcePlugin, _nullRepeatStrategy, _arrayRepeatStrategy, _mapRepeatStrategy, _setRepeatStrategy, _numberRepeatStrategy, _repeatUtilities, _analyzeViewFactory, _aureliaHideStyle) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.viewsRequireLifecycle = exports.unwrapExpression = exports.updateOneTimeBinding = exports.isOneTime = exports.getItemsSourceExpression = exports.updateOverrideContext = exports.createFullOverrideContext = exports.NumberRepeatStrategy = exports.SetRepeatStrategy = exports.MapRepeatStrategy = exports.ArrayRepeatStrategy = exports.NullRepeatStrategy = exports.RepeatStrategyLocator = exports.AbstractRepeater = exports.UpdateTriggerBindingBehavior = exports.BindingSignaler = exports.SignalBindingBehavior = exports.DebounceBindingBehavior = exports.ThrottleBindingBehavior = exports.TwoWayBindingBehavior = exports.OneWayBindingBehavior = exports.OneTimeBindingBehavior = exports.configure = exports.Focus = exports.Replaceable = exports.SanitizeHTMLValueConverter = exports.HTMLSanitizer = exports.Hide = exports.Show = exports.Repeat = exports.With = exports.If = exports.Compose = undefined;
- function configure(config) {
- (0, _aureliaHideStyle.injectAureliaHideStyleAtHead)();
- config.globalResources('./compose', './if', './with', './repeat', './show', './hide', './replaceable', './sanitize-html', './focus', './binding-mode-behaviors', './throttle-binding-behavior', './debounce-binding-behavior', './signal-binding-behavior', './update-trigger-binding-behavior');
- (0, _htmlResourcePlugin.configure)(config);
- var viewEngine = config.container.get(_aureliaTemplating.ViewEngine);
- viewEngine.addResourcePlugin('.css', {
- 'fetch': function fetch(address) {
- var _ref;
- return _ref = {}, _ref[address] = (0, _cssResource._createCSSResource)(address), _ref;
- }
- });
- }
- exports.Compose = _compose.Compose;
- exports.If = _if.If;
- exports.With = _with.With;
- exports.Repeat = _repeat.Repeat;
- exports.Show = _show.Show;
- exports.Hide = _hide.Hide;
- exports.HTMLSanitizer = _htmlSanitizer.HTMLSanitizer;
- exports.SanitizeHTMLValueConverter = _sanitizeHtml.SanitizeHTMLValueConverter;
- exports.Replaceable = _replaceable.Replaceable;
- exports.Focus = _focus.Focus;
- exports.configure = configure;
- exports.OneTimeBindingBehavior = _bindingModeBehaviors.OneTimeBindingBehavior;
- exports.OneWayBindingBehavior = _bindingModeBehaviors.OneWayBindingBehavior;
- exports.TwoWayBindingBehavior = _bindingModeBehaviors.TwoWayBindingBehavior;
- exports.ThrottleBindingBehavior = _throttleBindingBehavior.ThrottleBindingBehavior;
- exports.DebounceBindingBehavior = _debounceBindingBehavior.DebounceBindingBehavior;
- exports.SignalBindingBehavior = _signalBindingBehavior.SignalBindingBehavior;
- exports.BindingSignaler = _bindingSignaler.BindingSignaler;
- exports.UpdateTriggerBindingBehavior = _updateTriggerBindingBehavior.UpdateTriggerBindingBehavior;
- exports.AbstractRepeater = _abstractRepeater.AbstractRepeater;
- exports.RepeatStrategyLocator = _repeatStrategyLocator.RepeatStrategyLocator;
- exports.NullRepeatStrategy = _nullRepeatStrategy.NullRepeatStrategy;
- exports.ArrayRepeatStrategy = _arrayRepeatStrategy.ArrayRepeatStrategy;
- exports.MapRepeatStrategy = _mapRepeatStrategy.MapRepeatStrategy;
- exports.SetRepeatStrategy = _setRepeatStrategy.SetRepeatStrategy;
- exports.NumberRepeatStrategy = _numberRepeatStrategy.NumberRepeatStrategy;
- exports.createFullOverrideContext = _repeatUtilities.createFullOverrideContext;
- exports.updateOverrideContext = _repeatUtilities.updateOverrideContext;
- exports.getItemsSourceExpression = _repeatUtilities.getItemsSourceExpression;
- exports.isOneTime = _repeatUtilities.isOneTime;
- exports.updateOneTimeBinding = _repeatUtilities.updateOneTimeBinding;
- exports.unwrapExpression = _repeatUtilities.unwrapExpression;
- exports.viewsRequireLifecycle = _analyzeViewFactory.viewsRequireLifecycle;
- });;define('aurelia-templating-resources', ['aurelia-templating-resources/aurelia-templating-resources'], function (main) { return main; });
- define('aurelia-templating-resources/compose',['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia-templating', 'aurelia-pal'], function (exports, _aureliaDependencyInjection, _aureliaTaskQueue, _aureliaTemplating, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Compose = undefined;
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
- return desc;
- }
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
- var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3;
- var Compose = exports.Compose = (_dec = (0, _aureliaTemplating.customElement)('compose'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaDependencyInjection.Container, _aureliaTemplating.CompositionEngine, _aureliaTemplating.ViewSlot, _aureliaTemplating.ViewResources, _aureliaTaskQueue.TaskQueue), _dec(_class = (0, _aureliaTemplating.noView)(_class = _dec2(_class = (_class2 = function () {
- function Compose(element, container, compositionEngine, viewSlot, viewResources, taskQueue) {
-
- _initDefineProp(this, 'model', _descriptor, this);
- _initDefineProp(this, 'view', _descriptor2, this);
- _initDefineProp(this, 'viewModel', _descriptor3, this);
- this.element = element;
- this.container = container;
- this.compositionEngine = compositionEngine;
- this.viewSlot = viewSlot;
- this.viewResources = viewResources;
- this.taskQueue = taskQueue;
- this.currentController = null;
- this.currentViewModel = null;
- }
- Compose.prototype.created = function created(owningView) {
- this.owningView = owningView;
- };
- Compose.prototype.bind = function bind(bindingContext, overrideContext) {
- this.bindingContext = bindingContext;
- this.overrideContext = overrideContext;
- processInstruction(this, createInstruction(this, {
- view: this.view,
- viewModel: this.viewModel,
- model: this.model
- }));
- };
- Compose.prototype.unbind = function unbind(bindingContext, overrideContext) {
- this.bindingContext = null;
- this.overrideContext = null;
- var returnToCache = true;
- var skipAnimation = true;
- this.viewSlot.removeAll(returnToCache, skipAnimation);
- };
- Compose.prototype.modelChanged = function modelChanged(newValue, oldValue) {
- var _this = this;
- if (this.currentInstruction) {
- this.currentInstruction.model = newValue;
- return;
- }
- this.taskQueue.queueMicroTask(function () {
- if (_this.currentInstruction) {
- _this.currentInstruction.model = newValue;
- return;
- }
- var vm = _this.currentViewModel;
- if (vm && typeof vm.activate === 'function') {
- vm.activate(newValue);
- }
- });
- };
- Compose.prototype.viewChanged = function viewChanged(newValue, oldValue) {
- var _this2 = this;
- var instruction = createInstruction(this, {
- view: newValue,
- viewModel: this.currentViewModel || this.viewModel,
- model: this.model
- });
- if (this.currentInstruction) {
- this.currentInstruction = instruction;
- return;
- }
- this.currentInstruction = instruction;
- this.taskQueue.queueMicroTask(function () {
- return processInstruction(_this2, _this2.currentInstruction);
- });
- };
- Compose.prototype.viewModelChanged = function viewModelChanged(newValue, oldValue) {
- var _this3 = this;
- var instruction = createInstruction(this, {
- viewModel: newValue,
- view: this.view,
- model: this.model
- });
- if (this.currentInstruction) {
- this.currentInstruction = instruction;
- return;
- }
- this.currentInstruction = instruction;
- this.taskQueue.queueMicroTask(function () {
- return processInstruction(_this3, _this3.currentInstruction);
- });
- };
- return Compose;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'model', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'view', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'viewModel', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class) || _class) || _class);
- function createInstruction(composer, instruction) {
- return Object.assign(instruction, {
- bindingContext: composer.bindingContext,
- overrideContext: composer.overrideContext,
- owningView: composer.owningView,
- container: composer.container,
- viewSlot: composer.viewSlot,
- viewResources: composer.viewResources,
- currentController: composer.currentController,
- host: composer.element
- });
- }
- function processInstruction(composer, instruction) {
- composer.currentInstruction = null;
- composer.compositionEngine.compose(instruction).then(function (controller) {
- composer.currentController = controller;
- composer.currentViewModel = controller ? controller.viewModel : null;
- });
- }
- });
- define('aurelia-templating-resources/if',['exports', 'aurelia-templating', 'aurelia-dependency-injection'], function (exports, _aureliaTemplating, _aureliaDependencyInjection) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.If = undefined;
-
- var _dec, _dec2, _class;
- var If = exports.If = (_dec = (0, _aureliaTemplating.customAttribute)('if'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot), _dec(_class = (0, _aureliaTemplating.templateController)(_class = _dec2(_class = function () {
- function If(viewFactory, viewSlot) {
-
- this.viewFactory = viewFactory;
- this.viewSlot = viewSlot;
- this.showing = false;
- this.view = null;
- this.bindingContext = null;
- this.overrideContext = null;
- }
- If.prototype.bind = function bind(bindingContext, overrideContext) {
- this.bindingContext = bindingContext;
- this.overrideContext = overrideContext;
- this.valueChanged(this.value);
- };
- If.prototype.valueChanged = function valueChanged(newValue) {
- var _this = this;
- if (this.__queuedChanges) {
- this.__queuedChanges.push(newValue);
- return;
- }
- var maybePromise = this._runValueChanged(newValue);
- if (maybePromise instanceof Promise) {
- (function () {
- var queuedChanges = _this.__queuedChanges = [];
- var runQueuedChanges = function runQueuedChanges() {
- if (!queuedChanges.length) {
- _this.__queuedChanges = undefined;
- return;
- }
- var nextPromise = _this._runValueChanged(queuedChanges.shift()) || Promise.resolve();
- nextPromise.then(runQueuedChanges);
- };
- maybePromise.then(runQueuedChanges);
- })();
- }
- };
- If.prototype._runValueChanged = function _runValueChanged(newValue) {
- var _this2 = this;
- if (!newValue) {
- var viewOrPromise = void 0;
- if (this.view !== null && this.showing) {
- viewOrPromise = this.viewSlot.remove(this.view);
- if (viewOrPromise instanceof Promise) {
- viewOrPromise.then(function () {
- return _this2.view.unbind();
- });
- } else {
- this.view.unbind();
- }
- }
- this.showing = false;
- return viewOrPromise;
- }
- if (this.view === null) {
- this.view = this.viewFactory.create();
- }
- if (!this.view.isBound) {
- this.view.bind(this.bindingContext, this.overrideContext);
- }
- if (!this.showing) {
- this.showing = true;
- return this.viewSlot.add(this.view);
- }
- return undefined;
- };
- If.prototype.unbind = function unbind() {
- if (this.view === null) {
- return;
- }
- this.view.unbind();
- if (!this.viewFactory.isCaching) {
- return;
- }
- if (this.showing) {
- this.showing = false;
- this.viewSlot.remove(this.view, true, true);
- }
- this.view.returnToCache();
- this.view = null;
- };
- return If;
- }()) || _class) || _class) || _class);
- });
- define('aurelia-templating-resources/with',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-binding'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaBinding) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.With = undefined;
-
- var _dec, _dec2, _class;
- var With = exports.With = (_dec = (0, _aureliaTemplating.customAttribute)('with'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot), _dec(_class = (0, _aureliaTemplating.templateController)(_class = _dec2(_class = function () {
- function With(viewFactory, viewSlot) {
-
- this.viewFactory = viewFactory;
- this.viewSlot = viewSlot;
- this.parentOverrideContext = null;
- this.view = null;
- }
- With.prototype.bind = function bind(bindingContext, overrideContext) {
- this.parentOverrideContext = overrideContext;
- this.valueChanged(this.value);
- };
- With.prototype.valueChanged = function valueChanged(newValue) {
- var overrideContext = (0, _aureliaBinding.createOverrideContext)(newValue, this.parentOverrideContext);
- if (!this.view) {
- this.view = this.viewFactory.create();
- this.view.bind(newValue, overrideContext);
- this.viewSlot.add(this.view);
- } else {
- this.view.bind(newValue, overrideContext);
- }
- };
- With.prototype.unbind = function unbind() {
- this.parentOverrideContext = null;
- if (this.view) {
- this.view.unbind();
- }
- };
- return With;
- }()) || _class) || _class) || _class);
- });
- define('aurelia-templating-resources/repeat',['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-templating', './repeat-strategy-locator', './repeat-utilities', './analyze-view-factory', './abstract-repeater'], function (exports, _aureliaDependencyInjection, _aureliaBinding, _aureliaTemplating, _repeatStrategyLocator, _repeatUtilities, _analyzeViewFactory, _abstractRepeater) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Repeat = undefined;
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
-
- function _possibleConstructorReturn(self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
- }
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
- }
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
- return desc;
- }
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
- var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
- var Repeat = exports.Repeat = (_dec = (0, _aureliaTemplating.customAttribute)('repeat'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.TargetInstruction, _aureliaTemplating.ViewSlot, _aureliaTemplating.ViewResources, _aureliaBinding.ObserverLocator, _repeatStrategyLocator.RepeatStrategyLocator), _dec(_class = (0, _aureliaTemplating.templateController)(_class = _dec2(_class = (_class2 = function (_AbstractRepeater) {
- _inherits(Repeat, _AbstractRepeater);
- function Repeat(viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator) {
-
- var _this = _possibleConstructorReturn(this, _AbstractRepeater.call(this, {
- local: 'item',
- viewsRequireLifecycle: (0, _analyzeViewFactory.viewsRequireLifecycle)(viewFactory)
- }));
- _initDefineProp(_this, 'items', _descriptor, _this);
- _initDefineProp(_this, 'local', _descriptor2, _this);
- _initDefineProp(_this, 'key', _descriptor3, _this);
- _initDefineProp(_this, 'value', _descriptor4, _this);
- _this.viewFactory = viewFactory;
- _this.instruction = instruction;
- _this.viewSlot = viewSlot;
- _this.lookupFunctions = viewResources.lookupFunctions;
- _this.observerLocator = observerLocator;
- _this.key = 'key';
- _this.value = 'value';
- _this.strategyLocator = strategyLocator;
- _this.ignoreMutation = false;
- _this.sourceExpression = (0, _repeatUtilities.getItemsSourceExpression)(_this.instruction, 'repeat.for');
- _this.isOneTime = (0, _repeatUtilities.isOneTime)(_this.sourceExpression);
- _this.viewsRequireLifecycle = (0, _analyzeViewFactory.viewsRequireLifecycle)(viewFactory);
- return _this;
- }
- Repeat.prototype.call = function call(context, changes) {
- this[context](this.items, changes);
- };
- Repeat.prototype.bind = function bind(bindingContext, overrideContext) {
- this.scope = { bindingContext: bindingContext, overrideContext: overrideContext };
- this.matcherBinding = this._captureAndRemoveMatcherBinding();
- this.itemsChanged();
- };
- Repeat.prototype.unbind = function unbind() {
- this.scope = null;
- this.items = null;
- this.matcherBinding = null;
- this.viewSlot.removeAll(true);
- this._unsubscribeCollection();
- };
- Repeat.prototype._unsubscribeCollection = function _unsubscribeCollection() {
- if (this.collectionObserver) {
- this.collectionObserver.unsubscribe(this.callContext, this);
- this.collectionObserver = null;
- this.callContext = null;
- }
- };
- Repeat.prototype.itemsChanged = function itemsChanged() {
- this._unsubscribeCollection();
- if (!this.scope) {
- return;
- }
- var items = this.items;
- this.strategy = this.strategyLocator.getStrategy(items);
- if (!this.strategy) {
- throw new Error('Value for \'' + this.sourceExpression + '\' is non-repeatable');
- }
- if (!this.isOneTime && !this._observeInnerCollection()) {
- this._observeCollection();
- }
- this.strategy.instanceChanged(this, items);
- };
- Repeat.prototype._getInnerCollection = function _getInnerCollection() {
- var expression = (0, _repeatUtilities.unwrapExpression)(this.sourceExpression);
- if (!expression) {
- return null;
- }
- return expression.evaluate(this.scope, null);
- };
- Repeat.prototype.handleCollectionMutated = function handleCollectionMutated(collection, changes) {
- if (!this.collectionObserver) {
- return;
- }
- this.strategy.instanceMutated(this, collection, changes);
- };
- Repeat.prototype.handleInnerCollectionMutated = function handleInnerCollectionMutated(collection, changes) {
- var _this2 = this;
- if (!this.collectionObserver) {
- return;
- }
- if (this.ignoreMutation) {
- return;
- }
- this.ignoreMutation = true;
- var newItems = this.sourceExpression.evaluate(this.scope, this.lookupFunctions);
- this.observerLocator.taskQueue.queueMicroTask(function () {
- return _this2.ignoreMutation = false;
- });
- if (newItems === this.items) {
- this.itemsChanged();
- } else {
- this.items = newItems;
- }
- };
- Repeat.prototype._observeInnerCollection = function _observeInnerCollection() {
- var items = this._getInnerCollection();
- var strategy = this.strategyLocator.getStrategy(items);
- if (!strategy) {
- return false;
- }
- this.collectionObserver = strategy.getCollectionObserver(this.observerLocator, items);
- if (!this.collectionObserver) {
- return false;
- }
- this.callContext = 'handleInnerCollectionMutated';
- this.collectionObserver.subscribe(this.callContext, this);
- return true;
- };
- Repeat.prototype._observeCollection = function _observeCollection() {
- var items = this.items;
- this.collectionObserver = this.strategy.getCollectionObserver(this.observerLocator, items);
- if (this.collectionObserver) {
- this.callContext = 'handleCollectionMutated';
- this.collectionObserver.subscribe(this.callContext, this);
- }
- };
- Repeat.prototype._captureAndRemoveMatcherBinding = function _captureAndRemoveMatcherBinding() {
- if (this.viewFactory.viewFactory) {
- var instructions = this.viewFactory.viewFactory.instructions;
- var instructionIds = Object.keys(instructions);
- for (var i = 0; i < instructionIds.length; i++) {
- var expressions = instructions[instructionIds[i]].expressions;
- if (expressions) {
- for (var ii = 0; i < expressions.length; i++) {
- if (expressions[ii].targetProperty === 'matcher') {
- var matcherBinding = expressions[ii];
- expressions.splice(ii, 1);
- return matcherBinding;
- }
- }
- }
- }
- }
- return undefined;
- };
- Repeat.prototype.viewCount = function viewCount() {
- return this.viewSlot.children.length;
- };
- Repeat.prototype.views = function views() {
- return this.viewSlot.children;
- };
- Repeat.prototype.view = function view(index) {
- return this.viewSlot.children[index];
- };
- Repeat.prototype.matcher = function matcher() {
- return this.matcherBinding ? this.matcherBinding.sourceExpression.evaluate(this.scope, this.matcherBinding.lookupFunctions) : null;
- };
- Repeat.prototype.addView = function addView(bindingContext, overrideContext) {
- var view = this.viewFactory.create();
- view.bind(bindingContext, overrideContext);
- this.viewSlot.add(view);
- };
- Repeat.prototype.insertView = function insertView(index, bindingContext, overrideContext) {
- var view = this.viewFactory.create();
- view.bind(bindingContext, overrideContext);
- this.viewSlot.insert(index, view);
- };
- Repeat.prototype.moveView = function moveView(sourceIndex, targetIndex) {
- this.viewSlot.move(sourceIndex, targetIndex);
- };
- Repeat.prototype.removeAllViews = function removeAllViews(returnToCache, skipAnimation) {
- return this.viewSlot.removeAll(returnToCache, skipAnimation);
- };
- Repeat.prototype.removeViews = function removeViews(viewsToRemove, returnToCache, skipAnimation) {
- return this.viewSlot.removeMany(viewsToRemove, returnToCache, skipAnimation);
- };
- Repeat.prototype.removeView = function removeView(index, returnToCache, skipAnimation) {
- return this.viewSlot.removeAt(index, returnToCache, skipAnimation);
- };
- Repeat.prototype.updateBindings = function updateBindings(view) {
- var j = view.bindings.length;
- while (j--) {
- (0, _repeatUtilities.updateOneTimeBinding)(view.bindings[j]);
- }
- j = view.controllers.length;
- while (j--) {
- var k = view.controllers[j].boundProperties.length;
- while (k--) {
- var binding = view.controllers[j].boundProperties[k].binding;
- (0, _repeatUtilities.updateOneTimeBinding)(binding);
- }
- }
- };
- return Repeat;
- }(_abstractRepeater.AbstractRepeater), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'items', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'local', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'key', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'value', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class) || _class) || _class);
- });
- define('aurelia-templating-resources/repeat-strategy-locator',['exports', './null-repeat-strategy', './array-repeat-strategy', './map-repeat-strategy', './set-repeat-strategy', './number-repeat-strategy'], function (exports, _nullRepeatStrategy, _arrayRepeatStrategy, _mapRepeatStrategy, _setRepeatStrategy, _numberRepeatStrategy) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.RepeatStrategyLocator = undefined;
-
- var RepeatStrategyLocator = exports.RepeatStrategyLocator = function () {
- function RepeatStrategyLocator() {
-
- this.matchers = [];
- this.strategies = [];
- this.addStrategy(function (items) {
- return items === null || items === undefined;
- }, new _nullRepeatStrategy.NullRepeatStrategy());
- this.addStrategy(function (items) {
- return items instanceof Array;
- }, new _arrayRepeatStrategy.ArrayRepeatStrategy());
- this.addStrategy(function (items) {
- return items instanceof Map;
- }, new _mapRepeatStrategy.MapRepeatStrategy());
- this.addStrategy(function (items) {
- return items instanceof Set;
- }, new _setRepeatStrategy.SetRepeatStrategy());
- this.addStrategy(function (items) {
- return typeof items === 'number';
- }, new _numberRepeatStrategy.NumberRepeatStrategy());
- }
- RepeatStrategyLocator.prototype.addStrategy = function addStrategy(matcher, strategy) {
- this.matchers.push(matcher);
- this.strategies.push(strategy);
- };
- RepeatStrategyLocator.prototype.getStrategy = function getStrategy(items) {
- var matchers = this.matchers;
- for (var i = 0, ii = matchers.length; i < ii; ++i) {
- if (matchers[i](items)) {
- return this.strategies[i];
- }
- }
- return null;
- };
- return RepeatStrategyLocator;
- }();
- });
- define('aurelia-templating-resources/null-repeat-strategy',["exports"], function (exports) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var NullRepeatStrategy = exports.NullRepeatStrategy = function () {
- function NullRepeatStrategy() {
-
- }
- NullRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
- repeat.removeAllViews(true);
- };
- NullRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {};
- return NullRepeatStrategy;
- }();
- });
- define('aurelia-templating-resources/array-repeat-strategy',['exports', './repeat-utilities', 'aurelia-binding'], function (exports, _repeatUtilities, _aureliaBinding) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ArrayRepeatStrategy = undefined;
-
- var ArrayRepeatStrategy = exports.ArrayRepeatStrategy = function () {
- function ArrayRepeatStrategy() {
-
- }
- ArrayRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
- return observerLocator.getArrayObserver(items);
- };
- ArrayRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
- var _this = this;
- var itemsLength = items.length;
- if (!items || itemsLength === 0) {
- repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- return;
- }
- var children = repeat.views();
- var viewsLength = children.length;
- if (viewsLength === 0) {
- this._standardProcessInstanceChanged(repeat, items);
- return;
- }
- if (repeat.viewsRequireLifecycle) {
- (function () {
- var childrenSnapshot = children.slice(0);
- var itemNameInBindingContext = repeat.local;
- var matcher = repeat.matcher();
- var itemsPreviouslyInViews = [];
- var viewsToRemove = [];
- for (var index = 0; index < viewsLength; index++) {
- var view = childrenSnapshot[index];
- var oldItem = view.bindingContext[itemNameInBindingContext];
- if ((0, _repeatUtilities.indexOf)(items, oldItem, matcher) === -1) {
- viewsToRemove.push(view);
- } else {
- itemsPreviouslyInViews.push(oldItem);
- }
- }
- var updateViews = void 0;
- var removePromise = void 0;
- if (itemsPreviouslyInViews.length > 0) {
- removePromise = repeat.removeViews(viewsToRemove, true, !repeat.viewsRequireLifecycle);
- updateViews = function updateViews() {
- for (var _index = 0; _index < itemsLength; _index++) {
- var item = items[_index];
- var indexOfView = (0, _repeatUtilities.indexOf)(itemsPreviouslyInViews, item, matcher, _index);
- var _view = void 0;
- if (indexOfView === -1) {
- var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[_index], _index, itemsLength);
- repeat.insertView(_index, overrideContext.bindingContext, overrideContext);
- itemsPreviouslyInViews.splice(_index, 0, undefined);
- } else if (indexOfView === _index) {
- _view = children[indexOfView];
- itemsPreviouslyInViews[indexOfView] = undefined;
- } else {
- _view = children[indexOfView];
- repeat.moveView(indexOfView, _index);
- itemsPreviouslyInViews.splice(indexOfView, 1);
- itemsPreviouslyInViews.splice(_index, 0, undefined);
- }
- if (_view) {
- (0, _repeatUtilities.updateOverrideContext)(_view.overrideContext, _index, itemsLength);
- }
- }
- _this._inPlaceProcessItems(repeat, items);
- };
- } else {
- removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- updateViews = function updateViews() {
- return _this._standardProcessInstanceChanged(repeat, items);
- };
- }
- if (removePromise instanceof Promise) {
- removePromise.then(updateViews);
- } else {
- updateViews();
- }
- })();
- } else {
- this._inPlaceProcessItems(repeat, items);
- }
- };
- ArrayRepeatStrategy.prototype._standardProcessInstanceChanged = function _standardProcessInstanceChanged(repeat, items) {
- for (var i = 0, ii = items.length; i < ii; i++) {
- var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[i], i, ii);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- }
- };
- ArrayRepeatStrategy.prototype._inPlaceProcessItems = function _inPlaceProcessItems(repeat, items) {
- var itemsLength = items.length;
- var viewsLength = repeat.viewCount();
- while (viewsLength > itemsLength) {
- viewsLength--;
- repeat.removeView(viewsLength, true, !repeat.viewsRequireLifecycle);
- }
- var local = repeat.local;
- for (var i = 0; i < viewsLength; i++) {
- var view = repeat.view(i);
- var last = i === itemsLength - 1;
- var middle = i !== 0 && !last;
- if (view.bindingContext[local] === items[i] && view.overrideContext.$middle === middle && view.overrideContext.$last === last) {
- continue;
- }
- view.bindingContext[local] = items[i];
- view.overrideContext.$middle = middle;
- view.overrideContext.$last = last;
- repeat.updateBindings(view);
- }
- for (var _i = viewsLength; _i < itemsLength; _i++) {
- var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[_i], _i, itemsLength);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- }
- };
- ArrayRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, array, splices) {
- var _this2 = this;
- if (repeat.__queuedSplices) {
- for (var i = 0, ii = splices.length; i < ii; ++i) {
- var _splices$i = splices[i];
- var index = _splices$i.index;
- var removed = _splices$i.removed;
- var addedCount = _splices$i.addedCount;
- (0, _aureliaBinding.mergeSplice)(repeat.__queuedSplices, index, removed, addedCount);
- }
- repeat.__array = array.slice(0);
- return;
- }
- var maybePromise = this._runSplices(repeat, array.slice(0), splices);
- if (maybePromise instanceof Promise) {
- (function () {
- var queuedSplices = repeat.__queuedSplices = [];
- var runQueuedSplices = function runQueuedSplices() {
- if (!queuedSplices.length) {
- repeat.__queuedSplices = undefined;
- repeat.__array = undefined;
- return;
- }
- var nextPromise = _this2._runSplices(repeat, repeat.__array, queuedSplices) || Promise.resolve();
- queuedSplices = repeat.__queuedSplices = [];
- nextPromise.then(runQueuedSplices);
- };
- maybePromise.then(runQueuedSplices);
- })();
- }
- };
- ArrayRepeatStrategy.prototype._runSplices = function _runSplices(repeat, array, splices) {
- var _this3 = this;
- var removeDelta = 0;
- var rmPromises = [];
- for (var i = 0, ii = splices.length; i < ii; ++i) {
- var splice = splices[i];
- var removed = splice.removed;
- for (var j = 0, jj = removed.length; j < jj; ++j) {
- var viewOrPromise = repeat.removeView(splice.index + removeDelta + rmPromises.length, true);
- if (viewOrPromise instanceof Promise) {
- rmPromises.push(viewOrPromise);
- }
- }
- removeDelta -= splice.addedCount;
- }
- if (rmPromises.length > 0) {
- return Promise.all(rmPromises).then(function () {
- var spliceIndexLow = _this3._handleAddedSplices(repeat, array, splices);
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), spliceIndexLow);
- });
- }
- var spliceIndexLow = this._handleAddedSplices(repeat, array, splices);
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), spliceIndexLow);
- return undefined;
- };
- ArrayRepeatStrategy.prototype._handleAddedSplices = function _handleAddedSplices(repeat, array, splices) {
- var spliceIndex = void 0;
- var spliceIndexLow = void 0;
- var arrayLength = array.length;
- for (var i = 0, ii = splices.length; i < ii; ++i) {
- var splice = splices[i];
- var addIndex = spliceIndex = splice.index;
- var end = splice.index + splice.addedCount;
- if (typeof spliceIndexLow === 'undefined' || spliceIndexLow === null || spliceIndexLow > splice.index) {
- spliceIndexLow = spliceIndex;
- }
- for (; addIndex < end; ++addIndex) {
- var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, array[addIndex], addIndex, arrayLength);
- repeat.insertView(addIndex, overrideContext.bindingContext, overrideContext);
- }
- }
- return spliceIndexLow;
- };
- return ArrayRepeatStrategy;
- }();
- });
- define('aurelia-templating-resources/repeat-utilities',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.updateOverrideContexts = updateOverrideContexts;
- exports.createFullOverrideContext = createFullOverrideContext;
- exports.updateOverrideContext = updateOverrideContext;
- exports.getItemsSourceExpression = getItemsSourceExpression;
- exports.unwrapExpression = unwrapExpression;
- exports.isOneTime = isOneTime;
- exports.updateOneTimeBinding = updateOneTimeBinding;
- exports.indexOf = indexOf;
- var oneTime = _aureliaBinding.bindingMode.oneTime;
- function updateOverrideContexts(views, startIndex) {
- var length = views.length;
- if (startIndex > 0) {
- startIndex = startIndex - 1;
- }
- for (; startIndex < length; ++startIndex) {
- updateOverrideContext(views[startIndex].overrideContext, startIndex, length);
- }
- }
- function createFullOverrideContext(repeat, data, index, length, key) {
- var bindingContext = {};
- var overrideContext = (0, _aureliaBinding.createOverrideContext)(bindingContext, repeat.scope.overrideContext);
- if (typeof key !== 'undefined') {
- bindingContext[repeat.key] = key;
- bindingContext[repeat.value] = data;
- } else {
- bindingContext[repeat.local] = data;
- }
- updateOverrideContext(overrideContext, index, length);
- return overrideContext;
- }
- function updateOverrideContext(overrideContext, index, length) {
- var first = index === 0;
- var last = index === length - 1;
- var even = index % 2 === 0;
- overrideContext.$index = index;
- overrideContext.$first = first;
- overrideContext.$last = last;
- overrideContext.$middle = !(first || last);
- overrideContext.$odd = !even;
- overrideContext.$even = even;
- }
- function getItemsSourceExpression(instruction, attrName) {
- return instruction.behaviorInstructions.filter(function (bi) {
- return bi.originalAttrName === attrName;
- })[0].attributes.items.sourceExpression;
- }
- function unwrapExpression(expression) {
- var unwrapped = false;
- while (expression instanceof _aureliaBinding.BindingBehavior) {
- expression = expression.expression;
- }
- while (expression instanceof _aureliaBinding.ValueConverter) {
- expression = expression.expression;
- unwrapped = true;
- }
- return unwrapped ? expression : null;
- }
- function isOneTime(expression) {
- while (expression instanceof _aureliaBinding.BindingBehavior) {
- if (expression.name === 'oneTime') {
- return true;
- }
- expression = expression.expression;
- }
- return false;
- }
- function updateOneTimeBinding(binding) {
- if (binding.call && binding.mode === oneTime) {
- binding.call(_aureliaBinding.sourceContext);
- } else if (binding.updateOneTimeBindings) {
- binding.updateOneTimeBindings();
- }
- }
- function indexOf(array, item, matcher, startIndex) {
- if (!matcher) {
- return array.indexOf(item);
- }
- var length = array.length;
- for (var index = startIndex || 0; index < length; index++) {
- if (matcher(array[index], item)) {
- return index;
- }
- }
- return -1;
- }
- });
- define('aurelia-templating-resources/map-repeat-strategy',['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.MapRepeatStrategy = undefined;
-
- var MapRepeatStrategy = exports.MapRepeatStrategy = function () {
- function MapRepeatStrategy() {
-
- }
- MapRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
- return observerLocator.getMapObserver(items);
- };
- MapRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
- var _this = this;
- var removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- if (removePromise instanceof Promise) {
- removePromise.then(function () {
- return _this._standardProcessItems(repeat, items);
- });
- return;
- }
- this._standardProcessItems(repeat, items);
- };
- MapRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, items) {
- var index = 0;
- var overrideContext = void 0;
- items.forEach(function (value, key) {
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, value, index, items.size, key);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- ++index;
- });
- };
- MapRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, map, records) {
- var key = void 0;
- var i = void 0;
- var ii = void 0;
- var overrideContext = void 0;
- var removeIndex = void 0;
- var record = void 0;
- var rmPromises = [];
- var viewOrPromise = void 0;
- for (i = 0, ii = records.length; i < ii; ++i) {
- record = records[i];
- key = record.key;
- switch (record.type) {
- case 'update':
- removeIndex = this._getViewIndexByKey(repeat, key);
- viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);
- if (viewOrPromise instanceof Promise) {
- rmPromises.push(viewOrPromise);
- }
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, map.get(key), removeIndex, map.size, key);
- repeat.insertView(removeIndex, overrideContext.bindingContext, overrideContext);
- break;
- case 'add':
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, map.get(key), map.size - 1, map.size, key);
- repeat.insertView(map.size - 1, overrideContext.bindingContext, overrideContext);
- break;
- case 'delete':
- if (record.oldValue === undefined) {
- return;
- }
- removeIndex = this._getViewIndexByKey(repeat, key);
- viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);
- if (viewOrPromise instanceof Promise) {
- rmPromises.push(viewOrPromise);
- }
- break;
- case 'clear':
- repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- break;
- default:
- continue;
- }
- }
- if (rmPromises.length > 0) {
- Promise.all(rmPromises).then(function () {
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- });
- } else {
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- }
- };
- MapRepeatStrategy.prototype._getViewIndexByKey = function _getViewIndexByKey(repeat, key) {
- var i = void 0;
- var ii = void 0;
- var child = void 0;
- for (i = 0, ii = repeat.viewCount(); i < ii; ++i) {
- child = repeat.view(i);
- if (child.bindingContext[repeat.key] === key) {
- return i;
- }
- }
- return undefined;
- };
- return MapRepeatStrategy;
- }();
- });
- define('aurelia-templating-resources/set-repeat-strategy',['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.SetRepeatStrategy = undefined;
-
- var SetRepeatStrategy = exports.SetRepeatStrategy = function () {
- function SetRepeatStrategy() {
-
- }
- SetRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
- return observerLocator.getSetObserver(items);
- };
- SetRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
- var _this = this;
- var removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- if (removePromise instanceof Promise) {
- removePromise.then(function () {
- return _this._standardProcessItems(repeat, items);
- });
- return;
- }
- this._standardProcessItems(repeat, items);
- };
- SetRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, items) {
- var index = 0;
- var overrideContext = void 0;
- items.forEach(function (value) {
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, value, index, items.size);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- ++index;
- });
- };
- SetRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, set, records) {
- var value = void 0;
- var i = void 0;
- var ii = void 0;
- var overrideContext = void 0;
- var removeIndex = void 0;
- var record = void 0;
- var rmPromises = [];
- var viewOrPromise = void 0;
- for (i = 0, ii = records.length; i < ii; ++i) {
- record = records[i];
- value = record.value;
- switch (record.type) {
- case 'add':
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, value, set.size - 1, set.size);
- repeat.insertView(set.size - 1, overrideContext.bindingContext, overrideContext);
- break;
- case 'delete':
- removeIndex = this._getViewIndexByValue(repeat, value);
- viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);
- if (viewOrPromise instanceof Promise) {
- rmPromises.push(viewOrPromise);
- }
- break;
- case 'clear':
- repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- break;
- default:
- continue;
- }
- }
- if (rmPromises.length > 0) {
- Promise.all(rmPromises).then(function () {
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- });
- } else {
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- }
- };
- SetRepeatStrategy.prototype._getViewIndexByValue = function _getViewIndexByValue(repeat, value) {
- var i = void 0;
- var ii = void 0;
- var child = void 0;
- for (i = 0, ii = repeat.viewCount(); i < ii; ++i) {
- child = repeat.view(i);
- if (child.bindingContext[repeat.local] === value) {
- return i;
- }
- }
- return undefined;
- };
- return SetRepeatStrategy;
- }();
- });
- define('aurelia-templating-resources/number-repeat-strategy',['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.NumberRepeatStrategy = undefined;
-
- var NumberRepeatStrategy = exports.NumberRepeatStrategy = function () {
- function NumberRepeatStrategy() {
-
- }
- NumberRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver() {
- return null;
- };
- NumberRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, value) {
- var _this = this;
- var removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
- if (removePromise instanceof Promise) {
- removePromise.then(function () {
- return _this._standardProcessItems(repeat, value);
- });
- return;
- }
- this._standardProcessItems(repeat, value);
- };
- NumberRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, value) {
- var childrenLength = repeat.viewCount();
- var i = void 0;
- var ii = void 0;
- var overrideContext = void 0;
- var viewsToRemove = void 0;
- value = Math.floor(value);
- viewsToRemove = childrenLength - value;
- if (viewsToRemove > 0) {
- if (viewsToRemove > childrenLength) {
- viewsToRemove = childrenLength;
- }
- for (i = 0, ii = viewsToRemove; i < ii; ++i) {
- repeat.removeView(childrenLength - (i + 1), true, !repeat.viewsRequireLifecycle);
- }
- return;
- }
- for (i = childrenLength, ii = value; i < ii; ++i) {
- overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, i, i, ii);
- repeat.addView(overrideContext.bindingContext, overrideContext);
- }
- (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
- };
- return NumberRepeatStrategy;
- }();
- });
- define('aurelia-templating-resources/analyze-view-factory',['exports'], function (exports) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.viewsRequireLifecycle = viewsRequireLifecycle;
- var lifecycleOptionalBehaviors = exports.lifecycleOptionalBehaviors = ['focus', 'if', 'repeat', 'show', 'with'];
- function behaviorRequiresLifecycle(instruction) {
- var t = instruction.type;
- var name = t.elementName !== null ? t.elementName : t.attributeName;
- return lifecycleOptionalBehaviors.indexOf(name) === -1 && (t.handlesAttached || t.handlesBind || t.handlesCreated || t.handlesDetached || t.handlesUnbind) || t.viewFactory && viewsRequireLifecycle(t.viewFactory) || instruction.viewFactory && viewsRequireLifecycle(instruction.viewFactory);
- }
- function targetRequiresLifecycle(instruction) {
- var behaviors = instruction.behaviorInstructions;
- if (behaviors) {
- var i = behaviors.length;
- while (i--) {
- if (behaviorRequiresLifecycle(behaviors[i])) {
- return true;
- }
- }
- }
- return instruction.viewFactory && viewsRequireLifecycle(instruction.viewFactory);
- }
- function viewsRequireLifecycle(viewFactory) {
- if ('_viewsRequireLifecycle' in viewFactory) {
- return viewFactory._viewsRequireLifecycle;
- }
- viewFactory._viewsRequireLifecycle = false;
- if (viewFactory.viewFactory) {
- viewFactory._viewsRequireLifecycle = viewsRequireLifecycle(viewFactory.viewFactory);
- return viewFactory._viewsRequireLifecycle;
- }
- if (viewFactory.template.querySelector('.au-animate')) {
- viewFactory._viewsRequireLifecycle = true;
- return true;
- }
- for (var id in viewFactory.instructions) {
- if (targetRequiresLifecycle(viewFactory.instructions[id])) {
- viewFactory._viewsRequireLifecycle = true;
- return true;
- }
- }
- viewFactory._viewsRequireLifecycle = false;
- return false;
- }
- });
- define('aurelia-templating-resources/abstract-repeater',['exports'], function (exports) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var AbstractRepeater = exports.AbstractRepeater = function () {
- function AbstractRepeater(options) {
-
- Object.assign(this, {
- local: 'items',
- viewsRequireLifecycle: true
- }, options);
- }
- AbstractRepeater.prototype.viewCount = function viewCount() {
- throw new Error('subclass must implement `viewCount`');
- };
- AbstractRepeater.prototype.views = function views() {
- throw new Error('subclass must implement `views`');
- };
- AbstractRepeater.prototype.view = function view(index) {
- throw new Error('subclass must implement `view`');
- };
- AbstractRepeater.prototype.matcher = function matcher() {
- throw new Error('subclass must implement `matcher`');
- };
- AbstractRepeater.prototype.addView = function addView(bindingContext, overrideContext) {
- throw new Error('subclass must implement `addView`');
- };
- AbstractRepeater.prototype.insertView = function insertView(index, bindingContext, overrideContext) {
- throw new Error('subclass must implement `insertView`');
- };
- AbstractRepeater.prototype.moveView = function moveView(sourceIndex, targetIndex) {
- throw new Error('subclass must implement `moveView`');
- };
- AbstractRepeater.prototype.removeAllViews = function removeAllViews(returnToCache, skipAnimation) {
- throw new Error('subclass must implement `removeAllViews`');
- };
- AbstractRepeater.prototype.removeViews = function removeViews(viewsToRemove, returnToCache, skipAnimation) {
- throw new Error('subclass must implement `removeView`');
- };
- AbstractRepeater.prototype.removeView = function removeView(index, returnToCache, skipAnimation) {
- throw new Error('subclass must implement `removeView`');
- };
- AbstractRepeater.prototype.updateBindings = function updateBindings(view) {
- throw new Error('subclass must implement `updateBindings`');
- };
- return AbstractRepeater;
- }();
- });
- define('aurelia-templating-resources/show',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-pal', './aurelia-hide-style'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaPal, _aureliaHideStyle) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Show = undefined;
-
- var _dec, _dec2, _class;
- var Show = exports.Show = (_dec = (0, _aureliaTemplating.customAttribute)('show'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaTemplating.Animator, _aureliaDependencyInjection.Optional.of(_aureliaPal.DOM.boundary, true)), _dec(_class = _dec2(_class = function () {
- function Show(element, animator, domBoundary) {
-
- this.element = element;
- this.animator = animator;
- this.domBoundary = domBoundary;
- }
- Show.prototype.created = function created() {
- (0, _aureliaHideStyle.injectAureliaHideStyleAtBoundary)(this.domBoundary);
- };
- Show.prototype.valueChanged = function valueChanged(newValue) {
- if (newValue) {
- this.animator.removeClass(this.element, _aureliaHideStyle.aureliaHideClassName);
- } else {
- this.animator.addClass(this.element, _aureliaHideStyle.aureliaHideClassName);
- }
- };
- Show.prototype.bind = function bind(bindingContext) {
- this.valueChanged(this.value);
- };
- return Show;
- }()) || _class) || _class);
- });
- define('aurelia-templating-resources/aurelia-hide-style',['exports', 'aurelia-pal'], function (exports, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.aureliaHideClassName = undefined;
- exports.injectAureliaHideStyleAtHead = injectAureliaHideStyleAtHead;
- exports.injectAureliaHideStyleAtBoundary = injectAureliaHideStyleAtBoundary;
- var aureliaHideClassName = exports.aureliaHideClassName = 'aurelia-hide';
- var aureliaHideClass = '.' + aureliaHideClassName + ' { display:none !important; }';
- function injectAureliaHideStyleAtHead() {
- _aureliaPal.DOM.injectStyles(aureliaHideClass);
- }
- function injectAureliaHideStyleAtBoundary(domBoundary) {
- if (_aureliaPal.FEATURE.shadowDOM && domBoundary && !domBoundary.hasAureliaHideStyle) {
- domBoundary.hasAureliaHideStyle = true;
- _aureliaPal.DOM.injectStyles(aureliaHideClass, domBoundary);
- }
- }
- });
- define('aurelia-templating-resources/hide',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-pal', './aurelia-hide-style'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaPal, _aureliaHideStyle) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Hide = undefined;
-
- var _dec, _dec2, _class;
- var Hide = exports.Hide = (_dec = (0, _aureliaTemplating.customAttribute)('hide'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaTemplating.Animator, _aureliaDependencyInjection.Optional.of(_aureliaPal.DOM.boundary, true)), _dec(_class = _dec2(_class = function () {
- function Hide(element, animator, domBoundary) {
-
- this.element = element;
- this.animator = animator;
- this.domBoundary = domBoundary;
- }
- Hide.prototype.created = function created() {
- (0, _aureliaHideStyle.injectAureliaHideStyleAtBoundary)(this.domBoundary);
- };
- Hide.prototype.valueChanged = function valueChanged(newValue) {
- if (newValue) {
- this.animator.addClass(this.element, _aureliaHideStyle.aureliaHideClassName);
- } else {
- this.animator.removeClass(this.element, _aureliaHideStyle.aureliaHideClassName);
- }
- };
- Hide.prototype.bind = function bind(bindingContext) {
- this.valueChanged(this.value);
- };
- return Hide;
- }()) || _class) || _class);
- });
- define('aurelia-templating-resources/sanitize-html',['exports', 'aurelia-binding', 'aurelia-dependency-injection', './html-sanitizer'], function (exports, _aureliaBinding, _aureliaDependencyInjection, _htmlSanitizer) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.SanitizeHTMLValueConverter = undefined;
-
- var _dec, _dec2, _class;
- var SanitizeHTMLValueConverter = exports.SanitizeHTMLValueConverter = (_dec = (0, _aureliaBinding.valueConverter)('sanitizeHTML'), _dec2 = (0, _aureliaDependencyInjection.inject)(_htmlSanitizer.HTMLSanitizer), _dec(_class = _dec2(_class = function () {
- function SanitizeHTMLValueConverter(sanitizer) {
-
- this.sanitizer = sanitizer;
- }
- SanitizeHTMLValueConverter.prototype.toView = function toView(untrustedMarkup) {
- if (untrustedMarkup === null || untrustedMarkup === undefined) {
- return null;
- }
- return this.sanitizer.sanitize(untrustedMarkup);
- };
- return SanitizeHTMLValueConverter;
- }()) || _class) || _class);
- });
- define('aurelia-templating-resources/html-sanitizer',['exports'], function (exports) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var SCRIPT_REGEX = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
- var HTMLSanitizer = exports.HTMLSanitizer = function () {
- function HTMLSanitizer() {
-
- }
- HTMLSanitizer.prototype.sanitize = function sanitize(input) {
- return input.replace(SCRIPT_REGEX, '');
- };
- return HTMLSanitizer;
- }();
- });
- define('aurelia-templating-resources/replaceable',['exports', 'aurelia-dependency-injection', 'aurelia-templating'], function (exports, _aureliaDependencyInjection, _aureliaTemplating) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Replaceable = undefined;
-
- var _dec, _dec2, _class;
- var Replaceable = exports.Replaceable = (_dec = (0, _aureliaTemplating.customAttribute)('replaceable'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot), _dec(_class = (0, _aureliaTemplating.templateController)(_class = _dec2(_class = function () {
- function Replaceable(viewFactory, viewSlot) {
-
- this.viewFactory = viewFactory;
- this.viewSlot = viewSlot;
- this.view = null;
- }
- Replaceable.prototype.bind = function bind(bindingContext, overrideContext) {
- if (this.view === null) {
- this.view = this.viewFactory.create();
- this.viewSlot.add(this.view);
- }
- this.view.bind(bindingContext, overrideContext);
- };
- Replaceable.prototype.unbind = function unbind() {
- this.view.unbind();
- };
- return Replaceable;
- }()) || _class) || _class) || _class);
- });
- define('aurelia-templating-resources/focus',['exports', 'aurelia-templating', 'aurelia-binding', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia-pal'], function (exports, _aureliaTemplating, _aureliaBinding, _aureliaDependencyInjection, _aureliaTaskQueue, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Focus = undefined;
-
- var _dec, _dec2, _class;
- var Focus = exports.Focus = (_dec = (0, _aureliaTemplating.customAttribute)('focus', _aureliaBinding.bindingMode.twoWay), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaTaskQueue.TaskQueue), _dec(_class = _dec2(_class = function () {
- function Focus(element, taskQueue) {
- var _this = this;
-
- this.element = element;
- this.taskQueue = taskQueue;
- this.isAttached = false;
- this.needsApply = false;
- this.focusListener = function (e) {
- _this.value = true;
- };
- this.blurListener = function (e) {
- if (_aureliaPal.DOM.activeElement !== _this.element) {
- _this.value = false;
- }
- };
- }
- Focus.prototype.valueChanged = function valueChanged(newValue) {
- if (this.isAttached) {
- this._apply();
- } else {
- this.needsApply = true;
- }
- };
- Focus.prototype._apply = function _apply() {
- var _this2 = this;
- if (this.value) {
- this.taskQueue.queueMicroTask(function () {
- if (_this2.value) {
- _this2.element.focus();
- }
- });
- } else {
- this.element.blur();
- }
- };
- Focus.prototype.attached = function attached() {
- this.isAttached = true;
- if (this.needsApply) {
- this.needsApply = false;
- this._apply();
- }
- this.element.addEventListener('focus', this.focusListener);
- this.element.addEventListener('blur', this.blurListener);
- };
- Focus.prototype.detached = function detached() {
- this.isAttached = false;
- this.element.removeEventListener('focus', this.focusListener);
- this.element.removeEventListener('blur', this.blurListener);
- };
- return Focus;
- }()) || _class) || _class);
- });
- define('aurelia-templating-resources/css-resource',['exports', 'aurelia-templating', 'aurelia-loader', 'aurelia-dependency-injection', 'aurelia-path', 'aurelia-pal'], function (exports, _aureliaTemplating, _aureliaLoader, _aureliaDependencyInjection, _aureliaPath, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports._createCSSResource = _createCSSResource;
- function _possibleConstructorReturn(self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
- }
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
- }
-
- var cssUrlMatcher = /url\((?!['"]data)([^)]+)\)/gi;
- function fixupCSSUrls(address, css) {
- if (typeof css !== 'string') {
- throw new Error('Failed loading required CSS file: ' + address);
- }
- return css.replace(cssUrlMatcher, function (match, p1) {
- var quote = p1.charAt(0);
- if (quote === '\'' || quote === '"') {
- p1 = p1.substr(1, p1.length - 2);
- }
- return 'url(\'' + (0, _aureliaPath.relativeToFile)(p1, address) + '\')';
- });
- }
- var CSSResource = function () {
- function CSSResource(address) {
-
- this.address = address;
- this._scoped = null;
- this._global = false;
- this._alreadyGloballyInjected = false;
- }
- CSSResource.prototype.initialize = function initialize(container, target) {
- this._scoped = new target(this);
- };
- CSSResource.prototype.register = function register(registry, name) {
- if (name === 'scoped') {
- registry.registerViewEngineHooks(this._scoped);
- } else {
- this._global = true;
- }
- };
- CSSResource.prototype.load = function load(container) {
- var _this = this;
- return container.get(_aureliaLoader.Loader).loadText(this.address).catch(function (err) {
- return null;
- }).then(function (text) {
- text = fixupCSSUrls(_this.address, text);
- _this._scoped.css = text;
- if (_this._global) {
- _this._alreadyGloballyInjected = true;
- _aureliaPal.DOM.injectStyles(text);
- }
- });
- };
- return CSSResource;
- }();
- var CSSViewEngineHooks = function () {
- function CSSViewEngineHooks(owner) {
-
- this.owner = owner;
- this.css = null;
- }
- CSSViewEngineHooks.prototype.beforeCompile = function beforeCompile(content, resources, instruction) {
- if (instruction.targetShadowDOM) {
- _aureliaPal.DOM.injectStyles(this.css, content, true);
- } else if (_aureliaPal.FEATURE.scopedCSS) {
- var styleNode = _aureliaPal.DOM.injectStyles(this.css, content, true);
- styleNode.setAttribute('scoped', 'scoped');
- } else if (!this.owner._alreadyGloballyInjected) {
- _aureliaPal.DOM.injectStyles(this.css);
- this.owner._alreadyGloballyInjected = true;
- }
- };
- return CSSViewEngineHooks;
- }();
- function _createCSSResource(address) {
- var _dec, _class;
- var ViewCSS = (_dec = (0, _aureliaTemplating.resource)(new CSSResource(address)), _dec(_class = function (_CSSViewEngineHooks) {
- _inherits(ViewCSS, _CSSViewEngineHooks);
- function ViewCSS() {
-
- return _possibleConstructorReturn(this, _CSSViewEngineHooks.apply(this, arguments));
- }
- return ViewCSS;
- }(CSSViewEngineHooks)) || _class);
- return ViewCSS;
- }
- });
- define('aurelia-templating-resources/binding-mode-behaviors',['exports', 'aurelia-binding', 'aurelia-metadata'], function (exports, _aureliaBinding, _aureliaMetadata) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.TwoWayBindingBehavior = exports.OneWayBindingBehavior = exports.OneTimeBindingBehavior = undefined;
-
- var _dec, _class, _dec2, _class2, _dec3, _class3;
- var modeBindingBehavior = {
- bind: function bind(binding, source, lookupFunctions) {
- binding.originalMode = binding.mode;
- binding.mode = this.mode;
- },
- unbind: function unbind(binding, source) {
- binding.mode = binding.originalMode;
- binding.originalMode = null;
- }
- };
- var OneTimeBindingBehavior = exports.OneTimeBindingBehavior = (_dec = (0, _aureliaMetadata.mixin)(modeBindingBehavior), _dec(_class = function OneTimeBindingBehavior() {
-
- this.mode = _aureliaBinding.bindingMode.oneTime;
- }) || _class);
- var OneWayBindingBehavior = exports.OneWayBindingBehavior = (_dec2 = (0, _aureliaMetadata.mixin)(modeBindingBehavior), _dec2(_class2 = function OneWayBindingBehavior() {
-
- this.mode = _aureliaBinding.bindingMode.oneWay;
- }) || _class2);
- var TwoWayBindingBehavior = exports.TwoWayBindingBehavior = (_dec3 = (0, _aureliaMetadata.mixin)(modeBindingBehavior), _dec3(_class3 = function TwoWayBindingBehavior() {
-
- this.mode = _aureliaBinding.bindingMode.twoWay;
- }) || _class3);
- });
- define('aurelia-templating-resources/throttle-binding-behavior',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ThrottleBindingBehavior = undefined;
-
- function throttle(newValue) {
- var _this = this;
- var state = this.throttleState;
- var elapsed = +new Date() - state.last;
- if (elapsed >= state.delay) {
- clearTimeout(state.timeoutId);
- state.timeoutId = null;
- state.last = +new Date();
- this.throttledMethod(newValue);
- return;
- }
- state.newValue = newValue;
- if (state.timeoutId === null) {
- state.timeoutId = setTimeout(function () {
- state.timeoutId = null;
- state.last = +new Date();
- _this.throttledMethod(state.newValue);
- }, state.delay - elapsed);
- }
- }
- var ThrottleBindingBehavior = exports.ThrottleBindingBehavior = function () {
- function ThrottleBindingBehavior() {
-
- }
- ThrottleBindingBehavior.prototype.bind = function bind(binding, source) {
- var delay = arguments.length <= 2 || arguments[2] === undefined ? 200 : arguments[2];
- var methodToThrottle = 'updateTarget';
- if (binding.callSource) {
- methodToThrottle = 'callSource';
- } else if (binding.updateSource && binding.mode === _aureliaBinding.bindingMode.twoWay) {
- methodToThrottle = 'updateSource';
- }
- binding.throttledMethod = binding[methodToThrottle];
- binding.throttledMethod.originalName = methodToThrottle;
- binding[methodToThrottle] = throttle;
- binding.throttleState = {
- delay: delay,
- last: 0,
- timeoutId: null
- };
- };
- ThrottleBindingBehavior.prototype.unbind = function unbind(binding, source) {
- var methodToRestore = binding.throttledMethod.originalName;
- binding[methodToRestore] = binding.throttledMethod;
- binding.throttledMethod = null;
- clearTimeout(binding.throttleState.timeoutId);
- binding.throttleState = null;
- };
- return ThrottleBindingBehavior;
- }();
- });
- define('aurelia-templating-resources/debounce-binding-behavior',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.DebounceBindingBehavior = undefined;
-
- function debounce(newValue) {
- var _this = this;
- var state = this.debounceState;
- if (state.immediate) {
- state.immediate = false;
- this.debouncedMethod(newValue);
- return;
- }
- clearTimeout(state.timeoutId);
- state.timeoutId = setTimeout(function () {
- return _this.debouncedMethod(newValue);
- }, state.delay);
- }
- var DebounceBindingBehavior = exports.DebounceBindingBehavior = function () {
- function DebounceBindingBehavior() {
-
- }
- DebounceBindingBehavior.prototype.bind = function bind(binding, source) {
- var delay = arguments.length <= 2 || arguments[2] === undefined ? 200 : arguments[2];
- var methodToDebounce = 'updateTarget';
- if (binding.callSource) {
- methodToDebounce = 'callSource';
- } else if (binding.updateSource && binding.mode === _aureliaBinding.bindingMode.twoWay) {
- methodToDebounce = 'updateSource';
- }
- binding.debouncedMethod = binding[methodToDebounce];
- binding.debouncedMethod.originalName = methodToDebounce;
- binding[methodToDebounce] = debounce;
- binding.debounceState = {
- delay: delay,
- timeoutId: null,
- immediate: methodToDebounce === 'updateTarget' };
- };
- DebounceBindingBehavior.prototype.unbind = function unbind(binding, source) {
- var methodToRestore = binding.debouncedMethod.originalName;
- binding[methodToRestore] = binding.debouncedMethod;
- binding.debouncedMethod = null;
- clearTimeout(binding.debounceState.timeoutId);
- binding.debounceState = null;
- };
- return DebounceBindingBehavior;
- }();
- });
- define('aurelia-templating-resources/signal-binding-behavior',['exports', './binding-signaler'], function (exports, _bindingSignaler) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.SignalBindingBehavior = undefined;
-
- var SignalBindingBehavior = exports.SignalBindingBehavior = function () {
- SignalBindingBehavior.inject = function inject() {
- return [_bindingSignaler.BindingSignaler];
- };
- function SignalBindingBehavior(bindingSignaler) {
-
- this.signals = bindingSignaler.signals;
- }
- SignalBindingBehavior.prototype.bind = function bind(binding, source) {
- if (!binding.updateTarget) {
- throw new Error('Only property bindings and string interpolation bindings can be signaled. Trigger, delegate and call bindings cannot be signaled.');
- }
- if (arguments.length === 3) {
- var name = arguments[2];
- var bindings = this.signals[name] || (this.signals[name] = []);
- bindings.push(binding);
- binding.signalName = name;
- } else if (arguments.length > 3) {
- var names = Array.prototype.slice.call(arguments, 2);
- var i = names.length;
- while (i--) {
- var _name = names[i];
- var _bindings = this.signals[_name] || (this.signals[_name] = []);
- _bindings.push(binding);
- }
- binding.signalName = names;
- } else {
- throw new Error('Signal name is required.');
- }
- };
- SignalBindingBehavior.prototype.unbind = function unbind(binding, source) {
- var name = binding.signalName;
- binding.signalName = null;
- if (Array.isArray(name)) {
- var names = name;
- var i = names.length;
- while (i--) {
- var n = names[i];
- var bindings = this.signals[n];
- bindings.splice(bindings.indexOf(binding), 1);
- }
- } else {
- var _bindings2 = this.signals[name];
- _bindings2.splice(_bindings2.indexOf(binding), 1);
- }
- };
- return SignalBindingBehavior;
- }();
- });
- define('aurelia-templating-resources/binding-signaler',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BindingSignaler = undefined;
-
- var BindingSignaler = exports.BindingSignaler = function () {
- function BindingSignaler() {
-
- this.signals = {};
- }
- BindingSignaler.prototype.signal = function signal(name) {
- var bindings = this.signals[name];
- if (!bindings) {
- return;
- }
- var i = bindings.length;
- while (i--) {
- bindings[i].call(_aureliaBinding.sourceContext);
- }
- };
- return BindingSignaler;
- }();
- });
- define('aurelia-templating-resources/update-trigger-binding-behavior',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.UpdateTriggerBindingBehavior = undefined;
-
- var _class, _temp;
- var eventNamesRequired = 'The updateTrigger binding behavior requires at least one event name argument: eg <input value.bind="firstName & updateTrigger:\'blur\'">';
- var notApplicableMessage = 'The updateTrigger binding behavior can only be applied to two-way bindings on input/select elements.';
- var UpdateTriggerBindingBehavior = exports.UpdateTriggerBindingBehavior = (_temp = _class = function () {
- function UpdateTriggerBindingBehavior(eventManager) {
-
- this.eventManager = eventManager;
- }
- UpdateTriggerBindingBehavior.prototype.bind = function bind(binding, source) {
- for (var _len = arguments.length, events = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
- events[_key - 2] = arguments[_key];
- }
- if (events.length === 0) {
- throw new Error(eventNamesRequired);
- }
- if (binding.mode !== _aureliaBinding.bindingMode.twoWay) {
- throw new Error(notApplicableMessage);
- }
- var targetObserver = binding.observerLocator.getObserver(binding.target, binding.targetProperty);
- if (!targetObserver.handler) {
- throw new Error(notApplicableMessage);
- }
- binding.targetObserver = targetObserver;
- targetObserver.originalHandler = binding.targetObserver.handler;
- var handler = this.eventManager.createElementHandler(events);
- targetObserver.handler = handler;
- };
- UpdateTriggerBindingBehavior.prototype.unbind = function unbind(binding, source) {
- binding.targetObserver.handler = binding.targetObserver.originalHandler;
- binding.targetObserver.originalHandler = null;
- };
- return UpdateTriggerBindingBehavior;
- }(), _class.inject = [_aureliaBinding.EventManager], _temp);
- });
- define('aurelia-templating-resources/html-resource-plugin',['exports', 'aurelia-templating', './dynamic-element'], function (exports, _aureliaTemplating, _dynamicElement) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getElementName = getElementName;
- exports.configure = configure;
- function getElementName(address) {
- return (/([^\/^\?]+)\.html/i.exec(address)[1].toLowerCase()
- );
- }
- function configure(config) {
- var viewEngine = config.container.get(_aureliaTemplating.ViewEngine);
- var loader = config.aurelia.loader;
- viewEngine.addResourcePlugin('.html', {
- 'fetch': function fetch(address) {
- return loader.loadTemplate(address).then(function (registryEntry) {
- var _ref;
- var bindable = registryEntry.template.getAttribute('bindable');
- var elementName = getElementName(address);
- if (bindable) {
- bindable = bindable.split(',').map(function (x) {
- return x.trim();
- });
- registryEntry.template.removeAttribute('bindable');
- } else {
- bindable = [];
- }
- return _ref = {}, _ref[elementName] = (0, _dynamicElement._createDynamicElement)(elementName, address, bindable), _ref;
- });
- }
- });
- }
- });
- define('aurelia-templating-resources/dynamic-element',['exports', 'aurelia-templating'], function (exports, _aureliaTemplating) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports._createDynamicElement = _createDynamicElement;
-
- function _createDynamicElement(name, viewUrl, bindableNames) {
- var _dec, _dec2, _class;
- var DynamicElement = (_dec = (0, _aureliaTemplating.customElement)(name), _dec2 = (0, _aureliaTemplating.useView)(viewUrl), _dec(_class = _dec2(_class = function () {
- function DynamicElement() {
-
- }
- DynamicElement.prototype.bind = function bind(bindingContext) {
- this.$parent = bindingContext;
- };
- return DynamicElement;
- }()) || _class) || _class);
- for (var i = 0, ii = bindableNames.length; i < ii; ++i) {
- (0, _aureliaTemplating.bindable)(bindableNames[i])(DynamicElement);
- }
- return DynamicElement;
- }
- });
- define('aurelia-templating-router/aurelia-templating-router',['exports', 'aurelia-router', './route-loader', './router-view', './route-href'], function (exports, _aureliaRouter, _routeLoader, _routerView, _routeHref) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.configure = exports.RouteHref = exports.RouterView = exports.TemplatingRouteLoader = undefined;
- function configure(config) {
- config.singleton(_aureliaRouter.RouteLoader, _routeLoader.TemplatingRouteLoader).singleton(_aureliaRouter.Router, _aureliaRouter.AppRouter).globalResources('./router-view', './route-href');
- config.container.registerAlias(_aureliaRouter.Router, _aureliaRouter.AppRouter);
- }
- exports.TemplatingRouteLoader = _routeLoader.TemplatingRouteLoader;
- exports.RouterView = _routerView.RouterView;
- exports.RouteHref = _routeHref.RouteHref;
- exports.configure = configure;
- });;define('aurelia-templating-router', ['aurelia-templating-router/aurelia-templating-router'], function (main) { return main; });
- define('aurelia-templating-router/route-loader',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-router', 'aurelia-path', 'aurelia-metadata'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaRouter, _aureliaPath, _aureliaMetadata) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.TemplatingRouteLoader = undefined;
-
- function _possibleConstructorReturn(self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
- }
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
- }
- var _dec, _class;
- var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.CompositionEngine), _dec(_class = function (_RouteLoader) {
- _inherits(TemplatingRouteLoader, _RouteLoader);
- function TemplatingRouteLoader(compositionEngine) {
-
- var _this = _possibleConstructorReturn(this, _RouteLoader.call(this));
- _this.compositionEngine = compositionEngine;
- return _this;
- }
- TemplatingRouteLoader.prototype.loadRoute = function loadRoute(router, config) {
- var childContainer = router.container.createChild();
- var instruction = {
- viewModel: (0, _aureliaPath.relativeToFile)(config.moduleId, _aureliaMetadata.Origin.get(router.container.viewModel.constructor).moduleId),
- childContainer: childContainer,
- view: config.view || config.viewStrategy,
- router: router
- };
- childContainer.getChildRouter = function () {
- var childRouter = void 0;
- childContainer.registerHandler(_aureliaRouter.Router, function (c) {
- return childRouter || (childRouter = router.createChild(childContainer));
- });
- return childContainer.get(_aureliaRouter.Router);
- };
- return this.compositionEngine.ensureViewModel(instruction);
- };
- return TemplatingRouteLoader;
- }(_aureliaRouter.RouteLoader)) || _class);
- });
- define('aurelia-templating-router/router-view',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-router', 'aurelia-metadata', 'aurelia-pal'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaRouter, _aureliaMetadata, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.RouterView = undefined;
- function _initDefineProp(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
- }
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
- if (desc.initializer === void 0) {
- Object['define' + 'Property'](target, property, desc);
- desc = null;
- }
- return desc;
- }
- function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
- }
- var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
-
- var SwapStrategies = function () {
- function SwapStrategies() {
-
- }
- SwapStrategies.prototype.before = function before(viewSlot, previousView, callback) {
- var promise = Promise.resolve(callback());
- if (previousView !== undefined) {
- return promise.then(function () {
- return viewSlot.remove(previousView, true);
- });
- }
- return promise;
- };
- SwapStrategies.prototype.with = function _with(viewSlot, previousView, callback) {
- var promise = Promise.resolve(callback());
- if (previousView !== undefined) {
- return Promise.all([viewSlot.remove(previousView, true), promise]);
- }
- return promise;
- };
- SwapStrategies.prototype.after = function after(viewSlot, previousView, callback) {
- return Promise.resolve(viewSlot.removeAll(true)).then(callback);
- };
- return SwapStrategies;
- }();
- var swapStrategies = new SwapStrategies();
- var RouterView = exports.RouterView = (_dec = (0, _aureliaTemplating.customElement)('router-view'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaDependencyInjection.Container, _aureliaTemplating.ViewSlot, _aureliaRouter.Router, _aureliaTemplating.ViewLocator, _aureliaTemplating.CompositionTransaction, _aureliaTemplating.CompositionEngine), _dec(_class = (0, _aureliaTemplating.noView)(_class = _dec2(_class = (_class2 = function () {
- function RouterView(element, container, viewSlot, router, viewLocator, compositionTransaction, compositionEngine) {
-
- _initDefineProp(this, 'swapOrder', _descriptor, this);
- _initDefineProp(this, 'layoutView', _descriptor2, this);
- _initDefineProp(this, 'layoutViewModel', _descriptor3, this);
- _initDefineProp(this, 'layoutModel', _descriptor4, this);
- this.element = element;
- this.container = container;
- this.viewSlot = viewSlot;
- this.router = router;
- this.viewLocator = viewLocator;
- this.compositionTransaction = compositionTransaction;
- this.compositionEngine = compositionEngine;
- this.router.registerViewPort(this, this.element.getAttribute('name'));
- if (!('initialComposition' in compositionTransaction)) {
- compositionTransaction.initialComposition = true;
- this.compositionTransactionNotifier = compositionTransaction.enlist();
- }
- }
- RouterView.prototype.created = function created(owningView) {
- this.owningView = owningView;
- };
- RouterView.prototype.bind = function bind(bindingContext, overrideContext) {
- this.container.viewModel = bindingContext;
- this.overrideContext = overrideContext;
- };
- RouterView.prototype.process = function process(viewPortInstruction, waitToSwap) {
- var _this = this;
- var component = viewPortInstruction.component;
- var childContainer = component.childContainer;
- var viewModel = component.viewModel;
- var viewModelResource = component.viewModelResource;
- var metadata = viewModelResource.metadata;
- var config = component.router.currentInstruction.config;
- var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {};
- var layoutInstruction = {
- viewModel: viewPort.layoutViewModel || config.layoutViewModel || this.layoutViewModel,
- view: viewPort.layoutView || config.layoutView || this.layoutView,
- model: viewPort.layoutModel || config.layoutModel || this.layoutModel,
- router: viewPortInstruction.component.router,
- childContainer: childContainer,
- viewSlot: this.viewSlot
- };
- var viewStrategy = this.viewLocator.getViewStrategy(component.view || viewModel);
- if (viewStrategy && component.view) {
- viewStrategy.makeRelativeTo(_aureliaMetadata.Origin.get(component.router.container.viewModel.constructor).moduleId);
- }
- return metadata.load(childContainer, viewModelResource.value, null, viewStrategy, true).then(function (viewFactory) {
- if (!_this.compositionTransactionNotifier) {
- _this.compositionTransactionOwnershipToken = _this.compositionTransaction.tryCapture();
- }
- if (layoutInstruction.viewModel || layoutInstruction.view) {
- viewPortInstruction.layoutInstruction = layoutInstruction;
- }
- viewPortInstruction.controller = metadata.create(childContainer, _aureliaTemplating.BehaviorInstruction.dynamic(_this.element, viewModel, viewFactory));
- if (waitToSwap) {
- return;
- }
- _this.swap(viewPortInstruction);
- });
- };
- RouterView.prototype.swap = function swap(viewPortInstruction) {
- var _this2 = this;
- var work = function work() {
- var previousView = _this2.view;
- var swapStrategy = void 0;
- var viewSlot = _this2.viewSlot;
- var layoutInstruction = viewPortInstruction.layoutInstruction;
- swapStrategy = _this2.swapOrder in swapStrategies ? swapStrategies[_this2.swapOrder] : swapStrategies.after;
- swapStrategy(viewSlot, previousView, function () {
- var waitForView = void 0;
- if (layoutInstruction) {
- if (!layoutInstruction.viewModel) {
- layoutInstruction.viewModel = {};
- }
- waitForView = _this2.compositionEngine.createController(layoutInstruction).then(function (layout) {
- _aureliaTemplating.ShadowDOM.distributeView(viewPortInstruction.controller.view, layout.slots || layout.view.slots);
- return layout.view || layout;
- });
- } else {
- waitForView = Promise.resolve(viewPortInstruction.controller.view);
- }
- return waitForView.then(function (newView) {
- _this2.view = newView;
- return viewSlot.add(newView);
- }).then(function () {
- _this2._notify();
- });
- });
- };
- viewPortInstruction.controller.automate(this.overrideContext, this.owningView);
- if (this.compositionTransactionOwnershipToken) {
- return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () {
- _this2.compositionTransactionOwnershipToken = null;
- return work();
- });
- }
- return work();
- };
- RouterView.prototype._notify = function _notify() {
- if (this.compositionTransactionNotifier) {
- this.compositionTransactionNotifier.done();
- this.compositionTransactionNotifier = null;
- }
- };
- return RouterView;
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'swapOrder', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'layoutView', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'layoutViewModel', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'layoutModel', [_aureliaTemplating.bindable], {
- enumerable: true,
- initializer: null
- })), _class2)) || _class) || _class) || _class);
- });
- define('aurelia-templating-router/route-href',['exports', 'aurelia-templating', 'aurelia-dependency-injection', 'aurelia-router', 'aurelia-pal', 'aurelia-logging'], function (exports, _aureliaTemplating, _aureliaDependencyInjection, _aureliaRouter, _aureliaPal, _aureliaLogging) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.RouteHref = undefined;
- var LogManager = _interopRequireWildcard(_aureliaLogging);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
-
- var _dec, _dec2, _dec3, _dec4, _dec5, _class;
- var logger = LogManager.getLogger('route-href');
- var RouteHref = exports.RouteHref = (_dec = (0, _aureliaTemplating.customAttribute)('route-href'), _dec2 = (0, _aureliaTemplating.bindable)({ name: 'route', changeHandler: 'processChange' }), _dec3 = (0, _aureliaTemplating.bindable)({ name: 'params', changeHandler: 'processChange' }), _dec4 = (0, _aureliaTemplating.bindable)({ name: 'attribute', defaultValue: 'href' }), _dec5 = (0, _aureliaDependencyInjection.inject)(_aureliaRouter.Router, _aureliaPal.DOM.Element), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = _dec5(_class = function () {
- function RouteHref(router, element) {
-
- this.router = router;
- this.element = element;
- }
- RouteHref.prototype.bind = function bind() {
- this.isActive = true;
- this.processChange();
- };
- RouteHref.prototype.unbind = function unbind() {
- this.isActive = false;
- };
- RouteHref.prototype.attributeChanged = function attributeChanged(value, previous) {
- if (previous) {
- this.element.removeAttribute(previous);
- }
- this.processChange();
- };
- RouteHref.prototype.processChange = function processChange() {
- var _this = this;
- return this.router.ensureConfigured().then(function () {
- if (!_this.isActive) {
- return null;
- }
- var href = _this.router.generate(_this.route, _this.params);
- _this.element.setAttribute(_this.attribute, href);
- return null;
- }).catch(function (reason) {
- logger.error(reason);
- });
- };
- return RouteHref;
- }()) || _class) || _class) || _class) || _class) || _class);
- });
- define('aurelia-templating',['exports', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pal', 'aurelia-path', 'aurelia-loader', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-task-queue'], function (exports, _aureliaLogging, _aureliaMetadata, _aureliaPal, _aureliaPath, _aureliaLoader, _aureliaDependencyInjection, _aureliaBinding, _aureliaTaskQueue) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.TemplatingEngine = exports.ElementConfigResource = exports.CompositionEngine = exports.HtmlBehaviorResource = exports.BindableProperty = exports.BehaviorPropertyObserver = exports.Controller = exports.ViewEngine = exports.ModuleAnalyzer = exports.ResourceDescription = exports.ResourceModule = exports.ViewCompiler = exports.ViewFactory = exports.BoundViewFactory = exports.ViewSlot = exports.View = exports.ViewResources = exports.ShadowDOM = exports.ShadowSlot = exports.PassThroughSlot = exports.SlotCustomAttribute = exports.BindingLanguage = exports.ViewLocator = exports.InlineViewStrategy = exports.TemplateRegistryViewStrategy = exports.NoViewStrategy = exports.ConventionalViewStrategy = exports.RelativeViewStrategy = exports.viewStrategy = exports.TargetInstruction = exports.BehaviorInstruction = exports.ViewCompileInstruction = exports.ResourceLoadContext = exports.ElementEvents = exports.ViewEngineHooksResource = exports.CompositionTransaction = exports.CompositionTransactionOwnershipToken = exports.CompositionTransactionNotifier = exports.Animator = exports.animationEvent = undefined;
- exports._hyphenate = _hyphenate;
- exports._isAllWhitespace = _isAllWhitespace;
- exports.viewEngineHooks = viewEngineHooks;
- exports.children = children;
- exports.child = child;
- exports.resource = resource;
- exports.behavior = behavior;
- exports.customElement = customElement;
- exports.customAttribute = customAttribute;
- exports.templateController = templateController;
- exports.bindable = bindable;
- exports.dynamicOptions = dynamicOptions;
- exports.useShadowDOM = useShadowDOM;
- exports.processAttributes = processAttributes;
- exports.processContent = processContent;
- exports.containerless = containerless;
- exports.useViewStrategy = useViewStrategy;
- exports.useView = useView;
- exports.inlineView = inlineView;
- exports.noView = noView;
- exports.elementConfig = elementConfig;
- exports.viewResources = viewResources;
- var LogManager = _interopRequireWildcard(_aureliaLogging);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
- var _createClass = 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);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- var _class4, _temp, _dec, _class5, _dec2, _class6, _dec3, _class7, _dec4, _class8, _dec5, _class9, _class10, _temp2, _dec6, _class11, _class12, _temp3, _class15, _dec7, _class17, _dec8, _class18, _class19, _temp4, _dec9, _class21, _dec10, _class22, _dec11, _class23;
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
- };
-
- var animationEvent = exports.animationEvent = {
- enterBegin: 'animation:enter:begin',
- enterActive: 'animation:enter:active',
- enterDone: 'animation:enter:done',
- enterTimeout: 'animation:enter:timeout',
- leaveBegin: 'animation:leave:begin',
- leaveActive: 'animation:leave:active',
- leaveDone: 'animation:leave:done',
- leaveTimeout: 'animation:leave:timeout',
- staggerNext: 'animation:stagger:next',
- removeClassBegin: 'animation:remove-class:begin',
- removeClassActive: 'animation:remove-class:active',
- removeClassDone: 'animation:remove-class:done',
- removeClassTimeout: 'animation:remove-class:timeout',
- addClassBegin: 'animation:add-class:begin',
- addClassActive: 'animation:add-class:active',
- addClassDone: 'animation:add-class:done',
- addClassTimeout: 'animation:add-class:timeout',
- animateBegin: 'animation:animate:begin',
- animateActive: 'animation:animate:active',
- animateDone: 'animation:animate:done',
- animateTimeout: 'animation:animate:timeout',
- sequenceBegin: 'animation:sequence:begin',
- sequenceDone: 'animation:sequence:done'
- };
- var Animator = exports.Animator = function () {
- function Animator() {
-
- }
- Animator.prototype.enter = function enter(element) {
- return Promise.resolve(false);
- };
- Animator.prototype.leave = function leave(element) {
- return Promise.resolve(false);
- };
- Animator.prototype.removeClass = function removeClass(element, className) {
- element.classList.remove(className);
- return Promise.resolve(false);
- };
- Animator.prototype.addClass = function addClass(element, className) {
- element.classList.add(className);
- return Promise.resolve(false);
- };
- Animator.prototype.animate = function animate(element, className) {
- return Promise.resolve(false);
- };
- Animator.prototype.runSequence = function runSequence(animations) {};
- Animator.prototype.registerEffect = function registerEffect(effectName, properties) {};
- Animator.prototype.unregisterEffect = function unregisterEffect(effectName) {};
- return Animator;
- }();
- var CompositionTransactionNotifier = exports.CompositionTransactionNotifier = function () {
- function CompositionTransactionNotifier(owner) {
-
- this.owner = owner;
- this.owner._compositionCount++;
- }
- CompositionTransactionNotifier.prototype.done = function done() {
- this.owner._compositionCount--;
- this.owner._tryCompleteTransaction();
- };
- return CompositionTransactionNotifier;
- }();
- var CompositionTransactionOwnershipToken = exports.CompositionTransactionOwnershipToken = function () {
- function CompositionTransactionOwnershipToken(owner) {
-
- this.owner = owner;
- this.owner._ownershipToken = this;
- this.thenable = this._createThenable();
- }
- CompositionTransactionOwnershipToken.prototype.waitForCompositionComplete = function waitForCompositionComplete() {
- this.owner._tryCompleteTransaction();
- return this.thenable;
- };
- CompositionTransactionOwnershipToken.prototype.resolve = function resolve() {
- this._resolveCallback();
- };
- CompositionTransactionOwnershipToken.prototype._createThenable = function _createThenable() {
- var _this = this;
- return new Promise(function (resolve, reject) {
- _this._resolveCallback = resolve;
- });
- };
- return CompositionTransactionOwnershipToken;
- }();
- var CompositionTransaction = exports.CompositionTransaction = function () {
- function CompositionTransaction() {
-
- this._ownershipToken = null;
- this._compositionCount = 0;
- }
- CompositionTransaction.prototype.tryCapture = function tryCapture() {
- return this._ownershipToken === null ? new CompositionTransactionOwnershipToken(this) : null;
- };
- CompositionTransaction.prototype.enlist = function enlist() {
- return new CompositionTransactionNotifier(this);
- };
- CompositionTransaction.prototype._tryCompleteTransaction = function _tryCompleteTransaction() {
- if (this._compositionCount <= 0) {
- this._compositionCount = 0;
- if (this._ownershipToken !== null) {
- var token = this._ownershipToken;
- this._ownershipToken = null;
- token.resolve();
- }
- }
- };
- return CompositionTransaction;
- }();
- var capitalMatcher = /([A-Z])/g;
- function addHyphenAndLower(char) {
- return '-' + char.toLowerCase();
- }
- function _hyphenate(name) {
- return (name.charAt(0).toLowerCase() + name.slice(1)).replace(capitalMatcher, addHyphenAndLower);
- }
- function _isAllWhitespace(node) {
- return !(node.auInterpolationTarget || /[^\t\n\r ]/.test(node.textContent));
- }
- var ViewEngineHooksResource = exports.ViewEngineHooksResource = function () {
- function ViewEngineHooksResource() {
-
- }
- ViewEngineHooksResource.prototype.initialize = function initialize(container, target) {
- this.instance = container.get(target);
- };
- ViewEngineHooksResource.prototype.register = function register(registry, name) {
- registry.registerViewEngineHooks(this.instance);
- };
- ViewEngineHooksResource.prototype.load = function load(container, target) {};
- ViewEngineHooksResource.convention = function convention(name) {
- if (name.endsWith('ViewEngineHooks')) {
- return new ViewEngineHooksResource();
- }
- };
- return ViewEngineHooksResource;
- }();
- function viewEngineHooks(target) {
- var deco = function deco(t) {
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ViewEngineHooksResource(), t);
- };
- return target ? deco(target) : deco;
- }
- var ElementEvents = exports.ElementEvents = function () {
- function ElementEvents(element) {
-
- this.element = element;
- this.subscriptions = {};
- }
- ElementEvents.prototype._enqueueHandler = function _enqueueHandler(handler) {
- this.subscriptions[handler.eventName] = this.subscriptions[handler.eventName] || [];
- this.subscriptions[handler.eventName].push(handler);
- };
- ElementEvents.prototype._dequeueHandler = function _dequeueHandler(handler) {
- var index = void 0;
- var subscriptions = this.subscriptions[handler.eventName];
- if (subscriptions) {
- index = subscriptions.indexOf(handler);
- if (index > -1) {
- subscriptions.splice(index, 1);
- }
- }
- return handler;
- };
- ElementEvents.prototype.publish = function publish(eventName) {
- var detail = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
- var bubbles = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];
- var cancelable = arguments.length <= 3 || arguments[3] === undefined ? true : arguments[3];
- var event = _aureliaPal.DOM.createCustomEvent(eventName, { cancelable: cancelable, bubbles: bubbles, detail: detail });
- this.element.dispatchEvent(event);
- };
- ElementEvents.prototype.subscribe = function subscribe(eventName, handler) {
- var _this2 = this;
- var bubbles = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];
- if (handler && typeof handler === 'function') {
- handler.eventName = eventName;
- handler.handler = handler;
- handler.bubbles = bubbles;
- handler.dispose = function () {
- _this2.element.removeEventListener(eventName, handler, bubbles);
- _this2._dequeueHandler(handler);
- };
- this.element.addEventListener(eventName, handler, bubbles);
- this._enqueueHandler(handler);
- return handler;
- }
- return undefined;
- };
- ElementEvents.prototype.subscribeOnce = function subscribeOnce(eventName, handler) {
- var _this3 = this;
- var bubbles = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];
- if (handler && typeof handler === 'function') {
- var _ret = function () {
- var _handler = function _handler(event) {
- handler(event);
- _handler.dispose();
- };
- return {
- v: _this3.subscribe(eventName, _handler, bubbles)
- };
- }();
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
- }
- return undefined;
- };
- ElementEvents.prototype.dispose = function dispose(eventName) {
- if (eventName && typeof eventName === 'string') {
- var subscriptions = this.subscriptions[eventName];
- if (subscriptions) {
- while (subscriptions.length) {
- var subscription = subscriptions.pop();
- if (subscription) {
- subscription.dispose();
- }
- }
- }
- } else {
- this.disposeAll();
- }
- };
- ElementEvents.prototype.disposeAll = function disposeAll() {
- for (var key in this.subscriptions) {
- this.dispose(key);
- }
- };
- return ElementEvents;
- }();
- var ResourceLoadContext = exports.ResourceLoadContext = function () {
- function ResourceLoadContext() {
-
- this.dependencies = {};
- }
- ResourceLoadContext.prototype.addDependency = function addDependency(url) {
- this.dependencies[url] = true;
- };
- ResourceLoadContext.prototype.hasDependency = function hasDependency(url) {
- return url in this.dependencies;
- };
- return ResourceLoadContext;
- }();
- var ViewCompileInstruction = exports.ViewCompileInstruction = function ViewCompileInstruction() {
- var targetShadowDOM = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
- var compileSurrogate = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
-
- this.targetShadowDOM = targetShadowDOM;
- this.compileSurrogate = compileSurrogate;
- this.associatedModuleId = null;
- };
- ViewCompileInstruction.normal = new ViewCompileInstruction();
- var BehaviorInstruction = exports.BehaviorInstruction = function () {
- BehaviorInstruction.enhance = function enhance() {
- var instruction = new BehaviorInstruction();
- instruction.enhance = true;
- return instruction;
- };
- BehaviorInstruction.unitTest = function unitTest(type, attributes) {
- var instruction = new BehaviorInstruction();
- instruction.type = type;
- instruction.attributes = attributes || {};
- return instruction;
- };
- BehaviorInstruction.element = function element(node, type) {
- var instruction = new BehaviorInstruction();
- instruction.type = type;
- instruction.attributes = {};
- instruction.anchorIsContainer = !(node.hasAttribute('containerless') || type.containerless);
- instruction.initiatedByBehavior = true;
- return instruction;
- };
- BehaviorInstruction.attribute = function attribute(attrName, type) {
- var instruction = new BehaviorInstruction();
- instruction.attrName = attrName;
- instruction.type = type || null;
- instruction.attributes = {};
- return instruction;
- };
- BehaviorInstruction.dynamic = function dynamic(host, viewModel, viewFactory) {
- var instruction = new BehaviorInstruction();
- instruction.host = host;
- instruction.viewModel = viewModel;
- instruction.viewFactory = viewFactory;
- instruction.inheritBindingContext = true;
- return instruction;
- };
- function BehaviorInstruction() {
-
- this.initiatedByBehavior = false;
- this.enhance = false;
- this.partReplacements = null;
- this.viewFactory = null;
- this.originalAttrName = null;
- this.skipContentProcessing = false;
- this.contentFactory = null;
- this.viewModel = null;
- this.anchorIsContainer = false;
- this.host = null;
- this.attributes = null;
- this.type = null;
- this.attrName = null;
- this.inheritBindingContext = false;
- }
- return BehaviorInstruction;
- }();
- BehaviorInstruction.normal = new BehaviorInstruction();
- var TargetInstruction = exports.TargetInstruction = (_temp = _class4 = function () {
- TargetInstruction.shadowSlot = function shadowSlot(parentInjectorId) {
- var instruction = new TargetInstruction();
- instruction.parentInjectorId = parentInjectorId;
- instruction.shadowSlot = true;
- return instruction;
- };
- TargetInstruction.contentExpression = function contentExpression(expression) {
- var instruction = new TargetInstruction();
- instruction.contentExpression = expression;
- return instruction;
- };
- TargetInstruction.lifting = function lifting(parentInjectorId, liftingInstruction) {
- var instruction = new TargetInstruction();
- instruction.parentInjectorId = parentInjectorId;
- instruction.expressions = TargetInstruction.noExpressions;
- instruction.behaviorInstructions = [liftingInstruction];
- instruction.viewFactory = liftingInstruction.viewFactory;
- instruction.providers = [liftingInstruction.type.target];
- instruction.lifting = true;
- return instruction;
- };
- TargetInstruction.normal = function normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction) {
- var instruction = new TargetInstruction();
- instruction.injectorId = injectorId;
- instruction.parentInjectorId = parentInjectorId;
- instruction.providers = providers;
- instruction.behaviorInstructions = behaviorInstructions;
- instruction.expressions = expressions;
- instruction.anchorIsContainer = elementInstruction ? elementInstruction.anchorIsContainer : true;
- instruction.elementInstruction = elementInstruction;
- return instruction;
- };
- TargetInstruction.surrogate = function surrogate(providers, behaviorInstructions, expressions, values) {
- var instruction = new TargetInstruction();
- instruction.expressions = expressions;
- instruction.behaviorInstructions = behaviorInstructions;
- instruction.providers = providers;
- instruction.values = values;
- return instruction;
- };
- function TargetInstruction() {
-
- this.injectorId = null;
- this.parentInjectorId = null;
- this.shadowSlot = false;
- this.slotName = null;
- this.slotFallbackFactory = null;
- this.contentExpression = null;
- this.expressions = null;
- this.behaviorInstructions = null;
- this.providers = null;
- this.viewFactory = null;
- this.anchorIsContainer = false;
- this.elementInstruction = null;
- this.lifting = false;
- this.values = null;
- }
- return TargetInstruction;
- }(), _class4.noExpressions = Object.freeze([]), _temp);
- var viewStrategy = exports.viewStrategy = _aureliaMetadata.protocol.create('aurelia:view-strategy', {
- validate: function validate(target) {
- if (!(typeof target.loadViewFactory === 'function')) {
- return 'View strategies must implement: loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise<ViewFactory>';
- }
- return true;
- },
- compose: function compose(target) {
- if (!(typeof target.makeRelativeTo === 'function')) {
- target.makeRelativeTo = _aureliaPal.PLATFORM.noop;
- }
- }
- });
- var RelativeViewStrategy = exports.RelativeViewStrategy = (_dec = viewStrategy(), _dec(_class5 = function () {
- function RelativeViewStrategy(path) {
-
- this.path = path;
- this.absolutePath = null;
- }
- RelativeViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
- if (this.absolutePath === null && this.moduleId) {
- this.absolutePath = (0, _aureliaPath.relativeToFile)(this.path, this.moduleId);
- }
- compileInstruction.associatedModuleId = this.moduleId;
- return viewEngine.loadViewFactory(this.absolutePath || this.path, compileInstruction, loadContext, target);
- };
- RelativeViewStrategy.prototype.makeRelativeTo = function makeRelativeTo(file) {
- if (this.absolutePath === null) {
- this.absolutePath = (0, _aureliaPath.relativeToFile)(this.path, file);
- }
- };
- return RelativeViewStrategy;
- }()) || _class5);
- var ConventionalViewStrategy = exports.ConventionalViewStrategy = (_dec2 = viewStrategy(), _dec2(_class6 = function () {
- function ConventionalViewStrategy(viewLocator, origin) {
-
- this.moduleId = origin.moduleId;
- this.viewUrl = viewLocator.convertOriginToViewUrl(origin);
- }
- ConventionalViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
- compileInstruction.associatedModuleId = this.moduleId;
- return viewEngine.loadViewFactory(this.viewUrl, compileInstruction, loadContext, target);
- };
- return ConventionalViewStrategy;
- }()) || _class6);
- var NoViewStrategy = exports.NoViewStrategy = (_dec3 = viewStrategy(), _dec3(_class7 = function () {
- function NoViewStrategy(dependencies, dependencyBaseUrl) {
-
- this.dependencies = dependencies || null;
- this.dependencyBaseUrl = dependencyBaseUrl || '';
- }
- NoViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
- var entry = this.entry;
- var dependencies = this.dependencies;
- if (entry && entry.factoryIsReady) {
- return Promise.resolve(null);
- }
- this.entry = entry = new _aureliaLoader.TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl);
- entry.dependencies = [];
- entry.templateIsLoaded = true;
- if (dependencies !== null) {
- for (var i = 0, ii = dependencies.length; i < ii; ++i) {
- var current = dependencies[i];
- if (typeof current === 'string' || typeof current === 'function') {
- entry.addDependency(current);
- } else {
- entry.addDependency(current.from, current.as);
- }
- }
- }
- compileInstruction.associatedModuleId = this.moduleId;
- return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);
- };
- return NoViewStrategy;
- }()) || _class7);
- var TemplateRegistryViewStrategy = exports.TemplateRegistryViewStrategy = (_dec4 = viewStrategy(), _dec4(_class8 = function () {
- function TemplateRegistryViewStrategy(moduleId, entry) {
-
- this.moduleId = moduleId;
- this.entry = entry;
- }
- TemplateRegistryViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
- var entry = this.entry;
- if (entry.factoryIsReady) {
- return Promise.resolve(entry.factory);
- }
- compileInstruction.associatedModuleId = this.moduleId;
- return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);
- };
- return TemplateRegistryViewStrategy;
- }()) || _class8);
- var InlineViewStrategy = exports.InlineViewStrategy = (_dec5 = viewStrategy(), _dec5(_class9 = function () {
- function InlineViewStrategy(markup, dependencies, dependencyBaseUrl) {
-
- this.markup = markup;
- this.dependencies = dependencies || null;
- this.dependencyBaseUrl = dependencyBaseUrl || '';
- }
- InlineViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
- var entry = this.entry;
- var dependencies = this.dependencies;
- if (entry && entry.factoryIsReady) {
- return Promise.resolve(entry.factory);
- }
- this.entry = entry = new _aureliaLoader.TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl);
- entry.template = _aureliaPal.DOM.createTemplateFromMarkup(this.markup);
- if (dependencies !== null) {
- for (var i = 0, ii = dependencies.length; i < ii; ++i) {
- var current = dependencies[i];
- if (typeof current === 'string' || typeof current === 'function') {
- entry.addDependency(current);
- } else {
- entry.addDependency(current.from, current.as);
- }
- }
- }
- compileInstruction.associatedModuleId = this.moduleId;
- return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);
- };
- return InlineViewStrategy;
- }()) || _class9);
- var ViewLocator = exports.ViewLocator = (_temp2 = _class10 = function () {
- function ViewLocator() {
-
- }
- ViewLocator.prototype.getViewStrategy = function getViewStrategy(value) {
- if (!value) {
- return null;
- }
- if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && 'getViewStrategy' in value) {
- var _origin = _aureliaMetadata.Origin.get(value.constructor);
- value = value.getViewStrategy();
- if (typeof value === 'string') {
- value = new RelativeViewStrategy(value);
- }
- viewStrategy.assert(value);
- if (_origin.moduleId) {
- value.makeRelativeTo(_origin.moduleId);
- }
- return value;
- }
- if (typeof value === 'string') {
- value = new RelativeViewStrategy(value);
- }
- if (viewStrategy.validate(value)) {
- return value;
- }
- if (typeof value !== 'function') {
- value = value.constructor;
- }
- var origin = _aureliaMetadata.Origin.get(value);
- var strategy = _aureliaMetadata.metadata.get(ViewLocator.viewStrategyMetadataKey, value);
- if (!strategy) {
- if (!origin.moduleId) {
- throw new Error('Cannot determine default view strategy for object.', value);
- }
- strategy = this.createFallbackViewStrategy(origin);
- } else if (origin.moduleId) {
- strategy.moduleId = origin.moduleId;
- }
- return strategy;
- };
- ViewLocator.prototype.createFallbackViewStrategy = function createFallbackViewStrategy(origin) {
- return new ConventionalViewStrategy(this, origin);
- };
- ViewLocator.prototype.convertOriginToViewUrl = function convertOriginToViewUrl(origin) {
- var moduleId = origin.moduleId;
- var id = moduleId.endsWith('.js') || moduleId.endsWith('.ts') ? moduleId.substring(0, moduleId.length - 3) : moduleId;
- return id + '.html';
- };
- return ViewLocator;
- }(), _class10.viewStrategyMetadataKey = 'aurelia:view-strategy', _temp2);
- function mi(name) {
- throw new Error('BindingLanguage must implement ' + name + '().');
- }
- var BindingLanguage = exports.BindingLanguage = function () {
- function BindingLanguage() {
-
- }
- BindingLanguage.prototype.inspectAttribute = function inspectAttribute(resources, elementName, attrName, attrValue) {
- mi('inspectAttribute');
- };
- BindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, info, existingInstruction) {
- mi('createAttributeInstruction');
- };
- BindingLanguage.prototype.inspectTextContent = function inspectTextContent(resources, value) {
- mi('inspectTextContent');
- };
- return BindingLanguage;
- }();
- var noNodes = Object.freeze([]);
- var SlotCustomAttribute = exports.SlotCustomAttribute = (_dec6 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element), _dec6(_class11 = function () {
- function SlotCustomAttribute(element) {
-
- this.element = element;
- this.element.auSlotAttribute = this;
- }
- SlotCustomAttribute.prototype.valueChanged = function valueChanged(newValue, oldValue) {};
- return SlotCustomAttribute;
- }()) || _class11);
- var PassThroughSlot = exports.PassThroughSlot = function () {
- function PassThroughSlot(anchor, name, destinationName, fallbackFactory) {
-
- this.anchor = anchor;
- this.anchor.viewSlot = this;
- this.name = name;
- this.destinationName = destinationName;
- this.fallbackFactory = fallbackFactory;
- this.destinationSlot = null;
- this.projections = 0;
- this.contentView = null;
- var attr = new SlotCustomAttribute(this.anchor);
- attr.value = this.destinationName;
- }
- PassThroughSlot.prototype.renderFallbackContent = function renderFallbackContent(view, nodes, projectionSource, index) {
- if (this.contentView === null) {
- this.contentView = this.fallbackFactory.create(this.ownerView.container);
- this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);
- var slots = Object.create(null);
- slots[this.destinationSlot.name] = this.destinationSlot;
- ShadowDOM.distributeView(this.contentView, slots, projectionSource, index, this.destinationSlot.name);
- }
- };
- PassThroughSlot.prototype.passThroughTo = function passThroughTo(destinationSlot) {
- this.destinationSlot = destinationSlot;
- };
- PassThroughSlot.prototype.addNode = function addNode(view, node, projectionSource, index) {
- if (this.contentView !== null) {
- this.contentView.removeNodes();
- this.contentView.detached();
- this.contentView.unbind();
- this.contentView = null;
- }
- if (node.viewSlot instanceof PassThroughSlot) {
- node.viewSlot.passThroughTo(this);
- return;
- }
- this.projections++;
- this.destinationSlot.addNode(view, node, projectionSource, index);
- };
- PassThroughSlot.prototype.removeView = function removeView(view, projectionSource) {
- this.projections--;
- this.destinationSlot.removeView(view, projectionSource);
- if (this.needsFallbackRendering) {
- this.renderFallbackContent(null, noNodes, projectionSource);
- }
- };
- PassThroughSlot.prototype.removeAll = function removeAll(projectionSource) {
- this.projections = 0;
- this.destinationSlot.removeAll(projectionSource);
- if (this.needsFallbackRendering) {
- this.renderFallbackContent(null, noNodes, projectionSource);
- }
- };
- PassThroughSlot.prototype.projectFrom = function projectFrom(view, projectionSource) {
- this.destinationSlot.projectFrom(view, projectionSource);
- };
- PassThroughSlot.prototype.created = function created(ownerView) {
- this.ownerView = ownerView;
- };
- PassThroughSlot.prototype.bind = function bind(view) {
- if (this.contentView) {
- this.contentView.bind(view.bindingContext, view.overrideContext);
- }
- };
- PassThroughSlot.prototype.attached = function attached() {
- if (this.contentView) {
- this.contentView.attached();
- }
- };
- PassThroughSlot.prototype.detached = function detached() {
- if (this.contentView) {
- this.contentView.detached();
- }
- };
- PassThroughSlot.prototype.unbind = function unbind() {
- if (this.contentView) {
- this.contentView.unbind();
- }
- };
- _createClass(PassThroughSlot, [{
- key: 'needsFallbackRendering',
- get: function get() {
- return this.fallbackFactory && this.projections === 0;
- }
- }]);
- return PassThroughSlot;
- }();
- var ShadowSlot = exports.ShadowSlot = function () {
- function ShadowSlot(anchor, name, fallbackFactory) {
-
- this.anchor = anchor;
- this.anchor.isContentProjectionSource = true;
- this.anchor.viewSlot = this;
- this.name = name;
- this.fallbackFactory = fallbackFactory;
- this.contentView = null;
- this.projections = 0;
- this.children = [];
- this.projectFromAnchors = null;
- this.destinationSlots = null;
- }
- ShadowSlot.prototype.addNode = function addNode(view, node, projectionSource, index, destination) {
- if (this.contentView !== null) {
- this.contentView.removeNodes();
- this.contentView.detached();
- this.contentView.unbind();
- this.contentView = null;
- }
- if (node.viewSlot instanceof PassThroughSlot) {
- node.viewSlot.passThroughTo(this);
- return;
- }
- if (this.destinationSlots !== null) {
- ShadowDOM.distributeNodes(view, [node], this.destinationSlots, this, index);
- } else {
- node.auOwnerView = view;
- node.auProjectionSource = projectionSource;
- node.auAssignedSlot = this;
- var anchor = this._findAnchor(view, node, projectionSource, index);
- var parent = anchor.parentNode;
- parent.insertBefore(node, anchor);
- this.children.push(node);
- this.projections++;
- }
- };
- ShadowSlot.prototype.removeView = function removeView(view, projectionSource) {
- if (this.destinationSlots !== null) {
- ShadowDOM.undistributeView(view, this.destinationSlots, this);
- } else if (this.contentView && this.contentView.hasSlots) {
- ShadowDOM.undistributeView(view, this.contentView.slots, projectionSource);
- } else {
- var found = this.children.find(function (x) {
- return x.auSlotProjectFrom === projectionSource;
- });
- if (found) {
- var _children = found.auProjectionChildren;
- for (var i = 0, ii = _children.length; i < ii; ++i) {
- var _child = _children[i];
- if (_child.auOwnerView === view) {
- _children.splice(i, 1);
- view.fragment.appendChild(_child);
- i--;ii--;
- this.projections--;
- }
- }
- if (this.needsFallbackRendering) {
- this.renderFallbackContent(view, noNodes, projectionSource);
- }
- }
- }
- };
- ShadowSlot.prototype.removeAll = function removeAll(projectionSource) {
- if (this.destinationSlots !== null) {
- ShadowDOM.undistributeAll(this.destinationSlots, this);
- } else if (this.contentView && this.contentView.hasSlots) {
- ShadowDOM.undistributeAll(this.contentView.slots, projectionSource);
- } else {
- var found = this.children.find(function (x) {
- return x.auSlotProjectFrom === projectionSource;
- });
- if (found) {
- var _children2 = found.auProjectionChildren;
- for (var i = 0, ii = _children2.length; i < ii; ++i) {
- var _child2 = _children2[i];
- _child2.auOwnerView.fragment.appendChild(_child2);
- this.projections--;
- }
- found.auProjectionChildren = [];
- if (this.needsFallbackRendering) {
- this.renderFallbackContent(null, noNodes, projectionSource);
- }
- }
- }
- };
- ShadowSlot.prototype._findAnchor = function _findAnchor(view, node, projectionSource, index) {
- if (projectionSource) {
- var found = this.children.find(function (x) {
- return x.auSlotProjectFrom === projectionSource;
- });
- if (found) {
- if (index !== undefined) {
- var _children3 = found.auProjectionChildren;
- var viewIndex = -1;
- var lastView = void 0;
- for (var i = 0, ii = _children3.length; i < ii; ++i) {
- var current = _children3[i];
- if (current.auOwnerView !== lastView) {
- viewIndex++;
- lastView = current.auOwnerView;
- if (viewIndex >= index && lastView !== view) {
- _children3.splice(i, 0, node);
- return current;
- }
- }
- }
- }
- found.auProjectionChildren.push(node);
- return found;
- }
- }
- return this.anchor;
- };
- ShadowSlot.prototype.projectTo = function projectTo(slots) {
- this.destinationSlots = slots;
- };
- ShadowSlot.prototype.projectFrom = function projectFrom(view, projectionSource) {
- var anchor = _aureliaPal.DOM.createComment('anchor');
- var parent = this.anchor.parentNode;
- anchor.auSlotProjectFrom = projectionSource;
- anchor.auOwnerView = view;
- anchor.auProjectionChildren = [];
- parent.insertBefore(anchor, this.anchor);
- this.children.push(anchor);
- if (this.projectFromAnchors === null) {
- this.projectFromAnchors = [];
- }
- this.projectFromAnchors.push(anchor);
- };
- ShadowSlot.prototype.renderFallbackContent = function renderFallbackContent(view, nodes, projectionSource, index) {
- if (this.contentView === null) {
- this.contentView = this.fallbackFactory.create(this.ownerView.container);
- this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);
- this.contentView.insertNodesBefore(this.anchor);
- }
- if (this.contentView.hasSlots) {
- var slots = this.contentView.slots;
- var projectFromAnchors = this.projectFromAnchors;
- if (projectFromAnchors !== null) {
- for (var slotName in slots) {
- var slot = slots[slotName];
- for (var i = 0, ii = projectFromAnchors.length; i < ii; ++i) {
- var anchor = projectFromAnchors[i];
- slot.projectFrom(anchor.auOwnerView, anchor.auSlotProjectFrom);
- }
- }
- }
- this.fallbackSlots = slots;
- ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index);
- }
- };
- ShadowSlot.prototype.created = function created(ownerView) {
- this.ownerView = ownerView;
- };
- ShadowSlot.prototype.bind = function bind(view) {
- if (this.contentView) {
- this.contentView.bind(view.bindingContext, view.overrideContext);
- }
- };
- ShadowSlot.prototype.attached = function attached() {
- if (this.contentView) {
- this.contentView.attached();
- }
- };
- ShadowSlot.prototype.detached = function detached() {
- if (this.contentView) {
- this.contentView.detached();
- }
- };
- ShadowSlot.prototype.unbind = function unbind() {
- if (this.contentView) {
- this.contentView.unbind();
- }
- };
- _createClass(ShadowSlot, [{
- key: 'needsFallbackRendering',
- get: function get() {
- return this.fallbackFactory && this.projections === 0;
- }
- }]);
- return ShadowSlot;
- }();
- var ShadowDOM = exports.ShadowDOM = (_temp3 = _class12 = function () {
- function ShadowDOM() {
-
- }
- ShadowDOM.getSlotName = function getSlotName(node) {
- if (node.auSlotAttribute === undefined) {
- return ShadowDOM.defaultSlotKey;
- }
- return node.auSlotAttribute.value;
- };
- ShadowDOM.distributeView = function distributeView(view, slots, projectionSource, index, destinationOverride) {
- var nodes = void 0;
- if (view === null) {
- nodes = noNodes;
- } else {
- var childNodes = view.fragment.childNodes;
- var ii = childNodes.length;
- nodes = new Array(ii);
- for (var i = 0; i < ii; ++i) {
- nodes[i] = childNodes[i];
- }
- }
- ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride);
- };
- ShadowDOM.undistributeView = function undistributeView(view, slots, projectionSource) {
- for (var slotName in slots) {
- slots[slotName].removeView(view, projectionSource);
- }
- };
- ShadowDOM.undistributeAll = function undistributeAll(slots, projectionSource) {
- for (var slotName in slots) {
- slots[slotName].removeAll(projectionSource);
- }
- };
- ShadowDOM.distributeNodes = function distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride) {
- for (var i = 0, ii = nodes.length; i < ii; ++i) {
- var currentNode = nodes[i];
- var nodeType = currentNode.nodeType;
- if (currentNode.isContentProjectionSource) {
- currentNode.viewSlot.projectTo(slots);
- for (var slotName in slots) {
- slots[slotName].projectFrom(view, currentNode.viewSlot);
- }
- nodes.splice(i, 1);
- ii--;i--;
- } else if (nodeType === 1 || nodeType === 3 || currentNode.viewSlot instanceof PassThroughSlot) {
- if (nodeType === 3 && _isAllWhitespace(currentNode)) {
- nodes.splice(i, 1);
- ii--;i--;
- } else {
- var found = slots[destinationOverride || ShadowDOM.getSlotName(currentNode)];
- if (found) {
- found.addNode(view, currentNode, projectionSource, index);
- nodes.splice(i, 1);
- ii--;i--;
- }
- }
- } else {
- nodes.splice(i, 1);
- ii--;i--;
- }
- }
- for (var _slotName in slots) {
- var slot = slots[_slotName];
- if (slot.needsFallbackRendering) {
- slot.renderFallbackContent(view, nodes, projectionSource, index);
- }
- }
- };
- return ShadowDOM;
- }(), _class12.defaultSlotKey = '__au-default-slot-key__', _temp3);
- function register(lookup, name, resource, type) {
- if (!name) {
- return;
- }
- var existing = lookup[name];
- if (existing) {
- if (existing !== resource) {
- throw new Error('Attempted to register ' + type + ' when one with the same name already exists. Name: ' + name + '.');
- }
- return;
- }
- lookup[name] = resource;
- }
- var ViewResources = exports.ViewResources = function () {
- function ViewResources(parent, viewUrl) {
-
- this.bindingLanguage = null;
- this.parent = parent || null;
- this.hasParent = this.parent !== null;
- this.viewUrl = viewUrl || '';
- this.lookupFunctions = {
- valueConverters: this.getValueConverter.bind(this),
- bindingBehaviors: this.getBindingBehavior.bind(this)
- };
- this.attributes = Object.create(null);
- this.elements = Object.create(null);
- this.valueConverters = Object.create(null);
- this.bindingBehaviors = Object.create(null);
- this.attributeMap = Object.create(null);
- this.values = Object.create(null);
- this.beforeCompile = this.afterCompile = this.beforeCreate = this.afterCreate = this.beforeBind = this.beforeUnbind = false;
- }
- ViewResources.prototype._tryAddHook = function _tryAddHook(obj, name) {
- if (typeof obj[name] === 'function') {
- var func = obj[name].bind(obj);
- var counter = 1;
- var callbackName = void 0;
- while (this[callbackName = name + counter.toString()] !== undefined) {
- counter++;
- }
- this[name] = true;
- this[callbackName] = func;
- }
- };
- ViewResources.prototype._invokeHook = function _invokeHook(name, one, two, three, four) {
- if (this.hasParent) {
- this.parent._invokeHook(name, one, two, three, four);
- }
- if (this[name]) {
- this[name + '1'](one, two, three, four);
- var callbackName = name + '2';
- if (this[callbackName]) {
- this[callbackName](one, two, three, four);
- callbackName = name + '3';
- if (this[callbackName]) {
- this[callbackName](one, two, three, four);
- var counter = 4;
- while (this[callbackName = name + counter.toString()] !== undefined) {
- this[callbackName](one, two, three, four);
- counter++;
- }
- }
- }
- }
- };
- ViewResources.prototype.registerViewEngineHooks = function registerViewEngineHooks(hooks) {
- this._tryAddHook(hooks, 'beforeCompile');
- this._tryAddHook(hooks, 'afterCompile');
- this._tryAddHook(hooks, 'beforeCreate');
- this._tryAddHook(hooks, 'afterCreate');
- this._tryAddHook(hooks, 'beforeBind');
- this._tryAddHook(hooks, 'beforeUnbind');
- };
- ViewResources.prototype.getBindingLanguage = function getBindingLanguage(bindingLanguageFallback) {
- return this.bindingLanguage || (this.bindingLanguage = bindingLanguageFallback);
- };
- ViewResources.prototype.patchInParent = function patchInParent(newParent) {
- var originalParent = this.parent;
- this.parent = newParent || null;
- this.hasParent = this.parent !== null;
- if (newParent.parent === null) {
- newParent.parent = originalParent;
- newParent.hasParent = originalParent !== null;
- }
- };
- ViewResources.prototype.relativeToView = function relativeToView(path) {
- return (0, _aureliaPath.relativeToFile)(path, this.viewUrl);
- };
- ViewResources.prototype.registerElement = function registerElement(tagName, behavior) {
- register(this.elements, tagName, behavior, 'an Element');
- };
- ViewResources.prototype.getElement = function getElement(tagName) {
- return this.elements[tagName] || (this.hasParent ? this.parent.getElement(tagName) : null);
- };
- ViewResources.prototype.mapAttribute = function mapAttribute(attribute) {
- return this.attributeMap[attribute] || (this.hasParent ? this.parent.mapAttribute(attribute) : null);
- };
- ViewResources.prototype.registerAttribute = function registerAttribute(attribute, behavior, knownAttribute) {
- this.attributeMap[attribute] = knownAttribute;
- register(this.attributes, attribute, behavior, 'an Attribute');
- };
- ViewResources.prototype.getAttribute = function getAttribute(attribute) {
- return this.attributes[attribute] || (this.hasParent ? this.parent.getAttribute(attribute) : null);
- };
- ViewResources.prototype.registerValueConverter = function registerValueConverter(name, valueConverter) {
- register(this.valueConverters, name, valueConverter, 'a ValueConverter');
- };
- ViewResources.prototype.getValueConverter = function getValueConverter(name) {
- return this.valueConverters[name] || (this.hasParent ? this.parent.getValueConverter(name) : null);
- };
- ViewResources.prototype.registerBindingBehavior = function registerBindingBehavior(name, bindingBehavior) {
- register(this.bindingBehaviors, name, bindingBehavior, 'a BindingBehavior');
- };
- ViewResources.prototype.getBindingBehavior = function getBindingBehavior(name) {
- return this.bindingBehaviors[name] || (this.hasParent ? this.parent.getBindingBehavior(name) : null);
- };
- ViewResources.prototype.registerValue = function registerValue(name, value) {
- register(this.values, name, value, 'a value');
- };
- ViewResources.prototype.getValue = function getValue(name) {
- return this.values[name] || (this.hasParent ? this.parent.getValue(name) : null);
- };
- return ViewResources;
- }();
- var View = exports.View = function () {
- function View(container, viewFactory, fragment, controllers, bindings, children, slots) {
-
- this.container = container;
- this.viewFactory = viewFactory;
- this.resources = viewFactory.resources;
- this.fragment = fragment;
- this.firstChild = fragment.firstChild;
- this.lastChild = fragment.lastChild;
- this.controllers = controllers;
- this.bindings = bindings;
- this.children = children;
- this.slots = slots;
- this.hasSlots = false;
- this.fromCache = false;
- this.isBound = false;
- this.isAttached = false;
- this.bindingContext = null;
- this.overrideContext = null;
- this.controller = null;
- this.viewModelScope = null;
- this.animatableElement = undefined;
- this._isUserControlled = false;
- this.contentView = null;
- for (var key in slots) {
- this.hasSlots = true;
- break;
- }
- }
- View.prototype.returnToCache = function returnToCache() {
- this.viewFactory.returnViewToCache(this);
- };
- View.prototype.created = function created() {
- var i = void 0;
- var ii = void 0;
- var controllers = this.controllers;
- for (i = 0, ii = controllers.length; i < ii; ++i) {
- controllers[i].created(this);
- }
- };
- View.prototype.bind = function bind(bindingContext, overrideContext, _systemUpdate) {
- var controllers = void 0;
- var bindings = void 0;
- var children = void 0;
- var i = void 0;
- var ii = void 0;
- if (_systemUpdate && this._isUserControlled) {
- return;
- }
- if (this.isBound) {
- if (this.bindingContext === bindingContext) {
- return;
- }
- this.unbind();
- }
- this.isBound = true;
- this.bindingContext = bindingContext;
- this.overrideContext = overrideContext || (0, _aureliaBinding.createOverrideContext)(bindingContext);
- this.resources._invokeHook('beforeBind', this);
- bindings = this.bindings;
- for (i = 0, ii = bindings.length; i < ii; ++i) {
- bindings[i].bind(this);
- }
- if (this.viewModelScope !== null) {
- bindingContext.bind(this.viewModelScope.bindingContext, this.viewModelScope.overrideContext);
- this.viewModelScope = null;
- }
- controllers = this.controllers;
- for (i = 0, ii = controllers.length; i < ii; ++i) {
- controllers[i].bind(this);
- }
- children = this.children;
- for (i = 0, ii = children.length; i < ii; ++i) {
- children[i].bind(bindingContext, overrideContext, true);
- }
- if (this.hasSlots) {
- ShadowDOM.distributeView(this.contentView, this.slots);
- }
- };
- View.prototype.addBinding = function addBinding(binding) {
- this.bindings.push(binding);
- if (this.isBound) {
- binding.bind(this);
- }
- };
- View.prototype.unbind = function unbind() {
- var controllers = void 0;
- var bindings = void 0;
- var children = void 0;
- var i = void 0;
- var ii = void 0;
- if (this.isBound) {
- this.isBound = false;
- this.resources._invokeHook('beforeUnbind', this);
- if (this.controller !== null) {
- this.controller.unbind();
- }
- bindings = this.bindings;
- for (i = 0, ii = bindings.length; i < ii; ++i) {
- bindings[i].unbind();
- }
- controllers = this.controllers;
- for (i = 0, ii = controllers.length; i < ii; ++i) {
- controllers[i].unbind();
- }
- children = this.children;
- for (i = 0, ii = children.length; i < ii; ++i) {
- children[i].unbind();
- }
- this.bindingContext = null;
- this.overrideContext = null;
- }
- };
- View.prototype.insertNodesBefore = function insertNodesBefore(refNode) {
- refNode.parentNode.insertBefore(this.fragment, refNode);
- };
- View.prototype.appendNodesTo = function appendNodesTo(parent) {
- parent.appendChild(this.fragment);
- };
- View.prototype.removeNodes = function removeNodes() {
- var fragment = this.fragment;
- var current = this.firstChild;
- var end = this.lastChild;
- var next = void 0;
- while (current) {
- next = current.nextSibling;
- fragment.appendChild(current);
- if (current === end) {
- break;
- }
- current = next;
- }
- };
- View.prototype.attached = function attached() {
- var controllers = void 0;
- var children = void 0;
- var i = void 0;
- var ii = void 0;
- if (this.isAttached) {
- return;
- }
- this.isAttached = true;
- if (this.controller !== null) {
- this.controller.attached();
- }
- controllers = this.controllers;
- for (i = 0, ii = controllers.length; i < ii; ++i) {
- controllers[i].attached();
- }
- children = this.children;
- for (i = 0, ii = children.length; i < ii; ++i) {
- children[i].attached();
- }
- };
- View.prototype.detached = function detached() {
- var controllers = void 0;
- var children = void 0;
- var i = void 0;
- var ii = void 0;
- if (this.isAttached) {
- this.isAttached = false;
- if (this.controller !== null) {
- this.controller.detached();
- }
- controllers = this.controllers;
- for (i = 0, ii = controllers.length; i < ii; ++i) {
- controllers[i].detached();
- }
- children = this.children;
- for (i = 0, ii = children.length; i < ii; ++i) {
- children[i].detached();
- }
- }
- };
- return View;
- }();
- function getAnimatableElement(view) {
- if (view.animatableElement !== undefined) {
- return view.animatableElement;
- }
- var current = view.firstChild;
- while (current && current.nodeType !== 1) {
- current = current.nextSibling;
- }
- if (current && current.nodeType === 1) {
- return view.animatableElement = current.classList.contains('au-animate') ? current : null;
- }
- return view.animatableElement = null;
- }
- var ViewSlot = exports.ViewSlot = function () {
- function ViewSlot(anchor, anchorIsContainer) {
- var animator = arguments.length <= 2 || arguments[2] === undefined ? Animator.instance : arguments[2];
-
- this.anchor = anchor;
- this.anchorIsContainer = anchorIsContainer;
- this.bindingContext = null;
- this.overrideContext = null;
- this.animator = animator;
- this.children = [];
- this.isBound = false;
- this.isAttached = false;
- this.contentSelectors = null;
- anchor.viewSlot = this;
- anchor.isContentProjectionSource = false;
- }
- ViewSlot.prototype.animateView = function animateView(view) {
- var direction = arguments.length <= 1 || arguments[1] === undefined ? 'enter' : arguments[1];
- var animatableElement = getAnimatableElement(view);
- if (animatableElement !== null) {
- switch (direction) {
- case 'enter':
- return this.animator.enter(animatableElement);
- case 'leave':
- return this.animator.leave(animatableElement);
- default:
- throw new Error('Invalid animation direction: ' + direction);
- }
- }
- };
- ViewSlot.prototype.transformChildNodesIntoView = function transformChildNodesIntoView() {
- var parent = this.anchor;
- this.children.push({
- fragment: parent,
- firstChild: parent.firstChild,
- lastChild: parent.lastChild,
- returnToCache: function returnToCache() {},
- removeNodes: function removeNodes() {
- var last = void 0;
- while (last = parent.lastChild) {
- parent.removeChild(last);
- }
- },
- created: function created() {},
- bind: function bind() {},
- unbind: function unbind() {},
- attached: function attached() {},
- detached: function detached() {}
- });
- };
- ViewSlot.prototype.bind = function bind(bindingContext, overrideContext) {
- var i = void 0;
- var ii = void 0;
- var children = void 0;
- if (this.isBound) {
- if (this.bindingContext === bindingContext) {
- return;
- }
- this.unbind();
- }
- this.isBound = true;
- this.bindingContext = bindingContext = bindingContext || this.bindingContext;
- this.overrideContext = overrideContext = overrideContext || this.overrideContext;
- children = this.children;
- for (i = 0, ii = children.length; i < ii; ++i) {
- children[i].bind(bindingContext, overrideContext, true);
- }
- };
- ViewSlot.prototype.unbind = function unbind() {
- if (this.isBound) {
- var i = void 0;
- var ii = void 0;
- var _children4 = this.children;
- this.isBound = false;
- this.bindingContext = null;
- this.overrideContext = null;
- for (i = 0, ii = _children4.length; i < ii; ++i) {
- _children4[i].unbind();
- }
- }
- };
- ViewSlot.prototype.add = function add(view) {
- if (this.anchorIsContainer) {
- view.appendNodesTo(this.anchor);
- } else {
- view.insertNodesBefore(this.anchor);
- }
- this.children.push(view);
- if (this.isAttached) {
- view.attached();
- return this.animateView(view, 'enter');
- }
- };
- ViewSlot.prototype.insert = function insert(index, view) {
- var children = this.children;
- var length = children.length;
- if (index === 0 && length === 0 || index >= length) {
- return this.add(view);
- }
- view.insertNodesBefore(children[index].firstChild);
- children.splice(index, 0, view);
- if (this.isAttached) {
- view.attached();
- return this.animateView(view, 'enter');
- }
- };
- ViewSlot.prototype.move = function move(sourceIndex, targetIndex) {
- if (sourceIndex === targetIndex) {
- return;
- }
- var children = this.children;
- var view = children[sourceIndex];
- view.removeNodes();
- view.insertNodesBefore(children[targetIndex].firstChild);
- children.splice(sourceIndex, 1);
- children.splice(targetIndex, 0, view);
- };
- ViewSlot.prototype.remove = function remove(view, returnToCache, skipAnimation) {
- return this.removeAt(this.children.indexOf(view), returnToCache, skipAnimation);
- };
- ViewSlot.prototype.removeMany = function removeMany(viewsToRemove, returnToCache, skipAnimation) {
- var _this4 = this;
- var children = this.children;
- var ii = viewsToRemove.length;
- var i = void 0;
- var rmPromises = [];
- viewsToRemove.forEach(function (child) {
- if (skipAnimation) {
- child.removeNodes();
- return;
- }
- var animation = _this4.animateView(child, 'leave');
- if (animation) {
- rmPromises.push(animation.then(function () {
- return child.removeNodes();
- }));
- } else {
- child.removeNodes();
- }
- });
- var removeAction = function removeAction() {
- if (_this4.isAttached) {
- for (i = 0; i < ii; ++i) {
- viewsToRemove[i].detached();
- }
- }
- if (returnToCache) {
- for (i = 0; i < ii; ++i) {
- viewsToRemove[i].returnToCache();
- }
- }
- for (i = 0; i < ii; ++i) {
- var index = children.indexOf(viewsToRemove[i]);
- if (index >= 0) {
- children.splice(index, 1);
- }
- }
- };
- if (rmPromises.length > 0) {
- return Promise.all(rmPromises).then(function () {
- return removeAction();
- });
- }
- return removeAction();
- };
- ViewSlot.prototype.removeAt = function removeAt(index, returnToCache, skipAnimation) {
- var _this5 = this;
- var view = this.children[index];
- var removeAction = function removeAction() {
- index = _this5.children.indexOf(view);
- view.removeNodes();
- _this5.children.splice(index, 1);
- if (_this5.isAttached) {
- view.detached();
- }
- if (returnToCache) {
- view.returnToCache();
- }
- return view;
- };
- if (!skipAnimation) {
- var animation = this.animateView(view, 'leave');
- if (animation) {
- return animation.then(function () {
- return removeAction();
- });
- }
- }
- return removeAction();
- };
- ViewSlot.prototype.removeAll = function removeAll(returnToCache, skipAnimation) {
- var _this6 = this;
- var children = this.children;
- var ii = children.length;
- var i = void 0;
- var rmPromises = [];
- children.forEach(function (child) {
- if (skipAnimation) {
- child.removeNodes();
- return;
- }
- var animation = _this6.animateView(child, 'leave');
- if (animation) {
- rmPromises.push(animation.then(function () {
- return child.removeNodes();
- }));
- } else {
- child.removeNodes();
- }
- });
- var removeAction = function removeAction() {
- if (_this6.isAttached) {
- for (i = 0; i < ii; ++i) {
- children[i].detached();
- }
- }
- if (returnToCache) {
- for (i = 0; i < ii; ++i) {
- children[i].returnToCache();
- }
- }
- _this6.children = [];
- };
- if (rmPromises.length > 0) {
- return Promise.all(rmPromises).then(function () {
- return removeAction();
- });
- }
- return removeAction();
- };
- ViewSlot.prototype.attached = function attached() {
- var i = void 0;
- var ii = void 0;
- var children = void 0;
- var child = void 0;
- if (this.isAttached) {
- return;
- }
- this.isAttached = true;
- children = this.children;
- for (i = 0, ii = children.length; i < ii; ++i) {
- child = children[i];
- child.attached();
- this.animateView(child, 'enter');
- }
- };
- ViewSlot.prototype.detached = function detached() {
- var i = void 0;
- var ii = void 0;
- var children = void 0;
- if (this.isAttached) {
- this.isAttached = false;
- children = this.children;
- for (i = 0, ii = children.length; i < ii; ++i) {
- children[i].detached();
- }
- }
- };
- ViewSlot.prototype.projectTo = function projectTo(slots) {
- var _this7 = this;
- this.projectToSlots = slots;
- this.add = this._projectionAdd;
- this.insert = this._projectionInsert;
- this.move = this._projectionMove;
- this.remove = this._projectionRemove;
- this.removeAt = this._projectionRemoveAt;
- this.removeMany = this._projectionRemoveMany;
- this.removeAll = this._projectionRemoveAll;
- this.children.forEach(function (view) {
- return ShadowDOM.distributeView(view, slots, _this7);
- });
- };
- ViewSlot.prototype._projectionAdd = function _projectionAdd(view) {
- ShadowDOM.distributeView(view, this.projectToSlots, this);
- this.children.push(view);
- if (this.isAttached) {
- view.attached();
- }
- };
- ViewSlot.prototype._projectionInsert = function _projectionInsert(index, view) {
- if (index === 0 && !this.children.length || index >= this.children.length) {
- this.add(view);
- } else {
- ShadowDOM.distributeView(view, this.projectToSlots, this, index);
- this.children.splice(index, 0, view);
- if (this.isAttached) {
- view.attached();
- }
- }
- };
- ViewSlot.prototype._projectionMove = function _projectionMove(sourceIndex, targetIndex) {
- if (sourceIndex === targetIndex) {
- return;
- }
- var children = this.children;
- var view = children[sourceIndex];
- ShadowDOM.undistributeView(view, this.projectToSlots, this);
- ShadowDOM.distributeView(view, this.projectToSlots, this, targetIndex);
- children.splice(sourceIndex, 1);
- children.splice(targetIndex, 0, view);
- };
- ViewSlot.prototype._projectionRemove = function _projectionRemove(view, returnToCache) {
- ShadowDOM.undistributeView(view, this.projectToSlots, this);
- this.children.splice(this.children.indexOf(view), 1);
- if (this.isAttached) {
- view.detached();
- }
- };
- ViewSlot.prototype._projectionRemoveAt = function _projectionRemoveAt(index, returnToCache) {
- var view = this.children[index];
- ShadowDOM.undistributeView(view, this.projectToSlots, this);
- this.children.splice(index, 1);
- if (this.isAttached) {
- view.detached();
- }
- };
- ViewSlot.prototype._projectionRemoveMany = function _projectionRemoveMany(viewsToRemove, returnToCache) {
- var _this8 = this;
- viewsToRemove.forEach(function (view) {
- return _this8.remove(view, returnToCache);
- });
- };
- ViewSlot.prototype._projectionRemoveAll = function _projectionRemoveAll(returnToCache) {
- ShadowDOM.undistributeAll(this.projectToSlots, this);
- var children = this.children;
- if (this.isAttached) {
- for (var i = 0, ii = children.length; i < ii; ++i) {
- children[i].detached();
- }
- }
- this.children = [];
- };
- return ViewSlot;
- }();
- var ProviderResolver = (0, _aureliaDependencyInjection.resolver)(_class15 = function () {
- function ProviderResolver() {
-
- }
- ProviderResolver.prototype.get = function get(container, key) {
- var id = key.__providerId__;
- return id in container ? container[id] : container[id] = container.invoke(key);
- };
- return ProviderResolver;
- }()) || _class15;
- var providerResolverInstance = new ProviderResolver();
- function elementContainerGet(key) {
- if (key === _aureliaPal.DOM.Element) {
- return this.element;
- }
- if (key === BoundViewFactory) {
- if (this.boundViewFactory) {
- return this.boundViewFactory;
- }
- var factory = this.instruction.viewFactory;
- var _partReplacements = this.partReplacements;
- if (_partReplacements) {
- factory = _partReplacements[factory.part] || factory;
- }
- this.boundViewFactory = new BoundViewFactory(this, factory, _partReplacements);
- return this.boundViewFactory;
- }
- if (key === ViewSlot) {
- if (this.viewSlot === undefined) {
- this.viewSlot = new ViewSlot(this.element, this.instruction.anchorIsContainer);
- this.element.isContentProjectionSource = this.instruction.lifting;
- this.children.push(this.viewSlot);
- }
- return this.viewSlot;
- }
- if (key === ElementEvents) {
- return this.elementEvents || (this.elementEvents = new ElementEvents(this.element));
- }
- if (key === CompositionTransaction) {
- return this.compositionTransaction || (this.compositionTransaction = this.parent.get(key));
- }
- if (key === ViewResources) {
- return this.viewResources;
- }
- if (key === TargetInstruction) {
- return this.instruction;
- }
- return this.superGet(key);
- }
- function createElementContainer(parent, element, instruction, children, partReplacements, resources) {
- var container = parent.createChild();
- var providers = void 0;
- var i = void 0;
- container.element = element;
- container.instruction = instruction;
- container.children = children;
- container.viewResources = resources;
- container.partReplacements = partReplacements;
- providers = instruction.providers;
- i = providers.length;
- while (i--) {
- container._resolvers.set(providers[i], providerResolverInstance);
- }
- container.superGet = container.get;
- container.get = elementContainerGet;
- return container;
- }
- function makeElementIntoAnchor(element, elementInstruction) {
- var anchor = _aureliaPal.DOM.createComment('anchor');
- if (elementInstruction) {
- var firstChild = element.firstChild;
- if (firstChild && firstChild.tagName === 'AU-CONTENT') {
- anchor.contentElement = firstChild;
- }
- anchor.hasAttribute = function (name) {
- return element.hasAttribute(name);
- };
- anchor.getAttribute = function (name) {
- return element.getAttribute(name);
- };
- anchor.setAttribute = function (name, value) {
- element.setAttribute(name, value);
- };
- }
- _aureliaPal.DOM.replaceNode(anchor, element);
- return anchor;
- }
- function applyInstructions(containers, element, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources) {
- var behaviorInstructions = instruction.behaviorInstructions;
- var expressions = instruction.expressions;
- var elementContainer = void 0;
- var i = void 0;
- var ii = void 0;
- var current = void 0;
- var instance = void 0;
- if (instruction.contentExpression) {
- bindings.push(instruction.contentExpression.createBinding(element.nextSibling));
- element.nextSibling.auInterpolationTarget = true;
- element.parentNode.removeChild(element);
- return;
- }
- if (instruction.shadowSlot) {
- var commentAnchor = _aureliaPal.DOM.createComment('slot');
- var slot = void 0;
- if (instruction.slotDestination) {
- slot = new PassThroughSlot(commentAnchor, instruction.slotName, instruction.slotDestination, instruction.slotFallbackFactory);
- } else {
- slot = new ShadowSlot(commentAnchor, instruction.slotName, instruction.slotFallbackFactory);
- }
- _aureliaPal.DOM.replaceNode(commentAnchor, element);
- shadowSlots[instruction.slotName] = slot;
- controllers.push(slot);
- return;
- }
- if (behaviorInstructions.length) {
- if (!instruction.anchorIsContainer) {
- element = makeElementIntoAnchor(element, instruction.elementInstruction);
- }
- containers[instruction.injectorId] = elementContainer = createElementContainer(containers[instruction.parentInjectorId], element, instruction, children, partReplacements, resources);
- for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {
- current = behaviorInstructions[i];
- instance = current.type.create(elementContainer, current, element, bindings);
- controllers.push(instance);
- }
- }
- for (i = 0, ii = expressions.length; i < ii; ++i) {
- bindings.push(expressions[i].createBinding(element));
- }
- }
- function styleStringToObject(style, target) {
- var attributes = style.split(';');
- var firstIndexOfColon = void 0;
- var i = void 0;
- var current = void 0;
- var key = void 0;
- var value = void 0;
- target = target || {};
- for (i = 0; i < attributes.length; i++) {
- current = attributes[i];
- firstIndexOfColon = current.indexOf(':');
- key = current.substring(0, firstIndexOfColon).trim();
- value = current.substring(firstIndexOfColon + 1).trim();
- target[key] = value;
- }
- return target;
- }
- function styleObjectToString(obj) {
- var result = '';
- for (var key in obj) {
- result += key + ':' + obj[key] + ';';
- }
- return result;
- }
- function applySurrogateInstruction(container, element, instruction, controllers, bindings, children) {
- var behaviorInstructions = instruction.behaviorInstructions;
- var expressions = instruction.expressions;
- var providers = instruction.providers;
- var values = instruction.values;
- var i = void 0;
- var ii = void 0;
- var current = void 0;
- var instance = void 0;
- var currentAttributeValue = void 0;
- i = providers.length;
- while (i--) {
- container._resolvers.set(providers[i], providerResolverInstance);
- }
- for (var key in values) {
- currentAttributeValue = element.getAttribute(key);
- if (currentAttributeValue) {
- if (key === 'class') {
- element.setAttribute('class', currentAttributeValue + ' ' + values[key]);
- } else if (key === 'style') {
- var styleObject = styleStringToObject(values[key]);
- styleStringToObject(currentAttributeValue, styleObject);
- element.setAttribute('style', styleObjectToString(styleObject));
- }
- } else {
- element.setAttribute(key, values[key]);
- }
- }
- if (behaviorInstructions.length) {
- for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {
- current = behaviorInstructions[i];
- instance = current.type.create(container, current, element, bindings);
- if (instance.contentView) {
- children.push(instance.contentView);
- }
- controllers.push(instance);
- }
- }
- for (i = 0, ii = expressions.length; i < ii; ++i) {
- bindings.push(expressions[i].createBinding(element));
- }
- }
- var BoundViewFactory = exports.BoundViewFactory = function () {
- function BoundViewFactory(parentContainer, viewFactory, partReplacements) {
-
- this.parentContainer = parentContainer;
- this.viewFactory = viewFactory;
- this.factoryCreateInstruction = { partReplacements: partReplacements };
- }
- BoundViewFactory.prototype.create = function create() {
- var view = this.viewFactory.create(this.parentContainer.createChild(), this.factoryCreateInstruction);
- view._isUserControlled = true;
- return view;
- };
- BoundViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) {
- this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet);
- };
- BoundViewFactory.prototype.getCachedView = function getCachedView() {
- return this.viewFactory.getCachedView();
- };
- BoundViewFactory.prototype.returnViewToCache = function returnViewToCache(view) {
- this.viewFactory.returnViewToCache(view);
- };
- _createClass(BoundViewFactory, [{
- key: 'isCaching',
- get: function get() {
- return this.viewFactory.isCaching;
- }
- }]);
- return BoundViewFactory;
- }();
- var ViewFactory = exports.ViewFactory = function () {
- function ViewFactory(template, instructions, resources) {
-
- this.isCaching = false;
- this.template = template;
- this.instructions = instructions;
- this.resources = resources;
- this.cacheSize = -1;
- this.cache = null;
- }
- ViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) {
- if (size) {
- if (size === '*') {
- size = Number.MAX_VALUE;
- } else if (typeof size === 'string') {
- size = parseInt(size, 10);
- }
- }
- if (this.cacheSize === -1 || !doNotOverrideIfAlreadySet) {
- this.cacheSize = size;
- }
- if (this.cacheSize > 0) {
- this.cache = [];
- } else {
- this.cache = null;
- }
- this.isCaching = this.cacheSize > 0;
- };
- ViewFactory.prototype.getCachedView = function getCachedView() {
- return this.cache !== null ? this.cache.pop() || null : null;
- };
- ViewFactory.prototype.returnViewToCache = function returnViewToCache(view) {
- if (view.isAttached) {
- view.detached();
- }
- if (view.isBound) {
- view.unbind();
- }
- if (this.cache !== null && this.cache.length < this.cacheSize) {
- view.fromCache = true;
- this.cache.push(view);
- }
- };
- ViewFactory.prototype.create = function create(container, createInstruction, element) {
- createInstruction = createInstruction || BehaviorInstruction.normal;
- var cachedView = this.getCachedView();
- if (cachedView !== null) {
- return cachedView;
- }
- var fragment = createInstruction.enhance ? this.template : this.template.cloneNode(true);
- var instructables = fragment.querySelectorAll('.au-target');
- var instructions = this.instructions;
- var resources = this.resources;
- var controllers = [];
- var bindings = [];
- var children = [];
- var shadowSlots = Object.create(null);
- var containers = { root: container };
- var partReplacements = createInstruction.partReplacements;
- var i = void 0;
- var ii = void 0;
- var view = void 0;
- var instructable = void 0;
- var instruction = void 0;
- this.resources._invokeHook('beforeCreate', this, container, fragment, createInstruction);
- if (element && this.surrogateInstruction !== null) {
- applySurrogateInstruction(container, element, this.surrogateInstruction, controllers, bindings, children);
- }
- if (createInstruction.enhance && fragment.hasAttribute('au-target-id')) {
- instructable = fragment;
- instruction = instructions[instructable.getAttribute('au-target-id')];
- applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources);
- }
- for (i = 0, ii = instructables.length; i < ii; ++i) {
- instructable = instructables[i];
- instruction = instructions[instructable.getAttribute('au-target-id')];
- applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources);
- }
- view = new View(container, this, fragment, controllers, bindings, children, shadowSlots);
- if (!createInstruction.initiatedByBehavior) {
- view.created();
- }
- this.resources._invokeHook('afterCreate', view);
- return view;
- };
- return ViewFactory;
- }();
- var nextInjectorId = 0;
- function getNextInjectorId() {
- return ++nextInjectorId;
- }
- function configureProperties(instruction, resources) {
- var type = instruction.type;
- var attrName = instruction.attrName;
- var attributes = instruction.attributes;
- var property = void 0;
- var key = void 0;
- var value = void 0;
- var knownAttribute = resources.mapAttribute(attrName);
- if (knownAttribute && attrName in attributes && knownAttribute !== attrName) {
- attributes[knownAttribute] = attributes[attrName];
- delete attributes[attrName];
- }
- for (key in attributes) {
- value = attributes[key];
- if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
- property = type.attributes[key];
- if (property !== undefined) {
- value.targetProperty = property.name;
- } else {
- value.targetProperty = key;
- }
- }
- }
- }
- var lastAUTargetID = 0;
- function getNextAUTargetID() {
- return (++lastAUTargetID).toString();
- }
- function makeIntoInstructionTarget(element) {
- var value = element.getAttribute('class');
- var auTargetID = getNextAUTargetID();
- element.setAttribute('class', value ? value += ' au-target' : 'au-target');
- element.setAttribute('au-target-id', auTargetID);
- return auTargetID;
- }
- function makeShadowSlot(compiler, resources, node, instructions, parentInjectorId) {
- var auShadowSlot = _aureliaPal.DOM.createElement('au-shadow-slot');
- _aureliaPal.DOM.replaceNode(auShadowSlot, node);
- var auTargetID = makeIntoInstructionTarget(auShadowSlot);
- var instruction = TargetInstruction.shadowSlot(parentInjectorId);
- instruction.slotName = node.getAttribute('name') || ShadowDOM.defaultSlotKey;
- instruction.slotDestination = node.getAttribute('slot');
- if (node.innerHTML.trim()) {
- var fragment = _aureliaPal.DOM.createDocumentFragment();
- var _child3 = void 0;
- while (_child3 = node.firstChild) {
- fragment.appendChild(_child3);
- }
- instruction.slotFallbackFactory = compiler.compile(fragment, resources);
- }
- instructions[auTargetID] = instruction;
- return auShadowSlot;
- }
- var ViewCompiler = exports.ViewCompiler = (_dec7 = (0, _aureliaDependencyInjection.inject)(BindingLanguage, ViewResources), _dec7(_class17 = function () {
- function ViewCompiler(bindingLanguage, resources) {
-
- this.bindingLanguage = bindingLanguage;
- this.resources = resources;
- }
- ViewCompiler.prototype.compile = function compile(source, resources, compileInstruction) {
- resources = resources || this.resources;
- compileInstruction = compileInstruction || ViewCompileInstruction.normal;
- source = typeof source === 'string' ? _aureliaPal.DOM.createTemplateFromMarkup(source) : source;
- var content = void 0;
- var part = void 0;
- var cacheSize = void 0;
- if (source.content) {
- part = source.getAttribute('part');
- cacheSize = source.getAttribute('view-cache');
- content = _aureliaPal.DOM.adoptNode(source.content);
- } else {
- content = source;
- }
- compileInstruction.targetShadowDOM = compileInstruction.targetShadowDOM && _aureliaPal.FEATURE.shadowDOM;
- resources._invokeHook('beforeCompile', content, resources, compileInstruction);
- var instructions = {};
- this._compileNode(content, resources, instructions, source, 'root', !compileInstruction.targetShadowDOM);
- var firstChild = content.firstChild;
- if (firstChild && firstChild.nodeType === 1) {
- var targetId = firstChild.getAttribute('au-target-id');
- if (targetId) {
- var ins = instructions[targetId];
- if (ins.shadowSlot || ins.lifting) {
- content.insertBefore(_aureliaPal.DOM.createComment('view'), firstChild);
- }
- }
- }
- var factory = new ViewFactory(content, instructions, resources);
- factory.surrogateInstruction = compileInstruction.compileSurrogate ? this._compileSurrogate(source, resources) : null;
- factory.part = part;
- if (cacheSize) {
- factory.setCacheSize(cacheSize);
- }
- resources._invokeHook('afterCompile', factory);
- return factory;
- };
- ViewCompiler.prototype._compileNode = function _compileNode(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) {
- switch (node.nodeType) {
- case 1:
- return this._compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM);
- case 3:
- var expression = resources.getBindingLanguage(this.bindingLanguage).inspectTextContent(resources, node.wholeText);
- if (expression) {
- var marker = _aureliaPal.DOM.createElement('au-marker');
- var auTargetID = makeIntoInstructionTarget(marker);
- (node.parentNode || parentNode).insertBefore(marker, node);
- node.textContent = ' ';
- instructions[auTargetID] = TargetInstruction.contentExpression(expression);
- while (node.nextSibling && node.nextSibling.nodeType === 3) {
- (node.parentNode || parentNode).removeChild(node.nextSibling);
- }
- } else {
- while (node.nextSibling && node.nextSibling.nodeType === 3) {
- node = node.nextSibling;
- }
- }
- return node.nextSibling;
- case 11:
- var currentChild = node.firstChild;
- while (currentChild) {
- currentChild = this._compileNode(currentChild, resources, instructions, node, parentInjectorId, targetLightDOM);
- }
- break;
- default:
- break;
- }
- return node.nextSibling;
- };
- ViewCompiler.prototype._compileSurrogate = function _compileSurrogate(node, resources) {
- var tagName = node.tagName.toLowerCase();
- var attributes = node.attributes;
- var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage);
- var knownAttribute = void 0;
- var property = void 0;
- var instruction = void 0;
- var i = void 0;
- var ii = void 0;
- var attr = void 0;
- var attrName = void 0;
- var attrValue = void 0;
- var info = void 0;
- var type = void 0;
- var expressions = [];
- var expression = void 0;
- var behaviorInstructions = [];
- var values = {};
- var hasValues = false;
- var providers = [];
- for (i = 0, ii = attributes.length; i < ii; ++i) {
- attr = attributes[i];
- attrName = attr.name;
- attrValue = attr.value;
- info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue);
- type = resources.getAttribute(info.attrName);
- if (type) {
- knownAttribute = resources.mapAttribute(info.attrName);
- if (knownAttribute) {
- property = type.attributes[knownAttribute];
- if (property) {
- info.defaultBindingMode = property.defaultBindingMode;
- if (!info.command && !info.expression) {
- info.command = property.hasOptions ? 'options' : null;
- }
- }
- }
- }
- instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type);
- if (instruction) {
- if (instruction.alteredAttr) {
- type = resources.getAttribute(instruction.attrName);
- }
- if (instruction.discrete) {
- expressions.push(instruction);
- } else {
- if (type) {
- instruction.type = type;
- configureProperties(instruction, resources);
- if (type.liftsContent) {
- throw new Error('You cannot place a template controller on a surrogate element.');
- } else {
- behaviorInstructions.push(instruction);
- }
- } else {
- expressions.push(instruction.attributes[instruction.attrName]);
- }
- }
- } else {
- if (type) {
- instruction = BehaviorInstruction.attribute(attrName, type);
- instruction.attributes[resources.mapAttribute(attrName)] = attrValue;
- if (type.liftsContent) {
- throw new Error('You cannot place a template controller on a surrogate element.');
- } else {
- behaviorInstructions.push(instruction);
- }
- } else if (attrName !== 'id' && attrName !== 'part' && attrName !== 'replace-part') {
- hasValues = true;
- values[attrName] = attrValue;
- }
- }
- }
- if (expressions.length || behaviorInstructions.length || hasValues) {
- for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {
- instruction = behaviorInstructions[i];
- instruction.type.compile(this, resources, node, instruction);
- providers.push(instruction.type.target);
- }
- for (i = 0, ii = expressions.length; i < ii; ++i) {
- expression = expressions[i];
- if (expression.attrToRemove !== undefined) {
- node.removeAttribute(expression.attrToRemove);
- }
- }
- return TargetInstruction.surrogate(providers, behaviorInstructions, expressions, values);
- }
- return null;
- };
- ViewCompiler.prototype._compileElement = function _compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) {
- var tagName = node.tagName.toLowerCase();
- var attributes = node.attributes;
- var expressions = [];
- var expression = void 0;
- var behaviorInstructions = [];
- var providers = [];
- var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage);
- var liftingInstruction = void 0;
- var viewFactory = void 0;
- var type = void 0;
- var elementInstruction = void 0;
- var elementProperty = void 0;
- var i = void 0;
- var ii = void 0;
- var attr = void 0;
- var attrName = void 0;
- var attrValue = void 0;
- var instruction = void 0;
- var info = void 0;
- var property = void 0;
- var knownAttribute = void 0;
- var auTargetID = void 0;
- var injectorId = void 0;
- if (tagName === 'slot') {
- if (targetLightDOM) {
- node = makeShadowSlot(this, resources, node, instructions, parentInjectorId);
- }
- return node.nextSibling;
- } else if (tagName === 'template') {
- viewFactory = this.compile(node, resources);
- viewFactory.part = node.getAttribute('part');
- } else {
- type = resources.getElement(node.getAttribute('as-element') || tagName);
- if (type) {
- elementInstruction = BehaviorInstruction.element(node, type);
- type.processAttributes(this, resources, node, attributes, elementInstruction);
- behaviorInstructions.push(elementInstruction);
- }
- }
- for (i = 0, ii = attributes.length; i < ii; ++i) {
- attr = attributes[i];
- attrName = attr.name;
- attrValue = attr.value;
- info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue);
- if (targetLightDOM && info.attrName === 'slot') {
- info.attrName = attrName = 'au-slot';
- }
- type = resources.getAttribute(info.attrName);
- elementProperty = null;
- if (type) {
- knownAttribute = resources.mapAttribute(info.attrName);
- if (knownAttribute) {
- property = type.attributes[knownAttribute];
- if (property) {
- info.defaultBindingMode = property.defaultBindingMode;
- if (!info.command && !info.expression) {
- info.command = property.hasOptions ? 'options' : null;
- }
- }
- }
- } else if (elementInstruction) {
- elementProperty = elementInstruction.type.attributes[info.attrName];
- if (elementProperty) {
- info.defaultBindingMode = elementProperty.defaultBindingMode;
- }
- }
- if (elementProperty) {
- instruction = bindingLanguage.createAttributeInstruction(resources, node, info, elementInstruction);
- } else {
- instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type);
- }
- if (instruction) {
- if (instruction.alteredAttr) {
- type = resources.getAttribute(instruction.attrName);
- }
- if (instruction.discrete) {
- expressions.push(instruction);
- } else {
- if (type) {
- instruction.type = type;
- configureProperties(instruction, resources);
- if (type.liftsContent) {
- instruction.originalAttrName = attrName;
- liftingInstruction = instruction;
- break;
- } else {
- behaviorInstructions.push(instruction);
- }
- } else if (elementProperty) {
- elementInstruction.attributes[info.attrName].targetProperty = elementProperty.name;
- } else {
- expressions.push(instruction.attributes[instruction.attrName]);
- }
- }
- } else {
- if (type) {
- instruction = BehaviorInstruction.attribute(attrName, type);
- instruction.attributes[resources.mapAttribute(attrName)] = attrValue;
- if (type.liftsContent) {
- instruction.originalAttrName = attrName;
- liftingInstruction = instruction;
- break;
- } else {
- behaviorInstructions.push(instruction);
- }
- } else if (elementProperty) {
- elementInstruction.attributes[attrName] = attrValue;
- }
- }
- }
- if (liftingInstruction) {
- liftingInstruction.viewFactory = viewFactory;
- node = liftingInstruction.type.compile(this, resources, node, liftingInstruction, parentNode);
- auTargetID = makeIntoInstructionTarget(node);
- instructions[auTargetID] = TargetInstruction.lifting(parentInjectorId, liftingInstruction);
- } else {
- if (expressions.length || behaviorInstructions.length) {
- injectorId = behaviorInstructions.length ? getNextInjectorId() : false;
- for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {
- instruction = behaviorInstructions[i];
- instruction.type.compile(this, resources, node, instruction, parentNode);
- providers.push(instruction.type.target);
- }
- for (i = 0, ii = expressions.length; i < ii; ++i) {
- expression = expressions[i];
- if (expression.attrToRemove !== undefined) {
- node.removeAttribute(expression.attrToRemove);
- }
- }
- auTargetID = makeIntoInstructionTarget(node);
- instructions[auTargetID] = TargetInstruction.normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction);
- }
- if (elementInstruction && elementInstruction.skipContentProcessing) {
- return node.nextSibling;
- }
- var currentChild = node.firstChild;
- while (currentChild) {
- currentChild = this._compileNode(currentChild, resources, instructions, node, injectorId || parentInjectorId, targetLightDOM);
- }
- }
- return node.nextSibling;
- };
- return ViewCompiler;
- }()) || _class17);
- var ResourceModule = exports.ResourceModule = function () {
- function ResourceModule(moduleId) {
-
- this.id = moduleId;
- this.moduleInstance = null;
- this.mainResource = null;
- this.resources = null;
- this.viewStrategy = null;
- this.isInitialized = false;
- this.onLoaded = null;
- this.loadContext = null;
- }
- ResourceModule.prototype.initialize = function initialize(container) {
- var current = this.mainResource;
- var resources = this.resources;
- var vs = this.viewStrategy;
- if (this.isInitialized) {
- return;
- }
- this.isInitialized = true;
- if (current !== undefined) {
- current.metadata.viewStrategy = vs;
- current.initialize(container);
- }
- for (var i = 0, ii = resources.length; i < ii; ++i) {
- current = resources[i];
- current.metadata.viewStrategy = vs;
- current.initialize(container);
- }
- };
- ResourceModule.prototype.register = function register(registry, name) {
- var main = this.mainResource;
- var resources = this.resources;
- if (main !== undefined) {
- main.register(registry, name);
- name = null;
- }
- for (var i = 0, ii = resources.length; i < ii; ++i) {
- resources[i].register(registry, name);
- name = null;
- }
- };
- ResourceModule.prototype.load = function load(container, loadContext) {
- if (this.onLoaded !== null) {
- return this.loadContext === loadContext ? Promise.resolve() : this.onLoaded;
- }
- var main = this.mainResource;
- var resources = this.resources;
- var loads = void 0;
- if (main !== undefined) {
- loads = new Array(resources.length + 1);
- loads[0] = main.load(container, loadContext);
- for (var i = 0, ii = resources.length; i < ii; ++i) {
- loads[i + 1] = resources[i].load(container, loadContext);
- }
- } else {
- loads = new Array(resources.length);
- for (var _i = 0, _ii = resources.length; _i < _ii; ++_i) {
- loads[_i] = resources[_i].load(container, loadContext);
- }
- }
- this.loadContext = loadContext;
- this.onLoaded = Promise.all(loads);
- return this.onLoaded;
- };
- return ResourceModule;
- }();
- var ResourceDescription = exports.ResourceDescription = function () {
- function ResourceDescription(key, exportedValue, resourceTypeMeta) {
-
- if (!resourceTypeMeta) {
- resourceTypeMeta = _aureliaMetadata.metadata.get(_aureliaMetadata.metadata.resource, exportedValue);
- if (!resourceTypeMeta) {
- resourceTypeMeta = new HtmlBehaviorResource();
- resourceTypeMeta.elementName = _hyphenate(key);
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, resourceTypeMeta, exportedValue);
- }
- }
- if (resourceTypeMeta instanceof HtmlBehaviorResource) {
- if (resourceTypeMeta.elementName === undefined) {
- resourceTypeMeta.elementName = _hyphenate(key);
- } else if (resourceTypeMeta.attributeName === undefined) {
- resourceTypeMeta.attributeName = _hyphenate(key);
- } else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
- HtmlBehaviorResource.convention(key, resourceTypeMeta);
- }
- } else if (!resourceTypeMeta.name) {
- resourceTypeMeta.name = _hyphenate(key);
- }
- this.metadata = resourceTypeMeta;
- this.value = exportedValue;
- }
- ResourceDescription.prototype.initialize = function initialize(container) {
- this.metadata.initialize(container, this.value);
- };
- ResourceDescription.prototype.register = function register(registry, name) {
- this.metadata.register(registry, name);
- };
- ResourceDescription.prototype.load = function load(container, loadContext) {
- return this.metadata.load(container, this.value, loadContext);
- };
- return ResourceDescription;
- }();
- var ModuleAnalyzer = exports.ModuleAnalyzer = function () {
- function ModuleAnalyzer() {
-
- this.cache = Object.create(null);
- }
- ModuleAnalyzer.prototype.getAnalysis = function getAnalysis(moduleId) {
- return this.cache[moduleId];
- };
- ModuleAnalyzer.prototype.analyze = function analyze(moduleId, moduleInstance, mainResourceKey) {
- var mainResource = void 0;
- var fallbackValue = void 0;
- var fallbackKey = void 0;
- var resourceTypeMeta = void 0;
- var key = void 0;
- var exportedValue = void 0;
- var resources = [];
- var conventional = void 0;
- var vs = void 0;
- var resourceModule = void 0;
- resourceModule = this.cache[moduleId];
- if (resourceModule) {
- return resourceModule;
- }
- resourceModule = new ResourceModule(moduleId);
- this.cache[moduleId] = resourceModule;
- if (typeof moduleInstance === 'function') {
- moduleInstance = { 'default': moduleInstance };
- }
- if (mainResourceKey) {
- mainResource = new ResourceDescription(mainResourceKey, moduleInstance[mainResourceKey]);
- }
- for (key in moduleInstance) {
- exportedValue = moduleInstance[key];
- if (key === mainResourceKey || typeof exportedValue !== 'function') {
- continue;
- }
- resourceTypeMeta = _aureliaMetadata.metadata.get(_aureliaMetadata.metadata.resource, exportedValue);
- if (resourceTypeMeta) {
- if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
- HtmlBehaviorResource.convention(key, resourceTypeMeta);
- }
- if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
- resourceTypeMeta.elementName = _hyphenate(key);
- }
- if (!mainResource && resourceTypeMeta instanceof HtmlBehaviorResource && resourceTypeMeta.elementName !== null) {
- mainResource = new ResourceDescription(key, exportedValue, resourceTypeMeta);
- } else {
- resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta));
- }
- } else if (viewStrategy.decorates(exportedValue)) {
- vs = exportedValue;
- } else if (exportedValue instanceof _aureliaLoader.TemplateRegistryEntry) {
- vs = new TemplateRegistryViewStrategy(moduleId, exportedValue);
- } else {
- if (conventional = HtmlBehaviorResource.convention(key)) {
- if (conventional.elementName !== null && !mainResource) {
- mainResource = new ResourceDescription(key, exportedValue, conventional);
- } else {
- resources.push(new ResourceDescription(key, exportedValue, conventional));
- }
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, conventional, exportedValue);
- } else if (conventional = _aureliaBinding.ValueConverterResource.convention(key) || _aureliaBinding.BindingBehaviorResource.convention(key) || ViewEngineHooksResource.convention(key)) {
- resources.push(new ResourceDescription(key, exportedValue, conventional));
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, conventional, exportedValue);
- } else if (!fallbackValue) {
- fallbackValue = exportedValue;
- fallbackKey = key;
- }
- }
- }
- if (!mainResource && fallbackValue) {
- mainResource = new ResourceDescription(fallbackKey, fallbackValue);
- }
- resourceModule.moduleInstance = moduleInstance;
- resourceModule.mainResource = mainResource;
- resourceModule.resources = resources;
- resourceModule.viewStrategy = vs;
- return resourceModule;
- };
- return ModuleAnalyzer;
- }();
- var logger = LogManager.getLogger('templating');
- function ensureRegistryEntry(loader, urlOrRegistryEntry) {
- if (urlOrRegistryEntry instanceof _aureliaLoader.TemplateRegistryEntry) {
- return Promise.resolve(urlOrRegistryEntry);
- }
- return loader.loadTemplate(urlOrRegistryEntry);
- }
- var ProxyViewFactory = function () {
- function ProxyViewFactory(promise) {
- var _this9 = this;
-
- promise.then(function (x) {
- return _this9.viewFactory = x;
- });
- }
- ProxyViewFactory.prototype.create = function create(container, bindingContext, createInstruction, element) {
- return this.viewFactory.create(container, bindingContext, createInstruction, element);
- };
- ProxyViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) {
- this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet);
- };
- ProxyViewFactory.prototype.getCachedView = function getCachedView() {
- return this.viewFactory.getCachedView();
- };
- ProxyViewFactory.prototype.returnViewToCache = function returnViewToCache(view) {
- this.viewFactory.returnViewToCache(view);
- };
- _createClass(ProxyViewFactory, [{
- key: 'isCaching',
- get: function get() {
- return this.viewFactory.isCaching;
- }
- }]);
- return ProxyViewFactory;
- }();
- var ViewEngine = exports.ViewEngine = (_dec8 = (0, _aureliaDependencyInjection.inject)(_aureliaLoader.Loader, _aureliaDependencyInjection.Container, ViewCompiler, ModuleAnalyzer, ViewResources), _dec8(_class18 = (_temp4 = _class19 = function () {
- function ViewEngine(loader, container, viewCompiler, moduleAnalyzer, appResources) {
-
- this.loader = loader;
- this.container = container;
- this.viewCompiler = viewCompiler;
- this.moduleAnalyzer = moduleAnalyzer;
- this.appResources = appResources;
- this._pluginMap = {};
- var auSlotBehavior = new HtmlBehaviorResource();
- auSlotBehavior.attributeName = 'au-slot';
- auSlotBehavior.initialize(container, SlotCustomAttribute);
- auSlotBehavior.register(appResources);
- }
- ViewEngine.prototype.addResourcePlugin = function addResourcePlugin(extension, implementation) {
- var name = extension.replace('.', '') + '-resource-plugin';
- this._pluginMap[extension] = name;
- this.loader.addPlugin(name, implementation);
- };
- ViewEngine.prototype.loadViewFactory = function loadViewFactory(urlOrRegistryEntry, compileInstruction, loadContext, target) {
- var _this10 = this;
- loadContext = loadContext || new ResourceLoadContext();
- return ensureRegistryEntry(this.loader, urlOrRegistryEntry).then(function (registryEntry) {
- if (registryEntry.onReady) {
- if (!loadContext.hasDependency(urlOrRegistryEntry)) {
- loadContext.addDependency(urlOrRegistryEntry);
- return registryEntry.onReady;
- }
- if (registryEntry.template === null) {
- return registryEntry.onReady;
- }
- return Promise.resolve(new ProxyViewFactory(registryEntry.onReady));
- }
- loadContext.addDependency(urlOrRegistryEntry);
- registryEntry.onReady = _this10.loadTemplateResources(registryEntry, compileInstruction, loadContext, target).then(function (resources) {
- registryEntry.resources = resources;
- if (registryEntry.template === null) {
- return registryEntry.factory = null;
- }
- var viewFactory = _this10.viewCompiler.compile(registryEntry.template, resources, compileInstruction);
- return registryEntry.factory = viewFactory;
- });
- return registryEntry.onReady;
- });
- };
- ViewEngine.prototype.loadTemplateResources = function loadTemplateResources(registryEntry, compileInstruction, loadContext, target) {
- var resources = new ViewResources(this.appResources, registryEntry.address);
- var dependencies = registryEntry.dependencies;
- var importIds = void 0;
- var names = void 0;
- compileInstruction = compileInstruction || ViewCompileInstruction.normal;
- if (dependencies.length === 0 && !compileInstruction.associatedModuleId) {
- return Promise.resolve(resources);
- }
- importIds = dependencies.map(function (x) {
- return x.src;
- });
- names = dependencies.map(function (x) {
- return x.name;
- });
- logger.debug('importing resources for ' + registryEntry.address, importIds);
- if (target) {
- var viewModelRequires = _aureliaMetadata.metadata.get(ViewEngine.viewModelRequireMetadataKey, target);
- if (viewModelRequires) {
- var templateImportCount = importIds.length;
- for (var i = 0, ii = viewModelRequires.length; i < ii; ++i) {
- var req = viewModelRequires[i];
- var importId = typeof req === 'function' ? _aureliaMetadata.Origin.get(req).moduleId : (0, _aureliaPath.relativeToFile)(req.src || req, registryEntry.address);
- if (importIds.indexOf(importId) === -1) {
- importIds.push(importId);
- names.push(req.as);
- }
- }
- logger.debug('importing ViewModel resources for ' + compileInstruction.associatedModuleId, importIds.slice(templateImportCount));
- }
- }
- return this.importViewResources(importIds, names, resources, compileInstruction, loadContext);
- };
- ViewEngine.prototype.importViewModelResource = function importViewModelResource(moduleImport, moduleMember) {
- var _this11 = this;
- return this.loader.loadModule(moduleImport).then(function (viewModelModule) {
- var normalizedId = _aureliaMetadata.Origin.get(viewModelModule).moduleId;
- var resourceModule = _this11.moduleAnalyzer.analyze(normalizedId, viewModelModule, moduleMember);
- if (!resourceModule.mainResource) {
- throw new Error('No view model found in module "' + moduleImport + '".');
- }
- resourceModule.initialize(_this11.container);
- return resourceModule.mainResource;
- });
- };
- ViewEngine.prototype.importViewResources = function importViewResources(moduleIds, names, resources, compileInstruction, loadContext) {
- var _this12 = this;
- loadContext = loadContext || new ResourceLoadContext();
- compileInstruction = compileInstruction || ViewCompileInstruction.normal;
- moduleIds = moduleIds.map(function (x) {
- return _this12._applyLoaderPlugin(x);
- });
- return this.loader.loadAllModules(moduleIds).then(function (imports) {
- var i = void 0;
- var ii = void 0;
- var analysis = void 0;
- var normalizedId = void 0;
- var current = void 0;
- var associatedModule = void 0;
- var container = _this12.container;
- var moduleAnalyzer = _this12.moduleAnalyzer;
- var allAnalysis = new Array(imports.length);
- for (i = 0, ii = imports.length; i < ii; ++i) {
- current = imports[i];
- normalizedId = _aureliaMetadata.Origin.get(current).moduleId;
- analysis = moduleAnalyzer.analyze(normalizedId, current);
- analysis.initialize(container);
- analysis.register(resources, names[i]);
- allAnalysis[i] = analysis;
- }
- if (compileInstruction.associatedModuleId) {
- associatedModule = moduleAnalyzer.getAnalysis(compileInstruction.associatedModuleId);
- if (associatedModule) {
- associatedModule.register(resources);
- }
- }
- for (i = 0, ii = allAnalysis.length; i < ii; ++i) {
- allAnalysis[i] = allAnalysis[i].load(container, loadContext);
- }
- return Promise.all(allAnalysis).then(function () {
- return resources;
- });
- });
- };
- ViewEngine.prototype._applyLoaderPlugin = function _applyLoaderPlugin(id) {
- var index = id.lastIndexOf('.');
- if (index !== -1) {
- var ext = id.substring(index);
- var pluginName = this._pluginMap[ext];
- if (pluginName === undefined) {
- return id;
- }
- return this.loader.applyPluginToUrl(id, pluginName);
- }
- return id;
- };
- return ViewEngine;
- }(), _class19.viewModelRequireMetadataKey = 'aurelia:view-model-require', _temp4)) || _class18);
- var Controller = exports.Controller = function () {
- function Controller(behavior, instruction, viewModel, container) {
-
- this.behavior = behavior;
- this.instruction = instruction;
- this.viewModel = viewModel;
- this.isAttached = false;
- this.view = null;
- this.isBound = false;
- this.scope = null;
- this.container = container;
- this.elementEvents = container.elementEvents || null;
- var observerLookup = behavior.observerLocator.getOrCreateObserversLookup(viewModel);
- var handlesBind = behavior.handlesBind;
- var attributes = instruction.attributes;
- var boundProperties = this.boundProperties = [];
- var properties = behavior.properties;
- var i = void 0;
- var ii = void 0;
- behavior._ensurePropertiesDefined(viewModel, observerLookup);
- for (i = 0, ii = properties.length; i < ii; ++i) {
- properties[i]._initialize(viewModel, observerLookup, attributes, handlesBind, boundProperties);
- }
- }
- Controller.prototype.created = function created(owningView) {
- if (this.behavior.handlesCreated) {
- this.viewModel.created(owningView, this.view);
- }
- };
- Controller.prototype.automate = function automate(overrideContext, owningView) {
- this.view.bindingContext = this.viewModel;
- this.view.overrideContext = overrideContext || (0, _aureliaBinding.createOverrideContext)(this.viewModel);
- this.view._isUserControlled = true;
- if (this.behavior.handlesCreated) {
- this.viewModel.created(owningView || null, this.view);
- }
- this.bind(this.view);
- };
- Controller.prototype.bind = function bind(scope) {
- var skipSelfSubscriber = this.behavior.handlesBind;
- var boundProperties = this.boundProperties;
- var i = void 0;
- var ii = void 0;
- var x = void 0;
- var observer = void 0;
- var selfSubscriber = void 0;
- if (this.isBound) {
- if (this.scope === scope) {
- return;
- }
- this.unbind();
- }
- this.isBound = true;
- this.scope = scope;
- for (i = 0, ii = boundProperties.length; i < ii; ++i) {
- x = boundProperties[i];
- observer = x.observer;
- selfSubscriber = observer.selfSubscriber;
- observer.publishing = false;
- if (skipSelfSubscriber) {
- observer.selfSubscriber = null;
- }
- x.binding.bind(scope);
- observer.call();
- observer.publishing = true;
- observer.selfSubscriber = selfSubscriber;
- }
- var overrideContext = void 0;
- if (this.view !== null) {
- if (skipSelfSubscriber) {
- this.view.viewModelScope = scope;
- }
- if (this.viewModel === scope.overrideContext.bindingContext) {
- overrideContext = scope.overrideContext;
- } else if (this.instruction.inheritBindingContext) {
- overrideContext = (0, _aureliaBinding.createOverrideContext)(this.viewModel, scope.overrideContext);
- } else {
- overrideContext = (0, _aureliaBinding.createOverrideContext)(this.viewModel);
- overrideContext.__parentOverrideContext = scope.overrideContext;
- }
- this.view.bind(this.viewModel, overrideContext);
- } else if (skipSelfSubscriber) {
- overrideContext = scope.overrideContext;
- if (scope.overrideContext.__parentOverrideContext !== undefined && this.viewModel.viewFactory && this.viewModel.viewFactory.factoryCreateInstruction.partReplacements) {
- overrideContext = Object.assign({}, scope.overrideContext);
- overrideContext.parentOverrideContext = scope.overrideContext.__parentOverrideContext;
- }
- this.viewModel.bind(scope.bindingContext, overrideContext);
- }
- };
- Controller.prototype.unbind = function unbind() {
- if (this.isBound) {
- var boundProperties = this.boundProperties;
- var i = void 0;
- var ii = void 0;
- this.isBound = false;
- this.scope = null;
- if (this.view !== null) {
- this.view.unbind();
- }
- if (this.behavior.handlesUnbind) {
- this.viewModel.unbind();
- }
- if (this.elementEvents !== null) {
- this.elementEvents.disposeAll();
- }
- for (i = 0, ii = boundProperties.length; i < ii; ++i) {
- boundProperties[i].binding.unbind();
- }
- }
- };
- Controller.prototype.attached = function attached() {
- if (this.isAttached) {
- return;
- }
- this.isAttached = true;
- if (this.behavior.handlesAttached) {
- this.viewModel.attached();
- }
- if (this.view !== null) {
- this.view.attached();
- }
- };
- Controller.prototype.detached = function detached() {
- if (this.isAttached) {
- this.isAttached = false;
- if (this.view !== null) {
- this.view.detached();
- }
- if (this.behavior.handlesDetached) {
- this.viewModel.detached();
- }
- }
- };
- return Controller;
- }();
- var BehaviorPropertyObserver = exports.BehaviorPropertyObserver = (_dec9 = (0, _aureliaBinding.subscriberCollection)(), _dec9(_class21 = function () {
- function BehaviorPropertyObserver(taskQueue, obj, propertyName, selfSubscriber, initialValue) {
-
- this.taskQueue = taskQueue;
- this.obj = obj;
- this.propertyName = propertyName;
- this.notqueued = true;
- this.publishing = false;
- this.selfSubscriber = selfSubscriber;
- this.currentValue = this.oldValue = initialValue;
- }
- BehaviorPropertyObserver.prototype.getValue = function getValue() {
- return this.currentValue;
- };
- BehaviorPropertyObserver.prototype.setValue = function setValue(newValue) {
- var oldValue = this.currentValue;
- if (oldValue !== newValue) {
- if (this.publishing && this.notqueued) {
- this.notqueued = false;
- this.taskQueue.queueMicroTask(this);
- }
- this.oldValue = oldValue;
- this.currentValue = newValue;
- }
- };
- BehaviorPropertyObserver.prototype.call = function call() {
- var oldValue = this.oldValue;
- var newValue = this.currentValue;
- this.notqueued = true;
- if (newValue === oldValue) {
- return;
- }
- if (this.selfSubscriber) {
- this.selfSubscriber(newValue, oldValue);
- }
- this.callSubscribers(newValue, oldValue);
- this.oldValue = newValue;
- };
- BehaviorPropertyObserver.prototype.subscribe = function subscribe(context, callable) {
- this.addSubscriber(context, callable);
- };
- BehaviorPropertyObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
- this.removeSubscriber(context, callable);
- };
- return BehaviorPropertyObserver;
- }()) || _class21);
- function getObserver(behavior, instance, name) {
- var lookup = instance.__observers__;
- if (lookup === undefined) {
- if (!behavior.isInitialized) {
- behavior.initialize(_aureliaDependencyInjection.Container.instance || new _aureliaDependencyInjection.Container(), instance.constructor);
- }
- lookup = behavior.observerLocator.getOrCreateObserversLookup(instance);
- behavior._ensurePropertiesDefined(instance, lookup);
- }
- return lookup[name];
- }
- var BindableProperty = exports.BindableProperty = function () {
- function BindableProperty(nameOrConfig) {
-
- if (typeof nameOrConfig === 'string') {
- this.name = nameOrConfig;
- } else {
- Object.assign(this, nameOrConfig);
- }
- this.attribute = this.attribute || _hyphenate(this.name);
- if (this.defaultBindingMode === null || this.defaultBindingMode === undefined) {
- this.defaultBindingMode = _aureliaBinding.bindingMode.oneWay;
- }
- this.changeHandler = this.changeHandler || null;
- this.owner = null;
- this.descriptor = null;
- }
- BindableProperty.prototype.registerWith = function registerWith(target, behavior, descriptor) {
- behavior.properties.push(this);
- behavior.attributes[this.attribute] = this;
- this.owner = behavior;
- if (descriptor) {
- this.descriptor = descriptor;
- return this._configureDescriptor(behavior, descriptor);
- }
- return undefined;
- };
- BindableProperty.prototype._configureDescriptor = function _configureDescriptor(behavior, descriptor) {
- var name = this.name;
- descriptor.configurable = true;
- descriptor.enumerable = true;
- if ('initializer' in descriptor) {
- this.defaultValue = descriptor.initializer;
- delete descriptor.initializer;
- delete descriptor.writable;
- }
- if ('value' in descriptor) {
- this.defaultValue = descriptor.value;
- delete descriptor.value;
- delete descriptor.writable;
- }
- descriptor.get = function () {
- return getObserver(behavior, this, name).getValue();
- };
- descriptor.set = function (value) {
- getObserver(behavior, this, name).setValue(value);
- };
- descriptor.get.getObserver = function (obj) {
- return getObserver(behavior, obj, name);
- };
- return descriptor;
- };
- BindableProperty.prototype.defineOn = function defineOn(target, behavior) {
- var name = this.name;
- var handlerName = void 0;
- if (this.changeHandler === null) {
- handlerName = name + 'Changed';
- if (handlerName in target.prototype) {
- this.changeHandler = handlerName;
- }
- }
- if (this.descriptor === null) {
- Object.defineProperty(target.prototype, name, this._configureDescriptor(behavior, {}));
- }
- };
- BindableProperty.prototype.createObserver = function createObserver(viewModel) {
- var selfSubscriber = null;
- var defaultValue = this.defaultValue;
- var changeHandlerName = this.changeHandler;
- var name = this.name;
- var initialValue = void 0;
- if (this.hasOptions) {
- return undefined;
- }
- if (changeHandlerName in viewModel) {
- if ('propertyChanged' in viewModel) {
- selfSubscriber = function selfSubscriber(newValue, oldValue) {
- viewModel[changeHandlerName](newValue, oldValue);
- viewModel.propertyChanged(name, newValue, oldValue);
- };
- } else {
- selfSubscriber = function selfSubscriber(newValue, oldValue) {
- return viewModel[changeHandlerName](newValue, oldValue);
- };
- }
- } else if ('propertyChanged' in viewModel) {
- selfSubscriber = function selfSubscriber(newValue, oldValue) {
- return viewModel.propertyChanged(name, newValue, oldValue);
- };
- } else if (changeHandlerName !== null) {
- throw new Error('Change handler ' + changeHandlerName + ' was specified but not declared on the class.');
- }
- if (defaultValue !== undefined) {
- initialValue = typeof defaultValue === 'function' ? defaultValue.call(viewModel) : defaultValue;
- }
- return new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, this.name, selfSubscriber, initialValue);
- };
- BindableProperty.prototype._initialize = function _initialize(viewModel, observerLookup, attributes, behaviorHandlesBind, boundProperties) {
- var selfSubscriber = void 0;
- var observer = void 0;
- var attribute = void 0;
- var defaultValue = this.defaultValue;
- if (this.isDynamic) {
- for (var key in attributes) {
- this._createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, key, attributes[key], boundProperties);
- }
- } else if (!this.hasOptions) {
- observer = observerLookup[this.name];
- if (attributes !== null) {
- selfSubscriber = observer.selfSubscriber;
- attribute = attributes[this.attribute];
- if (behaviorHandlesBind) {
- observer.selfSubscriber = null;
- }
- if (typeof attribute === 'string') {
- viewModel[this.name] = attribute;
- observer.call();
- } else if (attribute) {
- boundProperties.push({ observer: observer, binding: attribute.createBinding(viewModel) });
- } else if (defaultValue !== undefined) {
- observer.call();
- }
- observer.selfSubscriber = selfSubscriber;
- }
- observer.publishing = true;
- }
- };
- BindableProperty.prototype._createDynamicProperty = function _createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, name, attribute, boundProperties) {
- var changeHandlerName = name + 'Changed';
- var selfSubscriber = null;
- var observer = void 0;
- var info = void 0;
- if (changeHandlerName in viewModel) {
- if ('propertyChanged' in viewModel) {
- selfSubscriber = function selfSubscriber(newValue, oldValue) {
- viewModel[changeHandlerName](newValue, oldValue);
- viewModel.propertyChanged(name, newValue, oldValue);
- };
- } else {
- selfSubscriber = function selfSubscriber(newValue, oldValue) {
- return viewModel[changeHandlerName](newValue, oldValue);
- };
- }
- } else if ('propertyChanged' in viewModel) {
- selfSubscriber = function selfSubscriber(newValue, oldValue) {
- return viewModel.propertyChanged(name, newValue, oldValue);
- };
- }
- observer = observerLookup[name] = new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, name, selfSubscriber);
- Object.defineProperty(viewModel, name, {
- configurable: true,
- enumerable: true,
- get: observer.getValue.bind(observer),
- set: observer.setValue.bind(observer)
- });
- if (behaviorHandlesBind) {
- observer.selfSubscriber = null;
- }
- if (typeof attribute === 'string') {
- viewModel[name] = attribute;
- observer.call();
- } else if (attribute) {
- info = { observer: observer, binding: attribute.createBinding(viewModel) };
- boundProperties.push(info);
- }
- observer.publishing = true;
- observer.selfSubscriber = selfSubscriber;
- };
- return BindableProperty;
- }();
- var lastProviderId = 0;
- function nextProviderId() {
- return ++lastProviderId;
- }
- function doProcessContent() {
- return true;
- }
- function doProcessAttributes() {}
- var HtmlBehaviorResource = exports.HtmlBehaviorResource = function () {
- function HtmlBehaviorResource() {
-
- this.elementName = null;
- this.attributeName = null;
- this.attributeDefaultBindingMode = undefined;
- this.liftsContent = false;
- this.targetShadowDOM = false;
- this.shadowDOMOptions = null;
- this.processAttributes = doProcessAttributes;
- this.processContent = doProcessContent;
- this.usesShadowDOM = false;
- this.childBindings = null;
- this.hasDynamicOptions = false;
- this.containerless = false;
- this.properties = [];
- this.attributes = {};
- this.isInitialized = false;
- }
- HtmlBehaviorResource.convention = function convention(name, existing) {
- var behavior = void 0;
- if (name.endsWith('CustomAttribute')) {
- behavior = existing || new HtmlBehaviorResource();
- behavior.attributeName = _hyphenate(name.substring(0, name.length - 15));
- }
- if (name.endsWith('CustomElement')) {
- behavior = existing || new HtmlBehaviorResource();
- behavior.elementName = _hyphenate(name.substring(0, name.length - 13));
- }
- return behavior;
- };
- HtmlBehaviorResource.prototype.addChildBinding = function addChildBinding(behavior) {
- if (this.childBindings === null) {
- this.childBindings = [];
- }
- this.childBindings.push(behavior);
- };
- HtmlBehaviorResource.prototype.initialize = function initialize(container, target) {
- var proto = target.prototype;
- var properties = this.properties;
- var attributeName = this.attributeName;
- var attributeDefaultBindingMode = this.attributeDefaultBindingMode;
- var i = void 0;
- var ii = void 0;
- var current = void 0;
- if (this.isInitialized) {
- return;
- }
- this.isInitialized = true;
- target.__providerId__ = nextProviderId();
- this.observerLocator = container.get(_aureliaBinding.ObserverLocator);
- this.taskQueue = container.get(_aureliaTaskQueue.TaskQueue);
- this.target = target;
- this.usesShadowDOM = this.targetShadowDOM && _aureliaPal.FEATURE.shadowDOM;
- this.handlesCreated = 'created' in proto;
- this.handlesBind = 'bind' in proto;
- this.handlesUnbind = 'unbind' in proto;
- this.handlesAttached = 'attached' in proto;
- this.handlesDetached = 'detached' in proto;
- this.htmlName = this.elementName || this.attributeName;
- if (attributeName !== null) {
- if (properties.length === 0) {
- new BindableProperty({
- name: 'value',
- changeHandler: 'valueChanged' in proto ? 'valueChanged' : null,
- attribute: attributeName,
- defaultBindingMode: attributeDefaultBindingMode
- }).registerWith(target, this);
- }
- current = properties[0];
- if (properties.length === 1 && current.name === 'value') {
- current.isDynamic = current.hasOptions = this.hasDynamicOptions;
- current.defineOn(target, this);
- } else {
- for (i = 0, ii = properties.length; i < ii; ++i) {
- properties[i].defineOn(target, this);
- }
- current = new BindableProperty({
- name: 'value',
- changeHandler: 'valueChanged' in proto ? 'valueChanged' : null,
- attribute: attributeName,
- defaultBindingMode: attributeDefaultBindingMode
- });
- current.hasOptions = true;
- current.registerWith(target, this);
- }
- } else {
- for (i = 0, ii = properties.length; i < ii; ++i) {
- properties[i].defineOn(target, this);
- }
- }
- };
- HtmlBehaviorResource.prototype.register = function register(registry, name) {
- if (this.attributeName !== null) {
- registry.registerAttribute(name || this.attributeName, this, this.attributeName);
- }
- if (this.elementName !== null) {
- registry.registerElement(name || this.elementName, this);
- }
- };
- HtmlBehaviorResource.prototype.load = function load(container, target, loadContext, viewStrategy, transientView) {
- var _this13 = this;
- var options = void 0;
- if (this.elementName !== null) {
- viewStrategy = container.get(ViewLocator).getViewStrategy(viewStrategy || this.viewStrategy || target);
- options = new ViewCompileInstruction(this.targetShadowDOM, true);
- if (!viewStrategy.moduleId) {
- viewStrategy.moduleId = _aureliaMetadata.Origin.get(target).moduleId;
- }
- return viewStrategy.loadViewFactory(container.get(ViewEngine), options, loadContext, target).then(function (viewFactory) {
- if (!transientView || !_this13.viewFactory) {
- _this13.viewFactory = viewFactory;
- }
- return viewFactory;
- });
- }
- return Promise.resolve(this);
- };
- HtmlBehaviorResource.prototype.compile = function compile(compiler, resources, node, instruction, parentNode) {
- if (this.liftsContent) {
- if (!instruction.viewFactory) {
- var template = _aureliaPal.DOM.createElement('template');
- var fragment = _aureliaPal.DOM.createDocumentFragment();
- var cacheSize = node.getAttribute('view-cache');
- var part = node.getAttribute('part');
- node.removeAttribute(instruction.originalAttrName);
- _aureliaPal.DOM.replaceNode(template, node, parentNode);
- fragment.appendChild(node);
- instruction.viewFactory = compiler.compile(fragment, resources);
- if (part) {
- instruction.viewFactory.part = part;
- node.removeAttribute('part');
- }
- if (cacheSize) {
- instruction.viewFactory.setCacheSize(cacheSize);
- node.removeAttribute('view-cache');
- }
- node = template;
- }
- } else if (this.elementName !== null) {
- var _partReplacements2 = {};
- if (this.processContent(compiler, resources, node, instruction) && node.hasChildNodes()) {
- var currentChild = node.firstChild;
- var contentElement = this.usesShadowDOM ? null : _aureliaPal.DOM.createElement('au-content');
- var nextSibling = void 0;
- var toReplace = void 0;
- while (currentChild) {
- nextSibling = currentChild.nextSibling;
- if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) {
- _partReplacements2[toReplace] = compiler.compile(currentChild, resources);
- _aureliaPal.DOM.removeNode(currentChild, parentNode);
- instruction.partReplacements = _partReplacements2;
- } else if (contentElement !== null) {
- if (currentChild.nodeType === 3 && _isAllWhitespace(currentChild)) {
- _aureliaPal.DOM.removeNode(currentChild, parentNode);
- } else {
- contentElement.appendChild(currentChild);
- }
- }
- currentChild = nextSibling;
- }
- if (contentElement !== null && contentElement.hasChildNodes()) {
- node.appendChild(contentElement);
- }
- instruction.skipContentProcessing = false;
- } else {
- instruction.skipContentProcessing = true;
- }
- }
- return node;
- };
- HtmlBehaviorResource.prototype.create = function create(container, instruction, element, bindings) {
- var viewHost = void 0;
- var au = null;
- instruction = instruction || BehaviorInstruction.normal;
- element = element || null;
- bindings = bindings || null;
- if (this.elementName !== null && element) {
- if (this.usesShadowDOM) {
- viewHost = element.attachShadow(this.shadowDOMOptions);
- container.registerInstance(_aureliaPal.DOM.boundary, viewHost);
- } else {
- viewHost = element;
- if (this.targetShadowDOM) {
- container.registerInstance(_aureliaPal.DOM.boundary, viewHost);
- }
- }
- }
- if (element !== null) {
- element.au = au = element.au || {};
- }
- var viewModel = instruction.viewModel || container.get(this.target);
- var controller = new Controller(this, instruction, viewModel, container);
- var childBindings = this.childBindings;
- var viewFactory = void 0;
- if (this.liftsContent) {
- au.controller = controller;
- } else if (this.elementName !== null) {
- viewFactory = instruction.viewFactory || this.viewFactory;
- container.viewModel = viewModel;
- if (viewFactory) {
- controller.view = viewFactory.create(container, instruction, element);
- }
- if (element !== null) {
- au.controller = controller;
- if (controller.view) {
- if (!this.usesShadowDOM && (element.childNodes.length === 1 || element.contentElement)) {
- var contentElement = element.childNodes[0] || element.contentElement;
- controller.view.contentView = { fragment: contentElement };
- contentElement.parentNode && _aureliaPal.DOM.removeNode(contentElement);
- }
- if (instruction.anchorIsContainer) {
- if (childBindings !== null) {
- for (var i = 0, ii = childBindings.length; i < ii; ++i) {
- controller.view.addBinding(childBindings[i].create(element, viewModel, controller));
- }
- }
- controller.view.appendNodesTo(viewHost);
- } else {
- controller.view.insertNodesBefore(viewHost);
- }
- } else if (childBindings !== null) {
- for (var _i2 = 0, _ii2 = childBindings.length; _i2 < _ii2; ++_i2) {
- bindings.push(childBindings[_i2].create(element, viewModel, controller));
- }
- }
- } else if (controller.view) {
- controller.view.controller = controller;
- if (childBindings !== null) {
- for (var _i3 = 0, _ii3 = childBindings.length; _i3 < _ii3; ++_i3) {
- controller.view.addBinding(childBindings[_i3].create(instruction.host, viewModel, controller));
- }
- }
- } else if (childBindings !== null) {
- for (var _i4 = 0, _ii4 = childBindings.length; _i4 < _ii4; ++_i4) {
- bindings.push(childBindings[_i4].create(instruction.host, viewModel, controller));
- }
- }
- } else if (childBindings !== null) {
- for (var _i5 = 0, _ii5 = childBindings.length; _i5 < _ii5; ++_i5) {
- bindings.push(childBindings[_i5].create(element, viewModel, controller));
- }
- }
- if (au !== null) {
- au[this.htmlName] = controller;
- }
- if (instruction.initiatedByBehavior && viewFactory) {
- controller.view.created();
- }
- return controller;
- };
- HtmlBehaviorResource.prototype._ensurePropertiesDefined = function _ensurePropertiesDefined(instance, lookup) {
- var properties = void 0;
- var i = void 0;
- var ii = void 0;
- var observer = void 0;
- if ('__propertiesDefined__' in lookup) {
- return;
- }
- lookup.__propertiesDefined__ = true;
- properties = this.properties;
- for (i = 0, ii = properties.length; i < ii; ++i) {
- observer = properties[i].createObserver(instance);
- if (observer !== undefined) {
- lookup[observer.propertyName] = observer;
- }
- }
- };
- return HtmlBehaviorResource;
- }();
- function createChildObserverDecorator(selectorOrConfig, all) {
- return function (target, key, descriptor) {
- var actualTarget = typeof key === 'string' ? target.constructor : target;
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, actualTarget);
- if (typeof selectorOrConfig === 'string') {
- selectorOrConfig = {
- selector: selectorOrConfig,
- name: key
- };
- }
- if (descriptor) {
- descriptor.writable = true;
- }
- selectorOrConfig.all = all;
- r.addChildBinding(new ChildObserver(selectorOrConfig));
- };
- }
- function children(selectorOrConfig) {
- return createChildObserverDecorator(selectorOrConfig, true);
- }
- function child(selectorOrConfig) {
- return createChildObserverDecorator(selectorOrConfig, false);
- }
- var ChildObserver = function () {
- function ChildObserver(config) {
-
- this.name = config.name;
- this.changeHandler = config.changeHandler || this.name + 'Changed';
- this.selector = config.selector;
- this.all = config.all;
- }
- ChildObserver.prototype.create = function create(viewHost, viewModel, controller) {
- return new ChildObserverBinder(this.selector, viewHost, this.name, viewModel, controller, this.changeHandler, this.all);
- };
- return ChildObserver;
- }();
- var noMutations = [];
- function trackMutation(groupedMutations, binder, record) {
- var mutations = groupedMutations.get(binder);
- if (!mutations) {
- mutations = [];
- groupedMutations.set(binder, mutations);
- }
- mutations.push(record);
- }
- function onChildChange(mutations, observer) {
- var binders = observer.binders;
- var bindersLength = binders.length;
- var groupedMutations = new Map();
- for (var i = 0, ii = mutations.length; i < ii; ++i) {
- var record = mutations[i];
- var added = record.addedNodes;
- var removed = record.removedNodes;
- for (var j = 0, jj = removed.length; j < jj; ++j) {
- var node = removed[j];
- if (node.nodeType === 1) {
- for (var k = 0; k < bindersLength; ++k) {
- var binder = binders[k];
- if (binder.onRemove(node)) {
- trackMutation(groupedMutations, binder, record);
- }
- }
- }
- }
- for (var _j = 0, _jj = added.length; _j < _jj; ++_j) {
- var _node = added[_j];
- if (_node.nodeType === 1) {
- for (var _k = 0; _k < bindersLength; ++_k) {
- var _binder = binders[_k];
- if (_binder.onAdd(_node)) {
- trackMutation(groupedMutations, _binder, record);
- }
- }
- }
- }
- }
- groupedMutations.forEach(function (value, key) {
- if (key.changeHandler !== null) {
- key.viewModel[key.changeHandler](value);
- }
- });
- }
- var ChildObserverBinder = function () {
- function ChildObserverBinder(selector, viewHost, property, viewModel, controller, changeHandler, all) {
-
- this.selector = selector;
- this.viewHost = viewHost;
- this.property = property;
- this.viewModel = viewModel;
- this.controller = controller;
- this.changeHandler = changeHandler in viewModel ? changeHandler : null;
- this.usesShadowDOM = controller.behavior.usesShadowDOM;
- this.all = all;
- if (!this.usesShadowDOM && controller.view && controller.view.contentView) {
- this.contentView = controller.view.contentView;
- } else {
- this.contentView = null;
- }
- }
- ChildObserverBinder.prototype.matches = function matches(element) {
- if (element.matches(this.selector)) {
- if (this.contentView === null) {
- return true;
- }
- var contentView = this.contentView;
- var assignedSlot = element.auAssignedSlot;
- if (assignedSlot && assignedSlot.projectFromAnchors) {
- var anchors = assignedSlot.projectFromAnchors;
- for (var i = 0, ii = anchors.length; i < ii; ++i) {
- if (anchors[i].auOwnerView === contentView) {
- return true;
- }
- }
- return false;
- }
- return element.auOwnerView === contentView;
- }
- return false;
- };
- ChildObserverBinder.prototype.bind = function bind(source) {
- var viewHost = this.viewHost;
- var viewModel = this.viewModel;
- var observer = viewHost.__childObserver__;
- if (!observer) {
- observer = viewHost.__childObserver__ = _aureliaPal.DOM.createMutationObserver(onChildChange);
- var options = {
- childList: true,
- subtree: !this.usesShadowDOM
- };
- observer.observe(viewHost, options);
- observer.binders = [];
- }
- observer.binders.push(this);
- if (this.usesShadowDOM) {
- var current = viewHost.firstElementChild;
- if (this.all) {
- var items = viewModel[this.property];
- if (!items) {
- items = viewModel[this.property] = [];
- } else {
- items.length = 0;
- }
- while (current) {
- if (this.matches(current)) {
- items.push(current.au && current.au.controller ? current.au.controller.viewModel : current);
- }
- current = current.nextElementSibling;
- }
- if (this.changeHandler !== null) {
- this.viewModel[this.changeHandler](noMutations);
- }
- } else {
- while (current) {
- if (this.matches(current)) {
- var value = current.au && current.au.controller ? current.au.controller.viewModel : current;
- this.viewModel[this.property] = value;
- if (this.changeHandler !== null) {
- this.viewModel[this.changeHandler](value);
- }
- break;
- }
- current = current.nextElementSibling;
- }
- }
- }
- };
- ChildObserverBinder.prototype.onRemove = function onRemove(element) {
- if (this.matches(element)) {
- var value = element.au && element.au.controller ? element.au.controller.viewModel : element;
- if (this.all) {
- var items = this.viewModel[this.property] || (this.viewModel[this.property] = []);
- var index = items.indexOf(value);
- if (index !== -1) {
- items.splice(index, 1);
- }
- return true;
- }
- return false;
- }
- return false;
- };
- ChildObserverBinder.prototype.onAdd = function onAdd(element) {
- if (this.matches(element)) {
- var value = element.au && element.au.controller ? element.au.controller.viewModel : element;
- if (this.all) {
- var items = this.viewModel[this.property] || (this.viewModel[this.property] = []);
- var index = 0;
- var prev = element.previousElementSibling;
- while (prev) {
- if (this.matches(prev)) {
- index++;
- }
- prev = prev.previousElementSibling;
- }
- items.splice(index, 0, value);
- return true;
- }
- this.viewModel[this.property] = value;
- if (this.changeHandler !== null) {
- this.viewModel[this.changeHandler](value);
- }
- }
- return false;
- };
- ChildObserverBinder.prototype.unbind = function unbind() {
- if (this.viewHost.__childObserver__) {
- this.viewHost.__childObserver__.disconnect();
- this.viewHost.__childObserver__ = null;
- }
- };
- return ChildObserverBinder;
- }();
- function tryActivateViewModel(context) {
- if (context.skipActivation || typeof context.viewModel.activate !== 'function') {
- return Promise.resolve();
- }
- return context.viewModel.activate(context.model) || Promise.resolve();
- }
- var CompositionEngine = exports.CompositionEngine = (_dec10 = (0, _aureliaDependencyInjection.inject)(ViewEngine, ViewLocator), _dec10(_class22 = function () {
- function CompositionEngine(viewEngine, viewLocator) {
-
- this.viewEngine = viewEngine;
- this.viewLocator = viewLocator;
- }
- CompositionEngine.prototype._createControllerAndSwap = function _createControllerAndSwap(context) {
- function swap(controller) {
- return Promise.resolve(context.viewSlot.removeAll(true)).then(function () {
- if (context.currentController) {
- context.currentController.unbind();
- }
- context.viewSlot.add(controller.view);
- if (context.compositionTransactionNotifier) {
- context.compositionTransactionNotifier.done();
- }
- return controller;
- });
- }
- return this.createController(context).then(function (controller) {
- controller.automate(context.overrideContext, context.owningView);
- if (context.compositionTransactionOwnershipToken) {
- return context.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () {
- return swap(controller);
- });
- }
- return swap(controller);
- });
- };
- CompositionEngine.prototype.createController = function createController(context) {
- var _this14 = this;
- var childContainer = void 0;
- var viewModel = void 0;
- var viewModelResource = void 0;
- var m = void 0;
- return this.ensureViewModel(context).then(tryActivateViewModel).then(function () {
- childContainer = context.childContainer;
- viewModel = context.viewModel;
- viewModelResource = context.viewModelResource;
- m = viewModelResource.metadata;
- var viewStrategy = _this14.viewLocator.getViewStrategy(context.view || viewModel);
- if (context.viewResources) {
- viewStrategy.makeRelativeTo(context.viewResources.viewUrl);
- }
- return m.load(childContainer, viewModelResource.value, null, viewStrategy, true);
- }).then(function (viewFactory) {
- return m.create(childContainer, BehaviorInstruction.dynamic(context.host, viewModel, viewFactory));
- });
- };
- CompositionEngine.prototype.ensureViewModel = function ensureViewModel(context) {
- var childContainer = context.childContainer = context.childContainer || context.container.createChild();
- if (typeof context.viewModel === 'string') {
- context.viewModel = context.viewResources ? context.viewResources.relativeToView(context.viewModel) : context.viewModel;
- return this.viewEngine.importViewModelResource(context.viewModel).then(function (viewModelResource) {
- childContainer.autoRegister(viewModelResource.value);
- if (context.host) {
- childContainer.registerInstance(_aureliaPal.DOM.Element, context.host);
- }
- context.viewModel = childContainer.viewModel = childContainer.get(viewModelResource.value);
- context.viewModelResource = viewModelResource;
- return context;
- });
- }
- var m = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, context.viewModel.constructor);
- m.elementName = m.elementName || 'dynamic-element';
- m.initialize(context.container || childContainer, context.viewModel.constructor);
- context.viewModelResource = { metadata: m, value: context.viewModel.constructor };
- childContainer.viewModel = context.viewModel;
- return Promise.resolve(context);
- };
- CompositionEngine.prototype.compose = function compose(context) {
- context.childContainer = context.childContainer || context.container.createChild();
- context.view = this.viewLocator.getViewStrategy(context.view);
- var transaction = context.childContainer.get(CompositionTransaction);
- var compositionTransactionOwnershipToken = transaction.tryCapture();
- if (compositionTransactionOwnershipToken) {
- context.compositionTransactionOwnershipToken = compositionTransactionOwnershipToken;
- } else {
- context.compositionTransactionNotifier = transaction.enlist();
- }
- if (context.viewModel) {
- return this._createControllerAndSwap(context);
- } else if (context.view) {
- if (context.viewResources) {
- context.view.makeRelativeTo(context.viewResources.viewUrl);
- }
- return context.view.loadViewFactory(this.viewEngine, new ViewCompileInstruction()).then(function (viewFactory) {
- var result = viewFactory.create(context.childContainer);
- result.bind(context.bindingContext, context.overrideContext);
- var work = function work() {
- return Promise.resolve(context.viewSlot.removeAll(true)).then(function () {
- context.viewSlot.add(result);
- if (context.compositionTransactionNotifier) {
- context.compositionTransactionNotifier.done();
- }
- return result;
- });
- };
- if (context.compositionTransactionOwnershipToken) {
- return context.compositionTransactionOwnershipToken.waitForCompositionComplete().then(work);
- }
- return work();
- });
- } else if (context.viewSlot) {
- context.viewSlot.removeAll();
- if (context.compositionTransactionNotifier) {
- context.compositionTransactionNotifier.done();
- }
- return Promise.resolve(null);
- }
- return Promise.resolve(null);
- };
- return CompositionEngine;
- }()) || _class22);
- var ElementConfigResource = exports.ElementConfigResource = function () {
- function ElementConfigResource() {
-
- }
- ElementConfigResource.prototype.initialize = function initialize(container, target) {};
- ElementConfigResource.prototype.register = function register(registry, name) {};
- ElementConfigResource.prototype.load = function load(container, target) {
- var config = new target();
- var eventManager = container.get(_aureliaBinding.EventManager);
- eventManager.registerElementConfig(config);
- };
- return ElementConfigResource;
- }();
- function validateBehaviorName(name, type) {
- if (/[A-Z]/.test(name)) {
- var newName = _hyphenate(name);
- LogManager.getLogger('templating').warn('\'' + name + '\' is not a valid ' + type + ' name and has been converted to \'' + newName + '\'. Upper-case letters are not allowed because the DOM is not case-sensitive.');
- return newName;
- }
- return name;
- }
- function resource(instance) {
- return function (target) {
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, instance, target);
- };
- }
- function behavior(override) {
- return function (target) {
- if (override instanceof HtmlBehaviorResource) {
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, override, target);
- } else {
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, target);
- Object.assign(r, override);
- }
- };
- }
- function customElement(name) {
- return function (target) {
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, target);
- r.elementName = validateBehaviorName(name, 'custom element');
- };
- }
- function customAttribute(name, defaultBindingMode) {
- return function (target) {
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, target);
- r.attributeName = validateBehaviorName(name, 'custom attribute');
- r.attributeDefaultBindingMode = defaultBindingMode;
- };
- }
- function templateController(target) {
- var deco = function deco(t) {
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
- r.liftsContent = true;
- };
- return target ? deco(target) : deco;
- }
- function bindable(nameOrConfigOrTarget, key, descriptor) {
- var deco = function deco(target, key2, descriptor2) {
- var actualTarget = key2 ? target.constructor : target;
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, actualTarget);
- var prop = void 0;
- if (key2) {
- nameOrConfigOrTarget = nameOrConfigOrTarget || {};
- nameOrConfigOrTarget.name = key2;
- }
- prop = new BindableProperty(nameOrConfigOrTarget);
- return prop.registerWith(actualTarget, r, descriptor2);
- };
- if (!nameOrConfigOrTarget) {
- return deco;
- }
- if (key) {
- var _target = nameOrConfigOrTarget;
- nameOrConfigOrTarget = null;
- return deco(_target, key, descriptor);
- }
- return deco;
- }
- function dynamicOptions(target) {
- var deco = function deco(t) {
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
- r.hasDynamicOptions = true;
- };
- return target ? deco(target) : deco;
- }
- var defaultShadowDOMOptions = { mode: 'open' };
- function useShadowDOM(targetOrOptions) {
- var options = typeof targetOrOptions === 'function' || !targetOrOptions ? defaultShadowDOMOptions : targetOrOptions;
- var deco = function deco(t) {
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
- r.targetShadowDOM = true;
- r.shadowDOMOptions = options;
- };
- return typeof targetOrOptions === 'function' ? deco(targetOrOptions) : deco;
- }
- function processAttributes(processor) {
- return function (t) {
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
- r.processAttributes = function (compiler, resources, node, attributes, elementInstruction) {
- try {
- processor(compiler, resources, node, attributes, elementInstruction);
- } catch (error) {
- LogManager.getLogger('templating').error(error);
- }
- };
- };
- }
- function doNotProcessContent() {
- return false;
- }
- function processContent(processor) {
- return function (t) {
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
- r.processContent = processor ? function (compiler, resources, node, instruction) {
- try {
- return processor(compiler, resources, node, instruction);
- } catch (error) {
- LogManager.getLogger('templating').error(error);
- return false;
- }
- } : doNotProcessContent;
- };
- }
- function containerless(target) {
- var deco = function deco(t) {
- var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
- r.containerless = true;
- };
- return target ? deco(target) : deco;
- }
- function useViewStrategy(strategy) {
- return function (target) {
- _aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, strategy, target);
- };
- }
- function useView(path) {
- return useViewStrategy(new RelativeViewStrategy(path));
- }
- function inlineView(markup, dependencies, dependencyBaseUrl) {
- return useViewStrategy(new InlineViewStrategy(markup, dependencies, dependencyBaseUrl));
- }
- function noView(targetOrDependencies, dependencyBaseUrl) {
- var target = void 0;
- var dependencies = void 0;
- if (typeof targetOrDependencies === 'function') {
- target = targetOrDependencies;
- } else {
- dependencies = targetOrDependencies;
- target = undefined;
- }
- var deco = function deco(t) {
- _aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, new NoViewStrategy(dependencies, dependencyBaseUrl), t);
- };
- return target ? deco(target) : deco;
- }
- function elementConfig(target) {
- var deco = function deco(t) {
- _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ElementConfigResource(), t);
- };
- return target ? deco(target) : deco;
- }
- function viewResources() {
- return function (target) {
- _aureliaMetadata.metadata.define(ViewEngine.viewModelRequireMetadataKey, resources, target);
- };
- }
- var TemplatingEngine = exports.TemplatingEngine = (_dec11 = (0, _aureliaDependencyInjection.inject)(_aureliaDependencyInjection.Container, ModuleAnalyzer, ViewCompiler, CompositionEngine), _dec11(_class23 = function () {
- function TemplatingEngine(container, moduleAnalyzer, viewCompiler, compositionEngine) {
-
- this._container = container;
- this._moduleAnalyzer = moduleAnalyzer;
- this._viewCompiler = viewCompiler;
- this._compositionEngine = compositionEngine;
- container.registerInstance(Animator, Animator.instance = new Animator());
- }
- TemplatingEngine.prototype.configureAnimator = function configureAnimator(animator) {
- this._container.unregister(Animator);
- this._container.registerInstance(Animator, Animator.instance = animator);
- };
- TemplatingEngine.prototype.compose = function compose(context) {
- return this._compositionEngine.compose(context);
- };
- TemplatingEngine.prototype.enhance = function enhance(instruction) {
- if (instruction instanceof _aureliaPal.DOM.Element) {
- instruction = { element: instruction };
- }
- var compilerInstructions = {};
- var resources = instruction.resources || this._container.get(ViewResources);
- this._viewCompiler._compileNode(instruction.element, resources, compilerInstructions, instruction.element.parentNode, 'root', true);
- var factory = new ViewFactory(instruction.element, compilerInstructions, resources);
- var container = instruction.container || this._container.createChild();
- var view = factory.create(container, BehaviorInstruction.enhance());
- view.bind(instruction.bindingContext || {}, instruction.overrideContext);
- return view;
- };
- return TemplatingEngine;
- }()) || _class23);
- });
- define('text!bootstrap/css/bootstrap.css', ['module'], function(module) { module.exports = "/*!\n * Bootstrap v3.3.7 (http://getbootstrap.com)\n * Copyright 2011-2016 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n */\n/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */\nhtml {\n font-family: sans-serif;\n -webkit-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n}\nbody {\n margin: 0;\n}\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n display: block;\n}\naudio,\ncanvas,\nprogress,\nvideo {\n display: inline-block;\n vertical-align: baseline;\n}\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n[hidden],\ntemplate {\n display: none;\n}\na {\n background-color: transparent;\n}\na:active,\na:hover {\n outline: 0;\n}\nabbr[title] {\n border-bottom: 1px dotted;\n}\nb,\nstrong {\n font-weight: bold;\n}\ndfn {\n font-style: italic;\n}\nh1 {\n margin: .67em 0;\n font-size: 2em;\n}\nmark {\n color: #000;\n background: #ff0;\n}\nsmall {\n font-size: 80%;\n}\nsub,\nsup {\n position: relative;\n font-size: 75%;\n line-height: 0;\n vertical-align: baseline;\n}\nsup {\n top: -.5em;\n}\nsub {\n bottom: -.25em;\n}\nimg {\n border: 0;\n}\nsvg:not(:root) {\n overflow: hidden;\n}\nfigure {\n margin: 1em 40px;\n}\nhr {\n height: 0;\n -webkit-box-sizing: content-box;\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n}\npre {\n overflow: auto;\n}\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n margin: 0;\n font: inherit;\n color: inherit;\n}\nbutton {\n overflow: visible;\n}\nbutton,\nselect {\n text-transform: none;\n}\nbutton,\nhtml input[type=\"button\"],\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n -webkit-appearance: button;\n cursor: pointer;\n}\nbutton[disabled],\nhtml input[disabled] {\n cursor: default;\n}\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n padding: 0;\n border: 0;\n}\ninput {\n line-height: normal;\n}\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n padding: 0;\n}\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\ninput[type=\"search\"] {\n -webkit-box-sizing: content-box;\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n -webkit-appearance: textfield;\n}\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\nfieldset {\n padding: .35em .625em .75em;\n margin: 0 2px;\n border: 1px solid #c0c0c0;\n}\nlegend {\n padding: 0;\n border: 0;\n}\ntextarea {\n overflow: auto;\n}\noptgroup {\n font-weight: bold;\n}\ntable {\n border-spacing: 0;\n border-collapse: collapse;\n}\ntd,\nth {\n padding: 0;\n}\n/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */\n@media print {\n *,\n *:before,\n *:after {\n color: #000 !important;\n text-shadow: none !important;\n background: transparent !important;\n -webkit-box-shadow: none !important;\n box-shadow: none !important;\n }\n a,\n a:visited {\n text-decoration: underline;\n }\n a[href]:after {\n content: \" (\" attr(href) \")\";\n }\n abbr[title]:after {\n content: \" (\" attr(title) \")\";\n }\n a[href^=\"#\"]:after,\n a[href^=\"javascript:\"]:after {\n content: \"\";\n }\n pre,\n blockquote {\n border: 1px solid #999;\n\n page-break-inside: avoid;\n }\n thead {\n display: table-header-group;\n }\n tr,\n img {\n page-break-inside: avoid;\n }\n img {\n max-width: 100% !important;\n }\n p,\n h2,\n h3 {\n orphans: 3;\n widows: 3;\n }\n h2,\n h3 {\n page-break-after: avoid;\n }\n .navbar {\n display: none;\n }\n .btn > .caret,\n .dropup > .btn > .caret {\n border-top-color: #000 !important;\n }\n .label {\n border: 1px solid #000;\n }\n .table {\n border-collapse: collapse !important;\n }\n .table td,\n .table th {\n background-color: #fff !important;\n }\n .table-bordered th,\n .table-bordered td {\n border: 1px solid #ddd !important;\n }\n}\n@font-face {\n font-family: 'Glyphicons Halflings';\n\n src: url('../fonts/glyphicons-halflings-regular.eot');\n src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');\n}\n.glyphicon {\n position: relative;\n top: 1px;\n display: inline-block;\n font-family: 'Glyphicons Halflings';\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.glyphicon-asterisk:before {\n content: \"\\002a\";\n}\n.glyphicon-plus:before {\n content: \"\\002b\";\n}\n.glyphicon-euro:before,\n.glyphicon-eur:before {\n content: \"\\20ac\";\n}\n.glyphicon-minus:before {\n content: \"\\2212\";\n}\n.glyphicon-cloud:before {\n content: \"\\2601\";\n}\n.glyphicon-envelope:before {\n content: \"\\2709\";\n}\n.glyphicon-pencil:before {\n content: \"\\270f\";\n}\n.glyphicon-glass:before {\n content: \"\\e001\";\n}\n.glyphicon-music:before {\n content: \"\\e002\";\n}\n.glyphicon-search:before {\n content: \"\\e003\";\n}\n.glyphicon-heart:before {\n content: \"\\e005\";\n}\n.glyphicon-star:before {\n content: \"\\e006\";\n}\n.glyphicon-star-empty:before {\n content: \"\\e007\";\n}\n.glyphicon-user:before {\n content: \"\\e008\";\n}\n.glyphicon-film:before {\n content: \"\\e009\";\n}\n.glyphicon-th-large:before {\n content: \"\\e010\";\n}\n.glyphicon-th:before {\n content: \"\\e011\";\n}\n.glyphicon-th-list:before {\n content: \"\\e012\";\n}\n.glyphicon-ok:before {\n content: \"\\e013\";\n}\n.glyphicon-remove:before {\n content: \"\\e014\";\n}\n.glyphicon-zoom-in:before {\n content: \"\\e015\";\n}\n.glyphicon-zoom-out:before {\n content: \"\\e016\";\n}\n.glyphicon-off:before {\n content: \"\\e017\";\n}\n.glyphicon-signal:before {\n content: \"\\e018\";\n}\n.glyphicon-cog:before {\n content: \"\\e019\";\n}\n.glyphicon-trash:before {\n content: \"\\e020\";\n}\n.glyphicon-home:before {\n content: \"\\e021\";\n}\n.glyphicon-file:before {\n content: \"\\e022\";\n}\n.glyphicon-time:before {\n content: \"\\e023\";\n}\n.glyphicon-road:before {\n content: \"\\e024\";\n}\n.glyphicon-download-alt:before {\n content: \"\\e025\";\n}\n.glyphicon-download:before {\n content: \"\\e026\";\n}\n.glyphicon-upload:before {\n content: \"\\e027\";\n}\n.glyphicon-inbox:before {\n content: \"\\e028\";\n}\n.glyphicon-play-circle:before {\n content: \"\\e029\";\n}\n.glyphicon-repeat:before {\n content: \"\\e030\";\n}\n.glyphicon-refresh:before {\n content: \"\\e031\";\n}\n.glyphicon-list-alt:before {\n content: \"\\e032\";\n}\n.glyphicon-lock:before {\n content: \"\\e033\";\n}\n.glyphicon-flag:before {\n content: \"\\e034\";\n}\n.glyphicon-headphones:before {\n content: \"\\e035\";\n}\n.glyphicon-volume-off:before {\n content: \"\\e036\";\n}\n.glyphicon-volume-down:before {\n content: \"\\e037\";\n}\n.glyphicon-volume-up:before {\n content: \"\\e038\";\n}\n.glyphicon-qrcode:before {\n content: \"\\e039\";\n}\n.glyphicon-barcode:before {\n content: \"\\e040\";\n}\n.glyphicon-tag:before {\n content: \"\\e041\";\n}\n.glyphicon-tags:before {\n content: \"\\e042\";\n}\n.glyphicon-book:before {\n content: \"\\e043\";\n}\n.glyphicon-bookmark:before {\n content: \"\\e044\";\n}\n.glyphicon-print:before {\n content: \"\\e045\";\n}\n.glyphicon-camera:before {\n content: \"\\e046\";\n}\n.glyphicon-font:before {\n content: \"\\e047\";\n}\n.glyphicon-bold:before {\n content: \"\\e048\";\n}\n.glyphicon-italic:before {\n content: \"\\e049\";\n}\n.glyphicon-text-height:before {\n content: \"\\e050\";\n}\n.glyphicon-text-width:before {\n content: \"\\e051\";\n}\n.glyphicon-align-left:before {\n content: \"\\e052\";\n}\n.glyphicon-align-center:before {\n content: \"\\e053\";\n}\n.glyphicon-align-right:before {\n content: \"\\e054\";\n}\n.glyphicon-align-justify:before {\n content: \"\\e055\";\n}\n.glyphicon-list:before {\n content: \"\\e056\";\n}\n.glyphicon-indent-left:before {\n content: \"\\e057\";\n}\n.glyphicon-indent-right:before {\n content: \"\\e058\";\n}\n.glyphicon-facetime-video:before {\n content: \"\\e059\";\n}\n.glyphicon-picture:before {\n content: \"\\e060\";\n}\n.glyphicon-map-marker:before {\n content: \"\\e062\";\n}\n.glyphicon-adjust:before {\n content: \"\\e063\";\n}\n.glyphicon-tint:before {\n content: \"\\e064\";\n}\n.glyphicon-edit:before {\n content: \"\\e065\";\n}\n.glyphicon-share:before {\n content: \"\\e066\";\n}\n.glyphicon-check:before {\n content: \"\\e067\";\n}\n.glyphicon-move:before {\n content: \"\\e068\";\n}\n.glyphicon-step-backward:before {\n content: \"\\e069\";\n}\n.glyphicon-fast-backward:before {\n content: \"\\e070\";\n}\n.glyphicon-backward:before {\n content: \"\\e071\";\n}\n.glyphicon-play:before {\n content: \"\\e072\";\n}\n.glyphicon-pause:before {\n content: \"\\e073\";\n}\n.glyphicon-stop:before {\n content: \"\\e074\";\n}\n.glyphicon-forward:before {\n content: \"\\e075\";\n}\n.glyphicon-fast-forward:before {\n content: \"\\e076\";\n}\n.glyphicon-step-forward:before {\n content: \"\\e077\";\n}\n.glyphicon-eject:before {\n content: \"\\e078\";\n}\n.glyphicon-chevron-left:before {\n content: \"\\e079\";\n}\n.glyphicon-chevron-right:before {\n content: \"\\e080\";\n}\n.glyphicon-plus-sign:before {\n content: \"\\e081\";\n}\n.glyphicon-minus-sign:before {\n content: \"\\e082\";\n}\n.glyphicon-remove-sign:before {\n content: \"\\e083\";\n}\n.glyphicon-ok-sign:before {\n content: \"\\e084\";\n}\n.glyphicon-question-sign:before {\n content: \"\\e085\";\n}\n.glyphicon-info-sign:before {\n content: \"\\e086\";\n}\n.glyphicon-screenshot:before {\n content: \"\\e087\";\n}\n.glyphicon-remove-circle:before {\n content: \"\\e088\";\n}\n.glyphicon-ok-circle:before {\n content: \"\\e089\";\n}\n.glyphicon-ban-circle:before {\n content: \"\\e090\";\n}\n.glyphicon-arrow-left:before {\n content: \"\\e091\";\n}\n.glyphicon-arrow-right:before {\n content: \"\\e092\";\n}\n.glyphicon-arrow-up:before {\n content: \"\\e093\";\n}\n.glyphicon-arrow-down:before {\n content: \"\\e094\";\n}\n.glyphicon-share-alt:before {\n content: \"\\e095\";\n}\n.glyphicon-resize-full:before {\n content: \"\\e096\";\n}\n.glyphicon-resize-small:before {\n content: \"\\e097\";\n}\n.glyphicon-exclamation-sign:before {\n content: \"\\e101\";\n}\n.glyphicon-gift:before {\n content: \"\\e102\";\n}\n.glyphicon-leaf:before {\n content: \"\\e103\";\n}\n.glyphicon-fire:before {\n content: \"\\e104\";\n}\n.glyphicon-eye-open:before {\n content: \"\\e105\";\n}\n.glyphicon-eye-close:before {\n content: \"\\e106\";\n}\n.glyphicon-warning-sign:before {\n content: \"\\e107\";\n}\n.glyphicon-plane:before {\n content: \"\\e108\";\n}\n.glyphicon-calendar:before {\n content: \"\\e109\";\n}\n.glyphicon-random:before {\n content: \"\\e110\";\n}\n.glyphicon-comment:before {\n content: \"\\e111\";\n}\n.glyphicon-magnet:before {\n content: \"\\e112\";\n}\n.glyphicon-chevron-up:before {\n content: \"\\e113\";\n}\n.glyphicon-chevron-down:before {\n content: \"\\e114\";\n}\n.glyphicon-retweet:before {\n content: \"\\e115\";\n}\n.glyphicon-shopping-cart:before {\n content: \"\\e116\";\n}\n.glyphicon-folder-close:before {\n content: \"\\e117\";\n}\n.glyphicon-folder-open:before {\n content: \"\\e118\";\n}\n.glyphicon-resize-vertical:before {\n content: \"\\e119\";\n}\n.glyphicon-resize-horizontal:before {\n content: \"\\e120\";\n}\n.glyphicon-hdd:before {\n content: \"\\e121\";\n}\n.glyphicon-bullhorn:before {\n content: \"\\e122\";\n}\n.glyphicon-bell:before {\n content: \"\\e123\";\n}\n.glyphicon-certificate:before {\n content: \"\\e124\";\n}\n.glyphicon-thumbs-up:before {\n content: \"\\e125\";\n}\n.glyphicon-thumbs-down:before {\n content: \"\\e126\";\n}\n.glyphicon-hand-right:before {\n content: \"\\e127\";\n}\n.glyphicon-hand-left:before {\n content: \"\\e128\";\n}\n.glyphicon-hand-up:before {\n content: \"\\e129\";\n}\n.glyphicon-hand-down:before {\n content: \"\\e130\";\n}\n.glyphicon-circle-arrow-right:before {\n content: \"\\e131\";\n}\n.glyphicon-circle-arrow-left:before {\n content: \"\\e132\";\n}\n.glyphicon-circle-arrow-up:before {\n content: \"\\e133\";\n}\n.glyphicon-circle-arrow-down:before {\n content: \"\\e134\";\n}\n.glyphicon-globe:before {\n content: \"\\e135\";\n}\n.glyphicon-wrench:before {\n content: \"\\e136\";\n}\n.glyphicon-tasks:before {\n content: \"\\e137\";\n}\n.glyphicon-filter:before {\n content: \"\\e138\";\n}\n.glyphicon-briefcase:before {\n content: \"\\e139\";\n}\n.glyphicon-fullscreen:before {\n content: \"\\e140\";\n}\n.glyphicon-dashboard:before {\n content: \"\\e141\";\n}\n.glyphicon-paperclip:before {\n content: \"\\e142\";\n}\n.glyphicon-heart-empty:before {\n content: \"\\e143\";\n}\n.glyphicon-link:before {\n content: \"\\e144\";\n}\n.glyphicon-phone:before {\n content: \"\\e145\";\n}\n.glyphicon-pushpin:before {\n content: \"\\e146\";\n}\n.glyphicon-usd:before {\n content: \"\\e148\";\n}\n.glyphicon-gbp:before {\n content: \"\\e149\";\n}\n.glyphicon-sort:before {\n content: \"\\e150\";\n}\n.glyphicon-sort-by-alphabet:before {\n content: \"\\e151\";\n}\n.glyphicon-sort-by-alphabet-alt:before {\n content: \"\\e152\";\n}\n.glyphicon-sort-by-order:before {\n content: \"\\e153\";\n}\n.glyphicon-sort-by-order-alt:before {\n content: \"\\e154\";\n}\n.glyphicon-sort-by-attributes:before {\n content: \"\\e155\";\n}\n.glyphicon-sort-by-attributes-alt:before {\n content: \"\\e156\";\n}\n.glyphicon-unchecked:before {\n content: \"\\e157\";\n}\n.glyphicon-expand:before {\n content: \"\\e158\";\n}\n.glyphicon-collapse-down:before {\n content: \"\\e159\";\n}\n.glyphicon-collapse-up:before {\n content: \"\\e160\";\n}\n.glyphicon-log-in:before {\n content: \"\\e161\";\n}\n.glyphicon-flash:before {\n content: \"\\e162\";\n}\n.glyphicon-log-out:before {\n content: \"\\e163\";\n}\n.glyphicon-new-window:before {\n content: \"\\e164\";\n}\n.glyphicon-record:before {\n content: \"\\e165\";\n}\n.glyphicon-save:before {\n content: \"\\e166\";\n}\n.glyphicon-open:before {\n content: \"\\e167\";\n}\n.glyphicon-saved:before {\n content: \"\\e168\";\n}\n.glyphicon-import:before {\n content: \"\\e169\";\n}\n.glyphicon-export:before {\n content: \"\\e170\";\n}\n.glyphicon-send:before {\n content: \"\\e171\";\n}\n.glyphicon-floppy-disk:before {\n content: \"\\e172\";\n}\n.glyphicon-floppy-saved:before {\n content: \"\\e173\";\n}\n.glyphicon-floppy-remove:before {\n content: \"\\e174\";\n}\n.glyphicon-floppy-save:before {\n content: \"\\e175\";\n}\n.glyphicon-floppy-open:before {\n content: \"\\e176\";\n}\n.glyphicon-credit-card:before {\n content: \"\\e177\";\n}\n.glyphicon-transfer:before {\n content: \"\\e178\";\n}\n.glyphicon-cutlery:before {\n content: \"\\e179\";\n}\n.glyphicon-header:before {\n content: \"\\e180\";\n}\n.glyphicon-compressed:before {\n content: \"\\e181\";\n}\n.glyphicon-earphone:before {\n content: \"\\e182\";\n}\n.glyphicon-phone-alt:before {\n content: \"\\e183\";\n}\n.glyphicon-tower:before {\n content: \"\\e184\";\n}\n.glyphicon-stats:before {\n content: \"\\e185\";\n}\n.glyphicon-sd-video:before {\n content: \"\\e186\";\n}\n.glyphicon-hd-video:before {\n content: \"\\e187\";\n}\n.glyphicon-subtitles:before {\n content: \"\\e188\";\n}\n.glyphicon-sound-stereo:before {\n content: \"\\e189\";\n}\n.glyphicon-sound-dolby:before {\n content: \"\\e190\";\n}\n.glyphicon-sound-5-1:before {\n content: \"\\e191\";\n}\n.glyphicon-sound-6-1:before {\n content: \"\\e192\";\n}\n.glyphicon-sound-7-1:before {\n content: \"\\e193\";\n}\n.glyphicon-copyright-mark:before {\n content: \"\\e194\";\n}\n.glyphicon-registration-mark:before {\n content: \"\\e195\";\n}\n.glyphicon-cloud-download:before {\n content: \"\\e197\";\n}\n.glyphicon-cloud-upload:before {\n content: \"\\e198\";\n}\n.glyphicon-tree-conifer:before {\n content: \"\\e199\";\n}\n.glyphicon-tree-deciduous:before {\n content: \"\\e200\";\n}\n.glyphicon-cd:before {\n content: \"\\e201\";\n}\n.glyphicon-save-file:before {\n content: \"\\e202\";\n}\n.glyphicon-open-file:before {\n content: \"\\e203\";\n}\n.glyphicon-level-up:before {\n content: \"\\e204\";\n}\n.glyphicon-copy:before {\n content: \"\\e205\";\n}\n.glyphicon-paste:before {\n content: \"\\e206\";\n}\n.glyphicon-alert:before {\n content: \"\\e209\";\n}\n.glyphicon-equalizer:before {\n content: \"\\e210\";\n}\n.glyphicon-king:before {\n content: \"\\e211\";\n}\n.glyphicon-queen:before {\n content: \"\\e212\";\n}\n.glyphicon-pawn:before {\n content: \"\\e213\";\n}\n.glyphicon-bishop:before {\n content: \"\\e214\";\n}\n.glyphicon-knight:before {\n content: \"\\e215\";\n}\n.glyphicon-baby-formula:before {\n content: \"\\e216\";\n}\n.glyphicon-tent:before {\n content: \"\\26fa\";\n}\n.glyphicon-blackboard:before {\n content: \"\\e218\";\n}\n.glyphicon-bed:before {\n content: \"\\e219\";\n}\n.glyphicon-apple:before {\n content: \"\\f8ff\";\n}\n.glyphicon-erase:before {\n content: \"\\e221\";\n}\n.glyphicon-hourglass:before {\n content: \"\\231b\";\n}\n.glyphicon-lamp:before {\n content: \"\\e223\";\n}\n.glyphicon-duplicate:before {\n content: \"\\e224\";\n}\n.glyphicon-piggy-bank:before {\n content: \"\\e225\";\n}\n.glyphicon-scissors:before {\n content: \"\\e226\";\n}\n.glyphicon-bitcoin:before {\n content: \"\\e227\";\n}\n.glyphicon-btc:before {\n content: \"\\e227\";\n}\n.glyphicon-xbt:before {\n content: \"\\e227\";\n}\n.glyphicon-yen:before {\n content: \"\\00a5\";\n}\n.glyphicon-jpy:before {\n content: \"\\00a5\";\n}\n.glyphicon-ruble:before {\n content: \"\\20bd\";\n}\n.glyphicon-rub:before {\n content: \"\\20bd\";\n}\n.glyphicon-scale:before {\n content: \"\\e230\";\n}\n.glyphicon-ice-lolly:before {\n content: \"\\e231\";\n}\n.glyphicon-ice-lolly-tasted:before {\n content: \"\\e232\";\n}\n.glyphicon-education:before {\n content: \"\\e233\";\n}\n.glyphicon-option-horizontal:before {\n content: \"\\e234\";\n}\n.glyphicon-option-vertical:before {\n content: \"\\e235\";\n}\n.glyphicon-menu-hamburger:before {\n content: \"\\e236\";\n}\n.glyphicon-modal-window:before {\n content: \"\\e237\";\n}\n.glyphicon-oil:before {\n content: \"\\e238\";\n}\n.glyphicon-grain:before {\n content: \"\\e239\";\n}\n.glyphicon-sunglasses:before {\n content: \"\\e240\";\n}\n.glyphicon-text-size:before {\n content: \"\\e241\";\n}\n.glyphicon-text-color:before {\n content: \"\\e242\";\n}\n.glyphicon-text-background:before {\n content: \"\\e243\";\n}\n.glyphicon-object-align-top:before {\n content: \"\\e244\";\n}\n.glyphicon-object-align-bottom:before {\n content: \"\\e245\";\n}\n.glyphicon-object-align-horizontal:before {\n content: \"\\e246\";\n}\n.glyphicon-object-align-left:before {\n content: \"\\e247\";\n}\n.glyphicon-object-align-vertical:before {\n content: \"\\e248\";\n}\n.glyphicon-object-align-right:before {\n content: \"\\e249\";\n}\n.glyphicon-triangle-right:before {\n content: \"\\e250\";\n}\n.glyphicon-triangle-left:before {\n content: \"\\e251\";\n}\n.glyphicon-triangle-bottom:before {\n content: \"\\e252\";\n}\n.glyphicon-triangle-top:before {\n content: \"\\e253\";\n}\n.glyphicon-console:before {\n content: \"\\e254\";\n}\n.glyphicon-superscript:before {\n content: \"\\e255\";\n}\n.glyphicon-subscript:before {\n content: \"\\e256\";\n}\n.glyphicon-menu-left:before {\n content: \"\\e257\";\n}\n.glyphicon-menu-right:before {\n content: \"\\e258\";\n}\n.glyphicon-menu-down:before {\n content: \"\\e259\";\n}\n.glyphicon-menu-up:before {\n content: \"\\e260\";\n}\n* {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n*:before,\n*:after {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\nhtml {\n font-size: 10px;\n\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\nbody {\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n font-size: 14px;\n line-height: 1.42857143;\n color: #333;\n background-color: #fff;\n}\ninput,\nbutton,\nselect,\ntextarea {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n}\na {\n color: #337ab7;\n text-decoration: none;\n}\na:hover,\na:focus {\n color: #23527c;\n text-decoration: underline;\n}\na:focus {\n outline: 5px auto -webkit-focus-ring-color;\n outline-offset: -2px;\n}\nfigure {\n margin: 0;\n}\nimg {\n vertical-align: middle;\n}\n.img-responsive,\n.thumbnail > img,\n.thumbnail a > img,\n.carousel-inner > .item > img,\n.carousel-inner > .item > a > img {\n display: block;\n max-width: 100%;\n height: auto;\n}\n.img-rounded {\n border-radius: 6px;\n}\n.img-thumbnail {\n display: inline-block;\n max-width: 100%;\n height: auto;\n padding: 4px;\n line-height: 1.42857143;\n background-color: #fff;\n border: 1px solid #ddd;\n border-radius: 4px;\n -webkit-transition: all .2s ease-in-out;\n -o-transition: all .2s ease-in-out;\n transition: all .2s ease-in-out;\n}\n.img-circle {\n border-radius: 50%;\n}\nhr {\n margin-top: 20px;\n margin-bottom: 20px;\n border: 0;\n border-top: 1px solid #eee;\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n border: 0;\n}\n.sr-only-focusable:active,\n.sr-only-focusable:focus {\n position: static;\n width: auto;\n height: auto;\n margin: 0;\n overflow: visible;\n clip: auto;\n}\n[role=\"button\"] {\n cursor: pointer;\n}\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\n.h1,\n.h2,\n.h3,\n.h4,\n.h5,\n.h6 {\n font-family: inherit;\n font-weight: 500;\n line-height: 1.1;\n color: inherit;\n}\nh1 small,\nh2 small,\nh3 small,\nh4 small,\nh5 small,\nh6 small,\n.h1 small,\n.h2 small,\n.h3 small,\n.h4 small,\n.h5 small,\n.h6 small,\nh1 .small,\nh2 .small,\nh3 .small,\nh4 .small,\nh5 .small,\nh6 .small,\n.h1 .small,\n.h2 .small,\n.h3 .small,\n.h4 .small,\n.h5 .small,\n.h6 .small {\n font-weight: normal;\n line-height: 1;\n color: #777;\n}\nh1,\n.h1,\nh2,\n.h2,\nh3,\n.h3 {\n margin-top: 20px;\n margin-bottom: 10px;\n}\nh1 small,\n.h1 small,\nh2 small,\n.h2 small,\nh3 small,\n.h3 small,\nh1 .small,\n.h1 .small,\nh2 .small,\n.h2 .small,\nh3 .small,\n.h3 .small {\n font-size: 65%;\n}\nh4,\n.h4,\nh5,\n.h5,\nh6,\n.h6 {\n margin-top: 10px;\n margin-bottom: 10px;\n}\nh4 small,\n.h4 small,\nh5 small,\n.h5 small,\nh6 small,\n.h6 small,\nh4 .small,\n.h4 .small,\nh5 .small,\n.h5 .small,\nh6 .small,\n.h6 .small {\n font-size: 75%;\n}\nh1,\n.h1 {\n font-size: 36px;\n}\nh2,\n.h2 {\n font-size: 30px;\n}\nh3,\n.h3 {\n font-size: 24px;\n}\nh4,\n.h4 {\n font-size: 18px;\n}\nh5,\n.h5 {\n font-size: 14px;\n}\nh6,\n.h6 {\n font-size: 12px;\n}\np {\n margin: 0 0 10px;\n}\n.lead {\n margin-bottom: 20px;\n font-size: 16px;\n font-weight: 300;\n line-height: 1.4;\n}\n@media (min-width: 768px) {\n .lead {\n font-size: 21px;\n }\n}\nsmall,\n.small {\n font-size: 85%;\n}\nmark,\n.mark {\n padding: .2em;\n background-color: #fcf8e3;\n}\n.text-left {\n text-align: left;\n}\n.text-right {\n text-align: right;\n}\n.text-center {\n text-align: center;\n}\n.text-justify {\n text-align: justify;\n}\n.text-nowrap {\n white-space: nowrap;\n}\n.text-lowercase {\n text-transform: lowercase;\n}\n.text-uppercase {\n text-transform: uppercase;\n}\n.text-capitalize {\n text-transform: capitalize;\n}\n.text-muted {\n color: #777;\n}\n.text-primary {\n color: #337ab7;\n}\na.text-primary:hover,\na.text-primary:focus {\n color: #286090;\n}\n.text-success {\n color: #3c763d;\n}\na.text-success:hover,\na.text-success:focus {\n color: #2b542c;\n}\n.text-info {\n color: #31708f;\n}\na.text-info:hover,\na.text-info:focus {\n color: #245269;\n}\n.text-warning {\n color: #8a6d3b;\n}\na.text-warning:hover,\na.text-warning:focus {\n color: #66512c;\n}\n.text-danger {\n color: #a94442;\n}\na.text-danger:hover,\na.text-danger:focus {\n color: #843534;\n}\n.bg-primary {\n color: #fff;\n background-color: #337ab7;\n}\na.bg-primary:hover,\na.bg-primary:focus {\n background-color: #286090;\n}\n.bg-success {\n background-color: #dff0d8;\n}\na.bg-success:hover,\na.bg-success:focus {\n background-color: #c1e2b3;\n}\n.bg-info {\n background-color: #d9edf7;\n}\na.bg-info:hover,\na.bg-info:focus {\n background-color: #afd9ee;\n}\n.bg-warning {\n background-color: #fcf8e3;\n}\na.bg-warning:hover,\na.bg-warning:focus {\n background-color: #f7ecb5;\n}\n.bg-danger {\n background-color: #f2dede;\n}\na.bg-danger:hover,\na.bg-danger:focus {\n background-color: #e4b9b9;\n}\n.page-header {\n padding-bottom: 9px;\n margin: 40px 0 20px;\n border-bottom: 1px solid #eee;\n}\nul,\nol {\n margin-top: 0;\n margin-bottom: 10px;\n}\nul ul,\nol ul,\nul ol,\nol ol {\n margin-bottom: 0;\n}\n.list-unstyled {\n padding-left: 0;\n list-style: none;\n}\n.list-inline {\n padding-left: 0;\n margin-left: -5px;\n list-style: none;\n}\n.list-inline > li {\n display: inline-block;\n padding-right: 5px;\n padding-left: 5px;\n}\ndl {\n margin-top: 0;\n margin-bottom: 20px;\n}\ndt,\ndd {\n line-height: 1.42857143;\n}\ndt {\n font-weight: bold;\n}\ndd {\n margin-left: 0;\n}\n@media (min-width: 768px) {\n .dl-horizontal dt {\n float: left;\n width: 160px;\n overflow: hidden;\n clear: left;\n text-align: right;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .dl-horizontal dd {\n margin-left: 180px;\n }\n}\nabbr[title],\nabbr[data-original-title] {\n cursor: help;\n border-bottom: 1px dotted #777;\n}\n.initialism {\n font-size: 90%;\n text-transform: uppercase;\n}\nblockquote {\n padding: 10px 20px;\n margin: 0 0 20px;\n font-size: 17.5px;\n border-left: 5px solid #eee;\n}\nblockquote p:last-child,\nblockquote ul:last-child,\nblockquote ol:last-child {\n margin-bottom: 0;\n}\nblockquote footer,\nblockquote small,\nblockquote .small {\n display: block;\n font-size: 80%;\n line-height: 1.42857143;\n color: #777;\n}\nblockquote footer:before,\nblockquote small:before,\nblockquote .small:before {\n content: '\\2014 \\00A0';\n}\n.blockquote-reverse,\nblockquote.pull-right {\n padding-right: 15px;\n padding-left: 0;\n text-align: right;\n border-right: 5px solid #eee;\n border-left: 0;\n}\n.blockquote-reverse footer:before,\nblockquote.pull-right footer:before,\n.blockquote-reverse small:before,\nblockquote.pull-right small:before,\n.blockquote-reverse .small:before,\nblockquote.pull-right .small:before {\n content: '';\n}\n.blockquote-reverse footer:after,\nblockquote.pull-right footer:after,\n.blockquote-reverse small:after,\nblockquote.pull-right small:after,\n.blockquote-reverse .small:after,\nblockquote.pull-right .small:after {\n content: '\\00A0 \\2014';\n}\naddress {\n margin-bottom: 20px;\n font-style: normal;\n line-height: 1.42857143;\n}\ncode,\nkbd,\npre,\nsamp {\n font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\ncode {\n padding: 2px 4px;\n font-size: 90%;\n color: #c7254e;\n background-color: #f9f2f4;\n border-radius: 4px;\n}\nkbd {\n padding: 2px 4px;\n font-size: 90%;\n color: #fff;\n background-color: #333;\n border-radius: 3px;\n -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);\n box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);\n}\nkbd kbd {\n padding: 0;\n font-size: 100%;\n font-weight: bold;\n -webkit-box-shadow: none;\n box-shadow: none;\n}\npre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n background-color: #f5f5f5;\n border: 1px solid #ccc;\n border-radius: 4px;\n}\npre code {\n padding: 0;\n font-size: inherit;\n color: inherit;\n white-space: pre-wrap;\n background-color: transparent;\n border-radius: 0;\n}\n.pre-scrollable {\n max-height: 340px;\n overflow-y: scroll;\n}\n.container {\n padding-right: 15px;\n padding-left: 15px;\n margin-right: auto;\n margin-left: auto;\n}\n@media (min-width: 768px) {\n .container {\n width: 750px;\n }\n}\n@media (min-width: 992px) {\n .container {\n width: 970px;\n }\n}\n@media (min-width: 1200px) {\n .container {\n width: 1170px;\n }\n}\n.container-fluid {\n padding-right: 15px;\n padding-left: 15px;\n margin-right: auto;\n margin-left: auto;\n}\n.row {\n margin-right: -15px;\n margin-left: -15px;\n}\n.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {\n position: relative;\n min-height: 1px;\n padding-right: 15px;\n padding-left: 15px;\n}\n.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {\n float: left;\n}\n.col-xs-12 {\n width: 100%;\n}\n.col-xs-11 {\n width: 91.66666667%;\n}\n.col-xs-10 {\n width: 83.33333333%;\n}\n.col-xs-9 {\n width: 75%;\n}\n.col-xs-8 {\n width: 66.66666667%;\n}\n.col-xs-7 {\n width: 58.33333333%;\n}\n.col-xs-6 {\n width: 50%;\n}\n.col-xs-5 {\n width: 41.66666667%;\n}\n.col-xs-4 {\n width: 33.33333333%;\n}\n.col-xs-3 {\n width: 25%;\n}\n.col-xs-2 {\n width: 16.66666667%;\n}\n.col-xs-1 {\n width: 8.33333333%;\n}\n.col-xs-pull-12 {\n right: 100%;\n}\n.col-xs-pull-11 {\n right: 91.66666667%;\n}\n.col-xs-pull-10 {\n right: 83.33333333%;\n}\n.col-xs-pull-9 {\n right: 75%;\n}\n.col-xs-pull-8 {\n right: 66.66666667%;\n}\n.col-xs-pull-7 {\n right: 58.33333333%;\n}\n.col-xs-pull-6 {\n right: 50%;\n}\n.col-xs-pull-5 {\n right: 41.66666667%;\n}\n.col-xs-pull-4 {\n right: 33.33333333%;\n}\n.col-xs-pull-3 {\n right: 25%;\n}\n.col-xs-pull-2 {\n right: 16.66666667%;\n}\n.col-xs-pull-1 {\n right: 8.33333333%;\n}\n.col-xs-pull-0 {\n right: auto;\n}\n.col-xs-push-12 {\n left: 100%;\n}\n.col-xs-push-11 {\n left: 91.66666667%;\n}\n.col-xs-push-10 {\n left: 83.33333333%;\n}\n.col-xs-push-9 {\n left: 75%;\n}\n.col-xs-push-8 {\n left: 66.66666667%;\n}\n.col-xs-push-7 {\n left: 58.33333333%;\n}\n.col-xs-push-6 {\n left: 50%;\n}\n.col-xs-push-5 {\n left: 41.66666667%;\n}\n.col-xs-push-4 {\n left: 33.33333333%;\n}\n.col-xs-push-3 {\n left: 25%;\n}\n.col-xs-push-2 {\n left: 16.66666667%;\n}\n.col-xs-push-1 {\n left: 8.33333333%;\n}\n.col-xs-push-0 {\n left: auto;\n}\n.col-xs-offset-12 {\n margin-left: 100%;\n}\n.col-xs-offset-11 {\n margin-left: 91.66666667%;\n}\n.col-xs-offset-10 {\n margin-left: 83.33333333%;\n}\n.col-xs-offset-9 {\n margin-left: 75%;\n}\n.col-xs-offset-8 {\n margin-left: 66.66666667%;\n}\n.col-xs-offset-7 {\n margin-left: 58.33333333%;\n}\n.col-xs-offset-6 {\n margin-left: 50%;\n}\n.col-xs-offset-5 {\n margin-left: 41.66666667%;\n}\n.col-xs-offset-4 {\n margin-left: 33.33333333%;\n}\n.col-xs-offset-3 {\n margin-left: 25%;\n}\n.col-xs-offset-2 {\n margin-left: 16.66666667%;\n}\n.col-xs-offset-1 {\n margin-left: 8.33333333%;\n}\n.col-xs-offset-0 {\n margin-left: 0;\n}\n@media (min-width: 768px) {\n .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {\n float: left;\n }\n .col-sm-12 {\n width: 100%;\n }\n .col-sm-11 {\n width: 91.66666667%;\n }\n .col-sm-10 {\n width: 83.33333333%;\n }\n .col-sm-9 {\n width: 75%;\n }\n .col-sm-8 {\n width: 66.66666667%;\n }\n .col-sm-7 {\n width: 58.33333333%;\n }\n .col-sm-6 {\n width: 50%;\n }\n .col-sm-5 {\n width: 41.66666667%;\n }\n .col-sm-4 {\n width: 33.33333333%;\n }\n .col-sm-3 {\n width: 25%;\n }\n .col-sm-2 {\n width: 16.66666667%;\n }\n .col-sm-1 {\n width: 8.33333333%;\n }\n .col-sm-pull-12 {\n right: 100%;\n }\n .col-sm-pull-11 {\n right: 91.66666667%;\n }\n .col-sm-pull-10 {\n right: 83.33333333%;\n }\n .col-sm-pull-9 {\n right: 75%;\n }\n .col-sm-pull-8 {\n right: 66.66666667%;\n }\n .col-sm-pull-7 {\n right: 58.33333333%;\n }\n .col-sm-pull-6 {\n right: 50%;\n }\n .col-sm-pull-5 {\n right: 41.66666667%;\n }\n .col-sm-pull-4 {\n right: 33.33333333%;\n }\n .col-sm-pull-3 {\n right: 25%;\n }\n .col-sm-pull-2 {\n right: 16.66666667%;\n }\n .col-sm-pull-1 {\n right: 8.33333333%;\n }\n .col-sm-pull-0 {\n right: auto;\n }\n .col-sm-push-12 {\n left: 100%;\n }\n .col-sm-push-11 {\n left: 91.66666667%;\n }\n .col-sm-push-10 {\n left: 83.33333333%;\n }\n .col-sm-push-9 {\n left: 75%;\n }\n .col-sm-push-8 {\n left: 66.66666667%;\n }\n .col-sm-push-7 {\n left: 58.33333333%;\n }\n .col-sm-push-6 {\n left: 50%;\n }\n .col-sm-push-5 {\n left: 41.66666667%;\n }\n .col-sm-push-4 {\n left: 33.33333333%;\n }\n .col-sm-push-3 {\n left: 25%;\n }\n .col-sm-push-2 {\n left: 16.66666667%;\n }\n .col-sm-push-1 {\n left: 8.33333333%;\n }\n .col-sm-push-0 {\n left: auto;\n }\n .col-sm-offset-12 {\n margin-left: 100%;\n }\n .col-sm-offset-11 {\n margin-left: 91.66666667%;\n }\n .col-sm-offset-10 {\n margin-left: 83.33333333%;\n }\n .col-sm-offset-9 {\n margin-left: 75%;\n }\n .col-sm-offset-8 {\n margin-left: 66.66666667%;\n }\n .col-sm-offset-7 {\n margin-left: 58.33333333%;\n }\n .col-sm-offset-6 {\n margin-left: 50%;\n }\n .col-sm-offset-5 {\n margin-left: 41.66666667%;\n }\n .col-sm-offset-4 {\n margin-left: 33.33333333%;\n }\n .col-sm-offset-3 {\n margin-left: 25%;\n }\n .col-sm-offset-2 {\n margin-left: 16.66666667%;\n }\n .col-sm-offset-1 {\n margin-left: 8.33333333%;\n }\n .col-sm-offset-0 {\n margin-left: 0;\n }\n}\n@media (min-width: 992px) {\n .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {\n float: left;\n }\n .col-md-12 {\n width: 100%;\n }\n .col-md-11 {\n width: 91.66666667%;\n }\n .col-md-10 {\n width: 83.33333333%;\n }\n .col-md-9 {\n width: 75%;\n }\n .col-md-8 {\n width: 66.66666667%;\n }\n .col-md-7 {\n width: 58.33333333%;\n }\n .col-md-6 {\n width: 50%;\n }\n .col-md-5 {\n width: 41.66666667%;\n }\n .col-md-4 {\n width: 33.33333333%;\n }\n .col-md-3 {\n width: 25%;\n }\n .col-md-2 {\n width: 16.66666667%;\n }\n .col-md-1 {\n width: 8.33333333%;\n }\n .col-md-pull-12 {\n right: 100%;\n }\n .col-md-pull-11 {\n right: 91.66666667%;\n }\n .col-md-pull-10 {\n right: 83.33333333%;\n }\n .col-md-pull-9 {\n right: 75%;\n }\n .col-md-pull-8 {\n right: 66.66666667%;\n }\n .col-md-pull-7 {\n right: 58.33333333%;\n }\n .col-md-pull-6 {\n right: 50%;\n }\n .col-md-pull-5 {\n right: 41.66666667%;\n }\n .col-md-pull-4 {\n right: 33.33333333%;\n }\n .col-md-pull-3 {\n right: 25%;\n }\n .col-md-pull-2 {\n right: 16.66666667%;\n }\n .col-md-pull-1 {\n right: 8.33333333%;\n }\n .col-md-pull-0 {\n right: auto;\n }\n .col-md-push-12 {\n left: 100%;\n }\n .col-md-push-11 {\n left: 91.66666667%;\n }\n .col-md-push-10 {\n left: 83.33333333%;\n }\n .col-md-push-9 {\n left: 75%;\n }\n .col-md-push-8 {\n left: 66.66666667%;\n }\n .col-md-push-7 {\n left: 58.33333333%;\n }\n .col-md-push-6 {\n left: 50%;\n }\n .col-md-push-5 {\n left: 41.66666667%;\n }\n .col-md-push-4 {\n left: 33.33333333%;\n }\n .col-md-push-3 {\n left: 25%;\n }\n .col-md-push-2 {\n left: 16.66666667%;\n }\n .col-md-push-1 {\n left: 8.33333333%;\n }\n .col-md-push-0 {\n left: auto;\n }\n .col-md-offset-12 {\n margin-left: 100%;\n }\n .col-md-offset-11 {\n margin-left: 91.66666667%;\n }\n .col-md-offset-10 {\n margin-left: 83.33333333%;\n }\n .col-md-offset-9 {\n margin-left: 75%;\n }\n .col-md-offset-8 {\n margin-left: 66.66666667%;\n }\n .col-md-offset-7 {\n margin-left: 58.33333333%;\n }\n .col-md-offset-6 {\n margin-left: 50%;\n }\n .col-md-offset-5 {\n margin-left: 41.66666667%;\n }\n .col-md-offset-4 {\n margin-left: 33.33333333%;\n }\n .col-md-offset-3 {\n margin-left: 25%;\n }\n .col-md-offset-2 {\n margin-left: 16.66666667%;\n }\n .col-md-offset-1 {\n margin-left: 8.33333333%;\n }\n .col-md-offset-0 {\n margin-left: 0;\n }\n}\n@media (min-width: 1200px) {\n .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {\n float: left;\n }\n .col-lg-12 {\n width: 100%;\n }\n .col-lg-11 {\n width: 91.66666667%;\n }\n .col-lg-10 {\n width: 83.33333333%;\n }\n .col-lg-9 {\n width: 75%;\n }\n .col-lg-8 {\n width: 66.66666667%;\n }\n .col-lg-7 {\n width: 58.33333333%;\n }\n .col-lg-6 {\n width: 50%;\n }\n .col-lg-5 {\n width: 41.66666667%;\n }\n .col-lg-4 {\n width: 33.33333333%;\n }\n .col-lg-3 {\n width: 25%;\n }\n .col-lg-2 {\n width: 16.66666667%;\n }\n .col-lg-1 {\n width: 8.33333333%;\n }\n .col-lg-pull-12 {\n right: 100%;\n }\n .col-lg-pull-11 {\n right: 91.66666667%;\n }\n .col-lg-pull-10 {\n right: 83.33333333%;\n }\n .col-lg-pull-9 {\n right: 75%;\n }\n .col-lg-pull-8 {\n right: 66.66666667%;\n }\n .col-lg-pull-7 {\n right: 58.33333333%;\n }\n .col-lg-pull-6 {\n right: 50%;\n }\n .col-lg-pull-5 {\n right: 41.66666667%;\n }\n .col-lg-pull-4 {\n right: 33.33333333%;\n }\n .col-lg-pull-3 {\n right: 25%;\n }\n .col-lg-pull-2 {\n right: 16.66666667%;\n }\n .col-lg-pull-1 {\n right: 8.33333333%;\n }\n .col-lg-pull-0 {\n right: auto;\n }\n .col-lg-push-12 {\n left: 100%;\n }\n .col-lg-push-11 {\n left: 91.66666667%;\n }\n .col-lg-push-10 {\n left: 83.33333333%;\n }\n .col-lg-push-9 {\n left: 75%;\n }\n .col-lg-push-8 {\n left: 66.66666667%;\n }\n .col-lg-push-7 {\n left: 58.33333333%;\n }\n .col-lg-push-6 {\n left: 50%;\n }\n .col-lg-push-5 {\n left: 41.66666667%;\n }\n .col-lg-push-4 {\n left: 33.33333333%;\n }\n .col-lg-push-3 {\n left: 25%;\n }\n .col-lg-push-2 {\n left: 16.66666667%;\n }\n .col-lg-push-1 {\n left: 8.33333333%;\n }\n .col-lg-push-0 {\n left: auto;\n }\n .col-lg-offset-12 {\n margin-left: 100%;\n }\n .col-lg-offset-11 {\n margin-left: 91.66666667%;\n }\n .col-lg-offset-10 {\n margin-left: 83.33333333%;\n }\n .col-lg-offset-9 {\n margin-left: 75%;\n }\n .col-lg-offset-8 {\n margin-left: 66.66666667%;\n }\n .col-lg-offset-7 {\n margin-left: 58.33333333%;\n }\n .col-lg-offset-6 {\n margin-left: 50%;\n }\n .col-lg-offset-5 {\n margin-left: 41.66666667%;\n }\n .col-lg-offset-4 {\n margin-left: 33.33333333%;\n }\n .col-lg-offset-3 {\n margin-left: 25%;\n }\n .col-lg-offset-2 {\n margin-left: 16.66666667%;\n }\n .col-lg-offset-1 {\n margin-left: 8.33333333%;\n }\n .col-lg-offset-0 {\n margin-left: 0;\n }\n}\ntable {\n background-color: transparent;\n}\ncaption {\n padding-top: 8px;\n padding-bottom: 8px;\n color: #777;\n text-align: left;\n}\nth {\n text-align: left;\n}\n.table {\n width: 100%;\n max-width: 100%;\n margin-bottom: 20px;\n}\n.table > thead > tr > th,\n.table > tbody > tr > th,\n.table > tfoot > tr > th,\n.table > thead > tr > td,\n.table > tbody > tr > td,\n.table > tfoot > tr > td {\n padding: 8px;\n line-height: 1.42857143;\n vertical-align: top;\n border-top: 1px solid #ddd;\n}\n.table > thead > tr > th {\n vertical-align: bottom;\n border-bottom: 2px solid #ddd;\n}\n.table > caption + thead > tr:first-child > th,\n.table > colgroup + thead > tr:first-child > th,\n.table > thead:first-child > tr:first-child > th,\n.table > caption + thead > tr:first-child > td,\n.table > colgroup + thead > tr:first-child > td,\n.table > thead:first-child > tr:first-child > td {\n border-top: 0;\n}\n.table > tbody + tbody {\n border-top: 2px solid #ddd;\n}\n.table .table {\n background-color: #fff;\n}\n.table-condensed > thead > tr > th,\n.table-condensed > tbody > tr > th,\n.table-condensed > tfoot > tr > th,\n.table-condensed > thead > tr > td,\n.table-condensed > tbody > tr > td,\n.table-condensed > tfoot > tr > td {\n padding: 5px;\n}\n.table-bordered {\n border: 1px solid #ddd;\n}\n.table-bordered > thead > tr > th,\n.table-bordered > tbody > tr > th,\n.table-bordered > tfoot > tr > th,\n.table-bordered > thead > tr > td,\n.table-bordered > tbody > tr > td,\n.table-bordered > tfoot > tr > td {\n border: 1px solid #ddd;\n}\n.table-bordered > thead > tr > th,\n.table-bordered > thead > tr > td {\n border-bottom-width: 2px;\n}\n.table-striped > tbody > tr:nth-of-type(odd) {\n background-color: #f9f9f9;\n}\n.table-hover > tbody > tr:hover {\n background-color: #f5f5f5;\n}\ntable col[class*=\"col-\"] {\n position: static;\n display: table-column;\n float: none;\n}\ntable td[class*=\"col-\"],\ntable th[class*=\"col-\"] {\n position: static;\n display: table-cell;\n float: none;\n}\n.table > thead > tr > td.active,\n.table > tbody > tr > td.active,\n.table > tfoot > tr > td.active,\n.table > thead > tr > th.active,\n.table > tbody > tr > th.active,\n.table > tfoot > tr > th.active,\n.table > thead > tr.active > td,\n.table > tbody > tr.active > td,\n.table > tfoot > tr.active > td,\n.table > thead > tr.active > th,\n.table > tbody > tr.active > th,\n.table > tfoot > tr.active > th {\n background-color: #f5f5f5;\n}\n.table-hover > tbody > tr > td.active:hover,\n.table-hover > tbody > tr > th.active:hover,\n.table-hover > tbody > tr.active:hover > td,\n.table-hover > tbody > tr:hover > .active,\n.table-hover > tbody > tr.active:hover > th {\n background-color: #e8e8e8;\n}\n.table > thead > tr > td.success,\n.table > tbody > tr > td.success,\n.table > tfoot > tr > td.success,\n.table > thead > tr > th.success,\n.table > tbody > tr > th.success,\n.table > tfoot > tr > th.success,\n.table > thead > tr.success > td,\n.table > tbody > tr.success > td,\n.table > tfoot > tr.success > td,\n.table > thead > tr.success > th,\n.table > tbody > tr.success > th,\n.table > tfoot > tr.success > th {\n background-color: #dff0d8;\n}\n.table-hover > tbody > tr > td.success:hover,\n.table-hover > tbody > tr > th.success:hover,\n.table-hover > tbody > tr.success:hover > td,\n.table-hover > tbody > tr:hover > .success,\n.table-hover > tbody > tr.success:hover > th {\n background-color: #d0e9c6;\n}\n.table > thead > tr > td.info,\n.table > tbody > tr > td.info,\n.table > tfoot > tr > td.info,\n.table > thead > tr > th.info,\n.table > tbody > tr > th.info,\n.table > tfoot > tr > th.info,\n.table > thead > tr.info > td,\n.table > tbody > tr.info > td,\n.table > tfoot > tr.info > td,\n.table > thead > tr.info > th,\n.table > tbody > tr.info > th,\n.table > tfoot > tr.info > th {\n background-color: #d9edf7;\n}\n.table-hover > tbody > tr > td.info:hover,\n.table-hover > tbody > tr > th.info:hover,\n.table-hover > tbody > tr.info:hover > td,\n.table-hover > tbody > tr:hover > .info,\n.table-hover > tbody > tr.info:hover > th {\n background-color: #c4e3f3;\n}\n.table > thead > tr > td.warning,\n.table > tbody > tr > td.warning,\n.table > tfoot > tr > td.warning,\n.table > thead > tr > th.warning,\n.table > tbody > tr > th.warning,\n.table > tfoot > tr > th.warning,\n.table > thead > tr.warning > td,\n.table > tbody > tr.warning > td,\n.table > tfoot > tr.warning > td,\n.table > thead > tr.warning > th,\n.table > tbody > tr.warning > th,\n.table > tfoot > tr.warning > th {\n background-color: #fcf8e3;\n}\n.table-hover > tbody > tr > td.warning:hover,\n.table-hover > tbody > tr > th.warning:hover,\n.table-hover > tbody > tr.warning:hover > td,\n.table-hover > tbody > tr:hover > .warning,\n.table-hover > tbody > tr.warning:hover > th {\n background-color: #faf2cc;\n}\n.table > thead > tr > td.danger,\n.table > tbody > tr > td.danger,\n.table > tfoot > tr > td.danger,\n.table > thead > tr > th.danger,\n.table > tbody > tr > th.danger,\n.table > tfoot > tr > th.danger,\n.table > thead > tr.danger > td,\n.table > tbody > tr.danger > td,\n.table > tfoot > tr.danger > td,\n.table > thead > tr.danger > th,\n.table > tbody > tr.danger > th,\n.table > tfoot > tr.danger > th {\n background-color: #f2dede;\n}\n.table-hover > tbody > tr > td.danger:hover,\n.table-hover > tbody > tr > th.danger:hover,\n.table-hover > tbody > tr.danger:hover > td,\n.table-hover > tbody > tr:hover > .danger,\n.table-hover > tbody > tr.danger:hover > th {\n background-color: #ebcccc;\n}\n.table-responsive {\n min-height: .01%;\n overflow-x: auto;\n}\n@media screen and (max-width: 767px) {\n .table-responsive {\n width: 100%;\n margin-bottom: 15px;\n overflow-y: hidden;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n border: 1px solid #ddd;\n }\n .table-responsive > .table {\n margin-bottom: 0;\n }\n .table-responsive > .table > thead > tr > th,\n .table-responsive > .table > tbody > tr > th,\n .table-responsive > .table > tfoot > tr > th,\n .table-responsive > .table > thead > tr > td,\n .table-responsive > .table > tbody > tr > td,\n .table-responsive > .table > tfoot > tr > td {\n white-space: nowrap;\n }\n .table-responsive > .table-bordered {\n border: 0;\n }\n .table-responsive > .table-bordered > thead > tr > th:first-child,\n .table-responsive > .table-bordered > tbody > tr > th:first-child,\n .table-responsive > .table-bordered > tfoot > tr > th:first-child,\n .table-responsive > .table-bordered > thead > tr > td:first-child,\n .table-responsive > .table-bordered > tbody > tr > td:first-child,\n .table-responsive > .table-bordered > tfoot > tr > td:first-child {\n border-left: 0;\n }\n .table-responsive > .table-bordered > thead > tr > th:last-child,\n .table-responsive > .table-bordered > tbody > tr > th:last-child,\n .table-responsive > .table-bordered > tfoot > tr > th:last-child,\n .table-responsive > .table-bordered > thead > tr > td:last-child,\n .table-responsive > .table-bordered > tbody > tr > td:last-child,\n .table-responsive > .table-bordered > tfoot > tr > td:last-child {\n border-right: 0;\n }\n .table-responsive > .table-bordered > tbody > tr:last-child > th,\n .table-responsive > .table-bordered > tfoot > tr:last-child > th,\n .table-responsive > .table-bordered > tbody > tr:last-child > td,\n .table-responsive > .table-bordered > tfoot > tr:last-child > td {\n border-bottom: 0;\n }\n}\nfieldset {\n min-width: 0;\n padding: 0;\n margin: 0;\n border: 0;\n}\nlegend {\n display: block;\n width: 100%;\n padding: 0;\n margin-bottom: 20px;\n font-size: 21px;\n line-height: inherit;\n color: #333;\n border: 0;\n border-bottom: 1px solid #e5e5e5;\n}\nlabel {\n display: inline-block;\n max-width: 100%;\n margin-bottom: 5px;\n font-weight: bold;\n}\ninput[type=\"search\"] {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n margin: 4px 0 0;\n margin-top: 1px \\9;\n line-height: normal;\n}\ninput[type=\"file\"] {\n display: block;\n}\ninput[type=\"range\"] {\n display: block;\n width: 100%;\n}\nselect[multiple],\nselect[size] {\n height: auto;\n}\ninput[type=\"file\"]:focus,\ninput[type=\"radio\"]:focus,\ninput[type=\"checkbox\"]:focus {\n outline: 5px auto -webkit-focus-ring-color;\n outline-offset: -2px;\n}\noutput {\n display: block;\n padding-top: 7px;\n font-size: 14px;\n line-height: 1.42857143;\n color: #555;\n}\n.form-control {\n display: block;\n width: 100%;\n height: 34px;\n padding: 6px 12px;\n font-size: 14px;\n line-height: 1.42857143;\n color: #555;\n background-color: #fff;\n background-image: none;\n border: 1px solid #ccc;\n border-radius: 4px;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;\n -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\n transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\n}\n.form-control:focus {\n border-color: #66afe9;\n outline: 0;\n -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);\n box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);\n}\n.form-control::-moz-placeholder {\n color: #999;\n opacity: 1;\n}\n.form-control:-ms-input-placeholder {\n color: #999;\n}\n.form-control::-webkit-input-placeholder {\n color: #999;\n}\n.form-control::-ms-expand {\n background-color: transparent;\n border: 0;\n}\n.form-control[disabled],\n.form-control[readonly],\nfieldset[disabled] .form-control {\n background-color: #eee;\n opacity: 1;\n}\n.form-control[disabled],\nfieldset[disabled] .form-control {\n cursor: not-allowed;\n}\ntextarea.form-control {\n height: auto;\n}\ninput[type=\"search\"] {\n -webkit-appearance: none;\n}\n@media screen and (-webkit-min-device-pixel-ratio: 0) {\n input[type=\"date\"].form-control,\n input[type=\"time\"].form-control,\n input[type=\"datetime-local\"].form-control,\n input[type=\"month\"].form-control {\n line-height: 34px;\n }\n input[type=\"date\"].input-sm,\n input[type=\"time\"].input-sm,\n input[type=\"datetime-local\"].input-sm,\n input[type=\"month\"].input-sm,\n .input-group-sm input[type=\"date\"],\n .input-group-sm input[type=\"time\"],\n .input-group-sm input[type=\"datetime-local\"],\n .input-group-sm input[type=\"month\"] {\n line-height: 30px;\n }\n input[type=\"date\"].input-lg,\n input[type=\"time\"].input-lg,\n input[type=\"datetime-local\"].input-lg,\n input[type=\"month\"].input-lg,\n .input-group-lg input[type=\"date\"],\n .input-group-lg input[type=\"time\"],\n .input-group-lg input[type=\"datetime-local\"],\n .input-group-lg input[type=\"month\"] {\n line-height: 46px;\n }\n}\n.form-group {\n margin-bottom: 15px;\n}\n.radio,\n.checkbox {\n position: relative;\n display: block;\n margin-top: 10px;\n margin-bottom: 10px;\n}\n.radio label,\n.checkbox label {\n min-height: 20px;\n padding-left: 20px;\n margin-bottom: 0;\n font-weight: normal;\n cursor: pointer;\n}\n.radio input[type=\"radio\"],\n.radio-inline input[type=\"radio\"],\n.checkbox input[type=\"checkbox\"],\n.checkbox-inline input[type=\"checkbox\"] {\n position: absolute;\n margin-top: 4px \\9;\n margin-left: -20px;\n}\n.radio + .radio,\n.checkbox + .checkbox {\n margin-top: -5px;\n}\n.radio-inline,\n.checkbox-inline {\n position: relative;\n display: inline-block;\n padding-left: 20px;\n margin-bottom: 0;\n font-weight: normal;\n vertical-align: middle;\n cursor: pointer;\n}\n.radio-inline + .radio-inline,\n.checkbox-inline + .checkbox-inline {\n margin-top: 0;\n margin-left: 10px;\n}\ninput[type=\"radio\"][disabled],\ninput[type=\"checkbox\"][disabled],\ninput[type=\"radio\"].disabled,\ninput[type=\"checkbox\"].disabled,\nfieldset[disabled] input[type=\"radio\"],\nfieldset[disabled] input[type=\"checkbox\"] {\n cursor: not-allowed;\n}\n.radio-inline.disabled,\n.checkbox-inline.disabled,\nfieldset[disabled] .radio-inline,\nfieldset[disabled] .checkbox-inline {\n cursor: not-allowed;\n}\n.radio.disabled label,\n.checkbox.disabled label,\nfieldset[disabled] .radio label,\nfieldset[disabled] .checkbox label {\n cursor: not-allowed;\n}\n.form-control-static {\n min-height: 34px;\n padding-top: 7px;\n padding-bottom: 7px;\n margin-bottom: 0;\n}\n.form-control-static.input-lg,\n.form-control-static.input-sm {\n padding-right: 0;\n padding-left: 0;\n}\n.input-sm {\n height: 30px;\n padding: 5px 10px;\n font-size: 12px;\n line-height: 1.5;\n border-radius: 3px;\n}\nselect.input-sm {\n height: 30px;\n line-height: 30px;\n}\ntextarea.input-sm,\nselect[multiple].input-sm {\n height: auto;\n}\n.form-group-sm .form-control {\n height: 30px;\n padding: 5px 10px;\n font-size: 12px;\n line-height: 1.5;\n border-radius: 3px;\n}\n.form-group-sm select.form-control {\n height: 30px;\n line-height: 30px;\n}\n.form-group-sm textarea.form-control,\n.form-group-sm select[multiple].form-control {\n height: auto;\n}\n.form-group-sm .form-control-static {\n height: 30px;\n min-height: 32px;\n padding: 6px 10px;\n font-size: 12px;\n line-height: 1.5;\n}\n.input-lg {\n height: 46px;\n padding: 10px 16px;\n font-size: 18px;\n line-height: 1.3333333;\n border-radius: 6px;\n}\nselect.input-lg {\n height: 46px;\n line-height: 46px;\n}\ntextarea.input-lg,\nselect[multiple].input-lg {\n height: auto;\n}\n.form-group-lg .form-control {\n height: 46px;\n padding: 10px 16px;\n font-size: 18px;\n line-height: 1.3333333;\n border-radius: 6px;\n}\n.form-group-lg select.form-control {\n height: 46px;\n line-height: 46px;\n}\n.form-group-lg textarea.form-control,\n.form-group-lg select[multiple].form-control {\n height: auto;\n}\n.form-group-lg .form-control-static {\n height: 46px;\n min-height: 38px;\n padding: 11px 16px;\n font-size: 18px;\n line-height: 1.3333333;\n}\n.has-feedback {\n position: relative;\n}\n.has-feedback .form-control {\n padding-right: 42.5px;\n}\n.form-control-feedback {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 2;\n display: block;\n width: 34px;\n height: 34px;\n line-height: 34px;\n text-align: center;\n pointer-events: none;\n}\n.input-lg + .form-control-feedback,\n.input-group-lg + .form-control-feedback,\n.form-group-lg .form-control + .form-control-feedback {\n width: 46px;\n height: 46px;\n line-height: 46px;\n}\n.input-sm + .form-control-feedback,\n.input-group-sm + .form-control-feedback,\n.form-group-sm .form-control + .form-control-feedback {\n width: 30px;\n height: 30px;\n line-height: 30px;\n}\n.has-success .help-block,\n.has-success .control-label,\n.has-success .radio,\n.has-success .checkbox,\n.has-success .radio-inline,\n.has-success .checkbox-inline,\n.has-success.radio label,\n.has-success.checkbox label,\n.has-success.radio-inline label,\n.has-success.checkbox-inline label {\n color: #3c763d;\n}\n.has-success .form-control {\n border-color: #3c763d;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n}\n.has-success .form-control:focus {\n border-color: #2b542c;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;\n}\n.has-success .input-group-addon {\n color: #3c763d;\n background-color: #dff0d8;\n border-color: #3c763d;\n}\n.has-success .form-control-feedback {\n color: #3c763d;\n}\n.has-warning .help-block,\n.has-warning .control-label,\n.has-warning .radio,\n.has-warning .checkbox,\n.has-warning .radio-inline,\n.has-warning .checkbox-inline,\n.has-warning.radio label,\n.has-warning.checkbox label,\n.has-warning.radio-inline label,\n.has-warning.checkbox-inline label {\n color: #8a6d3b;\n}\n.has-warning .form-control {\n border-color: #8a6d3b;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n}\n.has-warning .form-control:focus {\n border-color: #66512c;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b;\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b;\n}\n.has-warning .input-group-addon {\n color: #8a6d3b;\n background-color: #fcf8e3;\n border-color: #8a6d3b;\n}\n.has-warning .form-control-feedback {\n color: #8a6d3b;\n}\n.has-error .help-block,\n.has-error .control-label,\n.has-error .radio,\n.has-error .checkbox,\n.has-error .radio-inline,\n.has-error .checkbox-inline,\n.has-error.radio label,\n.has-error.checkbox label,\n.has-error.radio-inline label,\n.has-error.checkbox-inline label {\n color: #a94442;\n}\n.has-error .form-control {\n border-color: #a94442;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n}\n.has-error .form-control:focus {\n border-color: #843534;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;\n}\n.has-error .input-group-addon {\n color: #a94442;\n background-color: #f2dede;\n border-color: #a94442;\n}\n.has-error .form-control-feedback {\n color: #a94442;\n}\n.has-feedback label ~ .form-control-feedback {\n top: 25px;\n}\n.has-feedback label.sr-only ~ .form-control-feedback {\n top: 0;\n}\n.help-block {\n display: block;\n margin-top: 5px;\n margin-bottom: 10px;\n color: #737373;\n}\n@media (min-width: 768px) {\n .form-inline .form-group {\n display: inline-block;\n margin-bottom: 0;\n vertical-align: middle;\n }\n .form-inline .form-control {\n display: inline-block;\n width: auto;\n vertical-align: middle;\n }\n .form-inline .form-control-static {\n display: inline-block;\n }\n .form-inline .input-group {\n display: inline-table;\n vertical-align: middle;\n }\n .form-inline .input-group .input-group-addon,\n .form-inline .input-group .input-group-btn,\n .form-inline .input-group .form-control {\n width: auto;\n }\n .form-inline .input-group > .form-control {\n width: 100%;\n }\n .form-inline .control-label {\n margin-bottom: 0;\n vertical-align: middle;\n }\n .form-inline .radio,\n .form-inline .checkbox {\n display: inline-block;\n margin-top: 0;\n margin-bottom: 0;\n vertical-align: middle;\n }\n .form-inline .radio label,\n .form-inline .checkbox label {\n padding-left: 0;\n }\n .form-inline .radio input[type=\"radio\"],\n .form-inline .checkbox input[type=\"checkbox\"] {\n position: relative;\n margin-left: 0;\n }\n .form-inline .has-feedback .form-control-feedback {\n top: 0;\n }\n}\n.form-horizontal .radio,\n.form-horizontal .checkbox,\n.form-horizontal .radio-inline,\n.form-horizontal .checkbox-inline {\n padding-top: 7px;\n margin-top: 0;\n margin-bottom: 0;\n}\n.form-horizontal .radio,\n.form-horizontal .checkbox {\n min-height: 27px;\n}\n.form-horizontal .form-group {\n margin-right: -15px;\n margin-left: -15px;\n}\n@media (min-width: 768px) {\n .form-horizontal .control-label {\n padding-top: 7px;\n margin-bottom: 0;\n text-align: right;\n }\n}\n.form-horizontal .has-feedback .form-control-feedback {\n right: 15px;\n}\n@media (min-width: 768px) {\n .form-horizontal .form-group-lg .control-label {\n padding-top: 11px;\n font-size: 18px;\n }\n}\n@media (min-width: 768px) {\n .form-horizontal .form-group-sm .control-label {\n padding-top: 6px;\n font-size: 12px;\n }\n}\n.btn {\n display: inline-block;\n padding: 6px 12px;\n margin-bottom: 0;\n font-size: 14px;\n font-weight: normal;\n line-height: 1.42857143;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 4px;\n}\n.btn:focus,\n.btn:active:focus,\n.btn.active:focus,\n.btn.focus,\n.btn:active.focus,\n.btn.active.focus {\n outline: 5px auto -webkit-focus-ring-color;\n outline-offset: -2px;\n}\n.btn:hover,\n.btn:focus,\n.btn.focus {\n color: #333;\n text-decoration: none;\n}\n.btn:active,\n.btn.active {\n background-image: none;\n outline: 0;\n -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);\n box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);\n}\n.btn.disabled,\n.btn[disabled],\nfieldset[disabled] .btn {\n cursor: not-allowed;\n filter: alpha(opacity=65);\n -webkit-box-shadow: none;\n box-shadow: none;\n opacity: .65;\n}\na.btn.disabled,\nfieldset[disabled] a.btn {\n pointer-events: none;\n}\n.btn-default {\n color: #333;\n background-color: #fff;\n border-color: #ccc;\n}\n.btn-default:focus,\n.btn-default.focus {\n color: #333;\n background-color: #e6e6e6;\n border-color: #8c8c8c;\n}\n.btn-default:hover {\n color: #333;\n background-color: #e6e6e6;\n border-color: #adadad;\n}\n.btn-default:active,\n.btn-default.active,\n.open > .dropdown-toggle.btn-default {\n color: #333;\n background-color: #e6e6e6;\n border-color: #adadad;\n}\n.btn-default:active:hover,\n.btn-default.active:hover,\n.open > .dropdown-toggle.btn-default:hover,\n.btn-default:active:focus,\n.btn-default.active:focus,\n.open > .dropdown-toggle.btn-default:focus,\n.btn-default:active.focus,\n.btn-default.active.focus,\n.open > .dropdown-toggle.btn-default.focus {\n color: #333;\n background-color: #d4d4d4;\n border-color: #8c8c8c;\n}\n.btn-default:active,\n.btn-default.active,\n.open > .dropdown-toggle.btn-default {\n background-image: none;\n}\n.btn-default.disabled:hover,\n.btn-default[disabled]:hover,\nfieldset[disabled] .btn-default:hover,\n.btn-default.disabled:focus,\n.btn-default[disabled]:focus,\nfieldset[disabled] .btn-default:focus,\n.btn-default.disabled.focus,\n.btn-default[disabled].focus,\nfieldset[disabled] .btn-default.focus {\n background-color: #fff;\n border-color: #ccc;\n}\n.btn-default .badge {\n color: #fff;\n background-color: #333;\n}\n.btn-primary {\n color: #fff;\n background-color: #337ab7;\n border-color: #2e6da4;\n}\n.btn-primary:focus,\n.btn-primary.focus {\n color: #fff;\n background-color: #286090;\n border-color: #122b40;\n}\n.btn-primary:hover {\n color: #fff;\n background-color: #286090;\n border-color: #204d74;\n}\n.btn-primary:active,\n.btn-primary.active,\n.open > .dropdown-toggle.btn-primary {\n color: #fff;\n background-color: #286090;\n border-color: #204d74;\n}\n.btn-primary:active:hover,\n.btn-primary.active:hover,\n.open > .dropdown-toggle.btn-primary:hover,\n.btn-primary:active:focus,\n.btn-primary.active:focus,\n.open > .dropdown-toggle.btn-primary:focus,\n.btn-primary:active.focus,\n.btn-primary.active.focus,\n.open > .dropdown-toggle.btn-primary.focus {\n color: #fff;\n background-color: #204d74;\n border-color: #122b40;\n}\n.btn-primary:active,\n.btn-primary.active,\n.open > .dropdown-toggle.btn-primary {\n background-image: none;\n}\n.btn-primary.disabled:hover,\n.btn-primary[disabled]:hover,\nfieldset[disabled] .btn-primary:hover,\n.btn-primary.disabled:focus,\n.btn-primary[disabled]:focus,\nfieldset[disabled] .btn-primary:focus,\n.btn-primary.disabled.focus,\n.btn-primary[disabled].focus,\nfieldset[disabled] .btn-primary.focus {\n background-color: #337ab7;\n border-color: #2e6da4;\n}\n.btn-primary .badge {\n color: #337ab7;\n background-color: #fff;\n}\n.btn-success {\n color: #fff;\n background-color: #5cb85c;\n border-color: #4cae4c;\n}\n.btn-success:focus,\n.btn-success.focus {\n color: #fff;\n background-color: #449d44;\n border-color: #255625;\n}\n.btn-success:hover {\n color: #fff;\n background-color: #449d44;\n border-color: #398439;\n}\n.btn-success:active,\n.btn-success.active,\n.open > .dropdown-toggle.btn-success {\n color: #fff;\n background-color: #449d44;\n border-color: #398439;\n}\n.btn-success:active:hover,\n.btn-success.active:hover,\n.open > .dropdown-toggle.btn-success:hover,\n.btn-success:active:focus,\n.btn-success.active:focus,\n.open > .dropdown-toggle.btn-success:focus,\n.btn-success:active.focus,\n.btn-success.active.focus,\n.open > .dropdown-toggle.btn-success.focus {\n color: #fff;\n background-color: #398439;\n border-color: #255625;\n}\n.btn-success:active,\n.btn-success.active,\n.open > .dropdown-toggle.btn-success {\n background-image: none;\n}\n.btn-success.disabled:hover,\n.btn-success[disabled]:hover,\nfieldset[disabled] .btn-success:hover,\n.btn-success.disabled:focus,\n.btn-success[disabled]:focus,\nfieldset[disabled] .btn-success:focus,\n.btn-success.disabled.focus,\n.btn-success[disabled].focus,\nfieldset[disabled] .btn-success.focus {\n background-color: #5cb85c;\n border-color: #4cae4c;\n}\n.btn-success .badge {\n color: #5cb85c;\n background-color: #fff;\n}\n.btn-info {\n color: #fff;\n background-color: #5bc0de;\n border-color: #46b8da;\n}\n.btn-info:focus,\n.btn-info.focus {\n color: #fff;\n background-color: #31b0d5;\n border-color: #1b6d85;\n}\n.btn-info:hover {\n color: #fff;\n background-color: #31b0d5;\n border-color: #269abc;\n}\n.btn-info:active,\n.btn-info.active,\n.open > .dropdown-toggle.btn-info {\n color: #fff;\n background-color: #31b0d5;\n border-color: #269abc;\n}\n.btn-info:active:hover,\n.btn-info.active:hover,\n.open > .dropdown-toggle.btn-info:hover,\n.btn-info:active:focus,\n.btn-info.active:focus,\n.open > .dropdown-toggle.btn-info:focus,\n.btn-info:active.focus,\n.btn-info.active.focus,\n.open > .dropdown-toggle.btn-info.focus {\n color: #fff;\n background-color: #269abc;\n border-color: #1b6d85;\n}\n.btn-info:active,\n.btn-info.active,\n.open > .dropdown-toggle.btn-info {\n background-image: none;\n}\n.btn-info.disabled:hover,\n.btn-info[disabled]:hover,\nfieldset[disabled] .btn-info:hover,\n.btn-info.disabled:focus,\n.btn-info[disabled]:focus,\nfieldset[disabled] .btn-info:focus,\n.btn-info.disabled.focus,\n.btn-info[disabled].focus,\nfieldset[disabled] .btn-info.focus {\n background-color: #5bc0de;\n border-color: #46b8da;\n}\n.btn-info .badge {\n color: #5bc0de;\n background-color: #fff;\n}\n.btn-warning {\n color: #fff;\n background-color: #f0ad4e;\n border-color: #eea236;\n}\n.btn-warning:focus,\n.btn-warning.focus {\n color: #fff;\n background-color: #ec971f;\n border-color: #985f0d;\n}\n.btn-warning:hover {\n color: #fff;\n background-color: #ec971f;\n border-color: #d58512;\n}\n.btn-warning:active,\n.btn-warning.active,\n.open > .dropdown-toggle.btn-warning {\n color: #fff;\n background-color: #ec971f;\n border-color: #d58512;\n}\n.btn-warning:active:hover,\n.btn-warning.active:hover,\n.open > .dropdown-toggle.btn-warning:hover,\n.btn-warning:active:focus,\n.btn-warning.active:focus,\n.open > .dropdown-toggle.btn-warning:focus,\n.btn-warning:active.focus,\n.btn-warning.active.focus,\n.open > .dropdown-toggle.btn-warning.focus {\n color: #fff;\n background-color: #d58512;\n border-color: #985f0d;\n}\n.btn-warning:active,\n.btn-warning.active,\n.open > .dropdown-toggle.btn-warning {\n background-image: none;\n}\n.btn-warning.disabled:hover,\n.btn-warning[disabled]:hover,\nfieldset[disabled] .btn-warning:hover,\n.btn-warning.disabled:focus,\n.btn-warning[disabled]:focus,\nfieldset[disabled] .btn-warning:focus,\n.btn-warning.disabled.focus,\n.btn-warning[disabled].focus,\nfieldset[disabled] .btn-warning.focus {\n background-color: #f0ad4e;\n border-color: #eea236;\n}\n.btn-warning .badge {\n color: #f0ad4e;\n background-color: #fff;\n}\n.btn-danger {\n color: #fff;\n background-color: #d9534f;\n border-color: #d43f3a;\n}\n.btn-danger:focus,\n.btn-danger.focus {\n color: #fff;\n background-color: #c9302c;\n border-color: #761c19;\n}\n.btn-danger:hover {\n color: #fff;\n background-color: #c9302c;\n border-color: #ac2925;\n}\n.btn-danger:active,\n.btn-danger.active,\n.open > .dropdown-toggle.btn-danger {\n color: #fff;\n background-color: #c9302c;\n border-color: #ac2925;\n}\n.btn-danger:active:hover,\n.btn-danger.active:hover,\n.open > .dropdown-toggle.btn-danger:hover,\n.btn-danger:active:focus,\n.btn-danger.active:focus,\n.open > .dropdown-toggle.btn-danger:focus,\n.btn-danger:active.focus,\n.btn-danger.active.focus,\n.open > .dropdown-toggle.btn-danger.focus {\n color: #fff;\n background-color: #ac2925;\n border-color: #761c19;\n}\n.btn-danger:active,\n.btn-danger.active,\n.open > .dropdown-toggle.btn-danger {\n background-image: none;\n}\n.btn-danger.disabled:hover,\n.btn-danger[disabled]:hover,\nfieldset[disabled] .btn-danger:hover,\n.btn-danger.disabled:focus,\n.btn-danger[disabled]:focus,\nfieldset[disabled] .btn-danger:focus,\n.btn-danger.disabled.focus,\n.btn-danger[disabled].focus,\nfieldset[disabled] .btn-danger.focus {\n background-color: #d9534f;\n border-color: #d43f3a;\n}\n.btn-danger .badge {\n color: #d9534f;\n background-color: #fff;\n}\n.btn-link {\n font-weight: normal;\n color: #337ab7;\n border-radius: 0;\n}\n.btn-link,\n.btn-link:active,\n.btn-link.active,\n.btn-link[disabled],\nfieldset[disabled] .btn-link {\n background-color: transparent;\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n.btn-link,\n.btn-link:hover,\n.btn-link:focus,\n.btn-link:active {\n border-color: transparent;\n}\n.btn-link:hover,\n.btn-link:focus {\n color: #23527c;\n text-decoration: underline;\n background-color: transparent;\n}\n.btn-link[disabled]:hover,\nfieldset[disabled] .btn-link:hover,\n.btn-link[disabled]:focus,\nfieldset[disabled] .btn-link:focus {\n color: #777;\n text-decoration: none;\n}\n.btn-lg,\n.btn-group-lg > .btn {\n padding: 10px 16px;\n font-size: 18px;\n line-height: 1.3333333;\n border-radius: 6px;\n}\n.btn-sm,\n.btn-group-sm > .btn {\n padding: 5px 10px;\n font-size: 12px;\n line-height: 1.5;\n border-radius: 3px;\n}\n.btn-xs,\n.btn-group-xs > .btn {\n padding: 1px 5px;\n font-size: 12px;\n line-height: 1.5;\n border-radius: 3px;\n}\n.btn-block {\n display: block;\n width: 100%;\n}\n.btn-block + .btn-block {\n margin-top: 5px;\n}\ninput[type=\"submit\"].btn-block,\ninput[type=\"reset\"].btn-block,\ninput[type=\"button\"].btn-block {\n width: 100%;\n}\n.fade {\n opacity: 0;\n -webkit-transition: opacity .15s linear;\n -o-transition: opacity .15s linear;\n transition: opacity .15s linear;\n}\n.fade.in {\n opacity: 1;\n}\n.collapse {\n display: none;\n}\n.collapse.in {\n display: block;\n}\ntr.collapse.in {\n display: table-row;\n}\ntbody.collapse.in {\n display: table-row-group;\n}\n.collapsing {\n position: relative;\n height: 0;\n overflow: hidden;\n -webkit-transition-timing-function: ease;\n -o-transition-timing-function: ease;\n transition-timing-function: ease;\n -webkit-transition-duration: .35s;\n -o-transition-duration: .35s;\n transition-duration: .35s;\n -webkit-transition-property: height, visibility;\n -o-transition-property: height, visibility;\n transition-property: height, visibility;\n}\n.caret {\n display: inline-block;\n width: 0;\n height: 0;\n margin-left: 2px;\n vertical-align: middle;\n border-top: 4px dashed;\n border-top: 4px solid \\9;\n border-right: 4px solid transparent;\n border-left: 4px solid transparent;\n}\n.dropup,\n.dropdown {\n position: relative;\n}\n.dropdown-toggle:focus {\n outline: 0;\n}\n.dropdown-menu {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 1000;\n display: none;\n float: left;\n min-width: 160px;\n padding: 5px 0;\n margin: 2px 0 0;\n font-size: 14px;\n text-align: left;\n list-style: none;\n background-color: #fff;\n -webkit-background-clip: padding-box;\n background-clip: padding-box;\n border: 1px solid #ccc;\n border: 1px solid rgba(0, 0, 0, .15);\n border-radius: 4px;\n -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);\n box-shadow: 0 6px 12px rgba(0, 0, 0, .175);\n}\n.dropdown-menu.pull-right {\n right: 0;\n left: auto;\n}\n.dropdown-menu .divider {\n height: 1px;\n margin: 9px 0;\n overflow: hidden;\n background-color: #e5e5e5;\n}\n.dropdown-menu > li > a {\n display: block;\n padding: 3px 20px;\n clear: both;\n font-weight: normal;\n line-height: 1.42857143;\n color: #333;\n white-space: nowrap;\n}\n.dropdown-menu > li > a:hover,\n.dropdown-menu > li > a:focus {\n color: #262626;\n text-decoration: none;\n background-color: #f5f5f5;\n}\n.dropdown-menu > .active > a,\n.dropdown-menu > .active > a:hover,\n.dropdown-menu > .active > a:focus {\n color: #fff;\n text-decoration: none;\n background-color: #337ab7;\n outline: 0;\n}\n.dropdown-menu > .disabled > a,\n.dropdown-menu > .disabled > a:hover,\n.dropdown-menu > .disabled > a:focus {\n color: #777;\n}\n.dropdown-menu > .disabled > a:hover,\n.dropdown-menu > .disabled > a:focus {\n text-decoration: none;\n cursor: not-allowed;\n background-color: transparent;\n background-image: none;\n filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);\n}\n.open > .dropdown-menu {\n display: block;\n}\n.open > a {\n outline: 0;\n}\n.dropdown-menu-right {\n right: 0;\n left: auto;\n}\n.dropdown-menu-left {\n right: auto;\n left: 0;\n}\n.dropdown-header {\n display: block;\n padding: 3px 20px;\n font-size: 12px;\n line-height: 1.42857143;\n color: #777;\n white-space: nowrap;\n}\n.dropdown-backdrop {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 990;\n}\n.pull-right > .dropdown-menu {\n right: 0;\n left: auto;\n}\n.dropup .caret,\n.navbar-fixed-bottom .dropdown .caret {\n content: \"\";\n border-top: 0;\n border-bottom: 4px dashed;\n border-bottom: 4px solid \\9;\n}\n.dropup .dropdown-menu,\n.navbar-fixed-bottom .dropdown .dropdown-menu {\n top: auto;\n bottom: 100%;\n margin-bottom: 2px;\n}\n@media (min-width: 768px) {\n .navbar-right .dropdown-menu {\n right: 0;\n left: auto;\n }\n .navbar-right .dropdown-menu-left {\n right: auto;\n left: 0;\n }\n}\n.btn-group,\n.btn-group-vertical {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n}\n.btn-group > .btn,\n.btn-group-vertical > .btn {\n position: relative;\n float: left;\n}\n.btn-group > .btn:hover,\n.btn-group-vertical > .btn:hover,\n.btn-group > .btn:focus,\n.btn-group-vertical > .btn:focus,\n.btn-group > .btn:active,\n.btn-group-vertical > .btn:active,\n.btn-group > .btn.active,\n.btn-group-vertical > .btn.active {\n z-index: 2;\n}\n.btn-group .btn + .btn,\n.btn-group .btn + .btn-group,\n.btn-group .btn-group + .btn,\n.btn-group .btn-group + .btn-group {\n margin-left: -1px;\n}\n.btn-toolbar {\n margin-left: -5px;\n}\n.btn-toolbar .btn,\n.btn-toolbar .btn-group,\n.btn-toolbar .input-group {\n float: left;\n}\n.btn-toolbar > .btn,\n.btn-toolbar > .btn-group,\n.btn-toolbar > .input-group {\n margin-left: 5px;\n}\n.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {\n border-radius: 0;\n}\n.btn-group > .btn:first-child {\n margin-left: 0;\n}\n.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.btn-group > .btn:last-child:not(:first-child),\n.btn-group > .dropdown-toggle:not(:first-child) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.btn-group > .btn-group {\n float: left;\n}\n.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {\n border-radius: 0;\n}\n.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child,\n.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.btn-group .dropdown-toggle:active,\n.btn-group.open .dropdown-toggle {\n outline: 0;\n}\n.btn-group > .btn + .dropdown-toggle {\n padding-right: 8px;\n padding-left: 8px;\n}\n.btn-group > .btn-lg + .dropdown-toggle {\n padding-right: 12px;\n padding-left: 12px;\n}\n.btn-group.open .dropdown-toggle {\n -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);\n box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);\n}\n.btn-group.open .dropdown-toggle.btn-link {\n -webkit-box-shadow: none;\n box-shadow: none;\n}\n.btn .caret {\n margin-left: 0;\n}\n.btn-lg .caret {\n border-width: 5px 5px 0;\n border-bottom-width: 0;\n}\n.dropup .btn-lg .caret {\n border-width: 0 5px 5px;\n}\n.btn-group-vertical > .btn,\n.btn-group-vertical > .btn-group,\n.btn-group-vertical > .btn-group > .btn {\n display: block;\n float: none;\n width: 100%;\n max-width: 100%;\n}\n.btn-group-vertical > .btn-group > .btn {\n float: none;\n}\n.btn-group-vertical > .btn + .btn,\n.btn-group-vertical > .btn + .btn-group,\n.btn-group-vertical > .btn-group + .btn,\n.btn-group-vertical > .btn-group + .btn-group {\n margin-top: -1px;\n margin-left: 0;\n}\n.btn-group-vertical > .btn:not(:first-child):not(:last-child) {\n border-radius: 0;\n}\n.btn-group-vertical > .btn:first-child:not(:last-child) {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n}\n.btn-group-vertical > .btn:last-child:not(:first-child) {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {\n border-radius: 0;\n}\n.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child,\n.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle {\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n}\n.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n.btn-group-justified {\n display: table;\n width: 100%;\n table-layout: fixed;\n border-collapse: separate;\n}\n.btn-group-justified > .btn,\n.btn-group-justified > .btn-group {\n display: table-cell;\n float: none;\n width: 1%;\n}\n.btn-group-justified > .btn-group .btn {\n width: 100%;\n}\n.btn-group-justified > .btn-group .dropdown-menu {\n left: auto;\n}\n[data-toggle=\"buttons\"] > .btn input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .btn-group > .btn input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .btn input[type=\"checkbox\"],\n[data-toggle=\"buttons\"] > .btn-group > .btn input[type=\"checkbox\"] {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n pointer-events: none;\n}\n.input-group {\n position: relative;\n display: table;\n border-collapse: separate;\n}\n.input-group[class*=\"col-\"] {\n float: none;\n padding-right: 0;\n padding-left: 0;\n}\n.input-group .form-control {\n position: relative;\n z-index: 2;\n float: left;\n width: 100%;\n margin-bottom: 0;\n}\n.input-group .form-control:focus {\n z-index: 3;\n}\n.input-group-lg > .form-control,\n.input-group-lg > .input-group-addon,\n.input-group-lg > .input-group-btn > .btn {\n height: 46px;\n padding: 10px 16px;\n font-size: 18px;\n line-height: 1.3333333;\n border-radius: 6px;\n}\nselect.input-group-lg > .form-control,\nselect.input-group-lg > .input-group-addon,\nselect.input-group-lg > .input-group-btn > .btn {\n height: 46px;\n line-height: 46px;\n}\ntextarea.input-group-lg > .form-control,\ntextarea.input-group-lg > .input-group-addon,\ntextarea.input-group-lg > .input-group-btn > .btn,\nselect[multiple].input-group-lg > .form-control,\nselect[multiple].input-group-lg > .input-group-addon,\nselect[multiple].input-group-lg > .input-group-btn > .btn {\n height: auto;\n}\n.input-group-sm > .form-control,\n.input-group-sm > .input-group-addon,\n.input-group-sm > .input-group-btn > .btn {\n height: 30px;\n padding: 5px 10px;\n font-size: 12px;\n line-height: 1.5;\n border-radius: 3px;\n}\nselect.input-group-sm > .form-control,\nselect.input-group-sm > .input-group-addon,\nselect.input-group-sm > .input-group-btn > .btn {\n height: 30px;\n line-height: 30px;\n}\ntextarea.input-group-sm > .form-control,\ntextarea.input-group-sm > .input-group-addon,\ntextarea.input-group-sm > .input-group-btn > .btn,\nselect[multiple].input-group-sm > .form-control,\nselect[multiple].input-group-sm > .input-group-addon,\nselect[multiple].input-group-sm > .input-group-btn > .btn {\n height: auto;\n}\n.input-group-addon,\n.input-group-btn,\n.input-group .form-control {\n display: table-cell;\n}\n.input-group-addon:not(:first-child):not(:last-child),\n.input-group-btn:not(:first-child):not(:last-child),\n.input-group .form-control:not(:first-child):not(:last-child) {\n border-radius: 0;\n}\n.input-group-addon,\n.input-group-btn {\n width: 1%;\n white-space: nowrap;\n vertical-align: middle;\n}\n.input-group-addon {\n padding: 6px 12px;\n font-size: 14px;\n font-weight: normal;\n line-height: 1;\n color: #555;\n text-align: center;\n background-color: #eee;\n border: 1px solid #ccc;\n border-radius: 4px;\n}\n.input-group-addon.input-sm {\n padding: 5px 10px;\n font-size: 12px;\n border-radius: 3px;\n}\n.input-group-addon.input-lg {\n padding: 10px 16px;\n font-size: 18px;\n border-radius: 6px;\n}\n.input-group-addon input[type=\"radio\"],\n.input-group-addon input[type=\"checkbox\"] {\n margin-top: 0;\n}\n.input-group .form-control:first-child,\n.input-group-addon:first-child,\n.input-group-btn:first-child > .btn,\n.input-group-btn:first-child > .btn-group > .btn,\n.input-group-btn:first-child > .dropdown-toggle,\n.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),\n.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.input-group-addon:first-child {\n border-right: 0;\n}\n.input-group .form-control:last-child,\n.input-group-addon:last-child,\n.input-group-btn:last-child > .btn,\n.input-group-btn:last-child > .btn-group > .btn,\n.input-group-btn:last-child > .dropdown-toggle,\n.input-group-btn:first-child > .btn:not(:first-child),\n.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.input-group-addon:last-child {\n border-left: 0;\n}\n.input-group-btn {\n position: relative;\n font-size: 0;\n white-space: nowrap;\n}\n.input-group-btn > .btn {\n position: relative;\n}\n.input-group-btn > .btn + .btn {\n margin-left: -1px;\n}\n.input-group-btn > .btn:hover,\n.input-group-btn > .btn:focus,\n.input-group-btn > .btn:active {\n z-index: 2;\n}\n.input-group-btn:first-child > .btn,\n.input-group-btn:first-child > .btn-group {\n margin-right: -1px;\n}\n.input-group-btn:last-child > .btn,\n.input-group-btn:last-child > .btn-group {\n z-index: 2;\n margin-left: -1px;\n}\n.nav {\n padding-left: 0;\n margin-bottom: 0;\n list-style: none;\n}\n.nav > li {\n position: relative;\n display: block;\n}\n.nav > li > a {\n position: relative;\n display: block;\n padding: 10px 15px;\n}\n.nav > li > a:hover,\n.nav > li > a:focus {\n text-decoration: none;\n background-color: #eee;\n}\n.nav > li.disabled > a {\n color: #777;\n}\n.nav > li.disabled > a:hover,\n.nav > li.disabled > a:focus {\n color: #777;\n text-decoration: none;\n cursor: not-allowed;\n background-color: transparent;\n}\n.nav .open > a,\n.nav .open > a:hover,\n.nav .open > a:focus {\n background-color: #eee;\n border-color: #337ab7;\n}\n.nav .nav-divider {\n height: 1px;\n margin: 9px 0;\n overflow: hidden;\n background-color: #e5e5e5;\n}\n.nav > li > a > img {\n max-width: none;\n}\n.nav-tabs {\n border-bottom: 1px solid #ddd;\n}\n.nav-tabs > li {\n float: left;\n margin-bottom: -1px;\n}\n.nav-tabs > li > a {\n margin-right: 2px;\n line-height: 1.42857143;\n border: 1px solid transparent;\n border-radius: 4px 4px 0 0;\n}\n.nav-tabs > li > a:hover {\n border-color: #eee #eee #ddd;\n}\n.nav-tabs > li.active > a,\n.nav-tabs > li.active > a:hover,\n.nav-tabs > li.active > a:focus {\n color: #555;\n cursor: default;\n background-color: #fff;\n border: 1px solid #ddd;\n border-bottom-color: transparent;\n}\n.nav-tabs.nav-justified {\n width: 100%;\n border-bottom: 0;\n}\n.nav-tabs.nav-justified > li {\n float: none;\n}\n.nav-tabs.nav-justified > li > a {\n margin-bottom: 5px;\n text-align: center;\n}\n.nav-tabs.nav-justified > .dropdown .dropdown-menu {\n top: auto;\n left: auto;\n}\n@media (min-width: 768px) {\n .nav-tabs.nav-justified > li {\n display: table-cell;\n width: 1%;\n }\n .nav-tabs.nav-justified > li > a {\n margin-bottom: 0;\n }\n}\n.nav-tabs.nav-justified > li > a {\n margin-right: 0;\n border-radius: 4px;\n}\n.nav-tabs.nav-justified > .active > a,\n.nav-tabs.nav-justified > .active > a:hover,\n.nav-tabs.nav-justified > .active > a:focus {\n border: 1px solid #ddd;\n}\n@media (min-width: 768px) {\n .nav-tabs.nav-justified > li > a {\n border-bottom: 1px solid #ddd;\n border-radius: 4px 4px 0 0;\n }\n .nav-tabs.nav-justified > .active > a,\n .nav-tabs.nav-justified > .active > a:hover,\n .nav-tabs.nav-justified > .active > a:focus {\n border-bottom-color: #fff;\n }\n}\n.nav-pills > li {\n float: left;\n}\n.nav-pills > li > a {\n border-radius: 4px;\n}\n.nav-pills > li + li {\n margin-left: 2px;\n}\n.nav-pills > li.active > a,\n.nav-pills > li.active > a:hover,\n.nav-pills > li.active > a:focus {\n color: #fff;\n background-color: #337ab7;\n}\n.nav-stacked > li {\n float: none;\n}\n.nav-stacked > li + li {\n margin-top: 2px;\n margin-left: 0;\n}\n.nav-justified {\n width: 100%;\n}\n.nav-justified > li {\n float: none;\n}\n.nav-justified > li > a {\n margin-bottom: 5px;\n text-align: center;\n}\n.nav-justified > .dropdown .dropdown-menu {\n top: auto;\n left: auto;\n}\n@media (min-width: 768px) {\n .nav-justified > li {\n display: table-cell;\n width: 1%;\n }\n .nav-justified > li > a {\n margin-bottom: 0;\n }\n}\n.nav-tabs-justified {\n border-bottom: 0;\n}\n.nav-tabs-justified > li > a {\n margin-right: 0;\n border-radius: 4px;\n}\n.nav-tabs-justified > .active > a,\n.nav-tabs-justified > .active > a:hover,\n.nav-tabs-justified > .active > a:focus {\n border: 1px solid #ddd;\n}\n@media (min-width: 768px) {\n .nav-tabs-justified > li > a {\n border-bottom: 1px solid #ddd;\n border-radius: 4px 4px 0 0;\n }\n .nav-tabs-justified > .active > a,\n .nav-tabs-justified > .active > a:hover,\n .nav-tabs-justified > .active > a:focus {\n border-bottom-color: #fff;\n }\n}\n.tab-content > .tab-pane {\n display: none;\n}\n.tab-content > .active {\n display: block;\n}\n.nav-tabs .dropdown-menu {\n margin-top: -1px;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n.navbar {\n position: relative;\n min-height: 50px;\n margin-bottom: 20px;\n border: 1px solid transparent;\n}\n@media (min-width: 768px) {\n .navbar {\n border-radius: 4px;\n }\n}\n@media (min-width: 768px) {\n .navbar-header {\n float: left;\n }\n}\n.navbar-collapse {\n padding-right: 15px;\n padding-left: 15px;\n overflow-x: visible;\n -webkit-overflow-scrolling: touch;\n border-top: 1px solid transparent;\n -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);\n box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);\n}\n.navbar-collapse.in {\n overflow-y: auto;\n}\n@media (min-width: 768px) {\n .navbar-collapse {\n width: auto;\n border-top: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n }\n .navbar-collapse.collapse {\n display: block !important;\n height: auto !important;\n padding-bottom: 0;\n overflow: visible !important;\n }\n .navbar-collapse.in {\n overflow-y: visible;\n }\n .navbar-fixed-top .navbar-collapse,\n .navbar-static-top .navbar-collapse,\n .navbar-fixed-bottom .navbar-collapse {\n padding-right: 0;\n padding-left: 0;\n }\n}\n.navbar-fixed-top .navbar-collapse,\n.navbar-fixed-bottom .navbar-collapse {\n max-height: 340px;\n}\n@media (max-device-width: 480px) and (orientation: landscape) {\n .navbar-fixed-top .navbar-collapse,\n .navbar-fixed-bottom .navbar-collapse {\n max-height: 200px;\n }\n}\n.container > .navbar-header,\n.container-fluid > .navbar-header,\n.container > .navbar-collapse,\n.container-fluid > .navbar-collapse {\n margin-right: -15px;\n margin-left: -15px;\n}\n@media (min-width: 768px) {\n .container > .navbar-header,\n .container-fluid > .navbar-header,\n .container > .navbar-collapse,\n .container-fluid > .navbar-collapse {\n margin-right: 0;\n margin-left: 0;\n }\n}\n.navbar-static-top {\n z-index: 1000;\n border-width: 0 0 1px;\n}\n@media (min-width: 768px) {\n .navbar-static-top {\n border-radius: 0;\n }\n}\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n position: fixed;\n right: 0;\n left: 0;\n z-index: 1030;\n}\n@media (min-width: 768px) {\n .navbar-fixed-top,\n .navbar-fixed-bottom {\n border-radius: 0;\n }\n}\n.navbar-fixed-top {\n top: 0;\n border-width: 0 0 1px;\n}\n.navbar-fixed-bottom {\n bottom: 0;\n margin-bottom: 0;\n border-width: 1px 0 0;\n}\n.navbar-brand {\n float: left;\n height: 50px;\n padding: 15px 15px;\n font-size: 18px;\n line-height: 20px;\n}\n.navbar-brand:hover,\n.navbar-brand:focus {\n text-decoration: none;\n}\n.navbar-brand > img {\n display: block;\n}\n@media (min-width: 768px) {\n .navbar > .container .navbar-brand,\n .navbar > .container-fluid .navbar-brand {\n margin-left: -15px;\n }\n}\n.navbar-toggle {\n position: relative;\n float: right;\n padding: 9px 10px;\n margin-top: 8px;\n margin-right: 15px;\n margin-bottom: 8px;\n background-color: transparent;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 4px;\n}\n.navbar-toggle:focus {\n outline: 0;\n}\n.navbar-toggle .icon-bar {\n display: block;\n width: 22px;\n height: 2px;\n border-radius: 1px;\n}\n.navbar-toggle .icon-bar + .icon-bar {\n margin-top: 4px;\n}\n@media (min-width: 768px) {\n .navbar-toggle {\n display: none;\n }\n}\n.navbar-nav {\n margin: 7.5px -15px;\n}\n.navbar-nav > li > a {\n padding-top: 10px;\n padding-bottom: 10px;\n line-height: 20px;\n}\n@media (max-width: 767px) {\n .navbar-nav .open .dropdown-menu {\n position: static;\n float: none;\n width: auto;\n margin-top: 0;\n background-color: transparent;\n border: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n }\n .navbar-nav .open .dropdown-menu > li > a,\n .navbar-nav .open .dropdown-menu .dropdown-header {\n padding: 5px 15px 5px 25px;\n }\n .navbar-nav .open .dropdown-menu > li > a {\n line-height: 20px;\n }\n .navbar-nav .open .dropdown-menu > li > a:hover,\n .navbar-nav .open .dropdown-menu > li > a:focus {\n background-image: none;\n }\n}\n@media (min-width: 768px) {\n .navbar-nav {\n float: left;\n margin: 0;\n }\n .navbar-nav > li {\n float: left;\n }\n .navbar-nav > li > a {\n padding-top: 15px;\n padding-bottom: 15px;\n }\n}\n.navbar-form {\n padding: 10px 15px;\n margin-top: 8px;\n margin-right: -15px;\n margin-bottom: 8px;\n margin-left: -15px;\n border-top: 1px solid transparent;\n border-bottom: 1px solid transparent;\n -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);\n box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);\n}\n@media (min-width: 768px) {\n .navbar-form .form-group {\n display: inline-block;\n margin-bottom: 0;\n vertical-align: middle;\n }\n .navbar-form .form-control {\n display: inline-block;\n width: auto;\n vertical-align: middle;\n }\n .navbar-form .form-control-static {\n display: inline-block;\n }\n .navbar-form .input-group {\n display: inline-table;\n vertical-align: middle;\n }\n .navbar-form .input-group .input-group-addon,\n .navbar-form .input-group .input-group-btn,\n .navbar-form .input-group .form-control {\n width: auto;\n }\n .navbar-form .input-group > .form-control {\n width: 100%;\n }\n .navbar-form .control-label {\n margin-bottom: 0;\n vertical-align: middle;\n }\n .navbar-form .radio,\n .navbar-form .checkbox {\n display: inline-block;\n margin-top: 0;\n margin-bottom: 0;\n vertical-align: middle;\n }\n .navbar-form .radio label,\n .navbar-form .checkbox label {\n padding-left: 0;\n }\n .navbar-form .radio input[type=\"radio\"],\n .navbar-form .checkbox input[type=\"checkbox\"] {\n position: relative;\n margin-left: 0;\n }\n .navbar-form .has-feedback .form-control-feedback {\n top: 0;\n }\n}\n@media (max-width: 767px) {\n .navbar-form .form-group {\n margin-bottom: 5px;\n }\n .navbar-form .form-group:last-child {\n margin-bottom: 0;\n }\n}\n@media (min-width: 768px) {\n .navbar-form {\n width: auto;\n padding-top: 0;\n padding-bottom: 0;\n margin-right: 0;\n margin-left: 0;\n border: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n }\n}\n.navbar-nav > li > .dropdown-menu {\n margin-top: 0;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {\n margin-bottom: 0;\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n}\n.navbar-btn {\n margin-top: 8px;\n margin-bottom: 8px;\n}\n.navbar-btn.btn-sm {\n margin-top: 10px;\n margin-bottom: 10px;\n}\n.navbar-btn.btn-xs {\n margin-top: 14px;\n margin-bottom: 14px;\n}\n.navbar-text {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n@media (min-width: 768px) {\n .navbar-text {\n float: left;\n margin-right: 15px;\n margin-left: 15px;\n }\n}\n@media (min-width: 768px) {\n .navbar-left {\n float: left !important;\n }\n .navbar-right {\n float: right !important;\n margin-right: -15px;\n }\n .navbar-right ~ .navbar-right {\n margin-right: 0;\n }\n}\n.navbar-default {\n background-color: #f8f8f8;\n border-color: #e7e7e7;\n}\n.navbar-default .navbar-brand {\n color: #777;\n}\n.navbar-default .navbar-brand:hover,\n.navbar-default .navbar-brand:focus {\n color: #5e5e5e;\n background-color: transparent;\n}\n.navbar-default .navbar-text {\n color: #777;\n}\n.navbar-default .navbar-nav > li > a {\n color: #777;\n}\n.navbar-default .navbar-nav > li > a:hover,\n.navbar-default .navbar-nav > li > a:focus {\n color: #333;\n background-color: transparent;\n}\n.navbar-default .navbar-nav > .active > a,\n.navbar-default .navbar-nav > .active > a:hover,\n.navbar-default .navbar-nav > .active > a:focus {\n color: #555;\n background-color: #e7e7e7;\n}\n.navbar-default .navbar-nav > .disabled > a,\n.navbar-default .navbar-nav > .disabled > a:hover,\n.navbar-default .navbar-nav > .disabled > a:focus {\n color: #ccc;\n background-color: transparent;\n}\n.navbar-default .navbar-toggle {\n border-color: #ddd;\n}\n.navbar-default .navbar-toggle:hover,\n.navbar-default .navbar-toggle:focus {\n background-color: #ddd;\n}\n.navbar-default .navbar-toggle .icon-bar {\n background-color: #888;\n}\n.navbar-default .navbar-collapse,\n.navbar-default .navbar-form {\n border-color: #e7e7e7;\n}\n.navbar-default .navbar-nav > .open > a,\n.navbar-default .navbar-nav > .open > a:hover,\n.navbar-default .navbar-nav > .open > a:focus {\n color: #555;\n background-color: #e7e7e7;\n}\n@media (max-width: 767px) {\n .navbar-default .navbar-nav .open .dropdown-menu > li > a {\n color: #777;\n }\n .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,\n .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {\n color: #333;\n background-color: transparent;\n }\n .navbar-default .navbar-nav .open .dropdown-menu > .active > a,\n .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,\n .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {\n color: #555;\n background-color: #e7e7e7;\n }\n .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a,\n .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover,\n .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus {\n color: #ccc;\n background-color: transparent;\n }\n}\n.navbar-default .navbar-link {\n color: #777;\n}\n.navbar-default .navbar-link:hover {\n color: #333;\n}\n.navbar-default .btn-link {\n color: #777;\n}\n.navbar-default .btn-link:hover,\n.navbar-default .btn-link:focus {\n color: #333;\n}\n.navbar-default .btn-link[disabled]:hover,\nfieldset[disabled] .navbar-default .btn-link:hover,\n.navbar-default .btn-link[disabled]:focus,\nfieldset[disabled] .navbar-default .btn-link:focus {\n color: #ccc;\n}\n.navbar-inverse {\n background-color: #222;\n border-color: #080808;\n}\n.navbar-inverse .navbar-brand {\n color: #9d9d9d;\n}\n.navbar-inverse .navbar-brand:hover,\n.navbar-inverse .navbar-brand:focus {\n color: #fff;\n background-color: transparent;\n}\n.navbar-inverse .navbar-text {\n color: #9d9d9d;\n}\n.navbar-inverse .navbar-nav > li > a {\n color: #9d9d9d;\n}\n.navbar-inverse .navbar-nav > li > a:hover,\n.navbar-inverse .navbar-nav > li > a:focus {\n color: #fff;\n background-color: transparent;\n}\n.navbar-inverse .navbar-nav > .active > a,\n.navbar-inverse .navbar-nav > .active > a:hover,\n.navbar-inverse .navbar-nav > .active > a:focus {\n color: #fff;\n background-color: #080808;\n}\n.navbar-inverse .navbar-nav > .disabled > a,\n.navbar-inverse .navbar-nav > .disabled > a:hover,\n.navbar-inverse .navbar-nav > .disabled > a:focus {\n color: #444;\n background-color: transparent;\n}\n.navbar-inverse .navbar-toggle {\n border-color: #333;\n}\n.navbar-inverse .navbar-toggle:hover,\n.navbar-inverse .navbar-toggle:focus {\n background-color: #333;\n}\n.navbar-inverse .navbar-toggle .icon-bar {\n background-color: #fff;\n}\n.navbar-inverse .navbar-collapse,\n.navbar-inverse .navbar-form {\n border-color: #101010;\n}\n.navbar-inverse .navbar-nav > .open > a,\n.navbar-inverse .navbar-nav > .open > a:hover,\n.navbar-inverse .navbar-nav > .open > a:focus {\n color: #fff;\n background-color: #080808;\n}\n@media (max-width: 767px) {\n .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {\n border-color: #080808;\n }\n .navbar-inverse .navbar-nav .open .dropdown-menu .divider {\n background-color: #080808;\n }\n .navbar-inverse .navbar-nav .open .dropdown-menu > li > a {\n color: #9d9d9d;\n }\n .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover,\n .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus {\n color: #fff;\n background-color: transparent;\n }\n .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a,\n .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover,\n .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {\n color: #fff;\n background-color: #080808;\n }\n .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a,\n .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover,\n .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus {\n color: #444;\n background-color: transparent;\n }\n}\n.navbar-inverse .navbar-link {\n color: #9d9d9d;\n}\n.navbar-inverse .navbar-link:hover {\n color: #fff;\n}\n.navbar-inverse .btn-link {\n color: #9d9d9d;\n}\n.navbar-inverse .btn-link:hover,\n.navbar-inverse .btn-link:focus {\n color: #fff;\n}\n.navbar-inverse .btn-link[disabled]:hover,\nfieldset[disabled] .navbar-inverse .btn-link:hover,\n.navbar-inverse .btn-link[disabled]:focus,\nfieldset[disabled] .navbar-inverse .btn-link:focus {\n color: #444;\n}\n.breadcrumb {\n padding: 8px 15px;\n margin-bottom: 20px;\n list-style: none;\n background-color: #f5f5f5;\n border-radius: 4px;\n}\n.breadcrumb > li {\n display: inline-block;\n}\n.breadcrumb > li + li:before {\n padding: 0 5px;\n color: #ccc;\n content: \"/\\00a0\";\n}\n.breadcrumb > .active {\n color: #777;\n}\n.pagination {\n display: inline-block;\n padding-left: 0;\n margin: 20px 0;\n border-radius: 4px;\n}\n.pagination > li {\n display: inline;\n}\n.pagination > li > a,\n.pagination > li > span {\n position: relative;\n float: left;\n padding: 6px 12px;\n margin-left: -1px;\n line-height: 1.42857143;\n color: #337ab7;\n text-decoration: none;\n background-color: #fff;\n border: 1px solid #ddd;\n}\n.pagination > li:first-child > a,\n.pagination > li:first-child > span {\n margin-left: 0;\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.pagination > li:last-child > a,\n.pagination > li:last-child > span {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n.pagination > li > a:hover,\n.pagination > li > span:hover,\n.pagination > li > a:focus,\n.pagination > li > span:focus {\n z-index: 2;\n color: #23527c;\n background-color: #eee;\n border-color: #ddd;\n}\n.pagination > .active > a,\n.pagination > .active > span,\n.pagination > .active > a:hover,\n.pagination > .active > span:hover,\n.pagination > .active > a:focus,\n.pagination > .active > span:focus {\n z-index: 3;\n color: #fff;\n cursor: default;\n background-color: #337ab7;\n border-color: #337ab7;\n}\n.pagination > .disabled > span,\n.pagination > .disabled > span:hover,\n.pagination > .disabled > span:focus,\n.pagination > .disabled > a,\n.pagination > .disabled > a:hover,\n.pagination > .disabled > a:focus {\n color: #777;\n cursor: not-allowed;\n background-color: #fff;\n border-color: #ddd;\n}\n.pagination-lg > li > a,\n.pagination-lg > li > span {\n padding: 10px 16px;\n font-size: 18px;\n line-height: 1.3333333;\n}\n.pagination-lg > li:first-child > a,\n.pagination-lg > li:first-child > span {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n}\n.pagination-lg > li:last-child > a,\n.pagination-lg > li:last-child > span {\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n}\n.pagination-sm > li > a,\n.pagination-sm > li > span {\n padding: 5px 10px;\n font-size: 12px;\n line-height: 1.5;\n}\n.pagination-sm > li:first-child > a,\n.pagination-sm > li:first-child > span {\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n}\n.pagination-sm > li:last-child > a,\n.pagination-sm > li:last-child > span {\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n}\n.pager {\n padding-left: 0;\n margin: 20px 0;\n text-align: center;\n list-style: none;\n}\n.pager li {\n display: inline;\n}\n.pager li > a,\n.pager li > span {\n display: inline-block;\n padding: 5px 14px;\n background-color: #fff;\n border: 1px solid #ddd;\n border-radius: 15px;\n}\n.pager li > a:hover,\n.pager li > a:focus {\n text-decoration: none;\n background-color: #eee;\n}\n.pager .next > a,\n.pager .next > span {\n float: right;\n}\n.pager .previous > a,\n.pager .previous > span {\n float: left;\n}\n.pager .disabled > a,\n.pager .disabled > a:hover,\n.pager .disabled > a:focus,\n.pager .disabled > span {\n color: #777;\n cursor: not-allowed;\n background-color: #fff;\n}\n.label {\n display: inline;\n padding: .2em .6em .3em;\n font-size: 75%;\n font-weight: bold;\n line-height: 1;\n color: #fff;\n text-align: center;\n white-space: nowrap;\n vertical-align: baseline;\n border-radius: .25em;\n}\na.label:hover,\na.label:focus {\n color: #fff;\n text-decoration: none;\n cursor: pointer;\n}\n.label:empty {\n display: none;\n}\n.btn .label {\n position: relative;\n top: -1px;\n}\n.label-default {\n background-color: #777;\n}\n.label-default[href]:hover,\n.label-default[href]:focus {\n background-color: #5e5e5e;\n}\n.label-primary {\n background-color: #337ab7;\n}\n.label-primary[href]:hover,\n.label-primary[href]:focus {\n background-color: #286090;\n}\n.label-success {\n background-color: #5cb85c;\n}\n.label-success[href]:hover,\n.label-success[href]:focus {\n background-color: #449d44;\n}\n.label-info {\n background-color: #5bc0de;\n}\n.label-info[href]:hover,\n.label-info[href]:focus {\n background-color: #31b0d5;\n}\n.label-warning {\n background-color: #f0ad4e;\n}\n.label-warning[href]:hover,\n.label-warning[href]:focus {\n background-color: #ec971f;\n}\n.label-danger {\n background-color: #d9534f;\n}\n.label-danger[href]:hover,\n.label-danger[href]:focus {\n background-color: #c9302c;\n}\n.badge {\n display: inline-block;\n min-width: 10px;\n padding: 3px 7px;\n font-size: 12px;\n font-weight: bold;\n line-height: 1;\n color: #fff;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n background-color: #777;\n border-radius: 10px;\n}\n.badge:empty {\n display: none;\n}\n.btn .badge {\n position: relative;\n top: -1px;\n}\n.btn-xs .badge,\n.btn-group-xs > .btn .badge {\n top: 0;\n padding: 1px 5px;\n}\na.badge:hover,\na.badge:focus {\n color: #fff;\n text-decoration: none;\n cursor: pointer;\n}\n.list-group-item.active > .badge,\n.nav-pills > .active > a > .badge {\n color: #337ab7;\n background-color: #fff;\n}\n.list-group-item > .badge {\n float: right;\n}\n.list-group-item > .badge + .badge {\n margin-right: 5px;\n}\n.nav-pills > li > a > .badge {\n margin-left: 3px;\n}\n.jumbotron {\n padding-top: 30px;\n padding-bottom: 30px;\n margin-bottom: 30px;\n color: inherit;\n background-color: #eee;\n}\n.jumbotron h1,\n.jumbotron .h1 {\n color: inherit;\n}\n.jumbotron p {\n margin-bottom: 15px;\n font-size: 21px;\n font-weight: 200;\n}\n.jumbotron > hr {\n border-top-color: #d5d5d5;\n}\n.container .jumbotron,\n.container-fluid .jumbotron {\n padding-right: 15px;\n padding-left: 15px;\n border-radius: 6px;\n}\n.jumbotron .container {\n max-width: 100%;\n}\n@media screen and (min-width: 768px) {\n .jumbotron {\n padding-top: 48px;\n padding-bottom: 48px;\n }\n .container .jumbotron,\n .container-fluid .jumbotron {\n padding-right: 60px;\n padding-left: 60px;\n }\n .jumbotron h1,\n .jumbotron .h1 {\n font-size: 63px;\n }\n}\n.thumbnail {\n display: block;\n padding: 4px;\n margin-bottom: 20px;\n line-height: 1.42857143;\n background-color: #fff;\n border: 1px solid #ddd;\n border-radius: 4px;\n -webkit-transition: border .2s ease-in-out;\n -o-transition: border .2s ease-in-out;\n transition: border .2s ease-in-out;\n}\n.thumbnail > img,\n.thumbnail a > img {\n margin-right: auto;\n margin-left: auto;\n}\na.thumbnail:hover,\na.thumbnail:focus,\na.thumbnail.active {\n border-color: #337ab7;\n}\n.thumbnail .caption {\n padding: 9px;\n color: #333;\n}\n.alert {\n padding: 15px;\n margin-bottom: 20px;\n border: 1px solid transparent;\n border-radius: 4px;\n}\n.alert h4 {\n margin-top: 0;\n color: inherit;\n}\n.alert .alert-link {\n font-weight: bold;\n}\n.alert > p,\n.alert > ul {\n margin-bottom: 0;\n}\n.alert > p + p {\n margin-top: 5px;\n}\n.alert-dismissable,\n.alert-dismissible {\n padding-right: 35px;\n}\n.alert-dismissable .close,\n.alert-dismissible .close {\n position: relative;\n top: -2px;\n right: -21px;\n color: inherit;\n}\n.alert-success {\n color: #3c763d;\n background-color: #dff0d8;\n border-color: #d6e9c6;\n}\n.alert-success hr {\n border-top-color: #c9e2b3;\n}\n.alert-success .alert-link {\n color: #2b542c;\n}\n.alert-info {\n color: #31708f;\n background-color: #d9edf7;\n border-color: #bce8f1;\n}\n.alert-info hr {\n border-top-color: #a6e1ec;\n}\n.alert-info .alert-link {\n color: #245269;\n}\n.alert-warning {\n color: #8a6d3b;\n background-color: #fcf8e3;\n border-color: #faebcc;\n}\n.alert-warning hr {\n border-top-color: #f7e1b5;\n}\n.alert-warning .alert-link {\n color: #66512c;\n}\n.alert-danger {\n color: #a94442;\n background-color: #f2dede;\n border-color: #ebccd1;\n}\n.alert-danger hr {\n border-top-color: #e4b9c0;\n}\n.alert-danger .alert-link {\n color: #843534;\n}\n@-webkit-keyframes progress-bar-stripes {\n from {\n background-position: 40px 0;\n }\n to {\n background-position: 0 0;\n }\n}\n@-o-keyframes progress-bar-stripes {\n from {\n background-position: 40px 0;\n }\n to {\n background-position: 0 0;\n }\n}\n@keyframes progress-bar-stripes {\n from {\n background-position: 40px 0;\n }\n to {\n background-position: 0 0;\n }\n}\n.progress {\n height: 20px;\n margin-bottom: 20px;\n overflow: hidden;\n background-color: #f5f5f5;\n border-radius: 4px;\n -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);\n box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);\n}\n.progress-bar {\n float: left;\n width: 0;\n height: 100%;\n font-size: 12px;\n line-height: 20px;\n color: #fff;\n text-align: center;\n background-color: #337ab7;\n -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);\n box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);\n -webkit-transition: width .6s ease;\n -o-transition: width .6s ease;\n transition: width .6s ease;\n}\n.progress-striped .progress-bar,\n.progress-bar-striped {\n background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n -webkit-background-size: 40px 40px;\n background-size: 40px 40px;\n}\n.progress.active .progress-bar,\n.progress-bar.active {\n -webkit-animation: progress-bar-stripes 2s linear infinite;\n -o-animation: progress-bar-stripes 2s linear infinite;\n animation: progress-bar-stripes 2s linear infinite;\n}\n.progress-bar-success {\n background-color: #5cb85c;\n}\n.progress-striped .progress-bar-success {\n background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n}\n.progress-bar-info {\n background-color: #5bc0de;\n}\n.progress-striped .progress-bar-info {\n background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n}\n.progress-bar-warning {\n background-color: #f0ad4e;\n}\n.progress-striped .progress-bar-warning {\n background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n}\n.progress-bar-danger {\n background-color: #d9534f;\n}\n.progress-striped .progress-bar-danger {\n background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n}\n.media {\n margin-top: 15px;\n}\n.media:first-child {\n margin-top: 0;\n}\n.media,\n.media-body {\n overflow: hidden;\n zoom: 1;\n}\n.media-body {\n width: 10000px;\n}\n.media-object {\n display: block;\n}\n.media-object.img-thumbnail {\n max-width: none;\n}\n.media-right,\n.media > .pull-right {\n padding-left: 10px;\n}\n.media-left,\n.media > .pull-left {\n padding-right: 10px;\n}\n.media-left,\n.media-right,\n.media-body {\n display: table-cell;\n vertical-align: top;\n}\n.media-middle {\n vertical-align: middle;\n}\n.media-bottom {\n vertical-align: bottom;\n}\n.media-heading {\n margin-top: 0;\n margin-bottom: 5px;\n}\n.media-list {\n padding-left: 0;\n list-style: none;\n}\n.list-group {\n padding-left: 0;\n margin-bottom: 20px;\n}\n.list-group-item {\n position: relative;\n display: block;\n padding: 10px 15px;\n margin-bottom: -1px;\n background-color: #fff;\n border: 1px solid #ddd;\n}\n.list-group-item:first-child {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n}\n.list-group-item:last-child {\n margin-bottom: 0;\n border-bottom-right-radius: 4px;\n border-bottom-left-radius: 4px;\n}\na.list-group-item,\nbutton.list-group-item {\n color: #555;\n}\na.list-group-item .list-group-item-heading,\nbutton.list-group-item .list-group-item-heading {\n color: #333;\n}\na.list-group-item:hover,\nbutton.list-group-item:hover,\na.list-group-item:focus,\nbutton.list-group-item:focus {\n color: #555;\n text-decoration: none;\n background-color: #f5f5f5;\n}\nbutton.list-group-item {\n width: 100%;\n text-align: left;\n}\n.list-group-item.disabled,\n.list-group-item.disabled:hover,\n.list-group-item.disabled:focus {\n color: #777;\n cursor: not-allowed;\n background-color: #eee;\n}\n.list-group-item.disabled .list-group-item-heading,\n.list-group-item.disabled:hover .list-group-item-heading,\n.list-group-item.disabled:focus .list-group-item-heading {\n color: inherit;\n}\n.list-group-item.disabled .list-group-item-text,\n.list-group-item.disabled:hover .list-group-item-text,\n.list-group-item.disabled:focus .list-group-item-text {\n color: #777;\n}\n.list-group-item.active,\n.list-group-item.active:hover,\n.list-group-item.active:focus {\n z-index: 2;\n color: #fff;\n background-color: #337ab7;\n border-color: #337ab7;\n}\n.list-group-item.active .list-group-item-heading,\n.list-group-item.active:hover .list-group-item-heading,\n.list-group-item.active:focus .list-group-item-heading,\n.list-group-item.active .list-group-item-heading > small,\n.list-group-item.active:hover .list-group-item-heading > small,\n.list-group-item.active:focus .list-group-item-heading > small,\n.list-group-item.active .list-group-item-heading > .small,\n.list-group-item.active:hover .list-group-item-heading > .small,\n.list-group-item.active:focus .list-group-item-heading > .small {\n color: inherit;\n}\n.list-group-item.active .list-group-item-text,\n.list-group-item.active:hover .list-group-item-text,\n.list-group-item.active:focus .list-group-item-text {\n color: #c7ddef;\n}\n.list-group-item-success {\n color: #3c763d;\n background-color: #dff0d8;\n}\na.list-group-item-success,\nbutton.list-group-item-success {\n color: #3c763d;\n}\na.list-group-item-success .list-group-item-heading,\nbutton.list-group-item-success .list-group-item-heading {\n color: inherit;\n}\na.list-group-item-success:hover,\nbutton.list-group-item-success:hover,\na.list-group-item-success:focus,\nbutton.list-group-item-success:focus {\n color: #3c763d;\n background-color: #d0e9c6;\n}\na.list-group-item-success.active,\nbutton.list-group-item-success.active,\na.list-group-item-success.active:hover,\nbutton.list-group-item-success.active:hover,\na.list-group-item-success.active:focus,\nbutton.list-group-item-success.active:focus {\n color: #fff;\n background-color: #3c763d;\n border-color: #3c763d;\n}\n.list-group-item-info {\n color: #31708f;\n background-color: #d9edf7;\n}\na.list-group-item-info,\nbutton.list-group-item-info {\n color: #31708f;\n}\na.list-group-item-info .list-group-item-heading,\nbutton.list-group-item-info .list-group-item-heading {\n color: inherit;\n}\na.list-group-item-info:hover,\nbutton.list-group-item-info:hover,\na.list-group-item-info:focus,\nbutton.list-group-item-info:focus {\n color: #31708f;\n background-color: #c4e3f3;\n}\na.list-group-item-info.active,\nbutton.list-group-item-info.active,\na.list-group-item-info.active:hover,\nbutton.list-group-item-info.active:hover,\na.list-group-item-info.active:focus,\nbutton.list-group-item-info.active:focus {\n color: #fff;\n background-color: #31708f;\n border-color: #31708f;\n}\n.list-group-item-warning {\n color: #8a6d3b;\n background-color: #fcf8e3;\n}\na.list-group-item-warning,\nbutton.list-group-item-warning {\n color: #8a6d3b;\n}\na.list-group-item-warning .list-group-item-heading,\nbutton.list-group-item-warning .list-group-item-heading {\n color: inherit;\n}\na.list-group-item-warning:hover,\nbutton.list-group-item-warning:hover,\na.list-group-item-warning:focus,\nbutton.list-group-item-warning:focus {\n color: #8a6d3b;\n background-color: #faf2cc;\n}\na.list-group-item-warning.active,\nbutton.list-group-item-warning.active,\na.list-group-item-warning.active:hover,\nbutton.list-group-item-warning.active:hover,\na.list-group-item-warning.active:focus,\nbutton.list-group-item-warning.active:focus {\n color: #fff;\n background-color: #8a6d3b;\n border-color: #8a6d3b;\n}\n.list-group-item-danger {\n color: #a94442;\n background-color: #f2dede;\n}\na.list-group-item-danger,\nbutton.list-group-item-danger {\n color: #a94442;\n}\na.list-group-item-danger .list-group-item-heading,\nbutton.list-group-item-danger .list-group-item-heading {\n color: inherit;\n}\na.list-group-item-danger:hover,\nbutton.list-group-item-danger:hover,\na.list-group-item-danger:focus,\nbutton.list-group-item-danger:focus {\n color: #a94442;\n background-color: #ebcccc;\n}\na.list-group-item-danger.active,\nbutton.list-group-item-danger.active,\na.list-group-item-danger.active:hover,\nbutton.list-group-item-danger.active:hover,\na.list-group-item-danger.active:focus,\nbutton.list-group-item-danger.active:focus {\n color: #fff;\n background-color: #a94442;\n border-color: #a94442;\n}\n.list-group-item-heading {\n margin-top: 0;\n margin-bottom: 5px;\n}\n.list-group-item-text {\n margin-bottom: 0;\n line-height: 1.3;\n}\n.panel {\n margin-bottom: 20px;\n background-color: #fff;\n border: 1px solid transparent;\n border-radius: 4px;\n -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);\n box-shadow: 0 1px 1px rgba(0, 0, 0, .05);\n}\n.panel-body {\n padding: 15px;\n}\n.panel-heading {\n padding: 10px 15px;\n border-bottom: 1px solid transparent;\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n}\n.panel-heading > .dropdown .dropdown-toggle {\n color: inherit;\n}\n.panel-title {\n margin-top: 0;\n margin-bottom: 0;\n font-size: 16px;\n color: inherit;\n}\n.panel-title > a,\n.panel-title > small,\n.panel-title > .small,\n.panel-title > small > a,\n.panel-title > .small > a {\n color: inherit;\n}\n.panel-footer {\n padding: 10px 15px;\n background-color: #f5f5f5;\n border-top: 1px solid #ddd;\n border-bottom-right-radius: 3px;\n border-bottom-left-radius: 3px;\n}\n.panel > .list-group,\n.panel > .panel-collapse > .list-group {\n margin-bottom: 0;\n}\n.panel > .list-group .list-group-item,\n.panel > .panel-collapse > .list-group .list-group-item {\n border-width: 1px 0;\n border-radius: 0;\n}\n.panel > .list-group:first-child .list-group-item:first-child,\n.panel > .panel-collapse > .list-group:first-child .list-group-item:first-child {\n border-top: 0;\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n}\n.panel > .list-group:last-child .list-group-item:last-child,\n.panel > .panel-collapse > .list-group:last-child .list-group-item:last-child {\n border-bottom: 0;\n border-bottom-right-radius: 3px;\n border-bottom-left-radius: 3px;\n}\n.panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n.panel-heading + .list-group .list-group-item:first-child {\n border-top-width: 0;\n}\n.list-group + .panel-footer {\n border-top-width: 0;\n}\n.panel > .table,\n.panel > .table-responsive > .table,\n.panel > .panel-collapse > .table {\n margin-bottom: 0;\n}\n.panel > .table caption,\n.panel > .table-responsive > .table caption,\n.panel > .panel-collapse > .table caption {\n padding-right: 15px;\n padding-left: 15px;\n}\n.panel > .table:first-child,\n.panel > .table-responsive:first-child > .table:first-child {\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n}\n.panel > .table:first-child > thead:first-child > tr:first-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child {\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n}\n.panel > .table:first-child > thead:first-child > tr:first-child td:first-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,\n.panel > .table:first-child > thead:first-child > tr:first-child th:first-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child {\n border-top-left-radius: 3px;\n}\n.panel > .table:first-child > thead:first-child > tr:first-child td:last-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,\n.panel > .table:first-child > thead:first-child > tr:first-child th:last-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child {\n border-top-right-radius: 3px;\n}\n.panel > .table:last-child,\n.panel > .table-responsive:last-child > .table:last-child {\n border-bottom-right-radius: 3px;\n border-bottom-left-radius: 3px;\n}\n.panel > .table:last-child > tbody:last-child > tr:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child {\n border-bottom-right-radius: 3px;\n border-bottom-left-radius: 3px;\n}\n.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,\n.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child {\n border-bottom-left-radius: 3px;\n}\n.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,\n.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child {\n border-bottom-right-radius: 3px;\n}\n.panel > .panel-body + .table,\n.panel > .panel-body + .table-responsive,\n.panel > .table + .panel-body,\n.panel > .table-responsive + .panel-body {\n border-top: 1px solid #ddd;\n}\n.panel > .table > tbody:first-child > tr:first-child th,\n.panel > .table > tbody:first-child > tr:first-child td {\n border-top: 0;\n}\n.panel > .table-bordered,\n.panel > .table-responsive > .table-bordered {\n border: 0;\n}\n.panel > .table-bordered > thead > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > thead > tr > th:first-child,\n.panel > .table-bordered > tbody > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,\n.panel > .table-bordered > tfoot > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,\n.panel > .table-bordered > thead > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > thead > tr > td:first-child,\n.panel > .table-bordered > tbody > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,\n.panel > .table-bordered > tfoot > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child {\n border-left: 0;\n}\n.panel > .table-bordered > thead > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > thead > tr > th:last-child,\n.panel > .table-bordered > tbody > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,\n.panel > .table-bordered > tfoot > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,\n.panel > .table-bordered > thead > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > thead > tr > td:last-child,\n.panel > .table-bordered > tbody > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,\n.panel > .table-bordered > tfoot > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child {\n border-right: 0;\n}\n.panel > .table-bordered > thead > tr:first-child > td,\n.panel > .table-responsive > .table-bordered > thead > tr:first-child > td,\n.panel > .table-bordered > tbody > tr:first-child > td,\n.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td,\n.panel > .table-bordered > thead > tr:first-child > th,\n.panel > .table-responsive > .table-bordered > thead > tr:first-child > th,\n.panel > .table-bordered > tbody > tr:first-child > th,\n.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th {\n border-bottom: 0;\n}\n.panel > .table-bordered > tbody > tr:last-child > td,\n.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,\n.panel > .table-bordered > tfoot > tr:last-child > td,\n.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td,\n.panel > .table-bordered > tbody > tr:last-child > th,\n.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,\n.panel > .table-bordered > tfoot > tr:last-child > th,\n.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th {\n border-bottom: 0;\n}\n.panel > .table-responsive {\n margin-bottom: 0;\n border: 0;\n}\n.panel-group {\n margin-bottom: 20px;\n}\n.panel-group .panel {\n margin-bottom: 0;\n border-radius: 4px;\n}\n.panel-group .panel + .panel {\n margin-top: 5px;\n}\n.panel-group .panel-heading {\n border-bottom: 0;\n}\n.panel-group .panel-heading + .panel-collapse > .panel-body,\n.panel-group .panel-heading + .panel-collapse > .list-group {\n border-top: 1px solid #ddd;\n}\n.panel-group .panel-footer {\n border-top: 0;\n}\n.panel-group .panel-footer + .panel-collapse .panel-body {\n border-bottom: 1px solid #ddd;\n}\n.panel-default {\n border-color: #ddd;\n}\n.panel-default > .panel-heading {\n color: #333;\n background-color: #f5f5f5;\n border-color: #ddd;\n}\n.panel-default > .panel-heading + .panel-collapse > .panel-body {\n border-top-color: #ddd;\n}\n.panel-default > .panel-heading .badge {\n color: #f5f5f5;\n background-color: #333;\n}\n.panel-default > .panel-footer + .panel-collapse > .panel-body {\n border-bottom-color: #ddd;\n}\n.panel-primary {\n border-color: #337ab7;\n}\n.panel-primary > .panel-heading {\n color: #fff;\n background-color: #337ab7;\n border-color: #337ab7;\n}\n.panel-primary > .panel-heading + .panel-collapse > .panel-body {\n border-top-color: #337ab7;\n}\n.panel-primary > .panel-heading .badge {\n color: #337ab7;\n background-color: #fff;\n}\n.panel-primary > .panel-footer + .panel-collapse > .panel-body {\n border-bottom-color: #337ab7;\n}\n.panel-success {\n border-color: #d6e9c6;\n}\n.panel-success > .panel-heading {\n color: #3c763d;\n background-color: #dff0d8;\n border-color: #d6e9c6;\n}\n.panel-success > .panel-heading + .panel-collapse > .panel-body {\n border-top-color: #d6e9c6;\n}\n.panel-success > .panel-heading .badge {\n color: #dff0d8;\n background-color: #3c763d;\n}\n.panel-success > .panel-footer + .panel-collapse > .panel-body {\n border-bottom-color: #d6e9c6;\n}\n.panel-info {\n border-color: #bce8f1;\n}\n.panel-info > .panel-heading {\n color: #31708f;\n background-color: #d9edf7;\n border-color: #bce8f1;\n}\n.panel-info > .panel-heading + .panel-collapse > .panel-body {\n border-top-color: #bce8f1;\n}\n.panel-info > .panel-heading .badge {\n color: #d9edf7;\n background-color: #31708f;\n}\n.panel-info > .panel-footer + .panel-collapse > .panel-body {\n border-bottom-color: #bce8f1;\n}\n.panel-warning {\n border-color: #faebcc;\n}\n.panel-warning > .panel-heading {\n color: #8a6d3b;\n background-color: #fcf8e3;\n border-color: #faebcc;\n}\n.panel-warning > .panel-heading + .panel-collapse > .panel-body {\n border-top-color: #faebcc;\n}\n.panel-warning > .panel-heading .badge {\n color: #fcf8e3;\n background-color: #8a6d3b;\n}\n.panel-warning > .panel-footer + .panel-collapse > .panel-body {\n border-bottom-color: #faebcc;\n}\n.panel-danger {\n border-color: #ebccd1;\n}\n.panel-danger > .panel-heading {\n color: #a94442;\n background-color: #f2dede;\n border-color: #ebccd1;\n}\n.panel-danger > .panel-heading + .panel-collapse > .panel-body {\n border-top-color: #ebccd1;\n}\n.panel-danger > .panel-heading .badge {\n color: #f2dede;\n background-color: #a94442;\n}\n.panel-danger > .panel-footer + .panel-collapse > .panel-body {\n border-bottom-color: #ebccd1;\n}\n.embed-responsive {\n position: relative;\n display: block;\n height: 0;\n padding: 0;\n overflow: hidden;\n}\n.embed-responsive .embed-responsive-item,\n.embed-responsive iframe,\n.embed-responsive embed,\n.embed-responsive object,\n.embed-responsive video {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 0;\n}\n.embed-responsive-16by9 {\n padding-bottom: 56.25%;\n}\n.embed-responsive-4by3 {\n padding-bottom: 75%;\n}\n.well {\n min-height: 20px;\n padding: 19px;\n margin-bottom: 20px;\n background-color: #f5f5f5;\n border: 1px solid #e3e3e3;\n border-radius: 4px;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);\n}\n.well blockquote {\n border-color: #ddd;\n border-color: rgba(0, 0, 0, .15);\n}\n.well-lg {\n padding: 24px;\n border-radius: 6px;\n}\n.well-sm {\n padding: 9px;\n border-radius: 3px;\n}\n.close {\n float: right;\n font-size: 21px;\n font-weight: bold;\n line-height: 1;\n color: #000;\n text-shadow: 0 1px 0 #fff;\n filter: alpha(opacity=20);\n opacity: .2;\n}\n.close:hover,\n.close:focus {\n color: #000;\n text-decoration: none;\n cursor: pointer;\n filter: alpha(opacity=50);\n opacity: .5;\n}\nbutton.close {\n -webkit-appearance: none;\n padding: 0;\n cursor: pointer;\n background: transparent;\n border: 0;\n}\n.modal-open {\n overflow: hidden;\n}\n.modal {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 1050;\n display: none;\n overflow: hidden;\n -webkit-overflow-scrolling: touch;\n outline: 0;\n}\n.modal.fade .modal-dialog {\n -webkit-transition: -webkit-transform .3s ease-out;\n -o-transition: -o-transform .3s ease-out;\n transition: transform .3s ease-out;\n -webkit-transform: translate(0, -25%);\n -ms-transform: translate(0, -25%);\n -o-transform: translate(0, -25%);\n transform: translate(0, -25%);\n}\n.modal.in .modal-dialog {\n -webkit-transform: translate(0, 0);\n -ms-transform: translate(0, 0);\n -o-transform: translate(0, 0);\n transform: translate(0, 0);\n}\n.modal-open .modal {\n overflow-x: hidden;\n overflow-y: auto;\n}\n.modal-dialog {\n position: relative;\n width: auto;\n margin: 10px;\n}\n.modal-content {\n position: relative;\n background-color: #fff;\n -webkit-background-clip: padding-box;\n background-clip: padding-box;\n border: 1px solid #999;\n border: 1px solid rgba(0, 0, 0, .2);\n border-radius: 6px;\n outline: 0;\n -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5);\n box-shadow: 0 3px 9px rgba(0, 0, 0, .5);\n}\n.modal-backdrop {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 1040;\n background-color: #000;\n}\n.modal-backdrop.fade {\n filter: alpha(opacity=0);\n opacity: 0;\n}\n.modal-backdrop.in {\n filter: alpha(opacity=50);\n opacity: .5;\n}\n.modal-header {\n padding: 15px;\n border-bottom: 1px solid #e5e5e5;\n}\n.modal-header .close {\n margin-top: -2px;\n}\n.modal-title {\n margin: 0;\n line-height: 1.42857143;\n}\n.modal-body {\n position: relative;\n padding: 15px;\n}\n.modal-footer {\n padding: 15px;\n text-align: right;\n border-top: 1px solid #e5e5e5;\n}\n.modal-footer .btn + .btn {\n margin-bottom: 0;\n margin-left: 5px;\n}\n.modal-footer .btn-group .btn + .btn {\n margin-left: -1px;\n}\n.modal-footer .btn-block + .btn-block {\n margin-left: 0;\n}\n.modal-scrollbar-measure {\n position: absolute;\n top: -9999px;\n width: 50px;\n height: 50px;\n overflow: scroll;\n}\n@media (min-width: 768px) {\n .modal-dialog {\n width: 600px;\n margin: 30px auto;\n }\n .modal-content {\n -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);\n box-shadow: 0 5px 15px rgba(0, 0, 0, .5);\n }\n .modal-sm {\n width: 300px;\n }\n}\n@media (min-width: 992px) {\n .modal-lg {\n width: 900px;\n }\n}\n.tooltip {\n position: absolute;\n z-index: 1070;\n display: block;\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n font-size: 12px;\n font-style: normal;\n font-weight: normal;\n line-height: 1.42857143;\n text-align: left;\n text-align: start;\n text-decoration: none;\n text-shadow: none;\n text-transform: none;\n letter-spacing: normal;\n word-break: normal;\n word-spacing: normal;\n word-wrap: normal;\n white-space: normal;\n filter: alpha(opacity=0);\n opacity: 0;\n\n line-break: auto;\n}\n.tooltip.in {\n filter: alpha(opacity=90);\n opacity: .9;\n}\n.tooltip.top {\n padding: 5px 0;\n margin-top: -3px;\n}\n.tooltip.right {\n padding: 0 5px;\n margin-left: 3px;\n}\n.tooltip.bottom {\n padding: 5px 0;\n margin-top: 3px;\n}\n.tooltip.left {\n padding: 0 5px;\n margin-left: -3px;\n}\n.tooltip-inner {\n max-width: 200px;\n padding: 3px 8px;\n color: #fff;\n text-align: center;\n background-color: #000;\n border-radius: 4px;\n}\n.tooltip-arrow {\n position: absolute;\n width: 0;\n height: 0;\n border-color: transparent;\n border-style: solid;\n}\n.tooltip.top .tooltip-arrow {\n bottom: 0;\n left: 50%;\n margin-left: -5px;\n border-width: 5px 5px 0;\n border-top-color: #000;\n}\n.tooltip.top-left .tooltip-arrow {\n right: 5px;\n bottom: 0;\n margin-bottom: -5px;\n border-width: 5px 5px 0;\n border-top-color: #000;\n}\n.tooltip.top-right .tooltip-arrow {\n bottom: 0;\n left: 5px;\n margin-bottom: -5px;\n border-width: 5px 5px 0;\n border-top-color: #000;\n}\n.tooltip.right .tooltip-arrow {\n top: 50%;\n left: 0;\n margin-top: -5px;\n border-width: 5px 5px 5px 0;\n border-right-color: #000;\n}\n.tooltip.left .tooltip-arrow {\n top: 50%;\n right: 0;\n margin-top: -5px;\n border-width: 5px 0 5px 5px;\n border-left-color: #000;\n}\n.tooltip.bottom .tooltip-arrow {\n top: 0;\n left: 50%;\n margin-left: -5px;\n border-width: 0 5px 5px;\n border-bottom-color: #000;\n}\n.tooltip.bottom-left .tooltip-arrow {\n top: 0;\n right: 5px;\n margin-top: -5px;\n border-width: 0 5px 5px;\n border-bottom-color: #000;\n}\n.tooltip.bottom-right .tooltip-arrow {\n top: 0;\n left: 5px;\n margin-top: -5px;\n border-width: 0 5px 5px;\n border-bottom-color: #000;\n}\n.popover {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 1060;\n display: none;\n max-width: 276px;\n padding: 1px;\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n font-size: 14px;\n font-style: normal;\n font-weight: normal;\n line-height: 1.42857143;\n text-align: left;\n text-align: start;\n text-decoration: none;\n text-shadow: none;\n text-transform: none;\n letter-spacing: normal;\n word-break: normal;\n word-spacing: normal;\n word-wrap: normal;\n white-space: normal;\n background-color: #fff;\n -webkit-background-clip: padding-box;\n background-clip: padding-box;\n border: 1px solid #ccc;\n border: 1px solid rgba(0, 0, 0, .2);\n border-radius: 6px;\n -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);\n box-shadow: 0 5px 10px rgba(0, 0, 0, .2);\n\n line-break: auto;\n}\n.popover.top {\n margin-top: -10px;\n}\n.popover.right {\n margin-left: 10px;\n}\n.popover.bottom {\n margin-top: 10px;\n}\n.popover.left {\n margin-left: -10px;\n}\n.popover-title {\n padding: 8px 14px;\n margin: 0;\n font-size: 14px;\n background-color: #f7f7f7;\n border-bottom: 1px solid #ebebeb;\n border-radius: 5px 5px 0 0;\n}\n.popover-content {\n padding: 9px 14px;\n}\n.popover > .arrow,\n.popover > .arrow:after {\n position: absolute;\n display: block;\n width: 0;\n height: 0;\n border-color: transparent;\n border-style: solid;\n}\n.popover > .arrow {\n border-width: 11px;\n}\n.popover > .arrow:after {\n content: \"\";\n border-width: 10px;\n}\n.popover.top > .arrow {\n bottom: -11px;\n left: 50%;\n margin-left: -11px;\n border-top-color: #999;\n border-top-color: rgba(0, 0, 0, .25);\n border-bottom-width: 0;\n}\n.popover.top > .arrow:after {\n bottom: 1px;\n margin-left: -10px;\n content: \" \";\n border-top-color: #fff;\n border-bottom-width: 0;\n}\n.popover.right > .arrow {\n top: 50%;\n left: -11px;\n margin-top: -11px;\n border-right-color: #999;\n border-right-color: rgba(0, 0, 0, .25);\n border-left-width: 0;\n}\n.popover.right > .arrow:after {\n bottom: -10px;\n left: 1px;\n content: \" \";\n border-right-color: #fff;\n border-left-width: 0;\n}\n.popover.bottom > .arrow {\n top: -11px;\n left: 50%;\n margin-left: -11px;\n border-top-width: 0;\n border-bottom-color: #999;\n border-bottom-color: rgba(0, 0, 0, .25);\n}\n.popover.bottom > .arrow:after {\n top: 1px;\n margin-left: -10px;\n content: \" \";\n border-top-width: 0;\n border-bottom-color: #fff;\n}\n.popover.left > .arrow {\n top: 50%;\n right: -11px;\n margin-top: -11px;\n border-right-width: 0;\n border-left-color: #999;\n border-left-color: rgba(0, 0, 0, .25);\n}\n.popover.left > .arrow:after {\n right: 1px;\n bottom: -10px;\n content: \" \";\n border-right-width: 0;\n border-left-color: #fff;\n}\n.carousel {\n position: relative;\n}\n.carousel-inner {\n position: relative;\n width: 100%;\n overflow: hidden;\n}\n.carousel-inner > .item {\n position: relative;\n display: none;\n -webkit-transition: .6s ease-in-out left;\n -o-transition: .6s ease-in-out left;\n transition: .6s ease-in-out left;\n}\n.carousel-inner > .item > img,\n.carousel-inner > .item > a > img {\n line-height: 1;\n}\n@media all and (transform-3d), (-webkit-transform-3d) {\n .carousel-inner > .item {\n -webkit-transition: -webkit-transform .6s ease-in-out;\n -o-transition: -o-transform .6s ease-in-out;\n transition: transform .6s ease-in-out;\n\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-perspective: 1000px;\n perspective: 1000px;\n }\n .carousel-inner > .item.next,\n .carousel-inner > .item.active.right {\n left: 0;\n -webkit-transform: translate3d(100%, 0, 0);\n transform: translate3d(100%, 0, 0);\n }\n .carousel-inner > .item.prev,\n .carousel-inner > .item.active.left {\n left: 0;\n -webkit-transform: translate3d(-100%, 0, 0);\n transform: translate3d(-100%, 0, 0);\n }\n .carousel-inner > .item.next.left,\n .carousel-inner > .item.prev.right,\n .carousel-inner > .item.active {\n left: 0;\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n }\n}\n.carousel-inner > .active,\n.carousel-inner > .next,\n.carousel-inner > .prev {\n display: block;\n}\n.carousel-inner > .active {\n left: 0;\n}\n.carousel-inner > .next,\n.carousel-inner > .prev {\n position: absolute;\n top: 0;\n width: 100%;\n}\n.carousel-inner > .next {\n left: 100%;\n}\n.carousel-inner > .prev {\n left: -100%;\n}\n.carousel-inner > .next.left,\n.carousel-inner > .prev.right {\n left: 0;\n}\n.carousel-inner > .active.left {\n left: -100%;\n}\n.carousel-inner > .active.right {\n left: 100%;\n}\n.carousel-control {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 15%;\n font-size: 20px;\n color: #fff;\n text-align: center;\n text-shadow: 0 1px 2px rgba(0, 0, 0, .6);\n background-color: rgba(0, 0, 0, 0);\n filter: alpha(opacity=50);\n opacity: .5;\n}\n.carousel-control.left {\n background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);\n background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);\n background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001)));\n background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);\n filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);\n background-repeat: repeat-x;\n}\n.carousel-control.right {\n right: 0;\n left: auto;\n background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);\n background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);\n background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5)));\n background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);\n filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);\n background-repeat: repeat-x;\n}\n.carousel-control:hover,\n.carousel-control:focus {\n color: #fff;\n text-decoration: none;\n filter: alpha(opacity=90);\n outline: 0;\n opacity: .9;\n}\n.carousel-control .icon-prev,\n.carousel-control .icon-next,\n.carousel-control .glyphicon-chevron-left,\n.carousel-control .glyphicon-chevron-right {\n position: absolute;\n top: 50%;\n z-index: 5;\n display: inline-block;\n margin-top: -10px;\n}\n.carousel-control .icon-prev,\n.carousel-control .glyphicon-chevron-left {\n left: 50%;\n margin-left: -10px;\n}\n.carousel-control .icon-next,\n.carousel-control .glyphicon-chevron-right {\n right: 50%;\n margin-right: -10px;\n}\n.carousel-control .icon-prev,\n.carousel-control .icon-next {\n width: 20px;\n height: 20px;\n font-family: serif;\n line-height: 1;\n}\n.carousel-control .icon-prev:before {\n content: '\\2039';\n}\n.carousel-control .icon-next:before {\n content: '\\203a';\n}\n.carousel-indicators {\n position: absolute;\n bottom: 10px;\n left: 50%;\n z-index: 15;\n width: 60%;\n padding-left: 0;\n margin-left: -30%;\n text-align: center;\n list-style: none;\n}\n.carousel-indicators li {\n display: inline-block;\n width: 10px;\n height: 10px;\n margin: 1px;\n text-indent: -999px;\n cursor: pointer;\n background-color: #000 \\9;\n background-color: rgba(0, 0, 0, 0);\n border: 1px solid #fff;\n border-radius: 10px;\n}\n.carousel-indicators .active {\n width: 12px;\n height: 12px;\n margin: 0;\n background-color: #fff;\n}\n.carousel-caption {\n position: absolute;\n right: 15%;\n bottom: 20px;\n left: 15%;\n z-index: 10;\n padding-top: 20px;\n padding-bottom: 20px;\n color: #fff;\n text-align: center;\n text-shadow: 0 1px 2px rgba(0, 0, 0, .6);\n}\n.carousel-caption .btn {\n text-shadow: none;\n}\n@media screen and (min-width: 768px) {\n .carousel-control .glyphicon-chevron-left,\n .carousel-control .glyphicon-chevron-right,\n .carousel-control .icon-prev,\n .carousel-control .icon-next {\n width: 30px;\n height: 30px;\n margin-top: -10px;\n font-size: 30px;\n }\n .carousel-control .glyphicon-chevron-left,\n .carousel-control .icon-prev {\n margin-left: -10px;\n }\n .carousel-control .glyphicon-chevron-right,\n .carousel-control .icon-next {\n margin-right: -10px;\n }\n .carousel-caption {\n right: 20%;\n left: 20%;\n padding-bottom: 30px;\n }\n .carousel-indicators {\n bottom: 20px;\n }\n}\n.clearfix:before,\n.clearfix:after,\n.dl-horizontal dd:before,\n.dl-horizontal dd:after,\n.container:before,\n.container:after,\n.container-fluid:before,\n.container-fluid:after,\n.row:before,\n.row:after,\n.form-horizontal .form-group:before,\n.form-horizontal .form-group:after,\n.btn-toolbar:before,\n.btn-toolbar:after,\n.btn-group-vertical > .btn-group:before,\n.btn-group-vertical > .btn-group:after,\n.nav:before,\n.nav:after,\n.navbar:before,\n.navbar:after,\n.navbar-header:before,\n.navbar-header:after,\n.navbar-collapse:before,\n.navbar-collapse:after,\n.pager:before,\n.pager:after,\n.panel-body:before,\n.panel-body:after,\n.modal-header:before,\n.modal-header:after,\n.modal-footer:before,\n.modal-footer:after {\n display: table;\n content: \" \";\n}\n.clearfix:after,\n.dl-horizontal dd:after,\n.container:after,\n.container-fluid:after,\n.row:after,\n.form-horizontal .form-group:after,\n.btn-toolbar:after,\n.btn-group-vertical > .btn-group:after,\n.nav:after,\n.navbar:after,\n.navbar-header:after,\n.navbar-collapse:after,\n.pager:after,\n.panel-body:after,\n.modal-header:after,\n.modal-footer:after {\n clear: both;\n}\n.center-block {\n display: block;\n margin-right: auto;\n margin-left: auto;\n}\n.pull-right {\n float: right !important;\n}\n.pull-left {\n float: left !important;\n}\n.hide {\n display: none !important;\n}\n.show {\n display: block !important;\n}\n.invisible {\n visibility: hidden;\n}\n.text-hide {\n font: 0/0 a;\n color: transparent;\n text-shadow: none;\n background-color: transparent;\n border: 0;\n}\n.hidden {\n display: none !important;\n}\n.affix {\n position: fixed;\n}\n@-ms-viewport {\n width: device-width;\n}\n.visible-xs,\n.visible-sm,\n.visible-md,\n.visible-lg {\n display: none !important;\n}\n.visible-xs-block,\n.visible-xs-inline,\n.visible-xs-inline-block,\n.visible-sm-block,\n.visible-sm-inline,\n.visible-sm-inline-block,\n.visible-md-block,\n.visible-md-inline,\n.visible-md-inline-block,\n.visible-lg-block,\n.visible-lg-inline,\n.visible-lg-inline-block {\n display: none !important;\n}\n@media (max-width: 767px) {\n .visible-xs {\n display: block !important;\n }\n table.visible-xs {\n display: table !important;\n }\n tr.visible-xs {\n display: table-row !important;\n }\n th.visible-xs,\n td.visible-xs {\n display: table-cell !important;\n }\n}\n@media (max-width: 767px) {\n .visible-xs-block {\n display: block !important;\n }\n}\n@media (max-width: 767px) {\n .visible-xs-inline {\n display: inline !important;\n }\n}\n@media (max-width: 767px) {\n .visible-xs-inline-block {\n display: inline-block !important;\n }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n .visible-sm {\n display: block !important;\n }\n table.visible-sm {\n display: table !important;\n }\n tr.visible-sm {\n display: table-row !important;\n }\n th.visible-sm,\n td.visible-sm {\n display: table-cell !important;\n }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n .visible-sm-block {\n display: block !important;\n }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n .visible-sm-inline {\n display: inline !important;\n }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n .visible-sm-inline-block {\n display: inline-block !important;\n }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n .visible-md {\n display: block !important;\n }\n table.visible-md {\n display: table !important;\n }\n tr.visible-md {\n display: table-row !important;\n }\n th.visible-md,\n td.visible-md {\n display: table-cell !important;\n }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n .visible-md-block {\n display: block !important;\n }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n .visible-md-inline {\n display: inline !important;\n }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n .visible-md-inline-block {\n display: inline-block !important;\n }\n}\n@media (min-width: 1200px) {\n .visible-lg {\n display: block !important;\n }\n table.visible-lg {\n display: table !important;\n }\n tr.visible-lg {\n display: table-row !important;\n }\n th.visible-lg,\n td.visible-lg {\n display: table-cell !important;\n }\n}\n@media (min-width: 1200px) {\n .visible-lg-block {\n display: block !important;\n }\n}\n@media (min-width: 1200px) {\n .visible-lg-inline {\n display: inline !important;\n }\n}\n@media (min-width: 1200px) {\n .visible-lg-inline-block {\n display: inline-block !important;\n }\n}\n@media (max-width: 767px) {\n .hidden-xs {\n display: none !important;\n }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n .hidden-sm {\n display: none !important;\n }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n .hidden-md {\n display: none !important;\n }\n}\n@media (min-width: 1200px) {\n .hidden-lg {\n display: none !important;\n }\n}\n.visible-print {\n display: none !important;\n}\n@media print {\n .visible-print {\n display: block !important;\n }\n table.visible-print {\n display: table !important;\n }\n tr.visible-print {\n display: table-row !important;\n }\n th.visible-print,\n td.visible-print {\n display: table-cell !important;\n }\n}\n.visible-print-block {\n display: none !important;\n}\n@media print {\n .visible-print-block {\n display: block !important;\n }\n}\n.visible-print-inline {\n display: none !important;\n}\n@media print {\n .visible-print-inline {\n display: inline !important;\n }\n}\n.visible-print-inline-block {\n display: none !important;\n}\n@media print {\n .visible-print-inline-block {\n display: inline-block !important;\n }\n}\n@media print {\n .hidden-print {\n display: none !important;\n }\n}\n/*# sourceMappingURL=bootstrap.css.map */\n"; });
- /*!
- * Bootstrap v3.3.7 (http://getbootstrap.com)
- * Copyright 2011-2016 Twitter, Inc.
- * Licensed under the MIT license
- */
- if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){document===a.target||this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);if(this.$element.trigger(g),!g.isDefaultPrevented())return f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=window.SVGElement&&c instanceof window.SVGElement,g=d?{top:0,left:0}:f?null:b.offset(),h={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},i=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,h,i,g)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){
- this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e<c&&"top";if("bottom"==this.affixed)return null!=c?!(e+this.unpin<=f.top)&&"bottom":!(e+g<=a-d)&&"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&e<=c?"top":null!=d&&i+j>=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
- define("bootstrap/js/bootstrap.min", ["jquery"], (function (global) {
- return function () {
- var ret, fn;
- return ret || global.$;
- };
- }(this)));
- ;define('bootstrap', ['bootstrap/js/bootstrap.min'], function (main) { return main; });
- define('aurelia-templating-binding',['exports', 'aurelia-logging', 'aurelia-binding', 'aurelia-templating'], function (exports, _aureliaLogging, _aureliaBinding, _aureliaTemplating) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.TemplatingBindingLanguage = exports.SyntaxInterpreter = exports.ChildInterpolationBinding = exports.InterpolationBinding = exports.InterpolationBindingExpression = exports.AttributeMap = undefined;
- exports.configure = configure;
- var LogManager = _interopRequireWildcard(_aureliaLogging);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
- function _possibleConstructorReturn(self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
- }
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
- }
-
- var _class, _temp, _dec, _class2, _class3, _temp2, _class4, _temp3;
- var AttributeMap = exports.AttributeMap = (_temp = _class = function () {
- function AttributeMap(svg) {
-
- this.elements = Object.create(null);
- this.allElements = Object.create(null);
- this.svg = svg;
- this.registerUniversal('accesskey', 'accessKey');
- this.registerUniversal('contenteditable', 'contentEditable');
- this.registerUniversal('tabindex', 'tabIndex');
- this.registerUniversal('textcontent', 'textContent');
- this.registerUniversal('innerhtml', 'innerHTML');
- this.registerUniversal('scrolltop', 'scrollTop');
- this.registerUniversal('scrollleft', 'scrollLeft');
- this.registerUniversal('readonly', 'readOnly');
- this.register('label', 'for', 'htmlFor');
- this.register('input', 'maxlength', 'maxLength');
- this.register('input', 'minlength', 'minLength');
- this.register('input', 'formaction', 'formAction');
- this.register('input', 'formenctype', 'formEncType');
- this.register('input', 'formmethod', 'formMethod');
- this.register('input', 'formnovalidate', 'formNoValidate');
- this.register('input', 'formtarget', 'formTarget');
- this.register('textarea', 'maxlength', 'maxLength');
- this.register('td', 'rowspan', 'rowSpan');
- this.register('td', 'colspan', 'colSpan');
- this.register('th', 'rowspan', 'rowSpan');
- this.register('th', 'colspan', 'colSpan');
- }
- AttributeMap.prototype.register = function register(elementName, attributeName, propertyName) {
- elementName = elementName.toLowerCase();
- attributeName = attributeName.toLowerCase();
- var element = this.elements[elementName] = this.elements[elementName] || Object.create(null);
- element[attributeName] = propertyName;
- };
- AttributeMap.prototype.registerUniversal = function registerUniversal(attributeName, propertyName) {
- attributeName = attributeName.toLowerCase();
- this.allElements[attributeName] = propertyName;
- };
- AttributeMap.prototype.map = function map(elementName, attributeName) {
- if (this.svg.isStandardSvgAttribute(elementName, attributeName)) {
- return attributeName;
- }
- elementName = elementName.toLowerCase();
- attributeName = attributeName.toLowerCase();
- var element = this.elements[elementName];
- if (element !== undefined && attributeName in element) {
- return element[attributeName];
- }
- if (attributeName in this.allElements) {
- return this.allElements[attributeName];
- }
- if (/(^data-)|(^aria-)|:/.test(attributeName)) {
- return attributeName;
- }
- return (0, _aureliaBinding.camelCase)(attributeName);
- };
- return AttributeMap;
- }(), _class.inject = [_aureliaBinding.SVGAnalyzer], _temp);
- var InterpolationBindingExpression = exports.InterpolationBindingExpression = function () {
- function InterpolationBindingExpression(observerLocator, targetProperty, parts, mode, lookupFunctions, attribute) {
-
- this.observerLocator = observerLocator;
- this.targetProperty = targetProperty;
- this.parts = parts;
- this.mode = mode;
- this.lookupFunctions = lookupFunctions;
- this.attribute = this.attrToRemove = attribute;
- this.discrete = false;
- }
- InterpolationBindingExpression.prototype.createBinding = function createBinding(target) {
- if (this.parts.length === 3) {
- return new ChildInterpolationBinding(target, this.observerLocator, this.parts[1], this.mode, this.lookupFunctions, this.targetProperty, this.parts[0], this.parts[2]);
- }
- return new InterpolationBinding(this.observerLocator, this.parts, target, this.targetProperty, this.mode, this.lookupFunctions);
- };
- return InterpolationBindingExpression;
- }();
- function validateTarget(target, propertyName) {
- if (propertyName === 'style') {
- LogManager.getLogger('templating-binding').info('Internet Explorer does not support interpolation in "style" attributes. Use the style attribute\'s alias, "css" instead.');
- } else if (target.parentElement && target.parentElement.nodeName === 'TEXTAREA' && propertyName === 'textContent') {
- throw new Error('Interpolation binding cannot be used in the content of a textarea element. Use <textarea value.bind="expression"></textarea> instead.');
- }
- }
- var InterpolationBinding = exports.InterpolationBinding = function () {
- function InterpolationBinding(observerLocator, parts, target, targetProperty, mode, lookupFunctions) {
-
- validateTarget(target, targetProperty);
- this.observerLocator = observerLocator;
- this.parts = parts;
- this.target = target;
- this.targetProperty = targetProperty;
- this.targetAccessor = observerLocator.getAccessor(target, targetProperty);
- this.mode = mode;
- this.lookupFunctions = lookupFunctions;
- }
- InterpolationBinding.prototype.interpolate = function interpolate() {
- if (this.isBound) {
- var value = '';
- var parts = this.parts;
- for (var i = 0, ii = parts.length; i < ii; i++) {
- value += i % 2 === 0 ? parts[i] : this['childBinding' + i].value;
- }
- this.targetAccessor.setValue(value, this.target, this.targetProperty);
- }
- };
- InterpolationBinding.prototype.updateOneTimeBindings = function updateOneTimeBindings() {
- for (var i = 1, ii = this.parts.length; i < ii; i += 2) {
- var child = this['childBinding' + i];
- if (child.mode === _aureliaBinding.bindingMode.oneTime) {
- child.call();
- }
- }
- };
- InterpolationBinding.prototype.bind = function bind(source) {
- if (this.isBound) {
- if (this.source === source) {
- return;
- }
- this.unbind();
- }
- this.source = source;
- var parts = this.parts;
- for (var i = 1, ii = parts.length; i < ii; i += 2) {
- var binding = new ChildInterpolationBinding(this, this.observerLocator, parts[i], this.mode, this.lookupFunctions);
- binding.bind(source);
- this['childBinding' + i] = binding;
- }
- this.isBound = true;
- this.interpolate();
- };
- InterpolationBinding.prototype.unbind = function unbind() {
- if (!this.isBound) {
- return;
- }
- this.isBound = false;
- this.source = null;
- var parts = this.parts;
- for (var i = 1, ii = parts.length; i < ii; i += 2) {
- var name = 'childBinding' + i;
- this[name].unbind();
- }
- };
- return InterpolationBinding;
- }();
- var ChildInterpolationBinding = exports.ChildInterpolationBinding = (_dec = (0, _aureliaBinding.connectable)(), _dec(_class2 = function () {
- function ChildInterpolationBinding(target, observerLocator, sourceExpression, mode, lookupFunctions, targetProperty, left, right) {
-
- if (target instanceof InterpolationBinding) {
- this.parent = target;
- } else {
- validateTarget(target, targetProperty);
- this.target = target;
- this.targetProperty = targetProperty;
- this.targetAccessor = observerLocator.getAccessor(target, targetProperty);
- }
- this.observerLocator = observerLocator;
- this.sourceExpression = sourceExpression;
- this.mode = mode;
- this.lookupFunctions = lookupFunctions;
- this.left = left;
- this.right = right;
- }
- ChildInterpolationBinding.prototype.updateTarget = function updateTarget(value) {
- value = value === null || value === undefined ? '' : value.toString();
- if (value !== this.value) {
- this.value = value;
- if (this.parent) {
- this.parent.interpolate();
- } else {
- this.targetAccessor.setValue(this.left + value + this.right, this.target, this.targetProperty);
- }
- }
- };
- ChildInterpolationBinding.prototype.call = function call() {
- if (!this.isBound) {
- return;
- }
- this.rawValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions);
- this.updateTarget(this.rawValue);
- if (this.mode !== _aureliaBinding.bindingMode.oneTime) {
- this._version++;
- this.sourceExpression.connect(this, this.source);
- if (this.rawValue instanceof Array) {
- this.observeArray(this.rawValue);
- }
- this.unobserve(false);
- }
- };
- ChildInterpolationBinding.prototype.bind = function bind(source) {
- if (this.isBound) {
- if (this.source === source) {
- return;
- }
- this.unbind();
- }
- this.isBound = true;
- this.source = source;
- var sourceExpression = this.sourceExpression;
- if (sourceExpression.bind) {
- sourceExpression.bind(this, source, this.lookupFunctions);
- }
- this.rawValue = sourceExpression.evaluate(source, this.lookupFunctions);
- this.updateTarget(this.rawValue);
- if (this.mode === _aureliaBinding.bindingMode.oneWay) {
- (0, _aureliaBinding.enqueueBindingConnect)(this);
- }
- };
- ChildInterpolationBinding.prototype.unbind = function unbind() {
- if (!this.isBound) {
- return;
- }
- this.isBound = false;
- var sourceExpression = this.sourceExpression;
- if (sourceExpression.unbind) {
- sourceExpression.unbind(this, this.source);
- }
- this.source = null;
- this.value = null;
- this.rawValue = null;
- this.unobserve(true);
- };
- ChildInterpolationBinding.prototype.connect = function connect(evaluate) {
- if (!this.isBound) {
- return;
- }
- if (evaluate) {
- this.rawValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions);
- this.updateTarget(this.rawValue);
- }
- this.sourceExpression.connect(this, this.source);
- if (this.rawValue instanceof Array) {
- this.observeArray(this.rawValue);
- }
- };
- return ChildInterpolationBinding;
- }()) || _class2);
- var SyntaxInterpreter = exports.SyntaxInterpreter = (_temp2 = _class3 = function () {
- function SyntaxInterpreter(parser, observerLocator, eventManager, attributeMap) {
-
- this.parser = parser;
- this.observerLocator = observerLocator;
- this.eventManager = eventManager;
- this.attributeMap = attributeMap;
- }
- SyntaxInterpreter.prototype.interpret = function interpret(resources, element, info, existingInstruction, context) {
- if (info.command in this) {
- return this[info.command](resources, element, info, existingInstruction, context);
- }
- return this.handleUnknownCommand(resources, element, info, existingInstruction, context);
- };
- SyntaxInterpreter.prototype.handleUnknownCommand = function handleUnknownCommand(resources, element, info, existingInstruction, context) {
- LogManager.getLogger('templating-binding').warn('Unknown binding command.', info);
- return existingInstruction;
- };
- SyntaxInterpreter.prototype.determineDefaultBindingMode = function determineDefaultBindingMode(element, attrName, context) {
- var tagName = element.tagName.toLowerCase();
- if (tagName === 'input' && (attrName === 'value' || attrName === 'files') && element.type !== 'checkbox' && element.type !== 'radio' || tagName === 'input' && attrName === 'checked' && (element.type === 'checkbox' || element.type === 'radio') || (tagName === 'textarea' || tagName === 'select') && attrName === 'value' || (attrName === 'textcontent' || attrName === 'innerhtml') && element.contentEditable === 'true' || attrName === 'scrolltop' || attrName === 'scrollleft') {
- return _aureliaBinding.bindingMode.twoWay;
- }
- if (context && attrName in context.attributes && context.attributes[attrName] && context.attributes[attrName].defaultBindingMode >= _aureliaBinding.bindingMode.oneTime) {
- return context.attributes[attrName].defaultBindingMode;
- }
- return _aureliaBinding.bindingMode.oneWay;
- };
- SyntaxInterpreter.prototype.bind = function bind(resources, element, info, existingInstruction, context) {
- var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
- instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName, context), resources.lookupFunctions);
- return instruction;
- };
- SyntaxInterpreter.prototype.trigger = function trigger(resources, element, info) {
- return new _aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), false, true, resources.lookupFunctions);
- };
- SyntaxInterpreter.prototype.delegate = function delegate(resources, element, info) {
- return new _aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), true, true, resources.lookupFunctions);
- };
- SyntaxInterpreter.prototype.call = function call(resources, element, info, existingInstruction) {
- var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
- instruction.attributes[info.attrName] = new _aureliaBinding.CallExpression(this.observerLocator, info.attrName, this.parser.parse(info.attrValue), resources.lookupFunctions);
- return instruction;
- };
- SyntaxInterpreter.prototype.options = function options(resources, element, info, existingInstruction, context) {
- var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
- var attrValue = info.attrValue;
- var language = this.language;
- var name = null;
- var target = '';
- var current = void 0;
- var i = void 0;
- var ii = void 0;
- var inString = false;
- var inEscape = false;
- for (i = 0, ii = attrValue.length; i < ii; ++i) {
- current = attrValue[i];
- if (current === ';' && !inString) {
- info = language.inspectAttribute(resources, '?', name, target.trim());
- language.createAttributeInstruction(resources, element, info, instruction, context);
- if (!instruction.attributes[info.attrName]) {
- instruction.attributes[info.attrName] = info.attrValue;
- }
- target = '';
- name = null;
- } else if (current === ':' && name === null) {
- name = target.trim();
- target = '';
- } else if (current === '\\') {
- target += current;
- inEscape = true;
- continue;
- } else {
- target += current;
- if (name !== null && inEscape === false && current === '\'') {
- inString = !inString;
- }
- }
- inEscape = false;
- }
- if (name !== null) {
- info = language.inspectAttribute(resources, '?', name, target.trim());
- language.createAttributeInstruction(resources, element, info, instruction, context);
- if (!instruction.attributes[info.attrName]) {
- instruction.attributes[info.attrName] = info.attrValue;
- }
- }
- return instruction;
- };
- SyntaxInterpreter.prototype['for'] = function _for(resources, element, info, existingInstruction) {
- var parts = void 0;
- var keyValue = void 0;
- var instruction = void 0;
- var attrValue = void 0;
- var isDestructuring = void 0;
- attrValue = info.attrValue;
- isDestructuring = attrValue.match(/^ *[[].+[\]]/);
- parts = isDestructuring ? attrValue.split('of ') : attrValue.split(' of ');
- if (parts.length !== 2) {
- throw new Error('Incorrect syntax for "for". The form is: "$local of $items" or "[$key, $value] of $items".');
- }
- instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
- if (isDestructuring) {
- keyValue = parts[0].replace(/[[\]]/g, '').replace(/,/g, ' ').replace(/\s+/g, ' ').trim().split(' ');
- instruction.attributes.key = keyValue[0];
- instruction.attributes.value = keyValue[1];
- } else {
- instruction.attributes.local = parts[0];
- }
- instruction.attributes.items = new _aureliaBinding.BindingExpression(this.observerLocator, 'items', this.parser.parse(parts[1]), _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions);
- return instruction;
- };
- SyntaxInterpreter.prototype['two-way'] = function twoWay(resources, element, info, existingInstruction) {
- var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
- instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), _aureliaBinding.bindingMode.twoWay, resources.lookupFunctions);
- return instruction;
- };
- SyntaxInterpreter.prototype['one-way'] = function oneWay(resources, element, info, existingInstruction) {
- var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
- instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions);
- return instruction;
- };
- SyntaxInterpreter.prototype['one-time'] = function oneTime(resources, element, info, existingInstruction) {
- var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
- instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), _aureliaBinding.bindingMode.oneTime, resources.lookupFunctions);
- return instruction;
- };
- return SyntaxInterpreter;
- }(), _class3.inject = [_aureliaBinding.Parser, _aureliaBinding.ObserverLocator, _aureliaBinding.EventManager, AttributeMap], _temp2);
- var info = {};
- var TemplatingBindingLanguage = exports.TemplatingBindingLanguage = (_temp3 = _class4 = function (_BindingLanguage) {
- _inherits(TemplatingBindingLanguage, _BindingLanguage);
- function TemplatingBindingLanguage(parser, observerLocator, syntaxInterpreter, attributeMap) {
-
- var _this = _possibleConstructorReturn(this, _BindingLanguage.call(this));
- _this.parser = parser;
- _this.observerLocator = observerLocator;
- _this.syntaxInterpreter = syntaxInterpreter;
- _this.emptyStringExpression = _this.parser.parse('\'\'');
- syntaxInterpreter.language = _this;
- _this.attributeMap = attributeMap;
- return _this;
- }
- TemplatingBindingLanguage.prototype.inspectAttribute = function inspectAttribute(resources, elementName, attrName, attrValue) {
- var parts = attrName.split('.');
- info.defaultBindingMode = null;
- if (parts.length === 2) {
- info.attrName = parts[0].trim();
- info.attrValue = attrValue;
- info.command = parts[1].trim();
- if (info.command === 'ref') {
- info.expression = new _aureliaBinding.NameExpression(this.parser.parse(attrValue), info.attrName, resources.lookupFunctions);
- info.command = null;
- info.attrName = 'ref';
- } else {
- info.expression = null;
- }
- } else if (attrName === 'ref') {
- info.attrName = attrName;
- info.attrValue = attrValue;
- info.command = null;
- info.expression = new _aureliaBinding.NameExpression(this.parser.parse(attrValue), 'element', resources.lookupFunctions);
- } else {
- info.attrName = attrName;
- info.attrValue = attrValue;
- info.command = null;
- var interpolationParts = this.parseInterpolation(resources, attrValue);
- if (interpolationParts === null) {
- info.expression = null;
- } else {
- info.expression = new InterpolationBindingExpression(this.observerLocator, this.attributeMap.map(elementName, attrName), interpolationParts, _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions, attrName);
- }
- }
- return info;
- };
- TemplatingBindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, theInfo, existingInstruction, context) {
- var instruction = void 0;
- if (theInfo.expression) {
- if (theInfo.attrName === 'ref') {
- return theInfo.expression;
- }
- instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(theInfo.attrName);
- instruction.attributes[theInfo.attrName] = theInfo.expression;
- } else if (theInfo.command) {
- instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction, context);
- }
- return instruction;
- };
- TemplatingBindingLanguage.prototype.inspectTextContent = function inspectTextContent(resources, value) {
- var parts = this.parseInterpolation(resources, value);
- if (parts === null) {
- return null;
- }
- return new InterpolationBindingExpression(this.observerLocator, 'textContent', parts, _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions, 'textContent');
- };
- TemplatingBindingLanguage.prototype.parseInterpolation = function parseInterpolation(resources, value) {
- var i = value.indexOf('${', 0);
- var ii = value.length;
- var char = void 0;
- var pos = 0;
- var open = 0;
- var quote = null;
- var interpolationStart = void 0;
- var parts = void 0;
- var partIndex = 0;
- while (i >= 0 && i < ii - 2) {
- open = 1;
- interpolationStart = i;
- i += 2;
- do {
- char = value[i];
- i++;
- if (char === "'" || char === '"') {
- if (quote === null) {
- quote = char;
- } else if (quote === char) {
- quote = null;
- }
- continue;
- }
- if (char === '\\') {
- i++;
- continue;
- }
- if (quote !== null) {
- continue;
- }
- if (char === '{') {
- open++;
- } else if (char === '}') {
- open--;
- }
- } while (open > 0 && i < ii);
- if (open === 0) {
- parts = parts || [];
- if (value[interpolationStart - 1] === '\\' && value[interpolationStart - 2] !== '\\') {
- parts[partIndex] = value.substring(pos, interpolationStart - 1) + value.substring(interpolationStart, i);
- partIndex++;
- parts[partIndex] = this.emptyStringExpression;
- partIndex++;
- } else {
- parts[partIndex] = value.substring(pos, interpolationStart);
- partIndex++;
- parts[partIndex] = this.parser.parse(value.substring(interpolationStart + 2, i - 1));
- partIndex++;
- }
- pos = i;
- i = value.indexOf('${', i);
- } else {
- break;
- }
- }
- if (partIndex === 0) {
- return null;
- }
- parts[partIndex] = value.substr(pos);
- return parts;
- };
- return TemplatingBindingLanguage;
- }(_aureliaTemplating.BindingLanguage), _class4.inject = [_aureliaBinding.Parser, _aureliaBinding.ObserverLocator, SyntaxInterpreter, AttributeMap], _temp3);
- function configure(config) {
- config.container.registerSingleton(_aureliaTemplating.BindingLanguage, TemplatingBindingLanguage);
- config.container.registerAlias(_aureliaTemplating.BindingLanguage, TemplatingBindingLanguage);
- }
- });
- define('text!nprogress/nprogress.css', ['module'], function(module) { module.exports = "/* Make clicks pass-through */\n#nprogress {\n pointer-events: none;\n}\n\n#nprogress .bar {\n background: #29d;\n\n position: fixed;\n z-index: 1031;\n top: 0;\n left: 0;\n\n width: 100%;\n height: 2px;\n}\n\n/* Fancy blur effect */\n#nprogress .peg {\n display: block;\n position: absolute;\n right: 0px;\n width: 100px;\n height: 100%;\n box-shadow: 0 0 10px #29d, 0 0 5px #29d;\n opacity: 1.0;\n\n -webkit-transform: rotate(3deg) translate(0px, -4px);\n -ms-transform: rotate(3deg) translate(0px, -4px);\n transform: rotate(3deg) translate(0px, -4px);\n}\n\n/* Remove these to get rid of the spinner */\n#nprogress .spinner {\n display: block;\n position: fixed;\n z-index: 1031;\n top: 15px;\n right: 15px;\n}\n\n#nprogress .spinner-icon {\n width: 18px;\n height: 18px;\n box-sizing: border-box;\n\n border: solid 2px transparent;\n border-top-color: #29d;\n border-left-color: #29d;\n border-radius: 50%;\n\n -webkit-animation: nprogress-spinner 400ms linear infinite;\n animation: nprogress-spinner 400ms linear infinite;\n}\n\n.nprogress-custom-parent {\n overflow: hidden;\n position: relative;\n}\n\n.nprogress-custom-parent #nprogress .spinner,\n.nprogress-custom-parent #nprogress .bar {\n position: absolute;\n}\n\n@-webkit-keyframes nprogress-spinner {\n 0% { -webkit-transform: rotate(0deg); }\n 100% { -webkit-transform: rotate(360deg); }\n}\n@keyframes nprogress-spinner {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n\n"; });
- /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
- * @license MIT */
- ;(function(root, factory) {
- if (typeof define === 'function' && define.amd) {
- define('nprogress/nprogress',factory);
- } else if (typeof exports === 'object') {
- module.exports = factory();
- } else {
- root.NProgress = factory();
- }
- })(this, function() {
- var NProgress = {};
- NProgress.version = '0.2.0';
- var Settings = NProgress.settings = {
- minimum: 0.08,
- easing: 'ease',
- positionUsing: '',
- speed: 200,
- trickle: true,
- trickleRate: 0.02,
- trickleSpeed: 800,
- showSpinner: true,
- barSelector: '[role="bar"]',
- spinnerSelector: '[role="spinner"]',
- parent: 'body',
- template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
- };
- /**
- * Updates configuration.
- *
- * NProgress.configure({
- * minimum: 0.1
- * });
- */
- NProgress.configure = function(options) {
- var key, value;
- for (key in options) {
- value = options[key];
- if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
- }
- return this;
- };
- /**
- * Last number.
- */
- NProgress.status = null;
- /**
- * Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
- *
- * NProgress.set(0.4);
- * NProgress.set(1.0);
- */
- NProgress.set = function(n) {
- var started = NProgress.isStarted();
- n = clamp(n, Settings.minimum, 1);
- NProgress.status = (n === 1 ? null : n);
- var progress = NProgress.render(!started),
- bar = progress.querySelector(Settings.barSelector),
- speed = Settings.speed,
- ease = Settings.easing;
- progress.offsetWidth; /* Repaint */
- queue(function(next) {
- // Set positionUsing if it hasn't already been set
- if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
- // Add transition
- css(bar, barPositionCSS(n, speed, ease));
- if (n === 1) {
- // Fade out
- css(progress, {
- transition: 'none',
- opacity: 1
- });
- progress.offsetWidth; /* Repaint */
- setTimeout(function() {
- css(progress, {
- transition: 'all ' + speed + 'ms linear',
- opacity: 0
- });
- setTimeout(function() {
- NProgress.remove();
- next();
- }, speed);
- }, speed);
- } else {
- setTimeout(next, speed);
- }
- });
- return this;
- };
- NProgress.isStarted = function() {
- return typeof NProgress.status === 'number';
- };
- /**
- * Shows the progress bar.
- * This is the same as setting the status to 0%, except that it doesn't go backwards.
- *
- * NProgress.start();
- *
- */
- NProgress.start = function() {
- if (!NProgress.status) NProgress.set(0);
- var work = function() {
- setTimeout(function() {
- if (!NProgress.status) return;
- NProgress.trickle();
- work();
- }, Settings.trickleSpeed);
- };
- if (Settings.trickle) work();
- return this;
- };
- /**
- * Hides the progress bar.
- * This is the *sort of* the same as setting the status to 100%, with the
- * difference being `done()` makes some placebo effect of some realistic motion.
- *
- * NProgress.done();
- *
- * If `true` is passed, it will show the progress bar even if its hidden.
- *
- * NProgress.done(true);
- */
- NProgress.done = function(force) {
- if (!force && !NProgress.status) return this;
- return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
- };
- /**
- * Increments by a random amount.
- */
- NProgress.inc = function(amount) {
- var n = NProgress.status;
- if (!n) {
- return NProgress.start();
- } else {
- if (typeof amount !== 'number') {
- amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
- }
- n = clamp(n + amount, 0, 0.994);
- return NProgress.set(n);
- }
- };
- NProgress.trickle = function() {
- return NProgress.inc(Math.random() * Settings.trickleRate);
- };
- /**
- * Waits for all supplied jQuery promises and
- * increases the progress as the promises resolve.
- *
- * @param $promise jQUery Promise
- */
- (function() {
- var initial = 0, current = 0;
- NProgress.promise = function($promise) {
- if (!$promise || $promise.state() === "resolved") {
- return this;
- }
- if (current === 0) {
- NProgress.start();
- }
- initial++;
- current++;
- $promise.always(function() {
- current--;
- if (current === 0) {
- initial = 0;
- NProgress.done();
- } else {
- NProgress.set((initial - current) / initial);
- }
- });
- return this;
- };
- })();
- /**
- * (Internal) renders the progress bar markup based on the `template`
- * setting.
- */
- NProgress.render = function(fromStart) {
- if (NProgress.isRendered()) return document.getElementById('nprogress');
- addClass(document.documentElement, 'nprogress-busy');
-
- var progress = document.createElement('div');
- progress.id = 'nprogress';
- progress.innerHTML = Settings.template;
- var bar = progress.querySelector(Settings.barSelector),
- perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
- parent = document.querySelector(Settings.parent),
- spinner;
-
- css(bar, {
- transition: 'all 0 linear',
- transform: 'translate3d(' + perc + '%,0,0)'
- });
- if (!Settings.showSpinner) {
- spinner = progress.querySelector(Settings.spinnerSelector);
- spinner && removeElement(spinner);
- }
- if (parent != document.body) {
- addClass(parent, 'nprogress-custom-parent');
- }
- parent.appendChild(progress);
- return progress;
- };
- /**
- * Removes the element. Opposite of render().
- */
- NProgress.remove = function() {
- removeClass(document.documentElement, 'nprogress-busy');
- removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent');
- var progress = document.getElementById('nprogress');
- progress && removeElement(progress);
- };
- /**
- * Checks if the progress bar is rendered.
- */
- NProgress.isRendered = function() {
- return !!document.getElementById('nprogress');
- };
- /**
- * Determine which positioning CSS rule to use.
- */
- NProgress.getPositioningCSS = function() {
- // Sniff on document.body.style
- var bodyStyle = document.body.style;
- // Sniff prefixes
- var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
- ('MozTransform' in bodyStyle) ? 'Moz' :
- ('msTransform' in bodyStyle) ? 'ms' :
- ('OTransform' in bodyStyle) ? 'O' : '';
- if (vendorPrefix + 'Perspective' in bodyStyle) {
- // Modern browsers with 3D support, e.g. Webkit, IE10
- return 'translate3d';
- } else if (vendorPrefix + 'Transform' in bodyStyle) {
- // Browsers without 3D support, e.g. IE9
- return 'translate';
- } else {
- // Browsers without translate() support, e.g. IE7-8
- return 'margin';
- }
- };
- /**
- * Helpers
- */
- function clamp(n, min, max) {
- if (n < min) return min;
- if (n > max) return max;
- return n;
- }
- /**
- * (Internal) converts a percentage (`0..1`) to a bar translateX
- * percentage (`-100%..0%`).
- */
- function toBarPerc(n) {
- return (-1 + n) * 100;
- }
- /**
- * (Internal) returns the correct CSS for changing the bar's
- * position given an n percentage, and speed and ease from Settings
- */
- function barPositionCSS(n, speed, ease) {
- var barCSS;
- if (Settings.positionUsing === 'translate3d') {
- barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
- } else if (Settings.positionUsing === 'translate') {
- barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
- } else {
- barCSS = { 'margin-left': toBarPerc(n)+'%' };
- }
- barCSS.transition = 'all '+speed+'ms '+ease;
- return barCSS;
- }
- /**
- * (Internal) Queues a function to be executed.
- */
- var queue = (function() {
- var pending = [];
-
- function next() {
- var fn = pending.shift();
- if (fn) {
- fn(next);
- }
- }
- return function(fn) {
- pending.push(fn);
- if (pending.length == 1) next();
- };
- })();
- /**
- * (Internal) Applies css properties to an element, similar to the jQuery
- * css method.
- *
- * While this helper does assist with vendor prefixed property names, it
- * does not perform any manipulation of values prior to setting styles.
- */
- var css = (function() {
- var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
- cssProps = {};
- function camelCase(string) {
- return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
- return letter.toUpperCase();
- });
- }
- function getVendorProp(name) {
- var style = document.body.style;
- if (name in style) return name;
- var i = cssPrefixes.length,
- capName = name.charAt(0).toUpperCase() + name.slice(1),
- vendorName;
- while (i--) {
- vendorName = cssPrefixes[i] + capName;
- if (vendorName in style) return vendorName;
- }
- return name;
- }
- function getStyleProp(name) {
- name = camelCase(name);
- return cssProps[name] || (cssProps[name] = getVendorProp(name));
- }
- function applyCss(element, prop, value) {
- prop = getStyleProp(prop);
- element.style[prop] = value;
- }
- return function(element, properties) {
- var args = arguments,
- prop,
- value;
- if (args.length == 2) {
- for (prop in properties) {
- value = properties[prop];
- if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
- }
- } else {
- applyCss(element, args[1], args[2]);
- }
- }
- })();
- /**
- * (Internal) Determines if an element or space separated list of class names contains a class name.
- */
- function hasClass(element, name) {
- var list = typeof element == 'string' ? element : classList(element);
- return list.indexOf(' ' + name + ' ') >= 0;
- }
- /**
- * (Internal) Adds a class to an element.
- */
- function addClass(element, name) {
- var oldList = classList(element),
- newList = oldList + name;
- if (hasClass(oldList, name)) return;
- // Trim the opening space.
- element.className = newList.substring(1);
- }
- /**
- * (Internal) Removes a class from an element.
- */
- function removeClass(element, name) {
- var oldList = classList(element),
- newList;
- if (!hasClass(element, name)) return;
- // Replace the class name.
- newList = oldList.replace(' ' + name + ' ', ' ');
- // Trim the opening and closing spaces.
- element.className = newList.substring(1, newList.length - 1);
- }
- /**
- * (Internal) Gets a space separated list of the class names on the element.
- * The list is wrapped with a single space on each end to facilitate finding
- * matches within the list.
- */
- function classList(element) {
- return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
- }
- /**
- * (Internal) Removes an element from the DOM.
- */
- function removeElement(element) {
- element && element.parentNode && element.parentNode.removeChild(element);
- }
- return NProgress;
- });
- ;define('nprogress', ['nprogress/nprogress'], function (main) { return main; });
- /*!
- * jQuery JavaScript Library v2.2.4
- * http://jquery.com/
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- *
- * Copyright jQuery Foundation and other contributors
- * Released under the MIT license
- * http://jquery.org/license
- *
- * Date: 2016-05-20T17:23Z
- */
- (function( global, factory ) {
- if ( typeof module === "object" && typeof module.exports === "object" ) {
- // For CommonJS and CommonJS-like environments where a proper `window`
- // is present, execute the factory and get jQuery.
- // For environments that do not have a `window` with a `document`
- // (such as Node.js), expose a factory as module.exports.
- // This accentuates the need for the creation of a real `window`.
- // e.g. var jQuery = require("jquery")(window);
- // See ticket #14549 for more info.
- module.exports = global.document ?
- factory( global, true ) :
- function( w ) {
- if ( !w.document ) {
- throw new Error( "jQuery requires a window with a document" );
- }
- return factory( w );
- };
- } else {
- factory( global );
- }
- // Pass this if window is not defined yet
- }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
- // Support: Firefox 18+
- // Can't be in strict mode, several libs including ASP.NET trace
- // the stack via arguments.caller.callee and Firefox dies if
- // you try to trace through "use strict" call chains. (#13335)
- //"use strict";
- var arr = [];
- var document = window.document;
- var slice = arr.slice;
- var concat = arr.concat;
- var push = arr.push;
- var indexOf = arr.indexOf;
- var class2type = {};
- var toString = class2type.toString;
- var hasOwn = class2type.hasOwnProperty;
- var support = {};
- var
- version = "2.2.4",
- // Define a local copy of jQuery
- jQuery = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- // Need init if jQuery is called (just allow error to be thrown if not included)
- return new jQuery.fn.init( selector, context );
- },
- // Support: Android<4.1
- // Make sure we trim BOM and NBSP
- rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
- // Matches dashed string for camelizing
- rmsPrefix = /^-ms-/,
- rdashAlpha = /-([\da-z])/gi,
- // Used by jQuery.camelCase as callback to replace()
- fcamelCase = function( all, letter ) {
- return letter.toUpperCase();
- };
- jQuery.fn = jQuery.prototype = {
- // The current version of jQuery being used
- jquery: version,
- constructor: jQuery,
- // Start with an empty selector
- selector: "",
- // The default length of a jQuery object is 0
- length: 0,
- toArray: function() {
- return slice.call( this );
- },
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num != null ?
- // Return just the one element from the set
- ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
- // Return all the elements in a clean array
- slice.call( this );
- },
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems ) {
- // Build a new jQuery matched element set
- var ret = jQuery.merge( this.constructor(), elems );
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
- ret.context = this.context;
- // Return the newly-formed element set
- return ret;
- },
- // Execute a callback for every element in the matched set.
- each: function( callback ) {
- return jQuery.each( this, callback );
- },
- map: function( callback ) {
- return this.pushStack( jQuery.map( this, function( elem, i ) {
- return callback.call( elem, i, elem );
- } ) );
- },
- slice: function() {
- return this.pushStack( slice.apply( this, arguments ) );
- },
- first: function() {
- return this.eq( 0 );
- },
- last: function() {
- return this.eq( -1 );
- },
- eq: function( i ) {
- var len = this.length,
- j = +i + ( i < 0 ? len : 0 );
- return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
- },
- end: function() {
- return this.prevObject || this.constructor();
- },
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: push,
- sort: arr.sort,
- splice: arr.splice
- };
- jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[ 0 ] || {},
- i = 1,
- length = arguments.length,
- deep = false;
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- // Skip the boolean and the target
- target = arguments[ i ] || {};
- i++;
- }
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
- target = {};
- }
- // Extend jQuery itself if only one argument is passed
- if ( i === length ) {
- target = this;
- i--;
- }
- for ( ; i < length; i++ ) {
- // Only deal with non-null/undefined values
- if ( ( options = arguments[ i ] ) != null ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
- ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
- if ( copyIsArray ) {
- copyIsArray = false;
- clone = src && jQuery.isArray( src ) ? src : [];
- } else {
- clone = src && jQuery.isPlainObject( src ) ? src : {};
- }
- // Never move original objects, clone them
- target[ name ] = jQuery.extend( deep, clone, copy );
- // Don't bring in undefined values
- } else if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
- // Return the modified object
- return target;
- };
- jQuery.extend( {
- // Unique for each copy of jQuery on the page
- expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
- // Assume jQuery is ready without the ready module
- isReady: true,
- error: function( msg ) {
- throw new Error( msg );
- },
- noop: function() {},
- isFunction: function( obj ) {
- return jQuery.type( obj ) === "function";
- },
- isArray: Array.isArray,
- isWindow: function( obj ) {
- return obj != null && obj === obj.window;
- },
- isNumeric: function( obj ) {
- // parseFloat NaNs numeric-cast false positives (null|true|false|"")
- // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
- // subtraction forces infinities to NaN
- // adding 1 corrects loss of precision from parseFloat (#15100)
- var realStringObj = obj && obj.toString();
- return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
- },
- isPlainObject: function( obj ) {
- var key;
- // Not plain objects:
- // - Any object or value whose internal [[Class]] property is not "[object Object]"
- // - DOM nodes
- // - window
- if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
- return false;
- }
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !hasOwn.call( obj, "constructor" ) &&
- !hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) {
- return false;
- }
- // Own properties are enumerated firstly, so to speed up,
- // if last one is own, then all properties are own
- for ( key in obj ) {}
- return key === undefined || hasOwn.call( obj, key );
- },
- isEmptyObject: function( obj ) {
- var name;
- for ( name in obj ) {
- return false;
- }
- return true;
- },
- type: function( obj ) {
- if ( obj == null ) {
- return obj + "";
- }
- // Support: Android<4.0, iOS<6 (functionish RegExp)
- return typeof obj === "object" || typeof obj === "function" ?
- class2type[ toString.call( obj ) ] || "object" :
- typeof obj;
- },
- // Evaluates a script in a global context
- globalEval: function( code ) {
- var script,
- indirect = eval;
- code = jQuery.trim( code );
- if ( code ) {
- // If the code includes a valid, prologue position
- // strict mode pragma, execute code by injecting a
- // script tag into the document.
- if ( code.indexOf( "use strict" ) === 1 ) {
- script = document.createElement( "script" );
- script.text = code;
- document.head.appendChild( script ).parentNode.removeChild( script );
- } else {
- // Otherwise, avoid the DOM node creation, insertion
- // and removal by using an indirect global eval
- indirect( code );
- }
- }
- },
- // Convert dashed to camelCase; used by the css and data modules
- // Support: IE9-11+
- // Microsoft forgot to hump their vendor prefix (#9572)
- camelCase: function( string ) {
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
- },
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
- },
- each: function( obj, callback ) {
- var length, i = 0;
- if ( isArrayLike( obj ) ) {
- length = obj.length;
- for ( ; i < length; i++ ) {
- if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
- break;
- }
- }
- } else {
- for ( i in obj ) {
- if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
- break;
- }
- }
- }
- return obj;
- },
- // Support: Android<4.1
- trim: function( text ) {
- return text == null ?
- "" :
- ( text + "" ).replace( rtrim, "" );
- },
- // results is for internal usage only
- makeArray: function( arr, results ) {
- var ret = results || [];
- if ( arr != null ) {
- if ( isArrayLike( Object( arr ) ) ) {
- jQuery.merge( ret,
- typeof arr === "string" ?
- [ arr ] : arr
- );
- } else {
- push.call( ret, arr );
- }
- }
- return ret;
- },
- inArray: function( elem, arr, i ) {
- return arr == null ? -1 : indexOf.call( arr, elem, i );
- },
- merge: function( first, second ) {
- var len = +second.length,
- j = 0,
- i = first.length;
- for ( ; j < len; j++ ) {
- first[ i++ ] = second[ j ];
- }
- first.length = i;
- return first;
- },
- grep: function( elems, callback, invert ) {
- var callbackInverse,
- matches = [],
- i = 0,
- length = elems.length,
- callbackExpect = !invert;
- // Go through the array, only saving the items
- // that pass the validator function
- for ( ; i < length; i++ ) {
- callbackInverse = !callback( elems[ i ], i );
- if ( callbackInverse !== callbackExpect ) {
- matches.push( elems[ i ] );
- }
- }
- return matches;
- },
- // arg is for internal usage only
- map: function( elems, callback, arg ) {
- var length, value,
- i = 0,
- ret = [];
- // Go through the array, translating each of the items to their new values
- if ( isArrayLike( elems ) ) {
- length = elems.length;
- for ( ; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
- if ( value != null ) {
- ret.push( value );
- }
- }
- // Go through every key on the object,
- } else {
- for ( i in elems ) {
- value = callback( elems[ i ], i, arg );
- if ( value != null ) {
- ret.push( value );
- }
- }
- }
- // Flatten any nested arrays
- return concat.apply( [], ret );
- },
- // A global GUID counter for objects
- guid: 1,
- // Bind a function to a context, optionally partially applying any
- // arguments.
- proxy: function( fn, context ) {
- var tmp, args, proxy;
- if ( typeof context === "string" ) {
- tmp = fn[ context ];
- context = fn;
- fn = tmp;
- }
- // Quick check to determine if target is callable, in the spec
- // this throws a TypeError, but we will just return undefined.
- if ( !jQuery.isFunction( fn ) ) {
- return undefined;
- }
- // Simulated bind
- args = slice.call( arguments, 2 );
- proxy = function() {
- return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
- };
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || jQuery.guid++;
- return proxy;
- },
- now: Date.now,
- // jQuery.support is not used in Core but other projects attach their
- // properties to it so it needs to exist.
- support: support
- } );
- // JSHint would error on this code due to the Symbol not being defined in ES5.
- // Defining this global in .jshintrc would create a danger of using the global
- // unguarded in another place, it seems safer to just disable JSHint for these
- // three lines.
- /* jshint ignore: start */
- if ( typeof Symbol === "function" ) {
- jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
- }
- /* jshint ignore: end */
- // Populate the class2type map
- jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
- function( i, name ) {
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
- } );
- function isArrayLike( obj ) {
- // Support: iOS 8.2 (not reproducible in simulator)
- // `in` check used to prevent JIT error (gh-2145)
- // hasOwn isn't used here due to false negatives
- // regarding Nodelist length in IE
- var length = !!obj && "length" in obj && obj.length,
- type = jQuery.type( obj );
- if ( type === "function" || jQuery.isWindow( obj ) ) {
- return false;
- }
- return type === "array" || length === 0 ||
- typeof length === "number" && length > 0 && ( length - 1 ) in obj;
- }
- var Sizzle =
- /*!
- * Sizzle CSS Selector Engine v2.2.1
- * http://sizzlejs.com/
- *
- * Copyright jQuery Foundation and other contributors
- * Released under the MIT license
- * http://jquery.org/license
- *
- * Date: 2015-10-17
- */
- (function( window ) {
- var i,
- support,
- Expr,
- getText,
- isXML,
- tokenize,
- compile,
- select,
- outermostContext,
- sortInput,
- hasDuplicate,
- // Local document vars
- setDocument,
- document,
- docElem,
- documentIsHTML,
- rbuggyQSA,
- rbuggyMatches,
- matches,
- contains,
- // Instance-specific data
- expando = "sizzle" + 1 * new Date(),
- preferredDoc = window.document,
- dirruns = 0,
- done = 0,
- classCache = createCache(),
- tokenCache = createCache(),
- compilerCache = createCache(),
- sortOrder = function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- }
- return 0;
- },
- // General-purpose constants
- MAX_NEGATIVE = 1 << 31,
- // Instance methods
- hasOwn = ({}).hasOwnProperty,
- arr = [],
- pop = arr.pop,
- push_native = arr.push,
- push = arr.push,
- slice = arr.slice,
- // Use a stripped-down indexOf as it's faster than native
- // http://jsperf.com/thor-indexof-vs-for/5
- indexOf = function( list, elem ) {
- var i = 0,
- len = list.length;
- for ( ; i < len; i++ ) {
- if ( list[i] === elem ) {
- return i;
- }
- }
- return -1;
- },
- booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
- // Regular expressions
- // http://www.w3.org/TR/css3-selectors/#whitespace
- whitespace = "[\\x20\\t\\r\\n\\f]",
- // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
- identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
- // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
- attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
- // Operator (capture 2)
- "*([*^$|!~]?=)" + whitespace +
- // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
- "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
- "*\\]",
- pseudos = ":(" + identifier + ")(?:\\((" +
- // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
- // 1. quoted (capture 3; capture 4 or capture 5)
- "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
- // 2. simple (capture 6)
- "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
- // 3. anything else (capture 2)
- ".*" +
- ")\\)|)",
- // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
- rwhitespace = new RegExp( whitespace + "+", "g" ),
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
- rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
- rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
- rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
- rpseudo = new RegExp( pseudos ),
- ridentifier = new RegExp( "^" + identifier + "$" ),
- matchExpr = {
- "ID": new RegExp( "^#(" + identifier + ")" ),
- "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
- "TAG": new RegExp( "^(" + identifier + "|[*])" ),
- "ATTR": new RegExp( "^" + attributes ),
- "PSEUDO": new RegExp( "^" + pseudos ),
- "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
- "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
- "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
- // For use in libraries implementing .is()
- // We use this for POS matching in `select`
- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
- whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
- },
- rinputs = /^(?:input|select|textarea|button)$/i,
- rheader = /^h\d$/i,
- rnative = /^[^{]+\{\s*\[native \w/,
- // Easily-parseable/retrievable ID or TAG or CLASS selectors
- rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
- rsibling = /[+~]/,
- rescape = /'|\\/g,
- // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
- runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
- funescape = function( _, escaped, escapedWhitespace ) {
- var high = "0x" + escaped - 0x10000;
- // NaN means non-codepoint
- // Support: Firefox<24
- // Workaround erroneous numeric interpretation of +"0x"
- return high !== high || escapedWhitespace ?
- escaped :
- high < 0 ?
- // BMP codepoint
- String.fromCharCode( high + 0x10000 ) :
- // Supplemental Plane codepoint (surrogate pair)
- String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
- },
- // Used for iframes
- // See setDocument()
- // Removing the function wrapper causes a "Permission Denied"
- // error in IE
- unloadHandler = function() {
- setDocument();
- };
- // Optimize for push.apply( _, NodeList )
- try {
- push.apply(
- (arr = slice.call( preferredDoc.childNodes )),
- preferredDoc.childNodes
- );
- // Support: Android<4.0
- // Detect silently failing push.apply
- arr[ preferredDoc.childNodes.length ].nodeType;
- } catch ( e ) {
- push = { apply: arr.length ?
- // Leverage slice if possible
- function( target, els ) {
- push_native.apply( target, slice.call(els) );
- } :
- // Support: IE<9
- // Otherwise append directly
- function( target, els ) {
- var j = target.length,
- i = 0;
- // Can't trust NodeList.length
- while ( (target[j++] = els[i++]) ) {}
- target.length = j - 1;
- }
- };
- }
- function Sizzle( selector, context, results, seed ) {
- var m, i, elem, nid, nidselect, match, groups, newSelector,
- newContext = context && context.ownerDocument,
- // nodeType defaults to 9, since context defaults to document
- nodeType = context ? context.nodeType : 9;
- results = results || [];
- // Return early from calls with invalid selector or context
- if ( typeof selector !== "string" || !selector ||
- nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
- return results;
- }
- // Try to shortcut find operations (as opposed to filters) in HTML documents
- if ( !seed ) {
- if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
- setDocument( context );
- }
- context = context || document;
- if ( documentIsHTML ) {
- // If the selector is sufficiently simple, try using a "get*By*" DOM method
- // (excepting DocumentFragment context, where the methods don't exist)
- if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
- // ID selector
- if ( (m = match[1]) ) {
- // Document context
- if ( nodeType === 9 ) {
- if ( (elem = context.getElementById( m )) ) {
- // Support: IE, Opera, Webkit
- // TODO: identify versions
- // getElementById can match elements by name instead of ID
- if ( elem.id === m ) {
- results.push( elem );
- return results;
- }
- } else {
- return results;
- }
- // Element context
- } else {
- // Support: IE, Opera, Webkit
- // TODO: identify versions
- // getElementById can match elements by name instead of ID
- if ( newContext && (elem = newContext.getElementById( m )) &&
- contains( context, elem ) &&
- elem.id === m ) {
- results.push( elem );
- return results;
- }
- }
- // Type selector
- } else if ( match[2] ) {
- push.apply( results, context.getElementsByTagName( selector ) );
- return results;
- // Class selector
- } else if ( (m = match[3]) && support.getElementsByClassName &&
- context.getElementsByClassName ) {
- push.apply( results, context.getElementsByClassName( m ) );
- return results;
- }
- }
- // Take advantage of querySelectorAll
- if ( support.qsa &&
- !compilerCache[ selector + " " ] &&
- (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
- if ( nodeType !== 1 ) {
- newContext = context;
- newSelector = selector;
- // qSA looks outside Element context, which is not what we want
- // Thanks to Andrew Dupont for this workaround technique
- // Support: IE <=8
- // Exclude object elements
- } else if ( context.nodeName.toLowerCase() !== "object" ) {
- // Capture the context ID, setting it first if necessary
- if ( (nid = context.getAttribute( "id" )) ) {
- nid = nid.replace( rescape, "\\$&" );
- } else {
- context.setAttribute( "id", (nid = expando) );
- }
- // Prefix every selector in the list
- groups = tokenize( selector );
- i = groups.length;
- nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
- while ( i-- ) {
- groups[i] = nidselect + " " + toSelector( groups[i] );
- }
- newSelector = groups.join( "," );
- // Expand context for sibling selectors
- newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
- context;
- }
- if ( newSelector ) {
- try {
- push.apply( results,
- newContext.querySelectorAll( newSelector )
- );
- return results;
- } catch ( qsaError ) {
- } finally {
- if ( nid === expando ) {
- context.removeAttribute( "id" );
- }
- }
- }
- }
- }
- }
- // All others
- return select( selector.replace( rtrim, "$1" ), context, results, seed );
- }
- /**
- * Create key-value caches of limited size
- * @returns {function(string, object)} Returns the Object data after storing it on itself with
- * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
- * deleting the oldest entry
- */
- function createCache() {
- var keys = [];
- function cache( key, value ) {
- // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
- if ( keys.push( key + " " ) > Expr.cacheLength ) {
- // Only keep the most recent entries
- delete cache[ keys.shift() ];
- }
- return (cache[ key + " " ] = value);
- }
- return cache;
- }
- /**
- * Mark a function for special use by Sizzle
- * @param {Function} fn The function to mark
- */
- function markFunction( fn ) {
- fn[ expando ] = true;
- return fn;
- }
- /**
- * Support testing using an element
- * @param {Function} fn Passed the created div and expects a boolean result
- */
- function assert( fn ) {
- var div = document.createElement("div");
- try {
- return !!fn( div );
- } catch (e) {
- return false;
- } finally {
- // Remove from its parent by default
- if ( div.parentNode ) {
- div.parentNode.removeChild( div );
- }
- // release memory in IE
- div = null;
- }
- }
- /**
- * Adds the same handler for all of the specified attrs
- * @param {String} attrs Pipe-separated list of attributes
- * @param {Function} handler The method that will be applied
- */
- function addHandle( attrs, handler ) {
- var arr = attrs.split("|"),
- i = arr.length;
- while ( i-- ) {
- Expr.attrHandle[ arr[i] ] = handler;
- }
- }
- /**
- * Checks document order of two siblings
- * @param {Element} a
- * @param {Element} b
- * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
- */
- function siblingCheck( a, b ) {
- var cur = b && a,
- diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
- ( ~b.sourceIndex || MAX_NEGATIVE ) -
- ( ~a.sourceIndex || MAX_NEGATIVE );
- // Use IE sourceIndex if available on both nodes
- if ( diff ) {
- return diff;
- }
- // Check if b follows a
- if ( cur ) {
- while ( (cur = cur.nextSibling) ) {
- if ( cur === b ) {
- return -1;
- }
- }
- }
- return a ? 1 : -1;
- }
- /**
- * Returns a function to use in pseudos for input types
- * @param {String} type
- */
- function createInputPseudo( type ) {
- return function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === type;
- };
- }
- /**
- * Returns a function to use in pseudos for buttons
- * @param {String} type
- */
- function createButtonPseudo( type ) {
- return function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && elem.type === type;
- };
- }
- /**
- * Returns a function to use in pseudos for positionals
- * @param {Function} fn
- */
- function createPositionalPseudo( fn ) {
- return markFunction(function( argument ) {
- argument = +argument;
- return markFunction(function( seed, matches ) {
- var j,
- matchIndexes = fn( [], seed.length, argument ),
- i = matchIndexes.length;
- // Match elements found at the specified indexes
- while ( i-- ) {
- if ( seed[ (j = matchIndexes[i]) ] ) {
- seed[j] = !(matches[j] = seed[j]);
- }
- }
- });
- });
- }
- /**
- * Checks a node for validity as a Sizzle context
- * @param {Element|Object=} context
- * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
- */
- function testContext( context ) {
- return context && typeof context.getElementsByTagName !== "undefined" && context;
- }
- // Expose support vars for convenience
- support = Sizzle.support = {};
- /**
- * Detects XML nodes
- * @param {Element|Object} elem An element or a document
- * @returns {Boolean} True iff elem is a non-HTML XML node
- */
- isXML = Sizzle.isXML = function( elem ) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
- return documentElement ? documentElement.nodeName !== "HTML" : false;
- };
- /**
- * Sets document-related variables once based on the current document
- * @param {Element|Object} [doc] An element or document object to use to set the document
- * @returns {Object} Returns the current document
- */
- setDocument = Sizzle.setDocument = function( node ) {
- var hasCompare, parent,
- doc = node ? node.ownerDocument || node : preferredDoc;
- // Return early if doc is invalid or already selected
- if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
- return document;
- }
- // Update global variables
- document = doc;
- docElem = document.documentElement;
- documentIsHTML = !isXML( document );
- // Support: IE 9-11, Edge
- // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
- if ( (parent = document.defaultView) && parent.top !== parent ) {
- // Support: IE 11
- if ( parent.addEventListener ) {
- parent.addEventListener( "unload", unloadHandler, false );
- // Support: IE 9 - 10 only
- } else if ( parent.attachEvent ) {
- parent.attachEvent( "onunload", unloadHandler );
- }
- }
- /* Attributes
- ---------------------------------------------------------------------- */
- // Support: IE<8
- // Verify that getAttribute really returns attributes and not properties
- // (excepting IE8 booleans)
- support.attributes = assert(function( div ) {
- div.className = "i";
- return !div.getAttribute("className");
- });
- /* getElement(s)By*
- ---------------------------------------------------------------------- */
- // Check if getElementsByTagName("*") returns only elements
- support.getElementsByTagName = assert(function( div ) {
- div.appendChild( document.createComment("") );
- return !div.getElementsByTagName("*").length;
- });
- // Support: IE<9
- support.getElementsByClassName = rnative.test( document.getElementsByClassName );
- // Support: IE<10
- // Check if getElementById returns elements by name
- // The broken getElementById methods don't pick up programatically-set names,
- // so use a roundabout getElementsByName test
- support.getById = assert(function( div ) {
- docElem.appendChild( div ).id = expando;
- return !document.getElementsByName || !document.getElementsByName( expando ).length;
- });
- // ID find and filter
- if ( support.getById ) {
- Expr.find["ID"] = function( id, context ) {
- if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
- var m = context.getElementById( id );
- return m ? [ m ] : [];
- }
- };
- Expr.filter["ID"] = function( id ) {
- var attrId = id.replace( runescape, funescape );
- return function( elem ) {
- return elem.getAttribute("id") === attrId;
- };
- };
- } else {
- // Support: IE6/7
- // getElementById is not reliable as a find shortcut
- delete Expr.find["ID"];
- Expr.filter["ID"] = function( id ) {
- var attrId = id.replace( runescape, funescape );
- return function( elem ) {
- var node = typeof elem.getAttributeNode !== "undefined" &&
- elem.getAttributeNode("id");
- return node && node.value === attrId;
- };
- };
- }
- // Tag
- Expr.find["TAG"] = support.getElementsByTagName ?
- function( tag, context ) {
- if ( typeof context.getElementsByTagName !== "undefined" ) {
- return context.getElementsByTagName( tag );
- // DocumentFragment nodes don't have gEBTN
- } else if ( support.qsa ) {
- return context.querySelectorAll( tag );
- }
- } :
- function( tag, context ) {
- var elem,
- tmp = [],
- i = 0,
- // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
- results = context.getElementsByTagName( tag );
- // Filter out possible comments
- if ( tag === "*" ) {
- while ( (elem = results[i++]) ) {
- if ( elem.nodeType === 1 ) {
- tmp.push( elem );
- }
- }
- return tmp;
- }
- return results;
- };
- // Class
- Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
- if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
- return context.getElementsByClassName( className );
- }
- };
- /* QSA/matchesSelector
- ---------------------------------------------------------------------- */
- // QSA and matchesSelector support
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
- rbuggyMatches = [];
- // qSa(:focus) reports false when true (Chrome 21)
- // We allow this because of a bug in IE8/9 that throws an error
- // whenever `document.activeElement` is accessed on an iframe
- // So, we allow :focus to pass through QSA all the time to avoid the IE error
- // See http://bugs.jquery.com/ticket/13378
- rbuggyQSA = [];
- if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
- // Build QSA regex
- // Regex strategy adopted from Diego Perini
- assert(function( div ) {
- // Select is set to empty string on purpose
- // This is to test IE's treatment of not explicitly
- // setting a boolean content attribute,
- // since its presence should be enough
- // http://bugs.jquery.com/ticket/12359
- docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
- "<select id='" + expando + "-\r\\' msallowcapture=''>" +
- "<option selected=''></option></select>";
- // Support: IE8, Opera 11-12.16
- // Nothing should be selected when empty strings follow ^= or $= or *=
- // The test attribute must be unknown in Opera but "safe" for WinRT
- // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
- if ( div.querySelectorAll("[msallowcapture^='']").length ) {
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
- }
- // Support: IE8
- // Boolean attributes and "value" are not treated correctly
- if ( !div.querySelectorAll("[selected]").length ) {
- rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
- }
- // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
- if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
- rbuggyQSA.push("~=");
- }
- // Webkit/Opera - :checked should return selected option elements
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
- // IE8 throws error here and will not see later tests
- if ( !div.querySelectorAll(":checked").length ) {
- rbuggyQSA.push(":checked");
- }
- // Support: Safari 8+, iOS 8+
- // https://bugs.webkit.org/show_bug.cgi?id=136851
- // In-page `selector#id sibing-combinator selector` fails
- if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
- rbuggyQSA.push(".#.+[+~]");
- }
- });
- assert(function( div ) {
- // Support: Windows 8 Native Apps
- // The type and name attributes are restricted during .innerHTML assignment
- var input = document.createElement("input");
- input.setAttribute( "type", "hidden" );
- div.appendChild( input ).setAttribute( "name", "D" );
- // Support: IE8
- // Enforce case-sensitivity of name attribute
- if ( div.querySelectorAll("[name=d]").length ) {
- rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
- }
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
- // IE8 throws error here and will not see later tests
- if ( !div.querySelectorAll(":enabled").length ) {
- rbuggyQSA.push( ":enabled", ":disabled" );
- }
- // Opera 10-11 does not throw on post-comma invalid pseudos
- div.querySelectorAll("*,:x");
- rbuggyQSA.push(",.*:");
- });
- }
- if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
- docElem.webkitMatchesSelector ||
- docElem.mozMatchesSelector ||
- docElem.oMatchesSelector ||
- docElem.msMatchesSelector) )) ) {
- assert(function( div ) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9)
- support.disconnectedMatch = matches.call( div, "div" );
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call( div, "[s!='']:x" );
- rbuggyMatches.push( "!=", pseudos );
- });
- }
- rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
- rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
- /* Contains
- ---------------------------------------------------------------------- */
- hasCompare = rnative.test( docElem.compareDocumentPosition );
- // Element contains another
- // Purposefully self-exclusive
- // As in, an element does not contain itself
- contains = hasCompare || rnative.test( docElem.contains ) ?
- function( a, b ) {
- var adown = a.nodeType === 9 ? a.documentElement : a,
- bup = b && b.parentNode;
- return a === bup || !!( bup && bup.nodeType === 1 && (
- adown.contains ?
- adown.contains( bup ) :
- a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
- ));
- } :
- function( a, b ) {
- if ( b ) {
- while ( (b = b.parentNode) ) {
- if ( b === a ) {
- return true;
- }
- }
- }
- return false;
- };
- /* Sorting
- ---------------------------------------------------------------------- */
- // Document order sorting
- sortOrder = hasCompare ?
- function( a, b ) {
- // Flag for duplicate removal
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
- // Sort on method existence if only one input has compareDocumentPosition
- var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
- if ( compare ) {
- return compare;
- }
- // Calculate position if both inputs belong to the same document
- compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
- a.compareDocumentPosition( b ) :
- // Otherwise we know they are disconnected
- 1;
- // Disconnected nodes
- if ( compare & 1 ||
- (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
- // Choose the first element that is related to our preferred document
- if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
- return -1;
- }
- if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
- return 1;
- }
- // Maintain original order
- return sortInput ?
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
- 0;
- }
- return compare & 4 ? -1 : 1;
- } :
- function( a, b ) {
- // Exit early if the nodes are identical
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
- var cur,
- i = 0,
- aup = a.parentNode,
- bup = b.parentNode,
- ap = [ a ],
- bp = [ b ];
- // Parentless nodes are either documents or disconnected
- if ( !aup || !bup ) {
- return a === document ? -1 :
- b === document ? 1 :
- aup ? -1 :
- bup ? 1 :
- sortInput ?
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
- 0;
- // If the nodes are siblings, we can do a quick check
- } else if ( aup === bup ) {
- return siblingCheck( a, b );
- }
- // Otherwise we need full lists of their ancestors for comparison
- cur = a;
- while ( (cur = cur.parentNode) ) {
- ap.unshift( cur );
- }
- cur = b;
- while ( (cur = cur.parentNode) ) {
- bp.unshift( cur );
- }
- // Walk down the tree looking for a discrepancy
- while ( ap[i] === bp[i] ) {
- i++;
- }
- return i ?
- // Do a sibling check if the nodes have a common ancestor
- siblingCheck( ap[i], bp[i] ) :
- // Otherwise nodes in our document sort first
- ap[i] === preferredDoc ? -1 :
- bp[i] === preferredDoc ? 1 :
- 0;
- };
- return document;
- };
- Sizzle.matches = function( expr, elements ) {
- return Sizzle( expr, null, null, elements );
- };
- Sizzle.matchesSelector = function( elem, expr ) {
- // Set document vars if needed
- if ( ( elem.ownerDocument || elem ) !== document ) {
- setDocument( elem );
- }
- // Make sure that attribute selectors are quoted
- expr = expr.replace( rattributeQuotes, "='$1']" );
- if ( support.matchesSelector && documentIsHTML &&
- !compilerCache[ expr + " " ] &&
- ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
- ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
- try {
- var ret = matches.call( elem, expr );
- // IE 9's matchesSelector returns false on disconnected nodes
- if ( ret || support.disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9
- elem.document && elem.document.nodeType !== 11 ) {
- return ret;
- }
- } catch (e) {}
- }
- return Sizzle( expr, document, null, [ elem ] ).length > 0;
- };
- Sizzle.contains = function( context, elem ) {
- // Set document vars if needed
- if ( ( context.ownerDocument || context ) !== document ) {
- setDocument( context );
- }
- return contains( context, elem );
- };
- Sizzle.attr = function( elem, name ) {
- // Set document vars if needed
- if ( ( elem.ownerDocument || elem ) !== document ) {
- setDocument( elem );
- }
- var fn = Expr.attrHandle[ name.toLowerCase() ],
- // Don't get fooled by Object.prototype properties (jQuery #13807)
- val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
- fn( elem, name, !documentIsHTML ) :
- undefined;
- return val !== undefined ?
- val :
- support.attributes || !documentIsHTML ?
- elem.getAttribute( name ) :
- (val = elem.getAttributeNode(name)) && val.specified ?
- val.value :
- null;
- };
- Sizzle.error = function( msg ) {
- throw new Error( "Syntax error, unrecognized expression: " + msg );
- };
- /**
- * Document sorting and removing duplicates
- * @param {ArrayLike} results
- */
- Sizzle.uniqueSort = function( results ) {
- var elem,
- duplicates = [],
- j = 0,
- i = 0;
- // Unless we *know* we can detect duplicates, assume their presence
- hasDuplicate = !support.detectDuplicates;
- sortInput = !support.sortStable && results.slice( 0 );
- results.sort( sortOrder );
- if ( hasDuplicate ) {
- while ( (elem = results[i++]) ) {
- if ( elem === results[ i ] ) {
- j = duplicates.push( i );
- }
- }
- while ( j-- ) {
- results.splice( duplicates[ j ], 1 );
- }
- }
- // Clear input after sorting to release objects
- // See https://github.com/jquery/sizzle/pull/225
- sortInput = null;
- return results;
- };
- /**
- * Utility function for retrieving the text value of an array of DOM nodes
- * @param {Array|Element} elem
- */
- getText = Sizzle.getText = function( elem ) {
- var node,
- ret = "",
- i = 0,
- nodeType = elem.nodeType;
- if ( !nodeType ) {
- // If no nodeType, this is expected to be an array
- while ( (node = elem[i++]) ) {
- // Do not traverse comment nodes
- ret += getText( node );
- }
- } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
- // Use textContent for elements
- // innerText usage removed for consistency of new lines (jQuery #11153)
- if ( typeof elem.textContent === "string" ) {
- return elem.textContent;
- } else {
- // Traverse its children
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
- ret += getText( elem );
- }
- }
- } else if ( nodeType === 3 || nodeType === 4 ) {
- return elem.nodeValue;
- }
- // Do not include comment or processing instruction nodes
- return ret;
- };
- Expr = Sizzle.selectors = {
- // Can be adjusted by the user
- cacheLength: 50,
- createPseudo: markFunction,
- match: matchExpr,
- attrHandle: {},
- find: {},
- relative: {
- ">": { dir: "parentNode", first: true },
- " ": { dir: "parentNode" },
- "+": { dir: "previousSibling", first: true },
- "~": { dir: "previousSibling" }
- },
- preFilter: {
- "ATTR": function( match ) {
- match[1] = match[1].replace( runescape, funescape );
- // Move the given value to match[3] whether quoted or unquoted
- match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
- if ( match[2] === "~=" ) {
- match[3] = " " + match[3] + " ";
- }
- return match.slice( 0, 4 );
- },
- "CHILD": function( match ) {
- /* matches from matchExpr["CHILD"]
- 1 type (only|nth|...)
- 2 what (child|of-type)
- 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
- 4 xn-component of xn+y argument ([+-]?\d*n|)
- 5 sign of xn-component
- 6 x of xn-component
- 7 sign of y-component
- 8 y of y-component
- */
- match[1] = match[1].toLowerCase();
- if ( match[1].slice( 0, 3 ) === "nth" ) {
- // nth-* requires argument
- if ( !match[3] ) {
- Sizzle.error( match[0] );
- }
- // numeric x and y parameters for Expr.filter.CHILD
- // remember that false/true cast respectively to 0/1
- match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
- match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
- // other types prohibit arguments
- } else if ( match[3] ) {
- Sizzle.error( match[0] );
- }
- return match;
- },
- "PSEUDO": function( match ) {
- var excess,
- unquoted = !match[6] && match[2];
- if ( matchExpr["CHILD"].test( match[0] ) ) {
- return null;
- }
- // Accept quoted arguments as-is
- if ( match[3] ) {
- match[2] = match[4] || match[5] || "";
- // Strip excess characters from unquoted arguments
- } else if ( unquoted && rpseudo.test( unquoted ) &&
- // Get excess from tokenize (recursively)
- (excess = tokenize( unquoted, true )) &&
- // advance to the next closing parenthesis
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
- // excess is a negative index
- match[0] = match[0].slice( 0, excess );
- match[2] = unquoted.slice( 0, excess );
- }
- // Return only captures needed by the pseudo filter method (type and argument)
- return match.slice( 0, 3 );
- }
- },
- filter: {
- "TAG": function( nodeNameSelector ) {
- var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
- return nodeNameSelector === "*" ?
- function() { return true; } :
- function( elem ) {
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
- };
- },
- "CLASS": function( className ) {
- var pattern = classCache[ className + " " ];
- return pattern ||
- (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
- classCache( className, function( elem ) {
- return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
- });
- },
- "ATTR": function( name, operator, check ) {
- return function( elem ) {
- var result = Sizzle.attr( elem, name );
- if ( result == null ) {
- return operator === "!=";
- }
- if ( !operator ) {
- return true;
- }
- result += "";
- return operator === "=" ? result === check :
- operator === "!=" ? result !== check :
- operator === "^=" ? check && result.indexOf( check ) === 0 :
- operator === "*=" ? check && result.indexOf( check ) > -1 :
- operator === "$=" ? check && result.slice( -check.length ) === check :
- operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
- operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
- false;
- };
- },
- "CHILD": function( type, what, argument, first, last ) {
- var simple = type.slice( 0, 3 ) !== "nth",
- forward = type.slice( -4 ) !== "last",
- ofType = what === "of-type";
- return first === 1 && last === 0 ?
- // Shortcut for :nth-*(n)
- function( elem ) {
- return !!elem.parentNode;
- } :
- function( elem, context, xml ) {
- var cache, uniqueCache, outerCache, node, nodeIndex, start,
- dir = simple !== forward ? "nextSibling" : "previousSibling",
- parent = elem.parentNode,
- name = ofType && elem.nodeName.toLowerCase(),
- useCache = !xml && !ofType,
- diff = false;
- if ( parent ) {
- // :(first|last|only)-(child|of-type)
- if ( simple ) {
- while ( dir ) {
- node = elem;
- while ( (node = node[ dir ]) ) {
- if ( ofType ?
- node.nodeName.toLowerCase() === name :
- node.nodeType === 1 ) {
- return false;
- }
- }
- // Reverse direction for :only-* (if we haven't yet done so)
- start = dir = type === "only" && !start && "nextSibling";
- }
- return true;
- }
- start = [ forward ? parent.firstChild : parent.lastChild ];
- // non-xml :nth-child(...) stores cache data on `parent`
- if ( forward && useCache ) {
- // Seek `elem` from a previously-cached index
- // ...in a gzip-friendly way
- node = parent;
- outerCache = node[ expando ] || (node[ expando ] = {});
- // Support: IE <9 only
- // Defend against cloned attroperties (jQuery gh-1709)
- uniqueCache = outerCache[ node.uniqueID ] ||
- (outerCache[ node.uniqueID ] = {});
- cache = uniqueCache[ type ] || [];
- nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
- diff = nodeIndex && cache[ 2 ];
- node = nodeIndex && parent.childNodes[ nodeIndex ];
- while ( (node = ++nodeIndex && node && node[ dir ] ||
- // Fallback to seeking `elem` from the start
- (diff = nodeIndex = 0) || start.pop()) ) {
- // When found, cache indexes on `parent` and break
- if ( node.nodeType === 1 && ++diff && node === elem ) {
- uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
- break;
- }
- }
- } else {
- // Use previously-cached element index if available
- if ( useCache ) {
- // ...in a gzip-friendly way
- node = elem;
- outerCache = node[ expando ] || (node[ expando ] = {});
- // Support: IE <9 only
- // Defend against cloned attroperties (jQuery gh-1709)
- uniqueCache = outerCache[ node.uniqueID ] ||
- (outerCache[ node.uniqueID ] = {});
- cache = uniqueCache[ type ] || [];
- nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
- diff = nodeIndex;
- }
- // xml :nth-child(...)
- // or :nth-last-child(...) or :nth(-last)?-of-type(...)
- if ( diff === false ) {
- // Use the same loop as above to seek `elem` from the start
- while ( (node = ++nodeIndex && node && node[ dir ] ||
- (diff = nodeIndex = 0) || start.pop()) ) {
- if ( ( ofType ?
- node.nodeName.toLowerCase() === name :
- node.nodeType === 1 ) &&
- ++diff ) {
- // Cache the index of each encountered element
- if ( useCache ) {
- outerCache = node[ expando ] || (node[ expando ] = {});
- // Support: IE <9 only
- // Defend against cloned attroperties (jQuery gh-1709)
- uniqueCache = outerCache[ node.uniqueID ] ||
- (outerCache[ node.uniqueID ] = {});
- uniqueCache[ type ] = [ dirruns, diff ];
- }
- if ( node === elem ) {
- break;
- }
- }
- }
- }
- }
- // Incorporate the offset, then check against cycle size
- diff -= last;
- return diff === first || ( diff % first === 0 && diff / first >= 0 );
- }
- };
- },
- "PSEUDO": function( pseudo, argument ) {
- // pseudo-class names are case-insensitive
- // http://www.w3.org/TR/selectors/#pseudo-classes
- // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
- // Remember that setFilters inherits from pseudos
- var args,
- fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
- Sizzle.error( "unsupported pseudo: " + pseudo );
- // The user may use createPseudo to indicate that
- // arguments are needed to create the filter function
- // just as Sizzle does
- if ( fn[ expando ] ) {
- return fn( argument );
- }
- // But maintain support for old signatures
- if ( fn.length > 1 ) {
- args = [ pseudo, pseudo, "", argument ];
- return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
- markFunction(function( seed, matches ) {
- var idx,
- matched = fn( seed, argument ),
- i = matched.length;
- while ( i-- ) {
- idx = indexOf( seed, matched[i] );
- seed[ idx ] = !( matches[ idx ] = matched[i] );
- }
- }) :
- function( elem ) {
- return fn( elem, 0, args );
- };
- }
- return fn;
- }
- },
- pseudos: {
- // Potentially complex pseudos
- "not": markFunction(function( selector ) {
- // Trim the selector passed to compile
- // to avoid treating leading and trailing
- // spaces as combinators
- var input = [],
- results = [],
- matcher = compile( selector.replace( rtrim, "$1" ) );
- return matcher[ expando ] ?
- markFunction(function( seed, matches, context, xml ) {
- var elem,
- unmatched = matcher( seed, null, xml, [] ),
- i = seed.length;
- // Match elements unmatched by `matcher`
- while ( i-- ) {
- if ( (elem = unmatched[i]) ) {
- seed[i] = !(matches[i] = elem);
- }
- }
- }) :
- function( elem, context, xml ) {
- input[0] = elem;
- matcher( input, null, xml, results );
- // Don't keep the element (issue #299)
- input[0] = null;
- return !results.pop();
- };
- }),
- "has": markFunction(function( selector ) {
- return function( elem ) {
- return Sizzle( selector, elem ).length > 0;
- };
- }),
- "contains": markFunction(function( text ) {
- text = text.replace( runescape, funescape );
- return function( elem ) {
- return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
- };
- }),
- // "Whether an element is represented by a :lang() selector
- // is based solely on the element's language value
- // being equal to the identifier C,
- // or beginning with the identifier C immediately followed by "-".
- // The matching of C against the element's language value is performed case-insensitively.
- // The identifier C does not have to be a valid language name."
- // http://www.w3.org/TR/selectors/#lang-pseudo
- "lang": markFunction( function( lang ) {
- // lang value must be a valid identifier
- if ( !ridentifier.test(lang || "") ) {
- Sizzle.error( "unsupported lang: " + lang );
- }
- lang = lang.replace( runescape, funescape ).toLowerCase();
- return function( elem ) {
- var elemLang;
- do {
- if ( (elemLang = documentIsHTML ?
- elem.lang :
- elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
- elemLang = elemLang.toLowerCase();
- return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
- }
- } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
- return false;
- };
- }),
- // Miscellaneous
- "target": function( elem ) {
- var hash = window.location && window.location.hash;
- return hash && hash.slice( 1 ) === elem.id;
- },
- "root": function( elem ) {
- return elem === docElem;
- },
- "focus": function( elem ) {
- return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
- },
- // Boolean properties
- "enabled": function( elem ) {
- return elem.disabled === false;
- },
- "disabled": function( elem ) {
- return elem.disabled === true;
- },
- "checked": function( elem ) {
- // In CSS3, :checked should return both checked and selected elements
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
- var nodeName = elem.nodeName.toLowerCase();
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
- },
- "selected": function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if ( elem.parentNode ) {
- elem.parentNode.selectedIndex;
- }
- return elem.selected === true;
- },
- // Contents
- "empty": function( elem ) {
- // http://www.w3.org/TR/selectors/#empty-pseudo
- // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
- // but not by others (comment: 8; processing instruction: 7; etc.)
- // nodeType < 6 works because attributes (2) do not appear as children
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
- if ( elem.nodeType < 6 ) {
- return false;
- }
- }
- return true;
- },
- "parent": function( elem ) {
- return !Expr.pseudos["empty"]( elem );
- },
- // Element/input types
- "header": function( elem ) {
- return rheader.test( elem.nodeName );
- },
- "input": function( elem ) {
- return rinputs.test( elem.nodeName );
- },
- "button": function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === "button" || name === "button";
- },
- "text": function( elem ) {
- var attr;
- return elem.nodeName.toLowerCase() === "input" &&
- elem.type === "text" &&
- // Support: IE<8
- // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
- },
- // Position-in-collection
- "first": createPositionalPseudo(function() {
- return [ 0 ];
- }),
- "last": createPositionalPseudo(function( matchIndexes, length ) {
- return [ length - 1 ];
- }),
- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
- return [ argument < 0 ? argument + length : argument ];
- }),
- "even": createPositionalPseudo(function( matchIndexes, length ) {
- var i = 0;
- for ( ; i < length; i += 2 ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- }),
- "odd": createPositionalPseudo(function( matchIndexes, length ) {
- var i = 1;
- for ( ; i < length; i += 2 ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- }),
- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
- var i = argument < 0 ? argument + length : argument;
- for ( ; --i >= 0; ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- }),
- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
- var i = argument < 0 ? argument + length : argument;
- for ( ; ++i < length; ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- })
- }
- };
- Expr.pseudos["nth"] = Expr.pseudos["eq"];
- // Add button/input type pseudos
- for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
- Expr.pseudos[ i ] = createInputPseudo( i );
- }
- for ( i in { submit: true, reset: true } ) {
- Expr.pseudos[ i ] = createButtonPseudo( i );
- }
- // Easy API for creating new setFilters
- function setFilters() {}
- setFilters.prototype = Expr.filters = Expr.pseudos;
- Expr.setFilters = new setFilters();
- tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
- var matched, match, tokens, type,
- soFar, groups, preFilters,
- cached = tokenCache[ selector + " " ];
- if ( cached ) {
- return parseOnly ? 0 : cached.slice( 0 );
- }
- soFar = selector;
- groups = [];
- preFilters = Expr.preFilter;
- while ( soFar ) {
- // Comma and first run
- if ( !matched || (match = rcomma.exec( soFar )) ) {
- if ( match ) {
- // Don't consume trailing commas as valid
- soFar = soFar.slice( match[0].length ) || soFar;
- }
- groups.push( (tokens = []) );
- }
- matched = false;
- // Combinators
- if ( (match = rcombinators.exec( soFar )) ) {
- matched = match.shift();
- tokens.push({
- value: matched,
- // Cast descendant combinators to space
- type: match[0].replace( rtrim, " " )
- });
- soFar = soFar.slice( matched.length );
- }
- // Filters
- for ( type in Expr.filter ) {
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
- (match = preFilters[ type ]( match ))) ) {
- matched = match.shift();
- tokens.push({
- value: matched,
- type: type,
- matches: match
- });
- soFar = soFar.slice( matched.length );
- }
- }
- if ( !matched ) {
- break;
- }
- }
- // Return the length of the invalid excess
- // if we're just parsing
- // Otherwise, throw an error or return tokens
- return parseOnly ?
- soFar.length :
- soFar ?
- Sizzle.error( selector ) :
- // Cache the tokens
- tokenCache( selector, groups ).slice( 0 );
- };
- function toSelector( tokens ) {
- var i = 0,
- len = tokens.length,
- selector = "";
- for ( ; i < len; i++ ) {
- selector += tokens[i].value;
- }
- return selector;
- }
- function addCombinator( matcher, combinator, base ) {
- var dir = combinator.dir,
- checkNonElements = base && dir === "parentNode",
- doneName = done++;
- return combinator.first ?
- // Check against closest ancestor/preceding element
- function( elem, context, xml ) {
- while ( (elem = elem[ dir ]) ) {
- if ( elem.nodeType === 1 || checkNonElements ) {
- return matcher( elem, context, xml );
- }
- }
- } :
- // Check against all ancestor/preceding elements
- function( elem, context, xml ) {
- var oldCache, uniqueCache, outerCache,
- newCache = [ dirruns, doneName ];
- // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
- if ( xml ) {
- while ( (elem = elem[ dir ]) ) {
- if ( elem.nodeType === 1 || checkNonElements ) {
- if ( matcher( elem, context, xml ) ) {
- return true;
- }
- }
- }
- } else {
- while ( (elem = elem[ dir ]) ) {
- if ( elem.nodeType === 1 || checkNonElements ) {
- outerCache = elem[ expando ] || (elem[ expando ] = {});
- // Support: IE <9 only
- // Defend against cloned attroperties (jQuery gh-1709)
- uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
- if ( (oldCache = uniqueCache[ dir ]) &&
- oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
- // Assign to newCache so results back-propagate to previous elements
- return (newCache[ 2 ] = oldCache[ 2 ]);
- } else {
- // Reuse newcache so results back-propagate to previous elements
- uniqueCache[ dir ] = newCache;
- // A match means we're done; a fail means we have to keep checking
- if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
- return true;
- }
- }
- }
- }
- }
- };
- }
- function elementMatcher( matchers ) {
- return matchers.length > 1 ?
- function( elem, context, xml ) {
- var i = matchers.length;
- while ( i-- ) {
- if ( !matchers[i]( elem, context, xml ) ) {
- return false;
- }
- }
- return true;
- } :
- matchers[0];
- }
- function multipleContexts( selector, contexts, results ) {
- var i = 0,
- len = contexts.length;
- for ( ; i < len; i++ ) {
- Sizzle( selector, contexts[i], results );
- }
- return results;
- }
- function condense( unmatched, map, filter, context, xml ) {
- var elem,
- newUnmatched = [],
- i = 0,
- len = unmatched.length,
- mapped = map != null;
- for ( ; i < len; i++ ) {
- if ( (elem = unmatched[i]) ) {
- if ( !filter || filter( elem, context, xml ) ) {
- newUnmatched.push( elem );
- if ( mapped ) {
- map.push( i );
- }
- }
- }
- }
- return newUnmatched;
- }
- function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
- if ( postFilter && !postFilter[ expando ] ) {
- postFilter = setMatcher( postFilter );
- }
- if ( postFinder && !postFinder[ expando ] ) {
- postFinder = setMatcher( postFinder, postSelector );
- }
- return markFunction(function( seed, results, context, xml ) {
- var temp, i, elem,
- preMap = [],
- postMap = [],
- preexisting = results.length,
- // Get initial elements from seed or context
- elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
- // Prefilter to get matcher input, preserving a map for seed-results synchronization
- matcherIn = preFilter && ( seed || !selector ) ?
- condense( elems, preMap, preFilter, context, xml ) :
- elems,
- matcherOut = matcher ?
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
- // ...intermediate processing is necessary
- [] :
- // ...otherwise use results directly
- results :
- matcherIn;
- // Find primary matches
- if ( matcher ) {
- matcher( matcherIn, matcherOut, context, xml );
- }
- // Apply postFilter
- if ( postFilter ) {
- temp = condense( matcherOut, postMap );
- postFilter( temp, [], context, xml );
- // Un-match failing elements by moving them back to matcherIn
- i = temp.length;
- while ( i-- ) {
- if ( (elem = temp[i]) ) {
- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
- }
- }
- }
- if ( seed ) {
- if ( postFinder || preFilter ) {
- if ( postFinder ) {
- // Get the final matcherOut by condensing this intermediate into postFinder contexts
- temp = [];
- i = matcherOut.length;
- while ( i-- ) {
- if ( (elem = matcherOut[i]) ) {
- // Restore matcherIn since elem is not yet a final match
- temp.push( (matcherIn[i] = elem) );
- }
- }
- postFinder( null, (matcherOut = []), temp, xml );
- }
- // Move matched elements from seed to results to keep them synchronized
- i = matcherOut.length;
- while ( i-- ) {
- if ( (elem = matcherOut[i]) &&
- (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
- seed[temp] = !(results[temp] = elem);
- }
- }
- }
- // Add elements to results, through postFinder if defined
- } else {
- matcherOut = condense(
- matcherOut === results ?
- matcherOut.splice( preexisting, matcherOut.length ) :
- matcherOut
- );
- if ( postFinder ) {
- postFinder( null, results, matcherOut, xml );
- } else {
- push.apply( results, matcherOut );
- }
- }
- });
- }
- function matcherFromTokens( tokens ) {
- var checkContext, matcher, j,
- len = tokens.length,
- leadingRelative = Expr.relative[ tokens[0].type ],
- implicitRelative = leadingRelative || Expr.relative[" "],
- i = leadingRelative ? 1 : 0,
- // The foundational matcher ensures that elements are reachable from top-level context(s)
- matchContext = addCombinator( function( elem ) {
- return elem === checkContext;
- }, implicitRelative, true ),
- matchAnyContext = addCombinator( function( elem ) {
- return indexOf( checkContext, elem ) > -1;
- }, implicitRelative, true ),
- matchers = [ function( elem, context, xml ) {
- var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
- (checkContext = context).nodeType ?
- matchContext( elem, context, xml ) :
- matchAnyContext( elem, context, xml ) );
- // Avoid hanging onto element (issue #299)
- checkContext = null;
- return ret;
- } ];
- for ( ; i < len; i++ ) {
- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
- matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
- } else {
- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
- // Return special upon seeing a positional matcher
- if ( matcher[ expando ] ) {
- // Find the next relative operator (if any) for proper handling
- j = ++i;
- for ( ; j < len; j++ ) {
- if ( Expr.relative[ tokens[j].type ] ) {
- break;
- }
- }
- return setMatcher(
- i > 1 && elementMatcher( matchers ),
- i > 1 && toSelector(
- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
- tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
- ).replace( rtrim, "$1" ),
- matcher,
- i < j && matcherFromTokens( tokens.slice( i, j ) ),
- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
- j < len && toSelector( tokens )
- );
- }
- matchers.push( matcher );
- }
- }
- return elementMatcher( matchers );
- }
- function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
- var bySet = setMatchers.length > 0,
- byElement = elementMatchers.length > 0,
- superMatcher = function( seed, context, xml, results, outermost ) {
- var elem, j, matcher,
- matchedCount = 0,
- i = "0",
- unmatched = seed && [],
- setMatched = [],
- contextBackup = outermostContext,
- // We must always have either seed elements or outermost context
- elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
- // Use integer dirruns iff this is the outermost matcher
- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
- len = elems.length;
- if ( outermost ) {
- outermostContext = context === document || context || outermost;
- }
- // Add elements passing elementMatchers directly to results
- // Support: IE<9, Safari
- // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
- for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
- if ( byElement && elem ) {
- j = 0;
- if ( !context && elem.ownerDocument !== document ) {
- setDocument( elem );
- xml = !documentIsHTML;
- }
- while ( (matcher = elementMatchers[j++]) ) {
- if ( matcher( elem, context || document, xml) ) {
- results.push( elem );
- break;
- }
- }
- if ( outermost ) {
- dirruns = dirrunsUnique;
- }
- }
- // Track unmatched elements for set filters
- if ( bySet ) {
- // They will have gone through all possible matchers
- if ( (elem = !matcher && elem) ) {
- matchedCount--;
- }
- // Lengthen the array for every element, matched or not
- if ( seed ) {
- unmatched.push( elem );
- }
- }
- }
- // `i` is now the count of elements visited above, and adding it to `matchedCount`
- // makes the latter nonnegative.
- matchedCount += i;
- // Apply set filters to unmatched elements
- // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
- // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
- // no element matchers and no seed.
- // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
- // case, which will result in a "00" `matchedCount` that differs from `i` but is also
- // numerically zero.
- if ( bySet && i !== matchedCount ) {
- j = 0;
- while ( (matcher = setMatchers[j++]) ) {
- matcher( unmatched, setMatched, context, xml );
- }
- if ( seed ) {
- // Reintegrate element matches to eliminate the need for sorting
- if ( matchedCount > 0 ) {
- while ( i-- ) {
- if ( !(unmatched[i] || setMatched[i]) ) {
- setMatched[i] = pop.call( results );
- }
- }
- }
- // Discard index placeholder values to get only actual matches
- setMatched = condense( setMatched );
- }
- // Add matches to results
- push.apply( results, setMatched );
- // Seedless set matches succeeding multiple successful matchers stipulate sorting
- if ( outermost && !seed && setMatched.length > 0 &&
- ( matchedCount + setMatchers.length ) > 1 ) {
- Sizzle.uniqueSort( results );
- }
- }
- // Override manipulation of globals by nested matchers
- if ( outermost ) {
- dirruns = dirrunsUnique;
- outermostContext = contextBackup;
- }
- return unmatched;
- };
- return bySet ?
- markFunction( superMatcher ) :
- superMatcher;
- }
- compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
- var i,
- setMatchers = [],
- elementMatchers = [],
- cached = compilerCache[ selector + " " ];
- if ( !cached ) {
- // Generate a function of recursive functions that can be used to check each element
- if ( !match ) {
- match = tokenize( selector );
- }
- i = match.length;
- while ( i-- ) {
- cached = matcherFromTokens( match[i] );
- if ( cached[ expando ] ) {
- setMatchers.push( cached );
- } else {
- elementMatchers.push( cached );
- }
- }
- // Cache the compiled function
- cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
- // Save selector and tokenization
- cached.selector = selector;
- }
- return cached;
- };
- /**
- * A low-level selection function that works with Sizzle's compiled
- * selector functions
- * @param {String|Function} selector A selector or a pre-compiled
- * selector function built with Sizzle.compile
- * @param {Element} context
- * @param {Array} [results]
- * @param {Array} [seed] A set of elements to match against
- */
- select = Sizzle.select = function( selector, context, results, seed ) {
- var i, tokens, token, type, find,
- compiled = typeof selector === "function" && selector,
- match = !seed && tokenize( (selector = compiled.selector || selector) );
- results = results || [];
- // Try to minimize operations if there is only one selector in the list and no seed
- // (the latter of which guarantees us context)
- if ( match.length === 1 ) {
- // Reduce context if the leading compound selector is an ID
- tokens = match[0] = match[0].slice( 0 );
- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
- support.getById && context.nodeType === 9 && documentIsHTML &&
- Expr.relative[ tokens[1].type ] ) {
- context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
- if ( !context ) {
- return results;
- // Precompiled matchers will still verify ancestry, so step up a level
- } else if ( compiled ) {
- context = context.parentNode;
- }
- selector = selector.slice( tokens.shift().value.length );
- }
- // Fetch a seed set for right-to-left matching
- i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
- while ( i-- ) {
- token = tokens[i];
- // Abort if we hit a combinator
- if ( Expr.relative[ (type = token.type) ] ) {
- break;
- }
- if ( (find = Expr.find[ type ]) ) {
- // Search, expanding context for leading sibling combinators
- if ( (seed = find(
- token.matches[0].replace( runescape, funescape ),
- rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
- )) ) {
- // If seed is empty or no tokens remain, we can return early
- tokens.splice( i, 1 );
- selector = seed.length && toSelector( tokens );
- if ( !selector ) {
- push.apply( results, seed );
- return results;
- }
- break;
- }
- }
- }
- }
- // Compile and execute a filtering function if one is not provided
- // Provide `match` to avoid retokenization if we modified the selector above
- ( compiled || compile( selector, match ) )(
- seed,
- context,
- !documentIsHTML,
- results,
- !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
- );
- return results;
- };
- // One-time assignments
- // Sort stability
- support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
- // Support: Chrome 14-35+
- // Always assume duplicates if they aren't passed to the comparison function
- support.detectDuplicates = !!hasDuplicate;
- // Initialize against the default document
- setDocument();
- // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
- // Detached nodes confoundingly follow *each other*
- support.sortDetached = assert(function( div1 ) {
- // Should return 1, but returns 4 (following)
- return div1.compareDocumentPosition( document.createElement("div") ) & 1;
- });
- // Support: IE<8
- // Prevent attribute/property "interpolation"
- // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
- if ( !assert(function( div ) {
- div.innerHTML = "<a href='#'></a>";
- return div.firstChild.getAttribute("href") === "#" ;
- }) ) {
- addHandle( "type|href|height|width", function( elem, name, isXML ) {
- if ( !isXML ) {
- return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
- }
- });
- }
- // Support: IE<9
- // Use defaultValue in place of getAttribute("value")
- if ( !support.attributes || !assert(function( div ) {
- div.innerHTML = "<input/>";
- div.firstChild.setAttribute( "value", "" );
- return div.firstChild.getAttribute( "value" ) === "";
- }) ) {
- addHandle( "value", function( elem, name, isXML ) {
- if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
- return elem.defaultValue;
- }
- });
- }
- // Support: IE<9
- // Use getAttributeNode to fetch booleans when getAttribute lies
- if ( !assert(function( div ) {
- return div.getAttribute("disabled") == null;
- }) ) {
- addHandle( booleans, function( elem, name, isXML ) {
- var val;
- if ( !isXML ) {
- return elem[ name ] === true ? name.toLowerCase() :
- (val = elem.getAttributeNode( name )) && val.specified ?
- val.value :
- null;
- }
- });
- }
- return Sizzle;
- })( window );
- jQuery.find = Sizzle;
- jQuery.expr = Sizzle.selectors;
- jQuery.expr[ ":" ] = jQuery.expr.pseudos;
- jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
- jQuery.text = Sizzle.getText;
- jQuery.isXMLDoc = Sizzle.isXML;
- jQuery.contains = Sizzle.contains;
- var dir = function( elem, dir, until ) {
- var matched = [],
- truncate = until !== undefined;
- while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
- if ( elem.nodeType === 1 ) {
- if ( truncate && jQuery( elem ).is( until ) ) {
- break;
- }
- matched.push( elem );
- }
- }
- return matched;
- };
- var siblings = function( n, elem ) {
- var matched = [];
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType === 1 && n !== elem ) {
- matched.push( n );
- }
- }
- return matched;
- };
- var rneedsContext = jQuery.expr.match.needsContext;
- var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
- var risSimple = /^.[^:#\[\.,]*$/;
- // Implement the identical functionality for filter and not
- function winnow( elements, qualifier, not ) {
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep( elements, function( elem, i ) {
- /* jshint -W018 */
- return !!qualifier.call( elem, i, elem ) !== not;
- } );
- }
- if ( qualifier.nodeType ) {
- return jQuery.grep( elements, function( elem ) {
- return ( elem === qualifier ) !== not;
- } );
- }
- if ( typeof qualifier === "string" ) {
- if ( risSimple.test( qualifier ) ) {
- return jQuery.filter( qualifier, elements, not );
- }
- qualifier = jQuery.filter( qualifier, elements );
- }
- return jQuery.grep( elements, function( elem ) {
- return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
- } );
- }
- jQuery.filter = function( expr, elems, not ) {
- var elem = elems[ 0 ];
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
- return elems.length === 1 && elem.nodeType === 1 ?
- jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
- jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
- return elem.nodeType === 1;
- } ) );
- };
- jQuery.fn.extend( {
- find: function( selector ) {
- var i,
- len = this.length,
- ret = [],
- self = this;
- if ( typeof selector !== "string" ) {
- return this.pushStack( jQuery( selector ).filter( function() {
- for ( i = 0; i < len; i++ ) {
- if ( jQuery.contains( self[ i ], this ) ) {
- return true;
- }
- }
- } ) );
- }
- for ( i = 0; i < len; i++ ) {
- jQuery.find( selector, self[ i ], ret );
- }
- // Needed because $( selector, context ) becomes $( context ).find( selector )
- ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
- ret.selector = this.selector ? this.selector + " " + selector : selector;
- return ret;
- },
- filter: function( selector ) {
- return this.pushStack( winnow( this, selector || [], false ) );
- },
- not: function( selector ) {
- return this.pushStack( winnow( this, selector || [], true ) );
- },
- is: function( selector ) {
- return !!winnow(
- this,
- // If this is a positional/relative selector, check membership in the returned set
- // so $("p:first").is("p:last") won't return true for a doc with two "p".
- typeof selector === "string" && rneedsContext.test( selector ) ?
- jQuery( selector ) :
- selector || [],
- false
- ).length;
- }
- } );
- // Initialize a jQuery object
- // A central reference to the root jQuery(document)
- var rootjQuery,
- // A simple way to check for HTML strings
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
- // Strict HTML recognition (#11290: must start with <)
- rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
- init = jQuery.fn.init = function( selector, context, root ) {
- var match, elem;
- // HANDLE: $(""), $(null), $(undefined), $(false)
- if ( !selector ) {
- return this;
- }
- // Method init() accepts an alternate rootjQuery
- // so migrate can support jQuery.sub (gh-2101)
- root = root || rootjQuery;
- // Handle HTML strings
- if ( typeof selector === "string" ) {
- if ( selector[ 0 ] === "<" &&
- selector[ selector.length - 1 ] === ">" &&
- selector.length >= 3 ) {
- // Assume that strings that start and end with <> are HTML and skip the regex check
- match = [ null, selector, null ];
- } else {
- match = rquickExpr.exec( selector );
- }
- // Match html or make sure no context is specified for #id
- if ( match && ( match[ 1 ] || !context ) ) {
- // HANDLE: $(html) -> $(array)
- if ( match[ 1 ] ) {
- context = context instanceof jQuery ? context[ 0 ] : context;
- // Option to run scripts is true for back-compat
- // Intentionally let the error be thrown if parseHTML is not present
- jQuery.merge( this, jQuery.parseHTML(
- match[ 1 ],
- context && context.nodeType ? context.ownerDocument || context : document,
- true
- ) );
- // HANDLE: $(html, props)
- if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
- for ( match in context ) {
- // Properties of context are called as methods if possible
- if ( jQuery.isFunction( this[ match ] ) ) {
- this[ match ]( context[ match ] );
- // ...and otherwise set as attributes
- } else {
- this.attr( match, context[ match ] );
- }
- }
- }
- return this;
- // HANDLE: $(#id)
- } else {
- elem = document.getElementById( match[ 2 ] );
- // Support: Blackberry 4.6
- // gEBID returns nodes no longer in the document (#6963)
- if ( elem && elem.parentNode ) {
- // Inject the element directly into the jQuery object
- this.length = 1;
- this[ 0 ] = elem;
- }
- this.context = document;
- this.selector = selector;
- return this;
- }
- // HANDLE: $(expr, $(...))
- } else if ( !context || context.jquery ) {
- return ( context || root ).find( selector );
- // HANDLE: $(expr, context)
- // (which is just equivalent to: $(context).find(expr)
- } else {
- return this.constructor( context ).find( selector );
- }
- // HANDLE: $(DOMElement)
- } else if ( selector.nodeType ) {
- this.context = this[ 0 ] = selector;
- this.length = 1;
- return this;
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) ) {
- return root.ready !== undefined ?
- root.ready( selector ) :
- // Execute immediately if ready is not present
- selector( jQuery );
- }
- if ( selector.selector !== undefined ) {
- this.selector = selector.selector;
- this.context = selector.context;
- }
- return jQuery.makeArray( selector, this );
- };
- // Give the init function the jQuery prototype for later instantiation
- init.prototype = jQuery.fn;
- // Initialize central reference
- rootjQuery = jQuery( document );
- var rparentsprev = /^(?:parents|prev(?:Until|All))/,
- // Methods guaranteed to produce a unique set when starting from a unique set
- guaranteedUnique = {
- children: true,
- contents: true,
- next: true,
- prev: true
- };
- jQuery.fn.extend( {
- has: function( target ) {
- var targets = jQuery( target, this ),
- l = targets.length;
- return this.filter( function() {
- var i = 0;
- for ( ; i < l; i++ ) {
- if ( jQuery.contains( this, targets[ i ] ) ) {
- return true;
- }
- }
- } );
- },
- closest: function( selectors, context ) {
- var cur,
- i = 0,
- l = this.length,
- matched = [],
- pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
- jQuery( selectors, context || this.context ) :
- 0;
- for ( ; i < l; i++ ) {
- for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
- // Always skip document fragments
- if ( cur.nodeType < 11 && ( pos ?
- pos.index( cur ) > -1 :
- // Don't pass non-elements to Sizzle
- cur.nodeType === 1 &&
- jQuery.find.matchesSelector( cur, selectors ) ) ) {
- matched.push( cur );
- break;
- }
- }
- }
- return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
- },
- // Determine the position of an element within the set
- index: function( elem ) {
- // No argument, return index in parent
- if ( !elem ) {
- return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
- }
- // Index in selector
- if ( typeof elem === "string" ) {
- return indexOf.call( jQuery( elem ), this[ 0 ] );
- }
- // Locate the position of the desired element
- return indexOf.call( this,
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[ 0 ] : elem
- );
- },
- add: function( selector, context ) {
- return this.pushStack(
- jQuery.uniqueSort(
- jQuery.merge( this.get(), jQuery( selector, context ) )
- )
- );
- },
- addBack: function( selector ) {
- return this.add( selector == null ?
- this.prevObject : this.prevObject.filter( selector )
- );
- }
- } );
- function sibling( cur, dir ) {
- while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
- return cur;
- }
- jQuery.each( {
- parent: function( elem ) {
- var parent = elem.parentNode;
- return parent && parent.nodeType !== 11 ? parent : null;
- },
- parents: function( elem ) {
- return dir( elem, "parentNode" );
- },
- parentsUntil: function( elem, i, until ) {
- return dir( elem, "parentNode", until );
- },
- next: function( elem ) {
- return sibling( elem, "nextSibling" );
- },
- prev: function( elem ) {
- return sibling( elem, "previousSibling" );
- },
- nextAll: function( elem ) {
- return dir( elem, "nextSibling" );
- },
- prevAll: function( elem ) {
- return dir( elem, "previousSibling" );
- },
- nextUntil: function( elem, i, until ) {
- return dir( elem, "nextSibling", until );
- },
- prevUntil: function( elem, i, until ) {
- return dir( elem, "previousSibling", until );
- },
- siblings: function( elem ) {
- return siblings( ( elem.parentNode || {} ).firstChild, elem );
- },
- children: function( elem ) {
- return siblings( elem.firstChild );
- },
- contents: function( elem ) {
- return elem.contentDocument || jQuery.merge( [], elem.childNodes );
- }
- }, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var matched = jQuery.map( this, fn, until );
- if ( name.slice( -5 ) !== "Until" ) {
- selector = until;
- }
- if ( selector && typeof selector === "string" ) {
- matched = jQuery.filter( selector, matched );
- }
- if ( this.length > 1 ) {
- // Remove duplicates
- if ( !guaranteedUnique[ name ] ) {
- jQuery.uniqueSort( matched );
- }
- // Reverse order for parents* and prev-derivatives
- if ( rparentsprev.test( name ) ) {
- matched.reverse();
- }
- }
- return this.pushStack( matched );
- };
- } );
- var rnotwhite = ( /\S+/g );
- // Convert String-formatted options into Object-formatted ones
- function createOptions( options ) {
- var object = {};
- jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
- object[ flag ] = true;
- } );
- return object;
- }
- /*
- * Create a callback list using the following parameters:
- *
- * options: an optional list of space-separated options that will change how
- * the callback list behaves or a more traditional option object
- *
- * By default a callback list will act like an event callback list and can be
- * "fired" multiple times.
- *
- * Possible options:
- *
- * once: will ensure the callback list can only be fired once (like a Deferred)
- *
- * memory: will keep track of previous values and will call any callback added
- * after the list has been fired right away with the latest "memorized"
- * values (like a Deferred)
- *
- * unique: will ensure a callback can only be added once (no duplicate in the list)
- *
- * stopOnFalse: interrupt callings when a callback returns false
- *
- */
- jQuery.Callbacks = function( options ) {
- // Convert options from String-formatted to Object-formatted if needed
- // (we check in cache first)
- options = typeof options === "string" ?
- createOptions( options ) :
- jQuery.extend( {}, options );
- var // Flag to know if list is currently firing
- firing,
- // Last fire value for non-forgettable lists
- memory,
- // Flag to know if list was already fired
- fired,
- // Flag to prevent firing
- locked,
- // Actual callback list
- list = [],
- // Queue of execution data for repeatable lists
- queue = [],
- // Index of currently firing callback (modified by add/remove as needed)
- firingIndex = -1,
- // Fire callbacks
- fire = function() {
- // Enforce single-firing
- locked = options.once;
- // Execute callbacks for all pending executions,
- // respecting firingIndex overrides and runtime changes
- fired = firing = true;
- for ( ; queue.length; firingIndex = -1 ) {
- memory = queue.shift();
- while ( ++firingIndex < list.length ) {
- // Run callback and check for early termination
- if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
- options.stopOnFalse ) {
- // Jump to end and forget the data so .add doesn't re-fire
- firingIndex = list.length;
- memory = false;
- }
- }
- }
- // Forget the data if we're done with it
- if ( !options.memory ) {
- memory = false;
- }
- firing = false;
- // Clean up if we're done firing for good
- if ( locked ) {
- // Keep an empty list if we have data for future add calls
- if ( memory ) {
- list = [];
- // Otherwise, this object is spent
- } else {
- list = "";
- }
- }
- },
- // Actual Callbacks object
- self = {
- // Add a callback or a collection of callbacks to the list
- add: function() {
- if ( list ) {
- // If we have memory from a past run, we should fire after adding
- if ( memory && !firing ) {
- firingIndex = list.length - 1;
- queue.push( memory );
- }
- ( function add( args ) {
- jQuery.each( args, function( _, arg ) {
- if ( jQuery.isFunction( arg ) ) {
- if ( !options.unique || !self.has( arg ) ) {
- list.push( arg );
- }
- } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
- // Inspect recursively
- add( arg );
- }
- } );
- } )( arguments );
- if ( memory && !firing ) {
- fire();
- }
- }
- return this;
- },
- // Remove a callback from the list
- remove: function() {
- jQuery.each( arguments, function( _, arg ) {
- var index;
- while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
- list.splice( index, 1 );
- // Handle firing indexes
- if ( index <= firingIndex ) {
- firingIndex--;
- }
- }
- } );
- return this;
- },
- // Check if a given callback is in the list.
- // If no argument is given, return whether or not list has callbacks attached.
- has: function( fn ) {
- return fn ?
- jQuery.inArray( fn, list ) > -1 :
- list.length > 0;
- },
- // Remove all callbacks from the list
- empty: function() {
- if ( list ) {
- list = [];
- }
- return this;
- },
- // Disable .fire and .add
- // Abort any current/pending executions
- // Clear all callbacks and values
- disable: function() {
- locked = queue = [];
- list = memory = "";
- return this;
- },
- disabled: function() {
- return !list;
- },
- // Disable .fire
- // Also disable .add unless we have memory (since it would have no effect)
- // Abort any pending executions
- lock: function() {
- locked = queue = [];
- if ( !memory ) {
- list = memory = "";
- }
- return this;
- },
- locked: function() {
- return !!locked;
- },
- // Call all callbacks with the given context and arguments
- fireWith: function( context, args ) {
- if ( !locked ) {
- args = args || [];
- args = [ context, args.slice ? args.slice() : args ];
- queue.push( args );
- if ( !firing ) {
- fire();
- }
- }
- return this;
- },
- // Call all the callbacks with the given arguments
- fire: function() {
- self.fireWith( this, arguments );
- return this;
- },
- // To know if the callbacks have already been called at least once
- fired: function() {
- return !!fired;
- }
- };
- return self;
- };
- jQuery.extend( {
- Deferred: function( func ) {
- var tuples = [
- // action, add listener, listener list, final state
- [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
- [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
- [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
- ],
- state = "pending",
- promise = {
- state: function() {
- return state;
- },
- always: function() {
- deferred.done( arguments ).fail( arguments );
- return this;
- },
- then: function( /* fnDone, fnFail, fnProgress */ ) {
- var fns = arguments;
- return jQuery.Deferred( function( newDefer ) {
- jQuery.each( tuples, function( i, tuple ) {
- var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
- // deferred[ done | fail | progress ] for forwarding actions to newDefer
- deferred[ tuple[ 1 ] ]( function() {
- var returned = fn && fn.apply( this, arguments );
- if ( returned && jQuery.isFunction( returned.promise ) ) {
- returned.promise()
- .progress( newDefer.notify )
- .done( newDefer.resolve )
- .fail( newDefer.reject );
- } else {
- newDefer[ tuple[ 0 ] + "With" ](
- this === promise ? newDefer.promise() : this,
- fn ? [ returned ] : arguments
- );
- }
- } );
- } );
- fns = null;
- } ).promise();
- },
- // Get a promise for this deferred
- // If obj is provided, the promise aspect is added to the object
- promise: function( obj ) {
- return obj != null ? jQuery.extend( obj, promise ) : promise;
- }
- },
- deferred = {};
- // Keep pipe for back-compat
- promise.pipe = promise.then;
- // Add list-specific methods
- jQuery.each( tuples, function( i, tuple ) {
- var list = tuple[ 2 ],
- stateString = tuple[ 3 ];
- // promise[ done | fail | progress ] = list.add
- promise[ tuple[ 1 ] ] = list.add;
- // Handle state
- if ( stateString ) {
- list.add( function() {
- // state = [ resolved | rejected ]
- state = stateString;
- // [ reject_list | resolve_list ].disable; progress_list.lock
- }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
- }
- // deferred[ resolve | reject | notify ]
- deferred[ tuple[ 0 ] ] = function() {
- deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
- return this;
- };
- deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
- } );
- // Make the deferred a promise
- promise.promise( deferred );
- // Call given func if any
- if ( func ) {
- func.call( deferred, deferred );
- }
- // All done!
- return deferred;
- },
- // Deferred helper
- when: function( subordinate /* , ..., subordinateN */ ) {
- var i = 0,
- resolveValues = slice.call( arguments ),
- length = resolveValues.length,
- // the count of uncompleted subordinates
- remaining = length !== 1 ||
- ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
- // the master Deferred.
- // If resolveValues consist of only a single Deferred, just use that.
- deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
- // Update function for both resolve and progress values
- updateFunc = function( i, contexts, values ) {
- return function( value ) {
- contexts[ i ] = this;
- values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
- if ( values === progressValues ) {
- deferred.notifyWith( contexts, values );
- } else if ( !( --remaining ) ) {
- deferred.resolveWith( contexts, values );
- }
- };
- },
- progressValues, progressContexts, resolveContexts;
- // Add listeners to Deferred subordinates; treat others as resolved
- if ( length > 1 ) {
- progressValues = new Array( length );
- progressContexts = new Array( length );
- resolveContexts = new Array( length );
- for ( ; i < length; i++ ) {
- if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
- resolveValues[ i ].promise()
- .progress( updateFunc( i, progressContexts, progressValues ) )
- .done( updateFunc( i, resolveContexts, resolveValues ) )
- .fail( deferred.reject );
- } else {
- --remaining;
- }
- }
- }
- // If we're not waiting on anything, resolve the master
- if ( !remaining ) {
- deferred.resolveWith( resolveContexts, resolveValues );
- }
- return deferred.promise();
- }
- } );
- // The deferred used on DOM ready
- var readyList;
- jQuery.fn.ready = function( fn ) {
- // Add the callback
- jQuery.ready.promise().done( fn );
- return this;
- };
- jQuery.extend( {
- // Is the DOM ready to be used? Set to true once it occurs.
- isReady: false,
- // A counter to track how many items to wait for before
- // the ready event fires. See #6781
- readyWait: 1,
- // Hold (or release) the ready event
- holdReady: function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- },
- // Handle when the DOM is ready
- ready: function( wait ) {
- // Abort if there are pending holds or we're already ready
- if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
- return;
- }
- // Remember that the DOM is ready
- jQuery.isReady = true;
- // If a normal DOM Ready event fired, decrement, and wait if need be
- if ( wait !== true && --jQuery.readyWait > 0 ) {
- return;
- }
- // If there are functions bound, to execute
- readyList.resolveWith( document, [ jQuery ] );
- // Trigger any bound ready events
- if ( jQuery.fn.triggerHandler ) {
- jQuery( document ).triggerHandler( "ready" );
- jQuery( document ).off( "ready" );
- }
- }
- } );
- /**
- * The ready event handler and self cleanup method
- */
- function completed() {
- document.removeEventListener( "DOMContentLoaded", completed );
- window.removeEventListener( "load", completed );
- jQuery.ready();
- }
- jQuery.ready.promise = function( obj ) {
- if ( !readyList ) {
- readyList = jQuery.Deferred();
- // Catch cases where $(document).ready() is called
- // after the browser event has already occurred.
- // Support: IE9-10 only
- // Older IE sometimes signals "interactive" too soon
- if ( document.readyState === "complete" ||
- ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- window.setTimeout( jQuery.ready );
- } else {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", completed );
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", completed );
- }
- }
- return readyList.promise( obj );
- };
- // Kick off the DOM ready check even if the user does not
- jQuery.ready.promise();
- // Multifunctional method to get and set values of a collection
- // The value/s can optionally be executed if it's a function
- var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
- var i = 0,
- len = elems.length,
- bulk = key == null;
- // Sets many values
- if ( jQuery.type( key ) === "object" ) {
- chainable = true;
- for ( i in key ) {
- access( elems, fn, i, key[ i ], true, emptyGet, raw );
- }
- // Sets one value
- } else if ( value !== undefined ) {
- chainable = true;
- if ( !jQuery.isFunction( value ) ) {
- raw = true;
- }
- if ( bulk ) {
- // Bulk operations run against the entire set
- if ( raw ) {
- fn.call( elems, value );
- fn = null;
- // ...except when executing function values
- } else {
- bulk = fn;
- fn = function( elem, key, value ) {
- return bulk.call( jQuery( elem ), value );
- };
- }
- }
- if ( fn ) {
- for ( ; i < len; i++ ) {
- fn(
- elems[ i ], key, raw ?
- value :
- value.call( elems[ i ], i, fn( elems[ i ], key ) )
- );
- }
- }
- }
- return chainable ?
- elems :
- // Gets
- bulk ?
- fn.call( elems ) :
- len ? fn( elems[ 0 ], key ) : emptyGet;
- };
- var acceptData = function( owner ) {
- // Accepts only:
- // - Node
- // - Node.ELEMENT_NODE
- // - Node.DOCUMENT_NODE
- // - Object
- // - Any
- /* jshint -W018 */
- return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
- };
- function Data() {
- this.expando = jQuery.expando + Data.uid++;
- }
- Data.uid = 1;
- Data.prototype = {
- register: function( owner, initial ) {
- var value = initial || {};
- // If it is a node unlikely to be stringify-ed or looped over
- // use plain assignment
- if ( owner.nodeType ) {
- owner[ this.expando ] = value;
- // Otherwise secure it in a non-enumerable, non-writable property
- // configurability must be true to allow the property to be
- // deleted with the delete operator
- } else {
- Object.defineProperty( owner, this.expando, {
- value: value,
- writable: true,
- configurable: true
- } );
- }
- return owner[ this.expando ];
- },
- cache: function( owner ) {
- // We can accept data for non-element nodes in modern browsers,
- // but we should not, see #8335.
- // Always return an empty object.
- if ( !acceptData( owner ) ) {
- return {};
- }
- // Check if the owner object already has a cache
- var value = owner[ this.expando ];
- // If not, create one
- if ( !value ) {
- value = {};
- // We can accept data for non-element nodes in modern browsers,
- // but we should not, see #8335.
- // Always return an empty object.
- if ( acceptData( owner ) ) {
- // If it is a node unlikely to be stringify-ed or looped over
- // use plain assignment
- if ( owner.nodeType ) {
- owner[ this.expando ] = value;
- // Otherwise secure it in a non-enumerable property
- // configurable must be true to allow the property to be
- // deleted when data is removed
- } else {
- Object.defineProperty( owner, this.expando, {
- value: value,
- configurable: true
- } );
- }
- }
- }
- return value;
- },
- set: function( owner, data, value ) {
- var prop,
- cache = this.cache( owner );
- // Handle: [ owner, key, value ] args
- if ( typeof data === "string" ) {
- cache[ data ] = value;
- // Handle: [ owner, { properties } ] args
- } else {
- // Copy the properties one-by-one to the cache object
- for ( prop in data ) {
- cache[ prop ] = data[ prop ];
- }
- }
- return cache;
- },
- get: function( owner, key ) {
- return key === undefined ?
- this.cache( owner ) :
- owner[ this.expando ] && owner[ this.expando ][ key ];
- },
- access: function( owner, key, value ) {
- var stored;
- // In cases where either:
- //
- // 1. No key was specified
- // 2. A string key was specified, but no value provided
- //
- // Take the "read" path and allow the get method to determine
- // which value to return, respectively either:
- //
- // 1. The entire cache object
- // 2. The data stored at the key
- //
- if ( key === undefined ||
- ( ( key && typeof key === "string" ) && value === undefined ) ) {
- stored = this.get( owner, key );
- return stored !== undefined ?
- stored : this.get( owner, jQuery.camelCase( key ) );
- }
- // When the key is not a string, or both a key and value
- // are specified, set or extend (existing objects) with either:
- //
- // 1. An object of properties
- // 2. A key and value
- //
- this.set( owner, key, value );
- // Since the "set" path can have two possible entry points
- // return the expected data based on which path was taken[*]
- return value !== undefined ? value : key;
- },
- remove: function( owner, key ) {
- var i, name, camel,
- cache = owner[ this.expando ];
- if ( cache === undefined ) {
- return;
- }
- if ( key === undefined ) {
- this.register( owner );
- } else {
- // Support array or space separated string of keys
- if ( jQuery.isArray( key ) ) {
- // If "name" is an array of keys...
- // When data is initially created, via ("key", "val") signature,
- // keys will be converted to camelCase.
- // Since there is no way to tell _how_ a key was added, remove
- // both plain key and camelCase key. #12786
- // This will only penalize the array argument path.
- name = key.concat( key.map( jQuery.camelCase ) );
- } else {
- camel = jQuery.camelCase( key );
- // Try the string as a key before any manipulation
- if ( key in cache ) {
- name = [ key, camel ];
- } else {
- // If a key with the spaces exists, use it.
- // Otherwise, create an array by matching non-whitespace
- name = camel;
- name = name in cache ?
- [ name ] : ( name.match( rnotwhite ) || [] );
- }
- }
- i = name.length;
- while ( i-- ) {
- delete cache[ name[ i ] ];
- }
- }
- // Remove the expando if there's no more data
- if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
- // Support: Chrome <= 35-45+
- // Webkit & Blink performance suffers when deleting properties
- // from DOM nodes, so set to undefined instead
- // https://code.google.com/p/chromium/issues/detail?id=378607
- if ( owner.nodeType ) {
- owner[ this.expando ] = undefined;
- } else {
- delete owner[ this.expando ];
- }
- }
- },
- hasData: function( owner ) {
- var cache = owner[ this.expando ];
- return cache !== undefined && !jQuery.isEmptyObject( cache );
- }
- };
- var dataPriv = new Data();
- var dataUser = new Data();
- // Implementation Summary
- //
- // 1. Enforce API surface and semantic compatibility with 1.9.x branch
- // 2. Improve the module's maintainability by reducing the storage
- // paths to a single mechanism.
- // 3. Use the same single mechanism to support "private" and "user" data.
- // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
- // 5. Avoid exposing implementation details on user objects (eg. expando properties)
- // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
- var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
- rmultiDash = /[A-Z]/g;
- function dataAttr( elem, key, data ) {
- var name;
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
- name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
- data = elem.getAttribute( name );
- if ( typeof data === "string" ) {
- try {
- data = data === "true" ? true :
- data === "false" ? false :
- data === "null" ? null :
- // Only convert to a number if it doesn't change the string
- +data + "" === data ? +data :
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
- data;
- } catch ( e ) {}
- // Make sure we set the data so it isn't changed later
- dataUser.set( elem, key, data );
- } else {
- data = undefined;
- }
- }
- return data;
- }
- jQuery.extend( {
- hasData: function( elem ) {
- return dataUser.hasData( elem ) || dataPriv.hasData( elem );
- },
- data: function( elem, name, data ) {
- return dataUser.access( elem, name, data );
- },
- removeData: function( elem, name ) {
- dataUser.remove( elem, name );
- },
- // TODO: Now that all calls to _data and _removeData have been replaced
- // with direct calls to dataPriv methods, these can be deprecated.
- _data: function( elem, name, data ) {
- return dataPriv.access( elem, name, data );
- },
- _removeData: function( elem, name ) {
- dataPriv.remove( elem, name );
- }
- } );
- jQuery.fn.extend( {
- data: function( key, value ) {
- var i, name, data,
- elem = this[ 0 ],
- attrs = elem && elem.attributes;
- // Gets all values
- if ( key === undefined ) {
- if ( this.length ) {
- data = dataUser.get( elem );
- if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
- i = attrs.length;
- while ( i-- ) {
- // Support: IE11+
- // The attrs elements can be null (#14894)
- if ( attrs[ i ] ) {
- name = attrs[ i ].name;
- if ( name.indexOf( "data-" ) === 0 ) {
- name = jQuery.camelCase( name.slice( 5 ) );
- dataAttr( elem, name, data[ name ] );
- }
- }
- }
- dataPriv.set( elem, "hasDataAttrs", true );
- }
- }
- return data;
- }
- // Sets multiple values
- if ( typeof key === "object" ) {
- return this.each( function() {
- dataUser.set( this, key );
- } );
- }
- return access( this, function( value ) {
- var data, camelKey;
- // The calling jQuery object (element matches) is not empty
- // (and therefore has an element appears at this[ 0 ]) and the
- // `value` parameter was not undefined. An empty jQuery object
- // will result in `undefined` for elem = this[ 0 ] which will
- // throw an exception if an attempt to read a data cache is made.
- if ( elem && value === undefined ) {
- // Attempt to get data from the cache
- // with the key as-is
- data = dataUser.get( elem, key ) ||
- // Try to find dashed key if it exists (gh-2779)
- // This is for 2.2.x only
- dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() );
- if ( data !== undefined ) {
- return data;
- }
- camelKey = jQuery.camelCase( key );
- // Attempt to get data from the cache
- // with the key camelized
- data = dataUser.get( elem, camelKey );
- if ( data !== undefined ) {
- return data;
- }
- // Attempt to "discover" the data in
- // HTML5 custom data-* attrs
- data = dataAttr( elem, camelKey, undefined );
- if ( data !== undefined ) {
- return data;
- }
- // We tried really hard, but the data doesn't exist.
- return;
- }
- // Set the data...
- camelKey = jQuery.camelCase( key );
- this.each( function() {
- // First, attempt to store a copy or reference of any
- // data that might've been store with a camelCased key.
- var data = dataUser.get( this, camelKey );
- // For HTML5 data-* attribute interop, we have to
- // store property names with dashes in a camelCase form.
- // This might not apply to all properties...*
- dataUser.set( this, camelKey, value );
- // *... In the case of properties that might _actually_
- // have dashes, we need to also store a copy of that
- // unchanged property.
- if ( key.indexOf( "-" ) > -1 && data !== undefined ) {
- dataUser.set( this, key, value );
- }
- } );
- }, null, value, arguments.length > 1, null, true );
- },
- removeData: function( key ) {
- return this.each( function() {
- dataUser.remove( this, key );
- } );
- }
- } );
- jQuery.extend( {
- queue: function( elem, type, data ) {
- var queue;
- if ( elem ) {
- type = ( type || "fx" ) + "queue";
- queue = dataPriv.get( elem, type );
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !queue || jQuery.isArray( data ) ) {
- queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
- } else {
- queue.push( data );
- }
- }
- return queue || [];
- }
- },
- dequeue: function( elem, type ) {
- type = type || "fx";
- var queue = jQuery.queue( elem, type ),
- startLength = queue.length,
- fn = queue.shift(),
- hooks = jQuery._queueHooks( elem, type ),
- next = function() {
- jQuery.dequeue( elem, type );
- };
- // If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) {
- fn = queue.shift();
- startLength--;
- }
- if ( fn ) {
- // Add a progress sentinel to prevent the fx queue from being
- // automatically dequeued
- if ( type === "fx" ) {
- queue.unshift( "inprogress" );
- }
- // Clear up the last queue stop function
- delete hooks.stop;
- fn.call( elem, next, hooks );
- }
- if ( !startLength && hooks ) {
- hooks.empty.fire();
- }
- },
- // Not public - generate a queueHooks object, or return the current one
- _queueHooks: function( elem, type ) {
- var key = type + "queueHooks";
- return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
- empty: jQuery.Callbacks( "once memory" ).add( function() {
- dataPriv.remove( elem, [ type + "queue", key ] );
- } )
- } );
- }
- } );
- jQuery.fn.extend( {
- queue: function( type, data ) {
- var setter = 2;
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
- setter--;
- }
- if ( arguments.length < setter ) {
- return jQuery.queue( this[ 0 ], type );
- }
- return data === undefined ?
- this :
- this.each( function() {
- var queue = jQuery.queue( this, type, data );
- // Ensure a hooks for this queue
- jQuery._queueHooks( this, type );
- if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
- jQuery.dequeue( this, type );
- }
- } );
- },
- dequeue: function( type ) {
- return this.each( function() {
- jQuery.dequeue( this, type );
- } );
- },
- clearQueue: function( type ) {
- return this.queue( type || "fx", [] );
- },
- // Get a promise resolved when queues of a certain type
- // are emptied (fx is the type by default)
- promise: function( type, obj ) {
- var tmp,
- count = 1,
- defer = jQuery.Deferred(),
- elements = this,
- i = this.length,
- resolve = function() {
- if ( !( --count ) ) {
- defer.resolveWith( elements, [ elements ] );
- }
- };
- if ( typeof type !== "string" ) {
- obj = type;
- type = undefined;
- }
- type = type || "fx";
- while ( i-- ) {
- tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
- if ( tmp && tmp.empty ) {
- count++;
- tmp.empty.add( resolve );
- }
- }
- resolve();
- return defer.promise( obj );
- }
- } );
- var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
- var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
- var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
- var isHidden = function( elem, el ) {
- // isHidden might be called from jQuery#filter function;
- // in that case, element will be second argument
- elem = el || elem;
- return jQuery.css( elem, "display" ) === "none" ||
- !jQuery.contains( elem.ownerDocument, elem );
- };
- function adjustCSS( elem, prop, valueParts, tween ) {
- var adjusted,
- scale = 1,
- maxIterations = 20,
- currentValue = tween ?
- function() { return tween.cur(); } :
- function() { return jQuery.css( elem, prop, "" ); },
- initial = currentValue(),
- unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
- // Starting value computation is required for potential unit mismatches
- initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
- rcssNum.exec( jQuery.css( elem, prop ) );
- if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
- // Trust units reported by jQuery.css
- unit = unit || initialInUnit[ 3 ];
- // Make sure we update the tween properties later on
- valueParts = valueParts || [];
- // Iteratively approximate from a nonzero starting point
- initialInUnit = +initial || 1;
- do {
- // If previous iteration zeroed out, double until we get *something*.
- // Use string for doubling so we don't accidentally see scale as unchanged below
- scale = scale || ".5";
- // Adjust and apply
- initialInUnit = initialInUnit / scale;
- jQuery.style( elem, prop, initialInUnit + unit );
- // Update scale, tolerating zero or NaN from tween.cur()
- // Break the loop if scale is unchanged or perfect, or if we've just had enough.
- } while (
- scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
- );
- }
- if ( valueParts ) {
- initialInUnit = +initialInUnit || +initial || 0;
- // Apply relative offset (+=/-=) if specified
- adjusted = valueParts[ 1 ] ?
- initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
- +valueParts[ 2 ];
- if ( tween ) {
- tween.unit = unit;
- tween.start = initialInUnit;
- tween.end = adjusted;
- }
- }
- return adjusted;
- }
- var rcheckableType = ( /^(?:checkbox|radio)$/i );
- var rtagName = ( /<([\w:-]+)/ );
- var rscriptType = ( /^$|\/(?:java|ecma)script/i );
- // We have to close these tags to support XHTML (#13200)
- var wrapMap = {
- // Support: IE9
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
- // XHTML parsers do not magically insert elements in the
- // same way that tag soup parsers do. So we cannot shorten
- // this by omitting <tbody> or other required elements.
- 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, "", "" ]
- };
- // Support: IE9
- wrapMap.optgroup = wrapMap.option;
- wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
- wrapMap.th = wrapMap.td;
- function getAll( context, tag ) {
- // Support: IE9-11+
- // Use typeof to avoid zero-argument method invocation on host objects (#15151)
- var ret = typeof context.getElementsByTagName !== "undefined" ?
- context.getElementsByTagName( tag || "*" ) :
- typeof context.querySelectorAll !== "undefined" ?
- context.querySelectorAll( tag || "*" ) :
- [];
- return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
- jQuery.merge( [ context ], ret ) :
- ret;
- }
- // Mark scripts as having already been evaluated
- function setGlobalEval( elems, refElements ) {
- var i = 0,
- l = elems.length;
- for ( ; i < l; i++ ) {
- dataPriv.set(
- elems[ i ],
- "globalEval",
- !refElements || dataPriv.get( refElements[ i ], "globalEval" )
- );
- }
- }
- var rhtml = /<|&#?\w+;/;
- function buildFragment( elems, context, scripts, selection, ignored ) {
- var elem, tmp, tag, wrap, contains, j,
- fragment = context.createDocumentFragment(),
- nodes = [],
- i = 0,
- l = elems.length;
- for ( ; i < l; i++ ) {
- elem = elems[ i ];
- if ( elem || elem === 0 ) {
- // Add nodes directly
- if ( jQuery.type( elem ) === "object" ) {
- // Support: Android<4.1, PhantomJS<2
- // push.apply(_, arraylike) throws on ancient WebKit
- jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
- // Convert non-html into a text node
- } else if ( !rhtml.test( elem ) ) {
- nodes.push( context.createTextNode( elem ) );
- // Convert html into DOM nodes
- } else {
- tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
- // Deserialize a standard representation
- tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
- wrap = wrapMap[ tag ] || wrapMap._default;
- tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
- // Descend through wrappers to the right content
- j = wrap[ 0 ];
- while ( j-- ) {
- tmp = tmp.lastChild;
- }
- // Support: Android<4.1, PhantomJS<2
- // push.apply(_, arraylike) throws on ancient WebKit
- jQuery.merge( nodes, tmp.childNodes );
- // Remember the top-level container
- tmp = fragment.firstChild;
- // Ensure the created nodes are orphaned (#12392)
- tmp.textContent = "";
- }
- }
- }
- // Remove wrapper from fragment
- fragment.textContent = "";
- i = 0;
- while ( ( elem = nodes[ i++ ] ) ) {
- // Skip elements already in the context collection (trac-4087)
- if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
- if ( ignored ) {
- ignored.push( elem );
- }
- continue;
- }
- contains = jQuery.contains( elem.ownerDocument, elem );
- // Append to fragment
- tmp = getAll( fragment.appendChild( elem ), "script" );
- // Preserve script evaluation history
- if ( contains ) {
- setGlobalEval( tmp );
- }
- // Capture executables
- if ( scripts ) {
- j = 0;
- while ( ( elem = tmp[ j++ ] ) ) {
- if ( rscriptType.test( elem.type || "" ) ) {
- scripts.push( elem );
- }
- }
- }
- }
- return fragment;
- }
- ( function() {
- var fragment = document.createDocumentFragment(),
- div = fragment.appendChild( document.createElement( "div" ) ),
- input = document.createElement( "input" );
- // Support: Android 4.0-4.3, Safari<=5.1
- // Check state lost if the name is set (#11217)
- // Support: Windows Web Apps (WWA)
- // `name` and `type` must use .setAttribute for WWA (#14901)
- input.setAttribute( "type", "radio" );
- input.setAttribute( "checked", "checked" );
- input.setAttribute( "name", "t" );
- div.appendChild( input );
- // Support: Safari<=5.1, Android<4.2
- // Older WebKit doesn't clone checked state correctly in fragments
- support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
- // Support: IE<=11+
- // Make sure textarea (and checkbox) defaultValue is properly cloned
- div.innerHTML = "<textarea>x</textarea>";
- support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
- } )();
- var
- rkeyEvent = /^key/,
- rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
- rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
- function returnTrue() {
- return true;
- }
- function returnFalse() {
- return false;
- }
- // Support: IE9
- // See #13393 for more info
- function safeActiveElement() {
- try {
- return document.activeElement;
- } catch ( err ) { }
- }
- function on( elem, types, selector, data, fn, one ) {
- var origFn, type;
- // Types can be a map of types/handlers
- if ( typeof types === "object" ) {
- // ( types-Object, selector, data )
- if ( typeof selector !== "string" ) {
- // ( types-Object, data )
- data = data || selector;
- selector = undefined;
- }
- for ( type in types ) {
- on( elem, type, selector, data, types[ type ], one );
- }
- return elem;
- }
- if ( data == null && fn == null ) {
- // ( types, fn )
- fn = selector;
- data = selector = undefined;
- } else if ( fn == null ) {
- if ( typeof selector === "string" ) {
- // ( types, selector, fn )
- fn = data;
- data = undefined;
- } else {
- // ( types, data, fn )
- fn = data;
- data = selector;
- selector = undefined;
- }
- }
- if ( fn === false ) {
- fn = returnFalse;
- } else if ( !fn ) {
- return elem;
- }
- if ( one === 1 ) {
- origFn = fn;
- fn = function( event ) {
- // Can use an empty set, since event contains the info
- jQuery().off( event );
- return origFn.apply( this, arguments );
- };
- // Use same guid so caller can remove using origFn
- fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
- }
- return elem.each( function() {
- jQuery.event.add( this, types, fn, data, selector );
- } );
- }
- /*
- * Helper functions for managing events -- not part of the public interface.
- * Props to Dean Edwards' addEvent library for many of the ideas.
- */
- jQuery.event = {
- global: {},
- add: function( elem, types, handler, data, selector ) {
- var handleObjIn, eventHandle, tmp,
- events, t, handleObj,
- special, handlers, type, namespaces, origType,
- elemData = dataPriv.get( elem );
- // Don't attach events to noData or text/comment nodes (but allow plain objects)
- if ( !elemData ) {
- return;
- }
- // Caller can pass in an object of custom data in lieu of the handler
- if ( handler.handler ) {
- handleObjIn = handler;
- handler = handleObjIn.handler;
- selector = handleObjIn.selector;
- }
- // Make sure that the handler has a unique ID, used to find/remove it later
- if ( !handler.guid ) {
- handler.guid = jQuery.guid++;
- }
- // Init the element's event structure and main handler, if this is the first
- if ( !( events = elemData.events ) ) {
- events = elemData.events = {};
- }
- if ( !( eventHandle = elemData.handle ) ) {
- eventHandle = elemData.handle = function( e ) {
- // Discard the second event of a jQuery.event.trigger() and
- // when an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
- jQuery.event.dispatch.apply( elem, arguments ) : undefined;
- };
- }
- // Handle multiple events separated by a space
- types = ( types || "" ).match( rnotwhite ) || [ "" ];
- t = types.length;
- while ( t-- ) {
- tmp = rtypenamespace.exec( types[ t ] ) || [];
- type = origType = tmp[ 1 ];
- namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
- // There *must* be a type, no attaching namespace-only handlers
- if ( !type ) {
- continue;
- }
- // If event changes its type, use the special event handlers for the changed type
- special = jQuery.event.special[ type ] || {};
- // If selector defined, determine special event api type, otherwise given type
- type = ( selector ? special.delegateType : special.bindType ) || type;
- // Update special based on newly reset type
- special = jQuery.event.special[ type ] || {};
- // handleObj is passed to all event handlers
- handleObj = jQuery.extend( {
- type: type,
- origType: origType,
- data: data,
- handler: handler,
- guid: handler.guid,
- selector: selector,
- needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
- namespace: namespaces.join( "." )
- }, handleObjIn );
- // Init the event handler queue if we're the first
- if ( !( handlers = events[ type ] ) ) {
- handlers = events[ type ] = [];
- handlers.delegateCount = 0;
- // Only use addEventListener if the special events handler returns false
- if ( !special.setup ||
- special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- if ( elem.addEventListener ) {
- elem.addEventListener( type, eventHandle );
- }
- }
- }
- if ( special.add ) {
- special.add.call( elem, handleObj );
- if ( !handleObj.handler.guid ) {
- handleObj.handler.guid = handler.guid;
- }
- }
- // Add to the element's handler list, delegates in front
- if ( selector ) {
- handlers.splice( handlers.delegateCount++, 0, handleObj );
- } else {
- handlers.push( handleObj );
- }
- // Keep track of which events have ever been used, for event optimization
- jQuery.event.global[ type ] = true;
- }
- },
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, selector, mappedTypes ) {
- var j, origCount, tmp,
- events, t, handleObj,
- special, handlers, type, namespaces, origType,
- elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
- if ( !elemData || !( events = elemData.events ) ) {
- return;
- }
- // Once for each type.namespace in types; type may be omitted
- types = ( types || "" ).match( rnotwhite ) || [ "" ];
- t = types.length;
- while ( t-- ) {
- tmp = rtypenamespace.exec( types[ t ] ) || [];
- type = origType = tmp[ 1 ];
- namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
- // Unbind all events (on this namespace, if provided) for the element
- if ( !type ) {
- for ( type in events ) {
- jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
- }
- continue;
- }
- special = jQuery.event.special[ type ] || {};
- type = ( selector ? special.delegateType : special.bindType ) || type;
- handlers = events[ type ] || [];
- tmp = tmp[ 2 ] &&
- new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
- // Remove matching events
- origCount = j = handlers.length;
- while ( j-- ) {
- handleObj = handlers[ j ];
- if ( ( mappedTypes || origType === handleObj.origType ) &&
- ( !handler || handler.guid === handleObj.guid ) &&
- ( !tmp || tmp.test( handleObj.namespace ) ) &&
- ( !selector || selector === handleObj.selector ||
- selector === "**" && handleObj.selector ) ) {
- handlers.splice( j, 1 );
- if ( handleObj.selector ) {
- handlers.delegateCount--;
- }
- if ( special.remove ) {
- special.remove.call( elem, handleObj );
- }
- }
- }
- // Remove generic event handler if we removed something and no more handlers exist
- // (avoids potential for endless recursion during removal of special event handlers)
- if ( origCount && !handlers.length ) {
- if ( !special.teardown ||
- special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
- jQuery.removeEvent( elem, type, elemData.handle );
- }
- delete events[ type ];
- }
- }
- // Remove data and the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- dataPriv.remove( elem, "handle events" );
- }
- },
- dispatch: function( event ) {
- // Make a writable jQuery.Event from the native event object
- event = jQuery.event.fix( event );
- var i, j, ret, matched, handleObj,
- handlerQueue = [],
- args = slice.call( arguments ),
- handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
- special = jQuery.event.special[ event.type ] || {};
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
- args[ 0 ] = event;
- event.delegateTarget = this;
- // Call the preDispatch hook for the mapped type, and let it bail if desired
- if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
- return;
- }
- // Determine handlers
- handlerQueue = jQuery.event.handlers.call( this, event, handlers );
- // Run delegates first; they may want to stop propagation beneath us
- i = 0;
- while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
- event.currentTarget = matched.elem;
- j = 0;
- while ( ( handleObj = matched.handlers[ j++ ] ) &&
- !event.isImmediatePropagationStopped() ) {
- // Triggered event must either 1) have no namespace, or 2) have namespace(s)
- // a subset or equal to those in the bound event (both can have no namespace).
- if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
- event.handleObj = handleObj;
- event.data = handleObj.data;
- ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
- handleObj.handler ).apply( matched.elem, args );
- if ( ret !== undefined ) {
- if ( ( event.result = ret ) === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
- }
- }
- }
- // Call the postDispatch hook for the mapped type
- if ( special.postDispatch ) {
- special.postDispatch.call( this, event );
- }
- return event.result;
- },
- handlers: function( event, handlers ) {
- var i, matches, sel, handleObj,
- handlerQueue = [],
- delegateCount = handlers.delegateCount,
- cur = event.target;
- // Support (at least): Chrome, IE9
- // Find delegate handlers
- // Black-hole SVG <use> instance trees (#13180)
- //
- // Support: Firefox<=42+
- // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
- if ( delegateCount && cur.nodeType &&
- ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
- for ( ; cur !== this; cur = cur.parentNode || this ) {
- // Don't check non-elements (#13208)
- // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
- if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
- matches = [];
- for ( i = 0; i < delegateCount; i++ ) {
- handleObj = handlers[ i ];
- // Don't conflict with Object.prototype properties (#13203)
- sel = handleObj.selector + " ";
- if ( matches[ sel ] === undefined ) {
- matches[ sel ] = handleObj.needsContext ?
- jQuery( sel, this ).index( cur ) > -1 :
- jQuery.find( sel, this, null, [ cur ] ).length;
- }
- if ( matches[ sel ] ) {
- matches.push( handleObj );
- }
- }
- if ( matches.length ) {
- handlerQueue.push( { elem: cur, handlers: matches } );
- }
- }
- }
- }
- // Add the remaining (directly-bound) handlers
- if ( delegateCount < handlers.length ) {
- handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
- }
- return handlerQueue;
- },
- // Includes some event props shared by KeyEvent and MouseEvent
- 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( event, original ) {
- // Add which for key events
- if ( event.which == null ) {
- event.which = original.charCode != null ? original.charCode : original.keyCode;
- }
- return event;
- }
- },
- mouseHooks: {
- props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " +
- "screenX screenY toElement" ).split( " " ),
- filter: function( event, original ) {
- var eventDoc, doc, body,
- button = original.button;
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && original.clientX != null ) {
- eventDoc = event.target.ownerDocument || document;
- doc = eventDoc.documentElement;
- body = eventDoc.body;
- event.pageX = original.clientX +
- ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
- ( doc && doc.clientLeft || body && body.clientLeft || 0 );
- event.pageY = original.clientY +
- ( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
- ( doc && doc.clientTop || body && body.clientTop || 0 );
- }
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && button !== undefined ) {
- event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
- }
- return event;
- }
- },
- fix: function( event ) {
- if ( event[ jQuery.expando ] ) {
- return event;
- }
- // Create a writable copy of the event object and normalize some properties
- var i, prop, copy,
- type = event.type,
- originalEvent = event,
- fixHook = this.fixHooks[ type ];
- if ( !fixHook ) {
- this.fixHooks[ type ] = fixHook =
- rmouseEvent.test( type ) ? this.mouseHooks :
- rkeyEvent.test( type ) ? this.keyHooks :
- {};
- }
- copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
- event = new jQuery.Event( originalEvent );
- i = copy.length;
- while ( i-- ) {
- prop = copy[ i ];
- event[ prop ] = originalEvent[ prop ];
- }
- // Support: Cordova 2.5 (WebKit) (#13255)
- // All events should have a target; Cordova deviceready doesn't
- if ( !event.target ) {
- event.target = document;
- }
- // Support: Safari 6.0+, Chrome<28
- // Target should not be a text node (#504, #13143)
- if ( event.target.nodeType === 3 ) {
- event.target = event.target.parentNode;
- }
- return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
- },
- special: {
- load: {
- // Prevent triggered image.load events from bubbling to window.load
- noBubble: true
- },
- focus: {
- // Fire native event if possible so blur/focus sequence is correct
- trigger: function() {
- if ( this !== safeActiveElement() && this.focus ) {
- this.focus();
- return false;
- }
- },
- delegateType: "focusin"
- },
- blur: {
- trigger: function() {
- if ( this === safeActiveElement() && this.blur ) {
- this.blur();
- return false;
- }
- },
- delegateType: "focusout"
- },
- click: {
- // For checkbox, fire native event so checked state will be right
- trigger: function() {
- if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
- this.click();
- return false;
- }
- },
- // For cross-browser consistency, don't fire native .click() on links
- _default: function( event ) {
- return jQuery.nodeName( event.target, "a" );
- }
- },
- beforeunload: {
- postDispatch: function( event ) {
- // Support: Firefox 20+
- // Firefox doesn't alert if the returnValue field is not set.
- if ( event.result !== undefined && event.originalEvent ) {
- event.originalEvent.returnValue = event.result;
- }
- }
- }
- }
- };
- jQuery.removeEvent = function( elem, type, handle ) {
- // This "if" is needed for plain objects
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle );
- }
- };
- jQuery.Event = function( src, props ) {
- // Allow instantiation without the 'new' keyword
- if ( !( this instanceof jQuery.Event ) ) {
- return new jQuery.Event( src, props );
- }
- // Event object
- if ( src && src.type ) {
- this.originalEvent = src;
- this.type = src.type;
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = src.defaultPrevented ||
- src.defaultPrevented === undefined &&
- // Support: Android<4.0
- src.returnValue === false ?
- returnTrue :
- returnFalse;
- // Event type
- } else {
- this.type = src;
- }
- // Put explicitly provided properties onto the event object
- if ( props ) {
- jQuery.extend( this, props );
- }
- // Create a timestamp if incoming event doesn't have one
- this.timeStamp = src && src.timeStamp || jQuery.now();
- // Mark it as fixed
- this[ jQuery.expando ] = true;
- };
- // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
- // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
- jQuery.Event.prototype = {
- constructor: jQuery.Event,
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse,
- isSimulated: false,
- preventDefault: function() {
- var e = this.originalEvent;
- this.isDefaultPrevented = returnTrue;
- if ( e && !this.isSimulated ) {
- e.preventDefault();
- }
- },
- stopPropagation: function() {
- var e = this.originalEvent;
- this.isPropagationStopped = returnTrue;
- if ( e && !this.isSimulated ) {
- e.stopPropagation();
- }
- },
- stopImmediatePropagation: function() {
- var e = this.originalEvent;
- this.isImmediatePropagationStopped = returnTrue;
- if ( e && !this.isSimulated ) {
- e.stopImmediatePropagation();
- }
- this.stopPropagation();
- }
- };
- // Create mouseenter/leave events using mouseover/out and event-time checks
- // so that event delegation works in jQuery.
- // Do the same for pointerenter/pointerleave and pointerover/pointerout
- //
- // Support: Safari 7 only
- // Safari sends mouseenter too often; see:
- // https://code.google.com/p/chromium/issues/detail?id=470258
- // for the description of the bug (it existed in older Chrome versions as well).
- jQuery.each( {
- mouseenter: "mouseover",
- mouseleave: "mouseout",
- pointerenter: "pointerover",
- pointerleave: "pointerout"
- }, function( orig, fix ) {
- jQuery.event.special[ orig ] = {
- delegateType: fix,
- bindType: fix,
- handle: function( event ) {
- var ret,
- target = this,
- related = event.relatedTarget,
- handleObj = event.handleObj;
- // For mouseenter/leave call the handler if related is outside the target.
- // NB: No relatedTarget if the mouse left/entered the browser window
- if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
- event.type = handleObj.origType;
- ret = handleObj.handler.apply( this, arguments );
- event.type = fix;
- }
- return ret;
- }
- };
- } );
- jQuery.fn.extend( {
- on: function( types, selector, data, fn ) {
- return on( this, types, selector, data, fn );
- },
- one: function( types, selector, data, fn ) {
- return on( this, types, selector, data, fn, 1 );
- },
- off: function( types, selector, fn ) {
- var handleObj, type;
- if ( types && types.preventDefault && types.handleObj ) {
- // ( event ) dispatched jQuery.Event
- handleObj = types.handleObj;
- jQuery( types.delegateTarget ).off(
- handleObj.namespace ?
- handleObj.origType + "." + handleObj.namespace :
- handleObj.origType,
- handleObj.selector,
- handleObj.handler
- );
- return this;
- }
- if ( typeof types === "object" ) {
- // ( types-object [, selector] )
- for ( type in types ) {
- this.off( type, selector, types[ type ] );
- }
- return this;
- }
- if ( selector === false || typeof selector === "function" ) {
- // ( types [, fn] )
- fn = selector;
- selector = undefined;
- }
- if ( fn === false ) {
- fn = returnFalse;
- }
- return this.each( function() {
- jQuery.event.remove( this, types, fn, selector );
- } );
- }
- } );
- var
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
- // Support: IE 10-11, Edge 10240+
- // In IE/Edge using regex groups here causes severe slowdowns.
- // See https://connect.microsoft.com/IE/feedback/details/1736512/
- rnoInnerhtml = /<script|<style|<link/i,
- // checked="checked" or checked
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
- rscriptTypeMasked = /^true\/(.*)/,
- rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
- // Manipulating tables requires a tbody
- function manipulationTarget( elem, content ) {
- return jQuery.nodeName( elem, "table" ) &&
- jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
- elem.getElementsByTagName( "tbody" )[ 0 ] ||
- elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
- elem;
- }
- // Replace/restore the type attribute of script elements for safe DOM manipulation
- function disableScript( elem ) {
- elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
- return elem;
- }
- function restoreScript( elem ) {
- var match = rscriptTypeMasked.exec( elem.type );
- if ( match ) {
- elem.type = match[ 1 ];
- } else {
- elem.removeAttribute( "type" );
- }
- return elem;
- }
- function cloneCopyEvent( src, dest ) {
- var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
- if ( dest.nodeType !== 1 ) {
- return;
- }
- // 1. Copy private data: events, handlers, etc.
- if ( dataPriv.hasData( src ) ) {
- pdataOld = dataPriv.access( src );
- pdataCur = dataPriv.set( dest, pdataOld );
- events = pdataOld.events;
- if ( events ) {
- delete pdataCur.handle;
- pdataCur.events = {};
- for ( type in events ) {
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
- jQuery.event.add( dest, type, events[ type ][ i ] );
- }
- }
- }
- }
- // 2. Copy user data
- if ( dataUser.hasData( src ) ) {
- udataOld = dataUser.access( src );
- udataCur = jQuery.extend( {}, udataOld );
- dataUser.set( dest, udataCur );
- }
- }
- // Fix IE bugs, see support tests
- function fixInput( src, dest ) {
- var nodeName = dest.nodeName.toLowerCase();
- // Fails to persist the checked state of a cloned checkbox or radio button.
- if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
- dest.checked = src.checked;
- // Fails to return the selected option to the default selected state when cloning options
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
- dest.defaultValue = src.defaultValue;
- }
- }
- function domManip( collection, args, callback, ignored ) {
- // Flatten any nested arrays
- args = concat.apply( [], args );
- var fragment, first, scripts, hasScripts, node, doc,
- i = 0,
- l = collection.length,
- iNoClone = l - 1,
- value = args[ 0 ],
- isFunction = jQuery.isFunction( value );
- // We can't cloneNode fragments that contain checked, in WebKit
- if ( isFunction ||
- ( l > 1 && typeof value === "string" &&
- !support.checkClone && rchecked.test( value ) ) ) {
- return collection.each( function( index ) {
- var self = collection.eq( index );
- if ( isFunction ) {
- args[ 0 ] = value.call( this, index, self.html() );
- }
- domManip( self, args, callback, ignored );
- } );
- }
- if ( l ) {
- fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
- first = fragment.firstChild;
- if ( fragment.childNodes.length === 1 ) {
- fragment = first;
- }
- // Require either new content or an interest in ignored elements to invoke the callback
- if ( first || ignored ) {
- scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
- hasScripts = scripts.length;
- // Use the original fragment for the last item
- // instead of the first because it can end up
- // being emptied incorrectly in certain situations (#8070).
- for ( ; i < l; i++ ) {
- node = fragment;
- if ( i !== iNoClone ) {
- node = jQuery.clone( node, true, true );
- // Keep references to cloned scripts for later restoration
- if ( hasScripts ) {
- // Support: Android<4.1, PhantomJS<2
- // push.apply(_, arraylike) throws on ancient WebKit
- jQuery.merge( scripts, getAll( node, "script" ) );
- }
- }
- callback.call( collection[ i ], node, i );
- }
- if ( hasScripts ) {
- doc = scripts[ scripts.length - 1 ].ownerDocument;
- // Reenable scripts
- jQuery.map( scripts, restoreScript );
- // Evaluate executable scripts on first document insertion
- for ( i = 0; i < hasScripts; i++ ) {
- node = scripts[ i ];
- if ( rscriptType.test( node.type || "" ) &&
- !dataPriv.access( node, "globalEval" ) &&
- jQuery.contains( doc, node ) ) {
- if ( node.src ) {
- // Optional AJAX dependency, but won't run scripts if not present
- if ( jQuery._evalUrl ) {
- jQuery._evalUrl( node.src );
- }
- } else {
- jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
- }
- }
- }
- }
- }
- }
- return collection;
- }
- function remove( elem, selector, keepData ) {
- var node,
- nodes = selector ? jQuery.filter( selector, elem ) : elem,
- i = 0;
- for ( ; ( node = nodes[ i ] ) != null; i++ ) {
- if ( !keepData && node.nodeType === 1 ) {
- jQuery.cleanData( getAll( node ) );
- }
- if ( node.parentNode ) {
- if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
- setGlobalEval( getAll( node, "script" ) );
- }
- node.parentNode.removeChild( node );
- }
- }
- return elem;
- }
- jQuery.extend( {
- htmlPrefilter: function( html ) {
- return html.replace( rxhtmlTag, "<$1></$2>" );
- },
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var i, l, srcElements, destElements,
- clone = elem.cloneNode( true ),
- inPage = jQuery.contains( elem.ownerDocument, elem );
- // Fix IE cloning issues
- if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
- !jQuery.isXMLDoc( elem ) ) {
- // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
- destElements = getAll( clone );
- srcElements = getAll( elem );
- for ( i = 0, l = srcElements.length; i < l; i++ ) {
- fixInput( srcElements[ i ], destElements[ i ] );
- }
- }
- // Copy the events from the original to the clone
- if ( dataAndEvents ) {
- if ( deepDataAndEvents ) {
- srcElements = srcElements || getAll( elem );
- destElements = destElements || getAll( clone );
- for ( i = 0, l = srcElements.length; i < l; i++ ) {
- cloneCopyEvent( srcElements[ i ], destElements[ i ] );
- }
- } else {
- cloneCopyEvent( elem, clone );
- }
- }
- // Preserve script evaluation history
- destElements = getAll( clone, "script" );
- if ( destElements.length > 0 ) {
- setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
- }
- // Return the cloned set
- return clone;
- },
- cleanData: function( elems ) {
- var data, elem, type,
- special = jQuery.event.special,
- i = 0;
- for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
- if ( acceptData( elem ) ) {
- if ( ( data = elem[ dataPriv.expando ] ) ) {
- if ( data.events ) {
- for ( type in data.events ) {
- if ( special[ type ] ) {
- jQuery.event.remove( elem, type );
- // This is a shortcut to avoid jQuery.event.remove's overhead
- } else {
- jQuery.removeEvent( elem, type, data.handle );
- }
- }
- }
- // Support: Chrome <= 35-45+
- // Assign undefined instead of using delete, see Data#remove
- elem[ dataPriv.expando ] = undefined;
- }
- if ( elem[ dataUser.expando ] ) {
- // Support: Chrome <= 35-45+
- // Assign undefined instead of using delete, see Data#remove
- elem[ dataUser.expando ] = undefined;
- }
- }
- }
- }
- } );
- jQuery.fn.extend( {
- // Keep domManip exposed until 3.0 (gh-2225)
- domManip: domManip,
- detach: function( selector ) {
- return remove( this, selector, true );
- },
- remove: function( selector ) {
- return remove( this, selector );
- },
- text: function( value ) {
- return access( this, function( value ) {
- return value === undefined ?
- jQuery.text( this ) :
- this.empty().each( function() {
- if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
- this.textContent = value;
- }
- } );
- }, null, value, arguments.length );
- },
- append: function() {
- return domManip( this, arguments, function( elem ) {
- if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
- var target = manipulationTarget( this, elem );
- target.appendChild( elem );
- }
- } );
- },
- prepend: function() {
- return domManip( this, arguments, function( elem ) {
- if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
- var target = manipulationTarget( this, elem );
- target.insertBefore( elem, target.firstChild );
- }
- } );
- },
- before: function() {
- return domManip( this, arguments, function( elem ) {
- if ( this.parentNode ) {
- this.parentNode.insertBefore( elem, this );
- }
- } );
- },
- after: function() {
- return domManip( this, arguments, function( elem ) {
- if ( this.parentNode ) {
- this.parentNode.insertBefore( elem, this.nextSibling );
- }
- } );
- },
- empty: function() {
- var elem,
- i = 0;
- for ( ; ( elem = this[ i ] ) != null; i++ ) {
- if ( elem.nodeType === 1 ) {
- // Prevent memory leaks
- jQuery.cleanData( getAll( elem, false ) );
- // Remove any remaining nodes
- elem.textContent = "";
- }
- }
- return this;
- },
- clone: function( dataAndEvents, deepDataAndEvents ) {
- dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
- deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
- return this.map( function() {
- return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
- } );
- },
- html: function( value ) {
- return access( this, function( value ) {
- var elem = this[ 0 ] || {},
- i = 0,
- l = this.length;
- if ( value === undefined && elem.nodeType === 1 ) {
- return elem.innerHTML;
- }
- // See if we can take a shortcut and just use innerHTML
- if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
- !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
- value = jQuery.htmlPrefilter( value );
- try {
- for ( ; i < l; i++ ) {
- elem = this[ i ] || {};
- // Remove element nodes and prevent memory leaks
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( getAll( elem, false ) );
- elem.innerHTML = value;
- }
- }
- elem = 0;
- // If using innerHTML throws an exception, use the fallback method
- } catch ( e ) {}
- }
- if ( elem ) {
- this.empty().append( value );
- }
- }, null, value, arguments.length );
- },
- replaceWith: function() {
- var ignored = [];
- // Make the changes, replacing each non-ignored context element with the new content
- return domManip( this, arguments, function( elem ) {
- var parent = this.parentNode;
- if ( jQuery.inArray( this, ignored ) < 0 ) {
- jQuery.cleanData( getAll( this ) );
- if ( parent ) {
- parent.replaceChild( elem, this );
- }
- }
- // Force callback invocation
- }, ignored );
- }
- } );
- jQuery.each( {
- appendTo: "append",
- prependTo: "prepend",
- insertBefore: "before",
- insertAfter: "after",
- replaceAll: "replaceWith"
- }, function( name, original ) {
- jQuery.fn[ name ] = function( selector ) {
- var elems,
- ret = [],
- insert = jQuery( selector ),
- last = insert.length - 1,
- i = 0;
- for ( ; i <= last; i++ ) {
- elems = i === last ? this : this.clone( true );
- jQuery( insert[ i ] )[ original ]( elems );
- // Support: QtWebKit
- // .get() because push.apply(_, arraylike) throws
- push.apply( ret, elems.get() );
- }
- return this.pushStack( ret );
- };
- } );
- var iframe,
- elemdisplay = {
- // Support: Firefox
- // We have to pre-define these values for FF (#10227)
- HTML: "block",
- BODY: "block"
- };
- /**
- * Retrieve the actual display of a element
- * @param {String} name nodeName of the element
- * @param {Object} doc Document object
- */
- // Called only from within defaultDisplay
- function actualDisplay( name, doc ) {
- var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
- display = jQuery.css( elem[ 0 ], "display" );
- // We don't have any data stored on the element,
- // so use "detach" method as fast way to get rid of the element
- elem.detach();
- return display;
- }
- /**
- * Try to determine the default display value of an element
- * @param {String} nodeName
- */
- function defaultDisplay( nodeName ) {
- var doc = document,
- display = elemdisplay[ nodeName ];
- if ( !display ) {
- display = actualDisplay( nodeName, doc );
- // If the simple way fails, read from inside an iframe
- if ( display === "none" || !display ) {
- // Use the already-created iframe if possible
- iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
- .appendTo( doc.documentElement );
- // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
- doc = iframe[ 0 ].contentDocument;
- // Support: IE
- doc.write();
- doc.close();
- display = actualDisplay( nodeName, doc );
- iframe.detach();
- }
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
- }
- return display;
- }
- var rmargin = ( /^margin/ );
- var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
- var getStyles = function( elem ) {
- // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
- // IE throws on elements created in popups
- // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
- var view = elem.ownerDocument.defaultView;
- if ( !view || !view.opener ) {
- view = window;
- }
- return view.getComputedStyle( elem );
- };
- var swap = function( elem, options, callback, args ) {
- var ret, name,
- old = {};
- // Remember the old values, and insert the new ones
- for ( name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
- }
- ret = callback.apply( elem, args || [] );
- // Revert the old values
- for ( name in options ) {
- elem.style[ name ] = old[ name ];
- }
- return ret;
- };
- var documentElement = document.documentElement;
- ( function() {
- var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
- container = document.createElement( "div" ),
- div = document.createElement( "div" );
- // Finish early in limited (non-browser) environments
- if ( !div.style ) {
- return;
- }
- // Support: IE9-11+
- // Style of cloned element affects source element cloned (#8908)
- div.style.backgroundClip = "content-box";
- div.cloneNode( true ).style.backgroundClip = "";
- support.clearCloneStyle = div.style.backgroundClip === "content-box";
- container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
- "padding:0;margin-top:1px;position:absolute";
- container.appendChild( div );
- // Executing both pixelPosition & boxSizingReliable tests require only one layout
- // so they're executed at the same time to save the second computation.
- function computeStyleTests() {
- div.style.cssText =
- // Support: Firefox<29, Android 2.3
- // Vendor-prefix box-sizing
- "-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%";
- div.innerHTML = "";
- documentElement.appendChild( container );
- var divStyle = window.getComputedStyle( div );
- pixelPositionVal = divStyle.top !== "1%";
- reliableMarginLeftVal = divStyle.marginLeft === "2px";
- boxSizingReliableVal = divStyle.width === "4px";
- // Support: Android 4.0 - 4.3 only
- // Some styles come back with percentage values, even though they shouldn't
- div.style.marginRight = "50%";
- pixelMarginRightVal = divStyle.marginRight === "4px";
- documentElement.removeChild( container );
- }
- jQuery.extend( support, {
- pixelPosition: function() {
- // This test is executed only once but we still do memoizing
- // since we can use the boxSizingReliable pre-computing.
- // No need to check if the test was already performed, though.
- computeStyleTests();
- return pixelPositionVal;
- },
- boxSizingReliable: function() {
- if ( boxSizingReliableVal == null ) {
- computeStyleTests();
- }
- return boxSizingReliableVal;
- },
- pixelMarginRight: function() {
- // Support: Android 4.0-4.3
- // We're checking for boxSizingReliableVal here instead of pixelMarginRightVal
- // since that compresses better and they're computed together anyway.
- if ( boxSizingReliableVal == null ) {
- computeStyleTests();
- }
- return pixelMarginRightVal;
- },
- reliableMarginLeft: function() {
- // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
- if ( boxSizingReliableVal == null ) {
- computeStyleTests();
- }
- return reliableMarginLeftVal;
- },
- reliableMarginRight: function() {
- // Support: Android 2.3
- // Check if div with explicit width and no margin-right incorrectly
- // gets computed margin-right based on width of container. (#3333)
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- // This support function is only executed once so no memoizing is needed.
- var ret,
- marginDiv = div.appendChild( document.createElement( "div" ) );
- // Reset CSS: box-sizing; display; margin; border; padding
- marginDiv.style.cssText = div.style.cssText =
- // Support: Android 2.3
- // Vendor-prefix box-sizing
- "-webkit-box-sizing:content-box;box-sizing:content-box;" +
- "display:block;margin:0;border:0;padding:0";
- marginDiv.style.marginRight = marginDiv.style.width = "0";
- div.style.width = "1px";
- documentElement.appendChild( container );
- ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight );
- documentElement.removeChild( container );
- div.removeChild( marginDiv );
- return ret;
- }
- } );
- } )();
- function curCSS( elem, name, computed ) {
- var width, minWidth, maxWidth, ret,
- style = elem.style;
- computed = computed || getStyles( elem );
- ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
- // Support: Opera 12.1x only
- // Fall back to style even without computed
- // computed is undefined for elems on document fragments
- if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
- ret = jQuery.style( elem, name );
- }
- // Support: IE9
- // getPropertyValue is only needed for .css('filter') (#12537)
- if ( computed ) {
- // A tribute to the "awesome hack by Dean Edwards"
- // Android Browser returns percentage for some values,
- // but width seems to be reliably pixels.
- // This is against the CSSOM draft spec:
- // http://dev.w3.org/csswg/cssom/#resolved-values
- if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
- // Remember the original values
- width = style.width;
- minWidth = style.minWidth;
- maxWidth = style.maxWidth;
- // Put in the new values to get a computed value out
- style.minWidth = style.maxWidth = style.width = ret;
- ret = computed.width;
- // Revert the changed values
- style.width = width;
- style.minWidth = minWidth;
- style.maxWidth = maxWidth;
- }
- }
- return ret !== undefined ?
- // Support: IE9-11+
- // IE returns zIndex value as an integer.
- ret + "" :
- ret;
- }
- function addGetHookIf( conditionFn, hookFn ) {
- // Define the hook, we'll check on the first run if it's really needed.
- return {
- get: function() {
- if ( conditionFn() ) {
- // Hook not needed (or it's not possible to use it due
- // to missing dependency), remove it.
- delete this.get;
- return;
- }
- // Hook needed; redefine it so that the support test is not executed again.
- return ( this.get = hookFn ).apply( this, arguments );
- }
- };
- }
- var
- // Swappable if display is none or starts with table
- // except "table", "table-cell", or "table-caption"
- // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
- rdisplayswap = /^(none|table(?!-c[ea]).+)/,
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
- cssNormalTransform = {
- letterSpacing: "0",
- fontWeight: "400"
- },
- cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
- emptyStyle = document.createElement( "div" ).style;
- // Return a css property mapped to a potentially vendor prefixed property
- function vendorPropName( name ) {
- // Shortcut for names that are not vendor prefixed
- if ( name in emptyStyle ) {
- return name;
- }
- // Check for vendor prefixed names
- var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
- i = cssPrefixes.length;
- while ( i-- ) {
- name = cssPrefixes[ i ] + capName;
- if ( name in emptyStyle ) {
- return name;
- }
- }
- }
- function setPositiveNumber( elem, value, subtract ) {
- // Any relative (+/-) values have already been
- // normalized at this point
- var matches = rcssNum.exec( value );
- return matches ?
- // Guard against undefined "subtract", e.g., when used as in cssHooks
- Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
- value;
- }
- function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
- var i = extra === ( isBorderBox ? "border" : "content" ) ?
- // If we already have the right measurement, avoid augmentation
- 4 :
- // Otherwise initialize for horizontal or vertical properties
- name === "width" ? 1 : 0,
- val = 0;
- for ( ; i < 4; i += 2 ) {
- // Both box models exclude margin, so add it if we want it
- if ( extra === "margin" ) {
- val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
- }
- if ( isBorderBox ) {
- // border-box includes padding, so remove it if we want content
- if ( extra === "content" ) {
- val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
- }
- // At this point, extra isn't border nor margin, so remove border
- if ( extra !== "margin" ) {
- val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
- }
- } else {
- // At this point, extra isn't content, so add padding
- val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
- // At this point, extra isn't content nor padding, so add border
- if ( extra !== "padding" ) {
- val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
- }
- }
- }
- return val;
- }
- function getWidthOrHeight( elem, name, extra ) {
- // Start with offset property, which is equivalent to the border-box value
- var valueIsBorderBox = true,
- val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
- styles = getStyles( elem ),
- isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
- // Some non-html elements return undefined for offsetWidth, so check for null/undefined
- // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
- // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
- if ( val <= 0 || val == null ) {
- // Fall back to computed then uncomputed css if necessary
- val = curCSS( elem, name, styles );
- if ( val < 0 || val == null ) {
- val = elem.style[ name ];
- }
- // Computed unit is not pixels. Stop here and return.
- if ( rnumnonpx.test( val ) ) {
- return val;
- }
- // Check for style in case a browser which returns unreliable values
- // for getComputedStyle silently falls back to the reliable elem.style
- valueIsBorderBox = isBorderBox &&
- ( support.boxSizingReliable() || val === elem.style[ name ] );
- // Normalize "", auto, and prepare for extra
- val = parseFloat( val ) || 0;
- }
- // Use the active box-sizing model to add/subtract irrelevant styles
- return ( val +
- augmentWidthOrHeight(
- elem,
- name,
- extra || ( isBorderBox ? "border" : "content" ),
- valueIsBorderBox,
- styles
- )
- ) + "px";
- }
- function showHide( elements, show ) {
- var display, elem, hidden,
- values = [],
- index = 0,
- length = elements.length;
- for ( ; index < length; index++ ) {
- elem = elements[ index ];
- if ( !elem.style ) {
- continue;
- }
- values[ index ] = dataPriv.get( elem, "olddisplay" );
- display = elem.style.display;
- if ( show ) {
- // Reset the inline display of this element to learn if it is
- // being hidden by cascaded rules or not
- if ( !values[ index ] && display === "none" ) {
- elem.style.display = "";
- }
- // Set elements which have been overridden with display: none
- // in a stylesheet to whatever the default browser style is
- // for such an element
- if ( elem.style.display === "" && isHidden( elem ) ) {
- values[ index ] = dataPriv.access(
- elem,
- "olddisplay",
- defaultDisplay( elem.nodeName )
- );
- }
- } else {
- hidden = isHidden( elem );
- if ( display !== "none" || !hidden ) {
- dataPriv.set(
- elem,
- "olddisplay",
- hidden ? display : jQuery.css( elem, "display" )
- );
- }
- }
- }
- // Set the display of most of the elements in a second loop
- // to avoid the constant reflow
- for ( index = 0; index < length; index++ ) {
- elem = elements[ index ];
- if ( !elem.style ) {
- continue;
- }
- if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
- elem.style.display = show ? values[ index ] || "" : "none";
- }
- }
- return elements;
- }
- jQuery.extend( {
- // Add in style property hooks for overriding the default
- // behavior of getting and setting a style property
- cssHooks: {
- opacity: {
- get: function( elem, computed ) {
- if ( computed ) {
- // We should always get a number back from opacity
- var ret = curCSS( elem, "opacity" );
- return ret === "" ? "1" : ret;
- }
- }
- }
- },
- // Don't automatically add "px" to these possibly-unitless properties
- cssNumber: {
- "animationIterationCount": true,
- "columnCount": true,
- "fillOpacity": true,
- "flexGrow": true,
- "flexShrink": true,
- "fontWeight": true,
- "lineHeight": true,
- "opacity": true,
- "order": true,
- "orphans": true,
- "widows": true,
- "zIndex": true,
- "zoom": true
- },
- // Add in properties whose names you wish to fix before
- // setting or getting the value
- cssProps: {
- "float": "cssFloat"
- },
- // Get and set the style property on a DOM Node
- style: function( elem, name, value, extra ) {
- // Don't set styles on text and comment nodes
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
- return;
- }
- // Make sure that we're working with the right name
- var ret, type, hooks,
- origName = jQuery.camelCase( name ),
- style = elem.style;
- name = jQuery.cssProps[ origName ] ||
- ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
- // Gets hook for the prefixed version, then unprefixed version
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
- // Check if we're setting a value
- if ( value !== undefined ) {
- type = typeof value;
- // Convert "+=" or "-=" to relative numbers (#7345)
- if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
- value = adjustCSS( elem, name, ret );
- // Fixes bug #9237
- type = "number";
- }
- // Make sure that null and NaN values aren't set (#7116)
- if ( value == null || value !== value ) {
- return;
- }
- // If a number was passed in, add the unit (except for certain CSS properties)
- if ( type === "number" ) {
- value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
- }
- // Support: IE9-11+
- // background-* props affect original clone's values
- if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
- style[ name ] = "inherit";
- }
- // If a hook was provided, use that value, otherwise just set the specified value
- if ( !hooks || !( "set" in hooks ) ||
- ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
- style[ name ] = value;
- }
- } else {
- // If a hook was provided get the non-computed value from there
- if ( hooks && "get" in hooks &&
- ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
- return ret;
- }
- // Otherwise just get the value from the style object
- return style[ name ];
- }
- },
- css: function( elem, name, extra, styles ) {
- var val, num, hooks,
- origName = jQuery.camelCase( name );
- // Make sure that we're working with the right name
- name = jQuery.cssProps[ origName ] ||
- ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
- // Try prefixed name followed by the unprefixed name
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
- // If a hook was provided get the computed value from there
- if ( hooks && "get" in hooks ) {
- val = hooks.get( elem, true, extra );
- }
- // Otherwise, if a way to get the computed value exists, use that
- if ( val === undefined ) {
- val = curCSS( elem, name, styles );
- }
- // Convert "normal" to computed value
- if ( val === "normal" && name in cssNormalTransform ) {
- val = cssNormalTransform[ name ];
- }
- // Make numeric if forced or a qualifier was provided and val looks numeric
- if ( extra === "" || extra ) {
- num = parseFloat( val );
- return extra === true || isFinite( num ) ? num || 0 : val;
- }
- return val;
- }
- } );
- jQuery.each( [ "height", "width" ], function( i, name ) {
- jQuery.cssHooks[ name ] = {
- get: function( elem, computed, extra ) {
- if ( computed ) {
- // Certain elements can have dimension info if we invisibly show them
- // but it must have a current display style that would benefit
- return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
- elem.offsetWidth === 0 ?
- swap( elem, cssShow, function() {
- return getWidthOrHeight( elem, name, extra );
- } ) :
- getWidthOrHeight( elem, name, extra );
- }
- },
- set: function( elem, value, extra ) {
- var matches,
- styles = extra && getStyles( elem ),
- subtract = extra && augmentWidthOrHeight(
- elem,
- name,
- extra,
- jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
- styles
- );
- // Convert to pixels if value adjustment is needed
- if ( subtract && ( matches = rcssNum.exec( value ) ) &&
- ( matches[ 3 ] || "px" ) !== "px" ) {
- elem.style[ name ] = value;
- value = jQuery.css( elem, name );
- }
- return setPositiveNumber( elem, value, subtract );
- }
- };
- } );
- jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
- function( elem, computed ) {
- if ( computed ) {
- return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
- elem.getBoundingClientRect().left -
- swap( elem, { marginLeft: 0 }, function() {
- return elem.getBoundingClientRect().left;
- } )
- ) + "px";
- }
- }
- );
- // Support: Android 2.3
- jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
- function( elem, computed ) {
- if ( computed ) {
- return swap( elem, { "display": "inline-block" },
- curCSS, [ elem, "marginRight" ] );
- }
- }
- );
- // These hooks are used by animate to expand properties
- jQuery.each( {
- margin: "",
- padding: "",
- border: "Width"
- }, function( prefix, suffix ) {
- jQuery.cssHooks[ prefix + suffix ] = {
- expand: function( value ) {
- var i = 0,
- expanded = {},
- // Assumes a single number if not a string
- parts = typeof value === "string" ? value.split( " " ) : [ value ];
- for ( ; i < 4; i++ ) {
- expanded[ prefix + cssExpand[ i ] + suffix ] =
- parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
- }
- return expanded;
- }
- };
- if ( !rmargin.test( prefix ) ) {
- jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
- }
- } );
- jQuery.fn.extend( {
- css: function( name, value ) {
- return access( this, function( elem, name, value ) {
- var styles, len,
- map = {},
- i = 0;
- if ( jQuery.isArray( name ) ) {
- styles = getStyles( elem );
- len = name.length;
- for ( ; i < len; i++ ) {
- map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
- }
- return map;
- }
- return value !== undefined ?
- jQuery.style( elem, name, value ) :
- jQuery.css( elem, name );
- }, name, value, arguments.length > 1 );
- },
- show: function() {
- return showHide( this, true );
- },
- hide: function() {
- return showHide( this );
- },
- toggle: function( state ) {
- if ( typeof state === "boolean" ) {
- return state ? this.show() : this.hide();
- }
- return this.each( function() {
- if ( isHidden( this ) ) {
- jQuery( this ).show();
- } else {
- jQuery( this ).hide();
- }
- } );
- }
- } );
- function Tween( elem, options, prop, end, easing ) {
- return new Tween.prototype.init( elem, options, prop, end, easing );
- }
- jQuery.Tween = Tween;
- Tween.prototype = {
- constructor: Tween,
- init: function( elem, options, prop, end, easing, unit ) {
- this.elem = elem;
- this.prop = prop;
- this.easing = easing || jQuery.easing._default;
- this.options = options;
- this.start = this.now = this.cur();
- this.end = end;
- this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
- },
- cur: function() {
- var hooks = Tween.propHooks[ this.prop ];
- return hooks && hooks.get ?
- hooks.get( this ) :
- Tween.propHooks._default.get( this );
- },
- run: function( percent ) {
- var eased,
- hooks = Tween.propHooks[ this.prop ];
- if ( this.options.duration ) {
- this.pos = eased = jQuery.easing[ this.easing ](
- percent, this.options.duration * percent, 0, 1, this.options.duration
- );
- } else {
- this.pos = eased = percent;
- }
- this.now = ( this.end - this.start ) * eased + this.start;
- if ( this.options.step ) {
- this.options.step.call( this.elem, this.now, this );
- }
- if ( hooks && hooks.set ) {
- hooks.set( this );
- } else {
- Tween.propHooks._default.set( this );
- }
- return this;
- }
- };
- Tween.prototype.init.prototype = Tween.prototype;
- Tween.propHooks = {
- _default: {
- get: function( tween ) {
- var result;
- // Use a property on the element directly when it is not a DOM element,
- // or when there is no matching style property that exists.
- if ( tween.elem.nodeType !== 1 ||
- tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
- return tween.elem[ tween.prop ];
- }
- // Passing an empty string as a 3rd parameter to .css will automatically
- // attempt a parseFloat and fallback to a string if the parse fails.
- // Simple values such as "10px" are parsed to Float;
- // complex values such as "rotate(1rad)" are returned as-is.
- result = jQuery.css( tween.elem, tween.prop, "" );
- // Empty strings, null, undefined and "auto" are converted to 0.
- return !result || result === "auto" ? 0 : result;
- },
- set: function( tween ) {
- // Use step hook for back compat.
- // Use cssHook if its there.
- // Use .style if available and use plain properties where available.
- if ( jQuery.fx.step[ tween.prop ] ) {
- jQuery.fx.step[ tween.prop ]( tween );
- } else if ( tween.elem.nodeType === 1 &&
- ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
- jQuery.cssHooks[ tween.prop ] ) ) {
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
- } else {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
- }
- };
- // Support: IE9
- // Panic based approach to setting things on disconnected nodes
- Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
- set: function( tween ) {
- if ( tween.elem.nodeType && tween.elem.parentNode ) {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
- };
- jQuery.easing = {
- linear: function( p ) {
- return p;
- },
- swing: function( p ) {
- return 0.5 - Math.cos( p * Math.PI ) / 2;
- },
- _default: "swing"
- };
- jQuery.fx = Tween.prototype.init;
- // Back Compat <1.8 extension point
- jQuery.fx.step = {};
- var
- fxNow, timerId,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rrun = /queueHooks$/;
- // Animations created synchronously will run synchronously
- function createFxNow() {
- window.setTimeout( function() {
- fxNow = undefined;
- } );
- return ( fxNow = jQuery.now() );
- }
- // Generate parameters to create a standard animation
- function genFx( type, includeWidth ) {
- var which,
- i = 0,
- attrs = { height: type };
- // If we include width, step value is 1 to do all cssExpand values,
- // otherwise step value is 2 to skip over Left and Right
- includeWidth = includeWidth ? 1 : 0;
- for ( ; i < 4 ; i += 2 - includeWidth ) {
- which = cssExpand[ i ];
- attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
- }
- if ( includeWidth ) {
- attrs.opacity = attrs.width = type;
- }
- return attrs;
- }
- function createTween( value, prop, animation ) {
- var tween,
- collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
- index = 0,
- length = collection.length;
- for ( ; index < length; index++ ) {
- if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
- // We're done with this property
- return tween;
- }
- }
- }
- function defaultPrefilter( elem, props, opts ) {
- /* jshint validthis: true */
- var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
- anim = this,
- orig = {},
- style = elem.style,
- hidden = elem.nodeType && isHidden( elem ),
- dataShow = dataPriv.get( elem, "fxshow" );
- // Handle queue: false promises
- if ( !opts.queue ) {
- hooks = jQuery._queueHooks( elem, "fx" );
- if ( hooks.unqueued == null ) {
- hooks.unqueued = 0;
- oldfire = hooks.empty.fire;
- hooks.empty.fire = function() {
- if ( !hooks.unqueued ) {
- oldfire();
- }
- };
- }
- hooks.unqueued++;
- anim.always( function() {
- // Ensure the complete handler is called before this completes
- anim.always( function() {
- hooks.unqueued--;
- if ( !jQuery.queue( elem, "fx" ).length ) {
- hooks.empty.fire();
- }
- } );
- } );
- }
- // Height/width overflow pass
- if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
- // Make sure that nothing sneaks out
- // Record all 3 overflow attributes because IE9-10 do not
- // change the overflow attribute when overflowX and
- // overflowY are set to the same value
- opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
- // Set display property to inline-block for height/width
- // animations on inline elements that are having width/height animated
- display = jQuery.css( elem, "display" );
- // Test default display if display is currently "none"
- checkDisplay = display === "none" ?
- dataPriv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
- if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
- style.display = "inline-block";
- }
- }
- if ( opts.overflow ) {
- style.overflow = "hidden";
- anim.always( function() {
- style.overflow = opts.overflow[ 0 ];
- style.overflowX = opts.overflow[ 1 ];
- style.overflowY = opts.overflow[ 2 ];
- } );
- }
- // show/hide pass
- for ( prop in props ) {
- value = props[ prop ];
- if ( rfxtypes.exec( value ) ) {
- delete props[ prop ];
- toggle = toggle || value === "toggle";
- if ( value === ( hidden ? "hide" : "show" ) ) {
- // If there is dataShow left over from a stopped hide or show
- // and we are going to proceed with show, we should pretend to be hidden
- if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
- hidden = true;
- } else {
- continue;
- }
- }
- orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
- // Any non-fx value stops us from restoring the original display value
- } else {
- display = undefined;
- }
- }
- if ( !jQuery.isEmptyObject( orig ) ) {
- if ( dataShow ) {
- if ( "hidden" in dataShow ) {
- hidden = dataShow.hidden;
- }
- } else {
- dataShow = dataPriv.access( elem, "fxshow", {} );
- }
- // Store state if its toggle - enables .stop().toggle() to "reverse"
- if ( toggle ) {
- dataShow.hidden = !hidden;
- }
- if ( hidden ) {
- jQuery( elem ).show();
- } else {
- anim.done( function() {
- jQuery( elem ).hide();
- } );
- }
- anim.done( function() {
- var prop;
- dataPriv.remove( elem, "fxshow" );
- for ( prop in orig ) {
- jQuery.style( elem, prop, orig[ prop ] );
- }
- } );
- for ( prop in orig ) {
- tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
- if ( !( prop in dataShow ) ) {
- dataShow[ prop ] = tween.start;
- if ( hidden ) {
- tween.end = tween.start;
- tween.start = prop === "width" || prop === "height" ? 1 : 0;
- }
- }
- }
- // If this is a noop like .hide().hide(), restore an overwritten display value
- } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
- style.display = display;
- }
- }
- function propFilter( props, specialEasing ) {
- var index, name, easing, value, hooks;
- // camelCase, specialEasing and expand cssHook pass
- for ( index in props ) {
- name = jQuery.camelCase( index );
- easing = specialEasing[ name ];
- value = props[ index ];
- if ( jQuery.isArray( value ) ) {
- easing = value[ 1 ];
- value = props[ index ] = value[ 0 ];
- }
- if ( index !== name ) {
- props[ name ] = value;
- delete props[ index ];
- }
- hooks = jQuery.cssHooks[ name ];
- if ( hooks && "expand" in hooks ) {
- value = hooks.expand( value );
- delete props[ name ];
- // Not quite $.extend, this won't overwrite existing keys.
- // Reusing 'index' because we have the correct "name"
- for ( index in value ) {
- if ( !( index in props ) ) {
- props[ index ] = value[ index ];
- specialEasing[ index ] = easing;
- }
- }
- } else {
- specialEasing[ name ] = easing;
- }
- }
- }
- function Animation( elem, properties, options ) {
- var result,
- stopped,
- index = 0,
- length = Animation.prefilters.length,
- deferred = jQuery.Deferred().always( function() {
- // Don't match elem in the :animated selector
- delete tick.elem;
- } ),
- tick = function() {
- if ( stopped ) {
- return false;
- }
- var currentTime = fxNow || createFxNow(),
- remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
- // Support: Android 2.3
- // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
- temp = remaining / animation.duration || 0,
- percent = 1 - temp,
- index = 0,
- length = animation.tweens.length;
- for ( ; index < length ; index++ ) {
- animation.tweens[ index ].run( percent );
- }
- deferred.notifyWith( elem, [ animation, percent, remaining ] );
- if ( percent < 1 && length ) {
- return remaining;
- } else {
- deferred.resolveWith( elem, [ animation ] );
- return false;
- }
- },
- animation = deferred.promise( {
- elem: elem,
- props: jQuery.extend( {}, properties ),
- opts: jQuery.extend( true, {
- specialEasing: {},
- easing: jQuery.easing._default
- }, options ),
- originalProperties: properties,
- originalOptions: options,
- startTime: fxNow || createFxNow(),
- duration: options.duration,
- tweens: [],
- createTween: function( prop, end ) {
- var tween = jQuery.Tween( elem, animation.opts, prop, end,
- animation.opts.specialEasing[ prop ] || animation.opts.easing );
- animation.tweens.push( tween );
- return tween;
- },
- stop: function( gotoEnd ) {
- var index = 0,
- // If we are going to the end, we want to run all the tweens
- // otherwise we skip this part
- length = gotoEnd ? animation.tweens.length : 0;
- if ( stopped ) {
- return this;
- }
- stopped = true;
- for ( ; index < length ; index++ ) {
- animation.tweens[ index ].run( 1 );
- }
- // Resolve when we played the last frame; otherwise, reject
- if ( gotoEnd ) {
- deferred.notifyWith( elem, [ animation, 1, 0 ] );
- deferred.resolveWith( elem, [ animation, gotoEnd ] );
- } else {
- deferred.rejectWith( elem, [ animation, gotoEnd ] );
- }
- return this;
- }
- } ),
- props = animation.props;
- propFilter( props, animation.opts.specialEasing );
- for ( ; index < length ; index++ ) {
- result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
- if ( result ) {
- if ( jQuery.isFunction( result.stop ) ) {
- jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
- jQuery.proxy( result.stop, result );
- }
- return result;
- }
- }
- jQuery.map( props, createTween, animation );
- if ( jQuery.isFunction( animation.opts.start ) ) {
- animation.opts.start.call( elem, animation );
- }
- jQuery.fx.timer(
- jQuery.extend( tick, {
- elem: elem,
- anim: animation,
- queue: animation.opts.queue
- } )
- );
- // attach callbacks from options
- return animation.progress( animation.opts.progress )
- .done( animation.opts.done, animation.opts.complete )
- .fail( animation.opts.fail )
- .always( animation.opts.always );
- }
- jQuery.Animation = jQuery.extend( Animation, {
- tweeners: {
- "*": [ function( prop, value ) {
- var tween = this.createTween( prop, value );
- adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
- return tween;
- } ]
- },
- tweener: function( props, callback ) {
- if ( jQuery.isFunction( props ) ) {
- callback = props;
- props = [ "*" ];
- } else {
- props = props.match( rnotwhite );
- }
- var prop,
- index = 0,
- length = props.length;
- for ( ; index < length ; index++ ) {
- prop = props[ index ];
- Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
- Animation.tweeners[ prop ].unshift( callback );
- }
- },
- prefilters: [ defaultPrefilter ],
- prefilter: function( callback, prepend ) {
- if ( prepend ) {
- Animation.prefilters.unshift( callback );
- } else {
- Animation.prefilters.push( callback );
- }
- }
- } );
- jQuery.speed = function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
- };
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ?
- opt.duration : opt.duration in jQuery.fx.speeds ?
- jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
- // Normalize opt.queue - true/undefined/null -> "fx"
- if ( opt.queue == null || opt.queue === true ) {
- opt.queue = "fx";
- }
- // Queueing
- opt.old = opt.complete;
- opt.complete = function() {
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
- if ( opt.queue ) {
- jQuery.dequeue( this, opt.queue );
- }
- };
- return opt;
- };
- jQuery.fn.extend( {
- fadeTo: function( speed, to, easing, callback ) {
- // Show any hidden elements after setting opacity to 0
- return this.filter( isHidden ).css( "opacity", 0 ).show()
- // Animate to the value specified
- .end().animate( { opacity: to }, speed, easing, callback );
- },
- animate: function( prop, speed, easing, callback ) {
- var empty = jQuery.isEmptyObject( prop ),
- optall = jQuery.speed( speed, easing, callback ),
- doAnimation = function() {
- // Operate on a copy of prop so per-property easing won't be lost
- var anim = Animation( this, jQuery.extend( {}, prop ), optall );
- // Empty animations, or finishing resolves immediately
- if ( empty || dataPriv.get( this, "finish" ) ) {
- anim.stop( true );
- }
- };
- doAnimation.finish = doAnimation;
- return empty || optall.queue === false ?
- this.each( doAnimation ) :
- this.queue( optall.queue, doAnimation );
- },
- stop: function( type, clearQueue, gotoEnd ) {
- var stopQueue = function( hooks ) {
- var stop = hooks.stop;
- delete hooks.stop;
- stop( gotoEnd );
- };
- if ( typeof type !== "string" ) {
- gotoEnd = clearQueue;
- clearQueue = type;
- type = undefined;
- }
- if ( clearQueue && type !== false ) {
- this.queue( type || "fx", [] );
- }
- return this.each( function() {
- var dequeue = true,
- index = type != null && type + "queueHooks",
- timers = jQuery.timers,
- data = dataPriv.get( this );
- if ( index ) {
- if ( data[ index ] && data[ index ].stop ) {
- stopQueue( data[ index ] );
- }
- } else {
- for ( index in data ) {
- if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
- stopQueue( data[ index ] );
- }
- }
- }
- for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this &&
- ( type == null || timers[ index ].queue === type ) ) {
- timers[ index ].anim.stop( gotoEnd );
- dequeue = false;
- timers.splice( index, 1 );
- }
- }
- // Start the next in the queue if the last step wasn't forced.
- // Timers currently will call their complete callbacks, which
- // will dequeue but only if they were gotoEnd.
- if ( dequeue || !gotoEnd ) {
- jQuery.dequeue( this, type );
- }
- } );
- },
- finish: function( type ) {
- if ( type !== false ) {
- type = type || "fx";
- }
- return this.each( function() {
- var index,
- data = dataPriv.get( this ),
- queue = data[ type + "queue" ],
- hooks = data[ type + "queueHooks" ],
- timers = jQuery.timers,
- length = queue ? queue.length : 0;
- // Enable finishing flag on private data
- data.finish = true;
- // Empty the queue first
- jQuery.queue( this, type, [] );
- if ( hooks && hooks.stop ) {
- hooks.stop.call( this, true );
- }
- // Look for any active animations, and finish them
- for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
- timers[ index ].anim.stop( true );
- timers.splice( index, 1 );
- }
- }
- // Look for any animations in the old queue and finish them
- for ( index = 0; index < length; index++ ) {
- if ( queue[ index ] && queue[ index ].finish ) {
- queue[ index ].finish.call( this );
- }
- }
- // Turn off finishing flag
- delete data.finish;
- } );
- }
- } );
- jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
- var cssFn = jQuery.fn[ name ];
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return speed == null || typeof speed === "boolean" ?
- cssFn.apply( this, arguments ) :
- this.animate( genFx( name, true ), speed, easing, callback );
- };
- } );
- // Generate shortcuts for custom animations
- jQuery.each( {
- slideDown: genFx( "show" ),
- slideUp: genFx( "hide" ),
- slideToggle: genFx( "toggle" ),
- fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" },
- fadeToggle: { opacity: "toggle" }
- }, function( name, props ) {
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return this.animate( props, speed, easing, callback );
- };
- } );
- jQuery.timers = [];
- jQuery.fx.tick = function() {
- var timer,
- i = 0,
- timers = jQuery.timers;
- fxNow = jQuery.now();
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
- // Checks the timer has not already been removed
- if ( !timer() && timers[ i ] === timer ) {
- timers.splice( i--, 1 );
- }
- }
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- fxNow = undefined;
- };
- jQuery.fx.timer = function( timer ) {
- jQuery.timers.push( timer );
- if ( timer() ) {
- jQuery.fx.start();
- } else {
- jQuery.timers.pop();
- }
- };
- jQuery.fx.interval = 13;
- jQuery.fx.start = function() {
- if ( !timerId ) {
- timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
- }
- };
- jQuery.fx.stop = function() {
- window.clearInterval( timerId );
- timerId = null;
- };
- jQuery.fx.speeds = {
- slow: 600,
- fast: 200,
- // Default speed
- _default: 400
- };
- // Based off of the plugin by Clint Helfers, with permission.
- // http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
- jQuery.fn.delay = function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
- type = type || "fx";
- return this.queue( type, function( next, hooks ) {
- var timeout = window.setTimeout( next, time );
- hooks.stop = function() {
- window.clearTimeout( timeout );
- };
- } );
- };
- ( function() {
- var input = document.createElement( "input" ),
- select = document.createElement( "select" ),
- opt = select.appendChild( document.createElement( "option" ) );
- input.type = "checkbox";
- // Support: iOS<=5.1, Android<=4.2+
- // Default value for a checkbox should be "on"
- support.checkOn = input.value !== "";
- // Support: IE<=11+
- // Must access selectedIndex to make default options select
- support.optSelected = opt.selected;
- // Support: Android<=2.3
- // Options inside disabled selects are incorrectly marked as disabled
- select.disabled = true;
- support.optDisabled = !opt.disabled;
- // Support: IE<=11+
- // An input loses its value after becoming a radio
- input = document.createElement( "input" );
- input.value = "t";
- input.type = "radio";
- support.radioValue = input.value === "t";
- } )();
- var boolHook,
- attrHandle = jQuery.expr.attrHandle;
- jQuery.fn.extend( {
- attr: function( name, value ) {
- return access( this, jQuery.attr, name, value, arguments.length > 1 );
- },
- removeAttr: function( name ) {
- return this.each( function() {
- jQuery.removeAttr( this, name );
- } );
- }
- } );
- jQuery.extend( {
- attr: function( elem, name, value ) {
- var ret, hooks,
- nType = elem.nodeType;
- // Don't get/set attributes on text, comment and attribute nodes
- if ( nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
- // Fallback to prop when attributes are not supported
- if ( typeof elem.getAttribute === "undefined" ) {
- return jQuery.prop( elem, name, value );
- }
- // All attributes are lowercase
- // Grab necessary hook if one is defined
- if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
- name = name.toLowerCase();
- hooks = jQuery.attrHooks[ name ] ||
- ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
- }
- if ( value !== undefined ) {
- if ( value === null ) {
- jQuery.removeAttr( elem, name );
- return;
- }
- if ( hooks && "set" in hooks &&
- ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
- return ret;
- }
- elem.setAttribute( name, value + "" );
- return value;
- }
- if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
- return ret;
- }
- ret = jQuery.find.attr( elem, name );
- // Non-existent attributes return null, we normalize to undefined
- return ret == null ? undefined : ret;
- },
- attrHooks: {
- type: {
- set: function( elem, value ) {
- if ( !support.radioValue && value === "radio" &&
- jQuery.nodeName( elem, "input" ) ) {
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- }
- },
- removeAttr: function( elem, value ) {
- var name, propName,
- i = 0,
- attrNames = value && value.match( rnotwhite );
- if ( attrNames && elem.nodeType === 1 ) {
- while ( ( name = attrNames[ i++ ] ) ) {
- propName = jQuery.propFix[ name ] || name;
- // Boolean attributes get special treatment (#10870)
- if ( jQuery.expr.match.bool.test( name ) ) {
- // Set corresponding property to false
- elem[ propName ] = false;
- }
- elem.removeAttribute( name );
- }
- }
- }
- } );
- // Hooks for boolean attributes
- boolHook = {
- set: function( elem, value, name ) {
- if ( value === false ) {
- // Remove boolean attributes when set to false
- jQuery.removeAttr( elem, name );
- } else {
- elem.setAttribute( name, name );
- }
- return name;
- }
- };
- jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
- var getter = attrHandle[ name ] || jQuery.find.attr;
- attrHandle[ name ] = function( elem, name, isXML ) {
- var ret, handle;
- if ( !isXML ) {
- // Avoid an infinite loop by temporarily removing this function from the getter
- handle = attrHandle[ name ];
- attrHandle[ name ] = ret;
- ret = getter( elem, name, isXML ) != null ?
- name.toLowerCase() :
- null;
- attrHandle[ name ] = handle;
- }
- return ret;
- };
- } );
- var rfocusable = /^(?:input|select|textarea|button)$/i,
- rclickable = /^(?:a|area)$/i;
- jQuery.fn.extend( {
- prop: function( name, value ) {
- return access( this, jQuery.prop, name, value, arguments.length > 1 );
- },
- removeProp: function( name ) {
- return this.each( function() {
- delete this[ jQuery.propFix[ name ] || name ];
- } );
- }
- } );
- jQuery.extend( {
- prop: function( elem, name, value ) {
- var ret, hooks,
- nType = elem.nodeType;
- // Don't get/set properties on text, comment and attribute nodes
- if ( nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
- if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
- // Fix name and attach hooks
- name = jQuery.propFix[ name ] || name;
- hooks = jQuery.propHooks[ name ];
- }
- if ( value !== undefined ) {
- if ( hooks && "set" in hooks &&
- ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
- return ret;
- }
- return ( elem[ name ] = value );
- }
- if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
- return ret;
- }
- return elem[ name ];
- },
- propHooks: {
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the
- // correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- // Use proper attribute retrieval(#12072)
- var tabindex = jQuery.find.attr( elem, "tabindex" );
- return tabindex ?
- parseInt( tabindex, 10 ) :
- rfocusable.test( elem.nodeName ) ||
- rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- -1;
- }
- }
- },
- propFix: {
- "for": "htmlFor",
- "class": "className"
- }
- } );
- // Support: IE <=11 only
- // Accessing the selectedIndex property
- // forces the browser to respect setting selected
- // on the option
- // The getter ensures a default option is selected
- // when in an optgroup
- if ( !support.optSelected ) {
- jQuery.propHooks.selected = {
- get: function( elem ) {
- var parent = elem.parentNode;
- if ( parent && parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- return null;
- },
- set: function( elem ) {
- var parent = elem.parentNode;
- if ( parent ) {
- parent.selectedIndex;
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- }
- }
- };
- }
- jQuery.each( [
- "tabIndex",
- "readOnly",
- "maxLength",
- "cellSpacing",
- "cellPadding",
- "rowSpan",
- "colSpan",
- "useMap",
- "frameBorder",
- "contentEditable"
- ], function() {
- jQuery.propFix[ this.toLowerCase() ] = this;
- } );
- var rclass = /[\t\r\n\f]/g;
- function getClass( elem ) {
- return elem.getAttribute && elem.getAttribute( "class" ) || "";
- }
- jQuery.fn.extend( {
- addClass: function( value ) {
- var classes, elem, cur, curValue, clazz, j, finalValue,
- i = 0;
- if ( jQuery.isFunction( value ) ) {
- return this.each( function( j ) {
- jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
- } );
- }
- if ( typeof value === "string" && value ) {
- classes = value.match( rnotwhite ) || [];
- while ( ( elem = this[ i++ ] ) ) {
- curValue = getClass( elem );
- cur = elem.nodeType === 1 &&
- ( " " + curValue + " " ).replace( rclass, " " );
- if ( cur ) {
- j = 0;
- while ( ( clazz = classes[ j++ ] ) ) {
- if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
- cur += clazz + " ";
- }
- }
- // Only assign if different to avoid unneeded rendering.
- finalValue = jQuery.trim( cur );
- if ( curValue !== finalValue ) {
- elem.setAttribute( "class", finalValue );
- }
- }
- }
- }
- return this;
- },
- removeClass: function( value ) {
- var classes, elem, cur, curValue, clazz, j, finalValue,
- i = 0;
- if ( jQuery.isFunction( value ) ) {
- return this.each( function( j ) {
- jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
- } );
- }
- if ( !arguments.length ) {
- return this.attr( "class", "" );
- }
- if ( typeof value === "string" && value ) {
- classes = value.match( rnotwhite ) || [];
- while ( ( elem = this[ i++ ] ) ) {
- curValue = getClass( elem );
- // This expression is here for better compressibility (see addClass)
- cur = elem.nodeType === 1 &&
- ( " " + curValue + " " ).replace( rclass, " " );
- if ( cur ) {
- j = 0;
- while ( ( clazz = classes[ j++ ] ) ) {
- // Remove *all* instances
- while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
- cur = cur.replace( " " + clazz + " ", " " );
- }
- }
- // Only assign if different to avoid unneeded rendering.
- finalValue = jQuery.trim( cur );
- if ( curValue !== finalValue ) {
- elem.setAttribute( "class", finalValue );
- }
- }
- }
- }
- return this;
- },
- toggleClass: function( value, stateVal ) {
- var type = typeof value;
- if ( typeof stateVal === "boolean" && type === "string" ) {
- return stateVal ? this.addClass( value ) : this.removeClass( value );
- }
- if ( jQuery.isFunction( value ) ) {
- return this.each( function( i ) {
- jQuery( this ).toggleClass(
- value.call( this, i, getClass( this ), stateVal ),
- stateVal
- );
- } );
- }
- return this.each( function() {
- var className, i, self, classNames;
- if ( type === "string" ) {
- // Toggle individual class names
- i = 0;
- self = jQuery( this );
- classNames = value.match( rnotwhite ) || [];
- while ( ( className = classNames[ i++ ] ) ) {
- // Check each className given, space separated list
- if ( self.hasClass( className ) ) {
- self.removeClass( className );
- } else {
- self.addClass( className );
- }
- }
- // Toggle whole class name
- } else if ( value === undefined || type === "boolean" ) {
- className = getClass( this );
- if ( className ) {
- // Store className if set
- dataPriv.set( this, "__className__", className );
- }
- // If the element has a class name or if we're passed `false`,
- // then remove the whole classname (if there was one, the above saved it).
- // Otherwise bring back whatever was previously saved (if anything),
- // falling back to the empty string if nothing was stored.
- if ( this.setAttribute ) {
- this.setAttribute( "class",
- className || value === false ?
- "" :
- dataPriv.get( this, "__className__" ) || ""
- );
- }
- }
- } );
- },
- hasClass: function( selector ) {
- var className, elem,
- i = 0;
- className = " " + selector + " ";
- while ( ( elem = this[ i++ ] ) ) {
- if ( elem.nodeType === 1 &&
- ( " " + getClass( elem ) + " " ).replace( rclass, " " )
- .indexOf( className ) > -1
- ) {
- return true;
- }
- }
- return false;
- }
- } );
- var rreturn = /\r/g,
- rspaces = /[\x20\t\r\n\f]+/g;
- jQuery.fn.extend( {
- val: function( value ) {
- var hooks, ret, isFunction,
- elem = this[ 0 ];
- if ( !arguments.length ) {
- if ( elem ) {
- hooks = jQuery.valHooks[ elem.type ] ||
- jQuery.valHooks[ elem.nodeName.toLowerCase() ];
- if ( hooks &&
- "get" in hooks &&
- ( ret = hooks.get( elem, "value" ) ) !== undefined
- ) {
- return ret;
- }
- ret = elem.value;
- return typeof ret === "string" ?
- // Handle most common string cases
- ret.replace( rreturn, "" ) :
- // Handle cases where value is null/undef or number
- ret == null ? "" : ret;
- }
- return;
- }
- isFunction = jQuery.isFunction( value );
- return this.each( function( i ) {
- var val;
- if ( this.nodeType !== 1 ) {
- return;
- }
- if ( isFunction ) {
- val = value.call( this, i, jQuery( this ).val() );
- } else {
- val = value;
- }
- // Treat null/undefined as ""; convert numbers to string
- if ( val == null ) {
- val = "";
- } else if ( typeof val === "number" ) {
- val += "";
- } else if ( jQuery.isArray( val ) ) {
- val = jQuery.map( val, function( value ) {
- return value == null ? "" : value + "";
- } );
- }
- hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
- // If set returns undefined, fall back to normal setting
- if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
- this.value = val;
- }
- } );
- }
- } );
- jQuery.extend( {
- valHooks: {
- option: {
- get: function( elem ) {
- var val = jQuery.find.attr( elem, "value" );
- return val != null ?
- val :
- // Support: IE10-11+
- // option.text throws exceptions (#14686, #14858)
- // Strip and collapse whitespace
- // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
- jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
- }
- },
- select: {
- get: function( elem ) {
- var value, option,
- options = elem.options,
- index = elem.selectedIndex,
- one = elem.type === "select-one" || index < 0,
- values = one ? null : [],
- max = one ? index + 1 : options.length,
- i = index < 0 ?
- max :
- one ? index : 0;
- // Loop through all the selected options
- for ( ; i < max; i++ ) {
- option = options[ i ];
- // IE8-9 doesn't update selected after form reset (#2551)
- if ( ( option.selected || i === index ) &&
- // Don't return options that are disabled or in a disabled optgroup
- ( support.optDisabled ?
- !option.disabled : option.getAttribute( "disabled" ) === null ) &&
- ( !option.parentNode.disabled ||
- !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
- // Get the specific value for the option
- value = jQuery( option ).val();
- // We don't need an array for one selects
- if ( one ) {
- return value;
- }
- // Multi-Selects return an array
- values.push( value );
- }
- }
- return values;
- },
- set: function( elem, value ) {
- var optionSet, option,
- options = elem.options,
- values = jQuery.makeArray( value ),
- i = options.length;
- while ( i-- ) {
- option = options[ i ];
- if ( option.selected =
- jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
- ) {
- optionSet = true;
- }
- }
- // Force browsers to behave consistently when non-matching value is set
- if ( !optionSet ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- }
- } );
- // Radios and checkboxes getter/setter
- jQuery.each( [ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
- return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
- }
- }
- };
- if ( !support.checkOn ) {
- jQuery.valHooks[ this ].get = function( elem ) {
- return elem.getAttribute( "value" ) === null ? "on" : elem.value;
- };
- }
- } );
- // Return jQuery for attributes-only inclusion
- var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
- jQuery.extend( jQuery.event, {
- trigger: function( event, data, elem, onlyHandlers ) {
- var i, cur, tmp, bubbleType, ontype, handle, special,
- eventPath = [ elem || document ],
- type = hasOwn.call( event, "type" ) ? event.type : event,
- namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
- cur = tmp = elem = elem || document;
- // Don't do events on text and comment nodes
- if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
- return;
- }
- // focus/blur morphs to focusin/out; ensure we're not firing them right now
- if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
- return;
- }
- if ( type.indexOf( "." ) > -1 ) {
- // Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split( "." );
- type = namespaces.shift();
- namespaces.sort();
- }
- ontype = type.indexOf( ":" ) < 0 && "on" + type;
- // Caller can pass in a jQuery.Event object, Object, or just an event type string
- event = event[ jQuery.expando ] ?
- event :
- new jQuery.Event( type, typeof event === "object" && event );
- // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
- event.isTrigger = onlyHandlers ? 2 : 3;
- event.namespace = namespaces.join( "." );
- event.rnamespace = event.namespace ?
- new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
- null;
- // Clean up the event in case it is being reused
- event.result = undefined;
- if ( !event.target ) {
- event.target = elem;
- }
- // Clone any incoming data and prepend the event, creating the handler arg list
- data = data == null ?
- [ event ] :
- jQuery.makeArray( data, [ event ] );
- // Allow special events to draw outside the lines
- special = jQuery.event.special[ type ] || {};
- if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
- return;
- }
- // Determine event propagation path in advance, per W3C events spec (#9951)
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
- bubbleType = special.delegateType || type;
- if ( !rfocusMorph.test( bubbleType + type ) ) {
- cur = cur.parentNode;
- }
- for ( ; cur; cur = cur.parentNode ) {
- eventPath.push( cur );
- tmp = cur;
- }
- // Only add window if we got to document (e.g., not plain obj or detached DOM)
- if ( tmp === ( elem.ownerDocument || document ) ) {
- eventPath.push( tmp.defaultView || tmp.parentWindow || window );
- }
- }
- // Fire handlers on the event path
- i = 0;
- while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
- event.type = i > 1 ?
- bubbleType :
- special.bindType || type;
- // jQuery handler
- handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
- dataPriv.get( cur, "handle" );
- if ( handle ) {
- handle.apply( cur, data );
- }
- // Native handler
- handle = ontype && cur[ ontype ];
- if ( handle && handle.apply && acceptData( cur ) ) {
- event.result = handle.apply( cur, data );
- if ( event.result === false ) {
- event.preventDefault();
- }
- }
- }
- event.type = type;
- // If nobody prevented the default action, do it now
- if ( !onlyHandlers && !event.isDefaultPrevented() ) {
- if ( ( !special._default ||
- special._default.apply( eventPath.pop(), data ) === false ) &&
- acceptData( elem ) ) {
- // Call a native DOM method on the target with the same name name as the event.
- // Don't do default actions on window, that's where global variables be (#6170)
- if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
- // Don't re-trigger an onFOO event when we call its FOO() method
- tmp = elem[ ontype ];
- if ( tmp ) {
- elem[ ontype ] = null;
- }
- // Prevent re-triggering of the same event, since we already bubbled it above
- jQuery.event.triggered = type;
- elem[ type ]();
- jQuery.event.triggered = undefined;
- if ( tmp ) {
- elem[ ontype ] = tmp;
- }
- }
- }
- }
- return event.result;
- },
- // Piggyback on a donor event to simulate a different one
- // Used only for `focus(in | out)` events
- simulate: function( type, elem, event ) {
- var e = jQuery.extend(
- new jQuery.Event(),
- event,
- {
- type: type,
- isSimulated: true
- }
- );
- jQuery.event.trigger( e, null, elem );
- }
- } );
- jQuery.fn.extend( {
- trigger: function( type, data ) {
- return this.each( function() {
- jQuery.event.trigger( type, data, this );
- } );
- },
- triggerHandler: function( type, data ) {
- var elem = this[ 0 ];
- if ( elem ) {
- return jQuery.event.trigger( type, data, elem, true );
- }
- }
- } );
- jQuery.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( i, name ) {
- // Handle event binding
- jQuery.fn[ name ] = function( data, fn ) {
- return arguments.length > 0 ?
- this.on( name, null, data, fn ) :
- this.trigger( name );
- };
- } );
- jQuery.fn.extend( {
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
- } );
- support.focusin = "onfocusin" in window;
- // Support: Firefox
- // Firefox doesn't have focus(in | out) events
- // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
- //
- // Support: Chrome, Safari
- // focus(in | out) events fire after focus & blur events,
- // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
- // Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
- if ( !support.focusin ) {
- jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
- // Attach a single capturing handler on the document while someone wants focusin/focusout
- var handler = function( event ) {
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
- };
- jQuery.event.special[ fix ] = {
- setup: function() {
- var doc = this.ownerDocument || this,
- attaches = dataPriv.access( doc, fix );
- if ( !attaches ) {
- doc.addEventListener( orig, handler, true );
- }
- dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
- },
- teardown: function() {
- var doc = this.ownerDocument || this,
- attaches = dataPriv.access( doc, fix ) - 1;
- if ( !attaches ) {
- doc.removeEventListener( orig, handler, true );
- dataPriv.remove( doc, fix );
- } else {
- dataPriv.access( doc, fix, attaches );
- }
- }
- };
- } );
- }
- var location = window.location;
- var nonce = jQuery.now();
- var rquery = ( /\?/ );
- // Support: Android 2.3
- // Workaround failure to string-cast null input
- jQuery.parseJSON = function( data ) {
- return JSON.parse( data + "" );
- };
- // Cross-browser xml parsing
- jQuery.parseXML = function( data ) {
- var xml;
- if ( !data || typeof data !== "string" ) {
- return null;
- }
- // Support: IE9
- try {
- xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
- } catch ( e ) {
- xml = undefined;
- }
- if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
- jQuery.error( "Invalid XML: " + data );
- }
- return xml;
- };
- var
- rhash = /#.*$/,
- rts = /([?&])_=[^&]*/,
- rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
- // #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
- rnoContent = /^(?:GET|HEAD)$/,
- rprotocol = /^\/\//,
- /* Prefilters
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
- * 2) These are called:
- * - BEFORE asking for a transport
- * - AFTER param serialization (s.data is a string if s.processData is true)
- * 3) key is the dataType
- * 4) the catchall symbol "*" can be used
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
- */
- prefilters = {},
- /* Transports bindings
- * 1) key is the dataType
- * 2) the catchall symbol "*" can be used
- * 3) selection will start with transport dataType and THEN go to "*" if needed
- */
- transports = {},
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
- allTypes = "*/".concat( "*" ),
- // Anchor tag for parsing the document origin
- originAnchor = document.createElement( "a" );
- originAnchor.href = location.href;
- // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
- function addToPrefiltersOrTransports( structure ) {
- // dataTypeExpression is optional and defaults to "*"
- return function( dataTypeExpression, func ) {
- if ( typeof dataTypeExpression !== "string" ) {
- func = dataTypeExpression;
- dataTypeExpression = "*";
- }
- var dataType,
- i = 0,
- dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
- if ( jQuery.isFunction( func ) ) {
- // For each dataType in the dataTypeExpression
- while ( ( dataType = dataTypes[ i++ ] ) ) {
- // Prepend if requested
- if ( dataType[ 0 ] === "+" ) {
- dataType = dataType.slice( 1 ) || "*";
- ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
- // Otherwise append
- } else {
- ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
- }
- }
- }
- };
- }
- // Base inspection function for prefilters and transports
- function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
- var inspected = {},
- seekingTransport = ( structure === transports );
- function inspect( dataType ) {
- var selected;
- inspected[ dataType ] = true;
- jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
- var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
- if ( typeof dataTypeOrTransport === "string" &&
- !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
- options.dataTypes.unshift( dataTypeOrTransport );
- inspect( dataTypeOrTransport );
- return false;
- } else if ( seekingTransport ) {
- return !( selected = dataTypeOrTransport );
- }
- } );
- return selected;
- }
- return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
- }
- // A special extend for ajax options
- // that takes "flat" options (not to be deep extended)
- // Fixes #9887
- function ajaxExtend( target, src ) {
- var key, deep,
- flatOptions = jQuery.ajaxSettings.flatOptions || {};
- for ( key in src ) {
- if ( src[ key ] !== undefined ) {
- ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
- }
- }
- if ( deep ) {
- jQuery.extend( true, target, deep );
- }
- return target;
- }
- /* Handles responses to an ajax request:
- * - finds the right dataType (mediates between content-type and expected dataType)
- * - returns the corresponding response
- */
- function ajaxHandleResponses( s, jqXHR, responses ) {
- var ct, type, finalDataType, firstDataType,
- contents = s.contents,
- dataTypes = s.dataTypes;
- // Remove auto dataType and get content-type in the process
- while ( dataTypes[ 0 ] === "*" ) {
- dataTypes.shift();
- if ( ct === undefined ) {
- ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
- }
- }
- // Check if we're dealing with a known content-type
- if ( ct ) {
- for ( type in contents ) {
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
- dataTypes.unshift( type );
- break;
- }
- }
- }
- // Check to see if we have a response for the expected dataType
- if ( dataTypes[ 0 ] in responses ) {
- finalDataType = dataTypes[ 0 ];
- } else {
- // Try convertible dataTypes
- for ( type in responses ) {
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
- finalDataType = type;
- break;
- }
- if ( !firstDataType ) {
- firstDataType = type;
- }
- }
- // Or just use first one
- finalDataType = finalDataType || firstDataType;
- }
- // If we found a dataType
- // We add the dataType to the list if needed
- // and return the corresponding response
- if ( finalDataType ) {
- if ( finalDataType !== dataTypes[ 0 ] ) {
- dataTypes.unshift( finalDataType );
- }
- return responses[ finalDataType ];
- }
- }
- /* Chain conversions given the request and the original response
- * Also sets the responseXXX fields on the jqXHR instance
- */
- function ajaxConvert( s, response, jqXHR, isSuccess ) {
- var conv2, current, conv, tmp, prev,
- converters = {},
- // Work with a copy of dataTypes in case we need to modify it for conversion
- dataTypes = s.dataTypes.slice();
- // Create converters map with lowercased keys
- if ( dataTypes[ 1 ] ) {
- for ( conv in s.converters ) {
- converters[ conv.toLowerCase() ] = s.converters[ conv ];
- }
- }
- current = dataTypes.shift();
- // Convert to each sequential dataType
- while ( current ) {
- if ( s.responseFields[ current ] ) {
- jqXHR[ s.responseFields[ current ] ] = response;
- }
- // Apply the dataFilter if provided
- if ( !prev && isSuccess && s.dataFilter ) {
- response = s.dataFilter( response, s.dataType );
- }
- prev = current;
- current = dataTypes.shift();
- if ( current ) {
- // There's only work to do if current dataType is non-auto
- if ( current === "*" ) {
- current = prev;
- // Convert response if prev dataType is non-auto and differs from current
- } else if ( prev !== "*" && prev !== current ) {
- // Seek a direct converter
- conv = converters[ prev + " " + current ] || converters[ "* " + current ];
- // If none found, seek a pair
- if ( !conv ) {
- for ( conv2 in converters ) {
- // If conv2 outputs current
- tmp = conv2.split( " " );
- if ( tmp[ 1 ] === current ) {
- // If prev can be converted to accepted input
- conv = converters[ prev + " " + tmp[ 0 ] ] ||
- converters[ "* " + tmp[ 0 ] ];
- if ( conv ) {
- // Condense equivalence converters
- if ( conv === true ) {
- conv = converters[ conv2 ];
- // Otherwise, insert the intermediate dataType
- } else if ( converters[ conv2 ] !== true ) {
- current = tmp[ 0 ];
- dataTypes.unshift( tmp[ 1 ] );
- }
- break;
- }
- }
- }
- }
- // Apply converter (if not an equivalence)
- if ( conv !== true ) {
- // Unless errors are allowed to bubble, catch and return them
- if ( conv && s.throws ) {
- response = conv( response );
- } else {
- try {
- response = conv( response );
- } catch ( e ) {
- return {
- state: "parsererror",
- error: conv ? e : "No conversion from " + prev + " to " + current
- };
- }
- }
- }
- }
- }
- }
- return { state: "success", data: response };
- }
- jQuery.extend( {
- // Counter for holding the number of active queries
- active: 0,
- // Last-Modified header cache for next request
- lastModified: {},
- etag: {},
- ajaxSettings: {
- url: location.href,
- type: "GET",
- isLocal: rlocalProtocol.test( location.protocol ),
- global: true,
- processData: true,
- async: true,
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
- /*
- timeout: 0,
- data: null,
- dataType: null,
- username: null,
- password: null,
- cache: null,
- throws: false,
- traditional: false,
- headers: {},
- */
- accepts: {
- "*": allTypes,
- 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"
- },
- // Data converters
- // Keys separate source (or catchall "*") and destination types with a single space
- converters: {
- // Convert anything to text
- "* text": String,
- // Text to html (true = no transformation)
- "text html": true,
- // Evaluate text as a json expression
- "text json": jQuery.parseJSON,
- // Parse text as xml
- "text xml": jQuery.parseXML
- },
- // For options that shouldn't be deep extended:
- // you can add your own custom options here if
- // and when you create one that shouldn't be
- // deep extended (see ajaxExtend)
- flatOptions: {
- url: true,
- context: true
- }
- },
- // Creates a full fledged settings object into target
- // with both ajaxSettings and settings fields.
- // If target is omitted, writes into ajaxSettings.
- ajaxSetup: function( target, settings ) {
- return settings ?
- // Building a settings object
- ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
- // Extending ajaxSettings
- ajaxExtend( jQuery.ajaxSettings, target );
- },
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
- ajaxTransport: addToPrefiltersOrTransports( transports ),
- // Main method
- ajax: function( url, options ) {
- // If url is an object, simulate pre-1.5 signature
- if ( typeof url === "object" ) {
- options = url;
- url = undefined;
- }
- // Force options to be an object
- options = options || {};
- var transport,
- // URL without anti-cache param
- cacheURL,
- // Response headers
- responseHeadersString,
- responseHeaders,
- // timeout handle
- timeoutTimer,
- // Url cleanup var
- urlAnchor,
- // To know if global events are to be dispatched
- fireGlobals,
- // Loop variable
- i,
- // Create the final options object
- s = jQuery.ajaxSetup( {}, options ),
- // Callbacks context
- callbackContext = s.context || s,
- // Context for global events is callbackContext if it is a DOM node or jQuery collection
- globalEventContext = s.context &&
- ( callbackContext.nodeType || callbackContext.jquery ) ?
- jQuery( callbackContext ) :
- jQuery.event,
- // Deferreds
- deferred = jQuery.Deferred(),
- completeDeferred = jQuery.Callbacks( "once memory" ),
- // Status-dependent callbacks
- statusCode = s.statusCode || {},
- // Headers (they are sent all at once)
- requestHeaders = {},
- requestHeadersNames = {},
- // The jqXHR state
- state = 0,
- // Default abort message
- strAbort = "canceled",
- // Fake xhr
- jqXHR = {
- readyState: 0,
- // Builds headers hashtable if needed
- getResponseHeader: function( key ) {
- var match;
- if ( state === 2 ) {
- if ( !responseHeaders ) {
- responseHeaders = {};
- while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
- responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
- }
- }
- match = responseHeaders[ key.toLowerCase() ];
- }
- return match == null ? null : match;
- },
- // Raw string
- getAllResponseHeaders: function() {
- return state === 2 ? responseHeadersString : null;
- },
- // Caches the header
- setRequestHeader: function( name, value ) {
- var lname = name.toLowerCase();
- if ( !state ) {
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
- requestHeaders[ name ] = value;
- }
- return this;
- },
- // Overrides response content-type header
- overrideMimeType: function( type ) {
- if ( !state ) {
- s.mimeType = type;
- }
- return this;
- },
- // Status-dependent callbacks
- statusCode: function( map ) {
- var code;
- if ( map ) {
- if ( state < 2 ) {
- for ( code in map ) {
- // Lazy-add the new callback in a way that preserves old ones
- statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
- }
- } else {
- // Execute the appropriate callbacks
- jqXHR.always( map[ jqXHR.status ] );
- }
- }
- return this;
- },
- // Cancel the request
- abort: function( statusText ) {
- var finalText = statusText || strAbort;
- if ( transport ) {
- transport.abort( finalText );
- }
- done( 0, finalText );
- return this;
- }
- };
- // Attach deferreds
- deferred.promise( jqXHR ).complete = completeDeferred.add;
- jqXHR.success = jqXHR.done;
- jqXHR.error = jqXHR.fail;
- // Remove hash character (#7531: and string promotion)
- // Add protocol if not provided (prefilters might expect it)
- // Handle falsy url in the settings object (#10093: consistency with old signature)
- // We also use the url parameter if available
- s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" )
- .replace( rprotocol, location.protocol + "//" );
- // Alias method option to type as per ticket #12004
- s.type = options.method || options.type || s.method || s.type;
- // Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
- // A cross-domain request is in order when the origin doesn't match the current origin.
- if ( s.crossDomain == null ) {
- urlAnchor = document.createElement( "a" );
- // Support: IE8-11+
- // IE throws exception if url is malformed, e.g. http://example.com:80x/
- try {
- urlAnchor.href = s.url;
- // Support: IE8-11+
- // Anchor's host property isn't correctly set when s.url is relative
- urlAnchor.href = urlAnchor.href;
- s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
- urlAnchor.protocol + "//" + urlAnchor.host;
- } catch ( e ) {
- // If there is an error parsing the URL, assume it is crossDomain,
- // it can be rejected by the transport if it is invalid
- s.crossDomain = true;
- }
- }
- // Convert data if not already a string
- if ( s.data && s.processData && typeof s.data !== "string" ) {
- s.data = jQuery.param( s.data, s.traditional );
- }
- // Apply prefilters
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
- // If request was aborted inside a prefilter, stop there
- if ( state === 2 ) {
- return jqXHR;
- }
- // We can fire global events as of now if asked to
- // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
- fireGlobals = jQuery.event && s.global;
- // Watch for a new set of requests
- if ( fireGlobals && jQuery.active++ === 0 ) {
- jQuery.event.trigger( "ajaxStart" );
- }
- // Uppercase the type
- s.type = s.type.toUpperCase();
- // Determine if request has content
- s.hasContent = !rnoContent.test( s.type );
- // Save the URL in case we're toying with the If-Modified-Since
- // and/or If-None-Match header later on
- cacheURL = s.url;
- // More options handling for requests with no content
- if ( !s.hasContent ) {
- // If data is available, append data to url
- if ( s.data ) {
- cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
- // #9682: remove data so that it's not used in an eventual retry
- delete s.data;
- }
- // Add anti-cache in url if needed
- if ( s.cache === false ) {
- s.url = rts.test( cacheURL ) ?
- // If there is already a '_' parameter, set its value
- cacheURL.replace( rts, "$1_=" + nonce++ ) :
- // Otherwise add one to the end
- cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
- }
- }
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- if ( jQuery.lastModified[ cacheURL ] ) {
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
- }
- if ( jQuery.etag[ cacheURL ] ) {
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
- }
- }
- // Set the correct header, if data is being sent
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
- }
- // Set the Accepts header for the server, depending on the dataType
- jqXHR.setRequestHeader(
- "Accept",
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
- s.accepts[ s.dataTypes[ 0 ] ] +
- ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
- s.accepts[ "*" ]
- );
- // Check for headers option
- for ( i in s.headers ) {
- jqXHR.setRequestHeader( i, s.headers[ i ] );
- }
- // Allow custom headers/mimetypes and early abort
- if ( s.beforeSend &&
- ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
- // Abort if not done already and return
- return jqXHR.abort();
- }
- // Aborting is no longer a cancellation
- strAbort = "abort";
- // Install callbacks on deferreds
- for ( i in { success: 1, error: 1, complete: 1 } ) {
- jqXHR[ i ]( s[ i ] );
- }
- // Get transport
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
- // If no transport, we auto-abort
- if ( !transport ) {
- done( -1, "No Transport" );
- } else {
- jqXHR.readyState = 1;
- // Send global event
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
- }
- // If request was aborted inside ajaxSend, stop there
- if ( state === 2 ) {
- return jqXHR;
- }
- // Timeout
- if ( s.async && s.timeout > 0 ) {
- timeoutTimer = window.setTimeout( function() {
- jqXHR.abort( "timeout" );
- }, s.timeout );
- }
- try {
- state = 1;
- transport.send( requestHeaders, done );
- } catch ( e ) {
- // Propagate exception as error if not done
- if ( state < 2 ) {
- done( -1, e );
- // Simply rethrow otherwise
- } else {
- throw e;
- }
- }
- }
- // Callback for when everything is done
- function done( status, nativeStatusText, responses, headers ) {
- var isSuccess, success, error, response, modified,
- statusText = nativeStatusText;
- // Called once
- if ( state === 2 ) {
- return;
- }
- // State is "done" now
- state = 2;
- // Clear timeout if it exists
- if ( timeoutTimer ) {
- window.clearTimeout( timeoutTimer );
- }
- // Dereference transport for early garbage collection
- // (no matter how long the jqXHR object will be used)
- transport = undefined;
- // Cache response headers
- responseHeadersString = headers || "";
- // Set readyState
- jqXHR.readyState = status > 0 ? 4 : 0;
- // Determine if successful
- isSuccess = status >= 200 && status < 300 || status === 304;
- // Get response data
- if ( responses ) {
- response = ajaxHandleResponses( s, jqXHR, responses );
- }
- // Convert no matter what (that way responseXXX fields are always set)
- response = ajaxConvert( s, response, jqXHR, isSuccess );
- // If successful, handle type chaining
- if ( isSuccess ) {
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- modified = jqXHR.getResponseHeader( "Last-Modified" );
- if ( modified ) {
- jQuery.lastModified[ cacheURL ] = modified;
- }
- modified = jqXHR.getResponseHeader( "etag" );
- if ( modified ) {
- jQuery.etag[ cacheURL ] = modified;
- }
- }
- // if no content
- if ( status === 204 || s.type === "HEAD" ) {
- statusText = "nocontent";
- // if not modified
- } else if ( status === 304 ) {
- statusText = "notmodified";
- // If we have data, let's convert it
- } else {
- statusText = response.state;
- success = response.data;
- error = response.error;
- isSuccess = !error;
- }
- } else {
- // Extract error from statusText and normalize for non-aborts
- error = statusText;
- if ( status || !statusText ) {
- statusText = "error";
- if ( status < 0 ) {
- status = 0;
- }
- }
- }
- // Set data for the fake xhr object
- jqXHR.status = status;
- jqXHR.statusText = ( nativeStatusText || statusText ) + "";
- // Success/Error
- if ( isSuccess ) {
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
- } else {
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
- }
- // Status-dependent callbacks
- jqXHR.statusCode( statusCode );
- statusCode = undefined;
- if ( fireGlobals ) {
- globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
- [ jqXHR, s, isSuccess ? success : error ] );
- }
- // Complete
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
- // Handle the global AJAX counter
- if ( !( --jQuery.active ) ) {
- jQuery.event.trigger( "ajaxStop" );
- }
- }
- }
- return jqXHR;
- },
- getJSON: function( url, data, callback ) {
- return jQuery.get( url, data, callback, "json" );
- },
- getScript: function( url, callback ) {
- return jQuery.get( url, undefined, callback, "script" );
- }
- } );
- jQuery.each( [ "get", "post" ], function( i, method ) {
- jQuery[ method ] = function( url, data, callback, type ) {
- // Shift arguments if data argument was omitted
- if ( jQuery.isFunction( data ) ) {
- type = type || callback;
- callback = data;
- data = undefined;
- }
- // The url can be an options object (which then must have .url)
- return jQuery.ajax( jQuery.extend( {
- url: url,
- type: method,
- dataType: type,
- data: data,
- success: callback
- }, jQuery.isPlainObject( url ) && url ) );
- };
- } );
- jQuery._evalUrl = function( url ) {
- return jQuery.ajax( {
- url: url,
- // Make this explicit, since user can override this through ajaxSetup (#11264)
- type: "GET",
- dataType: "script",
- async: false,
- global: false,
- "throws": true
- } );
- };
- jQuery.fn.extend( {
- wrapAll: function( html ) {
- var wrap;
- if ( jQuery.isFunction( html ) ) {
- return this.each( function( i ) {
- jQuery( this ).wrapAll( html.call( this, i ) );
- } );
- }
- if ( this[ 0 ] ) {
- // The elements to wrap the target around
- wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
- if ( this[ 0 ].parentNode ) {
- wrap.insertBefore( this[ 0 ] );
- }
- wrap.map( function() {
- var elem = this;
- while ( elem.firstElementChild ) {
- elem = elem.firstElementChild;
- }
- return elem;
- } ).append( this );
- }
- return this;
- },
- wrapInner: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each( function( i ) {
- jQuery( this ).wrapInner( html.call( this, i ) );
- } );
- }
- return this.each( function() {
- var self = jQuery( this ),
- contents = self.contents();
- if ( contents.length ) {
- contents.wrapAll( html );
- } else {
- self.append( html );
- }
- } );
- },
- wrap: function( html ) {
- var isFunction = jQuery.isFunction( html );
- return this.each( function( i ) {
- jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
- } );
- },
- unwrap: function() {
- return this.parent().each( function() {
- if ( !jQuery.nodeName( this, "body" ) ) {
- jQuery( this ).replaceWith( this.childNodes );
- }
- } ).end();
- }
- } );
- jQuery.expr.filters.hidden = function( elem ) {
- return !jQuery.expr.filters.visible( elem );
- };
- jQuery.expr.filters.visible = function( elem ) {
- // Support: Opera <= 12.12
- // Opera reports offsetWidths and offsetHeights less than zero on some elements
- // Use OR instead of AND as the element is not visible if either is true
- // See tickets #10406 and #13132
- return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0;
- };
- var r20 = /%20/g,
- rbracket = /\[\]$/,
- rCRLF = /\r?\n/g,
- rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
- rsubmittable = /^(?:input|select|textarea|keygen)/i;
- function buildParams( prefix, obj, traditional, add ) {
- var name;
- if ( jQuery.isArray( obj ) ) {
- // Serialize array item.
- jQuery.each( obj, function( i, v ) {
- if ( traditional || rbracket.test( prefix ) ) {
- // Treat each array item as a scalar.
- add( prefix, v );
- } else {
- // Item is non-scalar (array or object), encode its numeric index.
- buildParams(
- prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
- v,
- traditional,
- add
- );
- }
- } );
- } else if ( !traditional && jQuery.type( obj ) === "object" ) {
- // Serialize object item.
- for ( name in obj ) {
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
- }
- } else {
- // Serialize scalar item.
- add( prefix, obj );
- }
- }
- // Serialize an array of form elements or a set of
- // key/values into a query string
- jQuery.param = function( a, traditional ) {
- var prefix,
- s = [],
- add = function( key, value ) {
- // If value is a function, invoke it and return its value
- value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
- s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
- };
- // Set traditional to true for jQuery <= 1.3.2 behavior.
- if ( traditional === undefined ) {
- traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
- }
- // If an array was passed in, assume that it is an array of form elements.
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
- // Serialize the form elements
- jQuery.each( a, function() {
- add( this.name, this.value );
- } );
- } else {
- // If traditional, encode the "old" way (the way 1.3.2 or older
- // did it), otherwise encode params recursively.
- for ( prefix in a ) {
- buildParams( prefix, a[ prefix ], traditional, add );
- }
- }
- // Return the resulting serialization
- return s.join( "&" ).replace( r20, "+" );
- };
- jQuery.fn.extend( {
- serialize: function() {
- return jQuery.param( this.serializeArray() );
- },
- serializeArray: function() {
- return this.map( function() {
- // Can add propHook for "elements" to filter or add form elements
- var elements = jQuery.prop( this, "elements" );
- return elements ? jQuery.makeArray( elements ) : this;
- } )
- .filter( function() {
- var type = this.type;
- // Use .is( ":disabled" ) so that fieldset[disabled] works
- return this.name && !jQuery( this ).is( ":disabled" ) &&
- rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
- ( this.checked || !rcheckableType.test( type ) );
- } )
- .map( function( i, elem ) {
- var val = jQuery( this ).val();
- return val == null ?
- null :
- jQuery.isArray( val ) ?
- jQuery.map( val, function( val ) {
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- } ) :
- { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- } ).get();
- }
- } );
- jQuery.ajaxSettings.xhr = function() {
- try {
- return new window.XMLHttpRequest();
- } catch ( e ) {}
- };
- var xhrSuccessStatus = {
- // File protocol always yields status code 0, assume 200
- 0: 200,
- // Support: IE9
- // #1450: sometimes IE returns 1223 when it should be 204
- 1223: 204
- },
- xhrSupported = jQuery.ajaxSettings.xhr();
- support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
- support.ajax = xhrSupported = !!xhrSupported;
- jQuery.ajaxTransport( function( options ) {
- var callback, errorCallback;
- // Cross domain only allowed if supported through XMLHttpRequest
- if ( support.cors || xhrSupported && !options.crossDomain ) {
- return {
- send: function( headers, complete ) {
- var i,
- xhr = options.xhr();
- xhr.open(
- options.type,
- options.url,
- options.async,
- options.username,
- options.password
- );
- // Apply custom fields if provided
- if ( options.xhrFields ) {
- for ( i in options.xhrFields ) {
- xhr[ i ] = options.xhrFields[ i ];
- }
- }
- // Override mime type if needed
- if ( options.mimeType && xhr.overrideMimeType ) {
- xhr.overrideMimeType( options.mimeType );
- }
- // X-Requested-With header
- // For cross-domain requests, seeing as conditions for a preflight are
- // akin to a jigsaw puzzle, we simply never set it to be sure.
- // (it can always be set on a per-request basis or even using ajaxSetup)
- // For same-domain requests, won't change header if already provided.
- if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
- headers[ "X-Requested-With" ] = "XMLHttpRequest";
- }
- // Set headers
- for ( i in headers ) {
- xhr.setRequestHeader( i, headers[ i ] );
- }
- // Callback
- callback = function( type ) {
- return function() {
- if ( callback ) {
- callback = errorCallback = xhr.onload =
- xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
- if ( type === "abort" ) {
- xhr.abort();
- } else if ( type === "error" ) {
- // Support: IE9
- // On a manual native abort, IE9 throws
- // errors on any property access that is not readyState
- if ( typeof xhr.status !== "number" ) {
- complete( 0, "error" );
- } else {
- complete(
- // File: protocol always yields status 0; see #8605, #14207
- xhr.status,
- xhr.statusText
- );
- }
- } else {
- complete(
- xhrSuccessStatus[ xhr.status ] || xhr.status,
- xhr.statusText,
- // Support: IE9 only
- // IE9 has no XHR2 but throws on binary (trac-11426)
- // For XHR2 non-text, let the caller handle it (gh-2498)
- ( xhr.responseType || "text" ) !== "text" ||
- typeof xhr.responseText !== "string" ?
- { binary: xhr.response } :
- { text: xhr.responseText },
- xhr.getAllResponseHeaders()
- );
- }
- }
- };
- };
- // Listen to events
- xhr.onload = callback();
- errorCallback = xhr.onerror = callback( "error" );
- // Support: IE9
- // Use onreadystatechange to replace onabort
- // to handle uncaught aborts
- if ( xhr.onabort !== undefined ) {
- xhr.onabort = errorCallback;
- } else {
- xhr.onreadystatechange = function() {
- // Check readyState before timeout as it changes
- if ( xhr.readyState === 4 ) {
- // Allow onerror to be called first,
- // but that will not handle a native abort
- // Also, save errorCallback to a variable
- // as xhr.onerror cannot be accessed
- window.setTimeout( function() {
- if ( callback ) {
- errorCallback();
- }
- } );
- }
- };
- }
- // Create the abort callback
- callback = callback( "abort" );
- try {
- // Do send the request (this may raise an exception)
- xhr.send( options.hasContent && options.data || null );
- } catch ( e ) {
- // #14683: Only rethrow if this hasn't been notified as an error yet
- if ( callback ) {
- throw e;
- }
- }
- },
- abort: function() {
- if ( callback ) {
- callback();
- }
- }
- };
- }
- } );
- // Install script dataType
- jQuery.ajaxSetup( {
- accepts: {
- script: "text/javascript, application/javascript, " +
- "application/ecmascript, application/x-ecmascript"
- },
- contents: {
- script: /\b(?:java|ecma)script\b/
- },
- converters: {
- "text script": function( text ) {
- jQuery.globalEval( text );
- return text;
- }
- }
- } );
- // Handle cache's special case and crossDomain
- jQuery.ajaxPrefilter( "script", function( s ) {
- if ( s.cache === undefined ) {
- s.cache = false;
- }
- if ( s.crossDomain ) {
- s.type = "GET";
- }
- } );
- // Bind script tag hack transport
- jQuery.ajaxTransport( "script", function( s ) {
- // This transport only deals with cross domain requests
- if ( s.crossDomain ) {
- var script, callback;
- return {
- send: function( _, complete ) {
- script = jQuery( "<script>" ).prop( {
- charset: s.scriptCharset,
- src: s.url
- } ).on(
- "load error",
- callback = function( evt ) {
- script.remove();
- callback = null;
- if ( evt ) {
- complete( evt.type === "error" ? 404 : 200, evt.type );
- }
- }
- );
- // Use native DOM manipulation to avoid our domManip AJAX trickery
- document.head.appendChild( script[ 0 ] );
- },
- abort: function() {
- if ( callback ) {
- callback();
- }
- }
- };
- }
- } );
- var oldCallbacks = [],
- rjsonp = /(=)\?(?=&|$)|\?\?/;
- // Default jsonp settings
- jQuery.ajaxSetup( {
- jsonp: "callback",
- jsonpCallback: function() {
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
- this[ callback ] = true;
- return callback;
- }
- } );
- // Detect, normalize options and install callbacks for jsonp requests
- jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
- var callbackName, overwritten, responseContainer,
- jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
- "url" :
- typeof s.data === "string" &&
- ( s.contentType || "" )
- .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
- rjsonp.test( s.data ) && "data"
- );
- // Handle iff the expected data type is "jsonp" or we have a parameter to set
- if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
- // Get callback name, remembering preexisting value associated with it
- callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
- s.jsonpCallback() :
- s.jsonpCallback;
- // Insert callback into url or form data
- if ( jsonProp ) {
- s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
- } else if ( s.jsonp !== false ) {
- s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
- }
- // Use data converter to retrieve json after script execution
- s.converters[ "script json" ] = function() {
- if ( !responseContainer ) {
- jQuery.error( callbackName + " was not called" );
- }
- return responseContainer[ 0 ];
- };
- // Force json dataType
- s.dataTypes[ 0 ] = "json";
- // Install callback
- overwritten = window[ callbackName ];
- window[ callbackName ] = function() {
- responseContainer = arguments;
- };
- // Clean-up function (fires after converters)
- jqXHR.always( function() {
- // If previous value didn't exist - remove it
- if ( overwritten === undefined ) {
- jQuery( window ).removeProp( callbackName );
- // Otherwise restore preexisting value
- } else {
- window[ callbackName ] = overwritten;
- }
- // Save back as free
- if ( s[ callbackName ] ) {
- // Make sure that re-using the options doesn't screw things around
- s.jsonpCallback = originalSettings.jsonpCallback;
- // Save the callback name for future use
- oldCallbacks.push( callbackName );
- }
- // Call if it was a function and we have a response
- if ( responseContainer && jQuery.isFunction( overwritten ) ) {
- overwritten( responseContainer[ 0 ] );
- }
- responseContainer = overwritten = undefined;
- } );
- // Delegate to script
- return "script";
- }
- } );
- // Argument "data" should be string of html
- // context (optional): If specified, the fragment will be created in this context,
- // defaults to document
- // keepScripts (optional): If true, will include scripts passed in the html string
- jQuery.parseHTML = function( data, context, keepScripts ) {
- if ( !data || typeof data !== "string" ) {
- return null;
- }
- if ( typeof context === "boolean" ) {
- keepScripts = context;
- context = false;
- }
- context = context || document;
- var parsed = rsingleTag.exec( data ),
- scripts = !keepScripts && [];
- // Single tag
- if ( parsed ) {
- return [ context.createElement( parsed[ 1 ] ) ];
- }
- parsed = buildFragment( [ data ], context, scripts );
- if ( scripts && scripts.length ) {
- jQuery( scripts ).remove();
- }
- return jQuery.merge( [], parsed.childNodes );
- };
- // Keep a copy of the old load method
- var _load = jQuery.fn.load;
- /**
- * Load a url into a page
- */
- jQuery.fn.load = function( url, params, callback ) {
- if ( typeof url !== "string" && _load ) {
- return _load.apply( this, arguments );
- }
- var selector, type, response,
- self = this,
- off = url.indexOf( " " );
- if ( off > -1 ) {
- selector = jQuery.trim( url.slice( off ) );
- url = url.slice( 0, off );
- }
- // If it's a function
- if ( jQuery.isFunction( params ) ) {
- // We assume that it's the callback
- callback = params;
- params = undefined;
- // Otherwise, build a param string
- } else if ( params && typeof params === "object" ) {
- type = "POST";
- }
- // If we have elements to modify, make the request
- if ( self.length > 0 ) {
- jQuery.ajax( {
- url: url,
- // If "type" variable is undefined, then "GET" method will be used.
- // Make value of this field explicit since
- // user can override it through ajaxSetup method
- type: type || "GET",
- dataType: "html",
- data: params
- } ).done( function( responseText ) {
- // Save response for use in complete callback
- response = arguments;
- self.html( selector ?
- // If a selector was specified, locate the right elements in a dummy div
- // Exclude scripts to avoid IE 'Permission Denied' errors
- jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
- // Otherwise use the full result
- responseText );
- // If the request succeeds, this function gets "data", "status", "jqXHR"
- // but they are ignored because response was set above.
- // If it fails, this function gets "jqXHR", "status", "error"
- } ).always( callback && function( jqXHR, status ) {
- self.each( function() {
- callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
- } );
- } );
- }
- return this;
- };
- // Attach a bunch of functions for handling common AJAX events
- jQuery.each( [
- "ajaxStart",
- "ajaxStop",
- "ajaxComplete",
- "ajaxError",
- "ajaxSuccess",
- "ajaxSend"
- ], function( i, type ) {
- jQuery.fn[ type ] = function( fn ) {
- return this.on( type, fn );
- };
- } );
- jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep( jQuery.timers, function( fn ) {
- return elem === fn.elem;
- } ).length;
- };
- /**
- * Gets a window from an element
- */
- function getWindow( elem ) {
- return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
- }
- jQuery.offset = {
- setOffset: function( elem, options, i ) {
- var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
- position = jQuery.css( elem, "position" ),
- curElem = jQuery( elem ),
- props = {};
- // Set position first, in-case top/left are set even on static elem
- if ( position === "static" ) {
- elem.style.position = "relative";
- }
- curOffset = curElem.offset();
- curCSSTop = jQuery.css( elem, "top" );
- curCSSLeft = jQuery.css( elem, "left" );
- calculatePosition = ( position === "absolute" || position === "fixed" ) &&
- ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
- // Need to be able to calculate position if either
- // top or left is auto and position is either absolute or fixed
- if ( calculatePosition ) {
- curPosition = curElem.position();
- curTop = curPosition.top;
- curLeft = curPosition.left;
- } else {
- curTop = parseFloat( curCSSTop ) || 0;
- curLeft = parseFloat( curCSSLeft ) || 0;
- }
- if ( jQuery.isFunction( options ) ) {
- // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
- options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
- }
- if ( options.top != null ) {
- props.top = ( options.top - curOffset.top ) + curTop;
- }
- if ( options.left != null ) {
- props.left = ( options.left - curOffset.left ) + curLeft;
- }
- if ( "using" in options ) {
- options.using.call( elem, props );
- } else {
- curElem.css( props );
- }
- }
- };
- jQuery.fn.extend( {
- offset: function( options ) {
- if ( arguments.length ) {
- return options === undefined ?
- this :
- this.each( function( i ) {
- jQuery.offset.setOffset( this, options, i );
- } );
- }
- var docElem, win,
- elem = this[ 0 ],
- box = { top: 0, left: 0 },
- doc = elem && elem.ownerDocument;
- if ( !doc ) {
- return;
- }
- docElem = doc.documentElement;
- // Make sure it's not a disconnected DOM node
- if ( !jQuery.contains( docElem, elem ) ) {
- return box;
- }
- box = elem.getBoundingClientRect();
- win = getWindow( doc );
- return {
- top: box.top + win.pageYOffset - docElem.clientTop,
- left: box.left + win.pageXOffset - docElem.clientLeft
- };
- },
- position: function() {
- if ( !this[ 0 ] ) {
- return;
- }
- var offsetParent, offset,
- elem = this[ 0 ],
- parentOffset = { top: 0, left: 0 };
- // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
- // because it is its only offset parent
- if ( jQuery.css( elem, "position" ) === "fixed" ) {
- // Assume getBoundingClientRect is there when computed position is fixed
- offset = elem.getBoundingClientRect();
- } else {
- // Get *real* offsetParent
- offsetParent = this.offsetParent();
- // Get correct offsets
- offset = this.offset();
- if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
- parentOffset = offsetParent.offset();
- }
- // Add offsetParent borders
- parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
- parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
- }
- // Subtract parent offsets and element margins
- return {
- top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
- left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
- };
- },
- // This method will return documentElement in the following cases:
- // 1) For the element inside the iframe without offsetParent, this method will return
- // documentElement of the parent window
- // 2) For the hidden or detached element
- // 3) For body or html element, i.e. in case of the html node - it will return itself
- //
- // but those exceptions were never presented as a real life use-cases
- // and might be considered as more preferable results.
- //
- // This logic, however, is not guaranteed and can change at any point in the future
- offsetParent: function() {
- return this.map( function() {
- var offsetParent = this.offsetParent;
- while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
- offsetParent = offsetParent.offsetParent;
- }
- return offsetParent || documentElement;
- } );
- }
- } );
- // Create scrollLeft and scrollTop methods
- jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
- var top = "pageYOffset" === prop;
- jQuery.fn[ method ] = function( val ) {
- return access( this, function( elem, method, val ) {
- var win = getWindow( elem );
- if ( val === undefined ) {
- return win ? win[ prop ] : elem[ method ];
- }
- if ( win ) {
- win.scrollTo(
- !top ? val : win.pageXOffset,
- top ? val : win.pageYOffset
- );
- } else {
- elem[ method ] = val;
- }
- }, method, val, arguments.length );
- };
- } );
- // Support: Safari<7-8+, Chrome<37-44+
- // Add the top/left cssHooks using jQuery.fn.position
- // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
- // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
- // getComputedStyle returns percent when specified for top/left/bottom/right;
- // rather than make the css module depend on the offset module, just check for it here
- jQuery.each( [ "top", "left" ], function( i, prop ) {
- jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
- function( elem, computed ) {
- if ( computed ) {
- computed = curCSS( elem, prop );
- // If curCSS returns percentage, fallback to offset
- return rnumnonpx.test( computed ) ?
- jQuery( elem ).position()[ prop ] + "px" :
- computed;
- }
- }
- );
- } );
- // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
- jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
- jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
- function( defaultExtra, funcName ) {
- // Margin is only for outerHeight, outerWidth
- jQuery.fn[ funcName ] = function( margin, value ) {
- var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
- extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
- return access( this, function( elem, type, value ) {
- var doc;
- if ( jQuery.isWindow( elem ) ) {
- // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
- // isn't a whole lot we can do. See pull request at this URL for discussion:
- // https://github.com/jquery/jquery/pull/764
- return elem.document.documentElement[ "client" + name ];
- }
- // Get document width or height
- if ( elem.nodeType === 9 ) {
- doc = elem.documentElement;
- // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
- // whichever is greatest
- return Math.max(
- elem.body[ "scroll" + name ], doc[ "scroll" + name ],
- elem.body[ "offset" + name ], doc[ "offset" + name ],
- doc[ "client" + name ]
- );
- }
- return value === undefined ?
- // Get width or height on the element, requesting but not forcing parseFloat
- jQuery.css( elem, type, extra ) :
- // Set width or height on the element
- jQuery.style( elem, type, value, extra );
- }, type, chainable ? margin : undefined, chainable, null );
- };
- } );
- } );
- jQuery.fn.extend( {
- bind: function( types, data, fn ) {
- return this.on( types, null, data, fn );
- },
- unbind: function( types, fn ) {
- return this.off( types, null, fn );
- },
- delegate: function( selector, types, data, fn ) {
- return this.on( types, selector, data, fn );
- },
- undelegate: function( selector, types, fn ) {
- // ( namespace ) or ( selector, types [, fn] )
- return arguments.length === 1 ?
- this.off( selector, "**" ) :
- this.off( types, selector || "**", fn );
- },
- size: function() {
- return this.length;
- }
- } );
- jQuery.fn.andSelf = jQuery.fn.addBack;
- // Register as a named AMD module, since jQuery can be concatenated with other
- // files that may use define, but not via a proper concatenation script that
- // understands anonymous AMD modules. A named AMD is safest and most robust
- // way to register. Lowercase jquery is used because AMD module names are
- // derived from file names, and jQuery is normally delivered in a lowercase
- // file name. Do this after creating the global so that if an AMD module wants
- // to call noConflict to hide this version of jQuery, it will work.
- // Note that for maximum portability, libraries that are not jQuery should
- // declare themselves as anonymous modules, and avoid setting a global if an
- // AMD loader is present. jQuery is a special case. For more information, see
- // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
- if ( typeof define === "function" && define.amd ) {
- define( "jquery", [], function() {
- return jQuery;
- } );
- }
- var
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
- // Map over the $ in case of overwrite
- _$ = window.$;
- jQuery.noConflict = function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
- return jQuery;
- };
- // Expose jQuery and $ identifiers, even in AMD
- // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
- // and CommonJS for browser emulators (#13566)
- if ( !noGlobal ) {
- window.jQuery = window.$ = jQuery;
- }
- return jQuery;
- }));
- define('aurelia-testing/aurelia-testing',['exports', './compile-spy', './view-spy', './component-tester'], function (exports, _compileSpy, _viewSpy, _componentTester) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.configure = exports.ComponentTester = exports.StageComponent = exports.ViewSpy = exports.CompileSpy = undefined;
- function configure(config) {
- config.globalResources('./compile-spy', './view-spy');
- }
- exports.CompileSpy = _compileSpy.CompileSpy;
- exports.ViewSpy = _viewSpy.ViewSpy;
- exports.StageComponent = _componentTester.StageComponent;
- exports.ComponentTester = _componentTester.ComponentTester;
- exports.configure = configure;
- });;define('aurelia-testing', ['aurelia-testing/aurelia-testing'], function (main) { return main; });
- define('aurelia-testing/compile-spy',['exports', 'aurelia-templating', 'aurelia-dependency-injection', 'aurelia-logging', 'aurelia-pal'], function (exports, _aureliaTemplating, _aureliaDependencyInjection, _aureliaLogging, _aureliaPal) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.CompileSpy = undefined;
- var LogManager = _interopRequireWildcard(_aureliaLogging);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
-
- var _dec, _dec2, _class;
- var CompileSpy = exports.CompileSpy = (_dec = (0, _aureliaTemplating.customAttribute)('compile-spy'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaTemplating.TargetInstruction), _dec(_class = _dec2(_class = function CompileSpy(element, instruction) {
-
- LogManager.getLogger('compile-spy').info(element, instruction);
- }) || _class) || _class);
- });
- define('aurelia-testing/view-spy',['exports', 'aurelia-templating', 'aurelia-logging'], function (exports, _aureliaTemplating, _aureliaLogging) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ViewSpy = undefined;
- var LogManager = _interopRequireWildcard(_aureliaLogging);
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
-
- var _dec, _class;
- var ViewSpy = exports.ViewSpy = (_dec = (0, _aureliaTemplating.customAttribute)('view-spy'), _dec(_class = function () {
- function ViewSpy() {
-
- this.logger = LogManager.getLogger('view-spy');
- }
- ViewSpy.prototype._log = function _log(lifecycleName, context) {
- if (!this.value && lifecycleName === 'created') {
- this.logger.info(lifecycleName, this.view);
- } else if (this.value && this.value.indexOf(lifecycleName) !== -1) {
- this.logger.info(lifecycleName, this.view, context);
- }
- };
- ViewSpy.prototype.created = function created(view) {
- this.view = view;
- this._log('created');
- };
- ViewSpy.prototype.bind = function bind(bindingContext) {
- this._log('bind', bindingContext);
- };
- ViewSpy.prototype.attached = function attached() {
- this._log('attached');
- };
- ViewSpy.prototype.detached = function detached() {
- this._log('detached');
- };
- ViewSpy.prototype.unbind = function unbind() {
- this._log('unbind');
- };
- return ViewSpy;
- }()) || _class);
- });
- define('aurelia-testing/component-tester',['exports', 'aurelia-templating', 'aurelia-framework'], function (exports, _aureliaTemplating, _aureliaFramework) {
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ComponentTester = exports.StageComponent = undefined;
-
- var StageComponent = exports.StageComponent = {
- withResources: function withResources(resources) {
- return new ComponentTester().withResources(resources);
- }
- };
- var ComponentTester = exports.ComponentTester = function () {
- function ComponentTester() {
-
- this.configure = function (aurelia) {
- return aurelia.use.standardConfiguration();
- };
- this._resources = [];
- }
- ComponentTester.prototype.bootstrap = function bootstrap(configure) {
- this.configure = configure;
- };
- ComponentTester.prototype.withResources = function withResources(resources) {
- this._resources = resources;
- return this;
- };
- ComponentTester.prototype.inView = function inView(html) {
- this._html = html;
- return this;
- };
- ComponentTester.prototype.boundTo = function boundTo(bindingContext) {
- this._bindingContext = bindingContext;
- return this;
- };
- ComponentTester.prototype.manuallyHandleLifecycle = function manuallyHandleLifecycle() {
- this._prepareLifecycle();
- return this;
- };
- ComponentTester.prototype.create = function create(bootstrap) {
- var _this = this;
- return bootstrap(function (aurelia) {
- return Promise.resolve(_this.configure(aurelia)).then(function () {
- if (_this._resources) {
- aurelia.use.globalResources(_this._resources);
- }
- return aurelia.start().then(function (a) {
- _this.host = document.createElement('div');
- _this.host.innerHTML = _this._html;
- document.body.appendChild(_this.host);
- return aurelia.enhance(_this._bindingContext, _this.host).then(function () {
- _this._rootView = aurelia.root;
- _this.element = _this.host.firstElementChild;
- if (aurelia.root.controllers.length) {
- _this.viewModel = aurelia.root.controllers[0].viewModel;
- }
- return new Promise(function (resolve) {
- return setTimeout(function () {
- return resolve();
- }, 0);
- });
- });
- });
- });
- });
- };
- ComponentTester.prototype.dispose = function dispose() {
- if (this.host === undefined || this._rootView === undefined) {
- throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()');
- }
- this._rootView.detached();
- this._rootView.unbind();
- return this.host.parentNode.removeChild(this.host);
- };
- ComponentTester.prototype._prepareLifecycle = function _prepareLifecycle() {
- var _this2 = this;
- var bindPrototype = _aureliaTemplating.View.prototype.bind;
- _aureliaTemplating.View.prototype.bind = function () {};
- this.bind = function (bindingContext) {
- return new Promise(function (resolve) {
- _aureliaTemplating.View.prototype.bind = bindPrototype;
- if (bindingContext !== undefined) {
- _this2._bindingContext = bindingContext;
- }
- _this2._rootView.bind(_this2._bindingContext);
- setTimeout(function () {
- return resolve();
- }, 0);
- });
- };
- var attachedPrototype = _aureliaTemplating.View.prototype.attached;
- _aureliaTemplating.View.prototype.attached = function () {};
- this.attached = function () {
- return new Promise(function (resolve) {
- _aureliaTemplating.View.prototype.attached = attachedPrototype;
- _this2._rootView.attached();
- setTimeout(function () {
- return resolve();
- }, 0);
- });
- };
- this.detached = function () {
- return new Promise(function (resolve) {
- _this2._rootView.detached();
- setTimeout(function () {
- return resolve();
- }, 0);
- });
- };
- this.unbind = function () {
- return new Promise(function (resolve) {
- _this2._rootView.unbind();
- setTimeout(function () {
- return resolve();
- }, 0);
- });
- };
- };
- return ComponentTester;
- }();
- });
|