@puckwang/vue-slot-machine
Version:
A Vue component of a slot machine, made with an HTML5 canvas, RWD.
1 lines • 183 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.VueSlotMachine={})}(this,function(t){"use strict";function e(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t,e){return t(e={exports:{}},e.exports),e.exports}var o=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var r=Math.PI/180;var n=function(t){var e=t.indexOf("msie ");if(e>0)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(t.indexOf("trident/")>0){var i=t.indexOf("rv:");return parseInt(t.substring(i+3,t.indexOf(".",i)),10)}var r=t.indexOf("edge/");return r>0&&parseInt(t.substring(r+5,t.indexOf(".",r)),10)};e._parseUA=function(t){var e=t.toLowerCase(),i=/(chrome)[ /]([\w.]+)/.exec(e)||/(webkit)[ /]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ /]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[],r=!!t.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i),o=!!t.match(/IEMobile/i);return{browser:i[1]||"",version:i[2]||"0",isIE:n(e),mobile:r,ieMobile:o}},e.glob=void 0!==i?i:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},e.Konva={version:"3.2.5",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle:function(t){return e.Konva.angleDeg?t*r:t},enableTrace:!1,listenClickTap:!1,inDblClickWindow:!1,pixelRatio:void 0,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:function(){return e.Konva.DD.isDragging},isDragReady:function(){return!!e.Konva.DD.node},UA:e._parseUA(e.glob.navigator&&e.glob.navigator.userAgent||""),document:e.glob.document,_injectGlobal:function(t){e.glob.Konva=t},_parseUA:e._parseUA},e._NODES_REGISTRY={},e._registerNode=function(t){e._NODES_REGISTRY[t.prototype.getClassName()]=t,e.Konva[t.prototype.getClassName()]=t}});r(o);o._parseUA,o.glob,o.Konva,o._NODES_REGISTRY,o._registerNode;var a=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(){}return t.toCollection=function(e){var i,r=new t,n=e.length;for(i=0;i<n;i++)r.push(e[i]);return r},t._mapMethod=function(e){t.prototype[e]=function(){var t,i=this.length,r=[].slice.call(arguments);for(t=0;t<i;t++)this[t][e].apply(this[t],r);return this}},t.mapMethods=function(e){var i=e.prototype;for(var r in i)t._mapMethod(r)},t}();e.Collection=i,i.prototype=[],i.prototype.each=function(t){for(var e=0;e<this.length;e++)t(this[e],e)},i.prototype.toArray=function(){var t,e=[],i=this.length;for(t=0;t<i;t++)e.push(this[t]);return e};var r=function(){function t(t){void 0===t&&(t=[1,0,0,1,0,0]),this.m=t&&t.slice()||[1,0,0,1,0,0]}return t.prototype.copy=function(){return new t(this.m)},t.prototype.point=function(t){var e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}},t.prototype.translate=function(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this},t.prototype.scale=function(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.m[0]*e+this.m[2]*i,n=this.m[1]*e+this.m[3]*i,o=this.m[0]*-i+this.m[2]*e,a=this.m[1]*-i+this.m[3]*e;return this.m[0]=r,this.m[1]=n,this.m[2]=o,this.m[3]=a,this},t.prototype.getTranslation=function(){return{x:this.m[4],y:this.m[5]}},t.prototype.skew=function(t,e){var i=this.m[0]+this.m[2]*e,r=this.m[1]+this.m[3]*e,n=this.m[2]+this.m[0]*t,o=this.m[3]+this.m[1]*t;return this.m[0]=i,this.m[1]=r,this.m[2]=n,this.m[3]=o,this},t.prototype.multiply=function(t){var e=this.m[0]*t.m[0]+this.m[2]*t.m[1],i=this.m[1]*t.m[0]+this.m[3]*t.m[1],r=this.m[0]*t.m[2]+this.m[2]*t.m[3],n=this.m[1]*t.m[2]+this.m[3]*t.m[3],o=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=i,this.m[2]=r,this.m[3]=n,this.m[4]=o,this.m[5]=a,this},t.prototype.invert=function(){var t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,i=-this.m[1]*t,r=-this.m[2]*t,n=this.m[0]*t,o=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=i,this.m[2]=r,this.m[3]=n,this.m[4]=o,this.m[5]=a,this},t.prototype.getMatrix=function(){return this.m},t.prototype.setAbsolutePosition=function(t,e){var i=this.m[0],r=this.m[1],n=this.m[2],o=this.m[3],a=this.m[4],s=(i*(e-this.m[5])-r*(t-a))/(i*o-r*n),h=(t-a-n*s)/i;return this.translate(h,s)},t}();e.Transform=r;var n=Math.PI/180,a=180/Math.PI,s={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},h=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,c=[];e.Util={_isElement:function(t){return!(!t||1!=t.nodeType)},_isFunction:function(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject:function(t){return!!t&&t.constructor===Object},_isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},_isNumber:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&!isNaN(t)&&isFinite(t)},_isString:function(t){return"[object String]"===Object.prototype.toString.call(t)},_isBoolean:function(t){return"[object Boolean]"===Object.prototype.toString.call(t)},isObject:function(t){return t instanceof Object},isValidSelector:function(t){if("string"!=typeof t)return!1;var e=t[0];return"#"===e||"."===e||e===e.toUpperCase()},_sign:function(t){return 0===t?0:t>0?1:-1},requestAnimFrame:function(t){c.push(t),1===c.length&&requestAnimationFrame(function(){var t=c;c=[],t.forEach(function(t){t()})})},createCanvasElement:function(){var t=document.createElement("canvas");try{t.style=t.style||{}}catch(t){}return t},createImageElement:function(){return document.createElement("img")},_isInDocument:function(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_simplifyArray:function(t){var i,r,n=[],o=t.length,a=e.Util;for(i=0;i<o;i++)r=t[i],a._isNumber(r)?r=Math.round(1e3*r)/1e3:a._isString(r)||(r=r.toString()),n.push(r);return n},_urlToImage:function(t,e){var i=new o.glob.Image;i.onload=function(){e(i)},i.src=t},_rgbToHex:function(t,e,i){return((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},_hexToRgb:function(t){t=t.replace("#","");var e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:255&e}},getRandomColor:function(){for(var t=(16777215*Math.random()<<0).toString(16);t.length<6;)t="0"+t;return"#"+t},get:function(t,e){return void 0===t?e:t},getRGB:function(t){var e;return t in s?{r:(e=s[t])[0],g:e[1],b:e[2]}:"#"===t[0]?this._hexToRgb(t.substring(1)):"rgb("===t.substr(0,4)?(e=h.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA:function(t){return t=t||"black",e.Util._namedColorToRBA(t)||e.Util._hex3ColorToRGBA(t)||e.Util._hex6ColorToRGBA(t)||e.Util._rgbColorToRGBA(t)||e.Util._rgbaColorToRGBA(t)},_namedColorToRBA:function(t){var e=s[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA:function(t){if(0===t.indexOf("rgb(")){var e=(t=t.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA:function(t){if(0===t.indexOf("rgba(")){var e=(t=t.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex6ColorToRGBA:function(t){if("#"===t[0]&&7===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex3ColorToRGBA:function(t){if("#"===t[0]&&4===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},haveIntersection:function(t,e){return!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y)},cloneObject:function(t){var e={};for(var i in t)this._isPlainObject(t[i])?e[i]=this.cloneObject(t[i]):this._isArray(t[i])?e[i]=this.cloneArray(t[i]):e[i]=t[i];return e},cloneArray:function(t){return t.slice(0)},_degToRad:function(t){return t*n},_radToDeg:function(t){return t*a},_capitalize:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},throw:function(t){throw new Error("Konva error: "+t)},error:function(t){console.error("Konva error: "+t)},warn:function(t){o.Konva.showWarnings&&console.warn("Konva warning: "+t)},extend:function(t,e){function i(){this.constructor=t}i.prototype=e.prototype;var r=t.prototype;for(var n in t.prototype=new i,r)r.hasOwnProperty(n)&&(t.prototype[n]=r[n]);t.__super__=e.prototype,t.super=e},_getControlPoints:function(t,e,i,r,n,o,a){var s=Math.sqrt(Math.pow(i-t,2)+Math.pow(r-e,2)),h=Math.sqrt(Math.pow(n-i,2)+Math.pow(o-r,2)),c=a*s/(s+h),l=a*h/(s+h);return[i-c*(n-t),r-c*(o-e),i+l*(n-t),r+l*(o-e)]},_expandPoints:function(t,i){var r,n,o=t.length,a=[];for(r=2;r<o-2;r+=2)n=e.Util._getControlPoints(t[r-2],t[r-1],t[r],t[r+1],t[r+2],t[r+3],i),a.push(n[0]),a.push(n[1]),a.push(t[r]),a.push(t[r+1]),a.push(n[2]),a.push(n[3]);return a},each:function(t,e){for(var i in t)e(i,t[i])},_inRange:function(t,e,i){return e<=t&&t<i},_getProjectionToSegment:function(t,e,i,r,n,o){var a,s,h,c=(t-i)*(t-i)+(e-r)*(e-r);if(0==c)a=t,s=e,h=(n-i)*(n-i)+(o-r)*(o-r);else{var l=((n-t)*(i-t)+(o-e)*(r-e))/c;l<0?(a=t,s=e,h=(t-n)*(t-n)+(e-o)*(e-o)):l>1?(a=i,s=r,h=(i-n)*(i-n)+(r-o)*(r-o)):h=((a=t+l*(i-t))-n)*(a-n)+((s=e+l*(r-e))-o)*(s-o)}return[a,s,h]},_getProjectionToLine:function(t,i,r){var n=e.Util.cloneObject(t),o=Number.MAX_VALUE;return i.forEach(function(a,s){if(r||s!==i.length-1){var h=i[(s+1)%i.length],c=e.Util._getProjectionToSegment(a.x,a.y,h.x,h.y,t.x,t.y),l=c[0],d=c[1],u=c[2];u<o&&(n.x=l,n.y=d,o=u)}}),n},_prepareArrayForTween:function(t,i,r){var n,o=[],a=[];if(t.length>i.length){var s=i;i=t,t=s}for(n=0;n<t.length;n+=2)o.push({x:t[n],y:t[n+1]});for(n=0;n<i.length;n+=2)a.push({x:i[n],y:i[n+1]});var h=[];return a.forEach(function(t){var i=e.Util._getProjectionToLine(t,o,r);h.push(i.x),h.push(i.y)}),h},_prepareToStringify:function(t){var i;for(var r in t.visitedByCircularReferenceRemoval=!0,t)if(t.hasOwnProperty(r)&&t[r]&&"object"==typeof t[r])if(i=Object.getOwnPropertyDescriptor(t,r),t[r].visitedByCircularReferenceRemoval||e.Util._isElement(t[r])){if(!i.configurable)return null;delete t[r]}else if(null===e.Util._prepareToStringify(t[r])){if(!i.configurable)return null;delete t[r]}return delete t.visitedByCircularReferenceRemoval,t},_assign:function(t,e){for(var i in e)t[i]=e[i];return t}}});r(a);a.Collection,a.Transform,a.Util;var s=n(function(t,e){function i(t){return a.Util._isString(t)?'"'+t+'"':"[object Number]"===Object.prototype.toString.call(t)?t:a.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.RGBComponent=function(t){return t>255?255:t<0?0:Math.round(t)},e.alphaComponent=function(t){return t>1?1:t<1e-4?1e-4:t},e.getNumberValidator=function(){if(o.Konva.isUnminified)return function(t,e){return a.Util._isNumber(t)||a.Util.warn(i(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}},e.getNumberOrAutoValidator=function(){if(o.Konva.isUnminified)return function(t,e){return a.Util._isNumber(t)||"auto"===t||a.Util.warn(i(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}},e.getStringValidator=function(){if(o.Konva.isUnminified)return function(t,e){return a.Util._isString(t)||a.Util.warn(i(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}},e.getFunctionValidator=function(){if(o.Konva.isUnminified)return function(t,e){return a.Util._isFunction(t)||a.Util.warn(i(t)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),t}},e.getNumberArrayValidator=function(){if(o.Konva.isUnminified)return function(t,e){return a.Util._isArray(t)?t.forEach(function(t){a.Util._isNumber(t)||a.Util.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")}):a.Util.warn(i(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.'),t}},e.getBooleanValidator=function(){if(o.Konva.isUnminified)return function(t,e){return!0===t||!1===t||a.Util.warn(i(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}},e.getComponentValidator=function(t){if(o.Konva.isUnminified)return function(e,r){return a.Util.isObject(e)||a.Util.warn(i(e)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+t),e}}});r(s);s.RGBComponent,s.alphaComponent,s.getNumberValidator,s.getNumberOrAutoValidator,s.getStringValidator,s.getFunctionValidator,s.getNumberArrayValidator,s.getBooleanValidator,s.getComponentValidator;var h=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});e.Factory={addGetterSetter:function(t,e,i,r,n){this.addGetter(t,e,i),this.addSetter(t,e,r,n),this.addOverloadedGetterSetter(t,e)},addGetter:function(t,e,i){var r="get"+a.Util._capitalize(e);t.prototype[r]=t.prototype[r]||function(){var t=this.attrs[e];return void 0===t?i:t}},addSetter:function(t,i,r,n){var o="set"+a.Util._capitalize(i);t.prototype[o]||e.Factory.overWriteSetter(t,i,r,n)},overWriteSetter:function(t,e,i,r){var n="set"+a.Util._capitalize(e);t.prototype[n]=function(t){return i&&null!=t&&(t=i.call(this,t,e)),this._setAttr(e,t),r&&r.call(this),this}},addComponentsGetterSetter:function(t,e,i,r,n){var o,h,c=i.length,l=a.Util._capitalize,d="get"+l(e),u="set"+l(e);t.prototype[d]=function(){var t={};for(o=0;o<c;o++)t[h=i[o]]=this.getAttr(e+l(h));return t};var p=s.getComponentValidator(i);t.prototype[u]=function(t){var i,o=this.attrs[e];for(i in r&&(t=r.call(this,t)),p&&p.call(this,t,e),t)t.hasOwnProperty(i)&&this._setAttr(e+l(i),t[i]);return this._fireChangeEvent(e,o,t),n&&n.call(this),this},this.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter:function(t,e){var i=a.Util._capitalize(e),r="set"+i,n="get"+i;t.prototype[e]=function(){return arguments.length?(this[r](arguments[0]),this):this[n]()}},addDeprecatedGetterSetter:function(t,e,i,r){a.Util.error("Adding deprecated "+e);var n="get"+a.Util._capitalize(e),o=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[n]=function(){a.Util.error(o);var t=this.attrs[e];return void 0===t?i:t},this.addSetter(t,e,r,function(){a.Util.error(o)}),this.addOverloadedGetterSetter(t,e)},backCompat:function(t,e){a.Util.each(e,function(e,i){var r=t.prototype[i],n="get"+a.Util._capitalize(e),o="set"+a.Util._capitalize(e);function s(){r.apply(this,arguments),a.Util.error('"'+e+'" method is deprecated and will be removed soon. Use ""'+i+'" instead.')}t.prototype[e]=s,t.prototype[n]=s,t.prototype[o]=s})},afterSetFilter:function(){this._filterUpToDate=!1}}});r(h);h.Factory;var c=n(function(t,e){var r,n=i&&i.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var s=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],h=function(){function t(t){this.canvas=t,this._context=t._canvas.getContext("2d"),o.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}return t.prototype.fillShape=function(t){t.getFillEnabled()&&this._fill(t)},t.prototype._fill=function(t){},t.prototype.strokeShape=function(t){t.getStrokeEnabled()&&this._stroke(t)},t.prototype._stroke=function(t){},t.prototype.fillStrokeShape=function(t){t.getFillEnabled()&&this._fill(t),t.getStrokeEnabled()&&this._stroke(t)},t.prototype.getTrace=function(t){var e,i,r,n,o=this.traceArr,s=o.length,h="";for(e=0;e<s;e++)(r=(i=o[e]).method)?(n=i.args,h+=r,t?h+="()":a.Util._isArray(n[0])?h+="(["+n.join(",")+"])":h+="("+n.join(",")+")"):(h+=i.property,t||(h+="="+i.val)),h+=";";return h},t.prototype.clearTrace=function(){this.traceArr=[]},t.prototype._trace=function(t){var e=this.traceArr;e.push(t),e.length>=100&&e.shift()},t.prototype.reset=function(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)},t.prototype.getCanvas=function(){return this.canvas},t.prototype.clear=function(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)},t.prototype._applyLineCap=function(t){var e=t.getLineCap();e&&this.setAttr("lineCap",e)},t.prototype._applyOpacity=function(t){var e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)},t.prototype._applyLineJoin=function(t){var e=t.getLineJoin();e&&this.setAttr("lineJoin",e)},t.prototype.setAttr=function(t,e){this._context[t]=e},t.prototype.arc=function(t,e,i,r,n,o){this._context.arc(t,e,i,r,n,o)},t.prototype.arcTo=function(t,e,i,r,n,o){this._context.arc(t,e,i,r,n,o)},t.prototype.beginPath=function(){this._context.beginPath()},t.prototype.bezierCurveTo=function(t,e,i,r,n,o){this._context.bezierCurveTo(t,e,i,r,n,o)},t.prototype.clearRect=function(t,e,i,r){this._context.clearRect(t,e,i,r)},t.prototype.clip=function(){this._context.clip()},t.prototype.closePath=function(){this._context.closePath()},t.prototype.createImageData=function(t,e){var i=arguments;return 2===i.length?this._context.createImageData(t,e):1===i.length?this._context.createImageData(t):void 0},t.prototype.createLinearGradient=function(t,e,i,r){return this._context.createLinearGradient(t,e,i,r)},t.prototype.createPattern=function(t,e){return this._context.createPattern(t,e)},t.prototype.createRadialGradient=function(t,e,i,r,n,o){return this._context.createRadialGradient(t,e,i,r,n,o)},t.prototype.drawImage=function(t,e,i,r,n,o,a,s,h){var c=arguments,l=this._context;3===c.length?l.drawImage(t,e,i):5===c.length?l.drawImage(t,e,i,r,n):9===c.length&&l.drawImage(t,e,i,r,n,o,a,s,h)},t.prototype.isPointInPath=function(t,e){return this._context.isPointInPath(t,e)},t.prototype.fill=function(){this._context.fill()},t.prototype.fillRect=function(t,e,i,r){this._context.fillRect(t,e,i,r)},t.prototype.strokeRect=function(t,e,i,r){this._context.strokeRect(t,e,i,r)},t.prototype.fillText=function(t,e,i){this._context.fillText(t,e,i)},t.prototype.measureText=function(t){return this._context.measureText(t)},t.prototype.getImageData=function(t,e,i,r){return this._context.getImageData(t,e,i,r)},t.prototype.lineTo=function(t,e){this._context.lineTo(t,e)},t.prototype.moveTo=function(t,e){this._context.moveTo(t,e)},t.prototype.rect=function(t,e,i,r){this._context.rect(t,e,i,r)},t.prototype.putImageData=function(t,e,i){this._context.putImageData(t,e,i)},t.prototype.quadraticCurveTo=function(t,e,i,r){this._context.quadraticCurveTo(t,e,i,r)},t.prototype.restore=function(){this._context.restore()},t.prototype.rotate=function(t){this._context.rotate(t)},t.prototype.save=function(){this._context.save()},t.prototype.scale=function(t,e){this._context.scale(t,e)},t.prototype.setLineDash=function(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)},t.prototype.getLineDash=function(){return this._context.getLineDash()},t.prototype.setTransform=function(t,e,i,r,n,o){this._context.setTransform(t,e,i,r,n,o)},t.prototype.stroke=function(){this._context.stroke()},t.prototype.strokeText=function(t,e,i,r){this._context.strokeText(t,e,i,r)},t.prototype.transform=function(t,e,i,r,n,o){this._context.transform(t,e,i,r,n,o)},t.prototype.translate=function(t,e){this._context.translate(t,e)},t.prototype._enableTrace=function(){var t,e,i=this,r=s.length,n=a.Util._simplifyArray,o=this.setAttr,h=function(t){var r,o=i[t];i[t]=function(){return e=n(Array.prototype.slice.call(arguments,0)),r=o.apply(i,arguments),i._trace({method:t,args:e}),r}};for(t=0;t<r;t++)h(s[t]);i.setAttr=function(){o.apply(i,arguments);var t=arguments[0],e=arguments[1];"shadowOffsetX"!==t&&"shadowOffsetY"!==t&&"shadowBlur"!==t||(e/=this.canvas.getPixelRatio()),i._trace({property:t,val:e})}},t.prototype._applyGlobalCompositeOperation=function(t){var e=t.getGlobalCompositeOperation();"source-over"!==e&&this.setAttr("globalCompositeOperation",e)},t}();e.Context=h,["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation"].forEach(function(t){Object.defineProperty(h.prototype,t,{get:function(){return this._context[t]},set:function(e){this._context[t]=e}})});var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._fillColor=function(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)},e.prototype._fillPattern=function(t){var e=t.getFillPatternX(),i=t.getFillPatternY(),r=t.getFillPatternScaleX(),n=t.getFillPatternScaleY(),a=o.Konva.getAngle(t.getFillPatternRotation()),s=t.getFillPatternOffsetX(),h=t.getFillPatternOffsetY();(e||i)&&this.translate(e||0,i||0),a&&this.rotate(a),(r||n)&&this.scale(r,n),(s||h)&&this.translate(-1*s,-1*h),this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)},e.prototype._fillLinearGradient=function(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))},e.prototype._fillRadialGradient=function(t){var e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))},e.prototype._fill=function(t){var e=t.fill(),i=t.getFillPriority();if(e&&"color"===i)this._fillColor(t);else{var r=t.getFillPatternImage();if(r&&"pattern"===i)this._fillPattern(t);else{var n=t.getFillLinearGradientColorStops();if(n&&"linear-gradient"===i)this._fillLinearGradient(t);else{var o=t.getFillRadialGradientColorStops();o&&"radial-gradient"===i?this._fillRadialGradient(t):e?this._fillColor(t):r?this._fillPattern(t):n?this._fillLinearGradient(t):o&&this._fillRadialGradient(t)}}}},e.prototype._strokeLinearGradient=function(t){var e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),n=this.createLinearGradient(e.x,e.y,i.x,i.y);if(r){for(var o=0;o<r.length;o+=2)n.addColorStop(r[o],r[o+1]);this.setAttr("strokeStyle",n)}},e.prototype._stroke=function(t){var e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore()}},e.prototype._applyShadow=function(t){var e=a.Util,i=e.get(t.getShadowRGBA(),"black"),r=e.get(t.getShadowBlur(),5),n=e.get(t.getShadowOffset(),{x:0,y:0}),o=t.getAbsoluteScale(),s=this.canvas.getPixelRatio(),h=o.x*s,c=o.y*s;this.setAttr("shadowColor",i),this.setAttr("shadowBlur",r*Math.min(Math.abs(h),Math.abs(c))),this.setAttr("shadowOffsetX",n.x*h),this.setAttr("shadowOffsetY",n.y*c)},e}(h);e.SceneContext=c;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype._fill=function(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()},e.prototype._stroke=function(t){if(t.hasStroke()&&t.hitStrokeWidth()){var e=t.getStrokeScaleEnabled();if(!e){this.save();var i=this.getCanvas().getPixelRatio();this.setTransform(i,0,0,i,0,0)}this._applyLineCap(t);var r=t.hitStrokeWidth(),n="auto"===r?t.strokeWidth():r;this.setAttr("lineWidth",n),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),e||this.restore()}},e}(h);e.HitContext=l});r(c);c.Context,c.SceneContext,c.HitContext;var l=n(function(t,e){var r,n,l=i&&i.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var d=function(){function t(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=(t||{}).pixelRatio||o.Konva.pixelRatio||function(){if(n)return n;var t=a.Util.createCanvasElement().getContext("2d");return n=(o.glob.window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}();this.pixelRatio=e,this._canvas=a.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}return t.prototype.getContext=function(){return this.context},t.prototype.getPixelRatio=function(){return this.pixelRatio},t.prototype.setPixelRatio=function(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)},t.prototype.setWidth=function(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)},t.prototype.setHeight=function(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)},t.prototype.getWidth=function(){return this.width},t.prototype.getHeight=function(){return this.height},t.prototype.setSize=function(t,e){this.setWidth(t),this.setHeight(e)},t.prototype.toDataURL=function(t,e){try{return this._canvas.toDataURL(t,e)}catch(t){try{return this._canvas.toDataURL()}catch(t){return a.Util.error("Unable to get data URL. "+t.message),""}}},t}();e.Canvas=d,h.Factory.addGetterSetter(d,"pixelRatio",void 0,s.getNumberValidator());var u=function(t){function e(e){void 0===e&&(e={width:0,height:0});var i=t.call(this,e)||this;return i.context=new c.SceneContext(i),i.setSize(e.width,e.height),i}return l(e,t),e}(d);e.SceneCanvas=u;var p=function(t){function e(e){void 0===e&&(e={width:0,height:0});var i=t.call(this,e)||this;return i.hitCanvas=!0,i.context=new c.HitContext(i),i.setSize(e.width,e.height),i}return l(e,t),e}(d);e.HitCanvas=p});r(l);l.Canvas,l.SceneCanvas,l.HitCanvas;var d=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var i=o.glob.performance&&o.glob.performance.now?function(){return o.glob.performance.now()}:function(){return(new Date).getTime()},r=function(){function t(e,r){this.id=t.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:i(),frameRate:0},this.func=e,this.setLayers(r)}return t.prototype.setLayers=function(t){var e=[];return e=t?t.length>0?t:[t]:[],this.layers=e,this},t.prototype.getLayers=function(){return this.layers},t.prototype.addLayer=function(t){var e,i=this.layers,r=i.length;for(e=0;e<r;e++)if(i[e]._id===t._id)return!1;return this.layers.push(t),!0},t.prototype.isRunning=function(){var e,i=t.animations,r=i.length;for(e=0;e<r;e++)if(i[e].id===this.id)return!0;return!1},t.prototype.start=function(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=i(),t._addAnimation(this),this},t.prototype.stop=function(){return t._removeAnimation(this),this},t.prototype._updateFrameObject=function(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff},t._addAnimation=function(t){this.animations.push(t),this._handleAnimation()},t._removeAnimation=function(t){var e,i=t.id,r=this.animations,n=r.length;for(e=0;e<n;e++)if(r[e].id===i){this.animations.splice(e,1);break}},t._runFrames=function(){var t,e,r,n,o,a,s,h,c={},l=this.animations;for(n=0;n<l.length;n++)if(e=(t=l[n]).layers,r=t.func,t._updateFrameObject(i()),a=e.length,!r||!1!==r.call(t,t.frame))for(o=0;o<a;o++)void 0!==(s=e[o])._id&&(c[s._id]=s);for(h in c)c.hasOwnProperty(h)&&c[h].draw()},t._animationLoop=function(){var e=t;e.animations.length?(e._runFrames(),requestAnimationFrame(e._animationLoop)):e.animRunning=!1},t._handleAnimation=function(){this.animRunning||(this.animRunning=!0,requestAnimationFrame(this._animationLoop))},t.animations=[],t.animIdCounter=0,t.animRunning=!1,t}();e.Animation=r});r(d);d.Animation;var u=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DD={startPointerPos:{x:0,y:0},anim:new d.Animation(function(){var t=this.dirty;return this.dirty=!1,t}),isDragging:!1,justDragged:!1,offset:{x:0,y:0},node:null,_drag:function(t){var i=e.DD.node;if(i){if(!e.DD.isDragging){var r=i.getStage().getPointerPosition();r||(i.getStage().setPointersPositions(t),r=i.getStage().getPointerPosition());var n=i.dragDistance();if(Math.max(Math.abs(r.x-e.DD.startPointerPos.x),Math.abs(r.y-e.DD.startPointerPos.y))<n)return}if(i.getStage().setPointersPositions(t),!e.DD.isDragging&&(e.DD.isDragging=!0,i.fire("dragstart",{type:"dragstart",target:i,evt:t},!0),!i.isDragging()))return;i._setDragPosition(t),i.fire("dragmove",{type:"dragmove",target:i,evt:t},!0)}},_endDragBefore:function(t){var i=e.DD.node;if(i){e.DD.anim.stop(),e.DD.isDragging&&(e.DD.isDragging=!1,e.DD.justDragged=!0,o.Konva.listenClickTap=!1,t&&(t.dragEndNode=i)),e.DD.node=null;var r=i.getLayer()||i instanceof o.Konva.Stage&&i;r&&r.draw()}},_endDragAfter:function(t){var e=(t=t||{}).dragEndNode;t&&e&&e.fire("dragend",{type:"dragend",target:e,evt:t},!0)}},o.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))});r(u);u.DD;var p=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ids={},e.names={};e._removeId=function(t,i){t&&e.ids[t]===i&&delete e.ids[t]},e._addName=function(t,i){i&&(e.names[i]||(e.names[i]=[]),e.names[i].push(t))},e._removeName=function(t,i){if(t){var r=e.names[t];if(r){for(var n=0;n<r.length;n++){r[n]._id===i&&r.splice(n,1)}0===r.length&&delete e.names[t]}}};var i="absoluteOpacity",r="absoluteTransform",n="absoluteScale",c="listening",d="Shape",p="transform",f="visible",g=["id"],y=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(" "),v=["scaleXChange.konva","scaleYChange.konva"].join(" "),_=new a.Collection,m=1,b=function(){function t(t){this._id=m++,this.eventListeners={},this.attrs={},this.index=0,this.parent=null,this._cache=new Map,this._lastPos=null,this._filterUpToDate=!1,this._isUnderCache=!1,this.children=_,this.setAttrs(t),this.on(y,function(){this._clearCache(p),this._clearSelfAndDescendantCache(r)}),this.on(v,function(){this._clearSelfAndDescendantCache(n)}),this.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(f)}),this.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(c)}),this.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(i)})}return t.prototype.hasChildren=function(){return!1},t.prototype.getChildren=function(){return _},t.prototype._clearCache=function(t){t?this._cache.delete(t):this._cache.clear()},t.prototype._getCache=function(t,e){var i=this._cache.get(t);return void 0===i&&(i=e.call(this),this._cache.set(t,i)),i},t.prototype._getCanvasCache=function(){return this._cache.get("canvas")},t.prototype._clearSelfAndDescendantCache=function(t){this._clearCache(t),this._getCanvasCache()||this.children&&this.children.each(function(e){e._clearSelfAndDescendantCache(t)})},t.prototype.clearCache=function(){return this._cache.delete("canvas"),this._clearSelfAndDescendantCache(),this},t.prototype.cache=function(t){var e=t||{},r={};void 0!==e.x&&void 0!==e.y&&void 0!==e.width&&void 0!==e.height||(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var o=e.width||r.width,s=e.height||r.height,h=e.pixelRatio,c=void 0===e.x?r.x:e.x,d=void 0===e.y?r.y:e.y,u=e.offset||0,p=e.drawBorder||!1;if(o&&s){o+=2*u,s+=2*u,c-=u,d-=u;var f=new l.SceneCanvas({pixelRatio:h,width:o,height:s}),g=new l.SceneCanvas({pixelRatio:h,width:o,height:s}),y=new l.HitCanvas({pixelRatio:1,width:o,height:s}),v=f.getContext(),_=y.getContext();return y.isCache=!0,this._cache.delete("canvas"),this._filterUpToDate=!1,v.save(),_.save(),v.translate(-c,-d),_.translate(-c,-d),this._isUnderCache=!0,this._clearSelfAndDescendantCache(i),this._clearSelfAndDescendantCache(n),this.drawScene(f,this,!0),this.drawHit(y,this,!0),this._isUnderCache=!1,v.restore(),_.restore(),p&&(v.save(),v.beginPath(),v.rect(0,0,o,s),v.closePath(),v.setAttr("strokeStyle","red"),v.setAttr("lineWidth",5),v.stroke(),v.restore()),this._cache.set("canvas",{scene:f,filter:g,hit:y,x:c,y:d}),this}a.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")},t.prototype.getClientRect=function(t){throw new Error('abstract "getClientRect" method call')},t.prototype._transformedRect=function(t,e){var i,r,n,o,a=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],s=this.getAbsoluteTransform(e);return a.forEach(function(t){var e=s.point(t);void 0===i&&(i=n=e.x,r=o=e.y),i=Math.min(i,e.x),r=Math.min(r,e.y),n=Math.max(n,e.x),o=Math.max(o,e.y)}),{x:i,y:r,width:n-i,height:o-r}},t.prototype._drawCachedSceneCanvas=function(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);var e=this._getCanvasCache();t.translate(e.x,e.y);var i=this._getCachedSceneCanvas(),r=i.pixelRatio;t.drawImage(i._canvas,0,0,i.width/r,i.height/r),t.restore()},t.prototype._drawCachedHitCanvas=function(t){var e=this._getCanvasCache(),i=e.hit;t.save(),t._applyGlobalCompositeOperation(this),t.translate(e.x,e.y),t.drawImage(i._canvas,0,0),t.restore()},t.prototype._getCachedSceneCanvas=function(){var t,e,i,r,n=this.filters(),o=this._getCanvasCache(),s=o.scene,h=o.filter,c=h.getContext();if(n){if(!this._filterUpToDate){var l=s.pixelRatio;try{for(t=n.length,c.clear(),c.drawImage(s._canvas,0,0,s.getWidth()/l,s.getHeight()/l),e=c.getImageData(0,0,h.getWidth(),h.getHeight()),i=0;i<t;i++)"function"==typeof(r=n[i])?(r.call(this,e),c.putImageData(e,0,0)):a.Util.error("Filter should be type of function, but got "+typeof r+" insted. Please check correct filters")}catch(t){a.Util.error("Unable to apply filter. "+t.message)}this._filterUpToDate=!0}return h}return s},t.prototype.on=function(t,e){if(3===arguments.length)return this._delegate.apply(this,arguments);var i,r,n,o,a=t.split(" "),s=a.length;for(i=0;i<s;i++)n=(r=a[i].split("."))[0],o=r[1]||"",this.eventListeners[n]||(this.eventListeners[n]=[]),this.eventListeners[n].push({name:o,handler:e});return this},t.prototype.off=function(t,e){var i,r,n,o,a,s=(t||"").split(" "),h=s.length;if(!t)for(r in this.eventListeners)this._off(r);for(i=0;i<h;i++)if(o=(n=s[i].split("."))[0],a=n[1],o)this.eventListeners[o]&&this._off(o,a,e);else for(r in this.eventListeners)this._off(r,a,e);return this},t.prototype.dispatchEvent=function(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this},t.prototype.addEventListener=function(t,e){return this.on(t,function(t){e.call(this,t.evt)}),this},t.prototype.removeEventListener=function(t){return this.off(t),this},t.prototype._delegate=function(t,e,i){var r=this;this.on(t,function(t){for(var n=t.target.findAncestors(e,!0,r),o=0;o<n.length;o++)(t=a.Util.cloneObject(t)).currentTarget=n[o],i.call(n[o],t)})},t.prototype.remove=function(){return u.DD.node&&u.DD.node===this&&this.stopDrag(),this._remove(),this},t.prototype._remove=function(){this._clearSelfAndDescendantCache("stage"),this._clearSelfAndDescendantCache(r),this._clearSelfAndDescendantCache(f),this._clearSelfAndDescendantCache(c),this._clearSelfAndDescendantCache(i);var t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)},t.prototype.destroy=function(){e._removeId(this.id(),this);for(var t=(this.name()||"").split(/\s/g),i=0;i<t.length;i++){var r=t[i];e._removeName(r,this._id)}return this.remove(),this},t.prototype.getAttr=function(t){var e="get"+a.Util._capitalize(t);return a.Util._isFunction(this[e])?this[e]():this.attrs[t]},t.prototype.getAncestors=function(){for(var t=this.getParent(),e=new a.Collection;t;)e.push(t),t=t.getParent();return e},t.prototype.getAttrs=function(){return this.attrs||{}},t.prototype.setAttrs=function(t){var e,i;if(!t)return this;for(e in t)"children"!==e&&(i="set"+a.Util._capitalize(e),a.Util._isFunction(this[i])?this[i](t[e]):this._setAttr(e,t[e]));return this},t.prototype.isListening=function(){return this._getCache(c,this._isListening)},t.prototype._isListening=function(){var t=this.listening(),e=this.getParent();return"inherit"===t?!e||e.isListening():t},t.prototype.isVisible=function(){return this._getCache(f,this._isVisible)},t.prototype._isVisible=function(t){var e=this.visible(),i=this.getParent();return"inherit"===e?!i||i===t||i._isVisible(t):e},t.prototype.shouldDrawHit=function(){var t=this.getLayer();return!t&&this.isListening()&&this.isVisible()||t&&t.hitGraphEnabled()&&this.isListening()&&this.isVisible()},t.prototype.show=function(){return this.visible(!0),this},t.prototype.hide=function(){return this.visible(!1),this},t.prototype.getZIndex=function(){return this.index||0},t.prototype.getAbsoluteZIndex=function(){var t,e,i,r,n=this.getDepth(),o=this,a=0;return"Stage"!==o.nodeType&&function s(h){for(t=[],e=h.length,i=0;i<e;i++)r=h[i],a++,r.nodeType!==d&&(t=t.concat(r.getChildren().toArray())),r._id===o._id&&(i=e);t.length>0&&t[0].getDepth()<=n&&s(t)}(o.getStage().getChildren()),a},t.prototype.getDepth=function(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t},t.prototype.setPosition=function(t){return this.x(t.x),this.y(t.y),this},t.prototype.getPosition=function(){return{x:this.x(),y:this.y()}},t.prototype.getAbsolutePosition=function(t){var e=this.getAbsoluteTransform(t).getMatrix(),i=new a.Transform,r=this.offset();return i.m=e.slice(),i.translate(r.x,r.y),i.getTranslation()},t.prototype.setAbsolutePosition=function(t){var e,i=this._clearTransform();return this.attrs.x=i.x,this.attrs.y=i.y,delete i.x,delete i.y,(e=this.getAbsoluteTransform()).invert(),e.translate(t.x,t.y),t={x:this.attrs.x+e.getTranslation().x,y:this.attrs.y+e.getTranslation().y},this.setPosition({x:t.x,y:t.y}),this._setTransform(i),this},t.prototype._setTransform=function(t){var e;for(e in t)this.attrs[e]=t[e];this._clearCache(p),this._clearSelfAndDescendantCache(r)},t.prototype._clearTransform=function(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,this._clearCache(p),this._clearSelfAndDescendantCache(r),t},t.prototype.move=function(t){var e=t.x,i=t.y,r=this.x(),n=this.y();return void 0!==e&&(r+=e),void 0!==i&&(n+=i),this.setPosition({x:r,y:n}),this},t.prototype._eachAncestorReverse=function(t,e){var i,r,n=[],o=this.getParent();if(e&&e._id===this._id)t(this);else{for(n.unshift(this);o&&(!e||o._id!==e._id);)n.unshift(o),o=o.parent;for(i=n.length,r=0;r<i;r++)t(n[r])}},t.prototype.rotate=function(t){return this.rotation(this.rotation()+t),this},t.prototype.moveToTop=function(){if(!this.parent)return a.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var t=this.index;return this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0},t.prototype.moveUp=function(){if(!this.parent)return a.Util.warn("Node has no parent. moveUp function is ignored."),!1;var t=this.index;return t<this.parent.getChildren().length-1&&(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0)},t.prototype.moveDown=function(){if(!this.parent)return a.Util.warn("Node has no parent. moveDown function is ignored."),!1;var t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0)},t.prototype.moveToBottom=function(){if(!this.parent)return a.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)},t.prototype.setZIndex=function(t){if(!this.parent)return a.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&a.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this},t.prototype.getAbsoluteOpacity=function(){return this._getCache(i,this._getAbsoluteOpacity)},t.prototype._getAbsoluteOpacity=function(){var t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=this.getParent().getAbsoluteOpacity()),t},t.prototype.moveTo=function(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this},t.prototype.toObject=function(){var t,e,i,r,n={},o=this.getAttrs();for(t in n.attrs={},o)e=o[t],a.Util.isObject(e)&&!a.Util._isPlainObject(e)&&!a.Util._isArray(e)||(i="function"==typeof this[t]&&this[t],delete o[t],r=i?i.call(this):null,o[t]=e,r!==e&&(n.attrs[t]=e));return n.className=this.getClassName(),a.Util._prepareToStringify(n)},t.prototype.toJSON=function(){return JSON.stringify(this.toObject())},t.prototype.getParent=function(){return this.parent},t.prototype.findAncestors=function(t,e,i){var r=[];e&&this._isMatch(t)&&r.push(this);for(var n=this.parent;n;){if(n===i)return r;n._isMatch(t)&&r.push(n),n=n.parent}return r},t.prototype.isAncestorOf=function(t){return!1},t.prototype.findAncestor=function(t,e,i){return this.findAncestors(t,e,i)[0]},t.prototype._isMatch=function(t){if(!t)return!1;if("function"==typeof t)return t(this);var e,i,r=t.replace(/ /g,"").split(","),n=r.length;for(e=0;e<n;e++)if(i=r[e],a.Util.isValidSelector(i)||(a.Util.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),a.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),a.Util.warn("Konva is awesome, right?")),"#"===i.charAt(0)){if(this.id()===i.slice(1))return!0}else if("."===i.charAt(0)){if(this.hasName(i.slice(1)))return!0}else if(this.className===t||this.nodeType===t)return!0;return!1},t.prototype.getLayer=function(){var t=this.getParent();return t?t.getLayer():null},t.prototype.getStage=function(){return this._getCache("stage",this._getStage)},t.prototype._getStage=function(){var t=this.getParent();return t?t.getStage():void 0},t.prototype.fire=function(t,e,i){return(e=e||{}).target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this},t.prototype.getAbsoluteTransform=function(t){return t?this._getAbsoluteTransform(t):this._getCache(r,this._getAbsoluteTransform)},t.prototype._getAbsoluteTransform=function(t){var e=new a.Transform;return this._eachAncestorReverse(function(t){var i=t.getTransformsEnabled();"all"===i?e.multiply(t.getTransform()):"position"===i&&e.translate(t.getX()-t.getOffsetX(),t.getY()-t.getOffsetY())},t),e},t.prototype.getAbsoluteScale=function(t){return t?this._getAbsoluteScale(t):this._getCache(n,this._getAbsoluteScale)},t.prototype._getAbsoluteScale=function(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();var i=1,r=1;return this._eachAncestorReverse(function(t){i*=t.scaleX(),r*=t.scaleY()},t),{x:i,y:r}},t.prototype.getTransform=function(){return this._getCache(p,this._getTransform)},t.prototype._getTransform=function(){var t=new a.Transform,e=this.x(),i=this.y(),r=o.Konva.getAngle(this.rotation()),n=this.scaleX(),s=this.scaleY(),h=this.skewX(),c=this.skewY(),l=this.offsetX(),d=this.offsetY();return 0===e&&0===i||t.translate(e,i),0!==r&&t.rotate(r),0===h&&0===c||t.skew(h,c),1===n&&1===s||t.scale(n,s),0===l&&0===d||t.translate(-1*l,-1*d),t},t.prototype.clone=function(t){var e,i,r,n,o,s=a.Util.cloneObject(this.attrs);for(var h in g){delete s[g[h]]}for(e in t)s[e]=t[e];var c=new this.constructor(s);for(e in this.eventListeners)for(r=(i=this.eventListeners[e]).length,n=0;n<r;n++)(o=i[n]).name.indexOf("konva")<0&&(c.eventListeners[e]||(c.eventListeners[e]=[]),c.eventListeners[e].push(o));return c},t.prototype._toKonvaCanvas=function(t){t=t||{};var e=this.getClientRect(),i=this.getStage(),r=void 0!==t.x?t.x:e.x,n=void 0!==t.y?t.y:e.y,o=t.pixelRatio||1,a=new l.SceneCanvas({width:t.width||e.width||(i?i.getWidth():0),height:t.height||e.height||(i?i.getHeight():0),pixelRatio:o}),s=a.getContext();return s.save(),(r||n)&&s.translate(-1*r,-1*n),this.drawScene(a),s.restore(),a},t.prototype.toCanvas=function(t){return this._toKonvaCanvas(t)._canvas},t.prototype.toDataURL=function(t){var e=(t=t||{}).mimeType||null,i=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(r),r},t.prototype.toImage=function(t){if(!t||!t.callback)throw"callback required for toImage method config argument";var e=t.callback;delete t.callback,a.Util._urlToImage(this.toDataURL(t),function(t){e(t)})},t.prototype.setSize=function(t){return this.width(t.width),this