worker-html.js 330 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605
  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.data,
  23. file: file,
  24. line: line,
  25. col: col,
  26. stack: 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.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. require.tlns = {};
  141. window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
  142. for (var i in topLevelNamespaces)
  143. 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. require("ace/lib/es5-shim");
  186. sender = window.sender = window.initSender();
  187. var clazz = require(msg.module)[msg.classname];
  188. main = window.main = new clazz(sender);
  189. }
  190. };
  191. })(this);
  192. ace.define("ace/lib/oop",["require","exports","module"], function(require, exports, module) {
  193. "use strict";
  194. exports.inherits = function(ctor, superCtor) {
  195. ctor.super_ = superCtor;
  196. ctor.prototype = Object.create(superCtor.prototype, {
  197. constructor: {
  198. value: ctor,
  199. enumerable: false,
  200. writable: true,
  201. configurable: true
  202. }
  203. });
  204. };
  205. exports.mixin = function(obj, mixin) {
  206. for (var key in mixin) {
  207. obj[key] = mixin[key];
  208. }
  209. return obj;
  210. };
  211. exports.implement = function(proto, mixin) {
  212. exports.mixin(proto, mixin);
  213. };
  214. });
  215. ace.define("ace/lib/lang",["require","exports","module"], function(require, exports, module) {
  216. "use strict";
  217. exports.last = function(a) {
  218. return a[a.length - 1];
  219. };
  220. exports.stringReverse = function(string) {
  221. return string.split("").reverse().join("");
  222. };
  223. exports.stringRepeat = function (string, count) {
  224. var result = '';
  225. while (count > 0) {
  226. if (count & 1)
  227. result += string;
  228. if (count >>= 1)
  229. string += string;
  230. }
  231. return result;
  232. };
  233. var trimBeginRegexp = /^\s\s*/;
  234. var trimEndRegexp = /\s\s*$/;
  235. exports.stringTrimLeft = function (string) {
  236. return string.replace(trimBeginRegexp, '');
  237. };
  238. exports.stringTrimRight = function (string) {
  239. return string.replace(trimEndRegexp, '');
  240. };
  241. exports.copyObject = function(obj) {
  242. var copy = {};
  243. for (var key in obj) {
  244. copy[key] = obj[key];
  245. }
  246. return copy;
  247. };
  248. exports.copyArray = function(array){
  249. var copy = [];
  250. for (var i=0, l=array.length; i<l; i++) {
  251. if (array[i] && typeof array[i] == "object")
  252. copy[i] = this.copyObject(array[i]);
  253. else
  254. copy[i] = array[i];
  255. }
  256. return copy;
  257. };
  258. exports.deepCopy = function deepCopy(obj) {
  259. if (typeof obj !== "object" || !obj)
  260. return obj;
  261. var copy;
  262. if (Array.isArray(obj)) {
  263. copy = [];
  264. for (var key = 0; key < obj.length; key++) {
  265. copy[key] = deepCopy(obj[key]);
  266. }
  267. return copy;
  268. }
  269. if (Object.prototype.toString.call(obj) !== "[object Object]")
  270. return obj;
  271. copy = {};
  272. for (var key in obj)
  273. copy[key] = deepCopy(obj[key]);
  274. return copy;
  275. };
  276. exports.arrayToMap = function(arr) {
  277. var map = {};
  278. for (var i=0; i<arr.length; i++) {
  279. map[arr[i]] = 1;
  280. }
  281. return map;
  282. };
  283. exports.createMap = function(props) {
  284. var map = Object.create(null);
  285. for (var i in props) {
  286. map[i] = props[i];
  287. }
  288. return map;
  289. };
  290. exports.arrayRemove = function(array, value) {
  291. for (var i = 0; i <= array.length; i++) {
  292. if (value === array[i]) {
  293. array.splice(i, 1);
  294. }
  295. }
  296. };
  297. exports.escapeRegExp = function(str) {
  298. return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
  299. };
  300. exports.escapeHTML = function(str) {
  301. return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
  302. };
  303. exports.getMatchOffsets = function(string, regExp) {
  304. var matches = [];
  305. string.replace(regExp, function(str) {
  306. matches.push({
  307. offset: arguments[arguments.length-2],
  308. length: str.length
  309. });
  310. });
  311. return matches;
  312. };
  313. exports.deferredCall = function(fcn) {
  314. var timer = null;
  315. var callback = function() {
  316. timer = null;
  317. fcn();
  318. };
  319. var deferred = function(timeout) {
  320. deferred.cancel();
  321. timer = setTimeout(callback, timeout || 0);
  322. return deferred;
  323. };
  324. deferred.schedule = deferred;
  325. deferred.call = function() {
  326. this.cancel();
  327. fcn();
  328. return deferred;
  329. };
  330. deferred.cancel = function() {
  331. clearTimeout(timer);
  332. timer = null;
  333. return deferred;
  334. };
  335. deferred.isPending = function() {
  336. return timer;
  337. };
  338. return deferred;
  339. };
  340. exports.delayedCall = function(fcn, defaultTimeout) {
  341. var timer = null;
  342. var callback = function() {
  343. timer = null;
  344. fcn();
  345. };
  346. var _self = function(timeout) {
  347. if (timer == null)
  348. timer = setTimeout(callback, timeout || defaultTimeout);
  349. };
  350. _self.delay = function(timeout) {
  351. timer && clearTimeout(timer);
  352. timer = setTimeout(callback, timeout || defaultTimeout);
  353. };
  354. _self.schedule = _self;
  355. _self.call = function() {
  356. this.cancel();
  357. fcn();
  358. };
  359. _self.cancel = function() {
  360. timer && clearTimeout(timer);
  361. timer = null;
  362. };
  363. _self.isPending = function() {
  364. return timer;
  365. };
  366. return _self;
  367. };
  368. });
  369. ace.define("ace/range",["require","exports","module"], function(require, exports, module) {
  370. "use strict";
  371. var comparePoints = function(p1, p2) {
  372. return p1.row - p2.row || p1.column - p2.column;
  373. };
  374. var Range = function(startRow, startColumn, endRow, endColumn) {
  375. this.start = {
  376. row: startRow,
  377. column: startColumn
  378. };
  379. this.end = {
  380. row: endRow,
  381. column: endColumn
  382. };
  383. };
  384. (function() {
  385. this.isEqual = function(range) {
  386. return this.start.row === range.start.row &&
  387. this.end.row === range.end.row &&
  388. this.start.column === range.start.column &&
  389. this.end.column === range.end.column;
  390. };
  391. this.toString = function() {
  392. return ("Range: [" + this.start.row + "/" + this.start.column +
  393. "] -> [" + this.end.row + "/" + this.end.column + "]");
  394. };
  395. this.contains = function(row, column) {
  396. return this.compare(row, column) == 0;
  397. };
  398. this.compareRange = function(range) {
  399. var cmp,
  400. end = range.end,
  401. start = range.start;
  402. cmp = this.compare(end.row, end.column);
  403. if (cmp == 1) {
  404. cmp = this.compare(start.row, start.column);
  405. if (cmp == 1) {
  406. return 2;
  407. } else if (cmp == 0) {
  408. return 1;
  409. } else {
  410. return 0;
  411. }
  412. } else if (cmp == -1) {
  413. return -2;
  414. } else {
  415. cmp = this.compare(start.row, start.column);
  416. if (cmp == -1) {
  417. return -1;
  418. } else if (cmp == 1) {
  419. return 42;
  420. } else {
  421. return 0;
  422. }
  423. }
  424. };
  425. this.comparePoint = function(p) {
  426. return this.compare(p.row, p.column);
  427. };
  428. this.containsRange = function(range) {
  429. return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
  430. };
  431. this.intersects = function(range) {
  432. var cmp = this.compareRange(range);
  433. return (cmp == -1 || cmp == 0 || cmp == 1);
  434. };
  435. this.isEnd = function(row, column) {
  436. return this.end.row == row && this.end.column == column;
  437. };
  438. this.isStart = function(row, column) {
  439. return this.start.row == row && this.start.column == column;
  440. };
  441. this.setStart = function(row, column) {
  442. if (typeof row == "object") {
  443. this.start.column = row.column;
  444. this.start.row = row.row;
  445. } else {
  446. this.start.row = row;
  447. this.start.column = column;
  448. }
  449. };
  450. this.setEnd = function(row, column) {
  451. if (typeof row == "object") {
  452. this.end.column = row.column;
  453. this.end.row = row.row;
  454. } else {
  455. this.end.row = row;
  456. this.end.column = column;
  457. }
  458. };
  459. this.inside = function(row, column) {
  460. if (this.compare(row, column) == 0) {
  461. if (this.isEnd(row, column) || this.isStart(row, column)) {
  462. return false;
  463. } else {
  464. return true;
  465. }
  466. }
  467. return false;
  468. };
  469. this.insideStart = function(row, column) {
  470. if (this.compare(row, column) == 0) {
  471. if (this.isEnd(row, column)) {
  472. return false;
  473. } else {
  474. return true;
  475. }
  476. }
  477. return false;
  478. };
  479. this.insideEnd = function(row, column) {
  480. if (this.compare(row, column) == 0) {
  481. if (this.isStart(row, column)) {
  482. return false;
  483. } else {
  484. return true;
  485. }
  486. }
  487. return false;
  488. };
  489. this.compare = function(row, column) {
  490. if (!this.isMultiLine()) {
  491. if (row === this.start.row) {
  492. return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
  493. }
  494. }
  495. if (row < this.start.row)
  496. return -1;
  497. if (row > this.end.row)
  498. return 1;
  499. if (this.start.row === row)
  500. return column >= this.start.column ? 0 : -1;
  501. if (this.end.row === row)
  502. return column <= this.end.column ? 0 : 1;
  503. return 0;
  504. };
  505. this.compareStart = function(row, column) {
  506. if (this.start.row == row && this.start.column == column) {
  507. return -1;
  508. } else {
  509. return this.compare(row, column);
  510. }
  511. };
  512. this.compareEnd = function(row, column) {
  513. if (this.end.row == row && this.end.column == column) {
  514. return 1;
  515. } else {
  516. return this.compare(row, column);
  517. }
  518. };
  519. this.compareInside = function(row, column) {
  520. if (this.end.row == row && this.end.column == column) {
  521. return 1;
  522. } else if (this.start.row == row && this.start.column == column) {
  523. return -1;
  524. } else {
  525. return this.compare(row, column);
  526. }
  527. };
  528. this.clipRows = function(firstRow, lastRow) {
  529. if (this.end.row > lastRow)
  530. var end = {row: lastRow + 1, column: 0};
  531. else if (this.end.row < firstRow)
  532. var end = {row: firstRow, column: 0};
  533. if (this.start.row > lastRow)
  534. var start = {row: lastRow + 1, column: 0};
  535. else if (this.start.row < firstRow)
  536. var start = {row: firstRow, column: 0};
  537. return Range.fromPoints(start || this.start, end || this.end);
  538. };
  539. this.extend = function(row, column) {
  540. var cmp = this.compare(row, column);
  541. if (cmp == 0)
  542. return this;
  543. else if (cmp == -1)
  544. var start = {row: row, column: column};
  545. else
  546. var end = {row: row, column: column};
  547. return Range.fromPoints(start || this.start, end || this.end);
  548. };
  549. this.isEmpty = function() {
  550. return (this.start.row === this.end.row && this.start.column === this.end.column);
  551. };
  552. this.isMultiLine = function() {
  553. return (this.start.row !== this.end.row);
  554. };
  555. this.clone = function() {
  556. return Range.fromPoints(this.start, this.end);
  557. };
  558. this.collapseRows = function() {
  559. if (this.end.column == 0)
  560. return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
  561. else
  562. return new Range(this.start.row, 0, this.end.row, 0)
  563. };
  564. this.toScreenRange = function(session) {
  565. var screenPosStart = session.documentToScreenPosition(this.start);
  566. var screenPosEnd = session.documentToScreenPosition(this.end);
  567. return new Range(
  568. screenPosStart.row, screenPosStart.column,
  569. screenPosEnd.row, screenPosEnd.column
  570. );
  571. };
  572. this.moveBy = function(row, column) {
  573. this.start.row += row;
  574. this.start.column += column;
  575. this.end.row += row;
  576. this.end.column += column;
  577. };
  578. }).call(Range.prototype);
  579. Range.fromPoints = function(start, end) {
  580. return new Range(start.row, start.column, end.row, end.column);
  581. };
  582. Range.comparePoints = comparePoints;
  583. Range.comparePoints = function(p1, p2) {
  584. return p1.row - p2.row || p1.column - p2.column;
  585. };
  586. exports.Range = Range;
  587. });
  588. ace.define("ace/apply_delta",["require","exports","module"], function(require, exports, module) {
  589. "use strict";
  590. function throwDeltaError(delta, errorText){
  591. console.log("Invalid Delta:", delta);
  592. throw "Invalid Delta: " + errorText;
  593. }
  594. function positionInDocument(docLines, position) {
  595. return position.row >= 0 && position.row < docLines.length &&
  596. position.column >= 0 && position.column <= docLines[position.row].length;
  597. }
  598. function validateDelta(docLines, delta) {
  599. if (delta.action != "insert" && delta.action != "remove")
  600. throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
  601. if (!(delta.lines instanceof Array))
  602. throwDeltaError(delta, "delta.lines must be an Array");
  603. if (!delta.start || !delta.end)
  604. throwDeltaError(delta, "delta.start/end must be an present");
  605. var start = delta.start;
  606. if (!positionInDocument(docLines, delta.start))
  607. throwDeltaError(delta, "delta.start must be contained in document");
  608. var end = delta.end;
  609. if (delta.action == "remove" && !positionInDocument(docLines, end))
  610. throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
  611. var numRangeRows = end.row - start.row;
  612. var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
  613. if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
  614. throwDeltaError(delta, "delta.range must match delta lines");
  615. }
  616. exports.applyDelta = function(docLines, delta, doNotValidate) {
  617. var row = delta.start.row;
  618. var startColumn = delta.start.column;
  619. var line = docLines[row] || "";
  620. switch (delta.action) {
  621. case "insert":
  622. var lines = delta.lines;
  623. if (lines.length === 1) {
  624. docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
  625. } else {
  626. var args = [row, 1].concat(delta.lines);
  627. docLines.splice.apply(docLines, args);
  628. docLines[row] = line.substring(0, startColumn) + docLines[row];
  629. docLines[row + delta.lines.length - 1] += line.substring(startColumn);
  630. }
  631. break;
  632. case "remove":
  633. var endColumn = delta.end.column;
  634. var endRow = delta.end.row;
  635. if (row === endRow) {
  636. docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
  637. } else {
  638. docLines.splice(
  639. row, endRow - row + 1,
  640. line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
  641. );
  642. }
  643. break;
  644. }
  645. }
  646. });
  647. ace.define("ace/lib/event_emitter",["require","exports","module"], function(require, exports, module) {
  648. "use strict";
  649. var EventEmitter = {};
  650. var stopPropagation = function() { this.propagationStopped = true; };
  651. var preventDefault = function() { this.defaultPrevented = true; };
  652. EventEmitter._emit =
  653. EventEmitter._dispatchEvent = function(eventName, e) {
  654. this._eventRegistry || (this._eventRegistry = {});
  655. this._defaultHandlers || (this._defaultHandlers = {});
  656. var listeners = this._eventRegistry[eventName] || [];
  657. var defaultHandler = this._defaultHandlers[eventName];
  658. if (!listeners.length && !defaultHandler)
  659. return;
  660. if (typeof e != "object" || !e)
  661. e = {};
  662. if (!e.type)
  663. e.type = eventName;
  664. if (!e.stopPropagation)
  665. e.stopPropagation = stopPropagation;
  666. if (!e.preventDefault)
  667. e.preventDefault = preventDefault;
  668. listeners = listeners.slice();
  669. for (var i=0; i<listeners.length; i++) {
  670. listeners[i](e, this);
  671. if (e.propagationStopped)
  672. break;
  673. }
  674. if (defaultHandler && !e.defaultPrevented)
  675. return defaultHandler(e, this);
  676. };
  677. EventEmitter._signal = function(eventName, e) {
  678. var listeners = (this._eventRegistry || {})[eventName];
  679. if (!listeners)
  680. return;
  681. listeners = listeners.slice();
  682. for (var i=0; i<listeners.length; i++)
  683. listeners[i](e, this);
  684. };
  685. EventEmitter.once = function(eventName, callback) {
  686. var _self = this;
  687. callback && this.addEventListener(eventName, function newCallback() {
  688. _self.removeEventListener(eventName, newCallback);
  689. callback.apply(null, arguments);
  690. });
  691. };
  692. EventEmitter.setDefaultHandler = function(eventName, callback) {
  693. var handlers = this._defaultHandlers
  694. if (!handlers)
  695. handlers = this._defaultHandlers = {_disabled_: {}};
  696. if (handlers[eventName]) {
  697. var old = handlers[eventName];
  698. var disabled = handlers._disabled_[eventName];
  699. if (!disabled)
  700. handlers._disabled_[eventName] = disabled = [];
  701. disabled.push(old);
  702. var i = disabled.indexOf(callback);
  703. if (i != -1)
  704. disabled.splice(i, 1);
  705. }
  706. handlers[eventName] = callback;
  707. };
  708. EventEmitter.removeDefaultHandler = function(eventName, callback) {
  709. var handlers = this._defaultHandlers
  710. if (!handlers)
  711. return;
  712. var disabled = handlers._disabled_[eventName];
  713. if (handlers[eventName] == callback) {
  714. var old = handlers[eventName];
  715. if (disabled)
  716. this.setDefaultHandler(eventName, disabled.pop());
  717. } else if (disabled) {
  718. var i = disabled.indexOf(callback);
  719. if (i != -1)
  720. disabled.splice(i, 1);
  721. }
  722. };
  723. EventEmitter.on =
  724. EventEmitter.addEventListener = function(eventName, callback, capturing) {
  725. this._eventRegistry = this._eventRegistry || {};
  726. var listeners = this._eventRegistry[eventName];
  727. if (!listeners)
  728. listeners = this._eventRegistry[eventName] = [];
  729. if (listeners.indexOf(callback) == -1)
  730. listeners[capturing ? "unshift" : "push"](callback);
  731. return callback;
  732. };
  733. EventEmitter.off =
  734. EventEmitter.removeListener =
  735. EventEmitter.removeEventListener = function(eventName, callback) {
  736. this._eventRegistry = this._eventRegistry || {};
  737. var listeners = this._eventRegistry[eventName];
  738. if (!listeners)
  739. return;
  740. var index = listeners.indexOf(callback);
  741. if (index !== -1)
  742. listeners.splice(index, 1);
  743. };
  744. EventEmitter.removeAllListeners = function(eventName) {
  745. if (this._eventRegistry) this._eventRegistry[eventName] = [];
  746. };
  747. exports.EventEmitter = EventEmitter;
  748. });
  749. ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(require, exports, module) {
  750. "use strict";
  751. var oop = require("./lib/oop");
  752. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  753. var Anchor = exports.Anchor = function(doc, row, column) {
  754. this.$onChange = this.onChange.bind(this);
  755. this.attach(doc);
  756. if (typeof column == "undefined")
  757. this.setPosition(row.row, row.column);
  758. else
  759. this.setPosition(row, column);
  760. };
  761. (function() {
  762. oop.implement(this, EventEmitter);
  763. this.getPosition = function() {
  764. return this.$clipPositionToDocument(this.row, this.column);
  765. };
  766. this.getDocument = function() {
  767. return this.document;
  768. };
  769. this.$insertRight = false;
  770. this.onChange = function(delta) {
  771. if (delta.start.row == delta.end.row && delta.start.row != this.row)
  772. return;
  773. if (delta.start.row > this.row)
  774. return;
  775. var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
  776. this.setPosition(point.row, point.column, true);
  777. };
  778. function $pointsInOrder(point1, point2, equalPointsInOrder) {
  779. var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
  780. return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
  781. }
  782. function $getTransformedPoint(delta, point, moveIfEqual) {
  783. var deltaIsInsert = delta.action == "insert";
  784. var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
  785. var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
  786. var deltaStart = delta.start;
  787. var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
  788. if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
  789. return {
  790. row: point.row,
  791. column: point.column
  792. };
  793. }
  794. if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
  795. return {
  796. row: point.row + deltaRowShift,
  797. column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
  798. };
  799. }
  800. return {
  801. row: deltaStart.row,
  802. column: deltaStart.column
  803. };
  804. }
  805. this.setPosition = function(row, column, noClip) {
  806. var pos;
  807. if (noClip) {
  808. pos = {
  809. row: row,
  810. column: column
  811. };
  812. } else {
  813. pos = this.$clipPositionToDocument(row, column);
  814. }
  815. if (this.row == pos.row && this.column == pos.column)
  816. return;
  817. var old = {
  818. row: this.row,
  819. column: this.column
  820. };
  821. this.row = pos.row;
  822. this.column = pos.column;
  823. this._signal("change", {
  824. old: old,
  825. value: pos
  826. });
  827. };
  828. this.detach = function() {
  829. this.document.removeEventListener("change", this.$onChange);
  830. };
  831. this.attach = function(doc) {
  832. this.document = doc || this.document;
  833. this.document.on("change", this.$onChange);
  834. };
  835. this.$clipPositionToDocument = function(row, column) {
  836. var pos = {};
  837. if (row >= this.document.getLength()) {
  838. pos.row = Math.max(0, this.document.getLength() - 1);
  839. pos.column = this.document.getLine(pos.row).length;
  840. }
  841. else if (row < 0) {
  842. pos.row = 0;
  843. pos.column = 0;
  844. }
  845. else {
  846. pos.row = row;
  847. pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
  848. }
  849. if (column < 0)
  850. pos.column = 0;
  851. return pos;
  852. };
  853. }).call(Anchor.prototype);
  854. });
  855. ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"], function(require, exports, module) {
  856. "use strict";
  857. var oop = require("./lib/oop");
  858. var applyDelta = require("./apply_delta").applyDelta;
  859. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  860. var Range = require("./range").Range;
  861. var Anchor = require("./anchor").Anchor;
  862. var Document = function(textOrLines) {
  863. this.$lines = [""];
  864. if (textOrLines.length === 0) {
  865. this.$lines = [""];
  866. } else if (Array.isArray(textOrLines)) {
  867. this.insertMergedLines({row: 0, column: 0}, textOrLines);
  868. } else {
  869. this.insert({row: 0, column:0}, textOrLines);
  870. }
  871. };
  872. (function() {
  873. oop.implement(this, EventEmitter);
  874. this.setValue = function(text) {
  875. var len = this.getLength() - 1;
  876. this.remove(new Range(0, 0, len, this.getLine(len).length));
  877. this.insert({row: 0, column: 0}, text);
  878. };
  879. this.getValue = function() {
  880. return this.getAllLines().join(this.getNewLineCharacter());
  881. };
  882. this.createAnchor = function(row, column) {
  883. return new Anchor(this, row, column);
  884. };
  885. if ("aaa".split(/a/).length === 0) {
  886. this.$split = function(text) {
  887. return text.replace(/\r\n|\r/g, "\n").split("\n");
  888. };
  889. } else {
  890. this.$split = function(text) {
  891. return text.split(/\r\n|\r|\n/);
  892. };
  893. }
  894. this.$detectNewLine = function(text) {
  895. var match = text.match(/^.*?(\r\n|\r|\n)/m);
  896. this.$autoNewLine = match ? match[1] : "\n";
  897. this._signal("changeNewLineMode");
  898. };
  899. this.getNewLineCharacter = function() {
  900. switch (this.$newLineMode) {
  901. case "windows":
  902. return "\r\n";
  903. case "unix":
  904. return "\n";
  905. default:
  906. return this.$autoNewLine || "\n";
  907. }
  908. };
  909. this.$autoNewLine = "";
  910. this.$newLineMode = "auto";
  911. this.setNewLineMode = function(newLineMode) {
  912. if (this.$newLineMode === newLineMode)
  913. return;
  914. this.$newLineMode = newLineMode;
  915. this._signal("changeNewLineMode");
  916. };
  917. this.getNewLineMode = function() {
  918. return this.$newLineMode;
  919. };
  920. this.isNewLine = function(text) {
  921. return (text == "\r\n" || text == "\r" || text == "\n");
  922. };
  923. this.getLine = function(row) {
  924. return this.$lines[row] || "";
  925. };
  926. this.getLines = function(firstRow, lastRow) {
  927. return this.$lines.slice(firstRow, lastRow + 1);
  928. };
  929. this.getAllLines = function() {
  930. return this.getLines(0, this.getLength());
  931. };
  932. this.getLength = function() {
  933. return this.$lines.length;
  934. };
  935. this.getTextRange = function(range) {
  936. return this.getLinesForRange(range).join(this.getNewLineCharacter());
  937. };
  938. this.getLinesForRange = function(range) {
  939. var lines;
  940. if (range.start.row === range.end.row) {
  941. lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
  942. } else {
  943. lines = this.getLines(range.start.row, range.end.row);
  944. lines[0] = (lines[0] || "").substring(range.start.column);
  945. var l = lines.length - 1;
  946. if (range.end.row - range.start.row == l)
  947. lines[l] = lines[l].substring(0, range.end.column);
  948. }
  949. return lines;
  950. };
  951. this.insertLines = function(row, lines) {
  952. console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
  953. return this.insertFullLines(row, lines);
  954. };
  955. this.removeLines = function(firstRow, lastRow) {
  956. console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
  957. return this.removeFullLines(firstRow, lastRow);
  958. };
  959. this.insertNewLine = function(position) {
  960. console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
  961. return this.insertMergedLines(position, ["", ""]);
  962. };
  963. this.insert = function(position, text) {
  964. if (this.getLength() <= 1)
  965. this.$detectNewLine(text);
  966. return this.insertMergedLines(position, this.$split(text));
  967. };
  968. this.insertInLine = function(position, text) {
  969. var start = this.clippedPos(position.row, position.column);
  970. var end = this.pos(position.row, position.column + text.length);
  971. this.applyDelta({
  972. start: start,
  973. end: end,
  974. action: "insert",
  975. lines: [text]
  976. }, true);
  977. return this.clonePos(end);
  978. };
  979. this.clippedPos = function(row, column) {
  980. var length = this.getLength();
  981. if (row === undefined) {
  982. row = length;
  983. } else if (row < 0) {
  984. row = 0;
  985. } else if (row >= length) {
  986. row = length - 1;
  987. column = undefined;
  988. }
  989. var line = this.getLine(row);
  990. if (column == undefined)
  991. column = line.length;
  992. column = Math.min(Math.max(column, 0), line.length);
  993. return {row: row, column: column};
  994. };
  995. this.clonePos = function(pos) {
  996. return {row: pos.row, column: pos.column};
  997. };
  998. this.pos = function(row, column) {
  999. return {row: row, column: column};
  1000. };
  1001. this.$clipPosition = function(position) {
  1002. var length = this.getLength();
  1003. if (position.row >= length) {
  1004. position.row = Math.max(0, length - 1);
  1005. position.column = this.getLine(length - 1).length;
  1006. } else {
  1007. position.row = Math.max(0, position.row);
  1008. position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
  1009. }
  1010. return position;
  1011. };
  1012. this.insertFullLines = function(row, lines) {
  1013. row = Math.min(Math.max(row, 0), this.getLength());
  1014. var column = 0;
  1015. if (row < this.getLength()) {
  1016. lines = lines.concat([""]);
  1017. column = 0;
  1018. } else {
  1019. lines = [""].concat(lines);
  1020. row--;
  1021. column = this.$lines[row].length;
  1022. }
  1023. this.insertMergedLines({row: row, column: column}, lines);
  1024. };
  1025. this.insertMergedLines = function(position, lines) {
  1026. var start = this.clippedPos(position.row, position.column);
  1027. var end = {
  1028. row: start.row + lines.length - 1,
  1029. column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
  1030. };
  1031. this.applyDelta({
  1032. start: start,
  1033. end: end,
  1034. action: "insert",
  1035. lines: lines
  1036. });
  1037. return this.clonePos(end);
  1038. };
  1039. this.remove = function(range) {
  1040. var start = this.clippedPos(range.start.row, range.start.column);
  1041. var end = this.clippedPos(range.end.row, range.end.column);
  1042. this.applyDelta({
  1043. start: start,
  1044. end: end,
  1045. action: "remove",
  1046. lines: this.getLinesForRange({start: start, end: end})
  1047. });
  1048. return this.clonePos(start);
  1049. };
  1050. this.removeInLine = function(row, startColumn, endColumn) {
  1051. var start = this.clippedPos(row, startColumn);
  1052. var end = this.clippedPos(row, endColumn);
  1053. this.applyDelta({
  1054. start: start,
  1055. end: end,
  1056. action: "remove",
  1057. lines: this.getLinesForRange({start: start, end: end})
  1058. }, true);
  1059. return this.clonePos(start);
  1060. };
  1061. this.removeFullLines = function(firstRow, lastRow) {
  1062. firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
  1063. lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
  1064. var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
  1065. var deleteLastNewLine = lastRow < this.getLength() - 1;
  1066. var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
  1067. var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
  1068. var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
  1069. var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
  1070. var range = new Range(startRow, startCol, endRow, endCol);
  1071. var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
  1072. this.applyDelta({
  1073. start: range.start,
  1074. end: range.end,
  1075. action: "remove",
  1076. lines: this.getLinesForRange(range)
  1077. });
  1078. return deletedLines;
  1079. };
  1080. this.removeNewLine = function(row) {
  1081. if (row < this.getLength() - 1 && row >= 0) {
  1082. this.applyDelta({
  1083. start: this.pos(row, this.getLine(row).length),
  1084. end: this.pos(row + 1, 0),
  1085. action: "remove",
  1086. lines: ["", ""]
  1087. });
  1088. }
  1089. };
  1090. this.replace = function(range, text) {
  1091. if (!(range instanceof Range))
  1092. range = Range.fromPoints(range.start, range.end);
  1093. if (text.length === 0 && range.isEmpty())
  1094. return range.start;
  1095. if (text == this.getTextRange(range))
  1096. return range.end;
  1097. this.remove(range);
  1098. var end;
  1099. if (text) {
  1100. end = this.insert(range.start, text);
  1101. }
  1102. else {
  1103. end = range.start;
  1104. }
  1105. return end;
  1106. };
  1107. this.applyDeltas = function(deltas) {
  1108. for (var i=0; i<deltas.length; i++) {
  1109. this.applyDelta(deltas[i]);
  1110. }
  1111. };
  1112. this.revertDeltas = function(deltas) {
  1113. for (var i=deltas.length-1; i>=0; i--) {
  1114. this.revertDelta(deltas[i]);
  1115. }
  1116. };
  1117. this.applyDelta = function(delta, doNotValidate) {
  1118. var isInsert = delta.action == "insert";
  1119. if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
  1120. : !Range.comparePoints(delta.start, delta.end)) {
  1121. return;
  1122. }
  1123. if (isInsert && delta.lines.length > 20000)
  1124. this.$splitAndapplyLargeDelta(delta, 20000);
  1125. applyDelta(this.$lines, delta, doNotValidate);
  1126. this._signal("change", delta);
  1127. };
  1128. this.$splitAndapplyLargeDelta = function(delta, MAX) {
  1129. var lines = delta.lines;
  1130. var l = lines.length;
  1131. var row = delta.start.row;
  1132. var column = delta.start.column;
  1133. var from = 0, to = 0;
  1134. do {
  1135. from = to;
  1136. to += MAX - 1;
  1137. var chunk = lines.slice(from, to);
  1138. if (to > l) {
  1139. delta.lines = chunk;
  1140. delta.start.row = row + from;
  1141. delta.start.column = column;
  1142. break;
  1143. }
  1144. chunk.push("");
  1145. this.applyDelta({
  1146. start: this.pos(row + from, column),
  1147. end: this.pos(row + to, column = 0),
  1148. action: delta.action,
  1149. lines: chunk
  1150. }, true);
  1151. } while(true);
  1152. };
  1153. this.revertDelta = function(delta) {
  1154. this.applyDelta({
  1155. start: this.clonePos(delta.start),
  1156. end: this.clonePos(delta.end),
  1157. action: (delta.action == "insert" ? "remove" : "insert"),
  1158. lines: delta.lines.slice()
  1159. });
  1160. };
  1161. this.indexToPosition = function(index, startRow) {
  1162. var lines = this.$lines || this.getAllLines();
  1163. var newlineLength = this.getNewLineCharacter().length;
  1164. for (var i = startRow || 0, l = lines.length; i < l; i++) {
  1165. index -= lines[i].length + newlineLength;
  1166. if (index < 0)
  1167. return {row: i, column: index + lines[i].length + newlineLength};
  1168. }
  1169. return {row: l-1, column: lines[l-1].length};
  1170. };
  1171. this.positionToIndex = function(pos, startRow) {
  1172. var lines = this.$lines || this.getAllLines();
  1173. var newlineLength = this.getNewLineCharacter().length;
  1174. var index = 0;
  1175. var row = Math.min(pos.row, lines.length);
  1176. for (var i = startRow || 0; i < row; ++i)
  1177. index += lines[i].length + newlineLength;
  1178. return index + pos.column;
  1179. };
  1180. }).call(Document.prototype);
  1181. exports.Document = Document;
  1182. });
  1183. ace.define("ace/worker/mirror",["require","exports","module","ace/range","ace/document","ace/lib/lang"], function(require, exports, module) {
  1184. "use strict";
  1185. var Range = require("../range").Range;
  1186. var Document = require("../document").Document;
  1187. var lang = require("../lib/lang");
  1188. var Mirror = exports.Mirror = function(sender) {
  1189. this.sender = sender;
  1190. var doc = this.doc = new Document("");
  1191. var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
  1192. var _self = this;
  1193. sender.on("change", function(e) {
  1194. var data = e.data;
  1195. if (data[0].start) {
  1196. doc.applyDeltas(data);
  1197. } else {
  1198. for (var i = 0; i < data.length; i += 2) {
  1199. if (Array.isArray(data[i+1])) {
  1200. var d = {action: "insert", start: data[i], lines: data[i+1]};
  1201. } else {
  1202. var d = {action: "remove", start: data[i], end: data[i+1]};
  1203. }
  1204. doc.applyDelta(d, true);
  1205. }
  1206. }
  1207. if (_self.$timeout)
  1208. return deferredUpdate.schedule(_self.$timeout);
  1209. _self.onUpdate();
  1210. });
  1211. };
  1212. (function() {
  1213. this.$timeout = 500;
  1214. this.setTimeout = function(timeout) {
  1215. this.$timeout = timeout;
  1216. };
  1217. this.setValue = function(value) {
  1218. this.doc.setValue(value);
  1219. this.deferredUpdate.schedule(this.$timeout);
  1220. };
  1221. this.getValue = function(callbackId) {
  1222. this.sender.callback(this.doc.getValue(), callbackId);
  1223. };
  1224. this.onUpdate = function() {
  1225. };
  1226. this.isPending = function() {
  1227. return this.deferredUpdate.isPending();
  1228. };
  1229. }).call(Mirror.prototype);
  1230. });
  1231. ace.define("ace/mode/html/saxparser",["require","exports","module"], function(require, exports, module) {
  1232. 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})({
  1233. 1:[function(_dereq_,module,exports){
  1234. function isScopeMarker(node) {
  1235. if (node.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1236. return node.localName === "applet"
  1237. || node.localName === "caption"
  1238. || node.localName === "marquee"
  1239. || node.localName === "object"
  1240. || node.localName === "table"
  1241. || node.localName === "td"
  1242. || node.localName === "th";
  1243. }
  1244. if (node.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1245. return node.localName === "mi"
  1246. || node.localName === "mo"
  1247. || node.localName === "mn"
  1248. || node.localName === "ms"
  1249. || node.localName === "mtext"
  1250. || node.localName === "annotation-xml";
  1251. }
  1252. if (node.namespaceURI === "http://www.w3.org/2000/svg") {
  1253. return node.localName === "foreignObject"
  1254. || node.localName === "desc"
  1255. || node.localName === "title";
  1256. }
  1257. }
  1258. function isListItemScopeMarker(node) {
  1259. return isScopeMarker(node)
  1260. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ol')
  1261. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ul');
  1262. }
  1263. function isTableScopeMarker(node) {
  1264. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'table')
  1265. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1266. }
  1267. function isTableBodyScopeMarker(node) {
  1268. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tbody')
  1269. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tfoot')
  1270. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'thead')
  1271. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1272. }
  1273. function isTableRowScopeMarker(node) {
  1274. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tr')
  1275. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1276. }
  1277. function isButtonScopeMarker(node) {
  1278. return isScopeMarker(node)
  1279. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'button');
  1280. }
  1281. function isSelectScopeMarker(node) {
  1282. return !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'optgroup')
  1283. && !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'option');
  1284. }
  1285. function ElementStack() {
  1286. this.elements = [];
  1287. this.rootNode = null;
  1288. this.headElement = null;
  1289. this.bodyElement = null;
  1290. }
  1291. ElementStack.prototype._inScope = function(localName, isMarker) {
  1292. for (var i = this.elements.length - 1; i >= 0; i--) {
  1293. var node = this.elements[i];
  1294. if (node.localName === localName)
  1295. return true;
  1296. if (isMarker(node))
  1297. return false;
  1298. }
  1299. };
  1300. ElementStack.prototype.push = function(item) {
  1301. this.elements.push(item);
  1302. };
  1303. ElementStack.prototype.pushHtmlElement = function(item) {
  1304. this.rootNode = item.node;
  1305. this.push(item);
  1306. };
  1307. ElementStack.prototype.pushHeadElement = function(item) {
  1308. this.headElement = item.node;
  1309. this.push(item);
  1310. };
  1311. ElementStack.prototype.pushBodyElement = function(item) {
  1312. this.bodyElement = item.node;
  1313. this.push(item);
  1314. };
  1315. ElementStack.prototype.pop = function() {
  1316. return this.elements.pop();
  1317. };
  1318. ElementStack.prototype.remove = function(item) {
  1319. this.elements.splice(this.elements.indexOf(item), 1);
  1320. };
  1321. ElementStack.prototype.popUntilPopped = function(localName) {
  1322. var element;
  1323. do {
  1324. element = this.pop();
  1325. } while (element.localName != localName);
  1326. };
  1327. ElementStack.prototype.popUntilTableScopeMarker = function() {
  1328. while (!isTableScopeMarker(this.top))
  1329. this.pop();
  1330. };
  1331. ElementStack.prototype.popUntilTableBodyScopeMarker = function() {
  1332. while (!isTableBodyScopeMarker(this.top))
  1333. this.pop();
  1334. };
  1335. ElementStack.prototype.popUntilTableRowScopeMarker = function() {
  1336. while (!isTableRowScopeMarker(this.top))
  1337. this.pop();
  1338. };
  1339. ElementStack.prototype.item = function(index) {
  1340. return this.elements[index];
  1341. };
  1342. ElementStack.prototype.contains = function(element) {
  1343. return this.elements.indexOf(element) !== -1;
  1344. };
  1345. ElementStack.prototype.inScope = function(localName) {
  1346. return this._inScope(localName, isScopeMarker);
  1347. };
  1348. ElementStack.prototype.inListItemScope = function(localName) {
  1349. return this._inScope(localName, isListItemScopeMarker);
  1350. };
  1351. ElementStack.prototype.inTableScope = function(localName) {
  1352. return this._inScope(localName, isTableScopeMarker);
  1353. };
  1354. ElementStack.prototype.inButtonScope = function(localName) {
  1355. return this._inScope(localName, isButtonScopeMarker);
  1356. };
  1357. ElementStack.prototype.inSelectScope = function(localName) {
  1358. return this._inScope(localName, isSelectScopeMarker);
  1359. };
  1360. ElementStack.prototype.hasNumberedHeaderElementInScope = function() {
  1361. for (var i = this.elements.length - 1; i >= 0; i--) {
  1362. var node = this.elements[i];
  1363. if (node.isNumberedHeader())
  1364. return true;
  1365. if (isScopeMarker(node))
  1366. return false;
  1367. }
  1368. };
  1369. ElementStack.prototype.furthestBlockForFormattingElement = function(element) {
  1370. var furthestBlock = null;
  1371. for (var i = this.elements.length - 1; i >= 0; i--) {
  1372. var node = this.elements[i];
  1373. if (node.node === element)
  1374. break;
  1375. if (node.isSpecial())
  1376. furthestBlock = node;
  1377. }
  1378. return furthestBlock;
  1379. };
  1380. ElementStack.prototype.findIndex = function(localName) {
  1381. for (var i = this.elements.length - 1; i >= 0; i--) {
  1382. if (this.elements[i].localName == localName)
  1383. return i;
  1384. }
  1385. return -1;
  1386. };
  1387. ElementStack.prototype.remove_openElements_until = function(callback) {
  1388. var finished = false;
  1389. var element;
  1390. while (!finished) {
  1391. element = this.elements.pop();
  1392. finished = callback(element);
  1393. }
  1394. return element;
  1395. };
  1396. Object.defineProperty(ElementStack.prototype, 'top', {
  1397. get: function() {
  1398. return this.elements[this.elements.length - 1];
  1399. }
  1400. });
  1401. Object.defineProperty(ElementStack.prototype, 'length', {
  1402. get: function() {
  1403. return this.elements.length;
  1404. }
  1405. });
  1406. exports.ElementStack = ElementStack;
  1407. },
  1408. {}],
  1409. 2:[function(_dereq_,module,exports){
  1410. var entities = _dereq_('html5-entities');
  1411. var InputStream = _dereq_('./InputStream').InputStream;
  1412. var namedEntityPrefixes = {};
  1413. Object.keys(entities).forEach(function (entityKey) {
  1414. for (var i = 0; i < entityKey.length; i++) {
  1415. namedEntityPrefixes[entityKey.substring(0, i + 1)] = true;
  1416. }
  1417. });
  1418. function isAlphaNumeric(c) {
  1419. return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
  1420. }
  1421. function isHexDigit(c) {
  1422. return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
  1423. }
  1424. function isDecimalDigit(c) {
  1425. return (c >= '0' && c <= '9');
  1426. }
  1427. var EntityParser = {};
  1428. EntityParser.consumeEntity = function(buffer, tokenizer, additionalAllowedCharacter) {
  1429. var decodedCharacter = '';
  1430. var consumedCharacters = '';
  1431. var ch = buffer.char();
  1432. if (ch === InputStream.EOF)
  1433. return false;
  1434. consumedCharacters += ch;
  1435. if (ch == '\t' || ch == '\n' || ch == '\v' || ch == ' ' || ch == '<' || ch == '&') {
  1436. buffer.unget(consumedCharacters);
  1437. return false;
  1438. }
  1439. if (additionalAllowedCharacter === ch) {
  1440. buffer.unget(consumedCharacters);
  1441. return false;
  1442. }
  1443. if (ch == '#') {
  1444. ch = buffer.shift(1);
  1445. if (ch === InputStream.EOF) {
  1446. tokenizer._parseError("expected-numeric-entity-but-got-eof");
  1447. buffer.unget(consumedCharacters);
  1448. return false;
  1449. }
  1450. consumedCharacters += ch;
  1451. var radix = 10;
  1452. var isDigit = isDecimalDigit;
  1453. if (ch == 'x' || ch == 'X') {
  1454. radix = 16;
  1455. isDigit = isHexDigit;
  1456. ch = buffer.shift(1);
  1457. if (ch === InputStream.EOF) {
  1458. tokenizer._parseError("expected-numeric-entity-but-got-eof");
  1459. buffer.unget(consumedCharacters);
  1460. return false;
  1461. }
  1462. consumedCharacters += ch;
  1463. }
  1464. if (isDigit(ch)) {
  1465. var code = '';
  1466. while (ch !== InputStream.EOF && isDigit(ch)) {
  1467. code += ch;
  1468. ch = buffer.char();
  1469. }
  1470. code = parseInt(code, radix);
  1471. var replacement = this.replaceEntityNumbers(code);
  1472. if (replacement) {
  1473. tokenizer._parseError("invalid-numeric-entity-replaced");
  1474. code = replacement;
  1475. }
  1476. if (code > 0xFFFF && code <= 0x10FFFF) {
  1477. code -= 0x10000;
  1478. var first = ((0xffc00 & code) >> 10) + 0xD800;
  1479. var second = (0x3ff & code) + 0xDC00;
  1480. decodedCharacter = String.fromCharCode(first, second);
  1481. } else
  1482. decodedCharacter = String.fromCharCode(code);
  1483. if (ch !== ';') {
  1484. tokenizer._parseError("numeric-entity-without-semicolon");
  1485. buffer.unget(ch);
  1486. }
  1487. return decodedCharacter;
  1488. }
  1489. buffer.unget(consumedCharacters);
  1490. tokenizer._parseError("expected-numeric-entity");
  1491. return false;
  1492. }
  1493. if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
  1494. var mostRecentMatch = '';
  1495. while (namedEntityPrefixes[consumedCharacters]) {
  1496. if (entities[consumedCharacters]) {
  1497. mostRecentMatch = consumedCharacters;
  1498. }
  1499. if (ch == ';')
  1500. break;
  1501. ch = buffer.char();
  1502. if (ch === InputStream.EOF)
  1503. break;
  1504. consumedCharacters += ch;
  1505. }
  1506. if (!mostRecentMatch) {
  1507. tokenizer._parseError("expected-named-entity");
  1508. buffer.unget(consumedCharacters);
  1509. return false;
  1510. }
  1511. decodedCharacter = entities[mostRecentMatch];
  1512. if (ch === ';' || !additionalAllowedCharacter || !(isAlphaNumeric(ch) || ch === '=')) {
  1513. if (consumedCharacters.length > mostRecentMatch.length) {
  1514. buffer.unget(consumedCharacters.substring(mostRecentMatch.length));
  1515. }
  1516. if (ch !== ';') {
  1517. tokenizer._parseError("named-entity-without-semicolon");
  1518. }
  1519. return decodedCharacter;
  1520. }
  1521. buffer.unget(consumedCharacters);
  1522. return false;
  1523. }
  1524. };
  1525. EntityParser.replaceEntityNumbers = function(c) {
  1526. switch(c) {
  1527. case 0x00: return 0xFFFD; // REPLACEMENT CHARACTER
  1528. case 0x13: return 0x0010; // Carriage return
  1529. case 0x80: return 0x20AC; // EURO SIGN
  1530. case 0x81: return 0x0081; // <control>
  1531. case 0x82: return 0x201A; // SINGLE LOW-9 QUOTATION MARK
  1532. case 0x83: return 0x0192; // LATIN SMALL LETTER F WITH HOOK
  1533. case 0x84: return 0x201E; // DOUBLE LOW-9 QUOTATION MARK
  1534. case 0x85: return 0x2026; // HORIZONTAL ELLIPSIS
  1535. case 0x86: return 0x2020; // DAGGER
  1536. case 0x87: return 0x2021; // DOUBLE DAGGER
  1537. case 0x88: return 0x02C6; // MODIFIER LETTER CIRCUMFLEX ACCENT
  1538. case 0x89: return 0x2030; // PER MILLE SIGN
  1539. case 0x8A: return 0x0160; // LATIN CAPITAL LETTER S WITH CARON
  1540. case 0x8B: return 0x2039; // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
  1541. case 0x8C: return 0x0152; // LATIN CAPITAL LIGATURE OE
  1542. case 0x8D: return 0x008D; // <control>
  1543. case 0x8E: return 0x017D; // LATIN CAPITAL LETTER Z WITH CARON
  1544. case 0x8F: return 0x008F; // <control>
  1545. case 0x90: return 0x0090; // <control>
  1546. case 0x91: return 0x2018; // LEFT SINGLE QUOTATION MARK
  1547. case 0x92: return 0x2019; // RIGHT SINGLE QUOTATION MARK
  1548. case 0x93: return 0x201C; // LEFT DOUBLE QUOTATION MARK
  1549. case 0x94: return 0x201D; // RIGHT DOUBLE QUOTATION MARK
  1550. case 0x95: return 0x2022; // BULLET
  1551. case 0x96: return 0x2013; // EN DASH
  1552. case 0x97: return 0x2014; // EM DASH
  1553. case 0x98: return 0x02DC; // SMALL TILDE
  1554. case 0x99: return 0x2122; // TRADE MARK SIGN
  1555. case 0x9A: return 0x0161; // LATIN SMALL LETTER S WITH CARON
  1556. case 0x9B: return 0x203A; // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
  1557. case 0x9C: return 0x0153; // LATIN SMALL LIGATURE OE
  1558. case 0x9D: return 0x009D; // <control>
  1559. case 0x9E: return 0x017E; // LATIN SMALL LETTER Z WITH CARON
  1560. case 0x9F: return 0x0178; // LATIN CAPITAL LETTER Y WITH DIAERESIS
  1561. default:
  1562. if ((c >= 0xD800 && c <= 0xDFFF) || c > 0x10FFFF) {
  1563. return 0xFFFD;
  1564. } else if ((c >= 0x0001 && c <= 0x0008) || (c >= 0x000E && c <= 0x001F) ||
  1565. (c >= 0x007F && c <= 0x009F) || (c >= 0xFDD0 && c <= 0xFDEF) ||
  1566. c == 0x000B || c == 0xFFFE || c == 0x1FFFE || c == 0x2FFFFE ||
  1567. c == 0x2FFFF || c == 0x3FFFE || c == 0x3FFFF || c == 0x4FFFE ||
  1568. c == 0x4FFFF || c == 0x5FFFE || c == 0x5FFFF || c == 0x6FFFE ||
  1569. c == 0x6FFFF || c == 0x7FFFE || c == 0x7FFFF || c == 0x8FFFE ||
  1570. c == 0x8FFFF || c == 0x9FFFE || c == 0x9FFFF || c == 0xAFFFE ||
  1571. c == 0xAFFFF || c == 0xBFFFE || c == 0xBFFFF || c == 0xCFFFE ||
  1572. c == 0xCFFFF || c == 0xDFFFE || c == 0xDFFFF || c == 0xEFFFE ||
  1573. c == 0xEFFFF || c == 0xFFFFE || c == 0xFFFFF || c == 0x10FFFE ||
  1574. c == 0x10FFFF) {
  1575. return c;
  1576. }
  1577. }
  1578. };
  1579. exports.EntityParser = EntityParser;
  1580. },
  1581. {"./InputStream":3,"html5-entities":12}],
  1582. 3:[function(_dereq_,module,exports){
  1583. function InputStream() {
  1584. this.data = '';
  1585. this.start = 0;
  1586. this.committed = 0;
  1587. this.eof = false;
  1588. this.lastLocation = {line: 0, column: 0};
  1589. }
  1590. InputStream.EOF = -1;
  1591. InputStream.DRAIN = -2;
  1592. InputStream.prototype = {
  1593. slice: function() {
  1594. if(this.start >= this.data.length) {
  1595. if(!this.eof) throw InputStream.DRAIN;
  1596. return InputStream.EOF;
  1597. }
  1598. return this.data.slice(this.start, this.data.length);
  1599. },
  1600. char: function() {
  1601. if(!this.eof && this.start >= this.data.length - 1) throw InputStream.DRAIN;
  1602. if(this.start >= this.data.length) {
  1603. return InputStream.EOF;
  1604. }
  1605. var ch = this.data[this.start++];
  1606. if (ch === '\r')
  1607. ch = '\n';
  1608. return ch;
  1609. },
  1610. advance: function(amount) {
  1611. this.start += amount;
  1612. if(this.start >= this.data.length) {
  1613. if(!this.eof) throw InputStream.DRAIN;
  1614. return InputStream.EOF;
  1615. } else {
  1616. if(this.committed > this.data.length / 2) {
  1617. this.lastLocation = this.location();
  1618. this.data = this.data.slice(this.committed);
  1619. this.start = this.start - this.committed;
  1620. this.committed = 0;
  1621. }
  1622. }
  1623. },
  1624. matchWhile: function(re) {
  1625. if(this.eof && this.start >= this.data.length ) return '';
  1626. var r = new RegExp("^"+re+"+");
  1627. var m = r.exec(this.slice());
  1628. if(m) {
  1629. if(!this.eof && m[0].length == this.data.length - this.start) throw InputStream.DRAIN;
  1630. this.advance(m[0].length);
  1631. return m[0];
  1632. } else {
  1633. return '';
  1634. }
  1635. },
  1636. matchUntil: function(re) {
  1637. var m, s;
  1638. s = this.slice();
  1639. if(s === InputStream.EOF) {
  1640. return '';
  1641. } else if(m = new RegExp(re + (this.eof ? "|$" : "")).exec(s)) {
  1642. var t = this.data.slice(this.start, this.start + m.index);
  1643. this.advance(m.index);
  1644. return t.replace(/\r/g, '\n').replace(/\n{2,}/g, '\n');
  1645. } else {
  1646. throw InputStream.DRAIN;
  1647. }
  1648. },
  1649. append: function(data) {
  1650. this.data += data;
  1651. },
  1652. shift: function(n) {
  1653. if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN;
  1654. if(this.eof && this.start >= this.data.length) return InputStream.EOF;
  1655. var d = this.data.slice(this.start, this.start + n).toString();
  1656. this.advance(Math.min(n, this.data.length - this.start));
  1657. return d;
  1658. },
  1659. peek: function(n) {
  1660. if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN;
  1661. if(this.eof && this.start >= this.data.length) return InputStream.EOF;
  1662. return this.data.slice(this.start, Math.min(this.start + n, this.data.length)).toString();
  1663. },
  1664. length: function() {
  1665. return this.data.length - this.start - 1;
  1666. },
  1667. unget: function(d) {
  1668. if(d === InputStream.EOF) return;
  1669. this.start -= (d.length);
  1670. },
  1671. undo: function() {
  1672. this.start = this.committed;
  1673. },
  1674. commit: function() {
  1675. this.committed = this.start;
  1676. },
  1677. location: function() {
  1678. var lastLine = this.lastLocation.line;
  1679. var lastColumn = this.lastLocation.column;
  1680. var read = this.data.slice(0, this.committed);
  1681. var newlines = read.match(/\n/g);
  1682. var line = newlines ? lastLine + newlines.length : lastLine;
  1683. var column = newlines ? read.length - read.lastIndexOf('\n') - 1 : lastColumn + read.length;
  1684. return {line: line, column: column};
  1685. }
  1686. };
  1687. exports.InputStream = InputStream;
  1688. },
  1689. {}],
  1690. 4:[function(_dereq_,module,exports){
  1691. var SpecialElements = {
  1692. "http://www.w3.org/1999/xhtml": [
  1693. 'address',
  1694. 'applet',
  1695. 'area',
  1696. 'article',
  1697. 'aside',
  1698. 'base',
  1699. 'basefont',
  1700. 'bgsound',
  1701. 'blockquote',
  1702. 'body',
  1703. 'br',
  1704. 'button',
  1705. 'caption',
  1706. 'center',
  1707. 'col',
  1708. 'colgroup',
  1709. 'dd',
  1710. 'details',
  1711. 'dir',
  1712. 'div',
  1713. 'dl',
  1714. 'dt',
  1715. 'embed',
  1716. 'fieldset',
  1717. 'figcaption',
  1718. 'figure',
  1719. 'footer',
  1720. 'form',
  1721. 'frame',
  1722. 'frameset',
  1723. 'h1',
  1724. 'h2',
  1725. 'h3',
  1726. 'h4',
  1727. 'h5',
  1728. 'h6',
  1729. 'head',
  1730. 'header',
  1731. 'hgroup',
  1732. 'hr',
  1733. 'html',
  1734. 'iframe',
  1735. 'img',
  1736. 'input',
  1737. 'isindex',
  1738. 'li',
  1739. 'link',
  1740. 'listing',
  1741. 'main',
  1742. 'marquee',
  1743. 'menu',
  1744. 'menuitem',
  1745. 'meta',
  1746. 'nav',
  1747. 'noembed',
  1748. 'noframes',
  1749. 'noscript',
  1750. 'object',
  1751. 'ol',
  1752. 'p',
  1753. 'param',
  1754. 'plaintext',
  1755. 'pre',
  1756. 'script',
  1757. 'section',
  1758. 'select',
  1759. 'source',
  1760. 'style',
  1761. 'summary',
  1762. 'table',
  1763. 'tbody',
  1764. 'td',
  1765. 'textarea',
  1766. 'tfoot',
  1767. 'th',
  1768. 'thead',
  1769. 'title',
  1770. 'tr',
  1771. 'track',
  1772. 'ul',
  1773. 'wbr',
  1774. 'xmp'
  1775. ],
  1776. "http://www.w3.org/1998/Math/MathML": [
  1777. 'mi',
  1778. 'mo',
  1779. 'mn',
  1780. 'ms',
  1781. 'mtext',
  1782. 'annotation-xml'
  1783. ],
  1784. "http://www.w3.org/2000/svg": [
  1785. 'foreignObject',
  1786. 'desc',
  1787. 'title'
  1788. ]
  1789. };
  1790. function StackItem(namespaceURI, localName, attributes, node) {
  1791. this.localName = localName;
  1792. this.namespaceURI = namespaceURI;
  1793. this.attributes = attributes;
  1794. this.node = node;
  1795. }
  1796. StackItem.prototype.isSpecial = function() {
  1797. return this.namespaceURI in SpecialElements &&
  1798. SpecialElements[this.namespaceURI].indexOf(this.localName) > -1;
  1799. };
  1800. StackItem.prototype.isFosterParenting = function() {
  1801. if (this.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1802. return this.localName === 'table' ||
  1803. this.localName === 'tbody' ||
  1804. this.localName === 'tfoot' ||
  1805. this.localName === 'thead' ||
  1806. this.localName === 'tr';
  1807. }
  1808. return false;
  1809. };
  1810. StackItem.prototype.isNumberedHeader = function() {
  1811. if (this.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1812. return this.localName === 'h1' ||
  1813. this.localName === 'h2' ||
  1814. this.localName === 'h3' ||
  1815. this.localName === 'h4' ||
  1816. this.localName === 'h5' ||
  1817. this.localName === 'h6';
  1818. }
  1819. return false;
  1820. };
  1821. StackItem.prototype.isForeign = function() {
  1822. return this.namespaceURI != "http://www.w3.org/1999/xhtml";
  1823. };
  1824. function getAttribute(item, name) {
  1825. for (var i = 0; i < item.attributes.length; i++) {
  1826. if (item.attributes[i].nodeName == name)
  1827. return item.attributes[i].nodeValue;
  1828. }
  1829. return null;
  1830. }
  1831. StackItem.prototype.isHtmlIntegrationPoint = function() {
  1832. if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1833. if (this.localName !== "annotation-xml")
  1834. return false;
  1835. var encoding = getAttribute(this, 'encoding');
  1836. if (!encoding)
  1837. return false;
  1838. encoding = encoding.toLowerCase();
  1839. return encoding === "text/html" || encoding === "application/xhtml+xml";
  1840. }
  1841. if (this.namespaceURI === "http://www.w3.org/2000/svg") {
  1842. return this.localName === "foreignObject"
  1843. || this.localName === "desc"
  1844. || this.localName === "title";
  1845. }
  1846. return false;
  1847. };
  1848. StackItem.prototype.isMathMLTextIntegrationPoint = function() {
  1849. if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1850. return this.localName === "mi"
  1851. || this.localName === "mo"
  1852. || this.localName === "mn"
  1853. || this.localName === "ms"
  1854. || this.localName === "mtext";
  1855. }
  1856. return false;
  1857. };
  1858. exports.StackItem = StackItem;
  1859. },
  1860. {}],
  1861. 5:[function(_dereq_,module,exports){
  1862. var InputStream = _dereq_('./InputStream').InputStream;
  1863. var EntityParser = _dereq_('./EntityParser').EntityParser;
  1864. function isWhitespace(c){
  1865. return c === " " || c === "\n" || c === "\t" || c === "\r" || c === "\f";
  1866. }
  1867. function isAlpha(c) {
  1868. return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
  1869. }
  1870. function Tokenizer(tokenHandler) {
  1871. this._tokenHandler = tokenHandler;
  1872. this._state = Tokenizer.DATA;
  1873. this._inputStream = new InputStream();
  1874. this._currentToken = null;
  1875. this._temporaryBuffer = '';
  1876. this._additionalAllowedCharacter = '';
  1877. }
  1878. Tokenizer.prototype._parseError = function(code, args) {
  1879. this._tokenHandler.parseError(code, args);
  1880. };
  1881. Tokenizer.prototype._emitToken = function(token) {
  1882. if (token.type === 'StartTag') {
  1883. for (var i = 1; i < token.data.length; i++) {
  1884. if (!token.data[i].nodeName)
  1885. token.data.splice(i--, 1);
  1886. }
  1887. } else if (token.type === 'EndTag') {
  1888. if (token.selfClosing) {
  1889. this._parseError('self-closing-flag-on-end-tag');
  1890. }
  1891. if (token.data.length !== 0) {
  1892. this._parseError('attributes-in-end-tag');
  1893. }
  1894. }
  1895. this._tokenHandler.processToken(token);
  1896. if (token.type === 'StartTag' && token.selfClosing && !this._tokenHandler.isSelfClosingFlagAcknowledged()) {
  1897. this._parseError('non-void-element-with-trailing-solidus', {name: token.name});
  1898. }
  1899. };
  1900. Tokenizer.prototype._emitCurrentToken = function() {
  1901. this._state = Tokenizer.DATA;
  1902. this._emitToken(this._currentToken);
  1903. };
  1904. Tokenizer.prototype._currentAttribute = function() {
  1905. return this._currentToken.data[this._currentToken.data.length - 1];
  1906. };
  1907. Tokenizer.prototype.setState = function(state) {
  1908. this._state = state;
  1909. };
  1910. Tokenizer.prototype.tokenize = function(source) {
  1911. Tokenizer.DATA = data_state;
  1912. Tokenizer.RCDATA = rcdata_state;
  1913. Tokenizer.RAWTEXT = rawtext_state;
  1914. Tokenizer.SCRIPT_DATA = script_data_state;
  1915. Tokenizer.PLAINTEXT = plaintext_state;
  1916. this._state = Tokenizer.DATA;
  1917. this._inputStream.append(source);
  1918. this._tokenHandler.startTokenization(this);
  1919. this._inputStream.eof = true;
  1920. var tokenizer = this;
  1921. while (this._state.call(this, this._inputStream));
  1922. function data_state(buffer) {
  1923. var data = buffer.char();
  1924. if (data === InputStream.EOF) {
  1925. tokenizer._emitToken({type: 'EOF', data: null});
  1926. return false;
  1927. } else if (data === '&') {
  1928. tokenizer.setState(character_reference_in_data_state);
  1929. } else if (data === '<') {
  1930. tokenizer.setState(tag_open_state);
  1931. } else if (data === '\u0000') {
  1932. tokenizer._emitToken({type: 'Characters', data: data});
  1933. buffer.commit();
  1934. } else {
  1935. var chars = buffer.matchUntil("&|<|\u0000");
  1936. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1937. buffer.commit();
  1938. }
  1939. return true;
  1940. }
  1941. function character_reference_in_data_state(buffer) {
  1942. var character = EntityParser.consumeEntity(buffer, tokenizer);
  1943. tokenizer.setState(data_state);
  1944. tokenizer._emitToken({type: 'Characters', data: character || '&'});
  1945. return true;
  1946. }
  1947. function rcdata_state(buffer) {
  1948. var data = buffer.char();
  1949. if (data === InputStream.EOF) {
  1950. tokenizer._emitToken({type: 'EOF', data: null});
  1951. return false;
  1952. } else if (data === '&') {
  1953. tokenizer.setState(character_reference_in_rcdata_state);
  1954. } else if (data === '<') {
  1955. tokenizer.setState(rcdata_less_than_sign_state);
  1956. } else if (data === "\u0000") {
  1957. tokenizer._parseError("invalid-codepoint");
  1958. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  1959. buffer.commit();
  1960. } else {
  1961. var chars = buffer.matchUntil("&|<|\u0000");
  1962. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1963. buffer.commit();
  1964. }
  1965. return true;
  1966. }
  1967. function character_reference_in_rcdata_state(buffer) {
  1968. var character = EntityParser.consumeEntity(buffer, tokenizer);
  1969. tokenizer.setState(rcdata_state);
  1970. tokenizer._emitToken({type: 'Characters', data: character || '&'});
  1971. return true;
  1972. }
  1973. function rawtext_state(buffer) {
  1974. var data = buffer.char();
  1975. if (data === InputStream.EOF) {
  1976. tokenizer._emitToken({type: 'EOF', data: null});
  1977. return false;
  1978. } else if (data === '<') {
  1979. tokenizer.setState(rawtext_less_than_sign_state);
  1980. } else if (data === "\u0000") {
  1981. tokenizer._parseError("invalid-codepoint");
  1982. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  1983. buffer.commit();
  1984. } else {
  1985. var chars = buffer.matchUntil("<|\u0000");
  1986. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1987. }
  1988. return true;
  1989. }
  1990. function plaintext_state(buffer) {
  1991. var data = buffer.char();
  1992. if (data === InputStream.EOF) {
  1993. tokenizer._emitToken({type: 'EOF', data: null});
  1994. return false;
  1995. } else if (data === "\u0000") {
  1996. tokenizer._parseError("invalid-codepoint");
  1997. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  1998. buffer.commit();
  1999. } else {
  2000. var chars = buffer.matchUntil("\u0000");
  2001. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2002. }
  2003. return true;
  2004. }
  2005. function script_data_state(buffer) {
  2006. var data = buffer.char();
  2007. if (data === InputStream.EOF) {
  2008. tokenizer._emitToken({type: 'EOF', data: null});
  2009. return false;
  2010. } else if (data === '<') {
  2011. tokenizer.setState(script_data_less_than_sign_state);
  2012. } else if (data === '\u0000') {
  2013. tokenizer._parseError("invalid-codepoint");
  2014. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2015. buffer.commit();
  2016. } else {
  2017. var chars = buffer.matchUntil("<|\u0000");
  2018. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2019. }
  2020. return true;
  2021. }
  2022. function rcdata_less_than_sign_state(buffer) {
  2023. var data = buffer.char();
  2024. if (data === "/") {
  2025. this._temporaryBuffer = '';
  2026. tokenizer.setState(rcdata_end_tag_open_state);
  2027. } else {
  2028. tokenizer._emitToken({type: 'Characters', data: '<'});
  2029. buffer.unget(data);
  2030. tokenizer.setState(rcdata_state);
  2031. }
  2032. return true;
  2033. }
  2034. function rcdata_end_tag_open_state(buffer) {
  2035. var data = buffer.char();
  2036. if (isAlpha(data)) {
  2037. this._temporaryBuffer += data;
  2038. tokenizer.setState(rcdata_end_tag_name_state);
  2039. } else {
  2040. tokenizer._emitToken({type: 'Characters', data: '</'});
  2041. buffer.unget(data);
  2042. tokenizer.setState(rcdata_state);
  2043. }
  2044. return true;
  2045. }
  2046. function rcdata_end_tag_name_state(buffer) {
  2047. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2048. var data = buffer.char();
  2049. if (isWhitespace(data) && appropriate) {
  2050. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2051. tokenizer.setState(before_attribute_name_state);
  2052. } else if (data === '/' && appropriate) {
  2053. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2054. tokenizer.setState(self_closing_tag_state);
  2055. } else if (data === '>' && appropriate) {
  2056. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2057. tokenizer._emitCurrentToken();
  2058. tokenizer.setState(data_state);
  2059. } else if (isAlpha(data)) {
  2060. this._temporaryBuffer += data;
  2061. buffer.commit();
  2062. } else {
  2063. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2064. buffer.unget(data);
  2065. tokenizer.setState(rcdata_state);
  2066. }
  2067. return true;
  2068. }
  2069. function rawtext_less_than_sign_state(buffer) {
  2070. var data = buffer.char();
  2071. if (data === "/") {
  2072. this._temporaryBuffer = '';
  2073. tokenizer.setState(rawtext_end_tag_open_state);
  2074. } else {
  2075. tokenizer._emitToken({type: 'Characters', data: '<'});
  2076. buffer.unget(data);
  2077. tokenizer.setState(rawtext_state);
  2078. }
  2079. return true;
  2080. }
  2081. function rawtext_end_tag_open_state(buffer) {
  2082. var data = buffer.char();
  2083. if (isAlpha(data)) {
  2084. this._temporaryBuffer += data;
  2085. tokenizer.setState(rawtext_end_tag_name_state);
  2086. } else {
  2087. tokenizer._emitToken({type: 'Characters', data: '</'});
  2088. buffer.unget(data);
  2089. tokenizer.setState(rawtext_state);
  2090. }
  2091. return true;
  2092. }
  2093. function rawtext_end_tag_name_state(buffer) {
  2094. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2095. var data = buffer.char();
  2096. if (isWhitespace(data) && appropriate) {
  2097. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2098. tokenizer.setState(before_attribute_name_state);
  2099. } else if (data === '/' && appropriate) {
  2100. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2101. tokenizer.setState(self_closing_tag_state);
  2102. } else if (data === '>' && appropriate) {
  2103. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2104. tokenizer._emitCurrentToken();
  2105. tokenizer.setState(data_state);
  2106. } else if (isAlpha(data)) {
  2107. this._temporaryBuffer += data;
  2108. buffer.commit();
  2109. } else {
  2110. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2111. buffer.unget(data);
  2112. tokenizer.setState(rawtext_state);
  2113. }
  2114. return true;
  2115. }
  2116. function script_data_less_than_sign_state(buffer) {
  2117. var data = buffer.char();
  2118. if (data === "/") {
  2119. this._temporaryBuffer = '';
  2120. tokenizer.setState(script_data_end_tag_open_state);
  2121. } else if (data === '!') {
  2122. tokenizer._emitToken({type: 'Characters', data: '<!'});
  2123. tokenizer.setState(script_data_escape_start_state);
  2124. } else {
  2125. tokenizer._emitToken({type: 'Characters', data: '<'});
  2126. buffer.unget(data);
  2127. tokenizer.setState(script_data_state);
  2128. }
  2129. return true;
  2130. }
  2131. function script_data_end_tag_open_state(buffer) {
  2132. var data = buffer.char();
  2133. if (isAlpha(data)) {
  2134. this._temporaryBuffer += data;
  2135. tokenizer.setState(script_data_end_tag_name_state);
  2136. } else {
  2137. tokenizer._emitToken({type: 'Characters', data: '</'});
  2138. buffer.unget(data);
  2139. tokenizer.setState(script_data_state);
  2140. }
  2141. return true;
  2142. }
  2143. function script_data_end_tag_name_state(buffer) {
  2144. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2145. var data = buffer.char();
  2146. if (isWhitespace(data) && appropriate) {
  2147. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2148. tokenizer.setState(before_attribute_name_state);
  2149. } else if (data === '/' && appropriate) {
  2150. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2151. tokenizer.setState(self_closing_tag_state);
  2152. } else if (data === '>' && appropriate) {
  2153. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2154. tokenizer._emitCurrentToken();
  2155. } else if (isAlpha(data)) {
  2156. this._temporaryBuffer += data;
  2157. buffer.commit();
  2158. } else {
  2159. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2160. buffer.unget(data);
  2161. tokenizer.setState(script_data_state);
  2162. }
  2163. return true;
  2164. }
  2165. function script_data_escape_start_state(buffer) {
  2166. var data = buffer.char();
  2167. if (data === '-') {
  2168. tokenizer._emitToken({type: 'Characters', data: '-'});
  2169. tokenizer.setState(script_data_escape_start_dash_state);
  2170. } else {
  2171. buffer.unget(data);
  2172. tokenizer.setState(script_data_state);
  2173. }
  2174. return true;
  2175. }
  2176. function script_data_escape_start_dash_state(buffer) {
  2177. var data = buffer.char();
  2178. if (data === '-') {
  2179. tokenizer._emitToken({type: 'Characters', data: '-'});
  2180. tokenizer.setState(script_data_escaped_dash_dash_state);
  2181. } else {
  2182. buffer.unget(data);
  2183. tokenizer.setState(script_data_state);
  2184. }
  2185. return true;
  2186. }
  2187. function script_data_escaped_state(buffer) {
  2188. var data = buffer.char();
  2189. if (data === InputStream.EOF) {
  2190. buffer.unget(data);
  2191. tokenizer.setState(data_state);
  2192. } else if (data === '-') {
  2193. tokenizer._emitToken({type: 'Characters', data: '-'});
  2194. tokenizer.setState(script_data_escaped_dash_state);
  2195. } else if (data === '<') {
  2196. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2197. } else if (data === '\u0000') {
  2198. tokenizer._parseError("invalid-codepoint");
  2199. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2200. buffer.commit();
  2201. } else {
  2202. var chars = buffer.matchUntil('<|-|\u0000');
  2203. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2204. }
  2205. return true;
  2206. }
  2207. function script_data_escaped_dash_state(buffer) {
  2208. var data = buffer.char();
  2209. if (data === InputStream.EOF) {
  2210. buffer.unget(data);
  2211. tokenizer.setState(data_state);
  2212. } else if (data === '-') {
  2213. tokenizer._emitToken({type: 'Characters', data: '-'});
  2214. tokenizer.setState(script_data_escaped_dash_dash_state);
  2215. } else if (data === '<') {
  2216. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2217. } else if (data === '\u0000') {
  2218. tokenizer._parseError("invalid-codepoint");
  2219. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2220. tokenizer.setState(script_data_escaped_state);
  2221. } else {
  2222. tokenizer._emitToken({type: 'Characters', data: data});
  2223. tokenizer.setState(script_data_escaped_state);
  2224. }
  2225. return true;
  2226. }
  2227. function script_data_escaped_dash_dash_state(buffer) {
  2228. var data = buffer.char();
  2229. if (data === InputStream.EOF) {
  2230. tokenizer._parseError('eof-in-script');
  2231. buffer.unget(data);
  2232. tokenizer.setState(data_state);
  2233. } else if (data === '<') {
  2234. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2235. } else if (data === '>') {
  2236. tokenizer._emitToken({type: 'Characters', data: '>'});
  2237. tokenizer.setState(script_data_state);
  2238. } else if (data === '\u0000') {
  2239. tokenizer._parseError("invalid-codepoint");
  2240. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2241. tokenizer.setState(script_data_escaped_state);
  2242. } else {
  2243. tokenizer._emitToken({type: 'Characters', data: data});
  2244. tokenizer.setState(script_data_escaped_state);
  2245. }
  2246. return true;
  2247. }
  2248. function script_data_escaped_less_then_sign_state(buffer) {
  2249. var data = buffer.char();
  2250. if (data === '/') {
  2251. this._temporaryBuffer = '';
  2252. tokenizer.setState(script_data_escaped_end_tag_open_state);
  2253. } else if (isAlpha(data)) {
  2254. tokenizer._emitToken({type: 'Characters', data: '<' + data});
  2255. this._temporaryBuffer = data;
  2256. tokenizer.setState(script_data_double_escape_start_state);
  2257. } else {
  2258. tokenizer._emitToken({type: 'Characters', data: '<'});
  2259. buffer.unget(data);
  2260. tokenizer.setState(script_data_escaped_state);
  2261. }
  2262. return true;
  2263. }
  2264. function script_data_escaped_end_tag_open_state(buffer) {
  2265. var data = buffer.char();
  2266. if (isAlpha(data)) {
  2267. this._temporaryBuffer = data;
  2268. tokenizer.setState(script_data_escaped_end_tag_name_state);
  2269. } else {
  2270. tokenizer._emitToken({type: 'Characters', data: '</'});
  2271. buffer.unget(data);
  2272. tokenizer.setState(script_data_escaped_state);
  2273. }
  2274. return true;
  2275. }
  2276. function script_data_escaped_end_tag_name_state(buffer) {
  2277. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2278. var data = buffer.char();
  2279. if (isWhitespace(data) && appropriate) {
  2280. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2281. tokenizer.setState(before_attribute_name_state);
  2282. } else if (data === '/' && appropriate) {
  2283. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2284. tokenizer.setState(self_closing_tag_state);
  2285. } else if (data === '>' && appropriate) {
  2286. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2287. tokenizer.setState(data_state);
  2288. tokenizer._emitCurrentToken();
  2289. } else if (isAlpha(data)) {
  2290. this._temporaryBuffer += data;
  2291. buffer.commit();
  2292. } else {
  2293. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2294. buffer.unget(data);
  2295. tokenizer.setState(script_data_escaped_state);
  2296. }
  2297. return true;
  2298. }
  2299. function script_data_double_escape_start_state(buffer) {
  2300. var data = buffer.char();
  2301. if (isWhitespace(data) || data === '/' || data === '>') {
  2302. tokenizer._emitToken({type: 'Characters', data: data});
  2303. if (this._temporaryBuffer.toLowerCase() === 'script')
  2304. tokenizer.setState(script_data_double_escaped_state);
  2305. else
  2306. tokenizer.setState(script_data_escaped_state);
  2307. } else if (isAlpha(data)) {
  2308. tokenizer._emitToken({type: 'Characters', data: data});
  2309. this._temporaryBuffer += data;
  2310. buffer.commit();
  2311. } else {
  2312. buffer.unget(data);
  2313. tokenizer.setState(script_data_escaped_state);
  2314. }
  2315. return true;
  2316. }
  2317. function script_data_double_escaped_state(buffer) {
  2318. var data = buffer.char();
  2319. if (data === InputStream.EOF) {
  2320. tokenizer._parseError('eof-in-script');
  2321. buffer.unget(data);
  2322. tokenizer.setState(data_state);
  2323. } else if (data === '-') {
  2324. tokenizer._emitToken({type: 'Characters', data: '-'});
  2325. tokenizer.setState(script_data_double_escaped_dash_state);
  2326. } else if (data === '<') {
  2327. tokenizer._emitToken({type: 'Characters', data: '<'});
  2328. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2329. } else if (data === '\u0000') {
  2330. tokenizer._parseError('invalid-codepoint');
  2331. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2332. buffer.commit();
  2333. } else {
  2334. tokenizer._emitToken({type: 'Characters', data: data});
  2335. buffer.commit();
  2336. }
  2337. return true;
  2338. }
  2339. function script_data_double_escaped_dash_state(buffer) {
  2340. var data = buffer.char();
  2341. if (data === InputStream.EOF) {
  2342. tokenizer._parseError('eof-in-script');
  2343. buffer.unget(data);
  2344. tokenizer.setState(data_state);
  2345. } else if (data === '-') {
  2346. tokenizer._emitToken({type: 'Characters', data: '-'});
  2347. tokenizer.setState(script_data_double_escaped_dash_dash_state);
  2348. } else if (data === '<') {
  2349. tokenizer._emitToken({type: 'Characters', data: '<'});
  2350. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2351. } else if (data === '\u0000') {
  2352. tokenizer._parseError('invalid-codepoint');
  2353. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2354. tokenizer.setState(script_data_double_escaped_state);
  2355. } else {
  2356. tokenizer._emitToken({type: 'Characters', data: data});
  2357. tokenizer.setState(script_data_double_escaped_state);
  2358. }
  2359. return true;
  2360. }
  2361. function script_data_double_escaped_dash_dash_state(buffer) {
  2362. var data = buffer.char();
  2363. if (data === InputStream.EOF) {
  2364. tokenizer._parseError('eof-in-script');
  2365. buffer.unget(data);
  2366. tokenizer.setState(data_state);
  2367. } else if (data === '-') {
  2368. tokenizer._emitToken({type: 'Characters', data: '-'});
  2369. buffer.commit();
  2370. } else if (data === '<') {
  2371. tokenizer._emitToken({type: 'Characters', data: '<'});
  2372. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2373. } else if (data === '>') {
  2374. tokenizer._emitToken({type: 'Characters', data: '>'});
  2375. tokenizer.setState(script_data_state);
  2376. } else if (data === '\u0000') {
  2377. tokenizer._parseError('invalid-codepoint');
  2378. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2379. tokenizer.setState(script_data_double_escaped_state);
  2380. } else {
  2381. tokenizer._emitToken({type: 'Characters', data: data});
  2382. tokenizer.setState(script_data_double_escaped_state);
  2383. }
  2384. return true;
  2385. }
  2386. function script_data_double_escaped_less_than_sign_state(buffer) {
  2387. var data = buffer.char();
  2388. if (data === '/') {
  2389. tokenizer._emitToken({type: 'Characters', data: '/'});
  2390. this._temporaryBuffer = '';
  2391. tokenizer.setState(script_data_double_escape_end_state);
  2392. } else {
  2393. buffer.unget(data);
  2394. tokenizer.setState(script_data_double_escaped_state);
  2395. }
  2396. return true;
  2397. }
  2398. function script_data_double_escape_end_state(buffer) {
  2399. var data = buffer.char();
  2400. if (isWhitespace(data) || data === '/' || data === '>') {
  2401. tokenizer._emitToken({type: 'Characters', data: data});
  2402. if (this._temporaryBuffer.toLowerCase() === 'script')
  2403. tokenizer.setState(script_data_escaped_state);
  2404. else
  2405. tokenizer.setState(script_data_double_escaped_state);
  2406. } else if (isAlpha(data)) {
  2407. tokenizer._emitToken({type: 'Characters', data: data});
  2408. this._temporaryBuffer += data;
  2409. buffer.commit();
  2410. } else {
  2411. buffer.unget(data);
  2412. tokenizer.setState(script_data_double_escaped_state);
  2413. }
  2414. return true;
  2415. }
  2416. function tag_open_state(buffer) {
  2417. var data = buffer.char();
  2418. if (data === InputStream.EOF) {
  2419. tokenizer._parseError("bare-less-than-sign-at-eof");
  2420. tokenizer._emitToken({type: 'Characters', data: '<'});
  2421. buffer.unget(data);
  2422. tokenizer.setState(data_state);
  2423. } else if (isAlpha(data)) {
  2424. tokenizer._currentToken = {type: 'StartTag', name: data.toLowerCase(), data: []};
  2425. tokenizer.setState(tag_name_state);
  2426. } else if (data === '!') {
  2427. tokenizer.setState(markup_declaration_open_state);
  2428. } else if (data === '/') {
  2429. tokenizer.setState(close_tag_open_state);
  2430. } else if (data === '>') {
  2431. tokenizer._parseError("expected-tag-name-but-got-right-bracket");
  2432. tokenizer._emitToken({type: 'Characters', data: "<>"});
  2433. tokenizer.setState(data_state);
  2434. } else if (data === '?') {
  2435. tokenizer._parseError("expected-tag-name-but-got-question-mark");
  2436. buffer.unget(data);
  2437. tokenizer.setState(bogus_comment_state);
  2438. } else {
  2439. tokenizer._parseError("expected-tag-name");
  2440. tokenizer._emitToken({type: 'Characters', data: "<"});
  2441. buffer.unget(data);
  2442. tokenizer.setState(data_state);
  2443. }
  2444. return true;
  2445. }
  2446. function close_tag_open_state(buffer) {
  2447. var data = buffer.char();
  2448. if (data === InputStream.EOF) {
  2449. tokenizer._parseError("expected-closing-tag-but-got-eof");
  2450. tokenizer._emitToken({type: 'Characters', data: '</'});
  2451. buffer.unget(data);
  2452. tokenizer.setState(data_state);
  2453. } else if (isAlpha(data)) {
  2454. tokenizer._currentToken = {type: 'EndTag', name: data.toLowerCase(), data: []};
  2455. tokenizer.setState(tag_name_state);
  2456. } else if (data === '>') {
  2457. tokenizer._parseError("expected-closing-tag-but-got-right-bracket");
  2458. tokenizer.setState(data_state);
  2459. } else {
  2460. tokenizer._parseError("expected-closing-tag-but-got-char", {data: data}); // param 1 is datavars:
  2461. buffer.unget(data);
  2462. tokenizer.setState(bogus_comment_state);
  2463. }
  2464. return true;
  2465. }
  2466. function tag_name_state(buffer) {
  2467. var data = buffer.char();
  2468. if (data === InputStream.EOF) {
  2469. tokenizer._parseError('eof-in-tag-name');
  2470. buffer.unget(data);
  2471. tokenizer.setState(data_state);
  2472. } else if (isWhitespace(data)) {
  2473. tokenizer.setState(before_attribute_name_state);
  2474. } else if (isAlpha(data)) {
  2475. tokenizer._currentToken.name += data.toLowerCase();
  2476. } else if (data === '>') {
  2477. tokenizer._emitCurrentToken();
  2478. } else if (data === '/') {
  2479. tokenizer.setState(self_closing_tag_state);
  2480. } else if (data === '\u0000') {
  2481. tokenizer._parseError("invalid-codepoint");
  2482. tokenizer._currentToken.name += "\uFFFD";
  2483. } else {
  2484. tokenizer._currentToken.name += data;
  2485. }
  2486. buffer.commit();
  2487. return true;
  2488. }
  2489. function before_attribute_name_state(buffer) {
  2490. var data = buffer.char();
  2491. if (data === InputStream.EOF) {
  2492. tokenizer._parseError("expected-attribute-name-but-got-eof");
  2493. buffer.unget(data);
  2494. tokenizer.setState(data_state);
  2495. } else if (isWhitespace(data)) {
  2496. return true;
  2497. } else if (isAlpha(data)) {
  2498. tokenizer._currentToken.data.push({nodeName: data.toLowerCase(), nodeValue: ""});
  2499. tokenizer.setState(attribute_name_state);
  2500. } else if (data === '>') {
  2501. tokenizer._emitCurrentToken();
  2502. } else if (data === '/') {
  2503. tokenizer.setState(self_closing_tag_state);
  2504. } else if (data === "'" || data === '"' || data === '=' || data === '<') {
  2505. tokenizer._parseError("invalid-character-in-attribute-name");
  2506. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2507. tokenizer.setState(attribute_name_state);
  2508. } else if (data === '\u0000') {
  2509. tokenizer._parseError("invalid-codepoint");
  2510. tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""});
  2511. } else {
  2512. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2513. tokenizer.setState(attribute_name_state);
  2514. }
  2515. return true;
  2516. }
  2517. function attribute_name_state(buffer) {
  2518. var data = buffer.char();
  2519. var leavingThisState = true;
  2520. var shouldEmit = false;
  2521. if (data === InputStream.EOF) {
  2522. tokenizer._parseError("eof-in-attribute-name");
  2523. buffer.unget(data);
  2524. tokenizer.setState(data_state);
  2525. shouldEmit = true;
  2526. } else if (data === '=') {
  2527. tokenizer.setState(before_attribute_value_state);
  2528. } else if (isAlpha(data)) {
  2529. tokenizer._currentAttribute().nodeName += data.toLowerCase();
  2530. leavingThisState = false;
  2531. } else if (data === '>') {
  2532. shouldEmit = true;
  2533. } else if (isWhitespace(data)) {
  2534. tokenizer.setState(after_attribute_name_state);
  2535. } else if (data === '/') {
  2536. tokenizer.setState(self_closing_tag_state);
  2537. } else if (data === "'" || data === '"') {
  2538. tokenizer._parseError("invalid-character-in-attribute-name");
  2539. tokenizer._currentAttribute().nodeName += data;
  2540. leavingThisState = false;
  2541. } else if (data === '\u0000') {
  2542. tokenizer._parseError("invalid-codepoint");
  2543. tokenizer._currentAttribute().nodeName += "\uFFFD";
  2544. } else {
  2545. tokenizer._currentAttribute().nodeName += data;
  2546. leavingThisState = false;
  2547. }
  2548. if (leavingThisState) {
  2549. var attributes = tokenizer._currentToken.data;
  2550. var currentAttribute = attributes[attributes.length - 1];
  2551. for (var i = attributes.length - 2; i >= 0; i--) {
  2552. if (currentAttribute.nodeName === attributes[i].nodeName) {
  2553. tokenizer._parseError("duplicate-attribute", {name: currentAttribute.nodeName});
  2554. currentAttribute.nodeName = null;
  2555. break;
  2556. }
  2557. }
  2558. if (shouldEmit)
  2559. tokenizer._emitCurrentToken();
  2560. } else {
  2561. buffer.commit();
  2562. }
  2563. return true;
  2564. }
  2565. function after_attribute_name_state(buffer) {
  2566. var data = buffer.char();
  2567. if (data === InputStream.EOF) {
  2568. tokenizer._parseError("expected-end-of-tag-but-got-eof");
  2569. buffer.unget(data);
  2570. tokenizer.setState(data_state);
  2571. } else if (isWhitespace(data)) {
  2572. return true;
  2573. } else if (data === '=') {
  2574. tokenizer.setState(before_attribute_value_state);
  2575. } else if (data === '>') {
  2576. tokenizer._emitCurrentToken();
  2577. } else if (isAlpha(data)) {
  2578. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2579. tokenizer.setState(attribute_name_state);
  2580. } else if (data === '/') {
  2581. tokenizer.setState(self_closing_tag_state);
  2582. } else if (data === "'" || data === '"' || data === '<') {
  2583. tokenizer._parseError("invalid-character-after-attribute-name");
  2584. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2585. tokenizer.setState(attribute_name_state);
  2586. } else if (data === '\u0000') {
  2587. tokenizer._parseError("invalid-codepoint");
  2588. tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""});
  2589. } else {
  2590. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2591. tokenizer.setState(attribute_name_state);
  2592. }
  2593. return true;
  2594. }
  2595. function before_attribute_value_state(buffer) {
  2596. var data = buffer.char();
  2597. if (data === InputStream.EOF) {
  2598. tokenizer._parseError("expected-attribute-value-but-got-eof");
  2599. buffer.unget(data);
  2600. tokenizer.setState(data_state);
  2601. } else if (isWhitespace(data)) {
  2602. return true;
  2603. } else if (data === '"') {
  2604. tokenizer.setState(attribute_value_double_quoted_state);
  2605. } else if (data === '&') {
  2606. tokenizer.setState(attribute_value_unquoted_state);
  2607. buffer.unget(data);
  2608. } else if (data === "'") {
  2609. tokenizer.setState(attribute_value_single_quoted_state);
  2610. } else if (data === '>') {
  2611. tokenizer._parseError("expected-attribute-value-but-got-right-bracket");
  2612. tokenizer._emitCurrentToken();
  2613. } else if (data === '=' || data === '<' || data === '`') {
  2614. tokenizer._parseError("unexpected-character-in-unquoted-attribute-value");
  2615. tokenizer._currentAttribute().nodeValue += data;
  2616. tokenizer.setState(attribute_value_unquoted_state);
  2617. } else if (data === '\u0000') {
  2618. tokenizer._parseError("invalid-codepoint");
  2619. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2620. } else {
  2621. tokenizer._currentAttribute().nodeValue += data;
  2622. tokenizer.setState(attribute_value_unquoted_state);
  2623. }
  2624. return true;
  2625. }
  2626. function attribute_value_double_quoted_state(buffer) {
  2627. var data = buffer.char();
  2628. if (data === InputStream.EOF) {
  2629. tokenizer._parseError("eof-in-attribute-value-double-quote");
  2630. buffer.unget(data);
  2631. tokenizer.setState(data_state);
  2632. } else if (data === '"') {
  2633. tokenizer.setState(after_attribute_value_state);
  2634. } else if (data === '&') {
  2635. this._additionalAllowedCharacter = '"';
  2636. tokenizer.setState(character_reference_in_attribute_value_state);
  2637. } else if (data === '\u0000') {
  2638. tokenizer._parseError("invalid-codepoint");
  2639. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2640. } else {
  2641. var s = buffer.matchUntil('[\0"&]');
  2642. data = data + s;
  2643. tokenizer._currentAttribute().nodeValue += data;
  2644. }
  2645. return true;
  2646. }
  2647. function attribute_value_single_quoted_state(buffer) {
  2648. var data = buffer.char();
  2649. if (data === InputStream.EOF) {
  2650. tokenizer._parseError("eof-in-attribute-value-single-quote");
  2651. buffer.unget(data);
  2652. tokenizer.setState(data_state);
  2653. } else if (data === "'") {
  2654. tokenizer.setState(after_attribute_value_state);
  2655. } else if (data === '&') {
  2656. this._additionalAllowedCharacter = "'";
  2657. tokenizer.setState(character_reference_in_attribute_value_state);
  2658. } else if (data === '\u0000') {
  2659. tokenizer._parseError("invalid-codepoint");
  2660. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2661. } else {
  2662. tokenizer._currentAttribute().nodeValue += data + buffer.matchUntil("\u0000|['&]");
  2663. }
  2664. return true;
  2665. }
  2666. function attribute_value_unquoted_state(buffer) {
  2667. var data = buffer.char();
  2668. if (data === InputStream.EOF) {
  2669. tokenizer._parseError("eof-after-attribute-value");
  2670. buffer.unget(data);
  2671. tokenizer.setState(data_state);
  2672. } else if (isWhitespace(data)) {
  2673. tokenizer.setState(before_attribute_name_state);
  2674. } else if (data === '&') {
  2675. this._additionalAllowedCharacter = ">";
  2676. tokenizer.setState(character_reference_in_attribute_value_state);
  2677. } else if (data === '>') {
  2678. tokenizer._emitCurrentToken();
  2679. } else if (data === '"' || data === "'" || data === '=' || data === '`' || data === '<') {
  2680. tokenizer._parseError("unexpected-character-in-unquoted-attribute-value");
  2681. tokenizer._currentAttribute().nodeValue += data;
  2682. buffer.commit();
  2683. } else if (data === '\u0000') {
  2684. tokenizer._parseError("invalid-codepoint");
  2685. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2686. } else {
  2687. var o = buffer.matchUntil("\u0000|["+ "\t\n\v\f\x20\r" + "&<>\"'=`" +"]");
  2688. if (o === InputStream.EOF) {
  2689. tokenizer._parseError("eof-in-attribute-value-no-quotes");
  2690. tokenizer._emitCurrentToken();
  2691. }
  2692. buffer.commit();
  2693. tokenizer._currentAttribute().nodeValue += data + o;
  2694. }
  2695. return true;
  2696. }
  2697. function character_reference_in_attribute_value_state(buffer) {
  2698. var character = EntityParser.consumeEntity(buffer, tokenizer, this._additionalAllowedCharacter);
  2699. this._currentAttribute().nodeValue += character || '&';
  2700. if (this._additionalAllowedCharacter === '"')
  2701. tokenizer.setState(attribute_value_double_quoted_state);
  2702. else if (this._additionalAllowedCharacter === '\'')
  2703. tokenizer.setState(attribute_value_single_quoted_state);
  2704. else if (this._additionalAllowedCharacter === '>')
  2705. tokenizer.setState(attribute_value_unquoted_state);
  2706. return true;
  2707. }
  2708. function after_attribute_value_state(buffer) {
  2709. var data = buffer.char();
  2710. if (data === InputStream.EOF) {
  2711. tokenizer._parseError("eof-after-attribute-value");
  2712. buffer.unget(data);
  2713. tokenizer.setState(data_state);
  2714. } else if (isWhitespace(data)) {
  2715. tokenizer.setState(before_attribute_name_state);
  2716. } else if (data === '>') {
  2717. tokenizer.setState(data_state);
  2718. tokenizer._emitCurrentToken();
  2719. } else if (data === '/') {
  2720. tokenizer.setState(self_closing_tag_state);
  2721. } else {
  2722. tokenizer._parseError("unexpected-character-after-attribute-value");
  2723. buffer.unget(data);
  2724. tokenizer.setState(before_attribute_name_state);
  2725. }
  2726. return true;
  2727. }
  2728. function self_closing_tag_state(buffer) {
  2729. var c = buffer.char();
  2730. if (c === InputStream.EOF) {
  2731. tokenizer._parseError("unexpected-eof-after-solidus-in-tag");
  2732. buffer.unget(c);
  2733. tokenizer.setState(data_state);
  2734. } else if (c === '>') {
  2735. tokenizer._currentToken.selfClosing = true;
  2736. tokenizer.setState(data_state);
  2737. tokenizer._emitCurrentToken();
  2738. } else {
  2739. tokenizer._parseError("unexpected-character-after-solidus-in-tag");
  2740. buffer.unget(c);
  2741. tokenizer.setState(before_attribute_name_state);
  2742. }
  2743. return true;
  2744. }
  2745. function bogus_comment_state(buffer) {
  2746. var data = buffer.matchUntil('>');
  2747. data = data.replace(/\u0000/g, "\uFFFD");
  2748. buffer.char();
  2749. tokenizer._emitToken({type: 'Comment', data: data});
  2750. tokenizer.setState(data_state);
  2751. return true;
  2752. }
  2753. function markup_declaration_open_state(buffer) {
  2754. var chars = buffer.shift(2);
  2755. if (chars === '--') {
  2756. tokenizer._currentToken = {type: 'Comment', data: ''};
  2757. tokenizer.setState(comment_start_state);
  2758. } else {
  2759. var newchars = buffer.shift(5);
  2760. if (newchars === InputStream.EOF || chars === InputStream.EOF) {
  2761. tokenizer._parseError("expected-dashes-or-doctype");
  2762. tokenizer.setState(bogus_comment_state);
  2763. buffer.unget(chars);
  2764. return true;
  2765. }
  2766. chars += newchars;
  2767. if (chars.toUpperCase() === 'DOCTYPE') {
  2768. tokenizer._currentToken = {type: 'Doctype', name: '', publicId: null, systemId: null, forceQuirks: false};
  2769. tokenizer.setState(doctype_state);
  2770. } else if (tokenizer._tokenHandler.isCdataSectionAllowed() && chars === '[CDATA[') {
  2771. tokenizer.setState(cdata_section_state);
  2772. } else {
  2773. tokenizer._parseError("expected-dashes-or-doctype");
  2774. buffer.unget(chars);
  2775. tokenizer.setState(bogus_comment_state);
  2776. }
  2777. }
  2778. return true;
  2779. }
  2780. function cdata_section_state(buffer) {
  2781. var data = buffer.matchUntil(']]>');
  2782. buffer.shift(3);
  2783. if (data) {
  2784. tokenizer._emitToken({type: 'Characters', data: data});
  2785. }
  2786. tokenizer.setState(data_state);
  2787. return true;
  2788. }
  2789. function comment_start_state(buffer) {
  2790. var data = buffer.char();
  2791. if (data === InputStream.EOF) {
  2792. tokenizer._parseError("eof-in-comment");
  2793. tokenizer._emitToken(tokenizer._currentToken);
  2794. buffer.unget(data);
  2795. tokenizer.setState(data_state);
  2796. } else if (data === '-') {
  2797. tokenizer.setState(comment_start_dash_state);
  2798. } else if (data === '>') {
  2799. tokenizer._parseError("incorrect-comment");
  2800. tokenizer._emitToken(tokenizer._currentToken);
  2801. tokenizer.setState(data_state);
  2802. } else if (data === '\u0000') {
  2803. tokenizer._parseError("invalid-codepoint");
  2804. tokenizer._currentToken.data += "\uFFFD";
  2805. } else {
  2806. tokenizer._currentToken.data += data;
  2807. tokenizer.setState(comment_state);
  2808. }
  2809. return true;
  2810. }
  2811. function comment_start_dash_state(buffer) {
  2812. var data = buffer.char();
  2813. if (data === InputStream.EOF) {
  2814. tokenizer._parseError("eof-in-comment");
  2815. tokenizer._emitToken(tokenizer._currentToken);
  2816. buffer.unget(data);
  2817. tokenizer.setState(data_state);
  2818. } else if (data === '-') {
  2819. tokenizer.setState(comment_end_state);
  2820. } else if (data === '>') {
  2821. tokenizer._parseError("incorrect-comment");
  2822. tokenizer._emitToken(tokenizer._currentToken);
  2823. tokenizer.setState(data_state);
  2824. } else if (data === '\u0000') {
  2825. tokenizer._parseError("invalid-codepoint");
  2826. tokenizer._currentToken.data += "\uFFFD";
  2827. } else {
  2828. tokenizer._currentToken.data += '-' + data;
  2829. tokenizer.setState(comment_state);
  2830. }
  2831. return true;
  2832. }
  2833. function comment_state(buffer) {
  2834. var data = buffer.char();
  2835. if (data === InputStream.EOF) {
  2836. tokenizer._parseError("eof-in-comment");
  2837. tokenizer._emitToken(tokenizer._currentToken);
  2838. buffer.unget(data);
  2839. tokenizer.setState(data_state);
  2840. } else if (data === '-') {
  2841. tokenizer.setState(comment_end_dash_state);
  2842. } else if (data === '\u0000') {
  2843. tokenizer._parseError("invalid-codepoint");
  2844. tokenizer._currentToken.data += "\uFFFD";
  2845. } else {
  2846. tokenizer._currentToken.data += data;
  2847. buffer.commit();
  2848. }
  2849. return true;
  2850. }
  2851. function comment_end_dash_state(buffer) {
  2852. var data = buffer.char();
  2853. if (data === InputStream.EOF) {
  2854. tokenizer._parseError("eof-in-comment-end-dash");
  2855. tokenizer._emitToken(tokenizer._currentToken);
  2856. buffer.unget(data);
  2857. tokenizer.setState(data_state);
  2858. } else if (data === '-') {
  2859. tokenizer.setState(comment_end_state);
  2860. } else if (data === '\u0000') {
  2861. tokenizer._parseError("invalid-codepoint");
  2862. tokenizer._currentToken.data += "-\uFFFD";
  2863. tokenizer.setState(comment_state);
  2864. } else {
  2865. tokenizer._currentToken.data += '-' + data + buffer.matchUntil('\u0000|-');
  2866. buffer.char();
  2867. }
  2868. return true;
  2869. }
  2870. function comment_end_state(buffer) {
  2871. var data = buffer.char();
  2872. if (data === InputStream.EOF) {
  2873. tokenizer._parseError("eof-in-comment-double-dash");
  2874. tokenizer._emitToken(tokenizer._currentToken);
  2875. buffer.unget(data);
  2876. tokenizer.setState(data_state);
  2877. } else if (data === '>') {
  2878. tokenizer._emitToken(tokenizer._currentToken);
  2879. tokenizer.setState(data_state);
  2880. } else if (data === '!') {
  2881. tokenizer._parseError("unexpected-bang-after-double-dash-in-comment");
  2882. tokenizer.setState(comment_end_bang_state);
  2883. } else if (data === '-') {
  2884. tokenizer._parseError("unexpected-dash-after-double-dash-in-comment");
  2885. tokenizer._currentToken.data += data;
  2886. } else if (data === '\u0000') {
  2887. tokenizer._parseError("invalid-codepoint");
  2888. tokenizer._currentToken.data += "--\uFFFD";
  2889. tokenizer.setState(comment_state);
  2890. } else {
  2891. tokenizer._parseError("unexpected-char-in-comment");
  2892. tokenizer._currentToken.data += '--' + data;
  2893. tokenizer.setState(comment_state);
  2894. }
  2895. return true;
  2896. }
  2897. function comment_end_bang_state(buffer) {
  2898. var data = buffer.char();
  2899. if (data === InputStream.EOF) {
  2900. tokenizer._parseError("eof-in-comment-end-bang-state");
  2901. tokenizer._emitToken(tokenizer._currentToken);
  2902. buffer.unget(data);
  2903. tokenizer.setState(data_state);
  2904. } else if (data === '>') {
  2905. tokenizer._emitToken(tokenizer._currentToken);
  2906. tokenizer.setState(data_state);
  2907. } else if (data === '-') {
  2908. tokenizer._currentToken.data += '--!';
  2909. tokenizer.setState(comment_end_dash_state);
  2910. } else {
  2911. tokenizer._currentToken.data += '--!' + data;
  2912. tokenizer.setState(comment_state);
  2913. }
  2914. return true;
  2915. }
  2916. function doctype_state(buffer) {
  2917. var data = buffer.char();
  2918. if (data === InputStream.EOF) {
  2919. tokenizer._parseError("expected-doctype-name-but-got-eof");
  2920. tokenizer._currentToken.forceQuirks = true;
  2921. buffer.unget(data);
  2922. tokenizer.setState(data_state);
  2923. tokenizer._emitCurrentToken();
  2924. } else if (isWhitespace(data)) {
  2925. tokenizer.setState(before_doctype_name_state);
  2926. } else {
  2927. tokenizer._parseError("need-space-after-doctype");
  2928. buffer.unget(data);
  2929. tokenizer.setState(before_doctype_name_state);
  2930. }
  2931. return true;
  2932. }
  2933. function before_doctype_name_state(buffer) {
  2934. var data = buffer.char();
  2935. if (data === InputStream.EOF) {
  2936. tokenizer._parseError("expected-doctype-name-but-got-eof");
  2937. tokenizer._currentToken.forceQuirks = true;
  2938. buffer.unget(data);
  2939. tokenizer.setState(data_state);
  2940. tokenizer._emitCurrentToken();
  2941. } else if (isWhitespace(data)) {
  2942. } else if (data === '>') {
  2943. tokenizer._parseError("expected-doctype-name-but-got-right-bracket");
  2944. tokenizer._currentToken.forceQuirks = true;
  2945. tokenizer.setState(data_state);
  2946. tokenizer._emitCurrentToken();
  2947. } else {
  2948. if (isAlpha(data))
  2949. data = data.toLowerCase();
  2950. tokenizer._currentToken.name = data;
  2951. tokenizer.setState(doctype_name_state);
  2952. }
  2953. return true;
  2954. }
  2955. function doctype_name_state(buffer) {
  2956. var data = buffer.char();
  2957. if (data === InputStream.EOF) {
  2958. tokenizer._currentToken.forceQuirks = true;
  2959. buffer.unget(data);
  2960. tokenizer._parseError("eof-in-doctype-name");
  2961. tokenizer.setState(data_state);
  2962. tokenizer._emitCurrentToken();
  2963. } else if (isWhitespace(data)) {
  2964. tokenizer.setState(after_doctype_name_state);
  2965. } else if (data === '>') {
  2966. tokenizer.setState(data_state);
  2967. tokenizer._emitCurrentToken();
  2968. } else {
  2969. if (isAlpha(data))
  2970. data = data.toLowerCase();
  2971. tokenizer._currentToken.name += data;
  2972. buffer.commit();
  2973. }
  2974. return true;
  2975. }
  2976. function after_doctype_name_state(buffer) {
  2977. var data = buffer.char();
  2978. if (data === InputStream.EOF) {
  2979. tokenizer._currentToken.forceQuirks = true;
  2980. buffer.unget(data);
  2981. tokenizer._parseError("eof-in-doctype");
  2982. tokenizer.setState(data_state);
  2983. tokenizer._emitCurrentToken();
  2984. } else if (isWhitespace(data)) {
  2985. } else if (data === '>') {
  2986. tokenizer.setState(data_state);
  2987. tokenizer._emitCurrentToken();
  2988. } else {
  2989. if (['p', 'P'].indexOf(data) > -1) {
  2990. var expected = [['u', 'U'], ['b', 'B'], ['l', 'L'], ['i', 'I'], ['c', 'C']];
  2991. var matched = expected.every(function(expected){
  2992. data = buffer.char();
  2993. return expected.indexOf(data) > -1;
  2994. });
  2995. if (matched) {
  2996. tokenizer.setState(after_doctype_public_keyword_state);
  2997. return true;
  2998. }
  2999. } else if (['s', 'S'].indexOf(data) > -1) {
  3000. var expected = [['y', 'Y'], ['s', 'S'], ['t', 'T'], ['e', 'E'], ['m', 'M']];
  3001. var matched = expected.every(function(expected){
  3002. data = buffer.char();
  3003. return expected.indexOf(data) > -1;
  3004. });
  3005. if (matched) {
  3006. tokenizer.setState(after_doctype_system_keyword_state);
  3007. return true;
  3008. }
  3009. }
  3010. buffer.unget(data);
  3011. tokenizer._currentToken.forceQuirks = true;
  3012. if (data === InputStream.EOF) {
  3013. tokenizer._parseError("eof-in-doctype");
  3014. buffer.unget(data);
  3015. tokenizer.setState(data_state);
  3016. tokenizer._emitCurrentToken();
  3017. } else {
  3018. tokenizer._parseError("expected-space-or-right-bracket-in-doctype", {data: data});
  3019. tokenizer.setState(bogus_doctype_state);
  3020. }
  3021. }
  3022. return true;
  3023. }
  3024. function after_doctype_public_keyword_state(buffer) {
  3025. var data = buffer.char();
  3026. if (data === InputStream.EOF) {
  3027. tokenizer._parseError("eof-in-doctype");
  3028. tokenizer._currentToken.forceQuirks = true;
  3029. buffer.unget(data);
  3030. tokenizer.setState(data_state);
  3031. tokenizer._emitCurrentToken();
  3032. } else if (isWhitespace(data)) {
  3033. tokenizer.setState(before_doctype_public_identifier_state);
  3034. } else if (data === "'" || data === '"') {
  3035. tokenizer._parseError("unexpected-char-in-doctype");
  3036. buffer.unget(data);
  3037. tokenizer.setState(before_doctype_public_identifier_state);
  3038. } else {
  3039. buffer.unget(data);
  3040. tokenizer.setState(before_doctype_public_identifier_state);
  3041. }
  3042. return true;
  3043. }
  3044. function before_doctype_public_identifier_state(buffer) {
  3045. var data = buffer.char();
  3046. if (data === InputStream.EOF) {
  3047. tokenizer._parseError("eof-in-doctype");
  3048. tokenizer._currentToken.forceQuirks = true;
  3049. buffer.unget(data);
  3050. tokenizer.setState(data_state);
  3051. tokenizer._emitCurrentToken();
  3052. } else if (isWhitespace(data)) {
  3053. } else if (data === '"') {
  3054. tokenizer._currentToken.publicId = '';
  3055. tokenizer.setState(doctype_public_identifier_double_quoted_state);
  3056. } else if (data === "'") {
  3057. tokenizer._currentToken.publicId = '';
  3058. tokenizer.setState(doctype_public_identifier_single_quoted_state);
  3059. } else if (data === '>') {
  3060. tokenizer._parseError("unexpected-end-of-doctype");
  3061. tokenizer._currentToken.forceQuirks = true;
  3062. tokenizer.setState(data_state);
  3063. tokenizer._emitCurrentToken();
  3064. } else {
  3065. tokenizer._parseError("unexpected-char-in-doctype");
  3066. tokenizer._currentToken.forceQuirks = true;
  3067. tokenizer.setState(bogus_doctype_state);
  3068. }
  3069. return true;
  3070. }
  3071. function doctype_public_identifier_double_quoted_state(buffer) {
  3072. var data = buffer.char();
  3073. if (data === InputStream.EOF) {
  3074. tokenizer._parseError("eof-in-doctype");
  3075. tokenizer._currentToken.forceQuirks = true;
  3076. buffer.unget(data);
  3077. tokenizer.setState(data_state);
  3078. tokenizer._emitCurrentToken();
  3079. } else if (data === '"') {
  3080. tokenizer.setState(after_doctype_public_identifier_state);
  3081. } else if (data === '>') {
  3082. tokenizer._parseError("unexpected-end-of-doctype");
  3083. tokenizer._currentToken.forceQuirks = true;
  3084. tokenizer.setState(data_state);
  3085. tokenizer._emitCurrentToken();
  3086. } else {
  3087. tokenizer._currentToken.publicId += data;
  3088. }
  3089. return true;
  3090. }
  3091. function doctype_public_identifier_single_quoted_state(buffer) {
  3092. var data = buffer.char();
  3093. if (data === InputStream.EOF) {
  3094. tokenizer._parseError("eof-in-doctype");
  3095. tokenizer._currentToken.forceQuirks = true;
  3096. buffer.unget(data);
  3097. tokenizer.setState(data_state);
  3098. tokenizer._emitCurrentToken();
  3099. } else if (data === "'") {
  3100. tokenizer.setState(after_doctype_public_identifier_state);
  3101. } else if (data === '>') {
  3102. tokenizer._parseError("unexpected-end-of-doctype");
  3103. tokenizer._currentToken.forceQuirks = true;
  3104. tokenizer.setState(data_state);
  3105. tokenizer._emitCurrentToken();
  3106. } else {
  3107. tokenizer._currentToken.publicId += data;
  3108. }
  3109. return true;
  3110. }
  3111. function after_doctype_public_identifier_state(buffer) {
  3112. var data = buffer.char();
  3113. if (data === InputStream.EOF) {
  3114. tokenizer._parseError("eof-in-doctype");
  3115. tokenizer._currentToken.forceQuirks = true;
  3116. tokenizer._emitCurrentToken();
  3117. buffer.unget(data);
  3118. tokenizer.setState(data_state);
  3119. } else if (isWhitespace(data)) {
  3120. tokenizer.setState(between_doctype_public_and_system_identifiers_state);
  3121. } else if (data === '>') {
  3122. tokenizer.setState(data_state);
  3123. tokenizer._emitCurrentToken();
  3124. } else if (data === '"') {
  3125. tokenizer._parseError("unexpected-char-in-doctype");
  3126. tokenizer._currentToken.systemId = '';
  3127. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3128. } else if (data === "'") {
  3129. tokenizer._parseError("unexpected-char-in-doctype");
  3130. tokenizer._currentToken.systemId = '';
  3131. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3132. } else {
  3133. tokenizer._parseError("unexpected-char-in-doctype");
  3134. tokenizer._currentToken.forceQuirks = true;
  3135. tokenizer.setState(bogus_doctype_state);
  3136. }
  3137. return true;
  3138. }
  3139. function between_doctype_public_and_system_identifiers_state(buffer) {
  3140. var data = buffer.char();
  3141. if (data === InputStream.EOF) {
  3142. tokenizer._parseError("eof-in-doctype");
  3143. tokenizer._currentToken.forceQuirks = true;
  3144. tokenizer._emitCurrentToken();
  3145. buffer.unget(data);
  3146. tokenizer.setState(data_state);
  3147. } else if (isWhitespace(data)) {
  3148. } else if (data === '>') {
  3149. tokenizer._emitCurrentToken();
  3150. tokenizer.setState(data_state);
  3151. } else if (data === '"') {
  3152. tokenizer._currentToken.systemId = '';
  3153. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3154. } else if (data === "'") {
  3155. tokenizer._currentToken.systemId = '';
  3156. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3157. } else {
  3158. tokenizer._parseError("unexpected-char-in-doctype");
  3159. tokenizer._currentToken.forceQuirks = true;
  3160. tokenizer.setState(bogus_doctype_state);
  3161. }
  3162. return true;
  3163. }
  3164. function after_doctype_system_keyword_state(buffer) {
  3165. var data = buffer.char();
  3166. if (data === InputStream.EOF) {
  3167. tokenizer._parseError("eof-in-doctype");
  3168. tokenizer._currentToken.forceQuirks = true;
  3169. tokenizer._emitCurrentToken();
  3170. buffer.unget(data);
  3171. tokenizer.setState(data_state);
  3172. } else if (isWhitespace(data)) {
  3173. tokenizer.setState(before_doctype_system_identifier_state);
  3174. } else if (data === "'" || data === '"') {
  3175. tokenizer._parseError("unexpected-char-in-doctype");
  3176. buffer.unget(data);
  3177. tokenizer.setState(before_doctype_system_identifier_state);
  3178. } else {
  3179. buffer.unget(data);
  3180. tokenizer.setState(before_doctype_system_identifier_state);
  3181. }
  3182. return true;
  3183. }
  3184. function before_doctype_system_identifier_state(buffer) {
  3185. var data = buffer.char();
  3186. if (data === InputStream.EOF) {
  3187. tokenizer._parseError("eof-in-doctype");
  3188. tokenizer._currentToken.forceQuirks = true;
  3189. tokenizer._emitCurrentToken();
  3190. buffer.unget(data);
  3191. tokenizer.setState(data_state);
  3192. } else if (isWhitespace(data)) {
  3193. } else if (data === '"') {
  3194. tokenizer._currentToken.systemId = '';
  3195. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3196. } else if (data === "'") {
  3197. tokenizer._currentToken.systemId = '';
  3198. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3199. } else if (data === '>') {
  3200. tokenizer._parseError("unexpected-end-of-doctype");
  3201. tokenizer._currentToken.forceQuirks = true;
  3202. tokenizer._emitCurrentToken();
  3203. tokenizer.setState(data_state);
  3204. } else {
  3205. tokenizer._parseError("unexpected-char-in-doctype");
  3206. tokenizer._currentToken.forceQuirks = true;
  3207. tokenizer.setState(bogus_doctype_state);
  3208. }
  3209. return true;
  3210. }
  3211. function doctype_system_identifier_double_quoted_state(buffer) {
  3212. var data = buffer.char();
  3213. if (data === InputStream.EOF) {
  3214. tokenizer._parseError("eof-in-doctype");
  3215. tokenizer._currentToken.forceQuirks = true;
  3216. tokenizer._emitCurrentToken();
  3217. buffer.unget(data);
  3218. tokenizer.setState(data_state);
  3219. } else if (data === '"') {
  3220. tokenizer.setState(after_doctype_system_identifier_state);
  3221. } else if (data === '>') {
  3222. tokenizer._parseError("unexpected-end-of-doctype");
  3223. tokenizer._currentToken.forceQuirks = true;
  3224. tokenizer._emitCurrentToken();
  3225. tokenizer.setState(data_state);
  3226. } else {
  3227. tokenizer._currentToken.systemId += data;
  3228. }
  3229. return true;
  3230. }
  3231. function doctype_system_identifier_single_quoted_state(buffer) {
  3232. var data = buffer.char();
  3233. if (data === InputStream.EOF) {
  3234. tokenizer._parseError("eof-in-doctype");
  3235. tokenizer._currentToken.forceQuirks = true;
  3236. tokenizer._emitCurrentToken();
  3237. buffer.unget(data);
  3238. tokenizer.setState(data_state);
  3239. } else if (data === "'") {
  3240. tokenizer.setState(after_doctype_system_identifier_state);
  3241. } else if (data === '>') {
  3242. tokenizer._parseError("unexpected-end-of-doctype");
  3243. tokenizer._currentToken.forceQuirks = true;
  3244. tokenizer._emitCurrentToken();
  3245. tokenizer.setState(data_state);
  3246. } else {
  3247. tokenizer._currentToken.systemId += data;
  3248. }
  3249. return true;
  3250. }
  3251. function after_doctype_system_identifier_state(buffer) {
  3252. var data = buffer.char();
  3253. if (data === InputStream.EOF) {
  3254. tokenizer._parseError("eof-in-doctype");
  3255. tokenizer._currentToken.forceQuirks = true;
  3256. tokenizer._emitCurrentToken();
  3257. buffer.unget(data);
  3258. tokenizer.setState(data_state);
  3259. } else if (isWhitespace(data)) {
  3260. } else if (data === '>') {
  3261. tokenizer._emitCurrentToken();
  3262. tokenizer.setState(data_state);
  3263. } else {
  3264. tokenizer._parseError("unexpected-char-in-doctype");
  3265. tokenizer.setState(bogus_doctype_state);
  3266. }
  3267. return true;
  3268. }
  3269. function bogus_doctype_state(buffer) {
  3270. var data = buffer.char();
  3271. if (data === InputStream.EOF) {
  3272. buffer.unget(data);
  3273. tokenizer._emitCurrentToken();
  3274. tokenizer.setState(data_state);
  3275. } else if (data === '>') {
  3276. tokenizer._emitCurrentToken();
  3277. tokenizer.setState(data_state);
  3278. }
  3279. return true;
  3280. }
  3281. };
  3282. Object.defineProperty(Tokenizer.prototype, 'lineNumber', {
  3283. get: function() {
  3284. return this._inputStream.location().line;
  3285. }
  3286. });
  3287. Object.defineProperty(Tokenizer.prototype, 'columnNumber', {
  3288. get: function() {
  3289. return this._inputStream.location().column;
  3290. }
  3291. });
  3292. exports.Tokenizer = Tokenizer;
  3293. },
  3294. {"./EntityParser":2,"./InputStream":3}],
  3295. 6:[function(_dereq_,module,exports){
  3296. var assert = _dereq_('assert');
  3297. var messages = _dereq_('./messages.json');
  3298. var constants = _dereq_('./constants');
  3299. var EventEmitter = _dereq_('events').EventEmitter;
  3300. var Tokenizer = _dereq_('./Tokenizer').Tokenizer;
  3301. var ElementStack = _dereq_('./ElementStack').ElementStack;
  3302. var StackItem = _dereq_('./StackItem').StackItem;
  3303. var Marker = {};
  3304. function isWhitespace(ch) {
  3305. return ch === " " || ch === "\n" || ch === "\t" || ch === "\r" || ch === "\f";
  3306. }
  3307. function isWhitespaceOrReplacementCharacter(ch) {
  3308. return isWhitespace(ch) || ch === '\uFFFD';
  3309. }
  3310. function isAllWhitespace(characters) {
  3311. for (var i = 0; i < characters.length; i++) {
  3312. var ch = characters[i];
  3313. if (!isWhitespace(ch))
  3314. return false;
  3315. }
  3316. return true;
  3317. }
  3318. function isAllWhitespaceOrReplacementCharacters(characters) {
  3319. for (var i = 0; i < characters.length; i++) {
  3320. var ch = characters[i];
  3321. if (!isWhitespaceOrReplacementCharacter(ch))
  3322. return false;
  3323. }
  3324. return true;
  3325. }
  3326. function getAttribute(node, name) {
  3327. for (var i = 0; i < node.attributes.length; i++) {
  3328. var attribute = node.attributes[i];
  3329. if (attribute.nodeName === name) {
  3330. return attribute;
  3331. }
  3332. }
  3333. return null;
  3334. }
  3335. function CharacterBuffer(characters) {
  3336. this.characters = characters;
  3337. this.current = 0;
  3338. this.end = this.characters.length;
  3339. }
  3340. CharacterBuffer.prototype.skipAtMostOneLeadingNewline = function() {
  3341. if (this.characters[this.current] === '\n')
  3342. this.current++;
  3343. };
  3344. CharacterBuffer.prototype.skipLeadingWhitespace = function() {
  3345. while (isWhitespace(this.characters[this.current])) {
  3346. if (++this.current == this.end)
  3347. return;
  3348. }
  3349. };
  3350. CharacterBuffer.prototype.skipLeadingNonWhitespace = function() {
  3351. while (!isWhitespace(this.characters[this.current])) {
  3352. if (++this.current == this.end)
  3353. return;
  3354. }
  3355. };
  3356. CharacterBuffer.prototype.takeRemaining = function() {
  3357. return this.characters.substring(this.current);
  3358. };
  3359. CharacterBuffer.prototype.takeLeadingWhitespace = function() {
  3360. var start = this.current;
  3361. this.skipLeadingWhitespace();
  3362. if (start === this.current)
  3363. return "";
  3364. return this.characters.substring(start, this.current - start);
  3365. };
  3366. Object.defineProperty(CharacterBuffer.prototype, 'length', {
  3367. get: function(){
  3368. return this.end - this.current;
  3369. }
  3370. });
  3371. function TreeBuilder() {
  3372. this.tokenizer = null;
  3373. this.errorHandler = null;
  3374. this.scriptingEnabled = false;
  3375. this.document = null;
  3376. this.head = null;
  3377. this.form = null;
  3378. this.openElements = new ElementStack();
  3379. this.activeFormattingElements = [];
  3380. this.insertionMode = null;
  3381. this.insertionModeName = "";
  3382. this.originalInsertionMode = "";
  3383. this.inQuirksMode = false; // TODO quirks mode
  3384. this.compatMode = "no quirks";
  3385. this.framesetOk = true;
  3386. this.redirectAttachToFosterParent = false;
  3387. this.selfClosingFlagAcknowledged = false;
  3388. this.context = "";
  3389. this.pendingTableCharacters = [];
  3390. this.shouldSkipLeadingNewline = false;
  3391. var tree = this;
  3392. var modes = this.insertionModes = {};
  3393. modes.base = {
  3394. end_tag_handlers: {"-default": 'endTagOther'},
  3395. start_tag_handlers: {"-default": 'startTagOther'},
  3396. processEOF: function() {
  3397. tree.generateImpliedEndTags();
  3398. if (tree.openElements.length > 2) {
  3399. tree.parseError('expected-closing-tag-but-got-eof');
  3400. } else if (tree.openElements.length == 2 &&
  3401. tree.openElements.item(1).localName != 'body') {
  3402. tree.parseError('expected-closing-tag-but-got-eof');
  3403. } else if (tree.context && tree.openElements.length > 1) {
  3404. }
  3405. },
  3406. processComment: function(data) {
  3407. tree.insertComment(data, tree.currentStackItem().node);
  3408. },
  3409. processDoctype: function(name, publicId, systemId, forceQuirks) {
  3410. tree.parseError('unexpected-doctype');
  3411. },
  3412. processStartTag: function(name, attributes, selfClosing) {
  3413. if (this[this.start_tag_handlers[name]]) {
  3414. this[this.start_tag_handlers[name]](name, attributes, selfClosing);
  3415. } else if (this[this.start_tag_handlers["-default"]]) {
  3416. this[this.start_tag_handlers["-default"]](name, attributes, selfClosing);
  3417. } else {
  3418. throw(new Error("No handler found for "+name));
  3419. }
  3420. },
  3421. processEndTag: function(name) {
  3422. if (this[this.end_tag_handlers[name]]) {
  3423. this[this.end_tag_handlers[name]](name);
  3424. } else if (this[this.end_tag_handlers["-default"]]) {
  3425. this[this.end_tag_handlers["-default"]](name);
  3426. } else {
  3427. throw(new Error("No handler found for "+name));
  3428. }
  3429. },
  3430. startTagHtml: function(name, attributes) {
  3431. modes.inBody.startTagHtml(name, attributes);
  3432. }
  3433. };
  3434. modes.initial = Object.create(modes.base);
  3435. modes.initial.processEOF = function() {
  3436. tree.parseError("expected-doctype-but-got-eof");
  3437. this.anythingElse();
  3438. tree.insertionMode.processEOF();
  3439. };
  3440. modes.initial.processComment = function(data) {
  3441. tree.insertComment(data, tree.document);
  3442. };
  3443. modes.initial.processDoctype = function(name, publicId, systemId, forceQuirks) {
  3444. tree.insertDoctype(name || '', publicId || '', systemId || '');
  3445. if (forceQuirks || name != 'html' || (publicId != null && ([
  3446. "+//silmaril//dtd html pro v0r11 19970101//",
  3447. "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
  3448. "-//as//dtd html 3.0 aswedit + extensions//",
  3449. "-//ietf//dtd html 2.0 level 1//",
  3450. "-//ietf//dtd html 2.0 level 2//",
  3451. "-//ietf//dtd html 2.0 strict level 1//",
  3452. "-//ietf//dtd html 2.0 strict level 2//",
  3453. "-//ietf//dtd html 2.0 strict//",
  3454. "-//ietf//dtd html 2.0//",
  3455. "-//ietf//dtd html 2.1e//",
  3456. "-//ietf//dtd html 3.0//",
  3457. "-//ietf//dtd html 3.0//",
  3458. "-//ietf//dtd html 3.2 final//",
  3459. "-//ietf//dtd html 3.2//",
  3460. "-//ietf//dtd html 3//",
  3461. "-//ietf//dtd html level 0//",
  3462. "-//ietf//dtd html level 0//",
  3463. "-//ietf//dtd html level 1//",
  3464. "-//ietf//dtd html level 1//",
  3465. "-//ietf//dtd html level 2//",
  3466. "-//ietf//dtd html level 2//",
  3467. "-//ietf//dtd html level 3//",
  3468. "-//ietf//dtd html level 3//",
  3469. "-//ietf//dtd html strict level 0//",
  3470. "-//ietf//dtd html strict level 0//",
  3471. "-//ietf//dtd html strict level 1//",
  3472. "-//ietf//dtd html strict level 1//",
  3473. "-//ietf//dtd html strict level 2//",
  3474. "-//ietf//dtd html strict level 2//",
  3475. "-//ietf//dtd html strict level 3//",
  3476. "-//ietf//dtd html strict level 3//",
  3477. "-//ietf//dtd html strict//",
  3478. "-//ietf//dtd html strict//",
  3479. "-//ietf//dtd html strict//",
  3480. "-//ietf//dtd html//",
  3481. "-//ietf//dtd html//",
  3482. "-//ietf//dtd html//",
  3483. "-//metrius//dtd metrius presentational//",
  3484. "-//microsoft//dtd internet explorer 2.0 html strict//",
  3485. "-//microsoft//dtd internet explorer 2.0 html//",
  3486. "-//microsoft//dtd internet explorer 2.0 tables//",
  3487. "-//microsoft//dtd internet explorer 3.0 html strict//",
  3488. "-//microsoft//dtd internet explorer 3.0 html//",
  3489. "-//microsoft//dtd internet explorer 3.0 tables//",
  3490. "-//netscape comm. corp.//dtd html//",
  3491. "-//netscape comm. corp.//dtd strict html//",
  3492. "-//o'reilly and associates//dtd html 2.0//",
  3493. "-//o'reilly and associates//dtd html extended 1.0//",
  3494. "-//spyglass//dtd html 2.0 extended//",
  3495. "-//sq//dtd html 2.0 hotmetal + extensions//",
  3496. "-//sun microsystems corp.//dtd hotjava html//",
  3497. "-//sun microsystems corp.//dtd hotjava strict html//",
  3498. "-//w3c//dtd html 3 1995-03-24//",
  3499. "-//w3c//dtd html 3.2 draft//",
  3500. "-//w3c//dtd html 3.2 final//",
  3501. "-//w3c//dtd html 3.2//",
  3502. "-//w3c//dtd html 3.2s draft//",
  3503. "-//w3c//dtd html 4.0 frameset//",
  3504. "-//w3c//dtd html 4.0 transitional//",
  3505. "-//w3c//dtd html experimental 19960712//",
  3506. "-//w3c//dtd html experimental 970421//",
  3507. "-//w3c//dtd w3 html//",
  3508. "-//w3o//dtd w3 html 3.0//",
  3509. "-//webtechs//dtd mozilla html 2.0//",
  3510. "-//webtechs//dtd mozilla html//",
  3511. "html"
  3512. ].some(publicIdStartsWith)
  3513. || [
  3514. "-//w3o//dtd w3 html strict 3.0//en//",
  3515. "-/w3c/dtd html 4.0 transitional/en",
  3516. "html"
  3517. ].indexOf(publicId.toLowerCase()) > -1
  3518. || (systemId == null && [
  3519. "-//w3c//dtd html 4.01 transitional//",
  3520. "-//w3c//dtd html 4.01 frameset//"
  3521. ].some(publicIdStartsWith)))
  3522. )
  3523. || (systemId != null && (systemId.toLowerCase() == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"))
  3524. ) {
  3525. tree.compatMode = "quirks";
  3526. tree.parseError("quirky-doctype");
  3527. } else if (publicId != null && ([
  3528. "-//w3c//dtd xhtml 1.0 transitional//",
  3529. "-//w3c//dtd xhtml 1.0 frameset//"
  3530. ].some(publicIdStartsWith)
  3531. || (systemId != null && [
  3532. "-//w3c//dtd html 4.01 transitional//",
  3533. "-//w3c//dtd html 4.01 frameset//"
  3534. ].indexOf(publicId.toLowerCase()) > -1))
  3535. ) {
  3536. tree.compatMode = "limited quirks";
  3537. tree.parseError("almost-standards-doctype");
  3538. } else {
  3539. if ((publicId == "-//W3C//DTD HTML 4.0//EN" && (systemId == null || systemId == "http://www.w3.org/TR/REC-html40/strict.dtd"))
  3540. || (publicId == "-//W3C//DTD HTML 4.01//EN" && (systemId == null || systemId == "http://www.w3.org/TR/html4/strict.dtd"))
  3541. || (publicId == "-//W3C//DTD XHTML 1.0 Strict//EN" && (systemId == "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"))
  3542. || (publicId == "-//W3C//DTD XHTML 1.1//EN" && (systemId == "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"))
  3543. ) {
  3544. } else if (!((systemId == null || systemId == "about:legacy-compat") && publicId == null)) {
  3545. tree.parseError("unknown-doctype");
  3546. }
  3547. }
  3548. tree.setInsertionMode('beforeHTML');
  3549. function publicIdStartsWith(string) {
  3550. return publicId.toLowerCase().indexOf(string) === 0;
  3551. }
  3552. };
  3553. modes.initial.processCharacters = function(buffer) {
  3554. buffer.skipLeadingWhitespace();
  3555. if (!buffer.length)
  3556. return;
  3557. tree.parseError('expected-doctype-but-got-chars');
  3558. this.anythingElse();
  3559. tree.insertionMode.processCharacters(buffer);
  3560. };
  3561. modes.initial.processStartTag = function(name, attributes, selfClosing) {
  3562. tree.parseError('expected-doctype-but-got-start-tag', {name: name});
  3563. this.anythingElse();
  3564. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3565. };
  3566. modes.initial.processEndTag = function(name) {
  3567. tree.parseError('expected-doctype-but-got-end-tag', {name: name});
  3568. this.anythingElse();
  3569. tree.insertionMode.processEndTag(name);
  3570. };
  3571. modes.initial.anythingElse = function() {
  3572. tree.compatMode = 'quirks';
  3573. tree.setInsertionMode('beforeHTML');
  3574. };
  3575. modes.beforeHTML = Object.create(modes.base);
  3576. modes.beforeHTML.start_tag_handlers = {
  3577. html: 'startTagHtml',
  3578. '-default': 'startTagOther'
  3579. };
  3580. modes.beforeHTML.processEOF = function() {
  3581. this.anythingElse();
  3582. tree.insertionMode.processEOF();
  3583. };
  3584. modes.beforeHTML.processComment = function(data) {
  3585. tree.insertComment(data, tree.document);
  3586. };
  3587. modes.beforeHTML.processCharacters = function(buffer) {
  3588. buffer.skipLeadingWhitespace();
  3589. if (!buffer.length)
  3590. return;
  3591. this.anythingElse();
  3592. tree.insertionMode.processCharacters(buffer);
  3593. };
  3594. modes.beforeHTML.startTagHtml = function(name, attributes, selfClosing) {
  3595. tree.insertHtmlElement(attributes);
  3596. tree.setInsertionMode('beforeHead');
  3597. };
  3598. modes.beforeHTML.startTagOther = function(name, attributes, selfClosing) {
  3599. this.anythingElse();
  3600. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3601. };
  3602. modes.beforeHTML.processEndTag = function(name) {
  3603. this.anythingElse();
  3604. tree.insertionMode.processEndTag(name);
  3605. };
  3606. modes.beforeHTML.anythingElse = function() {
  3607. tree.insertHtmlElement();
  3608. tree.setInsertionMode('beforeHead');
  3609. };
  3610. modes.afterAfterBody = Object.create(modes.base);
  3611. modes.afterAfterBody.start_tag_handlers = {
  3612. html: 'startTagHtml',
  3613. '-default': 'startTagOther'
  3614. };
  3615. modes.afterAfterBody.processComment = function(data) {
  3616. tree.insertComment(data, tree.document);
  3617. };
  3618. modes.afterAfterBody.processDoctype = function(data) {
  3619. modes.inBody.processDoctype(data);
  3620. };
  3621. modes.afterAfterBody.startTagHtml = function(data, attributes) {
  3622. modes.inBody.startTagHtml(data, attributes);
  3623. };
  3624. modes.afterAfterBody.startTagOther = function(name, attributes, selfClosing) {
  3625. tree.parseError('unexpected-start-tag', {name: name});
  3626. tree.setInsertionMode('inBody');
  3627. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3628. };
  3629. modes.afterAfterBody.endTagOther = function(name) {
  3630. tree.parseError('unexpected-end-tag', {name: name});
  3631. tree.setInsertionMode('inBody');
  3632. tree.insertionMode.processEndTag(name);
  3633. };
  3634. modes.afterAfterBody.processCharacters = function(data) {
  3635. if (!isAllWhitespace(data.characters)) {
  3636. tree.parseError('unexpected-char-after-body');
  3637. tree.setInsertionMode('inBody');
  3638. return tree.insertionMode.processCharacters(data);
  3639. }
  3640. modes.inBody.processCharacters(data);
  3641. };
  3642. modes.afterBody = Object.create(modes.base);
  3643. modes.afterBody.end_tag_handlers = {
  3644. html: 'endTagHtml',
  3645. '-default': 'endTagOther'
  3646. };
  3647. modes.afterBody.processComment = function(data) {
  3648. tree.insertComment(data, tree.openElements.rootNode);
  3649. };
  3650. modes.afterBody.processCharacters = function(data) {
  3651. if (!isAllWhitespace(data.characters)) {
  3652. tree.parseError('unexpected-char-after-body');
  3653. tree.setInsertionMode('inBody');
  3654. return tree.insertionMode.processCharacters(data);
  3655. }
  3656. modes.inBody.processCharacters(data);
  3657. };
  3658. modes.afterBody.processStartTag = function(name, attributes, selfClosing) {
  3659. tree.parseError('unexpected-start-tag-after-body', {name: name});
  3660. tree.setInsertionMode('inBody');
  3661. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3662. };
  3663. modes.afterBody.endTagHtml = function(name) {
  3664. if (tree.context) {
  3665. tree.parseError('end-html-in-innerhtml');
  3666. } else {
  3667. tree.setInsertionMode('afterAfterBody');
  3668. }
  3669. };
  3670. modes.afterBody.endTagOther = function(name) {
  3671. tree.parseError('unexpected-end-tag-after-body', {name: name});
  3672. tree.setInsertionMode('inBody');
  3673. tree.insertionMode.processEndTag(name);
  3674. };
  3675. modes.afterFrameset = Object.create(modes.base);
  3676. modes.afterFrameset.start_tag_handlers = {
  3677. html: 'startTagHtml',
  3678. noframes: 'startTagNoframes',
  3679. '-default': 'startTagOther'
  3680. };
  3681. modes.afterFrameset.end_tag_handlers = {
  3682. html: 'endTagHtml',
  3683. '-default': 'endTagOther'
  3684. };
  3685. modes.afterFrameset.processCharacters = function(buffer) {
  3686. var characters = buffer.takeRemaining();
  3687. var whitespace = "";
  3688. for (var i = 0; i < characters.length; i++) {
  3689. var ch = characters[i];
  3690. if (isWhitespace(ch))
  3691. whitespace += ch;
  3692. }
  3693. if (whitespace) {
  3694. tree.insertText(whitespace);
  3695. }
  3696. if (whitespace.length < characters.length)
  3697. tree.parseError('expected-eof-but-got-char');
  3698. };
  3699. modes.afterFrameset.startTagNoframes = function(name, attributes) {
  3700. modes.inHead.processStartTag(name, attributes);
  3701. };
  3702. modes.afterFrameset.startTagOther = function(name, attributes) {
  3703. tree.parseError("unexpected-start-tag-after-frameset", {name: name});
  3704. };
  3705. modes.afterFrameset.endTagHtml = function(name) {
  3706. tree.setInsertionMode('afterAfterFrameset');
  3707. };
  3708. modes.afterFrameset.endTagOther = function(name) {
  3709. tree.parseError("unexpected-end-tag-after-frameset", {name: name});
  3710. };
  3711. modes.beforeHead = Object.create(modes.base);
  3712. modes.beforeHead.start_tag_handlers = {
  3713. html: 'startTagHtml',
  3714. head: 'startTagHead',
  3715. '-default': 'startTagOther'
  3716. };
  3717. modes.beforeHead.end_tag_handlers = {
  3718. html: 'endTagImplyHead',
  3719. head: 'endTagImplyHead',
  3720. body: 'endTagImplyHead',
  3721. br: 'endTagImplyHead',
  3722. '-default': 'endTagOther'
  3723. };
  3724. modes.beforeHead.processEOF = function() {
  3725. this.startTagHead('head', []);
  3726. tree.insertionMode.processEOF();
  3727. };
  3728. modes.beforeHead.processCharacters = function(buffer) {
  3729. buffer.skipLeadingWhitespace();
  3730. if (!buffer.length)
  3731. return;
  3732. this.startTagHead('head', []);
  3733. tree.insertionMode.processCharacters(buffer);
  3734. };
  3735. modes.beforeHead.startTagHead = function(name, attributes) {
  3736. tree.insertHeadElement(attributes);
  3737. tree.setInsertionMode('inHead');
  3738. };
  3739. modes.beforeHead.startTagOther = function(name, attributes, selfClosing) {
  3740. this.startTagHead('head', []);
  3741. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3742. };
  3743. modes.beforeHead.endTagImplyHead = function(name) {
  3744. this.startTagHead('head', []);
  3745. tree.insertionMode.processEndTag(name);
  3746. };
  3747. modes.beforeHead.endTagOther = function(name) {
  3748. tree.parseError('end-tag-after-implied-root', {name: name});
  3749. };
  3750. modes.inHead = Object.create(modes.base);
  3751. modes.inHead.start_tag_handlers = {
  3752. html: 'startTagHtml',
  3753. head: 'startTagHead',
  3754. title: 'startTagTitle',
  3755. script: 'startTagScript',
  3756. style: 'startTagNoFramesStyle',
  3757. noscript: 'startTagNoScript',
  3758. noframes: 'startTagNoFramesStyle',
  3759. base: 'startTagBaseBasefontBgsoundLink',
  3760. basefont: 'startTagBaseBasefontBgsoundLink',
  3761. bgsound: 'startTagBaseBasefontBgsoundLink',
  3762. link: 'startTagBaseBasefontBgsoundLink',
  3763. meta: 'startTagMeta',
  3764. "-default": 'startTagOther'
  3765. };
  3766. modes.inHead.end_tag_handlers = {
  3767. head: 'endTagHead',
  3768. html: 'endTagHtmlBodyBr',
  3769. body: 'endTagHtmlBodyBr',
  3770. br: 'endTagHtmlBodyBr',
  3771. "-default": 'endTagOther'
  3772. };
  3773. modes.inHead.processEOF = function() {
  3774. var name = tree.currentStackItem().localName;
  3775. if (['title', 'style', 'script'].indexOf(name) != -1) {
  3776. tree.parseError("expected-named-closing-tag-but-got-eof", {name: name});
  3777. tree.popElement();
  3778. }
  3779. this.anythingElse();
  3780. tree.insertionMode.processEOF();
  3781. };
  3782. modes.inHead.processCharacters = function(buffer) {
  3783. var leadingWhitespace = buffer.takeLeadingWhitespace();
  3784. if (leadingWhitespace)
  3785. tree.insertText(leadingWhitespace);
  3786. if (!buffer.length)
  3787. return;
  3788. this.anythingElse();
  3789. tree.insertionMode.processCharacters(buffer);
  3790. };
  3791. modes.inHead.startTagHtml = function(name, attributes) {
  3792. modes.inBody.processStartTag(name, attributes);
  3793. };
  3794. modes.inHead.startTagHead = function(name, attributes) {
  3795. tree.parseError('two-heads-are-not-better-than-one');
  3796. };
  3797. modes.inHead.startTagTitle = function(name, attributes) {
  3798. tree.processGenericRCDATAStartTag(name, attributes);
  3799. };
  3800. modes.inHead.startTagNoScript = function(name, attributes) {
  3801. if (tree.scriptingEnabled)
  3802. return tree.processGenericRawTextStartTag(name, attributes);
  3803. tree.insertElement(name, attributes);
  3804. tree.setInsertionMode('inHeadNoscript');
  3805. };
  3806. modes.inHead.startTagNoFramesStyle = function(name, attributes) {
  3807. tree.processGenericRawTextStartTag(name, attributes);
  3808. };
  3809. modes.inHead.startTagScript = function(name, attributes) {
  3810. tree.insertElement(name, attributes);
  3811. tree.tokenizer.setState(Tokenizer.SCRIPT_DATA);
  3812. tree.originalInsertionMode = tree.insertionModeName;
  3813. tree.setInsertionMode('text');
  3814. };
  3815. modes.inHead.startTagBaseBasefontBgsoundLink = function(name, attributes) {
  3816. tree.insertSelfClosingElement(name, attributes);
  3817. };
  3818. modes.inHead.startTagMeta = function(name, attributes) {
  3819. tree.insertSelfClosingElement(name, attributes);
  3820. };
  3821. modes.inHead.startTagOther = function(name, attributes, selfClosing) {
  3822. this.anythingElse();
  3823. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3824. };
  3825. modes.inHead.endTagHead = function(name) {
  3826. if (tree.openElements.item(tree.openElements.length - 1).localName == 'head') {
  3827. tree.openElements.pop();
  3828. } else {
  3829. tree.parseError('unexpected-end-tag', {name: 'head'});
  3830. }
  3831. tree.setInsertionMode('afterHead');
  3832. };
  3833. modes.inHead.endTagHtmlBodyBr = function(name) {
  3834. this.anythingElse();
  3835. tree.insertionMode.processEndTag(name);
  3836. };
  3837. modes.inHead.endTagOther = function(name) {
  3838. tree.parseError('unexpected-end-tag', {name: name});
  3839. };
  3840. modes.inHead.anythingElse = function() {
  3841. this.endTagHead('head');
  3842. };
  3843. modes.afterHead = Object.create(modes.base);
  3844. modes.afterHead.start_tag_handlers = {
  3845. html: 'startTagHtml',
  3846. head: 'startTagHead',
  3847. body: 'startTagBody',
  3848. frameset: 'startTagFrameset',
  3849. base: 'startTagFromHead',
  3850. link: 'startTagFromHead',
  3851. meta: 'startTagFromHead',
  3852. script: 'startTagFromHead',
  3853. style: 'startTagFromHead',
  3854. title: 'startTagFromHead',
  3855. "-default": 'startTagOther'
  3856. };
  3857. modes.afterHead.end_tag_handlers = {
  3858. body: 'endTagBodyHtmlBr',
  3859. html: 'endTagBodyHtmlBr',
  3860. br: 'endTagBodyHtmlBr',
  3861. "-default": 'endTagOther'
  3862. };
  3863. modes.afterHead.processEOF = function() {
  3864. this.anythingElse();
  3865. tree.insertionMode.processEOF();
  3866. };
  3867. modes.afterHead.processCharacters = function(buffer) {
  3868. var leadingWhitespace = buffer.takeLeadingWhitespace();
  3869. if (leadingWhitespace)
  3870. tree.insertText(leadingWhitespace);
  3871. if (!buffer.length)
  3872. return;
  3873. this.anythingElse();
  3874. tree.insertionMode.processCharacters(buffer);
  3875. };
  3876. modes.afterHead.startTagHtml = function(name, attributes) {
  3877. modes.inBody.processStartTag(name, attributes);
  3878. };
  3879. modes.afterHead.startTagBody = function(name, attributes) {
  3880. tree.framesetOk = false;
  3881. tree.insertBodyElement(attributes);
  3882. tree.setInsertionMode('inBody');
  3883. };
  3884. modes.afterHead.startTagFrameset = function(name, attributes) {
  3885. tree.insertElement(name, attributes);
  3886. tree.setInsertionMode('inFrameset');
  3887. };
  3888. modes.afterHead.startTagFromHead = function(name, attributes, selfClosing) {
  3889. tree.parseError("unexpected-start-tag-out-of-my-head", {name: name});
  3890. tree.openElements.push(tree.head);
  3891. modes.inHead.processStartTag(name, attributes, selfClosing);
  3892. tree.openElements.remove(tree.head);
  3893. };
  3894. modes.afterHead.startTagHead = function(name, attributes, selfClosing) {
  3895. tree.parseError('unexpected-start-tag', {name: name});
  3896. };
  3897. modes.afterHead.startTagOther = function(name, attributes, selfClosing) {
  3898. this.anythingElse();
  3899. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3900. };
  3901. modes.afterHead.endTagBodyHtmlBr = function(name) {
  3902. this.anythingElse();
  3903. tree.insertionMode.processEndTag(name);
  3904. };
  3905. modes.afterHead.endTagOther = function(name) {
  3906. tree.parseError('unexpected-end-tag', {name: name});
  3907. };
  3908. modes.afterHead.anythingElse = function() {
  3909. tree.insertBodyElement([]);
  3910. tree.setInsertionMode('inBody');
  3911. tree.framesetOk = true;
  3912. }
  3913. modes.inBody = Object.create(modes.base);
  3914. modes.inBody.start_tag_handlers = {
  3915. html: 'startTagHtml',
  3916. head: 'startTagMisplaced',
  3917. base: 'startTagProcessInHead',
  3918. basefont: 'startTagProcessInHead',
  3919. bgsound: 'startTagProcessInHead',
  3920. link: 'startTagProcessInHead',
  3921. meta: 'startTagProcessInHead',
  3922. noframes: 'startTagProcessInHead',
  3923. script: 'startTagProcessInHead',
  3924. style: 'startTagProcessInHead',
  3925. title: 'startTagProcessInHead',
  3926. body: 'startTagBody',
  3927. form: 'startTagForm',
  3928. plaintext: 'startTagPlaintext',
  3929. a: 'startTagA',
  3930. button: 'startTagButton',
  3931. xmp: 'startTagXmp',
  3932. table: 'startTagTable',
  3933. hr: 'startTagHr',
  3934. image: 'startTagImage',
  3935. input: 'startTagInput',
  3936. textarea: 'startTagTextarea',
  3937. select: 'startTagSelect',
  3938. isindex: 'startTagIsindex',
  3939. applet: 'startTagAppletMarqueeObject',
  3940. marquee: 'startTagAppletMarqueeObject',
  3941. object: 'startTagAppletMarqueeObject',
  3942. li: 'startTagListItem',
  3943. dd: 'startTagListItem',
  3944. dt: 'startTagListItem',
  3945. address: 'startTagCloseP',
  3946. article: 'startTagCloseP',
  3947. aside: 'startTagCloseP',
  3948. blockquote: 'startTagCloseP',
  3949. center: 'startTagCloseP',
  3950. details: 'startTagCloseP',
  3951. dir: 'startTagCloseP',
  3952. div: 'startTagCloseP',
  3953. dl: 'startTagCloseP',
  3954. fieldset: 'startTagCloseP',
  3955. figcaption: 'startTagCloseP',
  3956. figure: 'startTagCloseP',
  3957. footer: 'startTagCloseP',
  3958. header: 'startTagCloseP',
  3959. hgroup: 'startTagCloseP',
  3960. main: 'startTagCloseP',
  3961. menu: 'startTagCloseP',
  3962. nav: 'startTagCloseP',
  3963. ol: 'startTagCloseP',
  3964. p: 'startTagCloseP',
  3965. section: 'startTagCloseP',
  3966. summary: 'startTagCloseP',
  3967. ul: 'startTagCloseP',
  3968. listing: 'startTagPreListing',
  3969. pre: 'startTagPreListing',
  3970. b: 'startTagFormatting',
  3971. big: 'startTagFormatting',
  3972. code: 'startTagFormatting',
  3973. em: 'startTagFormatting',
  3974. font: 'startTagFormatting',
  3975. i: 'startTagFormatting',
  3976. s: 'startTagFormatting',
  3977. small: 'startTagFormatting',
  3978. strike: 'startTagFormatting',
  3979. strong: 'startTagFormatting',
  3980. tt: 'startTagFormatting',
  3981. u: 'startTagFormatting',
  3982. nobr: 'startTagNobr',
  3983. area: 'startTagVoidFormatting',
  3984. br: 'startTagVoidFormatting',
  3985. embed: 'startTagVoidFormatting',
  3986. img: 'startTagVoidFormatting',
  3987. keygen: 'startTagVoidFormatting',
  3988. wbr: 'startTagVoidFormatting',
  3989. param: 'startTagParamSourceTrack',
  3990. source: 'startTagParamSourceTrack',
  3991. track: 'startTagParamSourceTrack',
  3992. iframe: 'startTagIFrame',
  3993. noembed: 'startTagRawText',
  3994. noscript: 'startTagRawText',
  3995. h1: 'startTagHeading',
  3996. h2: 'startTagHeading',
  3997. h3: 'startTagHeading',
  3998. h4: 'startTagHeading',
  3999. h5: 'startTagHeading',
  4000. h6: 'startTagHeading',
  4001. caption: 'startTagMisplaced',
  4002. col: 'startTagMisplaced',
  4003. colgroup: 'startTagMisplaced',
  4004. frame: 'startTagMisplaced',
  4005. frameset: 'startTagFrameset',
  4006. tbody: 'startTagMisplaced',
  4007. td: 'startTagMisplaced',
  4008. tfoot: 'startTagMisplaced',
  4009. th: 'startTagMisplaced',
  4010. thead: 'startTagMisplaced',
  4011. tr: 'startTagMisplaced',
  4012. option: 'startTagOptionOptgroup',
  4013. optgroup: 'startTagOptionOptgroup',
  4014. math: 'startTagMath',
  4015. svg: 'startTagSVG',
  4016. rt: 'startTagRpRt',
  4017. rp: 'startTagRpRt',
  4018. "-default": 'startTagOther'
  4019. };
  4020. modes.inBody.end_tag_handlers = {
  4021. p: 'endTagP',
  4022. body: 'endTagBody',
  4023. html: 'endTagHtml',
  4024. address: 'endTagBlock',
  4025. article: 'endTagBlock',
  4026. aside: 'endTagBlock',
  4027. blockquote: 'endTagBlock',
  4028. button: 'endTagBlock',
  4029. center: 'endTagBlock',
  4030. details: 'endTagBlock',
  4031. dir: 'endTagBlock',
  4032. div: 'endTagBlock',
  4033. dl: 'endTagBlock',
  4034. fieldset: 'endTagBlock',
  4035. figcaption: 'endTagBlock',
  4036. figure: 'endTagBlock',
  4037. footer: 'endTagBlock',
  4038. header: 'endTagBlock',
  4039. hgroup: 'endTagBlock',
  4040. listing: 'endTagBlock',
  4041. main: 'endTagBlock',
  4042. menu: 'endTagBlock',
  4043. nav: 'endTagBlock',
  4044. ol: 'endTagBlock',
  4045. pre: 'endTagBlock',
  4046. section: 'endTagBlock',
  4047. summary: 'endTagBlock',
  4048. ul: 'endTagBlock',
  4049. form: 'endTagForm',
  4050. applet: 'endTagAppletMarqueeObject',
  4051. marquee: 'endTagAppletMarqueeObject',
  4052. object: 'endTagAppletMarqueeObject',
  4053. dd: 'endTagListItem',
  4054. dt: 'endTagListItem',
  4055. li: 'endTagListItem',
  4056. h1: 'endTagHeading',
  4057. h2: 'endTagHeading',
  4058. h3: 'endTagHeading',
  4059. h4: 'endTagHeading',
  4060. h5: 'endTagHeading',
  4061. h6: 'endTagHeading',
  4062. a: 'endTagFormatting',
  4063. b: 'endTagFormatting',
  4064. big: 'endTagFormatting',
  4065. code: 'endTagFormatting',
  4066. em: 'endTagFormatting',
  4067. font: 'endTagFormatting',
  4068. i: 'endTagFormatting',
  4069. nobr: 'endTagFormatting',
  4070. s: 'endTagFormatting',
  4071. small: 'endTagFormatting',
  4072. strike: 'endTagFormatting',
  4073. strong: 'endTagFormatting',
  4074. tt: 'endTagFormatting',
  4075. u: 'endTagFormatting',
  4076. br: 'endTagBr',
  4077. "-default": 'endTagOther'
  4078. };
  4079. modes.inBody.processCharacters = function(buffer) {
  4080. if (tree.shouldSkipLeadingNewline) {
  4081. tree.shouldSkipLeadingNewline = false;
  4082. buffer.skipAtMostOneLeadingNewline();
  4083. }
  4084. tree.reconstructActiveFormattingElements();
  4085. var characters = buffer.takeRemaining();
  4086. characters = characters.replace(/\u0000/g, function(match, index){
  4087. tree.parseError("invalid-codepoint");
  4088. return '';
  4089. });
  4090. if (!characters)
  4091. return;
  4092. tree.insertText(characters);
  4093. if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
  4094. tree.framesetOk = false;
  4095. };
  4096. modes.inBody.startTagHtml = function(name, attributes) {
  4097. tree.parseError('non-html-root');
  4098. tree.addAttributesToElement(tree.openElements.rootNode, attributes);
  4099. };
  4100. modes.inBody.startTagProcessInHead = function(name, attributes) {
  4101. modes.inHead.processStartTag(name, attributes);
  4102. };
  4103. modes.inBody.startTagBody = function(name, attributes) {
  4104. tree.parseError('unexpected-start-tag', {name: 'body'});
  4105. if (tree.openElements.length == 1 ||
  4106. tree.openElements.item(1).localName != 'body') {
  4107. assert.ok(tree.context);
  4108. } else {
  4109. tree.framesetOk = false;
  4110. tree.addAttributesToElement(tree.openElements.bodyElement, attributes);
  4111. }
  4112. };
  4113. modes.inBody.startTagFrameset = function(name, attributes) {
  4114. tree.parseError('unexpected-start-tag', {name: 'frameset'});
  4115. if (tree.openElements.length == 1 ||
  4116. tree.openElements.item(1).localName != 'body') {
  4117. assert.ok(tree.context);
  4118. } else if (tree.framesetOk) {
  4119. tree.detachFromParent(tree.openElements.bodyElement);
  4120. while (tree.openElements.length > 1)
  4121. tree.openElements.pop();
  4122. tree.insertElement(name, attributes);
  4123. tree.setInsertionMode('inFrameset');
  4124. }
  4125. };
  4126. modes.inBody.startTagCloseP = function(name, attributes) {
  4127. if (tree.openElements.inButtonScope('p'))
  4128. this.endTagP('p');
  4129. tree.insertElement(name, attributes);
  4130. };
  4131. modes.inBody.startTagPreListing = function(name, attributes) {
  4132. if (tree.openElements.inButtonScope('p'))
  4133. this.endTagP('p');
  4134. tree.insertElement(name, attributes);
  4135. tree.framesetOk = false;
  4136. tree.shouldSkipLeadingNewline = true;
  4137. };
  4138. modes.inBody.startTagForm = function(name, attributes) {
  4139. if (tree.form) {
  4140. tree.parseError('unexpected-start-tag', {name: name});
  4141. } else {
  4142. if (tree.openElements.inButtonScope('p'))
  4143. this.endTagP('p');
  4144. tree.insertElement(name, attributes);
  4145. tree.form = tree.currentStackItem();
  4146. }
  4147. };
  4148. modes.inBody.startTagRpRt = function(name, attributes) {
  4149. if (tree.openElements.inScope('ruby')) {
  4150. tree.generateImpliedEndTags();
  4151. if (tree.currentStackItem().localName != 'ruby') {
  4152. tree.parseError('unexpected-start-tag', {name: name});
  4153. }
  4154. }
  4155. tree.insertElement(name, attributes);
  4156. };
  4157. modes.inBody.startTagListItem = function(name, attributes) {
  4158. var stopNames = {li: ['li'], dd: ['dd', 'dt'], dt: ['dd', 'dt']};
  4159. var stopName = stopNames[name];
  4160. var els = tree.openElements;
  4161. for (var i = els.length - 1; i >= 0; i--) {
  4162. var node = els.item(i);
  4163. if (stopName.indexOf(node.localName) != -1) {
  4164. tree.insertionMode.processEndTag(node.localName);
  4165. break;
  4166. }
  4167. if (node.isSpecial() && node.localName !== 'p' && node.localName !== 'address' && node.localName !== 'div')
  4168. break;
  4169. }
  4170. if (tree.openElements.inButtonScope('p'))
  4171. this.endTagP('p');
  4172. tree.insertElement(name, attributes);
  4173. tree.framesetOk = false;
  4174. };
  4175. modes.inBody.startTagPlaintext = function(name, attributes) {
  4176. if (tree.openElements.inButtonScope('p'))
  4177. this.endTagP('p');
  4178. tree.insertElement(name, attributes);
  4179. tree.tokenizer.setState(Tokenizer.PLAINTEXT);
  4180. };
  4181. modes.inBody.startTagHeading = function(name, attributes) {
  4182. if (tree.openElements.inButtonScope('p'))
  4183. this.endTagP('p');
  4184. if (tree.currentStackItem().isNumberedHeader()) {
  4185. tree.parseError('unexpected-start-tag', {name: name});
  4186. tree.popElement();
  4187. }
  4188. tree.insertElement(name, attributes);
  4189. };
  4190. modes.inBody.startTagA = function(name, attributes) {
  4191. var activeA = tree.elementInActiveFormattingElements('a');
  4192. if (activeA) {
  4193. tree.parseError("unexpected-start-tag-implies-end-tag", {startName: "a", endName: "a"});
  4194. tree.adoptionAgencyEndTag('a');
  4195. if (tree.openElements.contains(activeA))
  4196. tree.openElements.remove(activeA);
  4197. tree.removeElementFromActiveFormattingElements(activeA);
  4198. }
  4199. tree.reconstructActiveFormattingElements();
  4200. tree.insertFormattingElement(name, attributes);
  4201. };
  4202. modes.inBody.startTagFormatting = function(name, attributes) {
  4203. tree.reconstructActiveFormattingElements();
  4204. tree.insertFormattingElement(name, attributes);
  4205. };
  4206. modes.inBody.startTagNobr = function(name, attributes) {
  4207. tree.reconstructActiveFormattingElements();
  4208. if (tree.openElements.inScope('nobr')) {
  4209. tree.parseError("unexpected-start-tag-implies-end-tag", {startName: 'nobr', endName: 'nobr'});
  4210. this.processEndTag('nobr');
  4211. tree.reconstructActiveFormattingElements();
  4212. }
  4213. tree.insertFormattingElement(name, attributes);
  4214. };
  4215. modes.inBody.startTagButton = function(name, attributes) {
  4216. if (tree.openElements.inScope('button')) {
  4217. tree.parseError('unexpected-start-tag-implies-end-tag', {startName: 'button', endName: 'button'});
  4218. this.processEndTag('button');
  4219. tree.insertionMode.processStartTag(name, attributes);
  4220. } else {
  4221. tree.framesetOk = false;
  4222. tree.reconstructActiveFormattingElements();
  4223. tree.insertElement(name, attributes);
  4224. }
  4225. };
  4226. modes.inBody.startTagAppletMarqueeObject = function(name, attributes) {
  4227. tree.reconstructActiveFormattingElements();
  4228. tree.insertElement(name, attributes);
  4229. tree.activeFormattingElements.push(Marker);
  4230. tree.framesetOk = false;
  4231. };
  4232. modes.inBody.endTagAppletMarqueeObject = function(name) {
  4233. if (!tree.openElements.inScope(name)) {
  4234. tree.parseError("unexpected-end-tag", {name: name});
  4235. } else {
  4236. tree.generateImpliedEndTags();
  4237. if (tree.currentStackItem().localName != name) {
  4238. tree.parseError('end-tag-too-early', {name: name});
  4239. }
  4240. tree.openElements.popUntilPopped(name);
  4241. tree.clearActiveFormattingElements();
  4242. }
  4243. };
  4244. modes.inBody.startTagXmp = function(name, attributes) {
  4245. if (tree.openElements.inButtonScope('p'))
  4246. this.processEndTag('p');
  4247. tree.reconstructActiveFormattingElements();
  4248. tree.processGenericRawTextStartTag(name, attributes);
  4249. tree.framesetOk = false;
  4250. };
  4251. modes.inBody.startTagTable = function(name, attributes) {
  4252. if (tree.compatMode !== "quirks")
  4253. if (tree.openElements.inButtonScope('p'))
  4254. this.processEndTag('p');
  4255. tree.insertElement(name, attributes);
  4256. tree.setInsertionMode('inTable');
  4257. tree.framesetOk = false;
  4258. };
  4259. modes.inBody.startTagVoidFormatting = function(name, attributes) {
  4260. tree.reconstructActiveFormattingElements();
  4261. tree.insertSelfClosingElement(name, attributes);
  4262. tree.framesetOk = false;
  4263. };
  4264. modes.inBody.startTagParamSourceTrack = function(name, attributes) {
  4265. tree.insertSelfClosingElement(name, attributes);
  4266. };
  4267. modes.inBody.startTagHr = function(name, attributes) {
  4268. if (tree.openElements.inButtonScope('p'))
  4269. this.endTagP('p');
  4270. tree.insertSelfClosingElement(name, attributes);
  4271. tree.framesetOk = false;
  4272. };
  4273. modes.inBody.startTagImage = function(name, attributes) {
  4274. tree.parseError('unexpected-start-tag-treated-as', {originalName: 'image', newName: 'img'});
  4275. this.processStartTag('img', attributes);
  4276. };
  4277. modes.inBody.startTagInput = function(name, attributes) {
  4278. var currentFramesetOk = tree.framesetOk;
  4279. this.startTagVoidFormatting(name, attributes);
  4280. for (var key in attributes) {
  4281. if (attributes[key].nodeName == 'type') {
  4282. if (attributes[key].nodeValue.toLowerCase() == 'hidden')
  4283. tree.framesetOk = currentFramesetOk;
  4284. break;
  4285. }
  4286. }
  4287. };
  4288. modes.inBody.startTagIsindex = function(name, attributes) {
  4289. tree.parseError('deprecated-tag', {name: 'isindex'});
  4290. tree.selfClosingFlagAcknowledged = true;
  4291. if (tree.form)
  4292. return;
  4293. var formAttributes = [];
  4294. var inputAttributes = [];
  4295. var prompt = "This is a searchable index. Enter search keywords: ";
  4296. for (var key in attributes) {
  4297. switch (attributes[key].nodeName) {
  4298. case 'action':
  4299. formAttributes.push({nodeName: 'action',
  4300. nodeValue: attributes[key].nodeValue});
  4301. break;
  4302. case 'prompt':
  4303. prompt = attributes[key].nodeValue;
  4304. break;
  4305. case 'name':
  4306. break;
  4307. default:
  4308. inputAttributes.push({nodeName: attributes[key].nodeName,
  4309. nodeValue: attributes[key].nodeValue});
  4310. }
  4311. }
  4312. inputAttributes.push({nodeName: 'name', nodeValue: 'isindex'});
  4313. this.processStartTag('form', formAttributes);
  4314. this.processStartTag('hr');
  4315. this.processStartTag('label');
  4316. this.processCharacters(new CharacterBuffer(prompt));
  4317. this.processStartTag('input', inputAttributes);
  4318. this.processEndTag('label');
  4319. this.processStartTag('hr');
  4320. this.processEndTag('form');
  4321. };
  4322. modes.inBody.startTagTextarea = function(name, attributes) {
  4323. tree.insertElement(name, attributes);
  4324. tree.tokenizer.setState(Tokenizer.RCDATA);
  4325. tree.originalInsertionMode = tree.insertionModeName;
  4326. tree.shouldSkipLeadingNewline = true;
  4327. tree.framesetOk = false;
  4328. tree.setInsertionMode('text');
  4329. };
  4330. modes.inBody.startTagIFrame = function(name, attributes) {
  4331. tree.framesetOk = false;
  4332. this.startTagRawText(name, attributes);
  4333. };
  4334. modes.inBody.startTagRawText = function(name, attributes) {
  4335. tree.processGenericRawTextStartTag(name, attributes);
  4336. };
  4337. modes.inBody.startTagSelect = function(name, attributes) {
  4338. tree.reconstructActiveFormattingElements();
  4339. tree.insertElement(name, attributes);
  4340. tree.framesetOk = false;
  4341. var insertionModeName = tree.insertionModeName;
  4342. if (insertionModeName == 'inTable' ||
  4343. insertionModeName == 'inCaption' ||
  4344. insertionModeName == 'inColumnGroup' ||
  4345. insertionModeName == 'inTableBody' ||
  4346. insertionModeName == 'inRow' ||
  4347. insertionModeName == 'inCell') {
  4348. tree.setInsertionMode('inSelectInTable');
  4349. } else {
  4350. tree.setInsertionMode('inSelect');
  4351. }
  4352. };
  4353. modes.inBody.startTagMisplaced = function(name, attributes) {
  4354. tree.parseError('unexpected-start-tag-ignored', {name: name});
  4355. };
  4356. modes.inBody.endTagMisplaced = function(name) {
  4357. tree.parseError("unexpected-end-tag", {name: name});
  4358. };
  4359. modes.inBody.endTagBr = function(name) {
  4360. tree.parseError("unexpected-end-tag-treated-as", {originalName: "br", newName: "br element"});
  4361. tree.reconstructActiveFormattingElements();
  4362. tree.insertElement(name, []);
  4363. tree.popElement();
  4364. };
  4365. modes.inBody.startTagOptionOptgroup = function(name, attributes) {
  4366. if (tree.currentStackItem().localName == 'option')
  4367. tree.popElement();
  4368. tree.reconstructActiveFormattingElements();
  4369. tree.insertElement(name, attributes);
  4370. };
  4371. modes.inBody.startTagOther = function(name, attributes) {
  4372. tree.reconstructActiveFormattingElements();
  4373. tree.insertElement(name, attributes);
  4374. };
  4375. modes.inBody.endTagOther = function(name) {
  4376. var node;
  4377. for (var i = tree.openElements.length - 1; i > 0; i--) {
  4378. node = tree.openElements.item(i);
  4379. if (node.localName == name) {
  4380. tree.generateImpliedEndTags(name);
  4381. if (tree.currentStackItem().localName != name)
  4382. tree.parseError('unexpected-end-tag', {name: name});
  4383. tree.openElements.remove_openElements_until(function(x) {return x === node;});
  4384. break;
  4385. }
  4386. if (node.isSpecial()) {
  4387. tree.parseError('unexpected-end-tag', {name: name});
  4388. break;
  4389. }
  4390. }
  4391. };
  4392. modes.inBody.startTagMath = function(name, attributes, selfClosing) {
  4393. tree.reconstructActiveFormattingElements();
  4394. attributes = tree.adjustMathMLAttributes(attributes);
  4395. attributes = tree.adjustForeignAttributes(attributes);
  4396. tree.insertForeignElement(name, attributes, "http://www.w3.org/1998/Math/MathML", selfClosing);
  4397. };
  4398. modes.inBody.startTagSVG = function(name, attributes, selfClosing) {
  4399. tree.reconstructActiveFormattingElements();
  4400. attributes = tree.adjustSVGAttributes(attributes);
  4401. attributes = tree.adjustForeignAttributes(attributes);
  4402. tree.insertForeignElement(name, attributes, "http://www.w3.org/2000/svg", selfClosing);
  4403. };
  4404. modes.inBody.endTagP = function(name) {
  4405. if (!tree.openElements.inButtonScope('p')) {
  4406. tree.parseError('unexpected-end-tag', {name: 'p'});
  4407. this.startTagCloseP('p', []);
  4408. this.endTagP('p');
  4409. } else {
  4410. tree.generateImpliedEndTags('p');
  4411. if (tree.currentStackItem().localName != 'p')
  4412. tree.parseError('unexpected-implied-end-tag', {name: 'p'});
  4413. tree.openElements.popUntilPopped(name);
  4414. }
  4415. };
  4416. modes.inBody.endTagBody = function(name) {
  4417. if (!tree.openElements.inScope('body')) {
  4418. tree.parseError('unexpected-end-tag', {name: name});
  4419. return;
  4420. }
  4421. if (tree.currentStackItem().localName != 'body') {
  4422. tree.parseError('expected-one-end-tag-but-got-another', {
  4423. expectedName: tree.currentStackItem().localName,
  4424. gotName: name
  4425. });
  4426. }
  4427. tree.setInsertionMode('afterBody');
  4428. };
  4429. modes.inBody.endTagHtml = function(name) {
  4430. if (!tree.openElements.inScope('body')) {
  4431. tree.parseError('unexpected-end-tag', {name: name});
  4432. return;
  4433. }
  4434. if (tree.currentStackItem().localName != 'body') {
  4435. tree.parseError('expected-one-end-tag-but-got-another', {
  4436. expectedName: tree.currentStackItem().localName,
  4437. gotName: name
  4438. });
  4439. }
  4440. tree.setInsertionMode('afterBody');
  4441. tree.insertionMode.processEndTag(name);
  4442. };
  4443. modes.inBody.endTagBlock = function(name) {
  4444. if (!tree.openElements.inScope(name)) {
  4445. tree.parseError('unexpected-end-tag', {name: name});
  4446. } else {
  4447. tree.generateImpliedEndTags();
  4448. if (tree.currentStackItem().localName != name) {
  4449. tree.parseError('end-tag-too-early', {name: name});
  4450. }
  4451. tree.openElements.popUntilPopped(name);
  4452. }
  4453. };
  4454. modes.inBody.endTagForm = function(name) {
  4455. var node = tree.form;
  4456. tree.form = null;
  4457. if (!node || !tree.openElements.inScope(name)) {
  4458. tree.parseError('unexpected-end-tag', {name: name});
  4459. } else {
  4460. tree.generateImpliedEndTags();
  4461. if (tree.currentStackItem() != node) {
  4462. tree.parseError('end-tag-too-early-ignored', {name: 'form'});
  4463. }
  4464. tree.openElements.remove(node);
  4465. }
  4466. };
  4467. modes.inBody.endTagListItem = function(name) {
  4468. if (!tree.openElements.inListItemScope(name)) {
  4469. tree.parseError('unexpected-end-tag', {name: name});
  4470. } else {
  4471. tree.generateImpliedEndTags(name);
  4472. if (tree.currentStackItem().localName != name)
  4473. tree.parseError('end-tag-too-early', {name: name});
  4474. tree.openElements.popUntilPopped(name);
  4475. }
  4476. };
  4477. modes.inBody.endTagHeading = function(name) {
  4478. if (!tree.openElements.hasNumberedHeaderElementInScope()) {
  4479. tree.parseError('unexpected-end-tag', {name: name});
  4480. return;
  4481. }
  4482. tree.generateImpliedEndTags();
  4483. if (tree.currentStackItem().localName != name)
  4484. tree.parseError('end-tag-too-early', {name: name});
  4485. tree.openElements.remove_openElements_until(function(e) {
  4486. return e.isNumberedHeader();
  4487. });
  4488. };
  4489. modes.inBody.endTagFormatting = function(name, attributes) {
  4490. if (!tree.adoptionAgencyEndTag(name))
  4491. this.endTagOther(name, attributes);
  4492. };
  4493. modes.inCaption = Object.create(modes.base);
  4494. modes.inCaption.start_tag_handlers = {
  4495. html: 'startTagHtml',
  4496. caption: 'startTagTableElement',
  4497. col: 'startTagTableElement',
  4498. colgroup: 'startTagTableElement',
  4499. tbody: 'startTagTableElement',
  4500. td: 'startTagTableElement',
  4501. tfoot: 'startTagTableElement',
  4502. thead: 'startTagTableElement',
  4503. tr: 'startTagTableElement',
  4504. '-default': 'startTagOther'
  4505. };
  4506. modes.inCaption.end_tag_handlers = {
  4507. caption: 'endTagCaption',
  4508. table: 'endTagTable',
  4509. body: 'endTagIgnore',
  4510. col: 'endTagIgnore',
  4511. colgroup: 'endTagIgnore',
  4512. html: 'endTagIgnore',
  4513. tbody: 'endTagIgnore',
  4514. td: 'endTagIgnore',
  4515. tfood: 'endTagIgnore',
  4516. thead: 'endTagIgnore',
  4517. tr: 'endTagIgnore',
  4518. '-default': 'endTagOther'
  4519. };
  4520. modes.inCaption.processCharacters = function(data) {
  4521. modes.inBody.processCharacters(data);
  4522. };
  4523. modes.inCaption.startTagTableElement = function(name, attributes) {
  4524. tree.parseError('unexpected-end-tag', {name: name});
  4525. var ignoreEndTag = !tree.openElements.inTableScope('caption');
  4526. tree.insertionMode.processEndTag('caption');
  4527. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes);
  4528. };
  4529. modes.inCaption.startTagOther = function(name, attributes, selfClosing) {
  4530. modes.inBody.processStartTag(name, attributes, selfClosing);
  4531. };
  4532. modes.inCaption.endTagCaption = function(name) {
  4533. if (!tree.openElements.inTableScope('caption')) {
  4534. assert.ok(tree.context);
  4535. tree.parseError('unexpected-end-tag', {name: name});
  4536. } else {
  4537. tree.generateImpliedEndTags();
  4538. if (tree.currentStackItem().localName != 'caption') {
  4539. tree.parseError('expected-one-end-tag-but-got-another', {
  4540. gotName: "caption",
  4541. expectedName: tree.currentStackItem().localName
  4542. });
  4543. }
  4544. tree.openElements.popUntilPopped('caption');
  4545. tree.clearActiveFormattingElements();
  4546. tree.setInsertionMode('inTable');
  4547. }
  4548. };
  4549. modes.inCaption.endTagTable = function(name) {
  4550. tree.parseError("unexpected-end-table-in-caption");
  4551. var ignoreEndTag = !tree.openElements.inTableScope('caption');
  4552. tree.insertionMode.processEndTag('caption');
  4553. if (!ignoreEndTag) tree.insertionMode.processEndTag(name);
  4554. };
  4555. modes.inCaption.endTagIgnore = function(name) {
  4556. tree.parseError('unexpected-end-tag', {name: name});
  4557. };
  4558. modes.inCaption.endTagOther = function(name) {
  4559. modes.inBody.processEndTag(name);
  4560. };
  4561. modes.inCell = Object.create(modes.base);
  4562. modes.inCell.start_tag_handlers = {
  4563. html: 'startTagHtml',
  4564. caption: 'startTagTableOther',
  4565. col: 'startTagTableOther',
  4566. colgroup: 'startTagTableOther',
  4567. tbody: 'startTagTableOther',
  4568. td: 'startTagTableOther',
  4569. tfoot: 'startTagTableOther',
  4570. th: 'startTagTableOther',
  4571. thead: 'startTagTableOther',
  4572. tr: 'startTagTableOther',
  4573. '-default': 'startTagOther'
  4574. };
  4575. modes.inCell.end_tag_handlers = {
  4576. td: 'endTagTableCell',
  4577. th: 'endTagTableCell',
  4578. body: 'endTagIgnore',
  4579. caption: 'endTagIgnore',
  4580. col: 'endTagIgnore',
  4581. colgroup: 'endTagIgnore',
  4582. html: 'endTagIgnore',
  4583. table: 'endTagImply',
  4584. tbody: 'endTagImply',
  4585. tfoot: 'endTagImply',
  4586. thead: 'endTagImply',
  4587. tr: 'endTagImply',
  4588. '-default': 'endTagOther'
  4589. };
  4590. modes.inCell.processCharacters = function(data) {
  4591. modes.inBody.processCharacters(data);
  4592. };
  4593. modes.inCell.startTagTableOther = function(name, attributes, selfClosing) {
  4594. if (tree.openElements.inTableScope('td') || tree.openElements.inTableScope('th')) {
  4595. this.closeCell();
  4596. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4597. } else {
  4598. tree.parseError('unexpected-start-tag', {name: name});
  4599. }
  4600. };
  4601. modes.inCell.startTagOther = function(name, attributes, selfClosing) {
  4602. modes.inBody.processStartTag(name, attributes, selfClosing);
  4603. };
  4604. modes.inCell.endTagTableCell = function(name) {
  4605. if (tree.openElements.inTableScope(name)) {
  4606. tree.generateImpliedEndTags(name);
  4607. if (tree.currentStackItem().localName != name.toLowerCase()) {
  4608. tree.parseError('unexpected-cell-end-tag', {name: name});
  4609. tree.openElements.popUntilPopped(name);
  4610. } else {
  4611. tree.popElement();
  4612. }
  4613. tree.clearActiveFormattingElements();
  4614. tree.setInsertionMode('inRow');
  4615. } else {
  4616. tree.parseError('unexpected-end-tag', {name: name});
  4617. }
  4618. };
  4619. modes.inCell.endTagIgnore = function(name) {
  4620. tree.parseError('unexpected-end-tag', {name: name});
  4621. };
  4622. modes.inCell.endTagImply = function(name) {
  4623. if (tree.openElements.inTableScope(name)) {
  4624. this.closeCell();
  4625. tree.insertionMode.processEndTag(name);
  4626. } else {
  4627. tree.parseError('unexpected-end-tag', {name: name});
  4628. }
  4629. };
  4630. modes.inCell.endTagOther = function(name) {
  4631. modes.inBody.processEndTag(name);
  4632. };
  4633. modes.inCell.closeCell = function() {
  4634. if (tree.openElements.inTableScope('td')) {
  4635. this.endTagTableCell('td');
  4636. } else if (tree.openElements.inTableScope('th')) {
  4637. this.endTagTableCell('th');
  4638. }
  4639. };
  4640. modes.inColumnGroup = Object.create(modes.base);
  4641. modes.inColumnGroup.start_tag_handlers = {
  4642. html: 'startTagHtml',
  4643. col: 'startTagCol',
  4644. '-default': 'startTagOther'
  4645. };
  4646. modes.inColumnGroup.end_tag_handlers = {
  4647. colgroup: 'endTagColgroup',
  4648. col: 'endTagCol',
  4649. '-default': 'endTagOther'
  4650. };
  4651. modes.inColumnGroup.ignoreEndTagColgroup = function() {
  4652. return tree.currentStackItem().localName == 'html';
  4653. };
  4654. modes.inColumnGroup.processCharacters = function(buffer) {
  4655. var leadingWhitespace = buffer.takeLeadingWhitespace();
  4656. if (leadingWhitespace)
  4657. tree.insertText(leadingWhitespace);
  4658. if (!buffer.length)
  4659. return;
  4660. var ignoreEndTag = this.ignoreEndTagColgroup();
  4661. this.endTagColgroup('colgroup');
  4662. if (!ignoreEndTag) tree.insertionMode.processCharacters(buffer);
  4663. };
  4664. modes.inColumnGroup.startTagCol = function(name, attributes) {
  4665. tree.insertSelfClosingElement(name, attributes);
  4666. };
  4667. modes.inColumnGroup.startTagOther = function(name, attributes, selfClosing) {
  4668. var ignoreEndTag = this.ignoreEndTagColgroup();
  4669. this.endTagColgroup('colgroup');
  4670. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4671. };
  4672. modes.inColumnGroup.endTagColgroup = function(name) {
  4673. if (this.ignoreEndTagColgroup()) {
  4674. assert.ok(tree.context);
  4675. tree.parseError('unexpected-end-tag', {name: name});
  4676. } else {
  4677. tree.popElement();
  4678. tree.setInsertionMode('inTable');
  4679. }
  4680. };
  4681. modes.inColumnGroup.endTagCol = function(name) {
  4682. tree.parseError("no-end-tag", {name: 'col'});
  4683. };
  4684. modes.inColumnGroup.endTagOther = function(name) {
  4685. var ignoreEndTag = this.ignoreEndTagColgroup();
  4686. this.endTagColgroup('colgroup');
  4687. if (!ignoreEndTag) tree.insertionMode.processEndTag(name) ;
  4688. };
  4689. modes.inForeignContent = Object.create(modes.base);
  4690. modes.inForeignContent.processStartTag = function(name, attributes, selfClosing) {
  4691. 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
  4692. || (name == 'font' && attributes.some(function(attr){ return ['color', 'face', 'size'].indexOf(attr.nodeName) >= 0 }))) {
  4693. tree.parseError('unexpected-html-element-in-foreign-content', {name: name});
  4694. while (tree.currentStackItem().isForeign()
  4695. && !tree.currentStackItem().isHtmlIntegrationPoint()
  4696. && !tree.currentStackItem().isMathMLTextIntegrationPoint()) {
  4697. tree.openElements.pop();
  4698. }
  4699. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4700. return;
  4701. }
  4702. if (tree.currentStackItem().namespaceURI == "http://www.w3.org/1998/Math/MathML") {
  4703. attributes = tree.adjustMathMLAttributes(attributes);
  4704. }
  4705. if (tree.currentStackItem().namespaceURI == "http://www.w3.org/2000/svg") {
  4706. name = tree.adjustSVGTagNameCase(name);
  4707. attributes = tree.adjustSVGAttributes(attributes);
  4708. }
  4709. attributes = tree.adjustForeignAttributes(attributes);
  4710. tree.insertForeignElement(name, attributes, tree.currentStackItem().namespaceURI, selfClosing);
  4711. };
  4712. modes.inForeignContent.processEndTag = function(name) {
  4713. var node = tree.currentStackItem();
  4714. var index = tree.openElements.length - 1;
  4715. if (node.localName.toLowerCase() != name)
  4716. tree.parseError("unexpected-end-tag", {name: name});
  4717. while (true) {
  4718. if (index === 0)
  4719. break;
  4720. if (node.localName.toLowerCase() == name) {
  4721. while (tree.openElements.pop() != node);
  4722. break;
  4723. }
  4724. index -= 1;
  4725. node = tree.openElements.item(index);
  4726. if (node.isForeign()) {
  4727. continue;
  4728. } else {
  4729. tree.insertionMode.processEndTag(name);
  4730. break;
  4731. }
  4732. }
  4733. };
  4734. modes.inForeignContent.processCharacters = function(buffer) {
  4735. var characters = buffer.takeRemaining();
  4736. characters = characters.replace(/\u0000/g, function(match, index){
  4737. tree.parseError('invalid-codepoint');
  4738. return '\uFFFD';
  4739. });
  4740. if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
  4741. tree.framesetOk = false;
  4742. tree.insertText(characters);
  4743. };
  4744. modes.inHeadNoscript = Object.create(modes.base);
  4745. modes.inHeadNoscript.start_tag_handlers = {
  4746. html: 'startTagHtml',
  4747. basefont: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4748. bgsound: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4749. link: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4750. meta: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4751. noframes: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4752. style: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4753. head: 'startTagHeadNoscript',
  4754. noscript: 'startTagHeadNoscript',
  4755. "-default": 'startTagOther'
  4756. };
  4757. modes.inHeadNoscript.end_tag_handlers = {
  4758. noscript: 'endTagNoscript',
  4759. br: 'endTagBr',
  4760. '-default': 'endTagOther'
  4761. };
  4762. modes.inHeadNoscript.processCharacters = function(buffer) {
  4763. var leadingWhitespace = buffer.takeLeadingWhitespace();
  4764. if (leadingWhitespace)
  4765. tree.insertText(leadingWhitespace);
  4766. if (!buffer.length)
  4767. return;
  4768. tree.parseError("unexpected-char-in-frameset");
  4769. this.anythingElse();
  4770. tree.insertionMode.processCharacters(buffer);
  4771. };
  4772. modes.inHeadNoscript.processComment = function(data) {
  4773. modes.inHead.processComment(data);
  4774. };
  4775. modes.inHeadNoscript.startTagBasefontBgsoundLinkMetaNoframesStyle = function(name, attributes) {
  4776. modes.inHead.processStartTag(name, attributes);
  4777. };
  4778. modes.inHeadNoscript.startTagHeadNoscript = function(name, attributes) {
  4779. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4780. };
  4781. modes.inHeadNoscript.startTagOther = function(name, attributes) {
  4782. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4783. this.anythingElse();
  4784. tree.insertionMode.processStartTag(name, attributes);
  4785. };
  4786. modes.inHeadNoscript.endTagBr = function(name, attributes) {
  4787. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4788. this.anythingElse();
  4789. tree.insertionMode.processEndTag(name, attributes);
  4790. };
  4791. modes.inHeadNoscript.endTagNoscript = function(name, attributes) {
  4792. tree.popElement();
  4793. tree.setInsertionMode('inHead');
  4794. };
  4795. modes.inHeadNoscript.endTagOther = function(name, attributes) {
  4796. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4797. };
  4798. modes.inHeadNoscript.anythingElse = function() {
  4799. tree.popElement();
  4800. tree.setInsertionMode('inHead');
  4801. };
  4802. modes.inFrameset = Object.create(modes.base);
  4803. modes.inFrameset.start_tag_handlers = {
  4804. html: 'startTagHtml',
  4805. frameset: 'startTagFrameset',
  4806. frame: 'startTagFrame',
  4807. noframes: 'startTagNoframes',
  4808. "-default": 'startTagOther'
  4809. };
  4810. modes.inFrameset.end_tag_handlers = {
  4811. frameset: 'endTagFrameset',
  4812. noframes: 'endTagNoframes',
  4813. '-default': 'endTagOther'
  4814. };
  4815. modes.inFrameset.processCharacters = function(data) {
  4816. tree.parseError("unexpected-char-in-frameset");
  4817. };
  4818. modes.inFrameset.startTagFrameset = function(name, attributes) {
  4819. tree.insertElement(name, attributes);
  4820. };
  4821. modes.inFrameset.startTagFrame = function(name, attributes) {
  4822. tree.insertSelfClosingElement(name, attributes);
  4823. };
  4824. modes.inFrameset.startTagNoframes = function(name, attributes) {
  4825. modes.inBody.processStartTag(name, attributes);
  4826. };
  4827. modes.inFrameset.startTagOther = function(name, attributes) {
  4828. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4829. };
  4830. modes.inFrameset.endTagFrameset = function(name, attributes) {
  4831. if (tree.currentStackItem().localName == 'html') {
  4832. tree.parseError("unexpected-frameset-in-frameset-innerhtml");
  4833. } else {
  4834. tree.popElement();
  4835. }
  4836. if (!tree.context && tree.currentStackItem().localName != 'frameset') {
  4837. tree.setInsertionMode('afterFrameset');
  4838. }
  4839. };
  4840. modes.inFrameset.endTagNoframes = function(name) {
  4841. modes.inBody.processEndTag(name);
  4842. };
  4843. modes.inFrameset.endTagOther = function(name) {
  4844. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4845. };
  4846. modes.inTable = Object.create(modes.base);
  4847. modes.inTable.start_tag_handlers = {
  4848. html: 'startTagHtml',
  4849. caption: 'startTagCaption',
  4850. colgroup: 'startTagColgroup',
  4851. col: 'startTagCol',
  4852. table: 'startTagTable',
  4853. tbody: 'startTagRowGroup',
  4854. tfoot: 'startTagRowGroup',
  4855. thead: 'startTagRowGroup',
  4856. td: 'startTagImplyTbody',
  4857. th: 'startTagImplyTbody',
  4858. tr: 'startTagImplyTbody',
  4859. style: 'startTagStyleScript',
  4860. script: 'startTagStyleScript',
  4861. input: 'startTagInput',
  4862. form: 'startTagForm',
  4863. '-default': 'startTagOther'
  4864. };
  4865. modes.inTable.end_tag_handlers = {
  4866. table: 'endTagTable',
  4867. body: 'endTagIgnore',
  4868. caption: 'endTagIgnore',
  4869. col: 'endTagIgnore',
  4870. colgroup: 'endTagIgnore',
  4871. html: 'endTagIgnore',
  4872. tbody: 'endTagIgnore',
  4873. td: 'endTagIgnore',
  4874. tfoot: 'endTagIgnore',
  4875. th: 'endTagIgnore',
  4876. thead: 'endTagIgnore',
  4877. tr: 'endTagIgnore',
  4878. '-default': 'endTagOther'
  4879. };
  4880. modes.inTable.processCharacters = function(data) {
  4881. if (tree.currentStackItem().isFosterParenting()) {
  4882. var originalInsertionMode = tree.insertionModeName;
  4883. tree.setInsertionMode('inTableText');
  4884. tree.originalInsertionMode = originalInsertionMode;
  4885. tree.insertionMode.processCharacters(data);
  4886. } else {
  4887. tree.redirectAttachToFosterParent = true;
  4888. modes.inBody.processCharacters(data);
  4889. tree.redirectAttachToFosterParent = false;
  4890. }
  4891. };
  4892. modes.inTable.startTagCaption = function(name, attributes) {
  4893. tree.openElements.popUntilTableScopeMarker();
  4894. tree.activeFormattingElements.push(Marker);
  4895. tree.insertElement(name, attributes);
  4896. tree.setInsertionMode('inCaption');
  4897. };
  4898. modes.inTable.startTagColgroup = function(name, attributes) {
  4899. tree.openElements.popUntilTableScopeMarker();
  4900. tree.insertElement(name, attributes);
  4901. tree.setInsertionMode('inColumnGroup');
  4902. };
  4903. modes.inTable.startTagCol = function(name, attributes) {
  4904. this.startTagColgroup('colgroup', []);
  4905. tree.insertionMode.processStartTag(name, attributes);
  4906. };
  4907. modes.inTable.startTagRowGroup = function(name, attributes) {
  4908. tree.openElements.popUntilTableScopeMarker();
  4909. tree.insertElement(name, attributes);
  4910. tree.setInsertionMode('inTableBody');
  4911. };
  4912. modes.inTable.startTagImplyTbody = function(name, attributes) {
  4913. this.startTagRowGroup('tbody', []);
  4914. tree.insertionMode.processStartTag(name, attributes);
  4915. };
  4916. modes.inTable.startTagTable = function(name, attributes) {
  4917. tree.parseError("unexpected-start-tag-implies-end-tag",
  4918. {startName: "table", endName: "table"});
  4919. tree.insertionMode.processEndTag('table');
  4920. if (!tree.context) tree.insertionMode.processStartTag(name, attributes);
  4921. };
  4922. modes.inTable.startTagStyleScript = function(name, attributes) {
  4923. modes.inHead.processStartTag(name, attributes);
  4924. };
  4925. modes.inTable.startTagInput = function(name, attributes) {
  4926. for (var key in attributes) {
  4927. if (attributes[key].nodeName.toLowerCase() == 'type') {
  4928. if (attributes[key].nodeValue.toLowerCase() == 'hidden') {
  4929. tree.parseError("unexpected-hidden-input-in-table");
  4930. tree.insertElement(name, attributes);
  4931. tree.openElements.pop();
  4932. return;
  4933. }
  4934. break;
  4935. }
  4936. }
  4937. this.startTagOther(name, attributes);
  4938. };
  4939. modes.inTable.startTagForm = function(name, attributes) {
  4940. tree.parseError("unexpected-form-in-table");
  4941. if (!tree.form) {
  4942. tree.insertElement(name, attributes);
  4943. tree.form = tree.currentStackItem();
  4944. tree.openElements.pop();
  4945. }
  4946. };
  4947. modes.inTable.startTagOther = function(name, attributes, selfClosing) {
  4948. tree.parseError("unexpected-start-tag-implies-table-voodoo", {name: name});
  4949. tree.redirectAttachToFosterParent = true;
  4950. modes.inBody.processStartTag(name, attributes, selfClosing);
  4951. tree.redirectAttachToFosterParent = false;
  4952. };
  4953. modes.inTable.endTagTable = function(name) {
  4954. if (tree.openElements.inTableScope(name)) {
  4955. tree.generateImpliedEndTags();
  4956. if (tree.currentStackItem().localName != name) {
  4957. tree.parseError("end-tag-too-early-named", {gotName: 'table', expectedName: tree.currentStackItem().localName});
  4958. }
  4959. tree.openElements.popUntilPopped('table');
  4960. tree.resetInsertionMode();
  4961. } else {
  4962. assert.ok(tree.context);
  4963. tree.parseError('unexpected-end-tag', {name: name});
  4964. }
  4965. };
  4966. modes.inTable.endTagIgnore = function(name) {
  4967. tree.parseError("unexpected-end-tag", {name: name});
  4968. };
  4969. modes.inTable.endTagOther = function(name) {
  4970. tree.parseError("unexpected-end-tag-implies-table-voodoo", {name: name});
  4971. tree.redirectAttachToFosterParent = true;
  4972. modes.inBody.processEndTag(name);
  4973. tree.redirectAttachToFosterParent = false;
  4974. };
  4975. modes.inTableText = Object.create(modes.base);
  4976. modes.inTableText.flushCharacters = function() {
  4977. var characters = tree.pendingTableCharacters.join('');
  4978. if (!isAllWhitespace(characters)) {
  4979. tree.redirectAttachToFosterParent = true;
  4980. tree.reconstructActiveFormattingElements();
  4981. tree.insertText(characters);
  4982. tree.framesetOk = false;
  4983. tree.redirectAttachToFosterParent = false;
  4984. } else {
  4985. tree.insertText(characters);
  4986. }
  4987. tree.pendingTableCharacters = [];
  4988. };
  4989. modes.inTableText.processComment = function(data) {
  4990. this.flushCharacters();
  4991. tree.setInsertionMode(tree.originalInsertionMode);
  4992. tree.insertionMode.processComment(data);
  4993. };
  4994. modes.inTableText.processEOF = function(data) {
  4995. this.flushCharacters();
  4996. tree.setInsertionMode(tree.originalInsertionMode);
  4997. tree.insertionMode.processEOF();
  4998. };
  4999. modes.inTableText.processCharacters = function(buffer) {
  5000. var characters = buffer.takeRemaining();
  5001. characters = characters.replace(/\u0000/g, function(match, index){
  5002. tree.parseError("invalid-codepoint");
  5003. return '';
  5004. });
  5005. if (!characters)
  5006. return;
  5007. tree.pendingTableCharacters.push(characters);
  5008. };
  5009. modes.inTableText.processStartTag = function(name, attributes, selfClosing) {
  5010. this.flushCharacters();
  5011. tree.setInsertionMode(tree.originalInsertionMode);
  5012. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  5013. };
  5014. modes.inTableText.processEndTag = function(name, attributes) {
  5015. this.flushCharacters();
  5016. tree.setInsertionMode(tree.originalInsertionMode);
  5017. tree.insertionMode.processEndTag(name, attributes);
  5018. };
  5019. modes.inTableBody = Object.create(modes.base);
  5020. modes.inTableBody.start_tag_handlers = {
  5021. html: 'startTagHtml',
  5022. tr: 'startTagTr',
  5023. td: 'startTagTableCell',
  5024. th: 'startTagTableCell',
  5025. caption: 'startTagTableOther',
  5026. col: 'startTagTableOther',
  5027. colgroup: 'startTagTableOther',
  5028. tbody: 'startTagTableOther',
  5029. tfoot: 'startTagTableOther',
  5030. thead: 'startTagTableOther',
  5031. '-default': 'startTagOther'
  5032. };
  5033. modes.inTableBody.end_tag_handlers = {
  5034. table: 'endTagTable',
  5035. tbody: 'endTagTableRowGroup',
  5036. tfoot: 'endTagTableRowGroup',
  5037. thead: 'endTagTableRowGroup',
  5038. body: 'endTagIgnore',
  5039. caption: 'endTagIgnore',
  5040. col: 'endTagIgnore',
  5041. colgroup: 'endTagIgnore',
  5042. html: 'endTagIgnore',
  5043. td: 'endTagIgnore',
  5044. th: 'endTagIgnore',
  5045. tr: 'endTagIgnore',
  5046. '-default': 'endTagOther'
  5047. };
  5048. modes.inTableBody.processCharacters = function(data) {
  5049. modes.inTable.processCharacters(data);
  5050. };
  5051. modes.inTableBody.startTagTr = function(name, attributes) {
  5052. tree.openElements.popUntilTableBodyScopeMarker();
  5053. tree.insertElement(name, attributes);
  5054. tree.setInsertionMode('inRow');
  5055. };
  5056. modes.inTableBody.startTagTableCell = function(name, attributes) {
  5057. tree.parseError("unexpected-cell-in-table-body", {name: name});
  5058. this.startTagTr('tr', []);
  5059. tree.insertionMode.processStartTag(name, attributes);
  5060. };
  5061. modes.inTableBody.startTagTableOther = function(name, attributes) {
  5062. if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) {
  5063. tree.openElements.popUntilTableBodyScopeMarker();
  5064. this.endTagTableRowGroup(tree.currentStackItem().localName);
  5065. tree.insertionMode.processStartTag(name, attributes);
  5066. } else {
  5067. tree.parseError('unexpected-start-tag', {name: name});
  5068. }
  5069. };
  5070. modes.inTableBody.startTagOther = function(name, attributes) {
  5071. modes.inTable.processStartTag(name, attributes);
  5072. };
  5073. modes.inTableBody.endTagTableRowGroup = function(name) {
  5074. if (tree.openElements.inTableScope(name)) {
  5075. tree.openElements.popUntilTableBodyScopeMarker();
  5076. tree.popElement();
  5077. tree.setInsertionMode('inTable');
  5078. } else {
  5079. tree.parseError('unexpected-end-tag-in-table-body', {name: name});
  5080. }
  5081. };
  5082. modes.inTableBody.endTagTable = function(name) {
  5083. if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) {
  5084. tree.openElements.popUntilTableBodyScopeMarker();
  5085. this.endTagTableRowGroup(tree.currentStackItem().localName);
  5086. tree.insertionMode.processEndTag(name);
  5087. } else {
  5088. tree.parseError('unexpected-end-tag', {name: name});
  5089. }
  5090. };
  5091. modes.inTableBody.endTagIgnore = function(name) {
  5092. tree.parseError("unexpected-end-tag-in-table-body", {name: name});
  5093. };
  5094. modes.inTableBody.endTagOther = function(name) {
  5095. modes.inTable.processEndTag(name);
  5096. };
  5097. modes.inSelect = Object.create(modes.base);
  5098. modes.inSelect.start_tag_handlers = {
  5099. html: 'startTagHtml',
  5100. option: 'startTagOption',
  5101. optgroup: 'startTagOptgroup',
  5102. select: 'startTagSelect',
  5103. input: 'startTagInput',
  5104. keygen: 'startTagInput',
  5105. textarea: 'startTagInput',
  5106. script: 'startTagScript',
  5107. '-default': 'startTagOther'
  5108. };
  5109. modes.inSelect.end_tag_handlers = {
  5110. option: 'endTagOption',
  5111. optgroup: 'endTagOptgroup',
  5112. select: 'endTagSelect',
  5113. caption: 'endTagTableElements',
  5114. table: 'endTagTableElements',
  5115. tbody: 'endTagTableElements',
  5116. tfoot: 'endTagTableElements',
  5117. thead: 'endTagTableElements',
  5118. tr: 'endTagTableElements',
  5119. td: 'endTagTableElements',
  5120. th: 'endTagTableElements',
  5121. '-default': 'endTagOther'
  5122. };
  5123. modes.inSelect.processCharacters = function(buffer) {
  5124. var data = buffer.takeRemaining();
  5125. data = data.replace(/\u0000/g, function(match, index){
  5126. tree.parseError("invalid-codepoint");
  5127. return '';
  5128. });
  5129. if (!data)
  5130. return;
  5131. tree.insertText(data);
  5132. };
  5133. modes.inSelect.startTagOption = function(name, attributes) {
  5134. if (tree.currentStackItem().localName == 'option')
  5135. tree.popElement();
  5136. tree.insertElement(name, attributes);
  5137. };
  5138. modes.inSelect.startTagOptgroup = function(name, attributes) {
  5139. if (tree.currentStackItem().localName == 'option')
  5140. tree.popElement();
  5141. if (tree.currentStackItem().localName == 'optgroup')
  5142. tree.popElement();
  5143. tree.insertElement(name, attributes);
  5144. };
  5145. modes.inSelect.endTagOption = function(name) {
  5146. if (tree.currentStackItem().localName !== 'option') {
  5147. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5148. return;
  5149. }
  5150. tree.popElement();
  5151. };
  5152. modes.inSelect.endTagOptgroup = function(name) {
  5153. if (tree.currentStackItem().localName == 'option' && tree.openElements.item(tree.openElements.length - 2).localName == 'optgroup') {
  5154. tree.popElement();
  5155. }
  5156. if (tree.currentStackItem().localName == 'optgroup') {
  5157. tree.popElement();
  5158. } else {
  5159. tree.parseError('unexpected-end-tag-in-select', {name: 'optgroup'});
  5160. }
  5161. };
  5162. modes.inSelect.startTagSelect = function(name) {
  5163. tree.parseError("unexpected-select-in-select");
  5164. this.endTagSelect('select');
  5165. };
  5166. modes.inSelect.endTagSelect = function(name) {
  5167. if (tree.openElements.inTableScope('select')) {
  5168. tree.openElements.popUntilPopped('select');
  5169. tree.resetInsertionMode();
  5170. } else {
  5171. tree.parseError('unexpected-end-tag', {name: name});
  5172. }
  5173. };
  5174. modes.inSelect.startTagInput = function(name, attributes) {
  5175. tree.parseError("unexpected-input-in-select");
  5176. if (tree.openElements.inSelectScope('select')) {
  5177. this.endTagSelect('select');
  5178. tree.insertionMode.processStartTag(name, attributes);
  5179. }
  5180. };
  5181. modes.inSelect.startTagScript = function(name, attributes) {
  5182. modes.inHead.processStartTag(name, attributes);
  5183. };
  5184. modes.inSelect.endTagTableElements = function(name) {
  5185. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5186. if (tree.openElements.inTableScope(name)) {
  5187. this.endTagSelect('select');
  5188. tree.insertionMode.processEndTag(name);
  5189. }
  5190. };
  5191. modes.inSelect.startTagOther = function(name, attributes) {
  5192. tree.parseError("unexpected-start-tag-in-select", {name: name});
  5193. };
  5194. modes.inSelect.endTagOther = function(name) {
  5195. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5196. };
  5197. modes.inSelectInTable = Object.create(modes.base);
  5198. modes.inSelectInTable.start_tag_handlers = {
  5199. caption: 'startTagTable',
  5200. table: 'startTagTable',
  5201. tbody: 'startTagTable',
  5202. tfoot: 'startTagTable',
  5203. thead: 'startTagTable',
  5204. tr: 'startTagTable',
  5205. td: 'startTagTable',
  5206. th: 'startTagTable',
  5207. '-default': 'startTagOther'
  5208. };
  5209. modes.inSelectInTable.end_tag_handlers = {
  5210. caption: 'endTagTable',
  5211. table: 'endTagTable',
  5212. tbody: 'endTagTable',
  5213. tfoot: 'endTagTable',
  5214. thead: 'endTagTable',
  5215. tr: 'endTagTable',
  5216. td: 'endTagTable',
  5217. th: 'endTagTable',
  5218. '-default': 'endTagOther'
  5219. };
  5220. modes.inSelectInTable.processCharacters = function(data) {
  5221. modes.inSelect.processCharacters(data);
  5222. };
  5223. modes.inSelectInTable.startTagTable = function(name, attributes) {
  5224. tree.parseError("unexpected-table-element-start-tag-in-select-in-table", {name: name});
  5225. this.endTagOther("select");
  5226. tree.insertionMode.processStartTag(name, attributes);
  5227. };
  5228. modes.inSelectInTable.startTagOther = function(name, attributes, selfClosing) {
  5229. modes.inSelect.processStartTag(name, attributes, selfClosing);
  5230. };
  5231. modes.inSelectInTable.endTagTable = function(name) {
  5232. tree.parseError("unexpected-table-element-end-tag-in-select-in-table", {name: name});
  5233. if (tree.openElements.inTableScope(name)) {
  5234. this.endTagOther("select");
  5235. tree.insertionMode.processEndTag(name);
  5236. }
  5237. };
  5238. modes.inSelectInTable.endTagOther = function(name) {
  5239. modes.inSelect.processEndTag(name);
  5240. };
  5241. modes.inRow = Object.create(modes.base);
  5242. modes.inRow.start_tag_handlers = {
  5243. html: 'startTagHtml',
  5244. td: 'startTagTableCell',
  5245. th: 'startTagTableCell',
  5246. caption: 'startTagTableOther',
  5247. col: 'startTagTableOther',
  5248. colgroup: 'startTagTableOther',
  5249. tbody: 'startTagTableOther',
  5250. tfoot: 'startTagTableOther',
  5251. thead: 'startTagTableOther',
  5252. tr: 'startTagTableOther',
  5253. '-default': 'startTagOther'
  5254. };
  5255. modes.inRow.end_tag_handlers = {
  5256. tr: 'endTagTr',
  5257. table: 'endTagTable',
  5258. tbody: 'endTagTableRowGroup',
  5259. tfoot: 'endTagTableRowGroup',
  5260. thead: 'endTagTableRowGroup',
  5261. body: 'endTagIgnore',
  5262. caption: 'endTagIgnore',
  5263. col: 'endTagIgnore',
  5264. colgroup: 'endTagIgnore',
  5265. html: 'endTagIgnore',
  5266. td: 'endTagIgnore',
  5267. th: 'endTagIgnore',
  5268. '-default': 'endTagOther'
  5269. };
  5270. modes.inRow.processCharacters = function(data) {
  5271. modes.inTable.processCharacters(data);
  5272. };
  5273. modes.inRow.startTagTableCell = function(name, attributes) {
  5274. tree.openElements.popUntilTableRowScopeMarker();
  5275. tree.insertElement(name, attributes);
  5276. tree.setInsertionMode('inCell');
  5277. tree.activeFormattingElements.push(Marker);
  5278. };
  5279. modes.inRow.startTagTableOther = function(name, attributes) {
  5280. var ignoreEndTag = this.ignoreEndTagTr();
  5281. this.endTagTr('tr');
  5282. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes);
  5283. };
  5284. modes.inRow.startTagOther = function(name, attributes, selfClosing) {
  5285. modes.inTable.processStartTag(name, attributes, selfClosing);
  5286. };
  5287. modes.inRow.endTagTr = function(name) {
  5288. if (this.ignoreEndTagTr()) {
  5289. assert.ok(tree.context);
  5290. tree.parseError('unexpected-end-tag', {name: name});
  5291. } else {
  5292. tree.openElements.popUntilTableRowScopeMarker();
  5293. tree.popElement();
  5294. tree.setInsertionMode('inTableBody');
  5295. }
  5296. };
  5297. modes.inRow.endTagTable = function(name) {
  5298. var ignoreEndTag = this.ignoreEndTagTr();
  5299. this.endTagTr('tr');
  5300. if (!ignoreEndTag) tree.insertionMode.processEndTag(name);
  5301. };
  5302. modes.inRow.endTagTableRowGroup = function(name) {
  5303. if (tree.openElements.inTableScope(name)) {
  5304. this.endTagTr('tr');
  5305. tree.insertionMode.processEndTag(name);
  5306. } else {
  5307. tree.parseError('unexpected-end-tag', {name: name});
  5308. }
  5309. };
  5310. modes.inRow.endTagIgnore = function(name) {
  5311. tree.parseError("unexpected-end-tag-in-table-row", {name: name});
  5312. };
  5313. modes.inRow.endTagOther = function(name) {
  5314. modes.inTable.processEndTag(name);
  5315. };
  5316. modes.inRow.ignoreEndTagTr = function() {
  5317. return !tree.openElements.inTableScope('tr');
  5318. };
  5319. modes.afterAfterFrameset = Object.create(modes.base);
  5320. modes.afterAfterFrameset.start_tag_handlers = {
  5321. html: 'startTagHtml',
  5322. noframes: 'startTagNoFrames',
  5323. '-default': 'startTagOther'
  5324. };
  5325. modes.afterAfterFrameset.processEOF = function() {};
  5326. modes.afterAfterFrameset.processComment = function(data) {
  5327. tree.insertComment(data, tree.document);
  5328. };
  5329. modes.afterAfterFrameset.processCharacters = function(buffer) {
  5330. var characters = buffer.takeRemaining();
  5331. var whitespace = "";
  5332. for (var i = 0; i < characters.length; i++) {
  5333. var ch = characters[i];
  5334. if (isWhitespace(ch))
  5335. whitespace += ch;
  5336. }
  5337. if (whitespace) {
  5338. tree.reconstructActiveFormattingElements();
  5339. tree.insertText(whitespace);
  5340. }
  5341. if (whitespace.length < characters.length)
  5342. tree.parseError('expected-eof-but-got-char');
  5343. };
  5344. modes.afterAfterFrameset.startTagNoFrames = function(name, attributes) {
  5345. modes.inHead.processStartTag(name, attributes);
  5346. };
  5347. modes.afterAfterFrameset.startTagOther = function(name, attributes, selfClosing) {
  5348. tree.parseError('expected-eof-but-got-start-tag', {name: name});
  5349. };
  5350. modes.afterAfterFrameset.processEndTag = function(name, attributes) {
  5351. tree.parseError('expected-eof-but-got-end-tag', {name: name});
  5352. };
  5353. modes.text = Object.create(modes.base);
  5354. modes.text.start_tag_handlers = {
  5355. '-default': 'startTagOther'
  5356. };
  5357. modes.text.end_tag_handlers = {
  5358. script: 'endTagScript',
  5359. '-default': 'endTagOther'
  5360. };
  5361. modes.text.processCharacters = function(buffer) {
  5362. if (tree.shouldSkipLeadingNewline) {
  5363. tree.shouldSkipLeadingNewline = false;
  5364. buffer.skipAtMostOneLeadingNewline();
  5365. }
  5366. var data = buffer.takeRemaining();
  5367. if (!data)
  5368. return;
  5369. tree.insertText(data);
  5370. };
  5371. modes.text.processEOF = function() {
  5372. tree.parseError("expected-named-closing-tag-but-got-eof",
  5373. {name: tree.currentStackItem().localName});
  5374. tree.openElements.pop();
  5375. tree.setInsertionMode(tree.originalInsertionMode);
  5376. tree.insertionMode.processEOF();
  5377. };
  5378. modes.text.startTagOther = function(name) {
  5379. throw "Tried to process start tag " + name + " in RCDATA/RAWTEXT mode";
  5380. };
  5381. modes.text.endTagScript = function(name) {
  5382. var node = tree.openElements.pop();
  5383. assert.ok(node.localName == 'script');
  5384. tree.setInsertionMode(tree.originalInsertionMode);
  5385. };
  5386. modes.text.endTagOther = function(name) {
  5387. tree.openElements.pop();
  5388. tree.setInsertionMode(tree.originalInsertionMode);
  5389. };
  5390. }
  5391. TreeBuilder.prototype.setInsertionMode = function(name) {
  5392. this.insertionMode = this.insertionModes[name];
  5393. this.insertionModeName = name;
  5394. };
  5395. TreeBuilder.prototype.adoptionAgencyEndTag = function(name) {
  5396. var outerIterationLimit = 8;
  5397. var innerIterationLimit = 3;
  5398. var formattingElement;
  5399. function isActiveFormattingElement(el) {
  5400. return el === formattingElement;
  5401. }
  5402. var outerLoopCounter = 0;
  5403. while (outerLoopCounter++ < outerIterationLimit) {
  5404. formattingElement = this.elementInActiveFormattingElements(name);
  5405. if (!formattingElement || (this.openElements.contains(formattingElement) && !this.openElements.inScope(formattingElement.localName))) {
  5406. this.parseError('adoption-agency-1.1', {name: name});
  5407. return false;
  5408. }
  5409. if (!this.openElements.contains(formattingElement)) {
  5410. this.parseError('adoption-agency-1.2', {name: name});
  5411. this.removeElementFromActiveFormattingElements(formattingElement);
  5412. return true;
  5413. }
  5414. if (!this.openElements.inScope(formattingElement.localName)) {
  5415. this.parseError('adoption-agency-4.4', {name: name});
  5416. }
  5417. if (formattingElement != this.currentStackItem()) {
  5418. this.parseError('adoption-agency-1.3', {name: name});
  5419. }
  5420. var furthestBlock = this.openElements.furthestBlockForFormattingElement(formattingElement.node);
  5421. if (!furthestBlock) {
  5422. this.openElements.remove_openElements_until(isActiveFormattingElement);
  5423. this.removeElementFromActiveFormattingElements(formattingElement);
  5424. return true;
  5425. }
  5426. var afeIndex = this.openElements.elements.indexOf(formattingElement);
  5427. var commonAncestor = this.openElements.item(afeIndex - 1);
  5428. var bookmark = this.activeFormattingElements.indexOf(formattingElement);
  5429. var node = furthestBlock;
  5430. var lastNode = furthestBlock;
  5431. var index = this.openElements.elements.indexOf(node);
  5432. var innerLoopCounter = 0;
  5433. while (innerLoopCounter++ < innerIterationLimit) {
  5434. index -= 1;
  5435. node = this.openElements.item(index);
  5436. if (this.activeFormattingElements.indexOf(node) < 0) {
  5437. this.openElements.elements.splice(index, 1);
  5438. continue;
  5439. }
  5440. if (node == formattingElement)
  5441. break;
  5442. if (lastNode == furthestBlock)
  5443. bookmark = this.activeFormattingElements.indexOf(node) + 1;
  5444. var clone = this.createElement(node.namespaceURI, node.localName, node.attributes);
  5445. var newNode = new StackItem(node.namespaceURI, node.localName, node.attributes, clone);
  5446. this.activeFormattingElements[this.activeFormattingElements.indexOf(node)] = newNode;
  5447. this.openElements.elements[this.openElements.elements.indexOf(node)] = newNode;
  5448. node = newNode;
  5449. this.detachFromParent(lastNode.node);
  5450. this.attachNode(lastNode.node, node.node);
  5451. lastNode = node;
  5452. }
  5453. this.detachFromParent(lastNode.node);
  5454. if (commonAncestor.isFosterParenting()) {
  5455. this.insertIntoFosterParent(lastNode.node);
  5456. } else {
  5457. this.attachNode(lastNode.node, commonAncestor.node);
  5458. }
  5459. var clone = this.createElement("http://www.w3.org/1999/xhtml", formattingElement.localName, formattingElement.attributes);
  5460. var formattingClone = new StackItem(formattingElement.namespaceURI, formattingElement.localName, formattingElement.attributes, clone);
  5461. this.reparentChildren(furthestBlock.node, clone);
  5462. this.attachNode(clone, furthestBlock.node);
  5463. this.removeElementFromActiveFormattingElements(formattingElement);
  5464. this.activeFormattingElements.splice(Math.min(bookmark, this.activeFormattingElements.length), 0, formattingClone);
  5465. this.openElements.remove(formattingElement);
  5466. this.openElements.elements.splice(this.openElements.elements.indexOf(furthestBlock) + 1, 0, formattingClone);
  5467. }
  5468. return true;
  5469. };
  5470. TreeBuilder.prototype.start = function() {
  5471. throw "Not mplemented";
  5472. };
  5473. TreeBuilder.prototype.startTokenization = function(tokenizer) {
  5474. this.tokenizer = tokenizer;
  5475. this.compatMode = "no quirks";
  5476. this.originalInsertionMode = "initial";
  5477. this.framesetOk = true;
  5478. this.openElements = new ElementStack();
  5479. this.activeFormattingElements = [];
  5480. this.start();
  5481. if (this.context) {
  5482. switch(this.context) {
  5483. case 'title':
  5484. case 'textarea':
  5485. this.tokenizer.setState(Tokenizer.RCDATA);
  5486. break;
  5487. case 'style':
  5488. case 'xmp':
  5489. case 'iframe':
  5490. case 'noembed':
  5491. case 'noframes':
  5492. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5493. break;
  5494. case 'script':
  5495. this.tokenizer.setState(Tokenizer.SCRIPT_DATA);
  5496. break;
  5497. case 'noscript':
  5498. if (this.scriptingEnabled)
  5499. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5500. break;
  5501. case 'plaintext':
  5502. this.tokenizer.setState(Tokenizer.PLAINTEXT);
  5503. break;
  5504. }
  5505. this.insertHtmlElement();
  5506. this.resetInsertionMode();
  5507. } else {
  5508. this.setInsertionMode('initial');
  5509. }
  5510. };
  5511. TreeBuilder.prototype.processToken = function(token) {
  5512. this.selfClosingFlagAcknowledged = false;
  5513. var currentNode = this.openElements.top || null;
  5514. var insertionMode;
  5515. if (!currentNode || !currentNode.isForeign() ||
  5516. (currentNode.isMathMLTextIntegrationPoint() &&
  5517. ((token.type == 'StartTag' &&
  5518. !(token.name in {mglyph:0, malignmark:0})) ||
  5519. (token.type === 'Characters'))
  5520. ) ||
  5521. (currentNode.namespaceURI == "http://www.w3.org/1998/Math/MathML" &&
  5522. currentNode.localName == 'annotation-xml' &&
  5523. token.type == 'StartTag' && token.name == 'svg'
  5524. ) ||
  5525. (currentNode.isHtmlIntegrationPoint() &&
  5526. token.type in {StartTag:0, Characters:0}
  5527. ) ||
  5528. token.type == 'EOF'
  5529. ) {
  5530. insertionMode = this.insertionMode;
  5531. } else {
  5532. insertionMode = this.insertionModes.inForeignContent;
  5533. }
  5534. switch(token.type) {
  5535. case 'Characters':
  5536. var buffer = new CharacterBuffer(token.data);
  5537. insertionMode.processCharacters(buffer);
  5538. break;
  5539. case 'Comment':
  5540. insertionMode.processComment(token.data);
  5541. break;
  5542. case 'StartTag':
  5543. insertionMode.processStartTag(token.name, token.data, token.selfClosing);
  5544. break;
  5545. case 'EndTag':
  5546. insertionMode.processEndTag(token.name);
  5547. break;
  5548. case 'Doctype':
  5549. insertionMode.processDoctype(token.name, token.publicId, token.systemId, token.forceQuirks);
  5550. break;
  5551. case 'EOF':
  5552. insertionMode.processEOF();
  5553. break;
  5554. }
  5555. };
  5556. TreeBuilder.prototype.isCdataSectionAllowed = function() {
  5557. return this.openElements.length > 0 && this.currentStackItem().isForeign();
  5558. };
  5559. TreeBuilder.prototype.isSelfClosingFlagAcknowledged = function() {
  5560. return this.selfClosingFlagAcknowledged;
  5561. };
  5562. TreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) {
  5563. throw new Error("Not implemented");
  5564. };
  5565. TreeBuilder.prototype.attachNode = function(child, parent) {
  5566. throw new Error("Not implemented");
  5567. };
  5568. TreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) {
  5569. throw new Error("Not implemented");
  5570. };
  5571. TreeBuilder.prototype.detachFromParent = function(node) {
  5572. throw new Error("Not implemented");
  5573. };
  5574. TreeBuilder.prototype.addAttributesToElement = function(element, attributes) {
  5575. throw new Error("Not implemented");
  5576. };
  5577. TreeBuilder.prototype.insertHtmlElement = function(attributes) {
  5578. var root = this.createElement("http://www.w3.org/1999/xhtml", 'html', attributes);
  5579. this.attachNode(root, this.document);
  5580. this.openElements.pushHtmlElement(new StackItem("http://www.w3.org/1999/xhtml", 'html', attributes, root));
  5581. return root;
  5582. };
  5583. TreeBuilder.prototype.insertHeadElement = function(attributes) {
  5584. var element = this.createElement("http://www.w3.org/1999/xhtml", "head", attributes);
  5585. this.head = new StackItem("http://www.w3.org/1999/xhtml", "head", attributes, element);
  5586. this.attachNode(element, this.openElements.top.node);
  5587. this.openElements.pushHeadElement(this.head);
  5588. return element;
  5589. };
  5590. TreeBuilder.prototype.insertBodyElement = function(attributes) {
  5591. var element = this.createElement("http://www.w3.org/1999/xhtml", "body", attributes);
  5592. this.attachNode(element, this.openElements.top.node);
  5593. this.openElements.pushBodyElement(new StackItem("http://www.w3.org/1999/xhtml", "body", attributes, element));
  5594. return element;
  5595. };
  5596. TreeBuilder.prototype.insertIntoFosterParent = function(node) {
  5597. var tableIndex = this.openElements.findIndex('table');
  5598. var tableElement = this.openElements.item(tableIndex).node;
  5599. if (tableIndex === 0)
  5600. return this.attachNode(node, tableElement);
  5601. this.attachNodeToFosterParent(node, tableElement, this.openElements.item(tableIndex - 1).node);
  5602. };
  5603. TreeBuilder.prototype.insertElement = function(name, attributes, namespaceURI, selfClosing) {
  5604. if (!namespaceURI)
  5605. namespaceURI = "http://www.w3.org/1999/xhtml";
  5606. var element = this.createElement(namespaceURI, name, attributes);
  5607. if (this.shouldFosterParent())
  5608. this.insertIntoFosterParent(element);
  5609. else
  5610. this.attachNode(element, this.openElements.top.node);
  5611. if (!selfClosing)
  5612. this.openElements.push(new StackItem(namespaceURI, name, attributes, element));
  5613. };
  5614. TreeBuilder.prototype.insertFormattingElement = function(name, attributes) {
  5615. this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml");
  5616. this.appendElementToActiveFormattingElements(this.currentStackItem());
  5617. };
  5618. TreeBuilder.prototype.insertSelfClosingElement = function(name, attributes) {
  5619. this.selfClosingFlagAcknowledged = true;
  5620. this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml", true);
  5621. };
  5622. TreeBuilder.prototype.insertForeignElement = function(name, attributes, namespaceURI, selfClosing) {
  5623. if (selfClosing)
  5624. this.selfClosingFlagAcknowledged = true;
  5625. this.insertElement(name, attributes, namespaceURI, selfClosing);
  5626. };
  5627. TreeBuilder.prototype.insertComment = function(data, parent) {
  5628. throw new Error("Not implemented");
  5629. };
  5630. TreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) {
  5631. throw new Error("Not implemented");
  5632. };
  5633. TreeBuilder.prototype.insertText = function(data) {
  5634. throw new Error("Not implemented");
  5635. };
  5636. TreeBuilder.prototype.currentStackItem = function() {
  5637. return this.openElements.top;
  5638. };
  5639. TreeBuilder.prototype.popElement = function() {
  5640. return this.openElements.pop();
  5641. };
  5642. TreeBuilder.prototype.shouldFosterParent = function() {
  5643. return this.redirectAttachToFosterParent && this.currentStackItem().isFosterParenting();
  5644. };
  5645. TreeBuilder.prototype.generateImpliedEndTags = function(exclude) {
  5646. var name = this.openElements.top.localName;
  5647. if (['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'].indexOf(name) != -1 && name != exclude) {
  5648. this.popElement();
  5649. this.generateImpliedEndTags(exclude);
  5650. }
  5651. };
  5652. TreeBuilder.prototype.reconstructActiveFormattingElements = function() {
  5653. if (this.activeFormattingElements.length === 0)
  5654. return;
  5655. var i = this.activeFormattingElements.length - 1;
  5656. var entry = this.activeFormattingElements[i];
  5657. if (entry == Marker || this.openElements.contains(entry))
  5658. return;
  5659. while (entry != Marker && !this.openElements.contains(entry)) {
  5660. i -= 1;
  5661. entry = this.activeFormattingElements[i];
  5662. if (!entry)
  5663. break;
  5664. }
  5665. while (true) {
  5666. i += 1;
  5667. entry = this.activeFormattingElements[i];
  5668. this.insertElement(entry.localName, entry.attributes);
  5669. var element = this.currentStackItem();
  5670. this.activeFormattingElements[i] = element;
  5671. if (element == this.activeFormattingElements[this.activeFormattingElements.length -1])
  5672. break;
  5673. }
  5674. };
  5675. TreeBuilder.prototype.ensureNoahsArkCondition = function(item) {
  5676. var kNoahsArkCapacity = 3;
  5677. if (this.activeFormattingElements.length < kNoahsArkCapacity)
  5678. return;
  5679. var candidates = [];
  5680. var newItemAttributeCount = item.attributes.length;
  5681. for (var i = this.activeFormattingElements.length - 1; i >= 0; i--) {
  5682. var candidate = this.activeFormattingElements[i];
  5683. if (candidate === Marker)
  5684. break;
  5685. if (item.localName !== candidate.localName || item.namespaceURI !== candidate.namespaceURI)
  5686. continue;
  5687. if (candidate.attributes.length != newItemAttributeCount)
  5688. continue;
  5689. candidates.push(candidate);
  5690. }
  5691. if (candidates.length < kNoahsArkCapacity)
  5692. return;
  5693. var remainingCandidates = [];
  5694. var attributes = item.attributes;
  5695. for (var i = 0; i < attributes.length; i++) {
  5696. var attribute = attributes[i];
  5697. for (var j = 0; j < candidates.length; j++) {
  5698. var candidate = candidates[j];
  5699. var candidateAttribute = getAttribute(candidate, attribute.nodeName);
  5700. if (candidateAttribute && candidateAttribute.nodeValue === attribute.nodeValue)
  5701. remainingCandidates.push(candidate);
  5702. }
  5703. if (remainingCandidates.length < kNoahsArkCapacity)
  5704. return;
  5705. candidates = remainingCandidates;
  5706. remainingCandidates = [];
  5707. }
  5708. for (var i = kNoahsArkCapacity - 1; i < candidates.length; i++)
  5709. this.removeElementFromActiveFormattingElements(candidates[i]);
  5710. };
  5711. TreeBuilder.prototype.appendElementToActiveFormattingElements = function(item) {
  5712. this.ensureNoahsArkCondition(item);
  5713. this.activeFormattingElements.push(item);
  5714. };
  5715. TreeBuilder.prototype.removeElementFromActiveFormattingElements = function(item) {
  5716. var index = this.activeFormattingElements.indexOf(item);
  5717. if (index >= 0)
  5718. this.activeFormattingElements.splice(index, 1);
  5719. };
  5720. TreeBuilder.prototype.elementInActiveFormattingElements = function(name) {
  5721. var els = this.activeFormattingElements;
  5722. for (var i = els.length - 1; i >= 0; i--) {
  5723. if (els[i] == Marker) break;
  5724. if (els[i].localName == name) return els[i];
  5725. }
  5726. return false;
  5727. };
  5728. TreeBuilder.prototype.clearActiveFormattingElements = function() {
  5729. while (!(this.activeFormattingElements.length === 0 || this.activeFormattingElements.pop() == Marker));
  5730. };
  5731. TreeBuilder.prototype.reparentChildren = function(oldParent, newParent) {
  5732. throw new Error("Not implemented");
  5733. };
  5734. TreeBuilder.prototype.setFragmentContext = function(context) {
  5735. this.context = context;
  5736. };
  5737. TreeBuilder.prototype.parseError = function(code, args) {
  5738. if (!this.errorHandler)
  5739. return;
  5740. var message = formatMessage(messages[code], args);
  5741. this.errorHandler.error(message, this.tokenizer._inputStream.location(), code);
  5742. };
  5743. TreeBuilder.prototype.resetInsertionMode = function() {
  5744. var last = false;
  5745. var node = null;
  5746. for (var i = this.openElements.length - 1; i >= 0; i--) {
  5747. node = this.openElements.item(i);
  5748. if (i === 0) {
  5749. assert.ok(this.context);
  5750. last = true;
  5751. node = new StackItem("http://www.w3.org/1999/xhtml", this.context, [], null);
  5752. }
  5753. if (node.namespaceURI === "http://www.w3.org/1999/xhtml") {
  5754. if (node.localName === 'select')
  5755. return this.setInsertionMode('inSelect');
  5756. if (node.localName === 'td' || node.localName === 'th')
  5757. return this.setInsertionMode('inCell');
  5758. if (node.localName === 'tr')
  5759. return this.setInsertionMode('inRow');
  5760. if (node.localName === 'tbody' || node.localName === 'thead' || node.localName === 'tfoot')
  5761. return this.setInsertionMode('inTableBody');
  5762. if (node.localName === 'caption')
  5763. return this.setInsertionMode('inCaption');
  5764. if (node.localName === 'colgroup')
  5765. return this.setInsertionMode('inColumnGroup');
  5766. if (node.localName === 'table')
  5767. return this.setInsertionMode('inTable');
  5768. if (node.localName === 'head' && !last)
  5769. return this.setInsertionMode('inHead');
  5770. if (node.localName === 'body')
  5771. return this.setInsertionMode('inBody');
  5772. if (node.localName === 'frameset')
  5773. return this.setInsertionMode('inFrameset');
  5774. if (node.localName === 'html')
  5775. if (!this.openElements.headElement)
  5776. return this.setInsertionMode('beforeHead');
  5777. else
  5778. return this.setInsertionMode('afterHead');
  5779. }
  5780. if (last)
  5781. return this.setInsertionMode('inBody');
  5782. }
  5783. };
  5784. TreeBuilder.prototype.processGenericRCDATAStartTag = function(name, attributes) {
  5785. this.insertElement(name, attributes);
  5786. this.tokenizer.setState(Tokenizer.RCDATA);
  5787. this.originalInsertionMode = this.insertionModeName;
  5788. this.setInsertionMode('text');
  5789. };
  5790. TreeBuilder.prototype.processGenericRawTextStartTag = function(name, attributes) {
  5791. this.insertElement(name, attributes);
  5792. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5793. this.originalInsertionMode = this.insertionModeName;
  5794. this.setInsertionMode('text');
  5795. };
  5796. TreeBuilder.prototype.adjustMathMLAttributes = function(attributes) {
  5797. attributes.forEach(function(a) {
  5798. a.namespaceURI = "http://www.w3.org/1998/Math/MathML";
  5799. if (constants.MATHMLAttributeMap[a.nodeName])
  5800. a.nodeName = constants.MATHMLAttributeMap[a.nodeName];
  5801. });
  5802. return attributes;
  5803. };
  5804. TreeBuilder.prototype.adjustSVGTagNameCase = function(name) {
  5805. return constants.SVGTagMap[name] || name;
  5806. };
  5807. TreeBuilder.prototype.adjustSVGAttributes = function(attributes) {
  5808. attributes.forEach(function(a) {
  5809. a.namespaceURI = "http://www.w3.org/2000/svg";
  5810. if (constants.SVGAttributeMap[a.nodeName])
  5811. a.nodeName = constants.SVGAttributeMap[a.nodeName];
  5812. });
  5813. return attributes;
  5814. };
  5815. TreeBuilder.prototype.adjustForeignAttributes = function(attributes) {
  5816. for (var i = 0; i < attributes.length; i++) {
  5817. var attribute = attributes[i];
  5818. var adjusted = constants.ForeignAttributeMap[attribute.nodeName];
  5819. if (adjusted) {
  5820. attribute.nodeName = adjusted.localName;
  5821. attribute.prefix = adjusted.prefix;
  5822. attribute.namespaceURI = adjusted.namespaceURI;
  5823. }
  5824. }
  5825. return attributes;
  5826. };
  5827. function formatMessage(format, args) {
  5828. return format.replace(new RegExp('{[0-9a-z-]+}', 'gi'), function(match) {
  5829. return args[match.slice(1, -1)] || match;
  5830. });
  5831. }
  5832. exports.TreeBuilder = TreeBuilder;
  5833. },
  5834. {"./ElementStack":1,"./StackItem":4,"./Tokenizer":5,"./constants":7,"./messages.json":8,"assert":13,"events":16}],
  5835. 7:[function(_dereq_,module,exports){
  5836. exports.SVGTagMap = {
  5837. "altglyph": "altGlyph",
  5838. "altglyphdef": "altGlyphDef",
  5839. "altglyphitem": "altGlyphItem",
  5840. "animatecolor": "animateColor",
  5841. "animatemotion": "animateMotion",
  5842. "animatetransform": "animateTransform",
  5843. "clippath": "clipPath",
  5844. "feblend": "feBlend",
  5845. "fecolormatrix": "feColorMatrix",
  5846. "fecomponenttransfer": "feComponentTransfer",
  5847. "fecomposite": "feComposite",
  5848. "feconvolvematrix": "feConvolveMatrix",
  5849. "fediffuselighting": "feDiffuseLighting",
  5850. "fedisplacementmap": "feDisplacementMap",
  5851. "fedistantlight": "feDistantLight",
  5852. "feflood": "feFlood",
  5853. "fefunca": "feFuncA",
  5854. "fefuncb": "feFuncB",
  5855. "fefuncg": "feFuncG",
  5856. "fefuncr": "feFuncR",
  5857. "fegaussianblur": "feGaussianBlur",
  5858. "feimage": "feImage",
  5859. "femerge": "feMerge",
  5860. "femergenode": "feMergeNode",
  5861. "femorphology": "feMorphology",
  5862. "feoffset": "feOffset",
  5863. "fepointlight": "fePointLight",
  5864. "fespecularlighting": "feSpecularLighting",
  5865. "fespotlight": "feSpotLight",
  5866. "fetile": "feTile",
  5867. "feturbulence": "feTurbulence",
  5868. "foreignobject": "foreignObject",
  5869. "glyphref": "glyphRef",
  5870. "lineargradient": "linearGradient",
  5871. "radialgradient": "radialGradient",
  5872. "textpath": "textPath"
  5873. };
  5874. exports.MATHMLAttributeMap = {
  5875. definitionurl: 'definitionURL'
  5876. };
  5877. exports.SVGAttributeMap = {
  5878. attributename: 'attributeName',
  5879. attributetype: 'attributeType',
  5880. basefrequency: 'baseFrequency',
  5881. baseprofile: 'baseProfile',
  5882. calcmode: 'calcMode',
  5883. clippathunits: 'clipPathUnits',
  5884. contentscripttype: 'contentScriptType',
  5885. contentstyletype: 'contentStyleType',
  5886. diffuseconstant: 'diffuseConstant',
  5887. edgemode: 'edgeMode',
  5888. externalresourcesrequired: 'externalResourcesRequired',
  5889. filterres: 'filterRes',
  5890. filterunits: 'filterUnits',
  5891. glyphref: 'glyphRef',
  5892. gradienttransform: 'gradientTransform',
  5893. gradientunits: 'gradientUnits',
  5894. kernelmatrix: 'kernelMatrix',
  5895. kernelunitlength: 'kernelUnitLength',
  5896. keypoints: 'keyPoints',
  5897. keysplines: 'keySplines',
  5898. keytimes: 'keyTimes',
  5899. lengthadjust: 'lengthAdjust',
  5900. limitingconeangle: 'limitingConeAngle',
  5901. markerheight: 'markerHeight',
  5902. markerunits: 'markerUnits',
  5903. markerwidth: 'markerWidth',
  5904. maskcontentunits: 'maskContentUnits',
  5905. maskunits: 'maskUnits',
  5906. numoctaves: 'numOctaves',
  5907. pathlength: 'pathLength',
  5908. patterncontentunits: 'patternContentUnits',
  5909. patterntransform: 'patternTransform',
  5910. patternunits: 'patternUnits',
  5911. pointsatx: 'pointsAtX',
  5912. pointsaty: 'pointsAtY',
  5913. pointsatz: 'pointsAtZ',
  5914. preservealpha: 'preserveAlpha',
  5915. preserveaspectratio: 'preserveAspectRatio',
  5916. primitiveunits: 'primitiveUnits',
  5917. refx: 'refX',
  5918. refy: 'refY',
  5919. repeatcount: 'repeatCount',
  5920. repeatdur: 'repeatDur',
  5921. requiredextensions: 'requiredExtensions',
  5922. requiredfeatures: 'requiredFeatures',
  5923. specularconstant: 'specularConstant',
  5924. specularexponent: 'specularExponent',
  5925. spreadmethod: 'spreadMethod',
  5926. startoffset: 'startOffset',
  5927. stddeviation: 'stdDeviation',
  5928. stitchtiles: 'stitchTiles',
  5929. surfacescale: 'surfaceScale',
  5930. systemlanguage: 'systemLanguage',
  5931. tablevalues: 'tableValues',
  5932. targetx: 'targetX',
  5933. targety: 'targetY',
  5934. textlength: 'textLength',
  5935. viewbox: 'viewBox',
  5936. viewtarget: 'viewTarget',
  5937. xchannelselector: 'xChannelSelector',
  5938. ychannelselector: 'yChannelSelector',
  5939. zoomandpan: 'zoomAndPan'
  5940. };
  5941. exports.ForeignAttributeMap = {
  5942. "xlink:actuate": {prefix: "xlink", localName: "actuate", namespaceURI: "http://www.w3.org/1999/xlink"},
  5943. "xlink:arcrole": {prefix: "xlink", localName: "arcrole", namespaceURI: "http://www.w3.org/1999/xlink"},
  5944. "xlink:href": {prefix: "xlink", localName: "href", namespaceURI: "http://www.w3.org/1999/xlink"},
  5945. "xlink:role": {prefix: "xlink", localName: "role", namespaceURI: "http://www.w3.org/1999/xlink"},
  5946. "xlink:show": {prefix: "xlink", localName: "show", namespaceURI: "http://www.w3.org/1999/xlink"},
  5947. "xlink:title": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"},
  5948. "xlink:type": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"},
  5949. "xml:base": {prefix: "xml", localName: "base", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5950. "xml:lang": {prefix: "xml", localName: "lang", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5951. "xml:space": {prefix: "xml", localName: "space", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5952. "xmlns": {prefix: null, localName: "xmlns", namespaceURI: "http://www.w3.org/2000/xmlns/"},
  5953. "xmlns:xlink": {prefix: "xmlns", localName: "xlink", namespaceURI: "http://www.w3.org/2000/xmlns/"},
  5954. };
  5955. },
  5956. {}],
  5957. 8:[function(_dereq_,module,exports){
  5958. module.exports={
  5959. "null-character":
  5960. "Null character in input stream, replaced with U+FFFD.",
  5961. "invalid-codepoint":
  5962. "Invalid codepoint in stream",
  5963. "incorrectly-placed-solidus":
  5964. "Solidus (/) incorrectly placed in tag.",
  5965. "incorrect-cr-newline-entity":
  5966. "Incorrect CR newline entity, replaced with LF.",
  5967. "illegal-windows-1252-entity":
  5968. "Entity used with illegal number (windows-1252 reference).",
  5969. "cant-convert-numeric-entity":
  5970. "Numeric entity couldn't be converted to character (codepoint U+{charAsInt}).",
  5971. "invalid-numeric-entity-replaced":
  5972. "Numeric entity represents an illegal codepoint. Expanded to the C1 controls range.",
  5973. "numeric-entity-without-semicolon":
  5974. "Numeric entity didn't end with ';'.",
  5975. "expected-numeric-entity-but-got-eof":
  5976. "Numeric entity expected. Got end of file instead.",
  5977. "expected-numeric-entity":
  5978. "Numeric entity expected but none found.",
  5979. "named-entity-without-semicolon":
  5980. "Named entity didn't end with ';'.",
  5981. "expected-named-entity":
  5982. "Named entity expected. Got none.",
  5983. "attributes-in-end-tag":
  5984. "End tag contains unexpected attributes.",
  5985. "self-closing-flag-on-end-tag":
  5986. "End tag contains unexpected self-closing flag.",
  5987. "bare-less-than-sign-at-eof":
  5988. "End of file after <.",
  5989. "expected-tag-name-but-got-right-bracket":
  5990. "Expected tag name. Got '>' instead.",
  5991. "expected-tag-name-but-got-question-mark":
  5992. "Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)",
  5993. "expected-tag-name":
  5994. "Expected tag name. Got something else instead.",
  5995. "expected-closing-tag-but-got-right-bracket":
  5996. "Expected closing tag. Got '>' instead. Ignoring '</>'.",
  5997. "expected-closing-tag-but-got-eof":
  5998. "Expected closing tag. Unexpected end of file.",
  5999. "expected-closing-tag-but-got-char":
  6000. "Expected closing tag. Unexpected character '{data}' found.",
  6001. "eof-in-tag-name":
  6002. "Unexpected end of file in the tag name.",
  6003. "expected-attribute-name-but-got-eof":
  6004. "Unexpected end of file. Expected attribute name instead.",
  6005. "eof-in-attribute-name":
  6006. "Unexpected end of file in attribute name.",
  6007. "invalid-character-in-attribute-name":
  6008. "Invalid character in attribute name.",
  6009. "duplicate-attribute":
  6010. "Dropped duplicate attribute '{name}' on tag.",
  6011. "expected-end-of-tag-but-got-eof":
  6012. "Unexpected end of file. Expected = or end of tag.",
  6013. "expected-attribute-value-but-got-eof":
  6014. "Unexpected end of file. Expected attribute value.",
  6015. "expected-attribute-value-but-got-right-bracket":
  6016. "Expected attribute value. Got '>' instead.",
  6017. "unexpected-character-in-unquoted-attribute-value":
  6018. "Unexpected character in unquoted attribute",
  6019. "invalid-character-after-attribute-name":
  6020. "Unexpected character after attribute name.",
  6021. "unexpected-character-after-attribute-value":
  6022. "Unexpected character after attribute value.",
  6023. "eof-in-attribute-value-double-quote":
  6024. "Unexpected end of file in attribute value (\").",
  6025. "eof-in-attribute-value-single-quote":
  6026. "Unexpected end of file in attribute value (').",
  6027. "eof-in-attribute-value-no-quotes":
  6028. "Unexpected end of file in attribute value.",
  6029. "eof-after-attribute-value":
  6030. "Unexpected end of file after attribute value.",
  6031. "unexpected-eof-after-solidus-in-tag":
  6032. "Unexpected end of file in tag. Expected >.",
  6033. "unexpected-character-after-solidus-in-tag":
  6034. "Unexpected character after / in tag. Expected >.",
  6035. "expected-dashes-or-doctype":
  6036. "Expected '--' or 'DOCTYPE'. Not found.",
  6037. "unexpected-bang-after-double-dash-in-comment":
  6038. "Unexpected ! after -- in comment.",
  6039. "incorrect-comment":
  6040. "Incorrect comment.",
  6041. "eof-in-comment":
  6042. "Unexpected end of file in comment.",
  6043. "eof-in-comment-end-dash":
  6044. "Unexpected end of file in comment (-).",
  6045. "unexpected-dash-after-double-dash-in-comment":
  6046. "Unexpected '-' after '--' found in comment.",
  6047. "eof-in-comment-double-dash":
  6048. "Unexpected end of file in comment (--).",
  6049. "eof-in-comment-end-bang-state":
  6050. "Unexpected end of file in comment.",
  6051. "unexpected-char-in-comment":
  6052. "Unexpected character in comment found.",
  6053. "need-space-after-doctype":
  6054. "No space after literal string 'DOCTYPE'.",
  6055. "expected-doctype-name-but-got-right-bracket":
  6056. "Unexpected > character. Expected DOCTYPE name.",
  6057. "expected-doctype-name-but-got-eof":
  6058. "Unexpected end of file. Expected DOCTYPE name.",
  6059. "eof-in-doctype-name":
  6060. "Unexpected end of file in DOCTYPE name.",
  6061. "eof-in-doctype":
  6062. "Unexpected end of file in DOCTYPE.",
  6063. "expected-space-or-right-bracket-in-doctype":
  6064. "Expected space or '>'. Got '{data}'.",
  6065. "unexpected-end-of-doctype":
  6066. "Unexpected end of DOCTYPE.",
  6067. "unexpected-char-in-doctype":
  6068. "Unexpected character in DOCTYPE.",
  6069. "eof-in-bogus-doctype":
  6070. "Unexpected end of file in bogus doctype.",
  6071. "eof-in-innerhtml":
  6072. "Unexpected EOF in inner html mode.",
  6073. "unexpected-doctype":
  6074. "Unexpected DOCTYPE. Ignored.",
  6075. "non-html-root":
  6076. "html needs to be the first start tag.",
  6077. "expected-doctype-but-got-eof":
  6078. "Unexpected End of file. Expected DOCTYPE.",
  6079. "unknown-doctype":
  6080. "Erroneous DOCTYPE. Expected <!DOCTYPE html>.",
  6081. "quirky-doctype":
  6082. "Quirky doctype. Expected <!DOCTYPE html>.",
  6083. "almost-standards-doctype":
  6084. "Almost standards mode doctype. Expected <!DOCTYPE html>.",
  6085. "obsolete-doctype":
  6086. "Obsolete doctype. Expected <!DOCTYPE html>.",
  6087. "expected-doctype-but-got-chars":
  6088. "Non-space characters found without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6089. "expected-doctype-but-got-start-tag":
  6090. "Start tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6091. "expected-doctype-but-got-end-tag":
  6092. "End tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6093. "end-tag-after-implied-root":
  6094. "Unexpected end tag ({name}) after the (implied) root element.",
  6095. "expected-named-closing-tag-but-got-eof":
  6096. "Unexpected end of file. Expected end tag ({name}).",
  6097. "two-heads-are-not-better-than-one":
  6098. "Unexpected start tag head in existing head. Ignored.",
  6099. "unexpected-end-tag":
  6100. "Unexpected end tag ({name}). Ignored.",
  6101. "unexpected-implied-end-tag":
  6102. "End tag {name} implied, but there were open elements.",
  6103. "unexpected-start-tag-out-of-my-head":
  6104. "Unexpected start tag ({name}) that can be in head. Moved.",
  6105. "unexpected-start-tag":
  6106. "Unexpected start tag ({name}).",
  6107. "missing-end-tag":
  6108. "Missing end tag ({name}).",
  6109. "missing-end-tags":
  6110. "Missing end tags ({name}).",
  6111. "unexpected-start-tag-implies-end-tag":
  6112. "Unexpected start tag ({startName}) implies end tag ({endName}).",
  6113. "unexpected-start-tag-treated-as":
  6114. "Unexpected start tag ({originalName}). Treated as {newName}.",
  6115. "deprecated-tag":
  6116. "Unexpected start tag {name}. Don't use it!",
  6117. "unexpected-start-tag-ignored":
  6118. "Unexpected start tag {name}. Ignored.",
  6119. "expected-one-end-tag-but-got-another":
  6120. "Unexpected end tag ({gotName}). Missing end tag ({expectedName}).",
  6121. "end-tag-too-early":
  6122. "End tag ({name}) seen too early. Expected other end tag.",
  6123. "end-tag-too-early-named":
  6124. "Unexpected end tag ({gotName}). Expected end tag ({expectedName}.",
  6125. "end-tag-too-early-ignored":
  6126. "End tag ({name}) seen too early. Ignored.",
  6127. "adoption-agency-1.1":
  6128. "End tag ({name}) violates step 1, paragraph 1 of the adoption agency algorithm.",
  6129. "adoption-agency-1.2":
  6130. "End tag ({name}) violates step 1, paragraph 2 of the adoption agency algorithm.",
  6131. "adoption-agency-1.3":
  6132. "End tag ({name}) violates step 1, paragraph 3 of the adoption agency algorithm.",
  6133. "adoption-agency-4.4":
  6134. "End tag ({name}) violates step 4, paragraph 4 of the adoption agency algorithm.",
  6135. "unexpected-end-tag-treated-as":
  6136. "Unexpected end tag ({originalName}). Treated as {newName}.",
  6137. "no-end-tag":
  6138. "This element ({name}) has no end tag.",
  6139. "unexpected-implied-end-tag-in-table":
  6140. "Unexpected implied end tag ({name}) in the table phase.",
  6141. "unexpected-implied-end-tag-in-table-body":
  6142. "Unexpected implied end tag ({name}) in the table body phase.",
  6143. "unexpected-char-implies-table-voodoo":
  6144. "Unexpected non-space characters in table context caused voodoo mode.",
  6145. "unexpected-hidden-input-in-table":
  6146. "Unexpected input with type hidden in table context.",
  6147. "unexpected-form-in-table":
  6148. "Unexpected form in table context.",
  6149. "unexpected-start-tag-implies-table-voodoo":
  6150. "Unexpected start tag ({name}) in table context caused voodoo mode.",
  6151. "unexpected-end-tag-implies-table-voodoo":
  6152. "Unexpected end tag ({name}) in table context caused voodoo mode.",
  6153. "unexpected-cell-in-table-body":
  6154. "Unexpected table cell start tag ({name}) in the table body phase.",
  6155. "unexpected-cell-end-tag":
  6156. "Got table cell end tag ({name}) while required end tags are missing.",
  6157. "unexpected-end-tag-in-table-body":
  6158. "Unexpected end tag ({name}) in the table body phase. Ignored.",
  6159. "unexpected-implied-end-tag-in-table-row":
  6160. "Unexpected implied end tag ({name}) in the table row phase.",
  6161. "unexpected-end-tag-in-table-row":
  6162. "Unexpected end tag ({name}) in the table row phase. Ignored.",
  6163. "unexpected-select-in-select":
  6164. "Unexpected select start tag in the select phase treated as select end tag.",
  6165. "unexpected-input-in-select":
  6166. "Unexpected input start tag in the select phase.",
  6167. "unexpected-start-tag-in-select":
  6168. "Unexpected start tag token ({name}) in the select phase. Ignored.",
  6169. "unexpected-end-tag-in-select":
  6170. "Unexpected end tag ({name}) in the select phase. Ignored.",
  6171. "unexpected-table-element-start-tag-in-select-in-table":
  6172. "Unexpected table element start tag ({name}) in the select in table phase.",
  6173. "unexpected-table-element-end-tag-in-select-in-table":
  6174. "Unexpected table element end tag ({name}) in the select in table phase.",
  6175. "unexpected-char-after-body":
  6176. "Unexpected non-space characters in the after body phase.",
  6177. "unexpected-start-tag-after-body":
  6178. "Unexpected start tag token ({name}) in the after body phase.",
  6179. "unexpected-end-tag-after-body":
  6180. "Unexpected end tag token ({name}) in the after body phase.",
  6181. "unexpected-char-in-frameset":
  6182. "Unepxected characters in the frameset phase. Characters ignored.",
  6183. "unexpected-start-tag-in-frameset":
  6184. "Unexpected start tag token ({name}) in the frameset phase. Ignored.",
  6185. "unexpected-frameset-in-frameset-innerhtml":
  6186. "Unexpected end tag token (frameset in the frameset phase (innerHTML).",
  6187. "unexpected-end-tag-in-frameset":
  6188. "Unexpected end tag token ({name}) in the frameset phase. Ignored.",
  6189. "unexpected-char-after-frameset":
  6190. "Unexpected non-space characters in the after frameset phase. Ignored.",
  6191. "unexpected-start-tag-after-frameset":
  6192. "Unexpected start tag ({name}) in the after frameset phase. Ignored.",
  6193. "unexpected-end-tag-after-frameset":
  6194. "Unexpected end tag ({name}) in the after frameset phase. Ignored.",
  6195. "expected-eof-but-got-char":
  6196. "Unexpected non-space characters. Expected end of file.",
  6197. "expected-eof-but-got-start-tag":
  6198. "Unexpected start tag ({name}). Expected end of file.",
  6199. "expected-eof-but-got-end-tag":
  6200. "Unexpected end tag ({name}). Expected end of file.",
  6201. "unexpected-end-table-in-caption":
  6202. "Unexpected end table tag in caption. Generates implied end caption.",
  6203. "end-html-in-innerhtml":
  6204. "Unexpected html end tag in inner html mode.",
  6205. "eof-in-table":
  6206. "Unexpected end of file. Expected table content.",
  6207. "eof-in-script":
  6208. "Unexpected end of file. Expected script content.",
  6209. "non-void-element-with-trailing-solidus":
  6210. "Trailing solidus not allowed on element {name}.",
  6211. "unexpected-html-element-in-foreign-content":
  6212. "HTML start tag \"{name}\" in a foreign namespace context.",
  6213. "unexpected-start-tag-in-table":
  6214. "Unexpected {name}. Expected table content."
  6215. }
  6216. },
  6217. {}],
  6218. 9:[function(_dereq_,module,exports){
  6219. var SAXTreeBuilder = _dereq_('./SAXTreeBuilder').SAXTreeBuilder;
  6220. var Tokenizer = _dereq_('../Tokenizer').Tokenizer;
  6221. var TreeParser = _dereq_('./TreeParser').TreeParser;
  6222. function SAXParser() {
  6223. this.contentHandler = null;
  6224. this._errorHandler = null;
  6225. this._treeBuilder = new SAXTreeBuilder();
  6226. this._tokenizer = new Tokenizer(this._treeBuilder);
  6227. this._scriptingEnabled = false;
  6228. }
  6229. SAXParser.prototype.parse = function(source) {
  6230. this._tokenizer.tokenize(source);
  6231. var document = this._treeBuilder.document;
  6232. if (document) {
  6233. new TreeParser(this.contentHandler).parse(document);
  6234. }
  6235. };
  6236. SAXParser.prototype.parseFragment = function(source, context) {
  6237. this._treeBuilder.setFragmentContext(context);
  6238. this._tokenizer.tokenize(source);
  6239. var fragment = this._treeBuilder.getFragment();
  6240. if (fragment) {
  6241. new TreeParser(this.contentHandler).parse(fragment);
  6242. }
  6243. };
  6244. Object.defineProperty(SAXParser.prototype, 'scriptingEnabled', {
  6245. get: function() {
  6246. return this._scriptingEnabled;
  6247. },
  6248. set: function(value) {
  6249. this._scriptingEnabled = value;
  6250. this._treeBuilder.scriptingEnabled = value;
  6251. }
  6252. });
  6253. Object.defineProperty(SAXParser.prototype, 'errorHandler', {
  6254. get: function() {
  6255. return this._errorHandler;
  6256. },
  6257. set: function(value) {
  6258. this._errorHandler = value;
  6259. this._treeBuilder.errorHandler = value;
  6260. }
  6261. });
  6262. exports.SAXParser = SAXParser;
  6263. },
  6264. {"../Tokenizer":5,"./SAXTreeBuilder":10,"./TreeParser":11}],
  6265. 10:[function(_dereq_,module,exports){
  6266. var util = _dereq_('util');
  6267. var TreeBuilder = _dereq_('../TreeBuilder').TreeBuilder;
  6268. function SAXTreeBuilder() {
  6269. TreeBuilder.call(this);
  6270. }
  6271. util.inherits(SAXTreeBuilder, TreeBuilder);
  6272. SAXTreeBuilder.prototype.start = function(tokenizer) {
  6273. this.document = new Document(this.tokenizer);
  6274. };
  6275. SAXTreeBuilder.prototype.end = function() {
  6276. this.document.endLocator = this.tokenizer;
  6277. };
  6278. SAXTreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) {
  6279. var doctype = new DTD(this.tokenizer, name, publicId, systemId);
  6280. doctype.endLocator = this.tokenizer;
  6281. this.document.appendChild(doctype);
  6282. };
  6283. SAXTreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) {
  6284. var element = new Element(this.tokenizer, namespaceURI, localName, localName, attributes || []);
  6285. return element;
  6286. };
  6287. SAXTreeBuilder.prototype.insertComment = function(data, parent) {
  6288. if (!parent)
  6289. parent = this.currentStackItem();
  6290. var comment = new Comment(this.tokenizer, data);
  6291. parent.appendChild(comment);
  6292. };
  6293. SAXTreeBuilder.prototype.appendCharacters = function(parent, data) {
  6294. var text = new Characters(this.tokenizer, data);
  6295. parent.appendChild(text);
  6296. };
  6297. SAXTreeBuilder.prototype.insertText = function(data) {
  6298. if (this.redirectAttachToFosterParent && this.openElements.top.isFosterParenting()) {
  6299. var tableIndex = this.openElements.findIndex('table');
  6300. var tableItem = this.openElements.item(tableIndex);
  6301. var table = tableItem.node;
  6302. if (tableIndex === 0) {
  6303. return this.appendCharacters(table, data);
  6304. }
  6305. var text = new Characters(this.tokenizer, data);
  6306. var parent = table.parentNode;
  6307. if (parent) {
  6308. parent.insertBetween(text, table.previousSibling, table);
  6309. return;
  6310. }
  6311. var stackParent = this.openElements.item(tableIndex - 1).node;
  6312. stackParent.appendChild(text);
  6313. return;
  6314. }
  6315. this.appendCharacters(this.currentStackItem().node, data);
  6316. };
  6317. SAXTreeBuilder.prototype.attachNode = function(node, parent) {
  6318. parent.appendChild(node);
  6319. };
  6320. SAXTreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) {
  6321. var parent = table.parentNode;
  6322. if (parent)
  6323. parent.insertBetween(child, table.previousSibling, table);
  6324. else
  6325. stackParent.appendChild(child);
  6326. };
  6327. SAXTreeBuilder.prototype.detachFromParent = function(element) {
  6328. element.detach();
  6329. };
  6330. SAXTreeBuilder.prototype.reparentChildren = function(oldParent, newParent) {
  6331. newParent.appendChildren(oldParent.firstChild);
  6332. };
  6333. SAXTreeBuilder.prototype.getFragment = function() {
  6334. var fragment = new DocumentFragment();
  6335. this.reparentChildren(this.openElements.rootNode, fragment);
  6336. return fragment;
  6337. };
  6338. function getAttribute(node, name) {
  6339. for (var i = 0; i < node.attributes.length; i++) {
  6340. var attribute = node.attributes[i];
  6341. if (attribute.nodeName === name)
  6342. return attribute.nodeValue;
  6343. }
  6344. }
  6345. SAXTreeBuilder.prototype.addAttributesToElement = function(element, attributes) {
  6346. for (var i = 0; i < attributes.length; i++) {
  6347. var attribute = attributes[i];
  6348. if (!getAttribute(element, attribute.nodeName))
  6349. element.attributes.push(attribute);
  6350. }
  6351. };
  6352. var NodeType = {
  6353. CDATA: 1,
  6354. CHARACTERS: 2,
  6355. COMMENT: 3,
  6356. DOCUMENT: 4,
  6357. DOCUMENT_FRAGMENT: 5,
  6358. DTD: 6,
  6359. ELEMENT: 7,
  6360. ENTITY: 8,
  6361. IGNORABLE_WHITESPACE: 9,
  6362. PROCESSING_INSTRUCTION: 10,
  6363. SKIPPED_ENTITY: 11
  6364. };
  6365. function Node(locator) {
  6366. if (!locator) {
  6367. this.columnNumber = -1;
  6368. this.lineNumber = -1;
  6369. } else {
  6370. this.columnNumber = locator.columnNumber;
  6371. this.lineNumber = locator.lineNumber;
  6372. }
  6373. this.parentNode = null;
  6374. this.nextSibling = null;
  6375. this.firstChild = null;
  6376. }
  6377. Node.prototype.visit = function(treeParser) {
  6378. throw new Error("Not Implemented");
  6379. };
  6380. Node.prototype.revisit = function(treeParser) {
  6381. return;
  6382. };
  6383. Node.prototype.detach = function() {
  6384. if (this.parentNode !== null) {
  6385. this.parentNode.removeChild(this);
  6386. this.parentNode = null;
  6387. }
  6388. };
  6389. Object.defineProperty(Node.prototype, 'previousSibling', {
  6390. get: function() {
  6391. var prev = null;
  6392. var next = this.parentNode.firstChild;
  6393. for(;;) {
  6394. if (this == next) {
  6395. return prev;
  6396. }
  6397. prev = next;
  6398. next = next.nextSibling;
  6399. }
  6400. }
  6401. });
  6402. function ParentNode(locator) {
  6403. Node.call(this, locator);
  6404. this.lastChild = null;
  6405. this._endLocator = null;
  6406. }
  6407. ParentNode.prototype = Object.create(Node.prototype);
  6408. ParentNode.prototype.insertBefore = function(child, sibling) {
  6409. if (!sibling) {
  6410. return this.appendChild(child);
  6411. }
  6412. child.detach();
  6413. child.parentNode = this;
  6414. if (this.firstChild == sibling) {
  6415. child.nextSibling = sibling;
  6416. this.firstChild = child;
  6417. } else {
  6418. var prev = this.firstChild;
  6419. var next = this.firstChild.nextSibling;
  6420. while (next != sibling) {
  6421. prev = next;
  6422. next = next.nextSibling;
  6423. }
  6424. prev.nextSibling = child;
  6425. child.nextSibling = next;
  6426. }
  6427. return child;
  6428. };
  6429. ParentNode.prototype.insertBetween = function(child, prev, next) {
  6430. if (!next) {
  6431. return this.appendChild(child);
  6432. }
  6433. child.detach();
  6434. child.parentNode = this;
  6435. child.nextSibling = next;
  6436. if (!prev) {
  6437. firstChild = child;
  6438. } else {
  6439. prev.nextSibling = child;
  6440. }
  6441. return child;
  6442. };
  6443. ParentNode.prototype.appendChild = function(child) {
  6444. child.detach();
  6445. child.parentNode = this;
  6446. if (!this.firstChild) {
  6447. this.firstChild = child;
  6448. } else {
  6449. this.lastChild.nextSibling = child;
  6450. }
  6451. this.lastChild = child;
  6452. return child;
  6453. };
  6454. ParentNode.prototype.appendChildren = function(parent) {
  6455. var child = parent.firstChild;
  6456. if (!child) {
  6457. return;
  6458. }
  6459. var another = parent;
  6460. if (!this.firstChild) {
  6461. this.firstChild = child;
  6462. } else {
  6463. this.lastChild.nextSibling = child;
  6464. }
  6465. this.lastChild = another.lastChild;
  6466. do {
  6467. child.parentNode = this;
  6468. } while ((child = child.nextSibling));
  6469. another.firstChild = null;
  6470. another.lastChild = null;
  6471. };
  6472. ParentNode.prototype.removeChild = function(node) {
  6473. if (this.firstChild == node) {
  6474. this.firstChild = node.nextSibling;
  6475. if (this.lastChild == node) {
  6476. this.lastChild = null;
  6477. }
  6478. } else {
  6479. var prev = this.firstChild;
  6480. var next = this.firstChild.nextSibling;
  6481. while (next != node) {
  6482. prev = next;
  6483. next = next.nextSibling;
  6484. }
  6485. prev.nextSibling = node.nextSibling;
  6486. if (this.lastChild == node) {
  6487. this.lastChild = prev;
  6488. }
  6489. }
  6490. node.parentNode = null;
  6491. return node;
  6492. };
  6493. Object.defineProperty(ParentNode.prototype, 'endLocator', {
  6494. get: function() {
  6495. return this._endLocator;
  6496. },
  6497. set: function(endLocator) {
  6498. this._endLocator = {
  6499. lineNumber: endLocator.lineNumber,
  6500. columnNumber: endLocator.columnNumber
  6501. };
  6502. }
  6503. });
  6504. function Document (locator) {
  6505. ParentNode.call(this, locator);
  6506. this.nodeType = NodeType.DOCUMENT;
  6507. }
  6508. Document.prototype = Object.create(ParentNode.prototype);
  6509. Document.prototype.visit = function(treeParser) {
  6510. treeParser.startDocument(this);
  6511. };
  6512. Document.prototype.revisit = function(treeParser) {
  6513. treeParser.endDocument(this.endLocator);
  6514. };
  6515. function DocumentFragment() {
  6516. ParentNode.call(this, new Locator());
  6517. this.nodeType = NodeType.DOCUMENT_FRAGMENT;
  6518. }
  6519. DocumentFragment.prototype = Object.create(ParentNode.prototype);
  6520. DocumentFragment.prototype.visit = function(treeParser) {
  6521. };
  6522. function Element(locator, uri, localName, qName, atts, prefixMappings) {
  6523. ParentNode.call(this, locator);
  6524. this.uri = uri;
  6525. this.localName = localName;
  6526. this.qName = qName;
  6527. this.attributes = atts;
  6528. this.prefixMappings = prefixMappings;
  6529. this.nodeType = NodeType.ELEMENT;
  6530. }
  6531. Element.prototype = Object.create(ParentNode.prototype);
  6532. Element.prototype.visit = function(treeParser) {
  6533. if (this.prefixMappings) {
  6534. for (var key in prefixMappings) {
  6535. var mapping = prefixMappings[key];
  6536. treeParser.startPrefixMapping(mapping.getPrefix(),
  6537. mapping.getUri(), this);
  6538. }
  6539. }
  6540. treeParser.startElement(this.uri, this.localName, this.qName, this.attributes, this);
  6541. };
  6542. Element.prototype.revisit = function(treeParser) {
  6543. treeParser.endElement(this.uri, this.localName, this.qName, this.endLocator);
  6544. if (this.prefixMappings) {
  6545. for (var key in prefixMappings) {
  6546. var mapping = prefixMappings[key];
  6547. treeParser.endPrefixMapping(mapping.getPrefix(), this.endLocator);
  6548. }
  6549. }
  6550. };
  6551. function Characters(locator, data){
  6552. Node.call(this, locator);
  6553. this.data = data;
  6554. this.nodeType = NodeType.CHARACTERS;
  6555. }
  6556. Characters.prototype = Object.create(Node.prototype);
  6557. Characters.prototype.visit = function (treeParser) {
  6558. treeParser.characters(this.data, 0, this.data.length, this);
  6559. };
  6560. function IgnorableWhitespace(locator, data) {
  6561. Node.call(this, locator);
  6562. this.data = data;
  6563. this.nodeType = NodeType.IGNORABLE_WHITESPACE;
  6564. }
  6565. IgnorableWhitespace.prototype = Object.create(Node.prototype);
  6566. IgnorableWhitespace.prototype.visit = function(treeParser) {
  6567. treeParser.ignorableWhitespace(this.data, 0, this.data.length, this);
  6568. };
  6569. function Comment(locator, data) {
  6570. Node.call(this, locator);
  6571. this.data = data;
  6572. this.nodeType = NodeType.COMMENT;
  6573. }
  6574. Comment.prototype = Object.create(Node.prototype);
  6575. Comment.prototype.visit = function(treeParser) {
  6576. treeParser.comment(this.data, 0, this.data.length, this);
  6577. };
  6578. function CDATA(locator) {
  6579. ParentNode.call(this, locator);
  6580. this.nodeType = NodeType.CDATA;
  6581. }
  6582. CDATA.prototype = Object.create(ParentNode.prototype);
  6583. CDATA.prototype.visit = function(treeParser) {
  6584. treeParser.startCDATA(this);
  6585. };
  6586. CDATA.prototype.revisit = function(treeParser) {
  6587. treeParser.endCDATA(this.endLocator);
  6588. };
  6589. function Entity(name) {
  6590. ParentNode.call(this);
  6591. this.name = name;
  6592. this.nodeType = NodeType.ENTITY;
  6593. }
  6594. Entity.prototype = Object.create(ParentNode.prototype);
  6595. Entity.prototype.visit = function(treeParser) {
  6596. treeParser.startEntity(this.name, this);
  6597. };
  6598. Entity.prototype.revisit = function(treeParser) {
  6599. treeParser.endEntity(this.name);
  6600. };
  6601. function SkippedEntity(name) {
  6602. Node.call(this);
  6603. this.name = name;
  6604. this.nodeType = NodeType.SKIPPED_ENTITY;
  6605. }
  6606. SkippedEntity.prototype = Object.create(Node.prototype);
  6607. SkippedEntity.prototype.visit = function(treeParser) {
  6608. treeParser.skippedEntity(this.name, this);
  6609. };
  6610. function ProcessingInstruction(target, data) {
  6611. Node.call(this);
  6612. this.target = target;
  6613. this.data = data;
  6614. }
  6615. ProcessingInstruction.prototype = Object.create(Node.prototype);
  6616. ProcessingInstruction.prototype.visit = function(treeParser) {
  6617. treeParser.processingInstruction(this.target, this.data, this);
  6618. };
  6619. ProcessingInstruction.prototype.getNodeType = function() {
  6620. return NodeType.PROCESSING_INSTRUCTION;
  6621. };
  6622. function DTD(name, publicIdentifier, systemIdentifier) {
  6623. ParentNode.call(this);
  6624. this.name = name;
  6625. this.publicIdentifier = publicIdentifier;
  6626. this.systemIdentifier = systemIdentifier;
  6627. this.nodeType = NodeType.DTD;
  6628. }
  6629. DTD.prototype = Object.create(ParentNode.prototype);
  6630. DTD.prototype.visit = function(treeParser) {
  6631. treeParser.startDTD(this.name, this.publicIdentifier, this.systemIdentifier, this);
  6632. };
  6633. DTD.prototype.revisit = function(treeParser) {
  6634. treeParser.endDTD();
  6635. };
  6636. exports.SAXTreeBuilder = SAXTreeBuilder;
  6637. },
  6638. {"../TreeBuilder":6,"util":20}],
  6639. 11:[function(_dereq_,module,exports){
  6640. function TreeParser(contentHandler, lexicalHandler){
  6641. this.contentHandler;
  6642. this.lexicalHandler;
  6643. this.locatorDelegate;
  6644. if (!contentHandler) {
  6645. throw new IllegalArgumentException("contentHandler was null.");
  6646. }
  6647. this.contentHandler = contentHandler;
  6648. if (!lexicalHandler) {
  6649. this.lexicalHandler = new NullLexicalHandler();
  6650. } else {
  6651. this.lexicalHandler = lexicalHandler;
  6652. }
  6653. }
  6654. TreeParser.prototype.parse = function(node) {
  6655. this.contentHandler.documentLocator = this;
  6656. var current = node;
  6657. var next;
  6658. for (;;) {
  6659. current.visit(this);
  6660. if (next = current.firstChild) {
  6661. current = next;
  6662. continue;
  6663. }
  6664. for (;;) {
  6665. current.revisit(this);
  6666. if (current == node) {
  6667. return;
  6668. }
  6669. if (next = current.nextSibling) {
  6670. current = next;
  6671. break;
  6672. }
  6673. current = current.parentNode;
  6674. }
  6675. }
  6676. };
  6677. TreeParser.prototype.characters = function(ch, start, length, locator) {
  6678. this.locatorDelegate = locator;
  6679. this.contentHandler.characters(ch, start, length);
  6680. };
  6681. TreeParser.prototype.endDocument = function(locator) {
  6682. this.locatorDelegate = locator;
  6683. this.contentHandler.endDocument();
  6684. };
  6685. TreeParser.prototype.endElement = function(uri, localName, qName, locator) {
  6686. this.locatorDelegate = locator;
  6687. this.contentHandler.endElement(uri, localName, qName);
  6688. };
  6689. TreeParser.prototype.endPrefixMapping = function(prefix, locator) {
  6690. this.locatorDelegate = locator;
  6691. this.contentHandler.endPrefixMapping(prefix);
  6692. };
  6693. TreeParser.prototype.ignorableWhitespace = function(ch, start, length, locator) {
  6694. this.locatorDelegate = locator;
  6695. this.contentHandler.ignorableWhitespace(ch, start, length);
  6696. };
  6697. TreeParser.prototype.processingInstruction = function(target, data, locator) {
  6698. this.locatorDelegate = locator;
  6699. this.contentHandler.processingInstruction(target, data);
  6700. };
  6701. TreeParser.prototype.skippedEntity = function(name, locator) {
  6702. this.locatorDelegate = locator;
  6703. this.contentHandler.skippedEntity(name);
  6704. };
  6705. TreeParser.prototype.startDocument = function(locator) {
  6706. this.locatorDelegate = locator;
  6707. this.contentHandler.startDocument();
  6708. };
  6709. TreeParser.prototype.startElement = function(uri, localName, qName, atts, locator) {
  6710. this.locatorDelegate = locator;
  6711. this.contentHandler.startElement(uri, localName, qName, atts);
  6712. };
  6713. TreeParser.prototype.startPrefixMapping = function(prefix, uri, locator) {
  6714. this.locatorDelegate = locator;
  6715. this.contentHandler.startPrefixMapping(prefix, uri);
  6716. };
  6717. TreeParser.prototype.comment = function(ch, start, length, locator) {
  6718. this.locatorDelegate = locator;
  6719. this.lexicalHandler.comment(ch, start, length);
  6720. };
  6721. TreeParser.prototype.endCDATA = function(locator) {
  6722. this.locatorDelegate = locator;
  6723. this.lexicalHandler.endCDATA();
  6724. };
  6725. TreeParser.prototype.endDTD = function(locator) {
  6726. this.locatorDelegate = locator;
  6727. this.lexicalHandler.endDTD();
  6728. };
  6729. TreeParser.prototype.endEntity = function(name, locator) {
  6730. this.locatorDelegate = locator;
  6731. this.lexicalHandler.endEntity(name);
  6732. };
  6733. TreeParser.prototype.startCDATA = function(locator) {
  6734. this.locatorDelegate = locator;
  6735. this.lexicalHandler.startCDATA();
  6736. };
  6737. TreeParser.prototype.startDTD = function(name, publicId, systemId, locator) {
  6738. this.locatorDelegate = locator;
  6739. this.lexicalHandler.startDTD(name, publicId, systemId);
  6740. };
  6741. TreeParser.prototype.startEntity = function(name, locator) {
  6742. this.locatorDelegate = locator;
  6743. this.lexicalHandler.startEntity(name);
  6744. };
  6745. Object.defineProperty(TreeParser.prototype, 'columnNumber', {
  6746. get: function() {
  6747. if (!this.locatorDelegate)
  6748. return -1;
  6749. else
  6750. return this.locatorDelegate.columnNumber;
  6751. }
  6752. });
  6753. Object.defineProperty(TreeParser.prototype, 'lineNumber', {
  6754. get: function() {
  6755. if (!this.locatorDelegate)
  6756. return -1;
  6757. else
  6758. return this.locatorDelegate.lineNumber;
  6759. }
  6760. });
  6761. function NullLexicalHandler() {
  6762. }
  6763. NullLexicalHandler.prototype.comment = function() {};
  6764. NullLexicalHandler.prototype.endCDATA = function() {};
  6765. NullLexicalHandler.prototype.endDTD = function() {};
  6766. NullLexicalHandler.prototype.endEntity = function() {};
  6767. NullLexicalHandler.prototype.startCDATA = function() {};
  6768. NullLexicalHandler.prototype.startDTD = function() {};
  6769. NullLexicalHandler.prototype.startEntity = function() {};
  6770. exports.TreeParser = TreeParser;
  6771. },
  6772. {}],
  6773. 12:[function(_dereq_,module,exports){
  6774. module.exports = {
  6775. "Aacute;": "\u00C1",
  6776. "Aacute": "\u00C1",
  6777. "aacute;": "\u00E1",
  6778. "aacute": "\u00E1",
  6779. "Abreve;": "\u0102",
  6780. "abreve;": "\u0103",
  6781. "ac;": "\u223E",
  6782. "acd;": "\u223F",
  6783. "acE;": "\u223E\u0333",
  6784. "Acirc;": "\u00C2",
  6785. "Acirc": "\u00C2",
  6786. "acirc;": "\u00E2",
  6787. "acirc": "\u00E2",
  6788. "acute;": "\u00B4",
  6789. "acute": "\u00B4",
  6790. "Acy;": "\u0410",
  6791. "acy;": "\u0430",
  6792. "AElig;": "\u00C6",
  6793. "AElig": "\u00C6",
  6794. "aelig;": "\u00E6",
  6795. "aelig": "\u00E6",
  6796. "af;": "\u2061",
  6797. "Afr;": "\uD835\uDD04",
  6798. "afr;": "\uD835\uDD1E",
  6799. "Agrave;": "\u00C0",
  6800. "Agrave": "\u00C0",
  6801. "agrave;": "\u00E0",
  6802. "agrave": "\u00E0",
  6803. "alefsym;": "\u2135",
  6804. "aleph;": "\u2135",
  6805. "Alpha;": "\u0391",
  6806. "alpha;": "\u03B1",
  6807. "Amacr;": "\u0100",
  6808. "amacr;": "\u0101",
  6809. "amalg;": "\u2A3F",
  6810. "amp;": "\u0026",
  6811. "amp": "\u0026",
  6812. "AMP;": "\u0026",
  6813. "AMP": "\u0026",
  6814. "andand;": "\u2A55",
  6815. "And;": "\u2A53",
  6816. "and;": "\u2227",
  6817. "andd;": "\u2A5C",
  6818. "andslope;": "\u2A58",
  6819. "andv;": "\u2A5A",
  6820. "ang;": "\u2220",
  6821. "ange;": "\u29A4",
  6822. "angle;": "\u2220",
  6823. "angmsdaa;": "\u29A8",
  6824. "angmsdab;": "\u29A9",
  6825. "angmsdac;": "\u29AA",
  6826. "angmsdad;": "\u29AB",
  6827. "angmsdae;": "\u29AC",
  6828. "angmsdaf;": "\u29AD",
  6829. "angmsdag;": "\u29AE",
  6830. "angmsdah;": "\u29AF",
  6831. "angmsd;": "\u2221",
  6832. "angrt;": "\u221F",
  6833. "angrtvb;": "\u22BE",
  6834. "angrtvbd;": "\u299D",
  6835. "angsph;": "\u2222",
  6836. "angst;": "\u00C5",
  6837. "angzarr;": "\u237C",
  6838. "Aogon;": "\u0104",
  6839. "aogon;": "\u0105",
  6840. "Aopf;": "\uD835\uDD38",
  6841. "aopf;": "\uD835\uDD52",
  6842. "apacir;": "\u2A6F",
  6843. "ap;": "\u2248",
  6844. "apE;": "\u2A70",
  6845. "ape;": "\u224A",
  6846. "apid;": "\u224B",
  6847. "apos;": "\u0027",
  6848. "ApplyFunction;": "\u2061",
  6849. "approx;": "\u2248",
  6850. "approxeq;": "\u224A",
  6851. "Aring;": "\u00C5",
  6852. "Aring": "\u00C5",
  6853. "aring;": "\u00E5",
  6854. "aring": "\u00E5",
  6855. "Ascr;": "\uD835\uDC9C",
  6856. "ascr;": "\uD835\uDCB6",
  6857. "Assign;": "\u2254",
  6858. "ast;": "\u002A",
  6859. "asymp;": "\u2248",
  6860. "asympeq;": "\u224D",
  6861. "Atilde;": "\u00C3",
  6862. "Atilde": "\u00C3",
  6863. "atilde;": "\u00E3",
  6864. "atilde": "\u00E3",
  6865. "Auml;": "\u00C4",
  6866. "Auml": "\u00C4",
  6867. "auml;": "\u00E4",
  6868. "auml": "\u00E4",
  6869. "awconint;": "\u2233",
  6870. "awint;": "\u2A11",
  6871. "backcong;": "\u224C",
  6872. "backepsilon;": "\u03F6",
  6873. "backprime;": "\u2035",
  6874. "backsim;": "\u223D",
  6875. "backsimeq;": "\u22CD",
  6876. "Backslash;": "\u2216",
  6877. "Barv;": "\u2AE7",
  6878. "barvee;": "\u22BD",
  6879. "barwed;": "\u2305",
  6880. "Barwed;": "\u2306",
  6881. "barwedge;": "\u2305",
  6882. "bbrk;": "\u23B5",
  6883. "bbrktbrk;": "\u23B6",
  6884. "bcong;": "\u224C",
  6885. "Bcy;": "\u0411",
  6886. "bcy;": "\u0431",
  6887. "bdquo;": "\u201E",
  6888. "becaus;": "\u2235",
  6889. "because;": "\u2235",
  6890. "Because;": "\u2235",
  6891. "bemptyv;": "\u29B0",
  6892. "bepsi;": "\u03F6",
  6893. "bernou;": "\u212C",
  6894. "Bernoullis;": "\u212C",
  6895. "Beta;": "\u0392",
  6896. "beta;": "\u03B2",
  6897. "beth;": "\u2136",
  6898. "between;": "\u226C",
  6899. "Bfr;": "\uD835\uDD05",
  6900. "bfr;": "\uD835\uDD1F",
  6901. "bigcap;": "\u22C2",
  6902. "bigcirc;": "\u25EF",
  6903. "bigcup;": "\u22C3",
  6904. "bigodot;": "\u2A00",
  6905. "bigoplus;": "\u2A01",
  6906. "bigotimes;": "\u2A02",
  6907. "bigsqcup;": "\u2A06",
  6908. "bigstar;": "\u2605",
  6909. "bigtriangledown;": "\u25BD",
  6910. "bigtriangleup;": "\u25B3",
  6911. "biguplus;": "\u2A04",
  6912. "bigvee;": "\u22C1",
  6913. "bigwedge;": "\u22C0",
  6914. "bkarow;": "\u290D",
  6915. "blacklozenge;": "\u29EB",
  6916. "blacksquare;": "\u25AA",
  6917. "blacktriangle;": "\u25B4",
  6918. "blacktriangledown;": "\u25BE",
  6919. "blacktriangleleft;": "\u25C2",
  6920. "blacktriangleright;": "\u25B8",
  6921. "blank;": "\u2423",
  6922. "blk12;": "\u2592",
  6923. "blk14;": "\u2591",
  6924. "blk34;": "\u2593",
  6925. "block;": "\u2588",
  6926. "bne;": "\u003D\u20E5",
  6927. "bnequiv;": "\u2261\u20E5",
  6928. "bNot;": "\u2AED",
  6929. "bnot;": "\u2310",
  6930. "Bopf;": "\uD835\uDD39",
  6931. "bopf;": "\uD835\uDD53",
  6932. "bot;": "\u22A5",
  6933. "bottom;": "\u22A5",
  6934. "bowtie;": "\u22C8",
  6935. "boxbox;": "\u29C9",
  6936. "boxdl;": "\u2510",
  6937. "boxdL;": "\u2555",
  6938. "boxDl;": "\u2556",
  6939. "boxDL;": "\u2557",
  6940. "boxdr;": "\u250C",
  6941. "boxdR;": "\u2552",
  6942. "boxDr;": "\u2553",
  6943. "boxDR;": "\u2554",
  6944. "boxh;": "\u2500",
  6945. "boxH;": "\u2550",
  6946. "boxhd;": "\u252C",
  6947. "boxHd;": "\u2564",
  6948. "boxhD;": "\u2565",
  6949. "boxHD;": "\u2566",
  6950. "boxhu;": "\u2534",
  6951. "boxHu;": "\u2567",
  6952. "boxhU;": "\u2568",
  6953. "boxHU;": "\u2569",
  6954. "boxminus;": "\u229F",
  6955. "boxplus;": "\u229E",
  6956. "boxtimes;": "\u22A0",
  6957. "boxul;": "\u2518",
  6958. "boxuL;": "\u255B",
  6959. "boxUl;": "\u255C",
  6960. "boxUL;": "\u255D",
  6961. "boxur;": "\u2514",
  6962. "boxuR;": "\u2558",
  6963. "boxUr;": "\u2559",
  6964. "boxUR;": "\u255A",
  6965. "boxv;": "\u2502",
  6966. "boxV;": "\u2551",
  6967. "boxvh;": "\u253C",
  6968. "boxvH;": "\u256A",
  6969. "boxVh;": "\u256B",
  6970. "boxVH;": "\u256C",
  6971. "boxvl;": "\u2524",
  6972. "boxvL;": "\u2561",
  6973. "boxVl;": "\u2562",
  6974. "boxVL;": "\u2563",
  6975. "boxvr;": "\u251C",
  6976. "boxvR;": "\u255E",
  6977. "boxVr;": "\u255F",
  6978. "boxVR;": "\u2560",
  6979. "bprime;": "\u2035",
  6980. "breve;": "\u02D8",
  6981. "Breve;": "\u02D8",
  6982. "brvbar;": "\u00A6",
  6983. "brvbar": "\u00A6",
  6984. "bscr;": "\uD835\uDCB7",
  6985. "Bscr;": "\u212C",
  6986. "bsemi;": "\u204F",
  6987. "bsim;": "\u223D",
  6988. "bsime;": "\u22CD",
  6989. "bsolb;": "\u29C5",
  6990. "bsol;": "\u005C",
  6991. "bsolhsub;": "\u27C8",
  6992. "bull;": "\u2022",
  6993. "bullet;": "\u2022",
  6994. "bump;": "\u224E",
  6995. "bumpE;": "\u2AAE",
  6996. "bumpe;": "\u224F",
  6997. "Bumpeq;": "\u224E",
  6998. "bumpeq;": "\u224F",
  6999. "Cacute;": "\u0106",
  7000. "cacute;": "\u0107",
  7001. "capand;": "\u2A44",
  7002. "capbrcup;": "\u2A49",
  7003. "capcap;": "\u2A4B",
  7004. "cap;": "\u2229",
  7005. "Cap;": "\u22D2",
  7006. "capcup;": "\u2A47",
  7007. "capdot;": "\u2A40",
  7008. "CapitalDifferentialD;": "\u2145",
  7009. "caps;": "\u2229\uFE00",
  7010. "caret;": "\u2041",
  7011. "caron;": "\u02C7",
  7012. "Cayleys;": "\u212D",
  7013. "ccaps;": "\u2A4D",
  7014. "Ccaron;": "\u010C",
  7015. "ccaron;": "\u010D",
  7016. "Ccedil;": "\u00C7",
  7017. "Ccedil": "\u00C7",
  7018. "ccedil;": "\u00E7",
  7019. "ccedil": "\u00E7",
  7020. "Ccirc;": "\u0108",
  7021. "ccirc;": "\u0109",
  7022. "Cconint;": "\u2230",
  7023. "ccups;": "\u2A4C",
  7024. "ccupssm;": "\u2A50",
  7025. "Cdot;": "\u010A",
  7026. "cdot;": "\u010B",
  7027. "cedil;": "\u00B8",
  7028. "cedil": "\u00B8",
  7029. "Cedilla;": "\u00B8",
  7030. "cemptyv;": "\u29B2",
  7031. "cent;": "\u00A2",
  7032. "cent": "\u00A2",
  7033. "centerdot;": "\u00B7",
  7034. "CenterDot;": "\u00B7",
  7035. "cfr;": "\uD835\uDD20",
  7036. "Cfr;": "\u212D",
  7037. "CHcy;": "\u0427",
  7038. "chcy;": "\u0447",
  7039. "check;": "\u2713",
  7040. "checkmark;": "\u2713",
  7041. "Chi;": "\u03A7",
  7042. "chi;": "\u03C7",
  7043. "circ;": "\u02C6",
  7044. "circeq;": "\u2257",
  7045. "circlearrowleft;": "\u21BA",
  7046. "circlearrowright;": "\u21BB",
  7047. "circledast;": "\u229B",
  7048. "circledcirc;": "\u229A",
  7049. "circleddash;": "\u229D",
  7050. "CircleDot;": "\u2299",
  7051. "circledR;": "\u00AE",
  7052. "circledS;": "\u24C8",
  7053. "CircleMinus;": "\u2296",
  7054. "CirclePlus;": "\u2295",
  7055. "CircleTimes;": "\u2297",
  7056. "cir;": "\u25CB",
  7057. "cirE;": "\u29C3",
  7058. "cire;": "\u2257",
  7059. "cirfnint;": "\u2A10",
  7060. "cirmid;": "\u2AEF",
  7061. "cirscir;": "\u29C2",
  7062. "ClockwiseContourIntegral;": "\u2232",
  7063. "CloseCurlyDoubleQuote;": "\u201D",
  7064. "CloseCurlyQuote;": "\u2019",
  7065. "clubs;": "\u2663",
  7066. "clubsuit;": "\u2663",
  7067. "colon;": "\u003A",
  7068. "Colon;": "\u2237",
  7069. "Colone;": "\u2A74",
  7070. "colone;": "\u2254",
  7071. "coloneq;": "\u2254",
  7072. "comma;": "\u002C",
  7073. "commat;": "\u0040",
  7074. "comp;": "\u2201",
  7075. "compfn;": "\u2218",
  7076. "complement;": "\u2201",
  7077. "complexes;": "\u2102",
  7078. "cong;": "\u2245",
  7079. "congdot;": "\u2A6D",
  7080. "Congruent;": "\u2261",
  7081. "conint;": "\u222E",
  7082. "Conint;": "\u222F",
  7083. "ContourIntegral;": "\u222E",
  7084. "copf;": "\uD835\uDD54",
  7085. "Copf;": "\u2102",
  7086. "coprod;": "\u2210",
  7087. "Coproduct;": "\u2210",
  7088. "copy;": "\u00A9",
  7089. "copy": "\u00A9",
  7090. "COPY;": "\u00A9",
  7091. "COPY": "\u00A9",
  7092. "copysr;": "\u2117",
  7093. "CounterClockwiseContourIntegral;": "\u2233",
  7094. "crarr;": "\u21B5",
  7095. "cross;": "\u2717",
  7096. "Cross;": "\u2A2F",
  7097. "Cscr;": "\uD835\uDC9E",
  7098. "cscr;": "\uD835\uDCB8",
  7099. "csub;": "\u2ACF",
  7100. "csube;": "\u2AD1",
  7101. "csup;": "\u2AD0",
  7102. "csupe;": "\u2AD2",
  7103. "ctdot;": "\u22EF",
  7104. "cudarrl;": "\u2938",
  7105. "cudarrr;": "\u2935",
  7106. "cuepr;": "\u22DE",
  7107. "cuesc;": "\u22DF",
  7108. "cularr;": "\u21B6",
  7109. "cularrp;": "\u293D",
  7110. "cupbrcap;": "\u2A48",
  7111. "cupcap;": "\u2A46",
  7112. "CupCap;": "\u224D",
  7113. "cup;": "\u222A",
  7114. "Cup;": "\u22D3",
  7115. "cupcup;": "\u2A4A",
  7116. "cupdot;": "\u228D",
  7117. "cupor;": "\u2A45",
  7118. "cups;": "\u222A\uFE00",
  7119. "curarr;": "\u21B7",
  7120. "curarrm;": "\u293C",
  7121. "curlyeqprec;": "\u22DE",
  7122. "curlyeqsucc;": "\u22DF",
  7123. "curlyvee;": "\u22CE",
  7124. "curlywedge;": "\u22CF",
  7125. "curren;": "\u00A4",
  7126. "curren": "\u00A4",
  7127. "curvearrowleft;": "\u21B6",
  7128. "curvearrowright;": "\u21B7",
  7129. "cuvee;": "\u22CE",
  7130. "cuwed;": "\u22CF",
  7131. "cwconint;": "\u2232",
  7132. "cwint;": "\u2231",
  7133. "cylcty;": "\u232D",
  7134. "dagger;": "\u2020",
  7135. "Dagger;": "\u2021",
  7136. "daleth;": "\u2138",
  7137. "darr;": "\u2193",
  7138. "Darr;": "\u21A1",
  7139. "dArr;": "\u21D3",
  7140. "dash;": "\u2010",
  7141. "Dashv;": "\u2AE4",
  7142. "dashv;": "\u22A3",
  7143. "dbkarow;": "\u290F",
  7144. "dblac;": "\u02DD",
  7145. "Dcaron;": "\u010E",
  7146. "dcaron;": "\u010F",
  7147. "Dcy;": "\u0414",
  7148. "dcy;": "\u0434",
  7149. "ddagger;": "\u2021",
  7150. "ddarr;": "\u21CA",
  7151. "DD;": "\u2145",
  7152. "dd;": "\u2146",
  7153. "DDotrahd;": "\u2911",
  7154. "ddotseq;": "\u2A77",
  7155. "deg;": "\u00B0",
  7156. "deg": "\u00B0",
  7157. "Del;": "\u2207",
  7158. "Delta;": "\u0394",
  7159. "delta;": "\u03B4",
  7160. "demptyv;": "\u29B1",
  7161. "dfisht;": "\u297F",
  7162. "Dfr;": "\uD835\uDD07",
  7163. "dfr;": "\uD835\uDD21",
  7164. "dHar;": "\u2965",
  7165. "dharl;": "\u21C3",
  7166. "dharr;": "\u21C2",
  7167. "DiacriticalAcute;": "\u00B4",
  7168. "DiacriticalDot;": "\u02D9",
  7169. "DiacriticalDoubleAcute;": "\u02DD",
  7170. "DiacriticalGrave;": "\u0060",
  7171. "DiacriticalTilde;": "\u02DC",
  7172. "diam;": "\u22C4",
  7173. "diamond;": "\u22C4",
  7174. "Diamond;": "\u22C4",
  7175. "diamondsuit;": "\u2666",
  7176. "diams;": "\u2666",
  7177. "die;": "\u00A8",
  7178. "DifferentialD;": "\u2146",
  7179. "digamma;": "\u03DD",
  7180. "disin;": "\u22F2",
  7181. "div;": "\u00F7",
  7182. "divide;": "\u00F7",
  7183. "divide": "\u00F7",
  7184. "divideontimes;": "\u22C7",
  7185. "divonx;": "\u22C7",
  7186. "DJcy;": "\u0402",
  7187. "djcy;": "\u0452",
  7188. "dlcorn;": "\u231E",
  7189. "dlcrop;": "\u230D",
  7190. "dollar;": "\u0024",
  7191. "Dopf;": "\uD835\uDD3B",
  7192. "dopf;": "\uD835\uDD55",
  7193. "Dot;": "\u00A8",
  7194. "dot;": "\u02D9",
  7195. "DotDot;": "\u20DC",
  7196. "doteq;": "\u2250",
  7197. "doteqdot;": "\u2251",
  7198. "DotEqual;": "\u2250",
  7199. "dotminus;": "\u2238",
  7200. "dotplus;": "\u2214",
  7201. "dotsquare;": "\u22A1",
  7202. "doublebarwedge;": "\u2306",
  7203. "DoubleContourIntegral;": "\u222F",
  7204. "DoubleDot;": "\u00A8",
  7205. "DoubleDownArrow;": "\u21D3",
  7206. "DoubleLeftArrow;": "\u21D0",
  7207. "DoubleLeftRightArrow;": "\u21D4",
  7208. "DoubleLeftTee;": "\u2AE4",
  7209. "DoubleLongLeftArrow;": "\u27F8",
  7210. "DoubleLongLeftRightArrow;": "\u27FA",
  7211. "DoubleLongRightArrow;": "\u27F9",
  7212. "DoubleRightArrow;": "\u21D2",
  7213. "DoubleRightTee;": "\u22A8",
  7214. "DoubleUpArrow;": "\u21D1",
  7215. "DoubleUpDownArrow;": "\u21D5",
  7216. "DoubleVerticalBar;": "\u2225",
  7217. "DownArrowBar;": "\u2913",
  7218. "downarrow;": "\u2193",
  7219. "DownArrow;": "\u2193",
  7220. "Downarrow;": "\u21D3",
  7221. "DownArrowUpArrow;": "\u21F5",
  7222. "DownBreve;": "\u0311",
  7223. "downdownarrows;": "\u21CA",
  7224. "downharpoonleft;": "\u21C3",
  7225. "downharpoonright;": "\u21C2",
  7226. "DownLeftRightVector;": "\u2950",
  7227. "DownLeftTeeVector;": "\u295E",
  7228. "DownLeftVectorBar;": "\u2956",
  7229. "DownLeftVector;": "\u21BD",
  7230. "DownRightTeeVector;": "\u295F",
  7231. "DownRightVectorBar;": "\u2957",
  7232. "DownRightVector;": "\u21C1",
  7233. "DownTeeArrow;": "\u21A7",
  7234. "DownTee;": "\u22A4",
  7235. "drbkarow;": "\u2910",
  7236. "drcorn;": "\u231F",
  7237. "drcrop;": "\u230C",
  7238. "Dscr;": "\uD835\uDC9F",
  7239. "dscr;": "\uD835\uDCB9",
  7240. "DScy;": "\u0405",
  7241. "dscy;": "\u0455",
  7242. "dsol;": "\u29F6",
  7243. "Dstrok;": "\u0110",
  7244. "dstrok;": "\u0111",
  7245. "dtdot;": "\u22F1",
  7246. "dtri;": "\u25BF",
  7247. "dtrif;": "\u25BE",
  7248. "duarr;": "\u21F5",
  7249. "duhar;": "\u296F",
  7250. "dwangle;": "\u29A6",
  7251. "DZcy;": "\u040F",
  7252. "dzcy;": "\u045F",
  7253. "dzigrarr;": "\u27FF",
  7254. "Eacute;": "\u00C9",
  7255. "Eacute": "\u00C9",
  7256. "eacute;": "\u00E9",
  7257. "eacute": "\u00E9",
  7258. "easter;": "\u2A6E",
  7259. "Ecaron;": "\u011A",
  7260. "ecaron;": "\u011B",
  7261. "Ecirc;": "\u00CA",
  7262. "Ecirc": "\u00CA",
  7263. "ecirc;": "\u00EA",
  7264. "ecirc": "\u00EA",
  7265. "ecir;": "\u2256",
  7266. "ecolon;": "\u2255",
  7267. "Ecy;": "\u042D",
  7268. "ecy;": "\u044D",
  7269. "eDDot;": "\u2A77",
  7270. "Edot;": "\u0116",
  7271. "edot;": "\u0117",
  7272. "eDot;": "\u2251",
  7273. "ee;": "\u2147",
  7274. "efDot;": "\u2252",
  7275. "Efr;": "\uD835\uDD08",
  7276. "efr;": "\uD835\uDD22",
  7277. "eg;": "\u2A9A",
  7278. "Egrave;": "\u00C8",
  7279. "Egrave": "\u00C8",
  7280. "egrave;": "\u00E8",
  7281. "egrave": "\u00E8",
  7282. "egs;": "\u2A96",
  7283. "egsdot;": "\u2A98",
  7284. "el;": "\u2A99",
  7285. "Element;": "\u2208",
  7286. "elinters;": "\u23E7",
  7287. "ell;": "\u2113",
  7288. "els;": "\u2A95",
  7289. "elsdot;": "\u2A97",
  7290. "Emacr;": "\u0112",
  7291. "emacr;": "\u0113",
  7292. "empty;": "\u2205",
  7293. "emptyset;": "\u2205",
  7294. "EmptySmallSquare;": "\u25FB",
  7295. "emptyv;": "\u2205",
  7296. "EmptyVerySmallSquare;": "\u25AB",
  7297. "emsp13;": "\u2004",
  7298. "emsp14;": "\u2005",
  7299. "emsp;": "\u2003",
  7300. "ENG;": "\u014A",
  7301. "eng;": "\u014B",
  7302. "ensp;": "\u2002",
  7303. "Eogon;": "\u0118",
  7304. "eogon;": "\u0119",
  7305. "Eopf;": "\uD835\uDD3C",
  7306. "eopf;": "\uD835\uDD56",
  7307. "epar;": "\u22D5",
  7308. "eparsl;": "\u29E3",
  7309. "eplus;": "\u2A71",
  7310. "epsi;": "\u03B5",
  7311. "Epsilon;": "\u0395",
  7312. "epsilon;": "\u03B5",
  7313. "epsiv;": "\u03F5",
  7314. "eqcirc;": "\u2256",
  7315. "eqcolon;": "\u2255",
  7316. "eqsim;": "\u2242",
  7317. "eqslantgtr;": "\u2A96",
  7318. "eqslantless;": "\u2A95",
  7319. "Equal;": "\u2A75",
  7320. "equals;": "\u003D",
  7321. "EqualTilde;": "\u2242",
  7322. "equest;": "\u225F",
  7323. "Equilibrium;": "\u21CC",
  7324. "equiv;": "\u2261",
  7325. "equivDD;": "\u2A78",
  7326. "eqvparsl;": "\u29E5",
  7327. "erarr;": "\u2971",
  7328. "erDot;": "\u2253",
  7329. "escr;": "\u212F",
  7330. "Escr;": "\u2130",
  7331. "esdot;": "\u2250",
  7332. "Esim;": "\u2A73",
  7333. "esim;": "\u2242",
  7334. "Eta;": "\u0397",
  7335. "eta;": "\u03B7",
  7336. "ETH;": "\u00D0",
  7337. "ETH": "\u00D0",
  7338. "eth;": "\u00F0",
  7339. "eth": "\u00F0",
  7340. "Euml;": "\u00CB",
  7341. "Euml": "\u00CB",
  7342. "euml;": "\u00EB",
  7343. "euml": "\u00EB",
  7344. "euro;": "\u20AC",
  7345. "excl;": "\u0021",
  7346. "exist;": "\u2203",
  7347. "Exists;": "\u2203",
  7348. "expectation;": "\u2130",
  7349. "exponentiale;": "\u2147",
  7350. "ExponentialE;": "\u2147",
  7351. "fallingdotseq;": "\u2252",
  7352. "Fcy;": "\u0424",
  7353. "fcy;": "\u0444",
  7354. "female;": "\u2640",
  7355. "ffilig;": "\uFB03",
  7356. "fflig;": "\uFB00",
  7357. "ffllig;": "\uFB04",
  7358. "Ffr;": "\uD835\uDD09",
  7359. "ffr;": "\uD835\uDD23",
  7360. "filig;": "\uFB01",
  7361. "FilledSmallSquare;": "\u25FC",
  7362. "FilledVerySmallSquare;": "\u25AA",
  7363. "fjlig;": "\u0066\u006A",
  7364. "flat;": "\u266D",
  7365. "fllig;": "\uFB02",
  7366. "fltns;": "\u25B1",
  7367. "fnof;": "\u0192",
  7368. "Fopf;": "\uD835\uDD3D",
  7369. "fopf;": "\uD835\uDD57",
  7370. "forall;": "\u2200",
  7371. "ForAll;": "\u2200",
  7372. "fork;": "\u22D4",
  7373. "forkv;": "\u2AD9",
  7374. "Fouriertrf;": "\u2131",
  7375. "fpartint;": "\u2A0D",
  7376. "frac12;": "\u00BD",
  7377. "frac12": "\u00BD",
  7378. "frac13;": "\u2153",
  7379. "frac14;": "\u00BC",
  7380. "frac14": "\u00BC",
  7381. "frac15;": "\u2155",
  7382. "frac16;": "\u2159",
  7383. "frac18;": "\u215B",
  7384. "frac23;": "\u2154",
  7385. "frac25;": "\u2156",
  7386. "frac34;": "\u00BE",
  7387. "frac34": "\u00BE",
  7388. "frac35;": "\u2157",
  7389. "frac38;": "\u215C",
  7390. "frac45;": "\u2158",
  7391. "frac56;": "\u215A",
  7392. "frac58;": "\u215D",
  7393. "frac78;": "\u215E",
  7394. "frasl;": "\u2044",
  7395. "frown;": "\u2322",
  7396. "fscr;": "\uD835\uDCBB",
  7397. "Fscr;": "\u2131",
  7398. "gacute;": "\u01F5",
  7399. "Gamma;": "\u0393",
  7400. "gamma;": "\u03B3",
  7401. "Gammad;": "\u03DC",
  7402. "gammad;": "\u03DD",
  7403. "gap;": "\u2A86",
  7404. "Gbreve;": "\u011E",
  7405. "gbreve;": "\u011F",
  7406. "Gcedil;": "\u0122",
  7407. "Gcirc;": "\u011C",
  7408. "gcirc;": "\u011D",
  7409. "Gcy;": "\u0413",
  7410. "gcy;": "\u0433",
  7411. "Gdot;": "\u0120",
  7412. "gdot;": "\u0121",
  7413. "ge;": "\u2265",
  7414. "gE;": "\u2267",
  7415. "gEl;": "\u2A8C",
  7416. "gel;": "\u22DB",
  7417. "geq;": "\u2265",
  7418. "geqq;": "\u2267",
  7419. "geqslant;": "\u2A7E",
  7420. "gescc;": "\u2AA9",
  7421. "ges;": "\u2A7E",
  7422. "gesdot;": "\u2A80",
  7423. "gesdoto;": "\u2A82",
  7424. "gesdotol;": "\u2A84",
  7425. "gesl;": "\u22DB\uFE00",
  7426. "gesles;": "\u2A94",
  7427. "Gfr;": "\uD835\uDD0A",
  7428. "gfr;": "\uD835\uDD24",
  7429. "gg;": "\u226B",
  7430. "Gg;": "\u22D9",
  7431. "ggg;": "\u22D9",
  7432. "gimel;": "\u2137",
  7433. "GJcy;": "\u0403",
  7434. "gjcy;": "\u0453",
  7435. "gla;": "\u2AA5",
  7436. "gl;": "\u2277",
  7437. "glE;": "\u2A92",
  7438. "glj;": "\u2AA4",
  7439. "gnap;": "\u2A8A",
  7440. "gnapprox;": "\u2A8A",
  7441. "gne;": "\u2A88",
  7442. "gnE;": "\u2269",
  7443. "gneq;": "\u2A88",
  7444. "gneqq;": "\u2269",
  7445. "gnsim;": "\u22E7",
  7446. "Gopf;": "\uD835\uDD3E",
  7447. "gopf;": "\uD835\uDD58",
  7448. "grave;": "\u0060",
  7449. "GreaterEqual;": "\u2265",
  7450. "GreaterEqualLess;": "\u22DB",
  7451. "GreaterFullEqual;": "\u2267",
  7452. "GreaterGreater;": "\u2AA2",
  7453. "GreaterLess;": "\u2277",
  7454. "GreaterSlantEqual;": "\u2A7E",
  7455. "GreaterTilde;": "\u2273",
  7456. "Gscr;": "\uD835\uDCA2",
  7457. "gscr;": "\u210A",
  7458. "gsim;": "\u2273",
  7459. "gsime;": "\u2A8E",
  7460. "gsiml;": "\u2A90",
  7461. "gtcc;": "\u2AA7",
  7462. "gtcir;": "\u2A7A",
  7463. "gt;": "\u003E",
  7464. "gt": "\u003E",
  7465. "GT;": "\u003E",
  7466. "GT": "\u003E",
  7467. "Gt;": "\u226B",
  7468. "gtdot;": "\u22D7",
  7469. "gtlPar;": "\u2995",
  7470. "gtquest;": "\u2A7C",
  7471. "gtrapprox;": "\u2A86",
  7472. "gtrarr;": "\u2978",
  7473. "gtrdot;": "\u22D7",
  7474. "gtreqless;": "\u22DB",
  7475. "gtreqqless;": "\u2A8C",
  7476. "gtrless;": "\u2277",
  7477. "gtrsim;": "\u2273",
  7478. "gvertneqq;": "\u2269\uFE00",
  7479. "gvnE;": "\u2269\uFE00",
  7480. "Hacek;": "\u02C7",
  7481. "hairsp;": "\u200A",
  7482. "half;": "\u00BD",
  7483. "hamilt;": "\u210B",
  7484. "HARDcy;": "\u042A",
  7485. "hardcy;": "\u044A",
  7486. "harrcir;": "\u2948",
  7487. "harr;": "\u2194",
  7488. "hArr;": "\u21D4",
  7489. "harrw;": "\u21AD",
  7490. "Hat;": "\u005E",
  7491. "hbar;": "\u210F",
  7492. "Hcirc;": "\u0124",
  7493. "hcirc;": "\u0125",
  7494. "hearts;": "\u2665",
  7495. "heartsuit;": "\u2665",
  7496. "hellip;": "\u2026",
  7497. "hercon;": "\u22B9",
  7498. "hfr;": "\uD835\uDD25",
  7499. "Hfr;": "\u210C",
  7500. "HilbertSpace;": "\u210B",
  7501. "hksearow;": "\u2925",
  7502. "hkswarow;": "\u2926",
  7503. "hoarr;": "\u21FF",
  7504. "homtht;": "\u223B",
  7505. "hookleftarrow;": "\u21A9",
  7506. "hookrightarrow;": "\u21AA",
  7507. "hopf;": "\uD835\uDD59",
  7508. "Hopf;": "\u210D",
  7509. "horbar;": "\u2015",
  7510. "HorizontalLine;": "\u2500",
  7511. "hscr;": "\uD835\uDCBD",
  7512. "Hscr;": "\u210B",
  7513. "hslash;": "\u210F",
  7514. "Hstrok;": "\u0126",
  7515. "hstrok;": "\u0127",
  7516. "HumpDownHump;": "\u224E",
  7517. "HumpEqual;": "\u224F",
  7518. "hybull;": "\u2043",
  7519. "hyphen;": "\u2010",
  7520. "Iacute;": "\u00CD",
  7521. "Iacute": "\u00CD",
  7522. "iacute;": "\u00ED",
  7523. "iacute": "\u00ED",
  7524. "ic;": "\u2063",
  7525. "Icirc;": "\u00CE",
  7526. "Icirc": "\u00CE",
  7527. "icirc;": "\u00EE",
  7528. "icirc": "\u00EE",
  7529. "Icy;": "\u0418",
  7530. "icy;": "\u0438",
  7531. "Idot;": "\u0130",
  7532. "IEcy;": "\u0415",
  7533. "iecy;": "\u0435",
  7534. "iexcl;": "\u00A1",
  7535. "iexcl": "\u00A1",
  7536. "iff;": "\u21D4",
  7537. "ifr;": "\uD835\uDD26",
  7538. "Ifr;": "\u2111",
  7539. "Igrave;": "\u00CC",
  7540. "Igrave": "\u00CC",
  7541. "igrave;": "\u00EC",
  7542. "igrave": "\u00EC",
  7543. "ii;": "\u2148",
  7544. "iiiint;": "\u2A0C",
  7545. "iiint;": "\u222D",
  7546. "iinfin;": "\u29DC",
  7547. "iiota;": "\u2129",
  7548. "IJlig;": "\u0132",
  7549. "ijlig;": "\u0133",
  7550. "Imacr;": "\u012A",
  7551. "imacr;": "\u012B",
  7552. "image;": "\u2111",
  7553. "ImaginaryI;": "\u2148",
  7554. "imagline;": "\u2110",
  7555. "imagpart;": "\u2111",
  7556. "imath;": "\u0131",
  7557. "Im;": "\u2111",
  7558. "imof;": "\u22B7",
  7559. "imped;": "\u01B5",
  7560. "Implies;": "\u21D2",
  7561. "incare;": "\u2105",
  7562. "in;": "\u2208",
  7563. "infin;": "\u221E",
  7564. "infintie;": "\u29DD",
  7565. "inodot;": "\u0131",
  7566. "intcal;": "\u22BA",
  7567. "int;": "\u222B",
  7568. "Int;": "\u222C",
  7569. "integers;": "\u2124",
  7570. "Integral;": "\u222B",
  7571. "intercal;": "\u22BA",
  7572. "Intersection;": "\u22C2",
  7573. "intlarhk;": "\u2A17",
  7574. "intprod;": "\u2A3C",
  7575. "InvisibleComma;": "\u2063",
  7576. "InvisibleTimes;": "\u2062",
  7577. "IOcy;": "\u0401",
  7578. "iocy;": "\u0451",
  7579. "Iogon;": "\u012E",
  7580. "iogon;": "\u012F",
  7581. "Iopf;": "\uD835\uDD40",
  7582. "iopf;": "\uD835\uDD5A",
  7583. "Iota;": "\u0399",
  7584. "iota;": "\u03B9",
  7585. "iprod;": "\u2A3C",
  7586. "iquest;": "\u00BF",
  7587. "iquest": "\u00BF",
  7588. "iscr;": "\uD835\uDCBE",
  7589. "Iscr;": "\u2110",
  7590. "isin;": "\u2208",
  7591. "isindot;": "\u22F5",
  7592. "isinE;": "\u22F9",
  7593. "isins;": "\u22F4",
  7594. "isinsv;": "\u22F3",
  7595. "isinv;": "\u2208",
  7596. "it;": "\u2062",
  7597. "Itilde;": "\u0128",
  7598. "itilde;": "\u0129",
  7599. "Iukcy;": "\u0406",
  7600. "iukcy;": "\u0456",
  7601. "Iuml;": "\u00CF",
  7602. "Iuml": "\u00CF",
  7603. "iuml;": "\u00EF",
  7604. "iuml": "\u00EF",
  7605. "Jcirc;": "\u0134",
  7606. "jcirc;": "\u0135",
  7607. "Jcy;": "\u0419",
  7608. "jcy;": "\u0439",
  7609. "Jfr;": "\uD835\uDD0D",
  7610. "jfr;": "\uD835\uDD27",
  7611. "jmath;": "\u0237",
  7612. "Jopf;": "\uD835\uDD41",
  7613. "jopf;": "\uD835\uDD5B",
  7614. "Jscr;": "\uD835\uDCA5",
  7615. "jscr;": "\uD835\uDCBF",
  7616. "Jsercy;": "\u0408",
  7617. "jsercy;": "\u0458",
  7618. "Jukcy;": "\u0404",
  7619. "jukcy;": "\u0454",
  7620. "Kappa;": "\u039A",
  7621. "kappa;": "\u03BA",
  7622. "kappav;": "\u03F0",
  7623. "Kcedil;": "\u0136",
  7624. "kcedil;": "\u0137",
  7625. "Kcy;": "\u041A",
  7626. "kcy;": "\u043A",
  7627. "Kfr;": "\uD835\uDD0E",
  7628. "kfr;": "\uD835\uDD28",
  7629. "kgreen;": "\u0138",
  7630. "KHcy;": "\u0425",
  7631. "khcy;": "\u0445",
  7632. "KJcy;": "\u040C",
  7633. "kjcy;": "\u045C",
  7634. "Kopf;": "\uD835\uDD42",
  7635. "kopf;": "\uD835\uDD5C",
  7636. "Kscr;": "\uD835\uDCA6",
  7637. "kscr;": "\uD835\uDCC0",
  7638. "lAarr;": "\u21DA",
  7639. "Lacute;": "\u0139",
  7640. "lacute;": "\u013A",
  7641. "laemptyv;": "\u29B4",
  7642. "lagran;": "\u2112",
  7643. "Lambda;": "\u039B",
  7644. "lambda;": "\u03BB",
  7645. "lang;": "\u27E8",
  7646. "Lang;": "\u27EA",
  7647. "langd;": "\u2991",
  7648. "langle;": "\u27E8",
  7649. "lap;": "\u2A85",
  7650. "Laplacetrf;": "\u2112",
  7651. "laquo;": "\u00AB",
  7652. "laquo": "\u00AB",
  7653. "larrb;": "\u21E4",
  7654. "larrbfs;": "\u291F",
  7655. "larr;": "\u2190",
  7656. "Larr;": "\u219E",
  7657. "lArr;": "\u21D0",
  7658. "larrfs;": "\u291D",
  7659. "larrhk;": "\u21A9",
  7660. "larrlp;": "\u21AB",
  7661. "larrpl;": "\u2939",
  7662. "larrsim;": "\u2973",
  7663. "larrtl;": "\u21A2",
  7664. "latail;": "\u2919",
  7665. "lAtail;": "\u291B",
  7666. "lat;": "\u2AAB",
  7667. "late;": "\u2AAD",
  7668. "lates;": "\u2AAD\uFE00",
  7669. "lbarr;": "\u290C",
  7670. "lBarr;": "\u290E",
  7671. "lbbrk;": "\u2772",
  7672. "lbrace;": "\u007B",
  7673. "lbrack;": "\u005B",
  7674. "lbrke;": "\u298B",
  7675. "lbrksld;": "\u298F",
  7676. "lbrkslu;": "\u298D",
  7677. "Lcaron;": "\u013D",
  7678. "lcaron;": "\u013E",
  7679. "Lcedil;": "\u013B",
  7680. "lcedil;": "\u013C",
  7681. "lceil;": "\u2308",
  7682. "lcub;": "\u007B",
  7683. "Lcy;": "\u041B",
  7684. "lcy;": "\u043B",
  7685. "ldca;": "\u2936",
  7686. "ldquo;": "\u201C",
  7687. "ldquor;": "\u201E",
  7688. "ldrdhar;": "\u2967",
  7689. "ldrushar;": "\u294B",
  7690. "ldsh;": "\u21B2",
  7691. "le;": "\u2264",
  7692. "lE;": "\u2266",
  7693. "LeftAngleBracket;": "\u27E8",
  7694. "LeftArrowBar;": "\u21E4",
  7695. "leftarrow;": "\u2190",
  7696. "LeftArrow;": "\u2190",
  7697. "Leftarrow;": "\u21D0",
  7698. "LeftArrowRightArrow;": "\u21C6",
  7699. "leftarrowtail;": "\u21A2",
  7700. "LeftCeiling;": "\u2308",
  7701. "LeftDoubleBracket;": "\u27E6",
  7702. "LeftDownTeeVector;": "\u2961",
  7703. "LeftDownVectorBar;": "\u2959",
  7704. "LeftDownVector;": "\u21C3",
  7705. "LeftFloor;": "\u230A",
  7706. "leftharpoondown;": "\u21BD",
  7707. "leftharpoonup;": "\u21BC",
  7708. "leftleftarrows;": "\u21C7",
  7709. "leftrightarrow;": "\u2194",
  7710. "LeftRightArrow;": "\u2194",
  7711. "Leftrightarrow;": "\u21D4",
  7712. "leftrightarrows;": "\u21C6",
  7713. "leftrightharpoons;": "\u21CB",
  7714. "leftrightsquigarrow;": "\u21AD",
  7715. "LeftRightVector;": "\u294E",
  7716. "LeftTeeArrow;": "\u21A4",
  7717. "LeftTee;": "\u22A3",
  7718. "LeftTeeVector;": "\u295A",
  7719. "leftthreetimes;": "\u22CB",
  7720. "LeftTriangleBar;": "\u29CF",
  7721. "LeftTriangle;": "\u22B2",
  7722. "LeftTriangleEqual;": "\u22B4",
  7723. "LeftUpDownVector;": "\u2951",
  7724. "LeftUpTeeVector;": "\u2960",
  7725. "LeftUpVectorBar;": "\u2958",
  7726. "LeftUpVector;": "\u21BF",
  7727. "LeftVectorBar;": "\u2952",
  7728. "LeftVector;": "\u21BC",
  7729. "lEg;": "\u2A8B",
  7730. "leg;": "\u22DA",
  7731. "leq;": "\u2264",
  7732. "leqq;": "\u2266",
  7733. "leqslant;": "\u2A7D",
  7734. "lescc;": "\u2AA8",
  7735. "les;": "\u2A7D",
  7736. "lesdot;": "\u2A7F",
  7737. "lesdoto;": "\u2A81",
  7738. "lesdotor;": "\u2A83",
  7739. "lesg;": "\u22DA\uFE00",
  7740. "lesges;": "\u2A93",
  7741. "lessapprox;": "\u2A85",
  7742. "lessdot;": "\u22D6",
  7743. "lesseqgtr;": "\u22DA",
  7744. "lesseqqgtr;": "\u2A8B",
  7745. "LessEqualGreater;": "\u22DA",
  7746. "LessFullEqual;": "\u2266",
  7747. "LessGreater;": "\u2276",
  7748. "lessgtr;": "\u2276",
  7749. "LessLess;": "\u2AA1",
  7750. "lesssim;": "\u2272",
  7751. "LessSlantEqual;": "\u2A7D",
  7752. "LessTilde;": "\u2272",
  7753. "lfisht;": "\u297C",
  7754. "lfloor;": "\u230A",
  7755. "Lfr;": "\uD835\uDD0F",
  7756. "lfr;": "\uD835\uDD29",
  7757. "lg;": "\u2276",
  7758. "lgE;": "\u2A91",
  7759. "lHar;": "\u2962",
  7760. "lhard;": "\u21BD",
  7761. "lharu;": "\u21BC",
  7762. "lharul;": "\u296A",
  7763. "lhblk;": "\u2584",
  7764. "LJcy;": "\u0409",
  7765. "ljcy;": "\u0459",
  7766. "llarr;": "\u21C7",
  7767. "ll;": "\u226A",
  7768. "Ll;": "\u22D8",
  7769. "llcorner;": "\u231E",
  7770. "Lleftarrow;": "\u21DA",
  7771. "llhard;": "\u296B",
  7772. "lltri;": "\u25FA",
  7773. "Lmidot;": "\u013F",
  7774. "lmidot;": "\u0140",
  7775. "lmoustache;": "\u23B0",
  7776. "lmoust;": "\u23B0",
  7777. "lnap;": "\u2A89",
  7778. "lnapprox;": "\u2A89",
  7779. "lne;": "\u2A87",
  7780. "lnE;": "\u2268",
  7781. "lneq;": "\u2A87",
  7782. "lneqq;": "\u2268",
  7783. "lnsim;": "\u22E6",
  7784. "loang;": "\u27EC",
  7785. "loarr;": "\u21FD",
  7786. "lobrk;": "\u27E6",
  7787. "longleftarrow;": "\u27F5",
  7788. "LongLeftArrow;": "\u27F5",
  7789. "Longleftarrow;": "\u27F8",
  7790. "longleftrightarrow;": "\u27F7",
  7791. "LongLeftRightArrow;": "\u27F7",
  7792. "Longleftrightarrow;": "\u27FA",
  7793. "longmapsto;": "\u27FC",
  7794. "longrightarrow;": "\u27F6",
  7795. "LongRightArrow;": "\u27F6",
  7796. "Longrightarrow;": "\u27F9",
  7797. "looparrowleft;": "\u21AB",
  7798. "looparrowright;": "\u21AC",
  7799. "lopar;": "\u2985",
  7800. "Lopf;": "\uD835\uDD43",
  7801. "lopf;": "\uD835\uDD5D",
  7802. "loplus;": "\u2A2D",
  7803. "lotimes;": "\u2A34",
  7804. "lowast;": "\u2217",
  7805. "lowbar;": "\u005F",
  7806. "LowerLeftArrow;": "\u2199",
  7807. "LowerRightArrow;": "\u2198",
  7808. "loz;": "\u25CA",
  7809. "lozenge;": "\u25CA",
  7810. "lozf;": "\u29EB",
  7811. "lpar;": "\u0028",
  7812. "lparlt;": "\u2993",
  7813. "lrarr;": "\u21C6",
  7814. "lrcorner;": "\u231F",
  7815. "lrhar;": "\u21CB",
  7816. "lrhard;": "\u296D",
  7817. "lrm;": "\u200E",
  7818. "lrtri;": "\u22BF",
  7819. "lsaquo;": "\u2039",
  7820. "lscr;": "\uD835\uDCC1",
  7821. "Lscr;": "\u2112",
  7822. "lsh;": "\u21B0",
  7823. "Lsh;": "\u21B0",
  7824. "lsim;": "\u2272",
  7825. "lsime;": "\u2A8D",
  7826. "lsimg;": "\u2A8F",
  7827. "lsqb;": "\u005B",
  7828. "lsquo;": "\u2018",
  7829. "lsquor;": "\u201A",
  7830. "Lstrok;": "\u0141",
  7831. "lstrok;": "\u0142",
  7832. "ltcc;": "\u2AA6",
  7833. "ltcir;": "\u2A79",
  7834. "lt;": "\u003C",
  7835. "lt": "\u003C",
  7836. "LT;": "\u003C",
  7837. "LT": "\u003C",
  7838. "Lt;": "\u226A",
  7839. "ltdot;": "\u22D6",
  7840. "lthree;": "\u22CB",
  7841. "ltimes;": "\u22C9",
  7842. "ltlarr;": "\u2976",
  7843. "ltquest;": "\u2A7B",
  7844. "ltri;": "\u25C3",
  7845. "ltrie;": "\u22B4",
  7846. "ltrif;": "\u25C2",
  7847. "ltrPar;": "\u2996",
  7848. "lurdshar;": "\u294A",
  7849. "luruhar;": "\u2966",
  7850. "lvertneqq;": "\u2268\uFE00",
  7851. "lvnE;": "\u2268\uFE00",
  7852. "macr;": "\u00AF",
  7853. "macr": "\u00AF",
  7854. "male;": "\u2642",
  7855. "malt;": "\u2720",
  7856. "maltese;": "\u2720",
  7857. "Map;": "\u2905",
  7858. "map;": "\u21A6",
  7859. "mapsto;": "\u21A6",
  7860. "mapstodown;": "\u21A7",
  7861. "mapstoleft;": "\u21A4",
  7862. "mapstoup;": "\u21A5",
  7863. "marker;": "\u25AE",
  7864. "mcomma;": "\u2A29",
  7865. "Mcy;": "\u041C",
  7866. "mcy;": "\u043C",
  7867. "mdash;": "\u2014",
  7868. "mDDot;": "\u223A",
  7869. "measuredangle;": "\u2221",
  7870. "MediumSpace;": "\u205F",
  7871. "Mellintrf;": "\u2133",
  7872. "Mfr;": "\uD835\uDD10",
  7873. "mfr;": "\uD835\uDD2A",
  7874. "mho;": "\u2127",
  7875. "micro;": "\u00B5",
  7876. "micro": "\u00B5",
  7877. "midast;": "\u002A",
  7878. "midcir;": "\u2AF0",
  7879. "mid;": "\u2223",
  7880. "middot;": "\u00B7",
  7881. "middot": "\u00B7",
  7882. "minusb;": "\u229F",
  7883. "minus;": "\u2212",
  7884. "minusd;": "\u2238",
  7885. "minusdu;": "\u2A2A",
  7886. "MinusPlus;": "\u2213",
  7887. "mlcp;": "\u2ADB",
  7888. "mldr;": "\u2026",
  7889. "mnplus;": "\u2213",
  7890. "models;": "\u22A7",
  7891. "Mopf;": "\uD835\uDD44",
  7892. "mopf;": "\uD835\uDD5E",
  7893. "mp;": "\u2213",
  7894. "mscr;": "\uD835\uDCC2",
  7895. "Mscr;": "\u2133",
  7896. "mstpos;": "\u223E",
  7897. "Mu;": "\u039C",
  7898. "mu;": "\u03BC",
  7899. "multimap;": "\u22B8",
  7900. "mumap;": "\u22B8",
  7901. "nabla;": "\u2207",
  7902. "Nacute;": "\u0143",
  7903. "nacute;": "\u0144",
  7904. "nang;": "\u2220\u20D2",
  7905. "nap;": "\u2249",
  7906. "napE;": "\u2A70\u0338",
  7907. "napid;": "\u224B\u0338",
  7908. "napos;": "\u0149",
  7909. "napprox;": "\u2249",
  7910. "natural;": "\u266E",
  7911. "naturals;": "\u2115",
  7912. "natur;": "\u266E",
  7913. "nbsp;": "\u00A0",
  7914. "nbsp": "\u00A0",
  7915. "nbump;": "\u224E\u0338",
  7916. "nbumpe;": "\u224F\u0338",
  7917. "ncap;": "\u2A43",
  7918. "Ncaron;": "\u0147",
  7919. "ncaron;": "\u0148",
  7920. "Ncedil;": "\u0145",
  7921. "ncedil;": "\u0146",
  7922. "ncong;": "\u2247",
  7923. "ncongdot;": "\u2A6D\u0338",
  7924. "ncup;": "\u2A42",
  7925. "Ncy;": "\u041D",
  7926. "ncy;": "\u043D",
  7927. "ndash;": "\u2013",
  7928. "nearhk;": "\u2924",
  7929. "nearr;": "\u2197",
  7930. "neArr;": "\u21D7",
  7931. "nearrow;": "\u2197",
  7932. "ne;": "\u2260",
  7933. "nedot;": "\u2250\u0338",
  7934. "NegativeMediumSpace;": "\u200B",
  7935. "NegativeThickSpace;": "\u200B",
  7936. "NegativeThinSpace;": "\u200B",
  7937. "NegativeVeryThinSpace;": "\u200B",
  7938. "nequiv;": "\u2262",
  7939. "nesear;": "\u2928",
  7940. "nesim;": "\u2242\u0338",
  7941. "NestedGreaterGreater;": "\u226B",
  7942. "NestedLessLess;": "\u226A",
  7943. "NewLine;": "\u000A",
  7944. "nexist;": "\u2204",
  7945. "nexists;": "\u2204",
  7946. "Nfr;": "\uD835\uDD11",
  7947. "nfr;": "\uD835\uDD2B",
  7948. "ngE;": "\u2267\u0338",
  7949. "nge;": "\u2271",
  7950. "ngeq;": "\u2271",
  7951. "ngeqq;": "\u2267\u0338",
  7952. "ngeqslant;": "\u2A7E\u0338",
  7953. "nges;": "\u2A7E\u0338",
  7954. "nGg;": "\u22D9\u0338",
  7955. "ngsim;": "\u2275",
  7956. "nGt;": "\u226B\u20D2",
  7957. "ngt;": "\u226F",
  7958. "ngtr;": "\u226F",
  7959. "nGtv;": "\u226B\u0338",
  7960. "nharr;": "\u21AE",
  7961. "nhArr;": "\u21CE",
  7962. "nhpar;": "\u2AF2",
  7963. "ni;": "\u220B",
  7964. "nis;": "\u22FC",
  7965. "nisd;": "\u22FA",
  7966. "niv;": "\u220B",
  7967. "NJcy;": "\u040A",
  7968. "njcy;": "\u045A",
  7969. "nlarr;": "\u219A",
  7970. "nlArr;": "\u21CD",
  7971. "nldr;": "\u2025",
  7972. "nlE;": "\u2266\u0338",
  7973. "nle;": "\u2270",
  7974. "nleftarrow;": "\u219A",
  7975. "nLeftarrow;": "\u21CD",
  7976. "nleftrightarrow;": "\u21AE",
  7977. "nLeftrightarrow;": "\u21CE",
  7978. "nleq;": "\u2270",
  7979. "nleqq;": "\u2266\u0338",
  7980. "nleqslant;": "\u2A7D\u0338",
  7981. "nles;": "\u2A7D\u0338",
  7982. "nless;": "\u226E",
  7983. "nLl;": "\u22D8\u0338",
  7984. "nlsim;": "\u2274",
  7985. "nLt;": "\u226A\u20D2",
  7986. "nlt;": "\u226E",
  7987. "nltri;": "\u22EA",
  7988. "nltrie;": "\u22EC",
  7989. "nLtv;": "\u226A\u0338",
  7990. "nmid;": "\u2224",
  7991. "NoBreak;": "\u2060",
  7992. "NonBreakingSpace;": "\u00A0",
  7993. "nopf;": "\uD835\uDD5F",
  7994. "Nopf;": "\u2115",
  7995. "Not;": "\u2AEC",
  7996. "not;": "\u00AC",
  7997. "not": "\u00AC",
  7998. "NotCongruent;": "\u2262",
  7999. "NotCupCap;": "\u226D",
  8000. "NotDoubleVerticalBar;": "\u2226",
  8001. "NotElement;": "\u2209",
  8002. "NotEqual;": "\u2260",
  8003. "NotEqualTilde;": "\u2242\u0338",
  8004. "NotExists;": "\u2204",
  8005. "NotGreater;": "\u226F",
  8006. "NotGreaterEqual;": "\u2271",
  8007. "NotGreaterFullEqual;": "\u2267\u0338",
  8008. "NotGreaterGreater;": "\u226B\u0338",
  8009. "NotGreaterLess;": "\u2279",
  8010. "NotGreaterSlantEqual;": "\u2A7E\u0338",
  8011. "NotGreaterTilde;": "\u2275",
  8012. "NotHumpDownHump;": "\u224E\u0338",
  8013. "NotHumpEqual;": "\u224F\u0338",
  8014. "notin;": "\u2209",
  8015. "notindot;": "\u22F5\u0338",
  8016. "notinE;": "\u22F9\u0338",
  8017. "notinva;": "\u2209",
  8018. "notinvb;": "\u22F7",
  8019. "notinvc;": "\u22F6",
  8020. "NotLeftTriangleBar;": "\u29CF\u0338",
  8021. "NotLeftTriangle;": "\u22EA",
  8022. "NotLeftTriangleEqual;": "\u22EC",
  8023. "NotLess;": "\u226E",
  8024. "NotLessEqual;": "\u2270",
  8025. "NotLessGreater;": "\u2278",
  8026. "NotLessLess;": "\u226A\u0338",
  8027. "NotLessSlantEqual;": "\u2A7D\u0338",
  8028. "NotLessTilde;": "\u2274",
  8029. "NotNestedGreaterGreater;": "\u2AA2\u0338",
  8030. "NotNestedLessLess;": "\u2AA1\u0338",
  8031. "notni;": "\u220C",
  8032. "notniva;": "\u220C",
  8033. "notnivb;": "\u22FE",
  8034. "notnivc;": "\u22FD",
  8035. "NotPrecedes;": "\u2280",
  8036. "NotPrecedesEqual;": "\u2AAF\u0338",
  8037. "NotPrecedesSlantEqual;": "\u22E0",
  8038. "NotReverseElement;": "\u220C",
  8039. "NotRightTriangleBar;": "\u29D0\u0338",
  8040. "NotRightTriangle;": "\u22EB",
  8041. "NotRightTriangleEqual;": "\u22ED",
  8042. "NotSquareSubset;": "\u228F\u0338",
  8043. "NotSquareSubsetEqual;": "\u22E2",
  8044. "NotSquareSuperset;": "\u2290\u0338",
  8045. "NotSquareSupersetEqual;": "\u22E3",
  8046. "NotSubset;": "\u2282\u20D2",
  8047. "NotSubsetEqual;": "\u2288",
  8048. "NotSucceeds;": "\u2281",
  8049. "NotSucceedsEqual;": "\u2AB0\u0338",
  8050. "NotSucceedsSlantEqual;": "\u22E1",
  8051. "NotSucceedsTilde;": "\u227F\u0338",
  8052. "NotSuperset;": "\u2283\u20D2",
  8053. "NotSupersetEqual;": "\u2289",
  8054. "NotTilde;": "\u2241",
  8055. "NotTildeEqual;": "\u2244",
  8056. "NotTildeFullEqual;": "\u2247",
  8057. "NotTildeTilde;": "\u2249",
  8058. "NotVerticalBar;": "\u2224",
  8059. "nparallel;": "\u2226",
  8060. "npar;": "\u2226",
  8061. "nparsl;": "\u2AFD\u20E5",
  8062. "npart;": "\u2202\u0338",
  8063. "npolint;": "\u2A14",
  8064. "npr;": "\u2280",
  8065. "nprcue;": "\u22E0",
  8066. "nprec;": "\u2280",
  8067. "npreceq;": "\u2AAF\u0338",
  8068. "npre;": "\u2AAF\u0338",
  8069. "nrarrc;": "\u2933\u0338",
  8070. "nrarr;": "\u219B",
  8071. "nrArr;": "\u21CF",
  8072. "nrarrw;": "\u219D\u0338",
  8073. "nrightarrow;": "\u219B",
  8074. "nRightarrow;": "\u21CF",
  8075. "nrtri;": "\u22EB",
  8076. "nrtrie;": "\u22ED",
  8077. "nsc;": "\u2281",
  8078. "nsccue;": "\u22E1",
  8079. "nsce;": "\u2AB0\u0338",
  8080. "Nscr;": "\uD835\uDCA9",
  8081. "nscr;": "\uD835\uDCC3",
  8082. "nshortmid;": "\u2224",
  8083. "nshortparallel;": "\u2226",
  8084. "nsim;": "\u2241",
  8085. "nsime;": "\u2244",
  8086. "nsimeq;": "\u2244",
  8087. "nsmid;": "\u2224",
  8088. "nspar;": "\u2226",
  8089. "nsqsube;": "\u22E2",
  8090. "nsqsupe;": "\u22E3",
  8091. "nsub;": "\u2284",
  8092. "nsubE;": "\u2AC5\u0338",
  8093. "nsube;": "\u2288",
  8094. "nsubset;": "\u2282\u20D2",
  8095. "nsubseteq;": "\u2288",
  8096. "nsubseteqq;": "\u2AC5\u0338",
  8097. "nsucc;": "\u2281",
  8098. "nsucceq;": "\u2AB0\u0338",
  8099. "nsup;": "\u2285",
  8100. "nsupE;": "\u2AC6\u0338",
  8101. "nsupe;": "\u2289",
  8102. "nsupset;": "\u2283\u20D2",
  8103. "nsupseteq;": "\u2289",
  8104. "nsupseteqq;": "\u2AC6\u0338",
  8105. "ntgl;": "\u2279",
  8106. "Ntilde;": "\u00D1",
  8107. "Ntilde": "\u00D1",
  8108. "ntilde;": "\u00F1",
  8109. "ntilde": "\u00F1",
  8110. "ntlg;": "\u2278",
  8111. "ntriangleleft;": "\u22EA",
  8112. "ntrianglelefteq;": "\u22EC",
  8113. "ntriangleright;": "\u22EB",
  8114. "ntrianglerighteq;": "\u22ED",
  8115. "Nu;": "\u039D",
  8116. "nu;": "\u03BD",
  8117. "num;": "\u0023",
  8118. "numero;": "\u2116",
  8119. "numsp;": "\u2007",
  8120. "nvap;": "\u224D\u20D2",
  8121. "nvdash;": "\u22AC",
  8122. "nvDash;": "\u22AD",
  8123. "nVdash;": "\u22AE",
  8124. "nVDash;": "\u22AF",
  8125. "nvge;": "\u2265\u20D2",
  8126. "nvgt;": "\u003E\u20D2",
  8127. "nvHarr;": "\u2904",
  8128. "nvinfin;": "\u29DE",
  8129. "nvlArr;": "\u2902",
  8130. "nvle;": "\u2264\u20D2",
  8131. "nvlt;": "\u003C\u20D2",
  8132. "nvltrie;": "\u22B4\u20D2",
  8133. "nvrArr;": "\u2903",
  8134. "nvrtrie;": "\u22B5\u20D2",
  8135. "nvsim;": "\u223C\u20D2",
  8136. "nwarhk;": "\u2923",
  8137. "nwarr;": "\u2196",
  8138. "nwArr;": "\u21D6",
  8139. "nwarrow;": "\u2196",
  8140. "nwnear;": "\u2927",
  8141. "Oacute;": "\u00D3",
  8142. "Oacute": "\u00D3",
  8143. "oacute;": "\u00F3",
  8144. "oacute": "\u00F3",
  8145. "oast;": "\u229B",
  8146. "Ocirc;": "\u00D4",
  8147. "Ocirc": "\u00D4",
  8148. "ocirc;": "\u00F4",
  8149. "ocirc": "\u00F4",
  8150. "ocir;": "\u229A",
  8151. "Ocy;": "\u041E",
  8152. "ocy;": "\u043E",
  8153. "odash;": "\u229D",
  8154. "Odblac;": "\u0150",
  8155. "odblac;": "\u0151",
  8156. "odiv;": "\u2A38",
  8157. "odot;": "\u2299",
  8158. "odsold;": "\u29BC",
  8159. "OElig;": "\u0152",
  8160. "oelig;": "\u0153",
  8161. "ofcir;": "\u29BF",
  8162. "Ofr;": "\uD835\uDD12",
  8163. "ofr;": "\uD835\uDD2C",
  8164. "ogon;": "\u02DB",
  8165. "Ograve;": "\u00D2",
  8166. "Ograve": "\u00D2",
  8167. "ograve;": "\u00F2",
  8168. "ograve": "\u00F2",
  8169. "ogt;": "\u29C1",
  8170. "ohbar;": "\u29B5",
  8171. "ohm;": "\u03A9",
  8172. "oint;": "\u222E",
  8173. "olarr;": "\u21BA",
  8174. "olcir;": "\u29BE",
  8175. "olcross;": "\u29BB",
  8176. "oline;": "\u203E",
  8177. "olt;": "\u29C0",
  8178. "Omacr;": "\u014C",
  8179. "omacr;": "\u014D",
  8180. "Omega;": "\u03A9",
  8181. "omega;": "\u03C9",
  8182. "Omicron;": "\u039F",
  8183. "omicron;": "\u03BF",
  8184. "omid;": "\u29B6",
  8185. "ominus;": "\u2296",
  8186. "Oopf;": "\uD835\uDD46",
  8187. "oopf;": "\uD835\uDD60",
  8188. "opar;": "\u29B7",
  8189. "OpenCurlyDoubleQuote;": "\u201C",
  8190. "OpenCurlyQuote;": "\u2018",
  8191. "operp;": "\u29B9",
  8192. "oplus;": "\u2295",
  8193. "orarr;": "\u21BB",
  8194. "Or;": "\u2A54",
  8195. "or;": "\u2228",
  8196. "ord;": "\u2A5D",
  8197. "order;": "\u2134",
  8198. "orderof;": "\u2134",
  8199. "ordf;": "\u00AA",
  8200. "ordf": "\u00AA",
  8201. "ordm;": "\u00BA",
  8202. "ordm": "\u00BA",
  8203. "origof;": "\u22B6",
  8204. "oror;": "\u2A56",
  8205. "orslope;": "\u2A57",
  8206. "orv;": "\u2A5B",
  8207. "oS;": "\u24C8",
  8208. "Oscr;": "\uD835\uDCAA",
  8209. "oscr;": "\u2134",
  8210. "Oslash;": "\u00D8",
  8211. "Oslash": "\u00D8",
  8212. "oslash;": "\u00F8",
  8213. "oslash": "\u00F8",
  8214. "osol;": "\u2298",
  8215. "Otilde;": "\u00D5",
  8216. "Otilde": "\u00D5",
  8217. "otilde;": "\u00F5",
  8218. "otilde": "\u00F5",
  8219. "otimesas;": "\u2A36",
  8220. "Otimes;": "\u2A37",
  8221. "otimes;": "\u2297",
  8222. "Ouml;": "\u00D6",
  8223. "Ouml": "\u00D6",
  8224. "ouml;": "\u00F6",
  8225. "ouml": "\u00F6",
  8226. "ovbar;": "\u233D",
  8227. "OverBar;": "\u203E",
  8228. "OverBrace;": "\u23DE",
  8229. "OverBracket;": "\u23B4",
  8230. "OverParenthesis;": "\u23DC",
  8231. "para;": "\u00B6",
  8232. "para": "\u00B6",
  8233. "parallel;": "\u2225",
  8234. "par;": "\u2225",
  8235. "parsim;": "\u2AF3",
  8236. "parsl;": "\u2AFD",
  8237. "part;": "\u2202",
  8238. "PartialD;": "\u2202",
  8239. "Pcy;": "\u041F",
  8240. "pcy;": "\u043F",
  8241. "percnt;": "\u0025",
  8242. "period;": "\u002E",
  8243. "permil;": "\u2030",
  8244. "perp;": "\u22A5",
  8245. "pertenk;": "\u2031",
  8246. "Pfr;": "\uD835\uDD13",
  8247. "pfr;": "\uD835\uDD2D",
  8248. "Phi;": "\u03A6",
  8249. "phi;": "\u03C6",
  8250. "phiv;": "\u03D5",
  8251. "phmmat;": "\u2133",
  8252. "phone;": "\u260E",
  8253. "Pi;": "\u03A0",
  8254. "pi;": "\u03C0",
  8255. "pitchfork;": "\u22D4",
  8256. "piv;": "\u03D6",
  8257. "planck;": "\u210F",
  8258. "planckh;": "\u210E",
  8259. "plankv;": "\u210F",
  8260. "plusacir;": "\u2A23",
  8261. "plusb;": "\u229E",
  8262. "pluscir;": "\u2A22",
  8263. "plus;": "\u002B",
  8264. "plusdo;": "\u2214",
  8265. "plusdu;": "\u2A25",
  8266. "pluse;": "\u2A72",
  8267. "PlusMinus;": "\u00B1",
  8268. "plusmn;": "\u00B1",
  8269. "plusmn": "\u00B1",
  8270. "plussim;": "\u2A26",
  8271. "plustwo;": "\u2A27",
  8272. "pm;": "\u00B1",
  8273. "Poincareplane;": "\u210C",
  8274. "pointint;": "\u2A15",
  8275. "popf;": "\uD835\uDD61",
  8276. "Popf;": "\u2119",
  8277. "pound;": "\u00A3",
  8278. "pound": "\u00A3",
  8279. "prap;": "\u2AB7",
  8280. "Pr;": "\u2ABB",
  8281. "pr;": "\u227A",
  8282. "prcue;": "\u227C",
  8283. "precapprox;": "\u2AB7",
  8284. "prec;": "\u227A",
  8285. "preccurlyeq;": "\u227C",
  8286. "Precedes;": "\u227A",
  8287. "PrecedesEqual;": "\u2AAF",
  8288. "PrecedesSlantEqual;": "\u227C",
  8289. "PrecedesTilde;": "\u227E",
  8290. "preceq;": "\u2AAF",
  8291. "precnapprox;": "\u2AB9",
  8292. "precneqq;": "\u2AB5",
  8293. "precnsim;": "\u22E8",
  8294. "pre;": "\u2AAF",
  8295. "prE;": "\u2AB3",
  8296. "precsim;": "\u227E",
  8297. "prime;": "\u2032",
  8298. "Prime;": "\u2033",
  8299. "primes;": "\u2119",
  8300. "prnap;": "\u2AB9",
  8301. "prnE;": "\u2AB5",
  8302. "prnsim;": "\u22E8",
  8303. "prod;": "\u220F",
  8304. "Product;": "\u220F",
  8305. "profalar;": "\u232E",
  8306. "profline;": "\u2312",
  8307. "profsurf;": "\u2313",
  8308. "prop;": "\u221D",
  8309. "Proportional;": "\u221D",
  8310. "Proportion;": "\u2237",
  8311. "propto;": "\u221D",
  8312. "prsim;": "\u227E",
  8313. "prurel;": "\u22B0",
  8314. "Pscr;": "\uD835\uDCAB",
  8315. "pscr;": "\uD835\uDCC5",
  8316. "Psi;": "\u03A8",
  8317. "psi;": "\u03C8",
  8318. "puncsp;": "\u2008",
  8319. "Qfr;": "\uD835\uDD14",
  8320. "qfr;": "\uD835\uDD2E",
  8321. "qint;": "\u2A0C",
  8322. "qopf;": "\uD835\uDD62",
  8323. "Qopf;": "\u211A",
  8324. "qprime;": "\u2057",
  8325. "Qscr;": "\uD835\uDCAC",
  8326. "qscr;": "\uD835\uDCC6",
  8327. "quaternions;": "\u210D",
  8328. "quatint;": "\u2A16",
  8329. "quest;": "\u003F",
  8330. "questeq;": "\u225F",
  8331. "quot;": "\u0022",
  8332. "quot": "\u0022",
  8333. "QUOT;": "\u0022",
  8334. "QUOT": "\u0022",
  8335. "rAarr;": "\u21DB",
  8336. "race;": "\u223D\u0331",
  8337. "Racute;": "\u0154",
  8338. "racute;": "\u0155",
  8339. "radic;": "\u221A",
  8340. "raemptyv;": "\u29B3",
  8341. "rang;": "\u27E9",
  8342. "Rang;": "\u27EB",
  8343. "rangd;": "\u2992",
  8344. "range;": "\u29A5",
  8345. "rangle;": "\u27E9",
  8346. "raquo;": "\u00BB",
  8347. "raquo": "\u00BB",
  8348. "rarrap;": "\u2975",
  8349. "rarrb;": "\u21E5",
  8350. "rarrbfs;": "\u2920",
  8351. "rarrc;": "\u2933",
  8352. "rarr;": "\u2192",
  8353. "Rarr;": "\u21A0",
  8354. "rArr;": "\u21D2",
  8355. "rarrfs;": "\u291E",
  8356. "rarrhk;": "\u21AA",
  8357. "rarrlp;": "\u21AC",
  8358. "rarrpl;": "\u2945",
  8359. "rarrsim;": "\u2974",
  8360. "Rarrtl;": "\u2916",
  8361. "rarrtl;": "\u21A3",
  8362. "rarrw;": "\u219D",
  8363. "ratail;": "\u291A",
  8364. "rAtail;": "\u291C",
  8365. "ratio;": "\u2236",
  8366. "rationals;": "\u211A",
  8367. "rbarr;": "\u290D",
  8368. "rBarr;": "\u290F",
  8369. "RBarr;": "\u2910",
  8370. "rbbrk;": "\u2773",
  8371. "rbrace;": "\u007D",
  8372. "rbrack;": "\u005D",
  8373. "rbrke;": "\u298C",
  8374. "rbrksld;": "\u298E",
  8375. "rbrkslu;": "\u2990",
  8376. "Rcaron;": "\u0158",
  8377. "rcaron;": "\u0159",
  8378. "Rcedil;": "\u0156",
  8379. "rcedil;": "\u0157",
  8380. "rceil;": "\u2309",
  8381. "rcub;": "\u007D",
  8382. "Rcy;": "\u0420",
  8383. "rcy;": "\u0440",
  8384. "rdca;": "\u2937",
  8385. "rdldhar;": "\u2969",
  8386. "rdquo;": "\u201D",
  8387. "rdquor;": "\u201D",
  8388. "rdsh;": "\u21B3",
  8389. "real;": "\u211C",
  8390. "realine;": "\u211B",
  8391. "realpart;": "\u211C",
  8392. "reals;": "\u211D",
  8393. "Re;": "\u211C",
  8394. "rect;": "\u25AD",
  8395. "reg;": "\u00AE",
  8396. "reg": "\u00AE",
  8397. "REG;": "\u00AE",
  8398. "REG": "\u00AE",
  8399. "ReverseElement;": "\u220B",
  8400. "ReverseEquilibrium;": "\u21CB",
  8401. "ReverseUpEquilibrium;": "\u296F",
  8402. "rfisht;": "\u297D",
  8403. "rfloor;": "\u230B",
  8404. "rfr;": "\uD835\uDD2F",
  8405. "Rfr;": "\u211C",
  8406. "rHar;": "\u2964",
  8407. "rhard;": "\u21C1",
  8408. "rharu;": "\u21C0",
  8409. "rharul;": "\u296C",
  8410. "Rho;": "\u03A1",
  8411. "rho;": "\u03C1",
  8412. "rhov;": "\u03F1",
  8413. "RightAngleBracket;": "\u27E9",
  8414. "RightArrowBar;": "\u21E5",
  8415. "rightarrow;": "\u2192",
  8416. "RightArrow;": "\u2192",
  8417. "Rightarrow;": "\u21D2",
  8418. "RightArrowLeftArrow;": "\u21C4",
  8419. "rightarrowtail;": "\u21A3",
  8420. "RightCeiling;": "\u2309",
  8421. "RightDoubleBracket;": "\u27E7",
  8422. "RightDownTeeVector;": "\u295D",
  8423. "RightDownVectorBar;": "\u2955",
  8424. "RightDownVector;": "\u21C2",
  8425. "RightFloor;": "\u230B",
  8426. "rightharpoondown;": "\u21C1",
  8427. "rightharpoonup;": "\u21C0",
  8428. "rightleftarrows;": "\u21C4",
  8429. "rightleftharpoons;": "\u21CC",
  8430. "rightrightarrows;": "\u21C9",
  8431. "rightsquigarrow;": "\u219D",
  8432. "RightTeeArrow;": "\u21A6",
  8433. "RightTee;": "\u22A2",
  8434. "RightTeeVector;": "\u295B",
  8435. "rightthreetimes;": "\u22CC",
  8436. "RightTriangleBar;": "\u29D0",
  8437. "RightTriangle;": "\u22B3",
  8438. "RightTriangleEqual;": "\u22B5",
  8439. "RightUpDownVector;": "\u294F",
  8440. "RightUpTeeVector;": "\u295C",
  8441. "RightUpVectorBar;": "\u2954",
  8442. "RightUpVector;": "\u21BE",
  8443. "RightVectorBar;": "\u2953",
  8444. "RightVector;": "\u21C0",
  8445. "ring;": "\u02DA",
  8446. "risingdotseq;": "\u2253",
  8447. "rlarr;": "\u21C4",
  8448. "rlhar;": "\u21CC",
  8449. "rlm;": "\u200F",
  8450. "rmoustache;": "\u23B1",
  8451. "rmoust;": "\u23B1",
  8452. "rnmid;": "\u2AEE",
  8453. "roang;": "\u27ED",
  8454. "roarr;": "\u21FE",
  8455. "robrk;": "\u27E7",
  8456. "ropar;": "\u2986",
  8457. "ropf;": "\uD835\uDD63",
  8458. "Ropf;": "\u211D",
  8459. "roplus;": "\u2A2E",
  8460. "rotimes;": "\u2A35",
  8461. "RoundImplies;": "\u2970",
  8462. "rpar;": "\u0029",
  8463. "rpargt;": "\u2994",
  8464. "rppolint;": "\u2A12",
  8465. "rrarr;": "\u21C9",
  8466. "Rrightarrow;": "\u21DB",
  8467. "rsaquo;": "\u203A",
  8468. "rscr;": "\uD835\uDCC7",
  8469. "Rscr;": "\u211B",
  8470. "rsh;": "\u21B1",
  8471. "Rsh;": "\u21B1",
  8472. "rsqb;": "\u005D",
  8473. "rsquo;": "\u2019",
  8474. "rsquor;": "\u2019",
  8475. "rthree;": "\u22CC",
  8476. "rtimes;": "\u22CA",
  8477. "rtri;": "\u25B9",
  8478. "rtrie;": "\u22B5",
  8479. "rtrif;": "\u25B8",
  8480. "rtriltri;": "\u29CE",
  8481. "RuleDelayed;": "\u29F4",
  8482. "ruluhar;": "\u2968",
  8483. "rx;": "\u211E",
  8484. "Sacute;": "\u015A",
  8485. "sacute;": "\u015B",
  8486. "sbquo;": "\u201A",
  8487. "scap;": "\u2AB8",
  8488. "Scaron;": "\u0160",
  8489. "scaron;": "\u0161",
  8490. "Sc;": "\u2ABC",
  8491. "sc;": "\u227B",
  8492. "sccue;": "\u227D",
  8493. "sce;": "\u2AB0",
  8494. "scE;": "\u2AB4",
  8495. "Scedil;": "\u015E",
  8496. "scedil;": "\u015F",
  8497. "Scirc;": "\u015C",
  8498. "scirc;": "\u015D",
  8499. "scnap;": "\u2ABA",
  8500. "scnE;": "\u2AB6",
  8501. "scnsim;": "\u22E9",
  8502. "scpolint;": "\u2A13",
  8503. "scsim;": "\u227F",
  8504. "Scy;": "\u0421",
  8505. "scy;": "\u0441",
  8506. "sdotb;": "\u22A1",
  8507. "sdot;": "\u22C5",
  8508. "sdote;": "\u2A66",
  8509. "searhk;": "\u2925",
  8510. "searr;": "\u2198",
  8511. "seArr;": "\u21D8",
  8512. "searrow;": "\u2198",
  8513. "sect;": "\u00A7",
  8514. "sect": "\u00A7",
  8515. "semi;": "\u003B",
  8516. "seswar;": "\u2929",
  8517. "setminus;": "\u2216",
  8518. "setmn;": "\u2216",
  8519. "sext;": "\u2736",
  8520. "Sfr;": "\uD835\uDD16",
  8521. "sfr;": "\uD835\uDD30",
  8522. "sfrown;": "\u2322",
  8523. "sharp;": "\u266F",
  8524. "SHCHcy;": "\u0429",
  8525. "shchcy;": "\u0449",
  8526. "SHcy;": "\u0428",
  8527. "shcy;": "\u0448",
  8528. "ShortDownArrow;": "\u2193",
  8529. "ShortLeftArrow;": "\u2190",
  8530. "shortmid;": "\u2223",
  8531. "shortparallel;": "\u2225",
  8532. "ShortRightArrow;": "\u2192",
  8533. "ShortUpArrow;": "\u2191",
  8534. "shy;": "\u00AD",
  8535. "shy": "\u00AD",
  8536. "Sigma;": "\u03A3",
  8537. "sigma;": "\u03C3",
  8538. "sigmaf;": "\u03C2",
  8539. "sigmav;": "\u03C2",
  8540. "sim;": "\u223C",
  8541. "simdot;": "\u2A6A",
  8542. "sime;": "\u2243",
  8543. "simeq;": "\u2243",
  8544. "simg;": "\u2A9E",
  8545. "simgE;": "\u2AA0",
  8546. "siml;": "\u2A9D",
  8547. "simlE;": "\u2A9F",
  8548. "simne;": "\u2246",
  8549. "simplus;": "\u2A24",
  8550. "simrarr;": "\u2972",
  8551. "slarr;": "\u2190",
  8552. "SmallCircle;": "\u2218",
  8553. "smallsetminus;": "\u2216",
  8554. "smashp;": "\u2A33",
  8555. "smeparsl;": "\u29E4",
  8556. "smid;": "\u2223",
  8557. "smile;": "\u2323",
  8558. "smt;": "\u2AAA",
  8559. "smte;": "\u2AAC",
  8560. "smtes;": "\u2AAC\uFE00",
  8561. "SOFTcy;": "\u042C",
  8562. "softcy;": "\u044C",
  8563. "solbar;": "\u233F",
  8564. "solb;": "\u29C4",
  8565. "sol;": "\u002F",
  8566. "Sopf;": "\uD835\uDD4A",
  8567. "sopf;": "\uD835\uDD64",
  8568. "spades;": "\u2660",
  8569. "spadesuit;": "\u2660",
  8570. "spar;": "\u2225",
  8571. "sqcap;": "\u2293",
  8572. "sqcaps;": "\u2293\uFE00",
  8573. "sqcup;": "\u2294",
  8574. "sqcups;": "\u2294\uFE00",
  8575. "Sqrt;": "\u221A",
  8576. "sqsub;": "\u228F",
  8577. "sqsube;": "\u2291",
  8578. "sqsubset;": "\u228F",
  8579. "sqsubseteq;": "\u2291",
  8580. "sqsup;": "\u2290",
  8581. "sqsupe;": "\u2292",
  8582. "sqsupset;": "\u2290",
  8583. "sqsupseteq;": "\u2292",
  8584. "square;": "\u25A1",
  8585. "Square;": "\u25A1",
  8586. "SquareIntersection;": "\u2293",
  8587. "SquareSubset;": "\u228F",
  8588. "SquareSubsetEqual;": "\u2291",
  8589. "SquareSuperset;": "\u2290",
  8590. "SquareSupersetEqual;": "\u2292",
  8591. "SquareUnion;": "\u2294",
  8592. "squarf;": "\u25AA",
  8593. "squ;": "\u25A1",
  8594. "squf;": "\u25AA",
  8595. "srarr;": "\u2192",
  8596. "Sscr;": "\uD835\uDCAE",
  8597. "sscr;": "\uD835\uDCC8",
  8598. "ssetmn;": "\u2216",
  8599. "ssmile;": "\u2323",
  8600. "sstarf;": "\u22C6",
  8601. "Star;": "\u22C6",
  8602. "star;": "\u2606",
  8603. "starf;": "\u2605",
  8604. "straightepsilon;": "\u03F5",
  8605. "straightphi;": "\u03D5",
  8606. "strns;": "\u00AF",
  8607. "sub;": "\u2282",
  8608. "Sub;": "\u22D0",
  8609. "subdot;": "\u2ABD",
  8610. "subE;": "\u2AC5",
  8611. "sube;": "\u2286",
  8612. "subedot;": "\u2AC3",
  8613. "submult;": "\u2AC1",
  8614. "subnE;": "\u2ACB",
  8615. "subne;": "\u228A",
  8616. "subplus;": "\u2ABF",
  8617. "subrarr;": "\u2979",
  8618. "subset;": "\u2282",
  8619. "Subset;": "\u22D0",
  8620. "subseteq;": "\u2286",
  8621. "subseteqq;": "\u2AC5",
  8622. "SubsetEqual;": "\u2286",
  8623. "subsetneq;": "\u228A",
  8624. "subsetneqq;": "\u2ACB",
  8625. "subsim;": "\u2AC7",
  8626. "subsub;": "\u2AD5",
  8627. "subsup;": "\u2AD3",
  8628. "succapprox;": "\u2AB8",
  8629. "succ;": "\u227B",
  8630. "succcurlyeq;": "\u227D",
  8631. "Succeeds;": "\u227B",
  8632. "SucceedsEqual;": "\u2AB0",
  8633. "SucceedsSlantEqual;": "\u227D",
  8634. "SucceedsTilde;": "\u227F",
  8635. "succeq;": "\u2AB0",
  8636. "succnapprox;": "\u2ABA",
  8637. "succneqq;": "\u2AB6",
  8638. "succnsim;": "\u22E9",
  8639. "succsim;": "\u227F",
  8640. "SuchThat;": "\u220B",
  8641. "sum;": "\u2211",
  8642. "Sum;": "\u2211",
  8643. "sung;": "\u266A",
  8644. "sup1;": "\u00B9",
  8645. "sup1": "\u00B9",
  8646. "sup2;": "\u00B2",
  8647. "sup2": "\u00B2",
  8648. "sup3;": "\u00B3",
  8649. "sup3": "\u00B3",
  8650. "sup;": "\u2283",
  8651. "Sup;": "\u22D1",
  8652. "supdot;": "\u2ABE",
  8653. "supdsub;": "\u2AD8",
  8654. "supE;": "\u2AC6",
  8655. "supe;": "\u2287",
  8656. "supedot;": "\u2AC4",
  8657. "Superset;": "\u2283",
  8658. "SupersetEqual;": "\u2287",
  8659. "suphsol;": "\u27C9",
  8660. "suphsub;": "\u2AD7",
  8661. "suplarr;": "\u297B",
  8662. "supmult;": "\u2AC2",
  8663. "supnE;": "\u2ACC",
  8664. "supne;": "\u228B",
  8665. "supplus;": "\u2AC0",
  8666. "supset;": "\u2283",
  8667. "Supset;": "\u22D1",
  8668. "supseteq;": "\u2287",
  8669. "supseteqq;": "\u2AC6",
  8670. "supsetneq;": "\u228B",
  8671. "supsetneqq;": "\u2ACC",
  8672. "supsim;": "\u2AC8",
  8673. "supsub;": "\u2AD4",
  8674. "supsup;": "\u2AD6",
  8675. "swarhk;": "\u2926",
  8676. "swarr;": "\u2199",
  8677. "swArr;": "\u21D9",
  8678. "swarrow;": "\u2199",
  8679. "swnwar;": "\u292A",
  8680. "szlig;": "\u00DF",
  8681. "szlig": "\u00DF",
  8682. "Tab;": "\u0009",
  8683. "target;": "\u2316",
  8684. "Tau;": "\u03A4",
  8685. "tau;": "\u03C4",
  8686. "tbrk;": "\u23B4",
  8687. "Tcaron;": "\u0164",
  8688. "tcaron;": "\u0165",
  8689. "Tcedil;": "\u0162",
  8690. "tcedil;": "\u0163",
  8691. "Tcy;": "\u0422",
  8692. "tcy;": "\u0442",
  8693. "tdot;": "\u20DB",
  8694. "telrec;": "\u2315",
  8695. "Tfr;": "\uD835\uDD17",
  8696. "tfr;": "\uD835\uDD31",
  8697. "there4;": "\u2234",
  8698. "therefore;": "\u2234",
  8699. "Therefore;": "\u2234",
  8700. "Theta;": "\u0398",
  8701. "theta;": "\u03B8",
  8702. "thetasym;": "\u03D1",
  8703. "thetav;": "\u03D1",
  8704. "thickapprox;": "\u2248",
  8705. "thicksim;": "\u223C",
  8706. "ThickSpace;": "\u205F\u200A",
  8707. "ThinSpace;": "\u2009",
  8708. "thinsp;": "\u2009",
  8709. "thkap;": "\u2248",
  8710. "thksim;": "\u223C",
  8711. "THORN;": "\u00DE",
  8712. "THORN": "\u00DE",
  8713. "thorn;": "\u00FE",
  8714. "thorn": "\u00FE",
  8715. "tilde;": "\u02DC",
  8716. "Tilde;": "\u223C",
  8717. "TildeEqual;": "\u2243",
  8718. "TildeFullEqual;": "\u2245",
  8719. "TildeTilde;": "\u2248",
  8720. "timesbar;": "\u2A31",
  8721. "timesb;": "\u22A0",
  8722. "times;": "\u00D7",
  8723. "times": "\u00D7",
  8724. "timesd;": "\u2A30",
  8725. "tint;": "\u222D",
  8726. "toea;": "\u2928",
  8727. "topbot;": "\u2336",
  8728. "topcir;": "\u2AF1",
  8729. "top;": "\u22A4",
  8730. "Topf;": "\uD835\uDD4B",
  8731. "topf;": "\uD835\uDD65",
  8732. "topfork;": "\u2ADA",
  8733. "tosa;": "\u2929",
  8734. "tprime;": "\u2034",
  8735. "trade;": "\u2122",
  8736. "TRADE;": "\u2122",
  8737. "triangle;": "\u25B5",
  8738. "triangledown;": "\u25BF",
  8739. "triangleleft;": "\u25C3",
  8740. "trianglelefteq;": "\u22B4",
  8741. "triangleq;": "\u225C",
  8742. "triangleright;": "\u25B9",
  8743. "trianglerighteq;": "\u22B5",
  8744. "tridot;": "\u25EC",
  8745. "trie;": "\u225C",
  8746. "triminus;": "\u2A3A",
  8747. "TripleDot;": "\u20DB",
  8748. "triplus;": "\u2A39",
  8749. "trisb;": "\u29CD",
  8750. "tritime;": "\u2A3B",
  8751. "trpezium;": "\u23E2",
  8752. "Tscr;": "\uD835\uDCAF",
  8753. "tscr;": "\uD835\uDCC9",
  8754. "TScy;": "\u0426",
  8755. "tscy;": "\u0446",
  8756. "TSHcy;": "\u040B",
  8757. "tshcy;": "\u045B",
  8758. "Tstrok;": "\u0166",
  8759. "tstrok;": "\u0167",
  8760. "twixt;": "\u226C",
  8761. "twoheadleftarrow;": "\u219E",
  8762. "twoheadrightarrow;": "\u21A0",
  8763. "Uacute;": "\u00DA",
  8764. "Uacute": "\u00DA",
  8765. "uacute;": "\u00FA",
  8766. "uacute": "\u00FA",
  8767. "uarr;": "\u2191",
  8768. "Uarr;": "\u219F",
  8769. "uArr;": "\u21D1",
  8770. "Uarrocir;": "\u2949",
  8771. "Ubrcy;": "\u040E",
  8772. "ubrcy;": "\u045E",
  8773. "Ubreve;": "\u016C",
  8774. "ubreve;": "\u016D",
  8775. "Ucirc;": "\u00DB",
  8776. "Ucirc": "\u00DB",
  8777. "ucirc;": "\u00FB",
  8778. "ucirc": "\u00FB",
  8779. "Ucy;": "\u0423",
  8780. "ucy;": "\u0443",
  8781. "udarr;": "\u21C5",
  8782. "Udblac;": "\u0170",
  8783. "udblac;": "\u0171",
  8784. "udhar;": "\u296E",
  8785. "ufisht;": "\u297E",
  8786. "Ufr;": "\uD835\uDD18",
  8787. "ufr;": "\uD835\uDD32",
  8788. "Ugrave;": "\u00D9",
  8789. "Ugrave": "\u00D9",
  8790. "ugrave;": "\u00F9",
  8791. "ugrave": "\u00F9",
  8792. "uHar;": "\u2963",
  8793. "uharl;": "\u21BF",
  8794. "uharr;": "\u21BE",
  8795. "uhblk;": "\u2580",
  8796. "ulcorn;": "\u231C",
  8797. "ulcorner;": "\u231C",
  8798. "ulcrop;": "\u230F",
  8799. "ultri;": "\u25F8",
  8800. "Umacr;": "\u016A",
  8801. "umacr;": "\u016B",
  8802. "uml;": "\u00A8",
  8803. "uml": "\u00A8",
  8804. "UnderBar;": "\u005F",
  8805. "UnderBrace;": "\u23DF",
  8806. "UnderBracket;": "\u23B5",
  8807. "UnderParenthesis;": "\u23DD",
  8808. "Union;": "\u22C3",
  8809. "UnionPlus;": "\u228E",
  8810. "Uogon;": "\u0172",
  8811. "uogon;": "\u0173",
  8812. "Uopf;": "\uD835\uDD4C",
  8813. "uopf;": "\uD835\uDD66",
  8814. "UpArrowBar;": "\u2912",
  8815. "uparrow;": "\u2191",
  8816. "UpArrow;": "\u2191",
  8817. "Uparrow;": "\u21D1",
  8818. "UpArrowDownArrow;": "\u21C5",
  8819. "updownarrow;": "\u2195",
  8820. "UpDownArrow;": "\u2195",
  8821. "Updownarrow;": "\u21D5",
  8822. "UpEquilibrium;": "\u296E",
  8823. "upharpoonleft;": "\u21BF",
  8824. "upharpoonright;": "\u21BE",
  8825. "uplus;": "\u228E",
  8826. "UpperLeftArrow;": "\u2196",
  8827. "UpperRightArrow;": "\u2197",
  8828. "upsi;": "\u03C5",
  8829. "Upsi;": "\u03D2",
  8830. "upsih;": "\u03D2",
  8831. "Upsilon;": "\u03A5",
  8832. "upsilon;": "\u03C5",
  8833. "UpTeeArrow;": "\u21A5",
  8834. "UpTee;": "\u22A5",
  8835. "upuparrows;": "\u21C8",
  8836. "urcorn;": "\u231D",
  8837. "urcorner;": "\u231D",
  8838. "urcrop;": "\u230E",
  8839. "Uring;": "\u016E",
  8840. "uring;": "\u016F",
  8841. "urtri;": "\u25F9",
  8842. "Uscr;": "\uD835\uDCB0",
  8843. "uscr;": "\uD835\uDCCA",
  8844. "utdot;": "\u22F0",
  8845. "Utilde;": "\u0168",
  8846. "utilde;": "\u0169",
  8847. "utri;": "\u25B5",
  8848. "utrif;": "\u25B4",
  8849. "uuarr;": "\u21C8",
  8850. "Uuml;": "\u00DC",
  8851. "Uuml": "\u00DC",
  8852. "uuml;": "\u00FC",
  8853. "uuml": "\u00FC",
  8854. "uwangle;": "\u29A7",
  8855. "vangrt;": "\u299C",
  8856. "varepsilon;": "\u03F5",
  8857. "varkappa;": "\u03F0",
  8858. "varnothing;": "\u2205",
  8859. "varphi;": "\u03D5",
  8860. "varpi;": "\u03D6",
  8861. "varpropto;": "\u221D",
  8862. "varr;": "\u2195",
  8863. "vArr;": "\u21D5",
  8864. "varrho;": "\u03F1",
  8865. "varsigma;": "\u03C2",
  8866. "varsubsetneq;": "\u228A\uFE00",
  8867. "varsubsetneqq;": "\u2ACB\uFE00",
  8868. "varsupsetneq;": "\u228B\uFE00",
  8869. "varsupsetneqq;": "\u2ACC\uFE00",
  8870. "vartheta;": "\u03D1",
  8871. "vartriangleleft;": "\u22B2",
  8872. "vartriangleright;": "\u22B3",
  8873. "vBar;": "\u2AE8",
  8874. "Vbar;": "\u2AEB",
  8875. "vBarv;": "\u2AE9",
  8876. "Vcy;": "\u0412",
  8877. "vcy;": "\u0432",
  8878. "vdash;": "\u22A2",
  8879. "vDash;": "\u22A8",
  8880. "Vdash;": "\u22A9",
  8881. "VDash;": "\u22AB",
  8882. "Vdashl;": "\u2AE6",
  8883. "veebar;": "\u22BB",
  8884. "vee;": "\u2228",
  8885. "Vee;": "\u22C1",
  8886. "veeeq;": "\u225A",
  8887. "vellip;": "\u22EE",
  8888. "verbar;": "\u007C",
  8889. "Verbar;": "\u2016",
  8890. "vert;": "\u007C",
  8891. "Vert;": "\u2016",
  8892. "VerticalBar;": "\u2223",
  8893. "VerticalLine;": "\u007C",
  8894. "VerticalSeparator;": "\u2758",
  8895. "VerticalTilde;": "\u2240",
  8896. "VeryThinSpace;": "\u200A",
  8897. "Vfr;": "\uD835\uDD19",
  8898. "vfr;": "\uD835\uDD33",
  8899. "vltri;": "\u22B2",
  8900. "vnsub;": "\u2282\u20D2",
  8901. "vnsup;": "\u2283\u20D2",
  8902. "Vopf;": "\uD835\uDD4D",
  8903. "vopf;": "\uD835\uDD67",
  8904. "vprop;": "\u221D",
  8905. "vrtri;": "\u22B3",
  8906. "Vscr;": "\uD835\uDCB1",
  8907. "vscr;": "\uD835\uDCCB",
  8908. "vsubnE;": "\u2ACB\uFE00",
  8909. "vsubne;": "\u228A\uFE00",
  8910. "vsupnE;": "\u2ACC\uFE00",
  8911. "vsupne;": "\u228B\uFE00",
  8912. "Vvdash;": "\u22AA",
  8913. "vzigzag;": "\u299A",
  8914. "Wcirc;": "\u0174",
  8915. "wcirc;": "\u0175",
  8916. "wedbar;": "\u2A5F",
  8917. "wedge;": "\u2227",
  8918. "Wedge;": "\u22C0",
  8919. "wedgeq;": "\u2259",
  8920. "weierp;": "\u2118",
  8921. "Wfr;": "\uD835\uDD1A",
  8922. "wfr;": "\uD835\uDD34",
  8923. "Wopf;": "\uD835\uDD4E",
  8924. "wopf;": "\uD835\uDD68",
  8925. "wp;": "\u2118",
  8926. "wr;": "\u2240",
  8927. "wreath;": "\u2240",
  8928. "Wscr;": "\uD835\uDCB2",
  8929. "wscr;": "\uD835\uDCCC",
  8930. "xcap;": "\u22C2",
  8931. "xcirc;": "\u25EF",
  8932. "xcup;": "\u22C3",
  8933. "xdtri;": "\u25BD",
  8934. "Xfr;": "\uD835\uDD1B",
  8935. "xfr;": "\uD835\uDD35",
  8936. "xharr;": "\u27F7",
  8937. "xhArr;": "\u27FA",
  8938. "Xi;": "\u039E",
  8939. "xi;": "\u03BE",
  8940. "xlarr;": "\u27F5",
  8941. "xlArr;": "\u27F8",
  8942. "xmap;": "\u27FC",
  8943. "xnis;": "\u22FB",
  8944. "xodot;": "\u2A00",
  8945. "Xopf;": "\uD835\uDD4F",
  8946. "xopf;": "\uD835\uDD69",
  8947. "xoplus;": "\u2A01",
  8948. "xotime;": "\u2A02",
  8949. "xrarr;": "\u27F6",
  8950. "xrArr;": "\u27F9",
  8951. "Xscr;": "\uD835\uDCB3",
  8952. "xscr;": "\uD835\uDCCD",
  8953. "xsqcup;": "\u2A06",
  8954. "xuplus;": "\u2A04",
  8955. "xutri;": "\u25B3",
  8956. "xvee;": "\u22C1",
  8957. "xwedge;": "\u22C0",
  8958. "Yacute;": "\u00DD",
  8959. "Yacute": "\u00DD",
  8960. "yacute;": "\u00FD",
  8961. "yacute": "\u00FD",
  8962. "YAcy;": "\u042F",
  8963. "yacy;": "\u044F",
  8964. "Ycirc;": "\u0176",
  8965. "ycirc;": "\u0177",
  8966. "Ycy;": "\u042B",
  8967. "ycy;": "\u044B",
  8968. "yen;": "\u00A5",
  8969. "yen": "\u00A5",
  8970. "Yfr;": "\uD835\uDD1C",
  8971. "yfr;": "\uD835\uDD36",
  8972. "YIcy;": "\u0407",
  8973. "yicy;": "\u0457",
  8974. "Yopf;": "\uD835\uDD50",
  8975. "yopf;": "\uD835\uDD6A",
  8976. "Yscr;": "\uD835\uDCB4",
  8977. "yscr;": "\uD835\uDCCE",
  8978. "YUcy;": "\u042E",
  8979. "yucy;": "\u044E",
  8980. "yuml;": "\u00FF",
  8981. "yuml": "\u00FF",
  8982. "Yuml;": "\u0178",
  8983. "Zacute;": "\u0179",
  8984. "zacute;": "\u017A",
  8985. "Zcaron;": "\u017D",
  8986. "zcaron;": "\u017E",
  8987. "Zcy;": "\u0417",
  8988. "zcy;": "\u0437",
  8989. "Zdot;": "\u017B",
  8990. "zdot;": "\u017C",
  8991. "zeetrf;": "\u2128",
  8992. "ZeroWidthSpace;": "\u200B",
  8993. "Zeta;": "\u0396",
  8994. "zeta;": "\u03B6",
  8995. "zfr;": "\uD835\uDD37",
  8996. "Zfr;": "\u2128",
  8997. "ZHcy;": "\u0416",
  8998. "zhcy;": "\u0436",
  8999. "zigrarr;": "\u21DD",
  9000. "zopf;": "\uD835\uDD6B",
  9001. "Zopf;": "\u2124",
  9002. "Zscr;": "\uD835\uDCB5",
  9003. "zscr;": "\uD835\uDCCF",
  9004. "zwj;": "\u200D",
  9005. "zwnj;": "\u200C"
  9006. };
  9007. },
  9008. {}],
  9009. 13:[function(_dereq_,module,exports){
  9010. var util = _dereq_('util/');
  9011. var pSlice = Array.prototype.slice;
  9012. var hasOwn = Object.prototype.hasOwnProperty;
  9013. var assert = module.exports = ok;
  9014. assert.AssertionError = function AssertionError(options) {
  9015. this.name = 'AssertionError';
  9016. this.actual = options.actual;
  9017. this.expected = options.expected;
  9018. this.operator = options.operator;
  9019. if (options.message) {
  9020. this.message = options.message;
  9021. this.generatedMessage = false;
  9022. } else {
  9023. this.message = getMessage(this);
  9024. this.generatedMessage = true;
  9025. }
  9026. var stackStartFunction = options.stackStartFunction || fail;
  9027. if (Error.captureStackTrace) {
  9028. Error.captureStackTrace(this, stackStartFunction);
  9029. }
  9030. else {
  9031. var err = new Error();
  9032. if (err.stack) {
  9033. var out = err.stack;
  9034. var fn_name = stackStartFunction.name;
  9035. var idx = out.indexOf('\n' + fn_name);
  9036. if (idx >= 0) {
  9037. var next_line = out.indexOf('\n', idx + 1);
  9038. out = out.substring(next_line + 1);
  9039. }
  9040. this.stack = out;
  9041. }
  9042. }
  9043. };
  9044. util.inherits(assert.AssertionError, Error);
  9045. function replacer(key, value) {
  9046. if (util.isUndefined(value)) {
  9047. return '' + value;
  9048. }
  9049. if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) {
  9050. return value.toString();
  9051. }
  9052. if (util.isFunction(value) || util.isRegExp(value)) {
  9053. return value.toString();
  9054. }
  9055. return value;
  9056. }
  9057. function truncate(s, n) {
  9058. if (util.isString(s)) {
  9059. return s.length < n ? s : s.slice(0, n);
  9060. } else {
  9061. return s;
  9062. }
  9063. }
  9064. function getMessage(self) {
  9065. return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
  9066. self.operator + ' ' +
  9067. truncate(JSON.stringify(self.expected, replacer), 128);
  9068. }
  9069. function fail(actual, expected, message, operator, stackStartFunction) {
  9070. throw new assert.AssertionError({
  9071. message: message,
  9072. actual: actual,
  9073. expected: expected,
  9074. operator: operator,
  9075. stackStartFunction: stackStartFunction
  9076. });
  9077. }
  9078. assert.fail = fail;
  9079. function ok(value, message) {
  9080. if (!value) fail(value, true, message, '==', assert.ok);
  9081. }
  9082. assert.ok = ok;
  9083. assert.equal = function equal(actual, expected, message) {
  9084. if (actual != expected) fail(actual, expected, message, '==', assert.equal);
  9085. };
  9086. assert.notEqual = function notEqual(actual, expected, message) {
  9087. if (actual == expected) {
  9088. fail(actual, expected, message, '!=', assert.notEqual);
  9089. }
  9090. };
  9091. assert.deepEqual = function deepEqual(actual, expected, message) {
  9092. if (!_deepEqual(actual, expected)) {
  9093. fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  9094. }
  9095. };
  9096. function _deepEqual(actual, expected) {
  9097. if (actual === expected) {
  9098. return true;
  9099. } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
  9100. if (actual.length != expected.length) return false;
  9101. for (var i = 0; i < actual.length; i++) {
  9102. if (actual[i] !== expected[i]) return false;
  9103. }
  9104. return true;
  9105. } else if (util.isDate(actual) && util.isDate(expected)) {
  9106. return actual.getTime() === expected.getTime();
  9107. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  9108. return actual.source === expected.source &&
  9109. actual.global === expected.global &&
  9110. actual.multiline === expected.multiline &&
  9111. actual.lastIndex === expected.lastIndex &&
  9112. actual.ignoreCase === expected.ignoreCase;
  9113. } else if (!util.isObject(actual) && !util.isObject(expected)) {
  9114. return actual == expected;
  9115. } else {
  9116. return objEquiv(actual, expected);
  9117. }
  9118. }
  9119. function isArguments(object) {
  9120. return Object.prototype.toString.call(object) == '[object Arguments]';
  9121. }
  9122. function objEquiv(a, b) {
  9123. if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
  9124. return false;
  9125. if (a.prototype !== b.prototype) return false;
  9126. if (isArguments(a)) {
  9127. if (!isArguments(b)) {
  9128. return false;
  9129. }
  9130. a = pSlice.call(a);
  9131. b = pSlice.call(b);
  9132. return _deepEqual(a, b);
  9133. }
  9134. try {
  9135. var ka = objectKeys(a),
  9136. kb = objectKeys(b),
  9137. key, i;
  9138. } catch (e) {//happens when one is a string literal and the other isn't
  9139. return false;
  9140. }
  9141. if (ka.length != kb.length)
  9142. return false;
  9143. ka.sort();
  9144. kb.sort();
  9145. for (i = ka.length - 1; i >= 0; i--) {
  9146. if (ka[i] != kb[i])
  9147. return false;
  9148. }
  9149. for (i = ka.length - 1; i >= 0; i--) {
  9150. key = ka[i];
  9151. if (!_deepEqual(a[key], b[key])) return false;
  9152. }
  9153. return true;
  9154. }
  9155. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  9156. if (_deepEqual(actual, expected)) {
  9157. fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  9158. }
  9159. };
  9160. assert.strictEqual = function strictEqual(actual, expected, message) {
  9161. if (actual !== expected) {
  9162. fail(actual, expected, message, '===', assert.strictEqual);
  9163. }
  9164. };
  9165. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  9166. if (actual === expected) {
  9167. fail(actual, expected, message, '!==', assert.notStrictEqual);
  9168. }
  9169. };
  9170. function expectedException(actual, expected) {
  9171. if (!actual || !expected) {
  9172. return false;
  9173. }
  9174. if (Object.prototype.toString.call(expected) == '[object RegExp]') {
  9175. return expected.test(actual);
  9176. } else if (actual instanceof expected) {
  9177. return true;
  9178. } else if (expected.call({}, actual) === true) {
  9179. return true;
  9180. }
  9181. return false;
  9182. }
  9183. function _throws(shouldThrow, block, expected, message) {
  9184. var actual;
  9185. if (util.isString(expected)) {
  9186. message = expected;
  9187. expected = null;
  9188. }
  9189. try {
  9190. block();
  9191. } catch (e) {
  9192. actual = e;
  9193. }
  9194. message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
  9195. (message ? ' ' + message : '.');
  9196. if (shouldThrow && !actual) {
  9197. fail(actual, expected, 'Missing expected exception' + message);
  9198. }
  9199. if (!shouldThrow && expectedException(actual, expected)) {
  9200. fail(actual, expected, 'Got unwanted exception' + message);
  9201. }
  9202. if ((shouldThrow && actual && expected &&
  9203. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  9204. throw actual;
  9205. }
  9206. }
  9207. assert.throws = function(block, /*optional*/error, /*optional*/message) {
  9208. _throws.apply(this, [true].concat(pSlice.call(arguments)));
  9209. };
  9210. assert.doesNotThrow = function(block, /*optional*/message) {
  9211. _throws.apply(this, [false].concat(pSlice.call(arguments)));
  9212. };
  9213. assert.ifError = function(err) { if (err) {throw err;}};
  9214. var objectKeys = Object.keys || function (obj) {
  9215. var keys = [];
  9216. for (var key in obj) {
  9217. if (hasOwn.call(obj, key)) keys.push(key);
  9218. }
  9219. return keys;
  9220. };
  9221. },
  9222. {"util/":15}],
  9223. 14:[function(_dereq_,module,exports){
  9224. module.exports = function isBuffer(arg) {
  9225. return arg && typeof arg === 'object'
  9226. && typeof arg.copy === 'function'
  9227. && typeof arg.fill === 'function'
  9228. && typeof arg.readUInt8 === 'function';
  9229. }
  9230. },
  9231. {}],
  9232. 15:[function(_dereq_,module,exports){
  9233. (function (process,global){
  9234. var formatRegExp = /%[sdj%]/g;
  9235. exports.format = function(f) {
  9236. if (!isString(f)) {
  9237. var objects = [];
  9238. for (var i = 0; i < arguments.length; i++) {
  9239. objects.push(inspect(arguments[i]));
  9240. }
  9241. return objects.join(' ');
  9242. }
  9243. var i = 1;
  9244. var args = arguments;
  9245. var len = args.length;
  9246. var str = String(f).replace(formatRegExp, function(x) {
  9247. if (x === '%%') return '%';
  9248. if (i >= len) return x;
  9249. switch (x) {
  9250. case '%s': return String(args[i++]);
  9251. case '%d': return Number(args[i++]);
  9252. case '%j':
  9253. try {
  9254. return JSON.stringify(args[i++]);
  9255. } catch (_) {
  9256. return '[Circular]';
  9257. }
  9258. default:
  9259. return x;
  9260. }
  9261. });
  9262. for (var x = args[i]; i < len; x = args[++i]) {
  9263. if (isNull(x) || !isObject(x)) {
  9264. str += ' ' + x;
  9265. } else {
  9266. str += ' ' + inspect(x);
  9267. }
  9268. }
  9269. return str;
  9270. };
  9271. exports.deprecate = function(fn, msg) {
  9272. if (isUndefined(global.process)) {
  9273. return function() {
  9274. return exports.deprecate(fn, msg).apply(this, arguments);
  9275. };
  9276. }
  9277. if (process.noDeprecation === true) {
  9278. return fn;
  9279. }
  9280. var warned = false;
  9281. function deprecated() {
  9282. if (!warned) {
  9283. if (process.throwDeprecation) {
  9284. throw new Error(msg);
  9285. } else if (process.traceDeprecation) {
  9286. console.trace(msg);
  9287. } else {
  9288. console.error(msg);
  9289. }
  9290. warned = true;
  9291. }
  9292. return fn.apply(this, arguments);
  9293. }
  9294. return deprecated;
  9295. };
  9296. var debugs = {};
  9297. var debugEnviron;
  9298. exports.debuglog = function(set) {
  9299. if (isUndefined(debugEnviron))
  9300. debugEnviron = process.env.NODE_DEBUG || '';
  9301. set = set.toUpperCase();
  9302. if (!debugs[set]) {
  9303. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  9304. var pid = process.pid;
  9305. debugs[set] = function() {
  9306. var msg = exports.format.apply(exports, arguments);
  9307. console.error('%s %d: %s', set, pid, msg);
  9308. };
  9309. } else {
  9310. debugs[set] = function() {};
  9311. }
  9312. }
  9313. return debugs[set];
  9314. };
  9315. function inspect(obj, opts) {
  9316. var ctx = {
  9317. seen: [],
  9318. stylize: stylizeNoColor
  9319. };
  9320. if (arguments.length >= 3) ctx.depth = arguments[2];
  9321. if (arguments.length >= 4) ctx.colors = arguments[3];
  9322. if (isBoolean(opts)) {
  9323. ctx.showHidden = opts;
  9324. } else if (opts) {
  9325. exports._extend(ctx, opts);
  9326. }
  9327. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  9328. if (isUndefined(ctx.depth)) ctx.depth = 2;
  9329. if (isUndefined(ctx.colors)) ctx.colors = false;
  9330. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  9331. if (ctx.colors) ctx.stylize = stylizeWithColor;
  9332. return formatValue(ctx, obj, ctx.depth);
  9333. }
  9334. exports.inspect = inspect;
  9335. inspect.colors = {
  9336. 'bold' : [1, 22],
  9337. 'italic' : [3, 23],
  9338. 'underline' : [4, 24],
  9339. 'inverse' : [7, 27],
  9340. 'white' : [37, 39],
  9341. 'grey' : [90, 39],
  9342. 'black' : [30, 39],
  9343. 'blue' : [34, 39],
  9344. 'cyan' : [36, 39],
  9345. 'green' : [32, 39],
  9346. 'magenta' : [35, 39],
  9347. 'red' : [31, 39],
  9348. 'yellow' : [33, 39]
  9349. };
  9350. inspect.styles = {
  9351. 'special': 'cyan',
  9352. 'number': 'yellow',
  9353. 'boolean': 'yellow',
  9354. 'undefined': 'grey',
  9355. 'null': 'bold',
  9356. 'string': 'green',
  9357. 'date': 'magenta',
  9358. 'regexp': 'red'
  9359. };
  9360. function stylizeWithColor(str, styleType) {
  9361. var style = inspect.styles[styleType];
  9362. if (style) {
  9363. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  9364. '\u001b[' + inspect.colors[style][1] + 'm';
  9365. } else {
  9366. return str;
  9367. }
  9368. }
  9369. function stylizeNoColor(str, styleType) {
  9370. return str;
  9371. }
  9372. function arrayToHash(array) {
  9373. var hash = {};
  9374. array.forEach(function(val, idx) {
  9375. hash[val] = true;
  9376. });
  9377. return hash;
  9378. }
  9379. function formatValue(ctx, value, recurseTimes) {
  9380. if (ctx.customInspect &&
  9381. value &&
  9382. isFunction(value.inspect) &&
  9383. value.inspect !== exports.inspect &&
  9384. !(value.constructor && value.constructor.prototype === value)) {
  9385. var ret = value.inspect(recurseTimes, ctx);
  9386. if (!isString(ret)) {
  9387. ret = formatValue(ctx, ret, recurseTimes);
  9388. }
  9389. return ret;
  9390. }
  9391. var primitive = formatPrimitive(ctx, value);
  9392. if (primitive) {
  9393. return primitive;
  9394. }
  9395. var keys = Object.keys(value);
  9396. var visibleKeys = arrayToHash(keys);
  9397. if (ctx.showHidden) {
  9398. keys = Object.getOwnPropertyNames(value);
  9399. }
  9400. if (isError(value)
  9401. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  9402. return formatError(value);
  9403. }
  9404. if (keys.length === 0) {
  9405. if (isFunction(value)) {
  9406. var name = value.name ? ': ' + value.name : '';
  9407. return ctx.stylize('[Function' + name + ']', 'special');
  9408. }
  9409. if (isRegExp(value)) {
  9410. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  9411. }
  9412. if (isDate(value)) {
  9413. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  9414. }
  9415. if (isError(value)) {
  9416. return formatError(value);
  9417. }
  9418. }
  9419. var base = '', array = false, braces = ['{', '}'];
  9420. if (isArray(value)) {
  9421. array = true;
  9422. braces = ['[', ']'];
  9423. }
  9424. if (isFunction(value)) {
  9425. var n = value.name ? ': ' + value.name : '';
  9426. base = ' [Function' + n + ']';
  9427. }
  9428. if (isRegExp(value)) {
  9429. base = ' ' + RegExp.prototype.toString.call(value);
  9430. }
  9431. if (isDate(value)) {
  9432. base = ' ' + Date.prototype.toUTCString.call(value);
  9433. }
  9434. if (isError(value)) {
  9435. base = ' ' + formatError(value);
  9436. }
  9437. if (keys.length === 0 && (!array || value.length == 0)) {
  9438. return braces[0] + base + braces[1];
  9439. }
  9440. if (recurseTimes < 0) {
  9441. if (isRegExp(value)) {
  9442. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  9443. } else {
  9444. return ctx.stylize('[Object]', 'special');
  9445. }
  9446. }
  9447. ctx.seen.push(value);
  9448. var output;
  9449. if (array) {
  9450. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  9451. } else {
  9452. output = keys.map(function(key) {
  9453. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  9454. });
  9455. }
  9456. ctx.seen.pop();
  9457. return reduceToSingleString(output, base, braces);
  9458. }
  9459. function formatPrimitive(ctx, value) {
  9460. if (isUndefined(value))
  9461. return ctx.stylize('undefined', 'undefined');
  9462. if (isString(value)) {
  9463. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  9464. .replace(/'/g, "\\'")
  9465. .replace(/\\"/g, '"') + '\'';
  9466. return ctx.stylize(simple, 'string');
  9467. }
  9468. if (isNumber(value))
  9469. return ctx.stylize('' + value, 'number');
  9470. if (isBoolean(value))
  9471. return ctx.stylize('' + value, 'boolean');
  9472. if (isNull(value))
  9473. return ctx.stylize('null', 'null');
  9474. }
  9475. function formatError(value) {
  9476. return '[' + Error.prototype.toString.call(value) + ']';
  9477. }
  9478. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  9479. var output = [];
  9480. for (var i = 0, l = value.length; i < l; ++i) {
  9481. if (hasOwnProperty(value, String(i))) {
  9482. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  9483. String(i), true));
  9484. } else {
  9485. output.push('');
  9486. }
  9487. }
  9488. keys.forEach(function(key) {
  9489. if (!key.match(/^\d+$/)) {
  9490. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  9491. key, true));
  9492. }
  9493. });
  9494. return output;
  9495. }
  9496. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  9497. var name, str, desc;
  9498. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  9499. if (desc.get) {
  9500. if (desc.set) {
  9501. str = ctx.stylize('[Getter/Setter]', 'special');
  9502. } else {
  9503. str = ctx.stylize('[Getter]', 'special');
  9504. }
  9505. } else {
  9506. if (desc.set) {
  9507. str = ctx.stylize('[Setter]', 'special');
  9508. }
  9509. }
  9510. if (!hasOwnProperty(visibleKeys, key)) {
  9511. name = '[' + key + ']';
  9512. }
  9513. if (!str) {
  9514. if (ctx.seen.indexOf(desc.value) < 0) {
  9515. if (isNull(recurseTimes)) {
  9516. str = formatValue(ctx, desc.value, null);
  9517. } else {
  9518. str = formatValue(ctx, desc.value, recurseTimes - 1);
  9519. }
  9520. if (str.indexOf('\n') > -1) {
  9521. if (array) {
  9522. str = str.split('\n').map(function(line) {
  9523. return ' ' + line;
  9524. }).join('\n').substr(2);
  9525. } else {
  9526. str = '\n' + str.split('\n').map(function(line) {
  9527. return ' ' + line;
  9528. }).join('\n');
  9529. }
  9530. }
  9531. } else {
  9532. str = ctx.stylize('[Circular]', 'special');
  9533. }
  9534. }
  9535. if (isUndefined(name)) {
  9536. if (array && key.match(/^\d+$/)) {
  9537. return str;
  9538. }
  9539. name = JSON.stringify('' + key);
  9540. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  9541. name = name.substr(1, name.length - 2);
  9542. name = ctx.stylize(name, 'name');
  9543. } else {
  9544. name = name.replace(/'/g, "\\'")
  9545. .replace(/\\"/g, '"')
  9546. .replace(/(^"|"$)/g, "'");
  9547. name = ctx.stylize(name, 'string');
  9548. }
  9549. }
  9550. return name + ': ' + str;
  9551. }
  9552. function reduceToSingleString(output, base, braces) {
  9553. var numLinesEst = 0;
  9554. var length = output.reduce(function(prev, cur) {
  9555. numLinesEst++;
  9556. if (cur.indexOf('\n') >= 0) numLinesEst++;
  9557. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  9558. }, 0);
  9559. if (length > 60) {
  9560. return braces[0] +
  9561. (base === '' ? '' : base + '\n ') +
  9562. ' ' +
  9563. output.join(',\n ') +
  9564. ' ' +
  9565. braces[1];
  9566. }
  9567. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  9568. }
  9569. function isArray(ar) {
  9570. return Array.isArray(ar);
  9571. }
  9572. exports.isArray = isArray;
  9573. function isBoolean(arg) {
  9574. return typeof arg === 'boolean';
  9575. }
  9576. exports.isBoolean = isBoolean;
  9577. function isNull(arg) {
  9578. return arg === null;
  9579. }
  9580. exports.isNull = isNull;
  9581. function isNullOrUndefined(arg) {
  9582. return arg == null;
  9583. }
  9584. exports.isNullOrUndefined = isNullOrUndefined;
  9585. function isNumber(arg) {
  9586. return typeof arg === 'number';
  9587. }
  9588. exports.isNumber = isNumber;
  9589. function isString(arg) {
  9590. return typeof arg === 'string';
  9591. }
  9592. exports.isString = isString;
  9593. function isSymbol(arg) {
  9594. return typeof arg === 'symbol';
  9595. }
  9596. exports.isSymbol = isSymbol;
  9597. function isUndefined(arg) {
  9598. return arg === void 0;
  9599. }
  9600. exports.isUndefined = isUndefined;
  9601. function isRegExp(re) {
  9602. return isObject(re) && objectToString(re) === '[object RegExp]';
  9603. }
  9604. exports.isRegExp = isRegExp;
  9605. function isObject(arg) {
  9606. return typeof arg === 'object' && arg !== null;
  9607. }
  9608. exports.isObject = isObject;
  9609. function isDate(d) {
  9610. return isObject(d) && objectToString(d) === '[object Date]';
  9611. }
  9612. exports.isDate = isDate;
  9613. function isError(e) {
  9614. return isObject(e) &&
  9615. (objectToString(e) === '[object Error]' || e instanceof Error);
  9616. }
  9617. exports.isError = isError;
  9618. function isFunction(arg) {
  9619. return typeof arg === 'function';
  9620. }
  9621. exports.isFunction = isFunction;
  9622. function isPrimitive(arg) {
  9623. return arg === null ||
  9624. typeof arg === 'boolean' ||
  9625. typeof arg === 'number' ||
  9626. typeof arg === 'string' ||
  9627. typeof arg === 'symbol' || // ES6 symbol
  9628. typeof arg === 'undefined';
  9629. }
  9630. exports.isPrimitive = isPrimitive;
  9631. exports.isBuffer = _dereq_('./support/isBuffer');
  9632. function objectToString(o) {
  9633. return Object.prototype.toString.call(o);
  9634. }
  9635. function pad(n) {
  9636. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  9637. }
  9638. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  9639. 'Oct', 'Nov', 'Dec'];
  9640. function timestamp() {
  9641. var d = new Date();
  9642. var time = [pad(d.getHours()),
  9643. pad(d.getMinutes()),
  9644. pad(d.getSeconds())].join(':');
  9645. return [d.getDate(), months[d.getMonth()], time].join(' ');
  9646. }
  9647. exports.log = function() {
  9648. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  9649. };
  9650. exports.inherits = _dereq_('inherits');
  9651. exports._extend = function(origin, add) {
  9652. if (!add || !isObject(add)) return origin;
  9653. var keys = Object.keys(add);
  9654. var i = keys.length;
  9655. while (i--) {
  9656. origin[keys[i]] = add[keys[i]];
  9657. }
  9658. return origin;
  9659. };
  9660. function hasOwnProperty(obj, prop) {
  9661. return Object.prototype.hasOwnProperty.call(obj, prop);
  9662. }
  9663. }).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 : {})
  9664. },
  9665. {"./support/isBuffer":14,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}],
  9666. 16:[function(_dereq_,module,exports){
  9667. function EventEmitter() {
  9668. this._events = this._events || {};
  9669. this._maxListeners = this._maxListeners || undefined;
  9670. }
  9671. module.exports = EventEmitter;
  9672. EventEmitter.EventEmitter = EventEmitter;
  9673. EventEmitter.prototype._events = undefined;
  9674. EventEmitter.prototype._maxListeners = undefined;
  9675. EventEmitter.defaultMaxListeners = 10;
  9676. EventEmitter.prototype.setMaxListeners = function(n) {
  9677. if (!isNumber(n) || n < 0 || isNaN(n))
  9678. throw TypeError('n must be a positive number');
  9679. this._maxListeners = n;
  9680. return this;
  9681. };
  9682. EventEmitter.prototype.emit = function(type) {
  9683. var er, handler, len, args, i, listeners;
  9684. if (!this._events)
  9685. this._events = {};
  9686. if (type === 'error') {
  9687. if (!this._events.error ||
  9688. (isObject(this._events.error) && !this._events.error.length)) {
  9689. er = arguments[1];
  9690. if (er instanceof Error) {
  9691. throw er; // Unhandled 'error' event
  9692. } else {
  9693. throw TypeError('Uncaught, unspecified "error" event.');
  9694. }
  9695. return false;
  9696. }
  9697. }
  9698. handler = this._events[type];
  9699. if (isUndefined(handler))
  9700. return false;
  9701. if (isFunction(handler)) {
  9702. switch (arguments.length) {
  9703. case 1:
  9704. handler.call(this);
  9705. break;
  9706. case 2:
  9707. handler.call(this, arguments[1]);
  9708. break;
  9709. case 3:
  9710. handler.call(this, arguments[1], arguments[2]);
  9711. break;
  9712. default:
  9713. len = arguments.length;
  9714. args = new Array(len - 1);
  9715. for (i = 1; i < len; i++)
  9716. args[i - 1] = arguments[i];
  9717. handler.apply(this, args);
  9718. }
  9719. } else if (isObject(handler)) {
  9720. len = arguments.length;
  9721. args = new Array(len - 1);
  9722. for (i = 1; i < len; i++)
  9723. args[i - 1] = arguments[i];
  9724. listeners = handler.slice();
  9725. len = listeners.length;
  9726. for (i = 0; i < len; i++)
  9727. listeners[i].apply(this, args);
  9728. }
  9729. return true;
  9730. };
  9731. EventEmitter.prototype.addListener = function(type, listener) {
  9732. var m;
  9733. if (!isFunction(listener))
  9734. throw TypeError('listener must be a function');
  9735. if (!this._events)
  9736. this._events = {};
  9737. if (this._events.newListener)
  9738. this.emit('newListener', type,
  9739. isFunction(listener.listener) ?
  9740. listener.listener : listener);
  9741. if (!this._events[type])
  9742. this._events[type] = listener;
  9743. else if (isObject(this._events[type]))
  9744. this._events[type].push(listener);
  9745. else
  9746. this._events[type] = [this._events[type], listener];
  9747. if (isObject(this._events[type]) && !this._events[type].warned) {
  9748. var m;
  9749. if (!isUndefined(this._maxListeners)) {
  9750. m = this._maxListeners;
  9751. } else {
  9752. m = EventEmitter.defaultMaxListeners;
  9753. }
  9754. if (m && m > 0 && this._events[type].length > m) {
  9755. this._events[type].warned = true;
  9756. console.error('(node) warning: possible EventEmitter memory ' +
  9757. 'leak detected. %d listeners added. ' +
  9758. 'Use emitter.setMaxListeners() to increase limit.',
  9759. this._events[type].length);
  9760. console.trace();
  9761. }
  9762. }
  9763. return this;
  9764. };
  9765. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  9766. EventEmitter.prototype.once = function(type, listener) {
  9767. if (!isFunction(listener))
  9768. throw TypeError('listener must be a function');
  9769. var fired = false;
  9770. function g() {
  9771. this.removeListener(type, g);
  9772. if (!fired) {
  9773. fired = true;
  9774. listener.apply(this, arguments);
  9775. }
  9776. }
  9777. g.listener = listener;
  9778. this.on(type, g);
  9779. return this;
  9780. };
  9781. EventEmitter.prototype.removeListener = function(type, listener) {
  9782. var list, position, length, i;
  9783. if (!isFunction(listener))
  9784. throw TypeError('listener must be a function');
  9785. if (!this._events || !this._events[type])
  9786. return this;
  9787. list = this._events[type];
  9788. length = list.length;
  9789. position = -1;
  9790. if (list === listener ||
  9791. (isFunction(list.listener) && list.listener === listener)) {
  9792. delete this._events[type];
  9793. if (this._events.removeListener)
  9794. this.emit('removeListener', type, listener);
  9795. } else if (isObject(list)) {
  9796. for (i = length; i-- > 0;) {
  9797. if (list[i] === listener ||
  9798. (list[i].listener && list[i].listener === listener)) {
  9799. position = i;
  9800. break;
  9801. }
  9802. }
  9803. if (position < 0)
  9804. return this;
  9805. if (list.length === 1) {
  9806. list.length = 0;
  9807. delete this._events[type];
  9808. } else {
  9809. list.splice(position, 1);
  9810. }
  9811. if (this._events.removeListener)
  9812. this.emit('removeListener', type, listener);
  9813. }
  9814. return this;
  9815. };
  9816. EventEmitter.prototype.removeAllListeners = function(type) {
  9817. var key, listeners;
  9818. if (!this._events)
  9819. return this;
  9820. if (!this._events.removeListener) {
  9821. if (arguments.length === 0)
  9822. this._events = {};
  9823. else if (this._events[type])
  9824. delete this._events[type];
  9825. return this;
  9826. }
  9827. if (arguments.length === 0) {
  9828. for (key in this._events) {
  9829. if (key === 'removeListener') continue;
  9830. this.removeAllListeners(key);
  9831. }
  9832. this.removeAllListeners('removeListener');
  9833. this._events = {};
  9834. return this;
  9835. }
  9836. listeners = this._events[type];
  9837. if (isFunction(listeners)) {
  9838. this.removeListener(type, listeners);
  9839. } else {
  9840. while (listeners.length)
  9841. this.removeListener(type, listeners[listeners.length - 1]);
  9842. }
  9843. delete this._events[type];
  9844. return this;
  9845. };
  9846. EventEmitter.prototype.listeners = function(type) {
  9847. var ret;
  9848. if (!this._events || !this._events[type])
  9849. ret = [];
  9850. else if (isFunction(this._events[type]))
  9851. ret = [this._events[type]];
  9852. else
  9853. ret = this._events[type].slice();
  9854. return ret;
  9855. };
  9856. EventEmitter.listenerCount = function(emitter, type) {
  9857. var ret;
  9858. if (!emitter._events || !emitter._events[type])
  9859. ret = 0;
  9860. else if (isFunction(emitter._events[type]))
  9861. ret = 1;
  9862. else
  9863. ret = emitter._events[type].length;
  9864. return ret;
  9865. };
  9866. function isFunction(arg) {
  9867. return typeof arg === 'function';
  9868. }
  9869. function isNumber(arg) {
  9870. return typeof arg === 'number';
  9871. }
  9872. function isObject(arg) {
  9873. return typeof arg === 'object' && arg !== null;
  9874. }
  9875. function isUndefined(arg) {
  9876. return arg === void 0;
  9877. }
  9878. },
  9879. {}],
  9880. 17:[function(_dereq_,module,exports){
  9881. if (typeof Object.create === 'function') {
  9882. module.exports = function inherits(ctor, superCtor) {
  9883. ctor.super_ = superCtor
  9884. ctor.prototype = Object.create(superCtor.prototype, {
  9885. constructor: {
  9886. value: ctor,
  9887. enumerable: false,
  9888. writable: true,
  9889. configurable: true
  9890. }
  9891. });
  9892. };
  9893. } else {
  9894. module.exports = function inherits(ctor, superCtor) {
  9895. ctor.super_ = superCtor
  9896. var TempCtor = function () {}
  9897. TempCtor.prototype = superCtor.prototype
  9898. ctor.prototype = new TempCtor()
  9899. ctor.prototype.constructor = ctor
  9900. }
  9901. }
  9902. },
  9903. {}],
  9904. 18:[function(_dereq_,module,exports){
  9905. var process = module.exports = {};
  9906. process.nextTick = (function () {
  9907. var canSetImmediate = typeof window !== 'undefined'
  9908. && window.setImmediate;
  9909. var canPost = typeof window !== 'undefined'
  9910. && window.postMessage && window.addEventListener
  9911. ;
  9912. if (canSetImmediate) {
  9913. return function (f) { return window.setImmediate(f) };
  9914. }
  9915. if (canPost) {
  9916. var queue = [];
  9917. window.addEventListener('message', function (ev) {
  9918. var source = ev.source;
  9919. if ((source === window || source === null) && ev.data === 'process-tick') {
  9920. ev.stopPropagation();
  9921. if (queue.length > 0) {
  9922. var fn = queue.shift();
  9923. fn();
  9924. }
  9925. }
  9926. }, true);
  9927. return function nextTick(fn) {
  9928. queue.push(fn);
  9929. window.postMessage('process-tick', '*');
  9930. };
  9931. }
  9932. return function nextTick(fn) {
  9933. setTimeout(fn, 0);
  9934. };
  9935. })();
  9936. process.title = 'browser';
  9937. process.browser = true;
  9938. process.env = {};
  9939. process.argv = [];
  9940. function noop() {}
  9941. process.on = noop;
  9942. process.once = noop;
  9943. process.off = noop;
  9944. process.emit = noop;
  9945. process.binding = function (name) {
  9946. throw new Error('process.binding is not supported');
  9947. }
  9948. process.cwd = function () { return '/' };
  9949. process.chdir = function (dir) {
  9950. throw new Error('process.chdir is not supported');
  9951. };
  9952. },
  9953. {}],
  9954. 19:[function(_dereq_,module,exports){
  9955. module.exports=_dereq_(14)
  9956. },
  9957. {}],
  9958. 20:[function(_dereq_,module,exports){
  9959. module.exports=_dereq_(15)
  9960. },
  9961. {"./support/isBuffer":19,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}]},{},[9])
  9962. (9)
  9963. });
  9964. ace.define("ace/mode/html_worker",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/worker/mirror","ace/mode/html/saxparser"], function(require, exports, module) {
  9965. "use strict";
  9966. var oop = require("../lib/oop");
  9967. var lang = require("../lib/lang");
  9968. var Mirror = require("../worker/mirror").Mirror;
  9969. var SAXParser = require("./html/saxparser").SAXParser;
  9970. var errorTypes = {
  9971. "expected-doctype-but-got-start-tag": "info",
  9972. "expected-doctype-but-got-chars": "info",
  9973. "non-html-root": "info"
  9974. }
  9975. var Worker = exports.Worker = function(sender) {
  9976. Mirror.call(this, sender);
  9977. this.setTimeout(400);
  9978. this.context = null;
  9979. };
  9980. oop.inherits(Worker, Mirror);
  9981. (function() {
  9982. this.setOptions = function(options) {
  9983. this.context = options.context;
  9984. };
  9985. this.onUpdate = function() {
  9986. var value = this.doc.getValue();
  9987. if (!value)
  9988. return;
  9989. var parser = new SAXParser();
  9990. var errors = [];
  9991. var noop = function(){};
  9992. parser.contentHandler = {
  9993. startDocument: noop,
  9994. endDocument: noop,
  9995. startElement: noop,
  9996. endElement: noop,
  9997. characters: noop
  9998. };
  9999. parser.errorHandler = {
  10000. error: function(message, location, code) {
  10001. errors.push({
  10002. row: location.line,
  10003. column: location.column,
  10004. text: message,
  10005. type: errorTypes[code] || "error"
  10006. });
  10007. }
  10008. };
  10009. if (this.context)
  10010. parser.parseFragment(value, this.context);
  10011. else
  10012. parser.parse(value);
  10013. this.sender.emit("error", errors);
  10014. };
  10015. }).call(Worker.prototype);
  10016. });
  10017. ace.define("ace/lib/es5-shim",["require","exports","module"], function(require, exports, module) {
  10018. function Empty() {}
  10019. if (!Function.prototype.bind) {
  10020. Function.prototype.bind = function bind(that) { // .length is 1
  10021. var target = this;
  10022. if (typeof target != "function") {
  10023. throw new TypeError("Function.prototype.bind called on incompatible " + target);
  10024. }
  10025. var args = slice.call(arguments, 1); // for normal call
  10026. var bound = function () {
  10027. if (this instanceof bound) {
  10028. var result = target.apply(
  10029. this,
  10030. args.concat(slice.call(arguments))
  10031. );
  10032. if (Object(result) === result) {
  10033. return result;
  10034. }
  10035. return this;
  10036. } else {
  10037. return target.apply(
  10038. that,
  10039. args.concat(slice.call(arguments))
  10040. );
  10041. }
  10042. };
  10043. if(target.prototype) {
  10044. Empty.prototype = target.prototype;
  10045. bound.prototype = new Empty();
  10046. Empty.prototype = null;
  10047. }
  10048. return bound;
  10049. };
  10050. }
  10051. var call = Function.prototype.call;
  10052. var prototypeOfArray = Array.prototype;
  10053. var prototypeOfObject = Object.prototype;
  10054. var slice = prototypeOfArray.slice;
  10055. var _toString = call.bind(prototypeOfObject.toString);
  10056. var owns = call.bind(prototypeOfObject.hasOwnProperty);
  10057. var defineGetter;
  10058. var defineSetter;
  10059. var lookupGetter;
  10060. var lookupSetter;
  10061. var supportsAccessors;
  10062. if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
  10063. defineGetter = call.bind(prototypeOfObject.__defineGetter__);
  10064. defineSetter = call.bind(prototypeOfObject.__defineSetter__);
  10065. lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
  10066. lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
  10067. }
  10068. if ([1,2].splice(0).length != 2) {
  10069. if(function() { // test IE < 9 to splice bug - see issue #138
  10070. function makeArray(l) {
  10071. var a = new Array(l+2);
  10072. a[0] = a[1] = 0;
  10073. return a;
  10074. }
  10075. var array = [], lengthBefore;
  10076. array.splice.apply(array, makeArray(20));
  10077. array.splice.apply(array, makeArray(26));
  10078. lengthBefore = array.length; //46
  10079. array.splice(5, 0, "XXX"); // add one element
  10080. lengthBefore + 1 == array.length
  10081. if (lengthBefore + 1 == array.length) {
  10082. return true;// has right splice implementation without bugs
  10083. }
  10084. }()) {//IE 6/7
  10085. var array_splice = Array.prototype.splice;
  10086. Array.prototype.splice = function(start, deleteCount) {
  10087. if (!arguments.length) {
  10088. return [];
  10089. } else {
  10090. return array_splice.apply(this, [
  10091. start === void 0 ? 0 : start,
  10092. deleteCount === void 0 ? (this.length - start) : deleteCount
  10093. ].concat(slice.call(arguments, 2)))
  10094. }
  10095. };
  10096. } else {//IE8
  10097. Array.prototype.splice = function(pos, removeCount){
  10098. var length = this.length;
  10099. if (pos > 0) {
  10100. if (pos > length)
  10101. pos = length;
  10102. } else if (pos == void 0) {
  10103. pos = 0;
  10104. } else if (pos < 0) {
  10105. pos = Math.max(length + pos, 0);
  10106. }
  10107. if (!(pos+removeCount < length))
  10108. removeCount = length - pos;
  10109. var removed = this.slice(pos, pos+removeCount);
  10110. var insert = slice.call(arguments, 2);
  10111. var add = insert.length;
  10112. if (pos === length) {
  10113. if (add) {
  10114. this.push.apply(this, insert);
  10115. }
  10116. } else {
  10117. var remove = Math.min(removeCount, length - pos);
  10118. var tailOldPos = pos + remove;
  10119. var tailNewPos = tailOldPos + add - remove;
  10120. var tailCount = length - tailOldPos;
  10121. var lengthAfterRemove = length - remove;
  10122. if (tailNewPos < tailOldPos) { // case A
  10123. for (var i = 0; i < tailCount; ++i) {
  10124. this[tailNewPos+i] = this[tailOldPos+i];
  10125. }
  10126. } else if (tailNewPos > tailOldPos) { // case B
  10127. for (i = tailCount; i--; ) {
  10128. this[tailNewPos+i] = this[tailOldPos+i];
  10129. }
  10130. } // else, add == remove (nothing to do)
  10131. if (add && pos === lengthAfterRemove) {
  10132. this.length = lengthAfterRemove; // truncate array
  10133. this.push.apply(this, insert);
  10134. } else {
  10135. this.length = lengthAfterRemove + add; // reserves space
  10136. for (i = 0; i < add; ++i) {
  10137. this[pos+i] = insert[i];
  10138. }
  10139. }
  10140. }
  10141. return removed;
  10142. };
  10143. }
  10144. }
  10145. if (!Array.isArray) {
  10146. Array.isArray = function isArray(obj) {
  10147. return _toString(obj) == "[object Array]";
  10148. };
  10149. }
  10150. var boxedString = Object("a"),
  10151. splitString = boxedString[0] != "a" || !(0 in boxedString);
  10152. if (!Array.prototype.forEach) {
  10153. Array.prototype.forEach = function forEach(fun /*, thisp*/) {
  10154. var object = toObject(this),
  10155. self = splitString && _toString(this) == "[object String]" ?
  10156. this.split("") :
  10157. object,
  10158. thisp = arguments[1],
  10159. i = -1,
  10160. length = self.length >>> 0;
  10161. if (_toString(fun) != "[object Function]") {
  10162. throw new TypeError(); // TODO message
  10163. }
  10164. while (++i < length) {
  10165. if (i in self) {
  10166. fun.call(thisp, self[i], i, object);
  10167. }
  10168. }
  10169. };
  10170. }
  10171. if (!Array.prototype.map) {
  10172. Array.prototype.map = function map(fun /*, thisp*/) {
  10173. var object = toObject(this),
  10174. self = splitString && _toString(this) == "[object String]" ?
  10175. this.split("") :
  10176. object,
  10177. length = self.length >>> 0,
  10178. result = Array(length),
  10179. thisp = arguments[1];
  10180. if (_toString(fun) != "[object Function]") {
  10181. throw new TypeError(fun + " is not a function");
  10182. }
  10183. for (var i = 0; i < length; i++) {
  10184. if (i in self)
  10185. result[i] = fun.call(thisp, self[i], i, object);
  10186. }
  10187. return result;
  10188. };
  10189. }
  10190. if (!Array.prototype.filter) {
  10191. Array.prototype.filter = function filter(fun /*, thisp */) {
  10192. var object = toObject(this),
  10193. self = splitString && _toString(this) == "[object String]" ?
  10194. this.split("") :
  10195. object,
  10196. length = self.length >>> 0,
  10197. result = [],
  10198. value,
  10199. thisp = arguments[1];
  10200. if (_toString(fun) != "[object Function]") {
  10201. throw new TypeError(fun + " is not a function");
  10202. }
  10203. for (var i = 0; i < length; i++) {
  10204. if (i in self) {
  10205. value = self[i];
  10206. if (fun.call(thisp, value, i, object)) {
  10207. result.push(value);
  10208. }
  10209. }
  10210. }
  10211. return result;
  10212. };
  10213. }
  10214. if (!Array.prototype.every) {
  10215. Array.prototype.every = function every(fun /*, thisp */) {
  10216. var object = toObject(this),
  10217. self = splitString && _toString(this) == "[object String]" ?
  10218. this.split("") :
  10219. object,
  10220. length = self.length >>> 0,
  10221. thisp = arguments[1];
  10222. if (_toString(fun) != "[object Function]") {
  10223. throw new TypeError(fun + " is not a function");
  10224. }
  10225. for (var i = 0; i < length; i++) {
  10226. if (i in self && !fun.call(thisp, self[i], i, object)) {
  10227. return false;
  10228. }
  10229. }
  10230. return true;
  10231. };
  10232. }
  10233. if (!Array.prototype.some) {
  10234. Array.prototype.some = function some(fun /*, thisp */) {
  10235. var object = toObject(this),
  10236. self = splitString && _toString(this) == "[object String]" ?
  10237. this.split("") :
  10238. object,
  10239. length = self.length >>> 0,
  10240. thisp = arguments[1];
  10241. if (_toString(fun) != "[object Function]") {
  10242. throw new TypeError(fun + " is not a function");
  10243. }
  10244. for (var i = 0; i < length; i++) {
  10245. if (i in self && fun.call(thisp, self[i], i, object)) {
  10246. return true;
  10247. }
  10248. }
  10249. return false;
  10250. };
  10251. }
  10252. if (!Array.prototype.reduce) {
  10253. Array.prototype.reduce = function reduce(fun /*, initial*/) {
  10254. var object = toObject(this),
  10255. self = splitString && _toString(this) == "[object String]" ?
  10256. this.split("") :
  10257. object,
  10258. length = self.length >>> 0;
  10259. if (_toString(fun) != "[object Function]") {
  10260. throw new TypeError(fun + " is not a function");
  10261. }
  10262. if (!length && arguments.length == 1) {
  10263. throw new TypeError("reduce of empty array with no initial value");
  10264. }
  10265. var i = 0;
  10266. var result;
  10267. if (arguments.length >= 2) {
  10268. result = arguments[1];
  10269. } else {
  10270. do {
  10271. if (i in self) {
  10272. result = self[i++];
  10273. break;
  10274. }
  10275. if (++i >= length) {
  10276. throw new TypeError("reduce of empty array with no initial value");
  10277. }
  10278. } while (true);
  10279. }
  10280. for (; i < length; i++) {
  10281. if (i in self) {
  10282. result = fun.call(void 0, result, self[i], i, object);
  10283. }
  10284. }
  10285. return result;
  10286. };
  10287. }
  10288. if (!Array.prototype.reduceRight) {
  10289. Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
  10290. var object = toObject(this),
  10291. self = splitString && _toString(this) == "[object String]" ?
  10292. this.split("") :
  10293. object,
  10294. length = self.length >>> 0;
  10295. if (_toString(fun) != "[object Function]") {
  10296. throw new TypeError(fun + " is not a function");
  10297. }
  10298. if (!length && arguments.length == 1) {
  10299. throw new TypeError("reduceRight of empty array with no initial value");
  10300. }
  10301. var result, i = length - 1;
  10302. if (arguments.length >= 2) {
  10303. result = arguments[1];
  10304. } else {
  10305. do {
  10306. if (i in self) {
  10307. result = self[i--];
  10308. break;
  10309. }
  10310. if (--i < 0) {
  10311. throw new TypeError("reduceRight of empty array with no initial value");
  10312. }
  10313. } while (true);
  10314. }
  10315. do {
  10316. if (i in this) {
  10317. result = fun.call(void 0, result, self[i], i, object);
  10318. }
  10319. } while (i--);
  10320. return result;
  10321. };
  10322. }
  10323. if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
  10324. Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
  10325. var self = splitString && _toString(this) == "[object String]" ?
  10326. this.split("") :
  10327. toObject(this),
  10328. length = self.length >>> 0;
  10329. if (!length) {
  10330. return -1;
  10331. }
  10332. var i = 0;
  10333. if (arguments.length > 1) {
  10334. i = toInteger(arguments[1]);
  10335. }
  10336. i = i >= 0 ? i : Math.max(0, length + i);
  10337. for (; i < length; i++) {
  10338. if (i in self && self[i] === sought) {
  10339. return i;
  10340. }
  10341. }
  10342. return -1;
  10343. };
  10344. }
  10345. if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
  10346. Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
  10347. var self = splitString && _toString(this) == "[object String]" ?
  10348. this.split("") :
  10349. toObject(this),
  10350. length = self.length >>> 0;
  10351. if (!length) {
  10352. return -1;
  10353. }
  10354. var i = length - 1;
  10355. if (arguments.length > 1) {
  10356. i = Math.min(i, toInteger(arguments[1]));
  10357. }
  10358. i = i >= 0 ? i : length - Math.abs(i);
  10359. for (; i >= 0; i--) {
  10360. if (i in self && sought === self[i]) {
  10361. return i;
  10362. }
  10363. }
  10364. return -1;
  10365. };
  10366. }
  10367. if (!Object.getPrototypeOf) {
  10368. Object.getPrototypeOf = function getPrototypeOf(object) {
  10369. return object.__proto__ || (
  10370. object.constructor ?
  10371. object.constructor.prototype :
  10372. prototypeOfObject
  10373. );
  10374. };
  10375. }
  10376. if (!Object.getOwnPropertyDescriptor) {
  10377. var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
  10378. "non-object: ";
  10379. Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
  10380. if ((typeof object != "object" && typeof object != "function") || object === null)
  10381. throw new TypeError(ERR_NON_OBJECT + object);
  10382. if (!owns(object, property))
  10383. return;
  10384. var descriptor, getter, setter;
  10385. descriptor = { enumerable: true, configurable: true };
  10386. if (supportsAccessors) {
  10387. var prototype = object.__proto__;
  10388. object.__proto__ = prototypeOfObject;
  10389. var getter = lookupGetter(object, property);
  10390. var setter = lookupSetter(object, property);
  10391. object.__proto__ = prototype;
  10392. if (getter || setter) {
  10393. if (getter) descriptor.get = getter;
  10394. if (setter) descriptor.set = setter;
  10395. return descriptor;
  10396. }
  10397. }
  10398. descriptor.value = object[property];
  10399. return descriptor;
  10400. };
  10401. }
  10402. if (!Object.getOwnPropertyNames) {
  10403. Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
  10404. return Object.keys(object);
  10405. };
  10406. }
  10407. if (!Object.create) {
  10408. var createEmpty;
  10409. if (Object.prototype.__proto__ === null) {
  10410. createEmpty = function () {
  10411. return { "__proto__": null };
  10412. };
  10413. } else {
  10414. createEmpty = function () {
  10415. var empty = {};
  10416. for (var i in empty)
  10417. empty[i] = null;
  10418. empty.constructor =
  10419. empty.hasOwnProperty =
  10420. empty.propertyIsEnumerable =
  10421. empty.isPrototypeOf =
  10422. empty.toLocaleString =
  10423. empty.toString =
  10424. empty.valueOf =
  10425. empty.__proto__ = null;
  10426. return empty;
  10427. }
  10428. }
  10429. Object.create = function create(prototype, properties) {
  10430. var object;
  10431. if (prototype === null) {
  10432. object = createEmpty();
  10433. } else {
  10434. if (typeof prototype != "object")
  10435. throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
  10436. var Type = function () {};
  10437. Type.prototype = prototype;
  10438. object = new Type();
  10439. object.__proto__ = prototype;
  10440. }
  10441. if (properties !== void 0)
  10442. Object.defineProperties(object, properties);
  10443. return object;
  10444. };
  10445. }
  10446. function doesDefinePropertyWork(object) {
  10447. try {
  10448. Object.defineProperty(object, "sentinel", {});
  10449. return "sentinel" in object;
  10450. } catch (exception) {
  10451. }
  10452. }
  10453. if (Object.defineProperty) {
  10454. var definePropertyWorksOnObject = doesDefinePropertyWork({});
  10455. var definePropertyWorksOnDom = typeof document == "undefined" ||
  10456. doesDefinePropertyWork(document.createElement("div"));
  10457. if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
  10458. var definePropertyFallback = Object.defineProperty;
  10459. }
  10460. }
  10461. if (!Object.defineProperty || definePropertyFallback) {
  10462. var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
  10463. var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
  10464. var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
  10465. "on this javascript engine";
  10466. Object.defineProperty = function defineProperty(object, property, descriptor) {
  10467. if ((typeof object != "object" && typeof object != "function") || object === null)
  10468. throw new TypeError(ERR_NON_OBJECT_TARGET + object);
  10469. if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
  10470. throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
  10471. if (definePropertyFallback) {
  10472. try {
  10473. return definePropertyFallback.call(Object, object, property, descriptor);
  10474. } catch (exception) {
  10475. }
  10476. }
  10477. if (owns(descriptor, "value")) {
  10478. if (supportsAccessors && (lookupGetter(object, property) ||
  10479. lookupSetter(object, property)))
  10480. {
  10481. var prototype = object.__proto__;
  10482. object.__proto__ = prototypeOfObject;
  10483. delete object[property];
  10484. object[property] = descriptor.value;
  10485. object.__proto__ = prototype;
  10486. } else {
  10487. object[property] = descriptor.value;
  10488. }
  10489. } else {
  10490. if (!supportsAccessors)
  10491. throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
  10492. if (owns(descriptor, "get"))
  10493. defineGetter(object, property, descriptor.get);
  10494. if (owns(descriptor, "set"))
  10495. defineSetter(object, property, descriptor.set);
  10496. }
  10497. return object;
  10498. };
  10499. }
  10500. if (!Object.defineProperties) {
  10501. Object.defineProperties = function defineProperties(object, properties) {
  10502. for (var property in properties) {
  10503. if (owns(properties, property))
  10504. Object.defineProperty(object, property, properties[property]);
  10505. }
  10506. return object;
  10507. };
  10508. }
  10509. if (!Object.seal) {
  10510. Object.seal = function seal(object) {
  10511. return object;
  10512. };
  10513. }
  10514. if (!Object.freeze) {
  10515. Object.freeze = function freeze(object) {
  10516. return object;
  10517. };
  10518. }
  10519. try {
  10520. Object.freeze(function () {});
  10521. } catch (exception) {
  10522. Object.freeze = (function freeze(freezeObject) {
  10523. return function freeze(object) {
  10524. if (typeof object == "function") {
  10525. return object;
  10526. } else {
  10527. return freezeObject(object);
  10528. }
  10529. };
  10530. })(Object.freeze);
  10531. }
  10532. if (!Object.preventExtensions) {
  10533. Object.preventExtensions = function preventExtensions(object) {
  10534. return object;
  10535. };
  10536. }
  10537. if (!Object.isSealed) {
  10538. Object.isSealed = function isSealed(object) {
  10539. return false;
  10540. };
  10541. }
  10542. if (!Object.isFrozen) {
  10543. Object.isFrozen = function isFrozen(object) {
  10544. return false;
  10545. };
  10546. }
  10547. if (!Object.isExtensible) {
  10548. Object.isExtensible = function isExtensible(object) {
  10549. if (Object(object) === object) {
  10550. throw new TypeError(); // TODO message
  10551. }
  10552. var name = '';
  10553. while (owns(object, name)) {
  10554. name += '?';
  10555. }
  10556. object[name] = true;
  10557. var returnValue = owns(object, name);
  10558. delete object[name];
  10559. return returnValue;
  10560. };
  10561. }
  10562. if (!Object.keys) {
  10563. var hasDontEnumBug = true,
  10564. dontEnums = [
  10565. "toString",
  10566. "toLocaleString",
  10567. "valueOf",
  10568. "hasOwnProperty",
  10569. "isPrototypeOf",
  10570. "propertyIsEnumerable",
  10571. "constructor"
  10572. ],
  10573. dontEnumsLength = dontEnums.length;
  10574. for (var key in {"toString": null}) {
  10575. hasDontEnumBug = false;
  10576. }
  10577. Object.keys = function keys(object) {
  10578. if (
  10579. (typeof object != "object" && typeof object != "function") ||
  10580. object === null
  10581. ) {
  10582. throw new TypeError("Object.keys called on a non-object");
  10583. }
  10584. var keys = [];
  10585. for (var name in object) {
  10586. if (owns(object, name)) {
  10587. keys.push(name);
  10588. }
  10589. }
  10590. if (hasDontEnumBug) {
  10591. for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
  10592. var dontEnum = dontEnums[i];
  10593. if (owns(object, dontEnum)) {
  10594. keys.push(dontEnum);
  10595. }
  10596. }
  10597. }
  10598. return keys;
  10599. };
  10600. }
  10601. if (!Date.now) {
  10602. Date.now = function now() {
  10603. return new Date().getTime();
  10604. };
  10605. }
  10606. var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
  10607. "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
  10608. "\u2029\uFEFF";
  10609. if (!String.prototype.trim || ws.trim()) {
  10610. ws = "[" + ws + "]";
  10611. var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
  10612. trimEndRegexp = new RegExp(ws + ws + "*$");
  10613. String.prototype.trim = function trim() {
  10614. return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
  10615. };
  10616. }
  10617. function toInteger(n) {
  10618. n = +n;
  10619. if (n !== n) { // isNaN
  10620. n = 0;
  10621. } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
  10622. n = (n > 0 || -1) * Math.floor(Math.abs(n));
  10623. }
  10624. return n;
  10625. }
  10626. function isPrimitive(input) {
  10627. var type = typeof input;
  10628. return (
  10629. input === null ||
  10630. type === "undefined" ||
  10631. type === "boolean" ||
  10632. type === "number" ||
  10633. type === "string"
  10634. );
  10635. }
  10636. function toPrimitive(input) {
  10637. var val, valueOf, toString;
  10638. if (isPrimitive(input)) {
  10639. return input;
  10640. }
  10641. valueOf = input.valueOf;
  10642. if (typeof valueOf === "function") {
  10643. val = valueOf.call(input);
  10644. if (isPrimitive(val)) {
  10645. return val;
  10646. }
  10647. }
  10648. toString = input.toString;
  10649. if (typeof toString === "function") {
  10650. val = toString.call(input);
  10651. if (isPrimitive(val)) {
  10652. return val;
  10653. }
  10654. }
  10655. throw new TypeError();
  10656. }
  10657. var toObject = function (o) {
  10658. if (o == null) { // this matches both null and undefined
  10659. throw new TypeError("can't convert "+o+" to object");
  10660. }
  10661. return Object(o);
  10662. };
  10663. });