_vendor-bundle.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835
  1. /* @preserve
  2. * The MIT License (MIT)
  3. *
  4. * Copyright (c) 2013-2015 Petka Antonov
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. * THE SOFTWARE.
  23. *
  24. */
  25. /**
  26. * bluebird build version 3.4.6
  27. * Features enabled: core
  28. * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each
  29. */
  30. !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){
  31. "use strict";
  32. var firstLineError;
  33. try {throw new Error(); } catch (e) {firstLineError = e;}
  34. var schedule = _dereq_("./schedule");
  35. var Queue = _dereq_("./queue");
  36. var util = _dereq_("./util");
  37. function Async() {
  38. this._customScheduler = false;
  39. this._isTickUsed = false;
  40. this._lateQueue = new Queue(16);
  41. this._normalQueue = new Queue(16);
  42. this._haveDrainedQueues = false;
  43. this._trampolineEnabled = true;
  44. var self = this;
  45. this.drainQueues = function () {
  46. self._drainQueues();
  47. };
  48. this._schedule = schedule;
  49. }
  50. Async.prototype.setScheduler = function(fn) {
  51. var prev = this._schedule;
  52. this._schedule = fn;
  53. this._customScheduler = true;
  54. return prev;
  55. };
  56. Async.prototype.hasCustomScheduler = function() {
  57. return this._customScheduler;
  58. };
  59. Async.prototype.enableTrampoline = function() {
  60. this._trampolineEnabled = true;
  61. };
  62. Async.prototype.disableTrampolineIfNecessary = function() {
  63. if (util.hasDevTools) {
  64. this._trampolineEnabled = false;
  65. }
  66. };
  67. Async.prototype.haveItemsQueued = function () {
  68. return this._isTickUsed || this._haveDrainedQueues;
  69. };
  70. Async.prototype.fatalError = function(e, isNode) {
  71. if (isNode) {
  72. process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
  73. "\n");
  74. process.exit(2);
  75. } else {
  76. this.throwLater(e);
  77. }
  78. };
  79. Async.prototype.throwLater = function(fn, arg) {
  80. if (arguments.length === 1) {
  81. arg = fn;
  82. fn = function () { throw arg; };
  83. }
  84. if (typeof setTimeout !== "undefined") {
  85. setTimeout(function() {
  86. fn(arg);
  87. }, 0);
  88. } else try {
  89. this._schedule(function() {
  90. fn(arg);
  91. });
  92. } catch (e) {
  93. throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  94. }
  95. };
  96. function AsyncInvokeLater(fn, receiver, arg) {
  97. this._lateQueue.push(fn, receiver, arg);
  98. this._queueTick();
  99. }
  100. function AsyncInvoke(fn, receiver, arg) {
  101. this._normalQueue.push(fn, receiver, arg);
  102. this._queueTick();
  103. }
  104. function AsyncSettlePromises(promise) {
  105. this._normalQueue._pushOne(promise);
  106. this._queueTick();
  107. }
  108. if (!util.hasDevTools) {
  109. Async.prototype.invokeLater = AsyncInvokeLater;
  110. Async.prototype.invoke = AsyncInvoke;
  111. Async.prototype.settlePromises = AsyncSettlePromises;
  112. } else {
  113. Async.prototype.invokeLater = function (fn, receiver, arg) {
  114. if (this._trampolineEnabled) {
  115. AsyncInvokeLater.call(this, fn, receiver, arg);
  116. } else {
  117. this._schedule(function() {
  118. setTimeout(function() {
  119. fn.call(receiver, arg);
  120. }, 100);
  121. });
  122. }
  123. };
  124. Async.prototype.invoke = function (fn, receiver, arg) {
  125. if (this._trampolineEnabled) {
  126. AsyncInvoke.call(this, fn, receiver, arg);
  127. } else {
  128. this._schedule(function() {
  129. fn.call(receiver, arg);
  130. });
  131. }
  132. };
  133. Async.prototype.settlePromises = function(promise) {
  134. if (this._trampolineEnabled) {
  135. AsyncSettlePromises.call(this, promise);
  136. } else {
  137. this._schedule(function() {
  138. promise._settlePromises();
  139. });
  140. }
  141. };
  142. }
  143. Async.prototype.invokeFirst = function (fn, receiver, arg) {
  144. this._normalQueue.unshift(fn, receiver, arg);
  145. this._queueTick();
  146. };
  147. Async.prototype._drainQueue = function(queue) {
  148. while (queue.length() > 0) {
  149. var fn = queue.shift();
  150. if (typeof fn !== "function") {
  151. fn._settlePromises();
  152. continue;
  153. }
  154. var receiver = queue.shift();
  155. var arg = queue.shift();
  156. fn.call(receiver, arg);
  157. }
  158. };
  159. Async.prototype._drainQueues = function () {
  160. this._drainQueue(this._normalQueue);
  161. this._reset();
  162. this._haveDrainedQueues = true;
  163. this._drainQueue(this._lateQueue);
  164. };
  165. Async.prototype._queueTick = function () {
  166. if (!this._isTickUsed) {
  167. this._isTickUsed = true;
  168. this._schedule(this.drainQueues);
  169. }
  170. };
  171. Async.prototype._reset = function () {
  172. this._isTickUsed = false;
  173. };
  174. module.exports = Async;
  175. module.exports.firstLineError = firstLineError;
  176. },{"./queue":17,"./schedule":18,"./util":21}],2:[function(_dereq_,module,exports){
  177. "use strict";
  178. module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
  179. var calledBind = false;
  180. var rejectThis = function(_, e) {
  181. this._reject(e);
  182. };
  183. var targetRejected = function(e, context) {
  184. context.promiseRejectionQueued = true;
  185. context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
  186. };
  187. var bindingResolved = function(thisArg, context) {
  188. if (((this._bitField & 50397184) === 0)) {
  189. this._resolveCallback(context.target);
  190. }
  191. };
  192. var bindingRejected = function(e, context) {
  193. if (!context.promiseRejectionQueued) this._reject(e);
  194. };
  195. Promise.prototype.bind = function (thisArg) {
  196. if (!calledBind) {
  197. calledBind = true;
  198. Promise.prototype._propagateFrom = debug.propagateFromFunction();
  199. Promise.prototype._boundValue = debug.boundValueFunction();
  200. }
  201. var maybePromise = tryConvertToPromise(thisArg);
  202. var ret = new Promise(INTERNAL);
  203. ret._propagateFrom(this, 1);
  204. var target = this._target();
  205. ret._setBoundTo(maybePromise);
  206. if (maybePromise instanceof Promise) {
  207. var context = {
  208. promiseRejectionQueued: false,
  209. promise: ret,
  210. target: target,
  211. bindingPromise: maybePromise
  212. };
  213. target._then(INTERNAL, targetRejected, undefined, ret, context);
  214. maybePromise._then(
  215. bindingResolved, bindingRejected, undefined, ret, context);
  216. ret._setOnCancel(maybePromise);
  217. } else {
  218. ret._resolveCallback(target);
  219. }
  220. return ret;
  221. };
  222. Promise.prototype._setBoundTo = function (obj) {
  223. if (obj !== undefined) {
  224. this._bitField = this._bitField | 2097152;
  225. this._boundTo = obj;
  226. } else {
  227. this._bitField = this._bitField & (~2097152);
  228. }
  229. };
  230. Promise.prototype._isBound = function () {
  231. return (this._bitField & 2097152) === 2097152;
  232. };
  233. Promise.bind = function (thisArg, value) {
  234. return Promise.resolve(value).bind(thisArg);
  235. };
  236. };
  237. },{}],3:[function(_dereq_,module,exports){
  238. "use strict";
  239. var old;
  240. if (typeof Promise !== "undefined") old = Promise;
  241. function noConflict() {
  242. try { if (Promise === bluebird) Promise = old; }
  243. catch (e) {}
  244. return bluebird;
  245. }
  246. var bluebird = _dereq_("./promise")();
  247. bluebird.noConflict = noConflict;
  248. module.exports = bluebird;
  249. },{"./promise":15}],4:[function(_dereq_,module,exports){
  250. "use strict";
  251. module.exports = function(Promise, PromiseArray, apiRejection, debug) {
  252. var util = _dereq_("./util");
  253. var tryCatch = util.tryCatch;
  254. var errorObj = util.errorObj;
  255. var async = Promise._async;
  256. Promise.prototype["break"] = Promise.prototype.cancel = function() {
  257. if (!debug.cancellation()) return this._warn("cancellation is disabled");
  258. var promise = this;
  259. var child = promise;
  260. while (promise._isCancellable()) {
  261. if (!promise._cancelBy(child)) {
  262. if (child._isFollowing()) {
  263. child._followee().cancel();
  264. } else {
  265. child._cancelBranched();
  266. }
  267. break;
  268. }
  269. var parent = promise._cancellationParent;
  270. if (parent == null || !parent._isCancellable()) {
  271. if (promise._isFollowing()) {
  272. promise._followee().cancel();
  273. } else {
  274. promise._cancelBranched();
  275. }
  276. break;
  277. } else {
  278. if (promise._isFollowing()) promise._followee().cancel();
  279. promise._setWillBeCancelled();
  280. child = promise;
  281. promise = parent;
  282. }
  283. }
  284. };
  285. Promise.prototype._branchHasCancelled = function() {
  286. this._branchesRemainingToCancel--;
  287. };
  288. Promise.prototype._enoughBranchesHaveCancelled = function() {
  289. return this._branchesRemainingToCancel === undefined ||
  290. this._branchesRemainingToCancel <= 0;
  291. };
  292. Promise.prototype._cancelBy = function(canceller) {
  293. if (canceller === this) {
  294. this._branchesRemainingToCancel = 0;
  295. this._invokeOnCancel();
  296. return true;
  297. } else {
  298. this._branchHasCancelled();
  299. if (this._enoughBranchesHaveCancelled()) {
  300. this._invokeOnCancel();
  301. return true;
  302. }
  303. }
  304. return false;
  305. };
  306. Promise.prototype._cancelBranched = function() {
  307. if (this._enoughBranchesHaveCancelled()) {
  308. this._cancel();
  309. }
  310. };
  311. Promise.prototype._cancel = function() {
  312. if (!this._isCancellable()) return;
  313. this._setCancelled();
  314. async.invoke(this._cancelPromises, this, undefined);
  315. };
  316. Promise.prototype._cancelPromises = function() {
  317. if (this._length() > 0) this._settlePromises();
  318. };
  319. Promise.prototype._unsetOnCancel = function() {
  320. this._onCancelField = undefined;
  321. };
  322. Promise.prototype._isCancellable = function() {
  323. return this.isPending() && !this._isCancelled();
  324. };
  325. Promise.prototype.isCancellable = function() {
  326. return this.isPending() && !this.isCancelled();
  327. };
  328. Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
  329. if (util.isArray(onCancelCallback)) {
  330. for (var i = 0; i < onCancelCallback.length; ++i) {
  331. this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
  332. }
  333. } else if (onCancelCallback !== undefined) {
  334. if (typeof onCancelCallback === "function") {
  335. if (!internalOnly) {
  336. var e = tryCatch(onCancelCallback).call(this._boundValue());
  337. if (e === errorObj) {
  338. this._attachExtraTrace(e.e);
  339. async.throwLater(e.e);
  340. }
  341. }
  342. } else {
  343. onCancelCallback._resultCancelled(this);
  344. }
  345. }
  346. };
  347. Promise.prototype._invokeOnCancel = function() {
  348. var onCancelCallback = this._onCancel();
  349. this._unsetOnCancel();
  350. async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
  351. };
  352. Promise.prototype._invokeInternalOnCancel = function() {
  353. if (this._isCancellable()) {
  354. this._doInvokeOnCancel(this._onCancel(), true);
  355. this._unsetOnCancel();
  356. }
  357. };
  358. Promise.prototype._resultCancelled = function() {
  359. this.cancel();
  360. };
  361. };
  362. },{"./util":21}],5:[function(_dereq_,module,exports){
  363. "use strict";
  364. module.exports = function(NEXT_FILTER) {
  365. var util = _dereq_("./util");
  366. var getKeys = _dereq_("./es5").keys;
  367. var tryCatch = util.tryCatch;
  368. var errorObj = util.errorObj;
  369. function catchFilter(instances, cb, promise) {
  370. return function(e) {
  371. var boundTo = promise._boundValue();
  372. predicateLoop: for (var i = 0; i < instances.length; ++i) {
  373. var item = instances[i];
  374. if (item === Error ||
  375. (item != null && item.prototype instanceof Error)) {
  376. if (e instanceof item) {
  377. return tryCatch(cb).call(boundTo, e);
  378. }
  379. } else if (typeof item === "function") {
  380. var matchesPredicate = tryCatch(item).call(boundTo, e);
  381. if (matchesPredicate === errorObj) {
  382. return matchesPredicate;
  383. } else if (matchesPredicate) {
  384. return tryCatch(cb).call(boundTo, e);
  385. }
  386. } else if (util.isObject(e)) {
  387. var keys = getKeys(item);
  388. for (var j = 0; j < keys.length; ++j) {
  389. var key = keys[j];
  390. if (item[key] != e[key]) {
  391. continue predicateLoop;
  392. }
  393. }
  394. return tryCatch(cb).call(boundTo, e);
  395. }
  396. }
  397. return NEXT_FILTER;
  398. };
  399. }
  400. return catchFilter;
  401. };
  402. },{"./es5":10,"./util":21}],6:[function(_dereq_,module,exports){
  403. "use strict";
  404. module.exports = function(Promise) {
  405. var longStackTraces = false;
  406. var contextStack = [];
  407. Promise.prototype._promiseCreated = function() {};
  408. Promise.prototype._pushContext = function() {};
  409. Promise.prototype._popContext = function() {return null;};
  410. Promise._peekContext = Promise.prototype._peekContext = function() {};
  411. function Context() {
  412. this._trace = new Context.CapturedTrace(peekContext());
  413. }
  414. Context.prototype._pushContext = function () {
  415. if (this._trace !== undefined) {
  416. this._trace._promiseCreated = null;
  417. contextStack.push(this._trace);
  418. }
  419. };
  420. Context.prototype._popContext = function () {
  421. if (this._trace !== undefined) {
  422. var trace = contextStack.pop();
  423. var ret = trace._promiseCreated;
  424. trace._promiseCreated = null;
  425. return ret;
  426. }
  427. return null;
  428. };
  429. function createContext() {
  430. if (longStackTraces) return new Context();
  431. }
  432. function peekContext() {
  433. var lastIndex = contextStack.length - 1;
  434. if (lastIndex >= 0) {
  435. return contextStack[lastIndex];
  436. }
  437. return undefined;
  438. }
  439. Context.CapturedTrace = null;
  440. Context.create = createContext;
  441. Context.deactivateLongStackTraces = function() {};
  442. Context.activateLongStackTraces = function() {
  443. var Promise_pushContext = Promise.prototype._pushContext;
  444. var Promise_popContext = Promise.prototype._popContext;
  445. var Promise_PeekContext = Promise._peekContext;
  446. var Promise_peekContext = Promise.prototype._peekContext;
  447. var Promise_promiseCreated = Promise.prototype._promiseCreated;
  448. Context.deactivateLongStackTraces = function() {
  449. Promise.prototype._pushContext = Promise_pushContext;
  450. Promise.prototype._popContext = Promise_popContext;
  451. Promise._peekContext = Promise_PeekContext;
  452. Promise.prototype._peekContext = Promise_peekContext;
  453. Promise.prototype._promiseCreated = Promise_promiseCreated;
  454. longStackTraces = false;
  455. };
  456. longStackTraces = true;
  457. Promise.prototype._pushContext = Context.prototype._pushContext;
  458. Promise.prototype._popContext = Context.prototype._popContext;
  459. Promise._peekContext = Promise.prototype._peekContext = peekContext;
  460. Promise.prototype._promiseCreated = function() {
  461. var ctx = this._peekContext();
  462. if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
  463. };
  464. };
  465. return Context;
  466. };
  467. },{}],7:[function(_dereq_,module,exports){
  468. "use strict";
  469. module.exports = function(Promise, Context) {
  470. var getDomain = Promise._getDomain;
  471. var async = Promise._async;
  472. var Warning = _dereq_("./errors").Warning;
  473. var util = _dereq_("./util");
  474. var canAttachTrace = util.canAttachTrace;
  475. var unhandledRejectionHandled;
  476. var possiblyUnhandledRejection;
  477. var bluebirdFramePattern =
  478. /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
  479. var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
  480. var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
  481. var stackFramePattern = null;
  482. var formatStack = null;
  483. var indentStackFrames = false;
  484. var printWarning;
  485. var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
  486. (true ||
  487. util.env("BLUEBIRD_DEBUG") ||
  488. util.env("NODE_ENV") === "development"));
  489. var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
  490. (debugging || util.env("BLUEBIRD_WARNINGS")));
  491. var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
  492. (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
  493. var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
  494. (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
  495. Promise.prototype.suppressUnhandledRejections = function() {
  496. var target = this._target();
  497. target._bitField = ((target._bitField & (~1048576)) |
  498. 524288);
  499. };
  500. Promise.prototype._ensurePossibleRejectionHandled = function () {
  501. if ((this._bitField & 524288) !== 0) return;
  502. this._setRejectionIsUnhandled();
  503. async.invokeLater(this._notifyUnhandledRejection, this, undefined);
  504. };
  505. Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
  506. fireRejectionEvent("rejectionHandled",
  507. unhandledRejectionHandled, undefined, this);
  508. };
  509. Promise.prototype._setReturnedNonUndefined = function() {
  510. this._bitField = this._bitField | 268435456;
  511. };
  512. Promise.prototype._returnedNonUndefined = function() {
  513. return (this._bitField & 268435456) !== 0;
  514. };
  515. Promise.prototype._notifyUnhandledRejection = function () {
  516. if (this._isRejectionUnhandled()) {
  517. var reason = this._settledValue();
  518. this._setUnhandledRejectionIsNotified();
  519. fireRejectionEvent("unhandledRejection",
  520. possiblyUnhandledRejection, reason, this);
  521. }
  522. };
  523. Promise.prototype._setUnhandledRejectionIsNotified = function () {
  524. this._bitField = this._bitField | 262144;
  525. };
  526. Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
  527. this._bitField = this._bitField & (~262144);
  528. };
  529. Promise.prototype._isUnhandledRejectionNotified = function () {
  530. return (this._bitField & 262144) > 0;
  531. };
  532. Promise.prototype._setRejectionIsUnhandled = function () {
  533. this._bitField = this._bitField | 1048576;
  534. };
  535. Promise.prototype._unsetRejectionIsUnhandled = function () {
  536. this._bitField = this._bitField & (~1048576);
  537. if (this._isUnhandledRejectionNotified()) {
  538. this._unsetUnhandledRejectionIsNotified();
  539. this._notifyUnhandledRejectionIsHandled();
  540. }
  541. };
  542. Promise.prototype._isRejectionUnhandled = function () {
  543. return (this._bitField & 1048576) > 0;
  544. };
  545. Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
  546. return warn(message, shouldUseOwnTrace, promise || this);
  547. };
  548. Promise.onPossiblyUnhandledRejection = function (fn) {
  549. var domain = getDomain();
  550. possiblyUnhandledRejection =
  551. typeof fn === "function" ? (domain === null ?
  552. fn : util.domainBind(domain, fn))
  553. : undefined;
  554. };
  555. Promise.onUnhandledRejectionHandled = function (fn) {
  556. var domain = getDomain();
  557. unhandledRejectionHandled =
  558. typeof fn === "function" ? (domain === null ?
  559. fn : util.domainBind(domain, fn))
  560. : undefined;
  561. };
  562. var disableLongStackTraces = function() {};
  563. Promise.longStackTraces = function () {
  564. if (async.haveItemsQueued() && !config.longStackTraces) {
  565. throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  566. }
  567. if (!config.longStackTraces && longStackTracesIsSupported()) {
  568. var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
  569. var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
  570. config.longStackTraces = true;
  571. disableLongStackTraces = function() {
  572. if (async.haveItemsQueued() && !config.longStackTraces) {
  573. throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  574. }
  575. Promise.prototype._captureStackTrace = Promise_captureStackTrace;
  576. Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
  577. Context.deactivateLongStackTraces();
  578. async.enableTrampoline();
  579. config.longStackTraces = false;
  580. };
  581. Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
  582. Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
  583. Context.activateLongStackTraces();
  584. async.disableTrampolineIfNecessary();
  585. }
  586. };
  587. Promise.hasLongStackTraces = function () {
  588. return config.longStackTraces && longStackTracesIsSupported();
  589. };
  590. var fireDomEvent = (function() {
  591. try {
  592. if (typeof CustomEvent === "function") {
  593. var event = new CustomEvent("CustomEvent");
  594. util.global.dispatchEvent(event);
  595. return function(name, event) {
  596. var domEvent = new CustomEvent(name.toLowerCase(), {
  597. detail: event,
  598. cancelable: true
  599. });
  600. return !util.global.dispatchEvent(domEvent);
  601. };
  602. } else if (typeof Event === "function") {
  603. var event = new Event("CustomEvent");
  604. util.global.dispatchEvent(event);
  605. return function(name, event) {
  606. var domEvent = new Event(name.toLowerCase(), {
  607. cancelable: true
  608. });
  609. domEvent.detail = event;
  610. return !util.global.dispatchEvent(domEvent);
  611. };
  612. } else {
  613. var event = document.createEvent("CustomEvent");
  614. event.initCustomEvent("testingtheevent", false, true, {});
  615. util.global.dispatchEvent(event);
  616. return function(name, event) {
  617. var domEvent = document.createEvent("CustomEvent");
  618. domEvent.initCustomEvent(name.toLowerCase(), false, true,
  619. event);
  620. return !util.global.dispatchEvent(domEvent);
  621. };
  622. }
  623. } catch (e) {}
  624. return function() {
  625. return false;
  626. };
  627. })();
  628. var fireGlobalEvent = (function() {
  629. if (util.isNode) {
  630. return function() {
  631. return process.emit.apply(process, arguments);
  632. };
  633. } else {
  634. if (!util.global) {
  635. return function() {
  636. return false;
  637. };
  638. }
  639. return function(name) {
  640. var methodName = "on" + name.toLowerCase();
  641. var method = util.global[methodName];
  642. if (!method) return false;
  643. method.apply(util.global, [].slice.call(arguments, 1));
  644. return true;
  645. };
  646. }
  647. })();
  648. function generatePromiseLifecycleEventObject(name, promise) {
  649. return {promise: promise};
  650. }
  651. var eventToObjectGenerator = {
  652. promiseCreated: generatePromiseLifecycleEventObject,
  653. promiseFulfilled: generatePromiseLifecycleEventObject,
  654. promiseRejected: generatePromiseLifecycleEventObject,
  655. promiseResolved: generatePromiseLifecycleEventObject,
  656. promiseCancelled: generatePromiseLifecycleEventObject,
  657. promiseChained: function(name, promise, child) {
  658. return {promise: promise, child: child};
  659. },
  660. warning: function(name, warning) {
  661. return {warning: warning};
  662. },
  663. unhandledRejection: function (name, reason, promise) {
  664. return {reason: reason, promise: promise};
  665. },
  666. rejectionHandled: generatePromiseLifecycleEventObject
  667. };
  668. var activeFireEvent = function (name) {
  669. var globalEventFired = false;
  670. try {
  671. globalEventFired = fireGlobalEvent.apply(null, arguments);
  672. } catch (e) {
  673. async.throwLater(e);
  674. globalEventFired = true;
  675. }
  676. var domEventFired = false;
  677. try {
  678. domEventFired = fireDomEvent(name,
  679. eventToObjectGenerator[name].apply(null, arguments));
  680. } catch (e) {
  681. async.throwLater(e);
  682. domEventFired = true;
  683. }
  684. return domEventFired || globalEventFired;
  685. };
  686. Promise.config = function(opts) {
  687. opts = Object(opts);
  688. if ("longStackTraces" in opts) {
  689. if (opts.longStackTraces) {
  690. Promise.longStackTraces();
  691. } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
  692. disableLongStackTraces();
  693. }
  694. }
  695. if ("warnings" in opts) {
  696. var warningsOption = opts.warnings;
  697. config.warnings = !!warningsOption;
  698. wForgottenReturn = config.warnings;
  699. if (util.isObject(warningsOption)) {
  700. if ("wForgottenReturn" in warningsOption) {
  701. wForgottenReturn = !!warningsOption.wForgottenReturn;
  702. }
  703. }
  704. }
  705. if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
  706. if (async.haveItemsQueued()) {
  707. throw new Error(
  708. "cannot enable cancellation after promises are in use");
  709. }
  710. Promise.prototype._clearCancellationData =
  711. cancellationClearCancellationData;
  712. Promise.prototype._propagateFrom = cancellationPropagateFrom;
  713. Promise.prototype._onCancel = cancellationOnCancel;
  714. Promise.prototype._setOnCancel = cancellationSetOnCancel;
  715. Promise.prototype._attachCancellationCallback =
  716. cancellationAttachCancellationCallback;
  717. Promise.prototype._execute = cancellationExecute;
  718. propagateFromFunction = cancellationPropagateFrom;
  719. config.cancellation = true;
  720. }
  721. if ("monitoring" in opts) {
  722. if (opts.monitoring && !config.monitoring) {
  723. config.monitoring = true;
  724. Promise.prototype._fireEvent = activeFireEvent;
  725. } else if (!opts.monitoring && config.monitoring) {
  726. config.monitoring = false;
  727. Promise.prototype._fireEvent = defaultFireEvent;
  728. }
  729. }
  730. };
  731. function defaultFireEvent() { return false; }
  732. Promise.prototype._fireEvent = defaultFireEvent;
  733. Promise.prototype._execute = function(executor, resolve, reject) {
  734. try {
  735. executor(resolve, reject);
  736. } catch (e) {
  737. return e;
  738. }
  739. };
  740. Promise.prototype._onCancel = function () {};
  741. Promise.prototype._setOnCancel = function (handler) { ; };
  742. Promise.prototype._attachCancellationCallback = function(onCancel) {
  743. ;
  744. };
  745. Promise.prototype._captureStackTrace = function () {};
  746. Promise.prototype._attachExtraTrace = function () {};
  747. Promise.prototype._clearCancellationData = function() {};
  748. Promise.prototype._propagateFrom = function (parent, flags) {
  749. ;
  750. ;
  751. };
  752. function cancellationExecute(executor, resolve, reject) {
  753. var promise = this;
  754. try {
  755. executor(resolve, reject, function(onCancel) {
  756. if (typeof onCancel !== "function") {
  757. throw new TypeError("onCancel must be a function, got: " +
  758. util.toString(onCancel));
  759. }
  760. promise._attachCancellationCallback(onCancel);
  761. });
  762. } catch (e) {
  763. return e;
  764. }
  765. }
  766. function cancellationAttachCancellationCallback(onCancel) {
  767. if (!this._isCancellable()) return this;
  768. var previousOnCancel = this._onCancel();
  769. if (previousOnCancel !== undefined) {
  770. if (util.isArray(previousOnCancel)) {
  771. previousOnCancel.push(onCancel);
  772. } else {
  773. this._setOnCancel([previousOnCancel, onCancel]);
  774. }
  775. } else {
  776. this._setOnCancel(onCancel);
  777. }
  778. }
  779. function cancellationOnCancel() {
  780. return this._onCancelField;
  781. }
  782. function cancellationSetOnCancel(onCancel) {
  783. this._onCancelField = onCancel;
  784. }
  785. function cancellationClearCancellationData() {
  786. this._cancellationParent = undefined;
  787. this._onCancelField = undefined;
  788. }
  789. function cancellationPropagateFrom(parent, flags) {
  790. if ((flags & 1) !== 0) {
  791. this._cancellationParent = parent;
  792. var branchesRemainingToCancel = parent._branchesRemainingToCancel;
  793. if (branchesRemainingToCancel === undefined) {
  794. branchesRemainingToCancel = 0;
  795. }
  796. parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
  797. }
  798. if ((flags & 2) !== 0 && parent._isBound()) {
  799. this._setBoundTo(parent._boundTo);
  800. }
  801. }
  802. function bindingPropagateFrom(parent, flags) {
  803. if ((flags & 2) !== 0 && parent._isBound()) {
  804. this._setBoundTo(parent._boundTo);
  805. }
  806. }
  807. var propagateFromFunction = bindingPropagateFrom;
  808. function boundValueFunction() {
  809. var ret = this._boundTo;
  810. if (ret !== undefined) {
  811. if (ret instanceof Promise) {
  812. if (ret.isFulfilled()) {
  813. return ret.value();
  814. } else {
  815. return undefined;
  816. }
  817. }
  818. }
  819. return ret;
  820. }
  821. function longStackTracesCaptureStackTrace() {
  822. this._trace = new CapturedTrace(this._peekContext());
  823. }
  824. function longStackTracesAttachExtraTrace(error, ignoreSelf) {
  825. if (canAttachTrace(error)) {
  826. var trace = this._trace;
  827. if (trace !== undefined) {
  828. if (ignoreSelf) trace = trace._parent;
  829. }
  830. if (trace !== undefined) {
  831. trace.attachExtraTrace(error);
  832. } else if (!error.__stackCleaned__) {
  833. var parsed = parseStackAndMessage(error);
  834. util.notEnumerableProp(error, "stack",
  835. parsed.message + "\n" + parsed.stack.join("\n"));
  836. util.notEnumerableProp(error, "__stackCleaned__", true);
  837. }
  838. }
  839. }
  840. function checkForgottenReturns(returnValue, promiseCreated, name, promise,
  841. parent) {
  842. if (returnValue === undefined && promiseCreated !== null &&
  843. wForgottenReturn) {
  844. if (parent !== undefined && parent._returnedNonUndefined()) return;
  845. if ((promise._bitField & 65535) === 0) return;
  846. if (name) name = name + " ";
  847. var handlerLine = "";
  848. var creatorLine = "";
  849. if (promiseCreated._trace) {
  850. var traceLines = promiseCreated._trace.stack.split("\n");
  851. var stack = cleanStack(traceLines);
  852. for (var i = stack.length - 1; i >= 0; --i) {
  853. var line = stack[i];
  854. if (!nodeFramePattern.test(line)) {
  855. var lineMatches = line.match(parseLinePattern);
  856. if (lineMatches) {
  857. handlerLine = "at " + lineMatches[1] +
  858. ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
  859. }
  860. break;
  861. }
  862. }
  863. if (stack.length > 0) {
  864. var firstUserLine = stack[0];
  865. for (var i = 0; i < traceLines.length; ++i) {
  866. if (traceLines[i] === firstUserLine) {
  867. if (i > 0) {
  868. creatorLine = "\n" + traceLines[i - 1];
  869. }
  870. break;
  871. }
  872. }
  873. }
  874. }
  875. var msg = "a promise was created in a " + name +
  876. "handler " + handlerLine + "but was not returned from it, " +
  877. "see http://goo.gl/rRqMUw" +
  878. creatorLine;
  879. promise._warn(msg, true, promiseCreated);
  880. }
  881. }
  882. function deprecated(name, replacement) {
  883. var message = name +
  884. " is deprecated and will be removed in a future version.";
  885. if (replacement) message += " Use " + replacement + " instead.";
  886. return warn(message);
  887. }
  888. function warn(message, shouldUseOwnTrace, promise) {
  889. if (!config.warnings) return;
  890. var warning = new Warning(message);
  891. var ctx;
  892. if (shouldUseOwnTrace) {
  893. promise._attachExtraTrace(warning);
  894. } else if (config.longStackTraces && (ctx = Promise._peekContext())) {
  895. ctx.attachExtraTrace(warning);
  896. } else {
  897. var parsed = parseStackAndMessage(warning);
  898. warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
  899. }
  900. if (!activeFireEvent("warning", warning)) {
  901. formatAndLogError(warning, "", true);
  902. }
  903. }
  904. function reconstructStack(message, stacks) {
  905. for (var i = 0; i < stacks.length - 1; ++i) {
  906. stacks[i].push("From previous event:");
  907. stacks[i] = stacks[i].join("\n");
  908. }
  909. if (i < stacks.length) {
  910. stacks[i] = stacks[i].join("\n");
  911. }
  912. return message + "\n" + stacks.join("\n");
  913. }
  914. function removeDuplicateOrEmptyJumps(stacks) {
  915. for (var i = 0; i < stacks.length; ++i) {
  916. if (stacks[i].length === 0 ||
  917. ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
  918. stacks.splice(i, 1);
  919. i--;
  920. }
  921. }
  922. }
  923. function removeCommonRoots(stacks) {
  924. var current = stacks[0];
  925. for (var i = 1; i < stacks.length; ++i) {
  926. var prev = stacks[i];
  927. var currentLastIndex = current.length - 1;
  928. var currentLastLine = current[currentLastIndex];
  929. var commonRootMeetPoint = -1;
  930. for (var j = prev.length - 1; j >= 0; --j) {
  931. if (prev[j] === currentLastLine) {
  932. commonRootMeetPoint = j;
  933. break;
  934. }
  935. }
  936. for (var j = commonRootMeetPoint; j >= 0; --j) {
  937. var line = prev[j];
  938. if (current[currentLastIndex] === line) {
  939. current.pop();
  940. currentLastIndex--;
  941. } else {
  942. break;
  943. }
  944. }
  945. current = prev;
  946. }
  947. }
  948. function cleanStack(stack) {
  949. var ret = [];
  950. for (var i = 0; i < stack.length; ++i) {
  951. var line = stack[i];
  952. var isTraceLine = " (No stack trace)" === line ||
  953. stackFramePattern.test(line);
  954. var isInternalFrame = isTraceLine && shouldIgnore(line);
  955. if (isTraceLine && !isInternalFrame) {
  956. if (indentStackFrames && line.charAt(0) !== " ") {
  957. line = " " + line;
  958. }
  959. ret.push(line);
  960. }
  961. }
  962. return ret;
  963. }
  964. function stackFramesAsArray(error) {
  965. var stack = error.stack.replace(/\s+$/g, "").split("\n");
  966. for (var i = 0; i < stack.length; ++i) {
  967. var line = stack[i];
  968. if (" (No stack trace)" === line || stackFramePattern.test(line)) {
  969. break;
  970. }
  971. }
  972. if (i > 0) {
  973. stack = stack.slice(i);
  974. }
  975. return stack;
  976. }
  977. function parseStackAndMessage(error) {
  978. var stack = error.stack;
  979. var message = error.toString();
  980. stack = typeof stack === "string" && stack.length > 0
  981. ? stackFramesAsArray(error) : [" (No stack trace)"];
  982. return {
  983. message: message,
  984. stack: cleanStack(stack)
  985. };
  986. }
  987. function formatAndLogError(error, title, isSoft) {
  988. if (typeof console !== "undefined") {
  989. var message;
  990. if (util.isObject(error)) {
  991. var stack = error.stack;
  992. message = title + formatStack(stack, error);
  993. } else {
  994. message = title + String(error);
  995. }
  996. if (typeof printWarning === "function") {
  997. printWarning(message, isSoft);
  998. } else if (typeof console.log === "function" ||
  999. typeof console.log === "object") {
  1000. console.log(message);
  1001. }
  1002. }
  1003. }
  1004. function fireRejectionEvent(name, localHandler, reason, promise) {
  1005. var localEventFired = false;
  1006. try {
  1007. if (typeof localHandler === "function") {
  1008. localEventFired = true;
  1009. if (name === "rejectionHandled") {
  1010. localHandler(promise);
  1011. } else {
  1012. localHandler(reason, promise);
  1013. }
  1014. }
  1015. } catch (e) {
  1016. async.throwLater(e);
  1017. }
  1018. if (name === "unhandledRejection") {
  1019. if (!activeFireEvent(name, reason, promise) && !localEventFired) {
  1020. formatAndLogError(reason, "Unhandled rejection ");
  1021. }
  1022. } else {
  1023. activeFireEvent(name, promise);
  1024. }
  1025. }
  1026. function formatNonError(obj) {
  1027. var str;
  1028. if (typeof obj === "function") {
  1029. str = "[function " +
  1030. (obj.name || "anonymous") +
  1031. "]";
  1032. } else {
  1033. str = obj && typeof obj.toString === "function"
  1034. ? obj.toString() : util.toString(obj);
  1035. var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
  1036. if (ruselessToString.test(str)) {
  1037. try {
  1038. var newStr = JSON.stringify(obj);
  1039. str = newStr;
  1040. }
  1041. catch(e) {
  1042. }
  1043. }
  1044. if (str.length === 0) {
  1045. str = "(empty array)";
  1046. }
  1047. }
  1048. return ("(<" + snip(str) + ">, no stack trace)");
  1049. }
  1050. function snip(str) {
  1051. var maxChars = 41;
  1052. if (str.length < maxChars) {
  1053. return str;
  1054. }
  1055. return str.substr(0, maxChars - 3) + "...";
  1056. }
  1057. function longStackTracesIsSupported() {
  1058. return typeof captureStackTrace === "function";
  1059. }
  1060. var shouldIgnore = function() { return false; };
  1061. var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
  1062. function parseLineInfo(line) {
  1063. var matches = line.match(parseLineInfoRegex);
  1064. if (matches) {
  1065. return {
  1066. fileName: matches[1],
  1067. line: parseInt(matches[2], 10)
  1068. };
  1069. }
  1070. }
  1071. function setBounds(firstLineError, lastLineError) {
  1072. if (!longStackTracesIsSupported()) return;
  1073. var firstStackLines = firstLineError.stack.split("\n");
  1074. var lastStackLines = lastLineError.stack.split("\n");
  1075. var firstIndex = -1;
  1076. var lastIndex = -1;
  1077. var firstFileName;
  1078. var lastFileName;
  1079. for (var i = 0; i < firstStackLines.length; ++i) {
  1080. var result = parseLineInfo(firstStackLines[i]);
  1081. if (result) {
  1082. firstFileName = result.fileName;
  1083. firstIndex = result.line;
  1084. break;
  1085. }
  1086. }
  1087. for (var i = 0; i < lastStackLines.length; ++i) {
  1088. var result = parseLineInfo(lastStackLines[i]);
  1089. if (result) {
  1090. lastFileName = result.fileName;
  1091. lastIndex = result.line;
  1092. break;
  1093. }
  1094. }
  1095. if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
  1096. firstFileName !== lastFileName || firstIndex >= lastIndex) {
  1097. return;
  1098. }
  1099. shouldIgnore = function(line) {
  1100. if (bluebirdFramePattern.test(line)) return true;
  1101. var info = parseLineInfo(line);
  1102. if (info) {
  1103. if (info.fileName === firstFileName &&
  1104. (firstIndex <= info.line && info.line <= lastIndex)) {
  1105. return true;
  1106. }
  1107. }
  1108. return false;
  1109. };
  1110. }
  1111. function CapturedTrace(parent) {
  1112. this._parent = parent;
  1113. this._promisesCreated = 0;
  1114. var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
  1115. captureStackTrace(this, CapturedTrace);
  1116. if (length > 32) this.uncycle();
  1117. }
  1118. util.inherits(CapturedTrace, Error);
  1119. Context.CapturedTrace = CapturedTrace;
  1120. CapturedTrace.prototype.uncycle = function() {
  1121. var length = this._length;
  1122. if (length < 2) return;
  1123. var nodes = [];
  1124. var stackToIndex = {};
  1125. for (var i = 0, node = this; node !== undefined; ++i) {
  1126. nodes.push(node);
  1127. node = node._parent;
  1128. }
  1129. length = this._length = i;
  1130. for (var i = length - 1; i >= 0; --i) {
  1131. var stack = nodes[i].stack;
  1132. if (stackToIndex[stack] === undefined) {
  1133. stackToIndex[stack] = i;
  1134. }
  1135. }
  1136. for (var i = 0; i < length; ++i) {
  1137. var currentStack = nodes[i].stack;
  1138. var index = stackToIndex[currentStack];
  1139. if (index !== undefined && index !== i) {
  1140. if (index > 0) {
  1141. nodes[index - 1]._parent = undefined;
  1142. nodes[index - 1]._length = 1;
  1143. }
  1144. nodes[i]._parent = undefined;
  1145. nodes[i]._length = 1;
  1146. var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
  1147. if (index < length - 1) {
  1148. cycleEdgeNode._parent = nodes[index + 1];
  1149. cycleEdgeNode._parent.uncycle();
  1150. cycleEdgeNode._length =
  1151. cycleEdgeNode._parent._length + 1;
  1152. } else {
  1153. cycleEdgeNode._parent = undefined;
  1154. cycleEdgeNode._length = 1;
  1155. }
  1156. var currentChildLength = cycleEdgeNode._length + 1;
  1157. for (var j = i - 2; j >= 0; --j) {
  1158. nodes[j]._length = currentChildLength;
  1159. currentChildLength++;
  1160. }
  1161. return;
  1162. }
  1163. }
  1164. };
  1165. CapturedTrace.prototype.attachExtraTrace = function(error) {
  1166. if (error.__stackCleaned__) return;
  1167. this.uncycle();
  1168. var parsed = parseStackAndMessage(error);
  1169. var message = parsed.message;
  1170. var stacks = [parsed.stack];
  1171. var trace = this;
  1172. while (trace !== undefined) {
  1173. stacks.push(cleanStack(trace.stack.split("\n")));
  1174. trace = trace._parent;
  1175. }
  1176. removeCommonRoots(stacks);
  1177. removeDuplicateOrEmptyJumps(stacks);
  1178. util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
  1179. util.notEnumerableProp(error, "__stackCleaned__", true);
  1180. };
  1181. var captureStackTrace = (function stackDetection() {
  1182. var v8stackFramePattern = /^\s*at\s*/;
  1183. var v8stackFormatter = function(stack, error) {
  1184. if (typeof stack === "string") return stack;
  1185. if (error.name !== undefined &&
  1186. error.message !== undefined) {
  1187. return error.toString();
  1188. }
  1189. return formatNonError(error);
  1190. };
  1191. if (typeof Error.stackTraceLimit === "number" &&
  1192. typeof Error.captureStackTrace === "function") {
  1193. Error.stackTraceLimit += 6;
  1194. stackFramePattern = v8stackFramePattern;
  1195. formatStack = v8stackFormatter;
  1196. var captureStackTrace = Error.captureStackTrace;
  1197. shouldIgnore = function(line) {
  1198. return bluebirdFramePattern.test(line);
  1199. };
  1200. return function(receiver, ignoreUntil) {
  1201. Error.stackTraceLimit += 6;
  1202. captureStackTrace(receiver, ignoreUntil);
  1203. Error.stackTraceLimit -= 6;
  1204. };
  1205. }
  1206. var err = new Error();
  1207. if (typeof err.stack === "string" &&
  1208. err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
  1209. stackFramePattern = /@/;
  1210. formatStack = v8stackFormatter;
  1211. indentStackFrames = true;
  1212. return function captureStackTrace(o) {
  1213. o.stack = new Error().stack;
  1214. };
  1215. }
  1216. var hasStackAfterThrow;
  1217. try { throw new Error(); }
  1218. catch(e) {
  1219. hasStackAfterThrow = ("stack" in e);
  1220. }
  1221. if (!("stack" in err) && hasStackAfterThrow &&
  1222. typeof Error.stackTraceLimit === "number") {
  1223. stackFramePattern = v8stackFramePattern;
  1224. formatStack = v8stackFormatter;
  1225. return function captureStackTrace(o) {
  1226. Error.stackTraceLimit += 6;
  1227. try { throw new Error(); }
  1228. catch(e) { o.stack = e.stack; }
  1229. Error.stackTraceLimit -= 6;
  1230. };
  1231. }
  1232. formatStack = function(stack, error) {
  1233. if (typeof stack === "string") return stack;
  1234. if ((typeof error === "object" ||
  1235. typeof error === "function") &&
  1236. error.name !== undefined &&
  1237. error.message !== undefined) {
  1238. return error.toString();
  1239. }
  1240. return formatNonError(error);
  1241. };
  1242. return null;
  1243. })([]);
  1244. if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
  1245. printWarning = function (message) {
  1246. console.warn(message);
  1247. };
  1248. if (util.isNode && process.stderr.isTTY) {
  1249. printWarning = function(message, isSoft) {
  1250. var color = isSoft ? "\u001b[33m" : "\u001b[31m";
  1251. console.warn(color + message + "\u001b[0m\n");
  1252. };
  1253. } else if (!util.isNode && typeof (new Error().stack) === "string") {
  1254. printWarning = function(message, isSoft) {
  1255. console.warn("%c" + message,
  1256. isSoft ? "color: darkorange" : "color: red");
  1257. };
  1258. }
  1259. }
  1260. var config = {
  1261. warnings: warnings,
  1262. longStackTraces: false,
  1263. cancellation: false,
  1264. monitoring: false
  1265. };
  1266. if (longStackTraces) Promise.longStackTraces();
  1267. return {
  1268. longStackTraces: function() {
  1269. return config.longStackTraces;
  1270. },
  1271. warnings: function() {
  1272. return config.warnings;
  1273. },
  1274. cancellation: function() {
  1275. return config.cancellation;
  1276. },
  1277. monitoring: function() {
  1278. return config.monitoring;
  1279. },
  1280. propagateFromFunction: function() {
  1281. return propagateFromFunction;
  1282. },
  1283. boundValueFunction: function() {
  1284. return boundValueFunction;
  1285. },
  1286. checkForgottenReturns: checkForgottenReturns,
  1287. setBounds: setBounds,
  1288. warn: warn,
  1289. deprecated: deprecated,
  1290. CapturedTrace: CapturedTrace,
  1291. fireDomEvent: fireDomEvent,
  1292. fireGlobalEvent: fireGlobalEvent
  1293. };
  1294. };
  1295. },{"./errors":9,"./util":21}],8:[function(_dereq_,module,exports){
  1296. "use strict";
  1297. module.exports = function(Promise) {
  1298. function returner() {
  1299. return this.value;
  1300. }
  1301. function thrower() {
  1302. throw this.reason;
  1303. }
  1304. Promise.prototype["return"] =
  1305. Promise.prototype.thenReturn = function (value) {
  1306. if (value instanceof Promise) value.suppressUnhandledRejections();
  1307. return this._then(
  1308. returner, undefined, undefined, {value: value}, undefined);
  1309. };
  1310. Promise.prototype["throw"] =
  1311. Promise.prototype.thenThrow = function (reason) {
  1312. return this._then(
  1313. thrower, undefined, undefined, {reason: reason}, undefined);
  1314. };
  1315. Promise.prototype.catchThrow = function (reason) {
  1316. if (arguments.length <= 1) {
  1317. return this._then(
  1318. undefined, thrower, undefined, {reason: reason}, undefined);
  1319. } else {
  1320. var _reason = arguments[1];
  1321. var handler = function() {throw _reason;};
  1322. return this.caught(reason, handler);
  1323. }
  1324. };
  1325. Promise.prototype.catchReturn = function (value) {
  1326. if (arguments.length <= 1) {
  1327. if (value instanceof Promise) value.suppressUnhandledRejections();
  1328. return this._then(
  1329. undefined, returner, undefined, {value: value}, undefined);
  1330. } else {
  1331. var _value = arguments[1];
  1332. if (_value instanceof Promise) _value.suppressUnhandledRejections();
  1333. var handler = function() {return _value;};
  1334. return this.caught(value, handler);
  1335. }
  1336. };
  1337. };
  1338. },{}],9:[function(_dereq_,module,exports){
  1339. "use strict";
  1340. var es5 = _dereq_("./es5");
  1341. var Objectfreeze = es5.freeze;
  1342. var util = _dereq_("./util");
  1343. var inherits = util.inherits;
  1344. var notEnumerableProp = util.notEnumerableProp;
  1345. function subError(nameProperty, defaultMessage) {
  1346. function SubError(message) {
  1347. if (!(this instanceof SubError)) return new SubError(message);
  1348. notEnumerableProp(this, "message",
  1349. typeof message === "string" ? message : defaultMessage);
  1350. notEnumerableProp(this, "name", nameProperty);
  1351. if (Error.captureStackTrace) {
  1352. Error.captureStackTrace(this, this.constructor);
  1353. } else {
  1354. Error.call(this);
  1355. }
  1356. }
  1357. inherits(SubError, Error);
  1358. return SubError;
  1359. }
  1360. var _TypeError, _RangeError;
  1361. var Warning = subError("Warning", "warning");
  1362. var CancellationError = subError("CancellationError", "cancellation error");
  1363. var TimeoutError = subError("TimeoutError", "timeout error");
  1364. var AggregateError = subError("AggregateError", "aggregate error");
  1365. try {
  1366. _TypeError = TypeError;
  1367. _RangeError = RangeError;
  1368. } catch(e) {
  1369. _TypeError = subError("TypeError", "type error");
  1370. _RangeError = subError("RangeError", "range error");
  1371. }
  1372. var methods = ("join pop push shift unshift slice filter forEach some " +
  1373. "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
  1374. for (var i = 0; i < methods.length; ++i) {
  1375. if (typeof Array.prototype[methods[i]] === "function") {
  1376. AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
  1377. }
  1378. }
  1379. es5.defineProperty(AggregateError.prototype, "length", {
  1380. value: 0,
  1381. configurable: false,
  1382. writable: true,
  1383. enumerable: true
  1384. });
  1385. AggregateError.prototype["isOperational"] = true;
  1386. var level = 0;
  1387. AggregateError.prototype.toString = function() {
  1388. var indent = Array(level * 4 + 1).join(" ");
  1389. var ret = "\n" + indent + "AggregateError of:" + "\n";
  1390. level++;
  1391. indent = Array(level * 4 + 1).join(" ");
  1392. for (var i = 0; i < this.length; ++i) {
  1393. var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
  1394. var lines = str.split("\n");
  1395. for (var j = 0; j < lines.length; ++j) {
  1396. lines[j] = indent + lines[j];
  1397. }
  1398. str = lines.join("\n");
  1399. ret += str + "\n";
  1400. }
  1401. level--;
  1402. return ret;
  1403. };
  1404. function OperationalError(message) {
  1405. if (!(this instanceof OperationalError))
  1406. return new OperationalError(message);
  1407. notEnumerableProp(this, "name", "OperationalError");
  1408. notEnumerableProp(this, "message", message);
  1409. this.cause = message;
  1410. this["isOperational"] = true;
  1411. if (message instanceof Error) {
  1412. notEnumerableProp(this, "message", message.message);
  1413. notEnumerableProp(this, "stack", message.stack);
  1414. } else if (Error.captureStackTrace) {
  1415. Error.captureStackTrace(this, this.constructor);
  1416. }
  1417. }
  1418. inherits(OperationalError, Error);
  1419. var errorTypes = Error["__BluebirdErrorTypes__"];
  1420. if (!errorTypes) {
  1421. errorTypes = Objectfreeze({
  1422. CancellationError: CancellationError,
  1423. TimeoutError: TimeoutError,
  1424. OperationalError: OperationalError,
  1425. RejectionError: OperationalError,
  1426. AggregateError: AggregateError
  1427. });
  1428. es5.defineProperty(Error, "__BluebirdErrorTypes__", {
  1429. value: errorTypes,
  1430. writable: false,
  1431. enumerable: false,
  1432. configurable: false
  1433. });
  1434. }
  1435. module.exports = {
  1436. Error: Error,
  1437. TypeError: _TypeError,
  1438. RangeError: _RangeError,
  1439. CancellationError: errorTypes.CancellationError,
  1440. OperationalError: errorTypes.OperationalError,
  1441. TimeoutError: errorTypes.TimeoutError,
  1442. AggregateError: errorTypes.AggregateError,
  1443. Warning: Warning
  1444. };
  1445. },{"./es5":10,"./util":21}],10:[function(_dereq_,module,exports){
  1446. var isES5 = (function(){
  1447. "use strict";
  1448. return this === undefined;
  1449. })();
  1450. if (isES5) {
  1451. module.exports = {
  1452. freeze: Object.freeze,
  1453. defineProperty: Object.defineProperty,
  1454. getDescriptor: Object.getOwnPropertyDescriptor,
  1455. keys: Object.keys,
  1456. names: Object.getOwnPropertyNames,
  1457. getPrototypeOf: Object.getPrototypeOf,
  1458. isArray: Array.isArray,
  1459. isES5: isES5,
  1460. propertyIsWritable: function(obj, prop) {
  1461. var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
  1462. return !!(!descriptor || descriptor.writable || descriptor.set);
  1463. }
  1464. };
  1465. } else {
  1466. var has = {}.hasOwnProperty;
  1467. var str = {}.toString;
  1468. var proto = {}.constructor.prototype;
  1469. var ObjectKeys = function (o) {
  1470. var ret = [];
  1471. for (var key in o) {
  1472. if (has.call(o, key)) {
  1473. ret.push(key);
  1474. }
  1475. }
  1476. return ret;
  1477. };
  1478. var ObjectGetDescriptor = function(o, key) {
  1479. return {value: o[key]};
  1480. };
  1481. var ObjectDefineProperty = function (o, key, desc) {
  1482. o[key] = desc.value;
  1483. return o;
  1484. };
  1485. var ObjectFreeze = function (obj) {
  1486. return obj;
  1487. };
  1488. var ObjectGetPrototypeOf = function (obj) {
  1489. try {
  1490. return Object(obj).constructor.prototype;
  1491. }
  1492. catch (e) {
  1493. return proto;
  1494. }
  1495. };
  1496. var ArrayIsArray = function (obj) {
  1497. try {
  1498. return str.call(obj) === "[object Array]";
  1499. }
  1500. catch(e) {
  1501. return false;
  1502. }
  1503. };
  1504. module.exports = {
  1505. isArray: ArrayIsArray,
  1506. keys: ObjectKeys,
  1507. names: ObjectKeys,
  1508. defineProperty: ObjectDefineProperty,
  1509. getDescriptor: ObjectGetDescriptor,
  1510. freeze: ObjectFreeze,
  1511. getPrototypeOf: ObjectGetPrototypeOf,
  1512. isES5: isES5,
  1513. propertyIsWritable: function() {
  1514. return true;
  1515. }
  1516. };
  1517. }
  1518. },{}],11:[function(_dereq_,module,exports){
  1519. "use strict";
  1520. module.exports = function(Promise, tryConvertToPromise) {
  1521. var util = _dereq_("./util");
  1522. var CancellationError = Promise.CancellationError;
  1523. var errorObj = util.errorObj;
  1524. function PassThroughHandlerContext(promise, type, handler) {
  1525. this.promise = promise;
  1526. this.type = type;
  1527. this.handler = handler;
  1528. this.called = false;
  1529. this.cancelPromise = null;
  1530. }
  1531. PassThroughHandlerContext.prototype.isFinallyHandler = function() {
  1532. return this.type === 0;
  1533. };
  1534. function FinallyHandlerCancelReaction(finallyHandler) {
  1535. this.finallyHandler = finallyHandler;
  1536. }
  1537. FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
  1538. checkCancel(this.finallyHandler);
  1539. };
  1540. function checkCancel(ctx, reason) {
  1541. if (ctx.cancelPromise != null) {
  1542. if (arguments.length > 1) {
  1543. ctx.cancelPromise._reject(reason);
  1544. } else {
  1545. ctx.cancelPromise._cancel();
  1546. }
  1547. ctx.cancelPromise = null;
  1548. return true;
  1549. }
  1550. return false;
  1551. }
  1552. function succeed() {
  1553. return finallyHandler.call(this, this.promise._target()._settledValue());
  1554. }
  1555. function fail(reason) {
  1556. if (checkCancel(this, reason)) return;
  1557. errorObj.e = reason;
  1558. return errorObj;
  1559. }
  1560. function finallyHandler(reasonOrValue) {
  1561. var promise = this.promise;
  1562. var handler = this.handler;
  1563. if (!this.called) {
  1564. this.called = true;
  1565. var ret = this.isFinallyHandler()
  1566. ? handler.call(promise._boundValue())
  1567. : handler.call(promise._boundValue(), reasonOrValue);
  1568. if (ret !== undefined) {
  1569. promise._setReturnedNonUndefined();
  1570. var maybePromise = tryConvertToPromise(ret, promise);
  1571. if (maybePromise instanceof Promise) {
  1572. if (this.cancelPromise != null) {
  1573. if (maybePromise._isCancelled()) {
  1574. var reason =
  1575. new CancellationError("late cancellation observer");
  1576. promise._attachExtraTrace(reason);
  1577. errorObj.e = reason;
  1578. return errorObj;
  1579. } else if (maybePromise.isPending()) {
  1580. maybePromise._attachCancellationCallback(
  1581. new FinallyHandlerCancelReaction(this));
  1582. }
  1583. }
  1584. return maybePromise._then(
  1585. succeed, fail, undefined, this, undefined);
  1586. }
  1587. }
  1588. }
  1589. if (promise.isRejected()) {
  1590. checkCancel(this);
  1591. errorObj.e = reasonOrValue;
  1592. return errorObj;
  1593. } else {
  1594. checkCancel(this);
  1595. return reasonOrValue;
  1596. }
  1597. }
  1598. Promise.prototype._passThrough = function(handler, type, success, fail) {
  1599. if (typeof handler !== "function") return this.then();
  1600. return this._then(success,
  1601. fail,
  1602. undefined,
  1603. new PassThroughHandlerContext(this, type, handler),
  1604. undefined);
  1605. };
  1606. Promise.prototype.lastly =
  1607. Promise.prototype["finally"] = function (handler) {
  1608. return this._passThrough(handler,
  1609. 0,
  1610. finallyHandler,
  1611. finallyHandler);
  1612. };
  1613. Promise.prototype.tap = function (handler) {
  1614. return this._passThrough(handler, 1, finallyHandler);
  1615. };
  1616. return PassThroughHandlerContext;
  1617. };
  1618. },{"./util":21}],12:[function(_dereq_,module,exports){
  1619. "use strict";
  1620. module.exports =
  1621. function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,
  1622. getDomain) {
  1623. var util = _dereq_("./util");
  1624. var canEvaluate = util.canEvaluate;
  1625. var tryCatch = util.tryCatch;
  1626. var errorObj = util.errorObj;
  1627. var reject;
  1628. if (!true) {
  1629. if (canEvaluate) {
  1630. var thenCallback = function(i) {
  1631. return new Function("value", "holder", " \n\
  1632. 'use strict'; \n\
  1633. holder.pIndex = value; \n\
  1634. holder.checkFulfillment(this); \n\
  1635. ".replace(/Index/g, i));
  1636. };
  1637. var promiseSetter = function(i) {
  1638. return new Function("promise", "holder", " \n\
  1639. 'use strict'; \n\
  1640. holder.pIndex = promise; \n\
  1641. ".replace(/Index/g, i));
  1642. };
  1643. var generateHolderClass = function(total) {
  1644. var props = new Array(total);
  1645. for (var i = 0; i < props.length; ++i) {
  1646. props[i] = "this.p" + (i+1);
  1647. }
  1648. var assignment = props.join(" = ") + " = null;";
  1649. var cancellationCode= "var promise;\n" + props.map(function(prop) {
  1650. return " \n\
  1651. promise = " + prop + "; \n\
  1652. if (promise instanceof Promise) { \n\
  1653. promise.cancel(); \n\
  1654. } \n\
  1655. ";
  1656. }).join("\n");
  1657. var passedArguments = props.join(", ");
  1658. var name = "Holder$" + total;
  1659. var code = "return function(tryCatch, errorObj, Promise, async) { \n\
  1660. 'use strict'; \n\
  1661. function [TheName](fn) { \n\
  1662. [TheProperties] \n\
  1663. this.fn = fn; \n\
  1664. this.asyncNeeded = true; \n\
  1665. this.now = 0; \n\
  1666. } \n\
  1667. \n\
  1668. [TheName].prototype._callFunction = function(promise) { \n\
  1669. promise._pushContext(); \n\
  1670. var ret = tryCatch(this.fn)([ThePassedArguments]); \n\
  1671. promise._popContext(); \n\
  1672. if (ret === errorObj) { \n\
  1673. promise._rejectCallback(ret.e, false); \n\
  1674. } else { \n\
  1675. promise._resolveCallback(ret); \n\
  1676. } \n\
  1677. }; \n\
  1678. \n\
  1679. [TheName].prototype.checkFulfillment = function(promise) { \n\
  1680. var now = ++this.now; \n\
  1681. if (now === [TheTotal]) { \n\
  1682. if (this.asyncNeeded) { \n\
  1683. async.invoke(this._callFunction, this, promise); \n\
  1684. } else { \n\
  1685. this._callFunction(promise); \n\
  1686. } \n\
  1687. \n\
  1688. } \n\
  1689. }; \n\
  1690. \n\
  1691. [TheName].prototype._resultCancelled = function() { \n\
  1692. [CancellationCode] \n\
  1693. }; \n\
  1694. \n\
  1695. return [TheName]; \n\
  1696. }(tryCatch, errorObj, Promise, async); \n\
  1697. ";
  1698. code = code.replace(/\[TheName\]/g, name)
  1699. .replace(/\[TheTotal\]/g, total)
  1700. .replace(/\[ThePassedArguments\]/g, passedArguments)
  1701. .replace(/\[TheProperties\]/g, assignment)
  1702. .replace(/\[CancellationCode\]/g, cancellationCode);
  1703. return new Function("tryCatch", "errorObj", "Promise", "async", code)
  1704. (tryCatch, errorObj, Promise, async);
  1705. };
  1706. var holderClasses = [];
  1707. var thenCallbacks = [];
  1708. var promiseSetters = [];
  1709. for (var i = 0; i < 8; ++i) {
  1710. holderClasses.push(generateHolderClass(i + 1));
  1711. thenCallbacks.push(thenCallback(i + 1));
  1712. promiseSetters.push(promiseSetter(i + 1));
  1713. }
  1714. reject = function (reason) {
  1715. this._reject(reason);
  1716. };
  1717. }}
  1718. Promise.join = function () {
  1719. var last = arguments.length - 1;
  1720. var fn;
  1721. if (last > 0 && typeof arguments[last] === "function") {
  1722. fn = arguments[last];
  1723. if (!true) {
  1724. if (last <= 8 && canEvaluate) {
  1725. var ret = new Promise(INTERNAL);
  1726. ret._captureStackTrace();
  1727. var HolderClass = holderClasses[last - 1];
  1728. var holder = new HolderClass(fn);
  1729. var callbacks = thenCallbacks;
  1730. for (var i = 0; i < last; ++i) {
  1731. var maybePromise = tryConvertToPromise(arguments[i], ret);
  1732. if (maybePromise instanceof Promise) {
  1733. maybePromise = maybePromise._target();
  1734. var bitField = maybePromise._bitField;
  1735. ;
  1736. if (((bitField & 50397184) === 0)) {
  1737. maybePromise._then(callbacks[i], reject,
  1738. undefined, ret, holder);
  1739. promiseSetters[i](maybePromise, holder);
  1740. holder.asyncNeeded = false;
  1741. } else if (((bitField & 33554432) !== 0)) {
  1742. callbacks[i].call(ret,
  1743. maybePromise._value(), holder);
  1744. } else if (((bitField & 16777216) !== 0)) {
  1745. ret._reject(maybePromise._reason());
  1746. } else {
  1747. ret._cancel();
  1748. }
  1749. } else {
  1750. callbacks[i].call(ret, maybePromise, holder);
  1751. }
  1752. }
  1753. if (!ret._isFateSealed()) {
  1754. if (holder.asyncNeeded) {
  1755. var domain = getDomain();
  1756. if (domain !== null) {
  1757. holder.fn = util.domainBind(domain, holder.fn);
  1758. }
  1759. }
  1760. ret._setAsyncGuaranteed();
  1761. ret._setOnCancel(holder);
  1762. }
  1763. return ret;
  1764. }
  1765. }
  1766. }
  1767. var args = [].slice.call(arguments);;
  1768. if (fn) args.pop();
  1769. var ret = new PromiseArray(args).promise();
  1770. return fn !== undefined ? ret.spread(fn) : ret;
  1771. };
  1772. };
  1773. },{"./util":21}],13:[function(_dereq_,module,exports){
  1774. "use strict";
  1775. module.exports =
  1776. function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
  1777. var util = _dereq_("./util");
  1778. var tryCatch = util.tryCatch;
  1779. Promise.method = function (fn) {
  1780. if (typeof fn !== "function") {
  1781. throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
  1782. }
  1783. return function () {
  1784. var ret = new Promise(INTERNAL);
  1785. ret._captureStackTrace();
  1786. ret._pushContext();
  1787. var value = tryCatch(fn).apply(this, arguments);
  1788. var promiseCreated = ret._popContext();
  1789. debug.checkForgottenReturns(
  1790. value, promiseCreated, "Promise.method", ret);
  1791. ret._resolveFromSyncValue(value);
  1792. return ret;
  1793. };
  1794. };
  1795. Promise.attempt = Promise["try"] = function (fn) {
  1796. if (typeof fn !== "function") {
  1797. return apiRejection("expecting a function but got " + util.classString(fn));
  1798. }
  1799. var ret = new Promise(INTERNAL);
  1800. ret._captureStackTrace();
  1801. ret._pushContext();
  1802. var value;
  1803. if (arguments.length > 1) {
  1804. debug.deprecated("calling Promise.try with more than 1 argument");
  1805. var arg = arguments[1];
  1806. var ctx = arguments[2];
  1807. value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
  1808. : tryCatch(fn).call(ctx, arg);
  1809. } else {
  1810. value = tryCatch(fn)();
  1811. }
  1812. var promiseCreated = ret._popContext();
  1813. debug.checkForgottenReturns(
  1814. value, promiseCreated, "Promise.try", ret);
  1815. ret._resolveFromSyncValue(value);
  1816. return ret;
  1817. };
  1818. Promise.prototype._resolveFromSyncValue = function (value) {
  1819. if (value === util.errorObj) {
  1820. this._rejectCallback(value.e, false);
  1821. } else {
  1822. this._resolveCallback(value, true);
  1823. }
  1824. };
  1825. };
  1826. },{"./util":21}],14:[function(_dereq_,module,exports){
  1827. "use strict";
  1828. var util = _dereq_("./util");
  1829. var maybeWrapAsError = util.maybeWrapAsError;
  1830. var errors = _dereq_("./errors");
  1831. var OperationalError = errors.OperationalError;
  1832. var es5 = _dereq_("./es5");
  1833. function isUntypedError(obj) {
  1834. return obj instanceof Error &&
  1835. es5.getPrototypeOf(obj) === Error.prototype;
  1836. }
  1837. var rErrorKey = /^(?:name|message|stack|cause)$/;
  1838. function wrapAsOperationalError(obj) {
  1839. var ret;
  1840. if (isUntypedError(obj)) {
  1841. ret = new OperationalError(obj);
  1842. ret.name = obj.name;
  1843. ret.message = obj.message;
  1844. ret.stack = obj.stack;
  1845. var keys = es5.keys(obj);
  1846. for (var i = 0; i < keys.length; ++i) {
  1847. var key = keys[i];
  1848. if (!rErrorKey.test(key)) {
  1849. ret[key] = obj[key];
  1850. }
  1851. }
  1852. return ret;
  1853. }
  1854. util.markAsOriginatingFromRejection(obj);
  1855. return obj;
  1856. }
  1857. function nodebackForPromise(promise, multiArgs) {
  1858. return function(err, value) {
  1859. if (promise === null) return;
  1860. if (err) {
  1861. var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
  1862. promise._attachExtraTrace(wrapped);
  1863. promise._reject(wrapped);
  1864. } else if (!multiArgs) {
  1865. promise._fulfill(value);
  1866. } else {
  1867. var args = [].slice.call(arguments, 1);;
  1868. promise._fulfill(args);
  1869. }
  1870. promise = null;
  1871. };
  1872. }
  1873. module.exports = nodebackForPromise;
  1874. },{"./errors":9,"./es5":10,"./util":21}],15:[function(_dereq_,module,exports){
  1875. "use strict";
  1876. module.exports = function() {
  1877. var makeSelfResolutionError = function () {
  1878. return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  1879. };
  1880. var reflectHandler = function() {
  1881. return new Promise.PromiseInspection(this._target());
  1882. };
  1883. var apiRejection = function(msg) {
  1884. return Promise.reject(new TypeError(msg));
  1885. };
  1886. function Proxyable() {}
  1887. var UNDEFINED_BINDING = {};
  1888. var util = _dereq_("./util");
  1889. var getDomain;
  1890. if (util.isNode) {
  1891. getDomain = function() {
  1892. var ret = process.domain;
  1893. if (ret === undefined) ret = null;
  1894. return ret;
  1895. };
  1896. } else {
  1897. getDomain = function() {
  1898. return null;
  1899. };
  1900. }
  1901. util.notEnumerableProp(Promise, "_getDomain", getDomain);
  1902. var es5 = _dereq_("./es5");
  1903. var Async = _dereq_("./async");
  1904. var async = new Async();
  1905. es5.defineProperty(Promise, "_async", {value: async});
  1906. var errors = _dereq_("./errors");
  1907. var TypeError = Promise.TypeError = errors.TypeError;
  1908. Promise.RangeError = errors.RangeError;
  1909. var CancellationError = Promise.CancellationError = errors.CancellationError;
  1910. Promise.TimeoutError = errors.TimeoutError;
  1911. Promise.OperationalError = errors.OperationalError;
  1912. Promise.RejectionError = errors.OperationalError;
  1913. Promise.AggregateError = errors.AggregateError;
  1914. var INTERNAL = function(){};
  1915. var APPLY = {};
  1916. var NEXT_FILTER = {};
  1917. var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL);
  1918. var PromiseArray =
  1919. _dereq_("./promise_array")(Promise, INTERNAL,
  1920. tryConvertToPromise, apiRejection, Proxyable);
  1921. var Context = _dereq_("./context")(Promise);
  1922. /*jshint unused:false*/
  1923. var createContext = Context.create;
  1924. var debug = _dereq_("./debuggability")(Promise, Context);
  1925. var CapturedTrace = debug.CapturedTrace;
  1926. var PassThroughHandlerContext =
  1927. _dereq_("./finally")(Promise, tryConvertToPromise);
  1928. var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER);
  1929. var nodebackForPromise = _dereq_("./nodeback");
  1930. var errorObj = util.errorObj;
  1931. var tryCatch = util.tryCatch;
  1932. function check(self, executor) {
  1933. if (typeof executor !== "function") {
  1934. throw new TypeError("expecting a function but got " + util.classString(executor));
  1935. }
  1936. if (self.constructor !== Promise) {
  1937. throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  1938. }
  1939. }
  1940. function Promise(executor) {
  1941. this._bitField = 0;
  1942. this._fulfillmentHandler0 = undefined;
  1943. this._rejectionHandler0 = undefined;
  1944. this._promise0 = undefined;
  1945. this._receiver0 = undefined;
  1946. if (executor !== INTERNAL) {
  1947. check(this, executor);
  1948. this._resolveFromExecutor(executor);
  1949. }
  1950. this._promiseCreated();
  1951. this._fireEvent("promiseCreated", this);
  1952. }
  1953. Promise.prototype.toString = function () {
  1954. return "[object Promise]";
  1955. };
  1956. Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
  1957. var len = arguments.length;
  1958. if (len > 1) {
  1959. var catchInstances = new Array(len - 1),
  1960. j = 0, i;
  1961. for (i = 0; i < len - 1; ++i) {
  1962. var item = arguments[i];
  1963. if (util.isObject(item)) {
  1964. catchInstances[j++] = item;
  1965. } else {
  1966. return apiRejection("expecting an object but got " +
  1967. "A catch statement predicate " + util.classString(item));
  1968. }
  1969. }
  1970. catchInstances.length = j;
  1971. fn = arguments[i];
  1972. return this.then(undefined, catchFilter(catchInstances, fn, this));
  1973. }
  1974. return this.then(undefined, fn);
  1975. };
  1976. Promise.prototype.reflect = function () {
  1977. return this._then(reflectHandler,
  1978. reflectHandler, undefined, this, undefined);
  1979. };
  1980. Promise.prototype.then = function (didFulfill, didReject) {
  1981. if (debug.warnings() && arguments.length > 0 &&
  1982. typeof didFulfill !== "function" &&
  1983. typeof didReject !== "function") {
  1984. var msg = ".then() only accepts functions but was passed: " +
  1985. util.classString(didFulfill);
  1986. if (arguments.length > 1) {
  1987. msg += ", " + util.classString(didReject);
  1988. }
  1989. this._warn(msg);
  1990. }
  1991. return this._then(didFulfill, didReject, undefined, undefined, undefined);
  1992. };
  1993. Promise.prototype.done = function (didFulfill, didReject) {
  1994. var promise =
  1995. this._then(didFulfill, didReject, undefined, undefined, undefined);
  1996. promise._setIsFinal();
  1997. };
  1998. Promise.prototype.spread = function (fn) {
  1999. if (typeof fn !== "function") {
  2000. return apiRejection("expecting a function but got " + util.classString(fn));
  2001. }
  2002. return this.all()._then(fn, undefined, undefined, APPLY, undefined);
  2003. };
  2004. Promise.prototype.toJSON = function () {
  2005. var ret = {
  2006. isFulfilled: false,
  2007. isRejected: false,
  2008. fulfillmentValue: undefined,
  2009. rejectionReason: undefined
  2010. };
  2011. if (this.isFulfilled()) {
  2012. ret.fulfillmentValue = this.value();
  2013. ret.isFulfilled = true;
  2014. } else if (this.isRejected()) {
  2015. ret.rejectionReason = this.reason();
  2016. ret.isRejected = true;
  2017. }
  2018. return ret;
  2019. };
  2020. Promise.prototype.all = function () {
  2021. if (arguments.length > 0) {
  2022. this._warn(".all() was passed arguments but it does not take any");
  2023. }
  2024. return new PromiseArray(this).promise();
  2025. };
  2026. Promise.prototype.error = function (fn) {
  2027. return this.caught(util.originatesFromRejection, fn);
  2028. };
  2029. Promise.getNewLibraryCopy = module.exports;
  2030. Promise.is = function (val) {
  2031. return val instanceof Promise;
  2032. };
  2033. Promise.fromNode = Promise.fromCallback = function(fn) {
  2034. var ret = new Promise(INTERNAL);
  2035. ret._captureStackTrace();
  2036. var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
  2037. : false;
  2038. var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
  2039. if (result === errorObj) {
  2040. ret._rejectCallback(result.e, true);
  2041. }
  2042. if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
  2043. return ret;
  2044. };
  2045. Promise.all = function (promises) {
  2046. return new PromiseArray(promises).promise();
  2047. };
  2048. Promise.cast = function (obj) {
  2049. var ret = tryConvertToPromise(obj);
  2050. if (!(ret instanceof Promise)) {
  2051. ret = new Promise(INTERNAL);
  2052. ret._captureStackTrace();
  2053. ret._setFulfilled();
  2054. ret._rejectionHandler0 = obj;
  2055. }
  2056. return ret;
  2057. };
  2058. Promise.resolve = Promise.fulfilled = Promise.cast;
  2059. Promise.reject = Promise.rejected = function (reason) {
  2060. var ret = new Promise(INTERNAL);
  2061. ret._captureStackTrace();
  2062. ret._rejectCallback(reason, true);
  2063. return ret;
  2064. };
  2065. Promise.setScheduler = function(fn) {
  2066. if (typeof fn !== "function") {
  2067. throw new TypeError("expecting a function but got " + util.classString(fn));
  2068. }
  2069. return async.setScheduler(fn);
  2070. };
  2071. Promise.prototype._then = function (
  2072. didFulfill,
  2073. didReject,
  2074. _, receiver,
  2075. internalData
  2076. ) {
  2077. var haveInternalData = internalData !== undefined;
  2078. var promise = haveInternalData ? internalData : new Promise(INTERNAL);
  2079. var target = this._target();
  2080. var bitField = target._bitField;
  2081. if (!haveInternalData) {
  2082. promise._propagateFrom(this, 3);
  2083. promise._captureStackTrace();
  2084. if (receiver === undefined &&
  2085. ((this._bitField & 2097152) !== 0)) {
  2086. if (!((bitField & 50397184) === 0)) {
  2087. receiver = this._boundValue();
  2088. } else {
  2089. receiver = target === this ? undefined : this._boundTo;
  2090. }
  2091. }
  2092. this._fireEvent("promiseChained", this, promise);
  2093. }
  2094. var domain = getDomain();
  2095. if (!((bitField & 50397184) === 0)) {
  2096. var handler, value, settler = target._settlePromiseCtx;
  2097. if (((bitField & 33554432) !== 0)) {
  2098. value = target._rejectionHandler0;
  2099. handler = didFulfill;
  2100. } else if (((bitField & 16777216) !== 0)) {
  2101. value = target._fulfillmentHandler0;
  2102. handler = didReject;
  2103. target._unsetRejectionIsUnhandled();
  2104. } else {
  2105. settler = target._settlePromiseLateCancellationObserver;
  2106. value = new CancellationError("late cancellation observer");
  2107. target._attachExtraTrace(value);
  2108. handler = didReject;
  2109. }
  2110. async.invoke(settler, target, {
  2111. handler: domain === null ? handler
  2112. : (typeof handler === "function" &&
  2113. util.domainBind(domain, handler)),
  2114. promise: promise,
  2115. receiver: receiver,
  2116. value: value
  2117. });
  2118. } else {
  2119. target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
  2120. }
  2121. return promise;
  2122. };
  2123. Promise.prototype._length = function () {
  2124. return this._bitField & 65535;
  2125. };
  2126. Promise.prototype._isFateSealed = function () {
  2127. return (this._bitField & 117506048) !== 0;
  2128. };
  2129. Promise.prototype._isFollowing = function () {
  2130. return (this._bitField & 67108864) === 67108864;
  2131. };
  2132. Promise.prototype._setLength = function (len) {
  2133. this._bitField = (this._bitField & -65536) |
  2134. (len & 65535);
  2135. };
  2136. Promise.prototype._setFulfilled = function () {
  2137. this._bitField = this._bitField | 33554432;
  2138. this._fireEvent("promiseFulfilled", this);
  2139. };
  2140. Promise.prototype._setRejected = function () {
  2141. this._bitField = this._bitField | 16777216;
  2142. this._fireEvent("promiseRejected", this);
  2143. };
  2144. Promise.prototype._setFollowing = function () {
  2145. this._bitField = this._bitField | 67108864;
  2146. this._fireEvent("promiseResolved", this);
  2147. };
  2148. Promise.prototype._setIsFinal = function () {
  2149. this._bitField = this._bitField | 4194304;
  2150. };
  2151. Promise.prototype._isFinal = function () {
  2152. return (this._bitField & 4194304) > 0;
  2153. };
  2154. Promise.prototype._unsetCancelled = function() {
  2155. this._bitField = this._bitField & (~65536);
  2156. };
  2157. Promise.prototype._setCancelled = function() {
  2158. this._bitField = this._bitField | 65536;
  2159. this._fireEvent("promiseCancelled", this);
  2160. };
  2161. Promise.prototype._setWillBeCancelled = function() {
  2162. this._bitField = this._bitField | 8388608;
  2163. };
  2164. Promise.prototype._setAsyncGuaranteed = function() {
  2165. if (async.hasCustomScheduler()) return;
  2166. this._bitField = this._bitField | 134217728;
  2167. };
  2168. Promise.prototype._receiverAt = function (index) {
  2169. var ret = index === 0 ? this._receiver0 : this[
  2170. index * 4 - 4 + 3];
  2171. if (ret === UNDEFINED_BINDING) {
  2172. return undefined;
  2173. } else if (ret === undefined && this._isBound()) {
  2174. return this._boundValue();
  2175. }
  2176. return ret;
  2177. };
  2178. Promise.prototype._promiseAt = function (index) {
  2179. return this[
  2180. index * 4 - 4 + 2];
  2181. };
  2182. Promise.prototype._fulfillmentHandlerAt = function (index) {
  2183. return this[
  2184. index * 4 - 4 + 0];
  2185. };
  2186. Promise.prototype._rejectionHandlerAt = function (index) {
  2187. return this[
  2188. index * 4 - 4 + 1];
  2189. };
  2190. Promise.prototype._boundValue = function() {};
  2191. Promise.prototype._migrateCallback0 = function (follower) {
  2192. var bitField = follower._bitField;
  2193. var fulfill = follower._fulfillmentHandler0;
  2194. var reject = follower._rejectionHandler0;
  2195. var promise = follower._promise0;
  2196. var receiver = follower._receiverAt(0);
  2197. if (receiver === undefined) receiver = UNDEFINED_BINDING;
  2198. this._addCallbacks(fulfill, reject, promise, receiver, null);
  2199. };
  2200. Promise.prototype._migrateCallbackAt = function (follower, index) {
  2201. var fulfill = follower._fulfillmentHandlerAt(index);
  2202. var reject = follower._rejectionHandlerAt(index);
  2203. var promise = follower._promiseAt(index);
  2204. var receiver = follower._receiverAt(index);
  2205. if (receiver === undefined) receiver = UNDEFINED_BINDING;
  2206. this._addCallbacks(fulfill, reject, promise, receiver, null);
  2207. };
  2208. Promise.prototype._addCallbacks = function (
  2209. fulfill,
  2210. reject,
  2211. promise,
  2212. receiver,
  2213. domain
  2214. ) {
  2215. var index = this._length();
  2216. if (index >= 65535 - 4) {
  2217. index = 0;
  2218. this._setLength(0);
  2219. }
  2220. if (index === 0) {
  2221. this._promise0 = promise;
  2222. this._receiver0 = receiver;
  2223. if (typeof fulfill === "function") {
  2224. this._fulfillmentHandler0 =
  2225. domain === null ? fulfill : util.domainBind(domain, fulfill);
  2226. }
  2227. if (typeof reject === "function") {
  2228. this._rejectionHandler0 =
  2229. domain === null ? reject : util.domainBind(domain, reject);
  2230. }
  2231. } else {
  2232. var base = index * 4 - 4;
  2233. this[base + 2] = promise;
  2234. this[base + 3] = receiver;
  2235. if (typeof fulfill === "function") {
  2236. this[base + 0] =
  2237. domain === null ? fulfill : util.domainBind(domain, fulfill);
  2238. }
  2239. if (typeof reject === "function") {
  2240. this[base + 1] =
  2241. domain === null ? reject : util.domainBind(domain, reject);
  2242. }
  2243. }
  2244. this._setLength(index + 1);
  2245. return index;
  2246. };
  2247. Promise.prototype._proxy = function (proxyable, arg) {
  2248. this._addCallbacks(undefined, undefined, arg, proxyable, null);
  2249. };
  2250. Promise.prototype._resolveCallback = function(value, shouldBind) {
  2251. if (((this._bitField & 117506048) !== 0)) return;
  2252. if (value === this)
  2253. return this._rejectCallback(makeSelfResolutionError(), false);
  2254. var maybePromise = tryConvertToPromise(value, this);
  2255. if (!(maybePromise instanceof Promise)) return this._fulfill(value);
  2256. if (shouldBind) this._propagateFrom(maybePromise, 2);
  2257. var promise = maybePromise._target();
  2258. if (promise === this) {
  2259. this._reject(makeSelfResolutionError());
  2260. return;
  2261. }
  2262. var bitField = promise._bitField;
  2263. if (((bitField & 50397184) === 0)) {
  2264. var len = this._length();
  2265. if (len > 0) promise._migrateCallback0(this);
  2266. for (var i = 1; i < len; ++i) {
  2267. promise._migrateCallbackAt(this, i);
  2268. }
  2269. this._setFollowing();
  2270. this._setLength(0);
  2271. this._setFollowee(promise);
  2272. } else if (((bitField & 33554432) !== 0)) {
  2273. this._fulfill(promise._value());
  2274. } else if (((bitField & 16777216) !== 0)) {
  2275. this._reject(promise._reason());
  2276. } else {
  2277. var reason = new CancellationError("late cancellation observer");
  2278. promise._attachExtraTrace(reason);
  2279. this._reject(reason);
  2280. }
  2281. };
  2282. Promise.prototype._rejectCallback =
  2283. function(reason, synchronous, ignoreNonErrorWarnings) {
  2284. var trace = util.ensureErrorObject(reason);
  2285. var hasStack = trace === reason;
  2286. if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
  2287. var message = "a promise was rejected with a non-error: " +
  2288. util.classString(reason);
  2289. this._warn(message, true);
  2290. }
  2291. this._attachExtraTrace(trace, synchronous ? hasStack : false);
  2292. this._reject(reason);
  2293. };
  2294. Promise.prototype._resolveFromExecutor = function (executor) {
  2295. var promise = this;
  2296. this._captureStackTrace();
  2297. this._pushContext();
  2298. var synchronous = true;
  2299. var r = this._execute(executor, function(value) {
  2300. promise._resolveCallback(value);
  2301. }, function (reason) {
  2302. promise._rejectCallback(reason, synchronous);
  2303. });
  2304. synchronous = false;
  2305. this._popContext();
  2306. if (r !== undefined) {
  2307. promise._rejectCallback(r, true);
  2308. }
  2309. };
  2310. Promise.prototype._settlePromiseFromHandler = function (
  2311. handler, receiver, value, promise
  2312. ) {
  2313. var bitField = promise._bitField;
  2314. if (((bitField & 65536) !== 0)) return;
  2315. promise._pushContext();
  2316. var x;
  2317. if (receiver === APPLY) {
  2318. if (!value || typeof value.length !== "number") {
  2319. x = errorObj;
  2320. x.e = new TypeError("cannot .spread() a non-array: " +
  2321. util.classString(value));
  2322. } else {
  2323. x = tryCatch(handler).apply(this._boundValue(), value);
  2324. }
  2325. } else {
  2326. x = tryCatch(handler).call(receiver, value);
  2327. }
  2328. var promiseCreated = promise._popContext();
  2329. bitField = promise._bitField;
  2330. if (((bitField & 65536) !== 0)) return;
  2331. if (x === NEXT_FILTER) {
  2332. promise._reject(value);
  2333. } else if (x === errorObj) {
  2334. promise._rejectCallback(x.e, false);
  2335. } else {
  2336. debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
  2337. promise._resolveCallback(x);
  2338. }
  2339. };
  2340. Promise.prototype._target = function() {
  2341. var ret = this;
  2342. while (ret._isFollowing()) ret = ret._followee();
  2343. return ret;
  2344. };
  2345. Promise.prototype._followee = function() {
  2346. return this._rejectionHandler0;
  2347. };
  2348. Promise.prototype._setFollowee = function(promise) {
  2349. this._rejectionHandler0 = promise;
  2350. };
  2351. Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
  2352. var isPromise = promise instanceof Promise;
  2353. var bitField = this._bitField;
  2354. var asyncGuaranteed = ((bitField & 134217728) !== 0);
  2355. if (((bitField & 65536) !== 0)) {
  2356. if (isPromise) promise._invokeInternalOnCancel();
  2357. if (receiver instanceof PassThroughHandlerContext &&
  2358. receiver.isFinallyHandler()) {
  2359. receiver.cancelPromise = promise;
  2360. if (tryCatch(handler).call(receiver, value) === errorObj) {
  2361. promise._reject(errorObj.e);
  2362. }
  2363. } else if (handler === reflectHandler) {
  2364. promise._fulfill(reflectHandler.call(receiver));
  2365. } else if (receiver instanceof Proxyable) {
  2366. receiver._promiseCancelled(promise);
  2367. } else if (isPromise || promise instanceof PromiseArray) {
  2368. promise._cancel();
  2369. } else {
  2370. receiver.cancel();
  2371. }
  2372. } else if (typeof handler === "function") {
  2373. if (!isPromise) {
  2374. handler.call(receiver, value, promise);
  2375. } else {
  2376. if (asyncGuaranteed) promise._setAsyncGuaranteed();
  2377. this._settlePromiseFromHandler(handler, receiver, value, promise);
  2378. }
  2379. } else if (receiver instanceof Proxyable) {
  2380. if (!receiver._isResolved()) {
  2381. if (((bitField & 33554432) !== 0)) {
  2382. receiver._promiseFulfilled(value, promise);
  2383. } else {
  2384. receiver._promiseRejected(value, promise);
  2385. }
  2386. }
  2387. } else if (isPromise) {
  2388. if (asyncGuaranteed) promise._setAsyncGuaranteed();
  2389. if (((bitField & 33554432) !== 0)) {
  2390. promise._fulfill(value);
  2391. } else {
  2392. promise._reject(value);
  2393. }
  2394. }
  2395. };
  2396. Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
  2397. var handler = ctx.handler;
  2398. var promise = ctx.promise;
  2399. var receiver = ctx.receiver;
  2400. var value = ctx.value;
  2401. if (typeof handler === "function") {
  2402. if (!(promise instanceof Promise)) {
  2403. handler.call(receiver, value, promise);
  2404. } else {
  2405. this._settlePromiseFromHandler(handler, receiver, value, promise);
  2406. }
  2407. } else if (promise instanceof Promise) {
  2408. promise._reject(value);
  2409. }
  2410. };
  2411. Promise.prototype._settlePromiseCtx = function(ctx) {
  2412. this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
  2413. };
  2414. Promise.prototype._settlePromise0 = function(handler, value, bitField) {
  2415. var promise = this._promise0;
  2416. var receiver = this._receiverAt(0);
  2417. this._promise0 = undefined;
  2418. this._receiver0 = undefined;
  2419. this._settlePromise(promise, handler, receiver, value);
  2420. };
  2421. Promise.prototype._clearCallbackDataAtIndex = function(index) {
  2422. var base = index * 4 - 4;
  2423. this[base + 2] =
  2424. this[base + 3] =
  2425. this[base + 0] =
  2426. this[base + 1] = undefined;
  2427. };
  2428. Promise.prototype._fulfill = function (value) {
  2429. var bitField = this._bitField;
  2430. if (((bitField & 117506048) >>> 16)) return;
  2431. if (value === this) {
  2432. var err = makeSelfResolutionError();
  2433. this._attachExtraTrace(err);
  2434. return this._reject(err);
  2435. }
  2436. this._setFulfilled();
  2437. this._rejectionHandler0 = value;
  2438. if ((bitField & 65535) > 0) {
  2439. if (((bitField & 134217728) !== 0)) {
  2440. this._settlePromises();
  2441. } else {
  2442. async.settlePromises(this);
  2443. }
  2444. }
  2445. };
  2446. Promise.prototype._reject = function (reason) {
  2447. var bitField = this._bitField;
  2448. if (((bitField & 117506048) >>> 16)) return;
  2449. this._setRejected();
  2450. this._fulfillmentHandler0 = reason;
  2451. if (this._isFinal()) {
  2452. return async.fatalError(reason, util.isNode);
  2453. }
  2454. if ((bitField & 65535) > 0) {
  2455. async.settlePromises(this);
  2456. } else {
  2457. this._ensurePossibleRejectionHandled();
  2458. }
  2459. };
  2460. Promise.prototype._fulfillPromises = function (len, value) {
  2461. for (var i = 1; i < len; i++) {
  2462. var handler = this._fulfillmentHandlerAt(i);
  2463. var promise = this._promiseAt(i);
  2464. var receiver = this._receiverAt(i);
  2465. this._clearCallbackDataAtIndex(i);
  2466. this._settlePromise(promise, handler, receiver, value);
  2467. }
  2468. };
  2469. Promise.prototype._rejectPromises = function (len, reason) {
  2470. for (var i = 1; i < len; i++) {
  2471. var handler = this._rejectionHandlerAt(i);
  2472. var promise = this._promiseAt(i);
  2473. var receiver = this._receiverAt(i);
  2474. this._clearCallbackDataAtIndex(i);
  2475. this._settlePromise(promise, handler, receiver, reason);
  2476. }
  2477. };
  2478. Promise.prototype._settlePromises = function () {
  2479. var bitField = this._bitField;
  2480. var len = (bitField & 65535);
  2481. if (len > 0) {
  2482. if (((bitField & 16842752) !== 0)) {
  2483. var reason = this._fulfillmentHandler0;
  2484. this._settlePromise0(this._rejectionHandler0, reason, bitField);
  2485. this._rejectPromises(len, reason);
  2486. } else {
  2487. var value = this._rejectionHandler0;
  2488. this._settlePromise0(this._fulfillmentHandler0, value, bitField);
  2489. this._fulfillPromises(len, value);
  2490. }
  2491. this._setLength(0);
  2492. }
  2493. this._clearCancellationData();
  2494. };
  2495. Promise.prototype._settledValue = function() {
  2496. var bitField = this._bitField;
  2497. if (((bitField & 33554432) !== 0)) {
  2498. return this._rejectionHandler0;
  2499. } else if (((bitField & 16777216) !== 0)) {
  2500. return this._fulfillmentHandler0;
  2501. }
  2502. };
  2503. function deferResolve(v) {this.promise._resolveCallback(v);}
  2504. function deferReject(v) {this.promise._rejectCallback(v, false);}
  2505. Promise.defer = Promise.pending = function() {
  2506. debug.deprecated("Promise.defer", "new Promise");
  2507. var promise = new Promise(INTERNAL);
  2508. return {
  2509. promise: promise,
  2510. resolve: deferResolve,
  2511. reject: deferReject
  2512. };
  2513. };
  2514. util.notEnumerableProp(Promise,
  2515. "_makeSelfResolutionError",
  2516. makeSelfResolutionError);
  2517. _dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection,
  2518. debug);
  2519. _dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug);
  2520. _dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug);
  2521. _dereq_("./direct_resolve")(Promise);
  2522. _dereq_("./synchronous_inspection")(Promise);
  2523. _dereq_("./join")(
  2524. Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
  2525. Promise.Promise = Promise;
  2526. Promise.version = "3.4.6";
  2527. util.toFastProperties(Promise);
  2528. util.toFastProperties(Promise.prototype);
  2529. function fillTypes(value) {
  2530. var p = new Promise(INTERNAL);
  2531. p._fulfillmentHandler0 = value;
  2532. p._rejectionHandler0 = value;
  2533. p._promise0 = value;
  2534. p._receiver0 = value;
  2535. }
  2536. // Complete slack tracking, opt out of field-type tracking and
  2537. // stabilize map
  2538. fillTypes({a: 1});
  2539. fillTypes({b: 2});
  2540. fillTypes({c: 3});
  2541. fillTypes(1);
  2542. fillTypes(function(){});
  2543. fillTypes(undefined);
  2544. fillTypes(false);
  2545. fillTypes(new Promise(INTERNAL));
  2546. debug.setBounds(Async.firstLineError, util.lastLineError);
  2547. return Promise;
  2548. };
  2549. },{"./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){
  2550. "use strict";
  2551. module.exports = function(Promise, INTERNAL, tryConvertToPromise,
  2552. apiRejection, Proxyable) {
  2553. var util = _dereq_("./util");
  2554. var isArray = util.isArray;
  2555. function toResolutionValue(val) {
  2556. switch(val) {
  2557. case -2: return [];
  2558. case -3: return {};
  2559. }
  2560. }
  2561. function PromiseArray(values) {
  2562. var promise = this._promise = new Promise(INTERNAL);
  2563. if (values instanceof Promise) {
  2564. promise._propagateFrom(values, 3);
  2565. }
  2566. promise._setOnCancel(this);
  2567. this._values = values;
  2568. this._length = 0;
  2569. this._totalResolved = 0;
  2570. this._init(undefined, -2);
  2571. }
  2572. util.inherits(PromiseArray, Proxyable);
  2573. PromiseArray.prototype.length = function () {
  2574. return this._length;
  2575. };
  2576. PromiseArray.prototype.promise = function () {
  2577. return this._promise;
  2578. };
  2579. PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
  2580. var values = tryConvertToPromise(this._values, this._promise);
  2581. if (values instanceof Promise) {
  2582. values = values._target();
  2583. var bitField = values._bitField;
  2584. ;
  2585. this._values = values;
  2586. if (((bitField & 50397184) === 0)) {
  2587. this._promise._setAsyncGuaranteed();
  2588. return values._then(
  2589. init,
  2590. this._reject,
  2591. undefined,
  2592. this,
  2593. resolveValueIfEmpty
  2594. );
  2595. } else if (((bitField & 33554432) !== 0)) {
  2596. values = values._value();
  2597. } else if (((bitField & 16777216) !== 0)) {
  2598. return this._reject(values._reason());
  2599. } else {
  2600. return this._cancel();
  2601. }
  2602. }
  2603. values = util.asArray(values);
  2604. if (values === null) {
  2605. var err = apiRejection(
  2606. "expecting an array or an iterable object but got " + util.classString(values)).reason();
  2607. this._promise._rejectCallback(err, false);
  2608. return;
  2609. }
  2610. if (values.length === 0) {
  2611. if (resolveValueIfEmpty === -5) {
  2612. this._resolveEmptyArray();
  2613. }
  2614. else {
  2615. this._resolve(toResolutionValue(resolveValueIfEmpty));
  2616. }
  2617. return;
  2618. }
  2619. this._iterate(values);
  2620. };
  2621. PromiseArray.prototype._iterate = function(values) {
  2622. var len = this.getActualLength(values.length);
  2623. this._length = len;
  2624. this._values = this.shouldCopyValues() ? new Array(len) : this._values;
  2625. var result = this._promise;
  2626. var isResolved = false;
  2627. var bitField = null;
  2628. for (var i = 0; i < len; ++i) {
  2629. var maybePromise = tryConvertToPromise(values[i], result);
  2630. if (maybePromise instanceof Promise) {
  2631. maybePromise = maybePromise._target();
  2632. bitField = maybePromise._bitField;
  2633. } else {
  2634. bitField = null;
  2635. }
  2636. if (isResolved) {
  2637. if (bitField !== null) {
  2638. maybePromise.suppressUnhandledRejections();
  2639. }
  2640. } else if (bitField !== null) {
  2641. if (((bitField & 50397184) === 0)) {
  2642. maybePromise._proxy(this, i);
  2643. this._values[i] = maybePromise;
  2644. } else if (((bitField & 33554432) !== 0)) {
  2645. isResolved = this._promiseFulfilled(maybePromise._value(), i);
  2646. } else if (((bitField & 16777216) !== 0)) {
  2647. isResolved = this._promiseRejected(maybePromise._reason(), i);
  2648. } else {
  2649. isResolved = this._promiseCancelled(i);
  2650. }
  2651. } else {
  2652. isResolved = this._promiseFulfilled(maybePromise, i);
  2653. }
  2654. }
  2655. if (!isResolved) result._setAsyncGuaranteed();
  2656. };
  2657. PromiseArray.prototype._isResolved = function () {
  2658. return this._values === null;
  2659. };
  2660. PromiseArray.prototype._resolve = function (value) {
  2661. this._values = null;
  2662. this._promise._fulfill(value);
  2663. };
  2664. PromiseArray.prototype._cancel = function() {
  2665. if (this._isResolved() || !this._promise._isCancellable()) return;
  2666. this._values = null;
  2667. this._promise._cancel();
  2668. };
  2669. PromiseArray.prototype._reject = function (reason) {
  2670. this._values = null;
  2671. this._promise._rejectCallback(reason, false);
  2672. };
  2673. PromiseArray.prototype._promiseFulfilled = function (value, index) {
  2674. this._values[index] = value;
  2675. var totalResolved = ++this._totalResolved;
  2676. if (totalResolved >= this._length) {
  2677. this._resolve(this._values);
  2678. return true;
  2679. }
  2680. return false;
  2681. };
  2682. PromiseArray.prototype._promiseCancelled = function() {
  2683. this._cancel();
  2684. return true;
  2685. };
  2686. PromiseArray.prototype._promiseRejected = function (reason) {
  2687. this._totalResolved++;
  2688. this._reject(reason);
  2689. return true;
  2690. };
  2691. PromiseArray.prototype._resultCancelled = function() {
  2692. if (this._isResolved()) return;
  2693. var values = this._values;
  2694. this._cancel();
  2695. if (values instanceof Promise) {
  2696. values.cancel();
  2697. } else {
  2698. for (var i = 0; i < values.length; ++i) {
  2699. if (values[i] instanceof Promise) {
  2700. values[i].cancel();
  2701. }
  2702. }
  2703. }
  2704. };
  2705. PromiseArray.prototype.shouldCopyValues = function () {
  2706. return true;
  2707. };
  2708. PromiseArray.prototype.getActualLength = function (len) {
  2709. return len;
  2710. };
  2711. return PromiseArray;
  2712. };
  2713. },{"./util":21}],17:[function(_dereq_,module,exports){
  2714. "use strict";
  2715. function arrayMove(src, srcIndex, dst, dstIndex, len) {
  2716. for (var j = 0; j < len; ++j) {
  2717. dst[j + dstIndex] = src[j + srcIndex];
  2718. src[j + srcIndex] = void 0;
  2719. }
  2720. }
  2721. function Queue(capacity) {
  2722. this._capacity = capacity;
  2723. this._length = 0;
  2724. this._front = 0;
  2725. }
  2726. Queue.prototype._willBeOverCapacity = function (size) {
  2727. return this._capacity < size;
  2728. };
  2729. Queue.prototype._pushOne = function (arg) {
  2730. var length = this.length();
  2731. this._checkCapacity(length + 1);
  2732. var i = (this._front + length) & (this._capacity - 1);
  2733. this[i] = arg;
  2734. this._length = length + 1;
  2735. };
  2736. Queue.prototype._unshiftOne = function(value) {
  2737. var capacity = this._capacity;
  2738. this._checkCapacity(this.length() + 1);
  2739. var front = this._front;
  2740. var i = (((( front - 1 ) &
  2741. ( capacity - 1) ) ^ capacity ) - capacity );
  2742. this[i] = value;
  2743. this._front = i;
  2744. this._length = this.length() + 1;
  2745. };
  2746. Queue.prototype.unshift = function(fn, receiver, arg) {
  2747. this._unshiftOne(arg);
  2748. this._unshiftOne(receiver);
  2749. this._unshiftOne(fn);
  2750. };
  2751. Queue.prototype.push = function (fn, receiver, arg) {
  2752. var length = this.length() + 3;
  2753. if (this._willBeOverCapacity(length)) {
  2754. this._pushOne(fn);
  2755. this._pushOne(receiver);
  2756. this._pushOne(arg);
  2757. return;
  2758. }
  2759. var j = this._front + length - 3;
  2760. this._checkCapacity(length);
  2761. var wrapMask = this._capacity - 1;
  2762. this[(j + 0) & wrapMask] = fn;
  2763. this[(j + 1) & wrapMask] = receiver;
  2764. this[(j + 2) & wrapMask] = arg;
  2765. this._length = length;
  2766. };
  2767. Queue.prototype.shift = function () {
  2768. var front = this._front,
  2769. ret = this[front];
  2770. this[front] = undefined;
  2771. this._front = (front + 1) & (this._capacity - 1);
  2772. this._length--;
  2773. return ret;
  2774. };
  2775. Queue.prototype.length = function () {
  2776. return this._length;
  2777. };
  2778. Queue.prototype._checkCapacity = function (size) {
  2779. if (this._capacity < size) {
  2780. this._resizeTo(this._capacity << 1);
  2781. }
  2782. };
  2783. Queue.prototype._resizeTo = function (capacity) {
  2784. var oldCapacity = this._capacity;
  2785. this._capacity = capacity;
  2786. var front = this._front;
  2787. var length = this._length;
  2788. var moveItemsCount = (front + length) & (oldCapacity - 1);
  2789. arrayMove(this, 0, this, oldCapacity, moveItemsCount);
  2790. };
  2791. module.exports = Queue;
  2792. },{}],18:[function(_dereq_,module,exports){
  2793. "use strict";
  2794. var util = _dereq_("./util");
  2795. var schedule;
  2796. var noAsyncScheduler = function() {
  2797. throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  2798. };
  2799. var NativePromise = util.getNativePromise();
  2800. if (util.isNode && typeof MutationObserver === "undefined") {
  2801. var GlobalSetImmediate = global.setImmediate;
  2802. var ProcessNextTick = process.nextTick;
  2803. schedule = util.isRecentNode
  2804. ? function(fn) { GlobalSetImmediate.call(global, fn); }
  2805. : function(fn) { ProcessNextTick.call(process, fn); };
  2806. } else if (typeof NativePromise === "function" &&
  2807. typeof NativePromise.resolve === "function") {
  2808. var nativePromise = NativePromise.resolve();
  2809. schedule = function(fn) {
  2810. nativePromise.then(fn);
  2811. };
  2812. } else if ((typeof MutationObserver !== "undefined") &&
  2813. !(typeof window !== "undefined" &&
  2814. window.navigator &&
  2815. (window.navigator.standalone || window.cordova))) {
  2816. schedule = (function() {
  2817. var div = document.createElement("div");
  2818. var opts = {attributes: true};
  2819. var toggleScheduled = false;
  2820. var div2 = document.createElement("div");
  2821. var o2 = new MutationObserver(function() {
  2822. div.classList.toggle("foo");
  2823. toggleScheduled = false;
  2824. });
  2825. o2.observe(div2, opts);
  2826. var scheduleToggle = function() {
  2827. if (toggleScheduled) return;
  2828. toggleScheduled = true;
  2829. div2.classList.toggle("foo");
  2830. };
  2831. return function schedule(fn) {
  2832. var o = new MutationObserver(function() {
  2833. o.disconnect();
  2834. fn();
  2835. });
  2836. o.observe(div, opts);
  2837. scheduleToggle();
  2838. };
  2839. })();
  2840. } else if (typeof setImmediate !== "undefined") {
  2841. schedule = function (fn) {
  2842. setImmediate(fn);
  2843. };
  2844. } else if (typeof setTimeout !== "undefined") {
  2845. schedule = function (fn) {
  2846. setTimeout(fn, 0);
  2847. };
  2848. } else {
  2849. schedule = noAsyncScheduler;
  2850. }
  2851. module.exports = schedule;
  2852. },{"./util":21}],19:[function(_dereq_,module,exports){
  2853. "use strict";
  2854. module.exports = function(Promise) {
  2855. function PromiseInspection(promise) {
  2856. if (promise !== undefined) {
  2857. promise = promise._target();
  2858. this._bitField = promise._bitField;
  2859. this._settledValueField = promise._isFateSealed()
  2860. ? promise._settledValue() : undefined;
  2861. }
  2862. else {
  2863. this._bitField = 0;
  2864. this._settledValueField = undefined;
  2865. }
  2866. }
  2867. PromiseInspection.prototype._settledValue = function() {
  2868. return this._settledValueField;
  2869. };
  2870. var value = PromiseInspection.prototype.value = function () {
  2871. if (!this.isFulfilled()) {
  2872. throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  2873. }
  2874. return this._settledValue();
  2875. };
  2876. var reason = PromiseInspection.prototype.error =
  2877. PromiseInspection.prototype.reason = function () {
  2878. if (!this.isRejected()) {
  2879. throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  2880. }
  2881. return this._settledValue();
  2882. };
  2883. var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
  2884. return (this._bitField & 33554432) !== 0;
  2885. };
  2886. var isRejected = PromiseInspection.prototype.isRejected = function () {
  2887. return (this._bitField & 16777216) !== 0;
  2888. };
  2889. var isPending = PromiseInspection.prototype.isPending = function () {
  2890. return (this._bitField & 50397184) === 0;
  2891. };
  2892. var isResolved = PromiseInspection.prototype.isResolved = function () {
  2893. return (this._bitField & 50331648) !== 0;
  2894. };
  2895. PromiseInspection.prototype.isCancelled = function() {
  2896. return (this._bitField & 8454144) !== 0;
  2897. };
  2898. Promise.prototype.__isCancelled = function() {
  2899. return (this._bitField & 65536) === 65536;
  2900. };
  2901. Promise.prototype._isCancelled = function() {
  2902. return this._target().__isCancelled();
  2903. };
  2904. Promise.prototype.isCancelled = function() {
  2905. return (this._target()._bitField & 8454144) !== 0;
  2906. };
  2907. Promise.prototype.isPending = function() {
  2908. return isPending.call(this._target());
  2909. };
  2910. Promise.prototype.isRejected = function() {
  2911. return isRejected.call(this._target());
  2912. };
  2913. Promise.prototype.isFulfilled = function() {
  2914. return isFulfilled.call(this._target());
  2915. };
  2916. Promise.prototype.isResolved = function() {
  2917. return isResolved.call(this._target());
  2918. };
  2919. Promise.prototype.value = function() {
  2920. return value.call(this._target());
  2921. };
  2922. Promise.prototype.reason = function() {
  2923. var target = this._target();
  2924. target._unsetRejectionIsUnhandled();
  2925. return reason.call(target);
  2926. };
  2927. Promise.prototype._value = function() {
  2928. return this._settledValue();
  2929. };
  2930. Promise.prototype._reason = function() {
  2931. this._unsetRejectionIsUnhandled();
  2932. return this._settledValue();
  2933. };
  2934. Promise.PromiseInspection = PromiseInspection;
  2935. };
  2936. },{}],20:[function(_dereq_,module,exports){
  2937. "use strict";
  2938. module.exports = function(Promise, INTERNAL) {
  2939. var util = _dereq_("./util");
  2940. var errorObj = util.errorObj;
  2941. var isObject = util.isObject;
  2942. function tryConvertToPromise(obj, context) {
  2943. if (isObject(obj)) {
  2944. if (obj instanceof Promise) return obj;
  2945. var then = getThen(obj);
  2946. if (then === errorObj) {
  2947. if (context) context._pushContext();
  2948. var ret = Promise.reject(then.e);
  2949. if (context) context._popContext();
  2950. return ret;
  2951. } else if (typeof then === "function") {
  2952. if (isAnyBluebirdPromise(obj)) {
  2953. var ret = new Promise(INTERNAL);
  2954. obj._then(
  2955. ret._fulfill,
  2956. ret._reject,
  2957. undefined,
  2958. ret,
  2959. null
  2960. );
  2961. return ret;
  2962. }
  2963. return doThenable(obj, then, context);
  2964. }
  2965. }
  2966. return obj;
  2967. }
  2968. function doGetThen(obj) {
  2969. return obj.then;
  2970. }
  2971. function getThen(obj) {
  2972. try {
  2973. return doGetThen(obj);
  2974. } catch (e) {
  2975. errorObj.e = e;
  2976. return errorObj;
  2977. }
  2978. }
  2979. var hasProp = {}.hasOwnProperty;
  2980. function isAnyBluebirdPromise(obj) {
  2981. try {
  2982. return hasProp.call(obj, "_promise0");
  2983. } catch (e) {
  2984. return false;
  2985. }
  2986. }
  2987. function doThenable(x, then, context) {
  2988. var promise = new Promise(INTERNAL);
  2989. var ret = promise;
  2990. if (context) context._pushContext();
  2991. promise._captureStackTrace();
  2992. if (context) context._popContext();
  2993. var synchronous = true;
  2994. var result = util.tryCatch(then).call(x, resolve, reject);
  2995. synchronous = false;
  2996. if (promise && result === errorObj) {
  2997. promise._rejectCallback(result.e, true, true);
  2998. promise = null;
  2999. }
  3000. function resolve(value) {
  3001. if (!promise) return;
  3002. promise._resolveCallback(value);
  3003. promise = null;
  3004. }
  3005. function reject(reason) {
  3006. if (!promise) return;
  3007. promise._rejectCallback(reason, synchronous, true);
  3008. promise = null;
  3009. }
  3010. return ret;
  3011. }
  3012. return tryConvertToPromise;
  3013. };
  3014. },{"./util":21}],21:[function(_dereq_,module,exports){
  3015. "use strict";
  3016. var es5 = _dereq_("./es5");
  3017. var canEvaluate = typeof navigator == "undefined";
  3018. var errorObj = {e: {}};
  3019. var tryCatchTarget;
  3020. var globalObject = typeof self !== "undefined" ? self :
  3021. typeof window !== "undefined" ? window :
  3022. typeof global !== "undefined" ? global :
  3023. this !== undefined ? this : null;
  3024. function tryCatcher() {
  3025. try {
  3026. var target = tryCatchTarget;
  3027. tryCatchTarget = null;
  3028. return target.apply(this, arguments);
  3029. } catch (e) {
  3030. errorObj.e = e;
  3031. return errorObj;
  3032. }
  3033. }
  3034. function tryCatch(fn) {
  3035. tryCatchTarget = fn;
  3036. return tryCatcher;
  3037. }
  3038. var inherits = function(Child, Parent) {
  3039. var hasProp = {}.hasOwnProperty;
  3040. function T() {
  3041. this.constructor = Child;
  3042. this.constructor$ = Parent;
  3043. for (var propertyName in Parent.prototype) {
  3044. if (hasProp.call(Parent.prototype, propertyName) &&
  3045. propertyName.charAt(propertyName.length-1) !== "$"
  3046. ) {
  3047. this[propertyName + "$"] = Parent.prototype[propertyName];
  3048. }
  3049. }
  3050. }
  3051. T.prototype = Parent.prototype;
  3052. Child.prototype = new T();
  3053. return Child.prototype;
  3054. };
  3055. function isPrimitive(val) {
  3056. return val == null || val === true || val === false ||
  3057. typeof val === "string" || typeof val === "number";
  3058. }
  3059. function isObject(value) {
  3060. return typeof value === "function" ||
  3061. typeof value === "object" && value !== null;
  3062. }
  3063. function maybeWrapAsError(maybeError) {
  3064. if (!isPrimitive(maybeError)) return maybeError;
  3065. return new Error(safeToString(maybeError));
  3066. }
  3067. function withAppended(target, appendee) {
  3068. var len = target.length;
  3069. var ret = new Array(len + 1);
  3070. var i;
  3071. for (i = 0; i < len; ++i) {
  3072. ret[i] = target[i];
  3073. }
  3074. ret[i] = appendee;
  3075. return ret;
  3076. }
  3077. function getDataPropertyOrDefault(obj, key, defaultValue) {
  3078. if (es5.isES5) {
  3079. var desc = Object.getOwnPropertyDescriptor(obj, key);
  3080. if (desc != null) {
  3081. return desc.get == null && desc.set == null
  3082. ? desc.value
  3083. : defaultValue;
  3084. }
  3085. } else {
  3086. return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
  3087. }
  3088. }
  3089. function notEnumerableProp(obj, name, value) {
  3090. if (isPrimitive(obj)) return obj;
  3091. var descriptor = {
  3092. value: value,
  3093. configurable: true,
  3094. enumerable: false,
  3095. writable: true
  3096. };
  3097. es5.defineProperty(obj, name, descriptor);
  3098. return obj;
  3099. }
  3100. function thrower(r) {
  3101. throw r;
  3102. }
  3103. var inheritedDataKeys = (function() {
  3104. var excludedPrototypes = [
  3105. Array.prototype,
  3106. Object.prototype,
  3107. Function.prototype
  3108. ];
  3109. var isExcludedProto = function(val) {
  3110. for (var i = 0; i < excludedPrototypes.length; ++i) {
  3111. if (excludedPrototypes[i] === val) {
  3112. return true;
  3113. }
  3114. }
  3115. return false;
  3116. };
  3117. if (es5.isES5) {
  3118. var getKeys = Object.getOwnPropertyNames;
  3119. return function(obj) {
  3120. var ret = [];
  3121. var visitedKeys = Object.create(null);
  3122. while (obj != null && !isExcludedProto(obj)) {
  3123. var keys;
  3124. try {
  3125. keys = getKeys(obj);
  3126. } catch (e) {
  3127. return ret;
  3128. }
  3129. for (var i = 0; i < keys.length; ++i) {
  3130. var key = keys[i];
  3131. if (visitedKeys[key]) continue;
  3132. visitedKeys[key] = true;
  3133. var desc = Object.getOwnPropertyDescriptor(obj, key);
  3134. if (desc != null && desc.get == null && desc.set == null) {
  3135. ret.push(key);
  3136. }
  3137. }
  3138. obj = es5.getPrototypeOf(obj);
  3139. }
  3140. return ret;
  3141. };
  3142. } else {
  3143. var hasProp = {}.hasOwnProperty;
  3144. return function(obj) {
  3145. if (isExcludedProto(obj)) return [];
  3146. var ret = [];
  3147. /*jshint forin:false */
  3148. enumeration: for (var key in obj) {
  3149. if (hasProp.call(obj, key)) {
  3150. ret.push(key);
  3151. } else {
  3152. for (var i = 0; i < excludedPrototypes.length; ++i) {
  3153. if (hasProp.call(excludedPrototypes[i], key)) {
  3154. continue enumeration;
  3155. }
  3156. }
  3157. ret.push(key);
  3158. }
  3159. }
  3160. return ret;
  3161. };
  3162. }
  3163. })();
  3164. var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
  3165. function isClass(fn) {
  3166. try {
  3167. if (typeof fn === "function") {
  3168. var keys = es5.names(fn.prototype);
  3169. var hasMethods = es5.isES5 && keys.length > 1;
  3170. var hasMethodsOtherThanConstructor = keys.length > 0 &&
  3171. !(keys.length === 1 && keys[0] === "constructor");
  3172. var hasThisAssignmentAndStaticMethods =
  3173. thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
  3174. if (hasMethods || hasMethodsOtherThanConstructor ||
  3175. hasThisAssignmentAndStaticMethods) {
  3176. return true;
  3177. }
  3178. }
  3179. return false;
  3180. } catch (e) {
  3181. return false;
  3182. }
  3183. }
  3184. function toFastProperties(obj) {
  3185. /*jshint -W027,-W055,-W031*/
  3186. function FakeConstructor() {}
  3187. FakeConstructor.prototype = obj;
  3188. var l = 8;
  3189. while (l--) new FakeConstructor();
  3190. return obj;
  3191. eval(obj);
  3192. }
  3193. var rident = /^[a-z$_][a-z$_0-9]*$/i;
  3194. function isIdentifier(str) {
  3195. return rident.test(str);
  3196. }
  3197. function filledRange(count, prefix, suffix) {
  3198. var ret = new Array(count);
  3199. for(var i = 0; i < count; ++i) {
  3200. ret[i] = prefix + i + suffix;
  3201. }
  3202. return ret;
  3203. }
  3204. function safeToString(obj) {
  3205. try {
  3206. return obj + "";
  3207. } catch (e) {
  3208. return "[no string representation]";
  3209. }
  3210. }
  3211. function isError(obj) {
  3212. return obj !== null &&
  3213. typeof obj === "object" &&
  3214. typeof obj.message === "string" &&
  3215. typeof obj.name === "string";
  3216. }
  3217. function markAsOriginatingFromRejection(e) {
  3218. try {
  3219. notEnumerableProp(e, "isOperational", true);
  3220. }
  3221. catch(ignore) {}
  3222. }
  3223. function originatesFromRejection(e) {
  3224. if (e == null) return false;
  3225. return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
  3226. e["isOperational"] === true);
  3227. }
  3228. function canAttachTrace(obj) {
  3229. return isError(obj) && es5.propertyIsWritable(obj, "stack");
  3230. }
  3231. var ensureErrorObject = (function() {
  3232. if (!("stack" in new Error())) {
  3233. return function(value) {
  3234. if (canAttachTrace(value)) return value;
  3235. try {throw new Error(safeToString(value));}
  3236. catch(err) {return err;}
  3237. };
  3238. } else {
  3239. return function(value) {
  3240. if (canAttachTrace(value)) return value;
  3241. return new Error(safeToString(value));
  3242. };
  3243. }
  3244. })();
  3245. function classString(obj) {
  3246. return {}.toString.call(obj);
  3247. }
  3248. function copyDescriptors(from, to, filter) {
  3249. var keys = es5.names(from);
  3250. for (var i = 0; i < keys.length; ++i) {
  3251. var key = keys[i];
  3252. if (filter(key)) {
  3253. try {
  3254. es5.defineProperty(to, key, es5.getDescriptor(from, key));
  3255. } catch (ignore) {}
  3256. }
  3257. }
  3258. }
  3259. var asArray = function(v) {
  3260. if (es5.isArray(v)) {
  3261. return v;
  3262. }
  3263. return null;
  3264. };
  3265. if (typeof Symbol !== "undefined" && Symbol.iterator) {
  3266. var ArrayFrom = typeof Array.from === "function" ? function(v) {
  3267. return Array.from(v);
  3268. } : function(v) {
  3269. var ret = [];
  3270. var it = v[Symbol.iterator]();
  3271. var itResult;
  3272. while (!((itResult = it.next()).done)) {
  3273. ret.push(itResult.value);
  3274. }
  3275. return ret;
  3276. };
  3277. asArray = function(v) {
  3278. if (es5.isArray(v)) {
  3279. return v;
  3280. } else if (v != null && typeof v[Symbol.iterator] === "function") {
  3281. return ArrayFrom(v);
  3282. }
  3283. return null;
  3284. };
  3285. }
  3286. var isNode = typeof process !== "undefined" &&
  3287. classString(process).toLowerCase() === "[object process]";
  3288. function env(key, def) {
  3289. return isNode ? process.env[key] : def;
  3290. }
  3291. function getNativePromise() {
  3292. if (typeof Promise === "function") {
  3293. try {
  3294. var promise = new Promise(function(){});
  3295. if ({}.toString.call(promise) === "[object Promise]") {
  3296. return Promise;
  3297. }
  3298. } catch (e) {}
  3299. }
  3300. }
  3301. function domainBind(self, cb) {
  3302. return self.bind(cb);
  3303. }
  3304. var ret = {
  3305. isClass: isClass,
  3306. isIdentifier: isIdentifier,
  3307. inheritedDataKeys: inheritedDataKeys,
  3308. getDataPropertyOrDefault: getDataPropertyOrDefault,
  3309. thrower: thrower,
  3310. isArray: es5.isArray,
  3311. asArray: asArray,
  3312. notEnumerableProp: notEnumerableProp,
  3313. isPrimitive: isPrimitive,
  3314. isObject: isObject,
  3315. isError: isError,
  3316. canEvaluate: canEvaluate,
  3317. errorObj: errorObj,
  3318. tryCatch: tryCatch,
  3319. inherits: inherits,
  3320. withAppended: withAppended,
  3321. maybeWrapAsError: maybeWrapAsError,
  3322. toFastProperties: toFastProperties,
  3323. filledRange: filledRange,
  3324. toString: safeToString,
  3325. canAttachTrace: canAttachTrace,
  3326. ensureErrorObject: ensureErrorObject,
  3327. originatesFromRejection: originatesFromRejection,
  3328. markAsOriginatingFromRejection: markAsOriginatingFromRejection,
  3329. classString: classString,
  3330. copyDescriptors: copyDescriptors,
  3331. hasDevTools: typeof chrome !== "undefined" && chrome &&
  3332. typeof chrome.loadTimes === "function",
  3333. isNode: isNode,
  3334. env: env,
  3335. global: globalObject,
  3336. getNativePromise: getNativePromise,
  3337. domainBind: domainBind
  3338. };
  3339. ret.isRecentNode = ret.isNode && (function() {
  3340. var version = process.versions.node.split(".").map(Number);
  3341. return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
  3342. })();
  3343. if (ret.isNode) ret.toFastProperties(process);
  3344. try {throw new Error(); } catch (e) {ret.lastLineError = e;}
  3345. module.exports = ret;
  3346. },{"./es5":10}]},{},[3])(3)
  3347. }); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }
  3348. /*
  3349. RequireJS 2.2.0 Copyright jQuery Foundation and other contributors.
  3350. Released under MIT license, http://github.com/requirejs/requirejs/LICENSE
  3351. */
  3352. var requirejs,require,define;
  3353. (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"!==
  3354. 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["*"];
  3355. 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)&&
  3356. (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,
  3357. 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,
  3358. 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];
  3359. 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&&
  3360. (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",
  3361. 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?
  3362. 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&&
  3363. (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():
  3364. 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!==
  3365. 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);
  3366. 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)})||
  3367. ""),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===
  3368. 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,
  3369. 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);
  3370. 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=
  3371. 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&&
  3372. (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",
  3373. "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,
  3374. 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;
  3375. 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("/"),
  3376. 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=[];
  3377. 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,
  3378. 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||
  3379. 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",
  3380. "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||
  3381. {},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(){},
  3382. 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&&
  3383. (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);
  3384. 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"]}});
  3385. define('text',{});
  3386. define('aurelia-dependency-injection',['exports', 'aurelia-metadata', 'aurelia-pal'], function (exports, _aureliaMetadata, _aureliaPal) {
  3387. 'use strict';
  3388. Object.defineProperty(exports, "__esModule", {
  3389. value: true
  3390. });
  3391. 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;
  3392. exports.getDecoratorDependencies = getDecoratorDependencies;
  3393. exports.lazy = lazy;
  3394. exports.all = all;
  3395. exports.optional = optional;
  3396. exports.parent = parent;
  3397. exports.factory = factory;
  3398. exports.newInstance = newInstance;
  3399. exports.invoker = invoker;
  3400. exports.factory = factory;
  3401. exports.registration = registration;
  3402. exports.transient = transient;
  3403. exports.singleton = singleton;
  3404. exports.autoinject = autoinject;
  3405. exports.inject = inject;
  3406. var _dec, _class, _dec2, _class3, _dec3, _class5, _dec4, _class7, _dec5, _class9, _dec6, _class11, _dec7, _class13, _classInvokers;
  3407. var resolver = exports.resolver = _aureliaMetadata.protocol.create('aurelia:resolver', function (target) {
  3408. if (!(typeof target.get === 'function')) {
  3409. return 'Resolvers must implement: get(container: Container, key: any): any';
  3410. }
  3411. return true;
  3412. });
  3413. var Lazy = exports.Lazy = (_dec = resolver(), _dec(_class = function () {
  3414. function Lazy(key) {
  3415. this._key = key;
  3416. }
  3417. Lazy.prototype.get = function get(container) {
  3418. var _this = this;
  3419. return function () {
  3420. return container.get(_this._key);
  3421. };
  3422. };
  3423. Lazy.of = function of(key) {
  3424. return new Lazy(key);
  3425. };
  3426. return Lazy;
  3427. }()) || _class);
  3428. var All = exports.All = (_dec2 = resolver(), _dec2(_class3 = function () {
  3429. function All(key) {
  3430. this._key = key;
  3431. }
  3432. All.prototype.get = function get(container) {
  3433. return container.getAll(this._key);
  3434. };
  3435. All.of = function of(key) {
  3436. return new All(key);
  3437. };
  3438. return All;
  3439. }()) || _class3);
  3440. var Optional = exports.Optional = (_dec3 = resolver(), _dec3(_class5 = function () {
  3441. function Optional(key) {
  3442. var checkParent = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
  3443. this._key = key;
  3444. this._checkParent = checkParent;
  3445. }
  3446. Optional.prototype.get = function get(container) {
  3447. if (container.hasResolver(this._key, this._checkParent)) {
  3448. return container.get(this._key);
  3449. }
  3450. return null;
  3451. };
  3452. Optional.of = function of(key) {
  3453. var checkParent = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
  3454. return new Optional(key, checkParent);
  3455. };
  3456. return Optional;
  3457. }()) || _class5);
  3458. var Parent = exports.Parent = (_dec4 = resolver(), _dec4(_class7 = function () {
  3459. function Parent(key) {
  3460. this._key = key;
  3461. }
  3462. Parent.prototype.get = function get(container) {
  3463. return container.parent ? container.parent.get(this._key) : null;
  3464. };
  3465. Parent.of = function of(key) {
  3466. return new Parent(key);
  3467. };
  3468. return Parent;
  3469. }()) || _class7);
  3470. var StrategyResolver = exports.StrategyResolver = (_dec5 = resolver(), _dec5(_class9 = function () {
  3471. function StrategyResolver(strategy, state) {
  3472. this.strategy = strategy;
  3473. this.state = state;
  3474. }
  3475. StrategyResolver.prototype.get = function get(container, key) {
  3476. switch (this.strategy) {
  3477. case 0:
  3478. return this.state;
  3479. case 1:
  3480. var singleton = container.invoke(this.state);
  3481. this.state = singleton;
  3482. this.strategy = 0;
  3483. return singleton;
  3484. case 2:
  3485. return container.invoke(this.state);
  3486. case 3:
  3487. return this.state(container, key, this);
  3488. case 4:
  3489. return this.state[0].get(container, key);
  3490. case 5:
  3491. return container.get(this.state);
  3492. default:
  3493. throw new Error('Invalid strategy: ' + this.strategy);
  3494. }
  3495. };
  3496. return StrategyResolver;
  3497. }()) || _class9);
  3498. var Factory = exports.Factory = (_dec6 = resolver(), _dec6(_class11 = function () {
  3499. function Factory(key) {
  3500. this._key = key;
  3501. }
  3502. Factory.prototype.get = function get(container) {
  3503. var _this2 = this;
  3504. return function () {
  3505. for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
  3506. rest[_key] = arguments[_key];
  3507. }
  3508. return container.invoke(_this2._key, rest);
  3509. };
  3510. };
  3511. Factory.of = function of(key) {
  3512. return new Factory(key);
  3513. };
  3514. return Factory;
  3515. }()) || _class11);
  3516. var NewInstance = exports.NewInstance = (_dec7 = resolver(), _dec7(_class13 = function () {
  3517. function NewInstance(key) {
  3518. this.key = key;
  3519. this.asKey = key;
  3520. }
  3521. NewInstance.prototype.get = function get(container) {
  3522. var instance = container.invoke(this.key);
  3523. container.registerInstance(this.asKey, instance);
  3524. return instance;
  3525. };
  3526. NewInstance.prototype.as = function as(key) {
  3527. this.asKey = key;
  3528. return this;
  3529. };
  3530. NewInstance.of = function of(key) {
  3531. return new NewInstance(key);
  3532. };
  3533. return NewInstance;
  3534. }()) || _class13);
  3535. function getDecoratorDependencies(target, name) {
  3536. var dependencies = target.inject;
  3537. if (typeof dependencies === 'function') {
  3538. throw new Error('Decorator ' + name + ' cannot be used with "inject()". Please use an array instead.');
  3539. }
  3540. if (!dependencies) {
  3541. dependencies = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, target).slice();
  3542. target.inject = dependencies;
  3543. }
  3544. return dependencies;
  3545. }
  3546. function lazy(keyValue) {
  3547. return function (target, key, index) {
  3548. var params = getDecoratorDependencies(target, 'lazy');
  3549. params[index] = Lazy.of(keyValue);
  3550. };
  3551. }
  3552. function all(keyValue) {
  3553. return function (target, key, index) {
  3554. var params = getDecoratorDependencies(target, 'all');
  3555. params[index] = All.of(keyValue);
  3556. };
  3557. }
  3558. function optional() {
  3559. var checkParentOrTarget = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
  3560. var deco = function deco(checkParent) {
  3561. return function (target, key, index) {
  3562. var params = getDecoratorDependencies(target, 'optional');
  3563. params[index] = Optional.of(params[index], checkParent);
  3564. };
  3565. };
  3566. if (typeof checkParentOrTarget === 'boolean') {
  3567. return deco(checkParentOrTarget);
  3568. }
  3569. return deco(true);
  3570. }
  3571. function parent(target, key, index) {
  3572. var params = getDecoratorDependencies(target, 'parent');
  3573. params[index] = Parent.of(params[index]);
  3574. }
  3575. function factory(keyValue, asValue) {
  3576. return function (target, key, index) {
  3577. var params = getDecoratorDependencies(target, 'factory');
  3578. var factory = Factory.of(keyValue);
  3579. params[index] = asValue ? factory.as(asValue) : factory;
  3580. };
  3581. }
  3582. function newInstance(asKeyOrTarget) {
  3583. var deco = function deco(asKey) {
  3584. return function (target, key, index) {
  3585. var params = getDecoratorDependencies(target, 'newInstance');
  3586. params[index] = NewInstance.of(params[index]);
  3587. if (!!asKey) {
  3588. params[index].as(asKey);
  3589. }
  3590. };
  3591. };
  3592. if (arguments.length === 1) {
  3593. return deco(asKeyOrTarget);
  3594. }
  3595. return deco();
  3596. }
  3597. function invoker(value) {
  3598. return function (target) {
  3599. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.invoker, value, target);
  3600. };
  3601. }
  3602. function factory(potentialTarget) {
  3603. var deco = function deco(target) {
  3604. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.invoker, FactoryInvoker.instance, target);
  3605. };
  3606. return potentialTarget ? deco(potentialTarget) : deco;
  3607. }
  3608. var FactoryInvoker = exports.FactoryInvoker = function () {
  3609. function FactoryInvoker() {
  3610. }
  3611. FactoryInvoker.prototype.invoke = function invoke(container, fn, dependencies) {
  3612. var i = dependencies.length;
  3613. var args = new Array(i);
  3614. while (i--) {
  3615. args[i] = container.get(dependencies[i]);
  3616. }
  3617. return fn.apply(undefined, args);
  3618. };
  3619. FactoryInvoker.prototype.invokeWithDynamicDependencies = function invokeWithDynamicDependencies(container, fn, staticDependencies, dynamicDependencies) {
  3620. var i = staticDependencies.length;
  3621. var args = new Array(i);
  3622. while (i--) {
  3623. args[i] = container.get(staticDependencies[i]);
  3624. }
  3625. if (dynamicDependencies !== undefined) {
  3626. args = args.concat(dynamicDependencies);
  3627. }
  3628. return fn.apply(undefined, args);
  3629. };
  3630. return FactoryInvoker;
  3631. }();
  3632. FactoryInvoker.instance = new FactoryInvoker();
  3633. function registration(value) {
  3634. return function (target) {
  3635. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.registration, value, target);
  3636. };
  3637. }
  3638. function transient(key) {
  3639. return registration(new TransientRegistration(key));
  3640. }
  3641. function singleton(keyOrRegisterInChild) {
  3642. var registerInChild = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
  3643. return registration(new SingletonRegistration(keyOrRegisterInChild, registerInChild));
  3644. }
  3645. var TransientRegistration = exports.TransientRegistration = function () {
  3646. function TransientRegistration(key) {
  3647. this._key = key;
  3648. }
  3649. TransientRegistration.prototype.registerResolver = function registerResolver(container, key, fn) {
  3650. return container.registerTransient(this._key || key, fn);
  3651. };
  3652. return TransientRegistration;
  3653. }();
  3654. var SingletonRegistration = exports.SingletonRegistration = function () {
  3655. function SingletonRegistration(keyOrRegisterInChild) {
  3656. var registerInChild = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
  3657. if (typeof keyOrRegisterInChild === 'boolean') {
  3658. this._registerInChild = keyOrRegisterInChild;
  3659. } else {
  3660. this._key = keyOrRegisterInChild;
  3661. this._registerInChild = registerInChild;
  3662. }
  3663. }
  3664. SingletonRegistration.prototype.registerResolver = function registerResolver(container, key, fn) {
  3665. return this._registerInChild ? container.registerSingleton(this._key || key, fn) : container.root.registerSingleton(this._key || key, fn);
  3666. };
  3667. return SingletonRegistration;
  3668. }();
  3669. var badKeyError = 'key/value cannot be null or undefined. Are you trying to inject/register something that doesn\'t exist with DI?';
  3670. var _emptyParameters = exports._emptyParameters = Object.freeze([]);
  3671. _aureliaMetadata.metadata.registration = 'aurelia:registration';
  3672. _aureliaMetadata.metadata.invoker = 'aurelia:invoker';
  3673. var resolverDecorates = resolver.decorates;
  3674. var InvocationHandler = exports.InvocationHandler = function () {
  3675. function InvocationHandler(fn, invoker, dependencies) {
  3676. this.fn = fn;
  3677. this.invoker = invoker;
  3678. this.dependencies = dependencies;
  3679. }
  3680. InvocationHandler.prototype.invoke = function invoke(container, dynamicDependencies) {
  3681. return dynamicDependencies !== undefined ? this.invoker.invokeWithDynamicDependencies(container, this.fn, this.dependencies, dynamicDependencies) : this.invoker.invoke(container, this.fn, this.dependencies);
  3682. };
  3683. return InvocationHandler;
  3684. }();
  3685. function invokeWithDynamicDependencies(container, fn, staticDependencies, dynamicDependencies) {
  3686. var i = staticDependencies.length;
  3687. var args = new Array(i);
  3688. while (i--) {
  3689. args[i] = container.get(staticDependencies[i]);
  3690. }
  3691. if (dynamicDependencies !== undefined) {
  3692. args = args.concat(dynamicDependencies);
  3693. }
  3694. return Reflect.construct(fn, args);
  3695. }
  3696. var classInvokers = (_classInvokers = {}, _classInvokers[0] = {
  3697. invoke: function invoke(container, Type) {
  3698. return new Type();
  3699. },
  3700. invokeWithDynamicDependencies: invokeWithDynamicDependencies
  3701. }, _classInvokers[1] = {
  3702. invoke: function invoke(container, Type, deps) {
  3703. return new Type(container.get(deps[0]));
  3704. },
  3705. invokeWithDynamicDependencies: invokeWithDynamicDependencies
  3706. }, _classInvokers[2] = {
  3707. invoke: function invoke(container, Type, deps) {
  3708. return new Type(container.get(deps[0]), container.get(deps[1]));
  3709. },
  3710. invokeWithDynamicDependencies: invokeWithDynamicDependencies
  3711. }, _classInvokers[3] = {
  3712. invoke: function invoke(container, Type, deps) {
  3713. return new Type(container.get(deps[0]), container.get(deps[1]), container.get(deps[2]));
  3714. },
  3715. invokeWithDynamicDependencies: invokeWithDynamicDependencies
  3716. }, _classInvokers[4] = {
  3717. invoke: function invoke(container, Type, deps) {
  3718. return new Type(container.get(deps[0]), container.get(deps[1]), container.get(deps[2]), container.get(deps[3]));
  3719. },
  3720. invokeWithDynamicDependencies: invokeWithDynamicDependencies
  3721. }, _classInvokers[5] = {
  3722. invoke: function invoke(container, Type, deps) {
  3723. return new Type(container.get(deps[0]), container.get(deps[1]), container.get(deps[2]), container.get(deps[3]), container.get(deps[4]));
  3724. },
  3725. invokeWithDynamicDependencies: invokeWithDynamicDependencies
  3726. }, _classInvokers.fallback = {
  3727. invoke: invokeWithDynamicDependencies,
  3728. invokeWithDynamicDependencies: invokeWithDynamicDependencies
  3729. }, _classInvokers);
  3730. function getDependencies(f) {
  3731. if (!f.hasOwnProperty('inject')) {
  3732. return [];
  3733. }
  3734. if (typeof f.inject === 'function') {
  3735. return f.inject();
  3736. }
  3737. return f.inject;
  3738. }
  3739. var Container = exports.Container = function () {
  3740. function Container(configuration) {
  3741. if (configuration === undefined) {
  3742. configuration = {};
  3743. }
  3744. this._configuration = configuration;
  3745. this._onHandlerCreated = configuration.onHandlerCreated;
  3746. this._handlers = configuration.handlers || (configuration.handlers = new Map());
  3747. this._resolvers = new Map();
  3748. this.root = this;
  3749. this.parent = null;
  3750. }
  3751. Container.prototype.makeGlobal = function makeGlobal() {
  3752. Container.instance = this;
  3753. return this;
  3754. };
  3755. Container.prototype.setHandlerCreatedCallback = function setHandlerCreatedCallback(onHandlerCreated) {
  3756. this._onHandlerCreated = onHandlerCreated;
  3757. this._configuration.onHandlerCreated = onHandlerCreated;
  3758. };
  3759. Container.prototype.registerInstance = function registerInstance(key, instance) {
  3760. return this.registerResolver(key, new StrategyResolver(0, instance === undefined ? key : instance));
  3761. };
  3762. Container.prototype.registerSingleton = function registerSingleton(key, fn) {
  3763. return this.registerResolver(key, new StrategyResolver(1, fn === undefined ? key : fn));
  3764. };
  3765. Container.prototype.registerTransient = function registerTransient(key, fn) {
  3766. return this.registerResolver(key, new StrategyResolver(2, fn === undefined ? key : fn));
  3767. };
  3768. Container.prototype.registerHandler = function registerHandler(key, handler) {
  3769. return this.registerResolver(key, new StrategyResolver(3, handler));
  3770. };
  3771. Container.prototype.registerAlias = function registerAlias(originalKey, aliasKey) {
  3772. return this.registerResolver(aliasKey, new StrategyResolver(5, originalKey));
  3773. };
  3774. Container.prototype.registerResolver = function registerResolver(key, resolver) {
  3775. if (key === null || key === undefined) {
  3776. throw new Error(badKeyError);
  3777. }
  3778. var allResolvers = this._resolvers;
  3779. var result = allResolvers.get(key);
  3780. if (result === undefined) {
  3781. allResolvers.set(key, resolver);
  3782. } else if (result.strategy === 4) {
  3783. result.state.push(resolver);
  3784. } else {
  3785. allResolvers.set(key, new StrategyResolver(4, [result, resolver]));
  3786. }
  3787. return resolver;
  3788. };
  3789. Container.prototype.autoRegister = function autoRegister(key, fn) {
  3790. fn = fn === undefined ? key : fn;
  3791. if (typeof fn === 'function') {
  3792. var _registration = _aureliaMetadata.metadata.get(_aureliaMetadata.metadata.registration, fn);
  3793. if (_registration === undefined) {
  3794. return this.registerResolver(key, new StrategyResolver(1, fn));
  3795. }
  3796. return _registration.registerResolver(this, key, fn);
  3797. }
  3798. return this.registerResolver(key, new StrategyResolver(0, fn));
  3799. };
  3800. Container.prototype.autoRegisterAll = function autoRegisterAll(fns) {
  3801. var i = fns.length;
  3802. while (i--) {
  3803. this.autoRegister(fns[i]);
  3804. }
  3805. };
  3806. Container.prototype.unregister = function unregister(key) {
  3807. this._resolvers.delete(key);
  3808. };
  3809. Container.prototype.hasResolver = function hasResolver(key) {
  3810. var checkParent = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
  3811. if (key === null || key === undefined) {
  3812. throw new Error(badKeyError);
  3813. }
  3814. return this._resolvers.has(key) || checkParent && this.parent !== null && this.parent.hasResolver(key, checkParent);
  3815. };
  3816. Container.prototype.get = function get(key) {
  3817. if (key === null || key === undefined) {
  3818. throw new Error(badKeyError);
  3819. }
  3820. if (key === Container) {
  3821. return this;
  3822. }
  3823. if (resolverDecorates(key)) {
  3824. return key.get(this, key);
  3825. }
  3826. var resolver = this._resolvers.get(key);
  3827. if (resolver === undefined) {
  3828. if (this.parent === null) {
  3829. return this.autoRegister(key).get(this, key);
  3830. }
  3831. return this.parent._get(key);
  3832. }
  3833. return resolver.get(this, key);
  3834. };
  3835. Container.prototype._get = function _get(key) {
  3836. var resolver = this._resolvers.get(key);
  3837. if (resolver === undefined) {
  3838. if (this.parent === null) {
  3839. return this.autoRegister(key).get(this, key);
  3840. }
  3841. return this.parent._get(key);
  3842. }
  3843. return resolver.get(this, key);
  3844. };
  3845. Container.prototype.getAll = function getAll(key) {
  3846. if (key === null || key === undefined) {
  3847. throw new Error(badKeyError);
  3848. }
  3849. var resolver = this._resolvers.get(key);
  3850. if (resolver === undefined) {
  3851. if (this.parent === null) {
  3852. return _emptyParameters;
  3853. }
  3854. return this.parent.getAll(key);
  3855. }
  3856. if (resolver.strategy === 4) {
  3857. var state = resolver.state;
  3858. var i = state.length;
  3859. var results = new Array(i);
  3860. while (i--) {
  3861. results[i] = state[i].get(this, key);
  3862. }
  3863. return results;
  3864. }
  3865. return [resolver.get(this, key)];
  3866. };
  3867. Container.prototype.createChild = function createChild() {
  3868. var child = new Container(this._configuration);
  3869. child.root = this.root;
  3870. child.parent = this;
  3871. return child;
  3872. };
  3873. Container.prototype.invoke = function invoke(fn, dynamicDependencies) {
  3874. try {
  3875. var _handler = this._handlers.get(fn);
  3876. if (_handler === undefined) {
  3877. _handler = this._createInvocationHandler(fn);
  3878. this._handlers.set(fn, _handler);
  3879. }
  3880. return _handler.invoke(this, dynamicDependencies);
  3881. } catch (e) {
  3882. throw new _aureliaPal.AggregateError('Error invoking ' + fn.name + '. Check the inner error for details.', e, true);
  3883. }
  3884. };
  3885. Container.prototype._createInvocationHandler = function _createInvocationHandler(fn) {
  3886. var dependencies = void 0;
  3887. if (fn.inject === undefined) {
  3888. dependencies = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, fn) || _emptyParameters;
  3889. } else {
  3890. dependencies = [];
  3891. var ctor = fn;
  3892. while (typeof ctor === 'function') {
  3893. var _dependencies;
  3894. (_dependencies = dependencies).push.apply(_dependencies, getDependencies(ctor));
  3895. ctor = Object.getPrototypeOf(ctor);
  3896. }
  3897. }
  3898. var invoker = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.invoker, fn) || classInvokers[dependencies.length] || classInvokers.fallback;
  3899. var handler = new InvocationHandler(fn, invoker, dependencies);
  3900. return this._onHandlerCreated !== undefined ? this._onHandlerCreated(handler) : handler;
  3901. };
  3902. return Container;
  3903. }();
  3904. function autoinject(potentialTarget) {
  3905. var deco = function deco(target) {
  3906. var previousInject = target.inject;
  3907. var autoInject = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, target) || _emptyParameters;
  3908. if (!previousInject) {
  3909. target.inject = autoInject;
  3910. } else {
  3911. for (var i = 0; i++; i < autoInject.length) {
  3912. if (!previousInject[i]) {
  3913. previousInject[i] = autoInject[i];
  3914. }
  3915. }
  3916. }
  3917. };
  3918. return potentialTarget ? deco(potentialTarget) : deco;
  3919. }
  3920. function inject() {
  3921. for (var _len2 = arguments.length, rest = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  3922. rest[_key2] = arguments[_key2];
  3923. }
  3924. return function (target, key, descriptor) {
  3925. if (typeof descriptor === 'number' && rest.length === 1) {
  3926. var params = target.inject;
  3927. if (typeof params === 'function') {
  3928. throw new Error('Decorator inject cannot be used with "inject()". Please use an array instead.');
  3929. }
  3930. if (!params) {
  3931. params = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, target).slice();
  3932. target.inject = params;
  3933. }
  3934. params[descriptor] = rest[0];
  3935. return;
  3936. }
  3937. if (descriptor) {
  3938. var _fn = descriptor.value;
  3939. _fn.inject = rest;
  3940. } else {
  3941. target.inject = rest;
  3942. }
  3943. };
  3944. }
  3945. });
  3946. define('aurelia-binding',['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aurelia-metadata'], function (exports, _aureliaLogging, _aureliaPal, _aureliaTaskQueue, _aureliaMetadata) {
  3947. 'use strict';
  3948. Object.defineProperty(exports, "__esModule", {
  3949. value: true
  3950. });
  3951. 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;
  3952. exports.camelCase = camelCase;
  3953. exports.createOverrideContext = createOverrideContext;
  3954. exports.getContextFor = getContextFor;
  3955. exports.createScopeForTest = createScopeForTest;
  3956. exports.connectable = connectable;
  3957. exports.enqueueBindingConnect = enqueueBindingConnect;
  3958. exports.subscriberCollection = subscriberCollection;
  3959. exports.calcSplices = calcSplices;
  3960. exports.mergeSplice = mergeSplice;
  3961. exports.projectArraySplices = projectArraySplices;
  3962. exports.getChangeRecords = getChangeRecords;
  3963. exports.cloneExpression = cloneExpression;
  3964. exports.hasDeclaredDependencies = hasDeclaredDependencies;
  3965. exports.declarePropertyDependencies = declarePropertyDependencies;
  3966. exports.computedFrom = computedFrom;
  3967. exports.createComputedObserver = createComputedObserver;
  3968. exports.valueConverter = valueConverter;
  3969. exports.bindingBehavior = bindingBehavior;
  3970. exports.observable = observable;
  3971. var LogManager = _interopRequireWildcard(_aureliaLogging);
  3972. function _interopRequireWildcard(obj) {
  3973. if (obj && obj.__esModule) {
  3974. return obj;
  3975. } else {
  3976. var newObj = {};
  3977. if (obj != null) {
  3978. for (var key in obj) {
  3979. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  3980. }
  3981. }
  3982. newObj.default = obj;
  3983. return newObj;
  3984. }
  3985. }
  3986. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  3987. return typeof obj;
  3988. } : function (obj) {
  3989. return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
  3990. };
  3991. var _createClass = function () {
  3992. function defineProperties(target, props) {
  3993. for (var i = 0; i < props.length; i++) {
  3994. var descriptor = props[i];
  3995. descriptor.enumerable = descriptor.enumerable || false;
  3996. descriptor.configurable = true;
  3997. if ("value" in descriptor) descriptor.writable = true;
  3998. Object.defineProperty(target, descriptor.key, descriptor);
  3999. }
  4000. }
  4001. return function (Constructor, protoProps, staticProps) {
  4002. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  4003. if (staticProps) defineProperties(Constructor, staticProps);
  4004. return Constructor;
  4005. };
  4006. }();
  4007. function _possibleConstructorReturn(self, call) {
  4008. if (!self) {
  4009. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  4010. }
  4011. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  4012. }
  4013. function _inherits(subClass, superClass) {
  4014. if (typeof superClass !== "function" && superClass !== null) {
  4015. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  4016. }
  4017. subClass.prototype = Object.create(superClass && superClass.prototype, {
  4018. constructor: {
  4019. value: subClass,
  4020. enumerable: false,
  4021. writable: true,
  4022. configurable: true
  4023. }
  4024. });
  4025. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  4026. }
  4027. var _dec, _dec2, _class, _dec3, _class2, _dec4, _class3, _dec5, _class5, _dec6, _class7, _dec7, _class8, _dec8, _class9, _dec9, _class10, _class11, _temp, _dec10, _class12, _class13, _temp2;
  4028. var map = Object.create(null);
  4029. function camelCase(name) {
  4030. if (name in map) {
  4031. return map[name];
  4032. }
  4033. var result = name.charAt(0).toLowerCase() + name.slice(1).replace(/[_.-](\w|$)/g, function (_, x) {
  4034. return x.toUpperCase();
  4035. });
  4036. map[name] = result;
  4037. return result;
  4038. }
  4039. function createOverrideContext(bindingContext, parentOverrideContext) {
  4040. return {
  4041. bindingContext: bindingContext,
  4042. parentOverrideContext: parentOverrideContext || null
  4043. };
  4044. }
  4045. function getContextFor(name, scope, ancestor) {
  4046. var oc = scope.overrideContext;
  4047. if (ancestor) {
  4048. while (ancestor && oc) {
  4049. ancestor--;
  4050. oc = oc.parentOverrideContext;
  4051. }
  4052. if (ancestor || !oc) {
  4053. return undefined;
  4054. }
  4055. return name in oc ? oc : oc.bindingContext;
  4056. }
  4057. while (oc && !(name in oc) && !(oc.bindingContext && name in oc.bindingContext)) {
  4058. oc = oc.parentOverrideContext;
  4059. }
  4060. if (oc) {
  4061. return name in oc ? oc : oc.bindingContext;
  4062. }
  4063. return scope.bindingContext || scope.overrideContext;
  4064. }
  4065. function createScopeForTest(bindingContext, parentBindingContext) {
  4066. if (parentBindingContext) {
  4067. return {
  4068. bindingContext: bindingContext,
  4069. overrideContext: createOverrideContext(bindingContext, createOverrideContext(parentBindingContext))
  4070. };
  4071. }
  4072. return {
  4073. bindingContext: bindingContext,
  4074. overrideContext: createOverrideContext(bindingContext)
  4075. };
  4076. }
  4077. var sourceContext = exports.sourceContext = 'Binding:source';
  4078. var slotNames = [];
  4079. var versionSlotNames = [];
  4080. for (var i = 0; i < 100; i++) {
  4081. slotNames.push('_observer' + i);
  4082. versionSlotNames.push('_observerVersion' + i);
  4083. }
  4084. function addObserver(observer) {
  4085. var observerSlots = this._observerSlots === undefined ? 0 : this._observerSlots;
  4086. var i = observerSlots;
  4087. while (i-- && this[slotNames[i]] !== observer) {}
  4088. if (i === -1) {
  4089. i = 0;
  4090. while (this[slotNames[i]]) {
  4091. i++;
  4092. }
  4093. this[slotNames[i]] = observer;
  4094. observer.subscribe(sourceContext, this);
  4095. if (i === observerSlots) {
  4096. this._observerSlots = i + 1;
  4097. }
  4098. }
  4099. if (this._version === undefined) {
  4100. this._version = 0;
  4101. }
  4102. this[versionSlotNames[i]] = this._version;
  4103. }
  4104. function observeProperty(obj, propertyName) {
  4105. var observer = this.observerLocator.getObserver(obj, propertyName);
  4106. addObserver.call(this, observer);
  4107. }
  4108. function observeArray(array) {
  4109. var observer = this.observerLocator.getArrayObserver(array);
  4110. addObserver.call(this, observer);
  4111. }
  4112. function unobserve(all) {
  4113. var i = this._observerSlots;
  4114. while (i--) {
  4115. if (all || this[versionSlotNames[i]] !== this._version) {
  4116. var observer = this[slotNames[i]];
  4117. this[slotNames[i]] = null;
  4118. if (observer) {
  4119. observer.unsubscribe(sourceContext, this);
  4120. }
  4121. }
  4122. }
  4123. }
  4124. function connectable() {
  4125. return function (target) {
  4126. target.prototype.observeProperty = observeProperty;
  4127. target.prototype.observeArray = observeArray;
  4128. target.prototype.unobserve = unobserve;
  4129. target.prototype.addObserver = addObserver;
  4130. };
  4131. }
  4132. var bindings = new Map();
  4133. var minimumImmediate = 100;
  4134. var frameBudget = 15;
  4135. var isFlushRequested = false;
  4136. var immediate = 0;
  4137. function flush(animationFrameStart) {
  4138. var i = 0;
  4139. var keys = bindings.keys();
  4140. var item = void 0;
  4141. while (item = keys.next()) {
  4142. if (item.done) {
  4143. break;
  4144. }
  4145. var binding = item.value;
  4146. bindings.delete(binding);
  4147. binding.connect(true);
  4148. i++;
  4149. if (i % 100 === 0 && _aureliaPal.PLATFORM.performance.now() - animationFrameStart > frameBudget) {
  4150. break;
  4151. }
  4152. }
  4153. if (bindings.size) {
  4154. _aureliaPal.PLATFORM.requestAnimationFrame(flush);
  4155. } else {
  4156. isFlushRequested = false;
  4157. immediate = 0;
  4158. }
  4159. }
  4160. function enqueueBindingConnect(binding) {
  4161. if (immediate < minimumImmediate) {
  4162. immediate++;
  4163. binding.connect(false);
  4164. } else {
  4165. bindings.set(binding);
  4166. }
  4167. if (!isFlushRequested) {
  4168. isFlushRequested = true;
  4169. _aureliaPal.PLATFORM.requestAnimationFrame(flush);
  4170. }
  4171. }
  4172. function addSubscriber(context, callable) {
  4173. if (this.hasSubscriber(context, callable)) {
  4174. return false;
  4175. }
  4176. if (!this._context0) {
  4177. this._context0 = context;
  4178. this._callable0 = callable;
  4179. return true;
  4180. }
  4181. if (!this._context1) {
  4182. this._context1 = context;
  4183. this._callable1 = callable;
  4184. return true;
  4185. }
  4186. if (!this._context2) {
  4187. this._context2 = context;
  4188. this._callable2 = callable;
  4189. return true;
  4190. }
  4191. if (!this._contextsRest) {
  4192. this._contextsRest = [context];
  4193. this._callablesRest = [callable];
  4194. return true;
  4195. }
  4196. this._contextsRest.push(context);
  4197. this._callablesRest.push(callable);
  4198. return true;
  4199. }
  4200. function removeSubscriber(context, callable) {
  4201. if (this._context0 === context && this._callable0 === callable) {
  4202. this._context0 = null;
  4203. this._callable0 = null;
  4204. return true;
  4205. }
  4206. if (this._context1 === context && this._callable1 === callable) {
  4207. this._context1 = null;
  4208. this._callable1 = null;
  4209. return true;
  4210. }
  4211. if (this._context2 === context && this._callable2 === callable) {
  4212. this._context2 = null;
  4213. this._callable2 = null;
  4214. return true;
  4215. }
  4216. var rest = this._contextsRest;
  4217. var index = void 0;
  4218. if (!rest || !rest.length || (index = rest.indexOf(context)) === -1 || this._callablesRest[index] !== callable) {
  4219. return false;
  4220. }
  4221. rest.splice(index, 1);
  4222. this._callablesRest.splice(index, 1);
  4223. return true;
  4224. }
  4225. var arrayPool1 = [];
  4226. var arrayPool2 = [];
  4227. var poolUtilization = [];
  4228. function callSubscribers(newValue, oldValue) {
  4229. var context0 = this._context0;
  4230. var callable0 = this._callable0;
  4231. var context1 = this._context1;
  4232. var callable1 = this._callable1;
  4233. var context2 = this._context2;
  4234. var callable2 = this._callable2;
  4235. var length = this._contextsRest ? this._contextsRest.length : 0;
  4236. var contextsRest = void 0;
  4237. var callablesRest = void 0;
  4238. var poolIndex = void 0;
  4239. var i = void 0;
  4240. if (length) {
  4241. poolIndex = poolUtilization.length;
  4242. while (poolIndex-- && poolUtilization[poolIndex]) {}
  4243. if (poolIndex < 0) {
  4244. poolIndex = poolUtilization.length;
  4245. contextsRest = [];
  4246. callablesRest = [];
  4247. poolUtilization.push(true);
  4248. arrayPool1.push(contextsRest);
  4249. arrayPool2.push(callablesRest);
  4250. } else {
  4251. poolUtilization[poolIndex] = true;
  4252. contextsRest = arrayPool1[poolIndex];
  4253. callablesRest = arrayPool2[poolIndex];
  4254. }
  4255. i = length;
  4256. while (i--) {
  4257. contextsRest[i] = this._contextsRest[i];
  4258. callablesRest[i] = this._callablesRest[i];
  4259. }
  4260. }
  4261. if (context0) {
  4262. if (callable0) {
  4263. callable0.call(context0, newValue, oldValue);
  4264. } else {
  4265. context0(newValue, oldValue);
  4266. }
  4267. }
  4268. if (context1) {
  4269. if (callable1) {
  4270. callable1.call(context1, newValue, oldValue);
  4271. } else {
  4272. context1(newValue, oldValue);
  4273. }
  4274. }
  4275. if (context2) {
  4276. if (callable2) {
  4277. callable2.call(context2, newValue, oldValue);
  4278. } else {
  4279. context2(newValue, oldValue);
  4280. }
  4281. }
  4282. if (length) {
  4283. for (i = 0; i < length; i++) {
  4284. var callable = callablesRest[i];
  4285. var context = contextsRest[i];
  4286. if (callable) {
  4287. callable.call(context, newValue, oldValue);
  4288. } else {
  4289. context(newValue, oldValue);
  4290. }
  4291. contextsRest[i] = null;
  4292. callablesRest[i] = null;
  4293. }
  4294. poolUtilization[poolIndex] = false;
  4295. }
  4296. }
  4297. function hasSubscribers() {
  4298. return !!(this._context0 || this._context1 || this._context2 || this._contextsRest && this._contextsRest.length);
  4299. }
  4300. function hasSubscriber(context, callable) {
  4301. var has = this._context0 === context && this._callable0 === callable || this._context1 === context && this._callable1 === callable || this._context2 === context && this._callable2 === callable;
  4302. if (has) {
  4303. return true;
  4304. }
  4305. var index = void 0;
  4306. var contexts = this._contextsRest;
  4307. if (!contexts || (index = contexts.length) === 0) {
  4308. return false;
  4309. }
  4310. var callables = this._callablesRest;
  4311. while (index--) {
  4312. if (contexts[index] === context && callables[index] === callable) {
  4313. return true;
  4314. }
  4315. }
  4316. return false;
  4317. }
  4318. function subscriberCollection() {
  4319. return function (target) {
  4320. target.prototype.addSubscriber = addSubscriber;
  4321. target.prototype.removeSubscriber = removeSubscriber;
  4322. target.prototype.callSubscribers = callSubscribers;
  4323. target.prototype.hasSubscribers = hasSubscribers;
  4324. target.prototype.hasSubscriber = hasSubscriber;
  4325. };
  4326. }
  4327. var ExpressionObserver = exports.ExpressionObserver = (_dec = connectable(), _dec2 = subscriberCollection(), _dec(_class = _dec2(_class = function () {
  4328. function ExpressionObserver(scope, expression, observerLocator, lookupFunctions) {
  4329. this.scope = scope;
  4330. this.expression = expression;
  4331. this.observerLocator = observerLocator;
  4332. this.lookupFunctions = lookupFunctions;
  4333. }
  4334. ExpressionObserver.prototype.getValue = function getValue() {
  4335. return this.expression.evaluate(this.scope, this.lookupFunctions);
  4336. };
  4337. ExpressionObserver.prototype.setValue = function setValue(newValue) {
  4338. this.expression.assign(this.scope, newValue);
  4339. };
  4340. ExpressionObserver.prototype.subscribe = function subscribe(context, callable) {
  4341. var _this = this;
  4342. if (!this.hasSubscribers()) {
  4343. this.oldValue = this.expression.evaluate(this.scope, this.lookupFunctions);
  4344. this.expression.connect(this, this.scope);
  4345. }
  4346. this.addSubscriber(context, callable);
  4347. if (arguments.length === 1 && context instanceof Function) {
  4348. return {
  4349. dispose: function dispose() {
  4350. _this.unsubscribe(context, callable);
  4351. }
  4352. };
  4353. }
  4354. };
  4355. ExpressionObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
  4356. if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
  4357. this.unobserve(true);
  4358. this.oldValue = undefined;
  4359. }
  4360. };
  4361. ExpressionObserver.prototype.call = function call() {
  4362. var newValue = this.expression.evaluate(this.scope, this.lookupFunctions);
  4363. var oldValue = this.oldValue;
  4364. if (newValue !== oldValue) {
  4365. this.oldValue = newValue;
  4366. this.callSubscribers(newValue, oldValue);
  4367. }
  4368. this._version++;
  4369. this.expression.connect(this, this.scope);
  4370. this.unobserve(false);
  4371. };
  4372. return ExpressionObserver;
  4373. }()) || _class) || _class);
  4374. function isIndex(s) {
  4375. return +s === s >>> 0;
  4376. }
  4377. function toNumber(s) {
  4378. return +s;
  4379. }
  4380. function newSplice(index, removed, addedCount) {
  4381. return {
  4382. index: index,
  4383. removed: removed,
  4384. addedCount: addedCount
  4385. };
  4386. }
  4387. var EDIT_LEAVE = 0;
  4388. var EDIT_UPDATE = 1;
  4389. var EDIT_ADD = 2;
  4390. var EDIT_DELETE = 3;
  4391. function ArraySplice() {}
  4392. ArraySplice.prototype = {
  4393. calcEditDistances: function calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd) {
  4394. var rowCount = oldEnd - oldStart + 1;
  4395. var columnCount = currentEnd - currentStart + 1;
  4396. var distances = new Array(rowCount);
  4397. var north = void 0;
  4398. var west = void 0;
  4399. for (var _i = 0; _i < rowCount; ++_i) {
  4400. distances[_i] = new Array(columnCount);
  4401. distances[_i][0] = _i;
  4402. }
  4403. for (var j = 0; j < columnCount; ++j) {
  4404. distances[0][j] = j;
  4405. }
  4406. for (var _i2 = 1; _i2 < rowCount; ++_i2) {
  4407. for (var _j = 1; _j < columnCount; ++_j) {
  4408. if (this.equals(current[currentStart + _j - 1], old[oldStart + _i2 - 1])) {
  4409. distances[_i2][_j] = distances[_i2 - 1][_j - 1];
  4410. } else {
  4411. north = distances[_i2 - 1][_j] + 1;
  4412. west = distances[_i2][_j - 1] + 1;
  4413. distances[_i2][_j] = north < west ? north : west;
  4414. }
  4415. }
  4416. }
  4417. return distances;
  4418. },
  4419. spliceOperationsFromEditDistances: function spliceOperationsFromEditDistances(distances) {
  4420. var i = distances.length - 1;
  4421. var j = distances[0].length - 1;
  4422. var current = distances[i][j];
  4423. var edits = [];
  4424. while (i > 0 || j > 0) {
  4425. if (i === 0) {
  4426. edits.push(EDIT_ADD);
  4427. j--;
  4428. continue;
  4429. }
  4430. if (j === 0) {
  4431. edits.push(EDIT_DELETE);
  4432. i--;
  4433. continue;
  4434. }
  4435. var northWest = distances[i - 1][j - 1];
  4436. var west = distances[i - 1][j];
  4437. var north = distances[i][j - 1];
  4438. var min = void 0;
  4439. if (west < north) {
  4440. min = west < northWest ? west : northWest;
  4441. } else {
  4442. min = north < northWest ? north : northWest;
  4443. }
  4444. if (min === northWest) {
  4445. if (northWest === current) {
  4446. edits.push(EDIT_LEAVE);
  4447. } else {
  4448. edits.push(EDIT_UPDATE);
  4449. current = northWest;
  4450. }
  4451. i--;
  4452. j--;
  4453. } else if (min === west) {
  4454. edits.push(EDIT_DELETE);
  4455. i--;
  4456. current = west;
  4457. } else {
  4458. edits.push(EDIT_ADD);
  4459. j--;
  4460. current = north;
  4461. }
  4462. }
  4463. edits.reverse();
  4464. return edits;
  4465. },
  4466. calcSplices: function calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd) {
  4467. var prefixCount = 0;
  4468. var suffixCount = 0;
  4469. var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
  4470. if (currentStart === 0 && oldStart === 0) {
  4471. prefixCount = this.sharedPrefix(current, old, minLength);
  4472. }
  4473. if (currentEnd === current.length && oldEnd === old.length) {
  4474. suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
  4475. }
  4476. currentStart += prefixCount;
  4477. oldStart += prefixCount;
  4478. currentEnd -= suffixCount;
  4479. oldEnd -= suffixCount;
  4480. if (currentEnd - currentStart === 0 && oldEnd - oldStart === 0) {
  4481. return [];
  4482. }
  4483. if (currentStart === currentEnd) {
  4484. var _splice = newSplice(currentStart, [], 0);
  4485. while (oldStart < oldEnd) {
  4486. _splice.removed.push(old[oldStart++]);
  4487. }
  4488. return [_splice];
  4489. } else if (oldStart === oldEnd) {
  4490. return [newSplice(currentStart, [], currentEnd - currentStart)];
  4491. }
  4492. var ops = this.spliceOperationsFromEditDistances(this.calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
  4493. var splice = undefined;
  4494. var splices = [];
  4495. var index = currentStart;
  4496. var oldIndex = oldStart;
  4497. for (var _i3 = 0; _i3 < ops.length; ++_i3) {
  4498. switch (ops[_i3]) {
  4499. case EDIT_LEAVE:
  4500. if (splice) {
  4501. splices.push(splice);
  4502. splice = undefined;
  4503. }
  4504. index++;
  4505. oldIndex++;
  4506. break;
  4507. case EDIT_UPDATE:
  4508. if (!splice) {
  4509. splice = newSplice(index, [], 0);
  4510. }
  4511. splice.addedCount++;
  4512. index++;
  4513. splice.removed.push(old[oldIndex]);
  4514. oldIndex++;
  4515. break;
  4516. case EDIT_ADD:
  4517. if (!splice) {
  4518. splice = newSplice(index, [], 0);
  4519. }
  4520. splice.addedCount++;
  4521. index++;
  4522. break;
  4523. case EDIT_DELETE:
  4524. if (!splice) {
  4525. splice = newSplice(index, [], 0);
  4526. }
  4527. splice.removed.push(old[oldIndex]);
  4528. oldIndex++;
  4529. break;
  4530. }
  4531. }
  4532. if (splice) {
  4533. splices.push(splice);
  4534. }
  4535. return splices;
  4536. },
  4537. sharedPrefix: function sharedPrefix(current, old, searchLength) {
  4538. for (var _i4 = 0; _i4 < searchLength; ++_i4) {
  4539. if (!this.equals(current[_i4], old[_i4])) {
  4540. return _i4;
  4541. }
  4542. }
  4543. return searchLength;
  4544. },
  4545. sharedSuffix: function sharedSuffix(current, old, searchLength) {
  4546. var index1 = current.length;
  4547. var index2 = old.length;
  4548. var count = 0;
  4549. while (count < searchLength && this.equals(current[--index1], old[--index2])) {
  4550. count++;
  4551. }
  4552. return count;
  4553. },
  4554. calculateSplices: function calculateSplices(current, previous) {
  4555. return this.calcSplices(current, 0, current.length, previous, 0, previous.length);
  4556. },
  4557. equals: function equals(currentValue, previousValue) {
  4558. return currentValue === previousValue;
  4559. }
  4560. };
  4561. var arraySplice = new ArraySplice();
  4562. function calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd) {
  4563. return arraySplice.calcSplices(current, currentStart, currentEnd, old, oldStart, oldEnd);
  4564. }
  4565. function intersect(start1, end1, start2, end2) {
  4566. if (end1 < start2 || end2 < start1) {
  4567. return -1;
  4568. }
  4569. if (end1 === start2 || end2 === start1) {
  4570. return 0;
  4571. }
  4572. if (start1 < start2) {
  4573. if (end1 < end2) {
  4574. return end1 - start2;
  4575. }
  4576. return end2 - start2;
  4577. }
  4578. if (end2 < end1) {
  4579. return end2 - start1;
  4580. }
  4581. return end1 - start1;
  4582. }
  4583. function mergeSplice(splices, index, removed, addedCount) {
  4584. var splice = newSplice(index, removed, addedCount);
  4585. var inserted = false;
  4586. var insertionOffset = 0;
  4587. for (var _i5 = 0; _i5 < splices.length; _i5++) {
  4588. var current = splices[_i5];
  4589. current.index += insertionOffset;
  4590. if (inserted) {
  4591. continue;
  4592. }
  4593. var intersectCount = intersect(splice.index, splice.index + splice.removed.length, current.index, current.index + current.addedCount);
  4594. if (intersectCount >= 0) {
  4595. splices.splice(_i5, 1);
  4596. _i5--;
  4597. insertionOffset -= current.addedCount - current.removed.length;
  4598. splice.addedCount += current.addedCount - intersectCount;
  4599. var deleteCount = splice.removed.length + current.removed.length - intersectCount;
  4600. if (!splice.addedCount && !deleteCount) {
  4601. inserted = true;
  4602. } else {
  4603. var currentRemoved = current.removed;
  4604. if (splice.index < current.index) {
  4605. var prepend = splice.removed.slice(0, current.index - splice.index);
  4606. Array.prototype.push.apply(prepend, currentRemoved);
  4607. currentRemoved = prepend;
  4608. }
  4609. if (splice.index + splice.removed.length > current.index + current.addedCount) {
  4610. var append = splice.removed.slice(current.index + current.addedCount - splice.index);
  4611. Array.prototype.push.apply(currentRemoved, append);
  4612. }
  4613. splice.removed = currentRemoved;
  4614. if (current.index < splice.index) {
  4615. splice.index = current.index;
  4616. }
  4617. }
  4618. } else if (splice.index < current.index) {
  4619. inserted = true;
  4620. splices.splice(_i5, 0, splice);
  4621. _i5++;
  4622. var offset = splice.addedCount - splice.removed.length;
  4623. current.index += offset;
  4624. insertionOffset += offset;
  4625. }
  4626. }
  4627. if (!inserted) {
  4628. splices.push(splice);
  4629. }
  4630. }
  4631. function createInitialSplices(array, changeRecords) {
  4632. var splices = [];
  4633. for (var _i6 = 0; _i6 < changeRecords.length; _i6++) {
  4634. var record = changeRecords[_i6];
  4635. switch (record.type) {
  4636. case 'splice':
  4637. mergeSplice(splices, record.index, record.removed.slice(), record.addedCount);
  4638. break;
  4639. case 'add':
  4640. case 'update':
  4641. case 'delete':
  4642. if (!isIndex(record.name)) {
  4643. continue;
  4644. }
  4645. var index = toNumber(record.name);
  4646. if (index < 0) {
  4647. continue;
  4648. }
  4649. mergeSplice(splices, index, [record.oldValue], record.type === 'delete' ? 0 : 1);
  4650. break;
  4651. default:
  4652. console.error('Unexpected record type: ' + JSON.stringify(record));
  4653. break;
  4654. }
  4655. }
  4656. return splices;
  4657. }
  4658. function projectArraySplices(array, changeRecords) {
  4659. var splices = [];
  4660. createInitialSplices(array, changeRecords).forEach(function (splice) {
  4661. if (splice.addedCount === 1 && splice.removed.length === 1) {
  4662. if (splice.removed[0] !== array[splice.index]) {
  4663. splices.push(splice);
  4664. }
  4665. return;
  4666. }
  4667. splices = splices.concat(calcSplices(array, splice.index, splice.index + splice.addedCount, splice.removed, 0, splice.removed.length));
  4668. });
  4669. return splices;
  4670. }
  4671. function newRecord(type, object, key, oldValue) {
  4672. return {
  4673. type: type,
  4674. object: object,
  4675. key: key,
  4676. oldValue: oldValue
  4677. };
  4678. }
  4679. function getChangeRecords(map) {
  4680. var entries = new Array(map.size);
  4681. var keys = map.keys();
  4682. var i = 0;
  4683. var item = void 0;
  4684. while (item = keys.next()) {
  4685. if (item.done) {
  4686. break;
  4687. }
  4688. entries[i] = newRecord('added', map, item.value);
  4689. i++;
  4690. }
  4691. return entries;
  4692. }
  4693. var ModifyCollectionObserver = exports.ModifyCollectionObserver = (_dec3 = subscriberCollection(), _dec3(_class2 = function () {
  4694. function ModifyCollectionObserver(taskQueue, collection) {
  4695. this.taskQueue = taskQueue;
  4696. this.queued = false;
  4697. this.changeRecords = null;
  4698. this.oldCollection = null;
  4699. this.collection = collection;
  4700. this.lengthPropertyName = collection instanceof Map || collection instanceof Set ? 'size' : 'length';
  4701. }
  4702. ModifyCollectionObserver.prototype.subscribe = function subscribe(context, callable) {
  4703. this.addSubscriber(context, callable);
  4704. };
  4705. ModifyCollectionObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
  4706. this.removeSubscriber(context, callable);
  4707. };
  4708. ModifyCollectionObserver.prototype.addChangeRecord = function addChangeRecord(changeRecord) {
  4709. if (!this.hasSubscribers() && !this.lengthObserver) {
  4710. return;
  4711. }
  4712. if (changeRecord.type === 'splice') {
  4713. var index = changeRecord.index;
  4714. var arrayLength = changeRecord.object.length;
  4715. if (index > arrayLength) {
  4716. index = arrayLength - changeRecord.addedCount;
  4717. } else if (index < 0) {
  4718. index = arrayLength + changeRecord.removed.length + index - changeRecord.addedCount;
  4719. }
  4720. if (index < 0) {
  4721. index = 0;
  4722. }
  4723. changeRecord.index = index;
  4724. }
  4725. if (this.changeRecords === null) {
  4726. this.changeRecords = [changeRecord];
  4727. } else {
  4728. this.changeRecords.push(changeRecord);
  4729. }
  4730. if (!this.queued) {
  4731. this.queued = true;
  4732. this.taskQueue.queueMicroTask(this);
  4733. }
  4734. };
  4735. ModifyCollectionObserver.prototype.flushChangeRecords = function flushChangeRecords() {
  4736. if (this.changeRecords && this.changeRecords.length || this.oldCollection) {
  4737. this.call();
  4738. }
  4739. };
  4740. ModifyCollectionObserver.prototype.reset = function reset(oldCollection) {
  4741. this.oldCollection = oldCollection;
  4742. if (this.hasSubscribers() && !this.queued) {
  4743. this.queued = true;
  4744. this.taskQueue.queueMicroTask(this);
  4745. }
  4746. };
  4747. ModifyCollectionObserver.prototype.getLengthObserver = function getLengthObserver() {
  4748. return this.lengthObserver || (this.lengthObserver = new CollectionLengthObserver(this.collection));
  4749. };
  4750. ModifyCollectionObserver.prototype.call = function call() {
  4751. var changeRecords = this.changeRecords;
  4752. var oldCollection = this.oldCollection;
  4753. var records = void 0;
  4754. this.queued = false;
  4755. this.changeRecords = [];
  4756. this.oldCollection = null;
  4757. if (this.hasSubscribers()) {
  4758. if (oldCollection) {
  4759. if (this.collection instanceof Map || this.collection instanceof Set) {
  4760. records = getChangeRecords(oldCollection);
  4761. } else {
  4762. records = calcSplices(this.collection, 0, this.collection.length, oldCollection, 0, oldCollection.length);
  4763. }
  4764. } else {
  4765. if (this.collection instanceof Map || this.collection instanceof Set) {
  4766. records = changeRecords;
  4767. } else {
  4768. records = projectArraySplices(this.collection, changeRecords);
  4769. }
  4770. }
  4771. this.callSubscribers(records);
  4772. }
  4773. if (this.lengthObserver) {
  4774. this.lengthObserver.call(this.collection[this.lengthPropertyName]);
  4775. }
  4776. };
  4777. return ModifyCollectionObserver;
  4778. }()) || _class2);
  4779. var CollectionLengthObserver = exports.CollectionLengthObserver = (_dec4 = subscriberCollection(), _dec4(_class3 = function () {
  4780. function CollectionLengthObserver(collection) {
  4781. this.collection = collection;
  4782. this.lengthPropertyName = collection instanceof Map || collection instanceof Set ? 'size' : 'length';
  4783. this.currentValue = collection[this.lengthPropertyName];
  4784. }
  4785. CollectionLengthObserver.prototype.getValue = function getValue() {
  4786. return this.collection[this.lengthPropertyName];
  4787. };
  4788. CollectionLengthObserver.prototype.setValue = function setValue(newValue) {
  4789. this.collection[this.lengthPropertyName] = newValue;
  4790. };
  4791. CollectionLengthObserver.prototype.subscribe = function subscribe(context, callable) {
  4792. this.addSubscriber(context, callable);
  4793. };
  4794. CollectionLengthObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
  4795. this.removeSubscriber(context, callable);
  4796. };
  4797. CollectionLengthObserver.prototype.call = function call(newValue) {
  4798. var oldValue = this.currentValue;
  4799. this.callSubscribers(newValue, oldValue);
  4800. this.currentValue = newValue;
  4801. };
  4802. return CollectionLengthObserver;
  4803. }()) || _class3);
  4804. var pop = Array.prototype.pop;
  4805. var push = Array.prototype.push;
  4806. var reverse = Array.prototype.reverse;
  4807. var shift = Array.prototype.shift;
  4808. var sort = Array.prototype.sort;
  4809. var splice = Array.prototype.splice;
  4810. var unshift = Array.prototype.unshift;
  4811. Array.prototype.pop = function () {
  4812. var notEmpty = this.length > 0;
  4813. var methodCallResult = pop.apply(this, arguments);
  4814. if (notEmpty && this.__array_observer__ !== undefined) {
  4815. this.__array_observer__.addChangeRecord({
  4816. type: 'delete',
  4817. object: this,
  4818. name: this.length,
  4819. oldValue: methodCallResult
  4820. });
  4821. }
  4822. return methodCallResult;
  4823. };
  4824. Array.prototype.push = function () {
  4825. var methodCallResult = push.apply(this, arguments);
  4826. if (this.__array_observer__ !== undefined) {
  4827. this.__array_observer__.addChangeRecord({
  4828. type: 'splice',
  4829. object: this,
  4830. index: this.length - arguments.length,
  4831. removed: [],
  4832. addedCount: arguments.length
  4833. });
  4834. }
  4835. return methodCallResult;
  4836. };
  4837. Array.prototype.reverse = function () {
  4838. var oldArray = void 0;
  4839. if (this.__array_observer__ !== undefined) {
  4840. this.__array_observer__.flushChangeRecords();
  4841. oldArray = this.slice();
  4842. }
  4843. var methodCallResult = reverse.apply(this, arguments);
  4844. if (this.__array_observer__ !== undefined) {
  4845. this.__array_observer__.reset(oldArray);
  4846. }
  4847. return methodCallResult;
  4848. };
  4849. Array.prototype.shift = function () {
  4850. var notEmpty = this.length > 0;
  4851. var methodCallResult = shift.apply(this, arguments);
  4852. if (notEmpty && this.__array_observer__ !== undefined) {
  4853. this.__array_observer__.addChangeRecord({
  4854. type: 'delete',
  4855. object: this,
  4856. name: 0,
  4857. oldValue: methodCallResult
  4858. });
  4859. }
  4860. return methodCallResult;
  4861. };
  4862. Array.prototype.sort = function () {
  4863. var oldArray = void 0;
  4864. if (this.__array_observer__ !== undefined) {
  4865. this.__array_observer__.flushChangeRecords();
  4866. oldArray = this.slice();
  4867. }
  4868. var methodCallResult = sort.apply(this, arguments);
  4869. if (this.__array_observer__ !== undefined) {
  4870. this.__array_observer__.reset(oldArray);
  4871. }
  4872. return methodCallResult;
  4873. };
  4874. Array.prototype.splice = function () {
  4875. var methodCallResult = splice.apply(this, arguments);
  4876. if (this.__array_observer__ !== undefined) {
  4877. this.__array_observer__.addChangeRecord({
  4878. type: 'splice',
  4879. object: this,
  4880. index: arguments[0],
  4881. removed: methodCallResult,
  4882. addedCount: arguments.length > 2 ? arguments.length - 2 : 0
  4883. });
  4884. }
  4885. return methodCallResult;
  4886. };
  4887. Array.prototype.unshift = function () {
  4888. var methodCallResult = unshift.apply(this, arguments);
  4889. if (this.__array_observer__ !== undefined) {
  4890. this.__array_observer__.addChangeRecord({
  4891. type: 'splice',
  4892. object: this,
  4893. index: 0,
  4894. removed: [],
  4895. addedCount: arguments.length
  4896. });
  4897. }
  4898. return methodCallResult;
  4899. };
  4900. function _getArrayObserver(taskQueue, array) {
  4901. return ModifyArrayObserver.for(taskQueue, array);
  4902. }
  4903. exports.getArrayObserver = _getArrayObserver;
  4904. var ModifyArrayObserver = function (_ModifyCollectionObse) {
  4905. _inherits(ModifyArrayObserver, _ModifyCollectionObse);
  4906. function ModifyArrayObserver(taskQueue, array) {
  4907. return _possibleConstructorReturn(this, _ModifyCollectionObse.call(this, taskQueue, array));
  4908. }
  4909. ModifyArrayObserver.for = function _for(taskQueue, array) {
  4910. if (!('__array_observer__' in array)) {
  4911. Reflect.defineProperty(array, '__array_observer__', {
  4912. value: ModifyArrayObserver.create(taskQueue, array),
  4913. enumerable: false, configurable: false
  4914. });
  4915. }
  4916. return array.__array_observer__;
  4917. };
  4918. ModifyArrayObserver.create = function create(taskQueue, array) {
  4919. return new ModifyArrayObserver(taskQueue, array);
  4920. };
  4921. return ModifyArrayObserver;
  4922. }(ModifyCollectionObserver);
  4923. var Expression = exports.Expression = function () {
  4924. function Expression() {
  4925. this.isChain = false;
  4926. this.isAssignable = false;
  4927. }
  4928. Expression.prototype.evaluate = function evaluate(scope, lookupFunctions, args) {
  4929. throw new Error('Binding expression "' + this + '" cannot be evaluated.');
  4930. };
  4931. Expression.prototype.assign = function assign(scope, value, lookupFunctions) {
  4932. throw new Error('Binding expression "' + this + '" cannot be assigned to.');
  4933. };
  4934. Expression.prototype.toString = function toString() {
  4935. return Unparser.unparse(this);
  4936. };
  4937. return Expression;
  4938. }();
  4939. var Chain = exports.Chain = function (_Expression) {
  4940. _inherits(Chain, _Expression);
  4941. function Chain(expressions) {
  4942. var _this3 = _possibleConstructorReturn(this, _Expression.call(this));
  4943. _this3.expressions = expressions;
  4944. _this3.isChain = true;
  4945. return _this3;
  4946. }
  4947. Chain.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  4948. var result = void 0;
  4949. var expressions = this.expressions;
  4950. var last = void 0;
  4951. for (var _i7 = 0, length = expressions.length; _i7 < length; ++_i7) {
  4952. last = expressions[_i7].evaluate(scope, lookupFunctions);
  4953. if (last !== null) {
  4954. result = last;
  4955. }
  4956. }
  4957. return result;
  4958. };
  4959. Chain.prototype.accept = function accept(visitor) {
  4960. return visitor.visitChain(this);
  4961. };
  4962. return Chain;
  4963. }(Expression);
  4964. var BindingBehavior = exports.BindingBehavior = function (_Expression2) {
  4965. _inherits(BindingBehavior, _Expression2);
  4966. function BindingBehavior(expression, name, args) {
  4967. var _this4 = _possibleConstructorReturn(this, _Expression2.call(this));
  4968. _this4.expression = expression;
  4969. _this4.name = name;
  4970. _this4.args = args;
  4971. return _this4;
  4972. }
  4973. BindingBehavior.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  4974. return this.expression.evaluate(scope, lookupFunctions);
  4975. };
  4976. BindingBehavior.prototype.assign = function assign(scope, value, lookupFunctions) {
  4977. return this.expression.assign(scope, value, lookupFunctions);
  4978. };
  4979. BindingBehavior.prototype.accept = function accept(visitor) {
  4980. return visitor.visitBindingBehavior(this);
  4981. };
  4982. BindingBehavior.prototype.connect = function connect(binding, scope) {
  4983. this.expression.connect(binding, scope);
  4984. };
  4985. BindingBehavior.prototype.bind = function bind(binding, scope, lookupFunctions) {
  4986. if (this.expression.expression && this.expression.bind) {
  4987. this.expression.bind(binding, scope, lookupFunctions);
  4988. }
  4989. var behavior = lookupFunctions.bindingBehaviors(this.name);
  4990. if (!behavior) {
  4991. throw new Error('No BindingBehavior named "' + this.name + '" was found!');
  4992. }
  4993. var behaviorKey = 'behavior-' + this.name;
  4994. if (binding[behaviorKey]) {
  4995. throw new Error('A binding behavior named "' + this.name + '" has already been applied to "' + this.expression + '"');
  4996. }
  4997. binding[behaviorKey] = behavior;
  4998. behavior.bind.apply(behavior, [binding, scope].concat(evalList(scope, this.args, binding.lookupFunctions)));
  4999. };
  5000. BindingBehavior.prototype.unbind = function unbind(binding, scope) {
  5001. var behaviorKey = 'behavior-' + this.name;
  5002. binding[behaviorKey].unbind(binding, scope);
  5003. binding[behaviorKey] = null;
  5004. if (this.expression.expression && this.expression.unbind) {
  5005. this.expression.unbind(binding, scope);
  5006. }
  5007. };
  5008. return BindingBehavior;
  5009. }(Expression);
  5010. var ValueConverter = exports.ValueConverter = function (_Expression3) {
  5011. _inherits(ValueConverter, _Expression3);
  5012. function ValueConverter(expression, name, args, allArgs) {
  5013. var _this5 = _possibleConstructorReturn(this, _Expression3.call(this));
  5014. _this5.expression = expression;
  5015. _this5.name = name;
  5016. _this5.args = args;
  5017. _this5.allArgs = allArgs;
  5018. return _this5;
  5019. }
  5020. ValueConverter.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5021. var converter = lookupFunctions.valueConverters(this.name);
  5022. if (!converter) {
  5023. throw new Error('No ValueConverter named "' + this.name + '" was found!');
  5024. }
  5025. if ('toView' in converter) {
  5026. return converter.toView.apply(converter, evalList(scope, this.allArgs, lookupFunctions));
  5027. }
  5028. return this.allArgs[0].evaluate(scope, lookupFunctions);
  5029. };
  5030. ValueConverter.prototype.assign = function assign(scope, value, lookupFunctions) {
  5031. var converter = lookupFunctions.valueConverters(this.name);
  5032. if (!converter) {
  5033. throw new Error('No ValueConverter named "' + this.name + '" was found!');
  5034. }
  5035. if ('fromView' in converter) {
  5036. value = converter.fromView.apply(converter, [value].concat(evalList(scope, this.args, lookupFunctions)));
  5037. }
  5038. return this.allArgs[0].assign(scope, value, lookupFunctions);
  5039. };
  5040. ValueConverter.prototype.accept = function accept(visitor) {
  5041. return visitor.visitValueConverter(this);
  5042. };
  5043. ValueConverter.prototype.connect = function connect(binding, scope) {
  5044. var expressions = this.allArgs;
  5045. var i = expressions.length;
  5046. while (i--) {
  5047. expressions[i].connect(binding, scope);
  5048. }
  5049. };
  5050. return ValueConverter;
  5051. }(Expression);
  5052. var Assign = exports.Assign = function (_Expression4) {
  5053. _inherits(Assign, _Expression4);
  5054. function Assign(target, value) {
  5055. var _this6 = _possibleConstructorReturn(this, _Expression4.call(this));
  5056. _this6.target = target;
  5057. _this6.value = value;
  5058. return _this6;
  5059. }
  5060. Assign.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5061. return this.target.assign(scope, this.value.evaluate(scope, lookupFunctions));
  5062. };
  5063. Assign.prototype.accept = function accept(vistor) {
  5064. vistor.visitAssign(this);
  5065. };
  5066. Assign.prototype.connect = function connect(binding, scope) {};
  5067. return Assign;
  5068. }(Expression);
  5069. var Conditional = exports.Conditional = function (_Expression5) {
  5070. _inherits(Conditional, _Expression5);
  5071. function Conditional(condition, yes, no) {
  5072. var _this7 = _possibleConstructorReturn(this, _Expression5.call(this));
  5073. _this7.condition = condition;
  5074. _this7.yes = yes;
  5075. _this7.no = no;
  5076. return _this7;
  5077. }
  5078. Conditional.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5079. return !!this.condition.evaluate(scope) ? this.yes.evaluate(scope) : this.no.evaluate(scope);
  5080. };
  5081. Conditional.prototype.accept = function accept(visitor) {
  5082. return visitor.visitConditional(this);
  5083. };
  5084. Conditional.prototype.connect = function connect(binding, scope) {
  5085. this.condition.connect(binding, scope);
  5086. if (this.condition.evaluate(scope)) {
  5087. this.yes.connect(binding, scope);
  5088. } else {
  5089. this.no.connect(binding, scope);
  5090. }
  5091. };
  5092. return Conditional;
  5093. }(Expression);
  5094. var AccessThis = exports.AccessThis = function (_Expression6) {
  5095. _inherits(AccessThis, _Expression6);
  5096. function AccessThis(ancestor) {
  5097. var _this8 = _possibleConstructorReturn(this, _Expression6.call(this));
  5098. _this8.ancestor = ancestor;
  5099. return _this8;
  5100. }
  5101. AccessThis.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5102. var oc = scope.overrideContext;
  5103. var i = this.ancestor;
  5104. while (i-- && oc) {
  5105. oc = oc.parentOverrideContext;
  5106. }
  5107. return i < 1 && oc ? oc.bindingContext : undefined;
  5108. };
  5109. AccessThis.prototype.accept = function accept(visitor) {
  5110. return visitor.visitAccessThis(this);
  5111. };
  5112. AccessThis.prototype.connect = function connect(binding, scope) {};
  5113. return AccessThis;
  5114. }(Expression);
  5115. var AccessScope = exports.AccessScope = function (_Expression7) {
  5116. _inherits(AccessScope, _Expression7);
  5117. function AccessScope(name, ancestor) {
  5118. var _this9 = _possibleConstructorReturn(this, _Expression7.call(this));
  5119. _this9.name = name;
  5120. _this9.ancestor = ancestor;
  5121. _this9.isAssignable = true;
  5122. return _this9;
  5123. }
  5124. AccessScope.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5125. var context = getContextFor(this.name, scope, this.ancestor);
  5126. return context[this.name];
  5127. };
  5128. AccessScope.prototype.assign = function assign(scope, value) {
  5129. var context = getContextFor(this.name, scope, this.ancestor);
  5130. return context ? context[this.name] = value : undefined;
  5131. };
  5132. AccessScope.prototype.accept = function accept(visitor) {
  5133. return visitor.visitAccessScope(this);
  5134. };
  5135. AccessScope.prototype.connect = function connect(binding, scope) {
  5136. var context = getContextFor(this.name, scope, this.ancestor);
  5137. binding.observeProperty(context, this.name);
  5138. };
  5139. return AccessScope;
  5140. }(Expression);
  5141. var AccessMember = exports.AccessMember = function (_Expression8) {
  5142. _inherits(AccessMember, _Expression8);
  5143. function AccessMember(object, name) {
  5144. var _this10 = _possibleConstructorReturn(this, _Expression8.call(this));
  5145. _this10.object = object;
  5146. _this10.name = name;
  5147. _this10.isAssignable = true;
  5148. return _this10;
  5149. }
  5150. AccessMember.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5151. var instance = this.object.evaluate(scope, lookupFunctions);
  5152. return instance === null || instance === undefined ? instance : instance[this.name];
  5153. };
  5154. AccessMember.prototype.assign = function assign(scope, value) {
  5155. var instance = this.object.evaluate(scope);
  5156. if (instance === null || instance === undefined) {
  5157. instance = {};
  5158. this.object.assign(scope, instance);
  5159. }
  5160. instance[this.name] = value;
  5161. return value;
  5162. };
  5163. AccessMember.prototype.accept = function accept(visitor) {
  5164. return visitor.visitAccessMember(this);
  5165. };
  5166. AccessMember.prototype.connect = function connect(binding, scope) {
  5167. this.object.connect(binding, scope);
  5168. var obj = this.object.evaluate(scope);
  5169. if (obj) {
  5170. binding.observeProperty(obj, this.name);
  5171. }
  5172. };
  5173. return AccessMember;
  5174. }(Expression);
  5175. var AccessKeyed = exports.AccessKeyed = function (_Expression9) {
  5176. _inherits(AccessKeyed, _Expression9);
  5177. function AccessKeyed(object, key) {
  5178. var _this11 = _possibleConstructorReturn(this, _Expression9.call(this));
  5179. _this11.object = object;
  5180. _this11.key = key;
  5181. _this11.isAssignable = true;
  5182. return _this11;
  5183. }
  5184. AccessKeyed.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5185. var instance = this.object.evaluate(scope, lookupFunctions);
  5186. var lookup = this.key.evaluate(scope, lookupFunctions);
  5187. return getKeyed(instance, lookup);
  5188. };
  5189. AccessKeyed.prototype.assign = function assign(scope, value) {
  5190. var instance = this.object.evaluate(scope);
  5191. var lookup = this.key.evaluate(scope);
  5192. return setKeyed(instance, lookup, value);
  5193. };
  5194. AccessKeyed.prototype.accept = function accept(visitor) {
  5195. return visitor.visitAccessKeyed(this);
  5196. };
  5197. AccessKeyed.prototype.connect = function connect(binding, scope) {
  5198. this.object.connect(binding, scope);
  5199. var obj = this.object.evaluate(scope);
  5200. if (obj instanceof Object) {
  5201. this.key.connect(binding, scope);
  5202. var key = this.key.evaluate(scope);
  5203. if (key !== null && key !== undefined && !(Array.isArray(obj) && typeof key === 'number')) {
  5204. binding.observeProperty(obj, key);
  5205. }
  5206. }
  5207. };
  5208. return AccessKeyed;
  5209. }(Expression);
  5210. var CallScope = exports.CallScope = function (_Expression10) {
  5211. _inherits(CallScope, _Expression10);
  5212. function CallScope(name, args, ancestor) {
  5213. var _this12 = _possibleConstructorReturn(this, _Expression10.call(this));
  5214. _this12.name = name;
  5215. _this12.args = args;
  5216. _this12.ancestor = ancestor;
  5217. return _this12;
  5218. }
  5219. CallScope.prototype.evaluate = function evaluate(scope, lookupFunctions, mustEvaluate) {
  5220. var args = evalList(scope, this.args, lookupFunctions);
  5221. var context = getContextFor(this.name, scope, this.ancestor);
  5222. var func = getFunction(context, this.name, mustEvaluate);
  5223. if (func) {
  5224. return func.apply(context, args);
  5225. }
  5226. return undefined;
  5227. };
  5228. CallScope.prototype.accept = function accept(visitor) {
  5229. return visitor.visitCallScope(this);
  5230. };
  5231. CallScope.prototype.connect = function connect(binding, scope) {
  5232. var args = this.args;
  5233. var i = args.length;
  5234. while (i--) {
  5235. args[i].connect(binding, scope);
  5236. }
  5237. };
  5238. return CallScope;
  5239. }(Expression);
  5240. var CallMember = exports.CallMember = function (_Expression11) {
  5241. _inherits(CallMember, _Expression11);
  5242. function CallMember(object, name, args) {
  5243. var _this13 = _possibleConstructorReturn(this, _Expression11.call(this));
  5244. _this13.object = object;
  5245. _this13.name = name;
  5246. _this13.args = args;
  5247. return _this13;
  5248. }
  5249. CallMember.prototype.evaluate = function evaluate(scope, lookupFunctions, mustEvaluate) {
  5250. var instance = this.object.evaluate(scope, lookupFunctions);
  5251. var args = evalList(scope, this.args, lookupFunctions);
  5252. var func = getFunction(instance, this.name, mustEvaluate);
  5253. if (func) {
  5254. return func.apply(instance, args);
  5255. }
  5256. return undefined;
  5257. };
  5258. CallMember.prototype.accept = function accept(visitor) {
  5259. return visitor.visitCallMember(this);
  5260. };
  5261. CallMember.prototype.connect = function connect(binding, scope) {
  5262. this.object.connect(binding, scope);
  5263. var obj = this.object.evaluate(scope);
  5264. if (getFunction(obj, this.name, false)) {
  5265. var args = this.args;
  5266. var _i8 = args.length;
  5267. while (_i8--) {
  5268. args[_i8].connect(binding, scope);
  5269. }
  5270. }
  5271. };
  5272. return CallMember;
  5273. }(Expression);
  5274. var CallFunction = exports.CallFunction = function (_Expression12) {
  5275. _inherits(CallFunction, _Expression12);
  5276. function CallFunction(func, args) {
  5277. var _this14 = _possibleConstructorReturn(this, _Expression12.call(this));
  5278. _this14.func = func;
  5279. _this14.args = args;
  5280. return _this14;
  5281. }
  5282. CallFunction.prototype.evaluate = function evaluate(scope, lookupFunctions, mustEvaluate) {
  5283. var func = this.func.evaluate(scope, lookupFunctions);
  5284. if (typeof func === 'function') {
  5285. return func.apply(null, evalList(scope, this.args, lookupFunctions));
  5286. }
  5287. if (!mustEvaluate && (func === null || func === undefined)) {
  5288. return undefined;
  5289. }
  5290. throw new Error(this.func + ' is not a function');
  5291. };
  5292. CallFunction.prototype.accept = function accept(visitor) {
  5293. return visitor.visitCallFunction(this);
  5294. };
  5295. CallFunction.prototype.connect = function connect(binding, scope) {
  5296. this.func.connect(binding, scope);
  5297. var func = this.func.evaluate(scope);
  5298. if (typeof func === 'function') {
  5299. var args = this.args;
  5300. var _i9 = args.length;
  5301. while (_i9--) {
  5302. args[_i9].connect(binding, scope);
  5303. }
  5304. }
  5305. };
  5306. return CallFunction;
  5307. }(Expression);
  5308. var Binary = exports.Binary = function (_Expression13) {
  5309. _inherits(Binary, _Expression13);
  5310. function Binary(operation, left, right) {
  5311. var _this15 = _possibleConstructorReturn(this, _Expression13.call(this));
  5312. _this15.operation = operation;
  5313. _this15.left = left;
  5314. _this15.right = right;
  5315. return _this15;
  5316. }
  5317. Binary.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5318. var left = this.left.evaluate(scope);
  5319. switch (this.operation) {
  5320. case '&&':
  5321. return left && this.right.evaluate(scope);
  5322. case '||':
  5323. return left || this.right.evaluate(scope);
  5324. }
  5325. var right = this.right.evaluate(scope);
  5326. switch (this.operation) {
  5327. case '==':
  5328. return left == right;
  5329. case '===':
  5330. return left === right;
  5331. case '!=':
  5332. return left != right;
  5333. case '!==':
  5334. return left !== right;
  5335. }
  5336. if (left === null || right === null || left === undefined || right === undefined) {
  5337. switch (this.operation) {
  5338. case '+':
  5339. if (left !== null && left !== undefined) return left;
  5340. if (right !== null && right !== undefined) return right;
  5341. return 0;
  5342. case '-':
  5343. if (left !== null && left !== undefined) return left;
  5344. if (right !== null && right !== undefined) return 0 - right;
  5345. return 0;
  5346. }
  5347. return null;
  5348. }
  5349. switch (this.operation) {
  5350. case '+':
  5351. return autoConvertAdd(left, right);
  5352. case '-':
  5353. return left - right;
  5354. case '*':
  5355. return left * right;
  5356. case '/':
  5357. return left / right;
  5358. case '%':
  5359. return left % right;
  5360. case '<':
  5361. return left < right;
  5362. case '>':
  5363. return left > right;
  5364. case '<=':
  5365. return left <= right;
  5366. case '>=':
  5367. return left >= right;
  5368. case '^':
  5369. return left ^ right;
  5370. }
  5371. throw new Error('Internal error [' + this.operation + '] not handled');
  5372. };
  5373. Binary.prototype.accept = function accept(visitor) {
  5374. return visitor.visitBinary(this);
  5375. };
  5376. Binary.prototype.connect = function connect(binding, scope) {
  5377. this.left.connect(binding, scope);
  5378. var left = this.left.evaluate(scope);
  5379. if (this.operation === '&&' && !left || this.operation === '||' && left) {
  5380. return;
  5381. }
  5382. this.right.connect(binding, scope);
  5383. };
  5384. return Binary;
  5385. }(Expression);
  5386. var PrefixNot = exports.PrefixNot = function (_Expression14) {
  5387. _inherits(PrefixNot, _Expression14);
  5388. function PrefixNot(operation, expression) {
  5389. var _this16 = _possibleConstructorReturn(this, _Expression14.call(this));
  5390. _this16.operation = operation;
  5391. _this16.expression = expression;
  5392. return _this16;
  5393. }
  5394. PrefixNot.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5395. return !this.expression.evaluate(scope);
  5396. };
  5397. PrefixNot.prototype.accept = function accept(visitor) {
  5398. return visitor.visitPrefix(this);
  5399. };
  5400. PrefixNot.prototype.connect = function connect(binding, scope) {
  5401. this.expression.connect(binding, scope);
  5402. };
  5403. return PrefixNot;
  5404. }(Expression);
  5405. var LiteralPrimitive = exports.LiteralPrimitive = function (_Expression15) {
  5406. _inherits(LiteralPrimitive, _Expression15);
  5407. function LiteralPrimitive(value) {
  5408. var _this17 = _possibleConstructorReturn(this, _Expression15.call(this));
  5409. _this17.value = value;
  5410. return _this17;
  5411. }
  5412. LiteralPrimitive.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5413. return this.value;
  5414. };
  5415. LiteralPrimitive.prototype.accept = function accept(visitor) {
  5416. return visitor.visitLiteralPrimitive(this);
  5417. };
  5418. LiteralPrimitive.prototype.connect = function connect(binding, scope) {};
  5419. return LiteralPrimitive;
  5420. }(Expression);
  5421. var LiteralString = exports.LiteralString = function (_Expression16) {
  5422. _inherits(LiteralString, _Expression16);
  5423. function LiteralString(value) {
  5424. var _this18 = _possibleConstructorReturn(this, _Expression16.call(this));
  5425. _this18.value = value;
  5426. return _this18;
  5427. }
  5428. LiteralString.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5429. return this.value;
  5430. };
  5431. LiteralString.prototype.accept = function accept(visitor) {
  5432. return visitor.visitLiteralString(this);
  5433. };
  5434. LiteralString.prototype.connect = function connect(binding, scope) {};
  5435. return LiteralString;
  5436. }(Expression);
  5437. var LiteralArray = exports.LiteralArray = function (_Expression17) {
  5438. _inherits(LiteralArray, _Expression17);
  5439. function LiteralArray(elements) {
  5440. var _this19 = _possibleConstructorReturn(this, _Expression17.call(this));
  5441. _this19.elements = elements;
  5442. return _this19;
  5443. }
  5444. LiteralArray.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5445. var elements = this.elements;
  5446. var result = [];
  5447. for (var _i10 = 0, length = elements.length; _i10 < length; ++_i10) {
  5448. result[_i10] = elements[_i10].evaluate(scope, lookupFunctions);
  5449. }
  5450. return result;
  5451. };
  5452. LiteralArray.prototype.accept = function accept(visitor) {
  5453. return visitor.visitLiteralArray(this);
  5454. };
  5455. LiteralArray.prototype.connect = function connect(binding, scope) {
  5456. var length = this.elements.length;
  5457. for (var _i11 = 0; _i11 < length; _i11++) {
  5458. this.elements[_i11].connect(binding, scope);
  5459. }
  5460. };
  5461. return LiteralArray;
  5462. }(Expression);
  5463. var LiteralObject = exports.LiteralObject = function (_Expression18) {
  5464. _inherits(LiteralObject, _Expression18);
  5465. function LiteralObject(keys, values) {
  5466. var _this20 = _possibleConstructorReturn(this, _Expression18.call(this));
  5467. _this20.keys = keys;
  5468. _this20.values = values;
  5469. return _this20;
  5470. }
  5471. LiteralObject.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  5472. var instance = {};
  5473. var keys = this.keys;
  5474. var values = this.values;
  5475. for (var _i12 = 0, length = keys.length; _i12 < length; ++_i12) {
  5476. instance[keys[_i12]] = values[_i12].evaluate(scope, lookupFunctions);
  5477. }
  5478. return instance;
  5479. };
  5480. LiteralObject.prototype.accept = function accept(visitor) {
  5481. return visitor.visitLiteralObject(this);
  5482. };
  5483. LiteralObject.prototype.connect = function connect(binding, scope) {
  5484. var length = this.keys.length;
  5485. for (var _i13 = 0; _i13 < length; _i13++) {
  5486. this.values[_i13].connect(binding, scope);
  5487. }
  5488. };
  5489. return LiteralObject;
  5490. }(Expression);
  5491. var evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0]];
  5492. function evalList(scope, list, lookupFunctions) {
  5493. var length = list.length;
  5494. for (var cacheLength = evalListCache.length; cacheLength <= length; ++cacheLength) {
  5495. evalListCache.push([]);
  5496. }
  5497. var result = evalListCache[length];
  5498. for (var _i14 = 0; _i14 < length; ++_i14) {
  5499. result[_i14] = list[_i14].evaluate(scope, lookupFunctions);
  5500. }
  5501. return result;
  5502. }
  5503. function autoConvertAdd(a, b) {
  5504. if (a !== null && b !== null) {
  5505. if (typeof a === 'string' && typeof b !== 'string') {
  5506. return a + b.toString();
  5507. }
  5508. if (typeof a !== 'string' && typeof b === 'string') {
  5509. return a.toString() + b;
  5510. }
  5511. return a + b;
  5512. }
  5513. if (a !== null) {
  5514. return a;
  5515. }
  5516. if (b !== null) {
  5517. return b;
  5518. }
  5519. return 0;
  5520. }
  5521. function getFunction(obj, name, mustExist) {
  5522. var func = obj === null || obj === undefined ? null : obj[name];
  5523. if (typeof func === 'function') {
  5524. return func;
  5525. }
  5526. if (!mustExist && (func === null || func === undefined)) {
  5527. return null;
  5528. }
  5529. throw new Error(name + ' is not a function');
  5530. }
  5531. function getKeyed(obj, key) {
  5532. if (Array.isArray(obj)) {
  5533. return obj[parseInt(key, 10)];
  5534. } else if (obj) {
  5535. return obj[key];
  5536. } else if (obj === null || obj === undefined) {
  5537. return undefined;
  5538. }
  5539. return obj[key];
  5540. }
  5541. function setKeyed(obj, key, value) {
  5542. if (Array.isArray(obj)) {
  5543. var index = parseInt(key, 10);
  5544. if (obj.length <= index) {
  5545. obj.length = index + 1;
  5546. }
  5547. obj[index] = value;
  5548. } else {
  5549. obj[key] = value;
  5550. }
  5551. return value;
  5552. }
  5553. var Unparser = exports.Unparser = function () {
  5554. function Unparser(buffer) {
  5555. this.buffer = buffer;
  5556. }
  5557. Unparser.unparse = function unparse(expression) {
  5558. var buffer = [];
  5559. var visitor = new Unparser(buffer);
  5560. expression.accept(visitor);
  5561. return buffer.join('');
  5562. };
  5563. Unparser.prototype.write = function write(text) {
  5564. this.buffer.push(text);
  5565. };
  5566. Unparser.prototype.writeArgs = function writeArgs(args) {
  5567. this.write('(');
  5568. for (var _i15 = 0, length = args.length; _i15 < length; ++_i15) {
  5569. if (_i15 !== 0) {
  5570. this.write(',');
  5571. }
  5572. args[_i15].accept(this);
  5573. }
  5574. this.write(')');
  5575. };
  5576. Unparser.prototype.visitChain = function visitChain(chain) {
  5577. var expressions = chain.expressions;
  5578. for (var _i16 = 0, length = expression.length; _i16 < length; ++_i16) {
  5579. if (_i16 !== 0) {
  5580. this.write(';');
  5581. }
  5582. expressions[_i16].accept(this);
  5583. }
  5584. };
  5585. Unparser.prototype.visitBindingBehavior = function visitBindingBehavior(behavior) {
  5586. var args = behavior.args;
  5587. behavior.expression.accept(this);
  5588. this.write('&' + behavior.name);
  5589. for (var _i17 = 0, length = args.length; _i17 < length; ++_i17) {
  5590. this.write(':');
  5591. args[_i17].accept(this);
  5592. }
  5593. };
  5594. Unparser.prototype.visitValueConverter = function visitValueConverter(converter) {
  5595. var args = converter.args;
  5596. converter.expression.accept(this);
  5597. this.write('|' + converter.name);
  5598. for (var _i18 = 0, length = args.length; _i18 < length; ++_i18) {
  5599. this.write(':');
  5600. args[_i18].accept(this);
  5601. }
  5602. };
  5603. Unparser.prototype.visitAssign = function visitAssign(assign) {
  5604. assign.target.accept(this);
  5605. this.write('=');
  5606. assign.value.accept(this);
  5607. };
  5608. Unparser.prototype.visitConditional = function visitConditional(conditional) {
  5609. conditional.condition.accept(this);
  5610. this.write('?');
  5611. conditional.yes.accept(this);
  5612. this.write(':');
  5613. conditional.no.accept(this);
  5614. };
  5615. Unparser.prototype.visitAccessThis = function visitAccessThis(access) {
  5616. if (access.ancestor === 0) {
  5617. this.write('$this');
  5618. return;
  5619. }
  5620. this.write('$parent');
  5621. var i = access.ancestor - 1;
  5622. while (i--) {
  5623. this.write('.$parent');
  5624. }
  5625. };
  5626. Unparser.prototype.visitAccessScope = function visitAccessScope(access) {
  5627. var i = access.ancestor;
  5628. while (i--) {
  5629. this.write('$parent.');
  5630. }
  5631. this.write(access.name);
  5632. };
  5633. Unparser.prototype.visitAccessMember = function visitAccessMember(access) {
  5634. access.object.accept(this);
  5635. this.write('.' + access.name);
  5636. };
  5637. Unparser.prototype.visitAccessKeyed = function visitAccessKeyed(access) {
  5638. access.object.accept(this);
  5639. this.write('[');
  5640. access.key.accept(this);
  5641. this.write(']');
  5642. };
  5643. Unparser.prototype.visitCallScope = function visitCallScope(call) {
  5644. var i = call.ancestor;
  5645. while (i--) {
  5646. this.write('$parent.');
  5647. }
  5648. this.write(call.name);
  5649. this.writeArgs(call.args);
  5650. };
  5651. Unparser.prototype.visitCallFunction = function visitCallFunction(call) {
  5652. call.func.accept(this);
  5653. this.writeArgs(call.args);
  5654. };
  5655. Unparser.prototype.visitCallMember = function visitCallMember(call) {
  5656. call.object.accept(this);
  5657. this.write('.' + call.name);
  5658. this.writeArgs(call.args);
  5659. };
  5660. Unparser.prototype.visitPrefix = function visitPrefix(prefix) {
  5661. this.write('(' + prefix.operation);
  5662. prefix.expression.accept(this);
  5663. this.write(')');
  5664. };
  5665. Unparser.prototype.visitBinary = function visitBinary(binary) {
  5666. binary.left.accept(this);
  5667. this.write(binary.operation);
  5668. binary.right.accept(this);
  5669. };
  5670. Unparser.prototype.visitLiteralPrimitive = function visitLiteralPrimitive(literal) {
  5671. this.write('' + literal.value);
  5672. };
  5673. Unparser.prototype.visitLiteralArray = function visitLiteralArray(literal) {
  5674. var elements = literal.elements;
  5675. this.write('[');
  5676. for (var _i19 = 0, length = elements.length; _i19 < length; ++_i19) {
  5677. if (_i19 !== 0) {
  5678. this.write(',');
  5679. }
  5680. elements[_i19].accept(this);
  5681. }
  5682. this.write(']');
  5683. };
  5684. Unparser.prototype.visitLiteralObject = function visitLiteralObject(literal) {
  5685. var keys = literal.keys;
  5686. var values = literal.values;
  5687. this.write('{');
  5688. for (var _i20 = 0, length = keys.length; _i20 < length; ++_i20) {
  5689. if (_i20 !== 0) {
  5690. this.write(',');
  5691. }
  5692. this.write('\'' + keys[_i20] + '\':');
  5693. values[_i20].accept(this);
  5694. }
  5695. this.write('}');
  5696. };
  5697. Unparser.prototype.visitLiteralString = function visitLiteralString(literal) {
  5698. var escaped = literal.value.replace(/'/g, "\'");
  5699. this.write('\'' + escaped + '\'');
  5700. };
  5701. return Unparser;
  5702. }();
  5703. var ExpressionCloner = exports.ExpressionCloner = function () {
  5704. function ExpressionCloner() {
  5705. }
  5706. ExpressionCloner.prototype.cloneExpressionArray = function cloneExpressionArray(array) {
  5707. var clonedArray = [];
  5708. var i = array.length;
  5709. while (i--) {
  5710. clonedArray[i] = array[i].accept(this);
  5711. }
  5712. return clonedArray;
  5713. };
  5714. ExpressionCloner.prototype.visitChain = function visitChain(chain) {
  5715. return new Chain(this.cloneExpressionArray(chain.expressions));
  5716. };
  5717. ExpressionCloner.prototype.visitBindingBehavior = function visitBindingBehavior(behavior) {
  5718. return new BindingBehavior(behavior.expression.accept(this), behavior.name, this.cloneExpressionArray(behavior.args));
  5719. };
  5720. ExpressionCloner.prototype.visitValueConverter = function visitValueConverter(converter) {
  5721. return new ValueConverter(converter.expression.accept(this), converter.name, this.cloneExpressionArray(converter.args));
  5722. };
  5723. ExpressionCloner.prototype.visitAssign = function visitAssign(assign) {
  5724. return new Assign(assign.target.accept(this), assign.value.accept(this));
  5725. };
  5726. ExpressionCloner.prototype.visitConditional = function visitConditional(conditional) {
  5727. return new Conditional(conditional.condition.accept(this), conditional.yes.accept(this), conditional.no.accept(this));
  5728. };
  5729. ExpressionCloner.prototype.visitAccessThis = function visitAccessThis(access) {
  5730. return new AccessThis(access.ancestor);
  5731. };
  5732. ExpressionCloner.prototype.visitAccessScope = function visitAccessScope(access) {
  5733. return new AccessScope(access.name, access.ancestor);
  5734. };
  5735. ExpressionCloner.prototype.visitAccessMember = function visitAccessMember(access) {
  5736. return new AccessMember(access.object.accept(this), access.name);
  5737. };
  5738. ExpressionCloner.prototype.visitAccessKeyed = function visitAccessKeyed(access) {
  5739. return new AccessKeyed(access.object.accept(this), access.key.accept(this));
  5740. };
  5741. ExpressionCloner.prototype.visitCallScope = function visitCallScope(call) {
  5742. return new CallScope(call.name, this.cloneExpressionArray(call.args), call.ancestor);
  5743. };
  5744. ExpressionCloner.prototype.visitCallFunction = function visitCallFunction(call) {
  5745. return new CallFunction(call.func.accept(this), this.cloneExpressionArray(call.args));
  5746. };
  5747. ExpressionCloner.prototype.visitCallMember = function visitCallMember(call) {
  5748. return new CallMember(call.object.accept(this), call.name, this.cloneExpressionArray(call.args));
  5749. };
  5750. ExpressionCloner.prototype.visitPrefix = function visitPrefix(prefix) {
  5751. return new PrefixNot(prefix.operation, prefix.expression.accept(this));
  5752. };
  5753. ExpressionCloner.prototype.visitBinary = function visitBinary(binary) {
  5754. return new Binary(binary.operation, binary.left.accept(this), binary.right.accept(this));
  5755. };
  5756. ExpressionCloner.prototype.visitLiteralPrimitive = function visitLiteralPrimitive(literal) {
  5757. return new LiteralPrimitive(literal);
  5758. };
  5759. ExpressionCloner.prototype.visitLiteralArray = function visitLiteralArray(literal) {
  5760. return new LiteralArray(this.cloneExpressionArray(literal.elements));
  5761. };
  5762. ExpressionCloner.prototype.visitLiteralObject = function visitLiteralObject(literal) {
  5763. return new LiteralObject(literal.keys, this.cloneExpressionArray(literal.values));
  5764. };
  5765. ExpressionCloner.prototype.visitLiteralString = function visitLiteralString(literal) {
  5766. return new LiteralString(literal.value);
  5767. };
  5768. return ExpressionCloner;
  5769. }();
  5770. function cloneExpression(expression) {
  5771. var visitor = new ExpressionCloner();
  5772. return expression.accept(visitor);
  5773. }
  5774. var bindingMode = exports.bindingMode = {
  5775. oneTime: 0,
  5776. oneWay: 1,
  5777. twoWay: 2
  5778. };
  5779. var Token = exports.Token = function () {
  5780. function Token(index, text) {
  5781. this.index = index;
  5782. this.text = text;
  5783. }
  5784. Token.prototype.withOp = function withOp(op) {
  5785. this.opKey = op;
  5786. return this;
  5787. };
  5788. Token.prototype.withGetterSetter = function withGetterSetter(key) {
  5789. this.key = key;
  5790. return this;
  5791. };
  5792. Token.prototype.withValue = function withValue(value) {
  5793. this.value = value;
  5794. return this;
  5795. };
  5796. Token.prototype.toString = function toString() {
  5797. return 'Token(' + this.text + ')';
  5798. };
  5799. return Token;
  5800. }();
  5801. var Lexer = exports.Lexer = function () {
  5802. function Lexer() {
  5803. }
  5804. Lexer.prototype.lex = function lex(text) {
  5805. var scanner = new Scanner(text);
  5806. var tokens = [];
  5807. var token = scanner.scanToken();
  5808. while (token) {
  5809. tokens.push(token);
  5810. token = scanner.scanToken();
  5811. }
  5812. return tokens;
  5813. };
  5814. return Lexer;
  5815. }();
  5816. var Scanner = exports.Scanner = function () {
  5817. function Scanner(input) {
  5818. this.input = input;
  5819. this.length = input.length;
  5820. this.peek = 0;
  5821. this.index = -1;
  5822. this.advance();
  5823. }
  5824. Scanner.prototype.scanToken = function scanToken() {
  5825. while (this.peek <= $SPACE) {
  5826. if (++this.index >= this.length) {
  5827. this.peek = $EOF;
  5828. return null;
  5829. }
  5830. this.peek = this.input.charCodeAt(this.index);
  5831. }
  5832. if (isIdentifierStart(this.peek)) {
  5833. return this.scanIdentifier();
  5834. }
  5835. if (isDigit(this.peek)) {
  5836. return this.scanNumber(this.index);
  5837. }
  5838. var start = this.index;
  5839. switch (this.peek) {
  5840. case $PERIOD:
  5841. this.advance();
  5842. return isDigit(this.peek) ? this.scanNumber(start) : new Token(start, '.');
  5843. case $LPAREN:
  5844. case $RPAREN:
  5845. case $LBRACE:
  5846. case $RBRACE:
  5847. case $LBRACKET:
  5848. case $RBRACKET:
  5849. case $COMMA:
  5850. case $COLON:
  5851. case $SEMICOLON:
  5852. return this.scanCharacter(start, String.fromCharCode(this.peek));
  5853. case $SQ:
  5854. case $DQ:
  5855. return this.scanString();
  5856. case $PLUS:
  5857. case $MINUS:
  5858. case $STAR:
  5859. case $SLASH:
  5860. case $PERCENT:
  5861. case $CARET:
  5862. case $QUESTION:
  5863. return this.scanOperator(start, String.fromCharCode(this.peek));
  5864. case $LT:
  5865. case $GT:
  5866. case $BANG:
  5867. case $EQ:
  5868. return this.scanComplexOperator(start, $EQ, String.fromCharCode(this.peek), '=');
  5869. case $AMPERSAND:
  5870. return this.scanComplexOperator(start, $AMPERSAND, '&', '&');
  5871. case $BAR:
  5872. return this.scanComplexOperator(start, $BAR, '|', '|');
  5873. case $NBSP:
  5874. while (isWhitespace(this.peek)) {
  5875. this.advance();
  5876. }
  5877. return this.scanToken();
  5878. }
  5879. var character = String.fromCharCode(this.peek);
  5880. this.error('Unexpected character [' + character + ']');
  5881. return null;
  5882. };
  5883. Scanner.prototype.scanCharacter = function scanCharacter(start, text) {
  5884. assert(this.peek === text.charCodeAt(0));
  5885. this.advance();
  5886. return new Token(start, text);
  5887. };
  5888. Scanner.prototype.scanOperator = function scanOperator(start, text) {
  5889. assert(this.peek === text.charCodeAt(0));
  5890. assert(OPERATORS.indexOf(text) !== -1);
  5891. this.advance();
  5892. return new Token(start, text).withOp(text);
  5893. };
  5894. Scanner.prototype.scanComplexOperator = function scanComplexOperator(start, code, one, two) {
  5895. assert(this.peek === one.charCodeAt(0));
  5896. this.advance();
  5897. var text = one;
  5898. if (this.peek === code) {
  5899. this.advance();
  5900. text += two;
  5901. }
  5902. if (this.peek === code) {
  5903. this.advance();
  5904. text += two;
  5905. }
  5906. assert(OPERATORS.indexOf(text) !== -1);
  5907. return new Token(start, text).withOp(text);
  5908. };
  5909. Scanner.prototype.scanIdentifier = function scanIdentifier() {
  5910. assert(isIdentifierStart(this.peek));
  5911. var start = this.index;
  5912. this.advance();
  5913. while (isIdentifierPart(this.peek)) {
  5914. this.advance();
  5915. }
  5916. var text = this.input.substring(start, this.index);
  5917. var result = new Token(start, text);
  5918. if (OPERATORS.indexOf(text) !== -1) {
  5919. result.withOp(text);
  5920. } else {
  5921. result.withGetterSetter(text);
  5922. }
  5923. return result;
  5924. };
  5925. Scanner.prototype.scanNumber = function scanNumber(start) {
  5926. assert(isDigit(this.peek));
  5927. var simple = this.index === start;
  5928. this.advance();
  5929. while (true) {
  5930. if (!isDigit(this.peek)) {
  5931. if (this.peek === $PERIOD) {
  5932. simple = false;
  5933. } else if (isExponentStart(this.peek)) {
  5934. this.advance();
  5935. if (isExponentSign(this.peek)) {
  5936. this.advance();
  5937. }
  5938. if (!isDigit(this.peek)) {
  5939. this.error('Invalid exponent', -1);
  5940. }
  5941. simple = false;
  5942. } else {
  5943. break;
  5944. }
  5945. }
  5946. this.advance();
  5947. }
  5948. var text = this.input.substring(start, this.index);
  5949. var value = simple ? parseInt(text, 10) : parseFloat(text);
  5950. return new Token(start, text).withValue(value);
  5951. };
  5952. Scanner.prototype.scanString = function scanString() {
  5953. assert(this.peek === $SQ || this.peek === $DQ);
  5954. var start = this.index;
  5955. var quote = this.peek;
  5956. this.advance();
  5957. var buffer = void 0;
  5958. var marker = this.index;
  5959. while (this.peek !== quote) {
  5960. if (this.peek === $BACKSLASH) {
  5961. if (!buffer) {
  5962. buffer = [];
  5963. }
  5964. buffer.push(this.input.substring(marker, this.index));
  5965. this.advance();
  5966. var _unescaped = void 0;
  5967. if (this.peek === $u) {
  5968. var hex = this.input.substring(this.index + 1, this.index + 5);
  5969. if (!/[A-Z0-9]{4}/.test(hex)) {
  5970. this.error('Invalid unicode escape [\\u' + hex + ']');
  5971. }
  5972. _unescaped = parseInt(hex, 16);
  5973. for (var _i21 = 0; _i21 < 5; ++_i21) {
  5974. this.advance();
  5975. }
  5976. } else {
  5977. _unescaped = unescape(this.peek);
  5978. this.advance();
  5979. }
  5980. buffer.push(String.fromCharCode(_unescaped));
  5981. marker = this.index;
  5982. } else if (this.peek === $EOF) {
  5983. this.error('Unterminated quote');
  5984. } else {
  5985. this.advance();
  5986. }
  5987. }
  5988. var last = this.input.substring(marker, this.index);
  5989. this.advance();
  5990. var text = this.input.substring(start, this.index);
  5991. var unescaped = last;
  5992. if (buffer !== null && buffer !== undefined) {
  5993. buffer.push(last);
  5994. unescaped = buffer.join('');
  5995. }
  5996. return new Token(start, text).withValue(unescaped);
  5997. };
  5998. Scanner.prototype.advance = function advance() {
  5999. if (++this.index >= this.length) {
  6000. this.peek = $EOF;
  6001. } else {
  6002. this.peek = this.input.charCodeAt(this.index);
  6003. }
  6004. };
  6005. Scanner.prototype.error = function error(message) {
  6006. var offset = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
  6007. var position = this.index + offset;
  6008. throw new Error('Lexer Error: ' + message + ' at column ' + position + ' in expression [' + this.input + ']');
  6009. };
  6010. return Scanner;
  6011. }();
  6012. var OPERATORS = ['undefined', 'null', 'true', 'false', '+', '-', '*', '/', '%', '^', '=', '==', '===', '!=', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?'];
  6013. var $EOF = 0;
  6014. var $TAB = 9;
  6015. var $LF = 10;
  6016. var $VTAB = 11;
  6017. var $FF = 12;
  6018. var $CR = 13;
  6019. var $SPACE = 32;
  6020. var $BANG = 33;
  6021. var $DQ = 34;
  6022. var $$ = 36;
  6023. var $PERCENT = 37;
  6024. var $AMPERSAND = 38;
  6025. var $SQ = 39;
  6026. var $LPAREN = 40;
  6027. var $RPAREN = 41;
  6028. var $STAR = 42;
  6029. var $PLUS = 43;
  6030. var $COMMA = 44;
  6031. var $MINUS = 45;
  6032. var $PERIOD = 46;
  6033. var $SLASH = 47;
  6034. var $COLON = 58;
  6035. var $SEMICOLON = 59;
  6036. var $LT = 60;
  6037. var $EQ = 61;
  6038. var $GT = 62;
  6039. var $QUESTION = 63;
  6040. var $0 = 48;
  6041. var $9 = 57;
  6042. var $A = 65;
  6043. var $E = 69;
  6044. var $Z = 90;
  6045. var $LBRACKET = 91;
  6046. var $BACKSLASH = 92;
  6047. var $RBRACKET = 93;
  6048. var $CARET = 94;
  6049. var $_ = 95;
  6050. var $a = 97;
  6051. var $e = 101;
  6052. var $f = 102;
  6053. var $n = 110;
  6054. var $r = 114;
  6055. var $t = 116;
  6056. var $u = 117;
  6057. var $v = 118;
  6058. var $z = 122;
  6059. var $LBRACE = 123;
  6060. var $BAR = 124;
  6061. var $RBRACE = 125;
  6062. var $NBSP = 160;
  6063. function isWhitespace(code) {
  6064. return code >= $TAB && code <= $SPACE || code === $NBSP;
  6065. }
  6066. function isIdentifierStart(code) {
  6067. return $a <= code && code <= $z || $A <= code && code <= $Z || code === $_ || code === $$;
  6068. }
  6069. function isIdentifierPart(code) {
  6070. return $a <= code && code <= $z || $A <= code && code <= $Z || $0 <= code && code <= $9 || code === $_ || code === $$;
  6071. }
  6072. function isDigit(code) {
  6073. return $0 <= code && code <= $9;
  6074. }
  6075. function isExponentStart(code) {
  6076. return code === $e || code === $E;
  6077. }
  6078. function isExponentSign(code) {
  6079. return code === $MINUS || code === $PLUS;
  6080. }
  6081. function unescape(code) {
  6082. switch (code) {
  6083. case $n:
  6084. return $LF;
  6085. case $f:
  6086. return $FF;
  6087. case $r:
  6088. return $CR;
  6089. case $t:
  6090. return $TAB;
  6091. case $v:
  6092. return $VTAB;
  6093. default:
  6094. return code;
  6095. }
  6096. }
  6097. function assert(condition, message) {
  6098. if (!condition) {
  6099. throw message || 'Assertion failed';
  6100. }
  6101. }
  6102. var EOF = new Token(-1, null);
  6103. var Parser = exports.Parser = function () {
  6104. function Parser() {
  6105. this.cache = {};
  6106. this.lexer = new Lexer();
  6107. }
  6108. Parser.prototype.parse = function parse(input) {
  6109. input = input || '';
  6110. return this.cache[input] || (this.cache[input] = new ParserImplementation(this.lexer, input).parseChain());
  6111. };
  6112. return Parser;
  6113. }();
  6114. var ParserImplementation = exports.ParserImplementation = function () {
  6115. function ParserImplementation(lexer, input) {
  6116. this.index = 0;
  6117. this.input = input;
  6118. this.tokens = lexer.lex(input);
  6119. }
  6120. ParserImplementation.prototype.parseChain = function parseChain() {
  6121. var isChain = false;
  6122. var expressions = [];
  6123. while (this.optional(';')) {
  6124. isChain = true;
  6125. }
  6126. while (this.index < this.tokens.length) {
  6127. if (this.peek.text === ')' || this.peek.text === '}' || this.peek.text === ']') {
  6128. this.error('Unconsumed token ' + this.peek.text);
  6129. }
  6130. var expr = this.parseBindingBehavior();
  6131. expressions.push(expr);
  6132. while (this.optional(';')) {
  6133. isChain = true;
  6134. }
  6135. if (isChain) {
  6136. this.error('Multiple expressions are not allowed.');
  6137. }
  6138. }
  6139. return expressions.length === 1 ? expressions[0] : new Chain(expressions);
  6140. };
  6141. ParserImplementation.prototype.parseBindingBehavior = function parseBindingBehavior() {
  6142. var result = this.parseValueConverter();
  6143. while (this.optional('&')) {
  6144. var name = this.peek.text;
  6145. var args = [];
  6146. this.advance();
  6147. while (this.optional(':')) {
  6148. args.push(this.parseExpression());
  6149. }
  6150. result = new BindingBehavior(result, name, args);
  6151. }
  6152. return result;
  6153. };
  6154. ParserImplementation.prototype.parseValueConverter = function parseValueConverter() {
  6155. var result = this.parseExpression();
  6156. while (this.optional('|')) {
  6157. var name = this.peek.text;
  6158. var args = [];
  6159. this.advance();
  6160. while (this.optional(':')) {
  6161. args.push(this.parseExpression());
  6162. }
  6163. result = new ValueConverter(result, name, args, [result].concat(args));
  6164. }
  6165. return result;
  6166. };
  6167. ParserImplementation.prototype.parseExpression = function parseExpression() {
  6168. var start = this.peek.index;
  6169. var result = this.parseConditional();
  6170. while (this.peek.text === '=') {
  6171. if (!result.isAssignable) {
  6172. var end = this.index < this.tokens.length ? this.peek.index : this.input.length;
  6173. var _expression = this.input.substring(start, end);
  6174. this.error('Expression ' + _expression + ' is not assignable');
  6175. }
  6176. this.expect('=');
  6177. result = new Assign(result, this.parseConditional());
  6178. }
  6179. return result;
  6180. };
  6181. ParserImplementation.prototype.parseConditional = function parseConditional() {
  6182. var start = this.peek.index;
  6183. var result = this.parseLogicalOr();
  6184. if (this.optional('?')) {
  6185. var yes = this.parseExpression();
  6186. if (!this.optional(':')) {
  6187. var end = this.index < this.tokens.length ? this.peek.index : this.input.length;
  6188. var _expression2 = this.input.substring(start, end);
  6189. this.error('Conditional expression ' + _expression2 + ' requires all 3 expressions');
  6190. }
  6191. var no = this.parseExpression();
  6192. result = new Conditional(result, yes, no);
  6193. }
  6194. return result;
  6195. };
  6196. ParserImplementation.prototype.parseLogicalOr = function parseLogicalOr() {
  6197. var result = this.parseLogicalAnd();
  6198. while (this.optional('||')) {
  6199. result = new Binary('||', result, this.parseLogicalAnd());
  6200. }
  6201. return result;
  6202. };
  6203. ParserImplementation.prototype.parseLogicalAnd = function parseLogicalAnd() {
  6204. var result = this.parseEquality();
  6205. while (this.optional('&&')) {
  6206. result = new Binary('&&', result, this.parseEquality());
  6207. }
  6208. return result;
  6209. };
  6210. ParserImplementation.prototype.parseEquality = function parseEquality() {
  6211. var result = this.parseRelational();
  6212. while (true) {
  6213. if (this.optional('==')) {
  6214. result = new Binary('==', result, this.parseRelational());
  6215. } else if (this.optional('!=')) {
  6216. result = new Binary('!=', result, this.parseRelational());
  6217. } else if (this.optional('===')) {
  6218. result = new Binary('===', result, this.parseRelational());
  6219. } else if (this.optional('!==')) {
  6220. result = new Binary('!==', result, this.parseRelational());
  6221. } else {
  6222. return result;
  6223. }
  6224. }
  6225. };
  6226. ParserImplementation.prototype.parseRelational = function parseRelational() {
  6227. var result = this.parseAdditive();
  6228. while (true) {
  6229. if (this.optional('<')) {
  6230. result = new Binary('<', result, this.parseAdditive());
  6231. } else if (this.optional('>')) {
  6232. result = new Binary('>', result, this.parseAdditive());
  6233. } else if (this.optional('<=')) {
  6234. result = new Binary('<=', result, this.parseAdditive());
  6235. } else if (this.optional('>=')) {
  6236. result = new Binary('>=', result, this.parseAdditive());
  6237. } else {
  6238. return result;
  6239. }
  6240. }
  6241. };
  6242. ParserImplementation.prototype.parseAdditive = function parseAdditive() {
  6243. var result = this.parseMultiplicative();
  6244. while (true) {
  6245. if (this.optional('+')) {
  6246. result = new Binary('+', result, this.parseMultiplicative());
  6247. } else if (this.optional('-')) {
  6248. result = new Binary('-', result, this.parseMultiplicative());
  6249. } else {
  6250. return result;
  6251. }
  6252. }
  6253. };
  6254. ParserImplementation.prototype.parseMultiplicative = function parseMultiplicative() {
  6255. var result = this.parsePrefix();
  6256. while (true) {
  6257. if (this.optional('*')) {
  6258. result = new Binary('*', result, this.parsePrefix());
  6259. } else if (this.optional('%')) {
  6260. result = new Binary('%', result, this.parsePrefix());
  6261. } else if (this.optional('/')) {
  6262. result = new Binary('/', result, this.parsePrefix());
  6263. } else {
  6264. return result;
  6265. }
  6266. }
  6267. };
  6268. ParserImplementation.prototype.parsePrefix = function parsePrefix() {
  6269. if (this.optional('+')) {
  6270. return this.parsePrefix();
  6271. } else if (this.optional('-')) {
  6272. return new Binary('-', new LiteralPrimitive(0), this.parsePrefix());
  6273. } else if (this.optional('!')) {
  6274. return new PrefixNot('!', this.parsePrefix());
  6275. }
  6276. return this.parseAccessOrCallMember();
  6277. };
  6278. ParserImplementation.prototype.parseAccessOrCallMember = function parseAccessOrCallMember() {
  6279. var result = this.parsePrimary();
  6280. while (true) {
  6281. if (this.optional('.')) {
  6282. var name = this.peek.text;
  6283. this.advance();
  6284. if (this.optional('(')) {
  6285. var args = this.parseExpressionList(')');
  6286. this.expect(')');
  6287. if (result instanceof AccessThis) {
  6288. result = new CallScope(name, args, result.ancestor);
  6289. } else {
  6290. result = new CallMember(result, name, args);
  6291. }
  6292. } else {
  6293. if (result instanceof AccessThis) {
  6294. result = new AccessScope(name, result.ancestor);
  6295. } else {
  6296. result = new AccessMember(result, name);
  6297. }
  6298. }
  6299. } else if (this.optional('[')) {
  6300. var key = this.parseExpression();
  6301. this.expect(']');
  6302. result = new AccessKeyed(result, key);
  6303. } else if (this.optional('(')) {
  6304. var _args = this.parseExpressionList(')');
  6305. this.expect(')');
  6306. result = new CallFunction(result, _args);
  6307. } else {
  6308. return result;
  6309. }
  6310. }
  6311. };
  6312. ParserImplementation.prototype.parsePrimary = function parsePrimary() {
  6313. if (this.optional('(')) {
  6314. var result = this.parseExpression();
  6315. this.expect(')');
  6316. return result;
  6317. } else if (this.optional('null')) {
  6318. return new LiteralPrimitive(null);
  6319. } else if (this.optional('undefined')) {
  6320. return new LiteralPrimitive(undefined);
  6321. } else if (this.optional('true')) {
  6322. return new LiteralPrimitive(true);
  6323. } else if (this.optional('false')) {
  6324. return new LiteralPrimitive(false);
  6325. } else if (this.optional('[')) {
  6326. var elements = this.parseExpressionList(']');
  6327. this.expect(']');
  6328. return new LiteralArray(elements);
  6329. } else if (this.peek.text === '{') {
  6330. return this.parseObject();
  6331. } else if (this.peek.key !== null && this.peek.key !== undefined) {
  6332. return this.parseAccessOrCallScope();
  6333. } else if (this.peek.value !== null && this.peek.value !== undefined) {
  6334. var value = this.peek.value;
  6335. this.advance();
  6336. return value instanceof String || typeof value === 'string' ? new LiteralString(value) : new LiteralPrimitive(value);
  6337. } else if (this.index >= this.tokens.length) {
  6338. throw new Error('Unexpected end of expression: ' + this.input);
  6339. } else {
  6340. this.error('Unexpected token ' + this.peek.text);
  6341. }
  6342. };
  6343. ParserImplementation.prototype.parseAccessOrCallScope = function parseAccessOrCallScope() {
  6344. var name = this.peek.key;
  6345. this.advance();
  6346. if (name === '$this') {
  6347. return new AccessThis(0);
  6348. }
  6349. var ancestor = 0;
  6350. while (name === '$parent') {
  6351. ancestor++;
  6352. if (this.optional('.')) {
  6353. name = this.peek.key;
  6354. this.advance();
  6355. } else if (this.peek === EOF || this.peek.text === '(' || this.peek.text === '[' || this.peek.text === '}') {
  6356. return new AccessThis(ancestor);
  6357. } else {
  6358. this.error('Unexpected token ' + this.peek.text);
  6359. }
  6360. }
  6361. if (this.optional('(')) {
  6362. var args = this.parseExpressionList(')');
  6363. this.expect(')');
  6364. return new CallScope(name, args, ancestor);
  6365. }
  6366. return new AccessScope(name, ancestor);
  6367. };
  6368. ParserImplementation.prototype.parseObject = function parseObject() {
  6369. var keys = [];
  6370. var values = [];
  6371. this.expect('{');
  6372. if (this.peek.text !== '}') {
  6373. do {
  6374. var peek = this.peek;
  6375. var value = peek.value;
  6376. keys.push(typeof value === 'string' ? value : peek.text);
  6377. this.advance();
  6378. if (peek.key && (this.peek.text === ',' || this.peek.text === '}')) {
  6379. --this.index;
  6380. values.push(this.parseAccessOrCallScope());
  6381. } else {
  6382. this.expect(':');
  6383. values.push(this.parseExpression());
  6384. }
  6385. } while (this.optional(','));
  6386. }
  6387. this.expect('}');
  6388. return new LiteralObject(keys, values);
  6389. };
  6390. ParserImplementation.prototype.parseExpressionList = function parseExpressionList(terminator) {
  6391. var result = [];
  6392. if (this.peek.text !== terminator) {
  6393. do {
  6394. result.push(this.parseExpression());
  6395. } while (this.optional(','));
  6396. }
  6397. return result;
  6398. };
  6399. ParserImplementation.prototype.optional = function optional(text) {
  6400. if (this.peek.text === text) {
  6401. this.advance();
  6402. return true;
  6403. }
  6404. return false;
  6405. };
  6406. ParserImplementation.prototype.expect = function expect(text) {
  6407. if (this.peek.text === text) {
  6408. this.advance();
  6409. } else {
  6410. this.error('Missing expected ' + text);
  6411. }
  6412. };
  6413. ParserImplementation.prototype.advance = function advance() {
  6414. this.index++;
  6415. };
  6416. ParserImplementation.prototype.error = function error(message) {
  6417. var location = this.index < this.tokens.length ? 'at column ' + (this.tokens[this.index].index + 1) + ' in' : 'at the end of the expression';
  6418. throw new Error('Parser Error: ' + message + ' ' + location + ' [' + this.input + ']');
  6419. };
  6420. _createClass(ParserImplementation, [{
  6421. key: 'peek',
  6422. get: function get() {
  6423. return this.index < this.tokens.length ? this.tokens[this.index] : EOF;
  6424. }
  6425. }]);
  6426. return ParserImplementation;
  6427. }();
  6428. var mapProto = Map.prototype;
  6429. function _getMapObserver(taskQueue, map) {
  6430. return ModifyMapObserver.for(taskQueue, map);
  6431. }
  6432. exports.getMapObserver = _getMapObserver;
  6433. var ModifyMapObserver = function (_ModifyCollectionObse2) {
  6434. _inherits(ModifyMapObserver, _ModifyCollectionObse2);
  6435. function ModifyMapObserver(taskQueue, map) {
  6436. return _possibleConstructorReturn(this, _ModifyCollectionObse2.call(this, taskQueue, map));
  6437. }
  6438. ModifyMapObserver.for = function _for(taskQueue, map) {
  6439. if (!('__map_observer__' in map)) {
  6440. Reflect.defineProperty(map, '__map_observer__', {
  6441. value: ModifyMapObserver.create(taskQueue, map),
  6442. enumerable: false, configurable: false
  6443. });
  6444. }
  6445. return map.__map_observer__;
  6446. };
  6447. ModifyMapObserver.create = function create(taskQueue, map) {
  6448. var observer = new ModifyMapObserver(taskQueue, map);
  6449. var proto = mapProto;
  6450. if (proto.add !== map.add || proto.delete !== map.delete || proto.clear !== map.clear) {
  6451. proto = {
  6452. add: map.add,
  6453. delete: map.delete,
  6454. clear: map.clear
  6455. };
  6456. }
  6457. map.set = function () {
  6458. var hasValue = map.has(arguments[0]);
  6459. var type = hasValue ? 'update' : 'add';
  6460. var oldValue = map.get(arguments[0]);
  6461. var methodCallResult = proto.set.apply(map, arguments);
  6462. if (!hasValue || oldValue !== map.get(arguments[0])) {
  6463. observer.addChangeRecord({
  6464. type: type,
  6465. object: map,
  6466. key: arguments[0],
  6467. oldValue: oldValue
  6468. });
  6469. }
  6470. return methodCallResult;
  6471. };
  6472. map.delete = function () {
  6473. var hasValue = map.has(arguments[0]);
  6474. var oldValue = map.get(arguments[0]);
  6475. var methodCallResult = proto.delete.apply(map, arguments);
  6476. if (hasValue) {
  6477. observer.addChangeRecord({
  6478. type: 'delete',
  6479. object: map,
  6480. key: arguments[0],
  6481. oldValue: oldValue
  6482. });
  6483. }
  6484. return methodCallResult;
  6485. };
  6486. map.clear = function () {
  6487. var methodCallResult = proto.clear.apply(map, arguments);
  6488. observer.addChangeRecord({
  6489. type: 'clear',
  6490. object: map
  6491. });
  6492. return methodCallResult;
  6493. };
  6494. return observer;
  6495. };
  6496. return ModifyMapObserver;
  6497. }(ModifyCollectionObserver);
  6498. function findOriginalEventTarget(event) {
  6499. return event.path && event.path[0] || event.deepPath && event.deepPath[0] || event.target;
  6500. }
  6501. function interceptStopPropagation(event) {
  6502. event.standardStopPropagation = event.stopPropagation;
  6503. event.stopPropagation = function () {
  6504. this.propagationStopped = true;
  6505. this.standardStopPropagation();
  6506. };
  6507. }
  6508. function handleDelegatedEvent(event) {
  6509. var interceptInstalled = false;
  6510. event.propagationStopped = false;
  6511. var target = findOriginalEventTarget(event);
  6512. while (target && !event.propagationStopped) {
  6513. if (target.delegatedCallbacks) {
  6514. var callback = target.delegatedCallbacks[event.type];
  6515. if (callback) {
  6516. if (!interceptInstalled) {
  6517. interceptStopPropagation(event);
  6518. interceptInstalled = true;
  6519. }
  6520. callback(event);
  6521. }
  6522. }
  6523. target = target.parentNode;
  6524. }
  6525. }
  6526. var DelegateHandlerEntry = function () {
  6527. function DelegateHandlerEntry(eventName) {
  6528. this.eventName = eventName;
  6529. this.count = 0;
  6530. }
  6531. DelegateHandlerEntry.prototype.increment = function increment() {
  6532. this.count++;
  6533. if (this.count === 1) {
  6534. _aureliaPal.DOM.addEventListener(this.eventName, handleDelegatedEvent, false);
  6535. }
  6536. };
  6537. DelegateHandlerEntry.prototype.decrement = function decrement() {
  6538. this.count--;
  6539. if (this.count === 0) {
  6540. _aureliaPal.DOM.removeEventListener(this.eventName, handleDelegatedEvent);
  6541. }
  6542. };
  6543. return DelegateHandlerEntry;
  6544. }();
  6545. var DefaultEventStrategy = function () {
  6546. function DefaultEventStrategy() {
  6547. this.delegatedHandlers = {};
  6548. }
  6549. DefaultEventStrategy.prototype.subscribe = function subscribe(target, targetEvent, callback, delegate) {
  6550. var _this22 = this;
  6551. if (delegate) {
  6552. var _ret = function () {
  6553. var delegatedHandlers = _this22.delegatedHandlers;
  6554. var handlerEntry = delegatedHandlers[targetEvent] || (delegatedHandlers[targetEvent] = new DelegateHandlerEntry(targetEvent));
  6555. var delegatedCallbacks = target.delegatedCallbacks || (target.delegatedCallbacks = {});
  6556. handlerEntry.increment();
  6557. delegatedCallbacks[targetEvent] = callback;
  6558. return {
  6559. v: function v() {
  6560. handlerEntry.decrement();
  6561. delegatedCallbacks[targetEvent] = null;
  6562. }
  6563. };
  6564. }();
  6565. if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
  6566. }
  6567. target.addEventListener(targetEvent, callback, false);
  6568. return function () {
  6569. target.removeEventListener(targetEvent, callback);
  6570. };
  6571. };
  6572. return DefaultEventStrategy;
  6573. }();
  6574. var EventManager = exports.EventManager = function () {
  6575. function EventManager() {
  6576. this.elementHandlerLookup = {};
  6577. this.eventStrategyLookup = {};
  6578. this.registerElementConfig({
  6579. tagName: 'input',
  6580. properties: {
  6581. value: ['change', 'input'],
  6582. checked: ['change', 'input'],
  6583. files: ['change', 'input']
  6584. }
  6585. });
  6586. this.registerElementConfig({
  6587. tagName: 'textarea',
  6588. properties: {
  6589. value: ['change', 'input']
  6590. }
  6591. });
  6592. this.registerElementConfig({
  6593. tagName: 'select',
  6594. properties: {
  6595. value: ['change']
  6596. }
  6597. });
  6598. this.registerElementConfig({
  6599. tagName: 'content editable',
  6600. properties: {
  6601. value: ['change', 'input', 'blur', 'keyup', 'paste']
  6602. }
  6603. });
  6604. this.registerElementConfig({
  6605. tagName: 'scrollable element',
  6606. properties: {
  6607. scrollTop: ['scroll'],
  6608. scrollLeft: ['scroll']
  6609. }
  6610. });
  6611. this.defaultEventStrategy = new DefaultEventStrategy();
  6612. }
  6613. EventManager.prototype.registerElementConfig = function registerElementConfig(config) {
  6614. var tagName = config.tagName.toLowerCase();
  6615. var properties = config.properties;
  6616. var propertyName = void 0;
  6617. this.elementHandlerLookup[tagName] = {};
  6618. for (propertyName in properties) {
  6619. if (properties.hasOwnProperty(propertyName)) {
  6620. this.registerElementPropertyConfig(tagName, propertyName, properties[propertyName]);
  6621. }
  6622. }
  6623. };
  6624. EventManager.prototype.registerElementPropertyConfig = function registerElementPropertyConfig(tagName, propertyName, events) {
  6625. this.elementHandlerLookup[tagName][propertyName] = this.createElementHandler(events);
  6626. };
  6627. EventManager.prototype.createElementHandler = function createElementHandler(events) {
  6628. return {
  6629. subscribe: function subscribe(target, callback) {
  6630. events.forEach(function (changeEvent) {
  6631. target.addEventListener(changeEvent, callback, false);
  6632. });
  6633. return function () {
  6634. events.forEach(function (changeEvent) {
  6635. target.removeEventListener(changeEvent, callback);
  6636. });
  6637. };
  6638. }
  6639. };
  6640. };
  6641. EventManager.prototype.registerElementHandler = function registerElementHandler(tagName, handler) {
  6642. this.elementHandlerLookup[tagName.toLowerCase()] = handler;
  6643. };
  6644. EventManager.prototype.registerEventStrategy = function registerEventStrategy(eventName, strategy) {
  6645. this.eventStrategyLookup[eventName] = strategy;
  6646. };
  6647. EventManager.prototype.getElementHandler = function getElementHandler(target, propertyName) {
  6648. var tagName = void 0;
  6649. var lookup = this.elementHandlerLookup;
  6650. if (target.tagName) {
  6651. tagName = target.tagName.toLowerCase();
  6652. if (lookup[tagName] && lookup[tagName][propertyName]) {
  6653. return lookup[tagName][propertyName];
  6654. }
  6655. if (propertyName === 'textContent' || propertyName === 'innerHTML') {
  6656. return lookup['content editable'].value;
  6657. }
  6658. if (propertyName === 'scrollTop' || propertyName === 'scrollLeft') {
  6659. return lookup['scrollable element'][propertyName];
  6660. }
  6661. }
  6662. return null;
  6663. };
  6664. EventManager.prototype.addEventListener = function addEventListener(target, targetEvent, callback, delegate) {
  6665. return (this.eventStrategyLookup[targetEvent] || this.defaultEventStrategy).subscribe(target, targetEvent, callback, delegate);
  6666. };
  6667. return EventManager;
  6668. }();
  6669. var DirtyChecker = exports.DirtyChecker = function () {
  6670. function DirtyChecker() {
  6671. this.tracked = [];
  6672. this.checkDelay = 120;
  6673. }
  6674. DirtyChecker.prototype.addProperty = function addProperty(property) {
  6675. var tracked = this.tracked;
  6676. tracked.push(property);
  6677. if (tracked.length === 1) {
  6678. this.scheduleDirtyCheck();
  6679. }
  6680. };
  6681. DirtyChecker.prototype.removeProperty = function removeProperty(property) {
  6682. var tracked = this.tracked;
  6683. tracked.splice(tracked.indexOf(property), 1);
  6684. };
  6685. DirtyChecker.prototype.scheduleDirtyCheck = function scheduleDirtyCheck() {
  6686. var _this23 = this;
  6687. setTimeout(function () {
  6688. return _this23.check();
  6689. }, this.checkDelay);
  6690. };
  6691. DirtyChecker.prototype.check = function check() {
  6692. var tracked = this.tracked;
  6693. var i = tracked.length;
  6694. while (i--) {
  6695. var current = tracked[i];
  6696. if (current.isDirty()) {
  6697. current.call();
  6698. }
  6699. }
  6700. if (tracked.length) {
  6701. this.scheduleDirtyCheck();
  6702. }
  6703. };
  6704. return DirtyChecker;
  6705. }();
  6706. var DirtyCheckProperty = exports.DirtyCheckProperty = (_dec5 = subscriberCollection(), _dec5(_class5 = function () {
  6707. function DirtyCheckProperty(dirtyChecker, obj, propertyName) {
  6708. this.dirtyChecker = dirtyChecker;
  6709. this.obj = obj;
  6710. this.propertyName = propertyName;
  6711. }
  6712. DirtyCheckProperty.prototype.getValue = function getValue() {
  6713. return this.obj[this.propertyName];
  6714. };
  6715. DirtyCheckProperty.prototype.setValue = function setValue(newValue) {
  6716. this.obj[this.propertyName] = newValue;
  6717. };
  6718. DirtyCheckProperty.prototype.call = function call() {
  6719. var oldValue = this.oldValue;
  6720. var newValue = this.getValue();
  6721. this.callSubscribers(newValue, oldValue);
  6722. this.oldValue = newValue;
  6723. };
  6724. DirtyCheckProperty.prototype.isDirty = function isDirty() {
  6725. return this.oldValue !== this.obj[this.propertyName];
  6726. };
  6727. DirtyCheckProperty.prototype.subscribe = function subscribe(context, callable) {
  6728. if (!this.hasSubscribers()) {
  6729. this.oldValue = this.getValue();
  6730. this.dirtyChecker.addProperty(this);
  6731. }
  6732. this.addSubscriber(context, callable);
  6733. };
  6734. DirtyCheckProperty.prototype.unsubscribe = function unsubscribe(context, callable) {
  6735. if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
  6736. this.dirtyChecker.removeProperty(this);
  6737. }
  6738. };
  6739. return DirtyCheckProperty;
  6740. }()) || _class5);
  6741. var logger = LogManager.getLogger('property-observation');
  6742. var propertyAccessor = exports.propertyAccessor = {
  6743. getValue: function getValue(obj, propertyName) {
  6744. return obj[propertyName];
  6745. },
  6746. setValue: function setValue(value, obj, propertyName) {
  6747. obj[propertyName] = value;
  6748. }
  6749. };
  6750. var PrimitiveObserver = exports.PrimitiveObserver = function () {
  6751. function PrimitiveObserver(primitive, propertyName) {
  6752. this.doNotCache = true;
  6753. this.primitive = primitive;
  6754. this.propertyName = propertyName;
  6755. }
  6756. PrimitiveObserver.prototype.getValue = function getValue() {
  6757. return this.primitive[this.propertyName];
  6758. };
  6759. PrimitiveObserver.prototype.setValue = function setValue() {
  6760. var type = _typeof(this.primitive);
  6761. throw new Error('The ' + this.propertyName + ' property of a ' + type + ' (' + this.primitive + ') cannot be assigned.');
  6762. };
  6763. PrimitiveObserver.prototype.subscribe = function subscribe() {};
  6764. PrimitiveObserver.prototype.unsubscribe = function unsubscribe() {};
  6765. return PrimitiveObserver;
  6766. }();
  6767. var SetterObserver = exports.SetterObserver = (_dec6 = subscriberCollection(), _dec6(_class7 = function () {
  6768. function SetterObserver(taskQueue, obj, propertyName) {
  6769. this.taskQueue = taskQueue;
  6770. this.obj = obj;
  6771. this.propertyName = propertyName;
  6772. this.queued = false;
  6773. this.observing = false;
  6774. }
  6775. SetterObserver.prototype.getValue = function getValue() {
  6776. return this.obj[this.propertyName];
  6777. };
  6778. SetterObserver.prototype.setValue = function setValue(newValue) {
  6779. this.obj[this.propertyName] = newValue;
  6780. };
  6781. SetterObserver.prototype.getterValue = function getterValue() {
  6782. return this.currentValue;
  6783. };
  6784. SetterObserver.prototype.setterValue = function setterValue(newValue) {
  6785. var oldValue = this.currentValue;
  6786. if (oldValue !== newValue) {
  6787. if (!this.queued) {
  6788. this.oldValue = oldValue;
  6789. this.queued = true;
  6790. this.taskQueue.queueMicroTask(this);
  6791. }
  6792. this.currentValue = newValue;
  6793. }
  6794. };
  6795. SetterObserver.prototype.call = function call() {
  6796. var oldValue = this.oldValue;
  6797. var newValue = this.currentValue;
  6798. this.queued = false;
  6799. this.callSubscribers(newValue, oldValue);
  6800. };
  6801. SetterObserver.prototype.subscribe = function subscribe(context, callable) {
  6802. if (!this.observing) {
  6803. this.convertProperty();
  6804. }
  6805. this.addSubscriber(context, callable);
  6806. };
  6807. SetterObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
  6808. this.removeSubscriber(context, callable);
  6809. };
  6810. SetterObserver.prototype.convertProperty = function convertProperty() {
  6811. this.observing = true;
  6812. this.currentValue = this.obj[this.propertyName];
  6813. this.setValue = this.setterValue;
  6814. this.getValue = this.getterValue;
  6815. if (!Reflect.defineProperty(this.obj, this.propertyName, {
  6816. configurable: true,
  6817. enumerable: this.propertyName in this.obj ? this.obj.propertyIsEnumerable(this.propertyName) : true,
  6818. get: this.getValue.bind(this),
  6819. set: this.setValue.bind(this)
  6820. })) {
  6821. logger.warn('Cannot observe property \'' + this.propertyName + '\' of object', this.obj);
  6822. }
  6823. };
  6824. return SetterObserver;
  6825. }()) || _class7);
  6826. var XLinkAttributeObserver = exports.XLinkAttributeObserver = function () {
  6827. function XLinkAttributeObserver(element, propertyName, attributeName) {
  6828. this.element = element;
  6829. this.propertyName = propertyName;
  6830. this.attributeName = attributeName;
  6831. }
  6832. XLinkAttributeObserver.prototype.getValue = function getValue() {
  6833. return this.element.getAttributeNS('http://www.w3.org/1999/xlink', this.attributeName);
  6834. };
  6835. XLinkAttributeObserver.prototype.setValue = function setValue(newValue) {
  6836. return this.element.setAttributeNS('http://www.w3.org/1999/xlink', this.attributeName, newValue);
  6837. };
  6838. XLinkAttributeObserver.prototype.subscribe = function subscribe() {
  6839. throw new Error('Observation of a "' + this.element.nodeName + '" element\'s "' + this.propertyName + '" property is not supported.');
  6840. };
  6841. return XLinkAttributeObserver;
  6842. }();
  6843. var dataAttributeAccessor = exports.dataAttributeAccessor = {
  6844. getValue: function getValue(obj, propertyName) {
  6845. return obj.getAttribute(propertyName);
  6846. },
  6847. setValue: function setValue(value, obj, propertyName) {
  6848. return obj.setAttribute(propertyName, value);
  6849. }
  6850. };
  6851. var DataAttributeObserver = exports.DataAttributeObserver = function () {
  6852. function DataAttributeObserver(element, propertyName) {
  6853. this.element = element;
  6854. this.propertyName = propertyName;
  6855. }
  6856. DataAttributeObserver.prototype.getValue = function getValue() {
  6857. return this.element.getAttribute(this.propertyName);
  6858. };
  6859. DataAttributeObserver.prototype.setValue = function setValue(newValue) {
  6860. return this.element.setAttribute(this.propertyName, newValue);
  6861. };
  6862. DataAttributeObserver.prototype.subscribe = function subscribe() {
  6863. throw new Error('Observation of a "' + this.element.nodeName + '" element\'s "' + this.propertyName + '" property is not supported.');
  6864. };
  6865. return DataAttributeObserver;
  6866. }();
  6867. var StyleObserver = exports.StyleObserver = function () {
  6868. function StyleObserver(element, propertyName) {
  6869. this.element = element;
  6870. this.propertyName = propertyName;
  6871. this.styles = null;
  6872. this.version = 0;
  6873. }
  6874. StyleObserver.prototype.getValue = function getValue() {
  6875. return this.element.style.cssText;
  6876. };
  6877. StyleObserver.prototype.setValue = function setValue(newValue) {
  6878. var styles = this.styles || {};
  6879. var style = void 0;
  6880. var version = this.version;
  6881. if (newValue !== null && newValue !== undefined) {
  6882. if (newValue instanceof Object) {
  6883. for (style in newValue) {
  6884. if (newValue.hasOwnProperty(style)) {
  6885. styles[style] = version;
  6886. this.element.style[style] = newValue[style];
  6887. }
  6888. }
  6889. } else if (newValue.length) {
  6890. var rx = /\s*([\w\-]+)\s*:\s*((?:(?:[\w\-]+\(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[\w\-]+\(\s*(?:^"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^\)]*)\),?|[^\)]*)\),?|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^;]*),?\s*)+);?/g;
  6891. var pair = void 0;
  6892. while ((pair = rx.exec(newValue)) !== null) {
  6893. style = pair[1];
  6894. if (!style) {
  6895. continue;
  6896. }
  6897. styles[style] = version;
  6898. this.element.style[style] = pair[2];
  6899. }
  6900. }
  6901. }
  6902. this.styles = styles;
  6903. this.version += 1;
  6904. if (version === 0) {
  6905. return;
  6906. }
  6907. version -= 1;
  6908. for (style in styles) {
  6909. if (!styles.hasOwnProperty(style) || styles[style] !== version) {
  6910. continue;
  6911. }
  6912. this.element.style[style] = '';
  6913. }
  6914. };
  6915. StyleObserver.prototype.subscribe = function subscribe() {
  6916. throw new Error('Observation of a "' + this.element.nodeName + '" element\'s "' + this.propertyName + '" property is not supported.');
  6917. };
  6918. return StyleObserver;
  6919. }();
  6920. var ValueAttributeObserver = exports.ValueAttributeObserver = (_dec7 = subscriberCollection(), _dec7(_class8 = function () {
  6921. function ValueAttributeObserver(element, propertyName, handler) {
  6922. this.element = element;
  6923. this.propertyName = propertyName;
  6924. this.handler = handler;
  6925. if (propertyName === 'files') {
  6926. this.setValue = function () {};
  6927. }
  6928. }
  6929. ValueAttributeObserver.prototype.getValue = function getValue() {
  6930. return this.element[this.propertyName];
  6931. };
  6932. ValueAttributeObserver.prototype.setValue = function setValue(newValue) {
  6933. newValue = newValue === undefined || newValue === null ? '' : newValue;
  6934. if (this.element[this.propertyName] !== newValue) {
  6935. this.element[this.propertyName] = newValue;
  6936. this.notify();
  6937. }
  6938. };
  6939. ValueAttributeObserver.prototype.notify = function notify() {
  6940. var oldValue = this.oldValue;
  6941. var newValue = this.getValue();
  6942. this.callSubscribers(newValue, oldValue);
  6943. this.oldValue = newValue;
  6944. };
  6945. ValueAttributeObserver.prototype.subscribe = function subscribe(context, callable) {
  6946. if (!this.hasSubscribers()) {
  6947. this.oldValue = this.getValue();
  6948. this.disposeHandler = this.handler.subscribe(this.element, this.notify.bind(this));
  6949. }
  6950. this.addSubscriber(context, callable);
  6951. };
  6952. ValueAttributeObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
  6953. if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
  6954. this.disposeHandler();
  6955. this.disposeHandler = null;
  6956. }
  6957. };
  6958. return ValueAttributeObserver;
  6959. }()) || _class8);
  6960. var checkedArrayContext = 'CheckedObserver:array';
  6961. var checkedValueContext = 'CheckedObserver:value';
  6962. var CheckedObserver = exports.CheckedObserver = (_dec8 = subscriberCollection(), _dec8(_class9 = function () {
  6963. function CheckedObserver(element, handler, observerLocator) {
  6964. this.element = element;
  6965. this.handler = handler;
  6966. this.observerLocator = observerLocator;
  6967. }
  6968. CheckedObserver.prototype.getValue = function getValue() {
  6969. return this.value;
  6970. };
  6971. CheckedObserver.prototype.setValue = function setValue(newValue) {
  6972. if (this.value === newValue) {
  6973. return;
  6974. }
  6975. if (this.arrayObserver) {
  6976. this.arrayObserver.unsubscribe(checkedArrayContext, this);
  6977. this.arrayObserver = null;
  6978. }
  6979. if (this.element.type === 'checkbox' && Array.isArray(newValue)) {
  6980. this.arrayObserver = this.observerLocator.getArrayObserver(newValue);
  6981. this.arrayObserver.subscribe(checkedArrayContext, this);
  6982. }
  6983. this.oldValue = this.value;
  6984. this.value = newValue;
  6985. this.synchronizeElement();
  6986. this.notify();
  6987. if (!this.initialSync) {
  6988. this.initialSync = true;
  6989. this.observerLocator.taskQueue.queueMicroTask(this);
  6990. }
  6991. };
  6992. CheckedObserver.prototype.call = function call(context, splices) {
  6993. this.synchronizeElement();
  6994. if (!this.valueObserver) {
  6995. this.valueObserver = this.element.__observers__.model || this.element.__observers__.value;
  6996. if (this.valueObserver) {
  6997. this.valueObserver.subscribe(checkedValueContext, this);
  6998. }
  6999. }
  7000. };
  7001. CheckedObserver.prototype.synchronizeElement = function synchronizeElement() {
  7002. var value = this.value;
  7003. var element = this.element;
  7004. var elementValue = element.hasOwnProperty('model') ? element.model : element.value;
  7005. var isRadio = element.type === 'radio';
  7006. var matcher = element.matcher || function (a, b) {
  7007. return a === b;
  7008. };
  7009. element.checked = isRadio && !!matcher(value, elementValue) || !isRadio && value === true || !isRadio && Array.isArray(value) && value.findIndex(function (item) {
  7010. return !!matcher(item, elementValue);
  7011. }) !== -1;
  7012. };
  7013. CheckedObserver.prototype.synchronizeValue = function synchronizeValue() {
  7014. var value = this.value;
  7015. var element = this.element;
  7016. var elementValue = element.hasOwnProperty('model') ? element.model : element.value;
  7017. var index = void 0;
  7018. var matcher = element.matcher || function (a, b) {
  7019. return a === b;
  7020. };
  7021. if (element.type === 'checkbox') {
  7022. if (Array.isArray(value)) {
  7023. index = value.findIndex(function (item) {
  7024. return !!matcher(item, elementValue);
  7025. });
  7026. if (element.checked && index === -1) {
  7027. value.push(elementValue);
  7028. } else if (!element.checked && index !== -1) {
  7029. value.splice(index, 1);
  7030. }
  7031. return;
  7032. }
  7033. value = element.checked;
  7034. } else if (element.checked) {
  7035. value = elementValue;
  7036. } else {
  7037. return;
  7038. }
  7039. this.oldValue = this.value;
  7040. this.value = value;
  7041. this.notify();
  7042. };
  7043. CheckedObserver.prototype.notify = function notify() {
  7044. var oldValue = this.oldValue;
  7045. var newValue = this.value;
  7046. this.callSubscribers(newValue, oldValue);
  7047. };
  7048. CheckedObserver.prototype.subscribe = function subscribe(context, callable) {
  7049. if (!this.hasSubscribers()) {
  7050. this.disposeHandler = this.handler.subscribe(this.element, this.synchronizeValue.bind(this, false));
  7051. }
  7052. this.addSubscriber(context, callable);
  7053. };
  7054. CheckedObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
  7055. if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
  7056. this.disposeHandler();
  7057. this.disposeHandler = null;
  7058. }
  7059. };
  7060. CheckedObserver.prototype.unbind = function unbind() {
  7061. if (this.arrayObserver) {
  7062. this.arrayObserver.unsubscribe(checkedArrayContext, this);
  7063. this.arrayObserver = null;
  7064. }
  7065. if (this.valueObserver) {
  7066. this.valueObserver.unsubscribe(checkedValueContext, this);
  7067. }
  7068. };
  7069. return CheckedObserver;
  7070. }()) || _class9);
  7071. var selectArrayContext = 'SelectValueObserver:array';
  7072. var SelectValueObserver = exports.SelectValueObserver = (_dec9 = subscriberCollection(), _dec9(_class10 = function () {
  7073. function SelectValueObserver(element, handler, observerLocator) {
  7074. this.element = element;
  7075. this.handler = handler;
  7076. this.observerLocator = observerLocator;
  7077. }
  7078. SelectValueObserver.prototype.getValue = function getValue() {
  7079. return this.value;
  7080. };
  7081. SelectValueObserver.prototype.setValue = function setValue(newValue) {
  7082. if (newValue !== null && newValue !== undefined && this.element.multiple && !Array.isArray(newValue)) {
  7083. throw new Error('Only null or Array instances can be bound to a multi-select.');
  7084. }
  7085. if (this.value === newValue) {
  7086. return;
  7087. }
  7088. if (this.arrayObserver) {
  7089. this.arrayObserver.unsubscribe(selectArrayContext, this);
  7090. this.arrayObserver = null;
  7091. }
  7092. if (Array.isArray(newValue)) {
  7093. this.arrayObserver = this.observerLocator.getArrayObserver(newValue);
  7094. this.arrayObserver.subscribe(selectArrayContext, this);
  7095. }
  7096. this.oldValue = this.value;
  7097. this.value = newValue;
  7098. this.synchronizeOptions();
  7099. this.notify();
  7100. if (!this.initialSync) {
  7101. this.initialSync = true;
  7102. this.observerLocator.taskQueue.queueMicroTask(this);
  7103. }
  7104. };
  7105. SelectValueObserver.prototype.call = function call(context, splices) {
  7106. this.synchronizeOptions();
  7107. };
  7108. SelectValueObserver.prototype.synchronizeOptions = function synchronizeOptions() {
  7109. var value = this.value;
  7110. var clear = void 0;
  7111. var isArray = void 0;
  7112. if (value === null || value === undefined) {
  7113. clear = true;
  7114. } else if (Array.isArray(value)) {
  7115. isArray = true;
  7116. }
  7117. var options = this.element.options;
  7118. var i = options.length;
  7119. var matcher = this.element.matcher || function (a, b) {
  7120. return a === b;
  7121. };
  7122. var _loop = function _loop() {
  7123. var option = options.item(i);
  7124. if (clear) {
  7125. option.selected = false;
  7126. return 'continue';
  7127. }
  7128. var optionValue = option.hasOwnProperty('model') ? option.model : option.value;
  7129. if (isArray) {
  7130. option.selected = value.findIndex(function (item) {
  7131. return !!matcher(optionValue, item);
  7132. }) !== -1;
  7133. return 'continue';
  7134. }
  7135. option.selected = !!matcher(optionValue, value);
  7136. };
  7137. while (i--) {
  7138. var _ret2 = _loop();
  7139. if (_ret2 === 'continue') continue;
  7140. }
  7141. };
  7142. SelectValueObserver.prototype.synchronizeValue = function synchronizeValue() {
  7143. var _this24 = this;
  7144. var options = this.element.options;
  7145. var count = 0;
  7146. var value = [];
  7147. for (var _i22 = 0, ii = options.length; _i22 < ii; _i22++) {
  7148. var _option = options.item(_i22);
  7149. if (!_option.selected) {
  7150. continue;
  7151. }
  7152. value.push(_option.hasOwnProperty('model') ? _option.model : _option.value);
  7153. count++;
  7154. }
  7155. if (this.element.multiple) {
  7156. if (Array.isArray(this.value)) {
  7157. var _ret3 = function () {
  7158. var matcher = _this24.element.matcher || function (a, b) {
  7159. return a === b;
  7160. };
  7161. var i = 0;
  7162. var _loop2 = function _loop2() {
  7163. var a = _this24.value[i];
  7164. if (value.findIndex(function (b) {
  7165. return matcher(a, b);
  7166. }) === -1) {
  7167. _this24.value.splice(i, 1);
  7168. } else {
  7169. i++;
  7170. }
  7171. };
  7172. while (i < _this24.value.length) {
  7173. _loop2();
  7174. }
  7175. i = 0;
  7176. var _loop3 = function _loop3() {
  7177. var a = value[i];
  7178. if (_this24.value.findIndex(function (b) {
  7179. return matcher(a, b);
  7180. }) === -1) {
  7181. _this24.value.push(a);
  7182. }
  7183. i++;
  7184. };
  7185. while (i < value.length) {
  7186. _loop3();
  7187. }
  7188. return {
  7189. v: void 0
  7190. };
  7191. }();
  7192. if ((typeof _ret3 === 'undefined' ? 'undefined' : _typeof(_ret3)) === "object") return _ret3.v;
  7193. }
  7194. } else {
  7195. if (count === 0) {
  7196. value = null;
  7197. } else {
  7198. value = value[0];
  7199. }
  7200. }
  7201. if (value !== this.value) {
  7202. this.oldValue = this.value;
  7203. this.value = value;
  7204. this.notify();
  7205. }
  7206. };
  7207. SelectValueObserver.prototype.notify = function notify() {
  7208. var oldValue = this.oldValue;
  7209. var newValue = this.value;
  7210. this.callSubscribers(newValue, oldValue);
  7211. };
  7212. SelectValueObserver.prototype.subscribe = function subscribe(context, callable) {
  7213. if (!this.hasSubscribers()) {
  7214. this.disposeHandler = this.handler.subscribe(this.element, this.synchronizeValue.bind(this, false));
  7215. }
  7216. this.addSubscriber(context, callable);
  7217. };
  7218. SelectValueObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
  7219. if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {
  7220. this.disposeHandler();
  7221. this.disposeHandler = null;
  7222. }
  7223. };
  7224. SelectValueObserver.prototype.bind = function bind() {
  7225. var _this25 = this;
  7226. this.domObserver = _aureliaPal.DOM.createMutationObserver(function () {
  7227. _this25.synchronizeOptions();
  7228. _this25.synchronizeValue();
  7229. });
  7230. this.domObserver.observe(this.element, { childList: true, subtree: true });
  7231. };
  7232. SelectValueObserver.prototype.unbind = function unbind() {
  7233. this.domObserver.disconnect();
  7234. this.domObserver = null;
  7235. if (this.arrayObserver) {
  7236. this.arrayObserver.unsubscribe(selectArrayContext, this);
  7237. this.arrayObserver = null;
  7238. }
  7239. };
  7240. return SelectValueObserver;
  7241. }()) || _class10);
  7242. var ClassObserver = exports.ClassObserver = function () {
  7243. function ClassObserver(element) {
  7244. this.element = element;
  7245. this.doNotCache = true;
  7246. this.value = '';
  7247. this.version = 0;
  7248. }
  7249. ClassObserver.prototype.getValue = function getValue() {
  7250. return this.value;
  7251. };
  7252. ClassObserver.prototype.setValue = function setValue(newValue) {
  7253. var nameIndex = this.nameIndex || {};
  7254. var version = this.version;
  7255. var names = void 0;
  7256. var name = void 0;
  7257. if (newValue !== null && newValue !== undefined && newValue.length) {
  7258. names = newValue.split(/\s+/);
  7259. for (var _i23 = 0, length = names.length; _i23 < length; _i23++) {
  7260. name = names[_i23];
  7261. if (name === '') {
  7262. continue;
  7263. }
  7264. nameIndex[name] = version;
  7265. this.element.classList.add(name);
  7266. }
  7267. }
  7268. this.value = newValue;
  7269. this.nameIndex = nameIndex;
  7270. this.version += 1;
  7271. if (version === 0) {
  7272. return;
  7273. }
  7274. version -= 1;
  7275. for (name in nameIndex) {
  7276. if (!nameIndex.hasOwnProperty(name) || nameIndex[name] !== version) {
  7277. continue;
  7278. }
  7279. this.element.classList.remove(name);
  7280. }
  7281. };
  7282. ClassObserver.prototype.subscribe = function subscribe() {
  7283. throw new Error('Observation of a "' + this.element.nodeName + '" element\'s "class" property is not supported.');
  7284. };
  7285. return ClassObserver;
  7286. }();
  7287. function hasDeclaredDependencies(descriptor) {
  7288. return !!(descriptor && descriptor.get && descriptor.get.dependencies);
  7289. }
  7290. function declarePropertyDependencies(ctor, propertyName, dependencies) {
  7291. var descriptor = Object.getOwnPropertyDescriptor(ctor.prototype, propertyName);
  7292. descriptor.get.dependencies = dependencies;
  7293. }
  7294. function computedFrom() {
  7295. for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
  7296. rest[_key] = arguments[_key];
  7297. }
  7298. return function (target, key, descriptor) {
  7299. descriptor.get.dependencies = rest;
  7300. return descriptor;
  7301. };
  7302. }
  7303. var ComputedExpression = exports.ComputedExpression = function (_Expression19) {
  7304. _inherits(ComputedExpression, _Expression19);
  7305. function ComputedExpression(name, dependencies) {
  7306. var _this26 = _possibleConstructorReturn(this, _Expression19.call(this));
  7307. _this26.name = name;
  7308. _this26.dependencies = dependencies;
  7309. _this26.isAssignable = true;
  7310. return _this26;
  7311. }
  7312. ComputedExpression.prototype.evaluate = function evaluate(scope, lookupFunctions) {
  7313. return scope.bindingContext[this.name];
  7314. };
  7315. ComputedExpression.prototype.assign = function assign(scope, value) {
  7316. scope.bindingContext[this.name] = value;
  7317. };
  7318. ComputedExpression.prototype.accept = function accept(visitor) {
  7319. throw new Error('not implemented');
  7320. };
  7321. ComputedExpression.prototype.connect = function connect(binding, scope) {
  7322. var dependencies = this.dependencies;
  7323. var i = dependencies.length;
  7324. while (i--) {
  7325. dependencies[i].connect(binding, scope);
  7326. }
  7327. };
  7328. return ComputedExpression;
  7329. }(Expression);
  7330. function createComputedObserver(obj, propertyName, descriptor, observerLocator) {
  7331. var dependencies = descriptor.get.dependencies;
  7332. if (!(dependencies instanceof ComputedExpression)) {
  7333. var _i24 = dependencies.length;
  7334. while (_i24--) {
  7335. dependencies[_i24] = observerLocator.parser.parse(dependencies[_i24]);
  7336. }
  7337. dependencies = descriptor.get.dependencies = new ComputedExpression(propertyName, dependencies);
  7338. }
  7339. var scope = { bindingContext: obj, overrideContext: createOverrideContext(obj) };
  7340. return new ExpressionObserver(scope, dependencies, observerLocator);
  7341. }
  7342. var elements = exports.elements = {
  7343. 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'],
  7344. 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'],
  7345. altGlyphDef: ['id', 'xml:base', 'xml:lang', 'xml:space'],
  7346. altGlyphItem: ['id', 'xml:base', 'xml:lang', 'xml:space'],
  7347. 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'],
  7348. 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'],
  7349. 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'],
  7350. 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'],
  7351. 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'],
  7352. clipPath: ['class', 'clipPathUnits', 'externalResourcesRequired', 'id', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'transform', 'xml:base', 'xml:lang', 'xml:space'],
  7353. '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'],
  7354. 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'],
  7355. 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'],
  7356. desc: ['class', 'id', 'style', 'xml:base', 'xml:lang', 'xml:space'],
  7357. 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'],
  7358. feBlend: ['class', 'height', 'id', 'in', 'in2', 'mode', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7359. feColorMatrix: ['class', 'height', 'id', 'in', 'result', 'style', 'type', 'values', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7360. feComponentTransfer: ['class', 'height', 'id', 'in', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7361. feComposite: ['class', 'height', 'id', 'in', 'in2', 'k1', 'k2', 'k3', 'k4', 'operator', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7362. 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'],
  7363. feDiffuseLighting: ['class', 'diffuseConstant', 'height', 'id', 'in', 'kernelUnitLength', 'result', 'style', 'surfaceScale', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7364. feDisplacementMap: ['class', 'height', 'id', 'in', 'in2', 'result', 'scale', 'style', 'width', 'x', 'xChannelSelector', 'xml:base', 'xml:lang', 'xml:space', 'y', 'yChannelSelector'],
  7365. feDistantLight: ['azimuth', 'elevation', 'id', 'xml:base', 'xml:lang', 'xml:space'],
  7366. feFlood: ['class', 'height', 'id', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7367. feFuncA: ['amplitude', 'exponent', 'id', 'intercept', 'offset', 'slope', 'tableValues', 'type', 'xml:base', 'xml:lang', 'xml:space'],
  7368. feFuncB: ['amplitude', 'exponent', 'id', 'intercept', 'offset', 'slope', 'tableValues', 'type', 'xml:base', 'xml:lang', 'xml:space'],
  7369. feFuncG: ['amplitude', 'exponent', 'id', 'intercept', 'offset', 'slope', 'tableValues', 'type', 'xml:base', 'xml:lang', 'xml:space'],
  7370. feFuncR: ['amplitude', 'exponent', 'id', 'intercept', 'offset', 'slope', 'tableValues', 'type', 'xml:base', 'xml:lang', 'xml:space'],
  7371. feGaussianBlur: ['class', 'height', 'id', 'in', 'result', 'stdDeviation', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7372. 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'],
  7373. feMerge: ['class', 'height', 'id', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7374. feMergeNode: ['id', 'xml:base', 'xml:lang', 'xml:space'],
  7375. feMorphology: ['class', 'height', 'id', 'in', 'operator', 'radius', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7376. feOffset: ['class', 'dx', 'dy', 'height', 'id', 'in', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7377. fePointLight: ['id', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y', 'z'],
  7378. feSpecularLighting: ['class', 'height', 'id', 'in', 'kernelUnitLength', 'result', 'specularConstant', 'specularExponent', 'style', 'surfaceScale', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7379. feSpotLight: ['id', 'limitingConeAngle', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'specularExponent', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y', 'z'],
  7380. feTile: ['class', 'height', 'id', 'in', 'result', 'style', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7381. feTurbulence: ['baseFrequency', 'class', 'height', 'id', 'numOctaves', 'result', 'seed', 'stitchTiles', 'style', 'type', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7382. 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'],
  7383. 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'],
  7384. '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'],
  7385. 'font-face-format': ['id', 'string', 'xml:base', 'xml:lang', 'xml:space'],
  7386. 'font-face-name': ['id', 'name', 'xml:base', 'xml:lang', 'xml:space'],
  7387. 'font-face-src': ['id', 'xml:base', 'xml:lang', 'xml:space'],
  7388. 'font-face-uri': ['id', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
  7389. 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'],
  7390. 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'],
  7391. 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'],
  7392. 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'],
  7393. hkern: ['g1', 'g2', 'id', 'k', 'u1', 'u2', 'xml:base', 'xml:lang', 'xml:space'],
  7394. 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'],
  7395. 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'],
  7396. 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'],
  7397. marker: ['class', 'externalResourcesRequired', 'id', 'markerHeight', 'markerUnits', 'markerWidth', 'orient', 'preserveAspectRatio', 'refX', 'refY', 'style', 'viewBox', 'xml:base', 'xml:lang', 'xml:space'],
  7398. mask: ['class', 'externalResourcesRequired', 'height', 'id', 'maskContentUnits', 'maskUnits', 'requiredExtensions', 'requiredFeatures', 'style', 'systemLanguage', 'width', 'x', 'xml:base', 'xml:lang', 'xml:space', 'y'],
  7399. metadata: ['id', 'xml:base', 'xml:lang', 'xml:space'],
  7400. 'missing-glyph': ['class', 'd', 'horiz-adv-x', 'id', 'style', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'xml:base', 'xml:lang', 'xml:space'],
  7401. mpath: ['externalResourcesRequired', 'id', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
  7402. 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'],
  7403. 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'],
  7404. 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'],
  7405. 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'],
  7406. 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'],
  7407. 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'],
  7408. script: ['externalResourcesRequired', 'id', 'type', 'xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type', 'xml:base', 'xml:lang', 'xml:space'],
  7409. 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'],
  7410. stop: ['class', 'id', 'offset', 'style', 'xml:base', 'xml:lang', 'xml:space'],
  7411. style: ['id', 'media', 'title', 'type', 'xml:base', 'xml:lang', 'xml:space'],
  7412. 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'],
  7413. 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'],
  7414. symbol: ['class', 'externalResourcesRequired', 'id', 'onactivate', 'onclick', 'onfocusin', 'onfocusout', 'onload', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'preserveAspectRatio', 'style', 'viewBox', 'xml:base', 'xml:lang', 'xml:space'],
  7415. 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'],
  7416. 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'],
  7417. title: ['class', 'id', 'style', 'xml:base', 'xml:lang', 'xml:space'],
  7418. 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'],
  7419. 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'],
  7420. 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'],
  7421. view: ['externalResourcesRequired', 'id', 'preserveAspectRatio', 'viewBox', 'viewTarget', 'xml:base', 'xml:lang', 'xml:space', 'zoomAndPan'],
  7422. vkern: ['g1', 'g2', 'id', 'k', 'u1', 'u2', 'xml:base', 'xml:lang', 'xml:space']
  7423. };
  7424. var presentationElements = exports.presentationElements = {
  7425. 'a': true,
  7426. 'altGlyph': true,
  7427. 'animate': true,
  7428. 'animateColor': true,
  7429. 'circle': true,
  7430. 'clipPath': true,
  7431. 'defs': true,
  7432. 'ellipse': true,
  7433. 'feBlend': true,
  7434. 'feColorMatrix': true,
  7435. 'feComponentTransfer': true,
  7436. 'feComposite': true,
  7437. 'feConvolveMatrix': true,
  7438. 'feDiffuseLighting': true,
  7439. 'feDisplacementMap': true,
  7440. 'feFlood': true,
  7441. 'feGaussianBlur': true,
  7442. 'feImage': true,
  7443. 'feMerge': true,
  7444. 'feMorphology': true,
  7445. 'feOffset': true,
  7446. 'feSpecularLighting': true,
  7447. 'feTile': true,
  7448. 'feTurbulence': true,
  7449. 'filter': true,
  7450. 'font': true,
  7451. 'foreignObject': true,
  7452. 'g': true,
  7453. 'glyph': true,
  7454. 'glyphRef': true,
  7455. 'image': true,
  7456. 'line': true,
  7457. 'linearGradient': true,
  7458. 'marker': true,
  7459. 'mask': true,
  7460. 'missing-glyph': true,
  7461. 'path': true,
  7462. 'pattern': true,
  7463. 'polygon': true,
  7464. 'polyline': true,
  7465. 'radialGradient': true,
  7466. 'rect': true,
  7467. 'stop': true,
  7468. 'svg': true,
  7469. 'switch': true,
  7470. 'symbol': true,
  7471. 'text': true,
  7472. 'textPath': true,
  7473. 'tref': true,
  7474. 'tspan': true,
  7475. 'use': true
  7476. };
  7477. var presentationAttributes = exports.presentationAttributes = {
  7478. 'alignment-baseline': true,
  7479. 'baseline-shift': true,
  7480. 'clip-path': true,
  7481. 'clip-rule': true,
  7482. 'clip': true,
  7483. 'color-interpolation-filters': true,
  7484. 'color-interpolation': true,
  7485. 'color-profile': true,
  7486. 'color-rendering': true,
  7487. 'color': true,
  7488. 'cursor': true,
  7489. 'direction': true,
  7490. 'display': true,
  7491. 'dominant-baseline': true,
  7492. 'enable-background': true,
  7493. 'fill-opacity': true,
  7494. 'fill-rule': true,
  7495. 'fill': true,
  7496. 'filter': true,
  7497. 'flood-color': true,
  7498. 'flood-opacity': true,
  7499. 'font-family': true,
  7500. 'font-size-adjust': true,
  7501. 'font-size': true,
  7502. 'font-stretch': true,
  7503. 'font-style': true,
  7504. 'font-variant': true,
  7505. 'font-weight': true,
  7506. 'glyph-orientation-horizontal': true,
  7507. 'glyph-orientation-vertical': true,
  7508. 'image-rendering': true,
  7509. 'kerning': true,
  7510. 'letter-spacing': true,
  7511. 'lighting-color': true,
  7512. 'marker-end': true,
  7513. 'marker-mid': true,
  7514. 'marker-start': true,
  7515. 'mask': true,
  7516. 'opacity': true,
  7517. 'overflow': true,
  7518. 'pointer-events': true,
  7519. 'shape-rendering': true,
  7520. 'stop-color': true,
  7521. 'stop-opacity': true,
  7522. 'stroke-dasharray': true,
  7523. 'stroke-dashoffset': true,
  7524. 'stroke-linecap': true,
  7525. 'stroke-linejoin': true,
  7526. 'stroke-miterlimit': true,
  7527. 'stroke-opacity': true,
  7528. 'stroke-width': true,
  7529. 'stroke': true,
  7530. 'text-anchor': true,
  7531. 'text-decoration': true,
  7532. 'text-rendering': true,
  7533. 'unicode-bidi': true,
  7534. 'visibility': true,
  7535. 'word-spacing': true,
  7536. 'writing-mode': true
  7537. };
  7538. function createElement(html) {
  7539. var div = _aureliaPal.DOM.createElement('div');
  7540. div.innerHTML = html;
  7541. return div.firstChild;
  7542. }
  7543. var SVGAnalyzer = exports.SVGAnalyzer = function () {
  7544. function SVGAnalyzer() {
  7545. if (createElement('<svg><altGlyph /></svg>').firstElementChild.nodeName === 'altglyph' && elements.altGlyph) {
  7546. elements.altglyph = elements.altGlyph;
  7547. delete elements.altGlyph;
  7548. elements.altglyphdef = elements.altGlyphDef;
  7549. delete elements.altGlyphDef;
  7550. elements.altglyphitem = elements.altGlyphItem;
  7551. delete elements.altGlyphItem;
  7552. elements.glyphref = elements.glyphRef;
  7553. delete elements.glyphRef;
  7554. }
  7555. }
  7556. SVGAnalyzer.prototype.isStandardSvgAttribute = function isStandardSvgAttribute(nodeName, attributeName) {
  7557. return presentationElements[nodeName] && presentationAttributes[attributeName] || elements[nodeName] && elements[nodeName].indexOf(attributeName) !== -1;
  7558. };
  7559. return SVGAnalyzer;
  7560. }();
  7561. var ObserverLocator = exports.ObserverLocator = (_temp = _class11 = function () {
  7562. function ObserverLocator(taskQueue, eventManager, dirtyChecker, svgAnalyzer, parser) {
  7563. this.taskQueue = taskQueue;
  7564. this.eventManager = eventManager;
  7565. this.dirtyChecker = dirtyChecker;
  7566. this.svgAnalyzer = svgAnalyzer;
  7567. this.parser = parser;
  7568. this.adapters = [];
  7569. this.logger = LogManager.getLogger('observer-locator');
  7570. }
  7571. ObserverLocator.prototype.getObserver = function getObserver(obj, propertyName) {
  7572. var observersLookup = obj.__observers__;
  7573. var observer = void 0;
  7574. if (observersLookup && propertyName in observersLookup) {
  7575. return observersLookup[propertyName];
  7576. }
  7577. observer = this.createPropertyObserver(obj, propertyName);
  7578. if (!observer.doNotCache) {
  7579. if (observersLookup === undefined) {
  7580. observersLookup = this.getOrCreateObserversLookup(obj);
  7581. }
  7582. observersLookup[propertyName] = observer;
  7583. }
  7584. return observer;
  7585. };
  7586. ObserverLocator.prototype.getOrCreateObserversLookup = function getOrCreateObserversLookup(obj) {
  7587. return obj.__observers__ || this.createObserversLookup(obj);
  7588. };
  7589. ObserverLocator.prototype.createObserversLookup = function createObserversLookup(obj) {
  7590. var value = {};
  7591. if (!Reflect.defineProperty(obj, '__observers__', {
  7592. enumerable: false,
  7593. configurable: false,
  7594. writable: false,
  7595. value: value
  7596. })) {
  7597. this.logger.warn('Cannot add observers to object', obj);
  7598. }
  7599. return value;
  7600. };
  7601. ObserverLocator.prototype.addAdapter = function addAdapter(adapter) {
  7602. this.adapters.push(adapter);
  7603. };
  7604. ObserverLocator.prototype.getAdapterObserver = function getAdapterObserver(obj, propertyName, descriptor) {
  7605. for (var _i25 = 0, ii = this.adapters.length; _i25 < ii; _i25++) {
  7606. var adapter = this.adapters[_i25];
  7607. var observer = adapter.getObserver(obj, propertyName, descriptor);
  7608. if (observer) {
  7609. return observer;
  7610. }
  7611. }
  7612. return null;
  7613. };
  7614. ObserverLocator.prototype.createPropertyObserver = function createPropertyObserver(obj, propertyName) {
  7615. var descriptor = void 0;
  7616. var handler = void 0;
  7617. var xlinkResult = void 0;
  7618. if (!(obj instanceof Object)) {
  7619. return new PrimitiveObserver(obj, propertyName);
  7620. }
  7621. if (obj instanceof _aureliaPal.DOM.Element) {
  7622. if (propertyName === 'class') {
  7623. return new ClassObserver(obj);
  7624. }
  7625. if (propertyName === 'style' || propertyName === 'css') {
  7626. return new StyleObserver(obj, propertyName);
  7627. }
  7628. handler = this.eventManager.getElementHandler(obj, propertyName);
  7629. if (propertyName === 'value' && obj.tagName.toLowerCase() === 'select') {
  7630. return new SelectValueObserver(obj, handler, this);
  7631. }
  7632. if (propertyName === 'checked' && obj.tagName.toLowerCase() === 'input') {
  7633. return new CheckedObserver(obj, handler, this);
  7634. }
  7635. if (handler) {
  7636. return new ValueAttributeObserver(obj, propertyName, handler);
  7637. }
  7638. xlinkResult = /^xlink:(.+)$/.exec(propertyName);
  7639. if (xlinkResult) {
  7640. return new XLinkAttributeObserver(obj, propertyName, xlinkResult[1]);
  7641. }
  7642. if (/^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
  7643. return new DataAttributeObserver(obj, propertyName);
  7644. }
  7645. }
  7646. descriptor = Object.getPropertyDescriptor(obj, propertyName);
  7647. if (hasDeclaredDependencies(descriptor)) {
  7648. return createComputedObserver(obj, propertyName, descriptor, this);
  7649. }
  7650. if (descriptor) {
  7651. var existingGetterOrSetter = descriptor.get || descriptor.set;
  7652. if (existingGetterOrSetter) {
  7653. if (existingGetterOrSetter.getObserver) {
  7654. return existingGetterOrSetter.getObserver(obj);
  7655. }
  7656. var adapterObserver = this.getAdapterObserver(obj, propertyName, descriptor);
  7657. if (adapterObserver) {
  7658. return adapterObserver;
  7659. }
  7660. return new DirtyCheckProperty(this.dirtyChecker, obj, propertyName);
  7661. }
  7662. }
  7663. if (obj instanceof Array) {
  7664. if (propertyName === 'length') {
  7665. return this.getArrayObserver(obj).getLengthObserver();
  7666. }
  7667. return new DirtyCheckProperty(this.dirtyChecker, obj, propertyName);
  7668. } else if (obj instanceof Map) {
  7669. if (propertyName === 'size') {
  7670. return this.getMapObserver(obj).getLengthObserver();
  7671. }
  7672. return new DirtyCheckProperty(this.dirtyChecker, obj, propertyName);
  7673. } else if (obj instanceof Set) {
  7674. if (propertyName === 'size') {
  7675. return this.getSetObserver(obj).getLengthObserver();
  7676. }
  7677. return new DirtyCheckProperty(this.dirtyChecker, obj, propertyName);
  7678. }
  7679. return new SetterObserver(this.taskQueue, obj, propertyName);
  7680. };
  7681. ObserverLocator.prototype.getAccessor = function getAccessor(obj, propertyName) {
  7682. if (obj instanceof _aureliaPal.DOM.Element) {
  7683. 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)) {
  7684. return this.getObserver(obj, propertyName);
  7685. }
  7686. if (/^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
  7687. return dataAttributeAccessor;
  7688. }
  7689. }
  7690. return propertyAccessor;
  7691. };
  7692. ObserverLocator.prototype.getArrayObserver = function getArrayObserver(array) {
  7693. return _getArrayObserver(this.taskQueue, array);
  7694. };
  7695. ObserverLocator.prototype.getMapObserver = function getMapObserver(map) {
  7696. return _getMapObserver(this.taskQueue, map);
  7697. };
  7698. ObserverLocator.prototype.getSetObserver = function getSetObserver(set) {
  7699. return _getSetObserver(this.taskQueue, set);
  7700. };
  7701. return ObserverLocator;
  7702. }(), _class11.inject = [_aureliaTaskQueue.TaskQueue, EventManager, DirtyChecker, SVGAnalyzer, Parser], _temp);
  7703. var ObjectObservationAdapter = exports.ObjectObservationAdapter = function () {
  7704. function ObjectObservationAdapter() {
  7705. }
  7706. ObjectObservationAdapter.prototype.getObserver = function getObserver(object, propertyName, descriptor) {
  7707. throw new Error('BindingAdapters must implement getObserver(object, propertyName).');
  7708. };
  7709. return ObjectObservationAdapter;
  7710. }();
  7711. var BindingExpression = exports.BindingExpression = function () {
  7712. function BindingExpression(observerLocator, targetProperty, sourceExpression, mode, lookupFunctions, attribute) {
  7713. this.observerLocator = observerLocator;
  7714. this.targetProperty = targetProperty;
  7715. this.sourceExpression = sourceExpression;
  7716. this.mode = mode;
  7717. this.lookupFunctions = lookupFunctions;
  7718. this.attribute = attribute;
  7719. this.discrete = false;
  7720. }
  7721. BindingExpression.prototype.createBinding = function createBinding(target) {
  7722. return new Binding(this.observerLocator, this.sourceExpression, target, this.targetProperty, this.mode, this.lookupFunctions);
  7723. };
  7724. return BindingExpression;
  7725. }();
  7726. var targetContext = 'Binding:target';
  7727. var Binding = exports.Binding = (_dec10 = connectable(), _dec10(_class12 = function () {
  7728. function Binding(observerLocator, sourceExpression, target, targetProperty, mode, lookupFunctions) {
  7729. this.observerLocator = observerLocator;
  7730. this.sourceExpression = sourceExpression;
  7731. this.target = target;
  7732. this.targetProperty = targetProperty;
  7733. this.mode = mode;
  7734. this.lookupFunctions = lookupFunctions;
  7735. }
  7736. Binding.prototype.updateTarget = function updateTarget(value) {
  7737. this.targetObserver.setValue(value, this.target, this.targetProperty);
  7738. };
  7739. Binding.prototype.updateSource = function updateSource(value) {
  7740. this.sourceExpression.assign(this.source, value, this.lookupFunctions);
  7741. };
  7742. Binding.prototype.call = function call(context, newValue, oldValue) {
  7743. if (!this.isBound) {
  7744. return;
  7745. }
  7746. if (context === sourceContext) {
  7747. oldValue = this.targetObserver.getValue(this.target, this.targetProperty);
  7748. newValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions);
  7749. if (newValue !== oldValue) {
  7750. this.updateTarget(newValue);
  7751. }
  7752. if (this.mode !== bindingMode.oneTime) {
  7753. this._version++;
  7754. this.sourceExpression.connect(this, this.source);
  7755. this.unobserve(false);
  7756. }
  7757. return;
  7758. }
  7759. if (context === targetContext) {
  7760. if (newValue !== this.sourceExpression.evaluate(this.source, this.lookupFunctions)) {
  7761. this.updateSource(newValue);
  7762. }
  7763. return;
  7764. }
  7765. throw new Error('Unexpected call context ' + context);
  7766. };
  7767. Binding.prototype.bind = function bind(source) {
  7768. if (this.isBound) {
  7769. if (this.source === source) {
  7770. return;
  7771. }
  7772. this.unbind();
  7773. }
  7774. this.isBound = true;
  7775. this.source = source;
  7776. if (this.sourceExpression.bind) {
  7777. this.sourceExpression.bind(this, source, this.lookupFunctions);
  7778. }
  7779. var mode = this.mode;
  7780. if (!this.targetObserver) {
  7781. var method = mode === bindingMode.twoWay ? 'getObserver' : 'getAccessor';
  7782. this.targetObserver = this.observerLocator[method](this.target, this.targetProperty);
  7783. }
  7784. if ('bind' in this.targetObserver) {
  7785. this.targetObserver.bind();
  7786. }
  7787. var value = this.sourceExpression.evaluate(source, this.lookupFunctions);
  7788. this.updateTarget(value);
  7789. if (mode === bindingMode.oneWay) {
  7790. enqueueBindingConnect(this);
  7791. } else if (mode === bindingMode.twoWay) {
  7792. this.sourceExpression.connect(this, source);
  7793. this.targetObserver.subscribe(targetContext, this);
  7794. }
  7795. };
  7796. Binding.prototype.unbind = function unbind() {
  7797. if (!this.isBound) {
  7798. return;
  7799. }
  7800. this.isBound = false;
  7801. if (this.sourceExpression.unbind) {
  7802. this.sourceExpression.unbind(this, this.source);
  7803. }
  7804. this.source = null;
  7805. if ('unbind' in this.targetObserver) {
  7806. this.targetObserver.unbind();
  7807. }
  7808. if (this.targetObserver.unsubscribe) {
  7809. this.targetObserver.unsubscribe(targetContext, this);
  7810. }
  7811. this.unobserve(true);
  7812. };
  7813. Binding.prototype.connect = function connect(evaluate) {
  7814. if (!this.isBound) {
  7815. return;
  7816. }
  7817. if (evaluate) {
  7818. var value = this.sourceExpression.evaluate(this.source, this.lookupFunctions);
  7819. this.updateTarget(value);
  7820. }
  7821. this.sourceExpression.connect(this, this.source);
  7822. };
  7823. return Binding;
  7824. }()) || _class12);
  7825. var CallExpression = exports.CallExpression = function () {
  7826. function CallExpression(observerLocator, targetProperty, sourceExpression, lookupFunctions) {
  7827. this.observerLocator = observerLocator;
  7828. this.targetProperty = targetProperty;
  7829. this.sourceExpression = sourceExpression;
  7830. this.lookupFunctions = lookupFunctions;
  7831. }
  7832. CallExpression.prototype.createBinding = function createBinding(target) {
  7833. return new Call(this.observerLocator, this.sourceExpression, target, this.targetProperty, this.lookupFunctions);
  7834. };
  7835. return CallExpression;
  7836. }();
  7837. var Call = exports.Call = function () {
  7838. function Call(observerLocator, sourceExpression, target, targetProperty, lookupFunctions) {
  7839. this.sourceExpression = sourceExpression;
  7840. this.target = target;
  7841. this.targetProperty = observerLocator.getObserver(target, targetProperty);
  7842. this.lookupFunctions = lookupFunctions;
  7843. }
  7844. Call.prototype.callSource = function callSource($event) {
  7845. var overrideContext = this.source.overrideContext;
  7846. Object.assign(overrideContext, $event);
  7847. overrideContext.$event = $event;
  7848. var mustEvaluate = true;
  7849. var result = this.sourceExpression.evaluate(this.source, this.lookupFunctions, mustEvaluate);
  7850. delete overrideContext.$event;
  7851. for (var prop in $event) {
  7852. delete overrideContext[prop];
  7853. }
  7854. return result;
  7855. };
  7856. Call.prototype.bind = function bind(source) {
  7857. var _this27 = this;
  7858. if (this.isBound) {
  7859. if (this.source === source) {
  7860. return;
  7861. }
  7862. this.unbind();
  7863. }
  7864. this.isBound = true;
  7865. this.source = source;
  7866. if (this.sourceExpression.bind) {
  7867. this.sourceExpression.bind(this, source, this.lookupFunctions);
  7868. }
  7869. this.targetProperty.setValue(function ($event) {
  7870. return _this27.callSource($event);
  7871. });
  7872. };
  7873. Call.prototype.unbind = function unbind() {
  7874. if (!this.isBound) {
  7875. return;
  7876. }
  7877. this.isBound = false;
  7878. if (this.sourceExpression.unbind) {
  7879. this.sourceExpression.unbind(this, this.source);
  7880. }
  7881. this.source = null;
  7882. this.targetProperty.setValue(null);
  7883. };
  7884. return Call;
  7885. }();
  7886. var ValueConverterResource = exports.ValueConverterResource = function () {
  7887. function ValueConverterResource(name) {
  7888. this.name = name;
  7889. }
  7890. ValueConverterResource.convention = function convention(name) {
  7891. if (name.endsWith('ValueConverter')) {
  7892. return new ValueConverterResource(camelCase(name.substring(0, name.length - 14)));
  7893. }
  7894. };
  7895. ValueConverterResource.prototype.initialize = function initialize(container, target) {
  7896. this.instance = container.get(target);
  7897. };
  7898. ValueConverterResource.prototype.register = function register(registry, name) {
  7899. registry.registerValueConverter(name || this.name, this.instance);
  7900. };
  7901. ValueConverterResource.prototype.load = function load(container, target) {};
  7902. return ValueConverterResource;
  7903. }();
  7904. function valueConverter(nameOrTarget) {
  7905. if (nameOrTarget === undefined || typeof nameOrTarget === 'string') {
  7906. return function (target) {
  7907. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ValueConverterResource(nameOrTarget), target);
  7908. };
  7909. }
  7910. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ValueConverterResource(), nameOrTarget);
  7911. }
  7912. var BindingBehaviorResource = exports.BindingBehaviorResource = function () {
  7913. function BindingBehaviorResource(name) {
  7914. this.name = name;
  7915. }
  7916. BindingBehaviorResource.convention = function convention(name) {
  7917. if (name.endsWith('BindingBehavior')) {
  7918. return new BindingBehaviorResource(camelCase(name.substring(0, name.length - 15)));
  7919. }
  7920. };
  7921. BindingBehaviorResource.prototype.initialize = function initialize(container, target) {
  7922. this.instance = container.get(target);
  7923. };
  7924. BindingBehaviorResource.prototype.register = function register(registry, name) {
  7925. registry.registerBindingBehavior(name || this.name, this.instance);
  7926. };
  7927. BindingBehaviorResource.prototype.load = function load(container, target) {};
  7928. return BindingBehaviorResource;
  7929. }();
  7930. function bindingBehavior(nameOrTarget) {
  7931. if (nameOrTarget === undefined || typeof nameOrTarget === 'string') {
  7932. return function (target) {
  7933. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new BindingBehaviorResource(nameOrTarget), target);
  7934. };
  7935. }
  7936. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new BindingBehaviorResource(), nameOrTarget);
  7937. }
  7938. var ListenerExpression = exports.ListenerExpression = function () {
  7939. function ListenerExpression(eventManager, targetEvent, sourceExpression, delegate, preventDefault, lookupFunctions) {
  7940. this.eventManager = eventManager;
  7941. this.targetEvent = targetEvent;
  7942. this.sourceExpression = sourceExpression;
  7943. this.delegate = delegate;
  7944. this.discrete = true;
  7945. this.preventDefault = preventDefault;
  7946. this.lookupFunctions = lookupFunctions;
  7947. }
  7948. ListenerExpression.prototype.createBinding = function createBinding(target) {
  7949. return new Listener(this.eventManager, this.targetEvent, this.delegate, this.sourceExpression, target, this.preventDefault, this.lookupFunctions);
  7950. };
  7951. return ListenerExpression;
  7952. }();
  7953. var Listener = exports.Listener = function () {
  7954. function Listener(eventManager, targetEvent, delegate, sourceExpression, target, preventDefault, lookupFunctions) {
  7955. this.eventManager = eventManager;
  7956. this.targetEvent = targetEvent;
  7957. this.delegate = delegate;
  7958. this.sourceExpression = sourceExpression;
  7959. this.target = target;
  7960. this.preventDefault = preventDefault;
  7961. this.lookupFunctions = lookupFunctions;
  7962. }
  7963. Listener.prototype.callSource = function callSource(event) {
  7964. var overrideContext = this.source.overrideContext;
  7965. overrideContext.$event = event;
  7966. var mustEvaluate = true;
  7967. var result = this.sourceExpression.evaluate(this.source, this.lookupFunctions, mustEvaluate);
  7968. delete overrideContext.$event;
  7969. if (result !== true && this.preventDefault) {
  7970. event.preventDefault();
  7971. }
  7972. return result;
  7973. };
  7974. Listener.prototype.bind = function bind(source) {
  7975. var _this28 = this;
  7976. if (this.isBound) {
  7977. if (this.source === source) {
  7978. return;
  7979. }
  7980. this.unbind();
  7981. }
  7982. this.isBound = true;
  7983. this.source = source;
  7984. if (this.sourceExpression.bind) {
  7985. this.sourceExpression.bind(this, source, this.lookupFunctions);
  7986. }
  7987. this._disposeListener = this.eventManager.addEventListener(this.target, this.targetEvent, function (event) {
  7988. return _this28.callSource(event);
  7989. }, this.delegate);
  7990. };
  7991. Listener.prototype.unbind = function unbind() {
  7992. if (!this.isBound) {
  7993. return;
  7994. }
  7995. this.isBound = false;
  7996. if (this.sourceExpression.unbind) {
  7997. this.sourceExpression.unbind(this, this.source);
  7998. }
  7999. this.source = null;
  8000. this._disposeListener();
  8001. this._disposeListener = null;
  8002. };
  8003. return Listener;
  8004. }();
  8005. function getAU(element) {
  8006. var au = element.au;
  8007. if (au === undefined) {
  8008. throw new Error('No Aurelia APIs are defined for the element: "' + element.tagName + '".');
  8009. }
  8010. return au;
  8011. }
  8012. var NameExpression = exports.NameExpression = function () {
  8013. function NameExpression(sourceExpression, apiName, lookupFunctions) {
  8014. this.sourceExpression = sourceExpression;
  8015. this.apiName = apiName;
  8016. this.lookupFunctions = lookupFunctions;
  8017. this.discrete = true;
  8018. }
  8019. NameExpression.prototype.createBinding = function createBinding(target) {
  8020. return new NameBinder(this.sourceExpression, NameExpression.locateAPI(target, this.apiName), this.lookupFunctions);
  8021. };
  8022. NameExpression.locateAPI = function locateAPI(element, apiName) {
  8023. switch (apiName) {
  8024. case 'element':
  8025. return element;
  8026. case 'controller':
  8027. return getAU(element).controller;
  8028. case 'view-model':
  8029. return getAU(element).controller.viewModel;
  8030. case 'view':
  8031. return getAU(element).controller.view;
  8032. default:
  8033. var target = getAU(element)[apiName];
  8034. if (target === undefined) {
  8035. throw new Error('Attempted to reference "' + apiName + '", but it was not found amongst the target\'s API.');
  8036. }
  8037. return target.viewModel;
  8038. }
  8039. };
  8040. return NameExpression;
  8041. }();
  8042. var NameBinder = function () {
  8043. function NameBinder(sourceExpression, target, lookupFunctions) {
  8044. this.sourceExpression = sourceExpression;
  8045. this.target = target;
  8046. this.lookupFunctions = lookupFunctions;
  8047. }
  8048. NameBinder.prototype.bind = function bind(source) {
  8049. if (this.isBound) {
  8050. if (this.source === source) {
  8051. return;
  8052. }
  8053. this.unbind();
  8054. }
  8055. this.isBound = true;
  8056. this.source = source;
  8057. if (this.sourceExpression.bind) {
  8058. this.sourceExpression.bind(this, source, this.lookupFunctions);
  8059. }
  8060. this.sourceExpression.assign(this.source, this.target, this.lookupFunctions);
  8061. };
  8062. NameBinder.prototype.unbind = function unbind() {
  8063. if (!this.isBound) {
  8064. return;
  8065. }
  8066. this.isBound = false;
  8067. this.sourceExpression.assign(this.source, null, this.lookupFunctions);
  8068. if (this.sourceExpression.unbind) {
  8069. this.sourceExpression.unbind(this, this.source);
  8070. }
  8071. this.source = null;
  8072. };
  8073. return NameBinder;
  8074. }();
  8075. var LookupFunctions = {
  8076. bindingBehaviors: function bindingBehaviors(name) {
  8077. return null;
  8078. },
  8079. valueConverters: function valueConverters(name) {
  8080. return null;
  8081. }
  8082. };
  8083. var BindingEngine = exports.BindingEngine = (_temp2 = _class13 = function () {
  8084. function BindingEngine(observerLocator, parser) {
  8085. this.observerLocator = observerLocator;
  8086. this.parser = parser;
  8087. }
  8088. BindingEngine.prototype.createBindingExpression = function createBindingExpression(targetProperty, sourceExpression) {
  8089. var mode = arguments.length <= 2 || arguments[2] === undefined ? bindingMode.oneWay : arguments[2];
  8090. var lookupFunctions = arguments.length <= 3 || arguments[3] === undefined ? LookupFunctions : arguments[3];
  8091. return new BindingExpression(this.observerLocator, targetProperty, this.parser.parse(sourceExpression), mode, lookupFunctions);
  8092. };
  8093. BindingEngine.prototype.propertyObserver = function propertyObserver(obj, propertyName) {
  8094. var _this29 = this;
  8095. return {
  8096. subscribe: function subscribe(callback) {
  8097. var observer = _this29.observerLocator.getObserver(obj, propertyName);
  8098. observer.subscribe(callback);
  8099. return {
  8100. dispose: function dispose() {
  8101. return observer.unsubscribe(callback);
  8102. }
  8103. };
  8104. }
  8105. };
  8106. };
  8107. BindingEngine.prototype.collectionObserver = function collectionObserver(collection) {
  8108. var _this30 = this;
  8109. return {
  8110. subscribe: function subscribe(callback) {
  8111. var observer = void 0;
  8112. if (collection instanceof Array) {
  8113. observer = _this30.observerLocator.getArrayObserver(collection);
  8114. } else if (collection instanceof Map) {
  8115. observer = _this30.observerLocator.getMapObserver(collection);
  8116. } else if (collection instanceof Set) {
  8117. observer = _this30.observerLocator.getSetObserver(collection);
  8118. } else {
  8119. throw new Error('collection must be an instance of Array, Map or Set.');
  8120. }
  8121. observer.subscribe(callback);
  8122. return {
  8123. dispose: function dispose() {
  8124. return observer.unsubscribe(callback);
  8125. }
  8126. };
  8127. }
  8128. };
  8129. };
  8130. BindingEngine.prototype.expressionObserver = function expressionObserver(bindingContext, expression) {
  8131. var scope = { bindingContext: bindingContext, overrideContext: createOverrideContext(bindingContext) };
  8132. return new ExpressionObserver(scope, this.parser.parse(expression), this.observerLocator, LookupFunctions);
  8133. };
  8134. BindingEngine.prototype.parseExpression = function parseExpression(expression) {
  8135. return this.parser.parse(expression);
  8136. };
  8137. BindingEngine.prototype.registerAdapter = function registerAdapter(adapter) {
  8138. this.observerLocator.addAdapter(adapter);
  8139. };
  8140. return BindingEngine;
  8141. }(), _class13.inject = [ObserverLocator, Parser], _temp2);
  8142. var setProto = Set.prototype;
  8143. function _getSetObserver(taskQueue, set) {
  8144. return ModifySetObserver.for(taskQueue, set);
  8145. }
  8146. exports.getSetObserver = _getSetObserver;
  8147. var ModifySetObserver = function (_ModifyCollectionObse3) {
  8148. _inherits(ModifySetObserver, _ModifyCollectionObse3);
  8149. function ModifySetObserver(taskQueue, set) {
  8150. return _possibleConstructorReturn(this, _ModifyCollectionObse3.call(this, taskQueue, set));
  8151. }
  8152. ModifySetObserver.for = function _for(taskQueue, set) {
  8153. if (!('__set_observer__' in set)) {
  8154. Reflect.defineProperty(set, '__set_observer__', {
  8155. value: ModifySetObserver.create(taskQueue, set),
  8156. enumerable: false, configurable: false
  8157. });
  8158. }
  8159. return set.__set_observer__;
  8160. };
  8161. ModifySetObserver.create = function create(taskQueue, set) {
  8162. var observer = new ModifySetObserver(taskQueue, set);
  8163. var proto = setProto;
  8164. if (proto.add !== set.add || proto.delete !== set.delete || proto.clear !== set.clear) {
  8165. proto = {
  8166. add: set.add,
  8167. delete: set.delete,
  8168. clear: set.clear
  8169. };
  8170. }
  8171. set.add = function () {
  8172. var type = 'add';
  8173. var oldSize = set.size;
  8174. var methodCallResult = proto.add.apply(set, arguments);
  8175. var hasValue = set.size === oldSize;
  8176. if (!hasValue) {
  8177. observer.addChangeRecord({
  8178. type: type,
  8179. object: set,
  8180. value: Array.from(set).pop()
  8181. });
  8182. }
  8183. return methodCallResult;
  8184. };
  8185. set.delete = function () {
  8186. var hasValue = set.has(arguments[0]);
  8187. var methodCallResult = proto.delete.apply(set, arguments);
  8188. if (hasValue) {
  8189. observer.addChangeRecord({
  8190. type: 'delete',
  8191. object: set,
  8192. value: arguments[0]
  8193. });
  8194. }
  8195. return methodCallResult;
  8196. };
  8197. set.clear = function () {
  8198. var methodCallResult = proto.clear.apply(set, arguments);
  8199. observer.addChangeRecord({
  8200. type: 'clear',
  8201. object: set
  8202. });
  8203. return methodCallResult;
  8204. };
  8205. return observer;
  8206. };
  8207. return ModifySetObserver;
  8208. }(ModifyCollectionObserver);
  8209. function observable(targetOrConfig, key, descriptor) {
  8210. function deco(target, key, descriptor, config) {
  8211. if (key === undefined) {
  8212. target = target.prototype;
  8213. key = typeof config === 'string' ? config : config.name;
  8214. }
  8215. var innerPropertyName = '_' + key;
  8216. var callbackName = config && config.changeHandler || key + 'Changed';
  8217. if (descriptor) {
  8218. if (typeof descriptor.initializer === 'function') {
  8219. target[innerPropertyName] = descriptor.initializer();
  8220. }
  8221. } else {
  8222. descriptor = {};
  8223. }
  8224. delete descriptor.writable;
  8225. delete descriptor.initializer;
  8226. descriptor.get = function () {
  8227. return this[innerPropertyName];
  8228. };
  8229. descriptor.set = function (newValue) {
  8230. var oldValue = this[innerPropertyName];
  8231. this[innerPropertyName] = newValue;
  8232. if (this[callbackName]) {
  8233. this[callbackName](newValue, oldValue, key);
  8234. }
  8235. };
  8236. descriptor.get.dependencies = [innerPropertyName];
  8237. Reflect.defineProperty(target, key, descriptor);
  8238. }
  8239. if (key === undefined) {
  8240. return function (t, k, d) {
  8241. return deco(t, k, d, targetOrConfig);
  8242. };
  8243. }
  8244. return deco(targetOrConfig, key, descriptor);
  8245. }
  8246. });
  8247. define('aurelia-bootstrapper',['exports', 'aurelia-pal', 'aurelia-pal-browser', 'aurelia-polyfills'], function (exports, _aureliaPal, _aureliaPalBrowser) {
  8248. 'use strict';
  8249. Object.defineProperty(exports, "__esModule", {
  8250. value: true
  8251. });
  8252. exports.bootstrap = bootstrap;
  8253. var bootstrapQueue = [];
  8254. var sharedLoader = null;
  8255. var Aurelia = null;
  8256. function onBootstrap(callback) {
  8257. return new Promise(function (resolve, reject) {
  8258. if (sharedLoader) {
  8259. resolve(callback(sharedLoader));
  8260. } else {
  8261. bootstrapQueue.push(function () {
  8262. try {
  8263. resolve(callback(sharedLoader));
  8264. } catch (e) {
  8265. reject(e);
  8266. }
  8267. });
  8268. }
  8269. });
  8270. }
  8271. function ready(global) {
  8272. return new Promise(function (resolve, reject) {
  8273. if (global.document.readyState === 'complete') {
  8274. resolve(global.document);
  8275. } else {
  8276. global.document.addEventListener('DOMContentLoaded', completed);
  8277. global.addEventListener('load', completed);
  8278. }
  8279. function completed() {
  8280. global.document.removeEventListener('DOMContentLoaded', completed);
  8281. global.removeEventListener('load', completed);
  8282. resolve(global.document);
  8283. }
  8284. });
  8285. }
  8286. function createLoader() {
  8287. if (_aureliaPal.PLATFORM.Loader) {
  8288. return Promise.resolve(new _aureliaPal.PLATFORM.Loader());
  8289. }
  8290. if (window.System && typeof window.System.import === 'function') {
  8291. return System.normalize('aurelia-bootstrapper').then(function (bootstrapperName) {
  8292. return System.normalize('aurelia-loader-default', bootstrapperName);
  8293. }).then(function (loaderName) {
  8294. return System.import(loaderName).then(function (m) {
  8295. return new m.DefaultLoader();
  8296. });
  8297. });
  8298. }
  8299. if (typeof window.require === 'function') {
  8300. return new Promise(function (resolve, reject) {
  8301. return require(['aurelia-loader-default'], function (m) {
  8302. return resolve(new m.DefaultLoader());
  8303. }, reject);
  8304. });
  8305. }
  8306. 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.');
  8307. }
  8308. function preparePlatform(loader) {
  8309. return loader.normalize('aurelia-bootstrapper').then(function (bootstrapperName) {
  8310. return loader.normalize('aurelia-framework', bootstrapperName).then(function (frameworkName) {
  8311. loader.map('aurelia-framework', frameworkName);
  8312. return Promise.all([loader.normalize('aurelia-dependency-injection', frameworkName).then(function (diName) {
  8313. return loader.map('aurelia-dependency-injection', diName);
  8314. }), loader.normalize('aurelia-router', bootstrapperName).then(function (routerName) {
  8315. return loader.map('aurelia-router', routerName);
  8316. }), loader.normalize('aurelia-logging-console', bootstrapperName).then(function (loggingConsoleName) {
  8317. return loader.map('aurelia-logging-console', loggingConsoleName);
  8318. })]).then(function () {
  8319. return loader.loadModule(frameworkName).then(function (m) {
  8320. return Aurelia = m.Aurelia;
  8321. });
  8322. });
  8323. });
  8324. });
  8325. }
  8326. function handleApp(loader, appHost) {
  8327. var moduleId = appHost.getAttribute('aurelia-app') || appHost.getAttribute('data-aurelia-app');
  8328. return config(loader, appHost, moduleId);
  8329. }
  8330. function config(loader, appHost, configModuleId) {
  8331. var aurelia = new Aurelia(loader);
  8332. aurelia.host = appHost;
  8333. aurelia.configModuleId = configModuleId || null;
  8334. if (configModuleId) {
  8335. return loader.loadModule(configModuleId).then(function (customConfig) {
  8336. return customConfig.configure(aurelia);
  8337. });
  8338. }
  8339. aurelia.use.standardConfiguration().developmentLogging();
  8340. return aurelia.start().then(function () {
  8341. return aurelia.setRoot();
  8342. });
  8343. }
  8344. function run() {
  8345. return ready(window).then(function (doc) {
  8346. (0, _aureliaPalBrowser.initialize)();
  8347. var appHost = doc.querySelectorAll('[aurelia-app],[data-aurelia-app]');
  8348. return createLoader().then(function (loader) {
  8349. return preparePlatform(loader).then(function () {
  8350. for (var i = 0, ii = appHost.length; i < ii; ++i) {
  8351. handleApp(loader, appHost[i]).catch(console.error.bind(console));
  8352. }
  8353. sharedLoader = loader;
  8354. for (var _i = 0, _ii = bootstrapQueue.length; _i < _ii; ++_i) {
  8355. bootstrapQueue[_i]();
  8356. }
  8357. bootstrapQueue = null;
  8358. });
  8359. });
  8360. });
  8361. }
  8362. function bootstrap(configure) {
  8363. return onBootstrap(function (loader) {
  8364. var aurelia = new Aurelia(loader);
  8365. return configure(aurelia);
  8366. });
  8367. }
  8368. run();
  8369. });
  8370. define('aurelia-event-aggregator',['exports', 'aurelia-logging'], function (exports, _aureliaLogging) {
  8371. 'use strict';
  8372. Object.defineProperty(exports, "__esModule", {
  8373. value: true
  8374. });
  8375. exports.EventAggregator = undefined;
  8376. exports.includeEventsIn = includeEventsIn;
  8377. exports.configure = configure;
  8378. var LogManager = _interopRequireWildcard(_aureliaLogging);
  8379. function _interopRequireWildcard(obj) {
  8380. if (obj && obj.__esModule) {
  8381. return obj;
  8382. } else {
  8383. var newObj = {};
  8384. if (obj != null) {
  8385. for (var key in obj) {
  8386. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  8387. }
  8388. }
  8389. newObj.default = obj;
  8390. return newObj;
  8391. }
  8392. }
  8393. var logger = LogManager.getLogger('event-aggregator');
  8394. var Handler = function () {
  8395. function Handler(messageType, callback) {
  8396. this.messageType = messageType;
  8397. this.callback = callback;
  8398. }
  8399. Handler.prototype.handle = function handle(message) {
  8400. if (message instanceof this.messageType) {
  8401. this.callback.call(null, message);
  8402. }
  8403. };
  8404. return Handler;
  8405. }();
  8406. var EventAggregator = exports.EventAggregator = function () {
  8407. function EventAggregator() {
  8408. this.eventLookup = {};
  8409. this.messageHandlers = [];
  8410. }
  8411. EventAggregator.prototype.publish = function publish(event, data) {
  8412. var subscribers = void 0;
  8413. var i = void 0;
  8414. if (!event) {
  8415. throw new Error('Event was invalid.');
  8416. }
  8417. if (typeof event === 'string') {
  8418. subscribers = this.eventLookup[event];
  8419. if (subscribers) {
  8420. subscribers = subscribers.slice();
  8421. i = subscribers.length;
  8422. try {
  8423. while (i--) {
  8424. subscribers[i](data, event);
  8425. }
  8426. } catch (e) {
  8427. logger.error(e);
  8428. }
  8429. }
  8430. } else {
  8431. subscribers = this.messageHandlers.slice();
  8432. i = subscribers.length;
  8433. try {
  8434. while (i--) {
  8435. subscribers[i].handle(event);
  8436. }
  8437. } catch (e) {
  8438. logger.error(e);
  8439. }
  8440. }
  8441. };
  8442. EventAggregator.prototype.subscribe = function subscribe(event, callback) {
  8443. var handler = void 0;
  8444. var subscribers = void 0;
  8445. if (!event) {
  8446. throw new Error('Event channel/type was invalid.');
  8447. }
  8448. if (typeof event === 'string') {
  8449. handler = callback;
  8450. subscribers = this.eventLookup[event] || (this.eventLookup[event] = []);
  8451. } else {
  8452. handler = new Handler(event, callback);
  8453. subscribers = this.messageHandlers;
  8454. }
  8455. subscribers.push(handler);
  8456. return {
  8457. dispose: function dispose() {
  8458. var idx = subscribers.indexOf(handler);
  8459. if (idx !== -1) {
  8460. subscribers.splice(idx, 1);
  8461. }
  8462. }
  8463. };
  8464. };
  8465. EventAggregator.prototype.subscribeOnce = function subscribeOnce(event, callback) {
  8466. var sub = this.subscribe(event, function (a, b) {
  8467. sub.dispose();
  8468. return callback(a, b);
  8469. });
  8470. return sub;
  8471. };
  8472. return EventAggregator;
  8473. }();
  8474. function includeEventsIn(obj) {
  8475. var ea = new EventAggregator();
  8476. obj.subscribeOnce = function (event, callback) {
  8477. return ea.subscribeOnce(event, callback);
  8478. };
  8479. obj.subscribe = function (event, callback) {
  8480. return ea.subscribe(event, callback);
  8481. };
  8482. obj.publish = function (event, data) {
  8483. ea.publish(event, data);
  8484. };
  8485. return ea;
  8486. }
  8487. function configure(config) {
  8488. config.instance(EventAggregator, includeEventsIn(config.aurelia));
  8489. }
  8490. });
  8491. 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) {
  8492. 'use strict';
  8493. Object.defineProperty(exports, "__esModule", {
  8494. value: true
  8495. });
  8496. exports.LogManager = exports.FrameworkConfiguration = exports.Aurelia = undefined;
  8497. Object.keys(_aureliaDependencyInjection).forEach(function (key) {
  8498. if (key === "default" || key === "__esModule") return;
  8499. Object.defineProperty(exports, key, {
  8500. enumerable: true,
  8501. get: function () {
  8502. return _aureliaDependencyInjection[key];
  8503. }
  8504. });
  8505. });
  8506. Object.keys(_aureliaBinding).forEach(function (key) {
  8507. if (key === "default" || key === "__esModule") return;
  8508. Object.defineProperty(exports, key, {
  8509. enumerable: true,
  8510. get: function () {
  8511. return _aureliaBinding[key];
  8512. }
  8513. });
  8514. });
  8515. Object.keys(_aureliaMetadata).forEach(function (key) {
  8516. if (key === "default" || key === "__esModule") return;
  8517. Object.defineProperty(exports, key, {
  8518. enumerable: true,
  8519. get: function () {
  8520. return _aureliaMetadata[key];
  8521. }
  8522. });
  8523. });
  8524. Object.keys(_aureliaTemplating).forEach(function (key) {
  8525. if (key === "default" || key === "__esModule") return;
  8526. Object.defineProperty(exports, key, {
  8527. enumerable: true,
  8528. get: function () {
  8529. return _aureliaTemplating[key];
  8530. }
  8531. });
  8532. });
  8533. Object.keys(_aureliaLoader).forEach(function (key) {
  8534. if (key === "default" || key === "__esModule") return;
  8535. Object.defineProperty(exports, key, {
  8536. enumerable: true,
  8537. get: function () {
  8538. return _aureliaLoader[key];
  8539. }
  8540. });
  8541. });
  8542. Object.keys(_aureliaTaskQueue).forEach(function (key) {
  8543. if (key === "default" || key === "__esModule") return;
  8544. Object.defineProperty(exports, key, {
  8545. enumerable: true,
  8546. get: function () {
  8547. return _aureliaTaskQueue[key];
  8548. }
  8549. });
  8550. });
  8551. Object.keys(_aureliaPath).forEach(function (key) {
  8552. if (key === "default" || key === "__esModule") return;
  8553. Object.defineProperty(exports, key, {
  8554. enumerable: true,
  8555. get: function () {
  8556. return _aureliaPath[key];
  8557. }
  8558. });
  8559. });
  8560. Object.keys(_aureliaPal).forEach(function (key) {
  8561. if (key === "default" || key === "__esModule") return;
  8562. Object.defineProperty(exports, key, {
  8563. enumerable: true,
  8564. get: function () {
  8565. return _aureliaPal[key];
  8566. }
  8567. });
  8568. });
  8569. var TheLogManager = _interopRequireWildcard(_aureliaLogging);
  8570. function _interopRequireWildcard(obj) {
  8571. if (obj && obj.__esModule) {
  8572. return obj;
  8573. } else {
  8574. var newObj = {};
  8575. if (obj != null) {
  8576. for (var key in obj) {
  8577. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  8578. }
  8579. }
  8580. newObj.default = obj;
  8581. return newObj;
  8582. }
  8583. }
  8584. function preventActionlessFormSubmit() {
  8585. _aureliaPal.DOM.addEventListener('submit', function (evt) {
  8586. var target = evt.target;
  8587. var action = target.action;
  8588. if (target.tagName.toLowerCase() === 'form' && !action) {
  8589. evt.preventDefault();
  8590. }
  8591. });
  8592. }
  8593. var Aurelia = exports.Aurelia = function () {
  8594. function Aurelia(loader, container, resources) {
  8595. this.loader = loader || new _aureliaPal.PLATFORM.Loader();
  8596. this.container = container || new _aureliaDependencyInjection.Container().makeGlobal();
  8597. this.resources = resources || new _aureliaTemplating.ViewResources();
  8598. this.use = new FrameworkConfiguration(this);
  8599. this.logger = TheLogManager.getLogger('aurelia');
  8600. this.hostConfigured = false;
  8601. this.host = null;
  8602. this.use.instance(Aurelia, this);
  8603. this.use.instance(_aureliaLoader.Loader, this.loader);
  8604. this.use.instance(_aureliaTemplating.ViewResources, this.resources);
  8605. }
  8606. Aurelia.prototype.start = function start() {
  8607. var _this = this;
  8608. if (this.started) {
  8609. return Promise.resolve(this);
  8610. }
  8611. this.started = true;
  8612. this.logger.info('Aurelia Starting');
  8613. return this.use.apply().then(function () {
  8614. preventActionlessFormSubmit();
  8615. if (!_this.container.hasResolver(_aureliaTemplating.BindingLanguage)) {
  8616. var message = 'You must configure Aurelia with a BindingLanguage implementation.';
  8617. _this.logger.error(message);
  8618. throw new Error(message);
  8619. }
  8620. _this.logger.info('Aurelia Started');
  8621. var evt = _aureliaPal.DOM.createCustomEvent('aurelia-started', { bubbles: true, cancelable: true });
  8622. _aureliaPal.DOM.dispatchEvent(evt);
  8623. return _this;
  8624. });
  8625. };
  8626. Aurelia.prototype.enhance = function enhance() {
  8627. var _this2 = this;
  8628. var bindingContext = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  8629. var applicationHost = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
  8630. this._configureHost(applicationHost || _aureliaPal.DOM.querySelectorAll('body')[0]);
  8631. return new Promise(function (resolve) {
  8632. var engine = _this2.container.get(_aureliaTemplating.TemplatingEngine);
  8633. _this2.root = engine.enhance({ container: _this2.container, element: _this2.host, resources: _this2.resources, bindingContext: bindingContext });
  8634. _this2.root.attached();
  8635. _this2._onAureliaComposed();
  8636. resolve(_this2);
  8637. });
  8638. };
  8639. Aurelia.prototype.setRoot = function setRoot() {
  8640. var _this3 = this;
  8641. var root = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
  8642. var applicationHost = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
  8643. var instruction = {};
  8644. if (this.root && this.root.viewModel && this.root.viewModel.router) {
  8645. this.root.viewModel.router.deactivate();
  8646. this.root.viewModel.router.reset();
  8647. }
  8648. this._configureHost(applicationHost);
  8649. var engine = this.container.get(_aureliaTemplating.TemplatingEngine);
  8650. var transaction = this.container.get(_aureliaTemplating.CompositionTransaction);
  8651. delete transaction.initialComposition;
  8652. if (!root) {
  8653. if (this.configModuleId) {
  8654. root = (0, _aureliaPath.relativeToFile)('./app', this.configModuleId);
  8655. } else {
  8656. root = 'app';
  8657. }
  8658. }
  8659. instruction.viewModel = root;
  8660. instruction.container = instruction.childContainer = this.container;
  8661. instruction.viewSlot = this.hostSlot;
  8662. instruction.host = this.host;
  8663. return engine.compose(instruction).then(function (r) {
  8664. _this3.root = r;
  8665. instruction.viewSlot.attached();
  8666. _this3._onAureliaComposed();
  8667. return _this3;
  8668. });
  8669. };
  8670. Aurelia.prototype._configureHost = function _configureHost(applicationHost) {
  8671. if (this.hostConfigured) {
  8672. return;
  8673. }
  8674. applicationHost = applicationHost || this.host;
  8675. if (!applicationHost || typeof applicationHost === 'string') {
  8676. this.host = _aureliaPal.DOM.getElementById(applicationHost || 'applicationHost');
  8677. } else {
  8678. this.host = applicationHost;
  8679. }
  8680. if (!this.host) {
  8681. throw new Error('No applicationHost was specified.');
  8682. }
  8683. this.hostConfigured = true;
  8684. this.host.aurelia = this;
  8685. this.hostSlot = new _aureliaTemplating.ViewSlot(this.host, true);
  8686. this.hostSlot.transformChildNodesIntoView();
  8687. this.container.registerInstance(_aureliaPal.DOM.boundary, this.host);
  8688. };
  8689. Aurelia.prototype._onAureliaComposed = function _onAureliaComposed() {
  8690. var evt = _aureliaPal.DOM.createCustomEvent('aurelia-composed', { bubbles: true, cancelable: true });
  8691. setTimeout(function () {
  8692. return _aureliaPal.DOM.dispatchEvent(evt);
  8693. }, 1);
  8694. };
  8695. return Aurelia;
  8696. }();
  8697. var logger = TheLogManager.getLogger('aurelia');
  8698. var extPattern = /\.[^/.]+$/;
  8699. function runTasks(config, tasks) {
  8700. var current = void 0;
  8701. var next = function next() {
  8702. current = tasks.shift();
  8703. if (current) {
  8704. return Promise.resolve(current(config)).then(next);
  8705. }
  8706. return Promise.resolve();
  8707. };
  8708. return next();
  8709. }
  8710. function loadPlugin(config, loader, info) {
  8711. logger.debug('Loading plugin ' + info.moduleId + '.');
  8712. config.resourcesRelativeTo = info.resourcesRelativeTo;
  8713. var id = info.moduleId;
  8714. if (info.resourcesRelativeTo.length > 1) {
  8715. return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) {
  8716. return _loadPlugin(normalizedId);
  8717. });
  8718. }
  8719. return _loadPlugin(id);
  8720. function _loadPlugin(moduleId) {
  8721. return loader.loadModule(moduleId).then(function (m) {
  8722. if ('configure' in m) {
  8723. return Promise.resolve(m.configure(config, info.config || {})).then(function () {
  8724. config.resourcesRelativeTo = null;
  8725. logger.debug('Configured plugin ' + info.moduleId + '.');
  8726. });
  8727. }
  8728. config.resourcesRelativeTo = null;
  8729. logger.debug('Loaded plugin ' + info.moduleId + '.');
  8730. });
  8731. }
  8732. }
  8733. function loadResources(aurelia, resourcesToLoad, appResources) {
  8734. var viewEngine = aurelia.container.get(_aureliaTemplating.ViewEngine);
  8735. return Promise.all(Object.keys(resourcesToLoad).map(function (n) {
  8736. return _normalize(resourcesToLoad[n]);
  8737. })).then(function (loads) {
  8738. var names = [];
  8739. var importIds = [];
  8740. loads.forEach(function (l) {
  8741. names.push(undefined);
  8742. importIds.push(l.importId);
  8743. });
  8744. return viewEngine.importViewResources(importIds, names, appResources);
  8745. });
  8746. function _normalize(load) {
  8747. var moduleId = load.moduleId;
  8748. var ext = getExt(moduleId);
  8749. if (isOtherResource(moduleId)) {
  8750. moduleId = removeExt(moduleId);
  8751. }
  8752. return aurelia.loader.normalize(moduleId, load.relativeTo).then(function (normalized) {
  8753. return {
  8754. name: load.moduleId,
  8755. importId: isOtherResource(load.moduleId) ? addOriginalExt(normalized, ext) : normalized
  8756. };
  8757. });
  8758. }
  8759. function isOtherResource(name) {
  8760. var ext = getExt(name);
  8761. if (!ext) return false;
  8762. if (ext === '') return false;
  8763. if (ext === '.js' || ext === '.ts') return false;
  8764. return true;
  8765. }
  8766. function removeExt(name) {
  8767. return name.replace(extPattern, '');
  8768. }
  8769. function addOriginalExt(normalized, ext) {
  8770. return removeExt(normalized) + '.' + ext;
  8771. }
  8772. }
  8773. function getExt(name) {
  8774. var match = name.match(extPattern);
  8775. if (match && match.length > 0) {
  8776. return match[0].split('.')[1];
  8777. }
  8778. }
  8779. function assertProcessed(plugins) {
  8780. if (plugins.processed) {
  8781. throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.');
  8782. }
  8783. }
  8784. var FrameworkConfiguration = function () {
  8785. function FrameworkConfiguration(aurelia) {
  8786. var _this4 = this;
  8787. this.aurelia = aurelia;
  8788. this.container = aurelia.container;
  8789. this.info = [];
  8790. this.processed = false;
  8791. this.preTasks = [];
  8792. this.postTasks = [];
  8793. this.resourcesToLoad = {};
  8794. this.preTask(function () {
  8795. return aurelia.loader.normalize('aurelia-bootstrapper').then(function (name) {
  8796. return _this4.bootstrapperName = name;
  8797. });
  8798. });
  8799. this.postTask(function () {
  8800. return loadResources(aurelia, _this4.resourcesToLoad, aurelia.resources);
  8801. });
  8802. }
  8803. FrameworkConfiguration.prototype.instance = function instance(type, _instance) {
  8804. this.container.registerInstance(type, _instance);
  8805. return this;
  8806. };
  8807. FrameworkConfiguration.prototype.singleton = function singleton(type, implementation) {
  8808. this.container.registerSingleton(type, implementation);
  8809. return this;
  8810. };
  8811. FrameworkConfiguration.prototype.transient = function transient(type, implementation) {
  8812. this.container.registerTransient(type, implementation);
  8813. return this;
  8814. };
  8815. FrameworkConfiguration.prototype.preTask = function preTask(task) {
  8816. assertProcessed(this);
  8817. this.preTasks.push(task);
  8818. return this;
  8819. };
  8820. FrameworkConfiguration.prototype.postTask = function postTask(task) {
  8821. assertProcessed(this);
  8822. this.postTasks.push(task);
  8823. return this;
  8824. };
  8825. FrameworkConfiguration.prototype.feature = function feature(plugin, config) {
  8826. if (getExt(plugin)) {
  8827. return this.plugin({ moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: config || {} });
  8828. }
  8829. return this.plugin({ moduleId: plugin + '/index', resourcesRelativeTo: [plugin, ''], config: config || {} });
  8830. };
  8831. FrameworkConfiguration.prototype.globalResources = function globalResources(resources) {
  8832. assertProcessed(this);
  8833. var toAdd = Array.isArray(resources) ? resources : arguments;
  8834. var resource = void 0;
  8835. var resourcesRelativeTo = this.resourcesRelativeTo || ['', ''];
  8836. for (var i = 0, ii = toAdd.length; i < ii; ++i) {
  8837. resource = toAdd[i];
  8838. if (typeof resource !== 'string') {
  8839. throw new Error('Invalid resource path [' + resource + ']. Resources must be specified as relative module IDs.');
  8840. }
  8841. var parent = resourcesRelativeTo[0];
  8842. var grandParent = resourcesRelativeTo[1];
  8843. var name = resource;
  8844. if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') {
  8845. name = (0, _aureliaPath.join)(parent, resource);
  8846. }
  8847. this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent };
  8848. }
  8849. return this;
  8850. };
  8851. FrameworkConfiguration.prototype.globalName = function globalName(resourcePath, newName) {
  8852. assertProcessed(this);
  8853. this.resourcesToLoad[resourcePath] = { moduleId: newName, relativeTo: '' };
  8854. return this;
  8855. };
  8856. FrameworkConfiguration.prototype.plugin = function plugin(_plugin, config) {
  8857. assertProcessed(this);
  8858. if (typeof _plugin === 'string') {
  8859. return this.plugin({ moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: config || {} });
  8860. }
  8861. this.info.push(_plugin);
  8862. return this;
  8863. };
  8864. FrameworkConfiguration.prototype._addNormalizedPlugin = function _addNormalizedPlugin(name, config) {
  8865. var _this5 = this;
  8866. var plugin = { moduleId: name, resourcesRelativeTo: [name, ''], config: config || {} };
  8867. this.plugin(plugin);
  8868. this.preTask(function () {
  8869. var relativeTo = [name, _this5.bootstrapperName];
  8870. plugin.moduleId = name;
  8871. plugin.resourcesRelativeTo = relativeTo;
  8872. return Promise.resolve();
  8873. });
  8874. return this;
  8875. };
  8876. FrameworkConfiguration.prototype.defaultBindingLanguage = function defaultBindingLanguage() {
  8877. return this._addNormalizedPlugin('aurelia-templating-binding');
  8878. };
  8879. FrameworkConfiguration.prototype.router = function router() {
  8880. return this._addNormalizedPlugin('aurelia-templating-router');
  8881. };
  8882. FrameworkConfiguration.prototype.history = function history() {
  8883. return this._addNormalizedPlugin('aurelia-history-browser');
  8884. };
  8885. FrameworkConfiguration.prototype.defaultResources = function defaultResources() {
  8886. return this._addNormalizedPlugin('aurelia-templating-resources');
  8887. };
  8888. FrameworkConfiguration.prototype.eventAggregator = function eventAggregator() {
  8889. return this._addNormalizedPlugin('aurelia-event-aggregator');
  8890. };
  8891. FrameworkConfiguration.prototype.basicConfiguration = function basicConfiguration() {
  8892. return this.defaultBindingLanguage().defaultResources().eventAggregator();
  8893. };
  8894. FrameworkConfiguration.prototype.standardConfiguration = function standardConfiguration() {
  8895. return this.basicConfiguration().history().router();
  8896. };
  8897. FrameworkConfiguration.prototype.developmentLogging = function developmentLogging() {
  8898. var _this6 = this;
  8899. this.preTask(function () {
  8900. return _this6.aurelia.loader.normalize('aurelia-logging-console', _this6.bootstrapperName).then(function (name) {
  8901. return _this6.aurelia.loader.loadModule(name).then(function (m) {
  8902. TheLogManager.addAppender(new m.ConsoleAppender());
  8903. TheLogManager.setLevel(TheLogManager.logLevel.debug);
  8904. });
  8905. });
  8906. });
  8907. return this;
  8908. };
  8909. FrameworkConfiguration.prototype.apply = function apply() {
  8910. var _this7 = this;
  8911. if (this.processed) {
  8912. return Promise.resolve();
  8913. }
  8914. return runTasks(this, this.preTasks).then(function () {
  8915. var loader = _this7.aurelia.loader;
  8916. var info = _this7.info;
  8917. var current = void 0;
  8918. var next = function next() {
  8919. current = info.shift();
  8920. if (current) {
  8921. return loadPlugin(_this7, loader, current).then(next);
  8922. }
  8923. _this7.processed = true;
  8924. return Promise.resolve();
  8925. };
  8926. return next().then(function () {
  8927. return runTasks(_this7, _this7.postTasks);
  8928. });
  8929. });
  8930. };
  8931. return FrameworkConfiguration;
  8932. }();
  8933. exports.FrameworkConfiguration = FrameworkConfiguration;
  8934. var LogManager = exports.LogManager = TheLogManager;
  8935. });
  8936. define('aurelia-metadata',['exports', 'aurelia-pal'], function (exports, _aureliaPal) {
  8937. 'use strict';
  8938. Object.defineProperty(exports, "__esModule", {
  8939. value: true
  8940. });
  8941. exports.Origin = exports.metadata = undefined;
  8942. exports.decorators = decorators;
  8943. exports.deprecated = deprecated;
  8944. exports.mixin = mixin;
  8945. exports.protocol = protocol;
  8946. var _extends = Object.assign || function (target) {
  8947. for (var i = 1; i < arguments.length; i++) {
  8948. var source = arguments[i];
  8949. for (var key in source) {
  8950. if (Object.prototype.hasOwnProperty.call(source, key)) {
  8951. target[key] = source[key];
  8952. }
  8953. }
  8954. }
  8955. return target;
  8956. };
  8957. var metadata = exports.metadata = {
  8958. resource: 'aurelia:resource',
  8959. paramTypes: 'design:paramtypes',
  8960. propertyType: 'design:type',
  8961. properties: 'design:properties',
  8962. get: function get(metadataKey, target, targetKey) {
  8963. if (!target) {
  8964. return undefined;
  8965. }
  8966. var result = metadata.getOwn(metadataKey, target, targetKey);
  8967. return result === undefined ? metadata.get(metadataKey, Object.getPrototypeOf(target), targetKey) : result;
  8968. },
  8969. getOwn: function getOwn(metadataKey, target, targetKey) {
  8970. if (!target) {
  8971. return undefined;
  8972. }
  8973. return Reflect.getOwnMetadata(metadataKey, target, targetKey);
  8974. },
  8975. define: function define(metadataKey, metadataValue, target, targetKey) {
  8976. Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey);
  8977. },
  8978. getOrCreateOwn: function getOrCreateOwn(metadataKey, Type, target, targetKey) {
  8979. var result = metadata.getOwn(metadataKey, target, targetKey);
  8980. if (result === undefined) {
  8981. result = new Type();
  8982. Reflect.defineMetadata(metadataKey, result, target, targetKey);
  8983. }
  8984. return result;
  8985. }
  8986. };
  8987. var originStorage = new Map();
  8988. var unknownOrigin = Object.freeze({ moduleId: undefined, moduleMember: undefined });
  8989. var Origin = exports.Origin = function () {
  8990. function Origin(moduleId, moduleMember) {
  8991. this.moduleId = moduleId;
  8992. this.moduleMember = moduleMember;
  8993. }
  8994. Origin.get = function get(fn) {
  8995. var origin = originStorage.get(fn);
  8996. if (origin === undefined) {
  8997. _aureliaPal.PLATFORM.eachModule(function (key, value) {
  8998. for (var name in value) {
  8999. var exp = value[name];
  9000. if (exp === fn) {
  9001. originStorage.set(fn, origin = new Origin(key, name));
  9002. return true;
  9003. }
  9004. }
  9005. if (value === fn) {
  9006. originStorage.set(fn, origin = new Origin(key, 'default'));
  9007. return true;
  9008. }
  9009. return false;
  9010. });
  9011. }
  9012. return origin || unknownOrigin;
  9013. };
  9014. Origin.set = function set(fn, origin) {
  9015. originStorage.set(fn, origin);
  9016. };
  9017. return Origin;
  9018. }();
  9019. function decorators() {
  9020. for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
  9021. rest[_key] = arguments[_key];
  9022. }
  9023. var applicator = function applicator(target, key, descriptor) {
  9024. var i = rest.length;
  9025. if (key) {
  9026. descriptor = descriptor || {
  9027. value: target[key],
  9028. writable: true,
  9029. configurable: true,
  9030. enumerable: true
  9031. };
  9032. while (i--) {
  9033. descriptor = rest[i](target, key, descriptor) || descriptor;
  9034. }
  9035. Object.defineProperty(target, key, descriptor);
  9036. } else {
  9037. while (i--) {
  9038. target = rest[i](target) || target;
  9039. }
  9040. }
  9041. return target;
  9042. };
  9043. applicator.on = applicator;
  9044. return applicator;
  9045. }
  9046. function deprecated(optionsOrTarget, maybeKey, maybeDescriptor) {
  9047. function decorator(target, key, descriptor) {
  9048. var methodSignature = target.constructor.name + '#' + key;
  9049. var options = maybeKey ? {} : optionsOrTarget || {};
  9050. var message = 'DEPRECATION - ' + methodSignature;
  9051. if (typeof descriptor.value !== 'function') {
  9052. throw new SyntaxError('Only methods can be marked as deprecated.');
  9053. }
  9054. if (options.message) {
  9055. message += ' - ' + options.message;
  9056. }
  9057. return _extends({}, descriptor, {
  9058. value: function deprecationWrapper() {
  9059. if (options.error) {
  9060. throw new Error(message);
  9061. } else {
  9062. console.warn(message);
  9063. }
  9064. return descriptor.value.apply(this, arguments);
  9065. }
  9066. });
  9067. }
  9068. return maybeKey ? decorator(optionsOrTarget, maybeKey, maybeDescriptor) : decorator;
  9069. }
  9070. function mixin(behavior) {
  9071. var instanceKeys = Object.keys(behavior);
  9072. function _mixin(possible) {
  9073. var decorator = function decorator(target) {
  9074. var resolvedTarget = typeof target === 'function' ? target.prototype : target;
  9075. var i = instanceKeys.length;
  9076. while (i--) {
  9077. var property = instanceKeys[i];
  9078. Object.defineProperty(resolvedTarget, property, {
  9079. value: behavior[property],
  9080. writable: true
  9081. });
  9082. }
  9083. };
  9084. return possible ? decorator(possible) : decorator;
  9085. }
  9086. return _mixin;
  9087. }
  9088. function alwaysValid() {
  9089. return true;
  9090. }
  9091. function noCompose() {}
  9092. function ensureProtocolOptions(options) {
  9093. if (options === undefined) {
  9094. options = {};
  9095. } else if (typeof options === 'function') {
  9096. options = {
  9097. validate: options
  9098. };
  9099. }
  9100. if (!options.validate) {
  9101. options.validate = alwaysValid;
  9102. }
  9103. if (!options.compose) {
  9104. options.compose = noCompose;
  9105. }
  9106. return options;
  9107. }
  9108. function createProtocolValidator(validate) {
  9109. return function (target) {
  9110. var result = validate(target);
  9111. return result === true;
  9112. };
  9113. }
  9114. function createProtocolAsserter(name, validate) {
  9115. return function (target) {
  9116. var result = validate(target);
  9117. if (result !== true) {
  9118. throw new Error(result || name + ' was not correctly implemented.');
  9119. }
  9120. };
  9121. }
  9122. function protocol(name, options) {
  9123. options = ensureProtocolOptions(options);
  9124. var result = function result(target) {
  9125. var resolvedTarget = typeof target === 'function' ? target.prototype : target;
  9126. options.compose(resolvedTarget);
  9127. result.assert(resolvedTarget);
  9128. Object.defineProperty(resolvedTarget, 'protocol:' + name, {
  9129. enumerable: false,
  9130. configurable: false,
  9131. writable: false,
  9132. value: true
  9133. });
  9134. };
  9135. result.validate = createProtocolValidator(options.validate);
  9136. result.assert = createProtocolAsserter(name, options.validate);
  9137. return result;
  9138. }
  9139. protocol.create = function (name, options) {
  9140. options = ensureProtocolOptions(options);
  9141. var hidden = 'protocol:' + name;
  9142. var result = function result(target) {
  9143. var decorator = protocol(name, options);
  9144. return target ? decorator(target) : decorator;
  9145. };
  9146. result.decorates = function (obj) {
  9147. return obj[hidden] === true;
  9148. };
  9149. result.validate = createProtocolValidator(options.validate);
  9150. result.assert = createProtocolAsserter(name, options.validate);
  9151. return result;
  9152. };
  9153. });
  9154. define('aurelia-pal',['exports'], function (exports) {
  9155. 'use strict';
  9156. Object.defineProperty(exports, "__esModule", {
  9157. value: true
  9158. });
  9159. exports.AggregateError = AggregateError;
  9160. exports.initializePAL = initializePAL;
  9161. function AggregateError(message, innerError, skipIfAlreadyAggregate) {
  9162. if (innerError) {
  9163. if (innerError.innerError && skipIfAlreadyAggregate) {
  9164. return innerError;
  9165. }
  9166. var separator = '\n------------------------------------------------\n';
  9167. message += separator + 'Inner Error:\n';
  9168. if (typeof innerError === 'string') {
  9169. message += 'Message: ' + innerError;
  9170. } else {
  9171. if (innerError.message) {
  9172. message += 'Message: ' + innerError.message;
  9173. } else {
  9174. message += 'Unknown Inner Error Type. Displaying Inner Error as JSON:\n ' + JSON.stringify(innerError, null, ' ');
  9175. }
  9176. if (innerError.stack) {
  9177. message += '\nInner Error Stack:\n' + innerError.stack;
  9178. message += '\nEnd Inner Error Stack';
  9179. }
  9180. }
  9181. message += separator;
  9182. }
  9183. var e = new Error(message);
  9184. if (innerError) {
  9185. e.innerError = innerError;
  9186. }
  9187. return e;
  9188. }
  9189. var FEATURE = exports.FEATURE = {};
  9190. var PLATFORM = exports.PLATFORM = {
  9191. noop: function noop() {},
  9192. eachModule: function eachModule() {}
  9193. };
  9194. PLATFORM.global = function () {
  9195. if (typeof self !== 'undefined') {
  9196. return self;
  9197. }
  9198. if (typeof global !== 'undefined') {
  9199. return global;
  9200. }
  9201. return new Function('return this')();
  9202. }();
  9203. var DOM = exports.DOM = {};
  9204. function initializePAL(callback) {
  9205. if (typeof Object.getPropertyDescriptor !== 'function') {
  9206. Object.getPropertyDescriptor = function (subject, name) {
  9207. var pd = Object.getOwnPropertyDescriptor(subject, name);
  9208. var proto = Object.getPrototypeOf(subject);
  9209. while (typeof pd === 'undefined' && proto !== null) {
  9210. pd = Object.getOwnPropertyDescriptor(proto, name);
  9211. proto = Object.getPrototypeOf(proto);
  9212. }
  9213. return pd;
  9214. };
  9215. }
  9216. callback(PLATFORM, FEATURE, DOM);
  9217. }
  9218. });
  9219. define('aurelia-history-browser',['exports', 'aurelia-pal', 'aurelia-history'], function (exports, _aureliaPal, _aureliaHistory) {
  9220. 'use strict';
  9221. Object.defineProperty(exports, "__esModule", {
  9222. value: true
  9223. });
  9224. exports.BrowserHistory = exports.DefaultLinkHandler = exports.LinkHandler = undefined;
  9225. exports.configure = configure;
  9226. var _class, _temp;
  9227. function _possibleConstructorReturn(self, call) {
  9228. if (!self) {
  9229. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  9230. }
  9231. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  9232. }
  9233. function _inherits(subClass, superClass) {
  9234. if (typeof superClass !== "function" && superClass !== null) {
  9235. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  9236. }
  9237. subClass.prototype = Object.create(superClass && superClass.prototype, {
  9238. constructor: {
  9239. value: subClass,
  9240. enumerable: false,
  9241. writable: true,
  9242. configurable: true
  9243. }
  9244. });
  9245. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  9246. }
  9247. var LinkHandler = exports.LinkHandler = function () {
  9248. function LinkHandler() {
  9249. }
  9250. LinkHandler.prototype.activate = function activate(history) {};
  9251. LinkHandler.prototype.deactivate = function deactivate() {};
  9252. return LinkHandler;
  9253. }();
  9254. var DefaultLinkHandler = exports.DefaultLinkHandler = function (_LinkHandler) {
  9255. _inherits(DefaultLinkHandler, _LinkHandler);
  9256. function DefaultLinkHandler() {
  9257. var _this = _possibleConstructorReturn(this, _LinkHandler.call(this));
  9258. _this.handler = function (e) {
  9259. var _DefaultLinkHandler$g = DefaultLinkHandler.getEventInfo(e);
  9260. var shouldHandleEvent = _DefaultLinkHandler$g.shouldHandleEvent;
  9261. var href = _DefaultLinkHandler$g.href;
  9262. if (shouldHandleEvent) {
  9263. e.preventDefault();
  9264. _this.history.navigate(href);
  9265. }
  9266. };
  9267. return _this;
  9268. }
  9269. DefaultLinkHandler.prototype.activate = function activate(history) {
  9270. if (history._hasPushState) {
  9271. this.history = history;
  9272. _aureliaPal.DOM.addEventListener('click', this.handler, true);
  9273. }
  9274. };
  9275. DefaultLinkHandler.prototype.deactivate = function deactivate() {
  9276. _aureliaPal.DOM.removeEventListener('click', this.handler);
  9277. };
  9278. DefaultLinkHandler.getEventInfo = function getEventInfo(event) {
  9279. var info = {
  9280. shouldHandleEvent: false,
  9281. href: null,
  9282. anchor: null
  9283. };
  9284. var target = DefaultLinkHandler.findClosestAnchor(event.target);
  9285. if (!target || !DefaultLinkHandler.targetIsThisWindow(target)) {
  9286. return info;
  9287. }
  9288. if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
  9289. return info;
  9290. }
  9291. var href = target.getAttribute('href');
  9292. info.anchor = target;
  9293. info.href = href;
  9294. var leftButtonClicked = event.which === 1;
  9295. var isRelative = href && !(href.charAt(0) === '#' || /^[a-z]+:/i.test(href));
  9296. info.shouldHandleEvent = leftButtonClicked && isRelative;
  9297. return info;
  9298. };
  9299. DefaultLinkHandler.findClosestAnchor = function findClosestAnchor(el) {
  9300. while (el) {
  9301. if (el.tagName === 'A') {
  9302. return el;
  9303. }
  9304. el = el.parentNode;
  9305. }
  9306. };
  9307. DefaultLinkHandler.targetIsThisWindow = function targetIsThisWindow(target) {
  9308. var targetWindow = target.getAttribute('target');
  9309. var win = _aureliaPal.PLATFORM.global;
  9310. return !targetWindow || targetWindow === win.name || targetWindow === '_self' || targetWindow === 'top' && win === win.top;
  9311. };
  9312. return DefaultLinkHandler;
  9313. }(LinkHandler);
  9314. function configure(config) {
  9315. config.singleton(_aureliaHistory.History, BrowserHistory);
  9316. config.transient(LinkHandler, DefaultLinkHandler);
  9317. }
  9318. var BrowserHistory = exports.BrowserHistory = (_temp = _class = function (_History) {
  9319. _inherits(BrowserHistory, _History);
  9320. function BrowserHistory(linkHandler) {
  9321. var _this2 = _possibleConstructorReturn(this, _History.call(this));
  9322. _this2._isActive = false;
  9323. _this2._checkUrlCallback = _this2._checkUrl.bind(_this2);
  9324. _this2.location = _aureliaPal.PLATFORM.location;
  9325. _this2.history = _aureliaPal.PLATFORM.history;
  9326. _this2.linkHandler = linkHandler;
  9327. return _this2;
  9328. }
  9329. BrowserHistory.prototype.activate = function activate(options) {
  9330. if (this._isActive) {
  9331. throw new Error('History has already been activated.');
  9332. }
  9333. var wantsPushState = !!options.pushState;
  9334. this._isActive = true;
  9335. this.options = Object.assign({}, { root: '/' }, this.options, options);
  9336. this.root = ('/' + this.options.root + '/').replace(rootStripper, '/');
  9337. this._wantsHashChange = this.options.hashChange !== false;
  9338. this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState);
  9339. var eventName = void 0;
  9340. if (this._hasPushState) {
  9341. eventName = 'popstate';
  9342. } else if (this._wantsHashChange) {
  9343. eventName = 'hashchange';
  9344. }
  9345. _aureliaPal.PLATFORM.addEventListener(eventName, this._checkUrlCallback);
  9346. if (this._wantsHashChange && wantsPushState) {
  9347. var loc = this.location;
  9348. var atRoot = loc.pathname.replace(/[^\/]$/, '$&/') === this.root;
  9349. if (!this._hasPushState && !atRoot) {
  9350. this.fragment = this._getFragment(null, true);
  9351. this.location.replace(this.root + this.location.search + '#' + this.fragment);
  9352. return true;
  9353. } else if (this._hasPushState && atRoot && loc.hash) {
  9354. this.fragment = this._getHash().replace(routeStripper, '');
  9355. this.history.replaceState({}, _aureliaPal.DOM.title, this.root + this.fragment + loc.search);
  9356. }
  9357. }
  9358. if (!this.fragment) {
  9359. this.fragment = this._getFragment();
  9360. }
  9361. this.linkHandler.activate(this);
  9362. if (!this.options.silent) {
  9363. return this._loadUrl();
  9364. }
  9365. };
  9366. BrowserHistory.prototype.deactivate = function deactivate() {
  9367. _aureliaPal.PLATFORM.removeEventListener('popstate', this._checkUrlCallback);
  9368. _aureliaPal.PLATFORM.removeEventListener('hashchange', this._checkUrlCallback);
  9369. this._isActive = false;
  9370. this.linkHandler.deactivate();
  9371. };
  9372. BrowserHistory.prototype.getAbsoluteRoot = function getAbsoluteRoot() {
  9373. var origin = createOrigin(this.location.protocol, this.location.hostname, this.location.port);
  9374. return '' + origin + this.root;
  9375. };
  9376. BrowserHistory.prototype.navigate = function navigate(fragment) {
  9377. var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  9378. var _ref$trigger = _ref.trigger;
  9379. var trigger = _ref$trigger === undefined ? true : _ref$trigger;
  9380. var _ref$replace = _ref.replace;
  9381. var replace = _ref$replace === undefined ? false : _ref$replace;
  9382. if (fragment && absoluteUrl.test(fragment)) {
  9383. this.location.href = fragment;
  9384. return true;
  9385. }
  9386. if (!this._isActive) {
  9387. return false;
  9388. }
  9389. fragment = this._getFragment(fragment || '');
  9390. if (this.fragment === fragment && !replace) {
  9391. return false;
  9392. }
  9393. this.fragment = fragment;
  9394. var url = this.root + fragment;
  9395. if (fragment === '' && url !== '/') {
  9396. url = url.slice(0, -1);
  9397. }
  9398. if (this._hasPushState) {
  9399. url = url.replace('//', '/');
  9400. this.history[replace ? 'replaceState' : 'pushState']({}, _aureliaPal.DOM.title, url);
  9401. } else if (this._wantsHashChange) {
  9402. updateHash(this.location, fragment, replace);
  9403. } else {
  9404. return this.location.assign(url);
  9405. }
  9406. if (trigger) {
  9407. return this._loadUrl(fragment);
  9408. }
  9409. };
  9410. BrowserHistory.prototype.navigateBack = function navigateBack() {
  9411. this.history.back();
  9412. };
  9413. BrowserHistory.prototype.setTitle = function setTitle(title) {
  9414. _aureliaPal.DOM.title = title;
  9415. };
  9416. BrowserHistory.prototype._getHash = function _getHash() {
  9417. return this.location.hash.substr(1);
  9418. };
  9419. BrowserHistory.prototype._getFragment = function _getFragment(fragment, forcePushState) {
  9420. var root = void 0;
  9421. if (!fragment) {
  9422. if (this._hasPushState || !this._wantsHashChange || forcePushState) {
  9423. fragment = this.location.pathname + this.location.search;
  9424. root = this.root.replace(trailingSlash, '');
  9425. if (!fragment.indexOf(root)) {
  9426. fragment = fragment.substr(root.length);
  9427. }
  9428. } else {
  9429. fragment = this._getHash();
  9430. }
  9431. }
  9432. return '/' + fragment.replace(routeStripper, '');
  9433. };
  9434. BrowserHistory.prototype._checkUrl = function _checkUrl() {
  9435. var current = this._getFragment();
  9436. if (current !== this.fragment) {
  9437. this._loadUrl();
  9438. }
  9439. };
  9440. BrowserHistory.prototype._loadUrl = function _loadUrl(fragmentOverride) {
  9441. var fragment = this.fragment = this._getFragment(fragmentOverride);
  9442. return this.options.routeHandler ? this.options.routeHandler(fragment) : false;
  9443. };
  9444. return BrowserHistory;
  9445. }(_aureliaHistory.History), _class.inject = [LinkHandler], _temp);
  9446. var routeStripper = /^#?\/*|\s+$/g;
  9447. var rootStripper = /^\/+|\/+$/g;
  9448. var trailingSlash = /\/$/;
  9449. var absoluteUrl = /^([a-z][a-z0-9+\-.]*:)?\/\//i;
  9450. function updateHash(location, fragment, replace) {
  9451. if (replace) {
  9452. var _href = location.href.replace(/(javascript:|#).*$/, '');
  9453. location.replace(_href + '#' + fragment);
  9454. } else {
  9455. location.hash = '#' + fragment;
  9456. }
  9457. }
  9458. function createOrigin(protocol, hostname, port) {
  9459. return protocol + '//' + hostname + (port ? ':' + port : '');
  9460. }
  9461. });
  9462. define('aurelia-history',['exports'], function (exports) {
  9463. 'use strict';
  9464. Object.defineProperty(exports, "__esModule", {
  9465. value: true
  9466. });
  9467. function mi(name) {
  9468. throw new Error('History must implement ' + name + '().');
  9469. }
  9470. var History = exports.History = function () {
  9471. function History() {
  9472. }
  9473. History.prototype.activate = function activate(options) {
  9474. mi('activate');
  9475. };
  9476. History.prototype.deactivate = function deactivate() {
  9477. mi('deactivate');
  9478. };
  9479. History.prototype.getAbsoluteRoot = function getAbsoluteRoot() {
  9480. mi('getAbsoluteRoot');
  9481. };
  9482. History.prototype.navigate = function navigate(fragment, options) {
  9483. mi('navigate');
  9484. };
  9485. History.prototype.navigateBack = function navigateBack() {
  9486. mi('navigateBack');
  9487. };
  9488. History.prototype.setTitle = function setTitle(title) {
  9489. mi('setTitle');
  9490. };
  9491. return History;
  9492. }();
  9493. });
  9494. define('aurelia-loader',['exports', 'aurelia-path', 'aurelia-metadata'], function (exports, _aureliaPath, _aureliaMetadata) {
  9495. 'use strict';
  9496. Object.defineProperty(exports, "__esModule", {
  9497. value: true
  9498. });
  9499. exports.Loader = exports.TemplateRegistryEntry = exports.TemplateDependency = undefined;
  9500. var _createClass = function () {
  9501. function defineProperties(target, props) {
  9502. for (var i = 0; i < props.length; i++) {
  9503. var descriptor = props[i];
  9504. descriptor.enumerable = descriptor.enumerable || false;
  9505. descriptor.configurable = true;
  9506. if ("value" in descriptor) descriptor.writable = true;
  9507. Object.defineProperty(target, descriptor.key, descriptor);
  9508. }
  9509. }
  9510. return function (Constructor, protoProps, staticProps) {
  9511. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  9512. if (staticProps) defineProperties(Constructor, staticProps);
  9513. return Constructor;
  9514. };
  9515. }();
  9516. var TemplateDependency = exports.TemplateDependency = function TemplateDependency(src, name) {
  9517. this.src = src;
  9518. this.name = name;
  9519. };
  9520. var TemplateRegistryEntry = exports.TemplateRegistryEntry = function () {
  9521. function TemplateRegistryEntry(address) {
  9522. this.templateIsLoaded = false;
  9523. this.factoryIsReady = false;
  9524. this.resources = null;
  9525. this.dependencies = null;
  9526. this.address = address;
  9527. this.onReady = null;
  9528. this._template = null;
  9529. this._factory = null;
  9530. }
  9531. TemplateRegistryEntry.prototype.addDependency = function addDependency(src, name) {
  9532. var finalSrc = typeof src === 'string' ? (0, _aureliaPath.relativeToFile)(src, this.address) : _aureliaMetadata.Origin.get(src).moduleId;
  9533. this.dependencies.push(new TemplateDependency(finalSrc, name));
  9534. };
  9535. _createClass(TemplateRegistryEntry, [{
  9536. key: 'template',
  9537. get: function get() {
  9538. return this._template;
  9539. },
  9540. set: function set(value) {
  9541. var address = this.address;
  9542. var requires = void 0;
  9543. var current = void 0;
  9544. var src = void 0;
  9545. var dependencies = void 0;
  9546. this._template = value;
  9547. this.templateIsLoaded = true;
  9548. requires = value.content.querySelectorAll('require');
  9549. dependencies = this.dependencies = new Array(requires.length);
  9550. for (var i = 0, ii = requires.length; i < ii; ++i) {
  9551. current = requires[i];
  9552. src = current.getAttribute('from');
  9553. if (!src) {
  9554. throw new Error('<require> element in ' + address + ' has no "from" attribute.');
  9555. }
  9556. dependencies[i] = new TemplateDependency((0, _aureliaPath.relativeToFile)(src, address), current.getAttribute('as'));
  9557. if (current.parentNode) {
  9558. current.parentNode.removeChild(current);
  9559. }
  9560. }
  9561. }
  9562. }, {
  9563. key: 'factory',
  9564. get: function get() {
  9565. return this._factory;
  9566. },
  9567. set: function set(value) {
  9568. this._factory = value;
  9569. this.factoryIsReady = true;
  9570. }
  9571. }]);
  9572. return TemplateRegistryEntry;
  9573. }();
  9574. var Loader = exports.Loader = function () {
  9575. function Loader() {
  9576. this.templateRegistry = {};
  9577. }
  9578. Loader.prototype.map = function map(id, source) {
  9579. throw new Error('Loaders must implement map(id, source).');
  9580. };
  9581. Loader.prototype.normalizeSync = function normalizeSync(moduleId, relativeTo) {
  9582. throw new Error('Loaders must implement normalizeSync(moduleId, relativeTo).');
  9583. };
  9584. Loader.prototype.normalize = function normalize(moduleId, relativeTo) {
  9585. throw new Error('Loaders must implement normalize(moduleId: string, relativeTo: string): Promise<string>.');
  9586. };
  9587. Loader.prototype.loadModule = function loadModule(id) {
  9588. throw new Error('Loaders must implement loadModule(id).');
  9589. };
  9590. Loader.prototype.loadAllModules = function loadAllModules(ids) {
  9591. throw new Error('Loader must implement loadAllModules(ids).');
  9592. };
  9593. Loader.prototype.loadTemplate = function loadTemplate(url) {
  9594. throw new Error('Loader must implement loadTemplate(url).');
  9595. };
  9596. Loader.prototype.loadText = function loadText(url) {
  9597. throw new Error('Loader must implement loadText(url).');
  9598. };
  9599. Loader.prototype.applyPluginToUrl = function applyPluginToUrl(url, pluginName) {
  9600. throw new Error('Loader must implement applyPluginToUrl(url, pluginName).');
  9601. };
  9602. Loader.prototype.addPlugin = function addPlugin(pluginName, implementation) {
  9603. throw new Error('Loader must implement addPlugin(pluginName, implementation).');
  9604. };
  9605. Loader.prototype.getOrCreateTemplateRegistryEntry = function getOrCreateTemplateRegistryEntry(address) {
  9606. return this.templateRegistry[address] || (this.templateRegistry[address] = new TemplateRegistryEntry(address));
  9607. };
  9608. return Loader;
  9609. }();
  9610. });
  9611. define('aurelia-polyfills',['aurelia-pal'], function (_aureliaPal) {
  9612. 'use strict';
  9613. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  9614. return typeof obj;
  9615. } : function (obj) {
  9616. return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
  9617. };
  9618. (function (Object, GOPS) {
  9619. 'use strict';
  9620. if (GOPS in Object) return;
  9621. var setDescriptor,
  9622. G = _aureliaPal.PLATFORM.global,
  9623. id = 0,
  9624. random = '' + Math.random(),
  9625. prefix = '__\x01symbol:',
  9626. prefixLength = prefix.length,
  9627. internalSymbol = '__\x01symbol@@' + random,
  9628. DP = 'defineProperty',
  9629. DPies = 'defineProperties',
  9630. GOPN = 'getOwnPropertyNames',
  9631. GOPD = 'getOwnPropertyDescriptor',
  9632. PIE = 'propertyIsEnumerable',
  9633. gOPN = Object[GOPN],
  9634. gOPD = Object[GOPD],
  9635. create = Object.create,
  9636. keys = Object.keys,
  9637. defineProperty = Object[DP],
  9638. $defineProperties = Object[DPies],
  9639. descriptor = gOPD(Object, GOPN),
  9640. ObjectProto = Object.prototype,
  9641. hOP = ObjectProto.hasOwnProperty,
  9642. pIE = ObjectProto[PIE],
  9643. toString = ObjectProto.toString,
  9644. indexOf = Array.prototype.indexOf || function (v) {
  9645. for (var i = this.length; i-- && this[i] !== v;) {}
  9646. return i;
  9647. },
  9648. addInternalIfNeeded = function addInternalIfNeeded(o, uid, enumerable) {
  9649. if (!hOP.call(o, internalSymbol)) {
  9650. defineProperty(o, internalSymbol, {
  9651. enumerable: false,
  9652. configurable: false,
  9653. writable: false,
  9654. value: {}
  9655. });
  9656. }
  9657. o[internalSymbol]['@@' + uid] = enumerable;
  9658. },
  9659. createWithSymbols = function createWithSymbols(proto, descriptors) {
  9660. var self = create(proto);
  9661. gOPN(descriptors).forEach(function (key) {
  9662. if (propertyIsEnumerable.call(descriptors, key)) {
  9663. $defineProperty(self, key, descriptors[key]);
  9664. }
  9665. });
  9666. return self;
  9667. },
  9668. copyAsNonEnumerable = function copyAsNonEnumerable(descriptor) {
  9669. var newDescriptor = create(descriptor);
  9670. newDescriptor.enumerable = false;
  9671. return newDescriptor;
  9672. },
  9673. get = function get() {},
  9674. onlyNonSymbols = function onlyNonSymbols(name) {
  9675. return name != internalSymbol && !hOP.call(source, name);
  9676. },
  9677. onlySymbols = function onlySymbols(name) {
  9678. return name != internalSymbol && hOP.call(source, name);
  9679. },
  9680. propertyIsEnumerable = function propertyIsEnumerable(key) {
  9681. var uid = '' + key;
  9682. return onlySymbols(uid) ? hOP.call(this, uid) && this[internalSymbol]['@@' + uid] : pIE.call(this, key);
  9683. },
  9684. setAndGetSymbol = function setAndGetSymbol(uid) {
  9685. var descriptor = {
  9686. enumerable: false,
  9687. configurable: true,
  9688. get: get,
  9689. set: function set(value) {
  9690. setDescriptor(this, uid, {
  9691. enumerable: false,
  9692. configurable: true,
  9693. writable: true,
  9694. value: value
  9695. });
  9696. addInternalIfNeeded(this, uid, true);
  9697. }
  9698. };
  9699. defineProperty(ObjectProto, uid, descriptor);
  9700. return source[uid] = defineProperty(Object(uid), 'constructor', sourceConstructor);
  9701. },
  9702. _Symbol = function _Symbol2(description) {
  9703. if (this && this !== G) {
  9704. throw new TypeError('Symbol is not a constructor');
  9705. }
  9706. return setAndGetSymbol(prefix.concat(description || '', random, ++id));
  9707. },
  9708. source = create(null),
  9709. sourceConstructor = { value: _Symbol },
  9710. sourceMap = function sourceMap(uid) {
  9711. return source[uid];
  9712. },
  9713. $defineProperty = function defineProp(o, key, descriptor) {
  9714. var uid = '' + key;
  9715. if (onlySymbols(uid)) {
  9716. setDescriptor(o, uid, descriptor.enumerable ? copyAsNonEnumerable(descriptor) : descriptor);
  9717. addInternalIfNeeded(o, uid, !!descriptor.enumerable);
  9718. } else {
  9719. defineProperty(o, key, descriptor);
  9720. }
  9721. return o;
  9722. },
  9723. $getOwnPropertySymbols = function getOwnPropertySymbols(o) {
  9724. var cof = toString.call(o);
  9725. o = cof === '[object String]' ? o.split('') : Object(o);
  9726. return gOPN(o).filter(onlySymbols).map(sourceMap);
  9727. };
  9728. descriptor.value = $defineProperty;
  9729. defineProperty(Object, DP, descriptor);
  9730. descriptor.value = $getOwnPropertySymbols;
  9731. defineProperty(Object, GOPS, descriptor);
  9732. descriptor.value = function getOwnPropertyNames(o) {
  9733. return gOPN(o).filter(onlyNonSymbols);
  9734. };
  9735. defineProperty(Object, GOPN, descriptor);
  9736. descriptor.value = function defineProperties(o, descriptors) {
  9737. var symbols = $getOwnPropertySymbols(descriptors);
  9738. if (symbols.length) {
  9739. keys(descriptors).concat(symbols).forEach(function (uid) {
  9740. if (propertyIsEnumerable.call(descriptors, uid)) {
  9741. $defineProperty(o, uid, descriptors[uid]);
  9742. }
  9743. });
  9744. } else {
  9745. $defineProperties(o, descriptors);
  9746. }
  9747. return o;
  9748. };
  9749. defineProperty(Object, DPies, descriptor);
  9750. descriptor.value = propertyIsEnumerable;
  9751. defineProperty(ObjectProto, PIE, descriptor);
  9752. descriptor.value = _Symbol;
  9753. defineProperty(G, 'Symbol', descriptor);
  9754. descriptor.value = function (key) {
  9755. var uid = prefix.concat(prefix, key, random);
  9756. return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid);
  9757. };
  9758. defineProperty(_Symbol, 'for', descriptor);
  9759. descriptor.value = function (symbol) {
  9760. return hOP.call(source, symbol) ? symbol.slice(prefixLength * 2, -random.length) : void 0;
  9761. };
  9762. defineProperty(_Symbol, 'keyFor', descriptor);
  9763. descriptor.value = function getOwnPropertyDescriptor(o, key) {
  9764. var descriptor = gOPD(o, key);
  9765. if (descriptor && onlySymbols(key)) {
  9766. descriptor.enumerable = propertyIsEnumerable.call(o, key);
  9767. }
  9768. return descriptor;
  9769. };
  9770. defineProperty(Object, GOPD, descriptor);
  9771. descriptor.value = function (proto, descriptors) {
  9772. return arguments.length === 1 ? create(proto) : createWithSymbols(proto, descriptors);
  9773. };
  9774. defineProperty(Object, 'create', descriptor);
  9775. descriptor.value = function () {
  9776. var str = toString.call(this);
  9777. return str === '[object String]' && onlySymbols(this) ? '[object Symbol]' : str;
  9778. };
  9779. defineProperty(ObjectProto, 'toString', descriptor);
  9780. try {
  9781. setDescriptor = create(defineProperty({}, prefix, {
  9782. get: function get() {
  9783. return defineProperty(this, prefix, { value: false })[prefix];
  9784. }
  9785. }))[prefix] || defineProperty;
  9786. } catch (o_O) {
  9787. setDescriptor = function setDescriptor(o, key, descriptor) {
  9788. var protoDescriptor = gOPD(ObjectProto, key);
  9789. delete ObjectProto[key];
  9790. defineProperty(o, key, descriptor);
  9791. defineProperty(ObjectProto, key, protoDescriptor);
  9792. };
  9793. }
  9794. })(Object, 'getOwnPropertySymbols');
  9795. (function (O, S) {
  9796. var dP = O.defineProperty,
  9797. ObjectProto = O.prototype,
  9798. toString = ObjectProto.toString,
  9799. toStringTag = 'toStringTag',
  9800. descriptor;
  9801. ['iterator', 'match', 'replace', 'search', 'split', 'hasInstance', 'isConcatSpreadable', 'unscopables', 'species', 'toPrimitive', toStringTag].forEach(function (name) {
  9802. if (!(name in Symbol)) {
  9803. dP(Symbol, name, { value: Symbol(name) });
  9804. switch (name) {
  9805. case toStringTag:
  9806. descriptor = O.getOwnPropertyDescriptor(ObjectProto, 'toString');
  9807. descriptor.value = function () {
  9808. var str = toString.call(this),
  9809. tst = typeof this === 'undefined' || this === null ? undefined : this[Symbol.toStringTag];
  9810. return typeof tst === 'undefined' ? str : '[object ' + tst + ']';
  9811. };
  9812. dP(ObjectProto, 'toString', descriptor);
  9813. break;
  9814. }
  9815. }
  9816. });
  9817. })(Object, Symbol);
  9818. (function (Si, AP, SP) {
  9819. function returnThis() {
  9820. return this;
  9821. }
  9822. if (!AP[Si]) AP[Si] = function () {
  9823. var i = 0,
  9824. self = this,
  9825. iterator = {
  9826. next: function next() {
  9827. var done = self.length <= i;
  9828. return done ? { done: done } : { done: done, value: self[i++] };
  9829. }
  9830. };
  9831. iterator[Si] = returnThis;
  9832. return iterator;
  9833. };
  9834. if (!SP[Si]) SP[Si] = function () {
  9835. var fromCodePoint = String.fromCodePoint,
  9836. self = this,
  9837. i = 0,
  9838. length = self.length,
  9839. iterator = {
  9840. next: function next() {
  9841. var done = length <= i,
  9842. c = done ? '' : fromCodePoint(self.codePointAt(i));
  9843. i += c.length;
  9844. return done ? { done: done } : { done: done, value: c };
  9845. }
  9846. };
  9847. iterator[Si] = returnThis;
  9848. return iterator;
  9849. };
  9850. })(Symbol.iterator, Array.prototype, String.prototype);
  9851. Number.isNaN = Number.isNaN || function (value) {
  9852. return value !== value;
  9853. };
  9854. Number.isFinite = Number.isFinite || function (value) {
  9855. return typeof value === "number" && isFinite(value);
  9856. };
  9857. if (!String.prototype.endsWith || function () {
  9858. try {
  9859. return !"ab".endsWith("a", 1);
  9860. } catch (e) {
  9861. return true;
  9862. }
  9863. }()) {
  9864. String.prototype.endsWith = function (searchString, position) {
  9865. var subjectString = this.toString();
  9866. if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
  9867. position = subjectString.length;
  9868. }
  9869. position -= searchString.length;
  9870. var lastIndex = subjectString.indexOf(searchString, position);
  9871. return lastIndex !== -1 && lastIndex === position;
  9872. };
  9873. }
  9874. if (!String.prototype.startsWith || function () {
  9875. try {
  9876. return !"ab".startsWith("b", 1);
  9877. } catch (e) {
  9878. return true;
  9879. }
  9880. }()) {
  9881. String.prototype.startsWith = function (searchString, position) {
  9882. position = position || 0;
  9883. return this.substr(position, searchString.length) === searchString;
  9884. };
  9885. }
  9886. if (!Array.from) {
  9887. Array.from = function () {
  9888. var toInteger = function toInteger(it) {
  9889. return isNaN(it = +it) ? 0 : (it > 0 ? Math.floor : Math.ceil)(it);
  9890. };
  9891. var toLength = function toLength(it) {
  9892. return it > 0 ? Math.min(toInteger(it), 0x1fffffffffffff) : 0;
  9893. };
  9894. var iterCall = function iterCall(iter, fn, a1, a2) {
  9895. try {
  9896. fn(a1, a2);
  9897. } catch (E) {
  9898. if (typeof iter.return == 'function') iter.return();
  9899. throw E;
  9900. }
  9901. };
  9902. return function from(arrayLike) {
  9903. var O = Object(arrayLike),
  9904. C = typeof this == 'function' ? this : Array,
  9905. aLen = arguments.length,
  9906. mapfn = aLen > 1 ? arguments[1] : undefined,
  9907. mapping = mapfn !== undefined,
  9908. index = 0,
  9909. iterFn = O[Symbol.iterator],
  9910. length,
  9911. result,
  9912. step,
  9913. iterator;
  9914. if (mapping) mapfn = mapfn.bind(aLen > 2 ? arguments[2] : undefined);
  9915. if (iterFn != undefined && !Array.isArray(arrayLike)) {
  9916. for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
  9917. result[index] = mapping ? iterCall(mapfn, step.value, index) : step.value;
  9918. }
  9919. } else {
  9920. length = toLength(O.length);
  9921. for (result = new C(length); length > index; index++) {
  9922. result[index] = mapping ? mapfn(O[index], index) : O[index];
  9923. }
  9924. }
  9925. result.length = index;
  9926. return result;
  9927. };
  9928. }();
  9929. }
  9930. if (!Array.prototype.find) {
  9931. Object.defineProperty(Array.prototype, 'find', {
  9932. configurable: true,
  9933. writable: true,
  9934. enumerable: false,
  9935. value: function value(predicate) {
  9936. if (this === null) {
  9937. throw new TypeError('Array.prototype.find called on null or undefined');
  9938. }
  9939. if (typeof predicate !== 'function') {
  9940. throw new TypeError('predicate must be a function');
  9941. }
  9942. var list = Object(this);
  9943. var length = list.length >>> 0;
  9944. var thisArg = arguments[1];
  9945. var value;
  9946. for (var i = 0; i < length; i++) {
  9947. value = list[i];
  9948. if (predicate.call(thisArg, value, i, list)) {
  9949. return value;
  9950. }
  9951. }
  9952. return undefined;
  9953. }
  9954. });
  9955. }
  9956. if (!Array.prototype.findIndex) {
  9957. Object.defineProperty(Array.prototype, 'findIndex', {
  9958. configurable: true,
  9959. writable: true,
  9960. enumerable: false,
  9961. value: function value(predicate) {
  9962. if (this === null) {
  9963. throw new TypeError('Array.prototype.findIndex called on null or undefined');
  9964. }
  9965. if (typeof predicate !== 'function') {
  9966. throw new TypeError('predicate must be a function');
  9967. }
  9968. var list = Object(this);
  9969. var length = list.length >>> 0;
  9970. var thisArg = arguments[1];
  9971. var value;
  9972. for (var i = 0; i < length; i++) {
  9973. value = list[i];
  9974. if (predicate.call(thisArg, value, i, list)) {
  9975. return i;
  9976. }
  9977. }
  9978. return -1;
  9979. }
  9980. });
  9981. }
  9982. if (!Array.prototype.includes) {
  9983. Object.defineProperty(Array.prototype, 'includes', {
  9984. configurable: true,
  9985. writable: true,
  9986. enumerable: false,
  9987. value: function value(searchElement) {
  9988. var O = Object(this);
  9989. var len = parseInt(O.length) || 0;
  9990. if (len === 0) {
  9991. return false;
  9992. }
  9993. var n = parseInt(arguments[1]) || 0;
  9994. var k;
  9995. if (n >= 0) {
  9996. k = n;
  9997. } else {
  9998. k = len + n;
  9999. if (k < 0) {
  10000. k = 0;
  10001. }
  10002. }
  10003. var currentElement;
  10004. while (k < len) {
  10005. currentElement = O[k];
  10006. if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) {
  10007. return true;
  10008. }
  10009. k++;
  10010. }
  10011. return false;
  10012. }
  10013. });
  10014. }
  10015. (function () {
  10016. var needsFix = false;
  10017. try {
  10018. var s = Object.keys('a');
  10019. needsFix = s.length !== 1 || s[0] !== '0';
  10020. } catch (e) {
  10021. needsFix = true;
  10022. }
  10023. if (needsFix) {
  10024. Object.keys = function () {
  10025. var hasOwnProperty = Object.prototype.hasOwnProperty,
  10026. hasDontEnumBug = !{ toString: null }.propertyIsEnumerable('toString'),
  10027. dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'],
  10028. dontEnumsLength = dontEnums.length;
  10029. return function (obj) {
  10030. if (obj === undefined || obj === null) {
  10031. throw TypeError('Cannot convert undefined or null to object');
  10032. }
  10033. obj = Object(obj);
  10034. var result = [],
  10035. prop,
  10036. i;
  10037. for (prop in obj) {
  10038. if (hasOwnProperty.call(obj, prop)) {
  10039. result.push(prop);
  10040. }
  10041. }
  10042. if (hasDontEnumBug) {
  10043. for (i = 0; i < dontEnumsLength; i++) {
  10044. if (hasOwnProperty.call(obj, dontEnums[i])) {
  10045. result.push(dontEnums[i]);
  10046. }
  10047. }
  10048. }
  10049. return result;
  10050. };
  10051. }();
  10052. }
  10053. })();
  10054. (function (O) {
  10055. if ('assign' in O) {
  10056. return;
  10057. }
  10058. O.defineProperty(O, 'assign', {
  10059. configurable: true,
  10060. writable: true,
  10061. value: function () {
  10062. var gOPS = O.getOwnPropertySymbols,
  10063. pIE = O.propertyIsEnumerable,
  10064. filterOS = gOPS ? function (self) {
  10065. return gOPS(self).filter(pIE, self);
  10066. } : function () {
  10067. return Array.prototype;
  10068. };
  10069. return function assign(where) {
  10070. if (gOPS && !(where instanceof O)) {
  10071. console.warn('problematic Symbols', where);
  10072. }
  10073. function set(keyOrSymbol) {
  10074. where[keyOrSymbol] = arg[keyOrSymbol];
  10075. }
  10076. for (var i = 1, ii = arguments.length; i < ii; ++i) {
  10077. var arg = arguments[i];
  10078. if (arg === null || arg === undefined) {
  10079. continue;
  10080. }
  10081. O.keys(arg).concat(filterOS(arg)).forEach(set);
  10082. }
  10083. return where;
  10084. };
  10085. }()
  10086. });
  10087. })(Object);
  10088. (function (global) {
  10089. var i;
  10090. var defineProperty = Object.defineProperty,
  10091. is = function is(a, b) {
  10092. return a === b || a !== a && b !== b;
  10093. };
  10094. if (typeof WeakMap == 'undefined') {
  10095. global.WeakMap = createCollection({
  10096. 'delete': sharedDelete,
  10097. clear: sharedClear,
  10098. get: sharedGet,
  10099. has: mapHas,
  10100. set: sharedSet
  10101. }, true);
  10102. }
  10103. if (typeof Map == 'undefined' || typeof new Map().values !== 'function' || !new Map().values().next) {
  10104. var _createCollection;
  10105. global.Map = createCollection((_createCollection = {
  10106. 'delete': sharedDelete,
  10107. has: mapHas,
  10108. get: sharedGet,
  10109. set: sharedSet,
  10110. keys: sharedKeys,
  10111. values: sharedValues,
  10112. entries: mapEntries,
  10113. forEach: sharedForEach,
  10114. clear: sharedClear
  10115. }, _createCollection[Symbol.iterator] = mapEntries, _createCollection));
  10116. }
  10117. if (typeof Set == 'undefined' || typeof new Set().values !== 'function' || !new Set().values().next) {
  10118. var _createCollection2;
  10119. global.Set = createCollection((_createCollection2 = {
  10120. has: setHas,
  10121. add: sharedAdd,
  10122. 'delete': sharedDelete,
  10123. clear: sharedClear,
  10124. keys: sharedValues,
  10125. values: sharedValues,
  10126. entries: setEntries,
  10127. forEach: sharedForEach
  10128. }, _createCollection2[Symbol.iterator] = sharedValues, _createCollection2));
  10129. }
  10130. if (typeof WeakSet == 'undefined') {
  10131. global.WeakSet = createCollection({
  10132. 'delete': sharedDelete,
  10133. add: sharedAdd,
  10134. clear: sharedClear,
  10135. has: setHas
  10136. }, true);
  10137. }
  10138. function createCollection(proto, objectOnly) {
  10139. function Collection(a) {
  10140. if (!this || this.constructor !== Collection) return new Collection(a);
  10141. this._keys = [];
  10142. this._values = [];
  10143. this._itp = [];
  10144. this.objectOnly = objectOnly;
  10145. if (a) init.call(this, a);
  10146. }
  10147. if (!objectOnly) {
  10148. defineProperty(proto, 'size', {
  10149. get: sharedSize
  10150. });
  10151. }
  10152. proto.constructor = Collection;
  10153. Collection.prototype = proto;
  10154. return Collection;
  10155. }
  10156. function init(a) {
  10157. var i;
  10158. if (this.add) a.forEach(this.add, this);else a.forEach(function (a) {
  10159. this.set(a[0], a[1]);
  10160. }, this);
  10161. }
  10162. function sharedDelete(key) {
  10163. if (this.has(key)) {
  10164. this._keys.splice(i, 1);
  10165. this._values.splice(i, 1);
  10166. this._itp.forEach(function (p) {
  10167. if (i < p[0]) p[0]--;
  10168. });
  10169. }
  10170. return -1 < i;
  10171. };
  10172. function sharedGet(key) {
  10173. return this.has(key) ? this._values[i] : undefined;
  10174. }
  10175. function has(list, key) {
  10176. if (this.objectOnly && key !== Object(key)) throw new TypeError("Invalid value used as weak collection key");
  10177. if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);) {} else i = list.indexOf(key);
  10178. return -1 < i;
  10179. }
  10180. function setHas(value) {
  10181. return has.call(this, this._values, value);
  10182. }
  10183. function mapHas(value) {
  10184. return has.call(this, this._keys, value);
  10185. }
  10186. function sharedSet(key, value) {
  10187. this.has(key) ? this._values[i] = value : this._values[this._keys.push(key) - 1] = value;
  10188. return this;
  10189. }
  10190. function sharedAdd(value) {
  10191. if (!this.has(value)) this._values.push(value);
  10192. return this;
  10193. }
  10194. function sharedClear() {
  10195. (this._keys || 0).length = this._values.length = 0;
  10196. }
  10197. function sharedKeys() {
  10198. return sharedIterator(this._itp, this._keys);
  10199. }
  10200. function sharedValues() {
  10201. return sharedIterator(this._itp, this._values);
  10202. }
  10203. function mapEntries() {
  10204. return sharedIterator(this._itp, this._keys, this._values);
  10205. }
  10206. function setEntries() {
  10207. return sharedIterator(this._itp, this._values, this._values);
  10208. }
  10209. function sharedIterator(itp, array, array2) {
  10210. var _ref;
  10211. var p = [0],
  10212. done = false;
  10213. itp.push(p);
  10214. return _ref = {}, _ref[Symbol.iterator] = function () {
  10215. return this;
  10216. }, _ref.next = function next() {
  10217. var v,
  10218. k = p[0];
  10219. if (!done && k < array.length) {
  10220. v = array2 ? [array[k], array2[k]] : array[k];
  10221. p[0]++;
  10222. } else {
  10223. done = true;
  10224. itp.splice(itp.indexOf(p), 1);
  10225. }
  10226. return { done: done, value: v };
  10227. }, _ref;
  10228. }
  10229. function sharedSize() {
  10230. return this._values.length;
  10231. }
  10232. function sharedForEach(callback, context) {
  10233. var it = this.entries();
  10234. for (;;) {
  10235. var r = it.next();
  10236. if (r.done) break;
  10237. callback.call(context, r.value[1], r.value[0], this);
  10238. }
  10239. }
  10240. })(_aureliaPal.PLATFORM.global);
  10241. var emptyMetadata = Object.freeze({});
  10242. var metadataContainerKey = '__metadata__';
  10243. var bind = Function.prototype.bind;
  10244. if (typeof _aureliaPal.PLATFORM.global.Reflect === 'undefined') {
  10245. _aureliaPal.PLATFORM.global.Reflect = {};
  10246. }
  10247. if (typeof Reflect.getOwnMetadata !== 'function') {
  10248. Reflect.getOwnMetadata = function (metadataKey, target, targetKey) {
  10249. if (target.hasOwnProperty(metadataContainerKey)) {
  10250. return (target[metadataContainerKey][targetKey] || emptyMetadata)[metadataKey];
  10251. }
  10252. };
  10253. }
  10254. if (typeof Reflect.defineMetadata !== 'function') {
  10255. Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) {
  10256. var metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {};
  10257. var targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {});
  10258. targetContainer[metadataKey] = metadataValue;
  10259. };
  10260. }
  10261. if (typeof Reflect.metadata !== 'function') {
  10262. Reflect.metadata = function (metadataKey, metadataValue) {
  10263. return function (target, targetKey) {
  10264. Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey);
  10265. };
  10266. };
  10267. }
  10268. if (typeof Reflect.defineProperty !== 'function') {
  10269. Reflect.defineProperty = function (target, propertyKey, descriptor) {
  10270. if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' ? target === null : typeof target !== 'function') {
  10271. throw new TypeError('Reflect.defineProperty called on non-object');
  10272. }
  10273. try {
  10274. Object.defineProperty(target, propertyKey, descriptor);
  10275. return true;
  10276. } catch (e) {
  10277. return false;
  10278. }
  10279. };
  10280. }
  10281. if (typeof Reflect.construct !== 'function') {
  10282. Reflect.construct = function (Target, args) {
  10283. if (args) {
  10284. switch (args.length) {
  10285. case 0:
  10286. return new Target();
  10287. case 1:
  10288. return new Target(args[0]);
  10289. case 2:
  10290. return new Target(args[0], args[1]);
  10291. case 3:
  10292. return new Target(args[0], args[1], args[2]);
  10293. case 4:
  10294. return new Target(args[0], args[1], args[2], args[3]);
  10295. }
  10296. }
  10297. var a = [null];
  10298. a.push.apply(a, args);
  10299. return new (bind.apply(Target, a))();
  10300. };
  10301. }
  10302. if (typeof Reflect.ownKeys !== 'function') {
  10303. Reflect.ownKeys = function (o) {
  10304. return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o));
  10305. };
  10306. }
  10307. });
  10308. define('aurelia-loader-default',['exports', 'aurelia-loader', 'aurelia-pal', 'aurelia-metadata'], function (exports, _aureliaLoader, _aureliaPal, _aureliaMetadata) {
  10309. 'use strict';
  10310. Object.defineProperty(exports, "__esModule", {
  10311. value: true
  10312. });
  10313. exports.DefaultLoader = exports.TextTemplateLoader = undefined;
  10314. function _possibleConstructorReturn(self, call) {
  10315. if (!self) {
  10316. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  10317. }
  10318. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  10319. }
  10320. function _inherits(subClass, superClass) {
  10321. if (typeof superClass !== "function" && superClass !== null) {
  10322. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  10323. }
  10324. subClass.prototype = Object.create(superClass && superClass.prototype, {
  10325. constructor: {
  10326. value: subClass,
  10327. enumerable: false,
  10328. writable: true,
  10329. configurable: true
  10330. }
  10331. });
  10332. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  10333. }
  10334. var TextTemplateLoader = exports.TextTemplateLoader = function () {
  10335. function TextTemplateLoader() {
  10336. }
  10337. TextTemplateLoader.prototype.loadTemplate = function loadTemplate(loader, entry) {
  10338. return loader.loadText(entry.address).then(function (text) {
  10339. entry.template = _aureliaPal.DOM.createTemplateFromMarkup(text);
  10340. });
  10341. };
  10342. return TextTemplateLoader;
  10343. }();
  10344. function ensureOriginOnExports(executed, name) {
  10345. var target = executed;
  10346. var key = void 0;
  10347. var exportedValue = void 0;
  10348. if (target.__useDefault) {
  10349. target = target['default'];
  10350. }
  10351. _aureliaMetadata.Origin.set(target, new _aureliaMetadata.Origin(name, 'default'));
  10352. for (key in target) {
  10353. exportedValue = target[key];
  10354. if (typeof exportedValue === 'function') {
  10355. _aureliaMetadata.Origin.set(exportedValue, new _aureliaMetadata.Origin(name, key));
  10356. }
  10357. }
  10358. return executed;
  10359. }
  10360. var DefaultLoader = exports.DefaultLoader = function (_Loader) {
  10361. _inherits(DefaultLoader, _Loader);
  10362. function DefaultLoader() {
  10363. var _this = _possibleConstructorReturn(this, _Loader.call(this));
  10364. _this.textPluginName = 'text';
  10365. _this.moduleRegistry = Object.create(null);
  10366. _this.useTemplateLoader(new TextTemplateLoader());
  10367. var that = _this;
  10368. _this.addPlugin('template-registry-entry', {
  10369. 'fetch': function fetch(address) {
  10370. var entry = that.getOrCreateTemplateRegistryEntry(address);
  10371. return entry.templateIsLoaded ? entry : that.templateLoader.loadTemplate(that, entry).then(function (x) {
  10372. return entry;
  10373. });
  10374. }
  10375. });
  10376. return _this;
  10377. }
  10378. DefaultLoader.prototype.useTemplateLoader = function useTemplateLoader(templateLoader) {
  10379. this.templateLoader = templateLoader;
  10380. };
  10381. DefaultLoader.prototype.loadAllModules = function loadAllModules(ids) {
  10382. var loads = [];
  10383. for (var i = 0, ii = ids.length; i < ii; ++i) {
  10384. loads.push(this.loadModule(ids[i]));
  10385. }
  10386. return Promise.all(loads);
  10387. };
  10388. DefaultLoader.prototype.loadTemplate = function loadTemplate(url) {
  10389. return this._import(this.applyPluginToUrl(url, 'template-registry-entry'));
  10390. };
  10391. DefaultLoader.prototype.loadText = function loadText(url) {
  10392. return this._import(this.applyPluginToUrl(url, this.textPluginName)).then(function (textOrModule) {
  10393. if (typeof textOrModule === 'string') {
  10394. return textOrModule;
  10395. }
  10396. return textOrModule['default'];
  10397. });
  10398. };
  10399. return DefaultLoader;
  10400. }(_aureliaLoader.Loader);
  10401. _aureliaPal.PLATFORM.Loader = DefaultLoader;
  10402. if (!_aureliaPal.PLATFORM.global.System || !_aureliaPal.PLATFORM.global.System.import) {
  10403. if (_aureliaPal.PLATFORM.global.requirejs && requirejs.s && requirejs.s.contexts && requirejs.s.contexts._ && requirejs.s.contexts._.defined) {
  10404. _aureliaPal.PLATFORM.eachModule = function (callback) {
  10405. var defined = requirejs.s.contexts._.defined;
  10406. for (var key in defined) {
  10407. try {
  10408. if (callback(key, defined[key])) return;
  10409. } catch (e) {}
  10410. }
  10411. };
  10412. } else {
  10413. _aureliaPal.PLATFORM.eachModule = function (callback) {};
  10414. }
  10415. DefaultLoader.prototype._import = function (moduleId) {
  10416. return new Promise(function (resolve, reject) {
  10417. require([moduleId], resolve, reject);
  10418. });
  10419. };
  10420. DefaultLoader.prototype.loadModule = function (id) {
  10421. var _this2 = this;
  10422. var existing = this.moduleRegistry[id];
  10423. if (existing !== undefined) {
  10424. return Promise.resolve(existing);
  10425. }
  10426. return new Promise(function (resolve, reject) {
  10427. require([id], function (m) {
  10428. _this2.moduleRegistry[id] = m;
  10429. resolve(ensureOriginOnExports(m, id));
  10430. }, reject);
  10431. });
  10432. };
  10433. DefaultLoader.prototype.map = function (id, source) {};
  10434. DefaultLoader.prototype.normalize = function (moduleId, relativeTo) {
  10435. return Promise.resolve(moduleId);
  10436. };
  10437. DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) {
  10438. return moduleId;
  10439. };
  10440. DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) {
  10441. return pluginName + '!' + url;
  10442. };
  10443. DefaultLoader.prototype.addPlugin = function (pluginName, implementation) {
  10444. var nonAnonDefine = define;
  10445. nonAnonDefine(pluginName, [], {
  10446. 'load': function load(name, req, onload) {
  10447. var result = implementation.fetch(name);
  10448. Promise.resolve(result).then(onload);
  10449. }
  10450. });
  10451. };
  10452. } else {
  10453. _aureliaPal.PLATFORM.eachModule = function (callback) {
  10454. var modules = System._loader.modules;
  10455. for (var key in modules) {
  10456. try {
  10457. if (callback(key, modules[key].module)) return;
  10458. } catch (e) {}
  10459. }
  10460. };
  10461. System.set('text', System.newModule({
  10462. 'translate': function translate(load) {
  10463. 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') + '";';
  10464. }
  10465. }));
  10466. DefaultLoader.prototype._import = function (moduleId) {
  10467. return System.import(moduleId);
  10468. };
  10469. DefaultLoader.prototype.loadModule = function (id) {
  10470. var _this3 = this;
  10471. return System.normalize(id).then(function (newId) {
  10472. var existing = _this3.moduleRegistry[newId];
  10473. if (existing !== undefined) {
  10474. return Promise.resolve(existing);
  10475. }
  10476. return System.import(newId).then(function (m) {
  10477. _this3.moduleRegistry[newId] = m;
  10478. return ensureOriginOnExports(m, newId);
  10479. });
  10480. });
  10481. };
  10482. DefaultLoader.prototype.map = function (id, source) {
  10483. System.map[id] = source;
  10484. };
  10485. DefaultLoader.prototype.normalizeSync = function (moduleId, relativeTo) {
  10486. return System.normalizeSync(moduleId, relativeTo);
  10487. };
  10488. DefaultLoader.prototype.normalize = function (moduleId, relativeTo) {
  10489. return System.normalize(moduleId, relativeTo);
  10490. };
  10491. DefaultLoader.prototype.applyPluginToUrl = function (url, pluginName) {
  10492. return url + '!' + pluginName;
  10493. };
  10494. DefaultLoader.prototype.addPlugin = function (pluginName, implementation) {
  10495. System.set(pluginName, System.newModule({
  10496. 'fetch': function fetch(load, _fetch) {
  10497. var result = implementation.fetch(load.address);
  10498. return Promise.resolve(result).then(function (x) {
  10499. load.metadata.result = x;
  10500. return '';
  10501. });
  10502. },
  10503. 'instantiate': function instantiate(load) {
  10504. return load.metadata.result;
  10505. }
  10506. }));
  10507. };
  10508. }
  10509. });
  10510. define('aurelia-logging',['exports'], function (exports) {
  10511. 'use strict';
  10512. Object.defineProperty(exports, "__esModule", {
  10513. value: true
  10514. });
  10515. exports.getLogger = getLogger;
  10516. exports.addAppender = addAppender;
  10517. exports.setLevel = setLevel;
  10518. var logLevel = exports.logLevel = {
  10519. none: 0,
  10520. error: 1,
  10521. warn: 2,
  10522. info: 3,
  10523. debug: 4
  10524. };
  10525. var loggers = {};
  10526. var currentLevel = logLevel.none;
  10527. var appenders = [];
  10528. var slice = Array.prototype.slice;
  10529. var loggerConstructionKey = {};
  10530. function log(logger, level, args) {
  10531. var i = appenders.length;
  10532. var current = void 0;
  10533. args = slice.call(args);
  10534. args.unshift(logger);
  10535. while (i--) {
  10536. current = appenders[i];
  10537. current[level].apply(current, args);
  10538. }
  10539. }
  10540. function debug() {
  10541. if (currentLevel < 4) {
  10542. return;
  10543. }
  10544. log(this, 'debug', arguments);
  10545. }
  10546. function info() {
  10547. if (currentLevel < 3) {
  10548. return;
  10549. }
  10550. log(this, 'info', arguments);
  10551. }
  10552. function warn() {
  10553. if (currentLevel < 2) {
  10554. return;
  10555. }
  10556. log(this, 'warn', arguments);
  10557. }
  10558. function error() {
  10559. if (currentLevel < 1) {
  10560. return;
  10561. }
  10562. log(this, 'error', arguments);
  10563. }
  10564. function connectLogger(logger) {
  10565. logger.debug = debug;
  10566. logger.info = info;
  10567. logger.warn = warn;
  10568. logger.error = error;
  10569. }
  10570. function createLogger(id) {
  10571. var logger = new Logger(id, loggerConstructionKey);
  10572. if (appenders.length) {
  10573. connectLogger(logger);
  10574. }
  10575. return logger;
  10576. }
  10577. function getLogger(id) {
  10578. return loggers[id] || (loggers[id] = createLogger(id));
  10579. }
  10580. function addAppender(appender) {
  10581. appenders.push(appender);
  10582. if (appenders.length === 1) {
  10583. for (var key in loggers) {
  10584. connectLogger(loggers[key]);
  10585. }
  10586. }
  10587. }
  10588. function setLevel(level) {
  10589. currentLevel = level;
  10590. }
  10591. var Logger = exports.Logger = function () {
  10592. function Logger(id, key) {
  10593. if (key !== loggerConstructionKey) {
  10594. throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.');
  10595. }
  10596. this.id = id;
  10597. }
  10598. Logger.prototype.debug = function debug(message) {};
  10599. Logger.prototype.info = function info(message) {};
  10600. Logger.prototype.warn = function warn(message) {};
  10601. Logger.prototype.error = function error(message) {};
  10602. return Logger;
  10603. }();
  10604. });
  10605. define('aurelia-route-recognizer',['exports', 'aurelia-path'], function (exports, _aureliaPath) {
  10606. 'use strict';
  10607. Object.defineProperty(exports, "__esModule", {
  10608. value: true
  10609. });
  10610. exports.RouteRecognizer = exports.EpsilonSegment = exports.StarSegment = exports.DynamicSegment = exports.StaticSegment = exports.State = undefined;
  10611. var State = exports.State = function () {
  10612. function State(charSpec) {
  10613. this.charSpec = charSpec;
  10614. this.nextStates = [];
  10615. }
  10616. State.prototype.get = function get(charSpec) {
  10617. for (var _iterator = this.nextStates, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  10618. var _ref;
  10619. if (_isArray) {
  10620. if (_i >= _iterator.length) break;
  10621. _ref = _iterator[_i++];
  10622. } else {
  10623. _i = _iterator.next();
  10624. if (_i.done) break;
  10625. _ref = _i.value;
  10626. }
  10627. var child = _ref;
  10628. var isEqual = child.charSpec.validChars === charSpec.validChars && child.charSpec.invalidChars === charSpec.invalidChars;
  10629. if (isEqual) {
  10630. return child;
  10631. }
  10632. }
  10633. return undefined;
  10634. };
  10635. State.prototype.put = function put(charSpec) {
  10636. var state = this.get(charSpec);
  10637. if (state) {
  10638. return state;
  10639. }
  10640. state = new State(charSpec);
  10641. this.nextStates.push(state);
  10642. if (charSpec.repeat) {
  10643. state.nextStates.push(state);
  10644. }
  10645. return state;
  10646. };
  10647. State.prototype.match = function match(ch) {
  10648. var nextStates = this.nextStates;
  10649. var results = [];
  10650. for (var i = 0, l = nextStates.length; i < l; i++) {
  10651. var child = nextStates[i];
  10652. var charSpec = child.charSpec;
  10653. if (charSpec.validChars !== undefined) {
  10654. if (charSpec.validChars.indexOf(ch) !== -1) {
  10655. results.push(child);
  10656. }
  10657. } else if (charSpec.invalidChars !== undefined) {
  10658. if (charSpec.invalidChars.indexOf(ch) === -1) {
  10659. results.push(child);
  10660. }
  10661. }
  10662. }
  10663. return results;
  10664. };
  10665. return State;
  10666. }();
  10667. var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
  10668. var escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');
  10669. var StaticSegment = exports.StaticSegment = function () {
  10670. function StaticSegment(string, caseSensitive) {
  10671. this.string = string;
  10672. this.caseSensitive = caseSensitive;
  10673. }
  10674. StaticSegment.prototype.eachChar = function eachChar(callback) {
  10675. var s = this.string;
  10676. for (var i = 0, ii = s.length; i < ii; ++i) {
  10677. var ch = s[i];
  10678. callback({ validChars: this.caseSensitive ? ch : ch.toUpperCase() + ch.toLowerCase() });
  10679. }
  10680. };
  10681. StaticSegment.prototype.regex = function regex() {
  10682. return this.string.replace(escapeRegex, '\\$1');
  10683. };
  10684. StaticSegment.prototype.generate = function generate() {
  10685. return this.string;
  10686. };
  10687. return StaticSegment;
  10688. }();
  10689. var DynamicSegment = exports.DynamicSegment = function () {
  10690. function DynamicSegment(name) {
  10691. this.name = name;
  10692. }
  10693. DynamicSegment.prototype.eachChar = function eachChar(callback) {
  10694. callback({ invalidChars: '/', repeat: true });
  10695. };
  10696. DynamicSegment.prototype.regex = function regex() {
  10697. return '([^/]+)';
  10698. };
  10699. DynamicSegment.prototype.generate = function generate(params, consumed) {
  10700. consumed[this.name] = true;
  10701. return params[this.name];
  10702. };
  10703. return DynamicSegment;
  10704. }();
  10705. var StarSegment = exports.StarSegment = function () {
  10706. function StarSegment(name) {
  10707. this.name = name;
  10708. }
  10709. StarSegment.prototype.eachChar = function eachChar(callback) {
  10710. callback({ invalidChars: '', repeat: true });
  10711. };
  10712. StarSegment.prototype.regex = function regex() {
  10713. return '(.+)';
  10714. };
  10715. StarSegment.prototype.generate = function generate(params, consumed) {
  10716. consumed[this.name] = true;
  10717. return params[this.name];
  10718. };
  10719. return StarSegment;
  10720. }();
  10721. var EpsilonSegment = exports.EpsilonSegment = function () {
  10722. function EpsilonSegment() {
  10723. }
  10724. EpsilonSegment.prototype.eachChar = function eachChar() {};
  10725. EpsilonSegment.prototype.regex = function regex() {
  10726. return '';
  10727. };
  10728. EpsilonSegment.prototype.generate = function generate() {
  10729. return '';
  10730. };
  10731. return EpsilonSegment;
  10732. }();
  10733. var RouteRecognizer = exports.RouteRecognizer = function () {
  10734. function RouteRecognizer() {
  10735. this.rootState = new State();
  10736. this.names = {};
  10737. }
  10738. RouteRecognizer.prototype.add = function add(route) {
  10739. var _this = this;
  10740. if (Array.isArray(route)) {
  10741. route.forEach(function (r) {
  10742. return _this.add(r);
  10743. });
  10744. return undefined;
  10745. }
  10746. var currentState = this.rootState;
  10747. var regex = '^';
  10748. var types = { statics: 0, dynamics: 0, stars: 0 };
  10749. var names = [];
  10750. var routeName = route.handler.name;
  10751. var isEmpty = true;
  10752. var segments = parse(route.path, names, types, route.caseSensitive);
  10753. for (var i = 0, ii = segments.length; i < ii; i++) {
  10754. var segment = segments[i];
  10755. if (segment instanceof EpsilonSegment) {
  10756. continue;
  10757. }
  10758. isEmpty = false;
  10759. currentState = currentState.put({ validChars: '/' });
  10760. regex += '/';
  10761. currentState = addSegment(currentState, segment);
  10762. regex += segment.regex();
  10763. }
  10764. if (isEmpty) {
  10765. currentState = currentState.put({ validChars: '/' });
  10766. regex += '/';
  10767. }
  10768. var handlers = [{ handler: route.handler, names: names }];
  10769. if (routeName) {
  10770. var routeNames = Array.isArray(routeName) ? routeName : [routeName];
  10771. for (var _i2 = 0; _i2 < routeNames.length; _i2++) {
  10772. this.names[routeNames[_i2]] = {
  10773. segments: segments,
  10774. handlers: handlers
  10775. };
  10776. }
  10777. }
  10778. currentState.handlers = handlers;
  10779. currentState.regex = new RegExp(regex + '$', route.caseSensitive ? '' : 'i');
  10780. currentState.types = types;
  10781. return currentState;
  10782. };
  10783. RouteRecognizer.prototype.handlersFor = function handlersFor(name) {
  10784. var route = this.names[name];
  10785. if (!route) {
  10786. throw new Error('There is no route named ' + name);
  10787. }
  10788. return [].concat(route.handlers);
  10789. };
  10790. RouteRecognizer.prototype.hasRoute = function hasRoute(name) {
  10791. return !!this.names[name];
  10792. };
  10793. RouteRecognizer.prototype.generate = function generate(name, params) {
  10794. var route = this.names[name];
  10795. if (!route) {
  10796. throw new Error('There is no route named ' + name);
  10797. }
  10798. var handler = route.handlers[0].handler;
  10799. if (handler.generationUsesHref) {
  10800. return handler.href;
  10801. }
  10802. var routeParams = Object.assign({}, params);
  10803. var segments = route.segments;
  10804. var consumed = {};
  10805. var output = '';
  10806. for (var i = 0, l = segments.length; i < l; i++) {
  10807. var segment = segments[i];
  10808. if (segment instanceof EpsilonSegment) {
  10809. continue;
  10810. }
  10811. output += '/';
  10812. var segmentValue = segment.generate(routeParams, consumed);
  10813. if (segmentValue === null || segmentValue === undefined) {
  10814. throw new Error('A value is required for route parameter \'' + segment.name + '\' in route \'' + name + '\'.');
  10815. }
  10816. output += segmentValue;
  10817. }
  10818. if (output.charAt(0) !== '/') {
  10819. output = '/' + output;
  10820. }
  10821. for (var param in consumed) {
  10822. delete routeParams[param];
  10823. }
  10824. var queryString = (0, _aureliaPath.buildQueryString)(routeParams);
  10825. output += queryString ? '?' + queryString : '';
  10826. return output;
  10827. };
  10828. RouteRecognizer.prototype.recognize = function recognize(path) {
  10829. var states = [this.rootState];
  10830. var queryParams = {};
  10831. var isSlashDropped = false;
  10832. var normalizedPath = path;
  10833. var queryStart = normalizedPath.indexOf('?');
  10834. if (queryStart !== -1) {
  10835. var queryString = normalizedPath.substr(queryStart + 1, normalizedPath.length);
  10836. normalizedPath = normalizedPath.substr(0, queryStart);
  10837. queryParams = (0, _aureliaPath.parseQueryString)(queryString);
  10838. }
  10839. normalizedPath = decodeURI(normalizedPath);
  10840. if (normalizedPath.charAt(0) !== '/') {
  10841. normalizedPath = '/' + normalizedPath;
  10842. }
  10843. var pathLen = normalizedPath.length;
  10844. if (pathLen > 1 && normalizedPath.charAt(pathLen - 1) === '/') {
  10845. normalizedPath = normalizedPath.substr(0, pathLen - 1);
  10846. isSlashDropped = true;
  10847. }
  10848. for (var i = 0, l = normalizedPath.length; i < l; i++) {
  10849. states = recognizeChar(states, normalizedPath.charAt(i));
  10850. if (!states.length) {
  10851. break;
  10852. }
  10853. }
  10854. var solutions = [];
  10855. for (var _i3 = 0, _l = states.length; _i3 < _l; _i3++) {
  10856. if (states[_i3].handlers) {
  10857. solutions.push(states[_i3]);
  10858. }
  10859. }
  10860. states = sortSolutions(solutions);
  10861. var state = solutions[0];
  10862. if (state && state.handlers) {
  10863. if (isSlashDropped && state.regex.source.slice(-5) === '(.+)$') {
  10864. normalizedPath = normalizedPath + '/';
  10865. }
  10866. return findHandler(state, normalizedPath, queryParams);
  10867. }
  10868. return undefined;
  10869. };
  10870. return RouteRecognizer;
  10871. }();
  10872. var RecognizeResults = function RecognizeResults(queryParams) {
  10873. this.splice = Array.prototype.splice;
  10874. this.slice = Array.prototype.slice;
  10875. this.push = Array.prototype.push;
  10876. this.length = 0;
  10877. this.queryParams = queryParams || {};
  10878. };
  10879. function parse(route, names, types, caseSensitive) {
  10880. var normalizedRoute = route;
  10881. if (route.charAt(0) === '/') {
  10882. normalizedRoute = route.substr(1);
  10883. }
  10884. var results = [];
  10885. var splitRoute = normalizedRoute.split('/');
  10886. for (var i = 0, ii = splitRoute.length; i < ii; ++i) {
  10887. var segment = splitRoute[i];
  10888. var match = segment.match(/^:([^\/]+)$/);
  10889. if (match) {
  10890. results.push(new DynamicSegment(match[1]));
  10891. names.push(match[1]);
  10892. types.dynamics++;
  10893. continue;
  10894. }
  10895. match = segment.match(/^\*([^\/]+)$/);
  10896. if (match) {
  10897. results.push(new StarSegment(match[1]));
  10898. names.push(match[1]);
  10899. types.stars++;
  10900. } else if (segment === '') {
  10901. results.push(new EpsilonSegment());
  10902. } else {
  10903. results.push(new StaticSegment(segment, caseSensitive));
  10904. types.statics++;
  10905. }
  10906. }
  10907. return results;
  10908. }
  10909. function sortSolutions(states) {
  10910. return states.sort(function (a, b) {
  10911. if (a.types.stars !== b.types.stars) {
  10912. return a.types.stars - b.types.stars;
  10913. }
  10914. if (a.types.stars) {
  10915. if (a.types.statics !== b.types.statics) {
  10916. return b.types.statics - a.types.statics;
  10917. }
  10918. if (a.types.dynamics !== b.types.dynamics) {
  10919. return b.types.dynamics - a.types.dynamics;
  10920. }
  10921. }
  10922. if (a.types.dynamics !== b.types.dynamics) {
  10923. return a.types.dynamics - b.types.dynamics;
  10924. }
  10925. if (a.types.statics !== b.types.statics) {
  10926. return b.types.statics - a.types.statics;
  10927. }
  10928. return 0;
  10929. });
  10930. }
  10931. function recognizeChar(states, ch) {
  10932. var nextStates = [];
  10933. for (var i = 0, l = states.length; i < l; i++) {
  10934. var state = states[i];
  10935. nextStates.push.apply(nextStates, state.match(ch));
  10936. }
  10937. return nextStates;
  10938. }
  10939. function findHandler(state, path, queryParams) {
  10940. var handlers = state.handlers;
  10941. var regex = state.regex;
  10942. var captures = path.match(regex);
  10943. var currentCapture = 1;
  10944. var result = new RecognizeResults(queryParams);
  10945. for (var i = 0, l = handlers.length; i < l; i++) {
  10946. var _handler = handlers[i];
  10947. var _names = _handler.names;
  10948. var _params = {};
  10949. for (var j = 0, m = _names.length; j < m; j++) {
  10950. _params[_names[j]] = captures[currentCapture++];
  10951. }
  10952. result.push({ handler: _handler.handler, params: _params, isDynamic: !!_names.length });
  10953. }
  10954. return result;
  10955. }
  10956. function addSegment(currentState, segment) {
  10957. var state = currentState;
  10958. segment.eachChar(function (ch) {
  10959. state = state.put(ch);
  10960. });
  10961. return state;
  10962. }
  10963. });
  10964. define('aurelia-router',['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-dependency-injection', 'aurelia-history', 'aurelia-event-aggregator'], function (exports, _aureliaLogging, _aureliaRouteRecognizer, _aureliaDependencyInjection, _aureliaHistory, _aureliaEventAggregator) {
  10965. 'use strict';
  10966. Object.defineProperty(exports, "__esModule", {
  10967. value: true
  10968. });
  10969. 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;
  10970. exports._normalizeAbsolutePath = _normalizeAbsolutePath;
  10971. exports._createRootedPath = _createRootedPath;
  10972. exports._resolveUrl = _resolveUrl;
  10973. exports.isNavigationCommand = isNavigationCommand;
  10974. exports._buildNavigationPlan = _buildNavigationPlan;
  10975. var LogManager = _interopRequireWildcard(_aureliaLogging);
  10976. function _interopRequireWildcard(obj) {
  10977. if (obj && obj.__esModule) {
  10978. return obj;
  10979. } else {
  10980. var newObj = {};
  10981. if (obj != null) {
  10982. for (var key in obj) {
  10983. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  10984. }
  10985. }
  10986. newObj.default = obj;
  10987. return newObj;
  10988. }
  10989. }
  10990. function _possibleConstructorReturn(self, call) {
  10991. if (!self) {
  10992. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  10993. }
  10994. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  10995. }
  10996. function _inherits(subClass, superClass) {
  10997. if (typeof superClass !== "function" && superClass !== null) {
  10998. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  10999. }
  11000. subClass.prototype = Object.create(superClass && superClass.prototype, {
  11001. constructor: {
  11002. value: subClass,
  11003. enumerable: false,
  11004. writable: true,
  11005. configurable: true
  11006. }
  11007. });
  11008. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  11009. }
  11010. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  11011. return typeof obj;
  11012. } : function (obj) {
  11013. return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
  11014. };
  11015. var _createClass = function () {
  11016. function defineProperties(target, props) {
  11017. for (var i = 0; i < props.length; i++) {
  11018. var descriptor = props[i];
  11019. descriptor.enumerable = descriptor.enumerable || false;
  11020. descriptor.configurable = true;
  11021. if ("value" in descriptor) descriptor.writable = true;
  11022. Object.defineProperty(target, descriptor.key, descriptor);
  11023. }
  11024. }
  11025. return function (Constructor, protoProps, staticProps) {
  11026. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  11027. if (staticProps) defineProperties(Constructor, staticProps);
  11028. return Constructor;
  11029. };
  11030. }();
  11031. function _normalizeAbsolutePath(path, hasPushState) {
  11032. var absolute = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];
  11033. if (!hasPushState && path[0] !== '#') {
  11034. path = '#' + path;
  11035. }
  11036. if (hasPushState && absolute) {
  11037. path = path.substring(1, path.length);
  11038. }
  11039. return path;
  11040. }
  11041. function _createRootedPath(fragment, baseUrl, hasPushState, absolute) {
  11042. if (isAbsoluteUrl.test(fragment)) {
  11043. return fragment;
  11044. }
  11045. var path = '';
  11046. if (baseUrl.length && baseUrl[0] !== '/') {
  11047. path += '/';
  11048. }
  11049. path += baseUrl;
  11050. if ((!path.length || path[path.length - 1] !== '/') && fragment[0] !== '/') {
  11051. path += '/';
  11052. }
  11053. if (path.length && path[path.length - 1] === '/' && fragment[0] === '/') {
  11054. path = path.substring(0, path.length - 1);
  11055. }
  11056. return _normalizeAbsolutePath(path + fragment, hasPushState, absolute);
  11057. }
  11058. function _resolveUrl(fragment, baseUrl, hasPushState) {
  11059. if (isRootedPath.test(fragment)) {
  11060. return _normalizeAbsolutePath(fragment, hasPushState);
  11061. }
  11062. return _createRootedPath(fragment, baseUrl, hasPushState);
  11063. }
  11064. var isRootedPath = /^#?\//;
  11065. var isAbsoluteUrl = /^([a-z][a-z0-9+\-.]*:)?\/\//i;
  11066. var pipelineStatus = exports.pipelineStatus = {
  11067. completed: 'completed',
  11068. canceled: 'canceled',
  11069. rejected: 'rejected',
  11070. running: 'running'
  11071. };
  11072. var Pipeline = exports.Pipeline = function () {
  11073. function Pipeline() {
  11074. this.steps = [];
  11075. }
  11076. Pipeline.prototype.addStep = function addStep(step) {
  11077. var run = void 0;
  11078. if (typeof step === 'function') {
  11079. run = step;
  11080. } else if (typeof step.getSteps === 'function') {
  11081. var steps = step.getSteps();
  11082. for (var i = 0, l = steps.length; i < l; i++) {
  11083. this.addStep(steps[i]);
  11084. }
  11085. return this;
  11086. } else {
  11087. run = step.run.bind(step);
  11088. }
  11089. this.steps.push(run);
  11090. return this;
  11091. };
  11092. Pipeline.prototype.run = function run(instruction) {
  11093. var index = -1;
  11094. var steps = this.steps;
  11095. function next() {
  11096. index++;
  11097. if (index < steps.length) {
  11098. var currentStep = steps[index];
  11099. try {
  11100. return currentStep(instruction, next);
  11101. } catch (e) {
  11102. return next.reject(e);
  11103. }
  11104. } else {
  11105. return next.complete();
  11106. }
  11107. }
  11108. next.complete = createCompletionHandler(next, pipelineStatus.completed);
  11109. next.cancel = createCompletionHandler(next, pipelineStatus.canceled);
  11110. next.reject = createCompletionHandler(next, pipelineStatus.rejected);
  11111. return next();
  11112. };
  11113. return Pipeline;
  11114. }();
  11115. function createCompletionHandler(next, status) {
  11116. return function (output) {
  11117. return Promise.resolve({ status: status, output: output, completed: status === pipelineStatus.completed });
  11118. };
  11119. }
  11120. var CommitChangesStep = exports.CommitChangesStep = function () {
  11121. function CommitChangesStep() {
  11122. }
  11123. CommitChangesStep.prototype.run = function run(navigationInstruction, next) {
  11124. return navigationInstruction._commitChanges(true).then(function () {
  11125. navigationInstruction._updateTitle();
  11126. return next();
  11127. });
  11128. };
  11129. return CommitChangesStep;
  11130. }();
  11131. var NavigationInstruction = exports.NavigationInstruction = function () {
  11132. function NavigationInstruction(init) {
  11133. this.plan = null;
  11134. this.options = {};
  11135. Object.assign(this, init);
  11136. this.params = this.params || {};
  11137. this.viewPortInstructions = {};
  11138. var ancestorParams = [];
  11139. var current = this;
  11140. do {
  11141. var currentParams = Object.assign({}, current.params);
  11142. if (current.config && current.config.hasChildRouter) {
  11143. delete currentParams[current.getWildCardName()];
  11144. }
  11145. ancestorParams.unshift(currentParams);
  11146. current = current.parentInstruction;
  11147. } while (current);
  11148. var allParams = Object.assign.apply(Object, [{}, this.queryParams].concat(ancestorParams));
  11149. this.lifecycleArgs = [allParams, this.config, this];
  11150. }
  11151. NavigationInstruction.prototype.getAllInstructions = function getAllInstructions() {
  11152. var instructions = [this];
  11153. for (var key in this.viewPortInstructions) {
  11154. var childInstruction = this.viewPortInstructions[key].childNavigationInstruction;
  11155. if (childInstruction) {
  11156. instructions.push.apply(instructions, childInstruction.getAllInstructions());
  11157. }
  11158. }
  11159. return instructions;
  11160. };
  11161. NavigationInstruction.prototype.getAllPreviousInstructions = function getAllPreviousInstructions() {
  11162. return this.getAllInstructions().map(function (c) {
  11163. return c.previousInstruction;
  11164. }).filter(function (c) {
  11165. return c;
  11166. });
  11167. };
  11168. NavigationInstruction.prototype.addViewPortInstruction = function addViewPortInstruction(viewPortName, strategy, moduleId, component) {
  11169. var viewportInstruction = this.viewPortInstructions[viewPortName] = {
  11170. name: viewPortName,
  11171. strategy: strategy,
  11172. moduleId: moduleId,
  11173. component: component,
  11174. childRouter: component.childRouter,
  11175. lifecycleArgs: this.lifecycleArgs.slice()
  11176. };
  11177. return viewportInstruction;
  11178. };
  11179. NavigationInstruction.prototype.getWildCardName = function getWildCardName() {
  11180. var wildcardIndex = this.config.route.lastIndexOf('*');
  11181. return this.config.route.substr(wildcardIndex + 1);
  11182. };
  11183. NavigationInstruction.prototype.getWildcardPath = function getWildcardPath() {
  11184. var wildcardName = this.getWildCardName();
  11185. var path = this.params[wildcardName] || '';
  11186. if (this.queryString) {
  11187. path += '?' + this.queryString;
  11188. }
  11189. return path;
  11190. };
  11191. NavigationInstruction.prototype.getBaseUrl = function getBaseUrl() {
  11192. if (!this.params) {
  11193. return this.fragment;
  11194. }
  11195. var wildcardName = this.getWildCardName();
  11196. var path = this.params[wildcardName] || '';
  11197. if (!path) {
  11198. return this.fragment;
  11199. }
  11200. path = encodeURI(path);
  11201. return this.fragment.substr(0, this.fragment.lastIndexOf(path));
  11202. };
  11203. NavigationInstruction.prototype._commitChanges = function _commitChanges(waitToSwap) {
  11204. var _this = this;
  11205. var router = this.router;
  11206. router.currentInstruction = this;
  11207. if (this.previousInstruction) {
  11208. this.previousInstruction.config.navModel.isActive = false;
  11209. }
  11210. this.config.navModel.isActive = true;
  11211. router._refreshBaseUrl();
  11212. router.refreshNavigation();
  11213. var loads = [];
  11214. var delaySwaps = [];
  11215. var _loop = function _loop(viewPortName) {
  11216. var viewPortInstruction = _this.viewPortInstructions[viewPortName];
  11217. var viewPort = router.viewPorts[viewPortName];
  11218. if (!viewPort) {
  11219. throw new Error('There was no router-view found in the view for ' + viewPortInstruction.moduleId + '.');
  11220. }
  11221. if (viewPortInstruction.strategy === activationStrategy.replace) {
  11222. if (waitToSwap) {
  11223. delaySwaps.push({ viewPort: viewPort, viewPortInstruction: viewPortInstruction });
  11224. }
  11225. loads.push(viewPort.process(viewPortInstruction, waitToSwap).then(function (x) {
  11226. if (viewPortInstruction.childNavigationInstruction) {
  11227. return viewPortInstruction.childNavigationInstruction._commitChanges();
  11228. }
  11229. return undefined;
  11230. }));
  11231. } else {
  11232. if (viewPortInstruction.childNavigationInstruction) {
  11233. loads.push(viewPortInstruction.childNavigationInstruction._commitChanges(waitToSwap));
  11234. }
  11235. }
  11236. };
  11237. for (var viewPortName in this.viewPortInstructions) {
  11238. _loop(viewPortName);
  11239. }
  11240. return Promise.all(loads).then(function () {
  11241. delaySwaps.forEach(function (x) {
  11242. return x.viewPort.swap(x.viewPortInstruction);
  11243. });
  11244. return null;
  11245. }).then(function () {
  11246. return prune(_this);
  11247. });
  11248. };
  11249. NavigationInstruction.prototype._updateTitle = function _updateTitle() {
  11250. var title = this._buildTitle();
  11251. if (title) {
  11252. this.router.history.setTitle(title);
  11253. }
  11254. };
  11255. NavigationInstruction.prototype._buildTitle = function _buildTitle() {
  11256. var separator = arguments.length <= 0 || arguments[0] === undefined ? ' | ' : arguments[0];
  11257. var title = this.config.navModel.title || '';
  11258. var childTitles = [];
  11259. for (var viewPortName in this.viewPortInstructions) {
  11260. var _viewPortInstruction = this.viewPortInstructions[viewPortName];
  11261. if (_viewPortInstruction.childNavigationInstruction) {
  11262. var childTitle = _viewPortInstruction.childNavigationInstruction._buildTitle(separator);
  11263. if (childTitle) {
  11264. childTitles.push(childTitle);
  11265. }
  11266. }
  11267. }
  11268. if (childTitles.length) {
  11269. title = childTitles.join(separator) + (title ? separator : '') + title;
  11270. }
  11271. if (this.router.title) {
  11272. title += (title ? separator : '') + this.router.title;
  11273. }
  11274. return title;
  11275. };
  11276. return NavigationInstruction;
  11277. }();
  11278. function prune(instruction) {
  11279. instruction.previousInstruction = null;
  11280. instruction.plan = null;
  11281. }
  11282. var NavModel = exports.NavModel = function () {
  11283. function NavModel(router, relativeHref) {
  11284. this.isActive = false;
  11285. this.title = null;
  11286. this.href = null;
  11287. this.relativeHref = null;
  11288. this.settings = {};
  11289. this.config = null;
  11290. this.router = router;
  11291. this.relativeHref = relativeHref;
  11292. }
  11293. NavModel.prototype.setTitle = function setTitle(title) {
  11294. this.title = title;
  11295. if (this.isActive) {
  11296. this.router.updateTitle();
  11297. }
  11298. };
  11299. return NavModel;
  11300. }();
  11301. function isNavigationCommand(obj) {
  11302. return obj && typeof obj.navigate === 'function';
  11303. }
  11304. var Redirect = exports.Redirect = function () {
  11305. function Redirect(url) {
  11306. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  11307. this.url = url;
  11308. this.options = Object.assign({ trigger: true, replace: true }, options);
  11309. this.shouldContinueProcessing = false;
  11310. }
  11311. Redirect.prototype.setRouter = function setRouter(router) {
  11312. this.router = router;
  11313. };
  11314. Redirect.prototype.navigate = function navigate(appRouter) {
  11315. var navigatingRouter = this.options.useAppRouter ? appRouter : this.router || appRouter;
  11316. navigatingRouter.navigate(this.url, this.options);
  11317. };
  11318. return Redirect;
  11319. }();
  11320. var RedirectToRoute = exports.RedirectToRoute = function () {
  11321. function RedirectToRoute(route) {
  11322. var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  11323. var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
  11324. this.route = route;
  11325. this.params = params;
  11326. this.options = Object.assign({ trigger: true, replace: true }, options);
  11327. this.shouldContinueProcessing = false;
  11328. }
  11329. RedirectToRoute.prototype.setRouter = function setRouter(router) {
  11330. this.router = router;
  11331. };
  11332. RedirectToRoute.prototype.navigate = function navigate(appRouter) {
  11333. var navigatingRouter = this.options.useAppRouter ? appRouter : this.router || appRouter;
  11334. navigatingRouter.navigateToRoute(this.route, this.params, this.options);
  11335. };
  11336. return RedirectToRoute;
  11337. }();
  11338. var RouterConfiguration = exports.RouterConfiguration = function () {
  11339. function RouterConfiguration() {
  11340. this.instructions = [];
  11341. this.options = {};
  11342. this.pipelineSteps = [];
  11343. }
  11344. RouterConfiguration.prototype.addPipelineStep = function addPipelineStep(name, step) {
  11345. this.pipelineSteps.push({ name: name, step: step });
  11346. return this;
  11347. };
  11348. RouterConfiguration.prototype.addAuthorizeStep = function addAuthorizeStep(step) {
  11349. return this.addPipelineStep('authorize', step);
  11350. };
  11351. RouterConfiguration.prototype.addPreActivateStep = function addPreActivateStep(step) {
  11352. return this.addPipelineStep('preActivate', step);
  11353. };
  11354. RouterConfiguration.prototype.addPreRenderStep = function addPreRenderStep(step) {
  11355. return this.addPipelineStep('preRender', step);
  11356. };
  11357. RouterConfiguration.prototype.addPostRenderStep = function addPostRenderStep(step) {
  11358. return this.addPipelineStep('postRender', step);
  11359. };
  11360. RouterConfiguration.prototype.map = function map(route) {
  11361. if (Array.isArray(route)) {
  11362. route.forEach(this.map.bind(this));
  11363. return this;
  11364. }
  11365. return this.mapRoute(route);
  11366. };
  11367. RouterConfiguration.prototype.mapRoute = function mapRoute(config) {
  11368. this.instructions.push(function (router) {
  11369. var routeConfigs = [];
  11370. if (Array.isArray(config.route)) {
  11371. for (var i = 0, ii = config.route.length; i < ii; ++i) {
  11372. var current = Object.assign({}, config);
  11373. current.route = config.route[i];
  11374. routeConfigs.push(current);
  11375. }
  11376. } else {
  11377. routeConfigs.push(Object.assign({}, config));
  11378. }
  11379. var navModel = void 0;
  11380. for (var _i = 0, _ii = routeConfigs.length; _i < _ii; ++_i) {
  11381. var _routeConfig = routeConfigs[_i];
  11382. _routeConfig.settings = _routeConfig.settings || {};
  11383. if (!navModel) {
  11384. navModel = router.createNavModel(_routeConfig);
  11385. }
  11386. router.addRoute(_routeConfig, navModel);
  11387. }
  11388. });
  11389. return this;
  11390. };
  11391. RouterConfiguration.prototype.mapUnknownRoutes = function mapUnknownRoutes(config) {
  11392. this.unknownRouteConfig = config;
  11393. return this;
  11394. };
  11395. RouterConfiguration.prototype.exportToRouter = function exportToRouter(router) {
  11396. var instructions = this.instructions;
  11397. for (var i = 0, ii = instructions.length; i < ii; ++i) {
  11398. instructions[i](router);
  11399. }
  11400. if (this.title) {
  11401. router.title = this.title;
  11402. }
  11403. if (this.unknownRouteConfig) {
  11404. router.handleUnknownRoutes(this.unknownRouteConfig);
  11405. }
  11406. router.options = this.options;
  11407. var pipelineSteps = this.pipelineSteps;
  11408. if (pipelineSteps.length) {
  11409. if (!router.isRoot) {
  11410. throw new Error('Pipeline steps can only be added to the root router');
  11411. }
  11412. var pipelineProvider = router.pipelineProvider;
  11413. for (var _i2 = 0, _ii2 = pipelineSteps.length; _i2 < _ii2; ++_i2) {
  11414. var _pipelineSteps$_i = pipelineSteps[_i2];
  11415. var _name = _pipelineSteps$_i.name;
  11416. var step = _pipelineSteps$_i.step;
  11417. pipelineProvider.addStep(_name, step);
  11418. }
  11419. }
  11420. };
  11421. return RouterConfiguration;
  11422. }();
  11423. var activationStrategy = exports.activationStrategy = {
  11424. noChange: 'no-change',
  11425. invokeLifecycle: 'invoke-lifecycle',
  11426. replace: 'replace'
  11427. };
  11428. var BuildNavigationPlanStep = exports.BuildNavigationPlanStep = function () {
  11429. function BuildNavigationPlanStep() {
  11430. }
  11431. BuildNavigationPlanStep.prototype.run = function run(navigationInstruction, next) {
  11432. return _buildNavigationPlan(navigationInstruction).then(function (plan) {
  11433. navigationInstruction.plan = plan;
  11434. return next();
  11435. }).catch(next.cancel);
  11436. };
  11437. return BuildNavigationPlanStep;
  11438. }();
  11439. function _buildNavigationPlan(instruction, forceLifecycleMinimum) {
  11440. var prev = instruction.previousInstruction;
  11441. var config = instruction.config;
  11442. var plan = {};
  11443. if ('redirect' in config) {
  11444. var redirectLocation = _resolveUrl(config.redirect, getInstructionBaseUrl(instruction));
  11445. if (instruction.queryString) {
  11446. redirectLocation += '?' + instruction.queryString;
  11447. }
  11448. return Promise.reject(new Redirect(redirectLocation));
  11449. }
  11450. if (prev) {
  11451. var newParams = hasDifferentParameterValues(prev, instruction);
  11452. var pending = [];
  11453. var _loop2 = function _loop2(viewPortName) {
  11454. var prevViewPortInstruction = prev.viewPortInstructions[viewPortName];
  11455. var nextViewPortConfig = config.viewPorts[viewPortName];
  11456. if (!nextViewPortConfig) throw new Error('Invalid Route Config: Configuration for viewPort "' + viewPortName + '" was not found for route: "' + instruction.config.route + '."');
  11457. var viewPortPlan = plan[viewPortName] = {
  11458. name: viewPortName,
  11459. config: nextViewPortConfig,
  11460. prevComponent: prevViewPortInstruction.component,
  11461. prevModuleId: prevViewPortInstruction.moduleId
  11462. };
  11463. if (prevViewPortInstruction.moduleId !== nextViewPortConfig.moduleId) {
  11464. viewPortPlan.strategy = activationStrategy.replace;
  11465. } else if ('determineActivationStrategy' in prevViewPortInstruction.component.viewModel) {
  11466. var _prevViewPortInstruct;
  11467. viewPortPlan.strategy = (_prevViewPortInstruct = prevViewPortInstruction.component.viewModel).determineActivationStrategy.apply(_prevViewPortInstruct, instruction.lifecycleArgs);
  11468. } else if (config.activationStrategy) {
  11469. viewPortPlan.strategy = config.activationStrategy;
  11470. } else if (newParams || forceLifecycleMinimum) {
  11471. viewPortPlan.strategy = activationStrategy.invokeLifecycle;
  11472. } else {
  11473. viewPortPlan.strategy = activationStrategy.noChange;
  11474. }
  11475. if (viewPortPlan.strategy !== activationStrategy.replace && prevViewPortInstruction.childRouter) {
  11476. var path = instruction.getWildcardPath();
  11477. var task = prevViewPortInstruction.childRouter._createNavigationInstruction(path, instruction).then(function (childInstruction) {
  11478. viewPortPlan.childNavigationInstruction = childInstruction;
  11479. return _buildNavigationPlan(childInstruction, viewPortPlan.strategy === activationStrategy.invokeLifecycle).then(function (childPlan) {
  11480. childInstruction.plan = childPlan;
  11481. });
  11482. });
  11483. pending.push(task);
  11484. }
  11485. };
  11486. for (var viewPortName in prev.viewPortInstructions) {
  11487. _loop2(viewPortName);
  11488. }
  11489. return Promise.all(pending).then(function () {
  11490. return plan;
  11491. });
  11492. }
  11493. for (var _viewPortName in config.viewPorts) {
  11494. plan[_viewPortName] = {
  11495. name: _viewPortName,
  11496. strategy: activationStrategy.replace,
  11497. config: instruction.config.viewPorts[_viewPortName]
  11498. };
  11499. }
  11500. return Promise.resolve(plan);
  11501. }
  11502. function hasDifferentParameterValues(prev, next) {
  11503. var prevParams = prev.params;
  11504. var nextParams = next.params;
  11505. var nextWildCardName = next.config.hasChildRouter ? next.getWildCardName() : null;
  11506. for (var key in nextParams) {
  11507. if (key === nextWildCardName) {
  11508. continue;
  11509. }
  11510. if (prevParams[key] !== nextParams[key]) {
  11511. return true;
  11512. }
  11513. }
  11514. for (var _key in prevParams) {
  11515. if (_key === nextWildCardName) {
  11516. continue;
  11517. }
  11518. if (prevParams[_key] !== nextParams[_key]) {
  11519. return true;
  11520. }
  11521. }
  11522. if (!next.options.compareQueryParams) {
  11523. return false;
  11524. }
  11525. var prevQueryParams = prev.queryParams;
  11526. var nextQueryParams = next.queryParams;
  11527. for (var _key2 in nextQueryParams) {
  11528. if (prevQueryParams[_key2] !== nextQueryParams[_key2]) {
  11529. return true;
  11530. }
  11531. }
  11532. for (var _key3 in prevQueryParams) {
  11533. if (prevQueryParams[_key3] !== nextQueryParams[_key3]) {
  11534. return true;
  11535. }
  11536. }
  11537. return false;
  11538. }
  11539. function getInstructionBaseUrl(instruction) {
  11540. var instructionBaseUrlParts = [];
  11541. instruction = instruction.parentInstruction;
  11542. while (instruction) {
  11543. instructionBaseUrlParts.unshift(instruction.getBaseUrl());
  11544. instruction = instruction.parentInstruction;
  11545. }
  11546. instructionBaseUrlParts.unshift('/');
  11547. return instructionBaseUrlParts.join('');
  11548. }
  11549. var Router = exports.Router = function () {
  11550. function Router(container, history) {
  11551. this.parent = null;
  11552. this.options = {};
  11553. this.container = container;
  11554. this.history = history;
  11555. this.reset();
  11556. }
  11557. Router.prototype.reset = function reset() {
  11558. var _this2 = this;
  11559. this.viewPorts = {};
  11560. this.routes = [];
  11561. this.baseUrl = '';
  11562. this.isConfigured = false;
  11563. this.isNavigating = false;
  11564. this.navigation = [];
  11565. this.currentInstruction = null;
  11566. this._fallbackOrder = 100;
  11567. this._recognizer = new _aureliaRouteRecognizer.RouteRecognizer();
  11568. this._childRecognizer = new _aureliaRouteRecognizer.RouteRecognizer();
  11569. this._configuredPromise = new Promise(function (resolve) {
  11570. _this2._resolveConfiguredPromise = resolve;
  11571. });
  11572. };
  11573. Router.prototype.registerViewPort = function registerViewPort(viewPort, name) {
  11574. name = name || 'default';
  11575. this.viewPorts[name] = viewPort;
  11576. };
  11577. Router.prototype.ensureConfigured = function ensureConfigured() {
  11578. return this._configuredPromise;
  11579. };
  11580. Router.prototype.configure = function configure(callbackOrConfig) {
  11581. var _this3 = this;
  11582. this.isConfigured = true;
  11583. var result = callbackOrConfig;
  11584. var config = void 0;
  11585. if (typeof callbackOrConfig === 'function') {
  11586. config = new RouterConfiguration();
  11587. result = callbackOrConfig(config);
  11588. }
  11589. return Promise.resolve(result).then(function (c) {
  11590. if (c && c.exportToRouter) {
  11591. config = c;
  11592. }
  11593. config.exportToRouter(_this3);
  11594. _this3.isConfigured = true;
  11595. _this3._resolveConfiguredPromise();
  11596. });
  11597. };
  11598. Router.prototype.navigate = function navigate(fragment, options) {
  11599. if (!this.isConfigured && this.parent) {
  11600. return this.parent.navigate(fragment, options);
  11601. }
  11602. return this.history.navigate(_resolveUrl(fragment, this.baseUrl, this.history._hasPushState), options);
  11603. };
  11604. Router.prototype.navigateToRoute = function navigateToRoute(route, params, options) {
  11605. var path = this.generate(route, params);
  11606. return this.navigate(path, options);
  11607. };
  11608. Router.prototype.navigateBack = function navigateBack() {
  11609. this.history.navigateBack();
  11610. };
  11611. Router.prototype.createChild = function createChild(container) {
  11612. var childRouter = new Router(container || this.container.createChild(), this.history);
  11613. childRouter.parent = this;
  11614. return childRouter;
  11615. };
  11616. Router.prototype.generate = function generate(name, params) {
  11617. var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
  11618. var hasRoute = this._recognizer.hasRoute(name);
  11619. if ((!this.isConfigured || !hasRoute) && this.parent) {
  11620. return this.parent.generate(name, params);
  11621. }
  11622. if (!hasRoute) {
  11623. throw new Error('A route with name \'' + name + '\' could not be found. Check that `name: \'' + name + '\'` was specified in the route\'s config.');
  11624. }
  11625. var path = this._recognizer.generate(name, params);
  11626. var rootedPath = _createRootedPath(path, this.baseUrl, this.history._hasPushState, options.absolute);
  11627. return options.absolute ? '' + this.history.getAbsoluteRoot() + rootedPath : rootedPath;
  11628. };
  11629. Router.prototype.createNavModel = function createNavModel(config) {
  11630. var navModel = new NavModel(this, 'href' in config ? config.href : config.route);
  11631. navModel.title = config.title;
  11632. navModel.order = config.nav;
  11633. navModel.href = config.href;
  11634. navModel.settings = config.settings;
  11635. navModel.config = config;
  11636. return navModel;
  11637. };
  11638. Router.prototype.addRoute = function addRoute(config, navModel) {
  11639. validateRouteConfig(config, this.routes);
  11640. if (!('viewPorts' in config) && !config.navigationStrategy) {
  11641. config.viewPorts = {
  11642. 'default': {
  11643. moduleId: config.moduleId,
  11644. view: config.view
  11645. }
  11646. };
  11647. }
  11648. if (!navModel) {
  11649. navModel = this.createNavModel(config);
  11650. }
  11651. this.routes.push(config);
  11652. var path = config.route;
  11653. if (path.charAt(0) === '/') {
  11654. path = path.substr(1);
  11655. }
  11656. var caseSensitive = config.caseSensitive === true;
  11657. var state = this._recognizer.add({ path: path, handler: config, caseSensitive: caseSensitive });
  11658. if (path) {
  11659. var _settings = config.settings;
  11660. delete config.settings;
  11661. var withChild = JSON.parse(JSON.stringify(config));
  11662. config.settings = _settings;
  11663. withChild.route = path + '/*childRoute';
  11664. withChild.hasChildRouter = true;
  11665. this._childRecognizer.add({
  11666. path: withChild.route,
  11667. handler: withChild,
  11668. caseSensitive: caseSensitive
  11669. });
  11670. withChild.navModel = navModel;
  11671. withChild.settings = config.settings;
  11672. }
  11673. config.navModel = navModel;
  11674. if ((navModel.order || navModel.order === 0) && this.navigation.indexOf(navModel) === -1) {
  11675. if (!navModel.href && navModel.href !== '' && (state.types.dynamics || state.types.stars)) {
  11676. throw new Error('Invalid route config for "' + config.route + '" : dynamic routes must specify an "href:" to be included in the navigation model.');
  11677. }
  11678. if (typeof navModel.order !== 'number') {
  11679. navModel.order = ++this._fallbackOrder;
  11680. }
  11681. this.navigation.push(navModel);
  11682. this.navigation = this.navigation.sort(function (a, b) {
  11683. return a.order - b.order;
  11684. });
  11685. }
  11686. };
  11687. Router.prototype.hasRoute = function hasRoute(name) {
  11688. return !!(this._recognizer.hasRoute(name) || this.parent && this.parent.hasRoute(name));
  11689. };
  11690. Router.prototype.hasOwnRoute = function hasOwnRoute(name) {
  11691. return this._recognizer.hasRoute(name);
  11692. };
  11693. Router.prototype.handleUnknownRoutes = function handleUnknownRoutes(config) {
  11694. var _this4 = this;
  11695. if (!config) {
  11696. throw new Error('Invalid unknown route handler');
  11697. }
  11698. this.catchAllHandler = function (instruction) {
  11699. return _this4._createRouteConfig(config, instruction).then(function (c) {
  11700. instruction.config = c;
  11701. return instruction;
  11702. });
  11703. };
  11704. };
  11705. Router.prototype.updateTitle = function updateTitle() {
  11706. if (this.parent) {
  11707. return this.parent.updateTitle();
  11708. }
  11709. this.currentInstruction._updateTitle();
  11710. return undefined;
  11711. };
  11712. Router.prototype.refreshNavigation = function refreshNavigation() {
  11713. var nav = this.navigation;
  11714. for (var i = 0, length = nav.length; i < length; i++) {
  11715. var current = nav[i];
  11716. if (!current.config.href) {
  11717. current.href = _createRootedPath(current.relativeHref, this.baseUrl, this.history._hasPushState);
  11718. } else {
  11719. current.href = _normalizeAbsolutePath(current.config.href, this.history._hasPushState);
  11720. }
  11721. }
  11722. };
  11723. Router.prototype._refreshBaseUrl = function _refreshBaseUrl() {
  11724. if (this.parent) {
  11725. var baseUrl = this.parent.currentInstruction.getBaseUrl();
  11726. this.baseUrl = this.parent.baseUrl + baseUrl;
  11727. }
  11728. };
  11729. Router.prototype._createNavigationInstruction = function _createNavigationInstruction() {
  11730. var url = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  11731. var parentInstruction = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
  11732. var fragment = url;
  11733. var queryString = '';
  11734. var queryIndex = url.indexOf('?');
  11735. if (queryIndex !== -1) {
  11736. fragment = url.substr(0, queryIndex);
  11737. queryString = url.substr(queryIndex + 1);
  11738. }
  11739. var results = this._recognizer.recognize(url);
  11740. if (!results || !results.length) {
  11741. results = this._childRecognizer.recognize(url);
  11742. }
  11743. var instructionInit = {
  11744. fragment: fragment,
  11745. queryString: queryString,
  11746. config: null,
  11747. parentInstruction: parentInstruction,
  11748. previousInstruction: this.currentInstruction,
  11749. router: this,
  11750. options: {
  11751. compareQueryParams: this.options.compareQueryParams
  11752. }
  11753. };
  11754. if (results && results.length) {
  11755. var first = results[0];
  11756. var _instruction = new NavigationInstruction(Object.assign({}, instructionInit, {
  11757. params: first.params,
  11758. queryParams: first.queryParams || results.queryParams,
  11759. config: first.config || first.handler
  11760. }));
  11761. if (typeof first.handler === 'function') {
  11762. return evaluateNavigationStrategy(_instruction, first.handler, first);
  11763. } else if (first.handler && 'navigationStrategy' in first.handler) {
  11764. return evaluateNavigationStrategy(_instruction, first.handler.navigationStrategy, first.handler);
  11765. }
  11766. return Promise.resolve(_instruction);
  11767. } else if (this.catchAllHandler) {
  11768. var _instruction2 = new NavigationInstruction(Object.assign({}, instructionInit, {
  11769. params: { path: fragment },
  11770. queryParams: results && results.queryParams,
  11771. config: null }));
  11772. return evaluateNavigationStrategy(_instruction2, this.catchAllHandler);
  11773. }
  11774. return Promise.reject(new Error('Route not found: ' + url));
  11775. };
  11776. Router.prototype._createRouteConfig = function _createRouteConfig(config, instruction) {
  11777. var _this5 = this;
  11778. return Promise.resolve(config).then(function (c) {
  11779. if (typeof c === 'string') {
  11780. return { moduleId: c };
  11781. } else if (typeof c === 'function') {
  11782. return c(instruction);
  11783. }
  11784. return c;
  11785. }).then(function (c) {
  11786. return typeof c === 'string' ? { moduleId: c } : c;
  11787. }).then(function (c) {
  11788. c.route = instruction.params.path;
  11789. validateRouteConfig(c, _this5.routes);
  11790. if (!c.navModel) {
  11791. c.navModel = _this5.createNavModel(c);
  11792. }
  11793. return c;
  11794. });
  11795. };
  11796. _createClass(Router, [{
  11797. key: 'isRoot',
  11798. get: function get() {
  11799. return !this.parent;
  11800. }
  11801. }]);
  11802. return Router;
  11803. }();
  11804. function validateRouteConfig(config, routes) {
  11805. if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) !== 'object') {
  11806. throw new Error('Invalid Route Config');
  11807. }
  11808. if (typeof config.route !== 'string') {
  11809. var _name2 = config.name || '(no name)';
  11810. throw new Error('Invalid Route Config for "' + _name2 + '": You must specify a "route:" pattern.');
  11811. }
  11812. if (!('redirect' in config || config.moduleId || config.navigationStrategy || config.viewPorts)) {
  11813. throw new Error('Invalid Route Config for "' + config.route + '": You must specify a "moduleId:", "redirect:", "navigationStrategy:", or "viewPorts:".');
  11814. }
  11815. }
  11816. function evaluateNavigationStrategy(instruction, evaluator, context) {
  11817. return Promise.resolve(evaluator.call(context, instruction)).then(function () {
  11818. if (!('viewPorts' in instruction.config)) {
  11819. instruction.config.viewPorts = {
  11820. 'default': {
  11821. moduleId: instruction.config.moduleId
  11822. }
  11823. };
  11824. }
  11825. return instruction;
  11826. });
  11827. }
  11828. var CanDeactivatePreviousStep = exports.CanDeactivatePreviousStep = function () {
  11829. function CanDeactivatePreviousStep() {
  11830. }
  11831. CanDeactivatePreviousStep.prototype.run = function run(navigationInstruction, next) {
  11832. return processDeactivatable(navigationInstruction.plan, 'canDeactivate', next);
  11833. };
  11834. return CanDeactivatePreviousStep;
  11835. }();
  11836. var CanActivateNextStep = exports.CanActivateNextStep = function () {
  11837. function CanActivateNextStep() {
  11838. }
  11839. CanActivateNextStep.prototype.run = function run(navigationInstruction, next) {
  11840. return processActivatable(navigationInstruction, 'canActivate', next);
  11841. };
  11842. return CanActivateNextStep;
  11843. }();
  11844. var DeactivatePreviousStep = exports.DeactivatePreviousStep = function () {
  11845. function DeactivatePreviousStep() {
  11846. }
  11847. DeactivatePreviousStep.prototype.run = function run(navigationInstruction, next) {
  11848. return processDeactivatable(navigationInstruction.plan, 'deactivate', next, true);
  11849. };
  11850. return DeactivatePreviousStep;
  11851. }();
  11852. var ActivateNextStep = exports.ActivateNextStep = function () {
  11853. function ActivateNextStep() {
  11854. }
  11855. ActivateNextStep.prototype.run = function run(navigationInstruction, next) {
  11856. return processActivatable(navigationInstruction, 'activate', next, true);
  11857. };
  11858. return ActivateNextStep;
  11859. }();
  11860. function processDeactivatable(plan, callbackName, next, ignoreResult) {
  11861. var infos = findDeactivatable(plan, callbackName);
  11862. var i = infos.length;
  11863. function inspect(val) {
  11864. if (ignoreResult || shouldContinue(val)) {
  11865. return iterate();
  11866. }
  11867. return next.cancel(val);
  11868. }
  11869. function iterate() {
  11870. if (i--) {
  11871. try {
  11872. var viewModel = infos[i];
  11873. var _result = viewModel[callbackName]();
  11874. return processPotential(_result, inspect, next.cancel);
  11875. } catch (error) {
  11876. return next.cancel(error);
  11877. }
  11878. }
  11879. return next();
  11880. }
  11881. return iterate();
  11882. }
  11883. function findDeactivatable(plan, callbackName) {
  11884. var list = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
  11885. for (var viewPortName in plan) {
  11886. var _viewPortPlan = plan[viewPortName];
  11887. var prevComponent = _viewPortPlan.prevComponent;
  11888. if ((_viewPortPlan.strategy === activationStrategy.invokeLifecycle || _viewPortPlan.strategy === activationStrategy.replace) && prevComponent) {
  11889. var viewModel = prevComponent.viewModel;
  11890. if (callbackName in viewModel) {
  11891. list.push(viewModel);
  11892. }
  11893. }
  11894. if (_viewPortPlan.childNavigationInstruction) {
  11895. findDeactivatable(_viewPortPlan.childNavigationInstruction.plan, callbackName, list);
  11896. } else if (prevComponent) {
  11897. addPreviousDeactivatable(prevComponent, callbackName, list);
  11898. }
  11899. }
  11900. return list;
  11901. }
  11902. function addPreviousDeactivatable(component, callbackName, list) {
  11903. var childRouter = component.childRouter;
  11904. if (childRouter && childRouter.currentInstruction) {
  11905. var viewPortInstructions = childRouter.currentInstruction.viewPortInstructions;
  11906. for (var viewPortName in viewPortInstructions) {
  11907. var _viewPortInstruction2 = viewPortInstructions[viewPortName];
  11908. var prevComponent = _viewPortInstruction2.component;
  11909. var prevViewModel = prevComponent.viewModel;
  11910. if (callbackName in prevViewModel) {
  11911. list.push(prevViewModel);
  11912. }
  11913. addPreviousDeactivatable(prevComponent, callbackName, list);
  11914. }
  11915. }
  11916. }
  11917. function processActivatable(navigationInstruction, callbackName, next, ignoreResult) {
  11918. var infos = findActivatable(navigationInstruction, callbackName);
  11919. var length = infos.length;
  11920. var i = -1;
  11921. function inspect(val, router) {
  11922. if (ignoreResult || shouldContinue(val, router)) {
  11923. return iterate();
  11924. }
  11925. return next.cancel(val);
  11926. }
  11927. function iterate() {
  11928. i++;
  11929. if (i < length) {
  11930. try {
  11931. var _ret3 = function () {
  11932. var _current$viewModel;
  11933. var current = infos[i];
  11934. var result = (_current$viewModel = current.viewModel)[callbackName].apply(_current$viewModel, current.lifecycleArgs);
  11935. return {
  11936. v: processPotential(result, function (val) {
  11937. return inspect(val, current.router);
  11938. }, next.cancel)
  11939. };
  11940. }();
  11941. if ((typeof _ret3 === 'undefined' ? 'undefined' : _typeof(_ret3)) === "object") return _ret3.v;
  11942. } catch (error) {
  11943. return next.cancel(error);
  11944. }
  11945. }
  11946. return next();
  11947. }
  11948. return iterate();
  11949. }
  11950. function findActivatable(navigationInstruction, callbackName) {
  11951. var list = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
  11952. var router = arguments[3];
  11953. var plan = navigationInstruction.plan;
  11954. Object.keys(plan).filter(function (viewPortName) {
  11955. var viewPortPlan = plan[viewPortName];
  11956. var viewPortInstruction = navigationInstruction.viewPortInstructions[viewPortName];
  11957. var viewModel = viewPortInstruction.component.viewModel;
  11958. if ((viewPortPlan.strategy === activationStrategy.invokeLifecycle || viewPortPlan.strategy === activationStrategy.replace) && callbackName in viewModel) {
  11959. list.push({
  11960. viewModel: viewModel,
  11961. lifecycleArgs: viewPortInstruction.lifecycleArgs,
  11962. router: router
  11963. });
  11964. }
  11965. if (viewPortPlan.childNavigationInstruction) {
  11966. findActivatable(viewPortPlan.childNavigationInstruction, callbackName, list, viewPortInstruction.component.childRouter || router);
  11967. }
  11968. });
  11969. return list;
  11970. }
  11971. function shouldContinue(output, router) {
  11972. if (output instanceof Error) {
  11973. return false;
  11974. }
  11975. if (isNavigationCommand(output)) {
  11976. if (typeof output.setRouter === 'function') {
  11977. output.setRouter(router);
  11978. }
  11979. return !!output.shouldContinueProcessing;
  11980. }
  11981. if (output === undefined) {
  11982. return true;
  11983. }
  11984. return output;
  11985. }
  11986. var SafeSubscription = function () {
  11987. function SafeSubscription(subscriptionFunc) {
  11988. this._subscribed = true;
  11989. this._subscription = subscriptionFunc(this);
  11990. if (!this._subscribed) this.unsubscribe();
  11991. }
  11992. SafeSubscription.prototype.unsubscribe = function unsubscribe() {
  11993. if (this._subscribed && this._subscription) this._subscription.unsubscribe();
  11994. this._subscribed = false;
  11995. };
  11996. _createClass(SafeSubscription, [{
  11997. key: 'subscribed',
  11998. get: function get() {
  11999. return this._subscribed;
  12000. }
  12001. }]);
  12002. return SafeSubscription;
  12003. }();
  12004. function processPotential(obj, resolve, reject) {
  12005. if (obj && typeof obj.then === 'function') {
  12006. return Promise.resolve(obj).then(resolve).catch(reject);
  12007. }
  12008. if (obj && typeof obj.subscribe === 'function') {
  12009. var _ret4 = function () {
  12010. var obs = obj;
  12011. return {
  12012. v: new SafeSubscription(function (sub) {
  12013. return obs.subscribe({
  12014. next: function next() {
  12015. if (sub.subscribed) {
  12016. sub.unsubscribe();
  12017. resolve(obj);
  12018. }
  12019. },
  12020. error: function error(_error) {
  12021. if (sub.subscribed) {
  12022. sub.unsubscribe();
  12023. reject(_error);
  12024. }
  12025. },
  12026. complete: function complete() {
  12027. if (sub.subscribed) {
  12028. sub.unsubscribe();
  12029. resolve(obj);
  12030. }
  12031. }
  12032. });
  12033. })
  12034. };
  12035. }();
  12036. if ((typeof _ret4 === 'undefined' ? 'undefined' : _typeof(_ret4)) === "object") return _ret4.v;
  12037. }
  12038. try {
  12039. return resolve(obj);
  12040. } catch (error) {
  12041. return reject(error);
  12042. }
  12043. }
  12044. var RouteLoader = exports.RouteLoader = function () {
  12045. function RouteLoader() {
  12046. }
  12047. RouteLoader.prototype.loadRoute = function loadRoute(router, config, navigationInstruction) {
  12048. throw Error('Route loaders must implement "loadRoute(router, config, navigationInstruction)".');
  12049. };
  12050. return RouteLoader;
  12051. }();
  12052. var LoadRouteStep = exports.LoadRouteStep = function () {
  12053. LoadRouteStep.inject = function inject() {
  12054. return [RouteLoader];
  12055. };
  12056. function LoadRouteStep(routeLoader) {
  12057. this.routeLoader = routeLoader;
  12058. }
  12059. LoadRouteStep.prototype.run = function run(navigationInstruction, next) {
  12060. return loadNewRoute(this.routeLoader, navigationInstruction).then(next).catch(next.cancel);
  12061. };
  12062. return LoadRouteStep;
  12063. }();
  12064. function loadNewRoute(routeLoader, navigationInstruction) {
  12065. var toLoad = determineWhatToLoad(navigationInstruction);
  12066. var loadPromises = toLoad.map(function (current) {
  12067. return loadRoute(routeLoader, current.navigationInstruction, current.viewPortPlan);
  12068. });
  12069. return Promise.all(loadPromises);
  12070. }
  12071. function determineWhatToLoad(navigationInstruction) {
  12072. var toLoad = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
  12073. var plan = navigationInstruction.plan;
  12074. for (var viewPortName in plan) {
  12075. var _viewPortPlan2 = plan[viewPortName];
  12076. if (_viewPortPlan2.strategy === activationStrategy.replace) {
  12077. toLoad.push({ viewPortPlan: _viewPortPlan2, navigationInstruction: navigationInstruction });
  12078. if (_viewPortPlan2.childNavigationInstruction) {
  12079. determineWhatToLoad(_viewPortPlan2.childNavigationInstruction, toLoad);
  12080. }
  12081. } else {
  12082. var _viewPortInstruction3 = navigationInstruction.addViewPortInstruction(viewPortName, _viewPortPlan2.strategy, _viewPortPlan2.prevModuleId, _viewPortPlan2.prevComponent);
  12083. if (_viewPortPlan2.childNavigationInstruction) {
  12084. _viewPortInstruction3.childNavigationInstruction = _viewPortPlan2.childNavigationInstruction;
  12085. determineWhatToLoad(_viewPortPlan2.childNavigationInstruction, toLoad);
  12086. }
  12087. }
  12088. }
  12089. return toLoad;
  12090. }
  12091. function loadRoute(routeLoader, navigationInstruction, viewPortPlan) {
  12092. var moduleId = viewPortPlan.config.moduleId;
  12093. return loadComponent(routeLoader, navigationInstruction, viewPortPlan.config).then(function (component) {
  12094. var viewPortInstruction = navigationInstruction.addViewPortInstruction(viewPortPlan.name, viewPortPlan.strategy, moduleId, component);
  12095. var childRouter = component.childRouter;
  12096. if (childRouter) {
  12097. var path = navigationInstruction.getWildcardPath();
  12098. return childRouter._createNavigationInstruction(path, navigationInstruction).then(function (childInstruction) {
  12099. viewPortPlan.childNavigationInstruction = childInstruction;
  12100. return _buildNavigationPlan(childInstruction).then(function (childPlan) {
  12101. childInstruction.plan = childPlan;
  12102. viewPortInstruction.childNavigationInstruction = childInstruction;
  12103. return loadNewRoute(routeLoader, childInstruction);
  12104. });
  12105. });
  12106. }
  12107. return undefined;
  12108. });
  12109. }
  12110. function loadComponent(routeLoader, navigationInstruction, config) {
  12111. var router = navigationInstruction.router;
  12112. var lifecycleArgs = navigationInstruction.lifecycleArgs;
  12113. return routeLoader.loadRoute(router, config, navigationInstruction).then(function (component) {
  12114. var viewModel = component.viewModel;
  12115. var childContainer = component.childContainer;
  12116. component.router = router;
  12117. component.config = config;
  12118. if ('configureRouter' in viewModel) {
  12119. var _ret5 = function () {
  12120. var childRouter = childContainer.getChildRouter();
  12121. component.childRouter = childRouter;
  12122. return {
  12123. v: childRouter.configure(function (c) {
  12124. return viewModel.configureRouter.apply(viewModel, [c, childRouter].concat(lifecycleArgs));
  12125. }).then(function () {
  12126. return component;
  12127. })
  12128. };
  12129. }();
  12130. if ((typeof _ret5 === 'undefined' ? 'undefined' : _typeof(_ret5)) === "object") return _ret5.v;
  12131. }
  12132. return component;
  12133. });
  12134. }
  12135. var PipelineSlot = function () {
  12136. function PipelineSlot(container, name, alias) {
  12137. this.steps = [];
  12138. this.container = container;
  12139. this.slotName = name;
  12140. this.slotAlias = alias;
  12141. }
  12142. PipelineSlot.prototype.getSteps = function getSteps() {
  12143. var _this6 = this;
  12144. return this.steps.map(function (x) {
  12145. return _this6.container.get(x);
  12146. });
  12147. };
  12148. return PipelineSlot;
  12149. }();
  12150. var PipelineProvider = exports.PipelineProvider = function () {
  12151. PipelineProvider.inject = function inject() {
  12152. return [_aureliaDependencyInjection.Container];
  12153. };
  12154. function PipelineProvider(container) {
  12155. this.container = container;
  12156. this.steps = [BuildNavigationPlanStep, CanDeactivatePreviousStep, LoadRouteStep, this._createPipelineSlot('authorize'), CanActivateNextStep, this._createPipelineSlot('preActivate', 'modelbind'), DeactivatePreviousStep, ActivateNextStep, this._createPipelineSlot('preRender', 'precommit'), CommitChangesStep, this._createPipelineSlot('postRender', 'postcomplete')];
  12157. }
  12158. PipelineProvider.prototype.createPipeline = function createPipeline() {
  12159. var _this7 = this;
  12160. var pipeline = new Pipeline();
  12161. this.steps.forEach(function (step) {
  12162. return pipeline.addStep(_this7.container.get(step));
  12163. });
  12164. return pipeline;
  12165. };
  12166. PipelineProvider.prototype._findStep = function _findStep(name) {
  12167. return this.steps.find(function (x) {
  12168. return x.slotName === name || x.slotAlias === name;
  12169. });
  12170. };
  12171. PipelineProvider.prototype.addStep = function addStep(name, step) {
  12172. var found = this._findStep(name);
  12173. if (found) {
  12174. if (!found.steps.includes(step)) {
  12175. found.steps.push(step);
  12176. }
  12177. } else {
  12178. throw new Error('Invalid pipeline slot name: ' + name + '.');
  12179. }
  12180. };
  12181. PipelineProvider.prototype.removeStep = function removeStep(name, step) {
  12182. var slot = this._findStep(name);
  12183. if (slot) {
  12184. slot.steps.splice(slot.steps.indexOf(step), 1);
  12185. }
  12186. };
  12187. PipelineProvider.prototype._clearSteps = function _clearSteps() {
  12188. var name = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  12189. var slot = this._findStep(name);
  12190. if (slot) {
  12191. slot.steps = [];
  12192. }
  12193. };
  12194. PipelineProvider.prototype.reset = function reset() {
  12195. this._clearSteps('authorize');
  12196. this._clearSteps('preActivate');
  12197. this._clearSteps('preRender');
  12198. this._clearSteps('postRender');
  12199. };
  12200. PipelineProvider.prototype._createPipelineSlot = function _createPipelineSlot(name, alias) {
  12201. return new PipelineSlot(this.container, name, alias);
  12202. };
  12203. return PipelineProvider;
  12204. }();
  12205. var logger = LogManager.getLogger('app-router');
  12206. var AppRouter = exports.AppRouter = function (_Router) {
  12207. _inherits(AppRouter, _Router);
  12208. AppRouter.inject = function inject() {
  12209. return [_aureliaDependencyInjection.Container, _aureliaHistory.History, PipelineProvider, _aureliaEventAggregator.EventAggregator];
  12210. };
  12211. function AppRouter(container, history, pipelineProvider, events) {
  12212. var _this8 = _possibleConstructorReturn(this, _Router.call(this, container, history));
  12213. _this8.pipelineProvider = pipelineProvider;
  12214. _this8.events = events;
  12215. return _this8;
  12216. }
  12217. AppRouter.prototype.reset = function reset() {
  12218. _Router.prototype.reset.call(this);
  12219. this.maxInstructionCount = 10;
  12220. if (!this._queue) {
  12221. this._queue = [];
  12222. } else {
  12223. this._queue.length = 0;
  12224. }
  12225. };
  12226. AppRouter.prototype.loadUrl = function loadUrl(url) {
  12227. var _this9 = this;
  12228. return this._createNavigationInstruction(url).then(function (instruction) {
  12229. return _this9._queueInstruction(instruction);
  12230. }).catch(function (error) {
  12231. logger.error(error);
  12232. restorePreviousLocation(_this9);
  12233. });
  12234. };
  12235. AppRouter.prototype.registerViewPort = function registerViewPort(viewPort, name) {
  12236. var _this10 = this;
  12237. _Router.prototype.registerViewPort.call(this, viewPort, name);
  12238. if (!this.isActive) {
  12239. var _ret6 = function () {
  12240. var viewModel = _this10._findViewModel(viewPort);
  12241. if ('configureRouter' in viewModel) {
  12242. if (!_this10.isConfigured) {
  12243. var _ret7 = function () {
  12244. var resolveConfiguredPromise = _this10._resolveConfiguredPromise;
  12245. _this10._resolveConfiguredPromise = function () {};
  12246. return {
  12247. v: {
  12248. v: _this10.configure(function (config) {
  12249. return viewModel.configureRouter(config, _this10);
  12250. }).then(function () {
  12251. _this10.activate();
  12252. resolveConfiguredPromise();
  12253. })
  12254. }
  12255. };
  12256. }();
  12257. if ((typeof _ret7 === 'undefined' ? 'undefined' : _typeof(_ret7)) === "object") return _ret7.v;
  12258. }
  12259. } else {
  12260. _this10.activate();
  12261. }
  12262. }();
  12263. if ((typeof _ret6 === 'undefined' ? 'undefined' : _typeof(_ret6)) === "object") return _ret6.v;
  12264. } else {
  12265. this._dequeueInstruction();
  12266. }
  12267. return Promise.resolve();
  12268. };
  12269. AppRouter.prototype.activate = function activate(options) {
  12270. if (this.isActive) {
  12271. return;
  12272. }
  12273. this.isActive = true;
  12274. this.options = Object.assign({ routeHandler: this.loadUrl.bind(this) }, this.options, options);
  12275. this.history.activate(this.options);
  12276. this._dequeueInstruction();
  12277. };
  12278. AppRouter.prototype.deactivate = function deactivate() {
  12279. this.isActive = false;
  12280. this.history.deactivate();
  12281. };
  12282. AppRouter.prototype._queueInstruction = function _queueInstruction(instruction) {
  12283. var _this11 = this;
  12284. return new Promise(function (resolve) {
  12285. instruction.resolve = resolve;
  12286. _this11._queue.unshift(instruction);
  12287. _this11._dequeueInstruction();
  12288. });
  12289. };
  12290. AppRouter.prototype._dequeueInstruction = function _dequeueInstruction() {
  12291. var _this12 = this;
  12292. var instructionCount = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];
  12293. return Promise.resolve().then(function () {
  12294. if (_this12.isNavigating && !instructionCount) {
  12295. return undefined;
  12296. }
  12297. var instruction = _this12._queue.shift();
  12298. _this12._queue.length = 0;
  12299. if (!instruction) {
  12300. return undefined;
  12301. }
  12302. _this12.isNavigating = true;
  12303. instruction.previousInstruction = _this12.currentInstruction;
  12304. if (!instructionCount) {
  12305. _this12.events.publish('router:navigation:processing', { instruction: instruction });
  12306. } else if (instructionCount === _this12.maxInstructionCount - 1) {
  12307. logger.error(instructionCount + 1 + ' navigation instructions have been attempted without success. Restoring last known good location.');
  12308. restorePreviousLocation(_this12);
  12309. return _this12._dequeueInstruction(instructionCount + 1);
  12310. } else if (instructionCount > _this12.maxInstructionCount) {
  12311. throw new Error('Maximum navigation attempts exceeded. Giving up.');
  12312. }
  12313. var pipeline = _this12.pipelineProvider.createPipeline();
  12314. return pipeline.run(instruction).then(function (result) {
  12315. return processResult(instruction, result, instructionCount, _this12);
  12316. }).catch(function (error) {
  12317. return { output: error instanceof Error ? error : new Error(error) };
  12318. }).then(function (result) {
  12319. return resolveInstruction(instruction, result, !!instructionCount, _this12);
  12320. });
  12321. });
  12322. };
  12323. AppRouter.prototype._findViewModel = function _findViewModel(viewPort) {
  12324. if (this.container.viewModel) {
  12325. return this.container.viewModel;
  12326. }
  12327. if (viewPort.container) {
  12328. var container = viewPort.container;
  12329. while (container) {
  12330. if (container.viewModel) {
  12331. this.container.viewModel = container.viewModel;
  12332. return container.viewModel;
  12333. }
  12334. container = container.parent;
  12335. }
  12336. }
  12337. return undefined;
  12338. };
  12339. return AppRouter;
  12340. }(Router);
  12341. function processResult(instruction, result, instructionCount, router) {
  12342. if (!(result && 'completed' in result && 'output' in result)) {
  12343. result = result || {};
  12344. result.output = new Error('Expected router pipeline to return a navigation result, but got [' + JSON.stringify(result) + '] instead.');
  12345. }
  12346. var finalResult = null;
  12347. if (isNavigationCommand(result.output)) {
  12348. result.output.navigate(router);
  12349. } else {
  12350. finalResult = result;
  12351. if (!result.completed) {
  12352. if (result.output instanceof Error) {
  12353. logger.error(result.output);
  12354. }
  12355. restorePreviousLocation(router);
  12356. }
  12357. }
  12358. return router._dequeueInstruction(instructionCount + 1).then(function (innerResult) {
  12359. return finalResult || innerResult || result;
  12360. });
  12361. }
  12362. function resolveInstruction(instruction, result, isInnerInstruction, router) {
  12363. instruction.resolve(result);
  12364. if (!isInnerInstruction) {
  12365. router.isNavigating = false;
  12366. var eventArgs = { instruction: instruction, result: result };
  12367. var eventName = void 0;
  12368. if (result.output instanceof Error) {
  12369. eventName = 'error';
  12370. } else if (!result.completed) {
  12371. eventName = 'canceled';
  12372. } else {
  12373. var _queryString = instruction.queryString ? '?' + instruction.queryString : '';
  12374. router.history.previousLocation = instruction.fragment + _queryString;
  12375. eventName = 'success';
  12376. }
  12377. router.events.publish('router:navigation:' + eventName, eventArgs);
  12378. router.events.publish('router:navigation:complete', eventArgs);
  12379. }
  12380. return result;
  12381. }
  12382. function restorePreviousLocation(router) {
  12383. var previousLocation = router.history.previousLocation;
  12384. if (previousLocation) {
  12385. router.navigate(router.history.previousLocation, { trigger: false, replace: true });
  12386. } else {
  12387. logger.error('Router navigation failed, and no previous location could be restored.');
  12388. }
  12389. }
  12390. });
  12391. define('aurelia-logging-console',['exports', 'aurelia-logging'], function (exports, _aureliaLogging) {
  12392. 'use strict';
  12393. Object.defineProperty(exports, "__esModule", {
  12394. value: true
  12395. });
  12396. exports.ConsoleAppender = undefined;
  12397. var ConsoleAppender = exports.ConsoleAppender = function () {
  12398. function ConsoleAppender() {
  12399. }
  12400. ConsoleAppender.prototype.debug = function debug(logger) {
  12401. var _console;
  12402. for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  12403. rest[_key - 1] = arguments[_key];
  12404. }
  12405. (_console = console).debug.apply(_console, ['DEBUG [' + logger.id + ']'].concat(rest));
  12406. };
  12407. ConsoleAppender.prototype.info = function info(logger) {
  12408. var _console2;
  12409. for (var _len2 = arguments.length, rest = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  12410. rest[_key2 - 1] = arguments[_key2];
  12411. }
  12412. (_console2 = console).info.apply(_console2, ['INFO [' + logger.id + ']'].concat(rest));
  12413. };
  12414. ConsoleAppender.prototype.warn = function warn(logger) {
  12415. var _console3;
  12416. for (var _len3 = arguments.length, rest = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  12417. rest[_key3 - 1] = arguments[_key3];
  12418. }
  12419. (_console3 = console).warn.apply(_console3, ['WARN [' + logger.id + ']'].concat(rest));
  12420. };
  12421. ConsoleAppender.prototype.error = function error(logger) {
  12422. var _console4;
  12423. for (var _len4 = arguments.length, rest = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
  12424. rest[_key4 - 1] = arguments[_key4];
  12425. }
  12426. (_console4 = console).error.apply(_console4, ['ERROR [' + logger.id + ']'].concat(rest));
  12427. };
  12428. return ConsoleAppender;
  12429. }();
  12430. });
  12431. define('aurelia-path',['exports'], function (exports) {
  12432. 'use strict';
  12433. Object.defineProperty(exports, "__esModule", {
  12434. value: true
  12435. });
  12436. exports.relativeToFile = relativeToFile;
  12437. exports.join = join;
  12438. exports.buildQueryString = buildQueryString;
  12439. exports.parseQueryString = parseQueryString;
  12440. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  12441. return typeof obj;
  12442. } : function (obj) {
  12443. return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
  12444. };
  12445. function trimDots(ary) {
  12446. for (var i = 0; i < ary.length; ++i) {
  12447. var part = ary[i];
  12448. if (part === '.') {
  12449. ary.splice(i, 1);
  12450. i -= 1;
  12451. } else if (part === '..') {
  12452. if (i === 0 || i === 1 && ary[2] === '..' || ary[i - 1] === '..') {
  12453. continue;
  12454. } else if (i > 0) {
  12455. ary.splice(i - 1, 2);
  12456. i -= 2;
  12457. }
  12458. }
  12459. }
  12460. }
  12461. function relativeToFile(name, file) {
  12462. var fileParts = file && file.split('/');
  12463. var nameParts = name.trim().split('/');
  12464. if (nameParts[0].charAt(0) === '.' && fileParts) {
  12465. var normalizedBaseParts = fileParts.slice(0, fileParts.length - 1);
  12466. nameParts.unshift.apply(nameParts, normalizedBaseParts);
  12467. }
  12468. trimDots(nameParts);
  12469. return nameParts.join('/');
  12470. }
  12471. function join(path1, path2) {
  12472. if (!path1) {
  12473. return path2;
  12474. }
  12475. if (!path2) {
  12476. return path1;
  12477. }
  12478. var schemeMatch = path1.match(/^([^/]*?:)\//);
  12479. var scheme = schemeMatch && schemeMatch.length > 0 ? schemeMatch[1] : '';
  12480. path1 = path1.substr(scheme.length);
  12481. var urlPrefix = void 0;
  12482. if (path1.indexOf('///') === 0 && scheme === 'file:') {
  12483. urlPrefix = '///';
  12484. } else if (path1.indexOf('//') === 0) {
  12485. urlPrefix = '//';
  12486. } else if (path1.indexOf('/') === 0) {
  12487. urlPrefix = '/';
  12488. } else {
  12489. urlPrefix = '';
  12490. }
  12491. var trailingSlash = path2.slice(-1) === '/' ? '/' : '';
  12492. var url1 = path1.split('/');
  12493. var url2 = path2.split('/');
  12494. var url3 = [];
  12495. for (var i = 0, ii = url1.length; i < ii; ++i) {
  12496. if (url1[i] === '..') {
  12497. url3.pop();
  12498. } else if (url1[i] === '.' || url1[i] === '') {
  12499. continue;
  12500. } else {
  12501. url3.push(url1[i]);
  12502. }
  12503. }
  12504. for (var _i = 0, _ii = url2.length; _i < _ii; ++_i) {
  12505. if (url2[_i] === '..') {
  12506. url3.pop();
  12507. } else if (url2[_i] === '.' || url2[_i] === '') {
  12508. continue;
  12509. } else {
  12510. url3.push(url2[_i]);
  12511. }
  12512. }
  12513. return scheme + urlPrefix + url3.join('/') + trailingSlash;
  12514. }
  12515. var encode = encodeURIComponent;
  12516. var encodeKey = function encodeKey(k) {
  12517. return encode(k).replace('%24', '$');
  12518. };
  12519. function buildParam(key, value) {
  12520. var result = [];
  12521. if (value === null || value === undefined) {
  12522. return result;
  12523. }
  12524. if (Array.isArray(value)) {
  12525. for (var i = 0, l = value.length; i < l; i++) {
  12526. var arrayKey = key + '[' + (_typeof(value[i]) === 'object' && value[i] !== null ? i : '') + ']';
  12527. result = result.concat(buildParam(arrayKey, value[i]));
  12528. }
  12529. } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
  12530. for (var propertyName in value) {
  12531. result = result.concat(buildParam(key + '[' + propertyName + ']', value[propertyName]));
  12532. }
  12533. } else {
  12534. result.push(encodeKey(key) + '=' + encode(value));
  12535. }
  12536. return result;
  12537. }
  12538. function buildQueryString(params) {
  12539. var pairs = [];
  12540. var keys = Object.keys(params || {}).sort();
  12541. for (var i = 0, len = keys.length; i < len; i++) {
  12542. var key = keys[i];
  12543. pairs = pairs.concat(buildParam(key, params[key]));
  12544. }
  12545. if (pairs.length === 0) {
  12546. return '';
  12547. }
  12548. return pairs.join('&');
  12549. }
  12550. function processScalarParam(existedParam, value, isPrimitive) {
  12551. if (Array.isArray(existedParam)) {
  12552. existedParam.push(value);
  12553. return existedParam;
  12554. }
  12555. if (existedParam !== undefined) {
  12556. return isPrimitive ? value : [existedParam, value];
  12557. }
  12558. return value;
  12559. }
  12560. function parseComplexParam(queryParams, keys, value) {
  12561. var currentParams = queryParams;
  12562. var keysLastIndex = keys.length - 1;
  12563. for (var j = 0; j <= keysLastIndex; j++) {
  12564. var key = keys[j] === '' ? currentParams.length : keys[j];
  12565. if (j < keysLastIndex) {
  12566. currentParams = currentParams[key] = currentParams[key] || (isNaN(keys[j + 1]) ? {} : []);
  12567. } else {
  12568. currentParams = currentParams[key] = value;
  12569. }
  12570. }
  12571. }
  12572. function parseQueryString(queryString) {
  12573. var queryParams = {};
  12574. if (!queryString || typeof queryString !== 'string') {
  12575. return queryParams;
  12576. }
  12577. var query = queryString;
  12578. if (query.charAt(0) === '?') {
  12579. query = query.substr(1);
  12580. }
  12581. var pairs = query.replace(/\+/g, ' ').split('&');
  12582. for (var i = 0; i < pairs.length; i++) {
  12583. var pair = pairs[i].split('=');
  12584. var key = decodeURIComponent(pair[0]);
  12585. var isPrimitive = false;
  12586. if (!key) {
  12587. continue;
  12588. }
  12589. var keys = key.split('][');
  12590. var keysLastIndex = keys.length - 1;
  12591. if (/\[/.test(keys[0]) && /\]$/.test(keys[keysLastIndex])) {
  12592. keys[keysLastIndex] = keys[keysLastIndex].replace(/\]$/, '');
  12593. keys = keys.shift().split('[').concat(keys);
  12594. keysLastIndex = keys.length - 1;
  12595. } else {
  12596. isPrimitive = true;
  12597. keysLastIndex = 0;
  12598. }
  12599. if (pair.length >= 2) {
  12600. var value = pair[1] ? decodeURIComponent(pair[1]) : '';
  12601. if (keysLastIndex) {
  12602. parseComplexParam(queryParams, keys, value);
  12603. } else {
  12604. queryParams[key] = processScalarParam(queryParams[key], value, isPrimitive);
  12605. }
  12606. } else {
  12607. queryParams[key] = true;
  12608. }
  12609. }
  12610. return queryParams;
  12611. }
  12612. });
  12613. define('aurelia-pal-browser',['exports', 'aurelia-pal'], function (exports, _aureliaPal) {
  12614. 'use strict';
  12615. Object.defineProperty(exports, "__esModule", {
  12616. value: true
  12617. });
  12618. exports._DOM = exports._FEATURE = exports._PLATFORM = undefined;
  12619. exports._ensureFunctionName = _ensureFunctionName;
  12620. exports._ensureClassList = _ensureClassList;
  12621. exports._ensurePerformance = _ensurePerformance;
  12622. exports._ensureCustomEvent = _ensureCustomEvent;
  12623. exports._ensureElementMatches = _ensureElementMatches;
  12624. exports._ensureHTMLTemplateElement = _ensureHTMLTemplateElement;
  12625. exports.initialize = initialize;
  12626. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  12627. return typeof obj;
  12628. } : function (obj) {
  12629. return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
  12630. };
  12631. var _PLATFORM = exports._PLATFORM = {
  12632. location: window.location,
  12633. history: window.history,
  12634. addEventListener: function addEventListener(eventName, callback, capture) {
  12635. this.global.addEventListener(eventName, callback, capture);
  12636. },
  12637. removeEventListener: function removeEventListener(eventName, callback, capture) {
  12638. this.global.removeEventListener(eventName, callback, capture);
  12639. },
  12640. performance: window.performance,
  12641. requestAnimationFrame: function requestAnimationFrame(callback) {
  12642. return this.global.requestAnimationFrame(callback);
  12643. }
  12644. };
  12645. function _ensureFunctionName() {
  12646. function test() {}
  12647. if (!test.name) {
  12648. Object.defineProperty(Function.prototype, 'name', {
  12649. get: function get() {
  12650. var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];
  12651. Object.defineProperty(this, 'name', { value: name });
  12652. return name;
  12653. }
  12654. });
  12655. }
  12656. }
  12657. function _ensureClassList() {
  12658. if (!('classList' in document.createElement('_')) || document.createElementNS && !('classList' in document.createElementNS('http://www.w3.org/2000/svg', 'g'))) {
  12659. (function () {
  12660. var protoProp = 'prototype';
  12661. var strTrim = String.prototype.trim;
  12662. var arrIndexOf = Array.prototype.indexOf;
  12663. var emptyArray = [];
  12664. var DOMEx = function DOMEx(type, message) {
  12665. this.name = type;
  12666. this.code = DOMException[type];
  12667. this.message = message;
  12668. };
  12669. var checkTokenAndGetIndex = function checkTokenAndGetIndex(classList, token) {
  12670. if (token === '') {
  12671. throw new DOMEx('SYNTAX_ERR', 'An invalid or illegal string was specified');
  12672. }
  12673. if (/\s/.test(token)) {
  12674. throw new DOMEx('INVALID_CHARACTER_ERR', 'String contains an invalid character');
  12675. }
  12676. return arrIndexOf.call(classList, token);
  12677. };
  12678. var ClassList = function ClassList(elem) {
  12679. var trimmedClasses = strTrim.call(elem.getAttribute('class') || '');
  12680. var classes = trimmedClasses ? trimmedClasses.split(/\s+/) : emptyArray;
  12681. for (var i = 0, ii = classes.length; i < ii; ++i) {
  12682. this.push(classes[i]);
  12683. }
  12684. this._updateClassName = function () {
  12685. elem.setAttribute('class', this.toString());
  12686. };
  12687. };
  12688. var classListProto = ClassList[protoProp] = [];
  12689. DOMEx[protoProp] = Error[protoProp];
  12690. classListProto.item = function (i) {
  12691. return this[i] || null;
  12692. };
  12693. classListProto.contains = function (token) {
  12694. token += '';
  12695. return checkTokenAndGetIndex(this, token) !== -1;
  12696. };
  12697. classListProto.add = function () {
  12698. var tokens = arguments;
  12699. var i = 0;
  12700. var ii = tokens.length;
  12701. var token = void 0;
  12702. var updated = false;
  12703. do {
  12704. token = tokens[i] + '';
  12705. if (checkTokenAndGetIndex(this, token) === -1) {
  12706. this.push(token);
  12707. updated = true;
  12708. }
  12709. } while (++i < ii);
  12710. if (updated) {
  12711. this._updateClassName();
  12712. }
  12713. };
  12714. classListProto.remove = function () {
  12715. var tokens = arguments;
  12716. var i = 0;
  12717. var ii = tokens.length;
  12718. var token = void 0;
  12719. var updated = false;
  12720. var index = void 0;
  12721. do {
  12722. token = tokens[i] + '';
  12723. index = checkTokenAndGetIndex(this, token);
  12724. while (index !== -1) {
  12725. this.splice(index, 1);
  12726. updated = true;
  12727. index = checkTokenAndGetIndex(this, token);
  12728. }
  12729. } while (++i < ii);
  12730. if (updated) {
  12731. this._updateClassName();
  12732. }
  12733. };
  12734. classListProto.toggle = function (token, force) {
  12735. token += '';
  12736. var result = this.contains(token);
  12737. var method = result ? force !== true && 'remove' : force !== false && 'add';
  12738. if (method) {
  12739. this[method](token);
  12740. }
  12741. if (force === true || force === false) {
  12742. return force;
  12743. }
  12744. return !result;
  12745. };
  12746. classListProto.toString = function () {
  12747. return this.join(' ');
  12748. };
  12749. Object.defineProperty(Element.prototype, 'classList', {
  12750. get: function get() {
  12751. return new ClassList(this);
  12752. },
  12753. enumerable: true,
  12754. configurable: true
  12755. });
  12756. })();
  12757. } else {
  12758. var testElement = document.createElement('_');
  12759. testElement.classList.add('c1', 'c2');
  12760. if (!testElement.classList.contains('c2')) {
  12761. var createMethod = function createMethod(method) {
  12762. var original = DOMTokenList.prototype[method];
  12763. DOMTokenList.prototype[method] = function (token) {
  12764. for (var i = 0, ii = arguments.length; i < ii; ++i) {
  12765. token = arguments[i];
  12766. original.call(this, token);
  12767. }
  12768. };
  12769. };
  12770. createMethod('add');
  12771. createMethod('remove');
  12772. }
  12773. testElement.classList.toggle('c3', false);
  12774. if (testElement.classList.contains('c3')) {
  12775. (function () {
  12776. var _toggle = DOMTokenList.prototype.toggle;
  12777. DOMTokenList.prototype.toggle = function (token, force) {
  12778. if (1 in arguments && !this.contains(token) === !force) {
  12779. return force;
  12780. }
  12781. return _toggle.call(this, token);
  12782. };
  12783. })();
  12784. }
  12785. testElement = null;
  12786. }
  12787. }
  12788. function _ensurePerformance() {
  12789. // @license http://opensource.org/licenses/MIT
  12790. if ('performance' in window === false) {
  12791. window.performance = {};
  12792. }
  12793. if ('now' in window.performance === false) {
  12794. (function () {
  12795. var nowOffset = Date.now();
  12796. if (performance.timing && performance.timing.navigationStart) {
  12797. nowOffset = performance.timing.navigationStart;
  12798. }
  12799. window.performance.now = function now() {
  12800. return Date.now() - nowOffset;
  12801. };
  12802. })();
  12803. }
  12804. _PLATFORM.performance = window.performance;
  12805. }
  12806. function _ensureCustomEvent() {
  12807. if (!window.CustomEvent || typeof window.CustomEvent !== 'function') {
  12808. var _CustomEvent = function _CustomEvent(event, params) {
  12809. params = params || {
  12810. bubbles: false,
  12811. cancelable: false,
  12812. detail: undefined
  12813. };
  12814. var evt = document.createEvent('CustomEvent');
  12815. evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
  12816. return evt;
  12817. };
  12818. _CustomEvent.prototype = window.Event.prototype;
  12819. window.CustomEvent = _CustomEvent;
  12820. }
  12821. }
  12822. function _ensureElementMatches() {
  12823. if (Element && !Element.prototype.matches) {
  12824. var proto = Element.prototype;
  12825. proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector;
  12826. }
  12827. }
  12828. var _FEATURE = exports._FEATURE = {};
  12829. _FEATURE.shadowDOM = function () {
  12830. return !!HTMLElement.prototype.attachShadow;
  12831. }();
  12832. _FEATURE.scopedCSS = function () {
  12833. return 'scoped' in document.createElement('style');
  12834. }();
  12835. _FEATURE.htmlTemplateElement = function () {
  12836. return 'content' in document.createElement('template');
  12837. }();
  12838. _FEATURE.mutationObserver = function () {
  12839. return !!(window.MutationObserver || window.WebKitMutationObserver);
  12840. }();
  12841. function _ensureHTMLTemplateElement() {
  12842. function isSVGTemplate(el) {
  12843. return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg';
  12844. }
  12845. function fixSVGTemplateElement(el) {
  12846. var template = el.ownerDocument.createElement('template');
  12847. var attrs = el.attributes;
  12848. var length = attrs.length;
  12849. var attr = void 0;
  12850. el.parentNode.insertBefore(template, el);
  12851. while (length-- > 0) {
  12852. attr = attrs[length];
  12853. template.setAttribute(attr.name, attr.value);
  12854. el.removeAttribute(attr.name);
  12855. }
  12856. el.parentNode.removeChild(el);
  12857. return fixHTMLTemplateElement(template);
  12858. }
  12859. function fixHTMLTemplateElement(template) {
  12860. var content = template.content = document.createDocumentFragment();
  12861. var child = void 0;
  12862. while (child = template.firstChild) {
  12863. content.appendChild(child);
  12864. }
  12865. return template;
  12866. }
  12867. function fixHTMLTemplateElementRoot(template) {
  12868. var content = fixHTMLTemplateElement(template).content;
  12869. var childTemplates = content.querySelectorAll('template');
  12870. for (var i = 0, ii = childTemplates.length; i < ii; ++i) {
  12871. var child = childTemplates[i];
  12872. if (isSVGTemplate(child)) {
  12873. fixSVGTemplateElement(child);
  12874. } else {
  12875. fixHTMLTemplateElement(child);
  12876. }
  12877. }
  12878. return template;
  12879. }
  12880. if (_FEATURE.htmlTemplateElement) {
  12881. _FEATURE.ensureHTMLTemplateElement = function (template) {
  12882. return template;
  12883. };
  12884. } else {
  12885. _FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot;
  12886. }
  12887. }
  12888. var shadowPoly = window.ShadowDOMPolyfill || null;
  12889. var _DOM = exports._DOM = {
  12890. Element: Element,
  12891. SVGElement: SVGElement,
  12892. boundary: 'aurelia-dom-boundary',
  12893. addEventListener: function addEventListener(eventName, callback, capture) {
  12894. document.addEventListener(eventName, callback, capture);
  12895. },
  12896. removeEventListener: function removeEventListener(eventName, callback, capture) {
  12897. document.removeEventListener(eventName, callback, capture);
  12898. },
  12899. adoptNode: function adoptNode(node) {
  12900. return document.adoptNode(node, true);
  12901. },
  12902. createElement: function createElement(tagName) {
  12903. return document.createElement(tagName);
  12904. },
  12905. createTextNode: function createTextNode(text) {
  12906. return document.createTextNode(text);
  12907. },
  12908. createComment: function createComment(text) {
  12909. return document.createComment(text);
  12910. },
  12911. createDocumentFragment: function createDocumentFragment() {
  12912. return document.createDocumentFragment();
  12913. },
  12914. createMutationObserver: function createMutationObserver(callback) {
  12915. return new (window.MutationObserver || window.WebKitMutationObserver)(callback);
  12916. },
  12917. createCustomEvent: function createCustomEvent(eventType, options) {
  12918. return new window.CustomEvent(eventType, options);
  12919. },
  12920. dispatchEvent: function dispatchEvent(evt) {
  12921. document.dispatchEvent(evt);
  12922. },
  12923. getComputedStyle: function getComputedStyle(element) {
  12924. return window.getComputedStyle(element);
  12925. },
  12926. getElementById: function getElementById(id) {
  12927. return document.getElementById(id);
  12928. },
  12929. querySelectorAll: function querySelectorAll(query) {
  12930. return document.querySelectorAll(query);
  12931. },
  12932. nextElementSibling: function nextElementSibling(element) {
  12933. if (element.nextElementSibling) {
  12934. return element.nextElementSibling;
  12935. }
  12936. do {
  12937. element = element.nextSibling;
  12938. } while (element && element.nodeType !== 1);
  12939. return element;
  12940. },
  12941. createTemplateFromMarkup: function createTemplateFromMarkup(markup) {
  12942. var parser = document.createElement('div');
  12943. parser.innerHTML = markup;
  12944. var temp = parser.firstElementChild;
  12945. if (!temp || temp.nodeName !== 'TEMPLATE') {
  12946. throw new Error('Template markup must be wrapped in a <template> element e.g. <template> <!-- markup here --> </template>');
  12947. }
  12948. return _FEATURE.ensureHTMLTemplateElement(temp);
  12949. },
  12950. appendNode: function appendNode(newNode, parentNode) {
  12951. (parentNode || document.body).appendChild(newNode);
  12952. },
  12953. replaceNode: function replaceNode(newNode, node, parentNode) {
  12954. if (node.parentNode) {
  12955. node.parentNode.replaceChild(newNode, node);
  12956. } else if (shadowPoly !== null) {
  12957. shadowPoly.unwrap(parentNode).replaceChild(shadowPoly.unwrap(newNode), shadowPoly.unwrap(node));
  12958. } else {
  12959. parentNode.replaceChild(newNode, node);
  12960. }
  12961. },
  12962. removeNode: function removeNode(node, parentNode) {
  12963. if (node.parentNode) {
  12964. node.parentNode.removeChild(node);
  12965. } else if (parentNode) {
  12966. if (shadowPoly !== null) {
  12967. shadowPoly.unwrap(parentNode).removeChild(shadowPoly.unwrap(node));
  12968. } else {
  12969. parentNode.removeChild(node);
  12970. }
  12971. }
  12972. },
  12973. injectStyles: function injectStyles(styles, destination, prepend) {
  12974. var node = document.createElement('style');
  12975. node.innerHTML = styles;
  12976. node.type = 'text/css';
  12977. destination = destination || document.head;
  12978. if (prepend && destination.childNodes.length > 0) {
  12979. destination.insertBefore(node, destination.childNodes[0]);
  12980. } else {
  12981. destination.appendChild(node);
  12982. }
  12983. return node;
  12984. }
  12985. };
  12986. var isInitialized = false;
  12987. function initialize() {
  12988. if (isInitialized) {
  12989. return;
  12990. }
  12991. isInitialized = true;
  12992. _ensureCustomEvent();
  12993. _ensureFunctionName();
  12994. _ensureHTMLTemplateElement();
  12995. _ensureElementMatches();
  12996. _ensureClassList();
  12997. _ensurePerformance();
  12998. (0, _aureliaPal.initializePAL)(function (platform, feature, dom) {
  12999. Object.assign(platform, _PLATFORM);
  13000. Object.assign(feature, _FEATURE);
  13001. Object.assign(dom, _DOM);
  13002. (function (global) {
  13003. global.console = global.console || {};
  13004. var con = global.console;
  13005. var prop = void 0;
  13006. var method = void 0;
  13007. var empty = {};
  13008. var dummy = function dummy() {};
  13009. var properties = 'memory'.split(',');
  13010. 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(',');
  13011. while (prop = properties.pop()) {
  13012. if (!con[prop]) con[prop] = empty;
  13013. }while (method = methods.pop()) {
  13014. if (!con[method]) con[method] = dummy;
  13015. }
  13016. })(platform.global);
  13017. if (platform.global.console && _typeof(console.log) === 'object') {
  13018. ['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) {
  13019. console[method] = this.bind(console[method], console);
  13020. }, Function.prototype.call);
  13021. }
  13022. Object.defineProperty(dom, 'title', {
  13023. get: function get() {
  13024. return document.title;
  13025. },
  13026. set: function set(value) {
  13027. document.title = value;
  13028. }
  13029. });
  13030. Object.defineProperty(dom, 'activeElement', {
  13031. get: function get() {
  13032. return document.activeElement;
  13033. }
  13034. });
  13035. Object.defineProperty(platform, 'XMLHttpRequest', {
  13036. get: function get() {
  13037. return platform.global.XMLHttpRequest;
  13038. }
  13039. });
  13040. });
  13041. }
  13042. });
  13043. define('aurelia-task-queue',['exports', 'aurelia-pal'], function (exports, _aureliaPal) {
  13044. 'use strict';
  13045. Object.defineProperty(exports, "__esModule", {
  13046. value: true
  13047. });
  13048. exports.TaskQueue = undefined;
  13049. var hasSetImmediate = typeof setImmediate === 'function';
  13050. function makeRequestFlushFromMutationObserver(flush) {
  13051. var toggle = 1;
  13052. var observer = _aureliaPal.DOM.createMutationObserver(flush);
  13053. var node = _aureliaPal.DOM.createTextNode('');
  13054. observer.observe(node, { characterData: true });
  13055. return function requestFlush() {
  13056. toggle = -toggle;
  13057. node.data = toggle;
  13058. };
  13059. }
  13060. function makeRequestFlushFromTimer(flush) {
  13061. return function requestFlush() {
  13062. var timeoutHandle = setTimeout(handleFlushTimer, 0);
  13063. var intervalHandle = setInterval(handleFlushTimer, 50);
  13064. function handleFlushTimer() {
  13065. clearTimeout(timeoutHandle);
  13066. clearInterval(intervalHandle);
  13067. flush();
  13068. }
  13069. };
  13070. }
  13071. function onError(error, task) {
  13072. if ('onError' in task) {
  13073. task.onError(error);
  13074. } else if (hasSetImmediate) {
  13075. setImmediate(function () {
  13076. throw error;
  13077. });
  13078. } else {
  13079. setTimeout(function () {
  13080. throw error;
  13081. }, 0);
  13082. }
  13083. }
  13084. var TaskQueue = exports.TaskQueue = function () {
  13085. function TaskQueue() {
  13086. var _this = this;
  13087. this.microTaskQueue = [];
  13088. this.microTaskQueueCapacity = 1024;
  13089. this.taskQueue = [];
  13090. if (_aureliaPal.FEATURE.mutationObserver) {
  13091. this.requestFlushMicroTaskQueue = makeRequestFlushFromMutationObserver(function () {
  13092. return _this.flushMicroTaskQueue();
  13093. });
  13094. } else {
  13095. this.requestFlushMicroTaskQueue = makeRequestFlushFromTimer(function () {
  13096. return _this.flushMicroTaskQueue();
  13097. });
  13098. }
  13099. this.requestFlushTaskQueue = makeRequestFlushFromTimer(function () {
  13100. return _this.flushTaskQueue();
  13101. });
  13102. }
  13103. TaskQueue.prototype.queueMicroTask = function queueMicroTask(task) {
  13104. if (this.microTaskQueue.length < 1) {
  13105. this.requestFlushMicroTaskQueue();
  13106. }
  13107. this.microTaskQueue.push(task);
  13108. };
  13109. TaskQueue.prototype.queueTask = function queueTask(task) {
  13110. if (this.taskQueue.length < 1) {
  13111. this.requestFlushTaskQueue();
  13112. }
  13113. this.taskQueue.push(task);
  13114. };
  13115. TaskQueue.prototype.flushTaskQueue = function flushTaskQueue() {
  13116. var queue = this.taskQueue;
  13117. var index = 0;
  13118. var task = void 0;
  13119. this.taskQueue = [];
  13120. try {
  13121. while (index < queue.length) {
  13122. task = queue[index];
  13123. task.call();
  13124. index++;
  13125. }
  13126. } catch (error) {
  13127. onError(error, task);
  13128. }
  13129. };
  13130. TaskQueue.prototype.flushMicroTaskQueue = function flushMicroTaskQueue() {
  13131. var queue = this.microTaskQueue;
  13132. var capacity = this.microTaskQueueCapacity;
  13133. var index = 0;
  13134. var task = void 0;
  13135. try {
  13136. while (index < queue.length) {
  13137. task = queue[index];
  13138. task.call();
  13139. index++;
  13140. if (index > capacity) {
  13141. for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
  13142. queue[scan] = queue[scan + index];
  13143. }
  13144. queue.length -= index;
  13145. index = 0;
  13146. }
  13147. }
  13148. } catch (error) {
  13149. onError(error, task);
  13150. }
  13151. queue.length = 0;
  13152. };
  13153. return TaskQueue;
  13154. }();
  13155. });
  13156. 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) {
  13157. 'use strict';
  13158. Object.defineProperty(exports, "__esModule", {
  13159. value: true
  13160. });
  13161. 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;
  13162. function configure(config) {
  13163. (0, _aureliaHideStyle.injectAureliaHideStyleAtHead)();
  13164. 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');
  13165. (0, _htmlResourcePlugin.configure)(config);
  13166. var viewEngine = config.container.get(_aureliaTemplating.ViewEngine);
  13167. viewEngine.addResourcePlugin('.css', {
  13168. 'fetch': function fetch(address) {
  13169. var _ref;
  13170. return _ref = {}, _ref[address] = (0, _cssResource._createCSSResource)(address), _ref;
  13171. }
  13172. });
  13173. }
  13174. exports.Compose = _compose.Compose;
  13175. exports.If = _if.If;
  13176. exports.With = _with.With;
  13177. exports.Repeat = _repeat.Repeat;
  13178. exports.Show = _show.Show;
  13179. exports.Hide = _hide.Hide;
  13180. exports.HTMLSanitizer = _htmlSanitizer.HTMLSanitizer;
  13181. exports.SanitizeHTMLValueConverter = _sanitizeHtml.SanitizeHTMLValueConverter;
  13182. exports.Replaceable = _replaceable.Replaceable;
  13183. exports.Focus = _focus.Focus;
  13184. exports.configure = configure;
  13185. exports.OneTimeBindingBehavior = _bindingModeBehaviors.OneTimeBindingBehavior;
  13186. exports.OneWayBindingBehavior = _bindingModeBehaviors.OneWayBindingBehavior;
  13187. exports.TwoWayBindingBehavior = _bindingModeBehaviors.TwoWayBindingBehavior;
  13188. exports.ThrottleBindingBehavior = _throttleBindingBehavior.ThrottleBindingBehavior;
  13189. exports.DebounceBindingBehavior = _debounceBindingBehavior.DebounceBindingBehavior;
  13190. exports.SignalBindingBehavior = _signalBindingBehavior.SignalBindingBehavior;
  13191. exports.BindingSignaler = _bindingSignaler.BindingSignaler;
  13192. exports.UpdateTriggerBindingBehavior = _updateTriggerBindingBehavior.UpdateTriggerBindingBehavior;
  13193. exports.AbstractRepeater = _abstractRepeater.AbstractRepeater;
  13194. exports.RepeatStrategyLocator = _repeatStrategyLocator.RepeatStrategyLocator;
  13195. exports.NullRepeatStrategy = _nullRepeatStrategy.NullRepeatStrategy;
  13196. exports.ArrayRepeatStrategy = _arrayRepeatStrategy.ArrayRepeatStrategy;
  13197. exports.MapRepeatStrategy = _mapRepeatStrategy.MapRepeatStrategy;
  13198. exports.SetRepeatStrategy = _setRepeatStrategy.SetRepeatStrategy;
  13199. exports.NumberRepeatStrategy = _numberRepeatStrategy.NumberRepeatStrategy;
  13200. exports.createFullOverrideContext = _repeatUtilities.createFullOverrideContext;
  13201. exports.updateOverrideContext = _repeatUtilities.updateOverrideContext;
  13202. exports.getItemsSourceExpression = _repeatUtilities.getItemsSourceExpression;
  13203. exports.isOneTime = _repeatUtilities.isOneTime;
  13204. exports.updateOneTimeBinding = _repeatUtilities.updateOneTimeBinding;
  13205. exports.unwrapExpression = _repeatUtilities.unwrapExpression;
  13206. exports.viewsRequireLifecycle = _analyzeViewFactory.viewsRequireLifecycle;
  13207. });;define('aurelia-templating-resources', ['aurelia-templating-resources/aurelia-templating-resources'], function (main) { return main; });
  13208. define('aurelia-templating-resources/compose',['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia-templating', 'aurelia-pal'], function (exports, _aureliaDependencyInjection, _aureliaTaskQueue, _aureliaTemplating, _aureliaPal) {
  13209. 'use strict';
  13210. Object.defineProperty(exports, "__esModule", {
  13211. value: true
  13212. });
  13213. exports.Compose = undefined;
  13214. function _initDefineProp(target, property, descriptor, context) {
  13215. if (!descriptor) return;
  13216. Object.defineProperty(target, property, {
  13217. enumerable: descriptor.enumerable,
  13218. configurable: descriptor.configurable,
  13219. writable: descriptor.writable,
  13220. value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
  13221. });
  13222. }
  13223. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
  13224. var desc = {};
  13225. Object['ke' + 'ys'](descriptor).forEach(function (key) {
  13226. desc[key] = descriptor[key];
  13227. });
  13228. desc.enumerable = !!desc.enumerable;
  13229. desc.configurable = !!desc.configurable;
  13230. if ('value' in desc || desc.initializer) {
  13231. desc.writable = true;
  13232. }
  13233. desc = decorators.slice().reverse().reduce(function (desc, decorator) {
  13234. return decorator(target, property, desc) || desc;
  13235. }, desc);
  13236. if (context && desc.initializer !== void 0) {
  13237. desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
  13238. desc.initializer = undefined;
  13239. }
  13240. if (desc.initializer === void 0) {
  13241. Object['define' + 'Property'](target, property, desc);
  13242. desc = null;
  13243. }
  13244. return desc;
  13245. }
  13246. function _initializerWarningHelper(descriptor, context) {
  13247. throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
  13248. }
  13249. var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3;
  13250. 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 () {
  13251. function Compose(element, container, compositionEngine, viewSlot, viewResources, taskQueue) {
  13252. _initDefineProp(this, 'model', _descriptor, this);
  13253. _initDefineProp(this, 'view', _descriptor2, this);
  13254. _initDefineProp(this, 'viewModel', _descriptor3, this);
  13255. this.element = element;
  13256. this.container = container;
  13257. this.compositionEngine = compositionEngine;
  13258. this.viewSlot = viewSlot;
  13259. this.viewResources = viewResources;
  13260. this.taskQueue = taskQueue;
  13261. this.currentController = null;
  13262. this.currentViewModel = null;
  13263. }
  13264. Compose.prototype.created = function created(owningView) {
  13265. this.owningView = owningView;
  13266. };
  13267. Compose.prototype.bind = function bind(bindingContext, overrideContext) {
  13268. this.bindingContext = bindingContext;
  13269. this.overrideContext = overrideContext;
  13270. processInstruction(this, createInstruction(this, {
  13271. view: this.view,
  13272. viewModel: this.viewModel,
  13273. model: this.model
  13274. }));
  13275. };
  13276. Compose.prototype.unbind = function unbind(bindingContext, overrideContext) {
  13277. this.bindingContext = null;
  13278. this.overrideContext = null;
  13279. var returnToCache = true;
  13280. var skipAnimation = true;
  13281. this.viewSlot.removeAll(returnToCache, skipAnimation);
  13282. };
  13283. Compose.prototype.modelChanged = function modelChanged(newValue, oldValue) {
  13284. var _this = this;
  13285. if (this.currentInstruction) {
  13286. this.currentInstruction.model = newValue;
  13287. return;
  13288. }
  13289. this.taskQueue.queueMicroTask(function () {
  13290. if (_this.currentInstruction) {
  13291. _this.currentInstruction.model = newValue;
  13292. return;
  13293. }
  13294. var vm = _this.currentViewModel;
  13295. if (vm && typeof vm.activate === 'function') {
  13296. vm.activate(newValue);
  13297. }
  13298. });
  13299. };
  13300. Compose.prototype.viewChanged = function viewChanged(newValue, oldValue) {
  13301. var _this2 = this;
  13302. var instruction = createInstruction(this, {
  13303. view: newValue,
  13304. viewModel: this.currentViewModel || this.viewModel,
  13305. model: this.model
  13306. });
  13307. if (this.currentInstruction) {
  13308. this.currentInstruction = instruction;
  13309. return;
  13310. }
  13311. this.currentInstruction = instruction;
  13312. this.taskQueue.queueMicroTask(function () {
  13313. return processInstruction(_this2, _this2.currentInstruction);
  13314. });
  13315. };
  13316. Compose.prototype.viewModelChanged = function viewModelChanged(newValue, oldValue) {
  13317. var _this3 = this;
  13318. var instruction = createInstruction(this, {
  13319. viewModel: newValue,
  13320. view: this.view,
  13321. model: this.model
  13322. });
  13323. if (this.currentInstruction) {
  13324. this.currentInstruction = instruction;
  13325. return;
  13326. }
  13327. this.currentInstruction = instruction;
  13328. this.taskQueue.queueMicroTask(function () {
  13329. return processInstruction(_this3, _this3.currentInstruction);
  13330. });
  13331. };
  13332. return Compose;
  13333. }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'model', [_aureliaTemplating.bindable], {
  13334. enumerable: true,
  13335. initializer: null
  13336. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'view', [_aureliaTemplating.bindable], {
  13337. enumerable: true,
  13338. initializer: null
  13339. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'viewModel', [_aureliaTemplating.bindable], {
  13340. enumerable: true,
  13341. initializer: null
  13342. })), _class2)) || _class) || _class) || _class);
  13343. function createInstruction(composer, instruction) {
  13344. return Object.assign(instruction, {
  13345. bindingContext: composer.bindingContext,
  13346. overrideContext: composer.overrideContext,
  13347. owningView: composer.owningView,
  13348. container: composer.container,
  13349. viewSlot: composer.viewSlot,
  13350. viewResources: composer.viewResources,
  13351. currentController: composer.currentController,
  13352. host: composer.element
  13353. });
  13354. }
  13355. function processInstruction(composer, instruction) {
  13356. composer.currentInstruction = null;
  13357. composer.compositionEngine.compose(instruction).then(function (controller) {
  13358. composer.currentController = controller;
  13359. composer.currentViewModel = controller ? controller.viewModel : null;
  13360. });
  13361. }
  13362. });
  13363. define('aurelia-templating-resources/if',['exports', 'aurelia-templating', 'aurelia-dependency-injection'], function (exports, _aureliaTemplating, _aureliaDependencyInjection) {
  13364. 'use strict';
  13365. Object.defineProperty(exports, "__esModule", {
  13366. value: true
  13367. });
  13368. exports.If = undefined;
  13369. var _dec, _dec2, _class;
  13370. 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 () {
  13371. function If(viewFactory, viewSlot) {
  13372. this.viewFactory = viewFactory;
  13373. this.viewSlot = viewSlot;
  13374. this.showing = false;
  13375. this.view = null;
  13376. this.bindingContext = null;
  13377. this.overrideContext = null;
  13378. }
  13379. If.prototype.bind = function bind(bindingContext, overrideContext) {
  13380. this.bindingContext = bindingContext;
  13381. this.overrideContext = overrideContext;
  13382. this.valueChanged(this.value);
  13383. };
  13384. If.prototype.valueChanged = function valueChanged(newValue) {
  13385. var _this = this;
  13386. if (this.__queuedChanges) {
  13387. this.__queuedChanges.push(newValue);
  13388. return;
  13389. }
  13390. var maybePromise = this._runValueChanged(newValue);
  13391. if (maybePromise instanceof Promise) {
  13392. (function () {
  13393. var queuedChanges = _this.__queuedChanges = [];
  13394. var runQueuedChanges = function runQueuedChanges() {
  13395. if (!queuedChanges.length) {
  13396. _this.__queuedChanges = undefined;
  13397. return;
  13398. }
  13399. var nextPromise = _this._runValueChanged(queuedChanges.shift()) || Promise.resolve();
  13400. nextPromise.then(runQueuedChanges);
  13401. };
  13402. maybePromise.then(runQueuedChanges);
  13403. })();
  13404. }
  13405. };
  13406. If.prototype._runValueChanged = function _runValueChanged(newValue) {
  13407. var _this2 = this;
  13408. if (!newValue) {
  13409. var viewOrPromise = void 0;
  13410. if (this.view !== null && this.showing) {
  13411. viewOrPromise = this.viewSlot.remove(this.view);
  13412. if (viewOrPromise instanceof Promise) {
  13413. viewOrPromise.then(function () {
  13414. return _this2.view.unbind();
  13415. });
  13416. } else {
  13417. this.view.unbind();
  13418. }
  13419. }
  13420. this.showing = false;
  13421. return viewOrPromise;
  13422. }
  13423. if (this.view === null) {
  13424. this.view = this.viewFactory.create();
  13425. }
  13426. if (!this.view.isBound) {
  13427. this.view.bind(this.bindingContext, this.overrideContext);
  13428. }
  13429. if (!this.showing) {
  13430. this.showing = true;
  13431. return this.viewSlot.add(this.view);
  13432. }
  13433. return undefined;
  13434. };
  13435. If.prototype.unbind = function unbind() {
  13436. if (this.view === null) {
  13437. return;
  13438. }
  13439. this.view.unbind();
  13440. if (!this.viewFactory.isCaching) {
  13441. return;
  13442. }
  13443. if (this.showing) {
  13444. this.showing = false;
  13445. this.viewSlot.remove(this.view, true, true);
  13446. }
  13447. this.view.returnToCache();
  13448. this.view = null;
  13449. };
  13450. return If;
  13451. }()) || _class) || _class) || _class);
  13452. });
  13453. define('aurelia-templating-resources/with',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-binding'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaBinding) {
  13454. 'use strict';
  13455. Object.defineProperty(exports, "__esModule", {
  13456. value: true
  13457. });
  13458. exports.With = undefined;
  13459. var _dec, _dec2, _class;
  13460. 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 () {
  13461. function With(viewFactory, viewSlot) {
  13462. this.viewFactory = viewFactory;
  13463. this.viewSlot = viewSlot;
  13464. this.parentOverrideContext = null;
  13465. this.view = null;
  13466. }
  13467. With.prototype.bind = function bind(bindingContext, overrideContext) {
  13468. this.parentOverrideContext = overrideContext;
  13469. this.valueChanged(this.value);
  13470. };
  13471. With.prototype.valueChanged = function valueChanged(newValue) {
  13472. var overrideContext = (0, _aureliaBinding.createOverrideContext)(newValue, this.parentOverrideContext);
  13473. if (!this.view) {
  13474. this.view = this.viewFactory.create();
  13475. this.view.bind(newValue, overrideContext);
  13476. this.viewSlot.add(this.view);
  13477. } else {
  13478. this.view.bind(newValue, overrideContext);
  13479. }
  13480. };
  13481. With.prototype.unbind = function unbind() {
  13482. this.parentOverrideContext = null;
  13483. if (this.view) {
  13484. this.view.unbind();
  13485. }
  13486. };
  13487. return With;
  13488. }()) || _class) || _class) || _class);
  13489. });
  13490. 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) {
  13491. 'use strict';
  13492. Object.defineProperty(exports, "__esModule", {
  13493. value: true
  13494. });
  13495. exports.Repeat = undefined;
  13496. function _initDefineProp(target, property, descriptor, context) {
  13497. if (!descriptor) return;
  13498. Object.defineProperty(target, property, {
  13499. enumerable: descriptor.enumerable,
  13500. configurable: descriptor.configurable,
  13501. writable: descriptor.writable,
  13502. value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
  13503. });
  13504. }
  13505. function _possibleConstructorReturn(self, call) {
  13506. if (!self) {
  13507. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  13508. }
  13509. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  13510. }
  13511. function _inherits(subClass, superClass) {
  13512. if (typeof superClass !== "function" && superClass !== null) {
  13513. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  13514. }
  13515. subClass.prototype = Object.create(superClass && superClass.prototype, {
  13516. constructor: {
  13517. value: subClass,
  13518. enumerable: false,
  13519. writable: true,
  13520. configurable: true
  13521. }
  13522. });
  13523. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  13524. }
  13525. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
  13526. var desc = {};
  13527. Object['ke' + 'ys'](descriptor).forEach(function (key) {
  13528. desc[key] = descriptor[key];
  13529. });
  13530. desc.enumerable = !!desc.enumerable;
  13531. desc.configurable = !!desc.configurable;
  13532. if ('value' in desc || desc.initializer) {
  13533. desc.writable = true;
  13534. }
  13535. desc = decorators.slice().reverse().reduce(function (desc, decorator) {
  13536. return decorator(target, property, desc) || desc;
  13537. }, desc);
  13538. if (context && desc.initializer !== void 0) {
  13539. desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
  13540. desc.initializer = undefined;
  13541. }
  13542. if (desc.initializer === void 0) {
  13543. Object['define' + 'Property'](target, property, desc);
  13544. desc = null;
  13545. }
  13546. return desc;
  13547. }
  13548. function _initializerWarningHelper(descriptor, context) {
  13549. throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
  13550. }
  13551. var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
  13552. 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) {
  13553. _inherits(Repeat, _AbstractRepeater);
  13554. function Repeat(viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator) {
  13555. var _this = _possibleConstructorReturn(this, _AbstractRepeater.call(this, {
  13556. local: 'item',
  13557. viewsRequireLifecycle: (0, _analyzeViewFactory.viewsRequireLifecycle)(viewFactory)
  13558. }));
  13559. _initDefineProp(_this, 'items', _descriptor, _this);
  13560. _initDefineProp(_this, 'local', _descriptor2, _this);
  13561. _initDefineProp(_this, 'key', _descriptor3, _this);
  13562. _initDefineProp(_this, 'value', _descriptor4, _this);
  13563. _this.viewFactory = viewFactory;
  13564. _this.instruction = instruction;
  13565. _this.viewSlot = viewSlot;
  13566. _this.lookupFunctions = viewResources.lookupFunctions;
  13567. _this.observerLocator = observerLocator;
  13568. _this.key = 'key';
  13569. _this.value = 'value';
  13570. _this.strategyLocator = strategyLocator;
  13571. _this.ignoreMutation = false;
  13572. _this.sourceExpression = (0, _repeatUtilities.getItemsSourceExpression)(_this.instruction, 'repeat.for');
  13573. _this.isOneTime = (0, _repeatUtilities.isOneTime)(_this.sourceExpression);
  13574. _this.viewsRequireLifecycle = (0, _analyzeViewFactory.viewsRequireLifecycle)(viewFactory);
  13575. return _this;
  13576. }
  13577. Repeat.prototype.call = function call(context, changes) {
  13578. this[context](this.items, changes);
  13579. };
  13580. Repeat.prototype.bind = function bind(bindingContext, overrideContext) {
  13581. this.scope = { bindingContext: bindingContext, overrideContext: overrideContext };
  13582. this.matcherBinding = this._captureAndRemoveMatcherBinding();
  13583. this.itemsChanged();
  13584. };
  13585. Repeat.prototype.unbind = function unbind() {
  13586. this.scope = null;
  13587. this.items = null;
  13588. this.matcherBinding = null;
  13589. this.viewSlot.removeAll(true);
  13590. this._unsubscribeCollection();
  13591. };
  13592. Repeat.prototype._unsubscribeCollection = function _unsubscribeCollection() {
  13593. if (this.collectionObserver) {
  13594. this.collectionObserver.unsubscribe(this.callContext, this);
  13595. this.collectionObserver = null;
  13596. this.callContext = null;
  13597. }
  13598. };
  13599. Repeat.prototype.itemsChanged = function itemsChanged() {
  13600. this._unsubscribeCollection();
  13601. if (!this.scope) {
  13602. return;
  13603. }
  13604. var items = this.items;
  13605. this.strategy = this.strategyLocator.getStrategy(items);
  13606. if (!this.strategy) {
  13607. throw new Error('Value for \'' + this.sourceExpression + '\' is non-repeatable');
  13608. }
  13609. if (!this.isOneTime && !this._observeInnerCollection()) {
  13610. this._observeCollection();
  13611. }
  13612. this.strategy.instanceChanged(this, items);
  13613. };
  13614. Repeat.prototype._getInnerCollection = function _getInnerCollection() {
  13615. var expression = (0, _repeatUtilities.unwrapExpression)(this.sourceExpression);
  13616. if (!expression) {
  13617. return null;
  13618. }
  13619. return expression.evaluate(this.scope, null);
  13620. };
  13621. Repeat.prototype.handleCollectionMutated = function handleCollectionMutated(collection, changes) {
  13622. if (!this.collectionObserver) {
  13623. return;
  13624. }
  13625. this.strategy.instanceMutated(this, collection, changes);
  13626. };
  13627. Repeat.prototype.handleInnerCollectionMutated = function handleInnerCollectionMutated(collection, changes) {
  13628. var _this2 = this;
  13629. if (!this.collectionObserver) {
  13630. return;
  13631. }
  13632. if (this.ignoreMutation) {
  13633. return;
  13634. }
  13635. this.ignoreMutation = true;
  13636. var newItems = this.sourceExpression.evaluate(this.scope, this.lookupFunctions);
  13637. this.observerLocator.taskQueue.queueMicroTask(function () {
  13638. return _this2.ignoreMutation = false;
  13639. });
  13640. if (newItems === this.items) {
  13641. this.itemsChanged();
  13642. } else {
  13643. this.items = newItems;
  13644. }
  13645. };
  13646. Repeat.prototype._observeInnerCollection = function _observeInnerCollection() {
  13647. var items = this._getInnerCollection();
  13648. var strategy = this.strategyLocator.getStrategy(items);
  13649. if (!strategy) {
  13650. return false;
  13651. }
  13652. this.collectionObserver = strategy.getCollectionObserver(this.observerLocator, items);
  13653. if (!this.collectionObserver) {
  13654. return false;
  13655. }
  13656. this.callContext = 'handleInnerCollectionMutated';
  13657. this.collectionObserver.subscribe(this.callContext, this);
  13658. return true;
  13659. };
  13660. Repeat.prototype._observeCollection = function _observeCollection() {
  13661. var items = this.items;
  13662. this.collectionObserver = this.strategy.getCollectionObserver(this.observerLocator, items);
  13663. if (this.collectionObserver) {
  13664. this.callContext = 'handleCollectionMutated';
  13665. this.collectionObserver.subscribe(this.callContext, this);
  13666. }
  13667. };
  13668. Repeat.prototype._captureAndRemoveMatcherBinding = function _captureAndRemoveMatcherBinding() {
  13669. if (this.viewFactory.viewFactory) {
  13670. var instructions = this.viewFactory.viewFactory.instructions;
  13671. var instructionIds = Object.keys(instructions);
  13672. for (var i = 0; i < instructionIds.length; i++) {
  13673. var expressions = instructions[instructionIds[i]].expressions;
  13674. if (expressions) {
  13675. for (var ii = 0; i < expressions.length; i++) {
  13676. if (expressions[ii].targetProperty === 'matcher') {
  13677. var matcherBinding = expressions[ii];
  13678. expressions.splice(ii, 1);
  13679. return matcherBinding;
  13680. }
  13681. }
  13682. }
  13683. }
  13684. }
  13685. return undefined;
  13686. };
  13687. Repeat.prototype.viewCount = function viewCount() {
  13688. return this.viewSlot.children.length;
  13689. };
  13690. Repeat.prototype.views = function views() {
  13691. return this.viewSlot.children;
  13692. };
  13693. Repeat.prototype.view = function view(index) {
  13694. return this.viewSlot.children[index];
  13695. };
  13696. Repeat.prototype.matcher = function matcher() {
  13697. return this.matcherBinding ? this.matcherBinding.sourceExpression.evaluate(this.scope, this.matcherBinding.lookupFunctions) : null;
  13698. };
  13699. Repeat.prototype.addView = function addView(bindingContext, overrideContext) {
  13700. var view = this.viewFactory.create();
  13701. view.bind(bindingContext, overrideContext);
  13702. this.viewSlot.add(view);
  13703. };
  13704. Repeat.prototype.insertView = function insertView(index, bindingContext, overrideContext) {
  13705. var view = this.viewFactory.create();
  13706. view.bind(bindingContext, overrideContext);
  13707. this.viewSlot.insert(index, view);
  13708. };
  13709. Repeat.prototype.moveView = function moveView(sourceIndex, targetIndex) {
  13710. this.viewSlot.move(sourceIndex, targetIndex);
  13711. };
  13712. Repeat.prototype.removeAllViews = function removeAllViews(returnToCache, skipAnimation) {
  13713. return this.viewSlot.removeAll(returnToCache, skipAnimation);
  13714. };
  13715. Repeat.prototype.removeViews = function removeViews(viewsToRemove, returnToCache, skipAnimation) {
  13716. return this.viewSlot.removeMany(viewsToRemove, returnToCache, skipAnimation);
  13717. };
  13718. Repeat.prototype.removeView = function removeView(index, returnToCache, skipAnimation) {
  13719. return this.viewSlot.removeAt(index, returnToCache, skipAnimation);
  13720. };
  13721. Repeat.prototype.updateBindings = function updateBindings(view) {
  13722. var j = view.bindings.length;
  13723. while (j--) {
  13724. (0, _repeatUtilities.updateOneTimeBinding)(view.bindings[j]);
  13725. }
  13726. j = view.controllers.length;
  13727. while (j--) {
  13728. var k = view.controllers[j].boundProperties.length;
  13729. while (k--) {
  13730. var binding = view.controllers[j].boundProperties[k].binding;
  13731. (0, _repeatUtilities.updateOneTimeBinding)(binding);
  13732. }
  13733. }
  13734. };
  13735. return Repeat;
  13736. }(_abstractRepeater.AbstractRepeater), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'items', [_aureliaTemplating.bindable], {
  13737. enumerable: true,
  13738. initializer: null
  13739. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'local', [_aureliaTemplating.bindable], {
  13740. enumerable: true,
  13741. initializer: null
  13742. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'key', [_aureliaTemplating.bindable], {
  13743. enumerable: true,
  13744. initializer: null
  13745. }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'value', [_aureliaTemplating.bindable], {
  13746. enumerable: true,
  13747. initializer: null
  13748. })), _class2)) || _class) || _class) || _class);
  13749. });
  13750. 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) {
  13751. 'use strict';
  13752. Object.defineProperty(exports, "__esModule", {
  13753. value: true
  13754. });
  13755. exports.RepeatStrategyLocator = undefined;
  13756. var RepeatStrategyLocator = exports.RepeatStrategyLocator = function () {
  13757. function RepeatStrategyLocator() {
  13758. this.matchers = [];
  13759. this.strategies = [];
  13760. this.addStrategy(function (items) {
  13761. return items === null || items === undefined;
  13762. }, new _nullRepeatStrategy.NullRepeatStrategy());
  13763. this.addStrategy(function (items) {
  13764. return items instanceof Array;
  13765. }, new _arrayRepeatStrategy.ArrayRepeatStrategy());
  13766. this.addStrategy(function (items) {
  13767. return items instanceof Map;
  13768. }, new _mapRepeatStrategy.MapRepeatStrategy());
  13769. this.addStrategy(function (items) {
  13770. return items instanceof Set;
  13771. }, new _setRepeatStrategy.SetRepeatStrategy());
  13772. this.addStrategy(function (items) {
  13773. return typeof items === 'number';
  13774. }, new _numberRepeatStrategy.NumberRepeatStrategy());
  13775. }
  13776. RepeatStrategyLocator.prototype.addStrategy = function addStrategy(matcher, strategy) {
  13777. this.matchers.push(matcher);
  13778. this.strategies.push(strategy);
  13779. };
  13780. RepeatStrategyLocator.prototype.getStrategy = function getStrategy(items) {
  13781. var matchers = this.matchers;
  13782. for (var i = 0, ii = matchers.length; i < ii; ++i) {
  13783. if (matchers[i](items)) {
  13784. return this.strategies[i];
  13785. }
  13786. }
  13787. return null;
  13788. };
  13789. return RepeatStrategyLocator;
  13790. }();
  13791. });
  13792. define('aurelia-templating-resources/null-repeat-strategy',["exports"], function (exports) {
  13793. "use strict";
  13794. Object.defineProperty(exports, "__esModule", {
  13795. value: true
  13796. });
  13797. var NullRepeatStrategy = exports.NullRepeatStrategy = function () {
  13798. function NullRepeatStrategy() {
  13799. }
  13800. NullRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
  13801. repeat.removeAllViews(true);
  13802. };
  13803. NullRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {};
  13804. return NullRepeatStrategy;
  13805. }();
  13806. });
  13807. define('aurelia-templating-resources/array-repeat-strategy',['exports', './repeat-utilities', 'aurelia-binding'], function (exports, _repeatUtilities, _aureliaBinding) {
  13808. 'use strict';
  13809. Object.defineProperty(exports, "__esModule", {
  13810. value: true
  13811. });
  13812. exports.ArrayRepeatStrategy = undefined;
  13813. var ArrayRepeatStrategy = exports.ArrayRepeatStrategy = function () {
  13814. function ArrayRepeatStrategy() {
  13815. }
  13816. ArrayRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
  13817. return observerLocator.getArrayObserver(items);
  13818. };
  13819. ArrayRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
  13820. var _this = this;
  13821. var itemsLength = items.length;
  13822. if (!items || itemsLength === 0) {
  13823. repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
  13824. return;
  13825. }
  13826. var children = repeat.views();
  13827. var viewsLength = children.length;
  13828. if (viewsLength === 0) {
  13829. this._standardProcessInstanceChanged(repeat, items);
  13830. return;
  13831. }
  13832. if (repeat.viewsRequireLifecycle) {
  13833. (function () {
  13834. var childrenSnapshot = children.slice(0);
  13835. var itemNameInBindingContext = repeat.local;
  13836. var matcher = repeat.matcher();
  13837. var itemsPreviouslyInViews = [];
  13838. var viewsToRemove = [];
  13839. for (var index = 0; index < viewsLength; index++) {
  13840. var view = childrenSnapshot[index];
  13841. var oldItem = view.bindingContext[itemNameInBindingContext];
  13842. if ((0, _repeatUtilities.indexOf)(items, oldItem, matcher) === -1) {
  13843. viewsToRemove.push(view);
  13844. } else {
  13845. itemsPreviouslyInViews.push(oldItem);
  13846. }
  13847. }
  13848. var updateViews = void 0;
  13849. var removePromise = void 0;
  13850. if (itemsPreviouslyInViews.length > 0) {
  13851. removePromise = repeat.removeViews(viewsToRemove, true, !repeat.viewsRequireLifecycle);
  13852. updateViews = function updateViews() {
  13853. for (var _index = 0; _index < itemsLength; _index++) {
  13854. var item = items[_index];
  13855. var indexOfView = (0, _repeatUtilities.indexOf)(itemsPreviouslyInViews, item, matcher, _index);
  13856. var _view = void 0;
  13857. if (indexOfView === -1) {
  13858. var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[_index], _index, itemsLength);
  13859. repeat.insertView(_index, overrideContext.bindingContext, overrideContext);
  13860. itemsPreviouslyInViews.splice(_index, 0, undefined);
  13861. } else if (indexOfView === _index) {
  13862. _view = children[indexOfView];
  13863. itemsPreviouslyInViews[indexOfView] = undefined;
  13864. } else {
  13865. _view = children[indexOfView];
  13866. repeat.moveView(indexOfView, _index);
  13867. itemsPreviouslyInViews.splice(indexOfView, 1);
  13868. itemsPreviouslyInViews.splice(_index, 0, undefined);
  13869. }
  13870. if (_view) {
  13871. (0, _repeatUtilities.updateOverrideContext)(_view.overrideContext, _index, itemsLength);
  13872. }
  13873. }
  13874. _this._inPlaceProcessItems(repeat, items);
  13875. };
  13876. } else {
  13877. removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
  13878. updateViews = function updateViews() {
  13879. return _this._standardProcessInstanceChanged(repeat, items);
  13880. };
  13881. }
  13882. if (removePromise instanceof Promise) {
  13883. removePromise.then(updateViews);
  13884. } else {
  13885. updateViews();
  13886. }
  13887. })();
  13888. } else {
  13889. this._inPlaceProcessItems(repeat, items);
  13890. }
  13891. };
  13892. ArrayRepeatStrategy.prototype._standardProcessInstanceChanged = function _standardProcessInstanceChanged(repeat, items) {
  13893. for (var i = 0, ii = items.length; i < ii; i++) {
  13894. var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[i], i, ii);
  13895. repeat.addView(overrideContext.bindingContext, overrideContext);
  13896. }
  13897. };
  13898. ArrayRepeatStrategy.prototype._inPlaceProcessItems = function _inPlaceProcessItems(repeat, items) {
  13899. var itemsLength = items.length;
  13900. var viewsLength = repeat.viewCount();
  13901. while (viewsLength > itemsLength) {
  13902. viewsLength--;
  13903. repeat.removeView(viewsLength, true, !repeat.viewsRequireLifecycle);
  13904. }
  13905. var local = repeat.local;
  13906. for (var i = 0; i < viewsLength; i++) {
  13907. var view = repeat.view(i);
  13908. var last = i === itemsLength - 1;
  13909. var middle = i !== 0 && !last;
  13910. if (view.bindingContext[local] === items[i] && view.overrideContext.$middle === middle && view.overrideContext.$last === last) {
  13911. continue;
  13912. }
  13913. view.bindingContext[local] = items[i];
  13914. view.overrideContext.$middle = middle;
  13915. view.overrideContext.$last = last;
  13916. repeat.updateBindings(view);
  13917. }
  13918. for (var _i = viewsLength; _i < itemsLength; _i++) {
  13919. var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, items[_i], _i, itemsLength);
  13920. repeat.addView(overrideContext.bindingContext, overrideContext);
  13921. }
  13922. };
  13923. ArrayRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, array, splices) {
  13924. var _this2 = this;
  13925. if (repeat.__queuedSplices) {
  13926. for (var i = 0, ii = splices.length; i < ii; ++i) {
  13927. var _splices$i = splices[i];
  13928. var index = _splices$i.index;
  13929. var removed = _splices$i.removed;
  13930. var addedCount = _splices$i.addedCount;
  13931. (0, _aureliaBinding.mergeSplice)(repeat.__queuedSplices, index, removed, addedCount);
  13932. }
  13933. repeat.__array = array.slice(0);
  13934. return;
  13935. }
  13936. var maybePromise = this._runSplices(repeat, array.slice(0), splices);
  13937. if (maybePromise instanceof Promise) {
  13938. (function () {
  13939. var queuedSplices = repeat.__queuedSplices = [];
  13940. var runQueuedSplices = function runQueuedSplices() {
  13941. if (!queuedSplices.length) {
  13942. repeat.__queuedSplices = undefined;
  13943. repeat.__array = undefined;
  13944. return;
  13945. }
  13946. var nextPromise = _this2._runSplices(repeat, repeat.__array, queuedSplices) || Promise.resolve();
  13947. queuedSplices = repeat.__queuedSplices = [];
  13948. nextPromise.then(runQueuedSplices);
  13949. };
  13950. maybePromise.then(runQueuedSplices);
  13951. })();
  13952. }
  13953. };
  13954. ArrayRepeatStrategy.prototype._runSplices = function _runSplices(repeat, array, splices) {
  13955. var _this3 = this;
  13956. var removeDelta = 0;
  13957. var rmPromises = [];
  13958. for (var i = 0, ii = splices.length; i < ii; ++i) {
  13959. var splice = splices[i];
  13960. var removed = splice.removed;
  13961. for (var j = 0, jj = removed.length; j < jj; ++j) {
  13962. var viewOrPromise = repeat.removeView(splice.index + removeDelta + rmPromises.length, true);
  13963. if (viewOrPromise instanceof Promise) {
  13964. rmPromises.push(viewOrPromise);
  13965. }
  13966. }
  13967. removeDelta -= splice.addedCount;
  13968. }
  13969. if (rmPromises.length > 0) {
  13970. return Promise.all(rmPromises).then(function () {
  13971. var spliceIndexLow = _this3._handleAddedSplices(repeat, array, splices);
  13972. (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), spliceIndexLow);
  13973. });
  13974. }
  13975. var spliceIndexLow = this._handleAddedSplices(repeat, array, splices);
  13976. (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), spliceIndexLow);
  13977. return undefined;
  13978. };
  13979. ArrayRepeatStrategy.prototype._handleAddedSplices = function _handleAddedSplices(repeat, array, splices) {
  13980. var spliceIndex = void 0;
  13981. var spliceIndexLow = void 0;
  13982. var arrayLength = array.length;
  13983. for (var i = 0, ii = splices.length; i < ii; ++i) {
  13984. var splice = splices[i];
  13985. var addIndex = spliceIndex = splice.index;
  13986. var end = splice.index + splice.addedCount;
  13987. if (typeof spliceIndexLow === 'undefined' || spliceIndexLow === null || spliceIndexLow > splice.index) {
  13988. spliceIndexLow = spliceIndex;
  13989. }
  13990. for (; addIndex < end; ++addIndex) {
  13991. var overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, array[addIndex], addIndex, arrayLength);
  13992. repeat.insertView(addIndex, overrideContext.bindingContext, overrideContext);
  13993. }
  13994. }
  13995. return spliceIndexLow;
  13996. };
  13997. return ArrayRepeatStrategy;
  13998. }();
  13999. });
  14000. define('aurelia-templating-resources/repeat-utilities',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
  14001. 'use strict';
  14002. Object.defineProperty(exports, "__esModule", {
  14003. value: true
  14004. });
  14005. exports.updateOverrideContexts = updateOverrideContexts;
  14006. exports.createFullOverrideContext = createFullOverrideContext;
  14007. exports.updateOverrideContext = updateOverrideContext;
  14008. exports.getItemsSourceExpression = getItemsSourceExpression;
  14009. exports.unwrapExpression = unwrapExpression;
  14010. exports.isOneTime = isOneTime;
  14011. exports.updateOneTimeBinding = updateOneTimeBinding;
  14012. exports.indexOf = indexOf;
  14013. var oneTime = _aureliaBinding.bindingMode.oneTime;
  14014. function updateOverrideContexts(views, startIndex) {
  14015. var length = views.length;
  14016. if (startIndex > 0) {
  14017. startIndex = startIndex - 1;
  14018. }
  14019. for (; startIndex < length; ++startIndex) {
  14020. updateOverrideContext(views[startIndex].overrideContext, startIndex, length);
  14021. }
  14022. }
  14023. function createFullOverrideContext(repeat, data, index, length, key) {
  14024. var bindingContext = {};
  14025. var overrideContext = (0, _aureliaBinding.createOverrideContext)(bindingContext, repeat.scope.overrideContext);
  14026. if (typeof key !== 'undefined') {
  14027. bindingContext[repeat.key] = key;
  14028. bindingContext[repeat.value] = data;
  14029. } else {
  14030. bindingContext[repeat.local] = data;
  14031. }
  14032. updateOverrideContext(overrideContext, index, length);
  14033. return overrideContext;
  14034. }
  14035. function updateOverrideContext(overrideContext, index, length) {
  14036. var first = index === 0;
  14037. var last = index === length - 1;
  14038. var even = index % 2 === 0;
  14039. overrideContext.$index = index;
  14040. overrideContext.$first = first;
  14041. overrideContext.$last = last;
  14042. overrideContext.$middle = !(first || last);
  14043. overrideContext.$odd = !even;
  14044. overrideContext.$even = even;
  14045. }
  14046. function getItemsSourceExpression(instruction, attrName) {
  14047. return instruction.behaviorInstructions.filter(function (bi) {
  14048. return bi.originalAttrName === attrName;
  14049. })[0].attributes.items.sourceExpression;
  14050. }
  14051. function unwrapExpression(expression) {
  14052. var unwrapped = false;
  14053. while (expression instanceof _aureliaBinding.BindingBehavior) {
  14054. expression = expression.expression;
  14055. }
  14056. while (expression instanceof _aureliaBinding.ValueConverter) {
  14057. expression = expression.expression;
  14058. unwrapped = true;
  14059. }
  14060. return unwrapped ? expression : null;
  14061. }
  14062. function isOneTime(expression) {
  14063. while (expression instanceof _aureliaBinding.BindingBehavior) {
  14064. if (expression.name === 'oneTime') {
  14065. return true;
  14066. }
  14067. expression = expression.expression;
  14068. }
  14069. return false;
  14070. }
  14071. function updateOneTimeBinding(binding) {
  14072. if (binding.call && binding.mode === oneTime) {
  14073. binding.call(_aureliaBinding.sourceContext);
  14074. } else if (binding.updateOneTimeBindings) {
  14075. binding.updateOneTimeBindings();
  14076. }
  14077. }
  14078. function indexOf(array, item, matcher, startIndex) {
  14079. if (!matcher) {
  14080. return array.indexOf(item);
  14081. }
  14082. var length = array.length;
  14083. for (var index = startIndex || 0; index < length; index++) {
  14084. if (matcher(array[index], item)) {
  14085. return index;
  14086. }
  14087. }
  14088. return -1;
  14089. }
  14090. });
  14091. define('aurelia-templating-resources/map-repeat-strategy',['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
  14092. 'use strict';
  14093. Object.defineProperty(exports, "__esModule", {
  14094. value: true
  14095. });
  14096. exports.MapRepeatStrategy = undefined;
  14097. var MapRepeatStrategy = exports.MapRepeatStrategy = function () {
  14098. function MapRepeatStrategy() {
  14099. }
  14100. MapRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
  14101. return observerLocator.getMapObserver(items);
  14102. };
  14103. MapRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
  14104. var _this = this;
  14105. var removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
  14106. if (removePromise instanceof Promise) {
  14107. removePromise.then(function () {
  14108. return _this._standardProcessItems(repeat, items);
  14109. });
  14110. return;
  14111. }
  14112. this._standardProcessItems(repeat, items);
  14113. };
  14114. MapRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, items) {
  14115. var index = 0;
  14116. var overrideContext = void 0;
  14117. items.forEach(function (value, key) {
  14118. overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, value, index, items.size, key);
  14119. repeat.addView(overrideContext.bindingContext, overrideContext);
  14120. ++index;
  14121. });
  14122. };
  14123. MapRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, map, records) {
  14124. var key = void 0;
  14125. var i = void 0;
  14126. var ii = void 0;
  14127. var overrideContext = void 0;
  14128. var removeIndex = void 0;
  14129. var record = void 0;
  14130. var rmPromises = [];
  14131. var viewOrPromise = void 0;
  14132. for (i = 0, ii = records.length; i < ii; ++i) {
  14133. record = records[i];
  14134. key = record.key;
  14135. switch (record.type) {
  14136. case 'update':
  14137. removeIndex = this._getViewIndexByKey(repeat, key);
  14138. viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);
  14139. if (viewOrPromise instanceof Promise) {
  14140. rmPromises.push(viewOrPromise);
  14141. }
  14142. overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, map.get(key), removeIndex, map.size, key);
  14143. repeat.insertView(removeIndex, overrideContext.bindingContext, overrideContext);
  14144. break;
  14145. case 'add':
  14146. overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, map.get(key), map.size - 1, map.size, key);
  14147. repeat.insertView(map.size - 1, overrideContext.bindingContext, overrideContext);
  14148. break;
  14149. case 'delete':
  14150. if (record.oldValue === undefined) {
  14151. return;
  14152. }
  14153. removeIndex = this._getViewIndexByKey(repeat, key);
  14154. viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);
  14155. if (viewOrPromise instanceof Promise) {
  14156. rmPromises.push(viewOrPromise);
  14157. }
  14158. break;
  14159. case 'clear':
  14160. repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
  14161. break;
  14162. default:
  14163. continue;
  14164. }
  14165. }
  14166. if (rmPromises.length > 0) {
  14167. Promise.all(rmPromises).then(function () {
  14168. (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
  14169. });
  14170. } else {
  14171. (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
  14172. }
  14173. };
  14174. MapRepeatStrategy.prototype._getViewIndexByKey = function _getViewIndexByKey(repeat, key) {
  14175. var i = void 0;
  14176. var ii = void 0;
  14177. var child = void 0;
  14178. for (i = 0, ii = repeat.viewCount(); i < ii; ++i) {
  14179. child = repeat.view(i);
  14180. if (child.bindingContext[repeat.key] === key) {
  14181. return i;
  14182. }
  14183. }
  14184. return undefined;
  14185. };
  14186. return MapRepeatStrategy;
  14187. }();
  14188. });
  14189. define('aurelia-templating-resources/set-repeat-strategy',['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
  14190. 'use strict';
  14191. Object.defineProperty(exports, "__esModule", {
  14192. value: true
  14193. });
  14194. exports.SetRepeatStrategy = undefined;
  14195. var SetRepeatStrategy = exports.SetRepeatStrategy = function () {
  14196. function SetRepeatStrategy() {
  14197. }
  14198. SetRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
  14199. return observerLocator.getSetObserver(items);
  14200. };
  14201. SetRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
  14202. var _this = this;
  14203. var removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
  14204. if (removePromise instanceof Promise) {
  14205. removePromise.then(function () {
  14206. return _this._standardProcessItems(repeat, items);
  14207. });
  14208. return;
  14209. }
  14210. this._standardProcessItems(repeat, items);
  14211. };
  14212. SetRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, items) {
  14213. var index = 0;
  14214. var overrideContext = void 0;
  14215. items.forEach(function (value) {
  14216. overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, value, index, items.size);
  14217. repeat.addView(overrideContext.bindingContext, overrideContext);
  14218. ++index;
  14219. });
  14220. };
  14221. SetRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, set, records) {
  14222. var value = void 0;
  14223. var i = void 0;
  14224. var ii = void 0;
  14225. var overrideContext = void 0;
  14226. var removeIndex = void 0;
  14227. var record = void 0;
  14228. var rmPromises = [];
  14229. var viewOrPromise = void 0;
  14230. for (i = 0, ii = records.length; i < ii; ++i) {
  14231. record = records[i];
  14232. value = record.value;
  14233. switch (record.type) {
  14234. case 'add':
  14235. overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, value, set.size - 1, set.size);
  14236. repeat.insertView(set.size - 1, overrideContext.bindingContext, overrideContext);
  14237. break;
  14238. case 'delete':
  14239. removeIndex = this._getViewIndexByValue(repeat, value);
  14240. viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);
  14241. if (viewOrPromise instanceof Promise) {
  14242. rmPromises.push(viewOrPromise);
  14243. }
  14244. break;
  14245. case 'clear':
  14246. repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
  14247. break;
  14248. default:
  14249. continue;
  14250. }
  14251. }
  14252. if (rmPromises.length > 0) {
  14253. Promise.all(rmPromises).then(function () {
  14254. (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
  14255. });
  14256. } else {
  14257. (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
  14258. }
  14259. };
  14260. SetRepeatStrategy.prototype._getViewIndexByValue = function _getViewIndexByValue(repeat, value) {
  14261. var i = void 0;
  14262. var ii = void 0;
  14263. var child = void 0;
  14264. for (i = 0, ii = repeat.viewCount(); i < ii; ++i) {
  14265. child = repeat.view(i);
  14266. if (child.bindingContext[repeat.local] === value) {
  14267. return i;
  14268. }
  14269. }
  14270. return undefined;
  14271. };
  14272. return SetRepeatStrategy;
  14273. }();
  14274. });
  14275. define('aurelia-templating-resources/number-repeat-strategy',['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
  14276. 'use strict';
  14277. Object.defineProperty(exports, "__esModule", {
  14278. value: true
  14279. });
  14280. exports.NumberRepeatStrategy = undefined;
  14281. var NumberRepeatStrategy = exports.NumberRepeatStrategy = function () {
  14282. function NumberRepeatStrategy() {
  14283. }
  14284. NumberRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver() {
  14285. return null;
  14286. };
  14287. NumberRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, value) {
  14288. var _this = this;
  14289. var removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);
  14290. if (removePromise instanceof Promise) {
  14291. removePromise.then(function () {
  14292. return _this._standardProcessItems(repeat, value);
  14293. });
  14294. return;
  14295. }
  14296. this._standardProcessItems(repeat, value);
  14297. };
  14298. NumberRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, value) {
  14299. var childrenLength = repeat.viewCount();
  14300. var i = void 0;
  14301. var ii = void 0;
  14302. var overrideContext = void 0;
  14303. var viewsToRemove = void 0;
  14304. value = Math.floor(value);
  14305. viewsToRemove = childrenLength - value;
  14306. if (viewsToRemove > 0) {
  14307. if (viewsToRemove > childrenLength) {
  14308. viewsToRemove = childrenLength;
  14309. }
  14310. for (i = 0, ii = viewsToRemove; i < ii; ++i) {
  14311. repeat.removeView(childrenLength - (i + 1), true, !repeat.viewsRequireLifecycle);
  14312. }
  14313. return;
  14314. }
  14315. for (i = childrenLength, ii = value; i < ii; ++i) {
  14316. overrideContext = (0, _repeatUtilities.createFullOverrideContext)(repeat, i, i, ii);
  14317. repeat.addView(overrideContext.bindingContext, overrideContext);
  14318. }
  14319. (0, _repeatUtilities.updateOverrideContexts)(repeat.views(), 0);
  14320. };
  14321. return NumberRepeatStrategy;
  14322. }();
  14323. });
  14324. define('aurelia-templating-resources/analyze-view-factory',['exports'], function (exports) {
  14325. 'use strict';
  14326. Object.defineProperty(exports, "__esModule", {
  14327. value: true
  14328. });
  14329. exports.viewsRequireLifecycle = viewsRequireLifecycle;
  14330. var lifecycleOptionalBehaviors = exports.lifecycleOptionalBehaviors = ['focus', 'if', 'repeat', 'show', 'with'];
  14331. function behaviorRequiresLifecycle(instruction) {
  14332. var t = instruction.type;
  14333. var name = t.elementName !== null ? t.elementName : t.attributeName;
  14334. 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);
  14335. }
  14336. function targetRequiresLifecycle(instruction) {
  14337. var behaviors = instruction.behaviorInstructions;
  14338. if (behaviors) {
  14339. var i = behaviors.length;
  14340. while (i--) {
  14341. if (behaviorRequiresLifecycle(behaviors[i])) {
  14342. return true;
  14343. }
  14344. }
  14345. }
  14346. return instruction.viewFactory && viewsRequireLifecycle(instruction.viewFactory);
  14347. }
  14348. function viewsRequireLifecycle(viewFactory) {
  14349. if ('_viewsRequireLifecycle' in viewFactory) {
  14350. return viewFactory._viewsRequireLifecycle;
  14351. }
  14352. viewFactory._viewsRequireLifecycle = false;
  14353. if (viewFactory.viewFactory) {
  14354. viewFactory._viewsRequireLifecycle = viewsRequireLifecycle(viewFactory.viewFactory);
  14355. return viewFactory._viewsRequireLifecycle;
  14356. }
  14357. if (viewFactory.template.querySelector('.au-animate')) {
  14358. viewFactory._viewsRequireLifecycle = true;
  14359. return true;
  14360. }
  14361. for (var id in viewFactory.instructions) {
  14362. if (targetRequiresLifecycle(viewFactory.instructions[id])) {
  14363. viewFactory._viewsRequireLifecycle = true;
  14364. return true;
  14365. }
  14366. }
  14367. viewFactory._viewsRequireLifecycle = false;
  14368. return false;
  14369. }
  14370. });
  14371. define('aurelia-templating-resources/abstract-repeater',['exports'], function (exports) {
  14372. 'use strict';
  14373. Object.defineProperty(exports, "__esModule", {
  14374. value: true
  14375. });
  14376. var AbstractRepeater = exports.AbstractRepeater = function () {
  14377. function AbstractRepeater(options) {
  14378. Object.assign(this, {
  14379. local: 'items',
  14380. viewsRequireLifecycle: true
  14381. }, options);
  14382. }
  14383. AbstractRepeater.prototype.viewCount = function viewCount() {
  14384. throw new Error('subclass must implement `viewCount`');
  14385. };
  14386. AbstractRepeater.prototype.views = function views() {
  14387. throw new Error('subclass must implement `views`');
  14388. };
  14389. AbstractRepeater.prototype.view = function view(index) {
  14390. throw new Error('subclass must implement `view`');
  14391. };
  14392. AbstractRepeater.prototype.matcher = function matcher() {
  14393. throw new Error('subclass must implement `matcher`');
  14394. };
  14395. AbstractRepeater.prototype.addView = function addView(bindingContext, overrideContext) {
  14396. throw new Error('subclass must implement `addView`');
  14397. };
  14398. AbstractRepeater.prototype.insertView = function insertView(index, bindingContext, overrideContext) {
  14399. throw new Error('subclass must implement `insertView`');
  14400. };
  14401. AbstractRepeater.prototype.moveView = function moveView(sourceIndex, targetIndex) {
  14402. throw new Error('subclass must implement `moveView`');
  14403. };
  14404. AbstractRepeater.prototype.removeAllViews = function removeAllViews(returnToCache, skipAnimation) {
  14405. throw new Error('subclass must implement `removeAllViews`');
  14406. };
  14407. AbstractRepeater.prototype.removeViews = function removeViews(viewsToRemove, returnToCache, skipAnimation) {
  14408. throw new Error('subclass must implement `removeView`');
  14409. };
  14410. AbstractRepeater.prototype.removeView = function removeView(index, returnToCache, skipAnimation) {
  14411. throw new Error('subclass must implement `removeView`');
  14412. };
  14413. AbstractRepeater.prototype.updateBindings = function updateBindings(view) {
  14414. throw new Error('subclass must implement `updateBindings`');
  14415. };
  14416. return AbstractRepeater;
  14417. }();
  14418. });
  14419. define('aurelia-templating-resources/show',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-pal', './aurelia-hide-style'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaPal, _aureliaHideStyle) {
  14420. 'use strict';
  14421. Object.defineProperty(exports, "__esModule", {
  14422. value: true
  14423. });
  14424. exports.Show = undefined;
  14425. var _dec, _dec2, _class;
  14426. 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 () {
  14427. function Show(element, animator, domBoundary) {
  14428. this.element = element;
  14429. this.animator = animator;
  14430. this.domBoundary = domBoundary;
  14431. }
  14432. Show.prototype.created = function created() {
  14433. (0, _aureliaHideStyle.injectAureliaHideStyleAtBoundary)(this.domBoundary);
  14434. };
  14435. Show.prototype.valueChanged = function valueChanged(newValue) {
  14436. if (newValue) {
  14437. this.animator.removeClass(this.element, _aureliaHideStyle.aureliaHideClassName);
  14438. } else {
  14439. this.animator.addClass(this.element, _aureliaHideStyle.aureliaHideClassName);
  14440. }
  14441. };
  14442. Show.prototype.bind = function bind(bindingContext) {
  14443. this.valueChanged(this.value);
  14444. };
  14445. return Show;
  14446. }()) || _class) || _class);
  14447. });
  14448. define('aurelia-templating-resources/aurelia-hide-style',['exports', 'aurelia-pal'], function (exports, _aureliaPal) {
  14449. 'use strict';
  14450. Object.defineProperty(exports, "__esModule", {
  14451. value: true
  14452. });
  14453. exports.aureliaHideClassName = undefined;
  14454. exports.injectAureliaHideStyleAtHead = injectAureliaHideStyleAtHead;
  14455. exports.injectAureliaHideStyleAtBoundary = injectAureliaHideStyleAtBoundary;
  14456. var aureliaHideClassName = exports.aureliaHideClassName = 'aurelia-hide';
  14457. var aureliaHideClass = '.' + aureliaHideClassName + ' { display:none !important; }';
  14458. function injectAureliaHideStyleAtHead() {
  14459. _aureliaPal.DOM.injectStyles(aureliaHideClass);
  14460. }
  14461. function injectAureliaHideStyleAtBoundary(domBoundary) {
  14462. if (_aureliaPal.FEATURE.shadowDOM && domBoundary && !domBoundary.hasAureliaHideStyle) {
  14463. domBoundary.hasAureliaHideStyle = true;
  14464. _aureliaPal.DOM.injectStyles(aureliaHideClass, domBoundary);
  14465. }
  14466. }
  14467. });
  14468. define('aurelia-templating-resources/hide',['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-pal', './aurelia-hide-style'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaPal, _aureliaHideStyle) {
  14469. 'use strict';
  14470. Object.defineProperty(exports, "__esModule", {
  14471. value: true
  14472. });
  14473. exports.Hide = undefined;
  14474. var _dec, _dec2, _class;
  14475. 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 () {
  14476. function Hide(element, animator, domBoundary) {
  14477. this.element = element;
  14478. this.animator = animator;
  14479. this.domBoundary = domBoundary;
  14480. }
  14481. Hide.prototype.created = function created() {
  14482. (0, _aureliaHideStyle.injectAureliaHideStyleAtBoundary)(this.domBoundary);
  14483. };
  14484. Hide.prototype.valueChanged = function valueChanged(newValue) {
  14485. if (newValue) {
  14486. this.animator.addClass(this.element, _aureliaHideStyle.aureliaHideClassName);
  14487. } else {
  14488. this.animator.removeClass(this.element, _aureliaHideStyle.aureliaHideClassName);
  14489. }
  14490. };
  14491. Hide.prototype.bind = function bind(bindingContext) {
  14492. this.valueChanged(this.value);
  14493. };
  14494. return Hide;
  14495. }()) || _class) || _class);
  14496. });
  14497. define('aurelia-templating-resources/sanitize-html',['exports', 'aurelia-binding', 'aurelia-dependency-injection', './html-sanitizer'], function (exports, _aureliaBinding, _aureliaDependencyInjection, _htmlSanitizer) {
  14498. 'use strict';
  14499. Object.defineProperty(exports, "__esModule", {
  14500. value: true
  14501. });
  14502. exports.SanitizeHTMLValueConverter = undefined;
  14503. var _dec, _dec2, _class;
  14504. var SanitizeHTMLValueConverter = exports.SanitizeHTMLValueConverter = (_dec = (0, _aureliaBinding.valueConverter)('sanitizeHTML'), _dec2 = (0, _aureliaDependencyInjection.inject)(_htmlSanitizer.HTMLSanitizer), _dec(_class = _dec2(_class = function () {
  14505. function SanitizeHTMLValueConverter(sanitizer) {
  14506. this.sanitizer = sanitizer;
  14507. }
  14508. SanitizeHTMLValueConverter.prototype.toView = function toView(untrustedMarkup) {
  14509. if (untrustedMarkup === null || untrustedMarkup === undefined) {
  14510. return null;
  14511. }
  14512. return this.sanitizer.sanitize(untrustedMarkup);
  14513. };
  14514. return SanitizeHTMLValueConverter;
  14515. }()) || _class) || _class);
  14516. });
  14517. define('aurelia-templating-resources/html-sanitizer',['exports'], function (exports) {
  14518. 'use strict';
  14519. Object.defineProperty(exports, "__esModule", {
  14520. value: true
  14521. });
  14522. var SCRIPT_REGEX = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
  14523. var HTMLSanitizer = exports.HTMLSanitizer = function () {
  14524. function HTMLSanitizer() {
  14525. }
  14526. HTMLSanitizer.prototype.sanitize = function sanitize(input) {
  14527. return input.replace(SCRIPT_REGEX, '');
  14528. };
  14529. return HTMLSanitizer;
  14530. }();
  14531. });
  14532. define('aurelia-templating-resources/replaceable',['exports', 'aurelia-dependency-injection', 'aurelia-templating'], function (exports, _aureliaDependencyInjection, _aureliaTemplating) {
  14533. 'use strict';
  14534. Object.defineProperty(exports, "__esModule", {
  14535. value: true
  14536. });
  14537. exports.Replaceable = undefined;
  14538. var _dec, _dec2, _class;
  14539. 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 () {
  14540. function Replaceable(viewFactory, viewSlot) {
  14541. this.viewFactory = viewFactory;
  14542. this.viewSlot = viewSlot;
  14543. this.view = null;
  14544. }
  14545. Replaceable.prototype.bind = function bind(bindingContext, overrideContext) {
  14546. if (this.view === null) {
  14547. this.view = this.viewFactory.create();
  14548. this.viewSlot.add(this.view);
  14549. }
  14550. this.view.bind(bindingContext, overrideContext);
  14551. };
  14552. Replaceable.prototype.unbind = function unbind() {
  14553. this.view.unbind();
  14554. };
  14555. return Replaceable;
  14556. }()) || _class) || _class) || _class);
  14557. });
  14558. 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) {
  14559. 'use strict';
  14560. Object.defineProperty(exports, "__esModule", {
  14561. value: true
  14562. });
  14563. exports.Focus = undefined;
  14564. var _dec, _dec2, _class;
  14565. 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 () {
  14566. function Focus(element, taskQueue) {
  14567. var _this = this;
  14568. this.element = element;
  14569. this.taskQueue = taskQueue;
  14570. this.isAttached = false;
  14571. this.needsApply = false;
  14572. this.focusListener = function (e) {
  14573. _this.value = true;
  14574. };
  14575. this.blurListener = function (e) {
  14576. if (_aureliaPal.DOM.activeElement !== _this.element) {
  14577. _this.value = false;
  14578. }
  14579. };
  14580. }
  14581. Focus.prototype.valueChanged = function valueChanged(newValue) {
  14582. if (this.isAttached) {
  14583. this._apply();
  14584. } else {
  14585. this.needsApply = true;
  14586. }
  14587. };
  14588. Focus.prototype._apply = function _apply() {
  14589. var _this2 = this;
  14590. if (this.value) {
  14591. this.taskQueue.queueMicroTask(function () {
  14592. if (_this2.value) {
  14593. _this2.element.focus();
  14594. }
  14595. });
  14596. } else {
  14597. this.element.blur();
  14598. }
  14599. };
  14600. Focus.prototype.attached = function attached() {
  14601. this.isAttached = true;
  14602. if (this.needsApply) {
  14603. this.needsApply = false;
  14604. this._apply();
  14605. }
  14606. this.element.addEventListener('focus', this.focusListener);
  14607. this.element.addEventListener('blur', this.blurListener);
  14608. };
  14609. Focus.prototype.detached = function detached() {
  14610. this.isAttached = false;
  14611. this.element.removeEventListener('focus', this.focusListener);
  14612. this.element.removeEventListener('blur', this.blurListener);
  14613. };
  14614. return Focus;
  14615. }()) || _class) || _class);
  14616. });
  14617. 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) {
  14618. 'use strict';
  14619. Object.defineProperty(exports, "__esModule", {
  14620. value: true
  14621. });
  14622. exports._createCSSResource = _createCSSResource;
  14623. function _possibleConstructorReturn(self, call) {
  14624. if (!self) {
  14625. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  14626. }
  14627. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  14628. }
  14629. function _inherits(subClass, superClass) {
  14630. if (typeof superClass !== "function" && superClass !== null) {
  14631. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  14632. }
  14633. subClass.prototype = Object.create(superClass && superClass.prototype, {
  14634. constructor: {
  14635. value: subClass,
  14636. enumerable: false,
  14637. writable: true,
  14638. configurable: true
  14639. }
  14640. });
  14641. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  14642. }
  14643. var cssUrlMatcher = /url\((?!['"]data)([^)]+)\)/gi;
  14644. function fixupCSSUrls(address, css) {
  14645. if (typeof css !== 'string') {
  14646. throw new Error('Failed loading required CSS file: ' + address);
  14647. }
  14648. return css.replace(cssUrlMatcher, function (match, p1) {
  14649. var quote = p1.charAt(0);
  14650. if (quote === '\'' || quote === '"') {
  14651. p1 = p1.substr(1, p1.length - 2);
  14652. }
  14653. return 'url(\'' + (0, _aureliaPath.relativeToFile)(p1, address) + '\')';
  14654. });
  14655. }
  14656. var CSSResource = function () {
  14657. function CSSResource(address) {
  14658. this.address = address;
  14659. this._scoped = null;
  14660. this._global = false;
  14661. this._alreadyGloballyInjected = false;
  14662. }
  14663. CSSResource.prototype.initialize = function initialize(container, target) {
  14664. this._scoped = new target(this);
  14665. };
  14666. CSSResource.prototype.register = function register(registry, name) {
  14667. if (name === 'scoped') {
  14668. registry.registerViewEngineHooks(this._scoped);
  14669. } else {
  14670. this._global = true;
  14671. }
  14672. };
  14673. CSSResource.prototype.load = function load(container) {
  14674. var _this = this;
  14675. return container.get(_aureliaLoader.Loader).loadText(this.address).catch(function (err) {
  14676. return null;
  14677. }).then(function (text) {
  14678. text = fixupCSSUrls(_this.address, text);
  14679. _this._scoped.css = text;
  14680. if (_this._global) {
  14681. _this._alreadyGloballyInjected = true;
  14682. _aureliaPal.DOM.injectStyles(text);
  14683. }
  14684. });
  14685. };
  14686. return CSSResource;
  14687. }();
  14688. var CSSViewEngineHooks = function () {
  14689. function CSSViewEngineHooks(owner) {
  14690. this.owner = owner;
  14691. this.css = null;
  14692. }
  14693. CSSViewEngineHooks.prototype.beforeCompile = function beforeCompile(content, resources, instruction) {
  14694. if (instruction.targetShadowDOM) {
  14695. _aureliaPal.DOM.injectStyles(this.css, content, true);
  14696. } else if (_aureliaPal.FEATURE.scopedCSS) {
  14697. var styleNode = _aureliaPal.DOM.injectStyles(this.css, content, true);
  14698. styleNode.setAttribute('scoped', 'scoped');
  14699. } else if (!this.owner._alreadyGloballyInjected) {
  14700. _aureliaPal.DOM.injectStyles(this.css);
  14701. this.owner._alreadyGloballyInjected = true;
  14702. }
  14703. };
  14704. return CSSViewEngineHooks;
  14705. }();
  14706. function _createCSSResource(address) {
  14707. var _dec, _class;
  14708. var ViewCSS = (_dec = (0, _aureliaTemplating.resource)(new CSSResource(address)), _dec(_class = function (_CSSViewEngineHooks) {
  14709. _inherits(ViewCSS, _CSSViewEngineHooks);
  14710. function ViewCSS() {
  14711. return _possibleConstructorReturn(this, _CSSViewEngineHooks.apply(this, arguments));
  14712. }
  14713. return ViewCSS;
  14714. }(CSSViewEngineHooks)) || _class);
  14715. return ViewCSS;
  14716. }
  14717. });
  14718. define('aurelia-templating-resources/binding-mode-behaviors',['exports', 'aurelia-binding', 'aurelia-metadata'], function (exports, _aureliaBinding, _aureliaMetadata) {
  14719. 'use strict';
  14720. Object.defineProperty(exports, "__esModule", {
  14721. value: true
  14722. });
  14723. exports.TwoWayBindingBehavior = exports.OneWayBindingBehavior = exports.OneTimeBindingBehavior = undefined;
  14724. var _dec, _class, _dec2, _class2, _dec3, _class3;
  14725. var modeBindingBehavior = {
  14726. bind: function bind(binding, source, lookupFunctions) {
  14727. binding.originalMode = binding.mode;
  14728. binding.mode = this.mode;
  14729. },
  14730. unbind: function unbind(binding, source) {
  14731. binding.mode = binding.originalMode;
  14732. binding.originalMode = null;
  14733. }
  14734. };
  14735. var OneTimeBindingBehavior = exports.OneTimeBindingBehavior = (_dec = (0, _aureliaMetadata.mixin)(modeBindingBehavior), _dec(_class = function OneTimeBindingBehavior() {
  14736. this.mode = _aureliaBinding.bindingMode.oneTime;
  14737. }) || _class);
  14738. var OneWayBindingBehavior = exports.OneWayBindingBehavior = (_dec2 = (0, _aureliaMetadata.mixin)(modeBindingBehavior), _dec2(_class2 = function OneWayBindingBehavior() {
  14739. this.mode = _aureliaBinding.bindingMode.oneWay;
  14740. }) || _class2);
  14741. var TwoWayBindingBehavior = exports.TwoWayBindingBehavior = (_dec3 = (0, _aureliaMetadata.mixin)(modeBindingBehavior), _dec3(_class3 = function TwoWayBindingBehavior() {
  14742. this.mode = _aureliaBinding.bindingMode.twoWay;
  14743. }) || _class3);
  14744. });
  14745. define('aurelia-templating-resources/throttle-binding-behavior',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
  14746. 'use strict';
  14747. Object.defineProperty(exports, "__esModule", {
  14748. value: true
  14749. });
  14750. exports.ThrottleBindingBehavior = undefined;
  14751. function throttle(newValue) {
  14752. var _this = this;
  14753. var state = this.throttleState;
  14754. var elapsed = +new Date() - state.last;
  14755. if (elapsed >= state.delay) {
  14756. clearTimeout(state.timeoutId);
  14757. state.timeoutId = null;
  14758. state.last = +new Date();
  14759. this.throttledMethod(newValue);
  14760. return;
  14761. }
  14762. state.newValue = newValue;
  14763. if (state.timeoutId === null) {
  14764. state.timeoutId = setTimeout(function () {
  14765. state.timeoutId = null;
  14766. state.last = +new Date();
  14767. _this.throttledMethod(state.newValue);
  14768. }, state.delay - elapsed);
  14769. }
  14770. }
  14771. var ThrottleBindingBehavior = exports.ThrottleBindingBehavior = function () {
  14772. function ThrottleBindingBehavior() {
  14773. }
  14774. ThrottleBindingBehavior.prototype.bind = function bind(binding, source) {
  14775. var delay = arguments.length <= 2 || arguments[2] === undefined ? 200 : arguments[2];
  14776. var methodToThrottle = 'updateTarget';
  14777. if (binding.callSource) {
  14778. methodToThrottle = 'callSource';
  14779. } else if (binding.updateSource && binding.mode === _aureliaBinding.bindingMode.twoWay) {
  14780. methodToThrottle = 'updateSource';
  14781. }
  14782. binding.throttledMethod = binding[methodToThrottle];
  14783. binding.throttledMethod.originalName = methodToThrottle;
  14784. binding[methodToThrottle] = throttle;
  14785. binding.throttleState = {
  14786. delay: delay,
  14787. last: 0,
  14788. timeoutId: null
  14789. };
  14790. };
  14791. ThrottleBindingBehavior.prototype.unbind = function unbind(binding, source) {
  14792. var methodToRestore = binding.throttledMethod.originalName;
  14793. binding[methodToRestore] = binding.throttledMethod;
  14794. binding.throttledMethod = null;
  14795. clearTimeout(binding.throttleState.timeoutId);
  14796. binding.throttleState = null;
  14797. };
  14798. return ThrottleBindingBehavior;
  14799. }();
  14800. });
  14801. define('aurelia-templating-resources/debounce-binding-behavior',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
  14802. 'use strict';
  14803. Object.defineProperty(exports, "__esModule", {
  14804. value: true
  14805. });
  14806. exports.DebounceBindingBehavior = undefined;
  14807. function debounce(newValue) {
  14808. var _this = this;
  14809. var state = this.debounceState;
  14810. if (state.immediate) {
  14811. state.immediate = false;
  14812. this.debouncedMethod(newValue);
  14813. return;
  14814. }
  14815. clearTimeout(state.timeoutId);
  14816. state.timeoutId = setTimeout(function () {
  14817. return _this.debouncedMethod(newValue);
  14818. }, state.delay);
  14819. }
  14820. var DebounceBindingBehavior = exports.DebounceBindingBehavior = function () {
  14821. function DebounceBindingBehavior() {
  14822. }
  14823. DebounceBindingBehavior.prototype.bind = function bind(binding, source) {
  14824. var delay = arguments.length <= 2 || arguments[2] === undefined ? 200 : arguments[2];
  14825. var methodToDebounce = 'updateTarget';
  14826. if (binding.callSource) {
  14827. methodToDebounce = 'callSource';
  14828. } else if (binding.updateSource && binding.mode === _aureliaBinding.bindingMode.twoWay) {
  14829. methodToDebounce = 'updateSource';
  14830. }
  14831. binding.debouncedMethod = binding[methodToDebounce];
  14832. binding.debouncedMethod.originalName = methodToDebounce;
  14833. binding[methodToDebounce] = debounce;
  14834. binding.debounceState = {
  14835. delay: delay,
  14836. timeoutId: null,
  14837. immediate: methodToDebounce === 'updateTarget' };
  14838. };
  14839. DebounceBindingBehavior.prototype.unbind = function unbind(binding, source) {
  14840. var methodToRestore = binding.debouncedMethod.originalName;
  14841. binding[methodToRestore] = binding.debouncedMethod;
  14842. binding.debouncedMethod = null;
  14843. clearTimeout(binding.debounceState.timeoutId);
  14844. binding.debounceState = null;
  14845. };
  14846. return DebounceBindingBehavior;
  14847. }();
  14848. });
  14849. define('aurelia-templating-resources/signal-binding-behavior',['exports', './binding-signaler'], function (exports, _bindingSignaler) {
  14850. 'use strict';
  14851. Object.defineProperty(exports, "__esModule", {
  14852. value: true
  14853. });
  14854. exports.SignalBindingBehavior = undefined;
  14855. var SignalBindingBehavior = exports.SignalBindingBehavior = function () {
  14856. SignalBindingBehavior.inject = function inject() {
  14857. return [_bindingSignaler.BindingSignaler];
  14858. };
  14859. function SignalBindingBehavior(bindingSignaler) {
  14860. this.signals = bindingSignaler.signals;
  14861. }
  14862. SignalBindingBehavior.prototype.bind = function bind(binding, source) {
  14863. if (!binding.updateTarget) {
  14864. throw new Error('Only property bindings and string interpolation bindings can be signaled. Trigger, delegate and call bindings cannot be signaled.');
  14865. }
  14866. if (arguments.length === 3) {
  14867. var name = arguments[2];
  14868. var bindings = this.signals[name] || (this.signals[name] = []);
  14869. bindings.push(binding);
  14870. binding.signalName = name;
  14871. } else if (arguments.length > 3) {
  14872. var names = Array.prototype.slice.call(arguments, 2);
  14873. var i = names.length;
  14874. while (i--) {
  14875. var _name = names[i];
  14876. var _bindings = this.signals[_name] || (this.signals[_name] = []);
  14877. _bindings.push(binding);
  14878. }
  14879. binding.signalName = names;
  14880. } else {
  14881. throw new Error('Signal name is required.');
  14882. }
  14883. };
  14884. SignalBindingBehavior.prototype.unbind = function unbind(binding, source) {
  14885. var name = binding.signalName;
  14886. binding.signalName = null;
  14887. if (Array.isArray(name)) {
  14888. var names = name;
  14889. var i = names.length;
  14890. while (i--) {
  14891. var n = names[i];
  14892. var bindings = this.signals[n];
  14893. bindings.splice(bindings.indexOf(binding), 1);
  14894. }
  14895. } else {
  14896. var _bindings2 = this.signals[name];
  14897. _bindings2.splice(_bindings2.indexOf(binding), 1);
  14898. }
  14899. };
  14900. return SignalBindingBehavior;
  14901. }();
  14902. });
  14903. define('aurelia-templating-resources/binding-signaler',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
  14904. 'use strict';
  14905. Object.defineProperty(exports, "__esModule", {
  14906. value: true
  14907. });
  14908. exports.BindingSignaler = undefined;
  14909. var BindingSignaler = exports.BindingSignaler = function () {
  14910. function BindingSignaler() {
  14911. this.signals = {};
  14912. }
  14913. BindingSignaler.prototype.signal = function signal(name) {
  14914. var bindings = this.signals[name];
  14915. if (!bindings) {
  14916. return;
  14917. }
  14918. var i = bindings.length;
  14919. while (i--) {
  14920. bindings[i].call(_aureliaBinding.sourceContext);
  14921. }
  14922. };
  14923. return BindingSignaler;
  14924. }();
  14925. });
  14926. define('aurelia-templating-resources/update-trigger-binding-behavior',['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
  14927. 'use strict';
  14928. Object.defineProperty(exports, "__esModule", {
  14929. value: true
  14930. });
  14931. exports.UpdateTriggerBindingBehavior = undefined;
  14932. var _class, _temp;
  14933. var eventNamesRequired = 'The updateTrigger binding behavior requires at least one event name argument: eg <input value.bind="firstName & updateTrigger:\'blur\'">';
  14934. var notApplicableMessage = 'The updateTrigger binding behavior can only be applied to two-way bindings on input/select elements.';
  14935. var UpdateTriggerBindingBehavior = exports.UpdateTriggerBindingBehavior = (_temp = _class = function () {
  14936. function UpdateTriggerBindingBehavior(eventManager) {
  14937. this.eventManager = eventManager;
  14938. }
  14939. UpdateTriggerBindingBehavior.prototype.bind = function bind(binding, source) {
  14940. for (var _len = arguments.length, events = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  14941. events[_key - 2] = arguments[_key];
  14942. }
  14943. if (events.length === 0) {
  14944. throw new Error(eventNamesRequired);
  14945. }
  14946. if (binding.mode !== _aureliaBinding.bindingMode.twoWay) {
  14947. throw new Error(notApplicableMessage);
  14948. }
  14949. var targetObserver = binding.observerLocator.getObserver(binding.target, binding.targetProperty);
  14950. if (!targetObserver.handler) {
  14951. throw new Error(notApplicableMessage);
  14952. }
  14953. binding.targetObserver = targetObserver;
  14954. targetObserver.originalHandler = binding.targetObserver.handler;
  14955. var handler = this.eventManager.createElementHandler(events);
  14956. targetObserver.handler = handler;
  14957. };
  14958. UpdateTriggerBindingBehavior.prototype.unbind = function unbind(binding, source) {
  14959. binding.targetObserver.handler = binding.targetObserver.originalHandler;
  14960. binding.targetObserver.originalHandler = null;
  14961. };
  14962. return UpdateTriggerBindingBehavior;
  14963. }(), _class.inject = [_aureliaBinding.EventManager], _temp);
  14964. });
  14965. define('aurelia-templating-resources/html-resource-plugin',['exports', 'aurelia-templating', './dynamic-element'], function (exports, _aureliaTemplating, _dynamicElement) {
  14966. 'use strict';
  14967. Object.defineProperty(exports, "__esModule", {
  14968. value: true
  14969. });
  14970. exports.getElementName = getElementName;
  14971. exports.configure = configure;
  14972. function getElementName(address) {
  14973. return (/([^\/^\?]+)\.html/i.exec(address)[1].toLowerCase()
  14974. );
  14975. }
  14976. function configure(config) {
  14977. var viewEngine = config.container.get(_aureliaTemplating.ViewEngine);
  14978. var loader = config.aurelia.loader;
  14979. viewEngine.addResourcePlugin('.html', {
  14980. 'fetch': function fetch(address) {
  14981. return loader.loadTemplate(address).then(function (registryEntry) {
  14982. var _ref;
  14983. var bindable = registryEntry.template.getAttribute('bindable');
  14984. var elementName = getElementName(address);
  14985. if (bindable) {
  14986. bindable = bindable.split(',').map(function (x) {
  14987. return x.trim();
  14988. });
  14989. registryEntry.template.removeAttribute('bindable');
  14990. } else {
  14991. bindable = [];
  14992. }
  14993. return _ref = {}, _ref[elementName] = (0, _dynamicElement._createDynamicElement)(elementName, address, bindable), _ref;
  14994. });
  14995. }
  14996. });
  14997. }
  14998. });
  14999. define('aurelia-templating-resources/dynamic-element',['exports', 'aurelia-templating'], function (exports, _aureliaTemplating) {
  15000. 'use strict';
  15001. Object.defineProperty(exports, "__esModule", {
  15002. value: true
  15003. });
  15004. exports._createDynamicElement = _createDynamicElement;
  15005. function _createDynamicElement(name, viewUrl, bindableNames) {
  15006. var _dec, _dec2, _class;
  15007. var DynamicElement = (_dec = (0, _aureliaTemplating.customElement)(name), _dec2 = (0, _aureliaTemplating.useView)(viewUrl), _dec(_class = _dec2(_class = function () {
  15008. function DynamicElement() {
  15009. }
  15010. DynamicElement.prototype.bind = function bind(bindingContext) {
  15011. this.$parent = bindingContext;
  15012. };
  15013. return DynamicElement;
  15014. }()) || _class) || _class);
  15015. for (var i = 0, ii = bindableNames.length; i < ii; ++i) {
  15016. (0, _aureliaTemplating.bindable)(bindableNames[i])(DynamicElement);
  15017. }
  15018. return DynamicElement;
  15019. }
  15020. });
  15021. define('aurelia-templating-router/aurelia-templating-router',['exports', 'aurelia-router', './route-loader', './router-view', './route-href'], function (exports, _aureliaRouter, _routeLoader, _routerView, _routeHref) {
  15022. 'use strict';
  15023. Object.defineProperty(exports, "__esModule", {
  15024. value: true
  15025. });
  15026. exports.configure = exports.RouteHref = exports.RouterView = exports.TemplatingRouteLoader = undefined;
  15027. function configure(config) {
  15028. config.singleton(_aureliaRouter.RouteLoader, _routeLoader.TemplatingRouteLoader).singleton(_aureliaRouter.Router, _aureliaRouter.AppRouter).globalResources('./router-view', './route-href');
  15029. config.container.registerAlias(_aureliaRouter.Router, _aureliaRouter.AppRouter);
  15030. }
  15031. exports.TemplatingRouteLoader = _routeLoader.TemplatingRouteLoader;
  15032. exports.RouterView = _routerView.RouterView;
  15033. exports.RouteHref = _routeHref.RouteHref;
  15034. exports.configure = configure;
  15035. });;define('aurelia-templating-router', ['aurelia-templating-router/aurelia-templating-router'], function (main) { return main; });
  15036. 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) {
  15037. 'use strict';
  15038. Object.defineProperty(exports, "__esModule", {
  15039. value: true
  15040. });
  15041. exports.TemplatingRouteLoader = undefined;
  15042. function _possibleConstructorReturn(self, call) {
  15043. if (!self) {
  15044. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  15045. }
  15046. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  15047. }
  15048. function _inherits(subClass, superClass) {
  15049. if (typeof superClass !== "function" && superClass !== null) {
  15050. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  15051. }
  15052. subClass.prototype = Object.create(superClass && superClass.prototype, {
  15053. constructor: {
  15054. value: subClass,
  15055. enumerable: false,
  15056. writable: true,
  15057. configurable: true
  15058. }
  15059. });
  15060. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  15061. }
  15062. var _dec, _class;
  15063. var TemplatingRouteLoader = exports.TemplatingRouteLoader = (_dec = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.CompositionEngine), _dec(_class = function (_RouteLoader) {
  15064. _inherits(TemplatingRouteLoader, _RouteLoader);
  15065. function TemplatingRouteLoader(compositionEngine) {
  15066. var _this = _possibleConstructorReturn(this, _RouteLoader.call(this));
  15067. _this.compositionEngine = compositionEngine;
  15068. return _this;
  15069. }
  15070. TemplatingRouteLoader.prototype.loadRoute = function loadRoute(router, config) {
  15071. var childContainer = router.container.createChild();
  15072. var instruction = {
  15073. viewModel: (0, _aureliaPath.relativeToFile)(config.moduleId, _aureliaMetadata.Origin.get(router.container.viewModel.constructor).moduleId),
  15074. childContainer: childContainer,
  15075. view: config.view || config.viewStrategy,
  15076. router: router
  15077. };
  15078. childContainer.getChildRouter = function () {
  15079. var childRouter = void 0;
  15080. childContainer.registerHandler(_aureliaRouter.Router, function (c) {
  15081. return childRouter || (childRouter = router.createChild(childContainer));
  15082. });
  15083. return childContainer.get(_aureliaRouter.Router);
  15084. };
  15085. return this.compositionEngine.ensureViewModel(instruction);
  15086. };
  15087. return TemplatingRouteLoader;
  15088. }(_aureliaRouter.RouteLoader)) || _class);
  15089. });
  15090. 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) {
  15091. 'use strict';
  15092. Object.defineProperty(exports, "__esModule", {
  15093. value: true
  15094. });
  15095. exports.RouterView = undefined;
  15096. function _initDefineProp(target, property, descriptor, context) {
  15097. if (!descriptor) return;
  15098. Object.defineProperty(target, property, {
  15099. enumerable: descriptor.enumerable,
  15100. configurable: descriptor.configurable,
  15101. writable: descriptor.writable,
  15102. value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
  15103. });
  15104. }
  15105. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
  15106. var desc = {};
  15107. Object['ke' + 'ys'](descriptor).forEach(function (key) {
  15108. desc[key] = descriptor[key];
  15109. });
  15110. desc.enumerable = !!desc.enumerable;
  15111. desc.configurable = !!desc.configurable;
  15112. if ('value' in desc || desc.initializer) {
  15113. desc.writable = true;
  15114. }
  15115. desc = decorators.slice().reverse().reduce(function (desc, decorator) {
  15116. return decorator(target, property, desc) || desc;
  15117. }, desc);
  15118. if (context && desc.initializer !== void 0) {
  15119. desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
  15120. desc.initializer = undefined;
  15121. }
  15122. if (desc.initializer === void 0) {
  15123. Object['define' + 'Property'](target, property, desc);
  15124. desc = null;
  15125. }
  15126. return desc;
  15127. }
  15128. function _initializerWarningHelper(descriptor, context) {
  15129. throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
  15130. }
  15131. var _dec, _dec2, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
  15132. var SwapStrategies = function () {
  15133. function SwapStrategies() {
  15134. }
  15135. SwapStrategies.prototype.before = function before(viewSlot, previousView, callback) {
  15136. var promise = Promise.resolve(callback());
  15137. if (previousView !== undefined) {
  15138. return promise.then(function () {
  15139. return viewSlot.remove(previousView, true);
  15140. });
  15141. }
  15142. return promise;
  15143. };
  15144. SwapStrategies.prototype.with = function _with(viewSlot, previousView, callback) {
  15145. var promise = Promise.resolve(callback());
  15146. if (previousView !== undefined) {
  15147. return Promise.all([viewSlot.remove(previousView, true), promise]);
  15148. }
  15149. return promise;
  15150. };
  15151. SwapStrategies.prototype.after = function after(viewSlot, previousView, callback) {
  15152. return Promise.resolve(viewSlot.removeAll(true)).then(callback);
  15153. };
  15154. return SwapStrategies;
  15155. }();
  15156. var swapStrategies = new SwapStrategies();
  15157. 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 () {
  15158. function RouterView(element, container, viewSlot, router, viewLocator, compositionTransaction, compositionEngine) {
  15159. _initDefineProp(this, 'swapOrder', _descriptor, this);
  15160. _initDefineProp(this, 'layoutView', _descriptor2, this);
  15161. _initDefineProp(this, 'layoutViewModel', _descriptor3, this);
  15162. _initDefineProp(this, 'layoutModel', _descriptor4, this);
  15163. this.element = element;
  15164. this.container = container;
  15165. this.viewSlot = viewSlot;
  15166. this.router = router;
  15167. this.viewLocator = viewLocator;
  15168. this.compositionTransaction = compositionTransaction;
  15169. this.compositionEngine = compositionEngine;
  15170. this.router.registerViewPort(this, this.element.getAttribute('name'));
  15171. if (!('initialComposition' in compositionTransaction)) {
  15172. compositionTransaction.initialComposition = true;
  15173. this.compositionTransactionNotifier = compositionTransaction.enlist();
  15174. }
  15175. }
  15176. RouterView.prototype.created = function created(owningView) {
  15177. this.owningView = owningView;
  15178. };
  15179. RouterView.prototype.bind = function bind(bindingContext, overrideContext) {
  15180. this.container.viewModel = bindingContext;
  15181. this.overrideContext = overrideContext;
  15182. };
  15183. RouterView.prototype.process = function process(viewPortInstruction, waitToSwap) {
  15184. var _this = this;
  15185. var component = viewPortInstruction.component;
  15186. var childContainer = component.childContainer;
  15187. var viewModel = component.viewModel;
  15188. var viewModelResource = component.viewModelResource;
  15189. var metadata = viewModelResource.metadata;
  15190. var config = component.router.currentInstruction.config;
  15191. var viewPort = config.viewPorts ? config.viewPorts[viewPortInstruction.name] : {};
  15192. var layoutInstruction = {
  15193. viewModel: viewPort.layoutViewModel || config.layoutViewModel || this.layoutViewModel,
  15194. view: viewPort.layoutView || config.layoutView || this.layoutView,
  15195. model: viewPort.layoutModel || config.layoutModel || this.layoutModel,
  15196. router: viewPortInstruction.component.router,
  15197. childContainer: childContainer,
  15198. viewSlot: this.viewSlot
  15199. };
  15200. var viewStrategy = this.viewLocator.getViewStrategy(component.view || viewModel);
  15201. if (viewStrategy && component.view) {
  15202. viewStrategy.makeRelativeTo(_aureliaMetadata.Origin.get(component.router.container.viewModel.constructor).moduleId);
  15203. }
  15204. return metadata.load(childContainer, viewModelResource.value, null, viewStrategy, true).then(function (viewFactory) {
  15205. if (!_this.compositionTransactionNotifier) {
  15206. _this.compositionTransactionOwnershipToken = _this.compositionTransaction.tryCapture();
  15207. }
  15208. if (layoutInstruction.viewModel || layoutInstruction.view) {
  15209. viewPortInstruction.layoutInstruction = layoutInstruction;
  15210. }
  15211. viewPortInstruction.controller = metadata.create(childContainer, _aureliaTemplating.BehaviorInstruction.dynamic(_this.element, viewModel, viewFactory));
  15212. if (waitToSwap) {
  15213. return;
  15214. }
  15215. _this.swap(viewPortInstruction);
  15216. });
  15217. };
  15218. RouterView.prototype.swap = function swap(viewPortInstruction) {
  15219. var _this2 = this;
  15220. var work = function work() {
  15221. var previousView = _this2.view;
  15222. var swapStrategy = void 0;
  15223. var viewSlot = _this2.viewSlot;
  15224. var layoutInstruction = viewPortInstruction.layoutInstruction;
  15225. swapStrategy = _this2.swapOrder in swapStrategies ? swapStrategies[_this2.swapOrder] : swapStrategies.after;
  15226. swapStrategy(viewSlot, previousView, function () {
  15227. var waitForView = void 0;
  15228. if (layoutInstruction) {
  15229. if (!layoutInstruction.viewModel) {
  15230. layoutInstruction.viewModel = {};
  15231. }
  15232. waitForView = _this2.compositionEngine.createController(layoutInstruction).then(function (layout) {
  15233. _aureliaTemplating.ShadowDOM.distributeView(viewPortInstruction.controller.view, layout.slots || layout.view.slots);
  15234. return layout.view || layout;
  15235. });
  15236. } else {
  15237. waitForView = Promise.resolve(viewPortInstruction.controller.view);
  15238. }
  15239. return waitForView.then(function (newView) {
  15240. _this2.view = newView;
  15241. return viewSlot.add(newView);
  15242. }).then(function () {
  15243. _this2._notify();
  15244. });
  15245. });
  15246. };
  15247. viewPortInstruction.controller.automate(this.overrideContext, this.owningView);
  15248. if (this.compositionTransactionOwnershipToken) {
  15249. return this.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () {
  15250. _this2.compositionTransactionOwnershipToken = null;
  15251. return work();
  15252. });
  15253. }
  15254. return work();
  15255. };
  15256. RouterView.prototype._notify = function _notify() {
  15257. if (this.compositionTransactionNotifier) {
  15258. this.compositionTransactionNotifier.done();
  15259. this.compositionTransactionNotifier = null;
  15260. }
  15261. };
  15262. return RouterView;
  15263. }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'swapOrder', [_aureliaTemplating.bindable], {
  15264. enumerable: true,
  15265. initializer: null
  15266. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'layoutView', [_aureliaTemplating.bindable], {
  15267. enumerable: true,
  15268. initializer: null
  15269. }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'layoutViewModel', [_aureliaTemplating.bindable], {
  15270. enumerable: true,
  15271. initializer: null
  15272. }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'layoutModel', [_aureliaTemplating.bindable], {
  15273. enumerable: true,
  15274. initializer: null
  15275. })), _class2)) || _class) || _class) || _class);
  15276. });
  15277. 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) {
  15278. 'use strict';
  15279. Object.defineProperty(exports, "__esModule", {
  15280. value: true
  15281. });
  15282. exports.RouteHref = undefined;
  15283. var LogManager = _interopRequireWildcard(_aureliaLogging);
  15284. function _interopRequireWildcard(obj) {
  15285. if (obj && obj.__esModule) {
  15286. return obj;
  15287. } else {
  15288. var newObj = {};
  15289. if (obj != null) {
  15290. for (var key in obj) {
  15291. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  15292. }
  15293. }
  15294. newObj.default = obj;
  15295. return newObj;
  15296. }
  15297. }
  15298. var _dec, _dec2, _dec3, _dec4, _dec5, _class;
  15299. var logger = LogManager.getLogger('route-href');
  15300. 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 () {
  15301. function RouteHref(router, element) {
  15302. this.router = router;
  15303. this.element = element;
  15304. }
  15305. RouteHref.prototype.bind = function bind() {
  15306. this.isActive = true;
  15307. this.processChange();
  15308. };
  15309. RouteHref.prototype.unbind = function unbind() {
  15310. this.isActive = false;
  15311. };
  15312. RouteHref.prototype.attributeChanged = function attributeChanged(value, previous) {
  15313. if (previous) {
  15314. this.element.removeAttribute(previous);
  15315. }
  15316. this.processChange();
  15317. };
  15318. RouteHref.prototype.processChange = function processChange() {
  15319. var _this = this;
  15320. return this.router.ensureConfigured().then(function () {
  15321. if (!_this.isActive) {
  15322. return null;
  15323. }
  15324. var href = _this.router.generate(_this.route, _this.params);
  15325. _this.element.setAttribute(_this.attribute, href);
  15326. return null;
  15327. }).catch(function (reason) {
  15328. logger.error(reason);
  15329. });
  15330. };
  15331. return RouteHref;
  15332. }()) || _class) || _class) || _class) || _class) || _class);
  15333. });
  15334. 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) {
  15335. 'use strict';
  15336. Object.defineProperty(exports, "__esModule", {
  15337. value: true
  15338. });
  15339. 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;
  15340. exports._hyphenate = _hyphenate;
  15341. exports._isAllWhitespace = _isAllWhitespace;
  15342. exports.viewEngineHooks = viewEngineHooks;
  15343. exports.children = children;
  15344. exports.child = child;
  15345. exports.resource = resource;
  15346. exports.behavior = behavior;
  15347. exports.customElement = customElement;
  15348. exports.customAttribute = customAttribute;
  15349. exports.templateController = templateController;
  15350. exports.bindable = bindable;
  15351. exports.dynamicOptions = dynamicOptions;
  15352. exports.useShadowDOM = useShadowDOM;
  15353. exports.processAttributes = processAttributes;
  15354. exports.processContent = processContent;
  15355. exports.containerless = containerless;
  15356. exports.useViewStrategy = useViewStrategy;
  15357. exports.useView = useView;
  15358. exports.inlineView = inlineView;
  15359. exports.noView = noView;
  15360. exports.elementConfig = elementConfig;
  15361. exports.viewResources = viewResources;
  15362. var LogManager = _interopRequireWildcard(_aureliaLogging);
  15363. function _interopRequireWildcard(obj) {
  15364. if (obj && obj.__esModule) {
  15365. return obj;
  15366. } else {
  15367. var newObj = {};
  15368. if (obj != null) {
  15369. for (var key in obj) {
  15370. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  15371. }
  15372. }
  15373. newObj.default = obj;
  15374. return newObj;
  15375. }
  15376. }
  15377. var _createClass = function () {
  15378. function defineProperties(target, props) {
  15379. for (var i = 0; i < props.length; i++) {
  15380. var descriptor = props[i];
  15381. descriptor.enumerable = descriptor.enumerable || false;
  15382. descriptor.configurable = true;
  15383. if ("value" in descriptor) descriptor.writable = true;
  15384. Object.defineProperty(target, descriptor.key, descriptor);
  15385. }
  15386. }
  15387. return function (Constructor, protoProps, staticProps) {
  15388. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  15389. if (staticProps) defineProperties(Constructor, staticProps);
  15390. return Constructor;
  15391. };
  15392. }();
  15393. 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;
  15394. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  15395. return typeof obj;
  15396. } : function (obj) {
  15397. return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
  15398. };
  15399. var animationEvent = exports.animationEvent = {
  15400. enterBegin: 'animation:enter:begin',
  15401. enterActive: 'animation:enter:active',
  15402. enterDone: 'animation:enter:done',
  15403. enterTimeout: 'animation:enter:timeout',
  15404. leaveBegin: 'animation:leave:begin',
  15405. leaveActive: 'animation:leave:active',
  15406. leaveDone: 'animation:leave:done',
  15407. leaveTimeout: 'animation:leave:timeout',
  15408. staggerNext: 'animation:stagger:next',
  15409. removeClassBegin: 'animation:remove-class:begin',
  15410. removeClassActive: 'animation:remove-class:active',
  15411. removeClassDone: 'animation:remove-class:done',
  15412. removeClassTimeout: 'animation:remove-class:timeout',
  15413. addClassBegin: 'animation:add-class:begin',
  15414. addClassActive: 'animation:add-class:active',
  15415. addClassDone: 'animation:add-class:done',
  15416. addClassTimeout: 'animation:add-class:timeout',
  15417. animateBegin: 'animation:animate:begin',
  15418. animateActive: 'animation:animate:active',
  15419. animateDone: 'animation:animate:done',
  15420. animateTimeout: 'animation:animate:timeout',
  15421. sequenceBegin: 'animation:sequence:begin',
  15422. sequenceDone: 'animation:sequence:done'
  15423. };
  15424. var Animator = exports.Animator = function () {
  15425. function Animator() {
  15426. }
  15427. Animator.prototype.enter = function enter(element) {
  15428. return Promise.resolve(false);
  15429. };
  15430. Animator.prototype.leave = function leave(element) {
  15431. return Promise.resolve(false);
  15432. };
  15433. Animator.prototype.removeClass = function removeClass(element, className) {
  15434. element.classList.remove(className);
  15435. return Promise.resolve(false);
  15436. };
  15437. Animator.prototype.addClass = function addClass(element, className) {
  15438. element.classList.add(className);
  15439. return Promise.resolve(false);
  15440. };
  15441. Animator.prototype.animate = function animate(element, className) {
  15442. return Promise.resolve(false);
  15443. };
  15444. Animator.prototype.runSequence = function runSequence(animations) {};
  15445. Animator.prototype.registerEffect = function registerEffect(effectName, properties) {};
  15446. Animator.prototype.unregisterEffect = function unregisterEffect(effectName) {};
  15447. return Animator;
  15448. }();
  15449. var CompositionTransactionNotifier = exports.CompositionTransactionNotifier = function () {
  15450. function CompositionTransactionNotifier(owner) {
  15451. this.owner = owner;
  15452. this.owner._compositionCount++;
  15453. }
  15454. CompositionTransactionNotifier.prototype.done = function done() {
  15455. this.owner._compositionCount--;
  15456. this.owner._tryCompleteTransaction();
  15457. };
  15458. return CompositionTransactionNotifier;
  15459. }();
  15460. var CompositionTransactionOwnershipToken = exports.CompositionTransactionOwnershipToken = function () {
  15461. function CompositionTransactionOwnershipToken(owner) {
  15462. this.owner = owner;
  15463. this.owner._ownershipToken = this;
  15464. this.thenable = this._createThenable();
  15465. }
  15466. CompositionTransactionOwnershipToken.prototype.waitForCompositionComplete = function waitForCompositionComplete() {
  15467. this.owner._tryCompleteTransaction();
  15468. return this.thenable;
  15469. };
  15470. CompositionTransactionOwnershipToken.prototype.resolve = function resolve() {
  15471. this._resolveCallback();
  15472. };
  15473. CompositionTransactionOwnershipToken.prototype._createThenable = function _createThenable() {
  15474. var _this = this;
  15475. return new Promise(function (resolve, reject) {
  15476. _this._resolveCallback = resolve;
  15477. });
  15478. };
  15479. return CompositionTransactionOwnershipToken;
  15480. }();
  15481. var CompositionTransaction = exports.CompositionTransaction = function () {
  15482. function CompositionTransaction() {
  15483. this._ownershipToken = null;
  15484. this._compositionCount = 0;
  15485. }
  15486. CompositionTransaction.prototype.tryCapture = function tryCapture() {
  15487. return this._ownershipToken === null ? new CompositionTransactionOwnershipToken(this) : null;
  15488. };
  15489. CompositionTransaction.prototype.enlist = function enlist() {
  15490. return new CompositionTransactionNotifier(this);
  15491. };
  15492. CompositionTransaction.prototype._tryCompleteTransaction = function _tryCompleteTransaction() {
  15493. if (this._compositionCount <= 0) {
  15494. this._compositionCount = 0;
  15495. if (this._ownershipToken !== null) {
  15496. var token = this._ownershipToken;
  15497. this._ownershipToken = null;
  15498. token.resolve();
  15499. }
  15500. }
  15501. };
  15502. return CompositionTransaction;
  15503. }();
  15504. var capitalMatcher = /([A-Z])/g;
  15505. function addHyphenAndLower(char) {
  15506. return '-' + char.toLowerCase();
  15507. }
  15508. function _hyphenate(name) {
  15509. return (name.charAt(0).toLowerCase() + name.slice(1)).replace(capitalMatcher, addHyphenAndLower);
  15510. }
  15511. function _isAllWhitespace(node) {
  15512. return !(node.auInterpolationTarget || /[^\t\n\r ]/.test(node.textContent));
  15513. }
  15514. var ViewEngineHooksResource = exports.ViewEngineHooksResource = function () {
  15515. function ViewEngineHooksResource() {
  15516. }
  15517. ViewEngineHooksResource.prototype.initialize = function initialize(container, target) {
  15518. this.instance = container.get(target);
  15519. };
  15520. ViewEngineHooksResource.prototype.register = function register(registry, name) {
  15521. registry.registerViewEngineHooks(this.instance);
  15522. };
  15523. ViewEngineHooksResource.prototype.load = function load(container, target) {};
  15524. ViewEngineHooksResource.convention = function convention(name) {
  15525. if (name.endsWith('ViewEngineHooks')) {
  15526. return new ViewEngineHooksResource();
  15527. }
  15528. };
  15529. return ViewEngineHooksResource;
  15530. }();
  15531. function viewEngineHooks(target) {
  15532. var deco = function deco(t) {
  15533. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ViewEngineHooksResource(), t);
  15534. };
  15535. return target ? deco(target) : deco;
  15536. }
  15537. var ElementEvents = exports.ElementEvents = function () {
  15538. function ElementEvents(element) {
  15539. this.element = element;
  15540. this.subscriptions = {};
  15541. }
  15542. ElementEvents.prototype._enqueueHandler = function _enqueueHandler(handler) {
  15543. this.subscriptions[handler.eventName] = this.subscriptions[handler.eventName] || [];
  15544. this.subscriptions[handler.eventName].push(handler);
  15545. };
  15546. ElementEvents.prototype._dequeueHandler = function _dequeueHandler(handler) {
  15547. var index = void 0;
  15548. var subscriptions = this.subscriptions[handler.eventName];
  15549. if (subscriptions) {
  15550. index = subscriptions.indexOf(handler);
  15551. if (index > -1) {
  15552. subscriptions.splice(index, 1);
  15553. }
  15554. }
  15555. return handler;
  15556. };
  15557. ElementEvents.prototype.publish = function publish(eventName) {
  15558. var detail = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  15559. var bubbles = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];
  15560. var cancelable = arguments.length <= 3 || arguments[3] === undefined ? true : arguments[3];
  15561. var event = _aureliaPal.DOM.createCustomEvent(eventName, { cancelable: cancelable, bubbles: bubbles, detail: detail });
  15562. this.element.dispatchEvent(event);
  15563. };
  15564. ElementEvents.prototype.subscribe = function subscribe(eventName, handler) {
  15565. var _this2 = this;
  15566. var bubbles = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];
  15567. if (handler && typeof handler === 'function') {
  15568. handler.eventName = eventName;
  15569. handler.handler = handler;
  15570. handler.bubbles = bubbles;
  15571. handler.dispose = function () {
  15572. _this2.element.removeEventListener(eventName, handler, bubbles);
  15573. _this2._dequeueHandler(handler);
  15574. };
  15575. this.element.addEventListener(eventName, handler, bubbles);
  15576. this._enqueueHandler(handler);
  15577. return handler;
  15578. }
  15579. return undefined;
  15580. };
  15581. ElementEvents.prototype.subscribeOnce = function subscribeOnce(eventName, handler) {
  15582. var _this3 = this;
  15583. var bubbles = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];
  15584. if (handler && typeof handler === 'function') {
  15585. var _ret = function () {
  15586. var _handler = function _handler(event) {
  15587. handler(event);
  15588. _handler.dispose();
  15589. };
  15590. return {
  15591. v: _this3.subscribe(eventName, _handler, bubbles)
  15592. };
  15593. }();
  15594. if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
  15595. }
  15596. return undefined;
  15597. };
  15598. ElementEvents.prototype.dispose = function dispose(eventName) {
  15599. if (eventName && typeof eventName === 'string') {
  15600. var subscriptions = this.subscriptions[eventName];
  15601. if (subscriptions) {
  15602. while (subscriptions.length) {
  15603. var subscription = subscriptions.pop();
  15604. if (subscription) {
  15605. subscription.dispose();
  15606. }
  15607. }
  15608. }
  15609. } else {
  15610. this.disposeAll();
  15611. }
  15612. };
  15613. ElementEvents.prototype.disposeAll = function disposeAll() {
  15614. for (var key in this.subscriptions) {
  15615. this.dispose(key);
  15616. }
  15617. };
  15618. return ElementEvents;
  15619. }();
  15620. var ResourceLoadContext = exports.ResourceLoadContext = function () {
  15621. function ResourceLoadContext() {
  15622. this.dependencies = {};
  15623. }
  15624. ResourceLoadContext.prototype.addDependency = function addDependency(url) {
  15625. this.dependencies[url] = true;
  15626. };
  15627. ResourceLoadContext.prototype.hasDependency = function hasDependency(url) {
  15628. return url in this.dependencies;
  15629. };
  15630. return ResourceLoadContext;
  15631. }();
  15632. var ViewCompileInstruction = exports.ViewCompileInstruction = function ViewCompileInstruction() {
  15633. var targetShadowDOM = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
  15634. var compileSurrogate = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
  15635. this.targetShadowDOM = targetShadowDOM;
  15636. this.compileSurrogate = compileSurrogate;
  15637. this.associatedModuleId = null;
  15638. };
  15639. ViewCompileInstruction.normal = new ViewCompileInstruction();
  15640. var BehaviorInstruction = exports.BehaviorInstruction = function () {
  15641. BehaviorInstruction.enhance = function enhance() {
  15642. var instruction = new BehaviorInstruction();
  15643. instruction.enhance = true;
  15644. return instruction;
  15645. };
  15646. BehaviorInstruction.unitTest = function unitTest(type, attributes) {
  15647. var instruction = new BehaviorInstruction();
  15648. instruction.type = type;
  15649. instruction.attributes = attributes || {};
  15650. return instruction;
  15651. };
  15652. BehaviorInstruction.element = function element(node, type) {
  15653. var instruction = new BehaviorInstruction();
  15654. instruction.type = type;
  15655. instruction.attributes = {};
  15656. instruction.anchorIsContainer = !(node.hasAttribute('containerless') || type.containerless);
  15657. instruction.initiatedByBehavior = true;
  15658. return instruction;
  15659. };
  15660. BehaviorInstruction.attribute = function attribute(attrName, type) {
  15661. var instruction = new BehaviorInstruction();
  15662. instruction.attrName = attrName;
  15663. instruction.type = type || null;
  15664. instruction.attributes = {};
  15665. return instruction;
  15666. };
  15667. BehaviorInstruction.dynamic = function dynamic(host, viewModel, viewFactory) {
  15668. var instruction = new BehaviorInstruction();
  15669. instruction.host = host;
  15670. instruction.viewModel = viewModel;
  15671. instruction.viewFactory = viewFactory;
  15672. instruction.inheritBindingContext = true;
  15673. return instruction;
  15674. };
  15675. function BehaviorInstruction() {
  15676. this.initiatedByBehavior = false;
  15677. this.enhance = false;
  15678. this.partReplacements = null;
  15679. this.viewFactory = null;
  15680. this.originalAttrName = null;
  15681. this.skipContentProcessing = false;
  15682. this.contentFactory = null;
  15683. this.viewModel = null;
  15684. this.anchorIsContainer = false;
  15685. this.host = null;
  15686. this.attributes = null;
  15687. this.type = null;
  15688. this.attrName = null;
  15689. this.inheritBindingContext = false;
  15690. }
  15691. return BehaviorInstruction;
  15692. }();
  15693. BehaviorInstruction.normal = new BehaviorInstruction();
  15694. var TargetInstruction = exports.TargetInstruction = (_temp = _class4 = function () {
  15695. TargetInstruction.shadowSlot = function shadowSlot(parentInjectorId) {
  15696. var instruction = new TargetInstruction();
  15697. instruction.parentInjectorId = parentInjectorId;
  15698. instruction.shadowSlot = true;
  15699. return instruction;
  15700. };
  15701. TargetInstruction.contentExpression = function contentExpression(expression) {
  15702. var instruction = new TargetInstruction();
  15703. instruction.contentExpression = expression;
  15704. return instruction;
  15705. };
  15706. TargetInstruction.lifting = function lifting(parentInjectorId, liftingInstruction) {
  15707. var instruction = new TargetInstruction();
  15708. instruction.parentInjectorId = parentInjectorId;
  15709. instruction.expressions = TargetInstruction.noExpressions;
  15710. instruction.behaviorInstructions = [liftingInstruction];
  15711. instruction.viewFactory = liftingInstruction.viewFactory;
  15712. instruction.providers = [liftingInstruction.type.target];
  15713. instruction.lifting = true;
  15714. return instruction;
  15715. };
  15716. TargetInstruction.normal = function normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction) {
  15717. var instruction = new TargetInstruction();
  15718. instruction.injectorId = injectorId;
  15719. instruction.parentInjectorId = parentInjectorId;
  15720. instruction.providers = providers;
  15721. instruction.behaviorInstructions = behaviorInstructions;
  15722. instruction.expressions = expressions;
  15723. instruction.anchorIsContainer = elementInstruction ? elementInstruction.anchorIsContainer : true;
  15724. instruction.elementInstruction = elementInstruction;
  15725. return instruction;
  15726. };
  15727. TargetInstruction.surrogate = function surrogate(providers, behaviorInstructions, expressions, values) {
  15728. var instruction = new TargetInstruction();
  15729. instruction.expressions = expressions;
  15730. instruction.behaviorInstructions = behaviorInstructions;
  15731. instruction.providers = providers;
  15732. instruction.values = values;
  15733. return instruction;
  15734. };
  15735. function TargetInstruction() {
  15736. this.injectorId = null;
  15737. this.parentInjectorId = null;
  15738. this.shadowSlot = false;
  15739. this.slotName = null;
  15740. this.slotFallbackFactory = null;
  15741. this.contentExpression = null;
  15742. this.expressions = null;
  15743. this.behaviorInstructions = null;
  15744. this.providers = null;
  15745. this.viewFactory = null;
  15746. this.anchorIsContainer = false;
  15747. this.elementInstruction = null;
  15748. this.lifting = false;
  15749. this.values = null;
  15750. }
  15751. return TargetInstruction;
  15752. }(), _class4.noExpressions = Object.freeze([]), _temp);
  15753. var viewStrategy = exports.viewStrategy = _aureliaMetadata.protocol.create('aurelia:view-strategy', {
  15754. validate: function validate(target) {
  15755. if (!(typeof target.loadViewFactory === 'function')) {
  15756. return 'View strategies must implement: loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise<ViewFactory>';
  15757. }
  15758. return true;
  15759. },
  15760. compose: function compose(target) {
  15761. if (!(typeof target.makeRelativeTo === 'function')) {
  15762. target.makeRelativeTo = _aureliaPal.PLATFORM.noop;
  15763. }
  15764. }
  15765. });
  15766. var RelativeViewStrategy = exports.RelativeViewStrategy = (_dec = viewStrategy(), _dec(_class5 = function () {
  15767. function RelativeViewStrategy(path) {
  15768. this.path = path;
  15769. this.absolutePath = null;
  15770. }
  15771. RelativeViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
  15772. if (this.absolutePath === null && this.moduleId) {
  15773. this.absolutePath = (0, _aureliaPath.relativeToFile)(this.path, this.moduleId);
  15774. }
  15775. compileInstruction.associatedModuleId = this.moduleId;
  15776. return viewEngine.loadViewFactory(this.absolutePath || this.path, compileInstruction, loadContext, target);
  15777. };
  15778. RelativeViewStrategy.prototype.makeRelativeTo = function makeRelativeTo(file) {
  15779. if (this.absolutePath === null) {
  15780. this.absolutePath = (0, _aureliaPath.relativeToFile)(this.path, file);
  15781. }
  15782. };
  15783. return RelativeViewStrategy;
  15784. }()) || _class5);
  15785. var ConventionalViewStrategy = exports.ConventionalViewStrategy = (_dec2 = viewStrategy(), _dec2(_class6 = function () {
  15786. function ConventionalViewStrategy(viewLocator, origin) {
  15787. this.moduleId = origin.moduleId;
  15788. this.viewUrl = viewLocator.convertOriginToViewUrl(origin);
  15789. }
  15790. ConventionalViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
  15791. compileInstruction.associatedModuleId = this.moduleId;
  15792. return viewEngine.loadViewFactory(this.viewUrl, compileInstruction, loadContext, target);
  15793. };
  15794. return ConventionalViewStrategy;
  15795. }()) || _class6);
  15796. var NoViewStrategy = exports.NoViewStrategy = (_dec3 = viewStrategy(), _dec3(_class7 = function () {
  15797. function NoViewStrategy(dependencies, dependencyBaseUrl) {
  15798. this.dependencies = dependencies || null;
  15799. this.dependencyBaseUrl = dependencyBaseUrl || '';
  15800. }
  15801. NoViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
  15802. var entry = this.entry;
  15803. var dependencies = this.dependencies;
  15804. if (entry && entry.factoryIsReady) {
  15805. return Promise.resolve(null);
  15806. }
  15807. this.entry = entry = new _aureliaLoader.TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl);
  15808. entry.dependencies = [];
  15809. entry.templateIsLoaded = true;
  15810. if (dependencies !== null) {
  15811. for (var i = 0, ii = dependencies.length; i < ii; ++i) {
  15812. var current = dependencies[i];
  15813. if (typeof current === 'string' || typeof current === 'function') {
  15814. entry.addDependency(current);
  15815. } else {
  15816. entry.addDependency(current.from, current.as);
  15817. }
  15818. }
  15819. }
  15820. compileInstruction.associatedModuleId = this.moduleId;
  15821. return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);
  15822. };
  15823. return NoViewStrategy;
  15824. }()) || _class7);
  15825. var TemplateRegistryViewStrategy = exports.TemplateRegistryViewStrategy = (_dec4 = viewStrategy(), _dec4(_class8 = function () {
  15826. function TemplateRegistryViewStrategy(moduleId, entry) {
  15827. this.moduleId = moduleId;
  15828. this.entry = entry;
  15829. }
  15830. TemplateRegistryViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
  15831. var entry = this.entry;
  15832. if (entry.factoryIsReady) {
  15833. return Promise.resolve(entry.factory);
  15834. }
  15835. compileInstruction.associatedModuleId = this.moduleId;
  15836. return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);
  15837. };
  15838. return TemplateRegistryViewStrategy;
  15839. }()) || _class8);
  15840. var InlineViewStrategy = exports.InlineViewStrategy = (_dec5 = viewStrategy(), _dec5(_class9 = function () {
  15841. function InlineViewStrategy(markup, dependencies, dependencyBaseUrl) {
  15842. this.markup = markup;
  15843. this.dependencies = dependencies || null;
  15844. this.dependencyBaseUrl = dependencyBaseUrl || '';
  15845. }
  15846. InlineViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {
  15847. var entry = this.entry;
  15848. var dependencies = this.dependencies;
  15849. if (entry && entry.factoryIsReady) {
  15850. return Promise.resolve(entry.factory);
  15851. }
  15852. this.entry = entry = new _aureliaLoader.TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl);
  15853. entry.template = _aureliaPal.DOM.createTemplateFromMarkup(this.markup);
  15854. if (dependencies !== null) {
  15855. for (var i = 0, ii = dependencies.length; i < ii; ++i) {
  15856. var current = dependencies[i];
  15857. if (typeof current === 'string' || typeof current === 'function') {
  15858. entry.addDependency(current);
  15859. } else {
  15860. entry.addDependency(current.from, current.as);
  15861. }
  15862. }
  15863. }
  15864. compileInstruction.associatedModuleId = this.moduleId;
  15865. return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);
  15866. };
  15867. return InlineViewStrategy;
  15868. }()) || _class9);
  15869. var ViewLocator = exports.ViewLocator = (_temp2 = _class10 = function () {
  15870. function ViewLocator() {
  15871. }
  15872. ViewLocator.prototype.getViewStrategy = function getViewStrategy(value) {
  15873. if (!value) {
  15874. return null;
  15875. }
  15876. if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && 'getViewStrategy' in value) {
  15877. var _origin = _aureliaMetadata.Origin.get(value.constructor);
  15878. value = value.getViewStrategy();
  15879. if (typeof value === 'string') {
  15880. value = new RelativeViewStrategy(value);
  15881. }
  15882. viewStrategy.assert(value);
  15883. if (_origin.moduleId) {
  15884. value.makeRelativeTo(_origin.moduleId);
  15885. }
  15886. return value;
  15887. }
  15888. if (typeof value === 'string') {
  15889. value = new RelativeViewStrategy(value);
  15890. }
  15891. if (viewStrategy.validate(value)) {
  15892. return value;
  15893. }
  15894. if (typeof value !== 'function') {
  15895. value = value.constructor;
  15896. }
  15897. var origin = _aureliaMetadata.Origin.get(value);
  15898. var strategy = _aureliaMetadata.metadata.get(ViewLocator.viewStrategyMetadataKey, value);
  15899. if (!strategy) {
  15900. if (!origin.moduleId) {
  15901. throw new Error('Cannot determine default view strategy for object.', value);
  15902. }
  15903. strategy = this.createFallbackViewStrategy(origin);
  15904. } else if (origin.moduleId) {
  15905. strategy.moduleId = origin.moduleId;
  15906. }
  15907. return strategy;
  15908. };
  15909. ViewLocator.prototype.createFallbackViewStrategy = function createFallbackViewStrategy(origin) {
  15910. return new ConventionalViewStrategy(this, origin);
  15911. };
  15912. ViewLocator.prototype.convertOriginToViewUrl = function convertOriginToViewUrl(origin) {
  15913. var moduleId = origin.moduleId;
  15914. var id = moduleId.endsWith('.js') || moduleId.endsWith('.ts') ? moduleId.substring(0, moduleId.length - 3) : moduleId;
  15915. return id + '.html';
  15916. };
  15917. return ViewLocator;
  15918. }(), _class10.viewStrategyMetadataKey = 'aurelia:view-strategy', _temp2);
  15919. function mi(name) {
  15920. throw new Error('BindingLanguage must implement ' + name + '().');
  15921. }
  15922. var BindingLanguage = exports.BindingLanguage = function () {
  15923. function BindingLanguage() {
  15924. }
  15925. BindingLanguage.prototype.inspectAttribute = function inspectAttribute(resources, elementName, attrName, attrValue) {
  15926. mi('inspectAttribute');
  15927. };
  15928. BindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, info, existingInstruction) {
  15929. mi('createAttributeInstruction');
  15930. };
  15931. BindingLanguage.prototype.inspectTextContent = function inspectTextContent(resources, value) {
  15932. mi('inspectTextContent');
  15933. };
  15934. return BindingLanguage;
  15935. }();
  15936. var noNodes = Object.freeze([]);
  15937. var SlotCustomAttribute = exports.SlotCustomAttribute = (_dec6 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element), _dec6(_class11 = function () {
  15938. function SlotCustomAttribute(element) {
  15939. this.element = element;
  15940. this.element.auSlotAttribute = this;
  15941. }
  15942. SlotCustomAttribute.prototype.valueChanged = function valueChanged(newValue, oldValue) {};
  15943. return SlotCustomAttribute;
  15944. }()) || _class11);
  15945. var PassThroughSlot = exports.PassThroughSlot = function () {
  15946. function PassThroughSlot(anchor, name, destinationName, fallbackFactory) {
  15947. this.anchor = anchor;
  15948. this.anchor.viewSlot = this;
  15949. this.name = name;
  15950. this.destinationName = destinationName;
  15951. this.fallbackFactory = fallbackFactory;
  15952. this.destinationSlot = null;
  15953. this.projections = 0;
  15954. this.contentView = null;
  15955. var attr = new SlotCustomAttribute(this.anchor);
  15956. attr.value = this.destinationName;
  15957. }
  15958. PassThroughSlot.prototype.renderFallbackContent = function renderFallbackContent(view, nodes, projectionSource, index) {
  15959. if (this.contentView === null) {
  15960. this.contentView = this.fallbackFactory.create(this.ownerView.container);
  15961. this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);
  15962. var slots = Object.create(null);
  15963. slots[this.destinationSlot.name] = this.destinationSlot;
  15964. ShadowDOM.distributeView(this.contentView, slots, projectionSource, index, this.destinationSlot.name);
  15965. }
  15966. };
  15967. PassThroughSlot.prototype.passThroughTo = function passThroughTo(destinationSlot) {
  15968. this.destinationSlot = destinationSlot;
  15969. };
  15970. PassThroughSlot.prototype.addNode = function addNode(view, node, projectionSource, index) {
  15971. if (this.contentView !== null) {
  15972. this.contentView.removeNodes();
  15973. this.contentView.detached();
  15974. this.contentView.unbind();
  15975. this.contentView = null;
  15976. }
  15977. if (node.viewSlot instanceof PassThroughSlot) {
  15978. node.viewSlot.passThroughTo(this);
  15979. return;
  15980. }
  15981. this.projections++;
  15982. this.destinationSlot.addNode(view, node, projectionSource, index);
  15983. };
  15984. PassThroughSlot.prototype.removeView = function removeView(view, projectionSource) {
  15985. this.projections--;
  15986. this.destinationSlot.removeView(view, projectionSource);
  15987. if (this.needsFallbackRendering) {
  15988. this.renderFallbackContent(null, noNodes, projectionSource);
  15989. }
  15990. };
  15991. PassThroughSlot.prototype.removeAll = function removeAll(projectionSource) {
  15992. this.projections = 0;
  15993. this.destinationSlot.removeAll(projectionSource);
  15994. if (this.needsFallbackRendering) {
  15995. this.renderFallbackContent(null, noNodes, projectionSource);
  15996. }
  15997. };
  15998. PassThroughSlot.prototype.projectFrom = function projectFrom(view, projectionSource) {
  15999. this.destinationSlot.projectFrom(view, projectionSource);
  16000. };
  16001. PassThroughSlot.prototype.created = function created(ownerView) {
  16002. this.ownerView = ownerView;
  16003. };
  16004. PassThroughSlot.prototype.bind = function bind(view) {
  16005. if (this.contentView) {
  16006. this.contentView.bind(view.bindingContext, view.overrideContext);
  16007. }
  16008. };
  16009. PassThroughSlot.prototype.attached = function attached() {
  16010. if (this.contentView) {
  16011. this.contentView.attached();
  16012. }
  16013. };
  16014. PassThroughSlot.prototype.detached = function detached() {
  16015. if (this.contentView) {
  16016. this.contentView.detached();
  16017. }
  16018. };
  16019. PassThroughSlot.prototype.unbind = function unbind() {
  16020. if (this.contentView) {
  16021. this.contentView.unbind();
  16022. }
  16023. };
  16024. _createClass(PassThroughSlot, [{
  16025. key: 'needsFallbackRendering',
  16026. get: function get() {
  16027. return this.fallbackFactory && this.projections === 0;
  16028. }
  16029. }]);
  16030. return PassThroughSlot;
  16031. }();
  16032. var ShadowSlot = exports.ShadowSlot = function () {
  16033. function ShadowSlot(anchor, name, fallbackFactory) {
  16034. this.anchor = anchor;
  16035. this.anchor.isContentProjectionSource = true;
  16036. this.anchor.viewSlot = this;
  16037. this.name = name;
  16038. this.fallbackFactory = fallbackFactory;
  16039. this.contentView = null;
  16040. this.projections = 0;
  16041. this.children = [];
  16042. this.projectFromAnchors = null;
  16043. this.destinationSlots = null;
  16044. }
  16045. ShadowSlot.prototype.addNode = function addNode(view, node, projectionSource, index, destination) {
  16046. if (this.contentView !== null) {
  16047. this.contentView.removeNodes();
  16048. this.contentView.detached();
  16049. this.contentView.unbind();
  16050. this.contentView = null;
  16051. }
  16052. if (node.viewSlot instanceof PassThroughSlot) {
  16053. node.viewSlot.passThroughTo(this);
  16054. return;
  16055. }
  16056. if (this.destinationSlots !== null) {
  16057. ShadowDOM.distributeNodes(view, [node], this.destinationSlots, this, index);
  16058. } else {
  16059. node.auOwnerView = view;
  16060. node.auProjectionSource = projectionSource;
  16061. node.auAssignedSlot = this;
  16062. var anchor = this._findAnchor(view, node, projectionSource, index);
  16063. var parent = anchor.parentNode;
  16064. parent.insertBefore(node, anchor);
  16065. this.children.push(node);
  16066. this.projections++;
  16067. }
  16068. };
  16069. ShadowSlot.prototype.removeView = function removeView(view, projectionSource) {
  16070. if (this.destinationSlots !== null) {
  16071. ShadowDOM.undistributeView(view, this.destinationSlots, this);
  16072. } else if (this.contentView && this.contentView.hasSlots) {
  16073. ShadowDOM.undistributeView(view, this.contentView.slots, projectionSource);
  16074. } else {
  16075. var found = this.children.find(function (x) {
  16076. return x.auSlotProjectFrom === projectionSource;
  16077. });
  16078. if (found) {
  16079. var _children = found.auProjectionChildren;
  16080. for (var i = 0, ii = _children.length; i < ii; ++i) {
  16081. var _child = _children[i];
  16082. if (_child.auOwnerView === view) {
  16083. _children.splice(i, 1);
  16084. view.fragment.appendChild(_child);
  16085. i--;ii--;
  16086. this.projections--;
  16087. }
  16088. }
  16089. if (this.needsFallbackRendering) {
  16090. this.renderFallbackContent(view, noNodes, projectionSource);
  16091. }
  16092. }
  16093. }
  16094. };
  16095. ShadowSlot.prototype.removeAll = function removeAll(projectionSource) {
  16096. if (this.destinationSlots !== null) {
  16097. ShadowDOM.undistributeAll(this.destinationSlots, this);
  16098. } else if (this.contentView && this.contentView.hasSlots) {
  16099. ShadowDOM.undistributeAll(this.contentView.slots, projectionSource);
  16100. } else {
  16101. var found = this.children.find(function (x) {
  16102. return x.auSlotProjectFrom === projectionSource;
  16103. });
  16104. if (found) {
  16105. var _children2 = found.auProjectionChildren;
  16106. for (var i = 0, ii = _children2.length; i < ii; ++i) {
  16107. var _child2 = _children2[i];
  16108. _child2.auOwnerView.fragment.appendChild(_child2);
  16109. this.projections--;
  16110. }
  16111. found.auProjectionChildren = [];
  16112. if (this.needsFallbackRendering) {
  16113. this.renderFallbackContent(null, noNodes, projectionSource);
  16114. }
  16115. }
  16116. }
  16117. };
  16118. ShadowSlot.prototype._findAnchor = function _findAnchor(view, node, projectionSource, index) {
  16119. if (projectionSource) {
  16120. var found = this.children.find(function (x) {
  16121. return x.auSlotProjectFrom === projectionSource;
  16122. });
  16123. if (found) {
  16124. if (index !== undefined) {
  16125. var _children3 = found.auProjectionChildren;
  16126. var viewIndex = -1;
  16127. var lastView = void 0;
  16128. for (var i = 0, ii = _children3.length; i < ii; ++i) {
  16129. var current = _children3[i];
  16130. if (current.auOwnerView !== lastView) {
  16131. viewIndex++;
  16132. lastView = current.auOwnerView;
  16133. if (viewIndex >= index && lastView !== view) {
  16134. _children3.splice(i, 0, node);
  16135. return current;
  16136. }
  16137. }
  16138. }
  16139. }
  16140. found.auProjectionChildren.push(node);
  16141. return found;
  16142. }
  16143. }
  16144. return this.anchor;
  16145. };
  16146. ShadowSlot.prototype.projectTo = function projectTo(slots) {
  16147. this.destinationSlots = slots;
  16148. };
  16149. ShadowSlot.prototype.projectFrom = function projectFrom(view, projectionSource) {
  16150. var anchor = _aureliaPal.DOM.createComment('anchor');
  16151. var parent = this.anchor.parentNode;
  16152. anchor.auSlotProjectFrom = projectionSource;
  16153. anchor.auOwnerView = view;
  16154. anchor.auProjectionChildren = [];
  16155. parent.insertBefore(anchor, this.anchor);
  16156. this.children.push(anchor);
  16157. if (this.projectFromAnchors === null) {
  16158. this.projectFromAnchors = [];
  16159. }
  16160. this.projectFromAnchors.push(anchor);
  16161. };
  16162. ShadowSlot.prototype.renderFallbackContent = function renderFallbackContent(view, nodes, projectionSource, index) {
  16163. if (this.contentView === null) {
  16164. this.contentView = this.fallbackFactory.create(this.ownerView.container);
  16165. this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);
  16166. this.contentView.insertNodesBefore(this.anchor);
  16167. }
  16168. if (this.contentView.hasSlots) {
  16169. var slots = this.contentView.slots;
  16170. var projectFromAnchors = this.projectFromAnchors;
  16171. if (projectFromAnchors !== null) {
  16172. for (var slotName in slots) {
  16173. var slot = slots[slotName];
  16174. for (var i = 0, ii = projectFromAnchors.length; i < ii; ++i) {
  16175. var anchor = projectFromAnchors[i];
  16176. slot.projectFrom(anchor.auOwnerView, anchor.auSlotProjectFrom);
  16177. }
  16178. }
  16179. }
  16180. this.fallbackSlots = slots;
  16181. ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index);
  16182. }
  16183. };
  16184. ShadowSlot.prototype.created = function created(ownerView) {
  16185. this.ownerView = ownerView;
  16186. };
  16187. ShadowSlot.prototype.bind = function bind(view) {
  16188. if (this.contentView) {
  16189. this.contentView.bind(view.bindingContext, view.overrideContext);
  16190. }
  16191. };
  16192. ShadowSlot.prototype.attached = function attached() {
  16193. if (this.contentView) {
  16194. this.contentView.attached();
  16195. }
  16196. };
  16197. ShadowSlot.prototype.detached = function detached() {
  16198. if (this.contentView) {
  16199. this.contentView.detached();
  16200. }
  16201. };
  16202. ShadowSlot.prototype.unbind = function unbind() {
  16203. if (this.contentView) {
  16204. this.contentView.unbind();
  16205. }
  16206. };
  16207. _createClass(ShadowSlot, [{
  16208. key: 'needsFallbackRendering',
  16209. get: function get() {
  16210. return this.fallbackFactory && this.projections === 0;
  16211. }
  16212. }]);
  16213. return ShadowSlot;
  16214. }();
  16215. var ShadowDOM = exports.ShadowDOM = (_temp3 = _class12 = function () {
  16216. function ShadowDOM() {
  16217. }
  16218. ShadowDOM.getSlotName = function getSlotName(node) {
  16219. if (node.auSlotAttribute === undefined) {
  16220. return ShadowDOM.defaultSlotKey;
  16221. }
  16222. return node.auSlotAttribute.value;
  16223. };
  16224. ShadowDOM.distributeView = function distributeView(view, slots, projectionSource, index, destinationOverride) {
  16225. var nodes = void 0;
  16226. if (view === null) {
  16227. nodes = noNodes;
  16228. } else {
  16229. var childNodes = view.fragment.childNodes;
  16230. var ii = childNodes.length;
  16231. nodes = new Array(ii);
  16232. for (var i = 0; i < ii; ++i) {
  16233. nodes[i] = childNodes[i];
  16234. }
  16235. }
  16236. ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride);
  16237. };
  16238. ShadowDOM.undistributeView = function undistributeView(view, slots, projectionSource) {
  16239. for (var slotName in slots) {
  16240. slots[slotName].removeView(view, projectionSource);
  16241. }
  16242. };
  16243. ShadowDOM.undistributeAll = function undistributeAll(slots, projectionSource) {
  16244. for (var slotName in slots) {
  16245. slots[slotName].removeAll(projectionSource);
  16246. }
  16247. };
  16248. ShadowDOM.distributeNodes = function distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride) {
  16249. for (var i = 0, ii = nodes.length; i < ii; ++i) {
  16250. var currentNode = nodes[i];
  16251. var nodeType = currentNode.nodeType;
  16252. if (currentNode.isContentProjectionSource) {
  16253. currentNode.viewSlot.projectTo(slots);
  16254. for (var slotName in slots) {
  16255. slots[slotName].projectFrom(view, currentNode.viewSlot);
  16256. }
  16257. nodes.splice(i, 1);
  16258. ii--;i--;
  16259. } else if (nodeType === 1 || nodeType === 3 || currentNode.viewSlot instanceof PassThroughSlot) {
  16260. if (nodeType === 3 && _isAllWhitespace(currentNode)) {
  16261. nodes.splice(i, 1);
  16262. ii--;i--;
  16263. } else {
  16264. var found = slots[destinationOverride || ShadowDOM.getSlotName(currentNode)];
  16265. if (found) {
  16266. found.addNode(view, currentNode, projectionSource, index);
  16267. nodes.splice(i, 1);
  16268. ii--;i--;
  16269. }
  16270. }
  16271. } else {
  16272. nodes.splice(i, 1);
  16273. ii--;i--;
  16274. }
  16275. }
  16276. for (var _slotName in slots) {
  16277. var slot = slots[_slotName];
  16278. if (slot.needsFallbackRendering) {
  16279. slot.renderFallbackContent(view, nodes, projectionSource, index);
  16280. }
  16281. }
  16282. };
  16283. return ShadowDOM;
  16284. }(), _class12.defaultSlotKey = '__au-default-slot-key__', _temp3);
  16285. function register(lookup, name, resource, type) {
  16286. if (!name) {
  16287. return;
  16288. }
  16289. var existing = lookup[name];
  16290. if (existing) {
  16291. if (existing !== resource) {
  16292. throw new Error('Attempted to register ' + type + ' when one with the same name already exists. Name: ' + name + '.');
  16293. }
  16294. return;
  16295. }
  16296. lookup[name] = resource;
  16297. }
  16298. var ViewResources = exports.ViewResources = function () {
  16299. function ViewResources(parent, viewUrl) {
  16300. this.bindingLanguage = null;
  16301. this.parent = parent || null;
  16302. this.hasParent = this.parent !== null;
  16303. this.viewUrl = viewUrl || '';
  16304. this.lookupFunctions = {
  16305. valueConverters: this.getValueConverter.bind(this),
  16306. bindingBehaviors: this.getBindingBehavior.bind(this)
  16307. };
  16308. this.attributes = Object.create(null);
  16309. this.elements = Object.create(null);
  16310. this.valueConverters = Object.create(null);
  16311. this.bindingBehaviors = Object.create(null);
  16312. this.attributeMap = Object.create(null);
  16313. this.values = Object.create(null);
  16314. this.beforeCompile = this.afterCompile = this.beforeCreate = this.afterCreate = this.beforeBind = this.beforeUnbind = false;
  16315. }
  16316. ViewResources.prototype._tryAddHook = function _tryAddHook(obj, name) {
  16317. if (typeof obj[name] === 'function') {
  16318. var func = obj[name].bind(obj);
  16319. var counter = 1;
  16320. var callbackName = void 0;
  16321. while (this[callbackName = name + counter.toString()] !== undefined) {
  16322. counter++;
  16323. }
  16324. this[name] = true;
  16325. this[callbackName] = func;
  16326. }
  16327. };
  16328. ViewResources.prototype._invokeHook = function _invokeHook(name, one, two, three, four) {
  16329. if (this.hasParent) {
  16330. this.parent._invokeHook(name, one, two, three, four);
  16331. }
  16332. if (this[name]) {
  16333. this[name + '1'](one, two, three, four);
  16334. var callbackName = name + '2';
  16335. if (this[callbackName]) {
  16336. this[callbackName](one, two, three, four);
  16337. callbackName = name + '3';
  16338. if (this[callbackName]) {
  16339. this[callbackName](one, two, three, four);
  16340. var counter = 4;
  16341. while (this[callbackName = name + counter.toString()] !== undefined) {
  16342. this[callbackName](one, two, three, four);
  16343. counter++;
  16344. }
  16345. }
  16346. }
  16347. }
  16348. };
  16349. ViewResources.prototype.registerViewEngineHooks = function registerViewEngineHooks(hooks) {
  16350. this._tryAddHook(hooks, 'beforeCompile');
  16351. this._tryAddHook(hooks, 'afterCompile');
  16352. this._tryAddHook(hooks, 'beforeCreate');
  16353. this._tryAddHook(hooks, 'afterCreate');
  16354. this._tryAddHook(hooks, 'beforeBind');
  16355. this._tryAddHook(hooks, 'beforeUnbind');
  16356. };
  16357. ViewResources.prototype.getBindingLanguage = function getBindingLanguage(bindingLanguageFallback) {
  16358. return this.bindingLanguage || (this.bindingLanguage = bindingLanguageFallback);
  16359. };
  16360. ViewResources.prototype.patchInParent = function patchInParent(newParent) {
  16361. var originalParent = this.parent;
  16362. this.parent = newParent || null;
  16363. this.hasParent = this.parent !== null;
  16364. if (newParent.parent === null) {
  16365. newParent.parent = originalParent;
  16366. newParent.hasParent = originalParent !== null;
  16367. }
  16368. };
  16369. ViewResources.prototype.relativeToView = function relativeToView(path) {
  16370. return (0, _aureliaPath.relativeToFile)(path, this.viewUrl);
  16371. };
  16372. ViewResources.prototype.registerElement = function registerElement(tagName, behavior) {
  16373. register(this.elements, tagName, behavior, 'an Element');
  16374. };
  16375. ViewResources.prototype.getElement = function getElement(tagName) {
  16376. return this.elements[tagName] || (this.hasParent ? this.parent.getElement(tagName) : null);
  16377. };
  16378. ViewResources.prototype.mapAttribute = function mapAttribute(attribute) {
  16379. return this.attributeMap[attribute] || (this.hasParent ? this.parent.mapAttribute(attribute) : null);
  16380. };
  16381. ViewResources.prototype.registerAttribute = function registerAttribute(attribute, behavior, knownAttribute) {
  16382. this.attributeMap[attribute] = knownAttribute;
  16383. register(this.attributes, attribute, behavior, 'an Attribute');
  16384. };
  16385. ViewResources.prototype.getAttribute = function getAttribute(attribute) {
  16386. return this.attributes[attribute] || (this.hasParent ? this.parent.getAttribute(attribute) : null);
  16387. };
  16388. ViewResources.prototype.registerValueConverter = function registerValueConverter(name, valueConverter) {
  16389. register(this.valueConverters, name, valueConverter, 'a ValueConverter');
  16390. };
  16391. ViewResources.prototype.getValueConverter = function getValueConverter(name) {
  16392. return this.valueConverters[name] || (this.hasParent ? this.parent.getValueConverter(name) : null);
  16393. };
  16394. ViewResources.prototype.registerBindingBehavior = function registerBindingBehavior(name, bindingBehavior) {
  16395. register(this.bindingBehaviors, name, bindingBehavior, 'a BindingBehavior');
  16396. };
  16397. ViewResources.prototype.getBindingBehavior = function getBindingBehavior(name) {
  16398. return this.bindingBehaviors[name] || (this.hasParent ? this.parent.getBindingBehavior(name) : null);
  16399. };
  16400. ViewResources.prototype.registerValue = function registerValue(name, value) {
  16401. register(this.values, name, value, 'a value');
  16402. };
  16403. ViewResources.prototype.getValue = function getValue(name) {
  16404. return this.values[name] || (this.hasParent ? this.parent.getValue(name) : null);
  16405. };
  16406. return ViewResources;
  16407. }();
  16408. var View = exports.View = function () {
  16409. function View(container, viewFactory, fragment, controllers, bindings, children, slots) {
  16410. this.container = container;
  16411. this.viewFactory = viewFactory;
  16412. this.resources = viewFactory.resources;
  16413. this.fragment = fragment;
  16414. this.firstChild = fragment.firstChild;
  16415. this.lastChild = fragment.lastChild;
  16416. this.controllers = controllers;
  16417. this.bindings = bindings;
  16418. this.children = children;
  16419. this.slots = slots;
  16420. this.hasSlots = false;
  16421. this.fromCache = false;
  16422. this.isBound = false;
  16423. this.isAttached = false;
  16424. this.bindingContext = null;
  16425. this.overrideContext = null;
  16426. this.controller = null;
  16427. this.viewModelScope = null;
  16428. this.animatableElement = undefined;
  16429. this._isUserControlled = false;
  16430. this.contentView = null;
  16431. for (var key in slots) {
  16432. this.hasSlots = true;
  16433. break;
  16434. }
  16435. }
  16436. View.prototype.returnToCache = function returnToCache() {
  16437. this.viewFactory.returnViewToCache(this);
  16438. };
  16439. View.prototype.created = function created() {
  16440. var i = void 0;
  16441. var ii = void 0;
  16442. var controllers = this.controllers;
  16443. for (i = 0, ii = controllers.length; i < ii; ++i) {
  16444. controllers[i].created(this);
  16445. }
  16446. };
  16447. View.prototype.bind = function bind(bindingContext, overrideContext, _systemUpdate) {
  16448. var controllers = void 0;
  16449. var bindings = void 0;
  16450. var children = void 0;
  16451. var i = void 0;
  16452. var ii = void 0;
  16453. if (_systemUpdate && this._isUserControlled) {
  16454. return;
  16455. }
  16456. if (this.isBound) {
  16457. if (this.bindingContext === bindingContext) {
  16458. return;
  16459. }
  16460. this.unbind();
  16461. }
  16462. this.isBound = true;
  16463. this.bindingContext = bindingContext;
  16464. this.overrideContext = overrideContext || (0, _aureliaBinding.createOverrideContext)(bindingContext);
  16465. this.resources._invokeHook('beforeBind', this);
  16466. bindings = this.bindings;
  16467. for (i = 0, ii = bindings.length; i < ii; ++i) {
  16468. bindings[i].bind(this);
  16469. }
  16470. if (this.viewModelScope !== null) {
  16471. bindingContext.bind(this.viewModelScope.bindingContext, this.viewModelScope.overrideContext);
  16472. this.viewModelScope = null;
  16473. }
  16474. controllers = this.controllers;
  16475. for (i = 0, ii = controllers.length; i < ii; ++i) {
  16476. controllers[i].bind(this);
  16477. }
  16478. children = this.children;
  16479. for (i = 0, ii = children.length; i < ii; ++i) {
  16480. children[i].bind(bindingContext, overrideContext, true);
  16481. }
  16482. if (this.hasSlots) {
  16483. ShadowDOM.distributeView(this.contentView, this.slots);
  16484. }
  16485. };
  16486. View.prototype.addBinding = function addBinding(binding) {
  16487. this.bindings.push(binding);
  16488. if (this.isBound) {
  16489. binding.bind(this);
  16490. }
  16491. };
  16492. View.prototype.unbind = function unbind() {
  16493. var controllers = void 0;
  16494. var bindings = void 0;
  16495. var children = void 0;
  16496. var i = void 0;
  16497. var ii = void 0;
  16498. if (this.isBound) {
  16499. this.isBound = false;
  16500. this.resources._invokeHook('beforeUnbind', this);
  16501. if (this.controller !== null) {
  16502. this.controller.unbind();
  16503. }
  16504. bindings = this.bindings;
  16505. for (i = 0, ii = bindings.length; i < ii; ++i) {
  16506. bindings[i].unbind();
  16507. }
  16508. controllers = this.controllers;
  16509. for (i = 0, ii = controllers.length; i < ii; ++i) {
  16510. controllers[i].unbind();
  16511. }
  16512. children = this.children;
  16513. for (i = 0, ii = children.length; i < ii; ++i) {
  16514. children[i].unbind();
  16515. }
  16516. this.bindingContext = null;
  16517. this.overrideContext = null;
  16518. }
  16519. };
  16520. View.prototype.insertNodesBefore = function insertNodesBefore(refNode) {
  16521. refNode.parentNode.insertBefore(this.fragment, refNode);
  16522. };
  16523. View.prototype.appendNodesTo = function appendNodesTo(parent) {
  16524. parent.appendChild(this.fragment);
  16525. };
  16526. View.prototype.removeNodes = function removeNodes() {
  16527. var fragment = this.fragment;
  16528. var current = this.firstChild;
  16529. var end = this.lastChild;
  16530. var next = void 0;
  16531. while (current) {
  16532. next = current.nextSibling;
  16533. fragment.appendChild(current);
  16534. if (current === end) {
  16535. break;
  16536. }
  16537. current = next;
  16538. }
  16539. };
  16540. View.prototype.attached = function attached() {
  16541. var controllers = void 0;
  16542. var children = void 0;
  16543. var i = void 0;
  16544. var ii = void 0;
  16545. if (this.isAttached) {
  16546. return;
  16547. }
  16548. this.isAttached = true;
  16549. if (this.controller !== null) {
  16550. this.controller.attached();
  16551. }
  16552. controllers = this.controllers;
  16553. for (i = 0, ii = controllers.length; i < ii; ++i) {
  16554. controllers[i].attached();
  16555. }
  16556. children = this.children;
  16557. for (i = 0, ii = children.length; i < ii; ++i) {
  16558. children[i].attached();
  16559. }
  16560. };
  16561. View.prototype.detached = function detached() {
  16562. var controllers = void 0;
  16563. var children = void 0;
  16564. var i = void 0;
  16565. var ii = void 0;
  16566. if (this.isAttached) {
  16567. this.isAttached = false;
  16568. if (this.controller !== null) {
  16569. this.controller.detached();
  16570. }
  16571. controllers = this.controllers;
  16572. for (i = 0, ii = controllers.length; i < ii; ++i) {
  16573. controllers[i].detached();
  16574. }
  16575. children = this.children;
  16576. for (i = 0, ii = children.length; i < ii; ++i) {
  16577. children[i].detached();
  16578. }
  16579. }
  16580. };
  16581. return View;
  16582. }();
  16583. function getAnimatableElement(view) {
  16584. if (view.animatableElement !== undefined) {
  16585. return view.animatableElement;
  16586. }
  16587. var current = view.firstChild;
  16588. while (current && current.nodeType !== 1) {
  16589. current = current.nextSibling;
  16590. }
  16591. if (current && current.nodeType === 1) {
  16592. return view.animatableElement = current.classList.contains('au-animate') ? current : null;
  16593. }
  16594. return view.animatableElement = null;
  16595. }
  16596. var ViewSlot = exports.ViewSlot = function () {
  16597. function ViewSlot(anchor, anchorIsContainer) {
  16598. var animator = arguments.length <= 2 || arguments[2] === undefined ? Animator.instance : arguments[2];
  16599. this.anchor = anchor;
  16600. this.anchorIsContainer = anchorIsContainer;
  16601. this.bindingContext = null;
  16602. this.overrideContext = null;
  16603. this.animator = animator;
  16604. this.children = [];
  16605. this.isBound = false;
  16606. this.isAttached = false;
  16607. this.contentSelectors = null;
  16608. anchor.viewSlot = this;
  16609. anchor.isContentProjectionSource = false;
  16610. }
  16611. ViewSlot.prototype.animateView = function animateView(view) {
  16612. var direction = arguments.length <= 1 || arguments[1] === undefined ? 'enter' : arguments[1];
  16613. var animatableElement = getAnimatableElement(view);
  16614. if (animatableElement !== null) {
  16615. switch (direction) {
  16616. case 'enter':
  16617. return this.animator.enter(animatableElement);
  16618. case 'leave':
  16619. return this.animator.leave(animatableElement);
  16620. default:
  16621. throw new Error('Invalid animation direction: ' + direction);
  16622. }
  16623. }
  16624. };
  16625. ViewSlot.prototype.transformChildNodesIntoView = function transformChildNodesIntoView() {
  16626. var parent = this.anchor;
  16627. this.children.push({
  16628. fragment: parent,
  16629. firstChild: parent.firstChild,
  16630. lastChild: parent.lastChild,
  16631. returnToCache: function returnToCache() {},
  16632. removeNodes: function removeNodes() {
  16633. var last = void 0;
  16634. while (last = parent.lastChild) {
  16635. parent.removeChild(last);
  16636. }
  16637. },
  16638. created: function created() {},
  16639. bind: function bind() {},
  16640. unbind: function unbind() {},
  16641. attached: function attached() {},
  16642. detached: function detached() {}
  16643. });
  16644. };
  16645. ViewSlot.prototype.bind = function bind(bindingContext, overrideContext) {
  16646. var i = void 0;
  16647. var ii = void 0;
  16648. var children = void 0;
  16649. if (this.isBound) {
  16650. if (this.bindingContext === bindingContext) {
  16651. return;
  16652. }
  16653. this.unbind();
  16654. }
  16655. this.isBound = true;
  16656. this.bindingContext = bindingContext = bindingContext || this.bindingContext;
  16657. this.overrideContext = overrideContext = overrideContext || this.overrideContext;
  16658. children = this.children;
  16659. for (i = 0, ii = children.length; i < ii; ++i) {
  16660. children[i].bind(bindingContext, overrideContext, true);
  16661. }
  16662. };
  16663. ViewSlot.prototype.unbind = function unbind() {
  16664. if (this.isBound) {
  16665. var i = void 0;
  16666. var ii = void 0;
  16667. var _children4 = this.children;
  16668. this.isBound = false;
  16669. this.bindingContext = null;
  16670. this.overrideContext = null;
  16671. for (i = 0, ii = _children4.length; i < ii; ++i) {
  16672. _children4[i].unbind();
  16673. }
  16674. }
  16675. };
  16676. ViewSlot.prototype.add = function add(view) {
  16677. if (this.anchorIsContainer) {
  16678. view.appendNodesTo(this.anchor);
  16679. } else {
  16680. view.insertNodesBefore(this.anchor);
  16681. }
  16682. this.children.push(view);
  16683. if (this.isAttached) {
  16684. view.attached();
  16685. return this.animateView(view, 'enter');
  16686. }
  16687. };
  16688. ViewSlot.prototype.insert = function insert(index, view) {
  16689. var children = this.children;
  16690. var length = children.length;
  16691. if (index === 0 && length === 0 || index >= length) {
  16692. return this.add(view);
  16693. }
  16694. view.insertNodesBefore(children[index].firstChild);
  16695. children.splice(index, 0, view);
  16696. if (this.isAttached) {
  16697. view.attached();
  16698. return this.animateView(view, 'enter');
  16699. }
  16700. };
  16701. ViewSlot.prototype.move = function move(sourceIndex, targetIndex) {
  16702. if (sourceIndex === targetIndex) {
  16703. return;
  16704. }
  16705. var children = this.children;
  16706. var view = children[sourceIndex];
  16707. view.removeNodes();
  16708. view.insertNodesBefore(children[targetIndex].firstChild);
  16709. children.splice(sourceIndex, 1);
  16710. children.splice(targetIndex, 0, view);
  16711. };
  16712. ViewSlot.prototype.remove = function remove(view, returnToCache, skipAnimation) {
  16713. return this.removeAt(this.children.indexOf(view), returnToCache, skipAnimation);
  16714. };
  16715. ViewSlot.prototype.removeMany = function removeMany(viewsToRemove, returnToCache, skipAnimation) {
  16716. var _this4 = this;
  16717. var children = this.children;
  16718. var ii = viewsToRemove.length;
  16719. var i = void 0;
  16720. var rmPromises = [];
  16721. viewsToRemove.forEach(function (child) {
  16722. if (skipAnimation) {
  16723. child.removeNodes();
  16724. return;
  16725. }
  16726. var animation = _this4.animateView(child, 'leave');
  16727. if (animation) {
  16728. rmPromises.push(animation.then(function () {
  16729. return child.removeNodes();
  16730. }));
  16731. } else {
  16732. child.removeNodes();
  16733. }
  16734. });
  16735. var removeAction = function removeAction() {
  16736. if (_this4.isAttached) {
  16737. for (i = 0; i < ii; ++i) {
  16738. viewsToRemove[i].detached();
  16739. }
  16740. }
  16741. if (returnToCache) {
  16742. for (i = 0; i < ii; ++i) {
  16743. viewsToRemove[i].returnToCache();
  16744. }
  16745. }
  16746. for (i = 0; i < ii; ++i) {
  16747. var index = children.indexOf(viewsToRemove[i]);
  16748. if (index >= 0) {
  16749. children.splice(index, 1);
  16750. }
  16751. }
  16752. };
  16753. if (rmPromises.length > 0) {
  16754. return Promise.all(rmPromises).then(function () {
  16755. return removeAction();
  16756. });
  16757. }
  16758. return removeAction();
  16759. };
  16760. ViewSlot.prototype.removeAt = function removeAt(index, returnToCache, skipAnimation) {
  16761. var _this5 = this;
  16762. var view = this.children[index];
  16763. var removeAction = function removeAction() {
  16764. index = _this5.children.indexOf(view);
  16765. view.removeNodes();
  16766. _this5.children.splice(index, 1);
  16767. if (_this5.isAttached) {
  16768. view.detached();
  16769. }
  16770. if (returnToCache) {
  16771. view.returnToCache();
  16772. }
  16773. return view;
  16774. };
  16775. if (!skipAnimation) {
  16776. var animation = this.animateView(view, 'leave');
  16777. if (animation) {
  16778. return animation.then(function () {
  16779. return removeAction();
  16780. });
  16781. }
  16782. }
  16783. return removeAction();
  16784. };
  16785. ViewSlot.prototype.removeAll = function removeAll(returnToCache, skipAnimation) {
  16786. var _this6 = this;
  16787. var children = this.children;
  16788. var ii = children.length;
  16789. var i = void 0;
  16790. var rmPromises = [];
  16791. children.forEach(function (child) {
  16792. if (skipAnimation) {
  16793. child.removeNodes();
  16794. return;
  16795. }
  16796. var animation = _this6.animateView(child, 'leave');
  16797. if (animation) {
  16798. rmPromises.push(animation.then(function () {
  16799. return child.removeNodes();
  16800. }));
  16801. } else {
  16802. child.removeNodes();
  16803. }
  16804. });
  16805. var removeAction = function removeAction() {
  16806. if (_this6.isAttached) {
  16807. for (i = 0; i < ii; ++i) {
  16808. children[i].detached();
  16809. }
  16810. }
  16811. if (returnToCache) {
  16812. for (i = 0; i < ii; ++i) {
  16813. children[i].returnToCache();
  16814. }
  16815. }
  16816. _this6.children = [];
  16817. };
  16818. if (rmPromises.length > 0) {
  16819. return Promise.all(rmPromises).then(function () {
  16820. return removeAction();
  16821. });
  16822. }
  16823. return removeAction();
  16824. };
  16825. ViewSlot.prototype.attached = function attached() {
  16826. var i = void 0;
  16827. var ii = void 0;
  16828. var children = void 0;
  16829. var child = void 0;
  16830. if (this.isAttached) {
  16831. return;
  16832. }
  16833. this.isAttached = true;
  16834. children = this.children;
  16835. for (i = 0, ii = children.length; i < ii; ++i) {
  16836. child = children[i];
  16837. child.attached();
  16838. this.animateView(child, 'enter');
  16839. }
  16840. };
  16841. ViewSlot.prototype.detached = function detached() {
  16842. var i = void 0;
  16843. var ii = void 0;
  16844. var children = void 0;
  16845. if (this.isAttached) {
  16846. this.isAttached = false;
  16847. children = this.children;
  16848. for (i = 0, ii = children.length; i < ii; ++i) {
  16849. children[i].detached();
  16850. }
  16851. }
  16852. };
  16853. ViewSlot.prototype.projectTo = function projectTo(slots) {
  16854. var _this7 = this;
  16855. this.projectToSlots = slots;
  16856. this.add = this._projectionAdd;
  16857. this.insert = this._projectionInsert;
  16858. this.move = this._projectionMove;
  16859. this.remove = this._projectionRemove;
  16860. this.removeAt = this._projectionRemoveAt;
  16861. this.removeMany = this._projectionRemoveMany;
  16862. this.removeAll = this._projectionRemoveAll;
  16863. this.children.forEach(function (view) {
  16864. return ShadowDOM.distributeView(view, slots, _this7);
  16865. });
  16866. };
  16867. ViewSlot.prototype._projectionAdd = function _projectionAdd(view) {
  16868. ShadowDOM.distributeView(view, this.projectToSlots, this);
  16869. this.children.push(view);
  16870. if (this.isAttached) {
  16871. view.attached();
  16872. }
  16873. };
  16874. ViewSlot.prototype._projectionInsert = function _projectionInsert(index, view) {
  16875. if (index === 0 && !this.children.length || index >= this.children.length) {
  16876. this.add(view);
  16877. } else {
  16878. ShadowDOM.distributeView(view, this.projectToSlots, this, index);
  16879. this.children.splice(index, 0, view);
  16880. if (this.isAttached) {
  16881. view.attached();
  16882. }
  16883. }
  16884. };
  16885. ViewSlot.prototype._projectionMove = function _projectionMove(sourceIndex, targetIndex) {
  16886. if (sourceIndex === targetIndex) {
  16887. return;
  16888. }
  16889. var children = this.children;
  16890. var view = children[sourceIndex];
  16891. ShadowDOM.undistributeView(view, this.projectToSlots, this);
  16892. ShadowDOM.distributeView(view, this.projectToSlots, this, targetIndex);
  16893. children.splice(sourceIndex, 1);
  16894. children.splice(targetIndex, 0, view);
  16895. };
  16896. ViewSlot.prototype._projectionRemove = function _projectionRemove(view, returnToCache) {
  16897. ShadowDOM.undistributeView(view, this.projectToSlots, this);
  16898. this.children.splice(this.children.indexOf(view), 1);
  16899. if (this.isAttached) {
  16900. view.detached();
  16901. }
  16902. };
  16903. ViewSlot.prototype._projectionRemoveAt = function _projectionRemoveAt(index, returnToCache) {
  16904. var view = this.children[index];
  16905. ShadowDOM.undistributeView(view, this.projectToSlots, this);
  16906. this.children.splice(index, 1);
  16907. if (this.isAttached) {
  16908. view.detached();
  16909. }
  16910. };
  16911. ViewSlot.prototype._projectionRemoveMany = function _projectionRemoveMany(viewsToRemove, returnToCache) {
  16912. var _this8 = this;
  16913. viewsToRemove.forEach(function (view) {
  16914. return _this8.remove(view, returnToCache);
  16915. });
  16916. };
  16917. ViewSlot.prototype._projectionRemoveAll = function _projectionRemoveAll(returnToCache) {
  16918. ShadowDOM.undistributeAll(this.projectToSlots, this);
  16919. var children = this.children;
  16920. if (this.isAttached) {
  16921. for (var i = 0, ii = children.length; i < ii; ++i) {
  16922. children[i].detached();
  16923. }
  16924. }
  16925. this.children = [];
  16926. };
  16927. return ViewSlot;
  16928. }();
  16929. var ProviderResolver = (0, _aureliaDependencyInjection.resolver)(_class15 = function () {
  16930. function ProviderResolver() {
  16931. }
  16932. ProviderResolver.prototype.get = function get(container, key) {
  16933. var id = key.__providerId__;
  16934. return id in container ? container[id] : container[id] = container.invoke(key);
  16935. };
  16936. return ProviderResolver;
  16937. }()) || _class15;
  16938. var providerResolverInstance = new ProviderResolver();
  16939. function elementContainerGet(key) {
  16940. if (key === _aureliaPal.DOM.Element) {
  16941. return this.element;
  16942. }
  16943. if (key === BoundViewFactory) {
  16944. if (this.boundViewFactory) {
  16945. return this.boundViewFactory;
  16946. }
  16947. var factory = this.instruction.viewFactory;
  16948. var _partReplacements = this.partReplacements;
  16949. if (_partReplacements) {
  16950. factory = _partReplacements[factory.part] || factory;
  16951. }
  16952. this.boundViewFactory = new BoundViewFactory(this, factory, _partReplacements);
  16953. return this.boundViewFactory;
  16954. }
  16955. if (key === ViewSlot) {
  16956. if (this.viewSlot === undefined) {
  16957. this.viewSlot = new ViewSlot(this.element, this.instruction.anchorIsContainer);
  16958. this.element.isContentProjectionSource = this.instruction.lifting;
  16959. this.children.push(this.viewSlot);
  16960. }
  16961. return this.viewSlot;
  16962. }
  16963. if (key === ElementEvents) {
  16964. return this.elementEvents || (this.elementEvents = new ElementEvents(this.element));
  16965. }
  16966. if (key === CompositionTransaction) {
  16967. return this.compositionTransaction || (this.compositionTransaction = this.parent.get(key));
  16968. }
  16969. if (key === ViewResources) {
  16970. return this.viewResources;
  16971. }
  16972. if (key === TargetInstruction) {
  16973. return this.instruction;
  16974. }
  16975. return this.superGet(key);
  16976. }
  16977. function createElementContainer(parent, element, instruction, children, partReplacements, resources) {
  16978. var container = parent.createChild();
  16979. var providers = void 0;
  16980. var i = void 0;
  16981. container.element = element;
  16982. container.instruction = instruction;
  16983. container.children = children;
  16984. container.viewResources = resources;
  16985. container.partReplacements = partReplacements;
  16986. providers = instruction.providers;
  16987. i = providers.length;
  16988. while (i--) {
  16989. container._resolvers.set(providers[i], providerResolverInstance);
  16990. }
  16991. container.superGet = container.get;
  16992. container.get = elementContainerGet;
  16993. return container;
  16994. }
  16995. function makeElementIntoAnchor(element, elementInstruction) {
  16996. var anchor = _aureliaPal.DOM.createComment('anchor');
  16997. if (elementInstruction) {
  16998. var firstChild = element.firstChild;
  16999. if (firstChild && firstChild.tagName === 'AU-CONTENT') {
  17000. anchor.contentElement = firstChild;
  17001. }
  17002. anchor.hasAttribute = function (name) {
  17003. return element.hasAttribute(name);
  17004. };
  17005. anchor.getAttribute = function (name) {
  17006. return element.getAttribute(name);
  17007. };
  17008. anchor.setAttribute = function (name, value) {
  17009. element.setAttribute(name, value);
  17010. };
  17011. }
  17012. _aureliaPal.DOM.replaceNode(anchor, element);
  17013. return anchor;
  17014. }
  17015. function applyInstructions(containers, element, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources) {
  17016. var behaviorInstructions = instruction.behaviorInstructions;
  17017. var expressions = instruction.expressions;
  17018. var elementContainer = void 0;
  17019. var i = void 0;
  17020. var ii = void 0;
  17021. var current = void 0;
  17022. var instance = void 0;
  17023. if (instruction.contentExpression) {
  17024. bindings.push(instruction.contentExpression.createBinding(element.nextSibling));
  17025. element.nextSibling.auInterpolationTarget = true;
  17026. element.parentNode.removeChild(element);
  17027. return;
  17028. }
  17029. if (instruction.shadowSlot) {
  17030. var commentAnchor = _aureliaPal.DOM.createComment('slot');
  17031. var slot = void 0;
  17032. if (instruction.slotDestination) {
  17033. slot = new PassThroughSlot(commentAnchor, instruction.slotName, instruction.slotDestination, instruction.slotFallbackFactory);
  17034. } else {
  17035. slot = new ShadowSlot(commentAnchor, instruction.slotName, instruction.slotFallbackFactory);
  17036. }
  17037. _aureliaPal.DOM.replaceNode(commentAnchor, element);
  17038. shadowSlots[instruction.slotName] = slot;
  17039. controllers.push(slot);
  17040. return;
  17041. }
  17042. if (behaviorInstructions.length) {
  17043. if (!instruction.anchorIsContainer) {
  17044. element = makeElementIntoAnchor(element, instruction.elementInstruction);
  17045. }
  17046. containers[instruction.injectorId] = elementContainer = createElementContainer(containers[instruction.parentInjectorId], element, instruction, children, partReplacements, resources);
  17047. for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {
  17048. current = behaviorInstructions[i];
  17049. instance = current.type.create(elementContainer, current, element, bindings);
  17050. controllers.push(instance);
  17051. }
  17052. }
  17053. for (i = 0, ii = expressions.length; i < ii; ++i) {
  17054. bindings.push(expressions[i].createBinding(element));
  17055. }
  17056. }
  17057. function styleStringToObject(style, target) {
  17058. var attributes = style.split(';');
  17059. var firstIndexOfColon = void 0;
  17060. var i = void 0;
  17061. var current = void 0;
  17062. var key = void 0;
  17063. var value = void 0;
  17064. target = target || {};
  17065. for (i = 0; i < attributes.length; i++) {
  17066. current = attributes[i];
  17067. firstIndexOfColon = current.indexOf(':');
  17068. key = current.substring(0, firstIndexOfColon).trim();
  17069. value = current.substring(firstIndexOfColon + 1).trim();
  17070. target[key] = value;
  17071. }
  17072. return target;
  17073. }
  17074. function styleObjectToString(obj) {
  17075. var result = '';
  17076. for (var key in obj) {
  17077. result += key + ':' + obj[key] + ';';
  17078. }
  17079. return result;
  17080. }
  17081. function applySurrogateInstruction(container, element, instruction, controllers, bindings, children) {
  17082. var behaviorInstructions = instruction.behaviorInstructions;
  17083. var expressions = instruction.expressions;
  17084. var providers = instruction.providers;
  17085. var values = instruction.values;
  17086. var i = void 0;
  17087. var ii = void 0;
  17088. var current = void 0;
  17089. var instance = void 0;
  17090. var currentAttributeValue = void 0;
  17091. i = providers.length;
  17092. while (i--) {
  17093. container._resolvers.set(providers[i], providerResolverInstance);
  17094. }
  17095. for (var key in values) {
  17096. currentAttributeValue = element.getAttribute(key);
  17097. if (currentAttributeValue) {
  17098. if (key === 'class') {
  17099. element.setAttribute('class', currentAttributeValue + ' ' + values[key]);
  17100. } else if (key === 'style') {
  17101. var styleObject = styleStringToObject(values[key]);
  17102. styleStringToObject(currentAttributeValue, styleObject);
  17103. element.setAttribute('style', styleObjectToString(styleObject));
  17104. }
  17105. } else {
  17106. element.setAttribute(key, values[key]);
  17107. }
  17108. }
  17109. if (behaviorInstructions.length) {
  17110. for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {
  17111. current = behaviorInstructions[i];
  17112. instance = current.type.create(container, current, element, bindings);
  17113. if (instance.contentView) {
  17114. children.push(instance.contentView);
  17115. }
  17116. controllers.push(instance);
  17117. }
  17118. }
  17119. for (i = 0, ii = expressions.length; i < ii; ++i) {
  17120. bindings.push(expressions[i].createBinding(element));
  17121. }
  17122. }
  17123. var BoundViewFactory = exports.BoundViewFactory = function () {
  17124. function BoundViewFactory(parentContainer, viewFactory, partReplacements) {
  17125. this.parentContainer = parentContainer;
  17126. this.viewFactory = viewFactory;
  17127. this.factoryCreateInstruction = { partReplacements: partReplacements };
  17128. }
  17129. BoundViewFactory.prototype.create = function create() {
  17130. var view = this.viewFactory.create(this.parentContainer.createChild(), this.factoryCreateInstruction);
  17131. view._isUserControlled = true;
  17132. return view;
  17133. };
  17134. BoundViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) {
  17135. this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet);
  17136. };
  17137. BoundViewFactory.prototype.getCachedView = function getCachedView() {
  17138. return this.viewFactory.getCachedView();
  17139. };
  17140. BoundViewFactory.prototype.returnViewToCache = function returnViewToCache(view) {
  17141. this.viewFactory.returnViewToCache(view);
  17142. };
  17143. _createClass(BoundViewFactory, [{
  17144. key: 'isCaching',
  17145. get: function get() {
  17146. return this.viewFactory.isCaching;
  17147. }
  17148. }]);
  17149. return BoundViewFactory;
  17150. }();
  17151. var ViewFactory = exports.ViewFactory = function () {
  17152. function ViewFactory(template, instructions, resources) {
  17153. this.isCaching = false;
  17154. this.template = template;
  17155. this.instructions = instructions;
  17156. this.resources = resources;
  17157. this.cacheSize = -1;
  17158. this.cache = null;
  17159. }
  17160. ViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) {
  17161. if (size) {
  17162. if (size === '*') {
  17163. size = Number.MAX_VALUE;
  17164. } else if (typeof size === 'string') {
  17165. size = parseInt(size, 10);
  17166. }
  17167. }
  17168. if (this.cacheSize === -1 || !doNotOverrideIfAlreadySet) {
  17169. this.cacheSize = size;
  17170. }
  17171. if (this.cacheSize > 0) {
  17172. this.cache = [];
  17173. } else {
  17174. this.cache = null;
  17175. }
  17176. this.isCaching = this.cacheSize > 0;
  17177. };
  17178. ViewFactory.prototype.getCachedView = function getCachedView() {
  17179. return this.cache !== null ? this.cache.pop() || null : null;
  17180. };
  17181. ViewFactory.prototype.returnViewToCache = function returnViewToCache(view) {
  17182. if (view.isAttached) {
  17183. view.detached();
  17184. }
  17185. if (view.isBound) {
  17186. view.unbind();
  17187. }
  17188. if (this.cache !== null && this.cache.length < this.cacheSize) {
  17189. view.fromCache = true;
  17190. this.cache.push(view);
  17191. }
  17192. };
  17193. ViewFactory.prototype.create = function create(container, createInstruction, element) {
  17194. createInstruction = createInstruction || BehaviorInstruction.normal;
  17195. var cachedView = this.getCachedView();
  17196. if (cachedView !== null) {
  17197. return cachedView;
  17198. }
  17199. var fragment = createInstruction.enhance ? this.template : this.template.cloneNode(true);
  17200. var instructables = fragment.querySelectorAll('.au-target');
  17201. var instructions = this.instructions;
  17202. var resources = this.resources;
  17203. var controllers = [];
  17204. var bindings = [];
  17205. var children = [];
  17206. var shadowSlots = Object.create(null);
  17207. var containers = { root: container };
  17208. var partReplacements = createInstruction.partReplacements;
  17209. var i = void 0;
  17210. var ii = void 0;
  17211. var view = void 0;
  17212. var instructable = void 0;
  17213. var instruction = void 0;
  17214. this.resources._invokeHook('beforeCreate', this, container, fragment, createInstruction);
  17215. if (element && this.surrogateInstruction !== null) {
  17216. applySurrogateInstruction(container, element, this.surrogateInstruction, controllers, bindings, children);
  17217. }
  17218. if (createInstruction.enhance && fragment.hasAttribute('au-target-id')) {
  17219. instructable = fragment;
  17220. instruction = instructions[instructable.getAttribute('au-target-id')];
  17221. applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources);
  17222. }
  17223. for (i = 0, ii = instructables.length; i < ii; ++i) {
  17224. instructable = instructables[i];
  17225. instruction = instructions[instructable.getAttribute('au-target-id')];
  17226. applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources);
  17227. }
  17228. view = new View(container, this, fragment, controllers, bindings, children, shadowSlots);
  17229. if (!createInstruction.initiatedByBehavior) {
  17230. view.created();
  17231. }
  17232. this.resources._invokeHook('afterCreate', view);
  17233. return view;
  17234. };
  17235. return ViewFactory;
  17236. }();
  17237. var nextInjectorId = 0;
  17238. function getNextInjectorId() {
  17239. return ++nextInjectorId;
  17240. }
  17241. function configureProperties(instruction, resources) {
  17242. var type = instruction.type;
  17243. var attrName = instruction.attrName;
  17244. var attributes = instruction.attributes;
  17245. var property = void 0;
  17246. var key = void 0;
  17247. var value = void 0;
  17248. var knownAttribute = resources.mapAttribute(attrName);
  17249. if (knownAttribute && attrName in attributes && knownAttribute !== attrName) {
  17250. attributes[knownAttribute] = attributes[attrName];
  17251. delete attributes[attrName];
  17252. }
  17253. for (key in attributes) {
  17254. value = attributes[key];
  17255. if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
  17256. property = type.attributes[key];
  17257. if (property !== undefined) {
  17258. value.targetProperty = property.name;
  17259. } else {
  17260. value.targetProperty = key;
  17261. }
  17262. }
  17263. }
  17264. }
  17265. var lastAUTargetID = 0;
  17266. function getNextAUTargetID() {
  17267. return (++lastAUTargetID).toString();
  17268. }
  17269. function makeIntoInstructionTarget(element) {
  17270. var value = element.getAttribute('class');
  17271. var auTargetID = getNextAUTargetID();
  17272. element.setAttribute('class', value ? value += ' au-target' : 'au-target');
  17273. element.setAttribute('au-target-id', auTargetID);
  17274. return auTargetID;
  17275. }
  17276. function makeShadowSlot(compiler, resources, node, instructions, parentInjectorId) {
  17277. var auShadowSlot = _aureliaPal.DOM.createElement('au-shadow-slot');
  17278. _aureliaPal.DOM.replaceNode(auShadowSlot, node);
  17279. var auTargetID = makeIntoInstructionTarget(auShadowSlot);
  17280. var instruction = TargetInstruction.shadowSlot(parentInjectorId);
  17281. instruction.slotName = node.getAttribute('name') || ShadowDOM.defaultSlotKey;
  17282. instruction.slotDestination = node.getAttribute('slot');
  17283. if (node.innerHTML.trim()) {
  17284. var fragment = _aureliaPal.DOM.createDocumentFragment();
  17285. var _child3 = void 0;
  17286. while (_child3 = node.firstChild) {
  17287. fragment.appendChild(_child3);
  17288. }
  17289. instruction.slotFallbackFactory = compiler.compile(fragment, resources);
  17290. }
  17291. instructions[auTargetID] = instruction;
  17292. return auShadowSlot;
  17293. }
  17294. var ViewCompiler = exports.ViewCompiler = (_dec7 = (0, _aureliaDependencyInjection.inject)(BindingLanguage, ViewResources), _dec7(_class17 = function () {
  17295. function ViewCompiler(bindingLanguage, resources) {
  17296. this.bindingLanguage = bindingLanguage;
  17297. this.resources = resources;
  17298. }
  17299. ViewCompiler.prototype.compile = function compile(source, resources, compileInstruction) {
  17300. resources = resources || this.resources;
  17301. compileInstruction = compileInstruction || ViewCompileInstruction.normal;
  17302. source = typeof source === 'string' ? _aureliaPal.DOM.createTemplateFromMarkup(source) : source;
  17303. var content = void 0;
  17304. var part = void 0;
  17305. var cacheSize = void 0;
  17306. if (source.content) {
  17307. part = source.getAttribute('part');
  17308. cacheSize = source.getAttribute('view-cache');
  17309. content = _aureliaPal.DOM.adoptNode(source.content);
  17310. } else {
  17311. content = source;
  17312. }
  17313. compileInstruction.targetShadowDOM = compileInstruction.targetShadowDOM && _aureliaPal.FEATURE.shadowDOM;
  17314. resources._invokeHook('beforeCompile', content, resources, compileInstruction);
  17315. var instructions = {};
  17316. this._compileNode(content, resources, instructions, source, 'root', !compileInstruction.targetShadowDOM);
  17317. var firstChild = content.firstChild;
  17318. if (firstChild && firstChild.nodeType === 1) {
  17319. var targetId = firstChild.getAttribute('au-target-id');
  17320. if (targetId) {
  17321. var ins = instructions[targetId];
  17322. if (ins.shadowSlot || ins.lifting) {
  17323. content.insertBefore(_aureliaPal.DOM.createComment('view'), firstChild);
  17324. }
  17325. }
  17326. }
  17327. var factory = new ViewFactory(content, instructions, resources);
  17328. factory.surrogateInstruction = compileInstruction.compileSurrogate ? this._compileSurrogate(source, resources) : null;
  17329. factory.part = part;
  17330. if (cacheSize) {
  17331. factory.setCacheSize(cacheSize);
  17332. }
  17333. resources._invokeHook('afterCompile', factory);
  17334. return factory;
  17335. };
  17336. ViewCompiler.prototype._compileNode = function _compileNode(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) {
  17337. switch (node.nodeType) {
  17338. case 1:
  17339. return this._compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM);
  17340. case 3:
  17341. var expression = resources.getBindingLanguage(this.bindingLanguage).inspectTextContent(resources, node.wholeText);
  17342. if (expression) {
  17343. var marker = _aureliaPal.DOM.createElement('au-marker');
  17344. var auTargetID = makeIntoInstructionTarget(marker);
  17345. (node.parentNode || parentNode).insertBefore(marker, node);
  17346. node.textContent = ' ';
  17347. instructions[auTargetID] = TargetInstruction.contentExpression(expression);
  17348. while (node.nextSibling && node.nextSibling.nodeType === 3) {
  17349. (node.parentNode || parentNode).removeChild(node.nextSibling);
  17350. }
  17351. } else {
  17352. while (node.nextSibling && node.nextSibling.nodeType === 3) {
  17353. node = node.nextSibling;
  17354. }
  17355. }
  17356. return node.nextSibling;
  17357. case 11:
  17358. var currentChild = node.firstChild;
  17359. while (currentChild) {
  17360. currentChild = this._compileNode(currentChild, resources, instructions, node, parentInjectorId, targetLightDOM);
  17361. }
  17362. break;
  17363. default:
  17364. break;
  17365. }
  17366. return node.nextSibling;
  17367. };
  17368. ViewCompiler.prototype._compileSurrogate = function _compileSurrogate(node, resources) {
  17369. var tagName = node.tagName.toLowerCase();
  17370. var attributes = node.attributes;
  17371. var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage);
  17372. var knownAttribute = void 0;
  17373. var property = void 0;
  17374. var instruction = void 0;
  17375. var i = void 0;
  17376. var ii = void 0;
  17377. var attr = void 0;
  17378. var attrName = void 0;
  17379. var attrValue = void 0;
  17380. var info = void 0;
  17381. var type = void 0;
  17382. var expressions = [];
  17383. var expression = void 0;
  17384. var behaviorInstructions = [];
  17385. var values = {};
  17386. var hasValues = false;
  17387. var providers = [];
  17388. for (i = 0, ii = attributes.length; i < ii; ++i) {
  17389. attr = attributes[i];
  17390. attrName = attr.name;
  17391. attrValue = attr.value;
  17392. info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue);
  17393. type = resources.getAttribute(info.attrName);
  17394. if (type) {
  17395. knownAttribute = resources.mapAttribute(info.attrName);
  17396. if (knownAttribute) {
  17397. property = type.attributes[knownAttribute];
  17398. if (property) {
  17399. info.defaultBindingMode = property.defaultBindingMode;
  17400. if (!info.command && !info.expression) {
  17401. info.command = property.hasOptions ? 'options' : null;
  17402. }
  17403. }
  17404. }
  17405. }
  17406. instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type);
  17407. if (instruction) {
  17408. if (instruction.alteredAttr) {
  17409. type = resources.getAttribute(instruction.attrName);
  17410. }
  17411. if (instruction.discrete) {
  17412. expressions.push(instruction);
  17413. } else {
  17414. if (type) {
  17415. instruction.type = type;
  17416. configureProperties(instruction, resources);
  17417. if (type.liftsContent) {
  17418. throw new Error('You cannot place a template controller on a surrogate element.');
  17419. } else {
  17420. behaviorInstructions.push(instruction);
  17421. }
  17422. } else {
  17423. expressions.push(instruction.attributes[instruction.attrName]);
  17424. }
  17425. }
  17426. } else {
  17427. if (type) {
  17428. instruction = BehaviorInstruction.attribute(attrName, type);
  17429. instruction.attributes[resources.mapAttribute(attrName)] = attrValue;
  17430. if (type.liftsContent) {
  17431. throw new Error('You cannot place a template controller on a surrogate element.');
  17432. } else {
  17433. behaviorInstructions.push(instruction);
  17434. }
  17435. } else if (attrName !== 'id' && attrName !== 'part' && attrName !== 'replace-part') {
  17436. hasValues = true;
  17437. values[attrName] = attrValue;
  17438. }
  17439. }
  17440. }
  17441. if (expressions.length || behaviorInstructions.length || hasValues) {
  17442. for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {
  17443. instruction = behaviorInstructions[i];
  17444. instruction.type.compile(this, resources, node, instruction);
  17445. providers.push(instruction.type.target);
  17446. }
  17447. for (i = 0, ii = expressions.length; i < ii; ++i) {
  17448. expression = expressions[i];
  17449. if (expression.attrToRemove !== undefined) {
  17450. node.removeAttribute(expression.attrToRemove);
  17451. }
  17452. }
  17453. return TargetInstruction.surrogate(providers, behaviorInstructions, expressions, values);
  17454. }
  17455. return null;
  17456. };
  17457. ViewCompiler.prototype._compileElement = function _compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) {
  17458. var tagName = node.tagName.toLowerCase();
  17459. var attributes = node.attributes;
  17460. var expressions = [];
  17461. var expression = void 0;
  17462. var behaviorInstructions = [];
  17463. var providers = [];
  17464. var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage);
  17465. var liftingInstruction = void 0;
  17466. var viewFactory = void 0;
  17467. var type = void 0;
  17468. var elementInstruction = void 0;
  17469. var elementProperty = void 0;
  17470. var i = void 0;
  17471. var ii = void 0;
  17472. var attr = void 0;
  17473. var attrName = void 0;
  17474. var attrValue = void 0;
  17475. var instruction = void 0;
  17476. var info = void 0;
  17477. var property = void 0;
  17478. var knownAttribute = void 0;
  17479. var auTargetID = void 0;
  17480. var injectorId = void 0;
  17481. if (tagName === 'slot') {
  17482. if (targetLightDOM) {
  17483. node = makeShadowSlot(this, resources, node, instructions, parentInjectorId);
  17484. }
  17485. return node.nextSibling;
  17486. } else if (tagName === 'template') {
  17487. viewFactory = this.compile(node, resources);
  17488. viewFactory.part = node.getAttribute('part');
  17489. } else {
  17490. type = resources.getElement(node.getAttribute('as-element') || tagName);
  17491. if (type) {
  17492. elementInstruction = BehaviorInstruction.element(node, type);
  17493. type.processAttributes(this, resources, node, attributes, elementInstruction);
  17494. behaviorInstructions.push(elementInstruction);
  17495. }
  17496. }
  17497. for (i = 0, ii = attributes.length; i < ii; ++i) {
  17498. attr = attributes[i];
  17499. attrName = attr.name;
  17500. attrValue = attr.value;
  17501. info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue);
  17502. if (targetLightDOM && info.attrName === 'slot') {
  17503. info.attrName = attrName = 'au-slot';
  17504. }
  17505. type = resources.getAttribute(info.attrName);
  17506. elementProperty = null;
  17507. if (type) {
  17508. knownAttribute = resources.mapAttribute(info.attrName);
  17509. if (knownAttribute) {
  17510. property = type.attributes[knownAttribute];
  17511. if (property) {
  17512. info.defaultBindingMode = property.defaultBindingMode;
  17513. if (!info.command && !info.expression) {
  17514. info.command = property.hasOptions ? 'options' : null;
  17515. }
  17516. }
  17517. }
  17518. } else if (elementInstruction) {
  17519. elementProperty = elementInstruction.type.attributes[info.attrName];
  17520. if (elementProperty) {
  17521. info.defaultBindingMode = elementProperty.defaultBindingMode;
  17522. }
  17523. }
  17524. if (elementProperty) {
  17525. instruction = bindingLanguage.createAttributeInstruction(resources, node, info, elementInstruction);
  17526. } else {
  17527. instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type);
  17528. }
  17529. if (instruction) {
  17530. if (instruction.alteredAttr) {
  17531. type = resources.getAttribute(instruction.attrName);
  17532. }
  17533. if (instruction.discrete) {
  17534. expressions.push(instruction);
  17535. } else {
  17536. if (type) {
  17537. instruction.type = type;
  17538. configureProperties(instruction, resources);
  17539. if (type.liftsContent) {
  17540. instruction.originalAttrName = attrName;
  17541. liftingInstruction = instruction;
  17542. break;
  17543. } else {
  17544. behaviorInstructions.push(instruction);
  17545. }
  17546. } else if (elementProperty) {
  17547. elementInstruction.attributes[info.attrName].targetProperty = elementProperty.name;
  17548. } else {
  17549. expressions.push(instruction.attributes[instruction.attrName]);
  17550. }
  17551. }
  17552. } else {
  17553. if (type) {
  17554. instruction = BehaviorInstruction.attribute(attrName, type);
  17555. instruction.attributes[resources.mapAttribute(attrName)] = attrValue;
  17556. if (type.liftsContent) {
  17557. instruction.originalAttrName = attrName;
  17558. liftingInstruction = instruction;
  17559. break;
  17560. } else {
  17561. behaviorInstructions.push(instruction);
  17562. }
  17563. } else if (elementProperty) {
  17564. elementInstruction.attributes[attrName] = attrValue;
  17565. }
  17566. }
  17567. }
  17568. if (liftingInstruction) {
  17569. liftingInstruction.viewFactory = viewFactory;
  17570. node = liftingInstruction.type.compile(this, resources, node, liftingInstruction, parentNode);
  17571. auTargetID = makeIntoInstructionTarget(node);
  17572. instructions[auTargetID] = TargetInstruction.lifting(parentInjectorId, liftingInstruction);
  17573. } else {
  17574. if (expressions.length || behaviorInstructions.length) {
  17575. injectorId = behaviorInstructions.length ? getNextInjectorId() : false;
  17576. for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {
  17577. instruction = behaviorInstructions[i];
  17578. instruction.type.compile(this, resources, node, instruction, parentNode);
  17579. providers.push(instruction.type.target);
  17580. }
  17581. for (i = 0, ii = expressions.length; i < ii; ++i) {
  17582. expression = expressions[i];
  17583. if (expression.attrToRemove !== undefined) {
  17584. node.removeAttribute(expression.attrToRemove);
  17585. }
  17586. }
  17587. auTargetID = makeIntoInstructionTarget(node);
  17588. instructions[auTargetID] = TargetInstruction.normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction);
  17589. }
  17590. if (elementInstruction && elementInstruction.skipContentProcessing) {
  17591. return node.nextSibling;
  17592. }
  17593. var currentChild = node.firstChild;
  17594. while (currentChild) {
  17595. currentChild = this._compileNode(currentChild, resources, instructions, node, injectorId || parentInjectorId, targetLightDOM);
  17596. }
  17597. }
  17598. return node.nextSibling;
  17599. };
  17600. return ViewCompiler;
  17601. }()) || _class17);
  17602. var ResourceModule = exports.ResourceModule = function () {
  17603. function ResourceModule(moduleId) {
  17604. this.id = moduleId;
  17605. this.moduleInstance = null;
  17606. this.mainResource = null;
  17607. this.resources = null;
  17608. this.viewStrategy = null;
  17609. this.isInitialized = false;
  17610. this.onLoaded = null;
  17611. this.loadContext = null;
  17612. }
  17613. ResourceModule.prototype.initialize = function initialize(container) {
  17614. var current = this.mainResource;
  17615. var resources = this.resources;
  17616. var vs = this.viewStrategy;
  17617. if (this.isInitialized) {
  17618. return;
  17619. }
  17620. this.isInitialized = true;
  17621. if (current !== undefined) {
  17622. current.metadata.viewStrategy = vs;
  17623. current.initialize(container);
  17624. }
  17625. for (var i = 0, ii = resources.length; i < ii; ++i) {
  17626. current = resources[i];
  17627. current.metadata.viewStrategy = vs;
  17628. current.initialize(container);
  17629. }
  17630. };
  17631. ResourceModule.prototype.register = function register(registry, name) {
  17632. var main = this.mainResource;
  17633. var resources = this.resources;
  17634. if (main !== undefined) {
  17635. main.register(registry, name);
  17636. name = null;
  17637. }
  17638. for (var i = 0, ii = resources.length; i < ii; ++i) {
  17639. resources[i].register(registry, name);
  17640. name = null;
  17641. }
  17642. };
  17643. ResourceModule.prototype.load = function load(container, loadContext) {
  17644. if (this.onLoaded !== null) {
  17645. return this.loadContext === loadContext ? Promise.resolve() : this.onLoaded;
  17646. }
  17647. var main = this.mainResource;
  17648. var resources = this.resources;
  17649. var loads = void 0;
  17650. if (main !== undefined) {
  17651. loads = new Array(resources.length + 1);
  17652. loads[0] = main.load(container, loadContext);
  17653. for (var i = 0, ii = resources.length; i < ii; ++i) {
  17654. loads[i + 1] = resources[i].load(container, loadContext);
  17655. }
  17656. } else {
  17657. loads = new Array(resources.length);
  17658. for (var _i = 0, _ii = resources.length; _i < _ii; ++_i) {
  17659. loads[_i] = resources[_i].load(container, loadContext);
  17660. }
  17661. }
  17662. this.loadContext = loadContext;
  17663. this.onLoaded = Promise.all(loads);
  17664. return this.onLoaded;
  17665. };
  17666. return ResourceModule;
  17667. }();
  17668. var ResourceDescription = exports.ResourceDescription = function () {
  17669. function ResourceDescription(key, exportedValue, resourceTypeMeta) {
  17670. if (!resourceTypeMeta) {
  17671. resourceTypeMeta = _aureliaMetadata.metadata.get(_aureliaMetadata.metadata.resource, exportedValue);
  17672. if (!resourceTypeMeta) {
  17673. resourceTypeMeta = new HtmlBehaviorResource();
  17674. resourceTypeMeta.elementName = _hyphenate(key);
  17675. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, resourceTypeMeta, exportedValue);
  17676. }
  17677. }
  17678. if (resourceTypeMeta instanceof HtmlBehaviorResource) {
  17679. if (resourceTypeMeta.elementName === undefined) {
  17680. resourceTypeMeta.elementName = _hyphenate(key);
  17681. } else if (resourceTypeMeta.attributeName === undefined) {
  17682. resourceTypeMeta.attributeName = _hyphenate(key);
  17683. } else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
  17684. HtmlBehaviorResource.convention(key, resourceTypeMeta);
  17685. }
  17686. } else if (!resourceTypeMeta.name) {
  17687. resourceTypeMeta.name = _hyphenate(key);
  17688. }
  17689. this.metadata = resourceTypeMeta;
  17690. this.value = exportedValue;
  17691. }
  17692. ResourceDescription.prototype.initialize = function initialize(container) {
  17693. this.metadata.initialize(container, this.value);
  17694. };
  17695. ResourceDescription.prototype.register = function register(registry, name) {
  17696. this.metadata.register(registry, name);
  17697. };
  17698. ResourceDescription.prototype.load = function load(container, loadContext) {
  17699. return this.metadata.load(container, this.value, loadContext);
  17700. };
  17701. return ResourceDescription;
  17702. }();
  17703. var ModuleAnalyzer = exports.ModuleAnalyzer = function () {
  17704. function ModuleAnalyzer() {
  17705. this.cache = Object.create(null);
  17706. }
  17707. ModuleAnalyzer.prototype.getAnalysis = function getAnalysis(moduleId) {
  17708. return this.cache[moduleId];
  17709. };
  17710. ModuleAnalyzer.prototype.analyze = function analyze(moduleId, moduleInstance, mainResourceKey) {
  17711. var mainResource = void 0;
  17712. var fallbackValue = void 0;
  17713. var fallbackKey = void 0;
  17714. var resourceTypeMeta = void 0;
  17715. var key = void 0;
  17716. var exportedValue = void 0;
  17717. var resources = [];
  17718. var conventional = void 0;
  17719. var vs = void 0;
  17720. var resourceModule = void 0;
  17721. resourceModule = this.cache[moduleId];
  17722. if (resourceModule) {
  17723. return resourceModule;
  17724. }
  17725. resourceModule = new ResourceModule(moduleId);
  17726. this.cache[moduleId] = resourceModule;
  17727. if (typeof moduleInstance === 'function') {
  17728. moduleInstance = { 'default': moduleInstance };
  17729. }
  17730. if (mainResourceKey) {
  17731. mainResource = new ResourceDescription(mainResourceKey, moduleInstance[mainResourceKey]);
  17732. }
  17733. for (key in moduleInstance) {
  17734. exportedValue = moduleInstance[key];
  17735. if (key === mainResourceKey || typeof exportedValue !== 'function') {
  17736. continue;
  17737. }
  17738. resourceTypeMeta = _aureliaMetadata.metadata.get(_aureliaMetadata.metadata.resource, exportedValue);
  17739. if (resourceTypeMeta) {
  17740. if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
  17741. HtmlBehaviorResource.convention(key, resourceTypeMeta);
  17742. }
  17743. if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
  17744. resourceTypeMeta.elementName = _hyphenate(key);
  17745. }
  17746. if (!mainResource && resourceTypeMeta instanceof HtmlBehaviorResource && resourceTypeMeta.elementName !== null) {
  17747. mainResource = new ResourceDescription(key, exportedValue, resourceTypeMeta);
  17748. } else {
  17749. resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta));
  17750. }
  17751. } else if (viewStrategy.decorates(exportedValue)) {
  17752. vs = exportedValue;
  17753. } else if (exportedValue instanceof _aureliaLoader.TemplateRegistryEntry) {
  17754. vs = new TemplateRegistryViewStrategy(moduleId, exportedValue);
  17755. } else {
  17756. if (conventional = HtmlBehaviorResource.convention(key)) {
  17757. if (conventional.elementName !== null && !mainResource) {
  17758. mainResource = new ResourceDescription(key, exportedValue, conventional);
  17759. } else {
  17760. resources.push(new ResourceDescription(key, exportedValue, conventional));
  17761. }
  17762. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, conventional, exportedValue);
  17763. } else if (conventional = _aureliaBinding.ValueConverterResource.convention(key) || _aureliaBinding.BindingBehaviorResource.convention(key) || ViewEngineHooksResource.convention(key)) {
  17764. resources.push(new ResourceDescription(key, exportedValue, conventional));
  17765. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, conventional, exportedValue);
  17766. } else if (!fallbackValue) {
  17767. fallbackValue = exportedValue;
  17768. fallbackKey = key;
  17769. }
  17770. }
  17771. }
  17772. if (!mainResource && fallbackValue) {
  17773. mainResource = new ResourceDescription(fallbackKey, fallbackValue);
  17774. }
  17775. resourceModule.moduleInstance = moduleInstance;
  17776. resourceModule.mainResource = mainResource;
  17777. resourceModule.resources = resources;
  17778. resourceModule.viewStrategy = vs;
  17779. return resourceModule;
  17780. };
  17781. return ModuleAnalyzer;
  17782. }();
  17783. var logger = LogManager.getLogger('templating');
  17784. function ensureRegistryEntry(loader, urlOrRegistryEntry) {
  17785. if (urlOrRegistryEntry instanceof _aureliaLoader.TemplateRegistryEntry) {
  17786. return Promise.resolve(urlOrRegistryEntry);
  17787. }
  17788. return loader.loadTemplate(urlOrRegistryEntry);
  17789. }
  17790. var ProxyViewFactory = function () {
  17791. function ProxyViewFactory(promise) {
  17792. var _this9 = this;
  17793. promise.then(function (x) {
  17794. return _this9.viewFactory = x;
  17795. });
  17796. }
  17797. ProxyViewFactory.prototype.create = function create(container, bindingContext, createInstruction, element) {
  17798. return this.viewFactory.create(container, bindingContext, createInstruction, element);
  17799. };
  17800. ProxyViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) {
  17801. this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet);
  17802. };
  17803. ProxyViewFactory.prototype.getCachedView = function getCachedView() {
  17804. return this.viewFactory.getCachedView();
  17805. };
  17806. ProxyViewFactory.prototype.returnViewToCache = function returnViewToCache(view) {
  17807. this.viewFactory.returnViewToCache(view);
  17808. };
  17809. _createClass(ProxyViewFactory, [{
  17810. key: 'isCaching',
  17811. get: function get() {
  17812. return this.viewFactory.isCaching;
  17813. }
  17814. }]);
  17815. return ProxyViewFactory;
  17816. }();
  17817. var ViewEngine = exports.ViewEngine = (_dec8 = (0, _aureliaDependencyInjection.inject)(_aureliaLoader.Loader, _aureliaDependencyInjection.Container, ViewCompiler, ModuleAnalyzer, ViewResources), _dec8(_class18 = (_temp4 = _class19 = function () {
  17818. function ViewEngine(loader, container, viewCompiler, moduleAnalyzer, appResources) {
  17819. this.loader = loader;
  17820. this.container = container;
  17821. this.viewCompiler = viewCompiler;
  17822. this.moduleAnalyzer = moduleAnalyzer;
  17823. this.appResources = appResources;
  17824. this._pluginMap = {};
  17825. var auSlotBehavior = new HtmlBehaviorResource();
  17826. auSlotBehavior.attributeName = 'au-slot';
  17827. auSlotBehavior.initialize(container, SlotCustomAttribute);
  17828. auSlotBehavior.register(appResources);
  17829. }
  17830. ViewEngine.prototype.addResourcePlugin = function addResourcePlugin(extension, implementation) {
  17831. var name = extension.replace('.', '') + '-resource-plugin';
  17832. this._pluginMap[extension] = name;
  17833. this.loader.addPlugin(name, implementation);
  17834. };
  17835. ViewEngine.prototype.loadViewFactory = function loadViewFactory(urlOrRegistryEntry, compileInstruction, loadContext, target) {
  17836. var _this10 = this;
  17837. loadContext = loadContext || new ResourceLoadContext();
  17838. return ensureRegistryEntry(this.loader, urlOrRegistryEntry).then(function (registryEntry) {
  17839. if (registryEntry.onReady) {
  17840. if (!loadContext.hasDependency(urlOrRegistryEntry)) {
  17841. loadContext.addDependency(urlOrRegistryEntry);
  17842. return registryEntry.onReady;
  17843. }
  17844. if (registryEntry.template === null) {
  17845. return registryEntry.onReady;
  17846. }
  17847. return Promise.resolve(new ProxyViewFactory(registryEntry.onReady));
  17848. }
  17849. loadContext.addDependency(urlOrRegistryEntry);
  17850. registryEntry.onReady = _this10.loadTemplateResources(registryEntry, compileInstruction, loadContext, target).then(function (resources) {
  17851. registryEntry.resources = resources;
  17852. if (registryEntry.template === null) {
  17853. return registryEntry.factory = null;
  17854. }
  17855. var viewFactory = _this10.viewCompiler.compile(registryEntry.template, resources, compileInstruction);
  17856. return registryEntry.factory = viewFactory;
  17857. });
  17858. return registryEntry.onReady;
  17859. });
  17860. };
  17861. ViewEngine.prototype.loadTemplateResources = function loadTemplateResources(registryEntry, compileInstruction, loadContext, target) {
  17862. var resources = new ViewResources(this.appResources, registryEntry.address);
  17863. var dependencies = registryEntry.dependencies;
  17864. var importIds = void 0;
  17865. var names = void 0;
  17866. compileInstruction = compileInstruction || ViewCompileInstruction.normal;
  17867. if (dependencies.length === 0 && !compileInstruction.associatedModuleId) {
  17868. return Promise.resolve(resources);
  17869. }
  17870. importIds = dependencies.map(function (x) {
  17871. return x.src;
  17872. });
  17873. names = dependencies.map(function (x) {
  17874. return x.name;
  17875. });
  17876. logger.debug('importing resources for ' + registryEntry.address, importIds);
  17877. if (target) {
  17878. var viewModelRequires = _aureliaMetadata.metadata.get(ViewEngine.viewModelRequireMetadataKey, target);
  17879. if (viewModelRequires) {
  17880. var templateImportCount = importIds.length;
  17881. for (var i = 0, ii = viewModelRequires.length; i < ii; ++i) {
  17882. var req = viewModelRequires[i];
  17883. var importId = typeof req === 'function' ? _aureliaMetadata.Origin.get(req).moduleId : (0, _aureliaPath.relativeToFile)(req.src || req, registryEntry.address);
  17884. if (importIds.indexOf(importId) === -1) {
  17885. importIds.push(importId);
  17886. names.push(req.as);
  17887. }
  17888. }
  17889. logger.debug('importing ViewModel resources for ' + compileInstruction.associatedModuleId, importIds.slice(templateImportCount));
  17890. }
  17891. }
  17892. return this.importViewResources(importIds, names, resources, compileInstruction, loadContext);
  17893. };
  17894. ViewEngine.prototype.importViewModelResource = function importViewModelResource(moduleImport, moduleMember) {
  17895. var _this11 = this;
  17896. return this.loader.loadModule(moduleImport).then(function (viewModelModule) {
  17897. var normalizedId = _aureliaMetadata.Origin.get(viewModelModule).moduleId;
  17898. var resourceModule = _this11.moduleAnalyzer.analyze(normalizedId, viewModelModule, moduleMember);
  17899. if (!resourceModule.mainResource) {
  17900. throw new Error('No view model found in module "' + moduleImport + '".');
  17901. }
  17902. resourceModule.initialize(_this11.container);
  17903. return resourceModule.mainResource;
  17904. });
  17905. };
  17906. ViewEngine.prototype.importViewResources = function importViewResources(moduleIds, names, resources, compileInstruction, loadContext) {
  17907. var _this12 = this;
  17908. loadContext = loadContext || new ResourceLoadContext();
  17909. compileInstruction = compileInstruction || ViewCompileInstruction.normal;
  17910. moduleIds = moduleIds.map(function (x) {
  17911. return _this12._applyLoaderPlugin(x);
  17912. });
  17913. return this.loader.loadAllModules(moduleIds).then(function (imports) {
  17914. var i = void 0;
  17915. var ii = void 0;
  17916. var analysis = void 0;
  17917. var normalizedId = void 0;
  17918. var current = void 0;
  17919. var associatedModule = void 0;
  17920. var container = _this12.container;
  17921. var moduleAnalyzer = _this12.moduleAnalyzer;
  17922. var allAnalysis = new Array(imports.length);
  17923. for (i = 0, ii = imports.length; i < ii; ++i) {
  17924. current = imports[i];
  17925. normalizedId = _aureliaMetadata.Origin.get(current).moduleId;
  17926. analysis = moduleAnalyzer.analyze(normalizedId, current);
  17927. analysis.initialize(container);
  17928. analysis.register(resources, names[i]);
  17929. allAnalysis[i] = analysis;
  17930. }
  17931. if (compileInstruction.associatedModuleId) {
  17932. associatedModule = moduleAnalyzer.getAnalysis(compileInstruction.associatedModuleId);
  17933. if (associatedModule) {
  17934. associatedModule.register(resources);
  17935. }
  17936. }
  17937. for (i = 0, ii = allAnalysis.length; i < ii; ++i) {
  17938. allAnalysis[i] = allAnalysis[i].load(container, loadContext);
  17939. }
  17940. return Promise.all(allAnalysis).then(function () {
  17941. return resources;
  17942. });
  17943. });
  17944. };
  17945. ViewEngine.prototype._applyLoaderPlugin = function _applyLoaderPlugin(id) {
  17946. var index = id.lastIndexOf('.');
  17947. if (index !== -1) {
  17948. var ext = id.substring(index);
  17949. var pluginName = this._pluginMap[ext];
  17950. if (pluginName === undefined) {
  17951. return id;
  17952. }
  17953. return this.loader.applyPluginToUrl(id, pluginName);
  17954. }
  17955. return id;
  17956. };
  17957. return ViewEngine;
  17958. }(), _class19.viewModelRequireMetadataKey = 'aurelia:view-model-require', _temp4)) || _class18);
  17959. var Controller = exports.Controller = function () {
  17960. function Controller(behavior, instruction, viewModel, container) {
  17961. this.behavior = behavior;
  17962. this.instruction = instruction;
  17963. this.viewModel = viewModel;
  17964. this.isAttached = false;
  17965. this.view = null;
  17966. this.isBound = false;
  17967. this.scope = null;
  17968. this.container = container;
  17969. this.elementEvents = container.elementEvents || null;
  17970. var observerLookup = behavior.observerLocator.getOrCreateObserversLookup(viewModel);
  17971. var handlesBind = behavior.handlesBind;
  17972. var attributes = instruction.attributes;
  17973. var boundProperties = this.boundProperties = [];
  17974. var properties = behavior.properties;
  17975. var i = void 0;
  17976. var ii = void 0;
  17977. behavior._ensurePropertiesDefined(viewModel, observerLookup);
  17978. for (i = 0, ii = properties.length; i < ii; ++i) {
  17979. properties[i]._initialize(viewModel, observerLookup, attributes, handlesBind, boundProperties);
  17980. }
  17981. }
  17982. Controller.prototype.created = function created(owningView) {
  17983. if (this.behavior.handlesCreated) {
  17984. this.viewModel.created(owningView, this.view);
  17985. }
  17986. };
  17987. Controller.prototype.automate = function automate(overrideContext, owningView) {
  17988. this.view.bindingContext = this.viewModel;
  17989. this.view.overrideContext = overrideContext || (0, _aureliaBinding.createOverrideContext)(this.viewModel);
  17990. this.view._isUserControlled = true;
  17991. if (this.behavior.handlesCreated) {
  17992. this.viewModel.created(owningView || null, this.view);
  17993. }
  17994. this.bind(this.view);
  17995. };
  17996. Controller.prototype.bind = function bind(scope) {
  17997. var skipSelfSubscriber = this.behavior.handlesBind;
  17998. var boundProperties = this.boundProperties;
  17999. var i = void 0;
  18000. var ii = void 0;
  18001. var x = void 0;
  18002. var observer = void 0;
  18003. var selfSubscriber = void 0;
  18004. if (this.isBound) {
  18005. if (this.scope === scope) {
  18006. return;
  18007. }
  18008. this.unbind();
  18009. }
  18010. this.isBound = true;
  18011. this.scope = scope;
  18012. for (i = 0, ii = boundProperties.length; i < ii; ++i) {
  18013. x = boundProperties[i];
  18014. observer = x.observer;
  18015. selfSubscriber = observer.selfSubscriber;
  18016. observer.publishing = false;
  18017. if (skipSelfSubscriber) {
  18018. observer.selfSubscriber = null;
  18019. }
  18020. x.binding.bind(scope);
  18021. observer.call();
  18022. observer.publishing = true;
  18023. observer.selfSubscriber = selfSubscriber;
  18024. }
  18025. var overrideContext = void 0;
  18026. if (this.view !== null) {
  18027. if (skipSelfSubscriber) {
  18028. this.view.viewModelScope = scope;
  18029. }
  18030. if (this.viewModel === scope.overrideContext.bindingContext) {
  18031. overrideContext = scope.overrideContext;
  18032. } else if (this.instruction.inheritBindingContext) {
  18033. overrideContext = (0, _aureliaBinding.createOverrideContext)(this.viewModel, scope.overrideContext);
  18034. } else {
  18035. overrideContext = (0, _aureliaBinding.createOverrideContext)(this.viewModel);
  18036. overrideContext.__parentOverrideContext = scope.overrideContext;
  18037. }
  18038. this.view.bind(this.viewModel, overrideContext);
  18039. } else if (skipSelfSubscriber) {
  18040. overrideContext = scope.overrideContext;
  18041. if (scope.overrideContext.__parentOverrideContext !== undefined && this.viewModel.viewFactory && this.viewModel.viewFactory.factoryCreateInstruction.partReplacements) {
  18042. overrideContext = Object.assign({}, scope.overrideContext);
  18043. overrideContext.parentOverrideContext = scope.overrideContext.__parentOverrideContext;
  18044. }
  18045. this.viewModel.bind(scope.bindingContext, overrideContext);
  18046. }
  18047. };
  18048. Controller.prototype.unbind = function unbind() {
  18049. if (this.isBound) {
  18050. var boundProperties = this.boundProperties;
  18051. var i = void 0;
  18052. var ii = void 0;
  18053. this.isBound = false;
  18054. this.scope = null;
  18055. if (this.view !== null) {
  18056. this.view.unbind();
  18057. }
  18058. if (this.behavior.handlesUnbind) {
  18059. this.viewModel.unbind();
  18060. }
  18061. if (this.elementEvents !== null) {
  18062. this.elementEvents.disposeAll();
  18063. }
  18064. for (i = 0, ii = boundProperties.length; i < ii; ++i) {
  18065. boundProperties[i].binding.unbind();
  18066. }
  18067. }
  18068. };
  18069. Controller.prototype.attached = function attached() {
  18070. if (this.isAttached) {
  18071. return;
  18072. }
  18073. this.isAttached = true;
  18074. if (this.behavior.handlesAttached) {
  18075. this.viewModel.attached();
  18076. }
  18077. if (this.view !== null) {
  18078. this.view.attached();
  18079. }
  18080. };
  18081. Controller.prototype.detached = function detached() {
  18082. if (this.isAttached) {
  18083. this.isAttached = false;
  18084. if (this.view !== null) {
  18085. this.view.detached();
  18086. }
  18087. if (this.behavior.handlesDetached) {
  18088. this.viewModel.detached();
  18089. }
  18090. }
  18091. };
  18092. return Controller;
  18093. }();
  18094. var BehaviorPropertyObserver = exports.BehaviorPropertyObserver = (_dec9 = (0, _aureliaBinding.subscriberCollection)(), _dec9(_class21 = function () {
  18095. function BehaviorPropertyObserver(taskQueue, obj, propertyName, selfSubscriber, initialValue) {
  18096. this.taskQueue = taskQueue;
  18097. this.obj = obj;
  18098. this.propertyName = propertyName;
  18099. this.notqueued = true;
  18100. this.publishing = false;
  18101. this.selfSubscriber = selfSubscriber;
  18102. this.currentValue = this.oldValue = initialValue;
  18103. }
  18104. BehaviorPropertyObserver.prototype.getValue = function getValue() {
  18105. return this.currentValue;
  18106. };
  18107. BehaviorPropertyObserver.prototype.setValue = function setValue(newValue) {
  18108. var oldValue = this.currentValue;
  18109. if (oldValue !== newValue) {
  18110. if (this.publishing && this.notqueued) {
  18111. this.notqueued = false;
  18112. this.taskQueue.queueMicroTask(this);
  18113. }
  18114. this.oldValue = oldValue;
  18115. this.currentValue = newValue;
  18116. }
  18117. };
  18118. BehaviorPropertyObserver.prototype.call = function call() {
  18119. var oldValue = this.oldValue;
  18120. var newValue = this.currentValue;
  18121. this.notqueued = true;
  18122. if (newValue === oldValue) {
  18123. return;
  18124. }
  18125. if (this.selfSubscriber) {
  18126. this.selfSubscriber(newValue, oldValue);
  18127. }
  18128. this.callSubscribers(newValue, oldValue);
  18129. this.oldValue = newValue;
  18130. };
  18131. BehaviorPropertyObserver.prototype.subscribe = function subscribe(context, callable) {
  18132. this.addSubscriber(context, callable);
  18133. };
  18134. BehaviorPropertyObserver.prototype.unsubscribe = function unsubscribe(context, callable) {
  18135. this.removeSubscriber(context, callable);
  18136. };
  18137. return BehaviorPropertyObserver;
  18138. }()) || _class21);
  18139. function getObserver(behavior, instance, name) {
  18140. var lookup = instance.__observers__;
  18141. if (lookup === undefined) {
  18142. if (!behavior.isInitialized) {
  18143. behavior.initialize(_aureliaDependencyInjection.Container.instance || new _aureliaDependencyInjection.Container(), instance.constructor);
  18144. }
  18145. lookup = behavior.observerLocator.getOrCreateObserversLookup(instance);
  18146. behavior._ensurePropertiesDefined(instance, lookup);
  18147. }
  18148. return lookup[name];
  18149. }
  18150. var BindableProperty = exports.BindableProperty = function () {
  18151. function BindableProperty(nameOrConfig) {
  18152. if (typeof nameOrConfig === 'string') {
  18153. this.name = nameOrConfig;
  18154. } else {
  18155. Object.assign(this, nameOrConfig);
  18156. }
  18157. this.attribute = this.attribute || _hyphenate(this.name);
  18158. if (this.defaultBindingMode === null || this.defaultBindingMode === undefined) {
  18159. this.defaultBindingMode = _aureliaBinding.bindingMode.oneWay;
  18160. }
  18161. this.changeHandler = this.changeHandler || null;
  18162. this.owner = null;
  18163. this.descriptor = null;
  18164. }
  18165. BindableProperty.prototype.registerWith = function registerWith(target, behavior, descriptor) {
  18166. behavior.properties.push(this);
  18167. behavior.attributes[this.attribute] = this;
  18168. this.owner = behavior;
  18169. if (descriptor) {
  18170. this.descriptor = descriptor;
  18171. return this._configureDescriptor(behavior, descriptor);
  18172. }
  18173. return undefined;
  18174. };
  18175. BindableProperty.prototype._configureDescriptor = function _configureDescriptor(behavior, descriptor) {
  18176. var name = this.name;
  18177. descriptor.configurable = true;
  18178. descriptor.enumerable = true;
  18179. if ('initializer' in descriptor) {
  18180. this.defaultValue = descriptor.initializer;
  18181. delete descriptor.initializer;
  18182. delete descriptor.writable;
  18183. }
  18184. if ('value' in descriptor) {
  18185. this.defaultValue = descriptor.value;
  18186. delete descriptor.value;
  18187. delete descriptor.writable;
  18188. }
  18189. descriptor.get = function () {
  18190. return getObserver(behavior, this, name).getValue();
  18191. };
  18192. descriptor.set = function (value) {
  18193. getObserver(behavior, this, name).setValue(value);
  18194. };
  18195. descriptor.get.getObserver = function (obj) {
  18196. return getObserver(behavior, obj, name);
  18197. };
  18198. return descriptor;
  18199. };
  18200. BindableProperty.prototype.defineOn = function defineOn(target, behavior) {
  18201. var name = this.name;
  18202. var handlerName = void 0;
  18203. if (this.changeHandler === null) {
  18204. handlerName = name + 'Changed';
  18205. if (handlerName in target.prototype) {
  18206. this.changeHandler = handlerName;
  18207. }
  18208. }
  18209. if (this.descriptor === null) {
  18210. Object.defineProperty(target.prototype, name, this._configureDescriptor(behavior, {}));
  18211. }
  18212. };
  18213. BindableProperty.prototype.createObserver = function createObserver(viewModel) {
  18214. var selfSubscriber = null;
  18215. var defaultValue = this.defaultValue;
  18216. var changeHandlerName = this.changeHandler;
  18217. var name = this.name;
  18218. var initialValue = void 0;
  18219. if (this.hasOptions) {
  18220. return undefined;
  18221. }
  18222. if (changeHandlerName in viewModel) {
  18223. if ('propertyChanged' in viewModel) {
  18224. selfSubscriber = function selfSubscriber(newValue, oldValue) {
  18225. viewModel[changeHandlerName](newValue, oldValue);
  18226. viewModel.propertyChanged(name, newValue, oldValue);
  18227. };
  18228. } else {
  18229. selfSubscriber = function selfSubscriber(newValue, oldValue) {
  18230. return viewModel[changeHandlerName](newValue, oldValue);
  18231. };
  18232. }
  18233. } else if ('propertyChanged' in viewModel) {
  18234. selfSubscriber = function selfSubscriber(newValue, oldValue) {
  18235. return viewModel.propertyChanged(name, newValue, oldValue);
  18236. };
  18237. } else if (changeHandlerName !== null) {
  18238. throw new Error('Change handler ' + changeHandlerName + ' was specified but not declared on the class.');
  18239. }
  18240. if (defaultValue !== undefined) {
  18241. initialValue = typeof defaultValue === 'function' ? defaultValue.call(viewModel) : defaultValue;
  18242. }
  18243. return new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, this.name, selfSubscriber, initialValue);
  18244. };
  18245. BindableProperty.prototype._initialize = function _initialize(viewModel, observerLookup, attributes, behaviorHandlesBind, boundProperties) {
  18246. var selfSubscriber = void 0;
  18247. var observer = void 0;
  18248. var attribute = void 0;
  18249. var defaultValue = this.defaultValue;
  18250. if (this.isDynamic) {
  18251. for (var key in attributes) {
  18252. this._createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, key, attributes[key], boundProperties);
  18253. }
  18254. } else if (!this.hasOptions) {
  18255. observer = observerLookup[this.name];
  18256. if (attributes !== null) {
  18257. selfSubscriber = observer.selfSubscriber;
  18258. attribute = attributes[this.attribute];
  18259. if (behaviorHandlesBind) {
  18260. observer.selfSubscriber = null;
  18261. }
  18262. if (typeof attribute === 'string') {
  18263. viewModel[this.name] = attribute;
  18264. observer.call();
  18265. } else if (attribute) {
  18266. boundProperties.push({ observer: observer, binding: attribute.createBinding(viewModel) });
  18267. } else if (defaultValue !== undefined) {
  18268. observer.call();
  18269. }
  18270. observer.selfSubscriber = selfSubscriber;
  18271. }
  18272. observer.publishing = true;
  18273. }
  18274. };
  18275. BindableProperty.prototype._createDynamicProperty = function _createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, name, attribute, boundProperties) {
  18276. var changeHandlerName = name + 'Changed';
  18277. var selfSubscriber = null;
  18278. var observer = void 0;
  18279. var info = void 0;
  18280. if (changeHandlerName in viewModel) {
  18281. if ('propertyChanged' in viewModel) {
  18282. selfSubscriber = function selfSubscriber(newValue, oldValue) {
  18283. viewModel[changeHandlerName](newValue, oldValue);
  18284. viewModel.propertyChanged(name, newValue, oldValue);
  18285. };
  18286. } else {
  18287. selfSubscriber = function selfSubscriber(newValue, oldValue) {
  18288. return viewModel[changeHandlerName](newValue, oldValue);
  18289. };
  18290. }
  18291. } else if ('propertyChanged' in viewModel) {
  18292. selfSubscriber = function selfSubscriber(newValue, oldValue) {
  18293. return viewModel.propertyChanged(name, newValue, oldValue);
  18294. };
  18295. }
  18296. observer = observerLookup[name] = new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, name, selfSubscriber);
  18297. Object.defineProperty(viewModel, name, {
  18298. configurable: true,
  18299. enumerable: true,
  18300. get: observer.getValue.bind(observer),
  18301. set: observer.setValue.bind(observer)
  18302. });
  18303. if (behaviorHandlesBind) {
  18304. observer.selfSubscriber = null;
  18305. }
  18306. if (typeof attribute === 'string') {
  18307. viewModel[name] = attribute;
  18308. observer.call();
  18309. } else if (attribute) {
  18310. info = { observer: observer, binding: attribute.createBinding(viewModel) };
  18311. boundProperties.push(info);
  18312. }
  18313. observer.publishing = true;
  18314. observer.selfSubscriber = selfSubscriber;
  18315. };
  18316. return BindableProperty;
  18317. }();
  18318. var lastProviderId = 0;
  18319. function nextProviderId() {
  18320. return ++lastProviderId;
  18321. }
  18322. function doProcessContent() {
  18323. return true;
  18324. }
  18325. function doProcessAttributes() {}
  18326. var HtmlBehaviorResource = exports.HtmlBehaviorResource = function () {
  18327. function HtmlBehaviorResource() {
  18328. this.elementName = null;
  18329. this.attributeName = null;
  18330. this.attributeDefaultBindingMode = undefined;
  18331. this.liftsContent = false;
  18332. this.targetShadowDOM = false;
  18333. this.shadowDOMOptions = null;
  18334. this.processAttributes = doProcessAttributes;
  18335. this.processContent = doProcessContent;
  18336. this.usesShadowDOM = false;
  18337. this.childBindings = null;
  18338. this.hasDynamicOptions = false;
  18339. this.containerless = false;
  18340. this.properties = [];
  18341. this.attributes = {};
  18342. this.isInitialized = false;
  18343. }
  18344. HtmlBehaviorResource.convention = function convention(name, existing) {
  18345. var behavior = void 0;
  18346. if (name.endsWith('CustomAttribute')) {
  18347. behavior = existing || new HtmlBehaviorResource();
  18348. behavior.attributeName = _hyphenate(name.substring(0, name.length - 15));
  18349. }
  18350. if (name.endsWith('CustomElement')) {
  18351. behavior = existing || new HtmlBehaviorResource();
  18352. behavior.elementName = _hyphenate(name.substring(0, name.length - 13));
  18353. }
  18354. return behavior;
  18355. };
  18356. HtmlBehaviorResource.prototype.addChildBinding = function addChildBinding(behavior) {
  18357. if (this.childBindings === null) {
  18358. this.childBindings = [];
  18359. }
  18360. this.childBindings.push(behavior);
  18361. };
  18362. HtmlBehaviorResource.prototype.initialize = function initialize(container, target) {
  18363. var proto = target.prototype;
  18364. var properties = this.properties;
  18365. var attributeName = this.attributeName;
  18366. var attributeDefaultBindingMode = this.attributeDefaultBindingMode;
  18367. var i = void 0;
  18368. var ii = void 0;
  18369. var current = void 0;
  18370. if (this.isInitialized) {
  18371. return;
  18372. }
  18373. this.isInitialized = true;
  18374. target.__providerId__ = nextProviderId();
  18375. this.observerLocator = container.get(_aureliaBinding.ObserverLocator);
  18376. this.taskQueue = container.get(_aureliaTaskQueue.TaskQueue);
  18377. this.target = target;
  18378. this.usesShadowDOM = this.targetShadowDOM && _aureliaPal.FEATURE.shadowDOM;
  18379. this.handlesCreated = 'created' in proto;
  18380. this.handlesBind = 'bind' in proto;
  18381. this.handlesUnbind = 'unbind' in proto;
  18382. this.handlesAttached = 'attached' in proto;
  18383. this.handlesDetached = 'detached' in proto;
  18384. this.htmlName = this.elementName || this.attributeName;
  18385. if (attributeName !== null) {
  18386. if (properties.length === 0) {
  18387. new BindableProperty({
  18388. name: 'value',
  18389. changeHandler: 'valueChanged' in proto ? 'valueChanged' : null,
  18390. attribute: attributeName,
  18391. defaultBindingMode: attributeDefaultBindingMode
  18392. }).registerWith(target, this);
  18393. }
  18394. current = properties[0];
  18395. if (properties.length === 1 && current.name === 'value') {
  18396. current.isDynamic = current.hasOptions = this.hasDynamicOptions;
  18397. current.defineOn(target, this);
  18398. } else {
  18399. for (i = 0, ii = properties.length; i < ii; ++i) {
  18400. properties[i].defineOn(target, this);
  18401. }
  18402. current = new BindableProperty({
  18403. name: 'value',
  18404. changeHandler: 'valueChanged' in proto ? 'valueChanged' : null,
  18405. attribute: attributeName,
  18406. defaultBindingMode: attributeDefaultBindingMode
  18407. });
  18408. current.hasOptions = true;
  18409. current.registerWith(target, this);
  18410. }
  18411. } else {
  18412. for (i = 0, ii = properties.length; i < ii; ++i) {
  18413. properties[i].defineOn(target, this);
  18414. }
  18415. }
  18416. };
  18417. HtmlBehaviorResource.prototype.register = function register(registry, name) {
  18418. if (this.attributeName !== null) {
  18419. registry.registerAttribute(name || this.attributeName, this, this.attributeName);
  18420. }
  18421. if (this.elementName !== null) {
  18422. registry.registerElement(name || this.elementName, this);
  18423. }
  18424. };
  18425. HtmlBehaviorResource.prototype.load = function load(container, target, loadContext, viewStrategy, transientView) {
  18426. var _this13 = this;
  18427. var options = void 0;
  18428. if (this.elementName !== null) {
  18429. viewStrategy = container.get(ViewLocator).getViewStrategy(viewStrategy || this.viewStrategy || target);
  18430. options = new ViewCompileInstruction(this.targetShadowDOM, true);
  18431. if (!viewStrategy.moduleId) {
  18432. viewStrategy.moduleId = _aureliaMetadata.Origin.get(target).moduleId;
  18433. }
  18434. return viewStrategy.loadViewFactory(container.get(ViewEngine), options, loadContext, target).then(function (viewFactory) {
  18435. if (!transientView || !_this13.viewFactory) {
  18436. _this13.viewFactory = viewFactory;
  18437. }
  18438. return viewFactory;
  18439. });
  18440. }
  18441. return Promise.resolve(this);
  18442. };
  18443. HtmlBehaviorResource.prototype.compile = function compile(compiler, resources, node, instruction, parentNode) {
  18444. if (this.liftsContent) {
  18445. if (!instruction.viewFactory) {
  18446. var template = _aureliaPal.DOM.createElement('template');
  18447. var fragment = _aureliaPal.DOM.createDocumentFragment();
  18448. var cacheSize = node.getAttribute('view-cache');
  18449. var part = node.getAttribute('part');
  18450. node.removeAttribute(instruction.originalAttrName);
  18451. _aureliaPal.DOM.replaceNode(template, node, parentNode);
  18452. fragment.appendChild(node);
  18453. instruction.viewFactory = compiler.compile(fragment, resources);
  18454. if (part) {
  18455. instruction.viewFactory.part = part;
  18456. node.removeAttribute('part');
  18457. }
  18458. if (cacheSize) {
  18459. instruction.viewFactory.setCacheSize(cacheSize);
  18460. node.removeAttribute('view-cache');
  18461. }
  18462. node = template;
  18463. }
  18464. } else if (this.elementName !== null) {
  18465. var _partReplacements2 = {};
  18466. if (this.processContent(compiler, resources, node, instruction) && node.hasChildNodes()) {
  18467. var currentChild = node.firstChild;
  18468. var contentElement = this.usesShadowDOM ? null : _aureliaPal.DOM.createElement('au-content');
  18469. var nextSibling = void 0;
  18470. var toReplace = void 0;
  18471. while (currentChild) {
  18472. nextSibling = currentChild.nextSibling;
  18473. if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) {
  18474. _partReplacements2[toReplace] = compiler.compile(currentChild, resources);
  18475. _aureliaPal.DOM.removeNode(currentChild, parentNode);
  18476. instruction.partReplacements = _partReplacements2;
  18477. } else if (contentElement !== null) {
  18478. if (currentChild.nodeType === 3 && _isAllWhitespace(currentChild)) {
  18479. _aureliaPal.DOM.removeNode(currentChild, parentNode);
  18480. } else {
  18481. contentElement.appendChild(currentChild);
  18482. }
  18483. }
  18484. currentChild = nextSibling;
  18485. }
  18486. if (contentElement !== null && contentElement.hasChildNodes()) {
  18487. node.appendChild(contentElement);
  18488. }
  18489. instruction.skipContentProcessing = false;
  18490. } else {
  18491. instruction.skipContentProcessing = true;
  18492. }
  18493. }
  18494. return node;
  18495. };
  18496. HtmlBehaviorResource.prototype.create = function create(container, instruction, element, bindings) {
  18497. var viewHost = void 0;
  18498. var au = null;
  18499. instruction = instruction || BehaviorInstruction.normal;
  18500. element = element || null;
  18501. bindings = bindings || null;
  18502. if (this.elementName !== null && element) {
  18503. if (this.usesShadowDOM) {
  18504. viewHost = element.attachShadow(this.shadowDOMOptions);
  18505. container.registerInstance(_aureliaPal.DOM.boundary, viewHost);
  18506. } else {
  18507. viewHost = element;
  18508. if (this.targetShadowDOM) {
  18509. container.registerInstance(_aureliaPal.DOM.boundary, viewHost);
  18510. }
  18511. }
  18512. }
  18513. if (element !== null) {
  18514. element.au = au = element.au || {};
  18515. }
  18516. var viewModel = instruction.viewModel || container.get(this.target);
  18517. var controller = new Controller(this, instruction, viewModel, container);
  18518. var childBindings = this.childBindings;
  18519. var viewFactory = void 0;
  18520. if (this.liftsContent) {
  18521. au.controller = controller;
  18522. } else if (this.elementName !== null) {
  18523. viewFactory = instruction.viewFactory || this.viewFactory;
  18524. container.viewModel = viewModel;
  18525. if (viewFactory) {
  18526. controller.view = viewFactory.create(container, instruction, element);
  18527. }
  18528. if (element !== null) {
  18529. au.controller = controller;
  18530. if (controller.view) {
  18531. if (!this.usesShadowDOM && (element.childNodes.length === 1 || element.contentElement)) {
  18532. var contentElement = element.childNodes[0] || element.contentElement;
  18533. controller.view.contentView = { fragment: contentElement };
  18534. contentElement.parentNode && _aureliaPal.DOM.removeNode(contentElement);
  18535. }
  18536. if (instruction.anchorIsContainer) {
  18537. if (childBindings !== null) {
  18538. for (var i = 0, ii = childBindings.length; i < ii; ++i) {
  18539. controller.view.addBinding(childBindings[i].create(element, viewModel, controller));
  18540. }
  18541. }
  18542. controller.view.appendNodesTo(viewHost);
  18543. } else {
  18544. controller.view.insertNodesBefore(viewHost);
  18545. }
  18546. } else if (childBindings !== null) {
  18547. for (var _i2 = 0, _ii2 = childBindings.length; _i2 < _ii2; ++_i2) {
  18548. bindings.push(childBindings[_i2].create(element, viewModel, controller));
  18549. }
  18550. }
  18551. } else if (controller.view) {
  18552. controller.view.controller = controller;
  18553. if (childBindings !== null) {
  18554. for (var _i3 = 0, _ii3 = childBindings.length; _i3 < _ii3; ++_i3) {
  18555. controller.view.addBinding(childBindings[_i3].create(instruction.host, viewModel, controller));
  18556. }
  18557. }
  18558. } else if (childBindings !== null) {
  18559. for (var _i4 = 0, _ii4 = childBindings.length; _i4 < _ii4; ++_i4) {
  18560. bindings.push(childBindings[_i4].create(instruction.host, viewModel, controller));
  18561. }
  18562. }
  18563. } else if (childBindings !== null) {
  18564. for (var _i5 = 0, _ii5 = childBindings.length; _i5 < _ii5; ++_i5) {
  18565. bindings.push(childBindings[_i5].create(element, viewModel, controller));
  18566. }
  18567. }
  18568. if (au !== null) {
  18569. au[this.htmlName] = controller;
  18570. }
  18571. if (instruction.initiatedByBehavior && viewFactory) {
  18572. controller.view.created();
  18573. }
  18574. return controller;
  18575. };
  18576. HtmlBehaviorResource.prototype._ensurePropertiesDefined = function _ensurePropertiesDefined(instance, lookup) {
  18577. var properties = void 0;
  18578. var i = void 0;
  18579. var ii = void 0;
  18580. var observer = void 0;
  18581. if ('__propertiesDefined__' in lookup) {
  18582. return;
  18583. }
  18584. lookup.__propertiesDefined__ = true;
  18585. properties = this.properties;
  18586. for (i = 0, ii = properties.length; i < ii; ++i) {
  18587. observer = properties[i].createObserver(instance);
  18588. if (observer !== undefined) {
  18589. lookup[observer.propertyName] = observer;
  18590. }
  18591. }
  18592. };
  18593. return HtmlBehaviorResource;
  18594. }();
  18595. function createChildObserverDecorator(selectorOrConfig, all) {
  18596. return function (target, key, descriptor) {
  18597. var actualTarget = typeof key === 'string' ? target.constructor : target;
  18598. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, actualTarget);
  18599. if (typeof selectorOrConfig === 'string') {
  18600. selectorOrConfig = {
  18601. selector: selectorOrConfig,
  18602. name: key
  18603. };
  18604. }
  18605. if (descriptor) {
  18606. descriptor.writable = true;
  18607. }
  18608. selectorOrConfig.all = all;
  18609. r.addChildBinding(new ChildObserver(selectorOrConfig));
  18610. };
  18611. }
  18612. function children(selectorOrConfig) {
  18613. return createChildObserverDecorator(selectorOrConfig, true);
  18614. }
  18615. function child(selectorOrConfig) {
  18616. return createChildObserverDecorator(selectorOrConfig, false);
  18617. }
  18618. var ChildObserver = function () {
  18619. function ChildObserver(config) {
  18620. this.name = config.name;
  18621. this.changeHandler = config.changeHandler || this.name + 'Changed';
  18622. this.selector = config.selector;
  18623. this.all = config.all;
  18624. }
  18625. ChildObserver.prototype.create = function create(viewHost, viewModel, controller) {
  18626. return new ChildObserverBinder(this.selector, viewHost, this.name, viewModel, controller, this.changeHandler, this.all);
  18627. };
  18628. return ChildObserver;
  18629. }();
  18630. var noMutations = [];
  18631. function trackMutation(groupedMutations, binder, record) {
  18632. var mutations = groupedMutations.get(binder);
  18633. if (!mutations) {
  18634. mutations = [];
  18635. groupedMutations.set(binder, mutations);
  18636. }
  18637. mutations.push(record);
  18638. }
  18639. function onChildChange(mutations, observer) {
  18640. var binders = observer.binders;
  18641. var bindersLength = binders.length;
  18642. var groupedMutations = new Map();
  18643. for (var i = 0, ii = mutations.length; i < ii; ++i) {
  18644. var record = mutations[i];
  18645. var added = record.addedNodes;
  18646. var removed = record.removedNodes;
  18647. for (var j = 0, jj = removed.length; j < jj; ++j) {
  18648. var node = removed[j];
  18649. if (node.nodeType === 1) {
  18650. for (var k = 0; k < bindersLength; ++k) {
  18651. var binder = binders[k];
  18652. if (binder.onRemove(node)) {
  18653. trackMutation(groupedMutations, binder, record);
  18654. }
  18655. }
  18656. }
  18657. }
  18658. for (var _j = 0, _jj = added.length; _j < _jj; ++_j) {
  18659. var _node = added[_j];
  18660. if (_node.nodeType === 1) {
  18661. for (var _k = 0; _k < bindersLength; ++_k) {
  18662. var _binder = binders[_k];
  18663. if (_binder.onAdd(_node)) {
  18664. trackMutation(groupedMutations, _binder, record);
  18665. }
  18666. }
  18667. }
  18668. }
  18669. }
  18670. groupedMutations.forEach(function (value, key) {
  18671. if (key.changeHandler !== null) {
  18672. key.viewModel[key.changeHandler](value);
  18673. }
  18674. });
  18675. }
  18676. var ChildObserverBinder = function () {
  18677. function ChildObserverBinder(selector, viewHost, property, viewModel, controller, changeHandler, all) {
  18678. this.selector = selector;
  18679. this.viewHost = viewHost;
  18680. this.property = property;
  18681. this.viewModel = viewModel;
  18682. this.controller = controller;
  18683. this.changeHandler = changeHandler in viewModel ? changeHandler : null;
  18684. this.usesShadowDOM = controller.behavior.usesShadowDOM;
  18685. this.all = all;
  18686. if (!this.usesShadowDOM && controller.view && controller.view.contentView) {
  18687. this.contentView = controller.view.contentView;
  18688. } else {
  18689. this.contentView = null;
  18690. }
  18691. }
  18692. ChildObserverBinder.prototype.matches = function matches(element) {
  18693. if (element.matches(this.selector)) {
  18694. if (this.contentView === null) {
  18695. return true;
  18696. }
  18697. var contentView = this.contentView;
  18698. var assignedSlot = element.auAssignedSlot;
  18699. if (assignedSlot && assignedSlot.projectFromAnchors) {
  18700. var anchors = assignedSlot.projectFromAnchors;
  18701. for (var i = 0, ii = anchors.length; i < ii; ++i) {
  18702. if (anchors[i].auOwnerView === contentView) {
  18703. return true;
  18704. }
  18705. }
  18706. return false;
  18707. }
  18708. return element.auOwnerView === contentView;
  18709. }
  18710. return false;
  18711. };
  18712. ChildObserverBinder.prototype.bind = function bind(source) {
  18713. var viewHost = this.viewHost;
  18714. var viewModel = this.viewModel;
  18715. var observer = viewHost.__childObserver__;
  18716. if (!observer) {
  18717. observer = viewHost.__childObserver__ = _aureliaPal.DOM.createMutationObserver(onChildChange);
  18718. var options = {
  18719. childList: true,
  18720. subtree: !this.usesShadowDOM
  18721. };
  18722. observer.observe(viewHost, options);
  18723. observer.binders = [];
  18724. }
  18725. observer.binders.push(this);
  18726. if (this.usesShadowDOM) {
  18727. var current = viewHost.firstElementChild;
  18728. if (this.all) {
  18729. var items = viewModel[this.property];
  18730. if (!items) {
  18731. items = viewModel[this.property] = [];
  18732. } else {
  18733. items.length = 0;
  18734. }
  18735. while (current) {
  18736. if (this.matches(current)) {
  18737. items.push(current.au && current.au.controller ? current.au.controller.viewModel : current);
  18738. }
  18739. current = current.nextElementSibling;
  18740. }
  18741. if (this.changeHandler !== null) {
  18742. this.viewModel[this.changeHandler](noMutations);
  18743. }
  18744. } else {
  18745. while (current) {
  18746. if (this.matches(current)) {
  18747. var value = current.au && current.au.controller ? current.au.controller.viewModel : current;
  18748. this.viewModel[this.property] = value;
  18749. if (this.changeHandler !== null) {
  18750. this.viewModel[this.changeHandler](value);
  18751. }
  18752. break;
  18753. }
  18754. current = current.nextElementSibling;
  18755. }
  18756. }
  18757. }
  18758. };
  18759. ChildObserverBinder.prototype.onRemove = function onRemove(element) {
  18760. if (this.matches(element)) {
  18761. var value = element.au && element.au.controller ? element.au.controller.viewModel : element;
  18762. if (this.all) {
  18763. var items = this.viewModel[this.property] || (this.viewModel[this.property] = []);
  18764. var index = items.indexOf(value);
  18765. if (index !== -1) {
  18766. items.splice(index, 1);
  18767. }
  18768. return true;
  18769. }
  18770. return false;
  18771. }
  18772. return false;
  18773. };
  18774. ChildObserverBinder.prototype.onAdd = function onAdd(element) {
  18775. if (this.matches(element)) {
  18776. var value = element.au && element.au.controller ? element.au.controller.viewModel : element;
  18777. if (this.all) {
  18778. var items = this.viewModel[this.property] || (this.viewModel[this.property] = []);
  18779. var index = 0;
  18780. var prev = element.previousElementSibling;
  18781. while (prev) {
  18782. if (this.matches(prev)) {
  18783. index++;
  18784. }
  18785. prev = prev.previousElementSibling;
  18786. }
  18787. items.splice(index, 0, value);
  18788. return true;
  18789. }
  18790. this.viewModel[this.property] = value;
  18791. if (this.changeHandler !== null) {
  18792. this.viewModel[this.changeHandler](value);
  18793. }
  18794. }
  18795. return false;
  18796. };
  18797. ChildObserverBinder.prototype.unbind = function unbind() {
  18798. if (this.viewHost.__childObserver__) {
  18799. this.viewHost.__childObserver__.disconnect();
  18800. this.viewHost.__childObserver__ = null;
  18801. }
  18802. };
  18803. return ChildObserverBinder;
  18804. }();
  18805. function tryActivateViewModel(context) {
  18806. if (context.skipActivation || typeof context.viewModel.activate !== 'function') {
  18807. return Promise.resolve();
  18808. }
  18809. return context.viewModel.activate(context.model) || Promise.resolve();
  18810. }
  18811. var CompositionEngine = exports.CompositionEngine = (_dec10 = (0, _aureliaDependencyInjection.inject)(ViewEngine, ViewLocator), _dec10(_class22 = function () {
  18812. function CompositionEngine(viewEngine, viewLocator) {
  18813. this.viewEngine = viewEngine;
  18814. this.viewLocator = viewLocator;
  18815. }
  18816. CompositionEngine.prototype._createControllerAndSwap = function _createControllerAndSwap(context) {
  18817. function swap(controller) {
  18818. return Promise.resolve(context.viewSlot.removeAll(true)).then(function () {
  18819. if (context.currentController) {
  18820. context.currentController.unbind();
  18821. }
  18822. context.viewSlot.add(controller.view);
  18823. if (context.compositionTransactionNotifier) {
  18824. context.compositionTransactionNotifier.done();
  18825. }
  18826. return controller;
  18827. });
  18828. }
  18829. return this.createController(context).then(function (controller) {
  18830. controller.automate(context.overrideContext, context.owningView);
  18831. if (context.compositionTransactionOwnershipToken) {
  18832. return context.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () {
  18833. return swap(controller);
  18834. });
  18835. }
  18836. return swap(controller);
  18837. });
  18838. };
  18839. CompositionEngine.prototype.createController = function createController(context) {
  18840. var _this14 = this;
  18841. var childContainer = void 0;
  18842. var viewModel = void 0;
  18843. var viewModelResource = void 0;
  18844. var m = void 0;
  18845. return this.ensureViewModel(context).then(tryActivateViewModel).then(function () {
  18846. childContainer = context.childContainer;
  18847. viewModel = context.viewModel;
  18848. viewModelResource = context.viewModelResource;
  18849. m = viewModelResource.metadata;
  18850. var viewStrategy = _this14.viewLocator.getViewStrategy(context.view || viewModel);
  18851. if (context.viewResources) {
  18852. viewStrategy.makeRelativeTo(context.viewResources.viewUrl);
  18853. }
  18854. return m.load(childContainer, viewModelResource.value, null, viewStrategy, true);
  18855. }).then(function (viewFactory) {
  18856. return m.create(childContainer, BehaviorInstruction.dynamic(context.host, viewModel, viewFactory));
  18857. });
  18858. };
  18859. CompositionEngine.prototype.ensureViewModel = function ensureViewModel(context) {
  18860. var childContainer = context.childContainer = context.childContainer || context.container.createChild();
  18861. if (typeof context.viewModel === 'string') {
  18862. context.viewModel = context.viewResources ? context.viewResources.relativeToView(context.viewModel) : context.viewModel;
  18863. return this.viewEngine.importViewModelResource(context.viewModel).then(function (viewModelResource) {
  18864. childContainer.autoRegister(viewModelResource.value);
  18865. if (context.host) {
  18866. childContainer.registerInstance(_aureliaPal.DOM.Element, context.host);
  18867. }
  18868. context.viewModel = childContainer.viewModel = childContainer.get(viewModelResource.value);
  18869. context.viewModelResource = viewModelResource;
  18870. return context;
  18871. });
  18872. }
  18873. var m = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, context.viewModel.constructor);
  18874. m.elementName = m.elementName || 'dynamic-element';
  18875. m.initialize(context.container || childContainer, context.viewModel.constructor);
  18876. context.viewModelResource = { metadata: m, value: context.viewModel.constructor };
  18877. childContainer.viewModel = context.viewModel;
  18878. return Promise.resolve(context);
  18879. };
  18880. CompositionEngine.prototype.compose = function compose(context) {
  18881. context.childContainer = context.childContainer || context.container.createChild();
  18882. context.view = this.viewLocator.getViewStrategy(context.view);
  18883. var transaction = context.childContainer.get(CompositionTransaction);
  18884. var compositionTransactionOwnershipToken = transaction.tryCapture();
  18885. if (compositionTransactionOwnershipToken) {
  18886. context.compositionTransactionOwnershipToken = compositionTransactionOwnershipToken;
  18887. } else {
  18888. context.compositionTransactionNotifier = transaction.enlist();
  18889. }
  18890. if (context.viewModel) {
  18891. return this._createControllerAndSwap(context);
  18892. } else if (context.view) {
  18893. if (context.viewResources) {
  18894. context.view.makeRelativeTo(context.viewResources.viewUrl);
  18895. }
  18896. return context.view.loadViewFactory(this.viewEngine, new ViewCompileInstruction()).then(function (viewFactory) {
  18897. var result = viewFactory.create(context.childContainer);
  18898. result.bind(context.bindingContext, context.overrideContext);
  18899. var work = function work() {
  18900. return Promise.resolve(context.viewSlot.removeAll(true)).then(function () {
  18901. context.viewSlot.add(result);
  18902. if (context.compositionTransactionNotifier) {
  18903. context.compositionTransactionNotifier.done();
  18904. }
  18905. return result;
  18906. });
  18907. };
  18908. if (context.compositionTransactionOwnershipToken) {
  18909. return context.compositionTransactionOwnershipToken.waitForCompositionComplete().then(work);
  18910. }
  18911. return work();
  18912. });
  18913. } else if (context.viewSlot) {
  18914. context.viewSlot.removeAll();
  18915. if (context.compositionTransactionNotifier) {
  18916. context.compositionTransactionNotifier.done();
  18917. }
  18918. return Promise.resolve(null);
  18919. }
  18920. return Promise.resolve(null);
  18921. };
  18922. return CompositionEngine;
  18923. }()) || _class22);
  18924. var ElementConfigResource = exports.ElementConfigResource = function () {
  18925. function ElementConfigResource() {
  18926. }
  18927. ElementConfigResource.prototype.initialize = function initialize(container, target) {};
  18928. ElementConfigResource.prototype.register = function register(registry, name) {};
  18929. ElementConfigResource.prototype.load = function load(container, target) {
  18930. var config = new target();
  18931. var eventManager = container.get(_aureliaBinding.EventManager);
  18932. eventManager.registerElementConfig(config);
  18933. };
  18934. return ElementConfigResource;
  18935. }();
  18936. function validateBehaviorName(name, type) {
  18937. if (/[A-Z]/.test(name)) {
  18938. var newName = _hyphenate(name);
  18939. 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.');
  18940. return newName;
  18941. }
  18942. return name;
  18943. }
  18944. function resource(instance) {
  18945. return function (target) {
  18946. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, instance, target);
  18947. };
  18948. }
  18949. function behavior(override) {
  18950. return function (target) {
  18951. if (override instanceof HtmlBehaviorResource) {
  18952. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, override, target);
  18953. } else {
  18954. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, target);
  18955. Object.assign(r, override);
  18956. }
  18957. };
  18958. }
  18959. function customElement(name) {
  18960. return function (target) {
  18961. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, target);
  18962. r.elementName = validateBehaviorName(name, 'custom element');
  18963. };
  18964. }
  18965. function customAttribute(name, defaultBindingMode) {
  18966. return function (target) {
  18967. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, target);
  18968. r.attributeName = validateBehaviorName(name, 'custom attribute');
  18969. r.attributeDefaultBindingMode = defaultBindingMode;
  18970. };
  18971. }
  18972. function templateController(target) {
  18973. var deco = function deco(t) {
  18974. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
  18975. r.liftsContent = true;
  18976. };
  18977. return target ? deco(target) : deco;
  18978. }
  18979. function bindable(nameOrConfigOrTarget, key, descriptor) {
  18980. var deco = function deco(target, key2, descriptor2) {
  18981. var actualTarget = key2 ? target.constructor : target;
  18982. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, actualTarget);
  18983. var prop = void 0;
  18984. if (key2) {
  18985. nameOrConfigOrTarget = nameOrConfigOrTarget || {};
  18986. nameOrConfigOrTarget.name = key2;
  18987. }
  18988. prop = new BindableProperty(nameOrConfigOrTarget);
  18989. return prop.registerWith(actualTarget, r, descriptor2);
  18990. };
  18991. if (!nameOrConfigOrTarget) {
  18992. return deco;
  18993. }
  18994. if (key) {
  18995. var _target = nameOrConfigOrTarget;
  18996. nameOrConfigOrTarget = null;
  18997. return deco(_target, key, descriptor);
  18998. }
  18999. return deco;
  19000. }
  19001. function dynamicOptions(target) {
  19002. var deco = function deco(t) {
  19003. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
  19004. r.hasDynamicOptions = true;
  19005. };
  19006. return target ? deco(target) : deco;
  19007. }
  19008. var defaultShadowDOMOptions = { mode: 'open' };
  19009. function useShadowDOM(targetOrOptions) {
  19010. var options = typeof targetOrOptions === 'function' || !targetOrOptions ? defaultShadowDOMOptions : targetOrOptions;
  19011. var deco = function deco(t) {
  19012. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
  19013. r.targetShadowDOM = true;
  19014. r.shadowDOMOptions = options;
  19015. };
  19016. return typeof targetOrOptions === 'function' ? deco(targetOrOptions) : deco;
  19017. }
  19018. function processAttributes(processor) {
  19019. return function (t) {
  19020. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
  19021. r.processAttributes = function (compiler, resources, node, attributes, elementInstruction) {
  19022. try {
  19023. processor(compiler, resources, node, attributes, elementInstruction);
  19024. } catch (error) {
  19025. LogManager.getLogger('templating').error(error);
  19026. }
  19027. };
  19028. };
  19029. }
  19030. function doNotProcessContent() {
  19031. return false;
  19032. }
  19033. function processContent(processor) {
  19034. return function (t) {
  19035. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
  19036. r.processContent = processor ? function (compiler, resources, node, instruction) {
  19037. try {
  19038. return processor(compiler, resources, node, instruction);
  19039. } catch (error) {
  19040. LogManager.getLogger('templating').error(error);
  19041. return false;
  19042. }
  19043. } : doNotProcessContent;
  19044. };
  19045. }
  19046. function containerless(target) {
  19047. var deco = function deco(t) {
  19048. var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t);
  19049. r.containerless = true;
  19050. };
  19051. return target ? deco(target) : deco;
  19052. }
  19053. function useViewStrategy(strategy) {
  19054. return function (target) {
  19055. _aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, strategy, target);
  19056. };
  19057. }
  19058. function useView(path) {
  19059. return useViewStrategy(new RelativeViewStrategy(path));
  19060. }
  19061. function inlineView(markup, dependencies, dependencyBaseUrl) {
  19062. return useViewStrategy(new InlineViewStrategy(markup, dependencies, dependencyBaseUrl));
  19063. }
  19064. function noView(targetOrDependencies, dependencyBaseUrl) {
  19065. var target = void 0;
  19066. var dependencies = void 0;
  19067. if (typeof targetOrDependencies === 'function') {
  19068. target = targetOrDependencies;
  19069. } else {
  19070. dependencies = targetOrDependencies;
  19071. target = undefined;
  19072. }
  19073. var deco = function deco(t) {
  19074. _aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, new NoViewStrategy(dependencies, dependencyBaseUrl), t);
  19075. };
  19076. return target ? deco(target) : deco;
  19077. }
  19078. function elementConfig(target) {
  19079. var deco = function deco(t) {
  19080. _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ElementConfigResource(), t);
  19081. };
  19082. return target ? deco(target) : deco;
  19083. }
  19084. function viewResources() {
  19085. return function (target) {
  19086. _aureliaMetadata.metadata.define(ViewEngine.viewModelRequireMetadataKey, resources, target);
  19087. };
  19088. }
  19089. var TemplatingEngine = exports.TemplatingEngine = (_dec11 = (0, _aureliaDependencyInjection.inject)(_aureliaDependencyInjection.Container, ModuleAnalyzer, ViewCompiler, CompositionEngine), _dec11(_class23 = function () {
  19090. function TemplatingEngine(container, moduleAnalyzer, viewCompiler, compositionEngine) {
  19091. this._container = container;
  19092. this._moduleAnalyzer = moduleAnalyzer;
  19093. this._viewCompiler = viewCompiler;
  19094. this._compositionEngine = compositionEngine;
  19095. container.registerInstance(Animator, Animator.instance = new Animator());
  19096. }
  19097. TemplatingEngine.prototype.configureAnimator = function configureAnimator(animator) {
  19098. this._container.unregister(Animator);
  19099. this._container.registerInstance(Animator, Animator.instance = animator);
  19100. };
  19101. TemplatingEngine.prototype.compose = function compose(context) {
  19102. return this._compositionEngine.compose(context);
  19103. };
  19104. TemplatingEngine.prototype.enhance = function enhance(instruction) {
  19105. if (instruction instanceof _aureliaPal.DOM.Element) {
  19106. instruction = { element: instruction };
  19107. }
  19108. var compilerInstructions = {};
  19109. var resources = instruction.resources || this._container.get(ViewResources);
  19110. this._viewCompiler._compileNode(instruction.element, resources, compilerInstructions, instruction.element.parentNode, 'root', true);
  19111. var factory = new ViewFactory(instruction.element, compilerInstructions, resources);
  19112. var container = instruction.container || this._container.createChild();
  19113. var view = factory.create(container, BehaviorInstruction.enhance());
  19114. view.bind(instruction.bindingContext || {}, instruction.overrideContext);
  19115. return view;
  19116. };
  19117. return TemplatingEngine;
  19118. }()) || _class23);
  19119. });
  19120. 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"; });
  19121. /*!
  19122. * Bootstrap v3.3.7 (http://getbootstrap.com)
  19123. * Copyright 2011-2016 Twitter, Inc.
  19124. * Licensed under the MIT license
  19125. */
  19126. 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){
  19127. 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);
  19128. define("bootstrap/js/bootstrap.min", ["jquery"], (function (global) {
  19129. return function () {
  19130. var ret, fn;
  19131. return ret || global.$;
  19132. };
  19133. }(this)));
  19134. ;define('bootstrap', ['bootstrap/js/bootstrap.min'], function (main) { return main; });
  19135. define('aurelia-templating-binding',['exports', 'aurelia-logging', 'aurelia-binding', 'aurelia-templating'], function (exports, _aureliaLogging, _aureliaBinding, _aureliaTemplating) {
  19136. 'use strict';
  19137. Object.defineProperty(exports, "__esModule", {
  19138. value: true
  19139. });
  19140. exports.TemplatingBindingLanguage = exports.SyntaxInterpreter = exports.ChildInterpolationBinding = exports.InterpolationBinding = exports.InterpolationBindingExpression = exports.AttributeMap = undefined;
  19141. exports.configure = configure;
  19142. var LogManager = _interopRequireWildcard(_aureliaLogging);
  19143. function _interopRequireWildcard(obj) {
  19144. if (obj && obj.__esModule) {
  19145. return obj;
  19146. } else {
  19147. var newObj = {};
  19148. if (obj != null) {
  19149. for (var key in obj) {
  19150. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  19151. }
  19152. }
  19153. newObj.default = obj;
  19154. return newObj;
  19155. }
  19156. }
  19157. function _possibleConstructorReturn(self, call) {
  19158. if (!self) {
  19159. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  19160. }
  19161. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  19162. }
  19163. function _inherits(subClass, superClass) {
  19164. if (typeof superClass !== "function" && superClass !== null) {
  19165. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  19166. }
  19167. subClass.prototype = Object.create(superClass && superClass.prototype, {
  19168. constructor: {
  19169. value: subClass,
  19170. enumerable: false,
  19171. writable: true,
  19172. configurable: true
  19173. }
  19174. });
  19175. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  19176. }
  19177. var _class, _temp, _dec, _class2, _class3, _temp2, _class4, _temp3;
  19178. var AttributeMap = exports.AttributeMap = (_temp = _class = function () {
  19179. function AttributeMap(svg) {
  19180. this.elements = Object.create(null);
  19181. this.allElements = Object.create(null);
  19182. this.svg = svg;
  19183. this.registerUniversal('accesskey', 'accessKey');
  19184. this.registerUniversal('contenteditable', 'contentEditable');
  19185. this.registerUniversal('tabindex', 'tabIndex');
  19186. this.registerUniversal('textcontent', 'textContent');
  19187. this.registerUniversal('innerhtml', 'innerHTML');
  19188. this.registerUniversal('scrolltop', 'scrollTop');
  19189. this.registerUniversal('scrollleft', 'scrollLeft');
  19190. this.registerUniversal('readonly', 'readOnly');
  19191. this.register('label', 'for', 'htmlFor');
  19192. this.register('input', 'maxlength', 'maxLength');
  19193. this.register('input', 'minlength', 'minLength');
  19194. this.register('input', 'formaction', 'formAction');
  19195. this.register('input', 'formenctype', 'formEncType');
  19196. this.register('input', 'formmethod', 'formMethod');
  19197. this.register('input', 'formnovalidate', 'formNoValidate');
  19198. this.register('input', 'formtarget', 'formTarget');
  19199. this.register('textarea', 'maxlength', 'maxLength');
  19200. this.register('td', 'rowspan', 'rowSpan');
  19201. this.register('td', 'colspan', 'colSpan');
  19202. this.register('th', 'rowspan', 'rowSpan');
  19203. this.register('th', 'colspan', 'colSpan');
  19204. }
  19205. AttributeMap.prototype.register = function register(elementName, attributeName, propertyName) {
  19206. elementName = elementName.toLowerCase();
  19207. attributeName = attributeName.toLowerCase();
  19208. var element = this.elements[elementName] = this.elements[elementName] || Object.create(null);
  19209. element[attributeName] = propertyName;
  19210. };
  19211. AttributeMap.prototype.registerUniversal = function registerUniversal(attributeName, propertyName) {
  19212. attributeName = attributeName.toLowerCase();
  19213. this.allElements[attributeName] = propertyName;
  19214. };
  19215. AttributeMap.prototype.map = function map(elementName, attributeName) {
  19216. if (this.svg.isStandardSvgAttribute(elementName, attributeName)) {
  19217. return attributeName;
  19218. }
  19219. elementName = elementName.toLowerCase();
  19220. attributeName = attributeName.toLowerCase();
  19221. var element = this.elements[elementName];
  19222. if (element !== undefined && attributeName in element) {
  19223. return element[attributeName];
  19224. }
  19225. if (attributeName in this.allElements) {
  19226. return this.allElements[attributeName];
  19227. }
  19228. if (/(^data-)|(^aria-)|:/.test(attributeName)) {
  19229. return attributeName;
  19230. }
  19231. return (0, _aureliaBinding.camelCase)(attributeName);
  19232. };
  19233. return AttributeMap;
  19234. }(), _class.inject = [_aureliaBinding.SVGAnalyzer], _temp);
  19235. var InterpolationBindingExpression = exports.InterpolationBindingExpression = function () {
  19236. function InterpolationBindingExpression(observerLocator, targetProperty, parts, mode, lookupFunctions, attribute) {
  19237. this.observerLocator = observerLocator;
  19238. this.targetProperty = targetProperty;
  19239. this.parts = parts;
  19240. this.mode = mode;
  19241. this.lookupFunctions = lookupFunctions;
  19242. this.attribute = this.attrToRemove = attribute;
  19243. this.discrete = false;
  19244. }
  19245. InterpolationBindingExpression.prototype.createBinding = function createBinding(target) {
  19246. if (this.parts.length === 3) {
  19247. return new ChildInterpolationBinding(target, this.observerLocator, this.parts[1], this.mode, this.lookupFunctions, this.targetProperty, this.parts[0], this.parts[2]);
  19248. }
  19249. return new InterpolationBinding(this.observerLocator, this.parts, target, this.targetProperty, this.mode, this.lookupFunctions);
  19250. };
  19251. return InterpolationBindingExpression;
  19252. }();
  19253. function validateTarget(target, propertyName) {
  19254. if (propertyName === 'style') {
  19255. LogManager.getLogger('templating-binding').info('Internet Explorer does not support interpolation in "style" attributes. Use the style attribute\'s alias, "css" instead.');
  19256. } else if (target.parentElement && target.parentElement.nodeName === 'TEXTAREA' && propertyName === 'textContent') {
  19257. throw new Error('Interpolation binding cannot be used in the content of a textarea element. Use <textarea value.bind="expression"></textarea> instead.');
  19258. }
  19259. }
  19260. var InterpolationBinding = exports.InterpolationBinding = function () {
  19261. function InterpolationBinding(observerLocator, parts, target, targetProperty, mode, lookupFunctions) {
  19262. validateTarget(target, targetProperty);
  19263. this.observerLocator = observerLocator;
  19264. this.parts = parts;
  19265. this.target = target;
  19266. this.targetProperty = targetProperty;
  19267. this.targetAccessor = observerLocator.getAccessor(target, targetProperty);
  19268. this.mode = mode;
  19269. this.lookupFunctions = lookupFunctions;
  19270. }
  19271. InterpolationBinding.prototype.interpolate = function interpolate() {
  19272. if (this.isBound) {
  19273. var value = '';
  19274. var parts = this.parts;
  19275. for (var i = 0, ii = parts.length; i < ii; i++) {
  19276. value += i % 2 === 0 ? parts[i] : this['childBinding' + i].value;
  19277. }
  19278. this.targetAccessor.setValue(value, this.target, this.targetProperty);
  19279. }
  19280. };
  19281. InterpolationBinding.prototype.updateOneTimeBindings = function updateOneTimeBindings() {
  19282. for (var i = 1, ii = this.parts.length; i < ii; i += 2) {
  19283. var child = this['childBinding' + i];
  19284. if (child.mode === _aureliaBinding.bindingMode.oneTime) {
  19285. child.call();
  19286. }
  19287. }
  19288. };
  19289. InterpolationBinding.prototype.bind = function bind(source) {
  19290. if (this.isBound) {
  19291. if (this.source === source) {
  19292. return;
  19293. }
  19294. this.unbind();
  19295. }
  19296. this.source = source;
  19297. var parts = this.parts;
  19298. for (var i = 1, ii = parts.length; i < ii; i += 2) {
  19299. var binding = new ChildInterpolationBinding(this, this.observerLocator, parts[i], this.mode, this.lookupFunctions);
  19300. binding.bind(source);
  19301. this['childBinding' + i] = binding;
  19302. }
  19303. this.isBound = true;
  19304. this.interpolate();
  19305. };
  19306. InterpolationBinding.prototype.unbind = function unbind() {
  19307. if (!this.isBound) {
  19308. return;
  19309. }
  19310. this.isBound = false;
  19311. this.source = null;
  19312. var parts = this.parts;
  19313. for (var i = 1, ii = parts.length; i < ii; i += 2) {
  19314. var name = 'childBinding' + i;
  19315. this[name].unbind();
  19316. }
  19317. };
  19318. return InterpolationBinding;
  19319. }();
  19320. var ChildInterpolationBinding = exports.ChildInterpolationBinding = (_dec = (0, _aureliaBinding.connectable)(), _dec(_class2 = function () {
  19321. function ChildInterpolationBinding(target, observerLocator, sourceExpression, mode, lookupFunctions, targetProperty, left, right) {
  19322. if (target instanceof InterpolationBinding) {
  19323. this.parent = target;
  19324. } else {
  19325. validateTarget(target, targetProperty);
  19326. this.target = target;
  19327. this.targetProperty = targetProperty;
  19328. this.targetAccessor = observerLocator.getAccessor(target, targetProperty);
  19329. }
  19330. this.observerLocator = observerLocator;
  19331. this.sourceExpression = sourceExpression;
  19332. this.mode = mode;
  19333. this.lookupFunctions = lookupFunctions;
  19334. this.left = left;
  19335. this.right = right;
  19336. }
  19337. ChildInterpolationBinding.prototype.updateTarget = function updateTarget(value) {
  19338. value = value === null || value === undefined ? '' : value.toString();
  19339. if (value !== this.value) {
  19340. this.value = value;
  19341. if (this.parent) {
  19342. this.parent.interpolate();
  19343. } else {
  19344. this.targetAccessor.setValue(this.left + value + this.right, this.target, this.targetProperty);
  19345. }
  19346. }
  19347. };
  19348. ChildInterpolationBinding.prototype.call = function call() {
  19349. if (!this.isBound) {
  19350. return;
  19351. }
  19352. this.rawValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions);
  19353. this.updateTarget(this.rawValue);
  19354. if (this.mode !== _aureliaBinding.bindingMode.oneTime) {
  19355. this._version++;
  19356. this.sourceExpression.connect(this, this.source);
  19357. if (this.rawValue instanceof Array) {
  19358. this.observeArray(this.rawValue);
  19359. }
  19360. this.unobserve(false);
  19361. }
  19362. };
  19363. ChildInterpolationBinding.prototype.bind = function bind(source) {
  19364. if (this.isBound) {
  19365. if (this.source === source) {
  19366. return;
  19367. }
  19368. this.unbind();
  19369. }
  19370. this.isBound = true;
  19371. this.source = source;
  19372. var sourceExpression = this.sourceExpression;
  19373. if (sourceExpression.bind) {
  19374. sourceExpression.bind(this, source, this.lookupFunctions);
  19375. }
  19376. this.rawValue = sourceExpression.evaluate(source, this.lookupFunctions);
  19377. this.updateTarget(this.rawValue);
  19378. if (this.mode === _aureliaBinding.bindingMode.oneWay) {
  19379. (0, _aureliaBinding.enqueueBindingConnect)(this);
  19380. }
  19381. };
  19382. ChildInterpolationBinding.prototype.unbind = function unbind() {
  19383. if (!this.isBound) {
  19384. return;
  19385. }
  19386. this.isBound = false;
  19387. var sourceExpression = this.sourceExpression;
  19388. if (sourceExpression.unbind) {
  19389. sourceExpression.unbind(this, this.source);
  19390. }
  19391. this.source = null;
  19392. this.value = null;
  19393. this.rawValue = null;
  19394. this.unobserve(true);
  19395. };
  19396. ChildInterpolationBinding.prototype.connect = function connect(evaluate) {
  19397. if (!this.isBound) {
  19398. return;
  19399. }
  19400. if (evaluate) {
  19401. this.rawValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions);
  19402. this.updateTarget(this.rawValue);
  19403. }
  19404. this.sourceExpression.connect(this, this.source);
  19405. if (this.rawValue instanceof Array) {
  19406. this.observeArray(this.rawValue);
  19407. }
  19408. };
  19409. return ChildInterpolationBinding;
  19410. }()) || _class2);
  19411. var SyntaxInterpreter = exports.SyntaxInterpreter = (_temp2 = _class3 = function () {
  19412. function SyntaxInterpreter(parser, observerLocator, eventManager, attributeMap) {
  19413. this.parser = parser;
  19414. this.observerLocator = observerLocator;
  19415. this.eventManager = eventManager;
  19416. this.attributeMap = attributeMap;
  19417. }
  19418. SyntaxInterpreter.prototype.interpret = function interpret(resources, element, info, existingInstruction, context) {
  19419. if (info.command in this) {
  19420. return this[info.command](resources, element, info, existingInstruction, context);
  19421. }
  19422. return this.handleUnknownCommand(resources, element, info, existingInstruction, context);
  19423. };
  19424. SyntaxInterpreter.prototype.handleUnknownCommand = function handleUnknownCommand(resources, element, info, existingInstruction, context) {
  19425. LogManager.getLogger('templating-binding').warn('Unknown binding command.', info);
  19426. return existingInstruction;
  19427. };
  19428. SyntaxInterpreter.prototype.determineDefaultBindingMode = function determineDefaultBindingMode(element, attrName, context) {
  19429. var tagName = element.tagName.toLowerCase();
  19430. 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') {
  19431. return _aureliaBinding.bindingMode.twoWay;
  19432. }
  19433. if (context && attrName in context.attributes && context.attributes[attrName] && context.attributes[attrName].defaultBindingMode >= _aureliaBinding.bindingMode.oneTime) {
  19434. return context.attributes[attrName].defaultBindingMode;
  19435. }
  19436. return _aureliaBinding.bindingMode.oneWay;
  19437. };
  19438. SyntaxInterpreter.prototype.bind = function bind(resources, element, info, existingInstruction, context) {
  19439. var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
  19440. 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);
  19441. return instruction;
  19442. };
  19443. SyntaxInterpreter.prototype.trigger = function trigger(resources, element, info) {
  19444. return new _aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), false, true, resources.lookupFunctions);
  19445. };
  19446. SyntaxInterpreter.prototype.delegate = function delegate(resources, element, info) {
  19447. return new _aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), true, true, resources.lookupFunctions);
  19448. };
  19449. SyntaxInterpreter.prototype.call = function call(resources, element, info, existingInstruction) {
  19450. var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
  19451. instruction.attributes[info.attrName] = new _aureliaBinding.CallExpression(this.observerLocator, info.attrName, this.parser.parse(info.attrValue), resources.lookupFunctions);
  19452. return instruction;
  19453. };
  19454. SyntaxInterpreter.prototype.options = function options(resources, element, info, existingInstruction, context) {
  19455. var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
  19456. var attrValue = info.attrValue;
  19457. var language = this.language;
  19458. var name = null;
  19459. var target = '';
  19460. var current = void 0;
  19461. var i = void 0;
  19462. var ii = void 0;
  19463. var inString = false;
  19464. var inEscape = false;
  19465. for (i = 0, ii = attrValue.length; i < ii; ++i) {
  19466. current = attrValue[i];
  19467. if (current === ';' && !inString) {
  19468. info = language.inspectAttribute(resources, '?', name, target.trim());
  19469. language.createAttributeInstruction(resources, element, info, instruction, context);
  19470. if (!instruction.attributes[info.attrName]) {
  19471. instruction.attributes[info.attrName] = info.attrValue;
  19472. }
  19473. target = '';
  19474. name = null;
  19475. } else if (current === ':' && name === null) {
  19476. name = target.trim();
  19477. target = '';
  19478. } else if (current === '\\') {
  19479. target += current;
  19480. inEscape = true;
  19481. continue;
  19482. } else {
  19483. target += current;
  19484. if (name !== null && inEscape === false && current === '\'') {
  19485. inString = !inString;
  19486. }
  19487. }
  19488. inEscape = false;
  19489. }
  19490. if (name !== null) {
  19491. info = language.inspectAttribute(resources, '?', name, target.trim());
  19492. language.createAttributeInstruction(resources, element, info, instruction, context);
  19493. if (!instruction.attributes[info.attrName]) {
  19494. instruction.attributes[info.attrName] = info.attrValue;
  19495. }
  19496. }
  19497. return instruction;
  19498. };
  19499. SyntaxInterpreter.prototype['for'] = function _for(resources, element, info, existingInstruction) {
  19500. var parts = void 0;
  19501. var keyValue = void 0;
  19502. var instruction = void 0;
  19503. var attrValue = void 0;
  19504. var isDestructuring = void 0;
  19505. attrValue = info.attrValue;
  19506. isDestructuring = attrValue.match(/^ *[[].+[\]]/);
  19507. parts = isDestructuring ? attrValue.split('of ') : attrValue.split(' of ');
  19508. if (parts.length !== 2) {
  19509. throw new Error('Incorrect syntax for "for". The form is: "$local of $items" or "[$key, $value] of $items".');
  19510. }
  19511. instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
  19512. if (isDestructuring) {
  19513. keyValue = parts[0].replace(/[[\]]/g, '').replace(/,/g, ' ').replace(/\s+/g, ' ').trim().split(' ');
  19514. instruction.attributes.key = keyValue[0];
  19515. instruction.attributes.value = keyValue[1];
  19516. } else {
  19517. instruction.attributes.local = parts[0];
  19518. }
  19519. instruction.attributes.items = new _aureliaBinding.BindingExpression(this.observerLocator, 'items', this.parser.parse(parts[1]), _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions);
  19520. return instruction;
  19521. };
  19522. SyntaxInterpreter.prototype['two-way'] = function twoWay(resources, element, info, existingInstruction) {
  19523. var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
  19524. 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);
  19525. return instruction;
  19526. };
  19527. SyntaxInterpreter.prototype['one-way'] = function oneWay(resources, element, info, existingInstruction) {
  19528. var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
  19529. 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);
  19530. return instruction;
  19531. };
  19532. SyntaxInterpreter.prototype['one-time'] = function oneTime(resources, element, info, existingInstruction) {
  19533. var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName);
  19534. 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);
  19535. return instruction;
  19536. };
  19537. return SyntaxInterpreter;
  19538. }(), _class3.inject = [_aureliaBinding.Parser, _aureliaBinding.ObserverLocator, _aureliaBinding.EventManager, AttributeMap], _temp2);
  19539. var info = {};
  19540. var TemplatingBindingLanguage = exports.TemplatingBindingLanguage = (_temp3 = _class4 = function (_BindingLanguage) {
  19541. _inherits(TemplatingBindingLanguage, _BindingLanguage);
  19542. function TemplatingBindingLanguage(parser, observerLocator, syntaxInterpreter, attributeMap) {
  19543. var _this = _possibleConstructorReturn(this, _BindingLanguage.call(this));
  19544. _this.parser = parser;
  19545. _this.observerLocator = observerLocator;
  19546. _this.syntaxInterpreter = syntaxInterpreter;
  19547. _this.emptyStringExpression = _this.parser.parse('\'\'');
  19548. syntaxInterpreter.language = _this;
  19549. _this.attributeMap = attributeMap;
  19550. return _this;
  19551. }
  19552. TemplatingBindingLanguage.prototype.inspectAttribute = function inspectAttribute(resources, elementName, attrName, attrValue) {
  19553. var parts = attrName.split('.');
  19554. info.defaultBindingMode = null;
  19555. if (parts.length === 2) {
  19556. info.attrName = parts[0].trim();
  19557. info.attrValue = attrValue;
  19558. info.command = parts[1].trim();
  19559. if (info.command === 'ref') {
  19560. info.expression = new _aureliaBinding.NameExpression(this.parser.parse(attrValue), info.attrName, resources.lookupFunctions);
  19561. info.command = null;
  19562. info.attrName = 'ref';
  19563. } else {
  19564. info.expression = null;
  19565. }
  19566. } else if (attrName === 'ref') {
  19567. info.attrName = attrName;
  19568. info.attrValue = attrValue;
  19569. info.command = null;
  19570. info.expression = new _aureliaBinding.NameExpression(this.parser.parse(attrValue), 'element', resources.lookupFunctions);
  19571. } else {
  19572. info.attrName = attrName;
  19573. info.attrValue = attrValue;
  19574. info.command = null;
  19575. var interpolationParts = this.parseInterpolation(resources, attrValue);
  19576. if (interpolationParts === null) {
  19577. info.expression = null;
  19578. } else {
  19579. info.expression = new InterpolationBindingExpression(this.observerLocator, this.attributeMap.map(elementName, attrName), interpolationParts, _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions, attrName);
  19580. }
  19581. }
  19582. return info;
  19583. };
  19584. TemplatingBindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, theInfo, existingInstruction, context) {
  19585. var instruction = void 0;
  19586. if (theInfo.expression) {
  19587. if (theInfo.attrName === 'ref') {
  19588. return theInfo.expression;
  19589. }
  19590. instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(theInfo.attrName);
  19591. instruction.attributes[theInfo.attrName] = theInfo.expression;
  19592. } else if (theInfo.command) {
  19593. instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction, context);
  19594. }
  19595. return instruction;
  19596. };
  19597. TemplatingBindingLanguage.prototype.inspectTextContent = function inspectTextContent(resources, value) {
  19598. var parts = this.parseInterpolation(resources, value);
  19599. if (parts === null) {
  19600. return null;
  19601. }
  19602. return new InterpolationBindingExpression(this.observerLocator, 'textContent', parts, _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions, 'textContent');
  19603. };
  19604. TemplatingBindingLanguage.prototype.parseInterpolation = function parseInterpolation(resources, value) {
  19605. var i = value.indexOf('${', 0);
  19606. var ii = value.length;
  19607. var char = void 0;
  19608. var pos = 0;
  19609. var open = 0;
  19610. var quote = null;
  19611. var interpolationStart = void 0;
  19612. var parts = void 0;
  19613. var partIndex = 0;
  19614. while (i >= 0 && i < ii - 2) {
  19615. open = 1;
  19616. interpolationStart = i;
  19617. i += 2;
  19618. do {
  19619. char = value[i];
  19620. i++;
  19621. if (char === "'" || char === '"') {
  19622. if (quote === null) {
  19623. quote = char;
  19624. } else if (quote === char) {
  19625. quote = null;
  19626. }
  19627. continue;
  19628. }
  19629. if (char === '\\') {
  19630. i++;
  19631. continue;
  19632. }
  19633. if (quote !== null) {
  19634. continue;
  19635. }
  19636. if (char === '{') {
  19637. open++;
  19638. } else if (char === '}') {
  19639. open--;
  19640. }
  19641. } while (open > 0 && i < ii);
  19642. if (open === 0) {
  19643. parts = parts || [];
  19644. if (value[interpolationStart - 1] === '\\' && value[interpolationStart - 2] !== '\\') {
  19645. parts[partIndex] = value.substring(pos, interpolationStart - 1) + value.substring(interpolationStart, i);
  19646. partIndex++;
  19647. parts[partIndex] = this.emptyStringExpression;
  19648. partIndex++;
  19649. } else {
  19650. parts[partIndex] = value.substring(pos, interpolationStart);
  19651. partIndex++;
  19652. parts[partIndex] = this.parser.parse(value.substring(interpolationStart + 2, i - 1));
  19653. partIndex++;
  19654. }
  19655. pos = i;
  19656. i = value.indexOf('${', i);
  19657. } else {
  19658. break;
  19659. }
  19660. }
  19661. if (partIndex === 0) {
  19662. return null;
  19663. }
  19664. parts[partIndex] = value.substr(pos);
  19665. return parts;
  19666. };
  19667. return TemplatingBindingLanguage;
  19668. }(_aureliaTemplating.BindingLanguage), _class4.inject = [_aureliaBinding.Parser, _aureliaBinding.ObserverLocator, SyntaxInterpreter, AttributeMap], _temp3);
  19669. function configure(config) {
  19670. config.container.registerSingleton(_aureliaTemplating.BindingLanguage, TemplatingBindingLanguage);
  19671. config.container.registerAlias(_aureliaTemplating.BindingLanguage, TemplatingBindingLanguage);
  19672. }
  19673. });
  19674. 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"; });
  19675. /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
  19676. * @license MIT */
  19677. ;(function(root, factory) {
  19678. if (typeof define === 'function' && define.amd) {
  19679. define('nprogress/nprogress',factory);
  19680. } else if (typeof exports === 'object') {
  19681. module.exports = factory();
  19682. } else {
  19683. root.NProgress = factory();
  19684. }
  19685. })(this, function() {
  19686. var NProgress = {};
  19687. NProgress.version = '0.2.0';
  19688. var Settings = NProgress.settings = {
  19689. minimum: 0.08,
  19690. easing: 'ease',
  19691. positionUsing: '',
  19692. speed: 200,
  19693. trickle: true,
  19694. trickleRate: 0.02,
  19695. trickleSpeed: 800,
  19696. showSpinner: true,
  19697. barSelector: '[role="bar"]',
  19698. spinnerSelector: '[role="spinner"]',
  19699. parent: 'body',
  19700. template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
  19701. };
  19702. /**
  19703. * Updates configuration.
  19704. *
  19705. * NProgress.configure({
  19706. * minimum: 0.1
  19707. * });
  19708. */
  19709. NProgress.configure = function(options) {
  19710. var key, value;
  19711. for (key in options) {
  19712. value = options[key];
  19713. if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
  19714. }
  19715. return this;
  19716. };
  19717. /**
  19718. * Last number.
  19719. */
  19720. NProgress.status = null;
  19721. /**
  19722. * Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
  19723. *
  19724. * NProgress.set(0.4);
  19725. * NProgress.set(1.0);
  19726. */
  19727. NProgress.set = function(n) {
  19728. var started = NProgress.isStarted();
  19729. n = clamp(n, Settings.minimum, 1);
  19730. NProgress.status = (n === 1 ? null : n);
  19731. var progress = NProgress.render(!started),
  19732. bar = progress.querySelector(Settings.barSelector),
  19733. speed = Settings.speed,
  19734. ease = Settings.easing;
  19735. progress.offsetWidth; /* Repaint */
  19736. queue(function(next) {
  19737. // Set positionUsing if it hasn't already been set
  19738. if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
  19739. // Add transition
  19740. css(bar, barPositionCSS(n, speed, ease));
  19741. if (n === 1) {
  19742. // Fade out
  19743. css(progress, {
  19744. transition: 'none',
  19745. opacity: 1
  19746. });
  19747. progress.offsetWidth; /* Repaint */
  19748. setTimeout(function() {
  19749. css(progress, {
  19750. transition: 'all ' + speed + 'ms linear',
  19751. opacity: 0
  19752. });
  19753. setTimeout(function() {
  19754. NProgress.remove();
  19755. next();
  19756. }, speed);
  19757. }, speed);
  19758. } else {
  19759. setTimeout(next, speed);
  19760. }
  19761. });
  19762. return this;
  19763. };
  19764. NProgress.isStarted = function() {
  19765. return typeof NProgress.status === 'number';
  19766. };
  19767. /**
  19768. * Shows the progress bar.
  19769. * This is the same as setting the status to 0%, except that it doesn't go backwards.
  19770. *
  19771. * NProgress.start();
  19772. *
  19773. */
  19774. NProgress.start = function() {
  19775. if (!NProgress.status) NProgress.set(0);
  19776. var work = function() {
  19777. setTimeout(function() {
  19778. if (!NProgress.status) return;
  19779. NProgress.trickle();
  19780. work();
  19781. }, Settings.trickleSpeed);
  19782. };
  19783. if (Settings.trickle) work();
  19784. return this;
  19785. };
  19786. /**
  19787. * Hides the progress bar.
  19788. * This is the *sort of* the same as setting the status to 100%, with the
  19789. * difference being `done()` makes some placebo effect of some realistic motion.
  19790. *
  19791. * NProgress.done();
  19792. *
  19793. * If `true` is passed, it will show the progress bar even if its hidden.
  19794. *
  19795. * NProgress.done(true);
  19796. */
  19797. NProgress.done = function(force) {
  19798. if (!force && !NProgress.status) return this;
  19799. return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
  19800. };
  19801. /**
  19802. * Increments by a random amount.
  19803. */
  19804. NProgress.inc = function(amount) {
  19805. var n = NProgress.status;
  19806. if (!n) {
  19807. return NProgress.start();
  19808. } else {
  19809. if (typeof amount !== 'number') {
  19810. amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
  19811. }
  19812. n = clamp(n + amount, 0, 0.994);
  19813. return NProgress.set(n);
  19814. }
  19815. };
  19816. NProgress.trickle = function() {
  19817. return NProgress.inc(Math.random() * Settings.trickleRate);
  19818. };
  19819. /**
  19820. * Waits for all supplied jQuery promises and
  19821. * increases the progress as the promises resolve.
  19822. *
  19823. * @param $promise jQUery Promise
  19824. */
  19825. (function() {
  19826. var initial = 0, current = 0;
  19827. NProgress.promise = function($promise) {
  19828. if (!$promise || $promise.state() === "resolved") {
  19829. return this;
  19830. }
  19831. if (current === 0) {
  19832. NProgress.start();
  19833. }
  19834. initial++;
  19835. current++;
  19836. $promise.always(function() {
  19837. current--;
  19838. if (current === 0) {
  19839. initial = 0;
  19840. NProgress.done();
  19841. } else {
  19842. NProgress.set((initial - current) / initial);
  19843. }
  19844. });
  19845. return this;
  19846. };
  19847. })();
  19848. /**
  19849. * (Internal) renders the progress bar markup based on the `template`
  19850. * setting.
  19851. */
  19852. NProgress.render = function(fromStart) {
  19853. if (NProgress.isRendered()) return document.getElementById('nprogress');
  19854. addClass(document.documentElement, 'nprogress-busy');
  19855. var progress = document.createElement('div');
  19856. progress.id = 'nprogress';
  19857. progress.innerHTML = Settings.template;
  19858. var bar = progress.querySelector(Settings.barSelector),
  19859. perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
  19860. parent = document.querySelector(Settings.parent),
  19861. spinner;
  19862. css(bar, {
  19863. transition: 'all 0 linear',
  19864. transform: 'translate3d(' + perc + '%,0,0)'
  19865. });
  19866. if (!Settings.showSpinner) {
  19867. spinner = progress.querySelector(Settings.spinnerSelector);
  19868. spinner && removeElement(spinner);
  19869. }
  19870. if (parent != document.body) {
  19871. addClass(parent, 'nprogress-custom-parent');
  19872. }
  19873. parent.appendChild(progress);
  19874. return progress;
  19875. };
  19876. /**
  19877. * Removes the element. Opposite of render().
  19878. */
  19879. NProgress.remove = function() {
  19880. removeClass(document.documentElement, 'nprogress-busy');
  19881. removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent');
  19882. var progress = document.getElementById('nprogress');
  19883. progress && removeElement(progress);
  19884. };
  19885. /**
  19886. * Checks if the progress bar is rendered.
  19887. */
  19888. NProgress.isRendered = function() {
  19889. return !!document.getElementById('nprogress');
  19890. };
  19891. /**
  19892. * Determine which positioning CSS rule to use.
  19893. */
  19894. NProgress.getPositioningCSS = function() {
  19895. // Sniff on document.body.style
  19896. var bodyStyle = document.body.style;
  19897. // Sniff prefixes
  19898. var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
  19899. ('MozTransform' in bodyStyle) ? 'Moz' :
  19900. ('msTransform' in bodyStyle) ? 'ms' :
  19901. ('OTransform' in bodyStyle) ? 'O' : '';
  19902. if (vendorPrefix + 'Perspective' in bodyStyle) {
  19903. // Modern browsers with 3D support, e.g. Webkit, IE10
  19904. return 'translate3d';
  19905. } else if (vendorPrefix + 'Transform' in bodyStyle) {
  19906. // Browsers without 3D support, e.g. IE9
  19907. return 'translate';
  19908. } else {
  19909. // Browsers without translate() support, e.g. IE7-8
  19910. return 'margin';
  19911. }
  19912. };
  19913. /**
  19914. * Helpers
  19915. */
  19916. function clamp(n, min, max) {
  19917. if (n < min) return min;
  19918. if (n > max) return max;
  19919. return n;
  19920. }
  19921. /**
  19922. * (Internal) converts a percentage (`0..1`) to a bar translateX
  19923. * percentage (`-100%..0%`).
  19924. */
  19925. function toBarPerc(n) {
  19926. return (-1 + n) * 100;
  19927. }
  19928. /**
  19929. * (Internal) returns the correct CSS for changing the bar's
  19930. * position given an n percentage, and speed and ease from Settings
  19931. */
  19932. function barPositionCSS(n, speed, ease) {
  19933. var barCSS;
  19934. if (Settings.positionUsing === 'translate3d') {
  19935. barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
  19936. } else if (Settings.positionUsing === 'translate') {
  19937. barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
  19938. } else {
  19939. barCSS = { 'margin-left': toBarPerc(n)+'%' };
  19940. }
  19941. barCSS.transition = 'all '+speed+'ms '+ease;
  19942. return barCSS;
  19943. }
  19944. /**
  19945. * (Internal) Queues a function to be executed.
  19946. */
  19947. var queue = (function() {
  19948. var pending = [];
  19949. function next() {
  19950. var fn = pending.shift();
  19951. if (fn) {
  19952. fn(next);
  19953. }
  19954. }
  19955. return function(fn) {
  19956. pending.push(fn);
  19957. if (pending.length == 1) next();
  19958. };
  19959. })();
  19960. /**
  19961. * (Internal) Applies css properties to an element, similar to the jQuery
  19962. * css method.
  19963. *
  19964. * While this helper does assist with vendor prefixed property names, it
  19965. * does not perform any manipulation of values prior to setting styles.
  19966. */
  19967. var css = (function() {
  19968. var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
  19969. cssProps = {};
  19970. function camelCase(string) {
  19971. return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
  19972. return letter.toUpperCase();
  19973. });
  19974. }
  19975. function getVendorProp(name) {
  19976. var style = document.body.style;
  19977. if (name in style) return name;
  19978. var i = cssPrefixes.length,
  19979. capName = name.charAt(0).toUpperCase() + name.slice(1),
  19980. vendorName;
  19981. while (i--) {
  19982. vendorName = cssPrefixes[i] + capName;
  19983. if (vendorName in style) return vendorName;
  19984. }
  19985. return name;
  19986. }
  19987. function getStyleProp(name) {
  19988. name = camelCase(name);
  19989. return cssProps[name] || (cssProps[name] = getVendorProp(name));
  19990. }
  19991. function applyCss(element, prop, value) {
  19992. prop = getStyleProp(prop);
  19993. element.style[prop] = value;
  19994. }
  19995. return function(element, properties) {
  19996. var args = arguments,
  19997. prop,
  19998. value;
  19999. if (args.length == 2) {
  20000. for (prop in properties) {
  20001. value = properties[prop];
  20002. if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
  20003. }
  20004. } else {
  20005. applyCss(element, args[1], args[2]);
  20006. }
  20007. }
  20008. })();
  20009. /**
  20010. * (Internal) Determines if an element or space separated list of class names contains a class name.
  20011. */
  20012. function hasClass(element, name) {
  20013. var list = typeof element == 'string' ? element : classList(element);
  20014. return list.indexOf(' ' + name + ' ') >= 0;
  20015. }
  20016. /**
  20017. * (Internal) Adds a class to an element.
  20018. */
  20019. function addClass(element, name) {
  20020. var oldList = classList(element),
  20021. newList = oldList + name;
  20022. if (hasClass(oldList, name)) return;
  20023. // Trim the opening space.
  20024. element.className = newList.substring(1);
  20025. }
  20026. /**
  20027. * (Internal) Removes a class from an element.
  20028. */
  20029. function removeClass(element, name) {
  20030. var oldList = classList(element),
  20031. newList;
  20032. if (!hasClass(element, name)) return;
  20033. // Replace the class name.
  20034. newList = oldList.replace(' ' + name + ' ', ' ');
  20035. // Trim the opening and closing spaces.
  20036. element.className = newList.substring(1, newList.length - 1);
  20037. }
  20038. /**
  20039. * (Internal) Gets a space separated list of the class names on the element.
  20040. * The list is wrapped with a single space on each end to facilitate finding
  20041. * matches within the list.
  20042. */
  20043. function classList(element) {
  20044. return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
  20045. }
  20046. /**
  20047. * (Internal) Removes an element from the DOM.
  20048. */
  20049. function removeElement(element) {
  20050. element && element.parentNode && element.parentNode.removeChild(element);
  20051. }
  20052. return NProgress;
  20053. });
  20054. ;define('nprogress', ['nprogress/nprogress'], function (main) { return main; });
  20055. /*!
  20056. * jQuery JavaScript Library v2.2.4
  20057. * http://jquery.com/
  20058. *
  20059. * Includes Sizzle.js
  20060. * http://sizzlejs.com/
  20061. *
  20062. * Copyright jQuery Foundation and other contributors
  20063. * Released under the MIT license
  20064. * http://jquery.org/license
  20065. *
  20066. * Date: 2016-05-20T17:23Z
  20067. */
  20068. (function( global, factory ) {
  20069. if ( typeof module === "object" && typeof module.exports === "object" ) {
  20070. // For CommonJS and CommonJS-like environments where a proper `window`
  20071. // is present, execute the factory and get jQuery.
  20072. // For environments that do not have a `window` with a `document`
  20073. // (such as Node.js), expose a factory as module.exports.
  20074. // This accentuates the need for the creation of a real `window`.
  20075. // e.g. var jQuery = require("jquery")(window);
  20076. // See ticket #14549 for more info.
  20077. module.exports = global.document ?
  20078. factory( global, true ) :
  20079. function( w ) {
  20080. if ( !w.document ) {
  20081. throw new Error( "jQuery requires a window with a document" );
  20082. }
  20083. return factory( w );
  20084. };
  20085. } else {
  20086. factory( global );
  20087. }
  20088. // Pass this if window is not defined yet
  20089. }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  20090. // Support: Firefox 18+
  20091. // Can't be in strict mode, several libs including ASP.NET trace
  20092. // the stack via arguments.caller.callee and Firefox dies if
  20093. // you try to trace through "use strict" call chains. (#13335)
  20094. //"use strict";
  20095. var arr = [];
  20096. var document = window.document;
  20097. var slice = arr.slice;
  20098. var concat = arr.concat;
  20099. var push = arr.push;
  20100. var indexOf = arr.indexOf;
  20101. var class2type = {};
  20102. var toString = class2type.toString;
  20103. var hasOwn = class2type.hasOwnProperty;
  20104. var support = {};
  20105. var
  20106. version = "2.2.4",
  20107. // Define a local copy of jQuery
  20108. jQuery = function( selector, context ) {
  20109. // The jQuery object is actually just the init constructor 'enhanced'
  20110. // Need init if jQuery is called (just allow error to be thrown if not included)
  20111. return new jQuery.fn.init( selector, context );
  20112. },
  20113. // Support: Android<4.1
  20114. // Make sure we trim BOM and NBSP
  20115. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  20116. // Matches dashed string for camelizing
  20117. rmsPrefix = /^-ms-/,
  20118. rdashAlpha = /-([\da-z])/gi,
  20119. // Used by jQuery.camelCase as callback to replace()
  20120. fcamelCase = function( all, letter ) {
  20121. return letter.toUpperCase();
  20122. };
  20123. jQuery.fn = jQuery.prototype = {
  20124. // The current version of jQuery being used
  20125. jquery: version,
  20126. constructor: jQuery,
  20127. // Start with an empty selector
  20128. selector: "",
  20129. // The default length of a jQuery object is 0
  20130. length: 0,
  20131. toArray: function() {
  20132. return slice.call( this );
  20133. },
  20134. // Get the Nth element in the matched element set OR
  20135. // Get the whole matched element set as a clean array
  20136. get: function( num ) {
  20137. return num != null ?
  20138. // Return just the one element from the set
  20139. ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
  20140. // Return all the elements in a clean array
  20141. slice.call( this );
  20142. },
  20143. // Take an array of elements and push it onto the stack
  20144. // (returning the new matched element set)
  20145. pushStack: function( elems ) {
  20146. // Build a new jQuery matched element set
  20147. var ret = jQuery.merge( this.constructor(), elems );
  20148. // Add the old object onto the stack (as a reference)
  20149. ret.prevObject = this;
  20150. ret.context = this.context;
  20151. // Return the newly-formed element set
  20152. return ret;
  20153. },
  20154. // Execute a callback for every element in the matched set.
  20155. each: function( callback ) {
  20156. return jQuery.each( this, callback );
  20157. },
  20158. map: function( callback ) {
  20159. return this.pushStack( jQuery.map( this, function( elem, i ) {
  20160. return callback.call( elem, i, elem );
  20161. } ) );
  20162. },
  20163. slice: function() {
  20164. return this.pushStack( slice.apply( this, arguments ) );
  20165. },
  20166. first: function() {
  20167. return this.eq( 0 );
  20168. },
  20169. last: function() {
  20170. return this.eq( -1 );
  20171. },
  20172. eq: function( i ) {
  20173. var len = this.length,
  20174. j = +i + ( i < 0 ? len : 0 );
  20175. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  20176. },
  20177. end: function() {
  20178. return this.prevObject || this.constructor();
  20179. },
  20180. // For internal use only.
  20181. // Behaves like an Array's method, not like a jQuery method.
  20182. push: push,
  20183. sort: arr.sort,
  20184. splice: arr.splice
  20185. };
  20186. jQuery.extend = jQuery.fn.extend = function() {
  20187. var options, name, src, copy, copyIsArray, clone,
  20188. target = arguments[ 0 ] || {},
  20189. i = 1,
  20190. length = arguments.length,
  20191. deep = false;
  20192. // Handle a deep copy situation
  20193. if ( typeof target === "boolean" ) {
  20194. deep = target;
  20195. // Skip the boolean and the target
  20196. target = arguments[ i ] || {};
  20197. i++;
  20198. }
  20199. // Handle case when target is a string or something (possible in deep copy)
  20200. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  20201. target = {};
  20202. }
  20203. // Extend jQuery itself if only one argument is passed
  20204. if ( i === length ) {
  20205. target = this;
  20206. i--;
  20207. }
  20208. for ( ; i < length; i++ ) {
  20209. // Only deal with non-null/undefined values
  20210. if ( ( options = arguments[ i ] ) != null ) {
  20211. // Extend the base object
  20212. for ( name in options ) {
  20213. src = target[ name ];
  20214. copy = options[ name ];
  20215. // Prevent never-ending loop
  20216. if ( target === copy ) {
  20217. continue;
  20218. }
  20219. // Recurse if we're merging plain objects or arrays
  20220. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  20221. ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
  20222. if ( copyIsArray ) {
  20223. copyIsArray = false;
  20224. clone = src && jQuery.isArray( src ) ? src : [];
  20225. } else {
  20226. clone = src && jQuery.isPlainObject( src ) ? src : {};
  20227. }
  20228. // Never move original objects, clone them
  20229. target[ name ] = jQuery.extend( deep, clone, copy );
  20230. // Don't bring in undefined values
  20231. } else if ( copy !== undefined ) {
  20232. target[ name ] = copy;
  20233. }
  20234. }
  20235. }
  20236. }
  20237. // Return the modified object
  20238. return target;
  20239. };
  20240. jQuery.extend( {
  20241. // Unique for each copy of jQuery on the page
  20242. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  20243. // Assume jQuery is ready without the ready module
  20244. isReady: true,
  20245. error: function( msg ) {
  20246. throw new Error( msg );
  20247. },
  20248. noop: function() {},
  20249. isFunction: function( obj ) {
  20250. return jQuery.type( obj ) === "function";
  20251. },
  20252. isArray: Array.isArray,
  20253. isWindow: function( obj ) {
  20254. return obj != null && obj === obj.window;
  20255. },
  20256. isNumeric: function( obj ) {
  20257. // parseFloat NaNs numeric-cast false positives (null|true|false|"")
  20258. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  20259. // subtraction forces infinities to NaN
  20260. // adding 1 corrects loss of precision from parseFloat (#15100)
  20261. var realStringObj = obj && obj.toString();
  20262. return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
  20263. },
  20264. isPlainObject: function( obj ) {
  20265. var key;
  20266. // Not plain objects:
  20267. // - Any object or value whose internal [[Class]] property is not "[object Object]"
  20268. // - DOM nodes
  20269. // - window
  20270. if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  20271. return false;
  20272. }
  20273. // Not own constructor property must be Object
  20274. if ( obj.constructor &&
  20275. !hasOwn.call( obj, "constructor" ) &&
  20276. !hasOwn.call( obj.constructor.prototype || {}, "isPrototypeOf" ) ) {
  20277. return false;
  20278. }
  20279. // Own properties are enumerated firstly, so to speed up,
  20280. // if last one is own, then all properties are own
  20281. for ( key in obj ) {}
  20282. return key === undefined || hasOwn.call( obj, key );
  20283. },
  20284. isEmptyObject: function( obj ) {
  20285. var name;
  20286. for ( name in obj ) {
  20287. return false;
  20288. }
  20289. return true;
  20290. },
  20291. type: function( obj ) {
  20292. if ( obj == null ) {
  20293. return obj + "";
  20294. }
  20295. // Support: Android<4.0, iOS<6 (functionish RegExp)
  20296. return typeof obj === "object" || typeof obj === "function" ?
  20297. class2type[ toString.call( obj ) ] || "object" :
  20298. typeof obj;
  20299. },
  20300. // Evaluates a script in a global context
  20301. globalEval: function( code ) {
  20302. var script,
  20303. indirect = eval;
  20304. code = jQuery.trim( code );
  20305. if ( code ) {
  20306. // If the code includes a valid, prologue position
  20307. // strict mode pragma, execute code by injecting a
  20308. // script tag into the document.
  20309. if ( code.indexOf( "use strict" ) === 1 ) {
  20310. script = document.createElement( "script" );
  20311. script.text = code;
  20312. document.head.appendChild( script ).parentNode.removeChild( script );
  20313. } else {
  20314. // Otherwise, avoid the DOM node creation, insertion
  20315. // and removal by using an indirect global eval
  20316. indirect( code );
  20317. }
  20318. }
  20319. },
  20320. // Convert dashed to camelCase; used by the css and data modules
  20321. // Support: IE9-11+
  20322. // Microsoft forgot to hump their vendor prefix (#9572)
  20323. camelCase: function( string ) {
  20324. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  20325. },
  20326. nodeName: function( elem, name ) {
  20327. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  20328. },
  20329. each: function( obj, callback ) {
  20330. var length, i = 0;
  20331. if ( isArrayLike( obj ) ) {
  20332. length = obj.length;
  20333. for ( ; i < length; i++ ) {
  20334. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  20335. break;
  20336. }
  20337. }
  20338. } else {
  20339. for ( i in obj ) {
  20340. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  20341. break;
  20342. }
  20343. }
  20344. }
  20345. return obj;
  20346. },
  20347. // Support: Android<4.1
  20348. trim: function( text ) {
  20349. return text == null ?
  20350. "" :
  20351. ( text + "" ).replace( rtrim, "" );
  20352. },
  20353. // results is for internal usage only
  20354. makeArray: function( arr, results ) {
  20355. var ret = results || [];
  20356. if ( arr != null ) {
  20357. if ( isArrayLike( Object( arr ) ) ) {
  20358. jQuery.merge( ret,
  20359. typeof arr === "string" ?
  20360. [ arr ] : arr
  20361. );
  20362. } else {
  20363. push.call( ret, arr );
  20364. }
  20365. }
  20366. return ret;
  20367. },
  20368. inArray: function( elem, arr, i ) {
  20369. return arr == null ? -1 : indexOf.call( arr, elem, i );
  20370. },
  20371. merge: function( first, second ) {
  20372. var len = +second.length,
  20373. j = 0,
  20374. i = first.length;
  20375. for ( ; j < len; j++ ) {
  20376. first[ i++ ] = second[ j ];
  20377. }
  20378. first.length = i;
  20379. return first;
  20380. },
  20381. grep: function( elems, callback, invert ) {
  20382. var callbackInverse,
  20383. matches = [],
  20384. i = 0,
  20385. length = elems.length,
  20386. callbackExpect = !invert;
  20387. // Go through the array, only saving the items
  20388. // that pass the validator function
  20389. for ( ; i < length; i++ ) {
  20390. callbackInverse = !callback( elems[ i ], i );
  20391. if ( callbackInverse !== callbackExpect ) {
  20392. matches.push( elems[ i ] );
  20393. }
  20394. }
  20395. return matches;
  20396. },
  20397. // arg is for internal usage only
  20398. map: function( elems, callback, arg ) {
  20399. var length, value,
  20400. i = 0,
  20401. ret = [];
  20402. // Go through the array, translating each of the items to their new values
  20403. if ( isArrayLike( elems ) ) {
  20404. length = elems.length;
  20405. for ( ; i < length; i++ ) {
  20406. value = callback( elems[ i ], i, arg );
  20407. if ( value != null ) {
  20408. ret.push( value );
  20409. }
  20410. }
  20411. // Go through every key on the object,
  20412. } else {
  20413. for ( i in elems ) {
  20414. value = callback( elems[ i ], i, arg );
  20415. if ( value != null ) {
  20416. ret.push( value );
  20417. }
  20418. }
  20419. }
  20420. // Flatten any nested arrays
  20421. return concat.apply( [], ret );
  20422. },
  20423. // A global GUID counter for objects
  20424. guid: 1,
  20425. // Bind a function to a context, optionally partially applying any
  20426. // arguments.
  20427. proxy: function( fn, context ) {
  20428. var tmp, args, proxy;
  20429. if ( typeof context === "string" ) {
  20430. tmp = fn[ context ];
  20431. context = fn;
  20432. fn = tmp;
  20433. }
  20434. // Quick check to determine if target is callable, in the spec
  20435. // this throws a TypeError, but we will just return undefined.
  20436. if ( !jQuery.isFunction( fn ) ) {
  20437. return undefined;
  20438. }
  20439. // Simulated bind
  20440. args = slice.call( arguments, 2 );
  20441. proxy = function() {
  20442. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  20443. };
  20444. // Set the guid of unique handler to the same of original handler, so it can be removed
  20445. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  20446. return proxy;
  20447. },
  20448. now: Date.now,
  20449. // jQuery.support is not used in Core but other projects attach their
  20450. // properties to it so it needs to exist.
  20451. support: support
  20452. } );
  20453. // JSHint would error on this code due to the Symbol not being defined in ES5.
  20454. // Defining this global in .jshintrc would create a danger of using the global
  20455. // unguarded in another place, it seems safer to just disable JSHint for these
  20456. // three lines.
  20457. /* jshint ignore: start */
  20458. if ( typeof Symbol === "function" ) {
  20459. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  20460. }
  20461. /* jshint ignore: end */
  20462. // Populate the class2type map
  20463. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  20464. function( i, name ) {
  20465. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  20466. } );
  20467. function isArrayLike( obj ) {
  20468. // Support: iOS 8.2 (not reproducible in simulator)
  20469. // `in` check used to prevent JIT error (gh-2145)
  20470. // hasOwn isn't used here due to false negatives
  20471. // regarding Nodelist length in IE
  20472. var length = !!obj && "length" in obj && obj.length,
  20473. type = jQuery.type( obj );
  20474. if ( type === "function" || jQuery.isWindow( obj ) ) {
  20475. return false;
  20476. }
  20477. return type === "array" || length === 0 ||
  20478. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  20479. }
  20480. var Sizzle =
  20481. /*!
  20482. * Sizzle CSS Selector Engine v2.2.1
  20483. * http://sizzlejs.com/
  20484. *
  20485. * Copyright jQuery Foundation and other contributors
  20486. * Released under the MIT license
  20487. * http://jquery.org/license
  20488. *
  20489. * Date: 2015-10-17
  20490. */
  20491. (function( window ) {
  20492. var i,
  20493. support,
  20494. Expr,
  20495. getText,
  20496. isXML,
  20497. tokenize,
  20498. compile,
  20499. select,
  20500. outermostContext,
  20501. sortInput,
  20502. hasDuplicate,
  20503. // Local document vars
  20504. setDocument,
  20505. document,
  20506. docElem,
  20507. documentIsHTML,
  20508. rbuggyQSA,
  20509. rbuggyMatches,
  20510. matches,
  20511. contains,
  20512. // Instance-specific data
  20513. expando = "sizzle" + 1 * new Date(),
  20514. preferredDoc = window.document,
  20515. dirruns = 0,
  20516. done = 0,
  20517. classCache = createCache(),
  20518. tokenCache = createCache(),
  20519. compilerCache = createCache(),
  20520. sortOrder = function( a, b ) {
  20521. if ( a === b ) {
  20522. hasDuplicate = true;
  20523. }
  20524. return 0;
  20525. },
  20526. // General-purpose constants
  20527. MAX_NEGATIVE = 1 << 31,
  20528. // Instance methods
  20529. hasOwn = ({}).hasOwnProperty,
  20530. arr = [],
  20531. pop = arr.pop,
  20532. push_native = arr.push,
  20533. push = arr.push,
  20534. slice = arr.slice,
  20535. // Use a stripped-down indexOf as it's faster than native
  20536. // http://jsperf.com/thor-indexof-vs-for/5
  20537. indexOf = function( list, elem ) {
  20538. var i = 0,
  20539. len = list.length;
  20540. for ( ; i < len; i++ ) {
  20541. if ( list[i] === elem ) {
  20542. return i;
  20543. }
  20544. }
  20545. return -1;
  20546. },
  20547. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  20548. // Regular expressions
  20549. // http://www.w3.org/TR/css3-selectors/#whitespace
  20550. whitespace = "[\\x20\\t\\r\\n\\f]",
  20551. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  20552. identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
  20553. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  20554. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  20555. // Operator (capture 2)
  20556. "*([*^$|!~]?=)" + whitespace +
  20557. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  20558. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  20559. "*\\]",
  20560. pseudos = ":(" + identifier + ")(?:\\((" +
  20561. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  20562. // 1. quoted (capture 3; capture 4 or capture 5)
  20563. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  20564. // 2. simple (capture 6)
  20565. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  20566. // 3. anything else (capture 2)
  20567. ".*" +
  20568. ")\\)|)",
  20569. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  20570. rwhitespace = new RegExp( whitespace + "+", "g" ),
  20571. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  20572. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  20573. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  20574. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  20575. rpseudo = new RegExp( pseudos ),
  20576. ridentifier = new RegExp( "^" + identifier + "$" ),
  20577. matchExpr = {
  20578. "ID": new RegExp( "^#(" + identifier + ")" ),
  20579. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  20580. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  20581. "ATTR": new RegExp( "^" + attributes ),
  20582. "PSEUDO": new RegExp( "^" + pseudos ),
  20583. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  20584. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  20585. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  20586. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  20587. // For use in libraries implementing .is()
  20588. // We use this for POS matching in `select`
  20589. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  20590. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  20591. },
  20592. rinputs = /^(?:input|select|textarea|button)$/i,
  20593. rheader = /^h\d$/i,
  20594. rnative = /^[^{]+\{\s*\[native \w/,
  20595. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  20596. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  20597. rsibling = /[+~]/,
  20598. rescape = /'|\\/g,
  20599. // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  20600. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  20601. funescape = function( _, escaped, escapedWhitespace ) {
  20602. var high = "0x" + escaped - 0x10000;
  20603. // NaN means non-codepoint
  20604. // Support: Firefox<24
  20605. // Workaround erroneous numeric interpretation of +"0x"
  20606. return high !== high || escapedWhitespace ?
  20607. escaped :
  20608. high < 0 ?
  20609. // BMP codepoint
  20610. String.fromCharCode( high + 0x10000 ) :
  20611. // Supplemental Plane codepoint (surrogate pair)
  20612. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  20613. },
  20614. // Used for iframes
  20615. // See setDocument()
  20616. // Removing the function wrapper causes a "Permission Denied"
  20617. // error in IE
  20618. unloadHandler = function() {
  20619. setDocument();
  20620. };
  20621. // Optimize for push.apply( _, NodeList )
  20622. try {
  20623. push.apply(
  20624. (arr = slice.call( preferredDoc.childNodes )),
  20625. preferredDoc.childNodes
  20626. );
  20627. // Support: Android<4.0
  20628. // Detect silently failing push.apply
  20629. arr[ preferredDoc.childNodes.length ].nodeType;
  20630. } catch ( e ) {
  20631. push = { apply: arr.length ?
  20632. // Leverage slice if possible
  20633. function( target, els ) {
  20634. push_native.apply( target, slice.call(els) );
  20635. } :
  20636. // Support: IE<9
  20637. // Otherwise append directly
  20638. function( target, els ) {
  20639. var j = target.length,
  20640. i = 0;
  20641. // Can't trust NodeList.length
  20642. while ( (target[j++] = els[i++]) ) {}
  20643. target.length = j - 1;
  20644. }
  20645. };
  20646. }
  20647. function Sizzle( selector, context, results, seed ) {
  20648. var m, i, elem, nid, nidselect, match, groups, newSelector,
  20649. newContext = context && context.ownerDocument,
  20650. // nodeType defaults to 9, since context defaults to document
  20651. nodeType = context ? context.nodeType : 9;
  20652. results = results || [];
  20653. // Return early from calls with invalid selector or context
  20654. if ( typeof selector !== "string" || !selector ||
  20655. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  20656. return results;
  20657. }
  20658. // Try to shortcut find operations (as opposed to filters) in HTML documents
  20659. if ( !seed ) {
  20660. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  20661. setDocument( context );
  20662. }
  20663. context = context || document;
  20664. if ( documentIsHTML ) {
  20665. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  20666. // (excepting DocumentFragment context, where the methods don't exist)
  20667. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  20668. // ID selector
  20669. if ( (m = match[1]) ) {
  20670. // Document context
  20671. if ( nodeType === 9 ) {
  20672. if ( (elem = context.getElementById( m )) ) {
  20673. // Support: IE, Opera, Webkit
  20674. // TODO: identify versions
  20675. // getElementById can match elements by name instead of ID
  20676. if ( elem.id === m ) {
  20677. results.push( elem );
  20678. return results;
  20679. }
  20680. } else {
  20681. return results;
  20682. }
  20683. // Element context
  20684. } else {
  20685. // Support: IE, Opera, Webkit
  20686. // TODO: identify versions
  20687. // getElementById can match elements by name instead of ID
  20688. if ( newContext && (elem = newContext.getElementById( m )) &&
  20689. contains( context, elem ) &&
  20690. elem.id === m ) {
  20691. results.push( elem );
  20692. return results;
  20693. }
  20694. }
  20695. // Type selector
  20696. } else if ( match[2] ) {
  20697. push.apply( results, context.getElementsByTagName( selector ) );
  20698. return results;
  20699. // Class selector
  20700. } else if ( (m = match[3]) && support.getElementsByClassName &&
  20701. context.getElementsByClassName ) {
  20702. push.apply( results, context.getElementsByClassName( m ) );
  20703. return results;
  20704. }
  20705. }
  20706. // Take advantage of querySelectorAll
  20707. if ( support.qsa &&
  20708. !compilerCache[ selector + " " ] &&
  20709. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  20710. if ( nodeType !== 1 ) {
  20711. newContext = context;
  20712. newSelector = selector;
  20713. // qSA looks outside Element context, which is not what we want
  20714. // Thanks to Andrew Dupont for this workaround technique
  20715. // Support: IE <=8
  20716. // Exclude object elements
  20717. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  20718. // Capture the context ID, setting it first if necessary
  20719. if ( (nid = context.getAttribute( "id" )) ) {
  20720. nid = nid.replace( rescape, "\\$&" );
  20721. } else {
  20722. context.setAttribute( "id", (nid = expando) );
  20723. }
  20724. // Prefix every selector in the list
  20725. groups = tokenize( selector );
  20726. i = groups.length;
  20727. nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
  20728. while ( i-- ) {
  20729. groups[i] = nidselect + " " + toSelector( groups[i] );
  20730. }
  20731. newSelector = groups.join( "," );
  20732. // Expand context for sibling selectors
  20733. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  20734. context;
  20735. }
  20736. if ( newSelector ) {
  20737. try {
  20738. push.apply( results,
  20739. newContext.querySelectorAll( newSelector )
  20740. );
  20741. return results;
  20742. } catch ( qsaError ) {
  20743. } finally {
  20744. if ( nid === expando ) {
  20745. context.removeAttribute( "id" );
  20746. }
  20747. }
  20748. }
  20749. }
  20750. }
  20751. }
  20752. // All others
  20753. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  20754. }
  20755. /**
  20756. * Create key-value caches of limited size
  20757. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  20758. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  20759. * deleting the oldest entry
  20760. */
  20761. function createCache() {
  20762. var keys = [];
  20763. function cache( key, value ) {
  20764. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  20765. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  20766. // Only keep the most recent entries
  20767. delete cache[ keys.shift() ];
  20768. }
  20769. return (cache[ key + " " ] = value);
  20770. }
  20771. return cache;
  20772. }
  20773. /**
  20774. * Mark a function for special use by Sizzle
  20775. * @param {Function} fn The function to mark
  20776. */
  20777. function markFunction( fn ) {
  20778. fn[ expando ] = true;
  20779. return fn;
  20780. }
  20781. /**
  20782. * Support testing using an element
  20783. * @param {Function} fn Passed the created div and expects a boolean result
  20784. */
  20785. function assert( fn ) {
  20786. var div = document.createElement("div");
  20787. try {
  20788. return !!fn( div );
  20789. } catch (e) {
  20790. return false;
  20791. } finally {
  20792. // Remove from its parent by default
  20793. if ( div.parentNode ) {
  20794. div.parentNode.removeChild( div );
  20795. }
  20796. // release memory in IE
  20797. div = null;
  20798. }
  20799. }
  20800. /**
  20801. * Adds the same handler for all of the specified attrs
  20802. * @param {String} attrs Pipe-separated list of attributes
  20803. * @param {Function} handler The method that will be applied
  20804. */
  20805. function addHandle( attrs, handler ) {
  20806. var arr = attrs.split("|"),
  20807. i = arr.length;
  20808. while ( i-- ) {
  20809. Expr.attrHandle[ arr[i] ] = handler;
  20810. }
  20811. }
  20812. /**
  20813. * Checks document order of two siblings
  20814. * @param {Element} a
  20815. * @param {Element} b
  20816. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  20817. */
  20818. function siblingCheck( a, b ) {
  20819. var cur = b && a,
  20820. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  20821. ( ~b.sourceIndex || MAX_NEGATIVE ) -
  20822. ( ~a.sourceIndex || MAX_NEGATIVE );
  20823. // Use IE sourceIndex if available on both nodes
  20824. if ( diff ) {
  20825. return diff;
  20826. }
  20827. // Check if b follows a
  20828. if ( cur ) {
  20829. while ( (cur = cur.nextSibling) ) {
  20830. if ( cur === b ) {
  20831. return -1;
  20832. }
  20833. }
  20834. }
  20835. return a ? 1 : -1;
  20836. }
  20837. /**
  20838. * Returns a function to use in pseudos for input types
  20839. * @param {String} type
  20840. */
  20841. function createInputPseudo( type ) {
  20842. return function( elem ) {
  20843. var name = elem.nodeName.toLowerCase();
  20844. return name === "input" && elem.type === type;
  20845. };
  20846. }
  20847. /**
  20848. * Returns a function to use in pseudos for buttons
  20849. * @param {String} type
  20850. */
  20851. function createButtonPseudo( type ) {
  20852. return function( elem ) {
  20853. var name = elem.nodeName.toLowerCase();
  20854. return (name === "input" || name === "button") && elem.type === type;
  20855. };
  20856. }
  20857. /**
  20858. * Returns a function to use in pseudos for positionals
  20859. * @param {Function} fn
  20860. */
  20861. function createPositionalPseudo( fn ) {
  20862. return markFunction(function( argument ) {
  20863. argument = +argument;
  20864. return markFunction(function( seed, matches ) {
  20865. var j,
  20866. matchIndexes = fn( [], seed.length, argument ),
  20867. i = matchIndexes.length;
  20868. // Match elements found at the specified indexes
  20869. while ( i-- ) {
  20870. if ( seed[ (j = matchIndexes[i]) ] ) {
  20871. seed[j] = !(matches[j] = seed[j]);
  20872. }
  20873. }
  20874. });
  20875. });
  20876. }
  20877. /**
  20878. * Checks a node for validity as a Sizzle context
  20879. * @param {Element|Object=} context
  20880. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  20881. */
  20882. function testContext( context ) {
  20883. return context && typeof context.getElementsByTagName !== "undefined" && context;
  20884. }
  20885. // Expose support vars for convenience
  20886. support = Sizzle.support = {};
  20887. /**
  20888. * Detects XML nodes
  20889. * @param {Element|Object} elem An element or a document
  20890. * @returns {Boolean} True iff elem is a non-HTML XML node
  20891. */
  20892. isXML = Sizzle.isXML = function( elem ) {
  20893. // documentElement is verified for cases where it doesn't yet exist
  20894. // (such as loading iframes in IE - #4833)
  20895. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  20896. return documentElement ? documentElement.nodeName !== "HTML" : false;
  20897. };
  20898. /**
  20899. * Sets document-related variables once based on the current document
  20900. * @param {Element|Object} [doc] An element or document object to use to set the document
  20901. * @returns {Object} Returns the current document
  20902. */
  20903. setDocument = Sizzle.setDocument = function( node ) {
  20904. var hasCompare, parent,
  20905. doc = node ? node.ownerDocument || node : preferredDoc;
  20906. // Return early if doc is invalid or already selected
  20907. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  20908. return document;
  20909. }
  20910. // Update global variables
  20911. document = doc;
  20912. docElem = document.documentElement;
  20913. documentIsHTML = !isXML( document );
  20914. // Support: IE 9-11, Edge
  20915. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  20916. if ( (parent = document.defaultView) && parent.top !== parent ) {
  20917. // Support: IE 11
  20918. if ( parent.addEventListener ) {
  20919. parent.addEventListener( "unload", unloadHandler, false );
  20920. // Support: IE 9 - 10 only
  20921. } else if ( parent.attachEvent ) {
  20922. parent.attachEvent( "onunload", unloadHandler );
  20923. }
  20924. }
  20925. /* Attributes
  20926. ---------------------------------------------------------------------- */
  20927. // Support: IE<8
  20928. // Verify that getAttribute really returns attributes and not properties
  20929. // (excepting IE8 booleans)
  20930. support.attributes = assert(function( div ) {
  20931. div.className = "i";
  20932. return !div.getAttribute("className");
  20933. });
  20934. /* getElement(s)By*
  20935. ---------------------------------------------------------------------- */
  20936. // Check if getElementsByTagName("*") returns only elements
  20937. support.getElementsByTagName = assert(function( div ) {
  20938. div.appendChild( document.createComment("") );
  20939. return !div.getElementsByTagName("*").length;
  20940. });
  20941. // Support: IE<9
  20942. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  20943. // Support: IE<10
  20944. // Check if getElementById returns elements by name
  20945. // The broken getElementById methods don't pick up programatically-set names,
  20946. // so use a roundabout getElementsByName test
  20947. support.getById = assert(function( div ) {
  20948. docElem.appendChild( div ).id = expando;
  20949. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  20950. });
  20951. // ID find and filter
  20952. if ( support.getById ) {
  20953. Expr.find["ID"] = function( id, context ) {
  20954. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  20955. var m = context.getElementById( id );
  20956. return m ? [ m ] : [];
  20957. }
  20958. };
  20959. Expr.filter["ID"] = function( id ) {
  20960. var attrId = id.replace( runescape, funescape );
  20961. return function( elem ) {
  20962. return elem.getAttribute("id") === attrId;
  20963. };
  20964. };
  20965. } else {
  20966. // Support: IE6/7
  20967. // getElementById is not reliable as a find shortcut
  20968. delete Expr.find["ID"];
  20969. Expr.filter["ID"] = function( id ) {
  20970. var attrId = id.replace( runescape, funescape );
  20971. return function( elem ) {
  20972. var node = typeof elem.getAttributeNode !== "undefined" &&
  20973. elem.getAttributeNode("id");
  20974. return node && node.value === attrId;
  20975. };
  20976. };
  20977. }
  20978. // Tag
  20979. Expr.find["TAG"] = support.getElementsByTagName ?
  20980. function( tag, context ) {
  20981. if ( typeof context.getElementsByTagName !== "undefined" ) {
  20982. return context.getElementsByTagName( tag );
  20983. // DocumentFragment nodes don't have gEBTN
  20984. } else if ( support.qsa ) {
  20985. return context.querySelectorAll( tag );
  20986. }
  20987. } :
  20988. function( tag, context ) {
  20989. var elem,
  20990. tmp = [],
  20991. i = 0,
  20992. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  20993. results = context.getElementsByTagName( tag );
  20994. // Filter out possible comments
  20995. if ( tag === "*" ) {
  20996. while ( (elem = results[i++]) ) {
  20997. if ( elem.nodeType === 1 ) {
  20998. tmp.push( elem );
  20999. }
  21000. }
  21001. return tmp;
  21002. }
  21003. return results;
  21004. };
  21005. // Class
  21006. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  21007. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  21008. return context.getElementsByClassName( className );
  21009. }
  21010. };
  21011. /* QSA/matchesSelector
  21012. ---------------------------------------------------------------------- */
  21013. // QSA and matchesSelector support
  21014. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  21015. rbuggyMatches = [];
  21016. // qSa(:focus) reports false when true (Chrome 21)
  21017. // We allow this because of a bug in IE8/9 that throws an error
  21018. // whenever `document.activeElement` is accessed on an iframe
  21019. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  21020. // See http://bugs.jquery.com/ticket/13378
  21021. rbuggyQSA = [];
  21022. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  21023. // Build QSA regex
  21024. // Regex strategy adopted from Diego Perini
  21025. assert(function( div ) {
  21026. // Select is set to empty string on purpose
  21027. // This is to test IE's treatment of not explicitly
  21028. // setting a boolean content attribute,
  21029. // since its presence should be enough
  21030. // http://bugs.jquery.com/ticket/12359
  21031. docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
  21032. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  21033. "<option selected=''></option></select>";
  21034. // Support: IE8, Opera 11-12.16
  21035. // Nothing should be selected when empty strings follow ^= or $= or *=
  21036. // The test attribute must be unknown in Opera but "safe" for WinRT
  21037. // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  21038. if ( div.querySelectorAll("[msallowcapture^='']").length ) {
  21039. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  21040. }
  21041. // Support: IE8
  21042. // Boolean attributes and "value" are not treated correctly
  21043. if ( !div.querySelectorAll("[selected]").length ) {
  21044. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  21045. }
  21046. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  21047. if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  21048. rbuggyQSA.push("~=");
  21049. }
  21050. // Webkit/Opera - :checked should return selected option elements
  21051. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  21052. // IE8 throws error here and will not see later tests
  21053. if ( !div.querySelectorAll(":checked").length ) {
  21054. rbuggyQSA.push(":checked");
  21055. }
  21056. // Support: Safari 8+, iOS 8+
  21057. // https://bugs.webkit.org/show_bug.cgi?id=136851
  21058. // In-page `selector#id sibing-combinator selector` fails
  21059. if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
  21060. rbuggyQSA.push(".#.+[+~]");
  21061. }
  21062. });
  21063. assert(function( div ) {
  21064. // Support: Windows 8 Native Apps
  21065. // The type and name attributes are restricted during .innerHTML assignment
  21066. var input = document.createElement("input");
  21067. input.setAttribute( "type", "hidden" );
  21068. div.appendChild( input ).setAttribute( "name", "D" );
  21069. // Support: IE8
  21070. // Enforce case-sensitivity of name attribute
  21071. if ( div.querySelectorAll("[name=d]").length ) {
  21072. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  21073. }
  21074. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  21075. // IE8 throws error here and will not see later tests
  21076. if ( !div.querySelectorAll(":enabled").length ) {
  21077. rbuggyQSA.push( ":enabled", ":disabled" );
  21078. }
  21079. // Opera 10-11 does not throw on post-comma invalid pseudos
  21080. div.querySelectorAll("*,:x");
  21081. rbuggyQSA.push(",.*:");
  21082. });
  21083. }
  21084. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  21085. docElem.webkitMatchesSelector ||
  21086. docElem.mozMatchesSelector ||
  21087. docElem.oMatchesSelector ||
  21088. docElem.msMatchesSelector) )) ) {
  21089. assert(function( div ) {
  21090. // Check to see if it's possible to do matchesSelector
  21091. // on a disconnected node (IE 9)
  21092. support.disconnectedMatch = matches.call( div, "div" );
  21093. // This should fail with an exception
  21094. // Gecko does not error, returns false instead
  21095. matches.call( div, "[s!='']:x" );
  21096. rbuggyMatches.push( "!=", pseudos );
  21097. });
  21098. }
  21099. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  21100. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  21101. /* Contains
  21102. ---------------------------------------------------------------------- */
  21103. hasCompare = rnative.test( docElem.compareDocumentPosition );
  21104. // Element contains another
  21105. // Purposefully self-exclusive
  21106. // As in, an element does not contain itself
  21107. contains = hasCompare || rnative.test( docElem.contains ) ?
  21108. function( a, b ) {
  21109. var adown = a.nodeType === 9 ? a.documentElement : a,
  21110. bup = b && b.parentNode;
  21111. return a === bup || !!( bup && bup.nodeType === 1 && (
  21112. adown.contains ?
  21113. adown.contains( bup ) :
  21114. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  21115. ));
  21116. } :
  21117. function( a, b ) {
  21118. if ( b ) {
  21119. while ( (b = b.parentNode) ) {
  21120. if ( b === a ) {
  21121. return true;
  21122. }
  21123. }
  21124. }
  21125. return false;
  21126. };
  21127. /* Sorting
  21128. ---------------------------------------------------------------------- */
  21129. // Document order sorting
  21130. sortOrder = hasCompare ?
  21131. function( a, b ) {
  21132. // Flag for duplicate removal
  21133. if ( a === b ) {
  21134. hasDuplicate = true;
  21135. return 0;
  21136. }
  21137. // Sort on method existence if only one input has compareDocumentPosition
  21138. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  21139. if ( compare ) {
  21140. return compare;
  21141. }
  21142. // Calculate position if both inputs belong to the same document
  21143. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  21144. a.compareDocumentPosition( b ) :
  21145. // Otherwise we know they are disconnected
  21146. 1;
  21147. // Disconnected nodes
  21148. if ( compare & 1 ||
  21149. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  21150. // Choose the first element that is related to our preferred document
  21151. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  21152. return -1;
  21153. }
  21154. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  21155. return 1;
  21156. }
  21157. // Maintain original order
  21158. return sortInput ?
  21159. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  21160. 0;
  21161. }
  21162. return compare & 4 ? -1 : 1;
  21163. } :
  21164. function( a, b ) {
  21165. // Exit early if the nodes are identical
  21166. if ( a === b ) {
  21167. hasDuplicate = true;
  21168. return 0;
  21169. }
  21170. var cur,
  21171. i = 0,
  21172. aup = a.parentNode,
  21173. bup = b.parentNode,
  21174. ap = [ a ],
  21175. bp = [ b ];
  21176. // Parentless nodes are either documents or disconnected
  21177. if ( !aup || !bup ) {
  21178. return a === document ? -1 :
  21179. b === document ? 1 :
  21180. aup ? -1 :
  21181. bup ? 1 :
  21182. sortInput ?
  21183. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  21184. 0;
  21185. // If the nodes are siblings, we can do a quick check
  21186. } else if ( aup === bup ) {
  21187. return siblingCheck( a, b );
  21188. }
  21189. // Otherwise we need full lists of their ancestors for comparison
  21190. cur = a;
  21191. while ( (cur = cur.parentNode) ) {
  21192. ap.unshift( cur );
  21193. }
  21194. cur = b;
  21195. while ( (cur = cur.parentNode) ) {
  21196. bp.unshift( cur );
  21197. }
  21198. // Walk down the tree looking for a discrepancy
  21199. while ( ap[i] === bp[i] ) {
  21200. i++;
  21201. }
  21202. return i ?
  21203. // Do a sibling check if the nodes have a common ancestor
  21204. siblingCheck( ap[i], bp[i] ) :
  21205. // Otherwise nodes in our document sort first
  21206. ap[i] === preferredDoc ? -1 :
  21207. bp[i] === preferredDoc ? 1 :
  21208. 0;
  21209. };
  21210. return document;
  21211. };
  21212. Sizzle.matches = function( expr, elements ) {
  21213. return Sizzle( expr, null, null, elements );
  21214. };
  21215. Sizzle.matchesSelector = function( elem, expr ) {
  21216. // Set document vars if needed
  21217. if ( ( elem.ownerDocument || elem ) !== document ) {
  21218. setDocument( elem );
  21219. }
  21220. // Make sure that attribute selectors are quoted
  21221. expr = expr.replace( rattributeQuotes, "='$1']" );
  21222. if ( support.matchesSelector && documentIsHTML &&
  21223. !compilerCache[ expr + " " ] &&
  21224. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  21225. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  21226. try {
  21227. var ret = matches.call( elem, expr );
  21228. // IE 9's matchesSelector returns false on disconnected nodes
  21229. if ( ret || support.disconnectedMatch ||
  21230. // As well, disconnected nodes are said to be in a document
  21231. // fragment in IE 9
  21232. elem.document && elem.document.nodeType !== 11 ) {
  21233. return ret;
  21234. }
  21235. } catch (e) {}
  21236. }
  21237. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  21238. };
  21239. Sizzle.contains = function( context, elem ) {
  21240. // Set document vars if needed
  21241. if ( ( context.ownerDocument || context ) !== document ) {
  21242. setDocument( context );
  21243. }
  21244. return contains( context, elem );
  21245. };
  21246. Sizzle.attr = function( elem, name ) {
  21247. // Set document vars if needed
  21248. if ( ( elem.ownerDocument || elem ) !== document ) {
  21249. setDocument( elem );
  21250. }
  21251. var fn = Expr.attrHandle[ name.toLowerCase() ],
  21252. // Don't get fooled by Object.prototype properties (jQuery #13807)
  21253. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  21254. fn( elem, name, !documentIsHTML ) :
  21255. undefined;
  21256. return val !== undefined ?
  21257. val :
  21258. support.attributes || !documentIsHTML ?
  21259. elem.getAttribute( name ) :
  21260. (val = elem.getAttributeNode(name)) && val.specified ?
  21261. val.value :
  21262. null;
  21263. };
  21264. Sizzle.error = function( msg ) {
  21265. throw new Error( "Syntax error, unrecognized expression: " + msg );
  21266. };
  21267. /**
  21268. * Document sorting and removing duplicates
  21269. * @param {ArrayLike} results
  21270. */
  21271. Sizzle.uniqueSort = function( results ) {
  21272. var elem,
  21273. duplicates = [],
  21274. j = 0,
  21275. i = 0;
  21276. // Unless we *know* we can detect duplicates, assume their presence
  21277. hasDuplicate = !support.detectDuplicates;
  21278. sortInput = !support.sortStable && results.slice( 0 );
  21279. results.sort( sortOrder );
  21280. if ( hasDuplicate ) {
  21281. while ( (elem = results[i++]) ) {
  21282. if ( elem === results[ i ] ) {
  21283. j = duplicates.push( i );
  21284. }
  21285. }
  21286. while ( j-- ) {
  21287. results.splice( duplicates[ j ], 1 );
  21288. }
  21289. }
  21290. // Clear input after sorting to release objects
  21291. // See https://github.com/jquery/sizzle/pull/225
  21292. sortInput = null;
  21293. return results;
  21294. };
  21295. /**
  21296. * Utility function for retrieving the text value of an array of DOM nodes
  21297. * @param {Array|Element} elem
  21298. */
  21299. getText = Sizzle.getText = function( elem ) {
  21300. var node,
  21301. ret = "",
  21302. i = 0,
  21303. nodeType = elem.nodeType;
  21304. if ( !nodeType ) {
  21305. // If no nodeType, this is expected to be an array
  21306. while ( (node = elem[i++]) ) {
  21307. // Do not traverse comment nodes
  21308. ret += getText( node );
  21309. }
  21310. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  21311. // Use textContent for elements
  21312. // innerText usage removed for consistency of new lines (jQuery #11153)
  21313. if ( typeof elem.textContent === "string" ) {
  21314. return elem.textContent;
  21315. } else {
  21316. // Traverse its children
  21317. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  21318. ret += getText( elem );
  21319. }
  21320. }
  21321. } else if ( nodeType === 3 || nodeType === 4 ) {
  21322. return elem.nodeValue;
  21323. }
  21324. // Do not include comment or processing instruction nodes
  21325. return ret;
  21326. };
  21327. Expr = Sizzle.selectors = {
  21328. // Can be adjusted by the user
  21329. cacheLength: 50,
  21330. createPseudo: markFunction,
  21331. match: matchExpr,
  21332. attrHandle: {},
  21333. find: {},
  21334. relative: {
  21335. ">": { dir: "parentNode", first: true },
  21336. " ": { dir: "parentNode" },
  21337. "+": { dir: "previousSibling", first: true },
  21338. "~": { dir: "previousSibling" }
  21339. },
  21340. preFilter: {
  21341. "ATTR": function( match ) {
  21342. match[1] = match[1].replace( runescape, funescape );
  21343. // Move the given value to match[3] whether quoted or unquoted
  21344. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  21345. if ( match[2] === "~=" ) {
  21346. match[3] = " " + match[3] + " ";
  21347. }
  21348. return match.slice( 0, 4 );
  21349. },
  21350. "CHILD": function( match ) {
  21351. /* matches from matchExpr["CHILD"]
  21352. 1 type (only|nth|...)
  21353. 2 what (child|of-type)
  21354. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  21355. 4 xn-component of xn+y argument ([+-]?\d*n|)
  21356. 5 sign of xn-component
  21357. 6 x of xn-component
  21358. 7 sign of y-component
  21359. 8 y of y-component
  21360. */
  21361. match[1] = match[1].toLowerCase();
  21362. if ( match[1].slice( 0, 3 ) === "nth" ) {
  21363. // nth-* requires argument
  21364. if ( !match[3] ) {
  21365. Sizzle.error( match[0] );
  21366. }
  21367. // numeric x and y parameters for Expr.filter.CHILD
  21368. // remember that false/true cast respectively to 0/1
  21369. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  21370. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  21371. // other types prohibit arguments
  21372. } else if ( match[3] ) {
  21373. Sizzle.error( match[0] );
  21374. }
  21375. return match;
  21376. },
  21377. "PSEUDO": function( match ) {
  21378. var excess,
  21379. unquoted = !match[6] && match[2];
  21380. if ( matchExpr["CHILD"].test( match[0] ) ) {
  21381. return null;
  21382. }
  21383. // Accept quoted arguments as-is
  21384. if ( match[3] ) {
  21385. match[2] = match[4] || match[5] || "";
  21386. // Strip excess characters from unquoted arguments
  21387. } else if ( unquoted && rpseudo.test( unquoted ) &&
  21388. // Get excess from tokenize (recursively)
  21389. (excess = tokenize( unquoted, true )) &&
  21390. // advance to the next closing parenthesis
  21391. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  21392. // excess is a negative index
  21393. match[0] = match[0].slice( 0, excess );
  21394. match[2] = unquoted.slice( 0, excess );
  21395. }
  21396. // Return only captures needed by the pseudo filter method (type and argument)
  21397. return match.slice( 0, 3 );
  21398. }
  21399. },
  21400. filter: {
  21401. "TAG": function( nodeNameSelector ) {
  21402. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  21403. return nodeNameSelector === "*" ?
  21404. function() { return true; } :
  21405. function( elem ) {
  21406. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  21407. };
  21408. },
  21409. "CLASS": function( className ) {
  21410. var pattern = classCache[ className + " " ];
  21411. return pattern ||
  21412. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  21413. classCache( className, function( elem ) {
  21414. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  21415. });
  21416. },
  21417. "ATTR": function( name, operator, check ) {
  21418. return function( elem ) {
  21419. var result = Sizzle.attr( elem, name );
  21420. if ( result == null ) {
  21421. return operator === "!=";
  21422. }
  21423. if ( !operator ) {
  21424. return true;
  21425. }
  21426. result += "";
  21427. return operator === "=" ? result === check :
  21428. operator === "!=" ? result !== check :
  21429. operator === "^=" ? check && result.indexOf( check ) === 0 :
  21430. operator === "*=" ? check && result.indexOf( check ) > -1 :
  21431. operator === "$=" ? check && result.slice( -check.length ) === check :
  21432. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  21433. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  21434. false;
  21435. };
  21436. },
  21437. "CHILD": function( type, what, argument, first, last ) {
  21438. var simple = type.slice( 0, 3 ) !== "nth",
  21439. forward = type.slice( -4 ) !== "last",
  21440. ofType = what === "of-type";
  21441. return first === 1 && last === 0 ?
  21442. // Shortcut for :nth-*(n)
  21443. function( elem ) {
  21444. return !!elem.parentNode;
  21445. } :
  21446. function( elem, context, xml ) {
  21447. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  21448. dir = simple !== forward ? "nextSibling" : "previousSibling",
  21449. parent = elem.parentNode,
  21450. name = ofType && elem.nodeName.toLowerCase(),
  21451. useCache = !xml && !ofType,
  21452. diff = false;
  21453. if ( parent ) {
  21454. // :(first|last|only)-(child|of-type)
  21455. if ( simple ) {
  21456. while ( dir ) {
  21457. node = elem;
  21458. while ( (node = node[ dir ]) ) {
  21459. if ( ofType ?
  21460. node.nodeName.toLowerCase() === name :
  21461. node.nodeType === 1 ) {
  21462. return false;
  21463. }
  21464. }
  21465. // Reverse direction for :only-* (if we haven't yet done so)
  21466. start = dir = type === "only" && !start && "nextSibling";
  21467. }
  21468. return true;
  21469. }
  21470. start = [ forward ? parent.firstChild : parent.lastChild ];
  21471. // non-xml :nth-child(...) stores cache data on `parent`
  21472. if ( forward && useCache ) {
  21473. // Seek `elem` from a previously-cached index
  21474. // ...in a gzip-friendly way
  21475. node = parent;
  21476. outerCache = node[ expando ] || (node[ expando ] = {});
  21477. // Support: IE <9 only
  21478. // Defend against cloned attroperties (jQuery gh-1709)
  21479. uniqueCache = outerCache[ node.uniqueID ] ||
  21480. (outerCache[ node.uniqueID ] = {});
  21481. cache = uniqueCache[ type ] || [];
  21482. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  21483. diff = nodeIndex && cache[ 2 ];
  21484. node = nodeIndex && parent.childNodes[ nodeIndex ];
  21485. while ( (node = ++nodeIndex && node && node[ dir ] ||
  21486. // Fallback to seeking `elem` from the start
  21487. (diff = nodeIndex = 0) || start.pop()) ) {
  21488. // When found, cache indexes on `parent` and break
  21489. if ( node.nodeType === 1 && ++diff && node === elem ) {
  21490. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  21491. break;
  21492. }
  21493. }
  21494. } else {
  21495. // Use previously-cached element index if available
  21496. if ( useCache ) {
  21497. // ...in a gzip-friendly way
  21498. node = elem;
  21499. outerCache = node[ expando ] || (node[ expando ] = {});
  21500. // Support: IE <9 only
  21501. // Defend against cloned attroperties (jQuery gh-1709)
  21502. uniqueCache = outerCache[ node.uniqueID ] ||
  21503. (outerCache[ node.uniqueID ] = {});
  21504. cache = uniqueCache[ type ] || [];
  21505. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  21506. diff = nodeIndex;
  21507. }
  21508. // xml :nth-child(...)
  21509. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  21510. if ( diff === false ) {
  21511. // Use the same loop as above to seek `elem` from the start
  21512. while ( (node = ++nodeIndex && node && node[ dir ] ||
  21513. (diff = nodeIndex = 0) || start.pop()) ) {
  21514. if ( ( ofType ?
  21515. node.nodeName.toLowerCase() === name :
  21516. node.nodeType === 1 ) &&
  21517. ++diff ) {
  21518. // Cache the index of each encountered element
  21519. if ( useCache ) {
  21520. outerCache = node[ expando ] || (node[ expando ] = {});
  21521. // Support: IE <9 only
  21522. // Defend against cloned attroperties (jQuery gh-1709)
  21523. uniqueCache = outerCache[ node.uniqueID ] ||
  21524. (outerCache[ node.uniqueID ] = {});
  21525. uniqueCache[ type ] = [ dirruns, diff ];
  21526. }
  21527. if ( node === elem ) {
  21528. break;
  21529. }
  21530. }
  21531. }
  21532. }
  21533. }
  21534. // Incorporate the offset, then check against cycle size
  21535. diff -= last;
  21536. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  21537. }
  21538. };
  21539. },
  21540. "PSEUDO": function( pseudo, argument ) {
  21541. // pseudo-class names are case-insensitive
  21542. // http://www.w3.org/TR/selectors/#pseudo-classes
  21543. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  21544. // Remember that setFilters inherits from pseudos
  21545. var args,
  21546. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  21547. Sizzle.error( "unsupported pseudo: " + pseudo );
  21548. // The user may use createPseudo to indicate that
  21549. // arguments are needed to create the filter function
  21550. // just as Sizzle does
  21551. if ( fn[ expando ] ) {
  21552. return fn( argument );
  21553. }
  21554. // But maintain support for old signatures
  21555. if ( fn.length > 1 ) {
  21556. args = [ pseudo, pseudo, "", argument ];
  21557. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  21558. markFunction(function( seed, matches ) {
  21559. var idx,
  21560. matched = fn( seed, argument ),
  21561. i = matched.length;
  21562. while ( i-- ) {
  21563. idx = indexOf( seed, matched[i] );
  21564. seed[ idx ] = !( matches[ idx ] = matched[i] );
  21565. }
  21566. }) :
  21567. function( elem ) {
  21568. return fn( elem, 0, args );
  21569. };
  21570. }
  21571. return fn;
  21572. }
  21573. },
  21574. pseudos: {
  21575. // Potentially complex pseudos
  21576. "not": markFunction(function( selector ) {
  21577. // Trim the selector passed to compile
  21578. // to avoid treating leading and trailing
  21579. // spaces as combinators
  21580. var input = [],
  21581. results = [],
  21582. matcher = compile( selector.replace( rtrim, "$1" ) );
  21583. return matcher[ expando ] ?
  21584. markFunction(function( seed, matches, context, xml ) {
  21585. var elem,
  21586. unmatched = matcher( seed, null, xml, [] ),
  21587. i = seed.length;
  21588. // Match elements unmatched by `matcher`
  21589. while ( i-- ) {
  21590. if ( (elem = unmatched[i]) ) {
  21591. seed[i] = !(matches[i] = elem);
  21592. }
  21593. }
  21594. }) :
  21595. function( elem, context, xml ) {
  21596. input[0] = elem;
  21597. matcher( input, null, xml, results );
  21598. // Don't keep the element (issue #299)
  21599. input[0] = null;
  21600. return !results.pop();
  21601. };
  21602. }),
  21603. "has": markFunction(function( selector ) {
  21604. return function( elem ) {
  21605. return Sizzle( selector, elem ).length > 0;
  21606. };
  21607. }),
  21608. "contains": markFunction(function( text ) {
  21609. text = text.replace( runescape, funescape );
  21610. return function( elem ) {
  21611. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  21612. };
  21613. }),
  21614. // "Whether an element is represented by a :lang() selector
  21615. // is based solely on the element's language value
  21616. // being equal to the identifier C,
  21617. // or beginning with the identifier C immediately followed by "-".
  21618. // The matching of C against the element's language value is performed case-insensitively.
  21619. // The identifier C does not have to be a valid language name."
  21620. // http://www.w3.org/TR/selectors/#lang-pseudo
  21621. "lang": markFunction( function( lang ) {
  21622. // lang value must be a valid identifier
  21623. if ( !ridentifier.test(lang || "") ) {
  21624. Sizzle.error( "unsupported lang: " + lang );
  21625. }
  21626. lang = lang.replace( runescape, funescape ).toLowerCase();
  21627. return function( elem ) {
  21628. var elemLang;
  21629. do {
  21630. if ( (elemLang = documentIsHTML ?
  21631. elem.lang :
  21632. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  21633. elemLang = elemLang.toLowerCase();
  21634. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  21635. }
  21636. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  21637. return false;
  21638. };
  21639. }),
  21640. // Miscellaneous
  21641. "target": function( elem ) {
  21642. var hash = window.location && window.location.hash;
  21643. return hash && hash.slice( 1 ) === elem.id;
  21644. },
  21645. "root": function( elem ) {
  21646. return elem === docElem;
  21647. },
  21648. "focus": function( elem ) {
  21649. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  21650. },
  21651. // Boolean properties
  21652. "enabled": function( elem ) {
  21653. return elem.disabled === false;
  21654. },
  21655. "disabled": function( elem ) {
  21656. return elem.disabled === true;
  21657. },
  21658. "checked": function( elem ) {
  21659. // In CSS3, :checked should return both checked and selected elements
  21660. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  21661. var nodeName = elem.nodeName.toLowerCase();
  21662. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  21663. },
  21664. "selected": function( elem ) {
  21665. // Accessing this property makes selected-by-default
  21666. // options in Safari work properly
  21667. if ( elem.parentNode ) {
  21668. elem.parentNode.selectedIndex;
  21669. }
  21670. return elem.selected === true;
  21671. },
  21672. // Contents
  21673. "empty": function( elem ) {
  21674. // http://www.w3.org/TR/selectors/#empty-pseudo
  21675. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  21676. // but not by others (comment: 8; processing instruction: 7; etc.)
  21677. // nodeType < 6 works because attributes (2) do not appear as children
  21678. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  21679. if ( elem.nodeType < 6 ) {
  21680. return false;
  21681. }
  21682. }
  21683. return true;
  21684. },
  21685. "parent": function( elem ) {
  21686. return !Expr.pseudos["empty"]( elem );
  21687. },
  21688. // Element/input types
  21689. "header": function( elem ) {
  21690. return rheader.test( elem.nodeName );
  21691. },
  21692. "input": function( elem ) {
  21693. return rinputs.test( elem.nodeName );
  21694. },
  21695. "button": function( elem ) {
  21696. var name = elem.nodeName.toLowerCase();
  21697. return name === "input" && elem.type === "button" || name === "button";
  21698. },
  21699. "text": function( elem ) {
  21700. var attr;
  21701. return elem.nodeName.toLowerCase() === "input" &&
  21702. elem.type === "text" &&
  21703. // Support: IE<8
  21704. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  21705. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  21706. },
  21707. // Position-in-collection
  21708. "first": createPositionalPseudo(function() {
  21709. return [ 0 ];
  21710. }),
  21711. "last": createPositionalPseudo(function( matchIndexes, length ) {
  21712. return [ length - 1 ];
  21713. }),
  21714. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  21715. return [ argument < 0 ? argument + length : argument ];
  21716. }),
  21717. "even": createPositionalPseudo(function( matchIndexes, length ) {
  21718. var i = 0;
  21719. for ( ; i < length; i += 2 ) {
  21720. matchIndexes.push( i );
  21721. }
  21722. return matchIndexes;
  21723. }),
  21724. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  21725. var i = 1;
  21726. for ( ; i < length; i += 2 ) {
  21727. matchIndexes.push( i );
  21728. }
  21729. return matchIndexes;
  21730. }),
  21731. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  21732. var i = argument < 0 ? argument + length : argument;
  21733. for ( ; --i >= 0; ) {
  21734. matchIndexes.push( i );
  21735. }
  21736. return matchIndexes;
  21737. }),
  21738. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  21739. var i = argument < 0 ? argument + length : argument;
  21740. for ( ; ++i < length; ) {
  21741. matchIndexes.push( i );
  21742. }
  21743. return matchIndexes;
  21744. })
  21745. }
  21746. };
  21747. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  21748. // Add button/input type pseudos
  21749. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  21750. Expr.pseudos[ i ] = createInputPseudo( i );
  21751. }
  21752. for ( i in { submit: true, reset: true } ) {
  21753. Expr.pseudos[ i ] = createButtonPseudo( i );
  21754. }
  21755. // Easy API for creating new setFilters
  21756. function setFilters() {}
  21757. setFilters.prototype = Expr.filters = Expr.pseudos;
  21758. Expr.setFilters = new setFilters();
  21759. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  21760. var matched, match, tokens, type,
  21761. soFar, groups, preFilters,
  21762. cached = tokenCache[ selector + " " ];
  21763. if ( cached ) {
  21764. return parseOnly ? 0 : cached.slice( 0 );
  21765. }
  21766. soFar = selector;
  21767. groups = [];
  21768. preFilters = Expr.preFilter;
  21769. while ( soFar ) {
  21770. // Comma and first run
  21771. if ( !matched || (match = rcomma.exec( soFar )) ) {
  21772. if ( match ) {
  21773. // Don't consume trailing commas as valid
  21774. soFar = soFar.slice( match[0].length ) || soFar;
  21775. }
  21776. groups.push( (tokens = []) );
  21777. }
  21778. matched = false;
  21779. // Combinators
  21780. if ( (match = rcombinators.exec( soFar )) ) {
  21781. matched = match.shift();
  21782. tokens.push({
  21783. value: matched,
  21784. // Cast descendant combinators to space
  21785. type: match[0].replace( rtrim, " " )
  21786. });
  21787. soFar = soFar.slice( matched.length );
  21788. }
  21789. // Filters
  21790. for ( type in Expr.filter ) {
  21791. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  21792. (match = preFilters[ type ]( match ))) ) {
  21793. matched = match.shift();
  21794. tokens.push({
  21795. value: matched,
  21796. type: type,
  21797. matches: match
  21798. });
  21799. soFar = soFar.slice( matched.length );
  21800. }
  21801. }
  21802. if ( !matched ) {
  21803. break;
  21804. }
  21805. }
  21806. // Return the length of the invalid excess
  21807. // if we're just parsing
  21808. // Otherwise, throw an error or return tokens
  21809. return parseOnly ?
  21810. soFar.length :
  21811. soFar ?
  21812. Sizzle.error( selector ) :
  21813. // Cache the tokens
  21814. tokenCache( selector, groups ).slice( 0 );
  21815. };
  21816. function toSelector( tokens ) {
  21817. var i = 0,
  21818. len = tokens.length,
  21819. selector = "";
  21820. for ( ; i < len; i++ ) {
  21821. selector += tokens[i].value;
  21822. }
  21823. return selector;
  21824. }
  21825. function addCombinator( matcher, combinator, base ) {
  21826. var dir = combinator.dir,
  21827. checkNonElements = base && dir === "parentNode",
  21828. doneName = done++;
  21829. return combinator.first ?
  21830. // Check against closest ancestor/preceding element
  21831. function( elem, context, xml ) {
  21832. while ( (elem = elem[ dir ]) ) {
  21833. if ( elem.nodeType === 1 || checkNonElements ) {
  21834. return matcher( elem, context, xml );
  21835. }
  21836. }
  21837. } :
  21838. // Check against all ancestor/preceding elements
  21839. function( elem, context, xml ) {
  21840. var oldCache, uniqueCache, outerCache,
  21841. newCache = [ dirruns, doneName ];
  21842. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  21843. if ( xml ) {
  21844. while ( (elem = elem[ dir ]) ) {
  21845. if ( elem.nodeType === 1 || checkNonElements ) {
  21846. if ( matcher( elem, context, xml ) ) {
  21847. return true;
  21848. }
  21849. }
  21850. }
  21851. } else {
  21852. while ( (elem = elem[ dir ]) ) {
  21853. if ( elem.nodeType === 1 || checkNonElements ) {
  21854. outerCache = elem[ expando ] || (elem[ expando ] = {});
  21855. // Support: IE <9 only
  21856. // Defend against cloned attroperties (jQuery gh-1709)
  21857. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  21858. if ( (oldCache = uniqueCache[ dir ]) &&
  21859. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  21860. // Assign to newCache so results back-propagate to previous elements
  21861. return (newCache[ 2 ] = oldCache[ 2 ]);
  21862. } else {
  21863. // Reuse newcache so results back-propagate to previous elements
  21864. uniqueCache[ dir ] = newCache;
  21865. // A match means we're done; a fail means we have to keep checking
  21866. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  21867. return true;
  21868. }
  21869. }
  21870. }
  21871. }
  21872. }
  21873. };
  21874. }
  21875. function elementMatcher( matchers ) {
  21876. return matchers.length > 1 ?
  21877. function( elem, context, xml ) {
  21878. var i = matchers.length;
  21879. while ( i-- ) {
  21880. if ( !matchers[i]( elem, context, xml ) ) {
  21881. return false;
  21882. }
  21883. }
  21884. return true;
  21885. } :
  21886. matchers[0];
  21887. }
  21888. function multipleContexts( selector, contexts, results ) {
  21889. var i = 0,
  21890. len = contexts.length;
  21891. for ( ; i < len; i++ ) {
  21892. Sizzle( selector, contexts[i], results );
  21893. }
  21894. return results;
  21895. }
  21896. function condense( unmatched, map, filter, context, xml ) {
  21897. var elem,
  21898. newUnmatched = [],
  21899. i = 0,
  21900. len = unmatched.length,
  21901. mapped = map != null;
  21902. for ( ; i < len; i++ ) {
  21903. if ( (elem = unmatched[i]) ) {
  21904. if ( !filter || filter( elem, context, xml ) ) {
  21905. newUnmatched.push( elem );
  21906. if ( mapped ) {
  21907. map.push( i );
  21908. }
  21909. }
  21910. }
  21911. }
  21912. return newUnmatched;
  21913. }
  21914. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  21915. if ( postFilter && !postFilter[ expando ] ) {
  21916. postFilter = setMatcher( postFilter );
  21917. }
  21918. if ( postFinder && !postFinder[ expando ] ) {
  21919. postFinder = setMatcher( postFinder, postSelector );
  21920. }
  21921. return markFunction(function( seed, results, context, xml ) {
  21922. var temp, i, elem,
  21923. preMap = [],
  21924. postMap = [],
  21925. preexisting = results.length,
  21926. // Get initial elements from seed or context
  21927. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  21928. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  21929. matcherIn = preFilter && ( seed || !selector ) ?
  21930. condense( elems, preMap, preFilter, context, xml ) :
  21931. elems,
  21932. matcherOut = matcher ?
  21933. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  21934. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  21935. // ...intermediate processing is necessary
  21936. [] :
  21937. // ...otherwise use results directly
  21938. results :
  21939. matcherIn;
  21940. // Find primary matches
  21941. if ( matcher ) {
  21942. matcher( matcherIn, matcherOut, context, xml );
  21943. }
  21944. // Apply postFilter
  21945. if ( postFilter ) {
  21946. temp = condense( matcherOut, postMap );
  21947. postFilter( temp, [], context, xml );
  21948. // Un-match failing elements by moving them back to matcherIn
  21949. i = temp.length;
  21950. while ( i-- ) {
  21951. if ( (elem = temp[i]) ) {
  21952. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  21953. }
  21954. }
  21955. }
  21956. if ( seed ) {
  21957. if ( postFinder || preFilter ) {
  21958. if ( postFinder ) {
  21959. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  21960. temp = [];
  21961. i = matcherOut.length;
  21962. while ( i-- ) {
  21963. if ( (elem = matcherOut[i]) ) {
  21964. // Restore matcherIn since elem is not yet a final match
  21965. temp.push( (matcherIn[i] = elem) );
  21966. }
  21967. }
  21968. postFinder( null, (matcherOut = []), temp, xml );
  21969. }
  21970. // Move matched elements from seed to results to keep them synchronized
  21971. i = matcherOut.length;
  21972. while ( i-- ) {
  21973. if ( (elem = matcherOut[i]) &&
  21974. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  21975. seed[temp] = !(results[temp] = elem);
  21976. }
  21977. }
  21978. }
  21979. // Add elements to results, through postFinder if defined
  21980. } else {
  21981. matcherOut = condense(
  21982. matcherOut === results ?
  21983. matcherOut.splice( preexisting, matcherOut.length ) :
  21984. matcherOut
  21985. );
  21986. if ( postFinder ) {
  21987. postFinder( null, results, matcherOut, xml );
  21988. } else {
  21989. push.apply( results, matcherOut );
  21990. }
  21991. }
  21992. });
  21993. }
  21994. function matcherFromTokens( tokens ) {
  21995. var checkContext, matcher, j,
  21996. len = tokens.length,
  21997. leadingRelative = Expr.relative[ tokens[0].type ],
  21998. implicitRelative = leadingRelative || Expr.relative[" "],
  21999. i = leadingRelative ? 1 : 0,
  22000. // The foundational matcher ensures that elements are reachable from top-level context(s)
  22001. matchContext = addCombinator( function( elem ) {
  22002. return elem === checkContext;
  22003. }, implicitRelative, true ),
  22004. matchAnyContext = addCombinator( function( elem ) {
  22005. return indexOf( checkContext, elem ) > -1;
  22006. }, implicitRelative, true ),
  22007. matchers = [ function( elem, context, xml ) {
  22008. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  22009. (checkContext = context).nodeType ?
  22010. matchContext( elem, context, xml ) :
  22011. matchAnyContext( elem, context, xml ) );
  22012. // Avoid hanging onto element (issue #299)
  22013. checkContext = null;
  22014. return ret;
  22015. } ];
  22016. for ( ; i < len; i++ ) {
  22017. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  22018. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  22019. } else {
  22020. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  22021. // Return special upon seeing a positional matcher
  22022. if ( matcher[ expando ] ) {
  22023. // Find the next relative operator (if any) for proper handling
  22024. j = ++i;
  22025. for ( ; j < len; j++ ) {
  22026. if ( Expr.relative[ tokens[j].type ] ) {
  22027. break;
  22028. }
  22029. }
  22030. return setMatcher(
  22031. i > 1 && elementMatcher( matchers ),
  22032. i > 1 && toSelector(
  22033. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  22034. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  22035. ).replace( rtrim, "$1" ),
  22036. matcher,
  22037. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  22038. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  22039. j < len && toSelector( tokens )
  22040. );
  22041. }
  22042. matchers.push( matcher );
  22043. }
  22044. }
  22045. return elementMatcher( matchers );
  22046. }
  22047. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  22048. var bySet = setMatchers.length > 0,
  22049. byElement = elementMatchers.length > 0,
  22050. superMatcher = function( seed, context, xml, results, outermost ) {
  22051. var elem, j, matcher,
  22052. matchedCount = 0,
  22053. i = "0",
  22054. unmatched = seed && [],
  22055. setMatched = [],
  22056. contextBackup = outermostContext,
  22057. // We must always have either seed elements or outermost context
  22058. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  22059. // Use integer dirruns iff this is the outermost matcher
  22060. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  22061. len = elems.length;
  22062. if ( outermost ) {
  22063. outermostContext = context === document || context || outermost;
  22064. }
  22065. // Add elements passing elementMatchers directly to results
  22066. // Support: IE<9, Safari
  22067. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  22068. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  22069. if ( byElement && elem ) {
  22070. j = 0;
  22071. if ( !context && elem.ownerDocument !== document ) {
  22072. setDocument( elem );
  22073. xml = !documentIsHTML;
  22074. }
  22075. while ( (matcher = elementMatchers[j++]) ) {
  22076. if ( matcher( elem, context || document, xml) ) {
  22077. results.push( elem );
  22078. break;
  22079. }
  22080. }
  22081. if ( outermost ) {
  22082. dirruns = dirrunsUnique;
  22083. }
  22084. }
  22085. // Track unmatched elements for set filters
  22086. if ( bySet ) {
  22087. // They will have gone through all possible matchers
  22088. if ( (elem = !matcher && elem) ) {
  22089. matchedCount--;
  22090. }
  22091. // Lengthen the array for every element, matched or not
  22092. if ( seed ) {
  22093. unmatched.push( elem );
  22094. }
  22095. }
  22096. }
  22097. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  22098. // makes the latter nonnegative.
  22099. matchedCount += i;
  22100. // Apply set filters to unmatched elements
  22101. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  22102. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  22103. // no element matchers and no seed.
  22104. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  22105. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  22106. // numerically zero.
  22107. if ( bySet && i !== matchedCount ) {
  22108. j = 0;
  22109. while ( (matcher = setMatchers[j++]) ) {
  22110. matcher( unmatched, setMatched, context, xml );
  22111. }
  22112. if ( seed ) {
  22113. // Reintegrate element matches to eliminate the need for sorting
  22114. if ( matchedCount > 0 ) {
  22115. while ( i-- ) {
  22116. if ( !(unmatched[i] || setMatched[i]) ) {
  22117. setMatched[i] = pop.call( results );
  22118. }
  22119. }
  22120. }
  22121. // Discard index placeholder values to get only actual matches
  22122. setMatched = condense( setMatched );
  22123. }
  22124. // Add matches to results
  22125. push.apply( results, setMatched );
  22126. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  22127. if ( outermost && !seed && setMatched.length > 0 &&
  22128. ( matchedCount + setMatchers.length ) > 1 ) {
  22129. Sizzle.uniqueSort( results );
  22130. }
  22131. }
  22132. // Override manipulation of globals by nested matchers
  22133. if ( outermost ) {
  22134. dirruns = dirrunsUnique;
  22135. outermostContext = contextBackup;
  22136. }
  22137. return unmatched;
  22138. };
  22139. return bySet ?
  22140. markFunction( superMatcher ) :
  22141. superMatcher;
  22142. }
  22143. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  22144. var i,
  22145. setMatchers = [],
  22146. elementMatchers = [],
  22147. cached = compilerCache[ selector + " " ];
  22148. if ( !cached ) {
  22149. // Generate a function of recursive functions that can be used to check each element
  22150. if ( !match ) {
  22151. match = tokenize( selector );
  22152. }
  22153. i = match.length;
  22154. while ( i-- ) {
  22155. cached = matcherFromTokens( match[i] );
  22156. if ( cached[ expando ] ) {
  22157. setMatchers.push( cached );
  22158. } else {
  22159. elementMatchers.push( cached );
  22160. }
  22161. }
  22162. // Cache the compiled function
  22163. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  22164. // Save selector and tokenization
  22165. cached.selector = selector;
  22166. }
  22167. return cached;
  22168. };
  22169. /**
  22170. * A low-level selection function that works with Sizzle's compiled
  22171. * selector functions
  22172. * @param {String|Function} selector A selector or a pre-compiled
  22173. * selector function built with Sizzle.compile
  22174. * @param {Element} context
  22175. * @param {Array} [results]
  22176. * @param {Array} [seed] A set of elements to match against
  22177. */
  22178. select = Sizzle.select = function( selector, context, results, seed ) {
  22179. var i, tokens, token, type, find,
  22180. compiled = typeof selector === "function" && selector,
  22181. match = !seed && tokenize( (selector = compiled.selector || selector) );
  22182. results = results || [];
  22183. // Try to minimize operations if there is only one selector in the list and no seed
  22184. // (the latter of which guarantees us context)
  22185. if ( match.length === 1 ) {
  22186. // Reduce context if the leading compound selector is an ID
  22187. tokens = match[0] = match[0].slice( 0 );
  22188. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  22189. support.getById && context.nodeType === 9 && documentIsHTML &&
  22190. Expr.relative[ tokens[1].type ] ) {
  22191. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  22192. if ( !context ) {
  22193. return results;
  22194. // Precompiled matchers will still verify ancestry, so step up a level
  22195. } else if ( compiled ) {
  22196. context = context.parentNode;
  22197. }
  22198. selector = selector.slice( tokens.shift().value.length );
  22199. }
  22200. // Fetch a seed set for right-to-left matching
  22201. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  22202. while ( i-- ) {
  22203. token = tokens[i];
  22204. // Abort if we hit a combinator
  22205. if ( Expr.relative[ (type = token.type) ] ) {
  22206. break;
  22207. }
  22208. if ( (find = Expr.find[ type ]) ) {
  22209. // Search, expanding context for leading sibling combinators
  22210. if ( (seed = find(
  22211. token.matches[0].replace( runescape, funescape ),
  22212. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  22213. )) ) {
  22214. // If seed is empty or no tokens remain, we can return early
  22215. tokens.splice( i, 1 );
  22216. selector = seed.length && toSelector( tokens );
  22217. if ( !selector ) {
  22218. push.apply( results, seed );
  22219. return results;
  22220. }
  22221. break;
  22222. }
  22223. }
  22224. }
  22225. }
  22226. // Compile and execute a filtering function if one is not provided
  22227. // Provide `match` to avoid retokenization if we modified the selector above
  22228. ( compiled || compile( selector, match ) )(
  22229. seed,
  22230. context,
  22231. !documentIsHTML,
  22232. results,
  22233. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  22234. );
  22235. return results;
  22236. };
  22237. // One-time assignments
  22238. // Sort stability
  22239. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  22240. // Support: Chrome 14-35+
  22241. // Always assume duplicates if they aren't passed to the comparison function
  22242. support.detectDuplicates = !!hasDuplicate;
  22243. // Initialize against the default document
  22244. setDocument();
  22245. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  22246. // Detached nodes confoundingly follow *each other*
  22247. support.sortDetached = assert(function( div1 ) {
  22248. // Should return 1, but returns 4 (following)
  22249. return div1.compareDocumentPosition( document.createElement("div") ) & 1;
  22250. });
  22251. // Support: IE<8
  22252. // Prevent attribute/property "interpolation"
  22253. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  22254. if ( !assert(function( div ) {
  22255. div.innerHTML = "<a href='#'></a>";
  22256. return div.firstChild.getAttribute("href") === "#" ;
  22257. }) ) {
  22258. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  22259. if ( !isXML ) {
  22260. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  22261. }
  22262. });
  22263. }
  22264. // Support: IE<9
  22265. // Use defaultValue in place of getAttribute("value")
  22266. if ( !support.attributes || !assert(function( div ) {
  22267. div.innerHTML = "<input/>";
  22268. div.firstChild.setAttribute( "value", "" );
  22269. return div.firstChild.getAttribute( "value" ) === "";
  22270. }) ) {
  22271. addHandle( "value", function( elem, name, isXML ) {
  22272. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  22273. return elem.defaultValue;
  22274. }
  22275. });
  22276. }
  22277. // Support: IE<9
  22278. // Use getAttributeNode to fetch booleans when getAttribute lies
  22279. if ( !assert(function( div ) {
  22280. return div.getAttribute("disabled") == null;
  22281. }) ) {
  22282. addHandle( booleans, function( elem, name, isXML ) {
  22283. var val;
  22284. if ( !isXML ) {
  22285. return elem[ name ] === true ? name.toLowerCase() :
  22286. (val = elem.getAttributeNode( name )) && val.specified ?
  22287. val.value :
  22288. null;
  22289. }
  22290. });
  22291. }
  22292. return Sizzle;
  22293. })( window );
  22294. jQuery.find = Sizzle;
  22295. jQuery.expr = Sizzle.selectors;
  22296. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  22297. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  22298. jQuery.text = Sizzle.getText;
  22299. jQuery.isXMLDoc = Sizzle.isXML;
  22300. jQuery.contains = Sizzle.contains;
  22301. var dir = function( elem, dir, until ) {
  22302. var matched = [],
  22303. truncate = until !== undefined;
  22304. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  22305. if ( elem.nodeType === 1 ) {
  22306. if ( truncate && jQuery( elem ).is( until ) ) {
  22307. break;
  22308. }
  22309. matched.push( elem );
  22310. }
  22311. }
  22312. return matched;
  22313. };
  22314. var siblings = function( n, elem ) {
  22315. var matched = [];
  22316. for ( ; n; n = n.nextSibling ) {
  22317. if ( n.nodeType === 1 && n !== elem ) {
  22318. matched.push( n );
  22319. }
  22320. }
  22321. return matched;
  22322. };
  22323. var rneedsContext = jQuery.expr.match.needsContext;
  22324. var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
  22325. var risSimple = /^.[^:#\[\.,]*$/;
  22326. // Implement the identical functionality for filter and not
  22327. function winnow( elements, qualifier, not ) {
  22328. if ( jQuery.isFunction( qualifier ) ) {
  22329. return jQuery.grep( elements, function( elem, i ) {
  22330. /* jshint -W018 */
  22331. return !!qualifier.call( elem, i, elem ) !== not;
  22332. } );
  22333. }
  22334. if ( qualifier.nodeType ) {
  22335. return jQuery.grep( elements, function( elem ) {
  22336. return ( elem === qualifier ) !== not;
  22337. } );
  22338. }
  22339. if ( typeof qualifier === "string" ) {
  22340. if ( risSimple.test( qualifier ) ) {
  22341. return jQuery.filter( qualifier, elements, not );
  22342. }
  22343. qualifier = jQuery.filter( qualifier, elements );
  22344. }
  22345. return jQuery.grep( elements, function( elem ) {
  22346. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  22347. } );
  22348. }
  22349. jQuery.filter = function( expr, elems, not ) {
  22350. var elem = elems[ 0 ];
  22351. if ( not ) {
  22352. expr = ":not(" + expr + ")";
  22353. }
  22354. return elems.length === 1 && elem.nodeType === 1 ?
  22355. jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
  22356. jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  22357. return elem.nodeType === 1;
  22358. } ) );
  22359. };
  22360. jQuery.fn.extend( {
  22361. find: function( selector ) {
  22362. var i,
  22363. len = this.length,
  22364. ret = [],
  22365. self = this;
  22366. if ( typeof selector !== "string" ) {
  22367. return this.pushStack( jQuery( selector ).filter( function() {
  22368. for ( i = 0; i < len; i++ ) {
  22369. if ( jQuery.contains( self[ i ], this ) ) {
  22370. return true;
  22371. }
  22372. }
  22373. } ) );
  22374. }
  22375. for ( i = 0; i < len; i++ ) {
  22376. jQuery.find( selector, self[ i ], ret );
  22377. }
  22378. // Needed because $( selector, context ) becomes $( context ).find( selector )
  22379. ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
  22380. ret.selector = this.selector ? this.selector + " " + selector : selector;
  22381. return ret;
  22382. },
  22383. filter: function( selector ) {
  22384. return this.pushStack( winnow( this, selector || [], false ) );
  22385. },
  22386. not: function( selector ) {
  22387. return this.pushStack( winnow( this, selector || [], true ) );
  22388. },
  22389. is: function( selector ) {
  22390. return !!winnow(
  22391. this,
  22392. // If this is a positional/relative selector, check membership in the returned set
  22393. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  22394. typeof selector === "string" && rneedsContext.test( selector ) ?
  22395. jQuery( selector ) :
  22396. selector || [],
  22397. false
  22398. ).length;
  22399. }
  22400. } );
  22401. // Initialize a jQuery object
  22402. // A central reference to the root jQuery(document)
  22403. var rootjQuery,
  22404. // A simple way to check for HTML strings
  22405. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  22406. // Strict HTML recognition (#11290: must start with <)
  22407. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
  22408. init = jQuery.fn.init = function( selector, context, root ) {
  22409. var match, elem;
  22410. // HANDLE: $(""), $(null), $(undefined), $(false)
  22411. if ( !selector ) {
  22412. return this;
  22413. }
  22414. // Method init() accepts an alternate rootjQuery
  22415. // so migrate can support jQuery.sub (gh-2101)
  22416. root = root || rootjQuery;
  22417. // Handle HTML strings
  22418. if ( typeof selector === "string" ) {
  22419. if ( selector[ 0 ] === "<" &&
  22420. selector[ selector.length - 1 ] === ">" &&
  22421. selector.length >= 3 ) {
  22422. // Assume that strings that start and end with <> are HTML and skip the regex check
  22423. match = [ null, selector, null ];
  22424. } else {
  22425. match = rquickExpr.exec( selector );
  22426. }
  22427. // Match html or make sure no context is specified for #id
  22428. if ( match && ( match[ 1 ] || !context ) ) {
  22429. // HANDLE: $(html) -> $(array)
  22430. if ( match[ 1 ] ) {
  22431. context = context instanceof jQuery ? context[ 0 ] : context;
  22432. // Option to run scripts is true for back-compat
  22433. // Intentionally let the error be thrown if parseHTML is not present
  22434. jQuery.merge( this, jQuery.parseHTML(
  22435. match[ 1 ],
  22436. context && context.nodeType ? context.ownerDocument || context : document,
  22437. true
  22438. ) );
  22439. // HANDLE: $(html, props)
  22440. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  22441. for ( match in context ) {
  22442. // Properties of context are called as methods if possible
  22443. if ( jQuery.isFunction( this[ match ] ) ) {
  22444. this[ match ]( context[ match ] );
  22445. // ...and otherwise set as attributes
  22446. } else {
  22447. this.attr( match, context[ match ] );
  22448. }
  22449. }
  22450. }
  22451. return this;
  22452. // HANDLE: $(#id)
  22453. } else {
  22454. elem = document.getElementById( match[ 2 ] );
  22455. // Support: Blackberry 4.6
  22456. // gEBID returns nodes no longer in the document (#6963)
  22457. if ( elem && elem.parentNode ) {
  22458. // Inject the element directly into the jQuery object
  22459. this.length = 1;
  22460. this[ 0 ] = elem;
  22461. }
  22462. this.context = document;
  22463. this.selector = selector;
  22464. return this;
  22465. }
  22466. // HANDLE: $(expr, $(...))
  22467. } else if ( !context || context.jquery ) {
  22468. return ( context || root ).find( selector );
  22469. // HANDLE: $(expr, context)
  22470. // (which is just equivalent to: $(context).find(expr)
  22471. } else {
  22472. return this.constructor( context ).find( selector );
  22473. }
  22474. // HANDLE: $(DOMElement)
  22475. } else if ( selector.nodeType ) {
  22476. this.context = this[ 0 ] = selector;
  22477. this.length = 1;
  22478. return this;
  22479. // HANDLE: $(function)
  22480. // Shortcut for document ready
  22481. } else if ( jQuery.isFunction( selector ) ) {
  22482. return root.ready !== undefined ?
  22483. root.ready( selector ) :
  22484. // Execute immediately if ready is not present
  22485. selector( jQuery );
  22486. }
  22487. if ( selector.selector !== undefined ) {
  22488. this.selector = selector.selector;
  22489. this.context = selector.context;
  22490. }
  22491. return jQuery.makeArray( selector, this );
  22492. };
  22493. // Give the init function the jQuery prototype for later instantiation
  22494. init.prototype = jQuery.fn;
  22495. // Initialize central reference
  22496. rootjQuery = jQuery( document );
  22497. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  22498. // Methods guaranteed to produce a unique set when starting from a unique set
  22499. guaranteedUnique = {
  22500. children: true,
  22501. contents: true,
  22502. next: true,
  22503. prev: true
  22504. };
  22505. jQuery.fn.extend( {
  22506. has: function( target ) {
  22507. var targets = jQuery( target, this ),
  22508. l = targets.length;
  22509. return this.filter( function() {
  22510. var i = 0;
  22511. for ( ; i < l; i++ ) {
  22512. if ( jQuery.contains( this, targets[ i ] ) ) {
  22513. return true;
  22514. }
  22515. }
  22516. } );
  22517. },
  22518. closest: function( selectors, context ) {
  22519. var cur,
  22520. i = 0,
  22521. l = this.length,
  22522. matched = [],
  22523. pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
  22524. jQuery( selectors, context || this.context ) :
  22525. 0;
  22526. for ( ; i < l; i++ ) {
  22527. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  22528. // Always skip document fragments
  22529. if ( cur.nodeType < 11 && ( pos ?
  22530. pos.index( cur ) > -1 :
  22531. // Don't pass non-elements to Sizzle
  22532. cur.nodeType === 1 &&
  22533. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  22534. matched.push( cur );
  22535. break;
  22536. }
  22537. }
  22538. }
  22539. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  22540. },
  22541. // Determine the position of an element within the set
  22542. index: function( elem ) {
  22543. // No argument, return index in parent
  22544. if ( !elem ) {
  22545. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  22546. }
  22547. // Index in selector
  22548. if ( typeof elem === "string" ) {
  22549. return indexOf.call( jQuery( elem ), this[ 0 ] );
  22550. }
  22551. // Locate the position of the desired element
  22552. return indexOf.call( this,
  22553. // If it receives a jQuery object, the first element is used
  22554. elem.jquery ? elem[ 0 ] : elem
  22555. );
  22556. },
  22557. add: function( selector, context ) {
  22558. return this.pushStack(
  22559. jQuery.uniqueSort(
  22560. jQuery.merge( this.get(), jQuery( selector, context ) )
  22561. )
  22562. );
  22563. },
  22564. addBack: function( selector ) {
  22565. return this.add( selector == null ?
  22566. this.prevObject : this.prevObject.filter( selector )
  22567. );
  22568. }
  22569. } );
  22570. function sibling( cur, dir ) {
  22571. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  22572. return cur;
  22573. }
  22574. jQuery.each( {
  22575. parent: function( elem ) {
  22576. var parent = elem.parentNode;
  22577. return parent && parent.nodeType !== 11 ? parent : null;
  22578. },
  22579. parents: function( elem ) {
  22580. return dir( elem, "parentNode" );
  22581. },
  22582. parentsUntil: function( elem, i, until ) {
  22583. return dir( elem, "parentNode", until );
  22584. },
  22585. next: function( elem ) {
  22586. return sibling( elem, "nextSibling" );
  22587. },
  22588. prev: function( elem ) {
  22589. return sibling( elem, "previousSibling" );
  22590. },
  22591. nextAll: function( elem ) {
  22592. return dir( elem, "nextSibling" );
  22593. },
  22594. prevAll: function( elem ) {
  22595. return dir( elem, "previousSibling" );
  22596. },
  22597. nextUntil: function( elem, i, until ) {
  22598. return dir( elem, "nextSibling", until );
  22599. },
  22600. prevUntil: function( elem, i, until ) {
  22601. return dir( elem, "previousSibling", until );
  22602. },
  22603. siblings: function( elem ) {
  22604. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  22605. },
  22606. children: function( elem ) {
  22607. return siblings( elem.firstChild );
  22608. },
  22609. contents: function( elem ) {
  22610. return elem.contentDocument || jQuery.merge( [], elem.childNodes );
  22611. }
  22612. }, function( name, fn ) {
  22613. jQuery.fn[ name ] = function( until, selector ) {
  22614. var matched = jQuery.map( this, fn, until );
  22615. if ( name.slice( -5 ) !== "Until" ) {
  22616. selector = until;
  22617. }
  22618. if ( selector && typeof selector === "string" ) {
  22619. matched = jQuery.filter( selector, matched );
  22620. }
  22621. if ( this.length > 1 ) {
  22622. // Remove duplicates
  22623. if ( !guaranteedUnique[ name ] ) {
  22624. jQuery.uniqueSort( matched );
  22625. }
  22626. // Reverse order for parents* and prev-derivatives
  22627. if ( rparentsprev.test( name ) ) {
  22628. matched.reverse();
  22629. }
  22630. }
  22631. return this.pushStack( matched );
  22632. };
  22633. } );
  22634. var rnotwhite = ( /\S+/g );
  22635. // Convert String-formatted options into Object-formatted ones
  22636. function createOptions( options ) {
  22637. var object = {};
  22638. jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
  22639. object[ flag ] = true;
  22640. } );
  22641. return object;
  22642. }
  22643. /*
  22644. * Create a callback list using the following parameters:
  22645. *
  22646. * options: an optional list of space-separated options that will change how
  22647. * the callback list behaves or a more traditional option object
  22648. *
  22649. * By default a callback list will act like an event callback list and can be
  22650. * "fired" multiple times.
  22651. *
  22652. * Possible options:
  22653. *
  22654. * once: will ensure the callback list can only be fired once (like a Deferred)
  22655. *
  22656. * memory: will keep track of previous values and will call any callback added
  22657. * after the list has been fired right away with the latest "memorized"
  22658. * values (like a Deferred)
  22659. *
  22660. * unique: will ensure a callback can only be added once (no duplicate in the list)
  22661. *
  22662. * stopOnFalse: interrupt callings when a callback returns false
  22663. *
  22664. */
  22665. jQuery.Callbacks = function( options ) {
  22666. // Convert options from String-formatted to Object-formatted if needed
  22667. // (we check in cache first)
  22668. options = typeof options === "string" ?
  22669. createOptions( options ) :
  22670. jQuery.extend( {}, options );
  22671. var // Flag to know if list is currently firing
  22672. firing,
  22673. // Last fire value for non-forgettable lists
  22674. memory,
  22675. // Flag to know if list was already fired
  22676. fired,
  22677. // Flag to prevent firing
  22678. locked,
  22679. // Actual callback list
  22680. list = [],
  22681. // Queue of execution data for repeatable lists
  22682. queue = [],
  22683. // Index of currently firing callback (modified by add/remove as needed)
  22684. firingIndex = -1,
  22685. // Fire callbacks
  22686. fire = function() {
  22687. // Enforce single-firing
  22688. locked = options.once;
  22689. // Execute callbacks for all pending executions,
  22690. // respecting firingIndex overrides and runtime changes
  22691. fired = firing = true;
  22692. for ( ; queue.length; firingIndex = -1 ) {
  22693. memory = queue.shift();
  22694. while ( ++firingIndex < list.length ) {
  22695. // Run callback and check for early termination
  22696. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  22697. options.stopOnFalse ) {
  22698. // Jump to end and forget the data so .add doesn't re-fire
  22699. firingIndex = list.length;
  22700. memory = false;
  22701. }
  22702. }
  22703. }
  22704. // Forget the data if we're done with it
  22705. if ( !options.memory ) {
  22706. memory = false;
  22707. }
  22708. firing = false;
  22709. // Clean up if we're done firing for good
  22710. if ( locked ) {
  22711. // Keep an empty list if we have data for future add calls
  22712. if ( memory ) {
  22713. list = [];
  22714. // Otherwise, this object is spent
  22715. } else {
  22716. list = "";
  22717. }
  22718. }
  22719. },
  22720. // Actual Callbacks object
  22721. self = {
  22722. // Add a callback or a collection of callbacks to the list
  22723. add: function() {
  22724. if ( list ) {
  22725. // If we have memory from a past run, we should fire after adding
  22726. if ( memory && !firing ) {
  22727. firingIndex = list.length - 1;
  22728. queue.push( memory );
  22729. }
  22730. ( function add( args ) {
  22731. jQuery.each( args, function( _, arg ) {
  22732. if ( jQuery.isFunction( arg ) ) {
  22733. if ( !options.unique || !self.has( arg ) ) {
  22734. list.push( arg );
  22735. }
  22736. } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
  22737. // Inspect recursively
  22738. add( arg );
  22739. }
  22740. } );
  22741. } )( arguments );
  22742. if ( memory && !firing ) {
  22743. fire();
  22744. }
  22745. }
  22746. return this;
  22747. },
  22748. // Remove a callback from the list
  22749. remove: function() {
  22750. jQuery.each( arguments, function( _, arg ) {
  22751. var index;
  22752. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  22753. list.splice( index, 1 );
  22754. // Handle firing indexes
  22755. if ( index <= firingIndex ) {
  22756. firingIndex--;
  22757. }
  22758. }
  22759. } );
  22760. return this;
  22761. },
  22762. // Check if a given callback is in the list.
  22763. // If no argument is given, return whether or not list has callbacks attached.
  22764. has: function( fn ) {
  22765. return fn ?
  22766. jQuery.inArray( fn, list ) > -1 :
  22767. list.length > 0;
  22768. },
  22769. // Remove all callbacks from the list
  22770. empty: function() {
  22771. if ( list ) {
  22772. list = [];
  22773. }
  22774. return this;
  22775. },
  22776. // Disable .fire and .add
  22777. // Abort any current/pending executions
  22778. // Clear all callbacks and values
  22779. disable: function() {
  22780. locked = queue = [];
  22781. list = memory = "";
  22782. return this;
  22783. },
  22784. disabled: function() {
  22785. return !list;
  22786. },
  22787. // Disable .fire
  22788. // Also disable .add unless we have memory (since it would have no effect)
  22789. // Abort any pending executions
  22790. lock: function() {
  22791. locked = queue = [];
  22792. if ( !memory ) {
  22793. list = memory = "";
  22794. }
  22795. return this;
  22796. },
  22797. locked: function() {
  22798. return !!locked;
  22799. },
  22800. // Call all callbacks with the given context and arguments
  22801. fireWith: function( context, args ) {
  22802. if ( !locked ) {
  22803. args = args || [];
  22804. args = [ context, args.slice ? args.slice() : args ];
  22805. queue.push( args );
  22806. if ( !firing ) {
  22807. fire();
  22808. }
  22809. }
  22810. return this;
  22811. },
  22812. // Call all the callbacks with the given arguments
  22813. fire: function() {
  22814. self.fireWith( this, arguments );
  22815. return this;
  22816. },
  22817. // To know if the callbacks have already been called at least once
  22818. fired: function() {
  22819. return !!fired;
  22820. }
  22821. };
  22822. return self;
  22823. };
  22824. jQuery.extend( {
  22825. Deferred: function( func ) {
  22826. var tuples = [
  22827. // action, add listener, listener list, final state
  22828. [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
  22829. [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
  22830. [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
  22831. ],
  22832. state = "pending",
  22833. promise = {
  22834. state: function() {
  22835. return state;
  22836. },
  22837. always: function() {
  22838. deferred.done( arguments ).fail( arguments );
  22839. return this;
  22840. },
  22841. then: function( /* fnDone, fnFail, fnProgress */ ) {
  22842. var fns = arguments;
  22843. return jQuery.Deferred( function( newDefer ) {
  22844. jQuery.each( tuples, function( i, tuple ) {
  22845. var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
  22846. // deferred[ done | fail | progress ] for forwarding actions to newDefer
  22847. deferred[ tuple[ 1 ] ]( function() {
  22848. var returned = fn && fn.apply( this, arguments );
  22849. if ( returned && jQuery.isFunction( returned.promise ) ) {
  22850. returned.promise()
  22851. .progress( newDefer.notify )
  22852. .done( newDefer.resolve )
  22853. .fail( newDefer.reject );
  22854. } else {
  22855. newDefer[ tuple[ 0 ] + "With" ](
  22856. this === promise ? newDefer.promise() : this,
  22857. fn ? [ returned ] : arguments
  22858. );
  22859. }
  22860. } );
  22861. } );
  22862. fns = null;
  22863. } ).promise();
  22864. },
  22865. // Get a promise for this deferred
  22866. // If obj is provided, the promise aspect is added to the object
  22867. promise: function( obj ) {
  22868. return obj != null ? jQuery.extend( obj, promise ) : promise;
  22869. }
  22870. },
  22871. deferred = {};
  22872. // Keep pipe for back-compat
  22873. promise.pipe = promise.then;
  22874. // Add list-specific methods
  22875. jQuery.each( tuples, function( i, tuple ) {
  22876. var list = tuple[ 2 ],
  22877. stateString = tuple[ 3 ];
  22878. // promise[ done | fail | progress ] = list.add
  22879. promise[ tuple[ 1 ] ] = list.add;
  22880. // Handle state
  22881. if ( stateString ) {
  22882. list.add( function() {
  22883. // state = [ resolved | rejected ]
  22884. state = stateString;
  22885. // [ reject_list | resolve_list ].disable; progress_list.lock
  22886. }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
  22887. }
  22888. // deferred[ resolve | reject | notify ]
  22889. deferred[ tuple[ 0 ] ] = function() {
  22890. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
  22891. return this;
  22892. };
  22893. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  22894. } );
  22895. // Make the deferred a promise
  22896. promise.promise( deferred );
  22897. // Call given func if any
  22898. if ( func ) {
  22899. func.call( deferred, deferred );
  22900. }
  22901. // All done!
  22902. return deferred;
  22903. },
  22904. // Deferred helper
  22905. when: function( subordinate /* , ..., subordinateN */ ) {
  22906. var i = 0,
  22907. resolveValues = slice.call( arguments ),
  22908. length = resolveValues.length,
  22909. // the count of uncompleted subordinates
  22910. remaining = length !== 1 ||
  22911. ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
  22912. // the master Deferred.
  22913. // If resolveValues consist of only a single Deferred, just use that.
  22914. deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
  22915. // Update function for both resolve and progress values
  22916. updateFunc = function( i, contexts, values ) {
  22917. return function( value ) {
  22918. contexts[ i ] = this;
  22919. values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  22920. if ( values === progressValues ) {
  22921. deferred.notifyWith( contexts, values );
  22922. } else if ( !( --remaining ) ) {
  22923. deferred.resolveWith( contexts, values );
  22924. }
  22925. };
  22926. },
  22927. progressValues, progressContexts, resolveContexts;
  22928. // Add listeners to Deferred subordinates; treat others as resolved
  22929. if ( length > 1 ) {
  22930. progressValues = new Array( length );
  22931. progressContexts = new Array( length );
  22932. resolveContexts = new Array( length );
  22933. for ( ; i < length; i++ ) {
  22934. if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
  22935. resolveValues[ i ].promise()
  22936. .progress( updateFunc( i, progressContexts, progressValues ) )
  22937. .done( updateFunc( i, resolveContexts, resolveValues ) )
  22938. .fail( deferred.reject );
  22939. } else {
  22940. --remaining;
  22941. }
  22942. }
  22943. }
  22944. // If we're not waiting on anything, resolve the master
  22945. if ( !remaining ) {
  22946. deferred.resolveWith( resolveContexts, resolveValues );
  22947. }
  22948. return deferred.promise();
  22949. }
  22950. } );
  22951. // The deferred used on DOM ready
  22952. var readyList;
  22953. jQuery.fn.ready = function( fn ) {
  22954. // Add the callback
  22955. jQuery.ready.promise().done( fn );
  22956. return this;
  22957. };
  22958. jQuery.extend( {
  22959. // Is the DOM ready to be used? Set to true once it occurs.
  22960. isReady: false,
  22961. // A counter to track how many items to wait for before
  22962. // the ready event fires. See #6781
  22963. readyWait: 1,
  22964. // Hold (or release) the ready event
  22965. holdReady: function( hold ) {
  22966. if ( hold ) {
  22967. jQuery.readyWait++;
  22968. } else {
  22969. jQuery.ready( true );
  22970. }
  22971. },
  22972. // Handle when the DOM is ready
  22973. ready: function( wait ) {
  22974. // Abort if there are pending holds or we're already ready
  22975. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  22976. return;
  22977. }
  22978. // Remember that the DOM is ready
  22979. jQuery.isReady = true;
  22980. // If a normal DOM Ready event fired, decrement, and wait if need be
  22981. if ( wait !== true && --jQuery.readyWait > 0 ) {
  22982. return;
  22983. }
  22984. // If there are functions bound, to execute
  22985. readyList.resolveWith( document, [ jQuery ] );
  22986. // Trigger any bound ready events
  22987. if ( jQuery.fn.triggerHandler ) {
  22988. jQuery( document ).triggerHandler( "ready" );
  22989. jQuery( document ).off( "ready" );
  22990. }
  22991. }
  22992. } );
  22993. /**
  22994. * The ready event handler and self cleanup method
  22995. */
  22996. function completed() {
  22997. document.removeEventListener( "DOMContentLoaded", completed );
  22998. window.removeEventListener( "load", completed );
  22999. jQuery.ready();
  23000. }
  23001. jQuery.ready.promise = function( obj ) {
  23002. if ( !readyList ) {
  23003. readyList = jQuery.Deferred();
  23004. // Catch cases where $(document).ready() is called
  23005. // after the browser event has already occurred.
  23006. // Support: IE9-10 only
  23007. // Older IE sometimes signals "interactive" too soon
  23008. if ( document.readyState === "complete" ||
  23009. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  23010. // Handle it asynchronously to allow scripts the opportunity to delay ready
  23011. window.setTimeout( jQuery.ready );
  23012. } else {
  23013. // Use the handy event callback
  23014. document.addEventListener( "DOMContentLoaded", completed );
  23015. // A fallback to window.onload, that will always work
  23016. window.addEventListener( "load", completed );
  23017. }
  23018. }
  23019. return readyList.promise( obj );
  23020. };
  23021. // Kick off the DOM ready check even if the user does not
  23022. jQuery.ready.promise();
  23023. // Multifunctional method to get and set values of a collection
  23024. // The value/s can optionally be executed if it's a function
  23025. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  23026. var i = 0,
  23027. len = elems.length,
  23028. bulk = key == null;
  23029. // Sets many values
  23030. if ( jQuery.type( key ) === "object" ) {
  23031. chainable = true;
  23032. for ( i in key ) {
  23033. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  23034. }
  23035. // Sets one value
  23036. } else if ( value !== undefined ) {
  23037. chainable = true;
  23038. if ( !jQuery.isFunction( value ) ) {
  23039. raw = true;
  23040. }
  23041. if ( bulk ) {
  23042. // Bulk operations run against the entire set
  23043. if ( raw ) {
  23044. fn.call( elems, value );
  23045. fn = null;
  23046. // ...except when executing function values
  23047. } else {
  23048. bulk = fn;
  23049. fn = function( elem, key, value ) {
  23050. return bulk.call( jQuery( elem ), value );
  23051. };
  23052. }
  23053. }
  23054. if ( fn ) {
  23055. for ( ; i < len; i++ ) {
  23056. fn(
  23057. elems[ i ], key, raw ?
  23058. value :
  23059. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  23060. );
  23061. }
  23062. }
  23063. }
  23064. return chainable ?
  23065. elems :
  23066. // Gets
  23067. bulk ?
  23068. fn.call( elems ) :
  23069. len ? fn( elems[ 0 ], key ) : emptyGet;
  23070. };
  23071. var acceptData = function( owner ) {
  23072. // Accepts only:
  23073. // - Node
  23074. // - Node.ELEMENT_NODE
  23075. // - Node.DOCUMENT_NODE
  23076. // - Object
  23077. // - Any
  23078. /* jshint -W018 */
  23079. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  23080. };
  23081. function Data() {
  23082. this.expando = jQuery.expando + Data.uid++;
  23083. }
  23084. Data.uid = 1;
  23085. Data.prototype = {
  23086. register: function( owner, initial ) {
  23087. var value = initial || {};
  23088. // If it is a node unlikely to be stringify-ed or looped over
  23089. // use plain assignment
  23090. if ( owner.nodeType ) {
  23091. owner[ this.expando ] = value;
  23092. // Otherwise secure it in a non-enumerable, non-writable property
  23093. // configurability must be true to allow the property to be
  23094. // deleted with the delete operator
  23095. } else {
  23096. Object.defineProperty( owner, this.expando, {
  23097. value: value,
  23098. writable: true,
  23099. configurable: true
  23100. } );
  23101. }
  23102. return owner[ this.expando ];
  23103. },
  23104. cache: function( owner ) {
  23105. // We can accept data for non-element nodes in modern browsers,
  23106. // but we should not, see #8335.
  23107. // Always return an empty object.
  23108. if ( !acceptData( owner ) ) {
  23109. return {};
  23110. }
  23111. // Check if the owner object already has a cache
  23112. var value = owner[ this.expando ];
  23113. // If not, create one
  23114. if ( !value ) {
  23115. value = {};
  23116. // We can accept data for non-element nodes in modern browsers,
  23117. // but we should not, see #8335.
  23118. // Always return an empty object.
  23119. if ( acceptData( owner ) ) {
  23120. // If it is a node unlikely to be stringify-ed or looped over
  23121. // use plain assignment
  23122. if ( owner.nodeType ) {
  23123. owner[ this.expando ] = value;
  23124. // Otherwise secure it in a non-enumerable property
  23125. // configurable must be true to allow the property to be
  23126. // deleted when data is removed
  23127. } else {
  23128. Object.defineProperty( owner, this.expando, {
  23129. value: value,
  23130. configurable: true
  23131. } );
  23132. }
  23133. }
  23134. }
  23135. return value;
  23136. },
  23137. set: function( owner, data, value ) {
  23138. var prop,
  23139. cache = this.cache( owner );
  23140. // Handle: [ owner, key, value ] args
  23141. if ( typeof data === "string" ) {
  23142. cache[ data ] = value;
  23143. // Handle: [ owner, { properties } ] args
  23144. } else {
  23145. // Copy the properties one-by-one to the cache object
  23146. for ( prop in data ) {
  23147. cache[ prop ] = data[ prop ];
  23148. }
  23149. }
  23150. return cache;
  23151. },
  23152. get: function( owner, key ) {
  23153. return key === undefined ?
  23154. this.cache( owner ) :
  23155. owner[ this.expando ] && owner[ this.expando ][ key ];
  23156. },
  23157. access: function( owner, key, value ) {
  23158. var stored;
  23159. // In cases where either:
  23160. //
  23161. // 1. No key was specified
  23162. // 2. A string key was specified, but no value provided
  23163. //
  23164. // Take the "read" path and allow the get method to determine
  23165. // which value to return, respectively either:
  23166. //
  23167. // 1. The entire cache object
  23168. // 2. The data stored at the key
  23169. //
  23170. if ( key === undefined ||
  23171. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  23172. stored = this.get( owner, key );
  23173. return stored !== undefined ?
  23174. stored : this.get( owner, jQuery.camelCase( key ) );
  23175. }
  23176. // When the key is not a string, or both a key and value
  23177. // are specified, set or extend (existing objects) with either:
  23178. //
  23179. // 1. An object of properties
  23180. // 2. A key and value
  23181. //
  23182. this.set( owner, key, value );
  23183. // Since the "set" path can have two possible entry points
  23184. // return the expected data based on which path was taken[*]
  23185. return value !== undefined ? value : key;
  23186. },
  23187. remove: function( owner, key ) {
  23188. var i, name, camel,
  23189. cache = owner[ this.expando ];
  23190. if ( cache === undefined ) {
  23191. return;
  23192. }
  23193. if ( key === undefined ) {
  23194. this.register( owner );
  23195. } else {
  23196. // Support array or space separated string of keys
  23197. if ( jQuery.isArray( key ) ) {
  23198. // If "name" is an array of keys...
  23199. // When data is initially created, via ("key", "val") signature,
  23200. // keys will be converted to camelCase.
  23201. // Since there is no way to tell _how_ a key was added, remove
  23202. // both plain key and camelCase key. #12786
  23203. // This will only penalize the array argument path.
  23204. name = key.concat( key.map( jQuery.camelCase ) );
  23205. } else {
  23206. camel = jQuery.camelCase( key );
  23207. // Try the string as a key before any manipulation
  23208. if ( key in cache ) {
  23209. name = [ key, camel ];
  23210. } else {
  23211. // If a key with the spaces exists, use it.
  23212. // Otherwise, create an array by matching non-whitespace
  23213. name = camel;
  23214. name = name in cache ?
  23215. [ name ] : ( name.match( rnotwhite ) || [] );
  23216. }
  23217. }
  23218. i = name.length;
  23219. while ( i-- ) {
  23220. delete cache[ name[ i ] ];
  23221. }
  23222. }
  23223. // Remove the expando if there's no more data
  23224. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  23225. // Support: Chrome <= 35-45+
  23226. // Webkit & Blink performance suffers when deleting properties
  23227. // from DOM nodes, so set to undefined instead
  23228. // https://code.google.com/p/chromium/issues/detail?id=378607
  23229. if ( owner.nodeType ) {
  23230. owner[ this.expando ] = undefined;
  23231. } else {
  23232. delete owner[ this.expando ];
  23233. }
  23234. }
  23235. },
  23236. hasData: function( owner ) {
  23237. var cache = owner[ this.expando ];
  23238. return cache !== undefined && !jQuery.isEmptyObject( cache );
  23239. }
  23240. };
  23241. var dataPriv = new Data();
  23242. var dataUser = new Data();
  23243. // Implementation Summary
  23244. //
  23245. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  23246. // 2. Improve the module's maintainability by reducing the storage
  23247. // paths to a single mechanism.
  23248. // 3. Use the same single mechanism to support "private" and "user" data.
  23249. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  23250. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  23251. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  23252. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  23253. rmultiDash = /[A-Z]/g;
  23254. function dataAttr( elem, key, data ) {
  23255. var name;
  23256. // If nothing was found internally, try to fetch any
  23257. // data from the HTML5 data-* attribute
  23258. if ( data === undefined && elem.nodeType === 1 ) {
  23259. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  23260. data = elem.getAttribute( name );
  23261. if ( typeof data === "string" ) {
  23262. try {
  23263. data = data === "true" ? true :
  23264. data === "false" ? false :
  23265. data === "null" ? null :
  23266. // Only convert to a number if it doesn't change the string
  23267. +data + "" === data ? +data :
  23268. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  23269. data;
  23270. } catch ( e ) {}
  23271. // Make sure we set the data so it isn't changed later
  23272. dataUser.set( elem, key, data );
  23273. } else {
  23274. data = undefined;
  23275. }
  23276. }
  23277. return data;
  23278. }
  23279. jQuery.extend( {
  23280. hasData: function( elem ) {
  23281. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  23282. },
  23283. data: function( elem, name, data ) {
  23284. return dataUser.access( elem, name, data );
  23285. },
  23286. removeData: function( elem, name ) {
  23287. dataUser.remove( elem, name );
  23288. },
  23289. // TODO: Now that all calls to _data and _removeData have been replaced
  23290. // with direct calls to dataPriv methods, these can be deprecated.
  23291. _data: function( elem, name, data ) {
  23292. return dataPriv.access( elem, name, data );
  23293. },
  23294. _removeData: function( elem, name ) {
  23295. dataPriv.remove( elem, name );
  23296. }
  23297. } );
  23298. jQuery.fn.extend( {
  23299. data: function( key, value ) {
  23300. var i, name, data,
  23301. elem = this[ 0 ],
  23302. attrs = elem && elem.attributes;
  23303. // Gets all values
  23304. if ( key === undefined ) {
  23305. if ( this.length ) {
  23306. data = dataUser.get( elem );
  23307. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  23308. i = attrs.length;
  23309. while ( i-- ) {
  23310. // Support: IE11+
  23311. // The attrs elements can be null (#14894)
  23312. if ( attrs[ i ] ) {
  23313. name = attrs[ i ].name;
  23314. if ( name.indexOf( "data-" ) === 0 ) {
  23315. name = jQuery.camelCase( name.slice( 5 ) );
  23316. dataAttr( elem, name, data[ name ] );
  23317. }
  23318. }
  23319. }
  23320. dataPriv.set( elem, "hasDataAttrs", true );
  23321. }
  23322. }
  23323. return data;
  23324. }
  23325. // Sets multiple values
  23326. if ( typeof key === "object" ) {
  23327. return this.each( function() {
  23328. dataUser.set( this, key );
  23329. } );
  23330. }
  23331. return access( this, function( value ) {
  23332. var data, camelKey;
  23333. // The calling jQuery object (element matches) is not empty
  23334. // (and therefore has an element appears at this[ 0 ]) and the
  23335. // `value` parameter was not undefined. An empty jQuery object
  23336. // will result in `undefined` for elem = this[ 0 ] which will
  23337. // throw an exception if an attempt to read a data cache is made.
  23338. if ( elem && value === undefined ) {
  23339. // Attempt to get data from the cache
  23340. // with the key as-is
  23341. data = dataUser.get( elem, key ) ||
  23342. // Try to find dashed key if it exists (gh-2779)
  23343. // This is for 2.2.x only
  23344. dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() );
  23345. if ( data !== undefined ) {
  23346. return data;
  23347. }
  23348. camelKey = jQuery.camelCase( key );
  23349. // Attempt to get data from the cache
  23350. // with the key camelized
  23351. data = dataUser.get( elem, camelKey );
  23352. if ( data !== undefined ) {
  23353. return data;
  23354. }
  23355. // Attempt to "discover" the data in
  23356. // HTML5 custom data-* attrs
  23357. data = dataAttr( elem, camelKey, undefined );
  23358. if ( data !== undefined ) {
  23359. return data;
  23360. }
  23361. // We tried really hard, but the data doesn't exist.
  23362. return;
  23363. }
  23364. // Set the data...
  23365. camelKey = jQuery.camelCase( key );
  23366. this.each( function() {
  23367. // First, attempt to store a copy or reference of any
  23368. // data that might've been store with a camelCased key.
  23369. var data = dataUser.get( this, camelKey );
  23370. // For HTML5 data-* attribute interop, we have to
  23371. // store property names with dashes in a camelCase form.
  23372. // This might not apply to all properties...*
  23373. dataUser.set( this, camelKey, value );
  23374. // *... In the case of properties that might _actually_
  23375. // have dashes, we need to also store a copy of that
  23376. // unchanged property.
  23377. if ( key.indexOf( "-" ) > -1 && data !== undefined ) {
  23378. dataUser.set( this, key, value );
  23379. }
  23380. } );
  23381. }, null, value, arguments.length > 1, null, true );
  23382. },
  23383. removeData: function( key ) {
  23384. return this.each( function() {
  23385. dataUser.remove( this, key );
  23386. } );
  23387. }
  23388. } );
  23389. jQuery.extend( {
  23390. queue: function( elem, type, data ) {
  23391. var queue;
  23392. if ( elem ) {
  23393. type = ( type || "fx" ) + "queue";
  23394. queue = dataPriv.get( elem, type );
  23395. // Speed up dequeue by getting out quickly if this is just a lookup
  23396. if ( data ) {
  23397. if ( !queue || jQuery.isArray( data ) ) {
  23398. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  23399. } else {
  23400. queue.push( data );
  23401. }
  23402. }
  23403. return queue || [];
  23404. }
  23405. },
  23406. dequeue: function( elem, type ) {
  23407. type = type || "fx";
  23408. var queue = jQuery.queue( elem, type ),
  23409. startLength = queue.length,
  23410. fn = queue.shift(),
  23411. hooks = jQuery._queueHooks( elem, type ),
  23412. next = function() {
  23413. jQuery.dequeue( elem, type );
  23414. };
  23415. // If the fx queue is dequeued, always remove the progress sentinel
  23416. if ( fn === "inprogress" ) {
  23417. fn = queue.shift();
  23418. startLength--;
  23419. }
  23420. if ( fn ) {
  23421. // Add a progress sentinel to prevent the fx queue from being
  23422. // automatically dequeued
  23423. if ( type === "fx" ) {
  23424. queue.unshift( "inprogress" );
  23425. }
  23426. // Clear up the last queue stop function
  23427. delete hooks.stop;
  23428. fn.call( elem, next, hooks );
  23429. }
  23430. if ( !startLength && hooks ) {
  23431. hooks.empty.fire();
  23432. }
  23433. },
  23434. // Not public - generate a queueHooks object, or return the current one
  23435. _queueHooks: function( elem, type ) {
  23436. var key = type + "queueHooks";
  23437. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  23438. empty: jQuery.Callbacks( "once memory" ).add( function() {
  23439. dataPriv.remove( elem, [ type + "queue", key ] );
  23440. } )
  23441. } );
  23442. }
  23443. } );
  23444. jQuery.fn.extend( {
  23445. queue: function( type, data ) {
  23446. var setter = 2;
  23447. if ( typeof type !== "string" ) {
  23448. data = type;
  23449. type = "fx";
  23450. setter--;
  23451. }
  23452. if ( arguments.length < setter ) {
  23453. return jQuery.queue( this[ 0 ], type );
  23454. }
  23455. return data === undefined ?
  23456. this :
  23457. this.each( function() {
  23458. var queue = jQuery.queue( this, type, data );
  23459. // Ensure a hooks for this queue
  23460. jQuery._queueHooks( this, type );
  23461. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  23462. jQuery.dequeue( this, type );
  23463. }
  23464. } );
  23465. },
  23466. dequeue: function( type ) {
  23467. return this.each( function() {
  23468. jQuery.dequeue( this, type );
  23469. } );
  23470. },
  23471. clearQueue: function( type ) {
  23472. return this.queue( type || "fx", [] );
  23473. },
  23474. // Get a promise resolved when queues of a certain type
  23475. // are emptied (fx is the type by default)
  23476. promise: function( type, obj ) {
  23477. var tmp,
  23478. count = 1,
  23479. defer = jQuery.Deferred(),
  23480. elements = this,
  23481. i = this.length,
  23482. resolve = function() {
  23483. if ( !( --count ) ) {
  23484. defer.resolveWith( elements, [ elements ] );
  23485. }
  23486. };
  23487. if ( typeof type !== "string" ) {
  23488. obj = type;
  23489. type = undefined;
  23490. }
  23491. type = type || "fx";
  23492. while ( i-- ) {
  23493. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  23494. if ( tmp && tmp.empty ) {
  23495. count++;
  23496. tmp.empty.add( resolve );
  23497. }
  23498. }
  23499. resolve();
  23500. return defer.promise( obj );
  23501. }
  23502. } );
  23503. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  23504. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  23505. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  23506. var isHidden = function( elem, el ) {
  23507. // isHidden might be called from jQuery#filter function;
  23508. // in that case, element will be second argument
  23509. elem = el || elem;
  23510. return jQuery.css( elem, "display" ) === "none" ||
  23511. !jQuery.contains( elem.ownerDocument, elem );
  23512. };
  23513. function adjustCSS( elem, prop, valueParts, tween ) {
  23514. var adjusted,
  23515. scale = 1,
  23516. maxIterations = 20,
  23517. currentValue = tween ?
  23518. function() { return tween.cur(); } :
  23519. function() { return jQuery.css( elem, prop, "" ); },
  23520. initial = currentValue(),
  23521. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  23522. // Starting value computation is required for potential unit mismatches
  23523. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  23524. rcssNum.exec( jQuery.css( elem, prop ) );
  23525. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  23526. // Trust units reported by jQuery.css
  23527. unit = unit || initialInUnit[ 3 ];
  23528. // Make sure we update the tween properties later on
  23529. valueParts = valueParts || [];
  23530. // Iteratively approximate from a nonzero starting point
  23531. initialInUnit = +initial || 1;
  23532. do {
  23533. // If previous iteration zeroed out, double until we get *something*.
  23534. // Use string for doubling so we don't accidentally see scale as unchanged below
  23535. scale = scale || ".5";
  23536. // Adjust and apply
  23537. initialInUnit = initialInUnit / scale;
  23538. jQuery.style( elem, prop, initialInUnit + unit );
  23539. // Update scale, tolerating zero or NaN from tween.cur()
  23540. // Break the loop if scale is unchanged or perfect, or if we've just had enough.
  23541. } while (
  23542. scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
  23543. );
  23544. }
  23545. if ( valueParts ) {
  23546. initialInUnit = +initialInUnit || +initial || 0;
  23547. // Apply relative offset (+=/-=) if specified
  23548. adjusted = valueParts[ 1 ] ?
  23549. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  23550. +valueParts[ 2 ];
  23551. if ( tween ) {
  23552. tween.unit = unit;
  23553. tween.start = initialInUnit;
  23554. tween.end = adjusted;
  23555. }
  23556. }
  23557. return adjusted;
  23558. }
  23559. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  23560. var rtagName = ( /<([\w:-]+)/ );
  23561. var rscriptType = ( /^$|\/(?:java|ecma)script/i );
  23562. // We have to close these tags to support XHTML (#13200)
  23563. var wrapMap = {
  23564. // Support: IE9
  23565. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  23566. // XHTML parsers do not magically insert elements in the
  23567. // same way that tag soup parsers do. So we cannot shorten
  23568. // this by omitting <tbody> or other required elements.
  23569. thead: [ 1, "<table>", "</table>" ],
  23570. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  23571. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  23572. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  23573. _default: [ 0, "", "" ]
  23574. };
  23575. // Support: IE9
  23576. wrapMap.optgroup = wrapMap.option;
  23577. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  23578. wrapMap.th = wrapMap.td;
  23579. function getAll( context, tag ) {
  23580. // Support: IE9-11+
  23581. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  23582. var ret = typeof context.getElementsByTagName !== "undefined" ?
  23583. context.getElementsByTagName( tag || "*" ) :
  23584. typeof context.querySelectorAll !== "undefined" ?
  23585. context.querySelectorAll( tag || "*" ) :
  23586. [];
  23587. return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
  23588. jQuery.merge( [ context ], ret ) :
  23589. ret;
  23590. }
  23591. // Mark scripts as having already been evaluated
  23592. function setGlobalEval( elems, refElements ) {
  23593. var i = 0,
  23594. l = elems.length;
  23595. for ( ; i < l; i++ ) {
  23596. dataPriv.set(
  23597. elems[ i ],
  23598. "globalEval",
  23599. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  23600. );
  23601. }
  23602. }
  23603. var rhtml = /<|&#?\w+;/;
  23604. function buildFragment( elems, context, scripts, selection, ignored ) {
  23605. var elem, tmp, tag, wrap, contains, j,
  23606. fragment = context.createDocumentFragment(),
  23607. nodes = [],
  23608. i = 0,
  23609. l = elems.length;
  23610. for ( ; i < l; i++ ) {
  23611. elem = elems[ i ];
  23612. if ( elem || elem === 0 ) {
  23613. // Add nodes directly
  23614. if ( jQuery.type( elem ) === "object" ) {
  23615. // Support: Android<4.1, PhantomJS<2
  23616. // push.apply(_, arraylike) throws on ancient WebKit
  23617. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  23618. // Convert non-html into a text node
  23619. } else if ( !rhtml.test( elem ) ) {
  23620. nodes.push( context.createTextNode( elem ) );
  23621. // Convert html into DOM nodes
  23622. } else {
  23623. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  23624. // Deserialize a standard representation
  23625. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  23626. wrap = wrapMap[ tag ] || wrapMap._default;
  23627. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  23628. // Descend through wrappers to the right content
  23629. j = wrap[ 0 ];
  23630. while ( j-- ) {
  23631. tmp = tmp.lastChild;
  23632. }
  23633. // Support: Android<4.1, PhantomJS<2
  23634. // push.apply(_, arraylike) throws on ancient WebKit
  23635. jQuery.merge( nodes, tmp.childNodes );
  23636. // Remember the top-level container
  23637. tmp = fragment.firstChild;
  23638. // Ensure the created nodes are orphaned (#12392)
  23639. tmp.textContent = "";
  23640. }
  23641. }
  23642. }
  23643. // Remove wrapper from fragment
  23644. fragment.textContent = "";
  23645. i = 0;
  23646. while ( ( elem = nodes[ i++ ] ) ) {
  23647. // Skip elements already in the context collection (trac-4087)
  23648. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  23649. if ( ignored ) {
  23650. ignored.push( elem );
  23651. }
  23652. continue;
  23653. }
  23654. contains = jQuery.contains( elem.ownerDocument, elem );
  23655. // Append to fragment
  23656. tmp = getAll( fragment.appendChild( elem ), "script" );
  23657. // Preserve script evaluation history
  23658. if ( contains ) {
  23659. setGlobalEval( tmp );
  23660. }
  23661. // Capture executables
  23662. if ( scripts ) {
  23663. j = 0;
  23664. while ( ( elem = tmp[ j++ ] ) ) {
  23665. if ( rscriptType.test( elem.type || "" ) ) {
  23666. scripts.push( elem );
  23667. }
  23668. }
  23669. }
  23670. }
  23671. return fragment;
  23672. }
  23673. ( function() {
  23674. var fragment = document.createDocumentFragment(),
  23675. div = fragment.appendChild( document.createElement( "div" ) ),
  23676. input = document.createElement( "input" );
  23677. // Support: Android 4.0-4.3, Safari<=5.1
  23678. // Check state lost if the name is set (#11217)
  23679. // Support: Windows Web Apps (WWA)
  23680. // `name` and `type` must use .setAttribute for WWA (#14901)
  23681. input.setAttribute( "type", "radio" );
  23682. input.setAttribute( "checked", "checked" );
  23683. input.setAttribute( "name", "t" );
  23684. div.appendChild( input );
  23685. // Support: Safari<=5.1, Android<4.2
  23686. // Older WebKit doesn't clone checked state correctly in fragments
  23687. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  23688. // Support: IE<=11+
  23689. // Make sure textarea (and checkbox) defaultValue is properly cloned
  23690. div.innerHTML = "<textarea>x</textarea>";
  23691. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  23692. } )();
  23693. var
  23694. rkeyEvent = /^key/,
  23695. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  23696. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  23697. function returnTrue() {
  23698. return true;
  23699. }
  23700. function returnFalse() {
  23701. return false;
  23702. }
  23703. // Support: IE9
  23704. // See #13393 for more info
  23705. function safeActiveElement() {
  23706. try {
  23707. return document.activeElement;
  23708. } catch ( err ) { }
  23709. }
  23710. function on( elem, types, selector, data, fn, one ) {
  23711. var origFn, type;
  23712. // Types can be a map of types/handlers
  23713. if ( typeof types === "object" ) {
  23714. // ( types-Object, selector, data )
  23715. if ( typeof selector !== "string" ) {
  23716. // ( types-Object, data )
  23717. data = data || selector;
  23718. selector = undefined;
  23719. }
  23720. for ( type in types ) {
  23721. on( elem, type, selector, data, types[ type ], one );
  23722. }
  23723. return elem;
  23724. }
  23725. if ( data == null && fn == null ) {
  23726. // ( types, fn )
  23727. fn = selector;
  23728. data = selector = undefined;
  23729. } else if ( fn == null ) {
  23730. if ( typeof selector === "string" ) {
  23731. // ( types, selector, fn )
  23732. fn = data;
  23733. data = undefined;
  23734. } else {
  23735. // ( types, data, fn )
  23736. fn = data;
  23737. data = selector;
  23738. selector = undefined;
  23739. }
  23740. }
  23741. if ( fn === false ) {
  23742. fn = returnFalse;
  23743. } else if ( !fn ) {
  23744. return elem;
  23745. }
  23746. if ( one === 1 ) {
  23747. origFn = fn;
  23748. fn = function( event ) {
  23749. // Can use an empty set, since event contains the info
  23750. jQuery().off( event );
  23751. return origFn.apply( this, arguments );
  23752. };
  23753. // Use same guid so caller can remove using origFn
  23754. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  23755. }
  23756. return elem.each( function() {
  23757. jQuery.event.add( this, types, fn, data, selector );
  23758. } );
  23759. }
  23760. /*
  23761. * Helper functions for managing events -- not part of the public interface.
  23762. * Props to Dean Edwards' addEvent library for many of the ideas.
  23763. */
  23764. jQuery.event = {
  23765. global: {},
  23766. add: function( elem, types, handler, data, selector ) {
  23767. var handleObjIn, eventHandle, tmp,
  23768. events, t, handleObj,
  23769. special, handlers, type, namespaces, origType,
  23770. elemData = dataPriv.get( elem );
  23771. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  23772. if ( !elemData ) {
  23773. return;
  23774. }
  23775. // Caller can pass in an object of custom data in lieu of the handler
  23776. if ( handler.handler ) {
  23777. handleObjIn = handler;
  23778. handler = handleObjIn.handler;
  23779. selector = handleObjIn.selector;
  23780. }
  23781. // Make sure that the handler has a unique ID, used to find/remove it later
  23782. if ( !handler.guid ) {
  23783. handler.guid = jQuery.guid++;
  23784. }
  23785. // Init the element's event structure and main handler, if this is the first
  23786. if ( !( events = elemData.events ) ) {
  23787. events = elemData.events = {};
  23788. }
  23789. if ( !( eventHandle = elemData.handle ) ) {
  23790. eventHandle = elemData.handle = function( e ) {
  23791. // Discard the second event of a jQuery.event.trigger() and
  23792. // when an event is called after a page has unloaded
  23793. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  23794. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  23795. };
  23796. }
  23797. // Handle multiple events separated by a space
  23798. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  23799. t = types.length;
  23800. while ( t-- ) {
  23801. tmp = rtypenamespace.exec( types[ t ] ) || [];
  23802. type = origType = tmp[ 1 ];
  23803. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  23804. // There *must* be a type, no attaching namespace-only handlers
  23805. if ( !type ) {
  23806. continue;
  23807. }
  23808. // If event changes its type, use the special event handlers for the changed type
  23809. special = jQuery.event.special[ type ] || {};
  23810. // If selector defined, determine special event api type, otherwise given type
  23811. type = ( selector ? special.delegateType : special.bindType ) || type;
  23812. // Update special based on newly reset type
  23813. special = jQuery.event.special[ type ] || {};
  23814. // handleObj is passed to all event handlers
  23815. handleObj = jQuery.extend( {
  23816. type: type,
  23817. origType: origType,
  23818. data: data,
  23819. handler: handler,
  23820. guid: handler.guid,
  23821. selector: selector,
  23822. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  23823. namespace: namespaces.join( "." )
  23824. }, handleObjIn );
  23825. // Init the event handler queue if we're the first
  23826. if ( !( handlers = events[ type ] ) ) {
  23827. handlers = events[ type ] = [];
  23828. handlers.delegateCount = 0;
  23829. // Only use addEventListener if the special events handler returns false
  23830. if ( !special.setup ||
  23831. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  23832. if ( elem.addEventListener ) {
  23833. elem.addEventListener( type, eventHandle );
  23834. }
  23835. }
  23836. }
  23837. if ( special.add ) {
  23838. special.add.call( elem, handleObj );
  23839. if ( !handleObj.handler.guid ) {
  23840. handleObj.handler.guid = handler.guid;
  23841. }
  23842. }
  23843. // Add to the element's handler list, delegates in front
  23844. if ( selector ) {
  23845. handlers.splice( handlers.delegateCount++, 0, handleObj );
  23846. } else {
  23847. handlers.push( handleObj );
  23848. }
  23849. // Keep track of which events have ever been used, for event optimization
  23850. jQuery.event.global[ type ] = true;
  23851. }
  23852. },
  23853. // Detach an event or set of events from an element
  23854. remove: function( elem, types, handler, selector, mappedTypes ) {
  23855. var j, origCount, tmp,
  23856. events, t, handleObj,
  23857. special, handlers, type, namespaces, origType,
  23858. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  23859. if ( !elemData || !( events = elemData.events ) ) {
  23860. return;
  23861. }
  23862. // Once for each type.namespace in types; type may be omitted
  23863. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  23864. t = types.length;
  23865. while ( t-- ) {
  23866. tmp = rtypenamespace.exec( types[ t ] ) || [];
  23867. type = origType = tmp[ 1 ];
  23868. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  23869. // Unbind all events (on this namespace, if provided) for the element
  23870. if ( !type ) {
  23871. for ( type in events ) {
  23872. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  23873. }
  23874. continue;
  23875. }
  23876. special = jQuery.event.special[ type ] || {};
  23877. type = ( selector ? special.delegateType : special.bindType ) || type;
  23878. handlers = events[ type ] || [];
  23879. tmp = tmp[ 2 ] &&
  23880. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  23881. // Remove matching events
  23882. origCount = j = handlers.length;
  23883. while ( j-- ) {
  23884. handleObj = handlers[ j ];
  23885. if ( ( mappedTypes || origType === handleObj.origType ) &&
  23886. ( !handler || handler.guid === handleObj.guid ) &&
  23887. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  23888. ( !selector || selector === handleObj.selector ||
  23889. selector === "**" && handleObj.selector ) ) {
  23890. handlers.splice( j, 1 );
  23891. if ( handleObj.selector ) {
  23892. handlers.delegateCount--;
  23893. }
  23894. if ( special.remove ) {
  23895. special.remove.call( elem, handleObj );
  23896. }
  23897. }
  23898. }
  23899. // Remove generic event handler if we removed something and no more handlers exist
  23900. // (avoids potential for endless recursion during removal of special event handlers)
  23901. if ( origCount && !handlers.length ) {
  23902. if ( !special.teardown ||
  23903. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  23904. jQuery.removeEvent( elem, type, elemData.handle );
  23905. }
  23906. delete events[ type ];
  23907. }
  23908. }
  23909. // Remove data and the expando if it's no longer used
  23910. if ( jQuery.isEmptyObject( events ) ) {
  23911. dataPriv.remove( elem, "handle events" );
  23912. }
  23913. },
  23914. dispatch: function( event ) {
  23915. // Make a writable jQuery.Event from the native event object
  23916. event = jQuery.event.fix( event );
  23917. var i, j, ret, matched, handleObj,
  23918. handlerQueue = [],
  23919. args = slice.call( arguments ),
  23920. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  23921. special = jQuery.event.special[ event.type ] || {};
  23922. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  23923. args[ 0 ] = event;
  23924. event.delegateTarget = this;
  23925. // Call the preDispatch hook for the mapped type, and let it bail if desired
  23926. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  23927. return;
  23928. }
  23929. // Determine handlers
  23930. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  23931. // Run delegates first; they may want to stop propagation beneath us
  23932. i = 0;
  23933. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  23934. event.currentTarget = matched.elem;
  23935. j = 0;
  23936. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  23937. !event.isImmediatePropagationStopped() ) {
  23938. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  23939. // a subset or equal to those in the bound event (both can have no namespace).
  23940. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  23941. event.handleObj = handleObj;
  23942. event.data = handleObj.data;
  23943. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  23944. handleObj.handler ).apply( matched.elem, args );
  23945. if ( ret !== undefined ) {
  23946. if ( ( event.result = ret ) === false ) {
  23947. event.preventDefault();
  23948. event.stopPropagation();
  23949. }
  23950. }
  23951. }
  23952. }
  23953. }
  23954. // Call the postDispatch hook for the mapped type
  23955. if ( special.postDispatch ) {
  23956. special.postDispatch.call( this, event );
  23957. }
  23958. return event.result;
  23959. },
  23960. handlers: function( event, handlers ) {
  23961. var i, matches, sel, handleObj,
  23962. handlerQueue = [],
  23963. delegateCount = handlers.delegateCount,
  23964. cur = event.target;
  23965. // Support (at least): Chrome, IE9
  23966. // Find delegate handlers
  23967. // Black-hole SVG <use> instance trees (#13180)
  23968. //
  23969. // Support: Firefox<=42+
  23970. // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
  23971. if ( delegateCount && cur.nodeType &&
  23972. ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
  23973. for ( ; cur !== this; cur = cur.parentNode || this ) {
  23974. // Don't check non-elements (#13208)
  23975. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  23976. if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
  23977. matches = [];
  23978. for ( i = 0; i < delegateCount; i++ ) {
  23979. handleObj = handlers[ i ];
  23980. // Don't conflict with Object.prototype properties (#13203)
  23981. sel = handleObj.selector + " ";
  23982. if ( matches[ sel ] === undefined ) {
  23983. matches[ sel ] = handleObj.needsContext ?
  23984. jQuery( sel, this ).index( cur ) > -1 :
  23985. jQuery.find( sel, this, null, [ cur ] ).length;
  23986. }
  23987. if ( matches[ sel ] ) {
  23988. matches.push( handleObj );
  23989. }
  23990. }
  23991. if ( matches.length ) {
  23992. handlerQueue.push( { elem: cur, handlers: matches } );
  23993. }
  23994. }
  23995. }
  23996. }
  23997. // Add the remaining (directly-bound) handlers
  23998. if ( delegateCount < handlers.length ) {
  23999. handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
  24000. }
  24001. return handlerQueue;
  24002. },
  24003. // Includes some event props shared by KeyEvent and MouseEvent
  24004. props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
  24005. "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
  24006. fixHooks: {},
  24007. keyHooks: {
  24008. props: "char charCode key keyCode".split( " " ),
  24009. filter: function( event, original ) {
  24010. // Add which for key events
  24011. if ( event.which == null ) {
  24012. event.which = original.charCode != null ? original.charCode : original.keyCode;
  24013. }
  24014. return event;
  24015. }
  24016. },
  24017. mouseHooks: {
  24018. props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " +
  24019. "screenX screenY toElement" ).split( " " ),
  24020. filter: function( event, original ) {
  24021. var eventDoc, doc, body,
  24022. button = original.button;
  24023. // Calculate pageX/Y if missing and clientX/Y available
  24024. if ( event.pageX == null && original.clientX != null ) {
  24025. eventDoc = event.target.ownerDocument || document;
  24026. doc = eventDoc.documentElement;
  24027. body = eventDoc.body;
  24028. event.pageX = original.clientX +
  24029. ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
  24030. ( doc && doc.clientLeft || body && body.clientLeft || 0 );
  24031. event.pageY = original.clientY +
  24032. ( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
  24033. ( doc && doc.clientTop || body && body.clientTop || 0 );
  24034. }
  24035. // Add which for click: 1 === left; 2 === middle; 3 === right
  24036. // Note: button is not normalized, so don't use it
  24037. if ( !event.which && button !== undefined ) {
  24038. event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
  24039. }
  24040. return event;
  24041. }
  24042. },
  24043. fix: function( event ) {
  24044. if ( event[ jQuery.expando ] ) {
  24045. return event;
  24046. }
  24047. // Create a writable copy of the event object and normalize some properties
  24048. var i, prop, copy,
  24049. type = event.type,
  24050. originalEvent = event,
  24051. fixHook = this.fixHooks[ type ];
  24052. if ( !fixHook ) {
  24053. this.fixHooks[ type ] = fixHook =
  24054. rmouseEvent.test( type ) ? this.mouseHooks :
  24055. rkeyEvent.test( type ) ? this.keyHooks :
  24056. {};
  24057. }
  24058. copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
  24059. event = new jQuery.Event( originalEvent );
  24060. i = copy.length;
  24061. while ( i-- ) {
  24062. prop = copy[ i ];
  24063. event[ prop ] = originalEvent[ prop ];
  24064. }
  24065. // Support: Cordova 2.5 (WebKit) (#13255)
  24066. // All events should have a target; Cordova deviceready doesn't
  24067. if ( !event.target ) {
  24068. event.target = document;
  24069. }
  24070. // Support: Safari 6.0+, Chrome<28
  24071. // Target should not be a text node (#504, #13143)
  24072. if ( event.target.nodeType === 3 ) {
  24073. event.target = event.target.parentNode;
  24074. }
  24075. return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
  24076. },
  24077. special: {
  24078. load: {
  24079. // Prevent triggered image.load events from bubbling to window.load
  24080. noBubble: true
  24081. },
  24082. focus: {
  24083. // Fire native event if possible so blur/focus sequence is correct
  24084. trigger: function() {
  24085. if ( this !== safeActiveElement() && this.focus ) {
  24086. this.focus();
  24087. return false;
  24088. }
  24089. },
  24090. delegateType: "focusin"
  24091. },
  24092. blur: {
  24093. trigger: function() {
  24094. if ( this === safeActiveElement() && this.blur ) {
  24095. this.blur();
  24096. return false;
  24097. }
  24098. },
  24099. delegateType: "focusout"
  24100. },
  24101. click: {
  24102. // For checkbox, fire native event so checked state will be right
  24103. trigger: function() {
  24104. if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
  24105. this.click();
  24106. return false;
  24107. }
  24108. },
  24109. // For cross-browser consistency, don't fire native .click() on links
  24110. _default: function( event ) {
  24111. return jQuery.nodeName( event.target, "a" );
  24112. }
  24113. },
  24114. beforeunload: {
  24115. postDispatch: function( event ) {
  24116. // Support: Firefox 20+
  24117. // Firefox doesn't alert if the returnValue field is not set.
  24118. if ( event.result !== undefined && event.originalEvent ) {
  24119. event.originalEvent.returnValue = event.result;
  24120. }
  24121. }
  24122. }
  24123. }
  24124. };
  24125. jQuery.removeEvent = function( elem, type, handle ) {
  24126. // This "if" is needed for plain objects
  24127. if ( elem.removeEventListener ) {
  24128. elem.removeEventListener( type, handle );
  24129. }
  24130. };
  24131. jQuery.Event = function( src, props ) {
  24132. // Allow instantiation without the 'new' keyword
  24133. if ( !( this instanceof jQuery.Event ) ) {
  24134. return new jQuery.Event( src, props );
  24135. }
  24136. // Event object
  24137. if ( src && src.type ) {
  24138. this.originalEvent = src;
  24139. this.type = src.type;
  24140. // Events bubbling up the document may have been marked as prevented
  24141. // by a handler lower down the tree; reflect the correct value.
  24142. this.isDefaultPrevented = src.defaultPrevented ||
  24143. src.defaultPrevented === undefined &&
  24144. // Support: Android<4.0
  24145. src.returnValue === false ?
  24146. returnTrue :
  24147. returnFalse;
  24148. // Event type
  24149. } else {
  24150. this.type = src;
  24151. }
  24152. // Put explicitly provided properties onto the event object
  24153. if ( props ) {
  24154. jQuery.extend( this, props );
  24155. }
  24156. // Create a timestamp if incoming event doesn't have one
  24157. this.timeStamp = src && src.timeStamp || jQuery.now();
  24158. // Mark it as fixed
  24159. this[ jQuery.expando ] = true;
  24160. };
  24161. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  24162. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  24163. jQuery.Event.prototype = {
  24164. constructor: jQuery.Event,
  24165. isDefaultPrevented: returnFalse,
  24166. isPropagationStopped: returnFalse,
  24167. isImmediatePropagationStopped: returnFalse,
  24168. isSimulated: false,
  24169. preventDefault: function() {
  24170. var e = this.originalEvent;
  24171. this.isDefaultPrevented = returnTrue;
  24172. if ( e && !this.isSimulated ) {
  24173. e.preventDefault();
  24174. }
  24175. },
  24176. stopPropagation: function() {
  24177. var e = this.originalEvent;
  24178. this.isPropagationStopped = returnTrue;
  24179. if ( e && !this.isSimulated ) {
  24180. e.stopPropagation();
  24181. }
  24182. },
  24183. stopImmediatePropagation: function() {
  24184. var e = this.originalEvent;
  24185. this.isImmediatePropagationStopped = returnTrue;
  24186. if ( e && !this.isSimulated ) {
  24187. e.stopImmediatePropagation();
  24188. }
  24189. this.stopPropagation();
  24190. }
  24191. };
  24192. // Create mouseenter/leave events using mouseover/out and event-time checks
  24193. // so that event delegation works in jQuery.
  24194. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  24195. //
  24196. // Support: Safari 7 only
  24197. // Safari sends mouseenter too often; see:
  24198. // https://code.google.com/p/chromium/issues/detail?id=470258
  24199. // for the description of the bug (it existed in older Chrome versions as well).
  24200. jQuery.each( {
  24201. mouseenter: "mouseover",
  24202. mouseleave: "mouseout",
  24203. pointerenter: "pointerover",
  24204. pointerleave: "pointerout"
  24205. }, function( orig, fix ) {
  24206. jQuery.event.special[ orig ] = {
  24207. delegateType: fix,
  24208. bindType: fix,
  24209. handle: function( event ) {
  24210. var ret,
  24211. target = this,
  24212. related = event.relatedTarget,
  24213. handleObj = event.handleObj;
  24214. // For mouseenter/leave call the handler if related is outside the target.
  24215. // NB: No relatedTarget if the mouse left/entered the browser window
  24216. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  24217. event.type = handleObj.origType;
  24218. ret = handleObj.handler.apply( this, arguments );
  24219. event.type = fix;
  24220. }
  24221. return ret;
  24222. }
  24223. };
  24224. } );
  24225. jQuery.fn.extend( {
  24226. on: function( types, selector, data, fn ) {
  24227. return on( this, types, selector, data, fn );
  24228. },
  24229. one: function( types, selector, data, fn ) {
  24230. return on( this, types, selector, data, fn, 1 );
  24231. },
  24232. off: function( types, selector, fn ) {
  24233. var handleObj, type;
  24234. if ( types && types.preventDefault && types.handleObj ) {
  24235. // ( event ) dispatched jQuery.Event
  24236. handleObj = types.handleObj;
  24237. jQuery( types.delegateTarget ).off(
  24238. handleObj.namespace ?
  24239. handleObj.origType + "." + handleObj.namespace :
  24240. handleObj.origType,
  24241. handleObj.selector,
  24242. handleObj.handler
  24243. );
  24244. return this;
  24245. }
  24246. if ( typeof types === "object" ) {
  24247. // ( types-object [, selector] )
  24248. for ( type in types ) {
  24249. this.off( type, selector, types[ type ] );
  24250. }
  24251. return this;
  24252. }
  24253. if ( selector === false || typeof selector === "function" ) {
  24254. // ( types [, fn] )
  24255. fn = selector;
  24256. selector = undefined;
  24257. }
  24258. if ( fn === false ) {
  24259. fn = returnFalse;
  24260. }
  24261. return this.each( function() {
  24262. jQuery.event.remove( this, types, fn, selector );
  24263. } );
  24264. }
  24265. } );
  24266. var
  24267. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
  24268. // Support: IE 10-11, Edge 10240+
  24269. // In IE/Edge using regex groups here causes severe slowdowns.
  24270. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  24271. rnoInnerhtml = /<script|<style|<link/i,
  24272. // checked="checked" or checked
  24273. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  24274. rscriptTypeMasked = /^true\/(.*)/,
  24275. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  24276. // Manipulating tables requires a tbody
  24277. function manipulationTarget( elem, content ) {
  24278. return jQuery.nodeName( elem, "table" ) &&
  24279. jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
  24280. elem.getElementsByTagName( "tbody" )[ 0 ] ||
  24281. elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
  24282. elem;
  24283. }
  24284. // Replace/restore the type attribute of script elements for safe DOM manipulation
  24285. function disableScript( elem ) {
  24286. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  24287. return elem;
  24288. }
  24289. function restoreScript( elem ) {
  24290. var match = rscriptTypeMasked.exec( elem.type );
  24291. if ( match ) {
  24292. elem.type = match[ 1 ];
  24293. } else {
  24294. elem.removeAttribute( "type" );
  24295. }
  24296. return elem;
  24297. }
  24298. function cloneCopyEvent( src, dest ) {
  24299. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  24300. if ( dest.nodeType !== 1 ) {
  24301. return;
  24302. }
  24303. // 1. Copy private data: events, handlers, etc.
  24304. if ( dataPriv.hasData( src ) ) {
  24305. pdataOld = dataPriv.access( src );
  24306. pdataCur = dataPriv.set( dest, pdataOld );
  24307. events = pdataOld.events;
  24308. if ( events ) {
  24309. delete pdataCur.handle;
  24310. pdataCur.events = {};
  24311. for ( type in events ) {
  24312. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  24313. jQuery.event.add( dest, type, events[ type ][ i ] );
  24314. }
  24315. }
  24316. }
  24317. }
  24318. // 2. Copy user data
  24319. if ( dataUser.hasData( src ) ) {
  24320. udataOld = dataUser.access( src );
  24321. udataCur = jQuery.extend( {}, udataOld );
  24322. dataUser.set( dest, udataCur );
  24323. }
  24324. }
  24325. // Fix IE bugs, see support tests
  24326. function fixInput( src, dest ) {
  24327. var nodeName = dest.nodeName.toLowerCase();
  24328. // Fails to persist the checked state of a cloned checkbox or radio button.
  24329. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  24330. dest.checked = src.checked;
  24331. // Fails to return the selected option to the default selected state when cloning options
  24332. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  24333. dest.defaultValue = src.defaultValue;
  24334. }
  24335. }
  24336. function domManip( collection, args, callback, ignored ) {
  24337. // Flatten any nested arrays
  24338. args = concat.apply( [], args );
  24339. var fragment, first, scripts, hasScripts, node, doc,
  24340. i = 0,
  24341. l = collection.length,
  24342. iNoClone = l - 1,
  24343. value = args[ 0 ],
  24344. isFunction = jQuery.isFunction( value );
  24345. // We can't cloneNode fragments that contain checked, in WebKit
  24346. if ( isFunction ||
  24347. ( l > 1 && typeof value === "string" &&
  24348. !support.checkClone && rchecked.test( value ) ) ) {
  24349. return collection.each( function( index ) {
  24350. var self = collection.eq( index );
  24351. if ( isFunction ) {
  24352. args[ 0 ] = value.call( this, index, self.html() );
  24353. }
  24354. domManip( self, args, callback, ignored );
  24355. } );
  24356. }
  24357. if ( l ) {
  24358. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  24359. first = fragment.firstChild;
  24360. if ( fragment.childNodes.length === 1 ) {
  24361. fragment = first;
  24362. }
  24363. // Require either new content or an interest in ignored elements to invoke the callback
  24364. if ( first || ignored ) {
  24365. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  24366. hasScripts = scripts.length;
  24367. // Use the original fragment for the last item
  24368. // instead of the first because it can end up
  24369. // being emptied incorrectly in certain situations (#8070).
  24370. for ( ; i < l; i++ ) {
  24371. node = fragment;
  24372. if ( i !== iNoClone ) {
  24373. node = jQuery.clone( node, true, true );
  24374. // Keep references to cloned scripts for later restoration
  24375. if ( hasScripts ) {
  24376. // Support: Android<4.1, PhantomJS<2
  24377. // push.apply(_, arraylike) throws on ancient WebKit
  24378. jQuery.merge( scripts, getAll( node, "script" ) );
  24379. }
  24380. }
  24381. callback.call( collection[ i ], node, i );
  24382. }
  24383. if ( hasScripts ) {
  24384. doc = scripts[ scripts.length - 1 ].ownerDocument;
  24385. // Reenable scripts
  24386. jQuery.map( scripts, restoreScript );
  24387. // Evaluate executable scripts on first document insertion
  24388. for ( i = 0; i < hasScripts; i++ ) {
  24389. node = scripts[ i ];
  24390. if ( rscriptType.test( node.type || "" ) &&
  24391. !dataPriv.access( node, "globalEval" ) &&
  24392. jQuery.contains( doc, node ) ) {
  24393. if ( node.src ) {
  24394. // Optional AJAX dependency, but won't run scripts if not present
  24395. if ( jQuery._evalUrl ) {
  24396. jQuery._evalUrl( node.src );
  24397. }
  24398. } else {
  24399. jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
  24400. }
  24401. }
  24402. }
  24403. }
  24404. }
  24405. }
  24406. return collection;
  24407. }
  24408. function remove( elem, selector, keepData ) {
  24409. var node,
  24410. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  24411. i = 0;
  24412. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  24413. if ( !keepData && node.nodeType === 1 ) {
  24414. jQuery.cleanData( getAll( node ) );
  24415. }
  24416. if ( node.parentNode ) {
  24417. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  24418. setGlobalEval( getAll( node, "script" ) );
  24419. }
  24420. node.parentNode.removeChild( node );
  24421. }
  24422. }
  24423. return elem;
  24424. }
  24425. jQuery.extend( {
  24426. htmlPrefilter: function( html ) {
  24427. return html.replace( rxhtmlTag, "<$1></$2>" );
  24428. },
  24429. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  24430. var i, l, srcElements, destElements,
  24431. clone = elem.cloneNode( true ),
  24432. inPage = jQuery.contains( elem.ownerDocument, elem );
  24433. // Fix IE cloning issues
  24434. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  24435. !jQuery.isXMLDoc( elem ) ) {
  24436. // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
  24437. destElements = getAll( clone );
  24438. srcElements = getAll( elem );
  24439. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  24440. fixInput( srcElements[ i ], destElements[ i ] );
  24441. }
  24442. }
  24443. // Copy the events from the original to the clone
  24444. if ( dataAndEvents ) {
  24445. if ( deepDataAndEvents ) {
  24446. srcElements = srcElements || getAll( elem );
  24447. destElements = destElements || getAll( clone );
  24448. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  24449. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  24450. }
  24451. } else {
  24452. cloneCopyEvent( elem, clone );
  24453. }
  24454. }
  24455. // Preserve script evaluation history
  24456. destElements = getAll( clone, "script" );
  24457. if ( destElements.length > 0 ) {
  24458. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  24459. }
  24460. // Return the cloned set
  24461. return clone;
  24462. },
  24463. cleanData: function( elems ) {
  24464. var data, elem, type,
  24465. special = jQuery.event.special,
  24466. i = 0;
  24467. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  24468. if ( acceptData( elem ) ) {
  24469. if ( ( data = elem[ dataPriv.expando ] ) ) {
  24470. if ( data.events ) {
  24471. for ( type in data.events ) {
  24472. if ( special[ type ] ) {
  24473. jQuery.event.remove( elem, type );
  24474. // This is a shortcut to avoid jQuery.event.remove's overhead
  24475. } else {
  24476. jQuery.removeEvent( elem, type, data.handle );
  24477. }
  24478. }
  24479. }
  24480. // Support: Chrome <= 35-45+
  24481. // Assign undefined instead of using delete, see Data#remove
  24482. elem[ dataPriv.expando ] = undefined;
  24483. }
  24484. if ( elem[ dataUser.expando ] ) {
  24485. // Support: Chrome <= 35-45+
  24486. // Assign undefined instead of using delete, see Data#remove
  24487. elem[ dataUser.expando ] = undefined;
  24488. }
  24489. }
  24490. }
  24491. }
  24492. } );
  24493. jQuery.fn.extend( {
  24494. // Keep domManip exposed until 3.0 (gh-2225)
  24495. domManip: domManip,
  24496. detach: function( selector ) {
  24497. return remove( this, selector, true );
  24498. },
  24499. remove: function( selector ) {
  24500. return remove( this, selector );
  24501. },
  24502. text: function( value ) {
  24503. return access( this, function( value ) {
  24504. return value === undefined ?
  24505. jQuery.text( this ) :
  24506. this.empty().each( function() {
  24507. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  24508. this.textContent = value;
  24509. }
  24510. } );
  24511. }, null, value, arguments.length );
  24512. },
  24513. append: function() {
  24514. return domManip( this, arguments, function( elem ) {
  24515. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  24516. var target = manipulationTarget( this, elem );
  24517. target.appendChild( elem );
  24518. }
  24519. } );
  24520. },
  24521. prepend: function() {
  24522. return domManip( this, arguments, function( elem ) {
  24523. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  24524. var target = manipulationTarget( this, elem );
  24525. target.insertBefore( elem, target.firstChild );
  24526. }
  24527. } );
  24528. },
  24529. before: function() {
  24530. return domManip( this, arguments, function( elem ) {
  24531. if ( this.parentNode ) {
  24532. this.parentNode.insertBefore( elem, this );
  24533. }
  24534. } );
  24535. },
  24536. after: function() {
  24537. return domManip( this, arguments, function( elem ) {
  24538. if ( this.parentNode ) {
  24539. this.parentNode.insertBefore( elem, this.nextSibling );
  24540. }
  24541. } );
  24542. },
  24543. empty: function() {
  24544. var elem,
  24545. i = 0;
  24546. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  24547. if ( elem.nodeType === 1 ) {
  24548. // Prevent memory leaks
  24549. jQuery.cleanData( getAll( elem, false ) );
  24550. // Remove any remaining nodes
  24551. elem.textContent = "";
  24552. }
  24553. }
  24554. return this;
  24555. },
  24556. clone: function( dataAndEvents, deepDataAndEvents ) {
  24557. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  24558. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  24559. return this.map( function() {
  24560. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  24561. } );
  24562. },
  24563. html: function( value ) {
  24564. return access( this, function( value ) {
  24565. var elem = this[ 0 ] || {},
  24566. i = 0,
  24567. l = this.length;
  24568. if ( value === undefined && elem.nodeType === 1 ) {
  24569. return elem.innerHTML;
  24570. }
  24571. // See if we can take a shortcut and just use innerHTML
  24572. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  24573. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  24574. value = jQuery.htmlPrefilter( value );
  24575. try {
  24576. for ( ; i < l; i++ ) {
  24577. elem = this[ i ] || {};
  24578. // Remove element nodes and prevent memory leaks
  24579. if ( elem.nodeType === 1 ) {
  24580. jQuery.cleanData( getAll( elem, false ) );
  24581. elem.innerHTML = value;
  24582. }
  24583. }
  24584. elem = 0;
  24585. // If using innerHTML throws an exception, use the fallback method
  24586. } catch ( e ) {}
  24587. }
  24588. if ( elem ) {
  24589. this.empty().append( value );
  24590. }
  24591. }, null, value, arguments.length );
  24592. },
  24593. replaceWith: function() {
  24594. var ignored = [];
  24595. // Make the changes, replacing each non-ignored context element with the new content
  24596. return domManip( this, arguments, function( elem ) {
  24597. var parent = this.parentNode;
  24598. if ( jQuery.inArray( this, ignored ) < 0 ) {
  24599. jQuery.cleanData( getAll( this ) );
  24600. if ( parent ) {
  24601. parent.replaceChild( elem, this );
  24602. }
  24603. }
  24604. // Force callback invocation
  24605. }, ignored );
  24606. }
  24607. } );
  24608. jQuery.each( {
  24609. appendTo: "append",
  24610. prependTo: "prepend",
  24611. insertBefore: "before",
  24612. insertAfter: "after",
  24613. replaceAll: "replaceWith"
  24614. }, function( name, original ) {
  24615. jQuery.fn[ name ] = function( selector ) {
  24616. var elems,
  24617. ret = [],
  24618. insert = jQuery( selector ),
  24619. last = insert.length - 1,
  24620. i = 0;
  24621. for ( ; i <= last; i++ ) {
  24622. elems = i === last ? this : this.clone( true );
  24623. jQuery( insert[ i ] )[ original ]( elems );
  24624. // Support: QtWebKit
  24625. // .get() because push.apply(_, arraylike) throws
  24626. push.apply( ret, elems.get() );
  24627. }
  24628. return this.pushStack( ret );
  24629. };
  24630. } );
  24631. var iframe,
  24632. elemdisplay = {
  24633. // Support: Firefox
  24634. // We have to pre-define these values for FF (#10227)
  24635. HTML: "block",
  24636. BODY: "block"
  24637. };
  24638. /**
  24639. * Retrieve the actual display of a element
  24640. * @param {String} name nodeName of the element
  24641. * @param {Object} doc Document object
  24642. */
  24643. // Called only from within defaultDisplay
  24644. function actualDisplay( name, doc ) {
  24645. var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
  24646. display = jQuery.css( elem[ 0 ], "display" );
  24647. // We don't have any data stored on the element,
  24648. // so use "detach" method as fast way to get rid of the element
  24649. elem.detach();
  24650. return display;
  24651. }
  24652. /**
  24653. * Try to determine the default display value of an element
  24654. * @param {String} nodeName
  24655. */
  24656. function defaultDisplay( nodeName ) {
  24657. var doc = document,
  24658. display = elemdisplay[ nodeName ];
  24659. if ( !display ) {
  24660. display = actualDisplay( nodeName, doc );
  24661. // If the simple way fails, read from inside an iframe
  24662. if ( display === "none" || !display ) {
  24663. // Use the already-created iframe if possible
  24664. iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
  24665. .appendTo( doc.documentElement );
  24666. // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
  24667. doc = iframe[ 0 ].contentDocument;
  24668. // Support: IE
  24669. doc.write();
  24670. doc.close();
  24671. display = actualDisplay( nodeName, doc );
  24672. iframe.detach();
  24673. }
  24674. // Store the correct default display
  24675. elemdisplay[ nodeName ] = display;
  24676. }
  24677. return display;
  24678. }
  24679. var rmargin = ( /^margin/ );
  24680. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  24681. var getStyles = function( elem ) {
  24682. // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
  24683. // IE throws on elements created in popups
  24684. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  24685. var view = elem.ownerDocument.defaultView;
  24686. if ( !view || !view.opener ) {
  24687. view = window;
  24688. }
  24689. return view.getComputedStyle( elem );
  24690. };
  24691. var swap = function( elem, options, callback, args ) {
  24692. var ret, name,
  24693. old = {};
  24694. // Remember the old values, and insert the new ones
  24695. for ( name in options ) {
  24696. old[ name ] = elem.style[ name ];
  24697. elem.style[ name ] = options[ name ];
  24698. }
  24699. ret = callback.apply( elem, args || [] );
  24700. // Revert the old values
  24701. for ( name in options ) {
  24702. elem.style[ name ] = old[ name ];
  24703. }
  24704. return ret;
  24705. };
  24706. var documentElement = document.documentElement;
  24707. ( function() {
  24708. var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
  24709. container = document.createElement( "div" ),
  24710. div = document.createElement( "div" );
  24711. // Finish early in limited (non-browser) environments
  24712. if ( !div.style ) {
  24713. return;
  24714. }
  24715. // Support: IE9-11+
  24716. // Style of cloned element affects source element cloned (#8908)
  24717. div.style.backgroundClip = "content-box";
  24718. div.cloneNode( true ).style.backgroundClip = "";
  24719. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  24720. container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
  24721. "padding:0;margin-top:1px;position:absolute";
  24722. container.appendChild( div );
  24723. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  24724. // so they're executed at the same time to save the second computation.
  24725. function computeStyleTests() {
  24726. div.style.cssText =
  24727. // Support: Firefox<29, Android 2.3
  24728. // Vendor-prefix box-sizing
  24729. "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" +
  24730. "position:relative;display:block;" +
  24731. "margin:auto;border:1px;padding:1px;" +
  24732. "top:1%;width:50%";
  24733. div.innerHTML = "";
  24734. documentElement.appendChild( container );
  24735. var divStyle = window.getComputedStyle( div );
  24736. pixelPositionVal = divStyle.top !== "1%";
  24737. reliableMarginLeftVal = divStyle.marginLeft === "2px";
  24738. boxSizingReliableVal = divStyle.width === "4px";
  24739. // Support: Android 4.0 - 4.3 only
  24740. // Some styles come back with percentage values, even though they shouldn't
  24741. div.style.marginRight = "50%";
  24742. pixelMarginRightVal = divStyle.marginRight === "4px";
  24743. documentElement.removeChild( container );
  24744. }
  24745. jQuery.extend( support, {
  24746. pixelPosition: function() {
  24747. // This test is executed only once but we still do memoizing
  24748. // since we can use the boxSizingReliable pre-computing.
  24749. // No need to check if the test was already performed, though.
  24750. computeStyleTests();
  24751. return pixelPositionVal;
  24752. },
  24753. boxSizingReliable: function() {
  24754. if ( boxSizingReliableVal == null ) {
  24755. computeStyleTests();
  24756. }
  24757. return boxSizingReliableVal;
  24758. },
  24759. pixelMarginRight: function() {
  24760. // Support: Android 4.0-4.3
  24761. // We're checking for boxSizingReliableVal here instead of pixelMarginRightVal
  24762. // since that compresses better and they're computed together anyway.
  24763. if ( boxSizingReliableVal == null ) {
  24764. computeStyleTests();
  24765. }
  24766. return pixelMarginRightVal;
  24767. },
  24768. reliableMarginLeft: function() {
  24769. // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
  24770. if ( boxSizingReliableVal == null ) {
  24771. computeStyleTests();
  24772. }
  24773. return reliableMarginLeftVal;
  24774. },
  24775. reliableMarginRight: function() {
  24776. // Support: Android 2.3
  24777. // Check if div with explicit width and no margin-right incorrectly
  24778. // gets computed margin-right based on width of container. (#3333)
  24779. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  24780. // This support function is only executed once so no memoizing is needed.
  24781. var ret,
  24782. marginDiv = div.appendChild( document.createElement( "div" ) );
  24783. // Reset CSS: box-sizing; display; margin; border; padding
  24784. marginDiv.style.cssText = div.style.cssText =
  24785. // Support: Android 2.3
  24786. // Vendor-prefix box-sizing
  24787. "-webkit-box-sizing:content-box;box-sizing:content-box;" +
  24788. "display:block;margin:0;border:0;padding:0";
  24789. marginDiv.style.marginRight = marginDiv.style.width = "0";
  24790. div.style.width = "1px";
  24791. documentElement.appendChild( container );
  24792. ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight );
  24793. documentElement.removeChild( container );
  24794. div.removeChild( marginDiv );
  24795. return ret;
  24796. }
  24797. } );
  24798. } )();
  24799. function curCSS( elem, name, computed ) {
  24800. var width, minWidth, maxWidth, ret,
  24801. style = elem.style;
  24802. computed = computed || getStyles( elem );
  24803. ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
  24804. // Support: Opera 12.1x only
  24805. // Fall back to style even without computed
  24806. // computed is undefined for elems on document fragments
  24807. if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
  24808. ret = jQuery.style( elem, name );
  24809. }
  24810. // Support: IE9
  24811. // getPropertyValue is only needed for .css('filter') (#12537)
  24812. if ( computed ) {
  24813. // A tribute to the "awesome hack by Dean Edwards"
  24814. // Android Browser returns percentage for some values,
  24815. // but width seems to be reliably pixels.
  24816. // This is against the CSSOM draft spec:
  24817. // http://dev.w3.org/csswg/cssom/#resolved-values
  24818. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  24819. // Remember the original values
  24820. width = style.width;
  24821. minWidth = style.minWidth;
  24822. maxWidth = style.maxWidth;
  24823. // Put in the new values to get a computed value out
  24824. style.minWidth = style.maxWidth = style.width = ret;
  24825. ret = computed.width;
  24826. // Revert the changed values
  24827. style.width = width;
  24828. style.minWidth = minWidth;
  24829. style.maxWidth = maxWidth;
  24830. }
  24831. }
  24832. return ret !== undefined ?
  24833. // Support: IE9-11+
  24834. // IE returns zIndex value as an integer.
  24835. ret + "" :
  24836. ret;
  24837. }
  24838. function addGetHookIf( conditionFn, hookFn ) {
  24839. // Define the hook, we'll check on the first run if it's really needed.
  24840. return {
  24841. get: function() {
  24842. if ( conditionFn() ) {
  24843. // Hook not needed (or it's not possible to use it due
  24844. // to missing dependency), remove it.
  24845. delete this.get;
  24846. return;
  24847. }
  24848. // Hook needed; redefine it so that the support test is not executed again.
  24849. return ( this.get = hookFn ).apply( this, arguments );
  24850. }
  24851. };
  24852. }
  24853. var
  24854. // Swappable if display is none or starts with table
  24855. // except "table", "table-cell", or "table-caption"
  24856. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  24857. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  24858. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  24859. cssNormalTransform = {
  24860. letterSpacing: "0",
  24861. fontWeight: "400"
  24862. },
  24863. cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
  24864. emptyStyle = document.createElement( "div" ).style;
  24865. // Return a css property mapped to a potentially vendor prefixed property
  24866. function vendorPropName( name ) {
  24867. // Shortcut for names that are not vendor prefixed
  24868. if ( name in emptyStyle ) {
  24869. return name;
  24870. }
  24871. // Check for vendor prefixed names
  24872. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  24873. i = cssPrefixes.length;
  24874. while ( i-- ) {
  24875. name = cssPrefixes[ i ] + capName;
  24876. if ( name in emptyStyle ) {
  24877. return name;
  24878. }
  24879. }
  24880. }
  24881. function setPositiveNumber( elem, value, subtract ) {
  24882. // Any relative (+/-) values have already been
  24883. // normalized at this point
  24884. var matches = rcssNum.exec( value );
  24885. return matches ?
  24886. // Guard against undefined "subtract", e.g., when used as in cssHooks
  24887. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  24888. value;
  24889. }
  24890. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  24891. var i = extra === ( isBorderBox ? "border" : "content" ) ?
  24892. // If we already have the right measurement, avoid augmentation
  24893. 4 :
  24894. // Otherwise initialize for horizontal or vertical properties
  24895. name === "width" ? 1 : 0,
  24896. val = 0;
  24897. for ( ; i < 4; i += 2 ) {
  24898. // Both box models exclude margin, so add it if we want it
  24899. if ( extra === "margin" ) {
  24900. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  24901. }
  24902. if ( isBorderBox ) {
  24903. // border-box includes padding, so remove it if we want content
  24904. if ( extra === "content" ) {
  24905. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  24906. }
  24907. // At this point, extra isn't border nor margin, so remove border
  24908. if ( extra !== "margin" ) {
  24909. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  24910. }
  24911. } else {
  24912. // At this point, extra isn't content, so add padding
  24913. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  24914. // At this point, extra isn't content nor padding, so add border
  24915. if ( extra !== "padding" ) {
  24916. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  24917. }
  24918. }
  24919. }
  24920. return val;
  24921. }
  24922. function getWidthOrHeight( elem, name, extra ) {
  24923. // Start with offset property, which is equivalent to the border-box value
  24924. var valueIsBorderBox = true,
  24925. val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
  24926. styles = getStyles( elem ),
  24927. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  24928. // Some non-html elements return undefined for offsetWidth, so check for null/undefined
  24929. // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
  24930. // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
  24931. if ( val <= 0 || val == null ) {
  24932. // Fall back to computed then uncomputed css if necessary
  24933. val = curCSS( elem, name, styles );
  24934. if ( val < 0 || val == null ) {
  24935. val = elem.style[ name ];
  24936. }
  24937. // Computed unit is not pixels. Stop here and return.
  24938. if ( rnumnonpx.test( val ) ) {
  24939. return val;
  24940. }
  24941. // Check for style in case a browser which returns unreliable values
  24942. // for getComputedStyle silently falls back to the reliable elem.style
  24943. valueIsBorderBox = isBorderBox &&
  24944. ( support.boxSizingReliable() || val === elem.style[ name ] );
  24945. // Normalize "", auto, and prepare for extra
  24946. val = parseFloat( val ) || 0;
  24947. }
  24948. // Use the active box-sizing model to add/subtract irrelevant styles
  24949. return ( val +
  24950. augmentWidthOrHeight(
  24951. elem,
  24952. name,
  24953. extra || ( isBorderBox ? "border" : "content" ),
  24954. valueIsBorderBox,
  24955. styles
  24956. )
  24957. ) + "px";
  24958. }
  24959. function showHide( elements, show ) {
  24960. var display, elem, hidden,
  24961. values = [],
  24962. index = 0,
  24963. length = elements.length;
  24964. for ( ; index < length; index++ ) {
  24965. elem = elements[ index ];
  24966. if ( !elem.style ) {
  24967. continue;
  24968. }
  24969. values[ index ] = dataPriv.get( elem, "olddisplay" );
  24970. display = elem.style.display;
  24971. if ( show ) {
  24972. // Reset the inline display of this element to learn if it is
  24973. // being hidden by cascaded rules or not
  24974. if ( !values[ index ] && display === "none" ) {
  24975. elem.style.display = "";
  24976. }
  24977. // Set elements which have been overridden with display: none
  24978. // in a stylesheet to whatever the default browser style is
  24979. // for such an element
  24980. if ( elem.style.display === "" && isHidden( elem ) ) {
  24981. values[ index ] = dataPriv.access(
  24982. elem,
  24983. "olddisplay",
  24984. defaultDisplay( elem.nodeName )
  24985. );
  24986. }
  24987. } else {
  24988. hidden = isHidden( elem );
  24989. if ( display !== "none" || !hidden ) {
  24990. dataPriv.set(
  24991. elem,
  24992. "olddisplay",
  24993. hidden ? display : jQuery.css( elem, "display" )
  24994. );
  24995. }
  24996. }
  24997. }
  24998. // Set the display of most of the elements in a second loop
  24999. // to avoid the constant reflow
  25000. for ( index = 0; index < length; index++ ) {
  25001. elem = elements[ index ];
  25002. if ( !elem.style ) {
  25003. continue;
  25004. }
  25005. if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
  25006. elem.style.display = show ? values[ index ] || "" : "none";
  25007. }
  25008. }
  25009. return elements;
  25010. }
  25011. jQuery.extend( {
  25012. // Add in style property hooks for overriding the default
  25013. // behavior of getting and setting a style property
  25014. cssHooks: {
  25015. opacity: {
  25016. get: function( elem, computed ) {
  25017. if ( computed ) {
  25018. // We should always get a number back from opacity
  25019. var ret = curCSS( elem, "opacity" );
  25020. return ret === "" ? "1" : ret;
  25021. }
  25022. }
  25023. }
  25024. },
  25025. // Don't automatically add "px" to these possibly-unitless properties
  25026. cssNumber: {
  25027. "animationIterationCount": true,
  25028. "columnCount": true,
  25029. "fillOpacity": true,
  25030. "flexGrow": true,
  25031. "flexShrink": true,
  25032. "fontWeight": true,
  25033. "lineHeight": true,
  25034. "opacity": true,
  25035. "order": true,
  25036. "orphans": true,
  25037. "widows": true,
  25038. "zIndex": true,
  25039. "zoom": true
  25040. },
  25041. // Add in properties whose names you wish to fix before
  25042. // setting or getting the value
  25043. cssProps: {
  25044. "float": "cssFloat"
  25045. },
  25046. // Get and set the style property on a DOM Node
  25047. style: function( elem, name, value, extra ) {
  25048. // Don't set styles on text and comment nodes
  25049. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  25050. return;
  25051. }
  25052. // Make sure that we're working with the right name
  25053. var ret, type, hooks,
  25054. origName = jQuery.camelCase( name ),
  25055. style = elem.style;
  25056. name = jQuery.cssProps[ origName ] ||
  25057. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  25058. // Gets hook for the prefixed version, then unprefixed version
  25059. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  25060. // Check if we're setting a value
  25061. if ( value !== undefined ) {
  25062. type = typeof value;
  25063. // Convert "+=" or "-=" to relative numbers (#7345)
  25064. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  25065. value = adjustCSS( elem, name, ret );
  25066. // Fixes bug #9237
  25067. type = "number";
  25068. }
  25069. // Make sure that null and NaN values aren't set (#7116)
  25070. if ( value == null || value !== value ) {
  25071. return;
  25072. }
  25073. // If a number was passed in, add the unit (except for certain CSS properties)
  25074. if ( type === "number" ) {
  25075. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  25076. }
  25077. // Support: IE9-11+
  25078. // background-* props affect original clone's values
  25079. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  25080. style[ name ] = "inherit";
  25081. }
  25082. // If a hook was provided, use that value, otherwise just set the specified value
  25083. if ( !hooks || !( "set" in hooks ) ||
  25084. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  25085. style[ name ] = value;
  25086. }
  25087. } else {
  25088. // If a hook was provided get the non-computed value from there
  25089. if ( hooks && "get" in hooks &&
  25090. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  25091. return ret;
  25092. }
  25093. // Otherwise just get the value from the style object
  25094. return style[ name ];
  25095. }
  25096. },
  25097. css: function( elem, name, extra, styles ) {
  25098. var val, num, hooks,
  25099. origName = jQuery.camelCase( name );
  25100. // Make sure that we're working with the right name
  25101. name = jQuery.cssProps[ origName ] ||
  25102. ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
  25103. // Try prefixed name followed by the unprefixed name
  25104. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  25105. // If a hook was provided get the computed value from there
  25106. if ( hooks && "get" in hooks ) {
  25107. val = hooks.get( elem, true, extra );
  25108. }
  25109. // Otherwise, if a way to get the computed value exists, use that
  25110. if ( val === undefined ) {
  25111. val = curCSS( elem, name, styles );
  25112. }
  25113. // Convert "normal" to computed value
  25114. if ( val === "normal" && name in cssNormalTransform ) {
  25115. val = cssNormalTransform[ name ];
  25116. }
  25117. // Make numeric if forced or a qualifier was provided and val looks numeric
  25118. if ( extra === "" || extra ) {
  25119. num = parseFloat( val );
  25120. return extra === true || isFinite( num ) ? num || 0 : val;
  25121. }
  25122. return val;
  25123. }
  25124. } );
  25125. jQuery.each( [ "height", "width" ], function( i, name ) {
  25126. jQuery.cssHooks[ name ] = {
  25127. get: function( elem, computed, extra ) {
  25128. if ( computed ) {
  25129. // Certain elements can have dimension info if we invisibly show them
  25130. // but it must have a current display style that would benefit
  25131. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  25132. elem.offsetWidth === 0 ?
  25133. swap( elem, cssShow, function() {
  25134. return getWidthOrHeight( elem, name, extra );
  25135. } ) :
  25136. getWidthOrHeight( elem, name, extra );
  25137. }
  25138. },
  25139. set: function( elem, value, extra ) {
  25140. var matches,
  25141. styles = extra && getStyles( elem ),
  25142. subtract = extra && augmentWidthOrHeight(
  25143. elem,
  25144. name,
  25145. extra,
  25146. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  25147. styles
  25148. );
  25149. // Convert to pixels if value adjustment is needed
  25150. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  25151. ( matches[ 3 ] || "px" ) !== "px" ) {
  25152. elem.style[ name ] = value;
  25153. value = jQuery.css( elem, name );
  25154. }
  25155. return setPositiveNumber( elem, value, subtract );
  25156. }
  25157. };
  25158. } );
  25159. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  25160. function( elem, computed ) {
  25161. if ( computed ) {
  25162. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  25163. elem.getBoundingClientRect().left -
  25164. swap( elem, { marginLeft: 0 }, function() {
  25165. return elem.getBoundingClientRect().left;
  25166. } )
  25167. ) + "px";
  25168. }
  25169. }
  25170. );
  25171. // Support: Android 2.3
  25172. jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
  25173. function( elem, computed ) {
  25174. if ( computed ) {
  25175. return swap( elem, { "display": "inline-block" },
  25176. curCSS, [ elem, "marginRight" ] );
  25177. }
  25178. }
  25179. );
  25180. // These hooks are used by animate to expand properties
  25181. jQuery.each( {
  25182. margin: "",
  25183. padding: "",
  25184. border: "Width"
  25185. }, function( prefix, suffix ) {
  25186. jQuery.cssHooks[ prefix + suffix ] = {
  25187. expand: function( value ) {
  25188. var i = 0,
  25189. expanded = {},
  25190. // Assumes a single number if not a string
  25191. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  25192. for ( ; i < 4; i++ ) {
  25193. expanded[ prefix + cssExpand[ i ] + suffix ] =
  25194. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  25195. }
  25196. return expanded;
  25197. }
  25198. };
  25199. if ( !rmargin.test( prefix ) ) {
  25200. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  25201. }
  25202. } );
  25203. jQuery.fn.extend( {
  25204. css: function( name, value ) {
  25205. return access( this, function( elem, name, value ) {
  25206. var styles, len,
  25207. map = {},
  25208. i = 0;
  25209. if ( jQuery.isArray( name ) ) {
  25210. styles = getStyles( elem );
  25211. len = name.length;
  25212. for ( ; i < len; i++ ) {
  25213. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  25214. }
  25215. return map;
  25216. }
  25217. return value !== undefined ?
  25218. jQuery.style( elem, name, value ) :
  25219. jQuery.css( elem, name );
  25220. }, name, value, arguments.length > 1 );
  25221. },
  25222. show: function() {
  25223. return showHide( this, true );
  25224. },
  25225. hide: function() {
  25226. return showHide( this );
  25227. },
  25228. toggle: function( state ) {
  25229. if ( typeof state === "boolean" ) {
  25230. return state ? this.show() : this.hide();
  25231. }
  25232. return this.each( function() {
  25233. if ( isHidden( this ) ) {
  25234. jQuery( this ).show();
  25235. } else {
  25236. jQuery( this ).hide();
  25237. }
  25238. } );
  25239. }
  25240. } );
  25241. function Tween( elem, options, prop, end, easing ) {
  25242. return new Tween.prototype.init( elem, options, prop, end, easing );
  25243. }
  25244. jQuery.Tween = Tween;
  25245. Tween.prototype = {
  25246. constructor: Tween,
  25247. init: function( elem, options, prop, end, easing, unit ) {
  25248. this.elem = elem;
  25249. this.prop = prop;
  25250. this.easing = easing || jQuery.easing._default;
  25251. this.options = options;
  25252. this.start = this.now = this.cur();
  25253. this.end = end;
  25254. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  25255. },
  25256. cur: function() {
  25257. var hooks = Tween.propHooks[ this.prop ];
  25258. return hooks && hooks.get ?
  25259. hooks.get( this ) :
  25260. Tween.propHooks._default.get( this );
  25261. },
  25262. run: function( percent ) {
  25263. var eased,
  25264. hooks = Tween.propHooks[ this.prop ];
  25265. if ( this.options.duration ) {
  25266. this.pos = eased = jQuery.easing[ this.easing ](
  25267. percent, this.options.duration * percent, 0, 1, this.options.duration
  25268. );
  25269. } else {
  25270. this.pos = eased = percent;
  25271. }
  25272. this.now = ( this.end - this.start ) * eased + this.start;
  25273. if ( this.options.step ) {
  25274. this.options.step.call( this.elem, this.now, this );
  25275. }
  25276. if ( hooks && hooks.set ) {
  25277. hooks.set( this );
  25278. } else {
  25279. Tween.propHooks._default.set( this );
  25280. }
  25281. return this;
  25282. }
  25283. };
  25284. Tween.prototype.init.prototype = Tween.prototype;
  25285. Tween.propHooks = {
  25286. _default: {
  25287. get: function( tween ) {
  25288. var result;
  25289. // Use a property on the element directly when it is not a DOM element,
  25290. // or when there is no matching style property that exists.
  25291. if ( tween.elem.nodeType !== 1 ||
  25292. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  25293. return tween.elem[ tween.prop ];
  25294. }
  25295. // Passing an empty string as a 3rd parameter to .css will automatically
  25296. // attempt a parseFloat and fallback to a string if the parse fails.
  25297. // Simple values such as "10px" are parsed to Float;
  25298. // complex values such as "rotate(1rad)" are returned as-is.
  25299. result = jQuery.css( tween.elem, tween.prop, "" );
  25300. // Empty strings, null, undefined and "auto" are converted to 0.
  25301. return !result || result === "auto" ? 0 : result;
  25302. },
  25303. set: function( tween ) {
  25304. // Use step hook for back compat.
  25305. // Use cssHook if its there.
  25306. // Use .style if available and use plain properties where available.
  25307. if ( jQuery.fx.step[ tween.prop ] ) {
  25308. jQuery.fx.step[ tween.prop ]( tween );
  25309. } else if ( tween.elem.nodeType === 1 &&
  25310. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  25311. jQuery.cssHooks[ tween.prop ] ) ) {
  25312. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  25313. } else {
  25314. tween.elem[ tween.prop ] = tween.now;
  25315. }
  25316. }
  25317. }
  25318. };
  25319. // Support: IE9
  25320. // Panic based approach to setting things on disconnected nodes
  25321. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  25322. set: function( tween ) {
  25323. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  25324. tween.elem[ tween.prop ] = tween.now;
  25325. }
  25326. }
  25327. };
  25328. jQuery.easing = {
  25329. linear: function( p ) {
  25330. return p;
  25331. },
  25332. swing: function( p ) {
  25333. return 0.5 - Math.cos( p * Math.PI ) / 2;
  25334. },
  25335. _default: "swing"
  25336. };
  25337. jQuery.fx = Tween.prototype.init;
  25338. // Back Compat <1.8 extension point
  25339. jQuery.fx.step = {};
  25340. var
  25341. fxNow, timerId,
  25342. rfxtypes = /^(?:toggle|show|hide)$/,
  25343. rrun = /queueHooks$/;
  25344. // Animations created synchronously will run synchronously
  25345. function createFxNow() {
  25346. window.setTimeout( function() {
  25347. fxNow = undefined;
  25348. } );
  25349. return ( fxNow = jQuery.now() );
  25350. }
  25351. // Generate parameters to create a standard animation
  25352. function genFx( type, includeWidth ) {
  25353. var which,
  25354. i = 0,
  25355. attrs = { height: type };
  25356. // If we include width, step value is 1 to do all cssExpand values,
  25357. // otherwise step value is 2 to skip over Left and Right
  25358. includeWidth = includeWidth ? 1 : 0;
  25359. for ( ; i < 4 ; i += 2 - includeWidth ) {
  25360. which = cssExpand[ i ];
  25361. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  25362. }
  25363. if ( includeWidth ) {
  25364. attrs.opacity = attrs.width = type;
  25365. }
  25366. return attrs;
  25367. }
  25368. function createTween( value, prop, animation ) {
  25369. var tween,
  25370. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  25371. index = 0,
  25372. length = collection.length;
  25373. for ( ; index < length; index++ ) {
  25374. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  25375. // We're done with this property
  25376. return tween;
  25377. }
  25378. }
  25379. }
  25380. function defaultPrefilter( elem, props, opts ) {
  25381. /* jshint validthis: true */
  25382. var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
  25383. anim = this,
  25384. orig = {},
  25385. style = elem.style,
  25386. hidden = elem.nodeType && isHidden( elem ),
  25387. dataShow = dataPriv.get( elem, "fxshow" );
  25388. // Handle queue: false promises
  25389. if ( !opts.queue ) {
  25390. hooks = jQuery._queueHooks( elem, "fx" );
  25391. if ( hooks.unqueued == null ) {
  25392. hooks.unqueued = 0;
  25393. oldfire = hooks.empty.fire;
  25394. hooks.empty.fire = function() {
  25395. if ( !hooks.unqueued ) {
  25396. oldfire();
  25397. }
  25398. };
  25399. }
  25400. hooks.unqueued++;
  25401. anim.always( function() {
  25402. // Ensure the complete handler is called before this completes
  25403. anim.always( function() {
  25404. hooks.unqueued--;
  25405. if ( !jQuery.queue( elem, "fx" ).length ) {
  25406. hooks.empty.fire();
  25407. }
  25408. } );
  25409. } );
  25410. }
  25411. // Height/width overflow pass
  25412. if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
  25413. // Make sure that nothing sneaks out
  25414. // Record all 3 overflow attributes because IE9-10 do not
  25415. // change the overflow attribute when overflowX and
  25416. // overflowY are set to the same value
  25417. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  25418. // Set display property to inline-block for height/width
  25419. // animations on inline elements that are having width/height animated
  25420. display = jQuery.css( elem, "display" );
  25421. // Test default display if display is currently "none"
  25422. checkDisplay = display === "none" ?
  25423. dataPriv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
  25424. if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
  25425. style.display = "inline-block";
  25426. }
  25427. }
  25428. if ( opts.overflow ) {
  25429. style.overflow = "hidden";
  25430. anim.always( function() {
  25431. style.overflow = opts.overflow[ 0 ];
  25432. style.overflowX = opts.overflow[ 1 ];
  25433. style.overflowY = opts.overflow[ 2 ];
  25434. } );
  25435. }
  25436. // show/hide pass
  25437. for ( prop in props ) {
  25438. value = props[ prop ];
  25439. if ( rfxtypes.exec( value ) ) {
  25440. delete props[ prop ];
  25441. toggle = toggle || value === "toggle";
  25442. if ( value === ( hidden ? "hide" : "show" ) ) {
  25443. // If there is dataShow left over from a stopped hide or show
  25444. // and we are going to proceed with show, we should pretend to be hidden
  25445. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  25446. hidden = true;
  25447. } else {
  25448. continue;
  25449. }
  25450. }
  25451. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  25452. // Any non-fx value stops us from restoring the original display value
  25453. } else {
  25454. display = undefined;
  25455. }
  25456. }
  25457. if ( !jQuery.isEmptyObject( orig ) ) {
  25458. if ( dataShow ) {
  25459. if ( "hidden" in dataShow ) {
  25460. hidden = dataShow.hidden;
  25461. }
  25462. } else {
  25463. dataShow = dataPriv.access( elem, "fxshow", {} );
  25464. }
  25465. // Store state if its toggle - enables .stop().toggle() to "reverse"
  25466. if ( toggle ) {
  25467. dataShow.hidden = !hidden;
  25468. }
  25469. if ( hidden ) {
  25470. jQuery( elem ).show();
  25471. } else {
  25472. anim.done( function() {
  25473. jQuery( elem ).hide();
  25474. } );
  25475. }
  25476. anim.done( function() {
  25477. var prop;
  25478. dataPriv.remove( elem, "fxshow" );
  25479. for ( prop in orig ) {
  25480. jQuery.style( elem, prop, orig[ prop ] );
  25481. }
  25482. } );
  25483. for ( prop in orig ) {
  25484. tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  25485. if ( !( prop in dataShow ) ) {
  25486. dataShow[ prop ] = tween.start;
  25487. if ( hidden ) {
  25488. tween.end = tween.start;
  25489. tween.start = prop === "width" || prop === "height" ? 1 : 0;
  25490. }
  25491. }
  25492. }
  25493. // If this is a noop like .hide().hide(), restore an overwritten display value
  25494. } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
  25495. style.display = display;
  25496. }
  25497. }
  25498. function propFilter( props, specialEasing ) {
  25499. var index, name, easing, value, hooks;
  25500. // camelCase, specialEasing and expand cssHook pass
  25501. for ( index in props ) {
  25502. name = jQuery.camelCase( index );
  25503. easing = specialEasing[ name ];
  25504. value = props[ index ];
  25505. if ( jQuery.isArray( value ) ) {
  25506. easing = value[ 1 ];
  25507. value = props[ index ] = value[ 0 ];
  25508. }
  25509. if ( index !== name ) {
  25510. props[ name ] = value;
  25511. delete props[ index ];
  25512. }
  25513. hooks = jQuery.cssHooks[ name ];
  25514. if ( hooks && "expand" in hooks ) {
  25515. value = hooks.expand( value );
  25516. delete props[ name ];
  25517. // Not quite $.extend, this won't overwrite existing keys.
  25518. // Reusing 'index' because we have the correct "name"
  25519. for ( index in value ) {
  25520. if ( !( index in props ) ) {
  25521. props[ index ] = value[ index ];
  25522. specialEasing[ index ] = easing;
  25523. }
  25524. }
  25525. } else {
  25526. specialEasing[ name ] = easing;
  25527. }
  25528. }
  25529. }
  25530. function Animation( elem, properties, options ) {
  25531. var result,
  25532. stopped,
  25533. index = 0,
  25534. length = Animation.prefilters.length,
  25535. deferred = jQuery.Deferred().always( function() {
  25536. // Don't match elem in the :animated selector
  25537. delete tick.elem;
  25538. } ),
  25539. tick = function() {
  25540. if ( stopped ) {
  25541. return false;
  25542. }
  25543. var currentTime = fxNow || createFxNow(),
  25544. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  25545. // Support: Android 2.3
  25546. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  25547. temp = remaining / animation.duration || 0,
  25548. percent = 1 - temp,
  25549. index = 0,
  25550. length = animation.tweens.length;
  25551. for ( ; index < length ; index++ ) {
  25552. animation.tweens[ index ].run( percent );
  25553. }
  25554. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  25555. if ( percent < 1 && length ) {
  25556. return remaining;
  25557. } else {
  25558. deferred.resolveWith( elem, [ animation ] );
  25559. return false;
  25560. }
  25561. },
  25562. animation = deferred.promise( {
  25563. elem: elem,
  25564. props: jQuery.extend( {}, properties ),
  25565. opts: jQuery.extend( true, {
  25566. specialEasing: {},
  25567. easing: jQuery.easing._default
  25568. }, options ),
  25569. originalProperties: properties,
  25570. originalOptions: options,
  25571. startTime: fxNow || createFxNow(),
  25572. duration: options.duration,
  25573. tweens: [],
  25574. createTween: function( prop, end ) {
  25575. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  25576. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  25577. animation.tweens.push( tween );
  25578. return tween;
  25579. },
  25580. stop: function( gotoEnd ) {
  25581. var index = 0,
  25582. // If we are going to the end, we want to run all the tweens
  25583. // otherwise we skip this part
  25584. length = gotoEnd ? animation.tweens.length : 0;
  25585. if ( stopped ) {
  25586. return this;
  25587. }
  25588. stopped = true;
  25589. for ( ; index < length ; index++ ) {
  25590. animation.tweens[ index ].run( 1 );
  25591. }
  25592. // Resolve when we played the last frame; otherwise, reject
  25593. if ( gotoEnd ) {
  25594. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  25595. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  25596. } else {
  25597. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  25598. }
  25599. return this;
  25600. }
  25601. } ),
  25602. props = animation.props;
  25603. propFilter( props, animation.opts.specialEasing );
  25604. for ( ; index < length ; index++ ) {
  25605. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  25606. if ( result ) {
  25607. if ( jQuery.isFunction( result.stop ) ) {
  25608. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  25609. jQuery.proxy( result.stop, result );
  25610. }
  25611. return result;
  25612. }
  25613. }
  25614. jQuery.map( props, createTween, animation );
  25615. if ( jQuery.isFunction( animation.opts.start ) ) {
  25616. animation.opts.start.call( elem, animation );
  25617. }
  25618. jQuery.fx.timer(
  25619. jQuery.extend( tick, {
  25620. elem: elem,
  25621. anim: animation,
  25622. queue: animation.opts.queue
  25623. } )
  25624. );
  25625. // attach callbacks from options
  25626. return animation.progress( animation.opts.progress )
  25627. .done( animation.opts.done, animation.opts.complete )
  25628. .fail( animation.opts.fail )
  25629. .always( animation.opts.always );
  25630. }
  25631. jQuery.Animation = jQuery.extend( Animation, {
  25632. tweeners: {
  25633. "*": [ function( prop, value ) {
  25634. var tween = this.createTween( prop, value );
  25635. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  25636. return tween;
  25637. } ]
  25638. },
  25639. tweener: function( props, callback ) {
  25640. if ( jQuery.isFunction( props ) ) {
  25641. callback = props;
  25642. props = [ "*" ];
  25643. } else {
  25644. props = props.match( rnotwhite );
  25645. }
  25646. var prop,
  25647. index = 0,
  25648. length = props.length;
  25649. for ( ; index < length ; index++ ) {
  25650. prop = props[ index ];
  25651. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  25652. Animation.tweeners[ prop ].unshift( callback );
  25653. }
  25654. },
  25655. prefilters: [ defaultPrefilter ],
  25656. prefilter: function( callback, prepend ) {
  25657. if ( prepend ) {
  25658. Animation.prefilters.unshift( callback );
  25659. } else {
  25660. Animation.prefilters.push( callback );
  25661. }
  25662. }
  25663. } );
  25664. jQuery.speed = function( speed, easing, fn ) {
  25665. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  25666. complete: fn || !fn && easing ||
  25667. jQuery.isFunction( speed ) && speed,
  25668. duration: speed,
  25669. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  25670. };
  25671. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ?
  25672. opt.duration : opt.duration in jQuery.fx.speeds ?
  25673. jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
  25674. // Normalize opt.queue - true/undefined/null -> "fx"
  25675. if ( opt.queue == null || opt.queue === true ) {
  25676. opt.queue = "fx";
  25677. }
  25678. // Queueing
  25679. opt.old = opt.complete;
  25680. opt.complete = function() {
  25681. if ( jQuery.isFunction( opt.old ) ) {
  25682. opt.old.call( this );
  25683. }
  25684. if ( opt.queue ) {
  25685. jQuery.dequeue( this, opt.queue );
  25686. }
  25687. };
  25688. return opt;
  25689. };
  25690. jQuery.fn.extend( {
  25691. fadeTo: function( speed, to, easing, callback ) {
  25692. // Show any hidden elements after setting opacity to 0
  25693. return this.filter( isHidden ).css( "opacity", 0 ).show()
  25694. // Animate to the value specified
  25695. .end().animate( { opacity: to }, speed, easing, callback );
  25696. },
  25697. animate: function( prop, speed, easing, callback ) {
  25698. var empty = jQuery.isEmptyObject( prop ),
  25699. optall = jQuery.speed( speed, easing, callback ),
  25700. doAnimation = function() {
  25701. // Operate on a copy of prop so per-property easing won't be lost
  25702. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  25703. // Empty animations, or finishing resolves immediately
  25704. if ( empty || dataPriv.get( this, "finish" ) ) {
  25705. anim.stop( true );
  25706. }
  25707. };
  25708. doAnimation.finish = doAnimation;
  25709. return empty || optall.queue === false ?
  25710. this.each( doAnimation ) :
  25711. this.queue( optall.queue, doAnimation );
  25712. },
  25713. stop: function( type, clearQueue, gotoEnd ) {
  25714. var stopQueue = function( hooks ) {
  25715. var stop = hooks.stop;
  25716. delete hooks.stop;
  25717. stop( gotoEnd );
  25718. };
  25719. if ( typeof type !== "string" ) {
  25720. gotoEnd = clearQueue;
  25721. clearQueue = type;
  25722. type = undefined;
  25723. }
  25724. if ( clearQueue && type !== false ) {
  25725. this.queue( type || "fx", [] );
  25726. }
  25727. return this.each( function() {
  25728. var dequeue = true,
  25729. index = type != null && type + "queueHooks",
  25730. timers = jQuery.timers,
  25731. data = dataPriv.get( this );
  25732. if ( index ) {
  25733. if ( data[ index ] && data[ index ].stop ) {
  25734. stopQueue( data[ index ] );
  25735. }
  25736. } else {
  25737. for ( index in data ) {
  25738. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  25739. stopQueue( data[ index ] );
  25740. }
  25741. }
  25742. }
  25743. for ( index = timers.length; index--; ) {
  25744. if ( timers[ index ].elem === this &&
  25745. ( type == null || timers[ index ].queue === type ) ) {
  25746. timers[ index ].anim.stop( gotoEnd );
  25747. dequeue = false;
  25748. timers.splice( index, 1 );
  25749. }
  25750. }
  25751. // Start the next in the queue if the last step wasn't forced.
  25752. // Timers currently will call their complete callbacks, which
  25753. // will dequeue but only if they were gotoEnd.
  25754. if ( dequeue || !gotoEnd ) {
  25755. jQuery.dequeue( this, type );
  25756. }
  25757. } );
  25758. },
  25759. finish: function( type ) {
  25760. if ( type !== false ) {
  25761. type = type || "fx";
  25762. }
  25763. return this.each( function() {
  25764. var index,
  25765. data = dataPriv.get( this ),
  25766. queue = data[ type + "queue" ],
  25767. hooks = data[ type + "queueHooks" ],
  25768. timers = jQuery.timers,
  25769. length = queue ? queue.length : 0;
  25770. // Enable finishing flag on private data
  25771. data.finish = true;
  25772. // Empty the queue first
  25773. jQuery.queue( this, type, [] );
  25774. if ( hooks && hooks.stop ) {
  25775. hooks.stop.call( this, true );
  25776. }
  25777. // Look for any active animations, and finish them
  25778. for ( index = timers.length; index--; ) {
  25779. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  25780. timers[ index ].anim.stop( true );
  25781. timers.splice( index, 1 );
  25782. }
  25783. }
  25784. // Look for any animations in the old queue and finish them
  25785. for ( index = 0; index < length; index++ ) {
  25786. if ( queue[ index ] && queue[ index ].finish ) {
  25787. queue[ index ].finish.call( this );
  25788. }
  25789. }
  25790. // Turn off finishing flag
  25791. delete data.finish;
  25792. } );
  25793. }
  25794. } );
  25795. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  25796. var cssFn = jQuery.fn[ name ];
  25797. jQuery.fn[ name ] = function( speed, easing, callback ) {
  25798. return speed == null || typeof speed === "boolean" ?
  25799. cssFn.apply( this, arguments ) :
  25800. this.animate( genFx( name, true ), speed, easing, callback );
  25801. };
  25802. } );
  25803. // Generate shortcuts for custom animations
  25804. jQuery.each( {
  25805. slideDown: genFx( "show" ),
  25806. slideUp: genFx( "hide" ),
  25807. slideToggle: genFx( "toggle" ),
  25808. fadeIn: { opacity: "show" },
  25809. fadeOut: { opacity: "hide" },
  25810. fadeToggle: { opacity: "toggle" }
  25811. }, function( name, props ) {
  25812. jQuery.fn[ name ] = function( speed, easing, callback ) {
  25813. return this.animate( props, speed, easing, callback );
  25814. };
  25815. } );
  25816. jQuery.timers = [];
  25817. jQuery.fx.tick = function() {
  25818. var timer,
  25819. i = 0,
  25820. timers = jQuery.timers;
  25821. fxNow = jQuery.now();
  25822. for ( ; i < timers.length; i++ ) {
  25823. timer = timers[ i ];
  25824. // Checks the timer has not already been removed
  25825. if ( !timer() && timers[ i ] === timer ) {
  25826. timers.splice( i--, 1 );
  25827. }
  25828. }
  25829. if ( !timers.length ) {
  25830. jQuery.fx.stop();
  25831. }
  25832. fxNow = undefined;
  25833. };
  25834. jQuery.fx.timer = function( timer ) {
  25835. jQuery.timers.push( timer );
  25836. if ( timer() ) {
  25837. jQuery.fx.start();
  25838. } else {
  25839. jQuery.timers.pop();
  25840. }
  25841. };
  25842. jQuery.fx.interval = 13;
  25843. jQuery.fx.start = function() {
  25844. if ( !timerId ) {
  25845. timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
  25846. }
  25847. };
  25848. jQuery.fx.stop = function() {
  25849. window.clearInterval( timerId );
  25850. timerId = null;
  25851. };
  25852. jQuery.fx.speeds = {
  25853. slow: 600,
  25854. fast: 200,
  25855. // Default speed
  25856. _default: 400
  25857. };
  25858. // Based off of the plugin by Clint Helfers, with permission.
  25859. // http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  25860. jQuery.fn.delay = function( time, type ) {
  25861. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  25862. type = type || "fx";
  25863. return this.queue( type, function( next, hooks ) {
  25864. var timeout = window.setTimeout( next, time );
  25865. hooks.stop = function() {
  25866. window.clearTimeout( timeout );
  25867. };
  25868. } );
  25869. };
  25870. ( function() {
  25871. var input = document.createElement( "input" ),
  25872. select = document.createElement( "select" ),
  25873. opt = select.appendChild( document.createElement( "option" ) );
  25874. input.type = "checkbox";
  25875. // Support: iOS<=5.1, Android<=4.2+
  25876. // Default value for a checkbox should be "on"
  25877. support.checkOn = input.value !== "";
  25878. // Support: IE<=11+
  25879. // Must access selectedIndex to make default options select
  25880. support.optSelected = opt.selected;
  25881. // Support: Android<=2.3
  25882. // Options inside disabled selects are incorrectly marked as disabled
  25883. select.disabled = true;
  25884. support.optDisabled = !opt.disabled;
  25885. // Support: IE<=11+
  25886. // An input loses its value after becoming a radio
  25887. input = document.createElement( "input" );
  25888. input.value = "t";
  25889. input.type = "radio";
  25890. support.radioValue = input.value === "t";
  25891. } )();
  25892. var boolHook,
  25893. attrHandle = jQuery.expr.attrHandle;
  25894. jQuery.fn.extend( {
  25895. attr: function( name, value ) {
  25896. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  25897. },
  25898. removeAttr: function( name ) {
  25899. return this.each( function() {
  25900. jQuery.removeAttr( this, name );
  25901. } );
  25902. }
  25903. } );
  25904. jQuery.extend( {
  25905. attr: function( elem, name, value ) {
  25906. var ret, hooks,
  25907. nType = elem.nodeType;
  25908. // Don't get/set attributes on text, comment and attribute nodes
  25909. if ( nType === 3 || nType === 8 || nType === 2 ) {
  25910. return;
  25911. }
  25912. // Fallback to prop when attributes are not supported
  25913. if ( typeof elem.getAttribute === "undefined" ) {
  25914. return jQuery.prop( elem, name, value );
  25915. }
  25916. // All attributes are lowercase
  25917. // Grab necessary hook if one is defined
  25918. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  25919. name = name.toLowerCase();
  25920. hooks = jQuery.attrHooks[ name ] ||
  25921. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  25922. }
  25923. if ( value !== undefined ) {
  25924. if ( value === null ) {
  25925. jQuery.removeAttr( elem, name );
  25926. return;
  25927. }
  25928. if ( hooks && "set" in hooks &&
  25929. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  25930. return ret;
  25931. }
  25932. elem.setAttribute( name, value + "" );
  25933. return value;
  25934. }
  25935. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  25936. return ret;
  25937. }
  25938. ret = jQuery.find.attr( elem, name );
  25939. // Non-existent attributes return null, we normalize to undefined
  25940. return ret == null ? undefined : ret;
  25941. },
  25942. attrHooks: {
  25943. type: {
  25944. set: function( elem, value ) {
  25945. if ( !support.radioValue && value === "radio" &&
  25946. jQuery.nodeName( elem, "input" ) ) {
  25947. var val = elem.value;
  25948. elem.setAttribute( "type", value );
  25949. if ( val ) {
  25950. elem.value = val;
  25951. }
  25952. return value;
  25953. }
  25954. }
  25955. }
  25956. },
  25957. removeAttr: function( elem, value ) {
  25958. var name, propName,
  25959. i = 0,
  25960. attrNames = value && value.match( rnotwhite );
  25961. if ( attrNames && elem.nodeType === 1 ) {
  25962. while ( ( name = attrNames[ i++ ] ) ) {
  25963. propName = jQuery.propFix[ name ] || name;
  25964. // Boolean attributes get special treatment (#10870)
  25965. if ( jQuery.expr.match.bool.test( name ) ) {
  25966. // Set corresponding property to false
  25967. elem[ propName ] = false;
  25968. }
  25969. elem.removeAttribute( name );
  25970. }
  25971. }
  25972. }
  25973. } );
  25974. // Hooks for boolean attributes
  25975. boolHook = {
  25976. set: function( elem, value, name ) {
  25977. if ( value === false ) {
  25978. // Remove boolean attributes when set to false
  25979. jQuery.removeAttr( elem, name );
  25980. } else {
  25981. elem.setAttribute( name, name );
  25982. }
  25983. return name;
  25984. }
  25985. };
  25986. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  25987. var getter = attrHandle[ name ] || jQuery.find.attr;
  25988. attrHandle[ name ] = function( elem, name, isXML ) {
  25989. var ret, handle;
  25990. if ( !isXML ) {
  25991. // Avoid an infinite loop by temporarily removing this function from the getter
  25992. handle = attrHandle[ name ];
  25993. attrHandle[ name ] = ret;
  25994. ret = getter( elem, name, isXML ) != null ?
  25995. name.toLowerCase() :
  25996. null;
  25997. attrHandle[ name ] = handle;
  25998. }
  25999. return ret;
  26000. };
  26001. } );
  26002. var rfocusable = /^(?:input|select|textarea|button)$/i,
  26003. rclickable = /^(?:a|area)$/i;
  26004. jQuery.fn.extend( {
  26005. prop: function( name, value ) {
  26006. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  26007. },
  26008. removeProp: function( name ) {
  26009. return this.each( function() {
  26010. delete this[ jQuery.propFix[ name ] || name ];
  26011. } );
  26012. }
  26013. } );
  26014. jQuery.extend( {
  26015. prop: function( elem, name, value ) {
  26016. var ret, hooks,
  26017. nType = elem.nodeType;
  26018. // Don't get/set properties on text, comment and attribute nodes
  26019. if ( nType === 3 || nType === 8 || nType === 2 ) {
  26020. return;
  26021. }
  26022. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  26023. // Fix name and attach hooks
  26024. name = jQuery.propFix[ name ] || name;
  26025. hooks = jQuery.propHooks[ name ];
  26026. }
  26027. if ( value !== undefined ) {
  26028. if ( hooks && "set" in hooks &&
  26029. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  26030. return ret;
  26031. }
  26032. return ( elem[ name ] = value );
  26033. }
  26034. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  26035. return ret;
  26036. }
  26037. return elem[ name ];
  26038. },
  26039. propHooks: {
  26040. tabIndex: {
  26041. get: function( elem ) {
  26042. // elem.tabIndex doesn't always return the
  26043. // correct value when it hasn't been explicitly set
  26044. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  26045. // Use proper attribute retrieval(#12072)
  26046. var tabindex = jQuery.find.attr( elem, "tabindex" );
  26047. return tabindex ?
  26048. parseInt( tabindex, 10 ) :
  26049. rfocusable.test( elem.nodeName ) ||
  26050. rclickable.test( elem.nodeName ) && elem.href ?
  26051. 0 :
  26052. -1;
  26053. }
  26054. }
  26055. },
  26056. propFix: {
  26057. "for": "htmlFor",
  26058. "class": "className"
  26059. }
  26060. } );
  26061. // Support: IE <=11 only
  26062. // Accessing the selectedIndex property
  26063. // forces the browser to respect setting selected
  26064. // on the option
  26065. // The getter ensures a default option is selected
  26066. // when in an optgroup
  26067. if ( !support.optSelected ) {
  26068. jQuery.propHooks.selected = {
  26069. get: function( elem ) {
  26070. var parent = elem.parentNode;
  26071. if ( parent && parent.parentNode ) {
  26072. parent.parentNode.selectedIndex;
  26073. }
  26074. return null;
  26075. },
  26076. set: function( elem ) {
  26077. var parent = elem.parentNode;
  26078. if ( parent ) {
  26079. parent.selectedIndex;
  26080. if ( parent.parentNode ) {
  26081. parent.parentNode.selectedIndex;
  26082. }
  26083. }
  26084. }
  26085. };
  26086. }
  26087. jQuery.each( [
  26088. "tabIndex",
  26089. "readOnly",
  26090. "maxLength",
  26091. "cellSpacing",
  26092. "cellPadding",
  26093. "rowSpan",
  26094. "colSpan",
  26095. "useMap",
  26096. "frameBorder",
  26097. "contentEditable"
  26098. ], function() {
  26099. jQuery.propFix[ this.toLowerCase() ] = this;
  26100. } );
  26101. var rclass = /[\t\r\n\f]/g;
  26102. function getClass( elem ) {
  26103. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  26104. }
  26105. jQuery.fn.extend( {
  26106. addClass: function( value ) {
  26107. var classes, elem, cur, curValue, clazz, j, finalValue,
  26108. i = 0;
  26109. if ( jQuery.isFunction( value ) ) {
  26110. return this.each( function( j ) {
  26111. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  26112. } );
  26113. }
  26114. if ( typeof value === "string" && value ) {
  26115. classes = value.match( rnotwhite ) || [];
  26116. while ( ( elem = this[ i++ ] ) ) {
  26117. curValue = getClass( elem );
  26118. cur = elem.nodeType === 1 &&
  26119. ( " " + curValue + " " ).replace( rclass, " " );
  26120. if ( cur ) {
  26121. j = 0;
  26122. while ( ( clazz = classes[ j++ ] ) ) {
  26123. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  26124. cur += clazz + " ";
  26125. }
  26126. }
  26127. // Only assign if different to avoid unneeded rendering.
  26128. finalValue = jQuery.trim( cur );
  26129. if ( curValue !== finalValue ) {
  26130. elem.setAttribute( "class", finalValue );
  26131. }
  26132. }
  26133. }
  26134. }
  26135. return this;
  26136. },
  26137. removeClass: function( value ) {
  26138. var classes, elem, cur, curValue, clazz, j, finalValue,
  26139. i = 0;
  26140. if ( jQuery.isFunction( value ) ) {
  26141. return this.each( function( j ) {
  26142. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  26143. } );
  26144. }
  26145. if ( !arguments.length ) {
  26146. return this.attr( "class", "" );
  26147. }
  26148. if ( typeof value === "string" && value ) {
  26149. classes = value.match( rnotwhite ) || [];
  26150. while ( ( elem = this[ i++ ] ) ) {
  26151. curValue = getClass( elem );
  26152. // This expression is here for better compressibility (see addClass)
  26153. cur = elem.nodeType === 1 &&
  26154. ( " " + curValue + " " ).replace( rclass, " " );
  26155. if ( cur ) {
  26156. j = 0;
  26157. while ( ( clazz = classes[ j++ ] ) ) {
  26158. // Remove *all* instances
  26159. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  26160. cur = cur.replace( " " + clazz + " ", " " );
  26161. }
  26162. }
  26163. // Only assign if different to avoid unneeded rendering.
  26164. finalValue = jQuery.trim( cur );
  26165. if ( curValue !== finalValue ) {
  26166. elem.setAttribute( "class", finalValue );
  26167. }
  26168. }
  26169. }
  26170. }
  26171. return this;
  26172. },
  26173. toggleClass: function( value, stateVal ) {
  26174. var type = typeof value;
  26175. if ( typeof stateVal === "boolean" && type === "string" ) {
  26176. return stateVal ? this.addClass( value ) : this.removeClass( value );
  26177. }
  26178. if ( jQuery.isFunction( value ) ) {
  26179. return this.each( function( i ) {
  26180. jQuery( this ).toggleClass(
  26181. value.call( this, i, getClass( this ), stateVal ),
  26182. stateVal
  26183. );
  26184. } );
  26185. }
  26186. return this.each( function() {
  26187. var className, i, self, classNames;
  26188. if ( type === "string" ) {
  26189. // Toggle individual class names
  26190. i = 0;
  26191. self = jQuery( this );
  26192. classNames = value.match( rnotwhite ) || [];
  26193. while ( ( className = classNames[ i++ ] ) ) {
  26194. // Check each className given, space separated list
  26195. if ( self.hasClass( className ) ) {
  26196. self.removeClass( className );
  26197. } else {
  26198. self.addClass( className );
  26199. }
  26200. }
  26201. // Toggle whole class name
  26202. } else if ( value === undefined || type === "boolean" ) {
  26203. className = getClass( this );
  26204. if ( className ) {
  26205. // Store className if set
  26206. dataPriv.set( this, "__className__", className );
  26207. }
  26208. // If the element has a class name or if we're passed `false`,
  26209. // then remove the whole classname (if there was one, the above saved it).
  26210. // Otherwise bring back whatever was previously saved (if anything),
  26211. // falling back to the empty string if nothing was stored.
  26212. if ( this.setAttribute ) {
  26213. this.setAttribute( "class",
  26214. className || value === false ?
  26215. "" :
  26216. dataPriv.get( this, "__className__" ) || ""
  26217. );
  26218. }
  26219. }
  26220. } );
  26221. },
  26222. hasClass: function( selector ) {
  26223. var className, elem,
  26224. i = 0;
  26225. className = " " + selector + " ";
  26226. while ( ( elem = this[ i++ ] ) ) {
  26227. if ( elem.nodeType === 1 &&
  26228. ( " " + getClass( elem ) + " " ).replace( rclass, " " )
  26229. .indexOf( className ) > -1
  26230. ) {
  26231. return true;
  26232. }
  26233. }
  26234. return false;
  26235. }
  26236. } );
  26237. var rreturn = /\r/g,
  26238. rspaces = /[\x20\t\r\n\f]+/g;
  26239. jQuery.fn.extend( {
  26240. val: function( value ) {
  26241. var hooks, ret, isFunction,
  26242. elem = this[ 0 ];
  26243. if ( !arguments.length ) {
  26244. if ( elem ) {
  26245. hooks = jQuery.valHooks[ elem.type ] ||
  26246. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  26247. if ( hooks &&
  26248. "get" in hooks &&
  26249. ( ret = hooks.get( elem, "value" ) ) !== undefined
  26250. ) {
  26251. return ret;
  26252. }
  26253. ret = elem.value;
  26254. return typeof ret === "string" ?
  26255. // Handle most common string cases
  26256. ret.replace( rreturn, "" ) :
  26257. // Handle cases where value is null/undef or number
  26258. ret == null ? "" : ret;
  26259. }
  26260. return;
  26261. }
  26262. isFunction = jQuery.isFunction( value );
  26263. return this.each( function( i ) {
  26264. var val;
  26265. if ( this.nodeType !== 1 ) {
  26266. return;
  26267. }
  26268. if ( isFunction ) {
  26269. val = value.call( this, i, jQuery( this ).val() );
  26270. } else {
  26271. val = value;
  26272. }
  26273. // Treat null/undefined as ""; convert numbers to string
  26274. if ( val == null ) {
  26275. val = "";
  26276. } else if ( typeof val === "number" ) {
  26277. val += "";
  26278. } else if ( jQuery.isArray( val ) ) {
  26279. val = jQuery.map( val, function( value ) {
  26280. return value == null ? "" : value + "";
  26281. } );
  26282. }
  26283. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  26284. // If set returns undefined, fall back to normal setting
  26285. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  26286. this.value = val;
  26287. }
  26288. } );
  26289. }
  26290. } );
  26291. jQuery.extend( {
  26292. valHooks: {
  26293. option: {
  26294. get: function( elem ) {
  26295. var val = jQuery.find.attr( elem, "value" );
  26296. return val != null ?
  26297. val :
  26298. // Support: IE10-11+
  26299. // option.text throws exceptions (#14686, #14858)
  26300. // Strip and collapse whitespace
  26301. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  26302. jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
  26303. }
  26304. },
  26305. select: {
  26306. get: function( elem ) {
  26307. var value, option,
  26308. options = elem.options,
  26309. index = elem.selectedIndex,
  26310. one = elem.type === "select-one" || index < 0,
  26311. values = one ? null : [],
  26312. max = one ? index + 1 : options.length,
  26313. i = index < 0 ?
  26314. max :
  26315. one ? index : 0;
  26316. // Loop through all the selected options
  26317. for ( ; i < max; i++ ) {
  26318. option = options[ i ];
  26319. // IE8-9 doesn't update selected after form reset (#2551)
  26320. if ( ( option.selected || i === index ) &&
  26321. // Don't return options that are disabled or in a disabled optgroup
  26322. ( support.optDisabled ?
  26323. !option.disabled : option.getAttribute( "disabled" ) === null ) &&
  26324. ( !option.parentNode.disabled ||
  26325. !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
  26326. // Get the specific value for the option
  26327. value = jQuery( option ).val();
  26328. // We don't need an array for one selects
  26329. if ( one ) {
  26330. return value;
  26331. }
  26332. // Multi-Selects return an array
  26333. values.push( value );
  26334. }
  26335. }
  26336. return values;
  26337. },
  26338. set: function( elem, value ) {
  26339. var optionSet, option,
  26340. options = elem.options,
  26341. values = jQuery.makeArray( value ),
  26342. i = options.length;
  26343. while ( i-- ) {
  26344. option = options[ i ];
  26345. if ( option.selected =
  26346. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  26347. ) {
  26348. optionSet = true;
  26349. }
  26350. }
  26351. // Force browsers to behave consistently when non-matching value is set
  26352. if ( !optionSet ) {
  26353. elem.selectedIndex = -1;
  26354. }
  26355. return values;
  26356. }
  26357. }
  26358. }
  26359. } );
  26360. // Radios and checkboxes getter/setter
  26361. jQuery.each( [ "radio", "checkbox" ], function() {
  26362. jQuery.valHooks[ this ] = {
  26363. set: function( elem, value ) {
  26364. if ( jQuery.isArray( value ) ) {
  26365. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  26366. }
  26367. }
  26368. };
  26369. if ( !support.checkOn ) {
  26370. jQuery.valHooks[ this ].get = function( elem ) {
  26371. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  26372. };
  26373. }
  26374. } );
  26375. // Return jQuery for attributes-only inclusion
  26376. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
  26377. jQuery.extend( jQuery.event, {
  26378. trigger: function( event, data, elem, onlyHandlers ) {
  26379. var i, cur, tmp, bubbleType, ontype, handle, special,
  26380. eventPath = [ elem || document ],
  26381. type = hasOwn.call( event, "type" ) ? event.type : event,
  26382. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  26383. cur = tmp = elem = elem || document;
  26384. // Don't do events on text and comment nodes
  26385. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  26386. return;
  26387. }
  26388. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  26389. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  26390. return;
  26391. }
  26392. if ( type.indexOf( "." ) > -1 ) {
  26393. // Namespaced trigger; create a regexp to match event type in handle()
  26394. namespaces = type.split( "." );
  26395. type = namespaces.shift();
  26396. namespaces.sort();
  26397. }
  26398. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  26399. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  26400. event = event[ jQuery.expando ] ?
  26401. event :
  26402. new jQuery.Event( type, typeof event === "object" && event );
  26403. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  26404. event.isTrigger = onlyHandlers ? 2 : 3;
  26405. event.namespace = namespaces.join( "." );
  26406. event.rnamespace = event.namespace ?
  26407. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  26408. null;
  26409. // Clean up the event in case it is being reused
  26410. event.result = undefined;
  26411. if ( !event.target ) {
  26412. event.target = elem;
  26413. }
  26414. // Clone any incoming data and prepend the event, creating the handler arg list
  26415. data = data == null ?
  26416. [ event ] :
  26417. jQuery.makeArray( data, [ event ] );
  26418. // Allow special events to draw outside the lines
  26419. special = jQuery.event.special[ type ] || {};
  26420. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  26421. return;
  26422. }
  26423. // Determine event propagation path in advance, per W3C events spec (#9951)
  26424. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  26425. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  26426. bubbleType = special.delegateType || type;
  26427. if ( !rfocusMorph.test( bubbleType + type ) ) {
  26428. cur = cur.parentNode;
  26429. }
  26430. for ( ; cur; cur = cur.parentNode ) {
  26431. eventPath.push( cur );
  26432. tmp = cur;
  26433. }
  26434. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  26435. if ( tmp === ( elem.ownerDocument || document ) ) {
  26436. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  26437. }
  26438. }
  26439. // Fire handlers on the event path
  26440. i = 0;
  26441. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  26442. event.type = i > 1 ?
  26443. bubbleType :
  26444. special.bindType || type;
  26445. // jQuery handler
  26446. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  26447. dataPriv.get( cur, "handle" );
  26448. if ( handle ) {
  26449. handle.apply( cur, data );
  26450. }
  26451. // Native handler
  26452. handle = ontype && cur[ ontype ];
  26453. if ( handle && handle.apply && acceptData( cur ) ) {
  26454. event.result = handle.apply( cur, data );
  26455. if ( event.result === false ) {
  26456. event.preventDefault();
  26457. }
  26458. }
  26459. }
  26460. event.type = type;
  26461. // If nobody prevented the default action, do it now
  26462. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  26463. if ( ( !special._default ||
  26464. special._default.apply( eventPath.pop(), data ) === false ) &&
  26465. acceptData( elem ) ) {
  26466. // Call a native DOM method on the target with the same name name as the event.
  26467. // Don't do default actions on window, that's where global variables be (#6170)
  26468. if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
  26469. // Don't re-trigger an onFOO event when we call its FOO() method
  26470. tmp = elem[ ontype ];
  26471. if ( tmp ) {
  26472. elem[ ontype ] = null;
  26473. }
  26474. // Prevent re-triggering of the same event, since we already bubbled it above
  26475. jQuery.event.triggered = type;
  26476. elem[ type ]();
  26477. jQuery.event.triggered = undefined;
  26478. if ( tmp ) {
  26479. elem[ ontype ] = tmp;
  26480. }
  26481. }
  26482. }
  26483. }
  26484. return event.result;
  26485. },
  26486. // Piggyback on a donor event to simulate a different one
  26487. // Used only for `focus(in | out)` events
  26488. simulate: function( type, elem, event ) {
  26489. var e = jQuery.extend(
  26490. new jQuery.Event(),
  26491. event,
  26492. {
  26493. type: type,
  26494. isSimulated: true
  26495. }
  26496. );
  26497. jQuery.event.trigger( e, null, elem );
  26498. }
  26499. } );
  26500. jQuery.fn.extend( {
  26501. trigger: function( type, data ) {
  26502. return this.each( function() {
  26503. jQuery.event.trigger( type, data, this );
  26504. } );
  26505. },
  26506. triggerHandler: function( type, data ) {
  26507. var elem = this[ 0 ];
  26508. if ( elem ) {
  26509. return jQuery.event.trigger( type, data, elem, true );
  26510. }
  26511. }
  26512. } );
  26513. jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
  26514. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  26515. "change select submit keydown keypress keyup error contextmenu" ).split( " " ),
  26516. function( i, name ) {
  26517. // Handle event binding
  26518. jQuery.fn[ name ] = function( data, fn ) {
  26519. return arguments.length > 0 ?
  26520. this.on( name, null, data, fn ) :
  26521. this.trigger( name );
  26522. };
  26523. } );
  26524. jQuery.fn.extend( {
  26525. hover: function( fnOver, fnOut ) {
  26526. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  26527. }
  26528. } );
  26529. support.focusin = "onfocusin" in window;
  26530. // Support: Firefox
  26531. // Firefox doesn't have focus(in | out) events
  26532. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  26533. //
  26534. // Support: Chrome, Safari
  26535. // focus(in | out) events fire after focus & blur events,
  26536. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  26537. // Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
  26538. if ( !support.focusin ) {
  26539. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  26540. // Attach a single capturing handler on the document while someone wants focusin/focusout
  26541. var handler = function( event ) {
  26542. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  26543. };
  26544. jQuery.event.special[ fix ] = {
  26545. setup: function() {
  26546. var doc = this.ownerDocument || this,
  26547. attaches = dataPriv.access( doc, fix );
  26548. if ( !attaches ) {
  26549. doc.addEventListener( orig, handler, true );
  26550. }
  26551. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  26552. },
  26553. teardown: function() {
  26554. var doc = this.ownerDocument || this,
  26555. attaches = dataPriv.access( doc, fix ) - 1;
  26556. if ( !attaches ) {
  26557. doc.removeEventListener( orig, handler, true );
  26558. dataPriv.remove( doc, fix );
  26559. } else {
  26560. dataPriv.access( doc, fix, attaches );
  26561. }
  26562. }
  26563. };
  26564. } );
  26565. }
  26566. var location = window.location;
  26567. var nonce = jQuery.now();
  26568. var rquery = ( /\?/ );
  26569. // Support: Android 2.3
  26570. // Workaround failure to string-cast null input
  26571. jQuery.parseJSON = function( data ) {
  26572. return JSON.parse( data + "" );
  26573. };
  26574. // Cross-browser xml parsing
  26575. jQuery.parseXML = function( data ) {
  26576. var xml;
  26577. if ( !data || typeof data !== "string" ) {
  26578. return null;
  26579. }
  26580. // Support: IE9
  26581. try {
  26582. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  26583. } catch ( e ) {
  26584. xml = undefined;
  26585. }
  26586. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  26587. jQuery.error( "Invalid XML: " + data );
  26588. }
  26589. return xml;
  26590. };
  26591. var
  26592. rhash = /#.*$/,
  26593. rts = /([?&])_=[^&]*/,
  26594. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  26595. // #7653, #8125, #8152: local protocol detection
  26596. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  26597. rnoContent = /^(?:GET|HEAD)$/,
  26598. rprotocol = /^\/\//,
  26599. /* Prefilters
  26600. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  26601. * 2) These are called:
  26602. * - BEFORE asking for a transport
  26603. * - AFTER param serialization (s.data is a string if s.processData is true)
  26604. * 3) key is the dataType
  26605. * 4) the catchall symbol "*" can be used
  26606. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  26607. */
  26608. prefilters = {},
  26609. /* Transports bindings
  26610. * 1) key is the dataType
  26611. * 2) the catchall symbol "*" can be used
  26612. * 3) selection will start with transport dataType and THEN go to "*" if needed
  26613. */
  26614. transports = {},
  26615. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  26616. allTypes = "*/".concat( "*" ),
  26617. // Anchor tag for parsing the document origin
  26618. originAnchor = document.createElement( "a" );
  26619. originAnchor.href = location.href;
  26620. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  26621. function addToPrefiltersOrTransports( structure ) {
  26622. // dataTypeExpression is optional and defaults to "*"
  26623. return function( dataTypeExpression, func ) {
  26624. if ( typeof dataTypeExpression !== "string" ) {
  26625. func = dataTypeExpression;
  26626. dataTypeExpression = "*";
  26627. }
  26628. var dataType,
  26629. i = 0,
  26630. dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
  26631. if ( jQuery.isFunction( func ) ) {
  26632. // For each dataType in the dataTypeExpression
  26633. while ( ( dataType = dataTypes[ i++ ] ) ) {
  26634. // Prepend if requested
  26635. if ( dataType[ 0 ] === "+" ) {
  26636. dataType = dataType.slice( 1 ) || "*";
  26637. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  26638. // Otherwise append
  26639. } else {
  26640. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  26641. }
  26642. }
  26643. }
  26644. };
  26645. }
  26646. // Base inspection function for prefilters and transports
  26647. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  26648. var inspected = {},
  26649. seekingTransport = ( structure === transports );
  26650. function inspect( dataType ) {
  26651. var selected;
  26652. inspected[ dataType ] = true;
  26653. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  26654. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  26655. if ( typeof dataTypeOrTransport === "string" &&
  26656. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  26657. options.dataTypes.unshift( dataTypeOrTransport );
  26658. inspect( dataTypeOrTransport );
  26659. return false;
  26660. } else if ( seekingTransport ) {
  26661. return !( selected = dataTypeOrTransport );
  26662. }
  26663. } );
  26664. return selected;
  26665. }
  26666. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  26667. }
  26668. // A special extend for ajax options
  26669. // that takes "flat" options (not to be deep extended)
  26670. // Fixes #9887
  26671. function ajaxExtend( target, src ) {
  26672. var key, deep,
  26673. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  26674. for ( key in src ) {
  26675. if ( src[ key ] !== undefined ) {
  26676. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  26677. }
  26678. }
  26679. if ( deep ) {
  26680. jQuery.extend( true, target, deep );
  26681. }
  26682. return target;
  26683. }
  26684. /* Handles responses to an ajax request:
  26685. * - finds the right dataType (mediates between content-type and expected dataType)
  26686. * - returns the corresponding response
  26687. */
  26688. function ajaxHandleResponses( s, jqXHR, responses ) {
  26689. var ct, type, finalDataType, firstDataType,
  26690. contents = s.contents,
  26691. dataTypes = s.dataTypes;
  26692. // Remove auto dataType and get content-type in the process
  26693. while ( dataTypes[ 0 ] === "*" ) {
  26694. dataTypes.shift();
  26695. if ( ct === undefined ) {
  26696. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  26697. }
  26698. }
  26699. // Check if we're dealing with a known content-type
  26700. if ( ct ) {
  26701. for ( type in contents ) {
  26702. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  26703. dataTypes.unshift( type );
  26704. break;
  26705. }
  26706. }
  26707. }
  26708. // Check to see if we have a response for the expected dataType
  26709. if ( dataTypes[ 0 ] in responses ) {
  26710. finalDataType = dataTypes[ 0 ];
  26711. } else {
  26712. // Try convertible dataTypes
  26713. for ( type in responses ) {
  26714. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  26715. finalDataType = type;
  26716. break;
  26717. }
  26718. if ( !firstDataType ) {
  26719. firstDataType = type;
  26720. }
  26721. }
  26722. // Or just use first one
  26723. finalDataType = finalDataType || firstDataType;
  26724. }
  26725. // If we found a dataType
  26726. // We add the dataType to the list if needed
  26727. // and return the corresponding response
  26728. if ( finalDataType ) {
  26729. if ( finalDataType !== dataTypes[ 0 ] ) {
  26730. dataTypes.unshift( finalDataType );
  26731. }
  26732. return responses[ finalDataType ];
  26733. }
  26734. }
  26735. /* Chain conversions given the request and the original response
  26736. * Also sets the responseXXX fields on the jqXHR instance
  26737. */
  26738. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  26739. var conv2, current, conv, tmp, prev,
  26740. converters = {},
  26741. // Work with a copy of dataTypes in case we need to modify it for conversion
  26742. dataTypes = s.dataTypes.slice();
  26743. // Create converters map with lowercased keys
  26744. if ( dataTypes[ 1 ] ) {
  26745. for ( conv in s.converters ) {
  26746. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  26747. }
  26748. }
  26749. current = dataTypes.shift();
  26750. // Convert to each sequential dataType
  26751. while ( current ) {
  26752. if ( s.responseFields[ current ] ) {
  26753. jqXHR[ s.responseFields[ current ] ] = response;
  26754. }
  26755. // Apply the dataFilter if provided
  26756. if ( !prev && isSuccess && s.dataFilter ) {
  26757. response = s.dataFilter( response, s.dataType );
  26758. }
  26759. prev = current;
  26760. current = dataTypes.shift();
  26761. if ( current ) {
  26762. // There's only work to do if current dataType is non-auto
  26763. if ( current === "*" ) {
  26764. current = prev;
  26765. // Convert response if prev dataType is non-auto and differs from current
  26766. } else if ( prev !== "*" && prev !== current ) {
  26767. // Seek a direct converter
  26768. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  26769. // If none found, seek a pair
  26770. if ( !conv ) {
  26771. for ( conv2 in converters ) {
  26772. // If conv2 outputs current
  26773. tmp = conv2.split( " " );
  26774. if ( tmp[ 1 ] === current ) {
  26775. // If prev can be converted to accepted input
  26776. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  26777. converters[ "* " + tmp[ 0 ] ];
  26778. if ( conv ) {
  26779. // Condense equivalence converters
  26780. if ( conv === true ) {
  26781. conv = converters[ conv2 ];
  26782. // Otherwise, insert the intermediate dataType
  26783. } else if ( converters[ conv2 ] !== true ) {
  26784. current = tmp[ 0 ];
  26785. dataTypes.unshift( tmp[ 1 ] );
  26786. }
  26787. break;
  26788. }
  26789. }
  26790. }
  26791. }
  26792. // Apply converter (if not an equivalence)
  26793. if ( conv !== true ) {
  26794. // Unless errors are allowed to bubble, catch and return them
  26795. if ( conv && s.throws ) {
  26796. response = conv( response );
  26797. } else {
  26798. try {
  26799. response = conv( response );
  26800. } catch ( e ) {
  26801. return {
  26802. state: "parsererror",
  26803. error: conv ? e : "No conversion from " + prev + " to " + current
  26804. };
  26805. }
  26806. }
  26807. }
  26808. }
  26809. }
  26810. }
  26811. return { state: "success", data: response };
  26812. }
  26813. jQuery.extend( {
  26814. // Counter for holding the number of active queries
  26815. active: 0,
  26816. // Last-Modified header cache for next request
  26817. lastModified: {},
  26818. etag: {},
  26819. ajaxSettings: {
  26820. url: location.href,
  26821. type: "GET",
  26822. isLocal: rlocalProtocol.test( location.protocol ),
  26823. global: true,
  26824. processData: true,
  26825. async: true,
  26826. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  26827. /*
  26828. timeout: 0,
  26829. data: null,
  26830. dataType: null,
  26831. username: null,
  26832. password: null,
  26833. cache: null,
  26834. throws: false,
  26835. traditional: false,
  26836. headers: {},
  26837. */
  26838. accepts: {
  26839. "*": allTypes,
  26840. text: "text/plain",
  26841. html: "text/html",
  26842. xml: "application/xml, text/xml",
  26843. json: "application/json, text/javascript"
  26844. },
  26845. contents: {
  26846. xml: /\bxml\b/,
  26847. html: /\bhtml/,
  26848. json: /\bjson\b/
  26849. },
  26850. responseFields: {
  26851. xml: "responseXML",
  26852. text: "responseText",
  26853. json: "responseJSON"
  26854. },
  26855. // Data converters
  26856. // Keys separate source (or catchall "*") and destination types with a single space
  26857. converters: {
  26858. // Convert anything to text
  26859. "* text": String,
  26860. // Text to html (true = no transformation)
  26861. "text html": true,
  26862. // Evaluate text as a json expression
  26863. "text json": jQuery.parseJSON,
  26864. // Parse text as xml
  26865. "text xml": jQuery.parseXML
  26866. },
  26867. // For options that shouldn't be deep extended:
  26868. // you can add your own custom options here if
  26869. // and when you create one that shouldn't be
  26870. // deep extended (see ajaxExtend)
  26871. flatOptions: {
  26872. url: true,
  26873. context: true
  26874. }
  26875. },
  26876. // Creates a full fledged settings object into target
  26877. // with both ajaxSettings and settings fields.
  26878. // If target is omitted, writes into ajaxSettings.
  26879. ajaxSetup: function( target, settings ) {
  26880. return settings ?
  26881. // Building a settings object
  26882. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  26883. // Extending ajaxSettings
  26884. ajaxExtend( jQuery.ajaxSettings, target );
  26885. },
  26886. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  26887. ajaxTransport: addToPrefiltersOrTransports( transports ),
  26888. // Main method
  26889. ajax: function( url, options ) {
  26890. // If url is an object, simulate pre-1.5 signature
  26891. if ( typeof url === "object" ) {
  26892. options = url;
  26893. url = undefined;
  26894. }
  26895. // Force options to be an object
  26896. options = options || {};
  26897. var transport,
  26898. // URL without anti-cache param
  26899. cacheURL,
  26900. // Response headers
  26901. responseHeadersString,
  26902. responseHeaders,
  26903. // timeout handle
  26904. timeoutTimer,
  26905. // Url cleanup var
  26906. urlAnchor,
  26907. // To know if global events are to be dispatched
  26908. fireGlobals,
  26909. // Loop variable
  26910. i,
  26911. // Create the final options object
  26912. s = jQuery.ajaxSetup( {}, options ),
  26913. // Callbacks context
  26914. callbackContext = s.context || s,
  26915. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  26916. globalEventContext = s.context &&
  26917. ( callbackContext.nodeType || callbackContext.jquery ) ?
  26918. jQuery( callbackContext ) :
  26919. jQuery.event,
  26920. // Deferreds
  26921. deferred = jQuery.Deferred(),
  26922. completeDeferred = jQuery.Callbacks( "once memory" ),
  26923. // Status-dependent callbacks
  26924. statusCode = s.statusCode || {},
  26925. // Headers (they are sent all at once)
  26926. requestHeaders = {},
  26927. requestHeadersNames = {},
  26928. // The jqXHR state
  26929. state = 0,
  26930. // Default abort message
  26931. strAbort = "canceled",
  26932. // Fake xhr
  26933. jqXHR = {
  26934. readyState: 0,
  26935. // Builds headers hashtable if needed
  26936. getResponseHeader: function( key ) {
  26937. var match;
  26938. if ( state === 2 ) {
  26939. if ( !responseHeaders ) {
  26940. responseHeaders = {};
  26941. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  26942. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  26943. }
  26944. }
  26945. match = responseHeaders[ key.toLowerCase() ];
  26946. }
  26947. return match == null ? null : match;
  26948. },
  26949. // Raw string
  26950. getAllResponseHeaders: function() {
  26951. return state === 2 ? responseHeadersString : null;
  26952. },
  26953. // Caches the header
  26954. setRequestHeader: function( name, value ) {
  26955. var lname = name.toLowerCase();
  26956. if ( !state ) {
  26957. name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
  26958. requestHeaders[ name ] = value;
  26959. }
  26960. return this;
  26961. },
  26962. // Overrides response content-type header
  26963. overrideMimeType: function( type ) {
  26964. if ( !state ) {
  26965. s.mimeType = type;
  26966. }
  26967. return this;
  26968. },
  26969. // Status-dependent callbacks
  26970. statusCode: function( map ) {
  26971. var code;
  26972. if ( map ) {
  26973. if ( state < 2 ) {
  26974. for ( code in map ) {
  26975. // Lazy-add the new callback in a way that preserves old ones
  26976. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  26977. }
  26978. } else {
  26979. // Execute the appropriate callbacks
  26980. jqXHR.always( map[ jqXHR.status ] );
  26981. }
  26982. }
  26983. return this;
  26984. },
  26985. // Cancel the request
  26986. abort: function( statusText ) {
  26987. var finalText = statusText || strAbort;
  26988. if ( transport ) {
  26989. transport.abort( finalText );
  26990. }
  26991. done( 0, finalText );
  26992. return this;
  26993. }
  26994. };
  26995. // Attach deferreds
  26996. deferred.promise( jqXHR ).complete = completeDeferred.add;
  26997. jqXHR.success = jqXHR.done;
  26998. jqXHR.error = jqXHR.fail;
  26999. // Remove hash character (#7531: and string promotion)
  27000. // Add protocol if not provided (prefilters might expect it)
  27001. // Handle falsy url in the settings object (#10093: consistency with old signature)
  27002. // We also use the url parameter if available
  27003. s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" )
  27004. .replace( rprotocol, location.protocol + "//" );
  27005. // Alias method option to type as per ticket #12004
  27006. s.type = options.method || options.type || s.method || s.type;
  27007. // Extract dataTypes list
  27008. s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
  27009. // A cross-domain request is in order when the origin doesn't match the current origin.
  27010. if ( s.crossDomain == null ) {
  27011. urlAnchor = document.createElement( "a" );
  27012. // Support: IE8-11+
  27013. // IE throws exception if url is malformed, e.g. http://example.com:80x/
  27014. try {
  27015. urlAnchor.href = s.url;
  27016. // Support: IE8-11+
  27017. // Anchor's host property isn't correctly set when s.url is relative
  27018. urlAnchor.href = urlAnchor.href;
  27019. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  27020. urlAnchor.protocol + "//" + urlAnchor.host;
  27021. } catch ( e ) {
  27022. // If there is an error parsing the URL, assume it is crossDomain,
  27023. // it can be rejected by the transport if it is invalid
  27024. s.crossDomain = true;
  27025. }
  27026. }
  27027. // Convert data if not already a string
  27028. if ( s.data && s.processData && typeof s.data !== "string" ) {
  27029. s.data = jQuery.param( s.data, s.traditional );
  27030. }
  27031. // Apply prefilters
  27032. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  27033. // If request was aborted inside a prefilter, stop there
  27034. if ( state === 2 ) {
  27035. return jqXHR;
  27036. }
  27037. // We can fire global events as of now if asked to
  27038. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  27039. fireGlobals = jQuery.event && s.global;
  27040. // Watch for a new set of requests
  27041. if ( fireGlobals && jQuery.active++ === 0 ) {
  27042. jQuery.event.trigger( "ajaxStart" );
  27043. }
  27044. // Uppercase the type
  27045. s.type = s.type.toUpperCase();
  27046. // Determine if request has content
  27047. s.hasContent = !rnoContent.test( s.type );
  27048. // Save the URL in case we're toying with the If-Modified-Since
  27049. // and/or If-None-Match header later on
  27050. cacheURL = s.url;
  27051. // More options handling for requests with no content
  27052. if ( !s.hasContent ) {
  27053. // If data is available, append data to url
  27054. if ( s.data ) {
  27055. cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
  27056. // #9682: remove data so that it's not used in an eventual retry
  27057. delete s.data;
  27058. }
  27059. // Add anti-cache in url if needed
  27060. if ( s.cache === false ) {
  27061. s.url = rts.test( cacheURL ) ?
  27062. // If there is already a '_' parameter, set its value
  27063. cacheURL.replace( rts, "$1_=" + nonce++ ) :
  27064. // Otherwise add one to the end
  27065. cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
  27066. }
  27067. }
  27068. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  27069. if ( s.ifModified ) {
  27070. if ( jQuery.lastModified[ cacheURL ] ) {
  27071. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  27072. }
  27073. if ( jQuery.etag[ cacheURL ] ) {
  27074. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  27075. }
  27076. }
  27077. // Set the correct header, if data is being sent
  27078. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  27079. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  27080. }
  27081. // Set the Accepts header for the server, depending on the dataType
  27082. jqXHR.setRequestHeader(
  27083. "Accept",
  27084. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  27085. s.accepts[ s.dataTypes[ 0 ] ] +
  27086. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  27087. s.accepts[ "*" ]
  27088. );
  27089. // Check for headers option
  27090. for ( i in s.headers ) {
  27091. jqXHR.setRequestHeader( i, s.headers[ i ] );
  27092. }
  27093. // Allow custom headers/mimetypes and early abort
  27094. if ( s.beforeSend &&
  27095. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
  27096. // Abort if not done already and return
  27097. return jqXHR.abort();
  27098. }
  27099. // Aborting is no longer a cancellation
  27100. strAbort = "abort";
  27101. // Install callbacks on deferreds
  27102. for ( i in { success: 1, error: 1, complete: 1 } ) {
  27103. jqXHR[ i ]( s[ i ] );
  27104. }
  27105. // Get transport
  27106. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  27107. // If no transport, we auto-abort
  27108. if ( !transport ) {
  27109. done( -1, "No Transport" );
  27110. } else {
  27111. jqXHR.readyState = 1;
  27112. // Send global event
  27113. if ( fireGlobals ) {
  27114. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  27115. }
  27116. // If request was aborted inside ajaxSend, stop there
  27117. if ( state === 2 ) {
  27118. return jqXHR;
  27119. }
  27120. // Timeout
  27121. if ( s.async && s.timeout > 0 ) {
  27122. timeoutTimer = window.setTimeout( function() {
  27123. jqXHR.abort( "timeout" );
  27124. }, s.timeout );
  27125. }
  27126. try {
  27127. state = 1;
  27128. transport.send( requestHeaders, done );
  27129. } catch ( e ) {
  27130. // Propagate exception as error if not done
  27131. if ( state < 2 ) {
  27132. done( -1, e );
  27133. // Simply rethrow otherwise
  27134. } else {
  27135. throw e;
  27136. }
  27137. }
  27138. }
  27139. // Callback for when everything is done
  27140. function done( status, nativeStatusText, responses, headers ) {
  27141. var isSuccess, success, error, response, modified,
  27142. statusText = nativeStatusText;
  27143. // Called once
  27144. if ( state === 2 ) {
  27145. return;
  27146. }
  27147. // State is "done" now
  27148. state = 2;
  27149. // Clear timeout if it exists
  27150. if ( timeoutTimer ) {
  27151. window.clearTimeout( timeoutTimer );
  27152. }
  27153. // Dereference transport for early garbage collection
  27154. // (no matter how long the jqXHR object will be used)
  27155. transport = undefined;
  27156. // Cache response headers
  27157. responseHeadersString = headers || "";
  27158. // Set readyState
  27159. jqXHR.readyState = status > 0 ? 4 : 0;
  27160. // Determine if successful
  27161. isSuccess = status >= 200 && status < 300 || status === 304;
  27162. // Get response data
  27163. if ( responses ) {
  27164. response = ajaxHandleResponses( s, jqXHR, responses );
  27165. }
  27166. // Convert no matter what (that way responseXXX fields are always set)
  27167. response = ajaxConvert( s, response, jqXHR, isSuccess );
  27168. // If successful, handle type chaining
  27169. if ( isSuccess ) {
  27170. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  27171. if ( s.ifModified ) {
  27172. modified = jqXHR.getResponseHeader( "Last-Modified" );
  27173. if ( modified ) {
  27174. jQuery.lastModified[ cacheURL ] = modified;
  27175. }
  27176. modified = jqXHR.getResponseHeader( "etag" );
  27177. if ( modified ) {
  27178. jQuery.etag[ cacheURL ] = modified;
  27179. }
  27180. }
  27181. // if no content
  27182. if ( status === 204 || s.type === "HEAD" ) {
  27183. statusText = "nocontent";
  27184. // if not modified
  27185. } else if ( status === 304 ) {
  27186. statusText = "notmodified";
  27187. // If we have data, let's convert it
  27188. } else {
  27189. statusText = response.state;
  27190. success = response.data;
  27191. error = response.error;
  27192. isSuccess = !error;
  27193. }
  27194. } else {
  27195. // Extract error from statusText and normalize for non-aborts
  27196. error = statusText;
  27197. if ( status || !statusText ) {
  27198. statusText = "error";
  27199. if ( status < 0 ) {
  27200. status = 0;
  27201. }
  27202. }
  27203. }
  27204. // Set data for the fake xhr object
  27205. jqXHR.status = status;
  27206. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  27207. // Success/Error
  27208. if ( isSuccess ) {
  27209. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  27210. } else {
  27211. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  27212. }
  27213. // Status-dependent callbacks
  27214. jqXHR.statusCode( statusCode );
  27215. statusCode = undefined;
  27216. if ( fireGlobals ) {
  27217. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  27218. [ jqXHR, s, isSuccess ? success : error ] );
  27219. }
  27220. // Complete
  27221. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  27222. if ( fireGlobals ) {
  27223. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  27224. // Handle the global AJAX counter
  27225. if ( !( --jQuery.active ) ) {
  27226. jQuery.event.trigger( "ajaxStop" );
  27227. }
  27228. }
  27229. }
  27230. return jqXHR;
  27231. },
  27232. getJSON: function( url, data, callback ) {
  27233. return jQuery.get( url, data, callback, "json" );
  27234. },
  27235. getScript: function( url, callback ) {
  27236. return jQuery.get( url, undefined, callback, "script" );
  27237. }
  27238. } );
  27239. jQuery.each( [ "get", "post" ], function( i, method ) {
  27240. jQuery[ method ] = function( url, data, callback, type ) {
  27241. // Shift arguments if data argument was omitted
  27242. if ( jQuery.isFunction( data ) ) {
  27243. type = type || callback;
  27244. callback = data;
  27245. data = undefined;
  27246. }
  27247. // The url can be an options object (which then must have .url)
  27248. return jQuery.ajax( jQuery.extend( {
  27249. url: url,
  27250. type: method,
  27251. dataType: type,
  27252. data: data,
  27253. success: callback
  27254. }, jQuery.isPlainObject( url ) && url ) );
  27255. };
  27256. } );
  27257. jQuery._evalUrl = function( url ) {
  27258. return jQuery.ajax( {
  27259. url: url,
  27260. // Make this explicit, since user can override this through ajaxSetup (#11264)
  27261. type: "GET",
  27262. dataType: "script",
  27263. async: false,
  27264. global: false,
  27265. "throws": true
  27266. } );
  27267. };
  27268. jQuery.fn.extend( {
  27269. wrapAll: function( html ) {
  27270. var wrap;
  27271. if ( jQuery.isFunction( html ) ) {
  27272. return this.each( function( i ) {
  27273. jQuery( this ).wrapAll( html.call( this, i ) );
  27274. } );
  27275. }
  27276. if ( this[ 0 ] ) {
  27277. // The elements to wrap the target around
  27278. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  27279. if ( this[ 0 ].parentNode ) {
  27280. wrap.insertBefore( this[ 0 ] );
  27281. }
  27282. wrap.map( function() {
  27283. var elem = this;
  27284. while ( elem.firstElementChild ) {
  27285. elem = elem.firstElementChild;
  27286. }
  27287. return elem;
  27288. } ).append( this );
  27289. }
  27290. return this;
  27291. },
  27292. wrapInner: function( html ) {
  27293. if ( jQuery.isFunction( html ) ) {
  27294. return this.each( function( i ) {
  27295. jQuery( this ).wrapInner( html.call( this, i ) );
  27296. } );
  27297. }
  27298. return this.each( function() {
  27299. var self = jQuery( this ),
  27300. contents = self.contents();
  27301. if ( contents.length ) {
  27302. contents.wrapAll( html );
  27303. } else {
  27304. self.append( html );
  27305. }
  27306. } );
  27307. },
  27308. wrap: function( html ) {
  27309. var isFunction = jQuery.isFunction( html );
  27310. return this.each( function( i ) {
  27311. jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
  27312. } );
  27313. },
  27314. unwrap: function() {
  27315. return this.parent().each( function() {
  27316. if ( !jQuery.nodeName( this, "body" ) ) {
  27317. jQuery( this ).replaceWith( this.childNodes );
  27318. }
  27319. } ).end();
  27320. }
  27321. } );
  27322. jQuery.expr.filters.hidden = function( elem ) {
  27323. return !jQuery.expr.filters.visible( elem );
  27324. };
  27325. jQuery.expr.filters.visible = function( elem ) {
  27326. // Support: Opera <= 12.12
  27327. // Opera reports offsetWidths and offsetHeights less than zero on some elements
  27328. // Use OR instead of AND as the element is not visible if either is true
  27329. // See tickets #10406 and #13132
  27330. return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0;
  27331. };
  27332. var r20 = /%20/g,
  27333. rbracket = /\[\]$/,
  27334. rCRLF = /\r?\n/g,
  27335. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  27336. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  27337. function buildParams( prefix, obj, traditional, add ) {
  27338. var name;
  27339. if ( jQuery.isArray( obj ) ) {
  27340. // Serialize array item.
  27341. jQuery.each( obj, function( i, v ) {
  27342. if ( traditional || rbracket.test( prefix ) ) {
  27343. // Treat each array item as a scalar.
  27344. add( prefix, v );
  27345. } else {
  27346. // Item is non-scalar (array or object), encode its numeric index.
  27347. buildParams(
  27348. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  27349. v,
  27350. traditional,
  27351. add
  27352. );
  27353. }
  27354. } );
  27355. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  27356. // Serialize object item.
  27357. for ( name in obj ) {
  27358. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  27359. }
  27360. } else {
  27361. // Serialize scalar item.
  27362. add( prefix, obj );
  27363. }
  27364. }
  27365. // Serialize an array of form elements or a set of
  27366. // key/values into a query string
  27367. jQuery.param = function( a, traditional ) {
  27368. var prefix,
  27369. s = [],
  27370. add = function( key, value ) {
  27371. // If value is a function, invoke it and return its value
  27372. value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
  27373. s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
  27374. };
  27375. // Set traditional to true for jQuery <= 1.3.2 behavior.
  27376. if ( traditional === undefined ) {
  27377. traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
  27378. }
  27379. // If an array was passed in, assume that it is an array of form elements.
  27380. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  27381. // Serialize the form elements
  27382. jQuery.each( a, function() {
  27383. add( this.name, this.value );
  27384. } );
  27385. } else {
  27386. // If traditional, encode the "old" way (the way 1.3.2 or older
  27387. // did it), otherwise encode params recursively.
  27388. for ( prefix in a ) {
  27389. buildParams( prefix, a[ prefix ], traditional, add );
  27390. }
  27391. }
  27392. // Return the resulting serialization
  27393. return s.join( "&" ).replace( r20, "+" );
  27394. };
  27395. jQuery.fn.extend( {
  27396. serialize: function() {
  27397. return jQuery.param( this.serializeArray() );
  27398. },
  27399. serializeArray: function() {
  27400. return this.map( function() {
  27401. // Can add propHook for "elements" to filter or add form elements
  27402. var elements = jQuery.prop( this, "elements" );
  27403. return elements ? jQuery.makeArray( elements ) : this;
  27404. } )
  27405. .filter( function() {
  27406. var type = this.type;
  27407. // Use .is( ":disabled" ) so that fieldset[disabled] works
  27408. return this.name && !jQuery( this ).is( ":disabled" ) &&
  27409. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  27410. ( this.checked || !rcheckableType.test( type ) );
  27411. } )
  27412. .map( function( i, elem ) {
  27413. var val = jQuery( this ).val();
  27414. return val == null ?
  27415. null :
  27416. jQuery.isArray( val ) ?
  27417. jQuery.map( val, function( val ) {
  27418. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  27419. } ) :
  27420. { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  27421. } ).get();
  27422. }
  27423. } );
  27424. jQuery.ajaxSettings.xhr = function() {
  27425. try {
  27426. return new window.XMLHttpRequest();
  27427. } catch ( e ) {}
  27428. };
  27429. var xhrSuccessStatus = {
  27430. // File protocol always yields status code 0, assume 200
  27431. 0: 200,
  27432. // Support: IE9
  27433. // #1450: sometimes IE returns 1223 when it should be 204
  27434. 1223: 204
  27435. },
  27436. xhrSupported = jQuery.ajaxSettings.xhr();
  27437. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  27438. support.ajax = xhrSupported = !!xhrSupported;
  27439. jQuery.ajaxTransport( function( options ) {
  27440. var callback, errorCallback;
  27441. // Cross domain only allowed if supported through XMLHttpRequest
  27442. if ( support.cors || xhrSupported && !options.crossDomain ) {
  27443. return {
  27444. send: function( headers, complete ) {
  27445. var i,
  27446. xhr = options.xhr();
  27447. xhr.open(
  27448. options.type,
  27449. options.url,
  27450. options.async,
  27451. options.username,
  27452. options.password
  27453. );
  27454. // Apply custom fields if provided
  27455. if ( options.xhrFields ) {
  27456. for ( i in options.xhrFields ) {
  27457. xhr[ i ] = options.xhrFields[ i ];
  27458. }
  27459. }
  27460. // Override mime type if needed
  27461. if ( options.mimeType && xhr.overrideMimeType ) {
  27462. xhr.overrideMimeType( options.mimeType );
  27463. }
  27464. // X-Requested-With header
  27465. // For cross-domain requests, seeing as conditions for a preflight are
  27466. // akin to a jigsaw puzzle, we simply never set it to be sure.
  27467. // (it can always be set on a per-request basis or even using ajaxSetup)
  27468. // For same-domain requests, won't change header if already provided.
  27469. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  27470. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  27471. }
  27472. // Set headers
  27473. for ( i in headers ) {
  27474. xhr.setRequestHeader( i, headers[ i ] );
  27475. }
  27476. // Callback
  27477. callback = function( type ) {
  27478. return function() {
  27479. if ( callback ) {
  27480. callback = errorCallback = xhr.onload =
  27481. xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
  27482. if ( type === "abort" ) {
  27483. xhr.abort();
  27484. } else if ( type === "error" ) {
  27485. // Support: IE9
  27486. // On a manual native abort, IE9 throws
  27487. // errors on any property access that is not readyState
  27488. if ( typeof xhr.status !== "number" ) {
  27489. complete( 0, "error" );
  27490. } else {
  27491. complete(
  27492. // File: protocol always yields status 0; see #8605, #14207
  27493. xhr.status,
  27494. xhr.statusText
  27495. );
  27496. }
  27497. } else {
  27498. complete(
  27499. xhrSuccessStatus[ xhr.status ] || xhr.status,
  27500. xhr.statusText,
  27501. // Support: IE9 only
  27502. // IE9 has no XHR2 but throws on binary (trac-11426)
  27503. // For XHR2 non-text, let the caller handle it (gh-2498)
  27504. ( xhr.responseType || "text" ) !== "text" ||
  27505. typeof xhr.responseText !== "string" ?
  27506. { binary: xhr.response } :
  27507. { text: xhr.responseText },
  27508. xhr.getAllResponseHeaders()
  27509. );
  27510. }
  27511. }
  27512. };
  27513. };
  27514. // Listen to events
  27515. xhr.onload = callback();
  27516. errorCallback = xhr.onerror = callback( "error" );
  27517. // Support: IE9
  27518. // Use onreadystatechange to replace onabort
  27519. // to handle uncaught aborts
  27520. if ( xhr.onabort !== undefined ) {
  27521. xhr.onabort = errorCallback;
  27522. } else {
  27523. xhr.onreadystatechange = function() {
  27524. // Check readyState before timeout as it changes
  27525. if ( xhr.readyState === 4 ) {
  27526. // Allow onerror to be called first,
  27527. // but that will not handle a native abort
  27528. // Also, save errorCallback to a variable
  27529. // as xhr.onerror cannot be accessed
  27530. window.setTimeout( function() {
  27531. if ( callback ) {
  27532. errorCallback();
  27533. }
  27534. } );
  27535. }
  27536. };
  27537. }
  27538. // Create the abort callback
  27539. callback = callback( "abort" );
  27540. try {
  27541. // Do send the request (this may raise an exception)
  27542. xhr.send( options.hasContent && options.data || null );
  27543. } catch ( e ) {
  27544. // #14683: Only rethrow if this hasn't been notified as an error yet
  27545. if ( callback ) {
  27546. throw e;
  27547. }
  27548. }
  27549. },
  27550. abort: function() {
  27551. if ( callback ) {
  27552. callback();
  27553. }
  27554. }
  27555. };
  27556. }
  27557. } );
  27558. // Install script dataType
  27559. jQuery.ajaxSetup( {
  27560. accepts: {
  27561. script: "text/javascript, application/javascript, " +
  27562. "application/ecmascript, application/x-ecmascript"
  27563. },
  27564. contents: {
  27565. script: /\b(?:java|ecma)script\b/
  27566. },
  27567. converters: {
  27568. "text script": function( text ) {
  27569. jQuery.globalEval( text );
  27570. return text;
  27571. }
  27572. }
  27573. } );
  27574. // Handle cache's special case and crossDomain
  27575. jQuery.ajaxPrefilter( "script", function( s ) {
  27576. if ( s.cache === undefined ) {
  27577. s.cache = false;
  27578. }
  27579. if ( s.crossDomain ) {
  27580. s.type = "GET";
  27581. }
  27582. } );
  27583. // Bind script tag hack transport
  27584. jQuery.ajaxTransport( "script", function( s ) {
  27585. // This transport only deals with cross domain requests
  27586. if ( s.crossDomain ) {
  27587. var script, callback;
  27588. return {
  27589. send: function( _, complete ) {
  27590. script = jQuery( "<script>" ).prop( {
  27591. charset: s.scriptCharset,
  27592. src: s.url
  27593. } ).on(
  27594. "load error",
  27595. callback = function( evt ) {
  27596. script.remove();
  27597. callback = null;
  27598. if ( evt ) {
  27599. complete( evt.type === "error" ? 404 : 200, evt.type );
  27600. }
  27601. }
  27602. );
  27603. // Use native DOM manipulation to avoid our domManip AJAX trickery
  27604. document.head.appendChild( script[ 0 ] );
  27605. },
  27606. abort: function() {
  27607. if ( callback ) {
  27608. callback();
  27609. }
  27610. }
  27611. };
  27612. }
  27613. } );
  27614. var oldCallbacks = [],
  27615. rjsonp = /(=)\?(?=&|$)|\?\?/;
  27616. // Default jsonp settings
  27617. jQuery.ajaxSetup( {
  27618. jsonp: "callback",
  27619. jsonpCallback: function() {
  27620. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  27621. this[ callback ] = true;
  27622. return callback;
  27623. }
  27624. } );
  27625. // Detect, normalize options and install callbacks for jsonp requests
  27626. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  27627. var callbackName, overwritten, responseContainer,
  27628. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  27629. "url" :
  27630. typeof s.data === "string" &&
  27631. ( s.contentType || "" )
  27632. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  27633. rjsonp.test( s.data ) && "data"
  27634. );
  27635. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  27636. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  27637. // Get callback name, remembering preexisting value associated with it
  27638. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  27639. s.jsonpCallback() :
  27640. s.jsonpCallback;
  27641. // Insert callback into url or form data
  27642. if ( jsonProp ) {
  27643. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  27644. } else if ( s.jsonp !== false ) {
  27645. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  27646. }
  27647. // Use data converter to retrieve json after script execution
  27648. s.converters[ "script json" ] = function() {
  27649. if ( !responseContainer ) {
  27650. jQuery.error( callbackName + " was not called" );
  27651. }
  27652. return responseContainer[ 0 ];
  27653. };
  27654. // Force json dataType
  27655. s.dataTypes[ 0 ] = "json";
  27656. // Install callback
  27657. overwritten = window[ callbackName ];
  27658. window[ callbackName ] = function() {
  27659. responseContainer = arguments;
  27660. };
  27661. // Clean-up function (fires after converters)
  27662. jqXHR.always( function() {
  27663. // If previous value didn't exist - remove it
  27664. if ( overwritten === undefined ) {
  27665. jQuery( window ).removeProp( callbackName );
  27666. // Otherwise restore preexisting value
  27667. } else {
  27668. window[ callbackName ] = overwritten;
  27669. }
  27670. // Save back as free
  27671. if ( s[ callbackName ] ) {
  27672. // Make sure that re-using the options doesn't screw things around
  27673. s.jsonpCallback = originalSettings.jsonpCallback;
  27674. // Save the callback name for future use
  27675. oldCallbacks.push( callbackName );
  27676. }
  27677. // Call if it was a function and we have a response
  27678. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  27679. overwritten( responseContainer[ 0 ] );
  27680. }
  27681. responseContainer = overwritten = undefined;
  27682. } );
  27683. // Delegate to script
  27684. return "script";
  27685. }
  27686. } );
  27687. // Argument "data" should be string of html
  27688. // context (optional): If specified, the fragment will be created in this context,
  27689. // defaults to document
  27690. // keepScripts (optional): If true, will include scripts passed in the html string
  27691. jQuery.parseHTML = function( data, context, keepScripts ) {
  27692. if ( !data || typeof data !== "string" ) {
  27693. return null;
  27694. }
  27695. if ( typeof context === "boolean" ) {
  27696. keepScripts = context;
  27697. context = false;
  27698. }
  27699. context = context || document;
  27700. var parsed = rsingleTag.exec( data ),
  27701. scripts = !keepScripts && [];
  27702. // Single tag
  27703. if ( parsed ) {
  27704. return [ context.createElement( parsed[ 1 ] ) ];
  27705. }
  27706. parsed = buildFragment( [ data ], context, scripts );
  27707. if ( scripts && scripts.length ) {
  27708. jQuery( scripts ).remove();
  27709. }
  27710. return jQuery.merge( [], parsed.childNodes );
  27711. };
  27712. // Keep a copy of the old load method
  27713. var _load = jQuery.fn.load;
  27714. /**
  27715. * Load a url into a page
  27716. */
  27717. jQuery.fn.load = function( url, params, callback ) {
  27718. if ( typeof url !== "string" && _load ) {
  27719. return _load.apply( this, arguments );
  27720. }
  27721. var selector, type, response,
  27722. self = this,
  27723. off = url.indexOf( " " );
  27724. if ( off > -1 ) {
  27725. selector = jQuery.trim( url.slice( off ) );
  27726. url = url.slice( 0, off );
  27727. }
  27728. // If it's a function
  27729. if ( jQuery.isFunction( params ) ) {
  27730. // We assume that it's the callback
  27731. callback = params;
  27732. params = undefined;
  27733. // Otherwise, build a param string
  27734. } else if ( params && typeof params === "object" ) {
  27735. type = "POST";
  27736. }
  27737. // If we have elements to modify, make the request
  27738. if ( self.length > 0 ) {
  27739. jQuery.ajax( {
  27740. url: url,
  27741. // If "type" variable is undefined, then "GET" method will be used.
  27742. // Make value of this field explicit since
  27743. // user can override it through ajaxSetup method
  27744. type: type || "GET",
  27745. dataType: "html",
  27746. data: params
  27747. } ).done( function( responseText ) {
  27748. // Save response for use in complete callback
  27749. response = arguments;
  27750. self.html( selector ?
  27751. // If a selector was specified, locate the right elements in a dummy div
  27752. // Exclude scripts to avoid IE 'Permission Denied' errors
  27753. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  27754. // Otherwise use the full result
  27755. responseText );
  27756. // If the request succeeds, this function gets "data", "status", "jqXHR"
  27757. // but they are ignored because response was set above.
  27758. // If it fails, this function gets "jqXHR", "status", "error"
  27759. } ).always( callback && function( jqXHR, status ) {
  27760. self.each( function() {
  27761. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  27762. } );
  27763. } );
  27764. }
  27765. return this;
  27766. };
  27767. // Attach a bunch of functions for handling common AJAX events
  27768. jQuery.each( [
  27769. "ajaxStart",
  27770. "ajaxStop",
  27771. "ajaxComplete",
  27772. "ajaxError",
  27773. "ajaxSuccess",
  27774. "ajaxSend"
  27775. ], function( i, type ) {
  27776. jQuery.fn[ type ] = function( fn ) {
  27777. return this.on( type, fn );
  27778. };
  27779. } );
  27780. jQuery.expr.filters.animated = function( elem ) {
  27781. return jQuery.grep( jQuery.timers, function( fn ) {
  27782. return elem === fn.elem;
  27783. } ).length;
  27784. };
  27785. /**
  27786. * Gets a window from an element
  27787. */
  27788. function getWindow( elem ) {
  27789. return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
  27790. }
  27791. jQuery.offset = {
  27792. setOffset: function( elem, options, i ) {
  27793. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  27794. position = jQuery.css( elem, "position" ),
  27795. curElem = jQuery( elem ),
  27796. props = {};
  27797. // Set position first, in-case top/left are set even on static elem
  27798. if ( position === "static" ) {
  27799. elem.style.position = "relative";
  27800. }
  27801. curOffset = curElem.offset();
  27802. curCSSTop = jQuery.css( elem, "top" );
  27803. curCSSLeft = jQuery.css( elem, "left" );
  27804. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  27805. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  27806. // Need to be able to calculate position if either
  27807. // top or left is auto and position is either absolute or fixed
  27808. if ( calculatePosition ) {
  27809. curPosition = curElem.position();
  27810. curTop = curPosition.top;
  27811. curLeft = curPosition.left;
  27812. } else {
  27813. curTop = parseFloat( curCSSTop ) || 0;
  27814. curLeft = parseFloat( curCSSLeft ) || 0;
  27815. }
  27816. if ( jQuery.isFunction( options ) ) {
  27817. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  27818. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  27819. }
  27820. if ( options.top != null ) {
  27821. props.top = ( options.top - curOffset.top ) + curTop;
  27822. }
  27823. if ( options.left != null ) {
  27824. props.left = ( options.left - curOffset.left ) + curLeft;
  27825. }
  27826. if ( "using" in options ) {
  27827. options.using.call( elem, props );
  27828. } else {
  27829. curElem.css( props );
  27830. }
  27831. }
  27832. };
  27833. jQuery.fn.extend( {
  27834. offset: function( options ) {
  27835. if ( arguments.length ) {
  27836. return options === undefined ?
  27837. this :
  27838. this.each( function( i ) {
  27839. jQuery.offset.setOffset( this, options, i );
  27840. } );
  27841. }
  27842. var docElem, win,
  27843. elem = this[ 0 ],
  27844. box = { top: 0, left: 0 },
  27845. doc = elem && elem.ownerDocument;
  27846. if ( !doc ) {
  27847. return;
  27848. }
  27849. docElem = doc.documentElement;
  27850. // Make sure it's not a disconnected DOM node
  27851. if ( !jQuery.contains( docElem, elem ) ) {
  27852. return box;
  27853. }
  27854. box = elem.getBoundingClientRect();
  27855. win = getWindow( doc );
  27856. return {
  27857. top: box.top + win.pageYOffset - docElem.clientTop,
  27858. left: box.left + win.pageXOffset - docElem.clientLeft
  27859. };
  27860. },
  27861. position: function() {
  27862. if ( !this[ 0 ] ) {
  27863. return;
  27864. }
  27865. var offsetParent, offset,
  27866. elem = this[ 0 ],
  27867. parentOffset = { top: 0, left: 0 };
  27868. // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
  27869. // because it is its only offset parent
  27870. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  27871. // Assume getBoundingClientRect is there when computed position is fixed
  27872. offset = elem.getBoundingClientRect();
  27873. } else {
  27874. // Get *real* offsetParent
  27875. offsetParent = this.offsetParent();
  27876. // Get correct offsets
  27877. offset = this.offset();
  27878. if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
  27879. parentOffset = offsetParent.offset();
  27880. }
  27881. // Add offsetParent borders
  27882. parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
  27883. parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
  27884. }
  27885. // Subtract parent offsets and element margins
  27886. return {
  27887. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  27888. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  27889. };
  27890. },
  27891. // This method will return documentElement in the following cases:
  27892. // 1) For the element inside the iframe without offsetParent, this method will return
  27893. // documentElement of the parent window
  27894. // 2) For the hidden or detached element
  27895. // 3) For body or html element, i.e. in case of the html node - it will return itself
  27896. //
  27897. // but those exceptions were never presented as a real life use-cases
  27898. // and might be considered as more preferable results.
  27899. //
  27900. // This logic, however, is not guaranteed and can change at any point in the future
  27901. offsetParent: function() {
  27902. return this.map( function() {
  27903. var offsetParent = this.offsetParent;
  27904. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  27905. offsetParent = offsetParent.offsetParent;
  27906. }
  27907. return offsetParent || documentElement;
  27908. } );
  27909. }
  27910. } );
  27911. // Create scrollLeft and scrollTop methods
  27912. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  27913. var top = "pageYOffset" === prop;
  27914. jQuery.fn[ method ] = function( val ) {
  27915. return access( this, function( elem, method, val ) {
  27916. var win = getWindow( elem );
  27917. if ( val === undefined ) {
  27918. return win ? win[ prop ] : elem[ method ];
  27919. }
  27920. if ( win ) {
  27921. win.scrollTo(
  27922. !top ? val : win.pageXOffset,
  27923. top ? val : win.pageYOffset
  27924. );
  27925. } else {
  27926. elem[ method ] = val;
  27927. }
  27928. }, method, val, arguments.length );
  27929. };
  27930. } );
  27931. // Support: Safari<7-8+, Chrome<37-44+
  27932. // Add the top/left cssHooks using jQuery.fn.position
  27933. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  27934. // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
  27935. // getComputedStyle returns percent when specified for top/left/bottom/right;
  27936. // rather than make the css module depend on the offset module, just check for it here
  27937. jQuery.each( [ "top", "left" ], function( i, prop ) {
  27938. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  27939. function( elem, computed ) {
  27940. if ( computed ) {
  27941. computed = curCSS( elem, prop );
  27942. // If curCSS returns percentage, fallback to offset
  27943. return rnumnonpx.test( computed ) ?
  27944. jQuery( elem ).position()[ prop ] + "px" :
  27945. computed;
  27946. }
  27947. }
  27948. );
  27949. } );
  27950. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  27951. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  27952. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  27953. function( defaultExtra, funcName ) {
  27954. // Margin is only for outerHeight, outerWidth
  27955. jQuery.fn[ funcName ] = function( margin, value ) {
  27956. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  27957. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  27958. return access( this, function( elem, type, value ) {
  27959. var doc;
  27960. if ( jQuery.isWindow( elem ) ) {
  27961. // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
  27962. // isn't a whole lot we can do. See pull request at this URL for discussion:
  27963. // https://github.com/jquery/jquery/pull/764
  27964. return elem.document.documentElement[ "client" + name ];
  27965. }
  27966. // Get document width or height
  27967. if ( elem.nodeType === 9 ) {
  27968. doc = elem.documentElement;
  27969. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  27970. // whichever is greatest
  27971. return Math.max(
  27972. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  27973. elem.body[ "offset" + name ], doc[ "offset" + name ],
  27974. doc[ "client" + name ]
  27975. );
  27976. }
  27977. return value === undefined ?
  27978. // Get width or height on the element, requesting but not forcing parseFloat
  27979. jQuery.css( elem, type, extra ) :
  27980. // Set width or height on the element
  27981. jQuery.style( elem, type, value, extra );
  27982. }, type, chainable ? margin : undefined, chainable, null );
  27983. };
  27984. } );
  27985. } );
  27986. jQuery.fn.extend( {
  27987. bind: function( types, data, fn ) {
  27988. return this.on( types, null, data, fn );
  27989. },
  27990. unbind: function( types, fn ) {
  27991. return this.off( types, null, fn );
  27992. },
  27993. delegate: function( selector, types, data, fn ) {
  27994. return this.on( types, selector, data, fn );
  27995. },
  27996. undelegate: function( selector, types, fn ) {
  27997. // ( namespace ) or ( selector, types [, fn] )
  27998. return arguments.length === 1 ?
  27999. this.off( selector, "**" ) :
  28000. this.off( types, selector || "**", fn );
  28001. },
  28002. size: function() {
  28003. return this.length;
  28004. }
  28005. } );
  28006. jQuery.fn.andSelf = jQuery.fn.addBack;
  28007. // Register as a named AMD module, since jQuery can be concatenated with other
  28008. // files that may use define, but not via a proper concatenation script that
  28009. // understands anonymous AMD modules. A named AMD is safest and most robust
  28010. // way to register. Lowercase jquery is used because AMD module names are
  28011. // derived from file names, and jQuery is normally delivered in a lowercase
  28012. // file name. Do this after creating the global so that if an AMD module wants
  28013. // to call noConflict to hide this version of jQuery, it will work.
  28014. // Note that for maximum portability, libraries that are not jQuery should
  28015. // declare themselves as anonymous modules, and avoid setting a global if an
  28016. // AMD loader is present. jQuery is a special case. For more information, see
  28017. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  28018. if ( typeof define === "function" && define.amd ) {
  28019. define( "jquery", [], function() {
  28020. return jQuery;
  28021. } );
  28022. }
  28023. var
  28024. // Map over jQuery in case of overwrite
  28025. _jQuery = window.jQuery,
  28026. // Map over the $ in case of overwrite
  28027. _$ = window.$;
  28028. jQuery.noConflict = function( deep ) {
  28029. if ( window.$ === jQuery ) {
  28030. window.$ = _$;
  28031. }
  28032. if ( deep && window.jQuery === jQuery ) {
  28033. window.jQuery = _jQuery;
  28034. }
  28035. return jQuery;
  28036. };
  28037. // Expose jQuery and $ identifiers, even in AMD
  28038. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  28039. // and CommonJS for browser emulators (#13566)
  28040. if ( !noGlobal ) {
  28041. window.jQuery = window.$ = jQuery;
  28042. }
  28043. return jQuery;
  28044. }));
  28045. define('aurelia-testing/aurelia-testing',['exports', './compile-spy', './view-spy', './component-tester'], function (exports, _compileSpy, _viewSpy, _componentTester) {
  28046. 'use strict';
  28047. Object.defineProperty(exports, "__esModule", {
  28048. value: true
  28049. });
  28050. exports.configure = exports.ComponentTester = exports.StageComponent = exports.ViewSpy = exports.CompileSpy = undefined;
  28051. function configure(config) {
  28052. config.globalResources('./compile-spy', './view-spy');
  28053. }
  28054. exports.CompileSpy = _compileSpy.CompileSpy;
  28055. exports.ViewSpy = _viewSpy.ViewSpy;
  28056. exports.StageComponent = _componentTester.StageComponent;
  28057. exports.ComponentTester = _componentTester.ComponentTester;
  28058. exports.configure = configure;
  28059. });;define('aurelia-testing', ['aurelia-testing/aurelia-testing'], function (main) { return main; });
  28060. define('aurelia-testing/compile-spy',['exports', 'aurelia-templating', 'aurelia-dependency-injection', 'aurelia-logging', 'aurelia-pal'], function (exports, _aureliaTemplating, _aureliaDependencyInjection, _aureliaLogging, _aureliaPal) {
  28061. 'use strict';
  28062. Object.defineProperty(exports, "__esModule", {
  28063. value: true
  28064. });
  28065. exports.CompileSpy = undefined;
  28066. var LogManager = _interopRequireWildcard(_aureliaLogging);
  28067. function _interopRequireWildcard(obj) {
  28068. if (obj && obj.__esModule) {
  28069. return obj;
  28070. } else {
  28071. var newObj = {};
  28072. if (obj != null) {
  28073. for (var key in obj) {
  28074. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  28075. }
  28076. }
  28077. newObj.default = obj;
  28078. return newObj;
  28079. }
  28080. }
  28081. var _dec, _dec2, _class;
  28082. 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) {
  28083. LogManager.getLogger('compile-spy').info(element, instruction);
  28084. }) || _class) || _class);
  28085. });
  28086. define('aurelia-testing/view-spy',['exports', 'aurelia-templating', 'aurelia-logging'], function (exports, _aureliaTemplating, _aureliaLogging) {
  28087. 'use strict';
  28088. Object.defineProperty(exports, "__esModule", {
  28089. value: true
  28090. });
  28091. exports.ViewSpy = undefined;
  28092. var LogManager = _interopRequireWildcard(_aureliaLogging);
  28093. function _interopRequireWildcard(obj) {
  28094. if (obj && obj.__esModule) {
  28095. return obj;
  28096. } else {
  28097. var newObj = {};
  28098. if (obj != null) {
  28099. for (var key in obj) {
  28100. if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
  28101. }
  28102. }
  28103. newObj.default = obj;
  28104. return newObj;
  28105. }
  28106. }
  28107. var _dec, _class;
  28108. var ViewSpy = exports.ViewSpy = (_dec = (0, _aureliaTemplating.customAttribute)('view-spy'), _dec(_class = function () {
  28109. function ViewSpy() {
  28110. this.logger = LogManager.getLogger('view-spy');
  28111. }
  28112. ViewSpy.prototype._log = function _log(lifecycleName, context) {
  28113. if (!this.value && lifecycleName === 'created') {
  28114. this.logger.info(lifecycleName, this.view);
  28115. } else if (this.value && this.value.indexOf(lifecycleName) !== -1) {
  28116. this.logger.info(lifecycleName, this.view, context);
  28117. }
  28118. };
  28119. ViewSpy.prototype.created = function created(view) {
  28120. this.view = view;
  28121. this._log('created');
  28122. };
  28123. ViewSpy.prototype.bind = function bind(bindingContext) {
  28124. this._log('bind', bindingContext);
  28125. };
  28126. ViewSpy.prototype.attached = function attached() {
  28127. this._log('attached');
  28128. };
  28129. ViewSpy.prototype.detached = function detached() {
  28130. this._log('detached');
  28131. };
  28132. ViewSpy.prototype.unbind = function unbind() {
  28133. this._log('unbind');
  28134. };
  28135. return ViewSpy;
  28136. }()) || _class);
  28137. });
  28138. define('aurelia-testing/component-tester',['exports', 'aurelia-templating', 'aurelia-framework'], function (exports, _aureliaTemplating, _aureliaFramework) {
  28139. 'use strict';
  28140. Object.defineProperty(exports, "__esModule", {
  28141. value: true
  28142. });
  28143. exports.ComponentTester = exports.StageComponent = undefined;
  28144. var StageComponent = exports.StageComponent = {
  28145. withResources: function withResources(resources) {
  28146. return new ComponentTester().withResources(resources);
  28147. }
  28148. };
  28149. var ComponentTester = exports.ComponentTester = function () {
  28150. function ComponentTester() {
  28151. this.configure = function (aurelia) {
  28152. return aurelia.use.standardConfiguration();
  28153. };
  28154. this._resources = [];
  28155. }
  28156. ComponentTester.prototype.bootstrap = function bootstrap(configure) {
  28157. this.configure = configure;
  28158. };
  28159. ComponentTester.prototype.withResources = function withResources(resources) {
  28160. this._resources = resources;
  28161. return this;
  28162. };
  28163. ComponentTester.prototype.inView = function inView(html) {
  28164. this._html = html;
  28165. return this;
  28166. };
  28167. ComponentTester.prototype.boundTo = function boundTo(bindingContext) {
  28168. this._bindingContext = bindingContext;
  28169. return this;
  28170. };
  28171. ComponentTester.prototype.manuallyHandleLifecycle = function manuallyHandleLifecycle() {
  28172. this._prepareLifecycle();
  28173. return this;
  28174. };
  28175. ComponentTester.prototype.create = function create(bootstrap) {
  28176. var _this = this;
  28177. return bootstrap(function (aurelia) {
  28178. return Promise.resolve(_this.configure(aurelia)).then(function () {
  28179. if (_this._resources) {
  28180. aurelia.use.globalResources(_this._resources);
  28181. }
  28182. return aurelia.start().then(function (a) {
  28183. _this.host = document.createElement('div');
  28184. _this.host.innerHTML = _this._html;
  28185. document.body.appendChild(_this.host);
  28186. return aurelia.enhance(_this._bindingContext, _this.host).then(function () {
  28187. _this._rootView = aurelia.root;
  28188. _this.element = _this.host.firstElementChild;
  28189. if (aurelia.root.controllers.length) {
  28190. _this.viewModel = aurelia.root.controllers[0].viewModel;
  28191. }
  28192. return new Promise(function (resolve) {
  28193. return setTimeout(function () {
  28194. return resolve();
  28195. }, 0);
  28196. });
  28197. });
  28198. });
  28199. });
  28200. });
  28201. };
  28202. ComponentTester.prototype.dispose = function dispose() {
  28203. if (this.host === undefined || this._rootView === undefined) {
  28204. throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()');
  28205. }
  28206. this._rootView.detached();
  28207. this._rootView.unbind();
  28208. return this.host.parentNode.removeChild(this.host);
  28209. };
  28210. ComponentTester.prototype._prepareLifecycle = function _prepareLifecycle() {
  28211. var _this2 = this;
  28212. var bindPrototype = _aureliaTemplating.View.prototype.bind;
  28213. _aureliaTemplating.View.prototype.bind = function () {};
  28214. this.bind = function (bindingContext) {
  28215. return new Promise(function (resolve) {
  28216. _aureliaTemplating.View.prototype.bind = bindPrototype;
  28217. if (bindingContext !== undefined) {
  28218. _this2._bindingContext = bindingContext;
  28219. }
  28220. _this2._rootView.bind(_this2._bindingContext);
  28221. setTimeout(function () {
  28222. return resolve();
  28223. }, 0);
  28224. });
  28225. };
  28226. var attachedPrototype = _aureliaTemplating.View.prototype.attached;
  28227. _aureliaTemplating.View.prototype.attached = function () {};
  28228. this.attached = function () {
  28229. return new Promise(function (resolve) {
  28230. _aureliaTemplating.View.prototype.attached = attachedPrototype;
  28231. _this2._rootView.attached();
  28232. setTimeout(function () {
  28233. return resolve();
  28234. }, 0);
  28235. });
  28236. };
  28237. this.detached = function () {
  28238. return new Promise(function (resolve) {
  28239. _this2._rootView.detached();
  28240. setTimeout(function () {
  28241. return resolve();
  28242. }, 0);
  28243. });
  28244. };
  28245. this.unbind = function () {
  28246. return new Promise(function (resolve) {
  28247. _this2._rootView.unbind();
  28248. setTimeout(function () {
  28249. return resolve();
  28250. }, 0);
  28251. });
  28252. };
  28253. };
  28254. return ComponentTester;
  28255. }();
  28256. });