UNPKG

html-to-docx-typescript

Version:
15 lines (13 loc) 137 kB
import JSZip from"jszip";import{fragment,create}from"xmlbuilder2";import HTMLToVDOM from"html-to-vdom";import crypto from"crypto";import require$$0 from"fs";import require$$1$1 from"path";import require$$1 from"events";import colorNames from"color-name"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function __rest(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]])}return t}function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P((function(resolve){resolve(value)}))).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}var isVnode=function(x){return x&&"VirtualNode"===x.type&&"2"===x.version};var isVNode=isVnode,isWidget=function(w){return w&&"Widget"===w.type},isThunk=function(t){return t&&"Thunk"===t.type},isVHook=function(hook){return hook&&("function"==typeof hook.hook&&!hook.hasOwnProperty("hook")||"function"==typeof hook.unhook&&!hook.hasOwnProperty("unhook"))},vnode=VirtualNode,noProperties={},noChildren=[];function VirtualNode(tagName,properties,children,key,namespace){this.tagName=tagName,this.properties=properties||noProperties,this.children=children||noChildren,this.key=null!=key?String(key):void 0,this.namespace="string"==typeof namespace?namespace:null;var hooks,count=children&&children.length||0,descendants=0,hasWidgets=!1,hasThunks=!1,descendantHooks=!1;for(var propName in properties)if(properties.hasOwnProperty(propName)){var property=properties[propName];isVHook(property)&&property.unhook&&(hooks||(hooks={}),hooks[propName]=property)}for(var i=0;i<count;i++){var child=children[i];isVNode(child)?(descendants+=child.count||0,!hasWidgets&&child.hasWidgets&&(hasWidgets=!0),!hasThunks&&child.hasThunks&&(hasThunks=!0),descendantHooks||!child.hooks&&!child.descendantHooks||(descendantHooks=!0)):!hasWidgets&&isWidget(child)?"function"==typeof child.destroy&&(hasWidgets=!0):!hasThunks&&isThunk(child)&&(hasThunks=!0)}this.count=count+descendants,this.hasWidgets=hasWidgets,this.hasThunks=hasThunks,this.hooks=hooks,this.descendantHooks=descendantHooks}VirtualNode.prototype.version="2",VirtualNode.prototype.type="VirtualNode";var vtext=VirtualText;function VirtualText(text){this.text=String(text)}VirtualText.prototype.version="2",VirtualText.prototype.type="VirtualText";const namespaces_a="http://schemas.openxmlformats.org/drawingml/2006/main",namespaces_cdr="http://schemas.openxmlformats.org/drawingml/2006/chartDrawing",namespaces_dc="http://purl.org/dc/elements/1.1/",namespaces_dcmitype="http://purl.org/dc/dcmitype/",namespaces_dcterms="http://purl.org/dc/terms/",namespaces_o="urn:schemas-microsoft-com:office:office",namespaces_pic="http://schemas.openxmlformats.org/drawingml/2006/picture",namespaces_r="http://schemas.openxmlformats.org/officeDocument/2006/relationships",namespaces_v="urn:schemas-microsoft-com:vml",namespaces_ve="http://schemas.openxmlformats.org/markup-compatibility/2006",namespaces_vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",namespaces_w="http://schemas.openxmlformats.org/wordprocessingml/2006/main",namespaces_w10="urn:schemas-microsoft-com:office:word",namespaces_wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",namespaces_wne="http://schemas.microsoft.com/office/word/2006/wordml",namespaces_xsi="http://www.w3.org/2001/XMLSchema-instance",namespaces_numbering="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",namespaces_hyperlinks="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",namespaces_images="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",namespaces_styles="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",namespaces_headers="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",namespaces_footers="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",namespaces_themes="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",namespaces_coreProperties="http://schemas.openxmlformats.org/package/2006/metadata/core-properties",namespaces_officeDocumentRelation="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",namespaces_corePropertiesRelation="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",namespaces_settingsRelation="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",namespaces_webSettingsRelation="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",namespaces_sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main",namespaces_contentTypes="http://schemas.openxmlformats.org/package/2006/content-types",namespaces_relationship="http://schemas.openxmlformats.org/package/2006/relationships";function eq(value,other){return value===other||value!=value&&other!=other}function assocIndexOf(array,key){for(var length=array.length;length--;)if(eq(array[length][0],key))return length;return-1}var splice=Array.prototype.splice;function ListCache(entries){var index=-1,length=null==entries?0:entries.length;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}ListCache.prototype.clear=function(){this.__data__=[],this.size=0},ListCache.prototype.delete=function(key){var data=this.__data__,index=assocIndexOf(data,key);return!(index<0)&&(index==data.length-1?data.pop():splice.call(data,index,1),--this.size,!0)},ListCache.prototype.get=function(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?void 0:data[index][1]},ListCache.prototype.has=function(key){return assocIndexOf(this.__data__,key)>-1},ListCache.prototype.set=function(key,value){var data=this.__data__,index=assocIndexOf(data,key);return index<0?(++this.size,data.push([key,value])):data[index][1]=value,this};var freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol=root.Symbol,objectProto$c=Object.prototype,hasOwnProperty$9=objectProto$c.hasOwnProperty,nativeObjectToString$1=objectProto$c.toString,symToStringTag$1=Symbol?Symbol.toStringTag:void 0;var nativeObjectToString=Object.prototype.toString;var symToStringTag=Symbol?Symbol.toStringTag:void 0;function baseGetTag(value){return null==value?void 0===value?"[object Undefined]":"[object Null]":symToStringTag&&symToStringTag in Object(value)?function(value){var isOwn=hasOwnProperty$9.call(value,symToStringTag$1),tag=value[symToStringTag$1];try{value[symToStringTag$1]=void 0;var unmasked=!0}catch(e){}var result=nativeObjectToString$1.call(value);return unmasked&&(isOwn?value[symToStringTag$1]=tag:delete value[symToStringTag$1]),result}(value):function(value){return nativeObjectToString.call(value)}(value)}function isObject(value){var type=typeof value;return null!=value&&("object"==type||"function"==type)}function isFunction(value){if(!isObject(value))return!1;var tag=baseGetTag(value);return"[object Function]"==tag||"[object GeneratorFunction]"==tag||"[object AsyncFunction]"==tag||"[object Proxy]"==tag}var uid,coreJsData=root["__core-js_shared__"],maskSrcKey=(uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||""))?"Symbol(src)_1."+uid:"";var funcToString$1=Function.prototype.toString;function toSource(func){if(null!=func){try{return funcToString$1.call(func)}catch(e){}try{return func+""}catch(e){}}return""}var reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$a=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$8=objectProto$a.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$8).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(value){return!(!isObject(value)||(func=value,maskSrcKey&&maskSrcKey in func))&&(isFunction(value)?reIsNative:reIsHostCtor).test(toSource(value));var func}function getNative(object,key){var value=function(object,key){return null==object?void 0:object[key]}(object,key);return baseIsNative(value)?value:void 0}var Map$1=getNative(root,"Map"),nativeCreate=getNative(Object,"create");var hasOwnProperty$7=Object.prototype.hasOwnProperty;var hasOwnProperty$6=Object.prototype.hasOwnProperty;function Hash(entries){var index=-1,length=null==entries?0:entries.length;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}function getMapData(map,key){var value,type,data=map.__data__;return("string"==(type=typeof(value=key))||"number"==type||"symbol"==type||"boolean"==type?"__proto__"!==value:null===value)?data["string"==typeof key?"string":"hash"]:data.map}function MapCache(entries){var index=-1,length=null==entries?0:entries.length;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}Hash.prototype.clear=function(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0},Hash.prototype.delete=function(key){var result=this.has(key)&&delete this.__data__[key];return this.size-=result?1:0,result},Hash.prototype.get=function(key){var data=this.__data__;if(nativeCreate){var result=data[key];return"__lodash_hash_undefined__"===result?void 0:result}return hasOwnProperty$7.call(data,key)?data[key]:void 0},Hash.prototype.has=function(key){var data=this.__data__;return nativeCreate?void 0!==data[key]:hasOwnProperty$6.call(data,key)},Hash.prototype.set=function(key,value){var data=this.__data__;return this.size+=this.has(key)?0:1,data[key]=nativeCreate&&void 0===value?"__lodash_hash_undefined__":value,this},MapCache.prototype.clear=function(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}},MapCache.prototype.delete=function(key){var result=getMapData(this,key).delete(key);return this.size-=result?1:0,result},MapCache.prototype.get=function(key){return getMapData(this,key).get(key)},MapCache.prototype.has=function(key){return getMapData(this,key).has(key)},MapCache.prototype.set=function(key,value){var data=getMapData(this,key),size=data.size;return data.set(key,value),this.size+=data.size==size?0:1,this};function Stack(entries){var data=this.__data__=new ListCache(entries);this.size=data.size}Stack.prototype.clear=function(){this.__data__=new ListCache,this.size=0},Stack.prototype.delete=function(key){var data=this.__data__,result=data.delete(key);return this.size=data.size,result},Stack.prototype.get=function(key){return this.__data__.get(key)},Stack.prototype.has=function(key){return this.__data__.has(key)},Stack.prototype.set=function(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map$1||pairs.length<199)return pairs.push([key,value]),this.size=++data.size,this;data=this.__data__=new MapCache(pairs)}return data.set(key,value),this.size=data.size,this};var defineProperty=function(){try{var func=getNative(Object,"defineProperty");return func({},"",{}),func}catch(e){}}();function baseAssignValue(object,key,value){"__proto__"==key&&defineProperty?defineProperty(object,key,{configurable:!0,enumerable:!0,value:value,writable:!0}):object[key]=value}var hasOwnProperty$5=Object.prototype.hasOwnProperty;function assignValue(object,key,value){var objValue=object[key];hasOwnProperty$5.call(object,key)&&eq(objValue,value)&&(void 0!==value||key in object)||baseAssignValue(object,key,value)}function copyObject(source,props,object,customizer){var isNew=!object;object||(object={});for(var index=-1,length=props.length;++index<length;){var key=props[index],newValue=customizer?customizer(object[key],source[key],key,object,source):void 0;void 0===newValue&&(newValue=source[key]),isNew?baseAssignValue(object,key,newValue):assignValue(object,key,newValue)}return object}function isObjectLike(value){return null!=value&&"object"==typeof value}function baseIsArguments(value){return isObjectLike(value)&&"[object Arguments]"==baseGetTag(value)}var objectProto$6=Object.prototype,hasOwnProperty$4=objectProto$6.hasOwnProperty,propertyIsEnumerable$1=objectProto$6.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty$4.call(value,"callee")&&!propertyIsEnumerable$1.call(value,"callee")},isArray=Array.isArray;var freeExports$2="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&"object"==typeof module&&module&&!module.nodeType&&module,Buffer$2=freeModule$2&&freeModule$2.exports===freeExports$2?root.Buffer:void 0,isBuffer=(Buffer$2?Buffer$2.isBuffer:void 0)||function(){return!1},reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(value,length){var type=typeof value;return!!(length=null==length?9007199254740991:length)&&("number"==type||"symbol"!=type&&reIsUint.test(value))&&value>-1&&value%1==0&&value<length}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=9007199254740991}var typedArrayTags={};function baseUnary(func){return function(value){return func(value)}}typedArrayTags["[object Float32Array]"]=typedArrayTags["[object Float64Array]"]=typedArrayTags["[object Int8Array]"]=typedArrayTags["[object Int16Array]"]=typedArrayTags["[object Int32Array]"]=typedArrayTags["[object Uint8Array]"]=typedArrayTags["[object Uint8ClampedArray]"]=typedArrayTags["[object Uint16Array]"]=typedArrayTags["[object Uint32Array]"]=!0,typedArrayTags["[object Arguments]"]=typedArrayTags["[object Array]"]=typedArrayTags["[object ArrayBuffer]"]=typedArrayTags["[object Boolean]"]=typedArrayTags["[object DataView]"]=typedArrayTags["[object Date]"]=typedArrayTags["[object Error]"]=typedArrayTags["[object Function]"]=typedArrayTags["[object Map]"]=typedArrayTags["[object Number]"]=typedArrayTags["[object Object]"]=typedArrayTags["[object RegExp]"]=typedArrayTags["[object Set]"]=typedArrayTags["[object String]"]=typedArrayTags["[object WeakMap]"]=!1;var freeExports$1="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&"object"==typeof module&&module&&!module.nodeType&&module,freeProcess=freeModule$1&&freeModule$1.exports===freeExports$1&&freeGlobal.process,nodeUtil=function(){try{var types=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return types||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):function(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[baseGetTag(value)]},hasOwnProperty$3=Object.prototype.hasOwnProperty;function arrayLikeKeys(value,inherited){var isArr=isArray(value),isArg=!isArr&&isArguments(value),isBuff=!isArr&&!isArg&&isBuffer(value),isType=!isArr&&!isArg&&!isBuff&&isTypedArray(value),skipIndexes=isArr||isArg||isBuff||isType,result=skipIndexes?function(n,iteratee){for(var index=-1,result=Array(n);++index<n;)result[index]=iteratee(index);return result}(value.length,String):[],length=result.length;for(var key in value)!inherited&&!hasOwnProperty$3.call(value,key)||skipIndexes&&("length"==key||isBuff&&("offset"==key||"parent"==key)||isType&&("buffer"==key||"byteLength"==key||"byteOffset"==key)||isIndex(key,length))||result.push(key);return result}var objectProto$4=Object.prototype;function isPrototype(value){var Ctor=value&&value.constructor;return value===("function"==typeof Ctor&&Ctor.prototype||objectProto$4)}function overArg(func,transform){return function(arg){return func(transform(arg))}}var nativeKeys=overArg(Object.keys,Object),hasOwnProperty$2=Object.prototype.hasOwnProperty;function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function keys$1(object){return isArrayLike(object)?arrayLikeKeys(object):function(object){if(!isPrototype(object))return nativeKeys(object);var result=[];for(var key in Object(object))hasOwnProperty$2.call(object,key)&&"constructor"!=key&&result.push(key);return result}(object)}var hasOwnProperty$1=Object.prototype.hasOwnProperty;function baseKeysIn(object){if(!isObject(object))return function(object){var result=[];if(null!=object)for(var key in Object(object))result.push(key);return result}(object);var isProto=isPrototype(object),result=[];for(var key in object)("constructor"!=key||!isProto&&hasOwnProperty$1.call(object,key))&&result.push(key);return result}function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,!0):baseKeysIn(object)}var freeExports="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&"object"==typeof module&&module&&!module.nodeType&&module,Buffer$1=freeModule&&freeModule.exports===freeExports?root.Buffer:void 0,allocUnsafe=Buffer$1?Buffer$1.allocUnsafe:void 0;function stubArray(){return[]}var propertyIsEnumerable=Object.prototype.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols$1?function(object){return null==object?[]:(object=Object(object),function(array,predicate){for(var index=-1,length=null==array?0:array.length,resIndex=0,result=[];++index<length;){var value=array[index];predicate(value,index,array)&&(result[resIndex++]=value)}return result}(nativeGetSymbols$1(object),(function(symbol){return propertyIsEnumerable.call(object,symbol)})))}:stubArray;function arrayPush(array,values){for(var index=-1,length=values.length,offset=array.length;++index<length;)array[offset+index]=values[index];return array}var getPrototype=overArg(Object.getPrototypeOf,Object),getSymbolsIn=Object.getOwnPropertySymbols?function(object){for(var result=[];object;)arrayPush(result,getSymbols(object)),object=getPrototype(object);return result}:stubArray;function baseGetAllKeys(object,keysFunc,symbolsFunc){var result=keysFunc(object);return isArray(object)?result:arrayPush(result,symbolsFunc(object))}function getAllKeys(object){return baseGetAllKeys(object,keys$1,getSymbols)}function getAllKeysIn(object){return baseGetAllKeys(object,keysIn,getSymbolsIn)}var DataView=getNative(root,"DataView"),Promise$1=getNative(root,"Promise"),Set=getNative(root,"Set"),WeakMap=getNative(root,"WeakMap"),dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap),getTag=baseGetTag;(DataView&&"[object DataView]"!=getTag(new DataView(new ArrayBuffer(1)))||Map$1&&"[object Map]"!=getTag(new Map$1)||Promise$1&&"[object Promise]"!=getTag(Promise$1.resolve())||Set&&"[object Set]"!=getTag(new Set)||WeakMap&&"[object WeakMap]"!=getTag(new WeakMap))&&(getTag=function(value){var result=baseGetTag(value),Ctor="[object Object]"==result?value.constructor:void 0,ctorString=Ctor?toSource(Ctor):"";if(ctorString)switch(ctorString){case dataViewCtorString:return"[object DataView]";case mapCtorString:return"[object Map]";case promiseCtorString:return"[object Promise]";case setCtorString:return"[object Set]";case weakMapCtorString:return"[object WeakMap]"}return result});var getTag$1=getTag,hasOwnProperty=Object.prototype.hasOwnProperty;var Uint8Array$1=root.Uint8Array;function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);return new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer)),result}var reFlags=/\w*$/;var symbolProto=Symbol?Symbol.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function initCloneByTag(object,tag,isDeep){var symbol,regexp,result,Ctor=object.constructor;switch(tag){case"[object ArrayBuffer]":return cloneArrayBuffer(object);case"[object Boolean]":case"[object Date]":return new Ctor(+object);case"[object DataView]":return function(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)}(object,isDeep);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}(object,isDeep);case"[object Map]":case"[object Set]":return new Ctor;case"[object Number]":case"[object String]":return new Ctor(object);case"[object RegExp]":return(result=new(regexp=object).constructor(regexp.source,reFlags.exec(regexp))).lastIndex=regexp.lastIndex,result;case"[object Symbol]":return symbol=object,symbolValueOf?Object(symbolValueOf.call(symbol)):{}}}var objectCreate=Object.create,baseCreate=function(){function object(){}return function(proto){if(!isObject(proto))return{};if(objectCreate)return objectCreate(proto);object.prototype=proto;var result=new object;return object.prototype=void 0,result}}();var nodeIsMap=nodeUtil&&nodeUtil.isMap,isMap=nodeIsMap?baseUnary(nodeIsMap):function(value){return isObjectLike(value)&&"[object Map]"==getTag$1(value)};var nodeIsSet=nodeUtil&&nodeUtil.isSet,isSet=nodeIsSet?baseUnary(nodeIsSet):function(value){return isObjectLike(value)&&"[object Set]"==getTag$1(value)},cloneableTags={};function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=1&bitmask,isFlat=2&bitmask,isFull=4&bitmask;if(customizer&&(result=object?customizer(value,key,object,stack):customizer(value)),void 0!==result)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){if(result=function(array){var length=array.length,result=new array.constructor(length);return length&&"string"==typeof array[0]&&hasOwnProperty.call(array,"index")&&(result.index=array.index,result.input=array.input),result}(value),!isDeep)return function(source,array){var index=-1,length=source.length;for(array||(array=Array(length));++index<length;)array[index]=source[index];return array}(value,result)}else{var tag=getTag$1(value),isFunc="[object Function]"==tag||"[object GeneratorFunction]"==tag;if(isBuffer(value))return function(buffer,isDeep){if(isDeep)return buffer.slice();var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);return buffer.copy(result),result}(value,isDeep);if("[object Object]"==tag||"[object Arguments]"==tag||isFunc&&!object){if(result=isFlat||isFunc?{}:function(object){return"function"!=typeof object.constructor||isPrototype(object)?{}:baseCreate(getPrototype(object))}(value),!isDeep)return isFlat?function(source,object){return copyObject(source,getSymbolsIn(source),object)}(value,function(object,source){return object&&copyObject(source,keysIn(source),object)}(result,value)):function(source,object){return copyObject(source,getSymbols(source),object)}(value,function(object,source){return object&&copyObject(source,keys$1(source),object)}(result,value))}else{if(!cloneableTags[tag])return object?value:{};result=initCloneByTag(value,tag,isDeep)}}stack||(stack=new Stack);var stacked=stack.get(value);if(stacked)return stacked;stack.set(value,result),isSet(value)?value.forEach((function(subValue){result.add(baseClone(subValue,bitmask,customizer,subValue,value,stack))})):isMap(value)&&value.forEach((function(subValue,key){result.set(key,baseClone(subValue,bitmask,customizer,key,value,stack))}));var props=isArr?void 0:(isFull?isFlat?getAllKeysIn:getAllKeys:isFlat?keysIn:keys$1)(value);return function(array,iteratee){for(var index=-1,length=null==array?0:array.length;++index<length&&!1!==iteratee(array[index],index,array););}(props||value,(function(subValue,key){props&&(subValue=value[key=subValue]),assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack))})),result}cloneableTags["[object Arguments]"]=cloneableTags["[object Array]"]=cloneableTags["[object ArrayBuffer]"]=cloneableTags["[object DataView]"]=cloneableTags["[object Boolean]"]=cloneableTags["[object Date]"]=cloneableTags["[object Float32Array]"]=cloneableTags["[object Float64Array]"]=cloneableTags["[object Int8Array]"]=cloneableTags["[object Int16Array]"]=cloneableTags["[object Int32Array]"]=cloneableTags["[object Map]"]=cloneableTags["[object Number]"]=cloneableTags["[object Object]"]=cloneableTags["[object RegExp]"]=cloneableTags["[object Set]"]=cloneableTags["[object String]"]=cloneableTags["[object Symbol]"]=cloneableTags["[object Uint8Array]"]=cloneableTags["[object Uint8ClampedArray]"]=cloneableTags["[object Uint16Array]"]=cloneableTags["[object Uint32Array]"]=!0,cloneableTags["[object Error]"]=cloneableTags["[object Function]"]=cloneableTags["[object WeakMap]"]=!1;function cloneDeep(value){return baseClone(value,5)}const landscapeMargins={top:1800,right:1440,bottom:1800,left:1440,header:720,footer:720,gutter:0},portraitMargins={top:1440,right:1800,bottom:1440,left:1800,header:720,footer:720,gutter:0},defaultDocumentOptions={orientation:"portrait",margins:cloneDeep(portraitMargins),title:"",subject:"",creator:"html-to-docx",keywords:["html-to-docx"],description:"",lastModifiedBy:"html-to-docx",revision:1,createdAt:new Date,modifiedAt:new Date,headerType:"default",header:!1,footerType:"default",footer:!1,font:"Times New Roman",fontSize:22,complexScriptFontSize:22,table:{row:{cantSplit:!1}},pageNumber:!1,skipFirstHeaderFooter:!1,lineNumber:!1,lineNumberOptions:{countBy:1,start:0,restart:"continuous"}},paragraphBordersObject={top:{size:0,spacing:3,color:"FFFFFF"},left:{size:0,spacing:3,color:"FFFFFF"},bottom:{size:0,spacing:3,color:"FFFFFF"},right:{size:0,spacing:3,color:"FFFFFF"}},colorlessColors=["transparent","auto"],verticalAlignValues=["top","middle","bottom"],documentRelsXML=`\n <?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n\n <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="${namespaces_numbering}" Target="numbering.xml"/>\n <Relationship Id="rId2" Type="${namespaces_styles}" Target="styles.xml"/>\n <Relationship Id="rId3" Type="${namespaces_settingsRelation}" Target="settings.xml"/>\n <Relationship Id="rId4" Type="${namespaces_webSettingsRelation}" Target="webSettings.xml"/>\n </Relationships>\n`,relsXML=`\n <?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n\n <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="${namespaces_officeDocumentRelation}" Target="word/document.xml"/>\n <Relationship Id="rId2" Type="${namespaces_corePropertiesRelation}" Target="docProps/core.xml"/>\n </Relationships>\n`,fontTableXML=`\n <?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n\n <w:fonts\n xmlns:r="${namespaces_r}"\n xmlns:w="${namespaces_w}"\n >\n <w:font w:name="Calibri">\n <w:panose1 w:val="020F0502020204030204"/>\n <w:charset w:val="00"/>\n <w:family w:val="swiss"/>\n <w:pitch w:val="variable"/>\n <w:sig w:usb0="E4002EFF" w:usb1="C000247B" w:usb2="00000009" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000"/>\n </w:font>\n <w:font w:name="Times New Roman">\n <w:panose1 w:val="02020603050405020304"/>\n <w:charset w:val="00"/>\n <w:family w:val="roman"/>\n <w:pitch w:val="variable"/>\n <w:sig w:usb0="E0002EFF" w:usb1="C000785B" w:usb2="00000009" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000"/>\n </w:font>\n <w:font w:name="Calibri Light">\n <w:panose1 w:val="020F0302020204030204"/>\n <w:charset w:val="00"/>\n <w:family w:val="swiss"/>\n <w:pitch w:val="variable"/>\n <w:sig w:usb0="E4002EFF" w:usb1="C000247B" w:usb2="00000009" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000"/>\n </w:font>\n </w:fonts>\n`,settingsXML=`\n <?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n\n <w:settings xmlns:w="${namespaces_w}" xmlns:o="${namespaces_o}" xmlns:r="${namespaces_r}" xmlns:v="${namespaces_v}" xmlns:w10="${namespaces_w10}" xmlns:sl="${namespaces_sl}">\n <w:zoom w:percent="100"/>\n <w:defaultTabStop w:val="720"/>\n <w:decimalSymbol w:val="."/>\n <w:listSeparator w:val=","/>\n </w:settings>\n`,webSettingsXML=`\n <?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n\n <w:webSettings xmlns:w="${namespaces_w}" xmlns:r="${namespaces_r}">\n </w:webSettings>\n`;let pool,poolOffset,nanoid=(size=21)=>{var bytes;bytes=size-=0,!pool||pool.length<bytes?(pool=Buffer.allocUnsafe(128*bytes),crypto.randomFillSync(pool),poolOffset=0):poolOffset+bytes>pool.length&&(crypto.randomFillSync(pool),poolOffset=0),poolOffset+=bytes;let id="";for(let i=poolOffset-size;i<poolOffset;i++)id+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&pool[i]];return id};var isVtext=function(x){return x&&"VirtualText"===x.type&&"2"===x.version};const{replace:replace}="",ca=/[&<>'"]/g,esca={"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"},pe=m=>esca[m],vNodeHasChildren=vNode=>vNode&&vNode.children&&Array.isArray(vNode.children)&&vNode.children.length;var dist={exports:{}},queue={exports:{}},inherits$1={exports:{}},inherits_browser={exports:{}};"function"==typeof Object.create?inherits_browser.exports=function(ctor,superCtor){superCtor&&(ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}};try{var util=require("util");if("function"!=typeof util.inherits)throw"";inherits$1.exports=util.inherits}catch(e){inherits$1.exports=inherits_browser.exports}var inherits=inherits$1.exports,EventEmitter=require$$1.EventEmitter;function Queue(options){if(!(this instanceof Queue))return new Queue(options);EventEmitter.call(this),options=options||{},this.concurrency=options.concurrency||1/0,this.timeout=options.timeout||0,this.autostart=options.autostart||!1,this.results=options.results||null,this.pending=0,this.session=0,this.running=!1,this.jobs=[],this.timers={}}queue.exports=Queue,queue.exports.default=Queue,inherits(Queue,EventEmitter);["pop","shift","indexOf","lastIndexOf"].forEach((function(method){Queue.prototype[method]=function(){return Array.prototype[method].apply(this.jobs,arguments)}})),Queue.prototype.slice=function(begin,end){return this.jobs=this.jobs.slice(begin,end),this},Queue.prototype.reverse=function(){return this.jobs.reverse(),this};function clearTimers(){for(var key in this.timers){var timeoutId=this.timers[key];delete this.timers[key],clearTimeout(timeoutId)}}function callOnErrorOrEnd(cb){var self=this;function onerror(err){self.end(err)}this.on("error",onerror),this.on("end",(function onend(err){self.removeListener("error",onerror),self.removeListener("end",onend),cb(err,this.results)}))}function done(err){this.session++,this.running=!1,this.emit("end",err)}["push","unshift","splice"].forEach((function(method){Queue.prototype[method]=function(){var methodResult=Array.prototype[method].apply(this.jobs,arguments);return this.autostart&&this.start(),methodResult}})),Object.defineProperty(Queue.prototype,"length",{get:function(){return this.pending+this.jobs.length}}),Queue.prototype.start=function(cb){if(cb&&callOnErrorOrEnd.call(this,cb),this.running=!0,!(this.pending>=this.concurrency))if(0!==this.jobs.length){var self=this,job=this.jobs.shift(),once=!0,session=this.session,timeoutId=null,didTimeout=!1,resultIndex=null,timeout=job.hasOwnProperty("timeout")?job.timeout:this.timeout;timeout&&(timeoutId=setTimeout((function(){didTimeout=!0,self.listeners("timeout").length>0?self.emit("timeout",next,job):next()}),timeout),this.timers[timeoutId]=timeoutId),this.results&&(resultIndex=this.results.length,this.results[resultIndex]=null),this.pending++,self.emit("start",job);var promise=job(next);promise&&promise.then&&"function"==typeof promise.then&&promise.then((function(result){return next(null,result)})).catch((function(err){return next(err||!0)})),this.running&&this.jobs.length>0&&this.start()}else 0===this.pending&&done.call(this);function next(err,result){once&&self.session===session&&(once=!1,self.pending--,null!==timeoutId&&(delete self.timers[timeoutId],clearTimeout(timeoutId)),err?self.emit("error",err,job):!1===didTimeout&&(null!==resultIndex&&(self.results[resultIndex]=Array.prototype.slice.call(arguments,1)),self.emit("success",result,job)),self.session===session&&(0===self.pending&&0===self.jobs.length?done.call(self):self.running&&self.start()))}},Queue.prototype.stop=function(){this.running=!1},Queue.prototype.end=function(err){clearTimers.call(this),this.jobs.length=0,this.pending=0,done.call(this,err)};var types={},bmp={};Object.defineProperty(bmp,"__esModule",{value:!0}),bmp.BMP=void 0,bmp.BMP={validate:buffer=>"BM"===buffer.toString("ascii",0,2),calculate:buffer=>({height:Math.abs(buffer.readInt32LE(22)),width:buffer.readUInt32LE(18)})};var cur={},ico={};Object.defineProperty(ico,"__esModule",{value:!0}),ico.ICO=void 0;function getSizeFromOffset(buffer,offset){const value=buffer.readUInt8(offset);return 0===value?256:value}function getImageSize$1(buffer,imageIndex){const offset=6+16*imageIndex;return{height:getSizeFromOffset(buffer,offset+1),width:getSizeFromOffset(buffer,offset)}}ico.ICO={validate:buffer=>0===buffer.readUInt16LE(0)&&1===buffer.readUInt16LE(2),calculate(buffer){const nbImages=buffer.readUInt16LE(4),imageSize=getImageSize$1(buffer,0);if(1===nbImages)return imageSize;const imgs=[imageSize];for(let imageIndex=1;imageIndex<nbImages;imageIndex+=1)imgs.push(getImageSize$1(buffer,imageIndex));return{height:imageSize.height,images:imgs,width:imageSize.width}}},Object.defineProperty(cur,"__esModule",{value:!0}),cur.CUR=void 0;const ico_1$1=ico;cur.CUR={validate:buffer=>0===buffer.readUInt16LE(0)&&2===buffer.readUInt16LE(2),calculate:buffer=>ico_1$1.ICO.calculate(buffer)};var dds={};Object.defineProperty(dds,"__esModule",{value:!0}),dds.DDS=void 0,dds.DDS={validate:buffer=>542327876===buffer.readUInt32LE(0),calculate:buffer=>({height:buffer.readUInt32LE(12),width:buffer.readUInt32LE(16)})};var gif={};Object.defineProperty(gif,"__esModule",{value:!0}),gif.GIF=void 0;const gifRegexp=/^GIF8[79]a/;gif.GIF={validate(buffer){const signature=buffer.toString("ascii",0,6);return gifRegexp.test(signature)},calculate:buffer=>({height:buffer.readUInt16LE(8),width:buffer.readUInt16LE(6)})};var icns={};Object.defineProperty(icns,"__esModule",{value:!0}),icns.ICNS=void 0;const ICON_TYPE_SIZE={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function readImageHeader(buffer,imageOffset){const imageLengthOffset=imageOffset+4;return[buffer.toString("ascii",imageOffset,imageLengthOffset),buffer.readUInt32BE(imageLengthOffset)]}function getImageSize(type){const size=ICON_TYPE_SIZE[type];return{width:size,height:size,type:type}}icns.ICNS={validate:buffer=>"icns"===buffer.toString("ascii",0,4),calculate(buffer){const bufferLength=buffer.length,fileLength=buffer.readUInt32BE(4);let imageOffset=8,imageHeader=readImageHeader(buffer,imageOffset),imageSize=getImageSize(imageHeader[0]);if(imageOffset+=imageHeader[1],imageOffset===fileLength)return imageSize;const result={height:imageSize.height,images:[imageSize],width:imageSize.width};for(;imageOffset<fileLength&&imageOffset<bufferLength;)imageHeader=readImageHeader(buffer,imageOffset),imageSize=getImageSize(imageHeader[0]),imageOffset+=imageHeader[1],result.images.push(imageSize);return result}};var j2c={};Object.defineProperty(j2c,"__esModule",{value:!0}),j2c.J2C=void 0,j2c.J2C={validate:buffer=>"ff4fff51"===buffer.toString("hex",0,4),calculate:buffer=>({height:buffer.readUInt32BE(12),width:buffer.readUInt32BE(8)})};var jp2={};Object.defineProperty(jp2,"__esModule",{value:!0}),jp2.JP2=void 0;const BoxTypes_ftyp="66747970",BoxTypes_jp2h="6a703268",BoxTypes_jp__="6a502020",BoxTypes_rreq="72726571",parseIHDR=box=>({height:box.readUInt32BE(4),width:box.readUInt32BE(8)});jp2.JP2={validate(buffer){const signature=buffer.toString("hex",4,8),signatureLength=buffer.readUInt32BE(0);if(signature!==BoxTypes_jp__||signatureLength<1)return!1;const ftypeBoxStart=signatureLength+4,ftypBoxLength=buffer.readUInt32BE(signatureLength);return buffer.slice(ftypeBoxStart,ftypeBoxStart+ftypBoxLength).toString("hex",0,4)===BoxTypes_ftyp},calculate(buffer){const signatureLength=buffer.readUInt32BE(0);let offset=signatureLength+4+buffer.readUInt16BE(signatureLength+2);switch(buffer.toString("hex",offset,offset+4)){case BoxTypes_rreq:return offset=offset+4+4+(box=>{const unit=box.readUInt8(0);let offset=1+2*unit;return offset=offset+2+box.readUInt16BE(offset)*(2+unit),offset+2+box.readUInt16BE(offset)*(16+unit)})(buffer.slice(offset+4)),parseIHDR(buffer.slice(offset+8,offset+24));case BoxTypes_jp2h:return parseIHDR(buffer.slice(offset+8,offset+24));default:throw new TypeError("Unsupported header found: "+buffer.toString("ascii",offset,offset+4))}}};var jpg={},readUInt$1={};Object.defineProperty(readUInt$1,"__esModule",{value:!0}),readUInt$1.readUInt=void 0,readUInt$1.readUInt=function(buffer,bits,offset,isBigEndian){return offset=offset||0,buffer["readUInt"+bits+(isBigEndian?"BE":"LE")].call(buffer,offset)},Object.defineProperty(jpg,"__esModule",{value:!0}),jpg.JPG=void 0;const readUInt_1$1=readUInt$1;function isEXIF(buffer){return"45786966"===buffer.toString("hex",2,6)}function extractSize(buffer,index){return{height:buffer.readUInt16BE(index),width:buffer.readUInt16BE(index+2)}}function validateExifBlock(buffer,index){const exifBlock=buffer.slice(2,index),byteAlign=exifBlock.toString("hex",6,8),isBigEndian="4d4d"===byteAlign;if(isBigEndian||"4949"===byteAlign)return function(exifBlock,isBigEndian){const idfDirectoryEntries=(0,readUInt_1$1.readUInt)(exifBlock,16,14,isBigEndian);for(let directoryEntryNumber=0;directoryEntryNumber<idfDirectoryEntries;directoryEntryNumber++){const start=16+12*directoryEntryNumber,end=start+12;if(start>exifBlock.length)return;const block=exifBlock.slice(start,end);if(274===(0,readUInt_1$1.readUInt)(block,16,0,isBigEndian)){if(3!==(0,readUInt_1$1.readUInt)(block,16,2,isBigEndian))return;if(1!==(0,readUInt_1$1.readUInt)(block,32,4,isBigEndian))return;return(0,readUInt_1$1.readUInt)(block,16,8,isBigEndian)}}}(exifBlock,isBigEndian)}function validateBuffer(buffer,index){if(index>buffer.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(255!==buffer[index])throw new TypeError("Invalid JPG, marker table corrupted")}jpg.JPG={validate:buffer=>"ffd8"===buffer.toString("hex",0,2),calculate(buffer){let orientation,next;for(buffer=buffer.slice(4);buffer.length;){const i=buffer.readUInt16BE(0);if(isEXIF(buffer)&&(orientation=validateExifBlock(buffer,i)),validateBuffer(buffer,i),next=buffer[i+1],192===next||193===next||194===next){const size=extractSize(buffer,i+5);return orientation?{height:size.height,orientation:orientation,width:size.width}:size}buffer=buffer.slice(i+2)}throw new TypeError("Invalid JPG, no size found")}};var ktx={};Object.defineProperty(ktx,"__esModule",{value:!0}),ktx.KTX=void 0;ktx.KTX={validate:buffer=>"KTX 11"===buffer.toString("ascii",1,7),calculate:buffer=>({height:buffer.readUInt32LE(40),width:buffer.readUInt32LE(36)})};var png={};Object.defineProperty(png,"__esModule",{value:!0}),png.PNG=void 0;png.PNG={validate(buffer){if("PNG\r\n\n"===buffer.toString("ascii",1,8)){let chunkName=buffer.toString("ascii",12,16);if("CgBI"===chunkName&&(chunkName=buffer.toString("ascii",28,32)),"IHDR"!==chunkName)throw new TypeError("Invalid PNG");return!0}return!1},calculate:buffer=>"CgBI"===buffer.toString("ascii",12,16)?{height:buffer.readUInt32BE(36),width:buffer.readUInt32BE(32)}:{height:buffer.readUInt32BE(20),width:buffer.readUInt32BE(16)}};var pnm={};Object.defineProperty(pnm,"__esModule",{value:!0}),pnm.PNM=void 0;const PNMTypes={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},Signatures=Object.keys(PNMTypes),handlers={default:lines=>{let dimensions=[];for(;lines.length>0;){const line=lines.shift();if("#"!==line[0]){dimensions=line.split(" ");break}}if(2===dimensions.length)return{height:parseInt(dimensions[1],10),width:parseInt(dimensions[0],10)};throw new TypeError("Invalid PNM")},pam:lines=>{const size={};for(;lines.length>0;){const line=lines.shift();if(line.length>16||line.charCodeAt(0)>128)continue;const[key,value]=line.split(" ");if(key&&value&&(size[key.toLowerCase()]=parseInt(value,10)),size.height&&size.width)break}if(size.height&&size.width)return{height:size.height,width:size.width};throw new TypeError("Invalid PAM")}};pnm.PNM={validate(buffer){const signature=buffer.toString("ascii",0,2);return Signatures.includes(signature)},calculate(buffer){const signature=buffer.toString("ascii",0,2),type=PNMTypes[signature],lines=buffer.toString("ascii",3).split(/[\r\n]+/);return(handlers[type]||handlers.default)(lines)}};var psd={};Object.defineProperty(psd,"__esModule",{value:!0}),psd.PSD=void 0,psd.PSD={validate:buffer=>"8BPS"===buffer.toString("ascii",0,4),calculate:buffer=>({height:buffer.readUInt32BE(14),width:buffer.readUInt32BE(18)})};var svg={};Object.defineProperty(svg,"__esModule",{value:!0}),svg.SVG=void 0;const svgReg=/<svg\s([^>"']|"[^"]*"|'[^']*')*>/,extractorRegExps={height:/\sheight=(['"])([^%]+?)\1/,root:svgReg,viewbox:/\sviewBox=(['"])(.+?)\1/i,width:/\swidth=(['"])([^%]+?)\1/},units={in:96,cm:96/2.54,em:16,ex:8,m:96/2.54*100,mm:96/2.54/10,pc:96/72/12,pt:96/72,px:1},unitsReg=new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);function parseLength(len){const m=unitsReg.exec(len);if(m)return Math.round(Number(m[1])*(units[m[2]]||1))}function parseViewbox(viewbox){const bounds=viewbox.split(" ");return{height:parseLength(bounds[3]),width:parseLength(bounds[2])}}svg.SVG={validate(buffer){const str=String(buffer);return svgReg.test(str)},calculate(buffer){const root=buffer.toString("utf8").match(extractorRegExps.root);if(root){const attrs=function(root){const width=root.match(extractorRegExps.width),height=root.match(extractorRegExps.height),viewbox=root.match(extractorRegExps.viewbox);return{height:height&&parseLength(height[2]),viewbox:viewbox&&parseViewbox(viewbox[2]),width:width&&parseLength(width[2])}}(root[0]);if(attrs.width&&attrs.height)return function(attrs){return{height:attrs.height,width:attrs.width}}(attrs);if(attrs.viewbox)return function(attrs,viewbox){const ratio=viewbox.width/viewbox.height;return attrs.width?{height:Math.floor(attrs.width/ratio),width:attrs.width}:attrs.height?{height:attrs.height,width:Math.floor(attrs.height*ratio)}:{height:viewbox.height,width:viewbox.width}}(attrs,attrs.viewbox)}throw new TypeError("Invalid SVG")}};var tiff={};Object.defineProperty(tiff,"__esModule",{value:!0}),tiff.TIFF=void 0;const fs=require$$0,readUInt_1=readUInt$1;function readValue(buffer,isBigEndian){const low=(0,readUInt_1.readUInt)(buffer,16,8,isBigEndian);return((0,readUInt_1.readUInt)(buffer,16,10,isBigEndian)<<16)+low}function nextTag(buffer){if(buffer.length>24)return buffer.slice(12)}const signatures=["49492a00","4d4d002a"];tiff.TIFF={validate:buffer=>signatures.includes(buffer.toString("hex",0,4)),calculate(buffer,filepath){if(!filepath)throw new TypeError("Tiff doesn't support buffer");const isBigEndian="BE"===function(buffer){const signature=buffer.toString("ascii",0,2);return"II"===signature?"LE":"MM"===signature?"BE":void 0}(buffer),ifdBuffer=function(buffer,filepath,isBigEndian){const ifdOffset=(0,readUInt_1.readUInt)(buffer,32,4,isBigEndian);let bufferSize=1024;const fileSize=fs.statSync(filepath).size;ifdOffset+bufferSize>fileSize&&(bufferSize=fileSize-ifdOffset-10);const endBuffer=Buffer.alloc(bufferSize),descriptor=fs.openSync(filepath,"r");return fs.readSync(descriptor,endBuffer,0,bufferSize,ifdOffset),fs.closeSync(descriptor),endBuffer.slice(2)}(buffer,filepath,isBigEndian),tags=function(buffer,isBigEndian){const tags={};let temp=buffer;for(;temp&&temp.length;){const code=(0,readUInt_1.readUInt)(temp,16,0,isBigEndian),type=(0,readUInt_1.readUInt)(temp,16,2,isBigEndian),length=(0,readUInt_1.readUInt)(temp,32,4,isBigEndian);if(0===code)break;1!==length||3!==type&&4!==type||(tags[code]=readValue(temp,isBigEndian)),temp=nextTag(temp)}return tags}(ifdBuffer,isBigEndian),width=tags[256],height=tags[257];if(!width||!height)throw new TypeError("Invalid Tiff. Missing tags");return{height:height,width:width}}};var webp={};Object.defineProperty(webp,"__esModule",{value:!0}),webp.WEBP=void 0,webp.WEBP={validate(buffer){const riffHeader="RIFF"===buffer.toString("ascii",0,4),webpHeader="WEBP"===buffer.toString("ascii",8,12),vp8Header="VP8"===buffer.toString("ascii",12,15);return riffHeader&&webpHeader&&vp8Header},calculate(buffer){const chunkHeader=buffer.toString("ascii",12,16);if(buffer=buffer.slice(20,30),"VP8X"===chunkHeader){const extendedHeader=buffer[0],validEnd=0==(1&extendedHeader);if(0==(192&extendedHeader)&&validEnd)return function(buffer){return{height:1+buffer.readUIntLE(7,3),width:1+buffer.readUIntLE(4,3)}}(buffer);throw new TypeError("Invalid WebP")}if("VP8 "===chunkHeader&&47!==buffer[0])return function(buffer){return{height:16383&buffer.readInt16LE(8),width:16383&buffer.readInt16LE(6)}}(buffer);const signature=buffer.toString("hex",3,6);if("VP8L"===chunkHeader&&"9d012a"!==signature)return function(buffer){return{height:1+((15&buffer[4])<<10|buffer[3]<<2|(192&buffer[2])>>6),width:1+((63&buffer[2])<<8|buffer[1])}}(buffer);throw new TypeError("Invalid WebP")}},Object.defineProperty(types,"__esModule",{value:!0}),types.typeHandlers=void 0;const bmp_1=bmp,cur_1=cur,dds_1=dds,gif_1=gif,icns_1=icns,ico_1=ico,j2c_1=j2c,jp2_1=jp2,jpg_1=jpg,ktx_1=ktx,png_1=png,pnm_1=pnm,psd_1=psd,svg_1=svg,tiff_1=tiff,webp_1=webp;types.typeHandlers={bmp:bmp_1.BMP,cur:cur_1.CUR,dds:dds_1.DDS,gif:gif_1.GIF,icns:icns_1.ICNS,ico:ico_1.ICO,j2c:j2c_1.J2C,jp2:jp2_1.JP2,jpg:jpg_1.JPG,ktx:ktx_1.KTX,png:png_1.PNG,pnm:pnm_1.PNM,psd:psd_1.PSD,svg:svg_1.SVG,tiff:tiff_1.TIFF,webp:webp_1.WEBP};var detector$1={};Object.defineProperty(detector$1,"__esModule",{value:!0}),detector$1.detector=void 0;const types_1=types,keys=Object.keys(types_1.typeHandlers),firstBytes={56:"psd",66:"bmp",68:"dds",71:"gif",73:"tiff",77:"tiff",82:"webp",105:"icns",137:"png",255:"jpg"};detector$1.detector=function(buffer){const byte=buffer[0];if(byte in firstBytes){const type=firstBytes[byte];if(type&&types_1.typeHandlers[type].validate(buffer))return type}return keys.find((key=>types_1.typeHandlers[key].validate(buffer)))},function(module,exports){var __awaiter=commonjsGlobal&&commonjsGlobal.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P((function(resolve){resolve(value)}))).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.types=exports.setConcurrency=exports.disableTypes=exports.disableFS=exports.imageSize=void 0;const fs=require$$0,path=require$$1$1,queue_1=queue.exports,types_1=types,detector_1=detector$1,queue$1=new queue_1.default({concurrency:100,autostart:!0}),globalOptions={disabledFS:!1,disabledTypes:[]};function lookup(buffer,filepath){const type=(0,detector_1.detector)(buffer);if(void 0!==type){if(globalOptions.disabledTypes.indexOf(type)>-1)throw new TypeError("disabled file type: "+type);if(type in types_1.typeHandlers){const size=types_1.typeHandlers[type].calculate(buffer,filepath);if(void 0!==size)return size.type=type,size}}throw new TypeError("unsupported file type: "+type+" (file: "+filepath+")")}function imageSize(input,callback){if(Buffer.isBuffer(input))return lookup(input);if("string"!=