(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define(factory);else if(typeof exports==="object")exports["markdown-it-imsize.js"]=factory();else root["markdown-it-imsize.js"]=factory()})(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:false};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";var sizeOf=__webpack_require__(2);var parseImageSize=__webpack_require__(1);function image_with_size(md,options){return function(state,silent){var attrs,code,label,labelEnd,labelStart,pos,ref,res,title,width="",height="",token,tokens,start,href="",oldPos=state.pos,max=state.posMax;if(state.src.charCodeAt(state.pos)!==33){return false}if(state.src.charCodeAt(state.pos+1)!==91){return false}labelStart=state.pos+2;labelEnd=md.helpers.parseLinkLabel(state,state.pos+1,false);if(labelEnd<0){return false}pos=labelEnd+1;if(pos=max){return false}start=pos;res=md.helpers.parseLinkDestination(state.src,pos,state.posMax);if(res.ok){href=state.md.normalizeLink(res.str);if(state.md.validateLink(href)){pos=res.pos}else{href=""}}start=pos;for(;pos=0){code=state.src.charCodeAt(pos-1);if(code===32){res=parseImageSize(state.src,pos,state.posMax);if(res.ok){width=res.width;height=res.height;pos=res.pos;for(;pos=max||state.src.charCodeAt(pos)!==41){state.pos=oldPos;return false}pos++}else{if(typeof state.env.references==="undefined"){return false}for(;pos=0){label=state.src.slice(start,pos++)}else{pos=labelEnd+1}}else{pos=labelEnd+1}if(!label){label=state.src.slice(labelStart,labelEnd)}ref=state.env.references[md.utils.normalizeReference(label)];if(!ref){state.pos=oldPos;return false}href=ref.href;title=ref.title}if(!silent){state.pos=labelStart;state.posMax=labelEnd;var newState=new state.md.inline.State(state.src.slice(labelStart,labelEnd),state.md,state.env,tokens=[]);newState.md.inline.tokenize(newState);if(options){if(options.autofill&&width===""&&height===""){try{var dimensions=sizeOf(href);width=dimensions.width;height=dimensions.height}catch(e){}}}token=state.push("image","img",0);token.attrs=attrs=[["src",href],["alt",""]];token.children=tokens;if(title){attrs.push(["title",title])}if(width!==""){attrs.push(["width",width])}if(height!==""){attrs.push(["height",height])}}state.pos=pos;state.posMax=max;return true}}module.exports=function imsize_plugin(md,options){md.inline.ruler.before("emphasis","image",image_with_size(md,options))}},function(module,exports,__webpack_require__){"use strict";function parseNextNumber(str,pos,max){var code,start=pos,result={ok:false,pos:pos,value:""};code=str.charCodeAt(pos);while(pos=48&&code<=57)||code===37){code=str.charCodeAt(++pos)}result.ok=true;result.pos=pos;result.value=str.slice(start,pos);return result}module.exports=function parseImageSize(str,pos,max){var code,result={ok:false,pos:0,width:"",height:""};if(pos>=max){return result}code=str.charCodeAt(pos);if(code!==61){return result}pos++;code=str.charCodeAt(pos);if(code!==120&&(code<48||code>57)){return result}var resultW=parseNextNumber(str,pos,max);pos=resultW.pos;code=str.charCodeAt(pos);if(code!==120){return result}pos++;var resultH=parseNextNumber(str,pos,max);pos=resultH.pos;result.width=resultW.value;result.height=resultH.value;result.pos=pos;result.ok=true;return result}},function(module,exports,__webpack_require__){(function(Buffer){"use strict";var fs=__webpack_require__(16);var path=__webpack_require__(6);var detector=__webpack_require__(3);var handlers={};var types=__webpack_require__(5);types.forEach(function(type){handlers[type]=__webpack_require__(4)("./"+type)});var MaxBufferSize=128*1024;function lookup(buffer,filepath){var type=detector(buffer,filepath);if(type in handlers){var size=handlers[type].calculate(buffer,filepath);if(size!==false){size.type=type;return size}}throw new TypeError("Unsupported file type")}function asyncFileToBuffer(filepath,callback){fs.open(filepath,"r",function(err0,descriptor){if(err0){return callback(err0)}var size=fs.fstatSync(descriptor).size;var bufferSize=Math.min(size,MaxBufferSize);var buffer=new Buffer(bufferSize);fs.read(descriptor,buffer,0,bufferSize,0,function(err1){if(err1){return callback(err1)}fs.close(descriptor,function(err2){callback(err2,buffer)})})})}function syncFileToBuffer(filepath){var descriptor=fs.openSync(filepath,"r");var size=fs.fstatSync(descriptor).size;var bufferSize=Math.min(size,MaxBufferSize);var buffer=new Buffer(bufferSize);fs.readSync(descriptor,buffer,0,bufferSize,0);fs.closeSync(descriptor);return buffer}module.exports=function(input,callback){if(typeof input!=="string"){throw new TypeError("Input must be file name")}var filepath=path.resolve(input);if(typeof callback==="function"){asyncFileToBuffer(filepath,function(err,buffer){if(err){return callback(err)}var dimensions;try{dimensions=lookup(buffer,filepath)}catch(e){err=e}callback(err,dimensions)})}else{var buffer=syncFileToBuffer(filepath);return lookup(buffer,filepath)}}}).call(exports,__webpack_require__(7).Buffer)},function(module,exports,__webpack_require__){"use strict";var typeMap={};var types=__webpack_require__(5);types.forEach(function(type){typeMap[type]=__webpack_require__(4)("./"+type).detect});module.exports=function(buffer,filepath){var type,result;for(type in typeMap){if(type in typeMap){result=typeMap[type](buffer,filepath);if(result){return type}}}throw new TypeError("Unsupported type")}},function(module,exports,__webpack_require__){var map={"./bmp":8,"./bmp.js":8,"./gif":9,"./gif.js":9,"./jpg":10,"./jpg.js":10,"./png":11,"./png.js":11,"./psd":12,"./psd.js":12,"./svg":13,"./svg.js":13,"./tiff":14,"./tiff.js":14,"./webp":15,"./webp.js":15};function webpackContext(req){return __webpack_require__(webpackContextResolve(req))}function webpackContextResolve(req){return map[req]||function(){throw new Error("Cannot find module '"+req+"'.")}()}webpackContext.keys=function webpackContextKeys(){return Object.keys(map)};webpackContext.resolve=webpackContextResolve;module.exports=webpackContext;webpackContext.id=4},function(module,exports,__webpack_require__){"use strict";module.exports=["bmp","gif","jpg","png","tiff"]},function(module,exports,__webpack_require__){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;ikMaxLength){throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength.toString(16)+" bytes")}if(length<0)length=0;else length>>>=0;if(Buffer.TYPED_ARRAY_SUPPORT){self=Buffer._augment(new Uint8Array(length))}else{self.length=length;self._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){self._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i0&&length<=Buffer.poolSize)self.parent=rootParent;return self}function SlowBuffer(subject,encoding){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding);var buf=new Buffer(subject,encoding);delete buf.parent;return buf}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;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function toString(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";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"binary":return binarySlice(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.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return true;return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function inspect(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return""};Buffer.prototype.compare=function compare(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return 0;return Buffer.compare(this,b)};Buffer.prototype.indexOf=function indexOf(val,byteOffset){if(byteOffset>2147483647)byteOffset=2147483647;else if(byteOffset<-2147483648)byteOffset=-2147483648;byteOffset>>=0;if(this.length===0)return-1;if(byteOffset>=this.length)return-1;if(byteOffset<0)byteOffset=Math.max(this.length+byteOffset,0);if(typeof val==="string"){if(val.length===0)return-1;return String.prototype.indexOf.call(this,val,byteOffset)}if(Buffer.isBuffer(val)){return arrayIndexOf(this,val,byteOffset)}if(typeof val==="number"){if(Buffer.TYPED_ARRAY_SUPPORT&&Uint8Array.prototype.indexOf==="function"){return Uint8Array.prototype.indexOf.call(this,val,byteOffset)}return arrayIndexOf(this,[val],byteOffset)}function arrayIndexOf(arr,val,byteOffset){var foundIndex=-1;for(var i=0;byteOffset+iremaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;ithis.length){throw new RangeError("attempt to write outside buffer bounds")}var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};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){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;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(++i>>0;byteLength=byteLength>>>0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(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 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)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1;var i=0;this[offset]=value&255;while(++i>>0&255}return offset+byteLength};Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul>>>0&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;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;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}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}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}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){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=0;var mul=1;var sub=value<0?1: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){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=byteLength-1;var mul=1;var sub=value<0?1:0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){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;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;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}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;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}else{objectWriteUInt32(this,value,offset,false)}return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||valuebuf.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,3.4028234663852886e38,-3.4028234663852886e38)}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,1.7976931348623157e308,-1.7976931348623157e308)}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,target_start,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(target_start>=target.length)target_start=target.length;if(!target_start)target_start=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-target_start=this.length)throw new RangeError("start out of bounds"); if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i55295&&codePoint<57344){if(leadSurrogate){if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}else{codePoint=leadSurrogate-55296<<10|codePoint-56320|65536;leadSurrogate=null}}else{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}else{leadSurrogate=codePoint;continue}}}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<2097152){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 decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}}).call(exports,__webpack_require__(7).Buffer)},function(module,exports,__webpack_require__){"use strict";function isBMP(buffer){return"BM"===buffer.toString("ascii",0,2)}function calculate(buffer){return{width:buffer.readUInt32LE(18),height:buffer.readUInt32LE(22)}}module.exports={detect:isBMP,calculate:calculate}},function(module,exports,__webpack_require__){"use strict";var gifRegexp=/^GIF8[7,9]a/;function isGIF(buffer){var signature=buffer.toString("ascii",0,6);return gifRegexp.test(signature)}function calculate(buffer){return{width:buffer.readUInt16LE(6),height:buffer.readUInt16LE(8)}}module.exports={detect:isGIF,calculate:calculate}},function(module,exports,__webpack_require__){"use strict";var validJFIFMarkers={ffdb:"0001010101",ffe0:"4a46494600",ffe1:"4578696600",ffe2:"4943435f50",ffe3:"",ffe8:"5350494646",ffec:"4475636b79",ffed:"50686f746f",ffee:"41646f6265"};var red=["",""];function isJPG(buffer){var SOIMarker=buffer.toString("hex",0,2);var JFIFMarker=buffer.toString("hex",2,4);if("ffd8"!==SOIMarker){return false}var got=buffer.toString("hex",6,11);var expected=JFIFMarker&&validJFIFMarkers[JFIFMarker];if(expected===""){console.warn(red[0]+"this looks like a unrecognised jpeg\n"+"please report the issue here\n"+red[1]," https://github.com/netroy/image-size/issues/new\n");return false}return got===expected||JFIFMarker==="ffdb"}function extractSize(buffer,i){return{height:buffer.readUInt16BE(i),width:buffer.readUInt16BE(i+2)}}function validateBuffer(buffer,i){if(i>buffer.length){throw new TypeError("Corrupt JPG, exceeded buffer limits")}if(buffer[i]!==255){throw new TypeError("Invalid JPG, marker table corrupted")}}function calculate(buffer){buffer=buffer.slice(4);var i,next;while(buffer.length){i=buffer.readUInt16BE(0);validateBuffer(buffer,i);next=buffer[i+1];if(next===192||next===194){return extractSize(buffer,i+5)}buffer=buffer.slice(i+2)}throw new TypeError("Invalid JPG, no size found")}module.exports={detect:isJPG,calculate:calculate}},function(module,exports,__webpack_require__){"use strict";var pngSignature="PNG\r\n\n";function isPNG(buffer){if(pngSignature===buffer.toString("ascii",1,8)){if("IHDR"!==buffer.toString("ascii",12,16)){throw new TypeError("invalid png")}return true}}function calculate(buffer){return{width:buffer.readUInt32BE(16),height:buffer.readUInt32BE(20)}}module.exports={detect:isPNG,calculate:calculate}},function(module,exports,__webpack_require__){"use strict";function isPSD(buffer){return"8BPS"===buffer.toString("ascii",0,4)}function calculate(buffer){return{width:buffer.readUInt32BE(18),height:buffer.readUInt32BE(14)}}module.exports={detect:isPSD,calculate:calculate}},function(module,exports,__webpack_require__){"use strict";var svgReg=/]+[^>]*>/;function isSVG(buffer){return svgReg.test(buffer)}var extractorRegExps={root:/]+>/,width:/(^|\s)width\s*=\s*"(.+?)"/i,height:/(^|\s)height\s*=\s*"(.+?)"/i,viewbox:/(^|\s)viewbox\s*=\s*"(.+?)"/i};function getRatio(viewbox){var ratio=1;if(viewbox&&viewbox[2]){var dim=viewbox[2].split(/\s/g);if(dim.length===4){dim=dim.map(function(i){return parseInt(i,10)});ratio=(dim[2]-dim[0])/(dim[3]-dim[1])}}return ratio}function parse(buffer){var body=buffer.toString().replace(/[\r\n\s]+/g," ");var section=body.match(extractorRegExps.root);var root=section&§ion[0];if(root){var width=root.match(extractorRegExps.width);var height=root.match(extractorRegExps.height);var viewbox=root.match(extractorRegExps.viewbox);var ratio=getRatio(viewbox);return{width:parseInt(width&&width[2],10)||0,height:parseInt(height&&height[2],10)||0,ratio:ratio}}}function calculate(buffer){var parsed=parse(buffer);var width=parsed.width;var height=parsed.height;var ratio=parsed.ratio;if(width&&height){return{width:width,height:height}}else{if(width){return{width:width,height:Math.floor(width/ratio)}}else if(height){return{width:Math.floor(height*ratio),height:height}}else{throw new TypeError("invalid svg")}}}module.exports={detect:isSVG,calculate:calculate}},function(module,exports,__webpack_require__){(function(Buffer){"use strict";var fs=__webpack_require__(16);var readUInt=__webpack_require__(17);function isTIFF(buffer){var hex4=buffer.toString("hex",0,4);return"49492a00"===hex4||"4d4d002a"===hex4}function readIFD(buffer,filepath,isBigEndian){var ifdOffset=readUInt(buffer,32,4,isBigEndian);var bufferSize=1024;var fileSize=fs.statSync(filepath).size;if(ifdOffset+bufferSize>fileSize){bufferSize=fileSize-ifdOffset-10}var endBuffer=new Buffer(bufferSize);var descriptor=fs.openSync(filepath,"r");fs.readSync(descriptor,endBuffer,0,bufferSize,ifdOffset);var ifdBuffer=endBuffer.slice(2);return ifdBuffer}function readValue(buffer,isBigEndian){var low=readUInt(buffer,16,8,isBigEndian);var high=readUInt(buffer,16,10,isBigEndian);return(high<<16)+low}function nextTag(buffer){if(buffer.length>24){return buffer.slice(12)}}function extractTags(buffer,isBigEndian){var tags={};var code,type,length;while(buffer&&buffer.length){code=readUInt(buffer,16,0,isBigEndian);type=readUInt(buffer,16,2,isBigEndian);length=readUInt(buffer,32,4,isBigEndian);if(code===0){break}else{if(length===1&&type===3){tags[code]=readValue(buffer,isBigEndian)}buffer=nextTag(buffer)}}return tags}function determineEndianness(buffer){var signature=buffer.toString("ascii",0,2);if("II"===signature){return"LE"}else if("MM"===signature){return"BE"}}function calculate(buffer,filepath){if(!filepath){throw new TypeError("Tiff doesn't support buffer")}var isBigEndian=determineEndianness(buffer)==="BE";var ifdBuffer=readIFD(buffer,filepath,isBigEndian);var tags=extractTags(ifdBuffer,isBigEndian);var width=tags[256];var height=tags[257];if(!width||!height){throw new TypeError("Invalid Tiff, missing tags")}return{width:width,height:height}}module.exports={detect:isTIFF,calculate:calculate}}).call(exports,__webpack_require__(7).Buffer)},function(module,exports,__webpack_require__){"use strict";function isWebP(buffer){var riffHeader="RIFF"===buffer.toString("ascii",0,4);var webpHeader="WEBP"===buffer.toString("ascii",8,12);var vp8Header="VP8"===buffer.toString("ascii",12,15);return riffHeader&&webpHeader&&vp8Header}function calculate(buffer){var chunkHeader=buffer.toString("ascii",12,16);buffer=buffer.slice(20,30);if(chunkHeader==="VP8 "&&buffer[0]!==47){return calculateLossy(buffer)}var signature=buffer.toString("hex",3,6);if(chunkHeader==="VP8L"&&signature!=="9d012a"){return calculateLossless(buffer)}return false}function calculateLossless(buffer){return{width:1+((buffer[2]&63)<<8|buffer[1]),height:1+((buffer[4]&15)<<10|buffer[3]<<2|(buffer[2]&192)>>6)}}function calculateLossy(buffer){return{width:buffer.readInt16LE(6)&16383,height:buffer.readInt16LE(8)&16383}}module.exports={detect:isWebP,calculate:calculate}},function(module,exports,__webpack_require__){},function(module,exports,__webpack_require__){"use strict";module.exports=function(buffer,bits,offset,isBigEndian){offset=offset||0;var endian=!!isBigEndian?"BE":"LE";var method=buffer["readUInt"+bits+endian];return method.call(buffer,offset)}},function(module,exports,__webpack_require__){var process=module.exports={};var queue=[];var draining=false;function drainQueue(){if(draining){return}draining=true;var currentQueue;var len=queue.length;while(len){currentQueue=queue;queue=[];var i=-1;while(++i>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,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,eLen=nBytes*8-mLen-1,eMax=(1<>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,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}},function(module,exports,__webpack_require__){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},function(module,exports,__webpack_require__){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);var PLUS_URL_SAFE="-".charCodeAt(0);var SLASH_URL_SAFE="_".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS||code===PLUS_URL_SAFE)return 62;if(code===SLASH||code===SLASH_URL_SAFE)return 63;if(code0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(false?this.base64js={}:exports)}])});