1import{m as ui,e as Da,n as Qi,o as Rr,p as La,q as ut,F as Ia,v as Ua}from"./vendor-BZmXdGJ6.js";var Ji={exports:{}},Ie={},Ge={},V={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o._registerNode=o.Konva=o.glob=void 0;const t=Math.PI/180;function e(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}o.glob=typeof ui<"u"?ui:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},o.Konva={_global:o.glob,version:"9.2.3",isBrowser:e(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return o.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return o.Konva.DD.isDragging},isDragReady(){return!!o.Konva.DD.node},releaseCanvasOnDestroy:!0,document:o.glob.document,_injectGlobal(i){o.glob.Konva=i}};const r=i=>{o.Konva[i.prototype.getClassName()]=i};o._registerNode=r,o.Konva._injectGlobal(o.Konva)})(V);var it={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Util=o.Transform=void 0;const t=V;class e{constructor(g=[1,0,0,1,0,0]){this.dirty=!1,this.m=g&&g.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new e(this.m)}copyInto(g){g.m[0]=this.m[0],g.m[1]=this.m[1],g.m[2]=this.m[2],g.m[3]=this.m[3],g.m[4]=this.m[4],g.m[5]=this.m[5]}point(g){var y=this.m;return{x:y[0]*g.x+y[2]*g.y+y[4],y:y[1]*g.x+y[3]*g.y+y[5]}}translate(g,y){return this.m[4]+=this.m[0]*g+this.m[2]*y,this.m[5]+=this.m[1]*g+this.m[3]*y,this}scale(g,y){return this.m[0]*=g,this.m[1]*=g,this.m[2]*=y,this.m[3]*=y,this}rotate(g){var y=Math.cos(g),w=Math.sin(g),A=this.m[0]*y+this.m[2]*w,b=this.m[1]*y+this.m[3]*w,E=this.m[0]*-w+this.m[2]*y,P=this.m[1]*-w+this.m[3]*y;return this.m[0]=A,this.m[1]=b,this.m[2]=E,this.m[3]=P,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(g,y){var w=this.m[0]+this.m[2]*y,A=this.m[1]+this.m[3]*y,b=this.m[2]+this.m[0]*g,E=this.m[3]+this.m[1]*g;return this.m[0]=w,this.m[1]=A,this.m[2]=b,this.m[3]=E,this}multiply(g){var y=this.m[0]*g.m[0]+this.m[2]*g.m[1],w=this.m[1]*g.m[0]+this.m[3]*g.m[1],A=this.m[0]*g.m[2]+this.m[2]*g.m[3],b=this.m[1]*g.m[2]+this.m[3]*g.m[3],E=this.m[0]*g.m[4]+this.m[2]*g.m[5]+this.m[4],P=this.m[1]*g.m[4]+this.m[3]*g.m[5]+this.m[5];return this.m[0]=y,this.m[1]=w,this.m[2]=A,this.m[3]=b,this.m[4]=E,this.m[5]=P,this}invert(){var g=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),y=this.m[3]*g,w=-this.m[1]*g,A=-this.m[2]*g,b=this.m[0]*g,E=g*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),P=g*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=y,this.m[1]=w,this.m[2]=A,this.m[3]=b,this.m[4]=E,this.m[5]=P,this}getMatrix(){return this.m}decompose(){var g=this.m[0],y=this.m[1],w=this.m[2],A=this.m[3],b=this.m[4],E=this.m[5],P=g*A-y*w;let x={x:b,y:E,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(g!=0||y!=0){var R=Math.sqrt(g*g+y*y);x.rotation=y>0?Math.acos(g/R):-Math.acos(g/R),x.scaleX=R,x.scaleY=P/R,x.skewX=(g*w+y*A)/P,x.skewY=0}else if(w!=0||A!=0){var k=Math.sqrt(w*w+A*A);x.rotation=Math.PI/2-(A>0?Math.acos(-w/k):-Math.acos(w/k)),x.scaleX=P/k,x.scaleY=k,x.skewX=0,x.skewY=(g*w+y*A)/P}return x.rotation=o.Util._getRotation(x.rotation),x}}o.Transform=e;var r="[object Array]",i="[object Number]",a="[object String]",n="[object Boolean]",s=Math.PI/180,h=180/Math.PI,l="#",u="",_="0",v="Konva warning: ",f="Konva error: ",c="rgb(",p={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],ol
1ive:[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]},m=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,C=[];const T=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(d){setTimeout(d,60)};o.Util={_isElement(d){return!!(d&&d.nodeType==1)},_isFunction(d){return!!(d&&d.constructor&&d.call&&d.apply)},_isPlainObject(d){return!!d&&d.constructor===Object},_isArray(d){return Object.prototype.toString.call(d)===r},_isNumber(d){return Object.prototype.toString.call(d)===i&&!isNaN(d)&&isFinite(d)},_isString(d){return Object.prototype.toString.call(d)===a},_isBoolean(d){return Object.prototype.toString.call(d)===n},isObject(d){return d instanceof Object},isValidSelector(d){if(typeof d!="string")return!1;var g=d[0];return g==="#"||g==="."||g===g.toUpperCase()},_sign(d){return d===0||d>0?1:-1},requestAnimFrame(d){C.push(d),C.length===1&&T(function(){const g=C;C=[],g.forEach(function(y){y()})})},createCanvasElement(){var d=document.createElement("canvas");try{d.style=d.style||{}}catch{}return d},createImageElement(){return document.createElement("img")},_isInDocument(d){for(;d=d.parentNode;)if(d==document)return!0;return!1},_urlToImage(d,g){var y=o.Util.createImageElement();y.onload=function(){g(y)},y.src=d},_rgbToHex(d,g,y){return((1<<24)+(d<<16)+(g<<8)+y).toString(16).slice(1)},_hexToRgb(d){d=d.replace(l,u);var g=parseInt(d,16);return{r:g>>16&255,g:g>>8&255,b:g&255}},getRandomColor(){for(var d=(Math.random()*16777215<<0).toString(16);d.length<6;)d=_+d;return l+d},getRGB(d){var g;return d in p?(g=p[d],{r:g[0],g:g[1],b:g[2]}):d[0]===l?this._hexToRgb(d.substring(1)):d.substr(0,4)===c?(g=m.exec(d.replace(/ /g,"")),{r:parseInt(g[1],10),g:parseInt(g[2],10),b:parseInt(g[3],10)}):{r:0,g:0,b:0}},colorToRGBA(d){return d=d||"black",o.Util._namedColorToRBA(d)||o.Util._hex3ColorToRGBA(d)||o.Util._hex4ColorToRGBA(d)||o.Util._hex6ColorToRGBA(d)||o.Util._hex8ColorToRGBA(d)||o.Util._rgbColorToRGBA(d)||o.Util._rgbaColorToRGBA(d)||o.Util._hslColorToRGBA(d)},_namedColorToRBA(d){var g=p[d.toLowerCase()];return g?{r:g[0],g:g[1],b:g[2],a:1}:null},_rgbColorToRGBA(d){if(d.indexOf("rgb(")===0){d=d.match(/rgb\(([^)]+)\)/)[1];var g=d.split(/ *, */).map(Number);return{r:g[0],g:g[1],b:g[2],a:1}}},_rgbaColorToRGBA(d){if(d.indexOf("rgba(")===0){d=d.match(/rgba\(([^)]+)\)/)[1];var g=d.split(/ *, */).map((y,w)=>y.slice(-1)==="%"?w===3?parseInt(y)/100:parseInt(y)/100*255:Number(y));return{r:g[0],g:g[1],b:g[2],a:g[3]}}},_hex8ColorToRGBA(d){if(d[0]==="#"&&d.length===9)return{r:parseInt(d.slice(1,3),16),g:parseInt(d.slice(3,5),16),b:parseInt(d.slice(5,7),16),a:parseInt(d.slice(7,9),16)/255}},_hex6ColorToRGBA(d){if(d[0]==="#"&&d.length===7)return{r:parseInt(d.slice(1,3),16),g:parseInt(d.slice(3,5),16),b:parseInt(d.slice(5,7),16),a:1}},_hex4ColorToRGBA(d){if(d[0]==="#"&&d.length===5)return{r:parseInt(d[1]+d[1],16),g:parseInt(d[2]+d[2],16),b:parseInt(d[3]+d[3],16),a:parseInt(d[4]+d[4],16)/255}},_hex3ColorToRGBA(d){if(d[0]==="#"&&d.length===4)return{r:parseInt(d[1]+d[1],16),g:parseInt(d[2]+d[2],16),b:parseInt(d[3]+d[3],16),a:1}},_hslColorToRGBA(d){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(d)){const[g,...y]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(d),w=Number(y[0])/360,A=Number(y[1])/100,b=Number(y[2])/100;let E,P,x;if(A===0)return x=b*255,{r:Math.round(x),g:Math.round(x),b:Math.round(x),a:1};b<.5?E=b*(1+A):E=b+A-b*A;const R=2*b-E,k=[0,0,0];for(let M=0;M<3;M++)P=w+1/3*-(M-1),P<0&&P++,P>1&&P--,6*P<1?x=R+(E-R)*6*P:2*P<1?x=E:3*P<2?x=R+(E-R)*(2/3-P)*6:x=R,k[M]=x*255;return{r:Math.round(k[0]),g:Math.round(k[1]),b:Math.round(k[2]),a:1}}},haveIntersection(d,g){return!(g.x>d.x+d.width||g.x+g.width<d.x||g.y>d.y+d.height||g.y+g.height<d.y)},cloneObject(d){var g={};for(var y in d)this._isPlainObject(d[y])?g[y]=this.cloneObject(d[y]):this._isArray(d[y])?g[y]=this.cloneArray(d[y]):g[y]=d[y];return g},cloneArray(d){return d.slice(0)},degToRad(d){return d*s},radToDeg(d){return d*h},_degToRad(d){return o.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),o.Util.degToRad(d)},_radToDeg(d){return o.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),o.Util.radToDeg(d)},_getRotation(d){return t.Konva.angleDeg?o.Util.radToDeg(d):d}
1,_capitalize(d){return d.charAt(0).toUpperCase()+d.slice(1)},throw(d){throw new Error(f+d)},error(d){console.error(f+d)},warn(d){t.Konva.showWarnings&&console.warn(v+d)},each(d,g){for(var y in d)g(y,d[y])},_inRange(d,g,y){return g<=d&&d<y},_getProjectionToSegment(d,g,y,w,A,b){var E,P,x,R=(d-y)*(d-y)+(g-w)*(g-w);if(R==0)E=d,P=g,x=(A-y)*(A-y)+(b-w)*(b-w);else{var k=((A-d)*(y-d)+(b-g)*(w-g))/R;k<0?(E=d,P=g,x=(d-A)*(d-A)+(g-b)*(g-b)):k>1?(E=y,P=w,x=(y-A)*(y-A)+(w-b)*(w-b)):(E=d+k*(y-d),P=g+k*(w-g),x=(E-A)*(E-A)+(P-b)*(P-b))}return[E,P,x]},_getProjectionToLine(d,g,y){var w=o.Util.cloneObject(d),A=Number.MAX_VALUE;return g.forEach(function(b,E){if(!(!y&&E===g.length-1)){var P=g[(E+1)%g.length],x=o.Util._getProjectionToSegment(b.x,b.y,P.x,P.y,d.x,d.y),R=x[0],k=x[1],M=x[2];M<A&&(w.x=R,w.y=k,A=M)}}),w},_prepareArrayForTween(d,g,y){var w,A=[],b=[];if(d.length>g.length){var E=g;g=d,d=E}for(w=0;w<d.length;w+=2)A.push({x:d[w],y:d[w+1]});for(w=0;w<g.length;w+=2)b.push({x:g[w],y:g[w+1]});var P=[];return b.forEach(function(x){var R=o.Util._getProjectionToLine(x,A,y);P.push(R.x),P.push(R.y)}),P},_prepareToStringify(d){var g;d.visitedByCircularReferenceRemoval=!0;for(var y in d)if(d.hasOwnProperty(y)&&d[y]&&typeof d[y]=="object"){if(g=Object.getOwnPropertyDescriptor(d,y),d[y].visitedByCircularReferenceRemoval||o.Util._isElement(d[y]))if(g.configurable)delete d[y];else return null;else if(o.Util._prepareToStringify(d[y])===null)if(g.configurable)delete d[y];else return null}return delete d.visitedByCircularReferenceRemoval,d},_assign(d,g){for(var y in g)d[y]=g[y];return d},_getFirstPointerId(d){return d.touches?d.changedTouches[0].identifier:d.pointerId||999},releaseCanvas(...d){t.Konva.releaseCanvasOnDestroy&&d.forEach(g=>{g.width=0,g.height=0})},drawRoundedRectPath(d,g,y,w){let A=0,b=0,E=0,P=0;typeof w=="number"?A=b=E=P=Math.min(w,g/2,y/2):(A=Math.min(w[0]||0,g/2,y/2),b=Math.min(w[1]||0,g/2,y/2),P=Math.min(w[2]||0,g/2,y/2),E=Math.min(w[3]||0,g/2,y/2)),d.moveTo(A,0),d.lineTo(g-b,0),d.arc(g-b,b,b,Math.PI*3/2,0,!1),d.lineTo(g,y-P),d.arc(g-P,y-P,P,0,Math.PI/2,!1),d.lineTo(E,y),d.arc(E,y-E,E,Math.PI/2,Math.PI,!1),d.lineTo(0,A),d.arc(A,A,A,Math.PI,Math.PI*3/2,!1)}}})(it);var rt={},B={},G={};Object.defineProperty(G,"__esModule",{value:!0});G.getComponentValidator=G.getBooleanValidator=G.getNumberArrayValidator=G.getFunctionValidator=G.getStringOrGradientValidator=G.getStringValidator=G.getNumberOrAutoValidator=G.getNumberOrArrayOfNumbersValidator=G.getNumberValidator=G.alphaComponent=G.RGBComponent=void 0;const At=V,at=it;function Ft(o){return at.Util._isString(o)?'"'+o+'"':Object.prototype.toString.call(o)==="[object Number]"||at.Util._isBoolean(o)?o:Object.prototype.toString.call(o)}function Va(o){return o>255?255:o<0?0:Math.round(o)}G.RGBComponent=Va;function Ba(o){return o>1?1:o<1e-4?1e-4:o}G.alphaComponent=Ba;function $a(){if(At.Konva.isUnminified)return function(o,t){return at.Util._isNumber(o)||at.Util.warn(Ft(o)+' is a not val
1id value for "'+t+'" attribute. The value should be a number.'),o}}G.getNumberValidator=$a;function Ha(o){if(At.Konva.isUnminified)return function(t,e){let r=at.Util._isNumber(t),i=at.Util._isArray(t)&&t.length==o;return!r&&!i&&at.Util.warn(Ft(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or Array<number>('+o+")"),t}}G.getNumberOrArrayOfNumbersValidator=Ha;function za(){if(At.Konva.isUnminified)return function(o,t){var e=at.Util._isNumber(o),r=o==="auto";return e||r||at.Util.warn(Ft(o)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),o}}G.getNumberOrAutoValidator=za;function Wa(){if(At.Konva.isUnminified)return function(o,t){return at.Util._isString(o)||at.Util.warn(Ft(o)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),o}}G.getStringValidator=Wa;function Ka(){if(At.Konva.isUnminified)return function(o,t){const e=at.Util._isString(o),r=Object.prototype.toString.call(o)==="[object CanvasGradient]"||o&&o.addColorStop;
1return e||r||at.Util.warn(Ft(o)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),o}}G.getStringOrGradientValidator=Ka;function Ya(){if(At.Konva.isUnminified)return function(o,t){return at.Util._isFunction(o)||at.Util.warn(Ft(o)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),o}}G.getFunctionValidator=Ya;function Xa(){if(At.Konva.isUnminified)return function(o,t){const e=Int8Array?Object.getPrototypeOf(Int8Array):null;return e&&o instanceof e||(at.Util._isArray(o)?o.forEach(function(r){at.Util._isNumber(r)||at.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):at.Util.warn(Ft(o)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),o}}G.getNumberArrayValidator=Xa;function ja(){if(At.Konva.isUnminified)return function(o,t){var e=o===!0||o===!1;return e||at.Util.warn(Ft(o)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),o}}G.getBooleanValidator=ja;function qa(o){if(At.Konva.isUnminified)return function(t,e){return t==null||at.Util.isObject(t)||at.Util.warn(Ft(t)+' is a not val
1id value for "'+e+'" attribute. The value should be an object with properties '+o),t}}G.getComponentValidator=qa;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Factory=void 0;const t=it,e=G;var r="get",i="set";o.Factory={addGetterSetter(a,n,s,h,l){o.Factory.addGetter(a,n,s),o.Factory.addSetter(a,n,h,l),o.Factory.addOverloadedGetterSetter(a,n)},addGetter(a,n,s){var h=r+t.Util._capitalize(n);a.prototype[h]=a.prototype[h]||function(){var l=this.attrs[n];return l===void 0?s:l}},addSetter(a,n,s,h){var l=i+t.Util._capitalize(n);a.prototype[l]||o.Factory.overWriteSetter(a,n,s,h)},overWriteSetter(a,n,s,h){var l=i+t.Util._capitalize(n);a.prototype[l]=function(u){return s&&u!==void 0&&u!==null&&(u=s.call(this,u,n)),this._setAttr(n,u),h&&h.call(this),this}},addComponentsGetterSetter(a,n,s,h,l){var u=s.length,_=t.Util._capitalize,v=r+_(n),f=i+_(n),c,p;a.prototype[v]=function(){var C={};for(c=0;c<u;c++)p=s[c],C[p]=this.getAttr(n+_(p));return C};var m=(0,e.getComponentValidator)(s);a.prototype[f]=function(C){var T=this.attrs[n],d;h&&(C=h.call(this,C)),m&&m.call(this,C,n);for(d in C)C.hasOwnProperty(d)&&this._setAttr(n+_(d),C[d]);return C||s.forEach(g=>{this._setAttr(n+_(g),void 0)}),this._fireChangeEvent(n,T,C),l&&l.call(this),this},o.Factory.addOverloadedGetterSetter(a,n)},addOverloadedGetterSetter(a,n){var s=t.Util._capitalize(n),h=i+s,l=r+s;a.prototype[n]=function(){return arguments.length?(this[h](arguments[0]),this):this[l]()}},addDeprecatedGetterSetter(a,n,s,h){t.Util.error("Adding deprecated "+n);var l=r+t.Util._capitalize(n),u=n+" property is deprecated and will be removed soon. Look at Konva change log for more information.";a.prototype[l]=function(){t.Util.error(u);var _=this.attrs[n];return _===void 0?s:_},o.Factory.addSetter(a,n,h,function(){t.Util.error(u)}),o.Factory.addOverloadedGetterSetter(a,n)},backCompat(a,n){t.Util.each(n,function(s,h){var l=a.prototype[h],u=r+t.Util._capitalize(s),_=i+t.Util._capitalize(s);function v(){l.apply(this,arguments),t.Util.error('"'+s+'" method is deprecated and will be removed soon. Use ""'+h+'" instead.')}a.prototype[s]=v,a.prototype[u]=v,a.prototype[_]=v})},afterSetFilter(){this._filterUpToDate=!1}}})(B);var mt={},Et={};Object.defineProperty(Et,"__esModule",{value:!0});Et.HitContext=Et.SceneContext=Et.Context=void 0;const Zi=it,Qa=V;function Ja(o){var t=[],e=o.length,r=Zi.Util,i,a;for(i=0;i<e;i++)a=o[i],r._isNumber(a)?a=Math.round(a*1e3)/1e3:r._isString(a)||(a=a+""),t.push(a);return t}var fi=",",Za="(",tn=")",en="([",rn="])",an=";",nn="()",sn="=",gi=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],on=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const hn=100;class Ue{constructor(t){this.canvas=t,Qa.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){var r=this.traceArr,i=r.length,a="",n,s,h,l;for(n=0;n<i;n++)s=r[n],h=s.method,h?(l=s.args,a+=h,t?a+=nn:Zi.Util._isArray(l[0])?a+=en+l.join(fi)+rn:(e&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),a+=Za+l.join(fi)+tn)):(a+=s.property,t||(a+=sn+s.val)),a+=an;return a}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr,r;e.push(t),r=e.length,r>=hn&&e.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(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)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){var e=t.getAbsoluteOpacity();e!==1&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,r,i,a,n){this._context.arc(t,e,r,i,a,n)}arcTo(t,e,r,i,a){this._context.arcTo(t,e,r,i,a)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,r,i,a,n){this._context.bezierCurveTo(t,e,r,i,a,n)}clearRect(t,e,r,i){this._context.clearRect(t,e,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){var r=arguments;if(r.length===2)return this._context.createImageData(t,e);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,e,r,i){return this._context.createLinearGradient(t,e,r,i)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,r,i,a,n){return this._context.createRadialGradient(t,e,r,i,a,n)}drawImage(t,e,r,i,a,n,s,h,l){var u=arguments,_=this._context;u.length===3?_.drawImage(t,e,r):u.length===5?_.drawImage(t,e,r,i,a):u.length===9&&_.drawImage(t,e,r,i,a,n,s,h,l)}ellipse(t,e,r,i,a,n,s,h){this._context.ellipse(t,e,r,i,a,n,s,h)}
1isPointInPath(t,e,r,i){return r?this._context.isPointInPath(r,t,e,i):this._context.isPointInPath(t,e,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,r,i){this._context.fillRect(t,e,r,i)}strokeRect(t,e,r,i){this._context.strokeRect(t,e,r,i)}fillText(t,e,r,i){i?this._context.fillText(t,e,r,i):this._context.fillText(t,e,r)}measureText(t){return this._context.measureText(t)}getImageData(t,e,r,i){return this._context.getImageData(t,e,r,i)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,r,i){this._context.rect(t,e,r,i)}putImageData(t,e,r){this._context.putImageData(t,e,r)}quadraticCurveTo(t,e,r,i){this._context.quadraticCurveTo(t,e,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,r,i,a,n){this._context.setTransform(t,e,r,i,a,n)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,r,i){this._context.strokeText(t,e,r,i)}transform(t,e,r,i,a,n){this._context.transform(t,e,r,i,a,n)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t=this,e=gi.length,r=this.setAttr,i,a,n=function(s){var h=t[s],l;t[s]=function(){return a=Ja(Array.prototype.slice.call(arguments,0)),l=h.apply(t,arguments),t._trace({method:s,args:a}),l}};for(i=0;i<e;i++)n(gi[i]);t.setAttr=function(){r.apply(t,arguments);var s=arguments[0],h=arguments[1];(s==="shadowOffsetX"||s==="shadowOffsetY"||s==="shadowBlur")&&(h=h/this.canvas.getPixelRatio()),t._trace({property:s,val:h})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;var r=!e||e==="source-over";r||this.setAttr("globalCompositeOperation",e)}}Et.Context=Ue;on.forEach(function(o){Object.defineProperty(Ue.prototype,o,{get(){return this._context[o]},set(t){this._context[o]=t}})});class ln extends Ue{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),r=t.getFillPriority();if(e&&r==="color"){this._fillColor(t);return}const i=t.getFillPatternImage();if(i&&r==="pattern"){this._fillPattern(t);return}const a=t.getFillLinearGradientColorStops();if(a&&r==="linear-gradient"){this._fillLinearGradient(t);return}const n=t.getFillRadialGradientColorStops();if(n&&r==="radial-gradient"){this._fillRadialGradient(t);return}e?this._fillColor(t):i?this._fillPattern(t):a?this._fillLinearGradient(t):n&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),r=t.getStrokeLinearGradientEndPoint(),i=t.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(e.x,e.y,r.x,r.y);if(i){for(var n=0;n<i.length;n+=2)a.addColorStop(i[n],i[n+1]);this.setAttr("strokeStyle",a)}}_stroke(t){var e=t.dash(),r=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!r){this.save();var i=this.getCanvas().getPixelRatio();this.setTransform(i,0,0,i,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)");var a=t.getStrokeLinearGradientColorStops();a?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),r||this.restore()}}_applyShadow(t){var e,r,i,a=(e=t.getShadowRGBA())!==null&&e!==void 0?e:"black",n=(r=t.getShadowBlur())!==null&&r!==void 0?r:5,s=(i=t.getShadowOffset())!==null&&i!==void 0?i:{x:0,y:0},h=t.getAbsoluteScale(),l=this.canvas.getPixelRatio(),u=h.x*l,_=h.y*l;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",n*Math.min(Math.abs(u),Math.abs(_))),this.setAttr("shadowOffsetX",s.x*u),this.setAttr("shadowOffsetY",s.y*_)}}Et.SceneContext=ln;class dn extends Ue{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore(
1)}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const a=t.getStrokeScaleEnabled();if(!a){this.save();var e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(t);var r=t.hitStrokeWidth(),i=r==="auto"?t.strokeWidth():r;this.setAttr("lineWidth",i),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),a||this.restore()}}}Et.HitContext=dn;Object.defineProperty(mt,"__esModule",{value:!0});mt.HitCanvas=mt.SceneCanvas=mt.Canvas=void 0;const Ne=it,ta=Et,ea=V,cn=B,un=G;var Te;function fn(){if(Te)return Te;var o=Ne.Util.createCanvasElement(),t=o.getContext("2d");return Te=function(){var e=ea.Konva._global.devicePixelRatio||1,r=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/r}(),Ne.Util.releaseCanvas(o),Te}class Ve{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=t||{},r=e.pixelRatio||ea.Konva.pixelRatio||fn();this.pixelRatio=r,this._canvas=Ne.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"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio,r=this.getContext()._context;r.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio,r=this.getContext()._context;r.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch{try{return this._canvas.toDataURL()}catch(i){return Ne.Util.error("Unable to get data URL. "+i.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}mt.Canvas=Ve;cn.Factory.addGetterSetter(Ve,"pixelRatio",void 0,(0,un.getNumberValidator)());class gn extends Ve{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new ta.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}mt.SceneCanvas=gn;class vn extends Ve{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new ta.HitContext(this),this.setSize(t.width,t.height)}}mt.HitCanvas=vn;var Be={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.DD=void 0;const t=V,e=it;o.DD={get isDragging(){var r=!1;return o.DD._dragElements.forEach(i=>{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return o.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];o.DD._dragElements.forEach((a,n)=>{const{node:s}=a,h=s.getStage();h.setPointersPositions(r),a.pointerId===void 0&&(a.pointerId=e.Util._getFirstPointerId(r));const l=h._changedPointerPositions.find(v=>v.id===a.pointerId);if(l){if(a.dragStatus!=="dragging"){var u=s.dragDistance(),_=Math.max(Math.abs(l.x-a.startPointerPos.x),Math.abs(l.y-a.startPointerPos.y));if(_<u||(s.startDrag({evt:r}),!s.isDragging()))return}s._setDragPosition(r,a),i.push(s)}}
1),i.forEach(a=>{a.fire("dragmove",{type:"dragmove",target:a,evt:r},!0)})},_endDragBefore(r){const i=[];o.DD._dragElements.forEach(a=>{const{node:n}=a,s=n.getStage();if(r&&s.setPointersPositions(r),!s._changedPointerPositions.find(u=>u.id===a.pointerId))return;(a.dragStatus==="dragging"||a.dragStatus==="stopped")&&(o.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,a.dragStatus="stopped");const l=a.node.getLayer()||a.node instanceof t.Konva.Stage&&a.node;l&&i.indexOf(l)===-1&&i.push(l)}),i.forEach(a=>{a.draw()})},_endDragAfter(r){o.DD._dragElements.forEach((i,a)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&o.DD._dragElements.delete(a)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",o.DD._endDragBefore,!0),window.addEventListener("touchend",o.DD._endDragBefore,!0),window.addEventListener("mousemove",o.DD._drag),window.addEventListener("touchmove",o.DD._drag),window.addEventListener("mouseup",o.DD._endDragAfter,!1),window.addEventListener("touchend",o.DD._endDragAfter,!1))})(Be);Object.defineProperty(rt,"__esModule",{value:!0});rt.Node=void 0;const $=it,ye=B,xe=mt,Bt=V,pt=Be,ot=G;var Re="absoluteOpacity",Ee="allEventListeners",xt="absoluteTransform",vi="absoluteScale",$t="canvas",pn="Change",_n="children",mn="konva",$r="listening",pi="mouseenter",_i="mouseleave",mi="set",yi="Shape",Me=" ",bi="stage",Gt="transform",yn="Stage",Hr="visible",bn=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Me);let Sn=1;class I{constructor(t){this._id=Sn++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===Gt||t===xt)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,e){var r=this._cache.get(t),i=t===Gt||t===xt,a=r===void 0||i&&r.dirty===!0;return a&&(r=e.call(this),this._cache.set(t,r)),r}_calculate(t,e,r){if(!this._attachedDepsListeners.get(t)){const i=e.map(a=>a+"Change.konva").join(Me);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get($t)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===xt&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has($t)){const{scene:t,filter:e,hit:r}=this._cache.get($t);$.Util.releaseCanvas(t,e,r),this._cache.delete($t)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var e=t||{},r={};(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var i=Math.ceil(e.width||r.width),a=Math.ceil(e.height||r.height),n=e.pixelRatio,s=e.x===void 0?Math.floor(r.x):e.x,h=e.y===void 0?Math.floor(r.y):e.y,l=e.offset||0,u=e.drawBorder||!1,_=e.hitCanvasPixelRatio||1;if(!i||!a){$.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=l*2+1,a+=l*2+1,s-=l,h-=l;var v=new xe.SceneCanvas({pixelRatio:n,width:i,height:a}),f=new xe.SceneCanvas({pixelRatio:n,width:0,height:0,willReadFrequently:!0}),c=new xe.HitCanvas({pixelRatio:_,width:i,height:a}),p=v.getContext(),m=c.getContext();return c.isCache=!0,v.isCache=!0,this._cache.delete($t),this._filterUpToDate=!1,e.imageSmoothingEnabled===!1&&(v.getContext()._context.imageSmoothingEnabled=!1,f.getContext()._context.imageSmoothingEnabled=!1),p.save(),m.save(),p.translate(-s,-h),m.translate(-s,-h),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Re),this._clearSelfAndDescendantCache(vi
1),this.drawScene(v,this),this.drawHit(c,this),this._isUnderCache=!1,p.restore(),m.restore(),u&&(p.save(),p.beginPath(),p.rect(0,0,i,a),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set($t,{scene:v,filter:f,hit:c,x:s,y:h}),this._requestDraw(),this}isCached(){return this._cache.has($t)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var r=[{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}],i=1/0,a=1/0,n=-1/0,s=-1/0,h=this.getAbsoluteTransform(e);return r.forEach(function(l){var u=h.point(l);i===void 0&&(i=n=u.x,a=s=u.y),i=Math.min(i,u.x),a=Math.min(a,u.y),n=Math.max(n,u.x),s=Math.max(s,u.y)}),{x:i,y:a,width:n-i,height:s-a}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),r=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),e=this._getCanvasCache(),r=e.scene,i=e.filter,a=i.getContext(),n,s,h,l;if(t){if(!this._filterUpToDate){var u=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(n=t.length,a.clear(),a.drawImage(r._canvas,0,0,r.getWidth()/u,r.getHeight()/u),s=a.getImageData(0,0,i.getWidth(),i.getHeight()),h=0;h<n;h++){if(l=t[h],typeof l!="function"){$.Util.error("Filter should be type of function, but got "+typeof l+" instead. Please check correct filters");continue}l.call(this,s),a.putImageData(s,0,0)}}catch(_){$.Util.error("Unable to apply filter. "+_.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return i}return r}on(t,e){if(this._cache&&this._cache.delete(Ee),arguments.length===3)return this._delegate.apply(this,arguments);var r=t.split(Me),i=r.length,a,n,s,h,l;for(a=0;a<i;a++)n=r[a],s=n.split("."),h=s[0],l=s[1]||"",this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:l,handler:e});return this}off(t,e){var r=(t||"").split(Me),i=r.length,a,n,s,h,l,u;if(this._cache&&this._cache.delete(Ee),!t)for(n in this.eventListeners)this._off(n);for(a=0;a<i;a++)if(s=r[a],h=s.split("."),l=h[0],u=h[1],l)this.eventListeners[l]&&this._off(l,u,e);else for(n in this.eventListeners)this._off(n,u,e);return this}dispatchEvent(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(r){e.call(this,r.evt)}
1),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,r){var i=this;this.on(t,function(a){for(var n=a.target.findAncestors(e,!0,i),s=0;s<n.length;s++)a=$.Util.cloneObject(a),a.currentTarget=n[s],r.call(n[s],a)})}remove(){return this.isDragging()&&this.stopDrag(),pt.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(xt),this._clearSelfAndDescendantCache(Re),this._clearSelfAndDescendantCache(vi),this._clearSelfAndDescendantCache(bi),this._clearSelfAndDescendantCache(Hr),this._clearSelfAndDescendantCache($r)}_remove(){this._clearCaches();var t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){var e="get"+$.Util._capitalize(t);return $.Util._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){for(var t=this.getParent(),e=[];t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{var e,r;if(!t)return this;for(e in t)e!==_n&&(r=mi+$.Util._capitalize(e),$.Util._isFunction(this[r])?this[r](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache($r,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(Hr,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;pt.DD._dragElements.forEach(n=>{n.dragStatus==="dragging"&&(n.node.nodeType==="Stage"||n.node.getLayer()===r)&&(i=!0)});var a=!e&&!Bt.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),e=this,r=0,i,a,n,s;function h(u){for(i=[],a=u.length,n=0;n<a;n++)s=u[n],r++,s.nodeType!==yi&&(i=i.concat(s.getChildren().slice())),s._id===e._id&&(n=a);i.length>0&&i[0].getDepth()<=t&&h(i)}const l=this.getStage();return e.nodeType!==yn&&l&&h(l.getChildren()),r}getDepth(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Gt),this._clearSelfAndDescendantCache(xt)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;var e=t.getPointerPosition();if(!e)return null;var r=this.getAbsoluteTransform().copy();return r.invert(),r.point(e)}getAbsolutePosition(t){let e=!1,r=this.parent;for(;r;){if(r.isCached()){e=!0;break}r=r.parent}e&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),a=new $.Transform,n=this.offset();return a.m=i.slice(),a.translate(n.x,n.y),a.getTranslation()}setAbsolutePosition(t){const{x:e,y:r,...i}=this._clearTransform();this.attrs.x=e,this.attrs.y=r,this._clearCache(Gt);var a=this._getAbsoluteTransform().copy();return a.invert(),a.translate(t.x,t.y),t={x:this.attrs.x+a.getTranslation().x,y:this.attrs.y+a.getTranslation().y},this._setTransform(i),this.setPosition({x:t.x,y:t.y}),this._clearCache(Gt),this._clearSelfAndDescendantCache(xt),this}_setTransform(t){var e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){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,t}move(t){var e=t.x,r=t.y,i=this.x(),a=this.y();return e!==void 0&&(i+=e),r!==void 0&&(a+=r),this.setPosition({x:i,y:a}),this}_eachAncestorReverse(t,e){var r=[],i=this.getParent(),a,n;if(!(e&&e._id===this._id)){for(r.unshift(this);i&&(!e||i._id!==e._id);)r.unshift(i),i=i.parent;for(a=r.length,n=0;n<a;n++)t(r[n])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return $.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return $.Util.warn("Node has no parent. moveUp function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return $.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):!1}moveToBottom(){if(!this.parent)return $.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):!1}setZIndex(t){if(!this.parent)return $.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&$.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}getAbsoluteOpacity(){return this._getCache(Re,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},e=this.getAttrs(),r,i,a,n,s;t.attrs={};for(r in e)i=e[r],s=$.Util.isObject(i)&&!$.Util._isPlainObject(i)&&!$.Util._isArray(i),!s&&(a=typeof this[r]=="function"&&this[r],delete e[r],n=a?a.call(this):null,e[r]=i,n!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),$.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,r){var i=[];e&&this._isMatch(t)&&i.push(this);for(var a=this.parent;a;){if(a===r)return i;a._isMatch(t)&&i.push(a),a=a.parent}return i}isAncestorOf(t){return!1}
1findAncestor(t,e,r){return this.findAncestors(t,e,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var e=t.replace(/ /g,"").split(","),r=e.length,i,a;for(i=0;i<r;i++)if(a=e[i],$.Util.isValidSelector(a)||($.Util.warn('Selector "'+a+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),$.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),$.Util.warn("Konva is awesome, right?")),a.charAt(0)==="#"){if(this.id()===a.slice(1))return!0}else if(a.charAt(0)==="."){if(this.hasName(a.slice(1)))return!0}else if(this.className===a||this.nodeType===a)return!0;return!1}getLayer(){var t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(bi,this._getStage)}_getStage(){var t=this.getParent();return t?t.getStage():null}fire(t,e={},r){return e.target=e.target||this,r?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(xt,this._getAbsoluteTransform)}_getAbsoluteTransform(t){var e;if(t)return e=new $.Transform,this._eachAncestorReverse(function(i){var a=i.transformsEnabled();a==="all"?e.multiply(i.getTransform()):a==="position"&&e.translate(i.x()-i.offsetX(),i.y()-i.offsetY())},t),e;e=this._cache.get(xt)||new $.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();var r=this.transformsEnabled();if(r==="all")e.multiply(this.getTransform());else if(r==="position"){const i=this.attrs.x||0,a=this.attrs.y||0,n=this.attrs.offsetX||0,s=this.attrs.offsetY||0;e.translate(i-n,a-s)}return e.dirty=!1,e}getAbsoluteScale(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();const i=this.getAbsoluteTransform(t).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Gt,this._getTransform)}_getTransform(){var t,e,r=this._cache.get(Gt)||new $.Transform;r.reset();var i=this.x(),a=this.y(),n=Bt.Konva.getAngle(this.rotation()),s=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,h=(e=this.attrs.scaleY)!==null&&e!==void 0?e:1,l=this.attrs.skewX||0,u=this.attrs.skewY||0,_=this.attrs.offsetX||0,v=this.attrs.offsetY||0;return(i!==0||a!==0)&&r.translate(i,a),n!==0&&r.rotate(n),(l!==0||u!==0)&&r.skew(l,u),(s!==1||h!==1)&&r.scale(s,h),(_!==0||v!==0)&&r.translate(-1*_,-1*v),r.dirty=!1,r}clone(t){var e=$.Util.cloneObject(this.attrs),r,i,a,n,s;for(r in t)e[r]=t[r];var h=new this.constructor(e);for(r in this.eventListeners)for(i=this.eventListeners[r],a=i.length,n=0;n<a;n++)s=i[n],s.name.indexOf(mn)<0&&(h.eventListeners[r]||(h.eventListeners[r]=[]),h.eventListeners[r].push(s));return h}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),r=this.getStage(),i=t.x!==void 0?t.x:Math.floor(e.x),a=t.y!==void 0?t.y:Math.floor(e.y),n=t.pixelRatio||1,s=new xe.SceneCanvas({width:t.width||Math.ceil(e.width)||(r?r.width():0),height:t.height||Math.ceil(e.height)||(r?r.height():0),pixelRatio:n}),h=s.getContext();return t.imageSmoothingEnabled===!1&&(h._context.imageSmoothingEnabled=!1),h.save(),(i||a)&&h.translate(-1*i,-1*a),this.drawScene(s),h.restore(),s}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};var e=t.mimeType||null,r=t.quality||null,i=this._toKonvaCanvas(t).toDataURL(e,r);return t.callback&&t.callback(i),i}toImage(t){return new Promise((e,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,$.Util._urlToImage(this.toDataURL(t),function(a){e(a),i==null||i(a)})}catch(i){r(i)}})}toBlob(t){return new Promise((e,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(a=>{e(a),i==null||i(a)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Bt.Konva.dragDistance}_off(t,e,r){var i=this.eventListeners[t],a,n,s;for(a=0;a<i.length;a++)if(n=i[a].name,s=i[a].handler,(n!=="konva"||e==="konva")&&(!e||n===e)&&(!r||r===s)){if(i.splice(a,1),i.length===0){delete this.eventListeners[t];break}a--}}_fireChangeEvent(t,e,r){this._fire(t+pn,{oldVal:e,newVal:r})}addName(t){if(!this.hasName(t)){var e=this.name(),r=e?e+" "+t:t;this.name(r)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;var r=(e||"").split(/\s/g);return r.indexOf(t)!==-1}removeName(t){var e=(this.name()||"").split(/\s/g),r=e.indexOf(t);return r!==-1&&(e.splice(r,1),this.name(e.join(" "))),this}
1setAttr(t,e){var r=this[mi+$.Util._capitalize(t)];return $.Util._isFunction(r)?r.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(Bt.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();t==null||t.batchDraw()}}_setAttr(t,e){var r=this.attrs[t];r===e&&!$.Util.isObject(e)||(e==null?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,r,e),this._requestDraw())}_setComponentAttr(t,e,r){var i;r!==void 0&&(i=this.attrs[t],i||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=r,this._fireChangeEvent(t,i,r))}_fireAndBubble(t,e,r){e&&this.nodeType===yi&&(e.target=this);var i=(t===pi||t===_i)&&(r&&(this===r||this.isAncestorOf&&this.isAncestorOf(r))||this.nodeType==="Stage"&&!r);if(!i){this._fire(t,e);var a=(t===pi||t===_i)&&r&&r.isAncestorOf&&r.isAncestorOf(this)&&!r.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!a&&(r&&r.parent?this._fireAndBubble.call(this.parent,t,e,r):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,r,i;const a=(e=this._cache.get(Ee))!==null&&e!==void 0?e:{};let n=a==null?void 0:a[t];if(n===void 0){n=[];let s=Object.getPrototypeOf(this);for(;s;){const h=(i=(r=s.eventListeners)===null||r===void 0?void 0:r[t])!==null&&i!==void 0?i:[];n.push(...h),s=Object.getPrototypeOf(s)}a[t]=n,this._cache.set(Ee,a)}return n}_fire(t,e){e=e||{},e.currentTarget=this,e.type=t;const r=this._getProtoListeners(t);if(r)for(var i=0;i<r.length;i++)r[i].handler.call(this,e);const a=this.eventListeners[t];if(a)for(var i=0;i<a.length;i++)a[i].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){var e=t?t.pointerId:void 0,r=this.getStage(),i=this.getAbsolutePosition();if(r){var a=r._getPointerById(e)||r._changedPointerPositions[0]||i;pt.DD._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-i.x,y:a.y-i.y},dragStatus:"ready",pointerId:e})}}startDrag(t,e=!0){pt.DD._dragElements.has(this._id)||this._createDragElement(t);const r=pt.DD._dragElements.get(this._id);r.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const r=this.getStage()._getPointerById(e.pointerId);if(r){var i={x:r.x-e.offset.x,y:r.y-e.offset.y},a=this.dragBoundFunc();if(a!==void 0){const n=a.call(this,i,t);n?i=n:$.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==i.x||this._lastPos.y!==i.y)&&(this.setAbsolutePosition(i),this._requestDraw()),this._lastPos=i}}stopDrag(t){const e=pt.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),pt.DD._endDragBefore(t),pt.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=pt.DD._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){var e=t.evt.button!==void 0,r=!e||Bt.Konva.dragButtons.indexOf(t.evt.button)>=0;if(r&&!this.isDragging()){var i=!1;pt.DD._dragElements.forEach(a=>{this.isAncestorOf(a.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const e=pt.DD._dragElements.get(this._id),r=e&&e.dragStatus==="dragging",i=e&&e.dragStatus==="ready";
1r?this.stopDrag():i&&pt.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const e=this.getStage();if(!e)return!1;const r={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return $.Util.haveIntersection(r,this.getClientRect())}static create(t,e){return $.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){var r=I.prototype.getClassName.call(t),i=t.children,a,n,s;e&&(t.attrs.container=e),Bt.Konva[r]||($.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const h=Bt.Konva[r];if(a=new h(t.attrs),i)for(n=i.length,s=0;s<n;s++)a.add(I._createNode(i[s]));return a}}rt.Node=I;I.prototype.nodeType="Node";I.prototype._attrsAffectingSize=[];I.prototype.eventListeners={};I.prototype.on.call(I.prototype,bn,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Gt),this._clearSelfAndDescendantCache(xt)});I.prototype.on.call(I.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Hr)});I.prototype.on.call(I.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache($r)});I.prototype.on.call(I.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(Re)});const q=ye.Factory.addGetterSetter;q(I,"zIndex");q(I,"absolutePosition");q(I,"position");q(I,"x",0,(0,ot.getNumberValidator)());q(I,"y",0,(0,ot.getNumberValidator)());q(I,"globalCompositeOperation","source-over",(0,ot.getStringValidator)());q(I,"opacity",1,(0,ot.getNumberValidator)());q(I,"name","",(0,ot.getStringValidator)());q(I,"id","",(0,ot.getStringValidator)());q(I,"rotation",0,(0,ot.getNumberValidator)());ye.Factory.addComponentsGetterSetter(I,"scale",["x","y"]);q(I,"scaleX",1,(0,ot.getNumberValidator)());q(I,"scaleY",1,(0,ot.getNumberValidator)());ye.Factory.addComponentsGetterSetter(I,"skew",["x","y"]);q(I,"skewX",0,(0,ot.getNumberValidator)());q(I,"skewY",0,(0,ot.getNumberValidator)());ye.Factory.addComponentsGetterSetter(I,"offset",["x","y"]);q(I,"offsetX",0,(0,ot.getNumberValidator)());q(I,"offsetY",0,(0,ot.getNumberValidator)());q(I,"dragDistance",null,(0,ot.getNumberValidator)());q(I,"width",0,(0,ot.getNumberValidator)());q(I,"height",0,(0,ot.getNumberValidator)());q(I,"listening",!0,(0,ot.getBooleanValidator)());q(I,"preventDefault",!0,(0,ot.getBooleanValidator)());q(I,"filters",null,function(o){return this._filterUpToDate=!1,o});q(I,"visible",!0,(0,ot.getBooleanValidator)());q(I,"transformsEnabled","all",(0,ot.getStringValidator)());q(I,"size");q(I,"dragBoundFunc");q(I,"draggable",!1,(0,ot.getBooleanValidator)());ye.Factory.backCompat(I,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var zt={};Object.defineProperty(zt,"__esModule",{value:!0});zt.Container=void 0;const se=B,Mr=rt,$e=G;class Wt extends Mr.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var r=[];return e.forEach(function(i){t(i)&&r.push(i)}),r}hasChildren(){return this.getChildren().length>0}
1removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var e=0;e<t.length;e++)this.add(t[e]);return this}const r=t[0];return r.getParent()?(r.moveTo(this),this):(this._validateAdd(r),r.index=this.getChildren().length,r.parent=this,r._clearCaches(),this.getChildren().push(r),this._fire("add",{child:r}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){var r=[];return this._descendants(i=>{const a=i._isMatch(t);return a&&r.push(i),!!(a&&e)}),r}_descendants(t){let e=!1;const r=this.getChildren();for(const i of r){if(e=t(i),e)return!0;if(i.hasChildren()&&(e=i._descendants(t),e))return!0}return!1}toObject(){var t=Mr.Node.prototype.toObject.call(this);
1return t.children=[],this.getChildren().forEach(e=>{t.children.push(e.toObject())}),t}isAncestorOf(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){var e=Mr.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){e.add(r.clone())}),e}getAllIntersections(t){var e=[];return this.find("Shape").forEach(r=>{r.isVisible()&&r.intersects(t)&&e.push(r)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),!this.isCached()&&((e=this.children)===null||e===void 0||e.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(e,r){e.index=r}),this._requestDraw()}drawScene(t,e){var r=this.getLayer(),i=t||r&&r.getCanvas(),a=i&&i.getContext(),n=this._getCanvasCache(),s=n&&n.scene,h=i&&i.isCache;if(!this.isVisible()&&!h)return this;if(s){a.save();var l=this.getAbsoluteTransform(e).getMatrix();a.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",i,e);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,a=i&&i.getContext(),n=this._getCanvasCache(),s=n&&n.hit;if(s){a.save();var h=this.getAbsoluteTransform(e).getMatrix();a.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",i,e);return this}_drawChildren(t,e,r){var i,a=e&&e.getContext(),n=this.clipWidth(),s=this.clipHeight(),h=this.clipFunc(),l=n&&s||h;const u=r===this;if(l){a.save();var _=this.getAbsoluteTransform(r),v=_.getMatrix();a.transform(v[0],v[1],v[2],v[3],v[4],v[5]),a.beginPath();let m;if(h)m=h.call(this,a,this);else{var f=this.clipX(),c=this.clipY();a.rect(f,c,n,s)}a.clip.apply(a,m),v=_.copy().invert().getMatrix(),a.transform(v[0],v[1],v[2],v[3],v[4],v[5])}var p=!u&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";p&&(a.save(),a._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(m){m[t](e,r)}),p&&a.restore(),l&&a.restore()}getClientRect(t={}){var e,r=t.skipTransform,i=t.relativeTo,a,n,s,h,l={x:1/0,y:1/0,width:0,height:0},u=this;(e=this.children)===null||e===void 0||e.forEach(function(p){if(p.visible()){var m=p.getClientRect({relativeTo:u,skipShadow:t.skipShadow,skipStroke:t.skipStroke});m.width===0&&m.height===0||(a===void 0?(a=m.x,n=m.y,s=m.x+m.width,h=m.y+m.height):(a=Math.min(a,m.x),n=Math.min(n,m.y),s=Math.max(s,m.x+m.width),h=Math.max(h,m.y+m.height)))}});for(var _=this.find("Shape"),v=!1,f=0;f<_.length;f++){var c=_[f];if(c._isVisible(this)){v=!0;break}}return v&&a!==void 0?l={x:a,y:n,width:s-a,height:h-n}:l={x:0,y:0,width:0,height:0},r?l:this._transformedRect(l,i)}}zt.Container=Wt;se.Factory.addComponentsGetterSetter(Wt,"clip",["x","y","width","height"]);se.Factory.addGetterSetter(Wt,"clipX",void 0,(0,$e.getNumberValidator)());se.Factory.addGetterSetter(Wt,"clipY",void 0,(0,$e.getNumberValidator)());se.Factory.addGetterSetter(Wt,"clipWidth",void 0,(0,$e.getNumberValidator)());se.Factory.addGetterSetter(Wt,"clipHeight",void 0,(0,$e.getNumberValidator)());se.Factory.addGetterSetter(Wt,"clipFunc");var ra={},gt={};Object.defineProperty(gt,"__esModule",{value:!0});gt.releaseCapture=gt.setPointerCapture=gt.hasPointerCapture=gt.createEvent=gt.getCapturedShape=void 0;const Cn=V,pe=new Map,ia=Cn.Konva._global.PointerEvent!==void 0;function wn(o){return pe.get(o)}gt.getCapturedShape=wn;function Qr(o){return{evt:o,pointerId:o.pointerId}}gt.createEvent=Qr;function Pn(o,t){return pe.get(o)===t}gt.hasPointerCapture=Pn;function Tn(o,t){aa(o),t.getStage()&&(pe.set(o,t),ia&&t._fire("gotpointercapture",Qr(new PointerEvent("gotpointercapture"))))}gt.setPointerCapture=Tn;function aa(o,t){const e=pe.get(o);if(!e)return;const r=e.getStage();r&&r.content,pe.delete(o),ia&&e._fire("lostpointercapture",Qr(new PointerEvent("lostpointercapture")))}gt.releaseCapture=aa;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Stage=o.stages=void 0;const t=it,e=B,r=zt,i=V,a=mt,n=Be,s=V,h=gt;
1var l="Stage",u="string",_="px",v="mouseout",f="mouseleave",c="mouseover",p="mouseenter",m="mousemove",C="mousedown",T="mouseup",d="pointermove",g="pointerdown",y="pointerup",w="pointercancel",A="lostpointercapture",b="pointerout",E="pointerleave",P="pointerover",x="pointerenter",R="contextmenu",k="touchstart",M="touchend",L="touchmove",U="touchcancel",H="wheel",z=5,J=[[p,"_pointerenter"],[C,"_pointerdown"],[m,"_pointermove"],[T,"_pointerup"],[f,"_pointerleave"],[k,"_pointerdown"],[L,"_pointermove"],[M,"_pointerup"],[U,"_pointercancel"],[c,"_pointerover"],[H,"_wheel"],[R,"_contextmenu"],[g,"_pointerdown"],[d,"_pointermove"],[y,"_pointerup"],[w,"_pointercancel"],[A,"_lostpointercapture"]];const O={mouse:{[b]:v,[E]:f,[P]:c,[x]:p,[d]:m,[g]:C,[y]:T,[w]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[b]:"touchout",[E]:"touchleave",[P]:"touchover",[x]:"touchenter",[d]:L,[g]:k,[y]:M,[w]:U,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[b]:b,[E]:E,[P]:P,[x]:x,[d]:d,[g]:g,[y]:y,[w]:w,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},D=ft=>ft.indexOf("pointer")>=0?"pointer":ft.indexOf("touch")>=0?"touch":"mouse",Y=ft=>{const S=D(ft);if(S==="pointer")return i.Konva.pointerEventsEnabled&&O.pointer;if(S==="touch")return O.touch;if(S==="mouse")return O.mouse};function Z(ft={}){return(ft.clipFunc||ft.clipWidth||ft.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),ft}const Q="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";o.stages=[];class wt extends r.Container{constructor(S){super(Z(S)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),o.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Z(this.attrs)}),this._checkVisibility()}_validateAdd(S){const F=S.getType()==="Layer",N=S.getType()==="FastLayer";F||N||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const S=this.visible()?"":"none";this.content.style.display=S}setContainer(S){if(typeof S===u){if(S.charAt(0)==="."){var F=S.slice(1);S=document.getElementsByClassName(F)[0]}else{var N;S.charAt(0)!=="#"?N=S:N=S.slice(1),S=document.getElementById(N)}if(!S)throw"Can not find container in document with id "+N}return this._setAttr("container",S),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),S.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var S=this.children,F=S.length,N;for(N=0;N<F;N++)S[N].clear();return this}clone(S){return S||(S={}),S.container=typeof document<"u"&&document.createElement("div"),r.Container.prototype.clone.call(this,S)}destroy(){super.destroy();var S=this.content;S&&t.Util._isInDocument(S)&&this.container().removeChild(S);var F=o.stages.indexOf(this);return F>-1&&o.stages.splice(F,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const S=this._pointerPositions[0]||this._changedPointerPositions[0];return S?{x:S.x,y:S.y}:(t.Util.warn(Q),null)}_getPointerById(S){return this._pointerPositions.find(F=>F.id===S)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(S){S=S||{},S.x=S.x||0,S.y=S.y||0,S.width=S.width||this.width(),S.height=S.height||this.height();var F=new a.SceneCanvas({width:S.width,height:S.height,pixelRatio:S.pixelRatio||1}),N=F.getContext()._context,et=this.children;return(S.x||S.y)&&N.translate(-1*S.x,-1*S.y),et.forEach(function(X){if(X.isVisible()){var st=X._toKonvaCanvas(S);N.drawImage(st._canvas,S.x,S.y,st.getWidth()/st.getPixelRatio(),st.getHeight()/st.getPixelRatio())}}),F}getIntersection(S){if(!S)return null;var F=this.children,N=F.length,et=N-1,X;for(X=et;X>=0;X--){const st=F[X].getIntersection(S);if(st)return st}return null}_resizeDOM(){var S=this.width(),F=this.height();this.content&&(this.content.style.width=S+_,this.content.style.height=F+_),this.bufferCanvas.setSize(S,F),this.bufferHitCanvas.setSize(S,F),this.children.forEac
1h(N=>{N.setSize({width:S,height:F}),N.draw()})}add(S,...F){if(arguments.length>1){for(var N=0;N<arguments.length;N++)this.add(arguments[N]);return this}super.add(S);var et=this.children.length;return et>z&&t.Util.warn("The stage has "+et+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),S.setSize({width:this.width(),height:this.height()}),S.draw(),i.Konva.isBrowser&&this.content.appendChild(S.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(S){return h.hasPointerCapture(S,this)}setPointerCapture(S){h.setPointerCapture(S,this)}releaseCapture(S){h.releaseCapture(S,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&J.forEach(([S,F])=>{this.content.addEventListener(S,N=>{this[F](N)},{passive:!1})})}_pointerenter(S){this.setPointersPositions(S);const F=Y(S.type);F&&this._fire(F.pointerenter,{evt:S,target:this,currentTarget:this})}_pointerover(S){this.setPointersPositions(S);const F=Y(S.type);F&&this._fire(F.pointerover,{evt:S,target:this,currentTarget:this})}_getTargetShape(S){let F=this[S+"targetShape"];return F&&!F.getStage()&&(F=null),F}_pointerleave(S){const F=Y(S.type),N=D(S.type);if(F){this.setPointersPositions(S);var et=this._getTargetShape(N),X=!n.DD.isDragging||i.Konva.hitOnDragEnabled;et&&X?(et._fireAndBubble(F.pointerout,{evt:S}),et._fireAndBubble(F.pointerleave,{evt:S}),this._fire(F.pointerleave,{evt:S,target:this,currentTarget:this}),this[N+"targetShape"]=null):X&&(this._fire(F.pointerleave,{evt:S,target:this,currentTarget:this}),this._fire(F.pointerout,{evt:S,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(S){const F=Y(S.type),N=D(S.type);if(F){this.setPointersPositions(S);var et=!1;this._changedPointerPositions.forEach(X=>{var st=this.getIntersection(X);if(n.DD.justDragged=!1,i.Konva["_"+N+"ListenClick"]=!0,!st||!st.isListening())return;i.Konva.capturePointerEventsEnabled&&st.setPointerCapture(X.id),this[N+"ClickStartShape"]=st,st._fireAndBubble(F.pointerdown,{evt:S,pointerId:X.id}),et=!0;const vt=S.type.indexOf("touch")>=0;st.preventDefault()&&S.cancelable&&vt&&S.preventDefault()}),et||this._fire(F.pointerdown,{evt:S,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(S){const F=Y(S.type),N=D(S.type);if(!F)return;n.DD.isDragging&&n.DD.node.preventDefault()&&S.cancelable&&S.preventDefault(),this.setPointersPositions(S);var et=!n.DD.isDragging||i.Konva.hitOnDragEnabled;if(!et)return;var X={};let st=!1;var vt=this._getTargetShape(N);this._changedPointerPositions.forEach(Mt=>{const tt=h.getCapturedShape(Mt.id)||this.getIntersection(Mt),Jt=Mt.id,Pt={evt:S,pointerId:Jt};var Zt=vt!==tt;if(Zt&&vt&&(vt._fireAndBubble(F.pointerout,{...Pt},tt),vt._fireAndBubble(F.pointerleave,{...Pt},tt)),tt){if(X[tt._id])return;X[tt._id]=!0}tt&&tt.isListening()?(st=!0,Zt&&(tt._fireAndBubble(F.pointerover,{...Pt},vt),tt._fireAndBubble(F.pointerenter,{...Pt},vt),this[N+"targetShape"]=tt),tt._fireAndBubble(F.pointermove,{...Pt})):vt&&(this._fire(F.pointerover,{evt:S,target:this,currentTarget:this,pointerId:Jt}),this[N+"targetShape"]=null)}),st||this._fire(F.pointermove,{evt:S,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(S){const F=Y(S.type),N=D(S.type);if(!F)return;this.setPointersPositions(S);const et=this[N+"ClickStartShape"],X=this[N+"ClickEndShape"];var st={};let vt=!1;this._changedPointerPositions.forEach(Mt=>{const tt=h.getCapturedShape(Mt.id)||this.getIntersection(Mt);if(tt){if(tt.releaseCapture(Mt.id),st[tt._id])return;st[tt._id]=!0}const Jt=Mt.id,Pt={evt:S,pointerId:Jt};let Zt=!1;i.Konva["_"+N+"InDblClickWindow"]?(Zt=!0,clearTimeout(this[N+"DblTimeout"])):n.DD.justDragged||(i.Konva["_"+N+"InDblClickWindow"]=!0,clearTimeout(this[N+"DblTimeout"])),this[N+"DblTimeout"]=setTimeout(function(){i.Konva["_"+N+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),tt&&tt.isListening()?(vt=!0,this[N+"ClickEndShape"]=tt,tt._fireAndBubble(F.pointerup,{...Pt}),i.Konva["_"+N+"ListenClick"]&&et&&et===tt&&(tt._fireAndBubble(F.pointerclick,{...Pt}),Zt&&X&&X===tt&&tt._fireAndBubble(F.pointerdblclick,{...Pt}))):(this[N+"ClickEndShape"]=null,i.Konva["_"+N+"ListenClick"]&&this._fire(F.pointerclick,{evt:S,target:this,currentTarget:this,pointerId:Jt}),Zt&&this._fire(F.pointerdblclick,{evt:S,target:this,currentTarget:this,pointerId:Jt}))}),vt||this._fire(F.pointerup,{evt:S,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+N+"ListenClick"]=!1,S.cancelable&&N!=="touch"&&S.preventDefault()}_contextmenu(S){this.setPointersPositions(S);var F=this.getIntersection(this.getPointerPosition());F&&F.isListening()?F._fireAndBubble(R,{evt:S}):this._fire(R,{evt:S,target:this,currentTarget:this})}_wheel(S){this.setPointersPositions(S);var F=this.getIntersection(this.getPointerPosition());F&&F.isListening()?F._fireAndBubble(H,{evt:S}):this._fire(H,{evt:S,target:this,currentTarget:this})}_pointercancel(S){this.setPointersPositions(S);const F=h.getCapturedShape(S.pointerId)||this.getIntersection(this.getPointerPosition());F&&F._fireAndBubble(y,h.createEvent(S)),h.releaseCapture(S.pointerId)}_lostpointercapture(S){h.releaseCapture(S.pointerId)}setPointersPositions(S){var F=this._getContentPosition(),N=null,et=null;S=S||window.event,S.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(S.touches,X=>{this._pointerPositions.push({id:X.identifier,x:(X.clientX-F.left)/F.scaleX,y:(X.clientY-F.top)/F.scaleY})}),Array.prototype.forEach.call(S.changedTouches||S.touches,X=>{this._changedPointerPositions.push({id:X.identifier,x:(X.clientX-F.left)/F.scaleX,y:(X.clientY-F.top)/F.scaleY})})):(N=(S.clientX-F.left)/F.scaleX,et=(S.clientY-F.top)/F.scaleY,this.pointerPos={x:N,y:et},this._pointerPositions=[{x:N,y:et,id:t.Util._getFirstPointerId(S)}],this._changedPointerPositions=[{x:N,y:et,id:t.Util._getFirstPointerId(S)}])}_setPointerPosition(S){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(S)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var S=this.content.getBoundingClientRect();
1return{top:S.top,left:S.left,scaleX:S.width/this.content.clientWidth||1,scaleY:S.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new a.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new a.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var S=this.container();if(!S)throw"Stage has no container. A container is required.";S.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),S.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(S){S.batchDraw()}),this}}o.Stage=wt,wt.prototype.nodeType=l,(0,s._registerNode)(wt),e.Factory.addGetterSetter(wt,"container")})(ra);var be={},ht={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Shape=o.shapes=void 0;const t=V,e=it,r=B,i=rt,a=G,n=V,s=gt;var h="hasShadow",l="shadowRGBA",u="patternImage",_="linearGradient",v="radialGradient";let f;function c(){return f||(f=e.Util.createCanvasElement().getContext("2d"),f)}o.shapes={};function p(E){const P=this.attrs.fillRule;P?E.fill(P):E.fill()}function m(E){E.stroke()}function C(E){E.fill()}function T(E){E.stroke()}function d(){this._clearCache(h)}function g(){this._clearCache(l)}function y(){this._clearCache(u)}function w(){this._clearCache(_)}function A(){this._clearCache(v)}class b extends i.Node{constructor(P){super(P);let x;for(;x=e.Util.getRandomColor(),!(x&&!(x in o.shapes)););this.colorKey=x,o.shapes[x]=this}getContext(){return e.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return e.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(h,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(u,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var P=c();const x=P.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(x&&x.setTransform){const R=new e.Transform;R.translate(this.fillPatternX(),this.fillPatternY()),R.rotate(t.Konva.getAngle(this.fillPatternRotation())),R.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),R.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const k=R.getMatrix(),M=typeof DOMMatrix>"u"?{a:k[0],b:k[1],c:k[2],d:k[3],e:k[4],f:k[5]}:new DOMMatrix(k);x.setTransform(M)}return x}}_getLinearGradient(){return this._getCache(_,this.__getLinearGradient)}__getLinearGradient(){var P=this.fillLinearGradientColorStops();if(P){for(var x=c(),R=this.fillLinearGradientStartPoint(),k=this.fillLinearGradientEndPoint(),M=x.createLinearGradient(R.x,R.y,k.x,k.y),L=0;L<P.length;L+=2)M.addColorStop(P[L],P[L+1]);return M}}_getRadialGradient(){return this._getCache(v,this.__getRadialGradient)}__getRadialGradient(){var P=this.fillRadialGradientColorStops();if(P){for(var x=c(),R=this.fillRadialGradientStartPoint(),k=this.fillRadialGradientEndPoint(),M=x.createRadialGradient(R.x,R.y,this.fillRadialGradientStartRadius(),k.x,k.y,this.fillRadialGradientEndRadius()),L=0;L<P.length;L+=2)M.addColorStop(P[L],P[L+1]);return M}}getShadowRGBA(){return this._getCache(l,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var P=e.Util.colorToRGBA(this.shadowColor());if(P)return"rgba("+P.r+","+P.g+","+P.b+","+P.a*(this.shadowOpacity()||1)+")"}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const P=this.hitStrokeWidth();return P==="auto"?this.hasStroke():this.strokeEnabled()&&!!P}intersects(P){var x=this.getStage();if(!x)return!1;const R=x.bufferHitCanvas;return R.getContext().clear(),this.drawHit(R,void 0,!0),R.context.getImageData(Math.round(P.x),Math.round(P.y),1,1).data[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete o.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(P){var x;if(!this.getStage()||!((x=this.attrs.perfectDrawEnabled)!==null&&x!==void 0?x:!0))return!1;const k=P||this.hasFill(),M=this.hasStroke(),L=this.getAbsoluteOpacity()!==1;if(k&&M&&L)return!0;const U=this.hasShadow(),H=this.shadowForStrokeEnabled();return!!(k&&M&&U&&H)}setStrokeHitEnabled(P){e.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),P?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var P=this.size();return{x:this._centroid?-P.width/2:0,y:this._centroid?-P.height/2:0,width:P.width,height:P.height}}getClientRect(P={}){const x=P.skipTransform,R=P.relativeTo,k=this.getSelfRect(),L=!P.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,U=k.width+L,H=k.height+L,z=!P.skipShadow&&this.hasShadow(),J=z?this.shadowOffsetX():0,O=z?this.shadowOffsetY():0,D=U+Math.abs(J),Y=H+Math.abs(O),Z=z&&this.shadowBlur()||0,Q=D+Z*2,wt=Y+Z*2,ft={width:Q,height:wt,x:-(L/2+Z)+Math.min(J,0)+k.x,y:-(L/2+Z)+Math.min(O,0)+k.y};return x?ft:this._transformedRect(ft,R)}drawScene(P,x){var R=this.getLayer(),k=P||R.getCanvas(),M=k.getContext(),L=this._getCanvasCache(),U=this.getSceneFunc(),H=this.hasShadow(),z,J,O,D=k.isCache,Y=x===this;if(!this.isVisible()&&!Y)return this;if(L){M.save();var Z=this.getAbsoluteTransform(x).getMatrix();return M.transform(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5]),this._drawCachedSceneCanvas(M),M.restore(
1),this}if(!U)return this;if(M.save(),this._useBufferCanvas()&&!D){z=this.getStage(),J=z.bufferCanvas,O=J.getContext(),O.clear(),O.save(),O._applyLineJoin(this);var Q=this.getAbsoluteTransform(x).getMatrix();O.transform(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5]),U.call(this,O,this),O.restore();var wt=J.pixelRatio;H&&M._applyShadow(this),M._applyOpacity(this),M._applyGlobalCompositeOperation(this),M.drawImage(J._canvas,0,0,J.width/wt,J.height/wt)}else{if(M._applyLineJoin(this),!Y){var Q=this.getAbsoluteTransform(x).getMatrix();M.transform(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5]),M._applyOpacity(this),M._applyGlobalCompositeOperation(this)}H&&M._applyShadow(this),U.call(this,M,this)}return M.restore(),this}drawHit(P,x,R=!1){if(!this.shouldDrawHit(x,R))return this;var k=this.getLayer(),M=P||k.hitCanvas,L=M&&M.getContext(),U=this.hitFunc()||this.sceneFunc(),H=this._getCanvasCache(),z=H&&H.hit;if(this.colorKey||e.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),z){L.save();var J=this.getAbsoluteTransform(x).getMatrix();return L.transform(J[0],J[1],J[2],J[3],J[4],J[5]),this._drawCachedHitCanvas(L),L.restore(),this}if(!U)return this;if(L.save(),L._applyLineJoin(this),!(this===x)){var D=this.getAbsoluteTransform(x).getMatrix();L.transform(D[0],D[1],D[2],D[3],D[4],D[5])}return U.call(this,L,this),L.restore(),this}drawHitFromCache(P=0){var x=this._getCanvasCache(),R=this._getCachedSceneCanvas(),k=x.hit,M=k.getContext(),L=k.getWidth(),U=k.getHeight(),H,z,J,O,D,Y;M.clear(),M.drawImage(R._canvas,0,0,L,U);try{for(H=M.getImageData(0,0,L,U),z=H.data,J=z.length,O=e.Util._hexToRgb(this.colorKey),D=0;D<J;D+=4)Y=z[D+3],Y>P?(z[D]=O.r,z[D+1]=O.g,z[D+2]=O.b,z[D+3]=255):z[D+3]=0;M.putImageData(H,0,0)}catch(Z){e.Util.error("Unable to draw hit graph from cached scene canvas. "+Z.message)}return this}hasPointerCapture(P){return s.hasPointerCapture(P,this)}setPointerCapture(P){s.setPointerCapture(P,this)}releaseCapture(P){s.releaseCapture(P,this)}}o.Shape=b,b.prototype._fillFunc=p,b.prototype._strokeFunc=m,b.prototype._fillFuncHit=C,b.prototype._strokeFuncHit=T,b.prototype._centroid=!1,b.prototype.nodeType="Shape",(0,n._registerNode)(b),b.prototype.eventListeners={},b.prototype.on.call(b.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",d),b.prototype.on.call(b.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),b.prototype.on.call(b.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",y),b.prototype.on.call(b.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),b.prototype.on.call(b.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",A),r.Factory.addGetterSetter(b,"stroke",void 0,(0,a.getStringOrGradientValidator)()),r.Factory.addGetterSetter(b,"strokeWidth",2,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(b,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(b,"hitStrokeWidth","auto",(0,a.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(b,"strokeHitEnabled",!0,(0,a.getBooleanValidator)()),r.Factory.addGetterSetter(b,"perfectDrawEnabled",!0,(0,a.getBooleanValidator)()),r.Factory.addGetterSetter(b,"shadowForStrokeEnabled",!0,(0,a.getBooleanValidator)()),r.Factory.addGetterSetter(b,"lineJoin"),r.Factory.addGetterSetter(b,"lineCap"),r.Factory.addGetterSetter(b,"sceneFunc"),r.Factory.addGetterSetter(b,"hitFunc"),r.Factory.addGetterSetter(b,"dash"),r.Factory.addGetterSetter(b,"dashOffset",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(b,"shadowColor",void 0,(0,a.getStringValidator)()),r.Factory.addGetterSetter(b,"shadowBlur",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(b,"shadowOpacity",1,(0,a.getNumberValidator)()),r.Factory.addComponentsGetterSetter(b,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(b,"shadowOffsetX",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(b,"shadowOffsetY",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(b,"fillPatternImage"),r.Factory.addGetterSetter(b,"fill",void 0,(0,a.getStringOrGradientValidator)()),r.Factory.addGetterSetter(b,"fillPatternX",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(b,"fillPatternY",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(b,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(b,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(b,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(b,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(b,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(b,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(b,"fillEnabled",!0),r.Factory.addGetterSetter(b,"strokeEnabled",!0),r.Factory.addGetterSetter(b,"shadowEnabled",!0),r.Factory.addGetterSetter(b,"dashEnabled",!0),r.Factory.addGetterSetter(b,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(b,"fillPriority","color"),r.Factory.addComponentsGetterSetter(b,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(b,"fillPatternOffsetX",0,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(b,"fillPatternOffsetY",0,(0,a.getNumberValidator)()),r.Factory.addComponentsGetterSetter(b,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(b,"fillPatternScaleX",1,(0,a.getNumberValidator)()),r.Factory.addGetterSetter(b,"fillPatternScaleY",1,(0,a.getNumberValidator)()),r.Factory.addComponentsGetterSetter(b,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(b,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(b,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(b,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(b,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(b,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(b,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(b,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(b,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(b,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(b,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(b,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(b,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(b,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(b,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(b,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(b,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(b,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(b,"fillPatternRotation",0),r.Factory.addGetterSetter(b,"fillRule",void 0,(0,a.getStringValidator)()),r.Factory.backCompat(b,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(ht);
1Object.defineProperty(be,"__esModule",{value:!0});be.Layer=void 0;const Tt=it,Gr=zt,te=rt,Jr=B,Si=mt,xn=G,En=ht,An=V;var Fn="#",kn="beforeDraw",Rn="draw",na=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Mn=na.length;let oe=class extends Gr.Container{constructor(t){super(t),this.canvas=new Si.SceneCanvas,this.hitCanvas=new Si.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){te.Node.prototype.moveToTop.call(this);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var t=te.Node.prototype.moveUp.call(this);if(!t)return!1;var e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(te.Node.prototype.moveDown.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(te.Node.prototype.moveToBottom.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var t=this.getNativeCanvasElement();return te.Node.prototype.remove.call(this),t&&t.parentNode&&Tt.Util._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&Tt.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return t=t||{},t.width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=t.x!==void 0?t.x:this.x(),t.y=t.y!==void 0?t.y:this.y(),te.Node.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Tt.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Tt.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Tt.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,r=!1;;){for(let i=0;i<Mn;i++){const a=na[i],n=this._getIntersection({x:t.x+a.x*e,y:t.y+a.y*e}),s=n.shape;if(s)return s;if(r=!!n.antialiased,!n.antialiased)break}if(r)e+=1;else return null}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,r=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,i=r[3];if(i===255){const a=Tt.Util._rgbToHex(r[0],r[1],r[2]),n=En.shapes[Fn+a];return n?{shape:n}:{antialiased:!0}}else if(i>0)return{antialiased:!0};return{}}drawScene(t,e){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(kn,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),Gr.Container.prototype.drawScene.call(this,i,e),this._fire(Rn,{node:this}),this}drawHit(t,e){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),Gr.Container.prototype.drawHit.call(this,i,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){Tt.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return Tt.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,e=!!this.hitCanvas._canvas.parentNode;e?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return Tt.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};
1be.Layer=oe;oe.prototype.nodeType="Layer";(0,An._registerNode)(oe);Jr.Factory.addGetterSetter(oe,"imageSmoothingEnabled",!0);Jr.Factory.addGetterSetter(oe,"clearBeforeDraw",!0);Jr.Factory.addGetterSetter(oe,"hitGraphEnabled",!0,(0,xn.getBooleanValidator)());var He={};Object.defineProperty(He,"__esModule",{value:!0});He.FastLayer=void 0;const Gn=it,Nn=be,On=V;class Zr extends Nn.Layer{constructor(t){super(t),this.listening(!1),Gn.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}He.FastLayer=Zr;Zr.prototype.nodeType="FastLayer";(0,On._registerNode)(Zr);var he={};Object.defineProperty(he,"__esModule",{value:!0});he.Group=void 0;const Dn=it,Ln=zt,In=V;let ti=class extends Ln.Container{_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&Dn.Util.throw("You may only add groups and shapes to groups.")}};he.Group=ti;ti.prototype.nodeType="Group";(0,In._registerNode)(ti);var le={};Object.defineProperty(le,"__esModule",{value:!0});le.Animation=void 0;const Nr=V,Ci=it,Or=function(){return Nr.glob.performance&&Nr.glob.performance.now?function(){return Nr.glob.performance.now()}:function(){return new Date().getTime()}}();class bt{constructor(t,e){this.id=bt.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Or(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,r=e.length;for(let i=0;i<r;i++)if(e[i]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const e=bt.animations,r=e.length;for(let i=0;i<r;i++)if(e[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=Or(),bt._addAnimation(this),this}stop(){return bt._removeAnimation(this),this}_updateFrameObject(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}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,r=this.animations,i=r.length;for(let a=0;a<i;a++)if(r[a].id===e){this.animations.splice(a,1);break}}static _runFrames(){const t={},e=this.animations;for(let r=0;r<e.length;r++){const i=e[r],a=i.layers,n=i.func;i._updateFrameObject(Or());const s=a.length;let h;if(n?h=n.call(i,i.frame)!==!1:h=!0,!!h)for(let l=0;l<s;l++){const u=a[l];u._id!==void 0&&(t[u._id]=u)}}for(let r in t)t.hasOwnProperty(r)&&t[r].batchDraw()}static _animationLoop(){const t=bt;t.animations.length?(t._runFrames(),Ci.Util.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Ci.Util.requestAnimFrame(this._animationLoop))}}le.Animation=bt;bt.animations=[];bt.animIdCounter=0;bt.animRunning=!1;var sa={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Easings=o.Tween=void 0;const t=it,e=le,r=rt,i=V;var a={node:1,duration:1,easing:1,onFinish:1,yoyo:1},n=1,s=2,h=3,l=0,u=["fill","stroke","shadowColor"];class _{constructor(c,p,m,C,T,d,g){this.prop=c,this.propFunc=p,this.begin=C,this._pos=C,this.duration=d,this._change=0,this.prevPos=0,this.yoyo=g,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=m,this._change=T-this.begin,this.pause()}fire(c){var p=this[c];p&&p()}setTime(c){c>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():c<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=c,this.update())}getTime(){return this._time}setPosition(c){this.prevPos=this._pos,this.propFunc(c),this._pos=c}getPosition(c){return c===void 0&&(c=this._time),this.func(c,this.begin,this._change,this.duration)}play(){this.state=s,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=h,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(c){this.pause(),this._time=c,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}
1onEnterFrame(){var c=this.getTimer()-this._startTime;this.state===s?this.setTime(c):this.state===h&&this.setTime(this.duration-c)}pause(){this.state=n,this.fire("onPause")}getTimer(){return new Date().getTime()}}class v{constructor(c){var p=this,m=c.node,C=m._id,T,d=c.easing||o.Easings.Linear,g=!!c.yoyo,y;typeof c.duration>"u"?T=.3:c.duration===0?T=.001:T=c.duration,this.node=m,this._id=l++;var w=m.getLayer()||(m instanceof i.Konva.Stage?m.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new e.Animation(function(){p.tween.onEnterFrame()},w),this.tween=new _(y,function(A){p._tweenFunc(A)},d,0,1,T*1e3,g),this._addListeners(),v.attrs[C]||(v.attrs[C]={}),v.attrs[C][this._id]||(v.attrs[C][this._id]={}),v.tweens[C]||(v.tweens[C]={});for(y in c)a[y]===void 0&&this._addAttr(y,c[y]);this.reset(),this.onFinish=c.onFinish,this.onReset=c.onReset,this.onUpdate=c.onUpdate}_addAttr(c,p){var m=this.node,C=m._id,T,d,g,y,w,A,b,E;if(g=v.tweens[C][c],g&&delete v.attrs[C][g][c],T=m.getAttr(c),t.Util._isArray(p))if(d=[],w=Math.max(p.length,T.length),c==="points"&&p.length!==T.length&&(p.length>T.length?(b=T,T=t.Util._prepareArrayForTween(T,p,m.closed())):(A=p,p=t.Util._prepareArrayForTween(p,T,m.closed()))),c.indexOf("fill")===0)for(y=0;y<w;y++)if(y%2===0)d.push(p[y]-T[y]);else{var P=t.Util.colorToRGBA(T[y]);E=t.Util.colorToRGBA(p[y]),T[y]=P,d.push({r:E.r-P.r,g:E.g-P.g,b:E.b-P.b,a:E.a-P.a})}else for(y=0;y<w;y++)d.push(p[y]-T[y]);else u.indexOf(c)!==-1?(T=t.Util.colorToRGBA(T),E=t.Util.colorToRGBA(p),d={r:E.r-T.r,g:E.g-T.g,b:E.b-T.b,a:E.a-T.a}):d=p-T;v.attrs[C][this._id][c]={start:T,diff:d,end:p,trueEnd:A,trueStart:b},v.tweens[C][c]=this._id}_tweenFunc(c){var p=this.node,m=v.attrs[p._id][this._id],C,T,d,g,y,w,A,b;for(C in m){if(T=m[C],d=T.start,g=T.diff,b=T.end,t.Util._isArray(d))if(y=[],A=Math.max(d.length,b.length),C.indexOf("fill")===0)for(w=0;w<A;w++)w%2===0?y.push((d[w]||0)+g[w]*c):y.push("rgba("+Math.round(d[w].r+g[w].r*c)+","+Math.round(d[w].g+g[w].g*c)+","+Math.round(d[w].b+g[w].b*c)+","+(d[w].a+g[w].a*c)+")");else for(w=0;w<A;w++)y.push((d[w]||0)+g[w]*c);else u.indexOf(C)!==-1?y="rgba("+Math.round(d.r+g.r*c)+","+Math.round(d.g+g.g*c)+","+Math.round(d.b+g.b*c)+","+(d.a+g.a*c)+")":y=d+g*c;p.setAttr(C,y)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var c=this.node,p=v.attrs[c._id][this._id];p.points&&p.points.trueEnd&&c.setAttr("points",p.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var c=this.node,p=v.attrs[c._id][this._id];p.points&&p.points.trueStart&&c.points(p.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(c){return this.tween.seek(c*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var c=this.node._id,p=this._id,m=v.tweens[c],C;this.pause();for(C in m)delete v.tweens[c][C];delete v.attrs[c][p]}}o.Tween=v,v.attrs={},v.tweens={},r.Node.prototype.to=function(f){var c=f.onFinish;f.node=this,f.onFinish=function(){this.destroy(),c&&c()};var p=new v(f);p.play()},o.Easings={BackEaseIn(f,c,p,m){var C=1.70158;return p*(f/=m)*f*((C+1)*f-C)+c},BackEaseOut(f,c,p,m){var C=1.70158;return p*((f=f/m-1)*f*((C+1)*f+C)+1)+c},BackEaseInOut(f,c,p,m){var C=1.70158;return(f/=m/2)<1?p/2*(f*f*(((C*=1.525)+1)*f-C))+c:p/2*((f-=2)*f*(((C*=1.525)+1)*f+C)+2)+c},ElasticEaseIn(f,c,p,m,C,T){var d=0;return f===0?c:(f/=m)===1?c+p:(T||(T=m*.3),!C||C<Math.abs(p)?(C=p,d=T/4):d=T/(2*Math.PI)*Math.asin(p/C),-(C*Math.pow(2,10*(f-=1))*Math.sin((f*m-d)*(2*Math.PI)/T))+c)},ElasticEaseOut(f,c,p,m,C,T){var d=0;return f===0?c:(f/=m)===1?c+p:(T||(T=m*.3),!C||C<Math.abs(p)?(C=p,d=T/4):d=T/(2*Math.PI)*Math.asin(p/C),C*Math.pow(2,-10*f)*Math.sin((f*m-d)*(2*Math.PI)/T)+p+c)},ElasticEaseInOut(f,c,p,m,C,T){var d=0;return f===0?c:(f/=m/2)===2?c+p:(T||(T=m*(.3*1.5)),!C||C<Math.abs(p)?(C=
1p,d=T/4):d=T/(2*Math.PI)*Math.asin(p/C),f<1?-.5*(C*Math.pow(2,10*(f-=1))*Math.sin((f*m-d)*(2*Math.PI)/T))+c:C*Math.pow(2,-10*(f-=1))*Math.sin((f*m-d)*(2*Math.PI)/T)*.5+p+c)},BounceEaseOut(f,c,p,m){return(f/=m)<1/2.75?p*(7.5625*f*f)+c:f<2/2.75?p*(7.5625*(f-=1.5/2.75)*f+.75)+c:f<2.5/2.75?p*(7.5625*(f-=2.25/2.75)*f+.9375)+c:p*(7.5625*(f-=2.625/2.75)*f+.984375)+c},BounceEaseIn(f,c,p,m){return p-o.Easings.BounceEaseOut(m-f,0,p,m)+c},BounceEaseInOut(f,c,p,m){return f<m/2?o.Easings.BounceEaseIn(f*2,0,p,m)*.5+c:o.Easings.BounceEaseOut(f*2-m,0,p,m)*.5+p*.5+c},EaseIn(f,c,p,m){return p*(f/=m)*f+c},EaseOut(f,c,p,m){return-p*(f/=m)*(f-2)+c},EaseInOut(f,c,p,m){return(f/=m/2)<1?p/2*f*f+c:-p/2*(--f*(f-2)-1)+c},StrongEaseIn(f,c,p,m){return p*(f/=m)*f*f*f*f+c},StrongEaseOut(f,c,p,m){return p*((f=f/m-1)*f*f*f*f+1)+c},StrongEaseInOut(f,c,p,m){return(f/=m/2)<1?p/2*f*f*f*f*f+c:p/2*((f-=2)*f*f*f*f+2)+c},Linear(f,c,p,m){return p*f/m+c}}})(sa);(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.Konva=void 0;const t=V,e=it,r=rt,i=zt,a=ra,n=be,s=He,h=he,l=Be,u=ht,_=le,v=sa,f=Et,c=mt;o.Konva=e.Util._assign(t.Konva,{Util:e.Util,Transform:e.Transform,Node:r.Node,Container:i.Container,Stage:a.Stage,stages:a.stages,Layer:n.Layer,FastLayer:s.FastLayer,Group:h.Group,DD:l.DD,Shape:u.Shape,shapes:u.shapes,Animation:_.Animation,Tween:v.Tween,Easings:v.Easings,Context:f.Context,Canvas:c.Canvas}),o.default=o.Konva})(Ge);var ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.Arc=void 0;const We=B,Un=ht,wi=V,Ke=G,Vn=V;class kt extends Un.Shape{_sceneFunc(t){var e=wi.Konva.getAngle(this.angle()),r=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,r),t.arc(0,0,this.innerRadius(),e,0,!r),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),r=this.clockwise(),i=wi.Konva.getAngle(r?360-this.angle():this.angle()),a=Math.cos(Math.min(i,Math.PI)),n=1,s=Math.sin(Math.min(Math.max(Math.PI,i),3*Math.PI/2)),h=Math.sin(Math.min(i,Math.PI/2)),l=a*(a>0?t:e),u=n*e,_=s*(s>0?t:e),v=h*(h>0?e:t);return{x:l,y:r?-1*v:_,width:u-l,height:v-_}}}ze.Arc=kt;kt.prototype._centroid=!0;kt.prototype.className="Arc";kt.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Vn._registerNode)(kt);We.Factory.addGetterSetter(kt,"innerRadius",0,(0,Ke.getNumberValidator)());We.Factory.addGetterSetter(kt,"outerRadius",0,(0,Ke.getNumberValidator)());We.Factory.addGetterSetter(kt,"angle",0,(0,Ke.getNumberValidator)());We.Factory.addGetterSetter(kt,"clockwise",!1,(0,Ke.getBooleanValidator)());var Ye={},Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.Line=void 0;const Xe=B,Bn=ht,oa=G,$n=V;function zr(o,t,e,r,i,a,n){var s=Math.sqrt(Math.pow(e-o,2)+Math.pow(r-t,2)),h=Math.sqrt(Math.pow(i-e,2)+Math.pow(a-r,2)),l=n*s/(s+h),u=n*h/(s+h),_=e-l*(i-o),v=r-l*(a-t),f=e+u*(i-o),c=r+u*(a-t);return[_,v,f,c]}function Pi(o,t){var e=o.length,r=[],i,a;for(i=2;i<e-2;i+=2)a=zr(o[i-2],o[i-1],o[i],o[i+1],o[i+2],o[i+3],t),!isNaN(a[0])&&(r.push(a[0]),r.push(a[1]),r.push(o[i]),r.push(o[i+1]),r.push(a[2]),r.push(a[3]));return r}let Ot=class extends Bn.Shape{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(t){var e=this.points(),r=e.length,i=this.tension(),a=this.closed(),n=this.bezier(),s,h,l;if(r){if(t.beginPath(),t.moveTo(e[0],e[1]),i!==0&&r>4){for(s=this.getTensionPoints(),h=s.length,l=a?0:4,a||t.quadraticCurveTo(s[0],s[1],s[2],s[3]);l<h-2;)t.bezierCurveTo(s[l++],s[l++],s[l++],s[l++],s[l++],s[l++]);a||t.quadraticCurveTo(s[h-2],s[h-1],e[r-2],e[r-1])}else if(n)for(l=2;l<r;)t.bezierCurveTo(e[l++],e[l++],e[l++],e[l++],e[l++],e[l++]);else for(l=2;l<r;l+=2)t.lineTo(e[l],e[l+1]);a?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Pi(this.points(),this.tension())}_getTensionPointsClosed(){var t=this.points(),e=t.length,r=this.tension(),i=zr(t[e-2],t[e-1],t[0],t[1],t[2],t[3],r),a=zr(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],r),n=Pi(t,r),s=[i[2],i[3]].concat(n).concat([a[0],a[1],t[e-2],t[e-1],a[2],a[3],i[0],i[1],t[0],t[1]]);return s}
1getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};this.tension()!==0?t=[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:t=this.points();for(var e=t[0],r=t[0],i=t[1],a=t[1],n,s,h=0;h<t.length/2;h++)n=t[h*2],s=t[h*2+1],e=Math.min(e,n),r=Math.max(r,n),i=Math.min(i,s),a=Math.max(a,s);return{x:e,y:i,width:r-e,height:a-i}}};Se.Line=Ot;Ot.prototype.className="Line";Ot.prototype._attrsAffectingSize=["points","bezier","tension"];(0,$n._registerNode)(Ot);Xe.Factory.addGetterSetter(Ot,"closed",!1);Xe.Factory.addGetterSetter(Ot,"bezier",!1);Xe.Factory.addGetterSetter(Ot,"tension",0,(0,oa.getNumberValidator)());Xe.Factory.addGetterSetter(Ot,"points",[],(0,oa.getNumberArrayValidator)());var de={},ha={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.t2length=o.getQuadraticArcLength=o.getCubicArcLength=o.binomialCoefficients=o.cValues=o.tValues=void 0,o.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,
1-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],o.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.122555206
171147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],o.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const t=(n,s,h)=>{let l,u,_;l=h/2,u=0;for(let f=0;f<20;f++)_=l*o.tValues[20][f]+l,u+=o.cValues[20][f]*r(n,s,_);return l*u};o.getCubicArcLength=t;const e=(n,s,h)=>{h===void 0&&(h=1);const l=n[0]-2*n[1]+n[2],u=s[0]-2*s[1]+s[2],_=2*n[1]-2*n[0],v=2*s[1]-2*s[0],f=4*(l*l+u*u),c=4*(l*_+u*v),p=_*_+v*v;if(f===0)return h*Math.sqrt(Math.pow(n[2]-n[0],2)+Math.pow(s[2]-s[0],2));const m=c/(2*f),C=p/f,T=h+m,d=C-m*m,g=T*T+d>0?Math.sqrt(T*T+d):0,y=m*m+d>0?Math.sqrt(m*m+d):0,w=m+Math.sqrt(m*m+d)!==0?d*Math.log(Math.abs((T+g)/(m+y))):0;return Math.sqrt(f)/2*(T*g-m*y+w)};o.getQuadraticArcLength=e;function r(n,s,h){const l=i(1,h,n),u=i(1,h,s),_=l*l+u*u;return Math.sqrt(_)}const i=(n,s,h)=>{const l=h.length-1;let u,_;if(l===0)return 0;if(n===0){_=0;for(let v=0;v<=l;v++)_+=o.binomialCoefficients[l][v]*Math.pow(1-s,l-v)*Math.pow(s,v)*h[v];return _}else{u=new Array(l);for(let v=0;v<l;v++)u[v]=l*(h[v+1]-h[v]);return i(n-1,s,u)}},a=(n,s,h)=>{let l=1,u=n/s,_=(n-h(u))/s,v=0;for(;l>.001;){const f=h(u+_),c=Math.abs(n-f)/s;if(c<l)l=c,u+=_;else{const p=h(u-_),m=Math.abs(n-p)/s;m<l?(l=m,u-=_):_/=2}if(v++,v>500)break}return u};o.t2length=a})(ha);Object.defineProperty(de,"__esModule",{value:!0});de.Path=void 0;const Hn=B,zn=ht,Wn=V,ee=ha;let Ce=class ct extends zn.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ct.parsePathData(this.data()),this.pathLength=ct.getPathLength(this.dataArray)}_sceneFunc(t){var e=this.dataArray;t.beginPath();for(var r=!1,i=0;i<e.length;i++){var a=e[i].command,n=e[i].points;switch(a){case"L":t.lineTo(n[0],n[1]);break;case"M":t.moveTo(n[0],n[1]);break;case"C":t.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]);break;case"Q":t.quadraticCurveTo(n[0],n[1],n[2],n[3]);break;case"A":var s=n[0],h=n[1],l=n[2],u=n[3],_=n[4],v=n[5],f=n[6],c=n[7],p=l>u?l:u,m=l>u?1:l/u,C=l>u?u/l:1;t.translate(s,h),t.rotate(f),t.scale(m,C),t.arc(0,0,p,_,_+v,1-c),t.scale(1/m,1/C),t.rotate(-f),t.translate(-s,-h);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(l){if(l.command==="A"){var u=l.points[4],_=l.points[5],v=l.points[4]+_,f=Math.PI/180;
1if(Math.abs(u-v)<f&&(f=Math.abs(u-v)),_<0)for(let c=u-f;c>v;c-=f){const p=ct.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],c,0);t.push(p.x,p.y)}else for(let c=u+f;c<v;c+=f){const p=ct.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],c,0);t.push(p.x,p.y)}}else if(l.command==="C")for(let c=0;c<=1;c+=.01){const p=ct.getPointOnCubicBezier(c,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);t.push(p.x,p.y)}else t=t.concat(l.points)});for(var e=t[0],r=t[0],i=t[1],a=t[1],n,s,h=0;h<t.length/2;h++)n=t[h*2],s=t[h*2+1],isNaN(n)||(e=Math.min(e,n),r=Math.max(r,n)),isNaN(s)||(i=Math.min(i,s),a=Math.max(a,s));return{x:e,y:i,width:r-e,height:a-i}}getLength(){return this.pathLength}getPointAtLength(t){return ct.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,r,i){return Math.sqrt((r-t)*(r-t)+(i-e)*(i-e))}static getPathLength(t){let e=0;for(var r=0;r<t.length;++r)e+=t[r].pathLength;return e}static getPointAtLengthOfDataArray(t,e){var r,i=0,a=e.length;if(!a)return null;for(;i<a&&t>e[i].pathLength;)t-=e[i].pathLength,++i;if(i===a)return r=e[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=e[i].points.slice(0,2),{x:r[0],y:r[1]};var n=e[i],s=n.points;switch(n.command){case"L":return ct.getPointOnLine(t,n.start.x,n.start.y,s[0],s[1]);case"C":return ct.getPointOnCubicBezier((0,ee.t2length)(t,ct.getPathLength(e),p=>(0,ee.getCubicArcLength)([n.start.x,s[0],s[2],s[4]],[n.start.y,s[1],s[3],s[5]],p)),n.start.x,n.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return ct.getPointOnQuadraticBezier((0,ee.t2length)(t,ct.getPathLength(e),p=>(0,ee.getQuadraticArcLength)([n.start.x,s[0],s[2]],[n.start.y,s[1],s[3]],p)),n.start.x,n.start.y,s[0],s[1],s[2],s[3]);case"A":var h=s[0],l=s[1],u=s[2],_=s[3],v=s[4],f=s[5],c=s[6];return v+=f*t/n.pathLength,ct.getPointOnEllipticalArc(h,l,u,_,v,c)}return null}static getPointOnLine(t,e,r,i,a,n,s){n===void 0&&(n=e),s===void 0&&(s=r);var h=(a-r)/(i-e+1e-8),l=Math.sqrt(t*t/(1+h*h));i<e&&(l*=-1);var u=h*l,_;if(i===e)_={x:n,y:s+u};else if((s-r)/(n-e+1e-8)===h)_={x:n+l,y:s+u};else{var v,f,c=this.getLineLength(e,r,i,a),p=(n-e)*(i-e)+(s-r)*(a-r);p=p/(c*c),v=e+p*(i-e),f=r+p*(a-r);var m=this.getLineLength(n,s,v,f),C=Math.sqrt(t*t-m*m);l=Math.sqrt(C*C/(1+h*h)),i<e&&(l*=-1),u=h*l,_={x:v+l,y:f+u}}return _}static getPointOnCubicBezier(t,e,r,i,a,n,s,h,l){function u(m){return m*m*m}function _(m){return 3*m*m*(1-m)}function v(m){return 3*m*(1-m)*(1-m)}function f(m){return(1-m)*(1-m)*(1-m)}var c=h*u(t)+n*_(t)+i*v(t)+e*f(t),p=l*u(t)+s*_(t)+a*v(t)+r*f(t);return{x:c,y:p}}static getPointOnQuadraticBezier(t,e,r,i,a,n,s){function h(f){return f*f}function l(f){return 2*f*(1-f)}function u(f){return(1-f)*(1-f)}var _=n*h(t)+i*l(t)+e*u(t),v=s*h(t)+a*l(t)+r*u(t);return{x:_,y:v}}static getPointOnEllipticalArc(t,e,r,i,a,n){var s=Math.cos(n),h=Math.sin(n),l={x:r*Math.cos(a),y:i*Math.sin(a)};return{x:t+(l.x*s-l.y*h),y:e+(l.x*h+l.y*s)}}static parsePathData(t){if(!t)return[];var e=t,r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var i=0;i<r.length;i++)e=e.replace(new RegExp(r[i],"g"),"|"+r[i]);var a=e.split("|"),n=[],s=[],h=0,l=0,u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,_;for(i=1;i<a.length;i++){var v=a[i],f=v.charAt(0);for(v=v.slice(1),s.length=0;_=u.exec(v);)s.push(_[0]);for(var c=[],p=0,m=s.length;p<m;p++){if(s[p]==="00"){c.push(0,0);continue}var C=parseFloat(s[p]);isNaN(C)?c.push(0):c.push(C)}for(;c.length>0&&!isNaN(c[0]);){var T="",d=[],g=h,y=l,w,A,b,E,P,x,R,k,M,L;switch(f){case"l":h+=c.shift(),l+=c.shift(),T="L",d.push(h,l);break;case"L":h=c.shift(),l=c.shift(),d.push(h,l);break;case"m":var U=c.shift(),H=c.shift();if(h+=U,l+=H,T="M",n.length>2&&n[n.length-1].command==="z"){for(var z=n.length-2;z>=0;z--)if(n[z].command==="M"){h=n[z].points[0]+U,l=n[z].points[1]+H;break}}d.push(h,l),f="l";break;case"M":h=c.shift(),l=c.shift(),T="M",d.push(h,l),f="L";break;case"h":h+=c.shift(),T="L",d.push(h,l);break;case"H":h=c.shift(),T="L",d.push(h,l);break;case"v":l+=c.shift(),T="L",d.push(h,l);break;case"V":l=c.shift(),T="L",d.push(h,l);break;case"C":d.push(c.shift(),c.shift(),c.shift(),c.shift()),h=c.shift(),l=c.shift(),d.push(h,l);break;case"c":d.push(h+c.shift(),l+c.shift(),h+c.shift(),l+c.shift()),h+=c.shift(),l+=c.shift(),T="C",d.push(h,l);break;case"S":A=h,b=l,w=n[n.length-1],w.command==="C"&&(A=h+(h-w.points[2]),b=l+(l-w.points[3])),d.push(A,b,c.shift(),c.shift()),h=c.shift(),l=c.shift(),T="C",d.push(h,l);break;case"s":A=h,b=l,w=n[n.length-1],w.command==="C"&&(A=h+(h-w.points[2]),b=l+(l-w.points[3])),d.push(A,b,h+c.shift(),l+c.shift()),h+=c.shift(),l+=c.shift(),T="C",d.push(h,l);break;case"Q":d.push(c.shift(),c.shift()),h=c.shift(),l=c.shift(),d.push(h,l);break;case"q":d.push(h+c.shift(),l+c.shift()),h+=c.shift(),l+=c.shift(),T="Q",d.push(h,l);break;case"T":A=h,b=l,w=n[n.length-1],w.command==="Q"&&(A=h+(h-w.points[0]),b=l+(l-w.points[1])),h=c.shift(),l=c.shift(),T="Q",d.push(A,b,h,l);break;case"t":A=h,b=l,w=n[n.length-1],w.command==="Q"&&(A=h+(h-w.points[0]),b=l+(l-w.points[1])),h+=c.shift(),l+=c.shift(),T="Q",d.push(A,b,h,l);break;case"A":E=c.shift(),P=c.shift(),x=c.shift(),R=c.shift(),k=c.shift(),M=h,L=l,h=c.shift(),l=c.shift(),T="A",d=this.convertEndpointToCenterParameterization(M,L,h,l,R,k,E,P,x);break;case"a":E=c.shift(),P=c.shift(),x=c.shift(),R=c.shift(),k=c.shift(),M=h,L=l,h+=c.shift(),l+=c.shift(),T="A",d=this.convertEndpointToCenterParameterization(M,L,h,l,R,k,E,P,x);break}n.push({command:T||f,points:d,start:{x:g,y},pathLength:this.calcLength(g,y,T||f,d)})}(f==="z"||f==="Z")&&n.push({command:"z",points:[],start:void 0,pathLength:0})}return n}static calcLength(t,e,r,i){var a,n,s,h,l=ct;switch(r){case"L":return l.getLineLength(t,e,i[0],i[1]);case"C":return(0,ee.getCubicArcLength)([t,i[0],i[2],i[4]],[e,i[1],i[3],i[5]],1);case"Q":return(0,ee.getQuadraticArcLength)([t,i[0],i[2]],[e,i[1],i[3]],1);case"A":a=0;var u=i[4],_=i[5],v=i[4]+_,f=Math.PI/180;
1if(Math.abs(u-v)<f&&(f=Math.abs(u-v)),n=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),_<0)for(h=u-f;h>v;h-=f)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],h,0),a+=l.getLineLength(n.x,n.y,s.x,s.y),n=s;else for(h=u+f;h<v;h+=f)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],h,0),a+=l.getLineLength(n.x,n.y,s.x,s.y),n=s;return s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],v,0),a+=l.getLineLength(n.x,n.y,s.x,s.y),a}return 0}static convertEndpointToCenterParameterization(t,e,r,i,a,n,s,h,l){var u=l*(Math.PI/180),_=Math.cos(u)*(t-r)/2+Math.sin(u)*(e-i)/2,v=-1*Math.sin(u)*(t-r)/2+Math.cos(u)*(e-i)/2,f=_*_/(s*s)+v*v/(h*h);f>1&&(s*=Math.sqrt(f),h*=Math.sqrt(f));var c=Math.sqrt((s*s*(h*h)-s*s*(v*v)-h*h*(_*_))/(s*s*(v*v)+h*h*(_*_)));a===n&&(c*=-1),isNaN(c)&&(c=0);var p=c*s*v/h,m=c*-h*_/s,C=(t+r)/2+Math.cos(u)*p-Math.sin(u)*m,T=(e+i)/2+Math.sin(u)*p+Math.cos(u)*m,d=function(P){return Math.sqrt(P[0]*P[0]+P[1]*P[1])},g=function(P,x){return(P[0]*x[0]+P[1]*x[1])/(d(P)*d(x))},y=function(P,x){return(P[0]*x[1]<P[1]*x[0]?-1:1)*Math.acos(g(P,x))},w=y([1,0],[(_-p)/s,(v-m)/h]),A=[(_-p)/s,(v-m)/h],b=[(-1*_-p)/s,(-1*v-m)/h],E=y(A,b);return g(A,b)<=-1&&(E=Math.PI),g(A,b)>=1&&(E=0),n===0&&E>0&&(E=E-2*Math.PI),n===1&&E<0&&(E=E+2*Math.PI),[C,T,s,h,w,E,u,n]}};de.Path=Ce;Ce.prototype.className="Path";Ce.prototype._attrsAffectingSize=["data"];(0,Wn._registerNode)(Ce);Hn.Factory.addGetterSetter(Ce,"data");Object.defineProperty(Ye,"__esModule",{value:!0});Ye.Arrow=void 0;const je=B,Kn=Se,la=G,Yn=V,Ti=de;class Kt extends Kn.Line{_sceneFunc(t){super._sceneFunc(t);var e=Math.PI*2,r=this.points(),i=r,a=this.tension()!==0&&r.length>4;a&&(i=this.getTensionPoints());var n=this.pointerLength(),s=r.length,h,l;if(a){const v=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],f=Ti.Path.calcLength(i[i.length-4],i[i.length-3],"C",v),c=Ti.Path.getPointOnQuadraticBezier(Math.min(1,1-n/f),v[0],v[1],v[2],v[3],v[4],v[5]);h=r[s-2]-c.x,l=r[s-1]-c.y}else h=r[s-2]-r[s-4],l=r[s-1]-r[s-3];var u=(Math.atan2(l,h)+e)%e,_=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(u),t.moveTo(0,0),t.lineTo(-n,_/2),t.lineTo(-n,-_/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),a?(h=(i[0]+i[2])/2-r[0],l=(i[1]+i[3])/2-r[1]):(h=r[2]-r[0],l=r[3]-r[1]),t.rotate((Math.atan2(-l,-h)+e)%e),t.moveTo(0,0),t.lineTo(-n,_/2),t.lineTo(-n,-_/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x-e,y:t.y-e,width:t.width+e*2,height:t.height+e*2}}}Ye.Arrow=Kt;Kt.prototype.className="Arrow";(0,Yn._registerNode)(Kt);je.Factory.addGetterSetter(Kt,"pointerLength",10,(0,la.getNumberValidator)());je.Factory.addGetterSetter(Kt,"pointerWidth",10,(0,la.getNumberValidator)());je.Factory.addGetterSetter(Kt,"pointerAtBeginning",!1);je.Factory.addGetterSetter(Kt,"pointerAtEnding",!0);var qe={};Object.defineProperty(qe,"__esModule",{value:!0});qe.Circle=void 0;const Xn=B,jn=ht,qn=G,Qn=V;let ce=class extends jn.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};qe.Circle=ce;ce.prototype._centroid=!0;ce.prototype.className="Circle";ce.prototype._attrsAffectingSize=["radius"];(0,Qn._registerNode)(ce);Xn.Factory.addGetterSetter(ce,"radius",0,(0,qn.getNumberValidator)());var Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.Ellipse=void 0;const ei=B,Jn=ht,da=G,Zn=V;class Dt extends Jn.Shape{_sceneFunc(t){var e=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),e!==r&&t.scale(1,r/e),t.arc(0,0,e,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}Qe.Ellipse=Dt;Dt.prototype.className="Ellipse";Dt.prototype._centroid=!0;
1Dt.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Zn._registerNode)(Dt);ei.Factory.addComponentsGetterSetter(Dt,"radius",["x","y"]);ei.Factory.addGetterSetter(Dt,"radiusX",0,(0,da.getNumberValidator)());ei.Factory.addGetterSetter(Dt,"radiusY",0,(0,da.getNumberValidator)());var Je={};Object.defineProperty(Je,"__esModule",{value:!0});Je.Image=void 0;const Dr=it,Yt=B,ts=ht,es=V,we=G;let St=class ca extends ts.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const e=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),a=this.attrs.image;let n;if(a){const s=this.attrs.cropWidth,h=this.attrs.cropHeight;s&&h?n=[a,this.cropX(),this.cropY(),s,h,0,0,e,r]:n=[a,0,0,e,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?Dr.Util.drawRoundedRectPath(t,e,r,i):t.rect(0,0,e,r),t.closePath(),t.fillStrokeShape(this)),a&&(i&&t.clip(),t.drawImage.apply(t,n))}_hitFunc(t){var e=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?Dr.Util.drawRoundedRectPath(t,e,r,i):t.rect(0,0,e,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e;return(t=this.attrs.width)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.width}getHeight(){var t,e;return(t=this.attrs.height)!==null&&t!==void 0?t:(e=this.image())===null||e===void 0?void 0:e.height}static fromURL(t,e,r=null){var i=Dr.Util.createImageElement();i.onload=function(){var a=new ca({image:i});e(a)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};Je.Image=St;St.prototype.className="Image";(0,es._registerNode)(St);Yt.Factory.addGetterSetter(St,"cornerRadius",0,(0,we.getNumberOrArrayOfNumbersValidator)(4));Yt.Factory.addGetterSetter(St,"image");Yt.Factory.addComponentsGetterSetter(St,"crop",["x","y","width","height"]);Yt.Factory.addGetterSetter(St,"cropX",0,(0,we.getNumberValidator)());Yt.Factory.addGetterSetter(St,"cropY",0,(0,we.getNumberValidator)());Yt.Factory.addGetterSetter(St,"cropWidth",0,(0,we.getNumberValidator)());Yt.Factory.addGetterSetter(St,"cropHeight",0,(0,we.getNumberValidator)());var ie={};Object.defineProperty(ie,"__esModule",{value:!0});ie.Tag=ie.Label=void 0;const Ze=B,rs=ht,is=he,ri=G,ua=V;var fa=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],as="Change.konva",ns="none",Wr="up",Kr="right",Yr="down",Xr="left",ss=fa.length;let ii=class extends is.Group{constructor(t){super(t),this.on("add.konva",function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var e=this,r,i=function(){e._sync()};for(r=0;r<ss;r++)t.on(fa[r]+as,i)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var t=this.getText(),e=this.getTag(),r,i,a,n,s,h,l;if(t&&e){switch(r=t.width(),i=t.height(),a=e.pointerDirection(),n=e.pointerWidth(),l=e.pointerHeight(),s=0,h=0,a){case Wr:s=r/2,h=-1*l;break;case Kr:s=r+n,h=i/2;break;case Yr:s=r/2,h=i+l;break;case Xr:s=-1*n,h=i/2;break}e.setAttrs({x:-1*s,y:-1*h,width:r,height:i}),t.setAttrs({x:-1*s,y:-1*h})}}};ie.Label=ii;ii.prototype.className="Label";(0,ua._registerNode)(ii);let Xt=class extends rs.Shape{_sceneFunc(t){var e=this.width(),r=this.height(),i=this.pointerDirection(),a=this.pointerWidth(),n=this.pointerHeight(),s=this.cornerRadius();let h=0,l=0,u=0,_=0;typeof s=="number"?h=l=u=_=Math.min(s,e/2,r/2):(h=Math.min(s[0]||0,e/2,r/2),l=Math.min(s[1]||0,e/2,r/2),_=Math.min(s[2]||0,e/2,r/2),u=Math.min(s[3]||0,e/2,r/2)),t.beginPath(),t.moveTo(h,0),i===Wr&&(t.lineTo((e-a)/2,0),t.lineTo(e/2,-1*n),t.lineTo((e+a)/2,0)),t.lineTo(e-l,0),t.arc(e-l,l,l,Math.PI*3/2,0,!1),i===Kr&&(t.lineTo(e,(r-n)/2),t.lineTo(e+a,r/2),t.lineTo(e,(r+n)/2)),t.lineTo(e,r-_),t.arc(e-_,r-_,_,0,Math.PI/2,!1),i===Yr&&(t.lineTo((e+a)/2,r),t.lineTo(e/2,r+n),t.lineTo((e-a)/2,r)),t.lineTo(u,r),t.arc(u,r-u,u,Math.PI/2,Math.PI,!1),i===Xr&&(t.lineTo(0,(r+n)/2),t.lineTo(-1*a,r/2),t.lineTo(0,(r-n)/2)),t.lineTo(0,h),t.arc(h,h,h,Math.PI,Math.PI*3/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){var t=0,e=0,r=this.pointerWidth(),i=this.pointerHeight(),a=this.pointerDirection(),n=this.width(),s=this.height();return a===Wr?(e-=i,s+=i):a===Yr?s+=i:a===Xr?(t-=r*1.5,n+=r):a===Kr&&(n+=r*1.5),{x:t,y:e,width:n,height:s}}};ie.Tag=Xt;Xt.prototype.className="Tag";(0,ua._registerNode)(Xt);Ze.Factory.addGetterSetter(Xt,"pointerDirection",ns);Ze.Factory.addGetterSetter(Xt,"pointerWidth",0,(0,ri.getNumberValidator)());Ze.Factory.addGetterSetter(Xt,"pointerHeight",0,(0,ri.getNumberValidator)());Ze.Factory.addGetterSetter(Xt,"cornerRadius",0,(0,ri.getNumberOrArrayOfNumbersValidator)(4));var Pe={};
1Object.defineProperty(Pe,"__esModule",{value:!0});Pe.Rect=void 0;const os=B,hs=ht,ls=V,ds=it,cs=G;let tr=class extends hs.Shape{_sceneFunc(t){var e=this.cornerRadius(),r=this.width(),i=this.height();t.beginPath(),e?ds.Util.drawRoundedRectPath(t,r,i,e):t.rect(0,0,r,i),t.closePath(),t.fillStrokeShape(this)}};Pe.Rect=tr;tr.prototype.className="Rect";(0,ls._registerNode)(tr);os.Factory.addGetterSetter(tr,"cornerRadius",0,(0,cs.getNumberOrArrayOfNumbersValidator)(4));var er={};Object.defineProperty(er,"__esModule",{value:!0});er.RegularPolygon=void 0;const ga=B,us=ht,va=G,fs=V;class jt extends us.Shape{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(var r=1;r<e.length;r++)t.lineTo(e[r].x,e[r].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,r=[];for(var i=0;i<t;i++)r.push({x:e*Math.sin(i*2*Math.PI/t),y:-1*e*Math.cos(i*2*Math.PI/t)});return r}getSelfRect(){const t=this._getPoints();var e=t[0].x,r=t[0].y,i=t[0].x,a=t[0].y;return t.forEach(n=>{e=Math.min(e,n.x),r=Math.max(r,n.x),i=Math.min(i,n.y),a=Math.max(a,n.y)}),{x:e,y:i,width:r-e,height:a-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}er.RegularPolygon=jt;jt.prototype.className="RegularPolygon";jt.prototype._centroid=!0;jt.prototype._attrsAffectingSize=["radius"];(0,fs._registerNode)(jt);ga.Factory.addGetterSetter(jt,"radius",0,(0,va.getNumberValidator)());ga.Factory.addGetterSetter(jt,"sides",0,(0,va.getNumberValidator)());var rr={};Object.defineProperty(rr,"__esModule",{value:!0});rr.Ring=void 0;const pa=B,gs=ht,_a=G,vs=V;var xi=Math.PI*2;class qt extends gs.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,xi,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),xi,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}rr.Ring=qt;qt.prototype.className="Ring";qt.prototype._centroid=!0;qt.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,vs._registerNode)(qt);pa.Factory.addGetterSetter(qt,"innerRadius",0,(0,_a.getNumberValidator)());pa.Factory.addGetterSetter(qt,"outerRadius",0,(0,_a.getNumberValidator)());var ir={};Object.defineProperty(ir,"__esModule",{value:!0});ir.Sprite=void 0;const Qt=B,ps=ht,_s=le,ma=G,ms=V;class Ct extends ps.Shape{constructor(t){super(t),this._updated=!0,this.anim=new _s.Animation(()=>{var e=this._updated;return this._updated=!1,e}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var e=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[e],n=this.frameOffsets(),s=a[i+0],h=a[i+1],l=a[i+2],u=a[i+3],_=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,l,u),t.closePath(),t.fillStrokeShape(this)),_)if(n){var v=n[e],f=r*2;t.drawImage(_,s,h,l,u,v[f+0],v[f+1],l,u)}else t.drawImage(_,s,h,l,u,0,0,l,u)}_hitFunc(t){var e=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[e],n=this.frameOffsets(),s=a[i+2],h=a[i+3];if(t.beginPath(),n){var l=n[e],u=r*2;t.rect(l[u+0],l[u+1],s,h)}else t.rect(0,0,s,h);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),e=this.animation(),r=this.animations(),i=r[e],a=i.length/4;t<a-1?this.frameIndex(t+1):this.frameIndex(0)}}ir.Sprite=Ct;Ct.prototype.className="Sprite";(0,ms._registerNode)(Ct);Qt.Factory.addGetterSetter(Ct,"animation");Qt.Factory.addGetterSetter(Ct,"animations");Qt.Factory.addGetterSetter(Ct,"frameOffsets");Qt.Factory.addGetterSetter(Ct,"image");Qt.Factory.addGetterSetter(Ct,"frameIndex",0,(0,ma.getNumberValidator)());Qt.Factory.addGetterSetter(Ct,"frameRate",17,(0,ma.getNumberValidator)());Qt.Factory.backCompat(Ct,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var ar={};
1Object.defineProperty(ar,"__esModule",{value:!0});ar.Star=void 0;const ai=B,ys=ht,ni=G,bs=V;class Lt extends ys.Shape{_sceneFunc(t){var e=this.innerRadius(),r=this.outerRadius(),i=this.numPoints();t.beginPath(),t.moveTo(0,0-r);for(var a=1;a<i*2;a++){var n=a%2===0?r:e,s=n*Math.sin(a*Math.PI/i),h=-1*n*Math.cos(a*Math.PI/i);t.lineTo(s,h)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}ar.Star=Lt;Lt.prototype.className="Star";Lt.prototype._centroid=!0;Lt.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,bs._registerNode)(Lt);ai.Factory.addGetterSetter(Lt,"numPoints",5,(0,ni.getNumberValidator)());ai.Factory.addGetterSetter(Lt,"innerRadius",0,(0,ni.getNumberValidator)());ai.Factory.addGetterSetter(Lt,"outerRadius",0,(0,ni.getNumberValidator)());var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.Text=Ht.stringToArray=void 0;const jr=it,dt=B,Ss=ht,It=G,Cs=V;function ya(o){return Array.from(o)}Ht.stringToArray=ya;var re="auto",ws="center",ba="inherit",ue="justify",Ps="Change.konva",Ts="2d",Ei="-",Sa="left",xs="text",Es="Text",As="top",Fs="bottom",Ai="middle",Ca="normal",ks="px ",Ae=" ",Rs="right",Fi="rtl",Ms="word",Gs="char",ki="none",Lr="…",wa=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],Ns=wa.length;function Os(o){return o.split(",").map(t=>{t=t.trim();const e=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!r&&(t=`"${t}"`),t}).join(", ")}var Fe;function Ir(){return Fe||(Fe=jr.Util.createCanvasElement().getContext(Ts),Fe)}function Ds(o){o.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Ls(o){o.setAttr("miterLimit",2),o.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Is(o){return o=o||{},!o.fillLinearGradientColorStops&&!o.fillRadialGradientColorStops&&!o.fillPatternImage&&(o.fill=o.fill||"black"),o}let nt=class extends Ss.Shape{constructor(t){super(Is(t)),this._partialTextX=0,this._partialTextY=0;for(var e=0;e<Ns;e++)this.on(wa[e]+Ps,this._setTextData);this._setTextData()}_sceneFunc(t){var e=this.textArr,r=e.length;if(this.text()){var i=this.padding(),a=this.fontSize(),n=this.lineHeight()*a,s=this.verticalAlign(),h=this.direction(),l=0,u=this.align(),_=this.getWidth(),v=this.letterSpacing(),f=this.fill(),c=this.textDecoration(),p=c.indexOf("underline")!==-1,m=c.indexOf("line-through")!==-1,C;h=h===ba?t.direction:h;var T=0,T=n/2,d=0,g=0;for(h===Fi&&t.setAttr("direction",h),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",Ai),t.setAttr("textAlign",Sa),s===Ai?l=(this.getHeight()-r*n-i*2)/2:s===Fs&&(l=this.getHeight()-r*n-i*2),t.translate(i,l+i),C=0;C<r;C++){var d=0,g=0,y=e[C],w=y.text,A=y.width,b=y.lastInParagraph,E,P,x;if(t.save(),u===Rs?d+=_-A-i*2:u===ws&&(d+=(_-A-i*2)/2),p){t.save(),t.beginPath(),t.moveTo(d,T+g+Math.round(a/2)),E=w.split(" ").length-1,P=E===0,x=u===ue&&!b?_-i*2:A,t.lineTo(d+Math.round(x),T+g+Math.round(a/2)),t.lineWidth=a/15;const H=this._getLinearGradient();t.strokeStyle=H||f,t.stroke(),t.restore()}if(m){t.save(),t.beginPath(),t.moveTo(d,T+g),E=w.split(" ").length-1,P=E===0,x=u===ue&&b&&!P?_-i*2:A,t.lineTo(d+Math.round(x),T+g),t.lineWidth=a/15;const H=this._getLinearGradient();t.strokeStyle=H||f,t.stroke(),t.restore()}if(h!==Fi&&(v!==0||u===ue)){E=w.split(" ").length-1;for(var R=ya(w),k=0;k<R.length;k++){var M=R[k];M===" "&&!b&&u===ue&&(d+=(_-i*2-A)/E),this._partialTextX=d,this._partialTextY=T+g,this._partialText=M,t.fillStrokeShape(this),d+=this.measureSize(M).width+v}}else v!==0&&t.setAttr("letterSpacing",`${v}px`),this._partialTextX=d,this._partialTextY=T+g,this._partialText=w,t.fillStrokeShape(this);t.restore(),r>1&&(T+=n)}}}_hitFunc(t){var e=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,e,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var e=jr.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(xs,e),this}getWidth(){var t=this.attrs.width===re||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}
1getHeight(){var t=this.attrs.height===re||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return jr.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e=Ir(),r=this.fontSize(),i;return e.save(),e.font=this._getContextFont(),i=e.measureText(t),e.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Ae+this.fontVariant()+Ae+(this.fontSize()+ks)+Os(this.fontFamily())}_addTextLine(t){this.align()===ue&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var e=this.letterSpacing(),r=t.length;return Ir().measureText(t).width+(r?e*(r-1):0)}_setTextData(){var t=this.text().split(` 2`),e=+this.fontSize(),r=0,i=this.lineHeight()*e,a=this.attrs.width,n=this.attrs.height,s=a!==re&&a!==void 0,h=n!==re&&n!==void 0,l=this.padding(),u=a-l*2,_=n-l*2,v=0,f=this.wrap(),c=f!==ki,p=f!==Gs&&c,m=this.ellipsis();this.textArr=[],Ir().font=this._getContextFont();for(var C=m?this._getTextWidth(Lr):0,T=0,d=t.length;T<d;++T){var g=t[T],y=this._getTextWidth(g);if(s&&y>u)for(;g.length>0;){for(var w=0,A=g.length,b="",E=0;w<A;){var P=w+A>>>1,x=g.slice(0,P+1),R=this._getTextWidth(x)+C;R<=u?(w=P+1,b=x,E=R):A=P}if(b){if(p){var k,M=g[b.length],L=M===Ae||M===Ei;L&&E<=u?k=b.length:k=Math.max(b.lastIndexOf(Ae),b.lastIndexOf(Ei))+1,k>0&&(w=k,b=b.slice(0,w),E=this._getTextWidth(b))}b=b.trimRight(),this._addTextLine(b),r=Math.max(r,E),v+=i;var U=this._shouldHandleEllipsis(v);if(U){this._tryToAddEllipsisToLastLine();break}if(g=g.slice(w),g=g.trimLeft(),g.length>0&&(y=this._getTextWidth(g),y<=u)){this._addTextLine(g),v+=i,r=Math.max(r,y);break}}else break}else this._addTextLine(g),v+=i,r=Math.max(r,y),this._shouldHandleEllipsis(v)&&T<d-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),h&&v+i>_)break}this.textHeight=e,this.textWidth=r}_shouldHandleEllipsis(t){var e=+this.fontSize(),r=this.lineHeight()*e,i=this.attrs.height,a=i!==re&&i!==void 0,n=this.padding(),s=i-n*2,h=this.wrap(),l=h!==ki;return!l||a&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,e=t!==re&&t!==void 0,r=this.padding(),i=t-r*2,a=this.ellipsis(),n=this.textArr[this.textArr.length-1];if(!(!n||!a)){if(e){var s=this._getTextWidth(n.text+Lr)<i;s||(n.text=n.text.slice(0,n.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(n.text+Lr)}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,e=this.hasShadow();return t&&e?!0:super._useBufferCanvas()}};Ht.Text=nt;nt.prototype._fillFunc=Ds;nt.prototype._strokeFunc=Ls;nt.prototype.className=Es;nt.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];(0,Cs._registerNode)(nt);dt.Factory.overWriteSetter(nt,"width",(0,It.getNumberOrAutoValidator)());dt.Factory.overWriteSetter(nt,"height",(0,It.getNumberOrAutoValidator)());dt.Factory.addGetterSetter(nt,"direction",ba);dt.Factory.addGetterSetter(nt,"fontFamily","Arial");dt.Factory.addGetterSetter(nt,"fontSize",12,(0,It.getNumberValidator)());dt.Factory.addGetterSetter(nt,"fontStyle",Ca);dt.Factory.addGetterSetter(nt,"fontVariant",Ca);dt.Factory.addGetterSetter(nt,"padding",0,(0,It.getNumberValidator)());dt.Factory.addGetterSetter(nt,"align",Sa);dt.Factory.addGetterSetter(nt,"verticalAlign",As);dt.Factory.addGetterSetter(nt,"lineHeight",1,(0,It.getNumberValidator)());dt.Factory.addGetterSetter(nt,"wrap",Ms);dt.Factory.addGetterSetter(nt,"ellipsis",!1,(0,It.getBooleanValidator)());dt.Factory.addGetterSetter(nt,"letterSpacing",0,(0,It.getNumberValidator)());dt.Factory.addGetterSetter(nt,"text","",(0,It.getStringValidator)());dt.Factory.addGetterSetter(nt,"textDecoration","");var nr={};Object.defineProperty(nr,"__esModule",{value:!0});nr.TextPath=void 0;const Ur=it,yt=B,Us=ht,fe=de,Vr=Ht,Pa=G,Vs=V;var Bs="",Ta="normal";function xa(o){o.fillText(this.partialText,0,0)}function Ea(o){o.strokeText(this.partialText,0,0)}class lt extends Us.Shape{constructor(t){super(t),this.dummyCanvas=Ur.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncCh
2ange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return fe.Path.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;const e=this.pathLength;return t-1>e?null:fe.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=fe.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),r=this.fill(),i=this.fontSize(),a=this.glyphInfo;e==="underline"&&t.beginPath();for(var n=0;n<a.length;n++){t.save();var s=a[n].p0;t.translate(s.x,s.y),t.rotate(a[n].rotation),this.partialText=a[n].text,t.fillStrokeShape(this),e==="underline"&&(n===0&&t.moveTo(0,i/2+1),t.lineTo(i,i/2+1)),t.restore()}e==="underline"&&(t.strokeStyle=r,t.lineWidth=i/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var r=e[0].p0;t.moveTo(r.x,r.y)}for(var i=0;i<e.length;i++){var a=e[i].p1;t.lineTo(a.x,a.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Ur.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return Vr.Text.prototype.setText.call(this,t)}_getContextFont(){return Vr.Text.prototype._getContextFont.call(this)}_getTextSize(t){var e=this.dummyCanvas,r=e.getContext("2d");r.save(),r.font=this._getContextFont();var i=r.measureText(t);return r.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const r=this.letterSpacing(),i=this.align(),a=this.kerningFunc(),n=Math.max(this.textWidth+((this.attrs.text||"").length-1)*r,0);let s=0;i==="center"&&(s=Math.max(0,this.pathLength/2-n/2)),i==="right"&&(s=Math.max(0,this.pathLength-n));const h=(0,Vr.stringToArray)(this.text());let l=s;for(var u=0;u<h.length;u++){const _=this._getPointAtLength(l);if(!_)return;let v=this._getTextSize(h[u]).width+r;if(h[u]===" "&&i==="justify"){const T=this.text().split(" ").length-1;v+=(this.pathLength-n)/T}const f=this._getPointAtLength(l+v);if(!f)return;const c=fe.Path.getLineLength(_.x,_.y,f.x,f.y);let p=0;if(a)try{p=a(h[u-1],h[u])*this.fontSize()}catch{p=0}_.x+=p,f.x+=p,this.textWidth+=p;const m=fe.Path.getPointOnLine(p+c/2,_.x,_.y,f.x,f.y),C=Math.atan2(f.y-_.y,f.x-_.x);this.glyphInfo.push({transposeX:m.x,transposeY:m.y,text:h[u],rotation:C,p0:_,p1:f}),l+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var t=[];this.glyphInfo.forEach(function(u){t.push(u.p0.x),t.push(u.p0.y),t.push(u.p1.x),t.push(u.p1.y)});for(var e=t[0]||0,r=t[0]||0,i=t[1]||0,a=t[1]||0,n,s,h=0;h<t.length/2;h++)n=t[h*2],s=t[h*2+1],e=Math.min(e,n),r=Math.max(r,n),i=Math.min(i,s),a=Math.max(a,s);var l=this.fontSize();return{x:e-l/2,y:i-l/2,width:r-e+l,height:a-i+l}}destroy(){return Ur.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}nr.TextPath=lt;lt.prototype._fillFunc=xa;lt.prototype._strokeFunc=Ea;lt.prototype._fillFuncHit=xa;lt.prototype._strokeFuncHit=Ea;lt.prototype.className="TextPath";lt.prototype._attrsAffectingSize=["text","fontSize","data"];(0,Vs._registerNode)(lt);yt.Factory.addGetterSetter(lt,"data");yt.Factory.addGetterSetter(lt,"fontFamily","Arial");yt.Factory.addGetterSetter(lt,"fontSize",12,(0,Pa.getNumberValidator)());yt.Factory.addGetterSetter(lt,"fontStyle",Ta);yt.Factory.addGetterSetter(lt,"align","left");yt.Factory.addGetterSetter(lt,"letterSpacing",0,(0,Pa.getNumberValidator)());yt.Factory.addGetterSetter(lt,"textBaseline","middle");yt.Factory.addGetterSetter(lt,"fontVariant",Ta);yt.Factory.addGetterSetter(lt,"text",Bs);yt.Factory.addGetterSetter(lt,"textDecoration",null);yt.Factory.addGetterSetter(lt,"kerningFunc",null);var sr={};
2Object.defineProperty(sr,"__esModule",{value:!0});sr.Transformer=void 0;const j=it,K=B,Ri=rt,$s=ht,Hs=Pe,Mi=he,_t=V,Ut=G,zs=V;var Aa="tr-konva",Ws=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(o=>o+`.${Aa}`).join(" "),Gi="nodesRect",Ks=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Ys={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const Xs="ontouchstart"in _t.Konva._global;function js(o,t,e){if(o==="rotater")return e;t+=j.Util.degToRad(Ys[o]||0);var r=(j.Util.radToDeg(t)%360+360)%360;return j.Util._inRange(r,315+22.5,360)||j.Util._inRange(r,0,22.5)?"ns-resize":j.Util._inRange(r,45-22.5,45+22.5)?"nesw-resize":j.Util._inRange(r,90-22.5,90+22.5)?"ew-resize":j.Util._inRange(r,135-22.5,135+22.5)?"nwse-resize":j.Util._inRange(r,180-22.5,180+22.5)?"ns-resize":j.Util._inRange(r,225-22.5,225+22.5)?"nesw-resize":j.Util._inRange(r,270-22.5,270+22.5)?"ew-resize":j.Util._inRange(r,315-22.5,315+22.5)?"nwse-resize":(j.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var Oe=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],Ni=1e8;function qs(o){return{x:o.x+o.width/2*Math.cos(o.rotation)+o.height/2*Math.sin(-o.rotation),y:o.y+o.height/2*Math.cos(o.rotation)+o.width/2*Math.sin(o.rotation)}}function Fa(o,t,e){const r=e.x+(o.x-e.x)*Math.cos(t)-(o.y-e.y)*Math.sin(t),i=e.y+(o.x-e.x)*Math.sin(t)+(o.y-e.y)*Math.cos(t);return{...o,rotation:o.rotation+t,x:r,y:i}}function Qs(o,t){const e=qs(o);return Fa(o,t,e)}function Js(o,t,e){let r=t;for(let i=0;i<o.length;i++){const a=_t.Konva.getAngle(o[i]),n=Math.abs(a-t)%(Math.PI*2);Math.min(n,Math.PI*2-n)<e&&(r=a)}return r}class W extends Mi.Group{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Ws,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return j.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Aa+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter(i=>i.isAncestorOf(this)?(j.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=e,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const a=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},n=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(n,a),i.on(Ks.map(s=>s+`.${this._getEventNamespace()}`).join(" "),a),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,a),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,r=>{e=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!e)return;const i=t.getAbsolutePosition(),a=i.x-e.x,n=i.y-e.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const h=s.getAbsolutePosition();s.setAbsolutePosition({x:h.x+a,y:h.y+n}),s.startDrag(r)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}
2detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Gi),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Gi,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=t.getAbsoluteScale(r),n=t.getAbsolutePosition(r),s=i.x*a.x-t.offsetX()*a.x,h=i.y*a.y-t.offsetY()*a.y;const l=(_t.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),u={x:n.x+s*Math.cos(l)+h*Math.sin(-l),y:n.y+h*Math.cos(l)+s*Math.sin(l),width:i.width*a.x,height:i.height*a.y,rotation:l};return Fa(u,-_t.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-Ni,y:-Ni,width:0,height:0,rotation:0};const e=[];this.nodes().map(l=>{const u=l.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var _=[{x:u.x,y:u.y},{x:u.x+u.width,y:u.y},{x:u.x+u.width,y:u.y+u.height},{x:u.x,y:u.y+u.height}],v=l.getAbsoluteTransform();_.forEach(function(f){var c=v.point(f);e.push(c)})});const r=new j.Transform;r.rotate(-_t.Konva.getAngle(this.rotation()));var i=1/0,a=1/0,n=-1/0,s=-1/0;e.forEach(function(l){var u=r.point(l);i===void 0&&(i=n=u.x,a=s=u.y),i=Math.min(i,u.x),a=Math.min(a,u.y),n=Math.max(n,u.x),s=Math.max(s,u.y)}),r.invert();const h=r.point({x:i,y:a});return{x:h.x,y:h.y,width:n-i,height:s-a,rotation:_t.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Oe.forEach(t=>{this._createAnchor(t)}),this._createAnchor("rotater")}_createAnchor(t){var e=new Hs.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Xs?10:"auto"}),r=this;e.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),e.on("dragstart",i=>{e.stopDrag(),i.cancelBubble=!0}),e.on("dragend",i=>{i.cancelBubble=!0}),e.on("mouseenter",()=>{var i=_t.Konva.getAngle(this.rotation()),a=this.rotateAnchorCursor(),n=js(t,i,a);e.getStage().content&&(e.getStage().content.style.cursor=n),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){var t=new $s.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e,r){var i=r.getParent(),a=i.padding();e.beginPath(),e.rect(-a,-a,r.width()+a*2,r.height()+a*2),e.moveTo(r.width()/2,-a),i.rotateEnabled()&&e.lineTo(r.width()/2,-i.rotateAnchorOffset()*j.Util._sign(r.height())-a),e.fillStrokeShape(r)},hitFunc:(e,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();e.beginPath(),e.rect(-i,-i,r.width()+i*2,r.height()+i*2),e.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",e=>{e.cancelBubble=!0}),t.on("dragmove",e=>{e.cancelBubble=!0}),t.on("dragend",e=>{e.cancelBubble=!0}),this.on("dragmove",e=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var e=this._getNodeRect(),r=e.width,i=e.height,a=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/a),this.cos=Math.abs(r/a),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var n=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-n.x,y:s.y-n.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(h=>{h._fire("transformstart",{evt:t.evt,target:h})})}_handleMouseMove(t){var e,r,i,a=this.findOne("."+this._movingAnchorName),n=a.getStage();n.setPointersPositions(t);const s=n.getPointerPosition();let h={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const l=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(h=this.anchorDragBoundFunc()(l,h,t)),a.setAbsolutePosition(h);const u=a.getAbsolutePosition();if(!(l.x===u.x&&l.y===u.y)){if(this._movingAnchorName==="rotater"){var _=this._getNodeRect();e=a.x()-_.width/2,r=-a.y()+_.height/2;let k=Math.atan2(-r,e)+Math.PI/2;_.height<0&&(k-=Math.PI);var v=_t.Konva.getAngle(this.rotation());const M=v+k,L=_t.Konva.getAngle(this.rotationSnapTolerance()),H=Js(this.rotationSnaps(),M,L)-_.rotation,z=Qs(_,H);this._fitNodesInto(z,t);return}var f=this.shiftBehavior(),c;f==="inverted"?c=this.keepRatio()&&!t.shiftKey:f==="none"?c=this.keepRatio():c=this.keepRatio()||t.shiftKey;var d=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(c){var p=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(p.x-a.x(),2)+Math.pow(p.y-a.y(),2));var m=this.findOne(".top-left").x()>p.x?-1:1,C=this.findOne(".top-left").y()>p.y?-1:1;e=i*this.cos*m,r=i*this.sin*C,this.findOne(".top-left").x(p.x-e),this.findOne(".top-left").y(p.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(c){var p=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(a.x()-p.x,2)+Math.pow(p.y-a.y(),2));var m=this.findOne(".top-right").x()<p.x?-1:1,C=this.findOne(".top-right").y()>p.y?-1:1;e=i*this.cos*m,r=i*this.sin*C,this.findOne(".top-right").x(p.x+e),this.findOne(".top-right").y(p.y-r)}var T=a.position();this.findOne(".top-left").y(T.y),this.findOne(".bottom-right").x(T.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(c){var p=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(p.x-a.x(),2)+Math.pow(a.y()-p.y,2));var m=p.x<a.x()?-1:1,C=a.y()<p.y?-1:1;e=i*this.cos*m,r=i*this.sin*C,a.x(p.x-e),a.y(p.y+r)}T=a.position(),this.findOne(".top-left").x(T.x),this.findOne(".bottom-right").y(T.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(a.y());else if(this._movingAnchorName==="bottom-right"){if(c){var p=d?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};i=Math.sqrt(Math.pow(a.x()-p.x,2)+Math.pow(a.y()-p.y,2));var m=this.findOne(".bottom-right").x()<p.x?-1:1,C=this.findOne(".bottom-right").y()<p.y?-1:1;e=i*this.cos*m,r=i*this.sin*C,this.findOne(".bottom-right").x(p.x+e),this.findOne(".bottom-right").y(p.y+r)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var d=this.centeredScaling()||t.altKey;if(d){var g=this.findOne(".top-left"),y=this.findOne(".bottom-right"),w=g.x(),A=g.y(),b=this.getWidth()-y.x(),E=this.getHeight()-y.y();y.move({x:-w,y:-A}),g.move({x:b,y:E}
2)}var P=this.findOne(".top-left").getAbsolutePosition();e=P.x,r=P.y;var x=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),R=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:r,width:x,height:R,rotation:_t.Konva.getAngle(this.rotation())},t)}}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var e=this.getNode();this._fire("transformend",{evt:t,target:e}),e&&this._nodes.forEach(r=>{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,e){var r=this._getNodeRect();const i=1;if(j.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(j.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}var a=new j.Transform;if(a.rotate(_t.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const v=a.point({x:-this.padding()*2,y:0});t.x+=v.x,t.y+=v.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=v.x,this._anchorDragOffset.y-=v.y}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const v=a.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=v.x,this._anchorDragOffset.y-=v.y,t.width+=this.padding()*2}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const v=a.point({x:0,y:-this.padding()*2});t.x+=v.x,t.y+=v.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=v.x,this._anchorDragOffset.y-=v.y,t.height+=this.padding()*2}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const v=a.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=v.x,this._anchorDragOffset.y-=v.y,t.height+=this.padding()*2}if(this.boundBoxFunc()){const v=this.boundBoxFunc()(r,t);v?t=v:j.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const n=1e7,s=new j.Transform;s.translate(r.x,r.y),s.rotate(r.rotation),s.scale(r.width/n,r.height/n);const h=new j.Transform,l=t.width/n,u=t.height/n;this.flipEnabled()===!1?(h.translate(t.x,t.y),h.rotate(t.rotation),h.translate(t.width<0?t.width:0,t.height<0?t.height:0),h.scale(Math.abs(l),Math.abs(u))):(h.translate(t.x,t.y),h.rotate(t.rotation),h.scale(l,u));const _=h.multiply(s.invert());this._nodes.forEach(v=>{var f;const c=v.getParent().getAbsoluteTransform(),p=v.getTransform().copy();p.translate(v.offsetX(),v.offsetY());const m=new j.Transform;
2m.multiply(c.copy().invert()).multiply(_).multiply(c).multiply(p);const C=m.decompose();v.setAttrs(C),this._fire("transform",{evt:e,target:v}),v._fire("transform",{evt:e,target:v}),(f=v.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(j.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t,e=this._getNodeRect();this.rotation(j.Util._getRotation(e.rotation));var r=e.width,i=e.height,a=this.enabledAnchors(),n=this.resizeEnabled(),s=this.padding(),h=this.anchorSize();const l=this.find("._anchor");l.forEach(_=>{_.setAttrs({width:h,height:h,offsetX:h/2,offsetY:h/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:h/2+s,offsetY:h/2+s,visible:n&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:h/2+s,visible:n&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:h/2-s,offsetY:h/2+s,visible:n&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:h/2+s,visible:n&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:h/2-s,visible:n&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:h/2+s,offsetY:h/2-s,visible:n&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:h/2-s,visible:n&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:h/2-s,offsetY:h/2-s,visible:n&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*j.Util._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const u=this.anchorStyleFunc();u&&l.forEach(_=>{u(_)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Mi.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Ri.Node.prototype.toObject.call(this)}clone(t){var e=Ri.Node.prototype.clone.call(this,t);return e}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}sr.Transformer=W;function Zs(o){return o instanceof Array||j.Util.warn("enabledAnchors value should be an array"),o instanceof Array&&o.forEach(function(t){Oe.indexOf(t)===-1&&j.Util.warn("Unknown anchor name: "+t+". Available names are: "+Oe.join(", "))}),o||[]}W.prototype.className="Transformer";(0,zs._registerNode)(W);K.Factory.addGetterSetter(W,"enabledAnchors",Oe,Zs);K.Factory.addGetterSetter(W,"flipEnabled",!0,(0,Ut.getBooleanValidator)());K.Factory.addGetterSetter(W,"resizeEnabled",!0);K.Factory.addGetterSetter(W,"anchorSize",10,(0,Ut.getNumberValidator)());K.Factory.addGetterSetter(W,"rotateEnabled",!0);K.Factory.addGetterSetter(W,"rotationSnaps",[]);K.Factory.addGetterSetter(W,"rotateAnchorOffset",50,(0,Ut.getNumberValidator)());K.Factory.addGetterSetter(W,"rotateAnchorCursor","crosshair");K.Factory.addGetterSetter(W,"rotationSnapTolerance",5,(0,Ut.getNumberValidator)());K.Factory.addGetterSetter(W,"borderEnabled",!0);K.Factory.addGetterSetter(W,"anchorStroke","rgb(0, 161, 255)");K.Factory.addGetterSetter(W,"anchorStrokeWidth",1,(0,Ut.getNumberValidator)());K.Factory.addGetterSetter(W,"anchorFill","white");K.Factory.addGetterSetter(W,"anchorCornerRadius",0,(0,Ut.getNumberValidator)());K.Factory.addGetterSetter(W,"borderStroke","rgb(0, 161, 255)");K.Factory.addGetterSetter(W,"borderStrokeWidth",1,(0,Ut.getNumberValidator)());K.Factory.addGetterSetter(W,"borderDash");K.Factory.addGetterSetter(W,"keepRatio",!0);K.Factory.addGetterSetter(W,"shiftBehavior","default");K.Factory.addGetterSetter(W,"centeredScaling",!1);K.Factory.addGetterSetter(W,"ignoreStroke",!1);K.Factory.addGetterSetter(W,"padding",0,(0,Ut.getNumberValidator)());K.Factory.addGetterSetter(W,"node");K.Factory.addGetterSetter(W,"nodes");
2K.Factory.addGetterSetter(W,"boundBoxFunc");K.Factory.addGetterSetter(W,"anchorDragBoundFunc");K.Factory.addGetterSetter(W,"anchorStyleFunc");K.Factory.addGetterSetter(W,"shouldOverdrawWholeArea",!1);K.Factory.addGetterSetter(W,"useSingleNodeRotation",!0);K.Factory.backCompat(W,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var or={};Object.defineProperty(or,"__esModule",{value:!0});or.Wedge=void 0;const hr=B,to=ht,eo=V,ka=G,ro=V;class Rt extends to.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,eo.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}or.Wedge=Rt;Rt.prototype.className="Wedge";Rt.prototype._centroid=!0;Rt.prototype._attrsAffectingSize=["radius"];(0,ro._registerNode)(Rt);hr.Factory.addGetterSetter(Rt,"radius",0,(0,ka.getNumberValidator)());hr.Factory.addGetterSetter(Rt,"angle",0,(0,ka.getNumberValidator)());hr.Factory.addGetterSetter(Rt,"clockwise",!1);hr.Factory.backCompat(Rt,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var lr={};Object.defineProperty(lr,"__esModule",{value:!0});lr.Blur=void 0;const Oi=B,io=rt,ao=G;function Di(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var no=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,39
26,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],so=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function oo(o,t){var e=o.data,r=o.width,i=o.height,a,n,s,h,l,u,_,v,f,c,p,m,C,T,d,g,y,w,A,b,E,P,x,R,k=t+t+1,M=r-1,L=i-1,U=t+1,H=U*(U+1)/2,z=new Di,J=null,O=z,D=null,Y=null,Z=no[t],Q=so[t];for(s=1;s<k;s++)O=O.next=new Di,s===U&&(J=O);for(O.next=z,_=u=0,n=0;n<i;n++){for(g=y=w=A=v=f=c=p=0,m=U*(b=e[u]),C=U*(E=e[u+1]),T=U*(P=e[u+2]),d=U*(x=e[u+3]),v+=H*b,f+=H*E,c+=H*P,p+=H*x,O=z,s=0;s<U;s++)O.r=b,O.g=E,O.b=P,O.a=x,O=O.next;for(s=1;s<U;s++)h=u+((M<s?M:s)<<2),v+=(O.r=b=e[h])*(R=U-s),f+=(O.g=E=e[h+1])*R,c+=(O.b=P=e[h+2])*R,p+=(O.a=x=e[h+3])*R,g+=b,y+=E,w+=P,A+=x,O=O.next;for(D=z,Y=J,a=0;a<r;a++)e[u+3]=x=p*Z>>Q,x!==0?(x=255/x,e[u]=(v*Z>>Q)*x,e[u+1]=(f*Z>>Q)*x,e[u+2]=(c*Z>>Q)*x):e[u]=e[u+1]=e[u+2]=0,v-=m,f-=C,c-=T,p-=d,m-=D.r,C-=D.g,T-=D.b,d-=D.a,h=_+((h=a+t+1)<M?h:M)<<2,g+=D.r=e[h],y+=D.g=e[h+1],w+=D.b=e[h+2],A+=D.a=e[h+3],v+=g,f+=y,c+=w,p+=A,D=D.next,m+=b=Y.r,C+=E=Y.g,T+=P=Y.b,d+=x=Y.a,g-=b,y-=E,w-=P,A-=x,Y=Y.next,u+=4;_+=r}for(a=0;a<r;a++){for(y=w=A=g=f=c=p=v=0,u=a<<2,m=U*(b=e[u]),C=U*(E=e[u+1]),T=U*(P=e[u+2]),d=U*(x=e[u+3]),v+=H*b,f+=H*E,c+=H*P,p+=H*x,O=z,s=0;s<U;s++)O.r=b,O.g=E,O.b=P,O.a=x,O=O.next;for(l=r,s=1;s<=t;s++)u=l+a<<2,v+=(O.r=b=e[u])*(R=U-s),f+=(O.g=E=e[u+1])*R,c+=(O.b=P=e[u+2])*R,p+=(O.a=x=e[u+3])*R,g+=b,y+=E,w+=P,A+=x,O=O.next,s<L&&(l+=r);for(u=a,D=z,Y=J,n=0;n<i;n++)h=u<<2,e[h+3]=x=p*Z>>Q,x>0?(x=255/x,e[h]=(v*Z>>Q)*x,e[h+1]=(f*Z>>Q)*x,e[h+2]=(c*Z>>Q)*x):e[h]=e[h+1]=e[h+2]=0,v-=m,f-=C,c-=T,p-=d,m-=D.r,C-=D.g,T-=D.b,d-=D.a,h=a+((h=n+U)<L?h:L)*r<<2,v+=g+=D.r=e[h],f+=y+=D.g=e[h+1],c+=w+=D.b=e[h+2],p+=A+=D.a=e[h+3],D=D.next,m+=b=Y.r,C+=E=Y.g,T+=P=Y.b,d+=x=Y.a,g-=b,y-=E,w-=P,A-=x,Y=Y.next,u+=r}}const ho=function(t){var e=Math.round(this.blurRadius());e>0&&oo(t,e)};lr.Blur=ho;Oi.Factory.addGetterSetter(io.Node,"blurRadius",0,(0,ao.getNumberValidator)(),Oi.Factory.afterSetFilter);var dr={};Object.defineProperty(dr,"__esModule",{value:!0});dr.Brighten=void 0;const Li=B,lo=rt,co=G,uo=function(o){var t=this.brightness()*255,e=o.data,r=e.length,i;for(i=0;i<r;i+=4)e[i]+=t,e[i+1]+=t,e[i+2]+=t};dr.Brighten=uo;Li.Factory.addGetterSetter(lo.Node,"brightness",0,(0,co.getNumberValidator)(),Li.Factory.afterSetFilter);var cr={};Object.defineProperty(cr,"__esModule",{value:!0});cr.Contrast=void 0;const Ii=B,fo=rt,go=G,vo=function(o){var t=Math.pow((this.contrast()+100)/100,2),e=o.data,r=e.length,i=150,a=150,n=150,s;for(s=0;s<r;s+=4)i=e[s],a=e[s+1],n=e[s+2],i/=255,i-=.5,i*=t,i+=.5,i*=255,a/=255,a-=.5,a*=t,a+=.5,a*=255,n/=255,n-=.5,n*=t,n+=.5,n*=255,i=i<0?0:i>255?255:i,a=a<0?0:a>255?255:a,n=n<0?0:n>255?255:n,e[s]=i,e[s+1]=a,e[s+2]=n};cr.Contrast=vo;Ii.Factory.addGetterSetter(fo.Node,"contrast",0,(0,go.getNumberValidator)(),Ii.Factory.afterSetFilter);var ur={};Object.defineProperty(ur,"__esModule",{value:!0});ur.Emboss=void 0;const Nt=B,fr=rt,po=it,Ra=G,_o=function(o){var t=this.embossStrength()*10,e=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),a=0,n=0,s=o.data,h=o.width,l=o.height,u=h*4,_=l;switch(r){case"top-left":a=-1,n=-1;break;case"top":a=-1,n=0;break;case"top-right":a=-1,n=1;break;case"right":a=0,n=1;break;case"bottom-right":a=1,n=1;break;case"bottom":a=1,n=0;break;case"bottom-left":a=1,n=-1;break;case"left":a=0,n=-1;break;default:po.Util.error("Unknown emboss direction: "+r)}do{var v=(_-1)*u,f=a;_+f<1&&(f=0),_+f>l&&(f=0);var c=(_-1+f)*h*4,p=h;do{var m=v+(p-1)*4,C=n;p+C<1&&(C=0),p+C>h&&(C=0);var T=c+(p-1+C)*4,d=s[m]-s[T],g=s[m+1]-s[T+1],y=s[m+2]-s[T+2],w=d,A=w>0?w:-w,b=g>0?g:-g,E=y>0?y:-y;if(b>A&&(w=g),E>A&&(w=y),w*=t,i){var P=s[m]+w,x=s[m+1]+w,R=s[m+2]+w;s[m]=P>255?255:P<0?0:P,s[m+1]=x>255?255:x<0?0:x,s[m+2]=R>255?255:R<0?0:R}else{var k=e-w;k<0?k=0:k>255&&(k=255),s[m]=s[m+1]=s[m+2]=k}}while(--p)}while(--_)};ur.Emboss=_o;Nt.Factory.addGetterSetter(fr.Node,"embossStrength",.5,(0,Ra.getNumberValidator)(),Nt.Factory.afterSetFilter);Nt.Factory.addGetterSetter(fr.Node,"embossWhiteLevel",.5,(0,Ra.getNumberValidator)(),Nt.Factory.afterSetFilter);Nt.Factory.addGetterSetter(fr.Node,"embossDirection","top-left",null,Nt.Factory.afterSetFilter);Nt.Factory.addGetterSetter(fr.Node,"embossBlend",!1,null,Nt.Factory.afterSetFilter);var gr={};
2Object.defineProperty(gr,"__esModule",{value:!0});gr.Enhance=void 0;const Ui=B,mo=rt,yo=G;function Br(o,t,e,r,i){var a=e-t,n=i-r,s;return a===0?r+n/2:n===0?r:(s=(o-t)/a,s=n*s+r,s)}const bo=function(o){var t=o.data,e=t.length,r=t[0],i=r,a,n=t[1],s=n,h,l=t[2],u=l,_,v,f=this.enhance();if(f!==0){for(v=0;v<e;v+=4)a=t[v+0],a<r?r=a:a>i&&(i=a),h=t[v+1],h<n?n=h:h>s&&(s=h),_=t[v+2],_<l?l=_:_>u&&(u=_);i===r&&(i=255,r=0),s===n&&(s=255,n=0),u===l&&(u=255,l=0);var c,p,m,C,T,d,g,y,w;for(f>0?(p=i+f*(255-i),m=r-f*(r-0),T=s+f*(255-s),d=n-f*(n-0),y=u+f*(255-u),w=l-f*(l-0)):(c=(i+r)*.5,p=i+f*(i-c),m=r+f*(r-c),C=(s+n)*.5,T=s+f*(s-C),d=n+f*(n-C),g=(u+l)*.5,y=u+f*(u-g),w=l+f*(l-g)),v=0;v<e;v+=4)t[v+0]=Br(t[v+0],r,i,m,p),t[v+1]=Br(t[v+1],n,s,d,T),t[v+2]=Br(t[v+2],l,u,w,y)}};gr.Enhance=bo;Ui.Factory.addGetterSetter(mo.Node,"enhance",0,(0,yo.getNumberValidator)(),Ui.Factory.afterSetFilter);var vr={};Object.defineProperty(vr,"__esModule",{value:!0});vr.Grayscale=void 0;const So=function(o){var t=o.data,e=t.length,r,i;for(r=0;r<e;r+=4)i=.34*t[r]+.5*t[r+1]+.16*t[r+2],t[r]=i,t[r+1]=i,t[r+2]=i};vr.Grayscale=So;var pr={};Object.defineProperty(pr,"__esModule",{value:!0});pr.HSL=void 0;const ae=B,si=rt,oi=G;ae.Factory.addGetterSetter(si.Node,"hue",0,(0,oi.getNumberValidator)(),ae.Factory.afterSetFilter);ae.Factory.addGetterSetter(si.Node,"saturation",0,(0,oi.getNumberValidator)(),ae.Factory.afterSetFilter);ae.Factory.addGetterSetter(si.Node,"luminance",0,(0,oi.getNumberValidator)(),ae.Factory.afterSetFilter);const Co=function(o){var t=o.data,e=t.length,r=1,i=Math.pow(2,this.saturation()),a=Math.abs(this.hue()+360)%360,n=this.luminance()*127,s,h=r*i*Math.cos(a*Math.PI/180),l=r*i*Math.sin(a*Math.PI/180),u=.299*r+.701*h+.167*l,_=.587*r-.587*h+.33*l,v=.114*r-.114*h-.497*l,f=.299*r-.299*h-.328*l,c=.587*r+.413*h+.035*l,p=.114*r-.114*h+.293*l,m=.299*r-.3*h+1.25*l,C=.587*r-.586*h-1.05*l,T=.114*r+.886*h-.2*l,d,g,y,w;for(s=0;s<e;s+=4)d=t[s+0],g=t[s+1],y=t[s+2],w=t[s+3],t[s+0]=u*d+_*g+v*y+n,t[s+1]=f*d+c*g+p*y+n,t[s+2]=m*d+C*g+T*y+n,t[s+3]=w};pr.HSL=Co;var _r={};Object.defineProperty(_r,"__esModule",{value:!0});_r.HSV=void 0;const ne=B,hi=rt,li=G,wo=function(o){var t=o.data,e=t.length,r=Math.pow(2,this.value()),i=Math.pow(2,this.saturation()),a=Math.abs(this.hue()+360)%360,n,s=r*i*Math.cos(a*Math.PI/180),h=r*i*Math.sin(a*Math.PI/180),l=.299*r+.701*s+.167*h,u=.587*r-.587*s+.33*h,_=.114*r-.114*s-.497*h,v=.299*r-.299*s-.328*h,f=.587*r+.413*s+.035*h,c=.114*r-.114*s+.293*h,p=.299*r-.3*s+1.25*h,m=.587*r-.586*s-1.05*h,C=.114*r+.886*s-.2*h,T,d,g,y;for(n=0;n<e;n+=4)T=t[n+0],d=t[n+1],g=t[n+2],y=t[n+3],t[n+0]=l*T+u*d+_*g,t[n+1]=v*T+f*d+c*g,t[n+2]=p*T+m*d+C*g,t[n+3]=y};_r.HSV=wo;ne.Factory.addGetterSetter(hi.Node,"hue",0,(0,li.getNumberValidator)(),ne.Factory.afterSetFilter);ne.Factory.addGetterSetter(hi.Node,"saturation",0,(0,li.getNumberValidator)(),ne.Factory.afterSetFilter);ne.Factory.addGetterSetter(hi.Node,"value",0,(0,li.getNumberValidator)(),ne.Factory.afterSetFilter);var mr={};Object.defineProperty(mr,"__esModule",{value:!0});mr.Invert=void 0;const Po=function(o){var t=o.data,e=t.length,r;for(r=0;r<e;r+=4)t[r]=255-t[r],t[r+1]=255-t[r+1],t[r+2]=255-t[r+2]};mr.Invert=Po;var yr={};
2Object.defineProperty(yr,"__esModule",{value:!0});yr.Kaleidoscope=void 0;const De=B,Ma=rt,Vi=it,Ga=G;var To=function(o,t,e){var r=o.data,i=t.data,a=o.width,n=o.height,s=e.polarCenterX||a/2,h=e.polarCenterY||n/2,l,u,_,v=0,f=0,c=0,p=0,m,C=Math.sqrt(s*s+h*h);u=a-s,_=n-h,m=Math.sqrt(u*u+_*_),C=m>C?m:C;var T=n,d=a,g,y,w=360/d*Math.PI/180,A,b;for(y=0;y<d;y+=1)for(A=Math.sin(y*w),b=Math.cos(y*w),g=0;g<T;g+=1)u=Math.floor(s+C*g/T*b),_=Math.floor(h+C*g/T*A),l=(_*a+u)*4,v=r[l+0],f=r[l+1],c=r[l+2],p=r[l+3],l=(y+g*a)*4,i[l+0]=v,i[l+1]=f,i[l+2]=c,i[l+3]=p},xo=function(o,t,e){var r=o.data,i=t.data,a=o.width,n=o.height,s=e.polarCenterX||a/2,h=e.polarCenterY||n/2,l,u,_,v,f,c=0,p=0,m=0,C=0,T,d=Math.sqrt(s*s+h*h);u=a-s,_=n-h,T=Math.sqrt(u*u+_*_),d=T>d?T:d;var g=n,y=a,w,A,b=0,E,P;for(u=0;u<a;u+=1)for(_=0;_<n;_+=1)v=u-s,f=_-h,w=Math.sqrt(v*v+f*f)*g/d,A=(Math.atan2(f,v)*180/Math.PI+360+b)%360,A=A*y/360,E=Math.floor(A),P=Math.floor(w),l=(P*a+E)*4,c=r[l+0],p=r[l+1],m=r[l+2],C=r[l+3],l=(_*a+u)*4,i[l+0]=c,i[l+1]=p,i[l+2]=m,i[l+3]=C};const Eo=function(o){var t=o.width,e=o.height,r,i,a,n,s,h,l,u,_,v,f=Math.round(this.kaleidoscopePower()),c=Math.round(this.kaleidoscopeAngle()),p=Math.floor(t*(c%360)/360);if(!(f<1)){var m=Vi.Util.createCanvasElement();m.width=t,m.height=e;var C=m.getContext("2d").getImageData(0,0,t,e);Vi.Util.releaseCanvas(m),To(o,C,{polarCenterX:t/2,polarCenterY:e/2});for(var T=t/Math.pow(2,f);T<=8;)T=T*2,f-=1;T=Math.ceil(T);var d=T,g=0,y=d,w=1;for(p+T>t&&(g=d,y=0,w=-1),i=0;i<e;i+=1)for(r=g;r!==y;r+=w)a=Math.round(r+p)%t,_=(t*i+a)*4,s=C.data[_+0],h=C.data[_+1],l=C.data[_+2],u=C.data[_+3],v=(t*i+r)*4,C.data[v+0]=s,C.data[v+1]=h,C.data[v+2]=l,C.data[v+3]=u;for(i=0;i<e;i+=1)for(d=Math.floor(T),n=0;n<f;n+=1){for(r=0;r<d+1;r+=1)_=(t*i+r)*4,s=C.data[_+0],h=C.data[_+1],l=C.data[_+2],u=C.data[_+3],v=(t*i+d*2-r-1)*4,C.data[v+0]=s,C.data[v+1]=h,C.data[v+2]=l,C.data[v+3]=u;d*=2}xo(C,o,{polarRotation:0})}};yr.Kaleidoscope=Eo;De.Factory.addGetterSetter(Ma.Node,"kaleidoscopePower",2,(0,Ga.getNumberValidator)(),De.Factory.afterSetFilter);De.Factory.addGetterSetter(Ma.Node,"kaleidoscopeAngle",0,(0,Ga.getNumberValidator)(),De.Factory.afterSetFilter);var br={};Object.defineProperty(br,"__esModule",{value:!0});br.Mask=void 0;const Bi=B,Ao=rt,Fo=G;function ke(o,t,e){var r=(e*o.width+t)*4,i=[];return i.push(o.data[r++],o.data[r++],o.data[r++],o.data[r++]),i}function ge(o,t){return Math.sqrt(Math.pow(o[0]-t[0],2)+Math.pow(o[1]-t[1],2)+Math.pow(o[2]-t[2],2))}function ko(o){for(var t=[0,0,0],e=0;e<o.length;e++)t[0]+=o[e][0],t[1]+=o[e][1],t[2]+=o[e][2];return t[0]/=o.length,t[1]/=o.length,t[2]/=o.length,t}function Ro(o,t){var e=ke(o,0,0),r=ke(o,o.width-1,0),i=ke(o,0,o.height-1),a=ke(o,o.width-1,o.height-1),n=t||10;if(ge(e,r)<n&&ge(r,a)<n&&ge(a,i)<n&&ge(i,e)<n){for(var s=ko([r,e,a,i]),h=[],l=0;l<o.width*o.height;l++){var u=ge(s,[o.data[l*4],o.data[l*4+1],o.data[l*4+2]]);h[l]=u<n?0:255}return h}}function Mo(o,t){for(var e=0;e<o.width*o.height;e++)o.data[4*e+3]=t[e]}function Go(o,t,e){for(var r=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),n=[],s=0;s<e;s++)for(var h=0;h<t;h++){for(var l=s*t+h,u=0,_=0;_<i;_++)for(var v=0;v<i;v++){var f=s+_-a,c=h+v-a;if(f>=0&&f<e&&c>=0&&c<t){var p=f*t+c,m=r[_*i+v];u+=o[p]*m}}n[l]=u===255*8?255:0}return n}function No(o,t,e){for(var r=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),n=[],s=0;s<e;s++)for(var h=0;h<t;h++){for(var l=s*t+h,u=0,_=0;_<i;_++)for(var v=0;v<i;v++){var f=s+_-a,c=h+v-a;if(f>=0&&f<e&&c>=0&&c<t){var p=f*t+c,m=r[_*i+v];u+=o[p]*m}}n[l]=u>=255*4?255:0}return n}function Oo(o,t,e){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),n=[],s=0;s<e;s++)for(var h=0;h<t;h++){for(var l=s*t+h,u=0,_=0;_<i;_++)for(var v=0;v<i;v++){var f=s+_-a,c=h+v-a;if(f>=0&&f<e&&c>=0&&c<t){var p=f*t+c,m=r[_*i+v];u+=o[p]*m}}n[l]=u}return n}const Do=function(o){var t=this.threshold(),e=Ro(o,t);return e&&(e=Go(e,o.width,o.height),e=No(e,o.width,o.height),e=Oo(e,o.width,o.height),Mo(o,e)),o};br.Mask=Do;Bi.Factory.addGetterSetter(Ao.Node,"threshold",0,(0,Fo.getNumberValidator)(),Bi.Factory.afterSetFilter);var Sr={};
2Object.defineProperty(Sr,"__esModule",{value:!0});Sr.Noise=void 0;const $i=B,Lo=rt,Io=G,Uo=function(o){var t=this.noise()*255,e=o.data,r=e.length,i=t/2,a;for(a=0;a<r;a+=4)e[a+0]+=i-2*i*Math.random(),e[a+1]+=i-2*i*Math.random(),e[a+2]+=i-2*i*Math.random()};Sr.Noise=Uo;$i.Factory.addGetterSetter(Lo.Node,"noise",.2,(0,Io.getNumberValidator)(),$i.Factory.afterSetFilter);var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.Pixelate=void 0;const Hi=B,Vo=it,Bo=rt,$o=G,Ho=function(o){var t=Math.ceil(this.pixelSize()),e=o.width,r=o.height,i,a,n,s,h,l,u,_=Math.ceil(e/t),v=Math.ceil(r/t),f,c,p,m,C,T,d,g=o.data;if(t<=0){Vo.Util.error("pixelSize value can not be <= 0");return}for(C=0;C<_;C+=1)for(T=0;T<v;T+=1){for(s=0,h=0,l=0,u=0,f=C*t,c=f+t,p=T*t,m=p+t,d=0,i=f;i<c;i+=1)if(!(i>=e))for(a=p;a<m;a+=1)a>=r||(n=(e*a+i)*4,s+=g[n+0],h+=g[n+1],l+=g[n+2],u+=g[n+3],d+=1);for(s=s/d,h=h/d,l=l/d,u=u/d,i=f;i<c;i+=1)if(!(i>=e))for(a=p;a<m;a+=1)a>=r||(n=(e*a+i)*4,g[n+0]=s,g[n+1]=h,g[n+2]=l,g[n+3]=u)}};Cr.Pixelate=Ho;Hi.Factory.addGetterSetter(Bo.Node,"pixelSize",8,(0,$o.getNumberValidator)(),Hi.Factory.afterSetFilter);var wr={};Object.defineProperty(wr,"__esModule",{value:!0});wr.Posterize=void 0;const zi=B,zo=rt,Wo=G,Ko=function(o){var t=Math.round(this.levels()*254)+1,e=o.data,r=e.length,i=255/t,a;for(a=0;a<r;a+=1)e[a]=Math.floor(e[a]/i)*i};wr.Posterize=Ko;zi.Factory.addGetterSetter(zo.Node,"levels",.5,(0,Wo.getNumberValidator)(),zi.Factory.afterSetFilter);var Pr={};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.RGB=void 0;const Le=B,di=rt,Yo=G,Xo=function(o){var t=o.data,e=t.length,r=this.red(),i=this.green(),a=this.blue(),n,s;for(n=0;n<e;n+=4)s=(.34*t[n]+.5*t[n+1]+.16*t[n+2])/255,t[n]=s*r,t[n+1]=s*i,t[n+2]=s*a,t[n+3]=t[n+3]};Pr.RGB=Xo;Le.Factory.addGetterSetter(di.Node,"red",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)});Le.Factory.addGetterSetter(di.Node,"green",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)});Le.Factory.addGetterSetter(di.Node,"blue",0,Yo.RGBComponent,Le.Factory.afterSetFilter);var Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.RGBA=void 0;const _e=B,xr=rt,jo=G,qo=function(o){var t=o.data,e=t.length,r=this.red(),i=this.green(),a=this.blue(),n=this.alpha(),s,h;for(s=0;s<e;s+=4)h=1-n,t[s]=r*n+t[s]*h,t[s+1]=i*n+t[s+1]*h,t[s+2]=a*n+t[s+2]*h};Tr.RGBA=qo;_e.Factory.addGetterSetter(xr.Node,"red",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)});_e.Factory.addGetterSetter(xr.Node,"green",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)});_e.Factory.addGetterSetter(xr.Node,"blue",0,jo.RGBComponent,_e.Factory.afterSetFilter);_e.Factory.addGetterSetter(xr.Node,"alpha",1,function(o){return this._filterUpToDate=!1,o>1?1:o<0?0:o});var Er={};Object.defineProperty(Er,"__esModule",{value:!0});Er.Sepia=void 0;const Qo=function(o){var t=o.data,e=t.length,r,i,a,n;for(r=0;r<e;r+=4)i=t[r+0],a=t[r+1],n=t[r+2],t[r+0]=Math.min(255,i*.393+a*.769+n*.189),t[r+1]=Math.min(255,i*.349+a*.686+n*.168),t[r+2]=Math.min(255,i*.272+a*.534+n*.131)};Er.Sepia=Qo;var Ar={};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.Solarize=void 0;const Jo=function(o){var t=o.data,e=o.width,r=o.height,i=e*4,a=r;do{var n=(a-1)*i,s=e;do{var h=n+(s-1)*4,l=t[h],u=t[h+1],_=t[h+2];l>127&&(l=255-l),u>127&&(u=255-u),_>127&&(_=255-_),t[h]=l,t[h+1]=u,t[h+2]=_}while(--s)}while(--a)};Ar.Solarize=Jo;var Fr={};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.Threshold=void 0;const Wi=B,Zo=rt,th=G,eh=function(o){var t=this.threshold()*255,e=o.data,r=e.length,i;for(i=0;i<r;i+=1)e[i]=e[i]<t?0:255};Fr.Threshold=eh;Wi.Factory.addGetterSetter(Zo.Node,"threshold",.5,(0,th.getNumberValidator)(),Wi.Factory.afterSetFilter);Object.defineProperty(Ie,"__esModule",{value:!0});Ie.Konva=void 0;const Ki=Ge,rh=ze,ih=Ye,ah=qe,nh=Qe,sh=Je,Yi=ie,oh=Se,hh=de,lh=Pe,dh=er,ch=rr,uh=ir,fh=ar,gh=Ht,vh=nr,ph=sr,_h=or,mh=lr,yh=dr,bh=cr,Sh=ur,Ch=gr,wh=vr,Ph=pr,Th=_r,xh=mr,Eh=yr,Ah=br,Fh=Sr,kh=Cr,Rh=wr,Mh=Pr,Gh=Tr,Nh=Er,Oh=Ar,Dh=Fr;Ie.Konva=Ki.Konva.Util._assign(Ki.Konva,{Arc:rh.Arc,Arrow:ih.Arrow,Circle:ah.Circle,Ellipse:nh.Ellipse,Image:sh.Image,Label:Yi.Label,Tag:Yi.Tag,Line:oh.Line,Path:hh.Path,Rect:lh.Rect,RegularPolygon:dh.RegularPolygon,Ring:ch.Ring,Sprite:uh.Sprite,Star:fh.Star,Text:gh.Text,TextPath:vh.TextPath,Transformer:ph.Transformer,Wedge:_h.Wedge,Filters:{Blur:mh.Blur,Brighten:yh.Brighten,Contrast:bh.Contrast,Emboss:Sh.Emboss,Enhance:Ch.Enhance,Grayscale:wh.Grayscale,HSL:Ph.HSL,HSV:Th.HSV,Invert:xh.Invert,Kaleidoscope:Eh.Kaleidoscope,Mask:Ah.Mask,Noise:Fh.Noise,Pixelate:k
2h.Pixelate,Posterize:Rh.Posterize,RGB:Mh.RGB,RGBA:Gh.RGBA,Sepia:Nh.Sepia,Solarize:Oh.Solarize,Threshold:Dh.Threshold}});var Lh=Ji.exports;Object.defineProperty(Lh,"__esModule",{value:!0});const Ih=Ie;Ji.exports=Ih.Konva;var qr={exports:{}};(function(o,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var e=Ge;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return e.Konva}});const r=Ge;o.exports=r.Konva})(qr,qr.exports);var Uh=qr.exports;const me=Da(Uh),Xi={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let ji=!1,qi=!1;const ci=".react-konva-event",Vh=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. 3Position of a node will be changed during drag&drop, so you should update state of the react app as well. 4Consider to add onDragMove or onDragEnd events. 5For more info see: https://github.com/konvajs/react-konva/issues/256 6`,Bh=`ReactKonva: You are using "zIndex" attribute for a Konva node. 7react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. 8For more info see: https://github.com/konvajs/react-konva/issues/194 9`,$h={};function kr(o,t,e=$h){if(!ji&&"zIndex"in t&&(console.warn(Bh),ji=!0),!qi&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(Vh),qi=!0)}for(var a in e)if(!Xi[a]){var n=a.slice(0,2)==="on",s=e[a]!==t[a];if(n&&s){var h=a.substr(2).toLowerCase();h.substr(0,7)==="content"&&(h="content"+h.substr(7,1).toUpperCase()+h.substr(8)),o.off(h,e[a])}var l=!t.hasOwnProperty(a);l&&o.setAttr(a,void 0)}var u=t._useStrictMode,_={},v=!1;const f={};for(var a in t)if(!Xi[a]){var n=a.slice(0,2)==="on",c=e[a]!==t[a];if(n&&c){var h=a.substr(2).toLowerCase();h.substr(0,7)==="content"&&(h="content"+h.substr(7,1).toUpperCase()+h.substr(8)),t[a]&&(f[h]=t[a])}!n&&(t[a]!==e[a]||u&&t[a]!==o.getAttr(a))&&(v=!0,_[a]=t[a])}v&&(o.setAttrs(_),Vt(o));for(var h in f)o.on(h+ci,f[h])}function Vt(o){if(!V.Konva.autoDrawEnabled){var t=o.getLayer()||o.getStage();t&&t.batchDraw()}}const Na={},Hh={};me.Node.prototype._applyProps=kr;function zh(o,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}o.add(t),Vt(o)}function Wh(o,t,e){let r=me[o];r||(console.error(`Konva has no node with the type ${o}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${o}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=me.Group);const i={},a={};for(var n in t){var s=n.slice(0,2)==="on";s?a[n]=t[n]:i[n]=t[n]}const h=new r(i);return kr(h,a),h}function Kh(o,t,e){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${o}"`)}function Yh(o,t,e){return!1}function Xh(o){return o}function jh(){return null}function qh(){return null}function Qh(o,t,e,r){return Hh}function Jh(){}function Zh(o){}function t0(o,t){return!1}function e0(){return Na}function r0(){return Na}const i0=setTimeout,a0=clearTimeout,n0=-1;function s0(o,t){return!1}const o0=!1,h0=!0,l0=!0;function d0(o,t){t.parent===o?t.moveToTop():o.add(t),Vt(o)}function c0(o,t){t.parent===o?t.moveToTop():o.add(t),Vt(o)}function Oa(o,t,e){t._remove(),o.add(t),t.setZIndex(e.getZIndex()),Vt(o)}function u0(o,t,e){Oa(o,t,e)}function f0(o,t){t.destroy(),t.off(ci),Vt(o)}function g0(o,t){t.destroy(),t.off(ci),Vt(o)}function v0(o,t,e){console.error(`Text components are not yet supported in ReactKonva. You text is: "${e}"`)}function p0(o,t,e){}function _0(o,t,e,r,i){kr(o,i,r)}function m0(o){o.hide(),Vt(o)}function y0(o){}function b0(o,t){(t.visible==null||t.visible)&&o.show()}function S0(o,t){}function C0(o){}function w0(){}const P0=()=>Qi.DefaultEventPriority,T0=Object.freeze(Object.defineProperty({__proto__:null,appendChild:d0,appendChildToContainer:c0,appendInitialChild:zh,cancelTimeout:a0,clearContainer:C0,
9commitMount:p0,commitTextUpdate:v0,commitUpdate:_0,createInstance:Wh,createTextInstance:Kh,detachDeletedInstance:w0,finalizeInitialChildren:Yh,getChildHostContext:r0,getCurrentEventPriority:P0,getPublicInstance:Xh,getRootHostContext:e0,hideInstance:m0,hideTextInstance:y0,idlePriority:Rr.unstable_IdlePriority,insertBefore:Oa,insertInContainerBefore:u0,isPrimaryRenderer:o0,noTimeout:n0,now:Rr.unstable_now,prepareForCommit:jh,preparePortalMount:qh,prepareUpdate:Qh,removeChild:f0,removeChildFromContainer:g0,resetAfterCommit:Jh,resetTextContent:Zh,run:Rr.unstable_runWithPriority,scheduleTimeout:i0,shouldDeprioritizeSubtree:t0,shouldSetTextContent:s0,supportsMutation:l0,unhideInstance:b0,unhideTextInstance:S0,warnsIfNotActing:h0},Symbol.toStringTag,{value:"Module"}));function x0(o){const t=ut.useRef();return ut.useLayoutEffect(()=>{t.current=o}),t.current}const E0=o=>{const t=ut.useRef(),e=ut.useRef(),r=ut.useRef(),i=x0(o),a=Ua(),n=s=>{const{forwardedRef:h}=o;h&&(typeof h=="function"?h(s):h.current=s)};return ut.useLayoutEffect(()=>(e.current=new me.Stage({width:o.width,height:o.height,container:t.current}),n(e.current),r.current=ve.createContainer(e.current,Qi.LegacyRoot,!1,null),ve.updateContainer(ut.createElement(a,{},o.children),r.current),()=>{me.isBrowser&&(n(null),ve.updateContainer(null,r.current,null),e.current.destroy())}),[]),ut.useLayoutEffect(()=>{n(e.current),kr(e.current,o,i),ve.updateContainer(ut.createElement(a,{},o.children),r.current,null)}),ut.createElement("div",{ref:t,accessKey:o.accessKey,className:o.className,role:o.role,style:o.style,tabIndex:o.tabIndex,title:o.title})},L0="Layer",I0="Group",U0="Label",V0="Rect",B0="Circle",$0="Line",H0="Image",z0="Text",W0="Tag",K0="Path",Y0="Shape",ve=La(T0);ve.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:ut.version,rendererPackageName:"react-konva"});const X0=ut.forwardRef((o,t)=>ut.createElement(Ia,{},ut.createElement(E0,{...o,forwardedRef:t})));export{B0 as C,I0 as G,H0 as I,$0 as L,K0 as P,V0 as R,Y0 as S,z0 as T,U0 as a,W0 as b,X0 as c,L0 as d}; 10//# sourceMappingURL=vendor-konva-BE48Xf0A.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.