worker-html.js 309 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922
  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.slice(0, factory.length).map(function(dep) {
  122. switch (dep) {
  123. // Because "require", "exports" and "module" aren't actual
  124. // dependencies, we must handle them seperately.
  125. case "require": return req;
  126. case "exports": return module.exports;
  127. case "module": return module;
  128. // But for all other dependencies, we can just go ahead and
  129. // require them.
  130. default: return req(dep);
  131. }
  132. }));
  133. if (returnExports)
  134. module.exports = returnExports;
  135. return module;
  136. }
  137. };
  138. };
  139. window.define.amd = {};
  140. 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. sender = window.sender = window.initSender();
  186. var clazz = require(msg.module)[msg.classname];
  187. main = window.main = new clazz(sender);
  188. }
  189. };
  190. })(this);
  191. ace.define("ace/lib/oop",[], function(require, exports, module) {
  192. "use strict";
  193. exports.inherits = function(ctor, superCtor) {
  194. ctor.super_ = superCtor;
  195. ctor.prototype = Object.create(superCtor.prototype, {
  196. constructor: {
  197. value: ctor,
  198. enumerable: false,
  199. writable: true,
  200. configurable: true
  201. }
  202. });
  203. };
  204. exports.mixin = function(obj, mixin) {
  205. for (var key in mixin) {
  206. obj[key] = mixin[key];
  207. }
  208. return obj;
  209. };
  210. exports.implement = function(proto, mixin) {
  211. exports.mixin(proto, mixin);
  212. };
  213. });
  214. ace.define("ace/lib/lang",[], function(require, exports, module) {
  215. "use strict";
  216. exports.last = function(a) {
  217. return a[a.length - 1];
  218. };
  219. exports.stringReverse = function(string) {
  220. return string.split("").reverse().join("");
  221. };
  222. exports.stringRepeat = function (string, count) {
  223. var result = '';
  224. while (count > 0) {
  225. if (count & 1)
  226. result += string;
  227. if (count >>= 1)
  228. string += string;
  229. }
  230. return result;
  231. };
  232. var trimBeginRegexp = /^\s\s*/;
  233. var trimEndRegexp = /\s\s*$/;
  234. exports.stringTrimLeft = function (string) {
  235. return string.replace(trimBeginRegexp, '');
  236. };
  237. exports.stringTrimRight = function (string) {
  238. return string.replace(trimEndRegexp, '');
  239. };
  240. exports.copyObject = function(obj) {
  241. var copy = {};
  242. for (var key in obj) {
  243. copy[key] = obj[key];
  244. }
  245. return copy;
  246. };
  247. exports.copyArray = function(array){
  248. var copy = [];
  249. for (var i=0, l=array.length; i<l; i++) {
  250. if (array[i] && typeof array[i] == "object")
  251. copy[i] = this.copyObject(array[i]);
  252. else
  253. copy[i] = array[i];
  254. }
  255. return copy;
  256. };
  257. exports.deepCopy = function deepCopy(obj) {
  258. if (typeof obj !== "object" || !obj)
  259. return obj;
  260. var copy;
  261. if (Array.isArray(obj)) {
  262. copy = [];
  263. for (var key = 0; key < obj.length; key++) {
  264. copy[key] = deepCopy(obj[key]);
  265. }
  266. return copy;
  267. }
  268. if (Object.prototype.toString.call(obj) !== "[object Object]")
  269. return obj;
  270. copy = {};
  271. for (var key in obj)
  272. copy[key] = deepCopy(obj[key]);
  273. return copy;
  274. };
  275. exports.arrayToMap = function(arr) {
  276. var map = {};
  277. for (var i=0; i<arr.length; i++) {
  278. map[arr[i]] = 1;
  279. }
  280. return map;
  281. };
  282. exports.createMap = function(props) {
  283. var map = Object.create(null);
  284. for (var i in props) {
  285. map[i] = props[i];
  286. }
  287. return map;
  288. };
  289. exports.arrayRemove = function(array, value) {
  290. for (var i = 0; i <= array.length; i++) {
  291. if (value === array[i]) {
  292. array.splice(i, 1);
  293. }
  294. }
  295. };
  296. exports.escapeRegExp = function(str) {
  297. return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
  298. };
  299. exports.escapeHTML = function(str) {
  300. return ("" + str).replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
  301. };
  302. exports.getMatchOffsets = function(string, regExp) {
  303. var matches = [];
  304. string.replace(regExp, function(str) {
  305. matches.push({
  306. offset: arguments[arguments.length-2],
  307. length: str.length
  308. });
  309. });
  310. return matches;
  311. };
  312. exports.deferredCall = function(fcn) {
  313. var timer = null;
  314. var callback = function() {
  315. timer = null;
  316. fcn();
  317. };
  318. var deferred = function(timeout) {
  319. deferred.cancel();
  320. timer = setTimeout(callback, timeout || 0);
  321. return deferred;
  322. };
  323. deferred.schedule = deferred;
  324. deferred.call = function() {
  325. this.cancel();
  326. fcn();
  327. return deferred;
  328. };
  329. deferred.cancel = function() {
  330. clearTimeout(timer);
  331. timer = null;
  332. return deferred;
  333. };
  334. deferred.isPending = function() {
  335. return timer;
  336. };
  337. return deferred;
  338. };
  339. exports.delayedCall = function(fcn, defaultTimeout) {
  340. var timer = null;
  341. var callback = function() {
  342. timer = null;
  343. fcn();
  344. };
  345. var _self = function(timeout) {
  346. if (timer == null)
  347. timer = setTimeout(callback, timeout || defaultTimeout);
  348. };
  349. _self.delay = function(timeout) {
  350. timer && clearTimeout(timer);
  351. timer = setTimeout(callback, timeout || defaultTimeout);
  352. };
  353. _self.schedule = _self;
  354. _self.call = function() {
  355. this.cancel();
  356. fcn();
  357. };
  358. _self.cancel = function() {
  359. timer && clearTimeout(timer);
  360. timer = null;
  361. };
  362. _self.isPending = function() {
  363. return timer;
  364. };
  365. return _self;
  366. };
  367. });
  368. ace.define("ace/range",[], function(require, exports, module) {
  369. "use strict";
  370. var comparePoints = function(p1, p2) {
  371. return p1.row - p2.row || p1.column - p2.column;
  372. };
  373. var Range = function(startRow, startColumn, endRow, endColumn) {
  374. this.start = {
  375. row: startRow,
  376. column: startColumn
  377. };
  378. this.end = {
  379. row: endRow,
  380. column: endColumn
  381. };
  382. };
  383. (function() {
  384. this.isEqual = function(range) {
  385. return this.start.row === range.start.row &&
  386. this.end.row === range.end.row &&
  387. this.start.column === range.start.column &&
  388. this.end.column === range.end.column;
  389. };
  390. this.toString = function() {
  391. return ("Range: [" + this.start.row + "/" + this.start.column +
  392. "] -> [" + this.end.row + "/" + this.end.column + "]");
  393. };
  394. this.contains = function(row, column) {
  395. return this.compare(row, column) == 0;
  396. };
  397. this.compareRange = function(range) {
  398. var cmp,
  399. end = range.end,
  400. start = range.start;
  401. cmp = this.compare(end.row, end.column);
  402. if (cmp == 1) {
  403. cmp = this.compare(start.row, start.column);
  404. if (cmp == 1) {
  405. return 2;
  406. } else if (cmp == 0) {
  407. return 1;
  408. } else {
  409. return 0;
  410. }
  411. } else if (cmp == -1) {
  412. return -2;
  413. } else {
  414. cmp = this.compare(start.row, start.column);
  415. if (cmp == -1) {
  416. return -1;
  417. } else if (cmp == 1) {
  418. return 42;
  419. } else {
  420. return 0;
  421. }
  422. }
  423. };
  424. this.comparePoint = function(p) {
  425. return this.compare(p.row, p.column);
  426. };
  427. this.containsRange = function(range) {
  428. return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
  429. };
  430. this.intersects = function(range) {
  431. var cmp = this.compareRange(range);
  432. return (cmp == -1 || cmp == 0 || cmp == 1);
  433. };
  434. this.isEnd = function(row, column) {
  435. return this.end.row == row && this.end.column == column;
  436. };
  437. this.isStart = function(row, column) {
  438. return this.start.row == row && this.start.column == column;
  439. };
  440. this.setStart = function(row, column) {
  441. if (typeof row == "object") {
  442. this.start.column = row.column;
  443. this.start.row = row.row;
  444. } else {
  445. this.start.row = row;
  446. this.start.column = column;
  447. }
  448. };
  449. this.setEnd = function(row, column) {
  450. if (typeof row == "object") {
  451. this.end.column = row.column;
  452. this.end.row = row.row;
  453. } else {
  454. this.end.row = row;
  455. this.end.column = column;
  456. }
  457. };
  458. this.inside = function(row, column) {
  459. if (this.compare(row, column) == 0) {
  460. if (this.isEnd(row, column) || this.isStart(row, column)) {
  461. return false;
  462. } else {
  463. return true;
  464. }
  465. }
  466. return false;
  467. };
  468. this.insideStart = function(row, column) {
  469. if (this.compare(row, column) == 0) {
  470. if (this.isEnd(row, column)) {
  471. return false;
  472. } else {
  473. return true;
  474. }
  475. }
  476. return false;
  477. };
  478. this.insideEnd = function(row, column) {
  479. if (this.compare(row, column) == 0) {
  480. if (this.isStart(row, column)) {
  481. return false;
  482. } else {
  483. return true;
  484. }
  485. }
  486. return false;
  487. };
  488. this.compare = function(row, column) {
  489. if (!this.isMultiLine()) {
  490. if (row === this.start.row) {
  491. return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
  492. }
  493. }
  494. if (row < this.start.row)
  495. return -1;
  496. if (row > this.end.row)
  497. return 1;
  498. if (this.start.row === row)
  499. return column >= this.start.column ? 0 : -1;
  500. if (this.end.row === row)
  501. return column <= this.end.column ? 0 : 1;
  502. return 0;
  503. };
  504. this.compareStart = function(row, column) {
  505. if (this.start.row == row && this.start.column == column) {
  506. return -1;
  507. } else {
  508. return this.compare(row, column);
  509. }
  510. };
  511. this.compareEnd = function(row, column) {
  512. if (this.end.row == row && this.end.column == column) {
  513. return 1;
  514. } else {
  515. return this.compare(row, column);
  516. }
  517. };
  518. this.compareInside = function(row, column) {
  519. if (this.end.row == row && this.end.column == column) {
  520. return 1;
  521. } else if (this.start.row == row && this.start.column == column) {
  522. return -1;
  523. } else {
  524. return this.compare(row, column);
  525. }
  526. };
  527. this.clipRows = function(firstRow, lastRow) {
  528. if (this.end.row > lastRow)
  529. var end = {row: lastRow + 1, column: 0};
  530. else if (this.end.row < firstRow)
  531. var end = {row: firstRow, column: 0};
  532. if (this.start.row > lastRow)
  533. var start = {row: lastRow + 1, column: 0};
  534. else if (this.start.row < firstRow)
  535. var start = {row: firstRow, column: 0};
  536. return Range.fromPoints(start || this.start, end || this.end);
  537. };
  538. this.extend = function(row, column) {
  539. var cmp = this.compare(row, column);
  540. if (cmp == 0)
  541. return this;
  542. else if (cmp == -1)
  543. var start = {row: row, column: column};
  544. else
  545. var end = {row: row, column: column};
  546. return Range.fromPoints(start || this.start, end || this.end);
  547. };
  548. this.isEmpty = function() {
  549. return (this.start.row === this.end.row && this.start.column === this.end.column);
  550. };
  551. this.isMultiLine = function() {
  552. return (this.start.row !== this.end.row);
  553. };
  554. this.clone = function() {
  555. return Range.fromPoints(this.start, this.end);
  556. };
  557. this.collapseRows = function() {
  558. if (this.end.column == 0)
  559. return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0);
  560. else
  561. return new Range(this.start.row, 0, this.end.row, 0);
  562. };
  563. this.toScreenRange = function(session) {
  564. var screenPosStart = session.documentToScreenPosition(this.start);
  565. var screenPosEnd = session.documentToScreenPosition(this.end);
  566. return new Range(
  567. screenPosStart.row, screenPosStart.column,
  568. screenPosEnd.row, screenPosEnd.column
  569. );
  570. };
  571. this.moveBy = function(row, column) {
  572. this.start.row += row;
  573. this.start.column += column;
  574. this.end.row += row;
  575. this.end.column += column;
  576. };
  577. }).call(Range.prototype);
  578. Range.fromPoints = function(start, end) {
  579. return new Range(start.row, start.column, end.row, end.column);
  580. };
  581. Range.comparePoints = comparePoints;
  582. Range.comparePoints = function(p1, p2) {
  583. return p1.row - p2.row || p1.column - p2.column;
  584. };
  585. exports.Range = Range;
  586. });
  587. ace.define("ace/apply_delta",[], function(require, exports, module) {
  588. "use strict";
  589. function throwDeltaError(delta, errorText){
  590. console.log("Invalid Delta:", delta);
  591. throw "Invalid Delta: " + errorText;
  592. }
  593. function positionInDocument(docLines, position) {
  594. return position.row >= 0 && position.row < docLines.length &&
  595. position.column >= 0 && position.column <= docLines[position.row].length;
  596. }
  597. function validateDelta(docLines, delta) {
  598. if (delta.action != "insert" && delta.action != "remove")
  599. throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
  600. if (!(delta.lines instanceof Array))
  601. throwDeltaError(delta, "delta.lines must be an Array");
  602. if (!delta.start || !delta.end)
  603. throwDeltaError(delta, "delta.start/end must be an present");
  604. var start = delta.start;
  605. if (!positionInDocument(docLines, delta.start))
  606. throwDeltaError(delta, "delta.start must be contained in document");
  607. var end = delta.end;
  608. if (delta.action == "remove" && !positionInDocument(docLines, end))
  609. throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
  610. var numRangeRows = end.row - start.row;
  611. var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
  612. if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
  613. throwDeltaError(delta, "delta.range must match delta lines");
  614. }
  615. exports.applyDelta = function(docLines, delta, doNotValidate) {
  616. var row = delta.start.row;
  617. var startColumn = delta.start.column;
  618. var line = docLines[row] || "";
  619. switch (delta.action) {
  620. case "insert":
  621. var lines = delta.lines;
  622. if (lines.length === 1) {
  623. docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
  624. } else {
  625. var args = [row, 1].concat(delta.lines);
  626. docLines.splice.apply(docLines, args);
  627. docLines[row] = line.substring(0, startColumn) + docLines[row];
  628. docLines[row + delta.lines.length - 1] += line.substring(startColumn);
  629. }
  630. break;
  631. case "remove":
  632. var endColumn = delta.end.column;
  633. var endRow = delta.end.row;
  634. if (row === endRow) {
  635. docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
  636. } else {
  637. docLines.splice(
  638. row, endRow - row + 1,
  639. line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
  640. );
  641. }
  642. break;
  643. }
  644. };
  645. });
  646. ace.define("ace/lib/event_emitter",[], function(require, exports, module) {
  647. "use strict";
  648. var EventEmitter = {};
  649. var stopPropagation = function() { this.propagationStopped = true; };
  650. var preventDefault = function() { this.defaultPrevented = true; };
  651. EventEmitter._emit =
  652. EventEmitter._dispatchEvent = function(eventName, e) {
  653. this._eventRegistry || (this._eventRegistry = {});
  654. this._defaultHandlers || (this._defaultHandlers = {});
  655. var listeners = this._eventRegistry[eventName] || [];
  656. var defaultHandler = this._defaultHandlers[eventName];
  657. if (!listeners.length && !defaultHandler)
  658. return;
  659. if (typeof e != "object" || !e)
  660. e = {};
  661. if (!e.type)
  662. e.type = eventName;
  663. if (!e.stopPropagation)
  664. e.stopPropagation = stopPropagation;
  665. if (!e.preventDefault)
  666. e.preventDefault = preventDefault;
  667. listeners = listeners.slice();
  668. for (var i=0; i<listeners.length; i++) {
  669. listeners[i](e, this);
  670. if (e.propagationStopped)
  671. break;
  672. }
  673. if (defaultHandler && !e.defaultPrevented)
  674. return defaultHandler(e, this);
  675. };
  676. EventEmitter._signal = function(eventName, e) {
  677. var listeners = (this._eventRegistry || {})[eventName];
  678. if (!listeners)
  679. return;
  680. listeners = listeners.slice();
  681. for (var i=0; i<listeners.length; i++)
  682. listeners[i](e, this);
  683. };
  684. EventEmitter.once = function(eventName, callback) {
  685. var _self = this;
  686. this.on(eventName, function newCallback() {
  687. _self.off(eventName, newCallback);
  688. callback.apply(null, arguments);
  689. });
  690. if (!callback) {
  691. return new Promise(function(resolve) {
  692. callback = resolve;
  693. });
  694. }
  695. };
  696. EventEmitter.setDefaultHandler = function(eventName, callback) {
  697. var handlers = this._defaultHandlers;
  698. if (!handlers)
  699. handlers = this._defaultHandlers = {_disabled_: {}};
  700. if (handlers[eventName]) {
  701. var old = handlers[eventName];
  702. var disabled = handlers._disabled_[eventName];
  703. if (!disabled)
  704. handlers._disabled_[eventName] = disabled = [];
  705. disabled.push(old);
  706. var i = disabled.indexOf(callback);
  707. if (i != -1)
  708. disabled.splice(i, 1);
  709. }
  710. handlers[eventName] = callback;
  711. };
  712. EventEmitter.removeDefaultHandler = function(eventName, callback) {
  713. var handlers = this._defaultHandlers;
  714. if (!handlers)
  715. return;
  716. var disabled = handlers._disabled_[eventName];
  717. if (handlers[eventName] == callback) {
  718. if (disabled)
  719. this.setDefaultHandler(eventName, disabled.pop());
  720. } else if (disabled) {
  721. var i = disabled.indexOf(callback);
  722. if (i != -1)
  723. disabled.splice(i, 1);
  724. }
  725. };
  726. EventEmitter.on =
  727. EventEmitter.addEventListener = function(eventName, callback, capturing) {
  728. this._eventRegistry = this._eventRegistry || {};
  729. var listeners = this._eventRegistry[eventName];
  730. if (!listeners)
  731. listeners = this._eventRegistry[eventName] = [];
  732. if (listeners.indexOf(callback) == -1)
  733. listeners[capturing ? "unshift" : "push"](callback);
  734. return callback;
  735. };
  736. EventEmitter.off =
  737. EventEmitter.removeListener =
  738. EventEmitter.removeEventListener = function(eventName, callback) {
  739. this._eventRegistry = this._eventRegistry || {};
  740. var listeners = this._eventRegistry[eventName];
  741. if (!listeners)
  742. return;
  743. var index = listeners.indexOf(callback);
  744. if (index !== -1)
  745. listeners.splice(index, 1);
  746. };
  747. EventEmitter.removeAllListeners = function(eventName) {
  748. if (!eventName) this._eventRegistry = this._defaultHandlers = undefined;
  749. if (this._eventRegistry) this._eventRegistry[eventName] = undefined;
  750. if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined;
  751. };
  752. exports.EventEmitter = EventEmitter;
  753. });
  754. ace.define("ace/anchor",[], function(require, exports, module) {
  755. "use strict";
  756. var oop = require("./lib/oop");
  757. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  758. var Anchor = exports.Anchor = function(doc, row, column) {
  759. this.$onChange = this.onChange.bind(this);
  760. this.attach(doc);
  761. if (typeof column == "undefined")
  762. this.setPosition(row.row, row.column);
  763. else
  764. this.setPosition(row, column);
  765. };
  766. (function() {
  767. oop.implement(this, EventEmitter);
  768. this.getPosition = function() {
  769. return this.$clipPositionToDocument(this.row, this.column);
  770. };
  771. this.getDocument = function() {
  772. return this.document;
  773. };
  774. this.$insertRight = false;
  775. this.onChange = function(delta) {
  776. if (delta.start.row == delta.end.row && delta.start.row != this.row)
  777. return;
  778. if (delta.start.row > this.row)
  779. return;
  780. var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
  781. this.setPosition(point.row, point.column, true);
  782. };
  783. function $pointsInOrder(point1, point2, equalPointsInOrder) {
  784. var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
  785. return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
  786. }
  787. function $getTransformedPoint(delta, point, moveIfEqual) {
  788. var deltaIsInsert = delta.action == "insert";
  789. var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
  790. var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
  791. var deltaStart = delta.start;
  792. var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
  793. if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
  794. return {
  795. row: point.row,
  796. column: point.column
  797. };
  798. }
  799. if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
  800. return {
  801. row: point.row + deltaRowShift,
  802. column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
  803. };
  804. }
  805. return {
  806. row: deltaStart.row,
  807. column: deltaStart.column
  808. };
  809. }
  810. this.setPosition = function(row, column, noClip) {
  811. var pos;
  812. if (noClip) {
  813. pos = {
  814. row: row,
  815. column: column
  816. };
  817. } else {
  818. pos = this.$clipPositionToDocument(row, column);
  819. }
  820. if (this.row == pos.row && this.column == pos.column)
  821. return;
  822. var old = {
  823. row: this.row,
  824. column: this.column
  825. };
  826. this.row = pos.row;
  827. this.column = pos.column;
  828. this._signal("change", {
  829. old: old,
  830. value: pos
  831. });
  832. };
  833. this.detach = function() {
  834. this.document.off("change", this.$onChange);
  835. };
  836. this.attach = function(doc) {
  837. this.document = doc || this.document;
  838. this.document.on("change", this.$onChange);
  839. };
  840. this.$clipPositionToDocument = function(row, column) {
  841. var pos = {};
  842. if (row >= this.document.getLength()) {
  843. pos.row = Math.max(0, this.document.getLength() - 1);
  844. pos.column = this.document.getLine(pos.row).length;
  845. }
  846. else if (row < 0) {
  847. pos.row = 0;
  848. pos.column = 0;
  849. }
  850. else {
  851. pos.row = row;
  852. pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
  853. }
  854. if (column < 0)
  855. pos.column = 0;
  856. return pos;
  857. };
  858. }).call(Anchor.prototype);
  859. });
  860. ace.define("ace/document",[], function(require, exports, module) {
  861. "use strict";
  862. var oop = require("./lib/oop");
  863. var applyDelta = require("./apply_delta").applyDelta;
  864. var EventEmitter = require("./lib/event_emitter").EventEmitter;
  865. var Range = require("./range").Range;
  866. var Anchor = require("./anchor").Anchor;
  867. var Document = function(textOrLines) {
  868. this.$lines = [""];
  869. if (textOrLines.length === 0) {
  870. this.$lines = [""];
  871. } else if (Array.isArray(textOrLines)) {
  872. this.insertMergedLines({row: 0, column: 0}, textOrLines);
  873. } else {
  874. this.insert({row: 0, column:0}, textOrLines);
  875. }
  876. };
  877. (function() {
  878. oop.implement(this, EventEmitter);
  879. this.setValue = function(text) {
  880. var len = this.getLength() - 1;
  881. this.remove(new Range(0, 0, len, this.getLine(len).length));
  882. this.insert({row: 0, column: 0}, text);
  883. };
  884. this.getValue = function() {
  885. return this.getAllLines().join(this.getNewLineCharacter());
  886. };
  887. this.createAnchor = function(row, column) {
  888. return new Anchor(this, row, column);
  889. };
  890. if ("aaa".split(/a/).length === 0) {
  891. this.$split = function(text) {
  892. return text.replace(/\r\n|\r/g, "\n").split("\n");
  893. };
  894. } else {
  895. this.$split = function(text) {
  896. return text.split(/\r\n|\r|\n/);
  897. };
  898. }
  899. this.$detectNewLine = function(text) {
  900. var match = text.match(/^.*?(\r\n|\r|\n)/m);
  901. this.$autoNewLine = match ? match[1] : "\n";
  902. this._signal("changeNewLineMode");
  903. };
  904. this.getNewLineCharacter = function() {
  905. switch (this.$newLineMode) {
  906. case "windows":
  907. return "\r\n";
  908. case "unix":
  909. return "\n";
  910. default:
  911. return this.$autoNewLine || "\n";
  912. }
  913. };
  914. this.$autoNewLine = "";
  915. this.$newLineMode = "auto";
  916. this.setNewLineMode = function(newLineMode) {
  917. if (this.$newLineMode === newLineMode)
  918. return;
  919. this.$newLineMode = newLineMode;
  920. this._signal("changeNewLineMode");
  921. };
  922. this.getNewLineMode = function() {
  923. return this.$newLineMode;
  924. };
  925. this.isNewLine = function(text) {
  926. return (text == "\r\n" || text == "\r" || text == "\n");
  927. };
  928. this.getLine = function(row) {
  929. return this.$lines[row] || "";
  930. };
  931. this.getLines = function(firstRow, lastRow) {
  932. return this.$lines.slice(firstRow, lastRow + 1);
  933. };
  934. this.getAllLines = function() {
  935. return this.getLines(0, this.getLength());
  936. };
  937. this.getLength = function() {
  938. return this.$lines.length;
  939. };
  940. this.getTextRange = function(range) {
  941. return this.getLinesForRange(range).join(this.getNewLineCharacter());
  942. };
  943. this.getLinesForRange = function(range) {
  944. var lines;
  945. if (range.start.row === range.end.row) {
  946. lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
  947. } else {
  948. lines = this.getLines(range.start.row, range.end.row);
  949. lines[0] = (lines[0] || "").substring(range.start.column);
  950. var l = lines.length - 1;
  951. if (range.end.row - range.start.row == l)
  952. lines[l] = lines[l].substring(0, range.end.column);
  953. }
  954. return lines;
  955. };
  956. this.insertLines = function(row, lines) {
  957. console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
  958. return this.insertFullLines(row, lines);
  959. };
  960. this.removeLines = function(firstRow, lastRow) {
  961. console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
  962. return this.removeFullLines(firstRow, lastRow);
  963. };
  964. this.insertNewLine = function(position) {
  965. console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
  966. return this.insertMergedLines(position, ["", ""]);
  967. };
  968. this.insert = function(position, text) {
  969. if (this.getLength() <= 1)
  970. this.$detectNewLine(text);
  971. return this.insertMergedLines(position, this.$split(text));
  972. };
  973. this.insertInLine = function(position, text) {
  974. var start = this.clippedPos(position.row, position.column);
  975. var end = this.pos(position.row, position.column + text.length);
  976. this.applyDelta({
  977. start: start,
  978. end: end,
  979. action: "insert",
  980. lines: [text]
  981. }, true);
  982. return this.clonePos(end);
  983. };
  984. this.clippedPos = function(row, column) {
  985. var length = this.getLength();
  986. if (row === undefined) {
  987. row = length;
  988. } else if (row < 0) {
  989. row = 0;
  990. } else if (row >= length) {
  991. row = length - 1;
  992. column = undefined;
  993. }
  994. var line = this.getLine(row);
  995. if (column == undefined)
  996. column = line.length;
  997. column = Math.min(Math.max(column, 0), line.length);
  998. return {row: row, column: column};
  999. };
  1000. this.clonePos = function(pos) {
  1001. return {row: pos.row, column: pos.column};
  1002. };
  1003. this.pos = function(row, column) {
  1004. return {row: row, column: column};
  1005. };
  1006. this.$clipPosition = function(position) {
  1007. var length = this.getLength();
  1008. if (position.row >= length) {
  1009. position.row = Math.max(0, length - 1);
  1010. position.column = this.getLine(length - 1).length;
  1011. } else {
  1012. position.row = Math.max(0, position.row);
  1013. position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
  1014. }
  1015. return position;
  1016. };
  1017. this.insertFullLines = function(row, lines) {
  1018. row = Math.min(Math.max(row, 0), this.getLength());
  1019. var column = 0;
  1020. if (row < this.getLength()) {
  1021. lines = lines.concat([""]);
  1022. column = 0;
  1023. } else {
  1024. lines = [""].concat(lines);
  1025. row--;
  1026. column = this.$lines[row].length;
  1027. }
  1028. this.insertMergedLines({row: row, column: column}, lines);
  1029. };
  1030. this.insertMergedLines = function(position, lines) {
  1031. var start = this.clippedPos(position.row, position.column);
  1032. var end = {
  1033. row: start.row + lines.length - 1,
  1034. column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
  1035. };
  1036. this.applyDelta({
  1037. start: start,
  1038. end: end,
  1039. action: "insert",
  1040. lines: lines
  1041. });
  1042. return this.clonePos(end);
  1043. };
  1044. this.remove = function(range) {
  1045. var start = this.clippedPos(range.start.row, range.start.column);
  1046. var end = this.clippedPos(range.end.row, range.end.column);
  1047. this.applyDelta({
  1048. start: start,
  1049. end: end,
  1050. action: "remove",
  1051. lines: this.getLinesForRange({start: start, end: end})
  1052. });
  1053. return this.clonePos(start);
  1054. };
  1055. this.removeInLine = function(row, startColumn, endColumn) {
  1056. var start = this.clippedPos(row, startColumn);
  1057. var end = this.clippedPos(row, endColumn);
  1058. this.applyDelta({
  1059. start: start,
  1060. end: end,
  1061. action: "remove",
  1062. lines: this.getLinesForRange({start: start, end: end})
  1063. }, true);
  1064. return this.clonePos(start);
  1065. };
  1066. this.removeFullLines = function(firstRow, lastRow) {
  1067. firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
  1068. lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
  1069. var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
  1070. var deleteLastNewLine = lastRow < this.getLength() - 1;
  1071. var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
  1072. var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
  1073. var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
  1074. var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
  1075. var range = new Range(startRow, startCol, endRow, endCol);
  1076. var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
  1077. this.applyDelta({
  1078. start: range.start,
  1079. end: range.end,
  1080. action: "remove",
  1081. lines: this.getLinesForRange(range)
  1082. });
  1083. return deletedLines;
  1084. };
  1085. this.removeNewLine = function(row) {
  1086. if (row < this.getLength() - 1 && row >= 0) {
  1087. this.applyDelta({
  1088. start: this.pos(row, this.getLine(row).length),
  1089. end: this.pos(row + 1, 0),
  1090. action: "remove",
  1091. lines: ["", ""]
  1092. });
  1093. }
  1094. };
  1095. this.replace = function(range, text) {
  1096. if (!(range instanceof Range))
  1097. range = Range.fromPoints(range.start, range.end);
  1098. if (text.length === 0 && range.isEmpty())
  1099. return range.start;
  1100. if (text == this.getTextRange(range))
  1101. return range.end;
  1102. this.remove(range);
  1103. var end;
  1104. if (text) {
  1105. end = this.insert(range.start, text);
  1106. }
  1107. else {
  1108. end = range.start;
  1109. }
  1110. return end;
  1111. };
  1112. this.applyDeltas = function(deltas) {
  1113. for (var i=0; i<deltas.length; i++) {
  1114. this.applyDelta(deltas[i]);
  1115. }
  1116. };
  1117. this.revertDeltas = function(deltas) {
  1118. for (var i=deltas.length-1; i>=0; i--) {
  1119. this.revertDelta(deltas[i]);
  1120. }
  1121. };
  1122. this.applyDelta = function(delta, doNotValidate) {
  1123. var isInsert = delta.action == "insert";
  1124. if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
  1125. : !Range.comparePoints(delta.start, delta.end)) {
  1126. return;
  1127. }
  1128. if (isInsert && delta.lines.length > 20000) {
  1129. this.$splitAndapplyLargeDelta(delta, 20000);
  1130. }
  1131. else {
  1132. applyDelta(this.$lines, delta, doNotValidate);
  1133. this._signal("change", delta);
  1134. }
  1135. };
  1136. this.$safeApplyDelta = function(delta) {
  1137. var docLength = this.$lines.length;
  1138. if (
  1139. delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength
  1140. || delta.action == "insert" && delta.start.row <= docLength
  1141. ) {
  1142. this.applyDelta(delta);
  1143. }
  1144. };
  1145. this.$splitAndapplyLargeDelta = function(delta, MAX) {
  1146. var lines = delta.lines;
  1147. var l = lines.length - MAX + 1;
  1148. var row = delta.start.row;
  1149. var column = delta.start.column;
  1150. for (var from = 0, to = 0; from < l; from = to) {
  1151. to += MAX - 1;
  1152. var chunk = lines.slice(from, to);
  1153. chunk.push("");
  1154. this.applyDelta({
  1155. start: this.pos(row + from, column),
  1156. end: this.pos(row + to, column = 0),
  1157. action: delta.action,
  1158. lines: chunk
  1159. }, true);
  1160. }
  1161. delta.lines = lines.slice(from);
  1162. delta.start.row = row + from;
  1163. delta.start.column = column;
  1164. this.applyDelta(delta, true);
  1165. };
  1166. this.revertDelta = function(delta) {
  1167. this.$safeApplyDelta({
  1168. start: this.clonePos(delta.start),
  1169. end: this.clonePos(delta.end),
  1170. action: (delta.action == "insert" ? "remove" : "insert"),
  1171. lines: delta.lines.slice()
  1172. });
  1173. };
  1174. this.indexToPosition = function(index, startRow) {
  1175. var lines = this.$lines || this.getAllLines();
  1176. var newlineLength = this.getNewLineCharacter().length;
  1177. for (var i = startRow || 0, l = lines.length; i < l; i++) {
  1178. index -= lines[i].length + newlineLength;
  1179. if (index < 0)
  1180. return {row: i, column: index + lines[i].length + newlineLength};
  1181. }
  1182. return {row: l-1, column: index + lines[l-1].length + newlineLength};
  1183. };
  1184. this.positionToIndex = function(pos, startRow) {
  1185. var lines = this.$lines || this.getAllLines();
  1186. var newlineLength = this.getNewLineCharacter().length;
  1187. var index = 0;
  1188. var row = Math.min(pos.row, lines.length);
  1189. for (var i = startRow || 0; i < row; ++i)
  1190. index += lines[i].length + newlineLength;
  1191. return index + pos.column;
  1192. };
  1193. }).call(Document.prototype);
  1194. exports.Document = Document;
  1195. });
  1196. ace.define("ace/worker/mirror",[], function(require, exports, module) {
  1197. "use strict";
  1198. var Range = require("../range").Range;
  1199. var Document = require("../document").Document;
  1200. var lang = require("../lib/lang");
  1201. var Mirror = exports.Mirror = function(sender) {
  1202. this.sender = sender;
  1203. var doc = this.doc = new Document("");
  1204. var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
  1205. var _self = this;
  1206. sender.on("change", function(e) {
  1207. var data = e.data;
  1208. if (data[0].start) {
  1209. doc.applyDeltas(data);
  1210. } else {
  1211. for (var i = 0; i < data.length; i += 2) {
  1212. if (Array.isArray(data[i+1])) {
  1213. var d = {action: "insert", start: data[i], lines: data[i+1]};
  1214. } else {
  1215. var d = {action: "remove", start: data[i], end: data[i+1]};
  1216. }
  1217. doc.applyDelta(d, true);
  1218. }
  1219. }
  1220. if (_self.$timeout)
  1221. return deferredUpdate.schedule(_self.$timeout);
  1222. _self.onUpdate();
  1223. });
  1224. };
  1225. (function() {
  1226. this.$timeout = 500;
  1227. this.setTimeout = function(timeout) {
  1228. this.$timeout = timeout;
  1229. };
  1230. this.setValue = function(value) {
  1231. this.doc.setValue(value);
  1232. this.deferredUpdate.schedule(this.$timeout);
  1233. };
  1234. this.getValue = function(callbackId) {
  1235. this.sender.callback(this.doc.getValue(), callbackId);
  1236. };
  1237. this.onUpdate = function() {
  1238. };
  1239. this.isPending = function() {
  1240. return this.deferredUpdate.isPending();
  1241. };
  1242. }).call(Mirror.prototype);
  1243. });
  1244. ace.define("ace/mode/html/saxparser",[], function(require, exports, module) {
  1245. 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})({
  1246. 1:[function(_dereq_,module,exports){
  1247. function isScopeMarker(node) {
  1248. if (node.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1249. return node.localName === "applet"
  1250. || node.localName === "caption"
  1251. || node.localName === "marquee"
  1252. || node.localName === "object"
  1253. || node.localName === "table"
  1254. || node.localName === "td"
  1255. || node.localName === "th";
  1256. }
  1257. if (node.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1258. return node.localName === "mi"
  1259. || node.localName === "mo"
  1260. || node.localName === "mn"
  1261. || node.localName === "ms"
  1262. || node.localName === "mtext"
  1263. || node.localName === "annotation-xml";
  1264. }
  1265. if (node.namespaceURI === "http://www.w3.org/2000/svg") {
  1266. return node.localName === "foreignObject"
  1267. || node.localName === "desc"
  1268. || node.localName === "title";
  1269. }
  1270. }
  1271. function isListItemScopeMarker(node) {
  1272. return isScopeMarker(node)
  1273. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ol')
  1274. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ul');
  1275. }
  1276. function isTableScopeMarker(node) {
  1277. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'table')
  1278. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1279. }
  1280. function isTableBodyScopeMarker(node) {
  1281. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tbody')
  1282. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tfoot')
  1283. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'thead')
  1284. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1285. }
  1286. function isTableRowScopeMarker(node) {
  1287. return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tr')
  1288. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html');
  1289. }
  1290. function isButtonScopeMarker(node) {
  1291. return isScopeMarker(node)
  1292. || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'button');
  1293. }
  1294. function isSelectScopeMarker(node) {
  1295. return !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'optgroup')
  1296. && !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'option');
  1297. }
  1298. function ElementStack() {
  1299. this.elements = [];
  1300. this.rootNode = null;
  1301. this.headElement = null;
  1302. this.bodyElement = null;
  1303. }
  1304. ElementStack.prototype._inScope = function(localName, isMarker) {
  1305. for (var i = this.elements.length - 1; i >= 0; i--) {
  1306. var node = this.elements[i];
  1307. if (node.localName === localName)
  1308. return true;
  1309. if (isMarker(node))
  1310. return false;
  1311. }
  1312. };
  1313. ElementStack.prototype.push = function(item) {
  1314. this.elements.push(item);
  1315. };
  1316. ElementStack.prototype.pushHtmlElement = function(item) {
  1317. this.rootNode = item.node;
  1318. this.push(item);
  1319. };
  1320. ElementStack.prototype.pushHeadElement = function(item) {
  1321. this.headElement = item.node;
  1322. this.push(item);
  1323. };
  1324. ElementStack.prototype.pushBodyElement = function(item) {
  1325. this.bodyElement = item.node;
  1326. this.push(item);
  1327. };
  1328. ElementStack.prototype.pop = function() {
  1329. return this.elements.pop();
  1330. };
  1331. ElementStack.prototype.remove = function(item) {
  1332. this.elements.splice(this.elements.indexOf(item), 1);
  1333. };
  1334. ElementStack.prototype.popUntilPopped = function(localName) {
  1335. var element;
  1336. do {
  1337. element = this.pop();
  1338. } while (element.localName != localName);
  1339. };
  1340. ElementStack.prototype.popUntilTableScopeMarker = function() {
  1341. while (!isTableScopeMarker(this.top))
  1342. this.pop();
  1343. };
  1344. ElementStack.prototype.popUntilTableBodyScopeMarker = function() {
  1345. while (!isTableBodyScopeMarker(this.top))
  1346. this.pop();
  1347. };
  1348. ElementStack.prototype.popUntilTableRowScopeMarker = function() {
  1349. while (!isTableRowScopeMarker(this.top))
  1350. this.pop();
  1351. };
  1352. ElementStack.prototype.item = function(index) {
  1353. return this.elements[index];
  1354. };
  1355. ElementStack.prototype.contains = function(element) {
  1356. return this.elements.indexOf(element) !== -1;
  1357. };
  1358. ElementStack.prototype.inScope = function(localName) {
  1359. return this._inScope(localName, isScopeMarker);
  1360. };
  1361. ElementStack.prototype.inListItemScope = function(localName) {
  1362. return this._inScope(localName, isListItemScopeMarker);
  1363. };
  1364. ElementStack.prototype.inTableScope = function(localName) {
  1365. return this._inScope(localName, isTableScopeMarker);
  1366. };
  1367. ElementStack.prototype.inButtonScope = function(localName) {
  1368. return this._inScope(localName, isButtonScopeMarker);
  1369. };
  1370. ElementStack.prototype.inSelectScope = function(localName) {
  1371. return this._inScope(localName, isSelectScopeMarker);
  1372. };
  1373. ElementStack.prototype.hasNumberedHeaderElementInScope = function() {
  1374. for (var i = this.elements.length - 1; i >= 0; i--) {
  1375. var node = this.elements[i];
  1376. if (node.isNumberedHeader())
  1377. return true;
  1378. if (isScopeMarker(node))
  1379. return false;
  1380. }
  1381. };
  1382. ElementStack.prototype.furthestBlockForFormattingElement = function(element) {
  1383. var furthestBlock = null;
  1384. for (var i = this.elements.length - 1; i >= 0; i--) {
  1385. var node = this.elements[i];
  1386. if (node.node === element)
  1387. break;
  1388. if (node.isSpecial())
  1389. furthestBlock = node;
  1390. }
  1391. return furthestBlock;
  1392. };
  1393. ElementStack.prototype.findIndex = function(localName) {
  1394. for (var i = this.elements.length - 1; i >= 0; i--) {
  1395. if (this.elements[i].localName == localName)
  1396. return i;
  1397. }
  1398. return -1;
  1399. };
  1400. ElementStack.prototype.remove_openElements_until = function(callback) {
  1401. var finished = false;
  1402. var element;
  1403. while (!finished) {
  1404. element = this.elements.pop();
  1405. finished = callback(element);
  1406. }
  1407. return element;
  1408. };
  1409. Object.defineProperty(ElementStack.prototype, 'top', {
  1410. get: function() {
  1411. return this.elements[this.elements.length - 1];
  1412. }
  1413. });
  1414. Object.defineProperty(ElementStack.prototype, 'length', {
  1415. get: function() {
  1416. return this.elements.length;
  1417. }
  1418. });
  1419. exports.ElementStack = ElementStack;
  1420. },
  1421. {}],
  1422. 2:[function(_dereq_,module,exports){
  1423. var entities = _dereq_('html5-entities');
  1424. var InputStream = _dereq_('./InputStream').InputStream;
  1425. var namedEntityPrefixes = {};
  1426. Object.keys(entities).forEach(function (entityKey) {
  1427. for (var i = 0; i < entityKey.length; i++) {
  1428. namedEntityPrefixes[entityKey.substring(0, i + 1)] = true;
  1429. }
  1430. });
  1431. function isAlphaNumeric(c) {
  1432. return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
  1433. }
  1434. function isHexDigit(c) {
  1435. return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
  1436. }
  1437. function isDecimalDigit(c) {
  1438. return (c >= '0' && c <= '9');
  1439. }
  1440. var EntityParser = {};
  1441. EntityParser.consumeEntity = function(buffer, tokenizer, additionalAllowedCharacter) {
  1442. var decodedCharacter = '';
  1443. var consumedCharacters = '';
  1444. var ch = buffer.char();
  1445. if (ch === InputStream.EOF)
  1446. return false;
  1447. consumedCharacters += ch;
  1448. if (ch == '\t' || ch == '\n' || ch == '\v' || ch == ' ' || ch == '<' || ch == '&') {
  1449. buffer.unget(consumedCharacters);
  1450. return false;
  1451. }
  1452. if (additionalAllowedCharacter === ch) {
  1453. buffer.unget(consumedCharacters);
  1454. return false;
  1455. }
  1456. if (ch == '#') {
  1457. ch = buffer.shift(1);
  1458. if (ch === InputStream.EOF) {
  1459. tokenizer._parseError("expected-numeric-entity-but-got-eof");
  1460. buffer.unget(consumedCharacters);
  1461. return false;
  1462. }
  1463. consumedCharacters += ch;
  1464. var radix = 10;
  1465. var isDigit = isDecimalDigit;
  1466. if (ch == 'x' || ch == 'X') {
  1467. radix = 16;
  1468. isDigit = isHexDigit;
  1469. ch = buffer.shift(1);
  1470. if (ch === InputStream.EOF) {
  1471. tokenizer._parseError("expected-numeric-entity-but-got-eof");
  1472. buffer.unget(consumedCharacters);
  1473. return false;
  1474. }
  1475. consumedCharacters += ch;
  1476. }
  1477. if (isDigit(ch)) {
  1478. var code = '';
  1479. while (ch !== InputStream.EOF && isDigit(ch)) {
  1480. code += ch;
  1481. ch = buffer.char();
  1482. }
  1483. code = parseInt(code, radix);
  1484. var replacement = this.replaceEntityNumbers(code);
  1485. if (replacement) {
  1486. tokenizer._parseError("invalid-numeric-entity-replaced");
  1487. code = replacement;
  1488. }
  1489. if (code > 0xFFFF && code <= 0x10FFFF) {
  1490. code -= 0x10000;
  1491. var first = ((0xffc00 & code) >> 10) + 0xD800;
  1492. var second = (0x3ff & code) + 0xDC00;
  1493. decodedCharacter = String.fromCharCode(first, second);
  1494. } else
  1495. decodedCharacter = String.fromCharCode(code);
  1496. if (ch !== ';') {
  1497. tokenizer._parseError("numeric-entity-without-semicolon");
  1498. buffer.unget(ch);
  1499. }
  1500. return decodedCharacter;
  1501. }
  1502. buffer.unget(consumedCharacters);
  1503. tokenizer._parseError("expected-numeric-entity");
  1504. return false;
  1505. }
  1506. if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
  1507. var mostRecentMatch = '';
  1508. while (namedEntityPrefixes[consumedCharacters]) {
  1509. if (entities[consumedCharacters]) {
  1510. mostRecentMatch = consumedCharacters;
  1511. }
  1512. if (ch == ';')
  1513. break;
  1514. ch = buffer.char();
  1515. if (ch === InputStream.EOF)
  1516. break;
  1517. consumedCharacters += ch;
  1518. }
  1519. if (!mostRecentMatch) {
  1520. tokenizer._parseError("expected-named-entity");
  1521. buffer.unget(consumedCharacters);
  1522. return false;
  1523. }
  1524. decodedCharacter = entities[mostRecentMatch];
  1525. if (ch === ';' || !additionalAllowedCharacter || !(isAlphaNumeric(ch) || ch === '=')) {
  1526. if (consumedCharacters.length > mostRecentMatch.length) {
  1527. buffer.unget(consumedCharacters.substring(mostRecentMatch.length));
  1528. }
  1529. if (ch !== ';') {
  1530. tokenizer._parseError("named-entity-without-semicolon");
  1531. }
  1532. return decodedCharacter;
  1533. }
  1534. buffer.unget(consumedCharacters);
  1535. return false;
  1536. }
  1537. };
  1538. EntityParser.replaceEntityNumbers = function(c) {
  1539. switch(c) {
  1540. case 0x00: return 0xFFFD; // REPLACEMENT CHARACTER
  1541. case 0x13: return 0x0010; // Carriage return
  1542. case 0x80: return 0x20AC; // EURO SIGN
  1543. case 0x81: return 0x0081; // <control>
  1544. case 0x82: return 0x201A; // SINGLE LOW-9 QUOTATION MARK
  1545. case 0x83: return 0x0192; // LATIN SMALL LETTER F WITH HOOK
  1546. case 0x84: return 0x201E; // DOUBLE LOW-9 QUOTATION MARK
  1547. case 0x85: return 0x2026; // HORIZONTAL ELLIPSIS
  1548. case 0x86: return 0x2020; // DAGGER
  1549. case 0x87: return 0x2021; // DOUBLE DAGGER
  1550. case 0x88: return 0x02C6; // MODIFIER LETTER CIRCUMFLEX ACCENT
  1551. case 0x89: return 0x2030; // PER MILLE SIGN
  1552. case 0x8A: return 0x0160; // LATIN CAPITAL LETTER S WITH CARON
  1553. case 0x8B: return 0x2039; // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
  1554. case 0x8C: return 0x0152; // LATIN CAPITAL LIGATURE OE
  1555. case 0x8D: return 0x008D; // <control>
  1556. case 0x8E: return 0x017D; // LATIN CAPITAL LETTER Z WITH CARON
  1557. case 0x8F: return 0x008F; // <control>
  1558. case 0x90: return 0x0090; // <control>
  1559. case 0x91: return 0x2018; // LEFT SINGLE QUOTATION MARK
  1560. case 0x92: return 0x2019; // RIGHT SINGLE QUOTATION MARK
  1561. case 0x93: return 0x201C; // LEFT DOUBLE QUOTATION MARK
  1562. case 0x94: return 0x201D; // RIGHT DOUBLE QUOTATION MARK
  1563. case 0x95: return 0x2022; // BULLET
  1564. case 0x96: return 0x2013; // EN DASH
  1565. case 0x97: return 0x2014; // EM DASH
  1566. case 0x98: return 0x02DC; // SMALL TILDE
  1567. case 0x99: return 0x2122; // TRADE MARK SIGN
  1568. case 0x9A: return 0x0161; // LATIN SMALL LETTER S WITH CARON
  1569. case 0x9B: return 0x203A; // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
  1570. case 0x9C: return 0x0153; // LATIN SMALL LIGATURE OE
  1571. case 0x9D: return 0x009D; // <control>
  1572. case 0x9E: return 0x017E; // LATIN SMALL LETTER Z WITH CARON
  1573. case 0x9F: return 0x0178; // LATIN CAPITAL LETTER Y WITH DIAERESIS
  1574. default:
  1575. if ((c >= 0xD800 && c <= 0xDFFF) || c > 0x10FFFF) {
  1576. return 0xFFFD;
  1577. } else if ((c >= 0x0001 && c <= 0x0008) || (c >= 0x000E && c <= 0x001F) ||
  1578. (c >= 0x007F && c <= 0x009F) || (c >= 0xFDD0 && c <= 0xFDEF) ||
  1579. c == 0x000B || c == 0xFFFE || c == 0x1FFFE || c == 0x2FFFFE ||
  1580. c == 0x2FFFF || c == 0x3FFFE || c == 0x3FFFF || c == 0x4FFFE ||
  1581. c == 0x4FFFF || c == 0x5FFFE || c == 0x5FFFF || c == 0x6FFFE ||
  1582. c == 0x6FFFF || c == 0x7FFFE || c == 0x7FFFF || c == 0x8FFFE ||
  1583. c == 0x8FFFF || c == 0x9FFFE || c == 0x9FFFF || c == 0xAFFFE ||
  1584. c == 0xAFFFF || c == 0xBFFFE || c == 0xBFFFF || c == 0xCFFFE ||
  1585. c == 0xCFFFF || c == 0xDFFFE || c == 0xDFFFF || c == 0xEFFFE ||
  1586. c == 0xEFFFF || c == 0xFFFFE || c == 0xFFFFF || c == 0x10FFFE ||
  1587. c == 0x10FFFF) {
  1588. return c;
  1589. }
  1590. }
  1591. };
  1592. exports.EntityParser = EntityParser;
  1593. },
  1594. {"./InputStream":3,"html5-entities":12}],
  1595. 3:[function(_dereq_,module,exports){
  1596. function InputStream() {
  1597. this.data = '';
  1598. this.start = 0;
  1599. this.committed = 0;
  1600. this.eof = false;
  1601. this.lastLocation = {line: 0, column: 0};
  1602. }
  1603. InputStream.EOF = -1;
  1604. InputStream.DRAIN = -2;
  1605. InputStream.prototype = {
  1606. slice: function() {
  1607. if(this.start >= this.data.length) {
  1608. if(!this.eof) throw InputStream.DRAIN;
  1609. return InputStream.EOF;
  1610. }
  1611. return this.data.slice(this.start, this.data.length);
  1612. },
  1613. char: function() {
  1614. if(!this.eof && this.start >= this.data.length - 1) throw InputStream.DRAIN;
  1615. if(this.start >= this.data.length) {
  1616. return InputStream.EOF;
  1617. }
  1618. var ch = this.data[this.start++];
  1619. if (ch === '\r')
  1620. ch = '\n';
  1621. return ch;
  1622. },
  1623. advance: function(amount) {
  1624. this.start += amount;
  1625. if(this.start >= this.data.length) {
  1626. if(!this.eof) throw InputStream.DRAIN;
  1627. return InputStream.EOF;
  1628. } else {
  1629. if(this.committed > this.data.length / 2) {
  1630. this.lastLocation = this.location();
  1631. this.data = this.data.slice(this.committed);
  1632. this.start = this.start - this.committed;
  1633. this.committed = 0;
  1634. }
  1635. }
  1636. },
  1637. matchWhile: function(re) {
  1638. if(this.eof && this.start >= this.data.length ) return '';
  1639. var r = new RegExp("^"+re+"+");
  1640. var m = r.exec(this.slice());
  1641. if(m) {
  1642. if(!this.eof && m[0].length == this.data.length - this.start) throw InputStream.DRAIN;
  1643. this.advance(m[0].length);
  1644. return m[0];
  1645. } else {
  1646. return '';
  1647. }
  1648. },
  1649. matchUntil: function(re) {
  1650. var m, s;
  1651. s = this.slice();
  1652. if(s === InputStream.EOF) {
  1653. return '';
  1654. } else if(m = new RegExp(re + (this.eof ? "|$" : "")).exec(s)) {
  1655. var t = this.data.slice(this.start, this.start + m.index);
  1656. this.advance(m.index);
  1657. return t.replace(/\r/g, '\n').replace(/\n{2,}/g, '\n');
  1658. } else {
  1659. throw InputStream.DRAIN;
  1660. }
  1661. },
  1662. append: function(data) {
  1663. this.data += data;
  1664. },
  1665. shift: function(n) {
  1666. if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN;
  1667. if(this.eof && this.start >= this.data.length) return InputStream.EOF;
  1668. var d = this.data.slice(this.start, this.start + n).toString();
  1669. this.advance(Math.min(n, this.data.length - this.start));
  1670. return d;
  1671. },
  1672. peek: function(n) {
  1673. if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN;
  1674. if(this.eof && this.start >= this.data.length) return InputStream.EOF;
  1675. return this.data.slice(this.start, Math.min(this.start + n, this.data.length)).toString();
  1676. },
  1677. length: function() {
  1678. return this.data.length - this.start - 1;
  1679. },
  1680. unget: function(d) {
  1681. if(d === InputStream.EOF) return;
  1682. this.start -= (d.length);
  1683. },
  1684. undo: function() {
  1685. this.start = this.committed;
  1686. },
  1687. commit: function() {
  1688. this.committed = this.start;
  1689. },
  1690. location: function() {
  1691. var lastLine = this.lastLocation.line;
  1692. var lastColumn = this.lastLocation.column;
  1693. var read = this.data.slice(0, this.committed);
  1694. var newlines = read.match(/\n/g);
  1695. var line = newlines ? lastLine + newlines.length : lastLine;
  1696. var column = newlines ? read.length - read.lastIndexOf('\n') - 1 : lastColumn + read.length;
  1697. return {line: line, column: column};
  1698. }
  1699. };
  1700. exports.InputStream = InputStream;
  1701. },
  1702. {}],
  1703. 4:[function(_dereq_,module,exports){
  1704. var SpecialElements = {
  1705. "http://www.w3.org/1999/xhtml": [
  1706. 'address',
  1707. 'applet',
  1708. 'area',
  1709. 'article',
  1710. 'aside',
  1711. 'base',
  1712. 'basefont',
  1713. 'bgsound',
  1714. 'blockquote',
  1715. 'body',
  1716. 'br',
  1717. 'button',
  1718. 'caption',
  1719. 'center',
  1720. 'col',
  1721. 'colgroup',
  1722. 'dd',
  1723. 'details',
  1724. 'dir',
  1725. 'div',
  1726. 'dl',
  1727. 'dt',
  1728. 'embed',
  1729. 'fieldset',
  1730. 'figcaption',
  1731. 'figure',
  1732. 'footer',
  1733. 'form',
  1734. 'frame',
  1735. 'frameset',
  1736. 'h1',
  1737. 'h2',
  1738. 'h3',
  1739. 'h4',
  1740. 'h5',
  1741. 'h6',
  1742. 'head',
  1743. 'header',
  1744. 'hgroup',
  1745. 'hr',
  1746. 'html',
  1747. 'iframe',
  1748. 'img',
  1749. 'input',
  1750. 'isindex',
  1751. 'li',
  1752. 'link',
  1753. 'listing',
  1754. 'main',
  1755. 'marquee',
  1756. 'menu',
  1757. 'menuitem',
  1758. 'meta',
  1759. 'nav',
  1760. 'noembed',
  1761. 'noframes',
  1762. 'noscript',
  1763. 'object',
  1764. 'ol',
  1765. 'p',
  1766. 'param',
  1767. 'plaintext',
  1768. 'pre',
  1769. 'script',
  1770. 'section',
  1771. 'select',
  1772. 'source',
  1773. 'style',
  1774. 'summary',
  1775. 'table',
  1776. 'tbody',
  1777. 'td',
  1778. 'textarea',
  1779. 'tfoot',
  1780. 'th',
  1781. 'thead',
  1782. 'title',
  1783. 'tr',
  1784. 'track',
  1785. 'ul',
  1786. 'wbr',
  1787. 'xmp'
  1788. ],
  1789. "http://www.w3.org/1998/Math/MathML": [
  1790. 'mi',
  1791. 'mo',
  1792. 'mn',
  1793. 'ms',
  1794. 'mtext',
  1795. 'annotation-xml'
  1796. ],
  1797. "http://www.w3.org/2000/svg": [
  1798. 'foreignObject',
  1799. 'desc',
  1800. 'title'
  1801. ]
  1802. };
  1803. function StackItem(namespaceURI, localName, attributes, node) {
  1804. this.localName = localName;
  1805. this.namespaceURI = namespaceURI;
  1806. this.attributes = attributes;
  1807. this.node = node;
  1808. }
  1809. StackItem.prototype.isSpecial = function() {
  1810. return this.namespaceURI in SpecialElements &&
  1811. SpecialElements[this.namespaceURI].indexOf(this.localName) > -1;
  1812. };
  1813. StackItem.prototype.isFosterParenting = function() {
  1814. if (this.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1815. return this.localName === 'table' ||
  1816. this.localName === 'tbody' ||
  1817. this.localName === 'tfoot' ||
  1818. this.localName === 'thead' ||
  1819. this.localName === 'tr';
  1820. }
  1821. return false;
  1822. };
  1823. StackItem.prototype.isNumberedHeader = function() {
  1824. if (this.namespaceURI === "http://www.w3.org/1999/xhtml") {
  1825. return this.localName === 'h1' ||
  1826. this.localName === 'h2' ||
  1827. this.localName === 'h3' ||
  1828. this.localName === 'h4' ||
  1829. this.localName === 'h5' ||
  1830. this.localName === 'h6';
  1831. }
  1832. return false;
  1833. };
  1834. StackItem.prototype.isForeign = function() {
  1835. return this.namespaceURI != "http://www.w3.org/1999/xhtml";
  1836. };
  1837. function getAttribute(item, name) {
  1838. for (var i = 0; i < item.attributes.length; i++) {
  1839. if (item.attributes[i].nodeName == name)
  1840. return item.attributes[i].nodeValue;
  1841. }
  1842. return null;
  1843. }
  1844. StackItem.prototype.isHtmlIntegrationPoint = function() {
  1845. if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1846. if (this.localName !== "annotation-xml")
  1847. return false;
  1848. var encoding = getAttribute(this, 'encoding');
  1849. if (!encoding)
  1850. return false;
  1851. encoding = encoding.toLowerCase();
  1852. return encoding === "text/html" || encoding === "application/xhtml+xml";
  1853. }
  1854. if (this.namespaceURI === "http://www.w3.org/2000/svg") {
  1855. return this.localName === "foreignObject"
  1856. || this.localName === "desc"
  1857. || this.localName === "title";
  1858. }
  1859. return false;
  1860. };
  1861. StackItem.prototype.isMathMLTextIntegrationPoint = function() {
  1862. if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
  1863. return this.localName === "mi"
  1864. || this.localName === "mo"
  1865. || this.localName === "mn"
  1866. || this.localName === "ms"
  1867. || this.localName === "mtext";
  1868. }
  1869. return false;
  1870. };
  1871. exports.StackItem = StackItem;
  1872. },
  1873. {}],
  1874. 5:[function(_dereq_,module,exports){
  1875. var InputStream = _dereq_('./InputStream').InputStream;
  1876. var EntityParser = _dereq_('./EntityParser').EntityParser;
  1877. function isWhitespace(c){
  1878. return c === " " || c === "\n" || c === "\t" || c === "\r" || c === "\f";
  1879. }
  1880. function isAlpha(c) {
  1881. return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
  1882. }
  1883. function Tokenizer(tokenHandler) {
  1884. this._tokenHandler = tokenHandler;
  1885. this._state = Tokenizer.DATA;
  1886. this._inputStream = new InputStream();
  1887. this._currentToken = null;
  1888. this._temporaryBuffer = '';
  1889. this._additionalAllowedCharacter = '';
  1890. }
  1891. Tokenizer.prototype._parseError = function(code, args) {
  1892. this._tokenHandler.parseError(code, args);
  1893. };
  1894. Tokenizer.prototype._emitToken = function(token) {
  1895. if (token.type === 'StartTag') {
  1896. for (var i = 1; i < token.data.length; i++) {
  1897. if (!token.data[i].nodeName)
  1898. token.data.splice(i--, 1);
  1899. }
  1900. } else if (token.type === 'EndTag') {
  1901. if (token.selfClosing) {
  1902. this._parseError('self-closing-flag-on-end-tag');
  1903. }
  1904. if (token.data.length !== 0) {
  1905. this._parseError('attributes-in-end-tag');
  1906. }
  1907. }
  1908. this._tokenHandler.processToken(token);
  1909. if (token.type === 'StartTag' && token.selfClosing && !this._tokenHandler.isSelfClosingFlagAcknowledged()) {
  1910. this._parseError('non-void-element-with-trailing-solidus', {name: token.name});
  1911. }
  1912. };
  1913. Tokenizer.prototype._emitCurrentToken = function() {
  1914. this._state = Tokenizer.DATA;
  1915. this._emitToken(this._currentToken);
  1916. };
  1917. Tokenizer.prototype._currentAttribute = function() {
  1918. return this._currentToken.data[this._currentToken.data.length - 1];
  1919. };
  1920. Tokenizer.prototype.setState = function(state) {
  1921. this._state = state;
  1922. };
  1923. Tokenizer.prototype.tokenize = function(source) {
  1924. Tokenizer.DATA = data_state;
  1925. Tokenizer.RCDATA = rcdata_state;
  1926. Tokenizer.RAWTEXT = rawtext_state;
  1927. Tokenizer.SCRIPT_DATA = script_data_state;
  1928. Tokenizer.PLAINTEXT = plaintext_state;
  1929. this._state = Tokenizer.DATA;
  1930. this._inputStream.append(source);
  1931. this._tokenHandler.startTokenization(this);
  1932. this._inputStream.eof = true;
  1933. var tokenizer = this;
  1934. while (this._state.call(this, this._inputStream));
  1935. function data_state(buffer) {
  1936. var data = buffer.char();
  1937. if (data === InputStream.EOF) {
  1938. tokenizer._emitToken({type: 'EOF', data: null});
  1939. return false;
  1940. } else if (data === '&') {
  1941. tokenizer.setState(character_reference_in_data_state);
  1942. } else if (data === '<') {
  1943. tokenizer.setState(tag_open_state);
  1944. } else if (data === '\u0000') {
  1945. tokenizer._emitToken({type: 'Characters', data: data});
  1946. buffer.commit();
  1947. } else {
  1948. var chars = buffer.matchUntil("&|<|\u0000");
  1949. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1950. buffer.commit();
  1951. }
  1952. return true;
  1953. }
  1954. function character_reference_in_data_state(buffer) {
  1955. var character = EntityParser.consumeEntity(buffer, tokenizer);
  1956. tokenizer.setState(data_state);
  1957. tokenizer._emitToken({type: 'Characters', data: character || '&'});
  1958. return true;
  1959. }
  1960. function rcdata_state(buffer) {
  1961. var data = buffer.char();
  1962. if (data === InputStream.EOF) {
  1963. tokenizer._emitToken({type: 'EOF', data: null});
  1964. return false;
  1965. } else if (data === '&') {
  1966. tokenizer.setState(character_reference_in_rcdata_state);
  1967. } else if (data === '<') {
  1968. tokenizer.setState(rcdata_less_than_sign_state);
  1969. } else if (data === "\u0000") {
  1970. tokenizer._parseError("invalid-codepoint");
  1971. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  1972. buffer.commit();
  1973. } else {
  1974. var chars = buffer.matchUntil("&|<|\u0000");
  1975. tokenizer._emitToken({type: 'Characters', data: data + chars});
  1976. buffer.commit();
  1977. }
  1978. return true;
  1979. }
  1980. function character_reference_in_rcdata_state(buffer) {
  1981. var character = EntityParser.consumeEntity(buffer, tokenizer);
  1982. tokenizer.setState(rcdata_state);
  1983. tokenizer._emitToken({type: 'Characters', data: character || '&'});
  1984. return true;
  1985. }
  1986. function rawtext_state(buffer) {
  1987. var data = buffer.char();
  1988. if (data === InputStream.EOF) {
  1989. tokenizer._emitToken({type: 'EOF', data: null});
  1990. return false;
  1991. } else if (data === '<') {
  1992. tokenizer.setState(rawtext_less_than_sign_state);
  1993. } else if (data === "\u0000") {
  1994. tokenizer._parseError("invalid-codepoint");
  1995. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  1996. buffer.commit();
  1997. } else {
  1998. var chars = buffer.matchUntil("<|\u0000");
  1999. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2000. }
  2001. return true;
  2002. }
  2003. function plaintext_state(buffer) {
  2004. var data = buffer.char();
  2005. if (data === InputStream.EOF) {
  2006. tokenizer._emitToken({type: 'EOF', data: null});
  2007. return false;
  2008. } else if (data === "\u0000") {
  2009. tokenizer._parseError("invalid-codepoint");
  2010. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2011. buffer.commit();
  2012. } else {
  2013. var chars = buffer.matchUntil("\u0000");
  2014. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2015. }
  2016. return true;
  2017. }
  2018. function script_data_state(buffer) {
  2019. var data = buffer.char();
  2020. if (data === InputStream.EOF) {
  2021. tokenizer._emitToken({type: 'EOF', data: null});
  2022. return false;
  2023. } else if (data === '<') {
  2024. tokenizer.setState(script_data_less_than_sign_state);
  2025. } else if (data === '\u0000') {
  2026. tokenizer._parseError("invalid-codepoint");
  2027. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2028. buffer.commit();
  2029. } else {
  2030. var chars = buffer.matchUntil("<|\u0000");
  2031. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2032. }
  2033. return true;
  2034. }
  2035. function rcdata_less_than_sign_state(buffer) {
  2036. var data = buffer.char();
  2037. if (data === "/") {
  2038. this._temporaryBuffer = '';
  2039. tokenizer.setState(rcdata_end_tag_open_state);
  2040. } else {
  2041. tokenizer._emitToken({type: 'Characters', data: '<'});
  2042. buffer.unget(data);
  2043. tokenizer.setState(rcdata_state);
  2044. }
  2045. return true;
  2046. }
  2047. function rcdata_end_tag_open_state(buffer) {
  2048. var data = buffer.char();
  2049. if (isAlpha(data)) {
  2050. this._temporaryBuffer += data;
  2051. tokenizer.setState(rcdata_end_tag_name_state);
  2052. } else {
  2053. tokenizer._emitToken({type: 'Characters', data: '</'});
  2054. buffer.unget(data);
  2055. tokenizer.setState(rcdata_state);
  2056. }
  2057. return true;
  2058. }
  2059. function rcdata_end_tag_name_state(buffer) {
  2060. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2061. var data = buffer.char();
  2062. if (isWhitespace(data) && appropriate) {
  2063. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2064. tokenizer.setState(before_attribute_name_state);
  2065. } else if (data === '/' && appropriate) {
  2066. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2067. tokenizer.setState(self_closing_tag_state);
  2068. } else if (data === '>' && appropriate) {
  2069. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2070. tokenizer._emitCurrentToken();
  2071. tokenizer.setState(data_state);
  2072. } else if (isAlpha(data)) {
  2073. this._temporaryBuffer += data;
  2074. buffer.commit();
  2075. } else {
  2076. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2077. buffer.unget(data);
  2078. tokenizer.setState(rcdata_state);
  2079. }
  2080. return true;
  2081. }
  2082. function rawtext_less_than_sign_state(buffer) {
  2083. var data = buffer.char();
  2084. if (data === "/") {
  2085. this._temporaryBuffer = '';
  2086. tokenizer.setState(rawtext_end_tag_open_state);
  2087. } else {
  2088. tokenizer._emitToken({type: 'Characters', data: '<'});
  2089. buffer.unget(data);
  2090. tokenizer.setState(rawtext_state);
  2091. }
  2092. return true;
  2093. }
  2094. function rawtext_end_tag_open_state(buffer) {
  2095. var data = buffer.char();
  2096. if (isAlpha(data)) {
  2097. this._temporaryBuffer += data;
  2098. tokenizer.setState(rawtext_end_tag_name_state);
  2099. } else {
  2100. tokenizer._emitToken({type: 'Characters', data: '</'});
  2101. buffer.unget(data);
  2102. tokenizer.setState(rawtext_state);
  2103. }
  2104. return true;
  2105. }
  2106. function rawtext_end_tag_name_state(buffer) {
  2107. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2108. var data = buffer.char();
  2109. if (isWhitespace(data) && appropriate) {
  2110. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2111. tokenizer.setState(before_attribute_name_state);
  2112. } else if (data === '/' && appropriate) {
  2113. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2114. tokenizer.setState(self_closing_tag_state);
  2115. } else if (data === '>' && appropriate) {
  2116. tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false};
  2117. tokenizer._emitCurrentToken();
  2118. tokenizer.setState(data_state);
  2119. } else if (isAlpha(data)) {
  2120. this._temporaryBuffer += data;
  2121. buffer.commit();
  2122. } else {
  2123. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2124. buffer.unget(data);
  2125. tokenizer.setState(rawtext_state);
  2126. }
  2127. return true;
  2128. }
  2129. function script_data_less_than_sign_state(buffer) {
  2130. var data = buffer.char();
  2131. if (data === "/") {
  2132. this._temporaryBuffer = '';
  2133. tokenizer.setState(script_data_end_tag_open_state);
  2134. } else if (data === '!') {
  2135. tokenizer._emitToken({type: 'Characters', data: '<!'});
  2136. tokenizer.setState(script_data_escape_start_state);
  2137. } else {
  2138. tokenizer._emitToken({type: 'Characters', data: '<'});
  2139. buffer.unget(data);
  2140. tokenizer.setState(script_data_state);
  2141. }
  2142. return true;
  2143. }
  2144. function script_data_end_tag_open_state(buffer) {
  2145. var data = buffer.char();
  2146. if (isAlpha(data)) {
  2147. this._temporaryBuffer += data;
  2148. tokenizer.setState(script_data_end_tag_name_state);
  2149. } else {
  2150. tokenizer._emitToken({type: 'Characters', data: '</'});
  2151. buffer.unget(data);
  2152. tokenizer.setState(script_data_state);
  2153. }
  2154. return true;
  2155. }
  2156. function script_data_end_tag_name_state(buffer) {
  2157. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2158. var data = buffer.char();
  2159. if (isWhitespace(data) && appropriate) {
  2160. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2161. tokenizer.setState(before_attribute_name_state);
  2162. } else if (data === '/' && appropriate) {
  2163. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2164. tokenizer.setState(self_closing_tag_state);
  2165. } else if (data === '>' && appropriate) {
  2166. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2167. tokenizer._emitCurrentToken();
  2168. } else if (isAlpha(data)) {
  2169. this._temporaryBuffer += data;
  2170. buffer.commit();
  2171. } else {
  2172. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2173. buffer.unget(data);
  2174. tokenizer.setState(script_data_state);
  2175. }
  2176. return true;
  2177. }
  2178. function script_data_escape_start_state(buffer) {
  2179. var data = buffer.char();
  2180. if (data === '-') {
  2181. tokenizer._emitToken({type: 'Characters', data: '-'});
  2182. tokenizer.setState(script_data_escape_start_dash_state);
  2183. } else {
  2184. buffer.unget(data);
  2185. tokenizer.setState(script_data_state);
  2186. }
  2187. return true;
  2188. }
  2189. function script_data_escape_start_dash_state(buffer) {
  2190. var data = buffer.char();
  2191. if (data === '-') {
  2192. tokenizer._emitToken({type: 'Characters', data: '-'});
  2193. tokenizer.setState(script_data_escaped_dash_dash_state);
  2194. } else {
  2195. buffer.unget(data);
  2196. tokenizer.setState(script_data_state);
  2197. }
  2198. return true;
  2199. }
  2200. function script_data_escaped_state(buffer) {
  2201. var data = buffer.char();
  2202. if (data === InputStream.EOF) {
  2203. buffer.unget(data);
  2204. tokenizer.setState(data_state);
  2205. } else if (data === '-') {
  2206. tokenizer._emitToken({type: 'Characters', data: '-'});
  2207. tokenizer.setState(script_data_escaped_dash_state);
  2208. } else if (data === '<') {
  2209. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2210. } else if (data === '\u0000') {
  2211. tokenizer._parseError("invalid-codepoint");
  2212. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2213. buffer.commit();
  2214. } else {
  2215. var chars = buffer.matchUntil('<|-|\u0000');
  2216. tokenizer._emitToken({type: 'Characters', data: data + chars});
  2217. }
  2218. return true;
  2219. }
  2220. function script_data_escaped_dash_state(buffer) {
  2221. var data = buffer.char();
  2222. if (data === InputStream.EOF) {
  2223. buffer.unget(data);
  2224. tokenizer.setState(data_state);
  2225. } else if (data === '-') {
  2226. tokenizer._emitToken({type: 'Characters', data: '-'});
  2227. tokenizer.setState(script_data_escaped_dash_dash_state);
  2228. } else if (data === '<') {
  2229. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2230. } else if (data === '\u0000') {
  2231. tokenizer._parseError("invalid-codepoint");
  2232. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2233. tokenizer.setState(script_data_escaped_state);
  2234. } else {
  2235. tokenizer._emitToken({type: 'Characters', data: data});
  2236. tokenizer.setState(script_data_escaped_state);
  2237. }
  2238. return true;
  2239. }
  2240. function script_data_escaped_dash_dash_state(buffer) {
  2241. var data = buffer.char();
  2242. if (data === InputStream.EOF) {
  2243. tokenizer._parseError('eof-in-script');
  2244. buffer.unget(data);
  2245. tokenizer.setState(data_state);
  2246. } else if (data === '<') {
  2247. tokenizer.setState(script_data_escaped_less_then_sign_state);
  2248. } else if (data === '>') {
  2249. tokenizer._emitToken({type: 'Characters', data: '>'});
  2250. tokenizer.setState(script_data_state);
  2251. } else if (data === '\u0000') {
  2252. tokenizer._parseError("invalid-codepoint");
  2253. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2254. tokenizer.setState(script_data_escaped_state);
  2255. } else {
  2256. tokenizer._emitToken({type: 'Characters', data: data});
  2257. tokenizer.setState(script_data_escaped_state);
  2258. }
  2259. return true;
  2260. }
  2261. function script_data_escaped_less_then_sign_state(buffer) {
  2262. var data = buffer.char();
  2263. if (data === '/') {
  2264. this._temporaryBuffer = '';
  2265. tokenizer.setState(script_data_escaped_end_tag_open_state);
  2266. } else if (isAlpha(data)) {
  2267. tokenizer._emitToken({type: 'Characters', data: '<' + data});
  2268. this._temporaryBuffer = data;
  2269. tokenizer.setState(script_data_double_escape_start_state);
  2270. } else {
  2271. tokenizer._emitToken({type: 'Characters', data: '<'});
  2272. buffer.unget(data);
  2273. tokenizer.setState(script_data_escaped_state);
  2274. }
  2275. return true;
  2276. }
  2277. function script_data_escaped_end_tag_open_state(buffer) {
  2278. var data = buffer.char();
  2279. if (isAlpha(data)) {
  2280. this._temporaryBuffer = data;
  2281. tokenizer.setState(script_data_escaped_end_tag_name_state);
  2282. } else {
  2283. tokenizer._emitToken({type: 'Characters', data: '</'});
  2284. buffer.unget(data);
  2285. tokenizer.setState(script_data_escaped_state);
  2286. }
  2287. return true;
  2288. }
  2289. function script_data_escaped_end_tag_name_state(buffer) {
  2290. var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase());
  2291. var data = buffer.char();
  2292. if (isWhitespace(data) && appropriate) {
  2293. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2294. tokenizer.setState(before_attribute_name_state);
  2295. } else if (data === '/' && appropriate) {
  2296. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2297. tokenizer.setState(self_closing_tag_state);
  2298. } else if (data === '>' && appropriate) {
  2299. tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false};
  2300. tokenizer.setState(data_state);
  2301. tokenizer._emitCurrentToken();
  2302. } else if (isAlpha(data)) {
  2303. this._temporaryBuffer += data;
  2304. buffer.commit();
  2305. } else {
  2306. tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer});
  2307. buffer.unget(data);
  2308. tokenizer.setState(script_data_escaped_state);
  2309. }
  2310. return true;
  2311. }
  2312. function script_data_double_escape_start_state(buffer) {
  2313. var data = buffer.char();
  2314. if (isWhitespace(data) || data === '/' || data === '>') {
  2315. tokenizer._emitToken({type: 'Characters', data: data});
  2316. if (this._temporaryBuffer.toLowerCase() === 'script')
  2317. tokenizer.setState(script_data_double_escaped_state);
  2318. else
  2319. tokenizer.setState(script_data_escaped_state);
  2320. } else if (isAlpha(data)) {
  2321. tokenizer._emitToken({type: 'Characters', data: data});
  2322. this._temporaryBuffer += data;
  2323. buffer.commit();
  2324. } else {
  2325. buffer.unget(data);
  2326. tokenizer.setState(script_data_escaped_state);
  2327. }
  2328. return true;
  2329. }
  2330. function script_data_double_escaped_state(buffer) {
  2331. var data = buffer.char();
  2332. if (data === InputStream.EOF) {
  2333. tokenizer._parseError('eof-in-script');
  2334. buffer.unget(data);
  2335. tokenizer.setState(data_state);
  2336. } else if (data === '-') {
  2337. tokenizer._emitToken({type: 'Characters', data: '-'});
  2338. tokenizer.setState(script_data_double_escaped_dash_state);
  2339. } else if (data === '<') {
  2340. tokenizer._emitToken({type: 'Characters', data: '<'});
  2341. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2342. } else if (data === '\u0000') {
  2343. tokenizer._parseError('invalid-codepoint');
  2344. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2345. buffer.commit();
  2346. } else {
  2347. tokenizer._emitToken({type: 'Characters', data: data});
  2348. buffer.commit();
  2349. }
  2350. return true;
  2351. }
  2352. function script_data_double_escaped_dash_state(buffer) {
  2353. var data = buffer.char();
  2354. if (data === InputStream.EOF) {
  2355. tokenizer._parseError('eof-in-script');
  2356. buffer.unget(data);
  2357. tokenizer.setState(data_state);
  2358. } else if (data === '-') {
  2359. tokenizer._emitToken({type: 'Characters', data: '-'});
  2360. tokenizer.setState(script_data_double_escaped_dash_dash_state);
  2361. } else if (data === '<') {
  2362. tokenizer._emitToken({type: 'Characters', data: '<'});
  2363. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2364. } else if (data === '\u0000') {
  2365. tokenizer._parseError('invalid-codepoint');
  2366. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2367. tokenizer.setState(script_data_double_escaped_state);
  2368. } else {
  2369. tokenizer._emitToken({type: 'Characters', data: data});
  2370. tokenizer.setState(script_data_double_escaped_state);
  2371. }
  2372. return true;
  2373. }
  2374. function script_data_double_escaped_dash_dash_state(buffer) {
  2375. var data = buffer.char();
  2376. if (data === InputStream.EOF) {
  2377. tokenizer._parseError('eof-in-script');
  2378. buffer.unget(data);
  2379. tokenizer.setState(data_state);
  2380. } else if (data === '-') {
  2381. tokenizer._emitToken({type: 'Characters', data: '-'});
  2382. buffer.commit();
  2383. } else if (data === '<') {
  2384. tokenizer._emitToken({type: 'Characters', data: '<'});
  2385. tokenizer.setState(script_data_double_escaped_less_than_sign_state);
  2386. } else if (data === '>') {
  2387. tokenizer._emitToken({type: 'Characters', data: '>'});
  2388. tokenizer.setState(script_data_state);
  2389. } else if (data === '\u0000') {
  2390. tokenizer._parseError('invalid-codepoint');
  2391. tokenizer._emitToken({type: 'Characters', data: '\uFFFD'});
  2392. tokenizer.setState(script_data_double_escaped_state);
  2393. } else {
  2394. tokenizer._emitToken({type: 'Characters', data: data});
  2395. tokenizer.setState(script_data_double_escaped_state);
  2396. }
  2397. return true;
  2398. }
  2399. function script_data_double_escaped_less_than_sign_state(buffer) {
  2400. var data = buffer.char();
  2401. if (data === '/') {
  2402. tokenizer._emitToken({type: 'Characters', data: '/'});
  2403. this._temporaryBuffer = '';
  2404. tokenizer.setState(script_data_double_escape_end_state);
  2405. } else {
  2406. buffer.unget(data);
  2407. tokenizer.setState(script_data_double_escaped_state);
  2408. }
  2409. return true;
  2410. }
  2411. function script_data_double_escape_end_state(buffer) {
  2412. var data = buffer.char();
  2413. if (isWhitespace(data) || data === '/' || data === '>') {
  2414. tokenizer._emitToken({type: 'Characters', data: data});
  2415. if (this._temporaryBuffer.toLowerCase() === 'script')
  2416. tokenizer.setState(script_data_escaped_state);
  2417. else
  2418. tokenizer.setState(script_data_double_escaped_state);
  2419. } else if (isAlpha(data)) {
  2420. tokenizer._emitToken({type: 'Characters', data: data});
  2421. this._temporaryBuffer += data;
  2422. buffer.commit();
  2423. } else {
  2424. buffer.unget(data);
  2425. tokenizer.setState(script_data_double_escaped_state);
  2426. }
  2427. return true;
  2428. }
  2429. function tag_open_state(buffer) {
  2430. var data = buffer.char();
  2431. if (data === InputStream.EOF) {
  2432. tokenizer._parseError("bare-less-than-sign-at-eof");
  2433. tokenizer._emitToken({type: 'Characters', data: '<'});
  2434. buffer.unget(data);
  2435. tokenizer.setState(data_state);
  2436. } else if (isAlpha(data)) {
  2437. tokenizer._currentToken = {type: 'StartTag', name: data.toLowerCase(), data: []};
  2438. tokenizer.setState(tag_name_state);
  2439. } else if (data === '!') {
  2440. tokenizer.setState(markup_declaration_open_state);
  2441. } else if (data === '/') {
  2442. tokenizer.setState(close_tag_open_state);
  2443. } else if (data === '>') {
  2444. tokenizer._parseError("expected-tag-name-but-got-right-bracket");
  2445. tokenizer._emitToken({type: 'Characters', data: "<>"});
  2446. tokenizer.setState(data_state);
  2447. } else if (data === '?') {
  2448. tokenizer._parseError("expected-tag-name-but-got-question-mark");
  2449. buffer.unget(data);
  2450. tokenizer.setState(bogus_comment_state);
  2451. } else {
  2452. tokenizer._parseError("expected-tag-name");
  2453. tokenizer._emitToken({type: 'Characters', data: "<"});
  2454. buffer.unget(data);
  2455. tokenizer.setState(data_state);
  2456. }
  2457. return true;
  2458. }
  2459. function close_tag_open_state(buffer) {
  2460. var data = buffer.char();
  2461. if (data === InputStream.EOF) {
  2462. tokenizer._parseError("expected-closing-tag-but-got-eof");
  2463. tokenizer._emitToken({type: 'Characters', data: '</'});
  2464. buffer.unget(data);
  2465. tokenizer.setState(data_state);
  2466. } else if (isAlpha(data)) {
  2467. tokenizer._currentToken = {type: 'EndTag', name: data.toLowerCase(), data: []};
  2468. tokenizer.setState(tag_name_state);
  2469. } else if (data === '>') {
  2470. tokenizer._parseError("expected-closing-tag-but-got-right-bracket");
  2471. tokenizer.setState(data_state);
  2472. } else {
  2473. tokenizer._parseError("expected-closing-tag-but-got-char", {data: data}); // param 1 is datavars:
  2474. buffer.unget(data);
  2475. tokenizer.setState(bogus_comment_state);
  2476. }
  2477. return true;
  2478. }
  2479. function tag_name_state(buffer) {
  2480. var data = buffer.char();
  2481. if (data === InputStream.EOF) {
  2482. tokenizer._parseError('eof-in-tag-name');
  2483. buffer.unget(data);
  2484. tokenizer.setState(data_state);
  2485. } else if (isWhitespace(data)) {
  2486. tokenizer.setState(before_attribute_name_state);
  2487. } else if (isAlpha(data)) {
  2488. tokenizer._currentToken.name += data.toLowerCase();
  2489. } else if (data === '>') {
  2490. tokenizer._emitCurrentToken();
  2491. } else if (data === '/') {
  2492. tokenizer.setState(self_closing_tag_state);
  2493. } else if (data === '\u0000') {
  2494. tokenizer._parseError("invalid-codepoint");
  2495. tokenizer._currentToken.name += "\uFFFD";
  2496. } else {
  2497. tokenizer._currentToken.name += data;
  2498. }
  2499. buffer.commit();
  2500. return true;
  2501. }
  2502. function before_attribute_name_state(buffer) {
  2503. var data = buffer.char();
  2504. if (data === InputStream.EOF) {
  2505. tokenizer._parseError("expected-attribute-name-but-got-eof");
  2506. buffer.unget(data);
  2507. tokenizer.setState(data_state);
  2508. } else if (isWhitespace(data)) {
  2509. return true;
  2510. } else if (isAlpha(data)) {
  2511. tokenizer._currentToken.data.push({nodeName: data.toLowerCase(), nodeValue: ""});
  2512. tokenizer.setState(attribute_name_state);
  2513. } else if (data === '>') {
  2514. tokenizer._emitCurrentToken();
  2515. } else if (data === '/') {
  2516. tokenizer.setState(self_closing_tag_state);
  2517. } else if (data === "'" || data === '"' || data === '=' || data === '<') {
  2518. tokenizer._parseError("invalid-character-in-attribute-name");
  2519. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2520. tokenizer.setState(attribute_name_state);
  2521. } else if (data === '\u0000') {
  2522. tokenizer._parseError("invalid-codepoint");
  2523. tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""});
  2524. } else {
  2525. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2526. tokenizer.setState(attribute_name_state);
  2527. }
  2528. return true;
  2529. }
  2530. function attribute_name_state(buffer) {
  2531. var data = buffer.char();
  2532. var leavingThisState = true;
  2533. var shouldEmit = false;
  2534. if (data === InputStream.EOF) {
  2535. tokenizer._parseError("eof-in-attribute-name");
  2536. buffer.unget(data);
  2537. tokenizer.setState(data_state);
  2538. shouldEmit = true;
  2539. } else if (data === '=') {
  2540. tokenizer.setState(before_attribute_value_state);
  2541. } else if (isAlpha(data)) {
  2542. tokenizer._currentAttribute().nodeName += data.toLowerCase();
  2543. leavingThisState = false;
  2544. } else if (data === '>') {
  2545. shouldEmit = true;
  2546. } else if (isWhitespace(data)) {
  2547. tokenizer.setState(after_attribute_name_state);
  2548. } else if (data === '/') {
  2549. tokenizer.setState(self_closing_tag_state);
  2550. } else if (data === "'" || data === '"') {
  2551. tokenizer._parseError("invalid-character-in-attribute-name");
  2552. tokenizer._currentAttribute().nodeName += data;
  2553. leavingThisState = false;
  2554. } else if (data === '\u0000') {
  2555. tokenizer._parseError("invalid-codepoint");
  2556. tokenizer._currentAttribute().nodeName += "\uFFFD";
  2557. } else {
  2558. tokenizer._currentAttribute().nodeName += data;
  2559. leavingThisState = false;
  2560. }
  2561. if (leavingThisState) {
  2562. var attributes = tokenizer._currentToken.data;
  2563. var currentAttribute = attributes[attributes.length - 1];
  2564. for (var i = attributes.length - 2; i >= 0; i--) {
  2565. if (currentAttribute.nodeName === attributes[i].nodeName) {
  2566. tokenizer._parseError("duplicate-attribute", {name: currentAttribute.nodeName});
  2567. currentAttribute.nodeName = null;
  2568. break;
  2569. }
  2570. }
  2571. if (shouldEmit)
  2572. tokenizer._emitCurrentToken();
  2573. } else {
  2574. buffer.commit();
  2575. }
  2576. return true;
  2577. }
  2578. function after_attribute_name_state(buffer) {
  2579. var data = buffer.char();
  2580. if (data === InputStream.EOF) {
  2581. tokenizer._parseError("expected-end-of-tag-but-got-eof");
  2582. buffer.unget(data);
  2583. tokenizer.setState(data_state);
  2584. } else if (isWhitespace(data)) {
  2585. return true;
  2586. } else if (data === '=') {
  2587. tokenizer.setState(before_attribute_value_state);
  2588. } else if (data === '>') {
  2589. tokenizer._emitCurrentToken();
  2590. } else if (isAlpha(data)) {
  2591. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2592. tokenizer.setState(attribute_name_state);
  2593. } else if (data === '/') {
  2594. tokenizer.setState(self_closing_tag_state);
  2595. } else if (data === "'" || data === '"' || data === '<') {
  2596. tokenizer._parseError("invalid-character-after-attribute-name");
  2597. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2598. tokenizer.setState(attribute_name_state);
  2599. } else if (data === '\u0000') {
  2600. tokenizer._parseError("invalid-codepoint");
  2601. tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""});
  2602. } else {
  2603. tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""});
  2604. tokenizer.setState(attribute_name_state);
  2605. }
  2606. return true;
  2607. }
  2608. function before_attribute_value_state(buffer) {
  2609. var data = buffer.char();
  2610. if (data === InputStream.EOF) {
  2611. tokenizer._parseError("expected-attribute-value-but-got-eof");
  2612. buffer.unget(data);
  2613. tokenizer.setState(data_state);
  2614. } else if (isWhitespace(data)) {
  2615. return true;
  2616. } else if (data === '"') {
  2617. tokenizer.setState(attribute_value_double_quoted_state);
  2618. } else if (data === '&') {
  2619. tokenizer.setState(attribute_value_unquoted_state);
  2620. buffer.unget(data);
  2621. } else if (data === "'") {
  2622. tokenizer.setState(attribute_value_single_quoted_state);
  2623. } else if (data === '>') {
  2624. tokenizer._parseError("expected-attribute-value-but-got-right-bracket");
  2625. tokenizer._emitCurrentToken();
  2626. } else if (data === '=' || data === '<' || data === '`') {
  2627. tokenizer._parseError("unexpected-character-in-unquoted-attribute-value");
  2628. tokenizer._currentAttribute().nodeValue += data;
  2629. tokenizer.setState(attribute_value_unquoted_state);
  2630. } else if (data === '\u0000') {
  2631. tokenizer._parseError("invalid-codepoint");
  2632. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2633. } else {
  2634. tokenizer._currentAttribute().nodeValue += data;
  2635. tokenizer.setState(attribute_value_unquoted_state);
  2636. }
  2637. return true;
  2638. }
  2639. function attribute_value_double_quoted_state(buffer) {
  2640. var data = buffer.char();
  2641. if (data === InputStream.EOF) {
  2642. tokenizer._parseError("eof-in-attribute-value-double-quote");
  2643. buffer.unget(data);
  2644. tokenizer.setState(data_state);
  2645. } else if (data === '"') {
  2646. tokenizer.setState(after_attribute_value_state);
  2647. } else if (data === '&') {
  2648. this._additionalAllowedCharacter = '"';
  2649. tokenizer.setState(character_reference_in_attribute_value_state);
  2650. } else if (data === '\u0000') {
  2651. tokenizer._parseError("invalid-codepoint");
  2652. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2653. } else {
  2654. var s = buffer.matchUntil('[\0"&]');
  2655. data = data + s;
  2656. tokenizer._currentAttribute().nodeValue += data;
  2657. }
  2658. return true;
  2659. }
  2660. function attribute_value_single_quoted_state(buffer) {
  2661. var data = buffer.char();
  2662. if (data === InputStream.EOF) {
  2663. tokenizer._parseError("eof-in-attribute-value-single-quote");
  2664. buffer.unget(data);
  2665. tokenizer.setState(data_state);
  2666. } else if (data === "'") {
  2667. tokenizer.setState(after_attribute_value_state);
  2668. } else if (data === '&') {
  2669. this._additionalAllowedCharacter = "'";
  2670. tokenizer.setState(character_reference_in_attribute_value_state);
  2671. } else if (data === '\u0000') {
  2672. tokenizer._parseError("invalid-codepoint");
  2673. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2674. } else {
  2675. tokenizer._currentAttribute().nodeValue += data + buffer.matchUntil("\u0000|['&]");
  2676. }
  2677. return true;
  2678. }
  2679. function attribute_value_unquoted_state(buffer) {
  2680. var data = buffer.char();
  2681. if (data === InputStream.EOF) {
  2682. tokenizer._parseError("eof-after-attribute-value");
  2683. buffer.unget(data);
  2684. tokenizer.setState(data_state);
  2685. } else if (isWhitespace(data)) {
  2686. tokenizer.setState(before_attribute_name_state);
  2687. } else if (data === '&') {
  2688. this._additionalAllowedCharacter = ">";
  2689. tokenizer.setState(character_reference_in_attribute_value_state);
  2690. } else if (data === '>') {
  2691. tokenizer._emitCurrentToken();
  2692. } else if (data === '"' || data === "'" || data === '=' || data === '`' || data === '<') {
  2693. tokenizer._parseError("unexpected-character-in-unquoted-attribute-value");
  2694. tokenizer._currentAttribute().nodeValue += data;
  2695. buffer.commit();
  2696. } else if (data === '\u0000') {
  2697. tokenizer._parseError("invalid-codepoint");
  2698. tokenizer._currentAttribute().nodeValue += "\uFFFD";
  2699. } else {
  2700. var o = buffer.matchUntil("\u0000|["+ "\t\n\v\f\x20\r" + "&<>\"'=`" +"]");
  2701. if (o === InputStream.EOF) {
  2702. tokenizer._parseError("eof-in-attribute-value-no-quotes");
  2703. tokenizer._emitCurrentToken();
  2704. }
  2705. buffer.commit();
  2706. tokenizer._currentAttribute().nodeValue += data + o;
  2707. }
  2708. return true;
  2709. }
  2710. function character_reference_in_attribute_value_state(buffer) {
  2711. var character = EntityParser.consumeEntity(buffer, tokenizer, this._additionalAllowedCharacter);
  2712. this._currentAttribute().nodeValue += character || '&';
  2713. if (this._additionalAllowedCharacter === '"')
  2714. tokenizer.setState(attribute_value_double_quoted_state);
  2715. else if (this._additionalAllowedCharacter === '\'')
  2716. tokenizer.setState(attribute_value_single_quoted_state);
  2717. else if (this._additionalAllowedCharacter === '>')
  2718. tokenizer.setState(attribute_value_unquoted_state);
  2719. return true;
  2720. }
  2721. function after_attribute_value_state(buffer) {
  2722. var data = buffer.char();
  2723. if (data === InputStream.EOF) {
  2724. tokenizer._parseError("eof-after-attribute-value");
  2725. buffer.unget(data);
  2726. tokenizer.setState(data_state);
  2727. } else if (isWhitespace(data)) {
  2728. tokenizer.setState(before_attribute_name_state);
  2729. } else if (data === '>') {
  2730. tokenizer.setState(data_state);
  2731. tokenizer._emitCurrentToken();
  2732. } else if (data === '/') {
  2733. tokenizer.setState(self_closing_tag_state);
  2734. } else {
  2735. tokenizer._parseError("unexpected-character-after-attribute-value");
  2736. buffer.unget(data);
  2737. tokenizer.setState(before_attribute_name_state);
  2738. }
  2739. return true;
  2740. }
  2741. function self_closing_tag_state(buffer) {
  2742. var c = buffer.char();
  2743. if (c === InputStream.EOF) {
  2744. tokenizer._parseError("unexpected-eof-after-solidus-in-tag");
  2745. buffer.unget(c);
  2746. tokenizer.setState(data_state);
  2747. } else if (c === '>') {
  2748. tokenizer._currentToken.selfClosing = true;
  2749. tokenizer.setState(data_state);
  2750. tokenizer._emitCurrentToken();
  2751. } else {
  2752. tokenizer._parseError("unexpected-character-after-solidus-in-tag");
  2753. buffer.unget(c);
  2754. tokenizer.setState(before_attribute_name_state);
  2755. }
  2756. return true;
  2757. }
  2758. function bogus_comment_state(buffer) {
  2759. var data = buffer.matchUntil('>');
  2760. data = data.replace(/\u0000/g, "\uFFFD");
  2761. buffer.char();
  2762. tokenizer._emitToken({type: 'Comment', data: data});
  2763. tokenizer.setState(data_state);
  2764. return true;
  2765. }
  2766. function markup_declaration_open_state(buffer) {
  2767. var chars = buffer.shift(2);
  2768. if (chars === '--') {
  2769. tokenizer._currentToken = {type: 'Comment', data: ''};
  2770. tokenizer.setState(comment_start_state);
  2771. } else {
  2772. var newchars = buffer.shift(5);
  2773. if (newchars === InputStream.EOF || chars === InputStream.EOF) {
  2774. tokenizer._parseError("expected-dashes-or-doctype");
  2775. tokenizer.setState(bogus_comment_state);
  2776. buffer.unget(chars);
  2777. return true;
  2778. }
  2779. chars += newchars;
  2780. if (chars.toUpperCase() === 'DOCTYPE') {
  2781. tokenizer._currentToken = {type: 'Doctype', name: '', publicId: null, systemId: null, forceQuirks: false};
  2782. tokenizer.setState(doctype_state);
  2783. } else if (tokenizer._tokenHandler.isCdataSectionAllowed() && chars === '[CDATA[') {
  2784. tokenizer.setState(cdata_section_state);
  2785. } else {
  2786. tokenizer._parseError("expected-dashes-or-doctype");
  2787. buffer.unget(chars);
  2788. tokenizer.setState(bogus_comment_state);
  2789. }
  2790. }
  2791. return true;
  2792. }
  2793. function cdata_section_state(buffer) {
  2794. var data = buffer.matchUntil(']]>');
  2795. buffer.shift(3);
  2796. if (data) {
  2797. tokenizer._emitToken({type: 'Characters', data: data});
  2798. }
  2799. tokenizer.setState(data_state);
  2800. return true;
  2801. }
  2802. function comment_start_state(buffer) {
  2803. var data = buffer.char();
  2804. if (data === InputStream.EOF) {
  2805. tokenizer._parseError("eof-in-comment");
  2806. tokenizer._emitToken(tokenizer._currentToken);
  2807. buffer.unget(data);
  2808. tokenizer.setState(data_state);
  2809. } else if (data === '-') {
  2810. tokenizer.setState(comment_start_dash_state);
  2811. } else if (data === '>') {
  2812. tokenizer._parseError("incorrect-comment");
  2813. tokenizer._emitToken(tokenizer._currentToken);
  2814. tokenizer.setState(data_state);
  2815. } else if (data === '\u0000') {
  2816. tokenizer._parseError("invalid-codepoint");
  2817. tokenizer._currentToken.data += "\uFFFD";
  2818. } else {
  2819. tokenizer._currentToken.data += data;
  2820. tokenizer.setState(comment_state);
  2821. }
  2822. return true;
  2823. }
  2824. function comment_start_dash_state(buffer) {
  2825. var data = buffer.char();
  2826. if (data === InputStream.EOF) {
  2827. tokenizer._parseError("eof-in-comment");
  2828. tokenizer._emitToken(tokenizer._currentToken);
  2829. buffer.unget(data);
  2830. tokenizer.setState(data_state);
  2831. } else if (data === '-') {
  2832. tokenizer.setState(comment_end_state);
  2833. } else if (data === '>') {
  2834. tokenizer._parseError("incorrect-comment");
  2835. tokenizer._emitToken(tokenizer._currentToken);
  2836. tokenizer.setState(data_state);
  2837. } else if (data === '\u0000') {
  2838. tokenizer._parseError("invalid-codepoint");
  2839. tokenizer._currentToken.data += "\uFFFD";
  2840. } else {
  2841. tokenizer._currentToken.data += '-' + data;
  2842. tokenizer.setState(comment_state);
  2843. }
  2844. return true;
  2845. }
  2846. function comment_state(buffer) {
  2847. var data = buffer.char();
  2848. if (data === InputStream.EOF) {
  2849. tokenizer._parseError("eof-in-comment");
  2850. tokenizer._emitToken(tokenizer._currentToken);
  2851. buffer.unget(data);
  2852. tokenizer.setState(data_state);
  2853. } else if (data === '-') {
  2854. tokenizer.setState(comment_end_dash_state);
  2855. } else if (data === '\u0000') {
  2856. tokenizer._parseError("invalid-codepoint");
  2857. tokenizer._currentToken.data += "\uFFFD";
  2858. } else {
  2859. tokenizer._currentToken.data += data;
  2860. buffer.commit();
  2861. }
  2862. return true;
  2863. }
  2864. function comment_end_dash_state(buffer) {
  2865. var data = buffer.char();
  2866. if (data === InputStream.EOF) {
  2867. tokenizer._parseError("eof-in-comment-end-dash");
  2868. tokenizer._emitToken(tokenizer._currentToken);
  2869. buffer.unget(data);
  2870. tokenizer.setState(data_state);
  2871. } else if (data === '-') {
  2872. tokenizer.setState(comment_end_state);
  2873. } else if (data === '\u0000') {
  2874. tokenizer._parseError("invalid-codepoint");
  2875. tokenizer._currentToken.data += "-\uFFFD";
  2876. tokenizer.setState(comment_state);
  2877. } else {
  2878. tokenizer._currentToken.data += '-' + data + buffer.matchUntil('\u0000|-');
  2879. buffer.char();
  2880. }
  2881. return true;
  2882. }
  2883. function comment_end_state(buffer) {
  2884. var data = buffer.char();
  2885. if (data === InputStream.EOF) {
  2886. tokenizer._parseError("eof-in-comment-double-dash");
  2887. tokenizer._emitToken(tokenizer._currentToken);
  2888. buffer.unget(data);
  2889. tokenizer.setState(data_state);
  2890. } else if (data === '>') {
  2891. tokenizer._emitToken(tokenizer._currentToken);
  2892. tokenizer.setState(data_state);
  2893. } else if (data === '!') {
  2894. tokenizer._parseError("unexpected-bang-after-double-dash-in-comment");
  2895. tokenizer.setState(comment_end_bang_state);
  2896. } else if (data === '-') {
  2897. tokenizer._parseError("unexpected-dash-after-double-dash-in-comment");
  2898. tokenizer._currentToken.data += data;
  2899. } else if (data === '\u0000') {
  2900. tokenizer._parseError("invalid-codepoint");
  2901. tokenizer._currentToken.data += "--\uFFFD";
  2902. tokenizer.setState(comment_state);
  2903. } else {
  2904. tokenizer._parseError("unexpected-char-in-comment");
  2905. tokenizer._currentToken.data += '--' + data;
  2906. tokenizer.setState(comment_state);
  2907. }
  2908. return true;
  2909. }
  2910. function comment_end_bang_state(buffer) {
  2911. var data = buffer.char();
  2912. if (data === InputStream.EOF) {
  2913. tokenizer._parseError("eof-in-comment-end-bang-state");
  2914. tokenizer._emitToken(tokenizer._currentToken);
  2915. buffer.unget(data);
  2916. tokenizer.setState(data_state);
  2917. } else if (data === '>') {
  2918. tokenizer._emitToken(tokenizer._currentToken);
  2919. tokenizer.setState(data_state);
  2920. } else if (data === '-') {
  2921. tokenizer._currentToken.data += '--!';
  2922. tokenizer.setState(comment_end_dash_state);
  2923. } else {
  2924. tokenizer._currentToken.data += '--!' + data;
  2925. tokenizer.setState(comment_state);
  2926. }
  2927. return true;
  2928. }
  2929. function doctype_state(buffer) {
  2930. var data = buffer.char();
  2931. if (data === InputStream.EOF) {
  2932. tokenizer._parseError("expected-doctype-name-but-got-eof");
  2933. tokenizer._currentToken.forceQuirks = true;
  2934. buffer.unget(data);
  2935. tokenizer.setState(data_state);
  2936. tokenizer._emitCurrentToken();
  2937. } else if (isWhitespace(data)) {
  2938. tokenizer.setState(before_doctype_name_state);
  2939. } else {
  2940. tokenizer._parseError("need-space-after-doctype");
  2941. buffer.unget(data);
  2942. tokenizer.setState(before_doctype_name_state);
  2943. }
  2944. return true;
  2945. }
  2946. function before_doctype_name_state(buffer) {
  2947. var data = buffer.char();
  2948. if (data === InputStream.EOF) {
  2949. tokenizer._parseError("expected-doctype-name-but-got-eof");
  2950. tokenizer._currentToken.forceQuirks = true;
  2951. buffer.unget(data);
  2952. tokenizer.setState(data_state);
  2953. tokenizer._emitCurrentToken();
  2954. } else if (isWhitespace(data)) {
  2955. } else if (data === '>') {
  2956. tokenizer._parseError("expected-doctype-name-but-got-right-bracket");
  2957. tokenizer._currentToken.forceQuirks = true;
  2958. tokenizer.setState(data_state);
  2959. tokenizer._emitCurrentToken();
  2960. } else {
  2961. if (isAlpha(data))
  2962. data = data.toLowerCase();
  2963. tokenizer._currentToken.name = data;
  2964. tokenizer.setState(doctype_name_state);
  2965. }
  2966. return true;
  2967. }
  2968. function doctype_name_state(buffer) {
  2969. var data = buffer.char();
  2970. if (data === InputStream.EOF) {
  2971. tokenizer._currentToken.forceQuirks = true;
  2972. buffer.unget(data);
  2973. tokenizer._parseError("eof-in-doctype-name");
  2974. tokenizer.setState(data_state);
  2975. tokenizer._emitCurrentToken();
  2976. } else if (isWhitespace(data)) {
  2977. tokenizer.setState(after_doctype_name_state);
  2978. } else if (data === '>') {
  2979. tokenizer.setState(data_state);
  2980. tokenizer._emitCurrentToken();
  2981. } else {
  2982. if (isAlpha(data))
  2983. data = data.toLowerCase();
  2984. tokenizer._currentToken.name += data;
  2985. buffer.commit();
  2986. }
  2987. return true;
  2988. }
  2989. function after_doctype_name_state(buffer) {
  2990. var data = buffer.char();
  2991. if (data === InputStream.EOF) {
  2992. tokenizer._currentToken.forceQuirks = true;
  2993. buffer.unget(data);
  2994. tokenizer._parseError("eof-in-doctype");
  2995. tokenizer.setState(data_state);
  2996. tokenizer._emitCurrentToken();
  2997. } else if (isWhitespace(data)) {
  2998. } else if (data === '>') {
  2999. tokenizer.setState(data_state);
  3000. tokenizer._emitCurrentToken();
  3001. } else {
  3002. if (['p', 'P'].indexOf(data) > -1) {
  3003. var expected = [['u', 'U'], ['b', 'B'], ['l', 'L'], ['i', 'I'], ['c', 'C']];
  3004. var matched = expected.every(function(expected){
  3005. data = buffer.char();
  3006. return expected.indexOf(data) > -1;
  3007. });
  3008. if (matched) {
  3009. tokenizer.setState(after_doctype_public_keyword_state);
  3010. return true;
  3011. }
  3012. } else if (['s', 'S'].indexOf(data) > -1) {
  3013. var expected = [['y', 'Y'], ['s', 'S'], ['t', 'T'], ['e', 'E'], ['m', 'M']];
  3014. var matched = expected.every(function(expected){
  3015. data = buffer.char();
  3016. return expected.indexOf(data) > -1;
  3017. });
  3018. if (matched) {
  3019. tokenizer.setState(after_doctype_system_keyword_state);
  3020. return true;
  3021. }
  3022. }
  3023. buffer.unget(data);
  3024. tokenizer._currentToken.forceQuirks = true;
  3025. if (data === InputStream.EOF) {
  3026. tokenizer._parseError("eof-in-doctype");
  3027. buffer.unget(data);
  3028. tokenizer.setState(data_state);
  3029. tokenizer._emitCurrentToken();
  3030. } else {
  3031. tokenizer._parseError("expected-space-or-right-bracket-in-doctype", {data: data});
  3032. tokenizer.setState(bogus_doctype_state);
  3033. }
  3034. }
  3035. return true;
  3036. }
  3037. function after_doctype_public_keyword_state(buffer) {
  3038. var data = buffer.char();
  3039. if (data === InputStream.EOF) {
  3040. tokenizer._parseError("eof-in-doctype");
  3041. tokenizer._currentToken.forceQuirks = true;
  3042. buffer.unget(data);
  3043. tokenizer.setState(data_state);
  3044. tokenizer._emitCurrentToken();
  3045. } else if (isWhitespace(data)) {
  3046. tokenizer.setState(before_doctype_public_identifier_state);
  3047. } else if (data === "'" || data === '"') {
  3048. tokenizer._parseError("unexpected-char-in-doctype");
  3049. buffer.unget(data);
  3050. tokenizer.setState(before_doctype_public_identifier_state);
  3051. } else {
  3052. buffer.unget(data);
  3053. tokenizer.setState(before_doctype_public_identifier_state);
  3054. }
  3055. return true;
  3056. }
  3057. function before_doctype_public_identifier_state(buffer) {
  3058. var data = buffer.char();
  3059. if (data === InputStream.EOF) {
  3060. tokenizer._parseError("eof-in-doctype");
  3061. tokenizer._currentToken.forceQuirks = true;
  3062. buffer.unget(data);
  3063. tokenizer.setState(data_state);
  3064. tokenizer._emitCurrentToken();
  3065. } else if (isWhitespace(data)) {
  3066. } else if (data === '"') {
  3067. tokenizer._currentToken.publicId = '';
  3068. tokenizer.setState(doctype_public_identifier_double_quoted_state);
  3069. } else if (data === "'") {
  3070. tokenizer._currentToken.publicId = '';
  3071. tokenizer.setState(doctype_public_identifier_single_quoted_state);
  3072. } else if (data === '>') {
  3073. tokenizer._parseError("unexpected-end-of-doctype");
  3074. tokenizer._currentToken.forceQuirks = true;
  3075. tokenizer.setState(data_state);
  3076. tokenizer._emitCurrentToken();
  3077. } else {
  3078. tokenizer._parseError("unexpected-char-in-doctype");
  3079. tokenizer._currentToken.forceQuirks = true;
  3080. tokenizer.setState(bogus_doctype_state);
  3081. }
  3082. return true;
  3083. }
  3084. function doctype_public_identifier_double_quoted_state(buffer) {
  3085. var data = buffer.char();
  3086. if (data === InputStream.EOF) {
  3087. tokenizer._parseError("eof-in-doctype");
  3088. tokenizer._currentToken.forceQuirks = true;
  3089. buffer.unget(data);
  3090. tokenizer.setState(data_state);
  3091. tokenizer._emitCurrentToken();
  3092. } else if (data === '"') {
  3093. tokenizer.setState(after_doctype_public_identifier_state);
  3094. } else if (data === '>') {
  3095. tokenizer._parseError("unexpected-end-of-doctype");
  3096. tokenizer._currentToken.forceQuirks = true;
  3097. tokenizer.setState(data_state);
  3098. tokenizer._emitCurrentToken();
  3099. } else {
  3100. tokenizer._currentToken.publicId += data;
  3101. }
  3102. return true;
  3103. }
  3104. function doctype_public_identifier_single_quoted_state(buffer) {
  3105. var data = buffer.char();
  3106. if (data === InputStream.EOF) {
  3107. tokenizer._parseError("eof-in-doctype");
  3108. tokenizer._currentToken.forceQuirks = true;
  3109. buffer.unget(data);
  3110. tokenizer.setState(data_state);
  3111. tokenizer._emitCurrentToken();
  3112. } else if (data === "'") {
  3113. tokenizer.setState(after_doctype_public_identifier_state);
  3114. } else if (data === '>') {
  3115. tokenizer._parseError("unexpected-end-of-doctype");
  3116. tokenizer._currentToken.forceQuirks = true;
  3117. tokenizer.setState(data_state);
  3118. tokenizer._emitCurrentToken();
  3119. } else {
  3120. tokenizer._currentToken.publicId += data;
  3121. }
  3122. return true;
  3123. }
  3124. function after_doctype_public_identifier_state(buffer) {
  3125. var data = buffer.char();
  3126. if (data === InputStream.EOF) {
  3127. tokenizer._parseError("eof-in-doctype");
  3128. tokenizer._currentToken.forceQuirks = true;
  3129. tokenizer._emitCurrentToken();
  3130. buffer.unget(data);
  3131. tokenizer.setState(data_state);
  3132. } else if (isWhitespace(data)) {
  3133. tokenizer.setState(between_doctype_public_and_system_identifiers_state);
  3134. } else if (data === '>') {
  3135. tokenizer.setState(data_state);
  3136. tokenizer._emitCurrentToken();
  3137. } else if (data === '"') {
  3138. tokenizer._parseError("unexpected-char-in-doctype");
  3139. tokenizer._currentToken.systemId = '';
  3140. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3141. } else if (data === "'") {
  3142. tokenizer._parseError("unexpected-char-in-doctype");
  3143. tokenizer._currentToken.systemId = '';
  3144. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3145. } else {
  3146. tokenizer._parseError("unexpected-char-in-doctype");
  3147. tokenizer._currentToken.forceQuirks = true;
  3148. tokenizer.setState(bogus_doctype_state);
  3149. }
  3150. return true;
  3151. }
  3152. function between_doctype_public_and_system_identifiers_state(buffer) {
  3153. var data = buffer.char();
  3154. if (data === InputStream.EOF) {
  3155. tokenizer._parseError("eof-in-doctype");
  3156. tokenizer._currentToken.forceQuirks = true;
  3157. tokenizer._emitCurrentToken();
  3158. buffer.unget(data);
  3159. tokenizer.setState(data_state);
  3160. } else if (isWhitespace(data)) {
  3161. } else if (data === '>') {
  3162. tokenizer._emitCurrentToken();
  3163. tokenizer.setState(data_state);
  3164. } else if (data === '"') {
  3165. tokenizer._currentToken.systemId = '';
  3166. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3167. } else if (data === "'") {
  3168. tokenizer._currentToken.systemId = '';
  3169. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3170. } else {
  3171. tokenizer._parseError("unexpected-char-in-doctype");
  3172. tokenizer._currentToken.forceQuirks = true;
  3173. tokenizer.setState(bogus_doctype_state);
  3174. }
  3175. return true;
  3176. }
  3177. function after_doctype_system_keyword_state(buffer) {
  3178. var data = buffer.char();
  3179. if (data === InputStream.EOF) {
  3180. tokenizer._parseError("eof-in-doctype");
  3181. tokenizer._currentToken.forceQuirks = true;
  3182. tokenizer._emitCurrentToken();
  3183. buffer.unget(data);
  3184. tokenizer.setState(data_state);
  3185. } else if (isWhitespace(data)) {
  3186. tokenizer.setState(before_doctype_system_identifier_state);
  3187. } else if (data === "'" || data === '"') {
  3188. tokenizer._parseError("unexpected-char-in-doctype");
  3189. buffer.unget(data);
  3190. tokenizer.setState(before_doctype_system_identifier_state);
  3191. } else {
  3192. buffer.unget(data);
  3193. tokenizer.setState(before_doctype_system_identifier_state);
  3194. }
  3195. return true;
  3196. }
  3197. function before_doctype_system_identifier_state(buffer) {
  3198. var data = buffer.char();
  3199. if (data === InputStream.EOF) {
  3200. tokenizer._parseError("eof-in-doctype");
  3201. tokenizer._currentToken.forceQuirks = true;
  3202. tokenizer._emitCurrentToken();
  3203. buffer.unget(data);
  3204. tokenizer.setState(data_state);
  3205. } else if (isWhitespace(data)) {
  3206. } else if (data === '"') {
  3207. tokenizer._currentToken.systemId = '';
  3208. tokenizer.setState(doctype_system_identifier_double_quoted_state);
  3209. } else if (data === "'") {
  3210. tokenizer._currentToken.systemId = '';
  3211. tokenizer.setState(doctype_system_identifier_single_quoted_state);
  3212. } else if (data === '>') {
  3213. tokenizer._parseError("unexpected-end-of-doctype");
  3214. tokenizer._currentToken.forceQuirks = true;
  3215. tokenizer._emitCurrentToken();
  3216. tokenizer.setState(data_state);
  3217. } else {
  3218. tokenizer._parseError("unexpected-char-in-doctype");
  3219. tokenizer._currentToken.forceQuirks = true;
  3220. tokenizer.setState(bogus_doctype_state);
  3221. }
  3222. return true;
  3223. }
  3224. function doctype_system_identifier_double_quoted_state(buffer) {
  3225. var data = buffer.char();
  3226. if (data === InputStream.EOF) {
  3227. tokenizer._parseError("eof-in-doctype");
  3228. tokenizer._currentToken.forceQuirks = true;
  3229. tokenizer._emitCurrentToken();
  3230. buffer.unget(data);
  3231. tokenizer.setState(data_state);
  3232. } else if (data === '"') {
  3233. tokenizer.setState(after_doctype_system_identifier_state);
  3234. } else if (data === '>') {
  3235. tokenizer._parseError("unexpected-end-of-doctype");
  3236. tokenizer._currentToken.forceQuirks = true;
  3237. tokenizer._emitCurrentToken();
  3238. tokenizer.setState(data_state);
  3239. } else {
  3240. tokenizer._currentToken.systemId += data;
  3241. }
  3242. return true;
  3243. }
  3244. function doctype_system_identifier_single_quoted_state(buffer) {
  3245. var data = buffer.char();
  3246. if (data === InputStream.EOF) {
  3247. tokenizer._parseError("eof-in-doctype");
  3248. tokenizer._currentToken.forceQuirks = true;
  3249. tokenizer._emitCurrentToken();
  3250. buffer.unget(data);
  3251. tokenizer.setState(data_state);
  3252. } else if (data === "'") {
  3253. tokenizer.setState(after_doctype_system_identifier_state);
  3254. } else if (data === '>') {
  3255. tokenizer._parseError("unexpected-end-of-doctype");
  3256. tokenizer._currentToken.forceQuirks = true;
  3257. tokenizer._emitCurrentToken();
  3258. tokenizer.setState(data_state);
  3259. } else {
  3260. tokenizer._currentToken.systemId += data;
  3261. }
  3262. return true;
  3263. }
  3264. function after_doctype_system_identifier_state(buffer) {
  3265. var data = buffer.char();
  3266. if (data === InputStream.EOF) {
  3267. tokenizer._parseError("eof-in-doctype");
  3268. tokenizer._currentToken.forceQuirks = true;
  3269. tokenizer._emitCurrentToken();
  3270. buffer.unget(data);
  3271. tokenizer.setState(data_state);
  3272. } else if (isWhitespace(data)) {
  3273. } else if (data === '>') {
  3274. tokenizer._emitCurrentToken();
  3275. tokenizer.setState(data_state);
  3276. } else {
  3277. tokenizer._parseError("unexpected-char-in-doctype");
  3278. tokenizer.setState(bogus_doctype_state);
  3279. }
  3280. return true;
  3281. }
  3282. function bogus_doctype_state(buffer) {
  3283. var data = buffer.char();
  3284. if (data === InputStream.EOF) {
  3285. buffer.unget(data);
  3286. tokenizer._emitCurrentToken();
  3287. tokenizer.setState(data_state);
  3288. } else if (data === '>') {
  3289. tokenizer._emitCurrentToken();
  3290. tokenizer.setState(data_state);
  3291. }
  3292. return true;
  3293. }
  3294. };
  3295. Object.defineProperty(Tokenizer.prototype, 'lineNumber', {
  3296. get: function() {
  3297. return this._inputStream.location().line;
  3298. }
  3299. });
  3300. Object.defineProperty(Tokenizer.prototype, 'columnNumber', {
  3301. get: function() {
  3302. return this._inputStream.location().column;
  3303. }
  3304. });
  3305. exports.Tokenizer = Tokenizer;
  3306. },
  3307. {"./EntityParser":2,"./InputStream":3}],
  3308. 6:[function(_dereq_,module,exports){
  3309. var assert = _dereq_('assert');
  3310. var messages = _dereq_('./messages.json');
  3311. var constants = _dereq_('./constants');
  3312. var EventEmitter = _dereq_('events').EventEmitter;
  3313. var Tokenizer = _dereq_('./Tokenizer').Tokenizer;
  3314. var ElementStack = _dereq_('./ElementStack').ElementStack;
  3315. var StackItem = _dereq_('./StackItem').StackItem;
  3316. var Marker = {};
  3317. function isWhitespace(ch) {
  3318. return ch === " " || ch === "\n" || ch === "\t" || ch === "\r" || ch === "\f";
  3319. }
  3320. function isWhitespaceOrReplacementCharacter(ch) {
  3321. return isWhitespace(ch) || ch === '\uFFFD';
  3322. }
  3323. function isAllWhitespace(characters) {
  3324. for (var i = 0; i < characters.length; i++) {
  3325. var ch = characters[i];
  3326. if (!isWhitespace(ch))
  3327. return false;
  3328. }
  3329. return true;
  3330. }
  3331. function isAllWhitespaceOrReplacementCharacters(characters) {
  3332. for (var i = 0; i < characters.length; i++) {
  3333. var ch = characters[i];
  3334. if (!isWhitespaceOrReplacementCharacter(ch))
  3335. return false;
  3336. }
  3337. return true;
  3338. }
  3339. function getAttribute(node, name) {
  3340. for (var i = 0; i < node.attributes.length; i++) {
  3341. var attribute = node.attributes[i];
  3342. if (attribute.nodeName === name) {
  3343. return attribute;
  3344. }
  3345. }
  3346. return null;
  3347. }
  3348. function CharacterBuffer(characters) {
  3349. this.characters = characters;
  3350. this.current = 0;
  3351. this.end = this.characters.length;
  3352. }
  3353. CharacterBuffer.prototype.skipAtMostOneLeadingNewline = function() {
  3354. if (this.characters[this.current] === '\n')
  3355. this.current++;
  3356. };
  3357. CharacterBuffer.prototype.skipLeadingWhitespace = function() {
  3358. while (isWhitespace(this.characters[this.current])) {
  3359. if (++this.current == this.end)
  3360. return;
  3361. }
  3362. };
  3363. CharacterBuffer.prototype.skipLeadingNonWhitespace = function() {
  3364. while (!isWhitespace(this.characters[this.current])) {
  3365. if (++this.current == this.end)
  3366. return;
  3367. }
  3368. };
  3369. CharacterBuffer.prototype.takeRemaining = function() {
  3370. return this.characters.substring(this.current);
  3371. };
  3372. CharacterBuffer.prototype.takeLeadingWhitespace = function() {
  3373. var start = this.current;
  3374. this.skipLeadingWhitespace();
  3375. if (start === this.current)
  3376. return "";
  3377. return this.characters.substring(start, this.current - start);
  3378. };
  3379. Object.defineProperty(CharacterBuffer.prototype, 'length', {
  3380. get: function(){
  3381. return this.end - this.current;
  3382. }
  3383. });
  3384. function TreeBuilder() {
  3385. this.tokenizer = null;
  3386. this.errorHandler = null;
  3387. this.scriptingEnabled = false;
  3388. this.document = null;
  3389. this.head = null;
  3390. this.form = null;
  3391. this.openElements = new ElementStack();
  3392. this.activeFormattingElements = [];
  3393. this.insertionMode = null;
  3394. this.insertionModeName = "";
  3395. this.originalInsertionMode = "";
  3396. this.inQuirksMode = false; // TODO quirks mode
  3397. this.compatMode = "no quirks";
  3398. this.framesetOk = true;
  3399. this.redirectAttachToFosterParent = false;
  3400. this.selfClosingFlagAcknowledged = false;
  3401. this.context = "";
  3402. this.pendingTableCharacters = [];
  3403. this.shouldSkipLeadingNewline = false;
  3404. var tree = this;
  3405. var modes = this.insertionModes = {};
  3406. modes.base = {
  3407. end_tag_handlers: {"-default": 'endTagOther'},
  3408. start_tag_handlers: {"-default": 'startTagOther'},
  3409. processEOF: function() {
  3410. tree.generateImpliedEndTags();
  3411. if (tree.openElements.length > 2) {
  3412. tree.parseError('expected-closing-tag-but-got-eof');
  3413. } else if (tree.openElements.length == 2 &&
  3414. tree.openElements.item(1).localName != 'body') {
  3415. tree.parseError('expected-closing-tag-but-got-eof');
  3416. } else if (tree.context && tree.openElements.length > 1) {
  3417. }
  3418. },
  3419. processComment: function(data) {
  3420. tree.insertComment(data, tree.currentStackItem().node);
  3421. },
  3422. processDoctype: function(name, publicId, systemId, forceQuirks) {
  3423. tree.parseError('unexpected-doctype');
  3424. },
  3425. processStartTag: function(name, attributes, selfClosing) {
  3426. if (this[this.start_tag_handlers[name]]) {
  3427. this[this.start_tag_handlers[name]](name, attributes, selfClosing);
  3428. } else if (this[this.start_tag_handlers["-default"]]) {
  3429. this[this.start_tag_handlers["-default"]](name, attributes, selfClosing);
  3430. } else {
  3431. throw(new Error("No handler found for "+name));
  3432. }
  3433. },
  3434. processEndTag: function(name) {
  3435. if (this[this.end_tag_handlers[name]]) {
  3436. this[this.end_tag_handlers[name]](name);
  3437. } else if (this[this.end_tag_handlers["-default"]]) {
  3438. this[this.end_tag_handlers["-default"]](name);
  3439. } else {
  3440. throw(new Error("No handler found for "+name));
  3441. }
  3442. },
  3443. startTagHtml: function(name, attributes) {
  3444. modes.inBody.startTagHtml(name, attributes);
  3445. }
  3446. };
  3447. modes.initial = Object.create(modes.base);
  3448. modes.initial.processEOF = function() {
  3449. tree.parseError("expected-doctype-but-got-eof");
  3450. this.anythingElse();
  3451. tree.insertionMode.processEOF();
  3452. };
  3453. modes.initial.processComment = function(data) {
  3454. tree.insertComment(data, tree.document);
  3455. };
  3456. modes.initial.processDoctype = function(name, publicId, systemId, forceQuirks) {
  3457. tree.insertDoctype(name || '', publicId || '', systemId || '');
  3458. if (forceQuirks || name != 'html' || (publicId != null && ([
  3459. "+//silmaril//dtd html pro v0r11 19970101//",
  3460. "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
  3461. "-//as//dtd html 3.0 aswedit + extensions//",
  3462. "-//ietf//dtd html 2.0 level 1//",
  3463. "-//ietf//dtd html 2.0 level 2//",
  3464. "-//ietf//dtd html 2.0 strict level 1//",
  3465. "-//ietf//dtd html 2.0 strict level 2//",
  3466. "-//ietf//dtd html 2.0 strict//",
  3467. "-//ietf//dtd html 2.0//",
  3468. "-//ietf//dtd html 2.1e//",
  3469. "-//ietf//dtd html 3.0//",
  3470. "-//ietf//dtd html 3.0//",
  3471. "-//ietf//dtd html 3.2 final//",
  3472. "-//ietf//dtd html 3.2//",
  3473. "-//ietf//dtd html 3//",
  3474. "-//ietf//dtd html level 0//",
  3475. "-//ietf//dtd html level 0//",
  3476. "-//ietf//dtd html level 1//",
  3477. "-//ietf//dtd html level 1//",
  3478. "-//ietf//dtd html level 2//",
  3479. "-//ietf//dtd html level 2//",
  3480. "-//ietf//dtd html level 3//",
  3481. "-//ietf//dtd html level 3//",
  3482. "-//ietf//dtd html strict level 0//",
  3483. "-//ietf//dtd html strict level 0//",
  3484. "-//ietf//dtd html strict level 1//",
  3485. "-//ietf//dtd html strict level 1//",
  3486. "-//ietf//dtd html strict level 2//",
  3487. "-//ietf//dtd html strict level 2//",
  3488. "-//ietf//dtd html strict level 3//",
  3489. "-//ietf//dtd html strict level 3//",
  3490. "-//ietf//dtd html strict//",
  3491. "-//ietf//dtd html strict//",
  3492. "-//ietf//dtd html strict//",
  3493. "-//ietf//dtd html//",
  3494. "-//ietf//dtd html//",
  3495. "-//ietf//dtd html//",
  3496. "-//metrius//dtd metrius presentational//",
  3497. "-//microsoft//dtd internet explorer 2.0 html strict//",
  3498. "-//microsoft//dtd internet explorer 2.0 html//",
  3499. "-//microsoft//dtd internet explorer 2.0 tables//",
  3500. "-//microsoft//dtd internet explorer 3.0 html strict//",
  3501. "-//microsoft//dtd internet explorer 3.0 html//",
  3502. "-//microsoft//dtd internet explorer 3.0 tables//",
  3503. "-//netscape comm. corp.//dtd html//",
  3504. "-//netscape comm. corp.//dtd strict html//",
  3505. "-//o'reilly and associates//dtd html 2.0//",
  3506. "-//o'reilly and associates//dtd html extended 1.0//",
  3507. "-//spyglass//dtd html 2.0 extended//",
  3508. "-//sq//dtd html 2.0 hotmetal + extensions//",
  3509. "-//sun microsystems corp.//dtd hotjava html//",
  3510. "-//sun microsystems corp.//dtd hotjava strict html//",
  3511. "-//w3c//dtd html 3 1995-03-24//",
  3512. "-//w3c//dtd html 3.2 draft//",
  3513. "-//w3c//dtd html 3.2 final//",
  3514. "-//w3c//dtd html 3.2//",
  3515. "-//w3c//dtd html 3.2s draft//",
  3516. "-//w3c//dtd html 4.0 frameset//",
  3517. "-//w3c//dtd html 4.0 transitional//",
  3518. "-//w3c//dtd html experimental 19960712//",
  3519. "-//w3c//dtd html experimental 970421//",
  3520. "-//w3c//dtd w3 html//",
  3521. "-//w3o//dtd w3 html 3.0//",
  3522. "-//webtechs//dtd mozilla html 2.0//",
  3523. "-//webtechs//dtd mozilla html//",
  3524. "html"
  3525. ].some(publicIdStartsWith)
  3526. || [
  3527. "-//w3o//dtd w3 html strict 3.0//en//",
  3528. "-/w3c/dtd html 4.0 transitional/en",
  3529. "html"
  3530. ].indexOf(publicId.toLowerCase()) > -1
  3531. || (systemId == null && [
  3532. "-//w3c//dtd html 4.01 transitional//",
  3533. "-//w3c//dtd html 4.01 frameset//"
  3534. ].some(publicIdStartsWith)))
  3535. )
  3536. || (systemId != null && (systemId.toLowerCase() == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"))
  3537. ) {
  3538. tree.compatMode = "quirks";
  3539. tree.parseError("quirky-doctype");
  3540. } else if (publicId != null && ([
  3541. "-//w3c//dtd xhtml 1.0 transitional//",
  3542. "-//w3c//dtd xhtml 1.0 frameset//"
  3543. ].some(publicIdStartsWith)
  3544. || (systemId != null && [
  3545. "-//w3c//dtd html 4.01 transitional//",
  3546. "-//w3c//dtd html 4.01 frameset//"
  3547. ].indexOf(publicId.toLowerCase()) > -1))
  3548. ) {
  3549. tree.compatMode = "limited quirks";
  3550. tree.parseError("almost-standards-doctype");
  3551. } else {
  3552. if ((publicId == "-//W3C//DTD HTML 4.0//EN" && (systemId == null || systemId == "http://www.w3.org/TR/REC-html40/strict.dtd"))
  3553. || (publicId == "-//W3C//DTD HTML 4.01//EN" && (systemId == null || systemId == "http://www.w3.org/TR/html4/strict.dtd"))
  3554. || (publicId == "-//W3C//DTD XHTML 1.0 Strict//EN" && (systemId == "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"))
  3555. || (publicId == "-//W3C//DTD XHTML 1.1//EN" && (systemId == "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"))
  3556. ) {
  3557. } else if (!((systemId == null || systemId == "about:legacy-compat") && publicId == null)) {
  3558. tree.parseError("unknown-doctype");
  3559. }
  3560. }
  3561. tree.setInsertionMode('beforeHTML');
  3562. function publicIdStartsWith(string) {
  3563. return publicId.toLowerCase().indexOf(string) === 0;
  3564. }
  3565. };
  3566. modes.initial.processCharacters = function(buffer) {
  3567. buffer.skipLeadingWhitespace();
  3568. if (!buffer.length)
  3569. return;
  3570. tree.parseError('expected-doctype-but-got-chars');
  3571. this.anythingElse();
  3572. tree.insertionMode.processCharacters(buffer);
  3573. };
  3574. modes.initial.processStartTag = function(name, attributes, selfClosing) {
  3575. tree.parseError('expected-doctype-but-got-start-tag', {name: name});
  3576. this.anythingElse();
  3577. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3578. };
  3579. modes.initial.processEndTag = function(name) {
  3580. tree.parseError('expected-doctype-but-got-end-tag', {name: name});
  3581. this.anythingElse();
  3582. tree.insertionMode.processEndTag(name);
  3583. };
  3584. modes.initial.anythingElse = function() {
  3585. tree.compatMode = 'quirks';
  3586. tree.setInsertionMode('beforeHTML');
  3587. };
  3588. modes.beforeHTML = Object.create(modes.base);
  3589. modes.beforeHTML.start_tag_handlers = {
  3590. html: 'startTagHtml',
  3591. '-default': 'startTagOther'
  3592. };
  3593. modes.beforeHTML.processEOF = function() {
  3594. this.anythingElse();
  3595. tree.insertionMode.processEOF();
  3596. };
  3597. modes.beforeHTML.processComment = function(data) {
  3598. tree.insertComment(data, tree.document);
  3599. };
  3600. modes.beforeHTML.processCharacters = function(buffer) {
  3601. buffer.skipLeadingWhitespace();
  3602. if (!buffer.length)
  3603. return;
  3604. this.anythingElse();
  3605. tree.insertionMode.processCharacters(buffer);
  3606. };
  3607. modes.beforeHTML.startTagHtml = function(name, attributes, selfClosing) {
  3608. tree.insertHtmlElement(attributes);
  3609. tree.setInsertionMode('beforeHead');
  3610. };
  3611. modes.beforeHTML.startTagOther = function(name, attributes, selfClosing) {
  3612. this.anythingElse();
  3613. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3614. };
  3615. modes.beforeHTML.processEndTag = function(name) {
  3616. this.anythingElse();
  3617. tree.insertionMode.processEndTag(name);
  3618. };
  3619. modes.beforeHTML.anythingElse = function() {
  3620. tree.insertHtmlElement();
  3621. tree.setInsertionMode('beforeHead');
  3622. };
  3623. modes.afterAfterBody = Object.create(modes.base);
  3624. modes.afterAfterBody.start_tag_handlers = {
  3625. html: 'startTagHtml',
  3626. '-default': 'startTagOther'
  3627. };
  3628. modes.afterAfterBody.processComment = function(data) {
  3629. tree.insertComment(data, tree.document);
  3630. };
  3631. modes.afterAfterBody.processDoctype = function(data) {
  3632. modes.inBody.processDoctype(data);
  3633. };
  3634. modes.afterAfterBody.startTagHtml = function(data, attributes) {
  3635. modes.inBody.startTagHtml(data, attributes);
  3636. };
  3637. modes.afterAfterBody.startTagOther = function(name, attributes, selfClosing) {
  3638. tree.parseError('unexpected-start-tag', {name: name});
  3639. tree.setInsertionMode('inBody');
  3640. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3641. };
  3642. modes.afterAfterBody.endTagOther = function(name) {
  3643. tree.parseError('unexpected-end-tag', {name: name});
  3644. tree.setInsertionMode('inBody');
  3645. tree.insertionMode.processEndTag(name);
  3646. };
  3647. modes.afterAfterBody.processCharacters = function(data) {
  3648. if (!isAllWhitespace(data.characters)) {
  3649. tree.parseError('unexpected-char-after-body');
  3650. tree.setInsertionMode('inBody');
  3651. return tree.insertionMode.processCharacters(data);
  3652. }
  3653. modes.inBody.processCharacters(data);
  3654. };
  3655. modes.afterBody = Object.create(modes.base);
  3656. modes.afterBody.end_tag_handlers = {
  3657. html: 'endTagHtml',
  3658. '-default': 'endTagOther'
  3659. };
  3660. modes.afterBody.processComment = function(data) {
  3661. tree.insertComment(data, tree.openElements.rootNode);
  3662. };
  3663. modes.afterBody.processCharacters = function(data) {
  3664. if (!isAllWhitespace(data.characters)) {
  3665. tree.parseError('unexpected-char-after-body');
  3666. tree.setInsertionMode('inBody');
  3667. return tree.insertionMode.processCharacters(data);
  3668. }
  3669. modes.inBody.processCharacters(data);
  3670. };
  3671. modes.afterBody.processStartTag = function(name, attributes, selfClosing) {
  3672. tree.parseError('unexpected-start-tag-after-body', {name: name});
  3673. tree.setInsertionMode('inBody');
  3674. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3675. };
  3676. modes.afterBody.endTagHtml = function(name) {
  3677. if (tree.context) {
  3678. tree.parseError('end-html-in-innerhtml');
  3679. } else {
  3680. tree.setInsertionMode('afterAfterBody');
  3681. }
  3682. };
  3683. modes.afterBody.endTagOther = function(name) {
  3684. tree.parseError('unexpected-end-tag-after-body', {name: name});
  3685. tree.setInsertionMode('inBody');
  3686. tree.insertionMode.processEndTag(name);
  3687. };
  3688. modes.afterFrameset = Object.create(modes.base);
  3689. modes.afterFrameset.start_tag_handlers = {
  3690. html: 'startTagHtml',
  3691. noframes: 'startTagNoframes',
  3692. '-default': 'startTagOther'
  3693. };
  3694. modes.afterFrameset.end_tag_handlers = {
  3695. html: 'endTagHtml',
  3696. '-default': 'endTagOther'
  3697. };
  3698. modes.afterFrameset.processCharacters = function(buffer) {
  3699. var characters = buffer.takeRemaining();
  3700. var whitespace = "";
  3701. for (var i = 0; i < characters.length; i++) {
  3702. var ch = characters[i];
  3703. if (isWhitespace(ch))
  3704. whitespace += ch;
  3705. }
  3706. if (whitespace) {
  3707. tree.insertText(whitespace);
  3708. }
  3709. if (whitespace.length < characters.length)
  3710. tree.parseError('expected-eof-but-got-char');
  3711. };
  3712. modes.afterFrameset.startTagNoframes = function(name, attributes) {
  3713. modes.inHead.processStartTag(name, attributes);
  3714. };
  3715. modes.afterFrameset.startTagOther = function(name, attributes) {
  3716. tree.parseError("unexpected-start-tag-after-frameset", {name: name});
  3717. };
  3718. modes.afterFrameset.endTagHtml = function(name) {
  3719. tree.setInsertionMode('afterAfterFrameset');
  3720. };
  3721. modes.afterFrameset.endTagOther = function(name) {
  3722. tree.parseError("unexpected-end-tag-after-frameset", {name: name});
  3723. };
  3724. modes.beforeHead = Object.create(modes.base);
  3725. modes.beforeHead.start_tag_handlers = {
  3726. html: 'startTagHtml',
  3727. head: 'startTagHead',
  3728. '-default': 'startTagOther'
  3729. };
  3730. modes.beforeHead.end_tag_handlers = {
  3731. html: 'endTagImplyHead',
  3732. head: 'endTagImplyHead',
  3733. body: 'endTagImplyHead',
  3734. br: 'endTagImplyHead',
  3735. '-default': 'endTagOther'
  3736. };
  3737. modes.beforeHead.processEOF = function() {
  3738. this.startTagHead('head', []);
  3739. tree.insertionMode.processEOF();
  3740. };
  3741. modes.beforeHead.processCharacters = function(buffer) {
  3742. buffer.skipLeadingWhitespace();
  3743. if (!buffer.length)
  3744. return;
  3745. this.startTagHead('head', []);
  3746. tree.insertionMode.processCharacters(buffer);
  3747. };
  3748. modes.beforeHead.startTagHead = function(name, attributes) {
  3749. tree.insertHeadElement(attributes);
  3750. tree.setInsertionMode('inHead');
  3751. };
  3752. modes.beforeHead.startTagOther = function(name, attributes, selfClosing) {
  3753. this.startTagHead('head', []);
  3754. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3755. };
  3756. modes.beforeHead.endTagImplyHead = function(name) {
  3757. this.startTagHead('head', []);
  3758. tree.insertionMode.processEndTag(name);
  3759. };
  3760. modes.beforeHead.endTagOther = function(name) {
  3761. tree.parseError('end-tag-after-implied-root', {name: name});
  3762. };
  3763. modes.inHead = Object.create(modes.base);
  3764. modes.inHead.start_tag_handlers = {
  3765. html: 'startTagHtml',
  3766. head: 'startTagHead',
  3767. title: 'startTagTitle',
  3768. script: 'startTagScript',
  3769. style: 'startTagNoFramesStyle',
  3770. noscript: 'startTagNoScript',
  3771. noframes: 'startTagNoFramesStyle',
  3772. base: 'startTagBaseBasefontBgsoundLink',
  3773. basefont: 'startTagBaseBasefontBgsoundLink',
  3774. bgsound: 'startTagBaseBasefontBgsoundLink',
  3775. link: 'startTagBaseBasefontBgsoundLink',
  3776. meta: 'startTagMeta',
  3777. "-default": 'startTagOther'
  3778. };
  3779. modes.inHead.end_tag_handlers = {
  3780. head: 'endTagHead',
  3781. html: 'endTagHtmlBodyBr',
  3782. body: 'endTagHtmlBodyBr',
  3783. br: 'endTagHtmlBodyBr',
  3784. "-default": 'endTagOther'
  3785. };
  3786. modes.inHead.processEOF = function() {
  3787. var name = tree.currentStackItem().localName;
  3788. if (['title', 'style', 'script'].indexOf(name) != -1) {
  3789. tree.parseError("expected-named-closing-tag-but-got-eof", {name: name});
  3790. tree.popElement();
  3791. }
  3792. this.anythingElse();
  3793. tree.insertionMode.processEOF();
  3794. };
  3795. modes.inHead.processCharacters = function(buffer) {
  3796. var leadingWhitespace = buffer.takeLeadingWhitespace();
  3797. if (leadingWhitespace)
  3798. tree.insertText(leadingWhitespace);
  3799. if (!buffer.length)
  3800. return;
  3801. this.anythingElse();
  3802. tree.insertionMode.processCharacters(buffer);
  3803. };
  3804. modes.inHead.startTagHtml = function(name, attributes) {
  3805. modes.inBody.processStartTag(name, attributes);
  3806. };
  3807. modes.inHead.startTagHead = function(name, attributes) {
  3808. tree.parseError('two-heads-are-not-better-than-one');
  3809. };
  3810. modes.inHead.startTagTitle = function(name, attributes) {
  3811. tree.processGenericRCDATAStartTag(name, attributes);
  3812. };
  3813. modes.inHead.startTagNoScript = function(name, attributes) {
  3814. if (tree.scriptingEnabled)
  3815. return tree.processGenericRawTextStartTag(name, attributes);
  3816. tree.insertElement(name, attributes);
  3817. tree.setInsertionMode('inHeadNoscript');
  3818. };
  3819. modes.inHead.startTagNoFramesStyle = function(name, attributes) {
  3820. tree.processGenericRawTextStartTag(name, attributes);
  3821. };
  3822. modes.inHead.startTagScript = function(name, attributes) {
  3823. tree.insertElement(name, attributes);
  3824. tree.tokenizer.setState(Tokenizer.SCRIPT_DATA);
  3825. tree.originalInsertionMode = tree.insertionModeName;
  3826. tree.setInsertionMode('text');
  3827. };
  3828. modes.inHead.startTagBaseBasefontBgsoundLink = function(name, attributes) {
  3829. tree.insertSelfClosingElement(name, attributes);
  3830. };
  3831. modes.inHead.startTagMeta = function(name, attributes) {
  3832. tree.insertSelfClosingElement(name, attributes);
  3833. };
  3834. modes.inHead.startTagOther = function(name, attributes, selfClosing) {
  3835. this.anythingElse();
  3836. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3837. };
  3838. modes.inHead.endTagHead = function(name) {
  3839. if (tree.openElements.item(tree.openElements.length - 1).localName == 'head') {
  3840. tree.openElements.pop();
  3841. } else {
  3842. tree.parseError('unexpected-end-tag', {name: 'head'});
  3843. }
  3844. tree.setInsertionMode('afterHead');
  3845. };
  3846. modes.inHead.endTagHtmlBodyBr = function(name) {
  3847. this.anythingElse();
  3848. tree.insertionMode.processEndTag(name);
  3849. };
  3850. modes.inHead.endTagOther = function(name) {
  3851. tree.parseError('unexpected-end-tag', {name: name});
  3852. };
  3853. modes.inHead.anythingElse = function() {
  3854. this.endTagHead('head');
  3855. };
  3856. modes.afterHead = Object.create(modes.base);
  3857. modes.afterHead.start_tag_handlers = {
  3858. html: 'startTagHtml',
  3859. head: 'startTagHead',
  3860. body: 'startTagBody',
  3861. frameset: 'startTagFrameset',
  3862. base: 'startTagFromHead',
  3863. link: 'startTagFromHead',
  3864. meta: 'startTagFromHead',
  3865. script: 'startTagFromHead',
  3866. style: 'startTagFromHead',
  3867. title: 'startTagFromHead',
  3868. "-default": 'startTagOther'
  3869. };
  3870. modes.afterHead.end_tag_handlers = {
  3871. body: 'endTagBodyHtmlBr',
  3872. html: 'endTagBodyHtmlBr',
  3873. br: 'endTagBodyHtmlBr',
  3874. "-default": 'endTagOther'
  3875. };
  3876. modes.afterHead.processEOF = function() {
  3877. this.anythingElse();
  3878. tree.insertionMode.processEOF();
  3879. };
  3880. modes.afterHead.processCharacters = function(buffer) {
  3881. var leadingWhitespace = buffer.takeLeadingWhitespace();
  3882. if (leadingWhitespace)
  3883. tree.insertText(leadingWhitespace);
  3884. if (!buffer.length)
  3885. return;
  3886. this.anythingElse();
  3887. tree.insertionMode.processCharacters(buffer);
  3888. };
  3889. modes.afterHead.startTagHtml = function(name, attributes) {
  3890. modes.inBody.processStartTag(name, attributes);
  3891. };
  3892. modes.afterHead.startTagBody = function(name, attributes) {
  3893. tree.framesetOk = false;
  3894. tree.insertBodyElement(attributes);
  3895. tree.setInsertionMode('inBody');
  3896. };
  3897. modes.afterHead.startTagFrameset = function(name, attributes) {
  3898. tree.insertElement(name, attributes);
  3899. tree.setInsertionMode('inFrameset');
  3900. };
  3901. modes.afterHead.startTagFromHead = function(name, attributes, selfClosing) {
  3902. tree.parseError("unexpected-start-tag-out-of-my-head", {name: name});
  3903. tree.openElements.push(tree.head);
  3904. modes.inHead.processStartTag(name, attributes, selfClosing);
  3905. tree.openElements.remove(tree.head);
  3906. };
  3907. modes.afterHead.startTagHead = function(name, attributes, selfClosing) {
  3908. tree.parseError('unexpected-start-tag', {name: name});
  3909. };
  3910. modes.afterHead.startTagOther = function(name, attributes, selfClosing) {
  3911. this.anythingElse();
  3912. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  3913. };
  3914. modes.afterHead.endTagBodyHtmlBr = function(name) {
  3915. this.anythingElse();
  3916. tree.insertionMode.processEndTag(name);
  3917. };
  3918. modes.afterHead.endTagOther = function(name) {
  3919. tree.parseError('unexpected-end-tag', {name: name});
  3920. };
  3921. modes.afterHead.anythingElse = function() {
  3922. tree.insertBodyElement([]);
  3923. tree.setInsertionMode('inBody');
  3924. tree.framesetOk = true;
  3925. }
  3926. modes.inBody = Object.create(modes.base);
  3927. modes.inBody.start_tag_handlers = {
  3928. html: 'startTagHtml',
  3929. head: 'startTagMisplaced',
  3930. base: 'startTagProcessInHead',
  3931. basefont: 'startTagProcessInHead',
  3932. bgsound: 'startTagProcessInHead',
  3933. link: 'startTagProcessInHead',
  3934. meta: 'startTagProcessInHead',
  3935. noframes: 'startTagProcessInHead',
  3936. script: 'startTagProcessInHead',
  3937. style: 'startTagProcessInHead',
  3938. title: 'startTagProcessInHead',
  3939. body: 'startTagBody',
  3940. form: 'startTagForm',
  3941. plaintext: 'startTagPlaintext',
  3942. a: 'startTagA',
  3943. button: 'startTagButton',
  3944. xmp: 'startTagXmp',
  3945. table: 'startTagTable',
  3946. hr: 'startTagHr',
  3947. image: 'startTagImage',
  3948. input: 'startTagInput',
  3949. textarea: 'startTagTextarea',
  3950. select: 'startTagSelect',
  3951. isindex: 'startTagIsindex',
  3952. applet: 'startTagAppletMarqueeObject',
  3953. marquee: 'startTagAppletMarqueeObject',
  3954. object: 'startTagAppletMarqueeObject',
  3955. li: 'startTagListItem',
  3956. dd: 'startTagListItem',
  3957. dt: 'startTagListItem',
  3958. address: 'startTagCloseP',
  3959. article: 'startTagCloseP',
  3960. aside: 'startTagCloseP',
  3961. blockquote: 'startTagCloseP',
  3962. center: 'startTagCloseP',
  3963. details: 'startTagCloseP',
  3964. dir: 'startTagCloseP',
  3965. div: 'startTagCloseP',
  3966. dl: 'startTagCloseP',
  3967. fieldset: 'startTagCloseP',
  3968. figcaption: 'startTagCloseP',
  3969. figure: 'startTagCloseP',
  3970. footer: 'startTagCloseP',
  3971. header: 'startTagCloseP',
  3972. hgroup: 'startTagCloseP',
  3973. main: 'startTagCloseP',
  3974. menu: 'startTagCloseP',
  3975. nav: 'startTagCloseP',
  3976. ol: 'startTagCloseP',
  3977. p: 'startTagCloseP',
  3978. section: 'startTagCloseP',
  3979. summary: 'startTagCloseP',
  3980. ul: 'startTagCloseP',
  3981. listing: 'startTagPreListing',
  3982. pre: 'startTagPreListing',
  3983. b: 'startTagFormatting',
  3984. big: 'startTagFormatting',
  3985. code: 'startTagFormatting',
  3986. em: 'startTagFormatting',
  3987. font: 'startTagFormatting',
  3988. i: 'startTagFormatting',
  3989. s: 'startTagFormatting',
  3990. small: 'startTagFormatting',
  3991. strike: 'startTagFormatting',
  3992. strong: 'startTagFormatting',
  3993. tt: 'startTagFormatting',
  3994. u: 'startTagFormatting',
  3995. nobr: 'startTagNobr',
  3996. area: 'startTagVoidFormatting',
  3997. br: 'startTagVoidFormatting',
  3998. embed: 'startTagVoidFormatting',
  3999. img: 'startTagVoidFormatting',
  4000. keygen: 'startTagVoidFormatting',
  4001. wbr: 'startTagVoidFormatting',
  4002. param: 'startTagParamSourceTrack',
  4003. source: 'startTagParamSourceTrack',
  4004. track: 'startTagParamSourceTrack',
  4005. iframe: 'startTagIFrame',
  4006. noembed: 'startTagRawText',
  4007. noscript: 'startTagRawText',
  4008. h1: 'startTagHeading',
  4009. h2: 'startTagHeading',
  4010. h3: 'startTagHeading',
  4011. h4: 'startTagHeading',
  4012. h5: 'startTagHeading',
  4013. h6: 'startTagHeading',
  4014. caption: 'startTagMisplaced',
  4015. col: 'startTagMisplaced',
  4016. colgroup: 'startTagMisplaced',
  4017. frame: 'startTagMisplaced',
  4018. frameset: 'startTagFrameset',
  4019. tbody: 'startTagMisplaced',
  4020. td: 'startTagMisplaced',
  4021. tfoot: 'startTagMisplaced',
  4022. th: 'startTagMisplaced',
  4023. thead: 'startTagMisplaced',
  4024. tr: 'startTagMisplaced',
  4025. option: 'startTagOptionOptgroup',
  4026. optgroup: 'startTagOptionOptgroup',
  4027. math: 'startTagMath',
  4028. svg: 'startTagSVG',
  4029. rt: 'startTagRpRt',
  4030. rp: 'startTagRpRt',
  4031. "-default": 'startTagOther'
  4032. };
  4033. modes.inBody.end_tag_handlers = {
  4034. p: 'endTagP',
  4035. body: 'endTagBody',
  4036. html: 'endTagHtml',
  4037. address: 'endTagBlock',
  4038. article: 'endTagBlock',
  4039. aside: 'endTagBlock',
  4040. blockquote: 'endTagBlock',
  4041. button: 'endTagBlock',
  4042. center: 'endTagBlock',
  4043. details: 'endTagBlock',
  4044. dir: 'endTagBlock',
  4045. div: 'endTagBlock',
  4046. dl: 'endTagBlock',
  4047. fieldset: 'endTagBlock',
  4048. figcaption: 'endTagBlock',
  4049. figure: 'endTagBlock',
  4050. footer: 'endTagBlock',
  4051. header: 'endTagBlock',
  4052. hgroup: 'endTagBlock',
  4053. listing: 'endTagBlock',
  4054. main: 'endTagBlock',
  4055. menu: 'endTagBlock',
  4056. nav: 'endTagBlock',
  4057. ol: 'endTagBlock',
  4058. pre: 'endTagBlock',
  4059. section: 'endTagBlock',
  4060. summary: 'endTagBlock',
  4061. ul: 'endTagBlock',
  4062. form: 'endTagForm',
  4063. applet: 'endTagAppletMarqueeObject',
  4064. marquee: 'endTagAppletMarqueeObject',
  4065. object: 'endTagAppletMarqueeObject',
  4066. dd: 'endTagListItem',
  4067. dt: 'endTagListItem',
  4068. li: 'endTagListItem',
  4069. h1: 'endTagHeading',
  4070. h2: 'endTagHeading',
  4071. h3: 'endTagHeading',
  4072. h4: 'endTagHeading',
  4073. h5: 'endTagHeading',
  4074. h6: 'endTagHeading',
  4075. a: 'endTagFormatting',
  4076. b: 'endTagFormatting',
  4077. big: 'endTagFormatting',
  4078. code: 'endTagFormatting',
  4079. em: 'endTagFormatting',
  4080. font: 'endTagFormatting',
  4081. i: 'endTagFormatting',
  4082. nobr: 'endTagFormatting',
  4083. s: 'endTagFormatting',
  4084. small: 'endTagFormatting',
  4085. strike: 'endTagFormatting',
  4086. strong: 'endTagFormatting',
  4087. tt: 'endTagFormatting',
  4088. u: 'endTagFormatting',
  4089. br: 'endTagBr',
  4090. "-default": 'endTagOther'
  4091. };
  4092. modes.inBody.processCharacters = function(buffer) {
  4093. if (tree.shouldSkipLeadingNewline) {
  4094. tree.shouldSkipLeadingNewline = false;
  4095. buffer.skipAtMostOneLeadingNewline();
  4096. }
  4097. tree.reconstructActiveFormattingElements();
  4098. var characters = buffer.takeRemaining();
  4099. characters = characters.replace(/\u0000/g, function(match, index){
  4100. tree.parseError("invalid-codepoint");
  4101. return '';
  4102. });
  4103. if (!characters)
  4104. return;
  4105. tree.insertText(characters);
  4106. if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
  4107. tree.framesetOk = false;
  4108. };
  4109. modes.inBody.startTagHtml = function(name, attributes) {
  4110. tree.parseError('non-html-root');
  4111. tree.addAttributesToElement(tree.openElements.rootNode, attributes);
  4112. };
  4113. modes.inBody.startTagProcessInHead = function(name, attributes) {
  4114. modes.inHead.processStartTag(name, attributes);
  4115. };
  4116. modes.inBody.startTagBody = function(name, attributes) {
  4117. tree.parseError('unexpected-start-tag', {name: 'body'});
  4118. if (tree.openElements.length == 1 ||
  4119. tree.openElements.item(1).localName != 'body') {
  4120. assert.ok(tree.context);
  4121. } else {
  4122. tree.framesetOk = false;
  4123. tree.addAttributesToElement(tree.openElements.bodyElement, attributes);
  4124. }
  4125. };
  4126. modes.inBody.startTagFrameset = function(name, attributes) {
  4127. tree.parseError('unexpected-start-tag', {name: 'frameset'});
  4128. if (tree.openElements.length == 1 ||
  4129. tree.openElements.item(1).localName != 'body') {
  4130. assert.ok(tree.context);
  4131. } else if (tree.framesetOk) {
  4132. tree.detachFromParent(tree.openElements.bodyElement);
  4133. while (tree.openElements.length > 1)
  4134. tree.openElements.pop();
  4135. tree.insertElement(name, attributes);
  4136. tree.setInsertionMode('inFrameset');
  4137. }
  4138. };
  4139. modes.inBody.startTagCloseP = function(name, attributes) {
  4140. if (tree.openElements.inButtonScope('p'))
  4141. this.endTagP('p');
  4142. tree.insertElement(name, attributes);
  4143. };
  4144. modes.inBody.startTagPreListing = function(name, attributes) {
  4145. if (tree.openElements.inButtonScope('p'))
  4146. this.endTagP('p');
  4147. tree.insertElement(name, attributes);
  4148. tree.framesetOk = false;
  4149. tree.shouldSkipLeadingNewline = true;
  4150. };
  4151. modes.inBody.startTagForm = function(name, attributes) {
  4152. if (tree.form) {
  4153. tree.parseError('unexpected-start-tag', {name: name});
  4154. } else {
  4155. if (tree.openElements.inButtonScope('p'))
  4156. this.endTagP('p');
  4157. tree.insertElement(name, attributes);
  4158. tree.form = tree.currentStackItem();
  4159. }
  4160. };
  4161. modes.inBody.startTagRpRt = function(name, attributes) {
  4162. if (tree.openElements.inScope('ruby')) {
  4163. tree.generateImpliedEndTags();
  4164. if (tree.currentStackItem().localName != 'ruby') {
  4165. tree.parseError('unexpected-start-tag', {name: name});
  4166. }
  4167. }
  4168. tree.insertElement(name, attributes);
  4169. };
  4170. modes.inBody.startTagListItem = function(name, attributes) {
  4171. var stopNames = {li: ['li'], dd: ['dd', 'dt'], dt: ['dd', 'dt']};
  4172. var stopName = stopNames[name];
  4173. var els = tree.openElements;
  4174. for (var i = els.length - 1; i >= 0; i--) {
  4175. var node = els.item(i);
  4176. if (stopName.indexOf(node.localName) != -1) {
  4177. tree.insertionMode.processEndTag(node.localName);
  4178. break;
  4179. }
  4180. if (node.isSpecial() && node.localName !== 'p' && node.localName !== 'address' && node.localName !== 'div')
  4181. break;
  4182. }
  4183. if (tree.openElements.inButtonScope('p'))
  4184. this.endTagP('p');
  4185. tree.insertElement(name, attributes);
  4186. tree.framesetOk = false;
  4187. };
  4188. modes.inBody.startTagPlaintext = function(name, attributes) {
  4189. if (tree.openElements.inButtonScope('p'))
  4190. this.endTagP('p');
  4191. tree.insertElement(name, attributes);
  4192. tree.tokenizer.setState(Tokenizer.PLAINTEXT);
  4193. };
  4194. modes.inBody.startTagHeading = function(name, attributes) {
  4195. if (tree.openElements.inButtonScope('p'))
  4196. this.endTagP('p');
  4197. if (tree.currentStackItem().isNumberedHeader()) {
  4198. tree.parseError('unexpected-start-tag', {name: name});
  4199. tree.popElement();
  4200. }
  4201. tree.insertElement(name, attributes);
  4202. };
  4203. modes.inBody.startTagA = function(name, attributes) {
  4204. var activeA = tree.elementInActiveFormattingElements('a');
  4205. if (activeA) {
  4206. tree.parseError("unexpected-start-tag-implies-end-tag", {startName: "a", endName: "a"});
  4207. tree.adoptionAgencyEndTag('a');
  4208. if (tree.openElements.contains(activeA))
  4209. tree.openElements.remove(activeA);
  4210. tree.removeElementFromActiveFormattingElements(activeA);
  4211. }
  4212. tree.reconstructActiveFormattingElements();
  4213. tree.insertFormattingElement(name, attributes);
  4214. };
  4215. modes.inBody.startTagFormatting = function(name, attributes) {
  4216. tree.reconstructActiveFormattingElements();
  4217. tree.insertFormattingElement(name, attributes);
  4218. };
  4219. modes.inBody.startTagNobr = function(name, attributes) {
  4220. tree.reconstructActiveFormattingElements();
  4221. if (tree.openElements.inScope('nobr')) {
  4222. tree.parseError("unexpected-start-tag-implies-end-tag", {startName: 'nobr', endName: 'nobr'});
  4223. this.processEndTag('nobr');
  4224. tree.reconstructActiveFormattingElements();
  4225. }
  4226. tree.insertFormattingElement(name, attributes);
  4227. };
  4228. modes.inBody.startTagButton = function(name, attributes) {
  4229. if (tree.openElements.inScope('button')) {
  4230. tree.parseError('unexpected-start-tag-implies-end-tag', {startName: 'button', endName: 'button'});
  4231. this.processEndTag('button');
  4232. tree.insertionMode.processStartTag(name, attributes);
  4233. } else {
  4234. tree.framesetOk = false;
  4235. tree.reconstructActiveFormattingElements();
  4236. tree.insertElement(name, attributes);
  4237. }
  4238. };
  4239. modes.inBody.startTagAppletMarqueeObject = function(name, attributes) {
  4240. tree.reconstructActiveFormattingElements();
  4241. tree.insertElement(name, attributes);
  4242. tree.activeFormattingElements.push(Marker);
  4243. tree.framesetOk = false;
  4244. };
  4245. modes.inBody.endTagAppletMarqueeObject = function(name) {
  4246. if (!tree.openElements.inScope(name)) {
  4247. tree.parseError("unexpected-end-tag", {name: name});
  4248. } else {
  4249. tree.generateImpliedEndTags();
  4250. if (tree.currentStackItem().localName != name) {
  4251. tree.parseError('end-tag-too-early', {name: name});
  4252. }
  4253. tree.openElements.popUntilPopped(name);
  4254. tree.clearActiveFormattingElements();
  4255. }
  4256. };
  4257. modes.inBody.startTagXmp = function(name, attributes) {
  4258. if (tree.openElements.inButtonScope('p'))
  4259. this.processEndTag('p');
  4260. tree.reconstructActiveFormattingElements();
  4261. tree.processGenericRawTextStartTag(name, attributes);
  4262. tree.framesetOk = false;
  4263. };
  4264. modes.inBody.startTagTable = function(name, attributes) {
  4265. if (tree.compatMode !== "quirks")
  4266. if (tree.openElements.inButtonScope('p'))
  4267. this.processEndTag('p');
  4268. tree.insertElement(name, attributes);
  4269. tree.setInsertionMode('inTable');
  4270. tree.framesetOk = false;
  4271. };
  4272. modes.inBody.startTagVoidFormatting = function(name, attributes) {
  4273. tree.reconstructActiveFormattingElements();
  4274. tree.insertSelfClosingElement(name, attributes);
  4275. tree.framesetOk = false;
  4276. };
  4277. modes.inBody.startTagParamSourceTrack = function(name, attributes) {
  4278. tree.insertSelfClosingElement(name, attributes);
  4279. };
  4280. modes.inBody.startTagHr = function(name, attributes) {
  4281. if (tree.openElements.inButtonScope('p'))
  4282. this.endTagP('p');
  4283. tree.insertSelfClosingElement(name, attributes);
  4284. tree.framesetOk = false;
  4285. };
  4286. modes.inBody.startTagImage = function(name, attributes) {
  4287. tree.parseError('unexpected-start-tag-treated-as', {originalName: 'image', newName: 'img'});
  4288. this.processStartTag('img', attributes);
  4289. };
  4290. modes.inBody.startTagInput = function(name, attributes) {
  4291. var currentFramesetOk = tree.framesetOk;
  4292. this.startTagVoidFormatting(name, attributes);
  4293. for (var key in attributes) {
  4294. if (attributes[key].nodeName == 'type') {
  4295. if (attributes[key].nodeValue.toLowerCase() == 'hidden')
  4296. tree.framesetOk = currentFramesetOk;
  4297. break;
  4298. }
  4299. }
  4300. };
  4301. modes.inBody.startTagIsindex = function(name, attributes) {
  4302. tree.parseError('deprecated-tag', {name: 'isindex'});
  4303. tree.selfClosingFlagAcknowledged = true;
  4304. if (tree.form)
  4305. return;
  4306. var formAttributes = [];
  4307. var inputAttributes = [];
  4308. var prompt = "This is a searchable index. Enter search keywords: ";
  4309. for (var key in attributes) {
  4310. switch (attributes[key].nodeName) {
  4311. case 'action':
  4312. formAttributes.push({nodeName: 'action',
  4313. nodeValue: attributes[key].nodeValue});
  4314. break;
  4315. case 'prompt':
  4316. prompt = attributes[key].nodeValue;
  4317. break;
  4318. case 'name':
  4319. break;
  4320. default:
  4321. inputAttributes.push({nodeName: attributes[key].nodeName,
  4322. nodeValue: attributes[key].nodeValue});
  4323. }
  4324. }
  4325. inputAttributes.push({nodeName: 'name', nodeValue: 'isindex'});
  4326. this.processStartTag('form', formAttributes);
  4327. this.processStartTag('hr');
  4328. this.processStartTag('label');
  4329. this.processCharacters(new CharacterBuffer(prompt));
  4330. this.processStartTag('input', inputAttributes);
  4331. this.processEndTag('label');
  4332. this.processStartTag('hr');
  4333. this.processEndTag('form');
  4334. };
  4335. modes.inBody.startTagTextarea = function(name, attributes) {
  4336. tree.insertElement(name, attributes);
  4337. tree.tokenizer.setState(Tokenizer.RCDATA);
  4338. tree.originalInsertionMode = tree.insertionModeName;
  4339. tree.shouldSkipLeadingNewline = true;
  4340. tree.framesetOk = false;
  4341. tree.setInsertionMode('text');
  4342. };
  4343. modes.inBody.startTagIFrame = function(name, attributes) {
  4344. tree.framesetOk = false;
  4345. this.startTagRawText(name, attributes);
  4346. };
  4347. modes.inBody.startTagRawText = function(name, attributes) {
  4348. tree.processGenericRawTextStartTag(name, attributes);
  4349. };
  4350. modes.inBody.startTagSelect = function(name, attributes) {
  4351. tree.reconstructActiveFormattingElements();
  4352. tree.insertElement(name, attributes);
  4353. tree.framesetOk = false;
  4354. var insertionModeName = tree.insertionModeName;
  4355. if (insertionModeName == 'inTable' ||
  4356. insertionModeName == 'inCaption' ||
  4357. insertionModeName == 'inColumnGroup' ||
  4358. insertionModeName == 'inTableBody' ||
  4359. insertionModeName == 'inRow' ||
  4360. insertionModeName == 'inCell') {
  4361. tree.setInsertionMode('inSelectInTable');
  4362. } else {
  4363. tree.setInsertionMode('inSelect');
  4364. }
  4365. };
  4366. modes.inBody.startTagMisplaced = function(name, attributes) {
  4367. tree.parseError('unexpected-start-tag-ignored', {name: name});
  4368. };
  4369. modes.inBody.endTagMisplaced = function(name) {
  4370. tree.parseError("unexpected-end-tag", {name: name});
  4371. };
  4372. modes.inBody.endTagBr = function(name) {
  4373. tree.parseError("unexpected-end-tag-treated-as", {originalName: "br", newName: "br element"});
  4374. tree.reconstructActiveFormattingElements();
  4375. tree.insertElement(name, []);
  4376. tree.popElement();
  4377. };
  4378. modes.inBody.startTagOptionOptgroup = function(name, attributes) {
  4379. if (tree.currentStackItem().localName == 'option')
  4380. tree.popElement();
  4381. tree.reconstructActiveFormattingElements();
  4382. tree.insertElement(name, attributes);
  4383. };
  4384. modes.inBody.startTagOther = function(name, attributes) {
  4385. tree.reconstructActiveFormattingElements();
  4386. tree.insertElement(name, attributes);
  4387. };
  4388. modes.inBody.endTagOther = function(name) {
  4389. var node;
  4390. for (var i = tree.openElements.length - 1; i > 0; i--) {
  4391. node = tree.openElements.item(i);
  4392. if (node.localName == name) {
  4393. tree.generateImpliedEndTags(name);
  4394. if (tree.currentStackItem().localName != name)
  4395. tree.parseError('unexpected-end-tag', {name: name});
  4396. tree.openElements.remove_openElements_until(function(x) {return x === node;});
  4397. break;
  4398. }
  4399. if (node.isSpecial()) {
  4400. tree.parseError('unexpected-end-tag', {name: name});
  4401. break;
  4402. }
  4403. }
  4404. };
  4405. modes.inBody.startTagMath = function(name, attributes, selfClosing) {
  4406. tree.reconstructActiveFormattingElements();
  4407. attributes = tree.adjustMathMLAttributes(attributes);
  4408. attributes = tree.adjustForeignAttributes(attributes);
  4409. tree.insertForeignElement(name, attributes, "http://www.w3.org/1998/Math/MathML", selfClosing);
  4410. };
  4411. modes.inBody.startTagSVG = function(name, attributes, selfClosing) {
  4412. tree.reconstructActiveFormattingElements();
  4413. attributes = tree.adjustSVGAttributes(attributes);
  4414. attributes = tree.adjustForeignAttributes(attributes);
  4415. tree.insertForeignElement(name, attributes, "http://www.w3.org/2000/svg", selfClosing);
  4416. };
  4417. modes.inBody.endTagP = function(name) {
  4418. if (!tree.openElements.inButtonScope('p')) {
  4419. tree.parseError('unexpected-end-tag', {name: 'p'});
  4420. this.startTagCloseP('p', []);
  4421. this.endTagP('p');
  4422. } else {
  4423. tree.generateImpliedEndTags('p');
  4424. if (tree.currentStackItem().localName != 'p')
  4425. tree.parseError('unexpected-implied-end-tag', {name: 'p'});
  4426. tree.openElements.popUntilPopped(name);
  4427. }
  4428. };
  4429. modes.inBody.endTagBody = 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. };
  4442. modes.inBody.endTagHtml = function(name) {
  4443. if (!tree.openElements.inScope('body')) {
  4444. tree.parseError('unexpected-end-tag', {name: name});
  4445. return;
  4446. }
  4447. if (tree.currentStackItem().localName != 'body') {
  4448. tree.parseError('expected-one-end-tag-but-got-another', {
  4449. expectedName: tree.currentStackItem().localName,
  4450. gotName: name
  4451. });
  4452. }
  4453. tree.setInsertionMode('afterBody');
  4454. tree.insertionMode.processEndTag(name);
  4455. };
  4456. modes.inBody.endTagBlock = function(name) {
  4457. if (!tree.openElements.inScope(name)) {
  4458. tree.parseError('unexpected-end-tag', {name: name});
  4459. } else {
  4460. tree.generateImpliedEndTags();
  4461. if (tree.currentStackItem().localName != name) {
  4462. tree.parseError('end-tag-too-early', {name: name});
  4463. }
  4464. tree.openElements.popUntilPopped(name);
  4465. }
  4466. };
  4467. modes.inBody.endTagForm = function(name) {
  4468. var node = tree.form;
  4469. tree.form = null;
  4470. if (!node || !tree.openElements.inScope(name)) {
  4471. tree.parseError('unexpected-end-tag', {name: name});
  4472. } else {
  4473. tree.generateImpliedEndTags();
  4474. if (tree.currentStackItem() != node) {
  4475. tree.parseError('end-tag-too-early-ignored', {name: 'form'});
  4476. }
  4477. tree.openElements.remove(node);
  4478. }
  4479. };
  4480. modes.inBody.endTagListItem = function(name) {
  4481. if (!tree.openElements.inListItemScope(name)) {
  4482. tree.parseError('unexpected-end-tag', {name: name});
  4483. } else {
  4484. tree.generateImpliedEndTags(name);
  4485. if (tree.currentStackItem().localName != name)
  4486. tree.parseError('end-tag-too-early', {name: name});
  4487. tree.openElements.popUntilPopped(name);
  4488. }
  4489. };
  4490. modes.inBody.endTagHeading = function(name) {
  4491. if (!tree.openElements.hasNumberedHeaderElementInScope()) {
  4492. tree.parseError('unexpected-end-tag', {name: name});
  4493. return;
  4494. }
  4495. tree.generateImpliedEndTags();
  4496. if (tree.currentStackItem().localName != name)
  4497. tree.parseError('end-tag-too-early', {name: name});
  4498. tree.openElements.remove_openElements_until(function(e) {
  4499. return e.isNumberedHeader();
  4500. });
  4501. };
  4502. modes.inBody.endTagFormatting = function(name, attributes) {
  4503. if (!tree.adoptionAgencyEndTag(name))
  4504. this.endTagOther(name, attributes);
  4505. };
  4506. modes.inCaption = Object.create(modes.base);
  4507. modes.inCaption.start_tag_handlers = {
  4508. html: 'startTagHtml',
  4509. caption: 'startTagTableElement',
  4510. col: 'startTagTableElement',
  4511. colgroup: 'startTagTableElement',
  4512. tbody: 'startTagTableElement',
  4513. td: 'startTagTableElement',
  4514. tfoot: 'startTagTableElement',
  4515. thead: 'startTagTableElement',
  4516. tr: 'startTagTableElement',
  4517. '-default': 'startTagOther'
  4518. };
  4519. modes.inCaption.end_tag_handlers = {
  4520. caption: 'endTagCaption',
  4521. table: 'endTagTable',
  4522. body: 'endTagIgnore',
  4523. col: 'endTagIgnore',
  4524. colgroup: 'endTagIgnore',
  4525. html: 'endTagIgnore',
  4526. tbody: 'endTagIgnore',
  4527. td: 'endTagIgnore',
  4528. tfood: 'endTagIgnore',
  4529. thead: 'endTagIgnore',
  4530. tr: 'endTagIgnore',
  4531. '-default': 'endTagOther'
  4532. };
  4533. modes.inCaption.processCharacters = function(data) {
  4534. modes.inBody.processCharacters(data);
  4535. };
  4536. modes.inCaption.startTagTableElement = function(name, attributes) {
  4537. tree.parseError('unexpected-end-tag', {name: name});
  4538. var ignoreEndTag = !tree.openElements.inTableScope('caption');
  4539. tree.insertionMode.processEndTag('caption');
  4540. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes);
  4541. };
  4542. modes.inCaption.startTagOther = function(name, attributes, selfClosing) {
  4543. modes.inBody.processStartTag(name, attributes, selfClosing);
  4544. };
  4545. modes.inCaption.endTagCaption = function(name) {
  4546. if (!tree.openElements.inTableScope('caption')) {
  4547. assert.ok(tree.context);
  4548. tree.parseError('unexpected-end-tag', {name: name});
  4549. } else {
  4550. tree.generateImpliedEndTags();
  4551. if (tree.currentStackItem().localName != 'caption') {
  4552. tree.parseError('expected-one-end-tag-but-got-another', {
  4553. gotName: "caption",
  4554. expectedName: tree.currentStackItem().localName
  4555. });
  4556. }
  4557. tree.openElements.popUntilPopped('caption');
  4558. tree.clearActiveFormattingElements();
  4559. tree.setInsertionMode('inTable');
  4560. }
  4561. };
  4562. modes.inCaption.endTagTable = function(name) {
  4563. tree.parseError("unexpected-end-table-in-caption");
  4564. var ignoreEndTag = !tree.openElements.inTableScope('caption');
  4565. tree.insertionMode.processEndTag('caption');
  4566. if (!ignoreEndTag) tree.insertionMode.processEndTag(name);
  4567. };
  4568. modes.inCaption.endTagIgnore = function(name) {
  4569. tree.parseError('unexpected-end-tag', {name: name});
  4570. };
  4571. modes.inCaption.endTagOther = function(name) {
  4572. modes.inBody.processEndTag(name);
  4573. };
  4574. modes.inCell = Object.create(modes.base);
  4575. modes.inCell.start_tag_handlers = {
  4576. html: 'startTagHtml',
  4577. caption: 'startTagTableOther',
  4578. col: 'startTagTableOther',
  4579. colgroup: 'startTagTableOther',
  4580. tbody: 'startTagTableOther',
  4581. td: 'startTagTableOther',
  4582. tfoot: 'startTagTableOther',
  4583. th: 'startTagTableOther',
  4584. thead: 'startTagTableOther',
  4585. tr: 'startTagTableOther',
  4586. '-default': 'startTagOther'
  4587. };
  4588. modes.inCell.end_tag_handlers = {
  4589. td: 'endTagTableCell',
  4590. th: 'endTagTableCell',
  4591. body: 'endTagIgnore',
  4592. caption: 'endTagIgnore',
  4593. col: 'endTagIgnore',
  4594. colgroup: 'endTagIgnore',
  4595. html: 'endTagIgnore',
  4596. table: 'endTagImply',
  4597. tbody: 'endTagImply',
  4598. tfoot: 'endTagImply',
  4599. thead: 'endTagImply',
  4600. tr: 'endTagImply',
  4601. '-default': 'endTagOther'
  4602. };
  4603. modes.inCell.processCharacters = function(data) {
  4604. modes.inBody.processCharacters(data);
  4605. };
  4606. modes.inCell.startTagTableOther = function(name, attributes, selfClosing) {
  4607. if (tree.openElements.inTableScope('td') || tree.openElements.inTableScope('th')) {
  4608. this.closeCell();
  4609. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4610. } else {
  4611. tree.parseError('unexpected-start-tag', {name: name});
  4612. }
  4613. };
  4614. modes.inCell.startTagOther = function(name, attributes, selfClosing) {
  4615. modes.inBody.processStartTag(name, attributes, selfClosing);
  4616. };
  4617. modes.inCell.endTagTableCell = function(name) {
  4618. if (tree.openElements.inTableScope(name)) {
  4619. tree.generateImpliedEndTags(name);
  4620. if (tree.currentStackItem().localName != name.toLowerCase()) {
  4621. tree.parseError('unexpected-cell-end-tag', {name: name});
  4622. tree.openElements.popUntilPopped(name);
  4623. } else {
  4624. tree.popElement();
  4625. }
  4626. tree.clearActiveFormattingElements();
  4627. tree.setInsertionMode('inRow');
  4628. } else {
  4629. tree.parseError('unexpected-end-tag', {name: name});
  4630. }
  4631. };
  4632. modes.inCell.endTagIgnore = function(name) {
  4633. tree.parseError('unexpected-end-tag', {name: name});
  4634. };
  4635. modes.inCell.endTagImply = function(name) {
  4636. if (tree.openElements.inTableScope(name)) {
  4637. this.closeCell();
  4638. tree.insertionMode.processEndTag(name);
  4639. } else {
  4640. tree.parseError('unexpected-end-tag', {name: name});
  4641. }
  4642. };
  4643. modes.inCell.endTagOther = function(name) {
  4644. modes.inBody.processEndTag(name);
  4645. };
  4646. modes.inCell.closeCell = function() {
  4647. if (tree.openElements.inTableScope('td')) {
  4648. this.endTagTableCell('td');
  4649. } else if (tree.openElements.inTableScope('th')) {
  4650. this.endTagTableCell('th');
  4651. }
  4652. };
  4653. modes.inColumnGroup = Object.create(modes.base);
  4654. modes.inColumnGroup.start_tag_handlers = {
  4655. html: 'startTagHtml',
  4656. col: 'startTagCol',
  4657. '-default': 'startTagOther'
  4658. };
  4659. modes.inColumnGroup.end_tag_handlers = {
  4660. colgroup: 'endTagColgroup',
  4661. col: 'endTagCol',
  4662. '-default': 'endTagOther'
  4663. };
  4664. modes.inColumnGroup.ignoreEndTagColgroup = function() {
  4665. return tree.currentStackItem().localName == 'html';
  4666. };
  4667. modes.inColumnGroup.processCharacters = function(buffer) {
  4668. var leadingWhitespace = buffer.takeLeadingWhitespace();
  4669. if (leadingWhitespace)
  4670. tree.insertText(leadingWhitespace);
  4671. if (!buffer.length)
  4672. return;
  4673. var ignoreEndTag = this.ignoreEndTagColgroup();
  4674. this.endTagColgroup('colgroup');
  4675. if (!ignoreEndTag) tree.insertionMode.processCharacters(buffer);
  4676. };
  4677. modes.inColumnGroup.startTagCol = function(name, attributes) {
  4678. tree.insertSelfClosingElement(name, attributes);
  4679. };
  4680. modes.inColumnGroup.startTagOther = function(name, attributes, selfClosing) {
  4681. var ignoreEndTag = this.ignoreEndTagColgroup();
  4682. this.endTagColgroup('colgroup');
  4683. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4684. };
  4685. modes.inColumnGroup.endTagColgroup = function(name) {
  4686. if (this.ignoreEndTagColgroup()) {
  4687. assert.ok(tree.context);
  4688. tree.parseError('unexpected-end-tag', {name: name});
  4689. } else {
  4690. tree.popElement();
  4691. tree.setInsertionMode('inTable');
  4692. }
  4693. };
  4694. modes.inColumnGroup.endTagCol = function(name) {
  4695. tree.parseError("no-end-tag", {name: 'col'});
  4696. };
  4697. modes.inColumnGroup.endTagOther = function(name) {
  4698. var ignoreEndTag = this.ignoreEndTagColgroup();
  4699. this.endTagColgroup('colgroup');
  4700. if (!ignoreEndTag) tree.insertionMode.processEndTag(name) ;
  4701. };
  4702. modes.inForeignContent = Object.create(modes.base);
  4703. modes.inForeignContent.processStartTag = function(name, attributes, selfClosing) {
  4704. 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
  4705. || (name == 'font' && attributes.some(function(attr){ return ['color', 'face', 'size'].indexOf(attr.nodeName) >= 0 }))) {
  4706. tree.parseError('unexpected-html-element-in-foreign-content', {name: name});
  4707. while (tree.currentStackItem().isForeign()
  4708. && !tree.currentStackItem().isHtmlIntegrationPoint()
  4709. && !tree.currentStackItem().isMathMLTextIntegrationPoint()) {
  4710. tree.openElements.pop();
  4711. }
  4712. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  4713. return;
  4714. }
  4715. if (tree.currentStackItem().namespaceURI == "http://www.w3.org/1998/Math/MathML") {
  4716. attributes = tree.adjustMathMLAttributes(attributes);
  4717. }
  4718. if (tree.currentStackItem().namespaceURI == "http://www.w3.org/2000/svg") {
  4719. name = tree.adjustSVGTagNameCase(name);
  4720. attributes = tree.adjustSVGAttributes(attributes);
  4721. }
  4722. attributes = tree.adjustForeignAttributes(attributes);
  4723. tree.insertForeignElement(name, attributes, tree.currentStackItem().namespaceURI, selfClosing);
  4724. };
  4725. modes.inForeignContent.processEndTag = function(name) {
  4726. var node = tree.currentStackItem();
  4727. var index = tree.openElements.length - 1;
  4728. if (node.localName.toLowerCase() != name)
  4729. tree.parseError("unexpected-end-tag", {name: name});
  4730. while (true) {
  4731. if (index === 0)
  4732. break;
  4733. if (node.localName.toLowerCase() == name) {
  4734. while (tree.openElements.pop() != node);
  4735. break;
  4736. }
  4737. index -= 1;
  4738. node = tree.openElements.item(index);
  4739. if (node.isForeign()) {
  4740. continue;
  4741. } else {
  4742. tree.insertionMode.processEndTag(name);
  4743. break;
  4744. }
  4745. }
  4746. };
  4747. modes.inForeignContent.processCharacters = function(buffer) {
  4748. var characters = buffer.takeRemaining();
  4749. characters = characters.replace(/\u0000/g, function(match, index){
  4750. tree.parseError('invalid-codepoint');
  4751. return '\uFFFD';
  4752. });
  4753. if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters))
  4754. tree.framesetOk = false;
  4755. tree.insertText(characters);
  4756. };
  4757. modes.inHeadNoscript = Object.create(modes.base);
  4758. modes.inHeadNoscript.start_tag_handlers = {
  4759. html: 'startTagHtml',
  4760. basefont: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4761. bgsound: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4762. link: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4763. meta: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4764. noframes: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4765. style: 'startTagBasefontBgsoundLinkMetaNoframesStyle',
  4766. head: 'startTagHeadNoscript',
  4767. noscript: 'startTagHeadNoscript',
  4768. "-default": 'startTagOther'
  4769. };
  4770. modes.inHeadNoscript.end_tag_handlers = {
  4771. noscript: 'endTagNoscript',
  4772. br: 'endTagBr',
  4773. '-default': 'endTagOther'
  4774. };
  4775. modes.inHeadNoscript.processCharacters = function(buffer) {
  4776. var leadingWhitespace = buffer.takeLeadingWhitespace();
  4777. if (leadingWhitespace)
  4778. tree.insertText(leadingWhitespace);
  4779. if (!buffer.length)
  4780. return;
  4781. tree.parseError("unexpected-char-in-frameset");
  4782. this.anythingElse();
  4783. tree.insertionMode.processCharacters(buffer);
  4784. };
  4785. modes.inHeadNoscript.processComment = function(data) {
  4786. modes.inHead.processComment(data);
  4787. };
  4788. modes.inHeadNoscript.startTagBasefontBgsoundLinkMetaNoframesStyle = function(name, attributes) {
  4789. modes.inHead.processStartTag(name, attributes);
  4790. };
  4791. modes.inHeadNoscript.startTagHeadNoscript = function(name, attributes) {
  4792. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4793. };
  4794. modes.inHeadNoscript.startTagOther = function(name, attributes) {
  4795. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4796. this.anythingElse();
  4797. tree.insertionMode.processStartTag(name, attributes);
  4798. };
  4799. modes.inHeadNoscript.endTagBr = function(name, attributes) {
  4800. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4801. this.anythingElse();
  4802. tree.insertionMode.processEndTag(name, attributes);
  4803. };
  4804. modes.inHeadNoscript.endTagNoscript = function(name, attributes) {
  4805. tree.popElement();
  4806. tree.setInsertionMode('inHead');
  4807. };
  4808. modes.inHeadNoscript.endTagOther = function(name, attributes) {
  4809. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4810. };
  4811. modes.inHeadNoscript.anythingElse = function() {
  4812. tree.popElement();
  4813. tree.setInsertionMode('inHead');
  4814. };
  4815. modes.inFrameset = Object.create(modes.base);
  4816. modes.inFrameset.start_tag_handlers = {
  4817. html: 'startTagHtml',
  4818. frameset: 'startTagFrameset',
  4819. frame: 'startTagFrame',
  4820. noframes: 'startTagNoframes',
  4821. "-default": 'startTagOther'
  4822. };
  4823. modes.inFrameset.end_tag_handlers = {
  4824. frameset: 'endTagFrameset',
  4825. noframes: 'endTagNoframes',
  4826. '-default': 'endTagOther'
  4827. };
  4828. modes.inFrameset.processCharacters = function(data) {
  4829. tree.parseError("unexpected-char-in-frameset");
  4830. };
  4831. modes.inFrameset.startTagFrameset = function(name, attributes) {
  4832. tree.insertElement(name, attributes);
  4833. };
  4834. modes.inFrameset.startTagFrame = function(name, attributes) {
  4835. tree.insertSelfClosingElement(name, attributes);
  4836. };
  4837. modes.inFrameset.startTagNoframes = function(name, attributes) {
  4838. modes.inBody.processStartTag(name, attributes);
  4839. };
  4840. modes.inFrameset.startTagOther = function(name, attributes) {
  4841. tree.parseError("unexpected-start-tag-in-frameset", {name: name});
  4842. };
  4843. modes.inFrameset.endTagFrameset = function(name, attributes) {
  4844. if (tree.currentStackItem().localName == 'html') {
  4845. tree.parseError("unexpected-frameset-in-frameset-innerhtml");
  4846. } else {
  4847. tree.popElement();
  4848. }
  4849. if (!tree.context && tree.currentStackItem().localName != 'frameset') {
  4850. tree.setInsertionMode('afterFrameset');
  4851. }
  4852. };
  4853. modes.inFrameset.endTagNoframes = function(name) {
  4854. modes.inBody.processEndTag(name);
  4855. };
  4856. modes.inFrameset.endTagOther = function(name) {
  4857. tree.parseError("unexpected-end-tag-in-frameset", {name: name});
  4858. };
  4859. modes.inTable = Object.create(modes.base);
  4860. modes.inTable.start_tag_handlers = {
  4861. html: 'startTagHtml',
  4862. caption: 'startTagCaption',
  4863. colgroup: 'startTagColgroup',
  4864. col: 'startTagCol',
  4865. table: 'startTagTable',
  4866. tbody: 'startTagRowGroup',
  4867. tfoot: 'startTagRowGroup',
  4868. thead: 'startTagRowGroup',
  4869. td: 'startTagImplyTbody',
  4870. th: 'startTagImplyTbody',
  4871. tr: 'startTagImplyTbody',
  4872. style: 'startTagStyleScript',
  4873. script: 'startTagStyleScript',
  4874. input: 'startTagInput',
  4875. form: 'startTagForm',
  4876. '-default': 'startTagOther'
  4877. };
  4878. modes.inTable.end_tag_handlers = {
  4879. table: 'endTagTable',
  4880. body: 'endTagIgnore',
  4881. caption: 'endTagIgnore',
  4882. col: 'endTagIgnore',
  4883. colgroup: 'endTagIgnore',
  4884. html: 'endTagIgnore',
  4885. tbody: 'endTagIgnore',
  4886. td: 'endTagIgnore',
  4887. tfoot: 'endTagIgnore',
  4888. th: 'endTagIgnore',
  4889. thead: 'endTagIgnore',
  4890. tr: 'endTagIgnore',
  4891. '-default': 'endTagOther'
  4892. };
  4893. modes.inTable.processCharacters = function(data) {
  4894. if (tree.currentStackItem().isFosterParenting()) {
  4895. var originalInsertionMode = tree.insertionModeName;
  4896. tree.setInsertionMode('inTableText');
  4897. tree.originalInsertionMode = originalInsertionMode;
  4898. tree.insertionMode.processCharacters(data);
  4899. } else {
  4900. tree.redirectAttachToFosterParent = true;
  4901. modes.inBody.processCharacters(data);
  4902. tree.redirectAttachToFosterParent = false;
  4903. }
  4904. };
  4905. modes.inTable.startTagCaption = function(name, attributes) {
  4906. tree.openElements.popUntilTableScopeMarker();
  4907. tree.activeFormattingElements.push(Marker);
  4908. tree.insertElement(name, attributes);
  4909. tree.setInsertionMode('inCaption');
  4910. };
  4911. modes.inTable.startTagColgroup = function(name, attributes) {
  4912. tree.openElements.popUntilTableScopeMarker();
  4913. tree.insertElement(name, attributes);
  4914. tree.setInsertionMode('inColumnGroup');
  4915. };
  4916. modes.inTable.startTagCol = function(name, attributes) {
  4917. this.startTagColgroup('colgroup', []);
  4918. tree.insertionMode.processStartTag(name, attributes);
  4919. };
  4920. modes.inTable.startTagRowGroup = function(name, attributes) {
  4921. tree.openElements.popUntilTableScopeMarker();
  4922. tree.insertElement(name, attributes);
  4923. tree.setInsertionMode('inTableBody');
  4924. };
  4925. modes.inTable.startTagImplyTbody = function(name, attributes) {
  4926. this.startTagRowGroup('tbody', []);
  4927. tree.insertionMode.processStartTag(name, attributes);
  4928. };
  4929. modes.inTable.startTagTable = function(name, attributes) {
  4930. tree.parseError("unexpected-start-tag-implies-end-tag",
  4931. {startName: "table", endName: "table"});
  4932. tree.insertionMode.processEndTag('table');
  4933. if (!tree.context) tree.insertionMode.processStartTag(name, attributes);
  4934. };
  4935. modes.inTable.startTagStyleScript = function(name, attributes) {
  4936. modes.inHead.processStartTag(name, attributes);
  4937. };
  4938. modes.inTable.startTagInput = function(name, attributes) {
  4939. for (var key in attributes) {
  4940. if (attributes[key].nodeName.toLowerCase() == 'type') {
  4941. if (attributes[key].nodeValue.toLowerCase() == 'hidden') {
  4942. tree.parseError("unexpected-hidden-input-in-table");
  4943. tree.insertElement(name, attributes);
  4944. tree.openElements.pop();
  4945. return;
  4946. }
  4947. break;
  4948. }
  4949. }
  4950. this.startTagOther(name, attributes);
  4951. };
  4952. modes.inTable.startTagForm = function(name, attributes) {
  4953. tree.parseError("unexpected-form-in-table");
  4954. if (!tree.form) {
  4955. tree.insertElement(name, attributes);
  4956. tree.form = tree.currentStackItem();
  4957. tree.openElements.pop();
  4958. }
  4959. };
  4960. modes.inTable.startTagOther = function(name, attributes, selfClosing) {
  4961. tree.parseError("unexpected-start-tag-implies-table-voodoo", {name: name});
  4962. tree.redirectAttachToFosterParent = true;
  4963. modes.inBody.processStartTag(name, attributes, selfClosing);
  4964. tree.redirectAttachToFosterParent = false;
  4965. };
  4966. modes.inTable.endTagTable = function(name) {
  4967. if (tree.openElements.inTableScope(name)) {
  4968. tree.generateImpliedEndTags();
  4969. if (tree.currentStackItem().localName != name) {
  4970. tree.parseError("end-tag-too-early-named", {gotName: 'table', expectedName: tree.currentStackItem().localName});
  4971. }
  4972. tree.openElements.popUntilPopped('table');
  4973. tree.resetInsertionMode();
  4974. } else {
  4975. assert.ok(tree.context);
  4976. tree.parseError('unexpected-end-tag', {name: name});
  4977. }
  4978. };
  4979. modes.inTable.endTagIgnore = function(name) {
  4980. tree.parseError("unexpected-end-tag", {name: name});
  4981. };
  4982. modes.inTable.endTagOther = function(name) {
  4983. tree.parseError("unexpected-end-tag-implies-table-voodoo", {name: name});
  4984. tree.redirectAttachToFosterParent = true;
  4985. modes.inBody.processEndTag(name);
  4986. tree.redirectAttachToFosterParent = false;
  4987. };
  4988. modes.inTableText = Object.create(modes.base);
  4989. modes.inTableText.flushCharacters = function() {
  4990. var characters = tree.pendingTableCharacters.join('');
  4991. if (!isAllWhitespace(characters)) {
  4992. tree.redirectAttachToFosterParent = true;
  4993. tree.reconstructActiveFormattingElements();
  4994. tree.insertText(characters);
  4995. tree.framesetOk = false;
  4996. tree.redirectAttachToFosterParent = false;
  4997. } else {
  4998. tree.insertText(characters);
  4999. }
  5000. tree.pendingTableCharacters = [];
  5001. };
  5002. modes.inTableText.processComment = function(data) {
  5003. this.flushCharacters();
  5004. tree.setInsertionMode(tree.originalInsertionMode);
  5005. tree.insertionMode.processComment(data);
  5006. };
  5007. modes.inTableText.processEOF = function(data) {
  5008. this.flushCharacters();
  5009. tree.setInsertionMode(tree.originalInsertionMode);
  5010. tree.insertionMode.processEOF();
  5011. };
  5012. modes.inTableText.processCharacters = function(buffer) {
  5013. var characters = buffer.takeRemaining();
  5014. characters = characters.replace(/\u0000/g, function(match, index){
  5015. tree.parseError("invalid-codepoint");
  5016. return '';
  5017. });
  5018. if (!characters)
  5019. return;
  5020. tree.pendingTableCharacters.push(characters);
  5021. };
  5022. modes.inTableText.processStartTag = function(name, attributes, selfClosing) {
  5023. this.flushCharacters();
  5024. tree.setInsertionMode(tree.originalInsertionMode);
  5025. tree.insertionMode.processStartTag(name, attributes, selfClosing);
  5026. };
  5027. modes.inTableText.processEndTag = function(name, attributes) {
  5028. this.flushCharacters();
  5029. tree.setInsertionMode(tree.originalInsertionMode);
  5030. tree.insertionMode.processEndTag(name, attributes);
  5031. };
  5032. modes.inTableBody = Object.create(modes.base);
  5033. modes.inTableBody.start_tag_handlers = {
  5034. html: 'startTagHtml',
  5035. tr: 'startTagTr',
  5036. td: 'startTagTableCell',
  5037. th: 'startTagTableCell',
  5038. caption: 'startTagTableOther',
  5039. col: 'startTagTableOther',
  5040. colgroup: 'startTagTableOther',
  5041. tbody: 'startTagTableOther',
  5042. tfoot: 'startTagTableOther',
  5043. thead: 'startTagTableOther',
  5044. '-default': 'startTagOther'
  5045. };
  5046. modes.inTableBody.end_tag_handlers = {
  5047. table: 'endTagTable',
  5048. tbody: 'endTagTableRowGroup',
  5049. tfoot: 'endTagTableRowGroup',
  5050. thead: 'endTagTableRowGroup',
  5051. body: 'endTagIgnore',
  5052. caption: 'endTagIgnore',
  5053. col: 'endTagIgnore',
  5054. colgroup: 'endTagIgnore',
  5055. html: 'endTagIgnore',
  5056. td: 'endTagIgnore',
  5057. th: 'endTagIgnore',
  5058. tr: 'endTagIgnore',
  5059. '-default': 'endTagOther'
  5060. };
  5061. modes.inTableBody.processCharacters = function(data) {
  5062. modes.inTable.processCharacters(data);
  5063. };
  5064. modes.inTableBody.startTagTr = function(name, attributes) {
  5065. tree.openElements.popUntilTableBodyScopeMarker();
  5066. tree.insertElement(name, attributes);
  5067. tree.setInsertionMode('inRow');
  5068. };
  5069. modes.inTableBody.startTagTableCell = function(name, attributes) {
  5070. tree.parseError("unexpected-cell-in-table-body", {name: name});
  5071. this.startTagTr('tr', []);
  5072. tree.insertionMode.processStartTag(name, attributes);
  5073. };
  5074. modes.inTableBody.startTagTableOther = function(name, attributes) {
  5075. if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) {
  5076. tree.openElements.popUntilTableBodyScopeMarker();
  5077. this.endTagTableRowGroup(tree.currentStackItem().localName);
  5078. tree.insertionMode.processStartTag(name, attributes);
  5079. } else {
  5080. tree.parseError('unexpected-start-tag', {name: name});
  5081. }
  5082. };
  5083. modes.inTableBody.startTagOther = function(name, attributes) {
  5084. modes.inTable.processStartTag(name, attributes);
  5085. };
  5086. modes.inTableBody.endTagTableRowGroup = function(name) {
  5087. if (tree.openElements.inTableScope(name)) {
  5088. tree.openElements.popUntilTableBodyScopeMarker();
  5089. tree.popElement();
  5090. tree.setInsertionMode('inTable');
  5091. } else {
  5092. tree.parseError('unexpected-end-tag-in-table-body', {name: name});
  5093. }
  5094. };
  5095. modes.inTableBody.endTagTable = function(name) {
  5096. if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) {
  5097. tree.openElements.popUntilTableBodyScopeMarker();
  5098. this.endTagTableRowGroup(tree.currentStackItem().localName);
  5099. tree.insertionMode.processEndTag(name);
  5100. } else {
  5101. tree.parseError('unexpected-end-tag', {name: name});
  5102. }
  5103. };
  5104. modes.inTableBody.endTagIgnore = function(name) {
  5105. tree.parseError("unexpected-end-tag-in-table-body", {name: name});
  5106. };
  5107. modes.inTableBody.endTagOther = function(name) {
  5108. modes.inTable.processEndTag(name);
  5109. };
  5110. modes.inSelect = Object.create(modes.base);
  5111. modes.inSelect.start_tag_handlers = {
  5112. html: 'startTagHtml',
  5113. option: 'startTagOption',
  5114. optgroup: 'startTagOptgroup',
  5115. select: 'startTagSelect',
  5116. input: 'startTagInput',
  5117. keygen: 'startTagInput',
  5118. textarea: 'startTagInput',
  5119. script: 'startTagScript',
  5120. '-default': 'startTagOther'
  5121. };
  5122. modes.inSelect.end_tag_handlers = {
  5123. option: 'endTagOption',
  5124. optgroup: 'endTagOptgroup',
  5125. select: 'endTagSelect',
  5126. caption: 'endTagTableElements',
  5127. table: 'endTagTableElements',
  5128. tbody: 'endTagTableElements',
  5129. tfoot: 'endTagTableElements',
  5130. thead: 'endTagTableElements',
  5131. tr: 'endTagTableElements',
  5132. td: 'endTagTableElements',
  5133. th: 'endTagTableElements',
  5134. '-default': 'endTagOther'
  5135. };
  5136. modes.inSelect.processCharacters = function(buffer) {
  5137. var data = buffer.takeRemaining();
  5138. data = data.replace(/\u0000/g, function(match, index){
  5139. tree.parseError("invalid-codepoint");
  5140. return '';
  5141. });
  5142. if (!data)
  5143. return;
  5144. tree.insertText(data);
  5145. };
  5146. modes.inSelect.startTagOption = function(name, attributes) {
  5147. if (tree.currentStackItem().localName == 'option')
  5148. tree.popElement();
  5149. tree.insertElement(name, attributes);
  5150. };
  5151. modes.inSelect.startTagOptgroup = function(name, attributes) {
  5152. if (tree.currentStackItem().localName == 'option')
  5153. tree.popElement();
  5154. if (tree.currentStackItem().localName == 'optgroup')
  5155. tree.popElement();
  5156. tree.insertElement(name, attributes);
  5157. };
  5158. modes.inSelect.endTagOption = function(name) {
  5159. if (tree.currentStackItem().localName !== 'option') {
  5160. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5161. return;
  5162. }
  5163. tree.popElement();
  5164. };
  5165. modes.inSelect.endTagOptgroup = function(name) {
  5166. if (tree.currentStackItem().localName == 'option' && tree.openElements.item(tree.openElements.length - 2).localName == 'optgroup') {
  5167. tree.popElement();
  5168. }
  5169. if (tree.currentStackItem().localName == 'optgroup') {
  5170. tree.popElement();
  5171. } else {
  5172. tree.parseError('unexpected-end-tag-in-select', {name: 'optgroup'});
  5173. }
  5174. };
  5175. modes.inSelect.startTagSelect = function(name) {
  5176. tree.parseError("unexpected-select-in-select");
  5177. this.endTagSelect('select');
  5178. };
  5179. modes.inSelect.endTagSelect = function(name) {
  5180. if (tree.openElements.inTableScope('select')) {
  5181. tree.openElements.popUntilPopped('select');
  5182. tree.resetInsertionMode();
  5183. } else {
  5184. tree.parseError('unexpected-end-tag', {name: name});
  5185. }
  5186. };
  5187. modes.inSelect.startTagInput = function(name, attributes) {
  5188. tree.parseError("unexpected-input-in-select");
  5189. if (tree.openElements.inSelectScope('select')) {
  5190. this.endTagSelect('select');
  5191. tree.insertionMode.processStartTag(name, attributes);
  5192. }
  5193. };
  5194. modes.inSelect.startTagScript = function(name, attributes) {
  5195. modes.inHead.processStartTag(name, attributes);
  5196. };
  5197. modes.inSelect.endTagTableElements = function(name) {
  5198. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5199. if (tree.openElements.inTableScope(name)) {
  5200. this.endTagSelect('select');
  5201. tree.insertionMode.processEndTag(name);
  5202. }
  5203. };
  5204. modes.inSelect.startTagOther = function(name, attributes) {
  5205. tree.parseError("unexpected-start-tag-in-select", {name: name});
  5206. };
  5207. modes.inSelect.endTagOther = function(name) {
  5208. tree.parseError('unexpected-end-tag-in-select', {name: name});
  5209. };
  5210. modes.inSelectInTable = Object.create(modes.base);
  5211. modes.inSelectInTable.start_tag_handlers = {
  5212. caption: 'startTagTable',
  5213. table: 'startTagTable',
  5214. tbody: 'startTagTable',
  5215. tfoot: 'startTagTable',
  5216. thead: 'startTagTable',
  5217. tr: 'startTagTable',
  5218. td: 'startTagTable',
  5219. th: 'startTagTable',
  5220. '-default': 'startTagOther'
  5221. };
  5222. modes.inSelectInTable.end_tag_handlers = {
  5223. caption: 'endTagTable',
  5224. table: 'endTagTable',
  5225. tbody: 'endTagTable',
  5226. tfoot: 'endTagTable',
  5227. thead: 'endTagTable',
  5228. tr: 'endTagTable',
  5229. td: 'endTagTable',
  5230. th: 'endTagTable',
  5231. '-default': 'endTagOther'
  5232. };
  5233. modes.inSelectInTable.processCharacters = function(data) {
  5234. modes.inSelect.processCharacters(data);
  5235. };
  5236. modes.inSelectInTable.startTagTable = function(name, attributes) {
  5237. tree.parseError("unexpected-table-element-start-tag-in-select-in-table", {name: name});
  5238. this.endTagOther("select");
  5239. tree.insertionMode.processStartTag(name, attributes);
  5240. };
  5241. modes.inSelectInTable.startTagOther = function(name, attributes, selfClosing) {
  5242. modes.inSelect.processStartTag(name, attributes, selfClosing);
  5243. };
  5244. modes.inSelectInTable.endTagTable = function(name) {
  5245. tree.parseError("unexpected-table-element-end-tag-in-select-in-table", {name: name});
  5246. if (tree.openElements.inTableScope(name)) {
  5247. this.endTagOther("select");
  5248. tree.insertionMode.processEndTag(name);
  5249. }
  5250. };
  5251. modes.inSelectInTable.endTagOther = function(name) {
  5252. modes.inSelect.processEndTag(name);
  5253. };
  5254. modes.inRow = Object.create(modes.base);
  5255. modes.inRow.start_tag_handlers = {
  5256. html: 'startTagHtml',
  5257. td: 'startTagTableCell',
  5258. th: 'startTagTableCell',
  5259. caption: 'startTagTableOther',
  5260. col: 'startTagTableOther',
  5261. colgroup: 'startTagTableOther',
  5262. tbody: 'startTagTableOther',
  5263. tfoot: 'startTagTableOther',
  5264. thead: 'startTagTableOther',
  5265. tr: 'startTagTableOther',
  5266. '-default': 'startTagOther'
  5267. };
  5268. modes.inRow.end_tag_handlers = {
  5269. tr: 'endTagTr',
  5270. table: 'endTagTable',
  5271. tbody: 'endTagTableRowGroup',
  5272. tfoot: 'endTagTableRowGroup',
  5273. thead: 'endTagTableRowGroup',
  5274. body: 'endTagIgnore',
  5275. caption: 'endTagIgnore',
  5276. col: 'endTagIgnore',
  5277. colgroup: 'endTagIgnore',
  5278. html: 'endTagIgnore',
  5279. td: 'endTagIgnore',
  5280. th: 'endTagIgnore',
  5281. '-default': 'endTagOther'
  5282. };
  5283. modes.inRow.processCharacters = function(data) {
  5284. modes.inTable.processCharacters(data);
  5285. };
  5286. modes.inRow.startTagTableCell = function(name, attributes) {
  5287. tree.openElements.popUntilTableRowScopeMarker();
  5288. tree.insertElement(name, attributes);
  5289. tree.setInsertionMode('inCell');
  5290. tree.activeFormattingElements.push(Marker);
  5291. };
  5292. modes.inRow.startTagTableOther = function(name, attributes) {
  5293. var ignoreEndTag = this.ignoreEndTagTr();
  5294. this.endTagTr('tr');
  5295. if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes);
  5296. };
  5297. modes.inRow.startTagOther = function(name, attributes, selfClosing) {
  5298. modes.inTable.processStartTag(name, attributes, selfClosing);
  5299. };
  5300. modes.inRow.endTagTr = function(name) {
  5301. if (this.ignoreEndTagTr()) {
  5302. assert.ok(tree.context);
  5303. tree.parseError('unexpected-end-tag', {name: name});
  5304. } else {
  5305. tree.openElements.popUntilTableRowScopeMarker();
  5306. tree.popElement();
  5307. tree.setInsertionMode('inTableBody');
  5308. }
  5309. };
  5310. modes.inRow.endTagTable = function(name) {
  5311. var ignoreEndTag = this.ignoreEndTagTr();
  5312. this.endTagTr('tr');
  5313. if (!ignoreEndTag) tree.insertionMode.processEndTag(name);
  5314. };
  5315. modes.inRow.endTagTableRowGroup = function(name) {
  5316. if (tree.openElements.inTableScope(name)) {
  5317. this.endTagTr('tr');
  5318. tree.insertionMode.processEndTag(name);
  5319. } else {
  5320. tree.parseError('unexpected-end-tag', {name: name});
  5321. }
  5322. };
  5323. modes.inRow.endTagIgnore = function(name) {
  5324. tree.parseError("unexpected-end-tag-in-table-row", {name: name});
  5325. };
  5326. modes.inRow.endTagOther = function(name) {
  5327. modes.inTable.processEndTag(name);
  5328. };
  5329. modes.inRow.ignoreEndTagTr = function() {
  5330. return !tree.openElements.inTableScope('tr');
  5331. };
  5332. modes.afterAfterFrameset = Object.create(modes.base);
  5333. modes.afterAfterFrameset.start_tag_handlers = {
  5334. html: 'startTagHtml',
  5335. noframes: 'startTagNoFrames',
  5336. '-default': 'startTagOther'
  5337. };
  5338. modes.afterAfterFrameset.processEOF = function() {};
  5339. modes.afterAfterFrameset.processComment = function(data) {
  5340. tree.insertComment(data, tree.document);
  5341. };
  5342. modes.afterAfterFrameset.processCharacters = function(buffer) {
  5343. var characters = buffer.takeRemaining();
  5344. var whitespace = "";
  5345. for (var i = 0; i < characters.length; i++) {
  5346. var ch = characters[i];
  5347. if (isWhitespace(ch))
  5348. whitespace += ch;
  5349. }
  5350. if (whitespace) {
  5351. tree.reconstructActiveFormattingElements();
  5352. tree.insertText(whitespace);
  5353. }
  5354. if (whitespace.length < characters.length)
  5355. tree.parseError('expected-eof-but-got-char');
  5356. };
  5357. modes.afterAfterFrameset.startTagNoFrames = function(name, attributes) {
  5358. modes.inHead.processStartTag(name, attributes);
  5359. };
  5360. modes.afterAfterFrameset.startTagOther = function(name, attributes, selfClosing) {
  5361. tree.parseError('expected-eof-but-got-start-tag', {name: name});
  5362. };
  5363. modes.afterAfterFrameset.processEndTag = function(name, attributes) {
  5364. tree.parseError('expected-eof-but-got-end-tag', {name: name});
  5365. };
  5366. modes.text = Object.create(modes.base);
  5367. modes.text.start_tag_handlers = {
  5368. '-default': 'startTagOther'
  5369. };
  5370. modes.text.end_tag_handlers = {
  5371. script: 'endTagScript',
  5372. '-default': 'endTagOther'
  5373. };
  5374. modes.text.processCharacters = function(buffer) {
  5375. if (tree.shouldSkipLeadingNewline) {
  5376. tree.shouldSkipLeadingNewline = false;
  5377. buffer.skipAtMostOneLeadingNewline();
  5378. }
  5379. var data = buffer.takeRemaining();
  5380. if (!data)
  5381. return;
  5382. tree.insertText(data);
  5383. };
  5384. modes.text.processEOF = function() {
  5385. tree.parseError("expected-named-closing-tag-but-got-eof",
  5386. {name: tree.currentStackItem().localName});
  5387. tree.openElements.pop();
  5388. tree.setInsertionMode(tree.originalInsertionMode);
  5389. tree.insertionMode.processEOF();
  5390. };
  5391. modes.text.startTagOther = function(name) {
  5392. throw "Tried to process start tag " + name + " in RCDATA/RAWTEXT mode";
  5393. };
  5394. modes.text.endTagScript = function(name) {
  5395. var node = tree.openElements.pop();
  5396. assert.ok(node.localName == 'script');
  5397. tree.setInsertionMode(tree.originalInsertionMode);
  5398. };
  5399. modes.text.endTagOther = function(name) {
  5400. tree.openElements.pop();
  5401. tree.setInsertionMode(tree.originalInsertionMode);
  5402. };
  5403. }
  5404. TreeBuilder.prototype.setInsertionMode = function(name) {
  5405. this.insertionMode = this.insertionModes[name];
  5406. this.insertionModeName = name;
  5407. };
  5408. TreeBuilder.prototype.adoptionAgencyEndTag = function(name) {
  5409. var outerIterationLimit = 8;
  5410. var innerIterationLimit = 3;
  5411. var formattingElement;
  5412. function isActiveFormattingElement(el) {
  5413. return el === formattingElement;
  5414. }
  5415. var outerLoopCounter = 0;
  5416. while (outerLoopCounter++ < outerIterationLimit) {
  5417. formattingElement = this.elementInActiveFormattingElements(name);
  5418. if (!formattingElement || (this.openElements.contains(formattingElement) && !this.openElements.inScope(formattingElement.localName))) {
  5419. this.parseError('adoption-agency-1.1', {name: name});
  5420. return false;
  5421. }
  5422. if (!this.openElements.contains(formattingElement)) {
  5423. this.parseError('adoption-agency-1.2', {name: name});
  5424. this.removeElementFromActiveFormattingElements(formattingElement);
  5425. return true;
  5426. }
  5427. if (!this.openElements.inScope(formattingElement.localName)) {
  5428. this.parseError('adoption-agency-4.4', {name: name});
  5429. }
  5430. if (formattingElement != this.currentStackItem()) {
  5431. this.parseError('adoption-agency-1.3', {name: name});
  5432. }
  5433. var furthestBlock = this.openElements.furthestBlockForFormattingElement(formattingElement.node);
  5434. if (!furthestBlock) {
  5435. this.openElements.remove_openElements_until(isActiveFormattingElement);
  5436. this.removeElementFromActiveFormattingElements(formattingElement);
  5437. return true;
  5438. }
  5439. var afeIndex = this.openElements.elements.indexOf(formattingElement);
  5440. var commonAncestor = this.openElements.item(afeIndex - 1);
  5441. var bookmark = this.activeFormattingElements.indexOf(formattingElement);
  5442. var node = furthestBlock;
  5443. var lastNode = furthestBlock;
  5444. var index = this.openElements.elements.indexOf(node);
  5445. var innerLoopCounter = 0;
  5446. while (innerLoopCounter++ < innerIterationLimit) {
  5447. index -= 1;
  5448. node = this.openElements.item(index);
  5449. if (this.activeFormattingElements.indexOf(node) < 0) {
  5450. this.openElements.elements.splice(index, 1);
  5451. continue;
  5452. }
  5453. if (node == formattingElement)
  5454. break;
  5455. if (lastNode == furthestBlock)
  5456. bookmark = this.activeFormattingElements.indexOf(node) + 1;
  5457. var clone = this.createElement(node.namespaceURI, node.localName, node.attributes);
  5458. var newNode = new StackItem(node.namespaceURI, node.localName, node.attributes, clone);
  5459. this.activeFormattingElements[this.activeFormattingElements.indexOf(node)] = newNode;
  5460. this.openElements.elements[this.openElements.elements.indexOf(node)] = newNode;
  5461. node = newNode;
  5462. this.detachFromParent(lastNode.node);
  5463. this.attachNode(lastNode.node, node.node);
  5464. lastNode = node;
  5465. }
  5466. this.detachFromParent(lastNode.node);
  5467. if (commonAncestor.isFosterParenting()) {
  5468. this.insertIntoFosterParent(lastNode.node);
  5469. } else {
  5470. this.attachNode(lastNode.node, commonAncestor.node);
  5471. }
  5472. var clone = this.createElement("http://www.w3.org/1999/xhtml", formattingElement.localName, formattingElement.attributes);
  5473. var formattingClone = new StackItem(formattingElement.namespaceURI, formattingElement.localName, formattingElement.attributes, clone);
  5474. this.reparentChildren(furthestBlock.node, clone);
  5475. this.attachNode(clone, furthestBlock.node);
  5476. this.removeElementFromActiveFormattingElements(formattingElement);
  5477. this.activeFormattingElements.splice(Math.min(bookmark, this.activeFormattingElements.length), 0, formattingClone);
  5478. this.openElements.remove(formattingElement);
  5479. this.openElements.elements.splice(this.openElements.elements.indexOf(furthestBlock) + 1, 0, formattingClone);
  5480. }
  5481. return true;
  5482. };
  5483. TreeBuilder.prototype.start = function() {
  5484. throw "Not mplemented";
  5485. };
  5486. TreeBuilder.prototype.startTokenization = function(tokenizer) {
  5487. this.tokenizer = tokenizer;
  5488. this.compatMode = "no quirks";
  5489. this.originalInsertionMode = "initial";
  5490. this.framesetOk = true;
  5491. this.openElements = new ElementStack();
  5492. this.activeFormattingElements = [];
  5493. this.start();
  5494. if (this.context) {
  5495. switch(this.context) {
  5496. case 'title':
  5497. case 'textarea':
  5498. this.tokenizer.setState(Tokenizer.RCDATA);
  5499. break;
  5500. case 'style':
  5501. case 'xmp':
  5502. case 'iframe':
  5503. case 'noembed':
  5504. case 'noframes':
  5505. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5506. break;
  5507. case 'script':
  5508. this.tokenizer.setState(Tokenizer.SCRIPT_DATA);
  5509. break;
  5510. case 'noscript':
  5511. if (this.scriptingEnabled)
  5512. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5513. break;
  5514. case 'plaintext':
  5515. this.tokenizer.setState(Tokenizer.PLAINTEXT);
  5516. break;
  5517. }
  5518. this.insertHtmlElement();
  5519. this.resetInsertionMode();
  5520. } else {
  5521. this.setInsertionMode('initial');
  5522. }
  5523. };
  5524. TreeBuilder.prototype.processToken = function(token) {
  5525. this.selfClosingFlagAcknowledged = false;
  5526. var currentNode = this.openElements.top || null;
  5527. var insertionMode;
  5528. if (!currentNode || !currentNode.isForeign() ||
  5529. (currentNode.isMathMLTextIntegrationPoint() &&
  5530. ((token.type == 'StartTag' &&
  5531. !(token.name in {mglyph:0, malignmark:0})) ||
  5532. (token.type === 'Characters'))
  5533. ) ||
  5534. (currentNode.namespaceURI == "http://www.w3.org/1998/Math/MathML" &&
  5535. currentNode.localName == 'annotation-xml' &&
  5536. token.type == 'StartTag' && token.name == 'svg'
  5537. ) ||
  5538. (currentNode.isHtmlIntegrationPoint() &&
  5539. token.type in {StartTag:0, Characters:0}
  5540. ) ||
  5541. token.type == 'EOF'
  5542. ) {
  5543. insertionMode = this.insertionMode;
  5544. } else {
  5545. insertionMode = this.insertionModes.inForeignContent;
  5546. }
  5547. switch(token.type) {
  5548. case 'Characters':
  5549. var buffer = new CharacterBuffer(token.data);
  5550. insertionMode.processCharacters(buffer);
  5551. break;
  5552. case 'Comment':
  5553. insertionMode.processComment(token.data);
  5554. break;
  5555. case 'StartTag':
  5556. insertionMode.processStartTag(token.name, token.data, token.selfClosing);
  5557. break;
  5558. case 'EndTag':
  5559. insertionMode.processEndTag(token.name);
  5560. break;
  5561. case 'Doctype':
  5562. insertionMode.processDoctype(token.name, token.publicId, token.systemId, token.forceQuirks);
  5563. break;
  5564. case 'EOF':
  5565. insertionMode.processEOF();
  5566. break;
  5567. }
  5568. };
  5569. TreeBuilder.prototype.isCdataSectionAllowed = function() {
  5570. return this.openElements.length > 0 && this.currentStackItem().isForeign();
  5571. };
  5572. TreeBuilder.prototype.isSelfClosingFlagAcknowledged = function() {
  5573. return this.selfClosingFlagAcknowledged;
  5574. };
  5575. TreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) {
  5576. throw new Error("Not implemented");
  5577. };
  5578. TreeBuilder.prototype.attachNode = function(child, parent) {
  5579. throw new Error("Not implemented");
  5580. };
  5581. TreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) {
  5582. throw new Error("Not implemented");
  5583. };
  5584. TreeBuilder.prototype.detachFromParent = function(node) {
  5585. throw new Error("Not implemented");
  5586. };
  5587. TreeBuilder.prototype.addAttributesToElement = function(element, attributes) {
  5588. throw new Error("Not implemented");
  5589. };
  5590. TreeBuilder.prototype.insertHtmlElement = function(attributes) {
  5591. var root = this.createElement("http://www.w3.org/1999/xhtml", 'html', attributes);
  5592. this.attachNode(root, this.document);
  5593. this.openElements.pushHtmlElement(new StackItem("http://www.w3.org/1999/xhtml", 'html', attributes, root));
  5594. return root;
  5595. };
  5596. TreeBuilder.prototype.insertHeadElement = function(attributes) {
  5597. var element = this.createElement("http://www.w3.org/1999/xhtml", "head", attributes);
  5598. this.head = new StackItem("http://www.w3.org/1999/xhtml", "head", attributes, element);
  5599. this.attachNode(element, this.openElements.top.node);
  5600. this.openElements.pushHeadElement(this.head);
  5601. return element;
  5602. };
  5603. TreeBuilder.prototype.insertBodyElement = function(attributes) {
  5604. var element = this.createElement("http://www.w3.org/1999/xhtml", "body", attributes);
  5605. this.attachNode(element, this.openElements.top.node);
  5606. this.openElements.pushBodyElement(new StackItem("http://www.w3.org/1999/xhtml", "body", attributes, element));
  5607. return element;
  5608. };
  5609. TreeBuilder.prototype.insertIntoFosterParent = function(node) {
  5610. var tableIndex = this.openElements.findIndex('table');
  5611. var tableElement = this.openElements.item(tableIndex).node;
  5612. if (tableIndex === 0)
  5613. return this.attachNode(node, tableElement);
  5614. this.attachNodeToFosterParent(node, tableElement, this.openElements.item(tableIndex - 1).node);
  5615. };
  5616. TreeBuilder.prototype.insertElement = function(name, attributes, namespaceURI, selfClosing) {
  5617. if (!namespaceURI)
  5618. namespaceURI = "http://www.w3.org/1999/xhtml";
  5619. var element = this.createElement(namespaceURI, name, attributes);
  5620. if (this.shouldFosterParent())
  5621. this.insertIntoFosterParent(element);
  5622. else
  5623. this.attachNode(element, this.openElements.top.node);
  5624. if (!selfClosing)
  5625. this.openElements.push(new StackItem(namespaceURI, name, attributes, element));
  5626. };
  5627. TreeBuilder.prototype.insertFormattingElement = function(name, attributes) {
  5628. this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml");
  5629. this.appendElementToActiveFormattingElements(this.currentStackItem());
  5630. };
  5631. TreeBuilder.prototype.insertSelfClosingElement = function(name, attributes) {
  5632. this.selfClosingFlagAcknowledged = true;
  5633. this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml", true);
  5634. };
  5635. TreeBuilder.prototype.insertForeignElement = function(name, attributes, namespaceURI, selfClosing) {
  5636. if (selfClosing)
  5637. this.selfClosingFlagAcknowledged = true;
  5638. this.insertElement(name, attributes, namespaceURI, selfClosing);
  5639. };
  5640. TreeBuilder.prototype.insertComment = function(data, parent) {
  5641. throw new Error("Not implemented");
  5642. };
  5643. TreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) {
  5644. throw new Error("Not implemented");
  5645. };
  5646. TreeBuilder.prototype.insertText = function(data) {
  5647. throw new Error("Not implemented");
  5648. };
  5649. TreeBuilder.prototype.currentStackItem = function() {
  5650. return this.openElements.top;
  5651. };
  5652. TreeBuilder.prototype.popElement = function() {
  5653. return this.openElements.pop();
  5654. };
  5655. TreeBuilder.prototype.shouldFosterParent = function() {
  5656. return this.redirectAttachToFosterParent && this.currentStackItem().isFosterParenting();
  5657. };
  5658. TreeBuilder.prototype.generateImpliedEndTags = function(exclude) {
  5659. var name = this.openElements.top.localName;
  5660. if (['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'].indexOf(name) != -1 && name != exclude) {
  5661. this.popElement();
  5662. this.generateImpliedEndTags(exclude);
  5663. }
  5664. };
  5665. TreeBuilder.prototype.reconstructActiveFormattingElements = function() {
  5666. if (this.activeFormattingElements.length === 0)
  5667. return;
  5668. var i = this.activeFormattingElements.length - 1;
  5669. var entry = this.activeFormattingElements[i];
  5670. if (entry == Marker || this.openElements.contains(entry))
  5671. return;
  5672. while (entry != Marker && !this.openElements.contains(entry)) {
  5673. i -= 1;
  5674. entry = this.activeFormattingElements[i];
  5675. if (!entry)
  5676. break;
  5677. }
  5678. while (true) {
  5679. i += 1;
  5680. entry = this.activeFormattingElements[i];
  5681. this.insertElement(entry.localName, entry.attributes);
  5682. var element = this.currentStackItem();
  5683. this.activeFormattingElements[i] = element;
  5684. if (element == this.activeFormattingElements[this.activeFormattingElements.length -1])
  5685. break;
  5686. }
  5687. };
  5688. TreeBuilder.prototype.ensureNoahsArkCondition = function(item) {
  5689. var kNoahsArkCapacity = 3;
  5690. if (this.activeFormattingElements.length < kNoahsArkCapacity)
  5691. return;
  5692. var candidates = [];
  5693. var newItemAttributeCount = item.attributes.length;
  5694. for (var i = this.activeFormattingElements.length - 1; i >= 0; i--) {
  5695. var candidate = this.activeFormattingElements[i];
  5696. if (candidate === Marker)
  5697. break;
  5698. if (item.localName !== candidate.localName || item.namespaceURI !== candidate.namespaceURI)
  5699. continue;
  5700. if (candidate.attributes.length != newItemAttributeCount)
  5701. continue;
  5702. candidates.push(candidate);
  5703. }
  5704. if (candidates.length < kNoahsArkCapacity)
  5705. return;
  5706. var remainingCandidates = [];
  5707. var attributes = item.attributes;
  5708. for (var i = 0; i < attributes.length; i++) {
  5709. var attribute = attributes[i];
  5710. for (var j = 0; j < candidates.length; j++) {
  5711. var candidate = candidates[j];
  5712. var candidateAttribute = getAttribute(candidate, attribute.nodeName);
  5713. if (candidateAttribute && candidateAttribute.nodeValue === attribute.nodeValue)
  5714. remainingCandidates.push(candidate);
  5715. }
  5716. if (remainingCandidates.length < kNoahsArkCapacity)
  5717. return;
  5718. candidates = remainingCandidates;
  5719. remainingCandidates = [];
  5720. }
  5721. for (var i = kNoahsArkCapacity - 1; i < candidates.length; i++)
  5722. this.removeElementFromActiveFormattingElements(candidates[i]);
  5723. };
  5724. TreeBuilder.prototype.appendElementToActiveFormattingElements = function(item) {
  5725. this.ensureNoahsArkCondition(item);
  5726. this.activeFormattingElements.push(item);
  5727. };
  5728. TreeBuilder.prototype.removeElementFromActiveFormattingElements = function(item) {
  5729. var index = this.activeFormattingElements.indexOf(item);
  5730. if (index >= 0)
  5731. this.activeFormattingElements.splice(index, 1);
  5732. };
  5733. TreeBuilder.prototype.elementInActiveFormattingElements = function(name) {
  5734. var els = this.activeFormattingElements;
  5735. for (var i = els.length - 1; i >= 0; i--) {
  5736. if (els[i] == Marker) break;
  5737. if (els[i].localName == name) return els[i];
  5738. }
  5739. return false;
  5740. };
  5741. TreeBuilder.prototype.clearActiveFormattingElements = function() {
  5742. while (!(this.activeFormattingElements.length === 0 || this.activeFormattingElements.pop() == Marker));
  5743. };
  5744. TreeBuilder.prototype.reparentChildren = function(oldParent, newParent) {
  5745. throw new Error("Not implemented");
  5746. };
  5747. TreeBuilder.prototype.setFragmentContext = function(context) {
  5748. this.context = context;
  5749. };
  5750. TreeBuilder.prototype.parseError = function(code, args) {
  5751. if (!this.errorHandler)
  5752. return;
  5753. var message = formatMessage(messages[code], args);
  5754. this.errorHandler.error(message, this.tokenizer._inputStream.location(), code);
  5755. };
  5756. TreeBuilder.prototype.resetInsertionMode = function() {
  5757. var last = false;
  5758. var node = null;
  5759. for (var i = this.openElements.length - 1; i >= 0; i--) {
  5760. node = this.openElements.item(i);
  5761. if (i === 0) {
  5762. assert.ok(this.context);
  5763. last = true;
  5764. node = new StackItem("http://www.w3.org/1999/xhtml", this.context, [], null);
  5765. }
  5766. if (node.namespaceURI === "http://www.w3.org/1999/xhtml") {
  5767. if (node.localName === 'select')
  5768. return this.setInsertionMode('inSelect');
  5769. if (node.localName === 'td' || node.localName === 'th')
  5770. return this.setInsertionMode('inCell');
  5771. if (node.localName === 'tr')
  5772. return this.setInsertionMode('inRow');
  5773. if (node.localName === 'tbody' || node.localName === 'thead' || node.localName === 'tfoot')
  5774. return this.setInsertionMode('inTableBody');
  5775. if (node.localName === 'caption')
  5776. return this.setInsertionMode('inCaption');
  5777. if (node.localName === 'colgroup')
  5778. return this.setInsertionMode('inColumnGroup');
  5779. if (node.localName === 'table')
  5780. return this.setInsertionMode('inTable');
  5781. if (node.localName === 'head' && !last)
  5782. return this.setInsertionMode('inHead');
  5783. if (node.localName === 'body')
  5784. return this.setInsertionMode('inBody');
  5785. if (node.localName === 'frameset')
  5786. return this.setInsertionMode('inFrameset');
  5787. if (node.localName === 'html')
  5788. if (!this.openElements.headElement)
  5789. return this.setInsertionMode('beforeHead');
  5790. else
  5791. return this.setInsertionMode('afterHead');
  5792. }
  5793. if (last)
  5794. return this.setInsertionMode('inBody');
  5795. }
  5796. };
  5797. TreeBuilder.prototype.processGenericRCDATAStartTag = function(name, attributes) {
  5798. this.insertElement(name, attributes);
  5799. this.tokenizer.setState(Tokenizer.RCDATA);
  5800. this.originalInsertionMode = this.insertionModeName;
  5801. this.setInsertionMode('text');
  5802. };
  5803. TreeBuilder.prototype.processGenericRawTextStartTag = function(name, attributes) {
  5804. this.insertElement(name, attributes);
  5805. this.tokenizer.setState(Tokenizer.RAWTEXT);
  5806. this.originalInsertionMode = this.insertionModeName;
  5807. this.setInsertionMode('text');
  5808. };
  5809. TreeBuilder.prototype.adjustMathMLAttributes = function(attributes) {
  5810. attributes.forEach(function(a) {
  5811. a.namespaceURI = "http://www.w3.org/1998/Math/MathML";
  5812. if (constants.MATHMLAttributeMap[a.nodeName])
  5813. a.nodeName = constants.MATHMLAttributeMap[a.nodeName];
  5814. });
  5815. return attributes;
  5816. };
  5817. TreeBuilder.prototype.adjustSVGTagNameCase = function(name) {
  5818. return constants.SVGTagMap[name] || name;
  5819. };
  5820. TreeBuilder.prototype.adjustSVGAttributes = function(attributes) {
  5821. attributes.forEach(function(a) {
  5822. a.namespaceURI = "http://www.w3.org/2000/svg";
  5823. if (constants.SVGAttributeMap[a.nodeName])
  5824. a.nodeName = constants.SVGAttributeMap[a.nodeName];
  5825. });
  5826. return attributes;
  5827. };
  5828. TreeBuilder.prototype.adjustForeignAttributes = function(attributes) {
  5829. for (var i = 0; i < attributes.length; i++) {
  5830. var attribute = attributes[i];
  5831. var adjusted = constants.ForeignAttributeMap[attribute.nodeName];
  5832. if (adjusted) {
  5833. attribute.nodeName = adjusted.localName;
  5834. attribute.prefix = adjusted.prefix;
  5835. attribute.namespaceURI = adjusted.namespaceURI;
  5836. }
  5837. }
  5838. return attributes;
  5839. };
  5840. function formatMessage(format, args) {
  5841. return format.replace(new RegExp('{[0-9a-z-]+}', 'gi'), function(match) {
  5842. return args[match.slice(1, -1)] || match;
  5843. });
  5844. }
  5845. exports.TreeBuilder = TreeBuilder;
  5846. },
  5847. {"./ElementStack":1,"./StackItem":4,"./Tokenizer":5,"./constants":7,"./messages.json":8,"assert":13,"events":16}],
  5848. 7:[function(_dereq_,module,exports){
  5849. exports.SVGTagMap = {
  5850. "altglyph": "altGlyph",
  5851. "altglyphdef": "altGlyphDef",
  5852. "altglyphitem": "altGlyphItem",
  5853. "animatecolor": "animateColor",
  5854. "animatemotion": "animateMotion",
  5855. "animatetransform": "animateTransform",
  5856. "clippath": "clipPath",
  5857. "feblend": "feBlend",
  5858. "fecolormatrix": "feColorMatrix",
  5859. "fecomponenttransfer": "feComponentTransfer",
  5860. "fecomposite": "feComposite",
  5861. "feconvolvematrix": "feConvolveMatrix",
  5862. "fediffuselighting": "feDiffuseLighting",
  5863. "fedisplacementmap": "feDisplacementMap",
  5864. "fedistantlight": "feDistantLight",
  5865. "feflood": "feFlood",
  5866. "fefunca": "feFuncA",
  5867. "fefuncb": "feFuncB",
  5868. "fefuncg": "feFuncG",
  5869. "fefuncr": "feFuncR",
  5870. "fegaussianblur": "feGaussianBlur",
  5871. "feimage": "feImage",
  5872. "femerge": "feMerge",
  5873. "femergenode": "feMergeNode",
  5874. "femorphology": "feMorphology",
  5875. "feoffset": "feOffset",
  5876. "fepointlight": "fePointLight",
  5877. "fespecularlighting": "feSpecularLighting",
  5878. "fespotlight": "feSpotLight",
  5879. "fetile": "feTile",
  5880. "feturbulence": "feTurbulence",
  5881. "foreignobject": "foreignObject",
  5882. "glyphref": "glyphRef",
  5883. "lineargradient": "linearGradient",
  5884. "radialgradient": "radialGradient",
  5885. "textpath": "textPath"
  5886. };
  5887. exports.MATHMLAttributeMap = {
  5888. definitionurl: 'definitionURL'
  5889. };
  5890. exports.SVGAttributeMap = {
  5891. attributename: 'attributeName',
  5892. attributetype: 'attributeType',
  5893. basefrequency: 'baseFrequency',
  5894. baseprofile: 'baseProfile',
  5895. calcmode: 'calcMode',
  5896. clippathunits: 'clipPathUnits',
  5897. contentscripttype: 'contentScriptType',
  5898. contentstyletype: 'contentStyleType',
  5899. diffuseconstant: 'diffuseConstant',
  5900. edgemode: 'edgeMode',
  5901. externalresourcesrequired: 'externalResourcesRequired',
  5902. filterres: 'filterRes',
  5903. filterunits: 'filterUnits',
  5904. glyphref: 'glyphRef',
  5905. gradienttransform: 'gradientTransform',
  5906. gradientunits: 'gradientUnits',
  5907. kernelmatrix: 'kernelMatrix',
  5908. kernelunitlength: 'kernelUnitLength',
  5909. keypoints: 'keyPoints',
  5910. keysplines: 'keySplines',
  5911. keytimes: 'keyTimes',
  5912. lengthadjust: 'lengthAdjust',
  5913. limitingconeangle: 'limitingConeAngle',
  5914. markerheight: 'markerHeight',
  5915. markerunits: 'markerUnits',
  5916. markerwidth: 'markerWidth',
  5917. maskcontentunits: 'maskContentUnits',
  5918. maskunits: 'maskUnits',
  5919. numoctaves: 'numOctaves',
  5920. pathlength: 'pathLength',
  5921. patterncontentunits: 'patternContentUnits',
  5922. patterntransform: 'patternTransform',
  5923. patternunits: 'patternUnits',
  5924. pointsatx: 'pointsAtX',
  5925. pointsaty: 'pointsAtY',
  5926. pointsatz: 'pointsAtZ',
  5927. preservealpha: 'preserveAlpha',
  5928. preserveaspectratio: 'preserveAspectRatio',
  5929. primitiveunits: 'primitiveUnits',
  5930. refx: 'refX',
  5931. refy: 'refY',
  5932. repeatcount: 'repeatCount',
  5933. repeatdur: 'repeatDur',
  5934. requiredextensions: 'requiredExtensions',
  5935. requiredfeatures: 'requiredFeatures',
  5936. specularconstant: 'specularConstant',
  5937. specularexponent: 'specularExponent',
  5938. spreadmethod: 'spreadMethod',
  5939. startoffset: 'startOffset',
  5940. stddeviation: 'stdDeviation',
  5941. stitchtiles: 'stitchTiles',
  5942. surfacescale: 'surfaceScale',
  5943. systemlanguage: 'systemLanguage',
  5944. tablevalues: 'tableValues',
  5945. targetx: 'targetX',
  5946. targety: 'targetY',
  5947. textlength: 'textLength',
  5948. viewbox: 'viewBox',
  5949. viewtarget: 'viewTarget',
  5950. xchannelselector: 'xChannelSelector',
  5951. ychannelselector: 'yChannelSelector',
  5952. zoomandpan: 'zoomAndPan'
  5953. };
  5954. exports.ForeignAttributeMap = {
  5955. "xlink:actuate": {prefix: "xlink", localName: "actuate", namespaceURI: "http://www.w3.org/1999/xlink"},
  5956. "xlink:arcrole": {prefix: "xlink", localName: "arcrole", namespaceURI: "http://www.w3.org/1999/xlink"},
  5957. "xlink:href": {prefix: "xlink", localName: "href", namespaceURI: "http://www.w3.org/1999/xlink"},
  5958. "xlink:role": {prefix: "xlink", localName: "role", namespaceURI: "http://www.w3.org/1999/xlink"},
  5959. "xlink:show": {prefix: "xlink", localName: "show", namespaceURI: "http://www.w3.org/1999/xlink"},
  5960. "xlink:title": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"},
  5961. "xlink:type": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"},
  5962. "xml:base": {prefix: "xml", localName: "base", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5963. "xml:lang": {prefix: "xml", localName: "lang", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5964. "xml:space": {prefix: "xml", localName: "space", namespaceURI: "http://www.w3.org/XML/1998/namespace"},
  5965. "xmlns": {prefix: null, localName: "xmlns", namespaceURI: "http://www.w3.org/2000/xmlns/"},
  5966. "xmlns:xlink": {prefix: "xmlns", localName: "xlink", namespaceURI: "http://www.w3.org/2000/xmlns/"},
  5967. };
  5968. },
  5969. {}],
  5970. 8:[function(_dereq_,module,exports){
  5971. module.exports={
  5972. "null-character":
  5973. "Null character in input stream, replaced with U+FFFD.",
  5974. "invalid-codepoint":
  5975. "Invalid codepoint in stream",
  5976. "incorrectly-placed-solidus":
  5977. "Solidus (/) incorrectly placed in tag.",
  5978. "incorrect-cr-newline-entity":
  5979. "Incorrect CR newline entity, replaced with LF.",
  5980. "illegal-windows-1252-entity":
  5981. "Entity used with illegal number (windows-1252 reference).",
  5982. "cant-convert-numeric-entity":
  5983. "Numeric entity couldn't be converted to character (codepoint U+{charAsInt}).",
  5984. "invalid-numeric-entity-replaced":
  5985. "Numeric entity represents an illegal codepoint. Expanded to the C1 controls range.",
  5986. "numeric-entity-without-semicolon":
  5987. "Numeric entity didn't end with ';'.",
  5988. "expected-numeric-entity-but-got-eof":
  5989. "Numeric entity expected. Got end of file instead.",
  5990. "expected-numeric-entity":
  5991. "Numeric entity expected but none found.",
  5992. "named-entity-without-semicolon":
  5993. "Named entity didn't end with ';'.",
  5994. "expected-named-entity":
  5995. "Named entity expected. Got none.",
  5996. "attributes-in-end-tag":
  5997. "End tag contains unexpected attributes.",
  5998. "self-closing-flag-on-end-tag":
  5999. "End tag contains unexpected self-closing flag.",
  6000. "bare-less-than-sign-at-eof":
  6001. "End of file after <.",
  6002. "expected-tag-name-but-got-right-bracket":
  6003. "Expected tag name. Got '>' instead.",
  6004. "expected-tag-name-but-got-question-mark":
  6005. "Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)",
  6006. "expected-tag-name":
  6007. "Expected tag name. Got something else instead.",
  6008. "expected-closing-tag-but-got-right-bracket":
  6009. "Expected closing tag. Got '>' instead. Ignoring '</>'.",
  6010. "expected-closing-tag-but-got-eof":
  6011. "Expected closing tag. Unexpected end of file.",
  6012. "expected-closing-tag-but-got-char":
  6013. "Expected closing tag. Unexpected character '{data}' found.",
  6014. "eof-in-tag-name":
  6015. "Unexpected end of file in the tag name.",
  6016. "expected-attribute-name-but-got-eof":
  6017. "Unexpected end of file. Expected attribute name instead.",
  6018. "eof-in-attribute-name":
  6019. "Unexpected end of file in attribute name.",
  6020. "invalid-character-in-attribute-name":
  6021. "Invalid character in attribute name.",
  6022. "duplicate-attribute":
  6023. "Dropped duplicate attribute '{name}' on tag.",
  6024. "expected-end-of-tag-but-got-eof":
  6025. "Unexpected end of file. Expected = or end of tag.",
  6026. "expected-attribute-value-but-got-eof":
  6027. "Unexpected end of file. Expected attribute value.",
  6028. "expected-attribute-value-but-got-right-bracket":
  6029. "Expected attribute value. Got '>' instead.",
  6030. "unexpected-character-in-unquoted-attribute-value":
  6031. "Unexpected character in unquoted attribute",
  6032. "invalid-character-after-attribute-name":
  6033. "Unexpected character after attribute name.",
  6034. "unexpected-character-after-attribute-value":
  6035. "Unexpected character after attribute value.",
  6036. "eof-in-attribute-value-double-quote":
  6037. "Unexpected end of file in attribute value (\").",
  6038. "eof-in-attribute-value-single-quote":
  6039. "Unexpected end of file in attribute value (').",
  6040. "eof-in-attribute-value-no-quotes":
  6041. "Unexpected end of file in attribute value.",
  6042. "eof-after-attribute-value":
  6043. "Unexpected end of file after attribute value.",
  6044. "unexpected-eof-after-solidus-in-tag":
  6045. "Unexpected end of file in tag. Expected >.",
  6046. "unexpected-character-after-solidus-in-tag":
  6047. "Unexpected character after / in tag. Expected >.",
  6048. "expected-dashes-or-doctype":
  6049. "Expected '--' or 'DOCTYPE'. Not found.",
  6050. "unexpected-bang-after-double-dash-in-comment":
  6051. "Unexpected ! after -- in comment.",
  6052. "incorrect-comment":
  6053. "Incorrect comment.",
  6054. "eof-in-comment":
  6055. "Unexpected end of file in comment.",
  6056. "eof-in-comment-end-dash":
  6057. "Unexpected end of file in comment (-).",
  6058. "unexpected-dash-after-double-dash-in-comment":
  6059. "Unexpected '-' after '--' found in comment.",
  6060. "eof-in-comment-double-dash":
  6061. "Unexpected end of file in comment (--).",
  6062. "eof-in-comment-end-bang-state":
  6063. "Unexpected end of file in comment.",
  6064. "unexpected-char-in-comment":
  6065. "Unexpected character in comment found.",
  6066. "need-space-after-doctype":
  6067. "No space after literal string 'DOCTYPE'.",
  6068. "expected-doctype-name-but-got-right-bracket":
  6069. "Unexpected > character. Expected DOCTYPE name.",
  6070. "expected-doctype-name-but-got-eof":
  6071. "Unexpected end of file. Expected DOCTYPE name.",
  6072. "eof-in-doctype-name":
  6073. "Unexpected end of file in DOCTYPE name.",
  6074. "eof-in-doctype":
  6075. "Unexpected end of file in DOCTYPE.",
  6076. "expected-space-or-right-bracket-in-doctype":
  6077. "Expected space or '>'. Got '{data}'.",
  6078. "unexpected-end-of-doctype":
  6079. "Unexpected end of DOCTYPE.",
  6080. "unexpected-char-in-doctype":
  6081. "Unexpected character in DOCTYPE.",
  6082. "eof-in-bogus-doctype":
  6083. "Unexpected end of file in bogus doctype.",
  6084. "eof-in-innerhtml":
  6085. "Unexpected EOF in inner html mode.",
  6086. "unexpected-doctype":
  6087. "Unexpected DOCTYPE. Ignored.",
  6088. "non-html-root":
  6089. "html needs to be the first start tag.",
  6090. "expected-doctype-but-got-eof":
  6091. "Unexpected End of file. Expected DOCTYPE.",
  6092. "unknown-doctype":
  6093. "Erroneous DOCTYPE. Expected <!DOCTYPE html>.",
  6094. "quirky-doctype":
  6095. "Quirky doctype. Expected <!DOCTYPE html>.",
  6096. "almost-standards-doctype":
  6097. "Almost standards mode doctype. Expected <!DOCTYPE html>.",
  6098. "obsolete-doctype":
  6099. "Obsolete doctype. Expected <!DOCTYPE html>.",
  6100. "expected-doctype-but-got-chars":
  6101. "Non-space characters found without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6102. "expected-doctype-but-got-start-tag":
  6103. "Start tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6104. "expected-doctype-but-got-end-tag":
  6105. "End tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.",
  6106. "end-tag-after-implied-root":
  6107. "Unexpected end tag ({name}) after the (implied) root element.",
  6108. "expected-named-closing-tag-but-got-eof":
  6109. "Unexpected end of file. Expected end tag ({name}).",
  6110. "two-heads-are-not-better-than-one":
  6111. "Unexpected start tag head in existing head. Ignored.",
  6112. "unexpected-end-tag":
  6113. "Unexpected end tag ({name}). Ignored.",
  6114. "unexpected-implied-end-tag":
  6115. "End tag {name} implied, but there were open elements.",
  6116. "unexpected-start-tag-out-of-my-head":
  6117. "Unexpected start tag ({name}) that can be in head. Moved.",
  6118. "unexpected-start-tag":
  6119. "Unexpected start tag ({name}).",
  6120. "missing-end-tag":
  6121. "Missing end tag ({name}).",
  6122. "missing-end-tags":
  6123. "Missing end tags ({name}).",
  6124. "unexpected-start-tag-implies-end-tag":
  6125. "Unexpected start tag ({startName}) implies end tag ({endName}).",
  6126. "unexpected-start-tag-treated-as":
  6127. "Unexpected start tag ({originalName}). Treated as {newName}.",
  6128. "deprecated-tag":
  6129. "Unexpected start tag {name}. Don't use it!",
  6130. "unexpected-start-tag-ignored":
  6131. "Unexpected start tag {name}. Ignored.",
  6132. "expected-one-end-tag-but-got-another":
  6133. "Unexpected end tag ({gotName}). Missing end tag ({expectedName}).",
  6134. "end-tag-too-early":
  6135. "End tag ({name}) seen too early. Expected other end tag.",
  6136. "end-tag-too-early-named":
  6137. "Unexpected end tag ({gotName}). Expected end tag ({expectedName}.",
  6138. "end-tag-too-early-ignored":
  6139. "End tag ({name}) seen too early. Ignored.",
  6140. "adoption-agency-1.1":
  6141. "End tag ({name}) violates step 1, paragraph 1 of the adoption agency algorithm.",
  6142. "adoption-agency-1.2":
  6143. "End tag ({name}) violates step 1, paragraph 2 of the adoption agency algorithm.",
  6144. "adoption-agency-1.3":
  6145. "End tag ({name}) violates step 1, paragraph 3 of the adoption agency algorithm.",
  6146. "adoption-agency-4.4":
  6147. "End tag ({name}) violates step 4, paragraph 4 of the adoption agency algorithm.",
  6148. "unexpected-end-tag-treated-as":
  6149. "Unexpected end tag ({originalName}). Treated as {newName}.",
  6150. "no-end-tag":
  6151. "This element ({name}) has no end tag.",
  6152. "unexpected-implied-end-tag-in-table":
  6153. "Unexpected implied end tag ({name}) in the table phase.",
  6154. "unexpected-implied-end-tag-in-table-body":
  6155. "Unexpected implied end tag ({name}) in the table body phase.",
  6156. "unexpected-char-implies-table-voodoo":
  6157. "Unexpected non-space characters in table context caused voodoo mode.",
  6158. "unexpected-hidden-input-in-table":
  6159. "Unexpected input with type hidden in table context.",
  6160. "unexpected-form-in-table":
  6161. "Unexpected form in table context.",
  6162. "unexpected-start-tag-implies-table-voodoo":
  6163. "Unexpected start tag ({name}) in table context caused voodoo mode.",
  6164. "unexpected-end-tag-implies-table-voodoo":
  6165. "Unexpected end tag ({name}) in table context caused voodoo mode.",
  6166. "unexpected-cell-in-table-body":
  6167. "Unexpected table cell start tag ({name}) in the table body phase.",
  6168. "unexpected-cell-end-tag":
  6169. "Got table cell end tag ({name}) while required end tags are missing.",
  6170. "unexpected-end-tag-in-table-body":
  6171. "Unexpected end tag ({name}) in the table body phase. Ignored.",
  6172. "unexpected-implied-end-tag-in-table-row":
  6173. "Unexpected implied end tag ({name}) in the table row phase.",
  6174. "unexpected-end-tag-in-table-row":
  6175. "Unexpected end tag ({name}) in the table row phase. Ignored.",
  6176. "unexpected-select-in-select":
  6177. "Unexpected select start tag in the select phase treated as select end tag.",
  6178. "unexpected-input-in-select":
  6179. "Unexpected input start tag in the select phase.",
  6180. "unexpected-start-tag-in-select":
  6181. "Unexpected start tag token ({name}) in the select phase. Ignored.",
  6182. "unexpected-end-tag-in-select":
  6183. "Unexpected end tag ({name}) in the select phase. Ignored.",
  6184. "unexpected-table-element-start-tag-in-select-in-table":
  6185. "Unexpected table element start tag ({name}) in the select in table phase.",
  6186. "unexpected-table-element-end-tag-in-select-in-table":
  6187. "Unexpected table element end tag ({name}) in the select in table phase.",
  6188. "unexpected-char-after-body":
  6189. "Unexpected non-space characters in the after body phase.",
  6190. "unexpected-start-tag-after-body":
  6191. "Unexpected start tag token ({name}) in the after body phase.",
  6192. "unexpected-end-tag-after-body":
  6193. "Unexpected end tag token ({name}) in the after body phase.",
  6194. "unexpected-char-in-frameset":
  6195. "Unepxected characters in the frameset phase. Characters ignored.",
  6196. "unexpected-start-tag-in-frameset":
  6197. "Unexpected start tag token ({name}) in the frameset phase. Ignored.",
  6198. "unexpected-frameset-in-frameset-innerhtml":
  6199. "Unexpected end tag token (frameset in the frameset phase (innerHTML).",
  6200. "unexpected-end-tag-in-frameset":
  6201. "Unexpected end tag token ({name}) in the frameset phase. Ignored.",
  6202. "unexpected-char-after-frameset":
  6203. "Unexpected non-space characters in the after frameset phase. Ignored.",
  6204. "unexpected-start-tag-after-frameset":
  6205. "Unexpected start tag ({name}) in the after frameset phase. Ignored.",
  6206. "unexpected-end-tag-after-frameset":
  6207. "Unexpected end tag ({name}) in the after frameset phase. Ignored.",
  6208. "expected-eof-but-got-char":
  6209. "Unexpected non-space characters. Expected end of file.",
  6210. "expected-eof-but-got-start-tag":
  6211. "Unexpected start tag ({name}). Expected end of file.",
  6212. "expected-eof-but-got-end-tag":
  6213. "Unexpected end tag ({name}). Expected end of file.",
  6214. "unexpected-end-table-in-caption":
  6215. "Unexpected end table tag in caption. Generates implied end caption.",
  6216. "end-html-in-innerhtml":
  6217. "Unexpected html end tag in inner html mode.",
  6218. "eof-in-table":
  6219. "Unexpected end of file. Expected table content.",
  6220. "eof-in-script":
  6221. "Unexpected end of file. Expected script content.",
  6222. "non-void-element-with-trailing-solidus":
  6223. "Trailing solidus not allowed on element {name}.",
  6224. "unexpected-html-element-in-foreign-content":
  6225. "HTML start tag \"{name}\" in a foreign namespace context.",
  6226. "unexpected-start-tag-in-table":
  6227. "Unexpected {name}. Expected table content."
  6228. }
  6229. },
  6230. {}],
  6231. 9:[function(_dereq_,module,exports){
  6232. var SAXTreeBuilder = _dereq_('./SAXTreeBuilder').SAXTreeBuilder;
  6233. var Tokenizer = _dereq_('../Tokenizer').Tokenizer;
  6234. var TreeParser = _dereq_('./TreeParser').TreeParser;
  6235. function SAXParser() {
  6236. this.contentHandler = null;
  6237. this._errorHandler = null;
  6238. this._treeBuilder = new SAXTreeBuilder();
  6239. this._tokenizer = new Tokenizer(this._treeBuilder);
  6240. this._scriptingEnabled = false;
  6241. }
  6242. SAXParser.prototype.parse = function(source) {
  6243. this._tokenizer.tokenize(source);
  6244. var document = this._treeBuilder.document;
  6245. if (document) {
  6246. new TreeParser(this.contentHandler).parse(document);
  6247. }
  6248. };
  6249. SAXParser.prototype.parseFragment = function(source, context) {
  6250. this._treeBuilder.setFragmentContext(context);
  6251. this._tokenizer.tokenize(source);
  6252. var fragment = this._treeBuilder.getFragment();
  6253. if (fragment) {
  6254. new TreeParser(this.contentHandler).parse(fragment);
  6255. }
  6256. };
  6257. Object.defineProperty(SAXParser.prototype, 'scriptingEnabled', {
  6258. get: function() {
  6259. return this._scriptingEnabled;
  6260. },
  6261. set: function(value) {
  6262. this._scriptingEnabled = value;
  6263. this._treeBuilder.scriptingEnabled = value;
  6264. }
  6265. });
  6266. Object.defineProperty(SAXParser.prototype, 'errorHandler', {
  6267. get: function() {
  6268. return this._errorHandler;
  6269. },
  6270. set: function(value) {
  6271. this._errorHandler = value;
  6272. this._treeBuilder.errorHandler = value;
  6273. }
  6274. });
  6275. exports.SAXParser = SAXParser;
  6276. },
  6277. {"../Tokenizer":5,"./SAXTreeBuilder":10,"./TreeParser":11}],
  6278. 10:[function(_dereq_,module,exports){
  6279. var util = _dereq_('util');
  6280. var TreeBuilder = _dereq_('../TreeBuilder').TreeBuilder;
  6281. function SAXTreeBuilder() {
  6282. TreeBuilder.call(this);
  6283. }
  6284. util.inherits(SAXTreeBuilder, TreeBuilder);
  6285. SAXTreeBuilder.prototype.start = function(tokenizer) {
  6286. this.document = new Document(this.tokenizer);
  6287. };
  6288. SAXTreeBuilder.prototype.end = function() {
  6289. this.document.endLocator = this.tokenizer;
  6290. };
  6291. SAXTreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) {
  6292. var doctype = new DTD(this.tokenizer, name, publicId, systemId);
  6293. doctype.endLocator = this.tokenizer;
  6294. this.document.appendChild(doctype);
  6295. };
  6296. SAXTreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) {
  6297. var element = new Element(this.tokenizer, namespaceURI, localName, localName, attributes || []);
  6298. return element;
  6299. };
  6300. SAXTreeBuilder.prototype.insertComment = function(data, parent) {
  6301. if (!parent)
  6302. parent = this.currentStackItem();
  6303. var comment = new Comment(this.tokenizer, data);
  6304. parent.appendChild(comment);
  6305. };
  6306. SAXTreeBuilder.prototype.appendCharacters = function(parent, data) {
  6307. var text = new Characters(this.tokenizer, data);
  6308. parent.appendChild(text);
  6309. };
  6310. SAXTreeBuilder.prototype.insertText = function(data) {
  6311. if (this.redirectAttachToFosterParent && this.openElements.top.isFosterParenting()) {
  6312. var tableIndex = this.openElements.findIndex('table');
  6313. var tableItem = this.openElements.item(tableIndex);
  6314. var table = tableItem.node;
  6315. if (tableIndex === 0) {
  6316. return this.appendCharacters(table, data);
  6317. }
  6318. var text = new Characters(this.tokenizer, data);
  6319. var parent = table.parentNode;
  6320. if (parent) {
  6321. parent.insertBetween(text, table.previousSibling, table);
  6322. return;
  6323. }
  6324. var stackParent = this.openElements.item(tableIndex - 1).node;
  6325. stackParent.appendChild(text);
  6326. return;
  6327. }
  6328. this.appendCharacters(this.currentStackItem().node, data);
  6329. };
  6330. SAXTreeBuilder.prototype.attachNode = function(node, parent) {
  6331. parent.appendChild(node);
  6332. };
  6333. SAXTreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) {
  6334. var parent = table.parentNode;
  6335. if (parent)
  6336. parent.insertBetween(child, table.previousSibling, table);
  6337. else
  6338. stackParent.appendChild(child);
  6339. };
  6340. SAXTreeBuilder.prototype.detachFromParent = function(element) {
  6341. element.detach();
  6342. };
  6343. SAXTreeBuilder.prototype.reparentChildren = function(oldParent, newParent) {
  6344. newParent.appendChildren(oldParent.firstChild);
  6345. };
  6346. SAXTreeBuilder.prototype.getFragment = function() {
  6347. var fragment = new DocumentFragment();
  6348. this.reparentChildren(this.openElements.rootNode, fragment);
  6349. return fragment;
  6350. };
  6351. function getAttribute(node, name) {
  6352. for (var i = 0; i < node.attributes.length; i++) {
  6353. var attribute = node.attributes[i];
  6354. if (attribute.nodeName === name)
  6355. return attribute.nodeValue;
  6356. }
  6357. }
  6358. SAXTreeBuilder.prototype.addAttributesToElement = function(element, attributes) {
  6359. for (var i = 0; i < attributes.length; i++) {
  6360. var attribute = attributes[i];
  6361. if (!getAttribute(element, attribute.nodeName))
  6362. element.attributes.push(attribute);
  6363. }
  6364. };
  6365. var NodeType = {
  6366. CDATA: 1,
  6367. CHARACTERS: 2,
  6368. COMMENT: 3,
  6369. DOCUMENT: 4,
  6370. DOCUMENT_FRAGMENT: 5,
  6371. DTD: 6,
  6372. ELEMENT: 7,
  6373. ENTITY: 8,
  6374. IGNORABLE_WHITESPACE: 9,
  6375. PROCESSING_INSTRUCTION: 10,
  6376. SKIPPED_ENTITY: 11
  6377. };
  6378. function Node(locator) {
  6379. if (!locator) {
  6380. this.columnNumber = -1;
  6381. this.lineNumber = -1;
  6382. } else {
  6383. this.columnNumber = locator.columnNumber;
  6384. this.lineNumber = locator.lineNumber;
  6385. }
  6386. this.parentNode = null;
  6387. this.nextSibling = null;
  6388. this.firstChild = null;
  6389. }
  6390. Node.prototype.visit = function(treeParser) {
  6391. throw new Error("Not Implemented");
  6392. };
  6393. Node.prototype.revisit = function(treeParser) {
  6394. return;
  6395. };
  6396. Node.prototype.detach = function() {
  6397. if (this.parentNode !== null) {
  6398. this.parentNode.removeChild(this);
  6399. this.parentNode = null;
  6400. }
  6401. };
  6402. Object.defineProperty(Node.prototype, 'previousSibling', {
  6403. get: function() {
  6404. var prev = null;
  6405. var next = this.parentNode.firstChild;
  6406. for(;;) {
  6407. if (this == next) {
  6408. return prev;
  6409. }
  6410. prev = next;
  6411. next = next.nextSibling;
  6412. }
  6413. }
  6414. });
  6415. function ParentNode(locator) {
  6416. Node.call(this, locator);
  6417. this.lastChild = null;
  6418. this._endLocator = null;
  6419. }
  6420. ParentNode.prototype = Object.create(Node.prototype);
  6421. ParentNode.prototype.insertBefore = function(child, sibling) {
  6422. if (!sibling) {
  6423. return this.appendChild(child);
  6424. }
  6425. child.detach();
  6426. child.parentNode = this;
  6427. if (this.firstChild == sibling) {
  6428. child.nextSibling = sibling;
  6429. this.firstChild = child;
  6430. } else {
  6431. var prev = this.firstChild;
  6432. var next = this.firstChild.nextSibling;
  6433. while (next != sibling) {
  6434. prev = next;
  6435. next = next.nextSibling;
  6436. }
  6437. prev.nextSibling = child;
  6438. child.nextSibling = next;
  6439. }
  6440. return child;
  6441. };
  6442. ParentNode.prototype.insertBetween = function(child, prev, next) {
  6443. if (!next) {
  6444. return this.appendChild(child);
  6445. }
  6446. child.detach();
  6447. child.parentNode = this;
  6448. child.nextSibling = next;
  6449. if (!prev) {
  6450. firstChild = child;
  6451. } else {
  6452. prev.nextSibling = child;
  6453. }
  6454. return child;
  6455. };
  6456. ParentNode.prototype.appendChild = function(child) {
  6457. child.detach();
  6458. child.parentNode = this;
  6459. if (!this.firstChild) {
  6460. this.firstChild = child;
  6461. } else {
  6462. this.lastChild.nextSibling = child;
  6463. }
  6464. this.lastChild = child;
  6465. return child;
  6466. };
  6467. ParentNode.prototype.appendChildren = function(parent) {
  6468. var child = parent.firstChild;
  6469. if (!child) {
  6470. return;
  6471. }
  6472. var another = parent;
  6473. if (!this.firstChild) {
  6474. this.firstChild = child;
  6475. } else {
  6476. this.lastChild.nextSibling = child;
  6477. }
  6478. this.lastChild = another.lastChild;
  6479. do {
  6480. child.parentNode = this;
  6481. } while ((child = child.nextSibling));
  6482. another.firstChild = null;
  6483. another.lastChild = null;
  6484. };
  6485. ParentNode.prototype.removeChild = function(node) {
  6486. if (this.firstChild == node) {
  6487. this.firstChild = node.nextSibling;
  6488. if (this.lastChild == node) {
  6489. this.lastChild = null;
  6490. }
  6491. } else {
  6492. var prev = this.firstChild;
  6493. var next = this.firstChild.nextSibling;
  6494. while (next != node) {
  6495. prev = next;
  6496. next = next.nextSibling;
  6497. }
  6498. prev.nextSibling = node.nextSibling;
  6499. if (this.lastChild == node) {
  6500. this.lastChild = prev;
  6501. }
  6502. }
  6503. node.parentNode = null;
  6504. return node;
  6505. };
  6506. Object.defineProperty(ParentNode.prototype, 'endLocator', {
  6507. get: function() {
  6508. return this._endLocator;
  6509. },
  6510. set: function(endLocator) {
  6511. this._endLocator = {
  6512. lineNumber: endLocator.lineNumber,
  6513. columnNumber: endLocator.columnNumber
  6514. };
  6515. }
  6516. });
  6517. function Document (locator) {
  6518. ParentNode.call(this, locator);
  6519. this.nodeType = NodeType.DOCUMENT;
  6520. }
  6521. Document.prototype = Object.create(ParentNode.prototype);
  6522. Document.prototype.visit = function(treeParser) {
  6523. treeParser.startDocument(this);
  6524. };
  6525. Document.prototype.revisit = function(treeParser) {
  6526. treeParser.endDocument(this.endLocator);
  6527. };
  6528. function DocumentFragment() {
  6529. ParentNode.call(this, new Locator());
  6530. this.nodeType = NodeType.DOCUMENT_FRAGMENT;
  6531. }
  6532. DocumentFragment.prototype = Object.create(ParentNode.prototype);
  6533. DocumentFragment.prototype.visit = function(treeParser) {
  6534. };
  6535. function Element(locator, uri, localName, qName, atts, prefixMappings) {
  6536. ParentNode.call(this, locator);
  6537. this.uri = uri;
  6538. this.localName = localName;
  6539. this.qName = qName;
  6540. this.attributes = atts;
  6541. this.prefixMappings = prefixMappings;
  6542. this.nodeType = NodeType.ELEMENT;
  6543. }
  6544. Element.prototype = Object.create(ParentNode.prototype);
  6545. Element.prototype.visit = function(treeParser) {
  6546. if (this.prefixMappings) {
  6547. for (var key in prefixMappings) {
  6548. var mapping = prefixMappings[key];
  6549. treeParser.startPrefixMapping(mapping.getPrefix(),
  6550. mapping.getUri(), this);
  6551. }
  6552. }
  6553. treeParser.startElement(this.uri, this.localName, this.qName, this.attributes, this);
  6554. };
  6555. Element.prototype.revisit = function(treeParser) {
  6556. treeParser.endElement(this.uri, this.localName, this.qName, this.endLocator);
  6557. if (this.prefixMappings) {
  6558. for (var key in prefixMappings) {
  6559. var mapping = prefixMappings[key];
  6560. treeParser.endPrefixMapping(mapping.getPrefix(), this.endLocator);
  6561. }
  6562. }
  6563. };
  6564. function Characters(locator, data){
  6565. Node.call(this, locator);
  6566. this.data = data;
  6567. this.nodeType = NodeType.CHARACTERS;
  6568. }
  6569. Characters.prototype = Object.create(Node.prototype);
  6570. Characters.prototype.visit = function (treeParser) {
  6571. treeParser.characters(this.data, 0, this.data.length, this);
  6572. };
  6573. function IgnorableWhitespace(locator, data) {
  6574. Node.call(this, locator);
  6575. this.data = data;
  6576. this.nodeType = NodeType.IGNORABLE_WHITESPACE;
  6577. }
  6578. IgnorableWhitespace.prototype = Object.create(Node.prototype);
  6579. IgnorableWhitespace.prototype.visit = function(treeParser) {
  6580. treeParser.ignorableWhitespace(this.data, 0, this.data.length, this);
  6581. };
  6582. function Comment(locator, data) {
  6583. Node.call(this, locator);
  6584. this.data = data;
  6585. this.nodeType = NodeType.COMMENT;
  6586. }
  6587. Comment.prototype = Object.create(Node.prototype);
  6588. Comment.prototype.visit = function(treeParser) {
  6589. treeParser.comment(this.data, 0, this.data.length, this);
  6590. };
  6591. function CDATA(locator) {
  6592. ParentNode.call(this, locator);
  6593. this.nodeType = NodeType.CDATA;
  6594. }
  6595. CDATA.prototype = Object.create(ParentNode.prototype);
  6596. CDATA.prototype.visit = function(treeParser) {
  6597. treeParser.startCDATA(this);
  6598. };
  6599. CDATA.prototype.revisit = function(treeParser) {
  6600. treeParser.endCDATA(this.endLocator);
  6601. };
  6602. function Entity(name) {
  6603. ParentNode.call(this);
  6604. this.name = name;
  6605. this.nodeType = NodeType.ENTITY;
  6606. }
  6607. Entity.prototype = Object.create(ParentNode.prototype);
  6608. Entity.prototype.visit = function(treeParser) {
  6609. treeParser.startEntity(this.name, this);
  6610. };
  6611. Entity.prototype.revisit = function(treeParser) {
  6612. treeParser.endEntity(this.name);
  6613. };
  6614. function SkippedEntity(name) {
  6615. Node.call(this);
  6616. this.name = name;
  6617. this.nodeType = NodeType.SKIPPED_ENTITY;
  6618. }
  6619. SkippedEntity.prototype = Object.create(Node.prototype);
  6620. SkippedEntity.prototype.visit = function(treeParser) {
  6621. treeParser.skippedEntity(this.name, this);
  6622. };
  6623. function ProcessingInstruction(target, data) {
  6624. Node.call(this);
  6625. this.target = target;
  6626. this.data = data;
  6627. }
  6628. ProcessingInstruction.prototype = Object.create(Node.prototype);
  6629. ProcessingInstruction.prototype.visit = function(treeParser) {
  6630. treeParser.processingInstruction(this.target, this.data, this);
  6631. };
  6632. ProcessingInstruction.prototype.getNodeType = function() {
  6633. return NodeType.PROCESSING_INSTRUCTION;
  6634. };
  6635. function DTD(name, publicIdentifier, systemIdentifier) {
  6636. ParentNode.call(this);
  6637. this.name = name;
  6638. this.publicIdentifier = publicIdentifier;
  6639. this.systemIdentifier = systemIdentifier;
  6640. this.nodeType = NodeType.DTD;
  6641. }
  6642. DTD.prototype = Object.create(ParentNode.prototype);
  6643. DTD.prototype.visit = function(treeParser) {
  6644. treeParser.startDTD(this.name, this.publicIdentifier, this.systemIdentifier, this);
  6645. };
  6646. DTD.prototype.revisit = function(treeParser) {
  6647. treeParser.endDTD();
  6648. };
  6649. exports.SAXTreeBuilder = SAXTreeBuilder;
  6650. },
  6651. {"../TreeBuilder":6,"util":20}],
  6652. 11:[function(_dereq_,module,exports){
  6653. function TreeParser(contentHandler, lexicalHandler){
  6654. this.contentHandler;
  6655. this.lexicalHandler;
  6656. this.locatorDelegate;
  6657. if (!contentHandler) {
  6658. throw new IllegalArgumentException("contentHandler was null.");
  6659. }
  6660. this.contentHandler = contentHandler;
  6661. if (!lexicalHandler) {
  6662. this.lexicalHandler = new NullLexicalHandler();
  6663. } else {
  6664. this.lexicalHandler = lexicalHandler;
  6665. }
  6666. }
  6667. TreeParser.prototype.parse = function(node) {
  6668. this.contentHandler.documentLocator = this;
  6669. var current = node;
  6670. var next;
  6671. for (;;) {
  6672. current.visit(this);
  6673. if (next = current.firstChild) {
  6674. current = next;
  6675. continue;
  6676. }
  6677. for (;;) {
  6678. current.revisit(this);
  6679. if (current == node) {
  6680. return;
  6681. }
  6682. if (next = current.nextSibling) {
  6683. current = next;
  6684. break;
  6685. }
  6686. current = current.parentNode;
  6687. }
  6688. }
  6689. };
  6690. TreeParser.prototype.characters = function(ch, start, length, locator) {
  6691. this.locatorDelegate = locator;
  6692. this.contentHandler.characters(ch, start, length);
  6693. };
  6694. TreeParser.prototype.endDocument = function(locator) {
  6695. this.locatorDelegate = locator;
  6696. this.contentHandler.endDocument();
  6697. };
  6698. TreeParser.prototype.endElement = function(uri, localName, qName, locator) {
  6699. this.locatorDelegate = locator;
  6700. this.contentHandler.endElement(uri, localName, qName);
  6701. };
  6702. TreeParser.prototype.endPrefixMapping = function(prefix, locator) {
  6703. this.locatorDelegate = locator;
  6704. this.contentHandler.endPrefixMapping(prefix);
  6705. };
  6706. TreeParser.prototype.ignorableWhitespace = function(ch, start, length, locator) {
  6707. this.locatorDelegate = locator;
  6708. this.contentHandler.ignorableWhitespace(ch, start, length);
  6709. };
  6710. TreeParser.prototype.processingInstruction = function(target, data, locator) {
  6711. this.locatorDelegate = locator;
  6712. this.contentHandler.processingInstruction(target, data);
  6713. };
  6714. TreeParser.prototype.skippedEntity = function(name, locator) {
  6715. this.locatorDelegate = locator;
  6716. this.contentHandler.skippedEntity(name);
  6717. };
  6718. TreeParser.prototype.startDocument = function(locator) {
  6719. this.locatorDelegate = locator;
  6720. this.contentHandler.startDocument();
  6721. };
  6722. TreeParser.prototype.startElement = function(uri, localName, qName, atts, locator) {
  6723. this.locatorDelegate = locator;
  6724. this.contentHandler.startElement(uri, localName, qName, atts);
  6725. };
  6726. TreeParser.prototype.startPrefixMapping = function(prefix, uri, locator) {
  6727. this.locatorDelegate = locator;
  6728. this.contentHandler.startPrefixMapping(prefix, uri);
  6729. };
  6730. TreeParser.prototype.comment = function(ch, start, length, locator) {
  6731. this.locatorDelegate = locator;
  6732. this.lexicalHandler.comment(ch, start, length);
  6733. };
  6734. TreeParser.prototype.endCDATA = function(locator) {
  6735. this.locatorDelegate = locator;
  6736. this.lexicalHandler.endCDATA();
  6737. };
  6738. TreeParser.prototype.endDTD = function(locator) {
  6739. this.locatorDelegate = locator;
  6740. this.lexicalHandler.endDTD();
  6741. };
  6742. TreeParser.prototype.endEntity = function(name, locator) {
  6743. this.locatorDelegate = locator;
  6744. this.lexicalHandler.endEntity(name);
  6745. };
  6746. TreeParser.prototype.startCDATA = function(locator) {
  6747. this.locatorDelegate = locator;
  6748. this.lexicalHandler.startCDATA();
  6749. };
  6750. TreeParser.prototype.startDTD = function(name, publicId, systemId, locator) {
  6751. this.locatorDelegate = locator;
  6752. this.lexicalHandler.startDTD(name, publicId, systemId);
  6753. };
  6754. TreeParser.prototype.startEntity = function(name, locator) {
  6755. this.locatorDelegate = locator;
  6756. this.lexicalHandler.startEntity(name);
  6757. };
  6758. Object.defineProperty(TreeParser.prototype, 'columnNumber', {
  6759. get: function() {
  6760. if (!this.locatorDelegate)
  6761. return -1;
  6762. else
  6763. return this.locatorDelegate.columnNumber;
  6764. }
  6765. });
  6766. Object.defineProperty(TreeParser.prototype, 'lineNumber', {
  6767. get: function() {
  6768. if (!this.locatorDelegate)
  6769. return -1;
  6770. else
  6771. return this.locatorDelegate.lineNumber;
  6772. }
  6773. });
  6774. function NullLexicalHandler() {
  6775. }
  6776. NullLexicalHandler.prototype.comment = function() {};
  6777. NullLexicalHandler.prototype.endCDATA = function() {};
  6778. NullLexicalHandler.prototype.endDTD = function() {};
  6779. NullLexicalHandler.prototype.endEntity = function() {};
  6780. NullLexicalHandler.prototype.startCDATA = function() {};
  6781. NullLexicalHandler.prototype.startDTD = function() {};
  6782. NullLexicalHandler.prototype.startEntity = function() {};
  6783. exports.TreeParser = TreeParser;
  6784. },
  6785. {}],
  6786. 12:[function(_dereq_,module,exports){
  6787. module.exports = {
  6788. "Aacute;": "\u00C1",
  6789. "Aacute": "\u00C1",
  6790. "aacute;": "\u00E1",
  6791. "aacute": "\u00E1",
  6792. "Abreve;": "\u0102",
  6793. "abreve;": "\u0103",
  6794. "ac;": "\u223E",
  6795. "acd;": "\u223F",
  6796. "acE;": "\u223E\u0333",
  6797. "Acirc;": "\u00C2",
  6798. "Acirc": "\u00C2",
  6799. "acirc;": "\u00E2",
  6800. "acirc": "\u00E2",
  6801. "acute;": "\u00B4",
  6802. "acute": "\u00B4",
  6803. "Acy;": "\u0410",
  6804. "acy;": "\u0430",
  6805. "AElig;": "\u00C6",
  6806. "AElig": "\u00C6",
  6807. "aelig;": "\u00E6",
  6808. "aelig": "\u00E6",
  6809. "af;": "\u2061",
  6810. "Afr;": "\uD835\uDD04",
  6811. "afr;": "\uD835\uDD1E",
  6812. "Agrave;": "\u00C0",
  6813. "Agrave": "\u00C0",
  6814. "agrave;": "\u00E0",
  6815. "agrave": "\u00E0",
  6816. "alefsym;": "\u2135",
  6817. "aleph;": "\u2135",
  6818. "Alpha;": "\u0391",
  6819. "alpha;": "\u03B1",
  6820. "Amacr;": "\u0100",
  6821. "amacr;": "\u0101",
  6822. "amalg;": "\u2A3F",
  6823. "amp;": "\u0026",
  6824. "amp": "\u0026",
  6825. "AMP;": "\u0026",
  6826. "AMP": "\u0026",
  6827. "andand;": "\u2A55",
  6828. "And;": "\u2A53",
  6829. "and;": "\u2227",
  6830. "andd;": "\u2A5C",
  6831. "andslope;": "\u2A58",
  6832. "andv;": "\u2A5A",
  6833. "ang;": "\u2220",
  6834. "ange;": "\u29A4",
  6835. "angle;": "\u2220",
  6836. "angmsdaa;": "\u29A8",
  6837. "angmsdab;": "\u29A9",
  6838. "angmsdac;": "\u29AA",
  6839. "angmsdad;": "\u29AB",
  6840. "angmsdae;": "\u29AC",
  6841. "angmsdaf;": "\u29AD",
  6842. "angmsdag;": "\u29AE",
  6843. "angmsdah;": "\u29AF",
  6844. "angmsd;": "\u2221",
  6845. "angrt;": "\u221F",
  6846. "angrtvb;": "\u22BE",
  6847. "angrtvbd;": "\u299D",
  6848. "angsph;": "\u2222",
  6849. "angst;": "\u00C5",
  6850. "angzarr;": "\u237C",
  6851. "Aogon;": "\u0104",
  6852. "aogon;": "\u0105",
  6853. "Aopf;": "\uD835\uDD38",
  6854. "aopf;": "\uD835\uDD52",
  6855. "apacir;": "\u2A6F",
  6856. "ap;": "\u2248",
  6857. "apE;": "\u2A70",
  6858. "ape;": "\u224A",
  6859. "apid;": "\u224B",
  6860. "apos;": "\u0027",
  6861. "ApplyFunction;": "\u2061",
  6862. "approx;": "\u2248",
  6863. "approxeq;": "\u224A",
  6864. "Aring;": "\u00C5",
  6865. "Aring": "\u00C5",
  6866. "aring;": "\u00E5",
  6867. "aring": "\u00E5",
  6868. "Ascr;": "\uD835\uDC9C",
  6869. "ascr;": "\uD835\uDCB6",
  6870. "Assign;": "\u2254",
  6871. "ast;": "\u002A",
  6872. "asymp;": "\u2248",
  6873. "asympeq;": "\u224D",
  6874. "Atilde;": "\u00C3",
  6875. "Atilde": "\u00C3",
  6876. "atilde;": "\u00E3",
  6877. "atilde": "\u00E3",
  6878. "Auml;": "\u00C4",
  6879. "Auml": "\u00C4",
  6880. "auml;": "\u00E4",
  6881. "auml": "\u00E4",
  6882. "awconint;": "\u2233",
  6883. "awint;": "\u2A11",
  6884. "backcong;": "\u224C",
  6885. "backepsilon;": "\u03F6",
  6886. "backprime;": "\u2035",
  6887. "backsim;": "\u223D",
  6888. "backsimeq;": "\u22CD",
  6889. "Backslash;": "\u2216",
  6890. "Barv;": "\u2AE7",
  6891. "barvee;": "\u22BD",
  6892. "barwed;": "\u2305",
  6893. "Barwed;": "\u2306",
  6894. "barwedge;": "\u2305",
  6895. "bbrk;": "\u23B5",
  6896. "bbrktbrk;": "\u23B6",
  6897. "bcong;": "\u224C",
  6898. "Bcy;": "\u0411",
  6899. "bcy;": "\u0431",
  6900. "bdquo;": "\u201E",
  6901. "becaus;": "\u2235",
  6902. "because;": "\u2235",
  6903. "Because;": "\u2235",
  6904. "bemptyv;": "\u29B0",
  6905. "bepsi;": "\u03F6",
  6906. "bernou;": "\u212C",
  6907. "Bernoullis;": "\u212C",
  6908. "Beta;": "\u0392",
  6909. "beta;": "\u03B2",
  6910. "beth;": "\u2136",
  6911. "between;": "\u226C",
  6912. "Bfr;": "\uD835\uDD05",
  6913. "bfr;": "\uD835\uDD1F",
  6914. "bigcap;": "\u22C2",
  6915. "bigcirc;": "\u25EF",
  6916. "bigcup;": "\u22C3",
  6917. "bigodot;": "\u2A00",
  6918. "bigoplus;": "\u2A01",
  6919. "bigotimes;": "\u2A02",
  6920. "bigsqcup;": "\u2A06",
  6921. "bigstar;": "\u2605",
  6922. "bigtriangledown;": "\u25BD",
  6923. "bigtriangleup;": "\u25B3",
  6924. "biguplus;": "\u2A04",
  6925. "bigvee;": "\u22C1",
  6926. "bigwedge;": "\u22C0",
  6927. "bkarow;": "\u290D",
  6928. "blacklozenge;": "\u29EB",
  6929. "blacksquare;": "\u25AA",
  6930. "blacktriangle;": "\u25B4",
  6931. "blacktriangledown;": "\u25BE",
  6932. "blacktriangleleft;": "\u25C2",
  6933. "blacktriangleright;": "\u25B8",
  6934. "blank;": "\u2423",
  6935. "blk12;": "\u2592",
  6936. "blk14;": "\u2591",
  6937. "blk34;": "\u2593",
  6938. "block;": "\u2588",
  6939. "bne;": "\u003D\u20E5",
  6940. "bnequiv;": "\u2261\u20E5",
  6941. "bNot;": "\u2AED",
  6942. "bnot;": "\u2310",
  6943. "Bopf;": "\uD835\uDD39",
  6944. "bopf;": "\uD835\uDD53",
  6945. "bot;": "\u22A5",
  6946. "bottom;": "\u22A5",
  6947. "bowtie;": "\u22C8",
  6948. "boxbox;": "\u29C9",
  6949. "boxdl;": "\u2510",
  6950. "boxdL;": "\u2555",
  6951. "boxDl;": "\u2556",
  6952. "boxDL;": "\u2557",
  6953. "boxdr;": "\u250C",
  6954. "boxdR;": "\u2552",
  6955. "boxDr;": "\u2553",
  6956. "boxDR;": "\u2554",
  6957. "boxh;": "\u2500",
  6958. "boxH;": "\u2550",
  6959. "boxhd;": "\u252C",
  6960. "boxHd;": "\u2564",
  6961. "boxhD;": "\u2565",
  6962. "boxHD;": "\u2566",
  6963. "boxhu;": "\u2534",
  6964. "boxHu;": "\u2567",
  6965. "boxhU;": "\u2568",
  6966. "boxHU;": "\u2569",
  6967. "boxminus;": "\u229F",
  6968. "boxplus;": "\u229E",
  6969. "boxtimes;": "\u22A0",
  6970. "boxul;": "\u2518",
  6971. "boxuL;": "\u255B",
  6972. "boxUl;": "\u255C",
  6973. "boxUL;": "\u255D",
  6974. "boxur;": "\u2514",
  6975. "boxuR;": "\u2558",
  6976. "boxUr;": "\u2559",
  6977. "boxUR;": "\u255A",
  6978. "boxv;": "\u2502",
  6979. "boxV;": "\u2551",
  6980. "boxvh;": "\u253C",
  6981. "boxvH;": "\u256A",
  6982. "boxVh;": "\u256B",
  6983. "boxVH;": "\u256C",
  6984. "boxvl;": "\u2524",
  6985. "boxvL;": "\u2561",
  6986. "boxVl;": "\u2562",
  6987. "boxVL;": "\u2563",
  6988. "boxvr;": "\u251C",
  6989. "boxvR;": "\u255E",
  6990. "boxVr;": "\u255F",
  6991. "boxVR;": "\u2560",
  6992. "bprime;": "\u2035",
  6993. "breve;": "\u02D8",
  6994. "Breve;": "\u02D8",
  6995. "brvbar;": "\u00A6",
  6996. "brvbar": "\u00A6",
  6997. "bscr;": "\uD835\uDCB7",
  6998. "Bscr;": "\u212C",
  6999. "bsemi;": "\u204F",
  7000. "bsim;": "\u223D",
  7001. "bsime;": "\u22CD",
  7002. "bsolb;": "\u29C5",
  7003. "bsol;": "\u005C",
  7004. "bsolhsub;": "\u27C8",
  7005. "bull;": "\u2022",
  7006. "bullet;": "\u2022",
  7007. "bump;": "\u224E",
  7008. "bumpE;": "\u2AAE",
  7009. "bumpe;": "\u224F",
  7010. "Bumpeq;": "\u224E",
  7011. "bumpeq;": "\u224F",
  7012. "Cacute;": "\u0106",
  7013. "cacute;": "\u0107",
  7014. "capand;": "\u2A44",
  7015. "capbrcup;": "\u2A49",
  7016. "capcap;": "\u2A4B",
  7017. "cap;": "\u2229",
  7018. "Cap;": "\u22D2",
  7019. "capcup;": "\u2A47",
  7020. "capdot;": "\u2A40",
  7021. "CapitalDifferentialD;": "\u2145",
  7022. "caps;": "\u2229\uFE00",
  7023. "caret;": "\u2041",
  7024. "caron;": "\u02C7",
  7025. "Cayleys;": "\u212D",
  7026. "ccaps;": "\u2A4D",
  7027. "Ccaron;": "\u010C",
  7028. "ccaron;": "\u010D",
  7029. "Ccedil;": "\u00C7",
  7030. "Ccedil": "\u00C7",
  7031. "ccedil;": "\u00E7",
  7032. "ccedil": "\u00E7",
  7033. "Ccirc;": "\u0108",
  7034. "ccirc;": "\u0109",
  7035. "Cconint;": "\u2230",
  7036. "ccups;": "\u2A4C",
  7037. "ccupssm;": "\u2A50",
  7038. "Cdot;": "\u010A",
  7039. "cdot;": "\u010B",
  7040. "cedil;": "\u00B8",
  7041. "cedil": "\u00B8",
  7042. "Cedilla;": "\u00B8",
  7043. "cemptyv;": "\u29B2",
  7044. "cent;": "\u00A2",
  7045. "cent": "\u00A2",
  7046. "centerdot;": "\u00B7",
  7047. "CenterDot;": "\u00B7",
  7048. "cfr;": "\uD835\uDD20",
  7049. "Cfr;": "\u212D",
  7050. "CHcy;": "\u0427",
  7051. "chcy;": "\u0447",
  7052. "check;": "\u2713",
  7053. "checkmark;": "\u2713",
  7054. "Chi;": "\u03A7",
  7055. "chi;": "\u03C7",
  7056. "circ;": "\u02C6",
  7057. "circeq;": "\u2257",
  7058. "circlearrowleft;": "\u21BA",
  7059. "circlearrowright;": "\u21BB",
  7060. "circledast;": "\u229B",
  7061. "circledcirc;": "\u229A",
  7062. "circleddash;": "\u229D",
  7063. "CircleDot;": "\u2299",
  7064. "circledR;": "\u00AE",
  7065. "circledS;": "\u24C8",
  7066. "CircleMinus;": "\u2296",
  7067. "CirclePlus;": "\u2295",
  7068. "CircleTimes;": "\u2297",
  7069. "cir;": "\u25CB",
  7070. "cirE;": "\u29C3",
  7071. "cire;": "\u2257",
  7072. "cirfnint;": "\u2A10",
  7073. "cirmid;": "\u2AEF",
  7074. "cirscir;": "\u29C2",
  7075. "ClockwiseContourIntegral;": "\u2232",
  7076. "CloseCurlyDoubleQuote;": "\u201D",
  7077. "CloseCurlyQuote;": "\u2019",
  7078. "clubs;": "\u2663",
  7079. "clubsuit;": "\u2663",
  7080. "colon;": "\u003A",
  7081. "Colon;": "\u2237",
  7082. "Colone;": "\u2A74",
  7083. "colone;": "\u2254",
  7084. "coloneq;": "\u2254",
  7085. "comma;": "\u002C",
  7086. "commat;": "\u0040",
  7087. "comp;": "\u2201",
  7088. "compfn;": "\u2218",
  7089. "complement;": "\u2201",
  7090. "complexes;": "\u2102",
  7091. "cong;": "\u2245",
  7092. "congdot;": "\u2A6D",
  7093. "Congruent;": "\u2261",
  7094. "conint;": "\u222E",
  7095. "Conint;": "\u222F",
  7096. "ContourIntegral;": "\u222E",
  7097. "copf;": "\uD835\uDD54",
  7098. "Copf;": "\u2102",
  7099. "coprod;": "\u2210",
  7100. "Coproduct;": "\u2210",
  7101. "copy;": "\u00A9",
  7102. "copy": "\u00A9",
  7103. "COPY;": "\u00A9",
  7104. "COPY": "\u00A9",
  7105. "copysr;": "\u2117",
  7106. "CounterClockwiseContourIntegral;": "\u2233",
  7107. "crarr;": "\u21B5",
  7108. "cross;": "\u2717",
  7109. "Cross;": "\u2A2F",
  7110. "Cscr;": "\uD835\uDC9E",
  7111. "cscr;": "\uD835\uDCB8",
  7112. "csub;": "\u2ACF",
  7113. "csube;": "\u2AD1",
  7114. "csup;": "\u2AD0",
  7115. "csupe;": "\u2AD2",
  7116. "ctdot;": "\u22EF",
  7117. "cudarrl;": "\u2938",
  7118. "cudarrr;": "\u2935",
  7119. "cuepr;": "\u22DE",
  7120. "cuesc;": "\u22DF",
  7121. "cularr;": "\u21B6",
  7122. "cularrp;": "\u293D",
  7123. "cupbrcap;": "\u2A48",
  7124. "cupcap;": "\u2A46",
  7125. "CupCap;": "\u224D",
  7126. "cup;": "\u222A",
  7127. "Cup;": "\u22D3",
  7128. "cupcup;": "\u2A4A",
  7129. "cupdot;": "\u228D",
  7130. "cupor;": "\u2A45",
  7131. "cups;": "\u222A\uFE00",
  7132. "curarr;": "\u21B7",
  7133. "curarrm;": "\u293C",
  7134. "curlyeqprec;": "\u22DE",
  7135. "curlyeqsucc;": "\u22DF",
  7136. "curlyvee;": "\u22CE",
  7137. "curlywedge;": "\u22CF",
  7138. "curren;": "\u00A4",
  7139. "curren": "\u00A4",
  7140. "curvearrowleft;": "\u21B6",
  7141. "curvearrowright;": "\u21B7",
  7142. "cuvee;": "\u22CE",
  7143. "cuwed;": "\u22CF",
  7144. "cwconint;": "\u2232",
  7145. "cwint;": "\u2231",
  7146. "cylcty;": "\u232D",
  7147. "dagger;": "\u2020",
  7148. "Dagger;": "\u2021",
  7149. "daleth;": "\u2138",
  7150. "darr;": "\u2193",
  7151. "Darr;": "\u21A1",
  7152. "dArr;": "\u21D3",
  7153. "dash;": "\u2010",
  7154. "Dashv;": "\u2AE4",
  7155. "dashv;": "\u22A3",
  7156. "dbkarow;": "\u290F",
  7157. "dblac;": "\u02DD",
  7158. "Dcaron;": "\u010E",
  7159. "dcaron;": "\u010F",
  7160. "Dcy;": "\u0414",
  7161. "dcy;": "\u0434",
  7162. "ddagger;": "\u2021",
  7163. "ddarr;": "\u21CA",
  7164. "DD;": "\u2145",
  7165. "dd;": "\u2146",
  7166. "DDotrahd;": "\u2911",
  7167. "ddotseq;": "\u2A77",
  7168. "deg;": "\u00B0",
  7169. "deg": "\u00B0",
  7170. "Del;": "\u2207",
  7171. "Delta;": "\u0394",
  7172. "delta;": "\u03B4",
  7173. "demptyv;": "\u29B1",
  7174. "dfisht;": "\u297F",
  7175. "Dfr;": "\uD835\uDD07",
  7176. "dfr;": "\uD835\uDD21",
  7177. "dHar;": "\u2965",
  7178. "dharl;": "\u21C3",
  7179. "dharr;": "\u21C2",
  7180. "DiacriticalAcute;": "\u00B4",
  7181. "DiacriticalDot;": "\u02D9",
  7182. "DiacriticalDoubleAcute;": "\u02DD",
  7183. "DiacriticalGrave;": "\u0060",
  7184. "DiacriticalTilde;": "\u02DC",
  7185. "diam;": "\u22C4",
  7186. "diamond;": "\u22C4",
  7187. "Diamond;": "\u22C4",
  7188. "diamondsuit;": "\u2666",
  7189. "diams;": "\u2666",
  7190. "die;": "\u00A8",
  7191. "DifferentialD;": "\u2146",
  7192. "digamma;": "\u03DD",
  7193. "disin;": "\u22F2",
  7194. "div;": "\u00F7",
  7195. "divide;": "\u00F7",
  7196. "divide": "\u00F7",
  7197. "divideontimes;": "\u22C7",
  7198. "divonx;": "\u22C7",
  7199. "DJcy;": "\u0402",
  7200. "djcy;": "\u0452",
  7201. "dlcorn;": "\u231E",
  7202. "dlcrop;": "\u230D",
  7203. "dollar;": "\u0024",
  7204. "Dopf;": "\uD835\uDD3B",
  7205. "dopf;": "\uD835\uDD55",
  7206. "Dot;": "\u00A8",
  7207. "dot;": "\u02D9",
  7208. "DotDot;": "\u20DC",
  7209. "doteq;": "\u2250",
  7210. "doteqdot;": "\u2251",
  7211. "DotEqual;": "\u2250",
  7212. "dotminus;": "\u2238",
  7213. "dotplus;": "\u2214",
  7214. "dotsquare;": "\u22A1",
  7215. "doublebarwedge;": "\u2306",
  7216. "DoubleContourIntegral;": "\u222F",
  7217. "DoubleDot;": "\u00A8",
  7218. "DoubleDownArrow;": "\u21D3",
  7219. "DoubleLeftArrow;": "\u21D0",
  7220. "DoubleLeftRightArrow;": "\u21D4",
  7221. "DoubleLeftTee;": "\u2AE4",
  7222. "DoubleLongLeftArrow;": "\u27F8",
  7223. "DoubleLongLeftRightArrow;": "\u27FA",
  7224. "DoubleLongRightArrow;": "\u27F9",
  7225. "DoubleRightArrow;": "\u21D2",
  7226. "DoubleRightTee;": "\u22A8",
  7227. "DoubleUpArrow;": "\u21D1",
  7228. "DoubleUpDownArrow;": "\u21D5",
  7229. "DoubleVerticalBar;": "\u2225",
  7230. "DownArrowBar;": "\u2913",
  7231. "downarrow;": "\u2193",
  7232. "DownArrow;": "\u2193",
  7233. "Downarrow;": "\u21D3",
  7234. "DownArrowUpArrow;": "\u21F5",
  7235. "DownBreve;": "\u0311",
  7236. "downdownarrows;": "\u21CA",
  7237. "downharpoonleft;": "\u21C3",
  7238. "downharpoonright;": "\u21C2",
  7239. "DownLeftRightVector;": "\u2950",
  7240. "DownLeftTeeVector;": "\u295E",
  7241. "DownLeftVectorBar;": "\u2956",
  7242. "DownLeftVector;": "\u21BD",
  7243. "DownRightTeeVector;": "\u295F",
  7244. "DownRightVectorBar;": "\u2957",
  7245. "DownRightVector;": "\u21C1",
  7246. "DownTeeArrow;": "\u21A7",
  7247. "DownTee;": "\u22A4",
  7248. "drbkarow;": "\u2910",
  7249. "drcorn;": "\u231F",
  7250. "drcrop;": "\u230C",
  7251. "Dscr;": "\uD835\uDC9F",
  7252. "dscr;": "\uD835\uDCB9",
  7253. "DScy;": "\u0405",
  7254. "dscy;": "\u0455",
  7255. "dsol;": "\u29F6",
  7256. "Dstrok;": "\u0110",
  7257. "dstrok;": "\u0111",
  7258. "dtdot;": "\u22F1",
  7259. "dtri;": "\u25BF",
  7260. "dtrif;": "\u25BE",
  7261. "duarr;": "\u21F5",
  7262. "duhar;": "\u296F",
  7263. "dwangle;": "\u29A6",
  7264. "DZcy;": "\u040F",
  7265. "dzcy;": "\u045F",
  7266. "dzigrarr;": "\u27FF",
  7267. "Eacute;": "\u00C9",
  7268. "Eacute": "\u00C9",
  7269. "eacute;": "\u00E9",
  7270. "eacute": "\u00E9",
  7271. "easter;": "\u2A6E",
  7272. "Ecaron;": "\u011A",
  7273. "ecaron;": "\u011B",
  7274. "Ecirc;": "\u00CA",
  7275. "Ecirc": "\u00CA",
  7276. "ecirc;": "\u00EA",
  7277. "ecirc": "\u00EA",
  7278. "ecir;": "\u2256",
  7279. "ecolon;": "\u2255",
  7280. "Ecy;": "\u042D",
  7281. "ecy;": "\u044D",
  7282. "eDDot;": "\u2A77",
  7283. "Edot;": "\u0116",
  7284. "edot;": "\u0117",
  7285. "eDot;": "\u2251",
  7286. "ee;": "\u2147",
  7287. "efDot;": "\u2252",
  7288. "Efr;": "\uD835\uDD08",
  7289. "efr;": "\uD835\uDD22",
  7290. "eg;": "\u2A9A",
  7291. "Egrave;": "\u00C8",
  7292. "Egrave": "\u00C8",
  7293. "egrave;": "\u00E8",
  7294. "egrave": "\u00E8",
  7295. "egs;": "\u2A96",
  7296. "egsdot;": "\u2A98",
  7297. "el;": "\u2A99",
  7298. "Element;": "\u2208",
  7299. "elinters;": "\u23E7",
  7300. "ell;": "\u2113",
  7301. "els;": "\u2A95",
  7302. "elsdot;": "\u2A97",
  7303. "Emacr;": "\u0112",
  7304. "emacr;": "\u0113",
  7305. "empty;": "\u2205",
  7306. "emptyset;": "\u2205",
  7307. "EmptySmallSquare;": "\u25FB",
  7308. "emptyv;": "\u2205",
  7309. "EmptyVerySmallSquare;": "\u25AB",
  7310. "emsp13;": "\u2004",
  7311. "emsp14;": "\u2005",
  7312. "emsp;": "\u2003",
  7313. "ENG;": "\u014A",
  7314. "eng;": "\u014B",
  7315. "ensp;": "\u2002",
  7316. "Eogon;": "\u0118",
  7317. "eogon;": "\u0119",
  7318. "Eopf;": "\uD835\uDD3C",
  7319. "eopf;": "\uD835\uDD56",
  7320. "epar;": "\u22D5",
  7321. "eparsl;": "\u29E3",
  7322. "eplus;": "\u2A71",
  7323. "epsi;": "\u03B5",
  7324. "Epsilon;": "\u0395",
  7325. "epsilon;": "\u03B5",
  7326. "epsiv;": "\u03F5",
  7327. "eqcirc;": "\u2256",
  7328. "eqcolon;": "\u2255",
  7329. "eqsim;": "\u2242",
  7330. "eqslantgtr;": "\u2A96",
  7331. "eqslantless;": "\u2A95",
  7332. "Equal;": "\u2A75",
  7333. "equals;": "\u003D",
  7334. "EqualTilde;": "\u2242",
  7335. "equest;": "\u225F",
  7336. "Equilibrium;": "\u21CC",
  7337. "equiv;": "\u2261",
  7338. "equivDD;": "\u2A78",
  7339. "eqvparsl;": "\u29E5",
  7340. "erarr;": "\u2971",
  7341. "erDot;": "\u2253",
  7342. "escr;": "\u212F",
  7343. "Escr;": "\u2130",
  7344. "esdot;": "\u2250",
  7345. "Esim;": "\u2A73",
  7346. "esim;": "\u2242",
  7347. "Eta;": "\u0397",
  7348. "eta;": "\u03B7",
  7349. "ETH;": "\u00D0",
  7350. "ETH": "\u00D0",
  7351. "eth;": "\u00F0",
  7352. "eth": "\u00F0",
  7353. "Euml;": "\u00CB",
  7354. "Euml": "\u00CB",
  7355. "euml;": "\u00EB",
  7356. "euml": "\u00EB",
  7357. "euro;": "\u20AC",
  7358. "excl;": "\u0021",
  7359. "exist;": "\u2203",
  7360. "Exists;": "\u2203",
  7361. "expectation;": "\u2130",
  7362. "exponentiale;": "\u2147",
  7363. "ExponentialE;": "\u2147",
  7364. "fallingdotseq;": "\u2252",
  7365. "Fcy;": "\u0424",
  7366. "fcy;": "\u0444",
  7367. "female;": "\u2640",
  7368. "ffilig;": "\uFB03",
  7369. "fflig;": "\uFB00",
  7370. "ffllig;": "\uFB04",
  7371. "Ffr;": "\uD835\uDD09",
  7372. "ffr;": "\uD835\uDD23",
  7373. "filig;": "\uFB01",
  7374. "FilledSmallSquare;": "\u25FC",
  7375. "FilledVerySmallSquare;": "\u25AA",
  7376. "fjlig;": "\u0066\u006A",
  7377. "flat;": "\u266D",
  7378. "fllig;": "\uFB02",
  7379. "fltns;": "\u25B1",
  7380. "fnof;": "\u0192",
  7381. "Fopf;": "\uD835\uDD3D",
  7382. "fopf;": "\uD835\uDD57",
  7383. "forall;": "\u2200",
  7384. "ForAll;": "\u2200",
  7385. "fork;": "\u22D4",
  7386. "forkv;": "\u2AD9",
  7387. "Fouriertrf;": "\u2131",
  7388. "fpartint;": "\u2A0D",
  7389. "frac12;": "\u00BD",
  7390. "frac12": "\u00BD",
  7391. "frac13;": "\u2153",
  7392. "frac14;": "\u00BC",
  7393. "frac14": "\u00BC",
  7394. "frac15;": "\u2155",
  7395. "frac16;": "\u2159",
  7396. "frac18;": "\u215B",
  7397. "frac23;": "\u2154",
  7398. "frac25;": "\u2156",
  7399. "frac34;": "\u00BE",
  7400. "frac34": "\u00BE",
  7401. "frac35;": "\u2157",
  7402. "frac38;": "\u215C",
  7403. "frac45;": "\u2158",
  7404. "frac56;": "\u215A",
  7405. "frac58;": "\u215D",
  7406. "frac78;": "\u215E",
  7407. "frasl;": "\u2044",
  7408. "frown;": "\u2322",
  7409. "fscr;": "\uD835\uDCBB",
  7410. "Fscr;": "\u2131",
  7411. "gacute;": "\u01F5",
  7412. "Gamma;": "\u0393",
  7413. "gamma;": "\u03B3",
  7414. "Gammad;": "\u03DC",
  7415. "gammad;": "\u03DD",
  7416. "gap;": "\u2A86",
  7417. "Gbreve;": "\u011E",
  7418. "gbreve;": "\u011F",
  7419. "Gcedil;": "\u0122",
  7420. "Gcirc;": "\u011C",
  7421. "gcirc;": "\u011D",
  7422. "Gcy;": "\u0413",
  7423. "gcy;": "\u0433",
  7424. "Gdot;": "\u0120",
  7425. "gdot;": "\u0121",
  7426. "ge;": "\u2265",
  7427. "gE;": "\u2267",
  7428. "gEl;": "\u2A8C",
  7429. "gel;": "\u22DB",
  7430. "geq;": "\u2265",
  7431. "geqq;": "\u2267",
  7432. "geqslant;": "\u2A7E",
  7433. "gescc;": "\u2AA9",
  7434. "ges;": "\u2A7E",
  7435. "gesdot;": "\u2A80",
  7436. "gesdoto;": "\u2A82",
  7437. "gesdotol;": "\u2A84",
  7438. "gesl;": "\u22DB\uFE00",
  7439. "gesles;": "\u2A94",
  7440. "Gfr;": "\uD835\uDD0A",
  7441. "gfr;": "\uD835\uDD24",
  7442. "gg;": "\u226B",
  7443. "Gg;": "\u22D9",
  7444. "ggg;": "\u22D9",
  7445. "gimel;": "\u2137",
  7446. "GJcy;": "\u0403",
  7447. "gjcy;": "\u0453",
  7448. "gla;": "\u2AA5",
  7449. "gl;": "\u2277",
  7450. "glE;": "\u2A92",
  7451. "glj;": "\u2AA4",
  7452. "gnap;": "\u2A8A",
  7453. "gnapprox;": "\u2A8A",
  7454. "gne;": "\u2A88",
  7455. "gnE;": "\u2269",
  7456. "gneq;": "\u2A88",
  7457. "gneqq;": "\u2269",
  7458. "gnsim;": "\u22E7",
  7459. "Gopf;": "\uD835\uDD3E",
  7460. "gopf;": "\uD835\uDD58",
  7461. "grave;": "\u0060",
  7462. "GreaterEqual;": "\u2265",
  7463. "GreaterEqualLess;": "\u22DB",
  7464. "GreaterFullEqual;": "\u2267",
  7465. "GreaterGreater;": "\u2AA2",
  7466. "GreaterLess;": "\u2277",
  7467. "GreaterSlantEqual;": "\u2A7E",
  7468. "GreaterTilde;": "\u2273",
  7469. "Gscr;": "\uD835\uDCA2",
  7470. "gscr;": "\u210A",
  7471. "gsim;": "\u2273",
  7472. "gsime;": "\u2A8E",
  7473. "gsiml;": "\u2A90",
  7474. "gtcc;": "\u2AA7",
  7475. "gtcir;": "\u2A7A",
  7476. "gt;": "\u003E",
  7477. "gt": "\u003E",
  7478. "GT;": "\u003E",
  7479. "GT": "\u003E",
  7480. "Gt;": "\u226B",
  7481. "gtdot;": "\u22D7",
  7482. "gtlPar;": "\u2995",
  7483. "gtquest;": "\u2A7C",
  7484. "gtrapprox;": "\u2A86",
  7485. "gtrarr;": "\u2978",
  7486. "gtrdot;": "\u22D7",
  7487. "gtreqless;": "\u22DB",
  7488. "gtreqqless;": "\u2A8C",
  7489. "gtrless;": "\u2277",
  7490. "gtrsim;": "\u2273",
  7491. "gvertneqq;": "\u2269\uFE00",
  7492. "gvnE;": "\u2269\uFE00",
  7493. "Hacek;": "\u02C7",
  7494. "hairsp;": "\u200A",
  7495. "half;": "\u00BD",
  7496. "hamilt;": "\u210B",
  7497. "HARDcy;": "\u042A",
  7498. "hardcy;": "\u044A",
  7499. "harrcir;": "\u2948",
  7500. "harr;": "\u2194",
  7501. "hArr;": "\u21D4",
  7502. "harrw;": "\u21AD",
  7503. "Hat;": "\u005E",
  7504. "hbar;": "\u210F",
  7505. "Hcirc;": "\u0124",
  7506. "hcirc;": "\u0125",
  7507. "hearts;": "\u2665",
  7508. "heartsuit;": "\u2665",
  7509. "hellip;": "\u2026",
  7510. "hercon;": "\u22B9",
  7511. "hfr;": "\uD835\uDD25",
  7512. "Hfr;": "\u210C",
  7513. "HilbertSpace;": "\u210B",
  7514. "hksearow;": "\u2925",
  7515. "hkswarow;": "\u2926",
  7516. "hoarr;": "\u21FF",
  7517. "homtht;": "\u223B",
  7518. "hookleftarrow;": "\u21A9",
  7519. "hookrightarrow;": "\u21AA",
  7520. "hopf;": "\uD835\uDD59",
  7521. "Hopf;": "\u210D",
  7522. "horbar;": "\u2015",
  7523. "HorizontalLine;": "\u2500",
  7524. "hscr;": "\uD835\uDCBD",
  7525. "Hscr;": "\u210B",
  7526. "hslash;": "\u210F",
  7527. "Hstrok;": "\u0126",
  7528. "hstrok;": "\u0127",
  7529. "HumpDownHump;": "\u224E",
  7530. "HumpEqual;": "\u224F",
  7531. "hybull;": "\u2043",
  7532. "hyphen;": "\u2010",
  7533. "Iacute;": "\u00CD",
  7534. "Iacute": "\u00CD",
  7535. "iacute;": "\u00ED",
  7536. "iacute": "\u00ED",
  7537. "ic;": "\u2063",
  7538. "Icirc;": "\u00CE",
  7539. "Icirc": "\u00CE",
  7540. "icirc;": "\u00EE",
  7541. "icirc": "\u00EE",
  7542. "Icy;": "\u0418",
  7543. "icy;": "\u0438",
  7544. "Idot;": "\u0130",
  7545. "IEcy;": "\u0415",
  7546. "iecy;": "\u0435",
  7547. "iexcl;": "\u00A1",
  7548. "iexcl": "\u00A1",
  7549. "iff;": "\u21D4",
  7550. "ifr;": "\uD835\uDD26",
  7551. "Ifr;": "\u2111",
  7552. "Igrave;": "\u00CC",
  7553. "Igrave": "\u00CC",
  7554. "igrave;": "\u00EC",
  7555. "igrave": "\u00EC",
  7556. "ii;": "\u2148",
  7557. "iiiint;": "\u2A0C",
  7558. "iiint;": "\u222D",
  7559. "iinfin;": "\u29DC",
  7560. "iiota;": "\u2129",
  7561. "IJlig;": "\u0132",
  7562. "ijlig;": "\u0133",
  7563. "Imacr;": "\u012A",
  7564. "imacr;": "\u012B",
  7565. "image;": "\u2111",
  7566. "ImaginaryI;": "\u2148",
  7567. "imagline;": "\u2110",
  7568. "imagpart;": "\u2111",
  7569. "imath;": "\u0131",
  7570. "Im;": "\u2111",
  7571. "imof;": "\u22B7",
  7572. "imped;": "\u01B5",
  7573. "Implies;": "\u21D2",
  7574. "incare;": "\u2105",
  7575. "in;": "\u2208",
  7576. "infin;": "\u221E",
  7577. "infintie;": "\u29DD",
  7578. "inodot;": "\u0131",
  7579. "intcal;": "\u22BA",
  7580. "int;": "\u222B",
  7581. "Int;": "\u222C",
  7582. "integers;": "\u2124",
  7583. "Integral;": "\u222B",
  7584. "intercal;": "\u22BA",
  7585. "Intersection;": "\u22C2",
  7586. "intlarhk;": "\u2A17",
  7587. "intprod;": "\u2A3C",
  7588. "InvisibleComma;": "\u2063",
  7589. "InvisibleTimes;": "\u2062",
  7590. "IOcy;": "\u0401",
  7591. "iocy;": "\u0451",
  7592. "Iogon;": "\u012E",
  7593. "iogon;": "\u012F",
  7594. "Iopf;": "\uD835\uDD40",
  7595. "iopf;": "\uD835\uDD5A",
  7596. "Iota;": "\u0399",
  7597. "iota;": "\u03B9",
  7598. "iprod;": "\u2A3C",
  7599. "iquest;": "\u00BF",
  7600. "iquest": "\u00BF",
  7601. "iscr;": "\uD835\uDCBE",
  7602. "Iscr;": "\u2110",
  7603. "isin;": "\u2208",
  7604. "isindot;": "\u22F5",
  7605. "isinE;": "\u22F9",
  7606. "isins;": "\u22F4",
  7607. "isinsv;": "\u22F3",
  7608. "isinv;": "\u2208",
  7609. "it;": "\u2062",
  7610. "Itilde;": "\u0128",
  7611. "itilde;": "\u0129",
  7612. "Iukcy;": "\u0406",
  7613. "iukcy;": "\u0456",
  7614. "Iuml;": "\u00CF",
  7615. "Iuml": "\u00CF",
  7616. "iuml;": "\u00EF",
  7617. "iuml": "\u00EF",
  7618. "Jcirc;": "\u0134",
  7619. "jcirc;": "\u0135",
  7620. "Jcy;": "\u0419",
  7621. "jcy;": "\u0439",
  7622. "Jfr;": "\uD835\uDD0D",
  7623. "jfr;": "\uD835\uDD27",
  7624. "jmath;": "\u0237",
  7625. "Jopf;": "\uD835\uDD41",
  7626. "jopf;": "\uD835\uDD5B",
  7627. "Jscr;": "\uD835\uDCA5",
  7628. "jscr;": "\uD835\uDCBF",
  7629. "Jsercy;": "\u0408",
  7630. "jsercy;": "\u0458",
  7631. "Jukcy;": "\u0404",
  7632. "jukcy;": "\u0454",
  7633. "Kappa;": "\u039A",
  7634. "kappa;": "\u03BA",
  7635. "kappav;": "\u03F0",
  7636. "Kcedil;": "\u0136",
  7637. "kcedil;": "\u0137",
  7638. "Kcy;": "\u041A",
  7639. "kcy;": "\u043A",
  7640. "Kfr;": "\uD835\uDD0E",
  7641. "kfr;": "\uD835\uDD28",
  7642. "kgreen;": "\u0138",
  7643. "KHcy;": "\u0425",
  7644. "khcy;": "\u0445",
  7645. "KJcy;": "\u040C",
  7646. "kjcy;": "\u045C",
  7647. "Kopf;": "\uD835\uDD42",
  7648. "kopf;": "\uD835\uDD5C",
  7649. "Kscr;": "\uD835\uDCA6",
  7650. "kscr;": "\uD835\uDCC0",
  7651. "lAarr;": "\u21DA",
  7652. "Lacute;": "\u0139",
  7653. "lacute;": "\u013A",
  7654. "laemptyv;": "\u29B4",
  7655. "lagran;": "\u2112",
  7656. "Lambda;": "\u039B",
  7657. "lambda;": "\u03BB",
  7658. "lang;": "\u27E8",
  7659. "Lang;": "\u27EA",
  7660. "langd;": "\u2991",
  7661. "langle;": "\u27E8",
  7662. "lap;": "\u2A85",
  7663. "Laplacetrf;": "\u2112",
  7664. "laquo;": "\u00AB",
  7665. "laquo": "\u00AB",
  7666. "larrb;": "\u21E4",
  7667. "larrbfs;": "\u291F",
  7668. "larr;": "\u2190",
  7669. "Larr;": "\u219E",
  7670. "lArr;": "\u21D0",
  7671. "larrfs;": "\u291D",
  7672. "larrhk;": "\u21A9",
  7673. "larrlp;": "\u21AB",
  7674. "larrpl;": "\u2939",
  7675. "larrsim;": "\u2973",
  7676. "larrtl;": "\u21A2",
  7677. "latail;": "\u2919",
  7678. "lAtail;": "\u291B",
  7679. "lat;": "\u2AAB",
  7680. "late;": "\u2AAD",
  7681. "lates;": "\u2AAD\uFE00",
  7682. "lbarr;": "\u290C",
  7683. "lBarr;": "\u290E",
  7684. "lbbrk;": "\u2772",
  7685. "lbrace;": "\u007B",
  7686. "lbrack;": "\u005B",
  7687. "lbrke;": "\u298B",
  7688. "lbrksld;": "\u298F",
  7689. "lbrkslu;": "\u298D",
  7690. "Lcaron;": "\u013D",
  7691. "lcaron;": "\u013E",
  7692. "Lcedil;": "\u013B",
  7693. "lcedil;": "\u013C",
  7694. "lceil;": "\u2308",
  7695. "lcub;": "\u007B",
  7696. "Lcy;": "\u041B",
  7697. "lcy;": "\u043B",
  7698. "ldca;": "\u2936",
  7699. "ldquo;": "\u201C",
  7700. "ldquor;": "\u201E",
  7701. "ldrdhar;": "\u2967",
  7702. "ldrushar;": "\u294B",
  7703. "ldsh;": "\u21B2",
  7704. "le;": "\u2264",
  7705. "lE;": "\u2266",
  7706. "LeftAngleBracket;": "\u27E8",
  7707. "LeftArrowBar;": "\u21E4",
  7708. "leftarrow;": "\u2190",
  7709. "LeftArrow;": "\u2190",
  7710. "Leftarrow;": "\u21D0",
  7711. "LeftArrowRightArrow;": "\u21C6",
  7712. "leftarrowtail;": "\u21A2",
  7713. "LeftCeiling;": "\u2308",
  7714. "LeftDoubleBracket;": "\u27E6",
  7715. "LeftDownTeeVector;": "\u2961",
  7716. "LeftDownVectorBar;": "\u2959",
  7717. "LeftDownVector;": "\u21C3",
  7718. "LeftFloor;": "\u230A",
  7719. "leftharpoondown;": "\u21BD",
  7720. "leftharpoonup;": "\u21BC",
  7721. "leftleftarrows;": "\u21C7",
  7722. "leftrightarrow;": "\u2194",
  7723. "LeftRightArrow;": "\u2194",
  7724. "Leftrightarrow;": "\u21D4",
  7725. "leftrightarrows;": "\u21C6",
  7726. "leftrightharpoons;": "\u21CB",
  7727. "leftrightsquigarrow;": "\u21AD",
  7728. "LeftRightVector;": "\u294E",
  7729. "LeftTeeArrow;": "\u21A4",
  7730. "LeftTee;": "\u22A3",
  7731. "LeftTeeVector;": "\u295A",
  7732. "leftthreetimes;": "\u22CB",
  7733. "LeftTriangleBar;": "\u29CF",
  7734. "LeftTriangle;": "\u22B2",
  7735. "LeftTriangleEqual;": "\u22B4",
  7736. "LeftUpDownVector;": "\u2951",
  7737. "LeftUpTeeVector;": "\u2960",
  7738. "LeftUpVectorBar;": "\u2958",
  7739. "LeftUpVector;": "\u21BF",
  7740. "LeftVectorBar;": "\u2952",
  7741. "LeftVector;": "\u21BC",
  7742. "lEg;": "\u2A8B",
  7743. "leg;": "\u22DA",
  7744. "leq;": "\u2264",
  7745. "leqq;": "\u2266",
  7746. "leqslant;": "\u2A7D",
  7747. "lescc;": "\u2AA8",
  7748. "les;": "\u2A7D",
  7749. "lesdot;": "\u2A7F",
  7750. "lesdoto;": "\u2A81",
  7751. "lesdotor;": "\u2A83",
  7752. "lesg;": "\u22DA\uFE00",
  7753. "lesges;": "\u2A93",
  7754. "lessapprox;": "\u2A85",
  7755. "lessdot;": "\u22D6",
  7756. "lesseqgtr;": "\u22DA",
  7757. "lesseqqgtr;": "\u2A8B",
  7758. "LessEqualGreater;": "\u22DA",
  7759. "LessFullEqual;": "\u2266",
  7760. "LessGreater;": "\u2276",
  7761. "lessgtr;": "\u2276",
  7762. "LessLess;": "\u2AA1",
  7763. "lesssim;": "\u2272",
  7764. "LessSlantEqual;": "\u2A7D",
  7765. "LessTilde;": "\u2272",
  7766. "lfisht;": "\u297C",
  7767. "lfloor;": "\u230A",
  7768. "Lfr;": "\uD835\uDD0F",
  7769. "lfr;": "\uD835\uDD29",
  7770. "lg;": "\u2276",
  7771. "lgE;": "\u2A91",
  7772. "lHar;": "\u2962",
  7773. "lhard;": "\u21BD",
  7774. "lharu;": "\u21BC",
  7775. "lharul;": "\u296A",
  7776. "lhblk;": "\u2584",
  7777. "LJcy;": "\u0409",
  7778. "ljcy;": "\u0459",
  7779. "llarr;": "\u21C7",
  7780. "ll;": "\u226A",
  7781. "Ll;": "\u22D8",
  7782. "llcorner;": "\u231E",
  7783. "Lleftarrow;": "\u21DA",
  7784. "llhard;": "\u296B",
  7785. "lltri;": "\u25FA",
  7786. "Lmidot;": "\u013F",
  7787. "lmidot;": "\u0140",
  7788. "lmoustache;": "\u23B0",
  7789. "lmoust;": "\u23B0",
  7790. "lnap;": "\u2A89",
  7791. "lnapprox;": "\u2A89",
  7792. "lne;": "\u2A87",
  7793. "lnE;": "\u2268",
  7794. "lneq;": "\u2A87",
  7795. "lneqq;": "\u2268",
  7796. "lnsim;": "\u22E6",
  7797. "loang;": "\u27EC",
  7798. "loarr;": "\u21FD",
  7799. "lobrk;": "\u27E6",
  7800. "longleftarrow;": "\u27F5",
  7801. "LongLeftArrow;": "\u27F5",
  7802. "Longleftarrow;": "\u27F8",
  7803. "longleftrightarrow;": "\u27F7",
  7804. "LongLeftRightArrow;": "\u27F7",
  7805. "Longleftrightarrow;": "\u27FA",
  7806. "longmapsto;": "\u27FC",
  7807. "longrightarrow;": "\u27F6",
  7808. "LongRightArrow;": "\u27F6",
  7809. "Longrightarrow;": "\u27F9",
  7810. "looparrowleft;": "\u21AB",
  7811. "looparrowright;": "\u21AC",
  7812. "lopar;": "\u2985",
  7813. "Lopf;": "\uD835\uDD43",
  7814. "lopf;": "\uD835\uDD5D",
  7815. "loplus;": "\u2A2D",
  7816. "lotimes;": "\u2A34",
  7817. "lowast;": "\u2217",
  7818. "lowbar;": "\u005F",
  7819. "LowerLeftArrow;": "\u2199",
  7820. "LowerRightArrow;": "\u2198",
  7821. "loz;": "\u25CA",
  7822. "lozenge;": "\u25CA",
  7823. "lozf;": "\u29EB",
  7824. "lpar;": "\u0028",
  7825. "lparlt;": "\u2993",
  7826. "lrarr;": "\u21C6",
  7827. "lrcorner;": "\u231F",
  7828. "lrhar;": "\u21CB",
  7829. "lrhard;": "\u296D",
  7830. "lrm;": "\u200E",
  7831. "lrtri;": "\u22BF",
  7832. "lsaquo;": "\u2039",
  7833. "lscr;": "\uD835\uDCC1",
  7834. "Lscr;": "\u2112",
  7835. "lsh;": "\u21B0",
  7836. "Lsh;": "\u21B0",
  7837. "lsim;": "\u2272",
  7838. "lsime;": "\u2A8D",
  7839. "lsimg;": "\u2A8F",
  7840. "lsqb;": "\u005B",
  7841. "lsquo;": "\u2018",
  7842. "lsquor;": "\u201A",
  7843. "Lstrok;": "\u0141",
  7844. "lstrok;": "\u0142",
  7845. "ltcc;": "\u2AA6",
  7846. "ltcir;": "\u2A79",
  7847. "lt;": "\u003C",
  7848. "lt": "\u003C",
  7849. "LT;": "\u003C",
  7850. "LT": "\u003C",
  7851. "Lt;": "\u226A",
  7852. "ltdot;": "\u22D6",
  7853. "lthree;": "\u22CB",
  7854. "ltimes;": "\u22C9",
  7855. "ltlarr;": "\u2976",
  7856. "ltquest;": "\u2A7B",
  7857. "ltri;": "\u25C3",
  7858. "ltrie;": "\u22B4",
  7859. "ltrif;": "\u25C2",
  7860. "ltrPar;": "\u2996",
  7861. "lurdshar;": "\u294A",
  7862. "luruhar;": "\u2966",
  7863. "lvertneqq;": "\u2268\uFE00",
  7864. "lvnE;": "\u2268\uFE00",
  7865. "macr;": "\u00AF",
  7866. "macr": "\u00AF",
  7867. "male;": "\u2642",
  7868. "malt;": "\u2720",
  7869. "maltese;": "\u2720",
  7870. "Map;": "\u2905",
  7871. "map;": "\u21A6",
  7872. "mapsto;": "\u21A6",
  7873. "mapstodown;": "\u21A7",
  7874. "mapstoleft;": "\u21A4",
  7875. "mapstoup;": "\u21A5",
  7876. "marker;": "\u25AE",
  7877. "mcomma;": "\u2A29",
  7878. "Mcy;": "\u041C",
  7879. "mcy;": "\u043C",
  7880. "mdash;": "\u2014",
  7881. "mDDot;": "\u223A",
  7882. "measuredangle;": "\u2221",
  7883. "MediumSpace;": "\u205F",
  7884. "Mellintrf;": "\u2133",
  7885. "Mfr;": "\uD835\uDD10",
  7886. "mfr;": "\uD835\uDD2A",
  7887. "mho;": "\u2127",
  7888. "micro;": "\u00B5",
  7889. "micro": "\u00B5",
  7890. "midast;": "\u002A",
  7891. "midcir;": "\u2AF0",
  7892. "mid;": "\u2223",
  7893. "middot;": "\u00B7",
  7894. "middot": "\u00B7",
  7895. "minusb;": "\u229F",
  7896. "minus;": "\u2212",
  7897. "minusd;": "\u2238",
  7898. "minusdu;": "\u2A2A",
  7899. "MinusPlus;": "\u2213",
  7900. "mlcp;": "\u2ADB",
  7901. "mldr;": "\u2026",
  7902. "mnplus;": "\u2213",
  7903. "models;": "\u22A7",
  7904. "Mopf;": "\uD835\uDD44",
  7905. "mopf;": "\uD835\uDD5E",
  7906. "mp;": "\u2213",
  7907. "mscr;": "\uD835\uDCC2",
  7908. "Mscr;": "\u2133",
  7909. "mstpos;": "\u223E",
  7910. "Mu;": "\u039C",
  7911. "mu;": "\u03BC",
  7912. "multimap;": "\u22B8",
  7913. "mumap;": "\u22B8",
  7914. "nabla;": "\u2207",
  7915. "Nacute;": "\u0143",
  7916. "nacute;": "\u0144",
  7917. "nang;": "\u2220\u20D2",
  7918. "nap;": "\u2249",
  7919. "napE;": "\u2A70\u0338",
  7920. "napid;": "\u224B\u0338",
  7921. "napos;": "\u0149",
  7922. "napprox;": "\u2249",
  7923. "natural;": "\u266E",
  7924. "naturals;": "\u2115",
  7925. "natur;": "\u266E",
  7926. "nbsp;": "\u00A0",
  7927. "nbsp": "\u00A0",
  7928. "nbump;": "\u224E\u0338",
  7929. "nbumpe;": "\u224F\u0338",
  7930. "ncap;": "\u2A43",
  7931. "Ncaron;": "\u0147",
  7932. "ncaron;": "\u0148",
  7933. "Ncedil;": "\u0145",
  7934. "ncedil;": "\u0146",
  7935. "ncong;": "\u2247",
  7936. "ncongdot;": "\u2A6D\u0338",
  7937. "ncup;": "\u2A42",
  7938. "Ncy;": "\u041D",
  7939. "ncy;": "\u043D",
  7940. "ndash;": "\u2013",
  7941. "nearhk;": "\u2924",
  7942. "nearr;": "\u2197",
  7943. "neArr;": "\u21D7",
  7944. "nearrow;": "\u2197",
  7945. "ne;": "\u2260",
  7946. "nedot;": "\u2250\u0338",
  7947. "NegativeMediumSpace;": "\u200B",
  7948. "NegativeThickSpace;": "\u200B",
  7949. "NegativeThinSpace;": "\u200B",
  7950. "NegativeVeryThinSpace;": "\u200B",
  7951. "nequiv;": "\u2262",
  7952. "nesear;": "\u2928",
  7953. "nesim;": "\u2242\u0338",
  7954. "NestedGreaterGreater;": "\u226B",
  7955. "NestedLessLess;": "\u226A",
  7956. "NewLine;": "\u000A",
  7957. "nexist;": "\u2204",
  7958. "nexists;": "\u2204",
  7959. "Nfr;": "\uD835\uDD11",
  7960. "nfr;": "\uD835\uDD2B",
  7961. "ngE;": "\u2267\u0338",
  7962. "nge;": "\u2271",
  7963. "ngeq;": "\u2271",
  7964. "ngeqq;": "\u2267\u0338",
  7965. "ngeqslant;": "\u2A7E\u0338",
  7966. "nges;": "\u2A7E\u0338",
  7967. "nGg;": "\u22D9\u0338",
  7968. "ngsim;": "\u2275",
  7969. "nGt;": "\u226B\u20D2",
  7970. "ngt;": "\u226F",
  7971. "ngtr;": "\u226F",
  7972. "nGtv;": "\u226B\u0338",
  7973. "nharr;": "\u21AE",
  7974. "nhArr;": "\u21CE",
  7975. "nhpar;": "\u2AF2",
  7976. "ni;": "\u220B",
  7977. "nis;": "\u22FC",
  7978. "nisd;": "\u22FA",
  7979. "niv;": "\u220B",
  7980. "NJcy;": "\u040A",
  7981. "njcy;": "\u045A",
  7982. "nlarr;": "\u219A",
  7983. "nlArr;": "\u21CD",
  7984. "nldr;": "\u2025",
  7985. "nlE;": "\u2266\u0338",
  7986. "nle;": "\u2270",
  7987. "nleftarrow;": "\u219A",
  7988. "nLeftarrow;": "\u21CD",
  7989. "nleftrightarrow;": "\u21AE",
  7990. "nLeftrightarrow;": "\u21CE",
  7991. "nleq;": "\u2270",
  7992. "nleqq;": "\u2266\u0338",
  7993. "nleqslant;": "\u2A7D\u0338",
  7994. "nles;": "\u2A7D\u0338",
  7995. "nless;": "\u226E",
  7996. "nLl;": "\u22D8\u0338",
  7997. "nlsim;": "\u2274",
  7998. "nLt;": "\u226A\u20D2",
  7999. "nlt;": "\u226E",
  8000. "nltri;": "\u22EA",
  8001. "nltrie;": "\u22EC",
  8002. "nLtv;": "\u226A\u0338",
  8003. "nmid;": "\u2224",
  8004. "NoBreak;": "\u2060",
  8005. "NonBreakingSpace;": "\u00A0",
  8006. "nopf;": "\uD835\uDD5F",
  8007. "Nopf;": "\u2115",
  8008. "Not;": "\u2AEC",
  8009. "not;": "\u00AC",
  8010. "not": "\u00AC",
  8011. "NotCongruent;": "\u2262",
  8012. "NotCupCap;": "\u226D",
  8013. "NotDoubleVerticalBar;": "\u2226",
  8014. "NotElement;": "\u2209",
  8015. "NotEqual;": "\u2260",
  8016. "NotEqualTilde;": "\u2242\u0338",
  8017. "NotExists;": "\u2204",
  8018. "NotGreater;": "\u226F",
  8019. "NotGreaterEqual;": "\u2271",
  8020. "NotGreaterFullEqual;": "\u2267\u0338",
  8021. "NotGreaterGreater;": "\u226B\u0338",
  8022. "NotGreaterLess;": "\u2279",
  8023. "NotGreaterSlantEqual;": "\u2A7E\u0338",
  8024. "NotGreaterTilde;": "\u2275",
  8025. "NotHumpDownHump;": "\u224E\u0338",
  8026. "NotHumpEqual;": "\u224F\u0338",
  8027. "notin;": "\u2209",
  8028. "notindot;": "\u22F5\u0338",
  8029. "notinE;": "\u22F9\u0338",
  8030. "notinva;": "\u2209",
  8031. "notinvb;": "\u22F7",
  8032. "notinvc;": "\u22F6",
  8033. "NotLeftTriangleBar;": "\u29CF\u0338",
  8034. "NotLeftTriangle;": "\u22EA",
  8035. "NotLeftTriangleEqual;": "\u22EC",
  8036. "NotLess;": "\u226E",
  8037. "NotLessEqual;": "\u2270",
  8038. "NotLessGreater;": "\u2278",
  8039. "NotLessLess;": "\u226A\u0338",
  8040. "NotLessSlantEqual;": "\u2A7D\u0338",
  8041. "NotLessTilde;": "\u2274",
  8042. "NotNestedGreaterGreater;": "\u2AA2\u0338",
  8043. "NotNestedLessLess;": "\u2AA1\u0338",
  8044. "notni;": "\u220C",
  8045. "notniva;": "\u220C",
  8046. "notnivb;": "\u22FE",
  8047. "notnivc;": "\u22FD",
  8048. "NotPrecedes;": "\u2280",
  8049. "NotPrecedesEqual;": "\u2AAF\u0338",
  8050. "NotPrecedesSlantEqual;": "\u22E0",
  8051. "NotReverseElement;": "\u220C",
  8052. "NotRightTriangleBar;": "\u29D0\u0338",
  8053. "NotRightTriangle;": "\u22EB",
  8054. "NotRightTriangleEqual;": "\u22ED",
  8055. "NotSquareSubset;": "\u228F\u0338",
  8056. "NotSquareSubsetEqual;": "\u22E2",
  8057. "NotSquareSuperset;": "\u2290\u0338",
  8058. "NotSquareSupersetEqual;": "\u22E3",
  8059. "NotSubset;": "\u2282\u20D2",
  8060. "NotSubsetEqual;": "\u2288",
  8061. "NotSucceeds;": "\u2281",
  8062. "NotSucceedsEqual;": "\u2AB0\u0338",
  8063. "NotSucceedsSlantEqual;": "\u22E1",
  8064. "NotSucceedsTilde;": "\u227F\u0338",
  8065. "NotSuperset;": "\u2283\u20D2",
  8066. "NotSupersetEqual;": "\u2289",
  8067. "NotTilde;": "\u2241",
  8068. "NotTildeEqual;": "\u2244",
  8069. "NotTildeFullEqual;": "\u2247",
  8070. "NotTildeTilde;": "\u2249",
  8071. "NotVerticalBar;": "\u2224",
  8072. "nparallel;": "\u2226",
  8073. "npar;": "\u2226",
  8074. "nparsl;": "\u2AFD\u20E5",
  8075. "npart;": "\u2202\u0338",
  8076. "npolint;": "\u2A14",
  8077. "npr;": "\u2280",
  8078. "nprcue;": "\u22E0",
  8079. "nprec;": "\u2280",
  8080. "npreceq;": "\u2AAF\u0338",
  8081. "npre;": "\u2AAF\u0338",
  8082. "nrarrc;": "\u2933\u0338",
  8083. "nrarr;": "\u219B",
  8084. "nrArr;": "\u21CF",
  8085. "nrarrw;": "\u219D\u0338",
  8086. "nrightarrow;": "\u219B",
  8087. "nRightarrow;": "\u21CF",
  8088. "nrtri;": "\u22EB",
  8089. "nrtrie;": "\u22ED",
  8090. "nsc;": "\u2281",
  8091. "nsccue;": "\u22E1",
  8092. "nsce;": "\u2AB0\u0338",
  8093. "Nscr;": "\uD835\uDCA9",
  8094. "nscr;": "\uD835\uDCC3",
  8095. "nshortmid;": "\u2224",
  8096. "nshortparallel;": "\u2226",
  8097. "nsim;": "\u2241",
  8098. "nsime;": "\u2244",
  8099. "nsimeq;": "\u2244",
  8100. "nsmid;": "\u2224",
  8101. "nspar;": "\u2226",
  8102. "nsqsube;": "\u22E2",
  8103. "nsqsupe;": "\u22E3",
  8104. "nsub;": "\u2284",
  8105. "nsubE;": "\u2AC5\u0338",
  8106. "nsube;": "\u2288",
  8107. "nsubset;": "\u2282\u20D2",
  8108. "nsubseteq;": "\u2288",
  8109. "nsubseteqq;": "\u2AC5\u0338",
  8110. "nsucc;": "\u2281",
  8111. "nsucceq;": "\u2AB0\u0338",
  8112. "nsup;": "\u2285",
  8113. "nsupE;": "\u2AC6\u0338",
  8114. "nsupe;": "\u2289",
  8115. "nsupset;": "\u2283\u20D2",
  8116. "nsupseteq;": "\u2289",
  8117. "nsupseteqq;": "\u2AC6\u0338",
  8118. "ntgl;": "\u2279",
  8119. "Ntilde;": "\u00D1",
  8120. "Ntilde": "\u00D1",
  8121. "ntilde;": "\u00F1",
  8122. "ntilde": "\u00F1",
  8123. "ntlg;": "\u2278",
  8124. "ntriangleleft;": "\u22EA",
  8125. "ntrianglelefteq;": "\u22EC",
  8126. "ntriangleright;": "\u22EB",
  8127. "ntrianglerighteq;": "\u22ED",
  8128. "Nu;": "\u039D",
  8129. "nu;": "\u03BD",
  8130. "num;": "\u0023",
  8131. "numero;": "\u2116",
  8132. "numsp;": "\u2007",
  8133. "nvap;": "\u224D\u20D2",
  8134. "nvdash;": "\u22AC",
  8135. "nvDash;": "\u22AD",
  8136. "nVdash;": "\u22AE",
  8137. "nVDash;": "\u22AF",
  8138. "nvge;": "\u2265\u20D2",
  8139. "nvgt;": "\u003E\u20D2",
  8140. "nvHarr;": "\u2904",
  8141. "nvinfin;": "\u29DE",
  8142. "nvlArr;": "\u2902",
  8143. "nvle;": "\u2264\u20D2",
  8144. "nvlt;": "\u003C\u20D2",
  8145. "nvltrie;": "\u22B4\u20D2",
  8146. "nvrArr;": "\u2903",
  8147. "nvrtrie;": "\u22B5\u20D2",
  8148. "nvsim;": "\u223C\u20D2",
  8149. "nwarhk;": "\u2923",
  8150. "nwarr;": "\u2196",
  8151. "nwArr;": "\u21D6",
  8152. "nwarrow;": "\u2196",
  8153. "nwnear;": "\u2927",
  8154. "Oacute;": "\u00D3",
  8155. "Oacute": "\u00D3",
  8156. "oacute;": "\u00F3",
  8157. "oacute": "\u00F3",
  8158. "oast;": "\u229B",
  8159. "Ocirc;": "\u00D4",
  8160. "Ocirc": "\u00D4",
  8161. "ocirc;": "\u00F4",
  8162. "ocirc": "\u00F4",
  8163. "ocir;": "\u229A",
  8164. "Ocy;": "\u041E",
  8165. "ocy;": "\u043E",
  8166. "odash;": "\u229D",
  8167. "Odblac;": "\u0150",
  8168. "odblac;": "\u0151",
  8169. "odiv;": "\u2A38",
  8170. "odot;": "\u2299",
  8171. "odsold;": "\u29BC",
  8172. "OElig;": "\u0152",
  8173. "oelig;": "\u0153",
  8174. "ofcir;": "\u29BF",
  8175. "Ofr;": "\uD835\uDD12",
  8176. "ofr;": "\uD835\uDD2C",
  8177. "ogon;": "\u02DB",
  8178. "Ograve;": "\u00D2",
  8179. "Ograve": "\u00D2",
  8180. "ograve;": "\u00F2",
  8181. "ograve": "\u00F2",
  8182. "ogt;": "\u29C1",
  8183. "ohbar;": "\u29B5",
  8184. "ohm;": "\u03A9",
  8185. "oint;": "\u222E",
  8186. "olarr;": "\u21BA",
  8187. "olcir;": "\u29BE",
  8188. "olcross;": "\u29BB",
  8189. "oline;": "\u203E",
  8190. "olt;": "\u29C0",
  8191. "Omacr;": "\u014C",
  8192. "omacr;": "\u014D",
  8193. "Omega;": "\u03A9",
  8194. "omega;": "\u03C9",
  8195. "Omicron;": "\u039F",
  8196. "omicron;": "\u03BF",
  8197. "omid;": "\u29B6",
  8198. "ominus;": "\u2296",
  8199. "Oopf;": "\uD835\uDD46",
  8200. "oopf;": "\uD835\uDD60",
  8201. "opar;": "\u29B7",
  8202. "OpenCurlyDoubleQuote;": "\u201C",
  8203. "OpenCurlyQuote;": "\u2018",
  8204. "operp;": "\u29B9",
  8205. "oplus;": "\u2295",
  8206. "orarr;": "\u21BB",
  8207. "Or;": "\u2A54",
  8208. "or;": "\u2228",
  8209. "ord;": "\u2A5D",
  8210. "order;": "\u2134",
  8211. "orderof;": "\u2134",
  8212. "ordf;": "\u00AA",
  8213. "ordf": "\u00AA",
  8214. "ordm;": "\u00BA",
  8215. "ordm": "\u00BA",
  8216. "origof;": "\u22B6",
  8217. "oror;": "\u2A56",
  8218. "orslope;": "\u2A57",
  8219. "orv;": "\u2A5B",
  8220. "oS;": "\u24C8",
  8221. "Oscr;": "\uD835\uDCAA",
  8222. "oscr;": "\u2134",
  8223. "Oslash;": "\u00D8",
  8224. "Oslash": "\u00D8",
  8225. "oslash;": "\u00F8",
  8226. "oslash": "\u00F8",
  8227. "osol;": "\u2298",
  8228. "Otilde;": "\u00D5",
  8229. "Otilde": "\u00D5",
  8230. "otilde;": "\u00F5",
  8231. "otilde": "\u00F5",
  8232. "otimesas;": "\u2A36",
  8233. "Otimes;": "\u2A37",
  8234. "otimes;": "\u2297",
  8235. "Ouml;": "\u00D6",
  8236. "Ouml": "\u00D6",
  8237. "ouml;": "\u00F6",
  8238. "ouml": "\u00F6",
  8239. "ovbar;": "\u233D",
  8240. "OverBar;": "\u203E",
  8241. "OverBrace;": "\u23DE",
  8242. "OverBracket;": "\u23B4",
  8243. "OverParenthesis;": "\u23DC",
  8244. "para;": "\u00B6",
  8245. "para": "\u00B6",
  8246. "parallel;": "\u2225",
  8247. "par;": "\u2225",
  8248. "parsim;": "\u2AF3",
  8249. "parsl;": "\u2AFD",
  8250. "part;": "\u2202",
  8251. "PartialD;": "\u2202",
  8252. "Pcy;": "\u041F",
  8253. "pcy;": "\u043F",
  8254. "percnt;": "\u0025",
  8255. "period;": "\u002E",
  8256. "permil;": "\u2030",
  8257. "perp;": "\u22A5",
  8258. "pertenk;": "\u2031",
  8259. "Pfr;": "\uD835\uDD13",
  8260. "pfr;": "\uD835\uDD2D",
  8261. "Phi;": "\u03A6",
  8262. "phi;": "\u03C6",
  8263. "phiv;": "\u03D5",
  8264. "phmmat;": "\u2133",
  8265. "phone;": "\u260E",
  8266. "Pi;": "\u03A0",
  8267. "pi;": "\u03C0",
  8268. "pitchfork;": "\u22D4",
  8269. "piv;": "\u03D6",
  8270. "planck;": "\u210F",
  8271. "planckh;": "\u210E",
  8272. "plankv;": "\u210F",
  8273. "plusacir;": "\u2A23",
  8274. "plusb;": "\u229E",
  8275. "pluscir;": "\u2A22",
  8276. "plus;": "\u002B",
  8277. "plusdo;": "\u2214",
  8278. "plusdu;": "\u2A25",
  8279. "pluse;": "\u2A72",
  8280. "PlusMinus;": "\u00B1",
  8281. "plusmn;": "\u00B1",
  8282. "plusmn": "\u00B1",
  8283. "plussim;": "\u2A26",
  8284. "plustwo;": "\u2A27",
  8285. "pm;": "\u00B1",
  8286. "Poincareplane;": "\u210C",
  8287. "pointint;": "\u2A15",
  8288. "popf;": "\uD835\uDD61",
  8289. "Popf;": "\u2119",
  8290. "pound;": "\u00A3",
  8291. "pound": "\u00A3",
  8292. "prap;": "\u2AB7",
  8293. "Pr;": "\u2ABB",
  8294. "pr;": "\u227A",
  8295. "prcue;": "\u227C",
  8296. "precapprox;": "\u2AB7",
  8297. "prec;": "\u227A",
  8298. "preccurlyeq;": "\u227C",
  8299. "Precedes;": "\u227A",
  8300. "PrecedesEqual;": "\u2AAF",
  8301. "PrecedesSlantEqual;": "\u227C",
  8302. "PrecedesTilde;": "\u227E",
  8303. "preceq;": "\u2AAF",
  8304. "precnapprox;": "\u2AB9",
  8305. "precneqq;": "\u2AB5",
  8306. "precnsim;": "\u22E8",
  8307. "pre;": "\u2AAF",
  8308. "prE;": "\u2AB3",
  8309. "precsim;": "\u227E",
  8310. "prime;": "\u2032",
  8311. "Prime;": "\u2033",
  8312. "primes;": "\u2119",
  8313. "prnap;": "\u2AB9",
  8314. "prnE;": "\u2AB5",
  8315. "prnsim;": "\u22E8",
  8316. "prod;": "\u220F",
  8317. "Product;": "\u220F",
  8318. "profalar;": "\u232E",
  8319. "profline;": "\u2312",
  8320. "profsurf;": "\u2313",
  8321. "prop;": "\u221D",
  8322. "Proportional;": "\u221D",
  8323. "Proportion;": "\u2237",
  8324. "propto;": "\u221D",
  8325. "prsim;": "\u227E",
  8326. "prurel;": "\u22B0",
  8327. "Pscr;": "\uD835\uDCAB",
  8328. "pscr;": "\uD835\uDCC5",
  8329. "Psi;": "\u03A8",
  8330. "psi;": "\u03C8",
  8331. "puncsp;": "\u2008",
  8332. "Qfr;": "\uD835\uDD14",
  8333. "qfr;": "\uD835\uDD2E",
  8334. "qint;": "\u2A0C",
  8335. "qopf;": "\uD835\uDD62",
  8336. "Qopf;": "\u211A",
  8337. "qprime;": "\u2057",
  8338. "Qscr;": "\uD835\uDCAC",
  8339. "qscr;": "\uD835\uDCC6",
  8340. "quaternions;": "\u210D",
  8341. "quatint;": "\u2A16",
  8342. "quest;": "\u003F",
  8343. "questeq;": "\u225F",
  8344. "quot;": "\u0022",
  8345. "quot": "\u0022",
  8346. "QUOT;": "\u0022",
  8347. "QUOT": "\u0022",
  8348. "rAarr;": "\u21DB",
  8349. "race;": "\u223D\u0331",
  8350. "Racute;": "\u0154",
  8351. "racute;": "\u0155",
  8352. "radic;": "\u221A",
  8353. "raemptyv;": "\u29B3",
  8354. "rang;": "\u27E9",
  8355. "Rang;": "\u27EB",
  8356. "rangd;": "\u2992",
  8357. "range;": "\u29A5",
  8358. "rangle;": "\u27E9",
  8359. "raquo;": "\u00BB",
  8360. "raquo": "\u00BB",
  8361. "rarrap;": "\u2975",
  8362. "rarrb;": "\u21E5",
  8363. "rarrbfs;": "\u2920",
  8364. "rarrc;": "\u2933",
  8365. "rarr;": "\u2192",
  8366. "Rarr;": "\u21A0",
  8367. "rArr;": "\u21D2",
  8368. "rarrfs;": "\u291E",
  8369. "rarrhk;": "\u21AA",
  8370. "rarrlp;": "\u21AC",
  8371. "rarrpl;": "\u2945",
  8372. "rarrsim;": "\u2974",
  8373. "Rarrtl;": "\u2916",
  8374. "rarrtl;": "\u21A3",
  8375. "rarrw;": "\u219D",
  8376. "ratail;": "\u291A",
  8377. "rAtail;": "\u291C",
  8378. "ratio;": "\u2236",
  8379. "rationals;": "\u211A",
  8380. "rbarr;": "\u290D",
  8381. "rBarr;": "\u290F",
  8382. "RBarr;": "\u2910",
  8383. "rbbrk;": "\u2773",
  8384. "rbrace;": "\u007D",
  8385. "rbrack;": "\u005D",
  8386. "rbrke;": "\u298C",
  8387. "rbrksld;": "\u298E",
  8388. "rbrkslu;": "\u2990",
  8389. "Rcaron;": "\u0158",
  8390. "rcaron;": "\u0159",
  8391. "Rcedil;": "\u0156",
  8392. "rcedil;": "\u0157",
  8393. "rceil;": "\u2309",
  8394. "rcub;": "\u007D",
  8395. "Rcy;": "\u0420",
  8396. "rcy;": "\u0440",
  8397. "rdca;": "\u2937",
  8398. "rdldhar;": "\u2969",
  8399. "rdquo;": "\u201D",
  8400. "rdquor;": "\u201D",
  8401. "rdsh;": "\u21B3",
  8402. "real;": "\u211C",
  8403. "realine;": "\u211B",
  8404. "realpart;": "\u211C",
  8405. "reals;": "\u211D",
  8406. "Re;": "\u211C",
  8407. "rect;": "\u25AD",
  8408. "reg;": "\u00AE",
  8409. "reg": "\u00AE",
  8410. "REG;": "\u00AE",
  8411. "REG": "\u00AE",
  8412. "ReverseElement;": "\u220B",
  8413. "ReverseEquilibrium;": "\u21CB",
  8414. "ReverseUpEquilibrium;": "\u296F",
  8415. "rfisht;": "\u297D",
  8416. "rfloor;": "\u230B",
  8417. "rfr;": "\uD835\uDD2F",
  8418. "Rfr;": "\u211C",
  8419. "rHar;": "\u2964",
  8420. "rhard;": "\u21C1",
  8421. "rharu;": "\u21C0",
  8422. "rharul;": "\u296C",
  8423. "Rho;": "\u03A1",
  8424. "rho;": "\u03C1",
  8425. "rhov;": "\u03F1",
  8426. "RightAngleBracket;": "\u27E9",
  8427. "RightArrowBar;": "\u21E5",
  8428. "rightarrow;": "\u2192",
  8429. "RightArrow;": "\u2192",
  8430. "Rightarrow;": "\u21D2",
  8431. "RightArrowLeftArrow;": "\u21C4",
  8432. "rightarrowtail;": "\u21A3",
  8433. "RightCeiling;": "\u2309",
  8434. "RightDoubleBracket;": "\u27E7",
  8435. "RightDownTeeVector;": "\u295D",
  8436. "RightDownVectorBar;": "\u2955",
  8437. "RightDownVector;": "\u21C2",
  8438. "RightFloor;": "\u230B",
  8439. "rightharpoondown;": "\u21C1",
  8440. "rightharpoonup;": "\u21C0",
  8441. "rightleftarrows;": "\u21C4",
  8442. "rightleftharpoons;": "\u21CC",
  8443. "rightrightarrows;": "\u21C9",
  8444. "rightsquigarrow;": "\u219D",
  8445. "RightTeeArrow;": "\u21A6",
  8446. "RightTee;": "\u22A2",
  8447. "RightTeeVector;": "\u295B",
  8448. "rightthreetimes;": "\u22CC",
  8449. "RightTriangleBar;": "\u29D0",
  8450. "RightTriangle;": "\u22B3",
  8451. "RightTriangleEqual;": "\u22B5",
  8452. "RightUpDownVector;": "\u294F",
  8453. "RightUpTeeVector;": "\u295C",
  8454. "RightUpVectorBar;": "\u2954",
  8455. "RightUpVector;": "\u21BE",
  8456. "RightVectorBar;": "\u2953",
  8457. "RightVector;": "\u21C0",
  8458. "ring;": "\u02DA",
  8459. "risingdotseq;": "\u2253",
  8460. "rlarr;": "\u21C4",
  8461. "rlhar;": "\u21CC",
  8462. "rlm;": "\u200F",
  8463. "rmoustache;": "\u23B1",
  8464. "rmoust;": "\u23B1",
  8465. "rnmid;": "\u2AEE",
  8466. "roang;": "\u27ED",
  8467. "roarr;": "\u21FE",
  8468. "robrk;": "\u27E7",
  8469. "ropar;": "\u2986",
  8470. "ropf;": "\uD835\uDD63",
  8471. "Ropf;": "\u211D",
  8472. "roplus;": "\u2A2E",
  8473. "rotimes;": "\u2A35",
  8474. "RoundImplies;": "\u2970",
  8475. "rpar;": "\u0029",
  8476. "rpargt;": "\u2994",
  8477. "rppolint;": "\u2A12",
  8478. "rrarr;": "\u21C9",
  8479. "Rrightarrow;": "\u21DB",
  8480. "rsaquo;": "\u203A",
  8481. "rscr;": "\uD835\uDCC7",
  8482. "Rscr;": "\u211B",
  8483. "rsh;": "\u21B1",
  8484. "Rsh;": "\u21B1",
  8485. "rsqb;": "\u005D",
  8486. "rsquo;": "\u2019",
  8487. "rsquor;": "\u2019",
  8488. "rthree;": "\u22CC",
  8489. "rtimes;": "\u22CA",
  8490. "rtri;": "\u25B9",
  8491. "rtrie;": "\u22B5",
  8492. "rtrif;": "\u25B8",
  8493. "rtriltri;": "\u29CE",
  8494. "RuleDelayed;": "\u29F4",
  8495. "ruluhar;": "\u2968",
  8496. "rx;": "\u211E",
  8497. "Sacute;": "\u015A",
  8498. "sacute;": "\u015B",
  8499. "sbquo;": "\u201A",
  8500. "scap;": "\u2AB8",
  8501. "Scaron;": "\u0160",
  8502. "scaron;": "\u0161",
  8503. "Sc;": "\u2ABC",
  8504. "sc;": "\u227B",
  8505. "sccue;": "\u227D",
  8506. "sce;": "\u2AB0",
  8507. "scE;": "\u2AB4",
  8508. "Scedil;": "\u015E",
  8509. "scedil;": "\u015F",
  8510. "Scirc;": "\u015C",
  8511. "scirc;": "\u015D",
  8512. "scnap;": "\u2ABA",
  8513. "scnE;": "\u2AB6",
  8514. "scnsim;": "\u22E9",
  8515. "scpolint;": "\u2A13",
  8516. "scsim;": "\u227F",
  8517. "Scy;": "\u0421",
  8518. "scy;": "\u0441",
  8519. "sdotb;": "\u22A1",
  8520. "sdot;": "\u22C5",
  8521. "sdote;": "\u2A66",
  8522. "searhk;": "\u2925",
  8523. "searr;": "\u2198",
  8524. "seArr;": "\u21D8",
  8525. "searrow;": "\u2198",
  8526. "sect;": "\u00A7",
  8527. "sect": "\u00A7",
  8528. "semi;": "\u003B",
  8529. "seswar;": "\u2929",
  8530. "setminus;": "\u2216",
  8531. "setmn;": "\u2216",
  8532. "sext;": "\u2736",
  8533. "Sfr;": "\uD835\uDD16",
  8534. "sfr;": "\uD835\uDD30",
  8535. "sfrown;": "\u2322",
  8536. "sharp;": "\u266F",
  8537. "SHCHcy;": "\u0429",
  8538. "shchcy;": "\u0449",
  8539. "SHcy;": "\u0428",
  8540. "shcy;": "\u0448",
  8541. "ShortDownArrow;": "\u2193",
  8542. "ShortLeftArrow;": "\u2190",
  8543. "shortmid;": "\u2223",
  8544. "shortparallel;": "\u2225",
  8545. "ShortRightArrow;": "\u2192",
  8546. "ShortUpArrow;": "\u2191",
  8547. "shy;": "\u00AD",
  8548. "shy": "\u00AD",
  8549. "Sigma;": "\u03A3",
  8550. "sigma;": "\u03C3",
  8551. "sigmaf;": "\u03C2",
  8552. "sigmav;": "\u03C2",
  8553. "sim;": "\u223C",
  8554. "simdot;": "\u2A6A",
  8555. "sime;": "\u2243",
  8556. "simeq;": "\u2243",
  8557. "simg;": "\u2A9E",
  8558. "simgE;": "\u2AA0",
  8559. "siml;": "\u2A9D",
  8560. "simlE;": "\u2A9F",
  8561. "simne;": "\u2246",
  8562. "simplus;": "\u2A24",
  8563. "simrarr;": "\u2972",
  8564. "slarr;": "\u2190",
  8565. "SmallCircle;": "\u2218",
  8566. "smallsetminus;": "\u2216",
  8567. "smashp;": "\u2A33",
  8568. "smeparsl;": "\u29E4",
  8569. "smid;": "\u2223",
  8570. "smile;": "\u2323",
  8571. "smt;": "\u2AAA",
  8572. "smte;": "\u2AAC",
  8573. "smtes;": "\u2AAC\uFE00",
  8574. "SOFTcy;": "\u042C",
  8575. "softcy;": "\u044C",
  8576. "solbar;": "\u233F",
  8577. "solb;": "\u29C4",
  8578. "sol;": "\u002F",
  8579. "Sopf;": "\uD835\uDD4A",
  8580. "sopf;": "\uD835\uDD64",
  8581. "spades;": "\u2660",
  8582. "spadesuit;": "\u2660",
  8583. "spar;": "\u2225",
  8584. "sqcap;": "\u2293",
  8585. "sqcaps;": "\u2293\uFE00",
  8586. "sqcup;": "\u2294",
  8587. "sqcups;": "\u2294\uFE00",
  8588. "Sqrt;": "\u221A",
  8589. "sqsub;": "\u228F",
  8590. "sqsube;": "\u2291",
  8591. "sqsubset;": "\u228F",
  8592. "sqsubseteq;": "\u2291",
  8593. "sqsup;": "\u2290",
  8594. "sqsupe;": "\u2292",
  8595. "sqsupset;": "\u2290",
  8596. "sqsupseteq;": "\u2292",
  8597. "square;": "\u25A1",
  8598. "Square;": "\u25A1",
  8599. "SquareIntersection;": "\u2293",
  8600. "SquareSubset;": "\u228F",
  8601. "SquareSubsetEqual;": "\u2291",
  8602. "SquareSuperset;": "\u2290",
  8603. "SquareSupersetEqual;": "\u2292",
  8604. "SquareUnion;": "\u2294",
  8605. "squarf;": "\u25AA",
  8606. "squ;": "\u25A1",
  8607. "squf;": "\u25AA",
  8608. "srarr;": "\u2192",
  8609. "Sscr;": "\uD835\uDCAE",
  8610. "sscr;": "\uD835\uDCC8",
  8611. "ssetmn;": "\u2216",
  8612. "ssmile;": "\u2323",
  8613. "sstarf;": "\u22C6",
  8614. "Star;": "\u22C6",
  8615. "star;": "\u2606",
  8616. "starf;": "\u2605",
  8617. "straightepsilon;": "\u03F5",
  8618. "straightphi;": "\u03D5",
  8619. "strns;": "\u00AF",
  8620. "sub;": "\u2282",
  8621. "Sub;": "\u22D0",
  8622. "subdot;": "\u2ABD",
  8623. "subE;": "\u2AC5",
  8624. "sube;": "\u2286",
  8625. "subedot;": "\u2AC3",
  8626. "submult;": "\u2AC1",
  8627. "subnE;": "\u2ACB",
  8628. "subne;": "\u228A",
  8629. "subplus;": "\u2ABF",
  8630. "subrarr;": "\u2979",
  8631. "subset;": "\u2282",
  8632. "Subset;": "\u22D0",
  8633. "subseteq;": "\u2286",
  8634. "subseteqq;": "\u2AC5",
  8635. "SubsetEqual;": "\u2286",
  8636. "subsetneq;": "\u228A",
  8637. "subsetneqq;": "\u2ACB",
  8638. "subsim;": "\u2AC7",
  8639. "subsub;": "\u2AD5",
  8640. "subsup;": "\u2AD3",
  8641. "succapprox;": "\u2AB8",
  8642. "succ;": "\u227B",
  8643. "succcurlyeq;": "\u227D",
  8644. "Succeeds;": "\u227B",
  8645. "SucceedsEqual;": "\u2AB0",
  8646. "SucceedsSlantEqual;": "\u227D",
  8647. "SucceedsTilde;": "\u227F",
  8648. "succeq;": "\u2AB0",
  8649. "succnapprox;": "\u2ABA",
  8650. "succneqq;": "\u2AB6",
  8651. "succnsim;": "\u22E9",
  8652. "succsim;": "\u227F",
  8653. "SuchThat;": "\u220B",
  8654. "sum;": "\u2211",
  8655. "Sum;": "\u2211",
  8656. "sung;": "\u266A",
  8657. "sup1;": "\u00B9",
  8658. "sup1": "\u00B9",
  8659. "sup2;": "\u00B2",
  8660. "sup2": "\u00B2",
  8661. "sup3;": "\u00B3",
  8662. "sup3": "\u00B3",
  8663. "sup;": "\u2283",
  8664. "Sup;": "\u22D1",
  8665. "supdot;": "\u2ABE",
  8666. "supdsub;": "\u2AD8",
  8667. "supE;": "\u2AC6",
  8668. "supe;": "\u2287",
  8669. "supedot;": "\u2AC4",
  8670. "Superset;": "\u2283",
  8671. "SupersetEqual;": "\u2287",
  8672. "suphsol;": "\u27C9",
  8673. "suphsub;": "\u2AD7",
  8674. "suplarr;": "\u297B",
  8675. "supmult;": "\u2AC2",
  8676. "supnE;": "\u2ACC",
  8677. "supne;": "\u228B",
  8678. "supplus;": "\u2AC0",
  8679. "supset;": "\u2283",
  8680. "Supset;": "\u22D1",
  8681. "supseteq;": "\u2287",
  8682. "supseteqq;": "\u2AC6",
  8683. "supsetneq;": "\u228B",
  8684. "supsetneqq;": "\u2ACC",
  8685. "supsim;": "\u2AC8",
  8686. "supsub;": "\u2AD4",
  8687. "supsup;": "\u2AD6",
  8688. "swarhk;": "\u2926",
  8689. "swarr;": "\u2199",
  8690. "swArr;": "\u21D9",
  8691. "swarrow;": "\u2199",
  8692. "swnwar;": "\u292A",
  8693. "szlig;": "\u00DF",
  8694. "szlig": "\u00DF",
  8695. "Tab;": "\u0009",
  8696. "target;": "\u2316",
  8697. "Tau;": "\u03A4",
  8698. "tau;": "\u03C4",
  8699. "tbrk;": "\u23B4",
  8700. "Tcaron;": "\u0164",
  8701. "tcaron;": "\u0165",
  8702. "Tcedil;": "\u0162",
  8703. "tcedil;": "\u0163",
  8704. "Tcy;": "\u0422",
  8705. "tcy;": "\u0442",
  8706. "tdot;": "\u20DB",
  8707. "telrec;": "\u2315",
  8708. "Tfr;": "\uD835\uDD17",
  8709. "tfr;": "\uD835\uDD31",
  8710. "there4;": "\u2234",
  8711. "therefore;": "\u2234",
  8712. "Therefore;": "\u2234",
  8713. "Theta;": "\u0398",
  8714. "theta;": "\u03B8",
  8715. "thetasym;": "\u03D1",
  8716. "thetav;": "\u03D1",
  8717. "thickapprox;": "\u2248",
  8718. "thicksim;": "\u223C",
  8719. "ThickSpace;": "\u205F\u200A",
  8720. "ThinSpace;": "\u2009",
  8721. "thinsp;": "\u2009",
  8722. "thkap;": "\u2248",
  8723. "thksim;": "\u223C",
  8724. "THORN;": "\u00DE",
  8725. "THORN": "\u00DE",
  8726. "thorn;": "\u00FE",
  8727. "thorn": "\u00FE",
  8728. "tilde;": "\u02DC",
  8729. "Tilde;": "\u223C",
  8730. "TildeEqual;": "\u2243",
  8731. "TildeFullEqual;": "\u2245",
  8732. "TildeTilde;": "\u2248",
  8733. "timesbar;": "\u2A31",
  8734. "timesb;": "\u22A0",
  8735. "times;": "\u00D7",
  8736. "times": "\u00D7",
  8737. "timesd;": "\u2A30",
  8738. "tint;": "\u222D",
  8739. "toea;": "\u2928",
  8740. "topbot;": "\u2336",
  8741. "topcir;": "\u2AF1",
  8742. "top;": "\u22A4",
  8743. "Topf;": "\uD835\uDD4B",
  8744. "topf;": "\uD835\uDD65",
  8745. "topfork;": "\u2ADA",
  8746. "tosa;": "\u2929",
  8747. "tprime;": "\u2034",
  8748. "trade;": "\u2122",
  8749. "TRADE;": "\u2122",
  8750. "triangle;": "\u25B5",
  8751. "triangledown;": "\u25BF",
  8752. "triangleleft;": "\u25C3",
  8753. "trianglelefteq;": "\u22B4",
  8754. "triangleq;": "\u225C",
  8755. "triangleright;": "\u25B9",
  8756. "trianglerighteq;": "\u22B5",
  8757. "tridot;": "\u25EC",
  8758. "trie;": "\u225C",
  8759. "triminus;": "\u2A3A",
  8760. "TripleDot;": "\u20DB",
  8761. "triplus;": "\u2A39",
  8762. "trisb;": "\u29CD",
  8763. "tritime;": "\u2A3B",
  8764. "trpezium;": "\u23E2",
  8765. "Tscr;": "\uD835\uDCAF",
  8766. "tscr;": "\uD835\uDCC9",
  8767. "TScy;": "\u0426",
  8768. "tscy;": "\u0446",
  8769. "TSHcy;": "\u040B",
  8770. "tshcy;": "\u045B",
  8771. "Tstrok;": "\u0166",
  8772. "tstrok;": "\u0167",
  8773. "twixt;": "\u226C",
  8774. "twoheadleftarrow;": "\u219E",
  8775. "twoheadrightarrow;": "\u21A0",
  8776. "Uacute;": "\u00DA",
  8777. "Uacute": "\u00DA",
  8778. "uacute;": "\u00FA",
  8779. "uacute": "\u00FA",
  8780. "uarr;": "\u2191",
  8781. "Uarr;": "\u219F",
  8782. "uArr;": "\u21D1",
  8783. "Uarrocir;": "\u2949",
  8784. "Ubrcy;": "\u040E",
  8785. "ubrcy;": "\u045E",
  8786. "Ubreve;": "\u016C",
  8787. "ubreve;": "\u016D",
  8788. "Ucirc;": "\u00DB",
  8789. "Ucirc": "\u00DB",
  8790. "ucirc;": "\u00FB",
  8791. "ucirc": "\u00FB",
  8792. "Ucy;": "\u0423",
  8793. "ucy;": "\u0443",
  8794. "udarr;": "\u21C5",
  8795. "Udblac;": "\u0170",
  8796. "udblac;": "\u0171",
  8797. "udhar;": "\u296E",
  8798. "ufisht;": "\u297E",
  8799. "Ufr;": "\uD835\uDD18",
  8800. "ufr;": "\uD835\uDD32",
  8801. "Ugrave;": "\u00D9",
  8802. "Ugrave": "\u00D9",
  8803. "ugrave;": "\u00F9",
  8804. "ugrave": "\u00F9",
  8805. "uHar;": "\u2963",
  8806. "uharl;": "\u21BF",
  8807. "uharr;": "\u21BE",
  8808. "uhblk;": "\u2580",
  8809. "ulcorn;": "\u231C",
  8810. "ulcorner;": "\u231C",
  8811. "ulcrop;": "\u230F",
  8812. "ultri;": "\u25F8",
  8813. "Umacr;": "\u016A",
  8814. "umacr;": "\u016B",
  8815. "uml;": "\u00A8",
  8816. "uml": "\u00A8",
  8817. "UnderBar;": "\u005F",
  8818. "UnderBrace;": "\u23DF",
  8819. "UnderBracket;": "\u23B5",
  8820. "UnderParenthesis;": "\u23DD",
  8821. "Union;": "\u22C3",
  8822. "UnionPlus;": "\u228E",
  8823. "Uogon;": "\u0172",
  8824. "uogon;": "\u0173",
  8825. "Uopf;": "\uD835\uDD4C",
  8826. "uopf;": "\uD835\uDD66",
  8827. "UpArrowBar;": "\u2912",
  8828. "uparrow;": "\u2191",
  8829. "UpArrow;": "\u2191",
  8830. "Uparrow;": "\u21D1",
  8831. "UpArrowDownArrow;": "\u21C5",
  8832. "updownarrow;": "\u2195",
  8833. "UpDownArrow;": "\u2195",
  8834. "Updownarrow;": "\u21D5",
  8835. "UpEquilibrium;": "\u296E",
  8836. "upharpoonleft;": "\u21BF",
  8837. "upharpoonright;": "\u21BE",
  8838. "uplus;": "\u228E",
  8839. "UpperLeftArrow;": "\u2196",
  8840. "UpperRightArrow;": "\u2197",
  8841. "upsi;": "\u03C5",
  8842. "Upsi;": "\u03D2",
  8843. "upsih;": "\u03D2",
  8844. "Upsilon;": "\u03A5",
  8845. "upsilon;": "\u03C5",
  8846. "UpTeeArrow;": "\u21A5",
  8847. "UpTee;": "\u22A5",
  8848. "upuparrows;": "\u21C8",
  8849. "urcorn;": "\u231D",
  8850. "urcorner;": "\u231D",
  8851. "urcrop;": "\u230E",
  8852. "Uring;": "\u016E",
  8853. "uring;": "\u016F",
  8854. "urtri;": "\u25F9",
  8855. "Uscr;": "\uD835\uDCB0",
  8856. "uscr;": "\uD835\uDCCA",
  8857. "utdot;": "\u22F0",
  8858. "Utilde;": "\u0168",
  8859. "utilde;": "\u0169",
  8860. "utri;": "\u25B5",
  8861. "utrif;": "\u25B4",
  8862. "uuarr;": "\u21C8",
  8863. "Uuml;": "\u00DC",
  8864. "Uuml": "\u00DC",
  8865. "uuml;": "\u00FC",
  8866. "uuml": "\u00FC",
  8867. "uwangle;": "\u29A7",
  8868. "vangrt;": "\u299C",
  8869. "varepsilon;": "\u03F5",
  8870. "varkappa;": "\u03F0",
  8871. "varnothing;": "\u2205",
  8872. "varphi;": "\u03D5",
  8873. "varpi;": "\u03D6",
  8874. "varpropto;": "\u221D",
  8875. "varr;": "\u2195",
  8876. "vArr;": "\u21D5",
  8877. "varrho;": "\u03F1",
  8878. "varsigma;": "\u03C2",
  8879. "varsubsetneq;": "\u228A\uFE00",
  8880. "varsubsetneqq;": "\u2ACB\uFE00",
  8881. "varsupsetneq;": "\u228B\uFE00",
  8882. "varsupsetneqq;": "\u2ACC\uFE00",
  8883. "vartheta;": "\u03D1",
  8884. "vartriangleleft;": "\u22B2",
  8885. "vartriangleright;": "\u22B3",
  8886. "vBar;": "\u2AE8",
  8887. "Vbar;": "\u2AEB",
  8888. "vBarv;": "\u2AE9",
  8889. "Vcy;": "\u0412",
  8890. "vcy;": "\u0432",
  8891. "vdash;": "\u22A2",
  8892. "vDash;": "\u22A8",
  8893. "Vdash;": "\u22A9",
  8894. "VDash;": "\u22AB",
  8895. "Vdashl;": "\u2AE6",
  8896. "veebar;": "\u22BB",
  8897. "vee;": "\u2228",
  8898. "Vee;": "\u22C1",
  8899. "veeeq;": "\u225A",
  8900. "vellip;": "\u22EE",
  8901. "verbar;": "\u007C",
  8902. "Verbar;": "\u2016",
  8903. "vert;": "\u007C",
  8904. "Vert;": "\u2016",
  8905. "VerticalBar;": "\u2223",
  8906. "VerticalLine;": "\u007C",
  8907. "VerticalSeparator;": "\u2758",
  8908. "VerticalTilde;": "\u2240",
  8909. "VeryThinSpace;": "\u200A",
  8910. "Vfr;": "\uD835\uDD19",
  8911. "vfr;": "\uD835\uDD33",
  8912. "vltri;": "\u22B2",
  8913. "vnsub;": "\u2282\u20D2",
  8914. "vnsup;": "\u2283\u20D2",
  8915. "Vopf;": "\uD835\uDD4D",
  8916. "vopf;": "\uD835\uDD67",
  8917. "vprop;": "\u221D",
  8918. "vrtri;": "\u22B3",
  8919. "Vscr;": "\uD835\uDCB1",
  8920. "vscr;": "\uD835\uDCCB",
  8921. "vsubnE;": "\u2ACB\uFE00",
  8922. "vsubne;": "\u228A\uFE00",
  8923. "vsupnE;": "\u2ACC\uFE00",
  8924. "vsupne;": "\u228B\uFE00",
  8925. "Vvdash;": "\u22AA",
  8926. "vzigzag;": "\u299A",
  8927. "Wcirc;": "\u0174",
  8928. "wcirc;": "\u0175",
  8929. "wedbar;": "\u2A5F",
  8930. "wedge;": "\u2227",
  8931. "Wedge;": "\u22C0",
  8932. "wedgeq;": "\u2259",
  8933. "weierp;": "\u2118",
  8934. "Wfr;": "\uD835\uDD1A",
  8935. "wfr;": "\uD835\uDD34",
  8936. "Wopf;": "\uD835\uDD4E",
  8937. "wopf;": "\uD835\uDD68",
  8938. "wp;": "\u2118",
  8939. "wr;": "\u2240",
  8940. "wreath;": "\u2240",
  8941. "Wscr;": "\uD835\uDCB2",
  8942. "wscr;": "\uD835\uDCCC",
  8943. "xcap;": "\u22C2",
  8944. "xcirc;": "\u25EF",
  8945. "xcup;": "\u22C3",
  8946. "xdtri;": "\u25BD",
  8947. "Xfr;": "\uD835\uDD1B",
  8948. "xfr;": "\uD835\uDD35",
  8949. "xharr;": "\u27F7",
  8950. "xhArr;": "\u27FA",
  8951. "Xi;": "\u039E",
  8952. "xi;": "\u03BE",
  8953. "xlarr;": "\u27F5",
  8954. "xlArr;": "\u27F8",
  8955. "xmap;": "\u27FC",
  8956. "xnis;": "\u22FB",
  8957. "xodot;": "\u2A00",
  8958. "Xopf;": "\uD835\uDD4F",
  8959. "xopf;": "\uD835\uDD69",
  8960. "xoplus;": "\u2A01",
  8961. "xotime;": "\u2A02",
  8962. "xrarr;": "\u27F6",
  8963. "xrArr;": "\u27F9",
  8964. "Xscr;": "\uD835\uDCB3",
  8965. "xscr;": "\uD835\uDCCD",
  8966. "xsqcup;": "\u2A06",
  8967. "xuplus;": "\u2A04",
  8968. "xutri;": "\u25B3",
  8969. "xvee;": "\u22C1",
  8970. "xwedge;": "\u22C0",
  8971. "Yacute;": "\u00DD",
  8972. "Yacute": "\u00DD",
  8973. "yacute;": "\u00FD",
  8974. "yacute": "\u00FD",
  8975. "YAcy;": "\u042F",
  8976. "yacy;": "\u044F",
  8977. "Ycirc;": "\u0176",
  8978. "ycirc;": "\u0177",
  8979. "Ycy;": "\u042B",
  8980. "ycy;": "\u044B",
  8981. "yen;": "\u00A5",
  8982. "yen": "\u00A5",
  8983. "Yfr;": "\uD835\uDD1C",
  8984. "yfr;": "\uD835\uDD36",
  8985. "YIcy;": "\u0407",
  8986. "yicy;": "\u0457",
  8987. "Yopf;": "\uD835\uDD50",
  8988. "yopf;": "\uD835\uDD6A",
  8989. "Yscr;": "\uD835\uDCB4",
  8990. "yscr;": "\uD835\uDCCE",
  8991. "YUcy;": "\u042E",
  8992. "yucy;": "\u044E",
  8993. "yuml;": "\u00FF",
  8994. "yuml": "\u00FF",
  8995. "Yuml;": "\u0178",
  8996. "Zacute;": "\u0179",
  8997. "zacute;": "\u017A",
  8998. "Zcaron;": "\u017D",
  8999. "zcaron;": "\u017E",
  9000. "Zcy;": "\u0417",
  9001. "zcy;": "\u0437",
  9002. "Zdot;": "\u017B",
  9003. "zdot;": "\u017C",
  9004. "zeetrf;": "\u2128",
  9005. "ZeroWidthSpace;": "\u200B",
  9006. "Zeta;": "\u0396",
  9007. "zeta;": "\u03B6",
  9008. "zfr;": "\uD835\uDD37",
  9009. "Zfr;": "\u2128",
  9010. "ZHcy;": "\u0416",
  9011. "zhcy;": "\u0436",
  9012. "zigrarr;": "\u21DD",
  9013. "zopf;": "\uD835\uDD6B",
  9014. "Zopf;": "\u2124",
  9015. "Zscr;": "\uD835\uDCB5",
  9016. "zscr;": "\uD835\uDCCF",
  9017. "zwj;": "\u200D",
  9018. "zwnj;": "\u200C"
  9019. };
  9020. },
  9021. {}],
  9022. 13:[function(_dereq_,module,exports){
  9023. var util = _dereq_('util/');
  9024. var pSlice = Array.prototype.slice;
  9025. var hasOwn = Object.prototype.hasOwnProperty;
  9026. var assert = module.exports = ok;
  9027. assert.AssertionError = function AssertionError(options) {
  9028. this.name = 'AssertionError';
  9029. this.actual = options.actual;
  9030. this.expected = options.expected;
  9031. this.operator = options.operator;
  9032. if (options.message) {
  9033. this.message = options.message;
  9034. this.generatedMessage = false;
  9035. } else {
  9036. this.message = getMessage(this);
  9037. this.generatedMessage = true;
  9038. }
  9039. var stackStartFunction = options.stackStartFunction || fail;
  9040. if (Error.captureStackTrace) {
  9041. Error.captureStackTrace(this, stackStartFunction);
  9042. }
  9043. else {
  9044. var err = new Error();
  9045. if (err.stack) {
  9046. var out = err.stack;
  9047. var fn_name = stackStartFunction.name;
  9048. var idx = out.indexOf('\n' + fn_name);
  9049. if (idx >= 0) {
  9050. var next_line = out.indexOf('\n', idx + 1);
  9051. out = out.substring(next_line + 1);
  9052. }
  9053. this.stack = out;
  9054. }
  9055. }
  9056. };
  9057. util.inherits(assert.AssertionError, Error);
  9058. function replacer(key, value) {
  9059. if (util.isUndefined(value)) {
  9060. return '' + value;
  9061. }
  9062. if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) {
  9063. return value.toString();
  9064. }
  9065. if (util.isFunction(value) || util.isRegExp(value)) {
  9066. return value.toString();
  9067. }
  9068. return value;
  9069. }
  9070. function truncate(s, n) {
  9071. if (util.isString(s)) {
  9072. return s.length < n ? s : s.slice(0, n);
  9073. } else {
  9074. return s;
  9075. }
  9076. }
  9077. function getMessage(self) {
  9078. return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
  9079. self.operator + ' ' +
  9080. truncate(JSON.stringify(self.expected, replacer), 128);
  9081. }
  9082. function fail(actual, expected, message, operator, stackStartFunction) {
  9083. throw new assert.AssertionError({
  9084. message: message,
  9085. actual: actual,
  9086. expected: expected,
  9087. operator: operator,
  9088. stackStartFunction: stackStartFunction
  9089. });
  9090. }
  9091. assert.fail = fail;
  9092. function ok(value, message) {
  9093. if (!value) fail(value, true, message, '==', assert.ok);
  9094. }
  9095. assert.ok = ok;
  9096. assert.equal = function equal(actual, expected, message) {
  9097. if (actual != expected) fail(actual, expected, message, '==', assert.equal);
  9098. };
  9099. assert.notEqual = function notEqual(actual, expected, message) {
  9100. if (actual == expected) {
  9101. fail(actual, expected, message, '!=', assert.notEqual);
  9102. }
  9103. };
  9104. assert.deepEqual = function deepEqual(actual, expected, message) {
  9105. if (!_deepEqual(actual, expected)) {
  9106. fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  9107. }
  9108. };
  9109. function _deepEqual(actual, expected) {
  9110. if (actual === expected) {
  9111. return true;
  9112. } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
  9113. if (actual.length != expected.length) return false;
  9114. for (var i = 0; i < actual.length; i++) {
  9115. if (actual[i] !== expected[i]) return false;
  9116. }
  9117. return true;
  9118. } else if (util.isDate(actual) && util.isDate(expected)) {
  9119. return actual.getTime() === expected.getTime();
  9120. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  9121. return actual.source === expected.source &&
  9122. actual.global === expected.global &&
  9123. actual.multiline === expected.multiline &&
  9124. actual.lastIndex === expected.lastIndex &&
  9125. actual.ignoreCase === expected.ignoreCase;
  9126. } else if (!util.isObject(actual) && !util.isObject(expected)) {
  9127. return actual == expected;
  9128. } else {
  9129. return objEquiv(actual, expected);
  9130. }
  9131. }
  9132. function isArguments(object) {
  9133. return Object.prototype.toString.call(object) == '[object Arguments]';
  9134. }
  9135. function objEquiv(a, b) {
  9136. if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
  9137. return false;
  9138. if (a.prototype !== b.prototype) return false;
  9139. if (isArguments(a)) {
  9140. if (!isArguments(b)) {
  9141. return false;
  9142. }
  9143. a = pSlice.call(a);
  9144. b = pSlice.call(b);
  9145. return _deepEqual(a, b);
  9146. }
  9147. try {
  9148. var ka = objectKeys(a),
  9149. kb = objectKeys(b),
  9150. key, i;
  9151. } catch (e) {//happens when one is a string literal and the other isn't
  9152. return false;
  9153. }
  9154. if (ka.length != kb.length)
  9155. return false;
  9156. ka.sort();
  9157. kb.sort();
  9158. for (i = ka.length - 1; i >= 0; i--) {
  9159. if (ka[i] != kb[i])
  9160. return false;
  9161. }
  9162. for (i = ka.length - 1; i >= 0; i--) {
  9163. key = ka[i];
  9164. if (!_deepEqual(a[key], b[key])) return false;
  9165. }
  9166. return true;
  9167. }
  9168. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  9169. if (_deepEqual(actual, expected)) {
  9170. fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  9171. }
  9172. };
  9173. assert.strictEqual = function strictEqual(actual, expected, message) {
  9174. if (actual !== expected) {
  9175. fail(actual, expected, message, '===', assert.strictEqual);
  9176. }
  9177. };
  9178. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  9179. if (actual === expected) {
  9180. fail(actual, expected, message, '!==', assert.notStrictEqual);
  9181. }
  9182. };
  9183. function expectedException(actual, expected) {
  9184. if (!actual || !expected) {
  9185. return false;
  9186. }
  9187. if (Object.prototype.toString.call(expected) == '[object RegExp]') {
  9188. return expected.test(actual);
  9189. } else if (actual instanceof expected) {
  9190. return true;
  9191. } else if (expected.call({}, actual) === true) {
  9192. return true;
  9193. }
  9194. return false;
  9195. }
  9196. function _throws(shouldThrow, block, expected, message) {
  9197. var actual;
  9198. if (util.isString(expected)) {
  9199. message = expected;
  9200. expected = null;
  9201. }
  9202. try {
  9203. block();
  9204. } catch (e) {
  9205. actual = e;
  9206. }
  9207. message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
  9208. (message ? ' ' + message : '.');
  9209. if (shouldThrow && !actual) {
  9210. fail(actual, expected, 'Missing expected exception' + message);
  9211. }
  9212. if (!shouldThrow && expectedException(actual, expected)) {
  9213. fail(actual, expected, 'Got unwanted exception' + message);
  9214. }
  9215. if ((shouldThrow && actual && expected &&
  9216. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  9217. throw actual;
  9218. }
  9219. }
  9220. assert.throws = function(block, /*optional*/error, /*optional*/message) {
  9221. _throws.apply(this, [true].concat(pSlice.call(arguments)));
  9222. };
  9223. assert.doesNotThrow = function(block, /*optional*/message) {
  9224. _throws.apply(this, [false].concat(pSlice.call(arguments)));
  9225. };
  9226. assert.ifError = function(err) { if (err) {throw err;}};
  9227. var objectKeys = Object.keys || function (obj) {
  9228. var keys = [];
  9229. for (var key in obj) {
  9230. if (hasOwn.call(obj, key)) keys.push(key);
  9231. }
  9232. return keys;
  9233. };
  9234. },
  9235. {"util/":15}],
  9236. 14:[function(_dereq_,module,exports){
  9237. module.exports = function isBuffer(arg) {
  9238. return arg && typeof arg === 'object'
  9239. && typeof arg.copy === 'function'
  9240. && typeof arg.fill === 'function'
  9241. && typeof arg.readUInt8 === 'function';
  9242. }
  9243. },
  9244. {}],
  9245. 15:[function(_dereq_,module,exports){
  9246. (function (process,global){
  9247. var formatRegExp = /%[sdj%]/g;
  9248. exports.format = function(f) {
  9249. if (!isString(f)) {
  9250. var objects = [];
  9251. for (var i = 0; i < arguments.length; i++) {
  9252. objects.push(inspect(arguments[i]));
  9253. }
  9254. return objects.join(' ');
  9255. }
  9256. var i = 1;
  9257. var args = arguments;
  9258. var len = args.length;
  9259. var str = String(f).replace(formatRegExp, function(x) {
  9260. if (x === '%%') return '%';
  9261. if (i >= len) return x;
  9262. switch (x) {
  9263. case '%s': return String(args[i++]);
  9264. case '%d': return Number(args[i++]);
  9265. case '%j':
  9266. try {
  9267. return JSON.stringify(args[i++]);
  9268. } catch (_) {
  9269. return '[Circular]';
  9270. }
  9271. default:
  9272. return x;
  9273. }
  9274. });
  9275. for (var x = args[i]; i < len; x = args[++i]) {
  9276. if (isNull(x) || !isObject(x)) {
  9277. str += ' ' + x;
  9278. } else {
  9279. str += ' ' + inspect(x);
  9280. }
  9281. }
  9282. return str;
  9283. };
  9284. exports.deprecate = function(fn, msg) {
  9285. if (isUndefined(global.process)) {
  9286. return function() {
  9287. return exports.deprecate(fn, msg).apply(this, arguments);
  9288. };
  9289. }
  9290. if (process.noDeprecation === true) {
  9291. return fn;
  9292. }
  9293. var warned = false;
  9294. function deprecated() {
  9295. if (!warned) {
  9296. if (process.throwDeprecation) {
  9297. throw new Error(msg);
  9298. } else if (process.traceDeprecation) {
  9299. console.trace(msg);
  9300. } else {
  9301. console.error(msg);
  9302. }
  9303. warned = true;
  9304. }
  9305. return fn.apply(this, arguments);
  9306. }
  9307. return deprecated;
  9308. };
  9309. var debugs = {};
  9310. var debugEnviron;
  9311. exports.debuglog = function(set) {
  9312. if (isUndefined(debugEnviron))
  9313. debugEnviron = process.env.NODE_DEBUG || '';
  9314. set = set.toUpperCase();
  9315. if (!debugs[set]) {
  9316. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  9317. var pid = process.pid;
  9318. debugs[set] = function() {
  9319. var msg = exports.format.apply(exports, arguments);
  9320. console.error('%s %d: %s', set, pid, msg);
  9321. };
  9322. } else {
  9323. debugs[set] = function() {};
  9324. }
  9325. }
  9326. return debugs[set];
  9327. };
  9328. function inspect(obj, opts) {
  9329. var ctx = {
  9330. seen: [],
  9331. stylize: stylizeNoColor
  9332. };
  9333. if (arguments.length >= 3) ctx.depth = arguments[2];
  9334. if (arguments.length >= 4) ctx.colors = arguments[3];
  9335. if (isBoolean(opts)) {
  9336. ctx.showHidden = opts;
  9337. } else if (opts) {
  9338. exports._extend(ctx, opts);
  9339. }
  9340. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  9341. if (isUndefined(ctx.depth)) ctx.depth = 2;
  9342. if (isUndefined(ctx.colors)) ctx.colors = false;
  9343. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  9344. if (ctx.colors) ctx.stylize = stylizeWithColor;
  9345. return formatValue(ctx, obj, ctx.depth);
  9346. }
  9347. exports.inspect = inspect;
  9348. inspect.colors = {
  9349. 'bold' : [1, 22],
  9350. 'italic' : [3, 23],
  9351. 'underline' : [4, 24],
  9352. 'inverse' : [7, 27],
  9353. 'white' : [37, 39],
  9354. 'grey' : [90, 39],
  9355. 'black' : [30, 39],
  9356. 'blue' : [34, 39],
  9357. 'cyan' : [36, 39],
  9358. 'green' : [32, 39],
  9359. 'magenta' : [35, 39],
  9360. 'red' : [31, 39],
  9361. 'yellow' : [33, 39]
  9362. };
  9363. inspect.styles = {
  9364. 'special': 'cyan',
  9365. 'number': 'yellow',
  9366. 'boolean': 'yellow',
  9367. 'undefined': 'grey',
  9368. 'null': 'bold',
  9369. 'string': 'green',
  9370. 'date': 'magenta',
  9371. 'regexp': 'red'
  9372. };
  9373. function stylizeWithColor(str, styleType) {
  9374. var style = inspect.styles[styleType];
  9375. if (style) {
  9376. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  9377. '\u001b[' + inspect.colors[style][1] + 'm';
  9378. } else {
  9379. return str;
  9380. }
  9381. }
  9382. function stylizeNoColor(str, styleType) {
  9383. return str;
  9384. }
  9385. function arrayToHash(array) {
  9386. var hash = {};
  9387. array.forEach(function(val, idx) {
  9388. hash[val] = true;
  9389. });
  9390. return hash;
  9391. }
  9392. function formatValue(ctx, value, recurseTimes) {
  9393. if (ctx.customInspect &&
  9394. value &&
  9395. isFunction(value.inspect) &&
  9396. value.inspect !== exports.inspect &&
  9397. !(value.constructor && value.constructor.prototype === value)) {
  9398. var ret = value.inspect(recurseTimes, ctx);
  9399. if (!isString(ret)) {
  9400. ret = formatValue(ctx, ret, recurseTimes);
  9401. }
  9402. return ret;
  9403. }
  9404. var primitive = formatPrimitive(ctx, value);
  9405. if (primitive) {
  9406. return primitive;
  9407. }
  9408. var keys = Object.keys(value);
  9409. var visibleKeys = arrayToHash(keys);
  9410. if (ctx.showHidden) {
  9411. keys = Object.getOwnPropertyNames(value);
  9412. }
  9413. if (isError(value)
  9414. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  9415. return formatError(value);
  9416. }
  9417. if (keys.length === 0) {
  9418. if (isFunction(value)) {
  9419. var name = value.name ? ': ' + value.name : '';
  9420. return ctx.stylize('[Function' + name + ']', 'special');
  9421. }
  9422. if (isRegExp(value)) {
  9423. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  9424. }
  9425. if (isDate(value)) {
  9426. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  9427. }
  9428. if (isError(value)) {
  9429. return formatError(value);
  9430. }
  9431. }
  9432. var base = '', array = false, braces = ['{', '}'];
  9433. if (isArray(value)) {
  9434. array = true;
  9435. braces = ['[', ']'];
  9436. }
  9437. if (isFunction(value)) {
  9438. var n = value.name ? ': ' + value.name : '';
  9439. base = ' [Function' + n + ']';
  9440. }
  9441. if (isRegExp(value)) {
  9442. base = ' ' + RegExp.prototype.toString.call(value);
  9443. }
  9444. if (isDate(value)) {
  9445. base = ' ' + Date.prototype.toUTCString.call(value);
  9446. }
  9447. if (isError(value)) {
  9448. base = ' ' + formatError(value);
  9449. }
  9450. if (keys.length === 0 && (!array || value.length == 0)) {
  9451. return braces[0] + base + braces[1];
  9452. }
  9453. if (recurseTimes < 0) {
  9454. if (isRegExp(value)) {
  9455. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  9456. } else {
  9457. return ctx.stylize('[Object]', 'special');
  9458. }
  9459. }
  9460. ctx.seen.push(value);
  9461. var output;
  9462. if (array) {
  9463. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  9464. } else {
  9465. output = keys.map(function(key) {
  9466. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  9467. });
  9468. }
  9469. ctx.seen.pop();
  9470. return reduceToSingleString(output, base, braces);
  9471. }
  9472. function formatPrimitive(ctx, value) {
  9473. if (isUndefined(value))
  9474. return ctx.stylize('undefined', 'undefined');
  9475. if (isString(value)) {
  9476. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  9477. .replace(/'/g, "\\'")
  9478. .replace(/\\"/g, '"') + '\'';
  9479. return ctx.stylize(simple, 'string');
  9480. }
  9481. if (isNumber(value))
  9482. return ctx.stylize('' + value, 'number');
  9483. if (isBoolean(value))
  9484. return ctx.stylize('' + value, 'boolean');
  9485. if (isNull(value))
  9486. return ctx.stylize('null', 'null');
  9487. }
  9488. function formatError(value) {
  9489. return '[' + Error.prototype.toString.call(value) + ']';
  9490. }
  9491. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  9492. var output = [];
  9493. for (var i = 0, l = value.length; i < l; ++i) {
  9494. if (hasOwnProperty(value, String(i))) {
  9495. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  9496. String(i), true));
  9497. } else {
  9498. output.push('');
  9499. }
  9500. }
  9501. keys.forEach(function(key) {
  9502. if (!key.match(/^\d+$/)) {
  9503. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  9504. key, true));
  9505. }
  9506. });
  9507. return output;
  9508. }
  9509. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  9510. var name, str, desc;
  9511. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  9512. if (desc.get) {
  9513. if (desc.set) {
  9514. str = ctx.stylize('[Getter/Setter]', 'special');
  9515. } else {
  9516. str = ctx.stylize('[Getter]', 'special');
  9517. }
  9518. } else {
  9519. if (desc.set) {
  9520. str = ctx.stylize('[Setter]', 'special');
  9521. }
  9522. }
  9523. if (!hasOwnProperty(visibleKeys, key)) {
  9524. name = '[' + key + ']';
  9525. }
  9526. if (!str) {
  9527. if (ctx.seen.indexOf(desc.value) < 0) {
  9528. if (isNull(recurseTimes)) {
  9529. str = formatValue(ctx, desc.value, null);
  9530. } else {
  9531. str = formatValue(ctx, desc.value, recurseTimes - 1);
  9532. }
  9533. if (str.indexOf('\n') > -1) {
  9534. if (array) {
  9535. str = str.split('\n').map(function(line) {
  9536. return ' ' + line;
  9537. }).join('\n').substr(2);
  9538. } else {
  9539. str = '\n' + str.split('\n').map(function(line) {
  9540. return ' ' + line;
  9541. }).join('\n');
  9542. }
  9543. }
  9544. } else {
  9545. str = ctx.stylize('[Circular]', 'special');
  9546. }
  9547. }
  9548. if (isUndefined(name)) {
  9549. if (array && key.match(/^\d+$/)) {
  9550. return str;
  9551. }
  9552. name = JSON.stringify('' + key);
  9553. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  9554. name = name.substr(1, name.length - 2);
  9555. name = ctx.stylize(name, 'name');
  9556. } else {
  9557. name = name.replace(/'/g, "\\'")
  9558. .replace(/\\"/g, '"')
  9559. .replace(/(^"|"$)/g, "'");
  9560. name = ctx.stylize(name, 'string');
  9561. }
  9562. }
  9563. return name + ': ' + str;
  9564. }
  9565. function reduceToSingleString(output, base, braces) {
  9566. var numLinesEst = 0;
  9567. var length = output.reduce(function(prev, cur) {
  9568. numLinesEst++;
  9569. if (cur.indexOf('\n') >= 0) numLinesEst++;
  9570. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  9571. }, 0);
  9572. if (length > 60) {
  9573. return braces[0] +
  9574. (base === '' ? '' : base + '\n ') +
  9575. ' ' +
  9576. output.join(',\n ') +
  9577. ' ' +
  9578. braces[1];
  9579. }
  9580. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  9581. }
  9582. function isArray(ar) {
  9583. return Array.isArray(ar);
  9584. }
  9585. exports.isArray = isArray;
  9586. function isBoolean(arg) {
  9587. return typeof arg === 'boolean';
  9588. }
  9589. exports.isBoolean = isBoolean;
  9590. function isNull(arg) {
  9591. return arg === null;
  9592. }
  9593. exports.isNull = isNull;
  9594. function isNullOrUndefined(arg) {
  9595. return arg == null;
  9596. }
  9597. exports.isNullOrUndefined = isNullOrUndefined;
  9598. function isNumber(arg) {
  9599. return typeof arg === 'number';
  9600. }
  9601. exports.isNumber = isNumber;
  9602. function isString(arg) {
  9603. return typeof arg === 'string';
  9604. }
  9605. exports.isString = isString;
  9606. function isSymbol(arg) {
  9607. return typeof arg === 'symbol';
  9608. }
  9609. exports.isSymbol = isSymbol;
  9610. function isUndefined(arg) {
  9611. return arg === void 0;
  9612. }
  9613. exports.isUndefined = isUndefined;
  9614. function isRegExp(re) {
  9615. return isObject(re) && objectToString(re) === '[object RegExp]';
  9616. }
  9617. exports.isRegExp = isRegExp;
  9618. function isObject(arg) {
  9619. return typeof arg === 'object' && arg !== null;
  9620. }
  9621. exports.isObject = isObject;
  9622. function isDate(d) {
  9623. return isObject(d) && objectToString(d) === '[object Date]';
  9624. }
  9625. exports.isDate = isDate;
  9626. function isError(e) {
  9627. return isObject(e) &&
  9628. (objectToString(e) === '[object Error]' || e instanceof Error);
  9629. }
  9630. exports.isError = isError;
  9631. function isFunction(arg) {
  9632. return typeof arg === 'function';
  9633. }
  9634. exports.isFunction = isFunction;
  9635. function isPrimitive(arg) {
  9636. return arg === null ||
  9637. typeof arg === 'boolean' ||
  9638. typeof arg === 'number' ||
  9639. typeof arg === 'string' ||
  9640. typeof arg === 'symbol' || // ES6 symbol
  9641. typeof arg === 'undefined';
  9642. }
  9643. exports.isPrimitive = isPrimitive;
  9644. exports.isBuffer = _dereq_('./support/isBuffer');
  9645. function objectToString(o) {
  9646. return Object.prototype.toString.call(o);
  9647. }
  9648. function pad(n) {
  9649. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  9650. }
  9651. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  9652. 'Oct', 'Nov', 'Dec'];
  9653. function timestamp() {
  9654. var d = new Date();
  9655. var time = [pad(d.getHours()),
  9656. pad(d.getMinutes()),
  9657. pad(d.getSeconds())].join(':');
  9658. return [d.getDate(), months[d.getMonth()], time].join(' ');
  9659. }
  9660. exports.log = function() {
  9661. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  9662. };
  9663. exports.inherits = _dereq_('inherits');
  9664. exports._extend = function(origin, add) {
  9665. if (!add || !isObject(add)) return origin;
  9666. var keys = Object.keys(add);
  9667. var i = keys.length;
  9668. while (i--) {
  9669. origin[keys[i]] = add[keys[i]];
  9670. }
  9671. return origin;
  9672. };
  9673. function hasOwnProperty(obj, prop) {
  9674. return Object.prototype.hasOwnProperty.call(obj, prop);
  9675. }
  9676. }).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 : {})
  9677. },
  9678. {"./support/isBuffer":14,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}],
  9679. 16:[function(_dereq_,module,exports){
  9680. function EventEmitter() {
  9681. this._events = this._events || {};
  9682. this._maxListeners = this._maxListeners || undefined;
  9683. }
  9684. module.exports = EventEmitter;
  9685. EventEmitter.EventEmitter = EventEmitter;
  9686. EventEmitter.prototype._events = undefined;
  9687. EventEmitter.prototype._maxListeners = undefined;
  9688. EventEmitter.defaultMaxListeners = 10;
  9689. EventEmitter.prototype.setMaxListeners = function(n) {
  9690. if (!isNumber(n) || n < 0 || isNaN(n))
  9691. throw TypeError('n must be a positive number');
  9692. this._maxListeners = n;
  9693. return this;
  9694. };
  9695. EventEmitter.prototype.emit = function(type) {
  9696. var er, handler, len, args, i, listeners;
  9697. if (!this._events)
  9698. this._events = {};
  9699. if (type === 'error') {
  9700. if (!this._events.error ||
  9701. (isObject(this._events.error) && !this._events.error.length)) {
  9702. er = arguments[1];
  9703. if (er instanceof Error) {
  9704. throw er; // Unhandled 'error' event
  9705. } else {
  9706. throw TypeError('Uncaught, unspecified "error" event.');
  9707. }
  9708. return false;
  9709. }
  9710. }
  9711. handler = this._events[type];
  9712. if (isUndefined(handler))
  9713. return false;
  9714. if (isFunction(handler)) {
  9715. switch (arguments.length) {
  9716. case 1:
  9717. handler.call(this);
  9718. break;
  9719. case 2:
  9720. handler.call(this, arguments[1]);
  9721. break;
  9722. case 3:
  9723. handler.call(this, arguments[1], arguments[2]);
  9724. break;
  9725. default:
  9726. len = arguments.length;
  9727. args = new Array(len - 1);
  9728. for (i = 1; i < len; i++)
  9729. args[i - 1] = arguments[i];
  9730. handler.apply(this, args);
  9731. }
  9732. } else if (isObject(handler)) {
  9733. len = arguments.length;
  9734. args = new Array(len - 1);
  9735. for (i = 1; i < len; i++)
  9736. args[i - 1] = arguments[i];
  9737. listeners = handler.slice();
  9738. len = listeners.length;
  9739. for (i = 0; i < len; i++)
  9740. listeners[i].apply(this, args);
  9741. }
  9742. return true;
  9743. };
  9744. EventEmitter.prototype.addListener = function(type, listener) {
  9745. var m;
  9746. if (!isFunction(listener))
  9747. throw TypeError('listener must be a function');
  9748. if (!this._events)
  9749. this._events = {};
  9750. if (this._events.newListener)
  9751. this.emit('newListener', type,
  9752. isFunction(listener.listener) ?
  9753. listener.listener : listener);
  9754. if (!this._events[type])
  9755. this._events[type] = listener;
  9756. else if (isObject(this._events[type]))
  9757. this._events[type].push(listener);
  9758. else
  9759. this._events[type] = [this._events[type], listener];
  9760. if (isObject(this._events[type]) && !this._events[type].warned) {
  9761. var m;
  9762. if (!isUndefined(this._maxListeners)) {
  9763. m = this._maxListeners;
  9764. } else {
  9765. m = EventEmitter.defaultMaxListeners;
  9766. }
  9767. if (m && m > 0 && this._events[type].length > m) {
  9768. this._events[type].warned = true;
  9769. console.error('(node) warning: possible EventEmitter memory ' +
  9770. 'leak detected. %d listeners added. ' +
  9771. 'Use emitter.setMaxListeners() to increase limit.',
  9772. this._events[type].length);
  9773. console.trace();
  9774. }
  9775. }
  9776. return this;
  9777. };
  9778. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  9779. EventEmitter.prototype.once = function(type, listener) {
  9780. if (!isFunction(listener))
  9781. throw TypeError('listener must be a function');
  9782. var fired = false;
  9783. function g() {
  9784. this.removeListener(type, g);
  9785. if (!fired) {
  9786. fired = true;
  9787. listener.apply(this, arguments);
  9788. }
  9789. }
  9790. g.listener = listener;
  9791. this.on(type, g);
  9792. return this;
  9793. };
  9794. EventEmitter.prototype.removeListener = function(type, listener) {
  9795. var list, position, length, i;
  9796. if (!isFunction(listener))
  9797. throw TypeError('listener must be a function');
  9798. if (!this._events || !this._events[type])
  9799. return this;
  9800. list = this._events[type];
  9801. length = list.length;
  9802. position = -1;
  9803. if (list === listener ||
  9804. (isFunction(list.listener) && list.listener === listener)) {
  9805. delete this._events[type];
  9806. if (this._events.removeListener)
  9807. this.emit('removeListener', type, listener);
  9808. } else if (isObject(list)) {
  9809. for (i = length; i-- > 0;) {
  9810. if (list[i] === listener ||
  9811. (list[i].listener && list[i].listener === listener)) {
  9812. position = i;
  9813. break;
  9814. }
  9815. }
  9816. if (position < 0)
  9817. return this;
  9818. if (list.length === 1) {
  9819. list.length = 0;
  9820. delete this._events[type];
  9821. } else {
  9822. list.splice(position, 1);
  9823. }
  9824. if (this._events.removeListener)
  9825. this.emit('removeListener', type, listener);
  9826. }
  9827. return this;
  9828. };
  9829. EventEmitter.prototype.removeAllListeners = function(type) {
  9830. var key, listeners;
  9831. if (!this._events)
  9832. return this;
  9833. if (!this._events.removeListener) {
  9834. if (arguments.length === 0)
  9835. this._events = {};
  9836. else if (this._events[type])
  9837. delete this._events[type];
  9838. return this;
  9839. }
  9840. if (arguments.length === 0) {
  9841. for (key in this._events) {
  9842. if (key === 'removeListener') continue;
  9843. this.removeAllListeners(key);
  9844. }
  9845. this.removeAllListeners('removeListener');
  9846. this._events = {};
  9847. return this;
  9848. }
  9849. listeners = this._events[type];
  9850. if (isFunction(listeners)) {
  9851. this.removeListener(type, listeners);
  9852. } else {
  9853. while (listeners.length)
  9854. this.removeListener(type, listeners[listeners.length - 1]);
  9855. }
  9856. delete this._events[type];
  9857. return this;
  9858. };
  9859. EventEmitter.prototype.listeners = function(type) {
  9860. var ret;
  9861. if (!this._events || !this._events[type])
  9862. ret = [];
  9863. else if (isFunction(this._events[type]))
  9864. ret = [this._events[type]];
  9865. else
  9866. ret = this._events[type].slice();
  9867. return ret;
  9868. };
  9869. EventEmitter.listenerCount = function(emitter, type) {
  9870. var ret;
  9871. if (!emitter._events || !emitter._events[type])
  9872. ret = 0;
  9873. else if (isFunction(emitter._events[type]))
  9874. ret = 1;
  9875. else
  9876. ret = emitter._events[type].length;
  9877. return ret;
  9878. };
  9879. function isFunction(arg) {
  9880. return typeof arg === 'function';
  9881. }
  9882. function isNumber(arg) {
  9883. return typeof arg === 'number';
  9884. }
  9885. function isObject(arg) {
  9886. return typeof arg === 'object' && arg !== null;
  9887. }
  9888. function isUndefined(arg) {
  9889. return arg === void 0;
  9890. }
  9891. },
  9892. {}],
  9893. 17:[function(_dereq_,module,exports){
  9894. if (typeof Object.create === 'function') {
  9895. module.exports = function inherits(ctor, superCtor) {
  9896. ctor.super_ = superCtor
  9897. ctor.prototype = Object.create(superCtor.prototype, {
  9898. constructor: {
  9899. value: ctor,
  9900. enumerable: false,
  9901. writable: true,
  9902. configurable: true
  9903. }
  9904. });
  9905. };
  9906. } else {
  9907. module.exports = function inherits(ctor, superCtor) {
  9908. ctor.super_ = superCtor
  9909. var TempCtor = function () {}
  9910. TempCtor.prototype = superCtor.prototype
  9911. ctor.prototype = new TempCtor()
  9912. ctor.prototype.constructor = ctor
  9913. }
  9914. }
  9915. },
  9916. {}],
  9917. 18:[function(_dereq_,module,exports){
  9918. var process = module.exports = {};
  9919. process.nextTick = (function () {
  9920. var canSetImmediate = typeof window !== 'undefined'
  9921. && window.setImmediate;
  9922. var canPost = typeof window !== 'undefined'
  9923. && window.postMessage && window.addEventListener
  9924. ;
  9925. if (canSetImmediate) {
  9926. return function (f) { return window.setImmediate(f) };
  9927. }
  9928. if (canPost) {
  9929. var queue = [];
  9930. window.addEventListener('message', function (ev) {
  9931. var source = ev.source;
  9932. if ((source === window || source === null) && ev.data === 'process-tick') {
  9933. ev.stopPropagation();
  9934. if (queue.length > 0) {
  9935. var fn = queue.shift();
  9936. fn();
  9937. }
  9938. }
  9939. }, true);
  9940. return function nextTick(fn) {
  9941. queue.push(fn);
  9942. window.postMessage('process-tick', '*');
  9943. };
  9944. }
  9945. return function nextTick(fn) {
  9946. setTimeout(fn, 0);
  9947. };
  9948. })();
  9949. process.title = 'browser';
  9950. process.browser = true;
  9951. process.env = {};
  9952. process.argv = [];
  9953. function noop() {}
  9954. process.on = noop;
  9955. process.once = noop;
  9956. process.off = noop;
  9957. process.emit = noop;
  9958. process.binding = function (name) {
  9959. throw new Error('process.binding is not supported');
  9960. }
  9961. process.cwd = function () { return '/' };
  9962. process.chdir = function (dir) {
  9963. throw new Error('process.chdir is not supported');
  9964. };
  9965. },
  9966. {}],
  9967. 19:[function(_dereq_,module,exports){
  9968. module.exports=_dereq_(14)
  9969. },
  9970. {}],
  9971. 20:[function(_dereq_,module,exports){
  9972. module.exports=_dereq_(15)
  9973. },
  9974. {"./support/isBuffer":19,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}]},{},[9])
  9975. (9)
  9976. });
  9977. ace.define("ace/mode/html_worker",[], function(require, exports, module) {
  9978. "use strict";
  9979. var oop = require("../lib/oop");
  9980. var lang = require("../lib/lang");
  9981. var Mirror = require("../worker/mirror").Mirror;
  9982. var SAXParser = require("./html/saxparser").SAXParser;
  9983. var errorTypes = {
  9984. "expected-doctype-but-got-start-tag": "info",
  9985. "expected-doctype-but-got-chars": "info",
  9986. "non-html-root": "info"
  9987. };
  9988. var Worker = exports.Worker = function(sender) {
  9989. Mirror.call(this, sender);
  9990. this.setTimeout(400);
  9991. this.context = null;
  9992. };
  9993. oop.inherits(Worker, Mirror);
  9994. (function() {
  9995. this.setOptions = function(options) {
  9996. this.context = options.context;
  9997. };
  9998. this.onUpdate = function() {
  9999. var value = this.doc.getValue();
  10000. if (!value)
  10001. return;
  10002. var parser = new SAXParser();
  10003. var errors = [];
  10004. var noop = function(){};
  10005. parser.contentHandler = {
  10006. startDocument: noop,
  10007. endDocument: noop,
  10008. startElement: noop,
  10009. endElement: noop,
  10010. characters: noop
  10011. };
  10012. parser.errorHandler = {
  10013. error: function(message, location, code) {
  10014. errors.push({
  10015. row: location.line,
  10016. column: location.column,
  10017. text: message,
  10018. type: errorTypes[code] || "error"
  10019. });
  10020. }
  10021. };
  10022. if (this.context)
  10023. parser.parseFragment(value, this.context);
  10024. else
  10025. parser.parse(value);
  10026. this.sender.emit("error", errors);
  10027. };
  10028. }).call(Worker.prototype);
  10029. });