diff --git "a/assets/konva-vendor-CFBUcegD.js" "b/assets/konva-vendor-CFBUcegD.js" new file mode 100644--- /dev/null +++ "b/assets/konva-vendor-CFBUcegD.js" @@ -0,0 +1,35 @@ +import{c as Yu,g as Bo,r as ue,s as ss,R as le}from"./react-vendor-DzFEYc3-.js";var Vo={exports:{}},fs={},ls={},lt={};(function(d){Object.defineProperty(d,"__esModule",{value:!0}),d._registerNode=d.Konva=d.glob=void 0;const e=Math.PI/180;function r(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}d.glob=typeof Yu<"u"?Yu:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},d.Konva={_global:d.glob,version:"9.3.22",isBrowser:r(),isUnminified:/param/.test((function(a){}).toString()),dblClickWindow:400,getAngle(a){return d.Konva.angleDeg?a*e:a},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,_fixTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return d.Konva.DD.isDragging},isTransforming(){var a;return(a=d.Konva.Transformer)===null||a===void 0?void 0:a.isTransforming()},isDragReady(){return!!d.Konva.DD.node},releaseCanvasOnDestroy:!0,document:d.glob.document,_injectGlobal(a){d.glob.Konva=a}};const s=a=>{d.Konva[a.prototype.getClassName()]=a};d._registerNode=s,d.Konva._injectGlobal(d.Konva)})(lt);var Gt={};(function(d){Object.defineProperty(d,"__esModule",{value:!0}),d.Util=d.Transform=void 0;const e=lt;class r{constructor(v=[1,0,0,1,0,0]){this.dirty=!1,this.m=v&&v.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 r(this.m)}copyInto(v){v.m[0]=this.m[0],v.m[1]=this.m[1],v.m[2]=this.m[2],v.m[3]=this.m[3],v.m[4]=this.m[4],v.m[5]=this.m[5]}point(v){const k=this.m;return{x:k[0]*v.x+k[2]*v.y+k[4],y:k[1]*v.x+k[3]*v.y+k[5]}}translate(v,k){return this.m[4]+=this.m[0]*v+this.m[2]*k,this.m[5]+=this.m[1]*v+this.m[3]*k,this}scale(v,k){return this.m[0]*=v,this.m[1]*=v,this.m[2]*=k,this.m[3]*=k,this}rotate(v){const k=Math.cos(v),M=Math.sin(v),I=this.m[0]*k+this.m[2]*M,T=this.m[1]*k+this.m[3]*M,U=this.m[0]*-M+this.m[2]*k,b=this.m[1]*-M+this.m[3]*k;return this.m[0]=I,this.m[1]=T,this.m[2]=U,this.m[3]=b,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(v,k){const M=this.m[0]+this.m[2]*k,I=this.m[1]+this.m[3]*k,T=this.m[2]+this.m[0]*v,U=this.m[3]+this.m[1]*v;return this.m[0]=M,this.m[1]=I,this.m[2]=T,this.m[3]=U,this}multiply(v){const k=this.m[0]*v.m[0]+this.m[2]*v.m[1],M=this.m[1]*v.m[0]+this.m[3]*v.m[1],I=this.m[0]*v.m[2]+this.m[2]*v.m[3],T=this.m[1]*v.m[2]+this.m[3]*v.m[3],U=this.m[0]*v.m[4]+this.m[2]*v.m[5]+this.m[4],b=this.m[1]*v.m[4]+this.m[3]*v.m[5]+this.m[5];return this.m[0]=k,this.m[1]=M,this.m[2]=I,this.m[3]=T,this.m[4]=U,this.m[5]=b,this}invert(){const v=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),k=this.m[3]*v,M=-this.m[1]*v,I=-this.m[2]*v,T=this.m[0]*v,U=v*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),b=v*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=k,this.m[1]=M,this.m[2]=I,this.m[3]=T,this.m[4]=U,this.m[5]=b,this}getMatrix(){return this.m}decompose(){const v=this.m[0],k=this.m[1],M=this.m[2],I=this.m[3],T=this.m[4],U=this.m[5],b=v*I-k*M,z={x:T,y:U,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(v!=0||k!=0){const B=Math.sqrt(v*v+k*k);z.rotation=k>0?Math.acos(v/B):-Math.acos(v/B),z.scaleX=B,z.scaleY=b/B,z.skewX=(v*M+k*I)/b,z.skewY=0}else if(M!=0||I!=0){const B=Math.sqrt(M*M+I*I);z.rotation=Math.PI/2-(I>0?Math.acos(-M/B):-Math.acos(M/B)),z.scaleX=b/B,z.scaleY=B,z.skewX=0,z.skewY=(v*M+k*I)/b}return z.rotation=d.Util._getRotation(z.rotation),z}}d.Transform=r;const s="[object Array]",a="[object Number]",l="[object String]",h="[object Boolean]",c=Math.PI/180,f=180/Math.PI,m="#",_="",x="0",w="Konva warning: ",C="Konva error: ",y="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],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},E=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let R=[];const L=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(p){setTimeout(p,60)};d.Util={_isElement(p){return!!(p&&p.nodeType==1)},_isFunction(p){return!!(p&&p.constructor&&p.call&&p.apply)},_isPlainObject(p){return!!p&&p.constructor===Object},_isArray(p){return Object.prototype.toString.call(p)===s},_isNumber(p){return Object.prototype.toString.call(p)===a&&!isNaN(p)&&isFinite(p)},_isString(p){return Object.prototype.toString.call(p)===l},_isBoolean(p){return Object.prototype.toString.call(p)===h},isObject(p){return p instanceof Object},isValidSelector(p){if(typeof p!="string")return!1;const v=p[0];return v==="#"||v==="."||v===v.toUpperCase()},_sign(p){return p===0||p>0?1:-1},requestAnimFrame(p){R.push(p),R.length===1&&L(function(){const v=R;R=[],v.forEach(function(k){k()})})},createCanvasElement(){const p=document.createElement("canvas");try{p.style=p.style||{}}catch{}return p},createImageElement(){return document.createElement("img")},_isInDocument(p){for(;p=p.parentNode;)if(p==document)return!0;return!1},_urlToImage(p,v){const k=d.Util.createImageElement();k.onload=function(){v(k)},k.src=p},_rgbToHex(p,v,k){return((1<<24)+(p<<16)+(v<<8)+k).toString(16).slice(1)},_hexToRgb(p){p=p.replace(m,_);const v=parseInt(p,16);return{r:v>>16&255,g:v>>8&255,b:v&255}},getRandomColor(){let p=(Math.random()*16777215<<0).toString(16);for(;p.length<6;)p=x+p;return m+p},getRGB(p){let v;return p in P?(v=P[p],{r:v[0],g:v[1],b:v[2]}):p[0]===m?this._hexToRgb(p.substring(1)):p.substr(0,4)===y?(v=E.exec(p.replace(/ /g,"")),{r:parseInt(v[1],10),g:parseInt(v[2],10),b:parseInt(v[3],10)}):{r:0,g:0,b:0}},colorToRGBA(p){return p=p||"black",d.Util._namedColorToRBA(p)||d.Util._hex3ColorToRGBA(p)||d.Util._hex4ColorToRGBA(p)||d.Util._hex6ColorToRGBA(p)||d.Util._hex8ColorToRGBA(p)||d.Util._rgbColorToRGBA(p)||d.Util._rgbaColorToRGBA(p)||d.Util._hslColorToRGBA(p)},_namedColorToRBA(p){const v=P[p.toLowerCase()];return v?{r:v[0],g:v[1],b:v[2],a:1}:null},_rgbColorToRGBA(p){if(p.indexOf("rgb(")===0){p=p.match(/rgb\(([^)]+)\)/)[1];const v=p.split(/ *, */).map(Number);return{r:v[0],g:v[1],b:v[2],a:1}}},_rgbaColorToRGBA(p){if(p.indexOf("rgba(")===0){p=p.match(/rgba\(([^)]+)\)/)[1];const v=p.split(/ *, */).map((k,M)=>k.slice(-1)==="%"?M===3?parseInt(k)/100:parseInt(k)/100*255:Number(k));return{r:v[0],g:v[1],b:v[2],a:v[3]}}},_hex8ColorToRGBA(p){if(p[0]==="#"&&p.length===9)return{r:parseInt(p.slice(1,3),16),g:parseInt(p.slice(3,5),16),b:parseInt(p.slice(5,7),16),a:parseInt(p.slice(7,9),16)/255}},_hex6ColorToRGBA(p){if(p[0]==="#"&&p.length===7)return{r:parseInt(p.slice(1,3),16),g:parseInt(p.slice(3,5),16),b:parseInt(p.slice(5,7),16),a:1}},_hex4ColorToRGBA(p){if(p[0]==="#"&&p.length===5)return{r:parseInt(p[1]+p[1],16),g:parseInt(p[2]+p[2],16),b:parseInt(p[3]+p[3],16),a:parseInt(p[4]+p[4],16)/255}},_hex3ColorToRGBA(p){if(p[0]==="#"&&p.length===4)return{r:parseInt(p[1]+p[1],16),g:parseInt(p[2]+p[2],16),b:parseInt(p[3]+p[3],16),a:1}},_hslColorToRGBA(p){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(p)){const[v,...k]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(p),M=Number(k[0])/360,I=Number(k[1])/100,T=Number(k[2])/100;let U,b,z;if(I===0)return z=T*255,{r:Math.round(z),g:Math.round(z),b:Math.round(z),a:1};T<.5?U=T*(1+I):U=T+I-T*I;const B=2*T-U,W=[0,0,0];for(let Z=0;Z<3;Z++)b=M+1/3*-(Z-1),b<0&&b++,b>1&&b--,6*b<1?z=B+(U-B)*6*b:2*b<1?z=U:3*b<2?z=B+(U-B)*(2/3-b)*6:z=B,W[Z]=z*255;return{r:Math.round(W[0]),g:Math.round(W[1]),b:Math.round(W[2]),a:1}}},haveIntersection(p,v){return!(v.x>p.x+p.width||v.x+v.widthp.y+p.height||v.y+v.height1?(U=k,b=M,z=(k-I)*(k-I)+(M-T)*(M-T)):(U=p+W*(k-p),b=v+W*(M-v),z=(U-I)*(U-I)+(b-T)*(b-T))}return[U,b,z]},_getProjectionToLine(p,v,k){const M=d.Util.cloneObject(p);let I=Number.MAX_VALUE;return v.forEach(function(T,U){if(!k&&U===v.length-1)return;const b=v[(U+1)%v.length],z=d.Util._getProjectionToSegment(T.x,T.y,b.x,b.y,p.x,p.y),B=z[0],W=z[1],Z=z[2];Zv.length){const U=v;v=p,p=U}for(let U=0;U{v.width=0,v.height=0})},drawRoundedRectPath(p,v,k,M){let I=0,T=0,U=0,b=0;typeof M=="number"?I=T=U=b=Math.min(M,v/2,k/2):(I=Math.min(M[0]||0,v/2,k/2),T=Math.min(M[1]||0,v/2,k/2),b=Math.min(M[2]||0,v/2,k/2),U=Math.min(M[3]||0,v/2,k/2)),p.moveTo(I,0),p.lineTo(v-T,0),p.arc(v-T,T,T,Math.PI*3/2,0,!1),p.lineTo(v,k-b),p.arc(v-b,k-b,b,0,Math.PI/2,!1),p.lineTo(U,k),p.arc(U,k-U,U,Math.PI/2,Math.PI,!1),p.lineTo(0,I),p.arc(I,I,I,Math.PI,Math.PI*3/2,!1)}}})(Gt);var bt={},De={},on={};Object.defineProperty(on,"__esModule",{value:!0});on.HitContext=on.SceneContext=on.Context=void 0;const Oh=Gt,r0=lt;function i0(d){const e=[],r=d.length,s=Oh.Util;for(let a=0;atypeof _=="number"?Math.floor(_):_)),l+=s0+m.join(Xu)+a0)):(l+=c.property,e||(l+=c0+c.val)),l+=u0;return l}clearTrace(){this.traceArr=[]}_trace(e){let r=this.traceArr,s;r.push(e),s=r.length,s>=f0&&r.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const r=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,r.getWidth()/r.pixelRatio,r.getHeight()/r.pixelRatio)}_applyLineCap(e){const r=e.attrs.lineCap;r&&this.setAttr("lineCap",r)}_applyOpacity(e){const r=e.getAbsoluteOpacity();r!==1&&this.setAttr("globalAlpha",r)}_applyLineJoin(e){const r=e.attrs.lineJoin;r&&this.setAttr("lineJoin",r)}setAttr(e,r){this._context[e]=r}arc(e,r,s,a,l,h){this._context.arc(e,r,s,a,l,h)}arcTo(e,r,s,a,l){this._context.arcTo(e,r,s,a,l)}beginPath(){this._context.beginPath()}bezierCurveTo(e,r,s,a,l,h){this._context.bezierCurveTo(e,r,s,a,l,h)}clearRect(e,r,s,a){this._context.clearRect(e,r,s,a)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,r){const s=arguments;if(s.length===2)return this._context.createImageData(e,r);if(s.length===1)return this._context.createImageData(e)}createLinearGradient(e,r,s,a){return this._context.createLinearGradient(e,r,s,a)}createPattern(e,r){return this._context.createPattern(e,r)}createRadialGradient(e,r,s,a,l,h){return this._context.createRadialGradient(e,r,s,a,l,h)}drawImage(e,r,s,a,l,h,c,f,m){const _=arguments,x=this._context;_.length===3?x.drawImage(e,r,s):_.length===5?x.drawImage(e,r,s,a,l):_.length===9&&x.drawImage(e,r,s,a,l,h,c,f,m)}ellipse(e,r,s,a,l,h,c,f){this._context.ellipse(e,r,s,a,l,h,c,f)}isPointInPath(e,r,s,a){return s?this._context.isPointInPath(s,e,r,a):this._context.isPointInPath(e,r,a)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,r,s,a){this._context.fillRect(e,r,s,a)}strokeRect(e,r,s,a){this._context.strokeRect(e,r,s,a)}fillText(e,r,s,a){a?this._context.fillText(e,r,s,a):this._context.fillText(e,r,s)}measureText(e){return this._context.measureText(e)}getImageData(e,r,s,a){return this._context.getImageData(e,r,s,a)}lineTo(e,r){this._context.lineTo(e,r)}moveTo(e,r){this._context.moveTo(e,r)}rect(e,r,s,a){this._context.rect(e,r,s,a)}roundRect(e,r,s,a,l){this._context.roundRect(e,r,s,a,l)}putImageData(e,r,s){this._context.putImageData(e,r,s)}quadraticCurveTo(e,r,s,a){this._context.quadraticCurveTo(e,r,s,a)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,r){this._context.scale(e,r)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,r,s,a,l,h){this._context.setTransform(e,r,s,a,l,h)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,r,s,a){this._context.strokeText(e,r,s,a)}transform(e,r,s,a,l,h){this._context.transform(e,r,s,a,l,h)}translate(e,r){this._context.translate(e,r)}_enableTrace(){let e=this,r=qu.length,s=this.setAttr,a,l;const h=function(c){let f=e[c],m;e[c]=function(){return l=i0(Array.prototype.slice.call(arguments,0)),m=f.apply(e,arguments),e._trace({method:c,args:l}),m}};for(a=0;a{a.dragStatus==="dragging"&&(s=!0)}),s},justDragged:!1,get node(){let s;return d.DD._dragElements.forEach(a=>{s=a.node}),s},_dragElements:new Map,_drag(s){const a=[];d.DD._dragElements.forEach((l,h)=>{const{node:c}=l,f=c.getStage();f.setPointersPositions(s),l.pointerId===void 0&&(l.pointerId=r.Util._getFirstPointerId(s));const m=f._changedPointerPositions.find(_=>_.id===l.pointerId);if(m){if(l.dragStatus!=="dragging"){const _=c.dragDistance();if(Math.max(Math.abs(m.x-l.startPointerPos.x),Math.abs(m.y-l.startPointerPos.y))<_||(c.startDrag({evt:s}),!c.isDragging()))return}c._setDragPosition(s,l),a.push(c)}}),a.forEach(l=>{l.fire("dragmove",{type:"dragmove",target:l,evt:s},!0)})},_endDragBefore(s){const a=[];d.DD._dragElements.forEach(l=>{const{node:h}=l,c=h.getStage();if(s&&c.setPointersPositions(s),!c._changedPointerPositions.find(_=>_.id===l.pointerId))return;(l.dragStatus==="dragging"||l.dragStatus==="stopped")&&(d.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,l.dragStatus="stopped");const m=l.node.getLayer()||l.node instanceof e.Konva.Stage&&l.node;m&&a.indexOf(m)===-1&&a.push(m)}),a.forEach(l=>{l.draw()})},_endDragAfter(s){d.DD._dragElements.forEach((a,l)=>{a.dragStatus==="stopped"&&a.node.fire("dragend",{type:"dragend",target:a.node,evt:s},!0),a.dragStatus!=="dragging"&&d.DD._dragElements.delete(l)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",d.DD._endDragBefore,!0),window.addEventListener("touchend",d.DD._endDragBefore,!0),window.addEventListener("touchcancel",d.DD._endDragBefore,!0),window.addEventListener("mousemove",d.DD._drag),window.addEventListener("touchmove",d.DD._drag),window.addEventListener("mouseup",d.DD._endDragAfter,!1),window.addEventListener("touchend",d.DD._endDragAfter,!1),window.addEventListener("touchcancel",d.DD._endDragAfter,!1))})(ps);var ht={},et={};Object.defineProperty(et,"__esModule",{value:!0});et.RGBComponent=v0;et.alphaComponent=S0;et.getNumberValidator=C0;et.getNumberOrArrayOfNumbersValidator=w0;et.getNumberOrAutoValidator=x0;et.getStringValidator=P0;et.getStringOrGradientValidator=E0;et.getFunctionValidator=k0;et.getNumberArrayValidator=T0;et.getBooleanValidator=N0;et.getComponentValidator=R0;const ln=lt,It=Gt;function un(d){return It.Util._isString(d)?'"'+d+'"':Object.prototype.toString.call(d)==="[object Number]"||It.Util._isBoolean(d)?d:Object.prototype.toString.call(d)}function v0(d){return d>255?255:d<0?0:Math.round(d)}function S0(d){return d>1?1:d<1e-4?1e-4:d}function C0(){if(ln.Konva.isUnminified)return function(d,e){return It.Util._isNumber(d)||It.Util.warn(un(d)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),d}}function w0(d){if(ln.Konva.isUnminified)return function(e,r){let s=It.Util._isNumber(e),a=It.Util._isArray(e)&&e.length==d;return!s&&!a&&It.Util.warn(un(e)+' is a not valid value for "'+r+'" attribute. The value should be a number or Array('+d+")"),e}}function x0(){if(ln.Konva.isUnminified)return function(d,e){return It.Util._isNumber(d)||d==="auto"||It.Util.warn(un(d)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),d}}function P0(){if(ln.Konva.isUnminified)return function(d,e){return It.Util._isString(d)||It.Util.warn(un(d)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),d}}function E0(){if(ln.Konva.isUnminified)return function(d,e){const r=It.Util._isString(d),s=Object.prototype.toString.call(d)==="[object CanvasGradient]"||d&&d.addColorStop;return r||s||It.Util.warn(un(d)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),d}}function k0(){if(ln.Konva.isUnminified)return function(d,e){return It.Util._isFunction(d)||It.Util.warn(un(d)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),d}}function T0(){if(ln.Konva.isUnminified)return function(d,e){const r=Int8Array?Object.getPrototypeOf(Int8Array):null;return r&&d instanceof r||(It.Util._isArray(d)?d.forEach(function(s){It.Util._isNumber(s)||It.Util.warn('"'+e+'" attribute has non numeric element '+s+". Make sure that all elements are numbers.")}):It.Util.warn(un(d)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),d}}function N0(){if(ln.Konva.isUnminified)return function(d,e){return d===!0||d===!1||It.Util.warn(un(d)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),d}}function R0(d){if(ln.Konva.isUnminified)return function(e,r){return e==null||It.Util.isObject(e)||It.Util.warn(un(e)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+d),e}}(function(d){Object.defineProperty(d,"__esModule",{value:!0}),d.Factory=void 0;const e=Gt,r=et,s="get",a="set";d.Factory={addGetterSetter(l,h,c,f,m){d.Factory.addGetter(l,h,c),d.Factory.addSetter(l,h,f,m),d.Factory.addOverloadedGetterSetter(l,h)},addGetter(l,h,c){const f=s+e.Util._capitalize(h);l.prototype[f]=l.prototype[f]||function(){const m=this.attrs[h];return m===void 0?c:m}},addSetter(l,h,c,f){const m=a+e.Util._capitalize(h);l.prototype[m]||d.Factory.overWriteSetter(l,h,c,f)},overWriteSetter(l,h,c,f){const m=a+e.Util._capitalize(h);l.prototype[m]=function(_){return c&&_!==void 0&&_!==null&&(_=c.call(this,_,h)),this._setAttr(h,_),f&&f.call(this),this}},addComponentsGetterSetter(l,h,c,f,m){const _=c.length,x=e.Util._capitalize,w=s+x(h),C=a+x(h);l.prototype[w]=function(){const P={};for(let E=0;E<_;E++){const R=c[E];P[R]=this.getAttr(h+x(R))}return P};const y=(0,r.getComponentValidator)(c);l.prototype[C]=function(P){const E=this.attrs[h];f&&(P=f.call(this,P,h)),y&&y.call(this,P,h);for(const R in P)P.hasOwnProperty(R)&&this._setAttr(h+x(R),P[R]);return P||c.forEach(R=>{this._setAttr(h+x(R),void 0)}),this._fireChangeEvent(h,E,P),m&&m.call(this),this},d.Factory.addOverloadedGetterSetter(l,h)},addOverloadedGetterSetter(l,h){const c=e.Util._capitalize(h),f=a+c,m=s+c;l.prototype[h]=function(){return arguments.length?(this[f](arguments[0]),this):this[m]()}},addDeprecatedGetterSetter(l,h,c,f){e.Util.error("Adding deprecated "+h);const m=s+e.Util._capitalize(h),_=h+" property is deprecated and will be removed soon. Look at Konva change log for more information.";l.prototype[m]=function(){e.Util.error(_);const x=this.attrs[h];return x===void 0?c:x},d.Factory.addSetter(l,h,f,function(){e.Util.error(_)}),d.Factory.addOverloadedGetterSetter(l,h)},backCompat(l,h){e.Util.each(h,function(c,f){const m=l.prototype[f],_=s+e.Util._capitalize(c),x=a+e.Util._capitalize(c);function w(){m.apply(this,arguments),e.Util.error('"'+c+'" method is deprecated and will be removed soon. Use ""'+f+'" instead.')}l.prototype[c]=w,l.prototype[_]=w,l.prototype[x]=w})},afterSetFilter(){this._filterUpToDate=!1}}})(ht);Object.defineProperty(bt,"__esModule",{value:!0});bt.Node=void 0;const pr=De,Te=ps,ri=ht,Pn=lt,dt=Gt,Bt=et,as="absoluteOpacity",es="allEventListeners",an="absoluteTransform",Qu="absoluteScale",Wn="canvas",F0="Change",A0="children",M0="konva",Ao="listening",L0="mouseenter",b0="mouseleave",O0="pointerenter",D0="pointerleave",G0="touchenter",I0="touchleave",Ju="set",Zu="Shape",os=" ",$u="stage",En="transform",U0="Stage",Mo="visible",z0=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(os);let B0=1;class nt{constructor(e){this._id=B0++,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(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===En||e===an)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,r){let s=this._cache.get(e);return(s===void 0||(e===En||e===an)&&s.dirty===!0)&&(s=r.call(this),this._cache.set(e,s)),s}_calculate(e,r,s){if(!this._attachedDepsListeners.get(e)){const a=r.map(l=>l+"Change.konva").join(os);this.on(a,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,s)}_getCanvasCache(){return this._cache.get(Wn)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===an&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Wn)){const{scene:e,filter:r,hit:s,buffer:a}=this._cache.get(Wn);dt.Util.releaseCanvas(e,r,s,a),this._cache.delete(Wn)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const r=e||{};let s={};(r.x===void 0||r.y===void 0||r.width===void 0||r.height===void 0)&&(s=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let a=Math.ceil(r.width||s.width),l=Math.ceil(r.height||s.height),h=r.pixelRatio,c=r.x===void 0?Math.floor(s.x):r.x,f=r.y===void 0?Math.floor(s.y):r.y,m=r.offset||0,_=r.drawBorder||!1,x=r.hitCanvasPixelRatio||1;if(!a||!l){dt.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const w=Math.abs(Math.round(s.x)-c)>.5?1:0,C=Math.abs(Math.round(s.y)-f)>.5?1:0;a+=m*2+w,l+=m*2+C,c-=m,f-=m;const y=new pr.SceneCanvas({pixelRatio:h,width:a,height:l}),P=new pr.SceneCanvas({pixelRatio:h,width:0,height:0,willReadFrequently:!0}),E=new pr.HitCanvas({pixelRatio:x,width:a,height:l}),R=y.getContext(),L=E.getContext(),p=new pr.SceneCanvas({width:y.width/y.pixelRatio+Math.abs(c),height:y.height/y.pixelRatio+Math.abs(f),pixelRatio:y.pixelRatio}),v=p.getContext();return E.isCache=!0,y.isCache=!0,this._cache.delete(Wn),this._filterUpToDate=!1,r.imageSmoothingEnabled===!1&&(y.getContext()._context.imageSmoothingEnabled=!1,P.getContext()._context.imageSmoothingEnabled=!1),R.save(),L.save(),v.save(),R.translate(-c,-f),L.translate(-c,-f),v.translate(-c,-f),p.x=c,p.y=f,this._isUnderCache=!0,this._clearSelfAndDescendantCache(as),this._clearSelfAndDescendantCache(Qu),this.drawScene(y,this,p),this.drawHit(E,this),this._isUnderCache=!1,R.restore(),L.restore(),_&&(R.save(),R.beginPath(),R.rect(0,0,a,l),R.closePath(),R.setAttr("strokeStyle","red"),R.setAttr("lineWidth",5),R.stroke(),R.restore()),this._cache.set(Wn,{scene:y,filter:P,hit:E,buffer:p,x:c,y:f}),this._requestDraw(),this}isCached(){return this._cache.has(Wn)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,r){const s=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];let a=1/0,l=1/0,h=-1/0,c=-1/0;const f=this.getAbsoluteTransform(r);return s.forEach(function(m){const _=f.point(m);a===void 0&&(a=h=_.x,l=c=_.y),a=Math.min(a,_.x),l=Math.min(l,_.y),h=Math.max(h,_.x),c=Math.max(c,_.y)}),{x:a,y:l,width:h-a,height:c-l}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const r=this._getCanvasCache();e.translate(r.x,r.y);const s=this._getCachedSceneCanvas(),a=s.pixelRatio;e.drawImage(s._canvas,0,0,s.width/a,s.height/a),e.restore()}_drawCachedHitCanvas(e){const r=this._getCanvasCache(),s=r.hit;e.save(),e.translate(r.x,r.y),e.drawImage(s._canvas,0,0,s.width/s.pixelRatio,s.height/s.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),r=this._getCanvasCache(),s=r.scene,a=r.filter,l=a.getContext(),h,c,f,m;if(e){if(!this._filterUpToDate){const _=s.pixelRatio;a.setSize(s.width/s.pixelRatio,s.height/s.pixelRatio);try{for(h=e.length,l.clear(),l.drawImage(s._canvas,0,0,s.getWidth()/_,s.getHeight()/_),c=l.getImageData(0,0,a.getWidth(),a.getHeight()),f=0;f{let r,s;if(!e)return this;for(r in e)r!==A0&&(s=Ju+dt.Util._capitalize(r),dt.Util._isFunction(this[s])?this[s](e[r]):this._setAttr(r,e[r]))}),this}isListening(){return this._getCache(Ao,this._isListening)}_isListening(e){if(!this.listening())return!1;const s=this.getParent();return s&&s!==e&&this!==e?s._isListening(e):!0}isVisible(){return this._getCache(Mo,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const s=this.getParent();return s&&s!==e&&this!==e?s._isVisible(e):!0}shouldDrawHit(e,r=!1){if(e)return this._isVisible(e)&&this._isListening(e);const s=this.getLayer();let a=!1;Te.DD._dragElements.forEach(h=>{h.dragStatus==="dragging"&&(h.node.nodeType==="Stage"||h.node.getLayer()===s)&&(a=!0)});const l=!r&&!Pn.Konva.hitOnDragEnabled&&(a||Pn.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!l}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),r=this,s=0,a,l,h,c;function f(_){for(a=[],l=_.length,h=0;h0&&a[0].getDepth()<=e&&f(a)}const m=this.getStage();return r.nodeType!==U0&&m&&f(m.getChildren()),s}getDepth(){let e=0,r=this.parent;for(;r;)e++,r=r.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(En),this._clearSelfAndDescendantCache(an)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;const r=e.getPointerPosition();if(!r)return null;const s=this.getAbsoluteTransform().copy();return s.invert(),s.point(r)}getAbsolutePosition(e){let r=!1,s=this.parent;for(;s;){if(s.isCached()){r=!0;break}s=s.parent}r&&!e&&(e=!0);const a=this.getAbsoluteTransform(e).getMatrix(),l=new dt.Transform,h=this.offset();return l.m=a.slice(),l.translate(h.x,h.y),l.getTranslation()}setAbsolutePosition(e){const{x:r,y:s,...a}=this._clearTransform();this.attrs.x=r,this.attrs.y=s,this._clearCache(En);const l=this._getAbsoluteTransform().copy();return l.invert(),l.translate(e.x,e.y),e={x:this.attrs.x+l.getTranslation().x,y:this.attrs.y+l.getTranslation().y},this._setTransform(a),this.setPosition({x:e.x,y:e.y}),this._clearCache(En),this._clearSelfAndDescendantCache(an),this}_setTransform(e){let r;for(r in e)this.attrs[r]=e[r]}_clearTransform(){const e={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,e}move(e){let r=e.x,s=e.y,a=this.x(),l=this.y();return r!==void 0&&(a+=r),s!==void 0&&(l+=s),this.setPosition({x:a,y:l}),this}_eachAncestorReverse(e,r){let s=[],a=this.getParent(),l,h;if(!(r&&r._id===this._id)){for(s.unshift(this);a&&(!r||a._id!==r._id);)s.unshift(a),a=a.parent;for(l=s.length,h=0;h0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return dt.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return dt.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&dt.Util.warn("Unexpected value "+e+" 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)+".");const r=this.index;return this.parent.children.splice(r,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(as,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const r=this.getParent();return r&&!r._isUnderCache&&(e*=r.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),r,s,a,l,h;const c={attrs:{},className:this.getClassName()};for(r in e)s=e[r],h=dt.Util.isObject(s)&&!dt.Util._isPlainObject(s)&&!dt.Util._isArray(s),!h&&(a=typeof this[r]=="function"&&this[r],delete e[r],l=a?a.call(this):null,e[r]=s,l!==s&&(c.attrs[r]=s));return dt.Util._prepareToStringify(c)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,r,s){const a=[];r&&this._isMatch(e)&&a.push(this);let l=this.parent;for(;l;){if(l===s)return a;l._isMatch(e)&&a.push(l),l=l.parent}return a}isAncestorOf(e){return!1}findAncestor(e,r,s){return this.findAncestors(e,r,s)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);let r=e.replace(/ /g,"").split(","),s=r.length,a,l;for(a=0;a{try{const a=e==null?void 0:e.callback;a&&delete e.callback,dt.Util._urlToImage(this.toDataURL(e),function(l){r(l),a==null||a(l)})}catch(a){s(a)}})}toBlob(e){return new Promise((r,s)=>{try{const a=e==null?void 0:e.callback;a&&delete e.callback,this.toCanvas(e).toBlob(l=>{r(l),a==null||a(l)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(a){s(a)}})}setSize(e){return this.width(e.width),this.height(e.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():Pn.Konva.dragDistance}_off(e,r,s){let a=this.eventListeners[e],l,h,c;for(l=0;l=0)||this.isDragging())return;let a=!1;Te.DD._dragElements.forEach(l=>{this.isAncestorOf(l.node)&&(a=!0)}),a||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const r=Te.DD._dragElements.get(this._id),s=r&&r.dragStatus==="dragging",a=r&&r.dragStatus==="ready";s?this.stopDrag():a&&Te.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const r=this.getStage();if(!r)return!1;const s={x:-e.x,y:-e.y,width:r.width()+2*e.x,height:r.height()+2*e.y};return dt.Util.haveIntersection(s,this.getClientRect())}static create(e,r){return dt.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,r)}static _createNode(e,r){let s=nt.prototype.getClassName.call(e),a=e.children,l,h,c;r&&(e.attrs.container=r),Pn.Konva[s]||(dt.Util.warn('Can not find a node with class name "'+s+'". Fallback to "Shape".'),s="Shape");const f=Pn.Konva[s];if(l=new f(e.attrs),a)for(h=a.length,c=0;c0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let s=0;s0?r[0]:void 0}_generalFind(e,r){const s=[];return this._descendants(a=>{const l=a._isMatch(e);return l&&s.push(a),!!(l&&r)}),s}_descendants(e){let r=!1;const s=this.getChildren();for(const a of s){if(r=e(a),r)return!0;if(a.hasChildren()&&(r=a._descendants(e),r))return!0}return!1}toObject(){const e=So.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(r=>{e.children.push(r.toObject())}),e}isAncestorOf(e){let r=e.getParent();for(;r;){if(r._id===this._id)return!0;r=r.getParent()}return!1}clone(e){const r=So.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(s){r.add(s.clone())}),r}getAllIntersections(e){const r=[];return this.find("Shape").forEach(s=>{s.isVisible()&&s.intersects(e)&&r.push(s)}),r}_clearSelfAndDescendantCache(e){var r;super._clearSelfAndDescendantCache(e),!this.isCached()&&((r=this.children)===null||r===void 0||r.forEach(function(s){s._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(r,s){r.index=s}),this._requestDraw()}drawScene(e,r,s){const a=this.getLayer(),l=e||a&&a.getCanvas(),h=l&&l.getContext(),c=this._getCanvasCache(),f=c&&c.scene,m=l&&l.isCache;if(!this.isVisible()&&!m)return this;if(f){h.save();const _=this.getAbsoluteTransform(r).getMatrix();h.transform(_[0],_[1],_[2],_[3],_[4],_[5]),this._drawCachedSceneCanvas(h),h.restore()}else this._drawChildren("drawScene",l,r,s);return this}drawHit(e,r){if(!this.shouldDrawHit(r))return this;const s=this.getLayer(),a=e||s&&s.hitCanvas,l=a&&a.getContext(),h=this._getCanvasCache();if(h&&h.hit){l.save();const f=this.getAbsoluteTransform(r).getMatrix();l.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedHitCanvas(l),l.restore()}else this._drawChildren("drawHit",a,r);return this}_drawChildren(e,r,s,a){var l;const h=r&&r.getContext(),c=this.clipWidth(),f=this.clipHeight(),m=this.clipFunc(),_=typeof c=="number"&&typeof f=="number"||m,x=s===this;if(_){h.save();const C=this.getAbsoluteTransform(s);let y=C.getMatrix();h.transform(y[0],y[1],y[2],y[3],y[4],y[5]),h.beginPath();let P;if(m)P=m.call(this,h,this);else{const E=this.clipX(),R=this.clipY();h.rect(E||0,R||0,c,f)}h.clip.apply(h,P),y=C.copy().invert().getMatrix(),h.transform(y[0],y[1],y[2],y[3],y[4],y[5])}const w=!x&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";w&&(h.save(),h._applyGlobalCompositeOperation(this)),(l=this.children)===null||l===void 0||l.forEach(function(C){C[e](r,s,a)}),w&&h.restore(),_&&h.restore()}getClientRect(e={}){var r;const s=e.skipTransform,a=e.relativeTo;let l,h,c,f,m={x:1/0,y:1/0,width:0,height:0};const _=this;(r=this.children)===null||r===void 0||r.forEach(function(C){if(!C.visible())return;const y=C.getClientRect({relativeTo:_,skipShadow:e.skipShadow,skipStroke:e.skipStroke});y.width===0&&y.height===0||(l===void 0?(l=y.x,h=y.y,c=y.x+y.width,f=y.y+y.height):(l=Math.min(l,y.x),h=Math.min(h,y.y),c=Math.max(c,y.x+y.width),f=Math.max(f,y.y+y.height)))});const x=this.find("Shape");let w=!1;for(let C=0;CZt.indexOf("pointer")>=0?"pointer":Zt.indexOf("touch")>=0?"touch":"mouse",ct=Zt=>{const F=J(Zt);if(F==="pointer")return a.Konva.pointerEventsEnabled&&rt.pointer;if(F==="touch")return rt.touch;if(F==="mouse")return rt.mouse};function kt(Zt={}){return(Zt.clipFunc||Zt.clipWidth||Zt.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Zt}const Qe="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);";d.stages=[];class me extends s.Container{constructor(F){super(kt(F)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),d.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",()=>{kt(this.attrs)}),this._checkVisibility()}_validateAdd(F){const V=F.getType()==="Layer",Q=F.getType()==="FastLayer";V||Q||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const F=this.visible()?"":"none";this.content.style.display=F}setContainer(F){if(typeof F===_){let V;if(F.charAt(0)==="."){const Q=F.slice(1);F=document.getElementsByClassName(Q)[0]}else F.charAt(0)!=="#"?V=F:V=F.slice(1),F=document.getElementById(V);if(!F)throw"Can not find container in document with id "+V}return this._setAttr("container",F),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),F.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const F=this.children,V=F.length;for(let Q=0;Q-1&&d.stages.splice(V,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const F=this._pointerPositions[0]||this._changedPointerPositions[0];return F?{x:F.x,y:F.y}:(e.Util.warn(Qe),null)}_getPointerById(F){return this._pointerPositions.find(V=>V.id===F)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(F){F=F||{},F.x=F.x||0,F.y=F.y||0,F.width=F.width||this.width(),F.height=F.height||this.height();const V=new l.SceneCanvas({width:F.width,height:F.height,pixelRatio:F.pixelRatio||1}),Q=V.getContext()._context,Ct=this.children;return(F.x||F.y)&&Q.translate(-1*F.x,-1*F.y),Ct.forEach(function(at){if(!at.isVisible())return;const Tt=at._toKonvaCanvas(F);Q.drawImage(Tt._canvas,F.x,F.y,Tt.getWidth()/Tt.getPixelRatio(),Tt.getHeight()/Tt.getPixelRatio())}),V}getIntersection(F){if(!F)return null;const V=this.children,Q=V.length,Ct=Q-1;for(let at=Ct;at>=0;at--){const Tt=V[at].getIntersection(F);if(Tt)return Tt}return null}_resizeDOM(){const F=this.width(),V=this.height();this.content&&(this.content.style.width=F+x,this.content.style.height=V+x),this.bufferCanvas.setSize(F,V),this.bufferHitCanvas.setSize(F,V),this.children.forEach(Q=>{Q.setSize({width:F,height:V}),Q.draw()})}add(F,...V){if(arguments.length>1){for(let Ct=0;Cttt&&e.Util.warn("The stage has "+Q+" 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."),F.setSize({width:this.width(),height:this.height()}),F.draw(),a.Konva.isBrowser&&this.content.appendChild(F.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(F){return f.hasPointerCapture(F,this)}setPointerCapture(F){f.setPointerCapture(F,this)}releaseCapture(F){f.releaseCapture(F,this)}getLayers(){return this.children}_bindContentEvents(){a.Konva.isBrowser&>.forEach(([F,V])=>{this.content.addEventListener(F,Q=>{this[V](Q)},{passive:!1})})}_pointerenter(F){this.setPointersPositions(F);const V=ct(F.type);V&&this._fire(V.pointerenter,{evt:F,target:this,currentTarget:this})}_pointerover(F){this.setPointersPositions(F);const V=ct(F.type);V&&this._fire(V.pointerover,{evt:F,target:this,currentTarget:this})}_getTargetShape(F){let V=this[F+"targetShape"];return V&&!V.getStage()&&(V=null),V}_pointerleave(F){const V=ct(F.type),Q=J(F.type);if(!V)return;this.setPointersPositions(F);const Ct=this._getTargetShape(Q),at=!(a.Konva.isDragging()||a.Konva.isTransforming())||a.Konva.hitOnDragEnabled;Ct&&at?(Ct._fireAndBubble(V.pointerout,{evt:F}),Ct._fireAndBubble(V.pointerleave,{evt:F}),this._fire(V.pointerleave,{evt:F,target:this,currentTarget:this}),this[Q+"targetShape"]=null):at&&(this._fire(V.pointerleave,{evt:F,target:this,currentTarget:this}),this._fire(V.pointerout,{evt:F,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(F){const V=ct(F.type),Q=J(F.type);if(!V)return;this.setPointersPositions(F);let Ct=!1;this._changedPointerPositions.forEach(at=>{const Tt=this.getIntersection(at);if(h.DD.justDragged=!1,a.Konva["_"+Q+"ListenClick"]=!0,!Tt||!Tt.isListening()){this[Q+"ClickStartShape"]=void 0;return}a.Konva.capturePointerEventsEnabled&&Tt.setPointerCapture(at.id),this[Q+"ClickStartShape"]=Tt,Tt._fireAndBubble(V.pointerdown,{evt:F,pointerId:at.id}),Ct=!0;const Rt=F.type.indexOf("touch")>=0;Tt.preventDefault()&&F.cancelable&&Rt&&F.preventDefault()}),Ct||this._fire(V.pointerdown,{evt:F,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(F){const V=ct(F.type),Q=J(F.type);if(!V||(a.Konva.isDragging()&&h.DD.node.preventDefault()&&F.cancelable&&F.preventDefault(),this.setPointersPositions(F),!(!(a.Konva.isDragging()||a.Konva.isTransforming())||a.Konva.hitOnDragEnabled)))return;const at={};let Tt=!1;const Rt=this._getTargetShape(Q);this._changedPointerPositions.forEach(Ie=>{const xt=f.getCapturedShape(Ie.id)||this.getIntersection(Ie),dn=Ie.id,Ne={evt:F,pointerId:dn},fn=Rt!==xt;if(fn&&Rt&&(Rt._fireAndBubble(V.pointerout,{...Ne},xt),Rt._fireAndBubble(V.pointerleave,{...Ne},xt)),xt){if(at[xt._id])return;at[xt._id]=!0}xt&&xt.isListening()?(Tt=!0,fn&&(xt._fireAndBubble(V.pointerover,{...Ne},Rt),xt._fireAndBubble(V.pointerenter,{...Ne},Rt),this[Q+"targetShape"]=xt),xt._fireAndBubble(V.pointermove,{...Ne})):Rt&&(this._fire(V.pointerover,{evt:F,target:this,currentTarget:this,pointerId:dn}),this[Q+"targetShape"]=null)}),Tt||this._fire(V.pointermove,{evt:F,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(F){const V=ct(F.type),Q=J(F.type);if(!V)return;this.setPointersPositions(F);const Ct=this[Q+"ClickStartShape"],at=this[Q+"ClickEndShape"],Tt={};let Rt=!1;this._changedPointerPositions.forEach(Ie=>{const xt=f.getCapturedShape(Ie.id)||this.getIntersection(Ie);if(xt){if(xt.releaseCapture(Ie.id),Tt[xt._id])return;Tt[xt._id]=!0}const dn=Ie.id,Ne={evt:F,pointerId:dn};let fn=!1;a.Konva["_"+Q+"InDblClickWindow"]?(fn=!0,clearTimeout(this[Q+"DblTimeout"])):h.DD.justDragged||(a.Konva["_"+Q+"InDblClickWindow"]=!0,clearTimeout(this[Q+"DblTimeout"])),this[Q+"DblTimeout"]=setTimeout(function(){a.Konva["_"+Q+"InDblClickWindow"]=!1},a.Konva.dblClickWindow),xt&&xt.isListening()?(Rt=!0,this[Q+"ClickEndShape"]=xt,xt._fireAndBubble(V.pointerup,{...Ne}),a.Konva["_"+Q+"ListenClick"]&&Ct&&Ct===xt&&(xt._fireAndBubble(V.pointerclick,{...Ne}),fn&&at&&at===xt&&xt._fireAndBubble(V.pointerdblclick,{...Ne}))):(this[Q+"ClickEndShape"]=null,a.Konva["_"+Q+"ListenClick"]&&this._fire(V.pointerclick,{evt:F,target:this,currentTarget:this,pointerId:dn}),fn&&this._fire(V.pointerdblclick,{evt:F,target:this,currentTarget:this,pointerId:dn}))}),Rt||this._fire(V.pointerup,{evt:F,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),a.Konva["_"+Q+"ListenClick"]=!1,F.cancelable&&Q!=="touch"&&Q!=="pointer"&&F.preventDefault()}_contextmenu(F){this.setPointersPositions(F);const V=this.getIntersection(this.getPointerPosition());V&&V.isListening()?V._fireAndBubble(B,{evt:F}):this._fire(B,{evt:F,target:this,currentTarget:this})}_wheel(F){this.setPointersPositions(F);const V=this.getIntersection(this.getPointerPosition());V&&V.isListening()?V._fireAndBubble(St,{evt:F}):this._fire(St,{evt:F,target:this,currentTarget:this})}_pointercancel(F){this.setPointersPositions(F);const V=f.getCapturedShape(F.pointerId)||this.getIntersection(this.getPointerPosition());V&&V._fireAndBubble(k,f.createEvent(F)),f.releaseCapture(F.pointerId)}_lostpointercapture(F){f.releaseCapture(F.pointerId)}setPointersPositions(F){const V=this._getContentPosition();let Q=null,Ct=null;F=F||window.event,F.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(F.touches,at=>{this._pointerPositions.push({id:at.identifier,x:(at.clientX-V.left)/V.scaleX,y:(at.clientY-V.top)/V.scaleY})}),Array.prototype.forEach.call(F.changedTouches||F.touches,at=>{this._changedPointerPositions.push({id:at.identifier,x:(at.clientX-V.left)/V.scaleX,y:(at.clientY-V.top)/V.scaleY})})):(Q=(F.clientX-V.left)/V.scaleX,Ct=(F.clientY-V.top)/V.scaleY,this.pointerPos={x:Q,y:Ct},this._pointerPositions=[{x:Q,y:Ct,id:e.Util._getFirstPointerId(F)}],this._changedPointerPositions=[{x:Q,y:Ct,id:e.Util._getFirstPointerId(F)}])}_setPointerPosition(F){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(F)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const F=this.content.getBoundingClientRect();return{top:F.top,left:F.left,scaleX:F.width/this.content.clientWidth||1,scaleY:F.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new l.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new l.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!a.Konva.isBrowser)return;const F=this.container();if(!F)throw"Stage has no container. A container is required.";F.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"),F.appendChild(this.content),this._resizeDOM()}cache(){return e.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(F){F.batchDraw()}),this}}d.Stage=me,me.prototype.nodeType=m,(0,c._registerNode)(me),r.Factory.addGetterSetter(me,"container"),a.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{d.stages.forEach(Zt=>{Zt.batchDraw()})})})(Ih);var ii={},Kt={};(function(d){Object.defineProperty(d,"__esModule",{value:!0}),d.Shape=d.shapes=void 0;const e=lt,r=Gt,s=ht,a=bt,l=et,h=lt,c=Tn,f="hasShadow",m="shadowRGBA",_="patternImage",x="linearGradient",w="radialGradient";let C;function y(){return C||(C=r.Util.createCanvasElement().getContext("2d"),C)}d.shapes={};function P(U){const b=this.attrs.fillRule;b?U.fill(b):U.fill()}function E(U){U.stroke()}function R(U){const b=this.attrs.fillRule;b?U.fill(b):U.fill()}function L(U){U.stroke()}function p(){this._clearCache(f)}function v(){this._clearCache(m)}function k(){this._clearCache(_)}function M(){this._clearCache(x)}function I(){this._clearCache(w)}class T extends a.Node{constructor(b){super(b);let z;for(;z=r.Util.getRandomColor(),!(z&&!(z in d.shapes)););this.colorKey=z,d.shapes[z]=this}getContext(){return r.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return r.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(f,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(_,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const z=y().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(z&&z.setTransform){const B=new r.Transform;B.translate(this.fillPatternX(),this.fillPatternY()),B.rotate(e.Konva.getAngle(this.fillPatternRotation())),B.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),B.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const W=B.getMatrix(),Z=typeof DOMMatrix>"u"?{a:W[0],b:W[1],c:W[2],d:W[3],e:W[4],f:W[5]}:new DOMMatrix(W);z.setTransform(Z)}return z}}_getLinearGradient(){return this._getCache(x,this.__getLinearGradient)}__getLinearGradient(){const b=this.fillLinearGradientColorStops();if(b){const z=y(),B=this.fillLinearGradientStartPoint(),W=this.fillLinearGradientEndPoint(),Z=z.createLinearGradient(B.x,B.y,W.x,W.y);for(let j=0;jthis.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 b=this.hitStrokeWidth();return b==="auto"?this.hasStroke():this.strokeEnabled()&&!!b}intersects(b){const z=this.getStage();if(!z)return!1;const B=z.bufferHitCanvas;return B.getContext().clear(),this.drawHit(B,void 0,!0),B.context.getImageData(Math.round(b.x),Math.round(b.y),1,1).data[3]>0}destroy(){return a.Node.prototype.destroy.call(this),delete d.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(b){var z;if(!((z=this.attrs.perfectDrawEnabled)!==null&&z!==void 0?z:!0))return!1;const W=b||this.hasFill(),Z=this.hasStroke(),j=this.getAbsoluteOpacity()!==1;if(W&&Z&&j)return!0;const _t=this.hasShadow(),St=this.shadowForStrokeEnabled();return!!(W&&Z&&_t&&St)}setStrokeHitEnabled(b){r.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),b?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const b=this.size();return{x:this._centroid?-b.width/2:0,y:this._centroid?-b.height/2:0,width:b.width,height:b.height}}getClientRect(b={}){let z=!1,B=this.getParent();for(;B;){if(B.isCached()){z=!0;break}B=B.getParent()}const W=b.skipTransform,Z=b.relativeTo||z&&this.getStage()||void 0,j=this.getSelfRect(),St=!b.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,tt=j.width+St,gt=j.height+St,rt=!b.skipShadow&&this.hasShadow(),J=rt?this.shadowOffsetX():0,ct=rt?this.shadowOffsetY():0,kt=tt+Math.abs(J),Qe=gt+Math.abs(ct),me=rt&&this.shadowBlur()||0,Zt=kt+me*2,F=Qe+me*2,V={width:Zt,height:F,x:-(St/2+me)+Math.min(J,0)+j.x,y:-(St/2+me)+Math.min(ct,0)+j.y};return W?V:this._transformedRect(V,Z)}drawScene(b,z,B){const W=this.getLayer(),Z=b||W.getCanvas(),j=Z.getContext(),_t=this._getCanvasCache(),St=this.getSceneFunc(),tt=this.hasShadow();let gt;const rt=z===this;if(!this.isVisible()&&!rt)return this;if(_t){j.save();const J=this.getAbsoluteTransform(z).getMatrix();return j.transform(J[0],J[1],J[2],J[3],J[4],J[5]),this._drawCachedSceneCanvas(j),j.restore(),this}if(!St)return this;if(j.save(),this._useBufferCanvas()){gt=this.getStage();const J=B||gt.bufferCanvas,ct=J.getContext();ct.clear(),ct.save(),ct._applyLineJoin(this);const kt=this.getAbsoluteTransform(z).getMatrix();ct.transform(kt[0],kt[1],kt[2],kt[3],kt[4],kt[5]),St.call(this,ct,this),ct.restore();const Qe=J.pixelRatio;tt&&j._applyShadow(this),j._applyOpacity(this),j._applyGlobalCompositeOperation(this),j.drawImage(J._canvas,J.x||0,J.y||0,J.width/Qe,J.height/Qe)}else{if(j._applyLineJoin(this),!rt){const J=this.getAbsoluteTransform(z).getMatrix();j.transform(J[0],J[1],J[2],J[3],J[4],J[5]),j._applyOpacity(this),j._applyGlobalCompositeOperation(this)}tt&&j._applyShadow(this),St.call(this,j,this)}return j.restore(),this}drawHit(b,z,B=!1){if(!this.shouldDrawHit(z,B))return this;const W=this.getLayer(),Z=b||W.hitCanvas,j=Z&&Z.getContext(),_t=this.hitFunc()||this.sceneFunc(),St=this._getCanvasCache(),tt=St&&St.hit;if(this.colorKey||r.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()"),tt){j.save();const rt=this.getAbsoluteTransform(z).getMatrix();return j.transform(rt[0],rt[1],rt[2],rt[3],rt[4],rt[5]),this._drawCachedHitCanvas(j),j.restore(),this}if(!_t)return this;if(j.save(),j._applyLineJoin(this),!(this===z)){const rt=this.getAbsoluteTransform(z).getMatrix();j.transform(rt[0],rt[1],rt[2],rt[3],rt[4],rt[5])}return _t.call(this,j,this),j.restore(),this}drawHitFromCache(b=0){const z=this._getCanvasCache(),B=this._getCachedSceneCanvas(),W=z.hit,Z=W.getContext(),j=W.getWidth(),_t=W.getHeight();Z.clear(),Z.drawImage(B._canvas,0,0,j,_t);try{const St=Z.getImageData(0,0,j,_t),tt=St.data,gt=tt.length,rt=r.Util._hexToRgb(this.colorKey);for(let J=0;Jb?(tt[J]=rt.r,tt[J+1]=rt.g,tt[J+2]=rt.b,tt[J+3]=255):tt[J+3]=0;Z.putImageData(St,0,0)}catch(St){r.Util.error("Unable to draw hit graph from cached scene canvas. "+St.message)}return this}hasPointerCapture(b){return c.hasPointerCapture(b,this)}setPointerCapture(b){c.setPointerCapture(b,this)}releaseCapture(b){c.releaseCapture(b,this)}}d.Shape=T,T.prototype._fillFunc=P,T.prototype._strokeFunc=E,T.prototype._fillFuncHit=R,T.prototype._strokeFuncHit=L,T.prototype._centroid=!1,T.prototype.nodeType="Shape",(0,h._registerNode)(T),T.prototype.eventListeners={},T.prototype.on.call(T.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",p),T.prototype.on.call(T.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",v),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",k),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",M),T.prototype.on.call(T.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",I),s.Factory.addGetterSetter(T,"stroke",void 0,(0,l.getStringOrGradientValidator)()),s.Factory.addGetterSetter(T,"strokeWidth",2,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(T,"fillAfterStrokeEnabled",!1),s.Factory.addGetterSetter(T,"hitStrokeWidth","auto",(0,l.getNumberOrAutoValidator)()),s.Factory.addGetterSetter(T,"strokeHitEnabled",!0,(0,l.getBooleanValidator)()),s.Factory.addGetterSetter(T,"perfectDrawEnabled",!0,(0,l.getBooleanValidator)()),s.Factory.addGetterSetter(T,"shadowForStrokeEnabled",!0,(0,l.getBooleanValidator)()),s.Factory.addGetterSetter(T,"lineJoin"),s.Factory.addGetterSetter(T,"lineCap"),s.Factory.addGetterSetter(T,"sceneFunc"),s.Factory.addGetterSetter(T,"hitFunc"),s.Factory.addGetterSetter(T,"dash"),s.Factory.addGetterSetter(T,"dashOffset",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(T,"shadowColor",void 0,(0,l.getStringValidator)()),s.Factory.addGetterSetter(T,"shadowBlur",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(T,"shadowOpacity",1,(0,l.getNumberValidator)()),s.Factory.addComponentsGetterSetter(T,"shadowOffset",["x","y"]),s.Factory.addGetterSetter(T,"shadowOffsetX",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(T,"shadowOffsetY",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(T,"fillPatternImage"),s.Factory.addGetterSetter(T,"fill",void 0,(0,l.getStringOrGradientValidator)()),s.Factory.addGetterSetter(T,"fillPatternX",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(T,"fillPatternY",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(T,"fillLinearGradientColorStops"),s.Factory.addGetterSetter(T,"strokeLinearGradientColorStops"),s.Factory.addGetterSetter(T,"fillRadialGradientStartRadius",0),s.Factory.addGetterSetter(T,"fillRadialGradientEndRadius",0),s.Factory.addGetterSetter(T,"fillRadialGradientColorStops"),s.Factory.addGetterSetter(T,"fillPatternRepeat","repeat"),s.Factory.addGetterSetter(T,"fillEnabled",!0),s.Factory.addGetterSetter(T,"strokeEnabled",!0),s.Factory.addGetterSetter(T,"shadowEnabled",!0),s.Factory.addGetterSetter(T,"dashEnabled",!0),s.Factory.addGetterSetter(T,"strokeScaleEnabled",!0),s.Factory.addGetterSetter(T,"fillPriority","color"),s.Factory.addComponentsGetterSetter(T,"fillPatternOffset",["x","y"]),s.Factory.addGetterSetter(T,"fillPatternOffsetX",0,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(T,"fillPatternOffsetY",0,(0,l.getNumberValidator)()),s.Factory.addComponentsGetterSetter(T,"fillPatternScale",["x","y"]),s.Factory.addGetterSetter(T,"fillPatternScaleX",1,(0,l.getNumberValidator)()),s.Factory.addGetterSetter(T,"fillPatternScaleY",1,(0,l.getNumberValidator)()),s.Factory.addComponentsGetterSetter(T,"fillLinearGradientStartPoint",["x","y"]),s.Factory.addComponentsGetterSetter(T,"strokeLinearGradientStartPoint",["x","y"]),s.Factory.addGetterSetter(T,"fillLinearGradientStartPointX",0),s.Factory.addGetterSetter(T,"strokeLinearGradientStartPointX",0),s.Factory.addGetterSetter(T,"fillLinearGradientStartPointY",0),s.Factory.addGetterSetter(T,"strokeLinearGradientStartPointY",0),s.Factory.addComponentsGetterSetter(T,"fillLinearGradientEndPoint",["x","y"]),s.Factory.addComponentsGetterSetter(T,"strokeLinearGradientEndPoint",["x","y"]),s.Factory.addGetterSetter(T,"fillLinearGradientEndPointX",0),s.Factory.addGetterSetter(T,"strokeLinearGradientEndPointX",0),s.Factory.addGetterSetter(T,"fillLinearGradientEndPointY",0),s.Factory.addGetterSetter(T,"strokeLinearGradientEndPointY",0),s.Factory.addComponentsGetterSetter(T,"fillRadialGradientStartPoint",["x","y"]),s.Factory.addGetterSetter(T,"fillRadialGradientStartPointX",0),s.Factory.addGetterSetter(T,"fillRadialGradientStartPointY",0),s.Factory.addComponentsGetterSetter(T,"fillRadialGradientEndPoint",["x","y"]),s.Factory.addGetterSetter(T,"fillRadialGradientEndPointX",0),s.Factory.addGetterSetter(T,"fillRadialGradientEndPointY",0),s.Factory.addGetterSetter(T,"fillPatternRotation",0),s.Factory.addGetterSetter(T,"fillRule",void 0,(0,l.getStringValidator)()),s.Factory.backCompat(T,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Kt);Object.defineProperty(ii,"__esModule",{value:!0});ii.Layer=void 0;const sn=Gt,Co=Kn,mr=bt,jo=ht,th=De,K0=et,Y0=Kt,X0=lt,q0="#",Q0="beforeDraw",J0="draw",Bh=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Z0=Bh.length;let xr=class extends Co.Container{constructor(e){super(e),this.canvas=new th.SceneCanvas,this.hitCanvas=new th.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(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const r=this.getStage();return r&&r.content&&(r.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let r=1,s=!1;for(;;){for(let a=0;a0)return{antialiased:!0};return{}}drawScene(e,r,s){const a=this.getLayer(),l=e||a&&a.getCanvas();return this._fire(Q0,{node:this}),this.clearBeforeDraw()&&l.getContext().clear(),Co.Container.prototype.drawScene.call(this,l,r,s),this._fire(J0,{node:this}),this}drawHit(e,r){const s=this.getLayer(),a=e||s&&s.hitCanvas;return s&&s.clearBeforeDraw()&&s.getHitCanvas().getContext().clear(),Co.Container.prototype.drawHit.call(this,a,r),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){sn.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return sn.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return sn.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};ii.Layer=xr;xr.prototype.nodeType="Layer";(0,X0._registerNode)(xr);jo.Factory.addGetterSetter(xr,"imageSmoothingEnabled",!0);jo.Factory.addGetterSetter(xr,"clearBeforeDraw",!0);jo.Factory.addGetterSetter(xr,"hitGraphEnabled",!0,(0,K0.getBooleanValidator)());var ys={};Object.defineProperty(ys,"__esModule",{value:!0});ys.FastLayer=void 0;const $0=Gt,tf=ii,ef=lt;class Ko extends tf.Layer{constructor(e){super(e),this.listening(!1),$0.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}ys.FastLayer=Ko;Ko.prototype.nodeType="FastLayer";(0,ef._registerNode)(Ko);var Pr={};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.Group=void 0;const nf=Gt,rf=Kn,sf=lt;class Yo extends rf.Container{_validateAdd(e){const r=e.getType();r!=="Group"&&r!=="Shape"&&nf.Util.throw("You may only add groups and shapes to groups.")}}Pr.Group=Yo;Yo.prototype.nodeType="Group";(0,sf._registerNode)(Yo);var Er={};Object.defineProperty(Er,"__esModule",{value:!0});Er.Animation=void 0;const wo=lt,eh=Gt,xo=function(){return wo.glob.performance&&wo.glob.performance.now?function(){return wo.glob.performance.now()}:function(){return new Date().getTime()}}();class Ye{constructor(e,r){this.id=Ye.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:xo(),frameRate:0},this.func=e,this.setLayers(r)}setLayers(e){let r=[];return e&&(r=Array.isArray(e)?e:[e]),this.layers=r,this}getLayers(){return this.layers}addLayer(e){const r=this.layers,s=r.length;for(let a=0;athis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():y<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=y,this.update())}getTime(){return this._time}setPosition(y){this.prevPos=this._pos,this.propFunc(y),this._pos=y}getPosition(y){return y===void 0&&(y=this._time),this.func(y,this.begin,this._change,this.duration)}play(){this.state=c,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=f,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(y){this.pause(),this._time=y,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")}onEnterFrame(){const y=this.getTimer()-this._startTime;this.state===c?this.setTime(y):this.state===f&&this.setTime(this.duration-y)}pause(){this.state=h,this.fire("onPause")}getTimer(){return new Date().getTime()}}class w{constructor(y){const P=this,E=y.node,R=E._id,L=y.easing||d.Easings.Linear,p=!!y.yoyo;let v,k;typeof y.duration>"u"?v=.3:y.duration===0?v=.001:v=y.duration,this.node=E,this._id=_++;const M=E.getLayer()||(E instanceof a.Konva.Stage?E.getLayers():null);M||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new r.Animation(function(){P.tween.onEnterFrame()},M),this.tween=new x(k,function(I){P._tweenFunc(I)},L,0,1,v*1e3,p),this._addListeners(),w.attrs[R]||(w.attrs[R]={}),w.attrs[R][this._id]||(w.attrs[R][this._id]={}),w.tweens[R]||(w.tweens[R]={});for(k in y)l[k]===void 0&&this._addAttr(k,y[k]);this.reset(),this.onFinish=y.onFinish,this.onReset=y.onReset,this.onUpdate=y.onUpdate}_addAttr(y,P){const E=this.node,R=E._id;let L,p,v,k,M;const I=w.tweens[R][y];I&&delete w.attrs[R][I][y];let T=E.getAttr(y);if(e.Util._isArray(P))if(L=[],p=Math.max(P.length,T.length),y==="points"&&P.length!==T.length&&(P.length>T.length?(k=T,T=e.Util._prepareArrayForTween(T,P,E.closed())):(v=P,P=e.Util._prepareArrayForTween(P,T,E.closed()))),y.indexOf("fill")===0)for(let U=0;U{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const y=this.node,P=w.attrs[y._id][this._id];P.points&&P.points.trueEnd&&y.setAttr("points",P.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const y=this.node,P=w.attrs[y._id][this._id];P.points&&P.points.trueStart&&y.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(y){return this.tween.seek(y*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const y=this.node._id,P=this._id,E=w.tweens[y];this.pause(),this.anim&&this.anim.stop();for(const R in E)delete w.tweens[y][R];delete w.attrs[y][P],w.tweens[y]&&(Object.keys(w.tweens[y]).length===0&&delete w.tweens[y],Object.keys(w.attrs[y]).length===0&&delete w.attrs[y])}}d.Tween=w,w.attrs={},w.tweens={},s.Node.prototype.to=function(C){const y=C.onFinish;C.node=this,C.onFinish=function(){this.destroy(),y&&y()},new w(C).play()},d.Easings={BackEaseIn(C,y,P,E){return P*(C/=E)*C*((1.70158+1)*C-1.70158)+y},BackEaseOut(C,y,P,E){return P*((C=C/E-1)*C*((1.70158+1)*C+1.70158)+1)+y},BackEaseInOut(C,y,P,E){let R=1.70158;return(C/=E/2)<1?P/2*(C*C*(((R*=1.525)+1)*C-R))+y:P/2*((C-=2)*C*(((R*=1.525)+1)*C+R)+2)+y},ElasticEaseIn(C,y,P,E,R,L){let p=0;return C===0?y:(C/=E)===1?y+P:(L||(L=E*.3),!R||R0?e:r),_=h*r,x=c*(c>0?e:r),w=f*(f>0?r:e);return{x:m,y:s?-1*w:x,width:_-m,height:w-x}}}_s.Arc=hn;hn.prototype._centroid=!0;hn.prototype.className="Arc";hn.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];(0,of._registerNode)(hn);vs.Factory.addGetterSetter(hn,"innerRadius",0,(0,Ss.getNumberValidator)());vs.Factory.addGetterSetter(hn,"outerRadius",0,(0,Ss.getNumberValidator)());vs.Factory.addGetterSetter(hn,"angle",0,(0,Ss.getNumberValidator)());vs.Factory.addGetterSetter(hn,"clockwise",!1,(0,Ss.getBooleanValidator)());var Cs={},si={};Object.defineProperty(si,"__esModule",{value:!0});si.Line=void 0;const ws=ht,lf=lt,uf=Kt,Hh=et;function Lo(d,e,r,s,a,l,h){const c=Math.sqrt(Math.pow(r-d,2)+Math.pow(s-e,2)),f=Math.sqrt(Math.pow(a-r,2)+Math.pow(l-s,2)),m=h*c/(c+f),_=h*f/(c+f),x=r-m*(a-d),w=s-m*(l-e),C=r+_*(a-d),y=s+_*(l-e);return[x,w,C,y]}function rh(d,e){const r=d.length,s=[];for(let a=2;a4){const f=this.getTensionPoints(),m=f.length;for(c=l?0:4,l||e.quadraticCurveTo(f[0],f[1],f[2],f[3]);c{let m,_;const w=f/2;m=0;for(let C=0;C<20;C++)_=w*d.tValues[20][C]+w,m+=d.cValues[20][C]*s(h,c,_);return w*m};d.getCubicArcLength=e;const r=(h,c,f)=>{f===void 0&&(f=1);const m=h[0]-2*h[1]+h[2],_=c[0]-2*c[1]+c[2],x=2*h[1]-2*h[0],w=2*c[1]-2*c[0],C=4*(m*m+_*_),y=4*(m*x+_*w),P=x*x+w*w;if(C===0)return f*Math.sqrt(Math.pow(h[2]-h[0],2)+Math.pow(c[2]-c[0],2));const E=y/(2*C),R=P/C,L=f+E,p=R-E*E,v=L*L+p>0?Math.sqrt(L*L+p):0,k=E*E+p>0?Math.sqrt(E*E+p):0,M=E+Math.sqrt(E*E+p)!==0?p*Math.log(Math.abs((L+v)/(E+k))):0;return Math.sqrt(C)/2*(L*v-E*k+M)};d.getQuadraticArcLength=r;function s(h,c,f){const m=a(1,f,h),_=a(1,f,c),x=m*m+_*_;return Math.sqrt(x)}const a=(h,c,f)=>{const m=f.length-1;let _,x;if(m===0)return 0;if(h===0){x=0;for(let w=0;w<=m;w++)x+=d.binomialCoefficients[m][w]*Math.pow(1-c,m-w)*Math.pow(c,w)*f[w];return x}else{_=new Array(m);for(let w=0;w{let m=1,_=h/c,x=(h-f(_))/c,w=0;for(;m>.001;){const C=f(_+x),y=Math.abs(h-C)/c;if(y500)break}return _};d.t2length=l})(Wh);Object.defineProperty(kr,"__esModule",{value:!0});kr.Path=void 0;const hf=ht,cf=lt,df=Kt,yr=Wh;class jt extends df.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=jt.parsePathData(this.data()),this.pathLength=jt.getPathLength(this.dataArray)}_sceneFunc(e){const r=this.dataArray;e.beginPath();let s=!1;for(let a=0;a_?m:_,E=m>_?1:m/_,R=m>_?_/m:1;e.translate(c,f),e.rotate(C),e.scale(E,R),e.arc(0,0,P,x,x+w,1-y),e.scale(1/E,1/R),e.rotate(-C),e.translate(-c,-f);break;case"z":s=!0,e.closePath();break}}!s&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(f){if(f.command==="A"){const m=f.points[4],_=f.points[5],x=f.points[4]+_;let w=Math.PI/180;if(Math.abs(m-x)x;C-=w){const y=jt.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],C,0);e.push(y.x,y.y)}else for(let C=m+w;Cr[a].pathLength;)e-=r[a].pathLength,++a;if(a===l)return s=r[a-1].points.slice(-2),{x:s[0],y:s[1]};if(e<.01)return r[a].command==="M"?(s=r[a].points.slice(0,2),{x:s[0],y:s[1]}):{x:r[a].start.x,y:r[a].start.y};const h=r[a],c=h.points;switch(h.command){case"L":return jt.getPointOnLine(e,h.start.x,h.start.y,c[0],c[1]);case"C":return jt.getPointOnCubicBezier((0,yr.t2length)(e,jt.getPathLength(r),P=>(0,yr.getCubicArcLength)([h.start.x,c[0],c[2],c[4]],[h.start.y,c[1],c[3],c[5]],P)),h.start.x,h.start.y,c[0],c[1],c[2],c[3],c[4],c[5]);case"Q":return jt.getPointOnQuadraticBezier((0,yr.t2length)(e,jt.getPathLength(r),P=>(0,yr.getQuadraticArcLength)([h.start.x,c[0],c[2]],[h.start.y,c[1],c[3]],P)),h.start.x,h.start.y,c[0],c[1],c[2],c[3]);case"A":const f=c[0],m=c[1],_=c[2],x=c[3],w=c[5],C=c[6];let y=c[4];return y+=w*e/h.pathLength,jt.getPointOnEllipticalArc(f,m,_,x,y,C)}return null}static getPointOnLine(e,r,s,a,l,h,c){h=h??r,c=c??s;const f=this.getLineLength(r,s,a,l);if(f<1e-10)return{x:r,y:s};if(a===r)return{x:h,y:c+(l>s?e:-e)};const m=(l-s)/(a-r),_=Math.sqrt(e*e/(1+m*m))*(a0&&!isNaN(y[0]);){let P="",E=[];const R=c,L=f;let p,v,k,M,I,T,U,b,z,B;switch(C){case"l":c+=y.shift(),f+=y.shift(),P="L",E.push(c,f);break;case"L":c=y.shift(),f=y.shift(),E.push(c,f);break;case"m":const W=y.shift(),Z=y.shift();if(c+=W,f+=Z,P="M",l.length>2&&l[l.length-1].command==="z"){for(let j=l.length-2;j>=0;j--)if(l[j].command==="M"){c=l[j].points[0]+W,f=l[j].points[1]+Z;break}}E.push(c,f),C="l";break;case"M":c=y.shift(),f=y.shift(),P="M",E.push(c,f),C="L";break;case"h":c+=y.shift(),P="L",E.push(c,f);break;case"H":c=y.shift(),P="L",E.push(c,f);break;case"v":f+=y.shift(),P="L",E.push(c,f);break;case"V":f=y.shift(),P="L",E.push(c,f);break;case"C":E.push(y.shift(),y.shift(),y.shift(),y.shift()),c=y.shift(),f=y.shift(),E.push(c,f);break;case"c":E.push(c+y.shift(),f+y.shift(),c+y.shift(),f+y.shift()),c+=y.shift(),f+=y.shift(),P="C",E.push(c,f);break;case"S":v=c,k=f,p=l[l.length-1],p.command==="C"&&(v=c+(c-p.points[2]),k=f+(f-p.points[3])),E.push(v,k,y.shift(),y.shift()),c=y.shift(),f=y.shift(),P="C",E.push(c,f);break;case"s":v=c,k=f,p=l[l.length-1],p.command==="C"&&(v=c+(c-p.points[2]),k=f+(f-p.points[3])),E.push(v,k,c+y.shift(),f+y.shift()),c+=y.shift(),f+=y.shift(),P="C",E.push(c,f);break;case"Q":E.push(y.shift(),y.shift()),c=y.shift(),f=y.shift(),E.push(c,f);break;case"q":E.push(c+y.shift(),f+y.shift()),c+=y.shift(),f+=y.shift(),P="Q",E.push(c,f);break;case"T":v=c,k=f,p=l[l.length-1],p.command==="Q"&&(v=c+(c-p.points[0]),k=f+(f-p.points[1])),c=y.shift(),f=y.shift(),P="Q",E.push(v,k,c,f);break;case"t":v=c,k=f,p=l[l.length-1],p.command==="Q"&&(v=c+(c-p.points[0]),k=f+(f-p.points[1])),c+=y.shift(),f+=y.shift(),P="Q",E.push(v,k,c,f);break;case"A":M=y.shift(),I=y.shift(),T=y.shift(),U=y.shift(),b=y.shift(),z=c,B=f,c=y.shift(),f=y.shift(),P="A",E=this.convertEndpointToCenterParameterization(z,B,c,f,U,b,M,I,T);break;case"a":M=y.shift(),I=y.shift(),T=y.shift(),U=y.shift(),b=y.shift(),z=c,B=f,c+=y.shift(),f+=y.shift(),P="A",E=this.convertEndpointToCenterParameterization(z,B,c,f,U,b,M,I,T);break}l.push({command:P||C,points:E,start:{x:R,y:L},pathLength:this.calcLength(R,L,P||C,E)})}(C==="z"||C==="Z")&&l.push({command:"z",points:[],start:void 0,pathLength:0})}return l}static calcLength(e,r,s,a){let l,h,c,f;const m=jt;switch(s){case"L":return m.getLineLength(e,r,a[0],a[1]);case"C":return(0,yr.getCubicArcLength)([e,a[0],a[2],a[4]],[r,a[1],a[3],a[5]],1);case"Q":return(0,yr.getQuadraticArcLength)([e,a[0],a[2]],[r,a[1],a[3]],1);case"A":l=0;const _=a[4],x=a[5],w=a[4]+x;let C=Math.PI/180;if(Math.abs(_-w)w;f-=C)c=m.getPointOnEllipticalArc(a[0],a[1],a[2],a[3],f,0),l+=m.getLineLength(h.x,h.y,c.x,c.y),h=c;else for(f=_+C;f1&&(c*=Math.sqrt(C),f*=Math.sqrt(C));let y=Math.sqrt((c*c*(f*f)-c*c*(w*w)-f*f*(x*x))/(c*c*(w*w)+f*f*(x*x)));l===h&&(y*=-1),isNaN(y)&&(y=0);const P=y*c*w/f,E=y*-f*x/c,R=(e+s)/2+Math.cos(_)*P-Math.sin(_)*E,L=(r+a)/2+Math.sin(_)*P+Math.cos(_)*E,p=function(b){return Math.sqrt(b[0]*b[0]+b[1]*b[1])},v=function(b,z){return(b[0]*z[0]+b[1]*z[1])/(p(b)*p(z))},k=function(b,z){return(b[0]*z[1]=1&&(U=0),h===0&&U>0&&(U=U-2*Math.PI),h===1&&U<0&&(U=U+2*Math.PI),[R,L,c,f,M,U,_,h]}}kr.Path=jt;jt.prototype.className="Path";jt.prototype._attrsAffectingSize=["data"];(0,cf._registerNode)(jt);hf.Factory.addGetterSetter(jt,"data");Object.defineProperty(Cs,"__esModule",{value:!0});Cs.Arrow=void 0;const xs=ht,ff=si,jh=et,gf=lt,ih=kr;class Xn extends ff.Line{_sceneFunc(e){super._sceneFunc(e);const r=Math.PI*2,s=this.points();let a=s;const l=this.tension()!==0&&s.length>4;l&&(a=this.getTensionPoints());const h=this.pointerLength(),c=s.length;let f,m;if(l){const w=[a[a.length-4],a[a.length-3],a[a.length-2],a[a.length-1],s[c-2],s[c-1]],C=ih.Path.calcLength(a[a.length-4],a[a.length-3],"C",w),y=ih.Path.getPointOnQuadraticBezier(Math.min(1,1-h/C),w[0],w[1],w[2],w[3],w[4],w[5]);f=s[c-2]-y.x,m=s[c-1]-y.y}else f=s[c-2]-s[c-4],m=s[c-1]-s[c-3];const _=(Math.atan2(m,f)+r)%r,x=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(s[c-2],s[c-1]),e.rotate(_),e.moveTo(0,0),e.lineTo(-h,x/2),e.lineTo(-h,-x/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(s[0],s[1]),l?(f=(a[0]+a[2])/2-s[0],m=(a[1]+a[3])/2-s[1]):(f=s[2]-s[0],m=s[3]-s[1]),e.rotate((Math.atan2(-m,-f)+r)%r),e.moveTo(0,0),e.lineTo(-h,x/2),e.lineTo(-h,-x/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const r=this.dashEnabled();r&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),r&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),r=this.pointerWidth()/2;return{x:e.x,y:e.y-r,width:e.width,height:e.height+r*2}}}Cs.Arrow=Xn;Xn.prototype.className="Arrow";(0,gf._registerNode)(Xn);xs.Factory.addGetterSetter(Xn,"pointerLength",10,(0,jh.getNumberValidator)());xs.Factory.addGetterSetter(Xn,"pointerWidth",10,(0,jh.getNumberValidator)());xs.Factory.addGetterSetter(Xn,"pointerAtBeginning",!1);xs.Factory.addGetterSetter(Xn,"pointerAtEnding",!0);var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});Ps.Circle=void 0;const pf=ht,mf=Kt,yf=et,_f=lt;class Tr extends mf.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Ps.Circle=Tr;Tr.prototype._centroid=!0;Tr.prototype.className="Circle";Tr.prototype._attrsAffectingSize=["radius"];(0,_f._registerNode)(Tr);pf.Factory.addGetterSetter(Tr,"radius",0,(0,yf.getNumberValidator)());var Es={};Object.defineProperty(Es,"__esModule",{value:!0});Es.Ellipse=void 0;const Xo=ht,vf=Kt,Kh=et,Sf=lt;class Rn extends vf.Shape{_sceneFunc(e){const r=this.radiusX(),s=this.radiusY();e.beginPath(),e.save(),r!==s&&e.scale(1,s/r),e.arc(0,0,r,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Es.Ellipse=Rn;Rn.prototype.className="Ellipse";Rn.prototype._centroid=!0;Rn.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,Sf._registerNode)(Rn);Xo.Factory.addComponentsGetterSetter(Rn,"radius",["x","y"]);Xo.Factory.addGetterSetter(Rn,"radiusX",0,(0,Kh.getNumberValidator)());Xo.Factory.addGetterSetter(Rn,"radiusY",0,(0,Kh.getNumberValidator)());var ks={};Object.defineProperty(ks,"__esModule",{value:!0});ks.Image=void 0;const Po=Gt,qn=ht,Cf=Kt,wf=lt,ai=et;let Xe=class Yh extends Cf.Shape{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",r=>{this._removeImageLoad(r.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",this._loadListener)}_removeImageLoad(e){e&&e.removeEventListener&&e.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const e=!!this.cornerRadius(),r=this.hasShadow();return e&&r?!0:super._useBufferCanvas(!0)}_sceneFunc(e){const r=this.getWidth(),s=this.getHeight(),a=this.cornerRadius(),l=this.attrs.image;let h;if(l){const c=this.attrs.cropWidth,f=this.attrs.cropHeight;c&&f?h=[l,this.cropX(),this.cropY(),c,f,0,0,r,s]:h=[l,0,0,r,s]}(this.hasFill()||this.hasStroke()||a)&&(e.beginPath(),a?Po.Util.drawRoundedRectPath(e,r,s,a):e.rect(0,0,r,s),e.closePath(),e.fillStrokeShape(this)),l&&(a&&e.clip(),e.drawImage.apply(e,h))}_hitFunc(e){const r=this.width(),s=this.height(),a=this.cornerRadius();e.beginPath(),a?Po.Util.drawRoundedRectPath(e,r,s,a):e.rect(0,0,r,s),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,r;return(e=this.attrs.width)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.width}getHeight(){var e,r;return(e=this.attrs.height)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.height}static fromURL(e,r,s=null){const a=Po.Util.createImageElement();a.onload=function(){const l=new Yh({image:a});r(l)},a.onerror=s,a.crossOrigin="Anonymous",a.src=e}};ks.Image=Xe;Xe.prototype.className="Image";(0,wf._registerNode)(Xe);qn.Factory.addGetterSetter(Xe,"cornerRadius",0,(0,ai.getNumberOrArrayOfNumbersValidator)(4));qn.Factory.addGetterSetter(Xe,"image");qn.Factory.addComponentsGetterSetter(Xe,"crop",["x","y","width","height"]);qn.Factory.addGetterSetter(Xe,"cropX",0,(0,ai.getNumberValidator)());qn.Factory.addGetterSetter(Xe,"cropY",0,(0,ai.getNumberValidator)());qn.Factory.addGetterSetter(Xe,"cropWidth",0,(0,ai.getNumberValidator)());qn.Factory.addGetterSetter(Xe,"cropHeight",0,(0,ai.getNumberValidator)());var vr={};Object.defineProperty(vr,"__esModule",{value:!0});vr.Tag=vr.Label=void 0;const Ts=ht,xf=Kt,Pf=Pr,qo=et,Xh=lt,qh=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],Ef="Change.konva",kf="none",bo="up",Oo="right",Do="down",Go="left",Tf=qh.length;class Qo extends Pf.Group{constructor(e){super(e),this.on("add.konva",function(r){this._addListeners(r.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let r=this,s;const a=function(){r._sync()};for(s=0;s{r=Math.min(r,h.x),s=Math.max(s,h.x),a=Math.min(a,h.y),l=Math.max(l,h.y)}),{x:r,y:a,width:s-r,height:l-a}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Rs.RegularPolygon=Jn;Jn.prototype.className="RegularPolygon";Jn.prototype._centroid=!0;Jn.prototype._attrsAffectingSize=["radius"];(0,bf._registerNode)(Jn);Qh.Factory.addGetterSetter(Jn,"radius",0,(0,Jh.getNumberValidator)());Qh.Factory.addGetterSetter(Jn,"sides",0,(0,Jh.getNumberValidator)());var Fs={};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.Ring=void 0;const Zh=ht,Of=Kt,$h=et,Df=lt,sh=Math.PI*2;class Zn extends Of.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,sh,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),sh,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Fs.Ring=Zn;Zn.prototype.className="Ring";Zn.prototype._centroid=!0;Zn.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Df._registerNode)(Zn);Zh.Factory.addGetterSetter(Zn,"innerRadius",0,(0,$h.getNumberValidator)());Zh.Factory.addGetterSetter(Zn,"outerRadius",0,(0,$h.getNumberValidator)());var As={};Object.defineProperty(As,"__esModule",{value:!0});As.Sprite=void 0;const $n=ht,Gf=Kt,If=Er,tc=et,Uf=lt;class qe extends Gf.Shape{constructor(e){super(e),this._updated=!0,this.anim=new If.Animation(()=>{const r=this._updated;return this._updated=!1,r}),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(e){const r=this.animation(),s=this.frameIndex(),a=s*4,l=this.animations()[r],h=this.frameOffsets(),c=l[a+0],f=l[a+1],m=l[a+2],_=l[a+3],x=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,m,_),e.closePath(),e.fillStrokeShape(this)),x)if(h){const w=h[r],C=s*2;e.drawImage(x,c,f,m,_,w[C+0],w[C+1],m,_)}else e.drawImage(x,c,f,m,_,0,0,m,_)}_hitFunc(e){const r=this.animation(),s=this.frameIndex(),a=s*4,l=this.animations()[r],h=this.frameOffsets(),c=l[a+2],f=l[a+3];if(e.beginPath(),h){const m=h[r],_=s*2;e.rect(m[_+0],m[_+1],c,f)}else e.rect(0,0,c,f);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),r=this.animation(),s=this.animations(),a=s[r],l=a.length/4;e{if(new RegExp("\\p{Emoji}","u").test(r)){const l=a[s+1];l&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(l)?(e.push(r+l),a[s+1]=""):e.push(r)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(r+(a[s+1]||""))?e.push(r+a[s+1]):s>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(r)?e[e.length-1]+=r:r&&e.push(r);return e},[])}const _r="auto",Wf="center",ec="inherit",Qr="justify",jf="Change.konva",Kf="2d",ah="-",nc="left",Yf="text",Xf="Text",qf="top",Qf="bottom",oh="middle",rc="normal",Jf="px ",ns=" ",Zf="right",lh="rtl",$f="word",t1="char",uh="none",ko="…",ic=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],e1=ic.length;function n1(d){return d.split(",").map(e=>{e=e.trim();const r=e.indexOf(" ")>=0,s=e.indexOf('"')>=0||e.indexOf("'")>=0;return r&&!s&&(e=`"${e}"`),e}).join(", ")}let rs;function To(){return rs||(rs=Io.Util.createCanvasElement().getContext(Kf),rs)}function r1(d){d.fillText(this._partialText,this._partialTextX,this._partialTextY)}function i1(d){d.setAttr("miterLimit",2),d.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function s1(d){return d=d||{},!d.fillLinearGradientColorStops&&!d.fillRadialGradientColorStops&&!d.fillPatternImage&&(d.fill=d.fill||"black"),d}let Ut=class extends Vf.Shape{constructor(e){super(s1(e)),this._partialTextX=0,this._partialTextY=0;for(let r=0;r1&&(L+=h)}}_hitFunc(e){const r=this.getWidth(),s=this.getHeight();e.beginPath(),e.rect(0,0,r,s),e.closePath(),e.fillStrokeShape(this)}setText(e){const r=Io.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(Yf,r),this}getWidth(){return this.attrs.width===_r||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===_r||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Io.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var r,s,a,l,h,c,f,m,_,x,w;let C=To(),y=this.fontSize(),P;C.save(),C.font=this._getContextFont(),P=C.measureText(e),C.restore();const E=y/100;return{actualBoundingBoxAscent:(r=P.actualBoundingBoxAscent)!==null&&r!==void 0?r:71.58203125*E,actualBoundingBoxDescent:(s=P.actualBoundingBoxDescent)!==null&&s!==void 0?s:0,actualBoundingBoxLeft:(a=P.actualBoundingBoxLeft)!==null&&a!==void 0?a:-7.421875*E,actualBoundingBoxRight:(l=P.actualBoundingBoxRight)!==null&&l!==void 0?l:75.732421875*E,alphabeticBaseline:(h=P.alphabeticBaseline)!==null&&h!==void 0?h:0,emHeightAscent:(c=P.emHeightAscent)!==null&&c!==void 0?c:100*E,emHeightDescent:(f=P.emHeightDescent)!==null&&f!==void 0?f:-20*E,fontBoundingBoxAscent:(m=P.fontBoundingBoxAscent)!==null&&m!==void 0?m:91*E,fontBoundingBoxDescent:(_=P.fontBoundingBoxDescent)!==null&&_!==void 0?_:21*E,hangingBaseline:(x=P.hangingBaseline)!==null&&x!==void 0?x:72.80000305175781*E,ideographicBaseline:(w=P.ideographicBaseline)!==null&&w!==void 0?w:-21*E,width:P.width,height:y}}_getContextFont(){return this.fontStyle()+ns+this.fontVariant()+ns+(this.fontSize()+Jf)+n1(this.fontFamily())}_addTextLine(e){this.align()===Qr&&(e=e.trim());const s=this._getTextWidth(e);return this.textArr.push({text:e,width:s,lastInParagraph:!1})}_getTextWidth(e){const r=this.letterSpacing(),s=e.length;return To().measureText(e).width+r*s}_setTextData(){let e=this.text().split(` +`),r=+this.fontSize(),s=0,a=this.lineHeight()*r,l=this.attrs.width,h=this.attrs.height,c=l!==_r&&l!==void 0,f=h!==_r&&h!==void 0,m=this.padding(),_=l-m*2,x=h-m*2,w=0,C=this.wrap(),y=C!==uh,P=C!==t1&&y,E=this.ellipsis();this.textArr=[],To().font=this._getContextFont();const R=E?this._getTextWidth(ko):0;for(let L=0,p=e.length;L_)for(;v.length>0;){let M=0,I=jn(v).length,T="",U=0;for(;M>>1,z=jn(v),B=z.slice(0,b+1).join(""),W=this._getTextWidth(B);(E&&f&&w+a>x?W+R:W)<=_?(M=b+1,T=B,U=W):I=b}if(T){if(P){const B=jn(v),W=jn(T),Z=B[W.length],j=Z===ns||Z===ah;let _t;if(j&&U<=_)_t=W.length;else{const St=W.lastIndexOf(ns),tt=W.lastIndexOf(ah);_t=Math.max(St,tt)+1}_t>0&&(M=_t,T=B.slice(0,M).join(""),U=this._getTextWidth(T))}if(T=T.trimRight(),this._addTextLine(T),s=Math.max(s,U),w+=a,this._shouldHandleEllipsis(w)){this._tryToAddEllipsisToLastLine();break}if(v=jn(v).slice(M).join("").trimLeft(),v.length>0&&(k=this._getTextWidth(v),k<=_)){this._addTextLine(v),w+=a,s=Math.max(s,k);break}}else break}else this._addTextLine(v),w+=a,s=Math.max(s,k),this._shouldHandleEllipsis(w)&&Lx)break}this.textHeight=r,this.textWidth=s}_shouldHandleEllipsis(e){const r=+this.fontSize(),s=this.lineHeight()*r,a=this.attrs.height,l=a!==_r&&a!==void 0,h=this.padding(),c=a-h*2;return!(this.wrap()!==uh)||l&&e+s>c}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,r=e!==_r&&e!==void 0,s=this.padding(),a=e-s*2,l=this.ellipsis(),h=this.textArr[this.textArr.length-1];!h||!l||(r&&(this._getTextWidth(h.text+ko)r?null:Jr.Path.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Jr.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const r=this.textDecoration(),s=this.fill(),a=this.fontSize(),l=this.glyphInfo;r==="underline"&&e.beginPath();for(let h=0;h=1){const s=r[0].p0;e.moveTo(s.x,s.y)}for(let s=0;sd+`.${uc}`).join(" "),dh="nodesRect",f1=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],g1={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},p1="ontouchstart"in Oe.Konva._global;function m1(d,e,r){if(d==="rotater")return r;e+=wt.Util.degToRad(g1[d]||0);const s=(wt.Util.radToDeg(e)%360+360)%360;return wt.Util._inRange(s,315+22.5,360)||wt.Util._inRange(s,0,22.5)?"ns-resize":wt.Util._inRange(s,45-22.5,45+22.5)?"nesw-resize":wt.Util._inRange(s,90-22.5,90+22.5)?"ew-resize":wt.Util._inRange(s,135-22.5,135+22.5)?"nwse-resize":wt.Util._inRange(s,180-22.5,180+22.5)?"ns-resize":wt.Util._inRange(s,225-22.5,225+22.5)?"nesw-resize":wt.Util._inRange(s,270-22.5,270+22.5)?"ew-resize":wt.Util._inRange(s,315-22.5,315+22.5)?"nwse-resize":(wt.Util.error("Transformer has unknown angle for cursor detection: "+s),"pointer")}const hs=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function y1(d){return{x:d.x+d.width/2*Math.cos(d.rotation)+d.height/2*Math.sin(-d.rotation),y:d.y+d.height/2*Math.cos(d.rotation)+d.width/2*Math.sin(d.rotation)}}function hc(d,e,r){const s=r.x+(d.x-r.x)*Math.cos(e)-(d.y-r.y)*Math.sin(e),a=r.y+(d.x-r.x)*Math.sin(e)+(d.y-r.y)*Math.cos(e);return{...d,rotation:d.rotation+e,x:s,y:a}}function _1(d,e){const r=y1(d);return hc(d,e,r)}function v1(d,e,r){let s=e;for(let a=0;aa.isAncestorOf(this)?(wt.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=r,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(a=>{const l=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(a._attrsAffectingSize.length){const h=a._attrsAffectingSize.map(c=>c+"Change."+this._getEventNamespace()).join(" ");a.on(h,l)}a.on(f1.map(h=>h+`.${this._getEventNamespace()}`).join(" "),l),a.on(`absoluteTransformChange.${this._getEventNamespace()}`,l),this._proxyDrag(a)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let r;e.on(`dragstart.${this._getEventNamespace()}`,s=>{r=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(s,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,s=>{if(!r)return;const a=e.getAbsolutePosition(),l=a.x-r.x,h=a.y-r.y;this.nodes().forEach(c=>{if(c===e||c.isDragging())return;const f=c.getAbsolutePosition();c.setAbsolutePosition({x:f.x+l,y:f.y+h}),c.startDrag(s)}),r=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(dh),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(dh,this.__getNodeRect)}__getNodeShape(e,r=this.rotation(),s){const a=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),l=e.getAbsoluteScale(s),h=e.getAbsolutePosition(s),c=a.x*l.x-e.offsetX()*l.x,f=a.y*l.y-e.offsetY()*l.y,m=(Oe.Konva.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),_={x:h.x+c*Math.cos(m)+f*Math.sin(-m),y:h.y+f*Math.cos(m)+c*Math.sin(m),width:a.width*l.x,height:a.height*l.y,rotation:m};return hc(_,-Oe.Konva.getAngle(r),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const r=[];this.nodes().map(m=>{const _=m.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),x=[{x:_.x,y:_.y},{x:_.x+_.width,y:_.y},{x:_.x+_.width,y:_.y+_.height},{x:_.x,y:_.y+_.height}],w=m.getAbsoluteTransform();x.forEach(function(C){const y=w.point(C);r.push(y)})});const s=new wt.Transform;s.rotate(-Oe.Konva.getAngle(this.rotation()));let a=1/0,l=1/0,h=-1/0,c=-1/0;r.forEach(function(m){const _=s.point(m);a===void 0&&(a=h=_.x,l=c=_.y),a=Math.min(a,_.x),l=Math.min(l,_.y),h=Math.max(h,_.x),c=Math.max(c,_.y)}),s.invert();const f=s.point({x:a,y:l});return{x:f.x,y:f.y,width:h-a,height:c-l,rotation:Oe.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(),hs.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const r=new h1.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:p1?10:"auto"}),s=this;r.on("mousedown touchstart",function(a){s._handleMouseDown(a)}),r.on("dragstart",a=>{r.stopDrag(),a.cancelBubble=!0}),r.on("dragend",a=>{a.cancelBubble=!0}),r.on("mouseenter",()=>{const a=Oe.Konva.getAngle(this.rotation()),l=this.rotateAnchorCursor(),h=m1(e,a,l);r.getStage().content&&(r.getStage().content.style.cursor=h),this._cursorChange=!0}),r.on("mouseout",()=>{r.getStage().content&&(r.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(r)}_createBack(){const e=new u1.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(r,s){const a=s.getParent(),l=a.padding();r.beginPath(),r.rect(-l,-l,s.width()+l*2,s.height()+l*2),r.moveTo(s.width()/2,-l),a.rotateEnabled()&&a.rotateLineVisible()&&r.lineTo(s.width()/2,-a.rotateAnchorOffset()*wt.Util._sign(s.height())-l),r.fillStrokeShape(s)},hitFunc:(r,s)=>{if(!this.shouldOverdrawWholeArea())return;const a=this.padding();r.beginPath(),r.rect(-a,-a,s.width()+a*2,s.height()+a*2),r.fillStrokeShape(s)}});this.add(e),this._proxyDrag(e),e.on("dragstart",r=>{r.cancelBubble=!0}),e.on("dragmove",r=>{r.cancelBubble=!0}),e.on("dragend",r=>{r.cancelBubble=!0}),this.on("dragmove",r=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const r=this._getNodeRect(),s=r.width,a=r.height,l=Math.sqrt(Math.pow(s,2)+Math.pow(a,2));this.sin=Math.abs(a/l),this.cos=Math.abs(s/l),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;const h=e.target.getAbsolutePosition(),c=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:c.x-h.x,y:c.y-h.y},Uo++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(f=>{f._fire("transformstart",{evt:e.evt,target:f})})}_handleMouseMove(e){let r,s,a;const l=this.findOne("."+this._movingAnchorName),h=l.getStage();h.setPointersPositions(e);const c=h.getPointerPosition();let f={x:c.x-this._anchorDragOffset.x,y:c.y-this._anchorDragOffset.y};const m=l.getAbsolutePosition();this.anchorDragBoundFunc()&&(f=this.anchorDragBoundFunc()(m,f,e)),l.setAbsolutePosition(f);const _=l.getAbsolutePosition();if(m.x===_.x&&m.y===_.y)return;if(this._movingAnchorName==="rotater"){const L=this._getNodeRect();r=l.x()-L.width/2,s=-l.y()+L.height/2;let p=Math.atan2(-s,r)+Math.PI/2;L.height<0&&(p-=Math.PI);const k=Oe.Konva.getAngle(this.rotation())+p,M=Oe.Konva.getAngle(this.rotationSnapTolerance()),T=v1(this.rotationSnaps(),k,M)-L.rotation,U=_1(L,T);this._fitNodesInto(U,e);return}const x=this.shiftBehavior();let w;x==="inverted"?w=this.keepRatio()&&!e.shiftKey:x==="none"?w=this.keepRatio():w=this.keepRatio()||e.shiftKey;let C=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(w){const L=C?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};a=Math.sqrt(Math.pow(L.x-l.x(),2)+Math.pow(L.y-l.y(),2));const p=this.findOne(".top-left").x()>L.x?-1:1,v=this.findOne(".top-left").y()>L.y?-1:1;r=a*this.cos*p,s=a*this.sin*v,this.findOne(".top-left").x(L.x-r),this.findOne(".top-left").y(L.y-s)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(l.y());else if(this._movingAnchorName==="top-right"){if(w){const L=C?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};a=Math.sqrt(Math.pow(l.x()-L.x,2)+Math.pow(L.y-l.y(),2));const p=this.findOne(".top-right").x()L.y?-1:1;r=a*this.cos*p,s=a*this.sin*v,this.findOne(".top-right").x(L.x+r),this.findOne(".top-right").y(L.y-s)}var y=l.position();this.findOne(".top-left").y(y.y),this.findOne(".bottom-right").x(y.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(l.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(l.x());else if(this._movingAnchorName==="bottom-left"){if(w){const L=C?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};a=Math.sqrt(Math.pow(L.x-l.x(),2)+Math.pow(l.y()-L.y,2));const p=L.x{var l;a._fire("transformend",{evt:e,target:a}),(l=a.getLayer())===null||l===void 0||l.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,r){const s=this._getNodeRect(),a=1;if(wt.Util._inRange(e.width,-this.padding()*2-a,a)){this.update();return}if(wt.Util._inRange(e.height,-this.padding()*2-a,a)){this.update();return}const l=new wt.Transform;if(l.rotate(Oe.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const w=l.point({x:-this.padding()*2,y:0});e.x+=w.x,e.y+=w.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=w.x,this._anchorDragOffset.y-=w.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const w=l.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=w.x,this._anchorDragOffset.y-=w.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const w=l.point({x:0,y:-this.padding()*2});e.x+=w.x,e.y+=w.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=w.x,this._anchorDragOffset.y-=w.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const w=l.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=w.x,this._anchorDragOffset.y-=w.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const w=this.boundBoxFunc()(s,e);w?e=w:wt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const h=1e7,c=new wt.Transform;c.translate(s.x,s.y),c.rotate(s.rotation),c.scale(s.width/h,s.height/h);const f=new wt.Transform,m=e.width/h,_=e.height/h;this.flipEnabled()===!1?(f.translate(e.x,e.y),f.rotate(e.rotation),f.translate(e.width<0?e.width:0,e.height<0?e.height:0),f.scale(Math.abs(m),Math.abs(_))):(f.translate(e.x,e.y),f.rotate(e.rotation),f.scale(m,_));const x=f.multiply(c.invert());this._nodes.forEach(w=>{var C;const y=w.getParent().getAbsoluteTransform(),P=w.getTransform().copy();P.translate(w.offsetX(),w.offsetY());const E=new wt.Transform;E.multiply(y.copy().invert()).multiply(x).multiply(y).multiply(P);const R=E.decompose();w.setAttrs(R),(C=w.getLayer())===null||C===void 0||C.batchDraw()}),this.rotation(wt.Util._getRotation(e.rotation)),this._nodes.forEach(w=>{this._fire("transform",{evt:r,target:w}),w._fire("transform",{evt:r,target:w})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,r){this.findOne(e).setAttrs(r)}update(){var e;const r=this._getNodeRect();this.rotation(wt.Util._getRotation(r.rotation));const s=r.width,a=r.height,l=this.enabledAnchors(),h=this.resizeEnabled(),c=this.padding(),f=this.anchorSize(),m=this.find("._anchor");m.forEach(x=>{x.setAttrs({width:f,height:f,offsetX:f/2,offsetY:f/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:f/2+c,offsetY:f/2+c,visible:h&&l.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:s/2,y:0,offsetY:f/2+c,visible:h&&l.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:s,y:0,offsetX:f/2-c,offsetY:f/2+c,visible:h&&l.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:a/2,offsetX:f/2+c,visible:h&&l.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:s,y:a/2,offsetX:f/2-c,visible:h&&l.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:a,offsetX:f/2+c,offsetY:f/2-c,visible:h&&l.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:s/2,y:a,offsetY:f/2-c,visible:h&&l.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:s,y:a,offsetX:f/2-c,offsetY:f/2-c,visible:h&&l.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:s/2,y:-this.rotateAnchorOffset()*wt.Util._sign(a)-c,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:s,height:a,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const _=this.anchorStyleFunc();_&&m.forEach(x=>{_(x)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),ch.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return hh.Node.prototype.toObject.call(this)}clone(e){return hh.Node.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};bs.Transformer=ft;ft.isTransforming=()=>Uo>0;function S1(d){return d instanceof Array||wt.Util.warn("enabledAnchors value should be an array"),d instanceof Array&&d.forEach(function(e){hs.indexOf(e)===-1&&wt.Util.warn("Unknown anchor name: "+e+". Available names are: "+hs.join(", "))}),d||[]}ft.prototype.className="Transformer";(0,c1._registerNode)(ft);vt.Factory.addGetterSetter(ft,"enabledAnchors",hs,S1);vt.Factory.addGetterSetter(ft,"flipEnabled",!0,(0,Mn.getBooleanValidator)());vt.Factory.addGetterSetter(ft,"resizeEnabled",!0);vt.Factory.addGetterSetter(ft,"anchorSize",10,(0,Mn.getNumberValidator)());vt.Factory.addGetterSetter(ft,"rotateEnabled",!0);vt.Factory.addGetterSetter(ft,"rotateLineVisible",!0);vt.Factory.addGetterSetter(ft,"rotationSnaps",[]);vt.Factory.addGetterSetter(ft,"rotateAnchorOffset",50,(0,Mn.getNumberValidator)());vt.Factory.addGetterSetter(ft,"rotateAnchorCursor","crosshair");vt.Factory.addGetterSetter(ft,"rotationSnapTolerance",5,(0,Mn.getNumberValidator)());vt.Factory.addGetterSetter(ft,"borderEnabled",!0);vt.Factory.addGetterSetter(ft,"anchorStroke","rgb(0, 161, 255)");vt.Factory.addGetterSetter(ft,"anchorStrokeWidth",1,(0,Mn.getNumberValidator)());vt.Factory.addGetterSetter(ft,"anchorFill","white");vt.Factory.addGetterSetter(ft,"anchorCornerRadius",0,(0,Mn.getNumberValidator)());vt.Factory.addGetterSetter(ft,"borderStroke","rgb(0, 161, 255)");vt.Factory.addGetterSetter(ft,"borderStrokeWidth",1,(0,Mn.getNumberValidator)());vt.Factory.addGetterSetter(ft,"borderDash");vt.Factory.addGetterSetter(ft,"keepRatio",!0);vt.Factory.addGetterSetter(ft,"shiftBehavior","default");vt.Factory.addGetterSetter(ft,"centeredScaling",!1);vt.Factory.addGetterSetter(ft,"ignoreStroke",!1);vt.Factory.addGetterSetter(ft,"padding",0,(0,Mn.getNumberValidator)());vt.Factory.addGetterSetter(ft,"nodes");vt.Factory.addGetterSetter(ft,"node");vt.Factory.addGetterSetter(ft,"boundBoxFunc");vt.Factory.addGetterSetter(ft,"anchorDragBoundFunc");vt.Factory.addGetterSetter(ft,"anchorStyleFunc");vt.Factory.addGetterSetter(ft,"shouldOverdrawWholeArea",!1);vt.Factory.addGetterSetter(ft,"useSingleNodeRotation",!0);vt.Factory.backCompat(ft,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Os={};Object.defineProperty(Os,"__esModule",{value:!0});Os.Wedge=void 0;const Ds=ht,C1=Kt,w1=lt,cc=et,x1=lt;class cn extends C1.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,w1.Konva.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Os.Wedge=cn;cn.prototype.className="Wedge";cn.prototype._centroid=!0;cn.prototype._attrsAffectingSize=["radius"];(0,x1._registerNode)(cn);Ds.Factory.addGetterSetter(cn,"radius",0,(0,cc.getNumberValidator)());Ds.Factory.addGetterSetter(cn,"angle",0,(0,cc.getNumberValidator)());Ds.Factory.addGetterSetter(cn,"clockwise",!1);Ds.Factory.backCompat(cn,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.Blur=void 0;const fh=ht,P1=bt,E1=et;function gh(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const k1=[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,396,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],T1=[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 N1(d,e){const r=d.data,s=d.width,a=d.height;let l,h,c,f,m,_,x,w,C,y,P,E,R,L,p,v,k,M,I,T;const U=e+e+1,b=s-1,z=a-1,B=e+1,W=B*(B+1)/2,Z=new gh,j=k1[e],_t=T1[e];let St=null,tt=Z,gt=null,rt=null;for(let J=1;J>_t,I!==0?(I=255/I,r[h]=(f*j>>_t)*I,r[h+1]=(m*j>>_t)*I,r[h+2]=(_*j>>_t)*I):r[h]=r[h+1]=r[h+2]=0,f-=w,m-=C,_-=y,x-=P,w-=gt.r,C-=gt.g,y-=gt.b,P-=gt.a,l=c+((l=ct+e+1)>_t,I>0?(I=255/I,r[l]=(f*j>>_t)*I,r[l+1]=(m*j>>_t)*I,r[l+2]=(_*j>>_t)*I):r[l]=r[l+1]=r[l+2]=0,f-=w,m-=C,_-=y,x-=P,w-=gt.r,C-=gt.g,y-=gt.b,P-=gt.a,l=J+((l=kt+B)0&&N1(e,r)};Gs.Blur=R1;fh.Factory.addGetterSetter(P1.Node,"blurRadius",0,(0,E1.getNumberValidator)(),fh.Factory.afterSetFilter);var Is={};Object.defineProperty(Is,"__esModule",{value:!0});Is.Brighten=void 0;const ph=ht,F1=bt,A1=et,M1=function(d){const e=this.brightness()*255,r=d.data,s=r.length;for(let a=0;a255?255:a,l=l<0?0:l>255?255:l,h=h<0?0:h>255?255:h,r[c]=a,r[c+1]=l,r[c+2]=h};Us.Contrast=O1;mh.Factory.addGetterSetter(L1.Node,"contrast",0,(0,b1.getNumberValidator)(),mh.Factory.afterSetFilter);var zs={};Object.defineProperty(zs,"__esModule",{value:!0});zs.Emboss=void 0;const kn=ht,Bs=bt,D1=Gt,dc=et,G1=function(d){const e=this.embossStrength()*10,r=this.embossWhiteLevel()*255,s=this.embossDirection(),a=this.embossBlend(),l=d.data,h=d.width,c=d.height,f=h*4;let m=0,_=0,x=c;switch(s){case"top-left":m=-1,_=-1;break;case"top":m=-1,_=0;break;case"top-right":m=-1,_=1;break;case"right":m=0,_=1;break;case"bottom-right":m=1,_=1;break;case"bottom":m=1,_=0;break;case"bottom-left":m=1,_=-1;break;case"left":m=0,_=-1;break;default:D1.Util.error("Unknown emboss direction: "+s)}do{const w=(x-1)*f;let C=m;x+C<1&&(C=0),x+C>c&&(C=0);const y=(x-1+C)*h*4;let P=h;do{const E=w+(P-1)*4;let R=_;P+R<1&&(R=0),P+R>h&&(R=0);const L=y+(P-1+R)*4,p=l[E]-l[L],v=l[E+1]-l[L+1],k=l[E+2]-l[L+2];let M=p;const I=M>0?M:-M,T=v>0?v:-v,U=k>0?k:-k;if(T>I&&(M=v),U>I&&(M=k),M*=e,a){const b=l[E]+M,z=l[E+1]+M,B=l[E+2]+M;l[E]=b>255?255:b<0?0:b,l[E+1]=z>255?255:z<0?0:z,l[E+2]=B>255?255:B<0?0:B}else{let b=r-M;b<0?b=0:b>255&&(b=255),l[E]=l[E+1]=l[E+2]=b}}while(--P)}while(--x)};zs.Emboss=G1;kn.Factory.addGetterSetter(Bs.Node,"embossStrength",.5,(0,dc.getNumberValidator)(),kn.Factory.afterSetFilter);kn.Factory.addGetterSetter(Bs.Node,"embossWhiteLevel",.5,(0,dc.getNumberValidator)(),kn.Factory.afterSetFilter);kn.Factory.addGetterSetter(Bs.Node,"embossDirection","top-left",void 0,kn.Factory.afterSetFilter);kn.Factory.addGetterSetter(Bs.Node,"embossBlend",!1,void 0,kn.Factory.afterSetFilter);var Vs={};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.Enhance=void 0;const yh=ht,I1=bt,U1=et;function Fo(d,e,r,s,a){const l=r-e,h=a-s;if(l===0)return s+h/2;if(h===0)return s;let c=(d-e)/l;return c=h*c+s,c}const z1=function(d){const e=d.data,r=e.length;let s=e[0],a=s,l,h=e[1],c=h,f,m=e[2],_=m,x;const w=this.enhance();if(w===0)return;for(let p=0;pa&&(a=l),f=e[p+1],fc&&(c=f),x=e[p+2],x_&&(_=x);a===s&&(a=255,s=0),c===h&&(c=255,h=0),_===m&&(_=255,m=0);let C,y,P,E,R,L;if(w>0)C=a+w*(255-a),y=s-w*(s-0),P=c+w*(255-c),E=h-w*(h-0),R=_+w*(255-_),L=m-w*(m-0);else{const p=(a+s)*.5;C=a+w*(a-p),y=s+w*(s-p);const v=(c+h)*.5;P=c+w*(c-v),E=h+w*(h-v);const k=(_+m)*.5;R=_+w*(_-k),L=m+w*(m-k)}for(let p=0;pm?w:m;const C=h,y=l,P=360/y*Math.PI/180;for(let E=0;Em?w:m;const C=h,y=l,P=0;let E,R;for(_=0;_e&&(v=p,k=0,M=-1),a=0;a=0&&C=0&&y=0&&C=0&&y=255*4?255:0}return h}function e2(d,e,r){const s=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],a=Math.round(Math.sqrt(s.length)),l=Math.floor(a/2),h=[];for(let c=0;c=0&&C=0&&y=r))for(let p=P;p=s)continue;const v=(r*p+L)*4;m+=h[v+0],_+=h[v+1],x+=h[v+2],w+=h[v+3],R+=1}m=m/R,_=_/R,x=x/R,w=w/R;for(let L=C;L=r))for(let p=P;p=s)continue;const v=(r*p+L)*4;h[v+0]=m,h[v+1]=_,h[v+2]=x,h[v+3]=w}}};Qs.Pixelate=u2;Ch.Factory.addGetterSetter(o2.Node,"pixelSize",8,(0,l2.getNumberValidator)(),Ch.Factory.afterSetFilter);var Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.Posterize=void 0;const wh=ht,h2=bt,c2=et,d2=function(d){const e=Math.round(this.levels()*254)+1,r=d.data,s=r.length,a=255/e;for(let l=0;l255?255:d<0?0:Math.round(d)});ds.Factory.addGetterSetter(rl.Node,"green",0,function(d){return this._filterUpToDate=!1,d>255?255:d<0?0:Math.round(d)});ds.Factory.addGetterSetter(rl.Node,"blue",0,f2.RGBComponent,ds.Factory.afterSetFilter);var $s={};Object.defineProperty($s,"__esModule",{value:!0});$s.RGBA=void 0;const ei=ht,ta=bt,p2=et,m2=function(d){const e=d.data,r=e.length,s=this.red(),a=this.green(),l=this.blue(),h=this.alpha();for(let c=0;c255?255:d<0?0:Math.round(d)});ei.Factory.addGetterSetter(ta.Node,"green",0,function(d){return this._filterUpToDate=!1,d>255?255:d<0?0:Math.round(d)});ei.Factory.addGetterSetter(ta.Node,"blue",0,p2.RGBComponent,ei.Factory.afterSetFilter);ei.Factory.addGetterSetter(ta.Node,"alpha",1,function(d){return this._filterUpToDate=!1,d>1?1:d<0?0:d});var ea={};Object.defineProperty(ea,"__esModule",{value:!0});ea.Sepia=void 0;const y2=function(d){const e=d.data,r=e.length;for(let s=0;s127&&(m=255-m),_>127&&(_=255-_),x>127&&(x=255-x),e[f]=m,e[f+1]=_,e[f+2]=x}while(--c)}while(--l)};na.Solarize=_2;var ra={};Object.defineProperty(ra,"__esModule",{value:!0});ra.Threshold=void 0;const xh=ht,v2=bt,S2=et,C2=function(d){const e=this.threshold()*255,r=d.data,s=r.length;for(let a=0;aN||u[S]!==g[N]){var D=` +`+u[S].replace(" at new "," at ");return t.displayName&&D.includes("")&&(D=D.replace("",t.displayName)),D}while(1<=S&&0<=N);break}}}finally{la=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?Ar(t):""}var cd=Object.prototype.hasOwnProperty,ha=[],er=-1;function gn(t){return{current:t}}function Ft(t){0>er||(t.current=ha[er],ha[er]=null,er--)}function Nt(t,n){er++,ha[er]=t.current,t.current=n}var pn={},ee=gn(pn),he=gn(!1),bn=pn;function nr(t,n){var i=t.type.contextTypes;if(!i)return pn;var o=t.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===n)return o.__reactInternalMemoizedMaskedChildContext;var u={},g;for(g in i)u[g]=n[g];return o&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=u),u}function ce(t){return t=t.childContextTypes,t!=null}function ui(){Ft(he),Ft(ee)}function dl(t,n,i){if(ee.current!==pn)throw Error(h(168));Nt(ee,n),Nt(he,i)}function fl(t,n,i){var o=t.stateNode;if(n=n.childContextTypes,typeof o.getChildContext!="function")return i;o=o.getChildContext();for(var u in o)if(!(u in n))throw Error(h(108,T(t)||"Unknown",u));return l({},i,o)}function hi(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||pn,bn=ee.current,Nt(ee,t),Nt(he,he.current),!0}function gl(t,n,i){var o=t.stateNode;if(!o)throw Error(h(169));i?(t=fl(t,n,bn),o.__reactInternalMemoizedMergedChildContext=t,Ft(he),Ft(ee),Nt(ee,t)):Ft(he),Nt(he,i)}var Re=Math.clz32?Math.clz32:gd,dd=Math.log,fd=Math.LN2;function gd(t){return t>>>=0,t===0?32:31-(dd(t)/fd|0)|0}var ci=64,di=4194304;function Mr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function fi(t,n){var i=t.pendingLanes;if(i===0)return 0;var o=0,u=t.suspendedLanes,g=t.pingedLanes,S=i&268435455;if(S!==0){var N=S&~u;N!==0?o=Mr(N):(g&=S,g!==0&&(o=Mr(g)))}else S=i&~u,S!==0?o=Mr(S):g!==0&&(o=Mr(g));if(o===0)return 0;if(n!==0&&n!==o&&!(n&u)&&(u=o&-o,g=n&-n,u>=g||u===16&&(g&4194240)!==0))return n;if(o&4&&(o|=i&16),n=t.entangledLanes,n!==0)for(t=t.entanglements,n&=o;0i;i++)n.push(t);return n}function Lr(t,n,i){t.pendingLanes|=n,n!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,n=31-Re(n),t[n]=i}function yd(t,n){var i=t.pendingLanes&~n;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=n,t.mutableReadLanes&=n,t.entangledLanes&=n,n=t.entanglements;var o=t.eventTimes;for(t=t.expirationTimes;0>=S,u-=S,Ze=1<<32-Re(n)+u|i<mt?(Jt=st,st=null):Jt=st.sibling;var yt=K(O,st,G[mt],Y);if(yt===null){st===null&&(st=Jt);break}t&&st&&yt.alternate===null&&n(O,st),A=g(yt,A,mt),ot===null?$=yt:ot.sibling=yt,ot=yt,st=Jt}if(mt===G.length)return i(O,st),Mt&&Dn(O,mt),$;if(st===null){for(;mtmt?(Jt=st,st=null):Jt=st.sibling;var xn=K(O,st,yt.value,Y);if(xn===null){st===null&&(st=Jt);break}t&&st&&xn.alternate===null&&n(O,st),A=g(xn,A,mt),ot===null?$=xn:ot.sibling=xn,ot=xn,st=Jt}if(yt.done)return i(O,st),Mt&&Dn(O,mt),$;if(st===null){for(;!yt.done;mt++,yt=G.next())yt=it(O,yt.value,Y),yt!==null&&(A=g(yt,A,mt),ot===null?$=yt:ot.sibling=yt,ot=yt);return Mt&&Dn(O,mt),$}for(st=o(O,st);!yt.done;mt++,yt=G.next())yt=At(st,O,mt,yt.value,Y),yt!==null&&(t&&yt.alternate!==null&&st.delete(yt.key===null?mt:yt.key),A=g(yt,A,mt),ot===null?$=yt:ot.sibling=yt,ot=yt);return t&&st.forEach(function(n0){return n(O,n0)}),Mt&&Dn(O,mt),$}function rn(O,A,G,Y){if(typeof G=="object"&&G!==null&&G.type===_&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case f:t:{for(var $=G.key,ot=A;ot!==null;){if(ot.key===$){if($=G.type,$===_){if(ot.tag===7){i(O,ot.sibling),A=u(ot,G.props.children),A.return=O,O=A;break t}}else if(ot.elementType===$||typeof $=="object"&&$!==null&&$.$$typeof===p&&Pl($)===ot.type){i(O,ot.sibling),A=u(ot,G.props),A.ref=Or(O,ot,G),A.return=O,O=A;break t}i(O,ot);break}else n(O,ot);ot=ot.sibling}G.type===_?(A=Hn(G.props.children,O.mode,Y,G.key),A.return=O,O=A):(Y=Ji(G.type,G.key,G.props,null,O.mode,Y),Y.ref=Or(O,A,G),Y.return=O,O=Y)}return S(O);case m:t:{for(ot=G.key;A!==null;){if(A.key===ot)if(A.tag===4&&A.stateNode.containerInfo===G.containerInfo&&A.stateNode.implementation===G.implementation){i(O,A.sibling),A=u(A,G.children||[]),A.return=O,O=A;break t}else{i(O,A);break}else n(O,A);A=A.sibling}A=vo(G,O.mode,Y),A.return=O,O=A}return S(O);case p:return ot=G._init,rn(O,A,ot(G._payload),Y)}if(j(G))return Pt(O,A,G,Y);if(M(G))return pe(O,A,G,Y);Si(O,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,A!==null&&A.tag===6?(i(O,A.sibling),A=u(A,G),A.return=O,O=A):(i(O,A),A=_o(G,O.mode,Y),A.return=O,O=A),S(O)):i(O,A)}return rn}var ar=El(!0),kl=El(!1),Ci=gn(null),wi=null,or=null,xa=null;function Pa(){xa=or=wi=null}function Tl(t,n,i){Ct?(Nt(Ci,n._currentValue),n._currentValue=i):(Nt(Ci,n._currentValue2),n._currentValue2=i)}function Ea(t){var n=Ci.current;Ft(Ci),Ct?t._currentValue=n:t._currentValue2=n}function ka(t,n,i){for(;t!==null;){var o=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),t===i)break;t=t.return}}function lr(t,n){wi=t,xa=or=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&n&&(de=!0),t.firstContext=null)}function we(t){var n=Ct?t._currentValue:t._currentValue2;if(xa!==t)if(t={context:t,memoizedValue:n,next:null},or===null){if(wi===null)throw Error(h(308));or=t,wi.dependencies={lanes:0,firstContext:t}}else or=or.next=t;return n}var Gn=null;function Ta(t){Gn===null?Gn=[t]:Gn.push(t)}function Nl(t,n,i,o){var u=n.interleaved;return u===null?(i.next=i,Ta(n)):(i.next=u.next,u.next=i),n.interleaved=i,Be(t,o)}function Be(t,n){t.lanes|=n;var i=t.alternate;for(i!==null&&(i.lanes|=n),i=t,t=t.return;t!==null;)t.childLanes|=n,i=t.alternate,i!==null&&(i.childLanes|=n),i=t,t=t.return;return i.tag===3?i.stateNode:null}var mn=!1;function Na(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Rl(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function tn(t,n){return{eventTime:t,lane:n,tag:0,payload:null,callback:null,next:null}}function yn(t,n,i){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,ut&2){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,Be(t,i)}return u=o.interleaved,u===null?(n.next=n,Ta(o)):(n.next=u.next,u.next=n),o.interleaved=n,Be(t,i)}function xi(t,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194240)!==0)){var o=n.lanes;o&=t.pendingLanes,i|=o,n.lanes=i,fa(t,i)}}function Fl(t,n){var i=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var u=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var S={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};g===null?u=g=S:g=g.next=S,i=i.next}while(i!==null);g===null?u=g=n:g=g.next=n}else u=g=n;i={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:g,shared:o.shared,effects:o.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=n:t.next=n,i.lastBaseUpdate=n}function Pi(t,n,i,o){var u=t.updateQueue;mn=!1;var g=u.firstBaseUpdate,S=u.lastBaseUpdate,N=u.shared.pending;if(N!==null){u.shared.pending=null;var D=N,H=D.next;D.next=null,S===null?g=H:S.next=H,S=D;var q=t.alternate;q!==null&&(q=q.updateQueue,N=q.lastBaseUpdate,N!==S&&(N===null?q.firstBaseUpdate=H:N.next=H,q.lastBaseUpdate=D))}if(g!==null){var it=u.baseState;S=0,q=H=D=null,N=g;do{var K=N.lane,At=N.eventTime;if((o&K)===K){q!==null&&(q=q.next={eventTime:At,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});t:{var Pt=t,pe=N;switch(K=n,At=i,pe.tag){case 1:if(Pt=pe.payload,typeof Pt=="function"){it=Pt.call(At,it,K);break t}it=Pt;break t;case 3:Pt.flags=Pt.flags&-65537|128;case 0:if(Pt=pe.payload,K=typeof Pt=="function"?Pt.call(At,it,K):Pt,K==null)break t;it=l({},it,K);break t;case 2:mn=!0}}N.callback!==null&&N.lane!==0&&(t.flags|=64,K=u.effects,K===null?u.effects=[N]:K.push(N))}else At={eventTime:At,lane:K,tag:N.tag,payload:N.payload,callback:N.callback,next:null},q===null?(H=q=At,D=it):q=q.next=At,S|=K;if(N=N.next,N===null){if(N=u.shared.pending,N===null)break;K=N,N=K.next,K.next=null,u.lastBaseUpdate=K,u.shared.pending=null}}while(!0);if(q===null&&(D=it),u.baseState=D,u.firstBaseUpdate=H,u.lastBaseUpdate=q,n=u.shared.interleaved,n!==null){u=n;do S|=u.lane,u=u.next;while(u!==n)}else g===null&&(u.shared.lanes=0);Un|=S,t.lanes=S,t.memoizedState=it}}function Al(t,n,i){if(t=n.effects,n.effects=null,t!==null)for(n=0;ni?i:4,t(!0);var o=La.transition;La.transition={};try{t(!1),n()}finally{pt=i,La.transition=o}}function Ql(){return Pe().memoizedState}function Rd(t,n,i){var o=Sn(t);if(i={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null},Jl(t))Zl(n,i);else if(i=Nl(t,n,i,o),i!==null){var u=se();Ee(i,t,o,u),$l(i,n,o)}}function Fd(t,n,i){var o=Sn(t),u={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null};if(Jl(t))Zl(n,u);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=n.lastRenderedReducer,g!==null))try{var S=n.lastRenderedState,N=g(S,i);if(u.hasEagerState=!0,u.eagerState=N,Fe(N,S)){var D=n.interleaved;D===null?(u.next=u,Ta(n)):(u.next=D.next,D.next=u),n.interleaved=u;return}}catch{}finally{}i=Nl(t,n,u,o),i!==null&&(u=se(),Ee(i,t,o,u),$l(i,n,o))}}function Jl(t){var n=t.alternate;return t===Dt||n!==null&&n===Dt}function Zl(t,n){Ir=Ti=!0;var i=t.pending;i===null?n.next=n:(n.next=i.next,i.next=n),t.pending=n}function $l(t,n,i){if(i&4194240){var o=n.lanes;o&=t.pendingLanes,i|=o,n.lanes=i,fa(t,i)}}var Fi={readContext:we,useCallback:ne,useContext:ne,useEffect:ne,useImperativeHandle:ne,useInsertionEffect:ne,useLayoutEffect:ne,useMemo:ne,useReducer:ne,useRef:ne,useState:ne,useDebugValue:ne,useDeferredValue:ne,useTransition:ne,useMutableSource:ne,useSyncExternalStore:ne,useId:ne,unstable_isNewReconciler:!1},Ad={readContext:we,useCallback:function(t,n){return He().memoizedState=[t,n===void 0?null:n],t},useContext:we,useEffect:Vl,useImperativeHandle:function(t,n,i){return i=i!=null?i.concat([t]):null,Ni(4194308,4,jl.bind(null,n,t),i)},useLayoutEffect:function(t,n){return Ni(4194308,4,t,n)},useInsertionEffect:function(t,n){return Ni(4,2,t,n)},useMemo:function(t,n){var i=He();return n=n===void 0?null:n,t=t(),i.memoizedState=[t,n],t},useReducer:function(t,n,i){var o=He();return n=i!==void 0?i(n):n,o.memoizedState=o.baseState=n,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},o.queue=t,t=t.dispatch=Rd.bind(null,Dt,t),[o.memoizedState,t]},useRef:function(t){var n=He();return t={current:t},n.memoizedState=t},useState:zl,useDebugValue:za,useDeferredValue:function(t){return He().memoizedState=t},useTransition:function(){var t=zl(!1),n=t[0];return t=Nd.bind(null,t[1]),He().memoizedState=t,[n,t]},useMutableSource:function(){},useSyncExternalStore:function(t,n,i){var o=Dt,u=He();if(Mt){if(i===void 0)throw Error(h(407));i=i()}else{if(i=n(),Qt===null)throw Error(h(349));In&30||Ol(o,n,i)}u.memoizedState=i;var g={value:i,getSnapshot:n};return u.queue=g,Vl(Gl.bind(null,o,g,t),[t]),o.flags|=2048,Br(9,Dl.bind(null,o,g,i,n),void 0,null),i},useId:function(){var t=He(),n=Qt.identifierPrefix;if(Mt){var i=$e,o=Ze;i=(o&~(1<<32-Re(o)-1)).toString(32)+i,n=":"+n+"R"+i,i=Ur++,0uo&&(n.flags|=128,o=!0,Wr(u,!1),n.lanes=4194304)}else{if(!o)if(t=Ei(g),t!==null){if(n.flags|=128,o=!0,t=t.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),Wr(u,!0),u.tail===null&&u.tailMode==="hidden"&&!g.alternate&&!Mt)return re(n),null}else 2*Xt()-u.renderingStartTime>uo&&i!==1073741824&&(n.flags|=128,o=!0,Wr(u,!1),n.lanes=4194304);u.isBackwards?(g.sibling=n.child,n.child=g):(t=u.last,t!==null?t.sibling=g:n.child=g,u.last=g)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Xt(),n.sibling=null,t=Ot.current,Nt(Ot,o?t&1|2:t&1),n):(re(n),null);case 22:case 23:return po(),i=n.memoizedState!==null,t!==null&&t.memoizedState!==null!==i&&(n.flags|=8192),i&&n.mode&1?_e&1073741824&&(re(n),at&&n.subtreeFlags&6&&(n.flags|=8192)):re(n),null;case 24:return null;case 25:return null}throw Error(h(156,n.tag))}function Ud(t,n){switch(va(n),n.tag){case 1:return ce(n.type)&&ui(),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return hr(),Ft(he),Ft(ee),Ma(),t=n.flags,t&65536&&!(t&128)?(n.flags=t&-65537|128,n):null;case 5:return Fa(n),null;case 13:if(Ft(Ot),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(h(340));sr()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Ft(Ot),null;case 4:return hr(),null;case 10:return Ea(n.type._context),null;case 22:case 23:return po(),null;case 24:return null;default:return null}}var Di=!1,ie=!1,zd=typeof WeakSet=="function"?WeakSet:Set,X=null;function dr(t,n){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(o){Lt(t,n,o)}else i.current=null}function Ja(t,n,i){try{i()}catch(o){Lt(t,n,o)}}var Cu=!1;function Bd(t,n){for(gt(t.containerInfo),X=n;X!==null;)if(t=X,n=t.child,(t.subtreeFlags&1028)!==0&&n!==null)n.return=t,X=n;else for(;X!==null;){t=X;try{var i=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(i!==null){var o=i.memoizedProps,u=i.memoizedState,g=t.stateNode,S=g.getSnapshotBeforeUpdate(t.elementType===t.type?o:Me(t.type,o),u);g.__reactInternalSnapshotBeforeUpdate=S}break;case 3:at&&Hc(t.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(h(163))}}catch(N){Lt(t,t.return,N)}if(n=t.sibling,n!==null){n.return=t.return,X=n;break}X=t.return}return i=Cu,Cu=!1,i}function jr(t,n,i){var o=n.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&t)===t){var g=u.destroy;u.destroy=void 0,g!==void 0&&Ja(n,i,g)}u=u.next}while(u!==o)}}function Gi(t,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.create;i.destroy=o()}i=i.next}while(i!==n)}}function Za(t){var n=t.ref;if(n!==null){var i=t.stateNode;switch(t.tag){case 5:t=_t(i);break;default:t=i}typeof n=="function"?n(t):n.current=t}}function wu(t){var n=t.alternate;n!==null&&(t.alternate=null,wu(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Ne(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function xu(t){return t.tag===5||t.tag===3||t.tag===4}function Pu(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||xu(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function $a(t,n,i){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?Dc(i,t,n):Ac(i,t);else if(o!==4&&(t=t.child,t!==null))for($a(t,n,i),t=t.sibling;t!==null;)$a(t,n,i),t=t.sibling}function to(t,n,i){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?Oc(i,t,n):Fc(i,t);else if(o!==4&&(t=t.child,t!==null))for(to(t,n,i),t=t.sibling;t!==null;)to(t,n,i),t=t.sibling}var $t=null,Le=!1;function je(t,n,i){for(i=i.child;i!==null;)eo(t,n,i),i=i.sibling}function eo(t,n,i){if(Ue&&typeof Ue.onCommitFiberUnmount=="function")try{Ue.onCommitFiberUnmount(gi,i)}catch{}switch(i.tag){case 5:ie||dr(i,n);case 6:if(at){var o=$t,u=Le;$t=null,je(t,n,i),$t=o,Le=u,$t!==null&&(Le?Ic($t,i.stateNode):Gc($t,i.stateNode))}else je(t,n,i);break;case 18:at&&$t!==null&&(Le?od($t,i.stateNode):ad($t,i.stateNode));break;case 4:at?(o=$t,u=Le,$t=i.stateNode.containerInfo,Le=!0,je(t,n,i),$t=o,Le=u):(Tt&&(o=i.stateNode.containerInfo,u=ol(o),sa(o,u)),je(t,n,i));break;case 0:case 11:case 14:case 15:if(!ie&&(o=i.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){u=o=o.next;do{var g=u,S=g.destroy;g=g.tag,S!==void 0&&(g&2||g&4)&&Ja(i,n,S),u=u.next}while(u!==o)}je(t,n,i);break;case 1:if(!ie&&(dr(i,n),o=i.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=i.memoizedProps,o.state=i.memoizedState,o.componentWillUnmount()}catch(N){Lt(i,n,N)}je(t,n,i);break;case 21:je(t,n,i);break;case 22:i.mode&1?(ie=(o=ie)||i.memoizedState!==null,je(t,n,i),ie=o):je(t,n,i);break;default:je(t,n,i)}}function Eu(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new zd),n.forEach(function(o){var u=Qd.bind(null,t,o);i.has(o)||(i.add(o),o.then(u,u))})}}function be(t,n){var i=n.deletions;if(i!==null)for(var o=0;o";case Ui:return":has("+(io(t)||"")+")";case zi:return'[role="'+t.value+'"]';case Vi:return'"'+t.value+'"';case Bi:return'[data-testname="'+t.value+'"]';default:throw Error(h(365))}}function Au(t,n){var i=[];t=[t,0];for(var o=0;ou&&(u=S),o&=~g}if(o=u,o=Xt()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*Hd(o/1960))-o,10t?16:t,vn===null)var o=!1;else{if(t=vn,vn=null,Yi=0,ut&6)throw Error(h(331));var u=ut;for(ut|=4,X=t.current;X!==null;){var g=X,S=g.child;if(X.flags&16){var N=g.deletions;if(N!==null){for(var D=0;DXt()-lo?zn(t,0):oo|=i),ge(t,n)}function zu(t,n){n===0&&(t.mode&1?(n=di,di<<=1,!(di&130023424)&&(di=4194304)):n=1);var i=se();t=Be(t,n),t!==null&&(Lr(t,n,i),ge(t,i))}function qd(t){var n=t.memoizedState,i=0;n!==null&&(i=n.retryLane),zu(t,i)}function Qd(t,n){var i=0;switch(t.tag){case 13:var o=t.stateNode,u=t.memoizedState;u!==null&&(i=u.retryLane);break;case 19:o=t.stateNode;break;default:throw Error(h(314))}o!==null&&o.delete(n),zu(t,i)}var Bu;Bu=function(t,n,i){if(t!==null)if(t.memoizedProps!==n.pendingProps||he.current)de=!0;else{if(!(t.lanes&i)&&!(n.flags&128))return de=!1,Gd(t,n,i);de=!!(t.flags&131072)}else de=!1,Mt&&n.flags&1048576&&vl(n,yi,n.index);switch(n.lanes=0,n.tag){case 2:var o=n.type;Li(t,n),t=n.pendingProps;var u=nr(n,ee.current);lr(n,i),u=Oa(null,n,o,t,u,i);var g=Da();return n.flags|=1,typeof u=="object"&&u!==null&&typeof u.render=="function"&&u.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,ce(o)?(g=!0,hi(n)):g=!1,n.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,Na(n),u.updater=Ai,n.stateNode=u,u._reactInternals=n,Va(n,o,t,i),n=Ka(null,n,o,!0,g,i)):(n.tag=0,Mt&&g&&_a(n),oe(null,n,u,i),n=n.child),n;case 16:o=n.elementType;t:{switch(Li(t,n),t=n.pendingProps,u=o._init,o=u(o._payload),n.type=o,u=n.tag=Zd(o),t=Me(o,t),u){case 0:n=ja(null,n,o,t,i);break t;case 1:n=fu(null,n,o,t,i);break t;case 11:n=lu(null,n,o,t,i);break t;case 14:n=uu(null,n,o,Me(o.type,t),i);break t}throw Error(h(306,o,""))}return n;case 0:return o=n.type,u=n.pendingProps,u=n.elementType===o?u:Me(o,u),ja(t,n,o,u,i);case 1:return o=n.type,u=n.pendingProps,u=n.elementType===o?u:Me(o,u),fu(t,n,o,u,i);case 3:t:{if(gu(n),t===null)throw Error(h(387));o=n.pendingProps,g=n.memoizedState,u=g.element,Rl(t,n),Pi(n,o,null,i);var S=n.memoizedState;if(o=S.element,Rt&&g.isDehydrated)if(g={element:o,isDehydrated:!1,cache:S.cache,pendingSuspenseBoundaries:S.pendingSuspenseBoundaries,transitions:S.transitions},n.updateQueue.baseState=g,n.memoizedState=g,n.flags&256){u=cr(Error(h(423)),n),n=pu(t,n,o,i,u);break t}else if(o!==u){u=cr(Error(h(424)),n),n=pu(t,n,o,i,u);break t}else for(Rt&&(Ce=Zc(n.stateNode.containerInfo),ye=n,Mt=!0,Ae=null,br=!1),i=kl(n,null,o,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(sr(),o===u){n=en(t,n,i);break t}oe(t,n,o,i)}n=n.child}return n;case 5:return Ml(n),t===null&&Ca(n),o=n.type,u=n.pendingProps,g=t!==null?t.memoizedProps:null,S=u.children,me(o,u)?S=null:g!==null&&me(o,g)&&(n.flags|=32),du(t,n),oe(t,n,S,i),n.child;case 6:return t===null&&Ca(n),null;case 13:return mu(t,n,i);case 4:return Ra(n,n.stateNode.containerInfo),o=n.pendingProps,t===null?n.child=ar(n,null,o,i):oe(t,n,o,i),n.child;case 11:return o=n.type,u=n.pendingProps,u=n.elementType===o?u:Me(o,u),lu(t,n,o,u,i);case 7:return oe(t,n,n.pendingProps,i),n.child;case 8:return oe(t,n,n.pendingProps.children,i),n.child;case 12:return oe(t,n,n.pendingProps.children,i),n.child;case 10:t:{if(o=n.type._context,u=n.pendingProps,g=n.memoizedProps,S=u.value,Tl(n,o,S),g!==null)if(Fe(g.value,S)){if(g.children===u.children&&!he.current){n=en(t,n,i);break t}}else for(g=n.child,g!==null&&(g.return=n);g!==null;){var N=g.dependencies;if(N!==null){S=g.child;for(var D=N.firstContext;D!==null;){if(D.context===o){if(g.tag===1){D=tn(-1,i&-i),D.tag=2;var H=g.updateQueue;if(H!==null){H=H.shared;var q=H.pending;q===null?D.next=D:(D.next=q.next,q.next=D),H.pending=D}}g.lanes|=i,D=g.alternate,D!==null&&(D.lanes|=i),ka(g.return,i,n),N.lanes|=i;break}D=D.next}}else if(g.tag===10)S=g.type===n.type?null:g.child;else if(g.tag===18){if(S=g.return,S===null)throw Error(h(341));S.lanes|=i,N=S.alternate,N!==null&&(N.lanes|=i),ka(S,i,n),S=g.sibling}else S=g.child;if(S!==null)S.return=g;else for(S=g;S!==null;){if(S===n){S=null;break}if(g=S.sibling,g!==null){g.return=S.return,S=g;break}S=S.return}g=S}oe(t,n,u.children,i),n=n.child}return n;case 9:return u=n.type,o=n.pendingProps.children,lr(n,i),u=we(u),o=o(u),n.flags|=1,oe(t,n,o,i),n.child;case 14:return o=n.type,u=Me(o,n.pendingProps),u=Me(o.type,u),uu(t,n,o,u,i);case 15:return hu(t,n,n.type,n.pendingProps,i);case 17:return o=n.type,u=n.pendingProps,u=n.elementType===o?u:Me(o,u),Li(t,n),n.tag=1,ce(o)?(t=!0,hi(n)):t=!1,lr(n,i),eu(n,o,u),Va(n,o,u,i),Ka(null,n,o,!0,t,i);case 19:return _u(t,n,i);case 22:return cu(t,n,i)}throw Error(h(156,n.tag))};function Vu(t,n){return ga(t,n)}function Jd(t,n,i,o){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ke(t,n,i,o){return new Jd(t,n,i,o)}function yo(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Zd(t){if(typeof t=="function")return yo(t)?1:0;if(t!=null){if(t=t.$$typeof,t===P)return 11;if(t===L)return 14}return 2}function wn(t,n){var i=t.alternate;return i===null?(i=ke(t.tag,n,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=n,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,n=t.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Ji(t,n,i,o,u,g){var S=2;if(o=t,typeof t=="function")yo(t)&&(S=1);else if(typeof t=="string")S=5;else t:switch(t){case _:return Hn(i.children,u,g,n);case x:S=8,u|=8;break;case w:return t=ke(12,i,n,u|2),t.elementType=w,t.lanes=g,t;case E:return t=ke(13,i,n,u),t.elementType=E,t.lanes=g,t;case R:return t=ke(19,i,n,u),t.elementType=R,t.lanes=g,t;case v:return Zi(i,u,g,n);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case C:S=10;break t;case y:S=9;break t;case P:S=11;break t;case L:S=14;break t;case p:S=16,o=null;break t}throw Error(h(130,t==null?t:typeof t,""))}return n=ke(S,i,n,u),n.elementType=t,n.type=o,n.lanes=g,n}function Hn(t,n,i,o){return t=ke(7,t,o,n),t.lanes=i,t}function Zi(t,n,i,o){return t=ke(22,t,o,n),t.elementType=v,t.lanes=i,t.stateNode={isHidden:!1},t}function _o(t,n,i){return t=ke(6,t,null,n),t.lanes=i,t}function vo(t,n,i){return n=ke(4,t.children!==null?t.children:[],t.key,n),n.lanes=i,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}function $d(t,n,i,o,u){this.tag=n,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Q,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=da(0),this.expirationTimes=da(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=da(0),this.identifierPrefix=o,this.onRecoverableError=u,Rt&&(this.mutableSourceEagerHydrationData=null)}function Hu(t,n,i,o,u,g,S,N,D){return t=new $d(t,n,i,N,D),n===1?(n=1,g===!0&&(n|=8)):n=0,g=ke(3,null,null,n),t.current=g,g.stateNode=t,g.memoizedState={element:o,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Na(g),t}function Wu(t){if(!t)return pn;t=t._reactInternals;t:{if(U(t)!==t||t.tag!==1)throw Error(h(170));var n=t;do{switch(n.tag){case 3:n=n.stateNode.context;break t;case 1:if(ce(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break t}}n=n.return}while(n!==null);throw Error(h(171))}if(t.tag===1){var i=t.type;if(ce(i))return fl(t,i,n)}return n}function ju(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(h(188)):(t=Object.keys(t).join(","),Error(h(268,t)));return t=B(n),t===null?null:t.stateNode}function Ku(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i=H&&g>=it&&u<=q&&S<=K){t.splice(n,1);break}else if(o!==H||i.width!==D.width||KS){if(!(g!==it||i.height!==D.height||qu)){H>o&&(D.width+=H-o,D.x=o),qg&&(D.height+=it-g,D.y=g),Ki&&(i=S)),S ")+` + +No matching component was found for: + `)+t.join(" > ")}return null},r.getPublicRootInstance=function(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return _t(t.child.stateNode);default:return t.child.stateNode}},r.injectIntoDevTools=function(t){if(t={bundleType:t.bundleType,version:t.version,rendererPackageName:t.rendererPackageName,rendererConfig:t.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:t0,findFiberByHostInstance:t.findFiberByHostInstance||e0,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")t=!1;else{var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled||!n.supportsFiber)t=!0;else{try{gi=n.inject(t),Ue=n}catch{}t=!!n.checkDCE}}return t},r.isAlreadyRendering=function(){return!1},r.observeVisibleRects=function(t,n,i,o){if(!Rr)throw Error(h(363));t=so(t,n);var u=Rc(t,i,o).disconnect;return{disconnect:function(){u()}}},r.registerMutableSourceForHydration=function(t,n){var i=n._getVersion;i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i)},r.runWithPriority=function(t,n){var i=pt;try{return pt=t,n()}finally{pt=i}},r.shouldError=function(){return null},r.shouldSuspend=function(){return!1},r.updateContainer=function(t,n,i,o){var u=n.current,g=se(),S=Sn(u);return i=Wu(i),n.context===null?n.context=i:n.pendingContext=i,n=tn(g,S),n.payload={element:t},o=o===void 0?null:o,o!==null&&(n.callback=o),t=yn(u,n,S),t!==null&&(Ee(t,u,S,g),xi(t,u,S)),S},r};pc.exports=og;var lg=pc.exports;const ug=Bo(lg);var mc={exports:{}},tr={};/** + * @license React + * react-reconciler-constants.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */tr.ConcurrentRoot=1;tr.ContinuousEventPriority=4;tr.DefaultEventPriority=16;tr.DiscreteEventPriority=1;tr.IdleEventPriority=536870912;tr.LegacyRoot=0;mc.exports=tr;var yc=mc.exports;const kh={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let Th=!1,Nh=!1;const il=".react-konva-event",hg=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. +Position of a node will be changed during drag&drop, so you should update state of the react app as well. +Consider to add onDragMove or onDragEnd events. +For more info see: https://github.com/konvajs/react-konva/issues/256 +`,cg=`ReactKonva: You are using "zIndex" attribute for a Konva node. +react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. +For more info see: https://github.com/konvajs/react-konva/issues/194 +`,dg={};function ia(d,e,r=dg){if(!Th&&"zIndex"in e&&(console.warn(cg),Th=!0),!Nh&&e.draggable){var s=e.x!==void 0||e.y!==void 0,a=e.onDragEnd||e.onDragMove;s&&!a&&(console.warn(hg),Nh=!0)}for(var l in r)if(!kh[l]){var h=l.slice(0,2)==="on",c=r[l]!==e[l];if(h&&c){var f=l.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),d.off(f,r[l])}var m=!e.hasOwnProperty(l);m&&d.setAttr(l,void 0)}var _=e._useStrictMode,x={},w=!1;const C={};for(var l in e)if(!kh[l]){var h=l.slice(0,2)==="on",y=r[l]!==e[l];if(h&&y){var f=l.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),e[l]&&(C[f]=e[l])}!h&&(e[l]!==r[l]||_&&e[l]!==d.getAttr(l))&&(w=!0,x[l]=e[l])}w&&(d.setAttrs(x),Ln(d));for(var f in C)d.on(f+il,C[f])}function Ln(d){if(!lt.Konva.autoDrawEnabled){var e=d.getLayer()||d.getStage();e&&e.batchDraw()}}const _c={},fg={};ni.Node.prototype._applyProps=ia;function gg(d,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}d.add(e),Ln(d)}function pg(d,e,r){let s=ni[d];s||(console.error(`Konva has no node with the type ${d}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${d}" 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`),s=ni.Group);const a={},l={};for(var h in e){var c=h.slice(0,2)==="on";c?l[h]=e[h]:a[h]=e[h]}const f=new s(a);return ia(f,l),f}function mg(d,e,r){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${d}"`)}function yg(d,e,r){return!1}function _g(d){return d}function vg(){return null}function Sg(){return null}function Cg(d,e,r,s){return fg}function wg(){}function xg(d){}function Pg(d,e){return!1}function Eg(){return _c}function kg(){return _c}const Tg=setTimeout,Ng=clearTimeout,Rg=-1;function Fg(d,e){return!1}const Ag=!1,Mg=!0,Lg=!0;function bg(d,e){e.parent===d?e.moveToTop():d.add(e),Ln(d)}function Og(d,e){e.parent===d?e.moveToTop():d.add(e),Ln(d)}function vc(d,e,r){e._remove(),d.add(e),e.setZIndex(r.getZIndex()),Ln(d)}function Dg(d,e,r){vc(d,e,r)}function Gg(d,e){e.destroy(),e.off(il),Ln(d)}function Ig(d,e){e.destroy(),e.off(il),Ln(d)}function Ug(d,e,r){console.error(`Text components are not yet supported in ReactKonva. You text is: "${r}"`)}function zg(d,e,r){}function Bg(d,e,r,s,a){ia(d,a,s)}function Vg(d){d.hide(),Ln(d)}function Hg(d){}function Wg(d,e){(e.visible==null||e.visible)&&d.show()}function jg(d,e){}function Kg(d){}function Yg(){}const Xg=()=>yc.DefaultEventPriority,qg=Object.freeze(Object.defineProperty({__proto__:null,appendChild:bg,appendChildToContainer:Og,appendInitialChild:gg,cancelTimeout:Ng,clearContainer:Kg,commitMount:zg,commitTextUpdate:Ug,commitUpdate:Bg,createInstance:pg,createTextInstance:mg,detachDeletedInstance:Yg,finalizeInitialChildren:yg,getChildHostContext:kg,getCurrentEventPriority:Xg,getPublicInstance:_g,getRootHostContext:Eg,hideInstance:Vg,hideTextInstance:Hg,idlePriority:ss.unstable_IdlePriority,insertBefore:vc,insertInContainerBefore:Dg,isPrimaryRenderer:Ag,noTimeout:Rg,now:ss.unstable_now,prepareForCommit:vg,preparePortalMount:Sg,prepareUpdate:Cg,removeChild:Gg,removeChildFromContainer:Ig,resetAfterCommit:wg,resetTextContent:xg,run:ss.unstable_runWithPriority,scheduleTimeout:Tg,shouldDeprioritizeSubtree:Pg,shouldSetTextContent:Fg,supportsMutation:Lg,unhideInstance:Wg,unhideTextInstance:jg,warnsIfNotActing:Mg},Symbol.toStringTag,{value:"Module"}));var Qg=Object.defineProperty,Jg=Object.defineProperties,Zg=Object.getOwnPropertyDescriptors,Rh=Object.getOwnPropertySymbols,$g=Object.prototype.hasOwnProperty,t5=Object.prototype.propertyIsEnumerable,Fh=(d,e,r)=>e in d?Qg(d,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):d[e]=r,Ah=(d,e)=>{for(var r in e||(e={}))$g.call(e,r)&&Fh(d,r,e[r]);if(Rh)for(var r of Rh(e))t5.call(e,r)&&Fh(d,r,e[r]);return d},e5=(d,e)=>Jg(d,Zg(e)),Mh,Lh;typeof window<"u"&&((Mh=window.document)!=null&&Mh.createElement||((Lh=window.navigator)==null?void 0:Lh.product)==="ReactNative")?ue.useLayoutEffect:ue.useEffect;function Sc(d,e,r){if(!d)return;if(r(d)===!0)return d;let s=d.child;for(;s;){const a=Sc(s,e,r);if(a)return a;s=s.sibling}}function Cc(d){try{return Object.defineProperties(d,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return d}}const bh=console.error;console.error=function(){const d=[...arguments].join("");if(d!=null&&d.startsWith("Warning:")&&d.includes("useContext")){console.error=bh;return}return bh.apply(this,arguments)};const sl=Cc(ue.createContext(null));class wc extends ue.Component{render(){return ue.createElement(sl.Provider,{value:this._reactInternals},this.props.children)}}function n5(){const d=ue.useContext(sl);if(d===null)throw new Error("its-fine: useFiber must be called within a !");const e=ue.useId();return ue.useMemo(()=>{for(const s of[d,d==null?void 0:d.alternate]){if(!s)continue;const a=Sc(s,!1,l=>{let h=l.memoizedState;for(;h;){if(h.memoizedState===e)return!0;h=h.next}});if(a)return a}},[d,e])}function r5(){const d=n5(),[e]=ue.useState(()=>new Map);e.clear();let r=d;for(;r;){if(r.type&&typeof r.type=="object"){const a=r.type._context===void 0&&r.type.Provider===r.type?r.type:r.type._context;a&&a!==sl&&!e.has(a)&&e.set(a,ue.useContext(Cc(a)))}r=r.return}return e}function i5(){const d=r5();return ue.useMemo(()=>Array.from(d.keys()).reduce((e,r)=>s=>ue.createElement(e,null,ue.createElement(r.Provider,e5(Ah({},s),{value:d.get(r)}))),e=>ue.createElement(wc,Ah({},e))),[d])}function s5(d){const e=le.useRef({});return le.useLayoutEffect(()=>{e.current=d}),le.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const a5=d=>{const e=le.useRef(null),r=le.useRef(null),s=le.useRef(null),a=s5(d),l=i5(),h=c=>{const{forwardedRef:f}=d;f&&(typeof f=="function"?f(c):f.current=c)};return le.useLayoutEffect(()=>(r.current=new ni.Stage({width:d.width,height:d.height,container:e.current}),h(r.current),s.current=$r.createContainer(r.current,yc.LegacyRoot,!1,null),$r.updateContainer(le.createElement(l,{},d.children),s.current),()=>{ni.isBrowser&&(h(null),$r.updateContainer(null,s.current,null),r.current.destroy())}),[]),le.useLayoutEffect(()=>{h(r.current),ia(r.current,d,a),$r.updateContainer(le.createElement(l,{},d.children),s.current,null)}),le.createElement("div",{ref:e,id:d.id,accessKey:d.accessKey,className:d.className,role:d.role,style:d.style,tabIndex:d.tabIndex,title:d.title})},f5="Layer",g5="Rect",p5="Image",m5="Text",y5="Transformer",$r=ug(qg);$r.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:le.version,rendererPackageName:"react-konva"});const _5=le.forwardRef((d,e)=>le.createElement(wc,{},le.createElement(a5,{...d,forwardedRef:e})));export{p5 as I,d5 as K,f5 as L,g5 as R,_5 as S,m5 as T,y5 as a};