You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
53 KiB

1 year ago
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Painter={})}(this,(function(t){"use strict";var e=function(){return e=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};function i(t,e,i,n){return new(i||(i=Promise))((function(o,r){function s(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))}function n(t,e){var i,n,o,r,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(o=2&r[0]?n.return:r[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;switch(n=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,n=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){s.label=r[1];break}if(6===r[0]&&s.label<o[1]){s.label=o[1],o=r;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(r);break}o[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],n=0}finally{i=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}}var o,r,s={MP_WEIXIN:"mp-weixin",MP_QQ:"mp-qq",MP_ALIPAY:"mp-alipay",MP_BAIDU:"mp-baidu",MP_TOUTIAO:"mp-toutiao",MP_DINGDING:"mp-dingding",H5:"h5",WEB:"web",PLUS:"plus"},a=["contentSize","clientSize","borderSize","offsetSize"],h="row",d="column",c="top",l="middle",f="bottom",u="left",p="center",g="right",v="view",y="text",b="image",x="qrcode",m="block",w="inline-block",S="none",z="flex",M="absolute",B="fixed",I="transparent",k="fill",P={display:m,color:"#000000",lineHeight:"1.4em",fontSize:14,fontWeight:400,fontFamily:"sans-serif",lineCap:"butt",flexDirection:h,flexWrap:"nowrap",textAlign:"left",alignItems:"flex-start",justifyContent:"flex-start",position:"static",transformOrigin:"center center"},W={upx2px:function(t){return window.innerWidth/750*t},getSystemInfoSync:function(){return{screenWidth:window.innerWidth}},getImageInfo:function(t){var e=t.src,i=t.success,n=t.fail,o=new Image;o.onload=function(){i({width:this.naturalWidth,height:this.naturalHeight,path:this.src,src:e})},o.onerror=n,o.src=e}},R="object",O="undefined",T=typeof window==R?typeof uni==O||typeof uni!==O&&!uni.addInterceptor?s.WEB:s.H5:typeof swan==R?s.MP_BAIDU:typeof tt==R?s.MP_TOUTIAO:typeof plus===R?s.PLUS:typeof wx==R?s.MP_WEIXIN:void 0,L=T==s.MP_WEIXIN?wx:typeof uni!=O?uni.getImageInfo?{upx2px:function(t){return uni.upx2px(t)},getSystemInfoSync:function(){return uni.getSystemInfoSync()},getImageInfo:function(t){return uni.getImageInfo(t)},downloadFile:function(t){return uni.downloadFile(t)}}:Object.assign(uni,W):typeof window!=O?W:uni;if(!L.upx2px){var A=(null!==(r=L.getSystemInfoSync&&(null===(o=uni.getSystemInfoSync())||void 0===o?void 0:o.screenWidth))&&void 0!==r?r:375)/750;L.upx2px=function(t){return A*t}}function F(t){return/^-?\d+(\.\d+)?$/.test(t)}function j(t,e,i){if("number"==typeof t)return t;if(F(t))return 1*t;if("string"==typeof t){var n=/^-?([0-9]+)?([.]{1}[0-9]+){0,1}(em|rpx|px|%)$/g.exec(t);if(!t||!n)return 0;var o=n[3];t=parseFloat(t);var r=0;return"rpx"===o?r=L.upx2px(t):"px"===o?r=1*t:"%"===o&&e?r=t*j(e)/100:"em"===o&&e&&(r=t*j(e||14)),1*r.toFixed(2)}return 0}function C(t){return/%$/.test(t)}var E=function(t){return!(!t||!t.startsWith("linear")&&!t.startsWith("radial"))},H=function(t,e,i,n,o,r){t.startsWith("linear")?function(t,e,i,n,o,r){for(var s=function