diff --git a/cases/111.json b/cases/111.json
index e8e7fe8..f459b4b 100644
--- a/cases/111.json
+++ b/cases/111.json
@@ -1,6 +1,6 @@
[
{
- "message": "强制性标签 ''或'' 缺失或错误",
+ "message": "强制性标签 ''或'' 缺失或错误",
"code": "06200101",
"line": 0,
"col": 0,
diff --git a/cases/144.json b/cases/144.json
index c9cf27a..89080a9 100644
--- a/cases/144.json
+++ b/cases/144.json
@@ -8,7 +8,7 @@
"input": ""
},
{
- "message": "强制性标签 '' 缺失或错误",
+ "message": "强制性标签 '' 缺失或错误",
"code": "06200101",
"line": 0,
"col": 0,
diff --git a/cases/216.json b/cases/216.json
index a44e321..9becaeb 100644
--- a/cases/216.json
+++ b/cases/216.json
@@ -1,4 +1,12 @@
[
+ {
+ "message": "标签 '' 只能出现一次",
+ "code": "06200701",
+ "line": 8,
+ "col": 9,
+ "offset": 339,
+ "input": " "
+ },
{
"message": "标签 '' 只能出现一次",
"code": "06200701",
diff --git a/cases/218.json b/cases/218.json
index 1e73e26..4fcedad 100644
--- a/cases/218.json
+++ b/cases/218.json
@@ -6,5 +6,13 @@
"col": 9,
"offset": 263,
"input": " "
+ },
+ {
+ "message": "强制性标签 '' 缺失或错误",
+ "code": "06200101",
+ "line": 0,
+ "col": 0,
+ "offset": 0,
+ "input": ""
}
]
diff --git a/cases/219.json b/cases/219.json
index b8e66d0..ba4ce48 100644
--- a/cases/219.json
+++ b/cases/219.json
@@ -6,5 +6,13 @@
"col": 9,
"offset": 263,
"input": " "
+ },
+ {
+ "message": "强制性标签 '' 缺失或错误",
+ "code": "06200101",
+ "line": 0,
+ "col": 0,
+ "offset": 0,
+ "input": ""
}
]
diff --git a/dist/mip-validator.js b/dist/mip-validator.js
index 1a3a5fc..c9832a2 100644
--- a/dist/mip-validator.js
+++ b/dist/mip-validator.js
@@ -17047,7 +17047,7 @@ arguments[4][4][0].apply(exports,arguments)
},{"./support/isBuffer":62,"_process":42,"dup":4,"inherits":12}],64:[function(require,module,exports){
module.exports={
"name": "mip-validator",
- "version": "1.6.2",
+ "version": "1.6.4",
"description": "MIP validator",
"main": "index.js",
"dependencies": {
@@ -17179,7 +17179,7 @@ module.exports={
}, {
"http-equiv": "/Content-Type/i"
}, {
- "charset": "/^utf-8$/i"
+ "charset": "/^(UTF-8)/i"
}],
"attrs": {
"content": [{
@@ -17194,9 +17194,9 @@ module.exports={
},
"mandatory_or": [{
"http-equiv": "/Content-Type/i",
- "content": "/charset=utf-8/i"
+ "content": "/charset=(utf)|(UTF)-8/"
}, {
- "charset": "/^utf-8$/i"
+ "charset": "/^(utf)|(UTF-8)/"
}],
"mandatory": {
"name": "/^(viewport)?/",
@@ -17206,20 +17206,26 @@ module.exports={
},
"link": {
"mandatory": [{
- "rel": "/^(miphtml)|(canonical)$/"
+ "rel": "/^(miphtml)|(canonical)$/",
+ "href": "/^(http(s)?:)?\/\//"
}, {
"rel": "/^stylesheet$/",
"href": "/^(https:)?\/\/((mipcache\\.bdstatic\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.css)|(mipcache\\.bdstatic\\.com\/static\/v\\d\/mip\\.css)|(c\\.mipcdn\\.com\/static\/v\\d\/mip\\.css)|(c\\.mipcdn\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.css)|(\\S+\\.sm-tc\\.cn\/static\/v\\d\/mip\\.css)|(\\S+\\.transcode\\.cn\/static\/v\\d\/mip\\.css))$/"
}],
"mandatory_parent": "head",
"duplicate": [{
+ "rel": "/^(miphtml)|(standardhtml)$/"
+ }, {
"rel": "/^(miphtml)|(canonical)$/"
+ }, {
+ "rel": "/^stylesheet$/",
+ "href": "/^(https:)?\/\/(mipcache.bdstatic.com\/static\/mipmain)|(m.baidu.com\/static\/ala\/sf\/static\/)|(c.mipcdn.com\/static\/mipmain)/"
}],
"attrs": {
"href": [{
"value": "/^(http(s)?:)?\/\//",
"match": {
- "rel": "/^((canonical)|(miphtml))$/"
+ "rel": "/^(miphtml)|(canonical)$/"
}
}, {
"value": "/^(?!\/[^\/])/",
@@ -17227,7 +17233,6 @@ module.exports={
"rel": "/^(?!((miphtml)|(canonical))$)/"
}
}]
-
}
},
"script": [
@@ -17287,6 +17292,9 @@ module.exports={
"frameset": {
"disallow": true
},
+ "iframe": {
+ "disallow": true
+ },
"object": {
"disallow": true
},
@@ -17302,9 +17310,6 @@ module.exports={
"form": {
"disallow": true
},
- "iframe": {
- "disallow": true
- },
"input": {
"mandatory_ancestor": "mip-form"
},
@@ -17457,15 +17462,34 @@ module.exports={
}
}
},
+ "mip-vd-baidu": {
+ "attrs": {
+ "src": {
+ "mandatory": true,
+ "value": "/^(http(s)?:)?\/\//"
+ },
+ "title": {
+ "mandatory": true,
+ "value": "/^\\S+$/"
+ },
+ "poster": {
+ "mandatory": true,
+ "value": "/^\\S+$/"
+ }
+ }
+ },
+ "mip-shell": {
+ "duplicate": true
+ },
"head": {
"duplicate": true,
"mandatory": true,
"mandatory_parent": "html"
},
"body": {
+ "duplicate": true,
"mandatory": true,
- "mandatory_parent": "html",
- "duplicate": true
+ "mandatory_parent": "html"
},
"style": {
"attrs": {
@@ -17500,22 +17524,6 @@ module.exports={
"value": "/^\/$/"
}
}
- },
- "mip-vd-baidu": {
- "attrs": {
- "src": {
- "mandatory": true,
- "value": "/^(http(s)?:)?\/\//"
- },
- "title": {
- "mandatory": true,
- "value": "/^\\S+$/"
- },
- "poster": {
- "mandatory": true,
- "value": "/^\\S+$/"
- }
- }
}
}
},{}],67:[function(require,module,exports){
diff --git a/dist/mip-validator.min.js b/dist/mip-validator.min.js
index 45fcf4b..d9c65da 100644
--- a/dist/mip-validator.min.js
+++ b/dist/mip-validator.min.js
@@ -1 +1 @@
-(function(define){(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.MIPValidator=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}};util.inherits(assert.AssertionError,Error);function truncate(s,n){if(typeof s==="string"){return s.length=0;i--){if(ka[i]!==kb[i])return false}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key],strict,actualVisitedObjects))return false}return true}assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected,false)){fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)}};assert.notDeepStrictEqual=notDeepStrictEqual;function notDeepStrictEqual(actual,expected,message){if(_deepEqual(actual,expected,true)){fail(actual,expected,message,"notDeepStrictEqual",notDeepStrictEqual)}}assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,"===",assert.strictEqual)}};assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,"!==",assert.notStrictEqual)}};function expectedException(actual,expected){if(!actual||!expected){return false}if(Object.prototype.toString.call(expected)=="[object RegExp]"){return expected.test(actual)}try{if(actual instanceof expected){return true}}catch(e){}if(Error.isPrototypeOf(expected)){return false}return expected.call({},actual)===true}function _tryBlock(block){var error;try{block()}catch(e){error=e}return error}function _throws(shouldThrow,block,expected,message){var actual;if(typeof block!=="function"){throw new TypeError('"block" argument must be a function')}if(typeof expected==="string"){message=expected;expected=null}actual=_tryBlock(block);message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:".");if(shouldThrow&&!actual){fail(actual,expected,"Missing expected exception"+message)}var userProvidedMessage=typeof message==="string";var isUnwantedException=!shouldThrow&&util.isError(actual);var isUnexpectedException=!shouldThrow&&actual&&!expected;if(isUnwantedException&&userProvidedMessage&&expectedException(actual,expected)||isUnexpectedException){fail(actual,expected,"Got unwanted exception"+message)}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual}}assert.throws=function(block,error,message){_throws(true,block,error,message)};assert.doesNotThrow=function(block,error,message){_throws(false,block,error,message)};assert.ifError=function(err){if(err)throw err};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key)}return keys}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"util/":4}],2:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],3:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],4:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":3,_process:42,inherits:2}],5:[function(require,module,exports){"use strict";exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i0){throw new Error("Invalid string. Length must be a multiple of 4")}var validLen=b64.indexOf("=");if(validLen===-1)validLen=len;var placeHoldersLen=validLen===len?0:4-validLen%4;return[validLen,placeHoldersLen]}function byteLength(b64){var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function _byteLength(b64,validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function toByteArray(b64){var tmp;var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];var arr=new Arr(_byteLength(b64,validLen,placeHoldersLen));var curByte=0;var len=placeHoldersLen>0?validLen-4:validLen;for(var i=0;i>16&255;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}if(placeHoldersLen===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[curByte++]=tmp&255}if(placeHoldersLen===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;ilen2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"=")}return parts.join("")}},{}],6:[function(require,module,exports){},{}],7:[function(require,module,exports){(function(global){"use strict";var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("isarray");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();exports.kMaxLength=kMaxLength();function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42&&typeof arr.subarray==="function"&&arr.subarray(1,1).byteLength===0}catch(e){return false}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()=kMaxLength()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength().toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;i0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return""};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target)){throw new TypeError("Argument must be a Buffer")}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(isNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;jremaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new TypeError("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;iremaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(ilen)end=len;var out="";for(var i=start;ilen){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(endlength)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&255;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,34028234663852886e22,-34028234663852886e22)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,17976931348623157e292,-17976931348623157e292)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart=0;--i){target[i+targetStart]=this[i+start]}}else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(i=0;i>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isnan(val){return val!==val}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":5,ieee754:11,isarray:8}],8:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}},{}],9:[function(require,module,exports){(function(Buffer){function isArray(arg){if(Array.isArray){return Array.isArray(arg)}return objectToString(arg)==="[object Array]"}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return objectToString(e)==="[object Error]"||e instanceof Error}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=Buffer.isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":13}],10:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}else{var err=new Error('Uncaught, unspecified "error" event. ('+er+")");err.context=er;throw err}}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1);handler.apply(this,args)}}else if(isObject(handler)){args=Array.prototype.slice.call(arguments,1);listeners=handler.slice();len=listeners.length;for(i=0;i0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-- >0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else if(listeners){while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;else if(evlistener)return evlistener.length}return 0};EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],11:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],12:[function(require,module,exports){arguments[4][2][0].apply(exports,arguments)},{dup:2}],13:[function(require,module,exports){module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE==="function"&&typeof obj.slice==="function"&&isBuffer(obj.slice(0,0))}},{}],14:[function(require,module,exports){(function(global){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,kn="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",En=RegExp("['’]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+kn+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Un={};Un["[object Float32Array]"]=Un["[object Float64Array]"]=Un["[object Int8Array]"]=Un["[object Int16Array]"]=Un["[object Int32Array]"]=Un["[object Uint8Array]"]=Un["[object Uint8ClampedArray]"]=Un["[object Uint16Array]"]=Un["[object Uint32Array]"]=true,Un["[object Arguments]"]=Un["[object Array]"]=Un["[object ArrayBuffer]"]=Un["[object Boolean]"]=Un["[object DataView]"]=Un["[object Date]"]=Un["[object Error]"]=Un["[object Function]"]=Un["[object Map]"]=Un["[object Number]"]=Un["[object Object]"]=Un["[object RegExp]"]=Un["[object Set]"]=Un["[object String]"]=Un["[object WeakMap]"]=false;var Bn={};Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object DataView]"]=Bn["[object Boolean]"]=Bn["[object Date]"]=Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object Symbol]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object WeakMap]"]=false;var Ln={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=(typeof global==="undefined"?"undefined":_typeof(global))=="object"&&global&&global.Object===Object&&global,Tn=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=(typeof exports==="undefined"?"undefined":_typeof(exports))=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&(typeof module==="undefined"?"undefined":_typeof(module))=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){try{var n=Nn&&Nn.require&&Nn.require("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nt=x({"&":"&","<":"<",">":">",'"':""","'":"'"}),tt=x({"&":"&","<":"<",">":">",""":'"',"'":"'"}),rt=function x(mn){function An(n){if(yu(n)&&!ff(n)&&!(n instanceof Ln)){if(n instanceof On)return n;if(oi.call(n,"__wrapped__"))return Fe(n)}return new On(n)}function kn(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Ln(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!du(n))return n;if(u=ff(n)){if(f=me(n),!c)return Lr(n,f)}else{var s=vo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(af(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Bn[s])return i?n:{};f=ke(n,s,c)}}if(o||(o=new Zn),i=o.get(n))return i;if(o.set(n,f),pf(n))return n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}),f;if(sf(n))return n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))}),f;var a=l?a?ve:_e:a?Uu:Wu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=Wu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Qu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ti("Expected a function");return bo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,E(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++ut}function Rt(n,t){return null!=n&&oi.call(n,t)}function zt(n,t){return null!=n&&t in Qu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Ku(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,E(t))),s=Ci(p.length,s),l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_r.length?t:Et(t,hr(r,0,-1)),r=null==t?t:t[Me(Ve(r))],null==r?T:n(r,t,e)}function Lt(n){return yu(n)&&"[object Arguments]"==Ot(n)}function Ct(n){return yu(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return yu(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)return true;if(null==n||null==t||!yu(n)&&!yu(t))return n!==n&&t!==t;n:{var i=ff(n),o=ff(t),f=i?"[object Array]":vo(n),c=o?"[object Array]":vo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&af(n)){if(!af(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||_f(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{if(!(1&r)&&(i=a&&oi.call(n,"__wrapped__"),f=o&&oi.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c){t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:oi.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++at?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[$u],E(ye())),n=Gt(n,function(n,r,u){return{a:c(t,function(t){return t(n)}),b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e=f){e=c;break n}e=c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return zu(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++et||9007199254740991t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ku(u);++e=u){for(;e>>1,o=n[i];null!==o&&!wu(o)&&(r?o<=t:ot.length?n:Et(n,hr(t,0,-1)),null==n||delete n[Me(Ve(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++ie)return e?br(n[0]):[];for(var u=-1,i=Ku(e);++u=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=gi?gi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new vi(t).set(new vi(n)),t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length)}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=wu(n),o=t!==T,f=null===t,c=t===t,a=wu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&nu?T:i,u=1),t=Qu(t);++eo&&f[0]!==a&&f[o-1]!==a?[]:B(f,a),o-=c.length,or?r?or(t,n):t:(r=or(t,Oi(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Ku(l+c),h=this&&this!==$n&&this instanceof i?f:t;++at||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Ur(e,r,h[4]):r,i[4]=e?B(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Br(e,r,h[6]):r,i[6]=e?B(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ci(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],t=i[1],r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Li(i[9]-a,0),!f&&24&t&&(t&=-25),c=t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),Le((h?co:yo)(c,i),n,t)}function ce(n,t,r,e){return n===T||lu(n,ei[r])&&!oi.call(e,r)?t:n}function ae(n,t,r,e,u,i){return du(n)&&du(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return xu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t;var c=-1,a=true,l=2&r?new Nn:T;for(i.set(n,t),i.set(t,n);++cr&&(r=Li(e+r,0)),_(n,ye(t,3),r)):-1}function Pe(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=ku(r),u=0>r?Li(e+u,0):Ci(u,e-1)),_(n,ye(t,3),u,true)}function Ze(n){return(null==n?0:n.length)?wt(n,1):[]}function qe(n){return n&&n.length?n[0]:T}function Ve(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ke(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ge(n){return null==n?n:$i.call(n)}function He(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(hu(n))return t=Li(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function Je(t,r){if(!t||!t.length)return[];var e=He(t);return null==r?e:c(e,function(t){return n(r,T,t)})}function Ye(n){return n=An(n),n.__chain__=true,n}function Qe(n,t){return t(n)}function Xe(){return this}function nu(n,t){return(ff(n)?r:uo)(n,ye(t,3))}function tu(n,t){return(ff(n)?e:io)(n,ye(t,3))}function ru(n,t){return(ff(n)?c:Gt)(n,ye(t,3))}function eu(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function uu(n,t){var r;if(typeof t!="function")throw new ti("Expected a function");return n=ku(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),r}}function iu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=iu.placeholder,n}function ou(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=ou.placeholder,n}function fu(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Go();if(u(n))return o(n);var r,e=bo;r=n-_,n=t-(n-p),r=g?Ci(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Go(),r=u(n);if(c=arguments,a=this,p=n,r){if(h===T)return _=n=p,h=bo(i,t),v?e(n):s;if(g)return h=bo(i,t),e(p)}return h===T&&(h=bo(i,t)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ti("Expected a function");return t=Su(t)||0,du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Li(Su(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&lo(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Go())},f}function cu(n,t){if(typeof n!="function"||null!=t&&typeof t!="function")throw new ti("Expected a function");var r=function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=n.apply(this,e),r.cache=i.set(u,e)||i,e)};return r.cache=new(cu.Cache||Fn),r}function au(n){if(typeof n!="function")throw new ti("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function lu(n,t){return n===t||n!==n&&t!==t}function su(n){return null!=n&&gu(n.length)&&!_u(n)}function hu(n){return yu(n)&&su(n)}function pu(n){if(!yu(n))return false;var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!xu(n)}function _u(n){return!!du(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function vu(n){return typeof n=="number"&&n==ku(n)}function gu(n){return typeof n=="number"&&-1=n}function du(n){var t=typeof n==="undefined"?"undefined":_typeof(n);return null!=n&&("object"==t||"function"==t)}function yu(n){return null!=n&&(typeof n==="undefined"?"undefined":_typeof(n))=="object"}function bu(n){return typeof n=="number"||yu(n)&&"[object Number]"==Ot(n)}function xu(n){return!(!yu(n)||"[object Object]"!=Ot(n))&&(n=di(n),null===n||(n=oi.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ii.call(n)==li))}function ju(n){return typeof n=="string"||!ff(n)&&yu(n)&&"[object String]"==Ot(n)}function wu(n){return(typeof n==="undefined"?"undefined":_typeof(n))=="symbol"||yu(n)&&"[object Symbol]"==Ot(n)}function mu(n){if(!n)return[];if(su(n))return ju(n)?M(n):Lr(n);if(wi&&n[wi]){n=n[wi]();for(var t,r=[];!(t=n.next()).done;){r.push(t.value)}return r}return t=vo(n),("[object Map]"==t?W:"[object Set]"==t?L:Lu)(n)}function Au(n){return n?(n=Su(n),n===$||n===-$?17976931348623157e292*(0>n?-1:1):n===n?n:0):0===n?n:0}function ku(n){n=Au(n);var t=n%1;return n===n?t?n-t:n:0}function Eu(n){return n?pt(ku(n),0,4294967295):0}function Su(n){if(typeof n=="number")return n;if(wu(n))return F;if(du(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,n=du(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n}function Ou(n){return Cr(n,Uu(n))}function Iu(n){return null==n?"":yr(n)}function Ru(n,t,r){return n=null==n?T:Et(n,t),n===T?r:n}function zu(n,t){return null!=n&&we(n,t,zt)}function Wu(n){return su(n)?qn(n):Vt(n)}function Uu(n){if(su(n))n=qn(n,true);else if(du(n)){var t,r=ze(n),e=[];for(t in n){("constructor"!=t||!r&&oi.call(n,t))&&e.push(t)}n=e}else{if(t=[],null!=n)for(r in Qu(n)){t.push(r)}n=t}return n}function Bu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){return t(n,r[0])})}function Lu(n){return null==n?[]:S(n,Wu(n))}function Cu(n){return $f(Iu(n).toLowerCase())}function Du(n){return(n=Iu(n))&&n.replace(xn,Xn).replace(Sn,"")}function Mu(n,t,r){return n=Iu(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Tu(n){return function(){return n}}function $u(n){return n}function Fu(n){return qt(typeof n=="function"?n:_t(n,1))}function Nu(n,t,e){var u=Wu(t),i=kt(t,u);null!=e||du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=kt(t,Wu(t)));var o=!(du(e)&&"chain"in e&&!e.chain),f=_u(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Lr(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Pu(){}function Zu(n){return Ie(n)?b(Me(n)):rr(n)}function qu(){return[]}function Vu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Ku=mn.Array,Gu=mn.Date,Hu=mn.Error,Ju=mn.Function,Yu=mn.Math,Qu=mn.Object,Xu=mn.RegExp,ni=mn.String,ti=mn.TypeError,ri=Ku.prototype,ei=Qu.prototype,ui=mn["__core-js_shared__"],ii=Ju.prototype.toString,oi=ei.hasOwnProperty,fi=0,ci=function(){var n=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ai=ei.toString,li=ii.call(Qu),si=$n._,hi=Xu("^"+ii.call(oi).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pi=Pn?mn.Buffer:T,_i=mn.Symbol,vi=mn.Uint8Array,gi=pi?pi.allocUnsafe:T,di=U(Qu.getPrototypeOf,Qu),yi=Qu.create,bi=ei.propertyIsEnumerable,xi=ri.splice,ji=_i?_i.isConcatSpreadable:T,wi=_i?_i.iterator:T,mi=_i?_i.toStringTag:T,Ai=function(){try{var n=je(Qu,"defineProperty");return n({},"",{}),n}catch(n){}}(),ki=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,Ei=Gu&&Gu.now!==$n.Date.now&&Gu.now,Si=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Oi=Yu.ceil,Ii=Yu.floor,Ri=Qu.getOwnPropertySymbols,zi=pi?pi.isBuffer:T,Wi=mn.isFinite,Ui=ri.join,Bi=U(Qu.keys,Qu),Li=Yu.max,Ci=Yu.min,Di=Gu.now,Mi=mn.parseInt,Ti=Yu.random,$i=ri.reverse,Fi=je(mn,"DataView"),Ni=je(mn,"Map"),Pi=je(mn,"Promise"),Zi=je(mn,"Set"),qi=je(mn,"WeakMap"),Vi=je(Qu,"create"),Ki=qi&&new qi,Gi={},Hi=Te(Fi),Ji=Te(Ni),Yi=Te(Pi),Qi=Te(Zi),Xi=Te(qi),no=_i?_i.prototype:T,to=no?no.valueOf:T,ro=no?no.toString:T,eo=function(){function n(){}return function(t){return du(t)?yi?yi(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=kn.prototype,An.prototype.constructor=An,On.prototype=eo(kn.prototype),On.prototype.constructor=On,Ln.prototype=eo(kn.prototype),Ln.prototype.constructor=Ln,Mn.prototype.clear=function(){this.__data__=Vi?Vi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n],this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return Vi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):oi.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return Vi?t[n]!==T:oi.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Vi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():xi.call(t,n,1),--this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Ni||Tn),string:new Mn}},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n)},Fn.prototype.has=function(n){return be(this,n).has(n)},Fn.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.clear=function(){this.__data__=new Tn,this.size=0},Zn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Zn.prototype.get=function(n){return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Ni||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var uo=Fr(mt),io=Fr(At,true),oo=Nr(),fo=Nr(true),co=Ki?function(n,t){return Ki.set(n,t),n}:$u,ao=Ai?function(n,t){return Ai(n,"toString",{configurable:true,enumerable:false,value:Tu(t),writable:true})}:$u,lo=ki||function(n){return $n.clearTimeout(n)},so=Zi&&1/L(new Zi([,-0]))[1]==$?function(n){return new Zi(n)}:Pu,ho=Ki?function(n){return Ki.get(n)}:Pu,po=Ri?function(n){return null==n?[]:(n=Qu(n),i(Ri(n),function(t){return bi.call(n,t)}))}:qu,_o=Ri?function(n){for(var t=[];n;){a(t,po(n)),n=di(n)}return t}:qu,vo=Ot;(Fi&&"[object DataView]"!=vo(new Fi(new ArrayBuffer(1)))||Ni&&"[object Map]"!=vo(new Ni)||Pi&&"[object Promise]"!=vo(Pi.resolve())||Zi&&"[object Set]"!=vo(new Zi)||qi&&"[object WeakMap]"!=vo(new qi))&&(vo=function vo(n){var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Te(n):"")switch(n){case Hi:return"[object DataView]";case Ji:return"[object Map]";case Yi:return"[object Promise]";case Qi:return"[object Set]";case Xi:return"[object WeakMap]"}return t});var go=ui?_u:Vu,yo=Ce(co),bo=Si||function(n,t){return $n.setTimeout(n,t)},xo=Ce(ao),jo=function(n){n=cu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){t.push(e?u.replace(hn,"$1"):r||n)}),t}),wo=fr(function(n,t){return hu(n)?yt(n,wt(t,1,hu,true)):[]}),mo=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),ye(r,2)):[]}),Ao=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),T,r):[]}),ko=fr(function(n){var t=c(n,kr);return t.length&&t[0]===n[0]?Wt(t):[]}),Eo=fr(function(n){var t=Ve(n),r=c(n,kr);return t===Ve(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),So=fr(function(n){var t=Ve(n),r=c(n,kr);return(t=typeof t=="function"?t:T)&&r.pop(),r.length&&r[0]===n[0]?Wt(r,T,t):[]}),Oo=fr(Ke),Io=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Ro=fr(function(n){return br(wt(n,1,hu,true))}),zo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),br(wt(n,1,hu,true),ye(t,2))}),Wo=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return br(wt(n,1,hu,true),T,t)}),Uo=fr(function(n,t){return hu(n)?yt(n,t):[]}),Bo=fr(function(n){return mr(i(n,hu))}),Lo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),mr(i(n,hu),ye(t,2))}),Co=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return mr(i(n,hu),T,t)}),Do=fr(He),Mo=fr(function(n){var t=n.length,t=1=t}),of=Lt(function(){return arguments}())?Lt:function(n){return yu(n)&&oi.call(n,"callee")&&!bi.call(n,"callee")},ff=Ku.isArray,cf=Vn?E(Vn):Ct,af=zi||Vu,lf=Kn?E(Kn):Dt,sf=Gn?E(Gn):Tt,hf=Hn?E(Hn):Nt,pf=Jn?E(Jn):Pt,_f=Yn?E(Yn):Zt,vf=ee(Kt),gf=ee(function(n,t){return n<=t}),df=$r(function(n,t){if(ze(t)||su(t))Cr(t,Wu(t),n);else for(var r in t){oi.call(t,r)&&ot(n,r,t[r])}}),yf=$r(function(n,t){Cr(t,Uu(t),n)}),bf=$r(function(n,t,r,e){Cr(t,Uu(t),n,e)}),xf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),jf=pe(ht),wf=fr(function(n,t){n=Qu(n);var r=-1,e=t.length,u=2--n)return t.apply(this,arguments)}},An.ary=eu,An.assign=df,An.assignIn=yf,An.assignInWith=bf,An.assignWith=xf,An.at=jf,An.before=uu,An.bind=Ho,An.bindAll=Nf,An.bindKey=Jo,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return ff(n)?n:[n]},An.chain=Ye,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Li(ku(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Ku(Oi(r/t));et?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:ku(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[]},An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=ku(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:ku(e),0>e&&(e+=u),e=r>e?0:Eu(e);r>>0,r?(n=Iu(n))&&(typeof t=="string"||null!=t&&!hf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ti("Expected a function");return r=null==r?0:Li(ku(r),0),fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:ku(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:ku(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n),n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ti("Expected a function");return du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),fu(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Qe,An.toArray=mu,An.toPairs=zf,An.toPairsIn=Wf,An.toPath=function(n){return ff(n)?c(n,Me):wu(n)?[n]:Lr(jo(Iu(n)))},An.toPlainObject=Ou,An.transform=function(n,t,e){var u=ff(n),i=u||af(n)||_f(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:du(n)&&_u(o)?eo(di(n)):{}}return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return eu(n,1)},An.union=Ro,An.unionBy=zo,An.unionWith=Wo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=He,An.unzipWith=Je,An.update=function(n,t,r){return null!=n&&(r=Er(r),n=lr(n,t,r(Et(n,t)),void 0)),n},An.updateWith=function(n,t,r,e){return e=typeof e=="function"?e:T,null!=n&&(r=Er(r),n=lr(n,t,r(Et(n,t)),e)),n},An.values=Lu,An.valuesIn=function(n){return null==n?[]:S(n,Uu(n))},An.without=Uo,An.words=Mu,An.wrap=function(n,t){return nf(Er(t),n)},An.xor=Bo,An.xorBy=Lo,An.xorWith=Co,An.zip=Do,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Mo,An.entries=zf,An.entriesIn=Wf,An.extend=yf,An.extendWith=bf,Nu(An,An),An.add=Qf,An.attempt=Ff,An.camelCase=Uf,An.capitalize=Cu,An.ceil=Xf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Su(r),r=r===r?r:0),t!==T&&(t=Su(t),t=t===t?t:0),pt(Su(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,Wu(t))},An.deburr=Du,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=nc,An.endsWith=function(n,t,r){n=Iu(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(ku(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=lu,An.escape=function(n){return(n=Iu(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Iu(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=ff(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=Fo,An.findIndex=Ne,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=No,An.findLastIndex=Pe,An.findLastKey=function(n,t){return p(n,ye(t,3),At)},An.floor=tc,An.forEach=nu,An.forEachRight=tu,An.forIn=function(n,t){return null==n?n:oo(n,ye(t,3),Uu)},An.forInRight=function(n,t){return null==n?n:fo(n,ye(t,3),Uu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Ru,An.gt=ef,An.gte=uf,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=zu,An.head=qe,An.identity=$u,An.includes=function(n,t,r,e){return n=su(n)?n:Lu(n),r=r&&!e?ku(r):0,e=n.length,0>r&&(r=Li(e+r,0)),ju(n)?r<=e&&-1r&&(r=Li(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=Au(t),r===T?(r=t,t=0):r=Au(r),n=Su(n),n>=Ci(t,r)&&n=n},An.isSet=pf,An.isString=ju,An.isSymbol=wu,An.isTypedArray=_f,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return yu(n)&&"[object WeakMap]"==vo(n)},An.isWeakSet=function(n){return yu(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Ui.call(n,t)},An.kebabCase=Bf,An.last=Ve,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=ku(r),u=0>u?Li(e+u,0):Ci(u,e-1)),t===t)n:{for(r=u+1;r--;){if(n[r]===t){n=r;break n}}n=r}else n=_(n,d,u,true);return n},An.lowerCase=Lf,An.lowerFirst=Cf,An.lt=vf,An.lte=gf,An.max=function(n){return n&&n.length?xt(n,$u,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,$u)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,$u,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=qu,An.stubFalse=Vu,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return true},An.multiply=rc,An.nth=function(n,t){return n&&n.length?Qt(n,ku(t)):T},An.noConflict=function(){return $n._===this&&($n._=si),this},An.noop=Pu,An.now=Go,An.pad=function(n,t,r){n=Iu(n);var e=(t=ku(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Ii(t),r)+n+ne(Oi(t),r))},An.padEnd=function(n,t,r){n=Iu(n);var e=(t=ku(t))?D(n):0;return t&&et){var e=n;n=t,t=e}return r||n%1||t%1?(r=Ti(),Ci(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=ff(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,uo)},An.reduceRight=function(n,t,r){var e=ff(n)?s:j,u=3>arguments.length;return e(n,ye(t,4),r,u,io)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:ku(t),or(Iu(n),t)},An.replace=function(){var n=arguments,t=Iu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++en||9007199254740991=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),hf(u)){if(n.slice(i).search(u)){var f=r;for(u.global||(u=Xu(u.source,Iu(_n.exec(u))+"g")),u.lastIndex=0;o=u.exec(f);){var c=o.index}r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1e.__dir__?"Right":"")}),e},Ln.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;Ln.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Ln.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Ln.prototype[n]=function(){return this.__filtered__?new Ln(this):this[r](1)}}),Ln.prototype.compact=function(){return this.filter($u)},Ln.prototype.find=function(n){return this.filter(n).head()},Ln.prototype.findLast=function(n){return this.reverse().find(n)},Ln.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Ln(this):this.map(function(r){return Bt(r,n,t)})}),Ln.prototype.reject=function(n){return this.filter(au(ye(n)))},Ln.prototype.slice=function(n,t){n=ku(n);var r=this;return r.__filtered__&&(0t)?new Ln(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=ku(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Ln.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},mt(Ln.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Ln,c=o[0],l=f||ff(t),s=function s(n){return n=u.apply(An,a([n],o)),e&&h?n[0]:n};l&&r&&typeof c=="function"&&1!=c.length&&(f=l=false);var h=this.__chain__,p=!!this.__actions__.length,c=i&&!h,f=f&&!p;return!i&&l?(t=f?t:new Ln(this),t=n.apply(t,o),t.__actions__.push({func:Qe,args:[s],thisArg:T}),new On(t,h)):c&&f?n.apply(this,o):(t=this.thru(s),c?e?t.value()[0]:t.value():t)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ri[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(ff(u)?u:[],n)}return this[r](function(r){return t.apply(ff(r)?r:[],n)})}}),mt(Ln.prototype,function(n,t){var r=An[t];if(r){var e=r.name+"";(Gi[e]||(Gi[e]=[])).push({name:t,func:r})}}),Gi[Jr(T,2).name]=[{name:"wrapper",func:T}],Ln.prototype.clone=function(){var n=new Ln(this.__wrapped__);return n.__actions__=Lr(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Lr(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Lr(this.__views__),n},Ln.prototype.reverse=function(){if(this.__filtered__){var n=new Ln(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Ln.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=0;for(var o=i,f=this.__views__,c=-1,a=f.length;++c=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){for(var t,r=this;r instanceof kn;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Ln?(this.__actions__.length&&(n=new Ln(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&_typeof(define.amd)=="object"&&define.amd?($n._=rt,define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(undefined)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],15:[function(require,module,exports){"use strict";var DOCUMENT_MODE=require("./html").DOCUMENT_MODE;var VALID_DOCTYPE_NAME="html",QUIRKS_MODE_SYSTEM_ID="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",QUIRKS_MODE_PUBLIC_ID_PREFIXES=["+//silmaril//dtd html pro v0r11 19970101//en","-//advasoft ltd//dtd html 3.0 aswedit + extensions//en","-//as//dtd html 3.0 aswedit + extensions//en","-//ietf//dtd html 2.0 level 1//en","-//ietf//dtd html 2.0 level 2//en","-//ietf//dtd html 2.0 strict level 1//en","-//ietf//dtd html 2.0 strict level 2//en","-//ietf//dtd html 2.0 strict//en","-//ietf//dtd html 2.0//en","-//ietf//dtd html 2.1e//en","-//ietf//dtd html 3.0//en","-//ietf//dtd html 3.0//en//","-//ietf//dtd html 3.2 final//en","-//ietf//dtd html 3.2//en","-//ietf//dtd html 3//en","-//ietf//dtd html level 0//en","-//ietf//dtd html level 0//en//2.0","-//ietf//dtd html level 1//en","-//ietf//dtd html level 1//en//2.0","-//ietf//dtd html level 2//en","-//ietf//dtd html level 2//en//2.0","-//ietf//dtd html level 3//en","-//ietf//dtd html level 3//en//3.0","-//ietf//dtd html strict level 0//en","-//ietf//dtd html strict level 0//en//2.0","-//ietf//dtd html strict level 1//en","-//ietf//dtd html strict level 1//en//2.0","-//ietf//dtd html strict level 2//en","-//ietf//dtd html strict level 2//en//2.0","-//ietf//dtd html strict level 3//en","-//ietf//dtd html strict level 3//en//3.0","-//ietf//dtd html strict//en","-//ietf//dtd html strict//en//2.0","-//ietf//dtd html strict//en//3.0","-//ietf//dtd html//en","-//ietf//dtd html//en//2.0","-//ietf//dtd html//en//3.0","-//metrius//dtd metrius presentational//en","-//microsoft//dtd internet explorer 2.0 html strict//en","-//microsoft//dtd internet explorer 2.0 html//en","-//microsoft//dtd internet explorer 2.0 tables//en","-//microsoft//dtd internet explorer 3.0 html strict//en","-//microsoft//dtd internet explorer 3.0 html//en","-//microsoft//dtd internet explorer 3.0 tables//en","-//netscape comm. corp.//dtd html//en","-//netscape comm. corp.//dtd strict html//en","-//o'reilly and associates//dtd html 2.0//en","-//o'reilly and associates//dtd html extended 1.0//en","-//spyglass//dtd html 2.0 extended//en","-//sq//dtd html 2.0 hotmetal + extensions//en","-//sun microsystems corp.//dtd hotjava html//en","-//sun microsystems corp.//dtd hotjava strict html//en","-//w3c//dtd html 3 1995-03-24//en","-//w3c//dtd html 3.2 draft//en","-//w3c//dtd html 3.2 final//en","-//w3c//dtd html 3.2//en","-//w3c//dtd html 3.2s draft//en","-//w3c//dtd html 4.0 frameset//en","-//w3c//dtd html 4.0 transitional//en","-//w3c//dtd html experimental 19960712//en","-//w3c//dtd html experimental 970421//en","-//w3c//dtd w3 html//en","-//w3o//dtd w3 html 3.0//en","-//w3o//dtd w3 html 3.0//en//","-//webtechs//dtd mozilla html 2.0//en","-//webtechs//dtd mozilla html//en"],QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES=QUIRKS_MODE_PUBLIC_ID_PREFIXES.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]),QUIRKS_MODE_PUBLIC_IDS=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"],LIMITED_QUIRKS_PUBLIC_ID_PREFIXES=["-//W3C//DTD XHTML 1.0 Frameset//","-//W3C//DTD XHTML 1.0 Transitional//"],LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES=LIMITED_QUIRKS_PUBLIC_ID_PREFIXES.concat(["-//W3C//DTD HTML 4.01 Frameset//","-//W3C//DTD HTML 4.01 Transitional//"]);function enquoteDoctypeId(id){var quote=id.indexOf('"')!==-1?"'":'"';return quote+id+quote}function hasPrefix(publicId,prefixes){for(var i=0;i-1)return DOCUMENT_MODE.QUIRKS;var prefixes=systemId===null?QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES:QUIRKS_MODE_PUBLIC_ID_PREFIXES;if(hasPrefix(publicId,prefixes))return DOCUMENT_MODE.QUIRKS;prefixes=systemId===null?LIMITED_QUIRKS_PUBLIC_ID_PREFIXES:LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;if(hasPrefix(publicId,prefixes))return DOCUMENT_MODE.LIMITED_QUIRKS}return DOCUMENT_MODE.NO_QUIRKS};exports.serializeContent=function(name,publicId,systemId){var str="!DOCTYPE ";if(name)str+=name;if(publicId!==null)str+=" PUBLIC "+enquoteDoctypeId(publicId);else if(systemId!==null)str+=" SYSTEM";if(systemId!==null)str+=" "+enquoteDoctypeId(systemId);return str}},{"./html":17}],16:[function(require,module,exports){"use strict";var Tokenizer=require("../tokenizer"),HTML=require("./html");var $=HTML.TAG_NAMES,NS=HTML.NAMESPACES,ATTRS=HTML.ATTRS;var MIME_TYPES={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"};var DEFINITION_URL_ATTR="definitionurl",ADJUSTED_DEFINITION_URL_ATTR="definitionURL",SVG_ATTRS_ADJUSTMENT_MAP={attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"},XML_ATTRS_ADJUSTMENT_MAP={"xlink:actuate":{prefix:"xlink",name:"actuate",namespace:NS.XLINK},"xlink:arcrole":{prefix:"xlink",name:"arcrole",namespace:NS.XLINK},"xlink:href":{prefix:"xlink",name:"href",namespace:NS.XLINK},"xlink:role":{prefix:"xlink",name:"role",namespace:NS.XLINK},"xlink:show":{prefix:"xlink",name:"show",namespace:NS.XLINK},"xlink:title":{prefix:"xlink",name:"title",namespace:NS.XLINK},"xlink:type":{prefix:"xlink",name:"type",namespace:NS.XLINK},"xml:base":{prefix:"xml",name:"base",namespace:NS.XML},"xml:lang":{prefix:"xml",name:"lang",namespace:NS.XML},"xml:space":{prefix:"xml",name:"space",namespace:NS.XML},xmlns:{prefix:"",name:"xmlns",namespace:NS.XMLNS},"xmlns:xlink":{prefix:"xmlns",name:"xlink",namespace:NS.XMLNS}};var SVG_TAG_NAMES_ADJUSTMENT_MAP=exports.SVG_TAG_NAMES_ADJUSTMENT_MAP={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"};var EXITS_FOREIGN_CONTENT=Object.create(null);EXITS_FOREIGN_CONTENT[$.B]=true;EXITS_FOREIGN_CONTENT[$.BIG]=true;EXITS_FOREIGN_CONTENT[$.BLOCKQUOTE]=true;EXITS_FOREIGN_CONTENT[$.BODY]=true;EXITS_FOREIGN_CONTENT[$.BR]=true;EXITS_FOREIGN_CONTENT[$.CENTER]=true;EXITS_FOREIGN_CONTENT[$.CODE]=true;EXITS_FOREIGN_CONTENT[$.DD]=true;EXITS_FOREIGN_CONTENT[$.DIV]=true;EXITS_FOREIGN_CONTENT[$.DL]=true;EXITS_FOREIGN_CONTENT[$.DT]=true;EXITS_FOREIGN_CONTENT[$.EM]=true;EXITS_FOREIGN_CONTENT[$.EMBED]=true;EXITS_FOREIGN_CONTENT[$.H1]=true;EXITS_FOREIGN_CONTENT[$.H2]=true;EXITS_FOREIGN_CONTENT[$.H3]=true;EXITS_FOREIGN_CONTENT[$.H4]=true;EXITS_FOREIGN_CONTENT[$.H5]=true;EXITS_FOREIGN_CONTENT[$.H6]=true;EXITS_FOREIGN_CONTENT[$.HEAD]=true;EXITS_FOREIGN_CONTENT[$.HR]=true;EXITS_FOREIGN_CONTENT[$.I]=true;EXITS_FOREIGN_CONTENT[$.IMG]=true;EXITS_FOREIGN_CONTENT[$.LI]=true;EXITS_FOREIGN_CONTENT[$.LISTING]=true;EXITS_FOREIGN_CONTENT[$.MENU]=true;EXITS_FOREIGN_CONTENT[$.META]=true;EXITS_FOREIGN_CONTENT[$.NOBR]=true;EXITS_FOREIGN_CONTENT[$.OL]=true;EXITS_FOREIGN_CONTENT[$.P]=true;EXITS_FOREIGN_CONTENT[$.PRE]=true;EXITS_FOREIGN_CONTENT[$.RUBY]=true;EXITS_FOREIGN_CONTENT[$.S]=true;EXITS_FOREIGN_CONTENT[$.SMALL]=true;EXITS_FOREIGN_CONTENT[$.SPAN]=true;EXITS_FOREIGN_CONTENT[$.STRONG]=true;EXITS_FOREIGN_CONTENT[$.STRIKE]=true;EXITS_FOREIGN_CONTENT[$.SUB]=true;EXITS_FOREIGN_CONTENT[$.SUP]=true;EXITS_FOREIGN_CONTENT[$.TABLE]=true;EXITS_FOREIGN_CONTENT[$.TT]=true;EXITS_FOREIGN_CONTENT[$.U]=true;EXITS_FOREIGN_CONTENT[$.UL]=true;EXITS_FOREIGN_CONTENT[$.VAR]=true;exports.causesExit=function(startTagToken){var tn=startTagToken.tagName;var isFontWithAttrs=tn===$.FONT&&(Tokenizer.getTokenAttr(startTagToken,ATTRS.COLOR)!==null||Tokenizer.getTokenAttr(startTagToken,ATTRS.SIZE)!==null||Tokenizer.getTokenAttr(startTagToken,ATTRS.FACE)!==null);return isFontWithAttrs?true:EXITS_FOREIGN_CONTENT[tn]};exports.adjustTokenMathMLAttrs=function(token){for(var i=0;i0;i--)mxn.onItemPop(this.items[i]);orig.popAllUpToHtmlElement.call(this)},remove:function(element){mxn.onItemPop(this.current);orig.remove.call(this,element)}}}},{"../../utils/mixin":40,util:63}],20:[function(require,module,exports){"use strict";var Mixin=require("../../utils/mixin"),Tokenizer=require("../../tokenizer"),LocationInfoTokenizerMixin=require("./tokenizer_mixin"),PositionTrackingPreprocessorMixin=require("../position_tracking/preprocessor_mixin"),LocationInfoOpenElementStackMixin=require("./open_element_stack_mixin"),HTML=require("../../common/html"),inherits=require("util").inherits;var $=HTML.TAG_NAMES;var LocationInfoParserMixin=module.exports=function(parser){Mixin.call(this,parser);this.parser=parser;this.posTracker=null;this.lastStartTagToken=null;this.lastFosterParentingLocation=null;this.currentToken=null};inherits(LocationInfoParserMixin,Mixin);LocationInfoParserMixin.prototype._setStartLocation=function(element){if(this.lastStartTagToken){element.__location=Object.create(this.lastStartTagToken.location);element.__location.startTag=this.lastStartTagToken.location}else element.__location=null};LocationInfoParserMixin.prototype._setEndLocation=function(element,closingToken){var loc=element.__location;if(loc){if(closingToken.location){var ctLoc=closingToken.location,tn=this.parser.treeAdapter.getTagName(element);var isClosingEndTag=closingToken.type===Tokenizer.END_TAG_TOKEN&&tn===closingToken.tagName;if(isClosingEndTag){loc.endTag=Object.create(ctLoc);loc.endOffset=ctLoc.endOffset}else loc.endOffset=ctLoc.startOffset}else if(closingToken.type===Tokenizer.EOF_TOKEN)loc.endOffset=this.posTracker.offset}};LocationInfoParserMixin.prototype._getOverriddenMethods=function(mxn,orig){return{_bootstrap:function(document,fragmentContext){orig._bootstrap.call(this,document,fragmentContext);mxn.lastStartTagToken=null;mxn.lastFosterParentingLocation=null;mxn.currentToken=null;mxn.posTracker=new PositionTrackingPreprocessorMixin(this.tokenizer.preprocessor);new LocationInfoTokenizerMixin(this.tokenizer);new LocationInfoOpenElementStackMixin(this.openElements,{onItemPop:function(element){mxn._setEndLocation(element,mxn.currentToken)}})},_runParsingLoop:function(scriptHandler){orig._runParsingLoop.call(this,scriptHandler);for(var i=this.openElements.stackTop;i>=0;i--)mxn._setEndLocation(this.openElements.items[i],mxn.currentToken)},_processTokenInForeignContent:function(token){mxn.currentToken=token;orig._processTokenInForeignContent.call(this,token)},_processToken:function(token){mxn.currentToken=token;orig._processToken.call(this,token);var requireExplicitUpdate=token.type===Tokenizer.END_TAG_TOKEN&&(token.tagName===$.HTML||token.tagName===$.BODY&&this.openElements.hasInScope($.BODY));if(requireExplicitUpdate){for(var i=this.openElements.stackTop;i>=0;i--){var element=this.openElements.items[i];if(this.treeAdapter.getTagName(element)===token.tagName){mxn._setEndLocation(element,token);break}}}},_setDocumentType:function(token){orig._setDocumentType.call(this,token);var documentChildren=this.treeAdapter.getChildNodes(this.document),cnLength=documentChildren.length;for(var i=0;i=NOAH_ARK_CAPACITY){var neAttrsLength=this.treeAdapter.getAttrList(newElement).length,neTagName=this.treeAdapter.getTagName(newElement),neNamespaceURI=this.treeAdapter.getNamespaceURI(newElement);for(var i=this.length-1;i>=0;i--){var entry=this.entries[i];if(entry.type===FormattingElementList.MARKER_ENTRY)break;var element=entry.element,elementAttrs=this.treeAdapter.getAttrList(element),isCandidate=this.treeAdapter.getTagName(element)===neTagName&&this.treeAdapter.getNamespaceURI(element)===neNamespaceURI&&elementAttrs.length===neAttrsLength;if(isCandidate)candidates.push({idx:i,attrs:elementAttrs})}}return candidates.length=NOAH_ARK_CAPACITY-1;i--){this.entries.splice(candidates[i].idx,1);this.length--}}};FormattingElementList.prototype.insertMarker=function(){this.entries.push({type:FormattingElementList.MARKER_ENTRY});this.length++};FormattingElementList.prototype.pushElement=function(element,token){this._ensureNoahArkCondition(element);this.entries.push({type:FormattingElementList.ELEMENT_ENTRY,element:element,token:token});this.length++};FormattingElementList.prototype.insertElementAfterBookmark=function(element,token){var bookmarkIdx=this.length-1;for(;bookmarkIdx>=0;bookmarkIdx--){if(this.entries[bookmarkIdx]===this.bookmark)break}this.entries.splice(bookmarkIdx+1,0,{type:FormattingElementList.ELEMENT_ENTRY,element:element,token:token});this.length++};FormattingElementList.prototype.removeEntry=function(entry){for(var i=this.length-1;i>=0;i--){if(this.entries[i]===entry){this.entries.splice(i,1);this.length--;break}}};FormattingElementList.prototype.clearToLastMarker=function(){while(this.length){var entry=this.entries.pop();this.length--;if(entry.type===FormattingElementList.MARKER_ENTRY)break}};FormattingElementList.prototype.getElementEntryInScopeWithTagName=function(tagName){for(var i=this.length-1;i>=0;i--){var entry=this.entries[i];if(entry.type===FormattingElementList.MARKER_ENTRY)return null;if(this.treeAdapter.getTagName(entry.element)===tagName)return entry}return null};FormattingElementList.prototype.getElementEntry=function(element){for(var i=this.length-1;i>=0;i--){var entry=this.entries[i];if(entry.type===FormattingElementList.ELEMENT_ENTRY&&entry.element===element)return entry}return null}},{}],25:[function(require,module,exports){"use strict";var Tokenizer=require("../tokenizer"),OpenElementStack=require("./open_element_stack"),FormattingElementList=require("./formatting_element_list"),LocationInfoParserMixin=require("../extensions/location_info/parser_mixin"),defaultTreeAdapter=require("../tree_adapters/default"),mergeOptions=require("../utils/merge_options"),doctype=require("../common/doctype"),foreignContent=require("../common/foreign_content"),UNICODE=require("../common/unicode"),HTML=require("../common/html");var $=HTML.TAG_NAMES,NS=HTML.NAMESPACES,ATTRS=HTML.ATTRS;var DEFAULT_OPTIONS={locationInfo:false,treeAdapter:defaultTreeAdapter};var HIDDEN_INPUT_TYPE="hidden";var AA_OUTER_LOOP_ITER=8,AA_INNER_LOOP_ITER=3;var INITIAL_MODE="INITIAL_MODE",BEFORE_HTML_MODE="BEFORE_HTML_MODE",BEFORE_HEAD_MODE="BEFORE_HEAD_MODE",IN_HEAD_MODE="IN_HEAD_MODE",AFTER_HEAD_MODE="AFTER_HEAD_MODE",IN_BODY_MODE="IN_BODY_MODE",TEXT_MODE="TEXT_MODE",IN_TABLE_MODE="IN_TABLE_MODE",IN_TABLE_TEXT_MODE="IN_TABLE_TEXT_MODE",IN_CAPTION_MODE="IN_CAPTION_MODE",IN_COLUMN_GROUP_MODE="IN_COLUMN_GROUP_MODE",IN_TABLE_BODY_MODE="IN_TABLE_BODY_MODE",IN_ROW_MODE="IN_ROW_MODE",IN_CELL_MODE="IN_CELL_MODE",IN_SELECT_MODE="IN_SELECT_MODE",IN_SELECT_IN_TABLE_MODE="IN_SELECT_IN_TABLE_MODE",IN_TEMPLATE_MODE="IN_TEMPLATE_MODE",AFTER_BODY_MODE="AFTER_BODY_MODE",IN_FRAMESET_MODE="IN_FRAMESET_MODE",AFTER_FRAMESET_MODE="AFTER_FRAMESET_MODE",AFTER_AFTER_BODY_MODE="AFTER_AFTER_BODY_MODE",AFTER_AFTER_FRAMESET_MODE="AFTER_AFTER_FRAMESET_MODE";var INSERTION_MODE_RESET_MAP=Object.create(null);INSERTION_MODE_RESET_MAP[$.TR]=IN_ROW_MODE;INSERTION_MODE_RESET_MAP[$.TBODY]=INSERTION_MODE_RESET_MAP[$.THEAD]=INSERTION_MODE_RESET_MAP[$.TFOOT]=IN_TABLE_BODY_MODE;INSERTION_MODE_RESET_MAP[$.CAPTION]=IN_CAPTION_MODE;INSERTION_MODE_RESET_MAP[$.COLGROUP]=IN_COLUMN_GROUP_MODE;INSERTION_MODE_RESET_MAP[$.TABLE]=IN_TABLE_MODE;INSERTION_MODE_RESET_MAP[$.BODY]=IN_BODY_MODE;INSERTION_MODE_RESET_MAP[$.FRAMESET]=IN_FRAMESET_MODE;var TEMPLATE_INSERTION_MODE_SWITCH_MAP=Object.create(null);TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.CAPTION]=TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.COLGROUP]=TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TBODY]=TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TFOOT]=TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.THEAD]=IN_TABLE_MODE;TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.COL]=IN_COLUMN_GROUP_MODE;TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TR]=IN_TABLE_BODY_MODE;TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TD]=TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TH]=IN_ROW_MODE;var _=Object.create(null);_[INITIAL_MODE]=Object.create(null);_[INITIAL_MODE][Tokenizer.CHARACTER_TOKEN]=_[INITIAL_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=tokenInInitialMode;_[INITIAL_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=ignoreToken;_[INITIAL_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[INITIAL_MODE][Tokenizer.DOCTYPE_TOKEN]=doctypeInInitialMode;_[INITIAL_MODE][Tokenizer.START_TAG_TOKEN]=_[INITIAL_MODE][Tokenizer.END_TAG_TOKEN]=_[INITIAL_MODE][Tokenizer.EOF_TOKEN]=tokenInInitialMode;_[BEFORE_HTML_MODE]=Object.create(null);_[BEFORE_HTML_MODE][Tokenizer.CHARACTER_TOKEN]=_[BEFORE_HTML_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=tokenBeforeHtml;_[BEFORE_HTML_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=ignoreToken;_[BEFORE_HTML_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[BEFORE_HTML_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[BEFORE_HTML_MODE][Tokenizer.START_TAG_TOKEN]=startTagBeforeHtml;_[BEFORE_HTML_MODE][Tokenizer.END_TAG_TOKEN]=endTagBeforeHtml;_[BEFORE_HTML_MODE][Tokenizer.EOF_TOKEN]=tokenBeforeHtml;_[BEFORE_HEAD_MODE]=Object.create(null);_[BEFORE_HEAD_MODE][Tokenizer.CHARACTER_TOKEN]=_[BEFORE_HEAD_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=tokenBeforeHead;_[BEFORE_HEAD_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=ignoreToken;_[BEFORE_HEAD_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[BEFORE_HEAD_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[BEFORE_HEAD_MODE][Tokenizer.START_TAG_TOKEN]=startTagBeforeHead;_[BEFORE_HEAD_MODE][Tokenizer.END_TAG_TOKEN]=endTagBeforeHead;_[BEFORE_HEAD_MODE][Tokenizer.EOF_TOKEN]=tokenBeforeHead;_[IN_HEAD_MODE]=Object.create(null);_[IN_HEAD_MODE][Tokenizer.CHARACTER_TOKEN]=_[IN_HEAD_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=tokenInHead;_[IN_HEAD_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=insertCharacters;_[IN_HEAD_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_HEAD_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_HEAD_MODE][Tokenizer.START_TAG_TOKEN]=startTagInHead;_[IN_HEAD_MODE][Tokenizer.END_TAG_TOKEN]=endTagInHead;_[IN_HEAD_MODE][Tokenizer.EOF_TOKEN]=tokenInHead;_[AFTER_HEAD_MODE]=Object.create(null);_[AFTER_HEAD_MODE][Tokenizer.CHARACTER_TOKEN]=_[AFTER_HEAD_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=tokenAfterHead;_[AFTER_HEAD_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=insertCharacters;_[AFTER_HEAD_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[AFTER_HEAD_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[AFTER_HEAD_MODE][Tokenizer.START_TAG_TOKEN]=startTagAfterHead;_[AFTER_HEAD_MODE][Tokenizer.END_TAG_TOKEN]=endTagAfterHead;_[AFTER_HEAD_MODE][Tokenizer.EOF_TOKEN]=tokenAfterHead;_[IN_BODY_MODE]=Object.create(null);_[IN_BODY_MODE][Tokenizer.CHARACTER_TOKEN]=characterInBody;_[IN_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[IN_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=whitespaceCharacterInBody;_[IN_BODY_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_BODY_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_BODY_MODE][Tokenizer.START_TAG_TOKEN]=startTagInBody;_[IN_BODY_MODE][Tokenizer.END_TAG_TOKEN]=endTagInBody;_[IN_BODY_MODE][Tokenizer.EOF_TOKEN]=eofInBody;_[TEXT_MODE]=Object.create(null);_[TEXT_MODE][Tokenizer.CHARACTER_TOKEN]=_[TEXT_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=_[TEXT_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=insertCharacters;_[TEXT_MODE][Tokenizer.COMMENT_TOKEN]=_[TEXT_MODE][Tokenizer.DOCTYPE_TOKEN]=_[TEXT_MODE][Tokenizer.START_TAG_TOKEN]=ignoreToken;_[TEXT_MODE][Tokenizer.END_TAG_TOKEN]=endTagInText;_[TEXT_MODE][Tokenizer.EOF_TOKEN]=eofInText;_[IN_TABLE_MODE]=Object.create(null);_[IN_TABLE_MODE][Tokenizer.CHARACTER_TOKEN]=_[IN_TABLE_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=_[IN_TABLE_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=characterInTable;_[IN_TABLE_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_TABLE_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_TABLE_MODE][Tokenizer.START_TAG_TOKEN]=startTagInTable;_[IN_TABLE_MODE][Tokenizer.END_TAG_TOKEN]=endTagInTable;_[IN_TABLE_MODE][Tokenizer.EOF_TOKEN]=eofInBody;_[IN_TABLE_TEXT_MODE]=Object.create(null);_[IN_TABLE_TEXT_MODE][Tokenizer.CHARACTER_TOKEN]=characterInTableText;_[IN_TABLE_TEXT_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[IN_TABLE_TEXT_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=whitespaceCharacterInTableText;_[IN_TABLE_TEXT_MODE][Tokenizer.COMMENT_TOKEN]=_[IN_TABLE_TEXT_MODE][Tokenizer.DOCTYPE_TOKEN]=_[IN_TABLE_TEXT_MODE][Tokenizer.START_TAG_TOKEN]=_[IN_TABLE_TEXT_MODE][Tokenizer.END_TAG_TOKEN]=_[IN_TABLE_TEXT_MODE][Tokenizer.EOF_TOKEN]=tokenInTableText;_[IN_CAPTION_MODE]=Object.create(null);_[IN_CAPTION_MODE][Tokenizer.CHARACTER_TOKEN]=characterInBody;_[IN_CAPTION_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[IN_CAPTION_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=whitespaceCharacterInBody;_[IN_CAPTION_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_CAPTION_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_CAPTION_MODE][Tokenizer.START_TAG_TOKEN]=startTagInCaption;_[IN_CAPTION_MODE][Tokenizer.END_TAG_TOKEN]=endTagInCaption;_[IN_CAPTION_MODE][Tokenizer.EOF_TOKEN]=eofInBody;_[IN_COLUMN_GROUP_MODE]=Object.create(null);_[IN_COLUMN_GROUP_MODE][Tokenizer.CHARACTER_TOKEN]=_[IN_COLUMN_GROUP_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=tokenInColumnGroup;_[IN_COLUMN_GROUP_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=insertCharacters;_[IN_COLUMN_GROUP_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_COLUMN_GROUP_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_COLUMN_GROUP_MODE][Tokenizer.START_TAG_TOKEN]=startTagInColumnGroup;_[IN_COLUMN_GROUP_MODE][Tokenizer.END_TAG_TOKEN]=endTagInColumnGroup;_[IN_COLUMN_GROUP_MODE][Tokenizer.EOF_TOKEN]=eofInBody;_[IN_TABLE_BODY_MODE]=Object.create(null);_[IN_TABLE_BODY_MODE][Tokenizer.CHARACTER_TOKEN]=_[IN_TABLE_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=_[IN_TABLE_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=characterInTable;_[IN_TABLE_BODY_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_TABLE_BODY_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_TABLE_BODY_MODE][Tokenizer.START_TAG_TOKEN]=startTagInTableBody;_[IN_TABLE_BODY_MODE][Tokenizer.END_TAG_TOKEN]=endTagInTableBody;_[IN_TABLE_BODY_MODE][Tokenizer.EOF_TOKEN]=eofInBody;_[IN_ROW_MODE]=Object.create(null);_[IN_ROW_MODE][Tokenizer.CHARACTER_TOKEN]=_[IN_ROW_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=_[IN_ROW_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=characterInTable;_[IN_ROW_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_ROW_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_ROW_MODE][Tokenizer.START_TAG_TOKEN]=startTagInRow;_[IN_ROW_MODE][Tokenizer.END_TAG_TOKEN]=endTagInRow;_[IN_ROW_MODE][Tokenizer.EOF_TOKEN]=eofInBody;_[IN_CELL_MODE]=Object.create(null);_[IN_CELL_MODE][Tokenizer.CHARACTER_TOKEN]=characterInBody;_[IN_CELL_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[IN_CELL_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=whitespaceCharacterInBody;_[IN_CELL_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_CELL_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_CELL_MODE][Tokenizer.START_TAG_TOKEN]=startTagInCell;_[IN_CELL_MODE][Tokenizer.END_TAG_TOKEN]=endTagInCell;_[IN_CELL_MODE][Tokenizer.EOF_TOKEN]=eofInBody;_[IN_SELECT_MODE]=Object.create(null);_[IN_SELECT_MODE][Tokenizer.CHARACTER_TOKEN]=insertCharacters;_[IN_SELECT_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[IN_SELECT_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=insertCharacters;_[IN_SELECT_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_SELECT_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_SELECT_MODE][Tokenizer.START_TAG_TOKEN]=startTagInSelect;_[IN_SELECT_MODE][Tokenizer.END_TAG_TOKEN]=endTagInSelect;_[IN_SELECT_MODE][Tokenizer.EOF_TOKEN]=eofInBody;_[IN_SELECT_IN_TABLE_MODE]=Object.create(null);_[IN_SELECT_IN_TABLE_MODE][Tokenizer.CHARACTER_TOKEN]=insertCharacters;_[IN_SELECT_IN_TABLE_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[IN_SELECT_IN_TABLE_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=insertCharacters;_[IN_SELECT_IN_TABLE_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_SELECT_IN_TABLE_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_SELECT_IN_TABLE_MODE][Tokenizer.START_TAG_TOKEN]=startTagInSelectInTable;_[IN_SELECT_IN_TABLE_MODE][Tokenizer.END_TAG_TOKEN]=endTagInSelectInTable;_[IN_SELECT_IN_TABLE_MODE][Tokenizer.EOF_TOKEN]=eofInBody;_[IN_TEMPLATE_MODE]=Object.create(null);_[IN_TEMPLATE_MODE][Tokenizer.CHARACTER_TOKEN]=characterInBody;_[IN_TEMPLATE_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[IN_TEMPLATE_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=whitespaceCharacterInBody;_[IN_TEMPLATE_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_TEMPLATE_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_TEMPLATE_MODE][Tokenizer.START_TAG_TOKEN]=startTagInTemplate;_[IN_TEMPLATE_MODE][Tokenizer.END_TAG_TOKEN]=endTagInTemplate;_[IN_TEMPLATE_MODE][Tokenizer.EOF_TOKEN]=eofInTemplate;_[AFTER_BODY_MODE]=Object.create(null);_[AFTER_BODY_MODE][Tokenizer.CHARACTER_TOKEN]=_[AFTER_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=tokenAfterBody;_[AFTER_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=whitespaceCharacterInBody;_[AFTER_BODY_MODE][Tokenizer.COMMENT_TOKEN]=appendCommentToRootHtmlElement;_[AFTER_BODY_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[AFTER_BODY_MODE][Tokenizer.START_TAG_TOKEN]=startTagAfterBody;_[AFTER_BODY_MODE][Tokenizer.END_TAG_TOKEN]=endTagAfterBody;_[AFTER_BODY_MODE][Tokenizer.EOF_TOKEN]=stopParsing;_[IN_FRAMESET_MODE]=Object.create(null);_[IN_FRAMESET_MODE][Tokenizer.CHARACTER_TOKEN]=_[IN_FRAMESET_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[IN_FRAMESET_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=insertCharacters;_[IN_FRAMESET_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[IN_FRAMESET_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[IN_FRAMESET_MODE][Tokenizer.START_TAG_TOKEN]=startTagInFrameset;_[IN_FRAMESET_MODE][Tokenizer.END_TAG_TOKEN]=endTagInFrameset;_[IN_FRAMESET_MODE][Tokenizer.EOF_TOKEN]=stopParsing;_[AFTER_FRAMESET_MODE]=Object.create(null);_[AFTER_FRAMESET_MODE][Tokenizer.CHARACTER_TOKEN]=_[AFTER_FRAMESET_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[AFTER_FRAMESET_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=insertCharacters;_[AFTER_FRAMESET_MODE][Tokenizer.COMMENT_TOKEN]=appendComment;_[AFTER_FRAMESET_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[AFTER_FRAMESET_MODE][Tokenizer.START_TAG_TOKEN]=startTagAfterFrameset;_[AFTER_FRAMESET_MODE][Tokenizer.END_TAG_TOKEN]=endTagAfterFrameset;_[AFTER_FRAMESET_MODE][Tokenizer.EOF_TOKEN]=stopParsing;_[AFTER_AFTER_BODY_MODE]=Object.create(null);_[AFTER_AFTER_BODY_MODE][Tokenizer.CHARACTER_TOKEN]=tokenAfterAfterBody;_[AFTER_AFTER_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=tokenAfterAfterBody;_[AFTER_AFTER_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=whitespaceCharacterInBody;_[AFTER_AFTER_BODY_MODE][Tokenizer.COMMENT_TOKEN]=appendCommentToDocument;_[AFTER_AFTER_BODY_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[AFTER_AFTER_BODY_MODE][Tokenizer.START_TAG_TOKEN]=startTagAfterAfterBody;_[AFTER_AFTER_BODY_MODE][Tokenizer.END_TAG_TOKEN]=tokenAfterAfterBody;_[AFTER_AFTER_BODY_MODE][Tokenizer.EOF_TOKEN]=stopParsing;_[AFTER_AFTER_FRAMESET_MODE]=Object.create(null);_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.CHARACTER_TOKEN]=_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.NULL_CHARACTER_TOKEN]=ignoreToken;_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN]=whitespaceCharacterInBody;_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.COMMENT_TOKEN]=appendCommentToDocument;_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.DOCTYPE_TOKEN]=ignoreToken;_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.START_TAG_TOKEN]=startTagAfterAfterFrameset;_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.END_TAG_TOKEN]=ignoreToken;_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.EOF_TOKEN]=stopParsing;var Parser=module.exports=function(options){this.options=mergeOptions(DEFAULT_OPTIONS,options);this.treeAdapter=this.options.treeAdapter;this.pendingScript=null;if(this.options.locationInfo)new LocationInfoParserMixin(this)};Parser.prototype.parse=function(html){var document=this.treeAdapter.createDocument();this._bootstrap(document,null);this.tokenizer.write(html,true);this._runParsingLoop(null);return document};Parser.prototype.parseFragment=function(html,fragmentContext){if(!fragmentContext)fragmentContext=this.treeAdapter.createElement($.TEMPLATE,NS.HTML,[]);var documentMock=this.treeAdapter.createElement("documentmock",NS.HTML,[]);this._bootstrap(documentMock,fragmentContext);if(this.treeAdapter.getTagName(fragmentContext)===$.TEMPLATE)this._pushTmplInsertionMode(IN_TEMPLATE_MODE);this._initTokenizerForFragmentParsing();this._insertFakeRootElement();this._resetInsertionMode();this._findFormInFragmentContext();this.tokenizer.write(html,true);this._runParsingLoop(null);var rootElement=this.treeAdapter.getFirstChild(documentMock),fragment=this.treeAdapter.createDocumentFragment();this._adoptNodes(rootElement,fragment);return fragment};Parser.prototype._bootstrap=function(document,fragmentContext){this.tokenizer=new Tokenizer(this.options);this.stopped=false;this.insertionMode=INITIAL_MODE;this.originalInsertionMode="";this.document=document;this.fragmentContext=fragmentContext;this.headElement=null;this.formElement=null;this.openElements=new OpenElementStack(this.document,this.treeAdapter);this.activeFormattingElements=new FormattingElementList(this.treeAdapter);this.tmplInsertionModeStack=[];this.tmplInsertionModeStackTop=-1;this.currentTmplInsertionMode=null;this.pendingCharacterTokens=[];this.hasNonWhitespacePendingCharacterToken=false;this.framesetOk=true;this.skipNextNewLine=false;this.fosterParentingEnabled=false};Parser.prototype._runParsingLoop=function(scriptHandler){while(!this.stopped){this._setupTokenizerCDATAMode();var token=this.tokenizer.getNextToken();if(token.type===Tokenizer.HIBERNATION_TOKEN)break;if(this.skipNextNewLine){this.skipNextNewLine=false;if(token.type===Tokenizer.WHITESPACE_CHARACTER_TOKEN&&token.chars[0]==="\n"){if(token.chars.length===1)continue;token.chars=token.chars.substr(1)}}this._processInputToken(token);if(scriptHandler&&this.pendingScript)break}};Parser.prototype.runParsingLoopForCurrentChunk=function(writeCallback,scriptHandler){this._runParsingLoop(scriptHandler);if(scriptHandler&&this.pendingScript){var script=this.pendingScript;this.pendingScript=null;scriptHandler(script);return}if(writeCallback)writeCallback()};Parser.prototype._setupTokenizerCDATAMode=function(){var current=this._getAdjustedCurrentElement();this.tokenizer.allowCDATA=current&¤t!==this.document&&this.treeAdapter.getNamespaceURI(current)!==NS.HTML&&!this._isIntegrationPoint(current)};Parser.prototype._switchToTextParsing=function(currentToken,nextTokenizerState){this._insertElement(currentToken,NS.HTML);this.tokenizer.state=nextTokenizerState;this.originalInsertionMode=this.insertionMode;this.insertionMode=TEXT_MODE};Parser.prototype.switchToPlaintextParsing=function(){this.insertionMode=TEXT_MODE;this.originalInsertionMode=IN_BODY_MODE;this.tokenizer.state=Tokenizer.MODE.PLAINTEXT};Parser.prototype._getAdjustedCurrentElement=function(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current};Parser.prototype._findFormInFragmentContext=function(){var node=this.fragmentContext;do{if(this.treeAdapter.getTagName(node)===$.FORM){this.formElement=node;break}node=this.treeAdapter.getParentNode(node)}while(node)};Parser.prototype._initTokenizerForFragmentParsing=function(){if(this.treeAdapter.getNamespaceURI(this.fragmentContext)===NS.HTML){var tn=this.treeAdapter.getTagName(this.fragmentContext);if(tn===$.TITLE||tn===$.TEXTAREA)this.tokenizer.state=Tokenizer.MODE.RCDATA;else if(tn===$.STYLE||tn===$.XMP||tn===$.IFRAME||tn===$.NOEMBED||tn===$.NOFRAMES||tn===$.NOSCRIPT)this.tokenizer.state=Tokenizer.MODE.RAWTEXT;else if(tn===$.SCRIPT)this.tokenizer.state=Tokenizer.MODE.SCRIPT_DATA;else if(tn===$.PLAINTEXT)this.tokenizer.state=Tokenizer.MODE.PLAINTEXT}};Parser.prototype._setDocumentType=function(token){this.treeAdapter.setDocumentType(this.document,token.name,token.publicId,token.systemId)};Parser.prototype._attachElementToTree=function(element){if(this._shouldFosterParentOnInsertion())this._fosterParentElement(element);else{var parent=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.appendChild(parent,element)}};Parser.prototype._appendElement=function(token,namespaceURI){var element=this.treeAdapter.createElement(token.tagName,namespaceURI,token.attrs);this._attachElementToTree(element)};Parser.prototype._insertElement=function(token,namespaceURI){var element=this.treeAdapter.createElement(token.tagName,namespaceURI,token.attrs);this._attachElementToTree(element);this.openElements.push(element)};Parser.prototype._insertFakeElement=function(tagName){var element=this.treeAdapter.createElement(tagName,NS.HTML,[]);this._attachElementToTree(element);this.openElements.push(element)};Parser.prototype._insertTemplate=function(token){var tmpl=this.treeAdapter.createElement(token.tagName,NS.HTML,token.attrs),content=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(tmpl,content);this._attachElementToTree(tmpl);this.openElements.push(tmpl)};Parser.prototype._insertFakeRootElement=function(){var element=this.treeAdapter.createElement($.HTML,NS.HTML,[]);this.treeAdapter.appendChild(this.openElements.current,element);this.openElements.push(element)};Parser.prototype._appendCommentNode=function(token,parent){var commentNode=this.treeAdapter.createCommentNode(token.data);this.treeAdapter.appendChild(parent,commentNode)};Parser.prototype._insertCharacters=function(token){if(this._shouldFosterParentOnInsertion())this._fosterParentText(token.chars);else{var parent=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.insertText(parent,token.chars)}};Parser.prototype._adoptNodes=function(donor,recipient){while(true){var child=this.treeAdapter.getFirstChild(donor);if(!child)break;this.treeAdapter.detachNode(child);this.treeAdapter.appendChild(recipient,child)}};Parser.prototype._shouldProcessTokenInForeignContent=function(token){var current=this._getAdjustedCurrentElement();if(!current||current===this.document)return false;var ns=this.treeAdapter.getNamespaceURI(current);if(ns===NS.HTML)return false;if(this.treeAdapter.getTagName(current)===$.ANNOTATION_XML&&ns===NS.MATHML&&token.type===Tokenizer.START_TAG_TOKEN&&token.tagName===$.SVG)return false;var isCharacterToken=token.type===Tokenizer.CHARACTER_TOKEN||token.type===Tokenizer.NULL_CHARACTER_TOKEN||token.type===Tokenizer.WHITESPACE_CHARACTER_TOKEN,isMathMLTextStartTag=token.type===Tokenizer.START_TAG_TOKEN&&token.tagName!==$.MGLYPH&&token.tagName!==$.MALIGNMARK;if((isMathMLTextStartTag||isCharacterToken)&&this._isIntegrationPoint(current,NS.MATHML))return false;if((token.type===Tokenizer.START_TAG_TOKEN||isCharacterToken)&&this._isIntegrationPoint(current,NS.HTML))return false;return token.type!==Tokenizer.EOF_TOKEN};Parser.prototype._processToken=function(token){_[this.insertionMode][token.type](this,token)};Parser.prototype._processTokenInBodyMode=function(token){_[IN_BODY_MODE][token.type](this,token)};Parser.prototype._processTokenInForeignContent=function(token){if(token.type===Tokenizer.CHARACTER_TOKEN)characterInForeignContent(this,token);else if(token.type===Tokenizer.NULL_CHARACTER_TOKEN)nullCharacterInForeignContent(this,token);else if(token.type===Tokenizer.WHITESPACE_CHARACTER_TOKEN)insertCharacters(this,token);else if(token.type===Tokenizer.COMMENT_TOKEN)appendComment(this,token);else if(token.type===Tokenizer.START_TAG_TOKEN)startTagInForeignContent(this,token);else if(token.type===Tokenizer.END_TAG_TOKEN)endTagInForeignContent(this,token)};Parser.prototype._processInputToken=function(token){if(this._shouldProcessTokenInForeignContent(token))this._processTokenInForeignContent(token);else this._processToken(token)};Parser.prototype._isIntegrationPoint=function(element,foreignNS){var tn=this.treeAdapter.getTagName(element),ns=this.treeAdapter.getNamespaceURI(element),attrs=this.treeAdapter.getAttrList(element);return foreignContent.isIntegrationPoint(tn,ns,attrs,foreignNS)};Parser.prototype._reconstructActiveFormattingElements=function(){var listLength=this.activeFormattingElements.length;if(listLength){var unopenIdx=listLength,entry=null;do{unopenIdx--;entry=this.activeFormattingElements.entries[unopenIdx];if(entry.type===FormattingElementList.MARKER_ENTRY||this.openElements.contains(entry.element)){unopenIdx++;break}}while(unopenIdx>0);for(var i=unopenIdx;i=0;i--){var element=this.openElements.items[i];if(i===0){last=true;if(this.fragmentContext)element=this.fragmentContext}var tn=this.treeAdapter.getTagName(element),newInsertionMode=INSERTION_MODE_RESET_MAP[tn];if(newInsertionMode){this.insertionMode=newInsertionMode;break}else if(!last&&(tn===$.TD||tn===$.TH)){this.insertionMode=IN_CELL_MODE;break}else if(!last&&tn===$.HEAD){this.insertionMode=IN_HEAD_MODE;break}else if(tn===$.SELECT){this._resetInsertionModeForSelect(i);break}else if(tn===$.TEMPLATE){this.insertionMode=this.currentTmplInsertionMode;break}else if(tn===$.HTML){this.insertionMode=this.headElement?AFTER_HEAD_MODE:BEFORE_HEAD_MODE;break}else if(last){this.insertionMode=IN_BODY_MODE;break}}};Parser.prototype._resetInsertionModeForSelect=function(selectIdx){if(selectIdx>0){for(var i=selectIdx-1;i>0;i--){var ancestor=this.openElements.items[i],tn=this.treeAdapter.getTagName(ancestor);if(tn===$.TEMPLATE)break;else if(tn===$.TABLE){this.insertionMode=IN_SELECT_IN_TABLE_MODE;return}}}this.insertionMode=IN_SELECT_MODE};Parser.prototype._pushTmplInsertionMode=function(mode){this.tmplInsertionModeStack.push(mode);this.tmplInsertionModeStackTop++;this.currentTmplInsertionMode=mode};Parser.prototype._popTmplInsertionMode=function(){this.tmplInsertionModeStack.pop();this.tmplInsertionModeStackTop--;this.currentTmplInsertionMode=this.tmplInsertionModeStack[this.tmplInsertionModeStackTop]};Parser.prototype._isElementCausesFosterParenting=function(element){var tn=this.treeAdapter.getTagName(element);return tn===$.TABLE||tn===$.TBODY||tn===$.TFOOT||tn===$.THEAD||tn===$.TR};Parser.prototype._shouldFosterParentOnInsertion=function(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.current)};Parser.prototype._findFosterParentingLocation=function(){var location={parent:null,beforeElement:null};for(var i=this.openElements.stackTop;i>=0;i--){var openElement=this.openElements.items[i],tn=this.treeAdapter.getTagName(openElement),ns=this.treeAdapter.getNamespaceURI(openElement);if(tn===$.TEMPLATE&&ns===NS.HTML){location.parent=this.treeAdapter.getTemplateContent(openElement);break}else if(tn===$.TABLE){location.parent=this.treeAdapter.getParentNode(openElement);if(location.parent)location.beforeElement=openElement;else location.parent=this.openElements.items[i-1];break}}if(!location.parent)location.parent=this.openElements.items[0];return location};Parser.prototype._fosterParentElement=function(element){var location=this._findFosterParentingLocation();if(location.beforeElement)this.treeAdapter.insertBefore(location.parent,element,location.beforeElement);else this.treeAdapter.appendChild(location.parent,element)};Parser.prototype._fosterParentText=function(chars){var location=this._findFosterParentingLocation();if(location.beforeElement)this.treeAdapter.insertTextBefore(location.parent,chars,location.beforeElement);else this.treeAdapter.insertText(location.parent,chars)};Parser.prototype._isSpecialElement=function(element){var tn=this.treeAdapter.getTagName(element),ns=this.treeAdapter.getNamespaceURI(element);return HTML.SPECIAL_ELEMENTS[ns][tn]};function aaObtainFormattingElementEntry(p,token){var formattingElementEntry=p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName);if(formattingElementEntry){if(!p.openElements.contains(formattingElementEntry.element)){p.activeFormattingElements.removeEntry(formattingElementEntry);formattingElementEntry=null}else if(!p.openElements.hasInScope(token.tagName))formattingElementEntry=null}else genericEndTagInBody(p,token);return formattingElementEntry}function aaObtainFurthestBlock(p,formattingElementEntry){var furthestBlock=null;for(var i=p.openElements.stackTop;i>=0;i--){var element=p.openElements.items[i];if(element===formattingElementEntry.element)break;if(p._isSpecialElement(element))furthestBlock=element}if(!furthestBlock){p.openElements.popUntilElementPopped(formattingElementEntry.element);p.activeFormattingElements.removeEntry(formattingElementEntry)}return furthestBlock}function aaInnerLoop(p,furthestBlock,formattingElement){var lastElement=furthestBlock,nextElement=p.openElements.getCommonAncestor(furthestBlock);for(var i=0,element=nextElement;element!==formattingElement;i++,element=nextElement){nextElement=p.openElements.getCommonAncestor(element);var elementEntry=p.activeFormattingElements.getElementEntry(element),counterOverflow=elementEntry&&i>=AA_INNER_LOOP_ITER,shouldRemoveFromOpenElements=!elementEntry||counterOverflow;if(shouldRemoveFromOpenElements){if(counterOverflow)p.activeFormattingElements.removeEntry(elementEntry);p.openElements.remove(element)}else{element=aaRecreateElementFromEntry(p,elementEntry);if(lastElement===furthestBlock)p.activeFormattingElements.bookmark=elementEntry;p.treeAdapter.detachNode(lastElement);p.treeAdapter.appendChild(element,lastElement);lastElement=element}}return lastElement}function aaRecreateElementFromEntry(p,elementEntry){var ns=p.treeAdapter.getNamespaceURI(elementEntry.element),newElement=p.treeAdapter.createElement(elementEntry.token.tagName,ns,elementEntry.token.attrs);p.openElements.replace(elementEntry.element,newElement);elementEntry.element=newElement;return newElement}function aaInsertLastNodeInCommonAncestor(p,commonAncestor,lastElement){if(p._isElementCausesFosterParenting(commonAncestor))p._fosterParentElement(lastElement);else{var tn=p.treeAdapter.getTagName(commonAncestor),ns=p.treeAdapter.getNamespaceURI(commonAncestor);if(tn===$.TEMPLATE&&ns===NS.HTML)commonAncestor=p.treeAdapter.getTemplateContent(commonAncestor);p.treeAdapter.appendChild(commonAncestor,lastElement)}}function aaReplaceFormattingElement(p,furthestBlock,formattingElementEntry){var ns=p.treeAdapter.getNamespaceURI(formattingElementEntry.element),token=formattingElementEntry.token,newElement=p.treeAdapter.createElement(token.tagName,ns,token.attrs);p._adoptNodes(furthestBlock,newElement);p.treeAdapter.appendChild(furthestBlock,newElement);p.activeFormattingElements.insertElementAfterBookmark(newElement,formattingElementEntry.token);p.activeFormattingElements.removeEntry(formattingElementEntry);p.openElements.remove(formattingElementEntry.element);p.openElements.insertAfter(furthestBlock,newElement)}function callAdoptionAgency(p,token){var formattingElementEntry;for(var i=0;i0){p.openElements.generateImpliedEndTags();p.openElements.popUntilTagNamePopped($.TEMPLATE);p.activeFormattingElements.clearToLastMarker();p._popTmplInsertionMode();p._resetInsertionMode()}}function tokenInHead(p,token){p.openElements.pop();p.insertionMode=AFTER_HEAD_MODE;p._processToken(token)}function startTagAfterHead(p,token){var tn=token.tagName;if(tn===$.HTML)startTagInBody(p,token);else if(tn===$.BODY){p._insertElement(token,NS.HTML);p.framesetOk=false;p.insertionMode=IN_BODY_MODE}else if(tn===$.FRAMESET){p._insertElement(token,NS.HTML);p.insertionMode=IN_FRAMESET_MODE}else if(tn===$.BASE||tn===$.BASEFONT||tn===$.BGSOUND||tn===$.LINK||tn===$.META||tn===$.NOFRAMES||tn===$.SCRIPT||tn===$.STYLE||tn===$.TEMPLATE||tn===$.TITLE){p.openElements.push(p.headElement);startTagInHead(p,token);p.openElements.remove(p.headElement)}else if(tn!==$.HEAD)tokenAfterHead(p,token)}function endTagAfterHead(p,token){var tn=token.tagName;if(tn===$.BODY||tn===$.HTML||tn===$.BR)tokenAfterHead(p,token);else if(tn===$.TEMPLATE)endTagInHead(p,token)}function tokenAfterHead(p,token){p._insertFakeElement($.BODY);p.insertionMode=IN_BODY_MODE;p._processToken(token)}function whitespaceCharacterInBody(p,token){p._reconstructActiveFormattingElements();p._insertCharacters(token)}function characterInBody(p,token){p._reconstructActiveFormattingElements();p._insertCharacters(token);p.framesetOk=false}function htmlStartTagInBody(p,token){if(p.openElements.tmplCount===0)p.treeAdapter.adoptAttributes(p.openElements.items[0],token.attrs)}function bodyStartTagInBody(p,token){var bodyElement=p.openElements.tryPeekProperlyNestedBodyElement();if(bodyElement&&p.openElements.tmplCount===0){p.framesetOk=false;p.treeAdapter.adoptAttributes(bodyElement,token.attrs)}}function framesetStartTagInBody(p,token){var bodyElement=p.openElements.tryPeekProperlyNestedBodyElement();if(p.framesetOk&&bodyElement){p.treeAdapter.detachNode(bodyElement);p.openElements.popAllUpToHtmlElement();p._insertElement(token,NS.HTML);p.insertionMode=IN_FRAMESET_MODE}}function addressStartTagInBody(p,token){if(p.openElements.hasInButtonScope($.P))p._closePElement();p._insertElement(token,NS.HTML)}function numberedHeaderStartTagInBody(p,token){if(p.openElements.hasInButtonScope($.P))p._closePElement();var tn=p.openElements.currentTagName;if(tn===$.H1||tn===$.H2||tn===$.H3||tn===$.H4||tn===$.H5||tn===$.H6)p.openElements.pop();p._insertElement(token,NS.HTML)}function preStartTagInBody(p,token){if(p.openElements.hasInButtonScope($.P))p._closePElement();p._insertElement(token,NS.HTML);p.skipNextNewLine=true;p.framesetOk=false}function formStartTagInBody(p,token){var inTemplate=p.openElements.tmplCount>0;if(!p.formElement||inTemplate){if(p.openElements.hasInButtonScope($.P))p._closePElement();p._insertElement(token,NS.HTML);if(!inTemplate)p.formElement=p.openElements.current}}function listItemStartTagInBody(p,token){p.framesetOk=false;var tn=token.tagName;for(var i=p.openElements.stackTop;i>=0;i--){var element=p.openElements.items[i],elementTn=p.treeAdapter.getTagName(element),closeTn=null;if(tn===$.LI&&elementTn===$.LI)closeTn=$.LI;else if((tn===$.DD||tn===$.DT)&&(elementTn===$.DD||elementTn===$.DT))closeTn=elementTn;if(closeTn){p.openElements.generateImpliedEndTagsWithExclusion(closeTn);p.openElements.popUntilTagNamePopped(closeTn);break}if(elementTn!==$.ADDRESS&&elementTn!==$.DIV&&elementTn!==$.P&&p._isSpecialElement(element))break}if(p.openElements.hasInButtonScope($.P))p._closePElement();p._insertElement(token,NS.HTML)}function plaintextStartTagInBody(p,token){if(p.openElements.hasInButtonScope($.P))p._closePElement();p._insertElement(token,NS.HTML);p.tokenizer.state=Tokenizer.MODE.PLAINTEXT}function buttonStartTagInBody(p,token){if(p.openElements.hasInScope($.BUTTON)){p.openElements.generateImpliedEndTags();p.openElements.popUntilTagNamePopped($.BUTTON)}p._reconstructActiveFormattingElements();p._insertElement(token,NS.HTML);p.framesetOk=false}function aStartTagInBody(p,token){var activeElementEntry=p.activeFormattingElements.getElementEntryInScopeWithTagName($.A);if(activeElementEntry){callAdoptionAgency(p,token);p.openElements.remove(activeElementEntry.element);p.activeFormattingElements.removeEntry(activeElementEntry)}p._reconstructActiveFormattingElements();p._insertElement(token,NS.HTML);p.activeFormattingElements.pushElement(p.openElements.current,token)}function bStartTagInBody(p,token){p._reconstructActiveFormattingElements();p._insertElement(token,NS.HTML);p.activeFormattingElements.pushElement(p.openElements.current,token)}function nobrStartTagInBody(p,token){p._reconstructActiveFormattingElements();if(p.openElements.hasInScope($.NOBR)){callAdoptionAgency(p,token);p._reconstructActiveFormattingElements()}p._insertElement(token,NS.HTML);p.activeFormattingElements.pushElement(p.openElements.current,token)}function appletStartTagInBody(p,token){p._reconstructActiveFormattingElements();p._insertElement(token,NS.HTML);p.activeFormattingElements.insertMarker();p.framesetOk=false}function tableStartTagInBody(p,token){if(p.treeAdapter.getDocumentMode(p.document)!==HTML.DOCUMENT_MODE.QUIRKS&&p.openElements.hasInButtonScope($.P))p._closePElement();p._insertElement(token,NS.HTML);p.framesetOk=false;p.insertionMode=IN_TABLE_MODE}function areaStartTagInBody(p,token){p._reconstructActiveFormattingElements();p._appendElement(token,NS.HTML);p.framesetOk=false}function inputStartTagInBody(p,token){p._reconstructActiveFormattingElements();p._appendElement(token,NS.HTML);var inputType=Tokenizer.getTokenAttr(token,ATTRS.TYPE);if(!inputType||inputType.toLowerCase()!==HIDDEN_INPUT_TYPE)p.framesetOk=false}function paramStartTagInBody(p,token){p._appendElement(token,NS.HTML)}function hrStartTagInBody(p,token){if(p.openElements.hasInButtonScope($.P))p._closePElement();if(p.openElements.currentTagName===$.MENUITEM)p.openElements.pop();p._appendElement(token,NS.HTML);p.framesetOk=false}function imageStartTagInBody(p,token){token.tagName=$.IMG;areaStartTagInBody(p,token)}function textareaStartTagInBody(p,token){p._insertElement(token,NS.HTML);p.skipNextNewLine=true;p.tokenizer.state=Tokenizer.MODE.RCDATA;p.originalInsertionMode=p.insertionMode;p.framesetOk=false;p.insertionMode=TEXT_MODE}function xmpStartTagInBody(p,token){if(p.openElements.hasInButtonScope($.P))p._closePElement();p._reconstructActiveFormattingElements();p.framesetOk=false;p._switchToTextParsing(token,Tokenizer.MODE.RAWTEXT)}function iframeStartTagInBody(p,token){p.framesetOk=false;p._switchToTextParsing(token,Tokenizer.MODE.RAWTEXT)}function noembedStartTagInBody(p,token){p._switchToTextParsing(token,Tokenizer.MODE.RAWTEXT)}function selectStartTagInBody(p,token){p._reconstructActiveFormattingElements();p._insertElement(token,NS.HTML);p.framesetOk=false;if(p.insertionMode===IN_TABLE_MODE||p.insertionMode===IN_CAPTION_MODE||p.insertionMode===IN_TABLE_BODY_MODE||p.insertionMode===IN_ROW_MODE||p.insertionMode===IN_CELL_MODE)p.insertionMode=IN_SELECT_IN_TABLE_MODE;else p.insertionMode=IN_SELECT_MODE}function optgroupStartTagInBody(p,token){if(p.openElements.currentTagName===$.OPTION)p.openElements.pop();p._reconstructActiveFormattingElements();p._insertElement(token,NS.HTML)}function rbStartTagInBody(p,token){if(p.openElements.hasInScope($.RUBY))p.openElements.generateImpliedEndTags();p._insertElement(token,NS.HTML)}function rtStartTagInBody(p,token){if(p.openElements.hasInScope($.RUBY))p.openElements.generateImpliedEndTagsWithExclusion($.RTC);p._insertElement(token,NS.HTML)}function menuitemStartTagInBody(p,token){if(p.openElements.currentTagName===$.MENUITEM)p.openElements.pop();p._reconstructActiveFormattingElements();p._insertElement(token,NS.HTML)}function menuStartTagInBody(p,token){if(p.openElements.hasInButtonScope($.P))p._closePElement();if(p.openElements.currentTagName===$.MENUITEM)p.openElements.pop();p._insertElement(token,NS.HTML)}function mathStartTagInBody(p,token){p._reconstructActiveFormattingElements();foreignContent.adjustTokenMathMLAttrs(token);foreignContent.adjustTokenXMLAttrs(token);if(token.selfClosing)p._appendElement(token,NS.MATHML);else p._insertElement(token,NS.MATHML)}function svgStartTagInBody(p,token){p._reconstructActiveFormattingElements();foreignContent.adjustTokenSVGAttrs(token);foreignContent.adjustTokenXMLAttrs(token);if(token.selfClosing)p._appendElement(token,NS.SVG);else p._insertElement(token,NS.SVG)}function genericStartTagInBody(p,token){p._reconstructActiveFormattingElements();p._insertElement(token,NS.HTML)}function startTagInBody(p,token){var tn=token.tagName;switch(tn.length){case 1:if(tn===$.I||tn===$.S||tn===$.B||tn===$.U)bStartTagInBody(p,token);else if(tn===$.P)addressStartTagInBody(p,token);else if(tn===$.A)aStartTagInBody(p,token);else genericStartTagInBody(p,token);break;case 2:if(tn===$.DL||tn===$.OL||tn===$.UL)addressStartTagInBody(p,token);else if(tn===$.H1||tn===$.H2||tn===$.H3||tn===$.H4||tn===$.H5||tn===$.H6)numberedHeaderStartTagInBody(p,token);else if(tn===$.LI||tn===$.DD||tn===$.DT)listItemStartTagInBody(p,token);else if(tn===$.EM||tn===$.TT)bStartTagInBody(p,token);else if(tn===$.BR)areaStartTagInBody(p,token);else if(tn===$.HR)hrStartTagInBody(p,token);else if(tn===$.RB)rbStartTagInBody(p,token);else if(tn===$.RT||tn===$.RP)rtStartTagInBody(p,token);else if(tn!==$.TH&&tn!==$.TD&&tn!==$.TR)genericStartTagInBody(p,token);break;case 3:if(tn===$.DIV||tn===$.DIR||tn===$.NAV)addressStartTagInBody(p,token);else if(tn===$.PRE)preStartTagInBody(p,token);else if(tn===$.BIG)bStartTagInBody(p,token);else if(tn===$.IMG||tn===$.WBR)areaStartTagInBody(p,token);else if(tn===$.XMP)xmpStartTagInBody(p,token);else if(tn===$.SVG)svgStartTagInBody(p,token);else if(tn===$.RTC)rbStartTagInBody(p,token);else if(tn!==$.COL)genericStartTagInBody(p,token);break;case 4:if(tn===$.HTML)htmlStartTagInBody(p,token);else if(tn===$.BASE||tn===$.LINK||tn===$.META)startTagInHead(p,token);else if(tn===$.BODY)bodyStartTagInBody(p,token);else if(tn===$.MAIN)addressStartTagInBody(p,token);else if(tn===$.FORM)formStartTagInBody(p,token);else if(tn===$.CODE||tn===$.FONT)bStartTagInBody(p,token);else if(tn===$.NOBR)nobrStartTagInBody(p,token);else if(tn===$.AREA)areaStartTagInBody(p,token);else if(tn===$.MATH)mathStartTagInBody(p,token);else if(tn===$.MENU)menuStartTagInBody(p,token);else if(tn!==$.HEAD)genericStartTagInBody(p,token);break;case 5:if(tn===$.STYLE||tn===$.TITLE)startTagInHead(p,token);else if(tn===$.ASIDE)addressStartTagInBody(p,token);else if(tn===$.SMALL)bStartTagInBody(p,token);else if(tn===$.TABLE)tableStartTagInBody(p,token);else if(tn===$.EMBED)areaStartTagInBody(p,token);else if(tn===$.INPUT)inputStartTagInBody(p,token);else if(tn===$.PARAM||tn===$.TRACK)paramStartTagInBody(p,token);else if(tn===$.IMAGE)imageStartTagInBody(p,token);else if(tn!==$.FRAME&&tn!==$.TBODY&&tn!==$.TFOOT&&tn!==$.THEAD)genericStartTagInBody(p,token);break;case 6:if(tn===$.SCRIPT)startTagInHead(p,token);else if(tn===$.CENTER||tn===$.FIGURE||tn===$.FOOTER||tn===$.HEADER||tn===$.HGROUP)addressStartTagInBody(p,token);else if(tn===$.BUTTON)buttonStartTagInBody(p,token);else if(tn===$.STRIKE||tn===$.STRONG)bStartTagInBody(p,token);else if(tn===$.APPLET||tn===$.OBJECT)appletStartTagInBody(p,token);else if(tn===$.KEYGEN)areaStartTagInBody(p,token);else if(tn===$.SOURCE)paramStartTagInBody(p,token);else if(tn===$.IFRAME)iframeStartTagInBody(p,token);else if(tn===$.SELECT)selectStartTagInBody(p,token);else if(tn===$.OPTION)optgroupStartTagInBody(p,token);else genericStartTagInBody(p,token);break;case 7:if(tn===$.BGSOUND)startTagInHead(p,token);else if(tn===$.DETAILS||tn===$.ADDRESS||tn===$.ARTICLE||tn===$.SECTION||tn===$.SUMMARY)addressStartTagInBody(p,token);else if(tn===$.LISTING)preStartTagInBody(p,token);else if(tn===$.MARQUEE)appletStartTagInBody(p,token);else if(tn===$.NOEMBED)noembedStartTagInBody(p,token);else if(tn!==$.CAPTION)genericStartTagInBody(p,token);break;case 8:if(tn===$.BASEFONT)startTagInHead(p,token);else if(tn===$.MENUITEM)menuitemStartTagInBody(p,token);else if(tn===$.FRAMESET)framesetStartTagInBody(p,token);else if(tn===$.FIELDSET)addressStartTagInBody(p,token);else if(tn===$.TEXTAREA)textareaStartTagInBody(p,token);else if(tn===$.TEMPLATE)startTagInHead(p,token);else if(tn===$.NOSCRIPT)noembedStartTagInBody(p,token);else if(tn===$.OPTGROUP)optgroupStartTagInBody(p,token);else if(tn!==$.COLGROUP)genericStartTagInBody(p,token);break;case 9:if(tn===$.PLAINTEXT)plaintextStartTagInBody(p,token);else genericStartTagInBody(p,token);break;case 10:if(tn===$.BLOCKQUOTE||tn===$.FIGCAPTION)addressStartTagInBody(p,token);else genericStartTagInBody(p,token);break;default:genericStartTagInBody(p,token)}}function bodyEndTagInBody(p){if(p.openElements.hasInScope($.BODY))p.insertionMode=AFTER_BODY_MODE}function htmlEndTagInBody(p,token){if(p.openElements.hasInScope($.BODY)){p.insertionMode=AFTER_BODY_MODE;p._processToken(token)}}function addressEndTagInBody(p,token){var tn=token.tagName;if(p.openElements.hasInScope(tn)){p.openElements.generateImpliedEndTags();p.openElements.popUntilTagNamePopped(tn)}}function formEndTagInBody(p){var inTemplate=p.openElements.tmplCount>0,formElement=p.formElement;if(!inTemplate)p.formElement=null;if((formElement||inTemplate)&&p.openElements.hasInScope($.FORM)){p.openElements.generateImpliedEndTags();if(inTemplate)p.openElements.popUntilTagNamePopped($.FORM);else p.openElements.remove(formElement)}}function pEndTagInBody(p){if(!p.openElements.hasInButtonScope($.P))p._insertFakeElement($.P);p._closePElement()}function liEndTagInBody(p){if(p.openElements.hasInListItemScope($.LI)){p.openElements.generateImpliedEndTagsWithExclusion($.LI);p.openElements.popUntilTagNamePopped($.LI)}}function ddEndTagInBody(p,token){var tn=token.tagName;if(p.openElements.hasInScope(tn)){p.openElements.generateImpliedEndTagsWithExclusion(tn);p.openElements.popUntilTagNamePopped(tn)}}function numberedHeaderEndTagInBody(p){if(p.openElements.hasNumberedHeaderInScope()){p.openElements.generateImpliedEndTags();p.openElements.popUntilNumberedHeaderPopped()}}function appletEndTagInBody(p,token){var tn=token.tagName;if(p.openElements.hasInScope(tn)){p.openElements.generateImpliedEndTags();p.openElements.popUntilTagNamePopped(tn);p.activeFormattingElements.clearToLastMarker()}}function brEndTagInBody(p){p._reconstructActiveFormattingElements();p._insertFakeElement($.BR);p.openElements.pop();p.framesetOk=false}function genericEndTagInBody(p,token){var tn=token.tagName;for(var i=p.openElements.stackTop;i>0;i--){var element=p.openElements.items[i];if(p.treeAdapter.getTagName(element)===tn){p.openElements.generateImpliedEndTagsWithExclusion(tn);p.openElements.popUntilElementPopped(element);break}if(p._isSpecialElement(element))break}}function endTagInBody(p,token){var tn=token.tagName;switch(tn.length){case 1:if(tn===$.A||tn===$.B||tn===$.I||tn===$.S||tn===$.U)callAdoptionAgency(p,token);else if(tn===$.P)pEndTagInBody(p,token);else genericEndTagInBody(p,token);break;case 2:if(tn===$.DL||tn===$.UL||tn===$.OL)addressEndTagInBody(p,token);else if(tn===$.LI)liEndTagInBody(p,token);else if(tn===$.DD||tn===$.DT)ddEndTagInBody(p,token);else if(tn===$.H1||tn===$.H2||tn===$.H3||tn===$.H4||tn===$.H5||tn===$.H6)numberedHeaderEndTagInBody(p,token);else if(tn===$.BR)brEndTagInBody(p,token);else if(tn===$.EM||tn===$.TT)callAdoptionAgency(p,token);else genericEndTagInBody(p,token);break;case 3:if(tn===$.BIG)callAdoptionAgency(p,token);else if(tn===$.DIR||tn===$.DIV||tn===$.NAV)addressEndTagInBody(p,token);else genericEndTagInBody(p,token);break;case 4:if(tn===$.BODY)bodyEndTagInBody(p,token);else if(tn===$.HTML)htmlEndTagInBody(p,token);else if(tn===$.FORM)formEndTagInBody(p,token);else if(tn===$.CODE||tn===$.FONT||tn===$.NOBR)callAdoptionAgency(p,token);else if(tn===$.MAIN||tn===$.MENU)addressEndTagInBody(p,token);else genericEndTagInBody(p,token);break;case 5:if(tn===$.ASIDE)addressEndTagInBody(p,token);else if(tn===$.SMALL)callAdoptionAgency(p,token);else genericEndTagInBody(p,token);break;case 6:if(tn===$.CENTER||tn===$.FIGURE||tn===$.FOOTER||tn===$.HEADER||tn===$.HGROUP)addressEndTagInBody(p,token);else if(tn===$.APPLET||tn===$.OBJECT)appletEndTagInBody(p,token);else if(tn===$.STRIKE||tn===$.STRONG)callAdoptionAgency(p,token);else genericEndTagInBody(p,token);break;case 7:if(tn===$.ADDRESS||tn===$.ARTICLE||tn===$.DETAILS||tn===$.SECTION||tn===$.SUMMARY)addressEndTagInBody(p,token);else if(tn===$.MARQUEE)appletEndTagInBody(p,token);else genericEndTagInBody(p,token);break;case 8:if(tn===$.FIELDSET)addressEndTagInBody(p,token);else if(tn===$.TEMPLATE)endTagInHead(p,token);else genericEndTagInBody(p,token);break;case 10:if(tn===$.BLOCKQUOTE||tn===$.FIGCAPTION)addressEndTagInBody(p,token);else genericEndTagInBody(p,token);break;default:genericEndTagInBody(p,token)}}function eofInBody(p,token){if(p.tmplInsertionModeStackTop>-1)eofInTemplate(p,token);else p.stopped=true}function endTagInText(p,token){if(token.tagName===$.SCRIPT)p.pendingScript=p.openElements.current;p.openElements.pop();p.insertionMode=p.originalInsertionMode}function eofInText(p,token){p.openElements.pop();p.insertionMode=p.originalInsertionMode;p._processToken(token)}function characterInTable(p,token){var curTn=p.openElements.currentTagName;if(curTn===$.TABLE||curTn===$.TBODY||curTn===$.TFOOT||curTn===$.THEAD||curTn===$.TR){p.pendingCharacterTokens=[];p.hasNonWhitespacePendingCharacterToken=false;p.originalInsertionMode=p.insertionMode;p.insertionMode=IN_TABLE_TEXT_MODE;p._processToken(token)}else tokenInTable(p,token)}function captionStartTagInTable(p,token){p.openElements.clearBackToTableContext();p.activeFormattingElements.insertMarker();p._insertElement(token,NS.HTML);p.insertionMode=IN_CAPTION_MODE}function colgroupStartTagInTable(p,token){p.openElements.clearBackToTableContext();p._insertElement(token,NS.HTML);p.insertionMode=IN_COLUMN_GROUP_MODE}function colStartTagInTable(p,token){p.openElements.clearBackToTableContext();p._insertFakeElement($.COLGROUP);p.insertionMode=IN_COLUMN_GROUP_MODE;p._processToken(token)}function tbodyStartTagInTable(p,token){p.openElements.clearBackToTableContext();p._insertElement(token,NS.HTML);p.insertionMode=IN_TABLE_BODY_MODE}function tdStartTagInTable(p,token){p.openElements.clearBackToTableContext();p._insertFakeElement($.TBODY);p.insertionMode=IN_TABLE_BODY_MODE;p._processToken(token)}function tableStartTagInTable(p,token){if(p.openElements.hasInTableScope($.TABLE)){p.openElements.popUntilTagNamePopped($.TABLE);p._resetInsertionMode();p._processToken(token)}}function inputStartTagInTable(p,token){var inputType=Tokenizer.getTokenAttr(token,ATTRS.TYPE);if(inputType&&inputType.toLowerCase()===HIDDEN_INPUT_TYPE)p._appendElement(token,NS.HTML);else tokenInTable(p,token)}function formStartTagInTable(p,token){if(!p.formElement&&p.openElements.tmplCount===0){p._insertElement(token,NS.HTML);p.formElement=p.openElements.current;p.openElements.pop()}}function startTagInTable(p,token){var tn=token.tagName;switch(tn.length){case 2:if(tn===$.TD||tn===$.TH||tn===$.TR)tdStartTagInTable(p,token);else tokenInTable(p,token);break;case 3:if(tn===$.COL)colStartTagInTable(p,token);else tokenInTable(p,token);break;case 4:if(tn===$.FORM)formStartTagInTable(p,token);else tokenInTable(p,token);break;case 5:if(tn===$.TABLE)tableStartTagInTable(p,token);else if(tn===$.STYLE)startTagInHead(p,token);else if(tn===$.TBODY||tn===$.TFOOT||tn===$.THEAD)tbodyStartTagInTable(p,token);else if(tn===$.INPUT)inputStartTagInTable(p,token);else tokenInTable(p,token);break;case 6:if(tn===$.SCRIPT)startTagInHead(p,token);else tokenInTable(p,token);break;case 7:if(tn===$.CAPTION)captionStartTagInTable(p,token);else tokenInTable(p,token);break;case 8:if(tn===$.COLGROUP)colgroupStartTagInTable(p,token);else if(tn===$.TEMPLATE)startTagInHead(p,token);else tokenInTable(p,token);break;default:tokenInTable(p,token)}}function endTagInTable(p,token){var tn=token.tagName;if(tn===$.TABLE){if(p.openElements.hasInTableScope($.TABLE)){p.openElements.popUntilTagNamePopped($.TABLE);p._resetInsertionMode()}}else if(tn===$.TEMPLATE)endTagInHead(p,token);else if(tn!==$.BODY&&tn!==$.CAPTION&&tn!==$.COL&&tn!==$.COLGROUP&&tn!==$.HTML&&tn!==$.TBODY&&tn!==$.TD&&tn!==$.TFOOT&&tn!==$.TH&&tn!==$.THEAD&&tn!==$.TR)tokenInTable(p,token)}function tokenInTable(p,token){var savedFosterParentingState=p.fosterParentingEnabled;p.fosterParentingEnabled=true;p._processTokenInBodyMode(token);p.fosterParentingEnabled=savedFosterParentingState}function whitespaceCharacterInTableText(p,token){p.pendingCharacterTokens.push(token)}function characterInTableText(p,token){p.pendingCharacterTokens.push(token);p.hasNonWhitespacePendingCharacterToken=true}function tokenInTableText(p,token){var i=0;if(p.hasNonWhitespacePendingCharacterToken){for(;i0){p.openElements.popUntilTagNamePopped($.TEMPLATE);p.activeFormattingElements.clearToLastMarker();p._popTmplInsertionMode();p._resetInsertionMode();p._processToken(token)}else p.stopped=true}function startTagAfterBody(p,token){if(token.tagName===$.HTML)startTagInBody(p,token);else tokenAfterBody(p,token)}function endTagAfterBody(p,token){if(token.tagName===$.HTML){if(!p.fragmentContext)p.insertionMode=AFTER_AFTER_BODY_MODE}else tokenAfterBody(p,token)}function tokenAfterBody(p,token){p.insertionMode=IN_BODY_MODE;p._processToken(token)}function startTagInFrameset(p,token){var tn=token.tagName;if(tn===$.HTML)startTagInBody(p,token);else if(tn===$.FRAMESET)p._insertElement(token,NS.HTML);else if(tn===$.FRAME)p._appendElement(token,NS.HTML);else if(tn===$.NOFRAMES)startTagInHead(p,token)}function endTagInFrameset(p,token){if(token.tagName===$.FRAMESET&&!p.openElements.isRootHtmlElementCurrent()){p.openElements.pop();if(!p.fragmentContext&&p.openElements.currentTagName!==$.FRAMESET)p.insertionMode=AFTER_FRAMESET_MODE}}function startTagAfterFrameset(p,token){var tn=token.tagName;if(tn===$.HTML)startTagInBody(p,token);else if(tn===$.NOFRAMES)startTagInHead(p,token)}function endTagAfterFrameset(p,token){if(token.tagName===$.HTML)p.insertionMode=AFTER_AFTER_FRAMESET_MODE}function startTagAfterAfterBody(p,token){if(token.tagName===$.HTML)startTagInBody(p,token);else tokenAfterAfterBody(p,token)}function tokenAfterAfterBody(p,token){p.insertionMode=IN_BODY_MODE;p._processToken(token)}function startTagAfterAfterFrameset(p,token){var tn=token.tagName;if(tn===$.HTML)startTagInBody(p,token);else if(tn===$.NOFRAMES)startTagInHead(p,token)}function nullCharacterInForeignContent(p,token){token.chars=UNICODE.REPLACEMENT_CHARACTER;p._insertCharacters(token)}function characterInForeignContent(p,token){p._insertCharacters(token);p.framesetOk=false}function startTagInForeignContent(p,token){if(foreignContent.causesExit(token)&&!p.fragmentContext){while(p.treeAdapter.getNamespaceURI(p.openElements.current)!==NS.HTML&&!p._isIntegrationPoint(p.openElements.current))p.openElements.pop();p._processToken(token)}else{var current=p._getAdjustedCurrentElement(),currentNs=p.treeAdapter.getNamespaceURI(current);if(currentNs===NS.MATHML)foreignContent.adjustTokenMathMLAttrs(token);else if(currentNs===NS.SVG){foreignContent.adjustTokenSVGTagName(token);foreignContent.adjustTokenSVGAttrs(token)}foreignContent.adjustTokenXMLAttrs(token);if(token.selfClosing)p._appendElement(token,currentNs);else p._insertElement(token,currentNs)}}function endTagInForeignContent(p,token){for(var i=p.openElements.stackTop;i>0;i--){var element=p.openElements.items[i];if(p.treeAdapter.getNamespaceURI(element)===NS.HTML){p._processToken(token);break}if(p.treeAdapter.getTagName(element).toLowerCase()===token.tagName){p.openElements.popUntilElementPopped(element);break}}}},{"../common/doctype":15,"../common/foreign_content":16,"../common/html":17,"../common/unicode":18,"../extensions/location_info/parser_mixin":20,"../tokenizer":34,"../tree_adapters/default":37,"../utils/merge_options":39,"./formatting_element_list":24,"./open_element_stack":26}],26:[function(require,module,exports){"use strict";var HTML=require("../common/html");var $=HTML.TAG_NAMES,NS=HTML.NAMESPACES;function isImpliedEndTagRequired(tn){switch(tn.length){case 1:return tn===$.P;case 2:return tn===$.RB||tn===$.RP||tn===$.RT||tn===$.DD||tn===$.DT||tn===$.LI;case 3:return tn===$.RTC;case 6:return tn===$.OPTION;case 8:return tn===$.OPTGROUP||tn===$.MENUITEM}return false}function isScopingElement(tn,ns){switch(tn.length){case 2:if(tn===$.TD||tn===$.TH)return ns===NS.HTML;else if(tn===$.MI||tn===$.MO||tn===$.MN||tn===$.MS)return ns===NS.MATHML;break;case 4:if(tn===$.HTML)return ns===NS.HTML;else if(tn===$.DESC)return ns===NS.SVG;break;case 5:if(tn===$.TABLE)return ns===NS.HTML;else if(tn===$.MTEXT)return ns===NS.MATHML;else if(tn===$.TITLE)return ns===NS.SVG;break;case 6:return(tn===$.APPLET||tn===$.OBJECT)&&ns===NS.HTML;case 7:return(tn===$.CAPTION||tn===$.MARQUEE)&&ns===NS.HTML;case 8:return tn===$.TEMPLATE&&ns===NS.HTML;case 13:return tn===$.FOREIGN_OBJECT&&ns===NS.SVG;case 14:return tn===$.ANNOTATION_XML&&ns===NS.MATHML}return false}var OpenElementStack=module.exports=function(document,treeAdapter){this.stackTop=-1;this.items=[];this.current=document;this.currentTagName=null;this.currentTmplContent=null;this.tmplCount=0;this.treeAdapter=treeAdapter};OpenElementStack.prototype._indexOf=function(element){var idx=-1;for(var i=this.stackTop;i>=0;i--){if(this.items[i]===element){idx=i;break}}return idx};OpenElementStack.prototype._isInTemplate=function(){return this.currentTagName===$.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===NS.HTML};OpenElementStack.prototype._updateCurrentElement=function(){this.current=this.items[this.stackTop];this.currentTagName=this.current&&this.treeAdapter.getTagName(this.current);this.currentTmplContent=this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):null};OpenElementStack.prototype.push=function(element){this.items[++this.stackTop]=element;this._updateCurrentElement();if(this._isInTemplate())this.tmplCount++};OpenElementStack.prototype.pop=function(){this.stackTop--;if(this.tmplCount>0&&this._isInTemplate())this.tmplCount--;this._updateCurrentElement()};OpenElementStack.prototype.replace=function(oldElement,newElement){var idx=this._indexOf(oldElement);this.items[idx]=newElement;if(idx===this.stackTop)this._updateCurrentElement()};OpenElementStack.prototype.insertAfter=function(referenceElement,newElement){var insertionIdx=this._indexOf(referenceElement)+1;this.items.splice(insertionIdx,0,newElement);if(insertionIdx===++this.stackTop)this._updateCurrentElement()};OpenElementStack.prototype.popUntilTagNamePopped=function(tagName){while(this.stackTop>-1){var tn=this.currentTagName,ns=this.treeAdapter.getNamespaceURI(this.current);this.pop();if(tn===tagName&&ns===NS.HTML)break}};OpenElementStack.prototype.popUntilElementPopped=function(element){while(this.stackTop>-1){var poppedElement=this.current;this.pop();if(poppedElement===element)break}};OpenElementStack.prototype.popUntilNumberedHeaderPopped=function(){while(this.stackTop>-1){var tn=this.currentTagName,ns=this.treeAdapter.getNamespaceURI(this.current);this.pop();if(tn===$.H1||tn===$.H2||tn===$.H3||tn===$.H4||tn===$.H5||tn===$.H6&&ns===NS.HTML)break}};OpenElementStack.prototype.popUntilTableCellPopped=function(){while(this.stackTop>-1){var tn=this.currentTagName,ns=this.treeAdapter.getNamespaceURI(this.current);this.pop();if(tn===$.TD||tn===$.TH&&ns===NS.HTML)break}};OpenElementStack.prototype.popAllUpToHtmlElement=function(){this.stackTop=0;this._updateCurrentElement()};OpenElementStack.prototype.clearBackToTableContext=function(){while(this.currentTagName!==$.TABLE&&this.currentTagName!==$.TEMPLATE&&this.currentTagName!==$.HTML||this.treeAdapter.getNamespaceURI(this.current)!==NS.HTML)this.pop()};OpenElementStack.prototype.clearBackToTableBodyContext=function(){while(this.currentTagName!==$.TBODY&&this.currentTagName!==$.TFOOT&&this.currentTagName!==$.THEAD&&this.currentTagName!==$.TEMPLATE&&this.currentTagName!==$.HTML||this.treeAdapter.getNamespaceURI(this.current)!==NS.HTML)this.pop()};OpenElementStack.prototype.clearBackToTableRowContext=function(){while(this.currentTagName!==$.TR&&this.currentTagName!==$.TEMPLATE&&this.currentTagName!==$.HTML||this.treeAdapter.getNamespaceURI(this.current)!==NS.HTML)this.pop()};OpenElementStack.prototype.remove=function(element){for(var i=this.stackTop;i>=0;i--){if(this.items[i]===element){this.items.splice(i,1);this.stackTop--;this._updateCurrentElement();break}}};OpenElementStack.prototype.tryPeekProperlyNestedBodyElement=function(){var element=this.items[1];return element&&this.treeAdapter.getTagName(element)===$.BODY?element:null};OpenElementStack.prototype.contains=function(element){return this._indexOf(element)>-1};OpenElementStack.prototype.getCommonAncestor=function(element){var elementIdx=this._indexOf(element);return--elementIdx>=0?this.items[elementIdx]:null};OpenElementStack.prototype.isRootHtmlElementCurrent=function(){return this.stackTop===0&&this.currentTagName===$.HTML};OpenElementStack.prototype.hasInScope=function(tagName){for(var i=this.stackTop;i>=0;i--){var tn=this.treeAdapter.getTagName(this.items[i]),ns=this.treeAdapter.getNamespaceURI(this.items[i]);if(tn===tagName&&ns===NS.HTML)return true;if(isScopingElement(tn,ns))return false}return true};OpenElementStack.prototype.hasNumberedHeaderInScope=function(){for(var i=this.stackTop;i>=0;i--){var tn=this.treeAdapter.getTagName(this.items[i]),ns=this.treeAdapter.getNamespaceURI(this.items[i]);if((tn===$.H1||tn===$.H2||tn===$.H3||tn===$.H4||tn===$.H5||tn===$.H6)&&ns===NS.HTML)return true;if(isScopingElement(tn,ns))return false}return true};OpenElementStack.prototype.hasInListItemScope=function(tagName){for(var i=this.stackTop;i>=0;i--){var tn=this.treeAdapter.getTagName(this.items[i]),ns=this.treeAdapter.getNamespaceURI(this.items[i]);if(tn===tagName&&ns===NS.HTML)return true;if((tn===$.UL||tn===$.OL)&&ns===NS.HTML||isScopingElement(tn,ns))return false}return true};OpenElementStack.prototype.hasInButtonScope=function(tagName){for(var i=this.stackTop;i>=0;i--){var tn=this.treeAdapter.getTagName(this.items[i]),ns=this.treeAdapter.getNamespaceURI(this.items[i]);if(tn===tagName&&ns===NS.HTML)return true;if(tn===$.BUTTON&&ns===NS.HTML||isScopingElement(tn,ns))return false}return true};OpenElementStack.prototype.hasInTableScope=function(tagName){for(var i=this.stackTop;i>=0;i--){var tn=this.treeAdapter.getTagName(this.items[i]),ns=this.treeAdapter.getNamespaceURI(this.items[i]);if(ns!==NS.HTML)continue;if(tn===tagName)return true;if(tn===$.TABLE||tn===$.TEMPLATE||tn===$.HTML)return false}return true};OpenElementStack.prototype.hasTableBodyContextInTableScope=function(){for(var i=this.stackTop;i>=0;i--){var tn=this.treeAdapter.getTagName(this.items[i]),ns=this.treeAdapter.getNamespaceURI(this.items[i]);if(ns!==NS.HTML)continue;if(tn===$.TBODY||tn===$.THEAD||tn===$.TFOOT)return true;if(tn===$.TABLE||tn===$.HTML)return false}return true};OpenElementStack.prototype.hasInSelectScope=function(tagName){for(var i=this.stackTop;i>=0;i--){var tn=this.treeAdapter.getTagName(this.items[i]),ns=this.treeAdapter.getNamespaceURI(this.items[i]);if(ns!==NS.HTML)continue;if(tn===tagName)return true;if(tn!==$.OPTION&&tn!==$.OPTGROUP)return false}return true};OpenElementStack.prototype.generateImpliedEndTags=function(){while(isImpliedEndTagRequired(this.currentTagName))this.pop()};OpenElementStack.prototype.generateImpliedEndTagsWithExclusion=function(exclusionTagName){while(isImpliedEndTagRequired(this.currentTagName)&&this.currentTagName!==exclusionTagName)this.pop()}},{"../common/html":17}],27:[function(require,module,exports){"use strict";var WritableStream=require("stream").Writable,inherits=require("util").inherits,Parser=require("./index");var ParserStream=module.exports=function(options){WritableStream.call(this);this.parser=new Parser(options);this.lastChunkWritten=false;this.writeCallback=null;this.pausedByScript=false;this.document=this.parser.treeAdapter.createDocument();this.pendingHtmlInsertions=[];this._resume=this._resume.bind(this);this._documentWrite=this._documentWrite.bind(this);this._scriptHandler=this._scriptHandler.bind(this);this.parser._bootstrap(this.document,null)};inherits(ParserStream,WritableStream);ParserStream.prototype._write=function(chunk,encoding,callback){this.writeCallback=callback;this.parser.tokenizer.write(chunk.toString("utf8"),this.lastChunkWritten);this._runParsingLoop()};ParserStream.prototype.end=function(chunk,encoding,callback){this.lastChunkWritten=true;WritableStream.prototype.end.call(this,chunk||"",encoding,callback)};ParserStream.prototype._runParsingLoop=function(){this.parser.runParsingLoopForCurrentChunk(this.writeCallback,this._scriptHandler)};ParserStream.prototype._resume=function(){if(!this.pausedByScript)throw new Error("Parser was already resumed");while(this.pendingHtmlInsertions.length){var html=this.pendingHtmlInsertions.pop();this.parser.tokenizer.insertHtmlAtCurrentPos(html)}this.pausedByScript=false;if(this.parser.tokenizer.active)this._runParsingLoop()};ParserStream.prototype._documentWrite=function(html){if(!this.parser.stopped)this.pendingHtmlInsertions.push(html)};ParserStream.prototype._scriptHandler=function(scriptElement){if(this.listeners("script").length){this.pausedByScript=true;this.emit("script",scriptElement,this._documentWrite,this._resume)}else this._runParsingLoop()}},{"./index":25,stream:59,util:63}],28:[function(require,module,exports){"use strict";var ParserStream=require("./parser_stream"),inherits=require("util").inherits,$=require("../common/html").TAG_NAMES;var PlainTextConversionStream=module.exports=function(options){ParserStream.call(this,options);this.parser._insertFakeElement($.HTML);this.parser._insertFakeElement($.HEAD);this.parser.openElements.pop();this.parser._insertFakeElement($.BODY);this.parser._insertFakeElement($.PRE);this.parser.treeAdapter.insertText(this.parser.openElements.current,"\n");this.parser.switchToPlaintextParsing()};inherits(PlainTextConversionStream,ParserStream)},{"../common/html":17,"./parser_stream":27,util:63}],29:[function(require,module,exports){"use strict";var WritableStream=require("stream").Writable,util=require("util");var DevNullStream=module.exports=function(){WritableStream.call(this)};util.inherits(DevNullStream,WritableStream);DevNullStream.prototype._write=function(chunk,encoding,cb){cb()}},{stream:59,util:63}],30:[function(require,module,exports){"use strict";var TransformStream=require("stream").Transform,DevNullStream=require("./dev_null_stream"),inherits=require("util").inherits,Tokenizer=require("../tokenizer"),LocationInfoTokenizerMixin=require("../extensions/location_info/tokenizer_mixin"),ParserFeedbackSimulator=require("./parser_feedback_simulator"),mergeOptions=require("../utils/merge_options");var DEFAULT_OPTIONS={locationInfo:false};var SAXParser=module.exports=function(options){TransformStream.call(this);this.options=mergeOptions(DEFAULT_OPTIONS,options);this.tokenizer=new Tokenizer(options);if(this.options.locationInfo)new LocationInfoTokenizerMixin(this.tokenizer);this.parserFeedbackSimulator=new ParserFeedbackSimulator(this.tokenizer);this.pendingText=null;this.currentTokenLocation=void 0;this.lastChunkWritten=false;this.stopped=false;this.pipe(new DevNullStream)};inherits(SAXParser,TransformStream);SAXParser.prototype._transform=function(chunk,encoding,callback){if(!this.stopped){this.tokenizer.write(chunk.toString("utf8"),this.lastChunkWritten);this._runParsingLoop()}this.push(chunk);callback()};SAXParser.prototype._flush=function(callback){callback()};SAXParser.prototype.end=function(chunk,encoding,callback){this.lastChunkWritten=true;TransformStream.prototype.end.call(this,chunk,encoding,callback)};SAXParser.prototype.stop=function(){this.stopped=true};SAXParser.prototype._runParsingLoop=function(){do{var token=this.parserFeedbackSimulator.getNextToken();if(token.type===Tokenizer.HIBERNATION_TOKEN)break;if(token.type===Tokenizer.CHARACTER_TOKEN||token.type===Tokenizer.WHITESPACE_CHARACTER_TOKEN||token.type===Tokenizer.NULL_CHARACTER_TOKEN){if(this.options.locationInfo){if(this.pendingText===null)this.currentTokenLocation=token.location;else this.currentTokenLocation.endOffset=token.location.endOffset}this.pendingText=(this.pendingText||"")+token.chars}else{this._emitPendingText();this._handleToken(token)}}while(!this.stopped&&token.type!==Tokenizer.EOF_TOKEN)};SAXParser.prototype._handleToken=function(token){if(this.options.locationInfo)this.currentTokenLocation=token.location;if(token.type===Tokenizer.START_TAG_TOKEN)this.emit("startTag",token.tagName,token.attrs,token.selfClosing,this.currentTokenLocation);else if(token.type===Tokenizer.END_TAG_TOKEN)this.emit("endTag",token.tagName,this.currentTokenLocation);else if(token.type===Tokenizer.COMMENT_TOKEN)this.emit("comment",token.data,this.currentTokenLocation);else if(token.type===Tokenizer.DOCTYPE_TOKEN)this.emit("doctype",token.name,token.publicId,token.systemId,this.currentTokenLocation)};SAXParser.prototype._emitPendingText=function(){if(this.pendingText!==null){this.emit("text",this.pendingText,this.currentTokenLocation);this.pendingText=null}}},{"../extensions/location_info/tokenizer_mixin":21,"../tokenizer":34,"../utils/merge_options":39,"./dev_null_stream":29,"./parser_feedback_simulator":31,stream:59,util:63}],31:[function(require,module,exports){"use strict";var Tokenizer=require("../tokenizer"),foreignContent=require("../common/foreign_content"),UNICODE=require("../common/unicode"),HTML=require("../common/html");var $=HTML.TAG_NAMES,NS=HTML.NAMESPACES;var ParserFeedbackSimulator=module.exports=function(tokenizer){this.tokenizer=tokenizer;this.namespaceStack=[];this.namespaceStackTop=-1;this._enterNamespace(NS.HTML)};ParserFeedbackSimulator.prototype.getNextToken=function(){var token=this.tokenizer.getNextToken();if(token.type===Tokenizer.START_TAG_TOKEN)this._handleStartTagToken(token);else if(token.type===Tokenizer.END_TAG_TOKEN)this._handleEndTagToken(token);else if(token.type===Tokenizer.NULL_CHARACTER_TOKEN&&this.inForeignContent){token.type=Tokenizer.CHARACTER_TOKEN;token.chars=UNICODE.REPLACEMENT_CHARACTER}else if(this.skipNextNewLine){if(token.type!==Tokenizer.HIBERNATION_TOKEN)this.skipNextNewLine=false;if(token.type===Tokenizer.WHITESPACE_CHARACTER_TOKEN&&token.chars[0]==="\n"){if(token.chars.length===1)return this.getNextToken();token.chars=token.chars.substr(1)}}return token};ParserFeedbackSimulator.prototype._enterNamespace=function(namespace){this.namespaceStackTop++;this.namespaceStack.push(namespace);this.inForeignContent=namespace!==NS.HTML;this.currentNamespace=namespace;this.tokenizer.allowCDATA=this.inForeignContent};ParserFeedbackSimulator.prototype._leaveCurrentNamespace=function(){this.namespaceStackTop--;this.namespaceStack.pop();this.currentNamespace=this.namespaceStack[this.namespaceStackTop];this.inForeignContent=this.currentNamespace!==NS.HTML;this.tokenizer.allowCDATA=this.inForeignContent};ParserFeedbackSimulator.prototype._ensureTokenizerMode=function(tn){if(tn===$.TEXTAREA||tn===$.TITLE)this.tokenizer.state=Tokenizer.MODE.RCDATA;else if(tn===$.PLAINTEXT)this.tokenizer.state=Tokenizer.MODE.PLAINTEXT;else if(tn===$.SCRIPT)this.tokenizer.state=Tokenizer.MODE.SCRIPT_DATA;else if(tn===$.STYLE||tn===$.IFRAME||tn===$.XMP||tn===$.NOEMBED||tn===$.NOFRAMES||tn===$.NOSCRIPT)this.tokenizer.state=Tokenizer.MODE.RAWTEXT};ParserFeedbackSimulator.prototype._handleStartTagToken=function(token){var tn=token.tagName;if(tn===$.SVG)this._enterNamespace(NS.SVG);else if(tn===$.MATH)this._enterNamespace(NS.MATHML);if(this.inForeignContent){if(foreignContent.causesExit(token)){this._leaveCurrentNamespace();return}var currentNs=this.currentNamespace;if(currentNs===NS.MATHML)foreignContent.adjustTokenMathMLAttrs(token);else if(currentNs===NS.SVG){foreignContent.adjustTokenSVGTagName(token);foreignContent.adjustTokenSVGAttrs(token)}foreignContent.adjustTokenXMLAttrs(token);tn=token.tagName;if(!token.selfClosing&&foreignContent.isIntegrationPoint(tn,currentNs,token.attrs))this._enterNamespace(NS.HTML)}else{if(tn===$.PRE||tn===$.TEXTAREA||tn===$.LISTING)this.skipNextNewLine=true;else if(tn===$.IMAGE)token.tagName=$.IMG;this._ensureTokenizerMode(tn)}};ParserFeedbackSimulator.prototype._handleEndTagToken=function(token){var tn=token.tagName;if(!this.inForeignContent){var previousNs=this.namespaceStack[this.namespaceStackTop-1];if(previousNs===NS.SVG&&foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn])tn=foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn];if(foreignContent.isIntegrationPoint(tn,previousNs,token.attrs))this._leaveCurrentNamespace()}else if(tn===$.SVG&&this.currentNamespace===NS.SVG||tn===$.MATH&&this.currentNamespace===NS.MATHML)this._leaveCurrentNamespace();if(this.currentNamespace===NS.SVG)foreignContent.adjustTokenSVGTagName(token)}},{"../common/foreign_content":16,"../common/html":17,"../common/unicode":18,"../tokenizer":34}],32:[function(require,module,exports){"use strict";var defaultTreeAdapter=require("../tree_adapters/default"),mergeOptions=require("../utils/merge_options"),doctype=require("../common/doctype"),HTML=require("../common/html");var $=HTML.TAG_NAMES,NS=HTML.NAMESPACES;var DEFAULT_OPTIONS={treeAdapter:defaultTreeAdapter};var AMP_REGEX=/&/g,NBSP_REGEX=/\u00a0/g,DOUBLE_QUOTE_REGEX=/"/g,LT_REGEX=//g;var Serializer=module.exports=function(node,options){this.options=mergeOptions(DEFAULT_OPTIONS,options);this.treeAdapter=this.options.treeAdapter;this.html="";this.startNode=node};Serializer.escapeString=function(str,attrMode){str=str.replace(AMP_REGEX,"&").replace(NBSP_REGEX," ");if(attrMode)str=str.replace(DOUBLE_QUOTE_REGEX,""");else{str=str.replace(LT_REGEX,"<").replace(GT_REGEX,">")}return str};Serializer.prototype.serialize=function(){this._serializeChildNodes(this.startNode);return this.html};Serializer.prototype._serializeChildNodes=function(parentNode){var childNodes=this.treeAdapter.getChildNodes(parentNode);if(childNodes){for(var i=0,cnLength=childNodes.length;i";if(tn!==$.AREA&&tn!==$.BASE&&tn!==$.BASEFONT&&tn!==$.BGSOUND&&tn!==$.BR&&tn!==$.BR&&tn!==$.COL&&tn!==$.EMBED&&tn!==$.FRAME&&tn!==$.HR&&tn!==$.IMG&&tn!==$.INPUT&&tn!==$.KEYGEN&&tn!==$.LINK&&tn!==$.MENUITEM&&tn!==$.META&&tn!==$.PARAM&&tn!==$.SOURCE&&tn!==$.TRACK&&tn!==$.WBR){var childNodesHolder=tn===$.TEMPLATE&&ns===NS.HTML?this.treeAdapter.getTemplateContent(node):node;this._serializeChildNodes(childNodesHolder);this.html+=""+tn+">"}};Serializer.prototype._serializeAttributes=function(node){var attrs=this.treeAdapter.getAttrList(node);for(var i=0,attrsLength=attrs.length;i"}},{"../common/doctype":15,"../common/html":17,"../tree_adapters/default":37,"../utils/merge_options":39}],33:[function(require,module,exports){"use strict";var ReadableStream=require("stream").Readable,inherits=require("util").inherits,Serializer=require("./index");var SerializerStream=module.exports=function(node,options){ReadableStream.call(this);this.serializer=new Serializer(node,options);Object.defineProperty(this.serializer,"html",{get:function(){return""},set:this.push.bind(this)})};inherits(SerializerStream,ReadableStream);SerializerStream.prototype._read=function(){this.serializer.serialize();this.push(null)}},{"./index":32,stream:59,util:63}],34:[function(require,module,exports){"use strict";var Preprocessor=require("./preprocessor"),UNICODE=require("../common/unicode"),neTree=require("./named_entity_data");var $=UNICODE.CODE_POINTS,$$=UNICODE.CODE_POINT_SEQUENCES;var NUMERIC_ENTITY_REPLACEMENTS={0:65533,13:13,128:8364,129:129,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,141:141,142:381,143:143,144:144,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,157:157,158:382,159:376};var HAS_DATA_FLAG=1<<0;var DATA_DUPLET_FLAG=1<<1;var HAS_BRANCHES_FLAG=1<<2;var MAX_BRANCH_MARKER_VALUE=HAS_DATA_FLAG|DATA_DUPLET_FLAG|HAS_BRANCHES_FLAG;var DATA_STATE="DATA_STATE",CHARACTER_REFERENCE_IN_DATA_STATE="CHARACTER_REFERENCE_IN_DATA_STATE",RCDATA_STATE="RCDATA_STATE",CHARACTER_REFERENCE_IN_RCDATA_STATE="CHARACTER_REFERENCE_IN_RCDATA_STATE",RAWTEXT_STATE="RAWTEXT_STATE",SCRIPT_DATA_STATE="SCRIPT_DATA_STATE",PLAINTEXT_STATE="PLAINTEXT_STATE",TAG_OPEN_STATE="TAG_OPEN_STATE",END_TAG_OPEN_STATE="END_TAG_OPEN_STATE",TAG_NAME_STATE="TAG_NAME_STATE",RCDATA_LESS_THAN_SIGN_STATE="RCDATA_LESS_THAN_SIGN_STATE",RCDATA_END_TAG_OPEN_STATE="RCDATA_END_TAG_OPEN_STATE",RCDATA_END_TAG_NAME_STATE="RCDATA_END_TAG_NAME_STATE",RAWTEXT_LESS_THAN_SIGN_STATE="RAWTEXT_LESS_THAN_SIGN_STATE",RAWTEXT_END_TAG_OPEN_STATE="RAWTEXT_END_TAG_OPEN_STATE",RAWTEXT_END_TAG_NAME_STATE="RAWTEXT_END_TAG_NAME_STATE",SCRIPT_DATA_LESS_THAN_SIGN_STATE="SCRIPT_DATA_LESS_THAN_SIGN_STATE",SCRIPT_DATA_END_TAG_OPEN_STATE="SCRIPT_DATA_END_TAG_OPEN_STATE",SCRIPT_DATA_END_TAG_NAME_STATE="SCRIPT_DATA_END_TAG_NAME_STATE",SCRIPT_DATA_ESCAPE_START_STATE="SCRIPT_DATA_ESCAPE_START_STATE",SCRIPT_DATA_ESCAPE_START_DASH_STATE="SCRIPT_DATA_ESCAPE_START_DASH_STATE",SCRIPT_DATA_ESCAPED_STATE="SCRIPT_DATA_ESCAPED_STATE",SCRIPT_DATA_ESCAPED_DASH_STATE="SCRIPT_DATA_ESCAPED_DASH_STATE",SCRIPT_DATA_ESCAPED_DASH_DASH_STATE="SCRIPT_DATA_ESCAPED_DASH_DASH_STATE",SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE",SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE",SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE="SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE",SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE="SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE",SCRIPT_DATA_DOUBLE_ESCAPED_STATE="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",BEFORE_ATTRIBUTE_NAME_STATE="BEFORE_ATTRIBUTE_NAME_STATE",ATTRIBUTE_NAME_STATE="ATTRIBUTE_NAME_STATE",AFTER_ATTRIBUTE_NAME_STATE="AFTER_ATTRIBUTE_NAME_STATE",BEFORE_ATTRIBUTE_VALUE_STATE="BEFORE_ATTRIBUTE_VALUE_STATE",ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",ATTRIBUTE_VALUE_UNQUOTED_STATE="ATTRIBUTE_VALUE_UNQUOTED_STATE",CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE="CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE",AFTER_ATTRIBUTE_VALUE_QUOTED_STATE="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE",SELF_CLOSING_START_TAG_STATE="SELF_CLOSING_START_TAG_STATE",BOGUS_COMMENT_STATE="BOGUS_COMMENT_STATE",BOGUS_COMMENT_STATE_CONTINUATION="BOGUS_COMMENT_STATE_CONTINUATION",MARKUP_DECLARATION_OPEN_STATE="MARKUP_DECLARATION_OPEN_STATE",COMMENT_START_STATE="COMMENT_START_STATE",COMMENT_START_DASH_STATE="COMMENT_START_DASH_STATE",COMMENT_STATE="COMMENT_STATE",COMMENT_END_DASH_STATE="COMMENT_END_DASH_STATE",COMMENT_END_STATE="COMMENT_END_STATE",COMMENT_END_BANG_STATE="COMMENT_END_BANG_STATE",DOCTYPE_STATE="DOCTYPE_STATE",DOCTYPE_NAME_STATE="DOCTYPE_NAME_STATE",AFTER_DOCTYPE_NAME_STATE="AFTER_DOCTYPE_NAME_STATE",BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE",DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE",DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE",BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE",BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE",DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE",DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE",AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE",BOGUS_DOCTYPE_STATE="BOGUS_DOCTYPE_STATE",CDATA_SECTION_STATE="CDATA_SECTION_STATE";function isWhitespace(cp){return cp===$.SPACE||cp===$.LINE_FEED||cp===$.TABULATION||cp===$.FORM_FEED}function isAsciiDigit(cp){return cp>=$.DIGIT_0&&cp<=$.DIGIT_9}function isAsciiUpper(cp){return cp>=$.LATIN_CAPITAL_A&&cp<=$.LATIN_CAPITAL_Z}function isAsciiLower(cp){return cp>=$.LATIN_SMALL_A&&cp<=$.LATIN_SMALL_Z}function isAsciiLetter(cp){return isAsciiLower(cp)||isAsciiUpper(cp)}function isAsciiAlphaNumeric(cp){return isAsciiLetter(cp)||isAsciiDigit(cp)}function isDigit(cp,isHex){return isAsciiDigit(cp)||isHex&&(cp>=$.LATIN_CAPITAL_A&&cp<=$.LATIN_CAPITAL_F||cp>=$.LATIN_SMALL_A&&cp<=$.LATIN_SMALL_F)}function isReservedCodePoint(cp){return cp>=55296&&cp<=57343||cp>1114111}function toAsciiLowerCodePoint(cp){return cp+32}function toChar(cp){if(cp<=65535)return String.fromCharCode(cp);cp-=65536;return String.fromCharCode(cp>>>10&1023|55296)+String.fromCharCode(56320|cp&1023)}function toAsciiLowerChar(cp){return String.fromCharCode(toAsciiLowerCodePoint(cp))}function findNamedEntityTreeBranch(nodeIx,cp){var branchCount=neTree[++nodeIx],lo=++nodeIx,hi=lo+branchCount-1;while(lo<=hi){var mid=lo+hi>>>1,midCp=neTree[mid];if(midCpcp)hi=mid-1;else return neTree[mid+branchCount]}return-1}var Tokenizer=module.exports=function(){this.preprocessor=new Preprocessor;this.tokenQueue=[];this.allowCDATA=false;this.state=DATA_STATE;this.returnState="";this.tempBuff=[];this.additionalAllowedCp=void 0;this.lastStartTagName="";this.consumedAfterSnapshot=-1;this.active=false;this.currentCharacterToken=null;this.currentToken=null;this.currentAttr=null};Tokenizer.CHARACTER_TOKEN="CHARACTER_TOKEN";Tokenizer.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN";Tokenizer.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN";Tokenizer.START_TAG_TOKEN="START_TAG_TOKEN";Tokenizer.END_TAG_TOKEN="END_TAG_TOKEN";Tokenizer.COMMENT_TOKEN="COMMENT_TOKEN";Tokenizer.DOCTYPE_TOKEN="DOCTYPE_TOKEN";Tokenizer.EOF_TOKEN="EOF_TOKEN";Tokenizer.HIBERNATION_TOKEN="HIBERNATION_TOKEN";Tokenizer.MODE={DATA:DATA_STATE,RCDATA:RCDATA_STATE,RAWTEXT:RAWTEXT_STATE,SCRIPT_DATA:SCRIPT_DATA_STATE,PLAINTEXT:PLAINTEXT_STATE};Tokenizer.getTokenAttr=function(token,attrName){for(var i=token.attrs.length-1;i>=0;i--){if(token.attrs[i].name===attrName)return token.attrs[i].value}return null};Tokenizer.prototype.getNextToken=function(){while(!this.tokenQueue.length&&this.active){this._hibernationSnapshot();var cp=this._consume();if(!this._ensureHibernation())this[this.state](cp)}return this.tokenQueue.shift()};Tokenizer.prototype.write=function(chunk,isLastChunk){this.active=true;this.preprocessor.write(chunk,isLastChunk)};Tokenizer.prototype.insertHtmlAtCurrentPos=function(chunk){this.active=true;this.preprocessor.insertHtmlAtCurrentPos(chunk)};Tokenizer.prototype._hibernationSnapshot=function(){this.consumedAfterSnapshot=0};Tokenizer.prototype._ensureHibernation=function(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();this.active=false;this.tokenQueue.push({type:Tokenizer.HIBERNATION_TOKEN});return true}return false};Tokenizer.prototype._consume=function(){this.consumedAfterSnapshot++;return this.preprocessor.advance()};Tokenizer.prototype._unconsume=function(){this.consumedAfterSnapshot--;this.preprocessor.retreat()};Tokenizer.prototype._unconsumeSeveral=function(count){while(count--)this._unconsume()};Tokenizer.prototype._reconsumeInState=function(state){this.state=state;this._unconsume()};Tokenizer.prototype._consumeSubsequentIfMatch=function(pattern,startCp,caseSensitive){var consumedCount=0,isMatch=true,patternLength=pattern.length,patternPos=0,cp=startCp,patternCp=void 0;for(;patternPos0){cp=this._consume();consumedCount++}if(cp===$.EOF){isMatch=false;break}patternCp=pattern[patternPos];if(cp!==patternCp&&(caseSensitive||cp!==toAsciiLowerCodePoint(patternCp))){isMatch=false;break}}if(!isMatch)this._unconsumeSeveral(consumedCount);return isMatch};Tokenizer.prototype._lookahead=function(){var cp=this._consume();this._unconsume();return cp};Tokenizer.prototype.isTempBufferEqualToScriptString=function(){if(this.tempBuff.length!==$$.SCRIPT_STRING.length)return false;for(var i=0;i-1;){var current=neTree[i],inNode=current")}else if(cp===$.NULL){this.state=SCRIPT_DATA_ESCAPED_STATE;this._emitChar(UNICODE.REPLACEMENT_CHARACTER)}else if(cp===$.EOF)this._reconsumeInState(DATA_STATE);else{this.state=SCRIPT_DATA_ESCAPED_STATE;this._emitCodePoint(cp)}};_[SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE]=function scriptDataEscapedLessThanSignState(cp){if(cp===$.SOLIDUS){this.tempBuff=[];this.state=SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE}else if(isAsciiLetter(cp)){this.tempBuff=[];this._emitChar("<");this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE)}else{this._emitChar("<");this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE)}};_[SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE]=function scriptDataEscapedEndTagOpenState(cp){if(isAsciiLetter(cp)){this._createEndTagToken();this._reconsumeInState(SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE)}else{this._emitChar("<");this._emitChar("/");this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE)}};_[SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE]=function scriptDataEscapedEndTagNameState(cp){if(isAsciiUpper(cp)){this.currentToken.tagName+=toAsciiLowerChar(cp);this.tempBuff.push(cp)}else if(isAsciiLower(cp)){this.currentToken.tagName+=toChar(cp);this.tempBuff.push(cp)}else{if(this._isAppropriateEndTagToken()){if(isWhitespace(cp)){this.state=BEFORE_ATTRIBUTE_NAME_STATE;return}if(cp===$.SOLIDUS){this.state=SELF_CLOSING_START_TAG_STATE;return}if(cp===$.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=DATA_STATE;return}}this._emitChar("<");this._emitChar("/");this._emitSeveralCodePoints(this.tempBuff);this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE)}};_[SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE]=function scriptDataDoubleEscapeStartState(cp){if(isWhitespace(cp)||cp===$.SOLIDUS||cp===$.GREATER_THAN_SIGN){this.state=this.isTempBufferEqualToScriptString()?SCRIPT_DATA_DOUBLE_ESCAPED_STATE:SCRIPT_DATA_ESCAPED_STATE;this._emitCodePoint(cp)}else if(isAsciiUpper(cp)){this.tempBuff.push(toAsciiLowerCodePoint(cp));this._emitCodePoint(cp)}else if(isAsciiLower(cp)){this.tempBuff.push(cp);this._emitCodePoint(cp)}else this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE)};_[SCRIPT_DATA_DOUBLE_ESCAPED_STATE]=function scriptDataDoubleEscapedState(cp){if(cp===$.HYPHEN_MINUS){this.state=SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE;this._emitChar("-")}else if(cp===$.LESS_THAN_SIGN){this.state=SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE;this._emitChar("<")}else if(cp===$.NULL)this._emitChar(UNICODE.REPLACEMENT_CHARACTER);else if(cp===$.EOF)this._reconsumeInState(DATA_STATE);else this._emitCodePoint(cp)};_[SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE]=function scriptDataDoubleEscapedDashState(cp){if(cp===$.HYPHEN_MINUS){this.state=SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE;this._emitChar("-")}else if(cp===$.LESS_THAN_SIGN){this.state=SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE;this._emitChar("<")}else if(cp===$.NULL){this.state=SCRIPT_DATA_DOUBLE_ESCAPED_STATE;this._emitChar(UNICODE.REPLACEMENT_CHARACTER)}else if(cp===$.EOF)this._reconsumeInState(DATA_STATE);else{this.state=SCRIPT_DATA_DOUBLE_ESCAPED_STATE;this._emitCodePoint(cp)}};_[SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE]=function scriptDataDoubleEscapedDashDashState(cp){if(cp===$.HYPHEN_MINUS)this._emitChar("-");else if(cp===$.LESS_THAN_SIGN){this.state=SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE;this._emitChar("<")}else if(cp===$.GREATER_THAN_SIGN){this.state=SCRIPT_DATA_STATE;this._emitChar(">")}else if(cp===$.NULL){this.state=SCRIPT_DATA_DOUBLE_ESCAPED_STATE;this._emitChar(UNICODE.REPLACEMENT_CHARACTER)}else if(cp===$.EOF)this._reconsumeInState(DATA_STATE);else{this.state=SCRIPT_DATA_DOUBLE_ESCAPED_STATE;this._emitCodePoint(cp)}};_[SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE]=function scriptDataDoubleEscapedLessThanSignState(cp){if(cp===$.SOLIDUS){this.tempBuff=[];this.state=SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE;this._emitChar("/")}else this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE)};_[SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE]=function scriptDataDoubleEscapeEndState(cp){if(isWhitespace(cp)||cp===$.SOLIDUS||cp===$.GREATER_THAN_SIGN){this.state=this.isTempBufferEqualToScriptString()?SCRIPT_DATA_ESCAPED_STATE:SCRIPT_DATA_DOUBLE_ESCAPED_STATE;this._emitCodePoint(cp)}else if(isAsciiUpper(cp)){this.tempBuff.push(toAsciiLowerCodePoint(cp));this._emitCodePoint(cp)}else if(isAsciiLower(cp)){this.tempBuff.push(cp);this._emitCodePoint(cp)}else this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE)};_[BEFORE_ATTRIBUTE_NAME_STATE]=function beforeAttributeNameState(cp){if(isWhitespace(cp))return;if(cp===$.SOLIDUS||cp===$.GREATER_THAN_SIGN||cp===$.EOF)this._reconsumeInState(AFTER_ATTRIBUTE_NAME_STATE);else if(cp===$.EQUALS_SIGN){this._createAttr("=");this.state=ATTRIBUTE_NAME_STATE}else{this._createAttr("");this._reconsumeInState(ATTRIBUTE_NAME_STATE)}};_[ATTRIBUTE_NAME_STATE]=function attributeNameState(cp){if(isWhitespace(cp)||cp===$.SOLIDUS||cp===$.GREATER_THAN_SIGN||cp===$.EOF){this._leaveAttrName(AFTER_ATTRIBUTE_NAME_STATE);this._unconsume()}else if(cp===$.EQUALS_SIGN)this._leaveAttrName(BEFORE_ATTRIBUTE_VALUE_STATE);else if(isAsciiUpper(cp))this.currentAttr.name+=toAsciiLowerChar(cp);else if(cp===$.QUOTATION_MARK||cp===$.APOSTROPHE||cp===$.LESS_THAN_SIGN)this.currentAttr.name+=toChar(cp);else if(cp===$.NULL)this.currentAttr.name+=UNICODE.REPLACEMENT_CHARACTER;else this.currentAttr.name+=toChar(cp)};_[AFTER_ATTRIBUTE_NAME_STATE]=function afterAttributeNameState(cp){if(isWhitespace(cp))return;if(cp===$.SOLIDUS)this.state=SELF_CLOSING_START_TAG_STATE;else if(cp===$.EQUALS_SIGN)this.state=BEFORE_ATTRIBUTE_VALUE_STATE;else if(cp===$.GREATER_THAN_SIGN){this.state=DATA_STATE;this._emitCurrentToken()}else if(cp===$.EOF)this._reconsumeInState(DATA_STATE);else{this._createAttr("");this._reconsumeInState(ATTRIBUTE_NAME_STATE)}};_[BEFORE_ATTRIBUTE_VALUE_STATE]=function beforeAttributeValueState(cp){if(isWhitespace(cp))return;if(cp===$.QUOTATION_MARK)this.state=ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE;else if(cp===$.APOSTROPHE)this.state=ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE;else this._reconsumeInState(ATTRIBUTE_VALUE_UNQUOTED_STATE)};_[ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE]=function attributeValueDoubleQuotedState(cp){if(cp===$.QUOTATION_MARK)this.state=AFTER_ATTRIBUTE_VALUE_QUOTED_STATE;else if(cp===$.AMPERSAND){this.additionalAllowedCp=$.QUOTATION_MARK;this.returnState=this.state;this.state=CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE}else if(cp===$.NULL)this.currentAttr.value+=UNICODE.REPLACEMENT_CHARACTER;else if(cp===$.EOF)this._reconsumeInState(DATA_STATE);else this.currentAttr.value+=toChar(cp)};_[ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE]=function attributeValueSingleQuotedState(cp){if(cp===$.APOSTROPHE)this.state=AFTER_ATTRIBUTE_VALUE_QUOTED_STATE;else if(cp===$.AMPERSAND){this.additionalAllowedCp=$.APOSTROPHE;this.returnState=this.state;this.state=CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE}else if(cp===$.NULL)this.currentAttr.value+=UNICODE.REPLACEMENT_CHARACTER;else if(cp===$.EOF)this._reconsumeInState(DATA_STATE);else this.currentAttr.value+=toChar(cp)};_[ATTRIBUTE_VALUE_UNQUOTED_STATE]=function attributeValueUnquotedState(cp){if(isWhitespace(cp))this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE);else if(cp===$.AMPERSAND){this.additionalAllowedCp=$.GREATER_THAN_SIGN;this.returnState=this.state;this.state=CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE}else if(cp===$.GREATER_THAN_SIGN){this._leaveAttrValue(DATA_STATE);this._emitCurrentToken()}else if(cp===$.NULL)this.currentAttr.value+=UNICODE.REPLACEMENT_CHARACTER;else if(cp===$.QUOTATION_MARK||cp===$.APOSTROPHE||cp===$.LESS_THAN_SIGN||cp===$.EQUALS_SIGN||cp===$.GRAVE_ACCENT)this.currentAttr.value+=toChar(cp);else if(cp===$.EOF)this._reconsumeInState(DATA_STATE);else this.currentAttr.value+=toChar(cp)};_[CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE]=function characterReferenceInAttributeValueState(cp){var referencedCodePoints=this._consumeCharacterReference(cp,true);if(!this._ensureHibernation()){if(referencedCodePoints){for(var i=0;i=55296&&cp1<=56319&&cp2>=56320&&cp2<=57343}function getSurrogatePairCodePoint(cp1,cp2){return(cp1-55296)*1024+9216+cp2}var DEFAULT_BUFFER_WATERLINE=1<<16;var Preprocessor=module.exports=function(){this.html=null;this.pos=-1;this.lastGapPos=-1;this.lastCharPos=-1;this.gapStack=[];this.skipNextNewLine=false;this.lastChunkWritten=false;this.endOfChunkHit=false;this.bufferWaterline=DEFAULT_BUFFER_WATERLINE};Preprocessor.prototype.dropParsedChunk=function(){if(this.pos>this.bufferWaterline){this.lastCharPos-=this.pos;this.html=this.html.substring(this.pos);this.pos=0;this.lastGapPos=-1;this.gapStack=[]}};Preprocessor.prototype._addGap=function(){this.gapStack.push(this.lastGapPos);this.lastGapPos=this.pos};Preprocessor.prototype._processHighRangeCodePoint=function(cp){if(this.pos!==this.lastCharPos){var nextCp=this.html.charCodeAt(this.pos+1);if(isSurrogatePair(cp,nextCp)){this.pos++;cp=getSurrogatePairCodePoint(cp,nextCp);this._addGap()}}else if(!this.lastChunkWritten){this.endOfChunkHit=true;return $.EOF}return cp};Preprocessor.prototype.write=function(chunk,isLastChunk){if(this.html)this.html+=chunk;else this.html=chunk;this.lastCharPos=this.html.length-1;this.endOfChunkHit=false;this.lastChunkWritten=isLastChunk};Preprocessor.prototype.insertHtmlAtCurrentPos=function(chunk){this.html=this.html.substring(0,this.pos+1)+chunk+this.html.substring(this.pos+1,this.html.length);this.lastCharPos=this.html.length-1;this.endOfChunkHit=false};Preprocessor.prototype.advance=function(){this.pos++;if(this.pos>this.lastCharPos){if(!this.lastChunkWritten)this.endOfChunkHit=true;return $.EOF}var cp=this.html.charCodeAt(this.pos);if(this.skipNextNewLine&&cp===$.LINE_FEED){this.skipNextNewLine=false;this._addGap();return this.advance()}if(cp===$.CARRIAGE_RETURN){this.skipNextNewLine=true;return $.LINE_FEED}this.skipNextNewLine=false;return cp>=55296?this._processHighRangeCodePoint(cp):cp};Preprocessor.prototype.retreat=function(){if(this.pos===this.lastGapPos){this.lastGapPos=this.gapStack.pop();this.pos--}this.pos--}},{"../common/unicode":18}],37:[function(require,module,exports){"use strict";var DOCUMENT_MODE=require("../common/html").DOCUMENT_MODE;exports.createDocument=function(){return{nodeName:"#document",mode:DOCUMENT_MODE.NO_QUIRKS,childNodes:[]}};exports.createDocumentFragment=function(){return{nodeName:"#document-fragment",childNodes:[]}};exports.createElement=function(tagName,namespaceURI,attrs){return{nodeName:tagName,tagName:tagName,attrs:attrs,namespaceURI:namespaceURI,childNodes:[],parentNode:null}};exports.createCommentNode=function(data){return{nodeName:"#comment",data:data,parentNode:null}};var createTextNode=function(value){return{nodeName:"#text",value:value,parentNode:null}};var appendChild=exports.appendChild=function(parentNode,newNode){parentNode.childNodes.push(newNode);newNode.parentNode=parentNode};var insertBefore=exports.insertBefore=function(parentNode,newNode,referenceNode){var insertionIdx=parentNode.childNodes.indexOf(referenceNode);parentNode.childNodes.splice(insertionIdx,0,newNode);newNode.parentNode=parentNode};exports.setTemplateContent=function(templateElement,contentElement){templateElement.content=contentElement};exports.getTemplateContent=function(templateElement){return templateElement.content};exports.setDocumentType=function(document,name,publicId,systemId){var doctypeNode=null;for(var i=0;i1){for(var i=1;i0){if(typeof chunk!=="string"&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer.prototype){chunk=_uint8ArrayToBuffer(chunk)}if(addToFront){if(state.endEmitted)stream.emit("error",new Error("stream.unshift() after end event"));else addChunk(stream,state,chunk,true)}else if(state.ended){stream.emit("error",new Error("stream.push() after EOF"))}else{state.reading=false;if(state.decoder&&!encoding){chunk=state.decoder.write(chunk);if(state.objectMode||chunk.length!==0)addChunk(stream,state,chunk,false);else maybeReadMore(stream,state)}else{addChunk(stream,state,chunk,false)}}}else if(!addToFront){state.reading=false}}return needMoreData(state)}function addChunk(stream,state,chunk,addToFront){if(state.flowing&&state.length===0&&!state.sync){stream.emit("data",chunk);stream.read(0)}else{state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream)}maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;if(!_isUint8Array(chunk)&&typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function needMoreData(state){return!state.ended&&(state.needReadable||state.length=MAX_HWM){n=MAX_HWM}else{n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++}return n}function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;if(!state.ended){state.needReadable=true;return 0}return state.length}Readable.prototype.read=function(n){debug("read",n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug("read: emitReadable",state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;debug("need readable",doRead);if(state.length===0||state.length-n0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}else{state.length-=n}if(state.length===0){if(!state.ended)state.needReadable=true;if(nOrig!==n&&state.ended)endReadable(this)}if(ret!==null)this.emit("data",ret);return ret};function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;emitReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug("emitReadable",state.flowing);state.emittedReadable=true;if(state.sync)pna.nextTick(emitReadable_,stream);else emitReadable_(stream)}}function emitReadable_(stream){debug("emit readable");stream.emit("readable");flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;pna.nextTick(maybeReadMore_,stream,state)}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug("false write response, pause",src._readableState.awaitDrain);src._readableState.awaitDrain++;increasedAwaitDrain=true}src.pause()}}function onerror(er){debug("onerror",er);unpipe();dest.removeListener("error",onerror);if(EElistenerCount(dest,"error")===0)dest.emit("error",er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish");dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe");src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){debug("pipe resume");src.resume()}return dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,"data")){state.flowing=true;flow(src)}}}Readable.prototype.unpipe=function(dest){var state=this._readableState;var unpipeInfo={hasUnpiped:false};if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit("unpipe",this,unpipeInfo);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var i=0;i=state.length){if(state.decoder)ret=state.buffer.join("");else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear()}else{ret=fromListPartial(n,state.buffer,state.decoder)}return ret}function fromListPartial(n,list,hasStrings){var ret;if(nstr.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=str.slice(nb)}break}++c}list.length-=c;return ret}function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=buf.slice(nb)}break}++c}list.length-=c;return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;pna.nextTick(endReadableNT,state,stream)}}function endReadableNT(state,stream){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}}function indexOf(xs,x){for(var i=0,l=xs.length;i-1?setImmediate:pna.nextTick;var Duplex;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")};var Stream=require("./internal/streams/stream");var Buffer=require("safe-buffer").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk)}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array}var destroyImpl=require("./internal/streams/destroy");util.inherits(Writable,Stream);function nop(){}function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};var isDuplex=stream instanceof Duplex;this.objectMode=!!options.objectMode;if(isDuplex)this.objectMode=this.objectMode||!!options.writableObjectMode;var hwm=options.highWaterMark;var writableHwm=options.writableHighWaterMark;var defaultHwm=this.objectMode?16:16*1024;if(hwm||hwm===0)this.highWaterMark=hwm;else if(isDuplex&&(writableHwm||writableHwm===0))this.highWaterMark=writableHwm;else this.highWaterMark=defaultHwm;this.highWaterMark=Math.floor(this.highWaterMark);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function getBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next}return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch(_){}})();var realHasInstance;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){realHasInstance=Function.prototype[Symbol.hasInstance];Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){if(realHasInstance.call(this,object))return true;if(this!==Writable)return false;return object&&object._writableState instanceof WritableState}})}else{realHasInstance=function(object){return object instanceof this}}function Writable(options){Duplex=Duplex||require("./_stream_duplex");if(!realHasInstance.call(Writable,this)&&!(this instanceof Duplex)){return new Writable(options)}this._writableState=new WritableState(options,this);this.writable=true;if(options){if(typeof options.write==="function")this._write=options.write;if(typeof options.writev==="function")this._writev=options.writev;if(typeof options.destroy==="function")this._destroy=options.destroy;if(typeof options.final==="function")this._final=options.final}Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function writeAfterEnd(stream,cb){var er=new Error("write after end");stream.emit("error",er);pna.nextTick(cb,er)}function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError("May not write null values to stream")}else if(typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}if(er){stream.emit("error",er);pna.nextTick(cb,er);valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;var isBuf=!state.objectMode&&_isUint8Array(chunk);if(isBuf&&!Buffer.isBuffer(chunk)){chunk=_uint8ArrayToBuffer(chunk)}if(typeof encoding==="function"){cb=encoding;encoding=null}if(isBuf)encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(isBuf||validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)}return ret};Writable.prototype.cork=function(){var state=this._writableState;state.corked++};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){if(typeof encoding==="string")encoding=encoding.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=Buffer.from(chunk,encoding)}return chunk}Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:false,get:function(){return this._writableState.highWaterMark}});function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);if(chunk!==newChunk){isBuf=true;encoding="buffer";chunk=newChunk}}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length};BufferList.prototype.unshift=function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length};BufferList.prototype.shift=function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret};BufferList.prototype.clear=function clear(){this.head=this.tail=null;this.length=0};BufferList.prototype.join=function join(s){if(this.length===0)return"";var p=this.head;var ret=""+p.data;while(p=p.next){ret+=s+p.data}return ret};BufferList.prototype.concat=function concat(n){if(this.length===0)return Buffer.alloc(0);if(this.length===1)return this.head.data;var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next}return ret};return BufferList}();if(util&&util.inspect&&util.inspect.custom){module.exports.prototype[util.inspect.custom]=function(){var obj=util.inspect({length:this.length});return this.constructor.name+" "+obj}}},{"safe-buffer":58,util:6}],50:[function(require,module,exports){"use strict";var pna=require("process-nextick-args");function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err)}else if(err&&(!this._writableState||!this._writableState.errorEmitted)){pna.nextTick(emitErrorNT,this,err)}return this}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy(err||null,function(err){if(!cb&&err){pna.nextTick(emitErrorNT,_this,err);if(_this._writableState){_this._writableState.errorEmitted=true}}else if(cb){cb(err)}});return this}function undestroy(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function emitErrorNT(self,err){self.emit("error",err)}module.exports={destroy:destroy,undestroy:undestroy}},{"process-nextick-args":41}],51:[function(require,module,exports){module.exports=require("events").EventEmitter},{events:10}],52:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],53:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;var isEncoding=Buffer.isEncoding||function(encoding){encoding=""+encoding;switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function _normalizeEncoding(enc){if(!enc)return"utf8";var retried;while(true){switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase();retried=true}}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!=="string"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}exports.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text;this.end=utf16End;nb=4;break;case"utf8":this.fillLast=utf8FillLast;nb=4;break;case"base64":this.text=base64Text;this.end=base64End;nb=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=Buffer.allocUnsafe(nb)}StringDecoder.prototype.write=function(buf){if(buf.length===0)return"";var r;var i;if(this.lastNeed){r=this.fillLast(buf);if(r===undefined)return"";i=this.lastNeed;this.lastNeed=0}else{i=0}if(i>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return byte>>6===2?-1:-2}function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}function utf8CheckExtraBytes(self,buf,p){if((buf[0]&192)!==128){self.lastNeed=0;return"�"}if(self.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128){self.lastNeed=1;return"�"}if(self.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128){self.lastNeed=2;return"�"}}}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+"�";return r}function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString("base64",i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1]}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1]}return buf.toString("base64",i,buf.length-n)}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+this.lastChar.toString("base64",0,3-this.lastNeed);return r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}},{"safe-buffer":58}],54:[function(require,module,exports){module.exports=require("./readable").PassThrough},{"./readable":55}],55:[function(require,module,exports){exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=exports;exports.Readable=exports;exports.Writable=require("./lib/_stream_writable.js");exports.Duplex=require("./lib/_stream_duplex.js");exports.Transform=require("./lib/_stream_transform.js");exports.PassThrough=require("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":44,"./lib/_stream_passthrough.js":45,"./lib/_stream_readable.js":46,"./lib/_stream_transform.js":47,"./lib/_stream_writable.js":48}],56:[function(require,module,exports){module.exports=require("./readable").Transform},{"./readable":55}],57:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":48}],58:[function(require,module,exports){var buffer=require("buffer");var Buffer=buffer.Buffer;function copyProps(src,dst){for(var key in src){dst[key]=src[key]}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer}else{copyProps(buffer,exports);exports.Buffer=SafeBuffer}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length)}copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==="number"){throw new TypeError("Argument must not be a number")}return Buffer(arg,encodingOrOffset,length)};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==="string"){buf.fill(fill,encoding)}else{buf.fill(fill)}}else{buf.fill(0)}return buf};SafeBuffer.allocUnsafe=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return Buffer(size)};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return buffer.SlowBuffer(size)}},{buffer:7}],59:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("readable-stream/readable.js");Stream.Writable=require("readable-stream/writable.js");Stream.Duplex=require("readable-stream/duplex.js");Stream.Transform=require("readable-stream/transform.js");Stream.PassThrough=require("readable-stream/passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{events:10,inherits:12,"readable-stream/duplex.js":43,"readable-stream/passthrough.js":54,"readable-stream/readable.js":55,"readable-stream/transform.js":56,"readable-stream/writable.js":57}],60:[function(require,module,exports){(function(setImmediate,clearImmediate){var nextTick=require("process/browser.js").nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)};exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)};exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(window,this._id)};exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)item._onTimeout()},msecs)}};exports.setImmediate=typeof setImmediate==="function"?setImmediate:function(fn){var id=nextImmediateId++;var args=arguments.length<2?false:slice.call(arguments,1);immediateIds[id]=true;nextTick(function onNextTick(){if(immediateIds[id]){if(args){fn.apply(null,args)}else{fn.call(null)}exports.clearImmediate(id)}});return id};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id]}}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":42,timers:60}],61:[function(require,module,exports){(function(global){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],62:[function(require,module,exports){arguments[4][3][0].apply(exports,arguments)},{dup:3}],63:[function(require,module,exports){arguments[4][4][0].apply(exports,arguments)},{"./support/isBuffer":62,_process:42,dup:4,inherits:12}],64:[function(require,module,exports){module.exports={name:"mip-validator",version:"1.6.2",description:"MIP validator",main:"index.js",dependencies:{commander:"^2.9.0",jschardet:"^1.4.1",lodash:"^4.17.2",parse5:"^3.0.1"},browserify:{transform:[["babelify",{presets:["es2015"],global:true}],["aliasify",{aliases:{jschardet:"./src/encoding/fake-jschardet.js",lodash:"./node_modules/lodash/lodash.min.js"}}]]},devDependencies:{aliasify:"^2.1.0","babel-preset-es2015":"^6.13.2",babelify:"^7.3.0",browserify:"^13.1.0",chai:"^3.5.0","chai-as-promised":"^6.0.0",changelog:"^1.0.7",coveralls:"^2.11.9",eslint:"^3.19.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.2.0","eslint-plugin-mocha":"^4.9.0","eslint-plugin-node":"^4.2.2","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","git-changelog":"^1.0.1",istanbul:"^0.4.3",mocha:"^3.2.0","mock-fs":"^3.11.0",sinon:"^1.17.6","sinon-chai":"^2.8.0",supertest:"^2.0.1",uglifyjs:"^2.4.10"},engines:{node:">=4.0.0"},scripts:{test:"DEBUG='mip-validator:' mocha && npm run test:e2e","test:e2e":"make cases",lint:"eslint src/ test/ bin/ index.js",preversion:"npm run lint && npm test",version:"make dist && git add -A dist",postversion:"git push && git push --tags && npm publish"},bin:{"mip-validator":"./bin/cli.js","mip-validator-http":"./bin/http.js","mip-validator-socket":"./bin/socket.js"},repository:{type:"git",url:"ssh://git@github.com:mipengine/mip-validator.git"},keywords:["MIP","validator"],author:"harttle",license:"ISC"}},{}],65:[function(require,module,exports){module.exports={script:{mandatory:[{type:"/^text/javascript|$/",src:"/^https://mipcache\\.bdstatic\\.com/static/v1/mip-fixed/mip-fixed\\.js$/"},{type:"/^text/javascript|$/",src:"/^https://mipcache\\.bdstatic\\.com/static/v1/mip-mustache/mip-mustache\\.js$/"},{type:"/^text/javascript|$/",src:"/^https://mipcache\\.bdstatic\\.com/static/v1/mip-custom/mip-custom\\.js$/"}]},"mip-custom":{mandatory:true}}},{}],66:[function(require,module,exports){module.exports={"/.*/":{attrs:{style:{disallow:true},"/^on.+/":{disallow:true}}},html:{mandatory:true,attrs:{mip:{mandatory:true}},duplicate:true},meta:{duplicate:[{name:"/^viewport/"},{"http-equiv":"/Content-Type/i"},{charset:"/^utf-8$/i"}],attrs:{content:[{match:{name:"/^viewport/"},properties:{width:"device-width","initial-scale":"1"}}]},mandatory_or:[{"http-equiv":"/Content-Type/i",content:"/charset=utf-8/i"},{charset:"/^utf-8$/i"}],mandatory:{name:"/^(viewport)?/",content:"/((width|initial-scale)=.+){2}/"},mandatory_parent:"head"},link:{mandatory:[{rel:"/^(miphtml)|(canonical)$/"},{rel:"/^stylesheet$/",href:"/^(https:)?//((mipcache\\.bdstatic\\.com/static/mipmain-v\\d\\.\\d\\.\\d\\.css)|(mipcache\\.bdstatic\\.com/static/v\\d/mip\\.css)|(c\\.mipcdn\\.com/static/v\\d/mip\\.css)|(c\\.mipcdn\\.com/static/mipmain-v\\d\\.\\d\\.\\d\\.css)|(\\S+\\.sm-tc\\.cn/static/v\\d/mip\\.css)|(\\S+\\.transcode\\.cn/static/v\\d/mip\\.css))$/"}],mandatory_parent:"head",duplicate:[{rel:"/^(miphtml)|(canonical)$/"}],attrs:{href:[{value:"/^(http(s)?:)?///",match:{rel:"/^((canonical)|(miphtml))$/"}},{value:"/^(?!/[^/])/",match:{rel:"/^(?!((miphtml)|(canonical))$)/"}}]}},script:[{mandatory:{src:"/^(https:)?//((mipcache\\.bdstatic\\.com/static/mipmain-v\\d\\.\\d\\.\\d\\.js)|(mipcache\\.bdstatic\\.com/static/v\\d/mip\\.js)|(c\\.mipcdn\\.com/static/v\\d/mip\\.js)|(c\\.mipcdn\\.com/static/mipmain-v\\d\\.\\d\\.\\d\\.js)|(\\S+\\.sm-tc\\.cn/static/v\\d/mip\\.js)|(\\S+\\.transcode\\.cn/static/v\\d/mip\\.js))$/"}},{match:{src:"/^(https:)?//((mipcache\\.bdstatic\\.com)|(c\\.mipcdn\\.com)|(\\S+\\.sm-tc\\.cn)|(\\S+\\.transcode\\.cn))(/([\\s\\S]*))?$/"},attrs:{type:{value:"/^(((application)|(text))/javascript)$/"}}},{match_ancestor:"head",match:{src:"/^(https:)?//((mipcache\\.bdstatic\\.com)|(c\\.mipcdn\\.com)|(\\S+\\.sm-tc\\.cn)|(\\S+\\.transcode\\.cn))(/([\\s\\S]*))?$/"},attrs:{async:{mandatory:true}}},{disallow:true,match:{type:"/^(?!application/(ld\\+)?json$)/",src:"/^(?!((https:)?//((mipcache\\.bdstatic\\.com)|(c\\.mipcdn\\.com)|(\\S+\\.sm-tc\\.cn)|(\\S+\\.transcode\\.cn))(/([\\s\\S]*))?$))/"}},{disallowed_ancestor:"template"}],"mip-input":{mandatory_ancestor:"mip-form",attrs:{name:{mandatory:true}}},img:{disallow:true},video:{disallow:true},audio:{disallow:true},frame:{disallow:true},frameset:{disallow:true},object:{disallow:true},param:{disallow:true},applet:{disallow:true},embed:{disallow:true},form:{disallow:true},iframe:{disallow:true},input:{mandatory_ancestor:"mip-form"},textarea:{mandatory_ancestor:"mip-form"},select:{mandatory_ancestor:"mip-form"},option:{mandatory_ancestor:"mip-form"},a:{attrs:{href:{mandatory:true,value:"/^((?!javascript:).*)$/"}}},"mip-img":{attrs_or:[{src:"/^\\S+$/"},{srcset:"/^\\S+$/"}],attrs:{src:{value:"/^\\S+$/"},srcset:{value:"/^\\S+$/"}}},"mip-pix":{attrs:{src:{mandatory:true,value:"/^((https:)?//)|(http://*\\?)/"}}},"mip-video":{attrs:{src:{mandatory:true,nomatch_descendant:"source"}}},source:{mandatory_ancestor:"/picture|mip-video|mip-audio/",attrs:{src:{mandatory:true,value:"/^(?!/[^/])/"}}},"mip-carousel":{attrs:{width:{mandatory:true,value:"/^\\d{1,4}$/"},height:{mandatory:true,value:"/^\\d{1,4}$/"}}},"mip-iframe":{attrs:{width:{mandatory:true,value:"/^\\d{1,4}$/"},height:{mandatory:true,value:"/^\\d{1,4}$/"}}},"mip-appdl":{attrs:{tpl:{mandatory:true,value:"/^(noneImg)|(imageText)$/"},src:{mandatory:true,value:"/^http(s)?:///",match:{tpl:"imageText"}},texttip:{mandatory:true,value:"/^\\S+$/"}}},"mip-audio":{attrs:{src:{mandatory:true,value:"/^(?!/[^/])/"}}},"mip-stats-bidu":{attrs:{token:{mandatory:true,value:"/^\\S+$/"}}},"mip-form":{attrs:{method:{value:"/^((post)|(get))$/i"},url:{mandatory:true,value:"/^(http(s)?:)?///"}}},"mip-link":{attrs:{href:{mandatory:true,value:"/^((?!javascript:).*)$/"}}},"mip-ad":{attrs:{type:{mandatory:true}}},"mip-embed":{attrs:{type:{mandatory:true}}},head:{duplicate:true,mandatory:true,mandatory_parent:"html"},body:{mandatory:true,mandatory_parent:"html",duplicate:true},style:{attrs:{"mip-custom":{mandatory:true}},duplicate:true,mandatory_parent:"head"},template:{attrs:{type:{mandatory:true}}},base:{duplicate:true,mandatory_parent:"head",attrs_or:[{target:"/^((_top)|(_self)|(_blank))$/i"},{href:"/^/$/"}],attrs:{target:{value:"/^((_top)|(_self)|(_blank))$/i"},href:{value:"/^/$/"}}},"mip-vd-baidu":{attrs:{src:{mandatory:true,value:"/^(http(s)?:)?///"},title:{mandatory:true,value:"/^\\S+$/"},poster:{mandatory:true,value:"/^\\S+$/"}}}}},{}],67:[function(require,module,exports){"use strict";exports.detect=function(){return{encoding:"UTF-8",confidence:1}}},{}],68:[function(require,module,exports){"use strict";var jschardet=require("./fake-jschardet.js");var ERR=require("../error/dfn.json");var allowedEncoding=["UTF-8","ascii"];var logger=require("../logger.js")("mip-validator:encoding");function checkUTF8(content,error){var result=jschardet.detect(content);logger.debug("encoding detected:",result.encoding);if(allowedEncoding.indexOf(result.encoding)===-1&&result.confidence>=.9){error(ERR.DISALLOWED_ENCODING,result.encoding)}}exports.checkUTF8=checkUTF8},{"../error/dfn.json":70,"../logger.js":72,"./fake-jschardet.js":67}],69:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};var _=require("./../node_modules/lodash/lodash.min.js");var Walker=require("./walker.js");var assert=require("assert");var ERR=require("./error/dfn.json");var ruleParser=require("./rule-parser.js");var parse5=require("parse5");var logger=require("./logger.js")("mip-validator:engine");var checkUTF8=require("./encoding").checkUTF8;var ValidateError=require("./error/validation-error.js");function Engine(rules){assert(_.isObject(rules),"rules must be object, "+(typeof rules==="undefined"?"undefined":_typeof(rules))+" found");var config=ruleParser.mkConfig(rules);this.walker=Walker(config)}Engine.prototype.register=function(validator){return this.walker.register(validator)};Engine.prototype.validate=function(html,options){var _this=this;html=normalize(html);options=_.assign({fastMode:false,rules:undefined,type:undefined},options);logger.debug("validating using options %J",options);return useErrorPolicy(function(){var errorGenertor=ValidateError.generator({html:html,fast:options.fastMode});checkUTF8(html,errorGenertor);var document=parse(html,options);behaveBuggyAsTheCPPVersion(document,errorGenertor);_this.walker.validate(document,errorGenertor,html);if(options.type){var rules=ruleParser.typedRules(options.type);_this.walker.config=ruleParser.mkConfig(rules);_this.walker.validate(document,errorGenertor,html)}return errorGenertor.errors},options.fastMode)};function normalize(content){return content.toString().replace(/^\uFEFF/,"")}function useErrorPolicy(validate,fastMode){if(!fastMode){return validate()}try{validate();return[]}catch(e){return[e]}}function parse(html,options){return parse5.parse(html,{locationInfo:!options.fastMode})}function behaveBuggyAsTheCPPVersion(doc,errorGenertor){var head=findFirstTagChild(findFirstTagChild(doc));var noscriptAppeared=false;head.childNodes.forEach(function(node){if(node.tagName==="noscript"){noscriptAppeared=true}else if(node.tagName&&noscriptAppeared){var err=ERR.INVALID_NOSCRIPT;errorGenertor(err)}})}function findFirstTagChild(parent){var ret;parent.childNodes.some(function(node){ret=node;return node.tagName});return ret}module.exports=Engine},{"./../node_modules/lodash/lodash.min.js":14,"./encoding":68,"./error/dfn.json":70,"./error/validation-error.js":71,"./logger.js":72,"./rule-parser.js":74,"./walker.js":88,assert:1,parse5:23}],70:[function(require,module,exports){module.exports={DISALLOWED_ENCODING:{code:"06200001",message:"禁止使用 '%s',请统一使用 UTF-8 编码",misc:"使用 UTF-8 编码"},INVALID_INNER_HTML:{code:"03210001",message:"标签 '%s' 的 HTML 内容不合法(%s)",misc:"使用合法 HTML"},MANDATORY_TAG_MISSING:{code:"06200101",message:"强制性标签 '%s' 缺失或错误",misc:"增加或修改强制性标签"},MANDATORY_ATTR_OR_MISSING:{code:"06200102",message:"标签 %s 必要属性不符合要求或缺失"},DISALLOWED_TAG:{code:"06200201",message:"禁止使用 '%s' 标签",misc:"删除禁用标签"},DUPLICATE_UNIQUE_TAG:{code:"06200701",message:"标签 '%s' 只能出现一次",misc:"删除多余标签"},MANDATORY_ONEOF_ATTR_MISSING:{code:"06200501",message:"标签 '%s' 的强制性属性 '%s' 缺失",misc:"增加缺失属性"},DISALLOWED_ATTR:{code:"06200202",message:"'%s' 标签中禁止使用 '%s' 属性",misc:"删除禁用属性"},INVALID_ATTR_VALUE:{code:"06200301",message:"标签 '%s' 中的属性 '%s' 的属性值 '%s' 无效",misc:"将属性值修改为规则限定格式"},DISALLOWED_TAG_ANCESTOR:{code:"06200801",message:"标签 '%s' 不应该是标签 '%s' 的子标签",misc:"将标签移出禁用的父标签"},MANDATORY_TAG_ANCESTOR:{code:"06200901",message:"标签 '%s' 只能是标签 '%s' 的子级标签",misc:"将标签插入到允许的父标签内"},WRONG_PARENT_TAG:{code:"06200601",message:"标签 '%s' 的直接父标签应该是 '%s',而不是 '%s'",misc:"使用正确的父标签"},INVALID_PROPERTY_VALUE_IN_ATTR_VALUE:{code:"06200401",message:"标签 '%s' 中的属性 '%s' 的属性 '%s' 被设置为 '%s',该属性值无效",misc:"使用正确的属性值"},INVALID_NOSCRIPT:{code:"06201001",message:"标签 '