(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-pages-recharge-rechargeSubgift-QR_code"],{"02ee":function(t,e,i){"use strict";i("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=i("6f47"),r={name:"lime-painter-view",mixins:[(0,n.children)("painter"),(0,n.parent)("painter")],props:{css:[String,Object]},data:function(){return{type:"view",el:{css:{},views:[]}}},mounted:function(){}};e.default=r},"03e2":function(t,e,i){"use strict";i.r(e);var n=i("6ea9"),r=i.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(o);e["default"]=r.a},"04fe":function(t,e,i){"use strict";i("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,i("64aa");var n={props:{board:Object,pathType:String,fileType:{type:String,default:"png"},quality:{type:Number,default:1},css:[String,Object],width:[Number,String],height:[Number,String],pixelRatio:Number,customStyle:String,isCanvasToTempFilePath:Boolean,sleep:{type:Number,default:1e3/30},beforeDelay:{type:Number,default:100},afterDelay:{type:Number,default:100},useCORS:Boolean}};e.default=n},"0893":function(t,e,i){var n=i("b3a4");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var r=i("967d").default;r("50bfbd2a",n,!0,{sourceMap:!1,shadowMode:!1})},"156d":function(t,e,i){"use strict";(function(t){i("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,i("aa9c"),i("7a76"),i("c9b5"),i("bf0f");var n={};(function(){function e(t){this.mode=r.MODE_8BIT_BYTE,this.data=t}function i(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=new Array}e.prototype={getLength:function(t){return this.data.length},write:function(t){for(var e=0;e=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=i.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var i=-1;i<=7;i++)if(!(t+i<=-1||this.moduleCount<=t+i))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(this.modules[t+i][e+n]=0<=i&&i<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==i||6==i)||2<=i&&i<=4&&2<=n&&n<=4)},getBestMaskPattern:function(){for(var t=0,e=0,i=0;i<8;i++){this.makeImpl(!0,i);var n=s.getLostPoint(this);(0==i||t>n)&&(t=n,e=i)}return e},createMovieClip:function(t,e,i){var n=t.createEmptyMovieClip(e,i);this.make();for(var r=0;r>i&1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=n}for(i=0;i<18;i++){n=!t&&1==(e>>i&1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=n}},setupTypeInfo:function(t,e){for(var i=this.errorCorrectLevel<<3|e,n=s.getBCHTypeInfo(i),r=0;r<15;r++){var o=!t&&1==(n>>r&1);r<6?this.modules[r][8]=o:r<8?this.modules[r+1][8]=o:this.modules[this.moduleCount-15+r][8]=o}for(r=0;r<15;r++){o=!t&&1==(n>>r&1);r<8?this.modules[8][this.moduleCount-r-1]=o:r<9?this.modules[8][15-r-1+1]=o:this.modules[8][15-r-1]=o}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var i=-1,n=this.moduleCount-1,r=7,o=0,a=this.moduleCount-1;a>0;a-=2){6==a&&a--;while(1){for(var h=0;h<2;h++)if(null==this.modules[n][a-h]){var c=!1;o>>r&1));var u=s.getMask(e,n,a-h);u&&(c=!c),this.modules[n][a-h]=c,r--,-1==r&&(o++,r=7)}if(n+=i,n<0||this.moduleCount<=n){n-=i,i=-i;break}}}}},i.PAD0=236,i.PAD1=17,i.createData=function(t,e,n){for(var r=d.getRSBlocks(t,e),o=new f,a=0;a8*c)throw new Error("code length overflow. ("+o.getLengthInBits()+">"+8*c+")");o.getLengthInBits()+4<=8*c&&o.put(0,4);while(o.getLengthInBits()%8!=0)o.putBit(!1);while(1){if(o.getLengthInBits()>=8*c)break;if(o.put(i.PAD0,8),o.getLengthInBits()>=8*c)break;o.put(i.PAD1,8)}return i.createBytes(o,r)},i.createBytes=function(t,e){for(var i=0,n=0,r=0,o=new Array(e.length),a=new Array(e.length),h=0;h=0?g.get(v):0}}var m=0;for(f=0;f=0)e^=s.G15<=0)e^=s.G18<>>=1;return e},getPatternPosition:function(t){return s.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,i){switch(t){case a.PATTERN000:return(e+i)%2==0;case a.PATTERN001:return e%2==0;case a.PATTERN010:return i%3==0;case a.PATTERN011:return(e+i)%3==0;case a.PATTERN100:return(Math.floor(e/2)+Math.floor(i/3))%2==0;case a.PATTERN101:return e*i%2+e*i%3==0;case a.PATTERN110:return(e*i%2+e*i%3)%2==0;case a.PATTERN111:return(e*i%3+(e+i)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new u([1],0),i=0;i5&&(i+=3+o-5)}for(n=0;n=256)t-=255;return h.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},c=0;c<8;c++)h.EXP_TABLE[c]=1<>>7-t%8&1)},put:function(t,e){for(var i=0;i>>e-i-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},n={errorCorrectLevel:o,defaults:{size:354,margin:0,backgroundColor:"#ffffff",foregroundColor:"#000000",fileType:"png",errorCorrectLevel:o.H,typeNumber:-1},make:function(e){var n=this;return new Promise((function(r,o){var a={canvasId:e.canvasId,componentInstance:e.componentInstance,text:e.text,size:n.defaults.size,margin:n.defaults.margin,backgroundColor:n.defaults.backgroundColor,foregroundColor:n.defaults.foregroundColor,fileType:n.defaults.fileType,errorCorrectLevel:n.defaults.errorCorrectLevel,typeNumber:n.defaults.typeNumber};if(e)for(var s in e)a[s]=e[s];e=a,e.canvasId?function(){var t=new i(e.typeNumber,e.errorCorrectLevel);t.addData(function(t){for(var e,i="",n=0;n=1&&e<=127?i+=t.charAt(n):e>2047?(i+=String.fromCharCode(224|e>>12&15),i+=String.fromCharCode(128|e>>6&63),i+=String.fromCharCode(128|e>>0&63)):(i+=String.fromCharCode(192|e>>6&31),i+=String.fromCharCode(128|e>>0&63));return i}(e.text)),t.make();var n=uni.createCanvasContext(e.canvasId,e.componentInstance);n.setFillStyle(e.backgroundColor),n.fillRect(0,0,e.size,e.size);for(var a=(e.size-2*e.margin)/t.getModuleCount(),s=a,h=0;ho)return 1;if(r2&&void 0!==arguments[2]&&arguments[2];if("number"===typeof e)return e;if(u(e))return 1*e;if("string"===typeof e){var r=/^-?([0-9]+)?([.]{1}[0-9]+){0,1}(em|rpx|px|%)$/g,o=r.exec(e);if(!e||!o)return 0;var a=o[3];e=parseFloat(e);var s=0;return"rpx"===a?s=uni.upx2px(e):"px"===a?s=1*e:"%"===a?s=e*t(i)/100:"em"===a&&(s=e*t(i||14)),n?1*s.toFixed(2):Math.round(s)}return 0};var r=n(i("2634")),o=n(i("9b1b")),a=n(i("2fdc")),s=n(i("5de6"));i("5c47"),i("0506"),i("bf0f"),i("4626"),i("e838"),i("aa9c"),i("e966"),i("80e3"),i("4db2"),i("5ef2"),i("c976"),i("4d8f"),i("7b97"),i("668a"),i("c5b7"),i("8ff5"),i("2378"),i("641a"),i("64e0"),i("cce3"),i("efba"),i("d009"),i("bd7d"),i("7edd"),i("d798"),i("f547"),i("5e54"),i("b60a"),i("8c18"),i("12973"),i("f991"),i("198e"),i("8557"),i("63b1"),i("1954"),i("1cf1"),i("a1c1"),i("c9b5"),i("15d1"),i("d5c6"),i("5a56"),i("f074"),i("18f7"),i("de6c"),i("dc89"),i("2425");e.networkReg=/^(http|\/\/)/;e.isBase64=function(t){return/^data:image\/(\w+);base64/.test(t)};var h=["devtools"].includes(uni.getSystemInfoSync().platform),c={};function u(t){return/^-?\d+(\.\d+)?$/.test(t)}function d(t){return/^data:/.test(t)?t:new Promise((function(e,i){var n=new Image;n.setAttribute("crossOrigin","Anonymous"),n.onload=function(){var t=document.createElement("canvas");t.width=this.naturalWidth,t.height=this.naturalHeight,t.getContext("2d").drawImage(n,0,0);var i=t.toDataURL("image/png");e(i),t.height=t.width=0},n.src=t+"?v="+Math.random(),n.onerror=function(t){i(t)}}))}}).call(this,i("ba7c")["default"])},"6b5e":function(t,e,i){"use strict";i.r(e);var n=i("839f"),r=i.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(o);e["default"]=r.a},"6ea9":function(t,e,i){"use strict";(function(t){i("6a54");var n=i("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,i("c223"),i("d4b5"),i("bf0f");n(i("156d"));var r,o=i("1bcb"),a={data:function(){return{path:"",base64Url:"",Base64Img:""}},onLoad:function(e){r=this,t.log(e["code_sn"],"转赠码");var i={code:e["code_sn"]};uni.showLoading({title:"正在生成分享码"}),(0,o.infoAPI)().then((function(e){(0,o.makeCodeAPI)({contents:"https://jc.agrimedia.cn/mkmk/index.html?bm_yq_code=".concat(e["data"]["userInfo"]["invite_code"],"&H5URL=https://jc.agrimedia.cn/privilege/pages/pages-recharge/shareRedEnvelopes/index&other=").concat(JSON.stringify(i))}).then((function(e){if(uni.hideLoading(),e){var i="data:image/png;base64,".concat(uni.arrayBufferToBase64(e));(0,o.getUpTokenAPI)().then((function(t){return r.uploadFilePromise(i,t["data"])})).then((function(e){var i=JSON.parse(e),n="https://img.agrimedia.cn/".concat(i.key);r["base64Url"]=n,t.log(r["Base64Img"],"二维码上传后")}))}}))}))},methods:{saveImageToPhotosAlbum:function(){downloadPics(this["Base64Img"])},success:function(e){var i=this;this["path"]=e,(0,o.getUpTokenAPI)().then((function(t){return i.uploadFilePromise(e,t["data"])})).then((function(e){var n=JSON.parse(e),r="https://img.agrimedia.cn/".concat(n.key);i["Base64Img"]=r,t.log(i["Base64Img"],"上传后")}))},uploadFilePromise:function(e,i){return new Promise((function(n,r){var o=uni.uploadFile({url:"https://up-z1.qiniup.com",filePath:e,name:"file",formData:{key:i.key,token:i.uptoken},success:function(e){n(e.data),t.log(e.data,"上传成功")},fail:function(e){t.log(e,"上传错误"),r()},onUploadProgress:function(e){t.log("upload",e)}});o.onProgressUpdate((function(t){}))}))}}};e.default=a}).call(this,i("ba7c")["default"])},"6f47":function(t,e,i){"use strict";var n=i("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.children=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.indexKey;return{inject:(0,a.default)({},t,{default:null}),watch:{el:{handler:function(t,e){JSON.stringify(t)!=JSON.stringify(e)&&this.bindRelation()},deep:!0,immediate:!0},src:{handler:function(t,e){t!=e&&this.bindRelation()},immediate:!0},text:{handler:function(t,e){t!=e&&this.bindRelation()},immediate:!0},css:{handler:function(t,e){t!=e&&(this.el.css=("object"==(0,o.default)(t)?t:t&&Object.assign.apply(Object,(0,r.default)(s(t))))||{})},immediate:!0},replace:{handler:function(t,e){JSON.stringify(t)!=JSON.stringify(e)&&this.bindRelation()},deep:!0,immediate:!0}},created:function(){var e=this;this._uid||(this._uid=this._.uid),Object.defineProperty(this,"parent",{get:function(){return e[t]||[]}}),Object.defineProperty(this,"index",{get:function(){e.bindRelation();var t=e.parent;t=void 0===t?{}:t;var i=t.el;i=void 0===i?{}:i;var n=i.views,r=void 0===n?[]:n;return r.indexOf(e.el)}}),this.el.type=this.type,this.bindRelation()},beforeDestroy:function(){this.removeEl()},methods:{removeEl:function(){var t=this;this.parent&&(this.parent.el.views=this.parent.el.views.filter((function(e){return e._uid!==t._uid})))},bindRelation:function(){var t=this;if(this.el._uid||(this.el._uid=this._uid),["text","qrcode"].includes(this.type)&&(this.el.text=this.$slots&&this.$slots.default&&this.$slots.default[0].text||"".concat(this.text||"").replace(/\\n/g,"\n")),"image"==this.type&&(this.el.src=this.src),this.parent){var e=this.parent.el.views||[];-1!==e.indexOf(this.el)?this.parent.el.views=e.map((function(e){return e._uid==t._uid?t.el:e})):this.parent.el.views=[].concat((0,r.default)(e),[this.el])}}},mounted:function(){}}},e.parent=function(t){return{provide:function(){return(0,a.default)({},t,this)},data:function(){return{el:{css:{},views:[]}}},watch:{css:{handler:function(t){this.canvasId&&(this.el.css=("object"==(0,o.default)(t)?t:t&&Object.assign.apply(Object,(0,r.default)(s(t))))||{},this.canvasWidth=this.el.css&&this.el.css.width||this.canvasWidth,this.canvasHeight=this.el.css&&this.el.css.height||this.canvasHeight)},immediate:!0}}}};var r=n(i("b7c7")),o=n(i("fcf3")),a=n(i("39d8"));i("fd3c"),i("8f71"),i("bf0f"),i("5c47"),i("0506"),i("f7a5"),i("5ef2"),i("a1c1"),i("d4b5"),i("6a54"),i("4626"),i("c223");var s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.split(";").filter((function(t){return t&&!/^[\n\s]+$/.test(t)})).map((function(t){var e=t.slice(0,t.indexOf(":")),i=t.slice(t.indexOf(":")+1);return(0,a.default)({},e.replace(/-([a-z])/g,(function(){return arguments[1].toUpperCase()})).replace(/\s+/g,""),i.replace(/^\s+/,"").replace(/\s+$/,"")||"")}))}},"72d6":function(t,e,i){"use strict";i.r(e);var n=i("02ee"),r=i.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(o);e["default"]=r.a},"786f":function(t,e,i){"use strict";i.r(e);var n=i("17c2"),r=i("6b5e");for(var o in r)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return r[t]}))}(o);var a=i("828b"),s=Object(a["a"])(r["default"],n["b"],n["c"],!1,null,"bef69f9a",null,!1,n["a"],void 0);e["default"]=s.exports},"7a9b":function(t,e,i){"use strict";i.r(e);var n=i("c5cb"),r=i.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(o);e["default"]=r.a},"839f":function(t,e,i){"use strict";i("6a54"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=i("6f47"),r={name:"lime-painter-image",mixins:[(0,n.children)("painter")],props:{css:[String,Object],src:String},data:function(){return{type:"image",el:{css:{},src:null}}}};e.default=r},"884c":function(t,e,i){"use strict";i.d(e,"b",(function(){return r})),i.d(e,"c",(function(){return o})),i.d(e,"a",(function(){return n}));var n={lPainter:i("bc20").default,lPainterView:i("c366").default,lPainterImage:i("786f").default},r=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("v-uni-view",{staticClass:"content"},[i("v-uni-image",{staticStyle:{width:"100%",height:"100%"},attrs:{src:t.path}}),t.base64Url?i("v-uni-view",[i("l-painter",{attrs:{isCanvasToTempFilePath:!0,"custom-style":"position: fixed; left: 200%",css:"width: 100%; height:100%; background: linear-gradient(,#ff971b 0%, #ff5000 100%)"},on:{success:function(e){arguments[0]=e=t.$handleEvent(e),t.success.apply(void 0,arguments)}}},[i("l-painter-view",{attrs:{css:"box-sizing: border-box; background: #fff; border-radius: 16rpx; width: 670rpx; box-shadow: 0 20rpx 58rpx rgba(0,0,0,.15)"}},[i("l-painter-image",{attrs:{src:"https://img.agrimedia.cn/chwl/20230107-114906.png",css:"object-fit: cover;width: 100%; height: 100%;"}}),i("l-painter-image",{attrs:{src:t.base64Url,css:"object-fit: cover;width: 300rpx; height: 300rpx;position: fixed;left:50%;top:20%;transform: translate(-50%,-20%);"}})],1)],1)],1):t._e(),i("v-uni-canvas",{staticStyle:{position:"fixed",top:"-2000rpx",width:"200rpx",height:"200rpx",margin:"0 auto"},attrs:{"canvas-id":"qrcode"}}),i("v-uni-view",{staticClass:"footer_content"},[i("v-uni-view",{staticClass:"btn btn2",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.saveImageToPhotosAlbum.apply(void 0,arguments)}}},[t._v("保存至本地")])],1)],1)},o=[]},9908:function(t,e,i){"use strict";i.r(e);var n=i("884c"),r=i("03e2");for(var o in r)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return r[t]}))}(o);i("c71a");var a=i("828b"),s=Object(a["a"])(r["default"],n["b"],n["c"],!1,null,"4b05a456",null,!1,n["a"],void 0);e["default"]=s.exports},b3a4:function(t,e,i){var n=i("c86c");e=n(!1),e.push([t.i,".lime-painter[data-v-56095063],\n.lime-painter__canvas[data-v-56095063]{\nwidth:100%;\n}",""]),t.exports=e},bc20:function(t,e,i){"use strict";i.r(e);var n=i("2106"),r=i("7a9b");for(var o in r)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return r[t]}))}(o);i("3d5a");var a=i("828b"),s=Object(a["a"])(r["default"],n["b"],n["c"],!1,null,"56095063",null,!1,n["a"],void 0);e["default"]=s.exports},bd59:function(t,e,i){var n=i("c2f9");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var r=i("967d").default;r("34bb8a7e",n,!0,{sourceMap:!1,shadowMode:!1})},c2f9:function(t,e,i){var n=i("c86c");e=n(!1),e.push([t.i,"uni-page-body[data-v-4b05a456],\n.content[data-v-4b05a456]{width:100%;height:100%}\n\n/* .footer_content{\n\twidth:100%;\n\t\t\tpadding-left: 24rpx;\n\tpadding-right: 24rpx;\n} */.btn[data-v-4b05a456]{\n\t/* width: 94%; */height:%?92?%;border-radius:%?46?%;font-size:%?32?%;line-height:%?92?%;text-align:center;width:%?680?%;left:50%;margin-left:%?-340?%}.btn2[data-v-4b05a456]{background:linear-gradient(141deg,#ffaf00,#f70);color:#fffbf2;position:fixed;bottom:%?148?%}",""]),t.exports=e},c366:function(t,e,i){"use strict";i.r(e);var n=i("f34d"),r=i("72d6");for(var o in r)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return r[t]}))}(o);var a=i("828b"),s=Object(a["a"])(r["default"],n["b"],n["c"],!1,null,"17c7b324",null,!1,n["a"],void 0);e["default"]=s.exports},c5cb:function(t,e,i){"use strict";(function(t){i("6a54");var n=i("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(i("2634")),o=n(i("2fdc"));i("c223"),i("dc8a"),i("d4b5"),i("bf0f"),i("5c47"),i("7a76"),i("c9b5"),i("a1c1");var a=i("6f47"),s=n(i("04fe")),h=i("5549"),c=n(i("e1c5")),u={name:"lime-painter",mixins:[s.default,(0,a.parent)("painter"),{}],data:function(){return{use2dCanvas:!1,canvasHeight:150,canvasWidth:null,parentWidth:0,inited:!1,progress:0,firstRender:0,done:!1}},computed:{styles:function(){return"".concat(this.size).concat(this.customStyle||"",";")},canvasId:function(){return"l-painter".concat(this._uid||this._.uid)},size:function(){if(this.boardWidth&&this.boardHeight)return"width:".concat(this.boardWidth,"px; height: ").concat(this.boardHeight,"px;")},dpr:function(){return this.pixelRatio||uni.getSystemInfoSync().pixelRatio},boardWidth:function(){var t=this.elements&&this.elements.css||this.elements||this,e=t.width,i=void 0===e?0:e,n=(0,h.toPx)(i||this.width);return n||Math.max(n,(0,h.toPx)(this.canvasWidth))},boardHeight:function(){var t=this.elements&&this.elements.css||this.elements||this,e=t.height,i=void 0===e?0:e,n=(0,h.toPx)(i||this.height);return n||Math.max(n,(0,h.toPx)(this.canvasHeight))},hasBoard:function(){return this.board&&Object.keys(this.board).length},elements:function(){return this.hasBoard?this.board:JSON.parse(JSON.stringify(this.el))}},watch:{},created:function(){var t=uni.getSystemInfoSync();t.SDKVersion,t.version,t.platform},mounted:function(){var t=this;return(0,o.default)((0,r.default)().mark((function e(){return(0,r.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,h.sleep)(30);case 2:return e.next=4,t.getParentWeith();case 4:t.$nextTick((function(){setTimeout((function(){t.$watch("elements",t.watchRender,{deep:!0,immediate:!0})}),30)}));case 5:case"end":return e.stop()}}),e)})))()},methods:{watchRender:function(t,e){var i=this;return(0,o.default)((0,r.default)().mark((function n(){return(0,r.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(t&&t.views&&(i.firstRender?i.firstRender:t.views.length)&&Object.keys(t).length&&JSON.stringify(t)!=JSON.stringify(e)){n.next=2;break}return n.abrupt("return");case 2:i.firstRender=1,clearTimeout(i.rendertimer),i.rendertimer=setTimeout((function(){i.render(t)}),i.beforeDelay);case 5:case"end":return n.stop()}}),n)})))()},setFilePath:function(t,e){var i=this;return(0,o.default)((0,r.default)().mark((function n(){var o,a,s,c;return(0,r.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(o=t,a=e||i,s=a.pathType,c=void 0===s?i.pathType:s,"base64"!=c||(0,h.isBase64)(t)){n.next=8;break}return n.next=5,(0,h.pathToBase64)(t);case 5:o=n.sent,n.next=12;break;case 8:if("url"!=c||!(0,h.isBase64)(t)){n.next=12;break}return n.next=11,(0,h.base64ToPath)(t);case 11:o=n.sent;case 12:return e&&e.isEmit&&i.$emit("success",o),n.abrupt("return",o);case 14:case"end":return n.stop()}}),n)})))()},getSize:function(t){var e=this;return(0,o.default)((0,r.default)().mark((function i(){var n,o,a,s;return(0,r.default)().wrap((function(i){while(1)switch(i.prev=i.next){case 0:if(n=t.css||t,o=n.width,a=t.css||t,s=a.height,e.size){i.next=12;break}if(!o&&!s){i.next=10;break}return e.canvasWidth=o||e.canvasWidth,e.canvasHeight=s||e.canvasHeight,i.next=8,(0,h.sleep)(30);case 8:i.next=12;break;case 10:return i.next=12,e.getParentWeith();case 12:case"end":return i.stop()}}),i)})))()},canvasToTempFilePathSync:function(t){var e=this;this.stopWatch=this.$watch("done",(function(i){i&&(e.canvasToTempFilePath(t),e.stopWatch&&e.stopWatch())}),{immediate:!0})},getParentWeith:function(){var t=this;return new Promise((function(e){uni.createSelectorQuery().in(t).select(".lime-painter").boundingClientRect().exec((function(i){var n=i[0]||{},r=n.width,o=n.height;t.parentWidth=Math.ceil(r||0),t.canvasWidth=t.parentWidth||300,t.canvasHeight=o||t.canvasHeight||150,e(i[0])}))}))},render:function(){var e=arguments,i=this;return(0,o.default)((0,r.default)().mark((function n(){var o,a,s,u,d,f,l,p,g,v,m,b,y,w;return(0,r.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(o=e.length>0&&void 0!==e[0]?e[0]:{},Object.keys(o).length){n.next=3;break}return n.abrupt("return",t.error("空对象"));case 3:return i.progress=0,i.done=!1,n.next=7,i.getSize(o);case 7:return n.next=9,i.getContext();case 9:if(a=n.sent,s=i.use2dCanvas,u=i.boardWidth,d=i.boardHeight,f=i.canvas,l=i.afterDelay,!s||f){n.next=13;break}return n.abrupt("return",Promise.reject(new Error("render: fail canvas has not been created")));case 13:return i.boundary={top:0,left:0,width:u,height:d},i.painter=null,i.painter||(p=o.css||o,g=p.width,v=o.css||o,v.height,!g&&i.parentWidth&&Object.assign(o,{width:i.parentWidth}),m={context:a,canvas:f,width:u,height:d,pixelRatio:i.dpr,useCORS:i.useCORS,createImage:h.getImageInfo.bind(i),listen:{onProgress:function(t){i.progress=t,i.$emit("progress",t)},onEffectFail:function(t){i.$emit("faill",t)}}},i.painter=new c.default(m)),n.next=18,i.painter.source(JSON.parse(JSON.stringify(o)));case 18:return b=n.sent,y=b.width,w=b.height,i.boundary.height=i.canvasHeight=w,i.boundary.width=i.canvasWidth=y,n.next=25,(0,h.sleep)(i.sleep);case 25:return i.painter.setContext(i.ctx),n.next=28,i.painter.render();case 28:return n.next=30,new Promise((function(t){return i.$nextTick(t)}));case 30:if(s){n.next=33;break}return n.next=33,i.canvasDraw();case 33:if(!l||!s){n.next=36;break}return n.next=36,(0,h.sleep)(l);case 36:return i.$emit("done"),i.done=!0,i.isCanvasToTempFilePath&&i.canvasToTempFilePath().then((function(t){i.$emit("success",t.tempFilePath)})).catch((function(t){i.$emit("fail",new Error(JSON.stringify(t)))})),n.abrupt("return",Promise.resolve({ctx:a,draw:i.painter,node:i.node}));case 40:case"end":return n.stop()}}),n)})))()},canvasDraw:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(i,n){return t.ctx.draw(e,(function(){return setTimeout((function(){return i()}),t.afterDelay)}))}))},getContext:function(){var e=this;return(0,o.default)((0,r.default)().mark((function i(){var n,o,a;return(0,r.default)().wrap((function(i){while(1)switch(i.prev=i.next){case 0:if(e.canvasWidth){i.next=4;break}return e.$emit("fail","painter no size"),t.error("painter no size: 请给画板或父级设置尺寸"),i.abrupt("return",Promise.reject());case 4:if(!e.ctx||!e.inited){i.next=6;break}return i.abrupt("return",Promise.resolve(e.ctx));case 6:if(n=e.type,o=e.use2dCanvas,e.dpr,e.boardWidth,e.boardHeight,a=function(){return new Promise((function(t){uni.createSelectorQuery().in(e).select("#".concat(e.canvasId)).boundingClientRect().exec((function(i){if(i){var n=uni.createCanvasContext(e.canvasId,e);e.inited||(e.inited=!0,e.use2dCanvas=!1,e.canvas=i),e.ctx=n,t(e.ctx)}}))}))},o){i.next=10;break}return i.abrupt("return",a());case 10:return i.abrupt("return",new Promise((function(t){uni.createSelectorQuery().in(e).select("#".concat(e.canvasId)).node().exec((function(i){var r=i[0].node;r||(e.use2dCanvas=!1,t(e.getContext()));var o=r.getContext(n);e.inited||(e.inited=!0,e.use2dCanvas=!0,e.canvas=r),e.ctx=o,t(e.ctx)}))})));case 11:case"end":return i.stop()}}),i)})))()},canvasToTempFilePath:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var i=(0,o.default)((0,r.default)().mark((function i(n,a){var s,h,c,u,d,f,l,p,g,v,m,b,y,w,x,S,P;return(0,r.default)().wrap((function(i){while(1)switch(i.prev=i.next){case 0:if(s=t.use2dCanvas,h=t.canvasId,c=t.dpr,u=t.fileType,d=t.quality,f=function(){var e=(0,o.default)((0,r.default)().mark((function e(i){var o;return(0,r.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setFilePath(i.tempFilePath||i);case 3:o=e.sent,n(Object.assign(i,{tempFilePath:o})),e.next=10;break;case 7:e.prev=7,e.t0=e["catch"](0),t.$emit("fail",e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}(),l=t.boundary||t,p=l.top,g=void 0===p?0:p,v=l.left,m=void 0===v?0:v,b=l.width,y=l.height,w=b*c,x=y*c,S=Object.assign({x:m,y:g,width:b,height:y,destWidth:w,destHeight:x,canvasId:h,fileType:u,quality:d,success:f,fail:a},e),!s){i.next=22;break}return i.prev=7,e.pathType||t.pathType||(e.pathType="url"),i.next=11,t.setFilePath(t.canvas.toDataURL("image/".concat(e.fileType||u).replace(/pg/,"peg"),e.quality||d),e);case 11:P=i.sent,e.success&&e.success({tempFilePath:P}),n({tempFilePath:P}),i.next=20;break;case 16:i.prev=16,i.t0=i["catch"](7),e.fail&&e.fail(i.t0),a(i.t0);case 20:i.next=23;break;case 22:uni.canvasToTempFilePath(S,t);case 23:case"end":return i.stop()}}),i,null,[[7,16]])})));return function(t,e){return i.apply(this,arguments)}}())}}};e.default=u}).call(this,i("ba7c")["default"])},c71a:function(t,e,i){"use strict";var n=i("bd59"),r=i.n(n);r.a},e1c5:function(t,e,i){"use strict";(function(t){var n=i("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Painter=void 0;var r=n(i("fcf3"));i("bf0f"),i("01a2"),i("e39c"),i("844d"),i("18f7"),i("de6c"),i("7a76"),i("c9b5"),i("aa9c"),i("5c47"),i("0506"),i("e838"),i("9db6"),i("2c10"),i("5ef2"),i("0c26"),i("20f3"),i("6a54"),i("8a8d"),i("f7a5"),i("08eb"),i("4626"),i("5ac7"),i("4100"),i("2797"),i("473f"),i("dc8a"),i("fd3c"),i("aa77"),i("a1c1"),i("c223"),i("c1a3"),i("1851"),i("8f71"),i("d4b5"),i("22b6");var o=function(){return o=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]t.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function M(t){return"number"==typeof t}function O(t){return"auto"===t||null===t}function L(t){return/%$/.test(t)}var z,A=0,E=function(){function t(){k(this,"elements",[]),k(this,"afterElements",[]),k(this,"beforeElements",[]),k(this,"ids",[]),k(this,"width",0),k(this,"height",0),k(this,"top",0),k(this,"left",0),k(this,"pre",null),k(this,"offsetX",0),k(this,"offsetY",0),A++,this.id=A}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return this.outerWidth||t.parent&&t.parent.contentSize.width,!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0)this[this.key.height]&&(this[this.key.height]=t.offsetSize[this.key.height]),this[this.key.width]+=t.offsetSize[this.key.width];var e=Math.min(this[this.key.width],this.container.contentSize[this.key.width]);(this.container.lineMaxWidth||0)1?0:"flex-end"===t.style.alignSelf?this.container.contentSize[this.key.contentHeight]-t.contentSize[this.key.height]:"center"===t.style.alignSelf?(this.container.contentSize[this.key.contentHeight]-t.contentSize[this.key.height])/2:0},r}(E),W=f,j=d,D=u,F=l,N="inline-block",H="flex",$="absolute",U="fixed",X=0,Y={left:null,top:null,width:null,height:null},J=function(){function e(t,e,i,n){var r=this;k(this,"id",X++),k(this,"style",{left:null,top:null,width:null,height:null}),k(this,"computedStyle",{}),k(this,"originStyle",{}),k(this,"children",{}),k(this,"layoutBox",T({},Y)),k(this,"contentSize",T({},Y)),k(this,"clientSize",T({},Y)),k(this,"borderSize",T({},Y)),k(this,"offsetSize",T({},Y)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.name||t.type,this.attributes=this.getAttributes(t);var o=this.getComputedStyle(t,e&&e.computedStyle);this.isAbsolute=o.position==$,this.isFixed=o.position==U,this.originStyle=o,Object.keys(o).forEach((function(t){Object.defineProperty(r.style,t,{configurable:!0,enumerable:!0,get:function(){return o[t]},set:function(e){o[t]=e}})}));var a={contentSize:T({},this.contentSize),clientSize:T({},this.clientSize),borderSize:T({},this.borderSize),offsetSize:T({},this.offsetSize)};Object.keys(a).forEach((function(t){Object.keys(r[t]).forEach((function(e){Object.defineProperty(r[t],e,{configurable:!0,enumerable:!0,get:function(){return a[t][e]},set:function(i){a[t][e]=i}})}))})),this.computedStyle=this.style}var i=e.prototype;return i.add=function(t){t.parent=this,this.children[t.id]=t},i.getChildren=function(){var t=this;return Object.keys(this.children).map((function(e){return t.children[e]}))},i.getLineRect=function(t,e){var i=e?e.lines:this.parent&&this.parent.lines;return i&&i.find((function(e){return e.ids.includes(t)}))||{width:0,height:0}},i.getComputedStyle=function(e,i){var n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],o=e.css,a=void 0===o?{}:o,s=e.type,h=void 0===s?D:s,c=T({},g);if([j,W,F].includes(h)&&!a.display&&(c.display=N),i)for(var u=0;u=0&&d<0,N=h>=0&&l<0;return i==c[0]&&(this[i].left=t.left+a+v+W+(F?2*-d:0),this[i].top=t.top+h+b+I+(N?2*-l:0),this[i].width=t.width+(this[i].widthAdd?0:j),this[i].height=t.height+(this[i].heightAdd?0:D),this[i].widthAdd=j,this[i].heightAdd=D),i==c[1]&&(this[i].left=t.left+a+W+(F<0?-d:0),this[i].top=t.top+h+I+(N?-l:0),this[i].width=t.width+v+w,this[i].height=t.height+b+S),i==c[2]&&(this[i].left=t.left+a+W/2+(F<0?-d:0),this[i].top=t.top+h+I/2+(N?-l:0),this[i].width=t.width+v+w+W/2+E/2,this[i].height=t.height+b+S+L/2+I/2),i==c[3]&&(this[i].left=t.left+(F<0?-d:0),this[i].top=t.top+(N?-l:0),this[i].width=t.width+v+w+W+E+a+d,this[i].height=t.height+b+S+L+I+l+h),this[i]},i.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},a=o.border,s=(a=void 0===a?{}:a).borderWidth,h=void 0===s?0:s,u=o.borderTop,d=(u=void 0===u?{}:u).borderTopWidth,f=void 0===d?h:d,l=o.borderBottom,p=(l=void 0===l?{}:l).borderBottomWidth,g=void 0===p?h:p,v=o.borderRight,m=(v=void 0===v?{}:v).borderRightWidth,b=void 0===m?h:m,y=o.borderLeft,w=(y=void 0===y?{}:y).borderLeftWidth,x=void 0===w?h:w,S=o.padding,P=(S=void 0===S?{}:S).paddingTop,k=void 0===P?0:P,T=S.paddingRight,B=void 0===T?0:T,C=S.paddingBottom,I=void 0===C?0:C,M=S.paddingLeft,O=void 0===M?0:M;i||(t.width-=O+B+b+x),1!==i||n||(t.height-=k+I+f+g)}this.layoutBox&&(c.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},i.getBoxPosition2=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,a=void 0===o?0:o,s=t.padding||{},h=s.paddingBottom,c=void 0===h?0:h,u=s.paddingRight,d=void 0===u?0:u,f=T({},this.contentSize,{left:r,top:a}),l=this.contentSize.top-this.offsetSize.top,p=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var g,v=I(this.root.fixedLine.elements);!(g=v()).done;){var m=g.value;m.setPosition(m,this.root.offsetSize),m.getBoxPosition2()}}if(e)for(var b,y=I(e.elements);!(b=y()).done;){var w=b.value;w.setPosition(w,f),w.style.left+=r+p+d,w.style.top+=a+l+c,w.getBoxPosition2()}if(i)for(var x,S=I(i);!(x=S()).done;)x.value.layout(f.top+l,f.left+p);return this.layoutBoxUpdate(f,t),this.layoutBox},i.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},i.isBlock=function(t){return void 0===t&&(t=this),t&&"block"==t.style.display},i.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==H},i.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},i.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&!!t.parent&&(!(!t.parent||t.parent.style.display!==H)||void 0)},i.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==N},i.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},i.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},i.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,a=this.ctx,s=this.getChildren(),h=i.left,c=void 0===h?0:h,u=i.top,d=void 0===u?0:u,f=i.bottom,l=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,m=i.maxWidth,b=i.minHeight,y=i.maxHeight,w=i.height,S=void 0===w?0:w,P=i.fontSize,k=void 0===P?14:P,T=i.fontWeight,B=i.fontFamily,C=i.fontStyle,I=i.position,M=i.lineClamp,O=i.lineHeight,z=i.padding,A=void 0===z?{}:z,R=i.margin,F=void 0===R?{}:R,N=i.border,H=(N=void 0===N?{}:N).borderWidth,U=void 0===H?0:H,X=i.borderRight,Y=(X=void 0===X?{}:X).borderRightWidth,J=void 0===Y?U:Y,G=i.borderLeft,q=(G=void 0===G?{}:G).borderLeftWidth,K=void 0===q?U:q,V=o.contentSize&&o.contentSize.width,Q=o.contentSize&&o.contentSize.height;if(L(g)&&V&&(g=x(g,V)),L(g)&&!V&&(g=null),L(S)&&Q&&(S=x(S,Q)),L(S)&&!Q&&(S=null),L(v)&&V&&(v=x(v,V)),L(m)&&V&&(m=x(m,V)),L(b)&&Q&&(b=x(b,Q)),L(y)&&Q&&(y=x(y,Q)),i.padding&&V)for(var Z in i.padding)Object.hasOwnProperty.call(i.padding,Z)&&(i.padding[Z]=x(i.padding[Z],V));var tt=A.paddingRight,et=void 0===tt?0:tt,it=A.paddingLeft,nt=void 0===it?0:it;if(i.margin&&[i.margin.marginLeft,i.margin.marginRight].includes("auto"))if(g){var rt=V&&V-g-et-nt-K-J||0;i.margin.marginLeft==i.margin.marginRight?i.margin.marginLeft=i.margin.marginRight=rt/2:"auto"==i.margin.marginLeft?i.margin.marginLeft=rt:i.margin.marginRight=rt}else i.margin.marginLeft=i.margin.marginRight=0;var ot=F.marginRight,at=void 0===ot?0:ot,st=F.marginLeft,ht={width:g,height:S,left:0,top:0},ct=nt+et+K+J+(void 0===st?0:st)+at;if(e==j&&!this.attributes.widths){var ut=n.text||"";a.save(),a.setFonts({fontFamily:B,fontSize:k,fontWeight:T,fontStyle:C});var dt=new Map;ut.split("\n").map((function(e){var i=e.split("").map((function(e){var i=dt.get(e);if(i)return i;var n=t.measureText(e,k).width;return dt.set(e,n),n})),n=t.measureText(e,k),r=n.fontHeight,o=n.ascent,a=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=a,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e}),0)})})),a.restore()}if(e==W&&null==g){var ft=n.width,lt=n.height;ht.width=this.contrastSize(Math.round(ft*S/lt)||0,v,m),this.layoutBoxUpdate(ht,i,0)}if(e==j&&null==g){var pt=this.attributes.widths,gt=Math.max.apply(Math,pt.map((function(t){return t.total})));o&&V>0&&(gt>V||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed&&(gt=V-ct),ht.width=this.contrastSize(gt,v,m),this.layoutBoxUpdate(ht,i,0)}if(e==j&&(o.style.flex||!this.attributes.lines)){var vt=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e>ht.width?(vt++,e):t+e}),0)})),vt=M&&vt>M?M:vt,this.attributes.lines=vt}if(e==W&&null==S){var mt=n.width,bt=n.height;ht.height=this.contrastSize(x(ht.width*bt/mt)||0,b,y),this.layoutBoxUpdate(ht,i,1)}e==j&&null==S&&(O=x(O,k),ht.height=this.contrastSize(x(this.attributes.lines*O),b,y),this.layoutBoxUpdate(ht,i,1,!0)),o&&o.children&&V&&([D,j].includes(e)&&this.isFlex()||e==D&&this.isBlock(this)&&this.isInFlow())&&(ht.width=this.contrastSize(V-ct,v,m),this.layoutBoxUpdate(ht,i)),g&&!L(g)&&(ht.width=this.contrastSize(g,v,m),this.layoutBoxUpdate(ht,i,0)),S&&!L(S)&&(ht.height=this.contrastSize(ht.height,b,y),this.layoutBoxUpdate(ht,i,1));var yt=0;if(s.length){var wt=null;s.forEach((function(e,n){e.getBoxWidthHeight();var r=s[n+1];if(r&&r.isInFlow()&&(e.next=r),e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(wt,e);t.line&&t.line.canIEnter(e)&&!o?t.line.add(e):(new E).bind(e),wt=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new _).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new E).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new E).fixedBind(e,1)})),this.lines&&(yt=this.lines.reduce((function(t,e){return t+e.height}),0))}var xt=0,St=0;if(!g&&(this.isAbsolute||this.isFixed)&&V){var Pt=I==$?V:this.root.width,kt=Pt-(L(c)?x(c,Pt):c)-(L(l)?x(l,Pt):l);xt=i.left?kt:this.lineMaxWidth}if(!S&&(null!=d?d:this.isAbsolute||this.isFixed&&Q)){var Tt=I==$?Q:this.root.height,Bt=Tt-(L(d)?x(d,Tt):d)-(L(f)?x(f,Tt):f);St=i.top?Bt:0}if(g&&!L(g)||ht.width||(ht.width=xt||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?V||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,m),this.layoutBoxUpdate(ht,i,0)),S||!yt&&!St||(ht.height=St||this.contrastSize(yt,b,y),this.layoutBoxUpdate(ht,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var Z in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,Z)&&(i.borderRadius[Z]=x(i.borderRadius[Z],this.borderSize.width));return this.layoutBox},i.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.getBoxPosition2(),this.offsetSize},e}(),G=function(){var e,i,n,r,o,a,s=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],h=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],c=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],u=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],d=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],f=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],l=[],p=[],g=[],v=[],m=[],b=2;function y(t,e){var i;t>e&&(i=t,t=e,e=i),i=e,i*=e,i+=e,i>>=1,v[i+=t]=1}function w(t,e){var n;for(g[t+i*e]=1,n=-2;n<2;n++)g[t+n+i*(e-2)]=1,g[t-2+i*(e+n+1)]=1,g[t+2+i*(e+n)]=1,g[t+n+1+i*(e+2)]=1;for(n=0;n<2;n++)y(t-1,e+n),y(t+1,e-n),y(t-n,e-1),y(t+n,e+1)}function x(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t}var S=[];function P(t,e,i,n){var r,o,a;for(r=0;re&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,v[i+=t]}function T(t){var e,n,r,o;switch(t){case 0:for(n=0;n>1&1,e=0;e=5&&(i+=3+m[e]-5);for(e=3;et||3*m[e-3]>=4*m[e]||3*m[e+3]>=4*m[e])&&(i+=40);return i}function C(){var t,e,n,r,o,a=0,s=0;for(e=0;ei*i;)h-=i*i,c++;for(a+=10*c,t=0;t1)for(M=s[e],B=i-7;;){for(m=i-7;m>M-3&&(w(m,B),!(m6)for(M=h[e-7],I=17,m=0;m<6;m++)for(B=0;B<3;B++,I--)1&(I>11?e>>I-12:M>>I)?(g[5-m+i*(2-B+i-11)]=1,g[2-B+i-11+i*(5-m)]=1):(y(5-m,2-B+i-11),y(2-B+i-11,5-m));for(B=0;B=(m=o*(n+r)+r)-2&&(O=m-2,e>9&&O--),L=O,e>9){for(l[L+2]=0,l[L+3]=0;L--;)M=l[L],l[L+3]|=255&M<<4,l[L+2]=M>>4;l[2]|=255&O<<4,l[1]=O>>4,l[0]=64|O>>12}else{for(l[L+1]=0,l[L+2]=0;L--;)M=l[L],l[L+2]|=255&M<<4,l[L+1]=M>>4;l[1]|=255&O<<4,l[0]=64|O>>4}for(L=O+3-(e<10);L0;z--)S[z]=S[z]?S[z-1]^f[x(d[S[z]]+L)]:S[z-1];S[0]=f[x(d[S[0]]+L)]}for(L=0;L<=a;L++)S[L]=d[S[L]];for(I=m,B=0,L=0;L>=1)1&B&&(g[i-1-I+8*i]=1,I<6?g[8+i*I]=1:g[8+i*(I+1)]=1);for(I=0;I<7;I++,B>>=1)1&B&&(g[8+i*(i-7+I)]=1,I?g[6-I+8*i]=1:g[7+8*i]=1);return g}(t)},utf16to8:function(t){var e,i,n,r;for(e="",n=t.length,i=0;i=1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r>>0&63)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|r>>0&63));return e},draw:function(e,n,r,o,a){n.drawView(r,o);var s=n.ctx,h=r.contentSize,c=h.width,u=h.height,d=h.left,f=h.top;o.borderRadius,o.backgroundColor;var l=o.color,p=void 0===l?"#000000":l;if(o.border,r.contentSize.left,r.borderSize.left,r.contentSize.top,r.borderSize.top,b=a||b,s){s.save(),n.setOpacity(o),n.setTransform(r,o);var g=Math.min(c,u);e=this.utf16to8(e);var v=this.getFrame(e),m=g/i;s.setFillStyle(p);for(var y=0;y=360&&(a-=360),a<0&&(a+=360),0===(a=Math.round(a)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===a)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===a)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===a)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var s=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(a===s)return{x0:n,y0:i+r,x1:e+n,y1:r};if(a===180-s)return{x0:n,y0:r,x1:e+n,y1:i+r};if(a===180+s)return{x0:e+n,y0:r,x1:n,y1:i+r};if(a===360-s)return{x0:e+n,y0:i+r,x1:n,y1:r};var h,c=0,u=0,d=0,f=0;if(a180-s&&a<180||a>180&&a<180+s||a>360-s){var l=a*Math.PI/180,p=a360-s?i/2:-i/2,g=Math.tan(l)*p,v=a180-s&&a<180?e/2-g:-e/2-g;c=-(d=g+(h=Math.pow(Math.sin(l),2)*v)),u=-(f=p+h/Math.tan(l))}(a>s&&a<90||a>90&&a<90+s||a>180+s&&a<270||a>270&&a<360-s)&&(l=(90-a)*Math.PI/180,g=a>s&&a<90||a>90&&a<90+s?e/2:-e/2,p=Math.tan(l)*g,v=a>s&&a<90||a>270&&a<360-s?i/2-p:-i/2-p,c=-(d=g+(h=Math.pow(Math.sin(l),2)*v)/Math.tan(l)),u=-(f=p+h));return c=Math.round(c+e/2)+n,u=Math.round(i/2-u)+r,d=Math.round(d+e/2)+n,f=Math.round(i/2-f)+r,{x0:c,y0:u,x1:d,y1:f}}(r,t,e,i,n),s=a.x0,h=a.y0,c=a.x1,u=a.y1,d=o.createLinearGradient(s,h,c,u),f=r.match(/linear-gradient\((.+)\)/)[1],l=P(f.substring(f.indexOf(",")+1)),p=0;p=a||"cover"==n&&o=a)&&(s=e.width/i.width);var h=i.width*s,c=i.height*s,u=r||[],d=u[0],f=u[1],l=/^\d+px|rpx$/.test(d)?x(d,e.width):(e.width-h)*(S(d)?x(d,1):{left:0,center:.5,right:1}[d||"center"]),p=/^\d+px|rpx$/.test(f)?x(f,e.height):(e.height-c)*(S(f)?x(f,1):{top:0,center:.5,bottom:1}[f||"center"]),g=function(t,e){return[(t-l)/s,(e-p)/s]},v=g(0,0),m=v[0],b=v[1],y=g(e.width,e.height),w=y[0],P=y[1];return{sx:Math.max(m,0),sy:Math.max(b,0),sw:Math.min(w-m,i.width),sh:Math.min(P-b,i.height),dx:Math.max(l,0),dy:Math.max(p,0),dw:Math.min(h,e.width),dh:Math.min(c,e.height)}}({objectFit:l,objectPosition:v},e.contentSize,t),n=i.sx,o=i.sy,a=i.sh,s=i.sw,c=i.dx,u=i.dy,d=i.dh,f=i.dw;m==h.MP_BAIDU?r.drawImage(t.src,c+k,u+T,f,d,n,o,s,a):r.drawImage(t.src,n,o,s,a,c+k,u+T,f,d)}else r.drawImage(t.src,k,T,w,P)},M=function(){r.restore(),L.drawView(e,i,!1,!0,!1),o(1)},O=function(t){I(t),M()},O(t),[2]}))}))}))];case 1:return o.sent(),[2]}}))}))},e.prototype.drawText=function(t,e,i,n){var r=this.ctx,o=e.borderSize,a=e.contentSize,s=e.left,h=e.top,c=a.width,u=a.height,d=a.left-o.left,f=a.top-o.top,l=i.color,p=void 0===l?"#000000":l,g=i.lineHeight,v=void 0===g?"1.4em":g,m=i.fontSize,b=void 0===m?14:m,y=i.fontWeight,w=i.fontFamily,S=i.fontStyle,P=i.textAlign,k=void 0===P?"left":P,T=i.verticalAlign,B=void 0===T?Q:T,C=i.backgroundColor,I=i.lineClamp,M=i.backgroundClip,O=i.textShadow,L=i.textDecoration;if(this.drawView(e,i,M!=q),v=x(v,b),t){r.save(),this.setShadow({boxShadow:O}),s+=d,h+=f;var z=n.fontHeight,A=n.descent+n.ascent;switch(r.setFonts({fontFamily:w,fontSize:b,fontWeight:y,fontStyle:S}),r.setTextBaseline(A?Q:B),r.setTextAlign(k),M?this.setBackground(C,c,u,s,h):r.setFillStyle(p),k){case"left":break;case"center":s+=.5*c;break;case"right":s+=c}var E=n.lines*v,R=Math.ceil((u-E)/2);switch(R<0&&(R=0),B){case"top":break;case Q:h+=R;break;case"bottom":h+=2*R}var _=(v-z)/2,W=function(t){var e=r.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,o=e.actualBoundingBoxAscent;return"top"==B?{fix:A?void 0===o?0:o:0,lineY:A?2*_:_}:B==Q?{fix:A?v/2+n/4:v/2,lineY:(v-z)/2}:"bottom"==B?{fix:A?v-n:v+_,lineY:0}:{fix:0,height:0,lineY:0}},j=function(t,e,i){var o=t;switch(k){case"left":o+=i;break;case"center":o=(t-=i/2)+i;break;case"right":o=t,t-=i}if(L){r.setLineWidth(b/13),r.beginPath();var a=.1*n.fontHeight;/\bunderline\b/.test(L)&&(r.moveTo(t,e+a),r.lineTo(o,e+a)),/\boverline\b/.test(L)&&(A||(e-=_),r.moveTo(t,e-n.fontHeight-a),r.lineTo(o,e-n.fontHeight-a)),/\bline-through\b/.test(L)&&(r.moveTo(t,e-.5*n.fontHeight),r.lineTo(o,e-.5*n.fontHeight)),r.closePath(),r.setStrokeStyle(p),r.stroke()}};if(!n.widths||1==n.widths.length&&n.widths[0].total<=a.width){var D=W(t),F=D.fix,N=D.lineY;return r.fillText(t,s,h+F),j(s,(h+=v)-N,n&&n.widths&&n.widths[0].total||n.text),r.restore(),void this.setBorder(e,i)}for(var H=t.split(""),$=h,U=s,X="",Y=0,J=0;J<=H.length;J++){var G=H[J]||"",K="\n"===G,V=""==G,Z=X+(G=K?"":G),tt=r.measureText(Z).width;if(Y>=I)break;if(U=s,tt>a.width||K||V){if(Y++,X=V&&tt<=a.width?Z:X,Y===I&&tt>c){for(;r.measureText("".concat(X,"...")).width>a.width&&!(X.length<=1);)X=X.substring(0,X.length-1);X+="..."}var et=W(X);if(F=et.fix,N=et.lineY,r.fillText(X,U,h+F),j(U,(h+=v)-N,tt),X=G,h>$+u)break}else X=Z}r.restore()}},e.prototype.source=function(e){return a(this,void 0,void 0,(function(){var i,n,r,o=this;return s(this,(function(a){switch(a.label){case 0:if(this.node=null,i=+new Date,"{}"==JSON.stringify(e))return[2];if(!e.type)for(n in e.type=V,e.css=e.css||{},e)["views","children","type","css"].includes(n)||(e.css[n]=e[n],delete e[n]);return e.css&&!e.css.width&&(e.css||(e.css={})),[4,this.create(e)];case 1:return(r=a.sent())?(this.size=r.layout()||{},this.node=r,this.onEffectFinished().then((function(t){return o.lifecycle("onEffectSuccess",t)})).catch((function(t){return o.lifecycle("onEffectFail",t)})),t.log("布局用时:"+(+new Date-i)+"ms"),[2,this.size]):[2,t.warn("no node")]}}))}))},e.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},e.prototype.create=function(t,e){return a(this,void 0,void 0,(function(){var i,n,r,a,h,c,u,d,f,l,p,g,v,m,b,y,w;return s(this,(function(s){switch(s.label){case 0:if(i="image"==t.type,n=[q,K].includes(t.type),r=t.css||{},a=r.backgroundImage,h=r.display,i&&!t.src&&!t.url||n&&!t.text)return[2];if("none"==h)return[2];if(n&&(t.text=String(t.text)),!(i||t.type==V&&a))return[3,4];c=i?t.src:"",u=/url\((.+)\)/.exec(a),a&&u&&u[1]&&(c=u[1]||""),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.getImageInfo(c)];case 2:return d=s.sent(),f=d.width,l=d.height,!(p=d.path)&&i?[2]:(p&&(t.attributes=Object.assign(t.attributes||{},{width:f,height:l,path:p,src:p,naturalSrc:c})),[3,4]);case 3:return g=s.sent(),t.type!=V?[2]:(this.lifecycle("onEffectFail",o(o({},g),{src:c})),[3,4]);case 4:if(this.count+=1,v=new J(t,e,this.root,this.ctx),!(m=t.views||t.children))return[3,8];b=0,s.label=5;case 5:return b