-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathhtml-canvas.js
19 lines (19 loc) · 54.9 KB
/
html-canvas.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.htmlcanvas=e():t.htmlcanvas=e()}(window,(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(r,o,function(e){return t[e]}.bind(null,o));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(t,e,i){"use strict";e.__esModule=!0,e.parseMarginValue=function(t){var e=(t=""+t).split(/\s+/);if(!e[0])return e;e[1]||(e[1]=e[0]);e[2]||(e[2]=e[0]);e[3]||(e[3]=e[1]);return e},e.parseBorderValue=function(t){var e=t.split(/\s+/),i=r.test(t),o=e.length,n=void 0,s=void 0,a=void 0;switch(o){case 1:s=e[0];break;case 2:i?(n=e[0],s=e[1]):(s=e[1],a=e[1]);break;case 3:n=e[0],s=e[1],a=e[2]}return{width:n,style:s,color:a}},e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.measureText=function(t,e,i){return t.font=i,t.measureText(e)},e.stringifyFont=function(t){return t["font-style"].value()+" "+t["font-variant"].value()+" "+t["font-weight"].value()+" "+t["font-stretch"].value()+" "+t["font-size"].value()+"px/"+t["line-height"].value()+" "+t["font-family"].value()},e.parseOverflowValue=function(t){var e=(t=""+t).split(/\s+/);if(!e[0])return e;e[1]||(e[1]=e[0]);return e},e.parseStyleStr=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e={},i=t.split(";");return i.forEach((function(t){var i=t.split(":"),r=(i[0]||"").replace(/^\s+|\s+$/g,""),o=(i[1]||"").replace(/^\s+|\s+$/g,"");r&&(e[r]=o)})),e},e.findIndex=function(t,e){for(var i=-1,r=0,o=t.length;r<o;r++)if(e(t[r])){i=r;break}return i},e.forIn=function(t,e){Object.keys(t).forEach((function(i){e(t[i],i)}))},e.downloadFile=function(t){return new Promise((function(e,i){wx.downloadFile({url:t,success:function(r){return 200===r.statusCode?e(r.tempFilePath):i(new Error("download "+t+" fail"))},fail:function(t){i(t)}})}))},e.parseClassName=function(t){return t.split(/\s+/g).filter((function(t){return!!t}))};var r=/\d+[a-z]+/i},function(t,e,i){"use strict";e.__esModule=!0,e.CssValue=e.AVALIABLE_PROP=e.FLEX_PROP=e.BOX_PROP=e.INHERITED_PROPERTIES=void 0,e.defaultCssValue=function t(e){if(!l[e])return new d("initial");var i=l[e].initial;if("string"==typeof i)return new d(i);if((0,s.isArray)(i))return i.reduce((function(e,i){return new d(e?e+" "+t(i)._v:t(i)._v)}),"");return new d("initial")};var r,o=i(7),n=(r=o)&&r.__esModule?r:{default:r},s=i(0);e.INHERITED_PROPERTIES=["--*","-ms-high-contrast-adjust","-ms-hyphenate-limit-chars","-ms-hyphenate-limit-lines","-ms-hyphenate-limit-zone","-ms-overflow-style","-ms-scrollbar-3dlight-color","-ms-scrollbar-arrow-color","-ms-scrollbar-base-color","-ms-scrollbar-darkshadow-color","-ms-scrollbar-face-color","-ms-scrollbar-highlight-color","-ms-scrollbar-shadow-color","-ms-scrollbar-track-color","-ms-scroll-translation","-ms-touch-select","-moz-context-properties","-moz-image-region","-moz-stack-sizing","-moz-user-input","-moz-user-modify","-webkit-border-before","-webkit-border-before-color","-webkit-border-before-style","-webkit-border-before-width","-webkit-overflow-scrolling","-webkit-text-fill-color","-webkit-text-stroke","-webkit-text-stroke-color","-webkit-text-stroke-width","-webkit-touch-callout","-webkit-user-modify","azimuth","block-overflow","border-collapse","border-spacing","caption-side","caret-color","color","color-adjust","cursor","direction","empty-cells","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-variation-settings","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","hanging-punctuation","hyphens","image-orientation","image-rendering","image-resolution","letter-spacing","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","object-position","orphans","overflow-wrap","paint-order","pointer-events","quotes","ruby-align","ruby-merge","ruby-position","scrollbar-color","tab-size","text-align","text-align-last","text-combine-upright","text-decoration-skip","text-decoration-skip-ink","text-indent","text-justify","text-orientation","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","visibility","white-space","widows","word-break","word-spacing","word-wrap","writing-mode"];var a=e.BOX_PROP={margin:{inherited:!1,initial:["margin-bottom","margin-left","margin-right","margin-top"],computed:["margin-bottom","margin-left","margin-right","margin-top"],parseParts:function(t){var e=(0,s.parseMarginValue)(t);return{"margin-top":e[0],"margin-right":e[1],"margin-bottom":e[2],"margin-left":e[3]}}},"margin-left":{inherited:!1,initial:"0px"},"margin-top":{inherited:!1,initial:"0px"},"margin-right":{inherited:!1,initial:"0px"},"margin-bottom":{inherited:!1,initial:"0px"},padding:{inherited:!1,initial:["padding-bottom","padding-left","padding-right","padding-top"],computed:["padding-bottom","padding-left","padding-right","padding-top"],parseParts:function(t){var e=(0,s.parseMarginValue)(t);return{"padding-top":e[0],"padding-right":e[1],"padding-bottom":e[2],"padding-left":e[3]}}},"padding-left":{inherited:!1,initial:"0px"},"padding-top":{inherited:!1,initial:"0px"},"padding-right":{inherited:!1,initial:"0px"},"padding-bottom":{inherited:!1,initial:"0px"},width:{inherited:!1,initial:"auto"},height:{inherited:!1,initial:"auto"},border:{inherited:!1,initial:["border-width","border-style","border-color"],computed:["border-width","border-style","border-color"],parseParts:function(t){return{"border-top":t,"border-right":t,"border-bottom":t,"border-left":t}}},"border-left":{inherited:!1,initial:["border-left-width","border-left-style","border-left-color"],computed:["border-left-width","border-left-style","border-left-color"],parseParts:function(t){var e=(0,s.parseBorderValue)(t);return{"border-left-width":e.width,"border-left-style":e.style,"border-left-color":e.color}}},"border-top":{inherited:!1,initial:["border-top-width","border-top-style","border-top-color"],computed:["border-top-width","border-top-style","border-top-color"],parseParts:function(t){var e=(0,s.parseBorderValue)(t);return{"border-top-width":e.width,"border-top-style":e.style,"border-top-color":e.color}}},"border-right":{inherited:!1,initial:["border-right-width","border-right-style","border-right-color"],computed:["border-right-width","border-right-style","border-right-color"],parseParts:function(t){var e=(0,s.parseBorderValue)(t);return{"border-right-width":e.width,"border-right-style":e.style,"border-right-color":e.color}}},"border-bottom":{inherited:!1,initial:["border-bottom-width","border-bottom-style","border-bottom-color"],computed:["border-bottom-width","border-bottom-style","border-bottom-color"],parseParts:function(t){var e=(0,s.parseBorderValue)(t);return{"border-bottom-width":e.width,"border-bottom-style":e.style,"border-bottom-color":e.color}}},"border-width":{inherited:!1,initial:["border-top-width","border-right-width","border-bottom-width","border-left-width"],computed:["border-top-width","border-right-width","border-bottom-width","border-left-width"],parseParts:function(t){var e=(0,s.parseMarginValue)(t);return{"border-top-width":e[0],"border-right-width":e[1],"border-bottom-width":e[2],"border-left-width":e[3]}}},"border-style":{inherited:!1,initial:["border-top-style","border-right-style","border-bottom-style","border-left-style"],computed:["border-top-style","border-right-style","border-bottom-style","border-left-style"],parseParts:function(t){var e=(0,s.parseMarginValue)(t);return{"border-top-style":e[0],"border-right-style":e[1],"border-bottom-style":e[2],"border-left-style":e[3]}}},"border-color":{inherited:!1,initial:["border-top-color","border-right-color","border-bottom-color","border-left-color"],computed:["border-top-color","border-right-color","border-bottom-color","border-left-color"],parseParts:function(t){var e=(0,s.parseMarginValue)(t);return{"border-top-color":e[0],"border-right-color":e[1],"border-bottom-color":e[2],"border-left-color":e[3]}}},"border-left-style":{inherited:!1,initial:"none"},"border-left-color":{inherited:!1,initial:"transparent"},"border-left-width":{inherited:!1,initial:"0px"},"border-top-style":{inherited:!1,initial:"none"},"border-top-color":{inherited:!1,initial:"transparent"},"border-top-width":{inherited:!1,initial:"0px"},"border-right-style":{inherited:!1,initial:"none"},"border-right-color":{inherited:!1,initial:"transparent"},"border-right-width":{inherited:!1,initial:"0px"},"border-bottom-style":{inherited:!1,initial:"none"},"border-bottom-color":{inherited:!1,initial:"transparent"},"border-bottom-width":{inherited:!1,initial:"0px"}},l=(e.FLEX_PROP={flex:{inherited:!1,initial:["flex-grow","flex-shrink","flex-basis"]},"flex-basis":{inherited:!1,initial:"auto"},"flex-direction":{inherited:!1,initial:"row"},"flex-flow":{inherited:!1,initial:["flex-direction","flex-wrap"]},"flex-grow":{inherited:!1,initial:"0"},"flex-shrink":{inherited:!1,initial:"1"},"flex-wrap":{inherited:!1,initial:"nowrap"}},e.AVALIABLE_PROP=Object.assign({},a,{color:{inherited:!0,initial:"#000000"},display:{inherited:!1,initial:"initial"},"background-color":{inherited:!1,initial:"transparent"},"border-radius":{inherited:!1,initial:["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"],computed:["border-bottom-left-radius","border-bottom-right-radius","border-top-left-radius","border-top-right-radius"],parseParts:function(t){var e=(0,s.parseMarginValue)(t);return{"border-top-left-radius":e[0],"border-top-right-radius":e[1],"border-bottom-right-radius":e[2],"border-bottom-left-radius":e[3]}}},"border-top-left-radius":{inherited:!1,initial:"0px"},"border-top-right-radius":{inherited:!1,initial:"0px"},"border-bottom-left-radius":{inherited:!1,initial:"0px"},"border-bottom-right-radius":{inherited:!1,initial:"0px"},"box-sizing":{inherited:!1,initial:"content-box"},font:{inherited:!0,initial:["font-style","font-variant","font-weight","font-stretch","font-size","line-height","font-family"],computed:["font-style","font-variant","font-weight","font-stretch","font-size","line-height","font-family"],parseParts:function(t){var e=(0,n.default)(t);return e["font-family"]&&(e["font-family"]=e["font-family"].join(",")),e}},"font-style":{media:"visual",inherited:!0,initial:"normal"},"font-variant":{inherited:!0,initial:"normal"},"font-weight":{inherited:!0,initial:"normal"},"font-stretch":{inherited:!0,initial:"normal"},"font-size":{inherited:!0,initial:"16px"},"line-height":{inherited:!0,initial:"1.2"},"font-family":{inherited:!0,initial:"PingFang SC"},"text-align":{inherited:!0,initial:"left"},position:{inherited:!1,initial:"static"},overflow:{inherited:!1,initial:["overflow-x","overflow-y"],computed:["overflow-x","overflow-y"],parseParts:function(t){var e=(0,s.parseOverflowValue)(t);return{"overflow-x":e[0],"overflow-y":e[1]}}},"overflow-x":{inherited:!1,initial:"visible"},"overflow-y":{inherited:!1,initial:"visible"},top:{inherited:!1,initial:"auto"},left:{inherited:!1,initial:"auto"},right:{inherited:!1,initial:"auto"},bottom:{inherited:!1,initial:"auto"},"z-index":{inherited:!1,initial:"0"}})),u=/^(-?[\d.]+)\s*([a-z%]*)$/i;function h(t){return t=parseFloat(t),isNaN(t)&&(t=0),t}var d=e.CssValue=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e._v&&(e=e._v),this._v=e.replace(/^\s+|\s+$/g,"");var i=u.exec(e);i?(this._value=parseFloat(i[1]),this.unit=i[2]):this._value=e.replace(/^\s+|\s+$/g,"")}return t.prototype.isAbsolute=function(){return"number"==typeof this._value&&"%"!==this.unit},t.prototype.isPercentage=function(){return"%"===this.unit&&"number"==typeof this._value},t.prototype.value=function(){return this._value},t.prototype.plus=function(){var e=h(this._value),i=[].slice.call(arguments);return i.forEach((function(i){i instanceof t&&(e+=h(i.value()))})),new t(""+e+this.unit)},t.prototype.minus=function(){var e=h(this._value),i=[].slice.call(arguments);return i.forEach((function(i){i instanceof t&&(e-=h(i.value()))})),new t(""+e+this.unit)},t.prototype.divide=function(e){return e instanceof t&&(e=e.value()),new t(""+this._value/e+this.unit)},t.prototype.clone=function(){return new t(this._v)},t}();d.min=function(){var t=[].slice.call(arguments),e=void 0;return t.forEach((function(t){(!e||t.minus(e).value()<0)&&(e=t)})),e},d.max=function(){var t=[].slice.call(arguments),e=void 0;return t.forEach((function(t){(!e||t.minus(e).value()>0)&&(e=t)})),e}},function(t,e,i){"use strict";e.__esModule=!0;var r=i(3);Object.defineProperty(e,"Node",{enumerable:!0,get:function(){return n(r).default}});var o=i(12);function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"Canvas",{enumerable:!0,get:function(){return n(o).default}})},function(t,e,i){"use strict";e.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=h(i(4)),n=i(1),s=i(8),a=h(i(9)),l=h(i(11)),u=i(0);function h(t){return t&&t.__esModule?t:{default:t}}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var p=function(){function t(e,i){var o=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];d(this,t),"object"===(void 0===e?"undefined":r(e))?(this.nodeName=e.nodeName,this.text=e.text,this.type=e.text?"text":e.type,this.props=e.props||{},s=e.childNodes||[]):"string"==typeof i?(this.nodeName=e,this.text=i,this.type="text",this.props=s||{},s=arguments[3]||[]):(this.nodeName=e,this.props=i||{}),this.parentNode=null,this.previousSibling=null,this.nextSibling=null,this.childNodes=[],this._posRelativeToParent={left:new n.CssValue("0px"),top:new n.CssValue("0px")},this._style={},this._box={border:{left:{width:(0,n.defaultCssValue)("border-left-width"),style:(0,n.defaultCssValue)("border-left-style"),color:(0,n.defaultCssValue)("border-left-color")},top:{width:(0,n.defaultCssValue)("border-top-width"),style:(0,n.defaultCssValue)("border-top-style"),color:(0,n.defaultCssValue)("border-top-color")},right:{width:(0,n.defaultCssValue)("border-right-width"),style:(0,n.defaultCssValue)("border-right-style"),color:(0,n.defaultCssValue)("border-right-color")},bottom:{width:(0,n.defaultCssValue)("border-bottom-width"),style:(0,n.defaultCssValue)("border-bottom-style"),color:(0,n.defaultCssValue)("border-bottom-color")}},padding:{left:(0,n.defaultCssValue)("padding-left"),top:(0,n.defaultCssValue)("padding-top"),right:(0,n.defaultCssValue)("padding-right"),bottom:(0,n.defaultCssValue)("padding-bottom")},margin:{left:(0,n.defaultCssValue)("margin-left"),top:(0,n.defaultCssValue)("margin-top"),right:(0,n.defaultCssValue)("margin-right"),bottom:(0,n.defaultCssValue)("margin-bottom")},width:(0,n.defaultCssValue)("width"),height:(0,n.defaultCssValue)("height")},s.forEach((function(e){e instanceof t?o.appendChild(e):o.appendChild(new t(e))})),"object"!==r(this.props.style)&&(this.props.style=(0,u.parseStyleStr)(this.props.style)),(0,u.forIn)(this.props.style,(function(t,e){o.style(e,t)}))}return t.prototype.insertBefore=function(t,e){if(this.isTextNode()||t._isEmptyText())return this;t._unMount();var i=this._childIndex(e);return this._insert(i-1,t),t},t.prototype.insertAfter=function(t,e){if(this.isTextNode()||t._isEmptyText())return this;t._unMount();var i=this._childIndex(e);return this._insert(i,t),t},t.prototype.appendChild=function(t){if(this.isTextNode()||t._isEmptyText())return this;t._unMount();var e=this.childNodes.length-1;return this._insert(e,t),t},t.prototype.cloneNode=function(e){return new t(this.nodeName,this.text||this.props,e?this.childNodes.map((function(t){return t.cloneNode(e)})):[])},t.prototype.removeChild=function(t){return this.isTextNode()||t._isEmptyText()?this:(this._childIndex(t)>-1&&t._unMount(),t)},t.prototype.getElementById=function(t){var e=void 0;return this.trevel((function(i){return i.props.id===t&&(e=i,!0)}),!0),e},t.prototype.getElementsByClassName=function(t){var e=[];return this.trevel((function(i){(0,u.parseClassName)(i.props.class).indexOf(t)>-1&&e.push(i)}),!0),e},t.prototype.getElementsByTagName=function(t){var e=[];return this.trevel((function(i){i.nodeName===t&&e.push(i)}),!0),e},t.prototype.relativePostion=function(){var t=this.style("position").value(),e=this._relativeNode();if("static"===t)return this._posRelativeToParent;var i=this.style("top"),r=this.style("right"),o=this.style("bottom"),s=this.style("left"),a=this.style("font-size").value();return"%"===i.unit&&e&&(i=new n.CssValue(i.value()*e.style("height").value()/100+"px")),"em"===i.unit&&e&&(i=new n.CssValue(i.value()*a+"px")),"%"===o.unit&&e&&(o=new n.CssValue(o.value()*e.style("height").value()/100+"px")),"em"===o.unit&&e&&(o=new n.CssValue(o.value()*a+"px")),"%"===s.unit&&e&&(s=new n.CssValue(s.value()*e.style("width").value()/100+"px")),"em"===s.unit&&e&&(s=new n.CssValue(s.value()*a+"px")),"%"===r.unit&&e&&(r=new n.CssValue(r.value()*e.style("width").value()/100+"px")),"em"===r.unit&&e&&(r=new n.CssValue(r.value()*a+"px")),"relative"===t?(i.isAbsolute()||(i=o.isAbsolute()&&e?new n.CssValue("-"+o.value()+"px"):new n.CssValue("0px")),s.isAbsolute()||(s=r.isAbsolute()?new n.CssValue("-"+r.value()+"px"):new n.CssValue("0px")),{top:this._posRelativeToParent.top.minus(i),left:this._posRelativeToParent.left.minus(s)}):(i.isAbsolute()||(i=o.isAbsolute()&&e?e.boxHeight().minus(o.plus(this._boxHeight())):new n.CssValue("0px")),s.isAbsolute()||(s=r.isAbsolute()?e.boxWidth().minus(r.plus(this._boxWidth())):new n.CssValue("0px")),{top:i,left:s})},t.prototype.rootPosition=function(){var t=new n.CssValue("0px"),e=new n.CssValue("0px"),i=this.style("position").value(),r=this._relativeNode(),o=this.relativePostion();for(t=t.plus(o.top),e=e.plus(o.left);r;){var s=r._box;"absolute"!==i&&"fixed"!==i&&(t=s.border.top.width.plus(s.margin.top).plus(s.padding.top).plus(t),e=s.border.left.width.plus(s.margin.left).plus(s.padding.left).plus(e));var a=r.relativePostion();t=t.plus(a.top),e=e.plus(a.left),i=r.style("position").value(),r=r._relativeNode()}return{top:t,left:e}},t.prototype.setStyle=function(t,e){this.props.style[t]=e,this.style(t,e)},t.prototype.style=function(t,e){var i=this;if("object"===(void 0===t?"undefined":r(t)))return(0,u.forIn)(t,(function(t,e){i.style(e,t)})),this;if(void 0!==e){t=t.toLowerCase().replace(/^\s+|\s+$/g,""),e=new n.CssValue(e);var o=n.AVALIABLE_PROP[t];if(o||this._logUnsupportCssProp(t),o&&o.parseParts){var s=o.parseParts(e._v);(0,u.forIn)(s,(function(t,e){i.style(e,t)}))}else n.BOX_PROP[t]&&this._changeBox(t,e);return this._setStyle(t,e),this}var a=this._getStyle(t);return void 0===a&&n.INHERITED_PROPERTIES.indexOf(t)>-1&&this.parentNode?(t=t.toLowerCase().replace(/^\s+|\s+$/g,""),n.AVALIABLE_PROP[t]||this._logUnsupportCssProp(t),this.parentNode.style(t)):(a=a||(0,n.defaultCssValue)(t))instanceof n.CssValue&&"inherit"===a.value()&&this.parentNode?this.parentNode.style(t):a},t.prototype.isTextNode=function(){return"text"===this.type},t.prototype.isStaticNode=function(){return["static"].indexOf(this.style("position").value())>-1},t.prototype.textContent=function(){return this.isTextNode()?this.text:this.childNodes.map((function(t){return t.textContent()})).join("")},t.prototype.lookUp=function(t,e){var i=!1;e&&(i=t(this)),!i&&this.parentNode&&this.parentNode.lookUp(t,!0)},t.prototype.trevel=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=!1;e&&(r=t(this)),r||(this.childNodes.forEach((function(r){r.trevel(t,e,i)})),i.afterTrevelChildren&&i.afterTrevelChildren(this))},t.prototype.layout=function(t){var e=this,i=void 0;return this.loadResource().then((function(){e.lookUp((function(t){return!t.parentNode&&(i=t,!0)}),!0),i&&i._layout(t)}))},t.prototype.wxLoadImage=function(t){return new Promise((function(e,i){wx.getImageInfo({src:t,success:function(t){t.src=t.path,e(t)},fail:function(t){i(t)}})}))},t.prototype.loadImage=function(t){if("undefined"!=typeof wx)return this.wxLoadImage(t);throw new Error("node.loadImage() not implement")},t.prototype.loadResource=function(){var t=this,e=[];return this.trevel((function(t){"img"===t.nodeName&&t.props.src&&!t._resource&&e.push({type:"img",src:t.props.src,node:t})}),!0),Promise.all(e.map((function(e){return t.loadImage(e.src)}))).then((function(t){return t.forEach((function(t,i){e[i].node._resource=t})),t}))},t.prototype._layout=function(t){var e=this;if(!this.isTextNode()){this._absolutes=[];var i=this._isBlockNode(),r=this.style("box-sizing").value(),o=this.props.style.width||"",s=this.props.style.height||"",a=o?new n.CssValue(o):(0,n.defaultCssValue)("width"),u=s?new n.CssValue(s):(0,n.defaultCssValue)("height"),h=!1,d=!1;if(a.isAbsolute())"border-box"===r&&(a=a.minus(this._box.padding.left).minus(this._box.padding.right)),h=!0;else if(i&&this.parentNode){var p=this.parentNode.style("width");p.isAbsolute()&&(a=a.isPercentage()?new n.CssValue(""+p.value()*a.value()/100+p.unit):new n.CssValue(""+p.value()+p.unit).minus(this._boxWidth(!0)),"border-box"===r&&(a=a.minus(this._box.padding.left).minus(this._box.padding.right)),h=!0)}else if(this.parentNode&&a.isPercentage()){var c=this.parentNode.style("width");c.isAbsolute()&&(a=new n.CssValue(""+c.value()*a.value()/100+c.unit),"border-box"===r&&(a=a.minus(this._box.padding.left).minus(this._box.padding.right)),h=!0)}if(u.isAbsolute())"border-box"===r&&(u=u.minus(this._box.padding.top).minus(this._box.padding.bottom)),d=!0;else if(u.isPercentage()&&this.parentNode){var f=u.value(),g=this.parentNode.style("height");g.isAbsolute()&&(u=new n.CssValue(""+g.value()*f/100+g.unit),"border-box"===r&&(u=u.minus(this._box.padding.top).minus(this._box.padding.bottom)),d=!0)}if(this.isImageNode()&&(h||(a=this.parentNode&&this.parentNode.style("width").isAbsolute()?new n.CssValue(Math.min(this._resource.width,this.parentNode.style("width"))+"px"):new n.CssValue(this._resource.width+"px"),h=!0),d||(u=new n.CssValue(a.value()*this._resource.height/this._resource.width+"px"),d=!0)),h&&(this.style("width",a),this._box.width=a,this.parentNode&&i)){var m=this.parentNode._box.width.minus(this._boxWidth()),b=new n.CssValue("0px"),y=0,v=!1,_=!1;"auto"===this._box.margin.left.value()&&(v=!0,y++),"auto"===this._box.margin.right.value()&&(_=!0,y++),y>0&&(b=m.divide(y)),v&&this._changeBox("margin-left",b.clone()),_&&this._changeBox("margin-right",b.clone())}d&&this.style("height",u),this.childNodes.forEach((function(e){e._layout(t)})),this._flows=new l.default(this),this.childNodes.forEach((function(i){var r=i.style("position").value();if("static"!==r&&"relative"!==r&&i.parentNode){var o=void 0;i.lookUp((function(t){return o=t,"absolute"===r&&["relative","absolute","fixed"].indexOf(t.style("position").value())>-1}),!1),o._absolutes.push(i)}else e._flows.addNode(i,t)})),h||(a=this._flows.getWidth(),this.style("width",a),h=!0),d||(u=this._flows.getHeight(),this.style("height",u),d=!0)}},t.prototype._initflowInfo=function(){return{direction:"row",justifyContent:"start",alignItems:"start",nodes:[]}},t.prototype._relativeNode=function(){var t=this.style("position").value();if("static"===t||"relative"===t)return this.parentNode;var e=void 0;return this.lookUp((function(t){return e=t,!t.isStaticNode()}),!1),e},t.prototype.boxWidth=function(){return this._boxWidth()},t.prototype._boxWidth=function(t){var e=this._box,i=e.border.left.width.plus(e.margin.left).plus(e.padding.left).plus(e.padding.right).plus(e.margin.right).plus(e.border.right.width);return t?i:i.plus(e.width)},t.prototype.boxHeight=function(){return this._boxHeight()},t.prototype._boxHeight=function(t){var e=this._box,i=e.border.top.width.plus(e.margin.top).plus(e.padding.top).plus(e.padding.bottom).plus(e.margin.bottom).plus(e.border.bottom.width);return t?i:i.plus(e.height)},t.prototype._getStyle=function(t){var e=this,i=n.AVALIABLE_PROP[t];if(i&&i.computed)return i.computed.reduce((function(t,i){return t[i]=e.style(i),t}),{});var r=this._style[t];return r&&(r=r.clone()),r},t.prototype._setStyle=function(t,e){this._style[t]=e},t.prototype._changeBox=function(t,e){this._setStyle(t,e),(0,o.default)(this._box,t.replace(/-/g,"."),e)},t.prototype.isImageNode=function(){return"img"===this.nodeName},t.prototype._isEmptyText=function(){return!("text"!==this.type||!/^[\s↵ ]+$/.test(this.text))},t.prototype._isBlockNode=function(){var t=this.style("display").value();return"inline-block"!==t&&"inline-flex"!==t&&"inline"!==t&&("block"===t||s.BLOCK_TAGS.indexOf(this.nodeName)>-1)},t.prototype._isFlexChild=function(){return!!this.parentNode&&this.parentNode._isFlexContainer()},t.prototype._isFlexContainer=function(){return"flex"===this.style("display").value()},t.prototype._isFlex=function(){return!(!this._isFlexContainer()&&!this.parentNode)&&this.parentNode._isFlexContainer()},t.prototype._insert=function(t,e){e.parentNode=this;var i=this.childNodes[t]||null,r=this.childNodes[t+1]||null;i&&(i.nextSibling=e),r&&(r.previousSibling=e),e.previousSibling=this.childNodes[t]||null,e.nextSibling=r,this.childNodes.splice(t+1,0,e)},t.prototype._childIndex=function(t){return(0,u.findIndex)(this.childNodes,(function(e){return e===t}))},t.prototype._unMount=function(){if(this.parentNode){var t=this.parentNode._childIndex(this);t>-1&&this.parentNode.children.splice(t,1)}var e=this.previousSibling,i=this.nextSibling;e&&(e.nextSibling=i),i&&(i.previousSibling=e)},t.prototype._nodeId=function(){var t=this.nodeName;return this.props.id&&(t+="#"+this.props.id),this.props.class&&(t+=this.props.class.split(/\s+/g).join(".")),t},t.prototype._nodePath=function(){var t="";return this.lookUp((function(e){t=e.parentNode?"["+e.parentNode._childIndex(e)+"] > "+e._nodeId()+t:e._nodeId()+t}),!0),t},t.prototype._logUnsupportCssProp=function(t){console.warn(this._nodePath()+": unsupport css property: "+t),console.warn("css property support list: ",Object.keys(n.AVALIABLE_PROP))},t.prototype._logDisplaySupportList=function(){console.warn(this._nodePath()+": display support list: block, inline-block, flex")},t}();e.default=p,p.fromHtml=function(t){t=t.replace(/^\s+|\s+$/g,"");var e=new a.default.DefaultHandler((function(t,e){t?console.error(t):e.forEach((function(t){!function t(e){e.nodeName=e.name,e.props=e.attribs,e.text="text"===e.type?e.data:"",e.childNodes=e.children,(e.children||[]).forEach((function(e){t(e)}))}(t)}))}));return new a.default.Parser(e).parseComplete(t),new p(e.dom[0])}},function(t,e,i){"use strict";
/*!
* set-value <https://github.com/jonschlinkert/set-value>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/const r=i(5);function o(t,e,i,r){if(!a(t))return t;let l=r||{};const u=Array.isArray(e);if(!u&&"string"!=typeof e)return t;let h=l.merge;h&&"function"!=typeof h&&(h=Object.assign);const d=(u?e:function(t,e){const i=function(t,e){let i=t;if(void 0===e)return i+"";const r=Object.keys(e);for(let t=0;t<r.length;t++){const o=r[t];i+=";"+o+"="+String(e[o])}return i}(t,e);if(o.memo[i])return o.memo[i];const r=e&&e.separator?e.separator:".";let n=[],s=[];n=e&&"function"==typeof e.split?e.split(t):t.split(r);for(let t=0;t<n.length;t++){let e=n[t];for(;e&&"\\"===e.slice(-1)&&n[t+1];)e=e.slice(0,-1)+r+n[++t];s.push(e)}return o.memo[i]=s,s}(e,l)).filter(s),p=d.length,c=t;if(!r&&1===d.length)return n(t,d[0],i,h),t;for(let e=0;e<p;e++){let r=d[e];if(a(t[r])||(t[r]={}),e===p-1){n(t,r,i,h);break}t=t[r]}return c}function n(t,e,i,o){o&&r(t[e])&&r(i)?t[e]=o({},t[e],i):t[e]=i}function s(t){return"__proto__"!==t&&"constructor"!==t&&"prototype"!==t}function a(t){return null!==t&&("object"==typeof t||"function"==typeof t)}o.memo={},t.exports=o},function(t,e,i){"use strict";
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/var r=i(6);function o(t){return!0===r(t)&&"[object Object]"===Object.prototype.toString.call(t)}t.exports=function(t){var e,i;return!1!==o(t)&&("function"==typeof(e=t.constructor)&&(!1!==o(i=e.prototype)&&!1!==i.hasOwnProperty("isPrototypeOf")))}},function(t,e,i){"use strict";
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/t.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}},function(t,e,i){var r,o;o=this,void 0===(r=function(){return o.returnExportsGlobal=function(t){var e=1,i=2,r=3,o=4;function n(t){for(var e=t.replace(/^\s+|\s+$/,"").replace(/\s+/g," ").split(" "),i=0;i<e.length;i+=1)if(/^(-?\d|--)/.test(e[i])||!/^([_a-zA-Z0-9-]|[^\0-\237]|(\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?|\\[^\n\r\f0-9a-f]))+$/.test(e[i]))return null;return e.join(" ")}return function(t){for(var s,a=e,l="",u={"font-family":[]},h=0;s=t.charAt(h);h+=1)if(a!==o||'"'!==s&&"'"!==s)if(a===r&&","===s)a=o,l="";else if(a===o&&","===s){var d;(d=n(l))&&u["font-family"].push(d),l=""}else a!==e||" "!==s&&"/"!==s?a===i&&" "===s?(/^(\+|-)?([0-9]*\.)?[0-9]+(em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)?$/.test(l)&&(u["line-height"]=l),a=o,l=""):l+=s:(/^((xx|x)-large|(xx|s)-small|small|large|medium)$/.test(l)||/^(larg|small)er$/.test(l)||/^(\+|-)?([0-9]*\.)?[0-9]+(em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)$/.test(l)?(a="/"===s?i:o,u["font-size"]=l):/^(italic|oblique)$/.test(l)?u["font-style"]=l:/^small-caps$/.test(l)?u["font-variant"]=l:/^(bold(er)?|lighter|[1-9]00)$/.test(l)?u["font-weight"]=l:/^((ultra|extra|semi)-)?(condensed|expanded)$/.test(l)&&(u["font-stretch"]=l),l="");else{var p=h+1;do{if(!(p=t.indexOf(s,p)+1))return null}while("\\"===t.charAt(p-2));u["font-family"].push(t.slice(h,p)),h=p-1,a=r,l=""}return a!==r||/^\s*$/.test(l)?(a===o&&(d=n(l))&&u["font-family"].push(d),u["font-size"]&&u["font-family"].length?u:null):null}}()}.apply(e,[]))||(t.exports=r)},function(t,e,i){"use strict";e.__esModule=!0;e.BLOCK_TAGS=["address","fieldset","li","article","figcaption","main","aside","blockquote","details","dialog","dd","div","dl","dt","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","nav","ol","p","pre","section","table","ul"]},function(t,e,i){"use strict";(function(t,i,r){var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(){if("object"!=o(e)||"object"!=o(t)||"string"!=typeof i||"string"!=typeof r){if(this.Tautologistics){if(this.Tautologistics.NodeHtmlParser)return}else this.Tautologistics={};this.Tautologistics.NodeHtmlParser={},e=this.Tautologistics.NodeHtmlParser}var n,s,a,l={Text:"text",Directive:"directive",Comment:"comment",Script:"script",Style:"style",Tag:"tag"};function u(t,e){this._options=e||{},null==this._options.includeLocation&&(this._options.includeLocation=!1),this.validateHandler(t),this._handler=t,this.reset()}function h(t){h.super_.call(this,t,{ignoreWhitespace:!0,verbose:!1,enforceEmptyTags:!1})}function d(t,e){this.reset(),this._options=e||{},null==this._options.ignoreWhitespace&&(this._options.ignoreWhitespace=!1),null==this._options.verbose&&(this._options.verbose=!0),null==this._options.enforceEmptyTags&&(this._options.enforceEmptyTags=!0),"function"==typeof t&&(this._callback=t)}u._reTrim=/(^\s+|\s+$)/g,u._reTrimComment=/(^\!--|--$)/g,u._reWhitespace=/\s/g,u._reTagName=/^\s*(\/?)\s*([^\s\/]+)/,u._reAttrib=/([^=<>\"\'\s]+)\s*=\s*"([^"]*)"|([^=<>\"\'\s]+)\s*=\s*'([^']*)'|([^=<>\"\'\s]+)\s*=\s*([^'"\s]+)|([^=<>\"\'\s\/]+)/g,u._reTags=/[\<\>]/g,u.prototype.parseComplete=function(t){this.reset(),this.parseChunk(t),this.done()},u.prototype.parseChunk=function(t){this._done&&this.handleError(new Error("Attempted to parse chunk after parsing already done")),this._buffer+=t,this.parseTags()},u.prototype.done=function(){if(!this._done){if(this._done=!0,this._buffer.length){var t=this._buffer;this._buffer="";var e={raw:t,data:this._parseState==l.Text?t:t.replace(u._reTrim,""),type:this._parseState};this._parseState!=l.Tag&&this._parseState!=l.Script&&this._parseState!=l.Style||(e.name=this.parseTagName(e.data)),this.parseAttribs(e),this._elements.push(e)}this.writeHandler(),this._handler.done()}},u.prototype.reset=function(){this._buffer="",this._done=!1,this._elements=[],this._elementsCurrent=0,this._current=0,this._next=0,this._location={row:0,col:0,charOffset:0,inBuffer:0},this._parseState=l.Text,this._prevTagSep="",this._tagStack=[],this._handler.reset()},u.prototype._options=null,u.prototype._handler=null,u.prototype._buffer=null,u.prototype._done=!1,u.prototype._elements=null,u.prototype._elementsCurrent=0,u.prototype._current=0,u.prototype._next=0,u.prototype._location=null,u.prototype._parseState=l.Text,u.prototype._prevTagSep="",u.prototype._tagStack=null,u.prototype.parseTagAttribs=function(t){for(var e=t.length,i=0;i<e;){var r=t[i++];r.type!=l.Tag&&r.type!=l.Script&&r.type!=l.style||this.parseAttribs(r)}return t},u.prototype.parseAttribs=function(t){if(t.type==l.Script||t.type==l.Style||t.type==l.Tag){var e,i=t.data.split(u._reWhitespace,1)[0],r=t.data.substring(i.length);if(!(r.length<1))for(u._reAttrib.lastIndex=0;e=u._reAttrib.exec(r);)null==t.attribs&&(t.attribs={}),"string"==typeof e[1]&&e[1].length?t.attribs[e[1]]=e[2]:"string"==typeof e[3]&&e[3].length?t.attribs[e[3].toString()]=e[4].toString():"string"==typeof e[5]&&e[5].length?t.attribs[e[5]]=e[6]:"string"==typeof e[7]&&e[7].length&&(t.attribs[e[7]]=e[7])}},u.prototype.parseTagName=function(t){if(null==t||""==t)return"";var e=u._reTagName.exec(t);return e?(e[1]?"/":"")+e[2]:""},u.prototype.parseTags=function(){for(var t=this._buffer.length-1;u._reTags.test(this._buffer);){this._next=u._reTags.lastIndex-1;var e=this._buffer.charAt(this._next),i=this._buffer.substring(this._current,this._next),r={raw:i,data:this._parseState==l.Text?i:i.replace(u._reTrim,""),type:this._parseState},o=this.parseTagName(r.data);if(this._tagStack.length)if(this._tagStack[this._tagStack.length-1]==l.Script){if("/script"==o.toLowerCase())this._tagStack.pop();else if(0!=r.raw.indexOf("!--"))if(r.type=l.Text,this._elements.length&&this._elements[this._elements.length-1].type==l.Text)(n=this._elements[this._elements.length-1]).raw=n.data=n.raw+this._prevTagSep+r.raw,r.raw=r.data=""}else if(this._tagStack[this._tagStack.length-1]==l.Style){if("/style"==o.toLowerCase())this._tagStack.pop();else if(0!=r.raw.indexOf("!--"))if(r.type=l.Text,this._elements.length&&this._elements[this._elements.length-1].type==l.Text){var n=this._elements[this._elements.length-1];""!=r.raw?(n.raw=n.data=n.raw+this._prevTagSep+r.raw,r.raw=r.data=""):n.raw=n.data=n.raw+this._prevTagSep}else""!=r.raw&&(r.raw=r.data=r.raw)}else if(this._tagStack[this._tagStack.length-1]==l.Comment){var s=r.raw.length;if("-"==r.raw.charAt(s-2)&&"-"==r.raw.charAt(s-1)&&">"==e)if(this._tagStack.pop(),this._elements.length&&this._elements[this._elements.length-1].type==l.Comment)(n=this._elements[this._elements.length-1]).raw=n.data=(n.raw+r.raw).replace(u._reTrimComment,""),r.raw=r.data="",r.type=l.Text;else r.type=l.Comment;else if(r.type=l.Comment,this._elements.length&&this._elements[this._elements.length-1].type==l.Comment)(n=this._elements[this._elements.length-1]).raw=n.data=n.raw+r.raw+e,r.raw=r.data="",r.type=l.Text;else r.raw=r.data=r.raw+e}if(r.type==l.Tag){r.name=o;var a=o.toLowerCase();if(0==r.raw.indexOf("!--")){r.type=l.Comment,delete r.name;s=r.raw.length;"-"==r.raw.charAt(s-1)&&"-"==r.raw.charAt(s-2)&&">"==e?r.raw=r.data=r.raw.replace(u._reTrimComment,""):(r.raw+=e,this._tagStack.push(l.Comment))}else 0==r.raw.indexOf("!")||0==r.raw.indexOf("?")?r.type=l.Directive:"script"==a?(r.type=l.Script,"/"!=r.data.charAt(r.data.length-1)&&this._tagStack.push(l.Script)):"/script"==a?r.type=l.Script:"style"==a?(r.type=l.Style,"/"!=r.data.charAt(r.data.length-1)&&this._tagStack.push(l.Style)):"/style"==a&&(r.type=l.Style);r.name&&"/"==r.name.charAt(0)&&(r.data=r.name)}""==r.raw&&r.type==l.Text||(this._options.includeLocation&&!r.location&&(r.location=this.getLocation(r.type==l.Tag)),this.parseAttribs(r),this._elements.push(r),r.type!=l.Text&&r.type!=l.Comment&&r.type!=l.Directive&&"/"==r.data.charAt(r.data.length-1)&&this._elements.push({raw:"/"+r.name,data:"/"+r.name,name:"/"+r.name,type:r.type})),this._parseState="<"==e?l.Tag:l.Text,this._current=this._next+1,this._prevTagSep=e}this._options.includeLocation&&(this.getLocation(),this._location.row+=this._location.inBuffer,this._location.inBuffer=0,this._location.charOffset=0),this._buffer=this._current<=t?this._buffer.substring(this._current):"",this._current=0,this.writeHandler()},u.prototype.getLocation=function(t){for(var e,i=this._location,r=this._current-(t?1:0),o=t&&0==i.charOffset&&0==this._current;i.charOffset<r;i.charOffset++)"\n"==(e=this._buffer.charAt(i.charOffset))?(i.inBuffer++,i.col=0):"\r"!=e&&i.col++;return{line:i.row+i.inBuffer+1,col:i.col+(o?0:1)}},u.prototype.validateHandler=function(t){if("object"!=(void 0===t?"undefined":o(t)))throw new Error("Handler is not an object");if("function"!=typeof t.reset)throw new Error("Handler method 'reset' is invalid");if("function"!=typeof t.done)throw new Error("Handler method 'done' is invalid");if("function"!=typeof t.writeTag)throw new Error("Handler method 'writeTag' is invalid");if("function"!=typeof t.writeText)throw new Error("Handler method 'writeText' is invalid");if("function"!=typeof t.writeComment)throw new Error("Handler method 'writeComment' is invalid");if("function"!=typeof t.writeDirective)throw new Error("Handler method 'writeDirective' is invalid")},u.prototype.writeHandler=function(t){if(t=!!t,!this._tagStack.length||t)for(;this._elements.length;){var e=this._elements.shift();switch(e.type){case l.Comment:this._handler.writeComment(e);break;case l.Directive:this._handler.writeDirective(e);break;case l.Text:this._handler.writeText(e);break;default:this._handler.writeTag(e)}}},u.prototype.handleError=function(t){if("function"!=typeof this._handler.error)throw t;this._handler.error(t)},n=h,(a=function(){}).prototype=(s=d).prototype,n.super_=s,n.prototype=new a,n.prototype.constructor=n,h.prototype.done=function(){var t,e={},i=p.getElementsByTagName((function(t){return"rss"==t||"feed"==t}),this.dom,!1);if(i.length&&(t=i[0]),t){if("rss"==t.name){e.type="rss",t=t.children[0],e.id="";try{e.title=p.getElementsByTagName("title",t.children,!1)[0].children[0].data}catch(t){}try{e.link=p.getElementsByTagName("link",t.children,!1)[0].children[0].data}catch(t){}try{e.description=p.getElementsByTagName("description",t.children,!1)[0].children[0].data}catch(t){}try{e.updated=new Date(p.getElementsByTagName("lastBuildDate",t.children,!1)[0].children[0].data)}catch(t){}try{e.author=p.getElementsByTagName("managingEditor",t.children,!1)[0].children[0].data}catch(t){}e.items=[],p.getElementsByTagName("item",t.children).forEach((function(t,i,r){var o={};try{o.id=p.getElementsByTagName("guid",t.children,!1)[0].children[0].data}catch(t){}try{o.title=p.getElementsByTagName("title",t.children,!1)[0].children[0].data}catch(t){}try{o.link=p.getElementsByTagName("link",t.children,!1)[0].children[0].data}catch(t){}try{o.description=p.getElementsByTagName("description",t.children,!1)[0].children[0].data}catch(t){}try{o.pubDate=new Date(p.getElementsByTagName("pubDate",t.children,!1)[0].children[0].data)}catch(t){}e.items.push(o)}))}else{e.type="atom";try{e.id=p.getElementsByTagName("id",t.children,!1)[0].children[0].data}catch(t){}try{e.title=p.getElementsByTagName("title",t.children,!1)[0].children[0].data}catch(t){}try{e.link=p.getElementsByTagName("link",t.children,!1)[0].attribs.href}catch(t){}try{e.description=p.getElementsByTagName("subtitle",t.children,!1)[0].children[0].data}catch(t){}try{e.updated=new Date(p.getElementsByTagName("updated",t.children,!1)[0].children[0].data)}catch(t){}try{e.author=p.getElementsByTagName("email",t.children,!0)[0].children[0].data}catch(t){}e.items=[],p.getElementsByTagName("entry",t.children).forEach((function(t,i,r){var o={};try{o.id=p.getElementsByTagName("id",t.children,!1)[0].children[0].data}catch(t){}try{o.title=p.getElementsByTagName("title",t.children,!1)[0].children[0].data}catch(t){}try{o.link=p.getElementsByTagName("link",t.children,!1)[0].attribs.href}catch(t){}try{o.description=p.getElementsByTagName("summary",t.children,!1)[0].children[0].data}catch(t){}try{o.pubDate=new Date(p.getElementsByTagName("updated",t.children,!1)[0].children[0].data)}catch(t){}e.items.push(o)}))}this.dom=e}h.super_.prototype.done.call(this)},d._emptyTags={area:1,base:1,basefont:1,br:1,col:1,frame:1,hr:1,img:1,input:1,isindex:1,link:1,meta:1,param:1,embed:1},d.reWhitespace=/^\s*$/,d.prototype.dom=null,d.prototype.reset=function(){this.dom=[],this._done=!1,this._tagStack=[],this._tagStack.last=function(){return this.length?this[this.length-1]:null}},d.prototype.done=function(){this._done=!0,this.handleCallback(null)},d.prototype.writeTag=function(t){this.handleElement(t)},d.prototype.writeText=function(t){this._options.ignoreWhitespace&&d.reWhitespace.test(t.data)||this.handleElement(t)},d.prototype.writeComment=function(t){this.handleElement(t)},d.prototype.writeDirective=function(t){this.handleElement(t)},d.prototype.error=function(t){this.handleCallback(t)},d.prototype._options=null,d.prototype._callback=null,d.prototype._done=!1,d.prototype._tagStack=null,d.prototype.handleCallback=function(t){if("function"==typeof this._callback)this._callback(t,this.dom);else if(t)throw t},d.prototype.isEmptyTag=function(t){var e=t.name.toLowerCase();return"/"==e.charAt(0)&&(e=e.substring(1)),this._options.enforceEmptyTags&&!!d._emptyTags[e]},d.prototype.handleElement=function(t){if(this._done&&this.handleCallback(new Error("Writing to the handler after done() called is not allowed without a reset()")),this._options.verbose||(delete t.raw,"tag"!=t.type&&"script"!=t.type&&"style"!=t.type||delete t.data),this._tagStack.last())if(t.type!=l.Text&&t.type!=l.Comment&&t.type!=l.Directive)if("/"==t.name.charAt(0)){var e=t.name.substring(1);if(!this.isEmptyTag(t)){for(var i=this._tagStack.length-1;i>-1&&this._tagStack[i--].name!=e;);if(i>-1||this._tagStack[0].name==e)for(;i<this._tagStack.length-1;)this._tagStack.pop()}}else this._tagStack.last().children||(this._tagStack.last().children=[]),this._tagStack.last().children.push(t),this.isEmptyTag(t)||this._tagStack.push(t);else this._tagStack.last().children||(this._tagStack.last().children=[]),this._tagStack.last().children.push(t);else t.type!=l.Text&&t.type!=l.Comment&&t.type!=l.Directive?"/"!=t.name.charAt(0)&&(this.dom.push(t),this.isEmptyTag(t)||this._tagStack.push(t)):this.dom.push(t)};var p={testElement:function(t,e){if(!e)return!1;for(var i in t)if("tag_name"==i){if("tag"!=e.type&&"script"!=e.type&&"style"!=e.type)return!1;if(!t.tag_name(e.name))return!1}else if("tag_type"==i){if(!t.tag_type(e.type))return!1}else if("tag_contains"==i){if("text"!=e.type&&"comment"!=e.type&&"directive"!=e.type)return!1;if(!t.tag_contains(e.data))return!1}else if(!e.attribs||!t[i](e.attribs[i]))return!1;return!0},getElements:function(t,e,i,r){if(i=null==i||!!i,r=isNaN(parseInt(r))?-1:parseInt(r),!e)return[];var o,n=[];function s(t){return function(e){return e==t}}for(var a in t)"function"!=typeof t[a]&&(t[a]=s(t[a]));if(p.testElement(t,e)&&n.push(e),r>=0&&n.length>=r)return n;if(i&&e.children)o=e.children;else{if(!(e instanceof Array))return n;o=e}for(var l=0;l<o.length&&(n=n.concat(p.getElements(t,o[l],i,r)),!(r>=0&&n.length>=r));l++);return n},getElementById:function(t,e,i){var r=p.getElements({id:t},e,i,1);return r.length?r[0]:null},getElementsByTagName:function(t,e,i,r){return p.getElements({tag_name:t},e,i,r)},getElementsByTagType:function(t,e,i,r){return p.getElements({tag_type:t},e,i,r)}};e.Parser=u,e.DefaultHandler=d,e.RssHandler=h,e.ElementType=l,e.DomUtils=p}()}).call(this,i(10)(t),"/index.js","/")},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,i){"use strict";e.__esModule=!0;var r=i(1),o=i(0);function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=/[({[<(【《「]/,a=/[^\w]*(\w+)$/,l=/[,,、.。??!!;;::>》」)】@#$%~^&*/]/,u=/([^,,、.。??!!;;::>》」)】@#$%~^&*/][,,、.。??!!;;::>》」)】@#$%~^&*/]*)$/;function h(t){if(0===t.length)return t;var e=t[t.length-1];if(e){var i=a.exec(e);i&&i[1].length<20&&((t=t.slice(0,t.length-1)).push(e.slice(0,e.length-i[1].length)),t.push(i[1]))}return t}function d(t){if(0===t.length)return t;var e=t[t.length-1];if(e){var i=u.exec(e);i&&i[1].length<20&&(t=t.slice(0,t.length-1)).push(e.slice(0,e.length-i[1].length));var r=t.length;if(/\w/.test(i[1][0]))r!==(t=h(t)).length?t[t.length-1]=t[t.length-1]+i[1]:t.push(i[1]);else t.push(i[1])}return t}function p(t,e){if(0===t.length)return t;var i=t[e],r=i[i.length-1];return i&&s.test(r)&&(t[e]=i.slice(0,-1),t[e+1]=r+(t[e+1]||"")),t}var c=function(){function t(e,i,o,s,a,l){n(this,t),this.flowContainer=e,this.direction=i,this.justifyContent=o||"flex-start",this.alignItems=s||"flex-start",this.top=a||new r.CssValue("0px"),this.left=l||new r.CssValue("0px"),this.width=new r.CssValue("0px"),this.height=new r.CssValue("0px"),this.items=[]}return t.prototype.canAccommodate=function(t){if(0===this.items.length)return!0;if(t._isBlockNode()||this.items[this.items.length-1]._isBlockNode())return!1;var e=this.flowContainer.width;if(!e.isAbsolute())return!0;if(e.minus(this.width).minus(t._boxWidth()).value()>=0)return!0;if(t.isTextNode()&&e.minus(this.width).value()>=t.style("font-size").value())return!0;return!1},t.prototype.getContentWidth=function(){return this.items.reduce((function(t,e){return t.plus(e._boxWidth())}),new r.CssValue("0px"))},t.prototype.getContentHeight=function(){var t=new r.CssValue("0px");return this.items.forEach((function(e){var i=e._boxHeight();i.minus(t).value()>0&&(t=i)})),t},t.prototype.addNode=function(t){this.items.push(t),this.layout()},t.prototype.layout=function(){var t=this,e=new r.CssValue("0px"),i=new r.CssValue("0px");this.items.forEach((function(r){var o=r._boxHeight(),n=r._boxWidth();r._posRelativeToParent={top:t.top,left:e},o.minus(i).value()>0&&(i=o),e=e.plus(n)})),this.width=e,this.height=i},t}(),f=function(){function t(e,i,r){n(this,t),this.container=e,this.width=e.style("width"),this.height=e.style("height"),this.direction=i||"row",this.wrap=r||!0,this._flows=[]}return t.prototype.newFlow=function(){var t=this._flows[this._flows.length-1],e=new r.CssValue("0px"),i=new r.CssValue("0px");return t&&(e=t.top.plus(t.height)),new c(this,this.direction,"","",e,i)},t.prototype.forEach=function(t){this._flows.forEach((function(e){e.items.forEach((function(e){t(e)}))}))},t.prototype.getWidth=function(){var t=new r.CssValue("0px");return this._flows.forEach((function(e){var i=e.getContentWidth();i.minus(t).value()>0&&(t=i)})),t},t.prototype.getHeight=function(){var t=new r.CssValue("0px");return this._flows.forEach((function(e){t=t.plus(e.getContentHeight())})),t},t.prototype.addNode=function(t,e){var i=this,r=void 0;if(this.width.isAbsolute()&&(r=this.width.value()),0!==r){r||(r=1/0);var n=this._flows[this._flows.length-1];if(n&&n.canAccommodate(t)||(n=this.newFlow(),this._flows.push(n)),t.isTextNode()){var s=t.text,a=s.length,u=t.style("font"),c=u["font-size"].value(),f=u["line-height"],g=f.value();f.unit||(g*=c);var m=(0,o.stringifyFont)(u),b=!1;n.width.value()>0&&(b=!0);for(var y=r-n.width.value(),v=[],_=0,w="",x="",T=0;T<a;T++)x=s[T],(0,o.measureText)(e,(v[_]||"")+x,m).width>y&&(l.test(x)?v=d(v):/\w/.test(x)&&/\w/.test(w)&&(v=h(v)),v=p(v,_),_++,y=r),v[_]=(v[_]||"")+x,w=x;v.forEach((function(r,s){r=r.replace(/^\s+|\s+$/g,"");var a=(0,o.measureText)(e,r,m).width,l=t.cloneNode();l.text=r,l.style("width",a+"px"),l.style("height",g+"px"),l.parentNode=t.parentNode,b&&0===s||(n=i.newFlow(),i._flows.push(n)),n.addNode(l)}))}else n.addNode(t)}},t}();e.default=f},function(t,e,i){"use strict";e.__esModule=!0;var r=i(0);var o=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("new Canvas(ctx, width) require ctx");this.ctx=e}return t.prototype.draw=function(t){var e=this;if(t){var i=this.ctx;i.save();var r=t.rootPosition();this.drawNodeBorder(t,r),this.processNodeBorderRadius(t,r),this.drawNodeBackgroundColor(t,r),this.drawNodeImage(t,r),i.restore(),this.processOverFlow(t,r),this.drawNodeText(t,r),(t._flows||[]).forEach((function(t){e.draw(t,"","",!0)})),(t._absolutes||[]).sort((function(t,e){return t.style("z-index").value()-e.style("z-index").value()})).forEach((function(t){e.draw(t,"","",!0)}));var o=t.style("overflow"),n=o["overflow-x"].value(),s=o["overflow-y"].value();"hidden"!==n&&"hidden"!==s||i.restore(),i.restore()}},t.prototype.drawNodeImage=function(t,e){if(t.isImageNode()&&t._resource){var i=this.ctx,r=e.top.plus(t._box.margin.top,t._box.padding.top,t._box.border.top.width).value(),o=e.left.plus(t._box.margin.left,t._box.padding.left,t._box.border.left.width).value();i.drawImage("undefined"!=typeof wx?t._resource.src:t._resource,0,0,t._resource.width,t._resource.height,o,r,t.style("width").value(),t.style("height").value())}},t.prototype.drawNodeText=function(t,e){if(t.isTextNode()){var i=e.top.value(),o=e.left.value(),n=this.ctx,s=t.parentNode?t.parentNode.style("width").value():0,a=t.style("font"),l=t.style("color").value(),u=t.style("text-align").value();"center"===u&&(o+=s/2),"right"===u&&(o+=s),n.textAlign=u,n.textBaseline="top",n.font=(0,r.stringifyFont)(a),n.fillStyle=l,n.fillText(t.text,o,i)}},t.prototype.drawNodeBackgroundColor=function(t,e){var i=(e=e||t.rootPosition()).top,r=e.left,o=t._boxWidth(),n=t._boxHeight(),s=t.style("background-color");if("transparent"!==s.value()){var a=i.plus(t._box.margin.top).plus(t._box.border.top.width),l=r.plus(t._box.margin.left).plus(t._box.border.left.width),u=o.minus(t._box.margin.left).minus(t._box.border.left.width).minus(t._box.margin.right).minus(t._box.border.right.width),h=n.minus(t._box.margin.top).minus(t._box.border.top.width).minus(t._box.margin.bottom).minus(t._box.border.bottom.width);this.ctx.fillStyle=s.value(),this.ctx.fillRect(l.value(),a.value(),u.value(),h.value())}},t.prototype.processOverFlow=function(t,e){var i=t.style("overflow"),r=i["overflow-x"].value(),o=i["overflow-y"].value();if("hidden"!==r&&"hidden"!==o)return!1;var n=t._boxWidth(),s=t._boxHeight();"hidden"!==r&&t._flows&&t._flows.getWidth().minus(n).value()>0&&(n=t._flows.getWidth()),"hidden"!==o&&t._flows&&t._flows.getHeight().minus(s).value()>0&&(s=t._flows.getHeight());var a=this.ctx,l=e.left.plus(t._box.margin.left,t._box.border.left.width,t._box.padding.left),u=e.top.plus(t._box.margin.top,t._box.border.top.width,t._box.padding.top),h=e.left.plus(n).minus(t._box.margin.right,t._box.border.right.width,t._box.padding.right),d=e.top.plus(s).minus(t._box.margin.bottom,t._box.border.bottom.width,t._box.padding.bottom);return a.save(),a.beginPath(),a.moveTo(l.value(),u.value()),a.lineTo(h.value(),u.value()),a.lineTo(h.value(),d.value()),a.lineTo(l.value(),d.value()),a.lineTo(l.value(),u.value()),a.clip(),!0},t.prototype.processNodeBorderRadius=function(t,e){e=e||t.rootPosition();var i=this.ctx,r=t.style("border-radius"),o=r["border-top-left-radius"],n=r["border-top-right-radius"],s=r["border-bottom-left-radius"],a=r["border-bottom-right-radius"],l=t._box.border.top,u=t._box.border.right,h=t._box.border.bottom,d=t._box.border.left,p=e.left.plus(t._box.margin.left).plus(d.width),c=e.top.plus(t._box.margin.top).plus(l.width),f=e.left.plus(t._boxWidth()).minus(t._box.margin.right).minus(u.width),g=e.top.plus(t._boxHeight()).minus(t._box.margin.bottom).minus(h.width);i.save(),i.beginPath();var m=p.plus(o),b=c.plus(o);i.moveTo(p.value(),b.value()),o.value()>0?i.arc(m.value(),b.value(),o.value(),Math.PI,1.5*Math.PI):(i.lineTo(p.value(),c.value()),i.lineTo(m.value(),c.value())),m=f.minus(n),b=c.plus(n),i.lineTo(m.value(),c.value()),n.value()>0?i.arc(m.value(),b.value(),n.value(),1.5*Math.PI,0):(i.lineTo(f.value(),c.value()),i.lineTo(f.value(),b.value())),m=f.minus(a),b=g.minus(a),i.lineTo(f.value(),b.value()),a.value()>0?i.arc(m.value(),b.value(),a.value(),0,.5*Math.PI):(i.lineTo(f.value(),g.value()),i.lineTo(m.value(),g.value())),m=p.plus(s),b=g.minus(s),i.lineTo(m.value(),g.value()),s.value()>0?i.arc(m.value(),b.value(),s.value(),.5*Math.PI,Math.PI):(i.lineTo(p.value(),g.value()),i.lineTo(p.value(),b.value())),m=p.plus(o),b=c.plus(o),i.lineTo(p.value(),b.value()),i.clip()},t.prototype.drawNodeBorder=function(t,e){e=e||t.rootPosition();var i=this.ctx,r=t.style("border-radius"),o=r["border-top-left-radius"],n=r["border-top-right-radius"],s=r["border-bottom-left-radius"],a=r["border-bottom-right-radius"],l=t._box.border.top,u=t._box.border.right,h=t._box.border.bottom,d=t._box.border.left,p=e.left.plus(t._box.margin.left).plus(d.width),c=e.top.plus(t._box.margin.top).plus(l.width),f=e.left.plus(t._boxWidth()).minus(t._box.margin.right).minus(u.width),g=e.top.plus(t._boxHeight()).minus(t._box.margin.bottom).minus(h.width),m=p.plus(o),b=c.plus(o);l.width.value()>0?(i.beginPath(),i.lineWidth=l.width.value(),i.strokeStyle=l.color.value(),"dashed"===l.style.value()?i.setLineDash([6,3]):i.setLineDash([]),i.moveTo(p.value(),b.value()),o.value()>0?i.arc(m.value(),b.value(),o.value(),Math.PI,1.5*Math.PI):(i.lineTo(p.value(),c.value()),i.lineTo(m.value(),c.value())),m=f.minus(n),b=c.plus(n),i.lineTo(m.value(),c.value()),i.stroke()):(m=f.minus(n),b=c.plus(n)),u.width.value()>0?(i.beginPath(),i.moveTo(m.value(),c.value()),i.strokeStyle=u.color.value(),i.lineWidth=u.width.value(),"dashed"===u.style.value()?i.setLineDash([6,3]):i.setLineDash([]),n.value()>0?i.arc(m.value(),b.value(),n.value(),1.5*Math.PI,0):(i.lineTo(f.value(),c.value()),i.lineTo(f.value(),b.value())),m=f.minus(a),b=g.minus(a),i.lineTo(f.value(),b.value()),i.stroke()):(m=f.minus(a),b=g.minus(a)),h.width.value()>0?(i.beginPath(),i.moveTo(f.value(),b.value()),i.strokeStyle=h.color.value(),i.lineWidth=h.width.value(),"dashed"===h.style.value()?i.setLineDash([6,3]):i.setLineDash([]),a.value()>0?i.arc(m.value(),b.value(),a.value(),0,.5*Math.PI):(i.lineTo(f.value(),g.value()),i.lineTo(m.value(),g.value())),m=p.plus(s),b=g.minus(s),i.lineTo(m.value(),g.value()),i.stroke()):(m=p.plus(s),b=g.minus(s)),d.width.value()>0&&(i.beginPath(),i.moveTo(m.value(),g.value()),i.strokeStyle=d.color.value(),i.lineWidth=d.width.value(),"dashed"===d.style.value()?i.setLineDash([6,3]):i.setLineDash([]),s.value()>0?i.arc(m.value(),b.value(),s.value(),.5*Math.PI,Math.PI):(i.lineTo(p.value(),g.value()),i.lineTo(p.value(),b.value())),m=p.plus(o),b=c.plus(o),i.lineTo(p.value(),b.value()-d.width.divide(2).value()),i.stroke())},t}();e.default=o}])}));