@camstack/addon-pipeline 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/detection-pipeline/index.js +205 -52
- package/dist/detection-pipeline/index.mjs +205 -53
- package/dist/stream-broker/_stub.js +1 -1
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-qX99--rF.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-dGO6_Xee.mjs} +3 -3
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-B0Z2W5UM.mjs +26 -0
- package/dist/stream-broker/{hostInit-Bx41KdYV.mjs → hostInit-ClKL4kbX.mjs} +3 -3
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/embed-dist/assets/MaskShapeCanvas-DI4BY7W2-DEYqSd2k.js +33 -0
- package/embed-dist/assets/MotionZonesSettings-C1EEbk2V-CRvYkSju.js +1 -0
- package/embed-dist/assets/PrivacyMaskSettings-APgPLF7p-CIq73-7y.js +1 -0
- package/embed-dist/assets/index-C5Az4io-.js +80 -0
- package/embed-dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-C9WX5HNw.mjs +0 -26
- package/embed-dist/assets/index-B8VlSD0-.js +0 -150
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{d as e,f as t,g as n,h as r,m as i,p as a}from"./index-C5Az4io-.js";var o=n(t()),s=n(e(),1),c=Math.PI/180;function l(){return typeof window<`u`&&({}.toString.call(window)===`[object Window]`||{}.toString.call(window)===`[object global]`)}var u=typeof global<`u`?global:typeof window<`u`?window:typeof WorkerGlobalScope<`u`?self:{},d={_global:u,version:`10.3.0`,isBrowser:l(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return d.angleDeg?e*c:e},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,_renderBackend:`web`,legacyTextRendering:!1,pixelRatio:typeof window<`u`&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return d.DD.isDragging},isTransforming(){return d.Transformer?.isTransforming()??!1},isDragReady(){return!!d.DD.node},releaseCanvasOnDestroy:!0,document:u.document,_injectGlobal(e){u.Konva!==void 0&&console.error(`Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.`),u.Konva=e}},f=e=>{d[e.prototype.getClassName()]=e};d._injectGlobal(d);var p=`Konva.js unsupported environment.
|
|
2
|
+
|
|
3
|
+
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
4
|
+
|
|
5
|
+
To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
|
|
6
|
+
|
|
7
|
+
bash: npm install canvas
|
|
8
|
+
js: import "konva/canvas-backend";
|
|
9
|
+
|
|
10
|
+
or
|
|
11
|
+
|
|
12
|
+
bash: npm install skia-canvas
|
|
13
|
+
js: import "konva/skia-backend";
|
|
14
|
+
`,m=()=>{if(typeof document>`u`)throw Error(p)},h=class e{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new e(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){let t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,i=this.m[1]*t+this.m[3]*n,a=this.m[0]*-n+this.m[2]*t,o=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=o,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){let n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,i=this.m[2]+this.m[0]*e,a=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this}multiply(e){let t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],i=this.m[1]*e.m[2]+this.m[3]*e.m[3],a=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],o=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=a,this.m[5]=o,this}invert(){let e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,i=this.m[0]*e,a=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),o=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=a,this.m[5]=o,this}getMatrix(){return this.m}decompose(){let e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],i=this.m[4],a=this.m[5],o=e*r-t*n,s={x:i,y:a,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||t!=0){let i=Math.sqrt(e*e+t*t);s.rotation=t>0?Math.acos(e/i):-Math.acos(e/i),s.scaleX=i,s.scaleY=o/i,s.skewX=(e*n+t*r)/o,s.skewY=0}else if(n!=0||r!=0){let i=Math.sqrt(n*n+r*r);s.rotation=Math.PI/2-(r>0?Math.acos(-n/i):-Math.acos(n/i)),s.scaleX=o/i,s.scaleY=i,s.skewX=0,s.skewY=(e*n+t*r)/o}return s.rotation=E._getRotation(s.rotation),s}},g=`[object Array]`,_=`[object Number]`,v=`[object String]`,y=`[object Boolean]`,b=Math.PI/180,x=180/Math.PI,S=`#`,C=``,w=`0`,ee=`Konva warning: `,te=`Konva error: `,ne=`rgb(`,T={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]},re=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,ie=[],ae=null,oe=typeof requestAnimationFrame<`u`&&requestAnimationFrame||function(e){setTimeout(e,16)},E={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===g},_isNumber(e){return Object.prototype.toString.call(e)===_&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===v},_isBoolean(e){return Object.prototype.toString.call(e)===y},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!=`string`)return!1;let t=e[0];return t===`#`||t===`.`||t===t.toUpperCase()},_sign(e){return e===0||e>0?1:-1},requestAnimFrame(e){ie.push(e),ie.length===1&&oe(function(){let e=ie;ie=[],e.forEach(function(e){e()})})},createCanvasElement(){m();let e=document.createElement(`canvas`);try{e.style=e.style||{}}catch{}return e},createImageElement(){return m(),document.createElement(`img`)},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){let n=E.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb(e){e=e.replace(S,C);let t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);for(;e.length<6;)e=w+e;return S+e},isCanvasFarblingActive(){if(ae!==null)return ae;if(typeof document>`u`)return ae=!1,!1;let e=this.createCanvasElement();e.width=10,e.height=10;let t=e.getContext(`2d`,{willReadFrequently:!0});t.clearRect(0,0,10,10),t.fillStyle=`#282828`,t.fillRect(0,0,10,10);let n=t.getImageData(0,0,10,10).data,r=!1;for(let e=0;e<100;e++)if(n[e*4]!==40||n[e*4+1]!==40||n[e*4+2]!==40||n[e*4+3]!==255){r=!0;break}return ae=r,this.releaseCanvas(e),ae},getHitColor(){let e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,t,n){return this.isCanvasFarblingActive()&&(e=Math.round(e/5)*5,t=Math.round(t/5)*5,n=Math.round(n/5)*5),S+this._rgbToHex(e,t,n)},getSnappedHexColor(e){let t=this._hexToRgb(e);return S+this._rgbToHex(Math.round(t.r/5)*5,Math.round(t.g/5)*5,Math.round(t.b/5)*5)},getRGB(e){let t;return e in T?(t=T[e],{r:t[0],g:t[1],b:t[2]}):e[0]===S?this._hexToRgb(e.substring(1)):e.substr(0,4)===ne?(t=re.exec(e.replace(/ /g,``)),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e||=`black`,E._namedColorToRBA(e)||E._hex3ColorToRGBA(e)||E._hex4ColorToRGBA(e)||E._hex6ColorToRGBA(e)||E._hex8ColorToRGBA(e)||E._rgbColorToRGBA(e)||E._rgbaColorToRGBA(e)||E._hslColorToRGBA(e)},_namedColorToRBA(e){let t=T[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf(`rgb(`)===0){e=e.match(/rgb\(([^)]+)\)/)[1];let t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf(`rgba(`)===0){e=e.match(/rgba\(([^)]+)\)/)[1];let t=e.split(/ *, */).map((e,t)=>e.slice(-1)===`%`?t===3?parseInt(e)/100:parseInt(e)/100*255:Number(e));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]===`#`&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]===`#`&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]===`#`&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]===`#`&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){let[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,i=Number(n[1])/100,a=Number(n[2])/100,o,s,c;if(i===0)return c=a*255,{r:Math.round(c),g:Math.round(c),b:Math.round(c),a:1};o=a<.5?a*(1+i):a+i-a*i;let l=2*a-o,u=[0,0,0];for(let e=0;e<3;e++)s=r+1/3*-(e-1),s<0&&s++,s>1&&s--,c=6*s<1?l+(o-l)*6*s:2*s<1?o:3*s<2?l+(o-l)*(2/3-s)*6:l,u[e]=c*255;return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){let t={};for(let n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*b},radToDeg(e){return e*x},_degToRad(e){return E.warn(`Util._degToRad is removed. Please use public Util.degToRad instead.`),E.degToRad(e)},_radToDeg(e){return E.warn(`Util._radToDeg is removed. Please use public Util.radToDeg instead.`),E.radToDeg(e)},_getRotation(e){return d.angleDeg?E.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw Error(te+e)},error(e){console.error(te+e)},warn(e){d.showWarnings&&console.warn(ee+e)},each(e,t){for(let n in e)t(n,e[n])},_inRange(e,t,n){return t<=e&&e<n},_getProjectionToSegment(e,t,n,r,i,a){let o,s,c,l=(e-n)*(e-n)+(t-r)*(t-r);if(l==0)o=e,s=t,c=(i-n)*(i-n)+(a-r)*(a-r);else{let u=((i-e)*(n-e)+(a-t)*(r-t))/l;u<0?(o=e,s=t,c=(e-i)*(e-i)+(t-a)*(t-a)):u>1?(o=n,s=r,c=(n-i)*(n-i)+(r-a)*(r-a)):(o=e+u*(n-e),s=t+u*(r-t),c=(o-i)*(o-i)+(s-a)*(s-a))}return[o,s,c]},_getProjectionToLine(e,t,n){let r=E.cloneObject(e),i=Number.MAX_VALUE;return t.forEach(function(a,o){if(!n&&o===t.length-1)return;let s=t[(o+1)%t.length],c=E._getProjectionToSegment(a.x,a.y,s.x,s.y,e.x,e.y),l=c[0],u=c[1],d=c[2];d<i&&(r.x=l,r.y=u,i=d)}),r},_prepareArrayForTween(e,t,n){let r=[],i=[];if(e.length>t.length){let n=t;t=e,e=n}for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});for(let e=0;e<t.length;e+=2)i.push({x:t[e],y:t[e+1]});let a=[];return i.forEach(function(e){let t=E._getProjectionToLine(e,r,n);a.push(t.x),a.push(t.y)}),a},_prepareToStringify(e){let t;e.visitedByCircularReferenceRemoval=!0;for(let n in e)if(e.hasOwnProperty(n)&&e[n]&&typeof e[n]==`object`){if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||E._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(E._prepareToStringify(e[n])===null)if(t.configurable)delete e[n];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(let n in t)e[n]=t[n];return e},_getFirstPointerId(e){return e.touches?e.changedTouches[0].identifier:e.pointerId||999},releaseCanvas(...e){d.releaseCanvasOnDestroy&&e.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(e,t,n,r){let i=t<0?t:0,a=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let o=0,s=0,c=0,l=0;typeof r==`number`?o=s=c=l=Math.min(r,t/2,n/2):(o=Math.min(r[0]||0,t/2,n/2),s=Math.min(r[1]||0,t/2,n/2),l=Math.min(r[2]||0,t/2,n/2),c=Math.min(r[3]||0,t/2,n/2)),e.moveTo(i+o,a),e.lineTo(i+t-s,a),e.arc(i+t-s,a+s,s,Math.PI*3/2,0,!1),e.lineTo(i+t,a+n-l),e.arc(i+t-l,a+n-l,l,0,Math.PI/2,!1),e.lineTo(i+c,a+n),e.arc(i+c,a+n-c,c,Math.PI/2,Math.PI,!1),e.lineTo(i,a+o),e.arc(i+o,a+o,o,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,i){r=Math.abs(r);for(let a=0;a<n;a++){let o=t[(a-1+n)%n],s=t[a],c=t[(a+1)%n],l={x:s.x-o.x,y:s.y-o.y},u={x:c.x-s.x,y:c.y-s.y},d=Math.hypot(l.x,l.y),f=Math.hypot(u.x,u.y),p;p=typeof i==`number`?i:a<i.length?i[a]:0,p=r*Math.cos(Math.PI/n)*Math.min(1,p/r*2);let m={x:l.x/d,y:l.y/d},h={x:u.x/f,y:u.y/f},g={x:s.x-m.x*p,y:s.y-m.y*p},_={x:s.x+h.x*p,y:s.y+h.y*p};a===0?e.moveTo(g.x,g.y):e.lineTo(g.x,g.y),e.arcTo(s.x,s.y,_.x,_.y,p)}}};function D(e){let t=[],n=e.length,r=E;for(let i=0;i<n;i++){let n=e[i];r._isNumber(n)?n=Math.round(n*1e3)/1e3:r._isString(n)||(n+=``),t.push(n)}return t}var O=`,`,k=`(`,se=`)`,ce=`([`,le=`])`,ue=`;`,de=`()`,fe=`=`,pe=`arc.arcTo.beginPath.bezierCurveTo.clearRect.clip.closePath.createLinearGradient.createPattern.createRadialGradient.drawImage.ellipse.fill.fillText.getImageData.createImageData.lineTo.moveTo.putImageData.quadraticCurveTo.rect.roundRect.restore.rotate.save.scale.setLineDash.setTransform.stroke.strokeText.transform.translate`.split(`.`),me=[`fillStyle`,`strokeStyle`,`shadowColor`,`shadowBlur`,`shadowOffsetX`,`shadowOffsetY`,`letterSpacing`,`lineCap`,`lineDashOffset`,`lineJoin`,`lineWidth`,`miterLimit`,`direction`,`font`,`textAlign`,`textBaseline`,`globalAlpha`,`globalCompositeOperation`,`imageSmoothingEnabled`,`filter`],he=100,ge=null;function _e(){if(ge!==null)return ge;try{let e=E.createCanvasElement().getContext(`2d`);return e?!!e&&`filter`in e:(ge=!1,!1)}catch{return ge=!1,!1}}var ve=class{constructor(e){this.canvas=e,d.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n=this.traceArr,r=n.length,i=``,a,o,s,c;for(a=0;a<r;a++)o=n[a],s=o.method,s?(c=o.args,i+=s,e?i+=de:E._isArray(c[0])?i+=ce+c.join(O)+le:(t&&(c=c.map(e=>typeof e==`number`?Math.floor(e):e)),i+=k+c.join(O)+se)):(i+=o.property,e||(i+=fe+o.val)),i+=ue;return i}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=he&&t.shift()}reset(){let e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){let t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){let t=e.attrs.lineCap;t&&this.setAttr(`lineCap`,t)}_applyOpacity(e){let t=e.getAbsoluteOpacity();t!==1&&this.setAttr(`globalAlpha`,t)}_applyLineJoin(e){let t=e.attrs.lineJoin;t&&this.setAttr(`lineJoin`,t)}_applyMiterLimit(e){let t=e.attrs.miterLimit;t!=null&&this.setAttr(`miterLimit`,t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,i,a){this._context.arc(e,t,n,r,i,a)}arcTo(e,t,n,r,i){this._context.arcTo(e,t,n,r,i)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,i,a){this._context.bezierCurveTo(e,t,n,r,i,a)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){let n=arguments;if(n.length===2)return this._context.createImageData(e,t);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,i,a){return this._context.createRadialGradient(e,t,n,r,i,a)}drawImage(e,t,n,r,i,a,o,s,c){let l=arguments,u=this._context;l.length===3?u.drawImage(e,t,n):l.length===5?u.drawImage(e,t,n,r,i):l.length===9&&u.drawImage(e,t,n,r,i,a,o,s,c)}ellipse(e,t,n,r,i,a,o,s){this._context.ellipse(e,t,n,r,i,a,o,s)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,i){this._context.roundRect(e,t,n,r,i)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}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,t,n,r,i,a){this._context.setTransform(e,t,n,r,i,a)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,i,a){this._context.transform(e,t,n,r,i,a)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e=this,t=pe.length,n=this.setAttr,r,i,a=function(t){let n=e[t],r;e[t]=function(){return i=D(Array.prototype.slice.call(arguments,0)),r=n.apply(e,arguments),e._trace({method:t,args:i}),r}};for(r=0;r<t;r++)a(pe[r]);e.setAttr=function(){n.apply(e,arguments);let t=arguments[0],r=arguments[1];(t===`shadowOffsetX`||t===`shadowOffsetY`||t===`shadowBlur`)&&(r/=this.canvas.getPixelRatio()),e._trace({property:t,val:r})}}_applyGlobalCompositeOperation(e){let t=e.attrs.globalCompositeOperation;!t||t===`source-over`||this.setAttr(`globalCompositeOperation`,t)}};me.forEach(function(e){Object.defineProperty(ve.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var ye=class extends ve{constructor(e,{willReadFrequently:t=!1}={}){super(e),this._context=e._canvas.getContext(`2d`,{willReadFrequently:t})}_fillColor(e){let t=e.fill();this.setAttr(`fillStyle`,t),e._fillFunc(this)}_fillPattern(e){this.setAttr(`fillStyle`,e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){let t=e._getLinearGradient();t&&(this.setAttr(`fillStyle`,t),e._fillFunc(this))}_fillRadialGradient(e){let t=e._getRadialGradient();t&&(this.setAttr(`fillStyle`,t),e._fillFunc(this))}_fill(e){let t=e.fill(),n=e.getFillPriority();if(t&&n===`color`){this._fillColor(e);return}let r=e.getFillPatternImage();if(r&&n===`pattern`){this._fillPattern(e);return}let i=e.getFillLinearGradientColorStops();if(i&&n===`linear-gradient`){this._fillLinearGradient(e);return}let a=e.getFillRadialGradientColorStops();if(a&&n===`radial-gradient`){this._fillRadialGradient(e);return}t?this._fillColor(e):r?this._fillPattern(e):i?this._fillLinearGradient(e):a&&this._fillRadialGradient(e)}_strokeLinearGradient(e){let t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),i=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(let e=0;e<r.length;e+=2)i.addColorStop(r[e],r[e+1]);this.setAttr(`strokeStyle`,i)}}_stroke(e){let t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();let e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr(`lineDashOffset`,e.dashOffset())),this.setAttr(`lineWidth`,e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr(`shadowColor`,`rgba(0,0,0,0)`),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr(`strokeStyle`,e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){let t=e.getShadowRGBA()??`black`,n=e.getShadowBlur()??5,r=e.getShadowOffset()??{x:0,y:0},i=e.getAbsoluteScale(),a=this.canvas.getPixelRatio(),o=i.x*a,s=i.y*a;this.setAttr(`shadowColor`,t),this.setAttr(`shadowBlur`,n*Math.min(Math.abs(o),Math.abs(s))),this.setAttr(`shadowOffsetX`,r.x*o),this.setAttr(`shadowOffsetY`,r.y*s)}},be=class extends ve{constructor(e){super(e),this._context=e._canvas.getContext(`2d`,{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr(`fillStyle`,e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){let t=e.getStrokeScaleEnabled();if(!t){this.save();let e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(e);let n=e.hitStrokeWidth(),r=n===`auto`?e.strokeWidth():n;this.setAttr(`lineWidth`,r),this.setAttr(`strokeStyle`,e.colorKey),e._strokeFuncHit(this),t||this.restore()}}},xe;function Se(){if(xe)return xe;let e=E.createCanvasElement(),t=e.getContext(`2d`);return xe=(function(){return(d._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),E.releaseCanvas(e),xe}var Ce=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;let t=(e||{}).pixelRatio||d.pixelRatio||Se();this.pixelRatio=t,this._canvas=E.createCanvasElement(),this._canvas.style.padding=`0`,this._canvas.style.margin=`0`,this._canvas.style.border=`0`,this._canvas.style.background=`transparent`,this._canvas.style.position=`absolute`,this._canvas.style.top=`0`,this._canvas.style.left=`0`}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){let t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+`px`;let t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+`px`;let t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch{try{return this._canvas.toDataURL()}catch(e){return E.error(`Unable to get data URL. `+e.message+` For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html.`),``}}}},we=class extends Ce{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new ye(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},Te=class extends Ce{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new be(this),this.setSize(e.width,e.height)}},A={get isDragging(){let e=!1;return A._dragElements.forEach(t=>{t.dragStatus===`dragging`&&(e=!0)}),e},justDragged:!1,get node(){let e;return A._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){let t=[];A._dragElements.forEach((n,r)=>{let{node:i}=n,a=i.getStage();a.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=E._getFirstPointerId(e));let o=a._changedPointerPositions.find(e=>e.id===n.pointerId);if(o){if(n.dragStatus!==`dragging`){let t=i.dragDistance();if(Math.max(Math.abs(o.x-n.startPointerPos.x),Math.abs(o.y-n.startPointerPos.y))<t||(i.startDrag({evt:e}),!i.isDragging()))return}i._setDragPosition(e,n),t.push(i)}}),t.forEach(t=>{t.getStage()&&t.fire(`dragmove`,{type:`dragmove`,target:t,evt:e},!0)})},_endDragBefore(e){let t=[];A._dragElements.forEach(n=>{let{node:r}=n,i=r.getStage();if(e&&i.setPointersPositions(e),!i._changedPointerPositions.find(e=>e.id===n.pointerId))return;(n.dragStatus===`dragging`||n.dragStatus===`stopped`)&&(A.justDragged=!0,d._mouseListenClick=!1,d._touchListenClick=!1,d._pointerListenClick=!1,n.dragStatus=`stopped`);let a=n.node.getLayer()||n.node instanceof d.Stage&&n.node;a&&t.indexOf(a)===-1&&t.push(a)}),t.forEach(e=>{e.draw()})},_endDragAfter(e){A._dragElements.forEach((t,n)=>{t.dragStatus===`stopped`&&t.node.fire(`dragend`,{type:`dragend`,target:t.node,evt:e},!0),t.dragStatus!==`dragging`&&A._dragElements.delete(n)})}};d.isBrowser&&(window.addEventListener(`mouseup`,A._endDragBefore,!0),window.addEventListener(`touchend`,A._endDragBefore,!0),window.addEventListener(`touchcancel`,A._endDragBefore,!0),window.addEventListener(`mousemove`,A._drag),window.addEventListener(`touchmove`,A._drag),window.addEventListener(`mouseup`,A._endDragAfter,!1),window.addEventListener(`touchend`,A._endDragAfter,!1),window.addEventListener(`touchcancel`,A._endDragAfter,!1));function Ee(e){return E._isString(e)?`"`+e+`"`:Object.prototype.toString.call(e)===`[object Number]`||E._isBoolean(e)?e:Object.prototype.toString.call(e)}function De(e){return e>255?255:e<0?0:Math.round(e)}function j(){if(d.isUnminified)return function(e,t){return E._isNumber(e)||E.warn(Ee(e)+` is a not valid value for "`+t+`" attribute. The value should be a number.`),e}}function Oe(e){if(d.isUnminified)return function(t,n){let r=E._isNumber(t),i=E._isArray(t)&&t.length==e;return!r&&!i&&E.warn(Ee(t)+` is a not valid value for "`+n+`" attribute. The value should be a number or Array<number>(`+e+`)`),t}}function ke(){if(d.isUnminified)return function(e,t){return E._isNumber(e)||e===`auto`||E.warn(Ee(e)+` is a not valid value for "`+t+`" attribute. The value should be a number or "auto".`),e}}function Ae(){if(d.isUnminified)return function(e,t){return E._isString(e)||E.warn(Ee(e)+` is a not valid value for "`+t+`" attribute. The value should be a string.`),e}}function je(){if(d.isUnminified)return function(e,t){let n=E._isString(e),r=Object.prototype.toString.call(e)===`[object CanvasGradient]`||e&&e.addColorStop;return n||r||E.warn(Ee(e)+` is a not valid value for "`+t+`" attribute. The value should be a string or a native gradient.`),e}}function Me(){if(d.isUnminified)return function(e,t){let n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(E._isArray(e)?e.forEach(function(e){E._isNumber(e)||E.warn(`"`+t+`" attribute has non numeric element `+e+`. Make sure that all elements are numbers.`)}):E.warn(Ee(e)+` is a not valid value for "`+t+`" attribute. The value should be a array of numbers.`)),e}}function Ne(){if(d.isUnminified)return function(e,t){return e===!0||e===!1||E.warn(Ee(e)+` is a not valid value for "`+t+`" attribute. The value should be a boolean.`),e}}function Pe(e){if(d.isUnminified)return function(t,n){return t==null||E.isObject(t)||E.warn(Ee(t)+` is a not valid value for "`+n+`" attribute. The value should be an object with properties `+e),t}}var Fe=`get`,Ie=`set`,M={addGetterSetter(e,t,n,r,i){M.addGetter(e,t,n),M.addSetter(e,t,r,i),M.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){let r=Fe+E._capitalize(t);e.prototype[r]=e.prototype[r]||function(){let e=this.attrs[t];return e===void 0?n:e}},addSetter(e,t,n,r){let i=Ie+E._capitalize(t);e.prototype[i]||M.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){let i=Ie+E._capitalize(t);e.prototype[i]=function(e){return n&&e!=null&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,i){let a=n.length,o=E._capitalize,s=Fe+o(t),c=Ie+o(t);e.prototype[s]=function(){let e={};for(let r=0;r<a;r++){let i=n[r];e[i]=this.getAttr(t+o(i))}return e};let l=Pe(n);e.prototype[c]=function(e){let a=this.attrs[t];r&&(e=r.call(this,e,t)),l&&l.call(this,e,t);for(let n in e)e.hasOwnProperty(n)&&this._setAttr(t+o(n),e[n]);return e||n.forEach(e=>{this._setAttr(t+o(e),void 0)}),this._fireChangeEvent(t,a,e),i&&i.call(this),this},M.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){let n=E._capitalize(t),r=Ie+n,i=Fe+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(e,t,n,r){E.error(`Adding deprecated `+t);let i=Fe+E._capitalize(t),a=t+` property is deprecated and will be removed soon. Look at Konva change log for more information.`;e.prototype[i]=function(){E.error(a);let e=this.attrs[t];return e===void 0?n:e},M.addSetter(e,t,r,function(){E.error(a)}),M.addOverloadedGetterSetter(e,t)},backCompat(e,t){E.each(t,function(t,n){let r=e.prototype[n],i=Fe+E._capitalize(t),a=Ie+E._capitalize(t);function o(){r.apply(this,arguments),E.error(`"`+t+`" method is deprecated and will be removed soon. Use ""`+n+`" instead.`)}e.prototype[t]=o,e.prototype[i]=o,e.prototype[a]=o})},afterSetFilter(){this._filterUpToDate=!1}};function Le(e){let t=/(\w+)\(([^)]+)\)/g,n;for(;(n=t.exec(e))!==null;){let[,e,t]=n;switch(e){case`blur`:{let e=parseFloat(t.replace(`px`,``));return function(t){this.blurRadius(e*.5);let n=d.Filters;n&&n.Blur&&n.Blur.call(this,t)}}case`brightness`:{let e=t.includes(`%`)?parseFloat(t)/100:parseFloat(t);return function(t){this.brightness(e);let n=d.Filters;n&&n.Brightness&&n.Brightness.call(this,t)}}case`contrast`:{let e=parseFloat(t);return function(t){let n=100*(Math.sqrt(e)-1);this.contrast(n);let r=d.Filters;r&&r.Contrast&&r.Contrast.call(this,t)}}case`grayscale`:return function(e){let t=d.Filters;t&&t.Grayscale&&t.Grayscale.call(this,e)};case`sepia`:return function(e){let t=d.Filters;t&&t.Sepia&&t.Sepia.call(this,e)};case`invert`:return function(e){let t=d.Filters;t&&t.Invert&&t.Invert.call(this,e)};default:E.warn(`CSS filter "${e}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Re=`absoluteOpacity`,ze=`allEventListeners`,Be=`absoluteTransform`,Ve=`absoluteScale`,He=`canvas`,Ue=`Change`,We=`children`,Ge=`konva`,Ke=`listening`,qe=`mouseenter`,Je=`mouseleave`,Ye=`pointerenter`,Xe=`pointerleave`,Ze=`touchenter`,Qe=`touchleave`,$e=`set`,et=`Shape`,tt=` `,nt=`stage`,rt=`transform`,it=`Stage`,at=`visible`,ot=[`xChange.konva`,`yChange.konva`,`scaleXChange.konva`,`scaleYChange.konva`,`skewXChange.konva`,`skewYChange.konva`,`rotationChange.konva`,`offsetXChange.konva`,`offsetYChange.konva`,`transformsEnabledChange.konva`].join(tt),st=1,N=class e{constructor(e){this._id=st++,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===rt||e===Be)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,t){let n=this._cache.get(e);return(n===void 0||(e===rt||e===Be)&&n.dirty===!0)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){let n=t.map(e=>e+`Change.konva`).join(tt);this.on(n,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(He)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Be&&this.fire(`absoluteTransformChange`)}clearCache(){if(this._cache.has(He)){let{scene:e,filter:t,hit:n}=this._cache.get(He);E.releaseCanvas(e._canvas,t._canvas,n._canvas),this._cache.delete(He)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){let t=e||{},n={};(t.x===void 0||t.y===void 0||t.width===void 0||t.height===void 0)&&(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let r=Math.ceil(t.width||n.width),i=Math.ceil(t.height||n.height),a=t.pixelRatio,o=t.x===void 0?Math.floor(n.x):t.x,s=t.y===void 0?Math.floor(n.y):t.y,c=t.offset||0,l=t.drawBorder||!1,u=t.hitCanvasPixelRatio||1;if(!r||!i){E.error(`Can not cache the node. Width or height of the node equals 0. Caching is skipped.`);return}let d=+(Math.abs(Math.round(n.x)-o)>.5),f=+(Math.abs(Math.round(n.y)-s)>.5);r+=c*2+d,i+=c*2+f,o-=c,s-=c;let p=new we({pixelRatio:a,width:r,height:i}),m=new we({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),h=new Te({pixelRatio:u,width:r,height:i}),g=p.getContext(),_=h.getContext(),v=new we({width:p.width/p.pixelRatio+Math.abs(o),height:p.height/p.pixelRatio+Math.abs(s),pixelRatio:p.pixelRatio}),y=v.getContext();return h.isCache=!0,p.isCache=!0,this._cache.delete(He),this._filterUpToDate=!1,t.imageSmoothingEnabled===!1&&(p.getContext()._context.imageSmoothingEnabled=!1,m.getContext()._context.imageSmoothingEnabled=!1),g.save(),_.save(),y.save(),g.translate(-o,-s),_.translate(-o,-s),y.translate(-o,-s),v.x=o,v.y=s,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Re),this._clearSelfAndDescendantCache(Ve),this.drawScene(p,this,v),this.drawHit(h,this),this._isUnderCache=!1,g.restore(),_.restore(),l&&(g.save(),g.beginPath(),g.rect(0,0,r,i),g.closePath(),g.setAttr(`strokeStyle`,`red`),g.setAttr(`lineWidth`,5),g.stroke(),g.restore()),E.releaseCanvas(v._canvas),this._cache.set(He,{scene:p,filter:m,hit:h,x:o,y:s}),this._requestDraw(),this}isCached(){return this._cache.has(He)}getClientRect(e){throw Error(`abstract "getClientRect" method call`)}_transformedRect(e,t){let n=[{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}],r=1/0,i=1/0,a=-1/0,o=-1/0,s=this.getAbsoluteTransform(t);return n.forEach(function(e){let t=s.point(e);r===void 0&&(r=a=t.x,i=o=t.y),r=Math.min(r,t.x),i=Math.min(i,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y)}),{x:r,y:i,width:a-r,height:o-i}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);let t=this._getCanvasCache();e.translate(t.x,t.y);let n=this._getCachedSceneCanvas(),r=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/r,n.height/r),e.restore()}_drawCachedHitCanvas(e){let t=this._getCanvasCache(),n=t.hit;e.save(),e.translate(t.x,t.y),e.drawImage(n._canvas,0,0,n.width/n.pixelRatio,n.height/n.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),t=this._getCanvasCache(),n=t.scene,r=t.filter,i=r.getContext(),a,o,s,c;if(!e||e.length===0)return n;if(this._filterUpToDate)return r;let l=!0;for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&_e(),typeof e[t]!=`string`||!_e()){l=!1;break}let u=n.pixelRatio;if(r.setSize(n.width/n.pixelRatio,n.height/n.pixelRatio),l){let t=e.join(` `);return i.save(),i.setAttr(`filter`,t),i.drawImage(n._canvas,0,0,n.getWidth()/u,n.getHeight()/u),i.restore(),this._filterUpToDate=!0,r}try{for(a=e.length,i.clear(),i.drawImage(n._canvas,0,0,n.getWidth()/u,n.getHeight()/u),o=i.getImageData(0,0,r.getWidth(),r.getHeight()),s=0;s<a;s++)c=e[s],typeof c==`string`&&(c=Le(c)),c.call(this,o),i.putImageData(o,0,0)}catch(e){E.error(`Unable to apply filter. `+e.message+` This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.`)}return this._filterUpToDate=!0,r}on(...e){let t=e[0],n=e[1];if(e[2],this._cache&&this._cache.delete(ze),e.length===3)return this._delegate.apply(this,e);let r=t.split(tt);for(let e=0;e<r.length;e++){let t=r[e].split(`.`),i=t[0],a=t[1]||``;this.eventListeners[i]||(this.eventListeners[i]=[]),this.eventListeners[i].push({name:a,handler:n})}return this}off(e,t){let n=(e||``).split(tt),r=n.length,i,a,o,s,c,l;if(this._cache&&this._cache.delete(ze),!e)for(a in this.eventListeners)this._off(a);for(i=0;i<r;i++)if(o=n[i],s=o.split(`.`),c=s[0],l=s[1],c)this.eventListeners[c]&&this._off(c,l,t);else for(a in this.eventListeners)this._off(a,l,t);return this}dispatchEvent(e){let t={target:this,type:e.type,evt:e};return this.fire(e.type,t),this}addEventListener(e,t){return this.on(e,function(e){t.call(this,e.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,t,n){let r=this;return this.on(e,function(e){let i=e.target.findAncestors(t,!0,r);for(let t=0;t<i.length;t++)e=E.cloneObject(e),e.currentTarget=i[t],n.call(i[t],e)}),this}remove(){return this.isDragging()&&this.stopDrag(),A._dragElements.delete(this._id),A._dragElements.forEach((e,t)=>{this.isAncestorOf(e.node)&&A._dragElements.delete(t)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Be),this._clearSelfAndDescendantCache(Re),this._clearSelfAndDescendantCache(Ve),this._clearSelfAndDescendantCache(nt),this._clearSelfAndDescendantCache(at),this._clearSelfAndDescendantCache(Ke)}_remove(){this._clearCaches();let e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){let t=`get`+E._capitalize(e);return E._isFunction(this[t])?this[t]():this.attrs[e]}getAncestors(){let e=this.getParent(),t=[];for(;e;)t.push(e),e=e.getParent();return t}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let t,n;if(!e)return this;for(t in e)t!==We&&(n=$e+E._capitalize(t),E._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))}),this}isListening(){return this._getCache(Ke,this._isListening)}_isListening(e){if(!this.listening())return!1;let t=this.getParent();return t&&t!==e&&this!==e?t._isListening(e):!0}isVisible(){return this._getCache(at,this._isVisible)}_isVisible(e){if(!this.visible())return!1;let t=this.getParent();return t&&t!==e&&this!==e?t._isVisible(e):!0}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);let n=this.getLayer(),r=!1;A._dragElements.forEach(e=>{e.dragStatus===`dragging`&&(e.node.nodeType===`Stage`||e.node.getLayer()===n)&&(r=!0)});let i=!t&&!d.hitOnDragEnabled&&(r||d.isTransforming());return this.isListening()&&this.isVisible()&&!i}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),t=this,n=0,r,i,a,o;function s(c){for(r=[],i=c.length,a=0;a<i;a++)o=c[a],n++,o.nodeType!==et&&(r=r.concat(o.getChildren().slice())),o._id===t._id&&(a=i);r.length>0&&r[0].getDepth()<=e&&s(r)}let c=this.getStage();return t.nodeType!==it&&c&&s(c.getChildren()),n}getDepth(){let e=0,t=this.parent;for(;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(rt),this._clearSelfAndDescendantCache(Be)),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(){let e=this.getStage();if(!e)return null;let t=e.getPointerPosition();if(!t)return null;let n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);let r=this.getAbsoluteTransform(e).getMatrix(),i=new h,a=this.offset();return i.m=r.slice(),i.translate(a.x,a.y),i.getTranslation()}setAbsolutePosition(e){let{x:t,y:n,...r}=this._clearTransform();this.attrs.x=t,this.attrs.y=n,this._clearCache(rt);let i=this._getAbsoluteTransform().copy();return i.invert(),i.translate(e.x,e.y),e={x:this.attrs.x+i.getTranslation().x,y:this.attrs.y+i.getTranslation().y},this._setTransform(r),this.setPosition({x:e.x,y:e.y}),this._clearCache(rt),this._clearSelfAndDescendantCache(Be),this}_setTransform(e){let t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){let 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 t=e.x,n=e.y,r=this.x(),i=this.y();return t!==void 0&&(r+=t),n!==void 0&&(i+=n),this.setPosition({x:r,y:i}),this}_eachAncestorReverse(e,t){let n=[],r=this.getParent(),i,a;if(!(t&&t._id===this._id)){for(n.unshift(this);r&&(!t||r._id!==t._id);)n.unshift(r),r=r.parent;for(i=n.length,a=0;a<i;a++)e(n[a])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return E.warn(`Node has no parent. moveToTop function is ignored.`),!1;let e=this.index;return e<this.parent.getChildren().length-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return E.warn(`Node has no parent. moveUp function is ignored.`),!1;let e=this.index;return e<this.parent.getChildren().length-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return E.warn(`Node has no parent. moveDown function is ignored.`),!1;let e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return E.warn(`Node has no parent. moveToBottom function is ignored.`),!1;let 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 E.warn(`Node has no parent. zIndex parameter is ignored.`),this;(e<0||e>=this.parent.children.length)&&E.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)+`.`);let t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Re,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),t,n,r,i,a,o={attrs:{},className:this.getClassName()};for(t in e)n=e[t],a=E.isObject(n)&&!E._isPlainObject(n)&&!E._isArray(n),!a&&(r=typeof this[t]==`function`&&this[t],delete e[t],i=r?r.call(this):null,e[t]=n,i!==n&&(o.attrs[t]=n));return E._prepareToStringify(o)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){let r=[];t&&this._isMatch(e)&&r.push(this);let i=this.parent;for(;i;){if(i===n)return r;i._isMatch(e)&&r.push(i),i=i.parent}return r}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if(typeof e==`function`)return e(this);let t=e.replace(/ /g,``).split(`,`),n=t.length,r,i;for(r=0;r<n;r++)if(i=t[r],E.isValidSelector(i)||(E.warn(`Selector "`+i+`" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".`),E.warn(`If you have a custom shape with such className, please change it to start with upper letter like "Triangle".`),E.warn(`Konva is awesome, right?`)),i.charAt(0)===`#`){if(this.id()===i.slice(1))return!0}else if(i.charAt(0)===`.`){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){let e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(nt,this._getStage)}_getStage(){let e=this.getParent();return e?e.getStage():null}fire(e,t={},n){return t.target=t.target||this,n?this._fireAndBubble(e,t):this._fire(e,t),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Be,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let t;if(e)return t=new h,this._eachAncestorReverse(function(e){let n=e.transformsEnabled();n===`all`?t.multiply(e.getTransform()):n===`position`&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())},e),t;{t=this._cache.get(Be)||new h,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();let e=this.transformsEnabled();if(e===`all`)t.multiply(this.getTransform());else if(e===`position`){let e=this.attrs.x||0,n=this.attrs.y||0,r=this.attrs.offsetX||0,i=this.attrs.offsetY||0;t.translate(e-r,n-i)}return t.dirty=!1,t}}getAbsoluteScale(e){let t=this;for(;t;)t._isUnderCache&&(e=t),t=t.getParent();let n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(rt,this._getTransform)}_getTransform(){let e=this._cache.get(rt)||new h;e.reset();let t=this.x(),n=this.y(),r=d.getAngle(this.rotation()),i=this.attrs.scaleX??1,a=this.attrs.scaleY??1,o=this.attrs.skewX||0,s=this.attrs.skewY||0,c=this.attrs.offsetX||0,l=this.attrs.offsetY||0;return(t!==0||n!==0)&&e.translate(t,n),r!==0&&e.rotate(r),(o!==0||s!==0)&&e.skew(o,s),(i!==1||a!==1)&&e.scale(i,a),(c!==0||l!==0)&&e.translate(-1*c,-1*l),e.dirty=!1,e}clone(e){let t=E.cloneObject(this.attrs),n,r,i,a,o;for(n in e)t[n]=e[n];let s=new this.constructor(t);for(n in this.eventListeners)for(r=this.eventListeners[n],i=r.length,a=0;a<i;a++)o=r[a],o.name.indexOf(Ge)<0&&(s.eventListeners[n]||(s.eventListeners[n]=[]),s.eventListeners[n].push(o));return s}_toKonvaCanvas(e){e||={};let t=this.getClientRect(),n=this.getStage(),r=e.x===void 0?Math.floor(t.x):e.x,i=e.y===void 0?Math.floor(t.y):e.y,a=e.pixelRatio||1,o=new we({width:e.width||Math.ceil(t.width)||(n?n.width():0),height:e.height||Math.ceil(t.height)||(n?n.height():0),pixelRatio:a}),s=o.getContext(),c=new we({width:o.width/o.pixelRatio+Math.abs(r),height:o.height/o.pixelRatio+Math.abs(i),pixelRatio:o.pixelRatio});return e.imageSmoothingEnabled===!1&&(s._context.imageSmoothingEnabled=!1),s.save(),(r||i)&&s.translate(-1*r,-1*i),this.drawScene(o,void 0,c),s.restore(),o}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e||={};let t=e.mimeType||null,n=e.quality||null,r=this._toKonvaCanvas(e).toDataURL(t,n);return e.callback&&e.callback(r),r}toImage(e){return new Promise((t,n)=>{try{let n=e?.callback;n&&delete e.callback,E._urlToImage(this.toDataURL(e),function(e){t(e),n?.(e)})}catch(e){n(e)}})}toBlob(e){return new Promise((t,n)=>{try{let n=e?.callback;n&&delete e.callback,this.toCanvas(e).toBlob(e=>{t(e),n?.(e)},e?.mimeType,e?.quality)}catch(e){n(e)}})}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.parent?this.parent.getDragDistance():d.dragDistance:this.attrs.dragDistance}_off(e,t,n){let r=this.eventListeners[e],i,a,o;for(i=0;i<r.length;i++)if(a=r[i].name,o=r[i].handler,(a!==`konva`||t===`konva`)&&(!t||a===t)&&(!n||n===o)){if(r.splice(i,1),r.length===0){delete this.eventListeners[e];break}i--}}_fireChangeEvent(e,t,n){this._fire(e+Ue,{oldVal:t,newVal:n})}addName(e){if(!this.hasName(e)){let t=this.name(),n=t?t+` `+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;let t=this.name();return t?(t||``).split(/\s/g).indexOf(e)!==-1:!1}removeName(e){let t=(this.name()||``).split(/\s/g),n=t.indexOf(e);return n!==-1&&(t.splice(n,1),this.name(t.join(` `))),this}setAttr(e,t){let n=this[$e+E._capitalize(e)];return E._isFunction(n)?n.call(this,t):this._setAttr(e,t),this}_requestDraw(){d.autoDrawEnabled&&(this.getLayer()||this.getStage())?.batchDraw()}_setAttr(e,t){let n=this.attrs[e];n===t&&!E.isObject(t)||(t==null?delete this.attrs[e]:this.attrs[e]=t,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,t),this._requestDraw())}_setComponentAttr(e,t,n){let r;n!==void 0&&(r=this.attrs[e],r||(this.attrs[e]=this.getAttr(e)),this.attrs[e][t]=n,this._fireChangeEvent(e,r,n))}_fireAndBubble(e,t,n){t&&this.nodeType===et&&(t.target=this);let r=[qe,Je,Ye,Xe,Ze,Qe];if(!(r.indexOf(e)!==-1&&(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||this.nodeType===`Stage`&&!n))){this._fire(e,t);let i=r.indexOf(e)!==-1&&n&&n.isAncestorOf&&n.isAncestorOf(this)&&!n.isAncestorOf(this.parent);(t&&!t.cancelBubble||!t)&&this.parent&&this.parent.isListening()&&!i&&(n&&n.parent?this._fireAndBubble.call(this.parent,e,t,n):this._fireAndBubble.call(this.parent,e,t))}}_getProtoListeners(t){let{nodeType:n}=this,r=e.protoListenerMap.get(n)||{},i=r?.[t];if(i===void 0){i=[];let a=Object.getPrototypeOf(this);for(;a;){let e=a.eventListeners?.[t]??[];i.push(...e),a=Object.getPrototypeOf(a)}r[t]=i,e.protoListenerMap.set(n,r)}return i}_fire(e,t){t||={},t.currentTarget=this,t.type=e;let n=this._getProtoListeners(e);if(n){let e=n.slice();for(let n=0;n<e.length;n++)e[n].handler.call(this,t)}let r=this.eventListeners[e];if(r){let n=r.slice(),i=n.length;for(let e=0;e<n.length;e++)n[e].handler.call(this,t);let a=this.eventListeners[e];if(a)for(let e=i;e<a.length;e++)a[e].handler.call(this,t)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){let t=e?e.pointerId:void 0,n=this.getStage(),r=this.getAbsolutePosition();if(!n)return;let i=n._getPointerById(t)||n._changedPointerPositions[0]||r;A._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-r.x,y:i.y-r.y},dragStatus:`ready`,pointerId:t,startEvent:e})}startDrag(e,t=!0){A._dragElements.has(this._id)||this._createDragElement(e);let n=A._dragElements.get(this._id);n.dragStatus=`dragging`,this.fire(`dragstart`,{type:`dragstart`,target:this,evt:n.startEvent&&n.startEvent.evt||e&&e.evt},t)}_setDragPosition(e,t){let n=this.getStage()._getPointerById(t.pointerId);if(!n)return;let r={x:n.x-t.offset.x,y:n.y-t.offset.y},i=this.dragBoundFunc();if(i!==void 0){let t=i.call(this,r,e);t?r=t:E.warn(`dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.`)}(!this._lastPos||this._lastPos.x!==r.x||this._lastPos.y!==r.y)&&(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}stopDrag(e){let t=A._dragElements.get(this._id);t&&(t.dragStatus=`stopped`),A._endDragBefore(e),A._endDragAfter(e)}setDraggable(e){this._setAttr(`draggable`,e),this._dragChange()}isDragging(){let e=A._dragElements.get(this._id);return e?e.dragStatus===`dragging`:!1}_listenDrag(){this._dragCleanup(),this.on(`mousedown.konva touchstart.konva`,function(e){if(!(e.evt.button===void 0||d.dragButtons.indexOf(e.evt.button)>=0)||this.isDragging())return;let t=!1;A._dragElements.forEach(e=>{this.isAncestorOf(e.node)&&(t=!0)}),t||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;let e=A._dragElements.get(this._id),t=e&&e.dragStatus===`dragging`,n=e&&e.dragStatus===`ready`;t?this.stopDrag():n&&A._dragElements.delete(this._id)}}_dragCleanup(){this.off(`mousedown.konva`),this.off(`touchstart.konva`)}isClientRectOnScreen(e={x:0,y:0}){let t=this.getStage();if(!t)return!1;let n={x:-e.x,y:-e.y,width:t.width()+2*e.x,height:t.height()+2*e.y};return E.haveIntersection(n,this.getClientRect())}static create(e,t){return E._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(t,n){let r=e.prototype.getClassName.call(t),i=t.children,a,o,s;n&&(t.attrs.container=n),d[r]||(E.warn(`Can not find a node with class name "`+r+`". Fallback to "Shape".`),r=`Shape`);let c=d[r];if(a=new c(t.attrs),i)for(o=i.length,s=0;s<o;s++)a.add(e._createNode(i[s]));return a}};N.protoListenerMap=new Map,N.prototype.nodeType=`Node`,N.prototype._attrsAffectingSize=[],N.prototype.eventListeners={},N.prototype.on(ot,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(rt),this._clearSelfAndDescendantCache(Be)}),N.prototype.on(`visibleChange.konva`,function(){this._clearSelfAndDescendantCache(at)}),N.prototype.on(`listeningChange.konva`,function(){this._clearSelfAndDescendantCache(Ke)}),N.prototype.on(`opacityChange.konva`,function(){this._clearSelfAndDescendantCache(Re)});var P=M.addGetterSetter;P(N,`zIndex`),P(N,`absolutePosition`),P(N,`position`),P(N,`x`,0,j()),P(N,`y`,0,j()),P(N,`globalCompositeOperation`,`source-over`,Ae()),P(N,`opacity`,1,j()),P(N,`name`,``,Ae()),P(N,`id`,``,Ae()),P(N,`rotation`,0,j()),M.addComponentsGetterSetter(N,`scale`,[`x`,`y`]),P(N,`scaleX`,1,j()),P(N,`scaleY`,1,j()),M.addComponentsGetterSetter(N,`skew`,[`x`,`y`]),P(N,`skewX`,0,j()),P(N,`skewY`,0,j()),M.addComponentsGetterSetter(N,`offset`,[`x`,`y`]),P(N,`offsetX`,0,j()),P(N,`offsetY`,0,j()),P(N,`dragDistance`,void 0,j()),P(N,`width`,0,j()),P(N,`height`,0,j()),P(N,`listening`,!0,Ne()),P(N,`preventDefault`,!0,Ne()),P(N,`filters`,void 0,function(e){return this._filterUpToDate=!1,e}),P(N,`visible`,!0,Ne()),P(N,`transformsEnabled`,`all`,Ae()),P(N,`size`),P(N,`dragBoundFunc`),P(N,`draggable`,!1,Ne()),M.backCompat(N,{rotateDeg:`rotate`,setRotationDeg:`setRotation`,getRotationDeg:`getRotation`});var ct=class extends N{constructor(){super(...arguments),this.children=[]}getChildren(e){let t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}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 t=0;t<e.length;t++)this.add(e[t]);return this}let t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire(`add`,{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){let t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){let n=[];return this._descendants(r=>{let i=r._isMatch(e);return i&&n.push(r),!!(i&&t)}),n}_descendants(e){let t=!1,n=this.getChildren();for(let r of n)if(t=e(r),t||r.hasChildren()&&(t=r._descendants(e),t))return!0;return!1}toObject(){let e=N.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){let t=N.prototype.clone.call(this,e);return this.getChildren().forEach(function(e){t.add(e.clone())}),t}getAllIntersections(e){let t=[];return this.find(`Shape`).forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)==null||t.forEach(function(t){t._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)==null||e.forEach(function(e,t){e.index=t}),this._requestDraw()}drawScene(e,t,n){let r=this.getLayer(),i=e||r&&r.getCanvas(),a=i&&i.getContext(),o=this._getCanvasCache(),s=o&&o.scene,c=i&&i.isCache;if(!this.isVisible()&&!c)return this;if(s){a.save();let e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren(`drawScene`,i,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;let n=this.getLayer(),r=e||n&&n.hitCanvas,i=r&&r.getContext(),a=this._getCanvasCache();if(a&&a.hit){i.save();let e=this.getAbsoluteTransform(t).getMatrix();i.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(i),i.restore()}else this._drawChildren(`drawHit`,r,t);return this}_drawChildren(e,t,n,r){var i;let a=t&&t.getContext(),o=this.clipWidth(),s=this.clipHeight(),c=this.clipFunc(),l=typeof o==`number`&&typeof s==`number`||c,u=n===this;if(l){a.save();let e=this.getAbsoluteTransform(n),t=e.getMatrix();a.transform(t[0],t[1],t[2],t[3],t[4],t[5]),a.beginPath();let r;if(c)r=c.call(this,a,this);else{let e=this.clipX(),t=this.clipY();a.rect(e||0,t||0,o,s)}a.clip.apply(a,r),t=e.copy().invert().getMatrix(),a.transform(t[0],t[1],t[2],t[3],t[4],t[5])}let d=!u&&this.globalCompositeOperation()!==`source-over`&&e===`drawScene`;d&&(a.save(),a._applyGlobalCompositeOperation(this)),(i=this.children)==null||i.forEach(function(i){i[e](t,n,r)}),d&&a.restore(),l&&a.restore()}getClientRect(e={}){var t;let n=e.skipTransform,r=e.relativeTo,i,a,o,s,c={x:1/0,y:1/0,width:0,height:0},l=this;(t=this.children)==null||t.forEach(function(t){if(!t.visible())return;let n=t.getClientRect({relativeTo:l,skipShadow:e.skipShadow,skipStroke:e.skipStroke});n.width===0&&n.height===0||(i===void 0?(i=n.x,a=n.y,o=n.x+n.width,s=n.y+n.height):(i=Math.min(i,n.x),a=Math.min(a,n.y),o=Math.max(o,n.x+n.width),s=Math.max(s,n.y+n.height)))});let u=this.find(`Shape`),d=!1;for(let e=0;e<u.length;e++)if(u[e]._isVisible(this)){d=!0;break}return c=d&&i!==void 0?{x:i,y:a,width:o-i,height:s-a}:{x:0,y:0,width:0,height:0},n?c:this._transformedRect(c,r)}};M.addComponentsGetterSetter(ct,`clip`,[`x`,`y`,`width`,`height`]),M.addGetterSetter(ct,`clipX`,void 0,j()),M.addGetterSetter(ct,`clipY`,void 0,j()),M.addGetterSetter(ct,`clipWidth`,void 0,j()),M.addGetterSetter(ct,`clipHeight`,void 0,j()),M.addGetterSetter(ct,`clipFunc`);var lt=new Map,ut=d._global.PointerEvent!==void 0;function dt(e){return lt.get(e)}function ft(e){return{evt:e,pointerId:e.pointerId}}function pt(e,t){return lt.get(e)===t}function mt(e,t){ht(e),t.getStage()&&(lt.set(e,t),ut&&t._fire(`gotpointercapture`,ft(new PointerEvent(`gotpointercapture`))))}function ht(e,t){let n=lt.get(e);if(!n)return;let r=n.getStage();r&&r.content,lt.delete(e),ut&&n._fire(`lostpointercapture`,ft(new PointerEvent(`lostpointercapture`)))}var gt=`Stage`,_t=`string`,vt=`px`,yt=`mouseout`,bt=`mouseleave`,xt=`mouseover`,St=`mouseenter`,Ct=`mousemove`,wt=`mousedown`,Tt=`mouseup`,Et=`pointermove`,F=`pointerdown`,Dt=`pointerup`,Ot=`pointercancel`,kt=`lostpointercapture`,At=`pointerout`,jt=`pointerleave`,Mt=`pointerover`,Nt=`pointerenter`,Pt=`contextmenu`,Ft=`touchstart`,I=`touchend`,It=`touchmove`,Lt=`touchcancel`,Rt=`wheel`,zt=5,Bt=[[St,`_pointerenter`],[wt,`_pointerdown`],[Ct,`_pointermove`],[Tt,`_pointerup`],[bt,`_pointerleave`],[Ft,`_pointerdown`],[It,`_pointermove`],[I,`_pointerup`],[Lt,`_pointercancel`],[xt,`_pointerover`],[Rt,`_wheel`],[Pt,`_contextmenu`],[F,`_pointerdown`],[Et,`_pointermove`],[Dt,`_pointerup`],[Ot,`_pointercancel`],[jt,`_pointerleave`],[kt,`_lostpointercapture`]],Vt={mouse:{[At]:yt,[jt]:bt,[Mt]:xt,[Nt]:St,[Et]:Ct,[F]:wt,[Dt]:Tt,[Ot]:`mousecancel`,pointerclick:`click`,pointerdblclick:`dblclick`},touch:{[At]:`touchout`,[jt]:`touchleave`,[Mt]:`touchover`,[Nt]:`touchenter`,[Et]:It,[F]:Ft,[Dt]:I,[Ot]:Lt,pointerclick:`tap`,pointerdblclick:`dbltap`},pointer:{[At]:At,[jt]:jt,[Mt]:Mt,[Nt]:Nt,[Et]:Et,[F]:F,[Dt]:Dt,[Ot]:Ot,pointerclick:`pointerclick`,pointerdblclick:`pointerdblclick`}},Ht=e=>e.indexOf(`pointer`)>=0?`pointer`:e.indexOf(`touch`)>=0?`touch`:`mouse`,Ut=e=>{let t=Ht(e);if(t===`pointer`)return d.pointerEventsEnabled&&Vt.pointer;if(t===`touch`)return Vt.touch;if(t===`mouse`)return Vt.mouse};function Wt(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&E.warn(`Stage does not support clipping. Please use clip for Layers or Groups.`),e}var Gt=`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);`,Kt=[],qt=class extends ct{constructor(e){super(Wt(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Kt.push(this),this.on(`widthChange.konva heightChange.konva`,this._resizeDOM),this.on(`visibleChange.konva`,this._checkVisibility),this.on(`clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva`,()=>{Wt(this.attrs)}),this._checkVisibility()}_validateAdd(e){let t=e.getType()===`Layer`,n=e.getType()===`FastLayer`;t||n||E.throw(`You may only add layers to the stage.`)}_checkVisibility(){if(!this.content)return;let e=this.visible()?``:`none`;this.content.style.display=e}setContainer(e){if(typeof e===_t){let t;if(e.charAt(0)===`.`){let t=e.slice(1);e=document.getElementsByClassName(t)[0]}else t=e.charAt(0)===`#`?e.slice(1):e,e=document.getElementById(t);if(!e)throw`Can not find container in document with id `+t}return this._setAttr(`container`,e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){let e=this.children,t=e.length;for(let n=0;n<t;n++)e[n].clear();return this}clone(e){return e||={},e.container=typeof document<`u`&&document.createElement(`div`),ct.prototype.clone.call(this,e)}destroy(){super.destroy();let e=this.content;e&&E._isInDocument(e)&&this.container().removeChild(e);let t=Kt.indexOf(this);return t>-1&&Kt.splice(t,1),E.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){let e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(E.warn(Gt),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();let t=new we({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach(function(t){if(!t.isVisible())return;let r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}),t}getIntersection(e){if(!e)return null;let t=this.children,n=t.length-1;for(let r=n;r>=0;r--){let n=t[r].getIntersection(e);if(n)return n}return null}_resizeDOM(){let e=this.width(),t=this.height();this.content&&(this.content.style.width=e+vt,this.content.style.height=t+vt),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}super.add(e);let n=this.children.length;return n>zt&&E.warn(`The stage has `+n+` 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.`),e.setSize({width:this.width(),height:this.height()}),e.draw(),d.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return pt(e,this)}setPointerCapture(e){mt(e,this)}releaseCapture(e){ht(e,this)}getLayers(){return this.children}_bindContentEvents(){d.isBrowser&&Bt.forEach(([e,t])=>{this.content.addEventListener(e,e=>{this[t](e)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);let t=Ut(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);let t=Ut(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+`targetShape`];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){let t=Ut(e.type),n=Ht(e.type);if(!t)return;this.setPointersPositions(e);let r=this._getTargetShape(n),i=!(d.isDragging()||d.isTransforming())||d.hitOnDragEnabled;r&&i?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+`targetShape`]=null):i&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){let t=Ut(e.type),n=Ht(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(i=>{let a=this.getIntersection(i);if(A.justDragged=!1,d[`_`+n+`ListenClick`]=!0,!a||!a.isListening()){this[n+`ClickStartShape`]=void 0;return}d.capturePointerEventsEnabled&&a.setPointerCapture(i.id),this[n+`ClickStartShape`]=a,a._fireAndBubble(t.pointerdown,{evt:e,pointerId:i.id}),r=!0;let o=e.type.indexOf(`touch`)>=0;a.preventDefault()&&e.cancelable&&o&&e.preventDefault()}),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){let t=Ut(e.type),n=Ht(e.type);if(!t)return;let r=e.type.indexOf(`touch`)>=0||e.pointerType===`touch`;if(d.isDragging()&&A.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(d.isDragging()||d.isTransforming())||d.hitOnDragEnabled))return;let i={},a=!1,o=this._getTargetShape(n);this._changedPointerPositions.forEach(r=>{let s=dt(r.id)||this.getIntersection(r),c=r.id,l={evt:e,pointerId:c},u=o!==s;if(u&&o&&(o._fireAndBubble(t.pointerout,{...l},s),o._fireAndBubble(t.pointerleave,{...l},s)),s){if(i[s._id])return;i[s._id]=!0}s&&s.isListening()?(a=!0,u&&(s._fireAndBubble(t.pointerover,{...l},o),s._fireAndBubble(t.pointerenter,{...l},o),this[n+`targetShape`]=s),s._fireAndBubble(t.pointermove,{...l})):o&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:c}),this[n+`targetShape`]=null)}),a||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){let t=Ut(e.type),n=Ht(e.type);if(!t)return;this.setPointersPositions(e);let r=this[n+`ClickStartShape`],i=this[n+`ClickEndShape`],a={},o=!1;this._changedPointerPositions.forEach(s=>{let c=dt(s.id)||this.getIntersection(s);if(c){if(c.releaseCapture(s.id),a[c._id])return;a[c._id]=!0}let l=s.id,u={evt:e,pointerId:l},f=!1;d[`_`+n+`InDblClickWindow`]?(f=!0,clearTimeout(this[n+`DblTimeout`])):A.justDragged||(d[`_`+n+`InDblClickWindow`]=!0,clearTimeout(this[n+`DblTimeout`])),this[n+`DblTimeout`]=setTimeout(function(){d[`_`+n+`InDblClickWindow`]=!1},d.dblClickWindow),c&&c.isListening()?(o=!0,this[n+`ClickEndShape`]=c,c._fireAndBubble(t.pointerup,{...u}),d[`_`+n+`ListenClick`]&&r&&r===c&&(c._fireAndBubble(t.pointerclick,{...u}),f&&i&&i===c&&c._fireAndBubble(t.pointerdblclick,{...u}))):(this[n+`ClickEndShape`]=null,o||=(this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),!0),d[`_`+n+`ListenClick`]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:l}),f&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:l}))}),o||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),d[`_`+n+`ListenClick`]=!1,e.cancelable&&n!==`touch`&&n!==`pointer`&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);let t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Pt,{evt:e}):this._fire(Pt,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);let t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Rt,{evt:e}):this._fire(Rt,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);let t=dt(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(Dt,ft(e)),ht(e.pointerId)}_lostpointercapture(e){ht(e.pointerId)}setPointersPositions(e){let t=this._getContentPosition(),n=null,r=null;e||=window.event,e.touches===void 0?(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:E._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:E._getFirstPointerId(e)}]):(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,e=>{this._pointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,e=>{this._changedPointerPositions.push({id:e.identifier,x:(e.clientX-t.left)/t.scaleX,y:(e.clientY-t.top)/t.scaleY})}))}_setPointerPosition(e){E.warn(`Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.`),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};let e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new we({width:this.width(),height:this.height()}),this.bufferHitCanvas=new Te({pixelRatio:1,width:this.width(),height:this.height()}),!d.isBrowser)return;let e=this.container();if(!e)throw`Stage has no container. A container is required.`;e.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`),e.appendChild(this.content),this._resizeDOM()}cache(){return E.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(e){e.batchDraw()}),this}};qt.prototype.nodeType=gt,f(qt),M.addGetterSetter(qt,`container`),d.isBrowser&&document.addEventListener(`visibilitychange`,()=>{Kt.forEach(e=>{e.batchDraw()})});var Jt=`hasShadow`,Yt=`shadowRGBA`,Xt=`patternImage`,Zt=`linearGradient`,Qt=`radialGradient`,$t;function en(){return $t||($t=E.createCanvasElement().getContext(`2d`),$t)}var tn={};function nn(e){let t=this.attrs.fillRule;t?e.fill(t):e.fill()}function rn(e){e.stroke()}function an(e){let t=this.attrs.fillRule;t?e.fill(t):e.fill()}function on(e){e.stroke()}function sn(){this._clearCache(Jt)}function cn(){this._clearCache(Yt)}function ln(){this._clearCache(Xt)}function un(){this._clearCache(Zt)}function dn(){this._clearCache(Qt)}var L=class extends N{constructor(e){super(e);let t,n=0;for(;t=E.getHitColor(),!(t&&!(t in tn));)if(n++,n>=1e4){E.warn(`Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it.`),t=E.getRandomColor();break}this.colorKey=t,tn[t]=this}getContext(){return E.warn(`shape.getContext() method is deprecated. Please do not use it.`),this.getLayer().getContext()}getCanvas(){return E.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(Jt,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Xt,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){let e=en().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||`repeat`);if(e&&e.setTransform){let t=new h;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(d.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());let n=t.getMatrix(),r=typeof DOMMatrix>`u`?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(Zt,this.__getLinearGradient)}__getLinearGradient(){let e=this.fillLinearGradientColorStops();if(e){let t=en(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),i=t.createLinearGradient(n.x,n.y,r.x,r.y);for(let t=0;t<e.length;t+=2)i.addColorStop(e[t],e[t+1]);return i}}_getRadialGradient(){return this._getCache(Qt,this.__getRadialGradient)}__getRadialGradient(){let e=this.fillRadialGradientColorStops();if(e){let t=en(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),i=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius());for(let t=0;t<e.length;t+=2)i.addColorStop(e[t],e[t+1]);return i}}getShadowRGBA(){return this._getCache(Yt,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;let e=E.colorToRGBA(this.shadowColor());if(e)return`rgba(`+e.r+`,`+e.g+`,`+e.b+`,`+e.a*(this.shadowOpacity()||1)+`)`}hasFill(){return this._calculate(`hasFill`,[`fillEnabled`,`fill`,`fillPatternImage`,`fillLinearGradientColorStops`,`fillRadialGradientColorStops`],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate(`hasStroke`,[`strokeEnabled`,`strokeWidth`,`stroke`,`strokeLinearGradientColorStops`],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){let e=this.hitStrokeWidth();return e===`auto`?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){let t=this.getStage();if(!t)return!1;let n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return N.prototype.destroy.call(this),delete tn[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){if(!(this.attrs.perfectDrawEnabled??!0))return!1;let t=e||this.hasFill(),n=this.hasStroke(),r=this.getAbsoluteOpacity()!==1;if(t&&n&&r)return!0;let i=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(t&&n&&i&&a)}setStrokeHitEnabled(e){E.warn(`strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead.`),e?this.hitStrokeWidth(`auto`):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){let e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}let r=e.skipTransform,i=e.relativeTo||t&&this.getStage()||void 0,a=this.getSelfRect(),o=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,s=a.width+o,c=a.height+o,l=!e.skipShadow&&this.hasShadow(),u=l?this.shadowOffsetX():0,d=l?this.shadowOffsetY():0,f=s+Math.abs(u),p=c+Math.abs(d),m=l&&this.shadowBlur()||0,h={width:f+m*2,height:p+m*2,x:-(o/2+m)+Math.min(u,0)+a.x,y:-(o/2+m)+Math.min(d,0)+a.y};return r?h:this._transformedRect(h,i)}drawScene(e,t,n){let r=this.getLayer(),i=(e||r.getCanvas()).getContext(),a=this._getCanvasCache(),o=this.getSceneFunc(),s=this.hasShadow(),c,l=t===this;if(!this.isVisible()&&!l)return this;if(a){i.save();let e=this.getAbsoluteTransform(t).getMatrix();return i.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedSceneCanvas(i),i.restore(),this}if(!o)return this;if(i.save(),this._useBufferCanvas()){c=this.getStage();let e=n||c.bufferCanvas,r=e.getContext();n?(r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.width,e.height),r.restore()):r.clear(),r.save(),r._applyLineJoin(this),r._applyMiterLimit(this);let a=this.getAbsoluteTransform(t).getMatrix();r.transform(a[0],a[1],a[2],a[3],a[4],a[5]),o.call(this,r,this),r.restore();let u=e.pixelRatio;s&&i._applyShadow(this),l||(i._applyOpacity(this),i._applyGlobalCompositeOperation(this)),i.drawImage(e._canvas,e.x||0,e.y||0,e.width/u,e.height/u)}else{if(i._applyLineJoin(this),i._applyMiterLimit(this),!l){let e=this.getAbsoluteTransform(t).getMatrix();i.transform(e[0],e[1],e[2],e[3],e[4],e[5]),i._applyOpacity(this),i._applyGlobalCompositeOperation(this)}s&&i._applyShadow(this),o.call(this,i,this)}return i.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;let r=this.getLayer(),i=e||r.hitCanvas,a=i&&i.getContext(),o=this.hitFunc()||this.sceneFunc(),s=this._getCanvasCache(),c=s&&s.hit;if(this.colorKey||E.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()`),c){a.save();let e=this.getAbsoluteTransform(t).getMatrix();return a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!o)return this;if(a.save(),a._applyLineJoin(this),a._applyMiterLimit(this),this!==t){let e=this.getAbsoluteTransform(t).getMatrix();a.transform(e[0],e[1],e[2],e[3],e[4],e[5])}return o.call(this,a,this),a.restore(),this}drawHitFromCache(e=0){let t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),r=t.hit,i=r.getContext(),a=r.getWidth(),o=r.getHeight();i.clear(),i.drawImage(n._canvas,0,0,a,o);try{let t=i.getImageData(0,0,a,o),n=t.data,r=n.length,s=E._hexToRgb(this.colorKey);for(let t=0;t<r;t+=4)n[t+3]>e?(n[t]=s.r,n[t+1]=s.g,n[t+2]=s.b,n[t+3]=255):n[t+3]=0;i.putImageData(t,0,0)}catch(e){E.error(`Unable to draw hit graph from cached scene canvas. `+e.message)}return this}hasPointerCapture(e){return pt(e,this)}setPointerCapture(e){mt(e,this)}releaseCapture(e){ht(e,this)}};L.prototype._fillFunc=nn,L.prototype._strokeFunc=rn,L.prototype._fillFuncHit=an,L.prototype._strokeFuncHit=on,L.prototype._centroid=!1,L.prototype.nodeType=`Shape`,f(L),L.prototype.eventListeners={},L.prototype.on(`shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva`,sn),L.prototype.on(`shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva`,cn),L.prototype.on(`fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva`,ln),L.prototype.on(`fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva`,un),L.prototype.on(`fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva`,dn),M.addGetterSetter(L,`stroke`,void 0,je()),M.addGetterSetter(L,`strokeWidth`,2,j()),M.addGetterSetter(L,`fillAfterStrokeEnabled`,!1),M.addGetterSetter(L,`hitStrokeWidth`,`auto`,ke()),M.addGetterSetter(L,`strokeHitEnabled`,!0,Ne()),M.addGetterSetter(L,`perfectDrawEnabled`,!0,Ne()),M.addGetterSetter(L,`shadowForStrokeEnabled`,!0,Ne()),M.addGetterSetter(L,`lineJoin`),M.addGetterSetter(L,`lineCap`),M.addGetterSetter(L,`miterLimit`),M.addGetterSetter(L,`sceneFunc`),M.addGetterSetter(L,`hitFunc`),M.addGetterSetter(L,`dash`),M.addGetterSetter(L,`dashOffset`,0,j()),M.addGetterSetter(L,`shadowColor`,void 0,Ae()),M.addGetterSetter(L,`shadowBlur`,0,j()),M.addGetterSetter(L,`shadowOpacity`,1,j()),M.addComponentsGetterSetter(L,`shadowOffset`,[`x`,`y`]),M.addGetterSetter(L,`shadowOffsetX`,0,j()),M.addGetterSetter(L,`shadowOffsetY`,0,j()),M.addGetterSetter(L,`fillPatternImage`),M.addGetterSetter(L,`fill`,void 0,je()),M.addGetterSetter(L,`fillPatternX`,0,j()),M.addGetterSetter(L,`fillPatternY`,0,j()),M.addGetterSetter(L,`fillLinearGradientColorStops`),M.addGetterSetter(L,`strokeLinearGradientColorStops`),M.addGetterSetter(L,`fillRadialGradientStartRadius`,0),M.addGetterSetter(L,`fillRadialGradientEndRadius`,0),M.addGetterSetter(L,`fillRadialGradientColorStops`),M.addGetterSetter(L,`fillPatternRepeat`,`repeat`),M.addGetterSetter(L,`fillEnabled`,!0),M.addGetterSetter(L,`strokeEnabled`,!0),M.addGetterSetter(L,`shadowEnabled`,!0),M.addGetterSetter(L,`dashEnabled`,!0),M.addGetterSetter(L,`strokeScaleEnabled`,!0),M.addGetterSetter(L,`fillPriority`,`color`),M.addComponentsGetterSetter(L,`fillPatternOffset`,[`x`,`y`]),M.addGetterSetter(L,`fillPatternOffsetX`,0,j()),M.addGetterSetter(L,`fillPatternOffsetY`,0,j()),M.addComponentsGetterSetter(L,`fillPatternScale`,[`x`,`y`]),M.addGetterSetter(L,`fillPatternScaleX`,1,j()),M.addGetterSetter(L,`fillPatternScaleY`,1,j()),M.addComponentsGetterSetter(L,`fillLinearGradientStartPoint`,[`x`,`y`]),M.addComponentsGetterSetter(L,`strokeLinearGradientStartPoint`,[`x`,`y`]),M.addGetterSetter(L,`fillLinearGradientStartPointX`,0),M.addGetterSetter(L,`strokeLinearGradientStartPointX`,0),M.addGetterSetter(L,`fillLinearGradientStartPointY`,0),M.addGetterSetter(L,`strokeLinearGradientStartPointY`,0),M.addComponentsGetterSetter(L,`fillLinearGradientEndPoint`,[`x`,`y`]),M.addComponentsGetterSetter(L,`strokeLinearGradientEndPoint`,[`x`,`y`]),M.addGetterSetter(L,`fillLinearGradientEndPointX`,0),M.addGetterSetter(L,`strokeLinearGradientEndPointX`,0),M.addGetterSetter(L,`fillLinearGradientEndPointY`,0),M.addGetterSetter(L,`strokeLinearGradientEndPointY`,0),M.addComponentsGetterSetter(L,`fillRadialGradientStartPoint`,[`x`,`y`]),M.addGetterSetter(L,`fillRadialGradientStartPointX`,0),M.addGetterSetter(L,`fillRadialGradientStartPointY`,0),M.addComponentsGetterSetter(L,`fillRadialGradientEndPoint`,[`x`,`y`]),M.addGetterSetter(L,`fillRadialGradientEndPointX`,0),M.addGetterSetter(L,`fillRadialGradientEndPointY`,0),M.addGetterSetter(L,`fillPatternRotation`,0),M.addGetterSetter(L,`fillRule`,void 0,Ae()),M.backCompat(L,{dashArray:`dash`,getDashArray:`getDash`,setDashArray:`getDash`,drawFunc:`sceneFunc`,getDrawFunc:`getSceneFunc`,setDrawFunc:`setSceneFunc`,drawHitFunc:`hitFunc`,getDrawHitFunc:`getHitFunc`,setDrawHitFunc:`setHitFunc`});var fn=`beforeDraw`,pn=`draw`,mn=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],hn=mn.length,gn=class extends ct{constructor(e){super(e),this.canvas=new we,this.hitCanvas=new Te({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);let t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){N.prototype.moveToTop.call(this);let e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!N.prototype.moveUp.call(this))return!1;let e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(N.prototype.moveDown.call(this)){let e=this.getStage();if(e){let t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(N.prototype.moveToBottom.call(this)){let e=this.getStage();if(e){let t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){let e=this.getNativeCanvasElement();return N.prototype.remove.call(this),e&&e.parentNode&&E._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){let t=e.getType();t!==`Group`&&t!==`Shape`&&E.throw(`You may only add groups and shapes to a layer.`)}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x===void 0?this.x():e.x,e.y=e.y===void 0?this.y():e.y,N.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display=`block`:this.canvas._canvas.style.display=`none`}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){E.warn(`Can not change width of layer. Use "stage.width(value)" function instead.`)}getHeight(){if(this.parent)return this.parent.height()}setHeight(){E.warn(`Can not change height of layer. Use "stage.height(value)" function instead.`)}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,E.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let r=0;r<hn;r++){let i=mn[r],a=this._getIntersection({x:e.x+i.x*t,y:e.y+i.y*t}),o=a.shape;if(o)return o;if(n=!!a.antialiased,!a.antialiased)break}if(n)t+=1;else return null}}_getIntersection(e){let t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(r===255){let e=tn[E.getHitColorKey(n[0],n[1],n[2])];return e?{shape:e}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(e,t,n){let r=this.getLayer(),i=e||r&&r.getCanvas();return this._fire(fn,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),ct.prototype.drawScene.call(this,i,t,n),this._fire(pn,{node:this}),this}drawHit(e,t){let n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),ct.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){E.warn(`hitGraphEnabled method is deprecated. Please use layer.listening() instead.`),this.listening(e)}getHitGraphEnabled(e){return E.warn(`hitGraphEnabled method is deprecated. Please use layer.listening() instead.`),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;let e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return E.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};gn.prototype.nodeType=`Layer`,f(gn),M.addGetterSetter(gn,`imageSmoothingEnabled`,!0),M.addGetterSetter(gn,`clearBeforeDraw`,!0),M.addGetterSetter(gn,`hitGraphEnabled`,!0,Ne());var _n=class extends gn{constructor(e){super(e),this.listening(!1),E.warn(`Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.`)}};_n.prototype.nodeType=`FastLayer`,f(_n);var vn=class extends ct{_validateAdd(e){let t=e.getType();t!==`Group`&&t!==`Shape`&&E.throw(`You may only add groups and shapes to groups.`)}};vn.prototype.nodeType=`Group`,f(vn);var yn=(function(){return u.performance&&u.performance.now?function(){return u.performance.now()}:function(){return new Date().getTime()}})(),bn=class e{constructor(t,n){this.id=e.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:yn(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(e){let t=[];return e&&(t=Array.isArray(e)?e:[e]),this.layers=t,this}getLayers(){return this.layers}addLayer(e){let t=this.layers,n=t.length;for(let r=0;r<n;r++)if(t[r]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){let t=e.animations,n=t.length;for(let e=0;e<n;e++)if(t[e].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=yn(),e._addAnimation(this),this}stop(){return e._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){let t=e.id,n=this.animations,r=n.length;for(let e=0;e<r;e++)if(n[e].id===t){this.animations.splice(e,1);break}}static _runFrames(){let e={},t=this.animations;for(let n=0;n<t.length;n++){let r=t[n],i=r.layers,a=r.func;r._updateFrameObject(yn());let o=i.length,s;if(s=a?a.call(r,r.frame)!==!1:!0,s)for(let t=0;t<o;t++){let n=i[t];n._id!==void 0&&(e[n._id]=n)}}for(let t in e)e.hasOwnProperty(t)&&e[t].batchDraw()}static _animationLoop(){let t=e;t.animations.length?(t._runFrames(),E.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,E.requestAnimFrame(this._animationLoop))}};bn.animations=[],bn.animIdCounter=0,bn.animRunning=!1;var xn={node:1,duration:1,easing:1,onFinish:1,yoyo:1},Sn=1,Cn=2,wn=3,Tn=[`fill`,`stroke`,`shadowColor`],En=0,Dn=class{constructor(e,t,n,r,i,a,o){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=a,this._change=0,this.prevPos=0,this.yoyo=o,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=i-this.begin,this.pause()}fire(e){let t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=Cn,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire(`onPlay`)}reverse(){this.state=wn,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire(`onReverse`)}seek(e){this.pause(),this._time=e,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(){let e=this.getTimer()-this._startTime;this.state===Cn?this.setTime(e):this.state===wn&&this.setTime(this.duration-e)}pause(){this.state=Sn,this.fire(`onPause`)}getTimer(){return new Date().getTime()}},On=class e{constructor(t){let n=this,r=t.node,i=r._id,a=t.easing||kn.Linear,o=!!t.yoyo,s,c;s=t.duration===void 0?.3:t.duration===0?.001:t.duration,this.node=r,this._id=En++;let l=r.getLayer()||(r instanceof d.Stage?r.getLayers():null);for(c in l||E.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new bn(function(){n.tween.onEnterFrame()},l),this.tween=new Dn(c,function(e){n._tweenFunc(e)},a,0,1,s*1e3,o),this._addListeners(),e.attrs[i]||(e.attrs[i]={}),e.attrs[i][this._id]||(e.attrs[i][this._id]={}),e.tweens[i]||(e.tweens[i]={}),t)xn[c]===void 0&&this._addAttr(c,t[c]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){let r=this.node,i=r._id,a,o,s,c,l,u=e.tweens[i][t];u&&delete e.attrs[i][u][t];let d=r.getAttr(t);if(E._isArray(n))if(a=[],o=Math.max(n.length,d.length),t===`points`&&n.length!==d.length&&(n.length>d.length?(c=d,d=E._prepareArrayForTween(d,n,r.closed())):(s=n,n=E._prepareArrayForTween(n,d,r.closed()))),t.indexOf(`fill`)===0)for(let e=0;e<o;e++)if(e%2==0)a.push(n[e]-d[e]);else{let t=E.colorToRGBA(d[e]);l=E.colorToRGBA(n[e]),d[e]=t,a.push({r:l.r-t.r,g:l.g-t.g,b:l.b-t.b,a:l.a-t.a})}else for(let e=0;e<o;e++)a.push(n[e]-d[e]);else Tn.indexOf(t)===-1?a=n-d:(d=E.colorToRGBA(d),l=E.colorToRGBA(n),a={r:l.r-d.r,g:l.g-d.g,b:l.b-d.b,a:l.a-d.a});e.attrs[i][this._id][t]={start:d,diff:a,end:n,trueEnd:s,trueStart:c},e.tweens[i][t]=this._id}_tweenFunc(t){let n=this.node,r=e.attrs[n._id][this._id],i,a,o,s,c,l,u,d;for(i in r){if(a=r[i],o=a.start,s=a.diff,d=a.end,E._isArray(o))if(c=[],u=Math.max(o.length,d.length),i.indexOf(`fill`)===0)for(l=0;l<u;l++)l%2==0?c.push((o[l]||0)+s[l]*t):c.push(`rgba(`+Math.round(o[l].r+s[l].r*t)+`,`+Math.round(o[l].g+s[l].g*t)+`,`+Math.round(o[l].b+s[l].b*t)+`,`+(o[l].a+s[l].a*t)+`)`);else for(l=0;l<u;l++)c.push((o[l]||0)+s[l]*t);else c=Tn.indexOf(i)===-1?o+s*t:`rgba(`+Math.round(o.r+s.r*t)+`,`+Math.round(o.g+s.g*t)+`,`+Math.round(o.b+s.b*t)+`,`+(o.a+s.a*t)+`)`;n.setAttr(i,c)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{let t=this.node,n=e.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr(`points`,n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{let t=this.node,n=e.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.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(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let t=this.node._id,n=this._id,r=e.tweens[t];this.pause(),this.anim&&this.anim.stop();for(let n in r)delete e.tweens[t][n];delete e.attrs[t][n],e.tweens[t]&&(Object.keys(e.tweens[t]).length===0&&delete e.tweens[t],Object.keys(e.attrs[t]).length===0&&delete e.attrs[t])}};On.attrs={},On.tweens={},N.prototype.to=function(e){let t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new On(e).play()};var kn={BackEaseIn(e,t,n,r){return n*(e/=r)*e*(2.70158*e-1.70158)+t},BackEaseOut(e,t,n,r){return n*((e=e/r-1)*e*(2.70158*e+1.70158)+1)+t},BackEaseInOut(e,t,n,r){let i=1.70158;return(e/=r/2)<1?n/2*(e*e*(((i*=1.525)+1)*e-i))+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},ElasticEaseIn(e,t,n,r,i,a){let o=0;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,!i||i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),-(i*2**(10*--e)*Math.sin((e*r-o)*(2*Math.PI)/a))+t)},ElasticEaseOut(e,t,n,r,i,a){let o=0;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,!i||i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),i*2**(-10*e)*Math.sin((e*r-o)*(2*Math.PI)/a)+n+t)},ElasticEaseInOut(e,t,n,r,i,a){let o=0;return e===0?t:(e/=r/2)==2?t+n:(a||=.3*1.5*r,!i||i<Math.abs(n)?(i=n,o=a/4):o=a/(2*Math.PI)*Math.asin(n/i),e<1?-.5*(i*2**(10*--e)*Math.sin((e*r-o)*(2*Math.PI)/a))+t:i*2**(-10*--e)*Math.sin((e*r-o)*(2*Math.PI)/a)*.5+n+t)},BounceEaseOut(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},BounceEaseIn(e,t,n,r){return n-kn.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?kn.BounceEaseIn(e*2,0,n,r)*.5+t:kn.BounceEaseOut(e*2-r,0,n,r)*.5+n*.5+t},EaseIn(e,t,n,r){return n*(e/=r)*e+t},EaseOut(e,t,n,r){return-n*(e/=r)*(e-2)+t},EaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},StrongEaseIn(e,t,n,r){return n*(e/=r)*e*e*e*e+t},StrongEaseOut(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t},StrongEaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},Linear(e,t,n,r){return n*e/r+t}},An=E._assign(d,{Util:E,Transform:h,Node:N,Container:ct,Stage:qt,stages:Kt,Layer:gn,FastLayer:_n,Group:vn,DD:A,Shape:L,shapes:tn,Animation:bn,Tween:On,Easings:kn,Context:ve,Canvas:Ce}),jn=class extends L{_sceneFunc(e){let t=d.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),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)}getSelfRect(){let e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=d.getAngle(n?360-this.angle():this.angle()),i=Math.cos(Math.min(r,Math.PI)),a=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),o=Math.sin(Math.min(r,Math.PI/2)),s=i*(i>0?e:t),c=1*t,l=a*(a>0?e:t),u=o*(o>0?t:e);return{x:s,y:n?-1*u:l,width:c-s,height:u-l}}};jn.prototype._centroid=!0,jn.prototype.className=`Arc`,jn.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`,`angle`,`clockwise`],f(jn),M.addGetterSetter(jn,`innerRadius`,0,j()),M.addGetterSetter(jn,`outerRadius`,0,j()),M.addGetterSetter(jn,`angle`,0,j()),M.addGetterSetter(jn,`clockwise`,!1,Ne());function Mn(e,t,n,r,i,a,o){let s=Math.sqrt((n-e)**2+(r-t)**2),c=Math.sqrt((i-n)**2+(a-r)**2),l=o*s/(s+c),u=o*c/(s+c);return[n-l*(i-e),r-l*(a-t),n+u*(i-e),r+u*(a-t)]}function Nn(e,t){let n=e.length,r=[];for(let i=2;i<n-2;i+=2){let n=Mn(e[i-2],e[i-1],e[i],e[i+1],e[i+2],e[i+3],t);isNaN(n[0])||(r.push(n[0]),r.push(n[1]),r.push(e[i]),r.push(e[i+1]),r.push(n[2]),r.push(n[3]))}return r}function Pn(e){let t=[[e[0],e[2],e[4],e[6]],[e[1],e[3],e[5],e[7]]],n=[];for(let e of t){let t=-3*e[0]+9*e[1]-9*e[2]+3*e[3];if(t!==0){let r=6*e[0]-12*e[1]+6*e[2],i=-3*e[0]+3*e[1],a=r*r-4*t*i;if(a>=0){let e=Math.sqrt(a);n.push((-r+e)/(2*t)),n.push((-r-e)/(2*t))}}}return n.filter(e=>e>0&&e<1).flatMap(e=>t.map(t=>{let n=1-e;return n*n*n*t[0]+3*n*n*e*t[1]+3*n*e*e*t[2]+e*e*e*t[3]}))}var Fn=class extends L{constructor(e){super(e),this.on(`pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva`,function(){this._clearCache(`tensionPoints`)})}_sceneFunc(e){let t=this.points(),n=t.length,r=this.tension(),i=this.closed(),a=this.bezier();if(!n)return;let o=0;if(e.beginPath(),e.moveTo(t[0],t[1]),r!==0&&n>4){let r=this.getTensionPoints(),a=r.length;for(o=i?0:4,i||e.quadraticCurveTo(r[0],r[1],r[2],r[3]);o<a-2;)e.bezierCurveTo(r[o++],r[o++],r[o++],r[o++],r[o++],r[o++]);i||e.quadraticCurveTo(r[a-2],r[a-1],t[n-2],t[n-1])}else if(a)for(o=2;o<n;)e.bezierCurveTo(t[o++],t[o++],t[o++],t[o++],t[o++],t[o++]);else for(o=2;o<n;o+=2)e.lineTo(t[o],t[o+1]);i?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache(`tensionPoints`,this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Nn(this.points(),this.tension())}_getTensionPointsClosed(){let e=this.points(),t=e.length,n=this.tension(),r=Mn(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),i=Mn(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),a=Nn(e,n);return[r[2],r[3]].concat(a,[i[0],i[1],e[t-2],e[t-1],i[2],i[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};e=this.tension()===0?this.bezier()?[e[0],e[1],...Pn(this.points()),e[e.length-2],e[e.length-1]]:this.points():[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]];let t=e[0],n=e[0],r=e[1],i=e[1],a,o;for(let s=0;s<e.length/2;s++)a=e[s*2],o=e[s*2+1],t=Math.min(t,a),n=Math.max(n,a),r=Math.min(r,o),i=Math.max(i,o);return{x:t,y:r,width:n-t,height:i-r}}};Fn.prototype.className=`Line`,Fn.prototype._attrsAffectingSize=[`points`,`bezier`,`tension`],f(Fn),M.addGetterSetter(Fn,`closed`,!1),M.addGetterSetter(Fn,`bezier`,!1),M.addGetterSetter(Fn,`tension`,0,j()),M.addGetterSetter(Fn,`points`,[],Me());var In=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],Ln=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],Rn=[[1],[1,1],[1,2,1],[1,3,3,1]],zn=(e,t,n)=>{let r,i,a=n/2;r=0;for(let n=0;n<20;n++)i=a*In[20][n]+a,r+=Ln[20][n]*Vn(e,t,i);return a*r},Bn=(e,t,n)=>{n===void 0&&(n=1);let r=e[0]-2*e[1]+e[2],i=t[0]-2*t[1]+t[2],a=2*e[1]-2*e[0],o=2*t[1]-2*t[0],s=4*(r*r+i*i),c=4*(r*a+i*o),l=a*a+o*o;if(s===0)return n*Math.sqrt((e[2]-e[0])**2+(t[2]-t[0])**2);let u=c/(2*s),d=l/s,f=n+u,p=d-u*u,m=f*f+p>0?Math.sqrt(f*f+p):0,h=u*u+p>0?Math.sqrt(u*u+p):0,g=u+Math.sqrt(u*u+p)===0?0:p*Math.log(Math.abs((f+m)/(u+h)));return Math.sqrt(s)/2*(f*m-u*h+g)};function Vn(e,t,n){let r=Hn(1,n,e),i=Hn(1,n,t),a=r*r+i*i;return Math.sqrt(a)}var Hn=(e,t,n)=>{let r=n.length-1,i,a;if(r===0)return 0;if(e===0){a=0;for(let e=0;e<=r;e++)a+=Rn[r][e]*(1-t)**(r-e)*t**+e*n[e];return a}else{i=Array(r);for(let e=0;e<r;e++)i[e]=r*(n[e+1]-n[e]);return Hn(e-1,t,i)}},Un=(e,t,n)=>{let r=1,i=e/t,a=(e-n(i))/t,o=0;for(;r>.001;){let s=n(i+a),c=Math.abs(e-s)/t;if(c<r)r=c,i+=a;else{let o=n(i-a),s=Math.abs(e-o)/t;s<r?(r=s,i-=a):a/=2}if(o++,o>500)break}return i},Wn=class e extends L{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on(`dataChange.konva`,function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=e.parsePathData(this.data()),this.pathLength=e.getPathLength(this.dataArray)}_sceneFunc(e){let t=this.dataArray;e.beginPath();let n=!1;for(let r=0;r<t.length;r++){let i=t[r].command,a=t[r].points;switch(i){case`L`:e.lineTo(a[0],a[1]);break;case`M`:e.moveTo(a[0],a[1]);break;case`C`:e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case`Q`:e.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case`A`:let t=a[0],r=a[1],i=a[2],o=a[3],s=a[4],c=a[5],l=a[6],u=a[7],d=i>o?i:o,f=i>o?1:i/o,p=i>o?o/i:1;e.translate(t,r),e.rotate(l),e.scale(f,p),e.arc(0,0,d,s,s+c,1-u),e.scale(1/f,1/p),e.rotate(-l),e.translate(-t,-r);break;case`z`:n=!0,e.closePath();break}}!n&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(n){if(n.command===`A`){let r=n.points[4],i=n.points[5],a=n.points[4]+i,o=Math.PI/180;if(Math.abs(r-a)<o&&(o=Math.abs(r-a)),i<0)for(let i=r-o;i>a;i-=o){let r=e.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],i,0);t.push(r.x,r.y)}else for(let i=r+o;i<a;i+=o){let r=e.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],i,0);t.push(r.x,r.y)}}else if(n.command===`C`)for(let r=0;r<=1;r+=.01){let i=e.getPointOnCubicBezier(r,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);t.push(i.x,i.y)}else t=t.concat(n.points)});let n=t[0],r=t[0],i=t[1],a=t[1],o,s;for(let e=0;e<t.length/2;e++)o=t[e*2],s=t[e*2+1],isNaN(o)||(n=Math.min(n,o),r=Math.max(r,o)),isNaN(s)||(i=Math.min(i,s),a=Math.max(a,s));return{x:n,y:i,width:r-n,height:a-i}}getLength(){return this.pathLength}getPointAtLength(t){return e.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}static getPathLength(e){let t=0;for(let n=0;n<e.length;++n)t+=e[n].pathLength;return t}static getPointAtLengthOfDataArray(t,n){let r,i=0,a=n.length;if(!a)return null;for(;i<a&&t>n[i].pathLength;)t-=n[i].pathLength,++i;if(i===a)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return n[i].command===`M`?(r=n[i].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[i].start.x,y:n[i].start.y};let o=n[i],s=o.points;switch(o.command){case`L`:return e.getPointOnLine(t,o.start.x,o.start.y,s[0],s[1]);case`C`:return e.getPointOnCubicBezier(Un(t,e.getPathLength(n),e=>zn([o.start.x,s[0],s[2],s[4]],[o.start.y,s[1],s[3],s[5]],e)),o.start.x,o.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case`Q`:return e.getPointOnQuadraticBezier(Un(t,e.getPathLength(n),e=>Bn([o.start.x,s[0],s[2]],[o.start.y,s[1],s[3]],e)),o.start.x,o.start.y,s[0],s[1],s[2],s[3]);case`A`:let r=s[0],i=s[1],a=s[2],c=s[3],l=s[5],u=s[6],d=s[4];return d+=l*t/o.pathLength,e.getPointOnEllipticalArc(r,i,a,c,d,u)}return null}static getPointOnLine(e,t,n,r,i,a,o){a??=t,o??=n;let s=this.getLineLength(t,n,r,i);if(s<1e-10)return{x:t,y:n};if(r===t)return{x:a,y:o+(i>n?e:-e)};let c=(i-n)/(r-t),l=Math.sqrt(e*e/(1+c*c))*(r<t?-1:1),u=c*l;if(Math.abs(o-n-c*(a-t))<1e-10)return{x:a+l,y:o+u};let d=((a-t)*(r-t)+(o-n)*(i-n))/(s*s),f=t+d*(r-t),p=n+d*(i-n),m=this.getLineLength(a,o,f,p),h=Math.sqrt(e*e-m*m),g=Math.sqrt(h*h/(1+c*c))*(r<t?-1:1),_=c*g;return{x:f+g,y:p+_}}static getPointOnCubicBezier(e,t,n,r,i,a,o,s,c){function l(e){return e*e*e}function u(e){return 3*e*e*(1-e)}function d(e){return 3*e*(1-e)*(1-e)}function f(e){return(1-e)*(1-e)*(1-e)}return{x:s*l(e)+a*u(e)+r*d(e)+t*f(e),y:c*l(e)+o*u(e)+i*d(e)+n*f(e)}}static getPointOnQuadraticBezier(e,t,n,r,i,a,o){function s(e){return e*e}function c(e){return 2*e*(1-e)}function l(e){return(1-e)*(1-e)}return{x:a*s(e)+r*c(e)+t*l(e),y:o*s(e)+i*c(e)+n*l(e)}}static getPointOnEllipticalArc(e,t,n,r,i,a){let o=Math.cos(a),s=Math.sin(a),c={x:n*Math.cos(i),y:r*Math.sin(i)};return{x:e+(c.x*o-c.y*s),y:t+(c.x*s+c.y*o)}}static parsePathData(e){if(!e)return[];let t=e,n=[`m`,`M`,`l`,`L`,`v`,`V`,`h`,`H`,`z`,`Z`,`c`,`C`,`q`,`Q`,`t`,`T`,`s`,`S`,`a`,`A`];t=t.replace(RegExp(` `,`g`),`,`);for(let e=0;e<n.length;e++)t=t.replace(new RegExp(n[e],`g`),`|`+n[e]);let r=t.split(`|`),i=[],a=[],o=0,s=0,c=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi,l;for(let e=1;e<r.length;e++){let t=r[e],n=t.charAt(0);for(t=t.slice(1),a.length=0;l=c.exec(t);)a.push(l[0]);let u=[],d=n===`A`||n===`a`?0:-1;for(let e=0,t=a.length;e<t;e++){let t=a[e];if(t===`00`){u.push(0,0),d>=0&&(d+=2,d>=7&&(d-=7));continue}if(d>=0){if(d===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(t)){u.push(parseInt(t[0],10)),u.push(parseInt(t[1],10)),u.push(parseFloat(t.slice(2))),d+=3,d>=7&&(d-=7);continue}if(t===`11`||t===`10`||t===`01`){u.push(parseInt(t[0],10)),u.push(parseInt(t[1],10)),d+=2,d>=7&&(d-=7);continue}if(t===`0`||t===`1`){u.push(parseInt(t,10)),d+=1,d>=7&&(d-=7);continue}}else if(d===4){if(/^[01]\d+(?:\.\d+)?$/.test(t)){u.push(parseInt(t[0],10)),u.push(parseFloat(t.slice(1))),d+=2,d>=7&&(d-=7);continue}if(t===`0`||t===`1`){u.push(parseInt(t,10)),d+=1,d>=7&&(d-=7);continue}}let e=parseFloat(t);isNaN(e)?u.push(0):u.push(e),d+=1,d>=7&&(d-=7)}else{let e=parseFloat(t);isNaN(e)?u.push(0):u.push(e)}}for(;u.length>0&&!isNaN(u[0]);){let e=``,t=[],r=o,a=s,c,l,d,f,p,m,h,g,_,v;switch(n){case`l`:o+=u.shift(),s+=u.shift(),e=`L`,t.push(o,s);break;case`L`:o=u.shift(),s=u.shift(),t.push(o,s);break;case`m`:let r=u.shift(),a=u.shift();if(o+=r,s+=a,e=`M`,i.length>2&&i[i.length-1].command===`z`){for(let e=i.length-2;e>=0;e--)if(i[e].command===`M`){o=i[e].points[0]+r,s=i[e].points[1]+a;break}}t.push(o,s),n=`l`;break;case`M`:o=u.shift(),s=u.shift(),e=`M`,t.push(o,s),n=`L`;break;case`h`:o+=u.shift(),e=`L`,t.push(o,s);break;case`H`:o=u.shift(),e=`L`,t.push(o,s);break;case`v`:s+=u.shift(),e=`L`,t.push(o,s);break;case`V`:s=u.shift(),e=`L`,t.push(o,s);break;case`C`:t.push(u.shift(),u.shift(),u.shift(),u.shift()),o=u.shift(),s=u.shift(),t.push(o,s);break;case`c`:t.push(o+u.shift(),s+u.shift(),o+u.shift(),s+u.shift()),o+=u.shift(),s+=u.shift(),e=`C`,t.push(o,s);break;case`S`:l=o,d=s,c=i[i.length-1],c.command===`C`&&(l=o+(o-c.points[2]),d=s+(s-c.points[3])),t.push(l,d,u.shift(),u.shift()),o=u.shift(),s=u.shift(),e=`C`,t.push(o,s);break;case`s`:l=o,d=s,c=i[i.length-1],c.command===`C`&&(l=o+(o-c.points[2]),d=s+(s-c.points[3])),t.push(l,d,o+u.shift(),s+u.shift()),o+=u.shift(),s+=u.shift(),e=`C`,t.push(o,s);break;case`Q`:t.push(u.shift(),u.shift()),o=u.shift(),s=u.shift(),t.push(o,s);break;case`q`:t.push(o+u.shift(),s+u.shift()),o+=u.shift(),s+=u.shift(),e=`Q`,t.push(o,s);break;case`T`:l=o,d=s,c=i[i.length-1],c.command===`Q`&&(l=o+(o-c.points[0]),d=s+(s-c.points[1])),o=u.shift(),s=u.shift(),e=`Q`,t.push(l,d,o,s);break;case`t`:l=o,d=s,c=i[i.length-1],c.command===`Q`&&(l=o+(o-c.points[0]),d=s+(s-c.points[1])),o+=u.shift(),s+=u.shift(),e=`Q`,t.push(l,d,o,s);break;case`A`:f=u.shift(),p=u.shift(),m=u.shift(),h=u.shift(),g=u.shift(),_=o,v=s,o=u.shift(),s=u.shift(),e=`A`,t=this.convertEndpointToCenterParameterization(_,v,o,s,h,g,f,p,m);break;case`a`:f=u.shift(),p=u.shift(),m=u.shift(),h=u.shift(),g=u.shift(),_=o,v=s,o+=u.shift(),s+=u.shift(),e=`A`,t=this.convertEndpointToCenterParameterization(_,v,o,s,h,g,f,p,m);break}i.push({command:e||n,points:t,start:{x:r,y:a},pathLength:this.calcLength(r,a,e||n,t)})}(n===`z`||n===`Z`)&&i.push({command:`z`,points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,i){let a,o,s,c,l=e;switch(r){case`L`:return l.getLineLength(t,n,i[0],i[1]);case`C`:return zn([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case`Q`:return Bn([t,i[0],i[2]],[n,i[1],i[3]],1);case`A`:a=0;let e=i[4],r=i[5],u=i[4]+r,d=Math.PI/180;if(Math.abs(e-u)<d&&(d=Math.abs(e-u)),o=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],e,0),r<0)for(c=e-d;c>u;c-=d)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),o=s;else for(c=e+d;c<u;c+=d)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),o=s;return s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),a}return 0}static convertEndpointToCenterParameterization(e,t,n,r,i,a,o,s,c){let l=Math.PI/180*c,u=Math.cos(l)*(e-n)/2+Math.sin(l)*(t-r)/2,d=-1*Math.sin(l)*(e-n)/2+Math.cos(l)*(t-r)/2,f=u*u/(o*o)+d*d/(s*s);f>1&&(o*=Math.sqrt(f),s*=Math.sqrt(f));let p=Math.sqrt((o*o*(s*s)-o*o*(d*d)-s*s*(u*u))/(o*o*(d*d)+s*s*(u*u)));i===a&&(p*=-1),isNaN(p)&&(p=0);let m=p*o*d/s,h=p*-s*u/o,g=(e+n)/2+Math.cos(l)*m-Math.sin(l)*h,_=(t+r)/2+Math.sin(l)*m+Math.cos(l)*h,v=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},y=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(v(e)*v(t))},b=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(y(e,t))},x=b([1,0],[(u-m)/o,(d-h)/s]),S=[(u-m)/o,(d-h)/s],C=[(-1*u-m)/o,(-1*d-h)/s],w=b(S,C);return y(S,C)<=-1&&(w=Math.PI),y(S,C)>=1&&(w=0),a===0&&w>0&&(w-=2*Math.PI),a===1&&w<0&&(w+=2*Math.PI),[g,_,o,s,x,w,l,a]}};Wn.prototype.className=`Path`,Wn.prototype._attrsAffectingSize=[`data`],f(Wn),M.addGetterSetter(Wn,`data`);var Gn=class extends Fn{_sceneFunc(e){super._sceneFunc(e);let t=Math.PI*2,n=this.points(),r=n,i=this.tension()!==0&&n.length>4;i&&(r=this.getTensionPoints());let a=this.pointerLength(),o=n.length,s,c;if(i){let e=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[o-2],n[o-1]],t=Wn.calcLength(r[r.length-4],r[r.length-3],`C`,e),i=Wn.getPointOnQuadraticBezier(Math.min(1,1-a/t),e[0],e[1],e[2],e[3],e[4],e[5]);s=n[o-2]-i.x,c=n[o-1]-i.y}else s=n[o-2]-n[o-4],c=n[o-1]-n[o-3];let l=(Math.atan2(c,s)+t)%t,u=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[o-2],n[o-1]),e.rotate(l),e.moveTo(0,0),e.lineTo(-a,u/2),e.lineTo(-a,-u/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),i?(s=(r[0]+r[2])/2-n[0],c=(r[1]+r[3])/2-n[1]):(s=n[2]-n[0],c=n[3]-n[1]),e.rotate((Math.atan2(-c,-s)+t)%t),e.moveTo(0,0),e.lineTo(-a,u/2),e.lineTo(-a,-u/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){let t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){let e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};Gn.prototype.className=`Arrow`,f(Gn),M.addGetterSetter(Gn,`pointerLength`,10,j()),M.addGetterSetter(Gn,`pointerWidth`,10,j()),M.addGetterSetter(Gn,`pointerAtBeginning`,!1),M.addGetterSetter(Gn,`pointerAtEnding`,!0);var Kn=class extends L{_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)}};Kn.prototype._centroid=!0,Kn.prototype.className=`Circle`,Kn.prototype._attrsAffectingSize=[`radius`],f(Kn),M.addGetterSetter(Kn,`radius`,0,j());var qn=class extends L{_sceneFunc(e){let t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,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)}};qn.prototype.className=`Ellipse`,qn.prototype._centroid=!0,qn.prototype._attrsAffectingSize=[`radiusX`,`radiusY`],f(qn),M.addComponentsGetterSetter(qn,`radius`,[`x`,`y`]),M.addGetterSetter(qn,`radiusX`,0,j()),M.addGetterSetter(qn,`radiusY`,0,j());var Jn=class e extends L{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on(`imageChange.konva`,e=>{this._removeImageLoad(e.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){let 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(){let e=!!this.cornerRadius(),t=this.hasShadow();return e&&t?!0:super._useBufferCanvas(!0)}_sceneFunc(e){let t=this.getWidth(),n=this.getHeight(),r=this.cornerRadius(),i=this.attrs.image,a;if(i){let e=this.attrs.cropWidth,r=this.attrs.cropHeight;a=e&&r?[i,this.cropX(),this.cropY(),e,r,0,0,t,n]:[i,0,0,t,n]}(this.hasFill()||this.hasStroke()||r)&&(e.beginPath(),r?E.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),i&&(r&&e.clip(),e.drawImage.apply(e,a))}_hitFunc(e){let t=this.width(),n=this.height(),r=this.cornerRadius();e.beginPath(),r?E.drawRoundedRectPath(e,t,n,r):e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.attrs.width??this.image()?.width??0}getHeight(){return this.attrs.height??this.image()?.height??0}static fromURL(t,n,r=null){let i=E.createImageElement();i.onload=function(){n(new e({image:i}))},i.onerror=r,i.crossOrigin=`Anonymous`,i.src=t}};Jn.prototype.className=`Image`,Jn.prototype._attrsAffectingSize=[`image`],f(Jn),M.addGetterSetter(Jn,`cornerRadius`,0,Oe(4)),M.addGetterSetter(Jn,`image`),M.addComponentsGetterSetter(Jn,`crop`,[`x`,`y`,`width`,`height`]),M.addGetterSetter(Jn,`cropX`,0,j()),M.addGetterSetter(Jn,`cropY`,0,j()),M.addGetterSetter(Jn,`cropWidth`,0,j()),M.addGetterSetter(Jn,`cropHeight`,0,j());var Yn=[`fontFamily`,`fontSize`,`fontStyle`,`padding`,`lineHeight`,`text`,`width`,`height`,`pointerDirection`,`pointerWidth`,`pointerHeight`],Xn=`Change.konva`,Zn=`none`,Qn=`up`,$n=`right`,er=`down`,tr=`left`,nr=Yn.length,rr=class extends vn{constructor(e){super(e),this.on(`add.konva`,function(e){this._addListeners(e.child),this._sync()})}getText(){return this.find(`Text`)[0]}getTag(){return this.find(`Tag`)[0]}_addListeners(e){let t=this,n,r=function(){t._sync()};for(n=0;n<nr;n++)e.on(Yn[n]+Xn,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),t=this.getTag(),n,r,i,a,o,s,c;if(e&&t){switch(n=e.width(),r=e.height(),i=t.pointerDirection(),a=t.pointerWidth(),c=t.pointerHeight(),o=0,s=0,i){case Qn:o=n/2,s=-1*c;break;case $n:o=n+a,s=r/2;break;case er:o=n/2,s=r+c;break;case tr:o=-1*a,s=r/2;break}t.setAttrs({x:-1*o,y:-1*s,width:n,height:r}),e.setAttrs({x:-1*o,y:-1*s})}}};rr.prototype.className=`Label`,f(rr);var ir=class extends L{_sceneFunc(e){let t=this.width(),n=this.height(),r=this.pointerDirection(),i=this.pointerWidth(),a=this.pointerHeight(),o=this.cornerRadius(),s=0,c=0,l=0,u=0;typeof o==`number`?s=c=l=u=Math.min(o,t/2,n/2):(s=Math.min(o[0]||0,t/2,n/2),c=Math.min(o[1]||0,t/2,n/2),u=Math.min(o[2]||0,t/2,n/2),l=Math.min(o[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(s,0),r===Qn&&(e.lineTo((t-i)/2,0),e.lineTo(t/2,-1*a),e.lineTo((t+i)/2,0)),e.lineTo(t-c,0),e.arc(t-c,c,c,Math.PI*3/2,0,!1),r===$n&&(e.lineTo(t,(n-a)/2),e.lineTo(t+i,n/2),e.lineTo(t,(n+a)/2)),e.lineTo(t,n-u),e.arc(t-u,n-u,u,0,Math.PI/2,!1),r===er&&(e.lineTo((t+i)/2,n),e.lineTo(t/2,n+a),e.lineTo((t-i)/2,n)),e.lineTo(l,n),e.arc(l,n-l,l,Math.PI/2,Math.PI,!1),r===tr&&(e.lineTo(0,(n+a)/2),e.lineTo(-1*i,n/2),e.lineTo(0,(n-a)/2)),e.lineTo(0,s),e.arc(s,s,s,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),i=this.pointerDirection(),a=this.width(),o=this.height();return i===Qn?(t-=r,o+=r):i===er?o+=r:i===tr?(e-=n*1.5,a+=n):i===$n&&(a+=n*1.5),{x:e,y:t,width:a,height:o}}};ir.prototype.className=`Tag`,f(ir),M.addGetterSetter(ir,`pointerDirection`,Zn),M.addGetterSetter(ir,`pointerWidth`,0,j()),M.addGetterSetter(ir,`pointerHeight`,0,j()),M.addGetterSetter(ir,`cornerRadius`,0,Oe(4));var ar=class extends L{_sceneFunc(e){let t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?E.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};ar.prototype.className=`Rect`,f(ar),M.addGetterSetter(ar,`cornerRadius`,0,Oe(4));var or=class extends L{_sceneFunc(e){let t=this._getPoints(),n=this.radius(),r=this.sides(),i=this.cornerRadius();if(e.beginPath(),i)E.drawRoundedPolygonPath(e,t,r,n,i);else{e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){let e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(let r=0;r<e;r++)n.push({x:t*Math.sin(r*2*Math.PI/e),y:-1*t*Math.cos(r*2*Math.PI/e)});return n}getSelfRect(){let e=this._getPoints(),t=e[0].x,n=e[0].x,r=e[0].y,i=e[0].y;return e.forEach(e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.y)}),{x:t,y:r,width:n-t,height:i-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};or.prototype.className=`RegularPolygon`,or.prototype._centroid=!0,or.prototype._attrsAffectingSize=[`radius`],f(or),M.addGetterSetter(or,`radius`,0,j()),M.addGetterSetter(or,`sides`,0,j()),M.addGetterSetter(or,`cornerRadius`,0,Oe(4));var sr=Math.PI*2,cr=class extends L{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,sr,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),sr,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)}};cr.prototype.className=`Ring`,cr.prototype._centroid=!0,cr.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],f(cr),M.addGetterSetter(cr,`innerRadius`,0,j()),M.addGetterSetter(cr,`outerRadius`,0,j());var lr=class extends L{constructor(e){super(e),this._updated=!0,this.anim=new bn(()=>{let e=this._updated;return this._updated=!1,e}),this.on(`animationChange.konva`,function(){this.frameIndex(0)}),this.on(`frameIndexChange.konva`,function(){this._updated=!0}),this.on(`frameRateChange.konva`,function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){let t=this.animation(),n=this.frameIndex(),r=n*4,i=this.animations()[t],a=this.frameOffsets(),o=i[r+0],s=i[r+1],c=i[r+2],l=i[r+3],u=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,c,l),e.closePath(),e.fillStrokeShape(this)),u)if(a){let r=a[t],i=n*2;e.drawImage(u,o,s,c,l,r[i+0],r[i+1],c,l)}else e.drawImage(u,o,s,c,l,0,0,c,l)}_hitFunc(e){let t=this.animation(),n=this.frameIndex(),r=n*4,i=this.animations()[t],a=this.frameOffsets(),o=i[r+2],s=i[r+3];if(e.beginPath(),a){let r=a[t],i=n*2;e.rect(r[i+0],r[i+1],o,s)}else e.rect(0,0,o,s);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){let e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;let 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(){let e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};lr.prototype.className=`Sprite`,f(lr),M.addGetterSetter(lr,`animation`),M.addGetterSetter(lr,`animations`),M.addGetterSetter(lr,`frameOffsets`),M.addGetterSetter(lr,`image`),M.addGetterSetter(lr,`frameIndex`,0,j()),M.addGetterSetter(lr,`frameRate`,17,j()),M.backCompat(lr,{index:`frameIndex`,getIndex:`getFrameIndex`,setIndex:`setFrameIndex`});var ur=class extends L{_sceneFunc(e){let t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let i=1;i<r*2;i++){let a=i%2==0?n:t,o=a*Math.sin(i*Math.PI/r),s=-1*a*Math.cos(i*Math.PI/r);e.lineTo(o,s)}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)}};ur.prototype.className=`Star`,ur.prototype._centroid=!0,ur.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],f(ur),M.addGetterSetter(ur,`numPoints`,5,j()),M.addGetterSetter(ur,`innerRadius`,0,j()),M.addGetterSetter(ur,`outerRadius`,0,j());function dr(e){return[...e].reduce((e,t,n,r)=>{if(/\p{Emoji}/u.test(t)){let i=r[n+1];i&&/\p{Emoji_Modifier}|\u200D/u.test(i)?(e.push(t+i),r[n+1]=``):e.push(t)}else /\p{Regional_Indicator}{2}/u.test(t+(r[n+1]||``))?e.push(t+r[n+1]):n>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(t)?e[e.length-1]+=t:t&&e.push(t);return e},[])}var fr=`auto`,pr=`center`,mr=`inherit`,hr=`justify`,gr=`Change.konva`,_r=`2d`,vr=`-`,yr=`left`,br=`text`,xr=`Text`,Sr=`top`,Cr=`bottom`,wr=`middle`,Tr=`normal`,Er=`px `,Dr=` `,Or=`right`,kr=`rtl`,Ar=`word`,jr=`char`,Mr=`none`,Nr=`…`,Pr=[`direction`,`fontFamily`,`fontSize`,`fontStyle`,`fontVariant`,`padding`,`align`,`verticalAlign`,`lineHeight`,`text`,`width`,`height`,`wrap`,`ellipsis`,`letterSpacing`],R=Pr.length,Fr=null;function Ir(){if(Fr!==null)return Fr;Fr=!1;try{let e=document.createElement(`canvas`);e.width=10,e.height=10;let t=e.getContext(_r);if(t){t.globalAlpha=0,t.shadowColor=`black`,t.shadowBlur=5,t.shadowOffsetX=5,t.shadowOffsetY=5,t.fillStyle=`black`,t.font=`10px Arial`,t.fillText(`X`,0,10);let e=t.getImageData(0,0,10,10).data;for(let t=3;t<e.length;t+=4)if(e[t]>0){Fr=!0;break}}}catch{}return Fr}function Lr(e){return e.split(`,`).map(e=>{e=e.trim();let t=e.indexOf(` `)>=0,n=e.indexOf(`"`)>=0||e.indexOf(`'`)>=0;return t&&!n&&(e=`"${e}"`),e}).join(`, `)}var Rr;function zr(){return Rr||(Rr=E.createCanvasElement().getContext(_r),Rr)}function Br(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Vr(e){e.setAttr(`miterLimit`,2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Hr(e){return e||={},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||`black`),e}var z=class extends L{constructor(e){super(Hr(e)),this._partialTextX=0,this._partialTextY=0;for(let e=0;e<R;e++)this.on(Pr[e]+gr,this._setTextData);this._setTextData()}_sceneFunc(e){let t=this.textArr,n=t.length;if(!this.text())return;let r=this.padding(),i=this.fontSize(),a=this.lineHeight()*i,o=this.verticalAlign(),s=this.direction(),c=0,l=this.align(),u=this.getWidth(),f=this.letterSpacing(),p=this.charRenderFunc(),m=this.fill(),h=this.textDecoration(),g=this.underlineOffset(),_=h.indexOf(`underline`)!==-1,v=h.indexOf(`line-through`)!==-1,y;s=s===mr?e.direction:s;let b=a/2,x=wr;if(!d.legacyTextRendering){let e=this.measureSize(`M`);x=`alphabetic`,b=((e.fontBoundingBoxAscent??e.actualBoundingBoxAscent)-(e.fontBoundingBoxDescent??e.actualBoundingBoxDescent))/2+a/2}for(s===kr&&e.setAttr(`direction`,s),e.setAttr(`font`,this._getContextFont()),e.setAttr(`textBaseline`,x),e.setAttr(`textAlign`,yr),o===wr?c=(this.getHeight()-n*a-r*2)/2:o===Cr&&(c=this.getHeight()-n*a-r*2),e.translate(r,c+r),y=0;y<n;y++){let o=0,c=t[y],h=c.text,x=c.width,S=c.lastInParagraph;if(e.save(),l===Or?o+=u-x-r*2:l===pr&&(o+=(u-x-r*2)/2),_){e.save(),e.beginPath();let t=g??(d.legacyTextRendering?Math.round(i/2):Math.round(i/4)),n=o,a=b+0+t;e.moveTo(n,a);let s=l===hr&&!S?u-r*2:x;e.lineTo(n+Math.round(s),a),e.lineWidth=i/15,e.strokeStyle=this._getLinearGradient()||m,e.stroke(),e.restore()}let C=o;if(s!==kr&&(f!==0||l===hr||p)){let n=h.split(` `).length-1,i=dr(h);for(let a=0;a<i.length;a++){let s=i[a];if(s===` `&&!S&&l===hr&&(o+=(u-r*2-x)/n),this._partialTextX=o,this._partialTextY=b+0,this._partialText=s,p){e.save();let n=t.slice(0,y).reduce((e,t)=>e+dr(t.text).length,0);p({char:s,index:a+n,x:o,y:b+0,lineIndex:y,column:a,isLastInLine:S,width:this.measureSize(s).width,context:e})}e.fillStrokeShape(this),p&&e.restore(),o+=this.measureSize(s).width+f}}else f!==0&&e.setAttr(`letterSpacing`,`${f}px`),this._partialTextX=o,this._partialTextY=b+0,this._partialText=h,e.fillStrokeShape(this);if(v){e.save(),e.beginPath();let t=d.legacyTextRendering?0:-Math.round(i/4),n=C;e.moveTo(n,b+0+t);let a=l===hr&&!S?u-r*2:x;e.lineTo(n+Math.round(a),b+0+t),e.lineWidth=i/15,e.strokeStyle=this._getLinearGradient()||m,e.stroke(),e.restore()}e.restore(),n>1&&(b+=a)}}_hitFunc(e){let t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){let t=E._isString(e)?e:e==null?``:e+``;return this._setAttr(br,t),this}getWidth(){return this.attrs.width===fr||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===fr||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return E.warn(`text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.`),this.textHeight}measureSize(e){let t=zr(),n=this.fontSize(),r;t.save(),t.font=this._getContextFont(),r=t.measureText(e),t.restore();let i=n/100;return{actualBoundingBoxAscent:r.actualBoundingBoxAscent??71.58203125*i,actualBoundingBoxDescent:r.actualBoundingBoxDescent??0,actualBoundingBoxLeft:r.actualBoundingBoxLeft??-7.421875*i,actualBoundingBoxRight:r.actualBoundingBoxRight??75.732421875*i,alphabeticBaseline:r.alphabeticBaseline??0,emHeightAscent:r.emHeightAscent??100*i,emHeightDescent:r.emHeightDescent??-20*i,fontBoundingBoxAscent:r.fontBoundingBoxAscent??91*i,fontBoundingBoxDescent:r.fontBoundingBoxDescent??21*i,hangingBaseline:r.hangingBaseline??72.80000305175781*i,ideographicBaseline:r.ideographicBaseline??-21*i,width:r.width,height:n}}_getContextFont(){return this.fontStyle()+Dr+this.fontVariant()+Dr+(this.fontSize()+Er)+Lr(this.fontFamily())}_addTextLine(e){this.align()===hr&&(e=e.trim());let t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){let t=this.letterSpacing(),n=e.length;return zr().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
|
|
15
|
+
`),t=+this.fontSize(),n=0,r=this.lineHeight()*t,i=this.attrs.width,a=this.attrs.height,o=i!==fr&&i!==void 0,s=a!==fr&&a!==void 0,c=this.padding(),l=i-c*2,u=a-c*2,d=0,f=this.wrap(),p=f!==jr&&f!==Mr,m=this.ellipsis();this.textArr=[],zr().font=this._getContextFont();let h=m?this._getTextWidth(Nr):0;for(let t=0,i=e.length;t<i;++t){let a=e[t],c=this._getTextWidth(a);if(o&&c>l)for(;a.length>0;){let e=0,t=dr(a).length,i=``,o=0;for(;e<t;){let n=e+t>>>1,c=dr(a).slice(0,n+1).join(``),f=this._getTextWidth(c);(m&&s&&d+r>u?f+h:f)<=l?(e=n+1,i=c,o=f):t=n}if(i){if(p){let t=dr(a),n=dr(i),r=t[n.length],s=r===Dr||r===vr,c;if(s&&o<=l)c=n.length;else{let e=n.lastIndexOf(Dr),t=n.lastIndexOf(vr);c=Math.max(e,t)+1}c>0&&(e=c,i=t.slice(0,e).join(``),o=this._getTextWidth(i))}if(i=i.trimRight(),this._addTextLine(i),n=Math.max(n,o),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if(a=dr(a).slice(e).join(``).trimLeft(),a.length>0&&(c=this._getTextWidth(a),c<=l)){this._addTextLine(a),d+=r,n=Math.max(n,c);break}}else break}else this._addTextLine(a),d+=r,n=Math.max(n,c),this._shouldHandleEllipsis(d)&&t<i-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),s&&d+r>u)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){let t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,i=r!==fr&&r!==void 0,a=r-this.padding()*2;return this.wrap()===Mr||i&&e+n>a}_tryToAddEllipsisToLastLine(){let e=this.attrs.width,t=e!==fr&&e!==void 0,n=e-this.padding()*2,r=this.ellipsis(),i=this.textArr[this.textArr.length-1];!i||!r||(t&&(this._getTextWidth(i.text+Nr)<n||(i.text=i.text.slice(0,i.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(i.text+Nr))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){let e=this.textDecoration().indexOf(`underline`)!==-1||this.textDecoration().indexOf(`line-through`)!==-1,t=this.hasShadow();return e&&t||t&&this.getAbsoluteOpacity()!==1&&Ir()?!0:super._useBufferCanvas()}};z.prototype._fillFunc=Br,z.prototype._strokeFunc=Vr,z.prototype.className=xr,z.prototype._attrsAffectingSize=[`text`,`fontSize`,`padding`,`wrap`,`lineHeight`,`letterSpacing`],f(z),M.overWriteSetter(z,`width`,ke()),M.overWriteSetter(z,`height`,ke()),M.addGetterSetter(z,`direction`,mr),M.addGetterSetter(z,`fontFamily`,`Arial`),M.addGetterSetter(z,`fontSize`,12,j()),M.addGetterSetter(z,`fontStyle`,Tr),M.addGetterSetter(z,`fontVariant`,Tr),M.addGetterSetter(z,`padding`,0,j()),M.addGetterSetter(z,`align`,yr),M.addGetterSetter(z,`verticalAlign`,Sr),M.addGetterSetter(z,`lineHeight`,1,j()),M.addGetterSetter(z,`wrap`,Ar),M.addGetterSetter(z,`ellipsis`,!1,Ne()),M.addGetterSetter(z,`letterSpacing`,0,j()),M.addGetterSetter(z,`text`,``,Ae()),M.addGetterSetter(z,`textDecoration`,``),M.addGetterSetter(z,`underlineOffset`,void 0,j()),M.addGetterSetter(z,`charRenderFunc`,void 0);var Ur=``,Wr=`normal`;function Gr(e){e.fillText(this.partialText,0,0)}function Kr(e){e.strokeText(this.partialText,0,0)}var B=class extends L{constructor(e){super(e),this.dummyCanvas=E.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on(`dataChange.konva`,function(){this._readDataAttribute(),this._setTextData()}),this.on(`textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva directionChange.konva`,this._setTextData),this._setTextData()}_getTextPathLength(){return Wn.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:Wn.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Wn.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();let t=this.textDecoration(),n=this.fill(),r=this.fontSize(),i=this.glyphInfo,a=t.indexOf(`underline`)!==-1,o=t.indexOf(`line-through`)!==-1;a&&e.beginPath();for(let t=0;t<i.length;t++){e.save();let n=i[t].p0;e.translate(n.x,n.y),e.rotate(i[t].rotation),this.partialText=i[t].text,e.fillStrokeShape(this),a&&(t===0&&e.moveTo(0,r/2+1),e.lineTo(i[t].width,r/2+1)),e.restore()}if(a&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),o){e.beginPath();for(let t=0;t<i.length;t++){e.save();let n=i[t].p0;e.translate(n.x,n.y),e.rotate(i[t].rotation),t===0&&e.moveTo(0,0),e.lineTo(i[t].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=r/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();let t=this.glyphInfo;if(t.length>=1){let n=t[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<t.length;n++){let r=t[n].p1;e.lineTo(r.x,r.y)}e.setAttr(`lineWidth`,this.fontSize()),e.setAttr(`strokeStyle`,this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return E.warn(`text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.`),this.textHeight}setText(e){return z.prototype.setText.call(this,e)}_getContextFont(){return z.prototype._getContextFont.call(this)}_getTextSize(e){let t=this.dummyCanvas.getContext(`2d`);t.save(),t.font=this._getContextFont();let n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){let e=dr(this.text());this.direction()===`rtl`&&e.reverse();let t=[],n=0;for(let r=0;r<e.length;r++)t.push({char:e[r],width:this._getTextSize(e[r]).width}),n+=t[r].width;let{width:r,height:i}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=i,this.glyphInfo=[],!this.attrs.data)return null;let a=this.letterSpacing(),o=this.align(),s=this.kerningFunc(),c=Math.max(0,n-r),l=Math.max(this.textWidth+((this.attrs.text||``).length-1)*a,0),u=0;o===`center`&&(u=Math.max(0,this.pathLength/2-l/2)),o===`right`&&(u=Math.max(0,this.pathLength-l));let d=u;for(let n=0;n<t.length;n++){let r=this._getPointAtLength(d);if(!r)return;let i=t[n].char,u=t[n].width+a;if(i===` `&&o===`justify`){let e=this.text().split(` `).length-1;u+=(this.pathLength-l)/e}let f=d+u,p=this._getPointAtLength(f>this.pathLength&&f-this.pathLength<=c?this.pathLength:f);if(!p)return;let m=Wn.getLineLength(r.x,r.y,p.x,p.y),h=0;if(s)try{h=s(t[n-1].char,i)*this.fontSize()}catch{h=0}r.x+=h,p.x+=h,this.textWidth+=h;let g=Wn.getPointOnLine(h+m/2,r.x,r.y,p.x,p.y),_=Math.atan2(p.y-r.y,p.x-r.x);this.glyphInfo.push({transposeX:g.x,transposeY:g.y,text:e[n],rotation:_,p0:r,p1:p,width:m}),d+=u}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};let e=[];this.glyphInfo.forEach(function(t){e.push(t.p0.x),e.push(t.p0.y),e.push(t.p1.x),e.push(t.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,i=e[1]||0,a,o;for(let s=0;s<e.length/2;s++)a=e[s*2],o=e[s*2+1],t=Math.min(t,a),n=Math.max(n,a),r=Math.min(r,o),i=Math.max(i,o);let s=this.fontSize();return{x:t-s/2,y:r-s/2,width:n-t+s,height:i-r+s}}destroy(){return E.releaseCanvas(this.dummyCanvas),super.destroy()}};B.prototype._fillFunc=Gr,B.prototype._strokeFunc=Kr,B.prototype._fillFuncHit=Gr,B.prototype._strokeFuncHit=Kr,B.prototype.className=`TextPath`,B.prototype._attrsAffectingSize=[`text`,`fontSize`,`data`],f(B),M.addGetterSetter(B,`data`),M.addGetterSetter(B,`fontFamily`,`Arial`),M.addGetterSetter(B,`fontSize`,12,j()),M.addGetterSetter(B,`fontStyle`,Wr),M.addGetterSetter(B,`align`,`left`),M.addGetterSetter(B,`letterSpacing`,0,j()),M.addGetterSetter(B,`textBaseline`,`middle`),M.addGetterSetter(B,`fontVariant`,Wr),M.addGetterSetter(B,`text`,Ur),M.addGetterSetter(B,`textDecoration`,``),M.addGetterSetter(B,`kerningFunc`,void 0),M.addGetterSetter(B,`direction`,`inherit`);var qr=`tr-konva`,Jr=[`resizeEnabledChange`,`rotateAnchorOffsetChange`,`rotateAnchorAngleChange`,`rotateEnabledChange`,`enabledAnchorsChange`,`anchorSizeChange`,`borderEnabledChange`,`borderStrokeChange`,`borderStrokeWidthChange`,`borderDashChange`,`anchorStrokeChange`,`anchorStrokeWidthChange`,`anchorFillChange`,`anchorCornerRadiusChange`,`ignoreStrokeChange`,`anchorStyleFuncChange`].map(e=>e+`.${qr}`).join(` `),Yr=`nodesRect`,Xr=[`widthChange`,`heightChange`,`scaleXChange`,`scaleYChange`,`skewXChange`,`skewYChange`,`rotationChange`,`offsetXChange`,`offsetYChange`,`transformsEnabledChange`,`strokeWidthChange`,`draggableChange`],Zr={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},Qr=`ontouchstart`in d._global;function $r(e,t,n){if(e===`rotater`)return n;t+=E.degToRad(Zr[e]||0);let r=(E.radToDeg(t)%360+360)%360;return E._inRange(r,337.5,360)||E._inRange(r,0,22.5)?`ns-resize`:E._inRange(r,22.5,67.5)?`nesw-resize`:E._inRange(r,67.5,112.5)?`ew-resize`:E._inRange(r,112.5,157.5)?`nwse-resize`:E._inRange(r,157.5,202.5)?`ns-resize`:E._inRange(r,202.5,247.5)?`nesw-resize`:E._inRange(r,247.5,292.5)?`ew-resize`:E._inRange(r,292.5,337.5)?`nwse-resize`:(E.error(`Transformer has unknown angle for cursor detection: `+r),`pointer`)}var ei=[`top-left`,`top-center`,`top-right`,`middle-right`,`middle-left`,`bottom-left`,`bottom-center`,`bottom-right`];function ti(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function ni(e,t,n){let r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:i}}function ri(e,t){return ni(e,t,ti(e))}function ii(e,t,n){let r=t;for(let i=0;i<e.length;i++){let a=d.getAngle(e[i]),o=Math.abs(a-t)%(Math.PI*2);Math.min(o,Math.PI*2-o)<n&&(r=a)}return r}var ai=0,V=class extends vn{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Jr,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return E.warn(`tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead.`),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return qr+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();let t=e.filter(e=>e.isAncestorOf(this)?(E.error(`Konva.Transformer cannot be an a child of the node you are trying to attach`),!1):!0);return this._nodes=e=t,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(e=>{let t=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(e._attrsAffectingSize.length){let n=e._attrsAffectingSize.map(e=>e+`Change.`+this._getEventNamespace()).join(` `);e.on(n,t)}e.on(Xr.map(e=>e+`.${this._getEventNamespace()}`).join(` `),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),this._proxyDrag(e)}),this._resetTransformCache(),this.findOne(`.top-left`)&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,n=>{t=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(`.back`)&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!t)return;let r=e.getAbsolutePosition(),i=r.x-t.x,a=r.y-t.y;this.nodes().forEach(t=>{if(t===e||t.isDragging())return;let r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+i,y:r.y+a}),t.startDrag(n)}),t=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(Yr),this._clearCache(`transform`),this._clearSelfAndDescendantCache(`absoluteTransform`)}_getNodeRect(){return this._getCache(Yr,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){let r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),i=e.getAbsoluteScale(n),a=e.getAbsolutePosition(n),o=r.x*i.x-e.offsetX()*i.x,s=r.y*i.y-e.offsetY()*i.y,c=(d.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return ni({x:a.x+o*Math.cos(c)+s*Math.sin(-c),y:a.y+s*Math.cos(c)+o*Math.sin(c),width:r.width*i.x,height:r.height*i.y,rotation:c},-d.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};let e=[];this.nodes().map(t=>{let n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=[{x:n.x,y:n.y},{x:n.x+n.width,y:n.y},{x:n.x+n.width,y:n.y+n.height},{x:n.x,y:n.y+n.height}],i=t.getAbsoluteTransform();r.forEach(function(t){let n=i.point(t);e.push(n)})});let t=new h;t.rotate(-d.getAngle(this.rotation()));let n=1/0,r=1/0,i=-1/0,a=-1/0;e.forEach(function(e){let o=t.point(e);n===void 0&&(n=i=o.x,r=a=o.y),n=Math.min(n,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),a=Math.max(a,o.y)}),t.invert();let o=t.point({x:n,y:r});return{x:o.x,y:o.y,width:i-n,height:a-r,rotation:d.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(),ei.forEach(e=>{this._createAnchor(e)}),this._createAnchor(`rotater`),this._elementsCreated=!0}_createAnchor(e){let t=new ar({stroke:`rgb(0, 161, 255)`,fill:`white`,strokeWidth:1,name:e+` _anchor`,dragDistance:0,draggable:!0,hitStrokeWidth:Qr?10:`auto`}),n=this;t.on(`mousedown touchstart`,function(e){n._handleMouseDown(e)}),t.on(`dragstart`,e=>{t.stopDrag(),e.cancelBubble=!0}),t.on(`dragend`,e=>{e.cancelBubble=!0}),t.on(`mouseenter`,()=>{let n=$r(e,d.getAngle(this.rotation()),this.rotateAnchorCursor());t.getStage().content&&(t.getStage().content.style.cursor=n),this._cursorChange=!0}),t.on(`mouseout`,()=>{t.getStage().content&&(t.getStage().content.style.cursor=``),this._cursorChange=!1}),this.add(t)}_createBack(){let e=new L({name:`back`,width:0,height:0,sceneFunc(e,t){let n=t.getParent(),r=n.padding(),i=t.width(),a=t.height();if(e.beginPath(),e.rect(-r,-r,i+r*2,a+r*2),n.rotateEnabled()&&n.rotateLineVisible()){let t=n.rotateAnchorAngle(),r=n.rotateAnchorOffset(),o=E.degToRad(t),s=Math.sin(o),c=-Math.cos(o),l=i/2,u=a/2,d=1/0;c<0?d=Math.min(d,-u/c):c>0&&(d=Math.min(d,(a-u)/c)),s<0?d=Math.min(d,-l/s):s>0&&(d=Math.min(d,(i-l)/s));let f=l+s*d,p=u+c*d,m=E._sign(a),h=f+s*r*m,g=p+c*r*m;e.moveTo(f,p),e.lineTo(h,g)}e.fillStrokeShape(t)},hitFunc:(e,t)=>{if(!this.shouldOverdrawWholeArea())return;let n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+n*2,t.height()+n*2),e.fillStrokeShape(t)}});this.add(e),this._proxyDrag(e),e.on(`dragstart`,e=>{e.cancelBubble=!0}),e.on(`dragmove`,e=>{e.cancelBubble=!0}),e.on(`dragend`,e=>{e.cancelBubble=!0}),this.on(`dragmove`,e=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(` `)[0];let t=this._getNodeRect(),n=t.width,r=t.height,i=Math.sqrt(n**2+r**2);this.sin=Math.abs(r/i),this.cos=Math.abs(n/i),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;let a=e.target.getAbsolutePosition(),o=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:o.x-a.x,y:o.y-a.y},ai++,this._fire(`transformstart`,{evt:e.evt,target:this.getNode()}),this._nodes.forEach(t=>{t._fire(`transformstart`,{evt:e.evt,target:t})})}_handleMouseMove(e){let t,n,r,i=this.findOne(`.`+this._movingAnchorName),a=i.getStage();a.setPointersPositions(e);let o=a.getPointerPosition(),s={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y},c=i.getAbsolutePosition();this.anchorDragBoundFunc()&&(s=this.anchorDragBoundFunc()(c,s,e)),i.setAbsolutePosition(s);let l=i.getAbsolutePosition();if(c.x===l.x&&c.y===l.y)return;if(this._movingAnchorName===`rotater`){let r=this._getNodeRect();t=i.x()-r.width/2,n=-i.y()+r.height/2;let a=d.getAngle(this.rotateAnchorAngle()),o=Math.atan2(-n,t)+Math.PI/2-a;r.height<0&&(o-=Math.PI);let s=d.getAngle(this.rotation())+o,c=d.getAngle(this.rotationSnapTolerance()),l=ri(r,ii(this.rotationSnaps(),s,c)-r.rotation);this._fitNodesInto(l,e);return}let u=this.shiftBehavior(),f;f=u===`inverted`?this.keepRatio()&&!e.shiftKey:u===`none`?this.keepRatio():this.keepRatio()||e.shiftKey;let p=this.centeredScaling()||e.altKey;if(this._movingAnchorName===`top-left`){if(f){let e=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.bottom-right`).x(),y:this.findOne(`.bottom-right`).y()};r=Math.sqrt((e.x-i.x())**2+(e.y-i.y())**2);let a=this.findOne(`.top-left`).x()>e.x?-1:1,o=this.findOne(`.top-left`).y()>e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this.findOne(`.top-left`).x(e.x-t),this.findOne(`.top-left`).y(e.y-n)}}else if(this._movingAnchorName===`top-center`)this.findOne(`.top-left`).y(i.y());else if(this._movingAnchorName===`top-right`){if(f){let e=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.bottom-left`).x(),y:this.findOne(`.bottom-left`).y()};r=Math.sqrt((i.x()-e.x)**2+(e.y-i.y())**2);let a=this.findOne(`.top-right`).x()<e.x?-1:1,o=this.findOne(`.top-right`).y()>e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this.findOne(`.top-right`).x(e.x+t),this.findOne(`.top-right`).y(e.y-n)}var m=i.position();this.findOne(`.top-left`).y(m.y),this.findOne(`.bottom-right`).x(m.x)}else if(this._movingAnchorName===`middle-left`)this.findOne(`.top-left`).x(i.x());else if(this._movingAnchorName===`middle-right`)this.findOne(`.bottom-right`).x(i.x());else if(this._movingAnchorName===`bottom-left`){if(f){let e=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.top-right`).x(),y:this.findOne(`.top-right`).y()};r=Math.sqrt((e.x-i.x())**2+(i.y()-e.y)**2);let a=e.x<i.x()?-1:1,o=i.y()<e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,i.x(e.x-t),i.y(e.y+n)}m=i.position(),this.findOne(`.top-left`).x(m.x),this.findOne(`.bottom-right`).y(m.y)}else if(this._movingAnchorName===`bottom-center`)this.findOne(`.bottom-right`).y(i.y());else if(this._movingAnchorName===`bottom-right`){if(f){let e=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(`.top-left`).x(),y:this.findOne(`.top-left`).y()};r=Math.sqrt((i.x()-e.x)**2+(i.y()-e.y)**2);let a=this.findOne(`.bottom-right`).x()<e.x?-1:1,o=this.findOne(`.bottom-right`).y()<e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this.findOne(`.bottom-right`).x(e.x+t),this.findOne(`.bottom-right`).y(e.y+n)}}else console.error(Error(`Wrong position argument of selection resizer: `+this._movingAnchorName));if(p=this.centeredScaling()||e.altKey,p){let e=this.findOne(`.top-left`),t=this.findOne(`.bottom-right`),n=e.x(),r=e.y(),i=this.getWidth()-t.x(),a=this.getHeight()-t.y();t.move({x:-n,y:-r}),e.move({x:i,y:a})}let h=this.findOne(`.top-left`).getAbsolutePosition();t=h.x,n=h.y;let g=this.findOne(`.bottom-right`).x()-this.findOne(`.top-left`).x(),_=this.findOne(`.bottom-right`).y()-this.findOne(`.top-left`).y();this._fitNodesInto({x:t,y:n,width:g,height:_,rotation:d.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var t;if(this._transforming){this._transforming=!1,typeof window<`u`&&(window.removeEventListener(`mousemove`,this._handleMouseMove),window.removeEventListener(`touchmove`,this._handleMouseMove),window.removeEventListener(`mouseup`,this._handleMouseUp,!0),window.removeEventListener(`touchend`,this._handleMouseUp,!0));let n=this.getNode();ai--,this._fire(`transformend`,{evt:e,target:n}),(t=this.getLayer())==null||t.batchDraw(),n&&this._nodes.forEach(t=>{var n;t._fire(`transformend`,{evt:e,target:t}),(n=t.getLayer())==null||n.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,t){let n=this._getNodeRect();if(E._inRange(e.width,-this.padding()*2-1,1)){this.update();return}if(E._inRange(e.height,-this.padding()*2-1,1)){this.update();return}let r=new h;if(r.rotate(d.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`left`)>=0){let t=r.point({x:-this.padding()*2,y:0});e.x+=t.x,e.y+=t.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace(`left`,`right`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`right`)>=0){let t=r.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace(`right`,`left`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`top`)>=0){let t=r.point({x:0,y:-this.padding()*2});e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace(`top`,`bottom`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`bottom`)>=0){let t=r.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace(`bottom`,`top`),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){let t=this.boundBoxFunc()(n,e);t?e=t:E.warn(`boundBoxFunc returned falsy. You should return new bound rect from it!`)}let i=1e7,a=new h;a.translate(n.x,n.y),a.rotate(n.rotation),a.scale(n.width/i,n.height/i);let o=new h,s=e.width/i,c=e.height/i;this.flipEnabled()===!1?(o.translate(e.x,e.y),o.rotate(e.rotation),o.translate(e.width<0?e.width:0,e.height<0?e.height:0),o.scale(Math.abs(s),Math.abs(c))):(o.translate(e.x,e.y),o.rotate(e.rotation),o.scale(s,c));let l=o.multiply(a.invert());this._nodes.forEach(e=>{var t;if(!e.getStage())return;let n=e.getParent().getAbsoluteTransform(),r=e.getTransform().copy();r.translate(e.offsetX(),e.offsetY());let i=new h;i.multiply(n.copy().invert()).multiply(l).multiply(n).multiply(r);let a=i.decompose();e.setAttrs(a),(t=e.getLayer())==null||t.batchDraw()}),this.rotation(E._getRotation(e.rotation)),this._nodes.forEach(e=>{this._fire(`transform`,{evt:t,target:e}),e._fire(`transform`,{evt:t,target:e})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e;let t=this._getNodeRect();this.rotation(E._getRotation(t.rotation));let n=t.width,r=t.height,i=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),s=this.anchorSize(),c=this.find(`._anchor`);c.forEach(e=>{e.setAttrs({width:s,height:s,offsetX:s/2,offsetY:s/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(`.top-left`,{x:0,y:0,offsetX:s/2+o,offsetY:s/2+o,visible:a&&i.indexOf(`top-left`)>=0}),this._batchChangeChild(`.top-center`,{x:n/2,y:0,offsetY:s/2+o,visible:a&&i.indexOf(`top-center`)>=0}),this._batchChangeChild(`.top-right`,{x:n,y:0,offsetX:s/2-o,offsetY:s/2+o,visible:a&&i.indexOf(`top-right`)>=0}),this._batchChangeChild(`.middle-left`,{x:0,y:r/2,offsetX:s/2+o,visible:a&&i.indexOf(`middle-left`)>=0}),this._batchChangeChild(`.middle-right`,{x:n,y:r/2,offsetX:s/2-o,visible:a&&i.indexOf(`middle-right`)>=0}),this._batchChangeChild(`.bottom-left`,{x:0,y:r,offsetX:s/2+o,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-left`)>=0}),this._batchChangeChild(`.bottom-center`,{x:n/2,y:r,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-center`)>=0}),this._batchChangeChild(`.bottom-right`,{x:n,y:r,offsetX:s/2-o,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-right`)>=0});let l=this.rotateAnchorAngle(),u=this.rotateAnchorOffset(),d=E.degToRad(l),f=Math.sin(d),p=-Math.cos(d),m=n/2,h=r/2,g=1/0;p<0?g=Math.min(g,-h/p):p>0&&(g=Math.min(g,(r-h)/p)),f<0?g=Math.min(g,-m/f):f>0&&(g=Math.min(g,(n-m)/f));let _=m+f*g,v=h+p*g,y=E._sign(r);this._batchChangeChild(`.rotater`,{x:_+f*u*y,y:v+p*u*y-o*p,visible:this.rotateEnabled()}),this._batchChangeChild(`.back`,{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(e=>e.draggable()),x:0,y:0});let b=this.anchorStyleFunc();b&&c.forEach(e=>{b(e)}),(e=this.getLayer())==null||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();let e=this.findOne(`.`+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=``),vn.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(E.error(`You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead.`),this):super.add(...e)}toObject(){return N.prototype.toObject.call(this)}clone(e){return N.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};V.isTransforming=()=>ai>0;function oi(e){return e instanceof Array||E.warn(`enabledAnchors value should be an array`),e instanceof Array&&e.forEach(function(e){ei.indexOf(e)===-1&&E.warn(`Unknown anchor name: `+e+`. Available names are: `+ei.join(`, `))}),e||[]}V.prototype.className=`Transformer`,f(V),M.addGetterSetter(V,`enabledAnchors`,ei,oi),M.addGetterSetter(V,`flipEnabled`,!0,Ne()),M.addGetterSetter(V,`resizeEnabled`,!0),M.addGetterSetter(V,`anchorSize`,10,j()),M.addGetterSetter(V,`rotateEnabled`,!0),M.addGetterSetter(V,`rotateLineVisible`,!0),M.addGetterSetter(V,`rotationSnaps`,[]),M.addGetterSetter(V,`rotateAnchorOffset`,50,j()),M.addGetterSetter(V,`rotateAnchorAngle`,0,j()),M.addGetterSetter(V,`rotateAnchorCursor`,`crosshair`),M.addGetterSetter(V,`rotationSnapTolerance`,5,j()),M.addGetterSetter(V,`borderEnabled`,!0),M.addGetterSetter(V,`anchorStroke`,`rgb(0, 161, 255)`),M.addGetterSetter(V,`anchorStrokeWidth`,1,j()),M.addGetterSetter(V,`anchorFill`,`white`),M.addGetterSetter(V,`anchorCornerRadius`,0,j()),M.addGetterSetter(V,`borderStroke`,`rgb(0, 161, 255)`),M.addGetterSetter(V,`borderStrokeWidth`,1,j()),M.addGetterSetter(V,`borderDash`),M.addGetterSetter(V,`keepRatio`,!0),M.addGetterSetter(V,`shiftBehavior`,`default`),M.addGetterSetter(V,`centeredScaling`,!1),M.addGetterSetter(V,`ignoreStroke`,!1),M.addGetterSetter(V,`padding`,0,j()),M.addGetterSetter(V,`nodes`),M.addGetterSetter(V,`node`),M.addGetterSetter(V,`boundBoxFunc`),M.addGetterSetter(V,`anchorDragBoundFunc`),M.addGetterSetter(V,`anchorStyleFunc`),M.addGetterSetter(V,`shouldOverdrawWholeArea`,!1),M.addGetterSetter(V,`useSingleNodeRotation`,!0),M.backCompat(V,{lineEnabled:`borderEnabled`,rotateHandlerOffset:`rotateAnchorOffset`,enabledHandlers:`enabledAnchors`});var si=class extends L{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,d.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)}};si.prototype.className=`Wedge`,si.prototype._centroid=!0,si.prototype._attrsAffectingSize=[`radius`],f(si),M.addGetterSetter(si,`radius`,0,j()),M.addGetterSetter(si,`angle`,0,j()),M.addGetterSetter(si,`clockwise`,!1),M.backCompat(si,{angleDeg:`angle`,getAngleDeg:`getAngle`,setAngleDeg:`setAngle`});function ci(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var li=[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],ui=[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 di(e,t){let n=e.data,r=e.width,i=e.height,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,ee=t+t+1,te=r-1,ne=i-1,T=t+1,re=T*(T+1)/2,ie=new ci,ae=li[t],oe=ui[t],E=null,D=ie,O=null,k=null;for(let e=1;e<ee;e++)D=D.next=new ci,e===T&&(E=D);D.next=ie,s=o=0;for(let e=0;e<i;e++){g=_=v=y=c=l=u=d=0,f=T*(b=n[o]),p=T*(x=n[o+1]),m=T*(S=n[o+2]),h=T*(C=n[o+3]),c+=re*b,l+=re*x,u+=re*S,d+=re*C,D=ie;for(let e=0;e<T;e++)D.r=b,D.g=x,D.b=S,D.a=C,D=D.next;for(let e=1;e<T;e++)a=o+((te<e?te:e)<<2),c+=(D.r=b=n[a])*(w=T-e),l+=(D.g=x=n[a+1])*w,u+=(D.b=S=n[a+2])*w,d+=(D.a=C=n[a+3])*w,g+=b,_+=x,v+=S,y+=C,D=D.next;O=ie,k=E;for(let e=0;e<r;e++)n[o+3]=C=d*ae>>oe,C===0?n[o]=n[o+1]=n[o+2]=0:(C=255/C,n[o]=(c*ae>>oe)*C,n[o+1]=(l*ae>>oe)*C,n[o+2]=(u*ae>>oe)*C),c-=f,l-=p,u-=m,d-=h,f-=O.r,p-=O.g,m-=O.b,h-=O.a,a=s+((a=e+t+1)<te?a:te)<<2,g+=O.r=n[a],_+=O.g=n[a+1],v+=O.b=n[a+2],y+=O.a=n[a+3],c+=g,l+=_,u+=v,d+=y,O=O.next,f+=b=k.r,p+=x=k.g,m+=S=k.b,h+=C=k.a,g-=b,_-=x,v-=S,y-=C,k=k.next,o+=4;s+=r}for(let e=0;e<r;e++){_=v=y=g=l=u=d=c=0,o=e<<2,f=T*(b=n[o]),p=T*(x=n[o+1]),m=T*(S=n[o+2]),h=T*(C=n[o+3]),c+=re*b,l+=re*x,u+=re*S,d+=re*C,D=ie;for(let e=0;e<T;e++)D.r=b,D.g=x,D.b=S,D.a=C,D=D.next;let s=r;for(let i=1;i<=t;i++)o=s+e<<2,c+=(D.r=b=n[o])*(w=T-i),l+=(D.g=x=n[o+1])*w,u+=(D.b=S=n[o+2])*w,d+=(D.a=C=n[o+3])*w,g+=b,_+=x,v+=S,y+=C,D=D.next,i<ne&&(s+=r);o=e,O=ie,k=E;for(let t=0;t<i;t++)a=o<<2,n[a+3]=C=d*ae>>oe,C>0?(C=255/C,n[a]=(c*ae>>oe)*C,n[a+1]=(l*ae>>oe)*C,n[a+2]=(u*ae>>oe)*C):n[a]=n[a+1]=n[a+2]=0,c-=f,l-=p,u-=m,d-=h,f-=O.r,p-=O.g,m-=O.b,h-=O.a,a=e+((a=t+T)<ne?a:ne)*r<<2,c+=g+=O.r=n[a],l+=_+=O.g=n[a+1],u+=v+=O.b=n[a+2],d+=y+=O.a=n[a+3],O=O.next,f+=b=k.r,p+=x=k.g,m+=S=k.b,h+=C=k.a,g-=b,_-=x,v-=S,y-=C,k=k.next,o+=r}}var fi=function(e){let t=Math.round(this.blurRadius());t>0&&di(e,t)};M.addGetterSetter(N,`blurRadius`,0,j(),M.afterSetFilter);var pi=function(e){let t=this.brightness()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]+=t,n[e+1]+=t,n[e+2]+=t};M.addGetterSetter(N,`brightness`,0,j(),M.afterSetFilter);var mi=function(e){let t=this.brightness(),n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]=Math.min(255,n[e]*t),n[e+1]=Math.min(255,n[e+1]*t),n[e+2]=Math.min(255,n[e+2]*t)},hi=function(e){let t=((this.contrast()+100)/100)**2,n=e.data,r=n.length,i=150,a=150,o=150;for(let e=0;e<r;e+=4)i=n[e],a=n[e+1],o=n[e+2],i/=255,i-=.5,i*=t,i+=.5,i*=255,a/=255,a-=.5,a*=t,a+=.5,a*=255,o/=255,o-=.5,o*=t,o+=.5,o*=255,i=i<0?0:i>255?255:i,a=a<0?0:a>255?255:a,o=o<0?0:o>255?255:o,n[e]=i,n[e+1]=a,n[e+2]=o};M.addGetterSetter(N,`contrast`,0,j(),M.afterSetFilter);var gi=function(e){let t=e.data,n=e.width,r=e.height,i=Math.min(1,Math.max(0,this.embossStrength?.call(this)??.5)),a=Math.min(1,Math.max(0,this.embossWhiteLevel?.call(this)??.5)),o={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[this.embossDirection?.call(this)??`top-left`]??315,s=!!(this.embossBlend?.call(this)??!1),c=i*10,l=a*255,u=o*Math.PI/180,d=Math.cos(u),f=Math.sin(u),p=128/1020*c,m=new Uint8ClampedArray(t),h=new Float32Array(n*r);for(let e=0,n=0;n<t.length;n+=4,e++)h[e]=.2126*m[n]+.7152*m[n+1]+.0722*m[n+2];let g=[-1,0,1,-2,0,2,-1,0,1],_=[-1,-2,-1,0,0,0,1,2,1],v=[-n-1,-n,-n+1,-1,0,1,n-1,n,n+1],y=e=>e<0?0:e>255?255:e;for(let e=1;e<r-1;e++)for(let r=1;r<n-1;r++){let i=e*n+r,a=0,o=0;a+=h[i+v[0]]*g[0],o+=h[i+v[0]]*_[0],a+=h[i+v[1]]*g[1],o+=h[i+v[1]]*_[1],a+=h[i+v[2]]*g[2],o+=h[i+v[2]]*_[2],a+=h[i+v[3]]*g[3],o+=h[i+v[3]]*_[3],a+=h[i+v[5]]*g[5],o+=h[i+v[5]]*_[5],a+=h[i+v[6]]*g[6],o+=h[i+v[6]]*_[6],a+=h[i+v[7]]*g[7],o+=h[i+v[7]]*_[7],a+=h[i+v[8]]*g[8],o+=h[i+v[8]]*_[8];let c=y(l+(d*a+f*o)*p),u=i*4;if(s){let e=c-l;t[u]=y(m[u]+e),t[u+1]=y(m[u+1]+e),t[u+2]=y(m[u+2]+e),t[u+3]=m[u+3]}else t[u]=t[u+1]=t[u+2]=c,t[u+3]=m[u+3]}for(let e=0;e<n;e++){let i=e*4,a=((r-1)*n+e)*4;t[i]=m[i],t[i+1]=m[i+1],t[i+2]=m[i+2],t[i+3]=m[i+3],t[a]=m[a],t[a+1]=m[a+1],t[a+2]=m[a+2],t[a+3]=m[a+3]}for(let e=1;e<r-1;e++){let r=e*n*4,i=(e*n+(n-1))*4;t[r]=m[r],t[r+1]=m[r+1],t[r+2]=m[r+2],t[r+3]=m[r+3],t[i]=m[i],t[i+1]=m[i+1],t[i+2]=m[i+2],t[i+3]=m[i+3]}return e};M.addGetterSetter(N,`embossStrength`,.5,j(),M.afterSetFilter),M.addGetterSetter(N,`embossWhiteLevel`,.5,j(),M.afterSetFilter),M.addGetterSetter(N,`embossDirection`,`top-left`,void 0,M.afterSetFilter),M.addGetterSetter(N,`embossBlend`,!1,void 0,M.afterSetFilter);function _i(e,t,n,r,i){let a=n-t,o=i-r;if(a===0)return r+o/2;if(o===0)return r;let s=(e-t)/a;return s=o*s+r,s}var vi=function(e){let t=e.data,n=t.length,r=t[0],i=r,a,o=t[1],s=o,c,l=t[2],u=l,d,f=this.enhance();if(f===0)return;for(let e=0;e<n;e+=4)a=t[e+0],a<r?r=a:a>i&&(i=a),c=t[e+1],c<o?o=c:c>s&&(s=c),d=t[e+2],d<l?l=d:d>u&&(u=d);i===r&&(i=255,r=0),s===o&&(s=255,o=0),u===l&&(u=255,l=0);let p,m,h,g,_,v;if(f>0)p=i+f*(255-i),m=r-f*(r-0),h=s+f*(255-s),g=o-f*(o-0),_=u+f*(255-u),v=l-f*(l-0);else{let e=(i+r)*.5;p=i+f*(i-e),m=r+f*(r-e);let t=(s+o)*.5;h=s+f*(s-t),g=o+f*(o-t);let n=(u+l)*.5;_=u+f*(u-n),v=l+f*(l-n)}for(let e=0;e<n;e+=4)t[e+0]=_i(t[e+0],r,i,m,p),t[e+1]=_i(t[e+1],o,s,g,h),t[e+2]=_i(t[e+2],l,u,v,_)};M.addGetterSetter(N,`enhance`,0,j(),M.afterSetFilter);var yi=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=.34*t[e]+.5*t[e+1]+.16*t[e+2];t[e]=n,t[e+1]=n,t[e+2]=n}};M.addGetterSetter(N,`hue`,0,j(),M.afterSetFilter),M.addGetterSetter(N,`saturation`,0,j(),M.afterSetFilter),M.addGetterSetter(N,`luminance`,0,j(),M.afterSetFilter);var bi=function(e){let t=e.data,n=t.length,r=2**this.saturation(),i=Math.abs(this.hue()+360)%360,a=this.luminance()*127,o=1*r*Math.cos(i*Math.PI/180),s=1*r*Math.sin(i*Math.PI/180),c=.299*1+.701*o+.167*s,l=.587*1-.587*o+.33*s,u=.114*1-.114*o-.497*s,d=.299*1-.299*o-.328*s,f=.587*1+.413*o+.035*s,p=.114*1-.114*o+.293*s,m=.299*1-.3*o+1.25*s,h=.587*1-.586*o-1.05*s,g=.114*1+.886*o-.2*s,_,v,y,b;for(let e=0;e<n;e+=4)_=t[e+0],v=t[e+1],y=t[e+2],b=t[e+3],t[e+0]=c*_+l*v+u*y+a,t[e+1]=d*_+f*v+p*y+a,t[e+2]=m*_+h*v+g*y+a,t[e+3]=b},xi=function(e){let t=e.data,n=t.length,r=2**this.value(),i=2**this.saturation(),a=Math.abs(this.hue()+360)%360,o=r*i*Math.cos(a*Math.PI/180),s=r*i*Math.sin(a*Math.PI/180),c=.299*r+.701*o+.167*s,l=.587*r-.587*o+.33*s,u=.114*r-.114*o-.497*s,d=.299*r-.299*o-.328*s,f=.587*r+.413*o+.035*s,p=.114*r-.114*o+.293*s,m=.299*r-.3*o+1.25*s,h=.587*r-.586*o-1.05*s,g=.114*r+.886*o-.2*s;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],i=t[e+2],a=t[e+3];t[e+0]=c*n+l*r+u*i,t[e+1]=d*n+f*r+p*i,t[e+2]=m*n+h*r+g*i,t[e+3]=a}};M.addGetterSetter(N,`hue`,0,j(),M.afterSetFilter),M.addGetterSetter(N,`saturation`,0,j(),M.afterSetFilter),M.addGetterSetter(N,`value`,0,j(),M.afterSetFilter);var Si=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4)t[e]=255-t[e],t[e+1]=255-t[e+1],t[e+2]=255-t[e+2]},Ci=function(e,t,n){let r=e.data,i=t.data,a=e.width,o=e.height,s=n.polarCenterX||a/2,c=n.polarCenterY||o/2,l=Math.sqrt(s*s+c*c),u=a-s,d=o-c,f=Math.sqrt(u*u+d*d);l=f>l?f:l;let p=o,m=a,h=360/m*Math.PI/180;for(let e=0;e<m;e+=1){let t=Math.sin(e*h),n=Math.cos(e*h);for(let o=0;o<p;o+=1){u=Math.floor(s+l*o/p*n),d=Math.floor(c+l*o/p*t);let f=(d*a+u)*4,m=r[f+0],h=r[f+1],g=r[f+2],_=r[f+3];f=(e+o*a)*4,i[f+0]=m,i[f+1]=h,i[f+2]=g,i[f+3]=_}}},wi=function(e,t,n){let r=e.data,i=t.data,a=e.width,o=e.height,s=n.polarCenterX||a/2,c=n.polarCenterY||o/2,l=Math.sqrt(s*s+c*c),u=a-s,d=o-c,f=Math.sqrt(u*u+d*d);l=f>l?f:l;let p=o,m=a,h=n.polarRotation||0,g,_;for(u=0;u<a;u+=1)for(d=0;d<o;d+=1){let e=u-s,t=d-c,n=Math.sqrt(e*e+t*t)*p/l,o=(Math.atan2(t,e)*180/Math.PI+360+h)%360;o=o*m/360,g=Math.floor(o),_=Math.floor(n);let f=(_*a+g)*4,v=r[f+0],y=r[f+1],b=r[f+2],x=r[f+3];f=(d*a+u)*4,i[f+0]=v,i[f+1]=y,i[f+2]=b,i[f+3]=x}},Ti=function(e){let t=e.width,n=e.height,r,i,a,o,s,c,l,u,d,f,p=Math.round(this.kaleidoscopePower()),m=Math.round(this.kaleidoscopeAngle()),h=Math.floor(m%360*t/360);if(p<1)return;let g=E.createCanvasElement();g.width=t,g.height=n;let _=g.getContext(`2d`).getImageData(0,0,t,n);E.releaseCanvas(g),Ci(e,_,{polarCenterX:t/2,polarCenterY:n/2});let v=t/2**p;for(;v<=8;)v*=2,--p;v=Math.ceil(v);let y=v,b=0,x=y,S=1;for(h+v>t&&(b=y,x=0,S=-1),i=0;i<n;i+=1)for(r=b;r!==x;r+=S)a=Math.round(r+h)%t,d=(t*i+a)*4,s=_.data[d+0],c=_.data[d+1],l=_.data[d+2],u=_.data[d+3],f=(t*i+r)*4,_.data[f+0]=s,_.data[f+1]=c,_.data[f+2]=l,_.data[f+3]=u;for(i=0;i<n;i+=1)for(y=Math.floor(v),o=0;o<p;o+=1){for(r=0;r<y+1;r+=1)d=(t*i+r)*4,s=_.data[d+0],c=_.data[d+1],l=_.data[d+2],u=_.data[d+3],f=(t*i+y*2-r-1)*4,_.data[f+0]=s,_.data[f+1]=c,_.data[f+2]=l,_.data[f+3]=u;y*=2}wi(_,e,{polarRotation:0})};M.addGetterSetter(N,`kaleidoscopePower`,2,j(),M.afterSetFilter),M.addGetterSetter(N,`kaleidoscopeAngle`,0,j(),M.afterSetFilter);function Ei(e,t,n){let r=(n*e.width+t)*4,i=[];return i.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),i}function Di(e,t){return Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2)}function Oi(e){let t=[0,0,0];for(let n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}function ki(e,t){let n=Ei(e,0,0),r=Ei(e,e.width-1,0),i=Ei(e,0,e.height-1),a=Ei(e,e.width-1,e.height-1),o=t||10;if(Di(n,r)<o&&Di(r,a)<o&&Di(a,i)<o&&Di(i,n)<o){let t=Oi([r,n,a,i]),s=[];for(let n=0;n<e.width*e.height;n++)s[n]=Di(t,[e.data[n*4],e.data[n*4+1],e.data[n*4+2]])<o?0:255;return s}}function Ai(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function ji(e,t,n){let r=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u===2040?255:0}return o}function Mi(e,t,n){let r=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u>=1020?255:0}return o}function Ni(e,t,n){let r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u}return o}M.addGetterSetter(N,`threshold`,0,j(),M.afterSetFilter),M.addGetterSetter(N,`noise`,.2,j(),M.afterSetFilter),M.addGetterSetter(N,`pixelSize`,8,j(),M.afterSetFilter),M.addGetterSetter(N,`levels`,.5,j(),M.afterSetFilter),M.addGetterSetter(N,`red`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),M.addGetterSetter(N,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),M.addGetterSetter(N,`blue`,0,De,M.afterSetFilter),M.addGetterSetter(N,`red`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),M.addGetterSetter(N,`green`,0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),M.addGetterSetter(N,`blue`,0,De,M.afterSetFilter),M.addGetterSetter(N,`alpha`,1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e}),M.addGetterSetter(N,`threshold`,.5,j(),M.afterSetFilter),An.Util._assign(An,{Arc:jn,Arrow:Gn,Circle:Kn,Ellipse:qn,Image:Jn,Label:rr,Tag:ir,Line:Fn,Path:Wn,Rect:ar,RegularPolygon:or,Ring:cr,Sprite:lr,Star:ur,Text:z,TextPath:B,Transformer:V,Wedge:si,Filters:{Blur:fi,Brightness:mi,Brighten:pi,Contrast:hi,Emboss:gi,Enhance:vi,Grayscale:yi,HSL:bi,HSV:xi,Invert:Si,Kaleidoscope:Ti,Mask:function(e){let t=ki(e,this.threshold());return t&&(t=ji(t,e.width,e.height),t=Mi(t,e.width,e.height),t=Ni(t,e.width,e.height),Ai(e,t)),e},Noise:function(e){let t=this.noise()*255,n=e.data,r=n.length,i=t/2;for(let e=0;e<r;e+=4)n[e+0]+=i-2*i*Math.random(),n[e+1]+=i-2*i*Math.random(),n[e+2]+=i-2*i*Math.random()},Pixelate:function(e){let t=Math.ceil(this.pixelSize()),n=e.width,r=e.height,i=Math.ceil(n/t),a=Math.ceil(r/t),o=e.data;if(t<=0){E.error(`pixelSize value can not be <= 0`);return}for(let e=0;e<i;e+=1)for(let i=0;i<a;i+=1){let a=0,s=0,c=0,l=0,u=e*t,d=u+t,f=i*t,p=f+t,m=0;for(let e=u;e<d;e+=1)if(!(e>=n))for(let t=f;t<p;t+=1){if(t>=r)continue;let i=(n*t+e)*4;a+=o[i+0],s+=o[i+1],c+=o[i+2],l+=o[i+3],m+=1}a/=m,s/=m,c/=m,l/=m;for(let e=u;e<d;e+=1)if(!(e>=n))for(let t=f;t<p;t+=1){if(t>=r)continue;let i=(n*t+e)*4;o[i+0]=a,o[i+1]=s,o[i+2]=c,o[i+3]=l}}},Posterize:function(e){let t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t;for(let e=0;e<r;e+=1)n[e]=Math.floor(n[e]/i)*i},RGB:function(e){let t=e.data,n=t.length,r=this.red(),i=this.green(),a=this.blue();for(let e=0;e<n;e+=4){let n=(.34*t[e]+.5*t[e+1]+.16*t[e+2])/255;t[e]=n*r,t[e+1]=n*i,t[e+2]=n*a,t[e+3]=t[e+3]}},RGBA:function(e){let t=e.data,n=t.length,r=this.red(),i=this.green(),a=this.blue(),o=this.alpha();for(let e=0;e<n;e+=4){let n=1-o;t[e]=r*o+t[e]*n,t[e+1]=i*o+t[e+1]*n,t[e+2]=a*o+t[e+2]*n}},Sepia:function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],i=t[e+2];t[e+0]=Math.min(255,n*.393+r*.769+i*.189),t[e+1]=Math.min(255,n*.349+r*.686+i*.168),t[e+2]=Math.min(255,n*.272+r*.534+i*.131)}},Solarize:function(e){let t=e.data;for(let e=0;e<t.length;e+=4){let n=t[e],r=t[e+1],i=t[e+2];.2126*n+.7152*r+.0722*i>=128&&(t[e]=255-n,t[e+1]=255-r,t[e+2]=255-i)}return e},Threshold:function(e){let t=this.threshold()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=1)n[e]=n[e]<t?0:255}}});var Pi=An,Fi=i(((e,n)=>{n.exports=function(e){function n(e,t,n,r){return new pa(e,t,n,r)}function r(){}function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(o(e)!==e)throw Error(i(188))}function c(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var c=a.alternate;if(c===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===c.child){for(c=a.child;c;){if(c===n)return s(a),e;if(c===r)return s(a),t;c=c.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=c;else{for(var l=!1,u=a.child;u;){if(u===n){l=!0,n=a,r=c;break}if(u===r){l=!0,r=a,n=c;break}u=u.sibling}if(!l){for(u=c.child;u;){if(u===n){l=!0,n=c,r=a;break}if(u===r){l=!0,r=c,n=a;break}u=u.sibling}if(!l)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function l(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=l(e),t!==null)return t;e=e.sibling}return null}function u(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(e.tag!==4&&(t=u(e),t!==null))return t;e=e.sibling}return null}function d(e){return typeof e!=`object`||!e?null:(e=qa&&e[qa]||e[`@@iterator`],typeof e==`function`?e:null)}function f(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===Ja?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case Fa:return`Fragment`;case La:return`Profiler`;case Ia:return`StrictMode`;case Va:return`Suspense`;case Ha:return`SuspenseList`;case Ga:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case Pa:return`Portal`;case za:return e.displayName||`Context`;case Ra:return(e._context.displayName||`Context`)+`.Consumer`;case Ba:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case Ua:return t=e.displayName||null,t===null?f(e.type)||`Memo`:t;case Wa:t=e._payload,e=e._init;try{return f(e(t))}catch{}}return null}function p(e){return{current:e}}function m(e){0>hc||(e.current=mc[hc],mc[hc]=null,hc--)}function h(e,t){hc++,mc[hc]=e.current,e.current=t}function g(e){return e>>>=0,e===0?32:31-(vc(e)/yc|0)|0}function _(e){var t=e&42;if(t!==0)return t;switch(e&-e){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function v(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=_(n))):i=_(o):i=_(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=_(n))):i=_(o)):i=_(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function y(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function b(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function x(){var e=Sc;return Sc<<=1,!(Sc&62914560)&&(Sc=4194304),e}function S(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function C(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function w(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-_c(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&ee(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function ee(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-_c(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function te(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-_c(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ne(e,t){var n=t&-t;return n=n&42?1:T(n),(n&(e.suspendedLanes|t))===0?n:0}function T(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function re(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ie(e){if(typeof Mc==`function`&&Nc(e),Fc&&typeof Fc.setStrictMode==`function`)try{Fc.setStrictMode(Pc,e)}catch{}}function ae(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}function oe(e){if(zc===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);zc=t&&t[1]||``,Bc=-1<e.stack.indexOf(`
|
|
16
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
17
|
+
`+zc+e+Bc}function E(e,t){if(!e||Vc)return``;Vc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
18
|
+
`),l=s.split(`
|
|
19
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
20
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Vc=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?oe(n):``}function D(e,t){switch(e.tag){case 26:case 27:case 5:return oe(e.type);case 16:return oe(`Lazy`);case 13:return e.child!==t&&t!==null?oe(`Suspense Fallback`):oe(`Suspense`);case 19:return oe(`SuspenseList`);case 0:case 15:return E(e.type,!1);case 11:return E(e.type.render,!1);case 1:return E(e.type,!0);case 31:return oe(`Activity`);default:return``}}function O(e){try{var t=``,n=null;do t+=D(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
21
|
+
Error generating stack: `+e.message+`
|
|
22
|
+
`+e.stack}}function k(e,t){if(typeof e==`object`&&e){var n=Hc.get(e);return n===void 0?(t={value:e,source:t,stack:O(t)},Hc.set(e,t),t):n}return{value:e,source:t,stack:O(t)}}function se(e,t){Uc[Wc++]=Kc,Uc[Wc++]=Gc,Gc=e,Kc=t}function ce(e,t,n){qc[Jc++]=Xc,qc[Jc++]=Zc,qc[Jc++]=Yc,Yc=e;var r=Xc;e=Zc;var i=32-_c(r)-1;r&=~(1<<i),n+=1;var a=32-_c(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Xc=1<<32-_c(t)+i|n<<i|r,Zc=a+e}else Xc=1<<a|n<<i|r,Zc=e}function le(e){e.return!==null&&(se(e,1),ce(e,1,0))}function ue(e){for(;e===Gc;)Gc=Uc[--Wc],Uc[Wc]=null,Kc=Uc[--Wc],Uc[Wc]=null;for(;e===Yc;)Yc=qc[--Jc],qc[Jc]=null,Zc=qc[--Jc],qc[Jc]=null,Xc=qc[--Jc],qc[Jc]=null}function de(e,t){qc[Jc++]=Xc,qc[Jc++]=Zc,qc[Jc++]=Yc,Xc=t.id,Zc=t.overflow,Yc=e}function fe(e,t){h(el,t),h($c,e),h(Qc,null),e=eo(t),m(Qc),h(Qc,e)}function pe(){m(Qc),m($c),m(el)}function me(e){e.memoizedState!==null&&h(tl,e);var t=Qc.current,n=to(t,e.type);t!==n&&(h($c,e),h(Qc,n))}function he(e){$c.current===e&&(m(Qc),m($c)),tl.current===e&&(m(tl),po?Mo._currentValue=jo:Mo._currentValue2=jo)}function ge(e){throw Se(k(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),al}function _e(e,t){if(!go)throw Error(i(175));ks(e.stateNode,e.type,e.memoizedProps,t,e)||ge(e,!0)}function ve(e){for(nl=e.return;nl;)switch(nl.tag){case 5:case 31:case 13:il=!1;return;case 27:case 3:il=!0;return;default:nl=nl.return}}function ye(e){if(!go||e!==nl)return!1;if(!K)return ve(e),K=!0,!1;var t=e.tag;if(cc?t!==3&&t!==27&&(t!==5||Gs(e.type)&&!so(e.type,e.memoizedProps))&&G&&ge(e):t!==3&&(t!==5||Gs(e.type)&&!so(e.type,e.memoizedProps))&&G&&ge(e),ve(e),t===13){if(!go)throw Error(i(316));if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));G=Ps(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));G=Ns(e)}else G=cc&&t===27?ys(e.type,G):nl?vs(e.stateNode):null;return!0}function be(){go&&(G=nl=null,K=!1)}function xe(){var e=rl;return e!==null&&(Iu===null?Iu=e:Iu.push.apply(Iu,e),rl=null),e}function Se(e){rl===null?rl=[e]:rl.push(e)}function Ce(e,t,n){po?(h(ol,t._currentValue),t._currentValue=n):(h(ol,t._currentValue2),t._currentValue2=n)}function we(e){var t=ol.current;po?e._currentValue=t:e._currentValue2=t,m(ol)}function Te(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function A(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Te(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Te(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Ee(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Ic(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===tl.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Mo]:e.push(Mo))}a=a.return}e!==null&&A(t,e,n,r),t.flags|=262144}function De(e){for(e=e.firstContext;e!==null;){var t=e.context;if(!Ic(po?t._currentValue:t._currentValue2,e.memoizedValue))return!0;e=e.next}return!1}function j(e){sl=e,cl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Oe(e){return Ae(sl,e)}function ke(e,t){return sl===null&&j(e),Ae(e,t)}function Ae(e,t){var n=po?t._currentValue:t._currentValue2;if(t={context:t,memoizedValue:n,next:null},cl===null){if(e===null)throw Error(i(308));cl=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else cl=cl.next=t;return n}function je(){return{controller:new ll,data:new Map,refCount:0}}function Me(e){e.refCount--,e.refCount===0&&ul(dl,function(){e.controller.abort()})}function Ne(){}function Pe(e){e!==ml&&e.next===null&&(ml===null?pl=ml=e:ml=ml.next=e),gl=!0,hl||(hl=!0,Be())}function Fe(e,t){if(!_l&&gl){_l=!0;do for(var n=!1,r=pl;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-_c(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ze(r,a))}else a=Q,a=v(r,r===X?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==fo),!(a&3)||y(r,a)||(n=!0,ze(r,a));r=r.next}while(n);_l=!1}}function Ie(){M()}function M(){gl=hl=!1;var e=0;vl!==0&&So()&&(e=vl);for(var t=Dc(),n=null,r=pl;r!==null;){var i=r.next,a=Le(r,t);a===0?(r.next=null,n===null?pl=i:n.next=i,i===null&&(ml=n)):(n=r,(e!==0||a&3)&&(gl=!0)),r=i}Uu!==0&&Uu!==5||Fe(e,!1),vl!==0&&(vl=0)}function Le(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-_c(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=b(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=X,n=Q,n=v(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==fo),r=e.callbackNode,n===0||e===t&&($===2||$===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&wc(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||y(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&wc(r),re(n)){case 2:case 8:n=kc;break;case 32:n=Ac;break;case 268435456:n=jc;break;default:n=Ac}return r=Re.bind(null,e),n=Cc(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&wc(r),e.callbackPriority=2,e.callbackNode=null,2}function Re(e,t){if(Uu!==0&&Uu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ia()&&e.callbackNode!==n)return null;var r=Q;return r=v(e,e===X?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==fo),r===0?null:(Mi(e,r,t),Le(e,Dc()),e.callbackNode!=null&&e.callbackNode===n?Re.bind(null,e):null)}function ze(e,t){if(ia())return null;Mi(e,t,!0)}function Be(){Po?Fo(function(){Y&6?Cc(Oc,Ie):M()}):Cc(Oc,Ie)}function Ve(){if(vl===0){var e=xl;e===0&&(e=bc,bc<<=1,!(bc&261888)&&(bc=256)),vl=e}return vl}function He(e,t){if(yl===null){var n=yl=[];bl=0,xl=Ve(),Sl={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return bl++,t.then(Ue,Ue),t}function Ue(){if(--bl===0&&yl!==null){Sl!==null&&(Sl.status=`fulfilled`);var e=yl;yl=null,xl=0,Sl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function We(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}function Ge(){var e=wl.current;return e===null?X.pooledCache:e}function Ke(e,t){t===null?h(wl,wl.current):h(wl,t.pool)}function qe(){var e=Ge();return e===null?null:{parent:po?fl._currentValue:fl._currentValue2,pool:e}}function Je(e,t){if(Ic(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Rc.call(t,i)||!Ic(e[i],t[i]))return!1}return!0}function Ye(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Xe(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ne,Ne),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,$e(e),e;default:if(typeof t.status==`string`)t.then(Ne,Ne);else{if(e=X,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,$e(e),e}throw kl=t,Tl}}function Ze(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(kl=e,Tl):e}}function Qe(){if(kl===null)throw Error(i(459));var e=kl;return kl=null,e}function $e(e){if(e===Tl||e===Dl)throw Error(i(483))}function et(e){var t=jl;return jl+=1,Al===null&&(Al=[]),Xe(Al,e,t)}function tt(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function nt(e,t){throw t.$$typeof===Ma?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function rt(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function r(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function a(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function o(e,t){return e=ha(e,t),e.index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function c(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function l(e,t,n,r){return t===null||t.tag!==6?(t=ya(n,e.mode,r),t.return=e,t):(t=o(t,n),t.return=e,t)}function u(e,t,n,r){var i=n.type;return i===Fa?p(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===Wa&&Ze(i)===t.type)?(t=o(t,n.props),tt(t,n),t.return=e,t):(t=_a(n.type,n.key,n.props,null,e.mode,r),tt(t,n),t.return=e,t)}function f(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=xa(n,e.mode,r),t.return=e,t):(t=o(t,n.children||[]),t.return=e,t)}function p(e,t,n,r,i){return t===null||t.tag!==7?(t=va(n,e.mode,r,i),t.return=e,t):(t=o(t,n),t.return=e,t)}function m(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ya(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case Na:return n=_a(t.type,t.key,t.props,null,e.mode,n),tt(n,t),n.return=e,n;case Pa:return t=xa(t,e.mode,n),t.return=e,t;case Wa:return t=Ze(t),m(e,t,n)}if(Ya(t)||d(t))return t=va(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return m(e,et(t),n);if(t.$$typeof===za)return m(e,ke(e,t),n);nt(e,t)}return null}function h(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?l(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case Na:return n.key===i?u(e,t,n,r):null;case Pa:return n.key===i?f(e,t,n,r):null;case Wa:return n=Ze(n),h(e,t,n,r)}if(Ya(n)||d(n))return i===null?p(e,t,n,r,null):null;if(typeof n.then==`function`)return h(e,t,et(n),r);if(n.$$typeof===za)return h(e,t,ke(e,n),r);nt(e,n)}return null}function g(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,l(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case Na:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case Pa:return e=e.get(r.key===null?n:r.key)||null,f(t,e,r,i);case Wa:return r=Ze(r),g(e,t,n,r,i)}if(Ya(r)||d(r))return e=e.get(n)||null,p(t,e,r,i,null);if(typeof r.then==`function`)return g(e,t,n,et(r),i);if(r.$$typeof===za)return g(e,t,n,ke(t,r),i);nt(t,r)}return null}function _(n,i,o,c){for(var l=null,u=null,d=i,f=i=0,p=null;d!==null&&f<o.length;f++){d.index>f?(p=d,d=null):p=d.sibling;var _=h(n,d,o[f],c);if(_===null){d===null&&(d=p);break}e&&d&&_.alternate===null&&t(n,d),i=s(_,i,f),u===null?l=_:u.sibling=_,u=_,d=p}if(f===o.length)return r(n,d),K&&se(n,f),l;if(d===null){for(;f<o.length;f++)d=m(n,o[f],c),d!==null&&(i=s(d,i,f),u===null?l=d:u.sibling=d,u=d);return K&&se(n,f),l}for(d=a(d);f<o.length;f++)p=g(d,n,f,o[f],c),p!==null&&(e&&p.alternate!==null&&d.delete(p.key===null?f:p.key),i=s(p,i,f),u===null?l=p:u.sibling=p,u=p);return e&&d.forEach(function(e){return t(n,e)}),K&&se(n,f),l}function v(n,o,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,f=o,p=o=0,_=null,v=c.next();f!==null&&!v.done;p++,v=c.next()){f.index>p?(_=f,f=null):_=f.sibling;var y=h(n,f,v.value,l);if(y===null){f===null&&(f=_);break}e&&f&&y.alternate===null&&t(n,f),o=s(y,o,p),d===null?u=y:d.sibling=y,d=y,f=_}if(v.done)return r(n,f),K&&se(n,p),u;if(f===null){for(;!v.done;p++,v=c.next())v=m(n,v.value,l),v!==null&&(o=s(v,o,p),d===null?u=v:d.sibling=v,d=v);return K&&se(n,p),u}for(f=a(f);!v.done;p++,v=c.next())v=g(f,n,p,v.value,l),v!==null&&(e&&v.alternate!==null&&f.delete(v.key===null?p:v.key),o=s(v,o,p),d===null?u=v:d.sibling=v,d=v);return e&&f.forEach(function(e){return t(n,e)}),K&&se(n,p),u}function y(e,n,a,s){if(typeof a==`object`&&a&&a.type===Fa&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case Na:a:{for(var l=a.key;n!==null;){if(n.key===l){if(l=a.type,l===Fa){if(n.tag===7){r(e,n.sibling),s=o(n,a.props.children),s.return=e,e=s;break a}}else if(n.elementType===l||typeof l==`object`&&l&&l.$$typeof===Wa&&Ze(l)===n.type){r(e,n.sibling),s=o(n,a.props),tt(s,a),s.return=e,e=s;break a}r(e,n);break}else t(e,n);n=n.sibling}a.type===Fa?(s=va(a.props.children,e.mode,s,a.key),s.return=e,e=s):(s=_a(a.type,a.key,a.props,null,e.mode,s),tt(s,a),s.return=e,e=s)}return c(e);case Pa:a:{for(l=a.key;n!==null;){if(n.key===l)if(n.tag===4&&n.stateNode.containerInfo===a.containerInfo&&n.stateNode.implementation===a.implementation){r(e,n.sibling),s=o(n,a.children||[]),s.return=e,e=s;break a}else{r(e,n);break}else t(e,n);n=n.sibling}s=xa(a,e.mode,s),s.return=e,e=s}return c(e);case Wa:return a=Ze(a),y(e,n,a,s)}if(Ya(a))return _(e,n,a,s);if(d(a)){if(l=d(a),typeof l!=`function`)throw Error(i(150));return a=l.call(a),v(e,n,a,s)}if(typeof a.then==`function`)return y(e,n,et(a),s);if(a.$$typeof===za)return y(e,n,ke(e,a),s);nt(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,n!==null&&n.tag===6?(r(e,n.sibling),s=o(n,a),s.return=e,e=s):(r(e,n),s=ya(a,e.mode,s),s.return=e,e=s),c(e)):r(e,n)}return function(e,t,r,i){try{jl=0;var a=y(e,t,r,i);return Al=null,a}catch(t){if(t===Tl||t===Dl)throw t;var o=n(29,t,null,e.mode);return o.lanes=i,o.return=e,o}}}function it(){for(var e=Fl,t=Il=Fl=0;t<e;){var n=Pl[t];Pl[t++]=null;var r=Pl[t];Pl[t++]=null;var i=Pl[t];Pl[t++]=null;var a=Pl[t];if(Pl[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&N(n,i,a)}}function at(e,t,n,r){Pl[Fl++]=e,Pl[Fl++]=t,Pl[Fl++]=n,Pl[Fl++]=r,Il|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ot(e,t,n,r){return at(e,t,n,r),P(e)}function st(e,t){return at(e,null,null,t),P(e)}function N(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-_c(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function P(e){if(50<Xu)throw Xu=0,Zu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}function ct(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lt(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ut(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function dt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Y&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=P(e),N(e,null,n),t}return at(e,r,t,n),P(e)}function ft(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,te(e,n)}}function pt(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function mt(){if(Rl){var e=Sl;if(e!==null)throw e}}function ht(e,t,n,r){Rl=!1;var i=e.updateQueue;Ll=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Q&f)===f:(r&f)===f){f!==0&&f===xl&&(Rl=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=ja({},d,f);break a;case 2:Ll=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Au|=o,e.lanes=o,e.memoizedState=d}}function gt(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function _t(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)gt(n[e],t)}function vt(e,t){e=Ou,h(Bl,e),h(zl,t),Ou=e|t.baseLanes}function yt(){h(Bl,Ou),h(zl,zl.current)}function bt(){Ou=Bl.current,m(zl),m(Bl)}function xt(e){var t=e.alternate;h(Ul,Ul.current&1),h(Vl,e),Hl===null&&(t===null||zl.current!==null||t.memoizedState!==null)&&(Hl=e)}function St(e){h(Ul,Ul.current),h(Vl,e),Hl===null&&(Hl=e)}function Ct(e){e.tag===22?(h(Ul,Ul.current),h(Vl,e),Hl===null&&(Hl=e)):wt(e)}function wt(){h(Ul,Ul.current),h(Vl,Vl.current)}function Tt(e){m(Vl),Hl===e&&(Hl=null),m(Ul)}function Et(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||fs(n)||ps(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function F(){throw Error(i(321))}function Dt(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ic(e[n],t[n]))return!1;return!0}function Ot(e,t,n,r,i,a){return Wl=a,q=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,W.H=e===null||e.memoizedState===null?eu:tu,Jl=!1,a=n(r,i),Jl=!1,ql&&(a=At(t,n,r,i)),kt(e),a}function kt(e){W.H=$l;var t=J!==null&&J.next!==null;if(Wl=0,Gl=J=q=null,Kl=!1,Xl=0,Zl=null,t)throw Error(i(300));e===null||au||(e=e.dependencies,e!==null&&De(e)&&(au=!0))}function At(e,t,n,r){q=e;var a=0;do{if(ql&&(Zl=null),Xl=0,ql=!1,25<=a)throw Error(i(301));if(a+=1,Gl=J=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}W.H=nu,o=t(n,r)}while(ql);return o}function jt(){var e=W.H,t=e.useState()[0];return t=typeof t.then==`function`?Lt(t):t,e=e.useState()[0],(J===null?null:J.memoizedState)!==e&&(q.flags|=1024),t}function Mt(){var e=Yl!==0;return Yl=0,e}function Nt(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Pt(e){if(Kl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Kl=!1}Wl=0,Gl=J=q=null,ql=!1,Xl=Yl=0,Zl=null}function Ft(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gl===null?q.memoizedState=Gl=e:Gl=Gl.next=e,Gl}function I(){if(J===null){var e=q.alternate;e=e===null?null:e.memoizedState}else e=J.next;var t=Gl===null?q.memoizedState:Gl.next;if(t!==null)Gl=t,J=e;else{if(e===null)throw q.alternate===null?Error(i(467)):Error(i(310));J=e,e={memoizedState:J.memoizedState,baseState:J.baseState,baseQueue:J.baseQueue,queue:J.queue,next:null},Gl===null?q.memoizedState=Gl=e:Gl=Gl.next=e}return Gl}function It(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lt(e){var t=Xl;return Xl+=1,Zl===null&&(Zl=[]),e=Xe(Zl,e,t),t=q,(Gl===null?t.memoizedState:Gl.next)===null&&(t=t.alternate,W.H=t===null||t.memoizedState===null?eu:tu),e}function Rt(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Lt(e);if(e.$$typeof===za)return Oe(e)}throw Error(i(438,String(e)))}function zt(e){var t=null,n=q.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=q.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=It(),q.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=Ka;return t.index++,n}function Bt(e,t){return typeof t==`function`?t(e):t}function Vt(e){return Ht(I(),J,e)}function Ht(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Wl&f)===f:(Q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===xl&&(d=!0);else if((Wl&p)===p){u=u.next,p===xl&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,q.lanes|=p,Au|=p;f=u.action,Jl&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,q.lanes|=f,Au|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Ic(o,e.memoizedState)&&(au=!0,d&&(n=Sl,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Ut(e){var t=I(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Ic(o,t.memoizedState)||(au=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Wt(e,t,n){var r=q,a=I(),o=K;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Ic((J||a).memoizedState,n);if(s&&(a.memoizedState=n,au=!0),a=a.queue,hn(qt.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||Gl!==null&&Gl.memoizedState.tag&1){if(r.flags|=2048,dn(9,{destroy:void 0},Kt.bind(null,r,a,n,t),null),X===null)throw Error(i(349));o||Wl&127||Gt(r,t,n)}return n}function Gt(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=q.updateQueue,t===null?(t=It(),q.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Kt(e,t,n,r){t.value=n,t.getSnapshot=r,Jt(t)&&Yt(e)}function qt(e,t,n){return n(function(){Jt(t)&&Yt(e)})}function Jt(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ic(e,n)}catch{return!0}}function Yt(e){var t=st(e,2);t!==null&&ji(t,e,2)}function Xt(e){var t=Ft();if(typeof e==`function`){var n=e;if(e=n(),Jl){ie(!0);try{n()}finally{ie(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bt,lastRenderedState:e},t}function Zt(e,t,n,r){return e.baseState=n,Ht(e,J,typeof r==`function`?r:Bt)}function Qt(e,t,n,r,a){if(Ln(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};W.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,$t(t,o)):(o.next=n.next,t.pending=n.next=o)}}function $t(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=W.T,o={};W.T=o;try{var s=n(i,r),c=W.S;c!==null&&c(o,s),en(e,t,s)}catch(n){nn(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),W.T=a}}else try{a=n(i,r),en(e,t,a)}catch(n){nn(e,t,n)}}function en(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){tn(e,t,n)},function(n){return nn(e,t,n)}):tn(e,t,n)}function tn(e,t,n){t.status=`fulfilled`,t.value=n,rn(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,$t(e,n)))}function nn(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,rn(t),t=t.next;while(t!==r)}e.action=null}function rn(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function an(e,t){return t}function on(e,t){if(K){var n=X.formState;if(n!==null){a:{var r=q;if(K){if(G){var i=gs(G,il);if(i){G=vs(i),r=_s(i);break a}}ge(r)}r=!1}r&&(t=n[0])}}n=Ft(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:an,lastRenderedState:t},n.queue=r,n=Pn.bind(null,q,r),r.dispatch=n,r=Xt(!1);var a=In.bind(null,q,!1,r.queue);return r=Ft(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Qt.bind(null,q,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function sn(e){return cn(I(),J,e)}function cn(e,t,n){if(t=Ht(e,t,an)[0],e=Vt(Bt)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Lt(t)}catch(e){throw e===Tl?Dl:e}else r=t;t=I();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(q.flags|=2048,dn(9,{destroy:void 0},ln.bind(null,i,n),null)),[r,a,e]}function ln(e,t){e.action=t}function un(e){var t=I(),n=J;if(n!==null)return cn(t,n,e);I(),t=t.memoizedState,n=I();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function dn(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=q.updateQueue,t===null&&(t=It(),q.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function L(){return I().memoizedState}function fn(e,t,n,r){var i=Ft();q.flags|=e,i.memoizedState=dn(1|t,{destroy:void 0},n,r===void 0?null:r)}function pn(e,t,n,r){var i=I();r=r===void 0?null:r;var a=i.memoizedState.inst;J!==null&&r!==null&&Dt(r,J.memoizedState.deps)?i.memoizedState=dn(t,a,n,r):(q.flags|=e,i.memoizedState=dn(1|t,a,n,r))}function mn(e,t){fn(8390656,8,e,t)}function hn(e,t){pn(2048,8,e,t)}function gn(e){q.flags|=4;var t=q.updateQueue;if(t===null)t=It(),q.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function _n(e){var t=I().memoizedState;return gn({ref:t,nextImpl:e}),function(){if(Y&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function vn(e,t){return pn(4,2,e,t)}function yn(e,t){return pn(4,4,e,t)}function bn(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function xn(e,t,n){n=n==null?null:n.concat([e]),pn(4,4,bn.bind(null,t,e),n)}function Sn(){}function Cn(e,t){var n=I();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Dt(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function wn(e,t){var n=I();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Dt(t,r[1]))return r[0];if(r=e(),Jl){ie(!0);try{e()}finally{ie(!1)}}return n.memoizedState=[r,t],r}function Tn(e,t,n){return n===void 0||Wl&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=Ai(),q.lanes|=e,Au|=e,n)}function En(e,t,n,r){return Ic(n,t)?n:zl.current===null?!(Wl&42)||Wl&1073741824&&!(Q&261930)?(au=!0,e.memoizedState=n):(e=Ai(),q.lanes|=e,Au|=e,t):(e=Tn(e,n,r),Ic(e,t)||(au=!0),e)}function Dn(e,t,n,r,i){var a=bo();yo(a!==0&&8>a?a:8);var o=W.T,s={};W.T=s,In(e,!1,t,n);try{var c=i(),l=W.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Fn(e,t,We(c,r),ki(e)):Fn(e,t,r,ki(e))}catch(n){Fn(e,t,{then:function(){},status:`rejected`,reason:n},ki())}finally{yo(a),o!==null&&s.types!==null&&(o.types=s.types),W.T=o}}function On(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:jo,baseState:jo,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bt,lastRenderedState:jo},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bt,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function kn(){return Oe(Mo)}function An(){return I().memoizedState}function jn(){return I().memoizedState}function Mn(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=ki();e=ut(n);var r=dt(t,e,n);r!==null&&(ji(r,t,n),ft(r,t,n)),t={cache:je()},e.payload=t;return}t=t.return}}function Nn(e,t,n){var r=ki();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ln(e)?Rn(t,n):(n=ot(e,t,n,r),n!==null&&(ji(n,e,r),zn(n,t,r)))}function Pn(e,t,n){Fn(e,t,n,ki())}function Fn(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ln(e))Rn(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Ic(s,o))return at(e,t,i,0),X===null&&it(),!1}catch{}if(n=ot(e,t,i,r),n!==null)return ji(n,e,r),zn(n,t,r),!0}return!1}function In(e,t,n,r){if(r={lane:2,revertLane:Ve(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ln(e)){if(t)throw Error(i(479))}else t=ot(e,n,r,2),t!==null&&ji(t,e,2)}function Ln(e){var t=e.alternate;return e===q||t!==null&&t===q}function Rn(e,t){ql=Kl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zn(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,te(e,n)}}function Bn(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ja({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}function Vn(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Je(n,r)||!Je(i,a):!0}function Hn(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ru.enqueueReplaceState(t,t.state,null)}function Un(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=ja({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Wn(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Gn(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Kn(e,t,n){return n=ut(n),n.tag=3,n.payload={element:null},n.callback=function(){Wn(e,t)},n}function qn(e){return e=ut(e),e.tag=3,e}function Jn(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Gn(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Gn(t,n,r),typeof i!=`function`&&(Hu===null?Hu=new Set([this]):Hu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Yn(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ee(t,n,a,!0),n=Vl.current,n!==null){switch(n.tag){case 31:case 13:return Hl===null?Ui():n.alternate===null&&ku===0&&(ku=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ol?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),sa(e,r,a)),!1;case 22:return n.flags|=65536,r===Ol?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),sa(e,r,a)),!1}throw Error(i(435,n.tag))}return sa(e,r,a),Ui(),!1}if(K)return t=Vl.current,t===null?(r!==al&&(t=Error(i(423),{cause:r}),Se(k(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=k(r,n),a=Kn(e.stateNode,r,a),pt(e,a),ku!==4&&(ku=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==al&&(e=Error(i(422),{cause:r}),Se(k(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=k(o,n),Fu===null?Fu=[o]:Fu.push(o),ku!==4&&(ku=2),t===null)return!0;r=k(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Kn(n.stateNode,r,e),pt(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Hu===null||!Hu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=qn(a),Jn(a,e,n,r),pt(n,a),!1}n=n.return}while(n!==null);return!1}function Xn(e,t,n,r){t.child=e===null?Nl(t,null,n,r):Ml(t,e.child,n,r)}function Zn(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return j(t),r=Ot(e,t,n,o,a,i),s=Mt(),e!==null&&!au?(Nt(e,t,i),br(e,t,i)):(K&&s&&le(t),t.flags|=1,Xn(e,t,r,i),t.child)}function Qn(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ma(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,$n(e,t,a,r,i)):(e=_a(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!xr(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Je:n,n(o,r)&&e.ref===t.ref)return br(e,t,i)}return t.flags|=1,e=ha(a,r),e.ref=t.ref,e.return=t,t.child=e}function $n(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Je(a,r)&&e.ref===t.ref)if(au=!1,t.pendingProps=r=a,xr(e,i))e.flags&131072&&(au=!0);else return t.lanes=e.lanes,br(e,t,i)}return sr(e,t,n,r,i)}function er(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return nr(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ke(t,a===null?null:a.cachePool),a===null?yt():vt(t,a),Ct(t);else return r=t.lanes=536870912,nr(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ke(t,null),yt(),wt(t)):(Ke(t,a.cachePool),vt(t,a),wt(t),t.memoizedState=null);return Xn(e,t,i,n),t.child}function tr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function nr(e,t,n,r,i){var a=Ge();return a=a===null?null:{parent:po?fl._currentValue:fl._currentValue2,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ke(t,null),yt(),Ct(t),e!==null&&Ee(e,t,r,!0),t.childLanes=i,null}function rr(e,t){return t=hr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ir(e,t,n){return Ml(t,e.child,null,n),e=rr(t,t.pendingProps),e.flags|=2,Tt(t),t.memoizedState=null,e}function ar(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(K){if(r.mode===`hidden`)return e=rr(t,r),t.lanes=536870912,tr(null,e);if(St(t),(e=G)?(e=Ds(e,il),e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yc===null?null:{id:Xc,overflow:Zc},retryLane:536870912,hydrationErrors:null},n=ba(e),n.return=t,t.child=n,nl=t,G=null)):e=null,e===null)throw ge(t);return t.lanes=536870912,null}return rr(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(St(t),a)if(t.flags&256)t.flags&=-257,t=ir(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(au||Ee(e,t,n,!1),a=(n&e.childLanes)!==0,au||a){if(r=X,r!==null&&(s=ne(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,st(e,s),ji(r,e,s),iu;Ui(),t=ir(e,t,n)}else e=o.treeContext,go&&(G=Ss(s),nl=t,K=!0,rl=null,il=!1,e!==null&&de(t,e)),t=rr(t,r),t.flags|=4096;return t}return e=ha(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function or(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function sr(e,t,n,r,i){return j(t),n=Ot(e,t,n,r,void 0,i),r=Mt(),e!==null&&!au?(Nt(e,t,i),br(e,t,i)):(K&&r&&le(t),t.flags|=1,Xn(e,t,n,i),t.child)}function cr(e,t,n,r,i,a){return j(t),t.updateQueue=null,n=At(t,r,n,i),kt(e),r=Mt(),e!==null&&!au?(Nt(e,t,a),br(e,t,a)):(K&&r&&le(t),t.flags|=1,Xn(e,t,n,a),t.child)}function lr(e,t,n,r,i){if(j(t),t.stateNode===null){var a=gc,o=n.contextType;typeof o==`object`&&o&&(a=Oe(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=ru,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ct(t),o=n.contextType,a.context=typeof o==`object`&&o?Oe(o):gc,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Bn(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&ru.enqueueReplaceState(a,a.state,null),ht(t,r,a,i),mt(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Un(n,s);a.props=c;var l=a.context,u=n.contextType;o=gc,typeof u==`object`&&u&&(o=Oe(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Hn(t,a,r,o),Ll=!1;var f=t.memoizedState;a.state=f,ht(t,r,a,i),mt(),l=t.memoizedState,s||f!==l||Ll?(typeof d==`function`&&(Bn(t,n,d,r),l=t.memoizedState),(c=Ll||Vn(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,lt(e,t),o=t.memoizedProps,u=Un(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=gc,typeof l==`object`&&l&&(c=Oe(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Hn(t,a,r,c),Ll=!1,f=t.memoizedState,a.state=f,ht(t,r,a,i),mt();var p=t.memoizedState;o!==d||f!==p||Ll||e!==null&&e.dependencies!==null&&De(e.dependencies)?(typeof s==`function`&&(Bn(t,n,s,r),p=t.memoizedState),(u=Ll||Vn(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&De(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,or(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ml(t,e.child,null,i),t.child=Ml(t,null,n,i)):Xn(e,t,n,i),t.memoizedState=a.state,e=t.child):e=br(e,t,i),e}function ur(e,t,n,r){return be(),t.flags|=256,Xn(e,t,n,r),t.child}function dr(e){return{baseLanes:e,cachePool:qe()}}function fr(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Nu),e}function pr(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(Ul.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(K){if(a?xt(t):wt(t),(e=G)?(e=Os(e,il),e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yc===null?null:{id:Xc,overflow:Zc},retryLane:536870912,hydrationErrors:null},n=ba(e),n.return=t,t.child=n,nl=t,G=null)):e=null,e===null)throw ge(t);return ps(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(wt(t),a=t.mode,c=hr({mode:`hidden`,children:c},a),r=va(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=dr(n),r.childLanes=fr(e,s,n),t.memoizedState=ou,tr(null,r)):(xt(t),mr(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(xt(t),t.flags&=-257,t=gr(e,t,n)):t.memoizedState===null?(wt(t),c=r.fallback,a=t.mode,r=hr({mode:`visible`,children:r.children},a),c=va(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ml(t,e.child,null,n),r=t.child,r.memoizedState=dr(n),r.childLanes=fr(e,s,n),t.memoizedState=ou,t=tr(null,r)):(wt(t),t.child=e.child,t.flags|=128,t=null);else if(xt(t),ps(c))s=ms(c).digest,r=Error(i(419)),r.stack=``,r.digest=s,Se({value:r,source:null,stack:null}),t=gr(e,t,n);else if(au||Ee(e,t,n,!1),s=(n&e.childLanes)!==0,au||s){if(s=X,s!==null&&(r=ne(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,st(e,r),ji(s,e,r),iu;fs(c)||Ui(),t=gr(e,t,n)}else fs(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,go&&(G=Cs(c),nl=t,K=!0,rl=null,il=!1,e!==null&&de(t,e)),t=mr(t,r.children),t.flags|=4096);return t}return a?(wt(t),c=r.fallback,a=t.mode,l=e.child,o=l.sibling,r=ha(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,o===null?(c=va(c,a,n,null),c.flags|=2):c=ha(o,c),c.return=t,r.return=t,r.sibling=c,t.child=r,tr(null,r),r=t.child,c=e.child.memoizedState,c===null?c=dr(n):(a=c.cachePool,a===null?a=qe():(l=po?fl._currentValue:fl._currentValue2,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=fr(e,s,n),t.memoizedState=ou,tr(e.child,r)):(xt(t),n=e.child,e=n.sibling,n=ha(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function mr(e,t){return t=hr({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function hr(e,t){return e=n(22,e,null,t),e.lanes=0,e}function gr(e,t,n){return Ml(t,e.child,null,n),e=mr(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _r(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Te(e.return,t,n)}function vr(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function yr(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Ul.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,h(Ul,o),Xn(e,t,r,n),r=K?Kc:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&_r(e,n,t);else if(e.tag===19)_r(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Et(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),vr(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Et(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}vr(t,!0,n,null,a,r);break;case`together`:vr(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function br(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Au|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ee(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ha(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ha(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function xr(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&De(e))):!0}function Sr(e,t,n){switch(t.tag){case 3:fe(t,t.stateNode.containerInfo),Ce(t,fl,e.memoizedState.cache),be();break;case 27:case 5:me(t);break;case 4:fe(t,t.stateNode.containerInfo);break;case 10:Ce(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,St(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(xt(t),e=br(e,t,n),e===null?null:e.sibling):pr(e,t,n):(xt(t),t.flags|=128,null);xt(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Ee(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return yr(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),h(Ul,Ul.current),r)break;return null;case 22:return t.lanes=0,er(e,t,n,t.pendingProps);case 24:Ce(t,fl,e.memoizedState.cache)}return br(e,t,n)}function Cr(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)au=!0;else{if(!xr(e,n)&&!(t.flags&128))return au=!1,Sr(e,t,n);au=!!(e.flags&131072)}else au=!1,K&&t.flags&1048576&&ce(t,Kc,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ze(t.elementType),t.type=e,typeof e==`function`)ma(e)?(r=Un(e,r),t.tag=1,t=lr(null,t,e,r,n)):(t.tag=0,t=sr(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===Ba){t.tag=11,t=Zn(null,t,e,r,n);break a}else if(a===Ua){t.tag=14,t=Qn(null,t,e,r,n);break a}}throw t=f(e)||e,Error(i(306,t,``))}}return t;case 0:return sr(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Un(r,t.pendingProps),lr(e,t,r,a,n);case 3:a:{if(fe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));var o=t.pendingProps;a=t.memoizedState,r=a.element,lt(e,t),ht(t,o,null,n);var s=t.memoizedState;if(o=s.cache,Ce(t,fl,o),o!==a.cache&&A(t,[fl],n,!0),mt(),o=s.element,go&&a.isDehydrated)if(a={element:o,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=ur(e,t,o,n);break a}else if(o!==r){r=k(Error(i(424)),t),Se(r),t=ur(e,t,o,n);break a}else for(go&&(G=xs(t.stateNode.containerInfo),nl=t,K=!0,rl=null,il=!0),n=Nl(t,null,o,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(be(),o===r){t=br(e,t,n);break a}Xn(e,t,o,n)}t=t.child}return t;case 26:if(Js)return or(e,t),e===null?(n=Zs(t.type,null,t.pendingProps,null))?t.memoizedState=n:K||(t.stateNode=rc(t.type,t.pendingProps,el.current,t)):t.memoizedState=Zs(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:if(cc)return me(t),e===null&&cc&&K&&(r=t.stateNode=lc(t.type,t.pendingProps,el.current,Qc.current,!1),nl=t,il=!0,G=ws(t.type,r,G)),Xn(e,t,t.pendingProps.children,n),or(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&K&&(Ks(t.type,t.pendingProps,Qc.current),(a=r=G)&&(r=Ts(r,t.type,t.pendingProps,il),r===null?a=!1:(t.stateNode=r,nl=t,G=bs(r),il=!1,a=!0)),a||ge(t)),me(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,so(a,o)?r=null:s!==null&&so(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Ot(e,t,jt,null,null,n),po?Mo._currentValue=a:Mo._currentValue2=a),or(e,t),Xn(e,t,r,n),t.child;case 6:return e===null&&K&&(qs(t.pendingProps,Qc.current),(e=n=G)&&(n=Es(n,t.pendingProps,il),n===null?e=!1:(t.stateNode=n,nl=t,G=null,e=!0)),e||ge(t)),null;case 13:return pr(e,t,n);case 4:return fe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ml(t,null,r,n):Xn(e,t,r,n),t.child;case 11:return Zn(e,t,t.type,t.pendingProps,n);case 7:return Xn(e,t,t.pendingProps,n),t.child;case 8:return Xn(e,t,t.pendingProps.children,n),t.child;case 12:return Xn(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ce(t,t.type,r.value),Xn(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,j(t),a=Oe(a),r=r(a),t.flags|=1,Xn(e,t,r,n),t.child;case 14:return Qn(e,t,t.type,t.pendingProps,n);case 15:return $n(e,t,t.type,t.pendingProps,n);case 19:return yr(e,t,n);case 31:return ar(e,t,n);case 22:return er(e,t,n,t.pendingProps);case 24:return j(t),r=Oe(fl),e===null?(a=Ge(),a===null&&(a=X,o=je(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ct(t),Ce(t,fl,a)):((e.lanes&n)!==0&&(lt(e,t),ht(t,null,null,n),mt()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ce(t,fl,r),r!==a.cache&&A(t,[fl],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ce(t,fl,r))),Xn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function wr(e){e.flags|=4}function Tr(e){ho&&(e.flags|=8)}function Er(e,t){if(e!==null&&e.child===t.child)return!1;if(t.flags&16)return!0;for(e=t.child;e!==null;){if(e.flags&8218||e.subtreeFlags&8218)return!0;e=e.sibling}return!1}function Dr(e,t,n,r){if(mo)for(n=t.child;n!==null;){if(n.tag===5||n.tag===6)ao(e,n.stateNode);else if(!(n.tag===4||cc&&n.tag===27)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}else if(ho)for(var i=t.child;i!==null;){if(i.tag===5){var a=i.stateNode;n&&r&&(a=us(a,i.type,i.memoizedProps)),ao(e,a)}else if(i.tag===6)a=i.stateNode,n&&r&&(a=ds(a,i.memoizedProps)),ao(e,a);else if(i.tag!==4){if(i.tag===22&&i.memoizedState!==null)a=i.child,a!==null&&(a.return=i),Dr(e,i,!0,!0);else if(i.child!==null){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}}function Or(e,t,n,r){var i=!1;if(ho)for(var a=t.child;a!==null;){if(a.tag===5){var o=a.stateNode;n&&r&&(o=us(o,a.type,a.memoizedProps)),ss(e,o)}else if(a.tag===6)o=a.stateNode,n&&r&&(o=ds(o,a.memoizedProps)),ss(e,o);else if(a.tag!==4){if(a.tag===22&&a.memoizedState!==null)i=a.child,i!==null&&(i.return=a),Or(e,a,!0,!0),i=!0;else if(a.child!==null){a.child.return=a,a=a.child;continue}}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return i;a=a.return}a.sibling.return=a.return,a=a.sibling}return i}function kr(e,t){if(ho&&Er(e,t)){e=t.stateNode;var n=e.containerInfo,r=os();Or(r,t,!1,!1),e.pendingChildren=r,wr(t),cs(n,r)}}function Ar(e,t,n,r){if(mo)e.memoizedProps!==r&&wr(t);else if(ho){var i=e.stateNode,a=e.memoizedProps;if((e=Er(e,t))||a!==r){var o=Qc.current;a=as(i,n,a,r,!e,null),a===i?t.stateNode=i:(Tr(t),oo(a,n,r,o)&&wr(t),t.stateNode=a,e&&Dr(a,t,!1,!1))}else t.stateNode=i}}function jr(e,t,n,r,i){if(e.mode&32&&(n===null?wo(t,r):To(t,n,r))){if(e.flags|=16777216,(i&335544128)===i||Eo(t,r))if(Do(e.stateNode,t,r))e.flags|=8192;else if(Bi())e.flags|=8192;else throw kl=Ol,El}else e.flags&=-16777217}function Mr(e,t){if(ac(t)){if(e.flags|=16777216,!oc(t))if(Bi())e.flags|=8192;else throw kl=Ol,El}else e.flags&=-16777217}function Nr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:x(),e.lanes|=t,Pu|=t)}function Pr(e,t){if(!K)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function R(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fr(e,t,n){var r=t.pendingProps;switch(ue(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return R(t),null;case 1:return R(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),we(fl),pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ye(t)?wr(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xe())),kr(e,t),R(t),null;case 26:if(Js){var a=t.type,o=t.memoizedState;return e===null?(wr(t),o===null?(R(t),jr(t,a,null,r,n)):(R(t),Mr(t,o))):o?o===e.memoizedState?(R(t),t.flags&=-16777217):(wr(t),R(t),Mr(t,o)):(o=e.memoizedProps,mo?o!==r&&wr(t):Ar(e,t,a,r),R(t),jr(t,a,o,r,n)),null}case 27:if(cc){if(he(t),n=el.current,a=t.type,e!==null&&t.stateNode!=null)mo?e.memoizedProps!==r&&wr(t):Ar(e,t,a,r);else{if(!r){if(t.stateNode===null)throw Error(i(166));return R(t),null}e=Qc.current,ye(t)?_e(t,e):(e=lc(a,r,n,e,!0),t.stateNode=e,wr(t))}return R(t),null}case 5:if(he(t),a=t.type,e!==null&&t.stateNode!=null)Ar(e,t,a,r);else{if(!r){if(t.stateNode===null)throw Error(i(166));return R(t),null}if(o=Qc.current,ye(t))_e(t,o),zs(t.stateNode,a,r,o)&&(t.flags|=64);else{var s=io(a,r,el.current,o,t);Tr(t),Dr(s,t,!1,!1),t.stateNode=s,oo(s,a,r,o)&&wr(t)}}return R(t),jr(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)n=e.memoizedProps,mo?n!==r&&wr(t):ho&&(n===r?t.stateNode=e.stateNode:(e=el.current,n=Qc.current,Tr(t),t.stateNode=co(r,e,n,t)));else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=el.current,n=Qc.current,ye(t)){if(!go)throw Error(i(176));if(e=t.stateNode,n=t.memoizedProps,r=null,a=nl,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}As(e,n,t,r)||ge(t,!0)}else Tr(t),t.stateNode=co(r,e,n,t)}return R(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ye(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(!go)throw Error(i(556));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));js(e,t)}else be(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;R(t),e=!1}else n=xe(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Tt(t),t):(Tt(t),null);if(t.flags&128)throw Error(i(558))}return R(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ye(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(!go)throw Error(i(344));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));Ms(a,t)}else be(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;R(t),a=!1}else a=xe(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Tt(t),t):(Tt(t),null)}return Tt(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Nr(t,t.updateQueue),R(t),null);case 4:return pe(),kr(e,t),e===null&&vo(t.stateNode.containerInfo),R(t),null;case 10:return we(t.type),R(t),null;case 19:if(m(Ul),r=t.memoizedState,r===null)return R(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Pr(r,!1);else{if(ku!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Et(e),o!==null){for(t.flags|=128,Pr(r,!1),e=o.updateQueue,t.updateQueue=e,Nr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ga(n,e),n=n.sibling;return h(Ul,Ul.current&1|2),K&&se(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Dc()>Bu&&(t.flags|=128,a=!0,Pr(r,!1),t.lanes=4194304)}else{if(!a)if(e=Et(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Nr(t,e),Pr(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!K)return R(t),null}else 2*Dc()-r.renderingStartTime>Bu&&n!==536870912&&(t.flags|=128,a=!0,Pr(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(R(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Dc(),e.sibling=null,n=Ul.current,h(Ul,a?n&1|2:n&1),K&&se(t,r.treeForkCount),e);case 22:case 23:return Tt(t),bt(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(R(t),t.subtreeFlags&6&&(t.flags|=8192)):R(t),n=t.updateQueue,n!==null&&Nr(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&m(wl),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),we(fl),R(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Ir(e,t){switch(ue(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return we(fl),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return he(t),null;case 31:if(t.memoizedState!==null){if(Tt(t),t.alternate===null)throw Error(i(340));be()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Tt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));be()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return m(Ul),null;case 4:return pe(),null;case 10:return we(t.type),null;case 22:case 23:return Tt(t),bt(),e!==null&&m(wl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return we(fl),null;case 25:return null;default:return null}}function Lr(e,t){switch(ue(t),t.tag){case 3:we(fl),pe();break;case 26:case 27:case 5:he(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&Tt(t);break;case 13:Tt(t);break;case 19:m(Ul);break;case 10:we(t.type);break;case 22:case 23:Tt(t),bt(),e!==null&&m(wl);break;case 24:we(fl)}}function Rr(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){H(t,t.return,e)}}function zr(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){H(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){H(t,t.return,e)}}function Br(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{_t(t,n)}catch(t){H(e,e.return,t)}}}function Vr(e,t,n){n.props=Un(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){H(e,t,n)}}function Hr(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=$a(e.stateNode);break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){H(e,t,n)}}function z(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){H(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){H(e,t,n)}else n.current=null}function Ur(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{qo(r,t,n,e)}catch(t){H(e,e.return,t)}}function Wr(e,t,n){try{Jo(e.stateNode,e.type,n,t,e)}catch(t){H(e,e.return,t)}}function Gr(e){return e.tag===5||e.tag===3||(Js?e.tag===26:!1)||(cc?e.tag===27&&pc(e.type):!1)||e.tag===4}function Kr(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gr(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(cc&&e.tag===27&&pc(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function B(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Xo(n,e,t):Go(n,e);else if(r!==4&&(cc&&r===27&&pc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(B(e,t,n),e=e.sibling;e!==null;)B(e,t,n),e=e.sibling}function qr(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?Yo(n,e,t):Wo(n,e);else if(r!==4&&(cc&&r===27&&pc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(qr(e,t,n),e=e.sibling;e!==null;)qr(e,t,n),e=e.sibling}function Jr(e,t,n){e=e.containerInfo;try{ls(e,n)}catch(e){H(t,t.return,e)}}function Yr(e){var t=e.stateNode,n=e.memoizedProps;try{uc(e.type,n,t,e)}catch(t){H(e,e.return,t)}}function Xr(e,t){for(no(e.containerInfo),du=t;du!==null;)if(e=du,t=e.child,e.subtreeFlags&1028&&t!==null)t.return=e,du=t;else for(;du!==null;){e=du;var n=e.alternate;switch(t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t===null?null:t.events,t!==null))for(var r=0;r<t.length;r++){var a=t[r];a.ref.impl=a.nextImpl}break;case 11:case 15:break;case 1:if(t&1024&&n!==null){t=void 0,r=e,a=n.memoizedProps,n=n.memoizedState;var o=r.stateNode;try{var s=Un(r.type,a);t=o.getSnapshotBeforeUpdate(s,n),o.__reactInternalSnapshotBeforeUpdate=t}catch(e){H(r,r.return,e)}}break;case 3:t&1024&&mo&&is(e.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(i(163))}if(t=e.sibling,t!==null){t.return=e.return,du=t;break}du=e.return}}function Zr(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ci(e,n),r&4&&Rr(5,n);break;case 1:if(ci(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){H(n,n.return,e)}else{var i=Un(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){H(n,n.return,e)}}r&64&&Br(n),r&512&&Hr(n,n.return);break;case 3:if(ci(e,n),r&64&&(r=n.updateQueue,r!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=$a(n.child.stateNode);break;case 1:e=n.child.stateNode}try{_t(r,e)}catch(e){H(n,n.return,e)}}break;case 27:cc&&t===null&&r&4&&Yr(n);case 26:case 5:if(ci(e,n),t===null){if(r&4)Ur(n);else if(r&64){e=n.type,t=n.memoizedProps,i=n.stateNode;try{Fs(i,e,t,n)}catch(e){H(n,n.return,e)}}}r&512&&Hr(n,n.return);break;case 12:ci(e,n);break;case 31:ci(e,n),r&4&&ti(e,n);break;case 13:ci(e,n),r&4&&ni(e,n),r&64&&(r=n.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(n=ua.bind(null,n),hs(r,n))));break;case 22:if(r=n.memoizedState!==null||su,!r){t=t!==null&&t.memoizedState!==null||cu,i=su;var a=cu;su=r,(cu=t)&&!a?ui(e,n,(n.subtreeFlags&8772)!=0):ci(e,n),su=i,cu=a}break;case 30:break;default:ci(e,n)}}function Qr(e){var t=e.alternate;t!==null&&(e.alternate=null,Qr(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Co(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function $r(e,t,n){for(n=n.child;n!==null;)ei(e,t,n),n=n.sibling}function ei(e,t,n){if(Fc&&typeof Fc.onCommitFiberUnmount==`function`)try{Fc.onCommitFiberUnmount(Pc,n)}catch{}switch(n.tag){case 26:if(Js){cu||z(n,t),$r(e,t,n),n.memoizedState?$s(n.memoizedState):n.stateNode&&nc(n.stateNode);break}case 27:if(cc){cu||z(n,t);var r=fu,i=pu;pc(n.type)&&(fu=n.stateNode,pu=!1),$r(e,t,n),dc(n.stateNode),fu=r,pu=i;break}case 5:cu||z(n,t);case 6:if(mo){if(r=fu,i=pu,fu=null,$r(e,t,n),fu=r,pu=i,fu!==null)if(pu)try{Qo(fu,n.stateNode)}catch(e){H(n,t,e)}else try{Zo(fu,n.stateNode)}catch(e){H(n,t,e)}}else $r(e,t,n);break;case 18:mo&&fu!==null&&(pu?Hs(fu,n.stateNode):Vs(fu,n.stateNode));break;case 4:mo?(r=fu,i=pu,fu=n.stateNode.containerInfo,pu=!0,$r(e,t,n),fu=r,pu=i):(ho&&Jr(n.stateNode,n,os()),$r(e,t,n));break;case 0:case 11:case 14:case 15:zr(2,n,t),cu||zr(4,n,t),$r(e,t,n);break;case 1:cu||(z(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Vr(n,t,r)),$r(e,t,n);break;case 21:$r(e,t,n);break;case 22:cu=(r=cu)||n.memoizedState!==null,$r(e,t,n),cu=r;break;default:$r(e,t,n)}}function ti(e,t){if(go&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ls(e)}catch(e){H(t,t.return,e)}}}function ni(e,t){if(go&&t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Rs(e)}catch(e){H(t,t.return,e)}}function ri(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new uu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new uu),t;default:throw Error(i(435,e.tag))}}function ii(e,t){var n=ri(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=da.bind(null,e,t);t.then(r,r)}})}function ai(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t;if(mo){var c=s;a:for(;c!==null;){switch(c.tag){case 27:if(cc){if(pc(c.type)){fu=c.stateNode,pu=!1;break a}break}case 5:fu=c.stateNode,pu=!1;break a;case 3:case 4:fu=c.stateNode.containerInfo,pu=!0;break a}c=c.return}if(fu===null)throw Error(i(160));ei(o,s,a),fu=null,pu=!1}else ei(o,s,a);o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)V(t,e),t=t.sibling}function V(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ai(t,e),oi(e),r&4&&(zr(3,e,e.return),Rr(3,e),zr(5,e,e.return));break;case 1:ai(t,e),oi(e),r&512&&(cu||n===null||z(n,n.return)),r&64&&su&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:if(Js){var a=mu;if(ai(t,e),oi(e),r&512&&(cu||n===null||z(n,n.return)),r&4){r=n===null?null:n.memoizedState;var o=e.memoizedState;n===null?o===null?e.stateNode===null?e.stateNode=ec(a,e.type,e.memoizedProps,e):tc(a,e.type,e.stateNode):e.stateNode=Qs(a,o,e.memoizedProps):r===o?o===null&&e.stateNode!==null&&Wr(e,e.memoizedProps,n.memoizedProps):(r===null?n.stateNode!==null&&nc(n.stateNode):$s(r),o===null?tc(a,e.type,e.stateNode):Qs(a,o,e.memoizedProps))}break}case 27:if(cc){ai(t,e),oi(e),r&512&&(cu||n===null||z(n,n.return)),n!==null&&r&4&&Wr(e,e.memoizedProps,n.memoizedProps);break}case 5:if(ai(t,e),oi(e),r&512&&(cu||n===null||z(n,n.return)),mo){if(e.flags&32){a=e.stateNode;try{$o(a)}catch(t){H(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Wr(e,a,n===null?a:n.memoizedProps)),r&1024&&(lu=!0)}else ho&&e.alternate!==null&&(e.alternate.stateNode=e.stateNode);break;case 6:if(ai(t,e),oi(e),r&4&&mo){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=n===null?r:n.memoizedProps,a=e.stateNode;try{Ko(a,n,r)}catch(t){H(e,e.return,t)}}break;case 3:if(Js?(ic(),a=mu,mu=Xs(t.containerInfo),ai(t,e),mu=a):ai(t,e),oi(e),r&4){if(mo&&go&&n!==null&&n.memoizedState.isDehydrated)try{Is(t.containerInfo)}catch(t){H(e,e.return,t)}if(ho){r=t.containerInfo,n=t.pendingChildren;try{ls(r,n)}catch(t){H(e,e.return,t)}}}lu&&(lu=!1,si(e));break;case 4:Js?(n=mu,mu=Xs(e.stateNode.containerInfo),ai(t,e),oi(e),mu=n):(ai(t,e),oi(e)),r&4&&ho&&Jr(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:ai(t,e),oi(e);break;case 31:ai(t,e),oi(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ii(e,r)));break;case 13:ai(t,e),oi(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ru=Dc()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ii(e,r)));break;case 22:a=e.memoizedState!==null;var s=n!==null&&n.memoizedState!==null,c=su,l=cu;if(su=c||a,cu=l||s,ai(t,e),cu=l,su=c,oi(e),r&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||s||su||cu||li(e)),mo)){a:if(n=null,mo)for(t=e;;){if(t.tag===5||Js&&t.tag===26){if(n===null){s=n=t;try{o=s.stateNode,a?es(o):ns(s.stateNode,s.memoizedProps)}catch(e){H(s,s.return,e)}}}else if(t.tag===6){if(n===null){s=t;try{var u=s.stateNode;a?ts(u):rs(u,s.memoizedProps)}catch(e){H(s,s.return,e)}}}else if(t.tag===18){if(n===null){s=t;try{var d=s.stateNode;a?Us(d):Ws(s.stateNode)}catch(e){H(s,s.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ii(e,n))));break;case 19:ai(t,e),oi(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ii(e,r)));break;case 30:break;case 21:break;default:ai(t,e),oi(e)}}function oi(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Gr(r)){n=r;break}r=r.return}if(mo){if(n==null)throw Error(i(160));switch(n.tag){case 27:if(cc){var a=n.stateNode;qr(e,Kr(e),a);break}case 5:var o=n.stateNode;n.flags&32&&($o(o),n.flags&=-33),qr(e,Kr(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;B(e,Kr(e),s);break;default:throw Error(i(161))}}}catch(t){H(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function si(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;si(t),t.tag===5&&t.flags&1024&&No(t.stateNode),e=e.sibling}}function ci(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Zr(e,t.alternate,t),t=t.sibling}function li(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zr(4,t,t.return),li(t);break;case 1:z(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vr(t,t.return,n),li(t);break;case 27:cc&&dc(t.stateNode);case 26:case 5:z(t,t.return),li(t);break;case 22:t.memoizedState===null&&li(t);break;case 30:li(t);break;default:li(t)}e=e.sibling}}function ui(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:ui(i,a,n),Rr(4,a);break;case 1:if(ui(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){H(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)gt(c[i],s)}catch(e){H(r,r.return,e)}}n&&o&64&&Br(a),Hr(a,a.return);break;case 27:cc&&Yr(a);case 26:case 5:ui(i,a,n),n&&r===null&&o&4&&Ur(a),Hr(a,a.return);break;case 12:ui(i,a,n);break;case 31:ui(i,a,n),n&&o&4&&ti(i,a);break;case 13:ui(i,a,n),n&&o&4&&ni(i,a);break;case 22:a.memoizedState===null&&ui(i,a,n),Hr(a,a.return);break;case 30:break;default:ui(i,a,n)}t=t.sibling}}function di(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Me(n))}function fi(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Me(e))}function pi(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)mi(e,t,n,r),t=t.sibling}function mi(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:pi(e,t,n,r),i&2048&&Rr(9,t);break;case 1:pi(e,t,n,r);break;case 3:pi(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Me(e)));break;case 12:if(i&2048){pi(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){H(t,t.return,e)}}else pi(e,t,n,r);break;case 31:pi(e,t,n,r);break;case 13:pi(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?pi(e,t,n,r):(a._visibility|=2,hi(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?pi(e,t,n,r):gi(e,t),i&2048&&di(o,t);break;case 24:pi(e,t,n,r),i&2048&&fi(t.alternate,t);break;default:pi(e,t,n,r)}}function hi(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:hi(a,o,s,c,i),Rr(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,hi(a,o,s,c,i)):u._visibility&2?hi(a,o,s,c,i):gi(a,o),i&&l&2048&&di(o.alternate,o);break;case 24:hi(a,o,s,c,i),i&&l&2048&&fi(o.alternate,o);break;default:hi(a,o,s,c,i)}t=t.sibling}}function gi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:gi(n,r),i&2048&&di(r.alternate,r);break;case 24:gi(n,r),i&2048&&fi(r.alternate,r);break;default:gi(n,r)}t=t.sibling}}function _i(e,t,n){if(e.subtreeFlags&hu)for(e=e.child;e!==null;)vi(e,t,n),e=e.sibling}function vi(e,t,n){switch(e.tag){case 26:if(_i(e,t,n),e.flags&hu)if(e.memoizedState!==null)sc(n,mu,e.memoizedState,e.memoizedProps);else{var r=e.stateNode,i=e.type;e=e.memoizedProps,((t&335544128)===t||Eo(i,e))&&ko(n,r,i,e)}break;case 5:_i(e,t,n),e.flags&hu&&(r=e.stateNode,i=e.type,e=e.memoizedProps,((t&335544128)===t||Eo(i,e))&&ko(n,r,i,e));break;case 3:case 4:Js?(r=mu,mu=Xs(e.stateNode.containerInfo),_i(e,t,n),mu=r):_i(e,t,n);break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=hu,hu=16777216,_i(e,t,n),hu=r):_i(e,t,n));break;default:_i(e,t,n)}}function yi(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function bi(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];du=r,Ci(r,e)}yi(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)xi(e),e=e.sibling}function xi(e){switch(e.tag){case 0:case 11:case 15:bi(e),e.flags&2048&&zr(9,e,e.return);break;case 3:bi(e);break;case 12:bi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Si(e)):bi(e);break;default:bi(e)}}function Si(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];du=r,Ci(r,e)}yi(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zr(8,t,t.return),Si(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Si(t));break;default:Si(t)}e=e.sibling}}function Ci(e,t){for(;du!==null;){var n=du;switch(n.tag){case 0:case 11:case 15:zr(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Me(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,du=r;else a:for(n=e;du!==null;){r=du;var i=r.sibling,a=r.return;if(Qr(r),r===n){du=null;break a}if(i!==null){i.return=a,du=i;break a}du=a}}}function wi(e){var t=_o(e);if(t!=null){if(typeof t.memoizedProps[`data-testname`]!=`string`)throw Error(i(364));return t}if(e=Lo(e),e===null)throw Error(i(362));return e.stateNode.current}function Ti(e,t){var n=e.tag;switch(t.$$typeof){case _u:if(e.type===t.value)return!0;break;case vu:a:{for(t=t.value,e=[e,0],n=0;n<e.length;){var r=e[n++],a=r.tag,o=e[n++],s=t[o];if(a!==5&&a!==26&&a!==27||!Bo(r)){for(;s!=null&&Ti(r,s);)o++,s=t[o];if(o===t.length){t=!0;break a}else for(r=r.child;r!==null;)e.push(r,o),r=r.sibling}}t=!1}return t;case yu:if((n===5||n===26||n===27)&&Vo(e.stateNode,t.value))return!0;break;case xu:if((n===5||n===6||n===26||n===27)&&(e=zo(e),e!==null&&0<=e.indexOf(t.value)))return!0;break;case bu:if((n===5||n===26||n===27)&&(e=e.memoizedProps[`data-testname`],typeof e==`string`&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function Ei(e){switch(e.$$typeof){case _u:return`<`+(f(e.value)||`Unknown`)+`>`;case vu:return`:has(`+(Ei(e)||``)+`)`;case yu:return`[role="`+e.value+`"]`;case xu:return`"`+e.value+`"`;case bu:return`[data-testname="`+e.value+`"]`;default:throw Error(i(365))}}function Di(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],a=i.tag,o=e[r++],s=t[o];if(a!==5&&a!==26&&a!==27||!Bo(i)){for(;s!=null&&Ti(i,s);)o++,s=t[o];if(o===t.length)n.push(i);else for(i=i.child;i!==null;)e.push(i,o),i=i.sibling}}return n}function Oi(e,t){if(!Io)throw Error(i(363));e=wi(e),e=Di(e,t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var r=e[n++],a=r.tag;if(a===5||a===26||a===27)Bo(r)||t.push(r.stateNode);else for(r=r.child;r!==null;)e.push(r),r=r.sibling}return t}function ki(){return Y&2&&Q!==0?Q&-Q:W.T===null?xo():Ve()}function Ai(){if(Nu===0)if(!(Q&536870912)||K){var e=xc;xc<<=1,!(xc&3932160)&&(xc=262144),Nu=e}else Nu=536870912;return e=Vl.current,e!==null&&(e.flags|=32),Nu}function ji(e,t,n){(e===X&&($===2||$===9)||e.cancelPendingCommit!==null)&&(Ri(e,0),Fi(e,Q,Nu,!1)),C(e,n),(!(Y&2)||e!==X)&&(e===X&&(!(Y&2)&&(ju|=n),ku===4&&Fi(e,Q,Nu,!1)),Pe(e))}function Mi(e,t,n){if(Y&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||y(e,t),a=r?Ki(e,t):Wi(e,t,!0),o=r;do{if(a===0){Eu&&!r&&Fi(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Pi(n)){a=Wi(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Fu;var l=go&&c.current.memoizedState.isDehydrated;if(l&&(Ri(c,s).flags|=256),s=Wi(c,s,!1),s!==2){if(Du&&!l){c.errorRecoveryDisabledLanes|=o,ju|=o,a=4;break a}o=Iu,Iu=a,o!==null&&(Iu===null?Iu=o:Iu.push.apply(Iu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Ri(e,0),Fi(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Fi(r,t,Nu,!Tu);break a;case 2:Iu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Ru+300-Dc(),10<a)){if(Fi(r,t,Nu,!Tu),v(r,0,!0)!==0)break a;Ku=t,r.timeoutHandle=lo(Ni.bind(null,r,n,Iu,Vu,Lu,t,Nu,ju,Pu,Tu,o,`Throttled`,-0,0),a);break a}Ni(r,n,Iu,Vu,Lu,t,Nu,ju,Pu,Tu,o,null,-0,0)}}break}while(1);Pe(e)}function Ni(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=fo,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d=Oo(),vi(t,a,d);var m=(a&62914560)===a?Ru-Dc():(a&4194048)===a?zu-Dc():0;if(m=Ao(d,m),m!==null){Ku=a,e.cancelPendingCommit=m($i.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Fi(e,a,o,!l);return}}$i(e,t,a,n,r,i,o,s,c)}function Pi(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Ic(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Fi(e,t,n,r){t&=~Mu,t&=~ju,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-_c(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&ee(e,n,t)}function Ii(){return Y&6?!0:(Fe(0,!1),!1)}function Li(){if(Z!==null){if($===0)var e=Z.return;else e=Z,cl=sl=null,Pt(e),Al=null,jl=0,e=Z;for(;e!==null;)Lr(e.alternate,e),e=e.return;Z=null}}function Ri(e,t){var n=e.timeoutHandle;n!==fo&&(e.timeoutHandle=fo,uo(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ku=0,Li(),X=e,Z=n=ha(e.current,null),Q=t,$=0,wu=null,Tu=!1,Eu=y(e,t),Du=!1,Pu=Nu=Mu=ju=Au=ku=0,Iu=Fu=null,Lu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-_c(r),a=1<<i;t|=e[i],r&=~a}return Ou=t,it(),n}function zi(e,t){q=null,W.H=$l,t===Tl||t===Dl?(t=Qe(),$=3):t===El?(t=Qe(),$=4):$=t===iu?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,wu=t,Z===null&&(ku=1,Wn(e,k(t,e.current)))}function Bi(){var e=Vl.current;return e===null?!0:(Q&4194048)===Q?Hl===null:(Q&62914560)===Q||Q&536870912?e===Hl:!1}function Vi(){var e=W.H;return W.H=$l,e===null?$l:e}function Hi(){var e=W.A;return W.A=gu,e}function Ui(){ku=4,Tu||(Q&4194048)!==Q&&Vl.current!==null||(Eu=!0),!(Au&134217727)&&!(ju&134217727)||X===null||Fi(X,Q,Nu,!1)}function Wi(e,t,n){var r=Y;Y|=2;var i=Vi(),a=Hi();(X!==e||Q!==t)&&(Vu=null,Ri(e,t)),t=!1;var o=ku;a:do try{if($!==0&&Z!==null){var s=Z,c=wu;switch($){case 8:Li(),o=6;break a;case 3:case 2:case 9:case 6:Vl.current===null&&(t=!0);var l=$;if($=0,wu=null,Xi(e,s,c,l),n&&Eu){o=0;break a}break;default:l=$,$=0,wu=null,Xi(e,s,c,l)}}Gi(),o=ku;break}catch(t){zi(e,t)}while(1);return t&&e.shellSuspendCounter++,cl=sl=null,Y=r,W.H=i,W.A=a,Z===null&&(X=null,Q=0,it()),o}function Gi(){for(;Z!==null;)Ji(Z)}function Ki(e,t){var n=Y;Y|=2;var r=Vi(),a=Hi();X!==e||Q!==t?(Vu=null,Bu=Dc()+500,Ri(e,t)):Eu=y(e,t);a:do try{if($!==0&&Z!==null){t=Z;var o=wu;b:switch($){case 1:$=0,wu=null,Xi(e,t,o,1);break;case 2:case 9:if(Ye(o)){$=0,wu=null,Yi(t);break}t=function(){$!==2&&$!==9||X!==e||($=7),Pe(e)},o.then(t,t);break a;case 3:$=7;break a;case 4:$=5;break a;case 7:Ye(o)?($=0,wu=null,Yi(t)):($=0,wu=null,Xi(e,t,o,7));break;case 5:var s=null;switch(Z.tag){case 26:s=Z.memoizedState;case 5:case 27:var c=Z,l=c.type,u=c.pendingProps;if(s?oc(s):Do(c.stateNode,l,u)){$=0,wu=null;var d=c.sibling;if(d!==null)Z=d;else{var f=c.return;f===null?Z=null:(Z=f,Zi(f))}break b}}$=0,wu=null,Xi(e,t,o,5);break;case 6:$=0,wu=null,Xi(e,t,o,6);break;case 8:Li(),ku=6;break a;default:throw Error(i(462))}}qi();break}catch(t){zi(e,t)}while(1);return cl=sl=null,W.H=r,W.A=a,Y=n,Z===null?(X=null,Q=0,it(),ku):0}function qi(){for(;Z!==null&&!Tc();)Ji(Z)}function Ji(e){var t=Cr(e.alternate,e,Ou);e.memoizedProps=e.pendingProps,t===null?Zi(e):Z=t}function Yi(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=cr(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=cr(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:Pt(t);default:Lr(n,t),t=Z=ga(t,Ou),t=Cr(n,t,Ou)}e.memoizedProps=e.pendingProps,t===null?Zi(e):Z=t}function Xi(e,t,n,r){cl=sl=null,Pt(t),Al=null,jl=0;var i=t.return;try{if(Yn(e,i,t,n,Q)){ku=1,Wn(e,k(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;ku=1,Wn(e,k(n,e.current)),Z=null;return}t.flags&32768?(K||r===1?e=!0:Eu||Q&536870912?e=!1:(Tu=e=!0,(r===2||r===9||r===3||r===6)&&(r=Vl.current,r!==null&&r.tag===13&&(r.flags|=16384))),Qi(t,e)):Zi(t)}function Zi(e){var t=e;do{if(t.flags&32768){Qi(t,Tu);return}e=t.return;var n=Fr(t.alternate,t,Ou);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);ku===0&&(ku=5)}function Qi(e,t){do{var n=Ir(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);ku=6,Z=null}function $i(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do ia();while(Uu!==0);if(Y&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Il,w(e,n,o,s,c,l),e===X&&(Z=X=null,Q=0),Gu=t,Wu=e,Ku=n,qu=o,Ju=a,Yu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,fa(Ac,function(){return aa(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=W.T,W.T=null,a=bo(),yo(2),s=Y,Y|=4;try{Xr(e,t,n)}finally{Y=s,yo(a),W.T=r}}Uu=1,ea(),ta(),na()}}function ea(){if(Uu===1){Uu=0;var e=Wu,t=Gu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=W.T,W.T=null;var r=bo();yo(2);var i=Y;Y|=4;try{V(t,e),ro(e.containerInfo)}finally{Y=i,yo(r),W.T=n}}e.current=t,Uu=2}}function ta(){if(Uu===2){Uu=0;var e=Wu,t=Gu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=W.T,W.T=null;var r=bo();yo(2);var i=Y;Y|=4;try{Zr(e,t.alternate,t)}finally{Y=i,yo(r),W.T=n}}Uu=3}}function na(){if(Uu===4||Uu===3){Uu=0,Ec();var e=Wu,t=Gu,n=Ku,r=Yu;t.subtreeFlags&10256||t.flags&10256?Uu=5:(Uu=0,Gu=Wu=null,ra(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Hu=null),re(n),t=t.stateNode,Fc&&typeof Fc.onCommitFiberRoot==`function`)try{Fc.onCommitFiberRoot(Pc,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=W.T,i=bo(),yo(2),W.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{W.T=t,yo(i)}}Ku&3&&ia(),Pe(e),i=e.pendingLanes,n&261930&&i&42?e===Zu?Xu++:(Xu=0,Zu=e):Xu=0,go&&Bs(),Fe(0,!1)}}function ra(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Me(t)))}function ia(){return ea(),ta(),na(),aa()}function aa(){if(Uu!==5)return!1;var e=Wu,t=qu;qu=0;var n=re(Ku),r=32>n?32:n;n=W.T;var a=bo();try{yo(r),W.T=null,r=Ju,Ju=null;var o=Wu,s=Ku;if(Uu=0,Gu=Wu=null,Ku=0,Y&6)throw Error(i(331));var c=Y;if(Y|=4,xi(o.current),mi(o,o.current,s,r),Y=c,Fe(0,!1),Fc&&typeof Fc.onPostCommitFiberRoot==`function`)try{Fc.onPostCommitFiberRoot(Pc,o)}catch{}return!0}finally{yo(a),W.T=n,ra(e,t)}}function oa(e,t,n){t=k(n,t),t=Kn(e.stateNode,t,2),e=dt(e,t,2),e!==null&&(C(e,2),Pe(e))}function H(e,t,n){if(e.tag===3)oa(e,e,n);else for(;t!==null;){if(t.tag===3){oa(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Hu===null||!Hu.has(r))){e=k(n,e),n=qn(2),r=dt(t,n,2),r!==null&&(Jn(n,r,t,e),C(r,2),Pe(r));break}}t=t.return}}function sa(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Cu;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Du=!0,i.add(n),e=ca.bind(null,e,t,n),t.then(e,e))}function ca(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,X===e&&(Q&n)===n&&(ku===4||ku===3&&(Q&62914560)===Q&&300>Dc()-Ru?!(Y&2)&&Ri(e,0):Mu|=n,Pu===Q&&(Pu=0)),Pe(e)}function la(e,t){t===0&&(t=x()),e=st(e,t),e!==null&&(C(e,t),Pe(e))}function ua(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),la(e,n)}function da(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),la(e,n)}function fa(e,t){return Cc(e,t)}function pa(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ma(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ha(e,t){var r=e.alternate;return r===null?(r=n(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function ga(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function _a(e,t,r,a,o,s){var c=0;if(a=e,typeof e==`function`)ma(e)&&(c=1);else if(typeof e==`string`)c=Js&&cc?Ys(e,r,Qc.current)?26:fc(e)?27:5:Js?Ys(e,r,Qc.current)?26:5:cc&&fc(e)?27:5;else a:switch(e){case Ga:return e=n(31,r,t,o),e.elementType=Ga,e.lanes=s,e;case Fa:return va(r.children,o,s,t);case Ia:c=8,o|=24;break;case La:return e=n(12,r,t,o|2),e.elementType=La,e.lanes=s,e;case Va:return e=n(13,r,t,o),e.elementType=Va,e.lanes=s,e;case Ha:return e=n(19,r,t,o),e.elementType=Ha,e.lanes=s,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case za:c=10;break a;case Ra:c=9;break a;case Ba:c=11;break a;case Ua:c=14;break a;case Wa:c=16,a=null;break a}c=29,r=Error(i(130,e===null?`null`:typeof e,``)),a=null}return t=n(c,r,t,o),t.elementType=e,t.type=a,t.lanes=s,t}function va(e,t,r,i){return e=n(7,e,i,t),e.lanes=r,e}function ya(e,t,r){return e=n(6,e,null,t),e.lanes=r,e}function ba(e){var t=n(18,null,null,0);return t.stateNode=e,t}function xa(e,t,r){return t=n(4,e.children===null?[]:e.children,e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Sa(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=fo,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=S(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=S(0),this.hiddenUpdates=S(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Ca(e,t,r,i,a,o,s,c,l,u,d,f){return e=new Sa(e,t,r,s,l,u,d,f,c),t=1,!0===o&&(t|=24),o=n(3,null,null,t),e.current=o,o.stateNode=e,t=je(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:i,isDehydrated:r,cache:t},ct(o),e}function wa(e){return e?(e=gc,e):gc}function Ta(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=c(t),e=e===null?null:l(e),e===null?null:$a(e.stateNode)}function Ea(e,t,n,r,i,a){i=wa(i),r.context===null?r.context=i:r.pendingContext=i,r=ut(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=dt(e,r,t),n!==null&&(ji(n,e,t),ft(n,e,t))}function Da(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Oa(e,t){Da(e,t),(e=e.alternate)&&Da(e,t)}var U={},ka=t(),Aa=a(),ja=Object.assign,Ma=Symbol.for(`react.element`),Na=Symbol.for(`react.transitional.element`),Pa=Symbol.for(`react.portal`),Fa=Symbol.for(`react.fragment`),Ia=Symbol.for(`react.strict_mode`),La=Symbol.for(`react.profiler`),Ra=Symbol.for(`react.consumer`),za=Symbol.for(`react.context`),Ba=Symbol.for(`react.forward_ref`),Va=Symbol.for(`react.suspense`),Ha=Symbol.for(`react.suspense_list`),Ua=Symbol.for(`react.memo`),Wa=Symbol.for(`react.lazy`),Ga=Symbol.for(`react.activity`),Ka=Symbol.for(`react.memo_cache_sentinel`),qa=Symbol.iterator,Ja=Symbol.for(`react.client.reference`),Ya=Array.isArray,W=ka.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Xa=e.rendererVersion,Za=e.rendererPackageName,Qa=e.extraDevToolsConfig,$a=e.getPublicInstance,eo=e.getRootHostContext,to=e.getChildHostContext,no=e.prepareForCommit,ro=e.resetAfterCommit,io=e.createInstance;e.cloneMutableInstance;var ao=e.appendInitialChild,oo=e.finalizeInitialChildren,so=e.shouldSetTextContent,co=e.createTextInstance;e.cloneMutableTextInstance;var lo=e.scheduleTimeout,uo=e.cancelTimeout,fo=e.noTimeout,po=e.isPrimaryRenderer;e.warnsIfNotActing;var mo=e.supportsMutation,ho=e.supportsPersistence,go=e.supportsHydration,_o=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var vo=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var yo=e.setCurrentUpdatePriority,bo=e.getCurrentUpdatePriority,xo=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var So=e.shouldAttemptEagerTransition,Co=e.detachDeletedInstance;e.requestPostPaintCallback;var wo=e.maySuspendCommit,To=e.maySuspendCommitOnUpdate,Eo=e.maySuspendCommitInSyncRender,Do=e.preloadInstance,Oo=e.startSuspendingCommit,ko=e.suspendInstance;e.suspendOnActiveViewTransition;var Ao=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var jo=e.NotPendingTransition,Mo=e.HostTransitionContext,No=e.resetFormInstance;e.bindToConsole;var Po=e.supportsMicrotasks,Fo=e.scheduleMicrotask,Io=e.supportsTestSelectors,Lo=e.findFiberRoot,Ro=e.getBoundingRect,zo=e.getTextContent,Bo=e.isHiddenSubtree,Vo=e.matchAccessibilityRole,Ho=e.setFocusIfFocusable,Uo=e.setupIntersectionObserver,Wo=e.appendChild,Go=e.appendChildToContainer,Ko=e.commitTextUpdate,qo=e.commitMount,Jo=e.commitUpdate,Yo=e.insertBefore,Xo=e.insertInContainerBefore,Zo=e.removeChild,Qo=e.removeChildFromContainer,$o=e.resetTextContent,es=e.hideInstance,ts=e.hideTextInstance,ns=e.unhideInstance,rs=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var is=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var as=e.cloneInstance,os=e.createContainerChildSet,ss=e.appendChildToContainerChildSet,cs=e.finalizeContainerChildren,ls=e.replaceContainerChildren,us=e.cloneHiddenInstance,ds=e.cloneHiddenTextInstance,fs=e.isSuspenseInstancePending,ps=e.isSuspenseInstanceFallback,ms=e.getSuspenseInstanceFallbackErrorDetails,hs=e.registerSuspenseInstanceRetry,gs=e.canHydrateFormStateMarker,_s=e.isFormStateMarkerMatching,vs=e.getNextHydratableSibling,ys=e.getNextHydratableSiblingAfterSingleton,bs=e.getFirstHydratableChild,xs=e.getFirstHydratableChildWithinContainer,Ss=e.getFirstHydratableChildWithinActivityInstance,Cs=e.getFirstHydratableChildWithinSuspenseInstance,ws=e.getFirstHydratableChildWithinSingleton,Ts=e.canHydrateInstance,Es=e.canHydrateTextInstance,Ds=e.canHydrateActivityInstance,Os=e.canHydrateSuspenseInstance,ks=e.hydrateInstance,As=e.hydrateTextInstance,js=e.hydrateActivityInstance,Ms=e.hydrateSuspenseInstance,Ns=e.getNextHydratableInstanceAfterActivityInstance,Ps=e.getNextHydratableInstanceAfterSuspenseInstance,Fs=e.commitHydratedInstance,Is=e.commitHydratedContainer,Ls=e.commitHydratedActivityInstance,Rs=e.commitHydratedSuspenseInstance,zs=e.finalizeHydratedChildren,Bs=e.flushHydrationEvents;e.clearActivityBoundary;var Vs=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Hs=e.clearSuspenseBoundaryFromContainer,Us=e.hideDehydratedBoundary,Ws=e.unhideDehydratedBoundary,Gs=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var Ks=e.validateHydratableInstance,qs=e.validateHydratableTextInstance,Js=e.supportsResources,Ys=e.isHostHoistableType,Xs=e.getHoistableRoot,Zs=e.getResource,Qs=e.acquireResource,$s=e.releaseResource,ec=e.hydrateHoistable,tc=e.mountHoistable,nc=e.unmountHoistable,rc=e.createHoistableInstance,ic=e.prepareToCommitHoistables,ac=e.mayResourceSuspendCommit,oc=e.preloadResource,sc=e.suspendResource,cc=e.supportsSingletons,lc=e.resolveSingletonInstance,uc=e.acquireSingletonInstance,dc=e.releaseSingletonInstance,fc=e.isHostSingletonType,pc=e.isSingletonScope,mc=[],hc=-1,gc={},_c=Math.clz32?Math.clz32:g,vc=Math.log,yc=Math.LN2,bc=256,xc=262144,Sc=4194304,Cc=Aa.unstable_scheduleCallback,wc=Aa.unstable_cancelCallback,Tc=Aa.unstable_shouldYield,Ec=Aa.unstable_requestPaint,Dc=Aa.unstable_now,Oc=Aa.unstable_ImmediatePriority,kc=Aa.unstable_UserBlockingPriority,Ac=Aa.unstable_NormalPriority,jc=Aa.unstable_IdlePriority,Mc=Aa.log,Nc=Aa.unstable_setDisableYieldValue,Pc=null,Fc=null,Ic=typeof Object.is==`function`?Object.is:ae,Lc=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Rc=Object.prototype.hasOwnProperty,zc,Bc,Vc=!1,Hc=new WeakMap,Uc=[],Wc=0,Gc=null,Kc=0,qc=[],Jc=0,Yc=null,Xc=1,Zc=``,Qc=p(null),$c=p(null),el=p(null),tl=p(null),nl=null,G=null,K=!1,rl=null,il=!1,al=Error(i(519)),ol=p(null),sl=null,cl=null,ll=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ul=Aa.unstable_scheduleCallback,dl=Aa.unstable_NormalPriority,fl={$$typeof:za,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},pl=null,ml=null,hl=!1,gl=!1,_l=!1,vl=0,yl=null,bl=0,xl=0,Sl=null,Cl=W.S;W.S=function(e,t){zu=Dc(),typeof t==`object`&&t&&typeof t.then==`function`&&He(e,t),Cl!==null&&Cl(e,t)};var wl=p(null),Tl=Error(i(460)),El=Error(i(474)),Dl=Error(i(542)),Ol={then:function(){}},kl=null,Al=null,jl=0,Ml=rt(!0),Nl=rt(!1),Pl=[],Fl=0,Il=0,Ll=!1,Rl=!1,zl=p(null),Bl=p(0),Vl=p(null),Hl=null,Ul=p(0),Wl=0,q=null,J=null,Gl=null,Kl=!1,ql=!1,Jl=!1,Yl=0,Xl=0,Zl=null,Ql=0,$l={readContext:Oe,use:Rt,useCallback:F,useContext:F,useEffect:F,useImperativeHandle:F,useLayoutEffect:F,useInsertionEffect:F,useMemo:F,useReducer:F,useRef:F,useState:F,useDebugValue:F,useDeferredValue:F,useTransition:F,useSyncExternalStore:F,useId:F,useHostTransitionStatus:F,useFormState:F,useActionState:F,useOptimistic:F,useMemoCache:F,useCacheRefresh:F};$l.useEffectEvent=F;var eu={readContext:Oe,use:Rt,useCallback:function(e,t){return Ft().memoizedState=[e,t===void 0?null:t],e},useContext:Oe,useEffect:mn,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),fn(4194308,4,bn.bind(null,t,e),n)},useLayoutEffect:function(e,t){return fn(4194308,4,e,t)},useInsertionEffect:function(e,t){fn(4,2,e,t)},useMemo:function(e,t){var n=Ft();t=t===void 0?null:t;var r=e();if(Jl){ie(!0);try{e()}finally{ie(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ft();if(n!==void 0){var i=n(t);if(Jl){ie(!0);try{n(t)}finally{ie(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Nn.bind(null,q,e),[r.memoizedState,e]},useRef:function(e){var t=Ft();return e={current:e},t.memoizedState=e},useState:function(e){e=Xt(e);var t=e.queue,n=Pn.bind(null,q,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Sn,useDeferredValue:function(e,t){return Tn(Ft(),e,t)},useTransition:function(){var e=Xt(!1);return e=Dn.bind(null,q,e.queue,!0,!1),Ft().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=q,a=Ft();if(K){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),X===null)throw Error(i(349));Q&127||Gt(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,mn(qt.bind(null,r,o,e),[e]),r.flags|=2048,dn(9,{destroy:void 0},Kt.bind(null,r,o,n,t),null),n},useId:function(){var e=Ft(),t=X.identifierPrefix;if(K){var n=Zc,r=Xc;n=(r&~(1<<32-_c(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Yl++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Ql++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:kn,useFormState:on,useActionState:on,useOptimistic:function(e){var t=Ft();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=In.bind(null,q,!0,n),n.dispatch=t,[e,t]},useMemoCache:zt,useCacheRefresh:function(){return Ft().memoizedState=Mn.bind(null,q)},useEffectEvent:function(e){var t=Ft(),n={impl:e};return t.memoizedState=n,function(){if(Y&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},tu={readContext:Oe,use:Rt,useCallback:Cn,useContext:Oe,useEffect:hn,useImperativeHandle:xn,useInsertionEffect:vn,useLayoutEffect:yn,useMemo:wn,useReducer:Vt,useRef:L,useState:function(){return Vt(Bt)},useDebugValue:Sn,useDeferredValue:function(e,t){return En(I(),J.memoizedState,e,t)},useTransition:function(){var e=Vt(Bt)[0],t=I().memoizedState;return[typeof e==`boolean`?e:Lt(e),t]},useSyncExternalStore:Wt,useId:An,useHostTransitionStatus:kn,useFormState:sn,useActionState:sn,useOptimistic:function(e,t){return Zt(I(),J,e,t)},useMemoCache:zt,useCacheRefresh:jn};tu.useEffectEvent=_n;var nu={readContext:Oe,use:Rt,useCallback:Cn,useContext:Oe,useEffect:hn,useImperativeHandle:xn,useInsertionEffect:vn,useLayoutEffect:yn,useMemo:wn,useReducer:Ut,useRef:L,useState:function(){return Ut(Bt)},useDebugValue:Sn,useDeferredValue:function(e,t){var n=I();return J===null?Tn(n,e,t):En(n,J.memoizedState,e,t)},useTransition:function(){var e=Ut(Bt)[0],t=I().memoizedState;return[typeof e==`boolean`?e:Lt(e),t]},useSyncExternalStore:Wt,useId:An,useHostTransitionStatus:kn,useFormState:un,useActionState:un,useOptimistic:function(e,t){var n=I();return J===null?(n.baseState=e,[e,n.queue.dispatch]):Zt(n,J,e,t)},useMemoCache:zt,useCacheRefresh:jn};nu.useEffectEvent=_n;var ru={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ki(),i=ut(r);i.payload=t,n!=null&&(i.callback=n),t=dt(e,i,r),t!==null&&(ji(t,e,r),ft(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ki(),i=ut(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=dt(e,i,r),t!==null&&(ji(t,e,r),ft(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ki(),r=ut(n);r.tag=2,t!=null&&(r.callback=t),t=dt(e,r,n),t!==null&&(ji(t,e,n),ft(t,e,n))}},iu=Error(i(461)),au=!1,ou={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},su=!1,cu=!1,lu=!1,uu=typeof WeakSet==`function`?WeakSet:Set,du=null,fu=null,pu=!1,mu=null,hu=8192,gu={getCacheForType:function(e){var t=Oe(fl),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Oe(fl).controller.signal}},_u=0,vu=1,yu=2,bu=3,xu=4;if(typeof Symbol==`function`&&Symbol.for){var Su=Symbol.for;_u=Su(`selector.component`),vu=Su(`selector.has_pseudo_class`),yu=Su(`selector.role`),bu=Su(`selector.test_id`),xu=Su(`selector.text`)}var Cu=typeof WeakMap==`function`?WeakMap:Map,Y=0,X=null,Z=null,Q=0,$=0,wu=null,Tu=!1,Eu=!1,Du=!1,Ou=0,ku=0,Au=0,ju=0,Mu=0,Nu=0,Pu=0,Fu=null,Iu=null,Lu=!1,Ru=0,zu=0,Bu=1/0,Vu=null,Hu=null,Uu=0,Wu=null,Gu=null,Ku=0,qu=0,Ju=null,Yu=null,Xu=0,Zu=null;return U.attemptContinuousHydration=function(e){if(e.tag===13||e.tag===31){var t=st(e,67108864);t!==null&&ji(t,e,67108864),Oa(e,67108864)}},U.attemptHydrationAtCurrentPriority=function(e){if(e.tag===13||e.tag===31){var t=ki();t=T(t);var n=st(e,t);n!==null&&ji(n,e,t),Oa(e,t)}},U.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if(e=e.stateNode,e.current.memoizedState.isDehydrated){var t=_(e.pendingLanes);if(t!==0){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-_c(t);e.entanglements[1]|=n,t&=~n}Pe(e),!(Y&6)&&(Bu=Dc()+500,Fe(0,!1))}}break;case 31:case 13:t=st(e,2),t!==null&&ji(t,e,2),Ii(),Oa(e,2)}},U.batchedUpdates=function(e,t){return e(t)},U.createComponentSelector=function(e){return{$$typeof:_u,value:e}},U.createContainer=function(e,t,n,r,i,a,o,s,c,l){return Ca(e,t,!1,null,n,r,a,null,o,s,c,l)},U.createHasPseudoClassSelector=function(e){return{$$typeof:vu,value:e}},U.createHydrationContainer=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p){return e=Ca(n,r,!0,e,i,a,s,p,c,l,u,d),e.context=wa(null),n=e.current,r=ki(),r=T(r),i=ut(r),i.callback=t??null,dt(n,i,r),t=r,e.current.lanes=t,C(e,t),Pe(e),e},U.createPortal=function(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Pa,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}},U.createRoleSelector=function(e){return{$$typeof:yu,value:e}},U.createTestNameSelector=function(e){return{$$typeof:bu,value:e}},U.createTextSelector=function(e){return{$$typeof:xu,value:e}},U.defaultOnCaughtError=function(e){console.error(e)},U.defaultOnRecoverableError=function(e){Lc(e)},U.defaultOnUncaughtError=function(e){Lc(e)},U.deferredUpdates=function(e){var t=W.T,n=bo();try{return yo(32),W.T=null,e()}finally{yo(n),W.T=t}},U.discreteUpdates=function(e,t,n,r,i){var a=W.T,o=bo();try{return yo(2),W.T=null,e(t,n,r,i)}finally{yo(o),W.T=a,Y===0&&(Bu=Dc()+500)}},U.findAllNodes=Oi,U.findBoundingRects=function(e,t){if(!Io)throw Error(i(363));t=Oi(e,t),e=[];for(var n=0;n<t.length;n++)e.push(Ro(t[n]));for(t=e.length-1;0<t;t--){n=e[t];for(var r=n.x,a=r+n.width,o=n.y,s=o+n.height,c=t-1;0<=c;c--)if(t!==c){var l=e[c],u=l.x,d=u+l.width,f=l.y,p=f+l.height;if(r>=u&&o>=f&&a<=d&&s<=p){e.splice(t,1);break}else if(!(r!==u||n.width!==l.width||p<o||f>s)){f>o&&(l.height+=f-o,l.y=o),p<s&&(l.height=s-f),e.splice(t,1);break}else if(!(o!==f||n.height!==l.height||d<r||u>a)){u>r&&(l.width+=u-r,l.x=r),d<a&&(l.width=a-u),e.splice(t,1);break}}}return e},U.findHostInstance=Ta,U.findHostInstanceWithNoPortals=function(e){return e=c(e),e=e===null?null:u(e),e===null?null:$a(e.stateNode)},U.findHostInstanceWithWarning=function(e){return Ta(e)},U.flushPassiveEffects=ia,U.flushSyncFromReconciler=function(e){var t=Y;Y|=1;var n=W.T,r=bo();try{if(yo(2),W.T=null,e)return e()}finally{yo(r),W.T=n,Y=t,!(Y&6)&&Fe(0,!1)}},U.flushSyncWork=Ii,U.focusWithin=function(e,t){if(!Io)throw Error(i(363));for(e=wi(e),t=Di(e,t),t=Array.from(t),e=0;e<t.length;){var n=t[e++],r=n.tag;if(!Bo(n)){if((r===5||r===26||r===27)&&Ho(n.stateNode))return!0;for(n=n.child;n!==null;)t.push(n),n=n.sibling}}return!1},U.getFindAllNodesFailureDescription=function(e,t){if(!Io)throw Error(i(363));var n=0,r=[];e=[wi(e),0];for(var a=0;a<e.length;){var o=e[a++],s=o.tag,c=e[a++],l=t[c];if((s!==5&&s!==26&&s!==27||!Bo(o))&&(Ti(o,l)&&(r.push(Ei(l)),c++,c>n&&(n=c)),c<t.length))for(o=o.child;o!==null;)e.push(o,c),o=o.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(Ei(t[n]));return`findAllNodes was able to match part of the selector:
|
|
23
|
+
`+(r.join(` > `)+`
|
|
24
|
+
|
|
25
|
+
No matching component was found for:
|
|
26
|
+
`)+e.join(` > `)}return null},U.getPublicRootInstance=function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 27:case 5:return $a(e.child.stateNode);default:return e.child.stateNode}},U.injectIntoDevTools=function(){var e={bundleType:0,version:Xa,rendererPackageName:Za,currentDispatcherRef:W,reconcilerVersion:`19.2.0`};if(Qa!==null&&(e.rendererConfig=Qa),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Pc=t.inject(e),Fc=t}catch{}e=!!t.checkDCE}}return e},U.isAlreadyRendering=function(){return(Y&6)!=0},U.observeVisibleRects=function(e,t,n,r){if(!Io)throw Error(i(363));e=Oi(e,t);var a=Uo(e,n,r).disconnect;return{disconnect:function(){a()}}},U.shouldError=function(){return null},U.shouldSuspend=function(){return!1},U.startHostTransition=function(e,t,n,a){if(e.tag!==5)throw Error(i(476));var o=On(e).queue;Dn(e,o,t,jo,n===null?r:function(){var t=On(e);return t.next===null&&(t=e.alternate.memoizedState),Fn(e,t.next.queue,{},ki()),n(a)})},U.updateContainer=function(e,t,n,r){var i=t.current,a=ki();return Ea(i,a,e,t,n,r),a},U.updateContainerSync=function(e,t,n,r){return Ea(t.current,2,e,t,n,r),2},U},n.exports.default=n.exports,Object.defineProperty(n.exports,"__esModule",{value:!0})})),Ii=i(((e,t)=>{t.exports=Fi()})),Li=i((e=>{e.ConcurrentRoot=1,e.DefaultEventPriority=32,e.DiscreteEventPriority=2})),Ri=i(((e,t)=>{t.exports=Li()})),zi=n(Ii()),Bi=Ri(),Vi={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0},Hi=!1,Ui=!1,Wi=`.react-konva-event`,Gi=!1,Ki=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
|
|
27
|
+
Position of a node will be changed during drag&drop, so you should update state of the react app as well.
|
|
28
|
+
Consider to add onDragMove or onDragEnd events.
|
|
29
|
+
For more info see: https://github.com/konvajs/react-konva/issues/256
|
|
30
|
+
`,qi=`ReactKonva: You are using "zIndex" attribute for a Konva node.
|
|
31
|
+
react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
|
|
32
|
+
For more info see: https://github.com/konvajs/react-konva/issues/194
|
|
33
|
+
`,Ji={},Yi=()=>{};function Xi(e){Yi=e}var Zi=!1;function Qi(e){return function(...t){let n=e.apply(this,t);if(!Zi){Zi=!0;try{Yi()}finally{Zi=!1}}return n}}function $i(e,t,n=Ji){if(!Hi&&`zIndex`in t&&(console.warn(qi),Hi=!0),!Ui&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(Ki),Ui=!0)}for(var a in n)if(!Vi[a]){var o=a.slice(0,2)===`on`,s=n[a]!==t[a];if(o&&s){var c=a.substr(2).toLowerCase();c.substr(0,7)===`content`&&(c=`content`+c.substr(7,1).toUpperCase()+c.substr(8)),e.off(c+Wi)}t.hasOwnProperty(a)||e.setAttr(a,void 0)}var l=Gi||t._useStrictMode,u={},d=!1;let f={};for(var a in t)if(!Vi[a]){var o=a.slice(0,2)===`on`,p=n[a]!==t[a];if(o&&p){var c=a.substr(2).toLowerCase();c.substr(0,7)===`content`&&(c=`content`+c.substr(7,1).toUpperCase()+c.substr(8)),t[a]&&(f[c]=t[a])}!o&&(t[a]!==n[a]||l&&t[a]!==e.getAttr(a))&&(d=!0,u[a]=t[a])}for(var c in d&&(e.setAttrs(u),ea(e)),f)e.off(c+Wi),e.on(c+Wi,Qi(f[c]))}function ea(e){if(!d.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}var ta=r({HostTransitionContext:()=>eo,NotPendingTransition:()=>null,afterActiveInstanceBlur:()=>Ra,appendChild:()=>Sa,appendChildToContainer:()=>Ca,appendInitialChild:()=>oa,beforeActiveInstanceBlur:()=>La,cancelTimeout:()=>ya,clearContainer:()=>Pa,commitMount:()=>U,commitTextUpdate:()=>Oa,commitUpdate:()=>ka,createInstance:()=>H,createTextInstance:()=>sa,detachDeletedInstance:()=>Fa,finalizeInitialChildren:()=>ca,getChildHostContext:()=>_a,getCurrentEventPriority:()=>za,getCurrentUpdatePriority:()=>Ua,getInstanceFromNode:()=>Ia,getInstanceFromScope:()=>Va,getPublicInstance:()=>la,getRootHostContext:()=>ga,hideInstance:()=>Aa,hideTextInstance:()=>ja,idlePriority:()=>na.unstable_IdlePriority,insertBefore:()=>wa,insertInContainerBefore:()=>Ta,isPrimaryRenderer:()=>!1,maySuspendCommit:()=>W,noTimeout:()=>-1,now:()=>na.unstable_now,preloadInstance:()=>Xa,prepareForCommit:()=>ua,preparePortalMount:()=>da,prepareScopeUpdate:()=>Ba,prepareUpdate:()=>fa,removeChild:()=>Ea,removeChildFromContainer:()=>Da,requestPostPaintCallback:()=>Ya,resetAfterCommit:()=>pa,resetFormInstance:()=>to,resetTextContent:()=>ma,resolveEventTimeStamp:()=>Ja,resolveEventType:()=>qa,resolveUpdatePriority:()=>Wa,run:()=>na.unstable_runWithPriority,scheduleMicrotask:()=>ba,scheduleTimeout:()=>va,setCurrentUpdatePriority:()=>Ha,shouldAttemptEagerTransition:()=>Ga,shouldDeprioritizeSubtree:()=>ha,shouldSetTextContent:()=>xa,startSuspendingCommit:()=>Za,supportsHydration:()=>!1,supportsMicrotasks:()=>!0,supportsMutation:()=>!0,supportsPersistence:()=>!1,suspendInstance:()=>Qa,trackSchedulerEvent:()=>Ka,unhideInstance:()=>Ma,unhideTextInstance:()=>Na,waitForCommitToBeReady:()=>$a,warnsIfNotActing:()=>!1}),na=a(),ra={},ia={};Pi.Node.prototype._applyProps=$i;var aa=Bi.DefaultEventPriority;function oa(e,t){if(typeof t==`string`){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),ea(e)}function H(e,t,n){let r=Pi[e];r||=(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" 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`),Pi.Group);let i={},a={};for(var o in t)o!==`ref`&&(o.slice(0,2)===`on`?a[o]=t[o]:i[o]=t[o]);let s=new r(i);return $i(s,a),s}function sa(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function ca(e,t,n){return!1}function la(e){return e}function ua(){return null}function da(){return null}function fa(e,t,n,r){return ia}function pa(){}function ma(e){}function ha(e,t){return!1}function ga(){return ra}function _a(){return ra}var va=setTimeout,ya=clearTimeout,ba=typeof queueMicrotask==`function`?queueMicrotask:e=>Promise.resolve(null).then(e);function xa(e,t){return!1}function Sa(e,t){t.parent===e?t.moveToTop():e.add(t),ea(e)}function Ca(e,t){t.parent===e?t.moveToTop():e.add(t),ea(e)}function wa(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),ea(e)}function Ta(e,t,n){wa(e,t,n)}function Ea(e,t){t.destroy(),t.off(Wi),ea(e)}function Da(e,t){t.destroy(),t.off(Wi),ea(e)}function Oa(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function U(e,t,n){}function ka(e,t,n,r){$i(e,r,n)}function Aa(e){e.hide(),ea(e)}function ja(e){}function Ma(e,t){(t.visible==null||t.visible)&&e.show()}function Na(e,t){}function Pa(e){}function Fa(){}function Ia(){return null}function La(){}function Ra(){}function za(){return Bi.DefaultEventPriority}function Ba(){}function Va(){return null}function Ha(e){aa=e}function Ua(){return aa}function Wa(){return Bi.DiscreteEventPriority}function Ga(){return!1}function Ka(){}function qa(){return null}function Ja(){return-1.1}function Ya(){}function W(){return!1}function Xa(){return!0}function Za(){}function Qa(){}function $a(){return null}var eo=o.createContext(null);function to(){}typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)?o.useLayoutEffect:o.useEffect;function no(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){let e=no(r,t,n);if(e)return e;r=t?null:r.sibling}}function ro(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}var io=ro(o.createContext(null)),ao=class extends o.Component{render(){return o.createElement(io.Provider,{value:this._reactInternals},this.props.children)}};function oo(){let e=o.useContext(io);if(e===null)throw Error(`its-fine: useFiber must be called within a <FiberProvider />!`);let t=o.useId();return o.useMemo(()=>{for(let n of[e,e?.alternate]){if(!n)continue;let e=no(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}var so=Symbol.for(`react.context`),co=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===so;function lo(){let e=oo(),[t]=o.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;co(e)&&e!==io&&!t.has(e)&&t.set(e,o.use(ro(e))),n=n.return}return t}function uo(){let e=lo();return o.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>o.createElement(t,null,o.createElement(n.Provider,{...r,value:e.get(n)})),e=>o.createElement(ao,{...e})),[e])}function fo(e){let t=o.useRef({});return o.useLayoutEffect(()=>{t.current=e}),o.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}var po=()=>{let e=o.useRef(0);return o.useMemo(()=>{e.current++},[]),e.current>1},mo=e=>{let t=o.useRef(null),n=o.useRef(null),r=o.useRef(null),i=fo(e),a=uo(),s=o.useRef(null),c=t=>{let{forwardedRef:n}=e;n&&(typeof n==`function`?n(t):n.current=t)},l=po(),u=()=>{c(null),So.flushSyncFromReconciler(()=>{So.updateContainer(null,r.current,null)}),n.current?.destroy(),n.current=null};return o.useLayoutEffect(()=>(s.current&&=(clearTimeout(s.current),null),n.current?c(n.current):(n.current=new Pi.Stage({width:e.width,height:e.height,container:t.current}),c(n.current),r.current=So.createContainer(n.current,Bi.ConcurrentRoot,null,!1,null,``,console.error,console.error,console.error,null),So.updateContainer(o.createElement(a,{},e.children),r.current,null,()=>{})),()=>{l?s.current=setTimeout(u,0):u()}),[]),o.useLayoutEffect(()=>{c(n.current),$i(n.current,e,i),So.updateContainer(o.createElement(a,{},e.children),r.current,null),So.flushSyncWork()}),o.createElement(`div`,{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},ho=`Layer`,go=`Group`,_o=`Rect`,vo=`Circle`,yo=`Line`,bo=`Text`,xo=`Arrow`,So=(0,zi.default)(ta);Xi(()=>So.flushSyncWork());var Co=o.forwardRef((e,t)=>o.createElement(ao,{},o.createElement(mo,{...e,forwardedRef:t}))),wo={rect:`#ef4444`,polygon:`#3b82f6`,grid:`#6366f1`,line:`#f59e0b`},To=`33`,Eo=`66`,Do=`#6366f1`,Oo=3,ko=2,Ao=12,jo=16,Mo=9;function No(e,t,n){return{x:e.x*t,y:e.y*n}}function Po(e,t,n){return{x:e.x/t,y:e.y/n}}function Fo(e,t,n){return e.flatMap(e=>[e.x*t,e.y*n])}function Io(e){return!Number.isFinite(e)||e<0?0:e>1?1:e}function Lo(e){return e.color??wo[e.shape.kind]}function Ro(e,t){let n=e[t],r=e[(t+1)%e.length];if(!n||!r)return[...e];let i={x:(n.x+r.x)/2,y:(n.y+r.y)/2};return[...e.slice(0,t+1),i,...e.slice(t+1)]}function zo(e,t){return e.length===t.length?e.every((e,n)=>{let r=t[n];return Math.abs(e.x-r.x)<1e-6&&Math.abs(e.y-r.y)<1e-6}):!1}function Bo(e){return e.kind===`polygon`||e.kind===`line`}function Vo({items:e,selectedId:t,onSelect:n,onShapeChange:r,onDrawComplete:i,drawingKind:a,supportedShapes:c,transparent:l=!1,backdrop:u,polygonVertices:d,grid:f}){let p=(0,o.useRef)(null),[m,h]=(0,o.useState)({w:800,h:450}),[g,_]=(0,o.useState)([]),[v,y]=(0,o.useState)(null),[b,x]=(0,o.useState)(null),[S,C]=(0,o.useState)(null),w=a!==null&&c.includes(a);(0,o.useEffect)(()=>{if(!S)return;let t=e.find(e=>e.id===S.itemId);if(!t||!Bo(t.shape)){C(null);return}zo(t.shape.points,S.points)&&C(null)},[e,S]),(0,o.useEffect)(()=>{let e=p.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0];if(!t)return;let{width:n,height:r}=t.contentRect;h(l?{w:n,h:r}:{w:n,h:n*9/16})});return t.observe(e),()=>t.disconnect()},[l]),(0,o.useEffect)(()=>{!w&&v!==null&&y(null)},[w,v]);let ee=(0,o.useCallback)(e=>{i(e),_([])},[i]),te=(0,o.useCallback)(e=>{if(!w||a===null){n(null);return}let t=e.target.getStage();if(!t)return;let r=t.getPointerPosition();if(!r)return;let i=Po(r,m.w,m.h);if(a===`rect`){let e=Io(i.x),t=Io(i.y);ee({kind:`rect`,x:e,y:t,width:Math.min(.2,1-e),height:Math.min(.2,1-t)});return}if(a===`grid`){let e=f?.width??jo,t=f?.height??Mo;ee({kind:`grid`,gridWidth:e,gridHeight:t,cells:Array.from({length:e*t},()=>!1)});return}if(a===`line`){if(g.length===0){_([i]);return}ee({kind:`line`,points:[...g,i]});return}if(a===`polygon`){if(g.length===0){_([i]);return}if(g.length>=Oo){let e=No(g[0],m.w,m.h);if(Math.hypot(r.x-e.x,r.y-e.y)<Ao){ee({kind:`polygon`,points:g});return}}_(e=>[...e,i])}},[w,a,g,m,f,ee,n]),ne=(0,o.useCallback)(e=>{!w||a!==`polygon`||g.length<Oo||(e.cancelBubble=!0,ee({kind:`polygon`,points:g}))},[w,a,g,ee]),T=(0,o.useRef)(null),re=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{T.current!==null&&cancelAnimationFrame(T.current)},[]);let ie=(0,o.useCallback)(e=>{if(!w)return;let t=e.target.getStage();t&&(re.current=t.getPointerPosition()??null,T.current===null&&(T.current=requestAnimationFrame(()=>{T.current=null,y(re.current)})))},[w]),ae=(0,o.useRef)(!1),oe=(0,o.useRef)(!0),E=(0,o.useRef)(new Set),D=(0,o.useCallback)((e,t,n,i)=>{let a=t.gridWidth*t.gridHeight;if(n<0||n>=a||t.cells[n]===i)return;let o=[...t.cells];for(;o.length<a;)o.push(!1);o.length=a,o[n]=i,r(e,{...t,cells:o})},[r]),O=[];if(!l){for(let e=1;e<jo;e++){let t=m.w/jo*e;O.push((0,s.jsx)(yo,{points:[t,0,t,m.h],stroke:`#ffffff`,strokeWidth:.5,opacity:.08},`gv-${e}`))}for(let e=1;e<Mo;e++){let t=m.h/Mo*e;O.push((0,s.jsx)(yo,{points:[0,t,m.w,t],stroke:`#ffffff`,strokeWidth:.5,opacity:.08},`gh-${e}`))}}return(0,s.jsxs)(`div`,{ref:p,className:l?`absolute inset-0`:`relative w-full bg-zinc-900 rounded-lg overflow-hidden`,style:{cursor:w?`crosshair`:`default`},children:[u&&!l?(0,s.jsx)(`div`,{className:`absolute inset-0 pointer-events-none [&>*]:w-full [&>*]:h-full [&>img]:object-cover [&>video]:object-cover`,style:{width:m.w,height:m.h},children:u}):null,(0,s.jsxs)(Co,{width:m.w,height:m.h,onClick:te,onDblClick:ne,onMouseMove:ie,children:[(0,s.jsxs)(ho,{listening:!1,children:[(0,s.jsx)(yo,{points:[0,0,m.w,0,m.w,m.h,0,m.h,0,0],stroke:`transparent`,strokeWidth:0}),O]}),(0,s.jsx)(ho,{children:e.map(e=>{let i=e.id===t,a=e.enabled===!1,o=Lo(e),c=i&&!w&&!a;if(e.shape.kind===`rect`)return(0,s.jsx)(Wo,{item:e,shape:e.shape,color:o,selected:i,dimmed:a,editable:c,isDrawing:w,size:m,onSelect:n,onShapeChange:r},e.id);if(e.shape.kind===`grid`)return(0,s.jsx)(Go,{item:e,shape:e.shape,color:o,dimmed:a,editable:c,size:m,onSelect:n,paintingRef:ae,paintValueRef:oe,paintedRef:E,paintCell:D},e.id);let l=e.shape.kind===`line`,u=l?ko:Math.max(Oo,d?.min??Oo),f=l?ko:d?.max,p=S&&S.itemId===e.id?S.points:e.shape.points;return(0,s.jsx)(Ko,{item:e,shape:e.shape,color:o,selected:i,dimmed:a,editable:c,isLine:l,isDrawing:w,size:m,effectivePoints:p,minVertices:u,maxVertices:f,isDragging:b===e.id,onSelect:n,onShapeChange:r,setDragOverride:C,setDraggingItemId:x},e.id)})}),(0,s.jsx)(ho,{listening:!1,children:w&&g.length>0&&(0,s.jsxs)(`Group`,{children:[a===`polygon`&&g.length>=2&&(0,s.jsx)(`Line`,{points:Fo(g,m.w,m.h),stroke:Do,strokeWidth:1.5,dash:[6,3],opacity:.8}),a===`line`&&g.length===1&&v&&(0,s.jsx)(`Line`,{points:[g[0].x*m.w,g[0].y*m.h,v.x,v.y],stroke:wo.line,strokeWidth:1.5,dash:[6,3],opacity:.7}),a===`polygon`&&v&&g.length>=1&&(0,s.jsx)(`Line`,{points:[g[g.length-1].x*m.w,g[g.length-1].y*m.h,v.x,v.y],stroke:Do,strokeWidth:1,dash:[4,4],opacity:.5}),g.map((e,t)=>{let n=No(e,m.w,m.h),r=t===0&&a===`polygon`&&g.length>=Oo;return(0,s.jsx)(`Circle`,{x:n.x,y:n.y,radius:r?7:4,fill:r?Do:`#ffffff`,stroke:Do,strokeWidth:1.5,opacity:.9},t)})]})})]}),w?(0,s.jsx)(`div`,{className:`px-3 py-1.5 bg-zinc-800/80 text-[11px] text-zinc-400 border-t border-zinc-700`,children:a===`line`?`Click to set the start point, click again to complete the line`:a===`rect`?`Click to drop a rectangle, then drag the corner to resize`:a===`grid`?`Click to add the grid, then paint cells`:g.length<Oo?`Click to add points (min 3). Double-click or click the first point to close.`:`Continue adding points. Double-click or click the first point to close.`}):null]})}var Ho=.02;function Uo(e,t){return Math.abs(e.x-t.x)<1e-6&&Math.abs(e.y-t.y)<1e-6&&Math.abs(e.width-t.width)<1e-6&&Math.abs(e.height-t.height)<1e-6}function Wo({item:e,shape:t,color:n,selected:r,dimmed:i,editable:a,isDrawing:c,size:l,onSelect:u,onShapeChange:d}){let[f,p]=(0,o.useState)(null),m={x:t.x,y:t.y,width:t.width,height:t.height};(0,o.useEffect)(()=>{f&&Uo(m,f)&&p(null)},[t.x,t.y,t.width,t.height,f]);let h=f??m,g=h.x*l.w,_=h.y*l.h,v=h.width*l.w,y=h.height*l.h,b=i?.35:r?1:.85,x=t=>{p(t),d(e.id,{kind:`rect`,x:t.x,y:t.y,width:t.width,height:t.height})};return(0,s.jsx)(go,{onClick:t=>{t.cancelBubble=!0,c||u(e.id)},children:(0,s.jsxs)(go,{draggable:a,dragBoundFunc:a?e=>({x:Math.max(-g,Math.min(l.w-(g+v),e.x)),y:Math.max(-_,Math.min(l.h-(_+y),e.y))}):void 0,onDragEnd:a?e=>{let t=e.target,n=t.x()/l.w,r=t.y()/l.h;if(t.position({x:0,y:0}),n===0&&r===0)return;let i=Math.min(Math.max(0,h.x+n),Math.max(0,1-h.width)),a=Math.min(Math.max(0,h.y+r),Math.max(0,1-h.height));x({...h,x:i,y:a})}:void 0,onMouseEnter:e=>{if(!a)return;let t=e.target.getStage();t&&(t.container().style.cursor=`move`)},onMouseLeave:e=>{if(!a)return;let t=e.target.getStage();t&&(t.container().style.cursor=c?`crosshair`:`default`)},children:[(0,s.jsx)(_o,{x:g,y:_,width:v,height:y,fill:n+(r?Eo:To),stroke:n,strokeWidth:r?2.5:1.5,opacity:b}),e.label?(0,s.jsx)(bo,{x:g,y:_-16,text:e.label,fontSize:12,fill:n,stroke:`#000000`,strokeWidth:3,fillAfterStrokeEnabled:!0,fontStyle:`bold`,listening:!1}):null,a?(0,s.jsx)(vo,{x:g+v,y:_+y,radius:6,fill:n,stroke:`#ffffff`,strokeWidth:1.5,draggable:!0,dragBoundFunc:e=>({x:Math.min(l.w,Math.max(g,e.x)),y:Math.min(l.h,Math.max(_,e.y))}),onDragStart:e=>{e.cancelBubble=!0},onDragMove:e=>{let t=e.target,n=Io(t.x()/l.w-h.x),r=Io(t.y()/l.h-h.y);p({...h,width:Math.max(Ho,Math.min(n,1-h.x)),height:Math.max(Ho,Math.min(r,1-h.y))})},onDragEnd:e=>{let t=e.target,n=Io(t.x()/l.w-h.x),r=Io(t.y()/l.h-h.y);x({...h,width:Math.max(Ho,Math.min(n,1-h.x)),height:Math.max(Ho,Math.min(r,1-h.y))})},onMouseEnter:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=`nwse-resize`)},onMouseLeave:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=`default`)}}):null]})})}function Go({item:e,shape:t,color:n,dimmed:r,editable:i,size:a,onSelect:o,paintingRef:c,paintValueRef:l,paintedRef:u,paintCell:d}){let{gridWidth:f,gridHeight:p,cells:m}=t,h=a.w/f,g=a.h/p,_=f*p,v=r?.3:1,y=n=>{if(!i){o(e.id);return}let r=m[n]!==!0;c.current=!0,l.current=r,u.current=new Set([n]),d(e.id,t,n,r)},b=n=>{!c.current||!i||u.current.has(n)||(u.current.add(n),d(e.id,t,n,l.current))},x=()=>{c.current&&(c.current=!1,u.current=new Set)};return(0,s.jsx)(go,{opacity:v,onMouseUp:x,onMouseLeave:x,children:Array.from({length:_},(e,t)=>{let r=t%f,i=Math.floor(t/f),a=m[t]===!0;return(0,s.jsx)(_o,{x:r*h,y:i*g,width:h,height:g,fill:a?n+Eo:`#ffffff10`,stroke:a?n:`#ffffff40`,strokeWidth:.5,onMouseDown:e=>{e.cancelBubble=!0,y(t)},onMouseEnter:()=>b(t)},t)})})}function Ko({item:e,shape:t,color:n,selected:r,dimmed:i,editable:a,isLine:o,isDrawing:c,size:l,effectivePoints:u,minVertices:d,maxVertices:f,isDragging:p,onSelect:m,onShapeChange:h,setDragOverride:g,setDraggingItemId:_}){let v=Fo(u,l.w,l.h),y=i?.35:r?1:o?.8:.85,b=e=>o?{kind:`line`,points:[...e]}:{kind:`polygon`,points:[...e]},x=u.map(e=>e.x*l.w),S=u.map(e=>e.y*l.h),C=x.length>0?Math.min(...x):0,w=x.length>0?Math.max(...x):0,ee=S.length>0?Math.min(...S):0,te=S.length>0?Math.max(...S):0,ne=e=>({x:Math.max(-C,Math.min(l.w-w,e.x)),y:Math.max(-ee,Math.min(l.h-te,e.y))}),T=n=>{let r=n.target,i=r.x()/l.w,a=r.y()/l.h;if(r.position({x:0,y:0}),_(null),i===0&&a===0)return;let o=t.points.map(e=>({x:e.x+i,y:e.y+a}));g({itemId:e.id,points:o}),h(e.id,b(o))},re=!o&&u.length>d,ie=!o&&(f===void 0||u.length<f);return(0,s.jsxs)(go,{onClick:t=>{t.cancelBubble=!0,c||m(e.id)},children:[(0,s.jsxs)(go,{draggable:a,dragBoundFunc:a?ne:void 0,onDragStart:a?()=>_(e.id):void 0,onDragEnd:a?T:void 0,onMouseEnter:e=>{if(!a)return;let t=e.target.getStage();t&&(t.container().style.cursor=`move`)},onMouseLeave:e=>{if(!a)return;let t=e.target.getStage();t&&(t.container().style.cursor=c?`crosshair`:`default`)},children:[o?(0,s.jsx)(xo,{points:v,stroke:n,strokeWidth:r?3:2,fill:n,pointerLength:10,pointerWidth:8,opacity:y}):(0,s.jsx)(yo,{points:v,closed:!0,fill:n+(r?Eo:To),stroke:n,strokeWidth:r?2.5:1.5,opacity:y}),e.label&&u.length>0?(()=>{let t=No({x:u.reduce((e,t)=>e+t.x,0)/u.length,y:u.reduce((e,t)=>e+t.y,0)/u.length},l.w,l.h),r=Math.max(40,e.label.length*11*.62);return(0,s.jsx)(bo,{x:t.x-r/2,y:t.y-7,width:r,align:`center`,text:e.label,fontSize:12,fill:n,stroke:`#000000`,strokeWidth:3,fillAfterStrokeEnabled:!0,fontStyle:`bold`,listening:!1})})():null]}),a&&!p&&u.map((r,i)=>{let a=No(r,l.w,l.h);return(0,s.jsx)(`Circle`,{x:a.x,y:a.y,radius:5,fill:n,stroke:`#ffffff`,strokeWidth:1.5,draggable:!0,onDragMove:n=>{let r=Po({x:n.target.x(),y:n.target.y()},l.w,l.h);g(n=>{let a=n&&n.itemId===e.id?n.points:t.points;return{itemId:e.id,points:a.map((e,t)=>t===i?r:e)}})},onDragEnd:n=>{let r=Po({x:n.target.x(),y:n.target.y()},l.w,l.h),a=t.points.map((e,t)=>t===i?r:e);g({itemId:e.id,points:a}),h(e.id,b(a))},onContextMenu:n=>{n.evt.preventDefault(),n.cancelBubble=!0,re&&h(e.id,b(t.points.filter((e,t)=>t!==i)))}},`pt-${i}`)}),a&&!p&&ie&&u.length>=2&&u.map((r,i)=>{let a=u[(i+1)%u.length],o=No({x:(r.x+a.x)/2,y:(r.y+a.y)/2},l.w,l.h);return(0,s.jsx)(`Circle`,{x:o.x,y:o.y,radius:4,fill:`#ffffff`,stroke:n,strokeWidth:1.5,opacity:.6,onMouseEnter:e=>{let t=e.target;t.to({radius:6,opacity:1,duration:.1});let n=t.getStage();n&&(n.container().style.cursor=`copy`)},onMouseLeave:e=>{let t=e.target;t.to({radius:4,opacity:.6,duration:.1});let n=t.getStage();n&&(n.container().style.cursor=c?`crosshair`:`default`)},onClick:n=>{n.cancelBubble=!0,h(e.id,b(Ro(t.points,i)))}},`mid-${i}`)})]})}var qo=(0,o.memo)(Vo);export{qo as MaskShapeCanvas};
|