@pie-element/hotspot 10.0.0-beta.1 → 10.0.0-next.42

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.
@@ -0,0 +1 @@
1
+ import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as n,_dll_mui__material as i,_dll_mui__material_styles as r,_dll_lodash as a,_dll_mui__icons_material as s,_dll_debug as o}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^3.0.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as h}from"../../../@pie-lib/editable-html-module@^6.0.5/module/index.js";var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),t}var f,g=e;f=g.createRoot,g.hydrateRoot;var p={};Object.defineProperty(p,"__esModule",{value:!0});class m extends CustomEvent{constructor(e,t=!1){super(m.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}m.TYPE="model.updated";var v=p.ModelUpdatedEvent=m;class y extends CustomEvent{constructor(e,t){super(y.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}y.TYPE="delete.image";var b=p.DeleteImageEvent=y;class C extends CustomEvent{constructor(e){super(C.TYPE,{bubbles:!0,detail:e}),this.handler=e}}C.TYPE="insert.image";var x=p.InsertImageEvent=C;class _ extends CustomEvent{constructor(e,t){super(_.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}_.TYPE="delete.sound";var S=p.DeleteSoundEvent=_;class A extends CustomEvent{constructor(e){super(A.TYPE,{bubbles:!0,detail:e}),this.handler=e}}A.TYPE="insert.sound";var w=p.InsertSoundEvent=A;const k=t,E=n,{Select:P}=i,{MenuItem:D}=i,{styled:R}=r,{InputContainer:M}=l,I=R("div")(({theme:e})=>({marginTop:e.spacing(2),display:"flex"})),T=R(M)({flex:1,width:"90%"}),L=R(D)(({theme:e})=>({borderRadius:"2px",height:"22px",marginLeft:e.spacing(2),marginRight:e.spacing(2),marginTop:e.spacing(2)}));class H extends k.Component{constructor(...e){super(...e),H.prototype.__init.call(this)}__init(){this.onChange=e=>t=>{const{value:n}=t.target,{onHotspotColorChange:i,onOutlineColorChange:r}=this.props;"hotspot"===e?i(n):r(n)}}render(){const{hotspotColor:e,outlineColor:t,hotspotList:n,outlineList:i}=this.props;return k.createElement(I,null,k.createElement(T,{label:"Hot Spot"},k.createElement(P,{onChange:this.onChange("hotspot"),value:e,variant:"standard",MenuProps:{transitionDuration:{enter:225,exit:195}}},n.map(e=>k.createElement(L,{key:e,value:e,style:{backgroundColor:e}},e)))),k.createElement(T,{label:"Response Outline"},k.createElement(P,{onChange:this.onChange("outline"),value:t,variant:"standard",MenuProps:{transitionDuration:{enter:225,exit:195}}},i.map(e=>k.createElement(L,{key:e,value:e,style:{border:`2px solid ${e}`}},e)))))}}H.propTypes={hotspotColor:E.string.isRequired,hotspotList:E.array.isRequired,onHotspotColorChange:E.func.isRequired,onOutlineColorChange:E.func.isRequired,outlineColor:E.string.isRequired,outlineList:E.array.isRequired};const O=t,B=n,{styled:F}=r,{Button:N}=i,z=F(N)(({theme:e})=>({marginLeft:e.spacing(1)})),V=({className:e,label:t,onClick:n,disabled:i})=>O.createElement(z,{onClick:n,disabled:i,className:e,size:"small",variant:"contained"},t);V.propTypes={className:B.string,disabled:B.bool,label:B.string,onClick:B.func},V.defaultProps={className:"",disabled:!1,label:"Add",onClick:()=>{}};const G=t,U=({isActive:e=!1})=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"32",viewBox:"56 0 48 32",fill:"none"},G.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M56 4C56 1.79086 57.7909 0 60 0H99C101.209 0 103 1.79086 103 4V28.0001C103 30.2093 101.209 32.0001 99 32.0001H60C57.7909 32.0001 56 30.2093 56 28.0001V4Z",fill:e?"#D3D4D9":"#ECEDF1"}),G.createElement("circle",{cx:"79",cy:"16",r:"7.5",stroke:"black"}));U.propTypes={isActive:n.bool};const W=t,Q=({isActive:e=!1})=>W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"32",viewBox:"112 0 48 32",fill:"none"},W.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M112 4C112 1.79086 113.791 0 116 0H155C157.209 0 159 1.79086 159 4V28.0001C159 30.2093 157.209 32.0001 155 32.0001H116C113.791 32.0001 112 30.2093 112 28.0001V4Z",fill:e?"#D3D4D9":"#ECEDF1"}),W.createElement("mask",{id:"path-6-inside-1_2196_700",fill:"white"},W.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M130 8H126V12H127.5V20H126V24H130V22.7145H141V24H145V20H141.737L139.998 18H140V14.4265L142.11 12H145V8H141V9.71451H130V8ZM139.046 14L141 11.7525V10.7145H130V12H128.5V20H130V21.7145H141V20.6765L138.673 18H136V14H139.046Z"})),W.createElement("path",{d:"M126 8V7H125V8H126ZM130 8H131V7H130V8ZM126 12H125V13H126V12ZM127.5 12H128.5V11H127.5V12ZM127.5 20V21H128.5V20H127.5ZM126 20V19H125V20H126ZM126 24H125V25H126V24ZM130 24V25H131V24H130ZM130 22.7145V21.7145H129V22.7145H130ZM141 22.7145H142V21.7145H141V22.7145ZM141 24H140V25H141V24ZM145 24V25H146V24H145ZM145 20H146V19H145V20ZM141.737 20L140.982 20.6562L141.281 21H141.737V20ZM139.998 18V17H137.803L139.243 18.6562L139.998 18ZM140 18V19H141V18H140ZM140 14.4265L139.245 13.7703L139 14.0525V14.4265H140ZM142.11 12V11H141.654L141.355 11.3438L142.11 12ZM145 12V13H146V12H145ZM145 8H146V7H145V8ZM141 8V7H140V8H141ZM141 9.71451V10.7145H142V9.71451H141ZM130 9.71451H129V10.7145H130V9.71451ZM141 11.7525L141.755 12.4087L142 12.1265V11.7525H141ZM139.046 14V15H139.501L139.8 14.6562L139.046 14ZM141 10.7145H142V9.71451H141V10.7145ZM130 10.7145V9.71451H129V10.7145H130ZM130 12V13H131V12H130ZM128.5 12V11H127.5V12H128.5ZM128.5 20H127.5V21H128.5V20ZM130 20H131V19H130V20ZM130 21.7145H129V22.7145H130V21.7145ZM141 21.7145V22.7145H142V21.7145H141ZM141 20.6765H142V20.3025L141.755 20.0203L141 20.6765ZM138.673 18L139.427 17.3438L139.128 17H138.673V18ZM136 18H135V19H136V18ZM136 14V13H135V14H136ZM126 9H130V7H126V9ZM127 12V8H125V12H127ZM127.5 11H126V13H127.5V11ZM128.5 20V12H126.5V20H128.5ZM126 21H127.5V19H126V21ZM127 24V20H125V24H127ZM130 23H126V25H130V23ZM129 22.7145V24H131V22.7145H129ZM141 21.7145H130V23.7145H141V21.7145ZM142 24V22.7145H140V24H142ZM145 23H141V25H145V23ZM144 20V24H146V20H144ZM141.737 21H145V19H141.737V21ZM139.243 18.6562L140.982 20.6562L142.492 19.3438L140.752 17.3438L139.243 18.6562ZM140 17H139.998V19H140V17ZM139 14.4265V18H141V14.4265H139ZM141.355 11.3438L139.245 13.7703L140.755 15.0827L142.865 12.6562L141.355 11.3438ZM145 11H142.11V13H145V11ZM144 8V12H146V8H144ZM141 9H145V7H141V9ZM142 9.71451V8H140V9.71451H142ZM130 10.7145H141V8.71451H130V10.7145ZM129 8V9.71451H131V8H129ZM140.245 11.0963L138.291 13.3438L139.8 14.6562L141.755 12.4087L140.245 11.0963ZM140 10.7145V11.7525H142V10.7145H140ZM130 11.7145H141V9.71451H130V11.7145ZM131 12V10.7145H129V12H131ZM128.5 13H130V11H128.5V13ZM129.5 20V12H127.5V20H129.5ZM130 19H128.5V21H130V19ZM131 21.7145V20H129V21.7145H131ZM141 20.7145H130V22.7145H141V20.7145ZM140 20.6765V21.7145H142V20.6765H140ZM137.918 18.6562L140.245 21.3327L141.755 20.0203L139.427 17.3438L137.918 18.6562ZM138.673 17H136V19H138.673V17ZM137 18V14H135V18H137ZM136 15H139.046V13H136V15Z",fill:"black",mask:"url(#path-6-inside-1_2196_700)"}));Q.propTypes={isActive:n.bool};const j=t,Y=({isActive:e=!1})=>j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"32",viewBox:"0 0 48 32",fill:"none"},j.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 4C0 1.79086 1.79086 0 4 0H43C45.2091 0 47 1.79086 47 4V28.0001C47 30.2093 45.2091 32.0001 43 32.0001H4C1.79086 32.0001 0 30.2093 0 28.0001V4Z",fill:e?"#D3D4D9":"#ECEDF1"}),j.createElement("mask",{id:"path-8-inside-2_2196_700",fill:"white"},j.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13 8H17V9.5H29V8H33V12H31.5V20H33V24H29V22.5H17V24H13V20H14.5V12H13V8ZM17 21.5V20H15.5V12H17V10.5H29V12H30.5V20H29V21.5H17Z"})),j.createElement("path",{d:"M17 8H18V7H17V8ZM13 8V7H12V8H13ZM17 9.5H16V10.5H17V9.5ZM29 9.5V10.5H30V9.5H29ZM29 8V7H28V8H29ZM33 8H34V7H33V8ZM33 12V13H34V12H33ZM31.5 12V11H30.5V12H31.5ZM31.5 20H30.5V21H31.5V20ZM33 20H34V19H33V20ZM33 24V25H34V24H33ZM29 24H28V25H29V24ZM29 22.5H30V21.5H29V22.5ZM17 22.5V21.5H16V22.5H17ZM17 24V25H18V24H17ZM13 24H12V25H13V24ZM13 20V19H12V20H13ZM14.5 20V21H15.5V20H14.5ZM14.5 12H15.5V11H14.5V12ZM13 12H12V13H13V12ZM17 20H18V19H17V20ZM17 21.5H16V22.5H17V21.5ZM15.5 20H14.5V21H15.5V20ZM15.5 12V11H14.5V12H15.5ZM17 12V13H18V12H17ZM17 10.5V9.5H16V10.5H17ZM29 10.5H30V9.5H29V10.5ZM29 12H28V13H29V12ZM30.5 12H31.5V11H30.5V12ZM30.5 20V21H31.5V20H30.5ZM29 20V19H28V20H29ZM29 21.5V22.5H30V21.5H29ZM17 7H13V9H17V7ZM18 9.5V8H16V9.5H18ZM29 8.5H17V10.5H29V8.5ZM28 8V9.5H30V8H28ZM33 7H29V9H33V7ZM34 12V8H32V12H34ZM31.5 13H33V11H31.5V13ZM32.5 20V12H30.5V20H32.5ZM33 19H31.5V21H33V19ZM34 24V20H32V24H34ZM29 25H33V23H29V25ZM28 22.5V24H30V22.5H28ZM17 23.5H29V21.5H17V23.5ZM16 22.5V24H18V22.5H16ZM17 23H13V25H17V23ZM14 24V20H12V24H14ZM13 21H14.5V19H13V21ZM13.5 12V20H15.5V12H13.5ZM13 13H14.5V11H13V13ZM12 8V12H14V8H12ZM16 20V21.5H18V20H16ZM15.5 21H17V19H15.5V21ZM16.5 20V12H14.5V20H16.5ZM15.5 13H17V11H15.5V13ZM18 12V10.5H16V12H18ZM17 11.5H29V9.5H17V11.5ZM28 10.5V12H30V10.5H28ZM29 13H30.5V11H29V13ZM29.5 12V20H31.5V12H29.5ZM30.5 19H29V21H30.5V19ZM28 20V21.5H30V20H28ZM29 20.5H17V22.5H29V20.5Z",fill:"black",mask:"url(#path-8-inside-2_2196_700)"}));Y.propTypes={isActive:n.bool};class q{static __initStatic(){this.name="circle"}static create(e,t){const n=[...e],i={id:`${Math.max(...n.map(e=>parseInt(e.id)),0)+1}`,radius:0,x:t.evt.layerX,y:t.evt.layerY,group:"circles",index:n.length};return n.push(i),{shapes:n,isDrawing:!0,isDrawingShapeId:i.id}}static finalizeCreation(e,t){const n=e.shapes.findIndex(t=>t.id===e.isDrawingShapeId);return-1!==n?e.shapes[n].radius>0?{...e,isDrawing:!1,stateShapes:!1,isDrawingShapeId:void 0}:{...e,isDrawing:!1,stateShapes:!1,isDrawingShapeId:void 0,shapes:e.shapes.filter(t=>t.id!==e.isDrawingShapeId)}:{...e,isDrawing:!1,stateShapes:!1,isDrawingShapeId:void 0}}static handleMouseMove(e,t){const{isDrawing:n,isDrawingShapeId:i,shapes:r}=e;if(n){const e=[...r],n=e.findIndex(e=>e.id===i);if(-1!==n){const i=e[n],r=t.evt.layerX-i.x,a=t.evt.layerY-i.y;return i.radius=Math.sqrt(r*r+a*a),{shapes:e}}}return e}}q.__initStatic();class Z{static __initStatic(){this.name="rectangle"}static create(e,t){const n=[...e],i={id:`${(Math.max(...n.map(e=>parseInt(e.id)),0)||0)+1}`,height:0,width:0,x:t.evt.layerX,y:t.evt.layerY,group:"rectangles",index:n.length};return n.push(i),{shapes:n,isDrawing:!0,isDrawingShapeId:i.id}}static finalizeCreation(e,t){const n=e.shapes.findIndex(t=>t.id===e.isDrawingShapeId);if(-1!==n){const t=e.shapes[n];return t.width>0&&t.height>0?{...e,isDrawing:!1,stateShapes:!1,isDrawingShapeId:void 0}:{...e,isDrawing:!1,stateShapes:!1,isDrawingShapeId:void 0,shapes:e.shapes.filter(t=>t.id!==e.isDrawingShapeId)}}return{...e,isDrawing:!1,stateShapes:!1,isDrawingShapeId:void 0}}static handleMouseMove(e,t){const{isDrawing:n,isDrawingShapeId:i,shapes:r}=e;if(n){const e=[...r],n=e.findIndex(e=>e.id===i);if(-1!==n){const i=e[n];return i.width=t.evt.layerX-i.x,i.height=t.evt.layerY-i.y,{shapes:e}}}return e}}Z.__initStatic();class X{static __initStatic(){this.name="polygon"}static create(e,t){const n=[...e],i={id:"newPolygon",points:[{x:t.evt.layerX,y:t.evt.layerY}],group:"polygons",index:n.length};return n.push(i),{shapes:n,isDrawing:!0,isDrawingShapeId:i.id}}static addPoint(e,t,n){const i=JSON.parse(JSON.stringify(e.shapes)),r=i.findIndex(t=>t.id===e.isDrawingShapeId);if(-1!==r){const a=i[r];if(a.points&&Array.isArray(a.points)){const s=a.points[0];return Math.abs(s.x-t.evt.layerX)<=5&&Math.abs(s.y-t.evt.layerY)<=5?X.finalizeCreation(e,n):(a.points.push({x:t.evt.layerX,y:t.evt.layerY}),i[r]=a,{shapes:i})}}return e}static finalizeCreation(e,t){const{shapes:n}=e,i=[...n],r=Math.max(...e.shapes.map(e=>parseInt(e.id)||0),0),a=i.findIndex(t=>t.id===e.isDrawingShapeId);return-1!==a&&i[a].points.length>2?(i[a].id=`${r+1}`,t(i),{isDrawing:!1,shapes:i,isDrawingShapeId:void 0}):e}static handleMouseMove(e,t){return e}}X.__initStatic();const K={CIRCLE:q.name,POLYGON:X.name,RECTANGLE:Z.name,NONE:"none"},J="circles",$="polygons",ee="rectangles";var te=Math.PI/180;const ne="undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},ie={_global:ne,version:"8.3.0",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>ie.angleDeg?e*te: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,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>ie.DD.isDragging,isDragReady:()=>!!ie.DD.node,document:ne.document,_injectGlobal(e){ne.Konva=e}},re=e=>{ie[e.prototype.getClassName()]=e};ie._injectGlobal(ie);var ae=Object.freeze({__proto__:null,glob:ne,Konva:ie,_registerNode:re});class se{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 se(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){var 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){var t=Math.cos(e),n=Math.sin(e),i=this.m[0]*t+this.m[2]*n,r=this.m[1]*t+this.m[3]*n,a=this.m[0]*-n+this.m[2]*t,s=this.m[1]*-n+this.m[3]*t;return this.m[0]=i,this.m[1]=r,this.m[2]=a,this.m[3]=s,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){var n=this.m[0]+this.m[2]*t,i=this.m[1]+this.m[3]*t,r=this.m[2]+this.m[0]*e,a=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=i,this.m[2]=r,this.m[3]=a,this}multiply(e){var 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],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],r=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],s=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]=i,this.m[3]=r,this.m[4]=a,this.m[5]=s,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,i=-this.m[2]*e,r=this.m[0]*e,a=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=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]=i,this.m[3]=r,this.m[4]=a,this.m[5]=s,this}getMatrix(){return this.m}setAbsolutePosition(e,t){var n=this.m[0],i=this.m[1],r=this.m[2],a=this.m[3],s=this.m[4],o=(n*(t-this.m[5])-i*(e-s))/(n*a-i*r),l=(e-s-r*o)/n;return this.translate(l,o)}decompose(){var e=this.m[0],t=this.m[1],n=this.m[2],i=this.m[3],r=e*i-t*n;let a={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=t){var s=Math.sqrt(e*e+t*t);a.rotation=t>0?Math.acos(e/s):-Math.acos(e/s),a.scaleX=s,a.scaleY=r/s,a.skewX=(e*n+t*i)/r,a.skewY=0}else if(0!=n||0!=i){var o=Math.sqrt(n*n+i*i);a.rotation=Math.PI/2-(i>0?Math.acos(-n/o):-Math.acos(n/o)),a.scaleX=r/o,a.scaleY=o,a.skewX=0,a.skewY=(e*n+t*i)/r}return a.rotation=ge._getRotation(a.rotation),a}}var oe=Math.PI/180,le=180/Math.PI,he="Konva error: ",ue={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]},de=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,ce=[];const fe="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)},ge={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>"[object Array]"===Object.prototype.toString.call(e),_isNumber:e=>"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e),_isString:e=>"[object String]"===Object.prototype.toString.call(e),_isBoolean:e=>"[object Boolean]"===Object.prototype.toString.call(e),isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e||e>0?1:-1,requestAnimFrame(e){ce.push(e),1===ce.length&&fe(function(){const e=ce;ce=[],e.forEach(function(e){e()})})},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(e){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){var n=ge.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex:(e,t,n)=>((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1),_hexToRgb(e){e=e.replace("#","");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){for(var e=(16777215*Math.random()|0).toString(16);e.length<6;)e="0"+e;return"#"+e},getRGB(e){var t;return e in ue?{r:(t=ue[e])[0],g:t[1],b:t[2]}:"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=de.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=>(e=e||"black",ge._namedColorToRBA(e)||ge._hex3ColorToRGBA(e)||ge._hex6ColorToRGBA(e)||ge._rgbColorToRGBA(e)||ge._rgbaColorToRGBA(e)||ge._hslColorToRGBA(e)),_namedColorToRBA(e){var t=ue[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)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)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),i=Number(n[0])/360,r=Number(n[1])/100,a=Number(n[2])/100;let s,o,l;if(0===r)return l=255*a,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};s=a<.5?a*(1+r):a+r-a*r;const h=2*a-s,u=[0,0,0];for(let e=0;e<3;e++)o=i+1/3*-(e-1),o<0&&o++,o>1&&o--,l=6*o<1?h+6*(s-h)*o:2*o<1?s:3*o<2?h+(s-h)*(2/3-o)*6:h,u[e]=255*l;return{r:Math.round(u[0]),g:Math.round(u[1]),b:Math.round(u[2]),a:1}}},haveIntersection:(e,t)=>!(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){var t={};for(var 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=>e.slice(0),degToRad:e=>e*oe,radToDeg:e=>e*le,_degToRad:e=>(ge.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),ge.degToRad(e)),_radToDeg:e=>(ge.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),ge.radToDeg(e)),_getRotation:e=>ie.angleDeg?ge.radToDeg(e):e,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(he+e)},error(e){console.error(he+e)},warn(e){ie.showWarnings&&console.warn("Konva warning: "+e)},each(e,t){for(var n in e)t(n,e[n])},_inRange:(e,t,n)=>t<=e&&e<n,_getProjectionToSegment(e,t,n,i,r,a){var s,o,l,h=(e-n)*(e-n)+(t-i)*(t-i);if(0==h)s=e,o=t,l=(r-n)*(r-n)+(a-i)*(a-i);else{var u=((r-e)*(n-e)+(a-t)*(i-t))/h;u<0?(s=e,o=t,l=(e-r)*(e-r)+(t-a)*(t-a)):u>1?(s=n,o=i,l=(n-r)*(n-r)+(i-a)*(i-a)):l=((s=e+u*(n-e))-r)*(s-r)+((o=t+u*(i-t))-a)*(o-a)}return[s,o,l]},_getProjectionToLine(e,t,n){var i=ge.cloneObject(e),r=Number.MAX_VALUE;return t.forEach(function(a,s){if(n||s!==t.length-1){var o=t[(s+1)%t.length],l=ge._getProjectionToSegment(a.x,a.y,o.x,o.y,e.x,e.y),h=l[0],u=l[1],d=l[2];d<r&&(i.x=h,i.y=u,r=d)}}),i},_prepareArrayForTween(e,t,n){var i,r=[],a=[];if(e.length>t.length){var s=t;t=e,e=s}for(i=0;i<e.length;i+=2)r.push({x:e[i],y:e[i+1]});for(i=0;i<t.length;i+=2)a.push({x:t[i],y:t[i+1]});var o=[];return a.forEach(function(e){var t=ge._getProjectionToLine(e,r,n);o.push(t.x),o.push(t.y)}),o},_prepareToStringify(e){var t;for(var n in e.visitedByCircularReferenceRemoval=!0,e)if(e.hasOwnProperty(n)&&e[n]&&"object"==typeof e[n])if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||ge._isElement(e[n])){if(!t.configurable)return null;delete e[n]}else if(null===ge._prepareToStringify(e[n])){if(!t.configurable)return null;delete e[n]}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(var n in t)e[n]=t[n];return e},_getFirstPointerId:e=>e.touches?e.changedTouches[0].identifier:e.pointerId||999};function pe(e){return ge._isString(e)?'"'+e+'"':"[object Number]"===Object.prototype.toString.call(e)||ge._isBoolean(e)?e:Object.prototype.toString.call(e)}function me(e){return e>255?255:e<0?0:Math.round(e)}function ve(){if(ie.isUnminified)return function(e,t){return ge._isNumber(e)||ge.warn(pe(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function ye(e){if(ie.isUnminified)return function(t,n){let i=ge._isNumber(t),r=ge._isArray(t)&&t.length==e;return i||r||ge.warn(pe(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function be(){if(ie.isUnminified)return function(e,t){return ge._isNumber(e)||"auto"===e||ge.warn(pe(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function Ce(){if(ie.isUnminified)return function(e,t){return ge._isString(e)||ge.warn(pe(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function xe(){if(ie.isUnminified)return function(e,t){const n=ge._isString(e),i="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||i||ge.warn(pe(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function _e(){if(ie.isUnminified)return function(e,t){return!0===e||!1===e||ge.warn(pe(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}var Se="get",Ae="set";const we={addGetterSetter(e,t,n,i,r){we.addGetter(e,t,n),we.addSetter(e,t,i,r),we.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){var i=Se+ge._capitalize(t);e.prototype[i]=e.prototype[i]||function(){var e=this.attrs[t];return void 0===e?n:e}},addSetter(e,t,n,i){var r=Ae+ge._capitalize(t);e.prototype[r]||we.overWriteSetter(e,t,n,i)},overWriteSetter(e,t,n,i){var r=Ae+ge._capitalize(t);e.prototype[r]=function(e){return n&&null!=e&&(e=n.call(this,e,t)),this._setAttr(t,e),i&&i.call(this),this}},addComponentsGetterSetter(e,t,n,i,r){var a,s,o=n.length,l=ge._capitalize,h=Se+l(t),u=Ae+l(t);e.prototype[h]=function(){var e={};for(a=0;a<o;a++)e[s=n[a]]=this.getAttr(t+l(s));return e};var d=function(e){if(ie.isUnminified)return function(t,n){return ge.isObject(t)||ge.warn(pe(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}(n);e.prototype[u]=function(e){var n,a=this.attrs[t];for(n in i&&(e=i.call(this,e)),d&&d.call(this,e,t),e)e.hasOwnProperty(n)&&this._setAttr(t+l(n),e[n]);return this._fireChangeEvent(t,a,e),r&&r.call(this),this},we.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){var n=ge._capitalize(t),i=Ae+n,r=Se+n;e.prototype[t]=function(){return arguments.length?(this[i](arguments[0]),this):this[r]()}},addDeprecatedGetterSetter(e,t,n,i){ge.error("Adding deprecated "+t);var r=Se+ge._capitalize(t),a=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[r]=function(){ge.error(a);var e=this.attrs[t];return void 0===e?n:e},we.addSetter(e,t,i,function(){ge.error(a)}),we.addOverloadedGetterSetter(e,t)},backCompat(e,t){ge.each(t,function(t,n){var i=e.prototype[n],r=Se+ge._capitalize(t),a=Ae+ge._capitalize(t);function s(){i.apply(this,arguments),ge.error('"'+t+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}e.prototype[t]=s,e.prototype[r]=s,e.prototype[a]=s})},afterSetFilter(){this._filterUpToDate=!1}};var ke,Ee=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class Pe{constructor(e){this.canvas=e,this._context=e._canvas.getContext("2d"),ie.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){var n,i,r,a,s=this.traceArr,o=s.length,l="";for(n=0;n<o;n++)(r=(i=s[n]).method)?(a=i.args,l+=r,e?l+="()":ge._isArray(a[0])?l+="(["+a.join(",")+"])":(t&&(a=a.map(e=>"number"==typeof e?Math.floor(e):e)),l+="("+a.join(",")+")")):(l+=i.property,e||(l+="="+i.val)),l+=";";return l}clearTrace(){this.traceArr=[]}_trace(e){var t=this.traceArr;t.push(e),t.length>=100&&t.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var 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){var t=e.getLineCap();t&&this.setAttr("lineCap",t)}_applyOpacity(e){var t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){var t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,i,r,a){this._context.arc(e,t,n,i,r,a)}arcTo(e,t,n,i,r){this._context.arcTo(e,t,n,i,r)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,i,r,a){this._context.bezierCurveTo(e,t,n,i,r,a)}clearRect(e,t,n,i){this._context.clearRect(e,t,n,i)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,t){var n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}createLinearGradient(e,t,n,i){return this._context.createLinearGradient(e,t,n,i)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,i,r,a){return this._context.createRadialGradient(e,t,n,i,r,a)}drawImage(e,t,n,i,r,a,s,o,l){var h=arguments,u=this._context;3===h.length?u.drawImage(e,t,n):5===h.length?u.drawImage(e,t,n,i,r):9===h.length&&u.drawImage(e,t,n,i,r,a,s,o,l)}ellipse(e,t,n,i,r,a,s,o){this._context.ellipse(e,t,n,i,r,a,s,o)}isPointInPath(e,t){return this._context.isPointInPath(e,t)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,t,n,i){this._context.fillRect(e,t,n,i)}strokeRect(e,t,n,i){this._context.strokeRect(e,t,n,i)}fillText(e,t,n,i){i?this._context.fillText(e,t,n,i):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,i){return this._context.getImageData(e,t,n,i)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,i){this._context.rect(e,t,n,i)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,i){this._context.quadraticCurveTo(e,t,n,i)}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,i,r,a){this._context.setTransform(e,t,n,i,r,a)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,i){this._context.strokeText(e,t,n,i)}transform(e,t,n,i,r,a){this._context.transform(e,t,n,i,r,a)}translate(e,t){this._context.translate(e,t)}_enableTrace(){var e,t,n=this,i=Ee.length,r=this.setAttr,a=function(e){var i,r=n[e];n[e]=function(){return t=function(e){var t,n,i=[],r=e.length,a=ge;for(t=0;t<r;t++)n=e[t],a._isNumber(n)?n=Math.round(1e3*n)/1e3:a._isString(n)||(n+=""),i.push(n);return i}(Array.prototype.slice.call(arguments,0)),i=r.apply(n,arguments),n._trace({method:e,args:t}),i}};for(e=0;e<i;e++)a(Ee[e]);n.setAttr=function(){r.apply(n,arguments);var e=arguments[0],t=arguments[1];"shadowOffsetX"!==e&&"shadowOffsetY"!==e&&"shadowBlur"!==e||(t/=this.canvas.getPixelRatio()),n._trace({property:e,val:t})}}_applyGlobalCompositeOperation(e){const t=e.attrs.globalCompositeOperation;!t||"source-over"===t||this.setAttr("globalCompositeOperation",t)}}["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach(function(e){Object.defineProperty(Pe.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});class De extends Pe{_fillColor(e){var t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){var t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){var t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){var t=e.fill(),n=e.getFillPriority();if(t&&"color"===n)this._fillColor(e);else{var i=e.getFillPatternImage();if(i&&"pattern"===n)this._fillPattern(e);else{var r=e.getFillLinearGradientColorStops();if(r&&"linear-gradient"===n)this._fillLinearGradient(e);else{var a=e.getFillRadialGradientColorStops();a&&"radial-gradient"===n?this._fillRadialGradient(e):t?this._fillColor(e):i?this._fillPattern(e):r?this._fillLinearGradient(e):a&&this._fillRadialGradient(e)}}}}_strokeLinearGradient(e){var t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),i=e.getStrokeLinearGradientColorStops(),r=this.createLinearGradient(t.x,t.y,n.x,n.y);if(i){for(var a=0;a<i.length;a+=2)r.addColorStop(i[a],i[a+1]);this.setAttr("strokeStyle",r)}}_stroke(e){var t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();var i=this.getCanvas().getPixelRatio();this.setTransform(i,0,0,i,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){var t,n,i,r=null!==(t=e.getShadowRGBA())&&void 0!==t?t:"black",a=null!==(n=e.getShadowBlur())&&void 0!==n?n:5,s=null!==(i=e.getShadowOffset())&&void 0!==i?i:{x:0,y:0},o=e.getAbsoluteScale(),l=this.canvas.getPixelRatio(),h=o.x*l,u=o.y*l;this.setAttr("shadowColor",r),this.setAttr("shadowBlur",a*Math.min(Math.abs(h),Math.abs(u))),this.setAttr("shadowOffsetX",s.x*h),this.setAttr("shadowOffsetY",s.y*u)}}class Re extends Pe{_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()){var t=e.getStrokeScaleEnabled();if(!t){this.save();var n=this.getCanvas().getPixelRatio();this.setTransform(n,0,0,n,0,0)}this._applyLineCap(e);var i=e.hitStrokeWidth(),r="auto"===i?e.strokeWidth():i;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),t||this.restore()}}}class Me{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var t=(e||{}).pixelRatio||ie.pixelRatio||function(){if(ke)return ke;var e=ge.createCanvasElement().getContext("2d");return ke=(ie._global.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}();this.pixelRatio=t,this._canvas=ge.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){var 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";var 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";var 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(e){try{return this._canvas.toDataURL()}catch(e){return ge.error("Unable to get data URL. "+e.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}we.addGetterSetter(Me,"pixelRatio",void 0,ve());class Ie extends Me{constructor(e={width:0,height:0}){super(e),this.context=new De(this),this.setSize(e.width,e.height)}}class Te extends Me{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new Re(this),this.setSize(e.width,e.height)}}const Le={get isDragging(){var e=!1;return Le._dragElements.forEach(t=>{"dragging"===t.dragStatus&&(e=!0)}),e},justDragged:!1,get node(){var e;return Le._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];Le._dragElements.forEach((n,i)=>{const{node:r}=n,a=r.getStage();a.setPointersPositions(e),void 0===n.pointerId&&(n.pointerId=ge._getFirstPointerId(e));const s=a._changedPointerPositions.find(e=>e.id===n.pointerId);if(s){if("dragging"!==n.dragStatus){var o=r.dragDistance();if(Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y))<o)return;if(r.startDrag({evt:e}),!r.isDragging())return}r._setDragPosition(e,n),t.push(r)}}),t.forEach(t=>{t.fire("dragmove",{type:"dragmove",target:t,evt:e},!0)})},_endDragBefore(e){Le._dragElements.forEach(t=>{const{node:n}=t,i=n.getStage();if(e&&i.setPointersPositions(e),!i._changedPointerPositions.find(e=>e.id===t.pointerId))return;"dragging"!==t.dragStatus&&"stopped"!==t.dragStatus||(Le.justDragged=!0,ie._mouseListenClick=!1,ie._touchListenClick=!1,ie._pointerListenClick=!1,t.dragStatus="stopped");const r=t.node.getLayer()||t.node instanceof ie.Stage&&t.node;r&&r.batchDraw()})},_endDragAfter(e){Le._dragElements.forEach((t,n)=>{"stopped"===t.dragStatus&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),"dragging"!==t.dragStatus&&Le._dragElements.delete(n)})}};ie.isBrowser&&(window.addEventListener("mouseup",Le._endDragBefore,!0),window.addEventListener("touchend",Le._endDragBefore,!0),window.addEventListener("mousemove",Le._drag),window.addEventListener("touchmove",Le._drag),window.addEventListener("mouseup",Le._endDragAfter,!1),window.addEventListener("touchend",Le._endDragAfter,!1));var He="absoluteOpacity",Oe="allEventListeners",Be="absoluteTransform",Fe="absoluteScale",Ne="canvas",ze="listening",Ve="mouseenter",Ge="mouseleave",Ue="Shape",We=" ",Qe="stage",je="transform",Ye="visible",qe=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(We);let Ze=1;class Xe{constructor(e){this._id=Ze++,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!==je&&e!==Be||!this._cache.get(e)?e?this._cache.delete(e):this._cache.clear():this._cache.get(e).dirty=!0}_getCache(e,t){var n=this._cache.get(e);return(void 0===n||(e===je||e===Be)&&!0===n.dirty)&&(n=t.call(this),this._cache.set(e,n)),n}_calculate(e,t,n){if(!this._attachedDepsListeners.get(e)){const n=t.map(e=>e+"Change.konva").join(We);this.on(n,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,n)}_getCanvasCache(){return this._cache.get(Ne)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Be&&this.fire("absoluteTransformChange")}clearCache(){return this._cache.delete(Ne),this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var t=e||{},n={};void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height||(n=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(t.width||n.width),r=Math.ceil(t.height||n.height),a=t.pixelRatio,s=void 0===t.x?n.x:t.x,o=void 0===t.y?n.y:t.y,l=t.offset||0,h=t.drawBorder||!1,u=t.hitCanvasPixelRatio||1;if(i&&r){s-=l,o-=l;var d=new Ie({pixelRatio:a,width:i+=2*l,height:r+=2*l}),c=new Ie({pixelRatio:a,width:0,height:0}),f=new Te({pixelRatio:u,width:i,height:r}),g=d.getContext(),p=f.getContext();return f.isCache=!0,d.isCache=!0,this._cache.delete(Ne),this._filterUpToDate=!1,!1===t.imageSmoothingEnabled&&(d.getContext()._context.imageSmoothingEnabled=!1,c.getContext()._context.imageSmoothingEnabled=!1),g.save(),p.save(),g.translate(-s,-o),p.translate(-s,-o),this._isUnderCache=!0,this._clearSelfAndDescendantCache(He),this._clearSelfAndDescendantCache(Fe),this.drawScene(d,this),this.drawHit(f,this),this._isUnderCache=!1,g.restore(),p.restore(),h&&(g.save(),g.beginPath(),g.rect(0,0,i,r),g.closePath(),g.setAttr("strokeStyle","red"),g.setAttr("lineWidth",5),g.stroke(),g.restore()),this._cache.set(Ne,{scene:d,filter:c,hit:f,x:s,y:o}),this._requestDraw(),this}ge.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")}isCached(){return this._cache.has(Ne)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,t){var n,i,r,a,s=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],o=this.getAbsoluteTransform(t);return s.forEach(function(e){var t=o.point(e);void 0===n&&(n=r=t.x,i=a=t.y),n=Math.min(n,t.x),i=Math.min(i,t.y),r=Math.max(r,t.x),a=Math.max(a,t.y)}),{x:n,y:i,width:r-n,height:a-i}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const t=this._getCanvasCache();e.translate(t.x,t.y);var n=this._getCachedSceneCanvas(),i=n.pixelRatio;e.drawImage(n._canvas,0,0,n.width/i,n.height/i),e.restore()}_drawCachedHitCanvas(e){var 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(){var e,t,n,i,r=this.filters(),a=this._getCanvasCache(),s=a.scene,o=a.filter,l=o.getContext();if(r){if(!this._filterUpToDate){var h=s.pixelRatio;o.setSize(s.width/s.pixelRatio,s.height/s.pixelRatio);try{for(e=r.length,l.clear(),l.drawImage(s._canvas,0,0,s.getWidth()/h,s.getHeight()/h),t=l.getImageData(0,0,o.getWidth(),o.getHeight()),n=0;n<e;n++)"function"==typeof(i=r[n])?(i.call(this,t),l.putImageData(t,0,0)):ge.error("Filter should be type of function, but got "+typeof i+" instead. Please check correct filters")}catch(e){ge.error("Unable to apply filter. "+e.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return o}return s}on(e,t){if(this._cache&&this._cache.delete(Oe),3===arguments.length)return this._delegate.apply(this,arguments);var n,i,r,a,s=e.split(We),o=s.length;for(n=0;n<o;n++)r=(i=s[n].split("."))[0],a=i[1]||"",this.eventListeners[r]||(this.eventListeners[r]=[]),this.eventListeners[r].push({name:a,handler:t});return this}off(e,t){var n,i,r,a,s,o=(e||"").split(We),l=o.length;if(this._cache&&this._cache.delete(Oe),!e)for(i in this.eventListeners)this._off(i);for(n=0;n<l;n++)if(a=(r=o[n].split("."))[0],s=r[1],a)this.eventListeners[a]&&this._off(a,s,t);else for(i in this.eventListeners)this._off(i,s,t);return this}dispatchEvent(e){var 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){var i=this;this.on(e,function(e){for(var r=e.target.findAncestors(t,!0,i),a=0;a<r.length;a++)(e=ge.cloneObject(e)).currentTarget=r[a],n.call(r[a],e)})}remove(){return this.isDragging()&&this.stopDrag(),Le._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Be),this._clearSelfAndDescendantCache(He),this._clearSelfAndDescendantCache(Fe),this._clearSelfAndDescendantCache(Qe),this._clearSelfAndDescendantCache(Ye),this._clearSelfAndDescendantCache(ze)}_remove(){this._clearCaches();var e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this}getAttr(e){var t="get"+ge._capitalize(e);return ge._isFunction(this[t])?this[t]():this.attrs[e]}getAncestors(){for(var e=this.getParent(),t=[];e;)t.push(e),e=e.getParent();return t}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{var t,n;if(!e)return this;for(t in e)"children"!==t&&(n="set"+ge._capitalize(t),ge._isFunction(this[n])?this[n](e[t]):this._setAttr(t,e[t]))}),this}isListening(){return this._getCache(ze,this._isListening)}_isListening(e){if(!this.listening())return!1;const t=this.getParent();return!t||t===e||this===e||t._isListening(e)}isVisible(){return this._getCache(Ye,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const t=this.getParent();return!t||t===e||this===e||t._isVisible(e)}shouldDrawHit(e,t=!1){if(e)return this._isVisible(e)&&this._isListening(e);var n=this.getLayer(),i=!1;Le._dragElements.forEach(e=>{"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(i=!0)});var r=!t&&!ie.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!r}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e,t,n,i,r=this.getDepth(),a=this,s=0;return"Stage"!==a.nodeType&&function o(l){for(e=[],t=l.length,n=0;n<t;n++)i=l[n],s++,i.nodeType!==Ue&&(e=e.concat(i.getChildren().slice())),i._id===a._id&&(n=t);e.length>0&&e[0].getDepth()<=r&&o(e)}(a.getStage().getChildren()),s}getDepth(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(je),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(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(e)}getAbsolutePosition(e){let t=!1,n=this.parent;for(;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);var i=this.getAbsoluteTransform(e).getMatrix(),r=new se,a=this.offset();return r.m=i.slice(),r.translate(a.x,a.y),r.getTranslation()}setAbsolutePosition(e){var t=this._clearTransform();this.attrs.x=t.x,this.attrs.y=t.y,delete t.x,delete t.y,this._clearCache(je);var n=this._getAbsoluteTransform().copy();return n.invert(),n.translate(e.x,e.y),e={x:this.attrs.x+n.getTranslation().x,y:this.attrs.y+n.getTranslation().y},this._setTransform(t),this.setPosition({x:e.x,y:e.y}),this._clearCache(je),this._clearSelfAndDescendantCache(Be),this}_setTransform(e){var t;for(t in e)this.attrs[t]=e[t]}_clearTransform(){var 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){var t=e.x,n=e.y,i=this.x(),r=this.y();return void 0!==t&&(i+=t),void 0!==n&&(r+=n),this.setPosition({x:i,y:r}),this}_eachAncestorReverse(e,t){var n,i,r=[],a=this.getParent();if(!t||t._id!==this._id){for(r.unshift(this);a&&(!t||a._id!==t._id);)r.unshift(a),a=a.parent;for(n=r.length,i=0;i<n;i++)e(r[i])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return ge.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index;return this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0}moveUp(){if(!this.parent)return ge.warn("Node has no parent. moveUp function is ignored."),!1;var 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)}moveDown(){if(!this.parent)return ge.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return ge.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return ge.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&ge.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)+".");var 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(He,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var 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(){var e,t,n,i,r={},a=this.getAttrs();for(e in r.attrs={},a)t=a[e],ge.isObject(t)&&!ge._isPlainObject(t)&&!ge._isArray(t)||(n="function"==typeof this[e]&&this[e],delete a[e],i=n?n.call(this):null,a[e]=t,i!==t&&(r.attrs[e]=t));return r.className=this.getClassName(),ge._prepareToStringify(r)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,t,n){var i=[];t&&this._isMatch(e)&&i.push(this);for(var r=this.parent;r;){if(r===n)return i;r._isMatch(e)&&i.push(r),r=r.parent}return i}isAncestorOf(e){return!1}findAncestor(e,t,n){return this.findAncestors(e,t,n)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);var t,n,i=e.replace(/ /g,"").split(","),r=i.length;for(t=0;t<r;t++)if(n=i[t],ge.isValidSelector(n)||(ge.warn('Selector "'+n+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),ge.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),ge.warn("Konva is awesome, right?")),"#"===n.charAt(0)){if(this.id()===n.slice(1))return!0}else if("."===n.charAt(0)){if(this.hasName(n.slice(1)))return!0}else if(this.className===n||this.nodeType===n)return!0;return!1}getLayer(){var e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(Qe,this._getStage)}_getStage(){var e=this.getParent();return e?e.getStage():void 0}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){var t;if(e)return t=new se,this._eachAncestorReverse(function(e){var n=e.transformsEnabled();"all"===n?t.multiply(e.getTransform()):"position"===n&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())},e),t;t=this._cache.get(Be)||new se,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();var n=this.transformsEnabled();if("all"===n)t.multiply(this.getTransform());else if("position"===n){const e=this.attrs.x||0,n=this.attrs.y||0,i=this.attrs.offsetX||0,r=this.attrs.offsetY||0;t.translate(e-i,n-r)}return t.dirty=!1,t}getAbsoluteScale(e){for(var t=this;t;)t._isUnderCache&&(e=t),t=t.getParent();const n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(je,this._getTransform)}_getTransform(){var e,t,n=this._cache.get(je)||new se;n.reset();var i=this.x(),r=this.y(),a=ie.getAngle(this.rotation()),s=null!==(e=this.attrs.scaleX)&&void 0!==e?e:1,o=null!==(t=this.attrs.scaleY)&&void 0!==t?t:1,l=this.attrs.skewX||0,h=this.attrs.skewY||0,u=this.attrs.offsetX||0,d=this.attrs.offsetY||0;return 0===i&&0===r||n.translate(i,r),0!==a&&n.rotate(a),0===l&&0===h||n.skew(l,h),1===s&&1===o||n.scale(s,o),0===u&&0===d||n.translate(-1*u,-1*d),n.dirty=!1,n}clone(e){var t,n,i,r,a,s=ge.cloneObject(this.attrs);for(t in e)s[t]=e[t];var o=new this.constructor(s);for(t in this.eventListeners)for(i=(n=this.eventListeners[t]).length,r=0;r<i;r++)(a=n[r]).name.indexOf("konva")<0&&(o.eventListeners[t]||(o.eventListeners[t]=[]),o.eventListeners[t].push(a));return o}_toKonvaCanvas(e){e=e||{};var t=this.getClientRect(),n=this.getStage(),i=void 0!==e.x?e.x:t.x,r=void 0!==e.y?e.y:t.y,a=e.pixelRatio||1,s=new Ie({width:e.width||t.width||(n?n.width():0),height:e.height||t.height||(n?n.height():0),pixelRatio:a}),o=s.getContext();return o.save(),(i||r)&&o.translate(-1*i,-1*r),this.drawScene(s),o.restore(),s}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){var t=(e=e||{}).mimeType||null,n=e.quality||null,i=this._toKonvaCanvas(e).toDataURL(t,n);return e.callback&&e.callback(i),i}toImage(e){if(!e||!e.callback)throw"callback required for toImage method config argument";var t=e.callback;delete e.callback,ge._urlToImage(this.toDataURL(e),function(e){t(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 void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():ie.dragDistance}_off(e,t,n){var i,r,a,s=this.eventListeners[e];for(i=0;i<s.length;i++)if(r=s[i].name,a=s[i].handler,!("konva"===r&&"konva"!==t||t&&r!==t||n&&n!==a)){if(s.splice(i,1),0===s.length){delete this.eventListeners[e];break}i--}}_fireChangeEvent(e,t,n){this._fire(e+"Change",{oldVal:t,newVal:n})}addName(e){if(!this.hasName(e)){var t=this.name(),n=t?t+" "+e:e;this.name(n)}return this}hasName(e){if(!e)return!1;const t=this.name();return!!t&&-1!==(t||"").split(/\s/g).indexOf(e)}removeName(e){var t=(this.name()||"").split(/\s/g),n=t.indexOf(e);return-1!==n&&(t.splice(n,1),this.name(t.join(" "))),this}setAttr(e,t){var n=this["set"+ge._capitalize(e)];return ge._isFunction(n)?n.call(this,t):this._setAttr(e,t),this}_requestDraw(){if(ie.autoDrawEnabled){const e=this.getLayer()||this.getStage();null==e||e.batchDraw()}}_setAttr(e,t){var n=this.attrs[e];(n!==t||ge.isObject(t))&&(null==t?delete this.attrs[e]:this.attrs[e]=t,this._shouldFireChangeEvents&&this._fireChangeEvent(e,n,t),this._requestDraw())}_setComponentAttr(e,t,n){var i;void 0!==n&&((i=this.attrs[e])||(this.attrs[e]=this.getAttr(e)),this.attrs[e][t]=n,this._fireChangeEvent(e,i,n))}_fireAndBubble(e,t,n){if(t&&this.nodeType===Ue&&(t.target=this),e!==Ve&&e!==Ge||!(n&&(this===n||this.isAncestorOf&&this.isAncestorOf(n))||"Stage"===this.nodeType&&!n)){this._fire(e,t);var i=(e===Ve||e===Ge)&&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(e){let t=this._cache.get(Oe);if(!t){t={};let e=Object.getPrototypeOf(this);for(;e;)if(e.eventListeners){for(var n in e.eventListeners){const i=e.eventListeners[n],r=t[n]||[];t[n]=i.concat(r)}e=Object.getPrototypeOf(e)}else e=Object.getPrototypeOf(e);this._cache.set(Oe,t)}return t[e]}_fire(e,t){(t=t||{}).currentTarget=this,t.type=e;const n=this._getProtoListeners(e);if(n)for(var i=0;i<n.length;i++)n[i].handler.call(this,t);const r=this.eventListeners[e];if(r)for(i=0;i<r.length;i++)r[i].handler.call(this,t)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){var t=e?e.pointerId:void 0,n=this.getStage(),i=this.getAbsolutePosition(),r=n._getPointerById(t)||n._changedPointerPositions[0]||i;Le._dragElements.set(this._id,{node:this,startPointerPos:r,offset:{x:r.x-i.x,y:r.y-i.y},dragStatus:"ready",pointerId:t})}startDrag(e,t=!0){Le._dragElements.has(this._id)||this._createDragElement(e),Le._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},t)}_setDragPosition(e,t){const n=this.getStage()._getPointerById(t.pointerId);if(n){var i={x:n.x-t.offset.x,y:n.y-t.offset.y},r=this.dragBoundFunc();if(void 0!==r){const t=r.call(this,i,e);t?i=t:ge.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===i.x&&this._lastPos.y===i.y||(this.setAbsolutePosition(i),this._requestDraw()),this._lastPos=i}}stopDrag(e){const t=Le._dragElements.get(this._id);t&&(t.dragStatus="stopped"),Le._endDragBefore(e),Le._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=Le._dragElements.get(this._id);return!!e&&"dragging"===e.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){if((void 0===e.evt.button||ie.dragButtons.indexOf(e.evt.button)>=0)&&!this.isDragging()){var t=!1;Le._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;const e=Le._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&Le._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const t=this.getStage();if(!t)return!1;const n={x:-e.x,y:-e.y,width:t.width()+e.x,height:t.height()+e.y};return ge.haveIntersection(n,this.getClientRect())}static create(e,t){return ge._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}static _createNode(e,t){var n,i,r,a=Xe.prototype.getClassName.call(e),s=e.children;if(t&&(e.attrs.container=t),ie[a]||(ge.warn('Can not find a node with class name "'+a+'". Fallback to "Shape".'),a="Shape"),n=new(0,ie[a])(e.attrs),s)for(i=s.length,r=0;r<i;r++)n.add(Xe._createNode(s[r]));return n}}Xe.prototype.nodeType="Node",Xe.prototype._attrsAffectingSize=[],Xe.prototype.eventListeners={},Xe.prototype.on.call(Xe.prototype,qe,function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(je),this._clearSelfAndDescendantCache(Be))}),Xe.prototype.on.call(Xe.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Ye)}),Xe.prototype.on.call(Xe.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(ze)}),Xe.prototype.on.call(Xe.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(He)});const Ke=we.addGetterSetter;Ke(Xe,"zIndex"),Ke(Xe,"absolutePosition"),Ke(Xe,"position"),Ke(Xe,"x",0,ve()),Ke(Xe,"y",0,ve()),Ke(Xe,"globalCompositeOperation","source-over",Ce()),Ke(Xe,"opacity",1,ve()),Ke(Xe,"name","",Ce()),Ke(Xe,"id","",Ce()),Ke(Xe,"rotation",0,ve()),we.addComponentsGetterSetter(Xe,"scale",["x","y"]),Ke(Xe,"scaleX",1,ve()),Ke(Xe,"scaleY",1,ve()),we.addComponentsGetterSetter(Xe,"skew",["x","y"]),Ke(Xe,"skewX",0,ve()),Ke(Xe,"skewY",0,ve()),we.addComponentsGetterSetter(Xe,"offset",["x","y"]),Ke(Xe,"offsetX",0,ve()),Ke(Xe,"offsetY",0,ve()),Ke(Xe,"dragDistance",null,ve()),Ke(Xe,"width",0,ve()),Ke(Xe,"height",0,ve()),Ke(Xe,"listening",!0,_e()),Ke(Xe,"preventDefault",!0,_e()),Ke(Xe,"filters",null,function(e){return this._filterUpToDate=!1,e}),Ke(Xe,"visible",!0,_e()),Ke(Xe,"transformsEnabled","all",Ce()),Ke(Xe,"size"),Ke(Xe,"dragBoundFunc"),Ke(Xe,"draggable",!1,_e()),we.backCompat(Xe,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class Je extends Xe{constructor(){super(...arguments),this.children=[]}getChildren(e){if(!e)return this.children||[];const t=this.children||[];var n=[];return t.forEach(function(t){e(t)&&n.push(t)}),n}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(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}var n=e[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){var t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){var n=[];return this._descendants(i=>{const r=i._isMatch(e);return r&&n.push(i),!(!r||!t)}),n}_descendants(e){let t=!1;const n=this.getChildren();for(const i of n){if(t=e(i),t)return!0;if(i.hasChildren()&&(t=i._descendants(e),t))return!0}return!1}toObject(){var e=Xe.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){for(var t=e.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){var t=Xe.prototype.clone.call(this,e);return this.getChildren().forEach(function(e){t.add(e.clone())}),t}getAllIntersections(e){var t=[];return this.find("Shape").forEach(function(n){n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach(function(t){t._clearSelfAndDescendantCache(e)})}_setChildrenIndices(){var e;null===(e=this.children)||void 0===e||e.forEach(function(e,t){e.index=t}),this._requestDraw()}drawScene(e,t){var n=this.getLayer(),i=e||n&&n.getCanvas(),r=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.scene,o=i&&i.isCache;if(!this.isVisible()&&!o)return this;if(s){r.save();var l=this.getAbsoluteTransform(t).getMatrix();r.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(r),r.restore()}else this._drawChildren("drawScene",i,t);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;var n=this.getLayer(),i=e||n&&n.hitCanvas,r=i&&i.getContext(),a=this._getCanvasCache();if(a&&a.hit){r.save();var s=this.getAbsoluteTransform(t).getMatrix();r.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(r),r.restore()}else this._drawChildren("drawHit",i,t);return this}_drawChildren(e,t,n){var i,r=t&&t.getContext(),a=this.clipWidth(),s=this.clipHeight(),o=this.clipFunc(),l=a&&s||o;const h=n===this;if(l){r.save();var u=this.getAbsoluteTransform(n),d=u.getMatrix();if(r.transform(d[0],d[1],d[2],d[3],d[4],d[5]),r.beginPath(),o)o.call(this,r,this);else{var c=this.clipX(),f=this.clipY();r.rect(c,f,a,s)}r.clip(),d=u.copy().invert().getMatrix(),r.transform(d[0],d[1],d[2],d[3],d[4],d[5])}var g=!h&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;g&&(r.save(),r._applyGlobalCompositeOperation(this)),null===(i=this.children)||void 0===i||i.forEach(function(i){i[e](t,n)}),g&&r.restore(),l&&r.restore()}getClientRect(e){var t,n,i,r,a,s,o=(e=e||{}).skipTransform,l=e.relativeTo,h=this;null===(t=this.children)||void 0===t||t.forEach(function(t){if(t.visible()){var s=t.getClientRect({relativeTo:h,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===s.width&&0===s.height||(void 0===n?(n=s.x,i=s.y,r=s.x+s.width,a=s.y+s.height):(n=Math.min(n,s.x),i=Math.min(i,s.y),r=Math.max(r,s.x+s.width),a=Math.max(a,s.y+s.height)))}});for(var u=this.find("Shape"),d=!1,c=0;c<u.length;c++)if(u[c]._isVisible(this)){d=!0;break}return s=d&&void 0!==n?{x:n,y:i,width:r-n,height:a-i}:{x:0,y:0,width:0,height:0},o?s:this._transformedRect(s,l)}}we.addComponentsGetterSetter(Je,"clip",["x","y","width","height"]),we.addGetterSetter(Je,"clipX",void 0,ve()),we.addGetterSetter(Je,"clipY",void 0,ve()),we.addGetterSetter(Je,"clipWidth",void 0,ve()),we.addGetterSetter(Je,"clipHeight",void 0,ve()),we.addGetterSetter(Je,"clipFunc");const $e=new Map,et=void 0!==ie._global.PointerEvent;function tt(e){return $e.get(e)}function nt(e){return{evt:e,pointerId:e.pointerId}}function it(e,t){return $e.get(e)===t}function rt(e,t){at(e),t.getStage()&&($e.set(e,t),et&&t._fire("gotpointercapture",nt(new PointerEvent("gotpointercapture"))))}function at(e,t){const n=$e.get(e);if(!n)return;const i=n.getStage();i&&i.content,$e.delete(e),et&&n._fire("lostpointercapture",nt(new PointerEvent("lostpointercapture")))}var st="mouseleave",ot="mouseover",lt="mouseenter",ht="mousemove",ut="mousedown",dt="mouseup",ct="pointermove",ft="pointerdown",gt="pointerup",pt="pointercancel",mt="pointerout",vt="pointerleave",yt="pointerover",bt="pointerenter",Ct="contextmenu",xt="touchstart",_t="touchend",St="touchmove",At="touchcancel",wt="wheel",kt=[[lt,"_pointerenter"],[ut,"_pointerdown"],[ht,"_pointermove"],[dt,"_pointerup"],[st,"_pointerleave"],[xt,"_pointerdown"],[St,"_pointermove"],[_t,"_pointerup"],[At,"_pointercancel"],[ot,"_pointerover"],[wt,"_wheel"],[Ct,"_contextmenu"],[ft,"_pointerdown"],[ct,"_pointermove"],[gt,"_pointerup"],[pt,"_pointercancel"],["lostpointercapture","_lostpointercapture"]];const Et={mouse:{[mt]:"mouseout",[vt]:st,[yt]:ot,[bt]:lt,[ct]:ht,[ft]:ut,[gt]:dt,[pt]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[mt]:"touchout",[vt]:"touchleave",[yt]:"touchover",[bt]:"touchenter",[ct]:St,[ft]:xt,[gt]:_t,[pt]:At,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[mt]:mt,[vt]:vt,[yt]:yt,[bt]:bt,[ct]:ct,[ft]:ft,[gt]:gt,[pt]:pt,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Pt=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",Dt=e=>{const t=Pt(e);return"pointer"===t?ie.pointerEventsEnabled&&Et.pointer:"touch"===t?Et.touch:"mouse"===t?Et.mouse:void 0};function Rt(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&ge.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}const Mt=[];class It extends Je{constructor(e){super(Rt(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Mt.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Rt(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||ge.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if("string"==typeof e){if("."===e.charAt(0)){var t=e.slice(1);e=document.getElementsByClassName(t)[0]}else{var n;n="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}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(){var e,t=this.children,n=t.length;for(e=0;e<n;e++)t[e].clear();return this}clone(e){return e||(e={}),e.container="undefined"!=typeof document&&document.createElement("div"),Je.prototype.clone.call(this,e)}destroy(){super.destroy();var e=this.content;e&&ge._isInDocument(e)&&this.container().removeChild(e);var t=Mt.indexOf(this);return t>-1&&Mt.splice(t,1),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(ge.warn("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);"),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||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var t=new Ie({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,i=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),i.forEach(function(t){if(t.isVisible()){var i=t._toKonvaCanvas(e);n.drawImage(i._canvas,e.x,e.y,i.getWidth()/i.getPixelRatio(),i.getHeight()/i.getPixelRatio())}}),t}getIntersection(e){if(!e)return null;var t,n=this.children;for(t=n.length-1;t>=0;t--){const i=n[t].getIntersection(e);if(i)return i}return null}_resizeDOM(){var e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),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(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}super.add(e);var i=this.children.length;return i>5&&ge.warn("The stage has "+i+" 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(),ie.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return it(e,this)}setPointerCapture(e){rt(e,this)}releaseCapture(e){at(e)}getLayers(){return this.children}_bindContentEvents(){ie.isBrowser&&kt.forEach(([e,t])=>{this.content.addEventListener(e,e=>{this[t](e)})})}_pointerenter(e){this.setPointersPositions(e);const t=Dt(e.type);this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=Dt(e.type);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){const t=Dt(e.type),n=Pt(e.type);if(t){this.setPointersPositions(e);var i=this._getTargetShape(n),r=!Le.isDragging||ie.hitOnDragEnabled;i&&r?(i._fireAndBubble(t.pointerout,{evt:e}),i._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):r&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const t=Dt(e.type),n=Pt(e.type);if(t){this.setPointersPositions(e);var i=!1;this._changedPointerPositions.forEach(r=>{var a=this.getIntersection(r);if(Le.justDragged=!1,ie["_"+n+"ListenClick"]=!0,!a||!a.isListening())return;ie.capturePointerEventsEnabled&&a.setPointerCapture(r.id),this[n+"ClickStartShape"]=a,a._fireAndBubble(t.pointerdown,{evt:e,pointerId:r.id}),i=!0;const s=e.type.indexOf("touch")>=0;a.preventDefault()&&e.cancelable&&s&&e.preventDefault()}),i||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const t=Dt(e.type),n=Pt(e.type);if(!t)return;if(Le.isDragging&&Le.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),Le.isDragging&&!ie.hitOnDragEnabled)return;var i={};let r=!1;var a=this._getTargetShape(n);this._changedPointerPositions.forEach(s=>{const o=tt(s.id)||this.getIntersection(s),l=s.id,h={evt:e,pointerId:l};var u=a!==o;if(u&&a&&(a._fireAndBubble(t.pointerout,Object.assign({},h),o),a._fireAndBubble(t.pointerleave,Object.assign({},h),o)),o){if(i[o._id])return;i[o._id]=!0}o&&o.isListening()?(r=!0,u&&(o._fireAndBubble(t.pointerover,Object.assign({},h),a),o._fireAndBubble(t.pointerenter,Object.assign({},h),a),this[n+"targetShape"]=o),o._fireAndBubble(t.pointermove,Object.assign({},h))):a&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:l}),this[n+"targetShape"]=null)}),r||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=Dt(e.type),n=Pt(e.type);if(!t)return;this.setPointersPositions(e);const i=this[n+"ClickStartShape"],r=this[n+"ClickEndShape"];var a={};let s=!1;this._changedPointerPositions.forEach(o=>{const l=tt(o.id)||this.getIntersection(o);if(l){if(l.releaseCapture(o.id),a[l._id])return;a[l._id]=!0}const h=o.id,u={evt:e,pointerId:h};let d=!1;ie["_"+n+"InDblClickWindow"]&&ie["_"+n+"InDblClickWindowId"]===h?(d=!0,clearTimeout(this[n+"DblTimeout"])):Le.justDragged||(ie["_"+n+"InDblClickWindow"]=!0,ie["_"+n+"InDblClickWindowId"]=h,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){ie["_"+n+"InDblClickWindow"]=!1},ie.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,Object.assign({},u)),ie["_"+n+"ListenClick"]&&i&&i===l&&(l._fireAndBubble(t.pointerclick,Object.assign({},u)),d&&r&&r===l&&l._fireAndBubble(t.pointerdblclick,Object.assign({},u)))):(this[n+"ClickEndShape"]=null,ie["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:h}),d&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:h}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),ie["_"+n+"ListenClick"]=!1,e.cancelable&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Ct,{evt:e}):this._fire(Ct,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(wt,{evt:e}):this._fire(wt,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=tt(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(gt,nt(e)),at(e.pointerId)}_lostpointercapture(e){at(e.pointerId)}setPointersPositions(e){var t=this._getContentPosition(),n=null,i=null;void 0!==(e=e||window.event).touches?(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})})):(n=(e.clientX-t.left)/t.scaleX,i=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:i},this._pointerPositions=[{x:n,y:i,id:ge._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:i,id:ge._getFirstPointerId(e)}])}_setPointerPosition(e){ge.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};var 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 Ie({width:this.width(),height:this.height()}),this.bufferHitCanvas=new Te({pixelRatio:1,width:this.width(),height:this.height()}),ie.isBrowser){var 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 ge.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}}It.prototype.nodeType="Stage",re(It),we.addGetterSetter(It,"container");var Tt="hasShadow",Lt="shadowRGBA",Ht="patternImage",Ot="linearGradient",Bt="radialGradient";let Ft;function Nt(){return Ft||(Ft=ge.createCanvasElement().getContext("2d"),Ft)}const zt={};class Vt extends Xe{constructor(e){let t;for(super(e);t=ge.getRandomColor(),!t||t in zt;);this.colorKey=t,zt[t]=this}getContext(){return ge.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return ge.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(Tt,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Ht,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=Nt().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new se;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(ie.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix();e.setTransform({a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]})}return e}}_getLinearGradient(){return this._getCache(Ot,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var t=Nt(),n=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),r=t.createLinearGradient(n.x,n.y,i.x,i.y),a=0;a<e.length;a+=2)r.addColorStop(e[a],e[a+1]);return r}}_getRadialGradient(){return this._getCache(Bt,this.__getRadialGradient)}__getRadialGradient(){var e=this.fillRadialGradientColorStops();if(e){for(var t=Nt(),n=this.fillRadialGradientStartPoint(),i=this.fillRadialGradientEndPoint(),r=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),i.x,i.y,this.fillRadialGradientEndRadius()),a=0;a<e.length;a+=2)r.addColorStop(e[a],e[a+1]);return r}}getShadowRGBA(){return this._getCache(Lt,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var e=ge.colorToRGBA(this.shadowColor());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(){const e=this.hitStrokeWidth();return"auto"===e?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var t=this.getStage().bufferHitCanvas;return t.getContext().clear(),this.drawHit(t,null,!0),t.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return Xe.prototype.destroy.call(this),delete zt[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!this.getStage())return!1;if(null!==(t=this.attrs.perfectDrawEnabled)&&void 0!==t&&!t)return!1;const n=e||this.hasFill(),i=this.hasStroke(),r=1!==this.getAbsoluteOpacity();if(n&&i&&r)return!0;const a=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!(n&&i&&a&&s)}setStrokeHitEnabled(e){ge.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var 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={}){const t=e.skipTransform,n=e.relativeTo,i=this.getSelfRect(),r=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,a=i.width+r,s=i.height+r,o=!e.skipShadow&&this.hasShadow(),l=o?this.shadowOffsetX():0,h=o?this.shadowOffsetY():0,u=a+Math.abs(l),d=s+Math.abs(h),c=o&&this.shadowBlur()||0,f=u+2*c,g=d+2*c;let p=0;Math.round(r/2)!==r/2&&(p=1);const m={width:f+p,height:g+p,x:-Math.round(r/2+c)+Math.min(l,0)+i.x,y:-Math.round(r/2+c)+Math.min(h,0)+i.y};return t?m:this._transformedRect(m,n)}drawScene(e,t){var n,i,r=this.getLayer(),a=e||r.getCanvas(),s=a.getContext(),o=this._getCanvasCache(),l=this.getSceneFunc(),h=this.hasShadow(),u=a.isCache,d=t===this;if(!this.isVisible()&&!d)return this;if(o){s.save();var c=this.getAbsoluteTransform(t).getMatrix();return s.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedSceneCanvas(s),s.restore(),this}if(!l)return this;if(s.save(),this._useBufferCanvas()&&!u){(i=(n=this.getStage().bufferCanvas).getContext()).clear(),i.save(),i._applyLineJoin(this);var f=this.getAbsoluteTransform(t).getMatrix();i.transform(f[0],f[1],f[2],f[3],f[4],f[5]),l.call(this,i,this),i.restore();var g=n.pixelRatio;h&&s._applyShadow(this),s._applyOpacity(this),s._applyGlobalCompositeOperation(this),s.drawImage(n._canvas,0,0,n.width/g,n.height/g)}else s._applyLineJoin(this),d||(f=this.getAbsoluteTransform(t).getMatrix(),s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),s._applyOpacity(this),s._applyGlobalCompositeOperation(this)),h&&s._applyShadow(this),l.call(this,s,this);return s.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;var i=this.getLayer(),r=e||i.hitCanvas,a=r&&r.getContext(),s=this.hitFunc()||this.sceneFunc(),o=this._getCanvasCache(),l=o&&o.hit;if(this.colorKey||ge.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()"),l){a.save();var h=this.getAbsoluteTransform(t).getMatrix();return a.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!s)return this;if(a.save(),a._applyLineJoin(this),this!==t){var u=this.getAbsoluteTransform(t).getMatrix();a.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return s.call(this,a,this),a.restore(),this}drawHitFromCache(e=0){var t,n,i,r,a,s=this._getCanvasCache(),o=this._getCachedSceneCanvas(),l=s.hit,h=l.getContext(),u=l.getWidth(),d=l.getHeight();h.clear(),h.drawImage(o._canvas,0,0,u,d);try{for(i=(n=(t=h.getImageData(0,0,u,d)).data).length,r=ge._hexToRgb(this.colorKey),a=0;a<i;a+=4)n[a+3]>e?(n[a]=r.r,n[a+1]=r.g,n[a+2]=r.b,n[a+3]=255):n[a+3]=0;h.putImageData(t,0,0)}catch(e){ge.error("Unable to draw hit graph from cached scene canvas. "+e.message)}return this}hasPointerCapture(e){return it(e,this)}setPointerCapture(e){rt(e,this)}releaseCapture(e){at(e)}}Vt.prototype._fillFunc=function(e){e.fill()},Vt.prototype._strokeFunc=function(e){e.stroke()},Vt.prototype._fillFuncHit=function(e){e.fill()},Vt.prototype._strokeFuncHit=function(e){e.stroke()},Vt.prototype._centroid=!1,Vt.prototype.nodeType="Shape",re(Vt),Vt.prototype.eventListeners={},Vt.prototype.on.call(Vt.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(Tt)}),Vt.prototype.on.call(Vt.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",function(){this._clearCache(Lt)}),Vt.prototype.on.call(Vt.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",function(){this._clearCache(Ht)}),Vt.prototype.on.call(Vt.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",function(){this._clearCache(Ot)}),Vt.prototype.on.call(Vt.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",function(){this._clearCache(Bt)}),we.addGetterSetter(Vt,"stroke",void 0,xe()),we.addGetterSetter(Vt,"strokeWidth",2,ve()),we.addGetterSetter(Vt,"fillAfterStrokeEnabled",!1),we.addGetterSetter(Vt,"hitStrokeWidth","auto",be()),we.addGetterSetter(Vt,"strokeHitEnabled",!0,_e()),we.addGetterSetter(Vt,"perfectDrawEnabled",!0,_e()),we.addGetterSetter(Vt,"shadowForStrokeEnabled",!0,_e()),we.addGetterSetter(Vt,"lineJoin"),we.addGetterSetter(Vt,"lineCap"),we.addGetterSetter(Vt,"sceneFunc"),we.addGetterSetter(Vt,"hitFunc"),we.addGetterSetter(Vt,"dash"),we.addGetterSetter(Vt,"dashOffset",0,ve()),we.addGetterSetter(Vt,"shadowColor",void 0,Ce()),we.addGetterSetter(Vt,"shadowBlur",0,ve()),we.addGetterSetter(Vt,"shadowOpacity",1,ve()),we.addComponentsGetterSetter(Vt,"shadowOffset",["x","y"]),we.addGetterSetter(Vt,"shadowOffsetX",0,ve()),we.addGetterSetter(Vt,"shadowOffsetY",0,ve()),we.addGetterSetter(Vt,"fillPatternImage"),we.addGetterSetter(Vt,"fill",void 0,xe()),we.addGetterSetter(Vt,"fillPatternX",0,ve()),we.addGetterSetter(Vt,"fillPatternY",0,ve()),we.addGetterSetter(Vt,"fillLinearGradientColorStops"),we.addGetterSetter(Vt,"strokeLinearGradientColorStops"),we.addGetterSetter(Vt,"fillRadialGradientStartRadius",0),we.addGetterSetter(Vt,"fillRadialGradientEndRadius",0),we.addGetterSetter(Vt,"fillRadialGradientColorStops"),we.addGetterSetter(Vt,"fillPatternRepeat","repeat"),we.addGetterSetter(Vt,"fillEnabled",!0),we.addGetterSetter(Vt,"strokeEnabled",!0),we.addGetterSetter(Vt,"shadowEnabled",!0),we.addGetterSetter(Vt,"dashEnabled",!0),we.addGetterSetter(Vt,"strokeScaleEnabled",!0),we.addGetterSetter(Vt,"fillPriority","color"),we.addComponentsGetterSetter(Vt,"fillPatternOffset",["x","y"]),we.addGetterSetter(Vt,"fillPatternOffsetX",0,ve()),we.addGetterSetter(Vt,"fillPatternOffsetY",0,ve()),we.addComponentsGetterSetter(Vt,"fillPatternScale",["x","y"]),we.addGetterSetter(Vt,"fillPatternScaleX",1,ve()),we.addGetterSetter(Vt,"fillPatternScaleY",1,ve()),we.addComponentsGetterSetter(Vt,"fillLinearGradientStartPoint",["x","y"]),we.addComponentsGetterSetter(Vt,"strokeLinearGradientStartPoint",["x","y"]),we.addGetterSetter(Vt,"fillLinearGradientStartPointX",0),we.addGetterSetter(Vt,"strokeLinearGradientStartPointX",0),we.addGetterSetter(Vt,"fillLinearGradientStartPointY",0),we.addGetterSetter(Vt,"strokeLinearGradientStartPointY",0),we.addComponentsGetterSetter(Vt,"fillLinearGradientEndPoint",["x","y"]),we.addComponentsGetterSetter(Vt,"strokeLinearGradientEndPoint",["x","y"]),we.addGetterSetter(Vt,"fillLinearGradientEndPointX",0),we.addGetterSetter(Vt,"strokeLinearGradientEndPointX",0),we.addGetterSetter(Vt,"fillLinearGradientEndPointY",0),we.addGetterSetter(Vt,"strokeLinearGradientEndPointY",0),we.addComponentsGetterSetter(Vt,"fillRadialGradientStartPoint",["x","y"]),we.addGetterSetter(Vt,"fillRadialGradientStartPointX",0),we.addGetterSetter(Vt,"fillRadialGradientStartPointY",0),we.addComponentsGetterSetter(Vt,"fillRadialGradientEndPoint",["x","y"]),we.addGetterSetter(Vt,"fillRadialGradientEndPointX",0),we.addGetterSetter(Vt,"fillRadialGradientEndPointY",0),we.addGetterSetter(Vt,"fillPatternRotation",0),we.backCompat(Vt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var Gt=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Ut=Gt.length;class Wt extends Je{constructor(e){super(e),this.canvas=new Ie,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);var 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(){Xe.prototype.moveToTop.call(this);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!Xe.prototype.moveUp.call(this))return!1;var e=this.getStage();return!(!e||!e.content||(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(Xe.prototype.moveDown.call(this)){var e=this.getStage();if(e){var 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(Xe.prototype.moveToBottom.call(this)){var e=this.getStage();if(e){var 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(){var e=this.getNativeCanvasElement();return Xe.prototype.remove.call(this),e&&e.parentNode&&ge._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){var t=e.getType();"Group"!==t&&"Shape"!==t&&ge.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return(e=e||{}).width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=void 0!==e.x?e.x:this.x(),e.y=void 0!==e.y?e.y:this.y(),Xe.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){const e=this.visible();this.canvas._canvas.style.display=e?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){ge.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){ge.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,ge.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var t=1,n=!1;;){for(let i=0;i<Ut;i++){const r=Gt[i],a=this._getIntersection({x:e.x+r.x*t,y:e.y+r.y*t}),s=a.shape;if(s)return s;if(n=!!a.antialiased,!a.antialiased)break}if(!n)return null;t+=1}}_getIntersection(e){const t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,i=n[3];if(255===i){const e=ge._rgbToHex(n[0],n[1],n[2]),t=zt["#"+e];return t?{shape:t}:{antialiased:!0}}return i>0?{antialiased:!0}:{}}drawScene(e,t){var n=this.getLayer(),i=e||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),Je.prototype.drawScene.call(this,i,t),this._fire("draw",{node:this}),this}drawHit(e,t){var n=this.getLayer(),i=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Je.prototype.drawHit.call(this,i,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){ge.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return ge.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}}Wt.prototype.nodeType="Layer",re(Wt),we.addGetterSetter(Wt,"imageSmoothingEnabled",!0),we.addGetterSetter(Wt,"clearBeforeDraw",!0),we.addGetterSetter(Wt,"hitGraphEnabled",!0,_e());class Qt extends Wt{constructor(e){super(e),this.listening(!1),ge.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Qt.prototype.nodeType="FastLayer",re(Qt);class jt extends Je{_validateAdd(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&ge.throw("You may only add groups and shapes to groups.")}}jt.prototype.nodeType="Group",re(jt);var Yt=ne.performance&&ne.performance.now?function(){return ne.performance.now()}:function(){return(new Date).getTime()};class qt{constructor(e,t){this.id=qt.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Yt(),frameRate:0},this.func=e,this.setLayers(t)}setLayers(e){var t;return t=e?e.length>0?e:[e]:[],this.layers=t,this}getLayers(){return this.layers}addLayer(e){var t,n=this.layers,i=n.length;for(t=0;t<i;t++)if(n[t]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){var e,t=qt.animations,n=t.length;for(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=Yt(),qt._addAnimation(this),this}stop(){return qt._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){var t,n=e.id,i=this.animations,r=i.length;for(t=0;t<r;t++)if(i[t].id===n){this.animations.splice(t,1);break}}static _runFrames(){var e,t,n,i,r,a,s,o,l={},h=this.animations;for(i=0;i<h.length;i++)if(t=(e=h[i]).layers,n=e.func,e._updateFrameObject(Yt()),a=t.length,!n||!1!==n.call(e,e.frame))for(r=0;r<a;r++)void 0!==(s=t[r])._id&&(l[s._id]=s);for(o in l)l.hasOwnProperty(o)&&l[o].batchDraw()}static _animationLoop(){var e=qt;e.animations.length?(e._runFrames(),ge.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,ge.requestAnimFrame(this._animationLoop))}}qt.animations=[],qt.animIdCounter=0,qt.animRunning=!1;var Zt={node:1,duration:1,easing:1,onFinish:1,yoyo:1},Xt=0,Kt=["fill","stroke","shadowColor"];class Jt{constructor(e,t,n,i,r,a,s){this.prop=e,this.propFunc=t,this.begin=i,this._pos=i,this.duration=a,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=r-this.begin,this.pause()}fire(e){var 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 void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,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(){var e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class $t{constructor(e){var t,n,i=this,r=e.node,a=r._id,s=e.easing||en.Linear,o=!!e.yoyo;t=void 0===e.duration?.3:0===e.duration?.001:e.duration,this.node=r,this._id=Xt++;var l=r.getLayer()||(r instanceof ie.Stage?r.getLayers():null);for(n in l||ge.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new qt(function(){i.tween.onEnterFrame()},l),this.tween=new Jt(n,function(e){i._tweenFunc(e)},s,0,1,1e3*t,o),this._addListeners(),$t.attrs[a]||($t.attrs[a]={}),$t.attrs[a][this._id]||($t.attrs[a][this._id]={}),$t.tweens[a]||($t.tweens[a]={}),e)void 0===Zt[n]&&this._addAttr(n,e[n]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,t){var n,i,r,a,s,o,l,h,u=this.node,d=u._id;if((r=$t.tweens[d][e])&&delete $t.attrs[d][r][e],n=u.getAttr(e),ge._isArray(t))if(i=[],s=Math.max(t.length,n.length),"points"===e&&t.length!==n.length&&(t.length>n.length?(l=n,n=ge._prepareArrayForTween(n,t,u.closed())):(o=t,t=ge._prepareArrayForTween(t,n,u.closed()))),0===e.indexOf("fill"))for(a=0;a<s;a++)if(a%2==0)i.push(t[a]-n[a]);else{var c=ge.colorToRGBA(n[a]);h=ge.colorToRGBA(t[a]),n[a]=c,i.push({r:h.r-c.r,g:h.g-c.g,b:h.b-c.b,a:h.a-c.a})}else for(a=0;a<s;a++)i.push(t[a]-n[a]);else-1!==Kt.indexOf(e)?(n=ge.colorToRGBA(n),i={r:(h=ge.colorToRGBA(t)).r-n.r,g:h.g-n.g,b:h.b-n.b,a:h.a-n.a}):i=t-n;$t.attrs[d][this._id][e]={start:n,diff:i,end:t,trueEnd:o,trueStart:l},$t.tweens[d][e]=this._id}_tweenFunc(e){var t,n,i,r,a,s,o,l,h=this.node,u=$t.attrs[h._id][this._id];for(t in u){if(i=(n=u[t]).start,r=n.diff,l=n.end,ge._isArray(i))if(a=[],o=Math.max(i.length,l.length),0===t.indexOf("fill"))for(s=0;s<o;s++)s%2==0?a.push((i[s]||0)+r[s]*e):a.push("rgba("+Math.round(i[s].r+r[s].r*e)+","+Math.round(i[s].g+r[s].g*e)+","+Math.round(i[s].b+r[s].b*e)+","+(i[s].a+r[s].a*e)+")");else for(s=0;s<o;s++)a.push((i[s]||0)+r[s]*e);else a=-1!==Kt.indexOf(t)?"rgba("+Math.round(i.r+r.r*e)+","+Math.round(i.g+r.g*e)+","+Math.round(i.b+r.b*e)+","+(i.a+r.a*e)+")":i+r*e;h.setAttr(t,a)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,t=$t.attrs[e._id][this._id];t.points&&t.points.trueEnd&&e.setAttr("points",t.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,t=$t.attrs[e._id][this._id];t.points&&t.points.trueStart&&e.points(t.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(1e3*e),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e,t=this.node._id,n=this._id,i=$t.tweens[t];for(e in this.pause(),i)delete $t.tweens[t][e];delete $t.attrs[t][n]}}$t.attrs={},$t.tweens={},Xe.prototype.to=function(e){var t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new $t(e).play()};const en={BackEaseIn(e,t,n,i){var r=1.70158;return n*(e/=i)*e*((r+1)*e-r)+t},BackEaseOut(e,t,n,i){var r=1.70158;return n*((e=e/i-1)*e*((r+1)*e+r)+1)+t},BackEaseInOut(e,t,n,i){var r=1.70158;return(e/=i/2)<1?n/2*(e*e*((1+(r*=1.525))*e-r))+t:n/2*((e-=2)*e*((1+(r*=1.525))*e+r)+2)+t},ElasticEaseIn(e,t,n,i,r,a){var s=0;return 0===e?t:1===(e/=i)?t+n:(a||(a=.3*i),!r||r<Math.abs(n)?(r=n,s=a/4):s=a/(2*Math.PI)*Math.asin(n/r),-r*Math.pow(2,10*(e-=1))*Math.sin((e*i-s)*(2*Math.PI)/a)+t)},ElasticEaseOut(e,t,n,i,r,a){var s=0;return 0===e?t:1===(e/=i)?t+n:(a||(a=.3*i),!r||r<Math.abs(n)?(r=n,s=a/4):s=a/(2*Math.PI)*Math.asin(n/r),r*Math.pow(2,-10*e)*Math.sin((e*i-s)*(2*Math.PI)/a)+n+t)},ElasticEaseInOut(e,t,n,i,r,a){var s=0;return 0===e?t:2==(e/=i/2)?t+n:(a||(a=i*(.3*1.5)),!r||r<Math.abs(n)?(r=n,s=a/4):s=a/(2*Math.PI)*Math.asin(n/r),e<1?r*Math.pow(2,10*(e-=1))*Math.sin((e*i-s)*(2*Math.PI)/a)*-.5+t:r*Math.pow(2,-10*(e-=1))*Math.sin((e*i-s)*(2*Math.PI)/a)*.5+n+t)},BounceEaseOut:(e,t,n,i)=>(e/=i)<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,i)=>n-en.BounceEaseOut(i-e,0,n,i)+t,BounceEaseInOut:(e,t,n,i)=>e<i/2?.5*en.BounceEaseIn(2*e,0,n,i)+t:.5*en.BounceEaseOut(2*e-i,0,n,i)+.5*n+t,EaseIn:(e,t,n,i)=>n*(e/=i)*e+t,EaseOut:(e,t,n,i)=>-n*(e/=i)*(e-2)+t,EaseInOut:(e,t,n,i)=>(e/=i/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t,StrongEaseIn:(e,t,n,i)=>n*(e/=i)*e*e*e*e+t,StrongEaseOut:(e,t,n,i)=>n*((e=e/i-1)*e*e*e*e+1)+t,StrongEaseInOut:(e,t,n,i)=>(e/=i/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t,Linear:(e,t,n,i)=>n*e/i+t},tn=ge._assign(ie,{Util:ge,Transform:se,Node:Xe,Container:Je,Stage:It,stages:Mt,Layer:Wt,FastLayer:Qt,Group:jt,DD:Le,Shape:Vt,shapes:zt,Animation:qt,Tween:$t,Easings:en,Context:Pe,Canvas:Me});class nn extends Vt{_sceneFunc(e){var t=ie.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 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}function rn(e,t,n,i,r,a,s){var o=Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2)),l=Math.sqrt(Math.pow(r-n,2)+Math.pow(a-i,2)),h=s*o/(o+l),u=s*l/(o+l);return[n-h*(r-e),i-h*(a-t),n+u*(r-e),i+u*(a-t)]}function an(e,t){var n,i,r=e.length,a=[];for(n=2;n<r-2;n+=2)i=rn(e[n-2],e[n-1],e[n],e[n+1],e[n+2],e[n+3],t),isNaN(i[0])||(a.push(i[0]),a.push(i[1]),a.push(e[n]),a.push(e[n+1]),a.push(i[2]),a.push(i[3]));return a}nn.prototype._centroid=!0,nn.prototype.className="Arc",nn.prototype._attrsAffectingSize=["innerRadius","outerRadius"],re(nn),we.addGetterSetter(nn,"innerRadius",0,ve()),we.addGetterSetter(nn,"outerRadius",0,ve()),we.addGetterSetter(nn,"angle",0,ve()),we.addGetterSetter(nn,"clockwise",!1,_e());class sn extends Vt{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){var t,n,i,r=this.points(),a=r.length,s=this.tension(),o=this.closed(),l=this.bezier();if(a){if(e.beginPath(),e.moveTo(r[0],r[1]),0!==s&&a>4){for(n=(t=this.getTensionPoints()).length,i=o?0:4,o||e.quadraticCurveTo(t[0],t[1],t[2],t[3]);i<n-2;)e.bezierCurveTo(t[i++],t[i++],t[i++],t[i++],t[i++],t[i++]);o||e.quadraticCurveTo(t[n-2],t[n-1],r[a-2],r[a-1])}else if(l)for(i=2;i<a;)e.bezierCurveTo(r[i++],r[i++],r[i++],r[i++],r[i++],r[i++]);else for(i=2;i<a;i+=2)e.lineTo(r[i],r[i+1]);o?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():an(this.points(),this.tension())}_getTensionPointsClosed(){var e=this.points(),t=e.length,n=this.tension(),i=rn(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),r=rn(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),a=an(e,n);return[i[2],i[3]].concat(a).concat([r[0],r[1],e[t-2],e[t-1],r[2],r[3],i[0],i[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};for(var t,n,i=(e=0!==this.tension()?[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.points())[0],r=e[0],a=e[1],s=e[1],o=0;o<e.length/2;o++)t=e[2*o],n=e[2*o+1],i=Math.min(i,t),r=Math.max(r,t),a=Math.min(a,n),s=Math.max(s,n);return{x:i,y:a,width:r-i,height:s-a}}}sn.prototype.className="Line",sn.prototype._attrsAffectingSize=["points","bezier","tension"],re(sn),we.addGetterSetter(sn,"closed",!1),we.addGetterSetter(sn,"bezier",!1),we.addGetterSetter(sn,"tension",0,ve()),we.addGetterSetter(sn,"points",[],function(){if(ie.isUnminified)return function(e,t){return ge._isArray(e)?e.forEach(function(e){ge._isNumber(e)||ge.warn('"'+t+'" attribute has non numeric element '+e+". Make sure that all elements are numbers.")}):ge.warn(pe(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.'),e}}());class on extends Vt{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this.dataArray=on.parsePathData(this.data()),this.pathLength=0;for(var t=0;t<this.dataArray.length;++t)this.pathLength+=this.dataArray[t].pathLength;this.on("dataChange.konva",function(){this.dataArray=on.parsePathData(this.data()),this.pathLength=0;for(var e=0;e<this.dataArray.length;++e)this.pathLength+=this.dataArray[e].pathLength})}_sceneFunc(e){var t=this.dataArray;e.beginPath();for(var n=!1,i=0;i<t.length;i++){var r=t[i].command,a=t[i].points;switch(r){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":var s=a[0],o=a[1],l=a[2],h=a[3],u=a[4],d=a[5],c=a[6],f=a[7],g=l>h?l:h,p=l>h?1:l/h,m=l>h?h/l:1;e.translate(s,o),e.rotate(c),e.scale(p,m),e.arc(0,0,g,u,u+d,1-f),e.scale(1/p,1/m),e.rotate(-c),e.translate(-s,-o);break;case"z":n=!0,e.closePath()}}n||this.hasFill()?e.fillStrokeShape(this):e.strokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(t){if("A"===t.command){var n=t.points[4],i=t.points[5],r=t.points[4]+i,a=Math.PI/180;if(Math.abs(n-r)<a&&(a=Math.abs(n-r)),i<0)for(let i=n-a;i>r;i-=a){const n=on.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],i,0);e.push(n.x,n.y)}else for(let i=n+a;i<r;i+=a){const n=on.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],i,0);e.push(n.x,n.y)}}else if("C"===t.command)for(let n=0;n<=1;n+=.01){const i=on.getPointOnCubicBezier(n,t.start.x,t.start.y,t.points[0],t.points[1],t.points[2],t.points[3],t.points[4],t.points[5]);e.push(i.x,i.y)}else e=e.concat(t.points)});for(var t,n,i=e[0],r=e[0],a=e[1],s=e[1],o=0;o<e.length/2;o++)t=e[2*o],n=e[2*o+1],isNaN(t)||(i=Math.min(i,t),r=Math.max(r,t)),isNaN(n)||(a=Math.min(a,n),s=Math.max(s,n));return{x:Math.round(i),y:Math.round(a),width:Math.round(r-i),height:Math.round(s-a)}}getLength(){return this.pathLength}getPointAtLength(e){var t,n=0,i=this.dataArray.length;if(!i)return null;for(;n<i&&e>this.dataArray[n].pathLength;)e-=this.dataArray[n].pathLength,++n;if(n===i)return{x:(t=this.dataArray[n-1].points.slice(-2))[0],y:t[1]};if(e<.01)return{x:(t=this.dataArray[n].points.slice(0,2))[0],y:t[1]};var r=this.dataArray[n],a=r.points;switch(r.command){case"L":return on.getPointOnLine(e,r.start.x,r.start.y,a[0],a[1]);case"C":return on.getPointOnCubicBezier(e/r.pathLength,r.start.x,r.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return on.getPointOnQuadraticBezier(e/r.pathLength,r.start.x,r.start.y,a[0],a[1],a[2],a[3]);case"A":var s=a[0],o=a[1],l=a[2],h=a[3],u=a[4],d=a[5],c=a[6];return u+=d*e/r.pathLength,on.getPointOnEllipticalArc(s,o,l,h,u,c)}return null}static getLineLength(e,t,n,i){return Math.sqrt((n-e)*(n-e)+(i-t)*(i-t))}static getPointOnLine(e,t,n,i,r,a,s){void 0===a&&(a=t),void 0===s&&(s=n);var o=(r-n)/(i-t+1e-8),l=Math.sqrt(e*e/(1+o*o));i<t&&(l*=-1);var h,u=o*l;if(i===t)h={x:a,y:s+u};else if((s-n)/(a-t+1e-8)===o)h={x:a+l,y:s+u};else{var d,c,f=this.getLineLength(t,n,i,r),g=(a-t)*(i-t)+(s-n)*(r-n);d=t+(g/=f*f)*(i-t),c=n+g*(r-n);var p=this.getLineLength(a,s,d,c),m=Math.sqrt(e*e-p*p);l=Math.sqrt(m*m/(1+o*o)),i<t&&(l*=-1),h={x:d+l,y:c+(u=o*l)}}return h}static getPointOnCubicBezier(e,t,n,i,r,a,s,o,l){function h(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 c(e){return(1-e)*(1-e)*(1-e)}return{x:o*h(e)+a*u(e)+i*d(e)+t*c(e),y:l*h(e)+s*u(e)+r*d(e)+n*c(e)}}static getPointOnQuadraticBezier(e,t,n,i,r,a,s){function o(e){return e*e}function l(e){return 2*e*(1-e)}function h(e){return(1-e)*(1-e)}return{x:a*o(e)+i*l(e)+t*h(e),y:s*o(e)+r*l(e)+n*h(e)}}static getPointOnEllipticalArc(e,t,n,i,r,a){var s=Math.cos(a),o=Math.sin(a),l=n*Math.cos(r),h=i*Math.sin(r);return{x:e+(l*s-h*o),y:t+(l*o+h*s)}}static parsePathData(e){if(!e)return[];var 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(new RegExp(" ","g"),",");for(var i=0;i<n.length;i++)t=t.replace(new RegExp(n[i],"g"),"|"+n[i]);var r,a=t.split("|"),s=[],o=[],l=0,h=0,u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;for(i=1;i<a.length;i++){var d=a[i],c=d.charAt(0);for(d=d.slice(1),o.length=0;r=u.exec(d);)o.push(r[0]);for(var f=[],g=0,p=o.length;g<p;g++)if("00"!==o[g]){var m=parseFloat(o[g]);isNaN(m)?f.push(0):f.push(m)}else f.push(0,0);for(;f.length>0&&!isNaN(f[0]);){var v,y,b,C,x,_,S,A,w,k,E=null,P=[],D=l,R=h;switch(c){case"l":l+=f.shift(),h+=f.shift(),E="L",P.push(l,h);break;case"L":l=f.shift(),h=f.shift(),P.push(l,h);break;case"m":var M=f.shift(),I=f.shift();if(l+=M,h+=I,E="M",s.length>2&&"z"===s[s.length-1].command)for(var T=s.length-2;T>=0;T--)if("M"===s[T].command){l=s[T].points[0]+M,h=s[T].points[1]+I;break}P.push(l,h),c="l";break;case"M":l=f.shift(),h=f.shift(),E="M",P.push(l,h),c="L";break;case"h":l+=f.shift(),E="L",P.push(l,h);break;case"H":l=f.shift(),E="L",P.push(l,h);break;case"v":h+=f.shift(),E="L",P.push(l,h);break;case"V":h=f.shift(),E="L",P.push(l,h);break;case"C":P.push(f.shift(),f.shift(),f.shift(),f.shift()),l=f.shift(),h=f.shift(),P.push(l,h);break;case"c":P.push(l+f.shift(),h+f.shift(),l+f.shift(),h+f.shift()),l+=f.shift(),h+=f.shift(),E="C",P.push(l,h);break;case"S":y=l,b=h,"C"===(v=s[s.length-1]).command&&(y=l+(l-v.points[2]),b=h+(h-v.points[3])),P.push(y,b,f.shift(),f.shift()),l=f.shift(),h=f.shift(),E="C",P.push(l,h);break;case"s":y=l,b=h,"C"===(v=s[s.length-1]).command&&(y=l+(l-v.points[2]),b=h+(h-v.points[3])),P.push(y,b,l+f.shift(),h+f.shift()),l+=f.shift(),h+=f.shift(),E="C",P.push(l,h);break;case"Q":P.push(f.shift(),f.shift()),l=f.shift(),h=f.shift(),P.push(l,h);break;case"q":P.push(l+f.shift(),h+f.shift()),l+=f.shift(),h+=f.shift(),E="Q",P.push(l,h);break;case"T":y=l,b=h,"Q"===(v=s[s.length-1]).command&&(y=l+(l-v.points[0]),b=h+(h-v.points[1])),l=f.shift(),h=f.shift(),E="Q",P.push(y,b,l,h);break;case"t":y=l,b=h,"Q"===(v=s[s.length-1]).command&&(y=l+(l-v.points[0]),b=h+(h-v.points[1])),l+=f.shift(),h+=f.shift(),E="Q",P.push(y,b,l,h);break;case"A":C=f.shift(),x=f.shift(),_=f.shift(),S=f.shift(),A=f.shift(),w=l,k=h,l=f.shift(),h=f.shift(),E="A",P=this.convertEndpointToCenterParameterization(w,k,l,h,S,A,C,x,_);break;case"a":C=f.shift(),x=f.shift(),_=f.shift(),S=f.shift(),A=f.shift(),w=l,k=h,l+=f.shift(),h+=f.shift(),E="A",P=this.convertEndpointToCenterParameterization(w,k,l,h,S,A,C,x,_)}s.push({command:E||c,points:P,start:{x:D,y:R},pathLength:this.calcLength(D,R,E||c,P)})}"z"!==c&&"Z"!==c||s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,t,n,i){var r,a,s,o,l=on;switch(n){case"L":return l.getLineLength(e,t,i[0],i[1]);case"C":for(r=0,a=l.getPointOnCubicBezier(0,e,t,i[0],i[1],i[2],i[3],i[4],i[5]),o=.01;o<=1;o+=.01)s=l.getPointOnCubicBezier(o,e,t,i[0],i[1],i[2],i[3],i[4],i[5]),r+=l.getLineLength(a.x,a.y,s.x,s.y),a=s;return r;case"Q":for(r=0,a=l.getPointOnQuadraticBezier(0,e,t,i[0],i[1],i[2],i[3]),o=.01;o<=1;o+=.01)s=l.getPointOnQuadraticBezier(o,e,t,i[0],i[1],i[2],i[3]),r+=l.getLineLength(a.x,a.y,s.x,s.y),a=s;return r;case"A":r=0;var h=i[4],u=i[5],d=i[4]+u,c=Math.PI/180;if(Math.abs(h-d)<c&&(c=Math.abs(h-d)),a=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],h,0),u<0)for(o=h-c;o>d;o-=c)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],o,0),r+=l.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(o=h+c;o<d;o+=c)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],o,0),r+=l.getLineLength(a.x,a.y,s.x,s.y),a=s;return s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],d,0),r+l.getLineLength(a.x,a.y,s.x,s.y)}return 0}static convertEndpointToCenterParameterization(e,t,n,i,r,a,s,o,l){var h=l*(Math.PI/180),u=Math.cos(h)*(e-n)/2+Math.sin(h)*(t-i)/2,d=-1*Math.sin(h)*(e-n)/2+Math.cos(h)*(t-i)/2,c=u*u/(s*s)+d*d/(o*o);c>1&&(s*=Math.sqrt(c),o*=Math.sqrt(c));var f=Math.sqrt((s*s*(o*o)-s*s*(d*d)-o*o*(u*u))/(s*s*(d*d)+o*o*(u*u)));r===a&&(f*=-1),isNaN(f)&&(f=0);var g=f*s*d/o,p=f*-o*u/s,m=(e+n)/2+Math.cos(h)*g-Math.sin(h)*p,v=(t+i)/2+Math.sin(h)*g+Math.cos(h)*p,y=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},b=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(y(e)*y(t))},C=function(e,t){return(e[0]*t[1]<e[1]*t[0]?-1:1)*Math.acos(b(e,t))},x=C([1,0],[(u-g)/s,(d-p)/o]),_=[(u-g)/s,(d-p)/o],S=[(-1*u-g)/s,(-1*d-p)/o],A=C(_,S);return b(_,S)<=-1&&(A=Math.PI),b(_,S)>=1&&(A=0),0===a&&A>0&&(A-=2*Math.PI),1===a&&A<0&&(A+=2*Math.PI),[m,v,s,o,x,A,h,a]}}on.prototype.className="Path",on.prototype._attrsAffectingSize=["data"],re(on),we.addGetterSetter(on,"data");class ln extends sn{_sceneFunc(e){super._sceneFunc(e);var t=2*Math.PI,n=this.points(),i=n,r=0!==this.tension()&&n.length>4;r&&(i=this.getTensionPoints());var a,s,o=this.pointerLength(),l=n.length;if(r){const e=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],n[l-2],n[l-1]],t=on.calcLength(i[i.length-4],i[i.length-3],"C",e),r=on.getPointOnQuadraticBezier(Math.min(1,1-o/t),e[0],e[1],e[2],e[3],e[4],e[5]);a=n[l-2]-r.x,s=n[l-1]-r.y}else a=n[l-2]-n[l-4],s=n[l-1]-n[l-3];var h=(Math.atan2(s,a)+t)%t,u=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[l-2],n[l-1]),e.rotate(h),e.moveTo(0,0),e.lineTo(-o,u/2),e.lineTo(-o,-u/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),r?(a=(i[0]+i[2])/2-n[0],s=(i[1]+i[3])/2-n[1]):(a=n[2]-n[0],s=n[3]-n[1]),e.rotate((Math.atan2(-s,-a)+t)%t),e.moveTo(0,0),e.lineTo(-o,u/2),e.lineTo(-o,-u/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}}ln.prototype.className="Arrow",re(ln),we.addGetterSetter(ln,"pointerLength",10,ve()),we.addGetterSetter(ln,"pointerWidth",10,ve()),we.addGetterSetter(ln,"pointerAtBeginning",!1),we.addGetterSetter(ln,"pointerAtEnding",!0);class hn extends Vt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}hn.prototype._centroid=!0,hn.prototype.className="Circle",hn.prototype._attrsAffectingSize=["radius"],re(hn),we.addGetterSetter(hn,"radius",0,ve());class un extends Vt{_sceneFunc(e){var t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,2*Math.PI,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}un.prototype.className="Ellipse",un.prototype._centroid=!0,un.prototype._attrsAffectingSize=["radiusX","radiusY"],re(un),we.addComponentsGetterSetter(un,"radius",["x","y"]),we.addGetterSetter(un,"radiusX",0,ve()),we.addGetterSetter(un,"radiusY",0,ve());class dn extends Vt{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&4===e.readyState||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const t=this.getWidth(),n=this.getHeight(),i=this.attrs.image;let r;if(i){const e=this.attrs.cropWidth,a=this.attrs.cropHeight;r=e&&a?[i,this.cropX(),this.cropY(),e,a,0,0,t,n]:[i,0,0,t,n]}(this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)),i&&e.drawImage.apply(e,r)}_hitFunc(e){var t=this.width(),n=this.height();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,t;return null!==(e=this.attrs.width)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.width}getHeight(){var e,t;return null!==(e=this.attrs.height)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.height}static fromURL(e,t){var n=ge.createImageElement();n.onload=function(){var e=new dn({image:n});t(e)},n.crossOrigin="Anonymous",n.src=e}}dn.prototype.className="Image",re(dn),we.addGetterSetter(dn,"image"),we.addComponentsGetterSetter(dn,"crop",["x","y","width","height"]),we.addGetterSetter(dn,"cropX",0,ve()),we.addGetterSetter(dn,"cropY",0,ve()),we.addGetterSetter(dn,"cropWidth",0,ve()),we.addGetterSetter(dn,"cropHeight",0,ve());var cn=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height"],fn="up",gn="right",pn="down",mn="left",vn=cn.length;class yn extends jt{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){var t,n=this,i=function(){n._sync()};for(t=0;t<vn;t++)e.on(cn[t]+"Change.konva",i)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var e,t,n,i,r,a,s,o=this.getText(),l=this.getTag();if(o&&l){switch(e=o.width(),t=o.height(),n=l.pointerDirection(),i=l.pointerWidth(),s=l.pointerHeight(),r=0,a=0,n){case fn:r=e/2,a=-1*s;break;case gn:r=e+i,a=t/2;break;case pn:r=e/2,a=t+s;break;case mn:r=-1*i,a=t/2}l.setAttrs({x:-1*r,y:-1*a,width:e,height:t}),o.setAttrs({x:-1*r,y:-1*a})}}}yn.prototype.className="Label",re(yn);class bn extends Vt{_sceneFunc(e){var t=this.width(),n=this.height(),i=this.pointerDirection(),r=this.pointerWidth(),a=this.pointerHeight(),s=this.cornerRadius();let o=0,l=0,h=0,u=0;"number"==typeof s?o=l=h=u=Math.min(s,t/2,n/2):(o=Math.min(s[0]||0,t/2,n/2),l=Math.min(s[1]||0,t/2,n/2),u=Math.min(s[2]||0,t/2,n/2),h=Math.min(s[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(o,0),i===fn&&(e.lineTo((t-r)/2,0),e.lineTo(t/2,-1*a),e.lineTo((t+r)/2,0)),e.lineTo(t-l,0),e.arc(t-l,l,l,3*Math.PI/2,0,!1),i===gn&&(e.lineTo(t,(n-a)/2),e.lineTo(t+r,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),i===pn&&(e.lineTo((t+r)/2,n),e.lineTo(t/2,n+a),e.lineTo((t-r)/2,n)),e.lineTo(h,n),e.arc(h,n-h,h,Math.PI/2,Math.PI,!1),i===mn&&(e.lineTo(0,(n+a)/2),e.lineTo(-1*r,n/2),e.lineTo(0,(n-a)/2)),e.lineTo(0,o),e.arc(o,o,o,Math.PI,3*Math.PI/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){var e=0,t=0,n=this.pointerWidth(),i=this.pointerHeight(),r=this.pointerDirection(),a=this.width(),s=this.height();return r===fn?(t-=i,s+=i):r===pn?s+=i:r===mn?(e-=1.5*n,a+=n):r===gn&&(a+=1.5*n),{x:e,y:t,width:a,height:s}}}bn.prototype.className="Tag",re(bn),we.addGetterSetter(bn,"pointerDirection","none"),we.addGetterSetter(bn,"pointerWidth",0,ve()),we.addGetterSetter(bn,"pointerHeight",0,ve()),we.addGetterSetter(bn,"cornerRadius",0,ye(4));class Cn extends Vt{_sceneFunc(e){var t=this.cornerRadius(),n=this.width(),i=this.height();if(e.beginPath(),t){let r=0,a=0,s=0,o=0;"number"==typeof t?r=a=s=o=Math.min(t,n/2,i/2):(r=Math.min(t[0]||0,n/2,i/2),a=Math.min(t[1]||0,n/2,i/2),o=Math.min(t[2]||0,n/2,i/2),s=Math.min(t[3]||0,n/2,i/2)),e.moveTo(r,0),e.lineTo(n-a,0),e.arc(n-a,a,a,3*Math.PI/2,0,!1),e.lineTo(n,i-o),e.arc(n-o,i-o,o,0,Math.PI/2,!1),e.lineTo(s,i),e.arc(s,i-s,s,Math.PI/2,Math.PI,!1),e.lineTo(0,r),e.arc(r,r,r,Math.PI,3*Math.PI/2,!1)}else e.rect(0,0,n,i);e.closePath(),e.fillStrokeShape(this)}}Cn.prototype.className="Rect",re(Cn),we.addGetterSetter(Cn,"cornerRadius",0,ye(4));class xn extends Vt{_sceneFunc(e){const t=this._getPoints();e.beginPath(),e.moveTo(t[0].x,t[0].y);for(var n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(var i=0;i<e;i++)n.push({x:t*Math.sin(2*i*Math.PI/e),y:-1*t*Math.cos(2*i*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();var t=e[0].x,n=e[0].y,i=e[0].x,r=e[0].y;return e.forEach(e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),i=Math.min(i,e.y),r=Math.max(r,e.y)}),{x:t,y:i,width:n-t,height:r-i}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}xn.prototype.className="RegularPolygon",xn.prototype._centroid=!0,xn.prototype._attrsAffectingSize=["radius"],re(xn),we.addGetterSetter(xn,"radius",0,ve()),we.addGetterSetter(xn,"sides",0,ve());var _n=2*Math.PI;class Sn extends Vt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,_n,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),_n,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Sn.prototype.className="Ring",Sn.prototype._centroid=!0,Sn.prototype._attrsAffectingSize=["innerRadius","outerRadius"],re(Sn),we.addGetterSetter(Sn,"innerRadius",0,ve()),we.addGetterSetter(Sn,"outerRadius",0,ve());class An extends Vt{constructor(e){super(e),this._updated=!0,this.anim=new qt(()=>{var e=this._updated;return this._updated=!1,e}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){var t=this.animation(),n=this.frameIndex(),i=4*n,r=this.animations()[t],a=this.frameOffsets(),s=r[i+0],o=r[i+1],l=r[i+2],h=r[i+3],u=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,h),e.closePath(),e.fillStrokeShape(this)),u)if(a){var d=a[t],c=2*n;e.drawImage(u,s,o,l,h,d[c+0],d[c+1],l,h)}else e.drawImage(u,s,o,l,h,0,0,l,h)}_hitFunc(e){var t=this.animation(),n=this.frameIndex(),i=4*n,r=this.animations()[t],a=this.frameOffsets(),s=r[i+2],o=r[i+3];if(e.beginPath(),a){var l=a[t],h=2*n;e.rect(l[h+0],l[h+1],s,o)}else e.rect(0,0,s,o);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var 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(){var e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}}An.prototype.className="Sprite",re(An),we.addGetterSetter(An,"animation"),we.addGetterSetter(An,"animations"),we.addGetterSetter(An,"frameOffsets"),we.addGetterSetter(An,"image"),we.addGetterSetter(An,"frameIndex",0,ve()),we.addGetterSetter(An,"frameRate",17,ve()),we.backCompat(An,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class wn extends Vt{_sceneFunc(e){var t=this.innerRadius(),n=this.outerRadius(),i=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(var r=1;r<2*i;r++){var a=r%2==0?n:t,s=a*Math.sin(r*Math.PI/i),o=-1*a*Math.cos(r*Math.PI/i);e.lineTo(s,o)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}function kn(e){return Array.from(e)}wn.prototype.className="Star",wn.prototype._centroid=!0,wn.prototype._attrsAffectingSize=["innerRadius","outerRadius"],re(wn),we.addGetterSetter(wn,"numPoints",5,ve()),we.addGetterSetter(wn,"innerRadius",0,ve()),we.addGetterSetter(wn,"outerRadius",0,ve());var En,Pn="auto",Dn="justify",Rn="left",Mn="middle",In="normal",Tn=" ",Ln=["fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],Hn=Ln.length;function On(){return En||(En=ge.createCanvasElement().getContext("2d"))}class Bn extends Vt{constructor(e){super(function(e){return(e=e||{}).fillLinearGradientColorStops||e.fillRadialGradientColorStops||e.fillPatternImage||(e.fill=e.fill||"black"),e}(e)),this._partialTextX=0,this._partialTextY=0;for(var t=0;t<Hn;t++)this.on(Ln[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(e){var t=this.textArr,n=t.length;if(this.text()){var i,r=this.padding(),a=this.fontSize(),s=this.lineHeight()*a,o=this.verticalAlign(),l=0,h=this.align(),u=this.getWidth(),d=this.letterSpacing(),c=this.fill(),f=this.textDecoration(),g=-1!==f.indexOf("underline"),p=-1!==f.indexOf("line-through"),m=0,v=(m=s/2,0),y=0;for(e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",Mn),e.setAttr("textAlign",Rn),o===Mn?l=(this.getHeight()-n*s-2*r)/2:"bottom"===o&&(l=this.getHeight()-n*s-2*r),e.translate(r,l+r),i=0;i<n;i++){v=0,y=0;var b,C,x,_=t[i],S=_.text,A=_.width,w=i!==n-1;if(e.save(),"right"===h?v+=u-A-2*r:"center"===h&&(v+=(u-A-2*r)/2),g&&(e.save(),e.beginPath(),e.moveTo(v,m+y+Math.round(a/2)),C=0==(b=S.split(" ").length-1),x=h===Dn&&w&&!C?u-2*r:A,e.lineTo(v+Math.round(x),m+y+Math.round(a/2)),e.lineWidth=a/15,e.strokeStyle=c,e.stroke(),e.restore()),p&&(e.save(),e.beginPath(),e.moveTo(v,m+y),C=0==(b=S.split(" ").length-1),x=h===Dn&&w&&!C?u-2*r:A,e.lineTo(v+Math.round(x),m+y),e.lineWidth=a/15,e.strokeStyle=c,e.stroke(),e.restore()),0!==d||h===Dn){b=S.split(" ").length-1;for(var k=kn(S),E=0;E<k.length;E++){var P=k[E];" "===P&&i!==n-1&&h===Dn&&(v+=(u-2*r-A)/b),this._partialTextX=v,this._partialTextY=m+y,this._partialText=P,e.fillStrokeShape(this),v+=this.measureSize(P).width+d}}else this._partialTextX=v,this._partialTextY=m+y,this._partialText=S,e.fillStrokeShape(this);e.restore(),n>1&&(m+=s)}}}_hitFunc(e){var t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){var t=ge._isString(e)?e:null==e?"":e+"";return this._setAttr("text",t),this}getWidth(){return this.attrs.width===Pn||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===Pn||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return ge.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n=On(),i=this.fontSize();return n.save(),n.font=this._getContextFont(),t=n.measureText(e),n.restore(),{width:t.width,height:i}}_getContextFont(){return this.fontStyle()+Tn+this.fontVariant()+Tn+(this.fontSize()+"px ")+this.fontFamily().split(",").map(e=>{const t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e=`"${e}"`),e}).join(", ")}_addTextLine(e){this.align()===Dn&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t})}_getTextWidth(e){var t=this.letterSpacing(),n=e.length;return On().measureText(e).width+(n?t*(n-1):0)}_setTextData(){var e=this.text().split("\n"),t=+this.fontSize(),n=0,i=this.lineHeight()*t,r=this.attrs.width,a=this.attrs.height,s=r!==Pn&&void 0!==r,o=a!==Pn&&void 0!==a,l=this.padding(),h=r-2*l,u=a-2*l,d=0,c=this.wrap(),f="none"!==c,g="char"!==c&&f,p=this.ellipsis();this.textArr=[],On().font=this._getContextFont();for(var m=p?this._getTextWidth("…"):0,v=0,y=e.length;v<y;++v){var b=e[v],C=this._getTextWidth(b);if(s&&C>h)for(;b.length>0;){for(var x=0,_=b.length,S="",A=0;x<_;){var w=x+_>>>1,k=b.slice(0,w+1),E=this._getTextWidth(k)+m;E<=h?(x=w+1,S=k,A=E):_=w}if(!S)break;if(g){var P,D=b[S.length];(P=(D===Tn||"-"===D)&&A<=h?S.length:Math.max(S.lastIndexOf(Tn),S.lastIndexOf("-"))+1)>0&&(x=P,S=S.slice(0,x),A=this._getTextWidth(S))}if(S=S.trimRight(),this._addTextLine(S),n=Math.max(n,A),d+=i,!f||o&&d+i>u){var R=this.textArr[this.textArr.length-1];R&&p&&(this._getTextWidth(R.text+"…")<h||(R.text=R.text.slice(0,R.text.length-3)),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(R.text+"…"));break}if((b=(b=b.slice(x)).trimLeft()).length>0&&(C=this._getTextWidth(b))<=h){this._addTextLine(b),d+=i,n=Math.max(n,C);break}}else this._addTextLine(b),d+=i,n=Math.max(n,C);if(o&&d+i>u)break}this.textHeight=t,this.textWidth=n}getStrokeScaleEnabled(){return!0}}Bn.prototype._fillFunc=function(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)},Bn.prototype._strokeFunc=function(e){e.strokeText(this._partialText,this._partialTextX,this._partialTextY)},Bn.prototype.className="Text",Bn.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],re(Bn),we.overWriteSetter(Bn,"width",be()),we.overWriteSetter(Bn,"height",be()),we.addGetterSetter(Bn,"fontFamily","Arial"),we.addGetterSetter(Bn,"fontSize",12,ve()),we.addGetterSetter(Bn,"fontStyle",In),we.addGetterSetter(Bn,"fontVariant",In),we.addGetterSetter(Bn,"padding",0,ve()),we.addGetterSetter(Bn,"align",Rn),we.addGetterSetter(Bn,"verticalAlign","top"),we.addGetterSetter(Bn,"lineHeight",1,ve()),we.addGetterSetter(Bn,"wrap","word"),we.addGetterSetter(Bn,"ellipsis",!1,_e()),we.addGetterSetter(Bn,"letterSpacing",0,ve()),we.addGetterSetter(Bn,"text","",Ce()),we.addGetterSetter(Bn,"textDecoration","");var Fn="normal";function Nn(e){e.fillText(this.partialText,0,0)}function zn(e){e.strokeText(this.partialText,0,0)}class Vn extends Vt{constructor(e){super(e),this.dummyCanvas=ge.createCanvasElement(),this.dataArray=[],this.dataArray=on.parsePathData(this.attrs.data),this.on("dataChange.konva",function(){this.dataArray=on.parsePathData(this.attrs.data),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva",this._setTextData),this._setTextData()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();var t=this.textDecoration(),n=this.fill(),i=this.fontSize(),r=this.glyphInfo;"underline"===t&&e.beginPath();for(var a=0;a<r.length;a++){e.save();var s=r[a].p0;e.translate(s.x,s.y),e.rotate(r[a].rotation),this.partialText=r[a].text,e.fillStrokeShape(this),"underline"===t&&(0===a&&e.moveTo(0,i/2+1),e.lineTo(i,i/2+1)),e.restore()}"underline"===t&&(e.strokeStyle=n,e.lineWidth=i/20,e.stroke()),e.restore()}_hitFunc(e){e.beginPath();var t=this.glyphInfo;if(t.length>=1){var n=t[0].p0;e.moveTo(n.x,n.y)}for(var i=0;i<t.length;i++){var r=t[i].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 ge.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Bn.prototype.setText.call(this,e)}_getContextFont(){return Bn.prototype._getContextFont.call(this)}_getTextSize(e){var t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();var n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(this.attrs.fontSize,10)}}_setTextData(){var e=this,t=this._getTextSize(this.attrs.text),n=this.letterSpacing(),i=this.align(),r=this.kerningFunc();this.textWidth=t.width,this.textHeight=t.height;var a=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);this.glyphInfo=[];for(var s=0,o=0;o<e.dataArray.length;o++)e.dataArray[o].pathLength>0&&(s+=e.dataArray[o].pathLength);var l=0;"center"===i&&(l=Math.max(0,s/2-a/2)),"right"===i&&(l=Math.max(0,s-a));for(var h,u,d,c=kn(this.text()),f=this.text().split(" ").length-1,g=-1,p=0,m=function(){p=0;for(var t=e.dataArray,n=g+1;n<t.length;n++){if(t[n].pathLength>0)return g=n,t[n];"M"===t[n].command&&(h={x:t[n].points[0],y:t[n].points[1]})}return{}},v=function(t){var r=e._getTextSize(t).width+n;" "===t&&"justify"===i&&(r+=(s-a)/f);var o=0,l=0;for(u=void 0;Math.abs(r-o)/r>.01&&l<20;){l++;for(var c=o;void 0===d;)(d=m())&&c+d.pathLength<r&&(c+=d.pathLength,d=void 0);if(d==={}||void 0===h)return;var g=!1;switch(d.command){case"L":on.getLineLength(h.x,h.y,d.points[0],d.points[1])>r?u=on.getPointOnLine(r,h.x,h.y,d.points[0],d.points[1],h.x,h.y):d=void 0;break;case"A":var v=d.points[4],y=d.points[5],b=d.points[4]+y;0===p?p=v+1e-8:r>o?p+=Math.PI/180*y/Math.abs(y):p-=Math.PI/360*y/Math.abs(y),(y<0&&p<b||y>=0&&p>b)&&(p=b,g=!0),u=on.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],p,d.points[6]);break;case"C":0===p?p=r>d.pathLength?1e-8:r/d.pathLength:r>o?p+=(r-o)/d.pathLength/2:p=Math.max(p-(o-r)/d.pathLength/2,0),p>1&&(p=1,g=!0),u=on.getPointOnCubicBezier(p,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3],d.points[4],d.points[5]);break;case"Q":0===p?p=r/d.pathLength:r>o?p+=(r-o)/d.pathLength:p-=(o-r)/d.pathLength,p>1&&(p=1,g=!0),u=on.getPointOnQuadraticBezier(p,d.start.x,d.start.y,d.points[0],d.points[1],d.points[2],d.points[3])}void 0!==u&&(o=on.getLineLength(h.x,h.y,u.x,u.y)),g&&(g=!1,d=void 0)}},y=l/(e._getTextSize("C").width+n)-1,b=0;b<y&&(v("C"),void 0!==h&&void 0!==u);b++)h=u;for(var C=0;C<c.length&&(v(c[C]),void 0!==h&&void 0!==u);C++){var x=on.getLineLength(h.x,h.y,u.x,u.y),_=0;if(r)try{_=r(c[C-1],c[C])*this.fontSize()}catch(e){_=0}h.x+=_,u.x+=_,this.textWidth+=_;var S=on.getPointOnLine(_+x/2,h.x,h.y,u.x,u.y),A=Math.atan2(u.y-h.y,u.x-h.x);this.glyphInfo.push({transposeX:S.x,transposeY:S.y,text:c[C],rotation:A,p0:h,p1:u}),h=u}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var 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)});for(var t,n,i=e[0]||0,r=e[0]||0,a=e[1]||0,s=e[1]||0,o=0;o<e.length/2;o++)t=e[2*o],n=e[2*o+1],i=Math.min(i,t),r=Math.max(r,t),a=Math.min(a,n),s=Math.max(s,n);var l=this.fontSize();return{x:i-l/2,y:a-l/2,width:r-i+l,height:s-a+l}}}Vn.prototype._fillFunc=Nn,Vn.prototype._strokeFunc=zn,Vn.prototype._fillFuncHit=Nn,Vn.prototype._strokeFuncHit=zn,Vn.prototype.className="TextPath",Vn.prototype._attrsAffectingSize=["text","fontSize","data"],re(Vn),we.addGetterSetter(Vn,"data"),we.addGetterSetter(Vn,"fontFamily","Arial"),we.addGetterSetter(Vn,"fontSize",12,ve()),we.addGetterSetter(Vn,"fontStyle",Fn),we.addGetterSetter(Vn,"align","left"),we.addGetterSetter(Vn,"letterSpacing",0,ve()),we.addGetterSetter(Vn,"textBaseline","middle"),we.addGetterSetter(Vn,"fontVariant",Fn),we.addGetterSetter(Vn,"text",""),we.addGetterSetter(Vn,"textDecoration",null),we.addGetterSetter(Vn,"kerningFunc",null);var Gn="tr-konva",Un=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange"].map(e=>e+`.${Gn}`).join(" "),Wn="nodesRect",Qn=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],jn={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const Yn="ontouchstart"in ie._global;var qn=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function Zn(e,t,n){const i=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),r=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:i,y:r})}class Xn extends jt{constructor(e){super(e),this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Un,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return ge.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 Gn+this._id}setNodes(e=[]){return this._nodes&&this._nodes.length&&this.detach(),this._nodes=e,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(e=>{const t=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},n=e._attrsAffectingSize.map(e=>e+"Change."+this._getEventNamespace()).join(" ");e.on(n,t),e.on(Qn.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;const i=e.getAbsolutePosition(),r=i.x-t.x,a=i.y-t.y;this.nodes().forEach(t=>{if(t===e)return;if(t.isDragging())return;const i=t.getAbsolutePosition();t.setAbsolutePosition({x:i.x+r,y:i.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(Wn),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Wn,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){var i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=e.getAbsoluteScale(n),a=e.getAbsolutePosition(n),s=i.x*r.x-e.offsetX()*r.x,o=i.y*r.y-e.offsetY()*r.y;const l=(ie.getAngle(e.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return Zn({x:a.x+s*Math.cos(l)+o*Math.sin(-l),y:a.y+o*Math.cos(l)+s*Math.sin(l),width:i.width*r.x,height:i.height*r.y,rotation:l},-ie.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map(t=>{const n=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var i=[{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}],r=t.getAbsoluteTransform();i.forEach(function(t){var n=r.point(t);e.push(n)})});const t=new se;var n,i,r,a;t.rotate(-ie.getAngle(this.rotation())),e.forEach(function(e){var s=t.point(e);void 0===n&&(n=r=s.x,i=a=s.y),n=Math.min(n,s.x),i=Math.min(i,s.y),r=Math.max(r,s.x),a=Math.max(a,s.y)}),t.invert();const s=t.point({x:n,y:i});return{x:s.x,y:s.y,width:r-n,height:a-i,rotation:ie.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(),qn.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var t=new Cn({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Yn?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",()=>{var n=ie.getAngle(this.rotation()),i=function(e,t){if("rotater"===e)return"crosshair";t+=ge.degToRad(jn[e]||0);var n=(ge.radToDeg(t)%360+360)%360;return ge._inRange(n,337.5,360)||ge._inRange(n,0,22.5)?"ns-resize":ge._inRange(n,22.5,67.5)?"nesw-resize":ge._inRange(n,67.5,112.5)?"ew-resize":ge._inRange(n,112.5,157.5)?"nwse-resize":ge._inRange(n,157.5,202.5)?"ns-resize":ge._inRange(n,202.5,247.5)?"nesw-resize":ge._inRange(n,247.5,292.5)?"ew-resize":ge._inRange(n,292.5,337.5)?"nwse-resize":(ge.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}(e,n);t.getStage().content&&(t.getStage().content.style.cursor=i),this._cursorChange=!0}),t.on("mouseout",()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(t)}_createBack(){var e=new Vt({name:"back",width:0,height:0,draggable:!0,sceneFunc(e){var t=this.getParent(),n=t.padding();e.beginPath(),e.rect(-n,-n,this.width()+2*n,this.height()+2*n),e.moveTo(this.width()/2,-n),t.rotateEnabled()&&e.lineTo(this.width()/2,-t.rotateAnchorOffset()*ge._sign(this.height())-n),e.fillStrokeShape(this)},hitFunc:(e,t)=>{if(this.shouldOverdrawWholeArea()){var n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+2*n,t.height()+2*n),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){this._movingAnchorName=e.target.name().split(" ")[0];var t=this._getNodeRect(),n=t.width,i=t.height,r=Math.sqrt(Math.pow(n,2)+Math.pow(i,2));this.sin=Math.abs(i/r),this.cos=Math.abs(n/r),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=e.target.getAbsolutePosition(),s=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},this._fire("transformstart",{evt:e,target:this.getNode()}),this._nodes.forEach(t=>{t._fire("transformstart",{evt:e,target:t})})}_handleMouseMove(e){var t,n,i,r=this.findOne("."+this._movingAnchorName),a=r.getStage();a.setPointersPositions(e);const s=a.getPointerPosition();let o={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const l=r.getAbsolutePosition();this.anchorDragBoundFunc()&&(o=this.anchorDragBoundFunc()(l,o,e)),r.setAbsolutePosition(o);const h=r.getAbsolutePosition();if(l.x!==h.x||l.y!==h.y){if("rotater"===this._movingAnchorName){var u=this._getNodeRect();t=r.x()-u.width/2,n=-r.y()+u.height/2;let i=Math.atan2(-n,t)+Math.PI/2;u.height<0&&(i-=Math.PI);const a=ie.getAngle(this.rotation())+i,s=ie.getAngle(this.rotationSnapTolerance()),o=function(e,t,n){let i=t;for(let r=0;r<e.length;r++){const a=ie.getAngle(e[r]),s=Math.abs(a-t)%(2*Math.PI);Math.min(s,2*Math.PI-s)<n&&(i=a)}return i}(this.rotationSnaps(),a,s),l=function(e,t){const n=function(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)}}(e);return Zn(e,t,n)}(u,o-u.rotation);return void this._fitNodesInto(l,e)}var d=this.keepRatio()||e.shiftKey,c=this.centeredScaling()||e.altKey;if("top-left"===this._movingAnchorName){if(d){var f=c?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(f.x-r.x(),2)+Math.pow(f.y-r.y(),2));var g=this.findOne(".top-left").x()>f.x?-1:1,p=this.findOne(".top-left").y()>f.y?-1:1;t=i*this.cos*g,n=i*this.sin*p,this.findOne(".top-left").x(f.x-t),this.findOne(".top-left").y(f.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(r.y());else if("top-right"===this._movingAnchorName){d&&(f=c?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()},i=Math.sqrt(Math.pow(r.x()-f.x,2)+Math.pow(f.y-r.y(),2)),g=this.findOne(".top-right").x()<f.x?-1:1,p=this.findOne(".top-right").y()>f.y?-1:1,t=i*this.cos*g,n=i*this.sin*p,this.findOne(".top-right").x(f.x+t),this.findOne(".top-right").y(f.y-n));var m=r.position();this.findOne(".top-left").y(m.y),this.findOne(".bottom-right").x(m.x)}else"middle-left"===this._movingAnchorName?this.findOne(".top-left").x(r.x()):"middle-right"===this._movingAnchorName?this.findOne(".bottom-right").x(r.x()):"bottom-left"===this._movingAnchorName?(d&&(f=c?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()},i=Math.sqrt(Math.pow(f.x-r.x(),2)+Math.pow(r.y()-f.y,2)),g=f.x<r.x()?-1:1,p=r.y()<f.y?-1:1,t=i*this.cos*g,n=i*this.sin*p,r.x(f.x-t),r.y(f.y+n)),m=r.position(),this.findOne(".top-left").x(m.x),this.findOne(".bottom-right").y(m.y)):"bottom-center"===this._movingAnchorName?this.findOne(".bottom-right").y(r.y()):"bottom-right"===this._movingAnchorName?d&&(f=c?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()},i=Math.sqrt(Math.pow(r.x()-f.x,2)+Math.pow(r.y()-f.y,2)),g=this.findOne(".bottom-right").x()<f.x?-1:1,p=this.findOne(".bottom-right").y()<f.y?-1:1,t=i*this.cos*g,n=i*this.sin*p,this.findOne(".bottom-right").x(f.x+t),this.findOne(".bottom-right").y(f.y+n)):console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(c=this.centeredScaling()||e.altKey){var v=this.findOne(".top-left"),y=this.findOne(".bottom-right"),b=v.x(),C=v.y(),x=this.getWidth()-y.x(),_=this.getHeight()-y.y();y.move({x:-b,y:-C}),v.move({x:x,y:_})}var S=this.findOne(".top-left").getAbsolutePosition();t=S.x,n=S.y;var A=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),w=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:A,height:w,rotation:ie.getAngle(this.rotation())},e)}}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var t=this.getNode();this._fire("transformend",{evt:e,target:t}),t&&this._nodes.forEach(t=>{t._fire("transformend",{evt:e,target:t})}),this._movingAnchorName=null}}_fitNodesInto(e,t){var n=this._getNodeRect();if(ge._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(ge._inRange(e.height,2*-this.padding()-1,1))return void this.update();const i=this.flipEnabled();var r=new se;if(r.rotate(ie.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=r.point({x:2*-this.padding(),y:0});if(e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,!i)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=r.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding(),!i)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=r.point({x:0,y:2*-this.padding()});if(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+=2*this.padding(),!i)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=r.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!i)return void this.update()}if(this.boundBoxFunc()){const t=this.boundBoxFunc()(n,e);t?e=t:ge.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,s=new se;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/a,n.height/a);const o=new se;o.translate(e.x,e.y),o.rotate(e.rotation),o.scale(e.width/a,e.height/a);const l=o.multiply(s.invert());this._nodes.forEach(e=>{var n;const i=e.getParent().getAbsoluteTransform(),r=e.getTransform().copy();r.translate(e.offsetX(),e.offsetY());const a=new se;a.multiply(i.copy().invert()).multiply(l).multiply(i).multiply(r);const s=a.decompose();e.setAttrs(s),this._fire("transform",{evt:t,target:e}),e._fire("transform",{evt:t,target:e}),null===(n=e.getLayer())||void 0===n||n.batchDraw()}),this.rotation(ge._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e,t=this._getNodeRect();this.rotation(ge._getRotation(t.rotation));var n=t.width,i=t.height,r=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),o=this.anchorSize();this.find("._anchor").forEach(e=>{e.setAttrs({width:o,height:o,offsetX:o/2,offsetY:o/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:o/2+s,offsetY:o/2+s,visible:a&&r.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:o/2+s,visible:a&&r.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:o/2-s,offsetY:o/2+s,visible:a&&r.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:o/2+s,visible:a&&r.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:i/2,offsetX:o/2-s,visible:a&&r.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:o/2+s,offsetY:o/2-s,visible:a&&r.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:i,offsetY:o/2-s,visible:a&&r.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:i,offsetX:o/2-s,offsetY:o/2-s,visible:a&&r.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:n/2,y:-this.rotateAnchorOffset()*ge._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),jt.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Xe.prototype.toObject.call(this)}}Xn.prototype.className="Transformer",re(Xn),we.addGetterSetter(Xn,"enabledAnchors",qn,function(e){return e instanceof Array||ge.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(e){-1===qn.indexOf(e)&&ge.warn("Unknown anchor name: "+e+". Available names are: "+qn.join(", "))}),e||[]}),we.addGetterSetter(Xn,"flipEnabled",!0,_e()),we.addGetterSetter(Xn,"resizeEnabled",!0),we.addGetterSetter(Xn,"anchorSize",10,ve()),we.addGetterSetter(Xn,"rotateEnabled",!0),we.addGetterSetter(Xn,"rotationSnaps",[]),we.addGetterSetter(Xn,"rotateAnchorOffset",50,ve()),we.addGetterSetter(Xn,"rotationSnapTolerance",5,ve()),we.addGetterSetter(Xn,"borderEnabled",!0),we.addGetterSetter(Xn,"anchorStroke","rgb(0, 161, 255)"),we.addGetterSetter(Xn,"anchorStrokeWidth",1,ve()),we.addGetterSetter(Xn,"anchorFill","white"),we.addGetterSetter(Xn,"anchorCornerRadius",0,ve()),we.addGetterSetter(Xn,"borderStroke","rgb(0, 161, 255)"),we.addGetterSetter(Xn,"borderStrokeWidth",1,ve()),we.addGetterSetter(Xn,"borderDash"),we.addGetterSetter(Xn,"keepRatio",!0),we.addGetterSetter(Xn,"centeredScaling",!1),we.addGetterSetter(Xn,"ignoreStroke",!1),we.addGetterSetter(Xn,"padding",0,ve()),we.addGetterSetter(Xn,"node"),we.addGetterSetter(Xn,"nodes"),we.addGetterSetter(Xn,"boundBoxFunc"),we.addGetterSetter(Xn,"anchorDragBoundFunc"),we.addGetterSetter(Xn,"shouldOverdrawWholeArea",!1),we.addGetterSetter(Xn,"useSingleNodeRotation",!0),we.backCompat(Xn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class Kn extends Vt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,ie.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}function Jn(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}Kn.prototype.className="Wedge",Kn.prototype._centroid=!0,Kn.prototype._attrsAffectingSize=["radius"],re(Kn),we.addGetterSetter(Kn,"radius",0,ve()),we.addGetterSetter(Kn,"angle",0,ve()),we.addGetterSetter(Kn,"clockwise",!1),we.backCompat(Kn,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var $n=[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],ei=[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 ti(e,t,n,i,r){var a=n-t,s=r-i;return 0===a?i+s/2:0===s?i:s*((e-t)/a)+i}function ni(e,t,n){var i=4*(n*e.width+t),r=[];return r.push(e.data[i++],e.data[i++],e.data[i++],e.data[i++]),r}function ii(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}we.addGetterSetter(Xe,"blurRadius",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"brightness",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"contrast",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"embossStrength",.5,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"embossWhiteLevel",.5,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"embossDirection","top-left",null,we.afterSetFilter),we.addGetterSetter(Xe,"embossBlend",!1,null,we.afterSetFilter),we.addGetterSetter(Xe,"enhance",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"hue",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"saturation",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"luminance",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"hue",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"saturation",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"value",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"kaleidoscopePower",2,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"kaleidoscopeAngle",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"threshold",0,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"noise",.2,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"pixelSize",8,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"levels",.5,ve(),we.afterSetFilter),we.addGetterSetter(Xe,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),we.addGetterSetter(Xe,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),we.addGetterSetter(Xe,"blue",0,me,we.afterSetFilter),we.addGetterSetter(Xe,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),we.addGetterSetter(Xe,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),we.addGetterSetter(Xe,"blue",0,me,we.afterSetFilter),we.addGetterSetter(Xe,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e}),we.addGetterSetter(Xe,"threshold",.5,ve(),we.afterSetFilter),tn.Util._assign(tn,{Arc:nn,Arrow:ln,Circle:hn,Ellipse:un,Image:dn,Label:yn,Tag:bn,Line:sn,Path:on,Rect:Cn,RegularPolygon:xn,Ring:Sn,Sprite:An,Star:wn,Text:Bn,TextPath:Vn,Transformer:Xn,Wedge:Kn,Filters:{Blur:function(e){var t=Math.round(this.blurRadius());t>0&&function(e,t){var n,i,r,a,s,o,l,h,u,d,c,f,g,p,m,v,y,b,C,x,_,S,A,w,k=e.data,E=e.width,P=e.height,D=t+t+1,R=E-1,M=P-1,I=t+1,T=I*(I+1)/2,L=new Jn,H=null,O=L,B=null,F=null,N=$n[t],z=ei[t];for(r=1;r<D;r++)O=O.next=new Jn,r===I&&(H=O);for(O.next=L,l=o=0,i=0;i<P;i++){for(v=y=b=C=h=u=d=c=0,f=I*(x=k[o]),g=I*(_=k[o+1]),p=I*(S=k[o+2]),m=I*(A=k[o+3]),h+=T*x,u+=T*_,d+=T*S,c+=T*A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<2,h+=v+=B.r=k[a],u+=y+=B.g=k[a+1],d+=b+=B.b=k[a+2],c+=C+=B.a=k[a+3],B=B.next,f+=x=F.r,g+=_=F.g,p+=S=F.b,m+=A=F.a,v-=x,y-=_,b-=S,C-=A,F=F.next,o+=E}}(e,t)},Brighten:function(e){var t,n=255*this.brightness(),i=e.data,r=i.length;for(t=0;t<r;t+=4)i[t]+=n,i[t+1]+=n,i[t+2]+=n},Contrast:function(e){var t,n=Math.pow((this.contrast()+100)/100,2),i=e.data,r=i.length,a=150,s=150,o=150;for(t=0;t<r;t+=4)a=i[t],s=i[t+1],o=i[t+2],a/=255,a-=.5,a*=n,a+=.5,s/=255,s-=.5,s*=n,s+=.5,o/=255,o-=.5,o*=n,o+=.5,a=(a*=255)<0?0:a>255?255:a,s=(s*=255)<0?0:s>255?255:s,o=(o*=255)<0?0:o>255?255:o,i[t]=a,i[t+1]=s,i[t+2]=o},Emboss:function(e){var t=10*this.embossStrength(),n=255*this.embossWhiteLevel(),i=this.embossDirection(),r=this.embossBlend(),a=0,s=0,o=e.data,l=e.width,h=e.height,u=4*l,d=h;switch(i){case"top-left":a=-1,s=-1;break;case"top":a=-1,s=0;break;case"top-right":a=-1,s=1;break;case"right":a=0,s=1;break;case"bottom-right":a=1,s=1;break;case"bottom":a=1,s=0;break;case"bottom-left":a=1,s=-1;break;case"left":a=0,s=-1;break;default:ge.error("Unknown emboss direction: "+i)}do{var c=(d-1)*u,f=a;d+f<1&&(f=0),d+f>h&&(f=0);var g=(d-1+f)*l*4,p=l;do{var m=c+4*(p-1),v=s;p+v<1&&(v=0),p+v>l&&(v=0);var y=g+4*(p-1+v),b=o[m]-o[y],C=o[m+1]-o[y+1],x=o[m+2]-o[y+2],_=b,S=_>0?_:-_;if((C>0?C:-C)>S&&(_=C),(x>0?x:-x)>S&&(_=x),_*=t,r){var A=o[m]+_,w=o[m+1]+_,k=o[m+2]+_;o[m]=A>255?255:A<0?0:A,o[m+1]=w>255?255:w<0?0:w,o[m+2]=k>255?255:k<0?0:k}else{var E=n-_;E<0?E=0:E>255&&(E=255),o[m]=o[m+1]=o[m+2]=E}}while(--p)}while(--d)},Enhance:function(e){var t,n,i,r,a=e.data,s=a.length,o=a[0],l=o,h=a[1],u=h,d=a[2],c=d,f=this.enhance();if(0!==f){for(r=0;r<s;r+=4)(t=a[r+0])<o?o=t:t>l&&(l=t),(n=a[r+1])<h?h=n:n>u&&(u=n),(i=a[r+2])<d?d=i:i>c&&(c=i);var g,p,m,v,y,b,C,x,_;for(l===o&&(l=255,o=0),u===h&&(u=255,h=0),c===d&&(c=255,d=0),f>0?(p=l+f*(255-l),m=o-f*(o-0),y=u+f*(255-u),b=h-f*(h-0),x=c+f*(255-c),_=d-f*(d-0)):(p=l+f*(l-(g=.5*(l+o))),m=o+f*(o-g),y=u+f*(u-(v=.5*(u+h))),b=h+f*(h-v),x=c+f*(c-(C=.5*(c+d))),_=d+f*(d-C)),r=0;r<s;r+=4)a[r+0]=ti(a[r+0],o,l,m,p),a[r+1]=ti(a[r+1],h,u,b,y),a[r+2]=ti(a[r+2],d,c,_,x)}},Grayscale:function(e){var t,n,i=e.data,r=i.length;for(t=0;t<r;t+=4)n=.34*i[t]+.5*i[t+1]+.16*i[t+2],i[t]=n,i[t+1]=n,i[t+2]=n},HSL:function(e){var t,n,i,r,a,s=e.data,o=s.length,l=Math.pow(2,this.saturation()),h=Math.abs(this.hue()+360)%360,u=127*this.luminance(),d=1*l*Math.cos(h*Math.PI/180),c=1*l*Math.sin(h*Math.PI/180),f=.299+.701*d+.167*c,g=.587-.587*d+.33*c,p=.114-.114*d-.497*c,m=.299-.299*d-.328*c,v=.587+.413*d+.035*c,y=.114-.114*d+.293*c,b=.299-.3*d+1.25*c,C=.587-.586*d-1.05*c,x=.114+.886*d-.2*c;for(t=0;t<o;t+=4)n=s[t+0],i=s[t+1],r=s[t+2],a=s[t+3],s[t+0]=f*n+g*i+p*r+u,s[t+1]=m*n+v*i+y*r+u,s[t+2]=b*n+C*i+x*r+u,s[t+3]=a},HSV:function(e){var t,n,i,r,a,s=e.data,o=s.length,l=Math.pow(2,this.value()),h=Math.pow(2,this.saturation()),u=Math.abs(this.hue()+360)%360,d=l*h*Math.cos(u*Math.PI/180),c=l*h*Math.sin(u*Math.PI/180),f=.299*l+.701*d+.167*c,g=.587*l-.587*d+.33*c,p=.114*l-.114*d-.497*c,m=.299*l-.299*d-.328*c,v=.587*l+.413*d+.035*c,y=.114*l-.114*d+.293*c,b=.299*l-.3*d+1.25*c,C=.587*l-.586*d-1.05*c,x=.114*l+.886*d-.2*c;for(t=0;t<o;t+=4)n=s[t+0],i=s[t+1],r=s[t+2],a=s[t+3],s[t+0]=f*n+g*i+p*r,s[t+1]=m*n+v*i+y*r,s[t+2]=b*n+C*i+x*r,s[t+3]=a},Invert:function(e){var t,n=e.data,i=n.length;for(t=0;t<i;t+=4)n[t]=255-n[t],n[t+1]=255-n[t+1],n[t+2]=255-n[t+2]},Kaleidoscope:function(e){var t,n,i,r,a,s,o,l,h,u=e.width,d=e.height,c=Math.round(this.kaleidoscopePower()),f=Math.round(this.kaleidoscopeAngle()),g=Math.floor(u*(f%360)/360);if(!(c<1)){var p=ge.createCanvasElement();p.width=u,p.height=d;var m=p.getContext("2d").getImageData(0,0,u,d);!function(e,t,n){var i,r,a,s,o=e.data,l=t.data,h=e.width,u=e.height,d=n.polarCenterX||h/2,c=n.polarCenterY||u/2,f=0,g=0,p=0,m=0,v=Math.sqrt(d*d+c*c);r=h-d,a=u-c,v=(s=Math.sqrt(r*r+a*a))>v?s:v;var y,b,C,x,_=u,S=h,A=360/S*Math.PI/180;for(b=0;b<S;b+=1)for(C=Math.sin(b*A),x=Math.cos(b*A),y=0;y<_;y+=1)r=Math.floor(d+v*y/_*x),f=o[0+(i=4*((a=Math.floor(c+v*y/_*C))*h+r))],g=o[i+1],p=o[i+2],m=o[i+3],l[0+(i=4*(b+y*h))]=f,l[i+1]=g,l[i+2]=p,l[i+3]=m}(e,m,{polarCenterX:u/2,polarCenterY:d/2});for(var v=u/Math.pow(2,c);v<=8;)v*=2,c-=1;var y=v=Math.ceil(v),b=0,C=y,x=1;for(g+v>u&&(b=y,C=0,x=-1),n=0;n<d;n+=1)for(t=b;t!==C;t+=x)l=4*(u*n+Math.round(t+g)%u),r=m.data[l+0],a=m.data[l+1],s=m.data[l+2],o=m.data[l+3],h=4*(u*n+t),m.data[h+0]=r,m.data[h+1]=a,m.data[h+2]=s,m.data[h+3]=o;for(n=0;n<d;n+=1)for(y=Math.floor(v),i=0;i<c;i+=1){for(t=0;t<y+1;t+=1)l=4*(u*n+t),r=m.data[l+0],a=m.data[l+1],s=m.data[l+2],o=m.data[l+3],h=4*(u*n+2*y-t-1),m.data[h+0]=r,m.data[h+1]=a,m.data[h+2]=s,m.data[h+3]=o;y*=2}!function(e,t,n){var i,r,a,s,o,l,h=e.data,u=t.data,d=e.width,c=e.height,f=n.polarCenterX||d/2,g=n.polarCenterY||c/2,p=0,m=0,v=0,y=0,b=Math.sqrt(f*f+g*g);r=d-f,a=c-g,b=(l=Math.sqrt(r*r+a*a))>b?l:b;var C,x,_,S=c,A=d,w=n.polarRotation||0;for(r=0;r<d;r+=1)for(a=0;a<c;a+=1)s=r-f,o=a-g,C=Math.sqrt(s*s+o*o)*S/b,x=(x=(180*Math.atan2(o,s)/Math.PI+360+w)%360)*A/360,_=Math.floor(x),p=h[0+(i=4*(Math.floor(C)*d+_))],m=h[i+1],v=h[i+2],y=h[i+3],u[0+(i=4*(a*d+r))]=p,u[i+1]=m,u[i+2]=v,u[i+3]=y}(m,e,{polarRotation:0})}},Mask:function(e){var t=function(e,t){var n=ni(e,0,0),i=ni(e,e.width-1,0),r=ni(e,0,e.height-1),a=ni(e,e.width-1,e.height-1),s=t||10;if(ii(n,i)<s&&ii(i,a)<s&&ii(a,r)<s&&ii(r,n)<s){for(var o=function(e){for(var t=[0,0,0],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}([i,n,a,r]),l=[],h=0;h<e.width*e.height;h++){var u=ii(o,[e.data[4*h],e.data[4*h+1],e.data[4*h+2]]);l[h]=u<s?0:255}return l}}(e,this.threshold());return t&&function(e,t){for(var n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}(e,t=function(e,t,n){for(var i=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],r=Math.round(Math.sqrt(i.length)),a=Math.floor(r/2),s=[],o=0;o<n;o++)for(var l=0;l<t;l++){for(var h=o*t+l,u=0,d=0;d<r;d++)for(var c=0;c<r;c++){var f=o+d-a,g=l+c-a;if(f>=0&&f<n&&g>=0&&g<t){var p=i[d*r+c];u+=e[f*t+g]*p}}s[h]=u}return s}(t=function(e,t,n){for(var i=[1,1,1,1,1,1,1,1,1],r=Math.round(Math.sqrt(i.length)),a=Math.floor(r/2),s=[],o=0;o<n;o++)for(var l=0;l<t;l++){for(var h=o*t+l,u=0,d=0;d<r;d++)for(var c=0;c<r;c++){var f=o+d-a,g=l+c-a;if(f>=0&&f<n&&g>=0&&g<t){var p=i[d*r+c];u+=e[f*t+g]*p}}s[h]=u>=1020?255:0}return s}(t=function(e,t,n){for(var i=[1,1,1,1,0,1,1,1,1],r=Math.round(Math.sqrt(i.length)),a=Math.floor(r/2),s=[],o=0;o<n;o++)for(var l=0;l<t;l++){for(var h=o*t+l,u=0,d=0;d<r;d++)for(var c=0;c<r;c++){var f=o+d-a,g=l+c-a;if(f>=0&&f<n&&g>=0&&g<t){var p=i[d*r+c];u+=e[f*t+g]*p}}s[h]=2040===u?255:0}return s}(t,e.width,e.height),e.width,e.height),e.width,e.height)),e},Noise:function(e){var t,n=255*this.noise(),i=e.data,r=i.length,a=n/2;for(t=0;t<r;t+=4)i[t+0]+=a-2*a*Math.random(),i[t+1]+=a-2*a*Math.random(),i[t+2]+=a-2*a*Math.random()},Pixelate:function(e){var t,n,i,r,a,s,o,l,h,u,d,c,f,g,p=Math.ceil(this.pixelSize()),m=e.width,v=e.height,y=Math.ceil(m/p),b=Math.ceil(v/p),C=e.data;if(p<=0)ge.error("pixelSize value can not be <= 0");else for(c=0;c<y;c+=1)for(f=0;f<b;f+=1){for(r=0,a=0,s=0,o=0,h=(l=c*p)+p,d=(u=f*p)+p,g=0,t=l;t<h;t+=1)if(!(t>=m))for(n=u;n<d;n+=1)n>=v||(r+=C[0+(i=4*(m*n+t))],a+=C[i+1],s+=C[i+2],o+=C[i+3],g+=1);for(r/=g,a/=g,s/=g,o/=g,t=l;t<h;t+=1)if(!(t>=m))for(n=u;n<d;n+=1)n>=v||(C[0+(i=4*(m*n+t))]=r,C[i+1]=a,C[i+2]=s,C[i+3]=o)}},Posterize:function(e){var t,n=Math.round(254*this.levels())+1,i=e.data,r=i.length,a=255/n;for(t=0;t<r;t+=1)i[t]=Math.floor(i[t]/a)*a},RGB:function(e){var t,n,i=e.data,r=i.length,a=this.red(),s=this.green(),o=this.blue();for(t=0;t<r;t+=4)n=(.34*i[t]+.5*i[t+1]+.16*i[t+2])/255,i[t]=n*a,i[t+1]=n*s,i[t+2]=n*o,i[t+3]=i[t+3]},RGBA:function(e){var t,n,i=e.data,r=i.length,a=this.red(),s=this.green(),o=this.blue(),l=this.alpha();for(t=0;t<r;t+=4)n=1-l,i[t]=a*l+i[t]*n,i[t+1]=s*l+i[t+1]*n,i[t+2]=o*l+i[t+2]*n},Sepia:function(e){var t,n,i,r,a=e.data,s=a.length;for(t=0;t<s;t+=4)n=a[t+0],i=a[t+1],r=a[t+2],a[t+0]=Math.min(255,.393*n+.769*i+.189*r),a[t+1]=Math.min(255,.349*n+.686*i+.168*r),a[t+2]=Math.min(255,.272*n+.534*i+.131*r)},Solarize:function(e){var t=e.data,n=e.width,i=4*n,r=e.height;do{var a=(r-1)*i,s=n;do{var o=a+4*(s-1),l=t[o],h=t[o+1],u=t[o+2];l>127&&(l=255-l),h>127&&(h=255-h),u>127&&(u=255-u),t[o]=l,t[o+1]=h,t[o+2]=u}while(--s)}while(--r)},Threshold:function(e){var t,n=255*this.threshold(),i=e.data,r=i.length;for(t=0;t<r;t+=1)i[t]=i[t]<n?0:255}}});var ri=Object.freeze({__proto__:null,default:tn,Konva:tn}),ai={exports:{}},si={exports:{}},oi={};!function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var i=n-1>>>1,a=e[i];if(!(0<r(a,t)))break e;e[i]=t,e[n]=a,n=i}}function n(e){return 0===e.length?null:e[0]}function i(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var i=0,a=e.length,s=a>>>1;i<s;){var o=2*(i+1)-1,l=e[o],h=o+1,u=e[h];if(0>r(l,n))h<a&&0>r(u,l)?(e[i]=u,e[h]=n,i=h):(e[i]=l,e[o]=n,i=o);else{if(!(h<a&&0>r(u,n)))break e;e[i]=u,e[h]=n,i=h}}}return t}function r(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var a=performance;e.unstable_now=function(){return a.now()}}else{var s=Date,o=s.now();e.unstable_now=function(){return s.now()-o}}var l=[],h=[],u=1,d=null,c=3,f=!1,g=!1,p=!1,m="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var r=n(h);null!==r;){if(null===r.callback)i(h);else{if(!(r.startTime<=e))break;i(h),r.sortIndex=r.expirationTime,t(l,r)}r=n(h)}}function C(e){if(p=!1,b(e),!g)if(null!==n(l))g=!0,I(x);else{var t=n(h);null!==t&&T(C,t.startTime-e)}}function x(t,r){g=!1,p&&(p=!1,v(w),w=-1),f=!0;var a=c;try{for(b(r),d=n(l);null!==d&&(!(d.expirationTime>r)||t&&!P());){var s=d.callback;if("function"==typeof s){d.callback=null,c=d.priorityLevel;var o=s(d.expirationTime<=r);r=e.unstable_now(),"function"==typeof o?d.callback=o:d===n(l)&&i(l),b(r)}else i(l);d=n(l)}if(null!==d)var u=!0;else{var m=n(h);null!==m&&T(C,m.startTime-r),u=!1}return u}finally{d=null,c=a,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var _,S=!1,A=null,w=-1,k=5,E=-1;function P(){return!(e.unstable_now()-E<k)}function D(){if(null!==A){var t=e.unstable_now();E=t;var n=!0;try{n=A(!0,t)}finally{n?_():(S=!1,A=null)}}else S=!1}if("function"==typeof y)_=function(){y(D)};else if("undefined"!=typeof MessageChannel){var R=new MessageChannel,M=R.port2;R.port1.onmessage=D,_=function(){M.postMessage(null)}}else _=function(){m(D,0)};function I(e){A=e,S||(S=!0,_())}function T(t,n){w=m(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){g||f||(g=!0,I(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return c},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(e){switch(c){case 1:case 2:case 3:var t=3;break;default:t=c}var n=c;c=t;try{return e()}finally{c=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=c;c=e;try{return t()}finally{c=n}},e.unstable_scheduleCallback=function(i,r,a){var s=e.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?s+a:s,i){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return i={id:u++,callback:r,priorityLevel:i,startTime:a,expirationTime:o=a+o,sortIndex:-1},a>s?(i.sortIndex=a,t(h,i),null===n(l)&&i===n(h)&&(p?(v(w),w=-1):p=!0,T(C,a-s))):(i.sortIndex=o,t(l,i),g||f||(g=!0,I(x))),i},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(e){var t=c;return function(){var n=c;c=t;try{return e.apply(this,arguments)}finally{c=n}}}}(oi),si.exports=oi;const li=t;ai.exports=function(e){var t={},n=li,i=si.exports,r=Object.assign;function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;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."}var s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,o=Symbol.for("react.element"),l=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),C=Symbol.iterator;function x(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=C&&e[C]||e["@@iterator"])?e:null}function _(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case h:return"Fragment";case l:return"Portal";case d:return"Profiler";case u:return"StrictMode";case p:return"Suspense";case m:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case f:return(e.displayName||"Context")+".Consumer";case c:return(e._context.displayName||"Context")+".Provider";case g:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case v:return null!==(t=e.displayName||null)?t:_(e.type)||"Memo";case y:t=e._payload,e=e._init;try{return _(e(t))}catch(e){}}return null}function S(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return _(t);case 8:return t===u?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function A(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function w(e){if(A(e)!==e)throw Error(a(188))}function k(e){var t=e.alternate;if(!t){if(null===(t=A(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,i=t;;){var r=n.return;if(null===r)break;var s=r.alternate;if(null===s){if(null!==(i=r.return)){n=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===n)return w(r),e;if(s===i)return w(r),t;s=s.sibling}throw Error(a(188))}if(n.return!==i.return)n=r,i=s;else{for(var o=!1,l=r.child;l;){if(l===n){o=!0,n=r,i=s;break}if(l===i){o=!0,i=r,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,i=r;break}if(l===i){o=!0,i=s,n=r;break}l=l.sibling}if(!o)throw Error(a(189))}}if(n.alternate!==i)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}function E(e){return null!==(e=k(e))?P(e):null}function P(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=P(e);if(null!==t)return t;e=e.sibling}return null}function D(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){if(4!==e.tag){var t=D(e);if(null!==t)return t}e=e.sibling}return null}var R,M=Array.isArray,I=e.getPublicInstance,T=e.getRootHostContext,L=e.getChildHostContext,H=e.prepareForCommit,O=e.resetAfterCommit,B=e.createInstance,F=e.appendInitialChild,N=e.finalizeInitialChildren,z=e.prepareUpdate,V=e.shouldSetTextContent,G=e.createTextInstance,U=e.scheduleTimeout,W=e.cancelTimeout,Q=e.noTimeout,j=e.isPrimaryRenderer,Y=e.supportsMutation,q=e.supportsPersistence,Z=e.supportsHydration,X=e.getInstanceFromNode,K=e.preparePortalMount,J=e.getCurrentEventPriority,$=e.detachDeletedInstance,ee=e.supportsMicrotasks,te=e.scheduleMicrotask,ne=e.supportsTestSelectors,ie=e.findFiberRoot,re=e.getBoundingRect,ae=e.getTextContent,se=e.isHiddenSubtree,oe=e.matchAccessibilityRole,le=e.setFocusIfFocusable,he=e.setupIntersectionObserver,ue=e.appendChild,de=e.appendChildToContainer,ce=e.commitTextUpdate,fe=e.commitMount,ge=e.commitUpdate,pe=e.insertBefore,me=e.insertInContainerBefore,ve=e.removeChild,ye=e.removeChildFromContainer,be=e.resetTextContent,Ce=e.hideInstance,xe=e.hideTextInstance,_e=e.unhideInstance,Se=e.unhideTextInstance,Ae=e.clearContainer,we=e.cloneInstance,ke=e.createContainerChildSet,Ee=e.appendChildToContainerChildSet,Pe=e.finalizeContainerChildren,De=e.replaceContainerChildren,Re=e.cloneHiddenInstance,Me=e.cloneHiddenTextInstance,Ie=e.canHydrateInstance,Te=e.canHydrateTextInstance,Le=e.canHydrateSuspenseInstance,He=e.isSuspenseInstancePending,Oe=e.isSuspenseInstanceFallback,Be=e.getSuspenseInstanceFallbackErrorDetails,Fe=e.registerSuspenseInstanceRetry,Ne=e.getNextHydratableSibling,ze=e.getFirstHydratableChild,Ve=e.getFirstHydratableChildWithinContainer,Ge=e.getFirstHydratableChildWithinSuspenseInstance,Ue=e.hydrateInstance,We=e.hydrateTextInstance,Qe=e.hydrateSuspenseInstance,je=e.getNextHydratableInstanceAfterSuspenseInstance,Ye=e.commitHydratedContainer,qe=e.commitHydratedSuspenseInstance,Ze=e.clearSuspenseBoundary,Xe=e.clearSuspenseBoundaryFromContainer,Ke=e.shouldDeleteUnhydratedTailInstances,Je=e.didNotMatchHydratedContainerTextInstance,$e=e.didNotMatchHydratedTextInstance;function et(e){if(void 0===R)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);R=t&&t[1]||""}return"\n"+R+e}var tt=!1;function nt(e,t){if(!e||tt)return"";tt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var i=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){i=e}e.call(t.prototype)}else{try{throw Error()}catch(e){i=e}e()}}catch(t){if(t&&i&&"string"==typeof t.stack){for(var r=t.stack.split("\n"),a=i.stack.split("\n"),s=r.length-1,o=a.length-1;1<=s&&0<=o&&r[s]!==a[o];)o--;for(;1<=s&&0<=o;s--,o--)if(r[s]!==a[o]){if(1!==s||1!==o)do{if(s--,0>--o||r[s]!==a[o]){var l="\n"+r[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=s&&0<=o);break}}}finally{tt=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?et(e):""}var it=Object.prototype.hasOwnProperty,rt=[],at=-1;function st(e){return{current:e}}function ot(e){0>at||(e.current=rt[at],rt[at]=null,at--)}function lt(e,t){at++,rt[at]=e.current,e.current=t}var ht={},ut=st(ht),dt=st(!1),ct=ht;function ft(e,t){var n=e.type.contextTypes;if(!n)return ht;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var r,a={};for(r in n)a[r]=t[r];return i&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function gt(e){return null!=e.childContextTypes}function pt(){ot(dt),ot(ut)}function mt(e,t,n){if(ut.current!==ht)throw Error(a(168));lt(ut,t),lt(dt,n)}function vt(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,"function"!=typeof i.getChildContext)return n;for(var s in i=i.getChildContext())if(!(s in t))throw Error(a(108,S(e)||"Unknown",s));return r({},n,i)}function yt(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ht,ct=ut.current,lt(ut,e),lt(dt,dt.current),!0}function bt(e,t,n){var i=e.stateNode;if(!i)throw Error(a(169));n?(e=vt(e,t,ct),i.__reactInternalMemoizedMergedChildContext=e,ot(dt),ot(ut),lt(ut,e)):ot(dt),lt(dt,n)}var Ct=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(xt(e)/_t|0)|0},xt=Math.log,_t=Math.LN2,St=64,At=4194304;function wt(e){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: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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function kt(e,t){var n=e.pendingLanes;if(0===n)return 0;var i=0,r=e.suspendedLanes,a=e.pingedLanes,s=268435455&n;if(0!==s){var o=s&~r;0!==o?i=wt(o):0!==(a&=s)&&(i=wt(a))}else 0!==(s=n&~r)?i=wt(s):0!==a&&(i=wt(a));if(0===i)return 0;if(0!==t&&t!==i&&0===(t&r)&&((r=i&-i)>=(a=t&-t)||16===r&&4194240&a))return t;if(4&i&&(i|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=i;0<t;)r=1<<(n=31-Ct(t)),i|=e[n],t&=~r;return i}function Et(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function Pt(e){return 0!=(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function Dt(){var e=St;return!(4194240&(St<<=1))&&(St=64),e}function Rt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Mt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-Ct(t)]=n}function It(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Ct(n),r=1<<i;r&t|e[i]&t&&(e[i]|=t),n&=~r}}var Tt=0;function Lt(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var Ht=i.unstable_scheduleCallback,Ot=i.unstable_cancelCallback,Bt=i.unstable_shouldYield,Ft=i.unstable_requestPaint,Nt=i.unstable_now,zt=i.unstable_ImmediatePriority,Vt=i.unstable_UserBlockingPriority,Gt=i.unstable_NormalPriority,Ut=i.unstable_IdlePriority,Wt=null,Qt=null,jt="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Yt=null,qt=!1,Zt=!1;function Xt(e){null===Yt?Yt=[e]:Yt.push(e)}function Kt(){if(!Zt&&null!==Yt){Zt=!0;var e=0,t=Tt;try{var n=Yt;for(Tt=1;e<n.length;e++){var i=n[e];do{i=i(!0)}while(null!==i)}Yt=null,qt=!1}catch(t){throw null!==Yt&&(Yt=Yt.slice(e+1)),Ht(zt,Kt),t}finally{Tt=t,Zt=!1}}return null}var Jt=[],$t=0,en=null,tn=0,nn=[],rn=0,an=null,sn=1,on="";function ln(e,t){Jt[$t++]=tn,Jt[$t++]=en,en=e,tn=t}function hn(e,t,n){nn[rn++]=sn,nn[rn++]=on,nn[rn++]=an,an=e;var i=sn;e=on;var r=32-Ct(i)-1;i&=~(1<<r),n+=1;var a=32-Ct(t)+r;if(30<a){var s=r-r%5;a=(i&(1<<s)-1).toString(32),i>>=s,r-=s,sn=1<<32-Ct(t)+r|n<<r|i,on=a+e}else sn=1<<a|n<<r|i,on=e}function un(e){null!==e.return&&(ln(e,1),hn(e,1,0))}function dn(e){for(;e===en;)en=Jt[--$t],Jt[$t]=null,tn=Jt[--$t],Jt[$t]=null;for(;e===an;)an=nn[--rn],nn[rn]=null,on=nn[--rn],nn[rn]=null,sn=nn[--rn],nn[rn]=null}var cn=null,fn=null,gn=!1,pn=!1,mn=null;function vn(e,t){var n=so(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function yn(e,t){switch(e.tag){case 5:return null!==(t=Ie(t,e.type,e.pendingProps))&&(e.stateNode=t,cn=e,fn=ze(t),!0);case 6:return null!==(t=Te(t,e.pendingProps))&&(e.stateNode=t,cn=e,fn=null,!0);case 13:if(null!==(t=Le(t))){var n=null!==an?{id:sn,overflow:on}:null;return e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=so(18,null,null,0)).stateNode=t,n.return=e,e.child=n,cn=e,fn=null,!0}return!1;default:return!1}}function bn(e){return!(!(1&e.mode)||128&e.flags)}function Cn(e){if(gn){var t=fn;if(t){var n=t;if(!yn(e,t)){if(bn(e))throw Error(a(418));t=Ne(n);var i=cn;t&&yn(e,t)?vn(i,n):(e.flags=-4097&e.flags|2,gn=!1,cn=e)}}else{if(bn(e))throw Error(a(418));e.flags=-4097&e.flags|2,gn=!1,cn=e}}}function xn(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;cn=e}function _n(e){if(!Z||e!==cn)return!1;if(!gn)return xn(e),gn=!0,!1;if(3!==e.tag&&(5!==e.tag||Ke(e.type)&&!V(e.type,e.memoizedProps))){var t=fn;if(t){if(bn(e))throw Sn(),Error(a(418));for(;t;)vn(e,t),t=Ne(t)}}if(xn(e),13===e.tag){if(!Z)throw Error(a(316));if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));fn=je(e)}else fn=cn?Ne(e.stateNode):null;return!0}function Sn(){for(var e=fn;e;)e=Ne(e)}function An(){Z&&(fn=cn=null,pn=gn=!1)}function wn(e){null===mn?mn=[e]:mn.push(e)}var kn=s.ReactCurrentBatchConfig;function En(e,t){if(jt(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!it.call(t,r)||!jt(e[r],t[r]))return!1}return!0}function Pn(e){switch(e.tag){case 5:return et(e.type);case 16:return et("Lazy");case 13:return et("Suspense");case 19:return et("SuspenseList");case 0:case 2:case 15:return nt(e.type,!1);case 11:return nt(e.type.render,!1);case 1:return nt(e.type,!0);default:return""}}function Dn(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(a(309));var i=n.stateNode}if(!i)throw Error(a(147,e));var r=i,s=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===s?t.ref:(t=function(e){var t=r.refs;null===e?delete t[s]:t[s]=e},t._stringRef=s,t)}if("string"!=typeof e)throw Error(a(284));if(!n._owner)throw Error(a(290,e))}return e}function Rn(e,t){throw e=Object.prototype.toString.call(t),Error(a(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Mn(e){return(0,e._init)(e._payload)}function In(e){function t(t,n){if(e){var i=t.deletions;null===i?(t.deletions=[n],t.flags|=16):i.push(n)}}function n(n,i){if(!e)return null;for(;null!==i;)t(n,i),i=i.sibling;return null}function i(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function r(e,t){return(e=lo(e,t)).index=0,e.sibling=null,e}function s(t,n,i){return t.index=i,e?null!==(i=t.alternate)?(i=i.index)<n?(t.flags|=2,n):i:(t.flags|=2,n):(t.flags|=1048576,n)}function u(t){return e&&null===t.alternate&&(t.flags|=2),t}function d(e,t,n,i){return null===t||6!==t.tag?((t=fo(n,e.mode,i)).return=e,t):((t=r(t,n)).return=e,t)}function c(e,t,n,i){var a=n.type;return a===h?g(e,t,n.props.children,i,n.key):null!==t&&(t.elementType===a||"object"==typeof a&&null!==a&&a.$$typeof===y&&Mn(a)===t.type)?((i=r(t,n.props)).ref=Dn(e,t,n),i.return=e,i):((i=ho(n.type,n.key,n.props,null,e.mode,i)).ref=Dn(e,t,n),i.return=e,i)}function f(e,t,n,i){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=go(n,e.mode,i)).return=e,t):((t=r(t,n.children||[])).return=e,t)}function g(e,t,n,i,a){return null===t||7!==t.tag?((t=uo(n,e.mode,i,a)).return=e,t):((t=r(t,n)).return=e,t)}function p(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=fo(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case o:return(n=ho(t.type,t.key,t.props,null,e.mode,n)).ref=Dn(e,null,t),n.return=e,n;case l:return(t=go(t,e.mode,n)).return=e,t;case y:return p(e,(0,t._init)(t._payload),n)}if(M(t)||x(t))return(t=uo(t,e.mode,n,null)).return=e,t;Rn(e,t)}return null}function m(e,t,n,i){var r=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==r?null:d(e,t,""+n,i);if("object"==typeof n&&null!==n){switch(n.$$typeof){case o:return n.key===r?c(e,t,n,i):null;case l:return n.key===r?f(e,t,n,i):null;case y:return m(e,t,(r=n._init)(n._payload),i)}if(M(n)||x(n))return null!==r?null:g(e,t,n,i,null);Rn(e,n)}return null}function v(e,t,n,i,r){if("string"==typeof i&&""!==i||"number"==typeof i)return d(t,e=e.get(n)||null,""+i,r);if("object"==typeof i&&null!==i){switch(i.$$typeof){case o:return c(t,e=e.get(null===i.key?n:i.key)||null,i,r);case l:return f(t,e=e.get(null===i.key?n:i.key)||null,i,r);case y:return v(e,t,n,(0,i._init)(i._payload),r)}if(M(i)||x(i))return g(t,e=e.get(n)||null,i,r,null);Rn(t,i)}return null}function b(r,a,o,l){for(var h=null,u=null,d=a,c=a=0,f=null;null!==d&&c<o.length;c++){d.index>c?(f=d,d=null):f=d.sibling;var g=m(r,d,o[c],l);if(null===g){null===d&&(d=f);break}e&&d&&null===g.alternate&&t(r,d),a=s(g,a,c),null===u?h=g:u.sibling=g,u=g,d=f}if(c===o.length)return n(r,d),gn&&ln(r,c),h;if(null===d){for(;c<o.length;c++)null!==(d=p(r,o[c],l))&&(a=s(d,a,c),null===u?h=d:u.sibling=d,u=d);return gn&&ln(r,c),h}for(d=i(r,d);c<o.length;c++)null!==(f=v(d,r,c,o[c],l))&&(e&&null!==f.alternate&&d.delete(null===f.key?c:f.key),a=s(f,a,c),null===u?h=f:u.sibling=f,u=f);return e&&d.forEach(function(e){return t(r,e)}),gn&&ln(r,c),h}function C(r,o,l,h){var u=x(l);if("function"!=typeof u)throw Error(a(150));if(null==(l=u.call(l)))throw Error(a(151));for(var d=u=null,c=o,f=o=0,g=null,y=l.next();null!==c&&!y.done;f++,y=l.next()){c.index>f?(g=c,c=null):g=c.sibling;var b=m(r,c,y.value,h);if(null===b){null===c&&(c=g);break}e&&c&&null===b.alternate&&t(r,c),o=s(b,o,f),null===d?u=b:d.sibling=b,d=b,c=g}if(y.done)return n(r,c),gn&&ln(r,f),u;if(null===c){for(;!y.done;f++,y=l.next())null!==(y=p(r,y.value,h))&&(o=s(y,o,f),null===d?u=y:d.sibling=y,d=y);return gn&&ln(r,f),u}for(c=i(r,c);!y.done;f++,y=l.next())null!==(y=v(c,r,f,y.value,h))&&(e&&null!==y.alternate&&c.delete(null===y.key?f:y.key),o=s(y,o,f),null===d?u=y:d.sibling=y,d=y);return e&&c.forEach(function(e){return t(r,e)}),gn&&ln(r,f),u}return function e(i,a,s,d){if("object"==typeof s&&null!==s&&s.type===h&&null===s.key&&(s=s.props.children),"object"==typeof s&&null!==s){switch(s.$$typeof){case o:e:{for(var c=s.key,f=a;null!==f;){if(f.key===c){if((c=s.type)===h){if(7===f.tag){n(i,f.sibling),(a=r(f,s.props.children)).return=i,i=a;break e}}else if(f.elementType===c||"object"==typeof c&&null!==c&&c.$$typeof===y&&Mn(c)===f.type){n(i,f.sibling),(a=r(f,s.props)).ref=Dn(i,f,s),a.return=i,i=a;break e}n(i,f);break}t(i,f),f=f.sibling}s.type===h?((a=uo(s.props.children,i.mode,d,s.key)).return=i,i=a):((d=ho(s.type,s.key,s.props,null,i.mode,d)).ref=Dn(i,a,s),d.return=i,i=d)}return u(i);case l:e:{for(f=s.key;null!==a;){if(a.key===f){if(4===a.tag&&a.stateNode.containerInfo===s.containerInfo&&a.stateNode.implementation===s.implementation){n(i,a.sibling),(a=r(a,s.children||[])).return=i,i=a;break e}n(i,a);break}t(i,a),a=a.sibling}(a=go(s,i.mode,d)).return=i,i=a}return u(i);case y:return e(i,a,(f=s._init)(s._payload),d)}if(M(s))return b(i,a,s,d);if(x(s))return C(i,a,s,d);Rn(i,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==a&&6===a.tag?(n(i,a.sibling),(a=r(a,s)).return=i,i=a):(n(i,a),(a=fo(s,i.mode,d)).return=i,i=a),u(i)):n(i,a)}}var Tn=In(!0),Ln=In(!1),Hn=st(null),On=null,Bn=null,Fn=null;function Nn(){Fn=Bn=On=null}function zn(e,t,n){j?(lt(Hn,t._currentValue),t._currentValue=n):(lt(Hn,t._currentValue2),t._currentValue2=n)}function Vn(e){var t=Hn.current;ot(Hn),j?e._currentValue=t:e._currentValue2=t}function Gn(e,t,n){for(;null!==e;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==i&&(i.childLanes|=t)):null!==i&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function Un(e,t){On=e,Fn=Bn=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(Lr=!0),e.firstContext=null)}function Wn(e){var t=j?e._currentValue:e._currentValue2;if(Fn!==e)if(e={context:e,memoizedValue:t,next:null},null===Bn){if(null===On)throw Error(a(308));Bn=e,On.dependencies={lanes:0,firstContext:e}}else Bn=Bn.next=e;return t}var Qn=null;function jn(e){null===Qn?Qn=[e]:Qn.push(e)}function Yn(e,t,n,i){var r=t.interleaved;return null===r?(n.next=n,jn(t)):(n.next=r.next,r.next=n),t.interleaved=n,qn(e,i)}function qn(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var Zn=!1;function Xn(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Kn(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Jn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function $n(e,t,n){var i=e.updateQueue;if(null===i)return null;if(i=i.shared,2&ns){var r=i.pending;return null===r?t.next=t:(t.next=r.next,r.next=t),i.pending=t,qn(e,n)}return null===(r=i.interleaved)?(t.next=t,jn(i)):(t.next=r.next,r.next=t),i.interleaved=t,qn(e,n)}function ei(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var i=t.lanes;n|=i&=e.pendingLanes,t.lanes=n,It(e,n)}}function ti(e,t){var n=e.updateQueue,i=e.alternate;if(null!==i&&n===(i=i.updateQueue)){var r=null,a=null;if(null!==(n=n.firstBaseUpdate)){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===a?r=a=s:a=a.next=s,n=n.next}while(null!==n);null===a?r=a=t:a=a.next=t}else r=a=t;return n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:a,shared:i.shared,effects:i.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ni(e,t,n,i){var a=e.updateQueue;Zn=!1;var s=a.firstBaseUpdate,o=a.lastBaseUpdate,l=a.shared.pending;if(null!==l){a.shared.pending=null;var h=l,u=h.next;h.next=null,null===o?s=u:o.next=u,o=h;var d=e.alternate;null!==d&&(l=(d=d.updateQueue).lastBaseUpdate)!==o&&(null===l?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=h)}if(null!==s){var c=a.baseState;for(o=0,d=u=h=null,l=s;;){var f=l.lane,g=l.eventTime;if((i&f)===f){null!==d&&(d=d.next={eventTime:g,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=e,m=l;switch(f=t,g=n,m.tag){case 1:if("function"==typeof(p=m.payload)){c=p.call(g,c,f);break e}c=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null==(f="function"==typeof(p=m.payload)?p.call(g,c,f):p))break e;c=r({},c,f);break e;case 2:Zn=!0}}null!==l.callback&&0!==l.lane&&(e.flags|=64,null===(f=a.effects)?a.effects=[l]:f.push(l))}else g={eventTime:g,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===d?(u=d=g,h=c):d=d.next=g,o|=f;if(null===(l=l.next)){if(null===(l=a.shared.pending))break;l=(f=l).next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}if(null===d&&(h=c),a.baseState=h,a.firstBaseUpdate=u,a.lastBaseUpdate=d,null!==(t=a.shared.interleaved)){a=t;do{o|=a.lane,a=a.next}while(a!==t)}else null===s&&(a.shared.lanes=0);us|=o,e.lanes=o,e.memoizedState=c}}function ii(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var i=e[t],r=i.callback;if(null!==r){if(i.callback=null,i=n,"function"!=typeof r)throw Error(a(191,r));r.call(i)}}}var ri={},ai=st(ri),oi=st(ri),hi=st(ri);function ui(e){if(e===ri)throw Error(a(174));return e}function di(e,t){lt(hi,t),lt(oi,e),lt(ai,ri),e=T(t),ot(ai),lt(ai,e)}function ci(){ot(ai),ot(oi),ot(hi)}function fi(e){var t=ui(hi.current),n=ui(ai.current);n!==(t=L(n,e.type,t))&&(lt(oi,e),lt(ai,t))}function gi(e){oi.current===e&&(ot(ai),ot(oi))}var pi=st(0);function mi(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||He(n)||Oe(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var vi=[];function yi(){for(var e=0;e<vi.length;e++){var t=vi[e];j?t._workInProgressVersionPrimary=null:t._workInProgressVersionSecondary=null}vi.length=0}var bi=s.ReactCurrentDispatcher,Ci=s.ReactCurrentBatchConfig,xi=0,_i=null,Si=null,Ai=null,wi=!1,ki=!1,Ei=0,Pi=0;function Di(){throw Error(a(321))}function Ri(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!jt(e[n],t[n]))return!1;return!0}function Mi(e,t,n,i,r,s){if(xi=s,_i=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,bi.current=null===e||null===e.memoizedState?gr:pr,e=n(i,r),ki){s=0;do{if(ki=!1,Ei=0,25<=s)throw Error(a(301));s+=1,Ai=Si=null,t.updateQueue=null,bi.current=mr,e=n(i,r)}while(ki)}if(bi.current=fr,t=null!==Si&&null!==Si.next,xi=0,Ai=Si=_i=null,wi=!1,t)throw Error(a(300));return e}function Ii(){var e=0!==Ei;return Ei=0,e}function Ti(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Ai?_i.memoizedState=Ai=e:Ai=Ai.next=e,Ai}function Li(){if(null===Si){var e=_i.alternate;e=null!==e?e.memoizedState:null}else e=Si.next;var t=null===Ai?_i.memoizedState:Ai.next;if(null!==t)Ai=t,Si=e;else{if(null===e)throw Error(a(310));e={memoizedState:(Si=e).memoizedState,baseState:Si.baseState,baseQueue:Si.baseQueue,queue:Si.queue,next:null},null===Ai?_i.memoizedState=Ai=e:Ai=Ai.next=e}return Ai}function Hi(e,t){return"function"==typeof t?t(e):t}function Oi(e){var t=Li(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var i=Si,r=i.baseQueue,s=n.pending;if(null!==s){if(null!==r){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,n.pending=null}if(null!==r){s=r.next,i=i.baseState;var l=o=null,h=null,u=s;do{var d=u.lane;if((xi&d)===d)null!==h&&(h=h.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var c={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===h?(l=h=c,o=i):h=h.next=c,_i.lanes|=d,us|=d}u=u.next}while(null!==u&&u!==s);null===h?o=i:h.next=l,jt(i,t.memoizedState)||(Lr=!0),t.memoizedState=i,t.baseState=o,t.baseQueue=h,n.lastRenderedState=i}if(null!==(e=n.interleaved)){r=e;do{s=r.lane,_i.lanes|=s,us|=s,r=r.next}while(r!==e)}else null===r&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Bi(e){var t=Li(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var i=n.dispatch,r=n.pending,s=t.memoizedState;if(null!==r){n.pending=null;var o=r=r.next;do{s=e(s,o.action),o=o.next}while(o!==r);jt(s,t.memoizedState)||(Lr=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),n.lastRenderedState=s}return[s,i]}function Fi(){}function Ni(e,t){var n=_i,i=Li(),r=t(),s=!jt(i.memoizedState,r);if(s&&(i.memoizedState=r,Lr=!0),i=i.queue,Ki(Gi.bind(null,n,i,e),[e]),i.getSnapshot!==t||s||null!==Ai&&1&Ai.memoizedState.tag){if(n.flags|=2048,ji(9,Vi.bind(null,n,i,r,t),void 0,null),null===is)throw Error(a(349));30&xi||zi(n,t,r)}return r}function zi(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=_i.updateQueue)?(t={lastEffect:null,stores:null},_i.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Vi(e,t,n,i){t.value=n,t.getSnapshot=i,Ui(t)&&Wi(e)}function Gi(e,t,n){return n(function(){Ui(t)&&Wi(e)})}function Ui(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jt(e,n)}catch(e){return!0}}function Wi(e){var t=qn(e,1);null!==t&&Is(t,e,1,-1)}function Qi(e){var t=Ti();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Hi,lastRenderedState:e},t.queue=e,e=e.dispatch=hr.bind(null,_i,e),[t.memoizedState,e]}function ji(e,t,n,i){return e={tag:e,create:t,destroy:n,deps:i,next:null},null===(t=_i.updateQueue)?(t={lastEffect:null,stores:null},_i.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function Yi(){return Li().memoizedState}function qi(e,t,n,i){var r=Ti();_i.flags|=e,r.memoizedState=ji(1|t,n,void 0,void 0===i?null:i)}function Zi(e,t,n,i){var r=Li();i=void 0===i?null:i;var a=void 0;if(null!==Si){var s=Si.memoizedState;if(a=s.destroy,null!==i&&Ri(i,s.deps))return void(r.memoizedState=ji(t,n,a,i))}_i.flags|=e,r.memoizedState=ji(1|t,n,a,i)}function Xi(e,t){return qi(8390656,8,e,t)}function Ki(e,t){return Zi(2048,8,e,t)}function Ji(e,t){return Zi(4,2,e,t)}function $i(e,t){return Zi(4,4,e,t)}function er(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function tr(e,t,n){return n=null!=n?n.concat([e]):null,Zi(4,4,er.bind(null,t,e),n)}function nr(){}function ir(e,t){var n=Li();t=void 0===t?null:t;var i=n.memoizedState;return null!==i&&null!==t&&Ri(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function rr(e,t){var n=Li();t=void 0===t?null:t;var i=n.memoizedState;return null!==i&&null!==t&&Ri(t,i[1])?i[0]:(e=e(),n.memoizedState=[e,t],e)}function ar(e,t,n){return 21&xi?(jt(n,t)||(n=Dt(),_i.lanes|=n,us|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Lr=!0),e.memoizedState=n)}function sr(e,t){var n=Tt;Tt=0!==n&&4>n?n:4,e(!0);var i=Ci.transition;Ci.transition={};try{e(!1),t()}finally{Tt=n,Ci.transition=i}}function or(){return Li().memoizedState}function lr(e,t,n){var i=Ms(e);n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},ur(e)?dr(t,n):null!==(n=Yn(e,t,n,i))&&(Is(n,e,i,Rs()),cr(n,t,i))}function hr(e,t,n){var i=Ms(e),r={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if(ur(e))dr(t,r);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var s=t.lastRenderedState,o=a(s,n);if(r.hasEagerState=!0,r.eagerState=o,jt(o,s)){var l=t.interleaved;return null===l?(r.next=r,jn(t)):(r.next=l.next,l.next=r),void(t.interleaved=r)}}catch(e){}null!==(n=Yn(e,t,r,i))&&(Is(n,e,i,r=Rs()),cr(n,t,i))}}function ur(e){var t=e.alternate;return e===_i||null!==t&&t===_i}function dr(e,t){ki=wi=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cr(e,t,n){if(4194240&n){var i=t.lanes;n|=i&=e.pendingLanes,t.lanes=n,It(e,n)}}var fr={readContext:Wn,useCallback:Di,useContext:Di,useEffect:Di,useImperativeHandle:Di,useInsertionEffect:Di,useLayoutEffect:Di,useMemo:Di,useReducer:Di,useRef:Di,useState:Di,useDebugValue:Di,useDeferredValue:Di,useTransition:Di,useMutableSource:Di,useSyncExternalStore:Di,useId:Di,unstable_isNewReconciler:!1},gr={readContext:Wn,useCallback:function(e,t){return Ti().memoizedState=[e,void 0===t?null:t],e},useContext:Wn,useEffect:Xi,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,qi(4194308,4,er.bind(null,t,e),n)},useLayoutEffect:function(e,t){return qi(4194308,4,e,t)},useInsertionEffect:function(e,t){return qi(4,2,e,t)},useMemo:function(e,t){var n=Ti();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var i=Ti();return t=void 0!==n?n(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=lr.bind(null,_i,e),[i.memoizedState,e]},useRef:function(e){return e={current:e},Ti().memoizedState=e},useState:Qi,useDebugValue:nr,useDeferredValue:function(e){return Ti().memoizedState=e},useTransition:function(){var e=Qi(!1),t=e[0];return e=sr.bind(null,e[1]),Ti().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=_i,r=Ti();if(gn){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===is)throw Error(a(349));30&xi||zi(i,t,n)}r.memoizedState=n;var s={value:n,getSnapshot:t};return r.queue=s,Xi(Gi.bind(null,i,s,e),[e]),i.flags|=2048,ji(9,Vi.bind(null,i,s,n,t),void 0,null),n},useId:function(){var e=Ti(),t=is.identifierPrefix;if(gn){var n=on;t=":"+t+"R"+(n=(sn&~(1<<32-Ct(sn)-1)).toString(32)+n),0<(n=Ei++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=Pi++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},pr={readContext:Wn,useCallback:ir,useContext:Wn,useEffect:Ki,useImperativeHandle:tr,useInsertionEffect:Ji,useLayoutEffect:$i,useMemo:rr,useReducer:Oi,useRef:Yi,useState:function(){return Oi(Hi)},useDebugValue:nr,useDeferredValue:function(e){return ar(Li(),Si.memoizedState,e)},useTransition:function(){return[Oi(Hi)[0],Li().memoizedState]},useMutableSource:Fi,useSyncExternalStore:Ni,useId:or,unstable_isNewReconciler:!1},mr={readContext:Wn,useCallback:ir,useContext:Wn,useEffect:Ki,useImperativeHandle:tr,useInsertionEffect:Ji,useLayoutEffect:$i,useMemo:rr,useReducer:Bi,useRef:Yi,useState:function(){return Bi(Hi)},useDebugValue:nr,useDeferredValue:function(e){var t=Li();return null===Si?t.memoizedState=e:ar(t,Si.memoizedState,e)},useTransition:function(){return[Bi(Hi)[0],Li().memoizedState]},useMutableSource:Fi,useSyncExternalStore:Ni,useId:or,unstable_isNewReconciler:!1};function vr(e,t){if(e&&e.defaultProps){for(var n in t=r({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function yr(e,t,n,i){n=null==(n=n(i,t=e.memoizedState))?t:r({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var br={isMounted:function(e){return!!(e=e._reactInternals)&&A(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var i=Rs(),r=Ms(e),a=Jn(i,r);a.payload=t,null!=n&&(a.callback=n),null!==(t=$n(e,a,r))&&(Is(t,e,r,i),ei(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=Rs(),r=Ms(e),a=Jn(i,r);a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=$n(e,a,r))&&(Is(t,e,r,i),ei(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Rs(),i=Ms(e),r=Jn(n,i);r.tag=2,null!=t&&(r.callback=t),null!==(t=$n(e,r,i))&&(Is(t,e,i,n),ei(t,e,i))}};function Cr(e,t,n,i,r,a,s){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(i,a,s):!(t.prototype&&t.prototype.isPureReactComponent&&En(n,i)&&En(r,a))}function xr(e,t,n){var i=!1,r=ht,a=t.contextType;return"object"==typeof a&&null!==a?a=Wn(a):(r=gt(t)?ct:ut.current,a=(i=null!=(i=t.contextTypes))?ft(e,r):ht),t=new t(n,a),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=br,e.stateNode=t,t._reactInternals=e,i&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=a),t}function _r(e,t,n,i){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,i),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&br.enqueueReplaceState(t,t.state,null)}function Sr(e,t,n,i){var r=e.stateNode;r.props=n,r.state=e.memoizedState,r.refs={},Xn(e);var a=t.contextType;"object"==typeof a&&null!==a?r.context=Wn(a):(a=gt(t)?ct:ut.current,r.context=ft(e,a)),r.state=e.memoizedState,"function"==typeof(a=t.getDerivedStateFromProps)&&(yr(e,t,a,n),r.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof r.getSnapshotBeforeUpdate||"function"!=typeof r.UNSAFE_componentWillMount&&"function"!=typeof r.componentWillMount||(t=r.state,"function"==typeof r.componentWillMount&&r.componentWillMount(),"function"==typeof r.UNSAFE_componentWillMount&&r.UNSAFE_componentWillMount(),t!==r.state&&br.enqueueReplaceState(r,r.state,null),ni(e,n,r,i),r.state=e.memoizedState),"function"==typeof r.componentDidMount&&(e.flags|=4194308)}function Ar(e,t){try{var n="",i=t;do{n+=Pn(i),i=i.return}while(i);var r=n}catch(e){r="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:r,digest:null}}function wr(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function kr(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Er="function"==typeof WeakMap?WeakMap:Map;function Pr(e,t,n){(n=Jn(-1,n)).tag=3,n.payload={element:null};var i=t.value;return n.callback=function(){Cs||(Cs=!0,xs=i),kr(0,t)},n}function Dr(e,t,n){(n=Jn(-1,n)).tag=3;var i=e.type.getDerivedStateFromError;if("function"==typeof i){var r=t.value;n.payload=function(){return i(r)},n.callback=function(){kr(0,t)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(n.callback=function(){kr(0,t),"function"!=typeof i&&(null===_s?_s=new Set([this]):_s.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function Rr(e,t,n){var i=e.pingCache;if(null===i){i=e.pingCache=new Er;var r=new Set;i.set(t,r)}else void 0===(r=i.get(t))&&(r=new Set,i.set(t,r));r.has(n)||(r.add(n),e=eo.bind(null,e,t,n),t.then(e,e))}function Mr(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function Ir(e,t,n,i,r){return 1&e.mode?(e.flags|=65536,e.lanes=r,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Jn(-1,1)).tag=2,$n(n,t,1))),n.lanes|=1),e)}var Tr=s.ReactCurrentOwner,Lr=!1;function Hr(e,t,n,i){t.child=null===e?Ln(t,null,n,i):Tn(t,e.child,n,i)}function Or(e,t,n,i,r){n=n.render;var a=t.ref;return Un(t,r),i=Mi(e,t,n,i,a,r),n=Ii(),null===e||Lr?(gn&&n&&un(t),t.flags|=1,Hr(e,t,i,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,aa(e,t,r))}function Br(e,t,n,i,r){if(null===e){var a=n.type;return"function"!=typeof a||oo(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=ho(n.type,null,i,t,t.mode,r)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,Fr(e,t,a,i,r))}if(a=e.child,0===(e.lanes&r)){var s=a.memoizedProps;if((n=null!==(n=n.compare)?n:En)(s,i)&&e.ref===t.ref)return aa(e,t,r)}return t.flags|=1,(e=lo(a,i)).ref=t.ref,e.return=t,t.child=e}function Fr(e,t,n,i,r){if(null!==e){var a=e.memoizedProps;if(En(a,i)&&e.ref===t.ref){if(Lr=!1,t.pendingProps=i=a,0===(e.lanes&r))return t.lanes=e.lanes,aa(e,t,r);131072&e.flags&&(Lr=!0)}}return Vr(e,t,n,i,r)}function Nr(e,t,n){var i=t.pendingProps,r=i.children,a=null!==e?e.memoizedState:null;if("hidden"===i.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,lt(os,ss),ss|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=null!==a?a.baseLanes:n,lt(os,ss),ss|=i}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},lt(os,ss),ss|=n;else null!==a?(i=a.baseLanes|n,t.memoizedState=null):i=n,lt(os,ss),ss|=i;return Hr(e,t,r,n),t.child}function zr(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Vr(e,t,n,i,r){var a=gt(n)?ct:ut.current;return a=ft(t,a),Un(t,r),n=Mi(e,t,n,i,a,r),i=Ii(),null===e||Lr?(gn&&i&&un(t),t.flags|=1,Hr(e,t,n,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,aa(e,t,r))}function Gr(e,t,n,i,r){if(gt(n)){var a=!0;yt(t)}else a=!1;if(Un(t,r),null===t.stateNode)ra(e,t),xr(t,n,i),Sr(t,n,i,r),i=!0;else if(null===e){var s=t.stateNode,o=t.memoizedProps;s.props=o;var l=s.context,h=n.contextType;h="object"==typeof h&&null!==h?Wn(h):ft(t,h=gt(n)?ct:ut.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof s.getSnapshotBeforeUpdate;d||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(o!==i||l!==h)&&_r(t,s,i,h),Zn=!1;var c=t.memoizedState;s.state=c,ni(t,i,s,r),l=t.memoizedState,o!==i||c!==l||dt.current||Zn?("function"==typeof u&&(yr(t,n,u,i),l=t.memoizedState),(o=Zn||Cr(t,n,o,i,c,l,h))?(d||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.flags|=4194308)):("function"==typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=l),s.props=i,s.state=l,s.context=h,i=o):("function"==typeof s.componentDidMount&&(t.flags|=4194308),i=!1)}else{s=t.stateNode,Kn(e,t),o=t.memoizedProps,h=t.type===t.elementType?o:vr(t.type,o),s.props=h,d=t.pendingProps,c=s.context,l="object"==typeof(l=n.contextType)&&null!==l?Wn(l):ft(t,l=gt(n)?ct:ut.current);var f=n.getDerivedStateFromProps;(u="function"==typeof f||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(o!==d||c!==l)&&_r(t,s,i,l),Zn=!1,c=t.memoizedState,s.state=c,ni(t,i,s,r);var g=t.memoizedState;o!==d||c!==g||dt.current||Zn?("function"==typeof f&&(yr(t,n,f,i),g=t.memoizedState),(h=Zn||Cr(t,n,h,i,c,g,l)||!1)?(u||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(i,g,l),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(i,g,l)),"function"==typeof s.componentDidUpdate&&(t.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof s.componentDidUpdate||o===e.memoizedProps&&c===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||o===e.memoizedProps&&c===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=g),s.props=i,s.state=g,s.context=l,i=h):("function"!=typeof s.componentDidUpdate||o===e.memoizedProps&&c===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||o===e.memoizedProps&&c===e.memoizedState||(t.flags|=1024),i=!1)}return Ur(e,t,n,i,a,r)}function Ur(e,t,n,i,r,a){zr(e,t);var s=!!(128&t.flags);if(!i&&!s)return r&&bt(t,n,!1),aa(e,t,a);i=t.stateNode,Tr.current=t;var o=s&&"function"!=typeof n.getDerivedStateFromError?null:i.render();return t.flags|=1,null!==e&&s?(t.child=Tn(t,e.child,null,a),t.child=Tn(t,null,o,a)):Hr(e,t,o,a),t.memoizedState=i.state,r&&bt(t,n,!0),t.child}function Wr(e){var t=e.stateNode;t.pendingContext?mt(0,t.pendingContext,t.pendingContext!==t.context):t.context&&mt(0,t.context,!1),di(e,t.containerInfo)}function Qr(e,t,n,i,r){return An(),wn(r),t.flags|=256,Hr(e,t,n,i),t.child}var jr,Yr,qr,Zr,Xr={dehydrated:null,treeContext:null,retryLane:0};function Kr(e){return{baseLanes:e,cachePool:null,transitions:null}}function Jr(e,t,n){var i,r=t.pendingProps,s=pi.current,o=!1,l=!!(128&t.flags);if((i=l)||(i=(null===e||null!==e.memoizedState)&&!!(2&s)),i?(o=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(s|=1),lt(pi,1&s),null===e)return Cn(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?Oe(e)?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(l=r.children,e=r.fallback,o?(r=t.mode,o=t.child,l={mode:"hidden",children:l},1&r||null===o?o=co(l,r,0,null):(o.childLanes=0,o.pendingProps=l),e=uo(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Kr(n),t.memoizedState=Xr,e):$r(t,l));if(null!==(s=e.memoizedState)&&null!==(i=s.dehydrated))return function(e,t,n,i,r,s,o){if(n)return 256&t.flags?(t.flags&=-257,ea(e,t,o,i=wr(Error(a(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(s=i.fallback,r=t.mode,i=co({mode:"visible",children:i.children},r,0,null),(s=uo(s,r,o,null)).flags|=2,i.return=t,s.return=t,i.sibling=s,t.child=i,1&t.mode&&Tn(t,e.child,null,o),t.child.memoizedState=Kr(o),t.memoizedState=Xr,s);if(!(1&t.mode))return ea(e,t,o,null);if(Oe(r))return i=Be(r).digest,ea(e,t,o,i=wr(s=Error(a(419)),i,void 0));if(n=0!==(o&e.childLanes),Lr||n){if(null!==(i=is)){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}0!==(r=0!==(r&(i.suspendedLanes|o))?0:r)&&r!==s.retryLane&&(s.retryLane=r,qn(e,r),Is(i,e,r,-1))}return Ws(),ea(e,t,o,i=wr(Error(a(421))))}return He(r)?(t.flags|=128,t.child=e.child,t=no.bind(null,e),Fe(r,t),null):(e=s.treeContext,Z&&(fn=Ge(r),cn=t,gn=!0,mn=null,pn=!1,null!==e&&(nn[rn++]=sn,nn[rn++]=on,nn[rn++]=an,sn=e.id,on=e.overflow,an=t)),(t=$r(t,i.children)).flags|=4096,t)}(e,t,l,r,i,s,n);if(o){o=r.fallback,l=t.mode,i=(s=e.child).sibling;var h={mode:"hidden",children:r.children};return 1&l||t.child===s?(r=lo(s,h)).subtreeFlags=14680064&s.subtreeFlags:((r=t.child).childLanes=0,r.pendingProps=h,t.deletions=null),null!==i?o=lo(i,o):(o=uo(o,l,n,null)).flags|=2,o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,l=null===(l=e.child.memoizedState)?Kr(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},o.memoizedState=l,o.childLanes=e.childLanes&~n,t.memoizedState=Xr,r}return e=(o=e.child).sibling,r=lo(o,{mode:"visible",children:r.children}),!(1&t.mode)&&(r.lanes=n),r.return=t,r.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function $r(e,t){return(t=co({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function ea(e,t,n,i){return null!==i&&wn(i),Tn(t,e.child,null,n),(e=$r(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function ta(e,t,n){e.lanes|=t;var i=e.alternate;null!==i&&(i.lanes|=t),Gn(e.return,t,n)}function na(e,t,n,i,r){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=i,a.tail=n,a.tailMode=r)}function ia(e,t,n){var i=t.pendingProps,r=i.revealOrder,a=i.tail;if(Hr(e,t,i.children,n),2&(i=pi.current))i=1&i|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&ta(e,n,t);else if(19===e.tag)ta(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}i&=1}if(lt(pi,i),1&t.mode)switch(r){case"forwards":for(n=t.child,r=null;null!==n;)null!==(e=n.alternate)&&null===mi(e)&&(r=n),n=n.sibling;null===(n=r)?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),na(t,!1,r,n,a);break;case"backwards":for(n=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===mi(e)){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}na(t,!0,n,null,a);break;case"together":na(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function ra(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function aa(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),us|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=lo(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=lo(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function sa(e){e.flags|=4}function oa(e,t){if(null!==e&&e.child===t.child)return!0;if(16&t.flags)return!1;for(e=t.child;null!==e;){if(12854&e.flags||12854&e.subtreeFlags)return!1;e=e.sibling}return!0}if(Y)jr=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)F(e,n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Yr=function(){},qr=function(e,t,n,i,r){if((e=e.memoizedProps)!==i){var a=t.stateNode,s=ui(ai.current);n=z(a,n,e,i,r,s),(t.updateQueue=n)&&sa(t)}},Zr=function(e,t,n,i){n!==i&&sa(t)};else if(q){jr=function(e,t,n,i){for(var r=t.child;null!==r;){if(5===r.tag){var a=r.stateNode;n&&i&&(a=Re(a,r.type,r.memoizedProps,r)),F(e,a)}else if(6===r.tag)a=r.stateNode,n&&i&&(a=Me(a,r.memoizedProps,r)),F(e,a);else if(4!==r.tag)if(22===r.tag&&null!==r.memoizedState)null!==(a=r.child)&&(a.return=r),jr(e,r,!0,!0);else if(null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};var la=function(e,t,n,i){for(var r=t.child;null!==r;){if(5===r.tag){var a=r.stateNode;n&&i&&(a=Re(a,r.type,r.memoizedProps,r)),Ee(e,a)}else if(6===r.tag)a=r.stateNode,n&&i&&(a=Me(a,r.memoizedProps,r)),Ee(e,a);else if(4!==r.tag)if(22===r.tag&&null!==r.memoizedState)null!==(a=r.child)&&(a.return=r),la(e,r,!0,!0);else if(null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Yr=function(e,t){var n=t.stateNode;if(!oa(e,t)){e=n.containerInfo;var i=ke(e);la(i,t,!1,!1),n.pendingChildren=i,sa(t),Pe(e,i)}},qr=function(e,t,n,i,r){var a=e.stateNode,s=e.memoizedProps;if((e=oa(e,t))&&s===i)t.stateNode=a;else{var o=t.stateNode,l=ui(ai.current),h=null;s!==i&&(h=z(o,n,s,i,r,l)),e&&null===h?t.stateNode=a:(a=we(a,h,n,s,i,t,e,o),N(a,n,i,r,l)&&sa(t),t.stateNode=a,e?sa(t):jr(a,t,!1,!1))}},Zr=function(e,t,n,i){n!==i?(e=ui(hi.current),n=ui(ai.current),t.stateNode=G(i,e,n,t),sa(t)):t.stateNode=e.stateNode}}else Yr=function(){},qr=function(){},Zr=function(){};function ha(e,t){if(!gn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;null!==n;)null!==n.alternate&&(i=n),n=n.sibling;null===i?t||null===e.tail?e.tail=null:e.tail.sibling=null:i.sibling=null}}function ua(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,i=0;if(t)for(var r=e.child;null!==r;)n|=r.lanes|r.childLanes,i|=14680064&r.subtreeFlags,i|=14680064&r.flags,r.return=e,r=r.sibling;else for(r=e.child;null!==r;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function da(e,t,n){var i=t.pendingProps;switch(dn(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ua(t),null;case 1:case 17:return gt(t.type)&&pt(),ua(t),null;case 3:return n=t.stateNode,ci(),ot(dt),ot(ut),yi(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(_n(t)?sa(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==mn&&(Os(mn),mn=null))),Yr(e,t),ua(t),null;case 5:gi(t),n=ui(hi.current);var r=t.type;if(null!==e&&null!=t.stateNode)qr(e,t,r,i,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(null===t.stateNode)throw Error(a(166));return ua(t),null}if(e=ui(ai.current),_n(t)){if(!Z)throw Error(a(175));e=Ue(t.stateNode,t.type,t.memoizedProps,n,e,t,!pn),t.updateQueue=e,null!==e&&sa(t)}else{var s=B(r,i,n,e,t);jr(s,t,!1,!1),t.stateNode=s,N(s,r,i,n,e)&&sa(t)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return ua(t),null;case 6:if(e&&null!=t.stateNode)Zr(e,t,e.memoizedProps,i);else{if("string"!=typeof i&&null===t.stateNode)throw Error(a(166));if(e=ui(hi.current),n=ui(ai.current),_n(t)){if(!Z)throw Error(a(176));if(e=t.stateNode,n=t.memoizedProps,(i=We(e,n,t,!pn))&&null!==(r=cn))switch(r.tag){case 3:Je(r.stateNode.containerInfo,e,n,!!(1&r.mode));break;case 5:$e(r.type,r.memoizedProps,r.stateNode,e,n,!!(1&r.mode))}i&&sa(t)}else t.stateNode=G(i,e,n,t)}return ua(t),null;case 13:if(ot(pi),i=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(gn&&null!==fn&&1&t.mode&&!(128&t.flags))Sn(),An(),t.flags|=98560,r=!1;else if(r=_n(t),null!==i&&null!==i.dehydrated){if(null===e){if(!r)throw Error(a(318));if(!Z)throw Error(a(344));if(!(r=null!==(r=t.memoizedState)?r.dehydrated:null))throw Error(a(317));Qe(r,t)}else An(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;ua(t),r=!1}else null!==mn&&(Os(mn),mn=null),r=!0;if(!r)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=n,t):((n=null!==i)!=(null!==e&&null!==e.memoizedState)&&n&&(t.child.flags|=8192,1&t.mode&&(null===e||1&pi.current?0===ls&&(ls=3):Ws())),null!==t.updateQueue&&(t.flags|=4),ua(t),null);case 4:return ci(),Yr(e,t),null===e&&K(t.stateNode.containerInfo),ua(t),null;case 10:return Vn(t.type._context),ua(t),null;case 19:if(ot(pi),null===(r=t.memoizedState))return ua(t),null;if(i=!!(128&t.flags),null===(s=r.rendering))if(i)ha(r,!1);else{if(0!==ls||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(s=mi(e))){for(t.flags|=128,ha(r,!1),null!==(e=s.updateQueue)&&(t.updateQueue=e,t.flags|=4),t.subtreeFlags=0,e=n,n=t.child;null!==n;)r=e,(i=n).flags&=14680066,null===(s=i.alternate)?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,r=s.dependencies,i.dependencies=null===r?null:{lanes:r.lanes,firstContext:r.firstContext}),n=n.sibling;return lt(pi,1&pi.current|2),t.child}e=e.sibling}null!==r.tail&&Nt()>ms&&(t.flags|=128,i=!0,ha(r,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=mi(s))){if(t.flags|=128,i=!0,null!==(e=e.updateQueue)&&(t.updateQueue=e,t.flags|=4),ha(r,!0),null===r.tail&&"hidden"===r.tailMode&&!s.alternate&&!gn)return ua(t),null}else 2*Nt()-r.renderingStartTime>ms&&1073741824!==n&&(t.flags|=128,i=!0,ha(r,!1),t.lanes=4194304);r.isBackwards?(s.sibling=t.child,t.child=s):(null!==(e=r.last)?e.sibling=s:t.child=s,r.last=s)}return null!==r.tail?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=Nt(),t.sibling=null,e=pi.current,lt(pi,i?1&e|2:1&e),t):(ua(t),null);case 22:case 23:return zs(),n=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==n&&(t.flags|=8192),n&&1&t.mode?!!(1073741824&ss)&&(ua(t),Y&&6&t.subtreeFlags&&(t.flags|=8192)):ua(t),null;case 24:case 25:return null}throw Error(a(156,t.tag))}function ca(e,t){switch(dn(t),t.tag){case 1:return gt(t.type)&&pt(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return ci(),ot(dt),ot(ut),yi(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return gi(t),null;case 13:if(ot(pi),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));An()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return ot(pi),null;case 4:return ci(),null;case 10:return Vn(t.type._context),null;case 22:case 23:return zs(),null;default:return null}}var fa=!1,ga=!1,pa="function"==typeof WeakSet?WeakSet:Set,ma=null;function va(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){$s(e,t,n)}else n.current=null}function ya(e,t,n){try{n()}catch(n){$s(e,t,n)}}var ba=!1;function Ca(e,t,n){var i=t.updateQueue;if(null!==(i=null!==i?i.lastEffect:null)){var r=i=i.next;do{if((r.tag&e)===e){var a=r.destroy;r.destroy=void 0,void 0!==a&&ya(t,n,a)}r=r.next}while(r!==i)}}function xa(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var i=n.create;n.destroy=i()}n=n.next}while(n!==t)}}function _a(e){var t=e.ref;if(null!==t){var n=e.stateNode;e=5===e.tag?I(n):n,"function"==typeof t?t(e):t.current=e}}function Sa(e){var t=e.alternate;null!==t&&(e.alternate=null,Sa(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(t=e.stateNode)&&$(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 Aa(e){return 5===e.tag||3===e.tag||4===e.tag}function wa(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Aa(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function ka(e,t,n){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?me(n,e,t):de(n,e);else if(4!==i&&null!==(e=e.child))for(ka(e,t,n),e=e.sibling;null!==e;)ka(e,t,n),e=e.sibling}function Ea(e,t,n){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?pe(n,e,t):ue(n,e);else if(4!==i&&null!==(e=e.child))for(Ea(e,t,n),e=e.sibling;null!==e;)Ea(e,t,n),e=e.sibling}var Pa=null,Da=!1;function Ra(e,t,n){for(n=n.child;null!==n;)Ma(e,t,n),n=n.sibling}function Ma(e,t,n){if(Qt&&"function"==typeof Qt.onCommitFiberUnmount)try{Qt.onCommitFiberUnmount(Wt,n)}catch(e){}switch(n.tag){case 5:ga||va(n,t);case 6:if(Y){var i=Pa,r=Da;Pa=null,Ra(e,t,n),Da=r,null!==(Pa=i)&&(Da?ye(Pa,n.stateNode):ve(Pa,n.stateNode))}else Ra(e,t,n);break;case 18:Y&&null!==Pa&&(Da?Xe(Pa,n.stateNode):Ze(Pa,n.stateNode));break;case 4:Y?(i=Pa,r=Da,Pa=n.stateNode.containerInfo,Da=!0,Ra(e,t,n),Pa=i,Da=r):(q&&(i=n.stateNode.containerInfo,r=ke(i),De(i,r)),Ra(e,t,n));break;case 0:case 11:case 14:case 15:if(!ga&&null!==(i=n.updateQueue)&&null!==(i=i.lastEffect)){r=i=i.next;do{var a=r,s=a.destroy;a=a.tag,void 0!==s&&(2&a||4&a)&&ya(n,t,s),r=r.next}while(r!==i)}Ra(e,t,n);break;case 1:if(!ga&&(va(n,t),"function"==typeof(i=n.stateNode).componentWillUnmount))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(e){$s(n,t,e)}Ra(e,t,n);break;case 21:Ra(e,t,n);break;case 22:1&n.mode?(ga=(i=ga)||null!==n.memoizedState,Ra(e,t,n),ga=i):Ra(e,t,n);break;default:Ra(e,t,n)}}function Ia(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new pa),t.forEach(function(t){var i=io.bind(null,e,t);n.has(t)||(n.add(t),t.then(i,i))})}}function Ta(e,t){var n=t.deletions;if(null!==n)for(var i=0;i<n.length;i++){var r=n[i];try{var s=e,o=t;if(Y){var l=o;e:for(;null!==l;){switch(l.tag){case 5:Pa=l.stateNode,Da=!1;break e;case 3:case 4:Pa=l.stateNode.containerInfo,Da=!0;break e}l=l.return}if(null===Pa)throw Error(a(160));Ma(s,o,r),Pa=null,Da=!1}else Ma(s,o,r);var h=r.alternate;null!==h&&(h.return=null),r.return=null}catch(e){$s(r,t,e)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)La(t,e),t=t.sibling}function La(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ta(t,e),Ha(e),4&i){try{Ca(3,e,e.return),xa(3,e)}catch(t){$s(e,e.return,t)}try{Ca(5,e,e.return)}catch(t){$s(e,e.return,t)}}break;case 1:Ta(t,e),Ha(e),512&i&&null!==n&&va(n,n.return);break;case 5:if(Ta(t,e),Ha(e),512&i&&null!==n&&va(n,n.return),Y){if(32&e.flags){var r=e.stateNode;try{be(r)}catch(t){$s(e,e.return,t)}}if(4&i&&null!=(r=e.stateNode)){var s=e.memoizedProps;if(n=null!==n?n.memoizedProps:s,i=e.type,t=e.updateQueue,e.updateQueue=null,null!==t)try{ge(r,t,i,n,s,e)}catch(t){$s(e,e.return,t)}}}break;case 6:if(Ta(t,e),Ha(e),4&i&&Y){if(null===e.stateNode)throw Error(a(162));r=e.stateNode,s=e.memoizedProps,n=null!==n?n.memoizedProps:s;try{ce(r,n,s)}catch(t){$s(e,e.return,t)}}break;case 3:if(Ta(t,e),Ha(e),4&i){if(Y&&Z&&null!==n&&n.memoizedState.isDehydrated)try{Ye(t.containerInfo)}catch(t){$s(e,e.return,t)}if(q){r=t.containerInfo,s=t.pendingChildren;try{De(r,s)}catch(t){$s(e,e.return,t)}}}break;case 4:if(Ta(t,e),Ha(e),4&i&&q){r=(s=e.stateNode).containerInfo,s=s.pendingChildren;try{De(r,s)}catch(t){$s(e,e.return,t)}}break;case 13:Ta(t,e),Ha(e),8192&(r=e.child).flags&&(s=null!==r.memoizedState,r.stateNode.isHidden=s,!s||null!==r.alternate&&null!==r.alternate.memoizedState||(ps=Nt())),4&i&&Ia(e);break;case 22:var o=null!==n&&null!==n.memoizedState;if(1&e.mode?(ga=(n=ga)||o,Ta(t,e),ga=n):Ta(t,e),Ha(e),8192&i){if(n=null!==e.memoizedState,(e.stateNode.isHidden=n)&&!o&&1&e.mode)for(ma=e,i=e.child;null!==i;){for(t=ma=i;null!==ma;){var l=(o=ma).child;switch(o.tag){case 0:case 11:case 14:case 15:Ca(4,o,o.return);break;case 1:va(o,o.return);var h=o.stateNode;if("function"==typeof h.componentWillUnmount){var u=o,d=o.return;try{var c=u;h.props=c.memoizedProps,h.state=c.memoizedState,h.componentWillUnmount()}catch(e){$s(u,d,e)}}break;case 5:va(o,o.return);break;case 22:if(null!==o.memoizedState){Na(t);continue}}null!==l?(l.return=o,ma=l):Na(t)}i=i.sibling}if(Y)e:if(i=null,Y)for(t=e;;){if(5===t.tag){if(null===i){i=t;try{r=t.stateNode,n?Ce(r):_e(t.stateNode,t.memoizedProps)}catch(t){$s(e,e.return,t)}}}else if(6===t.tag){if(null===i)try{s=t.stateNode,n?xe(s):Se(s,t.memoizedProps)}catch(t){$s(e,e.return,t)}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}}break;case 19:Ta(t,e),Ha(e),4&i&&Ia(e);break;case 21:break;default:Ta(t,e),Ha(e)}}function Ha(e){var t=e.flags;if(2&t){try{if(Y){e:{for(var n=e.return;null!==n;){if(Aa(n)){var i=n;break e}n=n.return}throw Error(a(160))}switch(i.tag){case 5:var r=i.stateNode;32&i.flags&&(be(r),i.flags&=-33),Ea(e,wa(e),r);break;case 3:case 4:var s=i.stateNode.containerInfo;ka(e,wa(e),s);break;default:throw Error(a(161))}}}catch(t){$s(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function Oa(e,t,n){ma=e,Ba(e)}function Ba(e,t,n){for(var i=!!(1&e.mode);null!==ma;){var r=ma,a=r.child;if(22===r.tag&&i){var s=null!==r.memoizedState||fa;if(!s){var o=r.alternate,l=null!==o&&null!==o.memoizedState||ga;o=fa;var h=ga;if(fa=s,(ga=l)&&!h)for(ma=r;null!==ma;)l=(s=ma).child,22===s.tag&&null!==s.memoizedState?za(r):null!==l?(l.return=s,ma=l):za(r);for(;null!==a;)ma=a,Ba(a),a=a.sibling;ma=r,fa=o,ga=h}Fa(e)}else 8772&r.subtreeFlags&&null!==a?(a.return=r,ma=a):Fa(e)}}function Fa(e){for(;null!==ma;){var t=ma;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:ga||xa(5,t);break;case 1:var i=t.stateNode;if(4&t.flags&&!ga)if(null===n)i.componentDidMount();else{var r=t.elementType===t.type?n.memoizedProps:vr(t.type,n.memoizedProps);i.componentDidUpdate(r,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;null!==s&&ii(t,s,i);break;case 3:var o=t.updateQueue;if(null!==o){if(n=null,null!==t.child)switch(t.child.tag){case 5:n=I(t.child.stateNode);break;case 1:n=t.child.stateNode}ii(t,o,n)}break;case 5:var l=t.stateNode;null===n&&4&t.flags&&fe(l,t.type,t.memoizedProps,t);break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(Z&&null===t.memoizedState){var h=t.alternate;if(null!==h){var u=h.memoizedState;if(null!==u){var d=u.dehydrated;null!==d&&qe(d)}}}break;default:throw Error(a(163))}ga||512&t.flags&&_a(t)}catch(e){$s(t,t.return,e)}}if(t===e){ma=null;break}if(null!==(n=t.sibling)){n.return=t.return,ma=n;break}ma=t.return}}function Na(e){for(;null!==ma;){var t=ma;if(t===e){ma=null;break}var n=t.sibling;if(null!==n){n.return=t.return,ma=n;break}ma=t.return}}function za(e){for(;null!==ma;){var t=ma;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{xa(4,t)}catch(e){$s(t,n,e)}break;case 1:var i=t.stateNode;if("function"==typeof i.componentDidMount){var r=t.return;try{i.componentDidMount()}catch(e){$s(t,r,e)}}var a=t.return;try{_a(t)}catch(e){$s(t,a,e)}break;case 5:var s=t.return;try{_a(t)}catch(e){$s(t,s,e)}}}catch(e){$s(t,t.return,e)}if(t===e){ma=null;break}var o=t.sibling;if(null!==o){o.return=t.return,ma=o;break}ma=t.return}}var Va=0,Ga=1,Ua=2,Wa=3,Qa=4;if("function"==typeof Symbol&&Symbol.for){var ja=Symbol.for;Va=ja("selector.component"),Ga=ja("selector.has_pseudo_class"),Ua=ja("selector.role"),Wa=ja("selector.test_id"),Qa=ja("selector.text")}function Ya(e){var t=X(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(a(364));return t}if(null===(e=ie(e)))throw Error(a(362));return e.stateNode.current}function qa(e,t){switch(t.$$typeof){case Va:if(e.type===t.value)return!0;break;case Ga:e:{t=t.value,e=[e,0];for(var n=0;n<e.length;){var i=e[n++],r=e[n++],s=t[r];if(5!==i.tag||!se(i)){for(;null!=s&&qa(i,s);)s=t[++r];if(r===t.length){t=!0;break e}for(i=i.child;null!==i;)e.push(i,r),i=i.sibling}}t=!1}return t;case Ua:if(5===e.tag&&oe(e.stateNode,t.value))return!0;break;case Qa:if((5===e.tag||6===e.tag)&&null!==(e=ae(e))&&0<=e.indexOf(t.value))return!0;break;case Wa:if(5===e.tag&&"string"==typeof(e=e.memoizedProps["data-testname"])&&e.toLowerCase()===t.value.toLowerCase())return!0;break;default:throw Error(a(365))}return!1}function Za(e){switch(e.$$typeof){case Va:return"<"+(_(e.value)||"Unknown")+">";case Ga:return":has("+(Za(e)||"")+")";case Ua:return'[role="'+e.value+'"]';case Qa:return'"'+e.value+'"';case Wa:return'[data-testname="'+e.value+'"]';default:throw Error(a(365))}}function Xa(e,t){var n=[];e=[e,0];for(var i=0;i<e.length;){var r=e[i++],a=e[i++],s=t[a];if(5!==r.tag||!se(r)){for(;null!=s&&qa(r,s);)s=t[++a];if(a===t.length)n.push(r);else for(r=r.child;null!==r;)e.push(r,a),r=r.sibling}}return n}function Ka(e,t){if(!ne)throw Error(a(363));e=Xa(e=Ya(e),t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var i=e[n++];if(5===i.tag)se(i)||t.push(i.stateNode);else for(i=i.child;null!==i;)e.push(i),i=i.sibling}return t}var Ja=Math.ceil,$a=s.ReactCurrentDispatcher,es=s.ReactCurrentOwner,ts=s.ReactCurrentBatchConfig,ns=0,is=null,rs=null,as=0,ss=0,os=st(0),ls=0,hs=null,us=0,ds=0,cs=0,fs=null,gs=null,ps=0,ms=1/0,vs=null;function ys(){ms=Nt()+500}var bs,Cs=!1,xs=null,_s=null,Ss=!1,As=null,ws=0,ks=0,Es=null,Ps=-1,Ds=0;function Rs(){return 6&ns?Nt():-1!==Ps?Ps:Ps=Nt()}function Ms(e){return 1&e.mode?2&ns&&0!==as?as&-as:null!==kn.transition?(0===Ds&&(Ds=Dt()),Ds):0!==(e=Tt)?e:J():1}function Is(e,t,n,i){if(50<ks)throw ks=0,Es=null,Error(a(185));Mt(e,n,i),2&ns&&e===is||(e===is&&(!(2&ns)&&(ds|=n),4===ls&&Bs(e,as)),Ts(e,i),1===n&&0===ns&&!(1&t.mode)&&(ys(),qt&&Kt()))}function Ts(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,r=e.expirationTimes,a=e.pendingLanes;0<a;){var s=31-Ct(a),o=1<<s,l=r[s];-1===l?0!==(o&n)&&0===(o&i)||(r[s]=Et(o,t)):l<=t&&(e.expiredLanes|=o),a&=~o}}(e,t);var i=kt(e,e===is?as:0);if(0===i)null!==n&&Ot(n),e.callbackNode=null,e.callbackPriority=0;else if(t=i&-i,e.callbackPriority!==t){if(null!=n&&Ot(n),1===t)0===e.tag?function(e){qt=!0,Xt(e)}(Fs.bind(null,e)):Xt(Fs.bind(null,e)),ee?te(function(){!(6&ns)&&Kt()}):Ht(zt,Kt),n=null;else{switch(Lt(i)){case 1:n=zt;break;case 4:n=Vt;break;case 16:default:n=Gt;break;case 536870912:n=Ut}n=ro(n,Ls.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ls(e,t){if(Ps=-1,Ds=0,6&ns)throw Error(a(327));var n=e.callbackNode;if(Ks()&&e.callbackNode!==n)return null;var i=kt(e,e===is?as:0);if(0===i)return null;if(30&i||0!==(i&e.expiredLanes)||t)t=Qs(e,i);else{t=i;var r=ns;ns|=2;var s=Us();for(is===e&&as===t||(vs=null,ys(),Vs(e,t));;)try{Ys();break}catch(t){Gs(e,t)}Nn(),$a.current=s,ns=r,null!==rs?t=0:(is=null,as=0,t=ls)}if(0!==t){if(2===t&&0!==(r=Pt(e))&&(i=r,t=Hs(e,r)),1===t)throw n=hs,Vs(e,0),Bs(e,i),Ts(e,Nt()),n;if(6===t)Bs(e,i);else{if(r=e.current.alternate,!(30&i||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var i=0;i<n.length;i++){var r=n[i],a=r.getSnapshot;r=r.value;try{if(!jt(a(),r))return!1}catch(e){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(r)||(t=Qs(e,i),2===t&&(s=Pt(e),0!==s&&(i=s,t=Hs(e,s))),1!==t)))throw n=hs,Vs(e,0),Bs(e,i),Ts(e,Nt()),n;switch(e.finishedWork=r,e.finishedLanes=i,t){case 0:case 1:throw Error(a(345));case 2:case 5:Xs(e,gs,vs);break;case 3:if(Bs(e,i),(130023424&i)===i&&10<(t=ps+500-Nt())){if(0!==kt(e,0))break;if(((r=e.suspendedLanes)&i)!==i){Rs(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=U(Xs.bind(null,e,gs,vs),t);break}Xs(e,gs,vs);break;case 4:if(Bs(e,i),(4194240&i)===i)break;for(t=e.eventTimes,r=-1;0<i;){var o=31-Ct(i);s=1<<o,(o=t[o])>r&&(r=o),i&=~s}if(i=r,10<(i=(120>(i=Nt()-i)?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Ja(i/1960))-i)){e.timeoutHandle=U(Xs.bind(null,e,gs,vs),i);break}Xs(e,gs,vs);break;default:throw Error(a(329))}}}return Ts(e,Nt()),e.callbackNode===n?Ls.bind(null,e):null}function Hs(e,t){var n=fs;return e.current.memoizedState.isDehydrated&&(Vs(e,t).flags|=256),2!==(e=Qs(e,t))&&(t=gs,gs=n,null!==t&&Os(t)),e}function Os(e){null===gs?gs=e:gs.push.apply(gs,e)}function Bs(e,t){for(t&=~cs,t&=~ds,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ct(t),i=1<<n;e[n]=-1,t&=~i}}function Fs(e){if(6&ns)throw Error(a(327));Ks();var t=kt(e,0);if(!(1&t))return Ts(e,Nt()),null;var n=Qs(e,t);if(0!==e.tag&&2===n){var i=Pt(e);0!==i&&(t=i,n=Hs(e,i))}if(1===n)throw n=hs,Vs(e,0),Bs(e,t),Ts(e,Nt()),n;if(6===n)throw Error(a(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Xs(e,gs,vs),Ts(e,Nt()),null}function Ns(e){null!==As&&0===As.tag&&!(6&ns)&&Ks();var t=ns;ns|=1;var n=ts.transition,i=Tt;try{if(ts.transition=null,Tt=1,e)return e()}finally{Tt=i,ts.transition=n,!(6&(ns=t))&&Kt()}}function zs(){ss=os.current,ot(os)}function Vs(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==Q&&(e.timeoutHandle=Q,W(n)),null!==rs)for(n=rs.return;null!==n;){var i=n;switch(dn(i),i.tag){case 1:null!=(i=i.type.childContextTypes)&&pt();break;case 3:ci(),ot(dt),ot(ut),yi();break;case 5:gi(i);break;case 4:ci();break;case 13:case 19:ot(pi);break;case 10:Vn(i.type._context);break;case 22:case 23:zs()}n=n.return}if(is=e,rs=e=lo(e.current,null),as=ss=t,ls=0,hs=null,cs=ds=us=0,gs=fs=null,null!==Qn){for(t=0;t<Qn.length;t++)if(null!==(i=(n=Qn[t]).interleaved)){n.interleaved=null;var r=i.next,a=n.pending;if(null!==a){var s=a.next;a.next=r,i.next=s}n.pending=i}Qn=null}return e}function Gs(e,t){for(;;){var n=rs;try{if(Nn(),bi.current=fr,wi){for(var i=_i.memoizedState;null!==i;){var r=i.queue;null!==r&&(r.pending=null),i=i.next}wi=!1}if(xi=0,Ai=Si=_i=null,ki=!1,Ei=0,es.current=null,null===n||null===n.return){ls=1,hs=t,rs=null;break}e:{var s=e,o=n.return,l=n,h=t;if(t=as,l.flags|=32768,null!==h&&"object"==typeof h&&"function"==typeof h.then){var u=h,d=l,c=d.tag;if(!(1&d.mode||0!==c&&11!==c&&15!==c)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var g=Mr(o);if(null!==g){g.flags&=-257,Ir(g,o,l,0,t),1&g.mode&&Rr(s,u,t),h=u;var p=(t=g).updateQueue;if(null===p){var m=new Set;m.add(h),t.updateQueue=m}else p.add(h);break e}if(!(1&t)){Rr(s,u,t),Ws();break e}h=Error(a(426))}else if(gn&&1&l.mode){var v=Mr(o);if(null!==v){!(65536&v.flags)&&(v.flags|=256),Ir(v,o,l,0,t),wn(Ar(h,l));break e}}s=h=Ar(h,l),4!==ls&&(ls=2),null===fs?fs=[s]:fs.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t,ti(s,Pr(0,h,t));break e;case 1:l=h;var y=s.type,b=s.stateNode;if(!(128&s.flags||"function"!=typeof y.getDerivedStateFromError&&(null===b||"function"!=typeof b.componentDidCatch||null!==_s&&_s.has(b)))){s.flags|=65536,t&=-t,s.lanes|=t,ti(s,Dr(s,l,t));break e}}s=s.return}while(null!==s)}Zs(n)}catch(e){t=e,rs===n&&null!==n&&(rs=n=n.return);continue}break}}function Us(){var e=$a.current;return $a.current=fr,null===e?fr:e}function Ws(){0!==ls&&3!==ls&&2!==ls||(ls=4),null===is||!(268435455&us)&&!(268435455&ds)||Bs(is,as)}function Qs(e,t){var n=ns;ns|=2;var i=Us();for(is===e&&as===t||(vs=null,Vs(e,t));;)try{js();break}catch(t){Gs(e,t)}if(Nn(),ns=n,$a.current=i,null!==rs)throw Error(a(261));return is=null,as=0,ls}function js(){for(;null!==rs;)qs(rs)}function Ys(){for(;null!==rs&&!Bt();)qs(rs)}function qs(e){var t=bs(e.alternate,e,ss);e.memoizedProps=e.pendingProps,null===t?Zs(e):rs=t,es.current=null}function Zs(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=ca(n,t)))return n.flags&=32767,void(rs=n);if(null===e)return ls=6,void(rs=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=da(n,t,ss)))return void(rs=n);if(null!==(t=t.sibling))return void(rs=t);rs=t=e}while(null!==t);0===ls&&(ls=5)}function Xs(e,t,n){var i=Tt,r=ts.transition;try{ts.transition=null,Tt=1,function(e,t,n,i){do{Ks()}while(null!==As);if(6&ns)throw Error(a(327));n=e.finishedWork;var r=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(a(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0<n;){var r=31-Ct(n),a=1<<r;t[r]=0,i[r]=-1,e[r]=-1,n&=~a}}(e,s),e===is&&(rs=is=null,as=0),!(2064&n.subtreeFlags)&&!(2064&n.flags)||Ss||(Ss=!0,ro(Gt,function(){return Ks(),null})),s=!!(15990&n.flags),15990&n.subtreeFlags||s){s=ts.transition,ts.transition=null;var o=Tt;Tt=1;var l=ns;ns|=4,es.current=null,function(e,t){for(H(e.containerInfo),ma=t;null!==ma;)if(t=(e=ma).child,1028&e.subtreeFlags&&null!==t)t.return=e,ma=t;else for(;null!==ma;){e=ma;try{var n=e.alternate;if(1024&e.flags)switch(e.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==n){var i=n.memoizedProps,r=n.memoizedState,s=e.stateNode,o=s.getSnapshotBeforeUpdate(e.elementType===e.type?i:vr(e.type,i),r);s.__reactInternalSnapshotBeforeUpdate=o}break;case 3:Y&&Ae(e.stateNode.containerInfo);break;default:throw Error(a(163))}}catch(t){$s(e,e.return,t)}if(null!==(t=e.sibling)){t.return=e.return,ma=t;break}ma=e.return}n=ba,ba=!1}(e,n),La(n,e),O(e.containerInfo),e.current=n,Oa(n),Ft(),ns=l,Tt=o,ts.transition=s}else e.current=n;if(Ss&&(Ss=!1,As=e,ws=r),0===(s=e.pendingLanes)&&(_s=null),function(e){if(Qt&&"function"==typeof Qt.onCommitFiberRoot)try{Qt.onCommitFiberRoot(Wt,e,void 0,!(128&~e.current.flags))}catch(e){}}(n.stateNode),Ts(e,Nt()),null!==t)for(i=e.onRecoverableError,n=0;n<t.length;n++)i((r=t[n]).value,{componentStack:r.stack,digest:r.digest});if(Cs)throw Cs=!1,e=xs,xs=null,e;!!(1&ws)&&0!==e.tag&&Ks(),1&(s=e.pendingLanes)?e===Es?ks++:(ks=0,Es=e):ks=0,Kt()}(e,t,n,i)}finally{ts.transition=r,Tt=i}return null}function Ks(){if(null!==As){var e=Lt(ws),t=ts.transition,n=Tt;try{if(ts.transition=null,Tt=16>e?16:e,null===As)var i=!1;else{if(e=As,As=null,ws=0,6&ns)throw Error(a(331));var r=ns;for(ns|=4,ma=e.current;null!==ma;){var s=ma,o=s.child;if(16&ma.flags){var l=s.deletions;if(null!==l){for(var h=0;h<l.length;h++){var u=l[h];for(ma=u;null!==ma;){var d=ma;switch(d.tag){case 0:case 11:case 15:Ca(8,d,s)}var c=d.child;if(null!==c)c.return=d,ma=c;else for(;null!==ma;){var f=(d=ma).sibling,g=d.return;if(Sa(d),d===u){ma=null;break}if(null!==f){f.return=g,ma=f;break}ma=g}}}var p=s.alternate;if(null!==p){var m=p.child;if(null!==m){p.child=null;do{var v=m.sibling;m.sibling=null,m=v}while(null!==m)}}ma=s}}if(2064&s.subtreeFlags&&null!==o)o.return=s,ma=o;else e:for(;null!==ma;){if(2048&(s=ma).flags)switch(s.tag){case 0:case 11:case 15:Ca(9,s,s.return)}var y=s.sibling;if(null!==y){y.return=s.return,ma=y;break e}ma=s.return}}var b=e.current;for(ma=b;null!==ma;){var C=(o=ma).child;if(2064&o.subtreeFlags&&null!==C)C.return=o,ma=C;else e:for(o=b;null!==ma;){if(2048&(l=ma).flags)try{switch(l.tag){case 0:case 11:case 15:xa(9,l)}}catch(e){$s(l,l.return,e)}if(l===o){ma=null;break e}var x=l.sibling;if(null!==x){x.return=l.return,ma=x;break e}ma=l.return}}if(ns=r,Kt(),Qt&&"function"==typeof Qt.onPostCommitFiberRoot)try{Qt.onPostCommitFiberRoot(Wt,e)}catch(e){}i=!0}return i}finally{Tt=n,ts.transition=t}}return!1}function Js(e,t,n){e=$n(e,t=Pr(0,t=Ar(n,t),1),1),t=Rs(),null!==e&&(Mt(e,1,t),Ts(e,t))}function $s(e,t,n){if(3===e.tag)Js(e,e,n);else for(;null!==t;){if(3===t.tag){Js(t,e,n);break}if(1===t.tag){var i=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof i.componentDidCatch&&(null===_s||!_s.has(i))){t=$n(t,e=Dr(t,e=Ar(n,e),1),1),e=Rs(),null!==t&&(Mt(t,1,e),Ts(t,e));break}}t=t.return}}function eo(e,t,n){var i=e.pingCache;null!==i&&i.delete(t),t=Rs(),e.pingedLanes|=e.suspendedLanes&n,is===e&&(as&n)===n&&(4===ls||3===ls&&(130023424&as)===as&&500>Nt()-ps?Vs(e,0):cs|=n),Ts(e,t)}function to(e,t){0===t&&(1&e.mode?(t=At,!(130023424&(At<<=1))&&(At=4194304)):t=1);var n=Rs();null!==(e=qn(e,t))&&(Mt(e,t,n),Ts(e,n))}function no(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),to(e,n)}function io(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,r=e.memoizedState;null!==r&&(n=r.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(a(314))}null!==i&&i.delete(t),to(e,n)}function ro(e,t){return Ht(e,t)}function ao(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function so(e,t,n,i){return new ao(e,t,n,i)}function oo(e){return!(!(e=e.prototype)||!e.isReactComponent)}function lo(e,t){var n=e.alternate;return null===n?((n=so(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ho(e,t,n,i,r,s){var o=2;if(i=e,"function"==typeof e)oo(e)&&(o=1);else if("string"==typeof e)o=5;else e:switch(e){case h:return uo(n.children,r,s,t);case u:o=8,r|=8;break;case d:return(e=so(12,n,t,2|r)).elementType=d,e.lanes=s,e;case p:return(e=so(13,n,t,r)).elementType=p,e.lanes=s,e;case m:return(e=so(19,n,t,r)).elementType=m,e.lanes=s,e;case b:return co(n,r,s,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case c:o=10;break e;case f:o=9;break e;case g:o=11;break e;case v:o=14;break e;case y:o=16,i=null;break e}throw Error(a(130,null==e?e:typeof e,""))}return(t=so(o,n,t,r)).elementType=e,t.type=i,t.lanes=s,t}function uo(e,t,n,i){return(e=so(7,e,i,t)).lanes=n,e}function co(e,t,n,i){return(e=so(22,e,i,t)).elementType=b,e.lanes=n,e.stateNode={isHidden:!1},e}function fo(e,t,n){return(e=so(6,e,null,t)).lanes=n,e}function go(e,t,n){return(t=so(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function po(e,t,n,i,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Q,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rt(0),this.expirationTimes=Rt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.identifierPrefix=i,this.onRecoverableError=r,Z&&(this.mutableSourceEagerHydrationData=null)}function mo(e,t,n,i,r,a,s,o,l){return e=new po(e,t,n,o,l),1===t?(t=1,!0===a&&(t|=8)):t=0,a=so(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xn(a),e}function vo(e){if(!e)return ht;e:{if(A(e=e._reactInternals)!==e||1!==e.tag)throw Error(a(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(gt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(a(171))}if(1===e.tag){var n=e.type;if(gt(n))return vt(e,n,t)}return t}function yo(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw e=Object.keys(e).join(","),Error(a(268,e))}return null===(e=E(t))?null:e.stateNode}function bo(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Co(e,t){bo(e,t),(e=e.alternate)&&bo(e,t)}function xo(e){return null===(e=E(e))?null:e.stateNode}function _o(){return null}return bs=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||dt.current)Lr=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return Lr=!1,function(e,t,n){switch(t.tag){case 3:Wr(t),An();break;case 5:fi(t);break;case 1:gt(t.type)&&yt(t);break;case 4:di(t,t.stateNode.containerInfo);break;case 10:zn(0,t.type._context,t.memoizedProps.value);break;case 13:var i=t.memoizedState;if(null!==i)return null!==i.dehydrated?(lt(pi,1&pi.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Jr(e,t,n):(lt(pi,1&pi.current),null!==(e=aa(e,t,n))?e.sibling:null);lt(pi,1&pi.current);break;case 19:if(i=0!==(n&t.childLanes),128&e.flags){if(i)return ia(e,t,n);t.flags|=128}var r=t.memoizedState;if(null!==r&&(r.rendering=null,r.tail=null,r.lastEffect=null),lt(pi,pi.current),i)break;return null;case 22:case 23:return t.lanes=0,Nr(e,t,n)}return aa(e,t,n)}(e,t,n);Lr=!!(131072&e.flags)}else Lr=!1,gn&&1048576&t.flags&&hn(t,tn,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ra(e,t),e=t.pendingProps;var r=ft(t,ut.current);Un(t,n),r=Mi(null,t,i,e,r,n);var s=Ii();return t.flags|=1,"object"==typeof r&&null!==r&&"function"==typeof r.render&&void 0===r.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,gt(i)?(s=!0,yt(t)):s=!1,t.memoizedState=null!==r.state&&void 0!==r.state?r.state:null,Xn(t),r.updater=br,t.stateNode=r,r._reactInternals=t,Sr(t,i,e,n),t=Ur(null,t,i,!0,s,n)):(t.tag=0,gn&&s&&un(t),Hr(null,t,r,n),t=t.child),t;case 16:i=t.elementType;e:{switch(ra(e,t),e=t.pendingProps,i=(r=i._init)(i._payload),t.type=i,r=t.tag=function(e){if("function"==typeof e)return oo(e)?1:0;if(null!=e){if((e=e.$$typeof)===g)return 11;if(e===v)return 14}return 2}(i),e=vr(i,e),r){case 0:t=Vr(null,t,i,e,n);break e;case 1:t=Gr(null,t,i,e,n);break e;case 11:t=Or(null,t,i,e,n);break e;case 14:t=Br(null,t,i,vr(i.type,e),n);break e}throw Error(a(306,i,""))}return t;case 0:return i=t.type,r=t.pendingProps,Vr(e,t,i,r=t.elementType===i?r:vr(i,r),n);case 1:return i=t.type,r=t.pendingProps,Gr(e,t,i,r=t.elementType===i?r:vr(i,r),n);case 3:e:{if(Wr(t),null===e)throw Error(a(387));i=t.pendingProps,r=(s=t.memoizedState).element,Kn(e,t),ni(t,i,null,n);var o=t.memoizedState;if(i=o.element,Z&&s.isDehydrated){if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,256&t.flags){t=Qr(e,t,i,n,r=Ar(Error(a(423)),t));break e}if(i!==r){t=Qr(e,t,i,n,r=Ar(Error(a(424)),t));break e}for(Z&&(fn=Ve(t.stateNode.containerInfo),cn=t,gn=!0,mn=null,pn=!1),n=Ln(t,null,i,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(An(),i===r){t=aa(e,t,n);break e}Hr(e,t,i,n)}t=t.child}return t;case 5:return fi(t),null===e&&Cn(t),i=t.type,r=t.pendingProps,s=null!==e?e.memoizedProps:null,o=r.children,V(i,r)?o=null:null!==s&&V(i,s)&&(t.flags|=32),zr(e,t),Hr(e,t,o,n),t.child;case 6:return null===e&&Cn(t),null;case 13:return Jr(e,t,n);case 4:return di(t,t.stateNode.containerInfo),i=t.pendingProps,null===e?t.child=Tn(t,null,i,n):Hr(e,t,i,n),t.child;case 11:return i=t.type,r=t.pendingProps,Or(e,t,i,r=t.elementType===i?r:vr(i,r),n);case 7:return Hr(e,t,t.pendingProps,n),t.child;case 8:case 12:return Hr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(i=t.type._context,r=t.pendingProps,s=t.memoizedProps,zn(0,i,o=r.value),null!==s)if(jt(s.value,o)){if(s.children===r.children&&!dt.current){t=aa(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var l=s.dependencies;if(null!==l){o=s.child;for(var h=l.firstContext;null!==h;){if(h.context===i){if(1===s.tag){(h=Jn(-1,n&-n)).tag=2;var u=s.updateQueue;if(null!==u){var d=(u=u.shared).pending;null===d?h.next=h:(h.next=d.next,d.next=h),u.pending=h}}s.lanes|=n,null!==(h=s.alternate)&&(h.lanes|=n),Gn(s.return,n,t),l.lanes|=n;break}h=h.next}}else if(10===s.tag)o=s.type===t.type?null:s.child;else if(18===s.tag){if(null===(o=s.return))throw Error(a(341));o.lanes|=n,null!==(l=o.alternate)&&(l.lanes|=n),Gn(o,n,t),o=s.sibling}else o=s.child;if(null!==o)o.return=s;else for(o=s;null!==o;){if(o===t){o=null;break}if(null!==(s=o.sibling)){s.return=o.return,o=s;break}o=o.return}s=o}Hr(e,t,r.children,n),t=t.child}return t;case 9:return r=t.type,i=t.pendingProps.children,Un(t,n),i=i(r=Wn(r)),t.flags|=1,Hr(e,t,i,n),t.child;case 14:return r=vr(i=t.type,t.pendingProps),Br(e,t,i,r=vr(i.type,r),n);case 15:return Fr(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,r=t.pendingProps,r=t.elementType===i?r:vr(i,r),ra(e,t),t.tag=1,gt(i)?(e=!0,yt(t)):e=!1,Un(t,n),xr(t,i,r),Sr(t,i,r,n),Ur(null,t,i,!0,e,n);case 19:return ia(e,t,n);case 22:return Nr(e,t,n)}throw Error(a(156,t.tag))},t.attemptContinuousHydration=function(e){if(13===e.tag){var t=qn(e,134217728);null!==t&&Is(t,e,134217728,Rs()),Co(e,134217728)}},t.attemptDiscreteHydration=function(e){if(13===e.tag){var t=qn(e,1);null!==t&&Is(t,e,1,Rs()),Co(e,1)}},t.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var t=Ms(e),n=qn(e,t);null!==n&&Is(n,e,t,Rs()),Co(e,t)}},t.attemptSynchronousHydration=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=wt(t.pendingLanes);0!==n&&(It(t,1|n),Ts(t,Nt()),!(6&ns)&&(ys(),Kt()))}break;case 13:Ns(function(){var t=qn(e,1);if(null!==t){var n=Rs();Is(t,e,1,n)}}),Co(e,1)}},t.batchedUpdates=function(e,t){var n=ns;ns|=1;try{return e(t)}finally{0===(ns=n)&&(ys(),qt&&Kt())}},t.createComponentSelector=function(e){return{$$typeof:Va,value:e}},t.createContainer=function(e,t,n,i,r,a,s){return mo(e,t,!1,null,0,i,0,a,s)},t.createHasPseudoClassSelector=function(e){return{$$typeof:Ga,value:e}},t.createHydrationContainer=function(e,t,n,i,r,a,s,o,l){return(e=mo(n,i,!0,e,0,a,0,o,l)).context=vo(null),n=e.current,(a=Jn(i=Rs(),r=Ms(n))).callback=null!=t?t:null,$n(n,a,r),e.current.lanes=r,Mt(e,r,i),Ts(e,i),e},t.createPortal=function(e,t,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:l,key:null==i?null:""+i,children:e,containerInfo:t,implementation:n}},t.createRoleSelector=function(e){return{$$typeof:Ua,value:e}},t.createTestNameSelector=function(e){return{$$typeof:Wa,value:e}},t.createTextSelector=function(e){return{$$typeof:Qa,value:e}},t.deferredUpdates=function(e){var t=Tt,n=ts.transition;try{return ts.transition=null,Tt=16,e()}finally{Tt=t,ts.transition=n}},t.discreteUpdates=function(e,t,n,i,r){var a=Tt,s=ts.transition;try{return ts.transition=null,Tt=1,e(t,n,i,r)}finally{Tt=a,ts.transition=s,0===ns&&ys()}},t.findAllNodes=Ka,t.findBoundingRects=function(e,t){if(!ne)throw Error(a(363));t=Ka(e,t),e=[];for(var n=0;n<t.length;n++)e.push(re(t[n]));for(t=e.length-1;0<t;t--)for(var i=(n=e[t]).x,r=i+n.width,s=n.y,o=s+n.height,l=t-1;0<=l;l--)if(t!==l){var h=e[l],u=h.x,d=u+h.width,c=h.y,f=c+h.height;if(i>=u&&s>=c&&r<=d&&o<=f){e.splice(t,1);break}if(!(i!==u||n.width!==h.width||f<s||c>o)){c>s&&(h.height+=c-s,h.y=s),f<o&&(h.height=o-c),e.splice(t,1);break}if(!(s!==c||n.height!==h.height||d<i||u>r)){u>i&&(h.width+=u-i,h.x=i),d<r&&(h.width=r-u),e.splice(t,1);break}}return e},t.findHostInstance=yo,t.findHostInstanceWithNoPortals=function(e){return null===(e=null!==(e=k(e))?D(e):null)?null:e.stateNode},t.findHostInstanceWithWarning=function(e){return yo(e)},t.flushControlled=function(e){var t=ns;ns|=1;var n=ts.transition,i=Tt;try{ts.transition=null,Tt=1,e()}finally{Tt=i,ts.transition=n,0===(ns=t)&&(ys(),Kt())}},t.flushPassiveEffects=Ks,t.flushSync=Ns,t.focusWithin=function(e,t){if(!ne)throw Error(a(363));for(t=Xa(e=Ya(e),t),t=Array.from(t),e=0;e<t.length;){var n=t[e++];if(!se(n)){if(5===n.tag&&le(n.stateNode))return!0;for(n=n.child;null!==n;)t.push(n),n=n.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Tt},t.getFindAllNodesFailureDescription=function(e,t){if(!ne)throw Error(a(363));var n=0,i=[];e=[Ya(e),0];for(var r=0;r<e.length;){var s=e[r++],o=e[r++],l=t[o];if((5!==s.tag||!se(s))&&(qa(s,l)&&(i.push(Za(l)),++o>n&&(n=o)),o<t.length))for(s=s.child;null!==s;)e.push(s,o),s=s.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(Za(t[n]));return"findAllNodes was able to match part of the selector:\n "+i.join(" > ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},t.getPublicRootInstance=function(e){return(e=e.current).child?5===e.child.tag?I(e.child.stateNode):e.child.stateNode:null},t.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:s.ReactCurrentDispatcher,findHostInstanceByFiber:xo,findFiberByHostInstance:e.findFiberByHostInstance||_o,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{Wt=t.inject(e),Qt=t}catch(e){}e=!!t.checkDCE}}return e},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(e,t,n,i){if(!ne)throw Error(a(363));e=Ka(e,t);var r=he(e,n,i).disconnect;return{disconnect:function(){r()}}},t.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},t.runWithPriority=function(e,t){var n=Tt;try{return Tt=e,t()}finally{Tt=n}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(e,t,n,i){var r=t.current,a=Rs(),s=Ms(r);return n=vo(n),null===t.context?t.context=n:t.pendingContext=n,(t=Jn(a,s)).payload={element:e},null!==(i=void 0===i?null:i)&&(t.callback=i),null!==(e=$n(r,t,s))&&(Is(e,r,s,a),ei(e,r,s)),s},t};var hi=ai.exports,ui={exports:{}};ui.exports={ConcurrentRoot:1,ContinuousEventPriority:4,DefaultEventPriority:16,DiscreteEventPriority:1,IdleEventPriority:536870912,LegacyRoot:0};const di={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let ci=!1,fi=!1;const gi=".react-konva-event",pi={};function mi(e,t,n=pi){if(!ci&&"zIndex"in t&&(console.warn('ReactKonva: You are using "zIndex" attribute for a Konva node.\nreact-konva may get confused with ordering. Just define correct order of elements in your render function of a component.\nFor more info see: https://github.com/konvajs/react-konva/issues/194\n'),ci=!0),!fi&&t.draggable){var i=void 0!==t.x||void 0!==t.y,r=t.onDragEnd||t.onDragMove;i&&!r&&(console.warn("ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.\nPosition of a node will be changed during drag&drop, so you should update state of the react app as well.\nConsider to add onDragMove or onDragEnd events.\nFor more info see: https://github.com/konvajs/react-konva/issues/256\n"),fi=!0)}for(var a in n)if(!di[a]){var s="on"===a.slice(0,2),o=n[a]!==t[a];s&&o&&("content"===(f=a.substr(2).toLowerCase()).substr(0,7)&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),e.off(f,n[a])),!t.hasOwnProperty(a)&&e.setAttr(a,void 0)}var l=t._useStrictMode,h={},u=!1;const d={};for(var a in t)if(!di[a]){s="on"===a.slice(0,2);var c=n[a]!==t[a];s&&c&&("content"===(f=a.substr(2).toLowerCase()).substr(0,7)&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),t[a]&&(d[f]=t[a])),!s&&(t[a]!==n[a]||l&&t[a]!==e.getAttr(a))&&(u=!0,h[a]=t[a])}for(var f in u&&(e.setAttrs(h),vi(e)),d)e.on(f+gi,d[f])}function vi(e){if(!ie.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const yi={},bi={};tn.Node.prototype._applyProps=mi;const Ci=setTimeout,xi=clearTimeout;function _i(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),vi(e)}var Si=Object.freeze({__proto__:null,appendInitialChild:function(e,t){"string"!=typeof t?(e.add(t),vi(e)):console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`)},createInstance:function(e,t,n){let i=tn[e];i||(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`),i=tn.Group);const r={},a={};for(var s in t)"on"===s.slice(0,2)?a[s]=t[s]:r[s]=t[s];const o=new i(r);return mi(o,a),o},createTextInstance:function(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)},finalizeInitialChildren:function(e,t,n){return!1},getPublicInstance:function(e){return e},prepareForCommit:function(){return null},preparePortalMount:function(){return null},prepareUpdate:function(e,t,n,i){return bi},resetAfterCommit:function(){},resetTextContent:function(e){},shouldDeprioritizeSubtree:function(e,t){return!1},getRootHostContext:function(){return yi},getChildHostContext:function(){return yi},scheduleTimeout:Ci,cancelTimeout:xi,noTimeout:-1,shouldSetTextContent:function(e,t){return!1},isPrimaryRenderer:!1,warnsIfNotActing:!0,supportsMutation:!0,appendChild:function(e,t){t.parent===e?t.moveToTop():e.add(t),vi(e)},appendChildToContainer:function(e,t){t.parent===e?t.moveToTop():e.add(t),vi(e)},insertBefore:_i,insertInContainerBefore:function(e,t,n){_i(e,t,n)},removeChild:function(e,t){t.destroy(),t.off(gi),vi(e)},removeChildFromContainer:function(e,t){t.destroy(),t.off(gi),vi(e)},commitTextUpdate:function(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)},commitMount:function(e,t,n){},commitUpdate:function(e,t,n,i,r){mi(e,r,i)},hideInstance:function(e){e.hide(),vi(e)},hideTextInstance:function(e){},unhideInstance:function(e,t){(null==t.visible||t.visible)&&e.show()},unhideTextInstance:function(e,t){},clearContainer:function(e){},detachDeletedInstance:function(){},getCurrentEventPriority:()=>ui.exports.DefaultEventPriority,now:si.exports.unstable_now,idlePriority:si.exports.unstable_IdlePriority,run:si.exports.unstable_runWithPriority});const Ai=t;var wi,ki,Ei=Object.defineProperty,Pi=Object.defineProperties,Di=Object.getOwnPropertyDescriptors,Ri=Object.getOwnPropertySymbols,Mi=Object.prototype.hasOwnProperty,Ii=Object.prototype.propertyIsEnumerable,Ti=(e,t,n)=>t in e?Ei(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Li=(e,t)=>{for(var n in t||(t={}))Mi.call(t,n)&&Ti(e,n,t[n]);if(Ri)for(var n of Ri(t))Ii.call(t,n)&&Ti(e,n,t[n]);return e};const Hi="undefined"==typeof window||!(null==(wi=window.document)?void 0:wi.createElement)&&"ReactNative"!==(null==(ki=window.navigator)?void 0:ki.product)?Ai.useEffect:Ai.useLayoutEffect;function Oi(e,t,n){if(!e)return;if(!0===n(e))return e;let i=t?e.return:e.child;for(;i;){const e=Oi(i,t,n);if(e)return e;i=t?null:i.sibling}}function Bi(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}const Fi=console.error;console.error=function(){const e=[...arguments].join("");if(!(null==e?void 0:e.startsWith("Warning:"))||!e.includes("useContext"))return Fi.apply(this,arguments);console.error=Fi};const Ni=Bi(Ai.createContext(null));class zi extends Ai.Component{render(){return Ai.createElement(Ni.Provider,{value:this._reactInternals},this.props.children)}}function Vi(){const e=Ai.useContext(Ni);if(null===e)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const t=Ai.useId();return Ai.useMemo(()=>{for(const n of[e,null==e?void 0:e.alternate]){if(!n)continue;const e=Oi(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}function Gi(){const e=Vi(),[t]=Ai.useState(()=>new Map);t.clear();let n=e;for(;n;){if(n.type&&"object"==typeof n.type){const e=void 0===n.type._context&&n.type.Provider===n.type?n.type:n.type._context;e&&e!==Ni&&!t.has(e)&&t.set(e,Ai.useContext(Bi(e)))}n=n.return}return t}function Ui(){const e=Gi();return Ai.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>i=>{return Ai.createElement(t,null,Ai.createElement(n.Provider,(r=Li({},i),a={value:e.get(n)},Pi(r,Di(a)))));var r,a},e=>Ai.createElement(zi,Li({},e))),[e])}var Wi=Object.freeze({__proto__:null,FiberProvider:zi,traverseFiber:Oi,useContainer:function(){const e=Vi(),t=Ai.useMemo(()=>Oi(e,!0,e=>{var t;return null!=(null==(t=e.stateNode)?void 0:t.containerInfo)}),[e]);return null==t?void 0:t.stateNode.containerInfo},useContextBridge:Ui,useContextMap:Gi,useFiber:Vi,useNearestChild:function(e){const t=Vi(),n=Ai.useRef();return Hi(()=>{var i;n.current=null==(i=Oi(t,!1,t=>"string"==typeof t.type&&(void 0===e||t.type===e)))?void 0:i.stateNode},[t]),n},useNearestParent:function(e){const t=Vi(),n=Ai.useRef();return Hi(()=>{var i;n.current=null==(i=Oi(t,!0,t=>"string"==typeof t.type&&(void 0===e||t.type===e)))?void 0:i.stateNode},[t]),n}});const Qi=t,ji=e=>{const t=Qi.useRef(null),n=Qi.useRef(null),i=Qi.useRef(null),r=function(e){const t=Qi.useRef({});return Qi.useLayoutEffect(()=>{t.current=e}),Qi.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}(e),a=Ui(),s=t=>{const{forwardedRef:n}=e;n&&("function"==typeof n?n(t):n.current=t)};return Qi.useLayoutEffect(()=>(n.current=new tn.Stage({width:e.width,height:e.height,container:t.current}),s(n.current),i.current=Ki.createContainer(n.current,ui.exports.LegacyRoot,!1,null),Ki.updateContainer(Qi.createElement(a,{},e.children),i.current),()=>{tn.isBrowser&&(s(null),Ki.updateContainer(null,i.current,null),n.current.destroy())}),[]),Qi.useLayoutEffect(()=>{s(n.current),mi(n.current,e,r),Ki.updateContainer(Qi.createElement(a,{},e.children),i.current,null)}),Qi.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})},Yi="Group",qi="Rect",Zi="Circle",Xi="Transformer",Ki=hi(Si);Ki.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:Qi.version,rendererPackageName:"react-konva"});const Ji=Qi.forwardRef((e,t)=>Qi.createElement(zi,{},Qi.createElement(ji,{...e,forwardedRef:t})));const $i=t,er=n;class tr extends $i.Component{constructor(e){super(e),tr.prototype.__init.call(this),this.state={image:null}}componentDidMount(){this.loadImage()}componentDidUpdate(e){e.src!==this.props.src&&this.loadImage()}componentWillUnmount(){this.image.removeEventListener("load",this.handleLoad)}loadImage(){const{src:e}=this.props;this.image=new window.Image,this.image.src=e,this.image.addEventListener("load",this.handleLoad)}__init(){this.handleLoad=()=>{this.setState({image:this.image})}}render(){const{x:e,y:t}=this.props,{image:n}=this.state;return $i.createElement("Image",{width:20,height:20,x:e,y:t,image:n})}}tr.propTypes={src:er.string.isRequired,x:er.number.isRequired,y:er.number.isRequired};const{cloneDeep:nr}=a,ir=(e,t,n,i)=>{if(n){const n=e.width/e.height;return"height"===i?{width:t.height*n,height:t.height}:{width:t.width,height:t.width/n}}return{width:t.width,height:t.height}},rr=(e,t,n)=>t/e*n,ar=(e,t,n)=>n.map(n=>n.group===ee?((e,t,n)=>({...n,width:rr(e.width,t.width,n.width),height:rr(e.height,t.height,n.height),x:rr(e.width,t.width,n.x),y:rr(e.height,t.height,n.y)}))(e,t,n):n.group===$?((e,t,n)=>({...n,points:n.points.map(n=>({x:rr(e.width,t.width,n.x),y:rr(e.height,t.height,n.y)}))}))(e,t,n):n.group===J?((e,t,n)=>({...n,radius:rr(e.width,t.width,n.radius),x:rr(e.width,t.width,n.x),y:rr(e.height,t.height,n.y)}))(e,t,n):void 0),sr=e=>{e=e||{};const t=[],n=Object.keys(e);return n.length?n.reduce((t,n)=>t.concat(e[n]?e[n].map((e,i)=>({...e,group:n,index:e.index||t.length+i})):[]),t):t},or=e=>{const t={rectangles:[],polygons:[],circles:[]};return(e=e||[]).length?e.reduce((e,{group:t,...n})=>(e[t]=[...e[t]||[],n],e),t):nr(t)},lr=(e,t,n)=>{let i=!1;if(!e||e.length<=0)return i;for(let r=0,a=e.length-1;r<e.length;a=r++){const s=e[r].x,o=e[r].y,l=e[a].x,h=e[a].y;o>n!=h>n&&t<(l-s)*(n-o)/(h-o)+s&&(i=!i)}return i},hr=t,ur=n,dr=({height:e,id:t,width:n,x:i,y:r,points:a,isCircle:s,radius:o,handleWidgetClick:l})=>{let h,u;if(s)h=i+o-20,u=r;else if(a){const e=(e=>{if(!e||e.length<=0)return{x:0,y:0};const t=e.map(e=>e.x),n=e.map(e=>e.y),i=Math.min(...t),r=Math.min(...n),a=Math.max(...t),s=Math.max(...n);let o,l;for(let t=i;t<=a-20;t++)for(let n=s-20;n>r;n--)if(lr(e,t,n)){o=t-10,l=n;break}return{x:o,y:l}})(a);h=e.x,u=e.y}else h=i+n-20,u=r+e-20;return hr.createElement(Yi,{onClick:()=>l(t)},hr.createElement(tr,{x:h,y:u,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7N15YFxV3T7w53tnss4kbdMFBGSxIEsRwTQJpQXSpC1UQRCNG4KyCSgq6Ov6e31BXEEFRUE2N3Av8qLAW9smacCWNkkjiCyKZSmLQLekycwkmcy9398fLdAlSZPJvXPu8nz+sk3mzGPJ5Dz33HPvFRCRr2l1dVGmqnS6IjsDtjVDLWeyBWuyOjoFkMlq6WQBJik0IWqVKzQhgmIBJqkiDsGkXQdEEkDRbm8zBEFqt+/rEYGtwDZVZAWSVnEyAkmLgx4V7QGkR0R6HEe7RaQHjm6UeNGm8qGijdLWlvP2X4aIJkJMByCKsr7Fx023hmIHwI6/2RHnQLFwABQHALo/IDOgmA7BdNM586LYBMFGQDcB1osQfUkdvGhBN2gMLzhDzouVbV2bTcckiioWACIPaVNTbGDbhgNtWw4V1ZkqcqhCZ4riUAhmAigzndGwfkDXK+RpEV0vKutV9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FTwLwBPQKXLEXRVpK0uPkqXaHxYAIhckl44dz/V7FFQa5bCOcpSa5aKHgPekyBfgwCeFsHjDvAEHDwO1SeSJ3c+yXvrE00cCwCRhxSQ/kU1B9i2dailOlMtHCqqhypkJoCZYDnoBfCMAOtVZb1An3Ysa30sp+vL2tpf4hI+kXdYAIgM6pk3b0q81D5A1D7IEX0zVA4QwZvhYD8A+0AwHcB0AJbhqOPlANgExSYAr8LCf1TxgqV4AYIXVWIbhnL9L0xpe6THdFCiqGIBIPI5bWqKpTc9Nx3x+HR17OkQqbJUJyvk/7dj7igIQwEQnIkgxiDmSN7fm5giT8T4Iby1k+AJLDLVFgvTLtunSf/NsBcPkl2kpdrFbIUjLgZE2AHtj+aBPBedGrga3zS5EybwFXITJkmpWqwWzVi1UDPabAbmeehO58t606+s/DcfNYIj5AJ5qjIAAAAASUVORK5CYII="}))};dr.propTypes={id:ur.string.isRequired,height:ur.number,width:ur.number,x:ur.number.isRequired,y:ur.number.isRequired,handleWidgetClick:ur.func.isRequired,radius:ur.number,isCircle:ur.bool,points:ur.arrayOf(ur.shape({x:ur.number,y:ur.number}))};const cr=t,fr=n;class gr extends cr.Component{constructor(e){super(e),gr.prototype.__init.call(this),gr.prototype.__init2.call(this),gr.prototype.__init3.call(this),gr.prototype.__init4.call(this),gr.prototype.__init5.call(this),gr.prototype.__init6.call(this),this.state={hovered:!1,isDragging:!1},this.shapeRef=cr.createRef(),this.trRef=cr.createRef()}__init(){this.handleClick=e=>{const{width:t,height:n,isDrawing:i,onClick:r,id:a}=this.props;t<0&&n<0&&i||(e.cancelBubble=!0,r(a))}}__init2(){this.handleMouseEnter=()=>{document.body.style.cursor="pointer",this.setState({hovered:!0}),this.trRef.current.setNode(this.shapeRef.current),this.trRef.current.getLayer().batchDraw()}}__init3(){this.handleMouseLeave=()=>{this.setState({hovered:!1}),document.body.style.cursor="default"}}__init4(){this.handleOnDragEnd=e=>{const{onDragEnd:t,id:n}=this.props;this.setState({isDragging:!1}),t(n,{x:e.target.x(),y:e.target.y()})}}__init5(){this.onResizeEnd=()=>{const{onDragEnd:e,id:t}=this.props,n=this.shapeRef.current,i=n.scaleX(),r=n.scaleY();n.scaleX(1),n.scaleY(1),this.setState({isDragging:!1}),e(t,{x:n.x(),y:n.y(),width:Math.max(5,n.width()*i),height:Math.max(n.height()*r)})}}__init6(){this.handleDelete=e=>{const{onDeleteShape:t}=this.props;t(e)}}render(){const{correct:e,height:t,hotspotColor:n,id:i,outlineColor:r,width:a,x:s,y:o,strokeWidth:l=5,selectedHotspotColor:h,hoverOutlineColor:u}=this.props,{hovered:d}=this.state;return cr.createElement(Yi,{onMouseLeave:this.handleMouseLeave,onMouseEnter:this.handleMouseEnter,padding:12},u&&d&&cr.createElement(qi,{x:s,y:o,width:a,height:t,stroke:u,strokeWidth:2,listening:!1}),cr.createElement(qi,{ref:this.shapeRef,width:a,height:t,fill:e&&h?h:n,onClick:this.handleClick,onTap:this.handleClick,draggable:!0,stroke:d?"transparent":r,strokeWidth:e&&!d?l:0,onDragStart:()=>this.setState({isDragging:!0}),onDragEnd:this.handleOnDragEnd,onTransformStart:()=>this.setState({isDragging:!0}),onTransformEnd:this.onResizeEnd,x:s,y:o,opacity:.5,cursor:"pointer"}),!this.state.isDragging&&this.state.hovered&&cr.createElement(dr,{id:i,height:t,width:a,x:s,y:o,handleWidgetClick:this.handleDelete}),this.state.hovered&&cr.createElement(Xi,{ref:this.trRef,rotateEnabled:!1,boundBoxFunc:(e,t)=>t.width<10||t.height<10?e:t}))}}gr.propTypes={correct:fr.bool,isDrawing:fr.bool.isRequired,id:fr.string.isRequired,height:fr.number.isRequired,hotspotColor:fr.string.isRequired,selectedHotspotColor:fr.string,hoverOutlineColor:fr.string,onClick:fr.func.isRequired,onDeleteShape:fr.func.isRequired,onDragEnd:fr.func.isRequired,outlineColor:fr.string.isRequired,width:fr.number.isRequired,x:fr.number.isRequired,y:fr.number.isRequired,strokeWidth:fr.number},gr.defaultProps={correct:!1};var pr={},mr=c(ri),vr={},yr={},br=c(ae);!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EVENTS_NAMESPACE=void 0,e.toggleStrictMode=function(e){a=e},e.applyNodeProps=function(t,u,d=l){if(!i&&"zIndex"in u&&(console.warn(o),i=!0),!r&&u.draggable){var c=void 0!==u.x||void 0!==u.y,f=u.onDragEnd||u.onDragMove;c&&!f&&(console.warn(s),r=!0)}for(var g in d)if(!n[g]){var p="on"===g.slice(0,2),m=d[g]!==u[g];p&&m&&("content"===(_=g.substr(2).toLowerCase()).substr(0,7)&&(_="content"+_.substr(7,1).toUpperCase()+_.substr(8)),t.off(_,d[g])),!u.hasOwnProperty(g)&&t.setAttr(g,void 0)}var v=a||u._useStrictMode,y={},b=!1;const C={};for(var g in u)if(!n[g]){p="on"===g.slice(0,2);var x=d[g]!==u[g];p&&x&&("content"===(_=g.substr(2).toLowerCase()).substr(0,7)&&(_="content"+_.substr(7,1).toUpperCase()+_.substr(8)),u[g]&&(C[_]=u[g])),!p&&(u[g]!==d[g]||v&&u[g]!==t.getAttr(g))&&(b=!0,y[g]=u[g])}for(var _ in b&&(t.setAttrs(y),h(t)),C)t.on(_+e.EVENTS_NAMESPACE,C[_])},e.updatePicture=h;const t=br,n={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let i=!1,r=!1;e.EVENTS_NAMESPACE=".react-konva-event";let a=!1;const s="ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.\nPosition of a node will be changed during drag&drop, so you should update state of the react app as well.\nConsider to add onDragMove or onDragEnd events.\nFor more info see: https://github.com/konvajs/react-konva/issues/256\n",o='ReactKonva: You are using "zIndex" attribute for a Konva node.\nreact-konva may get confused with ordering. Just define correct order of elements in your render function of a component.\nFor more info see: https://github.com/konvajs/react-konva/issues/194\n',l={};function h(e){if(!t.Konva.autoDrawEnabled){var n=e.getLayer()||e.getStage();n&&n.batchDraw()}}}(yr),d(yr),function(e){var t=u&&u.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.getCurrentEventPriority=e.supportsMutation=e.warnsIfNotActing=e.isPrimaryRenderer=e.noTimeout=e.cancelTimeout=e.scheduleTimeout=e.run=e.idlePriority=e.now=void 0,e.appendInitialChild=function(e,t){"string"!=typeof t?(e.add(t),(0,i.updatePicture)(e)):console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`)},e.createInstance=function(e,t,r){let a=n.default[e];a||(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`),a=n.default.Group);const s={},o={};for(var l in t)"on"===l.slice(0,2)?o[l]=t[l]:s[l]=t[l];const h=new a(s);return(0,i.applyNodeProps)(h,o),h},e.createTextInstance=function(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)},e.finalizeInitialChildren=function(e,t,n){return!1},e.getPublicInstance=function(e){return e},e.prepareForCommit=function(){return null},e.preparePortalMount=function(){return null},e.prepareUpdate=function(e,t,n,i){return o},e.resetAfterCommit=function(){},e.resetTextContent=function(e){},e.shouldDeprioritizeSubtree=function(e,t){return!1},e.getRootHostContext=function(){return s},e.getChildHostContext=function(){return s},e.shouldSetTextContent=function(e,t){return!1},e.appendChild=function(e,t){t.parent===e?t.moveToTop():e.add(t),(0,i.updatePicture)(e)},e.appendChildToContainer=function(e,t){t.parent===e?t.moveToTop():e.add(t),(0,i.updatePicture)(e)},e.insertBefore=l,e.insertInContainerBefore=function(e,t,n){l(e,t,n)},e.removeChild=function(e,t){t.destroy(),t.off(i.EVENTS_NAMESPACE),(0,i.updatePicture)(e)},e.removeChildFromContainer=function(e,t){t.destroy(),t.off(i.EVENTS_NAMESPACE),(0,i.updatePicture)(e)},e.commitTextUpdate=function(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)},e.commitMount=function(e,t,n){},e.commitUpdate=function(e,t,n,r,a){(0,i.applyNodeProps)(e,a,r)},e.hideInstance=function(e){e.hide(),(0,i.updatePicture)(e)},e.hideTextInstance=function(e){},e.unhideInstance=function(e,t){(null==t.visible||t.visible)&&e.show()},e.unhideTextInstance=function(e,t){},e.clearContainer=function(e){},e.detachDeletedInstance=function(){};const n=t(mr),i=yr;var r=si.exports;Object.defineProperty(e,"now",{enumerable:!0,get:function(){return r.unstable_now}}),Object.defineProperty(e,"idlePriority",{enumerable:!0,get:function(){return r.unstable_IdlePriority}}),Object.defineProperty(e,"run",{enumerable:!0,get:function(){return r.unstable_runWithPriority}});const a=ui.exports,s={},o={};function l(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),(0,i.updatePicture)(e)}n.default.Node.prototype._applyProps=i.applyNodeProps,e.scheduleTimeout=setTimeout,e.cancelTimeout=clearTimeout,e.noTimeout=-1,e.isPrimaryRenderer=!1,e.warnsIfNotActing=!0,e.supportsMutation=!0,e.getCurrentEventPriority=()=>a.DefaultEventPriority}(vr),d(vr);var Cr=c(Wi);const xr=t;!function(e){var t,n=u&&u.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),i=u&&u.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=u&&u.__importStar||(t=function(e){return t=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},t(e)},function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var a=t(e),s=0;s<a.length;s++)"default"!==a[s]&&n(r,e,a[s]);return i(r,e),r}),a=u&&u.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.useContextBridge=e.useStrictMode=e.Stage=e.KonvaRenderer=e.version=e.Transformer=e.Shape=e.Arrow=e.RegularPolygon=e.Path=e.Tag=e.Arc=e.Ring=e.Star=e.TextPath=e.Text=e.Image=e.Sprite=e.Line=e.Wedge=e.Ellipse=e.Circle=e.Rect=e.Label=e.Group=e.FastLayer=e.Layer=void 0;const s=a(xr),o=a(mr),l=a(ai.exports),h=ui.exports,d=r(vr),c=yr,f=Cr;Object.defineProperty(e,"useContextBridge",{enumerable:!0,get:function(){return f.useContextBridge}});const g=t=>{const n=s.default.useRef(null),i=s.default.useRef(null),r=s.default.useRef(null),a=function(e){const t=s.default.useRef({});return s.default.useLayoutEffect(()=>{t.current=e}),s.default.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}(t),l=(0,f.useContextBridge)(),u=e=>{const{forwardedRef:n}=t;n&&("function"==typeof n?n(e):n.current=e)};return s.default.useLayoutEffect(()=>(i.current=new o.default.Stage({width:t.width,height:t.height,container:n.current}),u(i.current),r.current=e.KonvaRenderer.createContainer(i.current,h.LegacyRoot,!1,null),e.KonvaRenderer.updateContainer(s.default.createElement(l,{},t.children),r.current),()=>{o.default.isBrowser&&(u(null),e.KonvaRenderer.updateContainer(null,r.current,null),i.current.destroy())}),[]),s.default.useLayoutEffect(()=>{u(i.current),(0,c.applyNodeProps)(i.current,t,a),e.KonvaRenderer.updateContainer(s.default.createElement(l,{},t.children),r.current,null)}),s.default.createElement("div",{ref:n,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})};e.Layer="Layer",e.FastLayer="FastLayer",e.Group="Group",e.Label="Label",e.Rect="Rect",e.Circle="Circle",e.Ellipse="Ellipse",e.Wedge="Wedge",e.Line="Line",e.Sprite="Sprite",e.Image="Image",e.Text="Text",e.TextPath="TextPath",e.Star="Star",e.Ring="Ring",e.Arc="Arc",e.Tag="Tag",e.Path="Path",e.RegularPolygon="RegularPolygon",e.Arrow="Arrow",e.Shape="Shape",e.Transformer="Transformer",e.version="18.2.13",e.KonvaRenderer=(0,l.default)(d),e.KonvaRenderer.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:s.default.version,rendererPackageName:"react-konva"}),e.Stage=s.default.forwardRef((e,t)=>s.default.createElement(f.FiberProvider,{},s.default.createElement(g,{...e,forwardedRef:t}))),e.useStrictMode=c.toggleStrictMode}(pr),d(pr);const _r=t,Sr=n,Ar="#00BFFF";class wr extends _r.Component{constructor(...e){super(...e),wr.prototype.__init.call(this),wr.prototype.__init2.call(this),wr.prototype.__init3.call(this),wr.prototype.__init4.call(this),wr.prototype.__init5.call(this),wr.prototype.__init6.call(this),wr.prototype.__init7.call(this),wr.prototype.__init8.call(this),wr.prototype.__init9.call(this),wr.prototype.__init10.call(this),wr.prototype.__init11.call(this)}static getDerivedStateFromProps(e,t){const{id:n,points:i,imageHeight:r,imageWidth:a}=e;if(t.imageHeight!==r||t.imageWidth!==a||t.id!==e.id||JSON.stringify(t.points)!==JSON.stringify(i)){const e=i.map(e=>e.x),t=i.map(e=>e.y);return{id:n,x:Math.min(...e),y:Math.max(...t),points:i,imageHeight:r,imageWidth:a}}return null}__init(){this.getOffset=e=>{const t=e.map(e=>e.x),n=e.map(e=>e.y);return{x:Math.min(...t),y:Math.max(...n)}}}__init2(){this.serialize=e=>{const{x:t,y:n}=this.getOffset(e);return e.reduce((e,i)=>[...e,i.x-t,i.y-n],[])}}__init3(){this.getInitialState=e=>{if(e.length){const{x:t,y:n}=this.getOffset(e);return{x:t,y:n,points:e}}return{id:"",x:0,y:0,points:[]}}}__init4(){this.state={hovered:!1,isDragging:!1,...this.getInitialState(this.props.points)}}__init5(){this.handleClick=e=>{const{points:t}=this.props,n=t.map(e=>e.x),i=t.map(e=>e.y),r=Math.max(...n)-Math.min(...n),a=Math.max(...i)-Math.min(...i),{isDrawing:s,onClick:o,id:l}=this.props;r<0&&a<0&&s||(s&&"newPolygon"===l?this.props.addPolygonPoint(e):(e.cancelBubble=!0,o(l)))}}__init6(){this.handleMouseEnter=()=>{this.setState({hovered:!0}),document.body.style.cursor="pointer"}}__init7(){this.handleMouseLeave=()=>{this.setState({hovered:!1}),document.body.style.cursor="default"}}__init8(){this.handleOnDragEnd=(e,t=!1)=>{const{onDragEnd:n,id:i}=this.props,r=e.target.points()||this.serialize(this.state.points),a=r.reduce((t,n,i)=>i%2==0&&i+1<r.length?[...t,{x:n+e.target.x(),y:r[i+1]+e.target.y()}]:t,[]);this.setState({points:a,...this.getOffset(a),isDragging:!t&&this.state.isDragging}),t&&n(i,{points:a})}}__init9(){this.handleOnDragVertex=(e,t,n)=>{const{onDragEnd:i,id:r}=this.props,{points:a}=this.state,s=a.map((n,i)=>i===t?{x:e.target.x(),y:e.target.y()}:n);this.setState({points:s,...this.getOffset(s),isDragging:!n&&this.state.isDragging}),n&&i(r,{points:s})}}__init10(){this.onDragStart=()=>{this.setState({isDragging:!0})}}__init11(){this.handleDelete=e=>{const{onDeleteShape:t}=this.props;t(e)}}getBoundingBox(e){const t=e.map(e=>e.x),n=e.map(e=>e.y),i=Math.min(...t),r=Math.max(...t),a=Math.min(...n);return{x:i,y:a,width:r-i,height:Math.max(...n)-a}}render(){const{correct:e,id:t,hotspotColor:n,outlineColor:i,selectedHotspotColor:r,hoverOutlineColor:a,strokeWidth:s=5}=this.props,{points:o,x:l,y:h,hovered:u}=this.state,d="newPolygon"===t,c=u||"newPolygon"===t,f=e?s:u?1:0,g=e?i:u?Ar:"",p=this.getBoundingBox(o),m=e&&r?r:n;return _r.createElement(Yi,{onMouseLeave:this.handleMouseLeave,onMouseEnter:this.handleMouseEnter},a&&u&&_r.createElement(pr.Rect,{x:p.x,y:p.y,width:p.width,height:p.height,stroke:a,strokeWidth:2,listening:!1}),_r.createElement("Line",{points:this.serialize(o),closed:!d,fill:d?"transparent":m,onClick:this.handleClick,onTap:this.handleClick,draggable:!0,stroke:d?i:g,strokeWidth:d?1:f,onDragStart:this.onDragStart,onDragMove:this.handleOnDragEnd,onDragEnd:e=>this.handleOnDragEnd(e,!0),x:l,y:h,opacity:.5}),c&&o.map((e,n)=>_r.createElement(Zi,{key:n,x:e.x,y:e.y,radius:5,fill:0===n&&"newPolygon"===t?"blue":"white",stroke:Ar,strokeWidth:1,onClick:this.handleClick,onDragStart:this.onDragStart,onDragMove:e=>{this.handleOnDragVertex(e,n)},onDragEnd:e=>{this.handleOnDragVertex(e,n,!0)},draggable:!0,opacity:4})),!this.state.isDragging&&this.state.hovered&&_r.createElement(dr,{x:l,y:h,id:t,handleWidgetClick:this.handleDelete,points:o}))}}wr.propTypes={correct:Sr.bool,isDrawing:Sr.bool.isRequired,id:Sr.string.isRequired,imageHeight:Sr.number,imageWidth:Sr.number,hotspotColor:Sr.string.isRequired,selectedHotspotColor:Sr.string,hoverOutlineColor:Sr.string,onClick:Sr.func.isRequired,addPolygonPoint:Sr.func.isRequired,onDeleteShape:Sr.func.isRequired,onDragEnd:Sr.func.isRequired,outlineColor:Sr.string.isRequired,points:Sr.arrayOf(Sr.shape({x:Sr.number,y:Sr.number})).isRequired,strokeWidth:Sr.number},wr.defaultProps={correct:!1};const kr=t,Er=n;class Pr extends kr.Component{constructor(e){super(e),Pr.prototype.__init.call(this),Pr.prototype.__init2.call(this),Pr.prototype.__init3.call(this),Pr.prototype.__init4.call(this),Pr.prototype.__init5.call(this),Pr.prototype.__init6.call(this),Pr.prototype.__init7.call(this),this.state={hovered:!1,isDragging:!1},this.shapeRef=kr.createRef(),this.trRef=kr.createRef()}__init(){this.handleClick=e=>{const{radius:t,isDrawing:n,onClick:i,id:r}=this.props;t<=0&&n||(e.cancelBubble=!0,i(r))}}__init2(){this.handleMouseEnter=()=>{document.body.style.cursor="pointer",this.setState({hovered:!0}),this.trRef.current.setNode(this.shapeRef.current),this.trRef.current.getLayer().batchDraw()}}__init3(){this.handleMouseLeave=()=>{this.setState({hovered:!1}),document.body.style.cursor="default"}}__init4(){this.handleOnDragEnd=e=>{const{onDragEnd:t,id:n}=this.props;this.setState({isDragging:!1}),t(n,{x:e.target.x(),y:e.target.y()})}}__init5(){this.onResizeEnd=()=>{const{onDragEnd:e,id:t}=this.props,n=this.shapeRef.current,i=1!==n.scaleX()?n.scaleX():n.scaleY(),r=Math.max(n.radius()*i,5);this.setState({isDragging:!1}),e(t,{x:n.x(),y:n.y(),radius:r}),n.scaleX(1),n.scaleY(1)}}__init6(){this.handleDelete=e=>{const{onDeleteShape:t}=this.props;t(e)}}__init7(){this.onTransform=()=>{const e=this.shapeRef.current,t=(e.scaleX()+e.scaleY())/2;e.scaleX(t),e.scaleY(t)}}render(){const{correct:e,radius:t,hotspotColor:n,id:i,outlineColor:r,x:a,y:s,strokeWidth:o=5,selectedHotspotColor:l,hoverOutlineColor:h}=this.props,{hovered:u,isDragging:d}=this.state,c=isNaN(t)||t<=0?5:t;return kr.createElement(Yi,{onMouseLeave:this.handleMouseLeave,onMouseEnter:this.handleMouseEnter,padding:12},kr.createElement(Zi,{ref:this.shapeRef,radius:c,fill:e&&l?l:n,onClick:this.handleClick,onTap:this.handleClick,draggable:!0,stroke:r,strokeWidth:e?o:0,onDragStart:()=>this.setState({isDragging:!0}),onDragEnd:this.handleOnDragEnd,onTransformStart:()=>this.setState({isDragging:!0}),onTransformEnd:this.onResizeEnd,x:a,y:s,opacity:.5,cursor:"pointer"}),!d&&u&&kr.createElement(dr,{id:i,radius:c,x:a,y:s,handleWidgetClick:this.handleDelete,isCircle:!0}),this.state.hovered&&kr.createElement(Xi,{borderStroke:h||null,ref:this.trRef,rotateEnabled:!1,keepRatio:!0,onTransform:this.onTransform,enabledAnchors:["middle-left","middle-right","top-center","bottom-center"],boundBoxFunc:(e,t)=>{if(t.width<10||t.height<10)return e;const n=e.x+e.width/2,i=e.y+e.height/2,r=n-(t.x+t.width/2),a=i-(t.y+t.height/2);return t.x+=r,t.y+=a,t}}))}}Pr.propTypes={correct:Er.bool,isDrawing:Er.bool.isRequired,id:Er.string.isRequired,radius:Er.number.isRequired,hotspotColor:Er.string.isRequired,selectedHotspotColor:Er.string,hoverOutlineColor:Er.string,onClick:Er.func.isRequired,onDeleteShape:Er.func.isRequired,onDragEnd:Er.func.isRequired,outlineColor:Er.string.isRequired,x:Er.number.isRequired,y:Er.number.isRequired,strokeWidth:Er.number},Pr.defaultProps={correct:!1};const Dr=t,Rr=n,{cloneDeep:Mr}=a,{styled:Ir}=r,Tr=Ir("div")({position:"relative"}),Lr=Ir("div")({position:"relative",width:"fit-content"}),Hr=Ir("img")({alignItems:"center",display:"flex",justifyContent:"center"}),Or=Ir("div")({borderBottom:"1px solid #727272",borderRight:"1px solid #727272",bottom:"-10px",cursor:"se-resize",height:"10px",position:"absolute",right:"-10px",width:"10px"}),Br=Ir(Ji)({left:0,top:0,position:"absolute"});class Fr extends Dr.Component{static getDerivedStateFromProps(e,t){return e.shapes!==t.shapes?{shapes:e.shapes}:null}constructor(e){super(e),Fr.prototype.__init.call(this),Fr.prototype.__init2.call(this),Fr.prototype.__init3.call(this),Fr.prototype.__init4.call(this),Fr.prototype.__init5.call(this),Fr.prototype.__init6.call(this),Fr.prototype.__init7.call(this),Fr.prototype.__init8.call(this),Fr.prototype.__init9.call(this),Fr.prototype.__init10.call(this),Fr.prototype.__init11.call(this),Fr.prototype.__init12.call(this),this.state={isDrawing:!1,stateShapes:!1,resizing:!1,temporaryPolygon:null,shapes:[],dimensions:{height:0,width:0}}}__init(){this.handleOnMouseDown=e=>{const{shapeType:t,onUpdateShapes:n,shapes:i}=this.props;let r,a;if(e.target===e.currentTarget&&Object.values(K).includes(t)){switch(t){case K.RECTANGLE:r=Z.create(i,e);break;case K.CIRCLE:r=q.create(i,e);break;case K.POLYGON:a=this.state.isDrawingShapeId,r=a?{isDrawing:!0,isDrawingShapeId:a,shapes:this.addPolygonPoint(e)}:X.create(i,e);break;default:return}this.setState({...r}),n(r.shapes)}}}addPolygonPoint(e){const{shapes:t}=X.addPoint(this.state,e,e=>{this.setState({isDrawing:!1,shapes:e,isDrawingShapeId:void 0}),this.props.onUpdateShapes(e)});return t}__init2(){this.handleOnMouseUp=()=>{const{shapeType:e,onUpdateShapes:t}=this.props;let n;if(e!==K.POLYGON){switch(e){case K.RECTANGLE:n=Z.finalizeCreation(this.state,this.props);break;case K.CIRCLE:n=q.finalizeCreation(this.state,this.props);break;default:return}this.setState({...n,isDrawing:!1}),t(n.shapes)}}}__init3(){this.handleMouseMove=e=>{const{shapeType:t,onUpdateShapes:n}=this.props;let i;if(this.state.isDrawing&&Object.values(K).includes(t)){switch(t){case K.RECTANGLE:i=Z.handleMouseMove(this.state,e);break;case K.CIRCLE:i=q.handleMouseMove(this.state,e);break;case K.POLYGON:i=X.handleMouseMove(this.state,e);break;default:return}this.setState(i),n(i.shapes)}}}__init4(){this.handleOnMouseOutOrLeave=e=>{this.state.isDrawing&&this.handleOnMouseUp(e)}}__init5(){this.handleOnDragEnd=(e,t)=>{const{shapes:n,onUpdateShapes:i,dimensions:r}=this.props,{width:a,height:s}=r,o=n.map(n=>{if(n.id!==e)return n;let i=t.x,r=t.y;if("rectangles"===n.group)return i+n.width<0||i>a||r+n.height<0||r>s?null:{...n,...t};if("circles"===n.group){const e=n.radius;return i+e<0||i-e>a||r+e<0||r-e>s?null:{...n,...t}}if("polygons"===n.group){const e=n.points,i=e.map(e=>e.x),r=e.map(e=>e.y);let o=Math.min(...i),l=Math.min(...r),h=Math.max(...i),u=Math.max(...r);const d=t.points[0].x-e[0].x,c=t.points[0].y-e[0].y;return o+=d,h+=d,l+=c,u+=c,h<0||o>a||u<0||l>s?null:{...n,...t}}return n}).filter(e=>null!==e);i(Mr(o))}}__init6(){this.closeInProgressPolygons=e=>{const{shapes:t,onUpdateShapes:n}=this.props,i=(t||[]).find(e=>"newPolygon"===e.id);("newPolygon"===e||i&&this.state.isDrawing)&&X.finalizeCreation(this.state,e=>{this.setState({isDrawing:!1,shapes:e,isDrawingShapeId:void 0}),n(Mr(e))})}}__init7(){this.handleOnSetAsCorrect=e=>{const{id:t}=e,{multipleCorrect:n,shapes:i,onUpdateShapes:r}=this.props;let a;a=n?i.map(e=>(e.id===t&&(e.correct=!e.correct),e)):i.map(e=>(e.correct=e.id===t,e)),r(Mr(a)),this.closeInProgressPolygons(t)}}__init8(){this.handleOnImageLoad=({target:e})=>{const{onUpdateImageDimension:t}=this.props,n=this.resize,i=getComputedStyle(e),r=parseFloat(i.height),a=parseFloat(i.width),s=a>800?{height:r/(a/800),width:800}:{height:r,width:a};this.setState({dimensions:s},()=>t(s)),n.addEventListener("mousedown",this.initialiseResize,!1)}}__init9(){this.initialiseResize=()=>{window.addEventListener("mousemove",this.startResizing,!1),window.addEventListener("mouseup",this.stopResizing,!1)}}checkIfResizeValid(e,t){const{shapes:n}=this.state;let i=!0;return n&&n.forEach(n=>{const r=n.x+n.width+5,a=n.y+n.height+5;(e<=r||t<=a)&&(i=!1)}),i}__init10(){this.startResizing=e=>{const t=e.target.getBoundingClientRect(),n=this.image,{disableDrag:i,preserveAspectRatioEnabled:r,dimensions:a,shapes:s}=this.props,{width:o,height:l}=ir(a,{width:e.clientX-t.left,height:e.clientY-t.top},r);this.checkIfResizeValid(o,l)&&o>150&&l>150&&n&&(n.style.width=`${o}px`,n.style.height=`${l}px`,this.setState({resizing:!0,dimensions:{height:l,width:o},stateShapes:ar(a,{width:o,height:l},s)})),i()}}__init11(){this.stopResizing=()=>{const{enableDrag:e,onUpdateImageDimension:t,onUpdateShapes:n}=this.props,{dimensions:i,stateShapes:r}=this.state;e(),r&&n(Mr(r)),t(i),window.removeEventListener("mousemove",this.startResizing,!1),window.removeEventListener("mouseup",this.stopResizing,!1),this.setState({resizing:!1,stateShapes:!1})}}__init12(){this.deleteShape=e=>{this.setState({isDrawing:!1,isDrawingShapeId:void 0}),this.props.onDeleteShape(e)}}render(){const{imageUrl:e,dimensions:{height:t,width:n},hotspotColor:i,outlineColor:r,shapes:a,strokeWidth:s,hoverOutlineColor:o,selectedHotspotColor:l}=this.props,{stateShapes:h,isDrawing:u,dimensions:{height:d,width:c}}=this.state,f=h||a;return Dr.createElement(Tr,null,e&&Dr.createElement(Lr,null,Dr.createElement(Hr,{onLoad:this.handleOnImageLoad,ref:e=>{this.image=e},src:e,...t&&n?{style:{height:t,width:n}}:{}}),Dr.createElement(Or,{ref:e=>{this.resize=e}})),Dr.createElement(Br,{height:d||t,width:c||n,onMouseDown:this.handleOnMouseDown,onMouseUp:this.handleOnMouseUp,onMouseMove:this.handleMouseMove,onContentMouseOut:this.handleOnMouseOutOrLeave,onContentMouseLeave:this.handleOnMouseOutOrLeave},Dr.createElement("Layer",null,f.map((e,a)=>{let h;switch(e.group){case ee:h=gr;break;case J:h=Pr;break;case $:h=wr;break;default:return null}return Dr.createElement(h,{...e.group===J?{radius:e.radius}:{},...e.group===ee?{height:e.height,width:e.width}:{},...e.group===$?{points:e.points,addPolygonPoint:e=>this.addPolygonPoint(e)}:{},correct:e.correct,isDrawing:u,hotspotColor:i,hoverOutlineColor:o,selectedHotspotColor:l,id:e.id,key:a,onClick:()=>this.handleOnSetAsCorrect(e),onDragEnd:this.handleOnDragEnd,onDeleteShape:this.deleteShape,outlineColor:r,width:e.width,x:e.x,y:e.y,strokeWidth:s,imageHeight:d||t,imageWidth:c||n,..."polygons"===e.group?{addPolygonPoint:e=>this.addPolygonPoint(e)}:{}})}))))}}Fr.propTypes={disableDrag:Rr.func.isRequired,dimensions:Rr.object.isRequired,enableDrag:Rr.func.isRequired,shapeType:Rr.oneOf(Object.values(K)),imageUrl:Rr.string.isRequired,handleFinishDrawing:Rr.func.isRequired,hotspotColor:Rr.string.isRequired,selectedHotspotColor:Rr.string,hoverOutlineColor:Rr.string,multipleCorrect:Rr.bool.isRequired,onUpdateImageDimension:Rr.func.isRequired,onUpdateShapes:Rr.func.isRequired,onDeleteShape:Rr.func.isRequired,outlineColor:Rr.string.isRequired,shapes:Rr.array.isRequired,strokeWidth:Rr.number,preserveAspectRatioEnabled:Rr.bool};const Nr=t,zr=n,Vr=({label:e,onInputClick:t,onUploadImage:n,setRef:i})=>Nr.createElement(Nr.Fragment,null,Nr.createElement(V,{label:e,onClick:t}),Nr.createElement("input",{accept:"image/*",style:{display:"none"},onChange:n,ref:e=>{i(e)},type:"file"}));Vr.propTypes={label:zr.string.isRequired,onInputClick:zr.func.isRequired,onUploadImage:zr.func.isRequired,setRef:zr.func.isRequired},Vr.defaultProps={classNameButton:"",classNameSection:""};const Gr=t,{Component:Ur}=t,{styled:Wr}=r,Qr=n,jr=Wr("div")(({theme:e})=>({marginTop:e.spacing(1.5),marginBottom:e.spacing(2.5)})),Yr=Wr("div")(({theme:e,hasErrors:t,dropzoneActive:n})=>({border:"1px solid #E0E1E6",borderRadius:"5px",...n&&{border:"1px solid #0032C2"},...t&&!n&&{border:`1px solid ${e.palette.error.main}`}})),qr=Wr("div")({marginRight:"5px","&:hover":{cursor:"pointer"}}),Zr=Wr("div")({alignItems:"center",display:"flex",flexDirection:"column",justifyContent:"center"}),Xr=Wr("div")(({theme:e})=>({minHeight:350,paddingBottom:e.spacing(5),paddingRight:e.spacing(5)})),Kr=Wr("div")(({theme:e})=>({backgroundColor:"#FFF",borderBottom:"1px solid #E0E1E6",borderTopLeftRadius:"5px",borderTopRightRadius:"5px",display:"flex",justifyContent:"flex-end",padding:e.spacing(1)})),Jr=Wr("div")({marginRight:"auto"}),$r=e=>e.type.match(/image.*/);class ea extends Ur{static getDerivedStateFromProps(e,t){return{...t,shapes:sr(e.shapes)}}constructor(e){super(e),ea.prototype.__init.call(this),ea.prototype.__init2.call(this),ea.prototype.__init3.call(this),ea.prototype.__init4.call(this),ea.prototype.__init5.call(this),ea.prototype.__init6.call(this),ea.prototype.__init7.call(this),ea.prototype.__init8.call(this),ea.prototype.__init9.call(this),ea.prototype.__init10.call(this),ea.prototype.__init11.call(this),ea.prototype.__init12.call(this),ea.prototype.__init13.call(this),ea.prototype.__init14.call(this),this.state={dragEnabled:!0,shapes:sr(e.shapes),selectedShape:K.NONE},this.fakeImageHandler={cancel:()=>{},done:(e,t)=>this.props.onImageUpload(t),fileChosen:()=>{},progress:()=>{}}}__init(){this.handleFileRead=e=>{if(e instanceof Blob){const{onImageUpload:t,insertImage:n}=this.props,i=new FileReader;i.onloadend=()=>t(i.result),i.readAsDataURL(e),n&&n({...this.fakeImageHandler,getChosenFile:()=>e,isPasted:!0})}}}__init2(){this.enableDropzone=()=>this.setState({dropzoneActive:!0})}__init3(){this.disableDropzone=()=>this.setState({dropzoneActive:!1})}__init4(){this.handleOnPaste=e=>{const{files:t}=e.clipboardData;t&&$r(t[0])&&this.handleFileRead(t[0])}}__init5(){this.handleOnDrop=e=>{e.preventDefault();const{items:t,files:n}=e.dataTransfer;if(t&&"file"===t[0].kind){const e=t[0].getAsFile();$r(e)&&this.handleFileRead(e)}else $r(n[0])&&this.handleFileRead(n[0]);this.disableDropzone()}}__init6(){this.handleOnDragOver=e=>{e.preventDefault();const{dropzoneActive:t}=this.state;t||this.enableDropzone()}}__init7(){this.handleOnDragExit=e=>{e.preventDefault(),this.disableDropzone()}}__init8(){this.onUpdateShapes=e=>{const{onUpdateShapes:t}=this.props;this.setState({shapes:e},()=>t(or(e)))}}__init9(){this.onDeleteShape=e=>{const{shapes:t}=this.state;if(t&&t.length){let n=t.filter(t=>t.id!==e);this.onUpdateShapes(n)}}}__init10(){this.handleClearAll=()=>this.onUpdateShapes([])}__init11(){this.handleEnableDrag=()=>this.setState({dragEnabled:!0})}__init12(){this.handleDisableDrag=()=>this.setState({dragEnabled:!1})}__init13(){this.handleInputClick=()=>{const{insertImage:e}=this.props;e&&e(this.fakeImageHandler)}}__init14(){this.handleFinishDrawing=()=>{this.setState({selectedShape:K.NONE})}}render(){const{dimensions:e,hasErrors:t,hotspotColor:n,imageUrl:i,multipleCorrect:r,onUpdateImageDimension:a,outlineColor:s,strokeWidth:o,preserveAspectRatioEnabled:l,hoverOutlineColor:h,selectedHotspotColor:u}=this.props,{dropzoneActive:d,dragEnabled:c}=this.state,{shapes:f,selectedShape:g}=this.state;return Gr.createElement(jr,null,Gr.createElement(Yr,{hasErrors:t,dropzoneActive:d,...c?{onDragExit:this.handleOnDragExit,onDragLeave:this.handleOnDragExit,onDragOver:this.handleOnDragOver,onDrop:this.handleOnDrop,onPaste:this.handleOnPaste}:{}},Gr.createElement(Kr,null,Gr.createElement(qr,{onClick:()=>this.setState({selectedShape:g===K.RECTANGLE?K.NONE:K.RECTANGLE})},Gr.createElement(Y,{isActive:g===K.RECTANGLE})),Gr.createElement(qr,{onClick:()=>this.setState({selectedShape:g===K.POLYGON?K.NONE:K.POLYGON})},Gr.createElement(Q,{isActive:g===K.POLYGON})),Gr.createElement(qr,{onClick:()=>this.setState({selectedShape:g===K.CIRCLE?K.NONE:K.CIRCLE})},Gr.createElement(U,{isActive:g===K.CIRCLE})),i&&Gr.createElement(Jr,null,Gr.createElement(Vr,{label:"Replace Image",onInputClick:this.handleInputClick,setRef:e=>{this.input=e}})),Gr.createElement(V,{disabled:!(f&&f.length),onClick:this.handleClearAll,label:"Clear all"})),Gr.createElement(Xr,{ref:e=>{this.imageSection=e}},i?Gr.createElement(Fr,{dimensions:e,disableDrag:this.handleDisableDrag,enableDrag:this.handleEnableDrag,shapeType:this.state.selectedShape,handleFinishDrawing:this.handleFinishDrawing,imageUrl:i,hotspotColor:n,selectedHotspotColor:u,hoverOutlineColor:h,multipleCorrect:r,onUpdateImageDimension:a,onUpdateShapes:this.onUpdateShapes,onDeleteShape:this.onDeleteShape,outlineColor:s,shapes:f,strokeWidth:o,preserveAspectRatioEnabled:l}):Gr.createElement(Zr,null,Gr.createElement("label",null,"Drag and drop or upload image from computer"),Gr.createElement("br",null),Gr.createElement(Vr,{label:"Upload Image",onInputClick:this.handleInputClick,setRef:e=>{this.input=e}})))))}}ea.propTypes={dimensions:Qr.object.isRequired,imageUrl:Qr.string.isRequired,hotspotColor:Qr.string.isRequired,selectedHotspotColor:Qr.string,hoverOutlineColor:Qr.string,multipleCorrect:Qr.bool.isRequired,onImageUpload:Qr.func.isRequired,onUpdateImageDimension:Qr.func.isRequired,insertImage:Qr.func,onUpdateShapes:Qr.func.isRequired,outlineColor:Qr.string.isRequired,shapes:Qr.shape({rectangles:Qr.array,polygons:Qr.array}).isRequired,strokeWidth:Qr.number,preserveAspectRatioEnabled:Qr.bool,hasErrors:Qr.bool},ea.defaultProps={strokeWidth:5};const ta=t,na=n,{styled:ia}=r,{Typography:ra}=i,{Tooltip:aa}=i,{Info:sa}=s,{settings:oa}=l,{layout:la}=l,{InputContainer:ha}=l,{NumberTextField:ua}=l,da=h;function ca(e){let t,n=e[0],i=1;for(;i<e.length;){const r=e[i],a=e[i+1];if(i+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=a(n)):"call"!==r&&"optionalCall"!==r||(n=a((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:fa,toggle:ga,dropdown:pa}=oa,ma=ia("div")(({theme:e})=>({display:"flex",marginBottom:e.spacing(1.5)})),va=ia("div")({flex:1,width:"90%"}),ya=ia(ha)(({theme:e})=>({paddingTop:e.spacing(1),marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),ba=ia(ra)(({theme:e})=>({marginRight:e.spacing(1)})),Ca=ia("div")({display:"flex",alignItems:"center"}),xa=ia(aa)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),_a=ia("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class Sa extends ta.Component{constructor(...e){super(...e),Sa.prototype.__init.call(this),Sa.prototype.__init2.call(this)}__init(){this.handleColorChange=(e,t)=>{const{onColorChanged:n}=this.props;n(`${e}Color`,t)}}__init2(){this.handleOnUpdateImageDimensions=(e,t)=>{const{model:{dimensions:n,shapes:i},configuration:{preserveAspectRatio:r={}},onUpdateImageDimension:a,onUpdateShapes:s}=this.props,o={...n,[t]:e},l=ir(n,o,r.enabled,t),h=sr(i),u=ar(n,l,h);s(or(u)),a(l)}}render(){const{configuration:e,model:t,imageSupport:n,uploadSoundSupport:i,onConfigurationChanged:r,onImageUpload:a,onModelChangedByConfig:s,onPromptChanged:o,onRationaleChanged:l,onUpdateImageDimension:h,onTeacherInstructionsChanged:u,onUpdateShapes:d}=this.props,{baseInputConfiguration:c={},contentDimensions:f={},maxImageWidth:g={},maxImageHeight:p={},multipleCorrect:m={},partialScoring:v={},preserveAspectRatio:y={},prompt:b={},rationale:C={},settingsPanelDisabled:x,spellCheck:_={},teacherInstructions:S={},withRubric:A={},mathMlOptions:w={},language:k={},languageChoices:E={}}=e||{},{errors:P,extraCSSRules:D,promptEnabled:R,rationaleEnabled:M,spellCheckEnabled:I,teacherInstructionsEnabled:T,toolbarEditorPosition:L}=t||{},{prompt:O,rationale:B,shapes:F,selections:N,teacherInstructions:z}=P||{},V=(e=>{const{minShapes:t,maxShapes:n,maxSelections:i}=e;return`Validation requirements:\nThere should be at least ${t} `+(n?`and at most ${n} `:"")+"shapes defined.\nThere should be at least 1 "+(i?`and at most ${i} `:"")+"shape"+(i?"s":"")+" selected."})(e),G=g&&g.prompt,U=p&&p.prompt,W={position:"top"===L?"top":"bottom"},Q={multipleCorrect:m.settings&&ga(m.label),partialScoring:v.settings&&ga(v.label),promptEnabled:b.settings&&ga(b.label),"language.enabled":k.settings&&ga(k.label,!0),language:k.settings&&k.enabled&&pa(E.label,E.options)},j={teacherInstructionsEnabled:S.settings&&ga(S.label),rationaleEnabled:C.settings&&ga(C.label),spellCheckEnabled:_.settings&&ga(_.label),rubricEnabled:ca([A,"optionalAccess",e=>e.settings])&&ga(ca([A,"optionalAccess",e=>e.label]))},Y=(e={})=>({...c,...e});return ta.createElement(la.ConfigLayout,{extraCSSRules:D,dimensions:f,hideSettings:x,settings:ta.createElement(fa,{model:t,onChangeModel:s,configuration:e,onChangeConfiguration:r,groups:{Settings:Q,Properties:j}})},T&&ta.createElement(ya,{label:S.label},ta.createElement(da,{markup:t.teacherInstructions||"",onChange:u,imageSupport:n,nonEmpty:!1,error:z,toolbarOpts:W,pluginProps:Y(ca([S,"optionalAccess",e=>e.inputConfiguration])),spellCheck:I,maxImageWidth:g&&g.teacherInstructions||G,maxImageHeight:p&&p.teacherInstructions||U,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:w}),z&&ta.createElement(_a,null,z)),R&&ta.createElement(ya,{label:b.label},ta.createElement(da,{markup:t.prompt||"",onChange:o,imageSupport:n,nonEmpty:!1,error:O,toolbarOpts:W,pluginProps:Y(ca([b,"optionalAccess",e=>e.inputConfiguration])),spellCheck:I,maxImageWidth:G,maxImageHeight:U,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:w}),O&&ta.createElement(_a,null,O)),ta.createElement(Ca,null,ta.createElement(ba,{variant:"h6"},"Define Hotspot"),ta.createElement(xa,{disableFocusListener:!0,disableTouchListener:!0,placement:"left",title:V},ta.createElement(sa,{fontSize:"small",color:"primary",style:{float:"right"}}))),ta.createElement(H,{hotspotColor:t.hotspotColor,hotspotList:t.hotspotList,outlineColor:t.outlineColor,outlineList:t.outlineList,onHotspotColorChange:e=>this.handleColorChange("hotspot",e),onOutlineColorChange:e=>this.handleColorChange("outline",e)}),ta.createElement(ea,{dimensions:t.dimensions,imageUrl:t.imageUrl,multipleCorrect:t.multipleCorrect,hasErrors:!!F||!!N,hotspotColor:t.hotspotColor,outlineColor:t.outlineColor,selectedHotspotColor:t.selectedHotspotColor,hoverOutlineColor:t.hoverOutlineColor,onUpdateImageDimension:h,onUpdateShapes:d,onImageUpload:a,shapes:t.shapes,strokeWidth:t.strokeWidth,preserveAspectRatioEnabled:y.enabled,insertImage:n&&n.add}),F&&ta.createElement(_a,null,F),N&&ta.createElement(_a,null,N),t.imageUrl&&ta.createElement(ta.Fragment,null,ta.createElement(ra,{variant:"h6"},"Image Dimensions"),ta.createElement(ma,null,ta.createElement(va,null,ta.createElement(ua,{key:"hotspot-manual-width",label:"Width",value:t.dimensions.width,min:0,onChange:(e,t)=>this.handleOnUpdateImageDimensions(t,"width"),showErrorWhenOutsideRange:!0})),ta.createElement(va,null,ta.createElement(ua,{key:"hotspot-manual-height",label:"Height",value:t.dimensions.height,min:0,onChange:(e,t)=>this.handleOnUpdateImageDimensions(t,"height"),showErrorWhenOutsideRange:!0})))),M&&ta.createElement(ya,{label:C.label},ta.createElement(da,{markup:t.rationale||"",onChange:l,imageSupport:n,error:B,toolbarOpts:W,pluginProps:Y(ca([C,"optionalAccess",e=>e.inputConfiguration])),spellCheck:I,maxImageWidth:g&&g.rationale||G,maxImageHeight:p&&p.rationale||U,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:w}),B&&ta.createElement(_a,null,B)))}}Sa.propTypes={configuration:na.object,model:na.object.isRequired,imageSupport:na.shape({add:na.func,delete:na.func}),uploadSoundSupport:na.shape({add:na.func,delete:na.func}),onImageUpload:na.func.isRequired,onColorChanged:na.func.isRequired,onPromptChanged:na.func.isRequired,onUpdateImageDimension:na.func.isRequired,onUpdateShapes:na.func.isRequired,onModelChangedByConfig:na.func.isRequired,onRationaleChanged:na.func.isRequired,onConfigurationChanged:na.func.isRequired,onTeacherInstructionsChanged:na.func.isRequired};var Aa={model:{dimensions:{height:0,width:0},hotspotColor:"rgba(137, 183, 244, 0.25)",hotspotList:["rgba(137, 183, 244, 0.25)"],imageUrl:"",multipleCorrect:!0,outlineColor:"blue",outlineList:["blue"],partialScoring:!1,prompt:"",promptEnabled:!0,rationaleEnabled:!0,shapes:{rectangles:[],polygons:[],circles:[]},strokeWidth:5,studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom"},configuration:{baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},multipleCorrect:{settings:!0,label:"Multiple Correct Responses"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},settingsPanelDisabled:!1,spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},preserveAspectRatio:{settings:!1,enabled:!0,label:"Preserve aspect ratio"},minShapes:2,maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}}};const wa=t;function ka(e){let t,n=e[0],i=1;for(;i<e.length;){const r=e[i],a=e[i+1];if(i+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=a(n)):"call"!==r&&"optionalCall"!==r||(n=a((...e)=>n.call(t,...e)),t=void 0)}return n}const Ea=o("hotspot:configure");class Pa extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>({...Aa.model,...e,hotspotList:e.hotspotList||[e.hotspotColor]||Aa.model.hotspotList,outlineList:e.outlineList||[e.outlineColor]||Aa.model.outlineList,shapes:e.shapes||Aa.model.shapes||{}})}constructor(){super(),Pa.prototype.__init.call(this),Pa.prototype.__init2.call(this),Pa.prototype.__init3.call(this),Pa.prototype.__init4.call(this),Pa.prototype.__init5.call(this),Pa.prototype.__init6.call(this),Pa.prototype.__init7.call(this),Pa.prototype.__init8.call(this),Pa.prototype.__init9.call(this),Pa.prototype.__init10.call(this),Pa.prototype.__init11.call(this),this._root=null,this._model=Pa.createDefaultModel(),this._configuration=Aa.configuration,this.onModelChanged=this.onModelChanged.bind(this)}set model(e){this._model=Pa.createDefaultModel(e),this._render()}set configuration(e){const t={...Aa.configuration,...e};this._configuration=t,ka([t,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?ka([t,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=ka([t,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):t.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find(e=>e.value===this._model.language)||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new v(this._model,t))}onModelChanged(e,t){this._model=e,this.dispatchModelUpdated(t),this._render()}__init(){this.onConfigurationChanged=e=>{this._configuration=e,this._render()}}__init2(){this.onModelChangedByConfig=(e,t)=>{const n=e;if("multipleCorrect"===t){const{rectangles:e=[],polygons:t=[],circles:i=[]}=n.shapes||{};n.shapes.rectangles=e.map(e=>({...e,correct:!1})),n.shapes.polygons=t.map(e=>({...e,correct:!1})),n.shapes.circles=i.map(e=>({...e,correct:!1}))}this.onModelChanged(n)}}__init3(){this.onColorChanged=(e,t)=>{this.onModelChanged({...this._model,[e]:t})}}__init4(){this.onPromptChanged=e=>{this.onModelChanged({...this._model,prompt:e})}}__init5(){this.onRationaleChanged=e=>{this.onModelChanged({...this._model,rationale:e})}}__init6(){this.onTeacherInstructionsChanged=e=>{this.onModelChanged({...this._model,teacherInstructions:e})}}__init7(){this.onUpdateImageDimension=e=>{this.onModelChanged({...this._model,dimensions:e})}}__init8(){this.onUpdateShapes=e=>{this.onModelChanged({...this._model,shapes:e})}}__init9(){this.onImageUpload=e=>{this.onModelChanged({...this._model,imageUrl:e})}}__init10(){this.insertImage=e=>{this.dispatchEvent(new x(e))}}__init11(){this.onDeleteImage=(e,t)=>{this.dispatchEvent(new b(e,t))}}insertSound(e){this.dispatchEvent(new w(e))}onDeleteSound(e,t){this.dispatchEvent(new S(e,t))}_render(){Ea("_render");let e=wa.createElement(Sa,{configuration:this._configuration,model:this._model,onColorChanged:this.onColorChanged,onImageUpload:this.onImageUpload,onRationaleChanged:this.onRationaleChanged,onConfigurationChanged:this.onConfigurationChanged,onPromptChanged:this.onPromptChanged,onUpdateImageDimension:this.onUpdateImageDimension,imageSupport:{add:this.insertImage,delete:this.onDeleteImage},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)},onUpdateShapes:this.onUpdateShapes,onModelChangedByConfig:this.onModelChangedByConfig,onTeacherInstructionsChanged:this.onTeacherInstructionsChanged});this._root||(this._root=f(this)),this._root.render(e)}disconnectedCallback(){this._root&&this._root.unmount()}}Pa.__initStatic();export{Pa as default};