text: !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("Vue"));else if("function"==typeof define&&define.amd)define(["Vue"],e);else{var r="object"==typeof exports?e(require("Vue")):e(t.Vue);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/wya-vc/dist/",r(r.s="./temp/imgs-processing/basic.js")}({"./node_modules/@babel/runtime/helpers/classCallCheck.js":function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},"./node_modules/@babel/runtime/helpers/createClass.js":function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},"./node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js":function(t,e,r){var n=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){var o=e&&e.prototype instanceof g?e:g,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n=l;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===p)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var c=s(t,e,r);if("normal"===c.type){if(n=r.done?d:f,c.arg===p)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=d,r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l="suspendedStart",f="suspendedYield",h="executing",d="completed",p={};function g(){}function m(){}function v(){}var y={};y[i]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(S([])));b&&b!==r&&n.call(b,i)&&(y=b);var _=v.prototype=g.prototype=Object.create(y);function x(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function j(t){var e;this._invoke=function(r,o){function i(){return new Promise((function(e,i){!function e(r,o,i,a){var u=s(t[r],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then((function(t){e("next",t,i,a)}),(function(t){e("throw",t,i,a)})):Promise.resolve(l).then((function(t){c.value=t,i(c)}),(function(t){return e("throw",t,i,a)}))}a(u.arg)}(r,o,e,i)}))}return e=e?e.then(i,i):i()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return p;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var o=s(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function S(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:k}}function k(){return{value:e,done:!0}}return m.prototype=_.constructor=v,v.constructor=m,v[u]=m.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(_),t},t.awrap=function(t){return{__await:t}},x(j.prototype),j.prototype[a]=function(){return this},t.AsyncIterator=j,t.async=function(e,r,n,o){var i=new j(c(e,r,n,o));return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},x(_),_[u]="Generator",_[i]=function(){return this},_.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:S(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),p}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},"./node_modules/@babel/runtime/regenerator/index.js":function(t,e,r){t.exports=r("./node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js")},"./node_modules/vue-loader/lib/runtime/componentNormalizer.js":function(t,e,r){"use strict";function n(t,e,r,n,o,i,a,u){var c,s="function"==typeof t?t.options:t;if(e&&(s.render=e,s.staticRenderFns=r,s._compiled=!0),n&&(s.functional=!0),i&&(s._scopeId="data-v-"+i),a?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},s._ssrRegister=c):o&&(c=u?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(s.functional){s._injectStyles=c;var l=s.render;s.render=function(t,e){return c.call(e),l(t,e)}}else{var f=s.beforeCreate;s.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:s}}r.d(e,"a",(function(){return n}))},"./src/imgs-processing/index.js":function(t,e,r){"use strict";var n=r("./node_modules/@babel/runtime/helpers/classCallCheck.js"),o=r.n(n),i=r("./node_modules/@babel/runtime/helpers/createClass.js"),a=r.n(i),u=function(){function t(){o()(this,t)}return a()(t,[{key:"picker",value:function(t,e){}}],[{key:"getImageData",value:function(t){var e=t.context,r=t.dataSource,n=t.width,o=t.height;if(!(e&&e instanceof CanvasRenderingContext2D))throw new Error("【wya-process】需要传入 CanvasRenderingContext2D 对象");return new Promise((function(t,i){var a=new Image;a.crossOrigin="anonymous",a.onload=function(){e.drawImage(a,0,0,n,o),t(e.getImageData(0,0,n,o))},a.onerror=function(t){console.error(t)},a.src=r}))}},{key:"cutout",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.tolerance,n=e.cutoutColor,o=0;o<t.data.length;o+=4){var i=t.data[o],a=t.data[o+1],u=t.data[o+2];Math.sqrt((i-n[0])*(i-n[0])+(a-n[1])*(a-n[1])+(u-n[2])*(u-n[2]))<=r?(t.data[o]=0,t.data[o+1]=0,t.data[o+2]=0,t.data[o+3]=0):(t.data[o]=i,t.data[o+1]=a,t.data[o+2]=u,t.data[o+3]=t.data[o+3])}return t}},{key:"gray",value:function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var e=0;e<t.data.length;e+=4){var r=t.data[e],n=t.data[e+1],o=t.data[e+2],i=parseInt((r+n+o)/3,10);t.data[e]=i,t.data[e+1]=i,t.data[e+2]=i}return t}}]),t}(),c=r("./node_modules/@babel/runtime/regenerator/index.js"),s=r.n(c),l={name:"vc-imgs-processing",props:{dataSource:[String],width:{type:Number,default:100},height:{type:Number,default:100},processing:{type:[String,Function],required:!0,validator:function(t){return"string"!=typeof t||["cutout","gray"].includes(t)}},cutoutColor:{type:Array,default:function(){return[0,0,0,1]}},tolerance:{type:Number,default:0}},data:function(){return{}},computed:{},watch:{dataSource:function(t){this.processImage(t)}},mounted:function(){this.processImage(this.dataSource)},methods:{processImage:function(t){var e,r;return s.a.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=this.$el.getContext("2d"),n.next=3,s.a.awrap(u.getImageData({context:e,dataSource:t,width:this.width,height:this.height}));case 3:this.imageData=n.sent,r="string"==typeof this.processing?u[this.processing](this.imageData,{cutoutColor:this.cutoutColor,tolerance:this.tolerance}):this.processing(this.imageData),e.putImageData(r,0,0);case 6:case"end":return n.stop()}}),null,this)}}},f=r("./node_modules/vue-loader/lib/runtime/componentNormalizer.js"),h=Object(f.a)(l,(function(){var t=this.$createElement;return(this._self._c||t)("canvas",{attrs:{width:this.width,height:this.height}})}),[],!1,null,null,null).exports;h.Func=u;e.a=h},"./temp/imgs-processing/basic.js":function(t,e,r){"use strict";r.r(e);var n=r("vue"),o=r.n(n),i={name:"vc-imgs-processing-basic",components:{"vc-imgs-processing":r("./src/imgs-processing/index.js").a},data:function(){return{img:"https://wyatest.oss-cn-hangzhou.aliyuncs.com/image/172/20190812/112918/微信图片_20190624213255.jpg"}},computed:{},methods:{}},a=r("./node_modules/vue-loader/lib/runtime/componentNormalizer.js"),u=Object(a.a)(i,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"20px"}},[r("h1",[t._v("图像处理")]),t._v(" "),r("h3",[t._v("原图")]),t._v(" "),r("img",{attrs:{src:t.img,width:"100",height:"100"}}),t._v(" "),r("h3",[t._v("扣掉指定颜色")]),t._v(" "),r("vc-imgs-processing",{attrs:{"data-source":t.img,tolerance:90,"cutout-color":[255,237,113,1],processing:"cutout"}}),t._v(" "),r("h3",[t._v("置灰")]),t._v(" "),r("vc-imgs-processing",{attrs:{"data-source":t.img,processing:"gray"}})],1)}),[],!1,null,null,null).exports;o.a.config.devtools=!0;var c=new o.a({el:"#pages",components:{App:u},template:"<App />"});window.app=c},vue:function(e,r){e.exports=t}})}));