From 721a2554eaff520f97d848cadb8539a402e06882 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Fri, 28 Feb 2025 08:47:55 +0000 Subject: [PATCH] Deploying to gh-pages --- pr-241/assets/{index-Dl1GktK9.js => index-DT6VlfWq.js} | 2 +- pr-241/index.html | 2 +- pr-241/sw.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename pr-241/assets/{index-Dl1GktK9.js => index-DT6VlfWq.js} (99%) diff --git a/pr-241/assets/index-Dl1GktK9.js b/pr-241/assets/index-DT6VlfWq.js similarity index 99% rename from pr-241/assets/index-Dl1GktK9.js rename to pr-241/assets/index-DT6VlfWq.js index c7fbc28b..c88a8a13 100644 --- a/pr-241/assets/index-Dl1GktK9.js +++ b/pr-241/assets/index-DT6VlfWq.js @@ -44,7 +44,7 @@ Expected #hex, #hexa, rgb(), rgba(), hsl(), hsla(), object or number`)}function * (c) 2025 Eduardo San Martin Morote * @license MIT */let mx;const Af=e=>mx=e,hx=Symbol();function hp(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Tl;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Tl||(Tl={}));function m$(){const e=oc(!0),t=e.run(()=>le({}));let n=[],i=[];const a=ef({install(r){Af(a),a._a=r,r.provide(hx,a),r.config.globalProperties.$pinia=a,i.forEach(s=>n.push(s)),i=[]},use(r){return this._a?n.push(r):i.push(r),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return a}const px=()=>{};function r0(e,t,n,i=px){e.push(t);const a=()=>{const r=e.indexOf(t);r>-1&&(e.splice(r,1),i())};return!n&&Gp()&&An(a),a}function vs(e,...t){e.slice().forEach(n=>{n(...t)})}const h$=e=>e(),a0=Symbol(),Em=Symbol();function pp(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,i)=>e.set(i,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const i=t[n],a=e[n];hp(a)&&hp(i)&&e.hasOwnProperty(n)&&!Ct(i)&&!Or(i)?e[n]=pp(a,i):e[n]=i}return e}const p$=Symbol();function g$(e){return!hp(e)||!e.hasOwnProperty(p$)}const{assign:Qr}=Object;function v$(e){return!!(Ct(e)&&e.effect)}function y$(e,t,n,i){const{state:a,actions:r,getters:s}=t,o=n.state.value[e];let l;function c(){o||(n.state.value[e]=a?a():{});const u=lc(n.state.value[e]);return Qr(u,r,Object.keys(s||{}).reduce((d,f)=>(d[f]=ef(N(()=>{Af(n);const m=n._s.get(e);return s[f].call(m,m)})),d),{}))}return l=gx(e,c,t,n,i,!0),l}function gx(e,t,n={},i,a,r){let s;const o=Qr({actions:{}},n),l={deep:!0};let c,u,d=[],f=[],m;const p=i.state.value[e];!r&&!p&&(i.state.value[e]={}),le({});let g;function v(C){let E;c=u=!1,typeof C=="function"?(C(i.state.value[e]),E={type:Tl.patchFunction,storeId:e,events:m}):(pp(i.state.value[e],C),E={type:Tl.patchObject,payload:C,storeId:e,events:m});const A=g=Symbol();ct().then(()=>{g===A&&(c=!0)}),u=!0,vs(d,E,i.state.value[e])}const _=r?function(){const{state:E}=n,A=E?E():{};this.$patch(T=>{Qr(T,A)})}:px;function h(){s.stop(),d=[],f=[],i._s.delete(e)}const y=(C,E="")=>{if(a0 in C)return C[Em]=E,C;const A=function(){Af(i);const T=Array.from(arguments),I=[],S=[];function $(B){I.push(B)}function O(B){S.push(B)}vs(f,{args:T,name:A[Em],store:k,after:$,onError:O});let j;try{j=C.apply(this&&this.$id===e?this:k,T)}catch(B){throw vs(S,B),B}return j instanceof Promise?j.then(B=>(vs(I,B),B)).catch(B=>(vs(S,B),Promise.reject(B))):(vs(I,j),j)};return A[a0]=!0,A[Em]=E,A},b={_p:i,$id:e,$onAction:r0.bind(null,f),$patch:v,$reset:_,$subscribe(C,E={}){const A=r0(d,C,E.detached,()=>T()),T=s.run(()=>we(()=>i.state.value[e],I=>{(E.flush==="sync"?u:c)&&C({storeId:e,type:Tl.direct,events:m},I)},Qr({},l,E)));return A},$dispose:h},k=qt(b);i._s.set(e,k);const P=(i._a&&i._a.runWithContext||h$)(()=>i._e.run(()=>(s=oc()).run(()=>t({action:y}))));for(const C in P){const E=P[C];if(Ct(E)&&!v$(E)||Or(E))r||(p&&g$(E)&&(Ct(E)?E.value=p[C]:pp(E,p[C])),i.state.value[e][C]=E);else if(typeof E=="function"){const A=y(E,C);P[C]=A,o.actions[C]=E}}return Qr(k,P),Qr(Ne(k),P),Object.defineProperty(k,"$state",{get:()=>i.state.value[e],set:C=>{v(E=>{Qr(E,C)})}}),i._p.forEach(C=>{Qr(k,s.run(()=>C({store:k,app:i._a,pinia:i,options:o})))}),p&&r&&n.hydrate&&n.hydrate(k.$state,p),c=!0,u=!0,k}/*! #__NO_SIDE_EFFECTS__ */function _$(e,t,n){let i;const a=typeof t=="function";i=a?n:t;function r(s,o){const l=yP();return s=s||(l?Ye(hx,null):null),s&&Af(s),s=mx,s._s.has(e)||(a?gx(e,t,i,s):y$(e,i,s)),s._s.get(e)}return r.$id=e,r}function ev(e){const t=Ne(e),n={};for(const i in t){const a=t[i];a.effect?n[i]=N({get:()=>e[i],set(r){e[i]=r}}):(Ct(a)||Or(a))&&(n[i]=be(e,i))}return n}class b${constructor(){Ce(this,"_event_handlers",[]);Ce(this,"container");Ce(this,"_current_selected_terminal",null)}add_observer(t){this._event_handlers.push(t)}remove_observer(t){this._event_handlers.splice(this._event_handlers.indexOf(t),1)}set_container(t){this.container=t}_clear_terminal_selection(){this._current_selected_terminal=null}clicked_instance(t){this._clear_terminal_selection(),this._publish({type:"SELECT",selection:{type:"MODULE_INSTANCE",id:t}})}clicked_terminal(t,n){if(!this._current_selected_terminal){this._publish({type:"SELECT",selection:{type:"TERMINAL",terminal:t}}),this._current_selected_terminal={...t,module_instance_id:n};return}this._publish({type:"ADD_CONNECTION",connection:{providing_impl_name:t.type==="provide"?t.id:this._current_selected_terminal.id,providing_instance_id:t.type==="provide"?n:this._current_selected_terminal.module_instance_id,requirement_name:t.type==="requirement"?t.id:this._current_selected_terminal.id,requiring_instance_id:t.type==="requirement"?n:this._current_selected_terminal.module_instance_id}}),this.unselect()}unselect(){this._clear_terminal_selection(),this._publish({type:"SELECT",selection:{type:"NONE"}})}clicked_connection(t){this._clear_terminal_selection(),this._publish({type:"SELECT",selection:{type:"CONNECTION",id:t}})}_publish(t){this._event_handlers.forEach(n=>{n(t)})}}const Sc=_$("evbc",()=>{const e=le({type:"NONE"}),t=le(null),n=qt(new b$),i=le({});n.add_observer(u=>{u.type==="SELECT"&&(e.value=u.selection)});function a(u){t.value=u}const r=()=>!!t.value;return{available_configs:i,selection:e,current_config:t,config_context:n,setOpenedConfig:a,get_config_context:()=>n,get_selected_module_instance:()=>r()&&e.value.type==="MODULE_INSTANCE"?e.value.id:null,get_selected_terminal:()=>r()&&e.value.type==="TERMINAL"?e.value.terminal:null,get_selected_connection:()=>r()&&e.value.type==="CONNECTION"?e.value.id:null}});var s0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ga(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ad={exports:{}},ko={},Pm={},Am={},o0;function pt(){return o0||(o0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;const t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof s0<"u"?s0:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.3.18",isBrowser:n(),isUnminified:/param/.test((function(a){}).toString()),dblClickWindow:400,getAngle(a){return e.Konva.angleDeg?a*t:a},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isTransforming(){var a;return(a=e.Konva.Transformer)===null||a===void 0?void 0:a.isTransforming()},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(a){e.glob.Konva=a}};const i=a=>{e.Konva[a.prototype.getClassName()]=a};e._registerNode=i,e.Konva._injectGlobal(e.Konva)}(Am)),Am}var Tm={},l0;function nn(){return l0||(l0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=pt();class n{constructor(b=[1,0,0,1,0,0]){this.dirty=!1,this.m=b&&b.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 n(this.m)}copyInto(b){b.m[0]=this.m[0],b.m[1]=this.m[1],b.m[2]=this.m[2],b.m[3]=this.m[3],b.m[4]=this.m[4],b.m[5]=this.m[5]}point(b){const k=this.m;return{x:k[0]*b.x+k[2]*b.y+k[4],y:k[1]*b.x+k[3]*b.y+k[5]}}translate(b,k){return this.m[4]+=this.m[0]*b+this.m[2]*k,this.m[5]+=this.m[1]*b+this.m[3]*k,this}scale(b,k){return this.m[0]*=b,this.m[1]*=b,this.m[2]*=k,this.m[3]*=k,this}rotate(b){const k=Math.cos(b),w=Math.sin(b),P=this.m[0]*k+this.m[2]*w,C=this.m[1]*k+this.m[3]*w,E=this.m[0]*-w+this.m[2]*k,A=this.m[1]*-w+this.m[3]*k;return this.m[0]=P,this.m[1]=C,this.m[2]=E,this.m[3]=A,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(b,k){const w=this.m[0]+this.m[2]*k,P=this.m[1]+this.m[3]*k,C=this.m[2]+this.m[0]*b,E=this.m[3]+this.m[1]*b;return this.m[0]=w,this.m[1]=P,this.m[2]=C,this.m[3]=E,this}multiply(b){const k=this.m[0]*b.m[0]+this.m[2]*b.m[1],w=this.m[1]*b.m[0]+this.m[3]*b.m[1],P=this.m[0]*b.m[2]+this.m[2]*b.m[3],C=this.m[1]*b.m[2]+this.m[3]*b.m[3],E=this.m[0]*b.m[4]+this.m[2]*b.m[5]+this.m[4],A=this.m[1]*b.m[4]+this.m[3]*b.m[5]+this.m[5];return this.m[0]=k,this.m[1]=w,this.m[2]=P,this.m[3]=C,this.m[4]=E,this.m[5]=A,this}invert(){const b=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),k=this.m[3]*b,w=-this.m[1]*b,P=-this.m[2]*b,C=this.m[0]*b,E=b*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),A=b*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=k,this.m[1]=w,this.m[2]=P,this.m[3]=C,this.m[4]=E,this.m[5]=A,this}getMatrix(){return this.m}decompose(){const b=this.m[0],k=this.m[1],w=this.m[2],P=this.m[3],C=this.m[4],E=this.m[5],A=b*P-k*w,T={x:C,y:E,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(b!=0||k!=0){const I=Math.sqrt(b*b+k*k);T.rotation=k>0?Math.acos(b/I):-Math.acos(b/I),T.scaleX=I,T.scaleY=A/I,T.skewX=(b*w+k*P)/A,T.skewY=0}else if(w!=0||P!=0){const I=Math.sqrt(w*w+P*P);T.rotation=Math.PI/2-(P>0?Math.acos(-w/I):-Math.acos(w/I)),T.scaleX=A/I,T.scaleY=I,T.skewX=0,T.skewY=(b*w+k*P)/A}return T.rotation=e.Util._getRotation(T.rotation),T}}e.Transform=n;const i="[object Array]",a="[object Number]",r="[object String]",s="[object Boolean]",o=Math.PI/180,l=180/Math.PI,c="#",u="",d="0",f="Konva warning: ",m="Konva error: ",p="rgb(",g={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]},v=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let _=[];const h=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(y){setTimeout(y,60)};e.Util={_isElement(y){return!!(y&&y.nodeType==1)},_isFunction(y){return!!(y&&y.constructor&&y.call&&y.apply)},_isPlainObject(y){return!!y&&y.constructor===Object},_isArray(y){return Object.prototype.toString.call(y)===i},_isNumber(y){return Object.prototype.toString.call(y)===a&&!isNaN(y)&&isFinite(y)},_isString(y){return Object.prototype.toString.call(y)===r},_isBoolean(y){return Object.prototype.toString.call(y)===s},isObject(y){return y instanceof Object},isValidSelector(y){if(typeof y!="string")return!1;const b=y[0];return b==="#"||b==="."||b===b.toUpperCase()},_sign(y){return y===0||y>0?1:-1},requestAnimFrame(y){_.push(y),_.length===1&&h(function(){const b=_;_=[],b.forEach(function(k){k()})})},createCanvasElement(){const y=document.createElement("canvas");try{y.style=y.style||{}}catch{}return y},createImageElement(){return document.createElement("img")},_isInDocument(y){for(;y=y.parentNode;)if(y==document)return!0;return!1},_urlToImage(y,b){const k=e.Util.createImageElement();k.onload=function(){b(k)},k.src=y},_rgbToHex(y,b,k){return((1<<24)+(y<<16)+(b<<8)+k).toString(16).slice(1)},_hexToRgb(y){y=y.replace(c,u);const b=parseInt(y,16);return{r:b>>16&255,g:b>>8&255,b:b&255}},getRandomColor(){let y=(Math.random()*16777215<<0).toString(16);for(;y.length<6;)y=d+y;return c+y},getRGB(y){let b;return y in g?(b=g[y],{r:b[0],g:b[1],b:b[2]}):y[0]===c?this._hexToRgb(y.substring(1)):y.substr(0,4)===p?(b=v.exec(y.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},colorToRGBA(y){return y=y||"black",e.Util._namedColorToRBA(y)||e.Util._hex3ColorToRGBA(y)||e.Util._hex4ColorToRGBA(y)||e.Util._hex6ColorToRGBA(y)||e.Util._hex8ColorToRGBA(y)||e.Util._rgbColorToRGBA(y)||e.Util._rgbaColorToRGBA(y)||e.Util._hslColorToRGBA(y)},_namedColorToRBA(y){const b=g[y.toLowerCase()];return b?{r:b[0],g:b[1],b:b[2],a:1}:null},_rgbColorToRGBA(y){if(y.indexOf("rgb(")===0){y=y.match(/rgb\(([^)]+)\)/)[1];const b=y.split(/ *, */).map(Number);return{r:b[0],g:b[1],b:b[2],a:1}}},_rgbaColorToRGBA(y){if(y.indexOf("rgba(")===0){y=y.match(/rgba\(([^)]+)\)/)[1];const b=y.split(/ *, */).map((k,w)=>k.slice(-1)==="%"?w===3?parseInt(k)/100:parseInt(k)/100*255:Number(k));return{r:b[0],g:b[1],b:b[2],a:b[3]}}},_hex8ColorToRGBA(y){if(y[0]==="#"&&y.length===9)return{r:parseInt(y.slice(1,3),16),g:parseInt(y.slice(3,5),16),b:parseInt(y.slice(5,7),16),a:parseInt(y.slice(7,9),16)/255}},_hex6ColorToRGBA(y){if(y[0]==="#"&&y.length===7)return{r:parseInt(y.slice(1,3),16),g:parseInt(y.slice(3,5),16),b:parseInt(y.slice(5,7),16),a:1}},_hex4ColorToRGBA(y){if(y[0]==="#"&&y.length===5)return{r:parseInt(y[1]+y[1],16),g:parseInt(y[2]+y[2],16),b:parseInt(y[3]+y[3],16),a:parseInt(y[4]+y[4],16)/255}},_hex3ColorToRGBA(y){if(y[0]==="#"&&y.length===4)return{r:parseInt(y[1]+y[1],16),g:parseInt(y[2]+y[2],16),b:parseInt(y[3]+y[3],16),a:1}},_hslColorToRGBA(y){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(y)){const[b,...k]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(y),w=Number(k[0])/360,P=Number(k[1])/100,C=Number(k[2])/100;let E,A,T;if(P===0)return T=C*255,{r:Math.round(T),g:Math.round(T),b:Math.round(T),a:1};C<.5?E=C*(1+P):E=C+P-C*P;const I=2*C-E,S=[0,0,0];for(let $=0;$<3;$++)A=w+1/3*-($-1),A<0&&A++,A>1&&A--,6*A<1?T=I+(E-I)*6*A:2*A<1?T=E:3*A<2?T=I+(E-I)*(2/3-A)*6:T=I,S[$]=T*255;return{r:Math.round(S[0]),g:Math.round(S[1]),b:Math.round(S[2]),a:1}}},haveIntersection(y,b){return!(b.x>y.x+y.width||b.x+b.widthy.y+y.height||b.y+b.height1?(E=k,A=w,T=(k-P)*(k-P)+(w-C)*(w-C)):(E=y+S*(k-y),A=b+S*(w-b),T=(E-P)*(E-P)+(A-C)*(A-C))}return[E,A,T]},_getProjectionToLine(y,b,k){const w=e.Util.cloneObject(y);let P=Number.MAX_VALUE;return b.forEach(function(C,E){if(!k&&E===b.length-1)return;const A=b[(E+1)%b.length],T=e.Util._getProjectionToSegment(C.x,C.y,A.x,A.y,y.x,y.y),I=T[0],S=T[1],$=T[2];$b.length){const E=b;b=y,y=E}for(let E=0;E{b.width=0,b.height=0})},drawRoundedRectPath(y,b,k,w){let P=0,C=0,E=0,A=0;typeof w=="number"?P=C=E=A=Math.min(w,b/2,k/2):(P=Math.min(w[0]||0,b/2,k/2),C=Math.min(w[1]||0,b/2,k/2),A=Math.min(w[2]||0,b/2,k/2),E=Math.min(w[3]||0,b/2,k/2)),y.moveTo(P,0),y.lineTo(b-C,0),y.arc(b-C,C,C,Math.PI*3/2,0,!1),y.lineTo(b,k-A),y.arc(b-A,k-A,A,0,Math.PI/2,!1),y.lineTo(E,k),y.arc(E,k-E,E,Math.PI/2,Math.PI,!1),y.lineTo(0,P),y.arc(P,P,P,Math.PI,Math.PI*3/2,!1)}}}(Tm)),Tm}var So={},Om={},Qn={},c0;function vt(){if(c0)return Qn;c0=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.RGBComponent=i,Qn.alphaComponent=a,Qn.getNumberValidator=r,Qn.getNumberOrArrayOfNumbersValidator=s,Qn.getNumberOrAutoValidator=o,Qn.getStringValidator=l,Qn.getStringOrGradientValidator=c,Qn.getFunctionValidator=u,Qn.getNumberArrayValidator=d,Qn.getBooleanValidator=f,Qn.getComponentValidator=m;const e=pt(),t=nn();function n(p){return t.Util._isString(p)?'"'+p+'"':Object.prototype.toString.call(p)==="[object Number]"||t.Util._isBoolean(p)?p:Object.prototype.toString.call(p)}function i(p){return p>255?255:p<0?0:Math.round(p)}function a(p){return p>1?1:p<1e-4?1e-4:p}function r(){if(e.Konva.isUnminified)return function(p,g){return t.Util._isNumber(p)||t.Util.warn(n(p)+' is a not valid value for "'+g+'" attribute. The value should be a number.'),p}}function s(p){if(e.Konva.isUnminified)return function(g,v){let _=t.Util._isNumber(g),h=t.Util._isArray(g)&&g.length==p;return!_&&!h&&t.Util.warn(n(g)+' is a not valid value for "'+v+'" attribute. The value should be a number or Array('+p+")"),g}}function o(){if(e.Konva.isUnminified)return function(p,g){var v=t.Util._isNumber(p),_=p==="auto";return v||_||t.Util.warn(n(p)+' is a not valid value for "'+g+'" attribute. The value should be a number or "auto".'),p}}function l(){if(e.Konva.isUnminified)return function(p,g){return t.Util._isString(p)||t.Util.warn(n(p)+' is a not valid value for "'+g+'" attribute. The value should be a string.'),p}}function c(){if(e.Konva.isUnminified)return function(p,g){const v=t.Util._isString(p),_=Object.prototype.toString.call(p)==="[object CanvasGradient]"||p&&p.addColorStop;return v||_||t.Util.warn(n(p)+' is a not valid value for "'+g+'" attribute. The value should be a string or a native gradient.'),p}}function u(){if(e.Konva.isUnminified)return function(p,g){return t.Util._isFunction(p)||t.Util.warn(n(p)+' is a not valid value for "'+g+'" attribute. The value should be a function.'),p}}function d(){if(e.Konva.isUnminified)return function(p,g){const v=Int8Array?Object.getPrototypeOf(Int8Array):null;return v&&p instanceof v||(t.Util._isArray(p)?p.forEach(function(_){t.Util._isNumber(_)||t.Util.warn('"'+g+'" attribute has non numeric element '+_+". Make sure that all elements are numbers.")}):t.Util.warn(n(p)+' is a not valid value for "'+g+'" attribute. The value should be a array of numbers.')),p}}function f(){if(e.Konva.isUnminified)return function(p,g){var v=p===!0||p===!1;return v||t.Util.warn(n(p)+' is a not valid value for "'+g+'" attribute. The value should be a boolean.'),p}}function m(p){if(e.Konva.isUnminified)return function(g,v){return g==null||t.Util.isObject(g)||t.Util.warn(n(g)+' is a not valid value for "'+v+'" attribute. The value should be an object with properties '+p),g}}return Qn}var u0;function gt(){return u0||(u0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=nn(),n=vt(),i="get",a="set";e.Factory={addGetterSetter(r,s,o,l,c){e.Factory.addGetter(r,s,o),e.Factory.addSetter(r,s,l,c),e.Factory.addOverloadedGetterSetter(r,s)},addGetter(r,s,o){var l=i+t.Util._capitalize(s);r.prototype[l]=r.prototype[l]||function(){const c=this.attrs[s];return c===void 0?o:c}},addSetter(r,s,o,l){var c=a+t.Util._capitalize(s);r.prototype[c]||e.Factory.overWriteSetter(r,s,o,l)},overWriteSetter(r,s,o,l){var c=a+t.Util._capitalize(s);r.prototype[c]=function(u){return o&&u!==void 0&&u!==null&&(u=o.call(this,u,s)),this._setAttr(s,u),l&&l.call(this),this}},addComponentsGetterSetter(r,s,o,l,c){const u=o.length,d=t.Util._capitalize,f=i+d(s),m=a+d(s);r.prototype[f]=function(){const g={};for(let v=0;v{this._setAttr(s+d(_),void 0)}),this._fireChangeEvent(s,v,g),c&&c.call(this),this},e.Factory.addOverloadedGetterSetter(r,s)},addOverloadedGetterSetter(r,s){var o=t.Util._capitalize(s),l=a+o,c=i+o;r.prototype[s]=function(){return arguments.length?(this[l](arguments[0]),this):this[c]()}},addDeprecatedGetterSetter(r,s,o,l){t.Util.error("Adding deprecated "+s);const c=i+t.Util._capitalize(s),u=s+" property is deprecated and will be removed soon. Look at Konva change log for more information.";r.prototype[c]=function(){t.Util.error(u);const d=this.attrs[s];return d===void 0?o:d},e.Factory.addSetter(r,s,l,function(){t.Util.error(u)}),e.Factory.addOverloadedGetterSetter(r,s)},backCompat(r,s){t.Util.each(s,function(o,l){const c=r.prototype[l],u=i+t.Util._capitalize(o),d=a+t.Util._capitalize(o);function f(){c.apply(this,arguments),t.Util.error('"'+o+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}r.prototype[o]=f,r.prototype[u]=f,r.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}}(Om)),Om}var yr={},_r={},d0;function vx(){if(d0)return _r;d0=1,Object.defineProperty(_r,"__esModule",{value:!0}),_r.HitContext=_r.SceneContext=_r.Context=void 0;const e=nn(),t=pt();function n(_){const h=[],y=_.length,b=e.Util;for(let k=0;ktypeof T=="number"?Math.floor(T):T)),w+=a+A.join(i)+r)):(w+=C.property,h||(w+=u+C.val)),w+=l;return w}clearTrace(){this.traceArr=[]}_trace(h){let y=this.traceArr,b;y.push(h),b=y.length,b>=m&&y.shift()}reset(){const h=this.getCanvas().getPixelRatio();this.setTransform(1*h,0,0,1*h,0,0)}getCanvas(){return this.canvas}clear(h){const y=this.getCanvas();h?this.clearRect(h.x||0,h.y||0,h.width||0,h.height||0):this.clearRect(0,0,y.getWidth()/y.pixelRatio,y.getHeight()/y.pixelRatio)}_applyLineCap(h){const y=h.attrs.lineCap;y&&this.setAttr("lineCap",y)}_applyOpacity(h){const y=h.getAbsoluteOpacity();y!==1&&this.setAttr("globalAlpha",y)}_applyLineJoin(h){const y=h.attrs.lineJoin;y&&this.setAttr("lineJoin",y)}setAttr(h,y){this._context[h]=y}arc(h,y,b,k,w,P){this._context.arc(h,y,b,k,w,P)}arcTo(h,y,b,k,w){this._context.arcTo(h,y,b,k,w)}beginPath(){this._context.beginPath()}bezierCurveTo(h,y,b,k,w,P){this._context.bezierCurveTo(h,y,b,k,w,P)}clearRect(h,y,b,k){this._context.clearRect(h,y,b,k)}clip(...h){this._context.clip.apply(this._context,h)}closePath(){this._context.closePath()}createImageData(h,y){const b=arguments;if(b.length===2)return this._context.createImageData(h,y);if(b.length===1)return this._context.createImageData(h)}createLinearGradient(h,y,b,k){return this._context.createLinearGradient(h,y,b,k)}createPattern(h,y){return this._context.createPattern(h,y)}createRadialGradient(h,y,b,k,w,P){return this._context.createRadialGradient(h,y,b,k,w,P)}drawImage(h,y,b,k,w,P,C,E,A){const T=arguments,I=this._context;T.length===3?I.drawImage(h,y,b):T.length===5?I.drawImage(h,y,b,k,w):T.length===9&&I.drawImage(h,y,b,k,w,P,C,E,A)}ellipse(h,y,b,k,w,P,C,E){this._context.ellipse(h,y,b,k,w,P,C,E)}isPointInPath(h,y,b,k){return b?this._context.isPointInPath(b,h,y,k):this._context.isPointInPath(h,y,k)}fill(...h){this._context.fill.apply(this._context,h)}fillRect(h,y,b,k){this._context.fillRect(h,y,b,k)}strokeRect(h,y,b,k){this._context.strokeRect(h,y,b,k)}fillText(h,y,b,k){k?this._context.fillText(h,y,b,k):this._context.fillText(h,y,b)}measureText(h){return this._context.measureText(h)}getImageData(h,y,b,k){return this._context.getImageData(h,y,b,k)}lineTo(h,y){this._context.lineTo(h,y)}moveTo(h,y){this._context.moveTo(h,y)}rect(h,y,b,k){this._context.rect(h,y,b,k)}roundRect(h,y,b,k,w){this._context.roundRect(h,y,b,k,w)}putImageData(h,y,b){this._context.putImageData(h,y,b)}quadraticCurveTo(h,y,b,k){this._context.quadraticCurveTo(h,y,b,k)}restore(){this._context.restore()}rotate(h){this._context.rotate(h)}save(){this._context.save()}scale(h,y){this._context.scale(h,y)}setLineDash(h){this._context.setLineDash?this._context.setLineDash(h):"mozDash"in this._context?this._context.mozDash=h:"webkitLineDash"in this._context&&(this._context.webkitLineDash=h)}getLineDash(){return this._context.getLineDash()}setTransform(h,y,b,k,w,P){this._context.setTransform(h,y,b,k,w,P)}stroke(h){h?this._context.stroke(h):this._context.stroke()}strokeText(h,y,b,k){this._context.strokeText(h,y,b,k)}transform(h,y,b,k,w,P){this._context.transform(h,y,b,k,w,P)}translate(h,y){this._context.translate(h,y)}_enableTrace(){let h=this,y=d.length,b=this.setAttr,k,w;const P=function(C){let E=h[C],A;h[C]=function(){return w=n(Array.prototype.slice.call(arguments,0)),A=E.apply(h,arguments),h._trace({method:C,args:w}),A}};for(k=0;k{a.dragStatus==="dragging"&&(i=!0)}),i},justDragged:!1,get node(){let i;return e.DD._dragElements.forEach(a=>{i=a.node}),i},_dragElements:new Map,_drag(i){const a=[];e.DD._dragElements.forEach((r,s)=>{const{node:o}=r,l=o.getStage();l.setPointersPositions(i),r.pointerId===void 0&&(r.pointerId=n.Util._getFirstPointerId(i));const c=l._changedPointerPositions.find(u=>u.id===r.pointerId);if(c){if(r.dragStatus!=="dragging"){const u=o.dragDistance();if(Math.max(Math.abs(c.x-r.startPointerPos.x),Math.abs(c.y-r.startPointerPos.y)){r.fire("dragmove",{type:"dragmove",target:r,evt:i},!0)})},_endDragBefore(i){const a=[];e.DD._dragElements.forEach(r=>{const{node:s}=r,o=s.getStage();if(i&&o.setPointersPositions(i),!o._changedPointerPositions.find(u=>u.id===r.pointerId))return;(r.dragStatus==="dragging"||r.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,r.dragStatus="stopped");const c=r.node.getLayer()||r.node instanceof t.Konva.Stage&&r.node;c&&a.indexOf(c)===-1&&a.push(c)}),a.forEach(r=>{r.draw()})},_endDragAfter(i){e.DD._dragElements.forEach((a,r)=>{a.dragStatus==="stopped"&&a.node.fire("dragend",{type:"dragend",target:a.node,evt:i},!0),a.dragStatus!=="dragging"&&e.DD._dragElements.delete(r)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("touchcancel",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1),window.addEventListener("touchcancel",e.DD._endDragAfter,!1))}($m)),$m}var h0;function on(){if(h0)return So;h0=1,Object.defineProperty(So,"__esModule",{value:!0}),So.Node=void 0;const e=nn(),t=gt(),n=Tf(),i=pt(),a=tv(),r=vt(),s="absoluteOpacity",o="allEventListeners",l="absoluteTransform",c="absoluteScale",u="canvas",d="Change",f="children",m="konva",p="listening",g="mouseenter",v="mouseleave",_="set",h="Shape",y=" ",b="stage",k="transform",w="Stage",P="visible",C=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(y);let E=1;class A{constructor(S){this._id=E++,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(S),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(S){(S===k||S===l)&&this._cache.get(S)?this._cache.get(S).dirty=!0:S?this._cache.delete(S):this._cache.clear()}_getCache(S,$){let O=this._cache.get(S);return(O===void 0||(S===k||S===l)&&O.dirty===!0)&&(O=$.call(this),this._cache.set(S,O)),O}_calculate(S,$,O){if(!this._attachedDepsListeners.get(S)){const j=$.map(B=>B+"Change.konva").join(y);this.on(j,()=>{this._clearCache(S)}),this._attachedDepsListeners.set(S,!0)}return this._getCache(S,O)}_getCanvasCache(){return this._cache.get(u)}_clearSelfAndDescendantCache(S){this._clearCache(S),S===l&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(u)){const{scene:S,filter:$,hit:O}=this._cache.get(u);e.Util.releaseCanvas(S,$,O),this._cache.delete(u)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(S){const $=S||{};let O={};($.x===void 0||$.y===void 0||$.width===void 0||$.height===void 0)&&(O=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let j=Math.ceil($.width||O.width),B=Math.ceil($.height||O.height),Y=$.pixelRatio,X=$.x===void 0?Math.floor(O.x):$.x,z=$.y===void 0?Math.floor(O.y):$.y,M=$.offset||0,q=$.drawBorder||!1,F=$.hitCanvasPixelRatio||1;if(!j||!B){e.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const R=Math.abs(Math.round(O.x)-X)>.5?1:0,U=Math.abs(Math.round(O.y)-z)>.5?1:0;j+=M*2+R,B+=M*2+U,X-=M,z-=M;const H=new n.SceneCanvas({pixelRatio:Y,width:j,height:B}),D=new n.SceneCanvas({pixelRatio:Y,width:0,height:0,willReadFrequently:!0}),G=new n.HitCanvas({pixelRatio:F,width:j,height:B}),J=H.getContext(),Q=G.getContext();return G.isCache=!0,H.isCache=!0,this._cache.delete(u),this._filterUpToDate=!1,$.imageSmoothingEnabled===!1&&(H.getContext()._context.imageSmoothingEnabled=!1,D.getContext()._context.imageSmoothingEnabled=!1),J.save(),Q.save(),J.translate(-X,-z),Q.translate(-X,-z),this._isUnderCache=!0,this._clearSelfAndDescendantCache(s),this._clearSelfAndDescendantCache(c),this.drawScene(H,this),this.drawHit(G,this),this._isUnderCache=!1,J.restore(),Q.restore(),q&&(J.save(),J.beginPath(),J.rect(0,0,j,B),J.closePath(),J.setAttr("strokeStyle","red"),J.setAttr("lineWidth",5),J.stroke(),J.restore()),this._cache.set(u,{scene:H,filter:D,hit:G,x:X,y:z}),this._requestDraw(),this}isCached(){return this._cache.has(u)}getClientRect(S){throw new Error('abstract "getClientRect" method call')}_transformedRect(S,$){const O=[{x:S.x,y:S.y},{x:S.x+S.width,y:S.y},{x:S.x+S.width,y:S.y+S.height},{x:S.x,y:S.y+S.height}];let j=1/0,B=1/0,Y=-1/0,X=-1/0;const z=this.getAbsoluteTransform($);return O.forEach(function(M){const q=z.point(M);j===void 0&&(j=Y=q.x,B=X=q.y),j=Math.min(j,q.x),B=Math.min(B,q.y),Y=Math.max(Y,q.x),X=Math.max(X,q.y)}),{x:j,y:B,width:Y-j,height:X-B}}_drawCachedSceneCanvas(S){S.save(),S._applyOpacity(this),S._applyGlobalCompositeOperation(this);const $=this._getCanvasCache();S.translate($.x,$.y);const O=this._getCachedSceneCanvas(),j=O.pixelRatio;S.drawImage(O._canvas,0,0,O.width/j,O.height/j),S.restore()}_drawCachedHitCanvas(S){const $=this._getCanvasCache(),O=$.hit;S.save(),S.translate($.x,$.y),S.drawImage(O._canvas,0,0,O.width/O.pixelRatio,O.height/O.pixelRatio),S.restore()}_getCachedSceneCanvas(){let S=this.filters(),$=this._getCanvasCache(),O=$.scene,j=$.filter,B=j.getContext(),Y,X,z,M;if(S){if(!this._filterUpToDate){const q=O.pixelRatio;j.setSize(O.width/O.pixelRatio,O.height/O.pixelRatio);try{for(Y=S.length,B.clear(),B.drawImage(O._canvas,0,0,O.getWidth()/q,O.getHeight()/q),X=B.getImageData(0,0,j.getWidth(),j.getHeight()),z=0;z{let $,O;if(!S)return this;for($ in S)$!==f&&(O=_+e.Util._capitalize($),e.Util._isFunction(this[O])?this[O](S[$]):this._setAttr($,S[$]))}),this}isListening(){return this._getCache(p,this._isListening)}_isListening(S){if(!this.listening())return!1;const O=this.getParent();return O&&O!==S&&this!==S?O._isListening(S):!0}isVisible(){return this._getCache(P,this._isVisible)}_isVisible(S){if(!this.visible())return!1;const O=this.getParent();return O&&O!==S&&this!==S?O._isVisible(S):!0}shouldDrawHit(S,$=!1){if(S)return this._isVisible(S)&&this._isListening(S);const O=this.getLayer();let j=!1;a.DD._dragElements.forEach(Y=>{Y.dragStatus==="dragging"&&(Y.node.nodeType==="Stage"||Y.node.getLayer()===O)&&(j=!0)});const B=!$&&!i.Konva.hitOnDragEnabled&&(j||i.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!B}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let S=this.getDepth(),$=this,O=0,j,B,Y,X;function z(q){for(j=[],B=q.length,Y=0;Y0&&j[0].getDepth()<=S&&z(j)}const M=this.getStage();return $.nodeType!==w&&M&&z(M.getChildren()),O}getDepth(){let S=0,$=this.parent;for(;$;)S++,$=$.parent;return S}_batchTransformChanges(S){this._batchingTransformChange=!0,S(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(k),this._clearSelfAndDescendantCache(l)),this._needClearTransformCache=!1}setPosition(S){return this._batchTransformChanges(()=>{this.x(S.x),this.y(S.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const S=this.getStage();if(!S)return null;const $=S.getPointerPosition();if(!$)return null;const O=this.getAbsoluteTransform().copy();return O.invert(),O.point($)}getAbsolutePosition(S){let $=!1,O=this.parent;for(;O;){if(O.isCached()){$=!0;break}O=O.parent}$&&!S&&(S=!0);const j=this.getAbsoluteTransform(S).getMatrix(),B=new e.Transform,Y=this.offset();return B.m=j.slice(),B.translate(Y.x,Y.y),B.getTranslation()}setAbsolutePosition(S){const{x:$,y:O,...j}=this._clearTransform();this.attrs.x=$,this.attrs.y=O,this._clearCache(k);const B=this._getAbsoluteTransform().copy();return B.invert(),B.translate(S.x,S.y),S={x:this.attrs.x+B.getTranslation().x,y:this.attrs.y+B.getTranslation().y},this._setTransform(j),this.setPosition({x:S.x,y:S.y}),this._clearCache(k),this._clearSelfAndDescendantCache(l),this}_setTransform(S){let $;for($ in S)this.attrs[$]=S[$]}_clearTransform(){const S={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,S}move(S){let $=S.x,O=S.y,j=this.x(),B=this.y();return $!==void 0&&(j+=$),O!==void 0&&(B+=O),this.setPosition({x:j,y:B}),this}_eachAncestorReverse(S,$){let O=[],j=this.getParent(),B,Y;if(!($&&$._id===this._id)){for(O.unshift(this);j&&(!$||j._id!==$._id);)O.unshift(j),j=j.parent;for(B=O.length,Y=0;Y0?(this.parent.children.splice(S,1),this.parent.children.splice(S-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return e.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const S=this.index;return S>0?(this.parent.children.splice(S,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(S){if(!this.parent)return e.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(S<0||S>=this.parent.children.length)&&e.Util.warn("Unexpected value "+S+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const $=this.index;return this.parent.children.splice($,1),this.parent.children.splice(S,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(s,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let S=this.opacity();const $=this.getParent();return $&&!$._isUnderCache&&(S*=$.getAbsoluteOpacity()),S}moveTo(S){return this.getParent()!==S&&(this._remove(),S.add(this)),this}toObject(){let S=this.getAttrs(),$,O,j,B,Y;const X={attrs:{},className:this.getClassName()};for($ in S)O=S[$],Y=e.Util.isObject(O)&&!e.Util._isPlainObject(O)&&!e.Util._isArray(O),!Y&&(j=typeof this[$]=="function"&&this[$],delete S[$],B=j?j.call(this):null,S[$]=O,B!==O&&(X.attrs[$]=O));return e.Util._prepareToStringify(X)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(S,$,O){const j=[];$&&this._isMatch(S)&&j.push(this);let B=this.parent;for(;B;){if(B===O)return j;B._isMatch(S)&&j.push(B),B=B.parent}return j}isAncestorOf(S){return!1}findAncestor(S,$,O){return this.findAncestors(S,$,O)[0]}_isMatch(S){if(!S)return!1;if(typeof S=="function")return S(this);let $=S.replace(/ /g,"").split(","),O=$.length,j,B;for(j=0;j{try{const j=S==null?void 0:S.callback;j&&delete S.callback,e.Util._urlToImage(this.toDataURL(S),function(B){$(B),j==null||j(B)})}catch(j){O(j)}})}toBlob(S){return new Promise(($,O)=>{try{const j=S==null?void 0:S.callback;j&&delete S.callback,this.toCanvas(S).toBlob(B=>{$(B),j==null||j(B)},S==null?void 0:S.mimeType,S==null?void 0:S.quality)}catch(j){O(j)}})}setSize(S){return this.width(S.width),this.height(S.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():i.Konva.dragDistance}_off(S,$,O){let j=this.eventListeners[S],B,Y,X;for(B=0;B=0)||this.isDragging())return;let j=!1;a.DD._dragElements.forEach(B=>{this.isAncestorOf(B.node)&&(j=!0)}),j||this._createDragElement(S)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const $=a.DD._dragElements.get(this._id),O=$&&$.dragStatus==="dragging",j=$&&$.dragStatus==="ready";O?this.stopDrag():j&&a.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(S={x:0,y:0}){const $=this.getStage();if(!$)return!1;const O={x:-S.x,y:-S.y,width:$.width()+2*S.x,height:$.height()+2*S.y};return e.Util.haveIntersection(O,this.getClientRect())}static create(S,$){return e.Util._isString(S)&&(S=JSON.parse(S)),this._createNode(S,$)}static _createNode(S,$){let O=A.prototype.getClassName.call(S),j=S.children,B,Y,X;$&&(S.attrs.container=$),i.Konva[O]||(e.Util.warn('Can not find a node with class name "'+O+'". Fallback to "Shape".'),O="Shape");const z=i.Konva[O];if(B=new z(S.attrs),j)for(Y=j.length,X=0;X0}removeChildren(){return this.getChildren().forEach(r=>{r.parent=null,r.index=0,r.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(r=>{r.parent=null,r.index=0,r.destroy()}),this.children=[],this._requestDraw(),this}add(...r){if(r.length===0)return this;if(r.length>1){for(let o=0;o0?s[0]:void 0}_generalFind(r,s){const o=[];return this._descendants(l=>{const c=l._isMatch(r);return c&&o.push(l),!!(c&&s)}),o}_descendants(r){let s=!1;const o=this.getChildren();for(const l of o){if(s=r(l),s)return!0;if(l.hasChildren()&&(s=l._descendants(r),s))return!0}return!1}toObject(){const r=t.Node.prototype.toObject.call(this);return r.children=[],this.getChildren().forEach(s=>{r.children.push(s.toObject())}),r}isAncestorOf(r){let s=r.getParent();for(;s;){if(s._id===this._id)return!0;s=s.getParent()}return!1}clone(r){const s=t.Node.prototype.clone.call(this,r);return this.getChildren().forEach(function(o){s.add(o.clone())}),s}getAllIntersections(r){const s=[];return this.find("Shape").forEach(o=>{o.isVisible()&&o.intersects(r)&&s.push(o)}),s}_clearSelfAndDescendantCache(r){var s;super._clearSelfAndDescendantCache(r),!this.isCached()&&((s=this.children)===null||s===void 0||s.forEach(function(o){o._clearSelfAndDescendantCache(r)}))}_setChildrenIndices(){var r;(r=this.children)===null||r===void 0||r.forEach(function(s,o){s.index=o}),this._requestDraw()}drawScene(r,s,o){const l=this.getLayer(),c=r||l&&l.getCanvas(),u=c&&c.getContext(),d=this._getCanvasCache(),f=d&&d.scene,m=c&&c.isCache;if(!this.isVisible()&&!m)return this;if(f){u.save();const p=this.getAbsoluteTransform(s).getMatrix();u.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedSceneCanvas(u),u.restore()}else this._drawChildren("drawScene",c,s,o);return this}drawHit(r,s){if(!this.shouldDrawHit(s))return this;const o=this.getLayer(),l=r||o&&o.hitCanvas,c=l&&l.getContext(),u=this._getCanvasCache();if(u&&u.hit){c.save();const f=this.getAbsoluteTransform(s).getMatrix();c.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedHitCanvas(c),c.restore()}else this._drawChildren("drawHit",l,s);return this}_drawChildren(r,s,o,l){var c;const u=s&&s.getContext(),d=this.clipWidth(),f=this.clipHeight(),m=this.clipFunc(),p=typeof d=="number"&&typeof f=="number"||m,g=o===this;if(p){u.save();const _=this.getAbsoluteTransform(o);let h=_.getMatrix();u.transform(h[0],h[1],h[2],h[3],h[4],h[5]),u.beginPath();let y;if(m)y=m.call(this,u,this);else{const b=this.clipX(),k=this.clipY();u.rect(b||0,k||0,d,f)}u.clip.apply(u,y),h=_.copy().invert().getMatrix(),u.transform(h[0],h[1],h[2],h[3],h[4],h[5])}const v=!g&&this.globalCompositeOperation()!=="source-over"&&r==="drawScene";v&&(u.save(),u._applyGlobalCompositeOperation(this)),(c=this.children)===null||c===void 0||c.forEach(function(_){_[r](s,o,l)}),v&&u.restore(),p&&u.restore()}getClientRect(r={}){var s;const o=r.skipTransform,l=r.relativeTo;let c,u,d,f,m={x:1/0,y:1/0,width:0,height:0};const p=this;(s=this.children)===null||s===void 0||s.forEach(function(_){if(!_.visible())return;const h=_.getClientRect({relativeTo:p,skipShadow:r.skipShadow,skipStroke:r.skipStroke});h.width===0&&h.height===0||(c===void 0?(c=h.x,u=h.y,d=h.x+h.width,f=h.y+h.height):(c=Math.min(c,h.x),u=Math.min(u,h.y),d=Math.max(d,h.x+h.width),f=Math.max(f,h.y+h.height)))});const g=this.find("Shape");let v=!1;for(let _=0;_H.indexOf("pointer")>=0?"pointer":H.indexOf("touch")>=0?"touch":"mouse",q=H=>{const D=M(H);if(D==="pointer")return a.Konva.pointerEventsEnabled&&z.pointer;if(D==="touch")return z.touch;if(D==="mouse")return z.mouse};function F(H={}){return(H.clipFunc||H.clipWidth||H.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),H}const R="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);";e.stages=[];class U extends i.Container{constructor(D){super(F(D)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{F(this.attrs)}),this._checkVisibility()}_validateAdd(D){const G=D.getType()==="Layer",J=D.getType()==="FastLayer";G||J||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const D=this.visible()?"":"none";this.content.style.display=D}setContainer(D){if(typeof D===u){if(D.charAt(0)==="."){const J=D.slice(1);D=document.getElementsByClassName(J)[0]}else{var G;D.charAt(0)!=="#"?G=D:G=D.slice(1),D=document.getElementById(G)}if(!D)throw"Can not find container in document with id "+G}return this._setAttr("container",D),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),D.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const D=this.children,G=D.length;for(let J=0;J-1&&e.stages.splice(G,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const D=this._pointerPositions[0]||this._changedPointerPositions[0];return D?{x:D.x,y:D.y}:(t.Util.warn(R),null)}_getPointerById(D){return this._pointerPositions.find(G=>G.id===D)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(D){D=D||{},D.x=D.x||0,D.y=D.y||0,D.width=D.width||this.width(),D.height=D.height||this.height();const G=new r.SceneCanvas({width:D.width,height:D.height,pixelRatio:D.pixelRatio||1}),J=G.getContext()._context,Q=this.children;return(D.x||D.y)&&J.translate(-1*D.x,-1*D.y),Q.forEach(function(W){if(!W.isVisible())return;const V=W._toKonvaCanvas(D);J.drawImage(V._canvas,D.x,D.y,V.getWidth()/V.getPixelRatio(),V.getHeight()/V.getPixelRatio())}),G}getIntersection(D){if(!D)return null;const G=this.children,J=G.length,Q=J-1;for(let W=Q;W>=0;W--){const V=G[W].getIntersection(D);if(V)return V}return null}_resizeDOM(){const D=this.width(),G=this.height();this.content&&(this.content.style.width=D+d,this.content.style.height=G+d),this.bufferCanvas.setSize(D,G),this.bufferHitCanvas.setSize(D,G),this.children.forEach(J=>{J.setSize({width:D,height:G}),J.draw()})}add(D,...G){if(arguments.length>1){for(let Q=0;QY&&t.Util.warn("The stage has "+J+" 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."),D.setSize({width:this.width(),height:this.height()}),D.draw(),a.Konva.isBrowser&&this.content.appendChild(D.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(D){return l.hasPointerCapture(D,this)}setPointerCapture(D){l.setPointerCapture(D,this)}releaseCapture(D){l.releaseCapture(D,this)}getLayers(){return this.children}_bindContentEvents(){a.Konva.isBrowser&&X.forEach(([D,G])=>{this.content.addEventListener(D,J=>{this[G](J)},{passive:!1})})}_pointerenter(D){this.setPointersPositions(D);const G=q(D.type);G&&this._fire(G.pointerenter,{evt:D,target:this,currentTarget:this})}_pointerover(D){this.setPointersPositions(D);const G=q(D.type);G&&this._fire(G.pointerover,{evt:D,target:this,currentTarget:this})}_getTargetShape(D){let G=this[D+"targetShape"];return G&&!G.getStage()&&(G=null),G}_pointerleave(D){const G=q(D.type),J=M(D.type);if(!G)return;this.setPointersPositions(D);const Q=this._getTargetShape(J),W=!(a.Konva.isDragging()||a.Konva.isTransforming())||a.Konva.hitOnDragEnabled;Q&&W?(Q._fireAndBubble(G.pointerout,{evt:D}),Q._fireAndBubble(G.pointerleave,{evt:D}),this._fire(G.pointerleave,{evt:D,target:this,currentTarget:this}),this[J+"targetShape"]=null):W&&(this._fire(G.pointerleave,{evt:D,target:this,currentTarget:this}),this._fire(G.pointerout,{evt:D,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(D){const G=q(D.type),J=M(D.type);if(!G)return;this.setPointersPositions(D);let Q=!1;this._changedPointerPositions.forEach(W=>{const V=this.getIntersection(W);if(s.DD.justDragged=!1,a.Konva["_"+J+"ListenClick"]=!0,!V||!V.isListening()){this[J+"ClickStartShape"]=void 0;return}a.Konva.capturePointerEventsEnabled&&V.setPointerCapture(W.id),this[J+"ClickStartShape"]=V,V._fireAndBubble(G.pointerdown,{evt:D,pointerId:W.id}),Q=!0;const L=D.type.indexOf("touch")>=0;V.preventDefault()&&D.cancelable&&L&&D.preventDefault()}),Q||this._fire(G.pointerdown,{evt:D,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(D){const G=q(D.type),J=M(D.type);if(!G||(a.Konva.isDragging()&&s.DD.node.preventDefault()&&D.cancelable&&D.preventDefault(),this.setPointersPositions(D),!(!(a.Konva.isDragging()||a.Konva.isTransforming())||a.Konva.hitOnDragEnabled)))return;const W={};let V=!1;const L=this._getTargetShape(J);this._changedPointerPositions.forEach(K=>{const Z=l.getCapturedShape(K.id)||this.getIntersection(K),ne=K.id,ie={evt:D,pointerId:ne},ue=L!==Z;if(ue&&L&&(L._fireAndBubble(G.pointerout,{...ie},Z),L._fireAndBubble(G.pointerleave,{...ie},Z)),Z){if(W[Z._id])return;W[Z._id]=!0}Z&&Z.isListening()?(V=!0,ue&&(Z._fireAndBubble(G.pointerover,{...ie},L),Z._fireAndBubble(G.pointerenter,{...ie},L),this[J+"targetShape"]=Z),Z._fireAndBubble(G.pointermove,{...ie})):L&&(this._fire(G.pointerover,{evt:D,target:this,currentTarget:this,pointerId:ne}),this[J+"targetShape"]=null)}),V||this._fire(G.pointermove,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(D){const G=q(D.type),J=M(D.type);if(!G)return;this.setPointersPositions(D);const Q=this[J+"ClickStartShape"],W=this[J+"ClickEndShape"],V={};let L=!1;this._changedPointerPositions.forEach(K=>{const Z=l.getCapturedShape(K.id)||this.getIntersection(K);if(Z){if(Z.releaseCapture(K.id),V[Z._id])return;V[Z._id]=!0}const ne=K.id,ie={evt:D,pointerId:ne};let ue=!1;a.Konva["_"+J+"InDblClickWindow"]?(ue=!0,clearTimeout(this[J+"DblTimeout"])):s.DD.justDragged||(a.Konva["_"+J+"InDblClickWindow"]=!0,clearTimeout(this[J+"DblTimeout"])),this[J+"DblTimeout"]=setTimeout(function(){a.Konva["_"+J+"InDblClickWindow"]=!1},a.Konva.dblClickWindow),Z&&Z.isListening()?(L=!0,this[J+"ClickEndShape"]=Z,Z._fireAndBubble(G.pointerup,{...ie}),a.Konva["_"+J+"ListenClick"]&&Q&&Q===Z&&(Z._fireAndBubble(G.pointerclick,{...ie}),ue&&W&&W===Z&&Z._fireAndBubble(G.pointerdblclick,{...ie}))):(this[J+"ClickEndShape"]=null,a.Konva["_"+J+"ListenClick"]&&this._fire(G.pointerclick,{evt:D,target:this,currentTarget:this,pointerId:ne}),ue&&this._fire(G.pointerdblclick,{evt:D,target:this,currentTarget:this,pointerId:ne}))}),L||this._fire(G.pointerup,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),a.Konva["_"+J+"ListenClick"]=!1,D.cancelable&&J!=="touch"&&J!=="pointer"&&D.preventDefault()}_contextmenu(D){this.setPointersPositions(D);const G=this.getIntersection(this.getPointerPosition());G&&G.isListening()?G._fireAndBubble(I,{evt:D}):this._fire(I,{evt:D,target:this,currentTarget:this})}_wheel(D){this.setPointersPositions(D);const G=this.getIntersection(this.getPointerPosition());G&&G.isListening()?G._fireAndBubble(B,{evt:D}):this._fire(B,{evt:D,target:this,currentTarget:this})}_pointercancel(D){this.setPointersPositions(D);const G=l.getCapturedShape(D.pointerId)||this.getIntersection(this.getPointerPosition());G&&G._fireAndBubble(k,l.createEvent(D)),l.releaseCapture(D.pointerId)}_lostpointercapture(D){l.releaseCapture(D.pointerId)}setPointersPositions(D){const G=this._getContentPosition();let J=null,Q=null;D=D||window.event,D.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(D.touches,W=>{this._pointerPositions.push({id:W.identifier,x:(W.clientX-G.left)/G.scaleX,y:(W.clientY-G.top)/G.scaleY})}),Array.prototype.forEach.call(D.changedTouches||D.touches,W=>{this._changedPointerPositions.push({id:W.identifier,x:(W.clientX-G.left)/G.scaleX,y:(W.clientY-G.top)/G.scaleY})})):(J=(D.clientX-G.left)/G.scaleX,Q=(D.clientY-G.top)/G.scaleY,this.pointerPos={x:J,y:Q},this._pointerPositions=[{x:J,y:Q,id:t.Util._getFirstPointerId(D)}],this._changedPointerPositions=[{x:J,y:Q,id:t.Util._getFirstPointerId(D)}])}_setPointerPosition(D){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(D)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const D=this.content.getBoundingClientRect();return{top:D.top,left:D.left,scaleX:D.width/this.content.clientWidth||1,scaleY:D.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new r.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new r.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!a.Konva.isBrowser)return;const D=this.container();if(!D)throw"Stage has no container. A container is required.";D.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"),D.appendChild(this.content),this._resizeDOM()}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(D){D.batchDraw()}),this}}e.Stage=U,U.prototype.nodeType=c,(0,o._registerNode)(U),n.Factory.addGetterSetter(U,"container"),a.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{e.stages.forEach(H=>{H.batchDraw()})})}(Im)),Im}var xo={},Mm={},y0;function Sn(){return y0||(y0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=pt(),n=nn(),i=gt(),a=on(),r=vt(),s=pt(),o=yx(),l="hasShadow",c="shadowRGBA",u="patternImage",d="linearGradient",f="radialGradient";let m;function p(){return m||(m=n.Util.createCanvasElement().getContext("2d"),m)}e.shapes={};function g(E){const A=this.attrs.fillRule;A?E.fill(A):E.fill()}function v(E){E.stroke()}function _(E){const A=this.attrs.fillRule;A?E.fill(A):E.fill()}function h(E){E.stroke()}function y(){this._clearCache(l)}function b(){this._clearCache(c)}function k(){this._clearCache(u)}function w(){this._clearCache(d)}function P(){this._clearCache(f)}class C extends a.Node{constructor(A){super(A);let T;for(;T=n.Util.getRandomColor(),!(T&&!(T in e.shapes)););this.colorKey=T,e.shapes[T]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(u,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const T=p().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(T&&T.setTransform){const I=new n.Transform;I.translate(this.fillPatternX(),this.fillPatternY()),I.rotate(t.Konva.getAngle(this.fillPatternRotation())),I.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),I.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const S=I.getMatrix(),$=typeof DOMMatrix>"u"?{a:S[0],b:S[1],c:S[2],d:S[3],e:S[4],f:S[5]}:new DOMMatrix(S);T.setTransform($)}return T}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){const A=this.fillLinearGradientColorStops();if(A){const T=p(),I=this.fillLinearGradientStartPoint(),S=this.fillLinearGradientEndPoint(),$=T.createLinearGradient(I.x,I.y,S.x,S.y);for(let O=0;Othis.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 A=this.hitStrokeWidth();return A==="auto"?this.hasStroke():this.strokeEnabled()&&!!A}intersects(A){const T=this.getStage();if(!T)return!1;const I=T.bufferHitCanvas;return I.getContext().clear(),this.drawHit(I,void 0,!0),I.context.getImageData(Math.round(A.x),Math.round(A.y),1,1).data[3]>0}destroy(){return a.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(A){var T;if(!((T=this.attrs.perfectDrawEnabled)!==null&&T!==void 0?T:!0))return!1;const S=A||this.hasFill(),$=this.hasStroke(),O=this.getAbsoluteOpacity()!==1;if(S&&$&&O)return!0;const j=this.hasShadow(),B=this.shadowForStrokeEnabled();return!!(S&&$&&j&&B)}setStrokeHitEnabled(A){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),A?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const A=this.size();return{x:this._centroid?-A.width/2:0,y:this._centroid?-A.height/2:0,width:A.width,height:A.height}}getClientRect(A={}){let T=!1,I=this.getParent();for(;I;){if(I.isCached()){T=!0;break}I=I.getParent()}const S=A.skipTransform,$=A.relativeTo||T&&this.getStage()||void 0,O=this.getSelfRect(),B=!A.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,Y=O.width+B,X=O.height+B,z=!A.skipShadow&&this.hasShadow(),M=z?this.shadowOffsetX():0,q=z?this.shadowOffsetY():0,F=Y+Math.abs(M),R=X+Math.abs(q),U=z&&this.shadowBlur()||0,H=F+U*2,D=R+U*2,G={width:H,height:D,x:-(B/2+U)+Math.min(M,0)+O.x,y:-(B/2+U)+Math.min(q,0)+O.y};return S?G:this._transformedRect(G,$)}drawScene(A,T,I){const S=this.getLayer();let $=A||S.getCanvas(),O=$.getContext(),j=this._getCanvasCache(),B=this.getSceneFunc(),Y=this.hasShadow(),X,z;const M=$.isCache,q=T===this;if(!this.isVisible()&&!q)return this;if(j){O.save();const R=this.getAbsoluteTransform(T).getMatrix();return O.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedSceneCanvas(O),O.restore(),this}if(!B)return this;if(O.save(),this._useBufferCanvas()&&!M){X=this.getStage();const R=I||X.bufferCanvas;z=R.getContext(),z.clear(),z.save(),z._applyLineJoin(this);var F=this.getAbsoluteTransform(T).getMatrix();z.transform(F[0],F[1],F[2],F[3],F[4],F[5]),B.call(this,z,this),z.restore();const U=R.pixelRatio;Y&&O._applyShadow(this),O._applyOpacity(this),O._applyGlobalCompositeOperation(this),O.drawImage(R._canvas,0,0,R.width/U,R.height/U)}else{if(O._applyLineJoin(this),!q){var F=this.getAbsoluteTransform(T).getMatrix();O.transform(F[0],F[1],F[2],F[3],F[4],F[5]),O._applyOpacity(this),O._applyGlobalCompositeOperation(this)}Y&&O._applyShadow(this),B.call(this,O,this)}return O.restore(),this}drawHit(A,T,I=!1){if(!this.shouldDrawHit(T,I))return this;const S=this.getLayer(),$=A||S.hitCanvas,O=$&&$.getContext(),j=this.hitFunc()||this.sceneFunc(),B=this._getCanvasCache(),Y=B&&B.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),Y){O.save();const z=this.getAbsoluteTransform(T).getMatrix();return O.transform(z[0],z[1],z[2],z[3],z[4],z[5]),this._drawCachedHitCanvas(O),O.restore(),this}if(!j)return this;if(O.save(),O._applyLineJoin(this),!(this===T)){const z=this.getAbsoluteTransform(T).getMatrix();O.transform(z[0],z[1],z[2],z[3],z[4],z[5])}return j.call(this,O,this),O.restore(),this}drawHitFromCache(A=0){const T=this._getCanvasCache(),I=this._getCachedSceneCanvas(),S=T.hit,$=S.getContext(),O=S.getWidth(),j=S.getHeight();$.clear(),$.drawImage(I._canvas,0,0,O,j);try{const B=$.getImageData(0,0,O,j),Y=B.data,X=Y.length,z=n.Util._hexToRgb(this.colorKey);for(let M=0;MA?(Y[M]=z.r,Y[M+1]=z.g,Y[M+2]=z.b,Y[M+3]=255):Y[M+3]=0;$.putImageData(B,0,0)}catch(B){n.Util.error("Unable to draw hit graph from cached scene canvas. "+B.message)}return this}hasPointerCapture(A){return o.hasPointerCapture(A,this)}setPointerCapture(A){o.setPointerCapture(A,this)}releaseCapture(A){o.releaseCapture(A,this)}}e.Shape=C,C.prototype._fillFunc=g,C.prototype._strokeFunc=v,C.prototype._fillFuncHit=_,C.prototype._strokeFuncHit=h,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,s._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",y),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",k),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",w),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",P),i.Factory.addGetterSetter(C,"stroke",void 0,(0,r.getStringOrGradientValidator)()),i.Factory.addGetterSetter(C,"strokeWidth",2,(0,r.getNumberValidator)()),i.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),i.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,r.getNumberOrAutoValidator)()),i.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,r.getBooleanValidator)()),i.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,r.getBooleanValidator)()),i.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,r.getBooleanValidator)()),i.Factory.addGetterSetter(C,"lineJoin"),i.Factory.addGetterSetter(C,"lineCap"),i.Factory.addGetterSetter(C,"sceneFunc"),i.Factory.addGetterSetter(C,"hitFunc"),i.Factory.addGetterSetter(C,"dash"),i.Factory.addGetterSetter(C,"dashOffset",0,(0,r.getNumberValidator)()),i.Factory.addGetterSetter(C,"shadowColor",void 0,(0,r.getStringValidator)()),i.Factory.addGetterSetter(C,"shadowBlur",0,(0,r.getNumberValidator)()),i.Factory.addGetterSetter(C,"shadowOpacity",1,(0,r.getNumberValidator)()),i.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),i.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,r.getNumberValidator)()),i.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,r.getNumberValidator)()),i.Factory.addGetterSetter(C,"fillPatternImage"),i.Factory.addGetterSetter(C,"fill",void 0,(0,r.getStringOrGradientValidator)()),i.Factory.addGetterSetter(C,"fillPatternX",0,(0,r.getNumberValidator)()),i.Factory.addGetterSetter(C,"fillPatternY",0,(0,r.getNumberValidator)()),i.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),i.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),i.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),i.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),i.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),i.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),i.Factory.addGetterSetter(C,"fillEnabled",!0),i.Factory.addGetterSetter(C,"strokeEnabled",!0),i.Factory.addGetterSetter(C,"shadowEnabled",!0),i.Factory.addGetterSetter(C,"dashEnabled",!0),i.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),i.Factory.addGetterSetter(C,"fillPriority","color"),i.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),i.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,r.getNumberValidator)()),i.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,r.getNumberValidator)()),i.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),i.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,r.getNumberValidator)()),i.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,r.getNumberValidator)()),i.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),i.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),i.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),i.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),i.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),i.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),i.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),i.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),i.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),i.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),i.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),i.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),i.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),i.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),i.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),i.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),i.Factory.addGetterSetter(C,"fillPatternRotation",0),i.Factory.addGetterSetter(C,"fillRule",void 0,(0,r.getStringValidator)()),i.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})}(Mm)),Mm}var _0;function _x(){if(_0)return xo;_0=1,Object.defineProperty(xo,"__esModule",{value:!0}),xo.Layer=void 0;const e=nn(),t=Of(),n=on(),i=gt(),a=Tf(),r=vt(),s=Sn(),o=pt(),l="#",c="beforeDraw",u="draw",d=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],f=d.length;let m=class extends t.Container{constructor(g){super(g),this.canvas=new a.SceneCanvas,this.hitCanvas=new a.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(g){return this.getContext().clear(g),this.getHitCanvas().getContext().clear(g),this}setZIndex(g){super.setZIndex(g);const v=this.getStage();return v&&v.content&&(v.content.removeChild(this.getNativeCanvasElement()),g{this.draw(),this._waitingForDraw=!1})),this}getIntersection(g){if(!this.isListening()||!this.isVisible())return null;let v=1,_=!1;for(;;){for(let h=0;h0)return{antialiased:!0};return{}}drawScene(g,v){const _=this.getLayer(),h=g||_&&_.getCanvas();return this._fire(c,{node:this}),this.clearBeforeDraw()&&h.getContext().clear(),t.Container.prototype.drawScene.call(this,h,v),this._fire(u,{node:this}),this}drawHit(g,v){const _=this.getLayer(),h=g||_&&_.hitCanvas;return _&&_.clearBeforeDraw()&&_.getHitCanvas().getContext().clear(),t.Container.prototype.drawHit.call(this,h,v),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(g){e.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(g)}getHitGraphEnabled(g){return e.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const g=this.parent;!!this.hitCanvas._canvas.parentNode?g.content.removeChild(this.hitCanvas._canvas):g.content.appendChild(this.hitCanvas._canvas)}destroy(){return e.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};return xo.Layer=m,m.prototype.nodeType="Layer",(0,o._registerNode)(m),i.Factory.addGetterSetter(m,"imageSmoothingEnabled",!0),i.Factory.addGetterSetter(m,"clearBeforeDraw",!0),i.Factory.addGetterSetter(m,"hitGraphEnabled",!0,(0,r.getBooleanValidator)()),xo}var Eo={},b0;function k$(){if(b0)return Eo;b0=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.FastLayer=void 0;const e=nn(),t=_x(),n=pt();let i=class extends t.Layer{constructor(r){super(r),this.listening(!1),e.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};return Eo.FastLayer=i,i.prototype.nodeType="FastLayer",(0,n._registerNode)(i),Eo}var Po={},w0;function nv(){if(w0)return Po;w0=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.Group=void 0;const e=nn(),t=Of(),n=pt();let i=class extends t.Container{_validateAdd(r){const s=r.getType();s!=="Group"&&s!=="Shape"&&e.Util.throw("You may only add groups and shapes to groups.")}};return Po.Group=i,i.prototype.nodeType="Group",(0,n._registerNode)(i),Po}var Ao={},k0;function iv(){if(k0)return Ao;k0=1,Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.Animation=void 0;const e=pt(),t=nn(),n=function(){return e.glob.performance&&e.glob.performance.now?function(){return e.glob.performance.now()}:function(){return new Date().getTime()}}();let i=class $s{constructor(r,s){this.id=$s.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:n(),frameRate:0},this.func=r,this.setLayers(s)}setLayers(r){let s=[];return r&&(s=Array.isArray(r)?r:[r]),this.layers=s,this}getLayers(){return this.layers}addLayer(r){const s=this.layers,o=s.length;for(let l=0;lthis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=o,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const p=this.getTimer()-this._startTime;this.state===o?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=s,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){const g=this,v=p.node,_=v._id,h=p.easing||e.Easings.Linear,y=!!p.yoyo;let b,k;typeof p.duration>"u"?b=.3:p.duration===0?b=.001:b=p.duration,this.node=v,this._id=u++;const w=v.getLayer()||(v instanceof a.Konva.Stage?v.getLayers():null);w||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){g.tween.onEnterFrame()},w),this.tween=new d(k,function(P){g._tweenFunc(P)},h,0,1,b*1e3,y),this._addListeners(),f.attrs[_]||(f.attrs[_]={}),f.attrs[_][this._id]||(f.attrs[_][this._id]={}),f.tweens[_]||(f.tweens[_]={});for(k in p)r[k]===void 0&&this._addAttr(k,p[k]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,g){const v=this.node,_=v._id;let h,y,b,k,w;const P=f.tweens[_][p];P&&delete f.attrs[_][P][p];let C=v.getAttr(p);if(t.Util._isArray(g))if(h=[],y=Math.max(g.length,C.length),p==="points"&&g.length!==C.length&&(g.length>C.length?(k=C,C=t.Util._prepareArrayForTween(C,g,v.closed())):(b=g,g=t.Util._prepareArrayForTween(g,C,v.closed()))),p.indexOf("fill")===0)for(let E=0;E{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const p=this.node,g=f.attrs[p._id][this._id];g.points&&g.points.trueEnd&&p.setAttr("points",g.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const p=this.node,g=f.attrs[p._id][this._id];g.points&&g.points.trueStart&&p.points(g.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(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const p=this.node._id,g=this._id,v=f.tweens[p];this.pause();for(const _ in v)delete f.tweens[p][_];delete f.attrs[p][g]}}e.Tween=f,f.attrs={},f.tweens={},i.Node.prototype.to=function(m){const p=m.onFinish;m.node=this,m.onFinish=function(){this.destroy(),p&&p()},new f(m).play()},e.Easings={BackEaseIn(m,p,g,v){return g*(m/=v)*m*((1.70158+1)*m-1.70158)+p},BackEaseOut(m,p,g,v){return g*((m=m/v-1)*m*((1.70158+1)*m+1.70158)+1)+p},BackEaseInOut(m,p,g,v){let _=1.70158;return(m/=v/2)<1?g/2*(m*m*(((_*=1.525)+1)*m-_))+p:g/2*((m-=2)*m*(((_*=1.525)+1)*m+_)+2)+p},ElasticEaseIn(m,p,g,v,_,h){let y=0;return m===0?p:(m/=v)===1?p+g:(h||(h=v*.3),!_||_0?o:l),v=f*l,_=m*(m>0?o:l),h=p*(p>0?l:o);return{x:g,y:c?-1*h:_,width:v-g,height:h-_}}};return To.Arc=r,r.prototype._centroid=!0,r.prototype.className="Arc",r.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,a._registerNode)(r),e.Factory.addGetterSetter(r,"innerRadius",0,(0,i.getNumberValidator)()),e.Factory.addGetterSetter(r,"outerRadius",0,(0,i.getNumberValidator)()),e.Factory.addGetterSetter(r,"angle",0,(0,i.getNumberValidator)()),e.Factory.addGetterSetter(r,"clockwise",!1,(0,i.getBooleanValidator)()),To}var Oo={},$o={},E0;function bx(){if(E0)return $o;E0=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.Line=void 0;const e=gt(),t=pt(),n=Sn(),i=vt();function a(o,l,c,u,d,f,m){const p=Math.sqrt(Math.pow(c-o,2)+Math.pow(u-l,2)),g=Math.sqrt(Math.pow(d-c,2)+Math.pow(f-u,2)),v=m*p/(p+g),_=m*g/(p+g),h=c-v*(d-o),y=u-v*(f-l),b=c+_*(d-o),k=u+_*(f-l);return[h,y,b,k]}function r(o,l){const c=o.length,u=[];for(let d=2;d4){for(p=this.getTensionPoints(),g=p.length,v=f?0:4,f||l.quadraticCurveTo(p[0],p[1],p[2],p[3]);v{let c,u;const f=l/2;c=0;for(let m=0;m<20;m++)u=f*e.tValues[20][m]+f,c+=e.cValues[20][m]*i(s,o,u);return f*c};e.getCubicArcLength=t;const n=(s,o,l)=>{l===void 0&&(l=1);const c=s[0]-2*s[1]+s[2],u=o[0]-2*o[1]+o[2],d=2*s[1]-2*s[0],f=2*o[1]-2*o[0],m=4*(c*c+u*u),p=4*(c*d+u*f),g=d*d+f*f;if(m===0)return l*Math.sqrt(Math.pow(s[2]-s[0],2)+Math.pow(o[2]-o[0],2));const v=p/(2*m),_=g/m,h=l+v,y=_-v*v,b=h*h+y>0?Math.sqrt(h*h+y):0,k=v*v+y>0?Math.sqrt(v*v+y):0,w=v+Math.sqrt(v*v+y)!==0?y*Math.log(Math.abs((h+b)/(v+k))):0;return Math.sqrt(m)/2*(h*b-v*k+w)};e.getQuadraticArcLength=n;function i(s,o,l){const c=a(1,l,s),u=a(1,l,o),d=c*c+u*u;return Math.sqrt(d)}const a=(s,o,l)=>{const c=l.length-1;let u,d;if(c===0)return 0;if(s===0){d=0;for(let f=0;f<=c;f++)d+=e.binomialCoefficients[c][f]*Math.pow(1-o,c-f)*Math.pow(o,f)*l[f];return d}else{u=new Array(c);for(let f=0;f{let c=1,u=s/o,d=(s-l(u))/o,f=0;for(;c>.001;){const m=l(u+d),p=Math.abs(s-m)/o;if(p500)break}return u};e.t2length=r}(Vm)),Vm}var A0;function rv(){if(A0)return Io;A0=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.Path=void 0;const e=gt(),t=Sn(),n=pt(),i=E$();let a=class ti extends t.Shape{constructor(s){super(s),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ti.parsePathData(this.data()),this.pathLength=ti.getPathLength(this.dataArray)}_sceneFunc(s){const o=this.dataArray;s.beginPath();let l=!1;for(let b=0;bf?d:f,h=d>f?1:d/f,y=d>f?f/d:1;s.translate(c,u),s.rotate(g),s.scale(h,y),s.arc(0,0,_,m,m+p,1-v),s.scale(1/h,1/y),s.rotate(-g),s.translate(-c,-u);break;case"z":l=!0,s.closePath();break}}!l&&!this.hasFill()?s.strokeShape(this):s.fillStrokeShape(this)}getSelfRect(){let s=[];this.dataArray.forEach(function(m){if(m.command==="A"){const p=m.points[4],g=m.points[5],v=m.points[4]+g;let _=Math.PI/180;if(Math.abs(p-v)<_&&(_=Math.abs(p-v)),g<0)for(let h=p-_;h>v;h-=_){const y=ti.getPointOnEllipticalArc(m.points[0],m.points[1],m.points[2],m.points[3],h,0);s.push(y.x,y.y)}else for(let h=p+_;ho[c].pathLength;)s-=o[c].pathLength,++c;if(c===u)return l=o[c-1].points.slice(-2),{x:l[0],y:l[1]};if(s<.01)return l=o[c].points.slice(0,2),{x:l[0],y:l[1]};const d=o[c],f=d.points;switch(d.command){case"L":return ti.getPointOnLine(s,d.start.x,d.start.y,f[0],f[1]);case"C":return ti.getPointOnCubicBezier((0,i.t2length)(s,ti.getPathLength(o),b=>(0,i.getCubicArcLength)([d.start.x,f[0],f[2],f[4]],[d.start.y,f[1],f[3],f[5]],b)),d.start.x,d.start.y,f[0],f[1],f[2],f[3],f[4],f[5]);case"Q":return ti.getPointOnQuadraticBezier((0,i.t2length)(s,ti.getPathLength(o),b=>(0,i.getQuadraticArcLength)([d.start.x,f[0],f[2]],[d.start.y,f[1],f[3]],b)),d.start.x,d.start.y,f[0],f[1],f[2],f[3]);case"A":var m=f[0],p=f[1],g=f[2],v=f[3],_=f[4],h=f[5],y=f[6];return _+=h*s/d.pathLength,ti.getPointOnEllipticalArc(m,p,g,v,_,y)}return null}static getPointOnLine(s,o,l,c,u,d,f){d=d??o,f=f??l;const m=this.getLineLength(o,l,c,u);if(m<1e-10)return{x:o,y:l};if(c===o)return{x:d,y:f+(u>l?s:-s)};const p=(u-l)/(c-o),g=Math.sqrt(s*s/(1+p*p))*(c0&&!isNaN(O[0]);){let j="",B=[];const Y=m,X=p;var _,h,y,b,k,w,P,C,E,A;switch($){case"l":m+=O.shift(),p+=O.shift(),j="L",B.push(m,p);break;case"L":m=O.shift(),p=O.shift(),B.push(m,p);break;case"m":var T=O.shift(),I=O.shift();if(m+=T,p+=I,j="M",d.length>2&&d[d.length-1].command==="z"){for(let z=d.length-2;z>=0;z--)if(d[z].command==="M"){m=d[z].points[0]+T,p=d[z].points[1]+I;break}}B.push(m,p),$="l";break;case"M":m=O.shift(),p=O.shift(),j="M",B.push(m,p),$="L";break;case"h":m+=O.shift(),j="L",B.push(m,p);break;case"H":m=O.shift(),j="L",B.push(m,p);break;case"v":p+=O.shift(),j="L",B.push(m,p);break;case"V":p=O.shift(),j="L",B.push(m,p);break;case"C":B.push(O.shift(),O.shift(),O.shift(),O.shift()),m=O.shift(),p=O.shift(),B.push(m,p);break;case"c":B.push(m+O.shift(),p+O.shift(),m+O.shift(),p+O.shift()),m+=O.shift(),p+=O.shift(),j="C",B.push(m,p);break;case"S":h=m,y=p,_=d[d.length-1],_.command==="C"&&(h=m+(m-_.points[2]),y=p+(p-_.points[3])),B.push(h,y,O.shift(),O.shift()),m=O.shift(),p=O.shift(),j="C",B.push(m,p);break;case"s":h=m,y=p,_=d[d.length-1],_.command==="C"&&(h=m+(m-_.points[2]),y=p+(p-_.points[3])),B.push(h,y,m+O.shift(),p+O.shift()),m+=O.shift(),p+=O.shift(),j="C",B.push(m,p);break;case"Q":B.push(O.shift(),O.shift()),m=O.shift(),p=O.shift(),B.push(m,p);break;case"q":B.push(m+O.shift(),p+O.shift()),m+=O.shift(),p+=O.shift(),j="Q",B.push(m,p);break;case"T":h=m,y=p,_=d[d.length-1],_.command==="Q"&&(h=m+(m-_.points[0]),y=p+(p-_.points[1])),m=O.shift(),p=O.shift(),j="Q",B.push(h,y,m,p);break;case"t":h=m,y=p,_=d[d.length-1],_.command==="Q"&&(h=m+(m-_.points[0]),y=p+(p-_.points[1])),m+=O.shift(),p+=O.shift(),j="Q",B.push(h,y,m,p);break;case"A":b=O.shift(),k=O.shift(),w=O.shift(),P=O.shift(),C=O.shift(),E=m,A=p,m=O.shift(),p=O.shift(),j="A",B=this.convertEndpointToCenterParameterization(E,A,m,p,P,C,b,k,w);break;case"a":b=O.shift(),k=O.shift(),w=O.shift(),P=O.shift(),C=O.shift(),E=m,A=p,m+=O.shift(),p+=O.shift(),j="A",B=this.convertEndpointToCenterParameterization(E,A,m,p,P,C,b,k,w);break}d.push({command:j||$,points:B,start:{x:Y,y:X},pathLength:this.calcLength(Y,X,j||$,B)})}($==="z"||$==="Z")&&d.push({command:"z",points:[],start:void 0,pathLength:0})}return d}static calcLength(s,o,l,c){let u,d,f,m;const p=ti;switch(l){case"L":return p.getLineLength(s,o,c[0],c[1]);case"C":return(0,i.getCubicArcLength)([s,c[0],c[2],c[4]],[o,c[1],c[3],c[5]],1);case"Q":return(0,i.getQuadraticArcLength)([s,c[0],c[2]],[o,c[1],c[3]],1);case"A":u=0;var g=c[4],v=c[5],_=c[4]+v,h=Math.PI/180;if(Math.abs(g-_)_;m-=h)f=p.getPointOnEllipticalArc(c[0],c[1],c[2],c[3],m,0),u+=p.getLineLength(d.x,d.y,f.x,f.y),d=f;else for(m=g+h;m<_;m+=h)f=p.getPointOnEllipticalArc(c[0],c[1],c[2],c[3],m,0),u+=p.getLineLength(d.x,d.y,f.x,f.y),d=f;return f=p.getPointOnEllipticalArc(c[0],c[1],c[2],c[3],_,0),u+=p.getLineLength(d.x,d.y,f.x,f.y),u}return 0}static convertEndpointToCenterParameterization(s,o,l,c,u,d,f,m,p){const g=p*(Math.PI/180),v=Math.cos(g)*(s-l)/2+Math.sin(g)*(o-c)/2,_=-1*Math.sin(g)*(s-l)/2+Math.cos(g)*(o-c)/2,h=v*v/(f*f)+_*_/(m*m);h>1&&(f*=Math.sqrt(h),m*=Math.sqrt(h));let y=Math.sqrt((f*f*(m*m)-f*f*(_*_)-m*m*(v*v))/(f*f*(_*_)+m*m*(v*v)));u===d&&(y*=-1),isNaN(y)&&(y=0);const b=y*f*_/m,k=y*-m*v/f,w=(s+l)/2+Math.cos(g)*b-Math.sin(g)*k,P=(o+c)/2+Math.sin(g)*b+Math.cos(g)*k,C=function(O){return Math.sqrt(O[0]*O[0]+O[1]*O[1])},E=function(O,j){return(O[0]*j[0]+O[1]*j[1])/(C(O)*C(j))},A=function(O,j){return(O[0]*j[1]=1&&($=0),d===0&&$>0&&($=$-2*Math.PI),d===1&&$<0&&($=$+2*Math.PI),[w,P,f,m,T,$,g,d]}};return Io.Path=a,a.prototype.className="Path",a.prototype._attrsAffectingSize=["data"],(0,n._registerNode)(a),e.Factory.addGetterSetter(a,"data"),Io}var T0;function P$(){if(T0)return Oo;T0=1,Object.defineProperty(Oo,"__esModule",{value:!0}),Oo.Arrow=void 0;const e=gt(),t=bx(),n=vt(),i=pt(),a=rv();let r=class extends t.Line{_sceneFunc(o){super._sceneFunc(o);const l=Math.PI*2,c=this.points();let u=c;const d=this.tension()!==0&&c.length>4;d&&(u=this.getTensionPoints());const f=this.pointerLength(),m=c.length;let p,g;if(d){const h=[u[u.length-4],u[u.length-3],u[u.length-2],u[u.length-1],c[m-2],c[m-1]],y=a.Path.calcLength(u[u.length-4],u[u.length-3],"C",h),b=a.Path.getPointOnQuadraticBezier(Math.min(1,1-f/y),h[0],h[1],h[2],h[3],h[4],h[5]);p=c[m-2]-b.x,g=c[m-1]-b.y}else p=c[m-2]-c[m-4],g=c[m-1]-c[m-3];const v=(Math.atan2(g,p)+l)%l,_=this.pointerWidth();this.pointerAtEnding()&&(o.save(),o.beginPath(),o.translate(c[m-2],c[m-1]),o.rotate(v),o.moveTo(0,0),o.lineTo(-f,_/2),o.lineTo(-f,-_/2),o.closePath(),o.restore(),this.__fillStroke(o)),this.pointerAtBeginning()&&(o.save(),o.beginPath(),o.translate(c[0],c[1]),d?(p=(u[0]+u[2])/2-c[0],g=(u[1]+u[3])/2-c[1]):(p=c[2]-c[0],g=c[3]-c[1]),o.rotate((Math.atan2(-g,-p)+l)%l),o.moveTo(0,0),o.lineTo(-f,_/2),o.lineTo(-f,-_/2),o.closePath(),o.restore(),this.__fillStroke(o))}__fillStroke(o){const l=this.dashEnabled();l&&(this.attrs.dashEnabled=!1,o.setLineDash([])),o.fillStrokeShape(this),l&&(this.attrs.dashEnabled=!0)}getSelfRect(){const o=super.getSelfRect(),l=this.pointerWidth()/2;return{x:o.x,y:o.y-l,width:o.width,height:o.height+l*2}}};return Oo.Arrow=r,r.prototype.className="Arrow",(0,i._registerNode)(r),e.Factory.addGetterSetter(r,"pointerLength",10,(0,n.getNumberValidator)()),e.Factory.addGetterSetter(r,"pointerWidth",10,(0,n.getNumberValidator)()),e.Factory.addGetterSetter(r,"pointerAtBeginning",!1),e.Factory.addGetterSetter(r,"pointerAtEnding",!0),Oo}var Mo={},O0;function A$(){if(O0)return Mo;O0=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.Circle=void 0;const e=gt(),t=Sn(),n=vt(),i=pt();let a=class extends t.Shape{_sceneFunc(s){s.beginPath(),s.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),s.closePath(),s.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(s){this.radius()!==s/2&&this.radius(s/2)}setHeight(s){this.radius()!==s/2&&this.radius(s/2)}};return Mo.Circle=a,a.prototype._centroid=!0,a.prototype.className="Circle",a.prototype._attrsAffectingSize=["radius"],(0,i._registerNode)(a),e.Factory.addGetterSetter(a,"radius",0,(0,n.getNumberValidator)()),Mo}var Ro={},$0;function T$(){if($0)return Ro;$0=1,Object.defineProperty(Ro,"__esModule",{value:!0}),Ro.Ellipse=void 0;const e=gt(),t=Sn(),n=vt(),i=pt();let a=class extends t.Shape{_sceneFunc(s){const o=this.radiusX(),l=this.radiusY();s.beginPath(),s.save(),o!==l&&s.scale(1,l/o),s.arc(0,0,o,0,Math.PI*2,!1),s.restore(),s.closePath(),s.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(s){this.radiusX(s/2)}setHeight(s){this.radiusY(s/2)}};return Ro.Ellipse=a,a.prototype.className="Ellipse",a.prototype._centroid=!0,a.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,i._registerNode)(a),e.Factory.addComponentsGetterSetter(a,"radius",["x","y"]),e.Factory.addGetterSetter(a,"radiusX",0,(0,n.getNumberValidator)()),e.Factory.addGetterSetter(a,"radiusY",0,(0,n.getNumberValidator)()),Ro}var Vo={},I0;function O$(){if(I0)return Vo;I0=1,Object.defineProperty(Vo,"__esModule",{value:!0}),Vo.Image=void 0;const e=nn(),t=gt(),n=Sn(),i=pt(),a=vt();class r extends n.Shape{constructor(o){super(o),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const o=this.image();o&&o.complete||o&&o.readyState===4||o&&o.addEventListener&&o.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){const o=!!this.cornerRadius(),l=this.hasShadow();return o&&l?!0:super._useBufferCanvas(!0)}_sceneFunc(o){const l=this.getWidth(),c=this.getHeight(),u=this.cornerRadius(),d=this.attrs.image;let f;if(d){const m=this.attrs.cropWidth,p=this.attrs.cropHeight;m&&p?f=[d,this.cropX(),this.cropY(),m,p,0,0,l,c]:f=[d,0,0,l,c]}(this.hasFill()||this.hasStroke()||u)&&(o.beginPath(),u?e.Util.drawRoundedRectPath(o,l,c,u):o.rect(0,0,l,c),o.closePath(),o.fillStrokeShape(this)),d&&(u&&o.clip(),o.drawImage.apply(o,f))}_hitFunc(o){const l=this.width(),c=this.height(),u=this.cornerRadius();o.beginPath(),u?e.Util.drawRoundedRectPath(o,l,c,u):o.rect(0,0,l,c),o.closePath(),o.fillStrokeShape(this)}getWidth(){var o,l;return(o=this.attrs.width)!==null&&o!==void 0?o:(l=this.image())===null||l===void 0?void 0:l.width}getHeight(){var o,l;return(o=this.attrs.height)!==null&&o!==void 0?o:(l=this.image())===null||l===void 0?void 0:l.height}static fromURL(o,l,c=null){const u=e.Util.createImageElement();u.onload=function(){const d=new r({image:u});l(d)},u.onerror=c,u.crossOrigin="Anonymous",u.src=o}}return Vo.Image=r,r.prototype.className="Image",(0,i._registerNode)(r),t.Factory.addGetterSetter(r,"cornerRadius",0,(0,a.getNumberOrArrayOfNumbersValidator)(4)),t.Factory.addGetterSetter(r,"image"),t.Factory.addComponentsGetterSetter(r,"crop",["x","y","width","height"]),t.Factory.addGetterSetter(r,"cropX",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(r,"cropY",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(r,"cropWidth",0,(0,a.getNumberValidator)()),t.Factory.addGetterSetter(r,"cropHeight",0,(0,a.getNumberValidator)()),Vo}var Ca={},M0;function $$(){if(M0)return Ca;M0=1,Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.Tag=Ca.Label=void 0;const e=gt(),t=Sn(),n=nv(),i=vt(),a=pt(),r=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],s="Change.konva",o="none",l="up",c="right",u="down",d="left",f=r.length;let m=class extends n.Group{constructor(v){super(v),this.on("add.konva",function(_){this._addListeners(_.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(v){let _=this,h;const y=function(){_._sync()};for(h=0;h{o=Math.min(o,d.x),l=Math.max(l,d.x),c=Math.min(c,d.y),u=Math.max(u,d.y)}),{x:o,y:c,width:l-o,height:u-c}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(s){this.radius(s/2)}setHeight(s){this.radius(s/2)}};return No.RegularPolygon=a,a.prototype.className="RegularPolygon",a.prototype._centroid=!0,a.prototype._attrsAffectingSize=["radius"],(0,i._registerNode)(a),e.Factory.addGetterSetter(a,"radius",0,(0,n.getNumberValidator)()),e.Factory.addGetterSetter(a,"sides",0,(0,n.getNumberValidator)()),No}var Lo={},D0;function M$(){if(D0)return Lo;D0=1,Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.Ring=void 0;const e=gt(),t=Sn(),n=vt(),i=pt(),a=Math.PI*2;let r=class extends t.Shape{_sceneFunc(o){o.beginPath(),o.arc(0,0,this.innerRadius(),0,a,!1),o.moveTo(this.outerRadius(),0),o.arc(0,0,this.outerRadius(),a,0,!0),o.closePath(),o.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(o){this.outerRadius(o/2)}setHeight(o){this.outerRadius(o/2)}};return Lo.Ring=r,r.prototype.className="Ring",r.prototype._centroid=!0,r.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,i._registerNode)(r),e.Factory.addGetterSetter(r,"innerRadius",0,(0,n.getNumberValidator)()),e.Factory.addGetterSetter(r,"outerRadius",0,(0,n.getNumberValidator)()),Lo}var jo={},N0;function R$(){if(N0)return jo;N0=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.Sprite=void 0;const e=gt(),t=Sn(),n=iv(),i=vt(),a=pt();let r=class extends t.Shape{constructor(o){super(o),this._updated=!0,this.anim=new n.Animation(()=>{const l=this._updated;return this._updated=!1,l}),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(o){const l=this.animation(),c=this.frameIndex(),u=c*4,d=this.animations()[l],f=this.frameOffsets(),m=d[u+0],p=d[u+1],g=d[u+2],v=d[u+3],_=this.image();if((this.hasFill()||this.hasStroke())&&(o.beginPath(),o.rect(0,0,g,v),o.closePath(),o.fillStrokeShape(this)),_)if(f){const h=f[l],y=c*2;o.drawImage(_,m,p,g,v,h[y+0],h[y+1],g,v)}else o.drawImage(_,m,p,g,v,0,0,g,v)}_hitFunc(o){const l=this.animation(),c=this.frameIndex(),u=c*4,d=this.animations()[l],f=this.frameOffsets(),m=d[u+2],p=d[u+3];if(o.beginPath(),f){const g=f[l],v=c*2;o.rect(g[v+0],g[v+1],m,p)}else o.rect(0,0,m,p);o.closePath(),o.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const o=this;this.interval=setInterval(function(){o._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const o=this.getLayer();this.anim.setLayers(o),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const o=this.frameIndex(),l=this.animation(),c=this.animations(),u=c[l],d=u.length/4;o{if(new RegExp("\\p{Emoji}","u").test(R)){const D=H[U+1];D&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(D)?(F.push(R+D),H[U+1]=""):F.push(R)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(R+(H[U+1]||""))?F.push(R+H[U+1]):U>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(R)?F[F.length-1]+=R:R&&F.push(R);return F},[])}const o="auto",l="center",c="inherit",u="justify",d="Change.konva",f="2d",m="-",p="left",g="text",v="Text",_="top",h="bottom",y="middle",b="normal",k="px ",w=" ",P="right",C="rtl",E="word",A="char",T="none",I="…",S=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],$=S.length;function O(q){return q.split(",").map(F=>{F=F.trim();const R=F.indexOf(" ")>=0,U=F.indexOf('"')>=0||F.indexOf("'")>=0;return R&&!U&&(F=`"${F}"`),F}).join(", ")}let j;function B(){return j||(j=e.Util.createCanvasElement().getContext(f),j)}function Y(q){q.fillText(this._partialText,this._partialTextX,this._partialTextY)}function X(q){q.setAttr("miterLimit",2),q.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function z(q){return q=q||{},!q.fillLinearGradientColorStops&&!q.fillRadialGradientColorStops&&!q.fillPatternImage&&(q.fill=q.fill||"black"),q}let M=class extends n.Shape{constructor(F){super(z(F)),this._partialTextX=0,this._partialTextY=0;for(let R=0;R<$;R++)this.on(S[R]+d,this._setTextData);this._setTextData()}_sceneFunc(F){const R=this.textArr,U=R.length;if(!this.text())return;let H=this.padding(),D=this.fontSize(),G=this.lineHeight()*D,J=this.verticalAlign(),Q=this.direction(),W=0,V=this.align(),L=this.getWidth(),K=this.letterSpacing(),Z=this.fill(),ne=this.textDecoration(),ie=ne.indexOf("underline")!==-1,ue=ne.indexOf("line-through")!==-1,me;Q=Q===c?F.direction:Q;let re=G/2,ce=y;if(i.Konva._fixTextRendering){const St=this.measureSize("M");ce="alphabetic",re=(St.fontBoundingBoxAscent-St.fontBoundingBoxDescent)/2+G/2}var _e=0,he=0;for(Q===C&&F.setAttr("direction",Q),F.setAttr("font",this._getContextFont()),F.setAttr("textBaseline",ce),F.setAttr("textAlign",p),J===y?W=(this.getHeight()-U*G-H*2)/2:J===h&&(W=this.getHeight()-U*G-H*2),F.translate(H,W+H),me=0;me1&&(re+=G)}}_hitFunc(F){const R=this.getWidth(),U=this.getHeight();F.beginPath(),F.rect(0,0,R,U),F.closePath(),F.fillStrokeShape(this)}setText(F){const R=e.Util._isString(F)?F:F==null?"":F+"";return this._setAttr(g,R),this}getWidth(){return this.attrs.width===o||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===o||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return e.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(F){var R,U,H,D,G,J,Q,W,V,L,K;let Z=B(),ne=this.fontSize(),ie;Z.save(),Z.font=this._getContextFont(),ie=Z.measureText(F),Z.restore();const ue=ne/100;return{actualBoundingBoxAscent:(R=ie.actualBoundingBoxAscent)!==null&&R!==void 0?R:71.58203125*ue,actualBoundingBoxDescent:(U=ie.actualBoundingBoxDescent)!==null&&U!==void 0?U:0,actualBoundingBoxLeft:(H=ie.actualBoundingBoxLeft)!==null&&H!==void 0?H:-7.421875*ue,actualBoundingBoxRight:(D=ie.actualBoundingBoxRight)!==null&&D!==void 0?D:75.732421875*ue,alphabeticBaseline:(G=ie.alphabeticBaseline)!==null&&G!==void 0?G:0,emHeightAscent:(J=ie.emHeightAscent)!==null&&J!==void 0?J:100*ue,emHeightDescent:(Q=ie.emHeightDescent)!==null&&Q!==void 0?Q:-20*ue,fontBoundingBoxAscent:(W=ie.fontBoundingBoxAscent)!==null&&W!==void 0?W:91*ue,fontBoundingBoxDescent:(V=ie.fontBoundingBoxDescent)!==null&&V!==void 0?V:21*ue,hangingBaseline:(L=ie.hangingBaseline)!==null&&L!==void 0?L:72.80000305175781*ue,ideographicBaseline:(K=ie.ideographicBaseline)!==null&&K!==void 0?K:-21*ue,width:ie.width,height:ne}}_getContextFont(){return this.fontStyle()+w+this.fontVariant()+w+(this.fontSize()+k)+O(this.fontFamily())}_addTextLine(F){this.align()===u&&(F=F.trim());const U=this._getTextWidth(F);return this.textArr.push({text:F,width:U,lastInParagraph:!1})}_getTextWidth(F){const R=this.letterSpacing(),U=F.length;return B().measureText(F).width+R*U}_setTextData(){let F=this.text().split(` -`),R=+this.fontSize(),U=0,H=this.lineHeight()*R,D=this.attrs.width,G=this.attrs.height,J=D!==o&&D!==void 0,Q=G!==o&&G!==void 0,W=this.padding(),V=D-W*2,L=G-W*2,K=0,Z=this.wrap(),ne=Z!==T,ie=Z!==A&&ne,ue=this.ellipsis();this.textArr=[],B().font=this._getContextFont();const me=ue?this._getTextWidth(I):0;for(let re=0,ce=F.length;reV)for(;_e.length>0;){let ye=0,Ae=s(_e).length,$e="",Le=0;for(;ye>>1,yt=s(_e),St=yt.slice(0,Fe+1).join(""),se=this._getTextWidth(St)+me;se<=V?(ye=Fe+1,$e=St,Le=se):Ae=Fe}if($e){if(ie){const St=s(_e),se=s($e),ae=St[se.length],pe=ae===w||ae===m;let Oe;if(pe&&Le<=V)Oe=se.length;else{const Re=se.lastIndexOf(w),He=se.lastIndexOf(m);Oe=Math.max(Re,He)+1}Oe>0&&(ye=Oe,$e=St.slice(0,ye).join(""),Le=this._getTextWidth($e))}if($e=$e.trimRight(),this._addTextLine($e),U=Math.max(U,Le),K+=H,this._shouldHandleEllipsis(K)){this._tryToAddEllipsisToLastLine();break}if(_e=s(_e).slice(ye).join("").trimLeft(),_e.length>0&&(he=this._getTextWidth(_e),he<=V)){this._addTextLine(_e),K+=H,U=Math.max(U,he);break}}else break}else this._addTextLine(_e),K+=H,U=Math.max(U,he),this._shouldHandleEllipsis(K)&&reL)break}this.textHeight=R,this.textWidth=U}_shouldHandleEllipsis(F){const R=+this.fontSize(),U=this.lineHeight()*R,H=this.attrs.height,D=H!==o&&H!==void 0,G=this.padding(),J=H-G*2;return!(this.wrap()!==T)||D&&F+U>J}_tryToAddEllipsisToLastLine(){const F=this.attrs.width,R=F!==o&&F!==void 0,U=this.padding(),H=F-U*2,D=this.ellipsis(),G=this.textArr[this.textArr.length-1];!G||!D||(R&&(this._getTextWidth(G.text+I)p?null:i.Path.getPointAtLengthOfDataArray(m,this.dataArray)}_readDataAttribute(){this.dataArray=i.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(m){m.setAttr("font",this._getContextFont()),m.setAttr("textBaseline",this.textBaseline()),m.setAttr("textAlign","left"),m.save();const p=this.textDecoration(),g=this.fill(),v=this.fontSize(),_=this.glyphInfo;p==="underline"&&m.beginPath();for(let h=0;h<_.length;h++){m.save();const y=_[h].p0;m.translate(y.x,y.y),m.rotate(_[h].rotation),this.partialText=_[h].text,m.fillStrokeShape(this),p==="underline"&&(h===0&&m.moveTo(0,v/2+1),m.lineTo(v,v/2+1)),m.restore()}p==="underline"&&(m.strokeStyle=g,m.lineWidth=v/20,m.stroke()),m.restore()}_hitFunc(m){m.beginPath();const p=this.glyphInfo;if(p.length>=1){const g=p[0].p0;m.moveTo(g.x,g.y)}for(let g=0;gC+`.${c}`).join(" "),d="nodesRect",f=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],m={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},p="ontouchstart"in s.Konva._global;function g(C,E,A){if(C==="rotater")return A;E+=e.Util.degToRad(m[C]||0);const T=(e.Util.radToDeg(E)%360+360)%360;return e.Util._inRange(T,315+22.5,360)||e.Util._inRange(T,0,22.5)?"ns-resize":e.Util._inRange(T,45-22.5,45+22.5)?"nesw-resize":e.Util._inRange(T,90-22.5,90+22.5)?"ew-resize":e.Util._inRange(T,135-22.5,135+22.5)?"nwse-resize":e.Util._inRange(T,180-22.5,180+22.5)?"ns-resize":e.Util._inRange(T,225-22.5,225+22.5)?"nesw-resize":e.Util._inRange(T,270-22.5,270+22.5)?"ew-resize":e.Util._inRange(T,315-22.5,315+22.5)?"nwse-resize":(e.Util.error("Transformer has unknown angle for cursor detection: "+T),"pointer")}const v=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function _(C){return{x:C.x+C.width/2*Math.cos(C.rotation)+C.height/2*Math.sin(-C.rotation),y:C.y+C.height/2*Math.cos(C.rotation)+C.width/2*Math.sin(C.rotation)}}function h(C,E,A){const T=A.x+(C.x-A.x)*Math.cos(E)-(C.y-A.y)*Math.sin(E),I=A.y+(C.x-A.x)*Math.sin(E)+(C.y-A.y)*Math.cos(E);return{...C,rotation:C.rotation+E,x:T,y:I}}function y(C,E){const A=_(C);return h(C,E,A)}function b(C,E,A){let T=E;for(let I=0;II.isAncestorOf(this)?(e.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=E=A,E.length===1&&this.useSingleNodeRotation()?this.rotation(E[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(I=>{const S=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},$=I._attrsAffectingSize.map(O=>O+"Change."+this._getEventNamespace()).join(" ");I.on($,S),I.on(f.map(O=>O+`.${this._getEventNamespace()}`).join(" "),S),I.on(`absoluteTransformChange.${this._getEventNamespace()}`,S),this._proxyDrag(I)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(E){let A;E.on(`dragstart.${this._getEventNamespace()}`,T=>{A=E.getAbsolutePosition(),!this.isDragging()&&E!==this.findOne(".back")&&this.startDrag(T,!1)}),E.on(`dragmove.${this._getEventNamespace()}`,T=>{if(!A)return;const I=E.getAbsolutePosition(),S=I.x-A.x,$=I.y-A.y;this.nodes().forEach(O=>{if(O===E||O.isDragging())return;const j=O.getAbsolutePosition();O.setAbsolutePosition({x:j.x+S,y:j.y+$}),O.startDrag(T)}),A=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(d),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(d,this.__getNodeRect)}__getNodeShape(E,A=this.rotation(),T){const I=E.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),S=E.getAbsoluteScale(T),$=E.getAbsolutePosition(T),O=I.x*S.x-E.offsetX()*S.x,j=I.y*S.y-E.offsetY()*S.y,B=(s.Konva.getAngle(E.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),Y={x:$.x+O*Math.cos(B)+j*Math.sin(-B),y:$.y+j*Math.cos(B)+O*Math.sin(B),width:I.width*S.x,height:I.height*S.y,rotation:B};return h(Y,-s.Konva.getAngle(A),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const A=[];this.nodes().map(B=>{const Y=B.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),X=[{x:Y.x,y:Y.y},{x:Y.x+Y.width,y:Y.y},{x:Y.x+Y.width,y:Y.y+Y.height},{x:Y.x,y:Y.y+Y.height}],z=B.getAbsoluteTransform();X.forEach(function(M){const q=z.point(M);A.push(q)})});const T=new e.Transform;T.rotate(-s.Konva.getAngle(this.rotation()));let I=1/0,S=1/0,$=-1/0,O=-1/0;A.forEach(function(B){const Y=T.point(B);I===void 0&&(I=$=Y.x,S=O=Y.y),I=Math.min(I,Y.x),S=Math.min(S,Y.y),$=Math.max($,Y.x),O=Math.max(O,Y.y)}),T.invert();const j=T.point({x:I,y:S});return{x:j.x,y:j.y,width:$-I,height:O-S,rotation:s.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),v.forEach(E=>{this._createAnchor(E)}),this._createAnchor("rotater")}_createAnchor(E){const A=new a.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:E+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:p?10:"auto"}),T=this;A.on("mousedown touchstart",function(I){T._handleMouseDown(I)}),A.on("dragstart",I=>{A.stopDrag(),I.cancelBubble=!0}),A.on("dragend",I=>{I.cancelBubble=!0}),A.on("mouseenter",()=>{const I=s.Konva.getAngle(this.rotation()),S=this.rotateAnchorCursor(),$=g(E,I,S);A.getStage().content&&(A.getStage().content.style.cursor=$),this._cursorChange=!0}),A.on("mouseout",()=>{A.getStage().content&&(A.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(A)}_createBack(){const E=new i.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(A,T){const I=T.getParent(),S=I.padding();A.beginPath(),A.rect(-S,-S,T.width()+S*2,T.height()+S*2),A.moveTo(T.width()/2,-S),I.rotateEnabled()&&I.rotateLineVisible()&&A.lineTo(T.width()/2,-I.rotateAnchorOffset()*e.Util._sign(T.height())-S),A.fillStrokeShape(T)},hitFunc:(A,T)=>{if(!this.shouldOverdrawWholeArea())return;const I=this.padding();A.beginPath(),A.rect(-I,-I,T.width()+I*2,T.height()+I*2),A.fillStrokeShape(T)}});this.add(E),this._proxyDrag(E),E.on("dragstart",A=>{A.cancelBubble=!0}),E.on("dragmove",A=>{A.cancelBubble=!0}),E.on("dragend",A=>{A.cancelBubble=!0}),this.on("dragmove",A=>{this.update()})}_handleMouseDown(E){if(this._transforming)return;this._movingAnchorName=E.target.name().split(" ")[0];const A=this._getNodeRect(),T=A.width,I=A.height,S=Math.sqrt(Math.pow(T,2)+Math.pow(I,2));this.sin=Math.abs(I/S),this.cos=Math.abs(T/S),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const $=E.target.getAbsolutePosition(),O=E.target.getStage().getPointerPosition();this._anchorDragOffset={x:O.x-$.x,y:O.y-$.y},k++,this._fire("transformstart",{evt:E.evt,target:this.getNode()}),this._nodes.forEach(j=>{j._fire("transformstart",{evt:E.evt,target:j})})}_handleMouseMove(E){let A,T,I;const S=this.findOne("."+this._movingAnchorName),$=S.getStage();$.setPointersPositions(E);const O=$.getPointerPosition();let j={x:O.x-this._anchorDragOffset.x,y:O.y-this._anchorDragOffset.y};const B=S.getAbsolutePosition();this.anchorDragBoundFunc()&&(j=this.anchorDragBoundFunc()(B,j,E)),S.setAbsolutePosition(j);const Y=S.getAbsolutePosition();if(B.x===Y.x&&B.y===Y.y)return;if(this._movingAnchorName==="rotater"){const J=this._getNodeRect();A=S.x()-J.width/2,T=-S.y()+J.height/2;let Q=Math.atan2(-T,A)+Math.PI/2;J.height<0&&(Q-=Math.PI);const V=s.Konva.getAngle(this.rotation())+Q,L=s.Konva.getAngle(this.rotationSnapTolerance()),Z=b(this.rotationSnaps(),V,L)-J.rotation,ne=y(J,Z);this._fitNodesInto(ne,E);return}const X=this.shiftBehavior();let z;X==="inverted"?z=this.keepRatio()&&!E.shiftKey:X==="none"?z=this.keepRatio():z=this.keepRatio()||E.shiftKey;var U=this.centeredScaling()||E.altKey;if(this._movingAnchorName==="top-left"){if(z){var M=U?{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(M.x-S.x(),2)+Math.pow(M.y-S.y(),2));var q=this.findOne(".top-left").x()>M.x?-1:1,F=this.findOne(".top-left").y()>M.y?-1:1;A=I*this.cos*q,T=I*this.sin*F,this.findOne(".top-left").x(M.x-A),this.findOne(".top-left").y(M.y-T)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(S.y());else if(this._movingAnchorName==="top-right"){if(z){var M=U?{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(S.x()-M.x,2)+Math.pow(M.y-S.y(),2));var q=this.findOne(".top-right").x()M.y?-1:1;A=I*this.cos*q,T=I*this.sin*F,this.findOne(".top-right").x(M.x+A),this.findOne(".top-right").y(M.y-T)}var R=S.position();this.findOne(".top-left").y(R.y),this.findOne(".bottom-right").x(R.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(S.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(S.x());else if(this._movingAnchorName==="bottom-left"){if(z){var M=U?{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(M.x-S.x(),2)+Math.pow(S.y()-M.y,2));var q=M.x{var S;I._fire("transformend",{evt:E,target:I}),(S=I.getLayer())===null||S===void 0||S.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(E,A){const T=this._getNodeRect(),I=1;if(e.Util._inRange(E.width,-this.padding()*2-I,I)){this.update();return}if(e.Util._inRange(E.height,-this.padding()*2-I,I)){this.update();return}const S=new e.Transform;if(S.rotate(s.Konva.getAngle(this.rotation())),this._movingAnchorName&&E.width<0&&this._movingAnchorName.indexOf("left")>=0){const z=S.point({x:-this.padding()*2,y:0});E.x+=z.x,E.y+=z.y,E.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=z.x,this._anchorDragOffset.y-=z.y}else if(this._movingAnchorName&&E.width<0&&this._movingAnchorName.indexOf("right")>=0){const z=S.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=z.x,this._anchorDragOffset.y-=z.y,E.width+=this.padding()*2}if(this._movingAnchorName&&E.height<0&&this._movingAnchorName.indexOf("top")>=0){const z=S.point({x:0,y:-this.padding()*2});E.x+=z.x,E.y+=z.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=z.x,this._anchorDragOffset.y-=z.y,E.height+=this.padding()*2}else if(this._movingAnchorName&&E.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const z=S.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=z.x,this._anchorDragOffset.y-=z.y,E.height+=this.padding()*2}if(this.boundBoxFunc()){const z=this.boundBoxFunc()(T,E);z?E=z:e.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const $=1e7,O=new e.Transform;O.translate(T.x,T.y),O.rotate(T.rotation),O.scale(T.width/$,T.height/$);const j=new e.Transform,B=E.width/$,Y=E.height/$;this.flipEnabled()===!1?(j.translate(E.x,E.y),j.rotate(E.rotation),j.translate(E.width<0?E.width:0,E.height<0?E.height:0),j.scale(Math.abs(B),Math.abs(Y))):(j.translate(E.x,E.y),j.rotate(E.rotation),j.scale(B,Y));const X=j.multiply(O.invert());this._nodes.forEach(z=>{var M;const q=z.getParent().getAbsoluteTransform(),F=z.getTransform().copy();F.translate(z.offsetX(),z.offsetY());const R=new e.Transform;R.multiply(q.copy().invert()).multiply(X).multiply(q).multiply(F);const U=R.decompose();z.setAttrs(U),(M=z.getLayer())===null||M===void 0||M.batchDraw()}),this.rotation(e.Util._getRotation(E.rotation)),this._nodes.forEach(z=>{this._fire("transform",{evt:A,target:z}),z._fire("transform",{evt:A,target:z})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(E,A){this.findOne(E).setAttrs(A)}update(){var E;const A=this._getNodeRect();this.rotation(e.Util._getRotation(A.rotation));const T=A.width,I=A.height,S=this.enabledAnchors(),$=this.resizeEnabled(),O=this.padding(),j=this.anchorSize(),B=this.find("._anchor");B.forEach(X=>{X.setAttrs({width:j,height:j,offsetX:j/2,offsetY:j/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:j/2+O,offsetY:j/2+O,visible:$&&S.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:T/2,y:0,offsetY:j/2+O,visible:$&&S.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:T,y:0,offsetX:j/2-O,offsetY:j/2+O,visible:$&&S.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:I/2,offsetX:j/2+O,visible:$&&S.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:T,y:I/2,offsetX:j/2-O,visible:$&&S.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:I,offsetX:j/2+O,offsetY:j/2-O,visible:$&&S.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:T/2,y:I,offsetY:j/2-O,visible:$&&S.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:T,y:I,offsetX:j/2-O,offsetY:j/2-O,visible:$&&S.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:T/2,y:-this.rotateAnchorOffset()*e.Util._sign(I)-O,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:T,height:I,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const Y=this.anchorStyleFunc();Y&&B.forEach(X=>{Y(X)}),(E=this.getLayer())===null||E===void 0||E.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const E=this.findOne("."+this._movingAnchorName);E&&E.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),r.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return n.Node.prototype.toObject.call(this)}clone(E){return n.Node.prototype.clone.call(this,E)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Bo.Transformer=w,w.isTransforming=()=>k>0;function P(C){return C instanceof Array||e.Util.warn("enabledAnchors value should be an array"),C instanceof Array&&C.forEach(function(E){v.indexOf(E)===-1&&e.Util.warn("Unknown anchor name: "+E+". Available names are: "+v.join(", "))}),C||[]}return w.prototype.className="Transformer",(0,l._registerNode)(w),t.Factory.addGetterSetter(w,"enabledAnchors",v,P),t.Factory.addGetterSetter(w,"flipEnabled",!0,(0,o.getBooleanValidator)()),t.Factory.addGetterSetter(w,"resizeEnabled",!0),t.Factory.addGetterSetter(w,"anchorSize",10,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"rotateEnabled",!0),t.Factory.addGetterSetter(w,"rotateLineVisible",!0),t.Factory.addGetterSetter(w,"rotationSnaps",[]),t.Factory.addGetterSetter(w,"rotateAnchorOffset",50,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"rotateAnchorCursor","crosshair"),t.Factory.addGetterSetter(w,"rotationSnapTolerance",5,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"borderEnabled",!0),t.Factory.addGetterSetter(w,"anchorStroke","rgb(0, 161, 255)"),t.Factory.addGetterSetter(w,"anchorStrokeWidth",1,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"anchorFill","white"),t.Factory.addGetterSetter(w,"anchorCornerRadius",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"borderStroke","rgb(0, 161, 255)"),t.Factory.addGetterSetter(w,"borderStrokeWidth",1,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"borderDash"),t.Factory.addGetterSetter(w,"keepRatio",!0),t.Factory.addGetterSetter(w,"shiftBehavior","default"),t.Factory.addGetterSetter(w,"centeredScaling",!1),t.Factory.addGetterSetter(w,"ignoreStroke",!1),t.Factory.addGetterSetter(w,"padding",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"nodes"),t.Factory.addGetterSetter(w,"node"),t.Factory.addGetterSetter(w,"boundBoxFunc"),t.Factory.addGetterSetter(w,"anchorDragBoundFunc"),t.Factory.addGetterSetter(w,"anchorStyleFunc"),t.Factory.addGetterSetter(w,"shouldOverdrawWholeArea",!1),t.Factory.addGetterSetter(w,"useSingleNodeRotation",!0),t.Factory.backCompat(w,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"}),Bo}var zo={},B0;function L$(){if(B0)return zo;B0=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.Wedge=void 0;const e=gt(),t=Sn(),n=pt(),i=vt(),a=pt();let r=class extends t.Shape{_sceneFunc(o){o.beginPath(),o.arc(0,0,this.radius(),0,n.Konva.getAngle(this.angle()),this.clockwise()),o.lineTo(0,0),o.closePath(),o.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(o){this.radius(o/2)}setHeight(o){this.radius(o/2)}};return zo.Wedge=r,r.prototype.className="Wedge",r.prototype._centroid=!0,r.prototype._attrsAffectingSize=["radius"],(0,a._registerNode)(r),e.Factory.addGetterSetter(r,"radius",0,(0,i.getNumberValidator)()),e.Factory.addGetterSetter(r,"angle",0,(0,i.getNumberValidator)()),e.Factory.addGetterSetter(r,"clockwise",!1),e.Factory.backCompat(r,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"}),zo}var Ho={},z0;function j$(){if(z0)return Ho;z0=1,Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.Blur=void 0;const e=gt(),t=on(),n=vt();function i(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const a=[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],r=[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 s(l,c){const u=l.data,d=l.width,f=l.height;let m,p,g,v,_,h,y,b,k,w,P,C,E,A,T,I,S,$,O,j,B,Y,X,z;const M=c+c+1,q=d-1,F=f-1,R=c+1,U=R*(R+1)/2,H=new i,D=a[c],G=r[c];let J=null,Q=H,W=null,V=null;for(g=1;g>G,X!==0?(X=255/X,u[h]=(b*D>>G)*X,u[h+1]=(k*D>>G)*X,u[h+2]=(w*D>>G)*X):u[h]=u[h+1]=u[h+2]=0,b-=C,k-=E,w-=A,P-=T,C-=W.r,E-=W.g,A-=W.b,T-=W.a,v=y+((v=m+c+1)>G,X>0?(X=255/X,u[v]=(b*D>>G)*X,u[v+1]=(k*D>>G)*X,u[v+2]=(w*D>>G)*X):u[v]=u[v+1]=u[v+2]=0,b-=C,k-=E,w-=A,P-=T,C-=W.r,E-=W.g,A-=W.b,T-=W.a,v=m+((v=p+R)0&&s(c,u)};return Ho.Blur=o,e.Factory.addGetterSetter(t.Node,"blurRadius",0,(0,n.getNumberValidator)(),e.Factory.afterSetFilter),Ho}var Uo={},H0;function F$(){if(H0)return Uo;H0=1,Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.Brighten=void 0;const e=gt(),t=on(),n=vt(),i=function(a){const r=this.brightness()*255,s=a.data,o=s.length;for(let l=0;l255?255:l,c=c<0?0:c>255?255:c,u=u<0?0:u>255?255:u,s[d]=l,s[d+1]=c,s[d+2]=u};return Go.Contrast=i,e.Factory.addGetterSetter(t.Node,"contrast",0,(0,n.getNumberValidator)(),e.Factory.afterSetFilter),Go}var Wo={},G0;function B$(){if(G0)return Wo;G0=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.Emboss=void 0;const e=gt(),t=on(),n=nn(),i=vt(),a=function(r){const s=this.embossStrength()*10,o=this.embossWhiteLevel()*255,l=this.embossDirection(),c=this.embossBlend(),u=r.data,d=r.width,f=r.height,m=d*4;let p=0,g=0,v=f;switch(l){case"top-left":p=-1,g=-1;break;case"top":p=-1,g=0;break;case"top-right":p=-1,g=1;break;case"right":p=0,g=1;break;case"bottom-right":p=1,g=1;break;case"bottom":p=1,g=0;break;case"bottom-left":p=1,g=-1;break;case"left":p=0,g=-1;break;default:n.Util.error("Unknown emboss direction: "+l)}do{const _=(v-1)*m;let h=p;v+h<1&&(h=0),v+h>f&&(h=0);const y=(v-1+h)*d*4;let b=d;do{const k=_+(b-1)*4;let w=g;b+w<1&&(w=0),b+w>d&&(w=0);const P=y+(b-1+w)*4,C=u[k]-u[P],E=u[k+1]-u[P+1],A=u[k+2]-u[P+2];let T=C;const I=T>0?T:-T,S=E>0?E:-E,$=A>0?A:-A;if(S>I&&(T=E),$>I&&(T=A),T*=s,c){const O=u[k]+T,j=u[k+1]+T,B=u[k+2]+T;u[k]=O>255?255:O<0?0:O,u[k+1]=j>255?255:j<0?0:j,u[k+2]=B>255?255:B<0?0:B}else{let O=o-T;O<0?O=0:O>255&&(O=255),u[k]=u[k+1]=u[k+2]=O}}while(--b)}while(--v)};return Wo.Emboss=a,e.Factory.addGetterSetter(t.Node,"embossStrength",.5,(0,i.getNumberValidator)(),e.Factory.afterSetFilter),e.Factory.addGetterSetter(t.Node,"embossWhiteLevel",.5,(0,i.getNumberValidator)(),e.Factory.afterSetFilter),e.Factory.addGetterSetter(t.Node,"embossDirection","top-left",void 0,e.Factory.afterSetFilter),e.Factory.addGetterSetter(t.Node,"embossBlend",!1,void 0,e.Factory.afterSetFilter),Wo}var Ko={},W0;function z$(){if(W0)return Ko;W0=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.Enhance=void 0;const e=gt(),t=on(),n=vt();function i(r,s,o,l,c){const u=o-s,d=c-l;if(u===0)return l+d/2;if(d===0)return l;let f=(r-s)/u;return f=d*f+l,f}const a=function(r){const s=r.data,o=s.length;let l=s[0],c=l,u,d=s[1],f=d,m,p=s[2],g=p,v;const _=this.enhance();if(_===0)return;for(let T=0;Tc&&(c=u),m=s[T+1],mf&&(f=m),v=s[T+2],vg&&(g=v);c===l&&(c=255,l=0),f===d&&(f=255,d=0),g===p&&(g=255,p=0);let h,y,b,k,w,P,C,E,A;_>0?(y=c+_*(255-c),b=l-_*(l-0),w=f+_*(255-f),P=d-_*(d-0),E=g+_*(255-g),A=p-_*(p-0)):(h=(c+l)*.5,y=c+_*(c-h),b=l+_*(l-h),k=(f+d)*.5,w=f+_*(f-k),P=d+_*(d-k),C=(g+p)*.5,E=g+_*(g-C),A=p+_*(p-C));for(let T=0;Tv?y:v;const b=m,k=f,w=360/k*Math.PI/180;for(let P=0;Pv?y:v;const b=m,k=f,w=0;let P,C;for(_=0;_l&&(T=A,I=0,S=-1),d=0;d=0&&E=0&&A=0&&E=0&&A=255*4?255:0}return h}function u(f,m,p){const g=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],v=Math.round(Math.sqrt(g.length)),_=Math.floor(v/2),h=[];for(let y=0;y=0&&E=0&&A=o))for(u=b;u=l||(d=(o*u+c)*4,f+=E[d+0],m+=E[d+1],p+=E[d+2],g+=E[d+3],C+=1);for(f=f/C,m=m/C,p=p/C,g=g/C,c=h;c=o))for(u=b;u=l||(d=(o*u+c)*4,E[d+0]=f,E[d+1]=m,E[d+2]=p,E[d+3]=g)}};return nl.Pixelate=a,e.Factory.addGetterSetter(n.Node,"pixelSize",8,(0,i.getNumberValidator)(),e.Factory.afterSetFilter),nl}var il={},nb;function Z$(){if(nb)return il;nb=1,Object.defineProperty(il,"__esModule",{value:!0}),il.Posterize=void 0;const e=gt(),t=on(),n=vt(),i=function(a){const r=Math.round(this.levels()*254)+1,s=a.data,o=s.length,l=255/r;for(let c=0;c255?255:a<0?0:Math.round(a)}),e.Factory.addGetterSetter(t.Node,"green",0,function(a){return this._filterUpToDate=!1,a>255?255:a<0?0:Math.round(a)}),e.Factory.addGetterSetter(t.Node,"blue",0,n.RGBComponent,e.Factory.afterSetFilter),rl}var al={},rb;function eI(){if(rb)return al;rb=1,Object.defineProperty(al,"__esModule",{value:!0}),al.RGBA=void 0;const e=gt(),t=on(),n=vt(),i=function(a){const r=a.data,s=r.length,o=this.red(),l=this.green(),c=this.blue(),u=this.alpha();for(let d=0;d255?255:a<0?0:Math.round(a)}),e.Factory.addGetterSetter(t.Node,"green",0,function(a){return this._filterUpToDate=!1,a>255?255:a<0?0:Math.round(a)}),e.Factory.addGetterSetter(t.Node,"blue",0,n.RGBComponent,e.Factory.afterSetFilter),e.Factory.addGetterSetter(t.Node,"alpha",1,function(a){return this._filterUpToDate=!1,a>1?1:a<0?0:a}),al}var sl={},ab;function tI(){if(ab)return sl;ab=1,Object.defineProperty(sl,"__esModule",{value:!0}),sl.Sepia=void 0;const e=function(t){const n=t.data,i=n.length;for(let a=0;a127&&(u=255-u),d>127&&(d=255-d),f>127&&(f=255-f),n[c]=u,n[c+1]=d,n[c+2]=f}while(--l)}while(--s)};return ol.Solarize=e,ol}var ll={},ob;function iI(){if(ob)return ll;ob=1,Object.defineProperty(ll,"__esModule",{value:!0}),ll.Threshold=void 0;const e=gt(),t=on(),n=vt(),i=function(a){const r=this.threshold()*255,s=a.data,o=s.length;for(let l=0;l0&&arguments[0]!==void 0?arguments[0]:{};const{blueprint:t,...n}=e,i=Rn(t,n),{aliases:a={},components:r={},directives:s={}}=i,o=T6(i.defaults),l=jT(i.display,i.ssr),c=G6(i.theme),u=mT(i.icons),d=B6(i.locale),f=o8(i.date,d),m=u8(i.goTo,d);return{install:g=>{for(const v in s)g.directive(v,s[v]);for(const v in r)g.component(v,r[v]);for(const v in a)g.component(v,Qi({...a[v],name:v,aliasName:a[v].name}));if(c.install(g),g.provide(Js,o),g.provide(ap,l),g.provide(Ul,c),g.provide(np,u),g.provide(xd,d),g.provide(DC,f.options),g.provide(F_,f.instance),g.provide(LC,m),kt&&i.ssr)if(g.$nuxt)g.$nuxt.hook("app:suspense:resolve",()=>{l.update()});else{const{mount:v}=g;g.mount=function(){const _=v(...arguments);return ct(()=>l.update()),g.mount=v,_}}Jn.reset(),g.mixin({computed:{$vuetify(){return qt({defaults:_s.call(this,Js),display:_s.call(this,ap),theme:_s.call(this,Ul),icons:_s.call(this,np),locale:_s.call(this,xd),date:_s.call(this,F_)})}}})},defaults:o,display:l,theme:c,icons:u,locale:d,date:f,goTo:m}}const cI="3.7.13";Sx.version=cI;function _s(e){var i,a;const t=this.$,n=((i=t.parent)==null?void 0:i.provides)??((a=t.vnode.appContext)==null?void 0:a.provides);if(n&&e in n)return n[e]}const Cx={dark:!1,colors:{background:"#EFEDE8",surface:"#EFEDE8",primary:"#254C84",secondary:"#35CE7C",error:"#b9352b",info:"#254C84",success:"#35CE7C",warning:"#c09112","on-background":"#212121","on-surface":"#212121"}},cr=Cx,uI=Sx({blueprint:lI,theme:{defaultTheme:"everestTheme",themes:{everestTheme:Cx}}}),xr={TERMINAL_REQUIREMENT:cr.colors.secondary,TERMINAL_REQUIREMENT_DISABLED:"#d5d4cc",TERMINAL_PROVIDE:cr.colors.warning,TERMINAL_PROVIDE_DISABLED:"#d5d4cc",CONNECTION:cr.colors.secondary},Dm={TERMINAL:"M12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M17,14L12,9L7,14H17Z",DISABLED:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2C6.47,2 2,6.47 2,12C2,17.53 6.47,22 12,22C17.53,22 22,17.53 22,12C22,6.47 17.53,2 12,2M14.59,8L12,10.59L9.41,8L8,9.41L10.59,12L8,14.59L9.41,16L12,13.41L14.59,16L16,14.59L13.41,12L16,9.41L14.59,8Z"},dt={GRID:24,FRAME_WIDTH:288,FRAME_HEIGHT:144,TERMINAL:24,CONNECTION_WIDTH:4,CONNECTION_CTRL:100},xx={fontFamily:"Roboto, sans-serif"},dI={fontFamily:"Roboto Mono, monospace"},fI={position:{x:10,y:10}},mI=1e4;class hI extends ri.Path{constructor(t){t.data=t.data||Dm.TERMINAL,t.fill=t.fill||t.terminal_type==="requirement"?xr.TERMINAL_REQUIREMENT:xr.TERMINAL_PROVIDE,t.x=t.x||0,t.y=t.y||0,t.offset=t.offset||{x:dt.TERMINAL/2,y:dt.TERMINAL/2},t.hitFunc=t.hitFunc||function(n,i){n.beginPath(),n.rect(0,0,dt.TERMINAL,dt.TERMINAL),n.closePath(),n.fillShape(i)},super(t),t.terminal_alignment&&this.set_alignment(t.terminal_alignment)}get terminal_type(){return this.getAttr("terminal_type")}get terminal_id(){return this.getAttr("terminal_id")}get terminal_alignment(){return this.getAttr("terminal_alignment")}set_alignment(t){this.setAttr("terminal_alignment",t);const n=this.terminal_type==="provide";t==="top"?this.rotation(n?0:180):t==="right"?this.rotation(n?90:270):t==="bottom"?this.rotation(n?180:0):t==="left"&&this.rotation(n?270:90)}set_appearence(t){t!=="DISABLED"&&this.data(Dm.TERMINAL),t==="DISABLED"?(this.data(Dm.DISABLED),this.fill(this.terminal_type==="requirement"?xr.TERMINAL_REQUIREMENT_DISABLED:xr.TERMINAL_PROVIDE_DISABLED),this.listening(!1)):t==="PLACEHOLDER"?(this.fill(this.terminal_type==="requirement"?xr.TERMINAL_REQUIREMENT_DISABLED:xr.TERMINAL_PROVIDE_DISABLED),this.listening(!1)):t==="NORMAL"&&(this.fill(this.terminal_type==="requirement"?xr.TERMINAL_REQUIREMENT:xr.TERMINAL_PROVIDE),this.listening(!0))}}function pI(e,t,n){let i=null,a=null;return 0dt.FRAME_HEIGHT&&tdt.FRAME_WIDTH&&e{const c=new hI({terminal_type:o.terminal.type,terminal_id:l,terminal_alignment:o.alignment});return c.setDraggable(!0),c.on("dragstart",()=>this._terminal_dragstart_handler(c)),c.on("dragmove",()=>this._terminal_dragmove_handler(c)),c.on("dragend",()=>this._terminal_dragend_handler(c)),c.on("mouseenter",()=>{this._vm.set_cursor("pointer");const u={type:"SHOW_TOOLTIP",text:`Interface type: ${o.terminal.interface}`};this._vm.notify_stage_context(u)}),c.on("mouseleave",()=>{this._vm.set_cursor("default");const u={type:"HIDE_TOOLTIP"};this._vm.notify_stage_context(u)}),c.on("pointerclick",u=>{t.clicked_terminal(l),u.cancelBubble=!0}),c}),Object.entries(t.terminal_dist).forEach(([o,l])=>{this._recalculate_terminal_position(o,l,!1)}),t.add_observer(o=>this._vm_event_handler(o)),this.group.on("dragmove",()=>this._module_dragmove_handler()),this.group.position({x:t.grid_position.x*dt.GRID,y:t.grid_position.y*dt.GRID});const n=new ri.Rect({cornerRadius:4,width:dt.FRAME_WIDTH,height:dt.FRAME_HEIGHT,fill:cr.colors.primary,shadowBlur:4,shadowOpacity:.4,shadowOffset:{x:2,y:2},fillAfterStrokeEnabled:!0,listening:!0}),i=8,a=new ri.Line({cornerRadius:4,points:[0,i/2,dt.FRAME_WIDTH,i/2],stroke:cr.colors.secondary,strokeWidth:i,x:n.x(),y:n.y(),listening:!0}),r=new ri.Text({wrap:"none",text:t.id,fontFamily:xx.fontFamily,ellipsis:!0,fill:"white",fontSize:16*2,padding:16,y:i,width:dt.FRAME_WIDTH,listening:!0}),s=new ri.Text({wrap:"none",text:`${t.type}`,fontFamily:dI.fontFamily,ellipsis:!0,fill:"white",opacity:.5,fontSize:16,padding:8,width:dt.FRAME_WIDTH,y:n.height()-16*2,align:"right",listening:!0});[n,r,a,s].forEach(o=>{o.on("mouseenter",()=>{this._vm.set_cursor("pointer")}),o.on("mouseleave",()=>{this._vm.set_cursor("default")}),o.on("pointerclick",l=>{this._vm.clicked_title(),l.cancelBubble=!0})}),this._title=r,this.group.add(n,a,s,r,...this._terminal_views)}get_terminal_placement(t){const n=this._terminal_views[t],i=n.position(),a=this.group.position();return{x:i.x+a.x,y:i.y+a.y,alignment:n.terminal_alignment}}add_observer(t){return this._observers.push(t),()=>{this._observers=this._observers.filter(n=>n!==t)}}_notify(t){this._observers.forEach(n=>n(t))}_vm_event_handler(t){t.type==="TERMINAL_MODIFY_APPEARENCE"?(t.disable.forEach(n=>{this._terminal_views[n].set_appearence("DISABLED")}),t.normal.forEach(n=>{this._terminal_views[n].set_appearence("NORMAL")}),this.group.children.length>0&&this.group.cache()):t.type==="MODULE_MODEL_UPDATE"&&(this._title.setText(this._vm.id),this.group.children.length>0&&this.group.cache())}_module_dragmove_handler(){const t=this.group.position(),n={x:Math.round(t.x/dt.GRID),y:Math.round(t.y/dt.GRID)},i=this._vm.grid_position,a={x:n.x*dt.GRID,y:n.y*dt.GRID};if(this.group.position(a),i.x!==n.x||i.y!==n.y){this._vm.grid_position=n;const r=this._terminal_views.map((s,o)=>({alignment:s.terminal_alignment,id:o,x:s.x()+a.x,y:s.y()+a.y}));this._notify({type:"TERMINALS_UPDATED",terminals:r,module_moved:!0})}}_terminal_dragstart_handler(t){const n=t.clone();n.set_appearence("PLACEHOLDER"),this._terminal_views[t.terminal_id]=n,this.group.add(n),t.moveToTop(),this.group.clearCache()}_terminal_dragmove_handler(t){const n=pI(t.x(),t.y(),this._vm.terminal_dist);if(!n.align)return;n.align!==this._vm.terminal_lookup[t.terminal_id].alignment&&t.set_alignment(n.align),this._vm.move_terminal(t.terminal_id,n.align,n.index).forEach(a=>{this._recalculate_terminal_position(a,this._vm.terminal_dist[a],!0)})}_terminal_dragend_handler(t){this._terminal_views[t.terminal_id].destroy(),this._terminal_views[t.terminal_id]=t;const n=this._vm.terminal_lookup[t.terminal_id].alignment;this._recalculate_terminal_position(n,this._vm.terminal_dist[n]),this.group.children.length>0&&this.group.cache()}_recalculate_terminal_position(t,n,i=!1){const a=t==="top"||t==="bottom",r=t==="right"?dt.FRAME_WIDTH+dt.TERMINAL:0,s=t==="bottom"?dt.FRAME_HEIGHT+dt.TERMINAL:0,o=a?dt.FRAME_WIDTH:dt.FRAME_HEIGHT,l=n.length,c={type:"TERMINALS_UPDATED",terminals:[],module_moved:!1};n.forEach((u,d)=>{const f=this._terminal_views[u],m=(d+.5)*o/l,p=r+(a?m:-24/2),g=s+(a?-24/2:m);f.set_alignment(t),i?f.to({duration:.2,ease:"EaseIn",x:p,y:g}):(f.x(p),f.y(g)),c.terminals.push({alignment:t,id:u,x:p+this.group.x(),y:g+this.group.y()})}),this._notify(c)}}class vI{constructor(t,n,i){Ce(this,"_grid_position");Ce(this,"terminal_dist",{top:[],right:[],bottom:[],left:[]});Ce(this,"terminal_lookup",[]);Ce(this,"type");Ce(this,"_instance_id");Ce(this,"_config_model");Ce(this,"_module_instance");Ce(this,"_observers",[]);Ce(this,"_stage_context");this._instance_id=n,this._config_model=t,this._stage_context=i,this._module_instance=t.get_module_instance(n),this._initialize_terminals(this._module_instance.view_config.terminals),this._grid_position=this._module_instance.view_config.position,this.type=this._module_instance.type,i.add_observer(a=>this._handle_stage_context_event(a)),t.add_observer(a=>{a.type==="MODULE_INSTANCE_UPDATED"&&a.id===n&&this._notify({type:"MODULE_MODEL_UPDATE"})})}_initialize_terminals(t){Object.entries(t).forEach(([n,i])=>{const a=n;i.forEach(r=>{const s=this.terminal_dist[a].length,o=this.terminal_lookup.length;this.terminal_lookup.push({terminal:r,alignment:a,index:s}),this.terminal_dist[a].push(o)})})}add_observer(t){return this._observers.push(t),()=>{this._observers=this._observers.filter(n=>n!==t)}}notify_stage_context(t){this._stage_context._publish(t)}_notify(t){this._observers.forEach(n=>n(t))}clicked_terminal(t){const n=this.terminal_lookup[t].terminal;this._stage_context.clicked_terminal(n,this._instance_id)}clicked_title(){this._stage_context.clicked_instance(this._instance_id)}set_cursor(t){this._stage_context.container.style.cursor=t}_handle_stage_context_event(t){if(t.type!=="SELECT")return;const n=t.selection;if(n.type==="TERMINAL"){const i={type:"TERMINAL_MODIFY_APPEARENCE",disable:[],highlight:[],normal:[]},a=n.terminal;this.terminal_lookup.forEach((r,s)=>{r.terminal.type!==a.type&&(a.type==="provide"?this._config_model.interfaces_match(a.interface,r.terminal.interface):this._config_model.interfaces_match(r.terminal.interface,a.interface))||i.disable.push(s)}),this._notify(i)}else this._notify({type:"TERMINAL_MODIFY_APPEARENCE",normal:Array.from(this.terminal_lookup.keys()),disable:[],highlight:[]})}get id(){return this._module_instance.id}get grid_position(){return this._grid_position}set grid_position(t){this._grid_position=t,this._config_model.update_module_view_position(this._instance_id,t)}move_terminal(t,n,i){const a=this.terminal_lookup[t].alignment,r=this.terminal_lookup[t].index;if(n!==a)return this.terminal_dist[a].splice(r,1),this.terminal_dist[n].splice(i,0,t),this.terminal_lookup[t].alignment=n,this._recalculate_terminal_index([a,n]),[a,n];if(i>r+1||ii.terminal.id===t&&i.terminal.type===n)}_recalculate_terminal_index(t){const n={};t.forEach(i=>{this.terminal_dist[i].forEach((a,r)=>{this.terminal_lookup[a].index=r}),n[i]=this.terminal_dist[i].map(a=>this.terminal_lookup[a].terminal)}),this._config_model.update_module_view_terminals(this._instance_id,n)}}const Kc={top:{x:0,y:-24/2},right:{x:dt.GRID/2,y:0},bottom:{x:0,y:dt.GRID/2},left:{x:-24/2,y:0}};class yI extends ri.Line{constructor(t){t.bezier=t.bezier||!0,t.strokeWidth=t.strokeWidth||dt.CONNECTION_WIDTH,t.stroke=t.stroke||xr.CONNECTION,super(t),this.update_terminals(t.requirement,t.provide)}update_terminals(t,n,i=!1){t=t||this.getAttr("requirement"),n=n||this.getAttr("provide");const a=t.x+Kc[t.alignment].x,r=t.y+Kc[t.alignment].y,s=n.x+Kc[n.alignment].x,o=n.y+Kc[n.alignment].y,l=s-a,c=o-r,u=[[t.alignment,a,r,l,c],[n.alignment,s,o,-l,-c]].map(f=>{const[m,p,g,v,_]=f;return m==="top"?[p,g-Math.max(dt.CONNECTION_CTRL,-_)]:m==="right"?[p+Math.max(dt.CONNECTION_CTRL,v),g]:m==="bottom"?[p,g+Math.max(dt.CONNECTION_CTRL,_)]:[p-Math.max(dt.CONNECTION_CTRL,-v),g]}),d=[a,r,u[0][0],u[0][1],u[1][0],u[1][1],s,o];i?this.to({points:d,duration:.2,ease:"EaseIn"}):this.points(d),this.setAttrs({requirement:t,provide:n})}}class _I{constructor(t){Ce(this,"group");Ce(this,"connections",[]);Ce(this,"_registered_modules",[]);Ce(this,"_stage_context");this.group=new ri.Group,this._stage_context=t}add_connection(t,n,i){const a=n.module_view.get_terminal_placement(n.terminal_lookup_id),r=i.module_view.get_terminal_placement(i.terminal_lookup_id),s=new yI({provide:a,requirement:r,hitStrokeWidth:12}),o={id:t,view:s};s.on("pointerclick",()=>this._stage_context.clicked_connection(t)),s.on("mouseenter",()=>{this._stage_context.container.style.cursor="pointer"}),s.on("mouseleave",()=>{this._stage_context.container.style.cursor="default"}),this.connections.push(o),this._insert_terminal_for_module_view(n,o,"provide"),this._insert_terminal_for_module_view(i,o,"requirement"),this.group.add(s)}delete_connection(t){const n=this.connections.findIndex(a=>a.id===t);this.connections[n].view.destroy(),this.connections.slice(n,1)}_insert_terminal_for_module_view(t,n,i){const a=this._registered_modules.find(s=>s.view===t.module_view);if(a){const s=a.terminal_lookup[t.terminal_lookup_id];s?s.connections.push(n):a.terminal_lookup[t.terminal_lookup_id]={type:i,connections:[n]};return}const r={view:t.module_view,terminal_lookup:Array(t.module_view._terminal_views.length)};r.terminal_lookup[t.terminal_lookup_id]={type:i,connections:[n]},this._registered_modules.push(r),r.view.add_observer(s=>{if(s.type==="TERMINALS_UPDATED"){const o=s.module_moved===!1;s.terminals.forEach(l=>{if(!r.terminal_lookup[l.id])return;const{connections:c,type:u}=r.terminal_lookup[l.id];c.forEach(d=>{u==="provide"?d.view.update_terminals(null,l,o):d.view.update_terminals(l,null,o)})})}})}}class bI{constructor(t,n){Ce(this,"_konva");Ce(this,"_module_views",{});Ce(this,"_model",null);Ce(this,"_module_vms",{});Ce(this,"_conn_man");Ce(this,"context");Ce(this,"_stage");Ce(this,"_bg");this.config=t,this._stage=new ri.Stage(t),this.resizeStage=this.resizeStage.bind(this),ri.dragButtons=[0,2],this._stage.on("contextmenu",s=>s.evt.preventDefault());const i=new ri.Layer({}),a=new ri.Text({text:"",fontFamily:xx.fontFamily,fontSize:16,padding:5,fill:"white",alpha:.75,visible:!1,sceneFunc:function(s,o){const{width:l,height:c}=o.size(),u=3;s.beginPath(),s.moveTo(u,0),s.lineTo(l-u,0),s.arcTo(l,0,l,u,u),s.lineTo(l,c-u),s.arcTo(l,c,l-u,c,u),s.lineTo(u,c),s.arcTo(0,c,0,c-u,u),s.lineTo(0,u),s.arcTo(0,0,u,0,u),s.closePath(),s.fillStyle=cr.colors.secondary,s.fill(),o._sceneFunc(s)},...fI.position});i.add(a);const r=new ri.Layer({draggable:!0});this._reset_static_layer(r),this._stage.on("wheel",s=>{s.evt.preventDefault();const o=r.scaleX(),l=this._stage.getPointerPosition();if(!l)return;const c={x:(l.x-r.x())/o,y:(l.y-r.y())/o},u=s.evt.deltaY===1||s.evt.deltaY===-1?s.evt.deltaY*.2:s.evt.deltaY,f=Math.exp(u*.005),m=o*f,p={x:l.x-c.x*m,y:l.y-c.y*m};this.setNewPosAndScale(r,p,m)}),this._stage.add(r),this._stage.add(i),this._konva={stage:this._stage,tooltip:a,static_layer:r,anim_layer:null},this.context=n,n.set_container(this._stage.container()),this.context.add_observer(s=>this._handle_stage_context_event(s)),this.registerListeners(),setTimeout(()=>this.resizeStage(),1500)}setNewPosAndScale(t,n,i){t.scale({x:i,y:i}),t.position(n),this._bg.width(this._stage.width()/i),this._bg.height(this._stage.height()/i),this._bg.setAbsolutePosition({x:0,y:0}),t.batchDraw()}registerListeners(){window.addEventListener("resize",this.resizeStage)}unregisterListeners(){window.removeEventListener("resize",this.resizeStage)}destroy(){this.unregisterListeners(),this._stage.destroy()}resizeStage(){const t=document.getElementById(this.config.container);if(!t)return;const n=t.offsetWidth,i=t.offsetHeight;this._stage.width(n),this._stage.height(i)}reset_view(){this.setNewPosAndScale(this._konva.static_layer,{x:0,y:0},1)}set_model(t){this._model,this._conn_man=new _I(this.context),this._reset_static_layer(this._konva.static_layer),this._konva.static_layer.add(this._conn_man.group),this._model=t,Object.keys(t._instances).forEach(n=>this._add_module_instance_to_stage(Number(n))),Object.keys(t._connections).forEach(n=>{try{this._add_connection_to_stage(Number(n))}catch(i){console.warn(i)}}),t.add_observer(n=>this._handle_config_event(n))}_handle_config_event(t){if(t.type==="MODULE_INSTANCE_ADDED")this._add_module_instance_to_stage(t.id);else if(t.type==="CONNECTION_ADDED")this._add_connection_to_stage(t.id);else if(t.type==="CONNECTION_DELETED")this._conn_man.delete_connection(t.id),this.context.unselect();else if(t.type==="MODULE_INSTANCE_DELETED"){const n=t.id;this._module_views[n].group.destroy(),delete this._module_views[n],delete this._module_vms[n],this.context.unselect()}}_handle_stage_context_event(t){t.type==="ADD_CONNECTION"?this._model.add_connection(t.connection):t.type==="SHOW_TOOLTIP"?(this._konva.tooltip.text(t.text),this._konva.tooltip.show()):t.type==="HIDE_TOOLTIP"&&this._konva.tooltip.hide()}_add_module_instance_to_stage(t){const n=new vI(this._model,t,this.context);this._module_vms[t]=n,n.grid_position||(n.grid_position={x:t,y:t});const i=new gI(n);this._module_views[t]=i,this._konva.static_layer.add(i.group)}_add_connection_to_stage(t){const n=this._model._connections[t],i=this._module_vms[n.requiring_instance_id],a=this._module_views[n.requiring_instance_id],r=this._module_vms[n.providing_instance_id],s=this._module_views[n.providing_instance_id],o=r.get_terminal_lookup_id(n.providing_impl_name,"provide");if(o===-1)throw Error(`Couldn't add connection to stage, terminal ${n.providing_impl_name} not found on ${r.type}.`);const l=i.get_terminal_lookup_id(n.requirement_name,"requirement");if(l===-1)throw Error(`Couldn't add connection to stage, terminal ${n.requirement_name} not found on ${i.type}.`);this._conn_man.add_connection(t,{module_view:s,terminal_lookup_id:o},{module_view:a,terminal_lookup_id:l})}_reset_static_layer(t){t.destroyChildren(),this._bg=new ri.Rect({width:this._stage.width(),height:this._stage.height(),fill:"rgba(255, 0, 0, 0)"}),this._bg.on("pointerclick",()=>this.context.unselect()),t.add(this._bg),t.on("dragstart",()=>{this._stage.container().style.cursor="grab"}),t.on("dragend",()=>{this._stage.container().style.cursor="default",this._bg.setAbsolutePosition({x:0,y:0})})}}/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function Ex(e){return typeof e>"u"||e===null}function wI(e){return typeof e=="object"&&e!==null}function kI(e){return Array.isArray(e)?e:Ex(e)?[]:[e]}function SI(e,t){var n,i,a,r;if(t)for(r=Object.keys(t),n=0,i=r.length;nV)for(;_e.length>0;){let ye=0,Ae=s(_e).length,$e="",Le=0;for(;ye>>1,yt=s(_e),St=yt.slice(0,Fe+1).join(""),se=this._getTextWidth(St)+me;se<=V?(ye=Fe+1,$e=St,Le=se):Ae=Fe}if($e){if(ie){const St=s(_e),se=s($e),ae=St[se.length],pe=ae===w||ae===m;let Oe;if(pe&&Le<=V)Oe=se.length;else{const Re=se.lastIndexOf(w),He=se.lastIndexOf(m);Oe=Math.max(Re,He)+1}Oe>0&&(ye=Oe,$e=St.slice(0,ye).join(""),Le=this._getTextWidth($e))}if($e=$e.trimRight(),this._addTextLine($e),U=Math.max(U,Le),K+=H,this._shouldHandleEllipsis(K)){this._tryToAddEllipsisToLastLine();break}if(_e=s(_e).slice(ye).join("").trimLeft(),_e.length>0&&(he=this._getTextWidth(_e),he<=V)){this._addTextLine(_e),K+=H,U=Math.max(U,he);break}}else break}else this._addTextLine(_e),K+=H,U=Math.max(U,he),this._shouldHandleEllipsis(K)&&reL)break}this.textHeight=R,this.textWidth=U}_shouldHandleEllipsis(F){const R=+this.fontSize(),U=this.lineHeight()*R,H=this.attrs.height,D=H!==o&&H!==void 0,G=this.padding(),J=H-G*2;return!(this.wrap()!==T)||D&&F+U>J}_tryToAddEllipsisToLastLine(){const F=this.attrs.width,R=F!==o&&F!==void 0,U=this.padding(),H=F-U*2,D=this.ellipsis(),G=this.textArr[this.textArr.length-1];!G||!D||(R&&(this._getTextWidth(G.text+I)p?null:i.Path.getPointAtLengthOfDataArray(m,this.dataArray)}_readDataAttribute(){this.dataArray=i.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(m){m.setAttr("font",this._getContextFont()),m.setAttr("textBaseline",this.textBaseline()),m.setAttr("textAlign","left"),m.save();const p=this.textDecoration(),g=this.fill(),v=this.fontSize(),_=this.glyphInfo;p==="underline"&&m.beginPath();for(let h=0;h<_.length;h++){m.save();const y=_[h].p0;m.translate(y.x,y.y),m.rotate(_[h].rotation),this.partialText=_[h].text,m.fillStrokeShape(this),p==="underline"&&(h===0&&m.moveTo(0,v/2+1),m.lineTo(v,v/2+1)),m.restore()}p==="underline"&&(m.strokeStyle=g,m.lineWidth=v/20,m.stroke()),m.restore()}_hitFunc(m){m.beginPath();const p=this.glyphInfo;if(p.length>=1){const g=p[0].p0;m.moveTo(g.x,g.y)}for(let g=0;gC+`.${c}`).join(" "),d="nodesRect",f=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],m={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},p="ontouchstart"in s.Konva._global;function g(C,E,A){if(C==="rotater")return A;E+=e.Util.degToRad(m[C]||0);const T=(e.Util.radToDeg(E)%360+360)%360;return e.Util._inRange(T,315+22.5,360)||e.Util._inRange(T,0,22.5)?"ns-resize":e.Util._inRange(T,45-22.5,45+22.5)?"nesw-resize":e.Util._inRange(T,90-22.5,90+22.5)?"ew-resize":e.Util._inRange(T,135-22.5,135+22.5)?"nwse-resize":e.Util._inRange(T,180-22.5,180+22.5)?"ns-resize":e.Util._inRange(T,225-22.5,225+22.5)?"nesw-resize":e.Util._inRange(T,270-22.5,270+22.5)?"ew-resize":e.Util._inRange(T,315-22.5,315+22.5)?"nwse-resize":(e.Util.error("Transformer has unknown angle for cursor detection: "+T),"pointer")}const v=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function _(C){return{x:C.x+C.width/2*Math.cos(C.rotation)+C.height/2*Math.sin(-C.rotation),y:C.y+C.height/2*Math.cos(C.rotation)+C.width/2*Math.sin(C.rotation)}}function h(C,E,A){const T=A.x+(C.x-A.x)*Math.cos(E)-(C.y-A.y)*Math.sin(E),I=A.y+(C.x-A.x)*Math.sin(E)+(C.y-A.y)*Math.cos(E);return{...C,rotation:C.rotation+E,x:T,y:I}}function y(C,E){const A=_(C);return h(C,E,A)}function b(C,E,A){let T=E;for(let I=0;II.isAncestorOf(this)?(e.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=E=A,E.length===1&&this.useSingleNodeRotation()?this.rotation(E[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(I=>{const S=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},$=I._attrsAffectingSize.map(O=>O+"Change."+this._getEventNamespace()).join(" ");I.on($,S),I.on(f.map(O=>O+`.${this._getEventNamespace()}`).join(" "),S),I.on(`absoluteTransformChange.${this._getEventNamespace()}`,S),this._proxyDrag(I)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(E){let A;E.on(`dragstart.${this._getEventNamespace()}`,T=>{A=E.getAbsolutePosition(),!this.isDragging()&&E!==this.findOne(".back")&&this.startDrag(T,!1)}),E.on(`dragmove.${this._getEventNamespace()}`,T=>{if(!A)return;const I=E.getAbsolutePosition(),S=I.x-A.x,$=I.y-A.y;this.nodes().forEach(O=>{if(O===E||O.isDragging())return;const j=O.getAbsolutePosition();O.setAbsolutePosition({x:j.x+S,y:j.y+$}),O.startDrag(T)}),A=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(d),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(d,this.__getNodeRect)}__getNodeShape(E,A=this.rotation(),T){const I=E.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),S=E.getAbsoluteScale(T),$=E.getAbsolutePosition(T),O=I.x*S.x-E.offsetX()*S.x,j=I.y*S.y-E.offsetY()*S.y,B=(s.Konva.getAngle(E.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),Y={x:$.x+O*Math.cos(B)+j*Math.sin(-B),y:$.y+j*Math.cos(B)+O*Math.sin(B),width:I.width*S.x,height:I.height*S.y,rotation:B};return h(Y,-s.Konva.getAngle(A),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const A=[];this.nodes().map(B=>{const Y=B.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),X=[{x:Y.x,y:Y.y},{x:Y.x+Y.width,y:Y.y},{x:Y.x+Y.width,y:Y.y+Y.height},{x:Y.x,y:Y.y+Y.height}],z=B.getAbsoluteTransform();X.forEach(function(M){const q=z.point(M);A.push(q)})});const T=new e.Transform;T.rotate(-s.Konva.getAngle(this.rotation()));let I=1/0,S=1/0,$=-1/0,O=-1/0;A.forEach(function(B){const Y=T.point(B);I===void 0&&(I=$=Y.x,S=O=Y.y),I=Math.min(I,Y.x),S=Math.min(S,Y.y),$=Math.max($,Y.x),O=Math.max(O,Y.y)}),T.invert();const j=T.point({x:I,y:S});return{x:j.x,y:j.y,width:$-I,height:O-S,rotation:s.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),v.forEach(E=>{this._createAnchor(E)}),this._createAnchor("rotater")}_createAnchor(E){const A=new a.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:E+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:p?10:"auto"}),T=this;A.on("mousedown touchstart",function(I){T._handleMouseDown(I)}),A.on("dragstart",I=>{A.stopDrag(),I.cancelBubble=!0}),A.on("dragend",I=>{I.cancelBubble=!0}),A.on("mouseenter",()=>{const I=s.Konva.getAngle(this.rotation()),S=this.rotateAnchorCursor(),$=g(E,I,S);A.getStage().content&&(A.getStage().content.style.cursor=$),this._cursorChange=!0}),A.on("mouseout",()=>{A.getStage().content&&(A.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(A)}_createBack(){const E=new i.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(A,T){const I=T.getParent(),S=I.padding();A.beginPath(),A.rect(-S,-S,T.width()+S*2,T.height()+S*2),A.moveTo(T.width()/2,-S),I.rotateEnabled()&&I.rotateLineVisible()&&A.lineTo(T.width()/2,-I.rotateAnchorOffset()*e.Util._sign(T.height())-S),A.fillStrokeShape(T)},hitFunc:(A,T)=>{if(!this.shouldOverdrawWholeArea())return;const I=this.padding();A.beginPath(),A.rect(-I,-I,T.width()+I*2,T.height()+I*2),A.fillStrokeShape(T)}});this.add(E),this._proxyDrag(E),E.on("dragstart",A=>{A.cancelBubble=!0}),E.on("dragmove",A=>{A.cancelBubble=!0}),E.on("dragend",A=>{A.cancelBubble=!0}),this.on("dragmove",A=>{this.update()})}_handleMouseDown(E){if(this._transforming)return;this._movingAnchorName=E.target.name().split(" ")[0];const A=this._getNodeRect(),T=A.width,I=A.height,S=Math.sqrt(Math.pow(T,2)+Math.pow(I,2));this.sin=Math.abs(I/S),this.cos=Math.abs(T/S),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const $=E.target.getAbsolutePosition(),O=E.target.getStage().getPointerPosition();this._anchorDragOffset={x:O.x-$.x,y:O.y-$.y},k++,this._fire("transformstart",{evt:E.evt,target:this.getNode()}),this._nodes.forEach(j=>{j._fire("transformstart",{evt:E.evt,target:j})})}_handleMouseMove(E){let A,T,I;const S=this.findOne("."+this._movingAnchorName),$=S.getStage();$.setPointersPositions(E);const O=$.getPointerPosition();let j={x:O.x-this._anchorDragOffset.x,y:O.y-this._anchorDragOffset.y};const B=S.getAbsolutePosition();this.anchorDragBoundFunc()&&(j=this.anchorDragBoundFunc()(B,j,E)),S.setAbsolutePosition(j);const Y=S.getAbsolutePosition();if(B.x===Y.x&&B.y===Y.y)return;if(this._movingAnchorName==="rotater"){const J=this._getNodeRect();A=S.x()-J.width/2,T=-S.y()+J.height/2;let Q=Math.atan2(-T,A)+Math.PI/2;J.height<0&&(Q-=Math.PI);const V=s.Konva.getAngle(this.rotation())+Q,L=s.Konva.getAngle(this.rotationSnapTolerance()),Z=b(this.rotationSnaps(),V,L)-J.rotation,ne=y(J,Z);this._fitNodesInto(ne,E);return}const X=this.shiftBehavior();let z;X==="inverted"?z=this.keepRatio()&&!E.shiftKey:X==="none"?z=this.keepRatio():z=this.keepRatio()||E.shiftKey;var U=this.centeredScaling()||E.altKey;if(this._movingAnchorName==="top-left"){if(z){var M=U?{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(M.x-S.x(),2)+Math.pow(M.y-S.y(),2));var q=this.findOne(".top-left").x()>M.x?-1:1,F=this.findOne(".top-left").y()>M.y?-1:1;A=I*this.cos*q,T=I*this.sin*F,this.findOne(".top-left").x(M.x-A),this.findOne(".top-left").y(M.y-T)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(S.y());else if(this._movingAnchorName==="top-right"){if(z){var M=U?{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(S.x()-M.x,2)+Math.pow(M.y-S.y(),2));var q=this.findOne(".top-right").x()M.y?-1:1;A=I*this.cos*q,T=I*this.sin*F,this.findOne(".top-right").x(M.x+A),this.findOne(".top-right").y(M.y-T)}var R=S.position();this.findOne(".top-left").y(R.y),this.findOne(".bottom-right").x(R.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(S.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(S.x());else if(this._movingAnchorName==="bottom-left"){if(z){var M=U?{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(M.x-S.x(),2)+Math.pow(S.y()-M.y,2));var q=M.x{var S;I._fire("transformend",{evt:E,target:I}),(S=I.getLayer())===null||S===void 0||S.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(E,A){const T=this._getNodeRect(),I=1;if(e.Util._inRange(E.width,-this.padding()*2-I,I)){this.update();return}if(e.Util._inRange(E.height,-this.padding()*2-I,I)){this.update();return}const S=new e.Transform;if(S.rotate(s.Konva.getAngle(this.rotation())),this._movingAnchorName&&E.width<0&&this._movingAnchorName.indexOf("left")>=0){const z=S.point({x:-this.padding()*2,y:0});E.x+=z.x,E.y+=z.y,E.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=z.x,this._anchorDragOffset.y-=z.y}else if(this._movingAnchorName&&E.width<0&&this._movingAnchorName.indexOf("right")>=0){const z=S.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=z.x,this._anchorDragOffset.y-=z.y,E.width+=this.padding()*2}if(this._movingAnchorName&&E.height<0&&this._movingAnchorName.indexOf("top")>=0){const z=S.point({x:0,y:-this.padding()*2});E.x+=z.x,E.y+=z.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=z.x,this._anchorDragOffset.y-=z.y,E.height+=this.padding()*2}else if(this._movingAnchorName&&E.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const z=S.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=z.x,this._anchorDragOffset.y-=z.y,E.height+=this.padding()*2}if(this.boundBoxFunc()){const z=this.boundBoxFunc()(T,E);z?E=z:e.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const $=1e7,O=new e.Transform;O.translate(T.x,T.y),O.rotate(T.rotation),O.scale(T.width/$,T.height/$);const j=new e.Transform,B=E.width/$,Y=E.height/$;this.flipEnabled()===!1?(j.translate(E.x,E.y),j.rotate(E.rotation),j.translate(E.width<0?E.width:0,E.height<0?E.height:0),j.scale(Math.abs(B),Math.abs(Y))):(j.translate(E.x,E.y),j.rotate(E.rotation),j.scale(B,Y));const X=j.multiply(O.invert());this._nodes.forEach(z=>{var M;const q=z.getParent().getAbsoluteTransform(),F=z.getTransform().copy();F.translate(z.offsetX(),z.offsetY());const R=new e.Transform;R.multiply(q.copy().invert()).multiply(X).multiply(q).multiply(F);const U=R.decompose();z.setAttrs(U),(M=z.getLayer())===null||M===void 0||M.batchDraw()}),this.rotation(e.Util._getRotation(E.rotation)),this._nodes.forEach(z=>{this._fire("transform",{evt:A,target:z}),z._fire("transform",{evt:A,target:z})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(E,A){this.findOne(E).setAttrs(A)}update(){var E;const A=this._getNodeRect();this.rotation(e.Util._getRotation(A.rotation));const T=A.width,I=A.height,S=this.enabledAnchors(),$=this.resizeEnabled(),O=this.padding(),j=this.anchorSize(),B=this.find("._anchor");B.forEach(X=>{X.setAttrs({width:j,height:j,offsetX:j/2,offsetY:j/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:j/2+O,offsetY:j/2+O,visible:$&&S.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:T/2,y:0,offsetY:j/2+O,visible:$&&S.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:T,y:0,offsetX:j/2-O,offsetY:j/2+O,visible:$&&S.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:I/2,offsetX:j/2+O,visible:$&&S.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:T,y:I/2,offsetX:j/2-O,visible:$&&S.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:I,offsetX:j/2+O,offsetY:j/2-O,visible:$&&S.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:T/2,y:I,offsetY:j/2-O,visible:$&&S.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:T,y:I,offsetX:j/2-O,offsetY:j/2-O,visible:$&&S.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:T/2,y:-this.rotateAnchorOffset()*e.Util._sign(I)-O,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:T,height:I,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const Y=this.anchorStyleFunc();Y&&B.forEach(X=>{Y(X)}),(E=this.getLayer())===null||E===void 0||E.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const E=this.findOne("."+this._movingAnchorName);E&&E.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),r.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return n.Node.prototype.toObject.call(this)}clone(E){return n.Node.prototype.clone.call(this,E)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Bo.Transformer=w,w.isTransforming=()=>k>0;function P(C){return C instanceof Array||e.Util.warn("enabledAnchors value should be an array"),C instanceof Array&&C.forEach(function(E){v.indexOf(E)===-1&&e.Util.warn("Unknown anchor name: "+E+". Available names are: "+v.join(", "))}),C||[]}return w.prototype.className="Transformer",(0,l._registerNode)(w),t.Factory.addGetterSetter(w,"enabledAnchors",v,P),t.Factory.addGetterSetter(w,"flipEnabled",!0,(0,o.getBooleanValidator)()),t.Factory.addGetterSetter(w,"resizeEnabled",!0),t.Factory.addGetterSetter(w,"anchorSize",10,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"rotateEnabled",!0),t.Factory.addGetterSetter(w,"rotateLineVisible",!0),t.Factory.addGetterSetter(w,"rotationSnaps",[]),t.Factory.addGetterSetter(w,"rotateAnchorOffset",50,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"rotateAnchorCursor","crosshair"),t.Factory.addGetterSetter(w,"rotationSnapTolerance",5,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"borderEnabled",!0),t.Factory.addGetterSetter(w,"anchorStroke","rgb(0, 161, 255)"),t.Factory.addGetterSetter(w,"anchorStrokeWidth",1,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"anchorFill","white"),t.Factory.addGetterSetter(w,"anchorCornerRadius",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"borderStroke","rgb(0, 161, 255)"),t.Factory.addGetterSetter(w,"borderStrokeWidth",1,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"borderDash"),t.Factory.addGetterSetter(w,"keepRatio",!0),t.Factory.addGetterSetter(w,"shiftBehavior","default"),t.Factory.addGetterSetter(w,"centeredScaling",!1),t.Factory.addGetterSetter(w,"ignoreStroke",!1),t.Factory.addGetterSetter(w,"padding",0,(0,o.getNumberValidator)()),t.Factory.addGetterSetter(w,"nodes"),t.Factory.addGetterSetter(w,"node"),t.Factory.addGetterSetter(w,"boundBoxFunc"),t.Factory.addGetterSetter(w,"anchorDragBoundFunc"),t.Factory.addGetterSetter(w,"anchorStyleFunc"),t.Factory.addGetterSetter(w,"shouldOverdrawWholeArea",!1),t.Factory.addGetterSetter(w,"useSingleNodeRotation",!0),t.Factory.backCompat(w,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"}),Bo}var zo={},B0;function L$(){if(B0)return zo;B0=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.Wedge=void 0;const e=gt(),t=Sn(),n=pt(),i=vt(),a=pt();let r=class extends t.Shape{_sceneFunc(o){o.beginPath(),o.arc(0,0,this.radius(),0,n.Konva.getAngle(this.angle()),this.clockwise()),o.lineTo(0,0),o.closePath(),o.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(o){this.radius(o/2)}setHeight(o){this.radius(o/2)}};return zo.Wedge=r,r.prototype.className="Wedge",r.prototype._centroid=!0,r.prototype._attrsAffectingSize=["radius"],(0,a._registerNode)(r),e.Factory.addGetterSetter(r,"radius",0,(0,i.getNumberValidator)()),e.Factory.addGetterSetter(r,"angle",0,(0,i.getNumberValidator)()),e.Factory.addGetterSetter(r,"clockwise",!1),e.Factory.backCompat(r,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"}),zo}var Ho={},z0;function j$(){if(z0)return Ho;z0=1,Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.Blur=void 0;const e=gt(),t=on(),n=vt();function i(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const a=[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],r=[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 s(l,c){const u=l.data,d=l.width,f=l.height;let m,p,g,v,_,h,y,b,k,w,P,C,E,A,T,I,S,$,O,j,B,Y,X,z;const M=c+c+1,q=d-1,F=f-1,R=c+1,U=R*(R+1)/2,H=new i,D=a[c],G=r[c];let J=null,Q=H,W=null,V=null;for(g=1;g>G,X!==0?(X=255/X,u[h]=(b*D>>G)*X,u[h+1]=(k*D>>G)*X,u[h+2]=(w*D>>G)*X):u[h]=u[h+1]=u[h+2]=0,b-=C,k-=E,w-=A,P-=T,C-=W.r,E-=W.g,A-=W.b,T-=W.a,v=y+((v=m+c+1)>G,X>0?(X=255/X,u[v]=(b*D>>G)*X,u[v+1]=(k*D>>G)*X,u[v+2]=(w*D>>G)*X):u[v]=u[v+1]=u[v+2]=0,b-=C,k-=E,w-=A,P-=T,C-=W.r,E-=W.g,A-=W.b,T-=W.a,v=m+((v=p+R)0&&s(c,u)};return Ho.Blur=o,e.Factory.addGetterSetter(t.Node,"blurRadius",0,(0,n.getNumberValidator)(),e.Factory.afterSetFilter),Ho}var Uo={},H0;function F$(){if(H0)return Uo;H0=1,Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.Brighten=void 0;const e=gt(),t=on(),n=vt(),i=function(a){const r=this.brightness()*255,s=a.data,o=s.length;for(let l=0;l255?255:l,c=c<0?0:c>255?255:c,u=u<0?0:u>255?255:u,s[d]=l,s[d+1]=c,s[d+2]=u};return Go.Contrast=i,e.Factory.addGetterSetter(t.Node,"contrast",0,(0,n.getNumberValidator)(),e.Factory.afterSetFilter),Go}var Wo={},G0;function B$(){if(G0)return Wo;G0=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.Emboss=void 0;const e=gt(),t=on(),n=nn(),i=vt(),a=function(r){const s=this.embossStrength()*10,o=this.embossWhiteLevel()*255,l=this.embossDirection(),c=this.embossBlend(),u=r.data,d=r.width,f=r.height,m=d*4;let p=0,g=0,v=f;switch(l){case"top-left":p=-1,g=-1;break;case"top":p=-1,g=0;break;case"top-right":p=-1,g=1;break;case"right":p=0,g=1;break;case"bottom-right":p=1,g=1;break;case"bottom":p=1,g=0;break;case"bottom-left":p=1,g=-1;break;case"left":p=0,g=-1;break;default:n.Util.error("Unknown emboss direction: "+l)}do{const _=(v-1)*m;let h=p;v+h<1&&(h=0),v+h>f&&(h=0);const y=(v-1+h)*d*4;let b=d;do{const k=_+(b-1)*4;let w=g;b+w<1&&(w=0),b+w>d&&(w=0);const P=y+(b-1+w)*4,C=u[k]-u[P],E=u[k+1]-u[P+1],A=u[k+2]-u[P+2];let T=C;const I=T>0?T:-T,S=E>0?E:-E,$=A>0?A:-A;if(S>I&&(T=E),$>I&&(T=A),T*=s,c){const O=u[k]+T,j=u[k+1]+T,B=u[k+2]+T;u[k]=O>255?255:O<0?0:O,u[k+1]=j>255?255:j<0?0:j,u[k+2]=B>255?255:B<0?0:B}else{let O=o-T;O<0?O=0:O>255&&(O=255),u[k]=u[k+1]=u[k+2]=O}}while(--b)}while(--v)};return Wo.Emboss=a,e.Factory.addGetterSetter(t.Node,"embossStrength",.5,(0,i.getNumberValidator)(),e.Factory.afterSetFilter),e.Factory.addGetterSetter(t.Node,"embossWhiteLevel",.5,(0,i.getNumberValidator)(),e.Factory.afterSetFilter),e.Factory.addGetterSetter(t.Node,"embossDirection","top-left",void 0,e.Factory.afterSetFilter),e.Factory.addGetterSetter(t.Node,"embossBlend",!1,void 0,e.Factory.afterSetFilter),Wo}var Ko={},W0;function z$(){if(W0)return Ko;W0=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.Enhance=void 0;const e=gt(),t=on(),n=vt();function i(r,s,o,l,c){const u=o-s,d=c-l;if(u===0)return l+d/2;if(d===0)return l;let f=(r-s)/u;return f=d*f+l,f}const a=function(r){const s=r.data,o=s.length;let l=s[0],c=l,u,d=s[1],f=d,m,p=s[2],g=p,v;const _=this.enhance();if(_===0)return;for(let T=0;Tc&&(c=u),m=s[T+1],mf&&(f=m),v=s[T+2],vg&&(g=v);c===l&&(c=255,l=0),f===d&&(f=255,d=0),g===p&&(g=255,p=0);let h,y,b,k,w,P,C,E,A;_>0?(y=c+_*(255-c),b=l-_*(l-0),w=f+_*(255-f),P=d-_*(d-0),E=g+_*(255-g),A=p-_*(p-0)):(h=(c+l)*.5,y=c+_*(c-h),b=l+_*(l-h),k=(f+d)*.5,w=f+_*(f-k),P=d+_*(d-k),C=(g+p)*.5,E=g+_*(g-C),A=p+_*(p-C));for(let T=0;Tv?y:v;const b=m,k=f,w=360/k*Math.PI/180;for(let P=0;Pv?y:v;const b=m,k=f,w=0;let P,C;for(_=0;_l&&(T=A,I=0,S=-1),d=0;d=0&&E=0&&A=0&&E=0&&A=255*4?255:0}return h}function u(f,m,p){const g=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],v=Math.round(Math.sqrt(g.length)),_=Math.floor(v/2),h=[];for(let y=0;y=0&&E=0&&A=o))for(u=b;u=l||(d=(o*u+c)*4,f+=E[d+0],m+=E[d+1],p+=E[d+2],g+=E[d+3],C+=1);for(f=f/C,m=m/C,p=p/C,g=g/C,c=h;c=o))for(u=b;u=l||(d=(o*u+c)*4,E[d+0]=f,E[d+1]=m,E[d+2]=p,E[d+3]=g)}};return nl.Pixelate=a,e.Factory.addGetterSetter(n.Node,"pixelSize",8,(0,i.getNumberValidator)(),e.Factory.afterSetFilter),nl}var il={},nb;function Z$(){if(nb)return il;nb=1,Object.defineProperty(il,"__esModule",{value:!0}),il.Posterize=void 0;const e=gt(),t=on(),n=vt(),i=function(a){const r=Math.round(this.levels()*254)+1,s=a.data,o=s.length,l=255/r;for(let c=0;c255?255:a<0?0:Math.round(a)}),e.Factory.addGetterSetter(t.Node,"green",0,function(a){return this._filterUpToDate=!1,a>255?255:a<0?0:Math.round(a)}),e.Factory.addGetterSetter(t.Node,"blue",0,n.RGBComponent,e.Factory.afterSetFilter),rl}var al={},rb;function eI(){if(rb)return al;rb=1,Object.defineProperty(al,"__esModule",{value:!0}),al.RGBA=void 0;const e=gt(),t=on(),n=vt(),i=function(a){const r=a.data,s=r.length,o=this.red(),l=this.green(),c=this.blue(),u=this.alpha();for(let d=0;d255?255:a<0?0:Math.round(a)}),e.Factory.addGetterSetter(t.Node,"green",0,function(a){return this._filterUpToDate=!1,a>255?255:a<0?0:Math.round(a)}),e.Factory.addGetterSetter(t.Node,"blue",0,n.RGBComponent,e.Factory.afterSetFilter),e.Factory.addGetterSetter(t.Node,"alpha",1,function(a){return this._filterUpToDate=!1,a>1?1:a<0?0:a}),al}var sl={},ab;function tI(){if(ab)return sl;ab=1,Object.defineProperty(sl,"__esModule",{value:!0}),sl.Sepia=void 0;const e=function(t){const n=t.data,i=n.length;for(let a=0;a127&&(u=255-u),d>127&&(d=255-d),f>127&&(f=255-f),n[c]=u,n[c+1]=d,n[c+2]=f}while(--l)}while(--s)};return ol.Solarize=e,ol}var ll={},ob;function iI(){if(ob)return ll;ob=1,Object.defineProperty(ll,"__esModule",{value:!0}),ll.Threshold=void 0;const e=gt(),t=on(),n=vt(),i=function(a){const r=this.threshold()*255,s=a.data,o=s.length;for(let l=0;l0&&arguments[0]!==void 0?arguments[0]:{};const{blueprint:t,...n}=e,i=Rn(t,n),{aliases:a={},components:r={},directives:s={}}=i,o=T6(i.defaults),l=jT(i.display,i.ssr),c=G6(i.theme),u=mT(i.icons),d=B6(i.locale),f=o8(i.date,d),m=u8(i.goTo,d);return{install:g=>{for(const v in s)g.directive(v,s[v]);for(const v in r)g.component(v,r[v]);for(const v in a)g.component(v,Qi({...a[v],name:v,aliasName:a[v].name}));if(c.install(g),g.provide(Js,o),g.provide(ap,l),g.provide(Ul,c),g.provide(np,u),g.provide(xd,d),g.provide(DC,f.options),g.provide(F_,f.instance),g.provide(LC,m),kt&&i.ssr)if(g.$nuxt)g.$nuxt.hook("app:suspense:resolve",()=>{l.update()});else{const{mount:v}=g;g.mount=function(){const _=v(...arguments);return ct(()=>l.update()),g.mount=v,_}}Jn.reset(),g.mixin({computed:{$vuetify(){return qt({defaults:_s.call(this,Js),display:_s.call(this,ap),theme:_s.call(this,Ul),icons:_s.call(this,np),locale:_s.call(this,xd),date:_s.call(this,F_)})}}})},defaults:o,display:l,theme:c,icons:u,locale:d,date:f,goTo:m}}const cI="3.7.13";Sx.version=cI;function _s(e){var i,a;const t=this.$,n=((i=t.parent)==null?void 0:i.provides)??((a=t.vnode.appContext)==null?void 0:a.provides);if(n&&e in n)return n[e]}const Cx={dark:!1,colors:{background:"#EFEDE8",surface:"#EFEDE8",primary:"#254C84",secondary:"#35CE7C",error:"#b9352b",info:"#254C84",success:"#35CE7C",warning:"#c09112","on-background":"#212121","on-surface":"#212121"}},cr=Cx,uI=Sx({blueprint:lI,theme:{defaultTheme:"everestTheme",themes:{everestTheme:Cx}}}),xr={TERMINAL_REQUIREMENT:cr.colors.secondary,TERMINAL_REQUIREMENT_DISABLED:"#d5d4cc",TERMINAL_PROVIDE:cr.colors.warning,TERMINAL_PROVIDE_DISABLED:"#d5d4cc",CONNECTION:cr.colors.secondary},Dm={TERMINAL:"M12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M17,14L12,9L7,14H17Z",DISABLED:"M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2C6.47,2 2,6.47 2,12C2,17.53 6.47,22 12,22C17.53,22 22,17.53 22,12C22,6.47 17.53,2 12,2M14.59,8L12,10.59L9.41,8L8,9.41L10.59,12L8,14.59L9.41,16L12,13.41L14.59,16L16,14.59L13.41,12L16,9.41L14.59,8Z"},dt={GRID:24,FRAME_WIDTH:288,FRAME_HEIGHT:144,TERMINAL:24,CONNECTION_WIDTH:4,CONNECTION_CTRL:100},xx={fontFamily:"Roboto, sans-serif"},dI={fontFamily:"Roboto Mono, monospace"},fI={position:{x:10,y:10}},mI=1e4;class hI extends ri.Path{constructor(t){t.data=t.data||Dm.TERMINAL,t.fill=t.fill||t.terminal_type==="requirement"?xr.TERMINAL_REQUIREMENT:xr.TERMINAL_PROVIDE,t.x=t.x||0,t.y=t.y||0,t.offset=t.offset||{x:dt.TERMINAL/2,y:dt.TERMINAL/2},t.hitFunc=t.hitFunc||function(n,i){n.beginPath(),n.rect(0,0,dt.TERMINAL,dt.TERMINAL),n.closePath(),n.fillShape(i)},super(t),t.terminal_alignment&&this.set_alignment(t.terminal_alignment)}get terminal_type(){return this.getAttr("terminal_type")}get terminal_id(){return this.getAttr("terminal_id")}get terminal_alignment(){return this.getAttr("terminal_alignment")}set_alignment(t){this.setAttr("terminal_alignment",t);const n=this.terminal_type==="provide";t==="top"?this.rotation(n?0:180):t==="right"?this.rotation(n?90:270):t==="bottom"?this.rotation(n?180:0):t==="left"&&this.rotation(n?270:90)}set_appearence(t){t!=="DISABLED"&&this.data(Dm.TERMINAL),t==="DISABLED"?(this.data(Dm.DISABLED),this.fill(this.terminal_type==="requirement"?xr.TERMINAL_REQUIREMENT_DISABLED:xr.TERMINAL_PROVIDE_DISABLED),this.listening(!1)):t==="PLACEHOLDER"?(this.fill(this.terminal_type==="requirement"?xr.TERMINAL_REQUIREMENT_DISABLED:xr.TERMINAL_PROVIDE_DISABLED),this.listening(!1)):t==="NORMAL"&&(this.fill(this.terminal_type==="requirement"?xr.TERMINAL_REQUIREMENT:xr.TERMINAL_PROVIDE),this.listening(!0))}}function pI(e,t,n){let i=null,a=null;return 0dt.FRAME_HEIGHT&&tdt.FRAME_WIDTH&&e{const c=new hI({terminal_type:o.terminal.type,terminal_id:l,terminal_alignment:o.alignment});return c.setDraggable(!0),c.on("dragstart",()=>this._terminal_dragstart_handler(c)),c.on("dragmove",()=>this._terminal_dragmove_handler(c)),c.on("dragend",()=>this._terminal_dragend_handler(c)),c.on("mouseenter",()=>{this._vm.set_cursor("pointer");const u={type:"SHOW_TOOLTIP",text:`Interface type: ${o.terminal.interface}`};this._vm.notify_stage_context(u)}),c.on("mouseleave",()=>{this._vm.set_cursor("default");const u={type:"HIDE_TOOLTIP"};this._vm.notify_stage_context(u)}),c.on("pointerclick",u=>{t.clicked_terminal(l),u.cancelBubble=!0}),c}),Object.entries(t.terminal_dist).forEach(([o,l])=>{this._recalculate_terminal_position(o,l,!1)}),t.add_observer(o=>this._vm_event_handler(o)),this.group.on("dragmove",()=>this._module_dragmove_handler()),this.group.position({x:t.grid_position.x*dt.GRID,y:t.grid_position.y*dt.GRID});const n=new ri.Rect({cornerRadius:4,width:dt.FRAME_WIDTH,height:dt.FRAME_HEIGHT,fill:cr.colors.primary,shadowBlur:4,shadowOpacity:.4,shadowOffset:{x:2,y:2},fillAfterStrokeEnabled:!0,listening:!0}),i=8,a=new ri.Line({cornerRadius:4,points:[0,i/2,dt.FRAME_WIDTH,i/2],stroke:cr.colors.secondary,strokeWidth:i,x:n.x(),y:n.y(),listening:!0}),r=new ri.Text({wrap:"none",text:t.id,fontFamily:xx.fontFamily,ellipsis:!0,fill:"white",fontSize:16*2,padding:16,y:i,width:dt.FRAME_WIDTH,listening:!0}),s=new ri.Text({wrap:"none",text:`${t.type}`,fontFamily:dI.fontFamily,ellipsis:!0,fill:"white",opacity:.5,fontSize:16,padding:8,width:dt.FRAME_WIDTH,y:n.height()-16*2,align:"right",listening:!0});[n,r,a,s].forEach(o=>{o.on("mouseenter",()=>{this._vm.set_cursor("pointer")}),o.on("mouseleave",()=>{this._vm.set_cursor("default")}),o.on("pointerclick",l=>{this._vm.clicked_title(),l.cancelBubble=!0})}),this._title=r,this.group.add(n,a,s,r,...this._terminal_views)}get_terminal_placement(t){const n=this._terminal_views[t],i=n.position(),a=this.group.position();return{x:i.x+a.x,y:i.y+a.y,alignment:n.terminal_alignment}}add_observer(t){return this._observers.push(t),()=>{this._observers=this._observers.filter(n=>n!==t)}}_notify(t){this._observers.forEach(n=>n(t))}_vm_event_handler(t){t.type==="TERMINAL_MODIFY_APPEARENCE"?(t.disable.forEach(n=>{this._terminal_views[n].set_appearence("DISABLED")}),t.normal.forEach(n=>{this._terminal_views[n].set_appearence("NORMAL")}),this.group.children.length>0&&this.group.cache()):t.type==="MODULE_MODEL_UPDATE"&&(this._title.setText(this._vm.id),this.group.children.length>0&&this.group.cache())}_module_dragmove_handler(){const t=this.group.position(),n={x:Math.round(t.x/dt.GRID),y:Math.round(t.y/dt.GRID)},i=this._vm.grid_position,a={x:n.x*dt.GRID,y:n.y*dt.GRID};if(this.group.position(a),i.x!==n.x||i.y!==n.y){this._vm.grid_position=n;const r=this._terminal_views.map((s,o)=>({alignment:s.terminal_alignment,id:o,x:s.x()+a.x,y:s.y()+a.y}));this._notify({type:"TERMINALS_UPDATED",terminals:r,module_moved:!0})}}_terminal_dragstart_handler(t){const n=t.clone();n.set_appearence("PLACEHOLDER"),this._terminal_views[t.terminal_id]=n,this.group.add(n),t.moveToTop(),this.group.clearCache()}_terminal_dragmove_handler(t){const n=pI(t.x(),t.y(),this._vm.terminal_dist);if(!n.align)return;n.align!==this._vm.terminal_lookup[t.terminal_id].alignment&&t.set_alignment(n.align),this._vm.move_terminal(t.terminal_id,n.align,n.index).forEach(a=>{this._recalculate_terminal_position(a,this._vm.terminal_dist[a],!0)})}_terminal_dragend_handler(t){this._terminal_views[t.terminal_id].destroy(),this._terminal_views[t.terminal_id]=t;const n=this._vm.terminal_lookup[t.terminal_id].alignment;this._recalculate_terminal_position(n,this._vm.terminal_dist[n]),this.group.children.length>0&&this.group.cache()}_recalculate_terminal_position(t,n,i=!1){const a=t==="top"||t==="bottom",r=t==="right"?dt.FRAME_WIDTH+dt.TERMINAL:0,s=t==="bottom"?dt.FRAME_HEIGHT+dt.TERMINAL:0,o=a?dt.FRAME_WIDTH:dt.FRAME_HEIGHT,l=n.length,c={type:"TERMINALS_UPDATED",terminals:[],module_moved:!1};n.forEach((u,d)=>{const f=this._terminal_views[u],m=(d+.5)*o/l,p=r+(a?m:-24/2),g=s+(a?-24/2:m);f.set_alignment(t),i?f.to({duration:.2,ease:"EaseIn",x:p,y:g}):(f.x(p),f.y(g)),c.terminals.push({alignment:t,id:u,x:p+this.group.x(),y:g+this.group.y()})}),this._notify(c)}}class vI{constructor(t,n,i){Ce(this,"_grid_position");Ce(this,"terminal_dist",{top:[],right:[],bottom:[],left:[]});Ce(this,"terminal_lookup",[]);Ce(this,"type");Ce(this,"_instance_id");Ce(this,"_config_model");Ce(this,"_module_instance");Ce(this,"_observers",[]);Ce(this,"_stage_context");this._instance_id=n,this._config_model=t,this._stage_context=i,this._module_instance=t.get_module_instance(n),this._initialize_terminals(this._module_instance.view_config.terminals),this._grid_position=this._module_instance.view_config.position,this.type=this._module_instance.type,i.add_observer(a=>this._handle_stage_context_event(a)),t.add_observer(a=>{a.type==="MODULE_INSTANCE_UPDATED"&&a.id===n&&this._notify({type:"MODULE_MODEL_UPDATE"})})}_initialize_terminals(t){Object.entries(t).forEach(([n,i])=>{const a=n;i.forEach(r=>{const s=this.terminal_dist[a].length,o=this.terminal_lookup.length;this.terminal_lookup.push({terminal:r,alignment:a,index:s}),this.terminal_dist[a].push(o)})})}add_observer(t){return this._observers.push(t),()=>{this._observers=this._observers.filter(n=>n!==t)}}notify_stage_context(t){this._stage_context._publish(t)}_notify(t){this._observers.forEach(n=>n(t))}clicked_terminal(t){const n=this.terminal_lookup[t].terminal;this._stage_context.clicked_terminal(n,this._instance_id)}clicked_title(){this._stage_context.clicked_instance(this._instance_id)}set_cursor(t){this._stage_context.container.style.cursor=t}_handle_stage_context_event(t){if(t.type!=="SELECT")return;const n=t.selection;if(n.type==="TERMINAL"){const i={type:"TERMINAL_MODIFY_APPEARENCE",disable:[],highlight:[],normal:[]},a=n.terminal;this.terminal_lookup.forEach((r,s)=>{r.terminal.type!==a.type&&(a.type==="provide"?this._config_model.interfaces_match(a.interface,r.terminal.interface):this._config_model.interfaces_match(r.terminal.interface,a.interface))||i.disable.push(s)}),this._notify(i)}else this._notify({type:"TERMINAL_MODIFY_APPEARENCE",normal:Array.from(this.terminal_lookup.keys()),disable:[],highlight:[]})}get id(){return this._module_instance.id}get grid_position(){return this._grid_position}set grid_position(t){this._grid_position=t,this._config_model.update_module_view_position(this._instance_id,t)}move_terminal(t,n,i){const a=this.terminal_lookup[t].alignment,r=this.terminal_lookup[t].index;if(n!==a)return this.terminal_dist[a].splice(r,1),this.terminal_dist[n].splice(i,0,t),this.terminal_lookup[t].alignment=n,this._recalculate_terminal_index([a,n]),[a,n];if(i>r+1||ii.terminal.id===t&&i.terminal.type===n)}_recalculate_terminal_index(t){const n={};t.forEach(i=>{this.terminal_dist[i].forEach((a,r)=>{this.terminal_lookup[a].index=r}),n[i]=this.terminal_dist[i].map(a=>this.terminal_lookup[a].terminal)}),this._config_model.update_module_view_terminals(this._instance_id,n)}}const Kc={top:{x:0,y:-24/2},right:{x:dt.GRID/2,y:0},bottom:{x:0,y:dt.GRID/2},left:{x:-24/2,y:0}};class yI extends ri.Line{constructor(t){t.bezier=t.bezier||!0,t.strokeWidth=t.strokeWidth||dt.CONNECTION_WIDTH,t.stroke=t.stroke||xr.CONNECTION,super(t),this.update_terminals(t.requirement,t.provide)}update_terminals(t,n,i=!1){t=t||this.getAttr("requirement"),n=n||this.getAttr("provide");const a=t.x+Kc[t.alignment].x,r=t.y+Kc[t.alignment].y,s=n.x+Kc[n.alignment].x,o=n.y+Kc[n.alignment].y,l=s-a,c=o-r,u=[[t.alignment,a,r,l,c],[n.alignment,s,o,-l,-c]].map(f=>{const[m,p,g,v,_]=f;return m==="top"?[p,g-Math.max(dt.CONNECTION_CTRL,-_)]:m==="right"?[p+Math.max(dt.CONNECTION_CTRL,v),g]:m==="bottom"?[p,g+Math.max(dt.CONNECTION_CTRL,_)]:[p-Math.max(dt.CONNECTION_CTRL,-v),g]}),d=[a,r,u[0][0],u[0][1],u[1][0],u[1][1],s,o];i?this.to({points:d,duration:.2,ease:"EaseIn"}):this.points(d),this.setAttrs({requirement:t,provide:n})}}class _I{constructor(t){Ce(this,"group");Ce(this,"connections",[]);Ce(this,"_registered_modules",[]);Ce(this,"_stage_context");this.group=new ri.Group,this._stage_context=t}add_connection(t,n,i){const a=n.module_view.get_terminal_placement(n.terminal_lookup_id),r=i.module_view.get_terminal_placement(i.terminal_lookup_id),s=new yI({provide:a,requirement:r,hitStrokeWidth:12}),o={id:t,view:s};s.on("pointerclick",()=>this._stage_context.clicked_connection(t)),s.on("mouseenter",()=>{this._stage_context.container.style.cursor="pointer"}),s.on("mouseleave",()=>{this._stage_context.container.style.cursor="default"}),this.connections.push(o),this._insert_terminal_for_module_view(n,o,"provide"),this._insert_terminal_for_module_view(i,o,"requirement"),this.group.add(s)}delete_connection(t){const n=this.connections.findIndex(a=>a.id===t);this.connections[n].view.destroy(),this.connections.slice(n,1)}_insert_terminal_for_module_view(t,n,i){const a=this._registered_modules.find(s=>s.view===t.module_view);if(a){const s=a.terminal_lookup[t.terminal_lookup_id];s?s.connections.push(n):a.terminal_lookup[t.terminal_lookup_id]={type:i,connections:[n]};return}const r={view:t.module_view,terminal_lookup:Array(t.module_view._terminal_views.length)};r.terminal_lookup[t.terminal_lookup_id]={type:i,connections:[n]},this._registered_modules.push(r),r.view.add_observer(s=>{if(s.type==="TERMINALS_UPDATED"){const o=s.module_moved===!1;s.terminals.forEach(l=>{if(!r.terminal_lookup[l.id])return;const{connections:c,type:u}=r.terminal_lookup[l.id];c.forEach(d=>{u==="provide"?d.view.update_terminals(null,l,o):d.view.update_terminals(l,null,o)})})}})}}class bI{constructor(t,n){Ce(this,"_konva");Ce(this,"_module_views",{});Ce(this,"_model",null);Ce(this,"_module_vms",{});Ce(this,"_conn_man");Ce(this,"context");Ce(this,"_stage");Ce(this,"_bg");this.config=t,this._stage=new ri.Stage(t),this.resizeStage=this.resizeStage.bind(this),ri.dragButtons=[0,2],this._stage.on("contextmenu",s=>s.evt.preventDefault());const i=new ri.Layer({}),a=new ri.Text({text:"",fontFamily:xx.fontFamily,fontSize:16,padding:5,fill:"white",alpha:.75,visible:!1,sceneFunc:function(s,o){const{width:l,height:c}=o.size(),u=3;s.beginPath(),s.moveTo(u,0),s.lineTo(l-u,0),s.arcTo(l,0,l,u,u),s.lineTo(l,c-u),s.arcTo(l,c,l-u,c,u),s.lineTo(u,c),s.arcTo(0,c,0,c-u,u),s.lineTo(0,u),s.arcTo(0,0,u,0,u),s.closePath(),s.fillStyle=cr.colors.secondary,s.fill(),o._sceneFunc(s)},...fI.position});i.add(a);const r=new ri.Layer({draggable:!0});this._reset_static_layer(r),this._stage.on("wheel",s=>{s.evt.preventDefault();const o=r.scaleX(),l=this._stage.getPointerPosition();if(!l)return;const c={x:(l.x-r.x())/o,y:(l.y-r.y())/o};let u;s.evt.deltaY===1||s.evt.deltaY===-1?u=s.evt.deltaY*.2:u=s.evt.deltaY,u=-u;const f=Math.exp(u*.005),m=o*f,p={x:l.x-c.x*m,y:l.y-c.y*m};this.setNewPosAndScale(r,p,m)}),this._stage.add(r),this._stage.add(i),this._konva={stage:this._stage,tooltip:a,static_layer:r,anim_layer:null},this.context=n,n.set_container(this._stage.container()),this.context.add_observer(s=>this._handle_stage_context_event(s)),this.registerListeners(),setTimeout(()=>this.resizeStage(),1500)}setNewPosAndScale(t,n,i){t.scale({x:i,y:i}),t.position(n),this._bg.width(this._stage.width()/i),this._bg.height(this._stage.height()/i),this._bg.setAbsolutePosition({x:0,y:0}),t.batchDraw()}registerListeners(){window.addEventListener("resize",this.resizeStage)}unregisterListeners(){window.removeEventListener("resize",this.resizeStage)}destroy(){this.unregisterListeners(),this._stage.destroy()}resizeStage(){const t=document.getElementById(this.config.container);if(!t)return;const n=t.offsetWidth,i=t.offsetHeight;this._stage.width(n),this._stage.height(i)}reset_view(){this.setNewPosAndScale(this._konva.static_layer,{x:0,y:0},1)}set_model(t){this._model,this._conn_man=new _I(this.context),this._reset_static_layer(this._konva.static_layer),this._konva.static_layer.add(this._conn_man.group),this._model=t,Object.keys(t._instances).forEach(n=>this._add_module_instance_to_stage(Number(n))),Object.keys(t._connections).forEach(n=>{try{this._add_connection_to_stage(Number(n))}catch(i){console.warn(i)}}),t.add_observer(n=>this._handle_config_event(n))}_handle_config_event(t){if(t.type==="MODULE_INSTANCE_ADDED")this._add_module_instance_to_stage(t.id);else if(t.type==="CONNECTION_ADDED")this._add_connection_to_stage(t.id);else if(t.type==="CONNECTION_DELETED")this._conn_man.delete_connection(t.id),this.context.unselect();else if(t.type==="MODULE_INSTANCE_DELETED"){const n=t.id;this._module_views[n].group.destroy(),delete this._module_views[n],delete this._module_vms[n],this.context.unselect()}}_handle_stage_context_event(t){t.type==="ADD_CONNECTION"?this._model.add_connection(t.connection):t.type==="SHOW_TOOLTIP"?(this._konva.tooltip.text(t.text),this._konva.tooltip.show()):t.type==="HIDE_TOOLTIP"&&this._konva.tooltip.hide()}_add_module_instance_to_stage(t){const n=new vI(this._model,t,this.context);this._module_vms[t]=n,n.grid_position||(n.grid_position={x:t,y:t});const i=new gI(n);this._module_views[t]=i,this._konva.static_layer.add(i.group)}_add_connection_to_stage(t){const n=this._model._connections[t],i=this._module_vms[n.requiring_instance_id],a=this._module_views[n.requiring_instance_id],r=this._module_vms[n.providing_instance_id],s=this._module_views[n.providing_instance_id],o=r.get_terminal_lookup_id(n.providing_impl_name,"provide");if(o===-1)throw Error(`Couldn't add connection to stage, terminal ${n.providing_impl_name} not found on ${r.type}.`);const l=i.get_terminal_lookup_id(n.requirement_name,"requirement");if(l===-1)throw Error(`Couldn't add connection to stage, terminal ${n.requirement_name} not found on ${i.type}.`);this._conn_man.add_connection(t,{module_view:s,terminal_lookup_id:o},{module_view:a,terminal_lookup_id:l})}_reset_static_layer(t){t.destroyChildren(),this._bg=new ri.Rect({width:this._stage.width(),height:this._stage.height(),fill:"rgba(255, 0, 0, 0)"}),this._bg.on("pointerclick",()=>this.context.unselect()),t.add(this._bg),t.on("dragstart",()=>{this._stage.container().style.cursor="grab"}),t.on("dragend",()=>{this._stage.container().style.cursor="default",this._bg.setAbsolutePosition({x:0,y:0})})}}/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function Ex(e){return typeof e>"u"||e===null}function wI(e){return typeof e=="object"&&e!==null}function kI(e){return Array.isArray(e)?e:Ex(e)?[]:[e]}function SI(e,t){var n,i,a,r;if(t)for(r=Object.keys(t),n=0,i=r.length;no&&(r=" ... ",t=i-o+r.length),n-i>o&&(s=" ...",n=i+o-s.length),{str:r+e.slice(t,n).replace(/\t/g,"→")+s,pos:i-t+r.length}}function Lm(e,t){return vn.repeat(" ",t-e.length)+e}function II(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,i=[0],a=[],r,s=-1;r=n.exec(e.buffer);)a.push(r.index),i.push(r.index+r[0].length),e.position<=r.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);var o="",l,c,u=Math.min(e.line+t.linesAfter,a.length).toString().length,d=t.maxLength-(t.indent+u+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)c=Nm(e.buffer,i[s-l],a[s-l],e.position-(i[s]-i[s-l]),d),o=vn.repeat(" ",t.indent)+Lm((e.line-l+1).toString(),u)+" | "+c.str+` `+o;for(c=Nm(e.buffer,i[s],a[s],e.position,d),o+=vn.repeat(" ",t.indent)+Lm((e.line+1).toString(),u)+" | "+c.str+` diff --git a/pr-241/index.html b/pr-241/index.html index 7f02ae23..dca22c2d 100644 --- a/pr-241/index.html +++ b/pr-241/index.html @@ -16,7 +16,7 @@ - + diff --git a/pr-241/sw.js b/pr-241/sw.js index 6cc5ec21..9bb7ed4b 100644 --- a/pr-241/sw.js +++ b/pr-241/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()})).then((()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const l=e=>i(e,r),u={module:{uri:r},exports:o,require:l};s[r]=Promise.all(n.map((e=>u[e]||l(e)))).then((e=>(t(...e),o)))}}define(["./workbox-e1498109"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-bYIhkDjQ.css",revision:null},{url:"assets/index-Dl1GktK9.js",revision:null},{url:"index.html",revision:"49af84750355584cac21a92585cb4061"},{url:"registerSW.js",revision:"e293df86d26ca02e3ed8ee925f2871e1"},{url:"manifest.webmanifest",revision:"094f9530d59b7ee72fe030855189d112"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))})); +if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()})).then((()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const l=e=>i(e,t),d={module:{uri:t},exports:o,require:l};s[t]=Promise.all(n.map((e=>d[e]||l(e)))).then((e=>(r(...e),o)))}}define(["./workbox-e1498109"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-bYIhkDjQ.css",revision:null},{url:"assets/index-DT6VlfWq.js",revision:null},{url:"index.html",revision:"c17d77426d18bcaa0fd02634b7a08c30"},{url:"registerSW.js",revision:"e293df86d26ca02e3ed8ee925f2871e1"},{url:"manifest.webmanifest",revision:"094f9530d59b7ee72fe030855189d112"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));