71e00a57633df688a7d1f766ea407536.js 309 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834
  1. "no use strict";
  2. !(function(window) {
  3. if (typeof window.window != "undefined" && window.document)
  4. return;
  5. if (window.require && window.define)
  6. return;
  7. if (!window.console) {
  8. window.console = function() {
  9. var msgs = Array.prototype.slice.call(arguments, 0);
  10. postMessage({type: "log", data: msgs});
  11. };
  12. window.console.error =
  13. window.console.warn =
  14. window.console.log =
  15. window.console.trace = window.console;
  16. }
  17. window.window = window;
  18. window.ace = window;
  19. window.onerror = function(message, file, line, col, err) {
  20. postMessage({type: "error", data: {
  21. message: message,
  22. data: err && err.data,
  23. file: file,
  24. line: line,
  25. col: col,
  26. stack: err && err.stack
  27. }});
  28. };
  29. window.normalizeModule = function(parentId, moduleName) {
  30. // normalize plugin requires
  31. if (moduleName.indexOf("!") !== -1) {
  32. var chunks = moduleName.split("!");
  33. return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]);
  34. }
  35. // normalize relative requires
  36. if (moduleName.charAt(0) == ".") {
  37. var base = parentId.split("/").slice(0, -1).join("/");
  38. moduleName = (base ? base + "/" : "") + moduleName;
  39. while (moduleName.indexOf(".") !== -1 && previous != moduleName) {
  40. var previous = moduleName;
  41. moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
  42. }
  43. }
  44. return moduleName;
  45. };
  46. window.require = function require(parentId, id) {
  47. if (!id) {
  48. id = parentId;
  49. parentId = null;
  50. }
  51. if (!id.charAt)
  52. throw new Error("worker.js require() accepts only (parentId, id) as arguments");
  53. id = window.normalizeModule(parentId, id);
  54. var module = window.require.modules[id];
  55. if (module) {
  56. if (!module.initialized) {
  57. module.initialized = true;
  58. module.exports = module.factory().exports;
  59. }
  60. return module.exports;
  61. }
  62. if (!window.require.tlns)
  63. return console.log("unable to load " + id);
  64. var path = resolveModuleId(id, window.require.tlns);
  65. if (path.slice(-3) != ".js") path += ".js";
  66. window.require.id = id;
  67. window.require.modules[id] = {}; // prevent infinite loop on broken modules
  68. importScripts(path);
  69. return window.require(parentId, id);
  70. };
  71. function resolveModuleId(id, paths) {
  72. var testPath = id, tail = "";
  73. while (testPath) {
  74. var alias = paths[testPath];
  75. if (typeof alias == "string") {
  76. return alias + tail;
  77. } else if (alias) {
  78. return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name);
  79. } else if (alias === false) {
  80. return "";
  81. }
  82. var i = testPath.lastIndexOf("/");
  83. if (i === -1) break;
  84. tail = testPath.substr(i) + tail;
  85. testPath = testPath.slice(0, i);
  86. }
  87. return id;
  88. }
  89. window.require.modules = {};
  90. window.require.tlns = {};
  91. window.define = function(id, deps, factory) {
  92. if (arguments.length == 2) {
  93. factory = deps;
  94. if (typeof id != "string") {
  95. deps = id;
  96. id = window.require.id;
  97. }
  98. } else if (arguments.length == 1) {
  99. factory = id;
  100. deps = [];
  101. id = window.require.id;
  102. }
  103. if (typeof factory != "function") {
  104. window.require.modules[id] = {
  105. exports: factory,
  106. initialized: true
  107. };
  108. return;
  109. }
  110. if (!deps.length)
  111. // If there is no dependencies, we inject "require", "exports" and
  112. // "module" as dependencies, to provide CommonJS compatibility.
  113. deps = ["require", "exports", "module"];
  114. var req = function(childId) {
  115. return window.require(id, childId);
  116. };
  117. window.require.modules[id] = {
  118. exports: {},
  119. factory: function() {
  120. var module = this;
  121. var returnExports = factory.apply(this, deps.slice(0, factory.length).map(function(dep) {
  122. switch (dep) {
  123. // Because "require", "exports" and "module" aren't actual
  124. // dependencies, we must handle them seperately.
  125. case "require": return req;
  126. case "exports": return module.exports;
  127. case "module": return module;
  128. // But for all other dependencies, we can just go ahead and
  129. // require them.
  130. default: return req(dep);
  131. }
  132. }));
  133. if (returnExports)
  134. module.exports = returnExports;
  135. return module;
  136. }
  137. };
  138. };
  139. window.define.amd = {};
  140. window.require.tlns = {};
  141. window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
  142. for (var i in topLevelNamespaces)
  143. this.require.tlns[i] = topLevelNamespaces[i];
  144. };
  145. window.initSender = function initSender() {
  146. var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter;
  147. var oop = window.require("ace/lib/oop");
  148. var Sender = function() {};
  149. (function() {
  150. oop.implement(this, EventEmitter);
  151. this.callback = function(data, callbackId) {
  152. postMessage({
  153. type: "call",
  154. id: callbackId,
  155. data: data
  156. });
  157. };
  158. this.emit = function(name, data) {
  159. postMessage({
  160. type: "event",
  161. name: name,
  162. data: data
  163. });
  164. };
  165. }).call(Sender.prototype);
  166. return new Sender();
  167. };
  168. var main = window.main = null;
  169. var sender = window.sender = null;
  170. window.onmessage = function(e) {
  171. var msg = e.data;
  172. if (msg.event && sender) {
  173. sender._signal(msg.event, msg.data);
  174. }
  175. else if (msg.command) {
  176. if (main[msg.command])
  177. main[msg.command].apply(main, msg.args);
  178. else if (window[msg.command])
  179. window[msg.command].apply(window, msg.args);
  180. else
  181. throw new Error("Unknown command:" + msg.command);
  182. }
  183. else if (msg.init) {
  184. window.initBaseUrls(msg.tlns);
  185. sender = window.sender = window.initSender();
  186. var clazz = this.require(msg.module)[msg.classname];
  187. main = window.main = new clazz(sender);
  188. }
  189. };
  190. })(this);
  191. ace.define("ace/lib/oop",[], function(require, exports, module){"use strict";
  192. exports.inherits = function (ctor, superCtor) {
  193. ctor.super_ = superCtor;
  194. ctor.prototype = Object.create(superCtor.prototype, {
  195. constructor: {
  196. value: ctor,
  197. enumerable: false,
  198. writable: true,
  199. configurable: true
  200. }
  201. });
  202. };
  203. exports.mixin = function (obj, mixin) {
  204. for (var key in mixin) {
  205. obj[key] = mixin[key];
  206. }
  207. return obj;
  208. };
  209. exports.implement = function (proto, mixin) {
  210. exports.mixin(proto, mixin);
  211. };
  212. });
  213. ace.define("ace/lib/lang",[], function(require, exports, module){"use strict";
  214. exports.last = function (a) {
  215. return a[a.length - 1];
  216. };
  217. exports.stringReverse = function (string) {
  218. return string.split("").reverse().join("");
  219. };
  220. exports.stringRepeat = function (string, count) {
  221. var result = '';
  222. while (count > 0) {
  223. if (count & 1)
  224. result += string;
  225. if (count >>= 1)
  226. string += string;
  227. }
  228. return result;
  229. };
  230. var trimBeginRegexp = /^\s\s*/;
  231. var trimEndRegexp = /\s\s*$/;
  232. exports.stringTrimLeft = function (string) {
  233. return string.replace(trimBeginRegexp, '');
  234. };
  235. exports.stringTrimRight = function (string) {
  236. return string.replace(trimEndRegexp, '');
  237. };
  238. exports.copyObject = function (obj) {
  239. var copy = {};
  240. for (var key in obj) {
  241. copy[key] = obj[key];
  242. }
  243. return copy;
  244. };
  245. exports.copyArray = function (array) {
  246. var copy = [];
  247. for (var i = 0, l = array.length; i < l; i++) {
  248. if (array[i] && typeof array[i] == "object")
  249. copy[i] = this.copyObject(array[i]);
  250. else
  251. copy[i] = array[i];
  252. }
  253. return copy;
  254. };
  255. exports.deepCopy = function deepCopy(obj) {
  256. if (typeof obj !== "object" || !obj)
  257. return obj;
  258. var copy;
  259. if (Array.isArray(obj)) {
  260. copy = [];
  261. for (var key = 0; key < obj.length; key++) {
  262. copy[key] = deepCopy(obj[key]);
  263. }
  264. return copy;
  265. }
  266. if (Object.prototype.toString.call(obj) !== "[object Object]")
  267. return obj;
  268. copy = {};
  269. for (var key in obj)
  270. copy[key] = deepCopy(obj[key]);
  271. return copy;
  272. };
  273. exports.arrayToMap = function (arr) {
  274. var map = {};
  275. for (var i = 0; i < arr.length; i++) {
  276. map[arr[i]] = 1;
  277. }
  278. return map;
  279. };
  280. exports.createMap = function (props) {
  281. var map = Object.create(null);
  282. for (var i in props) {
  283. map[i] = props[i];
  284. }
  285. return map;
  286. };
  287. exports.arrayRemove = function (array, value) {
  288. for (var i = 0; i <= array.length; i++) {
  289. if (value === array[i]) {
  290. array.splice(i, 1);
  291. }
  292. }
  293. };
  294. exports.escapeRegExp = function (str) {
  295. return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
  296. };
  297. exports.escapeHTML = function (str) {
  298. return ("" + str).replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
  299. };
  300. exports.getMatchOffsets = function (string, regExp) {
  301. var matches = [];
  302. string.replace(regExp, function (str) {
  303. matches.push({
  304. offset: arguments[arguments.length - 2],
  305. length: str.length
  306. });
  307. });
  308. return matches;
  309. };
  310. exports.deferredCall = function (fcn) {
  311. var timer = null;
  312. var callback = function () {
  313. timer = null;
  314. fcn();
  315. };
  316. var deferred = function (timeout) {
  317. deferred.cancel();
  318. timer = setTimeout(callback, timeout || 0);
  319. return deferred;
  320. };
  321. deferred.schedule = deferred;
  322. deferred.call = function () {
  323. this.cancel();
  324. fcn();
  325. return deferred;
  326. };
  327. deferred.cancel = function () {
  328. clearTimeout(timer);
  329. timer = null;
  330. return deferred;
  331. };
  332. deferred.isPending = function () {
  333. return timer;
  334. };
  335. return deferred;
  336. };
  337. exports.delayedCall = function (fcn, defaultTimeout) {
  338. var timer = null;
  339. var callback = function () {
  340. timer = null;
  341. fcn();
  342. };
  343. var _self = function (timeout) {
  344. if (timer == null)
  345. timer = setTimeout(callback, timeout || defaultTimeout);
  346. };
  347. _self.delay = function (timeout) {
  348. timer && clearTimeout(timer);
  349. timer = setTimeout(callback, timeout || defaultTimeout);
  350. };
  351. _self.schedule = _self;
  352. _self.call = function () {
  353. this.cancel();
  354. fcn();
  355. };
  356. _self.cancel = function () {
  357. timer && clearTimeout(timer);
  358. timer = null;
  359. };
  360. _self.isPending = function () {
  361. return timer;
  362. };
  363. return _self;
  364. };
  365. });
  366. ace.define("ace/apply_delta",[], function(require, exports, module){"use strict";
  367. function throwDeltaError(delta, errorText) {
  368. console.log("Invalid Delta:", delta);
  369. throw "Invalid Delta: " + errorText;
  370. }
  371. function positionInDocument(docLines, position) {
  372. return position.row >= 0 && position.row < docLines.length &&
  373. position.column >= 0 && position.column <= docLines[position.row].length;
  374. }
  375. function validateDelta(docLines, delta) {
  376. if (delta.action != "insert" && delta.action != "remove")
  377. throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
  378. if (!(delta.lines instanceof Array))
  379. throwDeltaError(delta, "delta.lines must be an Array");
  380. if (!delta.start || !delta.end)
  381. throwDeltaError(delta, "delta.start/end must be an present");
  382. var start = delta.start;
  383. if (!positionInDocument(docLines, delta.start))
  384. throwDeltaError(delta, "delta.start must be contained in document");
  385. var end = delta.end;
  386. if (delta.action == "remove" && !positionInDocument(docLines, end))
  387. throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
  388. var numRangeRows = end.row - start.row;
  389. var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
  390. if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
  391. throwDeltaError(delta, "delta.range must match delta lines");
  392. }
  393. exports.applyDelta = function (docLines, delta, doNotValidate) {
  394. var row = delta.start.row;
  395. var startColumn = delta.start.column;
  396. var line = docLines[row] || "";
  397. switch (delta.action) {
  398. case "insert":
  399. var lines = delta.lines;
  400. if (lines.length === 1) {
  401. docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
  402. }
  403. else {
  404. var args = [row, 1].concat(delta.lines);
  405. docLines.splice.apply(docLines, args);
  406. docLines[row] = line.substring(0, startColumn) + docLines[row];
  407. docLines[row + delta.lines.length - 1] += line.substring(startColumn);
  408. }
  409. break;
  410. case "remove":
  411. var endColumn = delta.end.column;
  412. var endRow = delta.end.row;
  413. if (row === endRow) {
  414. docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
  415. }
  416. else {
  417. docLines.splice(row, endRow - row + 1, line.substring(0, startColumn) + docLines[endRow].substring(endColumn));
  418. }
  419. break;
  420. }
  421. };
  422. });
  423. ace.define("ace/lib/event_emitter",[], function(require, exports, module){"use strict";
  424. var EventEmitter = {};
  425. var stopPropagation = function () { this.propagationStopped = true; };
  426. var preventDefault = function () { this.defaultPrevented = true; };
  427. EventEmitter._emit =
  428. EventEmitter._dispatchEvent = function (eventName, e) {
  429. this._eventRegistry || (this._eventRegistry = {});
  430. this._defaultHandlers || (this._defaultHandlers = {});
  431. var listeners = this._eventRegistry[eventName] || [];
  432. var defaultHandler = this._defaultHandlers[eventName];
  433. if (!listeners.length && !defaultHandler)
  434. return;
  435. if (typeof e != "object" || !e)
  436. e = {};
  437. if (!e.type)
  438. e.type = eventName;
  439. if (!e.stopPropagation)
  440. e.stopPropagation = stopPropagation;
  441. if (!e.preventDefault)
  442. e.preventDefault = preventDefault;
  443. listeners = listeners.slice();
  444. for (var i = 0; i < listeners.length; i++) {
  445. listeners[i](e, this);
  446. if (e.propagationStopped)
  447. break;
  448. }
  449. if (defaultHandler && !e.defaultPrevented)
  450. return defaultHandler(e, this);
  451. };
  452. EventEmitter._signal = function (eventName, e) {
  453. var listeners = (this._eventRegistry || {})[eventName];
  454. if (!listeners)
  455. return;
  456. listeners = listeners.slice();
  457. for (var i = 0; i < listeners.length; i++)
  458. listeners[i](e, this);
  459. };
  460. EventEmitter.once = function (eventName, callback) {
  461. var _self = this;
  462. this.on(eventName, function newCallback() {
  463. _self.off(eventName, newCallback);
  464. callback.apply(null, arguments);
  465. });
  466. if (!callback) {
  467. return new Promise(function (resolve) {
  468. callback = resolve;
  469. });
  470. }
  471. };
  472. EventEmitter.setDefaultHandler = function (eventName, callback) {
  473. var handlers = this._defaultHandlers;
  474. if (!handlers)
  475. handlers = this._defaultHandlers = { _disabled_: {} };
  476. if (handlers[eventName]) {
  477. var old = handlers[eventName];
  478. var disabled = handlers._disabled_[eventName];
  479. if (!disabled)
  480. handlers._disabled_[eventName] = disabled = [];
  481. disabled.push(old);
  482. var i = disabled.indexOf(callback);
  483. if (i != -1)
  484. disabled.splice(i, 1);
  485. }
  486. handlers[eventName] = callback;
  487. };
  488. EventEmitter.removeDefaultHandler = function (eventName, callback) {
  489. var handlers = this._defaultHandlers;
  490. if (!handlers)
  491. return;
  492. var disabled = handlers._disabled_[eventName];
  493. if (handlers[eventName] == callback) {
  494. if (disabled)
  495. this.setDefaultHandler(eventName, disabled.pop());
  496. }
  497. else if (disabled) {
  498. var i = disabled.indexOf(callback);
  499. if (i != -1)
  500. disabled.splice(i, 1);
  501. }
  502. };
  503. EventEmitter.on =
  504. EventEmitter.addEventListener = function (eventName, callback, capturing) {
  505. this._eventRegistry = this._eventRegistry || {};
  506. var listeners = this._eventRegistry[eventName];
  507. if (!listeners)
  508. listeners = this._eventRegistry[eventName] = [];
  509. if (listeners.indexOf(callback) == -1)
  510. listeners[capturing ? "unshift" : "push"](callback);
  511. return callback;
  512. };
  513. EventEmitter.off =
  514. EventEmitter.removeListener =
  515. EventEmitter.removeEventListener = function (eventName, callback) {
  516. this._eventRegistry = this._eventRegistry || {};
  517. var listeners = this._eventRegistry[eventName];
  518. if (!listeners)
  519. return;
  520. var index = listeners.indexOf(callback);
  521. if (index !== -1)
  522. listeners.splice(index, 1);
  523. };
  524. EventEmitter.removeAllListeners = function (eventName) {
  525. if (!eventName)
  526. this._eventRegistry = this._defaultHandlers = undefined;
  527. if (this._eventRegistry)
  528. this._eventRegistry[eventName] = undefined;
  529. if (this._defaultHandlers)
  530. this._defaultHandlers[eventName] = undefined;
  531. };
  532. exports.EventEmitter = EventEmitter;
  533. });
  534. ace.define("ace/range",[], function(require, exports, module){"use strict";
  535. var comparePoints = function (p1, p2) {
  536. return p1.row - p2.row || p1.column - p2.column;
  537. };
  538. var Range = function (startRow, startColumn, endRow, endColumn) {
  539. this.start = {
  540. row: startRow,
  541. column: startColumn
  542. };
  543. this.end = {
  544. row: endRow,
  545. column: endColumn
  546. };
  547. };
  548. (function () {
  549. this.isEqual = function (range) {
  550. return this.start.row === range.start.row &&
  551. this.end.row === range.end.row &&
  552. this.start.column === range.start.column &&
  553. this.end.column === range.end.column;
  554. };
  555. this.toString = function () {
  556. return ("Range: [" + this.start.row + "/" + this.start.column +
  557. "] -> [" + this.end.row + "/" + this.end.column + "]");
  558. };
  559. this.contains = function (row, column) {
  560. return this.compare(row, column) == 0;
  561. };
  562. this.compareRange = function (range) {
  563. var cmp, end = range.end, start = range.start;
  564. cmp = this.compare(end.row, end.column);
  565. if (cmp == 1) {
  566. cmp = this.compare(start.row, start.column);
  567. if (cmp == 1) {
  568. return 2;
  569. }
  570. else if (cmp == 0) {
  571. return 1;
  572. }
  573. else {
  574. return 0;
  575. }
  576. }
  577. else if (cmp == -1) {
  578. return -2;
  579. }
  580. else {
  581. cmp = this.compare(start.row, start.column);
  582. if (cmp == -1) {
  583. return -1;
  584. }
  585. else if (cmp == 1) {
  586. return 42;
  587. }
  588. else {
  589. return 0;
  590. }
  591. }
  592. };
  593. this.comparePoint = function (p) {
  594. return this.compare(p.row, p.column);
  595. };
  596. this.containsRange = function (range) {
  597. return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
  598. };
  599. this.intersects = function (range) {
  600. var cmp = this.compareRange(range);
  601. return (cmp == -1 || cmp == 0 || cmp == 1);
  602. };
  603. this.isEnd = function (row, column) {
  604. return this.end.row == row && this.end.column == column;
  605. };
  606. this.isStart = function (row, column) {
  607. return this.start.row == row && this.start.column == column;
  608. };
  609. this.setStart = function (row, column) {
  610. if (typeof row == "object") {
  611. this.start.column = row.column;
  612. this.start.row = row.row;
  613. }
  614. else {
  615. this.start.row = row;
  616. this.start.column = column;
  617. }
  618. };
  619. this.setEnd = function (row, column) {
  620. if (typeof row == "object") {
  621. this.end.column = row.column;
  622. this.end.row = row.row;
  623. }
  624. else {
  625. this.end.row = row;
  626. this.end.column = column;
  627. }
  628. };
  629. this.inside = function (row, column) {
  630. if (this.compare(row, column) == 0) {
  631. if (this.isEnd(row, column) || this.isStart(row, column)) {
  632. return false;
  633. }
  634. else {
  635. return true;
  636. }
  637. }
  638. return false;
  639. };
  640. this.insideStart = function (row, column) {
  641. if (this.compare(row, column) == 0) {
  642. if (this.isEnd(row, column)) {
  643. return false;
  644. }
  645. else {
  646. return true;
  647. }
  648. }
  649. return false;
  650. };
  651. this.insideEnd = function (row, column) {
  652. if (this.compare(row, column) == 0) {
  653. if (this.isStart(row, column)) {
  654. return false;
  655. }
  656. else {
  657. return true;
  658. }
  659. }
  660. return false;
  661. };
  662. this.compare = function (row, column) {
  663. if (!this.isMultiLine()) {
  664. if (row === this.start.row) {
  665. return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
  666. }
  667. }
  668. if (row < this.start.row)
  669. return -1;
  670. if (row > this.end.row)
  671. return 1;
  672. if (this.start.row === row)
  673. return column >= this.start.column ? 0 : -1;
  674. if (this.end.row === row)
  675. return column <= this.end.column ? 0 : 1;
  676. return 0;
  677. };
  678. this.compareStart = function (row, column) {
  679. if (this.start.row == row && this.start.column == column) {
  680. return -1;
  681. }
  682. else {
  683. return this.compare(row, column);
  684. }
  685. };
  686. this.compareEnd = function (row, column) {
  687. if (this.end.row == row && this.end.column == column) {
  688. return 1;
  689. }
  690. else {
  691. return this.compare(row, column);
  692. }
  693. };
  694. this.compareInside = function (row, column) {
  695. if (this.end.row == row && this.end.column == column) {
  696. return 1;
  697. }
  698. else if (this.start.row == row && this.start.column == column) {
  699. return -1;
  700. }
  701. else {
  702. return this.compare(row, column);
  703. }
  704. };
  705. this.clipRows = function (firstRow, lastRow) {
  706. if (this.end.row > lastRow)
  707. var end = { row: lastRow + 1, column: 0 };
  708. else if (this.end.row < firstRow)
  709. var end = { row: firstRow, column: 0 };
  710. if (this.start.row > lastRow)
  711. var start = { row: lastRow + 1, column: 0 };
  712. else if (this.start.row < firstRow)
  713. var start = { row: firstRow, column: 0 };
  714. return Range.fromPoints(start || this.start, end || this.end);
  715. };
  716. this.extend = function (row, column) {
  717. var cmp = this.compare(row, column);
  718. if (cmp == 0)
  719. return this;
  720. else if (cmp == -1)
  721. var start = { row: row, column: column };
  722. else
  723. var end = { row: row, column: column };
  724. return Range.fromPoints(start || this.start, end || this.end);
  725. };
  726. this.isEmpty = function () {
  727. return (this.start.row === this.end.row && this.start.column === this.end.column);
  728. };
  729. this.isMultiLine = function () {
  730. return (this.start.row !== this.end.row);
  731. };
  732. this.clone = function () {
  733. return Range.fromPoints(this.start, this.end);
  734. };
  735. this.collapseRows = function () {
  736. if (this.end.column == 0)
  737. return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row - 1), 0);
  738. else
  739. return new Range(this.start.row, 0, this.end.row, 0);
  740. };
  741. this.toScreenRange = function (session) {
  742. var screenPosStart = session.documentToScreenPosition(this.start);
  743. var screenPosEnd = session.documentToScreenPosition(this.end);
  744. return new Range(screenPosStart.row, screenPosStart.column, screenPosEnd.row, screenPosEnd.column);
  745. };
  746. this.moveBy = function (row, column) {
  747. this.start.row += row;
  748. this.start.column += column;
  749. this.end.row += row;
  750. this.end.column += column;
  751. };
  752. }).call(Range.prototype);
  753. Range.fromPoints = function (start, end) {
  754. return new Range(start.row, start.column, end.row, end.column);
  755. };
  756. Range.comparePoints = comparePoints;
  757. Range.comparePoints = function (p1, p2) {
  758. return p1.row - p2.row || p1.column - p2.column;
  759. };
  760. exports.Range = Range;
  761. });
  762. ace.define("ace/anchor",[], function(require, exports, module){"use strict";
  763. var oop = require("./lib/oop");
  764. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  765. var Anchor = exports.Anchor = function (doc, row, column) {
  766. this.$onChange = this.onChange.bind(this);
  767. this.attach(doc);
  768. if (typeof column == "undefined")
  769. this.setPosition(row.row, row.column);
  770. else
  771. this.setPosition(row, column);
  772. };
  773. (function () {
  774. oop.implement(this, EventEmitter);
  775. this.getPosition = function () {
  776. return this.$clipPositionToDocument(this.row, this.column);
  777. };
  778. this.getDocument = function () {
  779. return this.document;
  780. };
  781. this.$insertRight = false;
  782. this.onChange = function (delta) {
  783. if (delta.start.row == delta.end.row && delta.start.row != this.row)
  784. return;
  785. if (delta.start.row > this.row)
  786. return;
  787. var point = $getTransformedPoint(delta, { row: this.row, column: this.column }, this.$insertRight);
  788. this.setPosition(point.row, point.column, true);
  789. };
  790. function $pointsInOrder(point1, point2, equalPointsInOrder) {
  791. var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
  792. return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
  793. }
  794. function $getTransformedPoint(delta, point, moveIfEqual) {
  795. var deltaIsInsert = delta.action == "insert";
  796. var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
  797. var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
  798. var deltaStart = delta.start;
  799. var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
  800. if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
  801. return {
  802. row: point.row,
  803. column: point.column
  804. };
  805. }
  806. if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
  807. return {
  808. row: point.row + deltaRowShift,
  809. column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
  810. };
  811. }
  812. return {
  813. row: deltaStart.row,
  814. column: deltaStart.column
  815. };
  816. }
  817. this.setPosition = function (row, column, noClip) {
  818. var pos;
  819. if (noClip) {
  820. pos = {
  821. row: row,
  822. column: column
  823. };
  824. }
  825. else {
  826. pos = this.$clipPositionToDocument(row, column);
  827. }
  828. if (this.row == pos.row && this.column == pos.column)
  829. return;
  830. var old = {
  831. row: this.row,
  832. column: this.column
  833. };
  834. this.row = pos.row;
  835. this.column = pos.column;
  836. this._signal("change", {
  837. old: old,
  838. value: pos
  839. });
  840. };
  841. this.detach = function () {
  842. this.document.off("change", this.$onChange);
  843. };
  844. this.attach = function (doc) {
  845. this.document = doc || this.document;
  846. this.document.on("change", this.$onChange);
  847. };
  848. this.$clipPositionToDocument = function (row, column) {
  849. var pos = {};
  850. if (row >= this.document.getLength()) {
  851. pos.row = Math.max(0, this.document.getLength() - 1);
  852. pos.column = this.document.getLine(pos.row).length;
  853. }
  854. else if (row < 0) {
  855. pos.row = 0;
  856. pos.column = 0;
  857. }
  858. else {
  859. pos.row = row;
  860. pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
  861. }
  862. if (column < 0)
  863. pos.column = 0;
  864. return pos;
  865. };
  866. }).call(Anchor.prototype);
  867. });
  868. ace.define("ace/document",[], function(require, exports, module){"use strict";
  869. var oop = require("./lib/oop");
  870. var applyDelta = require("./apply_delta").applyDelta;
  871. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  872. var Range = require("./range").Range;
  873. var Anchor = require("./anchor").Anchor;
  874. var Document = function (textOrLines) {
  875. this.$lines = [""];
  876. if (textOrLines.length === 0) {
  877. this.$lines = [""];
  878. }
  879. else if (Array.isArray(textOrLines)) {
  880. this.insertMergedLines({ row: 0, column: 0 }, textOrLines);
  881. }
  882. else {
  883. this.insert({ row: 0, column: 0 }, textOrLines);
  884. }
  885. };
  886. (function () {
  887. oop.implement(this, EventEmitter);
  888. this.setValue = function (text) {
  889. var len = this.getLength() - 1;
  890. this.remove(new Range(0, 0, len, this.getLine(len).length));
  891. this.insert({ row: 0, column: 0 }, text);
  892. };
  893. this.getValue = function () {
  894. return this.getAllLines().join(this.getNewLineCharacter());
  895. };
  896. this.createAnchor = function (row, column) {
  897. return new Anchor(this, row, column);
  898. };
  899. if ("aaa".split(/a/).length === 0) {
  900. this.$split = function (text) {
  901. return text.replace(/\r\n|\r/g, "\n").split("\n");
  902. };
  903. }
  904. else {
  905. this.$split = function (text) {
  906. return text.split(/\r\n|\r|\n/);
  907. };
  908. }
  909. this.$detectNewLine = function (text) {
  910. var match = text.match(/^.*?(\r\n|\r|\n)/m);
  911. this.$autoNewLine = match ? match[1] : "\n";
  912. this._signal("changeNewLineMode");
  913. };
  914. this.getNewLineCharacter = function () {
  915. switch (this.$newLineMode) {
  916. case "windows":
  917. return "\r\n";
  918. case "unix":
  919. return "\n";
  920. default:
  921. return this.$autoNewLine || "\n";
  922. }
  923. };
  924. this.$autoNewLine = "";
  925. this.$newLineMode = "auto";
  926. this.setNewLineMode = function (newLineMode) {
  927. if (this.$newLineMode === newLineMode)
  928. return;
  929. this.$newLineMode = newLineMode;
  930. this._signal("changeNewLineMode");
  931. };
  932. this.getNewLineMode = function () {
  933. return this.$newLineMode;
  934. };
  935. this.isNewLine = function (text) {
  936. return (text == "\r\n" || text == "\r" || text == "\n");
  937. };
  938. this.getLine = function (row) {
  939. return this.$lines[row] || "";
  940. };
  941. this.getLines = function (firstRow, lastRow) {
  942. return this.$lines.slice(firstRow, lastRow + 1);
  943. };
  944. this.getAllLines = function () {
  945. return this.getLines(0, this.getLength());
  946. };
  947. this.getLength = function () {
  948. return this.$lines.length;
  949. };
  950. this.getTextRange = function (range) {
  951. return this.getLinesForRange(range).join(this.getNewLineCharacter());
  952. };
  953. this.getLinesForRange = function (range) {
  954. var lines;
  955. if (range.start.row === range.end.row) {
  956. lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
  957. }
  958. else {
  959. lines = this.getLines(range.start.row, range.end.row);
  960. lines[0] = (lines[0] || "").substring(range.start.column);
  961. var l = lines.length - 1;
  962. if (range.end.row - range.start.row == l)
  963. lines[l] = lines[l].substring(0, range.end.column);
  964. }
  965. return lines;
  966. };
  967. this.insertLines = function (row, lines) {
  968. console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
  969. return this.insertFullLines(row, lines);
  970. };
  971. this.removeLines = function (firstRow, lastRow) {
  972. console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
  973. return this.removeFullLines(firstRow, lastRow);
  974. };
  975. this.insertNewLine = function (position) {
  976. console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
  977. return this.insertMergedLines(position, ["", ""]);
  978. };
  979. this.insert = function (position, text) {
  980. if (this.getLength() <= 1)
  981. this.$detectNewLine(text);
  982. return this.insertMergedLines(position, this.$split(text));
  983. };
  984. this.insertInLine = function (position, text) {
  985. var start = this.clippedPos(position.row, position.column);
  986. var end = this.pos(position.row, position.column + text.length);
  987. this.applyDelta({
  988. start: start,
  989. end: end,
  990. action: "insert",
  991. lines: [text]
  992. }, true);
  993. return this.clonePos(end);
  994. };
  995. this.clippedPos = function (row, column) {
  996. var length = this.getLength();
  997. if (row === undefined) {
  998. row = length;
  999. }
  1000. else if (row < 0) {
  1001. row = 0;
  1002. }
  1003. else if (row >= length) {
  1004. row = length - 1;
  1005. column = undefined;
  1006. }
  1007. var line = this.getLine(row);
  1008. if (column == undefined)
  1009. column = line.length;
  1010. column = Math.min(Math.max(column, 0), line.length);
  1011. return { row: row, column: column };
  1012. };
  1013. this.clonePos = function (pos) {
  1014. return { row: pos.row, column: pos.column };
  1015. };
  1016. this.pos = function (row, column) {
  1017. return { row: row, column: column };
  1018. };
  1019. this.$clipPosition = function (position) {
  1020. var length = this.getLength();
  1021. if (position.row >= length) {
  1022. position.row = Math.max(0, length - 1);
  1023. position.column = this.getLine(length - 1).length;
  1024. }
  1025. else {
  1026. position.row = Math.max(0, position.row);
  1027. position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
  1028. }
  1029. return position;
  1030. };
  1031. this.insertFullLines = function (row, lines) {
  1032. row = Math.min(Math.max(row, 0), this.getLength());
  1033. var column = 0;
  1034. if (row < this.getLength()) {
  1035. lines = lines.concat([""]);
  1036. column = 0;
  1037. }
  1038. else {
  1039. lines = [""].concat(lines);
  1040. row--;
  1041. column = this.$lines[row].length;
  1042. }
  1043. this.insertMergedLines({ row: row, column: column }, lines);
  1044. };
  1045. this.insertMergedLines = function (position, lines) {
  1046. var start = this.clippedPos(position.row, position.column);
  1047. var end = {
  1048. row: start.row + lines.length - 1,
  1049. column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
  1050. };
  1051. this.applyDelta({
  1052. start: start,
  1053. end: end,
  1054. action: "insert",
  1055. lines: lines
  1056. });
  1057. return this.clonePos(end);
  1058. };
  1059. this.remove = function (range) {
  1060. var start = this.clippedPos(range.start.row, range.start.column);
  1061. var end = this.clippedPos(range.end.row, range.end.column);
  1062. this.applyDelta({
  1063. start: start,
  1064. end: end,
  1065. action: "remove",
  1066. lines: this.getLinesForRange({ start: start, end: end })
  1067. });
  1068. return this.clonePos(start);
  1069. };
  1070. this.removeInLine = function (row, startColumn, endColumn) {
  1071. var start = this.clippedPos(row, startColumn);
  1072. var end = this.clippedPos(row, endColumn);
  1073. this.applyDelta({
  1074. start: start,
  1075. end: end,
  1076. action: "remove",
  1077. lines: this.getLinesForRange({ start: start, end: end })
  1078. }, true);
  1079. return this.clonePos(start);
  1080. };
  1081. this.removeFullLines = function (firstRow, lastRow) {
  1082. firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
  1083. lastRow = Math.min(Math.max(0, lastRow), this.getLength() - 1);
  1084. var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
  1085. var deleteLastNewLine = lastRow < this.getLength() - 1;
  1086. var startRow = (deleteFirstNewLine ? firstRow - 1 : firstRow);
  1087. var startCol = (deleteFirstNewLine ? this.getLine(startRow).length : 0);
  1088. var endRow = (deleteLastNewLine ? lastRow + 1 : lastRow);
  1089. var endCol = (deleteLastNewLine ? 0 : this.getLine(endRow).length);
  1090. var range = new Range(startRow, startCol, endRow, endCol);
  1091. var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
  1092. this.applyDelta({
  1093. start: range.start,
  1094. end: range.end,
  1095. action: "remove",
  1096. lines: this.getLinesForRange(range)
  1097. });
  1098. return deletedLines;
  1099. };
  1100. this.removeNewLine = function (row) {
  1101. if (row < this.getLength() - 1 && row >= 0) {
  1102. this.applyDelta({
  1103. start: this.pos(row, this.getLine(row).length),
  1104. end: this.pos(row + 1, 0),
  1105. action: "remove",
  1106. lines: ["", ""]
  1107. });
  1108. }
  1109. };
  1110. this.replace = function (range, text) {
  1111. if (!(range instanceof Range))
  1112. range = Range.fromPoints(range.start, range.end);
  1113. if (text.length === 0 && range.isEmpty())
  1114. return range.start;
  1115. if (text == this.getTextRange(range))
  1116. return range.end;
  1117. this.remove(range);
  1118. var end;
  1119. if (text) {
  1120. end = this.insert(range.start, text);
  1121. }
  1122. else {
  1123. end = range.start;
  1124. }
  1125. return end;
  1126. };
  1127. this.applyDeltas = function (deltas) {
  1128. for (var i = 0; i < deltas.length; i++) {
  1129. this.applyDelta(deltas[i]);
  1130. }
  1131. };
  1132. this.revertDeltas = function (deltas) {
  1133. for (var i = deltas.length - 1; i >= 0; i--) {
  1134. this.revertDelta(deltas[i]);
  1135. }
  1136. };
  1137. this.applyDelta = function (delta, doNotValidate) {
  1138. var isInsert = delta.action == "insert";
  1139. if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
  1140. : !Range.comparePoints(delta.start, delta.end)) {
  1141. return;
  1142. }
  1143. if (isInsert && delta.lines.length > 20000) {
  1144. this.$splitAndapplyLargeDelta(delta, 20000);
  1145. }
  1146. else {
  1147. applyDelta(this.$lines, delta, doNotValidate);
  1148. this._signal("change", delta);
  1149. }
  1150. };
  1151. this.$safeApplyDelta = function (delta) {
  1152. var docLength = this.$lines.length;
  1153. if (delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength
  1154. || delta.action == "insert" && delta.start.row <= docLength) {
  1155. this.applyDelta(delta);
  1156. }
  1157. };
  1158. this.$splitAndapplyLargeDelta = function (delta, MAX) {
  1159. var lines = delta.lines;
  1160. var l = lines.length - MAX + 1;
  1161. var row = delta.start.row;
  1162. var column = delta.start.column;
  1163. for (var from = 0, to = 0; from < l; from = to) {
  1164. to += MAX - 1;
  1165. var chunk = lines.slice(from, to);
  1166. chunk.push("");
  1167. this.applyDelta({
  1168. start: this.pos(row + from, column),
  1169. end: this.pos(row + to, column = 0),
  1170. action: delta.action,
  1171. lines: chunk
  1172. }, true);
  1173. }
  1174. delta.lines = lines.slice(from);
  1175. delta.start.row = row + from;
  1176. delta.start.column = column;
  1177. this.applyDelta(delta, true);
  1178. };
  1179. this.revertDelta = function (delta) {
  1180. this.$safeApplyDelta({
  1181. start: this.clonePos(delta.start),
  1182. end: this.clonePos(delta.end),
  1183. action: (delta.action == "insert" ? "remove" : "insert"),
  1184. lines: delta.lines.slice()
  1185. });
  1186. };
  1187. this.indexToPosition = function (index, startRow) {
  1188. var lines = this.$lines || this.getAllLines();
  1189. var newlineLength = this.getNewLineCharacter().length;
  1190. for (var i = startRow || 0, l = lines.length; i < l; i++) {
  1191. index -= lines[i].length + newlineLength;
  1192. if (index < 0)
  1193. return { row: i, column: index + lines[i].length + newlineLength };
  1194. }
  1195. return { row: l - 1, column: index + lines[l - 1].length + newlineLength };
  1196. };
  1197. this.positionToIndex = function (pos, startRow) {
  1198. var lines = this.$lines || this.getAllLines();
  1199. var newlineLength = this.getNewLineCharacter().length;
  1200. var index = 0;
  1201. var row = Math.min(pos.row, lines.length);
  1202. for (var i = startRow || 0; i < row; ++i)
  1203. index += lines[i].length + newlineLength;
  1204. return index + pos.column;
  1205. };
  1206. }).call(Document.prototype);
  1207. exports.Document = Document;
  1208. });
  1209. ace.define("ace/worker/mirror",[], function(require, exports, module) {
  1210. "use strict";
  1211. var Document = require("../document").Document;
  1212. var lang = require("../lib/lang");
  1213. var Mirror = exports.Mirror = function(sender) {
  1214. this.sender = sender;
  1215. var doc = this.doc = new Document("");
  1216. var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
  1217. var _self = this;
  1218. sender.on("change", function(e) {
  1219. var data = e.data;
  1220. if (data[0].start) {
  1221. doc.applyDeltas(data);
  1222. } else {
  1223. for (var i = 0; i < data.length; i += 2) {
  1224. var d, err;
  1225. if (Array.isArray(data[i+1])) {
  1226. d = {action: "insert", start: data[i], lines: data[i+1]};
  1227. } else {
  1228. d = {action: "remove", start: data[i], end: data[i+1]};
  1229. }
  1230. if ((d.action == "insert" ? d.start : d.end).row >= doc.$lines.length) {
  1231. err = new Error("Invalid delta");
  1232. err.data = {
  1233. path: _self.$path,
  1234. linesLength: doc.$lines.length,
  1235. start: d.start,
  1236. end: d.end
  1237. };
  1238. throw err;
  1239. }
  1240. doc.applyDelta(d, true);
  1241. }
  1242. }
  1243. if (_self.$timeout)
  1244. return deferredUpdate.schedule(_self.$timeout);
  1245. _self.onUpdate();
  1246. });
  1247. };
  1248. (function() {
  1249. this.$timeout = 500;
  1250. this.setTimeout = function(timeout) {
  1251. this.$timeout = timeout;
  1252. };
  1253. this.setValue = function(value) {
  1254. this.doc.setValue(value);
  1255. this.deferredUpdate.schedule(this.$timeout);
  1256. };
  1257. this.getValue = function(callbackId) {
  1258. this.sender.callback(this.doc.getValue(), callbackId);
  1259. };
  1260. this.onUpdate = function() {
  1261. };
  1262. this.isPending = function() {
  1263. return this.deferredUpdate.isPending();
  1264. };
  1265. }).call(Mirror.prototype);
  1266. });
  1267. ace.define("ace/mode/html/saxparser",[], function(require, exports, module) {
  1268. module.exports = (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({
  1269. 1:[function(_dereq_,module,exports){
  1270. function isScopeMarker(node) {
  1271. if (node.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1272. return node.localName === "applet"
  1273. || node.localName === "caption"
  1274. || node.localName === "marquee"
  1275. || node.localName === "object"
  1276. || node.localName === "table"
  1277. || node.localName === "td"
  1278. || node.localName === "th";
  1279. }
  1280. if (node.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1281. return node.localName === "mi"
  1282. || node.localName === "mo"
  1283. || node.localName === "mn"
  1284. || node.localName === "ms"
  1285. || node.localName === "mtext"
  1286. || node.localName === "annotation-xml";
  1287. }
  1288. if (node.namespaceURI === "http://www.w3.org/2000/svg") {
  1289. return node.localName === "foreignObject"
  1290. || node.localName === "desc"
  1291. || node.localName === "title";
  1292. }
  1293. }
  1294. function isListItemScopeMarker(node) {
  1295. return isScopeMarker(node)
  1296. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ol')
  1297. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ul');
  1298. }
  1299. function isTableScopeMarker(node) {
  1300. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'table')
  1301. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1302. }
  1303. function isTableBodyScopeMarker(node) {
  1304. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tbody')
  1305. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tfoot')
  1306. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'thead')
  1307. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1308. }
  1309. function isTableRowScopeMarker(node) {
  1310. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tr')
  1311. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1312. }
  1313. function isButtonScopeMarker(node) {
  1314. return isScopeMarker(node)
  1315. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'button');
  1316. }
  1317. function isSelectScopeMarker(node) {
  1318. return !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'optgroup')
  1319. && !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'option');
  1320. }
  1321. function ElementStack() {
  1322. this.elements = [];
  1323. this.rootNode = null;
  1324. this.headElement = null;
  1325. this.bodyElement = null;
  1326. }
  1327. ElementStack.prototype._inScope = function(localName, isMarker) {
  1328. for (var i = this.elements.length - 1; i >= 0; i--) {
  1329. var node = this.elements[i];
  1330. if (node.localName === localName)
  1331. return true;
  1332. if (isMarker(node))
  1333. return false;
  1334. }
  1335. };
  1336. ElementStack.prototype.push = function(item) {
  1337. this.elements.push(item);
  1338. };
  1339. ElementStack.prototype.pushHtmlElement = function(item) {
  1340. this.rootNode = item.node;
  1341. this.push(item);
  1342. };
  1343. ElementStack.prototype.pushHeadElement = function(item) {
  1344. this.headElement = item.node;
  1345. this.push(item);
  1346. };
  1347. ElementStack.prototype.pushBodyElement = function(item) {
  1348. this.bodyElement = item.node;
  1349. this.push(item);
  1350. };
  1351. ElementStack.prototype.pop = function() {
  1352. return this.elements.pop();
  1353. };
  1354. ElementStack.prototype.remove = function(item) {
  1355. this.elements.splice(this.elements.indexOf(item), 1);
  1356. };
  1357. ElementStack.prototype.popUntilPopped = function(localName) {
  1358. var element;
  1359. do {
  1360. element = this.pop();
  1361. } while (element.localName != localName);
  1362. };
  1363. ElementStack.prototype.popUntilTableScopeMarker = function() {
  1364. while (!isTableScopeMarker(this.top))
  1365. this.pop();
  1366. };
  1367. ElementStack.prototype.popUntilTableBodyScopeMarker = function() {
  1368. while (!isTableBodyScopeMarker(this.top))
  1369. this.pop();
  1370. };
  1371. ElementStack.prototype.popUntilTableRowScopeMarker = function() {
  1372. while (!isTableRowScopeMarker(this.top))
  1373. this.pop();
  1374. };
  1375. ElementStack.prototype.item = function(index) {
  1376. return this.elements[index];
  1377. };
  1378. ElementStack.prototype.contains = function(element) {
  1379. return this.elements.indexOf(element) !== -1;
  1380. };
  1381. ElementStack.prototype.inScope = function(localName) {
  1382. return this._inScope(localName, isScopeMarker);
  1383. };
  1384. ElementStack.prototype.inListItemScope = function(localName) {
  1385. return this._inScope(localName, isListItemScopeMarker);
  1386. };
  1387. ElementStack.prototype.inTableScope = function(localName) {
  1388. return this._inScope(localName, isTableScopeMarker);
  1389. };
  1390. ElementStack.prototype.inButtonScope = function(localName) {
  1391. return this._inScope(localName, isButtonScopeMarker);
  1392. };
  1393. ElementStack.prototype.inSelectScope = function(localName) {
  1394. return this._inScope(localName, isSelectScopeMarker);
  1395. };
  1396. ElementStack.prototype.hasNumberedHeaderElementInScope = function() {
  1397. for (var i = this.elements.length - 1; i >= 0; i--) {
  1398. var node = this.elements[i];
  1399. if (node.isNumberedHeader())
  1400. return true;
  1401. if (isScopeMarker(node))
  1402. return false;
  1403. }
  1404. };
  1405. ElementStack.prototype.furthestBlockForFormattingElement = function(element) {
  1406. var furthestBlock = null;
  1407. for (var i = this.elements.length - 1; i >= 0; i--) {
  1408. var node = this.elements[i];
  1409. if (node.node === element)
  1410. break;
  1411. if (node.isSpecial())
  1412. furthestBlock = node;
  1413. }
  1414. return furthestBlock;
  1415. };
  1416. ElementStack.prototype.findIndex = function(localName) {
  1417. for (var i = this.elements.length - 1; i >= 0; i--) {
  1418. if (this.elements[i].localName == localName)
  1419. return i;
  1420. }
  1421. return -1;
  1422. };
  1423. ElementStack.prototype.remove_openElements_until = function(callback) {
  1424. var finished = false;
  1425. var element;
  1426. while (!finished) {
  1427. element = this.elements.pop();
  1428. finished = callback(element);
  1429. }
  1430. return element;
  1431. };
  1432. Object.defineProperty(ElementStack.prototype, 'top', {
  1433. get: function() {
  1434. return this.elements[this.elements.length - 1];
  1435. }
  1436. });
  1437. Object.defineProperty(ElementStack.prototype, 'length', {
  1438. get: function() {
  1439. return this.elements.length;
  1440. }
  1441. });
  1442. exports.ElementStack = ElementStack;
  1443. },
  1444. {}],
  1445. 2:[function(_dereq_,module,exports){
  1446. var entities = _dereq_('html5-entities');
  1447. var InputStream = _dereq_('./InputStream').InputStream;
  1448. var namedEntityPrefixes = {};
  1449. Object.keys(entities).forEach(function (entityKey) {
  1450. for (var i = 0; i < entityKey.length; i++) {
  1451. namedEntityPrefixes[entityKey.substring(0, i + 1)] = true;
  1452. }
  1453. });
  1454. function isAlphaNumeric(c) {
  1455. return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
  1456. }
  1457. function isHexDigit(c) {
  1458. return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
  1459. }
  1460. function isDecimalDigit(c) {
  1461. return (c >= '0' && c <= '9');
  1462. }
  1463. var EntityParser = {};
  1464. EntityParser.consumeEntity = function(buffer, tokenizer, additionalAllowedCharacter) {
  1465. var decodedCharacter = '';
  1466. var consumedCharacters = '';
  1467. var ch = buffer.char();
  1468. if (ch === InputStream.EOF)
  1469. return false;
  1470. consumedCharacters += ch;
  1471. if (ch == '\t' || ch == '\n' || ch == '\v' || ch == ' ' || ch == '<' || ch == '&') {
  1472. buffer.unget(consumedCharacters);
  1473. return false;
  1474. }
  1475. if (additionalAllowedCharacter === ch) {
  1476. buffer.unget(consumedCharacters);
  1477. return false;
  1478. }
  1479. if (ch == '#') {
  1480. ch = buffer.shift(1);
  1481. if (ch === InputStream.EOF) {
  1482. tokenizer._parseError("expected-numeric-entity-but-got-eof");
  1483. buffer.unget(consumedCharacters);
  1484. return false;
  1485. }
  1486. consumedCharacters += ch;
  1487. var radix = 10;
  1488. var isDigit = isDecimalDigit;
  1489. if (ch == 'x' || ch == 'X') {
  1490. radix = 16;
  1491. isDigit = isHexDigit;
  1492. ch = buffer.shift(1);
  1493. if (ch === InputStream.EOF) {
  1494. tokenizer._parseError("expected-numeric-entity-but-got-eof");
  1495. buffer.unget(consumedCharacters);
  1496. return false;
  1497. }
  1498. consumedCharacters += ch;
  1499. }
  1500. if (isDigit(ch)) {
  1501. var code = '';
  1502. while (ch !== InputStream.EOF && isDigit(ch)) {
  1503. code += ch;
  1504. ch = buffer.char();
  1505. }
  1506. code = parseInt(code, radix);
  1507. var replacement = this.replaceEntityNumbers(code);
  1508. if (replacement) {
  1509. tokenizer._parseError("invalid-numeric-entity-replaced");
  1510. code = replacement;
  1511. }
  1512. if (code > 0xFFFF && code <= 0x10FFFF) {
  1513. code -= 0x10000;
  1514. var first = ((0xffc00 & code) >> 10) + 0xD800;
  1515. var second = (0x3ff & code) + 0xDC00;
  1516. decodedCharacter = String.fromCharCode(first, second);
  1517. } else
  1518. decodedCharacter = String.fromCharCode(code);
  1519. if (ch !== ';') {
  1520. tokenizer._parseError("numeric-entity-without-semicolon");
  1521. buffer.unget(ch);
  1522. }
  1523. return decodedCharacter;
  1524. }
  1525. buffer.unget(consumedCharacters);
  1526. tokenizer._parseError("expected-numeric-entity");
  1527. return false;
  1528. }
  1529. if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
  1530. var mostRecentMatch = '';
  1531. while (namedEntityPrefixes[consumedCharacters]) {
  1532. if (entities[consumedCharacters]) {
  1533. mostRecentMatch = consumedCharacters;
  1534. }
  1535. if (ch == ';')
  1536. break;
  1537. ch = buffer.char();
  1538. if (ch === InputStream.EOF)
  1539. break;
  1540. consumedCharacters += ch;
  1541. }
  1542. if (!mostRecentMatch) {
  1543. tokenizer._parseError("expected-named-entity");
  1544. buffer.unget(consumedCharacters);
  1545. return false;
  1546. }
  1547. decodedCharacter = entities[mostRecentMatch];
  1548. if (ch === ';' || !additionalAllowedCharacter || !(isAlphaNumeric(ch) || ch === '=')) {
  1549. if (consumedCharacters.length > mostRecentMatch.length) {
  1550. buffer.unget(consumedCharacters.substring(mostRecentMatch.length));
  1551. }
  1552. if (ch !== ';') {
  1553. tokenizer._parseError("named-entity-without-semicolon");
  1554. }
  1555. return decodedCharacter;
  1556. }
  1557. buffer.unget(consumedCharacters);
  1558. return false;
  1559. }
  1560. };
  1561. EntityParser.replaceEntityNumbers = function(c) {
  1562. switch(c) {
  1563. case 0x00: return 0xFFFD; // REPLACEMENT CHARACTER
  1564. case 0x13: return 0x0010; // Carriage return
  1565. case 0x80: return 0x20AC; // EURO SIGN
  1566. case 0x81: return 0x0081; // <control>
  1567. case 0x82: return 0x201A; // SINGLE LOW-9 QUOTATION MARK
  1568. case 0x83: return 0x0192; // LATIN SMALL LETTER F WITH HOOK
  1569. case 0x84: return 0x201E; // DOUBLE LOW-9 QUOTATION MARK
  1570. case 0x85: return 0x2026; // HORIZONTAL ELLIPSIS
  1571. case 0x86: return 0x2020; // DAGGER
  1572. case 0x87: return 0x2021; // DOUBLE DAGGER
  1573. case 0x88: return 0x02C6; // MODIFIER LETTER CIRCUMFLEX ACCENT
  1574. case 0x89: return 0x2030; // PER MILLE SIGN
  1575. case 0x8A: return 0x0160; // LATIN CAPITAL LETTER S WITH CARON
  1576. case 0x8B: return 0x2039; // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
  1577. case 0x8C: return 0x0152; // LATIN CAPITAL LIGATURE OE
  1578. case 0x8D: return 0x008D; // <control>
  1579. case 0x8E: return 0x017D; // LATIN CAPITAL LETTER Z WITH CARON
  1580. case 0x8F: return 0x008F; // <control>
  1581. case 0x90: return 0x0090; // <control>
  1582. case 0x91: return 0x2018; // LEFT SINGLE QUOTATION MARK
  1583. case 0x92: return 0x2019; // RIGHT SINGLE QUOTATION MARK
  1584. case 0x93: return 0x201C; // LEFT DOUBLE QUOTATION MARK
  1585. case 0x94: return 0x201D; // RIGHT DOUBLE QUOTATION MARK
  1586. case 0x95: return 0x2022; // BULLET
  1587. case 0x96: return 0x2013; // EN DASH
  1588. case 0x97: return 0x2014; // EM DASH
  1589. case 0x98: return 0x02DC; // SMALL TILDE
  1590. case 0x99: return 0x2122; // TRADE MARK SIGN
  1591. case 0x9A: return 0x0161; // LATIN SMALL LETTER S WITH CARON
  1592. case 0x9B: return 0x203A; // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
  1593. case 0x9C: return 0x0153; // LATIN SMALL LIGATURE OE
  1594. case 0x9D: return 0x009D; // <control>
  1595. case 0x9E: return 0x017E; // LATIN SMALL LETTER Z WITH CARON
  1596. case 0x9F: return 0x0178; // LATIN CAPITAL LETTER Y WITH DIAERESIS
  1597. default:
  1598. if ((c >= 0xD800 && c <= 0xDFFF) || c > 0x10FFFF) {
  1599. return 0xFFFD;
  1600. } else if ((c >= 0x0001 && c <= 0x0008) || (c >= 0x000E && c <= 0x001F) ||
  1601. (c >= 0x007F && c <= 0x009F) || (c >= 0xFDD0 && c <= 0xFDEF) ||
  1602. c == 0x000B || c == 0xFFFE || c == 0x1FFFE || c == 0x2FFFFE ||
  1603. c == 0x2FFFF || c == 0x3FFFE || c == 0x3FFFF || c == 0x4FFFE ||
  1604. c == 0x4FFFF || c == 0x5FFFE || c == 0x5FFFF || c == 0x6FFFE ||
  1605. c == 0x6FFFF || c == 0x7FFFE || c == 0x7FFFF || c == 0x8FFFE ||
  1606. c == 0x8FFFF || c == 0x9FFFE || c == 0x9FFFF || c == 0xAFFFE ||
  1607. c == 0xAFFFF || c == 0xBFFFE || c == 0xBFFFF || c == 0xCFFFE ||
  1608. c == 0xCFFFF || c == 0xDFFFE || c == 0xDFFFF || c == 0xEFFFE ||
  1609. c == 0xEFFFF || c == 0xFFFFE || c == 0xFFFFF || c == 0x10FFFE ||
  1610. c == 0x10FFFF) {
  1611. return c;
  1612. }
  1613. }
  1614. };
  1615. exports.EntityParser = EntityParser;
  1616. },
  1617. {"./InputStream":3,"html5-entities":12}],
  1618. 3:[function(_dereq_,module,exports){
  1619. function InputStream() {
  1620. this.data = '';
  1621. this.start = 0;
  1622. this.committed = 0;
  1623. this.eof = false;
  1624. this.lastLocation = {line: 0, column: 0};
  1625. }
  1626. InputStream.EOF = -1;
  1627. InputStream.DRAIN = -2;
  1628. InputStream.prototype = {
  1629. slice: function() {
  1630. if(this.start >= this.data.length) {
  1631. if(!this.eof) throw InputStream.DRAIN;
  1632. return InputStream.EOF;
  1633. }
  1634. return this.data.slice(this.start, this.data.length);
  1635. },
  1636. char: function() {
  1637. if(!this.eof && this.start >= this.data.length - 1) throw InputStream.DRAIN;
  1638. if(this.start >= this.data.length) {
  1639. return InputStream.EOF;
  1640. }
  1641. var ch = this.data[this.start++];
  1642. if (ch === '\r')
  1643. ch = '\n';
  1644. return ch;
  1645. },
  1646. advance: function(amount) {
  1647. this.start += amount;
  1648. if(this.start >= this.data.length) {
  1649. if(!this.eof) throw InputStream.DRAIN;
  1650. return InputStream.EOF;
  1651. } else {
  1652. if(this.committed > this.data.length / 2) {
  1653. this.lastLocation = this.location();
  1654. this.data = this.data.slice(this.committed);
  1655. this.start = this.start - this.committed;
  1656. this.committed = 0;
  1657. }
  1658. }
  1659. },
  1660. matchWhile: function(re) {
  1661. if(this.eof && this.start >= this.data.length ) return '';
  1662. var r = new RegExp("^"+re+"+");
  1663. var m = r.exec(this.slice());
  1664. if(m) {
  1665. if(!this.eof && m[0].length == this.data.length - this.start) throw InputStream.DRAIN;
  1666. this.advance(m[0].length);
  1667. return m[0];
  1668. } else {
  1669. return '';
  1670. }
  1671. },
  1672. matchUntil: function(re) {
  1673. var m, s;
  1674. s = this.slice();
  1675. if(s === InputStream.EOF) {
  1676. return '';
  1677. } else if(m = new RegExp(re + (this.eof ? "|$" : "")).exec(s)) {
  1678. var t = this.data.slice(this.start, this.start + m.index);
  1679. this.advance(m.index);
  1680. return t.replace(/\r/g, '\n').replace(/\n{2,}/g, '\n');
  1681. } else {
  1682. throw InputStream.DRAIN;
  1683. }
  1684. },
  1685. append: function(data) {
  1686. this.data += data;
  1687. },
  1688. shift: function(n) {
  1689. if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN;
  1690. if(this.eof && this.start >= this.data.length) return InputStream.EOF;
  1691. var d = this.data.slice(this.start, this.start + n).toString();
  1692. this.advance(Math.min(n, this.data.length - this.start));
  1693. return d;
  1694. },
  1695. peek: function(n) {
  1696. if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN;
  1697. if(this.eof && this.start >= this.data.length) return InputStream.EOF;
  1698. return this.data.slice(this.start, Math.min(this.start + n, this.data.length)).toString();
  1699. },
  1700. length: function() {
  1701. return this.data.length - this.start - 1;
  1702. },
  1703. unget: function(d) {
  1704. if(d === InputStream.EOF) return;
  1705. this.start -= (d.length);
  1706. },
  1707. undo: function() {
  1708. this.start = this.committed;
  1709. },
  1710. commit: function() {
  1711. this.committed = this.start;
  1712. },
  1713. location: function() {
  1714. var lastLine = this.lastLocation.line;
  1715. var lastColumn = this.lastLocation.column;
  1716. var read = this.data.slice(0, this.committed);
  1717. var newlines = read.match(/\n/g);
  1718. var line = newlines ? lastLine + newlines.length : lastLine;
  1719. var column = newlines ? read.length - read.lastIndexOf('\n') - 1 : lastColumn + read.length;
  1720. return {line: line, column: column};
  1721. }
  1722. };
  1723. exports.InputStream = InputStream;
  1724. },
  1725. {}],
  1726. 4:[function(_dereq_,module,exports){
  1727. var SpecialElements = {
  1728. "http://www.w3.org/1999/xhtml": [
  1729. 'address',
  1730. 'applet',
  1731. 'area',
  1732. 'article',
  1733. 'aside',
  1734. 'base',
  1735. 'basefont',
  1736. 'bgsound',
  1737. 'blockquote',
  1738. 'body',
  1739. 'br',
  1740. 'button',
  1741. 'caption',
  1742. 'center',
  1743. 'col',
  1744. 'colgroup',
  1745. 'dd',
  1746. 'details',
  1747. 'dir',
  1748. 'div',
  1749. 'dl',
  1750. 'dt',
  1751. 'embed',
  1752. 'fieldset',
  1753. 'figcaption',
  1754. 'figure',
  1755. 'footer',
  1756. 'form',
  1757. 'frame',
  1758. 'frameset',
  1759. 'h1',
  1760. 'h2',
  1761. 'h3',
  1762. 'h4',
  1763. 'h5',
  1764. 'h6',
  1765. 'head',
  1766. 'header',
  1767. 'hgroup',
  1768. 'hr',
  1769. 'html',
  1770. 'iframe',
  1771. 'img',
  1772. 'input',
  1773. 'isindex',
  1774. 'li',
  1775. 'link',
  1776. 'listing',
  1777. 'main',
  1778. 'marquee',
  1779. 'menu',
  1780. 'menuitem',
  1781. 'meta',
  1782. 'nav',
  1783. 'noembed',
  1784. 'noframes',
  1785. 'noscript',
  1786. 'object',
  1787. 'ol',
  1788. 'p',
  1789. 'param',
  1790. 'plaintext',
  1791. 'pre',
  1792. 'script',
  1793. 'section',
  1794. 'select',
  1795. 'source',
  1796. 'style',
  1797. 'summary',
  1798. 'table',
  1799. 'tbody',
  1800. 'td',
  1801. 'textarea',
  1802. 'tfoot',
  1803. 'th',
  1804. 'thead',
  1805. 'title',
  1806. 'tr',
  1807. 'track',
  1808. 'ul',
  1809. 'wbr',
  1810. 'xmp'
  1811. ],
  1812. "http://www.w3.org/1998/Math/MathML": [
  1813. 'mi',
  1814. 'mo',
  1815. 'mn',
  1816. 'ms',
  1817. 'mtext',
  1818. 'annotation-xml'
  1819. ],
  1820. "http://www.w3.org/2000/svg": [
  1821. 'foreignObject',
  1822. 'desc',
  1823. 'title'
  1824. ]
  1825. };
  1826. function StackItem(namespaceURI, localName, attributes, node) {
  1827. this.localName = localName;
  1828. this.namespaceURI = namespaceURI;
  1829. this.attributes = attributes;
  1830. this.node = node;
  1831. }
  1832. StackItem.prototype.isSpecial = function() {
  1833. return this.namespaceURI in SpecialElements &&
  1834. SpecialElements[this.namespaceURI].indexOf(this.localName) > -1;
  1835. };
  1836. StackItem.prototype.isFosterParenting = function() {
  1837. if (this.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1838. return this.localName === 'table' ||
  1839. this.localName === 'tbody' ||
  1840. this.localName === 'tfoot' ||
  1841. this.localName === 'thead' ||
  1842. this.localName === 'tr';
  1843. }
  1844. return false;
  1845. };
  1846. StackItem.prototype.isNumberedHeader = function() {
  1847. if (this.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1848. return this.localName === 'h1' ||
  1849. this.localName === 'h2' ||
  1850. this.localName === 'h3' ||
  1851. this.localName === 'h4' ||
  1852. this.localName === 'h5' ||
  1853. this.localName === 'h6';
  1854. }
  1855. return false;
  1856. };
  1857. StackItem.prototype.isForeign = function() {
  1858. return this.namespaceURI != "http://www.w3.org/1999/xhtml";
  1859. };
  1860. function getAttribute(item, name) {
  1861. for (var i = 0; i < item.attributes.length; i++) {
  1862. if (item.attributes[i].nodeName == name)
  1863. return item.attributes[i].nodeValue;
  1864. }
  1865. return null;
  1866. }
  1867. StackItem.prototype.isHtmlIntegrationPoint = function() {
  1868. if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1869. if (this.localName !== "annotation-xml")
  1870. return false;
  1871. var encoding = getAttribute(this, 'encoding');
  1872. if (!encoding)
  1873. return false;
  1874. encoding = encoding.toLowerCase();
  1875. return encoding === "text/html" || encoding === "application/xhtml+xml";
  1876. }
  1877. if (this.namespaceURI === "http://www.w3.org/2000/svg") {
  1878. return this.localName === "foreignObject"
  1879. || this.localName === "desc"
  1880. || this.localName === "title";
  1881. }
  1882. return false;
  1883. };
  1884. StackItem.prototype.isMathMLTextIntegrationPoint = function() {
  1885. if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1886. return this.localName === "mi"
  1887. || this.localName === "mo"
  1888. || this.localName === "mn"
  1889. || this.localName === "ms"
  1890. || this.localName === "mtext";
  1891. }
  1892. return false;
  1893. };
  1894. exports.StackItem = StackItem;
  1895. },
  1896. {}],
  1897. 5:[function(_dereq_,module,exports){
  1898. var InputStream = _dereq_('./InputStream').InputStream;
  1899. var EntityParser = _dereq_('./EntityParser').EntityParser;
  1900. function isWhitespace(c){
  1901. return c === " " || c === "\n" || c === "\t" || c === "\r" || c === "\f";
  1902. }
  1903. function isAlpha(c) {
  1904. return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
  1905. }
  1906. function Tokenizer(tokenHandler) {
  1907. this._tokenHandler = tokenHandler;
  1908. this._state = Tokenizer.DATA;
  1909. this._inputStream = new InputStream();
  1910. this._currentToken = null;
  1911. this._temporaryBuffer = '';
  1912. this._additionalAllowedCharacter = '';
  1913. }
  1914. Tokenizer.prototype._parseError = function(code, args) {
  1915. this._tokenHandler.parseError(code, args);
  1916. };
  1917. Tokenizer.prototype._emitToken = function(token) {
  1918. if (token.type === 'StartTag') {
  1919. for (var i = 1; i < token.data.length; i++) {
  1920. if (!token.data[i].nodeName)
  1921. token.data.splice(i--, 1);
  1922. }
  1923. } else if (token.type === 'EndTag') {
  1924. if (token.selfClosing) {
  1925. this._parseError('self-closing-flag-on-end-tag');
  1926. }
  1927. if (token.data.length !== 0) {
  1928. this._parseError('attributes-in-end-tag');
  1929. }
  1930. }
  1931. this._tokenHandler.processToken(token);
  1932. if (token.type === 'StartTag' && token.selfClosing && !this._tokenHandler.isSelfClosingFlagAcknowledged()) {
  1933. this._parseError('non-void-element-with-trailing-solidus', {name: token.name});
  1934. }
  1935. };
  1936. Tokenizer.prototype._emitCurrentToken = function() {
  1937. this._state = Tokenizer.DATA;
  1938. this._emitToken(this._currentToken);
  1939. };
  1940. Tokenizer.prototype._currentAttribute = function() {
  1941. return this._currentToken.data[this._currentToken.data.length - 1];
  1942. };
  1943. Tokenizer.prototype.setState = function(state) {
  1944. this._state = state;
  1945. };
  1946. Tokenizer.prototype.tokenize = function(source) {
  1947. Tokenizer.DATA = data_state;
  1948. Tokenizer.RCDATA = rcdata_state;
  1949. Tokenizer.RAWTEXT = rawtext_state;
  1950. Tokenizer.SCRIPT_DATA = script_data_state;
  1951. Tokenizer.PLAINTEXT = plaintext_state;
  1952. this._state = Tokenizer.DATA;
  1953. this._inputStream.append(source);
  1954. this._tokenHandler.startTokenization(this);
  1955. this._inputStream.eof = true;
  1956. var tokenizer = this;
  1957. while (this._state.call(this, this._inputStream));
  1958. function data_state(buffer) {
  1959. var data = buffer.char();
  1960. if (data === InputStream.EOF) {
  1961. tokenizer._emitToken({type: 'EOF', data: null});
  1962. return false;
  1963. } else if (data === '&') {
  1964. tokenizer.setState(character_reference_in_data_state);
  1965. } else if (data === '<') {
  1966. tokenizer.setState(tag_open_state);
  1967. } else if (data === '\u0000') {
  1968. tokenizer._emitToken({type: 'Characters', data: data});
  1969. buffer.commit();
  1970. } else {
  1971. var chars = buffer.matchUntil("&|<|\u0000");
  1972. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1973. buffer.commit();
  1974. }
  1975. return true;
  1976. }
  1977. function character_reference_in_data_state(buffer) {
  1978. var character = EntityParser.consumeEntity(buffer, tokenizer);
  1979. tokenizer.setState(data_state);
  1980. tokenizer._emitToken({type: 'Characters', data: character || '&'});
  1981. return true;
  1982. }
  1983. function rcdata_state(buffer) {
  1984. var data = buffer.char();
  1985. if (data === InputStream.EOF) {
  1986. tokenizer._emitToken({type: 'EOF', data: null});
  1987. return false;
  1988. } else if (data === '&') {
  1989. tokenizer.setState(character_reference_in_rcdata_state);
  1990. } else if (data === '<') {
  1991. tokenizer.setState(rcdata_less_than_sign_state);
  1992. } else if (data === "\u0000") {
  1993. tokenizer._parseError("invalid-codepoint");
  1994. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  1995. buffer.commit();
  1996. } else {
  1997. var chars = buffer.matchUntil("&|<|\u0000");
  1998. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1999. buffer.commit();
  2000. }
  2001. return true;
  2002. }
  2003. function character_reference_in_rcdata_state(buffer) {
  2004. var character = EntityParser.consumeEntity(buffer, tokenizer);
  2005. tokenizer.setState(rcdata_state);
  2006. tokenizer._emitToken({type: 'Characters', data: character || '&'});
  2007. return true;
  2008. }
  2009. function rawtext_state(buffer) {
  2010. var data = buffer.char();
  2011. if (data === InputStream.EOF) {
  2012. tokenizer._emitToken({type: 'EOF', data: null});
  2013. return false;
  2014. } else if (data === '<') {
  2015. tokenizer.setState(rawtext_less_than_sign_state);
  2016. } else if (data === "\u0000") {
  2017. tokenizer._parseError("invalid-codepoint");
  2018. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2019. buffer.commit();
  2020. } else {
  2021. var chars = buffer.matchUntil("<|\u0000");
  2022. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2023. }
  2024. return true;
  2025. }
  2026. function plaintext_state(buffer) {
  2027. var data = buffer.char();
  2028. if (data === InputStream.EOF) {
  2029. tokenizer._emitToken({type: 'EOF', data: null});
  2030. return false;
  2031. } else if (data === "\u0000") {
  2032. tokenizer._parseError("invalid-codepoint");
  2033. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2034. buffer.commit();
  2035. } else {
  2036. var chars = buffer.matchUntil("\u0000");
  2037. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2038. }
  2039. return true;
  2040. }
  2041. function script_data_state(buffer) {
  2042. var data = buffer.char();
  2043. if (data === InputStream.EOF) {
  2044. tokenizer._emitToken({type: 'EOF', data: null});
  2045. return false;
  2046. } else if (data === '<') {
  2047. tokenizer.setState(script_data_less_than_sign_state);
  2048. } else if (data === '\u0000') {
  2049. tokenizer._parseError("invalid-codepoint");
  2050. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2051. buffer.commit();
  2052. } else {
  2053. var chars = buffer.matchUntil("<|\u0000");
  2054. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2055. }
  2056. return true;
  2057. }
  2058. function rcdata_less_than_sign_state(buffer) {
  2059. var data = buffer.char();
  2060. if (data === "/") {
  2061. this._temporaryBuffer = '';
  2062. tokenizer.setState(rcdata_end_tag_open_state);
  2063. } else {
  2064. tokenizer._emitToken({type: 'Characters', data: '<'});
  2065. buffer.unget(data);
  2066. tokenizer.setState(rcdata_state);
  2067. }
  2068. return true;
  2069. }
  2070. function rcdata_end_tag_open_state(buffer) {
  2071. var data = buffer.char();
  2072. if (isAlpha(data)) {
  2073. this._temporaryBuffer += data;
  2074. tokenizer.setState(rcdata_end_tag_name_state);
  2075. } else {
  2076. tokenizer._emitToken({type: 'Characters', data: '</'});
  2077. buffer.unget(data);
  2078. tokenizer.setState(rcdata_state);
  2079. }
  2080. return true;
  2081. }
  2082. function rcdata_end_tag_name_state(buffer) {
  2083. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2084. var data = buffer.char();
  2085. if (isWhitespace(data) && appropriate) {
  2086. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2087. tokenizer.setState(before_attribute_name_state);
  2088. } else if (data === '/' && appropriate) {
  2089. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2090. tokenizer.setState(self_closing_tag_state);
  2091. } else if (data === '>' && appropriate) {
  2092. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2093. tokenizer._emitCurrentToken();
  2094. tokenizer.setState(data_state);
  2095. } else if (isAlpha(data)) {
  2096. this._temporaryBuffer += data;
  2097. buffer.commit();
  2098. } else {
  2099. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2100. buffer.unget(data);
  2101. tokenizer.setState(rcdata_state);
  2102. }
  2103. return true;
  2104. }
  2105. function rawtext_less_than_sign_state(buffer) {
  2106. var data = buffer.char();
  2107. if (data === "/") {
  2108. this._temporaryBuffer = '';
  2109. tokenizer.setState(rawtext_end_tag_open_state);
  2110. } else {
  2111. tokenizer._emitToken({type: 'Characters', data: '<'});
  2112. buffer.unget(data);
  2113. tokenizer.setState(rawtext_state);
  2114. }
  2115. return true;
  2116. }
  2117. function rawtext_end_tag_open_state(buffer) {
  2118. var data = buffer.char();
  2119. if (isAlpha(data)) {
  2120. this._temporaryBuffer += data;
  2121. tokenizer.setState(rawtext_end_tag_name_state);
  2122. } else {
  2123. tokenizer._emitToken({type: 'Characters', data: '</'});
  2124. buffer.unget(data);
  2125. tokenizer.setState(rawtext_state);
  2126. }
  2127. return true;
  2128. }
  2129. function rawtext_end_tag_name_state(buffer) {
  2130. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2131. var data = buffer.char();
  2132. if (isWhitespace(data) && appropriate) {
  2133. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2134. tokenizer.setState(before_attribute_name_state);
  2135. } else if (data === '/' && appropriate) {
  2136. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2137. tokenizer.setState(self_closing_tag_state);
  2138. } else if (data === '>' && appropriate) {
  2139. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2140. tokenizer._emitCurrentToken();
  2141. tokenizer.setState(data_state);
  2142. } else if (isAlpha(data)) {
  2143. this._temporaryBuffer += data;
  2144. buffer.commit();
  2145. } else {
  2146. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2147. buffer.unget(data);
  2148. tokenizer.setState(rawtext_state);
  2149. }
  2150. return true;
  2151. }
  2152. function script_data_less_than_sign_state(buffer) {
  2153. var data = buffer.char();
  2154. if (data === "/") {
  2155. this._temporaryBuffer = '';
  2156. tokenizer.setState(script_data_end_tag_open_state);
  2157. } else if (data === '!') {
  2158. tokenizer._emitToken({type: 'Characters', data: '<!'});
  2159. tokenizer.setState(script_data_escape_start_state);
  2160. } else {
  2161. tokenizer._emitToken({type: 'Characters', data: '<'});
  2162. buffer.unget(data);
  2163. tokenizer.setState(script_data_state);
  2164. }
  2165. return true;
  2166. }
  2167. function script_data_end_tag_open_state(buffer) {
  2168. var data = buffer.char();
  2169. if (isAlpha(data)) {
  2170. this._temporaryBuffer += data;
  2171. tokenizer.setState(script_data_end_tag_name_state);
  2172. } else {
  2173. tokenizer._emitToken({type: 'Characters', data: '</'});
  2174. buffer.unget(data);
  2175. tokenizer.setState(script_data_state);
  2176. }
  2177. return true;
  2178. }
  2179. function script_data_end_tag_name_state(buffer) {
  2180. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2181. var data = buffer.char();
  2182. if (isWhitespace(data) && appropriate) {
  2183. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2184. tokenizer.setState(before_attribute_name_state);
  2185. } else if (data === '/' && appropriate) {
  2186. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2187. tokenizer.setState(self_closing_tag_state);
  2188. } else if (data === '>' && appropriate) {
  2189. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2190. tokenizer._emitCurrentToken();
  2191. } else if (isAlpha(data)) {
  2192. this._temporaryBuffer += data;
  2193. buffer.commit();
  2194. } else {
  2195. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2196. buffer.unget(data);
  2197. tokenizer.setState(script_data_state);
  2198. }
  2199. return true;
  2200. }
  2201. function script_data_escape_start_state(buffer) {
  2202. var data = buffer.char();
  2203. if (data === '-') {
  2204. tokenizer._emitToken({type: 'Characters', data: '-'});
  2205. tokenizer.setState(script_data_escape_start_dash_state);
  2206. } else {
  2207. buffer.unget(data);
  2208. tokenizer.setState(script_data_state);
  2209. }
  2210. return true;
  2211. }
  2212. function script_data_escape_start_dash_state(buffer) {
  2213. var data = buffer.char();
  2214. if (data === '-') {
  2215. tokenizer._emitToken({type: 'Characters', data: '-'});
  2216. tokenizer.setState(script_data_escaped_dash_dash_state);
  2217. } else {
  2218. buffer.unget(data);
  2219. tokenizer.setState(script_data_state);
  2220. }
  2221. return true;
  2222. }
  2223. function script_data_escaped_state(buffer) {
  2224. var data = buffer.char();
  2225. if (data === InputStream.EOF) {
  2226. buffer.unget(data);
  2227. tokenizer.setState(data_state);
  2228. } else if (data === '-') {
  2229. tokenizer._emitToken({type: 'Characters', data: '-'});
  2230. tokenizer.setState(script_data_escaped_dash_state);
  2231. } else if (data === '<') {
  2232. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2233. } else if (data === '\u0000') {
  2234. tokenizer._parseError("invalid-codepoint");
  2235. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2236. buffer.commit();
  2237. } else {
  2238. var chars = buffer.matchUntil('<|-|\u0000');
  2239. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2240. }
  2241. return true;
  2242. }
  2243. function script_data_escaped_dash_state(buffer) {
  2244. var data = buffer.char();
  2245. if (data === InputStream.EOF) {
  2246. buffer.unget(data);
  2247. tokenizer.setState(data_state);
  2248. } else if (data === '-') {
  2249. tokenizer._emitToken({type: 'Characters', data: '-'});
  2250. tokenizer.setState(script_data_escaped_dash_dash_state);
  2251. } else if (data === '<') {
  2252. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2253. } else if (data === '\u0000') {
  2254. tokenizer._parseError("invalid-codepoint");
  2255. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2256. tokenizer.setState(script_data_escaped_state);
  2257. } else {
  2258. tokenizer._emitToken({type: 'Characters', data: data});
  2259. tokenizer.setState(script_data_escaped_state);
  2260. }
  2261. return true;
  2262. }
  2263. function script_data_escaped_dash_dash_state(buffer) {
  2264. var data = buffer.char();
  2265. if (data === InputStream.EOF) {
  2266. tokenizer._parseError('eof-in-script');
  2267. buffer.unget(data);
  2268. tokenizer.setState(data_state);
  2269. } else if (data === '<') {
  2270. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2271. } else if (data === '>') {
  2272. tokenizer._emitToken({type: 'Characters', data: '>'});
  2273. tokenizer.setState(script_data_state);
  2274. } else if (data === '\u0000') {
  2275. tokenizer._parseError("invalid-codepoint");
  2276. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2277. tokenizer.setState(script_data_escaped_state);
  2278. } else {
  2279. tokenizer._emitToken({type: 'Characters', data: data});
  2280. tokenizer.setState(script_data_escaped_state);
  2281. }
  2282. return true;
  2283. }
  2284. function script_data_escaped_less_then_sign_state(buffer) {
  2285. var data = buffer.char();
  2286. if (data === '/') {
  2287. this._temporaryBuffer = '';
  2288. tokenizer.setState(script_data_escaped_end_tag_open_state);
  2289. } else if (isAlpha(data)) {
  2290. tokenizer._emitToken({type: 'Characters', data: '<' + data});
  2291. this._temporaryBuffer = data;
  2292. tokenizer.setState(script_data_double_escape_start_state);
  2293. } else {
  2294. tokenizer._emitToken({type: 'Characters', data: '<'});
  2295. buffer.unget(data);
  2296. tokenizer.setState(script_data_escaped_state);
  2297. }
  2298. return true;
  2299. }
  2300. function script_data_escaped_end_tag_open_state(buffer) {
  2301. var data = buffer.char();
  2302. if (isAlpha(data)) {
  2303. this._temporaryBuffer = data;
  2304. tokenizer.setState(script_data_escaped_end_tag_name_state);
  2305. } else {
  2306. tokenizer._emitToken({type: 'Characters', data: '</'});
  2307. buffer.unget(data);
  2308. tokenizer.setState(script_data_escaped_state);
  2309. }
  2310. return true;
  2311. }
  2312. function script_data_escaped_end_tag_name_state(buffer) {
  2313. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2314. var data = buffer.char();
  2315. if (isWhitespace(data) && appropriate) {
  2316. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2317. tokenizer.setState(before_attribute_name_state);
  2318. } else if (data === '/' && appropriate) {
  2319. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2320. tokenizer.setState(self_closing_tag_state);
  2321. } else if (data === '>' && appropriate) {
  2322. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2323. tokenizer.setState(data_state);
  2324. tokenizer._emitCurrentToken();
  2325. } else if (isAlpha(data)) {
  2326. this._temporaryBuffer += data;
  2327. buffer.commit();
  2328. } else {
  2329. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2330. buffer.unget(data);
  2331. tokenizer.setState(script_data_escaped_state);
  2332. }
  2333. return true;
  2334. }
  2335. function script_data_double_escape_start_state(buffer) {
  2336. var data = buffer.char();
  2337. if (isWhitespace(data) || data === '/' || data === '>') {
  2338. tokenizer._emitToken({type: 'Characters', data: data});
  2339. if (this._temporaryBuffer.toLowerCase() === 'script')
  2340. tokenizer.setState(script_data_double_escaped_state);
  2341. else
  2342. tokenizer.setState(script_data_escaped_state);
  2343. } else if (isAlpha(data)) {
  2344. tokenizer._emitToken({type: 'Characters', data: data});
  2345. this._temporaryBuffer += data;
  2346. buffer.commit();
  2347. } else {
  2348. buffer.unget(data);
  2349. tokenizer.setState(script_data_escaped_state);
  2350. }
  2351. return true;
  2352. }
  2353. function script_data_double_escaped_state(buffer) {
  2354. var data = buffer.char();
  2355. if (data === InputStream.EOF) {
  2356. tokenizer._parseError('eof-in-script');
  2357. buffer.unget(data);
  2358. tokenizer.setState(data_state);
  2359. } else if (data === '-') {
  2360. tokenizer._emitToken({type: 'Characters', data: '-'});
  2361. tokenizer.setState(script_data_double_escaped_dash_state);
  2362. } else if (data === '<') {
  2363. tokenizer._emitToken({type: 'Characters', data: '<'});
  2364. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2365. } else if (data === '\u0000') {
  2366. tokenizer._parseError('invalid-codepoint');
  2367. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2368. buffer.commit();
  2369. } else {
  2370. tokenizer._emitToken({type: 'Characters', data: data});
  2371. buffer.commit();
  2372. }
  2373. return true;
  2374. }
  2375. function script_data_double_escaped_dash_state(buffer) {
  2376. var data = buffer.char();
  2377. if (data === InputStream.EOF) {
  2378. tokenizer._parseError('eof-in-script');
  2379. buffer.unget(data);
  2380. tokenizer.setState(data_state);
  2381. } else if (data === '-') {
  2382. tokenizer._emitToken({type: 'Characters', data: '-'});
  2383. tokenizer.setState(script_data_double_escaped_dash_dash_state);
  2384. } else if (data === '<') {
  2385. tokenizer._emitToken({type: 'Characters', data: '<'});
  2386. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2387. } else if (data === '\u0000') {
  2388. tokenizer._parseError('invalid-codepoint');
  2389. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2390. tokenizer.setState(script_data_double_escaped_state);
  2391. } else {
  2392. tokenizer._emitToken({type: 'Characters', data: data});
  2393. tokenizer.setState(script_data_double_escaped_state);
  2394. }
  2395. return true;
  2396. }
  2397. function script_data_double_escaped_dash_dash_state(buffer) {
  2398. var data = buffer.char();
  2399. if (data === InputStream.EOF) {
  2400. tokenizer._parseError('eof-in-script');
  2401. buffer.unget(data);
  2402. tokenizer.setState(data_state);
  2403. } else if (data === '-') {
  2404. tokenizer._emitToken({type: 'Characters', data: '-'});
  2405. buffer.commit();
  2406. } else if (data === '<') {
  2407. tokenizer._emitToken({type: 'Characters', data: '<'});
  2408. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2409. } else if (data === '>') {
  2410. tokenizer._emitToken({type: 'Characters', data: '>'});
  2411. tokenizer.setState(script_data_state);
  2412. } else if (data === '\u0000') {
  2413. tokenizer._parseError('invalid-codepoint');
  2414. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2415. tokenizer.setState(script_data_double_escaped_state);
  2416. } else {
  2417. tokenizer._emitToken({type: 'Characters', data: data});
  2418. tokenizer.setState(script_data_double_escaped_state);
  2419. }
  2420. return true;
  2421. }
  2422. function script_data_double_escaped_less_than_sign_state(buffer) {
  2423. var data = buffer.char();
  2424. if (data === '/') {
  2425. tokenizer._emitToken({type: 'Characters', data: '/'});
  2426. this._temporaryBuffer = '';
  2427. tokenizer.setState(script_data_double_escape_end_state);
  2428. } else {
  2429. buffer.unget(data);
  2430. tokenizer.setState(script_data_double_escaped_state);
  2431. }
  2432. return true;
  2433. }
  2434. function script_data_double_escape_end_state(buffer) {
  2435. var data = buffer.char();
  2436. if (isWhitespace(data) || data === '/' || data === '>') {
  2437. tokenizer._emitToken({type: 'Characters', data: data});
  2438. if (this._temporaryBuffer.toLowerCase() === 'script')
  2439. tokenizer.setState(script_data_escaped_state);
  2440. else
  2441. tokenizer.setState(script_data_double_escaped_state);
  2442. } else if (isAlpha(data)) {
  2443. tokenizer._emitToken({type: 'Characters', data: data});
  2444. this._temporaryBuffer += data;
  2445. buffer.commit();
  2446. } else {
  2447. buffer.unget(data);
  2448. tokenizer.setState(script_data_double_escaped_state);
  2449. }
  2450. return true;
  2451. }
  2452. function tag_open_state(buffer) {
  2453. var data = buffer.char();
  2454. if (data === InputStream.EOF) {
  2455. tokenizer._parseError("bare-less-than-sign-at-eof");
  2456. tokenizer._emitToken({type: 'Characters', data: '<'});
  2457. buffer.unget(data);
  2458. tokenizer.setState(data_state);
  2459. } else if (isAlpha(data)) {
  2460. tokenizer._currentToken = {type: 'StartTag', name: data.toLowerCase(), data: []};
  2461. tokenizer.setState(tag_name_state);
  2462. } else if (data === '!') {
  2463. tokenizer.setState(markup_declaration_open_state);
  2464. } else if (data === '/') {
  2465. tokenizer.setState(close_tag_open_state);
  2466. } else if (data === '>') {
  2467. tokenizer._parseError("expected-tag-name-but-got-right-bracket");
  2468. tokenizer._emitToken({type: 'Characters', data: "<>"});
  2469. tokenizer.setState(data_state);
  2470. } else if (data === '?') {
  2471. tokenizer._parseError("expected-tag-name-but-got-question-mark");
  2472. buffer.unget(data);
  2473. tokenizer.setState(bogus_comment_state);
  2474. } else {
  2475. tokenizer._parseError("expected-tag-name");
  2476. tokenizer._emitToken({type: 'Characters', data: "<"});
  2477. buffer.unget(data);
  2478. tokenizer.setState(data_state);
  2479. }
  2480. return true;
  2481. }
  2482. function close_tag_open_state(buffer) {
  2483. var data = buffer.char();
  2484. if (data === InputStream.EOF) {
  2485. tokenizer._parseError("expected-closing-tag-but-got-eof");
  2486. tokenizer._emitToken({type: 'Characters', data: '</'});
  2487. buffer.unget(data);
  2488. tokenizer.setState(data_state);
  2489. } else if (isAlpha(data)) {
  2490. tokenizer._currentToken = {type: 'EndTag', name: data.toLowerCase(), data: []};
  2491. tokenizer.setState(tag_name_state);
  2492. } else if (data === '>') {
  2493. tokenizer._parseError("expected-closing-tag-but-got-right-bracket");
  2494. tokenizer.setState(data_state);
  2495. } else {
  2496. tokenizer._parseError("expected-closing-tag-but-got-char", {data: data}); // param 1 is datavars:
  2497. buffer.unget(data);
  2498. tokenizer.setState(bogus_comment_state);
  2499. }
  2500. return true;
  2501. }
  2502. function tag_name_state(buffer) {
  2503. var data = buffer.char();
  2504. if (data === InputStream.EOF) {
  2505. tokenizer._parseError('eof-in-tag-name');
  2506. buffer.unget(data);
  2507. tokenizer.setState(data_state);
  2508. } else if (isWhitespace(data)) {
  2509. tokenizer.setState(before_attribute_name_state);
  2510. } else if (isAlpha(data)) {
  2511. tokenizer._currentToken.name += data.toLowerCase();
  2512. } else if (data === '>') {
  2513. tokenizer._emitCurrentToken();
  2514. } else if (data === '/') {
  2515. tokenizer.setState(self_closing_tag_state);
  2516. } else if (data === '\u0000') {
  2517. tokenizer._parseError("invalid-codepoint");
  2518. tokenizer._currentToken.name += "\uFFFD";
  2519. } else {
  2520. tokenizer._currentToken.name += data;
  2521. }
  2522. buffer.commit();
  2523. return true;
  2524. }
  2525. function before_attribute_name_state(buffer) {
  2526. var data = buffer.char();
  2527. if (data === InputStream.EOF) {
  2528. tokenizer._parseError("expected-attribute-name-but-got-eof");
  2529. buffer.unget(data);
  2530. tokenizer.setState(data_state);
  2531. } else if (isWhitespace(data)) {
  2532. return true;
  2533. } else if (isAlpha(data)) {
  2534. tokenizer._currentToken.data.push({nodeName: data.toLowerCase(), nodeValue: ""});
  2535. tokenizer.setState(attribute_name_state);
  2536. } else if (data === '>') {
  2537. tokenizer._emitCurrentToken();
  2538. } else if (data === '/') {
  2539. tokenizer.setState(self_closing_tag_state);
  2540. } else if (data === "'" || data === '"' || data === '=' || data === '<') {
  2541. tokenizer._parseError("invalid-character-in-attribute-name");
  2542. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2543. tokenizer.setState(attribute_name_state);
  2544. } else if (data === '\u0000') {
  2545. tokenizer._parseError("invalid-codepoint");
  2546. tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""});
  2547. } else {
  2548. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2549. tokenizer.setState(attribute_name_state);
  2550. }
  2551. return true;
  2552. }
  2553. function attribute_name_state(buffer) {
  2554. var data = buffer.char();
  2555. var leavingThisState = true;
  2556. var shouldEmit = false;
  2557. if (data === InputStream.EOF) {
  2558. tokenizer._parseError("eof-in-attribute-name");
  2559. buffer.unget(data);
  2560. tokenizer.setState(data_state);
  2561. shouldEmit = true;
  2562. } else if (data === '=') {
  2563. tokenizer.setState(before_attribute_value_state);
  2564. } else if (isAlpha(data)) {
  2565. tokenizer._currentAttribute().nodeName += data.toLowerCase();
  2566. leavingThisState = false;
  2567. } else if (data === '>') {
  2568. shouldEmit = true;
  2569. } else if (isWhitespace(data)) {
  2570. tokenizer.setState(after_attribute_name_state);
  2571. } else if (data === '/') {
  2572. tokenizer.setState(self_closing_tag_state);
  2573. } else if (data === "'" || data === '"') {
  2574. tokenizer._parseError("invalid-character-in-attribute-name");
  2575. tokenizer._currentAttribute().nodeName += data;
  2576. leavingThisState = false;
  2577. } else if (data === '\u0000') {
  2578. tokenizer._parseError("invalid-codepoint");
  2579. tokenizer._currentAttribute().nodeName += "\uFFFD";
  2580. } else {
  2581. tokenizer._currentAttribute().nodeName += data;
  2582. leavingThisState = false;
  2583. }
  2584. if (leavingThisState) {
  2585. var attributes = tokenizer._currentToken.data;
  2586. var currentAttribute = attributes[attributes.length - 1];
  2587. for (var i = attributes.length - 2; i >= 0; i--) {
  2588. if (currentAttribute.nodeName === attributes[i].nodeName) {
  2589. tokenizer._parseError("duplicate-attribute", {name: currentAttribute.nodeName});
  2590. currentAttribute.nodeName = null;
  2591. break;
  2592. }
  2593. }
  2594. if (shouldEmit)
  2595. tokenizer._emitCurrentToken();
  2596. } else {
  2597. buffer.commit();
  2598. }
  2599. return true;
  2600. }
  2601. function after_attribute_name_state(buffer) {
  2602. var data = buffer.char();
  2603. if (data === InputStream.EOF) {
  2604. tokenizer._parseError("expected-end-of-tag-but-got-eof");
  2605. buffer.unget(data);
  2606. tokenizer.setState(data_state);
  2607. } else if (isWhitespace(data)) {
  2608. return true;
  2609. } else if (data === '=') {
  2610. tokenizer.setState(before_attribute_value_state);
  2611. } else if (data === '>') {
  2612. tokenizer._emitCurrentToken();
  2613. } else if (isAlpha(data)) {
  2614. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2615. tokenizer.setState(attribute_name_state);
  2616. } else if (data === '/') {
  2617. tokenizer.setState(self_closing_tag_state);
  2618. } else if (data === "'" || data === '"' || data === '<') {
  2619. tokenizer._parseError("invalid-character-after-attribute-name");
  2620. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2621. tokenizer.setState(attribute_name_state);
  2622. } else if (data === '\u0000') {
  2623. tokenizer._parseError("invalid-codepoint");
  2624. tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""});
  2625. } else {
  2626. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2627. tokenizer.setState(attribute_name_state);
  2628. }
  2629. return true;
  2630. }
  2631. function before_attribute_value_state(buffer) {
  2632. var data = buffer.char();
  2633. if (data === InputStream.EOF) {
  2634. tokenizer._parseError("expected-attribute-value-but-got-eof");
  2635. buffer.unget(data);
  2636. tokenizer.setState(data_state);
  2637. } else if (isWhitespace(data)) {
  2638. return true;
  2639. } else if (data === '"') {
  2640. tokenizer.setState(attribute_value_double_quoted_state);
  2641. } else if (data === '&') {
  2642. tokenizer.setState(attribute_value_unquoted_state);
  2643. buffer.unget(data);
  2644. } else if (data === "'") {
  2645. tokenizer.setState(attribute_value_single_quoted_state);
  2646. } else if (data === '>') {
  2647. tokenizer._parseError("expected-attribute-value-but-got-right-bracket");
  2648. tokenizer._emitCurrentToken();
  2649. } else if (data === '=' || data === '<' || data === '`') {
  2650. tokenizer._parseError("unexpected-character-in-unquoted-attribute-value");
  2651. tokenizer._currentAttribute().nodeValue += data;
  2652. tokenizer.setState(attribute_value_unquoted_state);
  2653. } else if (data === '\u0000') {
  2654. tokenizer._parseError("invalid-codepoint");
  2655. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2656. } else {
  2657. tokenizer._currentAttribute().nodeValue += data;
  2658. tokenizer.setState(attribute_value_unquoted_state);
  2659. }
  2660. return true;
  2661. }
  2662. function attribute_value_double_quoted_state(buffer) {
  2663. var data = buffer.char();
  2664. if (data === InputStream.EOF) {
  2665. tokenizer._parseError("eof-in-attribute-value-double-quote");
  2666. buffer.unget(data);
  2667. tokenizer.setState(data_state);
  2668. } else if (data === '"') {
  2669. tokenizer.setState(after_attribute_value_state);
  2670. } else if (data === '&') {
  2671. this._additionalAllowedCharacter = '"';
  2672. tokenizer.setState(character_reference_in_attribute_value_state);
  2673. } else if (data === '\u0000') {
  2674. tokenizer._parseError("invalid-codepoint");
  2675. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2676. } else {
  2677. var s = buffer.matchUntil('[\0"&]');
  2678. data = data + s;
  2679. tokenizer._currentAttribute().nodeValue += data;
  2680. }
  2681. return true;
  2682. }
  2683. function attribute_value_single_quoted_state(buffer) {
  2684. var data = buffer.char();
  2685. if (data === InputStream.EOF) {
  2686. tokenizer._parseError("eof-in-attribute-value-single-quote");
  2687. buffer.unget(data);
  2688. tokenizer.setState(data_state);
  2689. } else if (data === "'") {
  2690. tokenizer.setState(after_attribute_value_state);
  2691. } else if (data === '&') {
  2692. this._additionalAllowedCharacter = "'";
  2693. tokenizer.setState(character_reference_in_attribute_value_state);
  2694. } else if (data === '\u0000') {
  2695. tokenizer._parseError("invalid-codepoint");
  2696. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2697. } else {
  2698. tokenizer._currentAttribute().nodeValue += data + buffer.matchUntil("\u0000|['&]");
  2699. }
  2700. return true;
  2701. }
  2702. function attribute_value_unquoted_state(buffer) {
  2703. var data = buffer.char();
  2704. if (data === InputStream.EOF) {
  2705. tokenizer._parseError("eof-after-attribute-value");
  2706. buffer.unget(data);
  2707. tokenizer.setState(data_state);
  2708. } else if (isWhitespace(data)) {
  2709. tokenizer.setState(before_attribute_name_state);
  2710. } else if (data === '&') {
  2711. this._additionalAllowedCharacter = ">";
  2712. tokenizer.setState(character_reference_in_attribute_value_state);
  2713. } else if (data === '>') {
  2714. tokenizer._emitCurrentToken();
  2715. } else if (data === '"' || data === "'" || data === '=' || data === '`' || data === '<') {
  2716. tokenizer._parseError("unexpected-character-in-unquoted-attribute-value");
  2717. tokenizer._currentAttribute().nodeValue += data;
  2718. buffer.commit();
  2719. } else if (data === '\u0000') {
  2720. tokenizer._parseError("invalid-codepoint");
  2721. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2722. } else {
  2723. var o = buffer.matchUntil("\u0000|["+ "\t\n\v\f\x20\r" + "&<>\"'=`" +"]");
  2724. if (o === InputStream.EOF) {
  2725. tokenizer._parseError("eof-in-attribute-value-no-quotes");
  2726. tokenizer._emitCurrentToken();
  2727. }
  2728. buffer.commit();
  2729. tokenizer._currentAttribute().nodeValue += data + o;
  2730. }
  2731. return true;
  2732. }
  2733. function character_reference_in_attribute_value_state(buffer) {
  2734. var character = EntityParser.consumeEntity(buffer, tokenizer, this._additionalAllowedCharacter);
  2735. this._currentAttribute().nodeValue += character || '&';
  2736. if (this._additionalAllowedCharacter === '"')
  2737. tokenizer.setState(attribute_value_double_quoted_state);
  2738. else if (this._additionalAllowedCharacter === '\'')
  2739. tokenizer.setState(attribute_value_single_quoted_state);
  2740. else if (this._additionalAllowedCharacter === '>')
  2741. tokenizer.setState(attribute_value_unquoted_state);
  2742. return true;
  2743. }
  2744. function after_attribute_value_state(buffer) {
  2745. var data = buffer.char();
  2746. if (data === InputStream.EOF) {
  2747. tokenizer._parseError("eof-after-attribute-value");
  2748. buffer.unget(data);
  2749. tokenizer.setState(data_state);
  2750. } else if (isWhitespace(data)) {
  2751. tokenizer.setState(before_attribute_name_state);
  2752. } else if (data === '>') {
  2753. tokenizer.setState(data_state);
  2754. tokenizer._emitCurrentToken();
  2755. } else if (data === '/') {
  2756. tokenizer.setState(self_closing_tag_state);
  2757. } else {
  2758. tokenizer._parseError("unexpected-character-after-attribute-value");
  2759. buffer.unget(data);
  2760. tokenizer.setState(before_attribute_name_state);
  2761. }
  2762. return true;
  2763. }
  2764. function self_closing_tag_state(buffer) {
  2765. var c = buffer.char();
  2766. if (c === InputStream.EOF) {
  2767. tokenizer._parseError("unexpected-eof-after-solidus-in-tag");
  2768. buffer.unget(c);
  2769. tokenizer.setState(data_state);
  2770. } else if (c === '>') {
  2771. tokenizer._currentToken.selfClosing = true;
  2772. tokenizer.setState(data_state);
  2773. tokenizer._emitCurrentToken();
  2774. } else {
  2775. tokenizer._parseError("unexpected-character-after-solidus-in-tag");
  2776. buffer.unget(c);
  2777. tokenizer.setState(before_attribute_name_state);
  2778. }
  2779. return true;
  2780. }
  2781. function bogus_comment_state(buffer) {
  2782. var data = buffer.matchUntil('>');
  2783. data = data.replace(/\u0000/g, "\uFFFD");
  2784. buffer.char();
  2785. tokenizer._emitToken({type: 'Comment', data: data});
  2786. tokenizer.setState(data_state);
  2787. return true;
  2788. }
  2789. function markup_declaration_open_state(buffer) {
  2790. var chars = buffer.shift(2);
  2791. if (chars === '--') {
  2792. tokenizer._currentToken = {type: 'Comment', data: ''};
  2793. tokenizer.setState(comment_start_state);
  2794. } else {
  2795. var newchars = buffer.shift(5);
  2796. if (newchars === InputStream.EOF || chars === InputStream.EOF) {
  2797. tokenizer._parseError("expected-dashes-or-doctype");
  2798. tokenizer.setState(bogus_comment_state);
  2799. buffer.unget(chars);
  2800. return true;
  2801. }
  2802. chars += newchars;
  2803. if (chars.toUpperCase() === 'DOCTYPE') {
  2804. tokenizer._currentToken = {type: 'Doctype', name: '', publicId: null, systemId: null, forceQuirks: false};
  2805. tokenizer.setState(doctype_state);
  2806. } else if (tokenizer._tokenHandler.isCdataSectionAllowed() && chars === '[CDATA[') {
  2807. tokenizer.setState(cdata_section_state);
  2808. } else {
  2809. tokenizer._parseError("expected-dashes-or-doctype");
  2810. buffer.unget(chars);
  2811. tokenizer.setState(bogus_comment_state);
  2812. }
  2813. }
  2814. return true;
  2815. }
  2816. function cdata_section_state(buffer) {
  2817. var data = buffer.matchUntil(']]>');
  2818. buffer.shift(3);
  2819. if (data) {
  2820. tokenizer._emitToken({type: 'Characters', data: data});
  2821. }
  2822. tokenizer.setState(data_state);
  2823. return true;
  2824. }
  2825. function comment_start_state(buffer) {
  2826. var data = buffer.char();
  2827. if (data === InputStream.EOF) {
  2828. tokenizer._parseError("eof-in-comment");
  2829. tokenizer._emitToken(tokenizer._currentToken);
  2830. buffer.unget(data);
  2831. tokenizer.setState(data_state);
  2832. } else if (data === '-') {
  2833. tokenizer.setState(comment_start_dash_state);
  2834. } else if (data === '>') {
  2835. tokenizer._parseError("incorrect-comment");
  2836. tokenizer._emitToken(tokenizer._currentToken);
  2837. tokenizer.setState(data_state);
  2838. } else if (data === '\u0000') {
  2839. tokenizer._parseError("invalid-codepoint");
  2840. tokenizer._currentToken.data += "\uFFFD";
  2841. } else {
  2842. tokenizer._currentToken.data += data;
  2843. tokenizer.setState(comment_state);
  2844. }
  2845. return true;
  2846. }
  2847. function comment_start_dash_state(buffer) {
  2848. var data = buffer.char();
  2849. if (data === InputStream.EOF) {
  2850. tokenizer._parseError("eof-in-comment");
  2851. tokenizer._emitToken(tokenizer._currentToken);
  2852. buffer.unget(data);
  2853. tokenizer.setState(data_state);
  2854. } else if (data === '-') {
  2855. tokenizer.setState(comment_end_state);
  2856. } else if (data === '>') {
  2857. tokenizer._parseError("incorrect-comment");
  2858. tokenizer._emitToken(tokenizer._currentToken);
  2859. tokenizer.setState(data_state);
  2860. } else if (data === '\u0000') {
  2861. tokenizer._parseError("invalid-codepoint");
  2862. tokenizer._currentToken.data += "\uFFFD";
  2863. } else {
  2864. tokenizer._currentToken.data += '-' + data;
  2865. tokenizer.setState(comment_state);
  2866. }
  2867. return true;
  2868. }
  2869. function comment_state(buffer) {
  2870. var data = buffer.char();
  2871. if (data === InputStream.EOF) {
  2872. tokenizer._parseError("eof-in-comment");
  2873. tokenizer._emitToken(tokenizer._currentToken);
  2874. buffer.unget(data);
  2875. tokenizer.setState(data_state);
  2876. } else if (data === '-') {
  2877. tokenizer.setState(comment_end_dash_state);
  2878. } else if (data === '\u0000') {
  2879. tokenizer._parseError("invalid-codepoint");
  2880. tokenizer._currentToken.data += "\uFFFD";
  2881. } else {
  2882. tokenizer._currentToken.data += data;
  2883. buffer.commit();
  2884. }
  2885. return true;
  2886. }
  2887. function comment_end_dash_state(buffer) {
  2888. var data = buffer.char();
  2889. if (data === InputStream.EOF) {
  2890. tokenizer._parseError("eof-in-comment-end-dash");
  2891. tokenizer._emitToken(tokenizer._currentToken);
  2892. buffer.unget(data);
  2893. tokenizer.setState(data_state);
  2894. } else if (data === '-') {
  2895. tokenizer.setState(comment_end_state);
  2896. } else if (data === '\u0000') {
  2897. tokenizer._parseError("invalid-codepoint");
  2898. tokenizer._currentToken.data += "-\uFFFD";
  2899. tokenizer.setState(comment_state);
  2900. } else {
  2901. tokenizer._currentToken.data += '-' + data + buffer.matchUntil('\u0000|-');
  2902. buffer.char();
  2903. }
  2904. return true;
  2905. }
  2906. function comment_end_state(buffer) {
  2907. var data = buffer.char();
  2908. if (data === InputStream.EOF) {
  2909. tokenizer._parseError("eof-in-comment-double-dash");
  2910. tokenizer._emitToken(tokenizer._currentToken);
  2911. buffer.unget(data);
  2912. tokenizer.setState(data_state);
  2913. } else if (data === '>') {
  2914. tokenizer._emitToken(tokenizer._currentToken);
  2915. tokenizer.setState(data_state);
  2916. } else if (data === '!') {
  2917. tokenizer._parseError("unexpected-bang-after-double-dash-in-comment");
  2918. tokenizer.setState(comment_end_bang_state);
  2919. } else if (data === '-') {
  2920. tokenizer._parseError("unexpected-dash-after-double-dash-in-comment");
  2921. tokenizer._currentToken.data += data;
  2922. } else if (data === '\u0000') {
  2923. tokenizer._parseError("invalid-codepoint");
  2924. tokenizer._currentToken.data += "--\uFFFD";
  2925. tokenizer.setState(comment_state);
  2926. } else {
  2927. tokenizer._parseError("unexpected-char-in-comment");
  2928. tokenizer._currentToken.data += '--' + data;
  2929. tokenizer.setState(comment_state);
  2930. }
  2931. return true;
  2932. }
  2933. function comment_end_bang_state(buffer) {
  2934. var data = buffer.char();
  2935. if (data === InputStream.EOF) {
  2936. tokenizer._parseError("eof-in-comment-end-bang-state");
  2937. tokenizer._emitToken(tokenizer._currentToken);
  2938. buffer.unget(data);
  2939. tokenizer.setState(data_state);
  2940. } else if (data === '>') {
  2941. tokenizer._emitToken(tokenizer._currentToken);
  2942. tokenizer.setState(data_state);
  2943. } else if (data === '-') {
  2944. tokenizer._currentToken.data += '--!';
  2945. tokenizer.setState(comment_end_dash_state);
  2946. } else {
  2947. tokenizer._currentToken.data += '--!' + data;
  2948. tokenizer.setState(comment_state);
  2949. }
  2950. return true;
  2951. }
  2952. function doctype_state(buffer) {
  2953. var data = buffer.char();
  2954. if (data === InputStream.EOF) {
  2955. tokenizer._parseError("expected-doctype-name-but-got-eof");
  2956. tokenizer._currentToken.forceQuirks = true;
  2957. buffer.unget(data);
  2958. tokenizer.setState(data_state);
  2959. tokenizer._emitCurrentToken();
  2960. } else if (isWhitespace(data)) {
  2961. tokenizer.setState(before_doctype_name_state);
  2962. } else {
  2963. tokenizer._parseError("need-space-after-doctype");
  2964. buffer.unget(data);
  2965. tokenizer.setState(before_doctype_name_state);
  2966. }
  2967. return true;
  2968. }
  2969. function before_doctype_name_state(buffer) {
  2970. var data = buffer.char();
  2971. if (data === InputStream.EOF) {
  2972. tokenizer._parseError("expected-doctype-name-but-got-eof");
  2973. tokenizer._currentToken.forceQuirks = true;
  2974. buffer.unget(data);
  2975. tokenizer.setState(data_state);
  2976. tokenizer._emitCurrentToken();
  2977. } else if (isWhitespace(data)) {
  2978. } else if (data === '>') {
  2979. tokenizer._parseError("expected-doctype-name-but-got-right-bracket");
  2980. tokenizer._currentToken.forceQuirks = true;
  2981. tokenizer.setState(data_state);
  2982. tokenizer._emitCurrentToken();
  2983. } else {
  2984. if (isAlpha(data))
  2985. data = data.toLowerCase();
  2986. tokenizer._currentToken.name = data;
  2987. tokenizer.setState(doctype_name_state);
  2988. }
  2989. return true;
  2990. }
  2991. function doctype_name_state(buffer) {
  2992. var data = buffer.char();
  2993. if (data === InputStream.EOF) {
  2994. tokenizer._currentToken.forceQuirks = true;
  2995. buffer.unget(data);
  2996. tokenizer._parseError("eof-in-doctype-name");
  2997. tokenizer.setState(data_state);
  2998. tokenizer._emitCurrentToken();
  2999. } else if (isWhitespace(data)) {
  3000. tokenizer.setState(after_doctype_name_state);
  3001. } else if (data === '>') {
  3002. tokenizer.setState(data_state);
  3003. tokenizer._emitCurrentToken();
  3004. } else {
  3005. if (isAlpha(data))
  3006. data = data.toLowerCase();
  3007. tokenizer._currentToken.name += data;
  3008. buffer.commit();
  3009. }
  3010. return true;
  3011. }
  3012. function after_doctype_name_state(buffer) {
  3013. var data = buffer.char();
  3014. if (data === InputStream.EOF) {
  3015. tokenizer._currentToken.forceQuirks = true;
  3016. buffer.unget(data);
  3017. tokenizer._parseError("eof-in-doctype");
  3018. tokenizer.setState(data_state);
  3019. tokenizer._emitCurrentToken();
  3020. } else if (isWhitespace(data)) {
  3021. } else if (data === '>') {
  3022. tokenizer.setState(data_state);
  3023. tokenizer._emitCurrentToken();
  3024. } else {
  3025. if (['p', 'P'].indexOf(data) > -1) {
  3026. var expected = [['u', 'U'], ['b', 'B'], ['l', 'L'], ['i', 'I'], ['c', 'C']];
  3027. var matched = expected.every(function(expected){
  3028. data = buffer.char();
  3029. return expected.indexOf(data) > -1;
  3030. });
  3031. if (matched) {
  3032. tokenizer.setState(after_doctype_public_keyword_state);
  3033. return true;
  3034. }
  3035. } else if (['s', 'S'].indexOf(data) > -1) {
  3036. var expected = [['y', 'Y'], ['s', 'S'], ['t', 'T'], ['e', 'E'], ['m', 'M']];
  3037. var matched = expected.every(function(expected){
  3038. data = buffer.char();
  3039. return expected.indexOf(data) > -1;
  3040. });
  3041. if (matched) {
  3042. tokenizer.setState(after_doctype_system_keyword_state);
  3043. return true;
  3044. }
  3045. }
  3046. buffer.unget(data);
  3047. tokenizer._currentToken.forceQuirks = true;
  3048. if (data === InputStream.EOF) {
  3049. tokenizer._parseError("eof-in-doctype");
  3050. buffer.unget(data);
  3051. tokenizer.setState(data_state);
  3052. tokenizer._emitCurrentToken();
  3053. } else {
  3054. tokenizer._parseError("expected-space-or-right-bracket-in-doctype", {data: data});
  3055. tokenizer.setState(bogus_doctype_state);
  3056. }
  3057. }
  3058. return true;
  3059. }
  3060. function after_doctype_public_keyword_state(buffer) {
  3061. var data = buffer.char();
  3062. if (data === InputStream.EOF) {
  3063. tokenizer._parseError("eof-in-doctype");
  3064. tokenizer._currentToken.forceQuirks = true;
  3065. buffer.unget(data);
  3066. tokenizer.setState(data_state);
  3067. tokenizer._emitCurrentToken();
  3068. } else if (isWhitespace(data)) {
  3069. tokenizer.setState(before_doctype_public_identifier_state);
  3070. } else if (data === "'" || data === '"') {
  3071. tokenizer._parseError("unexpected-char-in-doctype");
  3072. buffer.unget(data);
  3073. tokenizer.setState(before_doctype_public_identifier_state);
  3074. } else {
  3075. buffer.unget(data);
  3076. tokenizer.setState(before_doctype_public_identifier_state);
  3077. }
  3078. return true;
  3079. }
  3080. function before_doctype_public_identifier_state(buffer) {
  3081. var data = buffer.char();
  3082. if (data === InputStream.EOF) {
  3083. tokenizer._parseError("eof-in-doctype");
  3084. tokenizer._currentToken.forceQuirks = true;
  3085. buffer.unget(data);
  3086. tokenizer.setState(data_state);
  3087. tokenizer._emitCurrentToken();
  3088. } else if (isWhitespace(data)) {
  3089. } else if (data === '"') {
  3090. tokenizer._currentToken.publicId = '';
  3091. tokenizer.setState(doctype_public_identifier_double_quoted_state);
  3092. } else if (data === "'") {
  3093. tokenizer._currentToken.publicId = '';
  3094. tokenizer.setState(doctype_public_identifier_single_quoted_state);
  3095. } else if (data === '>') {
  3096. tokenizer._parseError("unexpected-end-of-doctype");
  3097. tokenizer._currentToken.forceQuirks = true;
  3098. tokenizer.setState(data_state);
  3099. tokenizer._emitCurrentToken();
  3100. } else {
  3101. tokenizer._parseError("unexpected-char-in-doctype");
  3102. tokenizer._currentToken.forceQuirks = true;
  3103. tokenizer.setState(bogus_doctype_state);
  3104. }
  3105. return true;
  3106. }
  3107. function doctype_public_identifier_double_quoted_state(buffer) {
  3108. var data = buffer.char();
  3109. if (data === InputStream.EOF) {
  3110. tokenizer._parseError("eof-in-doctype");
  3111. tokenizer._currentToken.forceQuirks = true;
  3112. buffer.unget(data);
  3113. tokenizer.setState(data_state);
  3114. tokenizer._emitCurrentToken();
  3115. } else if (data === '"') {
  3116. tokenizer.setState(after_doctype_public_identifier_state);
  3117. } else if (data === '>') {
  3118. tokenizer._parseError("unexpected-end-of-doctype");
  3119. tokenizer._currentToken.forceQuirks = true;
  3120. tokenizer.setState(data_state);
  3121. tokenizer._emitCurrentToken();
  3122. } else {
  3123. tokenizer._currentToken.publicId += data;
  3124. }
  3125. return true;
  3126. }
  3127. function doctype_public_identifier_single_quoted_state(buffer) {
  3128. var data = buffer.char();
  3129. if (data === InputStream.EOF) {
  3130. tokenizer._parseError("eof-in-doctype");
  3131. tokenizer._currentToken.forceQuirks = true;
  3132. buffer.unget(data);
  3133. tokenizer.setState(data_state);
  3134. tokenizer._emitCurrentToken();
  3135. } else if (data === "'") {
  3136. tokenizer.setState(after_doctype_public_identifier_state);
  3137. } else if (data === '>') {
  3138. tokenizer._parseError("unexpected-end-of-doctype");
  3139. tokenizer._currentToken.forceQuirks = true;
  3140. tokenizer.setState(data_state);
  3141. tokenizer._emitCurrentToken();
  3142. } else {
  3143. tokenizer._currentToken.publicId += data;
  3144. }
  3145. return true;
  3146. }
  3147. function after_doctype_public_identifier_state(buffer) {
  3148. var data = buffer.char();
  3149. if (data === InputStream.EOF) {
  3150. tokenizer._parseError("eof-in-doctype");
  3151. tokenizer._currentToken.forceQuirks = true;
  3152. tokenizer._emitCurrentToken();
  3153. buffer.unget(data);
  3154. tokenizer.setState(data_state);
  3155. } else if (isWhitespace(data)) {
  3156. tokenizer.setState(between_doctype_public_and_system_identifiers_state);
  3157. } else if (data === '>') {
  3158. tokenizer.setState(data_state);
  3159. tokenizer._emitCurrentToken();
  3160. } else if (data === '"') {
  3161. tokenizer._parseError("unexpected-char-in-doctype");
  3162. tokenizer._currentToken.systemId = '';
  3163. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3164. } else if (data === "'") {
  3165. tokenizer._parseError("unexpected-char-in-doctype");
  3166. tokenizer._currentToken.systemId = '';
  3167. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3168. } else {
  3169. tokenizer._parseError("unexpected-char-in-doctype");
  3170. tokenizer._currentToken.forceQuirks = true;
  3171. tokenizer.setState(bogus_doctype_state);
  3172. }
  3173. return true;
  3174. }
  3175. function between_doctype_public_and_system_identifiers_state(buffer) {
  3176. var data = buffer.char();
  3177. if (data === InputStream.EOF) {
  3178. tokenizer._parseError("eof-in-doctype");
  3179. tokenizer._currentToken.forceQuirks = true;
  3180. tokenizer._emitCurrentToken();
  3181. buffer.unget(data);
  3182. tokenizer.setState(data_state);
  3183. } else if (isWhitespace(data)) {
  3184. } else if (data === '>') {
  3185. tokenizer._emitCurrentToken();
  3186. tokenizer.setState(data_state);
  3187. } else if (data === '"') {
  3188. tokenizer._currentToken.systemId = '';
  3189. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3190. } else if (data === "'") {
  3191. tokenizer._currentToken.systemId = '';
  3192. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3193. } else {
  3194. tokenizer._parseError("unexpected-char-in-doctype");
  3195. tokenizer._currentToken.forceQuirks = true;
  3196. tokenizer.setState(bogus_doctype_state);
  3197. }
  3198. return true;
  3199. }
  3200. function after_doctype_system_keyword_state(buffer) {
  3201. var data = buffer.char();
  3202. if (data === InputStream.EOF) {
  3203. tokenizer._parseError("eof-in-doctype");
  3204. tokenizer._currentToken.forceQuirks = true;
  3205. tokenizer._emitCurrentToken();
  3206. buffer.unget(data);
  3207. tokenizer.setState(data_state);
  3208. } else if (isWhitespace(data)) {
  3209. tokenizer.setState(before_doctype_system_identifier_state);
  3210. } else if (data === "'" || data === '"') {
  3211. tokenizer._parseError("unexpected-char-in-doctype");
  3212. buffer.unget(data);
  3213. tokenizer.setState(before_doctype_system_identifier_state);
  3214. } else {
  3215. buffer.unget(data);
  3216. tokenizer.setState(before_doctype_system_identifier_state);
  3217. }
  3218. return true;
  3219. }
  3220. function before_doctype_system_identifier_state(buffer) {
  3221. var data = buffer.char();
  3222. if (data === InputStream.EOF) {
  3223. tokenizer._parseError("eof-in-doctype");
  3224. tokenizer._currentToken.forceQuirks = true;
  3225. tokenizer._emitCurrentToken();
  3226. buffer.unget(data);
  3227. tokenizer.setState(data_state);
  3228. } else if (isWhitespace(data)) {
  3229. } else if (data === '"') {
  3230. tokenizer._currentToken.systemId = '';
  3231. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3232. } else if (data === "'") {
  3233. tokenizer._currentToken.systemId = '';
  3234. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3235. } else if (data === '>') {
  3236. tokenizer._parseError("unexpected-end-of-doctype");
  3237. tokenizer._currentToken.forceQuirks = true;
  3238. tokenizer._emitCurrentToken();
  3239. tokenizer.setState(data_state);
  3240. } else {
  3241. tokenizer._parseError("unexpected-char-in-doctype");
  3242. tokenizer._currentToken.forceQuirks = true;
  3243. tokenizer.setState(bogus_doctype_state);
  3244. }
  3245. return true;
  3246. }
  3247. function doctype_system_identifier_double_quoted_state(buffer) {
  3248. var data = buffer.char();
  3249. if (data === InputStream.EOF) {
  3250. tokenizer._parseError("eof-in-doctype");
  3251. tokenizer._currentToken.forceQuirks = true;
  3252. tokenizer._emitCurrentToken();
  3253. buffer.unget(data);
  3254. tokenizer.setState(data_state);
  3255. } else if (data === '"') {
  3256. tokenizer.setState(after_doctype_system_identifier_state);
  3257. } else if (data === '>') {
  3258. tokenizer._parseError("unexpected-end-of-doctype");
  3259. tokenizer._currentToken.forceQuirks = true;
  3260. tokenizer._emitCurrentToken();
  3261. tokenizer.setState(data_state);
  3262. } else {
  3263. tokenizer._currentToken.systemId += data;
  3264. }
  3265. return true;
  3266. }
  3267. function doctype_system_identifier_single_quoted_state(buffer) {
  3268. var data = buffer.char();
  3269. if (data === InputStream.EOF) {
  3270. tokenizer._parseError("eof-in-doctype");
  3271. tokenizer._currentToken.forceQuirks = true;
  3272. tokenizer._emitCurrentToken();
  3273. buffer.unget(data);
  3274. tokenizer.setState(data_state);
  3275. } else if (data === "'") {
  3276. tokenizer.setState(after_doctype_system_identifier_state);
  3277. } else if (data === '>') {
  3278. tokenizer._parseError("unexpected-end-of-doctype");
  3279. tokenizer._currentToken.forceQuirks = true;
  3280. tokenizer._emitCurrentToken();
  3281. tokenizer.setState(data_state);
  3282. } else {
  3283. tokenizer._currentToken.systemId += data;
  3284. }
  3285. return true;
  3286. }
  3287. function after_doctype_system_identifier_state(buffer) {
  3288. var data = buffer.char();
  3289. if (data === InputStream.EOF) {
  3290. tokenizer._parseError("eof-in-doctype");
  3291. tokenizer._currentToken.forceQuirks = true;
  3292. tokenizer._emitCurrentToken();
  3293. buffer.unget(data);
  3294. tokenizer.setState(data_state);
  3295. } else if (isWhitespace(data)) {
  3296. } else if (data === '>') {
  3297. tokenizer._emitCurrentToken();
  3298. tokenizer.setState(data_state);
  3299. } else {
  3300. tokenizer._parseError("unexpected-char-in-doctype");
  3301. tokenizer.setState(bogus_doctype_state);
  3302. }
  3303. return true;
  3304. }
  3305. function bogus_doctype_state(buffer) {
  3306. var data = buffer.char();
  3307. if (data === InputStream.EOF) {
  3308. buffer.unget(data);
  3309. tokenizer._emitCurrentToken();
  3310. tokenizer.setState(data_state);
  3311. } else if (data === '>') {
  3312. tokenizer._emitCurrentToken();
  3313. tokenizer.setState(data_state);
  3314. }
  3315. return true;
  3316. }
  3317. };
  3318. Object.defineProperty(Tokenizer.prototype, 'lineNumber', {
  3319. get: function() {
  3320. return this._inputStream.location().line;
  3321. }
  3322. });
  3323. Object.defineProperty(Tokenizer.prototype, 'columnNumber', {
  3324. get: function() {
  3325. return this._inputStream.location().column;
  3326. }
  3327. });
  3328. exports.Tokenizer = Tokenizer;
  3329. },
  3330. {"./EntityParser":2,"./InputStream":3}],
  3331. 6:[function(_dereq_,module,exports){
  3332. var assert = _dereq_('assert');
  3333. var messages = _dereq_('./messages.json');
  3334. var constants = _dereq_('./constants');
  3335. var EventEmitter = _dereq_('events').EventEmitter;
  3336. var Tokenizer = _dereq_('./Tokenizer').Tokenizer;
  3337. var ElementStack = _dereq_('./ElementStack').ElementStack;
  3338. var StackItem = _dereq_('./StackItem').StackItem;
  3339. var Marker = {};
  3340. function isWhitespace(ch) {
  3341. return ch === " " || ch === "\n" || ch === "\t" || ch === "\r" || ch === "\f";
  3342. }
  3343. function isWhitespaceOrReplacementCharacter(ch) {
  3344. return isWhitespace(ch) || ch === '\uFFFD';
  3345. }
  3346. function isAllWhitespace(characters) {
  3347. for (var i = 0; i < characters.length; i++) {
  3348. var ch = characters[i];
  3349. if (!isWhitespace(ch))
  3350. return false;
  3351. }
  3352. return true;
  3353. }
  3354. function isAllWhitespaceOrReplacementCharacters(characters) {
  3355. for (var i = 0; i < characters.length; i++) {
  3356. var ch = characters[i];
  3357. if (!isWhitespaceOrReplacementCharacter(ch))
  3358. return false;
  3359. }
  3360. return true;
  3361. }
  3362. function getAttribute(node, name) {
  3363. for (var i = 0; i < node.attributes.length; i++) {
  3364. var attribute = node.attributes[i];
  3365. if (attribute.nodeName === name) {
  3366. return attribute;
  3367. }
  3368. }
  3369. return null;
  3370. }
  3371. function CharacterBuffer(characters) {
  3372. this.characters = characters;
  3373. this.current = 0;
  3374. this.end = this.characters.length;
  3375. }
  3376. CharacterBuffer.prototype.skipAtMostOneLeadingNewline = function() {
  3377. if (this.characters[this.current] === '\n')
  3378. this.current++;
  3379. };
  3380. CharacterBuffer.prototype.skipLeadingWhitespace = function() {
  3381. while (isWhitespace(this.characters[this.current])) {
  3382. if (++this.current == this.end)
  3383. return;
  3384. }
  3385. };
  3386. CharacterBuffer.prototype.skipLeadingNonWhitespace = function() {
  3387. while (!isWhitespace(this.characters[this.current])) {
  3388. if (++this.current == this.end)
  3389. return;
  3390. }
  3391. };
  3392. CharacterBuffer.prototype.takeRemaining = function() {
  3393. return this.characters.substring(this.current);
  3394. };
  3395. CharacterBuffer.prototype.takeLeadingWhitespace = function() {
  3396. var start = this.current;
  3397. this.skipLeadingWhitespace();
  3398. if (start === this.current)
  3399. return "";
  3400. return this.characters.substring(start, this.current - start);
  3401. };
  3402. Object.defineProperty(CharacterBuffer.prototype, 'length', {
  3403. get: function(){
  3404. return this.end - this.current;
  3405. }
  3406. });
  3407. function TreeBuilder() {
  3408. this.tokenizer = null;
  3409. this.errorHandler = null;
  3410. this.scriptingEnabled = false;
  3411. this.document = null;
  3412. this.head = null;
  3413. this.form = null;
  3414. this.openElements = new ElementStack();
  3415. this.activeFormattingElements = [];
  3416. this.insertionMode = null;
  3417. this.insertionModeName = "";
  3418. this.originalInsertionMode = "";
  3419. this.inQuirksMode = false; // TODO quirks mode
  3420. this.compatMode = "no quirks";
  3421. this.framesetOk = true;
  3422. this.redirectAttachToFosterParent = false;
  3423. this.selfClosingFlagAcknowledged = false;
  3424. this.context = "";
  3425. this.pendingTableCharacters = [];
  3426. this.shouldSkipLeadingNewline = false;
  3427. var tree = this;
  3428. var modes = this.insertionModes = {};
  3429. modes.base = {
  3430. end_tag_handlers: {"-default": 'endTagOther'},
  3431. start_tag_handlers: {"-default": 'startTagOther'},
  3432. processEOF: function() {
  3433. tree.generateImpliedEndTags();
  3434. if (tree.openElements.length > 2) {
  3435. tree.parseError('expected-closing-tag-but-got-eof');
  3436. } else if (tree.openElements.length == 2 &&
  3437. tree.openElements.item(1).localName != 'body') {
  3438. tree.parseError('expected-closing-tag-but-got-eof');
  3439. } else if (tree.context && tree.openElements.length > 1) {
  3440. }
  3441. },
  3442. processComment: function(data) {
  3443. tree.insertComment(data, tree.currentStackItem().node);
  3444. },
  3445. processDoctype: function(name, publicId, systemId, forceQuirks) {
  3446. tree.parseError('unexpected-doctype');
  3447. },
  3448. processStartTag: function(name, attributes, selfClosing) {
  3449. if (this[this.start_tag_handlers[name]]) {
  3450. this[this.start_tag_handlers[name]](name, attributes, selfClosing);
  3451. } else if (this[this.start_tag_handlers["-default"]]) {
  3452. this[this.start_tag_handlers["-default"]](name, attributes, selfClosing);
  3453. } else {
  3454. throw(new Error("No handler found for "+name));
  3455. }
  3456. },
  3457. processEndTag: function(name) {
  3458. if (this[this.end_tag_handlers[name]]) {
  3459. this[this.end_tag_handlers[name]](name);
  3460. } else if (this[this.end_tag_handlers["-default"]]) {
  3461. this[this.end_tag_handlers["-default"]](name);
  3462. } else {
  3463. throw(new Error("No handler found for "+name));
  3464. }
  3465. },
  3466. startTagHtml: function(name, attributes) {
  3467. modes.inBody.startTagHtml(name, attributes);
  3468. }
  3469. };
  3470. modes.initial = Object.create(modes.base);
  3471. modes.initial.processEOF = function() {
  3472. tree.parseError("expected-doctype-but-got-eof");
  3473. this.anythingElse();
  3474. tree.insertionMode.processEOF();
  3475. };
  3476. modes.initial.processComment = function(data) {
  3477. tree.insertComment(data, tree.document);
  3478. };
  3479. modes.initial.processDoctype = function(name, publicId, systemId, forceQuirks) {
  3480. tree.insertDoctype(name || '', publicId || '', systemId || '');
  3481. if (forceQuirks || name != 'html' || (publicId != null && ([
  3482. "+//silmaril//dtd html pro v0r11 19970101//",
  3483. "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
  3484. "-//as//dtd html 3.0 aswedit + extensions//",
  3485. "-//ietf//dtd html 2.0 level 1//",
  3486. "-//ietf//dtd html 2.0 level 2//",
  3487. "-//ietf//dtd html 2.0 strict level 1//",
  3488. "-//ietf//dtd html 2.0 strict level 2//",
  3489. "-//ietf//dtd html 2.0 strict//",
  3490. "-//ietf//dtd html 2.0//",
  3491. "-//ietf//dtd html 2.1e//",
  3492. "-//ietf//dtd html 3.0//",
  3493. "-//ietf//dtd html 3.0//",
  3494. "-//ietf//dtd html 3.2 final//",
  3495. "-//ietf//dtd html 3.2//",
  3496. "-//ietf//dtd html 3//",
  3497. "-//ietf//dtd html level 0//",
  3498. "-//ietf//dtd html level 0//",
  3499. "-//ietf//dtd html level 1//",
  3500. "-//ietf//dtd html level 1//",
  3501. "-//ietf//dtd html level 2//",
  3502. "-//ietf//dtd html level 2//",
  3503. "-//ietf//dtd html level 3//",
  3504. "-//ietf//dtd html level 3//",
  3505. "-//ietf//dtd html strict level 0//",
  3506. "-//ietf//dtd html strict level 0//",
  3507. "-//ietf//dtd html strict level 1//",
  3508. "-//ietf//dtd html strict level 1//",
  3509. "-//ietf//dtd html strict level 2//",
  3510. "-//ietf//dtd html strict level 2//",
  3511. "-//ietf//dtd html strict level 3//",
  3512. "-//ietf//dtd html strict level 3//",
  3513. "-//ietf//dtd html strict//",
  3514. "-//ietf//dtd html strict//",
  3515. "-//ietf//dtd html strict//",
  3516. "-//ietf//dtd html//",
  3517. "-//ietf//dtd html//",
  3518. "-//ietf//dtd html//",
  3519. "-//metrius//dtd metrius presentational//",
  3520. "-//microsoft//dtd internet explorer 2.0 html strict//",
  3521. "-//microsoft//dtd internet explorer 2.0 html//",
  3522. "-//microsoft//dtd internet explorer 2.0 tables//",
  3523. "-//microsoft//dtd internet explorer 3.0 html strict//",
  3524. "-//microsoft//dtd internet explorer 3.0 html//",
  3525. "-//microsoft//dtd internet explorer 3.0 tables//",
  3526. "-//netscape comm. corp.//dtd html//",
  3527. "-//netscape comm. corp.//dtd strict html//",
  3528. "-//o'reilly and associates//dtd html 2.0//",
  3529. "-//o'reilly and associates//dtd html extended 1.0//",
  3530. "-//spyglass//dtd html 2.0 extended//",
  3531. "-//sq//dtd html 2.0 hotmetal + extensions//",
  3532. "-//sun microsystems corp.//dtd hotjava html//",
  3533. "-//sun microsystems corp.//dtd hotjava strict html//",
  3534. "-//w3c//dtd html 3 1995-03-24//",
  3535. "-//w3c//dtd html 3.2 draft//",
  3536. "-//w3c//dtd html 3.2 final//",
  3537. "-//w3c//dtd html 3.2//",
  3538. "-//w3c//dtd html 3.2s draft//",
  3539. "-//w3c//dtd html 4.0 frameset//",
  3540. "-//w3c//dtd html 4.0 transitional//",
  3541. "-//w3c//dtd html experimental 19960712//",
  3542. "-//w3c//dtd html experimental 970421//",
  3543. "-//w3c//dtd w3 html//",
  3544. "-//w3o//dtd w3 html 3.0//",
  3545. "-//webtechs//dtd mozilla html 2.0//",
  3546. "-//webtechs//dtd mozilla html//",
  3547. "html"
  3548. ].some(publicIdStartsWith)
  3549. || [
  3550. "-//w3o//dtd w3 html strict 3.0//en//",
  3551. "-/w3c/dtd html 4.0 transitional/en",
  3552. "html"
  3553. ].indexOf(publicId.toLowerCase()) > -1
  3554. || (systemId == null && [
  3555. "-//w3c//dtd html 4.01 transitional//",
  3556. "-//w3c//dtd html 4.01 frameset//"
  3557. ].some(publicIdStartsWith)))
  3558. )
  3559. || (systemId != null && (systemId.toLowerCase() == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"))
  3560. ) {
  3561. tree.compatMode = "quirks";
  3562. tree.parseError("quirky-doctype");
  3563. } else if (publicId != null && ([
  3564. "-//w3c//dtd xhtml 1.0 transitional//",
  3565. "-//w3c//dtd xhtml 1.0 frameset//"
  3566. ].some(publicIdStartsWith)
  3567. || (systemId != null && [
  3568. "-//w3c//dtd html 4.01 transitional//",
  3569. "-//w3c//dtd html 4.01 frameset//"
  3570. ].indexOf(publicId.toLowerCase()) > -1))
  3571. ) {
  3572. tree.compatMode = "limited quirks";
  3573. tree.parseError("almost-standards-doctype");
  3574. } else {
  3575. if ((publicId == "-//W3C//DTD HTML 4.0//EN" && (systemId == null || systemId == "http://www.w3.org/TR/REC-html40/strict.dtd"))
  3576. || (publicId == "-//W3C//DTD HTML 4.01//EN" && (systemId == null || systemId == "http://www.w3.org/TR/html4/strict.dtd"))
  3577. || (publicId == "-//W3C//DTD XHTML 1.0 Strict//EN" && (systemId == "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"))
  3578. || (publicId == "-//W3C//DTD XHTML 1.1//EN" && (systemId == "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"))
  3579. ) {
  3580. } else if (!((systemId == null || systemId == "about:legacy-compat") && publicId == null)) {
  3581. tree.parseError("unknown-doctype");
  3582. }
  3583. }
  3584. tree.setInsertionMode('beforeHTML');
  3585. function publicIdStartsWith(string) {
  3586. return publicId.toLowerCase().indexOf(string) === 0;
  3587. }
  3588. };
  3589. modes.initial.processCharacters = function(buffer) {
  3590. buffer.skipLeadingWhitespace();
  3591. if (!buffer.length)
  3592. return;
  3593. tree.parseError('expected-doctype-but-got-chars');
  3594. this.anythingElse();
  3595. tree.insertionMode.processCharacters(buffer);
  3596. };
  3597. modes.initial.processStartTag = function(name, attributes, selfClosing) {
  3598. tree.parseError('expected-doctype-but-got-start-tag', {name: name});
  3599. this.anythingElse();
  3600. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3601. };
  3602. modes.initial.processEndTag = function(name) {
  3603. tree.parseError('expected-doctype-but-got-end-tag', {name: name});
  3604. this.anythingElse();
  3605. tree.insertionMode.processEndTag(name);
  3606. };
  3607. modes.initial.anythingElse = function() {
  3608. tree.compatMode = 'quirks';
  3609. tree.setInsertionMode('beforeHTML');
  3610. };
  3611. modes.beforeHTML = Object.create(modes.base);
  3612. modes.beforeHTML.start_tag_handlers = {
  3613. html: 'startTagHtml',
  3614. '-default': 'startTagOther'
  3615. };
  3616. modes.beforeHTML.processEOF = function() {
  3617. this.anythingElse();
  3618. tree.insertionMode.processEOF();
  3619. };
  3620. modes.beforeHTML.processComment = function(data) {
  3621. tree.insertComment(data, tree.document);
  3622. };
  3623. modes.beforeHTML.processCharacters = function(buffer) {
  3624. buffer.skipLeadingWhitespace();
  3625. if (!buffer.length)
  3626. return;
  3627. this.anythingElse();
  3628. tree.insertionMode.processCharacters(buffer);
  3629. };
  3630. modes.beforeHTML.startTagHtml = function(name, attributes, selfClosing) {
  3631. tree.insertHtmlElement(attributes);
  3632. tree.setInsertionMode('beforeHead');
  3633. };
  3634. modes.beforeHTML.startTagOther = function(name, attributes, selfClosing) {
  3635. this.anythingElse();
  3636. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3637. };
  3638. modes.beforeHTML.processEndTag = function(name) {
  3639. this.anythingElse();
  3640. tree.insertionMode.processEndTag(name);
  3641. };
  3642. modes.beforeHTML.anythingElse = function() {
  3643. tree.insertHtmlElement();
  3644. tree.setInsertionMode('beforeHead');
  3645. };
  3646. modes.afterAfterBody = Object.create(modes.base);
  3647. modes.afterAfterBody.start_tag_handlers = {
  3648. html: 'startTagHtml',
  3649. '-default': 'startTagOther'
  3650. };
  3651. modes.afterAfterBody.processComment = function(data) {
  3652. tree.insertComment(data, tree.document);
  3653. };
  3654. modes.afterAfterBody.processDoctype = function(data) {
  3655. modes.inBody.processDoctype(data);
  3656. };
  3657. modes.afterAfterBody.startTagHtml = function(data, attributes) {
  3658. modes.inBody.startTagHtml(data, attributes);
  3659. };
  3660. modes.afterAfterBody.startTagOther = function(name, attributes, selfClosing) {
  3661. tree.parseError('unexpected-start-tag', {name: name});
  3662. tree.setInsertionMode('inBody');
  3663. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3664. };
  3665. modes.afterAfterBody.endTagOther = function(name) {
  3666. tree.parseError('unexpected-end-tag', {name: name});
  3667. tree.setInsertionMode('inBody');
  3668. tree.insertionMode.processEndTag(name);
  3669. };
  3670. modes.afterAfterBody.processCharacters = function(data) {
  3671. if (!isAllWhitespace(data.characters)) {
  3672. tree.parseError('unexpected-char-after-body');
  3673. tree.setInsertionMode('inBody');
  3674. return tree.insertionMode.processCharacters(data);
  3675. }
  3676. modes.inBody.processCharacters(data);
  3677. };
  3678. modes.afterBody = Object.create(modes.base);
  3679. modes.afterBody.end_tag_handlers = {
  3680. html: 'endTagHtml',
  3681. '-default': 'endTagOther'
  3682. };
  3683. modes.afterBody.processComment = function(data) {
  3684. tree.insertComment(data, tree.openElements.rootNode);
  3685. };
  3686. modes.afterBody.processCharacters = function(data) {
  3687. if (!isAllWhitespace(data.characters)) {
  3688. tree.parseError('unexpected-char-after-body');
  3689. tree.setInsertionMode('inBody');
  3690. return tree.insertionMode.processCharacters(data);
  3691. }
  3692. modes.inBody.processCharacters(data);
  3693. };
  3694. modes.afterBody.processStartTag = function(name, attributes, selfClosing) {
  3695. tree.parseError('unexpected-start-tag-after-body', {name: name});
  3696. tree.setInsertionMode('inBody');
  3697. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3698. };
  3699. modes.afterBody.endTagHtml = function(name) {
  3700. if (tree.context) {
  3701. tree.parseError('end-html-in-innerhtml');
  3702. } else {
  3703. tree.setInsertionMode('afterAfterBody');
  3704. }
  3705. };
  3706. modes.afterBody.endTagOther = function(name) {
  3707. tree.parseError('unexpected-end-tag-after-body', {name: name});
  3708. tree.setInsertionMode('inBody');
  3709. tree.insertionMode.processEndTag(name);
  3710. };
  3711. modes.afterFrameset = Object.create(modes.base);
  3712. modes.afterFrameset.start_tag_handlers = {
  3713. html: 'startTagHtml',
  3714. noframes: 'startTagNoframes',
  3715. '-default': 'startTagOther'
  3716. };
  3717. modes.afterFrameset.end_tag_handlers = {
  3718. html: 'endTagHtml',
  3719. '-default': 'endTagOther'
  3720. };
  3721. modes.afterFrameset.processCharacters = function(buffer) {
  3722. var characters = buffer.takeRemaining();
  3723. var whitespace = "";
  3724. for (var i = 0; i < characters.length; i++) {
  3725. var ch = characters[i];
  3726. if (isWhitespace(ch))
  3727. whitespace += ch;
  3728. }
  3729. if (whitespace) {
  3730. tree.insertText(whitespace);
  3731. }
  3732. if (whitespace.length < characters.length)
  3733. tree.parseError('expected-eof-but-got-char');
  3734. };
  3735. modes.afterFrameset.startTagNoframes = function(name, attributes) {
  3736. modes.inHead.processStartTag(name, attributes);
  3737. };
  3738. modes.afterFrameset.startTagOther = function(name, attributes) {
  3739. tree.parseError("unexpected-start-tag-after-frameset", {name: name});
  3740. };
  3741. modes.afterFrameset.endTagHtml = function(name) {
  3742. tree.setInsertionMode('afterAfterFrameset');
  3743. };
  3744. modes.afterFrameset.endTagOther = function(name) {
  3745. tree.parseError("unexpected-end-tag-after-frameset", {name: name});
  3746. };
  3747. modes.beforeHead = Object.create(modes.base);
  3748. modes.beforeHead.start_tag_handlers = {
  3749. html: 'startTagHtml',
  3750. head: 'startTagHead',
  3751. '-default': 'startTagOther'
  3752. };
  3753. modes.beforeHead.end_tag_handlers = {
  3754. html: 'endTagImplyHead',
  3755. head: 'endTagImplyHead',
  3756. body: 'endTagImplyHead',
  3757. br: 'endTagImplyHead',
  3758. '-default': 'endTagOther'
  3759. };
  3760. modes.beforeHead.processEOF = function() {
  3761. this.startTagHead('head', []);
  3762. tree.insertionMode.processEOF();
  3763. };
  3764. modes.beforeHead.processCharacters = function(buffer) {
  3765. buffer.skipLeadingWhitespace();
  3766. if (!buffer.length)
  3767. return;
  3768. this.startTagHead('head', []);
  3769. tree.insertionMode.processCharacters(buffer);
  3770. };
  3771. modes.beforeHead.startTagHead = function(name, attributes) {
  3772. tree.insertHeadElement(attributes);
  3773. tree.setInsertionMode('inHead');
  3774. };
  3775. modes.beforeHead.startTagOther = function(name, attributes, selfClosing) {
  3776. this.startTagHead('head', []);
  3777. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3778. };
  3779. modes.beforeHead.endTagImplyHead = function(name) {
  3780. this.startTagHead('head', []);
  3781. tree.insertionMode.processEndTag(name);
  3782. };
  3783. modes.beforeHead.endTagOther = function(name) {
  3784. tree.parseError('end-tag-after-implied-root', {name: name});
  3785. };
  3786. modes.inHead = Object.create(modes.base);
  3787. modes.inHead.start_tag_handlers = {
  3788. html: 'startTagHtml',
  3789. head: 'startTagHead',
  3790. title: 'startTagTitle',
  3791. script: 'startTagScript',
  3792. style: 'startTagNoFramesStyle',
  3793. noscript: 'startTagNoScript',
  3794. noframes: 'startTagNoFramesStyle',
  3795. base: 'startTagBaseBasefontBgsoundLink',
  3796. basefont: 'startTagBaseBasefontBgsoundLink',
  3797. bgsound: 'startTagBaseBasefontBgsoundLink',
  3798. link: 'startTagBaseBasefontBgsoundLink',
  3799. meta: 'startTagMeta',
  3800. "-default": 'startTagOther'
  3801. };
  3802. modes.inHead.end_tag_handlers = {
  3803. head: 'endTagHead',
  3804. html: 'endTagHtmlBodyBr',
  3805. body: 'endTagHtmlBodyBr',
  3806. br: 'endTagHtmlBodyBr',
  3807. "-default": 'endTagOther'
  3808. };
  3809. modes.inHead.processEOF = function() {
  3810. var name = tree.currentStackItem().localName;
  3811. if (['title', 'style', 'script'].indexOf(name) != -1) {
  3812. tree.parseError("expected-named-closing-tag-but-got-eof", {name: name});
  3813. tree.popElement();
  3814. }
  3815. this.anythingElse();
  3816. tree.insertionMode.processEOF();
  3817. };
  3818. modes.inHead.processCharacters = function(buffer) {
  3819. var leadingWhitespace = buffer.takeLeadingWhitespace();
  3820. if (leadingWhitespace)
  3821. tree.insertText(leadingWhitespace);
  3822. if (!buffer.length)
  3823. return;
  3824. this.anythingElse();
  3825. tree.insertionMode.processCharacters(buffer);
  3826. };
  3827. modes.inHead.startTagHtml = function(name, attributes) {
  3828. modes.inBody.processStartTag(name, attributes);
  3829. };
  3830. modes.inHead.startTagHead = function(name, attributes) {
  3831. tree.parseError('two-heads-are-not-better-than-one');
  3832. };
  3833. modes.inHead.startTagTitle = function(name, attributes) {
  3834. tree.processGenericRCDATAStartTag(name, attributes);
  3835. };
  3836. modes.inHead.startTagNoScript = function(name, attributes) {
  3837. if (tree.scriptingEnabled)
  3838. return tree.processGenericRawTextStartTag(name, attributes);
  3839. tree.insertElement(name, attributes);
  3840. tree.setInsertionMode('inHeadNoscript');
  3841. };
  3842. modes.inHead.startTagNoFramesStyle = function(name, attributes) {
  3843. tree.processGenericRawTextStartTag(name, attributes);
  3844. };
  3845. modes.inHead.startTagScript = function(name, attributes) {
  3846. tree.insertElement(name, attributes);
  3847. tree.tokenizer.setState(Tokenizer.SCRIPT_DATA);
  3848. tree.originalInsertionMode = tree.insertionModeName;
  3849. tree.setInsertionMode('text');
  3850. };
  3851. modes.inHead.startTagBaseBasefontBgsoundLink = function(name, attributes) {
  3852. tree.insertSelfClosingElement(name, attributes);
  3853. };
  3854. modes.inHead.startTagMeta = function(name, attributes) {
  3855. tree.insertSelfClosingElement(name, attributes);
  3856. };
  3857. modes.inHead.startTagOther = function(name, attributes, selfClosing) {
  3858. this.anythingElse();
  3859. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3860. };
  3861. modes.inHead.endTagHead = function(name) {
  3862. if (tree.openElements.item(tree.openElements.length - 1).localName == 'head') {
  3863. tree.openElements.pop();
  3864. } else {
  3865. tree.parseError('unexpected-end-tag', {name: 'head'});
  3866. }
  3867. tree.setInsertionMode('afterHead');
  3868. };
  3869. modes.inHead.endTagHtmlBodyBr = function(name) {
  3870. this.anythingElse();
  3871. tree.insertionMode.processEndTag(name);
  3872. };
  3873. modes.inHead.endTagOther = function(name) {
  3874. tree.parseError('unexpected-end-tag', {name: name});
  3875. };
  3876. modes.inHead.anythingElse = function() {
  3877. this.endTagHead('head');
  3878. };
  3879. modes.afterHead = Object.create(modes.base);
  3880. modes.afterHead.start_tag_handlers = {
  3881. html: 'startTagHtml',
  3882. head: 'startTagHead',
  3883. body: 'startTagBody',
  3884. frameset: 'startTagFrameset',
  3885. base: 'startTagFromHead',
  3886. link: 'startTagFromHead',
  3887. meta: 'startTagFromHead',
  3888. script: 'startTagFromHead',
  3889. style: 'startTagFromHead',
  3890. title: 'startTagFromHead',
  3891. "-default": 'startTagOther'
  3892. };
  3893. modes.afterHead.end_tag_handlers = {
  3894. body: 'endTagBodyHtmlBr',
  3895. html: 'endTagBodyHtmlBr',
  3896. br: 'endTagBodyHtmlBr',
  3897. "-default": 'endTagOther'
  3898. };
  3899. modes.afterHead.processEOF = function() {
  3900. this.anythingElse();
  3901. tree.insertionMode.processEOF();
  3902. };
  3903. modes.afterHead.processCharacters = function(buffer) {
  3904. var leadingWhitespace = buffer.takeLeadingWhitespace();
  3905. if (leadingWhitespace)
  3906. tree.insertText(leadingWhitespace);
  3907. if (!buffer.length)
  3908. return;
  3909. this.anythingElse();
  3910. tree.insertionMode.processCharacters(buffer);
  3911. };
  3912. modes.afterHead.startTagHtml = function(name, attributes) {
  3913. modes.inBody.processStartTag(name, attributes);
  3914. };
  3915. modes.afterHead.startTagBody = function(name, attributes) {
  3916. tree.framesetOk = false;
  3917. tree.insertBodyElement(attributes);
  3918. tree.setInsertionMode('inBody');
  3919. };
  3920. modes.afterHead.startTagFrameset = function(name, attributes) {
  3921. tree.insertElement(name, attributes);
  3922. tree.setInsertionMode('inFrameset');
  3923. };
  3924. modes.afterHead.startTagFromHead = function(name, attributes, selfClosing) {
  3925. tree.parseError("unexpected-start-tag-out-of-my-head", {name: name});
  3926. tree.openElements.push(tree.head);
  3927. modes.inHead.processStartTag(name, attributes, selfClosing);
  3928. tree.openElements.remove(tree.head);
  3929. };
  3930. modes.afterHead.startTagHead = function(name, attributes, selfClosing) {
  3931. tree.parseError('unexpected-start-tag', {name: name});
  3932. };
  3933. modes.afterHead.startTagOther = function(name, attributes, selfClosing) {
  3934. this.anythingElse();
  3935. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3936. };
  3937. modes.afterHead.endTagBodyHtmlBr = function(name) {
  3938. this.anythingElse();
  3939. tree.insertionMode.processEndTag(name);
  3940. };
  3941. modes.afterHead.endTagOther = function(name) {
  3942. tree.parseError('unexpected-end-tag', {name: name});
  3943. };
  3944. modes.afterHead.anythingElse = function() {
  3945. tree.insertBodyElement([]);
  3946. tree.setInsertionMode('inBody');
  3947. tree.framesetOk = true;
  3948. }
  3949. modes.inBody = Object.create(modes.base);
  3950. modes.inBody.start_tag_handlers = {
  3951. html: 'startTagHtml',
  3952. head: 'startTagMisplaced',
  3953. base: 'startTagProcessInHead',
  3954. basefont: 'startTagProcessInHead',
  3955. bgsound: 'startTagProcessInHead',
  3956. link: 'startTagProcessInHead',
  3957. meta: 'startTagProcessInHead',
  3958. noframes: 'startTagProcessInHead',
  3959. script: 'startTagProcessInHead',
  3960. style: 'startTagProcessInHead',
  3961. title: 'startTagProcessInHead',
  3962. body: 'startTagBody',
  3963. form: 'startTagForm',
  3964. plaintext: 'startTagPlaintext',
  3965. a: 'startTagA',
  3966. button: 'startTagButton',
  3967. xmp: 'startTagXmp',
  3968. table: 'startTagTable',
  3969. hr: 'startTagHr',
  3970. image: 'startTagImage',
  3971. input: 'startTagInput',
  3972. textarea: 'startTagTextarea',
  3973. select: 'startTagSelect',
  3974. isindex: 'startTagIsindex',
  3975. applet: 'startTagAppletMarqueeObject',
  3976. marquee: 'startTagAppletMarqueeObject',
  3977. object: 'startTagAppletMarqueeObject',
  3978. li: 'startTagListItem',
  3979. dd: 'startTagListItem',
  3980. dt: 'startTagListItem',
  3981. address: 'startTagCloseP',
  3982. article: 'startTagCloseP',
  3983. aside: 'startTagCloseP',
  3984. blockquote: 'startTagCloseP',
  3985. center: 'startTagCloseP',
  3986. details: 'startTagCloseP',
  3987. dir: 'startTagCloseP',
  3988. div: 'startTagCloseP',
  3989. dl: 'startTagCloseP',
  3990. fieldset: 'startTagCloseP',
  3991. figcaption: 'startTagCloseP',
  3992. figure: 'startTagCloseP',
  3993. footer: 'startTagCloseP',
  3994. header: 'startTagCloseP',
  3995. hgroup: 'startTagCloseP',
  3996. main: 'startTagCloseP',
  3997. menu: 'startTagCloseP',
  3998. nav: 'startTagCloseP',
  3999. ol: 'startTagCloseP',
  4000. p: 'startTagCloseP',
  4001. section: 'startTagCloseP',
  4002. summary: 'startTagCloseP',
  4003. ul: 'startTagCloseP',
  4004. listing: 'startTagPreListing',
  4005. pre: 'startTagPreListing',
  4006. b: 'startTagFormatting',
  4007. big: 'startTagFormatting',
  4008. code: 'startTagFormatting',
  4009. em: 'startTagFormatting',
  4010. font: 'startTagFormatting',
  4011. i: 'startTagFormatting',
  4012. s: 'startTagFormatting',
  4013. small: 'startTagFormatting',
  4014. strike: 'startTagFormatting',
  4015. strong: 'startTagFormatting',
  4016. tt: 'startTagFormatting',
  4017. u: 'startTagFormatting',
  4018. nobr: 'startTagNobr',
  4019. area: 'startTagVoidFormatting',
  4020. br: 'startTagVoidFormatting',
  4021. embed: 'startTagVoidFormatting',
  4022. img: 'startTagVoidFormatting',
  4023. keygen: 'startTagVoidFormatting',
  4024. wbr: 'startTagVoidFormatting',
  4025. param: 'startTagParamSourceTrack',
  4026. source: 'startTagParamSourceTrack',
  4027. track: 'startTagParamSourceTrack',
  4028. iframe: 'startTagIFrame',
  4029. noembed: 'startTagRawText',
  4030. noscript: 'startTagRawText',
  4031. h1: 'startTagHeading',
  4032. h2: 'startTagHeading',
  4033. h3: 'startTagHeading',
  4034. h4: 'startTagHeading',
  4035. h5: 'startTagHeading',
  4036. h6: 'startTagHeading',
  4037. caption: 'startTagMisplaced',
  4038. col: 'startTagMisplaced',
  4039. colgroup: 'startTagMisplaced',
  4040. frame: 'startTagMisplaced',
  4041. frameset: 'startTagFrameset',
  4042. tbody: 'startTagMisplaced',
  4043. td: 'startTagMisplaced',
  4044. tfoot: 'startTagMisplaced',
  4045. th: 'startTagMisplaced',
  4046. thead: 'startTagMisplaced',
  4047. tr: 'startTagMisplaced',
  4048. option: 'startTagOptionOptgroup',
  4049. optgroup: 'startTagOptionOptgroup',
  4050. math: 'startTagMath',
  4051. svg: 'startTagSVG',
  4052. rt: 'startTagRpRt',
  4053. rp: 'startTagRpRt',
  4054. "-default": 'startTagOther'
  4055. };
  4056. modes.inBody.end_tag_handlers = {
  4057. p: 'endTagP',
  4058. body: 'endTagBody',
  4059. html: 'endTagHtml',
  4060. address: 'endTagBlock',
  4061. article: 'endTagBlock',
  4062. aside: 'endTagBlock',
  4063. blockquote: 'endTagBlock',
  4064. button: 'endTagBlock',
  4065. center: 'endTagBlock',
  4066. details: 'endTagBlock',
  4067. dir: 'endTagBlock',
  4068. div: 'endTagBlock',
  4069. dl: 'endTagBlock',
  4070. fieldset: 'endTagBlock',
  4071. figcaption: 'endTagBlock',
  4072. figure: 'endTagBlock',
  4073. footer: 'endTagBlock',
  4074. header: 'endTagBlock',
  4075. hgroup: 'endTagBlock',
  4076. listing: 'endTagBlock',
  4077. main: 'endTagBlock',
  4078. menu: 'endTagBlock',
  4079. nav: 'endTagBlock',
  4080. ol: 'endTagBlock',
  4081. pre: 'endTagBlock',
  4082. section: 'endTagBlock',
  4083. summary: 'endTagBlock',
  4084. ul: 'endTagBlock',
  4085. form: 'endTagForm',
  4086. applet: 'endTagAppletMarqueeObject',
  4087. marquee: 'endTagAppletMarqueeObject',
  4088. object: 'endTagAppletMarqueeObject',
  4089. dd: 'endTagListItem',
  4090. dt: 'endTagListItem',
  4091. li: 'endTagListItem',
  4092. h1: 'endTagHeading',
  4093. h2: 'endTagHeading',
  4094. h3: 'endTagHeading',
  4095. h4: 'endTagHeading',
  4096. h5: 'endTagHeading',
  4097. h6: 'endTagHeading',
  4098. a: 'endTagFormatting',
  4099. b: 'endTagFormatting',
  4100. big: 'endTagFormatting',
  4101. code: 'endTagFormatting',
  4102. em: 'endTagFormatting',
  4103. font: 'endTagFormatting',
  4104. i: 'endTagFormatting',
  4105. nobr: 'endTagFormatting',
  4106. s: 'endTagFormatting',
  4107. small: 'endTagFormatting',
  4108. strike: 'endTagFormatting',
  4109. strong: 'endTagFormatting',
  4110. tt: 'endTagFormatting',
  4111. u: 'endTagFormatting',
  4112. br: 'endTagBr',
  4113. "-default": 'endTagOther'
  4114. };
  4115. modes.inBody.processCharacters = function(buffer) {
  4116. if (tree.shouldSkipLeadingNewline) {
  4117. tree.shouldSkipLeadingNewline = false;
  4118. buffer.skipAtMostOneLeadingNewline();
  4119. }
  4120. tree.reconstructActiveFormattingElements();
  4121. var characters = buffer.takeRemaining();
  4122. characters = characters.replace(/\u0000/g, function(match, index){
  4123. tree.parseError("invalid-codepoint");
  4124. return '';
  4125. });
  4126. if (!characters)
  4127. return;
  4128. tree.insertText(characters);
  4129. if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
  4130. tree.framesetOk = false;
  4131. };
  4132. modes.inBody.startTagHtml = function(name, attributes) {
  4133. tree.parseError('non-html-root');
  4134. tree.addAttributesToElement(tree.openElements.rootNode, attributes);
  4135. };
  4136. modes.inBody.startTagProcessInHead = function(name, attributes) {
  4137. modes.inHead.processStartTag(name, attributes);
  4138. };
  4139. modes.inBody.startTagBody = function(name, attributes) {
  4140. tree.parseError('unexpected-start-tag', {name: 'body'});
  4141. if (tree.openElements.length == 1 ||
  4142. tree.openElements.item(1).localName != 'body') {
  4143. assert.ok(tree.context);
  4144. } else {
  4145. tree.framesetOk = false;
  4146. tree.addAttributesToElement(tree.openElements.bodyElement, attributes);
  4147. }
  4148. };
  4149. modes.inBody.startTagFrameset = function(name, attributes) {
  4150. tree.parseError('unexpected-start-tag', {name: 'frameset'});
  4151. if (tree.openElements.length == 1 ||
  4152. tree.openElements.item(1).localName != 'body') {
  4153. assert.ok(tree.context);
  4154. } else if (tree.framesetOk) {
  4155. tree.detachFromParent(tree.openElements.bodyElement);
  4156. while (tree.openElements.length > 1)
  4157. tree.openElements.pop();
  4158. tree.insertElement(name, attributes);
  4159. tree.setInsertionMode('inFrameset');
  4160. }
  4161. };
  4162. modes.inBody.startTagCloseP = function(name, attributes) {
  4163. if (tree.openElements.inButtonScope('p'))
  4164. this.endTagP('p');
  4165. tree.insertElement(name, attributes);
  4166. };
  4167. modes.inBody.startTagPreListing = function(name, attributes) {
  4168. if (tree.openElements.inButtonScope('p'))
  4169. this.endTagP('p');
  4170. tree.insertElement(name, attributes);
  4171. tree.framesetOk = false;
  4172. tree.shouldSkipLeadingNewline = true;
  4173. };
  4174. modes.inBody.startTagForm = function(name, attributes) {
  4175. if (tree.form) {
  4176. tree.parseError('unexpected-start-tag', {name: name});
  4177. } else {
  4178. if (tree.openElements.inButtonScope('p'))
  4179. this.endTagP('p');
  4180. tree.insertElement(name, attributes);
  4181. tree.form = tree.currentStackItem();
  4182. }
  4183. };
  4184. modes.inBody.startTagRpRt = function(name, attributes) {
  4185. if (tree.openElements.inScope('ruby')) {
  4186. tree.generateImpliedEndTags();
  4187. if (tree.currentStackItem().localName != 'ruby') {
  4188. tree.parseError('unexpected-start-tag', {name: name});
  4189. }
  4190. }
  4191. tree.insertElement(name, attributes);
  4192. };
  4193. modes.inBody.startTagListItem = function(name, attributes) {
  4194. var stopNames = {li: ['li'], dd: ['dd', 'dt'], dt: ['dd', 'dt']};
  4195. var stopName = stopNames[name];
  4196. var els = tree.openElements;
  4197. for (var i = els.length - 1; i >= 0; i--) {
  4198. var node = els.item(i);
  4199. if (stopName.indexOf(node.localName) != -1) {
  4200. tree.insertionMode.processEndTag(node.localName);
  4201. break;
  4202. }
  4203. if (node.isSpecial() && node.localName !== 'p' && node.localName !== 'address' && node.localName !== 'div')
  4204. break;
  4205. }
  4206. if (tree.openElements.inButtonScope('p'))
  4207. this.endTagP('p');
  4208. tree.insertElement(name, attributes);
  4209. tree.framesetOk = false;
  4210. };
  4211. modes.inBody.startTagPlaintext = function(name, attributes) {
  4212. if (tree.openElements.inButtonScope('p'))
  4213. this.endTagP('p');
  4214. tree.insertElement(name, attributes);
  4215. tree.tokenizer.setState(Tokenizer.PLAINTEXT);
  4216. };
  4217. modes.inBody.startTagHeading = function(name, attributes) {
  4218. if (tree.openElements.inButtonScope('p'))
  4219. this.endTagP('p');
  4220. if (tree.currentStackItem().isNumberedHeader()) {
  4221. tree.parseError('unexpected-start-tag', {name: name});
  4222. tree.popElement();
  4223. }
  4224. tree.insertElement(name, attributes);
  4225. };
  4226. modes.inBody.startTagA = function(name, attributes) {
  4227. var activeA = tree.elementInActiveFormattingElements('a');
  4228. if (activeA) {
  4229. tree.parseError("unexpected-start-tag-implies-end-tag", {startName: "a", endName: "a"});
  4230. tree.adoptionAgencyEndTag('a');
  4231. if (tree.openElements.contains(activeA))
  4232. tree.openElements.remove(activeA);
  4233. tree.removeElementFromActiveFormattingElements(activeA);
  4234. }
  4235. tree.reconstructActiveFormattingElements();
  4236. tree.insertFormattingElement(name, attributes);
  4237. };
  4238. modes.inBody.startTagFormatting = function(name, attributes) {
  4239. tree.reconstructActiveFormattingElements();
  4240. tree.insertFormattingElement(name, attributes);
  4241. };
  4242. modes.inBody.startTagNobr = function(name, attributes) {
  4243. tree.reconstructActiveFormattingElements();
  4244. if (tree.openElements.inScope('nobr')) {
  4245. tree.parseError("unexpected-start-tag-implies-end-tag", {startName: 'nobr', endName: 'nobr'});
  4246. this.processEndTag('nobr');
  4247. tree.reconstructActiveFormattingElements();
  4248. }
  4249. tree.insertFormattingElement(name, attributes);
  4250. };
  4251. modes.inBody.startTagButton = function(name, attributes) {
  4252. if (tree.openElements.inScope('button')) {
  4253. tree.parseError('unexpected-start-tag-implies-end-tag', {startName: 'button', endName: 'button'});
  4254. this.processEndTag('button');
  4255. tree.insertionMode.processStartTag(name, attributes);
  4256. } else {
  4257. tree.framesetOk = false;
  4258. tree.reconstructActiveFormattingElements();
  4259. tree.insertElement(name, attributes);
  4260. }
  4261. };
  4262. modes.inBody.startTagAppletMarqueeObject = function(name, attributes) {
  4263. tree.reconstructActiveFormattingElements();
  4264. tree.insertElement(name, attributes);
  4265. tree.activeFormattingElements.push(Marker);
  4266. tree.framesetOk = false;
  4267. };
  4268. modes.inBody.endTagAppletMarqueeObject = function(name) {
  4269. if (!tree.openElements.inScope(name)) {
  4270. tree.parseError("unexpected-end-tag", {name: name});
  4271. } else {
  4272. tree.generateImpliedEndTags();
  4273. if (tree.currentStackItem().localName != name) {
  4274. tree.parseError('end-tag-too-early', {name: name});
  4275. }
  4276. tree.openElements.popUntilPopped(name);
  4277. tree.clearActiveFormattingElements();
  4278. }
  4279. };
  4280. modes.inBody.startTagXmp = function(name, attributes) {
  4281. if (tree.openElements.inButtonScope('p'))
  4282. this.processEndTag('p');
  4283. tree.reconstructActiveFormattingElements();
  4284. tree.processGenericRawTextStartTag(name, attributes);
  4285. tree.framesetOk = false;
  4286. };
  4287. modes.inBody.startTagTable = function(name, attributes) {
  4288. if (tree.compatMode !== "quirks")
  4289. if (tree.openElements.inButtonScope('p'))
  4290. this.processEndTag('p');
  4291. tree.insertElement(name, attributes);
  4292. tree.setInsertionMode('inTable');
  4293. tree.framesetOk = false;
  4294. };
  4295. modes.inBody.startTagVoidFormatting = function(name, attributes) {
  4296. tree.reconstructActiveFormattingElements();
  4297. tree.insertSelfClosingElement(name, attributes);
  4298. tree.framesetOk = false;
  4299. };
  4300. modes.inBody.startTagParamSourceTrack = function(name, attributes) {
  4301. tree.insertSelfClosingElement(name, attributes);
  4302. };
  4303. modes.inBody.startTagHr = function(name, attributes) {
  4304. if (tree.openElements.inButtonScope('p'))
  4305. this.endTagP('p');
  4306. tree.insertSelfClosingElement(name, attributes);
  4307. tree.framesetOk = false;
  4308. };
  4309. modes.inBody.startTagImage = function(name, attributes) {
  4310. tree.parseError('unexpected-start-tag-treated-as', {originalName: 'image', newName: 'img'});
  4311. this.processStartTag('img', attributes);
  4312. };
  4313. modes.inBody.startTagInput = function(name, attributes) {
  4314. var currentFramesetOk = tree.framesetOk;
  4315. this.startTagVoidFormatting(name, attributes);
  4316. for (var key in attributes) {
  4317. if (attributes[key].nodeName == 'type') {
  4318. if (attributes[key].nodeValue.toLowerCase() == 'hidden')
  4319. tree.framesetOk = currentFramesetOk;
  4320. break;
  4321. }
  4322. }
  4323. };
  4324. modes.inBody.startTagIsindex = function(name, attributes) {
  4325. tree.parseError('deprecated-tag', {name: 'isindex'});
  4326. tree.selfClosingFlagAcknowledged = true;
  4327. if (tree.form)
  4328. return;
  4329. var formAttributes = [];
  4330. var inputAttributes = [];
  4331. var prompt = "This is a searchable index. Enter search keywords: ";
  4332. for (var key in attributes) {
  4333. switch (attributes[key].nodeName) {
  4334. case 'action':
  4335. formAttributes.push({nodeName: 'action',
  4336. nodeValue: attributes[key].nodeValue});
  4337. break;
  4338. case 'prompt':
  4339. prompt = attributes[key].nodeValue;
  4340. break;
  4341. case 'name':
  4342. break;
  4343. default:
  4344. inputAttributes.push({nodeName: attributes[key].nodeName,
  4345. nodeValue: attributes[key].nodeValue});
  4346. }
  4347. }
  4348. inputAttributes.push({nodeName: 'name', nodeValue: 'isindex'});
  4349. this.processStartTag('form', formAttributes);
  4350. this.processStartTag('hr');
  4351. this.processStartTag('label');
  4352. this.processCharacters(new CharacterBuffer(prompt));
  4353. this.processStartTag('input', inputAttributes);
  4354. this.processEndTag('label');
  4355. this.processStartTag('hr');
  4356. this.processEndTag('form');
  4357. };
  4358. modes.inBody.startTagTextarea = function(name, attributes) {
  4359. tree.insertElement(name, attributes);
  4360. tree.tokenizer.setState(Tokenizer.RCDATA);
  4361. tree.originalInsertionMode = tree.insertionModeName;
  4362. tree.shouldSkipLeadingNewline = true;
  4363. tree.framesetOk = false;
  4364. tree.setInsertionMode('text');
  4365. };
  4366. modes.inBody.startTagIFrame = function(name, attributes) {
  4367. tree.framesetOk = false;
  4368. this.startTagRawText(name, attributes);
  4369. };
  4370. modes.inBody.startTagRawText = function(name, attributes) {
  4371. tree.processGenericRawTextStartTag(name, attributes);
  4372. };
  4373. modes.inBody.startTagSelect = function(name, attributes) {
  4374. tree.reconstructActiveFormattingElements();
  4375. tree.insertElement(name, attributes);
  4376. tree.framesetOk = false;
  4377. var insertionModeName = tree.insertionModeName;
  4378. if (insertionModeName == 'inTable' ||
  4379. insertionModeName == 'inCaption' ||
  4380. insertionModeName == 'inColumnGroup' ||
  4381. insertionModeName == 'inTableBody' ||
  4382. insertionModeName == 'inRow' ||
  4383. insertionModeName == 'inCell') {
  4384. tree.setInsertionMode('inSelectInTable');
  4385. } else {
  4386. tree.setInsertionMode('inSelect');
  4387. }
  4388. };
  4389. modes.inBody.startTagMisplaced = function(name, attributes) {
  4390. tree.parseError('unexpected-start-tag-ignored', {name: name});
  4391. };
  4392. modes.inBody.endTagMisplaced = function(name) {
  4393. tree.parseError("unexpected-end-tag", {name: name});
  4394. };
  4395. modes.inBody.endTagBr = function(name) {
  4396. tree.parseError("unexpected-end-tag-treated-as", {originalName: "br", newName: "br element"});
  4397. tree.reconstructActiveFormattingElements();
  4398. tree.insertElement(name, []);
  4399. tree.popElement();
  4400. };
  4401. modes.inBody.startTagOptionOptgroup = function(name, attributes) {
  4402. if (tree.currentStackItem().localName == 'option')
  4403. tree.popElement();
  4404. tree.reconstructActiveFormattingElements();
  4405. tree.insertElement(name, attributes);
  4406. };
  4407. modes.inBody.startTagOther = function(name, attributes) {
  4408. tree.reconstructActiveFormattingElements();
  4409. tree.insertElement(name, attributes);
  4410. };
  4411. modes.inBody.endTagOther = function(name) {
  4412. var node;
  4413. for (var i = tree.openElements.length - 1; i > 0; i--) {
  4414. node = tree.openElements.item(i);
  4415. if (node.localName == name) {
  4416. tree.generateImpliedEndTags(name);
  4417. if (tree.currentStackItem().localName != name)
  4418. tree.parseError('unexpected-end-tag', {name: name});
  4419. tree.openElements.remove_openElements_until(function(x) {return x === node;});
  4420. break;
  4421. }
  4422. if (node.isSpecial()) {
  4423. tree.parseError('unexpected-end-tag', {name: name});
  4424. break;
  4425. }
  4426. }
  4427. };
  4428. modes.inBody.startTagMath = function(name, attributes, selfClosing) {
  4429. tree.reconstructActiveFormattingElements();
  4430. attributes = tree.adjustMathMLAttributes(attributes);
  4431. attributes = tree.adjustForeignAttributes(attributes);
  4432. tree.insertForeignElement(name, attributes, "http://www.w3.org/1998/Math/MathML", selfClosing);
  4433. };
  4434. modes.inBody.startTagSVG = function(name, attributes, selfClosing) {
  4435. tree.reconstructActiveFormattingElements();
  4436. attributes = tree.adjustSVGAttributes(attributes);
  4437. attributes = tree.adjustForeignAttributes(attributes);
  4438. tree.insertForeignElement(name, attributes, "http://www.w3.org/2000/svg", selfClosing);
  4439. };
  4440. modes.inBody.endTagP = function(name) {
  4441. if (!tree.openElements.inButtonScope('p')) {
  4442. tree.parseError('unexpected-end-tag', {name: 'p'});
  4443. this.startTagCloseP('p', []);
  4444. this.endTagP('p');
  4445. } else {
  4446. tree.generateImpliedEndTags('p');
  4447. if (tree.currentStackItem().localName != 'p')
  4448. tree.parseError('unexpected-implied-end-tag', {name: 'p'});
  4449. tree.openElements.popUntilPopped(name);
  4450. }
  4451. };
  4452. modes.inBody.endTagBody = function(name) {
  4453. if (!tree.openElements.inScope('body')) {
  4454. tree.parseError('unexpected-end-tag', {name: name});
  4455. return;
  4456. }
  4457. if (tree.currentStackItem().localName != 'body') {
  4458. tree.parseError('expected-one-end-tag-but-got-another', {
  4459. expectedName: tree.currentStackItem().localName,
  4460. gotName: name
  4461. });
  4462. }
  4463. tree.setInsertionMode('afterBody');
  4464. };
  4465. modes.inBody.endTagHtml = function(name) {
  4466. if (!tree.openElements.inScope('body')) {
  4467. tree.parseError('unexpected-end-tag', {name: name});
  4468. return;
  4469. }
  4470. if (tree.currentStackItem().localName != 'body') {
  4471. tree.parseError('expected-one-end-tag-but-got-another', {
  4472. expectedName: tree.currentStackItem().localName,
  4473. gotName: name
  4474. });
  4475. }
  4476. tree.setInsertionMode('afterBody');
  4477. tree.insertionMode.processEndTag(name);
  4478. };
  4479. modes.inBody.endTagBlock = function(name) {
  4480. if (!tree.openElements.inScope(name)) {
  4481. tree.parseError('unexpected-end-tag', {name: name});
  4482. } else {
  4483. tree.generateImpliedEndTags();
  4484. if (tree.currentStackItem().localName != name) {
  4485. tree.parseError('end-tag-too-early', {name: name});
  4486. }
  4487. tree.openElements.popUntilPopped(name);
  4488. }
  4489. };
  4490. modes.inBody.endTagForm = function(name) {
  4491. var node = tree.form;
  4492. tree.form = null;
  4493. if (!node || !tree.openElements.inScope(name)) {
  4494. tree.parseError('unexpected-end-tag', {name: name});
  4495. } else {
  4496. tree.generateImpliedEndTags();
  4497. if (tree.currentStackItem() != node) {
  4498. tree.parseError('end-tag-too-early-ignored', {name: 'form'});
  4499. }
  4500. tree.openElements.remove(node);
  4501. }
  4502. };
  4503. modes.inBody.endTagListItem = function(name) {
  4504. if (!tree.openElements.inListItemScope(name)) {
  4505. tree.parseError('unexpected-end-tag', {name: name});
  4506. } else {
  4507. tree.generateImpliedEndTags(name);
  4508. if (tree.currentStackItem().localName != name)
  4509. tree.parseError('end-tag-too-early', {name: name});
  4510. tree.openElements.popUntilPopped(name);
  4511. }
  4512. };
  4513. modes.inBody.endTagHeading = function(name) {
  4514. if (!tree.openElements.hasNumberedHeaderElementInScope()) {
  4515. tree.parseError('unexpected-end-tag', {name: name});
  4516. return;
  4517. }
  4518. tree.generateImpliedEndTags();
  4519. if (tree.currentStackItem().localName != name)
  4520. tree.parseError('end-tag-too-early', {name: name});
  4521. tree.openElements.remove_openElements_until(function(e) {
  4522. return e.isNumberedHeader();
  4523. });
  4524. };
  4525. modes.inBody.endTagFormatting = function(name, attributes) {
  4526. if (!tree.adoptionAgencyEndTag(name))
  4527. this.endTagOther(name, attributes);
  4528. };
  4529. modes.inCaption = Object.create(modes.base);
  4530. modes.inCaption.start_tag_handlers = {
  4531. html: 'startTagHtml',
  4532. caption: 'startTagTableElement',
  4533. col: 'startTagTableElement',
  4534. colgroup: 'startTagTableElement',
  4535. tbody: 'startTagTableElement',
  4536. td: 'startTagTableElement',
  4537. tfoot: 'startTagTableElement',
  4538. thead: 'startTagTableElement',
  4539. tr: 'startTagTableElement',
  4540. '-default': 'startTagOther'
  4541. };
  4542. modes.inCaption.end_tag_handlers = {
  4543. caption: 'endTagCaption',
  4544. table: 'endTagTable',
  4545. body: 'endTagIgnore',
  4546. col: 'endTagIgnore',
  4547. colgroup: 'endTagIgnore',
  4548. html: 'endTagIgnore',
  4549. tbody: 'endTagIgnore',
  4550. td: 'endTagIgnore',
  4551. tfood: 'endTagIgnore',
  4552. thead: 'endTagIgnore',
  4553. tr: 'endTagIgnore',
  4554. '-default': 'endTagOther'
  4555. };
  4556. modes.inCaption.processCharacters = function(data) {
  4557. modes.inBody.processCharacters(data);
  4558. };
  4559. modes.inCaption.startTagTableElement = function(name, attributes) {
  4560. tree.parseError('unexpected-end-tag', {name: name});
  4561. var ignoreEndTag = !tree.openElements.inTableScope('caption');
  4562. tree.insertionMode.processEndTag('caption');
  4563. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes);
  4564. };
  4565. modes.inCaption.startTagOther = function(name, attributes, selfClosing) {
  4566. modes.inBody.processStartTag(name, attributes, selfClosing);
  4567. };
  4568. modes.inCaption.endTagCaption = function(name) {
  4569. if (!tree.openElements.inTableScope('caption')) {
  4570. assert.ok(tree.context);
  4571. tree.parseError('unexpected-end-tag', {name: name});
  4572. } else {
  4573. tree.generateImpliedEndTags();
  4574. if (tree.currentStackItem().localName != 'caption') {
  4575. tree.parseError('expected-one-end-tag-but-got-another', {
  4576. gotName: "caption",
  4577. expectedName: tree.currentStackItem().localName
  4578. });
  4579. }
  4580. tree.openElements.popUntilPopped('caption');
  4581. tree.clearActiveFormattingElements();
  4582. tree.setInsertionMode('inTable');
  4583. }
  4584. };
  4585. modes.inCaption.endTagTable = function(name) {
  4586. tree.parseError("unexpected-end-table-in-caption");
  4587. var ignoreEndTag = !tree.openElements.inTableScope('caption');
  4588. tree.insertionMode.processEndTag('caption');
  4589. if (!ignoreEndTag) tree.insertionMode.processEndTag(name);
  4590. };
  4591. modes.inCaption.endTagIgnore = function(name) {
  4592. tree.parseError('unexpected-end-tag', {name: name});
  4593. };
  4594. modes.inCaption.endTagOther = function(name) {
  4595. modes.inBody.processEndTag(name);
  4596. };
  4597. modes.inCell = Object.create(modes.base);
  4598. modes.inCell.start_tag_handlers = {
  4599. html: 'startTagHtml',
  4600. caption: 'startTagTableOther',
  4601. col: 'startTagTableOther',
  4602. colgroup: 'startTagTableOther',
  4603. tbody: 'startTagTableOther',
  4604. td: 'startTagTableOther',
  4605. tfoot: 'startTagTableOther',
  4606. th: 'startTagTableOther',
  4607. thead: 'startTagTableOther',
  4608. tr: 'startTagTableOther',
  4609. '-default': 'startTagOther'
  4610. };
  4611. modes.inCell.end_tag_handlers = {
  4612. td: 'endTagTableCell',
  4613. th: 'endTagTableCell',
  4614. body: 'endTagIgnore',
  4615. caption: 'endTagIgnore',
  4616. col: 'endTagIgnore',
  4617. colgroup: 'endTagIgnore',
  4618. html: 'endTagIgnore',
  4619. table: 'endTagImply',
  4620. tbody: 'endTagImply',
  4621. tfoot: 'endTagImply',
  4622. thead: 'endTagImply',
  4623. tr: 'endTagImply',
  4624. '-default': 'endTagOther'
  4625. };
  4626. modes.inCell.processCharacters = function(data) {
  4627. modes.inBody.processCharacters(data);
  4628. };
  4629. modes.inCell.startTagTableOther = function(name, attributes, selfClosing) {
  4630. if (tree.openElements.inTableScope('td') || tree.openElements.inTableScope('th')) {
  4631. this.closeCell();
  4632. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4633. } else {
  4634. tree.parseError('unexpected-start-tag', {name: name});
  4635. }
  4636. };
  4637. modes.inCell.startTagOther = function(name, attributes, selfClosing) {
  4638. modes.inBody.processStartTag(name, attributes, selfClosing);
  4639. };
  4640. modes.inCell.endTagTableCell = function(name) {
  4641. if (tree.openElements.inTableScope(name)) {
  4642. tree.generateImpliedEndTags(name);
  4643. if (tree.currentStackItem().localName != name.toLowerCase()) {
  4644. tree.parseError('unexpected-cell-end-tag', {name: name});
  4645. tree.openElements.popUntilPopped(name);
  4646. } else {
  4647. tree.popElement();
  4648. }
  4649. tree.clearActiveFormattingElements();
  4650. tree.setInsertionMode('inRow');
  4651. } else {
  4652. tree.parseError('unexpected-end-tag', {name: name});
  4653. }
  4654. };
  4655. modes.inCell.endTagIgnore = function(name) {
  4656. tree.parseError('unexpected-end-tag', {name: name});
  4657. };
  4658. modes.inCell.endTagImply = function(name) {
  4659. if (tree.openElements.inTableScope(name)) {
  4660. this.closeCell();
  4661. tree.insertionMode.processEndTag(name);
  4662. } else {
  4663. tree.parseError('unexpected-end-tag', {name: name});
  4664. }
  4665. };
  4666. modes.inCell.endTagOther = function(name) {
  4667. modes.inBody.processEndTag(name);
  4668. };
  4669. modes.inCell.closeCell = function() {
  4670. if (tree.openElements.inTableScope('td')) {
  4671. this.endTagTableCell('td');
  4672. } else if (tree.openElements.inTableScope('th')) {
  4673. this.endTagTableCell('th');
  4674. }
  4675. };
  4676. modes.inColumnGroup = Object.create(modes.base);
  4677. modes.inColumnGroup.start_tag_handlers = {
  4678. html: 'startTagHtml',
  4679. col: 'startTagCol',
  4680. '-default': 'startTagOther'
  4681. };
  4682. modes.inColumnGroup.end_tag_handlers = {
  4683. colgroup: 'endTagColgroup',
  4684. col: 'endTagCol',
  4685. '-default': 'endTagOther'
  4686. };
  4687. modes.inColumnGroup.ignoreEndTagColgroup = function() {
  4688. return tree.currentStackItem().localName == 'html';
  4689. };
  4690. modes.inColumnGroup.processCharacters = function(buffer) {
  4691. var leadingWhitespace = buffer.takeLeadingWhitespace();
  4692. if (leadingWhitespace)
  4693. tree.insertText(leadingWhitespace);
  4694. if (!buffer.length)
  4695. return;
  4696. var ignoreEndTag = this.ignoreEndTagColgroup();
  4697. this.endTagColgroup('colgroup');
  4698. if (!ignoreEndTag) tree.insertionMode.processCharacters(buffer);
  4699. };
  4700. modes.inColumnGroup.startTagCol = function(name, attributes) {
  4701. tree.insertSelfClosingElement(name, attributes);
  4702. };
  4703. modes.inColumnGroup.startTagOther = function(name, attributes, selfClosing) {
  4704. var ignoreEndTag = this.ignoreEndTagColgroup();
  4705. this.endTagColgroup('colgroup');
  4706. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4707. };
  4708. modes.inColumnGroup.endTagColgroup = function(name) {
  4709. if (this.ignoreEndTagColgroup()) {
  4710. assert.ok(tree.context);
  4711. tree.parseError('unexpected-end-tag', {name: name});
  4712. } else {
  4713. tree.popElement();
  4714. tree.setInsertionMode('inTable');
  4715. }
  4716. };
  4717. modes.inColumnGroup.endTagCol = function(name) {
  4718. tree.parseError("no-end-tag", {name: 'col'});
  4719. };
  4720. modes.inColumnGroup.endTagOther = function(name) {
  4721. var ignoreEndTag = this.ignoreEndTagColgroup();
  4722. this.endTagColgroup('colgroup');
  4723. if (!ignoreEndTag) tree.insertionMode.processEndTag(name) ;
  4724. };
  4725. modes.inForeignContent = Object.create(modes.base);
  4726. modes.inForeignContent.processStartTag = function(name, attributes, selfClosing) {
  4727. if (['b', 'big', 'blockquote', 'body', 'br', 'center', 'code', 'dd', 'div', 'dl', 'dt', 'em', 'embed', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', 'i', 'img', 'li', 'listing', 'menu', 'meta', 'nobr', 'ol', 'p', 'pre', 'ruby', 's', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'table', 'tt', 'u', 'ul', 'var'].indexOf(name) != -1
  4728. || (name == 'font' && attributes.some(function(attr){ return ['color', 'face', 'size'].indexOf(attr.nodeName) >= 0 }))) {
  4729. tree.parseError('unexpected-html-element-in-foreign-content', {name: name});
  4730. while (tree.currentStackItem().isForeign()
  4731. && !tree.currentStackItem().isHtmlIntegrationPoint()
  4732. && !tree.currentStackItem().isMathMLTextIntegrationPoint()) {
  4733. tree.openElements.pop();
  4734. }
  4735. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4736. return;
  4737. }
  4738. if (tree.currentStackItem().namespaceURI == "http://www.w3.org/1998/Math/MathML") {
  4739. attributes = tree.adjustMathMLAttributes(attributes);
  4740. }
  4741. if (tree.currentStackItem().namespaceURI == "http://www.w3.org/2000/svg") {
  4742. name = tree.adjustSVGTagNameCase(name);
  4743. attributes = tree.adjustSVGAttributes(attributes);
  4744. }
  4745. attributes = tree.adjustForeignAttributes(attributes);
  4746. tree.insertForeignElement(name, attributes, tree.currentStackItem().namespaceURI, selfClosing);
  4747. };
  4748. modes.inForeignContent.processEndTag = function(name) {
  4749. var node = tree.currentStackItem();
  4750. var index = tree.openElements.length - 1;
  4751. if (node.localName.toLowerCase() != name)
  4752. tree.parseError("unexpected-end-tag", {name: name});
  4753. while (true) {
  4754. if (index === 0)
  4755. break;
  4756. if (node.localName.toLowerCase() == name) {
  4757. while (tree.openElements.pop() != node);
  4758. break;
  4759. }
  4760. index -= 1;
  4761. node = tree.openElements.item(index);
  4762. if (node.isForeign()) {
  4763. continue;
  4764. } else {
  4765. tree.insertionMode.processEndTag(name);
  4766. break;
  4767. }
  4768. }
  4769. };
  4770. modes.inForeignContent.processCharacters = function(buffer) {
  4771. var characters = buffer.takeRemaining();
  4772. characters = characters.replace(/\u0000/g, function(match, index){
  4773. tree.parseError('invalid-codepoint');
  4774. return '\uFFFD';
  4775. });
  4776. if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
  4777. tree.framesetOk = false;
  4778. tree.insertText(characters);
  4779. };
  4780. modes.inHeadNoscript = Object.create(modes.base);
  4781. modes.inHeadNoscript.start_tag_handlers = {
  4782. html: 'startTagHtml',
  4783. basefont: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4784. bgsound: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4785. link: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4786. meta: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4787. noframes: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4788. style: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4789. head: 'startTagHeadNoscript',
  4790. noscript: 'startTagHeadNoscript',
  4791. "-default": 'startTagOther'
  4792. };
  4793. modes.inHeadNoscript.end_tag_handlers = {
  4794. noscript: 'endTagNoscript',
  4795. br: 'endTagBr',
  4796. '-default': 'endTagOther'
  4797. };
  4798. modes.inHeadNoscript.processCharacters = function(buffer) {
  4799. var leadingWhitespace = buffer.takeLeadingWhitespace();
  4800. if (leadingWhitespace)
  4801. tree.insertText(leadingWhitespace);
  4802. if (!buffer.length)
  4803. return;
  4804. tree.parseError("unexpected-char-in-frameset");
  4805. this.anythingElse();
  4806. tree.insertionMode.processCharacters(buffer);
  4807. };
  4808. modes.inHeadNoscript.processComment = function(data) {
  4809. modes.inHead.processComment(data);
  4810. };
  4811. modes.inHeadNoscript.startTagBasefontBgsoundLinkMetaNoframesStyle = function(name, attributes) {
  4812. modes.inHead.processStartTag(name, attributes);
  4813. };
  4814. modes.inHeadNoscript.startTagHeadNoscript = function(name, attributes) {
  4815. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4816. };
  4817. modes.inHeadNoscript.startTagOther = function(name, attributes) {
  4818. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4819. this.anythingElse();
  4820. tree.insertionMode.processStartTag(name, attributes);
  4821. };
  4822. modes.inHeadNoscript.endTagBr = function(name, attributes) {
  4823. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4824. this.anythingElse();
  4825. tree.insertionMode.processEndTag(name, attributes);
  4826. };
  4827. modes.inHeadNoscript.endTagNoscript = function(name, attributes) {
  4828. tree.popElement();
  4829. tree.setInsertionMode('inHead');
  4830. };
  4831. modes.inHeadNoscript.endTagOther = function(name, attributes) {
  4832. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4833. };
  4834. modes.inHeadNoscript.anythingElse = function() {
  4835. tree.popElement();
  4836. tree.setInsertionMode('inHead');
  4837. };
  4838. modes.inFrameset = Object.create(modes.base);
  4839. modes.inFrameset.start_tag_handlers = {
  4840. html: 'startTagHtml',
  4841. frameset: 'startTagFrameset',
  4842. frame: 'startTagFrame',
  4843. noframes: 'startTagNoframes',
  4844. "-default": 'startTagOther'
  4845. };
  4846. modes.inFrameset.end_tag_handlers = {
  4847. frameset: 'endTagFrameset',
  4848. noframes: 'endTagNoframes',
  4849. '-default': 'endTagOther'
  4850. };
  4851. modes.inFrameset.processCharacters = function(data) {
  4852. tree.parseError("unexpected-char-in-frameset");
  4853. };
  4854. modes.inFrameset.startTagFrameset = function(name, attributes) {
  4855. tree.insertElement(name, attributes);
  4856. };
  4857. modes.inFrameset.startTagFrame = function(name, attributes) {
  4858. tree.insertSelfClosingElement(name, attributes);
  4859. };
  4860. modes.inFrameset.startTagNoframes = function(name, attributes) {
  4861. modes.inBody.processStartTag(name, attributes);
  4862. };
  4863. modes.inFrameset.startTagOther = function(name, attributes) {
  4864. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4865. };
  4866. modes.inFrameset.endTagFrameset = function(name, attributes) {
  4867. if (tree.currentStackItem().localName == 'html') {
  4868. tree.parseError("unexpected-frameset-in-frameset-innerhtml");
  4869. } else {
  4870. tree.popElement();
  4871. }
  4872. if (!tree.context && tree.currentStackItem().localName != 'frameset') {
  4873. tree.setInsertionMode('afterFrameset');
  4874. }
  4875. };
  4876. modes.inFrameset.endTagNoframes = function(name) {
  4877. modes.inBody.processEndTag(name);
  4878. };
  4879. modes.inFrameset.endTagOther = function(name) {
  4880. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4881. };
  4882. modes.inTable = Object.create(modes.base);
  4883. modes.inTable.start_tag_handlers = {
  4884. html: 'startTagHtml',
  4885. caption: 'startTagCaption',
  4886. colgroup: 'startTagColgroup',
  4887. col: 'startTagCol',
  4888. table: 'startTagTable',
  4889. tbody: 'startTagRowGroup',
  4890. tfoot: 'startTagRowGroup',
  4891. thead: 'startTagRowGroup',
  4892. td: 'startTagImplyTbody',
  4893. th: 'startTagImplyTbody',
  4894. tr: 'startTagImplyTbody',
  4895. style: 'startTagStyleScript',
  4896. script: 'startTagStyleScript',
  4897. input: 'startTagInput',
  4898. form: 'startTagForm',
  4899. '-default': 'startTagOther'
  4900. };
  4901. modes.inTable.end_tag_handlers = {
  4902. table: 'endTagTable',
  4903. body: 'endTagIgnore',
  4904. caption: 'endTagIgnore',
  4905. col: 'endTagIgnore',
  4906. colgroup: 'endTagIgnore',
  4907. html: 'endTagIgnore',
  4908. tbody: 'endTagIgnore',
  4909. td: 'endTagIgnore',
  4910. tfoot: 'endTagIgnore',
  4911. th: 'endTagIgnore',
  4912. thead: 'endTagIgnore',
  4913. tr: 'endTagIgnore',
  4914. '-default': 'endTagOther'
  4915. };
  4916. modes.inTable.processCharacters = function(data) {
  4917. if (tree.currentStackItem().isFosterParenting()) {
  4918. var originalInsertionMode = tree.insertionModeName;
  4919. tree.setInsertionMode('inTableText');
  4920. tree.originalInsertionMode = originalInsertionMode;
  4921. tree.insertionMode.processCharacters(data);
  4922. } else {
  4923. tree.redirectAttachToFosterParent = true;
  4924. modes.inBody.processCharacters(data);
  4925. tree.redirectAttachToFosterParent = false;
  4926. }
  4927. };
  4928. modes.inTable.startTagCaption = function(name, attributes) {
  4929. tree.openElements.popUntilTableScopeMarker();
  4930. tree.activeFormattingElements.push(Marker);
  4931. tree.insertElement(name, attributes);
  4932. tree.setInsertionMode('inCaption');
  4933. };
  4934. modes.inTable.startTagColgroup = function(name, attributes) {
  4935. tree.openElements.popUntilTableScopeMarker();
  4936. tree.insertElement(name, attributes);
  4937. tree.setInsertionMode('inColumnGroup');
  4938. };
  4939. modes.inTable.startTagCol = function(name, attributes) {
  4940. this.startTagColgroup('colgroup', []);
  4941. tree.insertionMode.processStartTag(name, attributes);
  4942. };
  4943. modes.inTable.startTagRowGroup = function(name, attributes) {
  4944. tree.openElements.popUntilTableScopeMarker();
  4945. tree.insertElement(name, attributes);
  4946. tree.setInsertionMode('inTableBody');
  4947. };
  4948. modes.inTable.startTagImplyTbody = function(name, attributes) {
  4949. this.startTagRowGroup('tbody', []);
  4950. tree.insertionMode.processStartTag(name, attributes);
  4951. };
  4952. modes.inTable.startTagTable = function(name, attributes) {
  4953. tree.parseError("unexpected-start-tag-implies-end-tag",
  4954. {startName: "table", endName: "table"});
  4955. tree.insertionMode.processEndTag('table');
  4956. if (!tree.context) tree.insertionMode.processStartTag(name, attributes);
  4957. };
  4958. modes.inTable.startTagStyleScript = function(name, attributes) {
  4959. modes.inHead.processStartTag(name, attributes);
  4960. };
  4961. modes.inTable.startTagInput = function(name, attributes) {
  4962. for (var key in attributes) {
  4963. if (attributes[key].nodeName.toLowerCase() == 'type') {
  4964. if (attributes[key].nodeValue.toLowerCase() == 'hidden') {
  4965. tree.parseError("unexpected-hidden-input-in-table");
  4966. tree.insertElement(name, attributes);
  4967. tree.openElements.pop();
  4968. return;
  4969. }
  4970. break;
  4971. }
  4972. }
  4973. this.startTagOther(name, attributes);
  4974. };
  4975. modes.inTable.startTagForm = function(name, attributes) {
  4976. tree.parseError("unexpected-form-in-table");
  4977. if (!tree.form) {
  4978. tree.insertElement(name, attributes);
  4979. tree.form = tree.currentStackItem();
  4980. tree.openElements.pop();
  4981. }
  4982. };
  4983. modes.inTable.startTagOther = function(name, attributes, selfClosing) {
  4984. tree.parseError("unexpected-start-tag-implies-table-voodoo", {name: name});
  4985. tree.redirectAttachToFosterParent = true;
  4986. modes.inBody.processStartTag(name, attributes, selfClosing);
  4987. tree.redirectAttachToFosterParent = false;
  4988. };
  4989. modes.inTable.endTagTable = function(name) {
  4990. if (tree.openElements.inTableScope(name)) {
  4991. tree.generateImpliedEndTags();
  4992. if (tree.currentStackItem().localName != name) {
  4993. tree.parseError("end-tag-too-early-named", {gotName: 'table', expectedName: tree.currentStackItem().localName});
  4994. }
  4995. tree.openElements.popUntilPopped('table');
  4996. tree.resetInsertionMode();
  4997. } else {
  4998. assert.ok(tree.context);
  4999. tree.parseError('unexpected-end-tag', {name: name});
  5000. }
  5001. };
  5002. modes.inTable.endTagIgnore = function(name) {
  5003. tree.parseError("unexpected-end-tag", {name: name});
  5004. };
  5005. modes.inTable.endTagOther = function(name) {
  5006. tree.parseError("unexpected-end-tag-implies-table-voodoo", {name: name});
  5007. tree.redirectAttachToFosterParent = true;
  5008. modes.inBody.processEndTag(name);
  5009. tree.redirectAttachToFosterParent = false;
  5010. };
  5011. modes.inTableText = Object.create(modes.base);
  5012. modes.inTableText.flushCharacters = function() {
  5013. var characters = tree.pendingTableCharacters.join('');
  5014. if (!isAllWhitespace(characters)) {
  5015. tree.redirectAttachToFosterParent = true;
  5016. tree.reconstructActiveFormattingElements();
  5017. tree.insertText(characters);
  5018. tree.framesetOk = false;
  5019. tree.redirectAttachToFosterParent = false;
  5020. } else {
  5021. tree.insertText(characters);
  5022. }
  5023. tree.pendingTableCharacters = [];
  5024. };
  5025. modes.inTableText.processComment = function(data) {
  5026. this.flushCharacters();
  5027. tree.setInsertionMode(tree.originalInsertionMode);
  5028. tree.insertionMode.processComment(data);
  5029. };
  5030. modes.inTableText.processEOF = function(data) {
  5031. this.flushCharacters();
  5032. tree.setInsertionMode(tree.originalInsertionMode);
  5033. tree.insertionMode.processEOF();
  5034. };
  5035. modes.inTableText.processCharacters = function(buffer) {
  5036. var characters = buffer.takeRemaining();
  5037. characters = characters.replace(/\u0000/g, function(match, index){
  5038. tree.parseError("invalid-codepoint");
  5039. return '';
  5040. });
  5041. if (!characters)
  5042. return;
  5043. tree.pendingTableCharacters.push(characters);
  5044. };
  5045. modes.inTableText.processStartTag = function(name, attributes, selfClosing) {
  5046. this.flushCharacters();
  5047. tree.setInsertionMode(tree.originalInsertionMode);
  5048. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  5049. };
  5050. modes.inTableText.processEndTag = function(name, attributes) {
  5051. this.flushCharacters();
  5052. tree.setInsertionMode(tree.originalInsertionMode);
  5053. tree.insertionMode.processEndTag(name, attributes);
  5054. };
  5055. modes.inTableBody = Object.create(modes.base);
  5056. modes.inTableBody.start_tag_handlers = {
  5057. html: 'startTagHtml',
  5058. tr: 'startTagTr',
  5059. td: 'startTagTableCell',
  5060. th: 'startTagTableCell',
  5061. caption: 'startTagTableOther',
  5062. col: 'startTagTableOther',
  5063. colgroup: 'startTagTableOther',
  5064. tbody: 'startTagTableOther',
  5065. tfoot: 'startTagTableOther',
  5066. thead: 'startTagTableOther',
  5067. '-default': 'startTagOther'
  5068. };
  5069. modes.inTableBody.end_tag_handlers = {
  5070. table: 'endTagTable',
  5071. tbody: 'endTagTableRowGroup',
  5072. tfoot: 'endTagTableRowGroup',
  5073. thead: 'endTagTableRowGroup',
  5074. body: 'endTagIgnore',
  5075. caption: 'endTagIgnore',
  5076. col: 'endTagIgnore',
  5077. colgroup: 'endTagIgnore',
  5078. html: 'endTagIgnore',
  5079. td: 'endTagIgnore',
  5080. th: 'endTagIgnore',
  5081. tr: 'endTagIgnore',
  5082. '-default': 'endTagOther'
  5083. };
  5084. modes.inTableBody.processCharacters = function(data) {
  5085. modes.inTable.processCharacters(data);
  5086. };
  5087. modes.inTableBody.startTagTr = function(name, attributes) {
  5088. tree.openElements.popUntilTableBodyScopeMarker();
  5089. tree.insertElement(name, attributes);
  5090. tree.setInsertionMode('inRow');
  5091. };
  5092. modes.inTableBody.startTagTableCell = function(name, attributes) {
  5093. tree.parseError("unexpected-cell-in-table-body", {name: name});
  5094. this.startTagTr('tr', []);
  5095. tree.insertionMode.processStartTag(name, attributes);
  5096. };
  5097. modes.inTableBody.startTagTableOther = function(name, attributes) {
  5098. if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) {
  5099. tree.openElements.popUntilTableBodyScopeMarker();
  5100. this.endTagTableRowGroup(tree.currentStackItem().localName);
  5101. tree.insertionMode.processStartTag(name, attributes);
  5102. } else {
  5103. tree.parseError('unexpected-start-tag', {name: name});
  5104. }
  5105. };
  5106. modes.inTableBody.startTagOther = function(name, attributes) {
  5107. modes.inTable.processStartTag(name, attributes);
  5108. };
  5109. modes.inTableBody.endTagTableRowGroup = function(name) {
  5110. if (tree.openElements.inTableScope(name)) {
  5111. tree.openElements.popUntilTableBodyScopeMarker();
  5112. tree.popElement();
  5113. tree.setInsertionMode('inTable');
  5114. } else {
  5115. tree.parseError('unexpected-end-tag-in-table-body', {name: name});
  5116. }
  5117. };
  5118. modes.inTableBody.endTagTable = function(name) {
  5119. if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) {
  5120. tree.openElements.popUntilTableBodyScopeMarker();
  5121. this.endTagTableRowGroup(tree.currentStackItem().localName);
  5122. tree.insertionMode.processEndTag(name);
  5123. } else {
  5124. tree.parseError('unexpected-end-tag', {name: name});
  5125. }
  5126. };
  5127. modes.inTableBody.endTagIgnore = function(name) {
  5128. tree.parseError("unexpected-end-tag-in-table-body", {name: name});
  5129. };
  5130. modes.inTableBody.endTagOther = function(name) {
  5131. modes.inTable.processEndTag(name);
  5132. };
  5133. modes.inSelect = Object.create(modes.base);
  5134. modes.inSelect.start_tag_handlers = {
  5135. html: 'startTagHtml',
  5136. option: 'startTagOption',
  5137. optgroup: 'startTagOptgroup',
  5138. select: 'startTagSelect',
  5139. input: 'startTagInput',
  5140. keygen: 'startTagInput',
  5141. textarea: 'startTagInput',
  5142. script: 'startTagScript',
  5143. '-default': 'startTagOther'
  5144. };
  5145. modes.inSelect.end_tag_handlers = {
  5146. option: 'endTagOption',
  5147. optgroup: 'endTagOptgroup',
  5148. select: 'endTagSelect',
  5149. caption: 'endTagTableElements',
  5150. table: 'endTagTableElements',
  5151. tbody: 'endTagTableElements',
  5152. tfoot: 'endTagTableElements',
  5153. thead: 'endTagTableElements',
  5154. tr: 'endTagTableElements',
  5155. td: 'endTagTableElements',
  5156. th: 'endTagTableElements',
  5157. '-default': 'endTagOther'
  5158. };
  5159. modes.inSelect.processCharacters = function(buffer) {
  5160. var data = buffer.takeRemaining();
  5161. data = data.replace(/\u0000/g, function(match, index){
  5162. tree.parseError("invalid-codepoint");
  5163. return '';
  5164. });
  5165. if (!data)
  5166. return;
  5167. tree.insertText(data);
  5168. };
  5169. modes.inSelect.startTagOption = function(name, attributes) {
  5170. if (tree.currentStackItem().localName == 'option')
  5171. tree.popElement();
  5172. tree.insertElement(name, attributes);
  5173. };
  5174. modes.inSelect.startTagOptgroup = function(name, attributes) {
  5175. if (tree.currentStackItem().localName == 'option')
  5176. tree.popElement();
  5177. if (tree.currentStackItem().localName == 'optgroup')
  5178. tree.popElement();
  5179. tree.insertElement(name, attributes);
  5180. };
  5181. modes.inSelect.endTagOption = function(name) {
  5182. if (tree.currentStackItem().localName !== 'option') {
  5183. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5184. return;
  5185. }
  5186. tree.popElement();
  5187. };
  5188. modes.inSelect.endTagOptgroup = function(name) {
  5189. if (tree.currentStackItem().localName == 'option' && tree.openElements.item(tree.openElements.length - 2).localName == 'optgroup') {
  5190. tree.popElement();
  5191. }
  5192. if (tree.currentStackItem().localName == 'optgroup') {
  5193. tree.popElement();
  5194. } else {
  5195. tree.parseError('unexpected-end-tag-in-select', {name: 'optgroup'});
  5196. }
  5197. };
  5198. modes.inSelect.startTagSelect = function(name) {
  5199. tree.parseError("unexpected-select-in-select");
  5200. this.endTagSelect('select');
  5201. };
  5202. modes.inSelect.endTagSelect = function(name) {
  5203. if (tree.openElements.inTableScope('select')) {
  5204. tree.openElements.popUntilPopped('select');
  5205. tree.resetInsertionMode();
  5206. } else {
  5207. tree.parseError('unexpected-end-tag', {name: name});
  5208. }
  5209. };
  5210. modes.inSelect.startTagInput = function(name, attributes) {
  5211. tree.parseError("unexpected-input-in-select");
  5212. if (tree.openElements.inSelectScope('select')) {
  5213. this.endTagSelect('select');
  5214. tree.insertionMode.processStartTag(name, attributes);
  5215. }
  5216. };
  5217. modes.inSelect.startTagScript = function(name, attributes) {
  5218. modes.inHead.processStartTag(name, attributes);
  5219. };
  5220. modes.inSelect.endTagTableElements = function(name) {
  5221. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5222. if (tree.openElements.inTableScope(name)) {
  5223. this.endTagSelect('select');
  5224. tree.insertionMode.processEndTag(name);
  5225. }
  5226. };
  5227. modes.inSelect.startTagOther = function(name, attributes) {
  5228. tree.parseError("unexpected-start-tag-in-select", {name: name});
  5229. };
  5230. modes.inSelect.endTagOther = function(name) {
  5231. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5232. };
  5233. modes.inSelectInTable = Object.create(modes.base);
  5234. modes.inSelectInTable.start_tag_handlers = {
  5235. caption: 'startTagTable',
  5236. table: 'startTagTable',
  5237. tbody: 'startTagTable',
  5238. tfoot: 'startTagTable',
  5239. thead: 'startTagTable',
  5240. tr: 'startTagTable',
  5241. td: 'startTagTable',
  5242. th: 'startTagTable',
  5243. '-default': 'startTagOther'
  5244. };
  5245. modes.inSelectInTable.end_tag_handlers = {
  5246. caption: 'endTagTable',
  5247. table: 'endTagTable',
  5248. tbody: 'endTagTable',
  5249. tfoot: 'endTagTable',
  5250. thead: 'endTagTable',
  5251. tr: 'endTagTable',
  5252. td: 'endTagTable',
  5253. th: 'endTagTable',
  5254. '-default': 'endTagOther'
  5255. };
  5256. modes.inSelectInTable.processCharacters = function(data) {
  5257. modes.inSelect.processCharacters(data);
  5258. };
  5259. modes.inSelectInTable.startTagTable = function(name, attributes) {
  5260. tree.parseError("unexpected-table-element-start-tag-in-select-in-table", {name: name});
  5261. this.endTagOther("select");
  5262. tree.insertionMode.processStartTag(name, attributes);
  5263. };
  5264. modes.inSelectInTable.startTagOther = function(name, attributes, selfClosing) {
  5265. modes.inSelect.processStartTag(name, attributes, selfClosing);
  5266. };
  5267. modes.inSelectInTable.endTagTable = function(name) {
  5268. tree.parseError("unexpected-table-element-end-tag-in-select-in-table", {name: name});
  5269. if (tree.openElements.inTableScope(name)) {
  5270. this.endTagOther("select");
  5271. tree.insertionMode.processEndTag(name);
  5272. }
  5273. };
  5274. modes.inSelectInTable.endTagOther = function(name) {
  5275. modes.inSelect.processEndTag(name);
  5276. };
  5277. modes.inRow = Object.create(modes.base);
  5278. modes.inRow.start_tag_handlers = {
  5279. html: 'startTagHtml',
  5280. td: 'startTagTableCell',
  5281. th: 'startTagTableCell',
  5282. caption: 'startTagTableOther',
  5283. col: 'startTagTableOther',
  5284. colgroup: 'startTagTableOther',
  5285. tbody: 'startTagTableOther',
  5286. tfoot: 'startTagTableOther',
  5287. thead: 'startTagTableOther',
  5288. tr: 'startTagTableOther',
  5289. '-default': 'startTagOther'
  5290. };
  5291. modes.inRow.end_tag_handlers = {
  5292. tr: 'endTagTr',
  5293. table: 'endTagTable',
  5294. tbody: 'endTagTableRowGroup',
  5295. tfoot: 'endTagTableRowGroup',
  5296. thead: 'endTagTableRowGroup',
  5297. body: 'endTagIgnore',
  5298. caption: 'endTagIgnore',
  5299. col: 'endTagIgnore',
  5300. colgroup: 'endTagIgnore',
  5301. html: 'endTagIgnore',
  5302. td: 'endTagIgnore',
  5303. th: 'endTagIgnore',
  5304. '-default': 'endTagOther'
  5305. };
  5306. modes.inRow.processCharacters = function(data) {
  5307. modes.inTable.processCharacters(data);
  5308. };
  5309. modes.inRow.startTagTableCell = function(name, attributes) {
  5310. tree.openElements.popUntilTableRowScopeMarker();
  5311. tree.insertElement(name, attributes);
  5312. tree.setInsertionMode('inCell');
  5313. tree.activeFormattingElements.push(Marker);
  5314. };
  5315. modes.inRow.startTagTableOther = function(name, attributes) {
  5316. var ignoreEndTag = this.ignoreEndTagTr();
  5317. this.endTagTr('tr');
  5318. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes);
  5319. };
  5320. modes.inRow.startTagOther = function(name, attributes, selfClosing) {
  5321. modes.inTable.processStartTag(name, attributes, selfClosing);
  5322. };
  5323. modes.inRow.endTagTr = function(name) {
  5324. if (this.ignoreEndTagTr()) {
  5325. assert.ok(tree.context);
  5326. tree.parseError('unexpected-end-tag', {name: name});
  5327. } else {
  5328. tree.openElements.popUntilTableRowScopeMarker();
  5329. tree.popElement();
  5330. tree.setInsertionMode('inTableBody');
  5331. }
  5332. };
  5333. modes.inRow.endTagTable = function(name) {
  5334. var ignoreEndTag = this.ignoreEndTagTr();
  5335. this.endTagTr('tr');
  5336. if (!ignoreEndTag) tree.insertionMode.processEndTag(name);
  5337. };
  5338. modes.inRow.endTagTableRowGroup = function(name) {
  5339. if (tree.openElements.inTableScope(name)) {
  5340. this.endTagTr('tr');
  5341. tree.insertionMode.processEndTag(name);
  5342. } else {
  5343. tree.parseError('unexpected-end-tag', {name: name});
  5344. }
  5345. };
  5346. modes.inRow.endTagIgnore = function(name) {
  5347. tree.parseError("unexpected-end-tag-in-table-row", {name: name});
  5348. };
  5349. modes.inRow.endTagOther = function(name) {
  5350. modes.inTable.processEndTag(name);
  5351. };
  5352. modes.inRow.ignoreEndTagTr = function() {
  5353. return !tree.openElements.inTableScope('tr');
  5354. };
  5355. modes.afterAfterFrameset = Object.create(modes.base);
  5356. modes.afterAfterFrameset.start_tag_handlers = {
  5357. html: 'startTagHtml',
  5358. noframes: 'startTagNoFrames',
  5359. '-default': 'startTagOther'
  5360. };
  5361. modes.afterAfterFrameset.processEOF = function() {};
  5362. modes.afterAfterFrameset.processComment = function(data) {
  5363. tree.insertComment(data, tree.document);
  5364. };
  5365. modes.afterAfterFrameset.processCharacters = function(buffer) {
  5366. var characters = buffer.takeRemaining();
  5367. var whitespace = "";
  5368. for (var i = 0; i < characters.length; i++) {
  5369. var ch = characters[i];
  5370. if (isWhitespace(ch))
  5371. whitespace += ch;
  5372. }
  5373. if (whitespace) {
  5374. tree.reconstructActiveFormattingElements();
  5375. tree.insertText(whitespace);
  5376. }
  5377. if (whitespace.length < characters.length)
  5378. tree.parseError('expected-eof-but-got-char');
  5379. };
  5380. modes.afterAfterFrameset.startTagNoFrames = function(name, attributes) {
  5381. modes.inHead.processStartTag(name, attributes);
  5382. };
  5383. modes.afterAfterFrameset.startTagOther = function(name, attributes, selfClosing) {
  5384. tree.parseError('expected-eof-but-got-start-tag', {name: name});
  5385. };
  5386. modes.afterAfterFrameset.processEndTag = function(name, attributes) {
  5387. tree.parseError('expected-eof-but-got-end-tag', {name: name});
  5388. };
  5389. modes.text = Object.create(modes.base);
  5390. modes.text.start_tag_handlers = {
  5391. '-default': 'startTagOther'
  5392. };
  5393. modes.text.end_tag_handlers = {
  5394. script: 'endTagScript',
  5395. '-default': 'endTagOther'
  5396. };
  5397. modes.text.processCharacters = function(buffer) {
  5398. if (tree.shouldSkipLeadingNewline) {
  5399. tree.shouldSkipLeadingNewline = false;
  5400. buffer.skipAtMostOneLeadingNewline();
  5401. }
  5402. var data = buffer.takeRemaining();
  5403. if (!data)
  5404. return;
  5405. tree.insertText(data);
  5406. };
  5407. modes.text.processEOF = function() {
  5408. tree.parseError("expected-named-closing-tag-but-got-eof",
  5409. {name: tree.currentStackItem().localName});
  5410. tree.openElements.pop();
  5411. tree.setInsertionMode(tree.originalInsertionMode);
  5412. tree.insertionMode.processEOF();
  5413. };
  5414. modes.text.startTagOther = function(name) {
  5415. throw "Tried to process start tag " + name + " in RCDATA/RAWTEXT mode";
  5416. };
  5417. modes.text.endTagScript = function(name) {
  5418. var node = tree.openElements.pop();
  5419. assert.ok(node.localName == 'script');
  5420. tree.setInsertionMode(tree.originalInsertionMode);
  5421. };
  5422. modes.text.endTagOther = function(name) {
  5423. tree.openElements.pop();
  5424. tree.setInsertionMode(tree.originalInsertionMode);
  5425. };
  5426. }
  5427. TreeBuilder.prototype.setInsertionMode = function(name) {
  5428. this.insertionMode = this.insertionModes[name];
  5429. this.insertionModeName = name;
  5430. };
  5431. TreeBuilder.prototype.adoptionAgencyEndTag = function(name) {
  5432. var outerIterationLimit = 8;
  5433. var innerIterationLimit = 3;
  5434. var formattingElement;
  5435. function isActiveFormattingElement(el) {
  5436. return el === formattingElement;
  5437. }
  5438. var outerLoopCounter = 0;
  5439. while (outerLoopCounter++ < outerIterationLimit) {
  5440. formattingElement = this.elementInActiveFormattingElements(name);
  5441. if (!formattingElement || (this.openElements.contains(formattingElement) && !this.openElements.inScope(formattingElement.localName))) {
  5442. this.parseError('adoption-agency-1.1', {name: name});
  5443. return false;
  5444. }
  5445. if (!this.openElements.contains(formattingElement)) {
  5446. this.parseError('adoption-agency-1.2', {name: name});
  5447. this.removeElementFromActiveFormattingElements(formattingElement);
  5448. return true;
  5449. }
  5450. if (!this.openElements.inScope(formattingElement.localName)) {
  5451. this.parseError('adoption-agency-4.4', {name: name});
  5452. }
  5453. if (formattingElement != this.currentStackItem()) {
  5454. this.parseError('adoption-agency-1.3', {name: name});
  5455. }
  5456. var furthestBlock = this.openElements.furthestBlockForFormattingElement(formattingElement.node);
  5457. if (!furthestBlock) {
  5458. this.openElements.remove_openElements_until(isActiveFormattingElement);
  5459. this.removeElementFromActiveFormattingElements(formattingElement);
  5460. return true;
  5461. }
  5462. var afeIndex = this.openElements.elements.indexOf(formattingElement);
  5463. var commonAncestor = this.openElements.item(afeIndex - 1);
  5464. var bookmark = this.activeFormattingElements.indexOf(formattingElement);
  5465. var node = furthestBlock;
  5466. var lastNode = furthestBlock;
  5467. var index = this.openElements.elements.indexOf(node);
  5468. var innerLoopCounter = 0;
  5469. while (innerLoopCounter++ < innerIterationLimit) {
  5470. index -= 1;
  5471. node = this.openElements.item(index);
  5472. if (this.activeFormattingElements.indexOf(node) < 0) {
  5473. this.openElements.elements.splice(index, 1);
  5474. continue;
  5475. }
  5476. if (node == formattingElement)
  5477. break;
  5478. if (lastNode == furthestBlock)
  5479. bookmark = this.activeFormattingElements.indexOf(node) + 1;
  5480. var clone = this.createElement(node.namespaceURI, node.localName, node.attributes);
  5481. var newNode = new StackItem(node.namespaceURI, node.localName, node.attributes, clone);
  5482. this.activeFormattingElements[this.activeFormattingElements.indexOf(node)] = newNode;
  5483. this.openElements.elements[this.openElements.elements.indexOf(node)] = newNode;
  5484. node = newNode;
  5485. this.detachFromParent(lastNode.node);
  5486. this.attachNode(lastNode.node, node.node);
  5487. lastNode = node;
  5488. }
  5489. this.detachFromParent(lastNode.node);
  5490. if (commonAncestor.isFosterParenting()) {
  5491. this.insertIntoFosterParent(lastNode.node);
  5492. } else {
  5493. this.attachNode(lastNode.node, commonAncestor.node);
  5494. }
  5495. var clone = this.createElement("http://www.w3.org/1999/xhtml", formattingElement.localName, formattingElement.attributes);
  5496. var formattingClone = new StackItem(formattingElement.namespaceURI, formattingElement.localName, formattingElement.attributes, clone);
  5497. this.reparentChildren(furthestBlock.node, clone);
  5498. this.attachNode(clone, furthestBlock.node);
  5499. this.removeElementFromActiveFormattingElements(formattingElement);
  5500. this.activeFormattingElements.splice(Math.min(bookmark, this.activeFormattingElements.length), 0, formattingClone);
  5501. this.openElements.remove(formattingElement);
  5502. this.openElements.elements.splice(this.openElements.elements.indexOf(furthestBlock) + 1, 0, formattingClone);
  5503. }
  5504. return true;
  5505. };
  5506. TreeBuilder.prototype.start = function() {
  5507. throw "Not mplemented";
  5508. };
  5509. TreeBuilder.prototype.startTokenization = function(tokenizer) {
  5510. this.tokenizer = tokenizer;
  5511. this.compatMode = "no quirks";
  5512. this.originalInsertionMode = "initial";
  5513. this.framesetOk = true;
  5514. this.openElements = new ElementStack();
  5515. this.activeFormattingElements = [];
  5516. this.start();
  5517. if (this.context) {
  5518. switch(this.context) {
  5519. case 'title':
  5520. case 'textarea':
  5521. this.tokenizer.setState(Tokenizer.RCDATA);
  5522. break;
  5523. case 'style':
  5524. case 'xmp':
  5525. case 'iframe':
  5526. case 'noembed':
  5527. case 'noframes':
  5528. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5529. break;
  5530. case 'script':
  5531. this.tokenizer.setState(Tokenizer.SCRIPT_DATA);
  5532. break;
  5533. case 'noscript':
  5534. if (this.scriptingEnabled)
  5535. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5536. break;
  5537. case 'plaintext':
  5538. this.tokenizer.setState(Tokenizer.PLAINTEXT);
  5539. break;
  5540. }
  5541. this.insertHtmlElement();
  5542. if (this.context === 'head') {
  5543. this.insertHeadElement();
  5544. } else {
  5545. this.insertBodyElement();
  5546. }
  5547. this.resetInsertionMode();
  5548. } else {
  5549. this.setInsertionMode('initial');
  5550. }
  5551. };
  5552. TreeBuilder.prototype.processToken = function(token) {
  5553. this.selfClosingFlagAcknowledged = false;
  5554. var currentNode = this.openElements.top || null;
  5555. var insertionMode;
  5556. if (!currentNode || !currentNode.isForeign() ||
  5557. (currentNode.isMathMLTextIntegrationPoint() &&
  5558. ((token.type == 'StartTag' &&
  5559. !(token.name in {mglyph:0, malignmark:0})) ||
  5560. (token.type === 'Characters'))
  5561. ) ||
  5562. (currentNode.namespaceURI == "http://www.w3.org/1998/Math/MathML" &&
  5563. currentNode.localName == 'annotation-xml' &&
  5564. token.type == 'StartTag' && token.name == 'svg'
  5565. ) ||
  5566. (currentNode.isHtmlIntegrationPoint() &&
  5567. token.type in {StartTag:0, Characters:0}
  5568. ) ||
  5569. token.type == 'EOF'
  5570. ) {
  5571. insertionMode = this.insertionMode;
  5572. } else {
  5573. insertionMode = this.insertionModes.inForeignContent;
  5574. }
  5575. switch(token.type) {
  5576. case 'Characters':
  5577. var buffer = new CharacterBuffer(token.data);
  5578. insertionMode.processCharacters(buffer);
  5579. break;
  5580. case 'Comment':
  5581. insertionMode.processComment(token.data);
  5582. break;
  5583. case 'StartTag':
  5584. insertionMode.processStartTag(token.name, token.data, token.selfClosing);
  5585. break;
  5586. case 'EndTag':
  5587. insertionMode.processEndTag(token.name);
  5588. break;
  5589. case 'Doctype':
  5590. insertionMode.processDoctype(token.name, token.publicId, token.systemId, token.forceQuirks);
  5591. break;
  5592. case 'EOF':
  5593. insertionMode.processEOF();
  5594. break;
  5595. }
  5596. };
  5597. TreeBuilder.prototype.isCdataSectionAllowed = function() {
  5598. return this.openElements.length > 0 && this.currentStackItem().isForeign();
  5599. };
  5600. TreeBuilder.prototype.isSelfClosingFlagAcknowledged = function() {
  5601. return this.selfClosingFlagAcknowledged;
  5602. };
  5603. TreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) {
  5604. throw new Error("Not implemented");
  5605. };
  5606. TreeBuilder.prototype.attachNode = function(child, parent) {
  5607. throw new Error("Not implemented");
  5608. };
  5609. TreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) {
  5610. throw new Error("Not implemented");
  5611. };
  5612. TreeBuilder.prototype.detachFromParent = function(node) {
  5613. throw new Error("Not implemented");
  5614. };
  5615. TreeBuilder.prototype.addAttributesToElement = function(element, attributes) {
  5616. throw new Error("Not implemented");
  5617. };
  5618. TreeBuilder.prototype.insertHtmlElement = function(attributes) {
  5619. var root = this.createElement("http://www.w3.org/1999/xhtml", 'html', attributes);
  5620. this.attachNode(root, this.document);
  5621. this.openElements.pushHtmlElement(new StackItem("http://www.w3.org/1999/xhtml", 'html', attributes, root));
  5622. return root;
  5623. };
  5624. TreeBuilder.prototype.insertHeadElement = function(attributes) {
  5625. var element = this.createElement("http://www.w3.org/1999/xhtml", "head", attributes);
  5626. this.head = new StackItem("http://www.w3.org/1999/xhtml", "head", attributes, element);
  5627. this.attachNode(element, this.openElements.top.node);
  5628. this.openElements.pushHeadElement(this.head);
  5629. return element;
  5630. };
  5631. TreeBuilder.prototype.insertBodyElement = function(attributes) {
  5632. var element = this.createElement("http://www.w3.org/1999/xhtml", "body", attributes);
  5633. this.attachNode(element, this.openElements.top.node);
  5634. this.openElements.pushBodyElement(new StackItem("http://www.w3.org/1999/xhtml", "body", attributes, element));
  5635. return element;
  5636. };
  5637. TreeBuilder.prototype.insertIntoFosterParent = function(node) {
  5638. var tableIndex = this.openElements.findIndex('table');
  5639. var tableElement = this.openElements.item(tableIndex).node;
  5640. if (tableIndex === 0)
  5641. return this.attachNode(node, tableElement);
  5642. this.attachNodeToFosterParent(node, tableElement, this.openElements.item(tableIndex - 1).node);
  5643. };
  5644. TreeBuilder.prototype.insertElement = function(name, attributes, namespaceURI, selfClosing) {
  5645. if (!namespaceURI)
  5646. namespaceURI = "http://www.w3.org/1999/xhtml";
  5647. var element = this.createElement(namespaceURI, name, attributes);
  5648. if (this.shouldFosterParent())
  5649. this.insertIntoFosterParent(element);
  5650. else
  5651. this.attachNode(element, this.openElements.top.node);
  5652. if (!selfClosing)
  5653. this.openElements.push(new StackItem(namespaceURI, name, attributes, element));
  5654. };
  5655. TreeBuilder.prototype.insertFormattingElement = function(name, attributes) {
  5656. this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml");
  5657. this.appendElementToActiveFormattingElements(this.currentStackItem());
  5658. };
  5659. TreeBuilder.prototype.insertSelfClosingElement = function(name, attributes) {
  5660. this.selfClosingFlagAcknowledged = true;
  5661. this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml", true);
  5662. };
  5663. TreeBuilder.prototype.insertForeignElement = function(name, attributes, namespaceURI, selfClosing) {
  5664. if (selfClosing)
  5665. this.selfClosingFlagAcknowledged = true;
  5666. this.insertElement(name, attributes, namespaceURI, selfClosing);
  5667. };
  5668. TreeBuilder.prototype.insertComment = function(data, parent) {
  5669. throw new Error("Not implemented");
  5670. };
  5671. TreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) {
  5672. throw new Error("Not implemented");
  5673. };
  5674. TreeBuilder.prototype.insertText = function(data) {
  5675. throw new Error("Not implemented");
  5676. };
  5677. TreeBuilder.prototype.currentStackItem = function() {
  5678. return this.openElements.top;
  5679. };
  5680. TreeBuilder.prototype.popElement = function() {
  5681. return this.openElements.pop();
  5682. };
  5683. TreeBuilder.prototype.shouldFosterParent = function() {
  5684. return this.redirectAttachToFosterParent && this.currentStackItem().isFosterParenting();
  5685. };
  5686. TreeBuilder.prototype.generateImpliedEndTags = function(exclude) {
  5687. var name = this.openElements.top.localName;
  5688. if (['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'].indexOf(name) != -1 && name != exclude) {
  5689. this.popElement();
  5690. this.generateImpliedEndTags(exclude);
  5691. }
  5692. };
  5693. TreeBuilder.prototype.reconstructActiveFormattingElements = function() {
  5694. if (this.activeFormattingElements.length === 0)
  5695. return;
  5696. var i = this.activeFormattingElements.length - 1;
  5697. var entry = this.activeFormattingElements[i];
  5698. if (entry == Marker || this.openElements.contains(entry))
  5699. return;
  5700. while (entry != Marker && !this.openElements.contains(entry)) {
  5701. i -= 1;
  5702. entry = this.activeFormattingElements[i];
  5703. if (!entry)
  5704. break;
  5705. }
  5706. while (true) {
  5707. i += 1;
  5708. entry = this.activeFormattingElements[i];
  5709. this.insertElement(entry.localName, entry.attributes);
  5710. var element = this.currentStackItem();
  5711. this.activeFormattingElements[i] = element;
  5712. if (element == this.activeFormattingElements[this.activeFormattingElements.length -1])
  5713. break;
  5714. }
  5715. };
  5716. TreeBuilder.prototype.ensureNoahsArkCondition = function(item) {
  5717. var kNoahsArkCapacity = 3;
  5718. if (this.activeFormattingElements.length < kNoahsArkCapacity)
  5719. return;
  5720. var candidates = [];
  5721. var newItemAttributeCount = item.attributes.length;
  5722. for (var i = this.activeFormattingElements.length - 1; i >= 0; i--) {
  5723. var candidate = this.activeFormattingElements[i];
  5724. if (candidate === Marker)
  5725. break;
  5726. if (item.localName !== candidate.localName || item.namespaceURI !== candidate.namespaceURI)
  5727. continue;
  5728. if (candidate.attributes.length != newItemAttributeCount)
  5729. continue;
  5730. candidates.push(candidate);
  5731. }
  5732. if (candidates.length < kNoahsArkCapacity)
  5733. return;
  5734. var remainingCandidates = [];
  5735. var attributes = item.attributes;
  5736. for (var i = 0; i < attributes.length; i++) {
  5737. var attribute = attributes[i];
  5738. for (var j = 0; j < candidates.length; j++) {
  5739. var candidate = candidates[j];
  5740. var candidateAttribute = getAttribute(candidate, attribute.nodeName);
  5741. if (candidateAttribute && candidateAttribute.nodeValue === attribute.nodeValue)
  5742. remainingCandidates.push(candidate);
  5743. }
  5744. if (remainingCandidates.length < kNoahsArkCapacity)
  5745. return;
  5746. candidates = remainingCandidates;
  5747. remainingCandidates = [];
  5748. }
  5749. for (var i = kNoahsArkCapacity - 1; i < candidates.length; i++)
  5750. this.removeElementFromActiveFormattingElements(candidates[i]);
  5751. };
  5752. TreeBuilder.prototype.appendElementToActiveFormattingElements = function(item) {
  5753. this.ensureNoahsArkCondition(item);
  5754. this.activeFormattingElements.push(item);
  5755. };
  5756. TreeBuilder.prototype.removeElementFromActiveFormattingElements = function(item) {
  5757. var index = this.activeFormattingElements.indexOf(item);
  5758. if (index >= 0)
  5759. this.activeFormattingElements.splice(index, 1);
  5760. };
  5761. TreeBuilder.prototype.elementInActiveFormattingElements = function(name) {
  5762. var els = this.activeFormattingElements;
  5763. for (var i = els.length - 1; i >= 0; i--) {
  5764. if (els[i] == Marker) break;
  5765. if (els[i].localName == name) return els[i];
  5766. }
  5767. return false;
  5768. };
  5769. TreeBuilder.prototype.clearActiveFormattingElements = function() {
  5770. while (!(this.activeFormattingElements.length === 0 || this.activeFormattingElements.pop() == Marker));
  5771. };
  5772. TreeBuilder.prototype.reparentChildren = function(oldParent, newParent) {
  5773. throw new Error("Not implemented");
  5774. };
  5775. TreeBuilder.prototype.setFragmentContext = function(context) {
  5776. this.context = context;
  5777. };
  5778. TreeBuilder.prototype.parseError = function(code, args) {
  5779. if (!this.errorHandler)
  5780. return;
  5781. var message = formatMessage(messages[code], args);
  5782. this.errorHandler.error(message, this.tokenizer._inputStream.location(), code);
  5783. };
  5784. TreeBuilder.prototype.resetInsertionMode = function() {
  5785. var fragmentAssigned = false;
  5786. var node = null;
  5787. for (var i = this.openElements.length - 1; i >= 0; i--) {
  5788. node = this.openElements.item(i);
  5789. if (i === 0) {
  5790. assert.ok(this.context);
  5791. fragmentAssigned = true;
  5792. node = new StackItem("http://www.w3.org/1999/xhtml", this.context, [], null);
  5793. }
  5794. if (node.namespaceURI === "http://www.w3.org/1999/xhtml") {
  5795. if (node.localName === 'select')
  5796. return this.setInsertionMode('inSelect');
  5797. if (node.localName === 'td' || node.localName === 'th')
  5798. return this.setInsertionMode('inCell');
  5799. if (node.localName === 'tr')
  5800. return this.setInsertionMode('inRow');
  5801. if (node.localName === 'tbody' || node.localName === 'thead' || node.localName === 'tfoot')
  5802. return this.setInsertionMode('inTableBody');
  5803. if (node.localName === 'caption')
  5804. return this.setInsertionMode('inCaption');
  5805. if (node.localName === 'colgroup')
  5806. return this.setInsertionMode('inColumnGroup');
  5807. if (node.localName === 'table')
  5808. return this.setInsertionMode('inTable');
  5809. if (node.localName === 'head')
  5810. return this.setInsertionMode('inHead');
  5811. if (node.localName === 'body')
  5812. return this.setInsertionMode('inBody');
  5813. if (node.localName === 'frameset')
  5814. return this.setInsertionMode('inFrameset');
  5815. if (node.localName === 'html')
  5816. if (!this.openElements.headElement)
  5817. return this.setInsertionMode('beforeHead');
  5818. else
  5819. return this.setInsertionMode('afterHead');
  5820. }
  5821. if (fragmentAssigned)
  5822. return this.setInsertionMode('inBody');
  5823. }
  5824. };
  5825. TreeBuilder.prototype.processGenericRCDATAStartTag = function(name, attributes) {
  5826. this.insertElement(name, attributes);
  5827. this.tokenizer.setState(Tokenizer.RCDATA);
  5828. this.originalInsertionMode = this.insertionModeName;
  5829. this.setInsertionMode('text');
  5830. };
  5831. TreeBuilder.prototype.processGenericRawTextStartTag = function(name, attributes) {
  5832. this.insertElement(name, attributes);
  5833. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5834. this.originalInsertionMode = this.insertionModeName;
  5835. this.setInsertionMode('text');
  5836. };
  5837. TreeBuilder.prototype.adjustMathMLAttributes = function(attributes) {
  5838. attributes.forEach(function(a) {
  5839. a.namespaceURI = "http://www.w3.org/1998/Math/MathML";
  5840. if (constants.MATHMLAttributeMap[a.nodeName])
  5841. a.nodeName = constants.MATHMLAttributeMap[a.nodeName];
  5842. });
  5843. return attributes;
  5844. };
  5845. TreeBuilder.prototype.adjustSVGTagNameCase = function(name) {
  5846. return constants.SVGTagMap[name] || name;
  5847. };
  5848. TreeBuilder.prototype.adjustSVGAttributes = function(attributes) {
  5849. attributes.forEach(function(a) {
  5850. a.namespaceURI = "http://www.w3.org/2000/svg";
  5851. if (constants.SVGAttributeMap[a.nodeName])
  5852. a.nodeName = constants.SVGAttributeMap[a.nodeName];
  5853. });
  5854. return attributes;
  5855. };
  5856. TreeBuilder.prototype.adjustForeignAttributes = function(attributes) {
  5857. for (var i = 0; i < attributes.length; i++) {
  5858. var attribute = attributes[i];
  5859. var adjusted = constants.ForeignAttributeMap[attribute.nodeName];
  5860. if (adjusted) {
  5861. attribute.nodeName = adjusted.localName;
  5862. attribute.prefix = adjusted.prefix;
  5863. attribute.namespaceURI = adjusted.namespaceURI;
  5864. }
  5865. }
  5866. return attributes;
  5867. };
  5868. function formatMessage(format, args) {
  5869. return format.replace(new RegExp('{[0-9a-z-]+}', 'gi'), function(match) {
  5870. return args[match.slice(1, -1)] || match;
  5871. });
  5872. }
  5873. exports.TreeBuilder = TreeBuilder;
  5874. },
  5875. {"./ElementStack":1,"./StackItem":4,"./Tokenizer":5,"./constants":7,"./messages.json":8,"assert":13,"events":16}],
  5876. 7:[function(_dereq_,module,exports){
  5877. exports.SVGTagMap = {
  5878. "altglyph": "altGlyph",
  5879. "altglyphdef": "altGlyphDef",
  5880. "altglyphitem": "altGlyphItem",
  5881. "animatecolor": "animateColor",
  5882. "animatemotion": "animateMotion",
  5883. "animatetransform": "animateTransform",
  5884. "clippath": "clipPath",
  5885. "feblend": "feBlend",
  5886. "fecolormatrix": "feColorMatrix",
  5887. "fecomponenttransfer": "feComponentTransfer",
  5888. "fecomposite": "feComposite",
  5889. "feconvolvematrix": "feConvolveMatrix",
  5890. "fediffuselighting": "feDiffuseLighting",
  5891. "fedisplacementmap": "feDisplacementMap",
  5892. "fedistantlight": "feDistantLight",
  5893. "feflood": "feFlood",
  5894. "fefunca": "feFuncA",
  5895. "fefuncb": "feFuncB",
  5896. "fefuncg": "feFuncG",
  5897. "fefuncr": "feFuncR",
  5898. "fegaussianblur": "feGaussianBlur",
  5899. "feimage": "feImage",
  5900. "femerge": "feMerge",
  5901. "femergenode": "feMergeNode",
  5902. "femorphology": "feMorphology",
  5903. "feoffset": "feOffset",
  5904. "fepointlight": "fePointLight",
  5905. "fespecularlighting": "feSpecularLighting",
  5906. "fespotlight": "feSpotLight",
  5907. "fetile": "feTile",
  5908. "feturbulence": "feTurbulence",
  5909. "foreignobject": "foreignObject",
  5910. "glyphref": "glyphRef",
  5911. "lineargradient": "linearGradient",
  5912. "radialgradient": "radialGradient",
  5913. "textpath": "textPath"
  5914. };
  5915. exports.MATHMLAttributeMap = {
  5916. definitionurl: 'definitionURL'
  5917. };
  5918. exports.SVGAttributeMap = {
  5919. attributename: 'attributeName',
  5920. attributetype: 'attributeType',
  5921. basefrequency: 'baseFrequency',
  5922. baseprofile: 'baseProfile',
  5923. calcmode: 'calcMode',
  5924. clippathunits: 'clipPathUnits',
  5925. contentscripttype: 'contentScriptType',
  5926. contentstyletype: 'contentStyleType',
  5927. diffuseconstant: 'diffuseConstant',
  5928. edgemode: 'edgeMode',
  5929. externalresourcesrequired: 'externalResourcesRequired',
  5930. filterres: 'filterRes',
  5931. filterunits: 'filterUnits',
  5932. glyphref: 'glyphRef',
  5933. gradienttransform: 'gradientTransform',
  5934. gradientunits: 'gradientUnits',
  5935. kernelmatrix: 'kernelMatrix',
  5936. kernelunitlength: 'kernelUnitLength',
  5937. keypoints: 'keyPoints',
  5938. keysplines: 'keySplines',
  5939. keytimes: 'keyTimes',
  5940. lengthadjust: 'lengthAdjust',
  5941. limitingconeangle: 'limitingConeAngle',
  5942. markerheight: 'markerHeight',
  5943. markerunits: 'markerUnits',
  5944. markerwidth: 'markerWidth',
  5945. maskcontentunits: 'maskContentUnits',
  5946. maskunits: 'maskUnits',
  5947. numoctaves: 'numOctaves',
  5948. pathlength: 'pathLength',
  5949. patterncontentunits: 'patternContentUnits',
  5950. patterntransform: 'patternTransform',
  5951. patternunits: 'patternUnits',
  5952. pointsatx: 'pointsAtX',
  5953. pointsaty: 'pointsAtY',
  5954. pointsatz: 'pointsAtZ',
  5955. preservealpha: 'preserveAlpha',
  5956. preserveaspectratio: 'preserveAspectRatio',
  5957. primitiveunits: 'primitiveUnits',
  5958. refx: 'refX',
  5959. refy: 'refY',
  5960. repeatcount: 'repeatCount',
  5961. repeatdur: 'repeatDur',
  5962. requiredextensions: 'requiredExtensions',
  5963. requiredfeatures: 'requiredFeatures',
  5964. specularconstant: 'specularConstant',
  5965. specularexponent: 'specularExponent',
  5966. spreadmethod: 'spreadMethod',
  5967. startoffset: 'startOffset',
  5968. stddeviation: 'stdDeviation',
  5969. stitchtiles: 'stitchTiles',
  5970. surfacescale: 'surfaceScale',
  5971. systemlanguage: 'systemLanguage',
  5972. tablevalues: 'tableValues',
  5973. targetx: 'targetX',
  5974. targety: 'targetY',
  5975. textlength: 'textLength',
  5976. viewbox: 'viewBox',
  5977. viewtarget: 'viewTarget',
  5978. xchannelselector: 'xChannelSelector',
  5979. ychannelselector: 'yChannelSelector',
  5980. zoomandpan: 'zoomAndPan'
  5981. };
  5982. exports.ForeignAttributeMap = {
  5983. "xlink:actuate": {prefix: "xlink", localName: "actuate", namespaceURI: "http://www.w3.org/1999/xlink"},
  5984. "xlink:arcrole": {prefix: "xlink", localName: "arcrole", namespaceURI: "http://www.w3.org/1999/xlink"},
  5985. "xlink:href": {prefix: "xlink", localName: "href", namespaceURI: "http://www.w3.org/1999/xlink"},
  5986. "xlink:role": {prefix: "xlink", localName: "role", namespaceURI: "http://www.w3.org/1999/xlink"},
  5987. "xlink:show": {prefix: "xlink", localName: "show", namespaceURI: "http://www.w3.org/1999/xlink"},
  5988. "xlink:title": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"},
  5989. "xlink:type": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"},
  5990. "xml:base": {prefix: "xml", localName: "base", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5991. "xml:lang": {prefix: "xml", localName: "lang", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5992. "xml:space": {prefix: "xml", localName: "space", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5993. "xmlns": {prefix: null, localName: "xmlns", namespaceURI: "http://www.w3.org/2000/xmlns/"},
  5994. "xmlns:xlink": {prefix: "xmlns", localName: "xlink", namespaceURI: "http://www.w3.org/2000/xmlns/"},
  5995. };
  5996. },
  5997. {}],
  5998. 8:[function(_dereq_,module,exports){
  5999. module.exports={
  6000. "null-character":
  6001. "Null character in input stream, replaced with U+FFFD.",
  6002. "invalid-codepoint":
  6003. "Invalid codepoint in stream",
  6004. "incorrectly-placed-solidus":
  6005. "Solidus (/) incorrectly placed in tag.",
  6006. "incorrect-cr-newline-entity":
  6007. "Incorrect CR newline entity, replaced with LF.",
  6008. "illegal-windows-1252-entity":
  6009. "Entity used with illegal number (windows-1252 reference).",
  6010. "cant-convert-numeric-entity":
  6011. "Numeric entity couldn't be converted to character (codepoint U+{charAsInt}).",
  6012. "invalid-numeric-entity-replaced":
  6013. "Numeric entity represents an illegal codepoint. Expanded to the C1 controls range.",
  6014. "numeric-entity-without-semicolon":
  6015. "Numeric entity didn't end with ';'.",
  6016. "expected-numeric-entity-but-got-eof":
  6017. "Numeric entity expected. Got end of file instead.",
  6018. "expected-numeric-entity":
  6019. "Numeric entity expected but none found.",
  6020. "named-entity-without-semicolon":
  6021. "Named entity didn't end with ';'.",
  6022. "expected-named-entity":
  6023. "Named entity expected. Got none.",
  6024. "attributes-in-end-tag":
  6025. "End tag contains unexpected attributes.",
  6026. "self-closing-flag-on-end-tag":
  6027. "End tag contains unexpected self-closing flag.",
  6028. "bare-less-than-sign-at-eof":
  6029. "End of file after <.",
  6030. "expected-tag-name-but-got-right-bracket":
  6031. "Expected tag name. Got '>' instead.",
  6032. "expected-tag-name-but-got-question-mark":
  6033. "Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)",
  6034. "expected-tag-name":
  6035. "Expected tag name. Got something else instead.",
  6036. "expected-closing-tag-but-got-right-bracket":
  6037. "Expected closing tag. Got '>' instead. Ignoring '</>'.",
  6038. "expected-closing-tag-but-got-eof":
  6039. "Expected closing tag. Unexpected end of file.",
  6040. "expected-closing-tag-but-got-char":
  6041. "Expected closing tag. Unexpected character '{data}' found.",
  6042. "eof-in-tag-name":
  6043. "Unexpected end of file in the tag name.",
  6044. "expected-attribute-name-but-got-eof":
  6045. "Unexpected end of file. Expected attribute name instead.",
  6046. "eof-in-attribute-name":
  6047. "Unexpected end of file in attribute name.",
  6048. "invalid-character-in-attribute-name":
  6049. "Invalid character in attribute name.",
  6050. "duplicate-attribute":
  6051. "Dropped duplicate attribute '{name}' on tag.",
  6052. "expected-end-of-tag-but-got-eof":
  6053. "Unexpected end of file. Expected = or end of tag.",
  6054. "expected-attribute-value-but-got-eof":
  6055. "Unexpected end of file. Expected attribute value.",
  6056. "expected-attribute-value-but-got-right-bracket":
  6057. "Expected attribute value. Got '>' instead.",
  6058. "unexpected-character-in-unquoted-attribute-value":
  6059. "Unexpected character in unquoted attribute",
  6060. "invalid-character-after-attribute-name":
  6061. "Unexpected character after attribute name.",
  6062. "unexpected-character-after-attribute-value":
  6063. "Unexpected character after attribute value.",
  6064. "eof-in-attribute-value-double-quote":
  6065. "Unexpected end of file in attribute value (\").",
  6066. "eof-in-attribute-value-single-quote":
  6067. "Unexpected end of file in attribute value (').",
  6068. "eof-in-attribute-value-no-quotes":
  6069. "Unexpected end of file in attribute value.",
  6070. "eof-after-attribute-value":
  6071. "Unexpected end of file after attribute value.",
  6072. "unexpected-eof-after-solidus-in-tag":
  6073. "Unexpected end of file in tag. Expected >.",
  6074. "unexpected-character-after-solidus-in-tag":
  6075. "Unexpected character after / in tag. Expected >.",
  6076. "expected-dashes-or-doctype":
  6077. "Expected '--' or 'DOCTYPE'. Not found.",
  6078. "unexpected-bang-after-double-dash-in-comment":
  6079. "Unexpected ! after -- in comment.",
  6080. "incorrect-comment":
  6081. "Incorrect comment.",
  6082. "eof-in-comment":
  6083. "Unexpected end of file in comment.",
  6084. "eof-in-comment-end-dash":
  6085. "Unexpected end of file in comment (-).",
  6086. "unexpected-dash-after-double-dash-in-comment":
  6087. "Unexpected '-' after '--' found in comment.",
  6088. "eof-in-comment-double-dash":
  6089. "Unexpected end of file in comment (--).",
  6090. "eof-in-comment-end-bang-state":
  6091. "Unexpected end of file in comment.",
  6092. "unexpected-char-in-comment":
  6093. "Unexpected character in comment found.",
  6094. "need-space-after-doctype":
  6095. "No space after literal string 'DOCTYPE'.",
  6096. "expected-doctype-name-but-got-right-bracket":
  6097. "Unexpected > character. Expected DOCTYPE name.",
  6098. "expected-doctype-name-but-got-eof":
  6099. "Unexpected end of file. Expected DOCTYPE name.",
  6100. "eof-in-doctype-name":
  6101. "Unexpected end of file in DOCTYPE name.",
  6102. "eof-in-doctype":
  6103. "Unexpected end of file in DOCTYPE.",
  6104. "expected-space-or-right-bracket-in-doctype":
  6105. "Expected space or '>'. Got '{data}'.",
  6106. "unexpected-end-of-doctype":
  6107. "Unexpected end of DOCTYPE.",
  6108. "unexpected-char-in-doctype":
  6109. "Unexpected character in DOCTYPE.",
  6110. "eof-in-bogus-doctype":
  6111. "Unexpected end of file in bogus doctype.",
  6112. "eof-in-innerhtml":
  6113. "Unexpected EOF in inner html mode.",
  6114. "unexpected-doctype":
  6115. "Unexpected DOCTYPE. Ignored.",
  6116. "non-html-root":
  6117. "html needs to be the first start tag.",
  6118. "expected-doctype-but-got-eof":
  6119. "Unexpected End of file. Expected DOCTYPE.",
  6120. "unknown-doctype":
  6121. "Erroneous DOCTYPE. Expected <!DOCTYPE html>.",
  6122. "quirky-doctype":
  6123. "Quirky doctype. Expected <!DOCTYPE html>.",
  6124. "almost-standards-doctype":
  6125. "Almost standards mode doctype. Expected <!DOCTYPE html>.",
  6126. "obsolete-doctype":
  6127. "Obsolete doctype. Expected <!DOCTYPE html>.",
  6128. "expected-doctype-but-got-chars":
  6129. "Non-space characters found without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6130. "expected-doctype-but-got-start-tag":
  6131. "Start tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6132. "expected-doctype-but-got-end-tag":
  6133. "End tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6134. "end-tag-after-implied-root":
  6135. "Unexpected end tag ({name}) after the (implied) root element.",
  6136. "expected-named-closing-tag-but-got-eof":
  6137. "Unexpected end of file. Expected end tag ({name}).",
  6138. "two-heads-are-not-better-than-one":
  6139. "Unexpected start tag head in existing head. Ignored.",
  6140. "unexpected-end-tag":
  6141. "Unexpected end tag ({name}). Ignored.",
  6142. "unexpected-implied-end-tag":
  6143. "End tag {name} implied, but there were open elements.",
  6144. "unexpected-start-tag-out-of-my-head":
  6145. "Unexpected start tag ({name}) that can be in head. Moved.",
  6146. "unexpected-start-tag":
  6147. "Unexpected start tag ({name}).",
  6148. "missing-end-tag":
  6149. "Missing end tag ({name}).",
  6150. "missing-end-tags":
  6151. "Missing end tags ({name}).",
  6152. "unexpected-start-tag-implies-end-tag":
  6153. "Unexpected start tag ({startName}) implies end tag ({endName}).",
  6154. "unexpected-start-tag-treated-as":
  6155. "Unexpected start tag ({originalName}). Treated as {newName}.",
  6156. "deprecated-tag":
  6157. "Unexpected start tag {name}. Don't use it!",
  6158. "unexpected-start-tag-ignored":
  6159. "Unexpected start tag {name}. Ignored.",
  6160. "expected-one-end-tag-but-got-another":
  6161. "Unexpected end tag ({gotName}). Missing end tag ({expectedName}).",
  6162. "end-tag-too-early":
  6163. "End tag ({name}) seen too early. Expected other end tag.",
  6164. "end-tag-too-early-named":
  6165. "Unexpected end tag ({gotName}). Expected end tag ({expectedName}.",
  6166. "end-tag-too-early-ignored":
  6167. "End tag ({name}) seen too early. Ignored.",
  6168. "adoption-agency-1.1":
  6169. "End tag ({name}) violates step 1, paragraph 1 of the adoption agency algorithm.",
  6170. "adoption-agency-1.2":
  6171. "End tag ({name}) violates step 1, paragraph 2 of the adoption agency algorithm.",
  6172. "adoption-agency-1.3":
  6173. "End tag ({name}) violates step 1, paragraph 3 of the adoption agency algorithm.",
  6174. "adoption-agency-4.4":
  6175. "End tag ({name}) violates step 4, paragraph 4 of the adoption agency algorithm.",
  6176. "unexpected-end-tag-treated-as":
  6177. "Unexpected end tag ({originalName}). Treated as {newName}.",
  6178. "no-end-tag":
  6179. "This element ({name}) has no end tag.",
  6180. "unexpected-implied-end-tag-in-table":
  6181. "Unexpected implied end tag ({name}) in the table phase.",
  6182. "unexpected-implied-end-tag-in-table-body":
  6183. "Unexpected implied end tag ({name}) in the table body phase.",
  6184. "unexpected-char-implies-table-voodoo":
  6185. "Unexpected non-space characters in table context caused voodoo mode.",
  6186. "unexpected-hidden-input-in-table":
  6187. "Unexpected input with type hidden in table context.",
  6188. "unexpected-form-in-table":
  6189. "Unexpected form in table context.",
  6190. "unexpected-start-tag-implies-table-voodoo":
  6191. "Unexpected start tag ({name}) in table context caused voodoo mode.",
  6192. "unexpected-end-tag-implies-table-voodoo":
  6193. "Unexpected end tag ({name}) in table context caused voodoo mode.",
  6194. "unexpected-cell-in-table-body":
  6195. "Unexpected table cell start tag ({name}) in the table body phase.",
  6196. "unexpected-cell-end-tag":
  6197. "Got table cell end tag ({name}) while required end tags are missing.",
  6198. "unexpected-end-tag-in-table-body":
  6199. "Unexpected end tag ({name}) in the table body phase. Ignored.",
  6200. "unexpected-implied-end-tag-in-table-row":
  6201. "Unexpected implied end tag ({name}) in the table row phase.",
  6202. "unexpected-end-tag-in-table-row":
  6203. "Unexpected end tag ({name}) in the table row phase. Ignored.",
  6204. "unexpected-select-in-select":
  6205. "Unexpected select start tag in the select phase treated as select end tag.",
  6206. "unexpected-input-in-select":
  6207. "Unexpected input start tag in the select phase.",
  6208. "unexpected-start-tag-in-select":
  6209. "Unexpected start tag token ({name}) in the select phase. Ignored.",
  6210. "unexpected-end-tag-in-select":
  6211. "Unexpected end tag ({name}) in the select phase. Ignored.",
  6212. "unexpected-table-element-start-tag-in-select-in-table":
  6213. "Unexpected table element start tag ({name}) in the select in table phase.",
  6214. "unexpected-table-element-end-tag-in-select-in-table":
  6215. "Unexpected table element end tag ({name}) in the select in table phase.",
  6216. "unexpected-char-after-body":
  6217. "Unexpected non-space characters in the after body phase.",
  6218. "unexpected-start-tag-after-body":
  6219. "Unexpected start tag token ({name}) in the after body phase.",
  6220. "unexpected-end-tag-after-body":
  6221. "Unexpected end tag token ({name}) in the after body phase.",
  6222. "unexpected-char-in-frameset":
  6223. "Unepxected characters in the frameset phase. Characters ignored.",
  6224. "unexpected-start-tag-in-frameset":
  6225. "Unexpected start tag token ({name}) in the frameset phase. Ignored.",
  6226. "unexpected-frameset-in-frameset-innerhtml":
  6227. "Unexpected end tag token (frameset in the frameset phase (innerHTML).",
  6228. "unexpected-end-tag-in-frameset":
  6229. "Unexpected end tag token ({name}) in the frameset phase. Ignored.",
  6230. "unexpected-char-after-frameset":
  6231. "Unexpected non-space characters in the after frameset phase. Ignored.",
  6232. "unexpected-start-tag-after-frameset":
  6233. "Unexpected start tag ({name}) in the after frameset phase. Ignored.",
  6234. "unexpected-end-tag-after-frameset":
  6235. "Unexpected end tag ({name}) in the after frameset phase. Ignored.",
  6236. "expected-eof-but-got-char":
  6237. "Unexpected non-space characters. Expected end of file.",
  6238. "expected-eof-but-got-start-tag":
  6239. "Unexpected start tag ({name}). Expected end of file.",
  6240. "expected-eof-but-got-end-tag":
  6241. "Unexpected end tag ({name}). Expected end of file.",
  6242. "unexpected-end-table-in-caption":
  6243. "Unexpected end table tag in caption. Generates implied end caption.",
  6244. "end-html-in-innerhtml":
  6245. "Unexpected html end tag in inner html mode.",
  6246. "eof-in-table":
  6247. "Unexpected end of file. Expected table content.",
  6248. "eof-in-script":
  6249. "Unexpected end of file. Expected script content.",
  6250. "non-void-element-with-trailing-solidus":
  6251. "Trailing solidus not allowed on element {name}.",
  6252. "unexpected-html-element-in-foreign-content":
  6253. "HTML start tag \"{name}\" in a foreign namespace context.",
  6254. "unexpected-start-tag-in-table":
  6255. "Unexpected {name}. Expected table content."
  6256. }
  6257. },
  6258. {}],
  6259. 9:[function(_dereq_,module,exports){
  6260. var SAXTreeBuilder = _dereq_('./SAXTreeBuilder').SAXTreeBuilder;
  6261. var Tokenizer = _dereq_('../Tokenizer').Tokenizer;
  6262. var TreeParser = _dereq_('./TreeParser').TreeParser;
  6263. function SAXParser() {
  6264. this.contentHandler = null;
  6265. this._errorHandler = null;
  6266. this._treeBuilder = new SAXTreeBuilder();
  6267. this._tokenizer = new Tokenizer(this._treeBuilder);
  6268. this._scriptingEnabled = false;
  6269. }
  6270. SAXParser.prototype.parse = function(source, context) {
  6271. if (context) {
  6272. this._treeBuilder.setFragmentContext(context);
  6273. }
  6274. this._tokenizer.tokenize(source);
  6275. var document = this._treeBuilder.document;
  6276. if (document) {
  6277. new TreeParser(this.contentHandler).parse(document);
  6278. }
  6279. };
  6280. SAXParser.prototype.parseFragment = function(source, context) {
  6281. this._treeBuilder.setFragmentContext(context);
  6282. this._tokenizer.tokenize(source);
  6283. var fragment = this._treeBuilder.getFragment();
  6284. if (fragment) {
  6285. new TreeParser(this.contentHandler).parse(fragment);
  6286. }
  6287. };
  6288. Object.defineProperty(SAXParser.prototype, 'scriptingEnabled', {
  6289. get: function() {
  6290. return this._scriptingEnabled;
  6291. },
  6292. set: function(value) {
  6293. this._scriptingEnabled = value;
  6294. this._treeBuilder.scriptingEnabled = value;
  6295. }
  6296. });
  6297. Object.defineProperty(SAXParser.prototype, 'errorHandler', {
  6298. get: function() {
  6299. return this._errorHandler;
  6300. },
  6301. set: function(value) {
  6302. this._errorHandler = value;
  6303. this._treeBuilder.errorHandler = value;
  6304. }
  6305. });
  6306. exports.SAXParser = SAXParser;
  6307. },
  6308. {"../Tokenizer":5,"./SAXTreeBuilder":10,"./TreeParser":11}],
  6309. 10:[function(_dereq_,module,exports){
  6310. var util = _dereq_('util');
  6311. var TreeBuilder = _dereq_('../TreeBuilder').TreeBuilder;
  6312. function SAXTreeBuilder() {
  6313. TreeBuilder.call(this);
  6314. }
  6315. util.inherits(SAXTreeBuilder, TreeBuilder);
  6316. SAXTreeBuilder.prototype.start = function(tokenizer) {
  6317. this.document = new Document(this.tokenizer);
  6318. };
  6319. SAXTreeBuilder.prototype.end = function() {
  6320. this.document.endLocator = this.tokenizer;
  6321. };
  6322. SAXTreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) {
  6323. var doctype = new DTD(this.tokenizer, name, publicId, systemId);
  6324. doctype.endLocator = this.tokenizer;
  6325. this.document.appendChild(doctype);
  6326. };
  6327. SAXTreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) {
  6328. var element = new Element(this.tokenizer, namespaceURI, localName, localName, attributes || []);
  6329. return element;
  6330. };
  6331. SAXTreeBuilder.prototype.insertComment = function(data, parent) {
  6332. if (!parent)
  6333. parent = this.currentStackItem();
  6334. var comment = new Comment(this.tokenizer, data);
  6335. parent.appendChild(comment);
  6336. };
  6337. SAXTreeBuilder.prototype.appendCharacters = function(parent, data) {
  6338. var text = new Characters(this.tokenizer, data);
  6339. parent.appendChild(text);
  6340. };
  6341. SAXTreeBuilder.prototype.insertText = function(data) {
  6342. if (this.redirectAttachToFosterParent && this.openElements.top.isFosterParenting()) {
  6343. var tableIndex = this.openElements.findIndex('table');
  6344. var tableItem = this.openElements.item(tableIndex);
  6345. var table = tableItem.node;
  6346. if (tableIndex === 0) {
  6347. return this.appendCharacters(table, data);
  6348. }
  6349. var text = new Characters(this.tokenizer, data);
  6350. var parent = table.parentNode;
  6351. if (parent) {
  6352. parent.insertBetween(text, table.previousSibling, table);
  6353. return;
  6354. }
  6355. var stackParent = this.openElements.item(tableIndex - 1).node;
  6356. stackParent.appendChild(text);
  6357. return;
  6358. }
  6359. this.appendCharacters(this.currentStackItem().node, data);
  6360. };
  6361. SAXTreeBuilder.prototype.attachNode = function(node, parent) {
  6362. parent.appendChild(node);
  6363. };
  6364. SAXTreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) {
  6365. var parent = table.parentNode;
  6366. if (parent)
  6367. parent.insertBetween(child, table.previousSibling, table);
  6368. else
  6369. stackParent.appendChild(child);
  6370. };
  6371. SAXTreeBuilder.prototype.detachFromParent = function(element) {
  6372. element.detach();
  6373. };
  6374. SAXTreeBuilder.prototype.reparentChildren = function(oldParent, newParent) {
  6375. newParent.appendChildren(oldParent.firstChild);
  6376. };
  6377. SAXTreeBuilder.prototype.getFragment = function() {
  6378. var fragment = new DocumentFragment();
  6379. this.reparentChildren(this.openElements.rootNode, fragment);
  6380. return fragment;
  6381. };
  6382. function getAttribute(node, name) {
  6383. for (var i = 0; i < node.attributes.length; i++) {
  6384. var attribute = node.attributes[i];
  6385. if (attribute.nodeName === name)
  6386. return attribute.nodeValue;
  6387. }
  6388. }
  6389. SAXTreeBuilder.prototype.addAttributesToElement = function(element, attributes) {
  6390. for (var i = 0; i < attributes.length; i++) {
  6391. var attribute = attributes[i];
  6392. if (!getAttribute(element, attribute.nodeName))
  6393. element.attributes.push(attribute);
  6394. }
  6395. };
  6396. var NodeType = {
  6397. CDATA: 1,
  6398. CHARACTERS: 2,
  6399. COMMENT: 3,
  6400. DOCUMENT: 4,
  6401. DOCUMENT_FRAGMENT: 5,
  6402. DTD: 6,
  6403. ELEMENT: 7,
  6404. ENTITY: 8,
  6405. IGNORABLE_WHITESPACE: 9,
  6406. PROCESSING_INSTRUCTION: 10,
  6407. SKIPPED_ENTITY: 11
  6408. };
  6409. function Node(locator) {
  6410. if (!locator) {
  6411. this.columnNumber = -1;
  6412. this.lineNumber = -1;
  6413. } else {
  6414. this.columnNumber = locator.columnNumber;
  6415. this.lineNumber = locator.lineNumber;
  6416. }
  6417. this.parentNode = null;
  6418. this.nextSibling = null;
  6419. this.firstChild = null;
  6420. }
  6421. Node.prototype.visit = function(treeParser) {
  6422. throw new Error("Not Implemented");
  6423. };
  6424. Node.prototype.revisit = function(treeParser) {
  6425. return;
  6426. };
  6427. Node.prototype.detach = function() {
  6428. if (this.parentNode !== null) {
  6429. this.parentNode.removeChild(this);
  6430. this.parentNode = null;
  6431. }
  6432. };
  6433. Object.defineProperty(Node.prototype, 'previousSibling', {
  6434. get: function() {
  6435. var prev = null;
  6436. var next = this.parentNode.firstChild;
  6437. for(;;) {
  6438. if (this == next) {
  6439. return prev;
  6440. }
  6441. prev = next;
  6442. next = next.nextSibling;
  6443. }
  6444. }
  6445. });
  6446. function ParentNode(locator) {
  6447. Node.call(this, locator);
  6448. this.lastChild = null;
  6449. this._endLocator = null;
  6450. }
  6451. ParentNode.prototype = Object.create(Node.prototype);
  6452. ParentNode.prototype.insertBefore = function(child, sibling) {
  6453. if (!sibling) {
  6454. return this.appendChild(child);
  6455. }
  6456. child.detach();
  6457. child.parentNode = this;
  6458. if (this.firstChild == sibling) {
  6459. child.nextSibling = sibling;
  6460. this.firstChild = child;
  6461. } else {
  6462. var prev = this.firstChild;
  6463. var next = this.firstChild.nextSibling;
  6464. while (next != sibling) {
  6465. prev = next;
  6466. next = next.nextSibling;
  6467. }
  6468. prev.nextSibling = child;
  6469. child.nextSibling = next;
  6470. }
  6471. return child;
  6472. };
  6473. ParentNode.prototype.insertBetween = function(child, prev, next) {
  6474. if (!next) {
  6475. return this.appendChild(child);
  6476. }
  6477. child.detach();
  6478. child.parentNode = this;
  6479. child.nextSibling = next;
  6480. if (!prev) {
  6481. firstChild = child;
  6482. } else {
  6483. prev.nextSibling = child;
  6484. }
  6485. return child;
  6486. };
  6487. ParentNode.prototype.appendChild = function(child) {
  6488. child.detach();
  6489. child.parentNode = this;
  6490. if (!this.firstChild) {
  6491. this.firstChild = child;
  6492. } else {
  6493. this.lastChild.nextSibling = child;
  6494. }
  6495. this.lastChild = child;
  6496. return child;
  6497. };
  6498. ParentNode.prototype.appendChildren = function(parent) {
  6499. var child = parent.firstChild;
  6500. if (!child) {
  6501. return;
  6502. }
  6503. var another = parent;
  6504. if (!this.firstChild) {
  6505. this.firstChild = child;
  6506. } else {
  6507. this.lastChild.nextSibling = child;
  6508. }
  6509. this.lastChild = another.lastChild;
  6510. do {
  6511. child.parentNode = this;
  6512. } while ((child = child.nextSibling));
  6513. another.firstChild = null;
  6514. another.lastChild = null;
  6515. };
  6516. ParentNode.prototype.removeChild = function(node) {
  6517. if (this.firstChild == node) {
  6518. this.firstChild = node.nextSibling;
  6519. if (this.lastChild == node) {
  6520. this.lastChild = null;
  6521. }
  6522. } else {
  6523. var prev = this.firstChild;
  6524. var next = this.firstChild.nextSibling;
  6525. while (next != node) {
  6526. prev = next;
  6527. next = next.nextSibling;
  6528. }
  6529. prev.nextSibling = node.nextSibling;
  6530. if (this.lastChild == node) {
  6531. this.lastChild = prev;
  6532. }
  6533. }
  6534. node.parentNode = null;
  6535. return node;
  6536. };
  6537. Object.defineProperty(ParentNode.prototype, 'endLocator', {
  6538. get: function() {
  6539. return this._endLocator;
  6540. },
  6541. set: function(endLocator) {
  6542. this._endLocator = {
  6543. lineNumber: endLocator.lineNumber,
  6544. columnNumber: endLocator.columnNumber
  6545. };
  6546. }
  6547. });
  6548. function Document (locator) {
  6549. ParentNode.call(this, locator);
  6550. this.nodeType = NodeType.DOCUMENT;
  6551. }
  6552. Document.prototype = Object.create(ParentNode.prototype);
  6553. Document.prototype.visit = function(treeParser) {
  6554. treeParser.startDocument(this);
  6555. };
  6556. Document.prototype.revisit = function(treeParser) {
  6557. treeParser.endDocument(this.endLocator);
  6558. };
  6559. function DocumentFragment() {
  6560. ParentNode.call(this, new Locator());
  6561. this.nodeType = NodeType.DOCUMENT_FRAGMENT;
  6562. }
  6563. DocumentFragment.prototype = Object.create(ParentNode.prototype);
  6564. DocumentFragment.prototype.visit = function(treeParser) {
  6565. };
  6566. function Element(locator, uri, localName, qName, atts, prefixMappings) {
  6567. ParentNode.call(this, locator);
  6568. this.uri = uri;
  6569. this.localName = localName;
  6570. this.qName = qName;
  6571. this.attributes = atts;
  6572. this.prefixMappings = prefixMappings;
  6573. this.nodeType = NodeType.ELEMENT;
  6574. }
  6575. Element.prototype = Object.create(ParentNode.prototype);
  6576. Element.prototype.visit = function(treeParser) {
  6577. if (this.prefixMappings) {
  6578. for (var key in prefixMappings) {
  6579. var mapping = prefixMappings[key];
  6580. treeParser.startPrefixMapping(mapping.getPrefix(),
  6581. mapping.getUri(), this);
  6582. }
  6583. }
  6584. treeParser.startElement(this.uri, this.localName, this.qName, this.attributes, this);
  6585. };
  6586. Element.prototype.revisit = function(treeParser) {
  6587. treeParser.endElement(this.uri, this.localName, this.qName, this.endLocator);
  6588. if (this.prefixMappings) {
  6589. for (var key in prefixMappings) {
  6590. var mapping = prefixMappings[key];
  6591. treeParser.endPrefixMapping(mapping.getPrefix(), this.endLocator);
  6592. }
  6593. }
  6594. };
  6595. function Characters(locator, data){
  6596. Node.call(this, locator);
  6597. this.data = data;
  6598. this.nodeType = NodeType.CHARACTERS;
  6599. }
  6600. Characters.prototype = Object.create(Node.prototype);
  6601. Characters.prototype.visit = function (treeParser) {
  6602. treeParser.characters(this.data, 0, this.data.length, this);
  6603. };
  6604. function IgnorableWhitespace(locator, data) {
  6605. Node.call(this, locator);
  6606. this.data = data;
  6607. this.nodeType = NodeType.IGNORABLE_WHITESPACE;
  6608. }
  6609. IgnorableWhitespace.prototype = Object.create(Node.prototype);
  6610. IgnorableWhitespace.prototype.visit = function(treeParser) {
  6611. treeParser.ignorableWhitespace(this.data, 0, this.data.length, this);
  6612. };
  6613. function Comment(locator, data) {
  6614. Node.call(this, locator);
  6615. this.data = data;
  6616. this.nodeType = NodeType.COMMENT;
  6617. }
  6618. Comment.prototype = Object.create(Node.prototype);
  6619. Comment.prototype.visit = function(treeParser) {
  6620. treeParser.comment(this.data, 0, this.data.length, this);
  6621. };
  6622. function CDATA(locator) {
  6623. ParentNode.call(this, locator);
  6624. this.nodeType = NodeType.CDATA;
  6625. }
  6626. CDATA.prototype = Object.create(ParentNode.prototype);
  6627. CDATA.prototype.visit = function(treeParser) {
  6628. treeParser.startCDATA(this);
  6629. };
  6630. CDATA.prototype.revisit = function(treeParser) {
  6631. treeParser.endCDATA(this.endLocator);
  6632. };
  6633. function Entity(name) {
  6634. ParentNode.call(this);
  6635. this.name = name;
  6636. this.nodeType = NodeType.ENTITY;
  6637. }
  6638. Entity.prototype = Object.create(ParentNode.prototype);
  6639. Entity.prototype.visit = function(treeParser) {
  6640. treeParser.startEntity(this.name, this);
  6641. };
  6642. Entity.prototype.revisit = function(treeParser) {
  6643. treeParser.endEntity(this.name);
  6644. };
  6645. function SkippedEntity(name) {
  6646. Node.call(this);
  6647. this.name = name;
  6648. this.nodeType = NodeType.SKIPPED_ENTITY;
  6649. }
  6650. SkippedEntity.prototype = Object.create(Node.prototype);
  6651. SkippedEntity.prototype.visit = function(treeParser) {
  6652. treeParser.skippedEntity(this.name, this);
  6653. };
  6654. function ProcessingInstruction(target, data) {
  6655. Node.call(this);
  6656. this.target = target;
  6657. this.data = data;
  6658. }
  6659. ProcessingInstruction.prototype = Object.create(Node.prototype);
  6660. ProcessingInstruction.prototype.visit = function(treeParser) {
  6661. treeParser.processingInstruction(this.target, this.data, this);
  6662. };
  6663. ProcessingInstruction.prototype.getNodeType = function() {
  6664. return NodeType.PROCESSING_INSTRUCTION;
  6665. };
  6666. function DTD(name, publicIdentifier, systemIdentifier) {
  6667. ParentNode.call(this);
  6668. this.name = name;
  6669. this.publicIdentifier = publicIdentifier;
  6670. this.systemIdentifier = systemIdentifier;
  6671. this.nodeType = NodeType.DTD;
  6672. }
  6673. DTD.prototype = Object.create(ParentNode.prototype);
  6674. DTD.prototype.visit = function(treeParser) {
  6675. treeParser.startDTD(this.name, this.publicIdentifier, this.systemIdentifier, this);
  6676. };
  6677. DTD.prototype.revisit = function(treeParser) {
  6678. treeParser.endDTD();
  6679. };
  6680. exports.SAXTreeBuilder = SAXTreeBuilder;
  6681. },
  6682. {"../TreeBuilder":6,"util":20}],
  6683. 11:[function(_dereq_,module,exports){
  6684. function TreeParser(contentHandler, lexicalHandler){
  6685. this.contentHandler;
  6686. this.lexicalHandler;
  6687. this.locatorDelegate;
  6688. if (!contentHandler) {
  6689. throw new IllegalArgumentException("contentHandler was null.");
  6690. }
  6691. this.contentHandler = contentHandler;
  6692. if (!lexicalHandler) {
  6693. this.lexicalHandler = new NullLexicalHandler();
  6694. } else {
  6695. this.lexicalHandler = lexicalHandler;
  6696. }
  6697. }
  6698. TreeParser.prototype.parse = function(node) {
  6699. this.contentHandler.documentLocator = this;
  6700. var current = node;
  6701. var next;
  6702. for (;;) {
  6703. current.visit(this);
  6704. if (next = current.firstChild) {
  6705. current = next;
  6706. continue;
  6707. }
  6708. for (;;) {
  6709. current.revisit(this);
  6710. if (current == node) {
  6711. return;
  6712. }
  6713. if (next = current.nextSibling) {
  6714. current = next;
  6715. break;
  6716. }
  6717. current = current.parentNode;
  6718. }
  6719. }
  6720. };
  6721. TreeParser.prototype.characters = function(ch, start, length, locator) {
  6722. this.locatorDelegate = locator;
  6723. this.contentHandler.characters(ch, start, length);
  6724. };
  6725. TreeParser.prototype.endDocument = function(locator) {
  6726. this.locatorDelegate = locator;
  6727. this.contentHandler.endDocument();
  6728. };
  6729. TreeParser.prototype.endElement = function(uri, localName, qName, locator) {
  6730. this.locatorDelegate = locator;
  6731. this.contentHandler.endElement(uri, localName, qName);
  6732. };
  6733. TreeParser.prototype.endPrefixMapping = function(prefix, locator) {
  6734. this.locatorDelegate = locator;
  6735. this.contentHandler.endPrefixMapping(prefix);
  6736. };
  6737. TreeParser.prototype.ignorableWhitespace = function(ch, start, length, locator) {
  6738. this.locatorDelegate = locator;
  6739. this.contentHandler.ignorableWhitespace(ch, start, length);
  6740. };
  6741. TreeParser.prototype.processingInstruction = function(target, data, locator) {
  6742. this.locatorDelegate = locator;
  6743. this.contentHandler.processingInstruction(target, data);
  6744. };
  6745. TreeParser.prototype.skippedEntity = function(name, locator) {
  6746. this.locatorDelegate = locator;
  6747. this.contentHandler.skippedEntity(name);
  6748. };
  6749. TreeParser.prototype.startDocument = function(locator) {
  6750. this.locatorDelegate = locator;
  6751. this.contentHandler.startDocument();
  6752. };
  6753. TreeParser.prototype.startElement = function(uri, localName, qName, atts, locator) {
  6754. this.locatorDelegate = locator;
  6755. this.contentHandler.startElement(uri, localName, qName, atts);
  6756. };
  6757. TreeParser.prototype.startPrefixMapping = function(prefix, uri, locator) {
  6758. this.locatorDelegate = locator;
  6759. this.contentHandler.startPrefixMapping(prefix, uri);
  6760. };
  6761. TreeParser.prototype.comment = function(ch, start, length, locator) {
  6762. this.locatorDelegate = locator;
  6763. this.lexicalHandler.comment(ch, start, length);
  6764. };
  6765. TreeParser.prototype.endCDATA = function(locator) {
  6766. this.locatorDelegate = locator;
  6767. this.lexicalHandler.endCDATA();
  6768. };
  6769. TreeParser.prototype.endDTD = function(locator) {
  6770. this.locatorDelegate = locator;
  6771. this.lexicalHandler.endDTD();
  6772. };
  6773. TreeParser.prototype.endEntity = function(name, locator) {
  6774. this.locatorDelegate = locator;
  6775. this.lexicalHandler.endEntity(name);
  6776. };
  6777. TreeParser.prototype.startCDATA = function(locator) {
  6778. this.locatorDelegate = locator;
  6779. this.lexicalHandler.startCDATA();
  6780. };
  6781. TreeParser.prototype.startDTD = function(name, publicId, systemId, locator) {
  6782. this.locatorDelegate = locator;
  6783. this.lexicalHandler.startDTD(name, publicId, systemId);
  6784. };
  6785. TreeParser.prototype.startEntity = function(name, locator) {
  6786. this.locatorDelegate = locator;
  6787. this.lexicalHandler.startEntity(name);
  6788. };
  6789. Object.defineProperty(TreeParser.prototype, 'columnNumber', {
  6790. get: function() {
  6791. if (!this.locatorDelegate)
  6792. return -1;
  6793. else
  6794. return this.locatorDelegate.columnNumber;
  6795. }
  6796. });
  6797. Object.defineProperty(TreeParser.prototype, 'lineNumber', {
  6798. get: function() {
  6799. if (!this.locatorDelegate)
  6800. return -1;
  6801. else
  6802. return this.locatorDelegate.lineNumber;
  6803. }
  6804. });
  6805. function NullLexicalHandler() {
  6806. }
  6807. NullLexicalHandler.prototype.comment = function() {};
  6808. NullLexicalHandler.prototype.endCDATA = function() {};
  6809. NullLexicalHandler.prototype.endDTD = function() {};
  6810. NullLexicalHandler.prototype.endEntity = function() {};
  6811. NullLexicalHandler.prototype.startCDATA = function() {};
  6812. NullLexicalHandler.prototype.startDTD = function() {};
  6813. NullLexicalHandler.prototype.startEntity = function() {};
  6814. exports.TreeParser = TreeParser;
  6815. },
  6816. {}],
  6817. 12:[function(_dereq_,module,exports){
  6818. module.exports = {
  6819. "Aacute;": "\u00C1",
  6820. "Aacute": "\u00C1",
  6821. "aacute;": "\u00E1",
  6822. "aacute": "\u00E1",
  6823. "Abreve;": "\u0102",
  6824. "abreve;": "\u0103",
  6825. "ac;": "\u223E",
  6826. "acd;": "\u223F",
  6827. "acE;": "\u223E\u0333",
  6828. "Acirc;": "\u00C2",
  6829. "Acirc": "\u00C2",
  6830. "acirc;": "\u00E2",
  6831. "acirc": "\u00E2",
  6832. "acute;": "\u00B4",
  6833. "acute": "\u00B4",
  6834. "Acy;": "\u0410",
  6835. "acy;": "\u0430",
  6836. "AElig;": "\u00C6",
  6837. "AElig": "\u00C6",
  6838. "aelig;": "\u00E6",
  6839. "aelig": "\u00E6",
  6840. "af;": "\u2061",
  6841. "Afr;": "\uD835\uDD04",
  6842. "afr;": "\uD835\uDD1E",
  6843. "Agrave;": "\u00C0",
  6844. "Agrave": "\u00C0",
  6845. "agrave;": "\u00E0",
  6846. "agrave": "\u00E0",
  6847. "alefsym;": "\u2135",
  6848. "aleph;": "\u2135",
  6849. "Alpha;": "\u0391",
  6850. "alpha;": "\u03B1",
  6851. "Amacr;": "\u0100",
  6852. "amacr;": "\u0101",
  6853. "amalg;": "\u2A3F",
  6854. "amp;": "\u0026",
  6855. "amp": "\u0026",
  6856. "AMP;": "\u0026",
  6857. "AMP": "\u0026",
  6858. "andand;": "\u2A55",
  6859. "And;": "\u2A53",
  6860. "and;": "\u2227",
  6861. "andd;": "\u2A5C",
  6862. "andslope;": "\u2A58",
  6863. "andv;": "\u2A5A",
  6864. "ang;": "\u2220",
  6865. "ange;": "\u29A4",
  6866. "angle;": "\u2220",
  6867. "angmsdaa;": "\u29A8",
  6868. "angmsdab;": "\u29A9",
  6869. "angmsdac;": "\u29AA",
  6870. "angmsdad;": "\u29AB",
  6871. "angmsdae;": "\u29AC",
  6872. "angmsdaf;": "\u29AD",
  6873. "angmsdag;": "\u29AE",
  6874. "angmsdah;": "\u29AF",
  6875. "angmsd;": "\u2221",
  6876. "angrt;": "\u221F",
  6877. "angrtvb;": "\u22BE",
  6878. "angrtvbd;": "\u299D",
  6879. "angsph;": "\u2222",
  6880. "angst;": "\u00C5",
  6881. "angzarr;": "\u237C",
  6882. "Aogon;": "\u0104",
  6883. "aogon;": "\u0105",
  6884. "Aopf;": "\uD835\uDD38",
  6885. "aopf;": "\uD835\uDD52",
  6886. "apacir;": "\u2A6F",
  6887. "ap;": "\u2248",
  6888. "apE;": "\u2A70",
  6889. "ape;": "\u224A",
  6890. "apid;": "\u224B",
  6891. "apos;": "\u0027",
  6892. "ApplyFunction;": "\u2061",
  6893. "approx;": "\u2248",
  6894. "approxeq;": "\u224A",
  6895. "Aring;": "\u00C5",
  6896. "Aring": "\u00C5",
  6897. "aring;": "\u00E5",
  6898. "aring": "\u00E5",
  6899. "Ascr;": "\uD835\uDC9C",
  6900. "ascr;": "\uD835\uDCB6",
  6901. "Assign;": "\u2254",
  6902. "ast;": "\u002A",
  6903. "asymp;": "\u2248",
  6904. "asympeq;": "\u224D",
  6905. "Atilde;": "\u00C3",
  6906. "Atilde": "\u00C3",
  6907. "atilde;": "\u00E3",
  6908. "atilde": "\u00E3",
  6909. "Auml;": "\u00C4",
  6910. "Auml": "\u00C4",
  6911. "auml;": "\u00E4",
  6912. "auml": "\u00E4",
  6913. "awconint;": "\u2233",
  6914. "awint;": "\u2A11",
  6915. "backcong;": "\u224C",
  6916. "backepsilon;": "\u03F6",
  6917. "backprime;": "\u2035",
  6918. "backsim;": "\u223D",
  6919. "backsimeq;": "\u22CD",
  6920. "Backslash;": "\u2216",
  6921. "Barv;": "\u2AE7",
  6922. "barvee;": "\u22BD",
  6923. "barwed;": "\u2305",
  6924. "Barwed;": "\u2306",
  6925. "barwedge;": "\u2305",
  6926. "bbrk;": "\u23B5",
  6927. "bbrktbrk;": "\u23B6",
  6928. "bcong;": "\u224C",
  6929. "Bcy;": "\u0411",
  6930. "bcy;": "\u0431",
  6931. "bdquo;": "\u201E",
  6932. "becaus;": "\u2235",
  6933. "because;": "\u2235",
  6934. "Because;": "\u2235",
  6935. "bemptyv;": "\u29B0",
  6936. "bepsi;": "\u03F6",
  6937. "bernou;": "\u212C",
  6938. "Bernoullis;": "\u212C",
  6939. "Beta;": "\u0392",
  6940. "beta;": "\u03B2",
  6941. "beth;": "\u2136",
  6942. "between;": "\u226C",
  6943. "Bfr;": "\uD835\uDD05",
  6944. "bfr;": "\uD835\uDD1F",
  6945. "bigcap;": "\u22C2",
  6946. "bigcirc;": "\u25EF",
  6947. "bigcup;": "\u22C3",
  6948. "bigodot;": "\u2A00",
  6949. "bigoplus;": "\u2A01",
  6950. "bigotimes;": "\u2A02",
  6951. "bigsqcup;": "\u2A06",
  6952. "bigstar;": "\u2605",
  6953. "bigtriangledown;": "\u25BD",
  6954. "bigtriangleup;": "\u25B3",
  6955. "biguplus;": "\u2A04",
  6956. "bigvee;": "\u22C1",
  6957. "bigwedge;": "\u22C0",
  6958. "bkarow;": "\u290D",
  6959. "blacklozenge;": "\u29EB",
  6960. "blacksquare;": "\u25AA",
  6961. "blacktriangle;": "\u25B4",
  6962. "blacktriangledown;": "\u25BE",
  6963. "blacktriangleleft;": "\u25C2",
  6964. "blacktriangleright;": "\u25B8",
  6965. "blank;": "\u2423",
  6966. "blk12;": "\u2592",
  6967. "blk14;": "\u2591",
  6968. "blk34;": "\u2593",
  6969. "block;": "\u2588",
  6970. "bne;": "\u003D\u20E5",
  6971. "bnequiv;": "\u2261\u20E5",
  6972. "bNot;": "\u2AED",
  6973. "bnot;": "\u2310",
  6974. "Bopf;": "\uD835\uDD39",
  6975. "bopf;": "\uD835\uDD53",
  6976. "bot;": "\u22A5",
  6977. "bottom;": "\u22A5",
  6978. "bowtie;": "\u22C8",
  6979. "boxbox;": "\u29C9",
  6980. "boxdl;": "\u2510",
  6981. "boxdL;": "\u2555",
  6982. "boxDl;": "\u2556",
  6983. "boxDL;": "\u2557",
  6984. "boxdr;": "\u250C",
  6985. "boxdR;": "\u2552",
  6986. "boxDr;": "\u2553",
  6987. "boxDR;": "\u2554",
  6988. "boxh;": "\u2500",
  6989. "boxH;": "\u2550",
  6990. "boxhd;": "\u252C",
  6991. "boxHd;": "\u2564",
  6992. "boxhD;": "\u2565",
  6993. "boxHD;": "\u2566",
  6994. "boxhu;": "\u2534",
  6995. "boxHu;": "\u2567",
  6996. "boxhU;": "\u2568",
  6997. "boxHU;": "\u2569",
  6998. "boxminus;": "\u229F",
  6999. "boxplus;": "\u229E",
  7000. "boxtimes;": "\u22A0",
  7001. "boxul;": "\u2518",
  7002. "boxuL;": "\u255B",
  7003. "boxUl;": "\u255C",
  7004. "boxUL;": "\u255D",
  7005. "boxur;": "\u2514",
  7006. "boxuR;": "\u2558",
  7007. "boxUr;": "\u2559",
  7008. "boxUR;": "\u255A",
  7009. "boxv;": "\u2502",
  7010. "boxV;": "\u2551",
  7011. "boxvh;": "\u253C",
  7012. "boxvH;": "\u256A",
  7013. "boxVh;": "\u256B",
  7014. "boxVH;": "\u256C",
  7015. "boxvl;": "\u2524",
  7016. "boxvL;": "\u2561",
  7017. "boxVl;": "\u2562",
  7018. "boxVL;": "\u2563",
  7019. "boxvr;": "\u251C",
  7020. "boxvR;": "\u255E",
  7021. "boxVr;": "\u255F",
  7022. "boxVR;": "\u2560",
  7023. "bprime;": "\u2035",
  7024. "breve;": "\u02D8",
  7025. "Breve;": "\u02D8",
  7026. "brvbar;": "\u00A6",
  7027. "brvbar": "\u00A6",
  7028. "bscr;": "\uD835\uDCB7",
  7029. "Bscr;": "\u212C",
  7030. "bsemi;": "\u204F",
  7031. "bsim;": "\u223D",
  7032. "bsime;": "\u22CD",
  7033. "bsolb;": "\u29C5",
  7034. "bsol;": "\u005C",
  7035. "bsolhsub;": "\u27C8",
  7036. "bull;": "\u2022",
  7037. "bullet;": "\u2022",
  7038. "bump;": "\u224E",
  7039. "bumpE;": "\u2AAE",
  7040. "bumpe;": "\u224F",
  7041. "Bumpeq;": "\u224E",
  7042. "bumpeq;": "\u224F",
  7043. "Cacute;": "\u0106",
  7044. "cacute;": "\u0107",
  7045. "capand;": "\u2A44",
  7046. "capbrcup;": "\u2A49",
  7047. "capcap;": "\u2A4B",
  7048. "cap;": "\u2229",
  7049. "Cap;": "\u22D2",
  7050. "capcup;": "\u2A47",
  7051. "capdot;": "\u2A40",
  7052. "CapitalDifferentialD;": "\u2145",
  7053. "caps;": "\u2229\uFE00",
  7054. "caret;": "\u2041",
  7055. "caron;": "\u02C7",
  7056. "Cayleys;": "\u212D",
  7057. "ccaps;": "\u2A4D",
  7058. "Ccaron;": "\u010C",
  7059. "ccaron;": "\u010D",
  7060. "Ccedil;": "\u00C7",
  7061. "Ccedil": "\u00C7",
  7062. "ccedil;": "\u00E7",
  7063. "ccedil": "\u00E7",
  7064. "Ccirc;": "\u0108",
  7065. "ccirc;": "\u0109",
  7066. "Cconint;": "\u2230",
  7067. "ccups;": "\u2A4C",
  7068. "ccupssm;": "\u2A50",
  7069. "Cdot;": "\u010A",
  7070. "cdot;": "\u010B",
  7071. "cedil;": "\u00B8",
  7072. "cedil": "\u00B8",
  7073. "Cedilla;": "\u00B8",
  7074. "cemptyv;": "\u29B2",
  7075. "cent;": "\u00A2",
  7076. "cent": "\u00A2",
  7077. "centerdot;": "\u00B7",
  7078. "CenterDot;": "\u00B7",
  7079. "cfr;": "\uD835\uDD20",
  7080. "Cfr;": "\u212D",
  7081. "CHcy;": "\u0427",
  7082. "chcy;": "\u0447",
  7083. "check;": "\u2713",
  7084. "checkmark;": "\u2713",
  7085. "Chi;": "\u03A7",
  7086. "chi;": "\u03C7",
  7087. "circ;": "\u02C6",
  7088. "circeq;": "\u2257",
  7089. "circlearrowleft;": "\u21BA",
  7090. "circlearrowright;": "\u21BB",
  7091. "circledast;": "\u229B",
  7092. "circledcirc;": "\u229A",
  7093. "circleddash;": "\u229D",
  7094. "CircleDot;": "\u2299",
  7095. "circledR;": "\u00AE",
  7096. "circledS;": "\u24C8",
  7097. "CircleMinus;": "\u2296",
  7098. "CirclePlus;": "\u2295",
  7099. "CircleTimes;": "\u2297",
  7100. "cir;": "\u25CB",
  7101. "cirE;": "\u29C3",
  7102. "cire;": "\u2257",
  7103. "cirfnint;": "\u2A10",
  7104. "cirmid;": "\u2AEF",
  7105. "cirscir;": "\u29C2",
  7106. "ClockwiseContourIntegral;": "\u2232",
  7107. "CloseCurlyDoubleQuote;": "\u201D",
  7108. "CloseCurlyQuote;": "\u2019",
  7109. "clubs;": "\u2663",
  7110. "clubsuit;": "\u2663",
  7111. "colon;": "\u003A",
  7112. "Colon;": "\u2237",
  7113. "Colone;": "\u2A74",
  7114. "colone;": "\u2254",
  7115. "coloneq;": "\u2254",
  7116. "comma;": "\u002C",
  7117. "commat;": "\u0040",
  7118. "comp;": "\u2201",
  7119. "compfn;": "\u2218",
  7120. "complement;": "\u2201",
  7121. "complexes;": "\u2102",
  7122. "cong;": "\u2245",
  7123. "congdot;": "\u2A6D",
  7124. "Congruent;": "\u2261",
  7125. "conint;": "\u222E",
  7126. "Conint;": "\u222F",
  7127. "ContourIntegral;": "\u222E",
  7128. "copf;": "\uD835\uDD54",
  7129. "Copf;": "\u2102",
  7130. "coprod;": "\u2210",
  7131. "Coproduct;": "\u2210",
  7132. "copy;": "\u00A9",
  7133. "copy": "\u00A9",
  7134. "COPY;": "\u00A9",
  7135. "COPY": "\u00A9",
  7136. "copysr;": "\u2117",
  7137. "CounterClockwiseContourIntegral;": "\u2233",
  7138. "crarr;": "\u21B5",
  7139. "cross;": "\u2717",
  7140. "Cross;": "\u2A2F",
  7141. "Cscr;": "\uD835\uDC9E",
  7142. "cscr;": "\uD835\uDCB8",
  7143. "csub;": "\u2ACF",
  7144. "csube;": "\u2AD1",
  7145. "csup;": "\u2AD0",
  7146. "csupe;": "\u2AD2",
  7147. "ctdot;": "\u22EF",
  7148. "cudarrl;": "\u2938",
  7149. "cudarrr;": "\u2935",
  7150. "cuepr;": "\u22DE",
  7151. "cuesc;": "\u22DF",
  7152. "cularr;": "\u21B6",
  7153. "cularrp;": "\u293D",
  7154. "cupbrcap;": "\u2A48",
  7155. "cupcap;": "\u2A46",
  7156. "CupCap;": "\u224D",
  7157. "cup;": "\u222A",
  7158. "Cup;": "\u22D3",
  7159. "cupcup;": "\u2A4A",
  7160. "cupdot;": "\u228D",
  7161. "cupor;": "\u2A45",
  7162. "cups;": "\u222A\uFE00",
  7163. "curarr;": "\u21B7",
  7164. "curarrm;": "\u293C",
  7165. "curlyeqprec;": "\u22DE",
  7166. "curlyeqsucc;": "\u22DF",
  7167. "curlyvee;": "\u22CE",
  7168. "curlywedge;": "\u22CF",
  7169. "curren;": "\u00A4",
  7170. "curren": "\u00A4",
  7171. "curvearrowleft;": "\u21B6",
  7172. "curvearrowright;": "\u21B7",
  7173. "cuvee;": "\u22CE",
  7174. "cuwed;": "\u22CF",
  7175. "cwconint;": "\u2232",
  7176. "cwint;": "\u2231",
  7177. "cylcty;": "\u232D",
  7178. "dagger;": "\u2020",
  7179. "Dagger;": "\u2021",
  7180. "daleth;": "\u2138",
  7181. "darr;": "\u2193",
  7182. "Darr;": "\u21A1",
  7183. "dArr;": "\u21D3",
  7184. "dash;": "\u2010",
  7185. "Dashv;": "\u2AE4",
  7186. "dashv;": "\u22A3",
  7187. "dbkarow;": "\u290F",
  7188. "dblac;": "\u02DD",
  7189. "Dcaron;": "\u010E",
  7190. "dcaron;": "\u010F",
  7191. "Dcy;": "\u0414",
  7192. "dcy;": "\u0434",
  7193. "ddagger;": "\u2021",
  7194. "ddarr;": "\u21CA",
  7195. "DD;": "\u2145",
  7196. "dd;": "\u2146",
  7197. "DDotrahd;": "\u2911",
  7198. "ddotseq;": "\u2A77",
  7199. "deg;": "\u00B0",
  7200. "deg": "\u00B0",
  7201. "Del;": "\u2207",
  7202. "Delta;": "\u0394",
  7203. "delta;": "\u03B4",
  7204. "demptyv;": "\u29B1",
  7205. "dfisht;": "\u297F",
  7206. "Dfr;": "\uD835\uDD07",
  7207. "dfr;": "\uD835\uDD21",
  7208. "dHar;": "\u2965",
  7209. "dharl;": "\u21C3",
  7210. "dharr;": "\u21C2",
  7211. "DiacriticalAcute;": "\u00B4",
  7212. "DiacriticalDot;": "\u02D9",
  7213. "DiacriticalDoubleAcute;": "\u02DD",
  7214. "DiacriticalGrave;": "\u0060",
  7215. "DiacriticalTilde;": "\u02DC",
  7216. "diam;": "\u22C4",
  7217. "diamond;": "\u22C4",
  7218. "Diamond;": "\u22C4",
  7219. "diamondsuit;": "\u2666",
  7220. "diams;": "\u2666",
  7221. "die;": "\u00A8",
  7222. "DifferentialD;": "\u2146",
  7223. "digamma;": "\u03DD",
  7224. "disin;": "\u22F2",
  7225. "div;": "\u00F7",
  7226. "divide;": "\u00F7",
  7227. "divide": "\u00F7",
  7228. "divideontimes;": "\u22C7",
  7229. "divonx;": "\u22C7",
  7230. "DJcy;": "\u0402",
  7231. "djcy;": "\u0452",
  7232. "dlcorn;": "\u231E",
  7233. "dlcrop;": "\u230D",
  7234. "dollar;": "\u0024",
  7235. "Dopf;": "\uD835\uDD3B",
  7236. "dopf;": "\uD835\uDD55",
  7237. "Dot;": "\u00A8",
  7238. "dot;": "\u02D9",
  7239. "DotDot;": "\u20DC",
  7240. "doteq;": "\u2250",
  7241. "doteqdot;": "\u2251",
  7242. "DotEqual;": "\u2250",
  7243. "dotminus;": "\u2238",
  7244. "dotplus;": "\u2214",
  7245. "dotsquare;": "\u22A1",
  7246. "doublebarwedge;": "\u2306",
  7247. "DoubleContourIntegral;": "\u222F",
  7248. "DoubleDot;": "\u00A8",
  7249. "DoubleDownArrow;": "\u21D3",
  7250. "DoubleLeftArrow;": "\u21D0",
  7251. "DoubleLeftRightArrow;": "\u21D4",
  7252. "DoubleLeftTee;": "\u2AE4",
  7253. "DoubleLongLeftArrow;": "\u27F8",
  7254. "DoubleLongLeftRightArrow;": "\u27FA",
  7255. "DoubleLongRightArrow;": "\u27F9",
  7256. "DoubleRightArrow;": "\u21D2",
  7257. "DoubleRightTee;": "\u22A8",
  7258. "DoubleUpArrow;": "\u21D1",
  7259. "DoubleUpDownArrow;": "\u21D5",
  7260. "DoubleVerticalBar;": "\u2225",
  7261. "DownArrowBar;": "\u2913",
  7262. "downarrow;": "\u2193",
  7263. "DownArrow;": "\u2193",
  7264. "Downarrow;": "\u21D3",
  7265. "DownArrowUpArrow;": "\u21F5",
  7266. "DownBreve;": "\u0311",
  7267. "downdownarrows;": "\u21CA",
  7268. "downharpoonleft;": "\u21C3",
  7269. "downharpoonright;": "\u21C2",
  7270. "DownLeftRightVector;": "\u2950",
  7271. "DownLeftTeeVector;": "\u295E",
  7272. "DownLeftVectorBar;": "\u2956",
  7273. "DownLeftVector;": "\u21BD",
  7274. "DownRightTeeVector;": "\u295F",
  7275. "DownRightVectorBar;": "\u2957",
  7276. "DownRightVector;": "\u21C1",
  7277. "DownTeeArrow;": "\u21A7",
  7278. "DownTee;": "\u22A4",
  7279. "drbkarow;": "\u2910",
  7280. "drcorn;": "\u231F",
  7281. "drcrop;": "\u230C",
  7282. "Dscr;": "\uD835\uDC9F",
  7283. "dscr;": "\uD835\uDCB9",
  7284. "DScy;": "\u0405",
  7285. "dscy;": "\u0455",
  7286. "dsol;": "\u29F6",
  7287. "Dstrok;": "\u0110",
  7288. "dstrok;": "\u0111",
  7289. "dtdot;": "\u22F1",
  7290. "dtri;": "\u25BF",
  7291. "dtrif;": "\u25BE",
  7292. "duarr;": "\u21F5",
  7293. "duhar;": "\u296F",
  7294. "dwangle;": "\u29A6",
  7295. "DZcy;": "\u040F",
  7296. "dzcy;": "\u045F",
  7297. "dzigrarr;": "\u27FF",
  7298. "Eacute;": "\u00C9",
  7299. "Eacute": "\u00C9",
  7300. "eacute;": "\u00E9",
  7301. "eacute": "\u00E9",
  7302. "easter;": "\u2A6E",
  7303. "Ecaron;": "\u011A",
  7304. "ecaron;": "\u011B",
  7305. "Ecirc;": "\u00CA",
  7306. "Ecirc": "\u00CA",
  7307. "ecirc;": "\u00EA",
  7308. "ecirc": "\u00EA",
  7309. "ecir;": "\u2256",
  7310. "ecolon;": "\u2255",
  7311. "Ecy;": "\u042D",
  7312. "ecy;": "\u044D",
  7313. "eDDot;": "\u2A77",
  7314. "Edot;": "\u0116",
  7315. "edot;": "\u0117",
  7316. "eDot;": "\u2251",
  7317. "ee;": "\u2147",
  7318. "efDot;": "\u2252",
  7319. "Efr;": "\uD835\uDD08",
  7320. "efr;": "\uD835\uDD22",
  7321. "eg;": "\u2A9A",
  7322. "Egrave;": "\u00C8",
  7323. "Egrave": "\u00C8",
  7324. "egrave;": "\u00E8",
  7325. "egrave": "\u00E8",
  7326. "egs;": "\u2A96",
  7327. "egsdot;": "\u2A98",
  7328. "el;": "\u2A99",
  7329. "Element;": "\u2208",
  7330. "elinters;": "\u23E7",
  7331. "ell;": "\u2113",
  7332. "els;": "\u2A95",
  7333. "elsdot;": "\u2A97",
  7334. "Emacr;": "\u0112",
  7335. "emacr;": "\u0113",
  7336. "empty;": "\u2205",
  7337. "emptyset;": "\u2205",
  7338. "EmptySmallSquare;": "\u25FB",
  7339. "emptyv;": "\u2205",
  7340. "EmptyVerySmallSquare;": "\u25AB",
  7341. "emsp13;": "\u2004",
  7342. "emsp14;": "\u2005",
  7343. "emsp;": "\u2003",
  7344. "ENG;": "\u014A",
  7345. "eng;": "\u014B",
  7346. "ensp;": "\u2002",
  7347. "Eogon;": "\u0118",
  7348. "eogon;": "\u0119",
  7349. "Eopf;": "\uD835\uDD3C",
  7350. "eopf;": "\uD835\uDD56",
  7351. "epar;": "\u22D5",
  7352. "eparsl;": "\u29E3",
  7353. "eplus;": "\u2A71",
  7354. "epsi;": "\u03B5",
  7355. "Epsilon;": "\u0395",
  7356. "epsilon;": "\u03B5",
  7357. "epsiv;": "\u03F5",
  7358. "eqcirc;": "\u2256",
  7359. "eqcolon;": "\u2255",
  7360. "eqsim;": "\u2242",
  7361. "eqslantgtr;": "\u2A96",
  7362. "eqslantless;": "\u2A95",
  7363. "Equal;": "\u2A75",
  7364. "equals;": "\u003D",
  7365. "EqualTilde;": "\u2242",
  7366. "equest;": "\u225F",
  7367. "Equilibrium;": "\u21CC",
  7368. "equiv;": "\u2261",
  7369. "equivDD;": "\u2A78",
  7370. "eqvparsl;": "\u29E5",
  7371. "erarr;": "\u2971",
  7372. "erDot;": "\u2253",
  7373. "escr;": "\u212F",
  7374. "Escr;": "\u2130",
  7375. "esdot;": "\u2250",
  7376. "Esim;": "\u2A73",
  7377. "esim;": "\u2242",
  7378. "Eta;": "\u0397",
  7379. "eta;": "\u03B7",
  7380. "ETH;": "\u00D0",
  7381. "ETH": "\u00D0",
  7382. "eth;": "\u00F0",
  7383. "eth": "\u00F0",
  7384. "Euml;": "\u00CB",
  7385. "Euml": "\u00CB",
  7386. "euml;": "\u00EB",
  7387. "euml": "\u00EB",
  7388. "euro;": "\u20AC",
  7389. "excl;": "\u0021",
  7390. "exist;": "\u2203",
  7391. "Exists;": "\u2203",
  7392. "expectation;": "\u2130",
  7393. "exponentiale;": "\u2147",
  7394. "ExponentialE;": "\u2147",
  7395. "fallingdotseq;": "\u2252",
  7396. "Fcy;": "\u0424",
  7397. "fcy;": "\u0444",
  7398. "female;": "\u2640",
  7399. "ffilig;": "\uFB03",
  7400. "fflig;": "\uFB00",
  7401. "ffllig;": "\uFB04",
  7402. "Ffr;": "\uD835\uDD09",
  7403. "ffr;": "\uD835\uDD23",
  7404. "filig;": "\uFB01",
  7405. "FilledSmallSquare;": "\u25FC",
  7406. "FilledVerySmallSquare;": "\u25AA",
  7407. "fjlig;": "\u0066\u006A",
  7408. "flat;": "\u266D",
  7409. "fllig;": "\uFB02",
  7410. "fltns;": "\u25B1",
  7411. "fnof;": "\u0192",
  7412. "Fopf;": "\uD835\uDD3D",
  7413. "fopf;": "\uD835\uDD57",
  7414. "forall;": "\u2200",
  7415. "ForAll;": "\u2200",
  7416. "fork;": "\u22D4",
  7417. "forkv;": "\u2AD9",
  7418. "Fouriertrf;": "\u2131",
  7419. "fpartint;": "\u2A0D",
  7420. "frac12;": "\u00BD",
  7421. "frac12": "\u00BD",
  7422. "frac13;": "\u2153",
  7423. "frac14;": "\u00BC",
  7424. "frac14": "\u00BC",
  7425. "frac15;": "\u2155",
  7426. "frac16;": "\u2159",
  7427. "frac18;": "\u215B",
  7428. "frac23;": "\u2154",
  7429. "frac25;": "\u2156",
  7430. "frac34;": "\u00BE",
  7431. "frac34": "\u00BE",
  7432. "frac35;": "\u2157",
  7433. "frac38;": "\u215C",
  7434. "frac45;": "\u2158",
  7435. "frac56;": "\u215A",
  7436. "frac58;": "\u215D",
  7437. "frac78;": "\u215E",
  7438. "frasl;": "\u2044",
  7439. "frown;": "\u2322",
  7440. "fscr;": "\uD835\uDCBB",
  7441. "Fscr;": "\u2131",
  7442. "gacute;": "\u01F5",
  7443. "Gamma;": "\u0393",
  7444. "gamma;": "\u03B3",
  7445. "Gammad;": "\u03DC",
  7446. "gammad;": "\u03DD",
  7447. "gap;": "\u2A86",
  7448. "Gbreve;": "\u011E",
  7449. "gbreve;": "\u011F",
  7450. "Gcedil;": "\u0122",
  7451. "Gcirc;": "\u011C",
  7452. "gcirc;": "\u011D",
  7453. "Gcy;": "\u0413",
  7454. "gcy;": "\u0433",
  7455. "Gdot;": "\u0120",
  7456. "gdot;": "\u0121",
  7457. "ge;": "\u2265",
  7458. "gE;": "\u2267",
  7459. "gEl;": "\u2A8C",
  7460. "gel;": "\u22DB",
  7461. "geq;": "\u2265",
  7462. "geqq;": "\u2267",
  7463. "geqslant;": "\u2A7E",
  7464. "gescc;": "\u2AA9",
  7465. "ges;": "\u2A7E",
  7466. "gesdot;": "\u2A80",
  7467. "gesdoto;": "\u2A82",
  7468. "gesdotol;": "\u2A84",
  7469. "gesl;": "\u22DB\uFE00",
  7470. "gesles;": "\u2A94",
  7471. "Gfr;": "\uD835\uDD0A",
  7472. "gfr;": "\uD835\uDD24",
  7473. "gg;": "\u226B",
  7474. "Gg;": "\u22D9",
  7475. "ggg;": "\u22D9",
  7476. "gimel;": "\u2137",
  7477. "GJcy;": "\u0403",
  7478. "gjcy;": "\u0453",
  7479. "gla;": "\u2AA5",
  7480. "gl;": "\u2277",
  7481. "glE;": "\u2A92",
  7482. "glj;": "\u2AA4",
  7483. "gnap;": "\u2A8A",
  7484. "gnapprox;": "\u2A8A",
  7485. "gne;": "\u2A88",
  7486. "gnE;": "\u2269",
  7487. "gneq;": "\u2A88",
  7488. "gneqq;": "\u2269",
  7489. "gnsim;": "\u22E7",
  7490. "Gopf;": "\uD835\uDD3E",
  7491. "gopf;": "\uD835\uDD58",
  7492. "grave;": "\u0060",
  7493. "GreaterEqual;": "\u2265",
  7494. "GreaterEqualLess;": "\u22DB",
  7495. "GreaterFullEqual;": "\u2267",
  7496. "GreaterGreater;": "\u2AA2",
  7497. "GreaterLess;": "\u2277",
  7498. "GreaterSlantEqual;": "\u2A7E",
  7499. "GreaterTilde;": "\u2273",
  7500. "Gscr;": "\uD835\uDCA2",
  7501. "gscr;": "\u210A",
  7502. "gsim;": "\u2273",
  7503. "gsime;": "\u2A8E",
  7504. "gsiml;": "\u2A90",
  7505. "gtcc;": "\u2AA7",
  7506. "gtcir;": "\u2A7A",
  7507. "gt;": "\u003E",
  7508. "gt": "\u003E",
  7509. "GT;": "\u003E",
  7510. "GT": "\u003E",
  7511. "Gt;": "\u226B",
  7512. "gtdot;": "\u22D7",
  7513. "gtlPar;": "\u2995",
  7514. "gtquest;": "\u2A7C",
  7515. "gtrapprox;": "\u2A86",
  7516. "gtrarr;": "\u2978",
  7517. "gtrdot;": "\u22D7",
  7518. "gtreqless;": "\u22DB",
  7519. "gtreqqless;": "\u2A8C",
  7520. "gtrless;": "\u2277",
  7521. "gtrsim;": "\u2273",
  7522. "gvertneqq;": "\u2269\uFE00",
  7523. "gvnE;": "\u2269\uFE00",
  7524. "Hacek;": "\u02C7",
  7525. "hairsp;": "\u200A",
  7526. "half;": "\u00BD",
  7527. "hamilt;": "\u210B",
  7528. "HARDcy;": "\u042A",
  7529. "hardcy;": "\u044A",
  7530. "harrcir;": "\u2948",
  7531. "harr;": "\u2194",
  7532. "hArr;": "\u21D4",
  7533. "harrw;": "\u21AD",
  7534. "Hat;": "\u005E",
  7535. "hbar;": "\u210F",
  7536. "Hcirc;": "\u0124",
  7537. "hcirc;": "\u0125",
  7538. "hearts;": "\u2665",
  7539. "heartsuit;": "\u2665",
  7540. "hellip;": "\u2026",
  7541. "hercon;": "\u22B9",
  7542. "hfr;": "\uD835\uDD25",
  7543. "Hfr;": "\u210C",
  7544. "HilbertSpace;": "\u210B",
  7545. "hksearow;": "\u2925",
  7546. "hkswarow;": "\u2926",
  7547. "hoarr;": "\u21FF",
  7548. "homtht;": "\u223B",
  7549. "hookleftarrow;": "\u21A9",
  7550. "hookrightarrow;": "\u21AA",
  7551. "hopf;": "\uD835\uDD59",
  7552. "Hopf;": "\u210D",
  7553. "horbar;": "\u2015",
  7554. "HorizontalLine;": "\u2500",
  7555. "hscr;": "\uD835\uDCBD",
  7556. "Hscr;": "\u210B",
  7557. "hslash;": "\u210F",
  7558. "Hstrok;": "\u0126",
  7559. "hstrok;": "\u0127",
  7560. "HumpDownHump;": "\u224E",
  7561. "HumpEqual;": "\u224F",
  7562. "hybull;": "\u2043",
  7563. "hyphen;": "\u2010",
  7564. "Iacute;": "\u00CD",
  7565. "Iacute": "\u00CD",
  7566. "iacute;": "\u00ED",
  7567. "iacute": "\u00ED",
  7568. "ic;": "\u2063",
  7569. "Icirc;": "\u00CE",
  7570. "Icirc": "\u00CE",
  7571. "icirc;": "\u00EE",
  7572. "icirc": "\u00EE",
  7573. "Icy;": "\u0418",
  7574. "icy;": "\u0438",
  7575. "Idot;": "\u0130",
  7576. "IEcy;": "\u0415",
  7577. "iecy;": "\u0435",
  7578. "iexcl;": "\u00A1",
  7579. "iexcl": "\u00A1",
  7580. "iff;": "\u21D4",
  7581. "ifr;": "\uD835\uDD26",
  7582. "Ifr;": "\u2111",
  7583. "Igrave;": "\u00CC",
  7584. "Igrave": "\u00CC",
  7585. "igrave;": "\u00EC",
  7586. "igrave": "\u00EC",
  7587. "ii;": "\u2148",
  7588. "iiiint;": "\u2A0C",
  7589. "iiint;": "\u222D",
  7590. "iinfin;": "\u29DC",
  7591. "iiota;": "\u2129",
  7592. "IJlig;": "\u0132",
  7593. "ijlig;": "\u0133",
  7594. "Imacr;": "\u012A",
  7595. "imacr;": "\u012B",
  7596. "image;": "\u2111",
  7597. "ImaginaryI;": "\u2148",
  7598. "imagline;": "\u2110",
  7599. "imagpart;": "\u2111",
  7600. "imath;": "\u0131",
  7601. "Im;": "\u2111",
  7602. "imof;": "\u22B7",
  7603. "imped;": "\u01B5",
  7604. "Implies;": "\u21D2",
  7605. "incare;": "\u2105",
  7606. "in;": "\u2208",
  7607. "infin;": "\u221E",
  7608. "infintie;": "\u29DD",
  7609. "inodot;": "\u0131",
  7610. "intcal;": "\u22BA",
  7611. "int;": "\u222B",
  7612. "Int;": "\u222C",
  7613. "integers;": "\u2124",
  7614. "Integral;": "\u222B",
  7615. "intercal;": "\u22BA",
  7616. "Intersection;": "\u22C2",
  7617. "intlarhk;": "\u2A17",
  7618. "intprod;": "\u2A3C",
  7619. "InvisibleComma;": "\u2063",
  7620. "InvisibleTimes;": "\u2062",
  7621. "IOcy;": "\u0401",
  7622. "iocy;": "\u0451",
  7623. "Iogon;": "\u012E",
  7624. "iogon;": "\u012F",
  7625. "Iopf;": "\uD835\uDD40",
  7626. "iopf;": "\uD835\uDD5A",
  7627. "Iota;": "\u0399",
  7628. "iota;": "\u03B9",
  7629. "iprod;": "\u2A3C",
  7630. "iquest;": "\u00BF",
  7631. "iquest": "\u00BF",
  7632. "iscr;": "\uD835\uDCBE",
  7633. "Iscr;": "\u2110",
  7634. "isin;": "\u2208",
  7635. "isindot;": "\u22F5",
  7636. "isinE;": "\u22F9",
  7637. "isins;": "\u22F4",
  7638. "isinsv;": "\u22F3",
  7639. "isinv;": "\u2208",
  7640. "it;": "\u2062",
  7641. "Itilde;": "\u0128",
  7642. "itilde;": "\u0129",
  7643. "Iukcy;": "\u0406",
  7644. "iukcy;": "\u0456",
  7645. "Iuml;": "\u00CF",
  7646. "Iuml": "\u00CF",
  7647. "iuml;": "\u00EF",
  7648. "iuml": "\u00EF",
  7649. "Jcirc;": "\u0134",
  7650. "jcirc;": "\u0135",
  7651. "Jcy;": "\u0419",
  7652. "jcy;": "\u0439",
  7653. "Jfr;": "\uD835\uDD0D",
  7654. "jfr;": "\uD835\uDD27",
  7655. "jmath;": "\u0237",
  7656. "Jopf;": "\uD835\uDD41",
  7657. "jopf;": "\uD835\uDD5B",
  7658. "Jscr;": "\uD835\uDCA5",
  7659. "jscr;": "\uD835\uDCBF",
  7660. "Jsercy;": "\u0408",
  7661. "jsercy;": "\u0458",
  7662. "Jukcy;": "\u0404",
  7663. "jukcy;": "\u0454",
  7664. "Kappa;": "\u039A",
  7665. "kappa;": "\u03BA",
  7666. "kappav;": "\u03F0",
  7667. "Kcedil;": "\u0136",
  7668. "kcedil;": "\u0137",
  7669. "Kcy;": "\u041A",
  7670. "kcy;": "\u043A",
  7671. "Kfr;": "\uD835\uDD0E",
  7672. "kfr;": "\uD835\uDD28",
  7673. "kgreen;": "\u0138",
  7674. "KHcy;": "\u0425",
  7675. "khcy;": "\u0445",
  7676. "KJcy;": "\u040C",
  7677. "kjcy;": "\u045C",
  7678. "Kopf;": "\uD835\uDD42",
  7679. "kopf;": "\uD835\uDD5C",
  7680. "Kscr;": "\uD835\uDCA6",
  7681. "kscr;": "\uD835\uDCC0",
  7682. "lAarr;": "\u21DA",
  7683. "Lacute;": "\u0139",
  7684. "lacute;": "\u013A",
  7685. "laemptyv;": "\u29B4",
  7686. "lagran;": "\u2112",
  7687. "Lambda;": "\u039B",
  7688. "lambda;": "\u03BB",
  7689. "lang;": "\u27E8",
  7690. "Lang;": "\u27EA",
  7691. "langd;": "\u2991",
  7692. "langle;": "\u27E8",
  7693. "lap;": "\u2A85",
  7694. "Laplacetrf;": "\u2112",
  7695. "laquo;": "\u00AB",
  7696. "laquo": "\u00AB",
  7697. "larrb;": "\u21E4",
  7698. "larrbfs;": "\u291F",
  7699. "larr;": "\u2190",
  7700. "Larr;": "\u219E",
  7701. "lArr;": "\u21D0",
  7702. "larrfs;": "\u291D",
  7703. "larrhk;": "\u21A9",
  7704. "larrlp;": "\u21AB",
  7705. "larrpl;": "\u2939",
  7706. "larrsim;": "\u2973",
  7707. "larrtl;": "\u21A2",
  7708. "latail;": "\u2919",
  7709. "lAtail;": "\u291B",
  7710. "lat;": "\u2AAB",
  7711. "late;": "\u2AAD",
  7712. "lates;": "\u2AAD\uFE00",
  7713. "lbarr;": "\u290C",
  7714. "lBarr;": "\u290E",
  7715. "lbbrk;": "\u2772",
  7716. "lbrace;": "\u007B",
  7717. "lbrack;": "\u005B",
  7718. "lbrke;": "\u298B",
  7719. "lbrksld;": "\u298F",
  7720. "lbrkslu;": "\u298D",
  7721. "Lcaron;": "\u013D",
  7722. "lcaron;": "\u013E",
  7723. "Lcedil;": "\u013B",
  7724. "lcedil;": "\u013C",
  7725. "lceil;": "\u2308",
  7726. "lcub;": "\u007B",
  7727. "Lcy;": "\u041B",
  7728. "lcy;": "\u043B",
  7729. "ldca;": "\u2936",
  7730. "ldquo;": "\u201C",
  7731. "ldquor;": "\u201E",
  7732. "ldrdhar;": "\u2967",
  7733. "ldrushar;": "\u294B",
  7734. "ldsh;": "\u21B2",
  7735. "le;": "\u2264",
  7736. "lE;": "\u2266",
  7737. "LeftAngleBracket;": "\u27E8",
  7738. "LeftArrowBar;": "\u21E4",
  7739. "leftarrow;": "\u2190",
  7740. "LeftArrow;": "\u2190",
  7741. "Leftarrow;": "\u21D0",
  7742. "LeftArrowRightArrow;": "\u21C6",
  7743. "leftarrowtail;": "\u21A2",
  7744. "LeftCeiling;": "\u2308",
  7745. "LeftDoubleBracket;": "\u27E6",
  7746. "LeftDownTeeVector;": "\u2961",
  7747. "LeftDownVectorBar;": "\u2959",
  7748. "LeftDownVector;": "\u21C3",
  7749. "LeftFloor;": "\u230A",
  7750. "leftharpoondown;": "\u21BD",
  7751. "leftharpoonup;": "\u21BC",
  7752. "leftleftarrows;": "\u21C7",
  7753. "leftrightarrow;": "\u2194",
  7754. "LeftRightArrow;": "\u2194",
  7755. "Leftrightarrow;": "\u21D4",
  7756. "leftrightarrows;": "\u21C6",
  7757. "leftrightharpoons;": "\u21CB",
  7758. "leftrightsquigarrow;": "\u21AD",
  7759. "LeftRightVector;": "\u294E",
  7760. "LeftTeeArrow;": "\u21A4",
  7761. "LeftTee;": "\u22A3",
  7762. "LeftTeeVector;": "\u295A",
  7763. "leftthreetimes;": "\u22CB",
  7764. "LeftTriangleBar;": "\u29CF",
  7765. "LeftTriangle;": "\u22B2",
  7766. "LeftTriangleEqual;": "\u22B4",
  7767. "LeftUpDownVector;": "\u2951",
  7768. "LeftUpTeeVector;": "\u2960",
  7769. "LeftUpVectorBar;": "\u2958",
  7770. "LeftUpVector;": "\u21BF",
  7771. "LeftVectorBar;": "\u2952",
  7772. "LeftVector;": "\u21BC",
  7773. "lEg;": "\u2A8B",
  7774. "leg;": "\u22DA",
  7775. "leq;": "\u2264",
  7776. "leqq;": "\u2266",
  7777. "leqslant;": "\u2A7D",
  7778. "lescc;": "\u2AA8",
  7779. "les;": "\u2A7D",
  7780. "lesdot;": "\u2A7F",
  7781. "lesdoto;": "\u2A81",
  7782. "lesdotor;": "\u2A83",
  7783. "lesg;": "\u22DA\uFE00",
  7784. "lesges;": "\u2A93",
  7785. "lessapprox;": "\u2A85",
  7786. "lessdot;": "\u22D6",
  7787. "lesseqgtr;": "\u22DA",
  7788. "lesseqqgtr;": "\u2A8B",
  7789. "LessEqualGreater;": "\u22DA",
  7790. "LessFullEqual;": "\u2266",
  7791. "LessGreater;": "\u2276",
  7792. "lessgtr;": "\u2276",
  7793. "LessLess;": "\u2AA1",
  7794. "lesssim;": "\u2272",
  7795. "LessSlantEqual;": "\u2A7D",
  7796. "LessTilde;": "\u2272",
  7797. "lfisht;": "\u297C",
  7798. "lfloor;": "\u230A",
  7799. "Lfr;": "\uD835\uDD0F",
  7800. "lfr;": "\uD835\uDD29",
  7801. "lg;": "\u2276",
  7802. "lgE;": "\u2A91",
  7803. "lHar;": "\u2962",
  7804. "lhard;": "\u21BD",
  7805. "lharu;": "\u21BC",
  7806. "lharul;": "\u296A",
  7807. "lhblk;": "\u2584",
  7808. "LJcy;": "\u0409",
  7809. "ljcy;": "\u0459",
  7810. "llarr;": "\u21C7",
  7811. "ll;": "\u226A",
  7812. "Ll;": "\u22D8",
  7813. "llcorner;": "\u231E",
  7814. "Lleftarrow;": "\u21DA",
  7815. "llhard;": "\u296B",
  7816. "lltri;": "\u25FA",
  7817. "Lmidot;": "\u013F",
  7818. "lmidot;": "\u0140",
  7819. "lmoustache;": "\u23B0",
  7820. "lmoust;": "\u23B0",
  7821. "lnap;": "\u2A89",
  7822. "lnapprox;": "\u2A89",
  7823. "lne;": "\u2A87",
  7824. "lnE;": "\u2268",
  7825. "lneq;": "\u2A87",
  7826. "lneqq;": "\u2268",
  7827. "lnsim;": "\u22E6",
  7828. "loang;": "\u27EC",
  7829. "loarr;": "\u21FD",
  7830. "lobrk;": "\u27E6",
  7831. "longleftarrow;": "\u27F5",
  7832. "LongLeftArrow;": "\u27F5",
  7833. "Longleftarrow;": "\u27F8",
  7834. "longleftrightarrow;": "\u27F7",
  7835. "LongLeftRightArrow;": "\u27F7",
  7836. "Longleftrightarrow;": "\u27FA",
  7837. "longmapsto;": "\u27FC",
  7838. "longrightarrow;": "\u27F6",
  7839. "LongRightArrow;": "\u27F6",
  7840. "Longrightarrow;": "\u27F9",
  7841. "looparrowleft;": "\u21AB",
  7842. "looparrowright;": "\u21AC",
  7843. "lopar;": "\u2985",
  7844. "Lopf;": "\uD835\uDD43",
  7845. "lopf;": "\uD835\uDD5D",
  7846. "loplus;": "\u2A2D",
  7847. "lotimes;": "\u2A34",
  7848. "lowast;": "\u2217",
  7849. "lowbar;": "\u005F",
  7850. "LowerLeftArrow;": "\u2199",
  7851. "LowerRightArrow;": "\u2198",
  7852. "loz;": "\u25CA",
  7853. "lozenge;": "\u25CA",
  7854. "lozf;": "\u29EB",
  7855. "lpar;": "\u0028",
  7856. "lparlt;": "\u2993",
  7857. "lrarr;": "\u21C6",
  7858. "lrcorner;": "\u231F",
  7859. "lrhar;": "\u21CB",
  7860. "lrhard;": "\u296D",
  7861. "lrm;": "\u200E",
  7862. "lrtri;": "\u22BF",
  7863. "lsaquo;": "\u2039",
  7864. "lscr;": "\uD835\uDCC1",
  7865. "Lscr;": "\u2112",
  7866. "lsh;": "\u21B0",
  7867. "Lsh;": "\u21B0",
  7868. "lsim;": "\u2272",
  7869. "lsime;": "\u2A8D",
  7870. "lsimg;": "\u2A8F",
  7871. "lsqb;": "\u005B",
  7872. "lsquo;": "\u2018",
  7873. "lsquor;": "\u201A",
  7874. "Lstrok;": "\u0141",
  7875. "lstrok;": "\u0142",
  7876. "ltcc;": "\u2AA6",
  7877. "ltcir;": "\u2A79",
  7878. "lt;": "\u003C",
  7879. "lt": "\u003C",
  7880. "LT;": "\u003C",
  7881. "LT": "\u003C",
  7882. "Lt;": "\u226A",
  7883. "ltdot;": "\u22D6",
  7884. "lthree;": "\u22CB",
  7885. "ltimes;": "\u22C9",
  7886. "ltlarr;": "\u2976",
  7887. "ltquest;": "\u2A7B",
  7888. "ltri;": "\u25C3",
  7889. "ltrie;": "\u22B4",
  7890. "ltrif;": "\u25C2",
  7891. "ltrPar;": "\u2996",
  7892. "lurdshar;": "\u294A",
  7893. "luruhar;": "\u2966",
  7894. "lvertneqq;": "\u2268\uFE00",
  7895. "lvnE;": "\u2268\uFE00",
  7896. "macr;": "\u00AF",
  7897. "macr": "\u00AF",
  7898. "male;": "\u2642",
  7899. "malt;": "\u2720",
  7900. "maltese;": "\u2720",
  7901. "Map;": "\u2905",
  7902. "map;": "\u21A6",
  7903. "mapsto;": "\u21A6",
  7904. "mapstodown;": "\u21A7",
  7905. "mapstoleft;": "\u21A4",
  7906. "mapstoup;": "\u21A5",
  7907. "marker;": "\u25AE",
  7908. "mcomma;": "\u2A29",
  7909. "Mcy;": "\u041C",
  7910. "mcy;": "\u043C",
  7911. "mdash;": "\u2014",
  7912. "mDDot;": "\u223A",
  7913. "measuredangle;": "\u2221",
  7914. "MediumSpace;": "\u205F",
  7915. "Mellintrf;": "\u2133",
  7916. "Mfr;": "\uD835\uDD10",
  7917. "mfr;": "\uD835\uDD2A",
  7918. "mho;": "\u2127",
  7919. "micro;": "\u00B5",
  7920. "micro": "\u00B5",
  7921. "midast;": "\u002A",
  7922. "midcir;": "\u2AF0",
  7923. "mid;": "\u2223",
  7924. "middot;": "\u00B7",
  7925. "middot": "\u00B7",
  7926. "minusb;": "\u229F",
  7927. "minus;": "\u2212",
  7928. "minusd;": "\u2238",
  7929. "minusdu;": "\u2A2A",
  7930. "MinusPlus;": "\u2213",
  7931. "mlcp;": "\u2ADB",
  7932. "mldr;": "\u2026",
  7933. "mnplus;": "\u2213",
  7934. "models;": "\u22A7",
  7935. "Mopf;": "\uD835\uDD44",
  7936. "mopf;": "\uD835\uDD5E",
  7937. "mp;": "\u2213",
  7938. "mscr;": "\uD835\uDCC2",
  7939. "Mscr;": "\u2133",
  7940. "mstpos;": "\u223E",
  7941. "Mu;": "\u039C",
  7942. "mu;": "\u03BC",
  7943. "multimap;": "\u22B8",
  7944. "mumap;": "\u22B8",
  7945. "nabla;": "\u2207",
  7946. "Nacute;": "\u0143",
  7947. "nacute;": "\u0144",
  7948. "nang;": "\u2220\u20D2",
  7949. "nap;": "\u2249",
  7950. "napE;": "\u2A70\u0338",
  7951. "napid;": "\u224B\u0338",
  7952. "napos;": "\u0149",
  7953. "napprox;": "\u2249",
  7954. "natural;": "\u266E",
  7955. "naturals;": "\u2115",
  7956. "natur;": "\u266E",
  7957. "nbsp;": "\u00A0",
  7958. "nbsp": "\u00A0",
  7959. "nbump;": "\u224E\u0338",
  7960. "nbumpe;": "\u224F\u0338",
  7961. "ncap;": "\u2A43",
  7962. "Ncaron;": "\u0147",
  7963. "ncaron;": "\u0148",
  7964. "Ncedil;": "\u0145",
  7965. "ncedil;": "\u0146",
  7966. "ncong;": "\u2247",
  7967. "ncongdot;": "\u2A6D\u0338",
  7968. "ncup;": "\u2A42",
  7969. "Ncy;": "\u041D",
  7970. "ncy;": "\u043D",
  7971. "ndash;": "\u2013",
  7972. "nearhk;": "\u2924",
  7973. "nearr;": "\u2197",
  7974. "neArr;": "\u21D7",
  7975. "nearrow;": "\u2197",
  7976. "ne;": "\u2260",
  7977. "nedot;": "\u2250\u0338",
  7978. "NegativeMediumSpace;": "\u200B",
  7979. "NegativeThickSpace;": "\u200B",
  7980. "NegativeThinSpace;": "\u200B",
  7981. "NegativeVeryThinSpace;": "\u200B",
  7982. "nequiv;": "\u2262",
  7983. "nesear;": "\u2928",
  7984. "nesim;": "\u2242\u0338",
  7985. "NestedGreaterGreater;": "\u226B",
  7986. "NestedLessLess;": "\u226A",
  7987. "NewLine;": "\u000A",
  7988. "nexist;": "\u2204",
  7989. "nexists;": "\u2204",
  7990. "Nfr;": "\uD835\uDD11",
  7991. "nfr;": "\uD835\uDD2B",
  7992. "ngE;": "\u2267\u0338",
  7993. "nge;": "\u2271",
  7994. "ngeq;": "\u2271",
  7995. "ngeqq;": "\u2267\u0338",
  7996. "ngeqslant;": "\u2A7E\u0338",
  7997. "nges;": "\u2A7E\u0338",
  7998. "nGg;": "\u22D9\u0338",
  7999. "ngsim;": "\u2275",
  8000. "nGt;": "\u226B\u20D2",
  8001. "ngt;": "\u226F",
  8002. "ngtr;": "\u226F",
  8003. "nGtv;": "\u226B\u0338",
  8004. "nharr;": "\u21AE",
  8005. "nhArr;": "\u21CE",
  8006. "nhpar;": "\u2AF2",
  8007. "ni;": "\u220B",
  8008. "nis;": "\u22FC",
  8009. "nisd;": "\u22FA",
  8010. "niv;": "\u220B",
  8011. "NJcy;": "\u040A",
  8012. "njcy;": "\u045A",
  8013. "nlarr;": "\u219A",
  8014. "nlArr;": "\u21CD",
  8015. "nldr;": "\u2025",
  8016. "nlE;": "\u2266\u0338",
  8017. "nle;": "\u2270",
  8018. "nleftarrow;": "\u219A",
  8019. "nLeftarrow;": "\u21CD",
  8020. "nleftrightarrow;": "\u21AE",
  8021. "nLeftrightarrow;": "\u21CE",
  8022. "nleq;": "\u2270",
  8023. "nleqq;": "\u2266\u0338",
  8024. "nleqslant;": "\u2A7D\u0338",
  8025. "nles;": "\u2A7D\u0338",
  8026. "nless;": "\u226E",
  8027. "nLl;": "\u22D8\u0338",
  8028. "nlsim;": "\u2274",
  8029. "nLt;": "\u226A\u20D2",
  8030. "nlt;": "\u226E",
  8031. "nltri;": "\u22EA",
  8032. "nltrie;": "\u22EC",
  8033. "nLtv;": "\u226A\u0338",
  8034. "nmid;": "\u2224",
  8035. "NoBreak;": "\u2060",
  8036. "NonBreakingSpace;": "\u00A0",
  8037. "nopf;": "\uD835\uDD5F",
  8038. "Nopf;": "\u2115",
  8039. "Not;": "\u2AEC",
  8040. "not;": "\u00AC",
  8041. "not": "\u00AC",
  8042. "NotCongruent;": "\u2262",
  8043. "NotCupCap;": "\u226D",
  8044. "NotDoubleVerticalBar;": "\u2226",
  8045. "NotElement;": "\u2209",
  8046. "NotEqual;": "\u2260",
  8047. "NotEqualTilde;": "\u2242\u0338",
  8048. "NotExists;": "\u2204",
  8049. "NotGreater;": "\u226F",
  8050. "NotGreaterEqual;": "\u2271",
  8051. "NotGreaterFullEqual;": "\u2267\u0338",
  8052. "NotGreaterGreater;": "\u226B\u0338",
  8053. "NotGreaterLess;": "\u2279",
  8054. "NotGreaterSlantEqual;": "\u2A7E\u0338",
  8055. "NotGreaterTilde;": "\u2275",
  8056. "NotHumpDownHump;": "\u224E\u0338",
  8057. "NotHumpEqual;": "\u224F\u0338",
  8058. "notin;": "\u2209",
  8059. "notindot;": "\u22F5\u0338",
  8060. "notinE;": "\u22F9\u0338",
  8061. "notinva;": "\u2209",
  8062. "notinvb;": "\u22F7",
  8063. "notinvc;": "\u22F6",
  8064. "NotLeftTriangleBar;": "\u29CF\u0338",
  8065. "NotLeftTriangle;": "\u22EA",
  8066. "NotLeftTriangleEqual;": "\u22EC",
  8067. "NotLess;": "\u226E",
  8068. "NotLessEqual;": "\u2270",
  8069. "NotLessGreater;": "\u2278",
  8070. "NotLessLess;": "\u226A\u0338",
  8071. "NotLessSlantEqual;": "\u2A7D\u0338",
  8072. "NotLessTilde;": "\u2274",
  8073. "NotNestedGreaterGreater;": "\u2AA2\u0338",
  8074. "NotNestedLessLess;": "\u2AA1\u0338",
  8075. "notni;": "\u220C",
  8076. "notniva;": "\u220C",
  8077. "notnivb;": "\u22FE",
  8078. "notnivc;": "\u22FD",
  8079. "NotPrecedes;": "\u2280",
  8080. "NotPrecedesEqual;": "\u2AAF\u0338",
  8081. "NotPrecedesSlantEqual;": "\u22E0",
  8082. "NotReverseElement;": "\u220C",
  8083. "NotRightTriangleBar;": "\u29D0\u0338",
  8084. "NotRightTriangle;": "\u22EB",
  8085. "NotRightTriangleEqual;": "\u22ED",
  8086. "NotSquareSubset;": "\u228F\u0338",
  8087. "NotSquareSubsetEqual;": "\u22E2",
  8088. "NotSquareSuperset;": "\u2290\u0338",
  8089. "NotSquareSupersetEqual;": "\u22E3",
  8090. "NotSubset;": "\u2282\u20D2",
  8091. "NotSubsetEqual;": "\u2288",
  8092. "NotSucceeds;": "\u2281",
  8093. "NotSucceedsEqual;": "\u2AB0\u0338",
  8094. "NotSucceedsSlantEqual;": "\u22E1",
  8095. "NotSucceedsTilde;": "\u227F\u0338",
  8096. "NotSuperset;": "\u2283\u20D2",
  8097. "NotSupersetEqual;": "\u2289",
  8098. "NotTilde;": "\u2241",
  8099. "NotTildeEqual;": "\u2244",
  8100. "NotTildeFullEqual;": "\u2247",
  8101. "NotTildeTilde;": "\u2249",
  8102. "NotVerticalBar;": "\u2224",
  8103. "nparallel;": "\u2226",
  8104. "npar;": "\u2226",
  8105. "nparsl;": "\u2AFD\u20E5",
  8106. "npart;": "\u2202\u0338",
  8107. "npolint;": "\u2A14",
  8108. "npr;": "\u2280",
  8109. "nprcue;": "\u22E0",
  8110. "nprec;": "\u2280",
  8111. "npreceq;": "\u2AAF\u0338",
  8112. "npre;": "\u2AAF\u0338",
  8113. "nrarrc;": "\u2933\u0338",
  8114. "nrarr;": "\u219B",
  8115. "nrArr;": "\u21CF",
  8116. "nrarrw;": "\u219D\u0338",
  8117. "nrightarrow;": "\u219B",
  8118. "nRightarrow;": "\u21CF",
  8119. "nrtri;": "\u22EB",
  8120. "nrtrie;": "\u22ED",
  8121. "nsc;": "\u2281",
  8122. "nsccue;": "\u22E1",
  8123. "nsce;": "\u2AB0\u0338",
  8124. "Nscr;": "\uD835\uDCA9",
  8125. "nscr;": "\uD835\uDCC3",
  8126. "nshortmid;": "\u2224",
  8127. "nshortparallel;": "\u2226",
  8128. "nsim;": "\u2241",
  8129. "nsime;": "\u2244",
  8130. "nsimeq;": "\u2244",
  8131. "nsmid;": "\u2224",
  8132. "nspar;": "\u2226",
  8133. "nsqsube;": "\u22E2",
  8134. "nsqsupe;": "\u22E3",
  8135. "nsub;": "\u2284",
  8136. "nsubE;": "\u2AC5\u0338",
  8137. "nsube;": "\u2288",
  8138. "nsubset;": "\u2282\u20D2",
  8139. "nsubseteq;": "\u2288",
  8140. "nsubseteqq;": "\u2AC5\u0338",
  8141. "nsucc;": "\u2281",
  8142. "nsucceq;": "\u2AB0\u0338",
  8143. "nsup;": "\u2285",
  8144. "nsupE;": "\u2AC6\u0338",
  8145. "nsupe;": "\u2289",
  8146. "nsupset;": "\u2283\u20D2",
  8147. "nsupseteq;": "\u2289",
  8148. "nsupseteqq;": "\u2AC6\u0338",
  8149. "ntgl;": "\u2279",
  8150. "Ntilde;": "\u00D1",
  8151. "Ntilde": "\u00D1",
  8152. "ntilde;": "\u00F1",
  8153. "ntilde": "\u00F1",
  8154. "ntlg;": "\u2278",
  8155. "ntriangleleft;": "\u22EA",
  8156. "ntrianglelefteq;": "\u22EC",
  8157. "ntriangleright;": "\u22EB",
  8158. "ntrianglerighteq;": "\u22ED",
  8159. "Nu;": "\u039D",
  8160. "nu;": "\u03BD",
  8161. "num;": "\u0023",
  8162. "numero;": "\u2116",
  8163. "numsp;": "\u2007",
  8164. "nvap;": "\u224D\u20D2",
  8165. "nvdash;": "\u22AC",
  8166. "nvDash;": "\u22AD",
  8167. "nVdash;": "\u22AE",
  8168. "nVDash;": "\u22AF",
  8169. "nvge;": "\u2265\u20D2",
  8170. "nvgt;": "\u003E\u20D2",
  8171. "nvHarr;": "\u2904",
  8172. "nvinfin;": "\u29DE",
  8173. "nvlArr;": "\u2902",
  8174. "nvle;": "\u2264\u20D2",
  8175. "nvlt;": "\u003C\u20D2",
  8176. "nvltrie;": "\u22B4\u20D2",
  8177. "nvrArr;": "\u2903",
  8178. "nvrtrie;": "\u22B5\u20D2",
  8179. "nvsim;": "\u223C\u20D2",
  8180. "nwarhk;": "\u2923",
  8181. "nwarr;": "\u2196",
  8182. "nwArr;": "\u21D6",
  8183. "nwarrow;": "\u2196",
  8184. "nwnear;": "\u2927",
  8185. "Oacute;": "\u00D3",
  8186. "Oacute": "\u00D3",
  8187. "oacute;": "\u00F3",
  8188. "oacute": "\u00F3",
  8189. "oast;": "\u229B",
  8190. "Ocirc;": "\u00D4",
  8191. "Ocirc": "\u00D4",
  8192. "ocirc;": "\u00F4",
  8193. "ocirc": "\u00F4",
  8194. "ocir;": "\u229A",
  8195. "Ocy;": "\u041E",
  8196. "ocy;": "\u043E",
  8197. "odash;": "\u229D",
  8198. "Odblac;": "\u0150",
  8199. "odblac;": "\u0151",
  8200. "odiv;": "\u2A38",
  8201. "odot;": "\u2299",
  8202. "odsold;": "\u29BC",
  8203. "OElig;": "\u0152",
  8204. "oelig;": "\u0153",
  8205. "ofcir;": "\u29BF",
  8206. "Ofr;": "\uD835\uDD12",
  8207. "ofr;": "\uD835\uDD2C",
  8208. "ogon;": "\u02DB",
  8209. "Ograve;": "\u00D2",
  8210. "Ograve": "\u00D2",
  8211. "ograve;": "\u00F2",
  8212. "ograve": "\u00F2",
  8213. "ogt;": "\u29C1",
  8214. "ohbar;": "\u29B5",
  8215. "ohm;": "\u03A9",
  8216. "oint;": "\u222E",
  8217. "olarr;": "\u21BA",
  8218. "olcir;": "\u29BE",
  8219. "olcross;": "\u29BB",
  8220. "oline;": "\u203E",
  8221. "olt;": "\u29C0",
  8222. "Omacr;": "\u014C",
  8223. "omacr;": "\u014D",
  8224. "Omega;": "\u03A9",
  8225. "omega;": "\u03C9",
  8226. "Omicron;": "\u039F",
  8227. "omicron;": "\u03BF",
  8228. "omid;": "\u29B6",
  8229. "ominus;": "\u2296",
  8230. "Oopf;": "\uD835\uDD46",
  8231. "oopf;": "\uD835\uDD60",
  8232. "opar;": "\u29B7",
  8233. "OpenCurlyDoubleQuote;": "\u201C",
  8234. "OpenCurlyQuote;": "\u2018",
  8235. "operp;": "\u29B9",
  8236. "oplus;": "\u2295",
  8237. "orarr;": "\u21BB",
  8238. "Or;": "\u2A54",
  8239. "or;": "\u2228",
  8240. "ord;": "\u2A5D",
  8241. "order;": "\u2134",
  8242. "orderof;": "\u2134",
  8243. "ordf;": "\u00AA",
  8244. "ordf": "\u00AA",
  8245. "ordm;": "\u00BA",
  8246. "ordm": "\u00BA",
  8247. "origof;": "\u22B6",
  8248. "oror;": "\u2A56",
  8249. "orslope;": "\u2A57",
  8250. "orv;": "\u2A5B",
  8251. "oS;": "\u24C8",
  8252. "Oscr;": "\uD835\uDCAA",
  8253. "oscr;": "\u2134",
  8254. "Oslash;": "\u00D8",
  8255. "Oslash": "\u00D8",
  8256. "oslash;": "\u00F8",
  8257. "oslash": "\u00F8",
  8258. "osol;": "\u2298",
  8259. "Otilde;": "\u00D5",
  8260. "Otilde": "\u00D5",
  8261. "otilde;": "\u00F5",
  8262. "otilde": "\u00F5",
  8263. "otimesas;": "\u2A36",
  8264. "Otimes;": "\u2A37",
  8265. "otimes;": "\u2297",
  8266. "Ouml;": "\u00D6",
  8267. "Ouml": "\u00D6",
  8268. "ouml;": "\u00F6",
  8269. "ouml": "\u00F6",
  8270. "ovbar;": "\u233D",
  8271. "OverBar;": "\u203E",
  8272. "OverBrace;": "\u23DE",
  8273. "OverBracket;": "\u23B4",
  8274. "OverParenthesis;": "\u23DC",
  8275. "para;": "\u00B6",
  8276. "para": "\u00B6",
  8277. "parallel;": "\u2225",
  8278. "par;": "\u2225",
  8279. "parsim;": "\u2AF3",
  8280. "parsl;": "\u2AFD",
  8281. "part;": "\u2202",
  8282. "PartialD;": "\u2202",
  8283. "Pcy;": "\u041F",
  8284. "pcy;": "\u043F",
  8285. "percnt;": "\u0025",
  8286. "period;": "\u002E",
  8287. "permil;": "\u2030",
  8288. "perp;": "\u22A5",
  8289. "pertenk;": "\u2031",
  8290. "Pfr;": "\uD835\uDD13",
  8291. "pfr;": "\uD835\uDD2D",
  8292. "Phi;": "\u03A6",
  8293. "phi;": "\u03C6",
  8294. "phiv;": "\u03D5",
  8295. "phmmat;": "\u2133",
  8296. "phone;": "\u260E",
  8297. "Pi;": "\u03A0",
  8298. "pi;": "\u03C0",
  8299. "pitchfork;": "\u22D4",
  8300. "piv;": "\u03D6",
  8301. "planck;": "\u210F",
  8302. "planckh;": "\u210E",
  8303. "plankv;": "\u210F",
  8304. "plusacir;": "\u2A23",
  8305. "plusb;": "\u229E",
  8306. "pluscir;": "\u2A22",
  8307. "plus;": "\u002B",
  8308. "plusdo;": "\u2214",
  8309. "plusdu;": "\u2A25",
  8310. "pluse;": "\u2A72",
  8311. "PlusMinus;": "\u00B1",
  8312. "plusmn;": "\u00B1",
  8313. "plusmn": "\u00B1",
  8314. "plussim;": "\u2A26",
  8315. "plustwo;": "\u2A27",
  8316. "pm;": "\u00B1",
  8317. "Poincareplane;": "\u210C",
  8318. "pointint;": "\u2A15",
  8319. "popf;": "\uD835\uDD61",
  8320. "Popf;": "\u2119",
  8321. "pound;": "\u00A3",
  8322. "pound": "\u00A3",
  8323. "prap;": "\u2AB7",
  8324. "Pr;": "\u2ABB",
  8325. "pr;": "\u227A",
  8326. "prcue;": "\u227C",
  8327. "precapprox;": "\u2AB7",
  8328. "prec;": "\u227A",
  8329. "preccurlyeq;": "\u227C",
  8330. "Precedes;": "\u227A",
  8331. "PrecedesEqual;": "\u2AAF",
  8332. "PrecedesSlantEqual;": "\u227C",
  8333. "PrecedesTilde;": "\u227E",
  8334. "preceq;": "\u2AAF",
  8335. "precnapprox;": "\u2AB9",
  8336. "precneqq;": "\u2AB5",
  8337. "precnsim;": "\u22E8",
  8338. "pre;": "\u2AAF",
  8339. "prE;": "\u2AB3",
  8340. "precsim;": "\u227E",
  8341. "prime;": "\u2032",
  8342. "Prime;": "\u2033",
  8343. "primes;": "\u2119",
  8344. "prnap;": "\u2AB9",
  8345. "prnE;": "\u2AB5",
  8346. "prnsim;": "\u22E8",
  8347. "prod;": "\u220F",
  8348. "Product;": "\u220F",
  8349. "profalar;": "\u232E",
  8350. "profline;": "\u2312",
  8351. "profsurf;": "\u2313",
  8352. "prop;": "\u221D",
  8353. "Proportional;": "\u221D",
  8354. "Proportion;": "\u2237",
  8355. "propto;": "\u221D",
  8356. "prsim;": "\u227E",
  8357. "prurel;": "\u22B0",
  8358. "Pscr;": "\uD835\uDCAB",
  8359. "pscr;": "\uD835\uDCC5",
  8360. "Psi;": "\u03A8",
  8361. "psi;": "\u03C8",
  8362. "puncsp;": "\u2008",
  8363. "Qfr;": "\uD835\uDD14",
  8364. "qfr;": "\uD835\uDD2E",
  8365. "qint;": "\u2A0C",
  8366. "qopf;": "\uD835\uDD62",
  8367. "Qopf;": "\u211A",
  8368. "qprime;": "\u2057",
  8369. "Qscr;": "\uD835\uDCAC",
  8370. "qscr;": "\uD835\uDCC6",
  8371. "quaternions;": "\u210D",
  8372. "quatint;": "\u2A16",
  8373. "quest;": "\u003F",
  8374. "questeq;": "\u225F",
  8375. "quot;": "\u0022",
  8376. "quot": "\u0022",
  8377. "QUOT;": "\u0022",
  8378. "QUOT": "\u0022",
  8379. "rAarr;": "\u21DB",
  8380. "race;": "\u223D\u0331",
  8381. "Racute;": "\u0154",
  8382. "racute;": "\u0155",
  8383. "radic;": "\u221A",
  8384. "raemptyv;": "\u29B3",
  8385. "rang;": "\u27E9",
  8386. "Rang;": "\u27EB",
  8387. "rangd;": "\u2992",
  8388. "range;": "\u29A5",
  8389. "rangle;": "\u27E9",
  8390. "raquo;": "\u00BB",
  8391. "raquo": "\u00BB",
  8392. "rarrap;": "\u2975",
  8393. "rarrb;": "\u21E5",
  8394. "rarrbfs;": "\u2920",
  8395. "rarrc;": "\u2933",
  8396. "rarr;": "\u2192",
  8397. "Rarr;": "\u21A0",
  8398. "rArr;": "\u21D2",
  8399. "rarrfs;": "\u291E",
  8400. "rarrhk;": "\u21AA",
  8401. "rarrlp;": "\u21AC",
  8402. "rarrpl;": "\u2945",
  8403. "rarrsim;": "\u2974",
  8404. "Rarrtl;": "\u2916",
  8405. "rarrtl;": "\u21A3",
  8406. "rarrw;": "\u219D",
  8407. "ratail;": "\u291A",
  8408. "rAtail;": "\u291C",
  8409. "ratio;": "\u2236",
  8410. "rationals;": "\u211A",
  8411. "rbarr;": "\u290D",
  8412. "rBarr;": "\u290F",
  8413. "RBarr;": "\u2910",
  8414. "rbbrk;": "\u2773",
  8415. "rbrace;": "\u007D",
  8416. "rbrack;": "\u005D",
  8417. "rbrke;": "\u298C",
  8418. "rbrksld;": "\u298E",
  8419. "rbrkslu;": "\u2990",
  8420. "Rcaron;": "\u0158",
  8421. "rcaron;": "\u0159",
  8422. "Rcedil;": "\u0156",
  8423. "rcedil;": "\u0157",
  8424. "rceil;": "\u2309",
  8425. "rcub;": "\u007D",
  8426. "Rcy;": "\u0420",
  8427. "rcy;": "\u0440",
  8428. "rdca;": "\u2937",
  8429. "rdldhar;": "\u2969",
  8430. "rdquo;": "\u201D",
  8431. "rdquor;": "\u201D",
  8432. "rdsh;": "\u21B3",
  8433. "real;": "\u211C",
  8434. "realine;": "\u211B",
  8435. "realpart;": "\u211C",
  8436. "reals;": "\u211D",
  8437. "Re;": "\u211C",
  8438. "rect;": "\u25AD",
  8439. "reg;": "\u00AE",
  8440. "reg": "\u00AE",
  8441. "REG;": "\u00AE",
  8442. "REG": "\u00AE",
  8443. "ReverseElement;": "\u220B",
  8444. "ReverseEquilibrium;": "\u21CB",
  8445. "ReverseUpEquilibrium;": "\u296F",
  8446. "rfisht;": "\u297D",
  8447. "rfloor;": "\u230B",
  8448. "rfr;": "\uD835\uDD2F",
  8449. "Rfr;": "\u211C",
  8450. "rHar;": "\u2964",
  8451. "rhard;": "\u21C1",
  8452. "rharu;": "\u21C0",
  8453. "rharul;": "\u296C",
  8454. "Rho;": "\u03A1",
  8455. "rho;": "\u03C1",
  8456. "rhov;": "\u03F1",
  8457. "RightAngleBracket;": "\u27E9",
  8458. "RightArrowBar;": "\u21E5",
  8459. "rightarrow;": "\u2192",
  8460. "RightArrow;": "\u2192",
  8461. "Rightarrow;": "\u21D2",
  8462. "RightArrowLeftArrow;": "\u21C4",
  8463. "rightarrowtail;": "\u21A3",
  8464. "RightCeiling;": "\u2309",
  8465. "RightDoubleBracket;": "\u27E7",
  8466. "RightDownTeeVector;": "\u295D",
  8467. "RightDownVectorBar;": "\u2955",
  8468. "RightDownVector;": "\u21C2",
  8469. "RightFloor;": "\u230B",
  8470. "rightharpoondown;": "\u21C1",
  8471. "rightharpoonup;": "\u21C0",
  8472. "rightleftarrows;": "\u21C4",
  8473. "rightleftharpoons;": "\u21CC",
  8474. "rightrightarrows;": "\u21C9",
  8475. "rightsquigarrow;": "\u219D",
  8476. "RightTeeArrow;": "\u21A6",
  8477. "RightTee;": "\u22A2",
  8478. "RightTeeVector;": "\u295B",
  8479. "rightthreetimes;": "\u22CC",
  8480. "RightTriangleBar;": "\u29D0",
  8481. "RightTriangle;": "\u22B3",
  8482. "RightTriangleEqual;": "\u22B5",
  8483. "RightUpDownVector;": "\u294F",
  8484. "RightUpTeeVector;": "\u295C",
  8485. "RightUpVectorBar;": "\u2954",
  8486. "RightUpVector;": "\u21BE",
  8487. "RightVectorBar;": "\u2953",
  8488. "RightVector;": "\u21C0",
  8489. "ring;": "\u02DA",
  8490. "risingdotseq;": "\u2253",
  8491. "rlarr;": "\u21C4",
  8492. "rlhar;": "\u21CC",
  8493. "rlm;": "\u200F",
  8494. "rmoustache;": "\u23B1",
  8495. "rmoust;": "\u23B1",
  8496. "rnmid;": "\u2AEE",
  8497. "roang;": "\u27ED",
  8498. "roarr;": "\u21FE",
  8499. "robrk;": "\u27E7",
  8500. "ropar;": "\u2986",
  8501. "ropf;": "\uD835\uDD63",
  8502. "Ropf;": "\u211D",
  8503. "roplus;": "\u2A2E",
  8504. "rotimes;": "\u2A35",
  8505. "RoundImplies;": "\u2970",
  8506. "rpar;": "\u0029",
  8507. "rpargt;": "\u2994",
  8508. "rppolint;": "\u2A12",
  8509. "rrarr;": "\u21C9",
  8510. "Rrightarrow;": "\u21DB",
  8511. "rsaquo;": "\u203A",
  8512. "rscr;": "\uD835\uDCC7",
  8513. "Rscr;": "\u211B",
  8514. "rsh;": "\u21B1",
  8515. "Rsh;": "\u21B1",
  8516. "rsqb;": "\u005D",
  8517. "rsquo;": "\u2019",
  8518. "rsquor;": "\u2019",
  8519. "rthree;": "\u22CC",
  8520. "rtimes;": "\u22CA",
  8521. "rtri;": "\u25B9",
  8522. "rtrie;": "\u22B5",
  8523. "rtrif;": "\u25B8",
  8524. "rtriltri;": "\u29CE",
  8525. "RuleDelayed;": "\u29F4",
  8526. "ruluhar;": "\u2968",
  8527. "rx;": "\u211E",
  8528. "Sacute;": "\u015A",
  8529. "sacute;": "\u015B",
  8530. "sbquo;": "\u201A",
  8531. "scap;": "\u2AB8",
  8532. "Scaron;": "\u0160",
  8533. "scaron;": "\u0161",
  8534. "Sc;": "\u2ABC",
  8535. "sc;": "\u227B",
  8536. "sccue;": "\u227D",
  8537. "sce;": "\u2AB0",
  8538. "scE;": "\u2AB4",
  8539. "Scedil;": "\u015E",
  8540. "scedil;": "\u015F",
  8541. "Scirc;": "\u015C",
  8542. "scirc;": "\u015D",
  8543. "scnap;": "\u2ABA",
  8544. "scnE;": "\u2AB6",
  8545. "scnsim;": "\u22E9",
  8546. "scpolint;": "\u2A13",
  8547. "scsim;": "\u227F",
  8548. "Scy;": "\u0421",
  8549. "scy;": "\u0441",
  8550. "sdotb;": "\u22A1",
  8551. "sdot;": "\u22C5",
  8552. "sdote;": "\u2A66",
  8553. "searhk;": "\u2925",
  8554. "searr;": "\u2198",
  8555. "seArr;": "\u21D8",
  8556. "searrow;": "\u2198",
  8557. "sect;": "\u00A7",
  8558. "sect": "\u00A7",
  8559. "semi;": "\u003B",
  8560. "seswar;": "\u2929",
  8561. "setminus;": "\u2216",
  8562. "setmn;": "\u2216",
  8563. "sext;": "\u2736",
  8564. "Sfr;": "\uD835\uDD16",
  8565. "sfr;": "\uD835\uDD30",
  8566. "sfrown;": "\u2322",
  8567. "sharp;": "\u266F",
  8568. "SHCHcy;": "\u0429",
  8569. "shchcy;": "\u0449",
  8570. "SHcy;": "\u0428",
  8571. "shcy;": "\u0448",
  8572. "ShortDownArrow;": "\u2193",
  8573. "ShortLeftArrow;": "\u2190",
  8574. "shortmid;": "\u2223",
  8575. "shortparallel;": "\u2225",
  8576. "ShortRightArrow;": "\u2192",
  8577. "ShortUpArrow;": "\u2191",
  8578. "shy;": "\u00AD",
  8579. "shy": "\u00AD",
  8580. "Sigma;": "\u03A3",
  8581. "sigma;": "\u03C3",
  8582. "sigmaf;": "\u03C2",
  8583. "sigmav;": "\u03C2",
  8584. "sim;": "\u223C",
  8585. "simdot;": "\u2A6A",
  8586. "sime;": "\u2243",
  8587. "simeq;": "\u2243",
  8588. "simg;": "\u2A9E",
  8589. "simgE;": "\u2AA0",
  8590. "siml;": "\u2A9D",
  8591. "simlE;": "\u2A9F",
  8592. "simne;": "\u2246",
  8593. "simplus;": "\u2A24",
  8594. "simrarr;": "\u2972",
  8595. "slarr;": "\u2190",
  8596. "SmallCircle;": "\u2218",
  8597. "smallsetminus;": "\u2216",
  8598. "smashp;": "\u2A33",
  8599. "smeparsl;": "\u29E4",
  8600. "smid;": "\u2223",
  8601. "smile;": "\u2323",
  8602. "smt;": "\u2AAA",
  8603. "smte;": "\u2AAC",
  8604. "smtes;": "\u2AAC\uFE00",
  8605. "SOFTcy;": "\u042C",
  8606. "softcy;": "\u044C",
  8607. "solbar;": "\u233F",
  8608. "solb;": "\u29C4",
  8609. "sol;": "\u002F",
  8610. "Sopf;": "\uD835\uDD4A",
  8611. "sopf;": "\uD835\uDD64",
  8612. "spades;": "\u2660",
  8613. "spadesuit;": "\u2660",
  8614. "spar;": "\u2225",
  8615. "sqcap;": "\u2293",
  8616. "sqcaps;": "\u2293\uFE00",
  8617. "sqcup;": "\u2294",
  8618. "sqcups;": "\u2294\uFE00",
  8619. "Sqrt;": "\u221A",
  8620. "sqsub;": "\u228F",
  8621. "sqsube;": "\u2291",
  8622. "sqsubset;": "\u228F",
  8623. "sqsubseteq;": "\u2291",
  8624. "sqsup;": "\u2290",
  8625. "sqsupe;": "\u2292",
  8626. "sqsupset;": "\u2290",
  8627. "sqsupseteq;": "\u2292",
  8628. "square;": "\u25A1",
  8629. "Square;": "\u25A1",
  8630. "SquareIntersection;": "\u2293",
  8631. "SquareSubset;": "\u228F",
  8632. "SquareSubsetEqual;": "\u2291",
  8633. "SquareSuperset;": "\u2290",
  8634. "SquareSupersetEqual;": "\u2292",
  8635. "SquareUnion;": "\u2294",
  8636. "squarf;": "\u25AA",
  8637. "squ;": "\u25A1",
  8638. "squf;": "\u25AA",
  8639. "srarr;": "\u2192",
  8640. "Sscr;": "\uD835\uDCAE",
  8641. "sscr;": "\uD835\uDCC8",
  8642. "ssetmn;": "\u2216",
  8643. "ssmile;": "\u2323",
  8644. "sstarf;": "\u22C6",
  8645. "Star;": "\u22C6",
  8646. "star;": "\u2606",
  8647. "starf;": "\u2605",
  8648. "straightepsilon;": "\u03F5",
  8649. "straightphi;": "\u03D5",
  8650. "strns;": "\u00AF",
  8651. "sub;": "\u2282",
  8652. "Sub;": "\u22D0",
  8653. "subdot;": "\u2ABD",
  8654. "subE;": "\u2AC5",
  8655. "sube;": "\u2286",
  8656. "subedot;": "\u2AC3",
  8657. "submult;": "\u2AC1",
  8658. "subnE;": "\u2ACB",
  8659. "subne;": "\u228A",
  8660. "subplus;": "\u2ABF",
  8661. "subrarr;": "\u2979",
  8662. "subset;": "\u2282",
  8663. "Subset;": "\u22D0",
  8664. "subseteq;": "\u2286",
  8665. "subseteqq;": "\u2AC5",
  8666. "SubsetEqual;": "\u2286",
  8667. "subsetneq;": "\u228A",
  8668. "subsetneqq;": "\u2ACB",
  8669. "subsim;": "\u2AC7",
  8670. "subsub;": "\u2AD5",
  8671. "subsup;": "\u2AD3",
  8672. "succapprox;": "\u2AB8",
  8673. "succ;": "\u227B",
  8674. "succcurlyeq;": "\u227D",
  8675. "Succeeds;": "\u227B",
  8676. "SucceedsEqual;": "\u2AB0",
  8677. "SucceedsSlantEqual;": "\u227D",
  8678. "SucceedsTilde;": "\u227F",
  8679. "succeq;": "\u2AB0",
  8680. "succnapprox;": "\u2ABA",
  8681. "succneqq;": "\u2AB6",
  8682. "succnsim;": "\u22E9",
  8683. "succsim;": "\u227F",
  8684. "SuchThat;": "\u220B",
  8685. "sum;": "\u2211",
  8686. "Sum;": "\u2211",
  8687. "sung;": "\u266A",
  8688. "sup1;": "\u00B9",
  8689. "sup1": "\u00B9",
  8690. "sup2;": "\u00B2",
  8691. "sup2": "\u00B2",
  8692. "sup3;": "\u00B3",
  8693. "sup3": "\u00B3",
  8694. "sup;": "\u2283",
  8695. "Sup;": "\u22D1",
  8696. "supdot;": "\u2ABE",
  8697. "supdsub;": "\u2AD8",
  8698. "supE;": "\u2AC6",
  8699. "supe;": "\u2287",
  8700. "supedot;": "\u2AC4",
  8701. "Superset;": "\u2283",
  8702. "SupersetEqual;": "\u2287",
  8703. "suphsol;": "\u27C9",
  8704. "suphsub;": "\u2AD7",
  8705. "suplarr;": "\u297B",
  8706. "supmult;": "\u2AC2",
  8707. "supnE;": "\u2ACC",
  8708. "supne;": "\u228B",
  8709. "supplus;": "\u2AC0",
  8710. "supset;": "\u2283",
  8711. "Supset;": "\u22D1",
  8712. "supseteq;": "\u2287",
  8713. "supseteqq;": "\u2AC6",
  8714. "supsetneq;": "\u228B",
  8715. "supsetneqq;": "\u2ACC",
  8716. "supsim;": "\u2AC8",
  8717. "supsub;": "\u2AD4",
  8718. "supsup;": "\u2AD6",
  8719. "swarhk;": "\u2926",
  8720. "swarr;": "\u2199",
  8721. "swArr;": "\u21D9",
  8722. "swarrow;": "\u2199",
  8723. "swnwar;": "\u292A",
  8724. "szlig;": "\u00DF",
  8725. "szlig": "\u00DF",
  8726. "Tab;": "\u0009",
  8727. "target;": "\u2316",
  8728. "Tau;": "\u03A4",
  8729. "tau;": "\u03C4",
  8730. "tbrk;": "\u23B4",
  8731. "Tcaron;": "\u0164",
  8732. "tcaron;": "\u0165",
  8733. "Tcedil;": "\u0162",
  8734. "tcedil;": "\u0163",
  8735. "Tcy;": "\u0422",
  8736. "tcy;": "\u0442",
  8737. "tdot;": "\u20DB",
  8738. "telrec;": "\u2315",
  8739. "Tfr;": "\uD835\uDD17",
  8740. "tfr;": "\uD835\uDD31",
  8741. "there4;": "\u2234",
  8742. "therefore;": "\u2234",
  8743. "Therefore;": "\u2234",
  8744. "Theta;": "\u0398",
  8745. "theta;": "\u03B8",
  8746. "thetasym;": "\u03D1",
  8747. "thetav;": "\u03D1",
  8748. "thickapprox;": "\u2248",
  8749. "thicksim;": "\u223C",
  8750. "ThickSpace;": "\u205F\u200A",
  8751. "ThinSpace;": "\u2009",
  8752. "thinsp;": "\u2009",
  8753. "thkap;": "\u2248",
  8754. "thksim;": "\u223C",
  8755. "THORN;": "\u00DE",
  8756. "THORN": "\u00DE",
  8757. "thorn;": "\u00FE",
  8758. "thorn": "\u00FE",
  8759. "tilde;": "\u02DC",
  8760. "Tilde;": "\u223C",
  8761. "TildeEqual;": "\u2243",
  8762. "TildeFullEqual;": "\u2245",
  8763. "TildeTilde;": "\u2248",
  8764. "timesbar;": "\u2A31",
  8765. "timesb;": "\u22A0",
  8766. "times;": "\u00D7",
  8767. "times": "\u00D7",
  8768. "timesd;": "\u2A30",
  8769. "tint;": "\u222D",
  8770. "toea;": "\u2928",
  8771. "topbot;": "\u2336",
  8772. "topcir;": "\u2AF1",
  8773. "top;": "\u22A4",
  8774. "Topf;": "\uD835\uDD4B",
  8775. "topf;": "\uD835\uDD65",
  8776. "topfork;": "\u2ADA",
  8777. "tosa;": "\u2929",
  8778. "tprime;": "\u2034",
  8779. "trade;": "\u2122",
  8780. "TRADE;": "\u2122",
  8781. "triangle;": "\u25B5",
  8782. "triangledown;": "\u25BF",
  8783. "triangleleft;": "\u25C3",
  8784. "trianglelefteq;": "\u22B4",
  8785. "triangleq;": "\u225C",
  8786. "triangleright;": "\u25B9",
  8787. "trianglerighteq;": "\u22B5",
  8788. "tridot;": "\u25EC",
  8789. "trie;": "\u225C",
  8790. "triminus;": "\u2A3A",
  8791. "TripleDot;": "\u20DB",
  8792. "triplus;": "\u2A39",
  8793. "trisb;": "\u29CD",
  8794. "tritime;": "\u2A3B",
  8795. "trpezium;": "\u23E2",
  8796. "Tscr;": "\uD835\uDCAF",
  8797. "tscr;": "\uD835\uDCC9",
  8798. "TScy;": "\u0426",
  8799. "tscy;": "\u0446",
  8800. "TSHcy;": "\u040B",
  8801. "tshcy;": "\u045B",
  8802. "Tstrok;": "\u0166",
  8803. "tstrok;": "\u0167",
  8804. "twixt;": "\u226C",
  8805. "twoheadleftarrow;": "\u219E",
  8806. "twoheadrightarrow;": "\u21A0",
  8807. "Uacute;": "\u00DA",
  8808. "Uacute": "\u00DA",
  8809. "uacute;": "\u00FA",
  8810. "uacute": "\u00FA",
  8811. "uarr;": "\u2191",
  8812. "Uarr;": "\u219F",
  8813. "uArr;": "\u21D1",
  8814. "Uarrocir;": "\u2949",
  8815. "Ubrcy;": "\u040E",
  8816. "ubrcy;": "\u045E",
  8817. "Ubreve;": "\u016C",
  8818. "ubreve;": "\u016D",
  8819. "Ucirc;": "\u00DB",
  8820. "Ucirc": "\u00DB",
  8821. "ucirc;": "\u00FB",
  8822. "ucirc": "\u00FB",
  8823. "Ucy;": "\u0423",
  8824. "ucy;": "\u0443",
  8825. "udarr;": "\u21C5",
  8826. "Udblac;": "\u0170",
  8827. "udblac;": "\u0171",
  8828. "udhar;": "\u296E",
  8829. "ufisht;": "\u297E",
  8830. "Ufr;": "\uD835\uDD18",
  8831. "ufr;": "\uD835\uDD32",
  8832. "Ugrave;": "\u00D9",
  8833. "Ugrave": "\u00D9",
  8834. "ugrave;": "\u00F9",
  8835. "ugrave": "\u00F9",
  8836. "uHar;": "\u2963",
  8837. "uharl;": "\u21BF",
  8838. "uharr;": "\u21BE",
  8839. "uhblk;": "\u2580",
  8840. "ulcorn;": "\u231C",
  8841. "ulcorner;": "\u231C",
  8842. "ulcrop;": "\u230F",
  8843. "ultri;": "\u25F8",
  8844. "Umacr;": "\u016A",
  8845. "umacr;": "\u016B",
  8846. "uml;": "\u00A8",
  8847. "uml": "\u00A8",
  8848. "UnderBar;": "\u005F",
  8849. "UnderBrace;": "\u23DF",
  8850. "UnderBracket;": "\u23B5",
  8851. "UnderParenthesis;": "\u23DD",
  8852. "Union;": "\u22C3",
  8853. "UnionPlus;": "\u228E",
  8854. "Uogon;": "\u0172",
  8855. "uogon;": "\u0173",
  8856. "Uopf;": "\uD835\uDD4C",
  8857. "uopf;": "\uD835\uDD66",
  8858. "UpArrowBar;": "\u2912",
  8859. "uparrow;": "\u2191",
  8860. "UpArrow;": "\u2191",
  8861. "Uparrow;": "\u21D1",
  8862. "UpArrowDownArrow;": "\u21C5",
  8863. "updownarrow;": "\u2195",
  8864. "UpDownArrow;": "\u2195",
  8865. "Updownarrow;": "\u21D5",
  8866. "UpEquilibrium;": "\u296E",
  8867. "upharpoonleft;": "\u21BF",
  8868. "upharpoonright;": "\u21BE",
  8869. "uplus;": "\u228E",
  8870. "UpperLeftArrow;": "\u2196",
  8871. "UpperRightArrow;": "\u2197",
  8872. "upsi;": "\u03C5",
  8873. "Upsi;": "\u03D2",
  8874. "upsih;": "\u03D2",
  8875. "Upsilon;": "\u03A5",
  8876. "upsilon;": "\u03C5",
  8877. "UpTeeArrow;": "\u21A5",
  8878. "UpTee;": "\u22A5",
  8879. "upuparrows;": "\u21C8",
  8880. "urcorn;": "\u231D",
  8881. "urcorner;": "\u231D",
  8882. "urcrop;": "\u230E",
  8883. "Uring;": "\u016E",
  8884. "uring;": "\u016F",
  8885. "urtri;": "\u25F9",
  8886. "Uscr;": "\uD835\uDCB0",
  8887. "uscr;": "\uD835\uDCCA",
  8888. "utdot;": "\u22F0",
  8889. "Utilde;": "\u0168",
  8890. "utilde;": "\u0169",
  8891. "utri;": "\u25B5",
  8892. "utrif;": "\u25B4",
  8893. "uuarr;": "\u21C8",
  8894. "Uuml;": "\u00DC",
  8895. "Uuml": "\u00DC",
  8896. "uuml;": "\u00FC",
  8897. "uuml": "\u00FC",
  8898. "uwangle;": "\u29A7",
  8899. "vangrt;": "\u299C",
  8900. "varepsilon;": "\u03F5",
  8901. "varkappa;": "\u03F0",
  8902. "varnothing;": "\u2205",
  8903. "varphi;": "\u03D5",
  8904. "varpi;": "\u03D6",
  8905. "varpropto;": "\u221D",
  8906. "varr;": "\u2195",
  8907. "vArr;": "\u21D5",
  8908. "varrho;": "\u03F1",
  8909. "varsigma;": "\u03C2",
  8910. "varsubsetneq;": "\u228A\uFE00",
  8911. "varsubsetneqq;": "\u2ACB\uFE00",
  8912. "varsupsetneq;": "\u228B\uFE00",
  8913. "varsupsetneqq;": "\u2ACC\uFE00",
  8914. "vartheta;": "\u03D1",
  8915. "vartriangleleft;": "\u22B2",
  8916. "vartriangleright;": "\u22B3",
  8917. "vBar;": "\u2AE8",
  8918. "Vbar;": "\u2AEB",
  8919. "vBarv;": "\u2AE9",
  8920. "Vcy;": "\u0412",
  8921. "vcy;": "\u0432",
  8922. "vdash;": "\u22A2",
  8923. "vDash;": "\u22A8",
  8924. "Vdash;": "\u22A9",
  8925. "VDash;": "\u22AB",
  8926. "Vdashl;": "\u2AE6",
  8927. "veebar;": "\u22BB",
  8928. "vee;": "\u2228",
  8929. "Vee;": "\u22C1",
  8930. "veeeq;": "\u225A",
  8931. "vellip;": "\u22EE",
  8932. "verbar;": "\u007C",
  8933. "Verbar;": "\u2016",
  8934. "vert;": "\u007C",
  8935. "Vert;": "\u2016",
  8936. "VerticalBar;": "\u2223",
  8937. "VerticalLine;": "\u007C",
  8938. "VerticalSeparator;": "\u2758",
  8939. "VerticalTilde;": "\u2240",
  8940. "VeryThinSpace;": "\u200A",
  8941. "Vfr;": "\uD835\uDD19",
  8942. "vfr;": "\uD835\uDD33",
  8943. "vltri;": "\u22B2",
  8944. "vnsub;": "\u2282\u20D2",
  8945. "vnsup;": "\u2283\u20D2",
  8946. "Vopf;": "\uD835\uDD4D",
  8947. "vopf;": "\uD835\uDD67",
  8948. "vprop;": "\u221D",
  8949. "vrtri;": "\u22B3",
  8950. "Vscr;": "\uD835\uDCB1",
  8951. "vscr;": "\uD835\uDCCB",
  8952. "vsubnE;": "\u2ACB\uFE00",
  8953. "vsubne;": "\u228A\uFE00",
  8954. "vsupnE;": "\u2ACC\uFE00",
  8955. "vsupne;": "\u228B\uFE00",
  8956. "Vvdash;": "\u22AA",
  8957. "vzigzag;": "\u299A",
  8958. "Wcirc;": "\u0174",
  8959. "wcirc;": "\u0175",
  8960. "wedbar;": "\u2A5F",
  8961. "wedge;": "\u2227",
  8962. "Wedge;": "\u22C0",
  8963. "wedgeq;": "\u2259",
  8964. "weierp;": "\u2118",
  8965. "Wfr;": "\uD835\uDD1A",
  8966. "wfr;": "\uD835\uDD34",
  8967. "Wopf;": "\uD835\uDD4E",
  8968. "wopf;": "\uD835\uDD68",
  8969. "wp;": "\u2118",
  8970. "wr;": "\u2240",
  8971. "wreath;": "\u2240",
  8972. "Wscr;": "\uD835\uDCB2",
  8973. "wscr;": "\uD835\uDCCC",
  8974. "xcap;": "\u22C2",
  8975. "xcirc;": "\u25EF",
  8976. "xcup;": "\u22C3",
  8977. "xdtri;": "\u25BD",
  8978. "Xfr;": "\uD835\uDD1B",
  8979. "xfr;": "\uD835\uDD35",
  8980. "xharr;": "\u27F7",
  8981. "xhArr;": "\u27FA",
  8982. "Xi;": "\u039E",
  8983. "xi;": "\u03BE",
  8984. "xlarr;": "\u27F5",
  8985. "xlArr;": "\u27F8",
  8986. "xmap;": "\u27FC",
  8987. "xnis;": "\u22FB",
  8988. "xodot;": "\u2A00",
  8989. "Xopf;": "\uD835\uDD4F",
  8990. "xopf;": "\uD835\uDD69",
  8991. "xoplus;": "\u2A01",
  8992. "xotime;": "\u2A02",
  8993. "xrarr;": "\u27F6",
  8994. "xrArr;": "\u27F9",
  8995. "Xscr;": "\uD835\uDCB3",
  8996. "xscr;": "\uD835\uDCCD",
  8997. "xsqcup;": "\u2A06",
  8998. "xuplus;": "\u2A04",
  8999. "xutri;": "\u25B3",
  9000. "xvee;": "\u22C1",
  9001. "xwedge;": "\u22C0",
  9002. "Yacute;": "\u00DD",
  9003. "Yacute": "\u00DD",
  9004. "yacute;": "\u00FD",
  9005. "yacute": "\u00FD",
  9006. "YAcy;": "\u042F",
  9007. "yacy;": "\u044F",
  9008. "Ycirc;": "\u0176",
  9009. "ycirc;": "\u0177",
  9010. "Ycy;": "\u042B",
  9011. "ycy;": "\u044B",
  9012. "yen;": "\u00A5",
  9013. "yen": "\u00A5",
  9014. "Yfr;": "\uD835\uDD1C",
  9015. "yfr;": "\uD835\uDD36",
  9016. "YIcy;": "\u0407",
  9017. "yicy;": "\u0457",
  9018. "Yopf;": "\uD835\uDD50",
  9019. "yopf;": "\uD835\uDD6A",
  9020. "Yscr;": "\uD835\uDCB4",
  9021. "yscr;": "\uD835\uDCCE",
  9022. "YUcy;": "\u042E",
  9023. "yucy;": "\u044E",
  9024. "yuml;": "\u00FF",
  9025. "yuml": "\u00FF",
  9026. "Yuml;": "\u0178",
  9027. "Zacute;": "\u0179",
  9028. "zacute;": "\u017A",
  9029. "Zcaron;": "\u017D",
  9030. "zcaron;": "\u017E",
  9031. "Zcy;": "\u0417",
  9032. "zcy;": "\u0437",
  9033. "Zdot;": "\u017B",
  9034. "zdot;": "\u017C",
  9035. "zeetrf;": "\u2128",
  9036. "ZeroWidthSpace;": "\u200B",
  9037. "Zeta;": "\u0396",
  9038. "zeta;": "\u03B6",
  9039. "zfr;": "\uD835\uDD37",
  9040. "Zfr;": "\u2128",
  9041. "ZHcy;": "\u0416",
  9042. "zhcy;": "\u0436",
  9043. "zigrarr;": "\u21DD",
  9044. "zopf;": "\uD835\uDD6B",
  9045. "Zopf;": "\u2124",
  9046. "Zscr;": "\uD835\uDCB5",
  9047. "zscr;": "\uD835\uDCCF",
  9048. "zwj;": "\u200D",
  9049. "zwnj;": "\u200C"
  9050. };
  9051. },
  9052. {}],
  9053. 13:[function(_dereq_,module,exports){
  9054. var util = _dereq_('util/');
  9055. var pSlice = Array.prototype.slice;
  9056. var hasOwn = Object.prototype.hasOwnProperty;
  9057. var assert = module.exports = ok;
  9058. assert.AssertionError = function AssertionError(options) {
  9059. this.name = 'AssertionError';
  9060. this.actual = options.actual;
  9061. this.expected = options.expected;
  9062. this.operator = options.operator;
  9063. if (options.message) {
  9064. this.message = options.message;
  9065. this.generatedMessage = false;
  9066. } else {
  9067. this.message = getMessage(this);
  9068. this.generatedMessage = true;
  9069. }
  9070. var stackStartFunction = options.stackStartFunction || fail;
  9071. if (Error.captureStackTrace) {
  9072. Error.captureStackTrace(this, stackStartFunction);
  9073. }
  9074. else {
  9075. var err = new Error();
  9076. if (err.stack) {
  9077. var out = err.stack;
  9078. var fn_name = stackStartFunction.name;
  9079. var idx = out.indexOf('\n' + fn_name);
  9080. if (idx >= 0) {
  9081. var next_line = out.indexOf('\n', idx + 1);
  9082. out = out.substring(next_line + 1);
  9083. }
  9084. this.stack = out;
  9085. }
  9086. }
  9087. };
  9088. util.inherits(assert.AssertionError, Error);
  9089. function replacer(key, value) {
  9090. if (util.isUndefined(value)) {
  9091. return '' + value;
  9092. }
  9093. if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) {
  9094. return value.toString();
  9095. }
  9096. if (util.isFunction(value) || util.isRegExp(value)) {
  9097. return value.toString();
  9098. }
  9099. return value;
  9100. }
  9101. function truncate(s, n) {
  9102. if (util.isString(s)) {
  9103. return s.length < n ? s : s.slice(0, n);
  9104. } else {
  9105. return s;
  9106. }
  9107. }
  9108. function getMessage(self) {
  9109. return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
  9110. self.operator + ' ' +
  9111. truncate(JSON.stringify(self.expected, replacer), 128);
  9112. }
  9113. function fail(actual, expected, message, operator, stackStartFunction) {
  9114. throw new assert.AssertionError({
  9115. message: message,
  9116. actual: actual,
  9117. expected: expected,
  9118. operator: operator,
  9119. stackStartFunction: stackStartFunction
  9120. });
  9121. }
  9122. assert.fail = fail;
  9123. function ok(value, message) {
  9124. if (!value) fail(value, true, message, '==', assert.ok);
  9125. }
  9126. assert.ok = ok;
  9127. assert.equal = function equal(actual, expected, message) {
  9128. if (actual != expected) fail(actual, expected, message, '==', assert.equal);
  9129. };
  9130. assert.notEqual = function notEqual(actual, expected, message) {
  9131. if (actual == expected) {
  9132. fail(actual, expected, message, '!=', assert.notEqual);
  9133. }
  9134. };
  9135. assert.deepEqual = function deepEqual(actual, expected, message) {
  9136. if (!_deepEqual(actual, expected)) {
  9137. fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  9138. }
  9139. };
  9140. function _deepEqual(actual, expected) {
  9141. if (actual === expected) {
  9142. return true;
  9143. } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
  9144. if (actual.length != expected.length) return false;
  9145. for (var i = 0; i < actual.length; i++) {
  9146. if (actual[i] !== expected[i]) return false;
  9147. }
  9148. return true;
  9149. } else if (util.isDate(actual) && util.isDate(expected)) {
  9150. return actual.getTime() === expected.getTime();
  9151. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  9152. return actual.source === expected.source &&
  9153. actual.global === expected.global &&
  9154. actual.multiline === expected.multiline &&
  9155. actual.lastIndex === expected.lastIndex &&
  9156. actual.ignoreCase === expected.ignoreCase;
  9157. } else if (!util.isObject(actual) && !util.isObject(expected)) {
  9158. return actual == expected;
  9159. } else {
  9160. return objEquiv(actual, expected);
  9161. }
  9162. }
  9163. function isArguments(object) {
  9164. return Object.prototype.toString.call(object) == '[object Arguments]';
  9165. }
  9166. function objEquiv(a, b) {
  9167. if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
  9168. return false;
  9169. if (a.prototype !== b.prototype) return false;
  9170. if (isArguments(a)) {
  9171. if (!isArguments(b)) {
  9172. return false;
  9173. }
  9174. a = pSlice.call(a);
  9175. b = pSlice.call(b);
  9176. return _deepEqual(a, b);
  9177. }
  9178. try {
  9179. var ka = objectKeys(a),
  9180. kb = objectKeys(b),
  9181. key, i;
  9182. } catch (e) {//happens when one is a string literal and the other isn't
  9183. return false;
  9184. }
  9185. if (ka.length != kb.length)
  9186. return false;
  9187. ka.sort();
  9188. kb.sort();
  9189. for (i = ka.length - 1; i >= 0; i--) {
  9190. if (ka[i] != kb[i])
  9191. return false;
  9192. }
  9193. for (i = ka.length - 1; i >= 0; i--) {
  9194. key = ka[i];
  9195. if (!_deepEqual(a[key], b[key])) return false;
  9196. }
  9197. return true;
  9198. }
  9199. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  9200. if (_deepEqual(actual, expected)) {
  9201. fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  9202. }
  9203. };
  9204. assert.strictEqual = function strictEqual(actual, expected, message) {
  9205. if (actual !== expected) {
  9206. fail(actual, expected, message, '===', assert.strictEqual);
  9207. }
  9208. };
  9209. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  9210. if (actual === expected) {
  9211. fail(actual, expected, message, '!==', assert.notStrictEqual);
  9212. }
  9213. };
  9214. function expectedException(actual, expected) {
  9215. if (!actual || !expected) {
  9216. return false;
  9217. }
  9218. if (Object.prototype.toString.call(expected) == '[object RegExp]') {
  9219. return expected.test(actual);
  9220. } else if (actual instanceof expected) {
  9221. return true;
  9222. } else if (expected.call({}, actual) === true) {
  9223. return true;
  9224. }
  9225. return false;
  9226. }
  9227. function _throws(shouldThrow, block, expected, message) {
  9228. var actual;
  9229. if (util.isString(expected)) {
  9230. message = expected;
  9231. expected = null;
  9232. }
  9233. try {
  9234. block();
  9235. } catch (e) {
  9236. actual = e;
  9237. }
  9238. message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
  9239. (message ? ' ' + message : '.');
  9240. if (shouldThrow && !actual) {
  9241. fail(actual, expected, 'Missing expected exception' + message);
  9242. }
  9243. if (!shouldThrow && expectedException(actual, expected)) {
  9244. fail(actual, expected, 'Got unwanted exception' + message);
  9245. }
  9246. if ((shouldThrow && actual && expected &&
  9247. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  9248. throw actual;
  9249. }
  9250. }
  9251. assert.throws = function(block, /*optional*/error, /*optional*/message) {
  9252. _throws.apply(this, [true].concat(pSlice.call(arguments)));
  9253. };
  9254. assert.doesNotThrow = function(block, /*optional*/message) {
  9255. _throws.apply(this, [false].concat(pSlice.call(arguments)));
  9256. };
  9257. assert.ifError = function(err) { if (err) {throw err;}};
  9258. var objectKeys = Object.keys || function (obj) {
  9259. var keys = [];
  9260. for (var key in obj) {
  9261. if (hasOwn.call(obj, key)) keys.push(key);
  9262. }
  9263. return keys;
  9264. };
  9265. },
  9266. {"util/":15}],
  9267. 14:[function(_dereq_,module,exports){
  9268. module.exports = function isBuffer(arg) {
  9269. return arg && typeof arg === 'object'
  9270. && typeof arg.copy === 'function'
  9271. && typeof arg.fill === 'function'
  9272. && typeof arg.readUInt8 === 'function';
  9273. }
  9274. },
  9275. {}],
  9276. 15:[function(_dereq_,module,exports){
  9277. (function (process,global){
  9278. var formatRegExp = /%[sdj%]/g;
  9279. exports.format = function(f) {
  9280. if (!isString(f)) {
  9281. var objects = [];
  9282. for (var i = 0; i < arguments.length; i++) {
  9283. objects.push(inspect(arguments[i]));
  9284. }
  9285. return objects.join(' ');
  9286. }
  9287. var i = 1;
  9288. var args = arguments;
  9289. var len = args.length;
  9290. var str = String(f).replace(formatRegExp, function(x) {
  9291. if (x === '%%') return '%';
  9292. if (i >= len) return x;
  9293. switch (x) {
  9294. case '%s': return String(args[i++]);
  9295. case '%d': return Number(args[i++]);
  9296. case '%j':
  9297. try {
  9298. return JSON.stringify(args[i++]);
  9299. } catch (_) {
  9300. return '[Circular]';
  9301. }
  9302. default:
  9303. return x;
  9304. }
  9305. });
  9306. for (var x = args[i]; i < len; x = args[++i]) {
  9307. if (isNull(x) || !isObject(x)) {
  9308. str += ' ' + x;
  9309. } else {
  9310. str += ' ' + inspect(x);
  9311. }
  9312. }
  9313. return str;
  9314. };
  9315. exports.deprecate = function(fn, msg) {
  9316. if (isUndefined(global.process)) {
  9317. return function() {
  9318. return exports.deprecate(fn, msg).apply(this, arguments);
  9319. };
  9320. }
  9321. if (process.noDeprecation === true) {
  9322. return fn;
  9323. }
  9324. var warned = false;
  9325. function deprecated() {
  9326. if (!warned) {
  9327. if (process.throwDeprecation) {
  9328. throw new Error(msg);
  9329. } else if (process.traceDeprecation) {
  9330. console.trace(msg);
  9331. } else {
  9332. console.error(msg);
  9333. }
  9334. warned = true;
  9335. }
  9336. return fn.apply(this, arguments);
  9337. }
  9338. return deprecated;
  9339. };
  9340. var debugs = {};
  9341. var debugEnviron;
  9342. exports.debuglog = function(set) {
  9343. if (isUndefined(debugEnviron))
  9344. debugEnviron = process.env.NODE_DEBUG || '';
  9345. set = set.toUpperCase();
  9346. if (!debugs[set]) {
  9347. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  9348. var pid = process.pid;
  9349. debugs[set] = function() {
  9350. var msg = exports.format.apply(exports, arguments);
  9351. console.error('%s %d: %s', set, pid, msg);
  9352. };
  9353. } else {
  9354. debugs[set] = function() {};
  9355. }
  9356. }
  9357. return debugs[set];
  9358. };
  9359. function inspect(obj, opts) {
  9360. var ctx = {
  9361. seen: [],
  9362. stylize: stylizeNoColor
  9363. };
  9364. if (arguments.length >= 3) ctx.depth = arguments[2];
  9365. if (arguments.length >= 4) ctx.colors = arguments[3];
  9366. if (isBoolean(opts)) {
  9367. ctx.showHidden = opts;
  9368. } else if (opts) {
  9369. exports._extend(ctx, opts);
  9370. }
  9371. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  9372. if (isUndefined(ctx.depth)) ctx.depth = 2;
  9373. if (isUndefined(ctx.colors)) ctx.colors = false;
  9374. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  9375. if (ctx.colors) ctx.stylize = stylizeWithColor;
  9376. return formatValue(ctx, obj, ctx.depth);
  9377. }
  9378. exports.inspect = inspect;
  9379. inspect.colors = {
  9380. 'bold' : [1, 22],
  9381. 'italic' : [3, 23],
  9382. 'underline' : [4, 24],
  9383. 'inverse' : [7, 27],
  9384. 'white' : [37, 39],
  9385. 'grey' : [90, 39],
  9386. 'black' : [30, 39],
  9387. 'blue' : [34, 39],
  9388. 'cyan' : [36, 39],
  9389. 'green' : [32, 39],
  9390. 'magenta' : [35, 39],
  9391. 'red' : [31, 39],
  9392. 'yellow' : [33, 39]
  9393. };
  9394. inspect.styles = {
  9395. 'special': 'cyan',
  9396. 'number': 'yellow',
  9397. 'boolean': 'yellow',
  9398. 'undefined': 'grey',
  9399. 'null': 'bold',
  9400. 'string': 'green',
  9401. 'date': 'magenta',
  9402. 'regexp': 'red'
  9403. };
  9404. function stylizeWithColor(str, styleType) {
  9405. var style = inspect.styles[styleType];
  9406. if (style) {
  9407. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  9408. '\u001b[' + inspect.colors[style][1] + 'm';
  9409. } else {
  9410. return str;
  9411. }
  9412. }
  9413. function stylizeNoColor(str, styleType) {
  9414. return str;
  9415. }
  9416. function arrayToHash(array) {
  9417. var hash = {};
  9418. array.forEach(function(val, idx) {
  9419. hash[val] = true;
  9420. });
  9421. return hash;
  9422. }
  9423. function formatValue(ctx, value, recurseTimes) {
  9424. if (ctx.customInspect &&
  9425. value &&
  9426. isFunction(value.inspect) &&
  9427. value.inspect !== exports.inspect &&
  9428. !(value.constructor && value.constructor.prototype === value)) {
  9429. var ret = value.inspect(recurseTimes, ctx);
  9430. if (!isString(ret)) {
  9431. ret = formatValue(ctx, ret, recurseTimes);
  9432. }
  9433. return ret;
  9434. }
  9435. var primitive = formatPrimitive(ctx, value);
  9436. if (primitive) {
  9437. return primitive;
  9438. }
  9439. var keys = Object.keys(value);
  9440. var visibleKeys = arrayToHash(keys);
  9441. if (ctx.showHidden) {
  9442. keys = Object.getOwnPropertyNames(value);
  9443. }
  9444. if (isError(value)
  9445. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  9446. return formatError(value);
  9447. }
  9448. if (keys.length === 0) {
  9449. if (isFunction(value)) {
  9450. var name = value.name ? ': ' + value.name : '';
  9451. return ctx.stylize('[Function' + name + ']', 'special');
  9452. }
  9453. if (isRegExp(value)) {
  9454. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  9455. }
  9456. if (isDate(value)) {
  9457. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  9458. }
  9459. if (isError(value)) {
  9460. return formatError(value);
  9461. }
  9462. }
  9463. var base = '', array = false, braces = ['{', '}'];
  9464. if (isArray(value)) {
  9465. array = true;
  9466. braces = ['[', ']'];
  9467. }
  9468. if (isFunction(value)) {
  9469. var n = value.name ? ': ' + value.name : '';
  9470. base = ' [Function' + n + ']';
  9471. }
  9472. if (isRegExp(value)) {
  9473. base = ' ' + RegExp.prototype.toString.call(value);
  9474. }
  9475. if (isDate(value)) {
  9476. base = ' ' + Date.prototype.toUTCString.call(value);
  9477. }
  9478. if (isError(value)) {
  9479. base = ' ' + formatError(value);
  9480. }
  9481. if (keys.length === 0 && (!array || value.length == 0)) {
  9482. return braces[0] + base + braces[1];
  9483. }
  9484. if (recurseTimes < 0) {
  9485. if (isRegExp(value)) {
  9486. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  9487. } else {
  9488. return ctx.stylize('[Object]', 'special');
  9489. }
  9490. }
  9491. ctx.seen.push(value);
  9492. var output;
  9493. if (array) {
  9494. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  9495. } else {
  9496. output = keys.map(function(key) {
  9497. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  9498. });
  9499. }
  9500. ctx.seen.pop();
  9501. return reduceToSingleString(output, base, braces);
  9502. }
  9503. function formatPrimitive(ctx, value) {
  9504. if (isUndefined(value))
  9505. return ctx.stylize('undefined', 'undefined');
  9506. if (isString(value)) {
  9507. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  9508. .replace(/'/g, "\\'")
  9509. .replace(/\\"/g, '"') + '\'';
  9510. return ctx.stylize(simple, 'string');
  9511. }
  9512. if (isNumber(value))
  9513. return ctx.stylize('' + value, 'number');
  9514. if (isBoolean(value))
  9515. return ctx.stylize('' + value, 'boolean');
  9516. if (isNull(value))
  9517. return ctx.stylize('null', 'null');
  9518. }
  9519. function formatError(value) {
  9520. return '[' + Error.prototype.toString.call(value) + ']';
  9521. }
  9522. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  9523. var output = [];
  9524. for (var i = 0, l = value.length; i < l; ++i) {
  9525. if (hasOwnProperty(value, String(i))) {
  9526. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  9527. String(i), true));
  9528. } else {
  9529. output.push('');
  9530. }
  9531. }
  9532. keys.forEach(function(key) {
  9533. if (!key.match(/^\d+$/)) {
  9534. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  9535. key, true));
  9536. }
  9537. });
  9538. return output;
  9539. }
  9540. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  9541. var name, str, desc;
  9542. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  9543. if (desc.get) {
  9544. if (desc.set) {
  9545. str = ctx.stylize('[Getter/Setter]', 'special');
  9546. } else {
  9547. str = ctx.stylize('[Getter]', 'special');
  9548. }
  9549. } else {
  9550. if (desc.set) {
  9551. str = ctx.stylize('[Setter]', 'special');
  9552. }
  9553. }
  9554. if (!hasOwnProperty(visibleKeys, key)) {
  9555. name = '[' + key + ']';
  9556. }
  9557. if (!str) {
  9558. if (ctx.seen.indexOf(desc.value) < 0) {
  9559. if (isNull(recurseTimes)) {
  9560. str = formatValue(ctx, desc.value, null);
  9561. } else {
  9562. str = formatValue(ctx, desc.value, recurseTimes - 1);
  9563. }
  9564. if (str.indexOf('\n') > -1) {
  9565. if (array) {
  9566. str = str.split('\n').map(function(line) {
  9567. return ' ' + line;
  9568. }).join('\n').substr(2);
  9569. } else {
  9570. str = '\n' + str.split('\n').map(function(line) {
  9571. return ' ' + line;
  9572. }).join('\n');
  9573. }
  9574. }
  9575. } else {
  9576. str = ctx.stylize('[Circular]', 'special');
  9577. }
  9578. }
  9579. if (isUndefined(name)) {
  9580. if (array && key.match(/^\d+$/)) {
  9581. return str;
  9582. }
  9583. name = JSON.stringify('' + key);
  9584. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  9585. name = name.substr(1, name.length - 2);
  9586. name = ctx.stylize(name, 'name');
  9587. } else {
  9588. name = name.replace(/'/g, "\\'")
  9589. .replace(/\\"/g, '"')
  9590. .replace(/(^"|"$)/g, "'");
  9591. name = ctx.stylize(name, 'string');
  9592. }
  9593. }
  9594. return name + ': ' + str;
  9595. }
  9596. function reduceToSingleString(output, base, braces) {
  9597. var numLinesEst = 0;
  9598. var length = output.reduce(function(prev, cur) {
  9599. numLinesEst++;
  9600. if (cur.indexOf('\n') >= 0) numLinesEst++;
  9601. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  9602. }, 0);
  9603. if (length > 60) {
  9604. return braces[0] +
  9605. (base === '' ? '' : base + '\n ') +
  9606. ' ' +
  9607. output.join(',\n ') +
  9608. ' ' +
  9609. braces[1];
  9610. }
  9611. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  9612. }
  9613. function isArray(ar) {
  9614. return Array.isArray(ar);
  9615. }
  9616. exports.isArray = isArray;
  9617. function isBoolean(arg) {
  9618. return typeof arg === 'boolean';
  9619. }
  9620. exports.isBoolean = isBoolean;
  9621. function isNull(arg) {
  9622. return arg === null;
  9623. }
  9624. exports.isNull = isNull;
  9625. function isNullOrUndefined(arg) {
  9626. return arg == null;
  9627. }
  9628. exports.isNullOrUndefined = isNullOrUndefined;
  9629. function isNumber(arg) {
  9630. return typeof arg === 'number';
  9631. }
  9632. exports.isNumber = isNumber;
  9633. function isString(arg) {
  9634. return typeof arg === 'string';
  9635. }
  9636. exports.isString = isString;
  9637. function isSymbol(arg) {
  9638. return typeof arg === 'symbol';
  9639. }
  9640. exports.isSymbol = isSymbol;
  9641. function isUndefined(arg) {
  9642. return arg === void 0;
  9643. }
  9644. exports.isUndefined = isUndefined;
  9645. function isRegExp(re) {
  9646. return isObject(re) && objectToString(re) === '[object RegExp]';
  9647. }
  9648. exports.isRegExp = isRegExp;
  9649. function isObject(arg) {
  9650. return typeof arg === 'object' && arg !== null;
  9651. }
  9652. exports.isObject = isObject;
  9653. function isDate(d) {
  9654. return isObject(d) && objectToString(d) === '[object Date]';
  9655. }
  9656. exports.isDate = isDate;
  9657. function isError(e) {
  9658. return isObject(e) &&
  9659. (objectToString(e) === '[object Error]' || e instanceof Error);
  9660. }
  9661. exports.isError = isError;
  9662. function isFunction(arg) {
  9663. return typeof arg === 'function';
  9664. }
  9665. exports.isFunction = isFunction;
  9666. function isPrimitive(arg) {
  9667. return arg === null ||
  9668. typeof arg === 'boolean' ||
  9669. typeof arg === 'number' ||
  9670. typeof arg === 'string' ||
  9671. typeof arg === 'symbol' || // ES6 symbol
  9672. typeof arg === 'undefined';
  9673. }
  9674. exports.isPrimitive = isPrimitive;
  9675. exports.isBuffer = _dereq_('./support/isBuffer');
  9676. function objectToString(o) {
  9677. return Object.prototype.toString.call(o);
  9678. }
  9679. function pad(n) {
  9680. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  9681. }
  9682. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  9683. 'Oct', 'Nov', 'Dec'];
  9684. function timestamp() {
  9685. var d = new Date();
  9686. var time = [pad(d.getHours()),
  9687. pad(d.getMinutes()),
  9688. pad(d.getSeconds())].join(':');
  9689. return [d.getDate(), months[d.getMonth()], time].join(' ');
  9690. }
  9691. exports.log = function() {
  9692. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  9693. };
  9694. exports.inherits = _dereq_('inherits');
  9695. exports._extend = function(origin, add) {
  9696. if (!add || !isObject(add)) return origin;
  9697. var keys = Object.keys(add);
  9698. var i = keys.length;
  9699. while (i--) {
  9700. origin[keys[i]] = add[keys[i]];
  9701. }
  9702. return origin;
  9703. };
  9704. function hasOwnProperty(obj, prop) {
  9705. return Object.prototype.hasOwnProperty.call(obj, prop);
  9706. }
  9707. }).call(this,_dereq_("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  9708. },
  9709. {"./support/isBuffer":14,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}],
  9710. 16:[function(_dereq_,module,exports){
  9711. function EventEmitter() {
  9712. this._events = this._events || {};
  9713. this._maxListeners = this._maxListeners || undefined;
  9714. }
  9715. module.exports = EventEmitter;
  9716. EventEmitter.EventEmitter = EventEmitter;
  9717. EventEmitter.prototype._events = undefined;
  9718. EventEmitter.prototype._maxListeners = undefined;
  9719. EventEmitter.defaultMaxListeners = 10;
  9720. EventEmitter.prototype.setMaxListeners = function(n) {
  9721. if (!isNumber(n) || n < 0 || isNaN(n))
  9722. throw TypeError('n must be a positive number');
  9723. this._maxListeners = n;
  9724. return this;
  9725. };
  9726. EventEmitter.prototype.emit = function(type) {
  9727. var er, handler, len, args, i, listeners;
  9728. if (!this._events)
  9729. this._events = {};
  9730. if (type === 'error') {
  9731. if (!this._events.error ||
  9732. (isObject(this._events.error) && !this._events.error.length)) {
  9733. er = arguments[1];
  9734. if (er instanceof Error) {
  9735. throw er; // Unhandled 'error' event
  9736. } else {
  9737. throw TypeError('Uncaught, unspecified "error" event.');
  9738. }
  9739. return false;
  9740. }
  9741. }
  9742. handler = this._events[type];
  9743. if (isUndefined(handler))
  9744. return false;
  9745. if (isFunction(handler)) {
  9746. switch (arguments.length) {
  9747. case 1:
  9748. handler.call(this);
  9749. break;
  9750. case 2:
  9751. handler.call(this, arguments[1]);
  9752. break;
  9753. case 3:
  9754. handler.call(this, arguments[1], arguments[2]);
  9755. break;
  9756. default:
  9757. len = arguments.length;
  9758. args = new Array(len - 1);
  9759. for (i = 1; i < len; i++)
  9760. args[i - 1] = arguments[i];
  9761. handler.apply(this, args);
  9762. }
  9763. } else if (isObject(handler)) {
  9764. len = arguments.length;
  9765. args = new Array(len - 1);
  9766. for (i = 1; i < len; i++)
  9767. args[i - 1] = arguments[i];
  9768. listeners = handler.slice();
  9769. len = listeners.length;
  9770. for (i = 0; i < len; i++)
  9771. listeners[i].apply(this, args);
  9772. }
  9773. return true;
  9774. };
  9775. EventEmitter.prototype.addListener = function(type, listener) {
  9776. var m;
  9777. if (!isFunction(listener))
  9778. throw TypeError('listener must be a function');
  9779. if (!this._events)
  9780. this._events = {};
  9781. if (this._events.newListener)
  9782. this.emit('newListener', type,
  9783. isFunction(listener.listener) ?
  9784. listener.listener : listener);
  9785. if (!this._events[type])
  9786. this._events[type] = listener;
  9787. else if (isObject(this._events[type]))
  9788. this._events[type].push(listener);
  9789. else
  9790. this._events[type] = [this._events[type], listener];
  9791. if (isObject(this._events[type]) && !this._events[type].warned) {
  9792. var m;
  9793. if (!isUndefined(this._maxListeners)) {
  9794. m = this._maxListeners;
  9795. } else {
  9796. m = EventEmitter.defaultMaxListeners;
  9797. }
  9798. if (m && m > 0 && this._events[type].length > m) {
  9799. this._events[type].warned = true;
  9800. console.error('(node) warning: possible EventEmitter memory ' +
  9801. 'leak detected. %d listeners added. ' +
  9802. 'Use emitter.setMaxListeners() to increase limit.',
  9803. this._events[type].length);
  9804. console.trace();
  9805. }
  9806. }
  9807. return this;
  9808. };
  9809. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  9810. EventEmitter.prototype.once = function(type, listener) {
  9811. if (!isFunction(listener))
  9812. throw TypeError('listener must be a function');
  9813. var fired = false;
  9814. function g() {
  9815. this.removeListener(type, g);
  9816. if (!fired) {
  9817. fired = true;
  9818. listener.apply(this, arguments);
  9819. }
  9820. }
  9821. g.listener = listener;
  9822. this.on(type, g);
  9823. return this;
  9824. };
  9825. EventEmitter.prototype.removeListener = function(type, listener) {
  9826. var list, position, length, i;
  9827. if (!isFunction(listener))
  9828. throw TypeError('listener must be a function');
  9829. if (!this._events || !this._events[type])
  9830. return this;
  9831. list = this._events[type];
  9832. length = list.length;
  9833. position = -1;
  9834. if (list === listener ||
  9835. (isFunction(list.listener) && list.listener === listener)) {
  9836. delete this._events[type];
  9837. if (this._events.removeListener)
  9838. this.emit('removeListener', type, listener);
  9839. } else if (isObject(list)) {
  9840. for (i = length; i-- > 0;) {
  9841. if (list[i] === listener ||
  9842. (list[i].listener && list[i].listener === listener)) {
  9843. position = i;
  9844. break;
  9845. }
  9846. }
  9847. if (position < 0)
  9848. return this;
  9849. if (list.length === 1) {
  9850. list.length = 0;
  9851. delete this._events[type];
  9852. } else {
  9853. list.splice(position, 1);
  9854. }
  9855. if (this._events.removeListener)
  9856. this.emit('removeListener', type, listener);
  9857. }
  9858. return this;
  9859. };
  9860. EventEmitter.prototype.removeAllListeners = function(type) {
  9861. var key, listeners;
  9862. if (!this._events)
  9863. return this;
  9864. if (!this._events.removeListener) {
  9865. if (arguments.length === 0)
  9866. this._events = {};
  9867. else if (this._events[type])
  9868. delete this._events[type];
  9869. return this;
  9870. }
  9871. if (arguments.length === 0) {
  9872. for (key in this._events) {
  9873. if (key === 'removeListener') continue;
  9874. this.removeAllListeners(key);
  9875. }
  9876. this.removeAllListeners('removeListener');
  9877. this._events = {};
  9878. return this;
  9879. }
  9880. listeners = this._events[type];
  9881. if (isFunction(listeners)) {
  9882. this.removeListener(type, listeners);
  9883. } else {
  9884. while (listeners.length)
  9885. this.removeListener(type, listeners[listeners.length - 1]);
  9886. }
  9887. delete this._events[type];
  9888. return this;
  9889. };
  9890. EventEmitter.prototype.listeners = function(type) {
  9891. var ret;
  9892. if (!this._events || !this._events[type])
  9893. ret = [];
  9894. else if (isFunction(this._events[type]))
  9895. ret = [this._events[type]];
  9896. else
  9897. ret = this._events[type].slice();
  9898. return ret;
  9899. };
  9900. EventEmitter.listenerCount = function(emitter, type) {
  9901. var ret;
  9902. if (!emitter._events || !emitter._events[type])
  9903. ret = 0;
  9904. else if (isFunction(emitter._events[type]))
  9905. ret = 1;
  9906. else
  9907. ret = emitter._events[type].length;
  9908. return ret;
  9909. };
  9910. function isFunction(arg) {
  9911. return typeof arg === 'function';
  9912. }
  9913. function isNumber(arg) {
  9914. return typeof arg === 'number';
  9915. }
  9916. function isObject(arg) {
  9917. return typeof arg === 'object' && arg !== null;
  9918. }
  9919. function isUndefined(arg) {
  9920. return arg === void 0;
  9921. }
  9922. },
  9923. {}],
  9924. 17:[function(_dereq_,module,exports){
  9925. if (typeof Object.create === 'function') {
  9926. module.exports = function inherits(ctor, superCtor) {
  9927. ctor.super_ = superCtor
  9928. ctor.prototype = Object.create(superCtor.prototype, {
  9929. constructor: {
  9930. value: ctor,
  9931. enumerable: false,
  9932. writable: true,
  9933. configurable: true
  9934. }
  9935. });
  9936. };
  9937. } else {
  9938. module.exports = function inherits(ctor, superCtor) {
  9939. ctor.super_ = superCtor
  9940. var TempCtor = function () {}
  9941. TempCtor.prototype = superCtor.prototype
  9942. ctor.prototype = new TempCtor()
  9943. ctor.prototype.constructor = ctor
  9944. }
  9945. }
  9946. },
  9947. {}],
  9948. 18:[function(_dereq_,module,exports){
  9949. var process = module.exports = {};
  9950. process.nextTick = (function () {
  9951. var canSetImmediate = typeof window !== 'undefined'
  9952. && window.setImmediate;
  9953. var canPost = typeof window !== 'undefined'
  9954. && window.postMessage && window.addEventListener
  9955. ;
  9956. if (canSetImmediate) {
  9957. return function (f) { return window.setImmediate(f) };
  9958. }
  9959. if (canPost) {
  9960. var queue = [];
  9961. window.addEventListener('message', function (ev) {
  9962. var source = ev.source;
  9963. if ((source === window || source === null) && ev.data === 'process-tick') {
  9964. ev.stopPropagation();
  9965. if (queue.length > 0) {
  9966. var fn = queue.shift();
  9967. fn();
  9968. }
  9969. }
  9970. }, true);
  9971. return function nextTick(fn) {
  9972. queue.push(fn);
  9973. window.postMessage('process-tick', '*');
  9974. };
  9975. }
  9976. return function nextTick(fn) {
  9977. setTimeout(fn, 0);
  9978. };
  9979. })();
  9980. process.title = 'browser';
  9981. process.browser = true;
  9982. process.env = {};
  9983. process.argv = [];
  9984. function noop() {}
  9985. process.on = noop;
  9986. process.once = noop;
  9987. process.off = noop;
  9988. process.emit = noop;
  9989. process.binding = function (name) {
  9990. throw new Error('process.binding is not supported');
  9991. }
  9992. process.cwd = function () { return '/' };
  9993. process.chdir = function (dir) {
  9994. throw new Error('process.chdir is not supported');
  9995. };
  9996. },
  9997. {}],
  9998. 19:[function(_dereq_,module,exports){
  9999. module.exports=_dereq_(14)
  10000. },
  10001. {}],
  10002. 20:[function(_dereq_,module,exports){
  10003. module.exports=_dereq_(15)
  10004. },
  10005. {"./support/isBuffer":19,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}]},{},[9])
  10006. (9)
  10007. });
  10008. ace.define("ace/mode/html_worker",[], function(require, exports, module) {
  10009. "use strict";
  10010. var oop = require("../lib/oop");
  10011. var lang = require("../lib/lang");
  10012. var Mirror = require("../worker/mirror").Mirror;
  10013. var SAXParser = require("./html/saxparser").SAXParser;
  10014. var errorTypes = {
  10015. "expected-doctype-but-got-start-tag": "info",
  10016. "expected-doctype-but-got-chars": "info",
  10017. "non-html-root": "info"
  10018. };
  10019. var Worker = exports.Worker = function(sender) {
  10020. Mirror.call(this, sender);
  10021. this.setTimeout(400);
  10022. this.context = null;
  10023. };
  10024. oop.inherits(Worker, Mirror);
  10025. (function() {
  10026. this.setOptions = function(options) {
  10027. this.context = options.context;
  10028. };
  10029. this.onUpdate = function() {
  10030. var value = this.doc.getValue();
  10031. if (!value)
  10032. return;
  10033. var parser = new SAXParser();
  10034. var errors = [];
  10035. var noop = function(){};
  10036. parser.contentHandler = {
  10037. startDocument: noop,
  10038. endDocument: noop,
  10039. startElement: noop,
  10040. endElement: noop,
  10041. characters: noop
  10042. };
  10043. parser.errorHandler = {
  10044. error: function(message, location, code) {
  10045. errors.push({
  10046. row: location.line,
  10047. column: location.column,
  10048. text: message,
  10049. type: errorTypes[code] || "error"
  10050. });
  10051. }
  10052. };
  10053. parser.parse(value, this.context);
  10054. this.sender.emit("error", errors);
  10055. };
  10056. }).call(Worker.prototype);
  10057. });