1&&(E+=a)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=fe._isString(t)?t:t==null?"":t+"";return this._setAttr(N9e,n),this}getWidth(){var t=this.attrs.width===Fg||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Fg||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return fe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=jC(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Wb+this.fontVariant()+Wb+(this.fontSize()+F9e)+U9e(this.fontFamily())}_addTextLine(t){this.align()===gv&&(t=t.trim());var n=this._getTextWidth(t);return this.textArr.push({text:t,width:n,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return jC().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(`
+`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,a=this.attrs.height,s=o!==Fg&&o!==void 0,l=a!==Fg&&a!==void 0,u=this.padding(),d=o-u*2,h=a-u*2,m=0,y=this.wrap(),b=y!==uD,x=y!==V9e&&b,k=this.ellipsis();this.textArr=[],jC().font=this._getContextFont();for(var E=k?this._getTextWidth(NC):0,_=0,P=t.length;_d)for(;A.length>0;){for(var R=0,D=A.length,j="",z=0;R>>1,K=A.slice(0,H+1),te=this._getTextWidth(K)+E;te<=d?(R=H+1,j=K,z=te):D=H}if(j){if(x){var G,$=A[j.length],W=$===Wb||$===sD;W&&z<=d?G=j.length:G=Math.max(j.lastIndexOf(Wb),j.lastIndexOf(sD))+1,G>0&&(R=G,j=j.slice(0,R),z=this._getTextWidth(j))}j=j.trimRight(),this._addTextLine(j),r=Math.max(r,z),m+=i;var X=this._shouldHandleEllipsis(m);if(X){this._tryToAddEllipsisToLastLine();break}if(A=A.slice(R),A=A.trimLeft(),A.length>0&&(M=this._getTextWidth(A),M<=d)){this._addTextLine(A),m+=i,r=Math.max(r,M);break}}else break}else this._addTextLine(A),m+=i,r=Math.max(r,M),this._shouldHandleEllipsis(m)&&_h)break;this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0)}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==Fg&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==uD;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==Fg&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!o)){if(n){var s=this._getTextWidth(a.text+NC)=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;i0&&(s+=t.dataArray[l].pathLength);var u=0;i==="center"&&(u=Math.max(0,s/2-a/2)),i==="right"&&(u=Math.max(0,s-a));for(var d=HG(this.text()),h=this.text().split(" ").length-1,m,y,b,x=-1,k=0,E=function(){k=0;for(var te=t.dataArray,G=x+1;G0)return x=G,te[G];te[G].command==="M"&&(m={x:te[G].points[0],y:te[G].points[1]})}return{}},_=function(te){var G=t._getTextSize(te).width+r;te===" "&&i==="justify"&&(G+=(s-a)/h);var $=0,W=0;for(y=void 0;Math.abs(G-$)/G>.01&&W<20;){W++;for(var X=$;b===void 0;)b=E(),b&&X+b.pathLengthG?y=zn.getPointOnLine(G,m.x,m.y,b.points[0],b.points[1],m.x,m.y):b=void 0;break;case"A":var U=b.points[4],Q=b.points[5],re=b.points[4]+Q;k===0?k=U+1e-8:G>$?k+=Math.PI/180*Q/Math.abs(Q):k-=Math.PI/360*Q/Math.abs(Q),(Q<0&&k=0&&k>re)&&(k=re,Z=!0),y=zn.getPointOnEllipticalArc(b.points[0],b.points[1],b.points[2],b.points[3],k,b.points[6]);break;case"C":k===0?G>b.pathLength?k=1e-8:k=G/b.pathLength:G>$?k+=(G-$)/b.pathLength/2:k=Math.max(k-($-G)/b.pathLength/2,0),k>1&&(k=1,Z=!0),y=zn.getPointOnCubicBezier(k,b.start.x,b.start.y,b.points[0],b.points[1],b.points[2],b.points[3],b.points[4],b.points[5]);break;case"Q":k===0?k=G/b.pathLength:G>$?k+=(G-$)/b.pathLength:k-=($-G)/b.pathLength,k>1&&(k=1,Z=!0),y=zn.getPointOnQuadraticBezier(k,b.start.x,b.start.y,b.points[0],b.points[1],b.points[2],b.points[3]);break}y!==void 0&&($=zn.getLineLength(m.x,m.y,y.x,y.y)),Z&&(Z=!1,b=void 0)}},P="C",A=t._getTextSize(P).width+r,M=u/A-1,R=0;Re+`.${KG}`).join(" "),cD="nodesRect",Z9e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Q9e={"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 J9e="ontouchstart"in gt._global;function e8e(e,t){if(e==="rotater")return"crosshair";t+=fe.degToRad(Q9e[e]||0);var n=(fe.radToDeg(t)%360+360)%360;return fe._inRange(n,315+22.5,360)||fe._inRange(n,0,22.5)?"ns-resize":fe._inRange(n,45-22.5,45+22.5)?"nesw-resize":fe._inRange(n,90-22.5,90+22.5)?"ew-resize":fe._inRange(n,135-22.5,135+22.5)?"nwse-resize":fe._inRange(n,180-22.5,180+22.5)?"ns-resize":fe._inRange(n,225-22.5,225+22.5)?"nesw-resize":fe._inRange(n,270-22.5,270+22.5)?"ew-resize":fe._inRange(n,315-22.5,315+22.5)?"nwse-resize":(fe.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var rS=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],dD=1e8;function t8e(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function XG(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function n8e(e,t){const n=t8e(e);return XG(e,t,n)}function r8e(e,t,n){let r=t;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},o=r._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");r.on(o,i),r.on(Z9e.map(a=>a+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,a=i.y-n.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const l=s.getAbsolutePosition();s.setAbsolutePosition({x:l.x+o,y:l.y+a}),s.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(cD),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(cD,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),a=t.getAbsolutePosition(r),s=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(gt.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),d={x:a.x+s*Math.cos(u)+l*Math.sin(-u),y:a.y+l*Math.cos(u)+s*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return XG(d,-gt.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-dD,y:-dD,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const d=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var h=[{x:d.x,y:d.y},{x:d.x+d.width,y:d.y},{x:d.x+d.width,y:d.y+d.height},{x:d.x,y:d.y+d.height}],m=u.getAbsoluteTransform();h.forEach(function(y){var b=m.point(y);n.push(b)})});const r=new Ea;r.rotate(-gt.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(u){var d=r.point(u);i===void 0&&(i=a=d.x,o=s=d.y),i=Math.min(i,d.x),o=Math.min(o,d.y),a=Math.max(a,d.x),s=Math.max(s,d.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:a-i,height:s-o,rotation:gt.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(),rS.forEach(function(t){this._createAnchor(t)}.bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new Wy({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:J9e?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=gt.getAngle(this.rotation()),o=e8e(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new Fe({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*fe._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),a=o.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let l={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const d=o.getAbsolutePosition();if(!(u.x===d.x&&u.y===d.y)){if(this._movingAnchorName==="rotater"){var h=this._getNodeRect();n=o.x()-h.width/2,r=-o.y()+h.height/2;let te=Math.atan2(-r,n)+Math.PI/2;h.height<0&&(te-=Math.PI);var m=gt.getAngle(this.rotation());const G=m+te,$=gt.getAngle(this.rotationSnapTolerance()),X=r8e(this.rotationSnaps(),G,$)-h.rotation,Z=n8e(h,X);this._fitNodesInto(Z,t);return}var y=this.keepRatio()||t.shiftKey,_=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(y){var b=_?{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(b.x-o.x(),2)+Math.pow(b.y-o.y(),2));var x=this.findOne(".top-left").x()>b.x?-1:1,k=this.findOne(".top-left").y()>b.y?-1:1;n=i*this.cos*x,r=i*this.sin*k,this.findOne(".top-left").x(b.x-n),this.findOne(".top-left").y(b.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(y){var b=_?{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(o.x()-b.x,2)+Math.pow(b.y-o.y(),2));var x=this.findOne(".top-right").x()b.y?-1:1;n=i*this.cos*x,r=i*this.sin*k,this.findOne(".top-right").x(b.x+n),this.findOne(".top-right").y(b.y-r)}var E=o.position();this.findOne(".top-left").y(E.y),this.findOne(".bottom-right").x(E.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(y){var b=_?{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(b.x-o.x(),2)+Math.pow(o.y()-b.y,2));var x=b.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(fe._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(fe._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new Ea;if(a.rotate(gt.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const h=a.point({x:-this.padding()*2,y:0});if(t.x+=h.x,t.y+=h.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const h=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const h=a.point({x:0,y:-this.padding()*2});if(t.x+=h.x,t.y+=h.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const h=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const h=this.boundBoxFunc()(r,t);h?t=h:fe.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new Ea;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const u=new Ea;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/s,t.height/s);const d=u.multiply(l.invert());this._nodes.forEach(h=>{var m;const y=h.getParent().getAbsoluteTransform(),b=h.getTransform().copy();b.translate(h.offsetX(),h.offsetY());const x=new Ea;x.multiply(y.copy().invert()).multiply(d).multiply(y).multiply(b);const k=x.decompose();h.setAttrs(k),this._fire("transform",{evt:n,target:h}),h._fire("transform",{evt:n,target:h}),(m=h.getLayer())===null||m===void 0||m.batchDraw()}),this.rotation(fe._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(fe._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();this.find("._anchor").forEach(u=>{u.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+s,offsetY:l/2+s,visible:a&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+s,visible:a&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-s,offsetY:l/2+s,visible:a&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+s,visible:a&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-s,visible:a&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-s,visible:a&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*fe._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),u0.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Qe.prototype.toObject.call(this)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};function i8e(e){return e instanceof Array||fe.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){rS.indexOf(t)===-1&&fe.warn("Unknown anchor name: "+t+". Available names are: "+rS.join(", "))}),e||[]}In.prototype.className="Transformer";Or(In);ee.addGetterSetter(In,"enabledAnchors",rS,i8e);ee.addGetterSetter(In,"flipEnabled",!0,il());ee.addGetterSetter(In,"resizeEnabled",!0);ee.addGetterSetter(In,"anchorSize",10,Ye());ee.addGetterSetter(In,"rotateEnabled",!0);ee.addGetterSetter(In,"rotationSnaps",[]);ee.addGetterSetter(In,"rotateAnchorOffset",50,Ye());ee.addGetterSetter(In,"rotationSnapTolerance",5,Ye());ee.addGetterSetter(In,"borderEnabled",!0);ee.addGetterSetter(In,"anchorStroke","rgb(0, 161, 255)");ee.addGetterSetter(In,"anchorStrokeWidth",1,Ye());ee.addGetterSetter(In,"anchorFill","white");ee.addGetterSetter(In,"anchorCornerRadius",0,Ye());ee.addGetterSetter(In,"borderStroke","rgb(0, 161, 255)");ee.addGetterSetter(In,"borderStrokeWidth",1,Ye());ee.addGetterSetter(In,"borderDash");ee.addGetterSetter(In,"keepRatio",!0);ee.addGetterSetter(In,"centeredScaling",!1);ee.addGetterSetter(In,"ignoreStroke",!1);ee.addGetterSetter(In,"padding",0,Ye());ee.addGetterSetter(In,"node");ee.addGetterSetter(In,"nodes");ee.addGetterSetter(In,"boundBoxFunc");ee.addGetterSetter(In,"anchorDragBoundFunc");ee.addGetterSetter(In,"shouldOverdrawWholeArea",!1);ee.addGetterSetter(In,"useSingleNodeRotation",!0);ee.backCompat(In,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class gc extends Fe{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,gt.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}gc.prototype.className="Wedge";gc.prototype._centroid=!0;gc.prototype._attrsAffectingSize=["radius"];Or(gc);ee.addGetterSetter(gc,"radius",0,Ye());ee.addGetterSetter(gc,"angle",0,Ye());ee.addGetterSetter(gc,"clockwise",!1);ee.backCompat(gc,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function fD(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var o8e=[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],a8e=[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 s8e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,d,h,m,y,b,x,k,E,_,P,A,M,R,D,j,z,H,K,te,G=t+t+1,$=r-1,W=i-1,X=t+1,Z=X*(X+1)/2,U=new fD,Q=null,re=U,he=null,Ee=null,Ce=o8e[t],de=a8e[t];for(s=1;s>de,K!==0?(K=255/K,n[d]=(m*Ce>>de)*K,n[d+1]=(y*Ce>>de)*K,n[d+2]=(b*Ce>>de)*K):n[d]=n[d+1]=n[d+2]=0,m-=k,y-=E,b-=_,x-=P,k-=he.r,E-=he.g,_-=he.b,P-=he.a,l=h+((l=o+t+1)<$?l:$)<<2,A+=he.r=n[l],M+=he.g=n[l+1],R+=he.b=n[l+2],D+=he.a=n[l+3],m+=A,y+=M,b+=R,x+=D,he=he.next,k+=j=Ee.r,E+=z=Ee.g,_+=H=Ee.b,P+=K=Ee.a,A-=j,M-=z,R-=H,D-=K,Ee=Ee.next,d+=4;h+=r}for(o=0;o>de,K>0?(K=255/K,n[l]=(m*Ce>>de)*K,n[l+1]=(y*Ce>>de)*K,n[l+2]=(b*Ce>>de)*K):n[l]=n[l+1]=n[l+2]=0,m-=k,y-=E,b-=_,x-=P,k-=he.r,E-=he.g,_-=he.b,P-=he.a,l=o+((l=a+X)0&&s8e(t,n)};ee.addGetterSetter(Qe,"blurRadius",0,Ye(),ee.afterSetFilter);const u8e=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,a=a<0?0:a>255?255:a,n[s]=i,n[s+1]=o,n[s+2]=a};ee.addGetterSetter(Qe,"contrast",0,Ye(),ee.afterSetFilter);const d8e=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,s=e.data,l=e.width,u=e.height,d=l*4,h=u;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:fe.error("Unknown emboss direction: "+r)}do{var m=(h-1)*d,y=o;h+y<1&&(y=0),h+y>u&&(y=0);var b=(h-1+y)*l*4,x=l;do{var k=m+(x-1)*4,E=a;x+E<1&&(E=0),x+E>l&&(E=0);var _=b+(x-1+E)*4,P=s[k]-s[_],A=s[k+1]-s[_+1],M=s[k+2]-s[_+2],R=P,D=R>0?R:-R,j=A>0?A:-A,z=M>0?M:-M;if(j>D&&(R=A),z>D&&(R=M),R*=t,i){var H=s[k]+R,K=s[k+1]+R,te=s[k+2]+R;s[k]=H>255?255:H<0?0:H,s[k+1]=K>255?255:K<0?0:K,s[k+2]=te>255?255:te<0?0:te}else{var G=n-R;G<0?G=0:G>255&&(G=255),s[k]=s[k+1]=s[k+2]=G}}while(--x)}while(--h)};ee.addGetterSetter(Qe,"embossStrength",.5,Ye(),ee.afterSetFilter);ee.addGetterSetter(Qe,"embossWhiteLevel",.5,Ye(),ee.afterSetFilter);ee.addGetterSetter(Qe,"embossDirection","top-left",null,ee.afterSetFilter);ee.addGetterSetter(Qe,"embossBlend",!1,null,ee.afterSetFilter);function BC(e,t,n,r,i){var o=n-t,a=i-r,s;return o===0?r+a/2:a===0?r:(s=(e-t)/o,s=a*s+r,s)}const f8e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],d=u,h,m,y=this.enhance();if(y!==0){for(m=0;mi&&(i=o),l=t[m+1],ls&&(s=l),h=t[m+2],hd&&(d=h);i===r&&(i=255,r=0),s===a&&(s=255,a=0),d===u&&(d=255,u=0);var b,x,k,E,_,P,A,M,R;for(y>0?(x=i+y*(255-i),k=r-y*(r-0),_=s+y*(255-s),P=a-y*(a-0),M=d+y*(255-d),R=u-y*(u-0)):(b=(i+r)*.5,x=i+y*(i-b),k=r+y*(r-b),E=(s+a)*.5,_=s+y*(s-E),P=a+y*(a-E),A=(d+u)*.5,M=d+y*(d-A),R=u+y*(u-A)),m=0;mE?k:E;var _=a,P=o,A,M,R=360/P*Math.PI/180,D,j;for(M=0;MP?_:P;var A=a,M=o,R,D,j=n.polarRotation||0,z,H;for(d=0;dt&&(A=P,M=0,R=-1),i=0;i=0&&y=0&&b=0&&y=0&&b=255*4?255:0}return a}function k8e(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],s=0;s=0&&y