polotno-node 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,7 +47,7 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
47
47
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Observer",{enumerable:!0,get:function(){return a.Observer}}),exports.clearTimers=void 0,Object.defineProperty(exports,"enableStaticRendering",{enumerable:!0,get:function(){return s.enableStaticRendering}}),Object.defineProperty(exports,"isObserverBatched",{enumerable:!0,get:function(){return t.isObserverBatched}}),Object.defineProperty(exports,"isUsingStaticRendering",{enumerable:!0,get:function(){return s.isUsingStaticRendering}}),Object.defineProperty(exports,"observer",{enumerable:!0,get:function(){return o.observer}}),Object.defineProperty(exports,"observerBatching",{enumerable:!0,get:function(){return t.observerBatching}}),Object.defineProperty(exports,"useAsObservableSource",{enumerable:!0,get:function(){return l.useAsObservableSource}}),Object.defineProperty(exports,"useLocalObservable",{enumerable:!0,get:function(){return b.useLocalObservable}}),Object.defineProperty(exports,"useLocalStore",{enumerable:!0,get:function(){return c.useLocalStore}}),exports.useObserver=d,exports.useStaticRendering=p,require("./utils/assertEnvironment");var e,r=require("./utils/reactBatchedUpdates"),t=require("./utils/observerBatching"),n=require("./utils/utils"),i=require("./useObserver"),s=require("./staticRendering"),u=require("./utils/observerFinalizationRegistry"),o=require("./observer"),a=require("./ObserverComponent"),b=require("./useLocalObservable"),c=require("./useLocalStore"),l=require("./useAsObservableSource");(0,t.observerBatching)(r.unstable_batchedUpdates);var v=null!==(e=u.observerFinalizationRegistry.finalizeAllImmediately)&&void 0!==e?e:function(){};function d(e,r){return void 0===r&&(r="observed"),(0,i.useObserver)(e,r)}function p(e){(0,s.enableStaticRendering)(e)}exports.clearTimers=v;
48
48
  },{"./utils/assertEnvironment":"moAD","./utils/reactBatchedUpdates":"ZFRm","./utils/observerBatching":"EJpR","./utils/utils":"AGS0","./useObserver":"fdT3","./staticRendering":"vLuz","./utils/observerFinalizationRegistry":"TWPL","./observer":"Ocog","./ObserverComponent":"I8te","./useLocalObservable":"KZGF","./useLocalStore":"Grwe","./useAsObservableSource":"jn24"}],"bIDB":[function(require,module,exports) {
49
49
  var global = arguments[3];
50
- var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),exports._registerNode=exports.Konva=exports.glob=void 0;var o=Math.PI/180;function n(){return"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window))}exports.glob=void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},exports.Konva={_global:exports.glob,version:"9.0.2",isBrowser:n(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>exports.Konva.angleDeg?e*o:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>exports.Konva.DD.isDragging,isDragReady:()=>!!exports.Konva.DD.node,releaseCanvasOnDestroy:!0,document:exports.glob.document,_injectGlobal(e){exports.glob.Konva=e}};const t=e=>{exports.Konva[e.prototype.getClassName()]=e};exports._registerNode=t,exports.Konva._injectGlobal(exports.Konva);
50
+ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),exports._registerNode=exports.Konva=exports.glob=void 0;var o=Math.PI/180;function n(){return"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window))}exports.glob=void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},exports.Konva={_global:exports.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle:e=>exports.Konva.angleDeg?e*o:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>exports.Konva.DD.isDragging,isDragReady:()=>!!exports.Konva.DD.node,releaseCanvasOnDestroy:!0,document:exports.glob.document,_injectGlobal(e){exports.glob.Konva=e}};const t=e=>{exports.Konva[e.prototype.getClassName()]=e};exports._registerNode=t,exports.Konva._injectGlobal(exports.Konva);
51
51
  },{}],"XIcS":[function(require,module,exports) {
52
52
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Util=exports.Transform=void 0;const e=require("./Global");class t{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new t(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}translate(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}scale(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}rotate(e){var t=Math.cos(e),r=Math.sin(e),i=this.m[0]*t+this.m[2]*r,a=this.m[1]*t+this.m[3]*r,o=this.m[0]*-r+this.m[2]*t,s=this.m[1]*-r+this.m[3]*t;return this.m[0]=i,this.m[1]=a,this.m[2]=o,this.m[3]=s,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,t){var r=this.m[0]+this.m[2]*t,i=this.m[1]+this.m[3]*t,a=this.m[2]+this.m[0]*e,o=this.m[3]+this.m[1]*e;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=o,this}multiply(e){var t=this.m[0]*e.m[0]+this.m[2]*e.m[1],r=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],o=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],s=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=o,this.m[5]=s,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,r=-this.m[1]*e,i=-this.m[2]*e,a=this.m[0]*e,o=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=o,this.m[5]=s,this}getMatrix(){return this.m}decompose(){var e=this.m[0],t=this.m[1],r=this.m[2],i=this.m[3],a=e*i-t*r;let o={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=t){var s=Math.sqrt(e*e+t*t);o.rotation=t>0?Math.acos(e/s):-Math.acos(e/s),o.scaleX=s,o.scaleY=a/s,o.skewX=(e*r+t*i)/a,o.skewY=0}else if(0!=r||0!=i){var n=Math.sqrt(r*r+i*i);o.rotation=Math.PI/2-(i>0?Math.acos(-r/n):-Math.acos(r/n)),o.scaleX=a/n,o.scaleY=n,o.skewX=0,o.skewY=(e*r+t*i)/a}return o.rotation=exports.Util._getRotation(o.rotation),o}}exports.Transform=t;var r="[object Array]",i="[object Number]",a="[object String]",o="[object Boolean]",s=Math.PI/180,n=180/Math.PI,l="#",h="",m="0",c="Konva warning: ",g="Konva error: ",u="rgb(",d={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]},p=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,b=[];const y="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)};exports.Util={_isElement:e=>!(!e||1!=e.nodeType),_isFunction:e=>!!(e&&e.constructor&&e.call&&e.apply),_isPlainObject:e=>!!e&&e.constructor===Object,_isArray:e=>Object.prototype.toString.call(e)===r,_isNumber:e=>Object.prototype.toString.call(e)===i&&!isNaN(e)&&isFinite(e),_isString:e=>Object.prototype.toString.call(e)===a,_isBoolean:e=>Object.prototype.toString.call(e)===o,isObject:e=>e instanceof Object,isValidSelector(e){if("string"!=typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:e=>0===e?1:e>0?1:-1,requestAnimFrame(e){b.push(e),1===b.length&&y(function(){const e=b;b=[],e.forEach(function(e){e()})})},createCanvasElement(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(t){}return e},createImageElement:()=>document.createElement("img"),_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){var r=exports.Util.createImageElement();r.onload=function(){t(r)},r.src=e},_rgbToHex:(e,t,r)=>((1<<24)+(e<<16)+(t<<8)+r).toString(16).slice(1),_hexToRgb(e){e=e.replace(l,h);var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor(){for(var e=(16777215*Math.random()<<0).toString(16);e.length<6;)e=m+e;return l+e},getRGB(e){var t;return e in d?{r:(t=d[e])[0],g:t[1],b:t[2]}:e[0]===l?this._hexToRgb(e.substring(1)):e.substr(0,4)===u?(t=p.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:e=>(e=e||"black",exports.Util._namedColorToRBA(e)||exports.Util._hex3ColorToRGBA(e)||exports.Util._hex4ColorToRGBA(e)||exports.Util._hex6ColorToRGBA(e)||exports.Util._hex8ColorToRGBA(e)||exports.Util._rgbColorToRGBA(e)||exports.Util._rgbaColorToRGBA(e)||exports.Util._hslColorToRGBA(e)),_namedColorToRBA(e){var t=d[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map((e,t)=>"%"===e.slice(-1)?3===t?parseInt(e)/100:parseInt(e)/100*255:Number(e));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if("#"===e[0]&&9===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if("#"===e[0]&&5===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...r]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),i=Number(r[0])/360,a=Number(r[1])/100,o=Number(r[2])/100;let s,n,l;if(0===a)return l=255*o,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};const h=2*o-(s=o<.5?o*(1+a):o+a-o*a),m=[0,0,0];for(let e=0;e<3;e++)(n=i+1/3*-(e-1))<0&&n++,n>1&&n--,l=6*n<1?h+6*(s-h)*n:2*n<1?s:3*n<2?h+(s-h)*(2/3-n)*6:h,m[e]=255*l;return{r:Math.round(m[0]),g:Math.round(m[1]),b:Math.round(m[2]),a:1}}},haveIntersection:(e,t)=>!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y),cloneObject(e){var t={};for(var r in e)this._isPlainObject(e[r])?t[r]=this.cloneObject(e[r]):this._isArray(e[r])?t[r]=this.cloneArray(e[r]):t[r]=e[r];return t},cloneArray:e=>e.slice(0),degToRad:e=>e*s,radToDeg:e=>e*n,_degToRad:e=>(exports.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),exports.Util.degToRad(e)),_radToDeg:e=>(exports.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),exports.Util.radToDeg(e)),_getRotation:t=>e.Konva.angleDeg?exports.Util.radToDeg(t):t,_capitalize:e=>e.charAt(0).toUpperCase()+e.slice(1),throw(e){throw new Error(g+e)},error(e){console.error(g+e)},warn(t){e.Konva.showWarnings&&console.warn(c+t)},each(e,t){for(var r in e)t(r,e[r])},_inRange:(e,t,r)=>t<=e&&e<r,_getProjectionToSegment(e,t,r,i,a,o){var s,n,l,h=(e-r)*(e-r)+(t-i)*(t-i);if(0==h)s=e,n=t,l=(a-r)*(a-r)+(o-i)*(o-i);else{var m=((a-e)*(r-e)+(o-t)*(i-t))/h;m<0?(s=e,n=t,l=(e-a)*(e-a)+(t-o)*(t-o)):m>1?(s=r,n=i,l=(r-a)*(r-a)+(i-o)*(i-o)):l=((s=e+m*(r-e))-a)*(s-a)+((n=t+m*(i-t))-o)*(n-o)}return[s,n,l]},_getProjectionToLine(e,t,r){var i=exports.Util.cloneObject(e),a=Number.MAX_VALUE;return t.forEach(function(o,s){if(r||s!==t.length-1){var n=t[(s+1)%t.length],l=exports.Util._getProjectionToSegment(o.x,o.y,n.x,n.y,e.x,e.y),h=l[0],m=l[1],c=l[2];c<a&&(i.x=h,i.y=m,a=c)}}),i},_prepareArrayForTween(e,t,r){var i,a=[],o=[];if(e.length>t.length){var s=t;t=e,e=s}for(i=0;i<e.length;i+=2)a.push({x:e[i],y:e[i+1]});for(i=0;i<t.length;i+=2)o.push({x:t[i],y:t[i+1]});var n=[];return o.forEach(function(e){var t=exports.Util._getProjectionToLine(e,a,r);n.push(t.x),n.push(t.y)}),n},_prepareToStringify(e){var t;for(var r in e.visitedByCircularReferenceRemoval=!0,e)if(e.hasOwnProperty(r)&&e[r]&&"object"==typeof e[r])if(t=Object.getOwnPropertyDescriptor(e,r),e[r].visitedByCircularReferenceRemoval||exports.Util._isElement(e[r])){if(!t.configurable)return null;delete e[r]}else if(null===exports.Util._prepareToStringify(e[r])){if(!t.configurable)return null;delete e[r]}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(var r in t)e[r]=t[r];return e},_getFirstPointerId:e=>e.touches?e.changedTouches[0].identifier:e.pointerId||999,releaseCanvas(...t){e.Konva.releaseCanvasOnDestroy&&t.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(e,t,r,i){let a=0,o=0,s=0,n=0;"number"==typeof i?a=o=s=n=Math.min(i,t/2,r/2):(a=Math.min(i[0]||0,t/2,r/2),o=Math.min(i[1]||0,t/2,r/2),n=Math.min(i[2]||0,t/2,r/2),s=Math.min(i[3]||0,t/2,r/2)),e.moveTo(a,0),e.lineTo(t-o,0),e.arc(t-o,o,o,3*Math.PI/2,0,!1),e.lineTo(t,r-n),e.arc(t-n,r-n,n,0,Math.PI/2,!1),e.lineTo(s,r),e.arc(s,r-s,s,Math.PI/2,Math.PI,!1),e.lineTo(0,a),e.arc(a,a,a,Math.PI,3*Math.PI/2,!1)}};
53
53
  },{"./Global":"bIDB"}],"tgRR":[function(require,module,exports) {
@@ -55,7 +55,7 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
55
55
  },{"./Global":"bIDB","./Util":"XIcS"}],"cgGB":[function(require,module,exports) {
56
56
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Factory=void 0;const t=require("./Util"),e=require("./Validators");var r="get",o="set";exports.Factory={addGetterSetter(t,e,r,o,a){exports.Factory.addGetter(t,e,r),exports.Factory.addSetter(t,e,o,a),exports.Factory.addOverloadedGetterSetter(t,e)},addGetter(e,o,a){var i=r+t.Util._capitalize(o);e.prototype[i]=e.prototype[i]||function(){var t=this.attrs[o];return void 0===t?a:t}},addSetter(e,r,a,i){var p=o+t.Util._capitalize(r);e.prototype[p]||exports.Factory.overWriteSetter(e,r,a,i)},overWriteSetter(e,r,a,i){var p=o+t.Util._capitalize(r);e.prototype[p]=function(t){return a&&null!=t&&(t=a.call(this,t,r)),this._setAttr(r,t),i&&i.call(this),this}},addComponentsGetterSetter(a,i,p,d,l){var s,n,c=p.length,h=t.Util._capitalize,v=r+h(i),y=o+h(i);a.prototype[v]=function(){var t={};for(s=0;s<c;s++)t[n=p[s]]=this.getAttr(i+h(n));return t};var u=(0,e.getComponentValidator)(p);a.prototype[y]=function(t){var e,r=this.attrs[i];for(e in d&&(t=d.call(this,t)),u&&u.call(this,t,i),t)t.hasOwnProperty(e)&&this._setAttr(i+h(e),t[e]);return t||p.forEach(t=>{this._setAttr(i+h(t),void 0)}),this._fireChangeEvent(i,r,t),l&&l.call(this),this},exports.Factory.addOverloadedGetterSetter(a,i)},addOverloadedGetterSetter(e,a){var i=t.Util._capitalize(a),p=o+i,d=r+i;e.prototype[a]=function(){return arguments.length?(this[p](arguments[0]),this):this[d]()}},addDeprecatedGetterSetter(e,o,a,i){t.Util.error("Adding deprecated "+o);var p=r+t.Util._capitalize(o),d=o+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[p]=function(){t.Util.error(d);var e=this.attrs[o];return void 0===e?a:e},exports.Factory.addSetter(e,o,i,function(){t.Util.error(d)}),exports.Factory.addOverloadedGetterSetter(e,o)},backCompat(e,a){t.Util.each(a,function(a,i){var p=e.prototype[i],d=r+t.Util._capitalize(a),l=o+t.Util._capitalize(a);function s(){p.apply(this,arguments),t.Util.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+i+'" instead.')}e.prototype[a]=s,e.prototype[d]=s,e.prototype[l]=s})},afterSetFilter(){this._filterUpToDate=!1}};
57
57
  },{"./Util":"XIcS","./Validators":"tgRR"}],"pIAY":[function(require,module,exports) {
58
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HitContext=exports.SceneContext=exports.Context=void 0;const t=require("./Util"),e=require("./Global");function i(e){var i,a,r=[],s=e.length,o=t.Util;for(i=0;i<s;i++)a=e[i],o._isNumber(a)?a=Math.round(1e3*a)/1e3:o._isString(a)||(a+=""),r.push(a);return r}var a=",",r="(",s=")",o="([",n="])",l=";",h="()",c="=",_=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],d=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const f=100;class x{constructor(t){this.canvas=t,e.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(e,i){var _,d,f,x,g=this.traceArr,p=g.length,u="";for(_=0;_<p;_++)(f=(d=g[_]).method)?(x=d.args,u+=f,e?u+=h:t.Util._isArray(x[0])?u+=o+x.join(a)+n:(i&&(x=x.map(t=>"number"==typeof t?Math.floor(t):t)),u+=r+x.join(a)+s)):(u+=d.property,e||(u+=c+d.val)),u+=l;return u}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr;e.push(t),e.length>=f&&e.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){var e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,i,a,r,s){this._context.arc(t,e,i,a,r,s)}arcTo(t,e,i,a,r){this._context.arcTo(t,e,i,a,r)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,i,a,r,s){this._context.bezierCurveTo(t,e,i,a,r,s)}clearRect(t,e,i,a){this._context.clearRect(t,e,i,a)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(t,e){var i=arguments;return 2===i.length?this._context.createImageData(t,e):1===i.length?this._context.createImageData(t):void 0}createLinearGradient(t,e,i,a){return this._context.createLinearGradient(t,e,i,a)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,i,a,r,s){return this._context.createRadialGradient(t,e,i,a,r,s)}drawImage(t,e,i,a,r,s,o,n,l){var h=arguments,c=this._context;3===h.length?c.drawImage(t,e,i):5===h.length?c.drawImage(t,e,i,a,r):9===h.length&&c.drawImage(t,e,i,a,r,s,o,n,l)}ellipse(t,e,i,a,r,s,o,n){this._context.ellipse(t,e,i,a,r,s,o,n)}isPointInPath(t,e,i,a){return i?this._context.isPointInPath(i,t,e,a):this._context.isPointInPath(t,e,a)}fill(t){t?this._context.fill(t):this._context.fill()}fillRect(t,e,i,a){this._context.fillRect(t,e,i,a)}strokeRect(t,e,i,a){this._context.strokeRect(t,e,i,a)}fillText(t,e,i,a){a?this._context.fillText(t,e,i,a):this._context.fillText(t,e,i)}measureText(t){return this._context.measureText(t)}getImageData(t,e,i,a){return this._context.getImageData(t,e,i,a)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,i,a){this._context.rect(t,e,i,a)}putImageData(t,e,i){this._context.putImageData(t,e,i)}quadraticCurveTo(t,e,i,a){this._context.quadraticCurveTo(t,e,i,a)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,i,a,r,s){this._context.setTransform(t,e,i,a,r,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,i,a){this._context.strokeText(t,e,i,a)}transform(t,e,i,a,r,s){this._context.transform(t,e,i,a,r,s)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t,e,a=this,r=_.length,s=this.setAttr,o=function(t){var r,s=a[t];a[t]=function(){return e=i(Array.prototype.slice.call(arguments,0)),r=s.apply(a,arguments),a._trace({method:t,args:e}),r}};for(t=0;t<r;t++)o(_[t]);a.setAttr=function(){s.apply(a,arguments);var t=arguments[0],e=arguments[1];"shadowOffsetX"!==t&&"shadowOffsetY"!==t&&"shadowBlur"!==t||(e/=this.canvas.getPixelRatio()),a._trace({property:t,val:e})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;!e||"source-over"===e||this.setAttr("globalCompositeOperation",e)}}exports.Context=x,d.forEach(function(t){Object.defineProperty(x.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})});class g extends x{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),i=t.getFillPriority();if(e&&"color"===i)return void this._fillColor(t);const a=t.getFillPatternImage();if(a&&"pattern"===i)return void this._fillPattern(t);const r=t.getFillLinearGradientColorStops();if(r&&"linear-gradient"===i)return void this._fillLinearGradient(t);const s=t.getFillRadialGradientColorStops();s&&"radial-gradient"===i?this._fillRadialGradient(t):e?this._fillColor(t):a?this._fillPattern(t):r?this._fillLinearGradient(t):s&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),a=t.getStrokeLinearGradientColorStops(),r=this.createLinearGradient(e.x,e.y,i.x,i.y);if(a){for(var s=0;s<a.length;s+=2)r.addColorStop(a[s],a[s+1]);this.setAttr("strokeStyle",r)}}_stroke(t){var e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();var a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore()}}_applyShadow(t){var e,i,a,r=null!==(e=t.getShadowRGBA())&&void 0!==e?e:"black",s=null!==(i=t.getShadowBlur())&&void 0!==i?i:5,o=null!==(a=t.getShadowOffset())&&void 0!==a?a:{x:0,y:0},n=t.getAbsoluteScale(),l=this.canvas.getPixelRatio(),h=n.x*l,c=n.y*l;this.setAttr("shadowColor",r),this.setAttr("shadowBlur",s*Math.min(Math.abs(h),Math.abs(c))),this.setAttr("shadowOffsetX",o.x*h),this.setAttr("shadowOffsetY",o.y*c)}}exports.SceneContext=g;class p extends x{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const r=t.getStrokeScaleEnabled();if(!r){this.save();var e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(t);var i=t.hitStrokeWidth(),a="auto"===i?t.strokeWidth():i;this.setAttr("lineWidth",a),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),r||this.restore()}}}exports.HitContext=p;
58
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HitContext=exports.SceneContext=exports.Context=void 0;const t=require("./Util"),e=require("./Global");function i(e){var i,a,r=[],s=e.length,o=t.Util;for(i=0;i<s;i++)a=e[i],o._isNumber(a)?a=Math.round(1e3*a)/1e3:o._isString(a)||(a+=""),r.push(a);return r}var a=",",r="(",s=")",o="([",n="])",l=";",h="()",c="=",_=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],d=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"];const f=100;class x{constructor(t){this.canvas=t,e.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(e,i){var _,d,f,x,p=this.traceArr,g=p.length,u="";for(_=0;_<g;_++)(f=(d=p[_]).method)?(x=d.args,u+=f,e?u+=h:t.Util._isArray(x[0])?u+=o+x.join(a)+n:(i&&(x=x.map(t=>"number"==typeof t?Math.floor(t):t)),u+=r+x.join(a)+s)):(u+=d.property,e||(u+=c+d.val)),u+=l;return u}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr;e.push(t),e.length>=f&&e.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){var e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,i,a,r,s){this._context.arc(t,e,i,a,r,s)}arcTo(t,e,i,a,r){this._context.arcTo(t,e,i,a,r)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,i,a,r,s){this._context.bezierCurveTo(t,e,i,a,r,s)}clearRect(t,e,i,a){this._context.clearRect(t,e,i,a)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){var i=arguments;return 2===i.length?this._context.createImageData(t,e):1===i.length?this._context.createImageData(t):void 0}createLinearGradient(t,e,i,a){return this._context.createLinearGradient(t,e,i,a)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,i,a,r,s){return this._context.createRadialGradient(t,e,i,a,r,s)}drawImage(t,e,i,a,r,s,o,n,l){var h=arguments,c=this._context;3===h.length?c.drawImage(t,e,i):5===h.length?c.drawImage(t,e,i,a,r):9===h.length&&c.drawImage(t,e,i,a,r,s,o,n,l)}ellipse(t,e,i,a,r,s,o,n){this._context.ellipse(t,e,i,a,r,s,o,n)}isPointInPath(t,e,i,a){return i?this._context.isPointInPath(i,t,e,a):this._context.isPointInPath(t,e,a)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,i,a){this._context.fillRect(t,e,i,a)}strokeRect(t,e,i,a){this._context.strokeRect(t,e,i,a)}fillText(t,e,i,a){a?this._context.fillText(t,e,i,a):this._context.fillText(t,e,i)}measureText(t){return this._context.measureText(t)}getImageData(t,e,i,a){return this._context.getImageData(t,e,i,a)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,i,a){this._context.rect(t,e,i,a)}putImageData(t,e,i){this._context.putImageData(t,e,i)}quadraticCurveTo(t,e,i,a){this._context.quadraticCurveTo(t,e,i,a)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,i,a,r,s){this._context.setTransform(t,e,i,a,r,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,i,a){this._context.strokeText(t,e,i,a)}transform(t,e,i,a,r,s){this._context.transform(t,e,i,a,r,s)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t,e,a=this,r=_.length,s=this.setAttr,o=function(t){var r,s=a[t];a[t]=function(){return e=i(Array.prototype.slice.call(arguments,0)),r=s.apply(a,arguments),a._trace({method:t,args:e}),r}};for(t=0;t<r;t++)o(_[t]);a.setAttr=function(){s.apply(a,arguments);var t=arguments[0],e=arguments[1];"shadowOffsetX"!==t&&"shadowOffsetY"!==t&&"shadowBlur"!==t||(e/=this.canvas.getPixelRatio()),a._trace({property:t,val:e})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;!e||"source-over"===e||this.setAttr("globalCompositeOperation",e)}}exports.Context=x,d.forEach(function(t){Object.defineProperty(x.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})});class p extends x{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),i=t.getFillPriority();if(e&&"color"===i)return void this._fillColor(t);const a=t.getFillPatternImage();if(a&&"pattern"===i)return void this._fillPattern(t);const r=t.getFillLinearGradientColorStops();if(r&&"linear-gradient"===i)return void this._fillLinearGradient(t);const s=t.getFillRadialGradientColorStops();s&&"radial-gradient"===i?this._fillRadialGradient(t):e?this._fillColor(t):a?this._fillPattern(t):r?this._fillLinearGradient(t):s&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),a=t.getStrokeLinearGradientColorStops(),r=this.createLinearGradient(e.x,e.y,i.x,i.y);if(a){for(var s=0;s<a.length;s+=2)r.addColorStop(a[s],a[s+1]);this.setAttr("strokeStyle",r)}}_stroke(t){var e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();var a=this.getCanvas().getPixelRatio();this.setTransform(a,0,0,a,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore()}}_applyShadow(t){var e,i,a,r=null!==(e=t.getShadowRGBA())&&void 0!==e?e:"black",s=null!==(i=t.getShadowBlur())&&void 0!==i?i:5,o=null!==(a=t.getShadowOffset())&&void 0!==a?a:{x:0,y:0},n=t.getAbsoluteScale(),l=this.canvas.getPixelRatio(),h=n.x*l,c=n.y*l;this.setAttr("shadowColor",r),this.setAttr("shadowBlur",s*Math.min(Math.abs(h),Math.abs(c))),this.setAttr("shadowOffsetX",o.x*h),this.setAttr("shadowOffsetY",o.y*c)}}exports.SceneContext=p;class g extends x{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const r=t.getStrokeScaleEnabled();if(!r){this.save();var e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(t);var i=t.hitStrokeWidth(),a="auto"===i?t.strokeWidth():i;this.setAttr("lineWidth",a),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),r||this.restore()}}}exports.HitContext=g;
59
59
  },{"./Util":"XIcS","./Global":"bIDB"}],"KydS":[function(require,module,exports) {
60
60
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HitCanvas=exports.SceneCanvas=exports.Canvas=void 0;const t=require("./Util"),e=require("./Context"),i=require("./Global"),s=require("./Factory"),a=require("./Validators");var h;function r(){if(h)return h;var e=t.Util.createCanvasElement(),s=e.getContext("2d");return h=(i.Konva._global.devicePixelRatio||1)/(s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1),t.Util.releaseCanvas(e),h}class o{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var s=(e||{}).pixelRatio||i.Konva.pixelRatio||r();this.pixelRatio=s,this._canvas=t.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(e,i){try{return this._canvas.toDataURL(e,i)}catch(s){try{return this._canvas.toDataURL()}catch(a){return t.Util.error("Unable to get data URL. "+a.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}exports.Canvas=o,s.Factory.addGetterSetter(o,"pixelRatio",void 0,(0,a.getNumberValidator)());class n extends o{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new e.SceneContext(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}exports.SceneCanvas=n;class l extends o{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new e.HitContext(this),this.setSize(t.width,t.height)}}exports.HitCanvas=l;
61
61
  },{"./Util":"XIcS","./Context":"pIAY","./Global":"bIDB","./Factory":"cgGB","./Validators":"tgRR"}],"XvfD":[function(require,module,exports) {
@@ -63,13 +63,13 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
63
63
  },{"./Global":"bIDB","./Util":"XIcS"}],"pBWF":[function(require,module,exports) {
64
64
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Node=void 0;const t=require("./Util"),e=require("./Factory"),i=require("./Canvas"),s=require("./Global"),r=require("./DragAndDrop"),a=require("./Validators");var n="absoluteOpacity",h="allEventListeners",o="absoluteTransform",l="absoluteScale",c="canvas",g="Change",d="children",f="konva",u="listening",p="mouseenter",v="mouseleave",_="name",m="set",y="Shape",C=" ",b="stage",x="transform",w="Stage",D="visible",S=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(C);let A=1;class T{constructor(t){this._id=A++,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(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){t!==x&&t!==o||!this._cache.get(t)?t?this._cache.delete(t):this._cache.clear():this._cache.get(t).dirty=!0}_getCache(t,e){var i=this._cache.get(t);return(void 0===i||(t===x||t===o)&&!0===i.dirty)&&(i=e.call(this),this._cache.set(t,i)),i}_calculate(t,e,i){if(!this._attachedDepsListeners.get(t)){const i=e.map(t=>t+"Change.konva").join(C);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}_getCanvasCache(){return this._cache.get(c)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===o&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(c)){const{scene:e,filter:i,hit:s}=this._cache.get(c);t.Util.releaseCanvas(e,i,s),this._cache.delete(c)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var s=e||{},r={};void 0!==s.x&&void 0!==s.y&&void 0!==s.width&&void 0!==s.height||(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var a=Math.ceil(s.width||r.width),h=Math.ceil(s.height||r.height),o=s.pixelRatio,g=void 0===s.x?Math.floor(r.x):s.x,d=void 0===s.y?Math.floor(r.y):s.y,f=s.offset||0,u=s.drawBorder||!1,p=s.hitCanvasPixelRatio||1;if(a&&h){a+=2*f+1,h+=2*f+1,g-=f,d-=f;var v=new i.SceneCanvas({pixelRatio:o,width:a,height:h}),_=new i.SceneCanvas({pixelRatio:o,width:0,height:0,willReadFrequently:!0}),m=new i.HitCanvas({pixelRatio:p,width:a,height:h}),y=v.getContext(),C=m.getContext();return m.isCache=!0,v.isCache=!0,this._cache.delete(c),this._filterUpToDate=!1,!1===s.imageSmoothingEnabled&&(v.getContext()._context.imageSmoothingEnabled=!1,_.getContext()._context.imageSmoothingEnabled=!1),y.save(),C.save(),y.translate(-g,-d),C.translate(-g,-d),this._isUnderCache=!0,this._clearSelfAndDescendantCache(n),this._clearSelfAndDescendantCache(l),this.drawScene(v,this),this.drawHit(m,this),this._isUnderCache=!1,y.restore(),C.restore(),u&&(y.save(),y.beginPath(),y.rect(0,0,a,h),y.closePath(),y.setAttr("strokeStyle","red"),y.setAttr("lineWidth",5),y.stroke(),y.restore()),this._cache.set(c,{scene:v,filter:_,hit:m,x:g,y:d}),this._requestDraw(),this}t.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.")}isCached(){return this._cache.has(c)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var i,s,r,a,n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],h=this.getAbsoluteTransform(e);return n.forEach(function(t){var e=h.point(t);void 0===i&&(i=r=e.x,s=a=e.y),i=Math.min(i,e.x),s=Math.min(s,e.y),r=Math.max(r,e.x),a=Math.max(a,e.y)}),{x:i,y:s,width:r-i,height:a-s}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);var i=this._getCachedSceneCanvas(),s=i.pixelRatio;t.drawImage(i._canvas,0,0,i.width/s,i.height/s),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),i=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(i._canvas,0,0,i.width/i.pixelRatio,i.height/i.pixelRatio),t.restore()}_getCachedSceneCanvas(){var e,i,s,r,a=this.filters(),n=this._getCanvasCache(),h=n.scene,o=n.filter,l=o.getContext();if(a){if(!this._filterUpToDate){var c=h.pixelRatio;o.setSize(h.width/h.pixelRatio,h.height/h.pixelRatio);try{for(e=a.length,l.clear(),l.drawImage(h._canvas,0,0,h.getWidth()/c,h.getHeight()/c),i=l.getImageData(0,0,o.getWidth(),o.getHeight()),s=0;s<e;s++)"function"==typeof(r=a[s])?(r.call(this,i),l.putImageData(i,0,0)):t.Util.error("Filter should be type of function, but got "+typeof r+" instead. Please check correct filters")}catch(g){t.Util.error("Unable to apply filter. "+g.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return o}return h}on(t,e){if(this._cache&&this._cache.delete(h),3===arguments.length)return this._delegate.apply(this,arguments);var i,s,r,a,n=t.split(C),o=n.length;for(i=0;i<o;i++)r=(s=n[i].split("."))[0],a=s[1]||"",this.eventListeners[r]||(this.eventListeners[r]=[]),this.eventListeners[r].push({name:a,handler:e});return this}off(t,e){var i,s,r,a,n,o=(t||"").split(C),l=o.length;if(this._cache&&this._cache.delete(h),!t)for(s in this.eventListeners)this._off(s);for(i=0;i<l;i++)if(a=(r=o[i].split("."))[0],n=r[1],a)this.eventListeners[a]&&this._off(a,n,e);else for(s in this.eventListeners)this._off(s,n,e);return this}dispatchEvent(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(t){e.call(this,t.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(e,i,s){var r=this;this.on(e,function(e){for(var a=e.target.findAncestors(i,!0,r),n=0;n<a.length;n++)(e=t.Util.cloneObject(e)).currentTarget=a[n],s.call(a[n],e)})}remove(){return this.isDragging()&&this.stopDrag(),r.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(o),this._clearSelfAndDescendantCache(n),this._clearSelfAndDescendantCache(l),this._clearSelfAndDescendantCache(b),this._clearSelfAndDescendantCache(D),this._clearSelfAndDescendantCache(u)}_remove(){this._clearCaches();var t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){var i="get"+t.Util._capitalize(e);return t.Util._isFunction(this[i])?this[i]():this.attrs[e]}getAncestors(){for(var t=this.getParent(),e=[];t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{var i,s;if(!e)return this;for(i in e)i!==d&&(s=m+t.Util._capitalize(i),t.Util._isFunction(this[s])?this[s](e[i]):this._setAttr(i,e[i]))}),this}isListening(){return this._getCache(u,this._isListening)}_isListening(t){if(!this.listening())return!1;const e=this.getParent();return!e||e===t||this===t||e._isListening(t)}isVisible(){return this._getCache(D,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const e=this.getParent();return!e||e===t||this===t||e._isVisible(t)}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var i=this.getLayer(),a=!1;r.DD._dragElements.forEach(t=>{"dragging"===t.dragStatus&&("Stage"===t.node.nodeType?a=!0:t.node.getLayer()===i&&(a=!0))});var n=!e&&!s.Konva.hitOnDragEnabled&&a;return this.isListening()&&this.isVisible()&&!n}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t,e,i,s,r=this.getDepth(),a=this,n=0;return a.nodeType!==w&&function h(o){for(t=[],e=o.length,i=0;i<e;i++)s=o[i],n++,s.nodeType!==y&&(t=t.concat(s.getChildren().slice())),s._id===a._id&&(i=e);t.length>0&&t[0].getDepth()<=r&&h(t)}(a.getStage().getChildren()),n}getDepth(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(x),this._clearSelfAndDescendantCache(o)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var e=this.getAbsoluteTransform().copy();return e.invert(),e.point(t)}getAbsolutePosition(e){let i=!1,s=this.parent;for(;s;){if(s.isCached()){i=!0;break}s=s.parent}i&&!e&&(e=!0);var r=this.getAbsoluteTransform(e).getMatrix(),a=new t.Transform,n=this.offset();return a.m=r.slice(),a.translate(n.x,n.y),a.getTranslation()}setAbsolutePosition(t){var e=this._clearTransform();this.attrs.x=e.x,this.attrs.y=e.y,delete e.x,delete e.y,this._clearCache(x);var i=this._getAbsoluteTransform().copy();return i.invert(),i.translate(t.x,t.y),t={x:this.attrs.x+i.getTranslation().x,y:this.attrs.y+i.getTranslation().y},this._setTransform(e),this.setPosition({x:t.x,y:t.y}),this._clearCache(x),this._clearSelfAndDescendantCache(o),this}_setTransform(t){var e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){var t={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,t}move(t){var e=t.x,i=t.y,s=this.x(),r=this.y();return void 0!==e&&(s+=e),void 0!==i&&(r+=i),this.setPosition({x:s,y:r}),this}_eachAncestorReverse(t,e){var i,s,r=[],a=this.getParent();if(!e||e._id!==this._id){for(r.unshift(this);a&&(!e||a._id!==e._id);)r.unshift(a),a=a.parent;for(i=r.length,s=0;s<i;s++)t(r[s])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return t.Util.warn("Node has no parent. moveToTop function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return t.Util.warn("Node has no parent. moveUp function is ignored."),!1;var e=this.index;return e<this.parent.getChildren().length-1&&(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return t.Util.warn("Node has no parent. moveDown function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return t.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(e){if(!this.parent)return t.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&t.Util.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var i=this.index;return this.parent.children.splice(i,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(n,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var e,i,s,r,a={},n=this.getAttrs();for(e in a.attrs={},n)i=n[e],t.Util.isObject(i)&&!t.Util._isPlainObject(i)&&!t.Util._isArray(i)||(s="function"==typeof this[e]&&this[e],delete n[e],r=s?s.call(this):null,n[e]=i,r!==i&&(a.attrs[e]=i));return a.className=this.getClassName(),t.Util._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,i){var s=[];e&&this._isMatch(t)&&s.push(this);for(var r=this.parent;r;){if(r===i)return s;r._isMatch(t)&&s.push(r),r=r.parent}return s}isAncestorOf(t){return!1}findAncestor(t,e,i){return this.findAncestors(t,e,i)[0]}_isMatch(e){if(!e)return!1;if("function"==typeof e)return e(this);var i,s,r=e.replace(/ /g,"").split(","),a=r.length;for(i=0;i<a;i++)if(s=r[i],t.Util.isValidSelector(s)||(t.Util.warn('Selector "'+s+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),t.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),t.Util.warn("Konva is awesome, right?")),"#"===s.charAt(0)){if(this.id()===s.slice(1))return!0}else if("."===s.charAt(0)){if(this.hasName(s.slice(1)))return!0}else if(this.className===s||this.nodeType===s)return!0;return!1}getLayer(){var t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(b,this._getStage)}_getStage(){var t=this.getParent();return t?t.getStage():void 0}fire(t,e={},i){return e.target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(o,this._getAbsoluteTransform)}_getAbsoluteTransform(e){var i;if(e)return i=new t.Transform,this._eachAncestorReverse(function(t){var e=t.transformsEnabled();"all"===e?i.multiply(t.getTransform()):"position"===e&&i.translate(t.x()-t.offsetX(),t.y()-t.offsetY())},e),i;i=this._cache.get(o)||new t.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(i):i.reset();var s=this.transformsEnabled();if("all"===s)i.multiply(this.getTransform());else if("position"===s){const t=this.attrs.x||0,e=this.attrs.y||0,s=this.attrs.offsetX||0,r=this.attrs.offsetY||0;i.translate(t-s,e-r)}return i.dirty=!1,i}getAbsoluteScale(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();const i=this.getAbsoluteTransform(t).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(x,this._getTransform)}_getTransform(){var e,i,r=this._cache.get(x)||new t.Transform;r.reset();var a=this.x(),n=this.y(),h=s.Konva.getAngle(this.rotation()),o=null!==(e=this.attrs.scaleX)&&void 0!==e?e:1,l=null!==(i=this.attrs.scaleY)&&void 0!==i?i:1,c=this.attrs.skewX||0,g=this.attrs.skewY||0,d=this.attrs.offsetX||0,f=this.attrs.offsetY||0;return 0===a&&0===n||r.translate(a,n),0!==h&&r.rotate(h),0===c&&0===g||r.skew(c,g),1===o&&1===l||r.scale(o,l),0===d&&0===f||r.translate(-1*d,-1*f),r.dirty=!1,r}clone(e){var i,s,r,a,n,h=t.Util.cloneObject(this.attrs);for(i in e)h[i]=e[i];var o=new this.constructor(h);for(i in this.eventListeners)for(r=(s=this.eventListeners[i]).length,a=0;a<r;a++)(n=s[a]).name.indexOf(f)<0&&(o.eventListeners[i]||(o.eventListeners[i]=[]),o.eventListeners[i].push(n));return o}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),s=this.getStage(),r=void 0!==t.x?t.x:Math.floor(e.x),a=void 0!==t.y?t.y:Math.floor(e.y),n=t.pixelRatio||1,h=new i.SceneCanvas({width:t.width||Math.ceil(e.width)||(s?s.width():0),height:t.height||Math.ceil(e.height)||(s?s.height():0),pixelRatio:n}),o=h.getContext();return!1===t.imageSmoothingEnabled&&(o._context.imageSmoothingEnabled=!1),o.save(),(r||a)&&o.translate(-1*r,-1*a),this.drawScene(h),o.restore(),h}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){var e=(t=t||{}).mimeType||null,i=t.quality||null,s=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(s),s}toImage(e){return new Promise((i,s)=>{try{const a=null==e?void 0:e.callback;a&&delete e.callback,t.Util._urlToImage(this.toDataURL(e),function(t){i(t),null==a||a(t)})}catch(r){s(r)}})}toBlob(t){return new Promise((e,i)=>{try{const r=null==t?void 0:t.callback;r&&delete t.callback,this.toCanvas(t).toBlob(t=>{e(t),null==r||r(t)})}catch(s){i(s)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():s.Konva.dragDistance}_off(t,e,i){var s,r,a,n=this.eventListeners[t];for(s=0;s<n.length;s++)if(r=n[s].name,a=n[s].handler,!("konva"===r&&"konva"!==e||e&&r!==e||i&&i!==a)){if(n.splice(s,1),0===n.length){delete this.eventListeners[t];break}s--}}_fireChangeEvent(t,e,i){this._fire(t+g,{oldVal:e,newVal:i})}addName(t){if(!this.hasName(t)){var e=this.name(),i=e?e+" "+t:t;this.name(i)}return this}hasName(t){if(!t)return!1;const e=this.name();return!!e&&-1!==(e||"").split(/\s/g).indexOf(t)}removeName(t){var e=(this.name()||"").split(/\s/g),i=e.indexOf(t);return-1!==i&&(e.splice(i,1),this.name(e.join(" "))),this}setAttr(e,i){var s=this[m+t.Util._capitalize(e)];return t.Util._isFunction(s)?s.call(this,i):this._setAttr(e,i),this}_requestDraw(){if(s.Konva.autoDrawEnabled){const t=this.getLayer()||this.getStage();null==t||t.batchDraw()}}_setAttr(e,i){var s=this.attrs[e];(s!==i||t.Util.isObject(i))&&(null==i?delete this.attrs[e]:this.attrs[e]=i,this._shouldFireChangeEvents&&this._fireChangeEvent(e,s,i),this._requestDraw())}_setComponentAttr(t,e,i){var s;void 0!==i&&((s=this.attrs[t])||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=i,this._fireChangeEvent(t,s,i))}_fireAndBubble(t,e,i){if(e&&this.nodeType===y&&(e.target=this),!((t===p||t===v)&&(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||"Stage"===this.nodeType&&!i))){this._fire(t,e);var s=(t===p||t===v)&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!s&&(i&&i.parent?this._fireAndBubble.call(this.parent,t,e,i):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,i,s;const r=null!==(e=this._cache.get(h))&&void 0!==e?e:{};let a=null==r?void 0:r[t];if(void 0===a){a=[];let e=Object.getPrototypeOf(this);for(;e;){const r=null!==(s=null===(i=e.eventListeners)||void 0===i?void 0:i[t])&&void 0!==s?s:[];a.push(...r),e=Object.getPrototypeOf(e)}r[t]=a,this._cache.set(h,r)}return a}_fire(t,e){(e=e||{}).currentTarget=this,e.type=t;const i=this._getProtoListeners(t);if(i)for(var s=0;s<i.length;s++)i[s].handler.call(this,e);const r=this.eventListeners[t];if(r)for(s=0;s<r.length;s++)r[s].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){var e=t?t.pointerId:void 0,i=this.getStage(),s=this.getAbsolutePosition(),a=i._getPointerById(e)||i._changedPointerPositions[0]||s;r.DD._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-s.x,y:a.y-s.y},dragStatus:"ready",pointerId:e})}startDrag(t,e=!0){r.DD._dragElements.has(this._id)||this._createDragElement(t),r.DD._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(e,i){const s=this.getStage()._getPointerById(i.pointerId);if(s){var r={x:s.x-i.offset.x,y:s.y-i.offset.y},a=this.dragBoundFunc();if(void 0!==a){const i=a.call(this,r,e);i?r=i:t.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===r.x&&this._lastPos.y===r.y||(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(t){const e=r.DD._dragElements.get(this._id);e&&(e.dragStatus="stopped"),r.DD._endDragBefore(t),r.DD._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=r.DD._dragElements.get(this._id);return!!t&&"dragging"===t.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){if((!(void 0!==t.evt.button)||s.Konva.dragButtons.indexOf(t.evt.button)>=0)&&!this.isDragging()){var e=!1;r.DD._dragElements.forEach(t=>{this.isAncestorOf(t.node)&&(e=!0)}),e||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const t=r.DD._dragElements.get(this._id),e=t&&"dragging"===t.dragStatus,i=t&&"ready"===t.dragStatus;e?this.stopDrag():i&&r.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const i=this.getStage();if(!i)return!1;const s={x:-e.x,y:-e.y,width:i.width()+2*e.x,height:i.height()+2*e.y};return t.Util.haveIntersection(s,this.getClientRect())}static create(e,i){return t.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,i)}static _createNode(e,i){var r,a,n,h=T.prototype.getClassName.call(e),o=e.children;if(i&&(e.attrs.container=i),s.Konva[h]||(t.Util.warn('Can not find a node with class name "'+h+'". Fallback to "Shape".'),h="Shape"),r=new(0,s.Konva[h])(e.attrs),o)for(a=o.length,n=0;n<a;n++)r.add(T._createNode(o[n]));return r}}exports.Node=T,T.prototype.nodeType="Node",T.prototype._attrsAffectingSize=[],T.prototype.eventListeners={},T.prototype.on.call(T.prototype,S,function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(x),this._clearSelfAndDescendantCache(o))}),T.prototype.on.call(T.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(D)}),T.prototype.on.call(T.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(u)}),T.prototype.on.call(T.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(n)});const k=e.Factory.addGetterSetter;k(T,"zIndex"),k(T,"absolutePosition"),k(T,"position"),k(T,"x",0,(0,a.getNumberValidator)()),k(T,"y",0,(0,a.getNumberValidator)()),k(T,"globalCompositeOperation","source-over",(0,a.getStringValidator)()),k(T,"opacity",1,(0,a.getNumberValidator)()),k(T,"name","",(0,a.getStringValidator)()),k(T,"id","",(0,a.getStringValidator)()),k(T,"rotation",0,(0,a.getNumberValidator)()),e.Factory.addComponentsGetterSetter(T,"scale",["x","y"]),k(T,"scaleX",1,(0,a.getNumberValidator)()),k(T,"scaleY",1,(0,a.getNumberValidator)()),e.Factory.addComponentsGetterSetter(T,"skew",["x","y"]),k(T,"skewX",0,(0,a.getNumberValidator)()),k(T,"skewY",0,(0,a.getNumberValidator)()),e.Factory.addComponentsGetterSetter(T,"offset",["x","y"]),k(T,"offsetX",0,(0,a.getNumberValidator)()),k(T,"offsetY",0,(0,a.getNumberValidator)()),k(T,"dragDistance",null,(0,a.getNumberValidator)()),k(T,"width",0,(0,a.getNumberValidator)()),k(T,"height",0,(0,a.getNumberValidator)()),k(T,"listening",!0,(0,a.getBooleanValidator)()),k(T,"preventDefault",!0,(0,a.getBooleanValidator)()),k(T,"filters",null,function(t){return this._filterUpToDate=!1,t}),k(T,"visible",!0,(0,a.getBooleanValidator)()),k(T,"transformsEnabled","all",(0,a.getStringValidator)()),k(T,"size"),k(T,"dragBoundFunc"),k(T,"draggable",!1,(0,a.getBooleanValidator)()),e.Factory.backCompat(T,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});
65
65
  },{"./Util":"XIcS","./Factory":"cgGB","./Canvas":"KydS","./Global":"bIDB","./DragAndDrop":"XvfD","./Validators":"tgRR"}],"Eysw":[function(require,module,exports) {
66
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Container=void 0;const t=require("./Factory"),e=require("./Node"),r=require("./Validators");class i extends e.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var r=[];return e.forEach(function(e){t(e)&&r.push(e)}),r}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(0===t.length)return this;if(t.length>1){for(var e=0;e<t.length;e++)this.add(t[e]);return this}const r=t[0];return r.getParent()?(r.moveTo(this),this):(this._validateAdd(r),r.index=this.getChildren().length,r.parent=this,r._clearCaches(),this.getChildren().push(r),this._fire("add",{child:r}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){var r=[];return this._descendants(i=>{const s=i._isMatch(t);return s&&r.push(i),!(!s||!e)}),r}_descendants(t){let e=!1;const r=this.getChildren();for(const i of r){if(e=t(i))return!0;if(i.hasChildren()&&(e=i._descendants(t)))return!0}return!1}toObject(){var t=e.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(e=>{t.children.push(e.toObject())}),t}isAncestorOf(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){var r=e.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(t){r.add(t.clone())}),r}getAllIntersections(t){var e=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&e.push(r)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),this.isCached()||null===(e=this.children)||void 0===e||e.forEach(function(e){e._clearSelfAndDescendantCache(t)})}_setChildrenIndices(){var t;null===(t=this.children)||void 0===t||t.forEach(function(t,e){t.index=e}),this._requestDraw()}drawScene(t,e){var r=this.getLayer(),i=t||r&&r.getCanvas(),s=i&&i.getContext(),h=this._getCanvasCache(),n=h&&h.scene,a=i&&i.isCache;if(!this.isVisible()&&!a)return this;if(n){s.save();var d=this.getAbsoluteTransform(e).getMatrix();s.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",i,e);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,s=i&&i.getContext(),h=this._getCanvasCache();if(h&&h.hit){s.save();var n=this.getAbsoluteTransform(e).getMatrix();s.transform(n[0],n[1],n[2],n[3],n[4],n[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",i,e);return this}_drawChildren(t,e,r){var i,s=e&&e.getContext(),h=this.clipWidth(),n=this.clipHeight(),a=this.clipFunc(),d=h&&n||a;const o=r===this;if(d){s.save();var l=this.getAbsoluteTransform(r),c=l.getMatrix();if(s.transform(c[0],c[1],c[2],c[3],c[4],c[5]),s.beginPath(),a)a.call(this,s,this);else{var u=this.clipX(),f=this.clipY();s.rect(u,f,h,n)}s.clip(),c=l.copy().invert().getMatrix(),s.transform(c[0],c[1],c[2],c[3],c[4],c[5])}var g=!o&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===t;g&&(s.save(),s._applyGlobalCompositeOperation(this)),null===(i=this.children)||void 0===i||i.forEach(function(i){i[t](e,r)}),g&&s.restore(),d&&s.restore()}getClientRect(t){var e,r,i,s,h,n=(t=t||{}).skipTransform,a=t.relativeTo,d={x:1/0,y:1/0,width:0,height:0},o=this;null===(e=this.children)||void 0===e||e.forEach(function(e){if(e.visible()){var n=e.getClientRect({relativeTo:o,skipShadow:t.skipShadow,skipStroke:t.skipStroke});0===n.width&&0===n.height||(void 0===r?(r=n.x,i=n.y,s=n.x+n.width,h=n.y+n.height):(r=Math.min(r,n.x),i=Math.min(i,n.y),s=Math.max(s,n.x+n.width),h=Math.max(h,n.y+n.height)))}});for(var l=this.find("Shape"),c=!1,u=0;u<l.length;u++){if(l[u]._isVisible(this)){c=!0;break}}return d=c&&void 0!==r?{x:r,y:i,width:s-r,height:h-i}:{x:0,y:0,width:0,height:0},n?d:this._transformedRect(d,a)}}exports.Container=i,t.Factory.addComponentsGetterSetter(i,"clip",["x","y","width","height"]),t.Factory.addGetterSetter(i,"clipX",void 0,(0,r.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipY",void 0,(0,r.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipWidth",void 0,(0,r.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipHeight",void 0,(0,r.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipFunc");
66
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Container=void 0;const t=require("./Factory"),e=require("./Node"),r=require("./Validators");class i extends e.Node{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var r=[];return e.forEach(function(e){t(e)&&r.push(e)}),r}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(0===t.length)return this;if(t.length>1){for(var e=0;e<t.length;e++)this.add(t[e]);return this}const r=t[0];return r.getParent()?(r.moveTo(this),this):(this._validateAdd(r),r.index=this.getChildren().length,r.parent=this,r._clearCaches(),this.getChildren().push(r),this._fire("add",{child:r}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){var r=[];return this._descendants(i=>{const s=i._isMatch(t);return s&&r.push(i),!(!s||!e)}),r}_descendants(t){let e=!1;const r=this.getChildren();for(const i of r){if(e=t(i))return!0;if(i.hasChildren()&&(e=i._descendants(t)))return!0}return!1}toObject(){var t=e.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(e=>{t.children.push(e.toObject())}),t}isAncestorOf(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){var r=e.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(t){r.add(t.clone())}),r}getAllIntersections(t){var e=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&e.push(r)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),this.isCached()||null===(e=this.children)||void 0===e||e.forEach(function(e){e._clearSelfAndDescendantCache(t)})}_setChildrenIndices(){var t;null===(t=this.children)||void 0===t||t.forEach(function(t,e){t.index=e}),this._requestDraw()}drawScene(t,e){var r=this.getLayer(),i=t||r&&r.getCanvas(),s=i&&i.getContext(),h=this._getCanvasCache(),n=h&&h.scene,a=i&&i.isCache;if(!this.isVisible()&&!a)return this;if(n){s.save();var d=this.getAbsoluteTransform(e).getMatrix();s.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(s),s.restore()}else this._drawChildren("drawScene",i,e);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,s=i&&i.getContext(),h=this._getCanvasCache();if(h&&h.hit){s.save();var n=this.getAbsoluteTransform(e).getMatrix();s.transform(n[0],n[1],n[2],n[3],n[4],n[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",i,e);return this}_drawChildren(t,e,r){var i,s=e&&e.getContext(),h=this.clipWidth(),n=this.clipHeight(),a=this.clipFunc(),d=h&&n||a;const o=r===this;if(d){s.save();var l=this.getAbsoluteTransform(r),c=l.getMatrix();let t;if(s.transform(c[0],c[1],c[2],c[3],c[4],c[5]),s.beginPath(),a)t=a.call(this,s,this);else{var u=this.clipX(),f=this.clipY();s.rect(u,f,h,n)}s.clip.apply(s,t),c=l.copy().invert().getMatrix(),s.transform(c[0],c[1],c[2],c[3],c[4],c[5])}var g=!o&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===t;g&&(s.save(),s._applyGlobalCompositeOperation(this)),null===(i=this.children)||void 0===i||i.forEach(function(i){i[t](e,r)}),g&&s.restore(),d&&s.restore()}getClientRect(t){var e,r,i,s,h,n=(t=t||{}).skipTransform,a=t.relativeTo,d={x:1/0,y:1/0,width:0,height:0},o=this;null===(e=this.children)||void 0===e||e.forEach(function(e){if(e.visible()){var n=e.getClientRect({relativeTo:o,skipShadow:t.skipShadow,skipStroke:t.skipStroke});0===n.width&&0===n.height||(void 0===r?(r=n.x,i=n.y,s=n.x+n.width,h=n.y+n.height):(r=Math.min(r,n.x),i=Math.min(i,n.y),s=Math.max(s,n.x+n.width),h=Math.max(h,n.y+n.height)))}});for(var l=this.find("Shape"),c=!1,u=0;u<l.length;u++){if(l[u]._isVisible(this)){c=!0;break}}return d=c&&void 0!==r?{x:r,y:i,width:s-r,height:h-i}:{x:0,y:0,width:0,height:0},n?d:this._transformedRect(d,a)}}exports.Container=i,t.Factory.addComponentsGetterSetter(i,"clip",["x","y","width","height"]),t.Factory.addGetterSetter(i,"clipX",void 0,(0,r.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipY",void 0,(0,r.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipWidth",void 0,(0,r.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipHeight",void 0,(0,r.getNumberValidator)()),t.Factory.addGetterSetter(i,"clipFunc");
67
67
  },{"./Factory":"cgGB","./Node":"pBWF","./Validators":"tgRR"}],"Gfsp":[function(require,module,exports) {
68
68
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.releaseCapture=exports.setPointerCapture=exports.hasPointerCapture=exports.createEvent=exports.getCapturedShape=void 0;const e=require("./Global"),t=new Map,r=void 0!==e.Konva._global.PointerEvent;function o(e){return t.get(e)}function n(e){return{evt:e,pointerId:e.pointerId}}function p(e,r){return t.get(e)===r}function a(e,o){i(e),o.getStage()&&(t.set(e,o),r&&o._fire("gotpointercapture",n(new PointerEvent("gotpointercapture"))))}function i(e,o){const p=t.get(e);if(!p)return;const a=p.getStage();a&&a.content,t.delete(e),r&&p._fire("lostpointercapture",n(new PointerEvent("lostpointercapture")))}exports.getCapturedShape=o,exports.createEvent=n,exports.hasPointerCapture=p,exports.setPointerCapture=a,exports.releaseCapture=i;
69
69
  },{"./Global":"bIDB"}],"inLU":[function(require,module,exports) {
70
70
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Stage=exports.stages=void 0;const t=require("./Util"),e=require("./Factory"),i=require("./Container"),n=require("./Global"),r=require("./Canvas"),s=require("./DragAndDrop"),o=require("./Global"),a=require("./PointerEvents");var h="Stage",c="string",l="px",p="mouseout",u="mouseleave",d="mouseover",g="mouseenter",v="mousemove",_="mousedown",f="mouseup",P="pointermove",b="pointerdown",y="pointerup",C="pointercancel",m="lostpointercapture",w="pointerout",D="pointerleave",k="pointerover",x="pointerenter",S="contextmenu",E="touchstart",I="touchend",T="touchmove",A="touchcancel",B="wheel",O=5,K=[[g,"_pointerenter"],[_,"_pointerdown"],[v,"_pointermove"],[f,"_pointerup"],[u,"_pointerleave"],[E,"_pointerdown"],[T,"_pointermove"],[I,"_pointerup"],[A,"_pointercancel"],[d,"_pointerover"],[B,"_wheel"],[S,"_contextmenu"],[b,"_pointerdown"],[P,"_pointermove"],[y,"_pointerup"],[C,"_pointercancel"],[m,"_lostpointercapture"]];const L={mouse:{[w]:p,[D]:u,[k]:d,[x]:g,[P]:v,[b]:_,[y]:f,[C]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[w]:"touchout",[D]:"touchleave",[k]:"touchover",[x]:"touchenter",[P]:T,[b]:E,[y]:I,[C]:A,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[w]:w,[D]:D,[k]:k,[x]:x,[P]:P,[b]:b,[y]:y,[C]:C,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},j=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",U=t=>{const e=j(t);return"pointer"===e?n.Konva.pointerEventsEnabled&&L.pointer:"touch"===e?L.touch:"mouse"===e?L.mouse:void 0};function Y(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}const H="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);";exports.stages=[];class q extends i.Container{constructor(t){super(Y(t)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),exports.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",()=>{Y(this.attrs)}),this._checkVisibility()}_validateAdd(e){const i="Layer"===e.getType(),n="FastLayer"===e.getType();i||n||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if(typeof t===c){if("."===t.charAt(0)){var e=t.slice(1);t=document.getElementsByClassName(e)[0]}else{var i;i="#"!==t.charAt(0)?t:t.slice(1),t=document.getElementById(i)}if(!t)throw"Can not find container in document with id "+i}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var t,e=this.children,i=e.length;for(t=0;t<i;t++)e[t].clear();return this}clone(t){return t||(t={}),t.container="undefined"!=typeof document&&document.createElement("div"),i.Container.prototype.clone.call(this,t)}destroy(){super.destroy();var e=this.content;e&&t.Util._isInDocument(e)&&this.container().removeChild(e);var i=exports.stages.indexOf(this);return i>-1&&exports.stages.splice(i,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(t.Util.warn(H),null)}_getPointerById(t){return this._pointerPositions.find(e=>e.id===t)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(t){(t=t||{}).x=t.x||0,t.y=t.y||0,t.width=t.width||this.width(),t.height=t.height||this.height();var e=new r.SceneCanvas({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),i=e.getContext()._context,n=this.children;return(t.x||t.y)&&i.translate(-1*t.x,-1*t.y),n.forEach(function(e){if(e.isVisible()){var n=e._toKonvaCanvas(t);i.drawImage(n._canvas,t.x,t.y,n.getWidth()/n.getPixelRatio(),n.getHeight()/n.getPixelRatio())}}),e}getIntersection(t){if(!t)return null;var e,i=this.children;for(e=i.length-1;e>=0;e--){const n=i[e].getIntersection(t);if(n)return n}return null}_resizeDOM(){var t=this.width(),e=this.height();this.content&&(this.content.style.width=t+l,this.content.style.height=e+l),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.forEach(i=>{i.setSize({width:t,height:e}),i.draw()})}add(e,...i){if(arguments.length>1){for(var r=0;r<arguments.length;r++)this.add(arguments[r]);return this}super.add(e);var s=this.children.length;return s>O&&t.Util.warn("The stage has "+s+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),n.Konva.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return a.hasPointerCapture(t,this)}setPointerCapture(t){a.setPointerCapture(t,this)}releaseCapture(t){a.releaseCapture(t,this)}getLayers(){return this.children}_bindContentEvents(){n.Konva.isBrowser&&K.forEach(([t,e])=>{this.content.addEventListener(t,t=>{this[e](t)},{passive:!1})})}_pointerenter(t){this.setPointersPositions(t);const e=U(t.type);this._fire(e.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);const e=U(t.type);this._fire(e.pointerover,{evt:t,target:this,currentTarget:this})}_getTargetShape(t){let e=this[t+"targetShape"];return e&&!e.getStage()&&(e=null),e}_pointerleave(t){const e=U(t.type),i=j(t.type);if(e){this.setPointersPositions(t);var r=this._getTargetShape(i),o=!s.DD.isDragging||n.Konva.hitOnDragEnabled;r&&o?(r._fireAndBubble(e.pointerout,{evt:t}),r._fireAndBubble(e.pointerleave,{evt:t}),this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this[i+"targetShape"]=null):o&&(this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this._fire(e.pointerout,{evt:t,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(t){const e=U(t.type),i=j(t.type);if(e){this.setPointersPositions(t);var r=!1;this._changedPointerPositions.forEach(o=>{var a=this.getIntersection(o);if(s.DD.justDragged=!1,n.Konva["_"+i+"ListenClick"]=!0,!(a&&a.isListening()))return;n.Konva.capturePointerEventsEnabled&&a.setPointerCapture(o.id),this[i+"ClickStartShape"]=a,a._fireAndBubble(e.pointerdown,{evt:t,pointerId:o.id}),r=!0;const h=t.type.indexOf("touch")>=0;a.preventDefault()&&t.cancelable&&h&&t.preventDefault()}),r||this._fire(e.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(t){const e=U(t.type),i=j(t.type);if(!e)return;if(s.DD.isDragging&&s.DD.node.preventDefault()&&t.cancelable&&t.preventDefault(),this.setPointersPositions(t),!(!s.DD.isDragging||n.Konva.hitOnDragEnabled))return;var r={};let o=!1;var h=this._getTargetShape(i);this._changedPointerPositions.forEach(n=>{const s=a.getCapturedShape(n.id)||this.getIntersection(n),c=n.id,l={evt:t,pointerId:c};var p=h!==s;if(p&&h&&(h._fireAndBubble(e.pointerout,Object.assign({},l),s),h._fireAndBubble(e.pointerleave,Object.assign({},l),s)),s){if(r[s._id])return;r[s._id]=!0}s&&s.isListening()?(o=!0,p&&(s._fireAndBubble(e.pointerover,Object.assign({},l),h),s._fireAndBubble(e.pointerenter,Object.assign({},l),h),this[i+"targetShape"]=s),s._fireAndBubble(e.pointermove,Object.assign({},l))):h&&(this._fire(e.pointerover,{evt:t,target:this,currentTarget:this,pointerId:c}),this[i+"targetShape"]=null)}),o||this._fire(e.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){const e=U(t.type),i=j(t.type);if(!e)return;this.setPointersPositions(t);const r=this[i+"ClickStartShape"],o=this[i+"ClickEndShape"];var h={};let c=!1;this._changedPointerPositions.forEach(l=>{const p=a.getCapturedShape(l.id)||this.getIntersection(l);if(p){if(p.releaseCapture(l.id),h[p._id])return;h[p._id]=!0}const u=l.id,d={evt:t,pointerId:u};let g=!1;n.Konva["_"+i+"InDblClickWindow"]?(g=!0,clearTimeout(this[i+"DblTimeout"])):s.DD.justDragged||(n.Konva["_"+i+"InDblClickWindow"]=!0,clearTimeout(this[i+"DblTimeout"])),this[i+"DblTimeout"]=setTimeout(function(){n.Konva["_"+i+"InDblClickWindow"]=!1},n.Konva.dblClickWindow),p&&p.isListening()?(c=!0,this[i+"ClickEndShape"]=p,p._fireAndBubble(e.pointerup,Object.assign({},d)),n.Konva["_"+i+"ListenClick"]&&r&&r===p&&(p._fireAndBubble(e.pointerclick,Object.assign({},d)),g&&o&&o===p&&p._fireAndBubble(e.pointerdblclick,Object.assign({},d)))):(this[i+"ClickEndShape"]=null,n.Konva["_"+i+"ListenClick"]&&this._fire(e.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:u}),g&&this._fire(e.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:u}))}),c||this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),n.Konva["_"+i+"ListenClick"]=!1,t.cancelable&&"touch"!==i&&t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(S,{evt:t}):this._fire(S,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(B,{evt:t}):this._fire(B,{evt:t,target:this,currentTarget:this})}_pointercancel(t){this.setPointersPositions(t);const e=a.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble(y,a.createEvent(t)),a.releaseCapture(t.pointerId)}_lostpointercapture(t){a.releaseCapture(t.pointerId)}setPointersPositions(e){var i=this._getContentPosition(),n=null,r=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,t=>{this._pointerPositions.push({id:t.identifier,x:(t.clientX-i.left)/i.scaleX,y:(t.clientY-i.top)/i.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,t=>{this._changedPointerPositions.push({id:t.identifier,x:(t.clientX-i.left)/i.scaleX,y:(t.clientY-i.top)/i.scaleY})})):(n=(e.clientX-i.left)/i.scaleX,r=(e.clientY-i.top)/i.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:t.Util._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:t.Util._getFirstPointerId(e)}])}_setPointerPosition(e){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.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()}),n.Konva.isBrowser){var t=this.container();if(!t)throw"Stage has no container. A container is required.";t.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"),t.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(t){t.batchDraw()}),this}}exports.Stage=q,q.prototype.nodeType=h,(0,o._registerNode)(q),e.Factory.addGetterSetter(q,"container");
71
71
  },{"./Util":"XIcS","./Factory":"cgGB","./Container":"Eysw","./Global":"bIDB","./Canvas":"KydS","./DragAndDrop":"XvfD","./PointerEvents":"Gfsp"}],"JWag":[function(require,module,exports) {
72
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Shape=exports.shapes=void 0;const t=require("./Global"),e=require("./Util"),a=require("./Factory"),r=require("./Node"),i=require("./Validators"),o=require("./Global"),n=require("./PointerEvents");var s="hasShadow",d="shadowRGBA",l="patternImage",h="linearGradient",c="radialGradient";let f;function g(){return f||(f=e.Util.createCanvasElement().getContext("2d"))}function S(t){t.fill()}function u(t){t.stroke()}function y(t){t.fill()}function p(t){t.stroke()}function G(){this._clearCache(s)}function C(){this._clearCache(d)}function F(){this._clearCache(l)}function v(){this._clearCache(h)}function k(){this._clearCache(c)}exports.shapes={};class P extends r.Node{constructor(t){let a;for(super(t);!(a=e.Util.getRandomColor())||a in exports.shapes;);this.colorKey=a,exports.shapes[a]=this}getContext(){return e.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return e.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(s,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(l,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const a=g().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(a&&a.setTransform){const r=new e.Transform;r.translate(this.fillPatternX(),this.fillPatternY()),r.rotate(t.Konva.getAngle(this.fillPatternRotation())),r.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),r.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=r.getMatrix(),o="undefined"==typeof DOMMatrix?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);a.setTransform(o)}return a}}_getLinearGradient(){return this._getCache(h,this.__getLinearGradient)}__getLinearGradient(){var t=this.fillLinearGradientColorStops();if(t){for(var e=g(),a=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),i=e.createLinearGradient(a.x,a.y,r.x,r.y),o=0;o<t.length;o+=2)i.addColorStop(t[o],t[o+1]);return i}}_getRadialGradient(){return this._getCache(c,this.__getRadialGradient)}__getRadialGradient(){var t=this.fillRadialGradientColorStops();if(t){for(var e=g(),a=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),i=e.createRadialGradient(a.x,a.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius()),o=0;o<t.length;o+=2)i.addColorStop(t[o],t[o+1]);return i}}getShadowRGBA(){return this._getCache(d,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var t=e.Util.colorToRGBA(this.shadowColor());return t?"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")":void 0}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops()))}hasHitStroke(){const t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){var e=this.getStage().bufferHitCanvas;return e.getContext().clear(),this.drawHit(e,null,!0),e.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete exports.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(!this.getStage())return!1;if(!(null===(e=this.attrs.perfectDrawEnabled)||void 0===e||e))return!1;const a=t||this.hasFill(),r=this.hasStroke(),i=1!==this.getAbsoluteOpacity();if(a&&r&&i)return!0;const o=this.hasShadow(),n=this.shadowForStrokeEnabled();return!!(a&&r&&o&&n)}setStrokeHitEnabled(t){e.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){const e=t.skipTransform,a=t.relativeTo,r=this.getSelfRect(),i=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=r.width+i,n=r.height+i,s=!t.skipShadow&&this.hasShadow(),d=s?this.shadowOffsetX():0,l=s?this.shadowOffsetY():0,h=o+Math.abs(d),c=n+Math.abs(l),f=s&&this.shadowBlur()||0,g={width:h+2*f,height:c+2*f,x:-(i/2+f)+Math.min(d,0)+r.x,y:-(i/2+f)+Math.min(l,0)+r.y};return e?g:this._transformedRect(g,a)}drawScene(t,e){var a,r,i=this.getLayer(),o=t||i.getCanvas(),n=o.getContext(),s=this._getCanvasCache(),d=this.getSceneFunc(),l=this.hasShadow(),h=o.isCache,c=e===this;if(!this.isVisible()&&!c)return this;if(s){n.save();var f=this.getAbsoluteTransform(e).getMatrix();return n.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(n),n.restore(),this}if(!d)return this;if(n.save(),this._useBufferCanvas()&&!h){(r=(a=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this);var g=this.getAbsoluteTransform(e).getMatrix();r.transform(g[0],g[1],g[2],g[3],g[4],g[5]),d.call(this,r,this),r.restore();var S=a.pixelRatio;l&&n._applyShadow(this),n._applyOpacity(this),n._applyGlobalCompositeOperation(this),n.drawImage(a._canvas,0,0,a.width/S,a.height/S)}else{if(n._applyLineJoin(this),!c){g=this.getAbsoluteTransform(e).getMatrix();n.transform(g[0],g[1],g[2],g[3],g[4],g[5]),n._applyOpacity(this),n._applyGlobalCompositeOperation(this)}l&&n._applyShadow(this),d.call(this,n,this)}return n.restore(),this}drawHit(t,a,r=!1){if(!this.shouldDrawHit(a,r))return this;var i=this.getLayer(),o=t||i.hitCanvas,n=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),d=this._getCanvasCache(),l=d&&d.hit;if(this.colorKey||e.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()"),l){n.save();var h=this.getAbsoluteTransform(a).getMatrix();return n.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(n),n.restore(),this}if(!s)return this;if(n.save(),n._applyLineJoin(this),!(this===a)){var c=this.getAbsoluteTransform(a).getMatrix();n.transform(c[0],c[1],c[2],c[3],c[4],c[5])}return s.call(this,n,this),n.restore(),this}drawHitFromCache(t=0){var a,r,i,o,n,s=this._getCanvasCache(),d=this._getCachedSceneCanvas(),l=s.hit,h=l.getContext(),c=l.getWidth(),f=l.getHeight();h.clear(),h.drawImage(d._canvas,0,0,c,f);try{for(i=(r=(a=h.getImageData(0,0,c,f)).data).length,o=e.Util._hexToRgb(this.colorKey),n=0;n<i;n+=4)r[n+3]>t?(r[n]=o.r,r[n+1]=o.g,r[n+2]=o.b,r[n+3]=255):r[n+3]=0;h.putImageData(a,0,0)}catch(g){e.Util.error("Unable to draw hit graph from cached scene canvas. "+g.message)}return this}hasPointerCapture(t){return n.hasPointerCapture(t,this)}setPointerCapture(t){n.setPointerCapture(t,this)}releaseCapture(t){n.releaseCapture(t,this)}}exports.Shape=P,P.prototype._fillFunc=S,P.prototype._strokeFunc=u,P.prototype._fillFuncHit=y,P.prototype._strokeFuncHit=p,P.prototype._centroid=!1,P.prototype.nodeType="Shape",(0,o._registerNode)(P),P.prototype.eventListeners={},P.prototype.on.call(P.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",G),P.prototype.on.call(P.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",C),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",F),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",v),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",k),a.Factory.addGetterSetter(P,"stroke",void 0,(0,i.getStringOrGradientValidator)()),a.Factory.addGetterSetter(P,"strokeWidth",2,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillAfterStrokeEnabled",!1),a.Factory.addGetterSetter(P,"hitStrokeWidth","auto",(0,i.getNumberOrAutoValidator)()),a.Factory.addGetterSetter(P,"strokeHitEnabled",!0,(0,i.getBooleanValidator)()),a.Factory.addGetterSetter(P,"perfectDrawEnabled",!0,(0,i.getBooleanValidator)()),a.Factory.addGetterSetter(P,"shadowForStrokeEnabled",!0,(0,i.getBooleanValidator)()),a.Factory.addGetterSetter(P,"lineJoin"),a.Factory.addGetterSetter(P,"lineCap"),a.Factory.addGetterSetter(P,"sceneFunc"),a.Factory.addGetterSetter(P,"hitFunc"),a.Factory.addGetterSetter(P,"dash"),a.Factory.addGetterSetter(P,"dashOffset",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"shadowColor",void 0,(0,i.getStringValidator)()),a.Factory.addGetterSetter(P,"shadowBlur",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"shadowOpacity",1,(0,i.getNumberValidator)()),a.Factory.addComponentsGetterSetter(P,"shadowOffset",["x","y"]),a.Factory.addGetterSetter(P,"shadowOffsetX",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"shadowOffsetY",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillPatternImage"),a.Factory.addGetterSetter(P,"fill",void 0,(0,i.getStringOrGradientValidator)()),a.Factory.addGetterSetter(P,"fillPatternX",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillPatternY",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillLinearGradientColorStops"),a.Factory.addGetterSetter(P,"strokeLinearGradientColorStops"),a.Factory.addGetterSetter(P,"fillRadialGradientStartRadius",0),a.Factory.addGetterSetter(P,"fillRadialGradientEndRadius",0),a.Factory.addGetterSetter(P,"fillRadialGradientColorStops"),a.Factory.addGetterSetter(P,"fillPatternRepeat","repeat"),a.Factory.addGetterSetter(P,"fillEnabled",!0),a.Factory.addGetterSetter(P,"strokeEnabled",!0),a.Factory.addGetterSetter(P,"shadowEnabled",!0),a.Factory.addGetterSetter(P,"dashEnabled",!0),a.Factory.addGetterSetter(P,"strokeScaleEnabled",!0),a.Factory.addGetterSetter(P,"fillPriority","color"),a.Factory.addComponentsGetterSetter(P,"fillPatternOffset",["x","y"]),a.Factory.addGetterSetter(P,"fillPatternOffsetX",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillPatternOffsetY",0,(0,i.getNumberValidator)()),a.Factory.addComponentsGetterSetter(P,"fillPatternScale",["x","y"]),a.Factory.addGetterSetter(P,"fillPatternScaleX",1,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillPatternScaleY",1,(0,i.getNumberValidator)()),a.Factory.addComponentsGetterSetter(P,"fillLinearGradientStartPoint",["x","y"]),a.Factory.addComponentsGetterSetter(P,"strokeLinearGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(P,"fillLinearGradientStartPointX",0),a.Factory.addGetterSetter(P,"strokeLinearGradientStartPointX",0),a.Factory.addGetterSetter(P,"fillLinearGradientStartPointY",0),a.Factory.addGetterSetter(P,"strokeLinearGradientStartPointY",0),a.Factory.addComponentsGetterSetter(P,"fillLinearGradientEndPoint",["x","y"]),a.Factory.addComponentsGetterSetter(P,"strokeLinearGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(P,"fillLinearGradientEndPointX",0),a.Factory.addGetterSetter(P,"strokeLinearGradientEndPointX",0),a.Factory.addGetterSetter(P,"fillLinearGradientEndPointY",0),a.Factory.addGetterSetter(P,"strokeLinearGradientEndPointY",0),a.Factory.addComponentsGetterSetter(P,"fillRadialGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(P,"fillRadialGradientStartPointX",0),a.Factory.addGetterSetter(P,"fillRadialGradientStartPointY",0),a.Factory.addComponentsGetterSetter(P,"fillRadialGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(P,"fillRadialGradientEndPointX",0),a.Factory.addGetterSetter(P,"fillRadialGradientEndPointY",0),a.Factory.addGetterSetter(P,"fillPatternRotation",0),a.Factory.backCompat(P,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});
72
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Shape=exports.shapes=void 0;const t=require("./Global"),e=require("./Util"),a=require("./Factory"),r=require("./Node"),i=require("./Validators"),o=require("./Global"),n=require("./PointerEvents");var s="hasShadow",d="shadowRGBA",l="patternImage",h="linearGradient",c="radialGradient";let f;function g(){return f||(f=e.Util.createCanvasElement().getContext("2d"))}function S(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function u(t){t.stroke()}function y(t){t.fill()}function p(t){t.stroke()}function G(){this._clearCache(s)}function C(){this._clearCache(d)}function F(){this._clearCache(l)}function v(){this._clearCache(h)}function k(){this._clearCache(c)}exports.shapes={};class P extends r.Node{constructor(t){let a;for(super(t);!(a=e.Util.getRandomColor())||a in exports.shapes;);this.colorKey=a,exports.shapes[a]=this}getContext(){return e.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return e.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(s,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(l,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const a=g().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(a&&a.setTransform){const r=new e.Transform;r.translate(this.fillPatternX(),this.fillPatternY()),r.rotate(t.Konva.getAngle(this.fillPatternRotation())),r.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),r.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=r.getMatrix(),o="undefined"==typeof DOMMatrix?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);a.setTransform(o)}return a}}_getLinearGradient(){return this._getCache(h,this.__getLinearGradient)}__getLinearGradient(){var t=this.fillLinearGradientColorStops();if(t){for(var e=g(),a=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),i=e.createLinearGradient(a.x,a.y,r.x,r.y),o=0;o<t.length;o+=2)i.addColorStop(t[o],t[o+1]);return i}}_getRadialGradient(){return this._getCache(c,this.__getRadialGradient)}__getRadialGradient(){var t=this.fillRadialGradientColorStops();if(t){for(var e=g(),a=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),i=e.createRadialGradient(a.x,a.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius()),o=0;o<t.length;o+=2)i.addColorStop(t[o],t[o+1]);return i}}getShadowRGBA(){return this._getCache(d,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var t=e.Util.colorToRGBA(this.shadowColor());return t?"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")":void 0}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops()))}hasHitStroke(){const t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){var e=this.getStage().bufferHitCanvas;return e.getContext().clear(),this.drawHit(e,null,!0),e.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0}destroy(){return r.Node.prototype.destroy.call(this),delete exports.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(!this.getStage())return!1;if(!(null===(e=this.attrs.perfectDrawEnabled)||void 0===e||e))return!1;const a=t||this.hasFill(),r=this.hasStroke(),i=1!==this.getAbsoluteOpacity();if(a&&r&&i)return!0;const o=this.hasShadow(),n=this.shadowForStrokeEnabled();return!!(a&&r&&o&&n)}setStrokeHitEnabled(t){e.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){const e=t.skipTransform,a=t.relativeTo,r=this.getSelfRect(),i=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=r.width+i,n=r.height+i,s=!t.skipShadow&&this.hasShadow(),d=s?this.shadowOffsetX():0,l=s?this.shadowOffsetY():0,h=o+Math.abs(d),c=n+Math.abs(l),f=s&&this.shadowBlur()||0,g={width:h+2*f,height:c+2*f,x:-(i/2+f)+Math.min(d,0)+r.x,y:-(i/2+f)+Math.min(l,0)+r.y};return e?g:this._transformedRect(g,a)}drawScene(t,e){var a,r,i=this.getLayer(),o=t||i.getCanvas(),n=o.getContext(),s=this._getCanvasCache(),d=this.getSceneFunc(),l=this.hasShadow(),h=o.isCache,c=e===this;if(!this.isVisible()&&!c)return this;if(s){n.save();var f=this.getAbsoluteTransform(e).getMatrix();return n.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(n),n.restore(),this}if(!d)return this;if(n.save(),this._useBufferCanvas()&&!h){(r=(a=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this);var g=this.getAbsoluteTransform(e).getMatrix();r.transform(g[0],g[1],g[2],g[3],g[4],g[5]),d.call(this,r,this),r.restore();var S=a.pixelRatio;l&&n._applyShadow(this),n._applyOpacity(this),n._applyGlobalCompositeOperation(this),n.drawImage(a._canvas,0,0,a.width/S,a.height/S)}else{if(n._applyLineJoin(this),!c){g=this.getAbsoluteTransform(e).getMatrix();n.transform(g[0],g[1],g[2],g[3],g[4],g[5]),n._applyOpacity(this),n._applyGlobalCompositeOperation(this)}l&&n._applyShadow(this),d.call(this,n,this)}return n.restore(),this}drawHit(t,a,r=!1){if(!this.shouldDrawHit(a,r))return this;var i=this.getLayer(),o=t||i.hitCanvas,n=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),d=this._getCanvasCache(),l=d&&d.hit;if(this.colorKey||e.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()"),l){n.save();var h=this.getAbsoluteTransform(a).getMatrix();return n.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(n),n.restore(),this}if(!s)return this;if(n.save(),n._applyLineJoin(this),!(this===a)){var c=this.getAbsoluteTransform(a).getMatrix();n.transform(c[0],c[1],c[2],c[3],c[4],c[5])}return s.call(this,n,this),n.restore(),this}drawHitFromCache(t=0){var a,r,i,o,n,s=this._getCanvasCache(),d=this._getCachedSceneCanvas(),l=s.hit,h=l.getContext(),c=l.getWidth(),f=l.getHeight();h.clear(),h.drawImage(d._canvas,0,0,c,f);try{for(i=(r=(a=h.getImageData(0,0,c,f)).data).length,o=e.Util._hexToRgb(this.colorKey),n=0;n<i;n+=4)r[n+3]>t?(r[n]=o.r,r[n+1]=o.g,r[n+2]=o.b,r[n+3]=255):r[n+3]=0;h.putImageData(a,0,0)}catch(g){e.Util.error("Unable to draw hit graph from cached scene canvas. "+g.message)}return this}hasPointerCapture(t){return n.hasPointerCapture(t,this)}setPointerCapture(t){n.setPointerCapture(t,this)}releaseCapture(t){n.releaseCapture(t,this)}}exports.Shape=P,P.prototype._fillFunc=S,P.prototype._strokeFunc=u,P.prototype._fillFuncHit=y,P.prototype._strokeFuncHit=p,P.prototype._centroid=!1,P.prototype.nodeType="Shape",(0,o._registerNode)(P),P.prototype.eventListeners={},P.prototype.on.call(P.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",G),P.prototype.on.call(P.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",C),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",F),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",v),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",k),a.Factory.addGetterSetter(P,"stroke",void 0,(0,i.getStringOrGradientValidator)()),a.Factory.addGetterSetter(P,"strokeWidth",2,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillAfterStrokeEnabled",!1),a.Factory.addGetterSetter(P,"hitStrokeWidth","auto",(0,i.getNumberOrAutoValidator)()),a.Factory.addGetterSetter(P,"strokeHitEnabled",!0,(0,i.getBooleanValidator)()),a.Factory.addGetterSetter(P,"perfectDrawEnabled",!0,(0,i.getBooleanValidator)()),a.Factory.addGetterSetter(P,"shadowForStrokeEnabled",!0,(0,i.getBooleanValidator)()),a.Factory.addGetterSetter(P,"lineJoin"),a.Factory.addGetterSetter(P,"lineCap"),a.Factory.addGetterSetter(P,"sceneFunc"),a.Factory.addGetterSetter(P,"hitFunc"),a.Factory.addGetterSetter(P,"dash"),a.Factory.addGetterSetter(P,"dashOffset",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"shadowColor",void 0,(0,i.getStringValidator)()),a.Factory.addGetterSetter(P,"shadowBlur",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"shadowOpacity",1,(0,i.getNumberValidator)()),a.Factory.addComponentsGetterSetter(P,"shadowOffset",["x","y"]),a.Factory.addGetterSetter(P,"shadowOffsetX",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"shadowOffsetY",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillPatternImage"),a.Factory.addGetterSetter(P,"fill",void 0,(0,i.getStringOrGradientValidator)()),a.Factory.addGetterSetter(P,"fillPatternX",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillPatternY",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillLinearGradientColorStops"),a.Factory.addGetterSetter(P,"strokeLinearGradientColorStops"),a.Factory.addGetterSetter(P,"fillRadialGradientStartRadius",0),a.Factory.addGetterSetter(P,"fillRadialGradientEndRadius",0),a.Factory.addGetterSetter(P,"fillRadialGradientColorStops"),a.Factory.addGetterSetter(P,"fillPatternRepeat","repeat"),a.Factory.addGetterSetter(P,"fillEnabled",!0),a.Factory.addGetterSetter(P,"strokeEnabled",!0),a.Factory.addGetterSetter(P,"shadowEnabled",!0),a.Factory.addGetterSetter(P,"dashEnabled",!0),a.Factory.addGetterSetter(P,"strokeScaleEnabled",!0),a.Factory.addGetterSetter(P,"fillPriority","color"),a.Factory.addComponentsGetterSetter(P,"fillPatternOffset",["x","y"]),a.Factory.addGetterSetter(P,"fillPatternOffsetX",0,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillPatternOffsetY",0,(0,i.getNumberValidator)()),a.Factory.addComponentsGetterSetter(P,"fillPatternScale",["x","y"]),a.Factory.addGetterSetter(P,"fillPatternScaleX",1,(0,i.getNumberValidator)()),a.Factory.addGetterSetter(P,"fillPatternScaleY",1,(0,i.getNumberValidator)()),a.Factory.addComponentsGetterSetter(P,"fillLinearGradientStartPoint",["x","y"]),a.Factory.addComponentsGetterSetter(P,"strokeLinearGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(P,"fillLinearGradientStartPointX",0),a.Factory.addGetterSetter(P,"strokeLinearGradientStartPointX",0),a.Factory.addGetterSetter(P,"fillLinearGradientStartPointY",0),a.Factory.addGetterSetter(P,"strokeLinearGradientStartPointY",0),a.Factory.addComponentsGetterSetter(P,"fillLinearGradientEndPoint",["x","y"]),a.Factory.addComponentsGetterSetter(P,"strokeLinearGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(P,"fillLinearGradientEndPointX",0),a.Factory.addGetterSetter(P,"strokeLinearGradientEndPointX",0),a.Factory.addGetterSetter(P,"fillLinearGradientEndPointY",0),a.Factory.addGetterSetter(P,"strokeLinearGradientEndPointY",0),a.Factory.addComponentsGetterSetter(P,"fillRadialGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(P,"fillRadialGradientStartPointX",0),a.Factory.addGetterSetter(P,"fillRadialGradientStartPointY",0),a.Factory.addComponentsGetterSetter(P,"fillRadialGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(P,"fillRadialGradientEndPointX",0),a.Factory.addGetterSetter(P,"fillRadialGradientEndPointY",0),a.Factory.addGetterSetter(P,"fillPatternRotation",0),a.Factory.addGetterSetter(P,"fillRule",void 0,(0,i.getStringValidator)()),a.Factory.backCompat(P,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});
73
73
  },{"./Global":"bIDB","./Util":"XIcS","./Factory":"cgGB","./Node":"pBWF","./Validators":"tgRR","./PointerEvents":"Gfsp"}],"Xvvm":[function(require,module,exports) {
74
74
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Layer=void 0;const t=require("./Util"),e=require("./Container"),a=require("./Node"),i=require("./Factory"),n=require("./Canvas"),r=require("./Validators"),s=require("./Shape"),h=require("./Global");var o="#",l="beforeDraw",v="draw",d=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],g=d.length;class c extends e.Container{constructor(t){super(t),this.canvas=new n.SceneCanvas,this.hitCanvas=new n.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(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){a.Node.prototype.moveToTop.call(this);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!a.Node.prototype.moveUp.call(this))return!1;var t=this.getStage();return!(!t||!t.content)&&(t.content.removeChild(this.getNativeCanvasElement()),this.index<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[this.index+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(a.Node.prototype.moveDown.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(a.Node.prototype.moveToBottom.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var e=this.getNativeCanvasElement();return a.Node.prototype.remove.call(this),e&&e.parentNode&&t.Util._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(e){var a=e.getType();"Group"!==a&&"Shape"!==a&&t.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return(t=t||{}).width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=void 0!==t.x?t.x:this.x(),t.y=void 0!==t.y?t.y:this.y(),a.Node.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){const t=this.visible();this.canvas._canvas.style.display=t?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){t.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){t.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,t.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,a=!1;;){for(let i=0;i<g;i++){const n=d[i],r=this._getIntersection({x:t.x+n.x*e,y:t.y+n.y*e}),s=r.shape;if(s)return s;if(a=!!r.antialiased,!r.antialiased)break}if(!a)return null;e+=1}}_getIntersection(e){const a=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(e.x*a),Math.round(e.y*a),1,1).data,n=i[3];if(255===n){const e=t.Util._rgbToHex(i[0],i[1],i[2]),a=s.shapes[o+e];return a?{shape:a}:{antialiased:!0}}return n>0?{antialiased:!0}:{}}drawScene(t,a){var i=this.getLayer(),n=t||i&&i.getCanvas();return this._fire(l,{node:this}),this.clearBeforeDraw()&&n.getContext().clear(),e.Container.prototype.drawScene.call(this,n,a),this._fire(v,{node:this}),this}drawHit(t,a){var i=this.getLayer(),n=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),e.Container.prototype.drawHit.call(this,n,a),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){t.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return t.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var t=this.parent;!!this.hitCanvas._canvas.parentNode?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return t.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}exports.Layer=c,c.prototype.nodeType="Layer",(0,h._registerNode)(c),i.Factory.addGetterSetter(c,"imageSmoothingEnabled",!0),i.Factory.addGetterSetter(c,"clearBeforeDraw",!0),i.Factory.addGetterSetter(c,"hitGraphEnabled",!0,(0,r.getBooleanValidator)());
75
75
  },{"./Util":"XIcS","./Container":"Eysw","./Node":"pBWF","./Factory":"cgGB","./Canvas":"KydS","./Validators":"tgRR","./Shape":"JWag","./Global":"bIDB"}],"xdSo":[function(require,module,exports) {
@@ -77,9 +77,9 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
77
77
  },{"./Util":"XIcS","./Layer":"Xvvm","./Global":"bIDB"}],"SoFy":[function(require,module,exports) {
78
78
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Group=void 0;const e=require("./Util"),r=require("./Container"),o=require("./Global");class t extends r.Container{_validateAdd(r){var o=r.getType();"Group"!==o&&"Shape"!==o&&e.Util.throw("You may only add groups and shapes to groups.")}}exports.Group=t,t.prototype.nodeType="Group",(0,o._registerNode)(t);
79
79
  },{"./Util":"XIcS","./Container":"Eysw","./Global":"bIDB"}],"axDI":[function(require,module,exports) {
80
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Animation=void 0;const i=require("./Global"),t=require("./Util");var e=i.glob.performance&&i.glob.performance.now?function(){return i.glob.performance.now()}:function(){return(new Date).getTime()};class a{constructor(i,t){this.id=a.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:e(),frameRate:0},this.func=i,this.setLayers(t)}setLayers(i){var t=[];return t=i?i.length>0?i:[i]:[],this.layers=t,this}getLayers(){return this.layers}addLayer(i){var t,e=this.layers,a=e.length;for(t=0;t<a;t++)if(e[t]._id===i._id)return!1;return this.layers.push(i),!0}isRunning(){var i,t=a.animations,e=t.length;for(i=0;i<e;i++)if(t[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=e(),a._addAnimation(this),this}stop(){return a._removeAnimation(this),this}_updateFrameObject(i){this.frame.timeDiff=i-this.frame.lastTime,this.frame.lastTime=i,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(i){this.animations.push(i),this._handleAnimation()}static _removeAnimation(i){var t,e=i.id,a=this.animations,n=a.length;for(t=0;t<n;t++)if(a[t].id===e){this.animations.splice(t,1);break}}static _runFrames(){var i,t,a,n,r,s,m,o,h={},f=this.animations;for(n=0;n<f.length;n++)if(t=(i=f[n]).layers,a=i.func,i._updateFrameObject(e()),s=t.length,!a||!1!==a.call(i,i.frame))for(r=0;r<s;r++)void 0!==(m=t[r])._id&&(h[m._id]=m);for(o in h)h.hasOwnProperty(o)&&h[o].batchDraw()}static _animationLoop(){var i=a;i.animations.length?(i._runFrames(),t.Util.requestAnimFrame(i._animationLoop)):i.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,t.Util.requestAnimFrame(this._animationLoop))}}a.animations=[],a.animIdCounter=0,a.animRunning=!1,exports.Animation=a;
80
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Animation=void 0;const i=require("./Global"),t=require("./Util");var e=i.glob.performance&&i.glob.performance.now?function(){return i.glob.performance.now()}:function(){return(new Date).getTime()};class a{constructor(i,t){this.id=a.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:e(),frameRate:0},this.func=i,this.setLayers(t)}setLayers(i){var t=[];return t=i?i.length>0?i:[i]:[],this.layers=t,this}getLayers(){return this.layers}addLayer(i){var t,e=this.layers,a=e.length;for(t=0;t<a;t++)if(e[t]._id===i._id)return!1;return this.layers.push(i),!0}isRunning(){var i,t=a.animations,e=t.length;for(i=0;i<e;i++)if(t[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=e(),a._addAnimation(this),this}stop(){return a._removeAnimation(this),this}_updateFrameObject(i){this.frame.timeDiff=i-this.frame.lastTime,this.frame.lastTime=i,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(i){this.animations.push(i),this._handleAnimation()}static _removeAnimation(i){var t,e=i.id,a=this.animations,n=a.length;for(t=0;t<n;t++)if(a[t].id===e){this.animations.splice(t,1);break}}static _runFrames(){var i,t,a,n,r,s,m,o,h={},f=this.animations;for(n=0;n<f.length;n++)if(t=(i=f[n]).layers,a=i.func,i._updateFrameObject(e()),s=t.length,!a||!1!==a.call(i,i.frame))for(r=0;r<s;r++)void 0!==(m=t[r])._id&&(h[m._id]=m);for(o in h)h.hasOwnProperty(o)&&h[o].batchDraw()}static _animationLoop(){var i=a;i.animations.length?(i._runFrames(),t.Util.requestAnimFrame(i._animationLoop)):i.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,t.Util.requestAnimFrame(this._animationLoop))}}exports.Animation=a,a.animations=[],a.animIdCounter=0,a.animRunning=!1;
81
81
  },{"./Global":"bIDB","./Util":"XIcS"}],"Rq7v":[function(require,module,exports) {
82
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Easings=exports.Tween=void 0;const t=require("./Util"),e=require("./Animation"),s=require("./Node"),i=require("./Global");var n={node:1,duration:1,easing:1,onFinish:1,yoyo:1},r=1,a=2,h=3,o=0,u=["fill","stroke","shadowColor"];class d{constructor(t,e,s,i,n,r,a){this.prop=t,this.propFunc=e,this.begin=i,this._pos=i,this.duration=r,this._change=0,this.prevPos=0,this.yoyo=a,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=s,this._change=n-this.begin,this.pause()}fire(t){var e=this[t];e&&e()}setTime(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=h,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var t=this.getTimer()-this._startTime;this.state===a?this.setTime(t):this.state===h&&this.setTime(this.duration-t)}pause(){this.state=r,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class p{constructor(s){var r,a,h=this,u=s.node,l=u._id,_=s.easing||exports.Easings.Linear,g=!!s.yoyo;r=void 0===s.duration?.3:0===s.duration?.001:s.duration,this.node=u,this._id=o++;var c=u.getLayer()||(u instanceof i.Konva.Stage?u.getLayers():null);for(a in c||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new e.Animation(function(){h.tween.onEnterFrame()},c),this.tween=new d(a,function(t){h._tweenFunc(t)},_,0,1,1e3*r,g),this._addListeners(),p.attrs[l]||(p.attrs[l]={}),p.attrs[l][this._id]||(p.attrs[l][this._id]={}),p.tweens[l]||(p.tweens[l]={}),s)void 0===n[a]&&this._addAttr(a,s[a]);this.reset(),this.onFinish=s.onFinish,this.onReset=s.onReset,this.onUpdate=s.onUpdate}_addAttr(e,s){var i,n,r,a,h,o,d,l,_=this.node,g=_._id;if((r=p.tweens[g][e])&&delete p.attrs[g][r][e],i=_.getAttr(e),t.Util._isArray(s))if(n=[],h=Math.max(s.length,i.length),"points"===e&&s.length!==i.length&&(s.length>i.length?(d=i,i=t.Util._prepareArrayForTween(i,s,_.closed())):(o=s,s=t.Util._prepareArrayForTween(s,i,_.closed()))),0===e.indexOf("fill"))for(a=0;a<h;a++)if(a%2==0)n.push(s[a]-i[a]);else{var c=t.Util.colorToRGBA(i[a]);l=t.Util.colorToRGBA(s[a]),i[a]=c,n.push({r:l.r-c.r,g:l.g-c.g,b:l.b-c.b,a:l.a-c.a})}else for(a=0;a<h;a++)n.push(s[a]-i[a]);else-1!==u.indexOf(e)?(i=t.Util.colorToRGBA(i),n={r:(l=t.Util.colorToRGBA(s)).r-i.r,g:l.g-i.g,b:l.b-i.b,a:l.a-i.a}):n=s-i;p.attrs[g][this._id][e]={start:i,diff:n,end:s,trueEnd:o,trueStart:d},p.tweens[g][e]=this._id}_tweenFunc(e){var s,i,n,r,a,h,o,d,l=this.node,_=p.attrs[l._id][this._id];for(s in _){if(n=(i=_[s]).start,r=i.diff,d=i.end,t.Util._isArray(n))if(a=[],o=Math.max(n.length,d.length),0===s.indexOf("fill"))for(h=0;h<o;h++)h%2==0?a.push((n[h]||0)+r[h]*e):a.push("rgba("+Math.round(n[h].r+r[h].r*e)+","+Math.round(n[h].g+r[h].g*e)+","+Math.round(n[h].b+r[h].b*e)+","+(n[h].a+r[h].a*e)+")");else for(h=0;h<o;h++)a.push((n[h]||0)+r[h]*e);else a=-1!==u.indexOf(s)?"rgba("+Math.round(n.r+r.r*e)+","+Math.round(n.g+r.g*e)+","+Math.round(n.b+r.b*e)+","+(n.a+r.a*e)+")":n+r*e;l.setAttr(s,a)}}_addListeners(){this.tween.onPlay=(()=>{this.anim.start()}),this.tween.onReverse=(()=>{this.anim.start()}),this.tween.onPause=(()=>{this.anim.stop()}),this.tween.onFinish=(()=>{var t=this.node,e=p.attrs[t._id][this._id];e.points&&e.points.trueEnd&&t.setAttr("points",e.points.trueEnd),this.onFinish&&this.onFinish.call(this)}),this.tween.onReset=(()=>{var t=this.node,e=p.attrs[t._id][this._id];e.points&&e.points.trueStart&&t.points(e.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(t){return this.tween.seek(1e3*t),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var t,e=this.node._id,s=this._id,i=p.tweens[e];for(t in this.pause(),i)delete p.tweens[e][t];delete p.attrs[e][s]}}p.attrs={},p.tweens={},exports.Tween=p,s.Node.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new p(t).play()},exports.Easings={BackEaseIn(t,e,s,i){var n=1.70158;return s*(t/=i)*t*((n+1)*t-n)+e},BackEaseOut(t,e,s,i){var n=1.70158;return s*((t=t/i-1)*t*((n+1)*t+n)+1)+e},BackEaseInOut(t,e,s,i){var n=1.70158;return(t/=i/2)<1?s/2*(t*t*((1+(n*=1.525))*t-n))+e:s/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},ElasticEaseIn(t,e,s,i,n,r){var a=0;return 0===t?e:1==(t/=i)?e+s:(r||(r=.3*i),!n||n<Math.abs(s)?(n=s,a=r/4):a=r/(2*Math.PI)*Math.asin(s/n),-n*Math.pow(2,10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/r)+e)},ElasticEaseOut(t,e,s,i,n,r){var a=0;return 0===t?e:1==(t/=i)?e+s:(r||(r=.3*i),!n||n<Math.abs(s)?(n=s,a=r/4):a=r/(2*Math.PI)*Math.asin(s/n),n*Math.pow(2,-10*t)*Math.sin((t*i-a)*(2*Math.PI)/r)+s+e)},ElasticEaseInOut(t,e,s,i,n,r){var a=0;return 0===t?e:2==(t/=i/2)?e+s:(r||(r=i*(.3*1.5)),!n||n<Math.abs(s)?(n=s,a=r/4):a=r/(2*Math.PI)*Math.asin(s/n),t<1?n*Math.pow(2,10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/r)*-.5+e:n*Math.pow(2,-10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/r)*.5+s+e)},BounceEaseOut:(t,e,s,i)=>(t/=i)<1/2.75?s*(7.5625*t*t)+e:t<2/2.75?s*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?s*(7.5625*(t-=2.25/2.75)*t+.9375)+e:s*(7.5625*(t-=2.625/2.75)*t+.984375)+e,BounceEaseIn:(t,e,s,i)=>s-exports.Easings.BounceEaseOut(i-t,0,s,i)+e,BounceEaseInOut:(t,e,s,i)=>t<i/2?.5*exports.Easings.BounceEaseIn(2*t,0,s,i)+e:.5*exports.Easings.BounceEaseOut(2*t-i,0,s,i)+.5*s+e,EaseIn:(t,e,s,i)=>s*(t/=i)*t+e,EaseOut:(t,e,s,i)=>-s*(t/=i)*(t-2)+e,EaseInOut:(t,e,s,i)=>(t/=i/2)<1?s/2*t*t+e:-s/2*(--t*(t-2)-1)+e,StrongEaseIn:(t,e,s,i)=>s*(t/=i)*t*t*t*t+e,StrongEaseOut:(t,e,s,i)=>s*((t=t/i-1)*t*t*t*t+1)+e,StrongEaseInOut:(t,e,s,i)=>(t/=i/2)<1?s/2*t*t*t*t*t+e:s/2*((t-=2)*t*t*t*t+2)+e,Linear:(t,e,s,i)=>s*t/i+e};
82
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Easings=exports.Tween=void 0;const t=require("./Util"),e=require("./Animation"),s=require("./Node"),i=require("./Global");var n={node:1,duration:1,easing:1,onFinish:1,yoyo:1},r=1,a=2,h=3,o=0,u=["fill","stroke","shadowColor"];class d{constructor(t,e,s,i,n,r,a){this.prop=t,this.propFunc=e,this.begin=i,this._pos=i,this.duration=r,this._change=0,this.prevPos=0,this.yoyo=a,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=s,this._change=n-this.begin,this.pause()}fire(t){var e=this[t];e&&e()}setTime(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=h,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var t=this.getTimer()-this._startTime;this.state===a?this.setTime(t):this.state===h&&this.setTime(this.duration-t)}pause(){this.state=r,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class p{constructor(s){var r,a,h=this,u=s.node,l=u._id,_=s.easing||exports.Easings.Linear,g=!!s.yoyo;r=void 0===s.duration?.3:0===s.duration?.001:s.duration,this.node=u,this._id=o++;var c=u.getLayer()||(u instanceof i.Konva.Stage?u.getLayers():null);for(a in c||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new e.Animation(function(){h.tween.onEnterFrame()},c),this.tween=new d(a,function(t){h._tweenFunc(t)},_,0,1,1e3*r,g),this._addListeners(),p.attrs[l]||(p.attrs[l]={}),p.attrs[l][this._id]||(p.attrs[l][this._id]={}),p.tweens[l]||(p.tweens[l]={}),s)void 0===n[a]&&this._addAttr(a,s[a]);this.reset(),this.onFinish=s.onFinish,this.onReset=s.onReset,this.onUpdate=s.onUpdate}_addAttr(e,s){var i,n,r,a,h,o,d,l,_=this.node,g=_._id;if((r=p.tweens[g][e])&&delete p.attrs[g][r][e],i=_.getAttr(e),t.Util._isArray(s))if(n=[],h=Math.max(s.length,i.length),"points"===e&&s.length!==i.length&&(s.length>i.length?(d=i,i=t.Util._prepareArrayForTween(i,s,_.closed())):(o=s,s=t.Util._prepareArrayForTween(s,i,_.closed()))),0===e.indexOf("fill"))for(a=0;a<h;a++)if(a%2==0)n.push(s[a]-i[a]);else{var c=t.Util.colorToRGBA(i[a]);l=t.Util.colorToRGBA(s[a]),i[a]=c,n.push({r:l.r-c.r,g:l.g-c.g,b:l.b-c.b,a:l.a-c.a})}else for(a=0;a<h;a++)n.push(s[a]-i[a]);else-1!==u.indexOf(e)?(i=t.Util.colorToRGBA(i),n={r:(l=t.Util.colorToRGBA(s)).r-i.r,g:l.g-i.g,b:l.b-i.b,a:l.a-i.a}):n=s-i;p.attrs[g][this._id][e]={start:i,diff:n,end:s,trueEnd:o,trueStart:d},p.tweens[g][e]=this._id}_tweenFunc(e){var s,i,n,r,a,h,o,d,l=this.node,_=p.attrs[l._id][this._id];for(s in _){if(n=(i=_[s]).start,r=i.diff,d=i.end,t.Util._isArray(n))if(a=[],o=Math.max(n.length,d.length),0===s.indexOf("fill"))for(h=0;h<o;h++)h%2==0?a.push((n[h]||0)+r[h]*e):a.push("rgba("+Math.round(n[h].r+r[h].r*e)+","+Math.round(n[h].g+r[h].g*e)+","+Math.round(n[h].b+r[h].b*e)+","+(n[h].a+r[h].a*e)+")");else for(h=0;h<o;h++)a.push((n[h]||0)+r[h]*e);else a=-1!==u.indexOf(s)?"rgba("+Math.round(n.r+r.r*e)+","+Math.round(n.g+r.g*e)+","+Math.round(n.b+r.b*e)+","+(n.a+r.a*e)+")":n+r*e;l.setAttr(s,a)}}_addListeners(){this.tween.onPlay=(()=>{this.anim.start()}),this.tween.onReverse=(()=>{this.anim.start()}),this.tween.onPause=(()=>{this.anim.stop()}),this.tween.onFinish=(()=>{var t=this.node,e=p.attrs[t._id][this._id];e.points&&e.points.trueEnd&&t.setAttr("points",e.points.trueEnd),this.onFinish&&this.onFinish.call(this)}),this.tween.onReset=(()=>{var t=this.node,e=p.attrs[t._id][this._id];e.points&&e.points.trueStart&&t.points(e.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(t){return this.tween.seek(1e3*t),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var t,e=this.node._id,s=this._id,i=p.tweens[e];for(t in this.pause(),i)delete p.tweens[e][t];delete p.attrs[e][s]}}exports.Tween=p,p.attrs={},p.tweens={},s.Node.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new p(t).play()},exports.Easings={BackEaseIn(t,e,s,i){var n=1.70158;return s*(t/=i)*t*((n+1)*t-n)+e},BackEaseOut(t,e,s,i){var n=1.70158;return s*((t=t/i-1)*t*((n+1)*t+n)+1)+e},BackEaseInOut(t,e,s,i){var n=1.70158;return(t/=i/2)<1?s/2*(t*t*((1+(n*=1.525))*t-n))+e:s/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},ElasticEaseIn(t,e,s,i,n,r){var a=0;return 0===t?e:1==(t/=i)?e+s:(r||(r=.3*i),!n||n<Math.abs(s)?(n=s,a=r/4):a=r/(2*Math.PI)*Math.asin(s/n),-n*Math.pow(2,10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/r)+e)},ElasticEaseOut(t,e,s,i,n,r){var a=0;return 0===t?e:1==(t/=i)?e+s:(r||(r=.3*i),!n||n<Math.abs(s)?(n=s,a=r/4):a=r/(2*Math.PI)*Math.asin(s/n),n*Math.pow(2,-10*t)*Math.sin((t*i-a)*(2*Math.PI)/r)+s+e)},ElasticEaseInOut(t,e,s,i,n,r){var a=0;return 0===t?e:2==(t/=i/2)?e+s:(r||(r=i*(.3*1.5)),!n||n<Math.abs(s)?(n=s,a=r/4):a=r/(2*Math.PI)*Math.asin(s/n),t<1?n*Math.pow(2,10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/r)*-.5+e:n*Math.pow(2,-10*(t-=1))*Math.sin((t*i-a)*(2*Math.PI)/r)*.5+s+e)},BounceEaseOut:(t,e,s,i)=>(t/=i)<1/2.75?s*(7.5625*t*t)+e:t<2/2.75?s*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?s*(7.5625*(t-=2.25/2.75)*t+.9375)+e:s*(7.5625*(t-=2.625/2.75)*t+.984375)+e,BounceEaseIn:(t,e,s,i)=>s-exports.Easings.BounceEaseOut(i-t,0,s,i)+e,BounceEaseInOut:(t,e,s,i)=>t<i/2?.5*exports.Easings.BounceEaseIn(2*t,0,s,i)+e:.5*exports.Easings.BounceEaseOut(2*t-i,0,s,i)+.5*s+e,EaseIn:(t,e,s,i)=>s*(t/=i)*t+e,EaseOut:(t,e,s,i)=>-s*(t/=i)*(t-2)+e,EaseInOut:(t,e,s,i)=>(t/=i/2)<1?s/2*t*t+e:-s/2*(--t*(t-2)-1)+e,StrongEaseIn:(t,e,s,i)=>s*(t/=i)*t*t*t*t+e,StrongEaseOut:(t,e,s,i)=>s*((t=t/i-1)*t*t*t*t+1)+e,StrongEaseInOut:(t,e,s,i)=>(t/=i/2)<1?s/2*t*t*t*t*t+e:s/2*((t-=2)*t*t*t*t+2)+e,Linear:(t,e,s,i)=>s*t/i+e};
83
83
  },{"./Util":"XIcS","./Animation":"axDI","./Node":"pBWF","./Global":"bIDB"}],"Ufhz":[function(require,module,exports) {
84
84
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Konva=void 0;const e=require("./Global"),r=require("./Util"),a=require("./Node"),t=require("./Container"),i=require("./Stage"),n=require("./Layer"),o=require("./FastLayer"),s=require("./Group"),u=require("./DragAndDrop"),p=require("./Shape"),q=require("./Animation"),g=require("./Tween"),l=require("./Context"),v=require("./Canvas");exports.Konva=r.Util._assign(e.Konva,{Util:r.Util,Transform:r.Transform,Node:a.Node,Container:t.Container,Stage:i.Stage,stages:i.stages,Layer:n.Layer,FastLayer:o.FastLayer,Group:s.Group,DD:u.DD,Shape:p.Shape,shapes:p.shapes,Animation:q.Animation,Tween:g.Tween,Easings:g.Easings,Context:l.Context,Canvas:v.Canvas}),exports.default=exports.Konva;
85
85
  },{"./Global":"bIDB","./Util":"XIcS","./Node":"pBWF","./Container":"Eysw","./Stage":"inLU","./Layer":"Xvvm","./FastLayer":"xdSo","./Group":"SoFy","./DragAndDrop":"XvfD","./Shape":"JWag","./Animation":"axDI","./Tween":"Rq7v","./Context":"pIAY","./Canvas":"KydS"}],"XspI":[function(require,module,exports) {
@@ -115,7 +115,7 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
115
115
  },{"../Util":"XIcS","../Factory":"cgGB","../Shape":"JWag","../Validators":"tgRR","../Global":"bIDB"}],"aNkT":[function(require,module,exports) {
116
116
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TextPath=void 0;const t=require("../Util"),e=require("../Factory"),a=require("../Shape"),r=require("./Path"),i=require("./Text"),n=require("../Validators"),h=require("../Global");var s="",o="normal";function l(t){t.fillText(this.partialText,0,0)}function g(t){t.strokeText(this.partialText,0,0)}class x extends a.Shape{constructor(e){super(e),this.dummyCanvas=t.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return r.Path.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;return t-1>this.pathLength?null:r.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=r.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),a=this.fill(),r=this.fontSize(),i=this.glyphInfo;"underline"===e&&t.beginPath();for(var n=0;n<i.length;n++){t.save();var h=i[n].p0;t.translate(h.x,h.y),t.rotate(i[n].rotation),this.partialText=i[n].text,t.fillStrokeShape(this),"underline"===e&&(0===n&&t.moveTo(0,r/2+1),t.lineTo(r,r/2+1)),t.restore()}"underline"===e&&(t.strokeStyle=a,t.lineWidth=r/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var a=e[0].p0;t.moveTo(a.x,a.y)}for(var r=0;r<e.length;r++){var i=e[r].p1;t.lineTo(i.x,i.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return t.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return i.Text.prototype.setText.call(this,t)}_getContextFont(){return i.Text.prototype._getContextFont.call(this)}_getTextSize(t){var e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();var a=e.measureText(t);return e.restore(),{width:a.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const a=this.letterSpacing(),n=this.align(),h=this.kerningFunc(),s=Math.max(this.textWidth+((this.attrs.text||"").length-1)*a,0);let o=0;"center"===n&&(o=Math.max(0,this.pathLength/2-s/2)),"right"===n&&(o=Math.max(0,this.pathLength-s));const l=(0,i.stringToArray)(this.text());let g=o;for(var x=0;x<l.length;x++){const t=this._getPointAtLength(g);if(!t)return;let e=this._getTextSize(l[x]).width+a;if(" "===l[x]&&"justify"===n){const t=this.text().split(" ").length-1;e+=(this.pathLength-s)/t}const i=this._getPointAtLength(g+e);if(!i)return;const o=r.Path.getLineLength(t.x,t.y,i.x,i.y);let u=0;if(h)try{u=h(l[x-1],l[x])*this.fontSize()}catch(d){u=0}t.x+=u,i.x+=u,this.textWidth+=u;const p=r.Path.getPointOnLine(u+o/2,t.x,t.y,i.x,i.y),y=Math.atan2(i.y-t.y,i.x-t.x);this.glyphInfo.push({transposeX:p.x,transposeY:p.y,text:l[x],rotation:y,p0:t,p1:i}),g+=e}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var t=[];this.glyphInfo.forEach(function(e){t.push(e.p0.x),t.push(e.p0.y),t.push(e.p1.x),t.push(e.p1.y)});for(var e,a,r=t[0]||0,i=t[0]||0,n=t[1]||0,h=t[1]||0,s=0;s<t.length/2;s++)e=t[2*s],a=t[2*s+1],r=Math.min(r,e),i=Math.max(i,e),n=Math.min(n,a),h=Math.max(h,a);var o=this.fontSize();return{x:r-o/2,y:n-o/2,width:i-r+o,height:h-n+o}}destroy(){return t.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}exports.TextPath=x,x.prototype._fillFunc=l,x.prototype._strokeFunc=g,x.prototype._fillFuncHit=l,x.prototype._strokeFuncHit=g,x.prototype.className="TextPath",x.prototype._attrsAffectingSize=["text","fontSize","data"],(0,h._registerNode)(x),e.Factory.addGetterSetter(x,"data"),e.Factory.addGetterSetter(x,"fontFamily","Arial"),e.Factory.addGetterSetter(x,"fontSize",12,(0,n.getNumberValidator)()),e.Factory.addGetterSetter(x,"fontStyle",o),e.Factory.addGetterSetter(x,"align","left"),e.Factory.addGetterSetter(x,"letterSpacing",0,(0,n.getNumberValidator)()),e.Factory.addGetterSetter(x,"textBaseline","middle"),e.Factory.addGetterSetter(x,"fontVariant",o),e.Factory.addGetterSetter(x,"text",s),e.Factory.addGetterSetter(x,"textDecoration",null),e.Factory.addGetterSetter(x,"kerningFunc",null);
117
117
  },{"../Util":"XIcS","../Factory":"cgGB","../Shape":"JWag","./Path":"QFP7","./Text":"BUL9","../Validators":"tgRR","../Global":"bIDB"}],"HEY6":[function(require,module,exports) {
118
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Transformer=void 0;const t=require("../Util"),e=require("../Factory"),i=require("../Node"),o=require("../Shape"),n=require("./Rect"),r=require("../Group"),s=require("../Global"),h=require("../Validators"),a=require("../Global");var d="tr-konva",g=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange"].map(t=>t+`.${d}`).join(" "),c="nodesRect",l=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],f={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const m="ontouchstart"in s.Konva._global;function u(e,i){if("rotater"===e)return"crosshair";i+=t.Util.degToRad(f[e]||0);var o=(t.Util.radToDeg(i)%360+360)%360;return t.Util._inRange(o,337.5,360)||t.Util._inRange(o,0,22.5)?"ns-resize":t.Util._inRange(o,22.5,67.5)?"nesw-resize":t.Util._inRange(o,67.5,112.5)?"ew-resize":t.Util._inRange(o,112.5,157.5)?"nwse-resize":t.Util._inRange(o,157.5,202.5)?"ns-resize":t.Util._inRange(o,202.5,247.5)?"nesw-resize":t.Util._inRange(o,247.5,292.5)?"ew-resize":t.Util._inRange(o,292.5,337.5)?"nwse-resize":(t.Util.error("Transformer has unknown angle for cursor detection: "+o),"pointer")}var y=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],p=1e8;function _(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function b(t,e,i){const o=i.x+(t.x-i.x)*Math.cos(e)-(t.y-i.y)*Math.sin(e),n=i.y+(t.x-i.x)*Math.sin(e)+(t.y-i.y)*Math.cos(e);return Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:o,y:n})}function v(t,e){return b(t,e,_(t))}function x(t,e,i){let o=e;for(let n=0;n<t.length;n++){const r=s.Konva.getAngle(t[n]),h=Math.abs(r-e)%(2*Math.PI);Math.min(h,2*Math.PI-h)<i&&(o=r)}return o}class w extends r.Group{constructor(t){super(t),this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(g,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(e){return t.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return d+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const i=e.filter(e=>!e.isAncestorOf(this)||(t.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1));return this._nodes=e=i,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(t=>{const e=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},i=t._attrsAffectingSize.map(t=>t+"Change."+this._getEventNamespace()).join(" ");t.on(i,e),t.on(l.map(t=>t+`.${this._getEventNamespace()}`).join(" "),e),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,e),this._proxyDrag(t)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,i=>{e=t.getAbsolutePosition(),this.isDragging()||t===this.findOne(".back")||this.startDrag(i,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,i=>{if(!e)return;const o=t.getAbsolutePosition(),n=o.x-e.x,r=o.y-e.y;this.nodes().forEach(e=>{if(e===t)return;if(e.isDragging())return;const o=e.getAbsolutePosition();e.setAbsolutePosition({x:o.x+n,y:o.y+r}),e.startDrag(i)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(c),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(c,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),i){var o=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),n=t.getAbsoluteScale(i),r=t.getAbsolutePosition(i),h=o.x*n.x-t.offsetX()*n.x,a=o.y*n.y-t.offsetY()*n.y;const d=(s.Konva.getAngle(t.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return b({x:r.x+h*Math.cos(d)+a*Math.sin(-d),y:r.y+a*Math.cos(d)+h*Math.sin(d),width:o.width*n.x,height:o.height*n.y,rotation:d},-s.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-p,y:-p,width:0,height:0,rotation:0};const e=[];this.nodes().map(t=>{const i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var o=[{x:i.x,y:i.y},{x:i.x+i.width,y:i.y},{x:i.x+i.width,y:i.y+i.height},{x:i.x,y:i.y+i.height}],n=t.getAbsoluteTransform();o.forEach(function(t){var i=n.point(t);e.push(i)})});const i=new t.Transform;var o,n,r,h;i.rotate(-s.Konva.getAngle(this.rotation())),e.forEach(function(t){var e=i.point(t);void 0===o&&(o=r=e.x,n=h=e.y),o=Math.min(o,e.x),n=Math.min(n,e.y),r=Math.max(r,e.x),h=Math.max(h,e.y)}),i.invert();const a=i.point({x:o,y:n});return{x:a.x,y:a.y,width:r-o,height:h-n,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(),y.forEach(function(t){this._createAnchor(t)}.bind(this)),this._createAnchor("rotater")}_createAnchor(t){var e=new n.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:m?10:"auto"}),i=this;e.on("mousedown touchstart",function(t){i._handleMouseDown(t)}),e.on("dragstart",t=>{e.stopDrag(),t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),e.on("mouseenter",()=>{var i=s.Konva.getAngle(this.rotation()),o=u(t,i);e.getStage().content&&(e.getStage().content.style.cursor=o),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){var e=new o.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e){var i=this.getParent(),o=i.padding();e.beginPath(),e.rect(-o,-o,this.width()+2*o,this.height()+2*o),e.moveTo(this.width()/2,-o),i.rotateEnabled()&&e.lineTo(this.width()/2,-i.rotateAnchorOffset()*t.Util._sign(this.height())-o),e.fillStrokeShape(this)},hitFunc:(t,e)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();t.beginPath(),t.rect(-i,-i,e.width()+2*i,e.height()+2*i),t.fillStrokeShape(e)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",t=>{t.cancelBubble=!0}),e.on("dragmove",t=>{t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),this.on("dragmove",t=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var e=this._getNodeRect(),i=e.width,o=e.height,n=Math.sqrt(Math.pow(i,2)+Math.pow(o,2));this.sin=Math.abs(o/n),this.cos=Math.abs(i/n),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var r=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-r.x,y:s.y-r.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(e=>{e._fire("transformstart",{evt:t.evt,target:e})})}_handleMouseMove(t){var e,i,o,n=this.findOne("."+this._movingAnchorName),r=n.getStage();r.setPointersPositions(t);const h=r.getPointerPosition();let a={x:h.x-this._anchorDragOffset.x,y:h.y-this._anchorDragOffset.y};const d=n.getAbsolutePosition();this.anchorDragBoundFunc()&&(a=this.anchorDragBoundFunc()(d,a,t)),n.setAbsolutePosition(a);const g=n.getAbsolutePosition();if(d.x!==g.x||d.y!==g.y)if("rotater"!==this._movingAnchorName){var c,l=this.shiftBehavior();c="inverted"===l?this.keepRatio()&&!t.shiftKey:"none"===l?this.keepRatio():this.keepRatio()||t.shiftKey;var f=this.centeredScaling()||t.altKey;if("top-left"===this._movingAnchorName){if(c){var m=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};o=Math.sqrt(Math.pow(m.x-n.x(),2)+Math.pow(m.y-n.y(),2));var u=this.findOne(".top-left").x()>m.x?-1:1,y=this.findOne(".top-left").y()>m.y?-1:1;e=o*this.cos*u,i=o*this.sin*y,this.findOne(".top-left").x(m.x-e),this.findOne(".top-left").y(m.y-i)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(n.y());else if("top-right"===this._movingAnchorName){if(c){m=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};o=Math.sqrt(Math.pow(n.x()-m.x,2)+Math.pow(m.y-n.y(),2));u=this.findOne(".top-right").x()<m.x?-1:1,y=this.findOne(".top-right").y()>m.y?-1:1;e=o*this.cos*u,i=o*this.sin*y,this.findOne(".top-right").x(m.x+e),this.findOne(".top-right").y(m.y-i)}var p=n.position();this.findOne(".top-left").y(p.y),this.findOne(".bottom-right").x(p.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(n.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(n.x());else if("bottom-left"===this._movingAnchorName){if(c){m=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};o=Math.sqrt(Math.pow(m.x-n.x(),2)+Math.pow(n.y()-m.y,2));u=m.x<n.x()?-1:1,y=n.y()<m.y?-1:1;e=o*this.cos*u,i=o*this.sin*y,n.x(m.x-e),n.y(m.y+i)}p=n.position(),this.findOne(".top-left").x(p.x),this.findOne(".bottom-right").y(p.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(n.y());else if("bottom-right"===this._movingAnchorName){if(c){m=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};o=Math.sqrt(Math.pow(n.x()-m.x,2)+Math.pow(n.y()-m.y,2));u=this.findOne(".bottom-right").x()<m.x?-1:1,y=this.findOne(".bottom-right").y()<m.y?-1:1;e=o*this.cos*u,i=o*this.sin*y,this.findOne(".bottom-right").x(m.x+e),this.findOne(".bottom-right").y(m.y+i)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(f=this.centeredScaling()||t.altKey){var _=this.findOne(".top-left"),b=this.findOne(".bottom-right"),w=_.x(),A=_.y(),S=this.getWidth()-b.x(),N=this.getHeight()-b.y();b.move({x:-w,y:-A}),_.move({x:S,y:N})}var O=this.findOne(".top-left").getAbsolutePosition();e=O.x,i=O.y;var C=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),M=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:i,width:C,height:M,rotation:s.Konva.getAngle(this.rotation())},t)}else{var k=this._getNodeRect();e=n.x()-k.width/2,i=-n.y()+k.height/2;let o=Math.atan2(-i,e)+Math.PI/2;k.height<0&&(o-=Math.PI);const r=s.Konva.getAngle(this.rotation())+o,h=s.Konva.getAngle(this.rotationSnapTolerance()),a=v(k,x(this.rotationSnaps(),r,h)-k.rotation);this._fitNodesInto(a,t)}}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var e=this.getNode();this._fire("transformend",{evt:t,target:e}),e&&this._nodes.forEach(e=>{e._fire("transformend",{evt:t,target:e})}),this._movingAnchorName=null}}_fitNodesInto(e,i){var o=this._getNodeRect();if(t.Util._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(t.Util._inRange(e.height,2*-this.padding()-1,1))return void this.update();const n=this.flipEnabled();var r=new t.Transform;if(r.rotate(s.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=r.point({x:2*-this.padding(),y:0});if(e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,!n)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=r.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding(),!n)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=r.point({x:0,y:2*-this.padding()});if(e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!n)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=r.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!n)return void this.update()}if(this.boundBoxFunc()){const i=this.boundBoxFunc()(o,e);i?e=i:t.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const h=new t.Transform;h.translate(o.x,o.y),h.rotate(o.rotation),h.scale(o.width/1e7,o.height/1e7);const a=new t.Transform;a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(e.width/1e7,e.height/1e7);const d=a.multiply(h.invert());this._nodes.forEach(e=>{var o;const n=e.getParent().getAbsoluteTransform(),r=e.getTransform().copy();r.translate(e.offsetX(),e.offsetY());const s=new t.Transform;s.multiply(n.copy().invert()).multiply(d).multiply(n).multiply(r);const h=s.decompose();e.setAttrs(h),this._fire("transform",{evt:i,target:e}),e._fire("transform",{evt:i,target:e}),null===(o=e.getLayer())||void 0===o||o.batchDraw()}),this.rotation(t.Util._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var e,i=this._getNodeRect();this.rotation(t.Util._getRotation(i.rotation));var o=i.width,n=i.height,r=this.enabledAnchors(),s=this.resizeEnabled(),h=this.padding(),a=this.anchorSize();this.find("._anchor").forEach(t=>{t.setAttrs({width:a,height:a,offsetX:a/2,offsetY:a/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:a/2+h,offsetY:a/2+h,visible:s&&r.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:o/2,y:0,offsetY:a/2+h,visible:s&&r.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:o,y:0,offsetX:a/2-h,offsetY:a/2+h,visible:s&&r.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:n/2,offsetX:a/2+h,visible:s&&r.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:o,y:n/2,offsetX:a/2-h,visible:s&&r.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:n,offsetX:a/2+h,offsetY:a/2-h,visible:s&&r.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:o/2,y:n,offsetY:a/2-h,visible:s&&r.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:o,y:n,offsetX:a/2-h,offsetY:a/2-h,visible:s&&r.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:o/2,y:-this.rotateAnchorOffset()*t.Util._sign(n)-h,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:o,height:n,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.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 i.Node.prototype.toObject.call(this)}clone(t){return i.Node.prototype.clone.call(this,t)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function A(e){return e instanceof Array||t.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(e){-1===y.indexOf(e)&&t.Util.warn("Unknown anchor name: "+e+". Available names are: "+y.join(", "))}),e||[]}exports.Transformer=w,w.prototype.className="Transformer",(0,a._registerNode)(w),e.Factory.addGetterSetter(w,"enabledAnchors",y,A),e.Factory.addGetterSetter(w,"flipEnabled",!0,(0,h.getBooleanValidator)()),e.Factory.addGetterSetter(w,"resizeEnabled",!0),e.Factory.addGetterSetter(w,"anchorSize",10,(0,h.getNumberValidator)()),e.Factory.addGetterSetter(w,"rotateEnabled",!0),e.Factory.addGetterSetter(w,"rotationSnaps",[]),e.Factory.addGetterSetter(w,"rotateAnchorOffset",50,(0,h.getNumberValidator)()),e.Factory.addGetterSetter(w,"rotationSnapTolerance",5,(0,h.getNumberValidator)()),e.Factory.addGetterSetter(w,"borderEnabled",!0),e.Factory.addGetterSetter(w,"anchorStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(w,"anchorStrokeWidth",1,(0,h.getNumberValidator)()),e.Factory.addGetterSetter(w,"anchorFill","white"),e.Factory.addGetterSetter(w,"anchorCornerRadius",0,(0,h.getNumberValidator)()),e.Factory.addGetterSetter(w,"borderStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(w,"borderStrokeWidth",1,(0,h.getNumberValidator)()),e.Factory.addGetterSetter(w,"borderDash"),e.Factory.addGetterSetter(w,"keepRatio",!0),e.Factory.addGetterSetter(w,"shiftBehavior","default"),e.Factory.addGetterSetter(w,"centeredScaling",!1),e.Factory.addGetterSetter(w,"ignoreStroke",!1),e.Factory.addGetterSetter(w,"padding",0,(0,h.getNumberValidator)()),e.Factory.addGetterSetter(w,"node"),e.Factory.addGetterSetter(w,"nodes"),e.Factory.addGetterSetter(w,"boundBoxFunc"),e.Factory.addGetterSetter(w,"anchorDragBoundFunc"),e.Factory.addGetterSetter(w,"shouldOverdrawWholeArea",!1),e.Factory.addGetterSetter(w,"useSingleNodeRotation",!0),e.Factory.backCompat(w,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});
118
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Transformer=void 0;const t=require("../Util"),e=require("../Factory"),i=require("../Node"),o=require("../Shape"),n=require("./Rect"),r=require("../Group"),h=require("../Global"),s=require("../Validators"),a=require("../Global");var d="tr-konva",g=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(t=>t+`.${d}`).join(" "),c="nodesRect",l=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],f={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const m="ontouchstart"in h.Konva._global;function u(e,i){if("rotater"===e)return"crosshair";i+=t.Util.degToRad(f[e]||0);var o=(t.Util.radToDeg(i)%360+360)%360;return t.Util._inRange(o,337.5,360)||t.Util._inRange(o,0,22.5)?"ns-resize":t.Util._inRange(o,22.5,67.5)?"nesw-resize":t.Util._inRange(o,67.5,112.5)?"ew-resize":t.Util._inRange(o,112.5,157.5)?"nwse-resize":t.Util._inRange(o,157.5,202.5)?"ns-resize":t.Util._inRange(o,202.5,247.5)?"nesw-resize":t.Util._inRange(o,247.5,292.5)?"ew-resize":t.Util._inRange(o,292.5,337.5)?"nwse-resize":(t.Util.error("Transformer has unknown angle for cursor detection: "+o),"pointer")}var y=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],p=1e8;function _(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function b(t,e,i){const o=i.x+(t.x-i.x)*Math.cos(e)-(t.y-i.y)*Math.sin(e),n=i.y+(t.x-i.x)*Math.sin(e)+(t.y-i.y)*Math.cos(e);return Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:o,y:n})}function v(t,e){return b(t,e,_(t))}function x(t,e,i){let o=e;for(let n=0;n<t.length;n++){const r=h.Konva.getAngle(t[n]),s=Math.abs(r-e)%(2*Math.PI);Math.min(s,2*Math.PI-s)<i&&(o=r)}return o}class w extends r.Group{constructor(t){super(t),this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(g,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(e){return t.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return d+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const i=e.filter(e=>!e.isAncestorOf(this)||(t.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1));return this._nodes=e=i,1===e.length&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(t=>{const e=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},i=t._attrsAffectingSize.map(t=>t+"Change."+this._getEventNamespace()).join(" ");t.on(i,e),t.on(l.map(t=>t+`.${this._getEventNamespace()}`).join(" "),e),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,e),this._proxyDrag(t)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,i=>{e=t.getAbsolutePosition(),this.isDragging()||t===this.findOne(".back")||this.startDrag(i,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,i=>{if(!e)return;const o=t.getAbsolutePosition(),n=o.x-e.x,r=o.y-e.y;this.nodes().forEach(e=>{if(e===t)return;if(e.isDragging())return;const o=e.getAbsolutePosition();e.setAbsolutePosition({x:o.x+n,y:o.y+r}),e.startDrag(i)}),e=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(c),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(c,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),i){var o=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),n=t.getAbsoluteScale(i),r=t.getAbsolutePosition(i),s=o.x*n.x-t.offsetX()*n.x,a=o.y*n.y-t.offsetY()*n.y;const d=(h.Konva.getAngle(t.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return b({x:r.x+s*Math.cos(d)+a*Math.sin(-d),y:r.y+a*Math.cos(d)+s*Math.sin(d),width:o.width*n.x,height:o.height*n.y,rotation:d},-h.Konva.getAngle(e),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-p,y:-p,width:0,height:0,rotation:0};const e=[];this.nodes().map(t=>{const i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var o=[{x:i.x,y:i.y},{x:i.x+i.width,y:i.y},{x:i.x+i.width,y:i.y+i.height},{x:i.x,y:i.y+i.height}],n=t.getAbsoluteTransform();o.forEach(function(t){var i=n.point(t);e.push(i)})});const i=new t.Transform;var o,n,r,s;i.rotate(-h.Konva.getAngle(this.rotation())),e.forEach(function(t){var e=i.point(t);void 0===o&&(o=r=e.x,n=s=e.y),o=Math.min(o,e.x),n=Math.min(n,e.y),r=Math.max(r,e.x),s=Math.max(s,e.y)}),i.invert();const a=i.point({x:o,y:n});return{x:a.x,y:a.y,width:r-o,height:s-n,rotation:h.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(),y.forEach(function(t){this._createAnchor(t)}.bind(this)),this._createAnchor("rotater")}_createAnchor(t){var e=new n.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:m?10:"auto"}),i=this;e.on("mousedown touchstart",function(t){i._handleMouseDown(t)}),e.on("dragstart",t=>{e.stopDrag(),t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),e.on("mouseenter",()=>{var i=h.Konva.getAngle(this.rotation()),o=u(t,i);e.getStage().content&&(e.getStage().content.style.cursor=o),this._cursorChange=!0}),e.on("mouseout",()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(e)}_createBack(){var e=new o.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(e){var i=this.getParent(),o=i.padding();e.beginPath(),e.rect(-o,-o,this.width()+2*o,this.height()+2*o),e.moveTo(this.width()/2,-o),i.rotateEnabled()&&e.lineTo(this.width()/2,-i.rotateAnchorOffset()*t.Util._sign(this.height())-o),e.fillStrokeShape(this)},hitFunc:(t,e)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();t.beginPath(),t.rect(-i,-i,e.width()+2*i,e.height()+2*i),t.fillStrokeShape(e)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",t=>{t.cancelBubble=!0}),e.on("dragmove",t=>{t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),this.on("dragmove",t=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var e=this._getNodeRect(),i=e.width,o=e.height,n=Math.sqrt(Math.pow(i,2)+Math.pow(o,2));this.sin=Math.abs(o/n),this.cos=Math.abs(i/n),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var r=t.target.getAbsolutePosition(),h=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:h.x-r.x,y:h.y-r.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(e=>{e._fire("transformstart",{evt:t.evt,target:e})})}_handleMouseMove(t){var e,i,o,n=this.findOne("."+this._movingAnchorName),r=n.getStage();r.setPointersPositions(t);const s=r.getPointerPosition();let a={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const d=n.getAbsolutePosition();this.anchorDragBoundFunc()&&(a=this.anchorDragBoundFunc()(d,a,t)),n.setAbsolutePosition(a);const g=n.getAbsolutePosition();if(d.x!==g.x||d.y!==g.y)if("rotater"!==this._movingAnchorName){var c,l=this.shiftBehavior();c="inverted"===l?this.keepRatio()&&!t.shiftKey:"none"===l?this.keepRatio():this.keepRatio()||t.shiftKey;var f=this.centeredScaling()||t.altKey;if("top-left"===this._movingAnchorName){if(c){var m=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};o=Math.sqrt(Math.pow(m.x-n.x(),2)+Math.pow(m.y-n.y(),2));var u=this.findOne(".top-left").x()>m.x?-1:1,y=this.findOne(".top-left").y()>m.y?-1:1;e=o*this.cos*u,i=o*this.sin*y,this.findOne(".top-left").x(m.x-e),this.findOne(".top-left").y(m.y-i)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(n.y());else if("top-right"===this._movingAnchorName){if(c){m=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};o=Math.sqrt(Math.pow(n.x()-m.x,2)+Math.pow(m.y-n.y(),2));u=this.findOne(".top-right").x()<m.x?-1:1,y=this.findOne(".top-right").y()>m.y?-1:1;e=o*this.cos*u,i=o*this.sin*y,this.findOne(".top-right").x(m.x+e),this.findOne(".top-right").y(m.y-i)}var p=n.position();this.findOne(".top-left").y(p.y),this.findOne(".bottom-right").x(p.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(n.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(n.x());else if("bottom-left"===this._movingAnchorName){if(c){m=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};o=Math.sqrt(Math.pow(m.x-n.x(),2)+Math.pow(n.y()-m.y,2));u=m.x<n.x()?-1:1,y=n.y()<m.y?-1:1;e=o*this.cos*u,i=o*this.sin*y,n.x(m.x-e),n.y(m.y+i)}p=n.position(),this.findOne(".top-left").x(p.x),this.findOne(".bottom-right").y(p.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(n.y());else if("bottom-right"===this._movingAnchorName){if(c){m=f?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};o=Math.sqrt(Math.pow(n.x()-m.x,2)+Math.pow(n.y()-m.y,2));u=this.findOne(".bottom-right").x()<m.x?-1:1,y=this.findOne(".bottom-right").y()<m.y?-1:1;e=o*this.cos*u,i=o*this.sin*y,this.findOne(".bottom-right").x(m.x+e),this.findOne(".bottom-right").y(m.y+i)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(f=this.centeredScaling()||t.altKey){var _=this.findOne(".top-left"),b=this.findOne(".bottom-right"),w=_.x(),A=_.y(),S=this.getWidth()-b.x(),N=this.getHeight()-b.y();b.move({x:-w,y:-A}),_.move({x:S,y:N})}var O=this.findOne(".top-left").getAbsolutePosition();e=O.x,i=O.y;var C=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),M=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:i,width:C,height:M,rotation:h.Konva.getAngle(this.rotation())},t)}else{var k=this._getNodeRect();e=n.x()-k.width/2,i=-n.y()+k.height/2;let o=Math.atan2(-i,e)+Math.PI/2;k.height<0&&(o-=Math.PI);const r=h.Konva.getAngle(this.rotation())+o,s=h.Konva.getAngle(this.rotationSnapTolerance()),a=v(k,x(this.rotationSnaps(),r,s)-k.rotation);this._fitNodesInto(a,t)}}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var e=this.getNode();this._fire("transformend",{evt:t,target:e}),e&&this._nodes.forEach(e=>{e._fire("transformend",{evt:t,target:e})}),this._movingAnchorName=null}}_fitNodesInto(e,i){var o=this._getNodeRect();if(t.Util._inRange(e.width,2*-this.padding()-1,1))return void this.update();if(t.Util._inRange(e.height,2*-this.padding()-1,1))return void this.update();const n=this.flipEnabled();var r=new t.Transform;if(r.rotate(h.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const t=r.point({x:2*-this.padding(),y:0});if(e.x+=t.x,e.y+=t.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,!n)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const t=r.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.width+=2*this.padding(),!n)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const t=r.point({x:0,y:2*-this.padding()});if(e.x+=t.x,e.y+=t.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!n)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const t=r.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=t.x,this._anchorDragOffset.y-=t.y,e.height+=2*this.padding(),!n)return void this.update()}if(this.boundBoxFunc()){const i=this.boundBoxFunc()(o,e);i?e=i:t.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=new t.Transform;s.translate(o.x,o.y),s.rotate(o.rotation),s.scale(o.width/1e7,o.height/1e7);const a=new t.Transform;a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(e.width/1e7,e.height/1e7);const d=a.multiply(s.invert());this._nodes.forEach(e=>{var o;const n=e.getParent().getAbsoluteTransform(),r=e.getTransform().copy();r.translate(e.offsetX(),e.offsetY());const h=new t.Transform;h.multiply(n.copy().invert()).multiply(d).multiply(n).multiply(r);const s=h.decompose();e.setAttrs(s),this._fire("transform",{evt:i,target:e}),e._fire("transform",{evt:i,target:e}),null===(o=e.getLayer())||void 0===o||o.batchDraw()}),this.rotation(t.Util._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var e,i=this._getNodeRect();this.rotation(t.Util._getRotation(i.rotation));var o=i.width,n=i.height,r=this.enabledAnchors(),h=this.resizeEnabled(),s=this.padding(),a=this.anchorSize();const d=this.find("._anchor");d.forEach(t=>{t.setAttrs({width:a,height:a,offsetX:a/2,offsetY:a/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:a/2+s,offsetY:a/2+s,visible:h&&r.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:o/2,y:0,offsetY:a/2+s,visible:h&&r.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:o,y:0,offsetX:a/2-s,offsetY:a/2+s,visible:h&&r.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:n/2,offsetX:a/2+s,visible:h&&r.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:o,y:n/2,offsetX:a/2-s,visible:h&&r.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:n,offsetX:a/2+s,offsetY:a/2-s,visible:h&&r.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:o/2,y:n,offsetY:a/2-s,visible:h&&r.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:o,y:n,offsetX:a/2-s,offsetY:a/2-s,visible:h&&r.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:o/2,y:-this.rotateAnchorOffset()*t.Util._sign(n)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:o,height:n,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const g=this.anchorStyleFunc();g&&d.forEach(t=>{g(t)}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),r.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return i.Node.prototype.toObject.call(this)}clone(t){return i.Node.prototype.clone.call(this,t)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function A(e){return e instanceof Array||t.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(e){-1===y.indexOf(e)&&t.Util.warn("Unknown anchor name: "+e+". Available names are: "+y.join(", "))}),e||[]}exports.Transformer=w,w.prototype.className="Transformer",(0,a._registerNode)(w),e.Factory.addGetterSetter(w,"enabledAnchors",y,A),e.Factory.addGetterSetter(w,"flipEnabled",!0,(0,s.getBooleanValidator)()),e.Factory.addGetterSetter(w,"resizeEnabled",!0),e.Factory.addGetterSetter(w,"anchorSize",10,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(w,"rotateEnabled",!0),e.Factory.addGetterSetter(w,"rotationSnaps",[]),e.Factory.addGetterSetter(w,"rotateAnchorOffset",50,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(w,"rotationSnapTolerance",5,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(w,"borderEnabled",!0),e.Factory.addGetterSetter(w,"anchorStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(w,"anchorStrokeWidth",1,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(w,"anchorFill","white"),e.Factory.addGetterSetter(w,"anchorCornerRadius",0,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(w,"borderStroke","rgb(0, 161, 255)"),e.Factory.addGetterSetter(w,"borderStrokeWidth",1,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(w,"borderDash"),e.Factory.addGetterSetter(w,"keepRatio",!0),e.Factory.addGetterSetter(w,"shiftBehavior","default"),e.Factory.addGetterSetter(w,"centeredScaling",!1),e.Factory.addGetterSetter(w,"ignoreStroke",!1),e.Factory.addGetterSetter(w,"padding",0,(0,s.getNumberValidator)()),e.Factory.addGetterSetter(w,"node"),e.Factory.addGetterSetter(w,"nodes"),e.Factory.addGetterSetter(w,"boundBoxFunc"),e.Factory.addGetterSetter(w,"anchorDragBoundFunc"),e.Factory.addGetterSetter(w,"anchorStyleFunc"),e.Factory.addGetterSetter(w,"shouldOverdrawWholeArea",!1),e.Factory.addGetterSetter(w,"useSingleNodeRotation",!0),e.Factory.backCompat(w,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});
119
119
  },{"../Util":"XIcS","../Factory":"cgGB","../Node":"pBWF","../Shape":"JWag","./Rect":"Fb9z","../Group":"SoFy","../Global":"bIDB","../Validators":"tgRR"}],"EbF6":[function(require,module,exports) {
120
120
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Wedge=void 0;const e=require("../Factory"),t=require("../Shape"),r=require("../Global"),a=require("../Validators"),i=require("../Global");class s extends t.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,r.Konva.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}exports.Wedge=s,s.prototype.className="Wedge",s.prototype._centroid=!0,s.prototype._attrsAffectingSize=["radius"],(0,i._registerNode)(s),e.Factory.addGetterSetter(s,"radius",0,(0,a.getNumberValidator)()),e.Factory.addGetterSetter(s,"angle",0,(0,a.getNumberValidator)()),e.Factory.addGetterSetter(s,"clockwise",!1),e.Factory.backCompat(s,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});
121
121
  },{"../Factory":"cgGB","../Shape":"JWag","../Global":"bIDB","../Validators":"tgRR"}],"LYZO":[function(require,module,exports) {
@@ -191,9 +191,9 @@ var e=require("react");module.exports=function(r,n,t){const u=e.useRef("loading"
191
191
  },{"use-image":"MJM3"}],"jXQU":[function(require,module,exports) {
192
192
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={Portal:!0,useImage:!0};Object.defineProperty(exports,"Portal",{enumerable:!0,get:function(){return t.Portal}}),Object.defineProperty(exports,"useImage",{enumerable:!0,get:function(){return o.useImage}});var r=require("./html");Object.keys(r).forEach(function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(e,t)||t in exports&&exports[t]===r[t]||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return r[t]}}))});var t=require("./portal"),o=require("./use-image");
193
193
  },{"./html":"XdpJ","./portal":"beYE","./use-image":"Io9F"}],"Qid2":[function(require,module,exports) {
194
- "use strict";function e(e,a){return Object.keys(e.values).forEach(r=>e.values[r]=e.values[r]&&parseFloat(e.values[r].toFixed(a))),e}function a(e,r,s){const t=r-1,l=s[u(t,s.length)];return"Z"!==l.marker?l:a(e,t,s)}function r(e,a,s){const t=a+1,l=s[u(t,s.length)];return"Z"===l.marker?r(e,t,s):l}function s(e,a,r){let s=r[a-1]||{values:{x:0,y:0}};if(e.marker===e.marker.toLowerCase())switch(e.marker=e.marker.toUpperCase(),e.marker){case"M":e.values.x+=s.values.x,e.values.y+=s.values.y;break;case"L":case"A":e.values.x+=s.values.x,e.values.y+=s.values.y;break;case"H":e.marker="L",e.values.x+=s.values.x,e.values.y=s.values.y;break;case"V":e.marker="L",e.values.x=s.values.x,e.values.y+=s.values.y;break;case"C":e.values.x+=s.values.x,e.values.y+=s.values.y,e.values.x1+=s.values.x,e.values.y1+=s.values.y,e.values.x2+=s.values.x,e.values.y2+=s.values.y;break;case"S":e.values.x+=s.values.x,e.values.y+=s.values.y,e.values.x2+=s.values.x,e.values.y2+=s.values.y;break;case"Q":e.values.x+=s.values.x,e.values.y+=s.values.y,e.values.x1+=s.values.x,e.values.y1+=s.values.y;break;case"T":e.values.x+=s.values.x,e.values.y+=s.values.y}else if(e.marker===e.marker.toUpperCase())switch(e.marker){case"H":e.marker="L",e.values.y=s.values.y;break;case"V":e.marker="L",e.values.x=s.values.x}if("Z"===e.marker){let s=function e(a,r){return"M"===a[r].marker?a[r]:e(a,r-1)}(r,a);e.values.x=s.values.x,e.values.y=s.values.y}return e}function t(e,a){const r=[];switch(e.toUpperCase()){case"M":for(let s=0;s<a.length;s+=2){let t;t=e===e.toUpperCase()?0===s?"M":"L":0===s?"m":"l",r.push({marker:t,values:{x:a[s],y:a[s+1]}})}break;case"L":for(let s=0;s<a.length;s+=2)r.push({marker:e,values:{x:a[s],y:a[s+1]}});break;case"H":for(let s=0;s<a.length;s++)r.push({marker:e,values:{x:a[s],y:0}});break;case"V":for(let s=0;s<a.length;s++)r.push({marker:e,values:{x:0,y:a[s]}});break;case"C":for(let s=0;s<a.length;s+=6)r.push({marker:e,values:{x1:a[s],y1:a[s+1],x2:a[s+2],y2:a[s+3],x:a[s+4],y:a[s+5]}});break;case"S":for(let s=0;s<a.length;s+=4)r.push({marker:e,values:{x2:a[s],y2:a[s+1],x:a[s+2],y:a[s+3]}});break;case"Q":for(let s=0;s<a.length;s+=4)r.push({marker:e,values:{x1:a[s],y1:a[s+1],x:a[s+2],y:a[s+3]}});break;case"T":for(let s=0;s<a.length;s+=2)r.push({marker:e,values:{x:a[s],y:a[s+1]}});break;case"A":for(let s=0;s<a.length;s+=7)r.push({marker:e,values:{radiusX:a[s],radiusY:a[s+1],rotation:a[s+2],largeArc:a[s+3],sweep:a[s+4],x:a[s+5],y:a[s+6]}});break;case"Z":r.push({marker:e,values:{x:0,y:0}})}return r}function u(e,a){return(e%a+a)%a}function l(e,a,r){if(0!==a&&"L"===e.marker){let s=r[a-1];["x","y"].every(a=>0===Math.round(Math.abs(s.values[a]-e.values[a])))&&(e.overlap=!0)}return e}function n(e,a){const r=["x","y"].every(r=>0===Math.round(Math.abs(e[a].values[r]-e[0].values[r])));"L"===e[a].marker&&r&&(e[a].overlap=!0,n(e,a-1)),"Z"===e[a].marker&&n(e,a-1)}function o(e,a,r){const s=x(e.values,r.values),t=x(a.values,e.values);return Math.min(t,s)}function v(e,a){return Math.atan2(a.x-e.x,a.y-e.y)}function x(e,a){const r=e.x-a.x,s=e.y-a.y;return Math.sqrt(Math.pow(r,2)+Math.pow(s,2))}function c(e,a){return Math.sin(e)*a}function p(e,a){return Math.cos(e)*a}function y(e,a){const r=a/Math.tan(e);return r===1/0||r===-1/0||isNaN(r)?a:r}function h(e,a){return a*Math.tan(e)}function i(e,a){let r,s=0,t=e*(180/Math.PI);return t<0&&t>=-180||t>180&&t<360?r=y(e/2,-a):(s=1,(r=y(e/2,a))===1/0&&(r=a)),{offset:r,sweepFlag:s}}function k(e,a){const r=e.length-1,s=[],t=[],u=[],l=1-a,n=function(e,a){const r=[];for(let s=0;s<e.length;s++)r.push(a*e[s]);return r},o=function(e,a){const r=[];for(let s=0;s<Math.min(e.length,a.length);s++)r.push(e[s]+a[s]);return r};for(let v=0;v<=r;v++)e[v]="object"==typeof e[v]?e[v]:[e[v]],s.push([e[v]]);for(let v=1;v<=r;v++)for(let e=0;e<=r-v;e++)s[e].push(o(n(s[e][v-1],l),n(s[e+1][v-1],a)));for(let v=0;v<=r;v++)t.push(s[0][v]),u.push(s[v][r-v]);return[t,u]}function f(e){const a=["radiusX","radiusY","rotation","largeArc","sweep","x1","y1","x2","y2","x","y"];return e.map(e=>{let r="";if("Z"!==e.marker){const s=Object.keys(e.values);r=a.filter(e=>-1!==s.indexOf(e)).map(a=>e.values[a]).join()}return`${e.marker}${r}`}).join("").trim()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.bsplit=k,exports.commandsToSvgPath=f,exports.convertToAbsolute=s,exports.getAdjacentLength=p,exports.getAngle=v,exports.getDistance=x,exports.getNextNoZ=r,exports.getOffset=i,exports.getOppositeLength=c,exports.getPreviousNoZ=a,exports.getTangentLength=y,exports.getTangentNoHyp=h,exports.markOverlapped=l,exports.mod=u,exports.newCommands=t,exports.reverseMarkOverlapped=n,exports.roundValues=e,exports.shortestSide=o;
194
+ "use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function r(e,r){return Object.keys(e.values).forEach(function(a){return e.values[a]=e.values[a]&&parseFloat(e.values[a].toFixed(r))}),e}function a(e,r,s){var t=r-1,u=s[n(t,s.length)];return"Z"!==u.marker?u:a(e,t,s)}function s(e,r,a){var t=r+1,u=a[n(t,a.length)];return"Z"===u.marker?s(e,t,a):u}function t(e,r,a){var s=a[r-1]||{values:{x:0,y:0}};if(e.marker===e.marker.toLowerCase())switch(e.marker=e.marker.toUpperCase(),e.marker){case"M":e.values.x+=s.values.x,e.values.y+=s.values.y;break;case"L":case"A":e.values.x+=s.values.x,e.values.y+=s.values.y;break;case"H":e.marker="L",e.values.x+=s.values.x,e.values.y=s.values.y;break;case"V":e.marker="L",e.values.x=s.values.x,e.values.y+=s.values.y;break;case"C":e.values.x+=s.values.x,e.values.y+=s.values.y,e.values.x1+=s.values.x,e.values.y1+=s.values.y,e.values.x2+=s.values.x,e.values.y2+=s.values.y;break;case"S":e.values.x+=s.values.x,e.values.y+=s.values.y,e.values.x2+=s.values.x,e.values.y2+=s.values.y;break;case"Q":e.values.x+=s.values.x,e.values.y+=s.values.y,e.values.x1+=s.values.x,e.values.y1+=s.values.y;break;case"T":e.values.x+=s.values.x,e.values.y+=s.values.y}else if(e.marker===e.marker.toUpperCase())switch(e.marker){case"H":e.marker="L",e.values.y=s.values.y;break;case"V":e.marker="L",e.values.x=s.values.x}if("Z"===e.marker){var t=function e(r,a){return"M"===r[a].marker?r[a]:e(r,a-1)}(a,r);e.values.x=t.values.x,e.values.y=t.values.y}return e}function u(e,r){var a=[];switch(e.toUpperCase()){case"M":for(var s=0;s<r.length;s+=2){var t=void 0;t=e===e.toUpperCase()?0===s?"M":"L":0===s?"m":"l",a.push({marker:t,values:{x:r[s],y:r[s+1]}})}break;case"L":for(var u=0;u<r.length;u+=2)a.push({marker:e,values:{x:r[u],y:r[u+1]}});break;case"H":for(var n=0;n<r.length;n++)a.push({marker:e,values:{x:r[n],y:0}});break;case"V":for(var o=0;o<r.length;o++)a.push({marker:e,values:{x:0,y:r[o]}});break;case"C":for(var v=0;v<r.length;v+=6)a.push({marker:e,values:{x1:r[v],y1:r[v+1],x2:r[v+2],y2:r[v+3],x:r[v+4],y:r[v+5]}});break;case"S":for(var l=0;l<r.length;l+=4)a.push({marker:e,values:{x2:r[l],y2:r[l+1],x:r[l+2],y:r[l+3]}});break;case"Q":for(var x=0;x<r.length;x+=4)a.push({marker:e,values:{x1:r[x],y1:r[x+1],x:r[x+2],y:r[x+3]}});break;case"T":for(var c=0;c<r.length;c+=2)a.push({marker:e,values:{x:r[c],y:r[c+1]}});break;case"A":for(var y=0;y<r.length;y+=7)a.push({marker:e,values:{radiusX:r[y],radiusY:r[y+1],rotation:r[y+2],largeArc:r[y+3],sweep:r[y+4],x:r[y+5],y:r[y+6]}});break;case"Z":a.push({marker:e,values:{x:0,y:0}})}return a}function n(e,r){return(e%r+r)%r}function o(e,r,a){if(0!==r&&"L"===e.marker){var s=a[r-1];["x","y"].every(function(r){return 0===Math.round(Math.abs(s.values[r]-e.values[r]))})&&(e.overlap=!0)}return e}function v(e,r){var a=["x","y"].every(function(a){return 0===Math.round(Math.abs(e[r].values[a]-e[0].values[a]))});"L"===e[r].marker&&a&&(e[r].overlap=!0,v(e,r-1)),"Z"===e[r].marker&&v(e,r-1)}function l(e,r,a){var s=c(e.values,a.values),t=c(r.values,e.values);return Math.min(t,s)}function x(e,r){return Math.atan2(r.x-e.x,r.y-e.y)}function c(e,r){var a=e.x-r.x,s=e.y-r.y;return Math.sqrt(Math.pow(a,2)+Math.pow(s,2))}function y(e,r){return Math.sin(e)*r}function p(e,r){return Math.cos(e)*r}function f(e,r){var a=r/Math.tan(e);return a===1/0||a===-1/0||isNaN(a)?r:a}function i(e,r){return r*Math.tan(e)}function h(e,r){var a,s=0,t=e*(180/Math.PI);return t<0&&t>=-180||t>180&&t<360?a=f(e/2,-r):(s=1,(a=f(e/2,r))===1/0&&(a=r)),{offset:a,sweepFlag:s}}function k(r,a){for(var s=r.length-1,t=[],u=[],n=[],o=1-a,v=function(e,r){for(var a=[],s=0;s<e.length;s++)a.push(r*e[s]);return a},l=function(e,r){for(var a=[],s=0;s<Math.min(e.length,r.length);s++)a.push(e[s]+r[s]);return a},x=0;x<=s;x++)r[x]="object"==e(r[x])?r[x]:[r[x]],t.push([r[x]]);for(var c=1;c<=s;c++)for(var y=0;y<=s-c;y++)t[y].push(l(v(t[y][c-1],o),v(t[y+1][c-1],a)));for(var p=0;p<=s;p++)u.push(t[0][p]),n.push(t[p][s-p]);return[u,n]}function m(e){var r=["radiusX","radiusY","rotation","largeArc","sweep","x1","y1","x2","y2","x","y"];return e.map(function(e){var a="";if("Z"!==e.marker){var s=Object.keys(e.values);a=r.filter(function(e){return-1!==s.indexOf(e)}).map(function(r){return e.values[r]}).join()}return`${e.marker}${a}`}).join("").trim()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.bsplit=k,exports.commandsToSvgPath=m,exports.convertToAbsolute=t,exports.getAdjacentLength=p,exports.getAngle=x,exports.getDistance=c,exports.getNextNoZ=s,exports.getOffset=h,exports.getOppositeLength=y,exports.getPreviousNoZ=a,exports.getTangentLength=f,exports.getTangentNoHyp=i,exports.markOverlapped=o,exports.mod=n,exports.newCommands=u,exports.reverseMarkOverlapped=v,exports.roundValues=r,exports.shortestSide=l;
195
195
  },{}],"NKfw":[function(require,module,exports) {
196
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.parsePath=a,exports.roundCommands=r,exports.roundCorners=t;var e=require("./utils.js");function a(a){const r=/-?[0-9]*\.?\d+/g;return[...a.matchAll(/[MmLlSsQqLlHhVvCcSsQqTtAaZz]/g)].map(e=>({marker:e[0],index:e.index})).reduceRight((e,r)=>{const t=a.substring(r.index,e.length?e[e.length-1].index:a.length);return e.concat([{marker:r.marker,index:r.index,chunk:t.length>0?t.substr(1,t.length-1):t}])},[]).reverse().flatMap(a=>{const t=a.chunk.match(r),s=t?t.map(parseFloat):[];return(0,e.newCommands)(a.marker,s)}).map(e.convertToAbsolute)}function r(a,r,t){let s=[],n=[];return t&&a.forEach(a=>(0,e.roundValues)(a,t)),a.forEach(e=>{"M"===e.marker&&s.push([]),s[s.length-1].push(e)}),s.forEach(a=>{a.map(e.markOverlapped),(0,e.reverseMarkOverlapped)(a,a.length-1);const t="Z"==a[a.length-1].marker;a.filter(e=>!e.overlap).map((a,s,o)=>{const l=(0,e.getPreviousNoZ)(a,s,o),u=(0,e.getNextNoZ)(a,s,o),c=(0,e.getAngle)(a.values,l.values),h=(0,e.getAngle)(a.values,u.values),p=h-c,m=p*(180/Math.PI),g=(0,e.shortestSide)(a,l,u),i=Math.abs((0,e.getTangentNoHyp)(p/2,g/2)),d=Math.min(r,i),v=(0,e.getOffset)(p,d),k=v.offset,x=v.sweepFlag,f=(0==s||s==o.length-1)&&!t;switch(a.marker){case"M":case"L":const r=[a.values.x+(0,e.getOppositeLength)(c,k),a.values.y+(0,e.getAdjacentLength)(c,k)],t=[a.values.x+(0,e.getOppositeLength)(h,k),a.values.y+(0,e.getAdjacentLength)(h,k)];f?n.push({marker:a.marker,values:a.values}):n.push({marker:a.marker,values:{x:parseFloat(r[0].toFixed(3)),y:parseFloat(r[1].toFixed(3))}}),f||"L"!==u.marker&&"M"!==u.marker||n.push({marker:"A",radius:d,values:{radiusX:d,radiusY:d,rotation:m,largeArc:0,sweep:x,x:parseFloat(t[0].toFixed(3)),y:parseFloat(t[1].toFixed(3))}});break;case"C":case"S":case"Q":case"T":case"A":case"Z":n.push({marker:a.marker,values:a.values})}})}),{path:(0,e.commandsToSvgPath)(n),commands:n}}function t(e,t,s){return r([...a(e)],t,s)}
196
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.parsePath=u,exports.roundCommands=l,exports.roundCorners=i;var e=require("./utils.js");function r(e){return o(e)||n(e)||a(e)||t()}function t(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e,r){if(e){if("string"==typeof e)return s(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?s(e,r):void 0}}function n(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function o(e){if(Array.isArray(e))return s(e)}function s(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}function u(t){var a=/-?[0-9]*\.?\d+/g;return r(t.matchAll(/[MmLlSsQqLlHhVvCcSsQqTtAaZz]/g)).map(function(e){return{marker:e[0],index:e.index}}).reduceRight(function(e,r){var a=t.substring(r.index,e.length?e[e.length-1].index:t.length);return e.concat([{marker:r.marker,index:r.index,chunk:a.length>0?a.substr(1,a.length-1):a}])},[]).reverse().flatMap(function(r){var t=r.chunk.match(a),n=t?t.map(parseFloat):[];return(0,e.newCommands)(r.marker,n)}).map(e.convertToAbsolute)}function l(r,t,a){var n=[],o=[];return a&&r.forEach(function(r){return(0,e.roundValues)(r,a)}),r.forEach(function(e){"M"===e.marker&&n.push([]),n[n.length-1].push(e)}),n.forEach(function(r){r.map(e.markOverlapped),(0,e.reverseMarkOverlapped)(r,r.length-1);var a="Z"==r[r.length-1].marker;r.filter(function(e){return!e.overlap}).map(function(r,n,s){var u=(0,e.getPreviousNoZ)(r,n,s),l=(0,e.getNextNoZ)(r,n,s),i=(0,e.getAngle)(r.values,u.values),c=(0,e.getAngle)(r.values,l.values),m=c-i,p=m*(180/Math.PI),h=(0,e.shortestSide)(r,u,l),g=Math.abs((0,e.getTangentNoHyp)(m/2,h/2)),d=Math.min(t,g),f=(0,e.getOffset)(m,d),v=f.offset,k=f.sweepFlag,y=(0==n||n==s.length-1)&&!a;switch(r.marker){case"M":case"L":var x=[r.values.x+(0,e.getOppositeLength)(i,v),r.values.y+(0,e.getAdjacentLength)(i,v)],A=[r.values.x+(0,e.getOppositeLength)(c,v),r.values.y+(0,e.getAdjacentLength)(c,v)];y?o.push({marker:r.marker,values:r.values}):o.push({marker:r.marker,values:{x:parseFloat(x[0].toFixed(3)),y:parseFloat(x[1].toFixed(3))}}),y||"L"!==l.marker&&"M"!==l.marker||o.push({marker:"A",radius:d,values:{radiusX:d,radiusY:d,rotation:p,largeArc:0,sweep:k,x:parseFloat(A[0].toFixed(3)),y:parseFloat(A[1].toFixed(3))}});break;case"C":case"S":case"Q":case"T":case"A":case"Z":o.push({marker:r.marker,values:r.values})}})}),{path:(0,e.commandsToSvgPath)(o),commands:o}}function i(e,t,a){return l(r(u(e)),t,a)}
197
197
  },{"./utils.js":"Qid2"}],"N3c2":[function(require,module,exports) {
198
198
  "use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFadeIn=exports.isAnimationUsed=exports.toggleFadeInAnimation=void 0;const t=e(require("react")),r=e(require("konva"));let n=!1;const o=(e=!n)=>{n=e};exports.toggleFadeInAnimation=o;const u=()=>n;function s(e,o){const u=t.default.useRef();t.default.useLayoutEffect(()=>{u.current&&u.current.destroy()},[o]),t.default.useLayoutEffect(()=>{if(!n)return;const t=e.current.opacity();return t?(e.current.opacity(0),u.current=new r.default.Tween({node:e.current,opacity:t,onFinish:()=>{var e;null===(e=u.current)||void 0===e||e.destroy()}}),u.current.play(),()=>{var e;null===(e=u.current)||void 0===e||e.destroy()}):void 0},[])}exports.isAnimationUsed=u,exports.useFadeIn=s;
199
199
  },{"react":"HdMw","konva":"aTGn"}],"bN4e":[function(require,module,exports) {
@@ -215,7 +215,7 @@ var t;(t=t||{}).stringify=function(){var t={"visit_linear-gradient":function(i){
215
215
  },{"react":"HdMw","mobx-react-lite":"ZfSi","react-konva":"Sgug"}],"aH85":[function(require,module,exports) {
216
216
  "use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.useMobile=exports.isMobile=exports.MOBILE_BREAKPOINT=void 0;const t=e(require("react"));exports.MOBILE_BREAKPOINT=500;const s=()=>window.innerWidth<=exports.MOBILE_BREAKPOINT;exports.isMobile=s;const o=()=>{const[e,s]=t.default.useState((0,exports.isMobile)());return t.default.useEffect(()=>{const e=()=>{s((0,exports.isMobile)())};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),e};exports.useMobile=o;
217
217
  },{"react":"HdMw"}],"Fpgh":[function(require,module,exports) {
218
- "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var n={};if(null!=r)for(var i in r)"default"!==i&&Object.prototype.hasOwnProperty.call(r,i)&&e(n,r,i);return t(n,r),n},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.TextElement=exports.useTextColor=exports.usePrevious=exports.getLineHeight=exports.useFontLoader=exports.getDir=exports.isRTLText=void 0;const i=n(require("react")),o=require("mobx-react-lite"),a=require("react-konva"),l=require("react-konva-utils"),s=require("mobx"),d=n(require("konva")),u=require("svg-round-corners"),c=require("../utils/loader"),f=require("../utils/fonts"),h=require("../utils/flags"),g=require("../utils/text"),p=r(require("../utils/gradient")),x=require("./apply-filters"),y=require("./use-fadein"),m=require("./highlighter"),w=require("../utils/screen"),v=document.createElement("style");v.type="text/css",document.head.appendChild(v);const b={border:"none",padding:"0px",overflow:"hidden",background:"none",outline:"none",resize:"none",overflowWrap:"break-word",whiteSpace:"pre-wrap",userSelect:"text",wordBreak:"normal"};function S(e){var t="֑-߿‏‫‮יִ-﷽ﹰ-ﻼ";return new RegExp("^[^"+t+"]*?["+t+"]").test(e)}function E(e){e=e.replace(/\s/g,"");let t=0;for(var r=0;r<e.length;r++)S(e[r])&&(t+=1);return t>e.length/2}function M(e){return E(e)?"rtl":"ltr"}exports.isRTLText=E,exports.getDir=M;const T=(0,o.observer)(({textNodeRef:e,element:t,onBlur:r,selectAll:n,cursorPosition:o})=>{const[a,s]=i.default.useState(b),d=e.current;i.default.useLayoutEffect(()=>{const e={};e.width=d.width()-2*d.padding()+"px",e.height=d.height()-2*d.padding()+10+"px",e.fontSize=d.fontSize()+"px",e.lineHeight=d.lineHeight()+.01,e.fontFamily=d.fontFamily(),e.textAlign=d.align(),e.color=d.fill(),e.fontWeight=t.fontWeight,e.fontStyle=t.fontStyle,e.letterSpacing=t.letterSpacing+"em";const r=`\n .polotno-input::placeholder {\n color: ${a.color};\n opacity: 0.6;\n }\n `;v.innerHTML="",v.appendChild(document.createTextNode(r)),JSON.stringify(e)!==JSON.stringify(a)&&s(e)});const u=i.default.useRef(null);i.default.useEffect(()=>{const e=setTimeout(()=>{var e;const t=u.current;if(!t)return;null===(e=u.current)||void 0===e||e.focus();const r=o||t.value.length;t.selectionStart=t.selectionEnd=r,n&&(null==t||t.select(),document.execCommand("selectAll",!1,null))});return()=>{clearTimeout(e)}},[]);let c=0;const f=d.textArr.length*d.lineHeight()*d.fontSize();"middle"===t.verticalAlign&&(c=(t.height-f)/2),"bottom"===t.verticalAlign&&(c=t.height-f);const h=(0,g.removeTags)(t.text);return i.default.createElement(l.Html,null,i.default.createElement("textarea",{className:"polotno-input",ref:u,dir:M(h),style:Object.assign(Object.assign(Object.assign({},b),a),{paddingTop:c+"px"}),value:h,onChange:e=>{t.set({text:e.target.value})},placeholder:t.placeholder,onBlur:r}))}),z=e=>{const[t,r]=i.default.useState(!1),n=i.default.useRef(!1);return i.default.useEffect(()=>{var t=!0;return setTimeout(()=>{t&&(e._editModeEnabled&&(n.current=!0),r(!0),setTimeout(()=>{n.current=!1},50))},50),()=>{t=!1}},[]),{editorEnabled:t&&e._editModeEnabled,selectAll:n.current}},L=(e,t)=>{const[r,n]=i.default.useReducer(e=>e+1,0),o=i.default.useRef(!1);return o.current=!!(0,f.isFontLoaded)(t),i.default.useLayoutEffect(()=>{if(o.current)return;let r=!0;return(async()=>{o.current=!1,n();const i=(0,c.incrementLoader)(`text ${t}`);await e.loadFont(t),d.default.Util.requestAnimFrame(i),r&&(o.current=!0,n())})(),()=>{r=!1}},[t]),[o.current]};exports.useFontLoader=L;const O=({fontLoaded:e,fontFamily:t,fontSize:r,lineHeight:n})=>i.default.useMemo(()=>{if("number"==typeof n)return n;const e=document.createElement("div");e.style.fontFamily=t,e.style.fontSize=r+"px",e.style.lineHeight=n,e.innerText="Test text",document.body.appendChild(e);const i=e.offsetHeight;return document.body.removeChild(e),i/r},[e,t,r,n]);function k(e){var t=e.getAbsoluteTransform().copy();t.invert();var r=e.getStage().getPointerPosition();return t.point(r)}function A(e){var t;const r=e.target,n=k(r),i=r.textArr,o=Math.floor(n.y/(r.fontSize()*r.lineHeight())),a=i.slice(0,o).reduce((e,t)=>e+t.text.length,o),l=null!==(t=i[o])&&void 0!==t?t:i[0];let s=0;return"right"===r.align()?s=r.width()-l.width:"center"===r.align()&&(s=r.width()/2-l.width/2),a+Math.round((n.x-s)/l.width*l.text.length)}function P(e){const t=i.default.useRef(e),r=i.default.useRef(e);return i.default.useMemo(()=>{r.current=t.current,t.current=e},[e]),r.current}function R(e,t){const r=e.getAttrs(),n=(0,g.removeTags)(t.text);let i=t.fontSize;const o=Math.round(2*t.fontSize)-1;for(let a=1;a<o;a++){const r=t.height&&e.height()>t.height,o=n.split("\n").join(" ").split(" ");let a=e.textArr.map(e=>e.text).join(";");const l=o.find(e=>!a.includes(e)||(a=a.replace(e,""),!1));if(!r&&!l)break;i-=.5,e.fontSize(i)}return e.fontSize(r.fontSize),i}function $({lines:e,lineHeight:t,width:r,align:n="left",padding:i=0,cornerRadius:o=0}){var a;e.forEach((e,t)=>{e.cx=r/2,"right"===n?e.cx=r-e.width/2:"left"===n&&(e.cx=e.width/2),"justify"!==n||e.lastInParagraph||(e.width=r),"justify"===n&&(e.cx=e.width/2)});let l=`M ${null===(a=e[0])||void 0===a?void 0:a.cx} ${-i}`;e.forEach((r,n)=>{const{cx:o}=r,a=e[n-1];a&&a.width>r.width?l+=` L ${o+r.width/2+i} ${n*t+i}`:l+=` L ${o+r.width/2+i} ${n*t-i}`;const s=e[n+1];s&&s.width>r.width?l+=` L ${o+r.width/2+i} ${(n+1)*t-i}`:l+=` L ${o+r.width/2+i} ${(n+1)*t+i}`});for(var s=e.length-1;s>=0;s--){const r=e[s],{cx:n}=r,o=e[s+1];o&&o.width>r.width?l+=` L ${n-r.width/2-i} ${(s+1)*t-i}`:l+=` L ${n-r.width/2-i} ${(s+1)*t+i}`;const a=e[s-1];a&&a.width>r.width?l+=` L ${n-r.width/2-i} ${s*t+i}`:l+=` L ${n-r.width/2-i} ${s*t-i}`}l+=" Z";const d=(0,u.parsePath)(l);return(0,u.roundCommands)(d,o).path}exports.getLineHeight=O,exports.usePrevious=P;const F=e=>i.default.useMemo(()=>{if(!p.isGradient(e.fill))return{fill:e.fill};const{stops:t,rotation:r}=p.parseColor(e.fill),n={x:e.width/2,y:e.height/2},i=Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)),o=d.default.Util.degToRad(r)-Math.PI/2,a=[];return t.forEach(({offset:e,color:t})=>{a.push(e,t)}),{fillLinearGradientStartPointX:n.x-i*Math.cos(o),fillLinearGradientStartPointY:n.y-i*Math.sin(o),fillLinearGradientColorStops:a,fillLinearGradientEndPointX:n.x+i*Math.cos(o),fillLinearGradientEndPointY:n.y+i*Math.sin(o),fill:t[1].color,fillPriority:"linear-gradient"}},[e.fill]);exports.useTextColor=F,exports.TextElement=(0,o.observer)(({element:e,store:t})=>{const r=i.default.useRef(null),n=i.default.useRef(null),{editorEnabled:o,selectAll:l}=z(e),[d,u]=i.default.useState(!1),[c,f]=i.default.useState(!1),p=i.default.useRef(e.height),v=t.selectedElements.indexOf(e)>=0,{textVerticalResizeEnabled:b}=h.flags,S=P(e.fontFamily),[E,M]=i.default.useState([]);i.default.useEffect(()=>{var e,t;const n=null!==(t=null===(e=r.current)||void 0===e?void 0:e.textArr)&&void 0!==t?t:[];JSON.stringify(n)!==JSON.stringify(E)&&M(n)}),i.default.useEffect(()=>{if(e.width)return;const t=r.current;t.width(600),e.set({width:1.4*t.getTextWidth()})},[]),i.default.useLayoutEffect(()=>(0,s.autorun)(()=>{const t=r.current;(0,x.applyFilter)(t,e)}));const[L]=(0,exports.useFontLoader)(t,e.fontFamily),O=(0,g.removeTags)(e.text),k=()=>{const e=r.current.clone({height:void 0}),t=Math.ceil(e.fontSize()*e.lineHeight()*e.textArr.length+1);return e.destroy(),t};i.default.useLayoutEffect(()=>{if(!L)return;const{textOverflow:n}=h.flags;if(e.height)if("change-font-size"!==n||c){if("resize"===n){const n=k();b&&e.height<n&&t.history.ignore(()=>{e.set({height:n}),r.current.height(n)}),b||e.height===n||t.history.ignore(()=>{e.set({height:n}),r.current.height(n)})}}else{const n=R(r.current,e);if(n!==e.fontSize)return void t.history.ignore(()=>{e.set({fontSize:n})});const i=k();e.height!==i&&t.history.ignore(()=>{e.set({height:i})})}else{const r=k();t.history.ignore(()=>{e.set({height:r})})}}),i.default.useLayoutEffect(()=>{const t=r.current;t&&(t.width(t.width()+1e-8),t._setTextData(),(0,x.applyFilter)(t,e))},[L]);const F=i.default.useRef(null),_=i.default.useRef(0),H=r=>{r.evt.preventDefault(),t.selectedShapes.find(t=>t===e)&&e.contentEditable&&(_.current=A(r),e.toggleEditMode())},q=!O&&e.placeholder?.6:e.a.opacity;(0,y.useFadeIn)(r,q);const C=(0,exports.getLineHeight)({fontLoaded:L,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),j=e.selectable||"admin"===t.role,D=(0,exports.useTextColor)(e),W=i.default.useMemo(()=>e.backgroundEnabled?$({lines:E,cornerRadius:e.backgroundCornerRadius*(e.fontSize*C*.5),lineHeight:C*e.fontSize,padding:e.backgroundPadding*(e.fontSize*C*.5),width:e.width,align:e.align}):"",[e.backgroundEnabled,e.backgroundCornerRadius,e.fontSize,C,e.backgroundPadding,e.width,e.align,E]),X=(0,w.useMobile)();let Y=0;return"middle"===e.verticalAlign?Y=(e.height-E.length*C*e.fontSize)/2:"bottom"===e.verticalAlign&&(Y=e.height-E.length*C*e.fontSize),i.default.createElement(i.default.Fragment,null,i.default.createElement(a.Path,{ref:n,x:e.a.x,y:e.a.y,rotation:e.a.rotation,hideInExport:!e.showInExport||!O,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity,data:W,fill:e.backgroundColor,offsetY:-Y}),i.default.createElement(a.Text,Object.assign({ref:r,id:e.id,name:"element",hideInExport:!e.showInExport||!O,editModeEnabled:e._editModeEnabled,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.width,height:e.height,text:O||e.placeholder},D,{stroke:e.stroke,lineJoin:"round",strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.fontSize,fontFamily:`"${e.fontFamily}", "${S}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:X?e.draggable&&v:e.draggable,preventDefault:!X||v,opacity:q,visible:!e._editModeEnabled,ellipsis:"ellipsis"===h.flags.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:C,letterSpacing:e.letterSpacing*e.fontSize,listening:j,onDragStart:()=>{t.history.startTransaction()},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:r=>{e.set({x:r.target.x(),y:r.target.y()}),t.history.endTransaction()},onMouseEnter:()=>{u(!0)},onMouseLeave:()=>{u(!1)},onClick:H,onTap:H,onTransformStart:()=>{f(!0),t.history.startTransaction(),p.current=r.current.height()},onTransform:t=>{var r,i;const o=t.target;null===(r=n.current)||void 0===r||r.setAttrs({x:o.x(),y:o.y(),rotation:o.rotation(),scale:o.scale()});const a=(null===(i=o.getStage())||void 0===i?void 0:i.findOne("Transformer")).getActiveAnchor();if("middle-left"===a||"middle-right"===a){const t=o.scaleX(),r=o.width()*t,n=e.fontSize;let i=r;r<n&&(i=n,F.current&&o.position(F.current)),o.width(i),o.scaleX(1),o.scaleY(1);const a=k();if("ellipsis"!==h.flags.textOverflow){const t=Math.max(a,p.current);o.height(t),e.set({height:o.height()})}e.set({x:o.x(),y:o.y(),width:o.width(),rotation:o.rotation()}),(0,x.applyFilter)(o,e)}if("top-center"===a||"bottom-center"===a){let r="resize"===h.flags.textOverflow?k():C*e.fontSize;t.target.height(Math.max(r,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}t.target.strokeWidth(e.strokeWidth/t.target.scaleX()),F.current=t.target.position()},onTransformEnd:r=>{var i;f(!1);const o=r.target.scaleX();r.target.scaleX(1),r.target.scaleY(1),r.target.strokeWidth(e.strokeWidth),e.set({fontSize:Math.round(e.fontSize*o),width:Math.ceil(r.target.width()*o),x:r.target.x(),y:r.target.y(),rotation:r.target.rotation(),height:r.target.height()*o}),t.history.endTransaction(),null===(i=n.current)||void 0===i||i.setAttrs({scaleX:1,scaleY:1})}})),o&&i.default.createElement(a.Group,{x:e.a.x,y:e.a.y,rotation:e.a.rotation},i.default.createElement(T,{textNodeRef:r,element:e,selectAll:l,cursorPosition:_.current,onBlur:()=>{e.toggleEditMode(!1)}})),!c&&(d||v)&&i.default.createElement(m.Highlighter,{element:e}))});
218
+ "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var n={};if(null!=r)for(var i in r)"default"!==i&&Object.prototype.hasOwnProperty.call(r,i)&&e(n,r,i);return t(n,r),n},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.TextElement=exports.useTextColor=exports.usePrevious=exports.getLineHeight=exports.useFontLoader=exports.getDir=exports.isRTLText=void 0;const i=n(require("react")),o=require("mobx-react-lite"),a=require("react-konva"),l=require("react-konva-utils"),s=require("mobx"),d=n(require("konva")),u=require("svg-round-corners"),c=require("../utils/loader"),f=require("../utils/fonts"),h=require("../utils/flags"),g=require("../utils/text"),p=r(require("../utils/gradient")),x=require("./apply-filters"),y=require("./use-fadein"),m=require("./highlighter"),w=require("../utils/screen"),v=document.createElement("style");v.type="text/css",document.head.appendChild(v);const b={border:"none",padding:"0px",overflow:"hidden",background:"none",outline:"none",resize:"none",overflowWrap:"break-word",whiteSpace:"pre-wrap",userSelect:"text",wordBreak:"normal"};function S(e){var t="֑-߿‏‫‮יִ-﷽ﹰ-ﻼ";return new RegExp("^[^"+t+"]*?["+t+"]").test(e)}function E(e){e=e.replace(/\s/g,"");let t=0;for(var r=0;r<e.length;r++)S(e[r])&&(t+=1);return t>e.length/2}function M(e){return E(e)?"rtl":"ltr"}exports.isRTLText=E,exports.getDir=M;const T=(0,o.observer)(({textNodeRef:e,element:t,onBlur:r,selectAll:n,cursorPosition:o})=>{const[a,s]=i.default.useState(b),d=e.current;i.default.useLayoutEffect(()=>{const e={};e.width=d.width()-2*d.padding()+"px",e.height=d.height()-2*d.padding()+10+"px",e.fontSize=d.fontSize()+"px",e.lineHeight=d.lineHeight()+.01,e.fontFamily=d.fontFamily(),e.textAlign=d.align(),e.color=d.fill(),e.fontWeight=t.fontWeight,e.fontStyle=t.fontStyle,e.letterSpacing=t.letterSpacing+"em";const r=`\n .polotno-input::placeholder {\n color: ${a.color};\n opacity: 0.6;\n }\n `;v.innerHTML="",v.appendChild(document.createTextNode(r)),JSON.stringify(e)!==JSON.stringify(a)&&s(e)});const u=i.default.useRef(null);i.default.useEffect(()=>{const e=setTimeout(()=>{var e;const t=u.current;if(!t)return;null===(e=u.current)||void 0===e||e.focus();const r=o||t.value.length;t.selectionStart=t.selectionEnd=r,n&&(null==t||t.select(),document.execCommand("selectAll",!1,null))});return()=>{clearTimeout(e)}},[]);let c=0;const f=d.textArr.length*d.lineHeight()*d.fontSize();"middle"===t.verticalAlign&&(c=(t.height-f)/2),"bottom"===t.verticalAlign&&(c=t.height-f);const h=(0,g.removeTags)(t.text);return i.default.createElement(l.Html,null,i.default.createElement("textarea",{className:"polotno-input",ref:u,dir:M(h),style:Object.assign(Object.assign(Object.assign({},b),a),{paddingTop:c+"px"}),value:h,onChange:e=>{t.set({text:e.target.value})},placeholder:t.placeholder,onBlur:r}))}),z=e=>{const[t,r]=i.default.useState(!1),n=i.default.useRef(!1);return i.default.useEffect(()=>{var t=!0;return setTimeout(()=>{t&&(e._editModeEnabled&&(n.current=!0),r(!0),setTimeout(()=>{n.current=!1},50))},50),()=>{t=!1}},[]),{editorEnabled:t&&e._editModeEnabled,selectAll:n.current}},L=(e,t)=>{const[r,n]=i.default.useReducer(e=>e+1,0),o=i.default.useRef(!1);return o.current=!!(0,f.isFontLoaded)(t),i.default.useLayoutEffect(()=>{if(o.current)return;let r=!0;return(async()=>{o.current=!1,n();const i=(0,c.incrementLoader)(`text ${t}`);await e.loadFont(t),d.default.Util.requestAnimFrame(i),r&&(o.current=!0,n())})(),()=>{r=!1}},[t]),[o.current]};exports.useFontLoader=L;const O=({fontLoaded:e,fontFamily:t,fontSize:r,lineHeight:n})=>i.default.useMemo(()=>{if("number"==typeof n)return n;const e=document.createElement("div");e.style.fontFamily=t,e.style.fontSize=r+"px",e.style.lineHeight=n,e.innerText="Test text",document.body.appendChild(e);const i=e.offsetHeight;return document.body.removeChild(e),i/r},[e,t,r,n]);function k(e){var t=e.getAbsoluteTransform().copy();t.invert();var r=e.getStage().getPointerPosition();return t.point(r)}function A(e){var t;const r=e.target,n=k(r),i=r.textArr,o=Math.floor(n.y/(r.fontSize()*r.lineHeight())),a=i.slice(0,o).reduce((e,t)=>e+t.text.length,o),l=null!==(t=i[o])&&void 0!==t?t:i[0];let s=0;return"right"===r.align()?s=r.width()-l.width:"center"===r.align()&&(s=r.width()/2-l.width/2),a+Math.round((n.x-s)/l.width*l.text.length)}function P(e){const t=i.default.useRef(e),r=i.default.useRef(e);return i.default.useMemo(()=>{r.current=t.current,t.current=e},[e]),r.current}function R(e,t){const r=e.fontSize(),n=e.height(),i=(0,g.removeTags)(t.text);let o=t.fontSize;e.height(void 0);const a=Math.round(2*t.fontSize)-1;for(let l=1;l<a;l++){const r=t.height&&e.height()>t.height,n=i.split("\n").join(" ").split(" ");let a=e.textArr.map(e=>e.text).join(";");const l=n.find(e=>!a.includes(e)||(a=a.replace(e,""),!1));if(!r&&!l)break;o-=.5,e.fontSize(o)}return e.fontSize(r),e.height(n),o}function $({lines:e,lineHeight:t,width:r,align:n="left",padding:i=0,cornerRadius:o=0}){var a;e.forEach((e,t)=>{e.cx=r/2,"right"===n?e.cx=r-e.width/2:"left"===n&&(e.cx=e.width/2),"justify"!==n||e.lastInParagraph||(e.width=r),"justify"===n&&(e.cx=e.width/2)});let l=`M ${null===(a=e[0])||void 0===a?void 0:a.cx} ${-i}`;e.forEach((r,n)=>{const{cx:o}=r,a=e[n-1];a&&a.width>r.width?l+=` L ${o+r.width/2+i} ${n*t+i}`:l+=` L ${o+r.width/2+i} ${n*t-i}`;const s=e[n+1];s&&s.width>r.width?l+=` L ${o+r.width/2+i} ${(n+1)*t-i}`:l+=` L ${o+r.width/2+i} ${(n+1)*t+i}`});for(var s=e.length-1;s>=0;s--){const r=e[s],{cx:n}=r,o=e[s+1];o&&o.width>r.width?l+=` L ${n-r.width/2-i} ${(s+1)*t-i}`:l+=` L ${n-r.width/2-i} ${(s+1)*t+i}`;const a=e[s-1];a&&a.width>r.width?l+=` L ${n-r.width/2-i} ${s*t+i}`:l+=` L ${n-r.width/2-i} ${s*t-i}`}l+=" Z";const d=(0,u.parsePath)(l);return(0,u.roundCommands)(d,o).path}exports.getLineHeight=O,exports.usePrevious=P;const F=e=>i.default.useMemo(()=>{if(!p.isGradient(e.fill))return{fill:e.fill};const{stops:t,rotation:r}=p.parseColor(e.fill),n={x:e.width/2,y:e.height/2},i=Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)),o=d.default.Util.degToRad(r)-Math.PI/2,a=[];return t.forEach(({offset:e,color:t})=>{a.push(e,t)}),{fillLinearGradientStartPointX:n.x-i*Math.cos(o),fillLinearGradientStartPointY:n.y-i*Math.sin(o),fillLinearGradientColorStops:a,fillLinearGradientEndPointX:n.x+i*Math.cos(o),fillLinearGradientEndPointY:n.y+i*Math.sin(o),fill:t[1].color,fillPriority:"linear-gradient"}},[e.fill]);exports.useTextColor=F,exports.TextElement=(0,o.observer)(({element:e,store:t})=>{const r=i.default.useRef(null),n=i.default.useRef(null),{editorEnabled:o,selectAll:l}=z(e),[d,u]=i.default.useState(!1),[c,f]=i.default.useState(!1),p=i.default.useRef(e.height),v=t.selectedElements.indexOf(e)>=0,{textVerticalResizeEnabled:b}=h.flags,S=P(e.fontFamily),[E,M]=i.default.useState([]);i.default.useEffect(()=>{var e,t;const n=null!==(t=null===(e=r.current)||void 0===e?void 0:e.textArr)&&void 0!==t?t:[];JSON.stringify(n)!==JSON.stringify(E)&&M(n)}),i.default.useEffect(()=>{if(e.width)return;const t=r.current;t.width(600),e.set({width:1.4*t.getTextWidth()})},[]),i.default.useLayoutEffect(()=>(0,s.autorun)(()=>{const t=r.current;(0,x.applyFilter)(t,e)}));const[L]=(0,exports.useFontLoader)(t,e.fontFamily),O=(0,g.removeTags)(e.text),k=()=>{const e=r.current.clone({height:void 0}),t=Math.ceil(e.fontSize()*e.lineHeight()*e.textArr.length+1);return e.destroy(),t};i.default.useLayoutEffect(()=>{if(!L)return;const{textOverflow:n}=h.flags;if(e.height)if("change-font-size"!==n||c){if("resize"===n){const n=k();b&&e.height<n&&t.history.ignore(()=>{e.set({height:n}),r.current.height(n)}),b||e.height===n||t.history.ignore(()=>{e.set({height:n}),r.current.height(n)})}}else{const n=R(r.current,e);if(n!==e.fontSize)return void t.history.ignore(()=>{e.set({fontSize:n})});const i=k();e.height===i||b||t.history.ignore(()=>{e.set({height:i})})}else{const r=k();t.history.ignore(()=>{e.set({height:r})})}}),i.default.useLayoutEffect(()=>{const t=r.current;t&&(t.width(t.width()+1e-8),t._setTextData(),(0,x.applyFilter)(t,e))},[L]);const F=i.default.useRef(null),_=i.default.useRef(0),H=r=>{r.evt.preventDefault(),t.selectedShapes.find(t=>t===e)&&e.contentEditable&&(_.current=A(r),e.toggleEditMode())},q=!O&&e.placeholder?.6:e.a.opacity;(0,y.useFadeIn)(r,q);const C=(0,exports.getLineHeight)({fontLoaded:L,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),j=e.selectable||"admin"===t.role,D=(0,exports.useTextColor)(e),W=i.default.useMemo(()=>e.backgroundEnabled?$({lines:E,cornerRadius:e.backgroundCornerRadius*(e.fontSize*C*.5),lineHeight:C*e.fontSize,padding:e.backgroundPadding*(e.fontSize*C*.5),width:e.width,align:e.align}):"",[e.backgroundEnabled,e.backgroundCornerRadius,e.fontSize,C,e.backgroundPadding,e.width,e.align,E]),X=(0,w.useMobile)();let Y=0;return"middle"===e.verticalAlign?Y=(e.height-E.length*C*e.fontSize)/2:"bottom"===e.verticalAlign&&(Y=e.height-E.length*C*e.fontSize),i.default.createElement(i.default.Fragment,null,i.default.createElement(a.Path,{ref:n,x:e.a.x,y:e.a.y,rotation:e.a.rotation,hideInExport:!e.showInExport||!O,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity,data:W,fill:e.backgroundColor,offsetY:-Y}),i.default.createElement(a.Text,Object.assign({ref:r,id:e.id,name:"element",hideInExport:!e.showInExport||!O,editModeEnabled:e._editModeEnabled,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.width,height:e.height,text:O||e.placeholder},D,{stroke:e.stroke,lineJoin:"round",strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.fontSize,fontFamily:`"${e.fontFamily}", "${S}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:X?e.draggable&&v:e.draggable,preventDefault:!X||v,opacity:q,visible:!e._editModeEnabled,ellipsis:"ellipsis"===h.flags.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:C,letterSpacing:e.letterSpacing*e.fontSize,listening:j,onDragStart:()=>{t.history.startTransaction()},onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:r=>{e.set({x:r.target.x(),y:r.target.y()}),t.history.endTransaction()},onMouseEnter:()=>{u(!0)},onMouseLeave:()=>{u(!1)},onClick:H,onTap:H,onTransformStart:()=>{f(!0),t.history.startTransaction(),p.current=r.current.height()},onTransform:t=>{var r,i;const o=t.target;null===(r=n.current)||void 0===r||r.setAttrs({x:o.x(),y:o.y(),rotation:o.rotation(),scale:o.scale()});const a=(null===(i=o.getStage())||void 0===i?void 0:i.findOne("Transformer")).getActiveAnchor();if("middle-left"===a||"middle-right"===a){const t=o.scaleX(),r=o.width()*t,n=e.fontSize;let i=r;r<n&&(i=n,F.current&&o.position(F.current)),o.width(i),o.scaleX(1),o.scaleY(1);const a=k();if("ellipsis"!==h.flags.textOverflow){const t=Math.max(a,p.current);o.height(t),e.set({height:o.height()})}e.set({x:o.x(),y:o.y(),width:o.width(),rotation:o.rotation()}),(0,x.applyFilter)(o,e)}if("top-center"===a||"bottom-center"===a){let r="resize"===h.flags.textOverflow?k():C*e.fontSize;t.target.height(Math.max(r,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}t.target.strokeWidth(e.strokeWidth/t.target.scaleX()),F.current=t.target.position()},onTransformEnd:r=>{var i;const o=r.target.scaleX();r.target.scaleX(1),r.target.scaleY(1),r.target.strokeWidth(e.strokeWidth),e.set({fontSize:Math.round(e.fontSize*o),width:Math.ceil(r.target.width()*o),x:r.target.x(),y:r.target.y(),rotation:r.target.rotation(),height:r.target.height()*o}),null===(i=n.current)||void 0===i||i.setAttrs({scaleX:1,scaleY:1}),t.history.endTransaction(),f(!1)}})),o&&i.default.createElement(a.Group,{x:e.a.x,y:e.a.y,rotation:e.a.rotation},i.default.createElement(T,{textNodeRef:r,element:e,selectAll:l,cursorPosition:_.current,onBlur:()=>{e.toggleEditMode(!1)}})),!c&&(d||v)&&i.default.createElement(m.Highlighter,{element:e}))});
219
219
  },{"react":"HdMw","mobx-react-lite":"ZfSi","react-konva":"Sgug","react-konva-utils":"jXQU","mobx":"BzvP","konva":"aTGn","svg-round-corners":"NKfw","../utils/loader":"bN4e","../utils/fonts":"XXLd","../utils/flags":"IDY9","../utils/text":"rHBV","../utils/gradient":"V8he","./apply-filters":"SIWI","./use-fadein":"N3c2","./highlighter":"cEy1","../utils/screen":"aH85"}],"B1DI":[function(require,module,exports) {
220
220
  "use strict";var t=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.useSvgColors=exports.replaceColors=exports.sameColors=exports.fixSize=exports.getSvgSize=exports.svgToURL=exports.getColors=exports.urlToString=exports.urlToBase64=void 0;const e=t(require("konva")),r=t(require("react")),o=require("./gradient");function s(t){for(;t.parentNode;){if("defs"===t.nodeName)return!0;t=t.parentNode}return!1}function n(t){const e={fill:"",stroke:""};return t.getAttribute("fill")&&"none"!==t.getAttribute("fill")&&(e.fill=t.getAttribute("fill")),!e.fill&&t.style.fill&&"none"!==t.style.fill&&(e.fill=t.style.fill),t.getAttribute("stroke")&&(e.stroke=t.getAttribute("stroke")),!e.stroke&&t.style.stroke&&(e.stroke=t.style.stroke),e.stroke||e.fill||(e.fill="black"),e}const i=["path","rect","circle"];function l(t){for(var e=[],r=t.getElementsByTagName("*"),o=0,n=r.length;o<n;o++){const t=r[o];s(t)||(null!==t.getAttribute("fill")&&e.push(t),(null!==t.getAttribute("stroke")||t.style&&t.style.fill||i.indexOf(t.nodeName)>=0)&&e.push(t))}return e}async function a(t){const e=await fetch(t);return f(await e.text())}async function u(t){const e=await fetch(t,{mode:"cors"});return await e.text()}function c(t){const r=l((new DOMParser).parseFromString(t,"image/svg+xml")),o=[];return r.forEach(t=>{const{fill:r,stroke:s}=n(t);[r,s].forEach(t=>{t&&e.default.Util.colorToRGBA(t)&&-1===o.indexOf(t)&&o.push(t)})}),o}function f(t){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t)))}async function p(t){const e=await u(t),r=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement.getAttribute("viewBox"),[o,s,n,i]=(null==r?void 0:r.split(" "))||[];return{width:parseFloat(n),height:parseFloat(i)}}function d(t){var e=(new DOMParser).parseFromString(t,"image/svg+xml");const r=e.documentElement.getAttribute("viewBox"),[o,s,n,i]=(null==r?void 0:r.split(" "))||[],l=e.documentElement.getAttribute("width");!l&&e.documentElement.setAttribute("width",n+"px");const a=e.documentElement.getAttribute("height");if((!a||a.indexOf("%")>=0)&&e.documentElement.setAttribute("height",i+"px"),l&&l.indexOf("%")>=0&&a&&-1===a.indexOf("%")){const t=parseFloat(a)/parseFloat(i);e.documentElement.setAttribute("width",t*parseFloat(n)+"px")}if(a&&a.indexOf("%")>=0&&l&&-1===l.indexOf("%")){const t=parseFloat(l)/parseFloat(n);e.documentElement.setAttribute("height",t*parseFloat(i)+"px")}return(new XMLSerializer).serializeToString(e)}exports.urlToBase64=a,exports.urlToString=u,exports.getColors=c,exports.svgToURL=f,exports.getSvgSize=p,exports.fixSize=d;const g=(t,r)=>{if(!t||!r)return!1;const o=e.default.Util.colorToRGBA(t),s=e.default.Util.colorToRGBA(r);return o&&s?o.r===s.r&&o.g===s.g&&o.b===s.b&&o.a===s.a:void 0};function m(t,r,o,s){var n=t.namespaceURI,i=document.createElementNS(n,"linearGradient");const l=e.default.Util.degToRad(o+90),a=(Math.cos(l)+1)/2,u=(Math.sin(l)+1)/2,c=(Math.cos(l+Math.PI)+1)/2,f=(Math.sin(l+Math.PI)+1)/2;i.setAttribute("x1",100*a+"%"),i.setAttribute("y1",100*u+"%"),i.setAttribute("x2",100*c+"%"),i.setAttribute("y2",100*f+"%"),i.setAttribute("gradientUnits","userSpaceOnUse"),i.setAttribute("id",r);for(var p=0;p<s.length;p++){var d=s[p],g=document.createElementNS(n,"stop");for(var m in d)d.hasOwnProperty(m)&&g.setAttribute(m,d[m]);i.appendChild(g)}return(t.querySelector("defs")||t.insertBefore(document.createElementNS(n,"defs"),t.firstChild)).appendChild(i)}function x(t,e){var r=(new DOMParser).parseFromString(t,"image/svg+xml");const s=l(r),i=Array.from(e.keys());return s.forEach(t=>{const{fill:s,stroke:l}=n(t);[{prop:"fill",color:s},{prop:"stroke",color:l}].forEach(({prop:s,color:n})=>{const l=i.find(t=>(0,exports.sameColors)(t,n));if(l){const n=e.get(l);if((0,o.isGradient)(n)){const{rotation:e,stops:i}=(0,o.parseColor)(n),l=i.map(t=>({offset:100*t.offset+"%","stop-color":t.color})),a="color"+Math.round(1e8*Math.random());m(r.children[0],a,e,l),t.style[s]=null,t.setAttribute(s,`url('#${a}')`)}else t.style[s]=e.get(l)}})}),f((new XMLSerializer).serializeToString(r))}exports.sameColors=g,exports.replaceColors=x;const h=t=>{const[e,o]=r.default.useState([]);return r.default.useEffect(()=>{let e=!1;return(async()=>{o([]);const r=c(await u(t));e||o(r)})(),()=>{e=!0}},[t]),e};exports.useSvgColors=h;
221
221
  },{"konva":"aTGn","react":"HdMw","./gradient":"V8he"}],"VbEp":[function(require,module,exports) {
@@ -238,17 +238,43 @@ var t,e=require("buffer").Buffer;!function(e,n){"object"==typeof exports&&"objec
238
238
  var global = arguments[3];
239
239
  var define;
240
240
  var o,e=arguments[3];!function(n){var r="object"==typeof exports&&exports&&!exports.nodeType&&exports,t="object"==typeof module&&module&&!module.nodeType&&module,u="object"==typeof e&&e;u.global!==u&&u.window!==u&&u.self!==u||(n=u);var i,f,c=2147483647,l=36,s=1,p=26,a=38,d=700,h=72,v=128,g="-",w=/^xn--/,x=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,m={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=l-s,b=Math.floor,j=String.fromCharCode;function A(o){throw new RangeError(m[o])}function I(o,e){for(var n=o.length,r=[];n--;)r[n]=e(o[n]);return r}function E(o,e){var n=o.split("@"),r="";return n.length>1&&(r=n[0]+"@",o=n[1]),r+I((o=o.replace(y,".")).split("."),e).join(".")}function F(o){for(var e,n,r=[],t=0,u=o.length;t<u;)(e=o.charCodeAt(t++))>=55296&&e<=56319&&t<u?56320==(64512&(n=o.charCodeAt(t++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),t--):r.push(e);return r}function O(o){return I(o,function(o){var e="";return o>65535&&(e+=j((o-=65536)>>>10&1023|55296),o=56320|1023&o),e+=j(o)}).join("")}function S(o,e){return o+22+75*(o<26)-((0!=e)<<5)}function T(o,e,n){var r=0;for(o=n?b(o/d):o>>1,o+=b(o/e);o>C*p>>1;r+=l)o=b(o/C);return b(r+(C+1)*o/(o+a))}function L(o){var e,n,r,t,u,i,f,a,d,w,x,y=[],m=o.length,C=0,j=v,I=h;for((n=o.lastIndexOf(g))<0&&(n=0),r=0;r<n;++r)o.charCodeAt(r)>=128&&A("not-basic"),y.push(o.charCodeAt(r));for(t=n>0?n+1:0;t<m;){for(u=C,i=1,f=l;t>=m&&A("invalid-input"),((a=(x=o.charCodeAt(t++))-48<10?x-22:x-65<26?x-65:x-97<26?x-97:l)>=l||a>b((c-C)/i))&&A("overflow"),C+=a*i,!(a<(d=f<=I?s:f>=I+p?p:f-I));f+=l)i>b(c/(w=l-d))&&A("overflow"),i*=w;I=T(C-u,e=y.length+1,0==u),b(C/e)>c-j&&A("overflow"),j+=b(C/e),C%=e,y.splice(C++,0,j)}return O(y)}function M(o){var e,n,r,t,u,i,f,a,d,w,x,y,m,C,I,E=[];for(y=(o=F(o)).length,e=v,n=0,u=h,i=0;i<y;++i)(x=o[i])<128&&E.push(j(x));for(r=t=E.length,t&&E.push(g);r<y;){for(f=c,i=0;i<y;++i)(x=o[i])>=e&&x<f&&(f=x);for(f-e>b((c-n)/(m=r+1))&&A("overflow"),n+=(f-e)*m,e=f,i=0;i<y;++i)if((x=o[i])<e&&++n>c&&A("overflow"),x==e){for(a=n,d=l;!(a<(w=d<=u?s:d>=u+p?p:d-u));d+=l)I=a-w,C=l-w,E.push(j(S(w+I%C,0))),a=b(I/C);E.push(j(S(a,0))),u=T(n,m,r==t),n=0,++r}++n,++e}return E.join("")}if(i={version:"1.4.1",ucs2:{decode:F,encode:O},decode:L,encode:M,toASCII:function(o){return E(o,function(o){return x.test(o)?"xn--"+M(o):o})},toUnicode:function(o){return E(o,function(o){return w.test(o)?L(o.slice(4).toLowerCase()):o})}},"function"==typeof o&&"object"==typeof o.amd&&o.amd)o("punycode",function(){return i});else if(r&&t)if(module.exports==r)t.exports=i;else for(f in i)i.hasOwnProperty(f)&&(r[f]=i[f]);else n.punycode=i}(this);
241
- },{}],"oHuK":[function(require,module,exports) {
242
- "use strict";module.exports={isString:function(n){return"string"==typeof n},isObject:function(n){return"object"==typeof n&&null!==n},isNull:function(n){return null===n},isNullOrUndefined:function(n){return null==n}};
243
- },{}],"ObZ4":[function(require,module,exports) {
244
- "use strict";function r(r,e){return Object.prototype.hasOwnProperty.call(r,e)}module.exports=function(t,n,o,a){n=n||"&",o=o||"=";var s={};if("string"!=typeof t||0===t.length)return s;var p=/\+/g;t=t.split(n);var u=1e3;a&&"number"==typeof a.maxKeys&&(u=a.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var i=0;i<c;++i){var y,l,f,v,b=t[i].replace(p,"%20"),d=b.indexOf(o);d>=0?(y=b.substr(0,d),l=b.substr(d+1)):(y=b,l=""),f=decodeURIComponent(y),v=decodeURIComponent(l),r(s,f)?e(s[f])?s[f].push(v):s[f]=[s[f],v]:s[f]=v}return s};var e=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)};
245
- },{}],"XK8a":[function(require,module,exports) {
246
- "use strict";var n=function(n){switch(typeof n){case"string":return n;case"boolean":return n?"true":"false";case"number":return isFinite(n)?n:"";default:return""}};module.exports=function(o,u,c,a){return u=u||"&",c=c||"=",null===o&&(o=void 0),"object"==typeof o?r(t(o),function(t){var a=encodeURIComponent(n(t))+c;return e(o[t])?r(o[t],function(e){return a+encodeURIComponent(n(e))}).join(u):a+encodeURIComponent(n(o[t]))}).join(u):a?encodeURIComponent(n(a))+c+encodeURIComponent(n(o)):""};var e=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)};function r(n,e){if(n.map)return n.map(e);for(var r=[],t=0;t<n.length;t++)r.push(e(n[t],t));return r}var t=Object.keys||function(n){var e=[];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.push(r);return e};
247
- },{}],"SF0R":[function(require,module,exports) {
248
- "use strict";exports.decode=exports.parse=require("./decode"),exports.encode=exports.stringify=require("./encode");
249
- },{"./decode":"ObZ4","./encode":"XK8a"}],"j37I":[function(require,module,exports) {
250
- "use strict";var t=require("punycode"),s=require("./util");function h(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}exports.parse=b,exports.resolve=O,exports.resolveObject=d,exports.format=q,exports.Url=h;var e=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,r=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,o=["<",">",'"',"`"," ","\r","\n","\t"],n=["{","}","|","\\","^","`"].concat(o),i=["'"].concat(n),l=["%","/","?",";","#"].concat(i),p=["/","?","#"],c=255,u=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=require("querystring");function b(t,e,a){if(t&&s.isObject(t)&&t instanceof h)return t;var r=new h;return r.parse(t,e,a),r}function q(t){return s.isString(t)&&(t=b(t)),t instanceof h?t.format():h.prototype.format.call(t)}function O(t,s){return b(t,!1,!0).resolve(s)}function d(t,s){return t?b(t,!1,!0).resolveObject(s):s}h.prototype.parse=function(h,a,o){if(!s.isString(h))throw new TypeError("Parameter 'url' must be a string, not "+typeof h);var n=h.indexOf("?"),b=-1!==n&&n<h.indexOf("#")?"?":"#",q=h.split(b);q[0]=q[0].replace(/\\/g,"/");var O=h=q.join(b);if(O=O.trim(),!o&&1===h.split("#").length){var d=r.exec(O);if(d)return this.path=O,this.href=O,this.pathname=d[1],d[2]?(this.search=d[2],this.query=a?y.parse(this.search.substr(1)):this.search.substr(1)):a&&(this.search="",this.query={}),this}var j=e.exec(O);if(j){var x=(j=j[0]).toLowerCase();this.protocol=x,O=O.substr(j.length)}if(o||j||O.match(/^\/\/[^@\/]+@[^@\/]+/)){var A="//"===O.substr(0,2);!A||j&&v[j]||(O=O.substr(2),this.slashes=!0)}if(!v[j]&&(A||j&&!g[j])){for(var C,I,w=-1,U=0;U<p.length;U++){-1!==(k=O.indexOf(p[U]))&&(-1===w||k<w)&&(w=k)}-1!==(I=-1===w?O.lastIndexOf("@"):O.lastIndexOf("@",w))&&(C=O.slice(0,I),O=O.slice(I+1),this.auth=decodeURIComponent(C)),w=-1;for(U=0;U<l.length;U++){var k;-1!==(k=O.indexOf(l[U]))&&(-1===w||k<w)&&(w=k)}-1===w&&(w=O.length),this.host=O.slice(0,w),O=O.slice(w),this.parseHost(),this.hostname=this.hostname||"";var N="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!N)for(var R=this.hostname.split(/\./),S=(U=0,R.length);U<S;U++){var $=R[U];if($&&!$.match(u)){for(var z="",H=0,L=$.length;H<L;H++)$.charCodeAt(H)>127?z+="x":z+=$[H];if(!z.match(u)){var Z=R.slice(0,U),_=R.slice(U+1),E=$.match(f);E&&(Z.push(E[1]),_.unshift(E[2])),_.length&&(O="/"+_.join(".")+O),this.hostname=Z.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),N||(this.hostname=t.toASCII(this.hostname));var P=this.port?":"+this.port:"",T=this.hostname||"";this.host=T+P,this.href+=this.host,N&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==O[0]&&(O="/"+O))}if(!m[x])for(U=0,S=i.length;U<S;U++){var B=i[U];if(-1!==O.indexOf(B)){var D=encodeURIComponent(B);D===B&&(D=escape(B)),O=O.split(B).join(D)}}var F=O.indexOf("#");-1!==F&&(this.hash=O.substr(F),O=O.slice(0,F));var G=O.indexOf("?");if(-1!==G?(this.search=O.substr(G),this.query=O.substr(G+1),a&&(this.query=y.parse(this.query)),O=O.slice(0,G)):a&&(this.search="",this.query={}),O&&(this.pathname=O),g[x]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){P=this.pathname||"";var J=this.search||"";this.path=P+J}return this.href=this.format(),this},h.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var h=this.protocol||"",e=this.pathname||"",a=this.hash||"",r=!1,o="";this.host?r=t+this.host:this.hostname&&(r=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&s.isObject(this.query)&&Object.keys(this.query).length&&(o=y.stringify(this.query));var n=this.search||o&&"?"+o||"";return h&&":"!==h.substr(-1)&&(h+=":"),this.slashes||(!h||g[h])&&!1!==r?(r="//"+(r||""),e&&"/"!==e.charAt(0)&&(e="/"+e)):r||(r=""),a&&"#"!==a.charAt(0)&&(a="#"+a),n&&"?"!==n.charAt(0)&&(n="?"+n),h+r+(e=e.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(n=n.replace("#","%23"))+a},h.prototype.resolve=function(t){return this.resolveObject(b(t,!1,!0)).format()},h.prototype.resolveObject=function(t){if(s.isString(t)){var e=new h;e.parse(t,!1,!0),t=e}for(var a=new h,r=Object.keys(this),o=0;o<r.length;o++){var n=r[o];a[n]=this[n]}if(a.hash=t.hash,""===t.href)return a.href=a.format(),a;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),l=0;l<i.length;l++){var p=i[l];"protocol"!==p&&(a[p]=t[p])}return g[a.protocol]&&a.hostname&&!a.pathname&&(a.path=a.pathname="/"),a.href=a.format(),a}if(t.protocol&&t.protocol!==a.protocol){if(!g[t.protocol]){for(var c=Object.keys(t),u=0;u<c.length;u++){var f=c[u];a[f]=t[f]}return a.href=a.format(),a}if(a.protocol=t.protocol,t.host||v[t.protocol])a.pathname=t.pathname;else{for(var m=(t.pathname||"").split("/");m.length&&!(t.host=m.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==m[0]&&m.unshift(""),m.length<2&&m.unshift(""),a.pathname=m.join("/")}if(a.search=t.search,a.query=t.query,a.host=t.host||"",a.auth=t.auth,a.hostname=t.hostname||t.host,a.port=t.port,a.pathname||a.search){var y=a.pathname||"",b=a.search||"";a.path=y+b}return a.slashes=a.slashes||t.slashes,a.href=a.format(),a}var q=a.pathname&&"/"===a.pathname.charAt(0),O=t.host||t.pathname&&"/"===t.pathname.charAt(0),d=O||q||a.host&&t.pathname,j=d,x=a.pathname&&a.pathname.split("/")||[],A=(m=t.pathname&&t.pathname.split("/")||[],a.protocol&&!g[a.protocol]);if(A&&(a.hostname="",a.port=null,a.host&&(""===x[0]?x[0]=a.host:x.unshift(a.host)),a.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===m[0]?m[0]=t.host:m.unshift(t.host)),t.host=null),d=d&&(""===m[0]||""===x[0])),O)a.host=t.host||""===t.host?t.host:a.host,a.hostname=t.hostname||""===t.hostname?t.hostname:a.hostname,a.search=t.search,a.query=t.query,x=m;else if(m.length)x||(x=[]),x.pop(),x=x.concat(m),a.search=t.search,a.query=t.query;else if(!s.isNullOrUndefined(t.search)){if(A)a.hostname=a.host=x.shift(),(k=!!(a.host&&a.host.indexOf("@")>0)&&a.host.split("@"))&&(a.auth=k.shift(),a.host=a.hostname=k.shift());return a.search=t.search,a.query=t.query,s.isNull(a.pathname)&&s.isNull(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.href=a.format(),a}if(!x.length)return a.pathname=null,a.search?a.path="/"+a.search:a.path=null,a.href=a.format(),a;for(var C=x.slice(-1)[0],I=(a.host||t.host||x.length>1)&&("."===C||".."===C)||""===C,w=0,U=x.length;U>=0;U--)"."===(C=x[U])?x.splice(U,1):".."===C?(x.splice(U,1),w++):w&&(x.splice(U,1),w--);if(!d&&!j)for(;w--;w)x.unshift("..");!d||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),I&&"/"!==x.join("/").substr(-1)&&x.push("");var k,N=""===x[0]||x[0]&&"/"===x[0].charAt(0);A&&(a.hostname=a.host=N?"":x.length?x.shift():"",(k=!!(a.host&&a.host.indexOf("@")>0)&&a.host.split("@"))&&(a.auth=k.shift(),a.host=a.hostname=k.shift()));return(d=d||a.host&&x.length)&&!N&&x.unshift(""),x.length?a.pathname=x.join("/"):(a.pathname=null,a.path=null),s.isNull(a.pathname)&&s.isNull(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.auth=t.auth||a.auth,a.slashes=a.slashes||t.slashes,a.href=a.format(),a},h.prototype.parseHost=function(){var t=this.host,s=a.exec(t);s&&(":"!==(s=s[0])&&(this.port=s.substr(1)),t=t.substr(0,t.length-s.length)),t&&(this.hostname=t)};
251
- },{"punycode":"sBBS","./util":"oHuK","querystring":"SF0R"}],"JMLK":[function(require,module,exports) {
241
+ },{}],"Ht9r":[function(require,module,exports) {
242
+ "use strict";module.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0};
243
+ },{}],"khja":[function(require,module,exports) {
244
+ "use strict";var o="undefined"!=typeof Symbol&&Symbol,e=require("./shams");module.exports=function(){return"function"==typeof o&&("function"==typeof Symbol&&("symbol"==typeof o("foo")&&("symbol"==typeof Symbol("bar")&&e())))};
245
+ },{"./shams":"Ht9r"}],"U7E0":[function(require,module,exports) {
246
+ "use strict";var o={foo:{}},t=Object;module.exports=function(){return{__proto__:o}.foo===o.foo&&!({__proto__:null}instanceof t)};
247
+ },{}],"sg3h":[function(require,module,exports) {
248
+ "use strict";var t="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,o=Object.prototype.toString,r="[object Function]";module.exports=function(e){var p=this;if("function"!=typeof p||o.call(p)!==r)throw new TypeError(t+p);for(var i,c=n.call(arguments,1),a=Math.max(0,p.length-c.length),l=[],u=0;u<a;u++)l.push("$"+u);if(i=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof i){var t=p.apply(this,c.concat(n.call(arguments)));return Object(t)===t?t:this}return p.apply(e,c.concat(n.call(arguments)))}),p.prototype){var y=function(){};y.prototype=p.prototype,i.prototype=new y,y.prototype=null}return i};
249
+ },{}],"KNOk":[function(require,module,exports) {
250
+ "use strict";var e=require("./implementation");module.exports=Function.prototype.bind||e;
251
+ },{"./implementation":"sg3h"}],"KeR3":[function(require,module,exports) {
252
+ "use strict";var t=require("function-bind");module.exports=t.call(Function.call,Object.prototype.hasOwnProperty);
253
+ },{"function-bind":"KNOk"}],"aOC8":[function(require,module,exports) {
254
+ "use strict";var r,t=SyntaxError,e=Function,o=TypeError,n=function(r){try{return e('"use strict"; return ('+r+").constructor;")()}catch(t){}},a=Object.getOwnPropertyDescriptor;if(a)try{a({},"")}catch(w){a=null}var y=function(){throw new o},p=a?function(){try{return arguments.callee,y}catch(r){try{return a(arguments,"callee").get}catch(t){return y}}}():y,i=require("has-symbols")(),f=require("has-proto")(),c=Object.getPrototypeOf||(f?function(r){return r.__proto__}:null),l={},u="undefined"!=typeof Uint8Array&&c?c(Uint8Array):r,s={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":i&&c?c([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?r:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":e,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":i&&c?c(c([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&i&&c?c((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&i&&c?c((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":i&&c?c(""[Symbol.iterator]()):r,"%Symbol%":i?Symbol:r,"%SyntaxError%":t,"%ThrowTypeError%":p,"%TypedArray%":u,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};if(c)try{null.error}catch(w){var A=c(c(w));s["%Error.prototype%"]=A}var d=function r(t){var e;if("%AsyncFunction%"===t)e=n("async function () {}");else if("%GeneratorFunction%"===t)e=n("function* () {}");else if("%AsyncGeneratorFunction%"===t)e=n("async function* () {}");else if("%AsyncGenerator%"===t){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var a=r("%AsyncGenerator%");a&&c&&(e=c(a.prototype))}return s[t]=e,e},P={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},g=require("function-bind"),m=require("has"),S=g.call(Function.call,Array.prototype.concat),E=g.call(Function.apply,Array.prototype.splice),h=g.call(Function.call,String.prototype.replace),I=g.call(Function.call,String.prototype.slice),F=g.call(Function.call,RegExp.prototype.exec),b=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,U=/\\(\\)?/g,v=function(r){var e=I(r,0,1),o=I(r,-1);if("%"===e&&"%"!==o)throw new t("invalid intrinsic syntax, expected closing `%`");if("%"===o&&"%"!==e)throw new t("invalid intrinsic syntax, expected opening `%`");var n=[];return h(r,b,function(r,t,e,o){n[n.length]=e?h(o,U,"$1"):t||r}),n},R=function(r,e){var n,a=r;if(m(P,a)&&(a="%"+(n=P[a])[0]+"%"),m(s,a)){var y=s[a];if(y===l&&(y=d(a)),void 0===y&&!e)throw new o("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:n,name:a,value:y}}throw new t("intrinsic "+r+" does not exist!")};module.exports=function(r,e){if("string"!=typeof r||0===r.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new o('"allowMissing" argument must be a boolean');if(null===F(/^%?[^%]*%?$/,r))throw new t("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=v(r),y=n.length>0?n[0]:"",p=R("%"+y+"%",e),i=p.name,f=p.value,c=!1,l=p.alias;l&&(y=l[0],E(n,S([0,1],l)));for(var u=1,A=!0;u<n.length;u+=1){var d=n[u],P=I(d,0,1),g=I(d,-1);if(('"'===P||"'"===P||"`"===P||'"'===g||"'"===g||"`"===g)&&P!==g)throw new t("property names with quotes must have matching quotes");if("constructor"!==d&&A||(c=!0),m(s,i="%"+(y+="."+d)+"%"))f=s[i];else if(null!=f){if(!(d in f)){if(!e)throw new o("base intrinsic for "+r+" exists, but the property is not available.");return}if(a&&u+1>=n.length){var h=a(f,d);f=(A=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:f[d]}else A=m(f,d),f=f[d];A&&!c&&(s[i]=f)}}return f};
255
+ },{"has-symbols":"khja","has-proto":"U7E0","function-bind":"KNOk","has":"KeR3"}],"VqWc":[function(require,module,exports) {
256
+ "use strict";var e=require("function-bind"),t=require("get-intrinsic"),r=t("%Function.prototype.apply%"),n=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(n,r),o=t("%Object.getOwnPropertyDescriptor%",!0),p=t("%Object.defineProperty%",!0),u=t("%Math.max%");if(p)try{p({},"a",{value:1})}catch(c){p=null}module.exports=function(t){var r=l(e,n,arguments);o&&p&&(o(r,"length").configurable&&p(r,"length",{value:1+u(0,t.length-(arguments.length-1))}));return r};var a=function(){return l(e,r,arguments)};p?p(module.exports,"apply",{value:a}):module.exports.apply=a;
257
+ },{"function-bind":"KNOk","get-intrinsic":"aOC8"}],"nnGn":[function(require,module,exports) {
258
+ "use strict";var r=require("get-intrinsic"),t=require("./"),e=t(r("String.prototype.indexOf"));module.exports=function(i,n){var o=r(i,!!n);return"function"==typeof o&&e(i,".prototype.")>-1?t(o):o};
259
+ },{"get-intrinsic":"aOC8","./":"VqWc"}],"sC8V":[function(require,module,exports) {
260
+
261
+ },{}],"DlkO":[function(require,module,exports) {
262
+ var t="function"==typeof Map&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,r=t&&e&&"function"==typeof e.get?e.get:null,n=t&&Map.prototype.forEach,o="function"==typeof Set&&Set.prototype,i=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=o&&i&&"function"==typeof i.get?i.get:null,c=o&&Set.prototype.forEach,l="function"==typeof WeakMap&&WeakMap.prototype,a=l?WeakMap.prototype.has:null,f="function"==typeof WeakSet&&WeakSet.prototype,p=f?WeakSet.prototype.has:null,y="function"==typeof WeakRef&&WeakRef.prototype,g=y?WeakRef.prototype.deref:null,b=Boolean.prototype.valueOf,s=Object.prototype.toString,S=Function.prototype.toString,h=String.prototype.match,m=String.prototype.slice,v=String.prototype.replace,d=String.prototype.toUpperCase,j=String.prototype.toLowerCase,O=RegExp.prototype.test,w=Array.prototype.concat,x=Array.prototype.join,k=Array.prototype.slice,E=Math.floor,M="function"==typeof BigInt?BigInt.prototype.valueOf:null,W=Object.getOwnPropertySymbols,_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,L="function"==typeof Symbol&&"object"==typeof Symbol.iterator,$="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===L||"symbol")?Symbol.toStringTag:null,q=Object.prototype.propertyIsEnumerable,A=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function T(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||O.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-E(-t):E(t);if(n!==t){var o=String(n),i=m.call(e,o.length+1);return v.call(o,r,"$&_")+"."+v.call(v.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(e,r,"$&_")}var I=require("./util.inspect"),N=I.custom,P=J(N)?N:null;function R(t,e,r){var n="double"===(r.quoteStyle||e)?'"':"'";return n+t+n}function D(t){return v.call(String(t),/"/g,"&quot;")}function B(t){return!("[object Array]"!==X(t)||$&&"object"==typeof t&&$ in t)}function C(t){return!("[object Date]"!==X(t)||$&&"object"==typeof t&&$ in t)}function z(t){return!("[object RegExp]"!==X(t)||$&&"object"==typeof t&&$ in t)}function F(t){return!("[object Error]"!==X(t)||$&&"object"==typeof t&&$ in t)}function H(t){return!("[object String]"!==X(t)||$&&"object"==typeof t&&$ in t)}function U(t){return!("[object Number]"!==X(t)||$&&"object"==typeof t&&$ in t)}function G(t){return!("[object Boolean]"!==X(t)||$&&"object"==typeof t&&$ in t)}function J(t){if(L)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!_)return!1;try{return _.call(t),!0}catch(e){}return!1}function K(t){if(!t||"object"!=typeof t||!M)return!1;try{return M.call(t),!0}catch(e){}return!1}module.exports=function t(e,o,i,l){var a=o||{};if(V(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=!V(a,"customInspect")||a.customInspect;if("boolean"!=typeof f&&"symbol"!==f)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(V(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(V(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var p=a.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return ut(e,a);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var y=String(e);return p?T(e,y):y}if("bigint"==typeof e){var g=String(e)+"n";return p?T(e,g):g}var s=void 0===a.depth?5:a.depth;if(void 0===i&&(i=0),i>=s&&s>0&&"object"==typeof e)return B(e)?"[Array]":"[Object]";var S=yt(a,i);if(void 0===l)l=[];else if(Z(l,e)>=0)return"[Circular]";function h(e,r,n){if(r&&(l=k.call(l)).push(r),n){var o={depth:a.depth};return V(a,"quoteStyle")&&(o.quoteStyle=a.quoteStyle),t(e,o,i+1,l)}return t(e,a,i+1,l)}if("function"==typeof e&&!z(e)){var d=Y(e),O=bt(e,h);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(O.length>0?" { "+x.call(O,", ")+" }":"")}if(J(e)){var E=L?v.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):_.call(e);return"object"!=typeof e||L?E:lt(E)}if(it(e)){for(var W="<"+j.call(String(e.nodeName)),N=e.attributes||[],Q=0;Q<N.length;Q++)W+=" "+N[Q].name+"="+R(D(N[Q].value),"double",a);return W+=">",e.childNodes&&e.childNodes.length&&(W+="..."),W+="</"+j.call(String(e.nodeName))+">"}if(B(e)){if(0===e.length)return"[]";var ct=bt(e,h);return S&&!pt(ct)?"["+gt(ct,S)+"]":"[ "+x.call(ct,", ")+" ]"}if(F(e)){var st=bt(e,h);return"cause"in Error.prototype||!("cause"in e)||q.call(e,"cause")?0===st.length?"["+String(e)+"]":"{ ["+String(e)+"] "+x.call(st,", ")+" }":"{ ["+String(e)+"] "+x.call(w.call("[cause]: "+h(e.cause),st),", ")+" }"}if("object"==typeof e&&f){if(P&&"function"==typeof e[P]&&I)return I(e,{depth:s-i});if("symbol"!==f&&"function"==typeof e.inspect)return e.inspect()}if(tt(e)){var St=[];return n&&n.call(e,function(t,r){St.push(h(r,e,!0)+" => "+h(t,e))}),ft("Map",r.call(e),St,S)}if(nt(e)){var ht=[];return c&&c.call(e,function(t){ht.push(h(t,e))}),ft("Set",u.call(e),ht,S)}if(et(e))return at("WeakMap");if(ot(e))return at("WeakSet");if(rt(e))return at("WeakRef");if(U(e))return lt(h(Number(e)));if(K(e))return lt(h(M.call(e)));if(G(e))return lt(b.call(e));if(H(e))return lt(h(String(e)));if(!C(e)&&!z(e)){var mt=bt(e,h),vt=A?A(e)===Object.prototype:e instanceof Object||e.constructor===Object,dt=e instanceof Object?"":"null prototype",jt=!vt&&$&&Object(e)===e&&$ in e?m.call(X(e),8,-1):dt?"Object":"",Ot=(vt||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(jt||dt?"["+x.call(w.call([],jt||[],dt||[]),": ")+"] ":"");return 0===mt.length?Ot+"{}":S?Ot+"{"+gt(mt,S)+"}":Ot+"{ "+x.call(mt,", ")+" }"}return String(e)};var Q=Object.prototype.hasOwnProperty||function(t){return t in this};function V(t,e){return Q.call(t,e)}function X(t){return s.call(t)}function Y(t){if(t.name)return t.name;var e=h.call(S.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Z(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function tt(t){if(!r||!t||"object"!=typeof t)return!1;try{r.call(t);try{u.call(t)}catch(e){return!0}return t instanceof Map}catch(n){}return!1}function et(t){if(!a||!t||"object"!=typeof t)return!1;try{a.call(t,a);try{p.call(t,p)}catch(e){return!0}return t instanceof WeakMap}catch(r){}return!1}function rt(t){if(!g||!t||"object"!=typeof t)return!1;try{return g.call(t),!0}catch(e){}return!1}function nt(t){if(!u||!t||"object"!=typeof t)return!1;try{u.call(t);try{r.call(t)}catch(e){return!0}return t instanceof Set}catch(n){}return!1}function ot(t){if(!p||!t||"object"!=typeof t)return!1;try{p.call(t,p);try{a.call(t,a)}catch(e){return!0}return t instanceof WeakSet}catch(r){}return!1}function it(t){return!(!t||"object"!=typeof t)&&("undefined"!=typeof HTMLElement&&t instanceof HTMLElement||"string"==typeof t.nodeName&&"function"==typeof t.getAttribute)}function ut(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return ut(m.call(t,0,e.maxStringLength),e)+n}return R(v.call(v.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ct),"single",e)}function ct(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+d.call(e.toString(16))}function lt(t){return"Object("+t+")"}function at(t){return t+" { ? }"}function ft(t,e,r,n){return t+" ("+e+") {"+(n?gt(r,n):x.call(r,", "))+"}"}function pt(t){for(var e=0;e<t.length;e++)if(Z(t[e],"\n")>=0)return!1;return!0}function yt(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=x.call(Array(t.indent+1)," ")}return{base:r,prev:x.call(Array(e+1),r)}}function gt(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+x.call(t,","+r)+"\n"+e.prev}function bt(t,e){var r=B(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=V(t,o)?e(t[o],t):""}var i,u="function"==typeof W?W(t):[];if(L){i={};for(var c=0;c<u.length;c++)i["$"+u[c]]=u[c]}for(var l in t)V(t,l)&&(r&&String(Number(l))===l&&l<t.length||L&&i["$"+l]instanceof Symbol||(O.call(/[^\w$]/,l)?n.push(e(l,t)+": "+e(t[l],t)):n.push(l+": "+e(t[l],t))));if("function"==typeof W)for(var a=0;a<u.length;a++)q.call(t,u[a])&&n.push("["+e(u[a])+"]: "+e(t[u[a]],t));return n}
263
+ },{"./util.inspect":"sC8V"}],"lzf1":[function(require,module,exports) {
264
+ "use strict";var e=require("get-intrinsic"),t=require("call-bind/callBound"),n=require("object-inspect"),r=e("%TypeError%"),o=e("%WeakMap%",!0),i=e("%Map%",!0),u=t("WeakMap.prototype.get",!0),f=t("WeakMap.prototype.set",!0),a=t("WeakMap.prototype.has",!0),p=t("Map.prototype.get",!0),c=t("Map.prototype.set",!0),s=t("Map.prototype.has",!0),l=function(e,t){for(var n,r=e;null!==(n=r.next);r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n},y=function(e,t){var n=l(e,t);return n&&n.value},x=function(e,t,n){var r=l(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}},v=function(e,t){return!!l(e,t)};module.exports=function(){var e,t,l,M={assert:function(e){if(!M.has(e))throw new r("Side channel does not contain "+n(e))},get:function(n){if(o&&n&&("object"==typeof n||"function"==typeof n)){if(e)return u(e,n)}else if(i){if(t)return p(t,n)}else if(l)return y(l,n)},has:function(n){if(o&&n&&("object"==typeof n||"function"==typeof n)){if(e)return a(e,n)}else if(i){if(t)return s(t,n)}else if(l)return v(l,n);return!1},set:function(n,r){o&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new o),f(e,n,r)):i?(t||(t=new i),c(t,n,r)):(l||(l={key:{},next:null}),x(l,n,r))}};return M};
265
+ },{"get-intrinsic":"aOC8","call-bind/callBound":"nnGn","object-inspect":"DlkO"}],"aYjf":[function(require,module,exports) {
266
+ "use strict";var t=String.prototype.replace,r=/%20/g,C={RFC1738:"RFC1738",RFC3986:"RFC3986"};module.exports={default:C.RFC3986,formatters:{RFC1738:function(C){return t.call(C,r,"+")},RFC3986:function(t){return String(t)}},RFC1738:C.RFC1738,RFC3986:C.RFC3986};
267
+ },{}],"uwwy":[function(require,module,exports) {
268
+ "use strict";var r=require("./formats"),e=Object.prototype.hasOwnProperty,t=Array.isArray,o=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),n=function(r){for(;r.length>1;){var e=r.pop(),o=e.obj[e.prop];if(t(o)){for(var n=[],c=0;c<o.length;++c)void 0!==o[c]&&n.push(o[c]);e.obj[e.prop]=n}}},c=function(r,e){for(var t=e&&e.plainObjects?Object.create(null):{},o=0;o<r.length;++o)void 0!==r[o]&&(t[o]=r[o]);return t},u=function r(o,n,u){if(!n)return o;if("object"!=typeof n){if(t(o))o.push(n);else{if(!o||"object"!=typeof o)return[o,n];(u&&(u.plainObjects||u.allowPrototypes)||!e.call(Object.prototype,n))&&(o[n]=!0)}return o}if(!o||"object"!=typeof o)return[o].concat(n);var f=o;return t(o)&&!t(n)&&(f=c(o,u)),t(o)&&t(n)?(n.forEach(function(t,n){if(e.call(o,n)){var c=o[n];c&&"object"==typeof c&&t&&"object"==typeof t?o[n]=r(c,t,u):o.push(t)}else o[n]=t}),o):Object.keys(n).reduce(function(t,o){var c=n[o];return e.call(t,o)?t[o]=r(t[o],c,u):t[o]=c,t},f)},f=function(r,e){return Object.keys(e).reduce(function(r,t){return r[t]=e[t],r},r)},p=function(r,e,t){var o=r.replace(/\+/g," ");if("iso-8859-1"===t)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(n){return o}},a=function(e,t,n,c,u){if(0===e.length)return e;var f=e;if("symbol"==typeof e?f=Symbol.prototype.toString.call(e):"string"!=typeof e&&(f=String(e)),"iso-8859-1"===n)return escape(f).replace(/%u[0-9a-f]{4}/gi,function(r){return"%26%23"+parseInt(r.slice(2),16)+"%3B"});for(var p="",a=0;a<f.length;++a){var i=f.charCodeAt(a);45===i||46===i||95===i||126===i||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||u===r.RFC1738&&(40===i||41===i)?p+=f.charAt(a):i<128?p+=o[i]:i<2048?p+=o[192|i>>6]+o[128|63&i]:i<55296||i>=57344?p+=o[224|i>>12]+o[128|i>>6&63]+o[128|63&i]:(a+=1,i=65536+((1023&i)<<10|1023&f.charCodeAt(a)),p+=o[240|i>>18]+o[128|i>>12&63]+o[128|i>>6&63]+o[128|63&i])}return p},i=function(r){for(var e=[{obj:{o:r},prop:"o"}],t=[],o=0;o<e.length;++o)for(var c=e[o],u=c.obj[c.prop],f=Object.keys(u),p=0;p<f.length;++p){var a=f[p],i=u[a];"object"==typeof i&&null!==i&&-1===t.indexOf(i)&&(e.push({obj:u,prop:a}),t.push(i))}return n(e),r},s=function(r){return"[object RegExp]"===Object.prototype.toString.call(r)},l=function(r){return!(!r||"object"!=typeof r)&&!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))},b=function(r,e){return[].concat(r,e)},y=function(r,e){if(t(r)){for(var o=[],n=0;n<r.length;n+=1)o.push(e(r[n]));return o}return e(r)};module.exports={arrayToObject:c,assign:f,combine:b,compact:i,decode:p,encode:a,isBuffer:l,isRegExp:s,maybeMap:y,merge:u};
269
+ },{"./formats":"aYjf"}],"LyVH":[function(require,module,exports) {
270
+ "use strict";var e=require("side-channel"),r=require("./utils"),t=require("./formats"),o=Object.prototype.hasOwnProperty,n={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},i=Array.isArray,a=Array.prototype.push,l=function(e,r){a.apply(e,i(r)?r:[r])},f=Date.prototype.toISOString,s=t.default,c={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:r.encode,encodeValuesOnly:!1,format:s,formatter:t.formatters[s],indices:!1,serializeDate:function(e){return f.call(e)},skipNulls:!1,strictNullHandling:!1},u=function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},d={},y=function t(o,n,a,f,s,y,p,m,v,h,b,g,w,D,k,N){for(var O=o,S=N,T=0,j=!1;void 0!==(S=S.get(d))&&!j;){var x=S.get(o);if(T+=1,void 0!==x){if(x===T)throw new RangeError("Cyclic object value");j=!0}void 0===S.get(d)&&(T=0)}if("function"==typeof m?O=m(n,O):O instanceof Date?O=b(O):"comma"===a&&i(O)&&(O=r.maybeMap(O,function(e){return e instanceof Date?b(e):e})),null===O){if(s)return p&&!D?p(n,c.encoder,k,"key",g):n;O=""}if(u(O)||r.isBuffer(O))return p?[w(D?n:p(n,c.encoder,k,"key",g))+"="+w(p(O,c.encoder,k,"value",g))]:[w(n)+"="+w(String(O))];var E,P=[];if(void 0===O)return P;if("comma"===a&&i(O))D&&p&&(O=r.maybeMap(O,p)),E=[{value:O.length>0?O.join(",")||null:void 0}];else if(i(m))E=m;else{var z=Object.keys(O);E=v?z.sort(v):z}for(var H=f&&i(O)&&1===O.length?n+"[]":n,Q=0;Q<E.length;++Q){var V=E[Q],R="object"==typeof V&&void 0!==V.value?V.value:O[V];if(!y||null!==R){var q=i(O)?"function"==typeof a?a(H,V):H:H+(h?"."+V:"["+V+"]");N.set(o,T);var A=e();A.set(d,N),l(P,t(R,q,a,f,s,y,"comma"===a&&D&&i(O)?null:p,m,v,h,b,g,w,D,k,A))}}return P},p=function(e){if(!e)return c;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||c.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=t.default;if(void 0!==e.format){if(!o.call(t.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var a=t.formatters[n],l=c.filter;return("function"==typeof e.filter||i(e.filter))&&(l=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:c.addQueryPrefix,allowDots:void 0===e.allowDots?c.allowDots:!!e.allowDots,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:c.charsetSentinel,delimiter:void 0===e.delimiter?c.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:c.encode,encoder:"function"==typeof e.encoder?e.encoder:c.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:c.encodeValuesOnly,filter:l,format:n,formatter:a,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:c.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:c.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:c.strictNullHandling}};module.exports=function(r,t){var o,a=r,f=p(t);"function"==typeof f.filter?a=(0,f.filter)("",a):i(f.filter)&&(o=f.filter);var s,c=[];if("object"!=typeof a||null===a)return"";s=t&&t.arrayFormat in n?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var u=n[s];if(t&&"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var d="comma"===u&&t&&t.commaRoundTrip;o||(o=Object.keys(a)),f.sort&&o.sort(f.sort);for(var m=e(),v=0;v<o.length;++v){var h=o[v];f.skipNulls&&null===a[h]||l(c,y(a[h],h,u,d,f.strictNullHandling,f.skipNulls,f.encode?f.encoder:null,f.filter,f.sort,f.allowDots,f.serializeDate,f.format,f.formatter,f.encodeValuesOnly,f.charset,m))}var b=c.join(f.delimiter),g=!0===f.addQueryPrefix?"?":"";return f.charsetSentinel&&("iso-8859-1"===f.charset?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),b.length>0?g+b:""};
271
+ },{"side-channel":"lzf1","./utils":"uwwy","./formats":"aYjf"}],"cUMK":[function(require,module,exports) {
272
+ "use strict";var e=require("./utils"),r=Object.prototype.hasOwnProperty,t=Array.isArray,i={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:e.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},o=function(e){return e.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},a=function(e,r){return e&&"string"==typeof e&&r.comma&&e.indexOf(",")>-1?e.split(","):e},n="utf8=%26%2310003%3B",l="utf8=%E2%9C%93",c=function(c,s){var p,d={__proto__:null},u=s.ignoreQueryPrefix?c.replace(/^\?/,""):c,f=s.parameterLimit===1/0?void 0:s.parameterLimit,m=u.split(s.delimiter,f),y=-1,h=s.charset;if(s.charsetSentinel)for(p=0;p<m.length;++p)0===m[p].indexOf("utf8=")&&(m[p]===l?h="utf-8":m[p]===n&&(h="iso-8859-1"),y=p,p=m.length);for(p=0;p<m.length;++p)if(p!==y){var b,g,w=m[p],O=w.indexOf("]="),v=-1===O?w.indexOf("="):O+1;-1===v?(b=s.decoder(w,i.decoder,h,"key"),g=s.strictNullHandling?null:""):(b=s.decoder(w.slice(0,v),i.decoder,h,"key"),g=e.maybeMap(a(w.slice(v+1),s),function(e){return s.decoder(e,i.decoder,h,"value")})),g&&s.interpretNumericEntities&&"iso-8859-1"===h&&(g=o(g)),w.indexOf("[]=")>-1&&(g=t(g)?[g]:g),r.call(d,b)?d[b]=e.combine(d[b],g):d[b]=g}return d},s=function(e,r,t,i){for(var o=i?r:a(r,t),n=e.length-1;n>=0;--n){var l,c=e[n];if("[]"===c&&t.parseArrays)l=[].concat(o);else{l=t.plainObjects?Object.create(null):{};var s="["===c.charAt(0)&&"]"===c.charAt(c.length-1)?c.slice(1,-1):c,p=parseInt(s,10);t.parseArrays||""!==s?!isNaN(p)&&c!==s&&String(p)===s&&p>=0&&t.parseArrays&&p<=t.arrayLimit?(l=[])[p]=o:"__proto__"!==s&&(l[s]=o):l={0:o}}o=l}return o},p=function(e,t,i,o){if(e){var a=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,n=/(\[[^[\]]*])/g,l=i.depth>0&&/(\[[^[\]]*])/.exec(a),c=l?a.slice(0,l.index):a,p=[];if(c){if(!i.plainObjects&&r.call(Object.prototype,c)&&!i.allowPrototypes)return;p.push(c)}for(var d=0;i.depth>0&&null!==(l=n.exec(a))&&d<i.depth;){if(d+=1,!i.plainObjects&&r.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;p.push(l[1])}return l&&p.push("["+a.slice(l.index)+"]"),s(p,t,i,o)}},d=function(r){if(!r)return i;if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==r.charset&&"utf-8"!==r.charset&&"iso-8859-1"!==r.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===r.charset?i.charset:r.charset;return{allowDots:void 0===r.allowDots?i.allowDots:!!r.allowDots,allowPrototypes:"boolean"==typeof r.allowPrototypes?r.allowPrototypes:i.allowPrototypes,allowSparse:"boolean"==typeof r.allowSparse?r.allowSparse:i.allowSparse,arrayLimit:"number"==typeof r.arrayLimit?r.arrayLimit:i.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof r.charsetSentinel?r.charsetSentinel:i.charsetSentinel,comma:"boolean"==typeof r.comma?r.comma:i.comma,decoder:"function"==typeof r.decoder?r.decoder:i.decoder,delimiter:"string"==typeof r.delimiter||e.isRegExp(r.delimiter)?r.delimiter:i.delimiter,depth:"number"==typeof r.depth||!1===r.depth?+r.depth:i.depth,ignoreQueryPrefix:!0===r.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof r.interpretNumericEntities?r.interpretNumericEntities:i.interpretNumericEntities,parameterLimit:"number"==typeof r.parameterLimit?r.parameterLimit:i.parameterLimit,parseArrays:!1!==r.parseArrays,plainObjects:"boolean"==typeof r.plainObjects?r.plainObjects:i.plainObjects,strictNullHandling:"boolean"==typeof r.strictNullHandling?r.strictNullHandling:i.strictNullHandling}};module.exports=function(r,t){var i=d(t);if(""===r||null==r)return i.plainObjects?Object.create(null):{};for(var o="string"==typeof r?c(r,i):r,a=i.plainObjects?Object.create(null):{},n=Object.keys(o),l=0;l<n.length;++l){var s=n[l],u=p(s,o[s],i,"string"==typeof r);a=e.merge(a,u,i)}return!0===i.allowSparse?a:e.compact(a)};
273
+ },{"./utils":"uwwy"}],"eX9A":[function(require,module,exports) {
274
+ "use strict";var r=require("./stringify"),e=require("./parse"),s=require("./formats");module.exports={formats:s,parse:e,stringify:r};
275
+ },{"./stringify":"LyVH","./parse":"cUMK","./formats":"aYjf"}],"j37I":[function(require,module,exports) {
276
+ "use strict";var t=require("punycode");function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var h=/^([a-z0-9.+-]+:)/i,e=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,r=["<",">",'"',"`"," ","\r","\n","\t"],o=["{","}","|","\\","^","`"].concat(r),n=["'"].concat(o),i=["%","/","?",";","#"].concat(n),l=["/","?","#"],p=255,c=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,u={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=require("qs");function g(t,h,e){if(t&&"object"==typeof t&&t instanceof s)return t;var a=new s;return a.parse(t,h,e),a}function b(t){return"string"==typeof t&&(t=g(t)),t instanceof s?t.format():s.prototype.format.call(t)}function q(t,s){return g(t,!1,!0).resolve(s)}function j(t,s){return t?g(t,!1,!0).resolveObject(s):s}s.prototype.parse=function(s,e,r){if("string"!=typeof s)throw new TypeError("Parameter 'url' must be a string, not "+typeof s);var o=s.indexOf("?"),g=-1!==o&&o<s.indexOf("#")?"?":"#",b=s.split(g);b[0]=b[0].replace(/\\/g,"/");var q=s=b.join(g);if(q=q.trim(),!r&&1===s.split("#").length){var j=a.exec(q);if(j)return this.path=q,this.href=q,this.pathname=j[1],j[2]?(this.search=j[2],this.query=e?y.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var x=h.exec(q);if(x){var O=(x=x[0]).toLowerCase();this.protocol=O,q=q.substr(x.length)}if(r||x||q.match(/^\/\/[^@/]+@[^@/]+/)){var d="//"===q.substr(0,2);!d||x&&m[x]||(q=q.substr(2),this.slashes=!0)}if(!m[x]&&(d||x&&!v[x])){for(var A,C,I=-1,w=0;w<l.length;w++){-1!==(k=q.indexOf(l[w]))&&(-1===I||k<I)&&(I=k)}-1!==(C=-1===I?q.lastIndexOf("@"):q.lastIndexOf("@",I))&&(A=q.slice(0,C),q=q.slice(C+1),this.auth=decodeURIComponent(A)),I=-1;for(w=0;w<i.length;w++){var k;-1!==(k=q.indexOf(i[w]))&&(-1===I||k<I)&&(I=k)}-1===I&&(I=q.length),this.host=q.slice(0,I),q=q.slice(I),this.parseHost(),this.hostname=this.hostname||"";var U="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!U)for(var R=this.hostname.split(/\./),$=(w=0,R.length);w<$;w++){var z=R[w];if(z&&!z.match(c)){for(var H="",L=0,Z=z.length;L<Z;L++)z.charCodeAt(L)>127?H+="x":H+=z[L];if(!H.match(c)){var _=R.slice(0,w),E=R.slice(w+1),P=z.match(f);P&&(_.push(P[1]),E.unshift(P[2])),E.length&&(q="/"+E.join(".")+q),this.hostname=_.join(".");break}}}this.hostname.length>p?this.hostname="":this.hostname=this.hostname.toLowerCase(),U||(this.hostname=t.toASCII(this.hostname));var S=this.port?":"+this.port:"",T=this.hostname||"";this.host=T+S,this.href+=this.host,U&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==q[0]&&(q="/"+q))}if(!u[O])for(w=0,$=n.length;w<$;w++){var B=n[w];if(-1!==q.indexOf(B)){var D=encodeURIComponent(B);D===B&&(D=escape(B)),q=q.split(B).join(D)}}var F=q.indexOf("#");-1!==F&&(this.hash=q.substr(F),q=q.slice(0,F));var G=q.indexOf("?");if(-1!==G?(this.search=q.substr(G),this.query=q.substr(G+1),e&&(this.query=y.parse(this.query)),q=q.slice(0,G)):e&&(this.search="",this.query={}),q&&(this.pathname=q),v[O]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){S=this.pathname||"";var J=this.search||"";this.path=S+J}return this.href=this.format(),this},s.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var s=this.protocol||"",h=this.pathname||"",e=this.hash||"",a=!1,r="";this.host?a=t+this.host:this.hostname&&(a=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(a+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(r=y.stringify(this.query));var o=this.search||r&&"?"+r||"";return s&&":"!==s.substr(-1)&&(s+=":"),this.slashes||(!s||v[s])&&!1!==a?(a="//"+(a||""),h&&"/"!==h.charAt(0)&&(h="/"+h)):a||(a=""),e&&"#"!==e.charAt(0)&&(e="#"+e),o&&"?"!==o.charAt(0)&&(o="?"+o),s+a+(h=h.replace(/[?#]/g,function(t){return encodeURIComponent(t)}))+(o=o.replace("#","%23"))+e},s.prototype.resolve=function(t){return this.resolveObject(g(t,!1,!0)).format()},s.prototype.resolveObject=function(t){if("string"==typeof t){var h=new s;h.parse(t,!1,!0),t=h}for(var e=new s,a=Object.keys(this),r=0;r<a.length;r++){var o=a[r];e[o]=this[o]}if(e.hash=t.hash,""===t.href)return e.href=e.format(),e;if(t.slashes&&!t.protocol){for(var n=Object.keys(t),i=0;i<n.length;i++){var l=n[i];"protocol"!==l&&(e[l]=t[l])}return v[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(t.protocol&&t.protocol!==e.protocol){if(!v[t.protocol]){for(var p=Object.keys(t),c=0;c<p.length;c++){var f=p[c];e[f]=t[f]}return e.href=e.format(),e}if(e.protocol=t.protocol,t.host||m[t.protocol])e.pathname=t.pathname;else{for(var u=(t.pathname||"").split("/");u.length&&!(t.host=u.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==u[0]&&u.unshift(""),u.length<2&&u.unshift(""),e.pathname=u.join("/")}if(e.search=t.search,e.query=t.query,e.host=t.host||"",e.auth=t.auth,e.hostname=t.hostname||t.host,e.port=t.port,e.pathname||e.search){var y=e.pathname||"",g=e.search||"";e.path=y+g}return e.slashes=e.slashes||t.slashes,e.href=e.format(),e}var b=e.pathname&&"/"===e.pathname.charAt(0),q=t.host||t.pathname&&"/"===t.pathname.charAt(0),j=q||b||e.host&&t.pathname,x=j,O=e.pathname&&e.pathname.split("/")||[],d=(u=t.pathname&&t.pathname.split("/")||[],e.protocol&&!v[e.protocol]);if(d&&(e.hostname="",e.port=null,e.host&&(""===O[0]?O[0]=e.host:O.unshift(e.host)),e.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===u[0]?u[0]=t.host:u.unshift(t.host)),t.host=null),j=j&&(""===u[0]||""===O[0])),q)e.host=t.host||""===t.host?t.host:e.host,e.hostname=t.hostname||""===t.hostname?t.hostname:e.hostname,e.search=t.search,e.query=t.query,O=u;else if(u.length)O||(O=[]),O.pop(),O=O.concat(u),e.search=t.search,e.query=t.query;else if(null!=t.search){if(d)e.host=O.shift(),e.hostname=e.host,(k=!!(e.host&&e.host.indexOf("@")>0)&&e.host.split("@"))&&(e.auth=k.shift(),e.hostname=k.shift(),e.host=e.hostname);return e.search=t.search,e.query=t.query,null===e.pathname&&null===e.search||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!O.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var A=O.slice(-1)[0],C=(e.host||t.host||O.length>1)&&("."===A||".."===A)||""===A,I=0,w=O.length;w>=0;w--)"."===(A=O[w])?O.splice(w,1):".."===A?(O.splice(w,1),I++):I&&(O.splice(w,1),I--);if(!j&&!x)for(;I--;I)O.unshift("..");!j||""===O[0]||O[0]&&"/"===O[0].charAt(0)||O.unshift(""),C&&"/"!==O.join("/").substr(-1)&&O.push("");var k,U=""===O[0]||O[0]&&"/"===O[0].charAt(0);d&&(e.hostname=U?"":O.length?O.shift():"",e.host=e.hostname,(k=!!(e.host&&e.host.indexOf("@")>0)&&e.host.split("@"))&&(e.auth=k.shift(),e.hostname=k.shift(),e.host=e.hostname));return(j=j||e.host&&O.length)&&!U&&O.unshift(""),O.length>0?e.pathname=O.join("/"):(e.pathname=null,e.path=null),null===e.pathname&&null===e.search||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=t.auth||e.auth,e.slashes=e.slashes||t.slashes,e.href=e.format(),e},s.prototype.parseHost=function(){var t=this.host,s=e.exec(t);s&&(":"!==(s=s[0])&&(this.port=s.substr(1)),t=t.substr(0,t.length-s.length)),t&&(this.hostname=t)},exports.parse=g,exports.resolve=q,exports.resolveObject=j,exports.format=b,exports.Url=s;
277
+ },{"punycode":"sBBS","qs":"eX9A"}],"JMLK":[function(require,module,exports) {
252
278
  var define;
253
279
  var e;!function(t,n){"function"==typeof e&&e.amd?e([],n):"object"==typeof module&&module.exports?module.exports=n():t.xmlserializer=n()}(this,function(){var e=function(e){var t=e.tagName;return"http://www.w3.org/1999/xhtml"===e.namespaceURI&&(t=t.toLowerCase()),t},t=function(e){return Array.prototype.map.call(e.childNodes,function(e){return r(e)}).join("")},n=function(n,r){var a="<"+e(n);return a+=function(e,t){return Array.prototype.map.call(e.attributes||e.attrs,function(e){return e.name}).indexOf("xmlns")>=0||!t&&e.namespaceURI===e.parentNode.namespaceURI?"":' xmlns="'+e.namespaceURI+'"'}(n,r),Array.prototype.forEach.call(n.attributes||n.attrs,function(e){a+=function(e){var t=e.value;return" "+e.name+'="'+function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}(t)+'"'}(e)}),n.childNodes.length>0?(a+=">",a+=t(n),a+="</"+e(n)+">"):a+="/>",a},r=function(e,r){var a=r&&r.rootNode;return"#document"===e.nodeName||"#document-fragment"===e.nodeName?t(e):e.tagName?n(e,a):"#text"===e.nodeName?function(e){var t=e.nodeValue||e.value||"";return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}(e):"#comment"===e.nodeName?function(e){return"\x3c!--"+e.data.replace(/-/g,"&#45;")+"--\x3e"}(e):"#cdata-section"===e.nodeName?function(e){return"<![CDATA["+e.nodeValue+"]]>"}(e):void 0};return{serializeToString:function(e){return r(e,{rootNode:!0}).replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"")}}});
254
280
  },{}],"ZgwT":[function(require,module,exports) {
@@ -409,27 +435,9 @@ var e=require("./toPropertyKey.js");function r(r,o,t){return(o=e(o))in r?Object.
409
435
  "use strict";var t;if(!Object.keys){var r=Object.prototype.hasOwnProperty,e=Object.prototype.toString,o=require("./isArguments"),n=Object.prototype.propertyIsEnumerable,l=!n.call({toString:null},"toString"),c=n.call(function(){},"prototype"),i=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(t){var r=t.constructor;return r&&r.prototype===t},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},u=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!f["$"+t]&&r.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{a(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),p=function(t){if("undefined"==typeof window||!u)return a(t);try{return a(t)}catch(r){return!1}};t=function(t){var n=null!==t&&"object"==typeof t,a="[object Function]"===e.call(t),f=o(t),u=n&&"[object String]"===e.call(t),s=[];if(!n&&!a&&!f)throw new TypeError("Object.keys called on a non-object");var $=c&&a;if(u&&t.length>0&&!r.call(t,0))for(var w=0;w<t.length;++w)s.push(String(w));if(f&&t.length>0)for(var g=0;g<t.length;++g)s.push(String(g));else for(var h in t)$&&"prototype"===h||!r.call(t,h)||s.push(String(h));if(l)for(var y=p(t),d=0;d<i.length;++d)y&&"constructor"===i[d]||!r.call(t,i[d])||s.push(i[d]);return s}}module.exports=t;
410
436
  },{"./isArguments":"wBSM"}],"XCKW":[function(require,module,exports) {
411
437
  "use strict";var e=Array.prototype.slice,t=require("./isArguments"),r=Object.keys,n=r?function(e){return r(e)}:require("./implementation"),c=Object.keys;n.shim=function(){Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(r){return t(r)?c(e.call(r)):c(r)}):Object.keys=n;return Object.keys||n},module.exports=n;
412
- },{"./isArguments":"wBSM","./implementation":"DprT"}],"Ht9r":[function(require,module,exports) {
413
- "use strict";module.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0};
414
- },{}],"WIzo":[function(require,module,exports) {
438
+ },{"./isArguments":"wBSM","./implementation":"DprT"}],"WIzo":[function(require,module,exports) {
415
439
  "use strict";var r=require("has-symbols/shams");module.exports=function(){return r()&&!!Symbol.toStringTag};
416
- },{"has-symbols/shams":"Ht9r"}],"khja":[function(require,module,exports) {
417
- "use strict";var o="undefined"!=typeof Symbol&&Symbol,e=require("./shams");module.exports=function(){return"function"==typeof o&&("function"==typeof Symbol&&("symbol"==typeof o("foo")&&("symbol"==typeof Symbol("bar")&&e())))};
418
- },{"./shams":"Ht9r"}],"U7E0":[function(require,module,exports) {
419
- "use strict";var o={foo:{}},t=Object;module.exports=function(){return{__proto__:o}.foo===o.foo&&!({__proto__:null}instanceof t)};
420
- },{}],"sg3h":[function(require,module,exports) {
421
- "use strict";var t="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,o=Object.prototype.toString,r="[object Function]";module.exports=function(e){var p=this;if("function"!=typeof p||o.call(p)!==r)throw new TypeError(t+p);for(var i,c=n.call(arguments,1),a=Math.max(0,p.length-c.length),l=[],u=0;u<a;u++)l.push("$"+u);if(i=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof i){var t=p.apply(this,c.concat(n.call(arguments)));return Object(t)===t?t:this}return p.apply(e,c.concat(n.call(arguments)))}),p.prototype){var y=function(){};y.prototype=p.prototype,i.prototype=new y,y.prototype=null}return i};
422
- },{}],"KNOk":[function(require,module,exports) {
423
- "use strict";var e=require("./implementation");module.exports=Function.prototype.bind||e;
424
- },{"./implementation":"sg3h"}],"KeR3":[function(require,module,exports) {
425
- "use strict";var t=require("function-bind");module.exports=t.call(Function.call,Object.prototype.hasOwnProperty);
426
- },{"function-bind":"KNOk"}],"aOC8":[function(require,module,exports) {
427
- "use strict";var r,t=SyntaxError,e=Function,o=TypeError,n=function(r){try{return e('"use strict"; return ('+r+").constructor;")()}catch(t){}},a=Object.getOwnPropertyDescriptor;if(a)try{a({},"")}catch(w){a=null}var y=function(){throw new o},p=a?function(){try{return arguments.callee,y}catch(r){try{return a(arguments,"callee").get}catch(t){return y}}}():y,i=require("has-symbols")(),f=require("has-proto")(),c=Object.getPrototypeOf||(f?function(r){return r.__proto__}:null),l={},u="undefined"!=typeof Uint8Array&&c?c(Uint8Array):r,s={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":i&&c?c([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?r:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":e,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":i&&c?c(c([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&i&&c?c((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&i&&c?c((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":i&&c?c(""[Symbol.iterator]()):r,"%Symbol%":i?Symbol:r,"%SyntaxError%":t,"%ThrowTypeError%":p,"%TypedArray%":u,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};if(c)try{null.error}catch(w){var A=c(c(w));s["%Error.prototype%"]=A}var d=function r(t){var e;if("%AsyncFunction%"===t)e=n("async function () {}");else if("%GeneratorFunction%"===t)e=n("function* () {}");else if("%AsyncGeneratorFunction%"===t)e=n("async function* () {}");else if("%AsyncGenerator%"===t){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var a=r("%AsyncGenerator%");a&&c&&(e=c(a.prototype))}return s[t]=e,e},P={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},g=require("function-bind"),m=require("has"),S=g.call(Function.call,Array.prototype.concat),E=g.call(Function.apply,Array.prototype.splice),h=g.call(Function.call,String.prototype.replace),I=g.call(Function.call,String.prototype.slice),F=g.call(Function.call,RegExp.prototype.exec),b=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,U=/\\(\\)?/g,v=function(r){var e=I(r,0,1),o=I(r,-1);if("%"===e&&"%"!==o)throw new t("invalid intrinsic syntax, expected closing `%`");if("%"===o&&"%"!==e)throw new t("invalid intrinsic syntax, expected opening `%`");var n=[];return h(r,b,function(r,t,e,o){n[n.length]=e?h(o,U,"$1"):t||r}),n},R=function(r,e){var n,a=r;if(m(P,a)&&(a="%"+(n=P[a])[0]+"%"),m(s,a)){var y=s[a];if(y===l&&(y=d(a)),void 0===y&&!e)throw new o("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:n,name:a,value:y}}throw new t("intrinsic "+r+" does not exist!")};module.exports=function(r,e){if("string"!=typeof r||0===r.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new o('"allowMissing" argument must be a boolean');if(null===F(/^%?[^%]*%?$/,r))throw new t("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=v(r),y=n.length>0?n[0]:"",p=R("%"+y+"%",e),i=p.name,f=p.value,c=!1,l=p.alias;l&&(y=l[0],E(n,S([0,1],l)));for(var u=1,A=!0;u<n.length;u+=1){var d=n[u],P=I(d,0,1),g=I(d,-1);if(('"'===P||"'"===P||"`"===P||'"'===g||"'"===g||"`"===g)&&P!==g)throw new t("property names with quotes must have matching quotes");if("constructor"!==d&&A||(c=!0),m(s,i="%"+(y+="."+d)+"%"))f=s[i];else if(null!=f){if(!(d in f)){if(!e)throw new o("base intrinsic for "+r+" exists, but the property is not available.");return}if(a&&u+1>=n.length){var h=a(f,d);f=(A=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:f[d]}else A=m(f,d),f=f[d];A&&!c&&(s[i]=f)}}return f};
428
- },{"has-symbols":"khja","has-proto":"U7E0","function-bind":"KNOk","has":"KeR3"}],"VqWc":[function(require,module,exports) {
429
- "use strict";var e=require("function-bind"),t=require("get-intrinsic"),r=t("%Function.prototype.apply%"),n=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(n,r),o=t("%Object.getOwnPropertyDescriptor%",!0),p=t("%Object.defineProperty%",!0),u=t("%Math.max%");if(p)try{p({},"a",{value:1})}catch(c){p=null}module.exports=function(t){var r=l(e,n,arguments);o&&p&&(o(r,"length").configurable&&p(r,"length",{value:1+u(0,t.length-(arguments.length-1))}));return r};var a=function(){return l(e,r,arguments)};p?p(module.exports,"apply",{value:a}):module.exports.apply=a;
430
- },{"function-bind":"KNOk","get-intrinsic":"aOC8"}],"nnGn":[function(require,module,exports) {
431
- "use strict";var r=require("get-intrinsic"),t=require("./"),e=t(r("String.prototype.indexOf"));module.exports=function(i,n){var o=r(i,!!n);return"function"==typeof o&&e(i,".prototype.")>-1?t(o):o};
432
- },{"get-intrinsic":"aOC8","./":"VqWc"}],"dZLe":[function(require,module,exports) {
440
+ },{"has-symbols/shams":"Ht9r"}],"dZLe":[function(require,module,exports) {
433
441
  "use strict";var t=require("has-tostringtag/shams")(),e=require("call-bind/callBound"),n=e("Object.prototype.toString"),r=function(e){return!(t&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===n(e)},o=function(t){return!!r(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==n(t)&&"[object Function]"===n(t.callee)},u=function(){return r(arguments)}();r.isLegacyArguments=o,module.exports=u?r:o;
434
442
  },{"has-tostringtag/shams":"WIzo","call-bind/callBound":"nnGn"}],"h9S1":[function(require,module,exports) {
435
443
  "use strict";var r=require("get-intrinsic"),e=r("%Object.defineProperty%",!0),t=function(){if(e)try{return e({},"a",{value:1}),!0}catch(r){return!1}return!1};t.hasArrayLengthDefineBug=function(){if(!t())return null;try{return 1!==e([],"length",{value:1}).length}catch(r){return!0}},module.exports=t;
@@ -3297,11 +3305,11 @@ var e="undefined"!=typeof Element,r="function"==typeof Map,t="function"==typeof
3297
3305
  },{"react":"HdMw","mobx-react-lite":"ZfSi","@blueprintjs/core":"Ydrz","@blueprintjs/popover2":"mZnF","../utils/l10n":"FlVj"}],"Ic0q":[function(require,module,exports) {
3298
3306
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setAPI=exports.iconscoutDownload=exports.iconscoutList=exports.svgapiDownload=exports.svgapiList=exports.unsplashDownload=exports.unsplashList=exports.textTemplateList=exports.templateList=exports.removeBackground=exports.polotnoShapesList=exports.getGoogleFontImage=exports.getGoogleFontsListAPI=exports.URLS=exports.URL=exports.API=void 0;const e=require("./validate-key");exports.API="https://api.polotno.dev/api",exports.URL="https://api.polotno.dev";const o={},t=(e,t)=>{o[e]||(o[e]=!0,console.error(t))},s=(e,o,t)=>e.replace(new RegExp(o,"g"),t),p="API for iconscout is provided as a demonstration.\nFor production usage you have to use your own API endpoint.\nhttps://iconscout.com/developers, https://iconscout.com/legal/api-license-development-agreement\nhttps://polotno.dev/docs/server-api",r="API for unsplash is provided as a demonstration.\nFor production usage you have to use your own API endpoint.\nhttps://unsplash.com/developers, https://unsplash.com/documentation#license\nhttps://polotno.dev/docs/server-api";exports.URLS={unsplashList:({query:o,page:t=1})=>`${exports.API}/get-unsplash?query=${o}&per_page=20&page=${t}&KEY=${(0,e.getKey)()}`,unsplashDownload:o=>`${exports.API}/download-unsplash?id=${o}&KEY=${(0,e.getKey)()}`,svgapiList:({query:o,page:t=0})=>`${exports.API}/get-svgapi?query=${o}&page=${t}&per_page=20&KEY=${(0,e.getKey)()}`,svgapiDownload:o=>`${exports.API}/download-svgapi?path=${o}&KEY=${(0,e.getKey)()}`,iconscoutList:({query:o,page:s=1})=>(t("iconscout",p),`${exports.API}/get-iconscout?query=${o}&page=${s}&KEY=${(0,e.getKey)()}`),iconscoutDownload:o=>(t("iconscout",p),`${exports.API}/download-iconscout?uuid=${o}&KEY=${(0,e.getKey)()}`),templateList:({query:o,page:t=1,sizeQuery:s})=>`${exports.API}/get-templates?${s}&query=${o}&per_page=30&page=${t}&KEY=${(0,e.getKey)()}`};const n=()=>`${exports.API}/get-google-fonts?KEY=${(0,e.getKey)()}`;exports.getGoogleFontsListAPI=n;const a=e=>{return`${exports.URL}/google-fonts-previews/black/${o=e," ","-",o.replace(new RegExp(" ","g"),"-")}.png`;var o};exports.getGoogleFontImage=a;const i=()=>`${exports.API}/get-basic-shapes?KEY=${(0,e.getKey)()}`;exports.polotnoShapesList=i;const c=()=>`${exports.API}/remove-image-background?KEY=${(0,e.getKey)()}`;exports.removeBackground=c;const g=e=>exports.URLS.templateList(e);exports.templateList=g;const l=()=>`${exports.API}/get-text-templates?KEY=${(0,e.getKey)()}`;exports.textTemplateList=l;const u=e=>exports.URLS.unsplashList(e);exports.unsplashList=u;const x=e=>exports.URLS.unsplashDownload(e);exports.unsplashDownload=x;const d=e=>exports.URLS.svgapiList(e);exports.svgapiList=d;const $=e=>exports.URLS.svgapiDownload(e);exports.svgapiDownload=$;const L=e=>exports.URLS.iconscoutList(e);exports.iconscoutList=L;const v=e=>exports.URLS.iconscoutDownload(e);exports.iconscoutDownload=v;const h=(e,o)=>{exports.URLS[e]=o};exports.setAPI=h;
3299
3307
  },{"./validate-key":"zree"}],"zree":[function(require,module,exports) {
3300
- "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o);var i=Object.getOwnPropertyDescriptor(t,o);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,n,i)}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(null!=o)for(var i in o)"default"!==i&&Object.prototype.hasOwnProperty.call(o,i)&&e(n,o,i);return t(n,o),n};Object.defineProperty(exports,"__esModule",{value:!0}),exports.validateKey=exports.isKeyPaid=exports.getKey=exports.shouldShowCredit=void 0;const n=o(require("mobx")),i=require("./api"),r=require("./flags");exports.shouldShowCredit=n.observable({value:!1});const a=n.action(()=>{exports.shouldShowCredit.value=!0});let s="";const l=()=>s||"";exports.getKey=l;const d=5,c=3e3,u="Polotno API is initialized without API key. It may lead to unexpected behavior and stop working. Please create API key here: https://polotno.dev/cabinet",p="Polotno API key is not valid. Please get new API key here: https://polotno.dev/cabinet",h="Can not validate Polotno API key. Please report to anton@polotno.dev immediately.",v="%cPolotno Free Version. Development or non-commercial usage only. https://polotno.dev/";let g=window.location.origin;const f=navigator.userAgent.indexOf("Headless")>-1,y=navigator.userAgent.indexOf("Electron")>-1;"file://"===g&&f&&(g="headless"),"file://"===g&&y&&(g="electron");const b=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${g}" here: https://polotno.dev/cabinet`;async function P(e){for(let t=0;t<5;t++)try{const t=await fetch(i.API+"/validate-key",{method:"POST",body:JSON.stringify({key:e,site:location.host+location.pathname})});if(!e)return console.warn(u),!1;if(200!==t.status){await new Promise(e=>setTimeout(e,3e3));continue}const o=await t.json();return o.is_valid||console.warn(p),o.is_paid||console.log(v,"background: rgb(0, 161, 255); color: white; padding: 5px; margin: 5px;"),o.is_domain_valid||console.log(b,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),(0,r.useRemoveBackground)(o.remove_background_enabled),o.is_paid||!1}catch(e){await new Promise(e=>setTimeout(e,3e3))}return console.error(h),!0}async function w(e,t){s=e,await P(e)&&!t||a()}exports.isKeyPaid=P,exports.validateKey=w;
3308
+ "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o);var i=Object.getOwnPropertyDescriptor(t,o);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,n,i)}:function(e,t,o,n){void 0===n&&(n=o),e[n]=t[o]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(null!=o)for(var i in o)"default"!==i&&Object.prototype.hasOwnProperty.call(o,i)&&e(n,o,i);return t(n,o),n};Object.defineProperty(exports,"__esModule",{value:!0}),exports.validateKey=exports.isKeyPaid=exports.getKey=exports.shouldShowCredit=void 0;const n=o(require("mobx")),i=require("./api"),r=require("./flags");exports.shouldShowCredit=n.observable({value:!1});const a=n.action(()=>{exports.shouldShowCredit.value=!0});let s="";const l=()=>s||"";exports.getKey=l;const d=5,c=3e3,u="Polotno API is initialized without API key. It may lead to unexpected behavior and stop working. Please create API key here: https://polotno.dev/cabinet",p="Polotno API key is not valid. Please get new API key here: https://polotno.dev/cabinet",v="Can not validate Polotno API key. Please report to anton@polotno.dev immediately.",g="%cPolotno Free Version. Development or non-commercial usage only. https://polotno.dev/";let h=window.location.origin;const f=navigator.userAgent.indexOf("Headless")>-1,y=navigator.userAgent.indexOf("Electron")>-1;"file://"===h&&f&&(h="headless"),"file://"===h&&y&&(h="electron");const b=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${h}" here: https://polotno.dev/cabinet`;async function P(e){for(let t=0;t<5;t++)try{const t=await fetch(i.API+"/validate-key",{method:"POST",body:JSON.stringify({key:e,site:location.host})});if(!e)return console.warn(u),!1;if(200!==t.status){await new Promise(e=>setTimeout(e,3e3));continue}const o=await t.json();return o.is_valid||console.warn(p),o.is_paid||console.log(g,"background: rgb(0, 161, 255); color: white; padding: 5px; margin: 5px;"),o.is_domain_valid||console.log(b,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),(0,r.useRemoveBackground)(o.remove_background_enabled),o.is_paid||!1}catch(e){await new Promise(e=>setTimeout(e,3e3))}return console.error(v),!0}async function w(e,t){s=e,await P(e)&&!t||a()}exports.isKeyPaid=P,exports.validateKey=w;
3301
3309
  },{"mobx":"BzvP","./api":"Ic0q","./flags":"IDY9"}],"BUt3":[function(require,module,exports) {
3302
3310
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.pxToUnitString=exports.unitToPx=exports.pxToUnitRounded=exports.pxToUnit=void 0;const t=({px:t,unit:e="px",dpi:n})=>{switch(e){case"pt":default:return t;case"mm":return t/(n/25.4);case"cm":return t/(n/2.54);case"in":return t/n}};exports.pxToUnit=t;const e=({px:t,precious:e=2,dpi:n=72,unit:o="px"})=>parseFloat((0,exports.pxToUnit)({px:t,dpi:n,unit:o}).toFixed(e));exports.pxToUnitRounded=e;const n=({unitVal:t,dpi:e,unit:n})=>t/(0,exports.pxToUnit)({px:1,unit:n,dpi:e});exports.unitToPx=n;const o=t=>{const e=parseFloat((0,exports.pxToUnit)(t).toFixed(1));switch(t.unit){case"pt":return`${Math.round(e)}pt`;case"mm":return`${e}mm`;case"cm":return`${e}cm`;case"in":return`${e}in`;default:return`${Math.round(e)}px`}};exports.pxToUnitString=o;
3303
3311
  },{}],"Co9b":[function(require,module,exports) {
3304
- "use strict";var e=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n},t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.registerNextDomDrop=exports.registerTransformerAttrs=void 0;const n=t(require("react")),i=require("mobx-react-lite"),r=require("mobx"),l=require("react-konva"),o=t(require("use-image")),a=t(require("konva")),s=t(require("./element")),d=require("./use-transformer-snap"),c=require("./image-element"),u=require("../utils/crop"),m=require("./page-controls"),g=require("../utils/validate-key"),h=require("../utils/math"),f=require("../utils/unit"),p=require("../utils/flags"),b=require("../utils/screen"),x={enabledAnchors:["top-left","top-center","top-right","middle-left","bottom-left","bottom-right","bottom-center","middle-right"],borderEnabled:!0,rotateEnabled:!0,rotationSnaps:[0,45,90,135,180,225,270,315],ignoreStroke:!0,anchorStrokeWidth:2,borderStrokeWidth:2},v={text:{enabledAnchors:["top-left","top-right","middle-left","bottom-left","bottom-right","middle-right"]},svg:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},line:{enabledAnchors:[],borderEnabled:!1,rotateEnabled:!1},image:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},many:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},group:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]}};function y(e,t){v[e]=v[e]||t,Object.assign(v[e],t)}exports.registerTransformerAttrs=y;const E=e=>n.default.createElement(l.Rect,Object.assign({},e,{preventDefault:!1})),w=t=>{var{url:i}=t,r=e(t,["url"]);const[a,s]=(0,o.default)(i,"anonymous"),d=a?(0,u.getCrop)(a,{width:r.width,height:r.height},"center-middle"):{};return(0,c.useImageLoader)(s,"background"),n.default.createElement(l.Image,Object.assign({image:a},r,d))},X=e=>n.default.createElement(l.Rect,Object.assign({},e)),Y=t=>{const{background:i,scale:r,borderColor:o}=t,s=e(t,["background","scale","borderColor"]),d=n.default.useMemo(()=>!!a.default.Util.colorToRGBA(i),[i]),c=n.default.useMemo(()=>{const e=document.createElement("canvas"),t=30;e.width=60,e.height=60;const n=e.getContext("2d");return n&&(n.fillStyle="black",n.fillRect(t,0,t,t),n.fillRect(0,t,t,t)),e},[]);return n.default.createElement(n.default.Fragment,null,n.default.createElement(l.Rect,Object.assign({fillPatternImage:c},s,{opacity:.1,hideInExport:!0})),d?n.default.createElement(X,Object.assign({fill:i},s)):n.default.createElement(w,Object.assign({url:i},s)))},k=(0,i.observer)(({selection:e})=>e.visible?n.default.createElement(l.Rect,{name:"selection",x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),width:Math.abs(e.x1-e.x2),height:Math.abs(e.y1-e.y2),fill:"rgba(0, 161, 255, 0.3)"}):null),A=(0,i.observer)(({x:e,y:t,width:i,height:r,rotation:o,anchor:s,store:d})=>{const c=(0,h.getClientRect)({x:e,y:t,width:i,height:r,rotation:a.default.Util.radToDeg(o)});if(void 0===s)return null;const u=(r/2+90)*Math.cos(o-Math.PI/2),m=(r/2+90)*Math.sin(o-Math.PI/2),g=(0,f.pxToUnitRounded)({unit:d.unit,dpi:d.dpi,px:i/d.scale,precious:"px"===d.unit?0:1})+" x "+(0,f.pxToUnitRounded)({unit:d.unit,dpi:d.dpi,px:r/d.scale,precious:"px"===d.unit?0:1})+("px"===d.unit?"":" "+d.unit);return n.default.createElement(n.default.Fragment,null,n.default.createElement(l.Label,{x:(c.minX+c.maxX)/2+u,y:(c.minY+c.maxY)/2+m,offsetX:14,offsetY:14,visible:"rotater"===s},n.default.createElement(l.Tag,{cornerRadius:5,fill:"rgb(0, 161, 255)"}),n.default.createElement(l.Text,{align:"center",verticalAlign:"middle",fill:"white",padding:8,text:Math.round(a.default.Util.radToDeg(o)).toString()+"°"})),n.default.createElement(l.Label,{x:(c.minX+c.maxX)/2,y:c.maxY+20,visible:"rotater"!==s},n.default.createElement(l.Tag,{cornerRadius:5,fill:"rgb(0, 161, 255)",pointerDirection:"up",pointerHeight:0,pointerWidth:0}),n.default.createElement(l.Text,{align:"center",verticalAlign:"middle",fill:"white",padding:8,text:g})))}),O=(0,i.observer)(({elements:e,store:t})=>{const i=e.filter(e=>e.alwaysOnTop),r=e.filter(e=>!e.alwaysOnTop).concat(i);return n.default.createElement(n.default.Fragment,null,r.map(e=>n.default.createElement(s.default,{key:e.id,store:t,element:e,onClick:()=>{console.warn("Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.")}})))});let S=null;const P=e=>{S=e};exports.registerNextDomDrop=P,exports.default=(0,i.observer)(({store:e,page:t,width:o,height:s,pageControlsEnabled:c,backColor:u,pageBorderColor:y,activePageBorderColor:w,components:X,bleedColor:P})=>{const R=e.bleedVisible?t.bleed:0,T=t.computedWidth+2*R,D=t.computedHeight+2*R,I=(o-T*e.scale)/2,C=(s-D*e.scale)/2,M=n.default.useRef(null),L=n.default.useRef(null),j=n.default.useRef(null),q=null==c||c,[W,B]=n.default.useState(null),[_,G]=n.default.useState({}),U=e.selectedElements.find(e=>e._cropModeEnabled),H=e.selectedShapes.filter(e=>!e.resizable).length>0,N=e.selectedShapes.filter(e=>!e.draggable).length>0,K=e.selectedElements.filter(e=>!e.visible).length>0;n.default.useLayoutEffect(()=>{var t,n,i;if(!M.current)return;const r=M.current.getStage(),l=e.selectedShapes.map(e=>e._cropModeEnabled?null:r.findOne("#"+e.id)).filter(e=>e),o=1===e.selectedElements.length&&(null===(t=e.selectedElements[0])||void 0===t?void 0:t.type)||"many";v[o]?(M.current.setAttrs(Object.assign(Object.assign({},x),v[o])),"svg"!==o&&"image"!==o||e.selectedElements[0].keepRatio||M.current.setAttrs({enabledAnchors:x.enabledAnchors}),"text"===o&&p.flags.textVerticalResizeEnabled&&M.current.setAttrs({enabledAnchors:null===(n=v.text.enabledAnchors)||void 0===n?void 0:n.concat(["bottom-center"])})):M.current.setAttrs(x),H&&M.current.enabledAnchors([]),N&&M.current.rotateEnabled(!1),l.find(e=>null==e?void 0:e.isDragging())&&l.forEach(e=>{null==e||e.startDrag()}),M.current.nodes(l),null===(i=M.current.getLayer())||void 0===i||i.batchDraw()},[e.selectedElements,U,H,K,N]);const F=(0,i.useLocalObservable)(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),z=n.default.useRef(!1),J=(0,b.useMobile)(),V=(0,r.action)(n=>{var i,r;if(J)return;z.current=!1,e.activePage!==t&&t.select();const l=n.target.findAncestor(".elements-container"),o=n.target.findAncestor("Transformer"),a=n.target.findAncestor(".page-abs-container");if(l||o||a)return;const s=null===(i=n.target.getStage())||void 0===i?void 0:i.getPointerPosition();s&&(F.visible=!0,F.x1=s.x,F.y1=s.y,F.x2=s.x,F.y2=s.y,(null===(r=n.target.getStage())||void 0===r?void 0:r.getPointersPositions().length)>=2&&(F.visible=!1))});n.default.useEffect(()=>{const t=(0,r.action)(e=>{var t,n;if(!F.visible)return;null===(t=L.current)||void 0===t||t.setPointersPositions(e);let i=(null===(n=L.current)||void 0===n?void 0:n.getPointerPosition())||{x:F.x2,y:F.y2};F.x2=i.x,F.y2=i.y}),n=(0,r.action)(()=>{if(!F.visible)return;if(!L.current)return;const t=L.current.findOne(".selection"),n=t?t.getClientRect():{width:0,height:0,x:0,y:0};if(n.width&&n.height){const t=[];L.current.find(".element").forEach(i=>{const r=i.getClientRect(),l=e.getElementById(i.id()),o=null==l?void 0:l.draggable,s=null==l?void 0:l.selectable;a.default.Util.haveIntersection(n,r)&&o&&s&&t.push(i.id())}),e.selectElements(t)}F.visible=!1,z.current=!0});return window.addEventListener("mousemove",t),window.addEventListener("touchmove",t),window.addEventListener("mouseup",n),window.addEventListener("touchend",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("touchmove",t),window.removeEventListener("mouseup",n),window.removeEventListener("touchend",n)}},[]);const Q=t=>{if(z.current)return;const n=t.evt.ctrlKey||t.evt.metaKey||t.evt.shiftKey,i=t.target.findAncestor(".elements-container"),r=t.target.findAncestor(".page-abs-container"),l=t.target.findAncestor("Transformer");if(!(n||i||l||r))return void e.selectElements([]);const o=t.target.findAncestor(".element",!0),a=e.getElementById(null==o?void 0:o.id()),s=null==a?void 0:a.top,d=null==s?void 0:s.id,c=e.selectedElementsIds.indexOf(d)>=0;d&&n&&!c?e.selectElements(e.selectedElementsIds.concat([d])):d&&n&&c?e.selectElements(e.selectedElementsIds.filter(e=>e!==d)):!d||n||c||e.selectElements([d])};(0,d.useSnap)(M);const Z=e.activePage===t,$=(null==X?void 0:X.PageControls)||m.PageControls,ee=1/e.scale,te=0/e.scale;return n.default.createElement("div",{ref:j,onDragOver:e=>e.preventDefault(),onDrop:t=>{if(t.preventDefault(),!L.current)return;L.current.setPointersPositions(t);const n=L.current.findOne(".elements-container").getRelativePointerPosition(),i=L.current.getPointerPosition(),r=L.current.getIntersection(i),l=r&&r.findAncestor(".element",!0),o=l?e.getElementById(l.id()):void 0;S&&(S(n,o),S=null)},style:{position:"relative",width:o+"px"},className:"polotno-page-container"+(Z?" active-page":"")},n.default.createElement(l.Stage,{ref:L,width:o,height:s,onClick:Q,onTap:Q,onMouseDown:V,onMouseMove:n=>{if(!n.evt.altKey&&W)return void B(null);if(!n.evt.altKey)return;const i=n.target.findAncestor(".element",!0),r=null==i?void 0:i.id();if(!e.selectedElements[0])return;if(e.selectedElementsIds.includes(r))return;const l=(0,h.getTotalClientRect)(e.selectedElements),o=r?e.getElementById(r):{x:0,y:0,width:t.computedWidth,height:t.computedHeight,rotation:0},a=(0,h.getClientRect)(o),s=[];l.minX>a.maxX&&s.push({distance:l.minX-a.maxX,box1:l,box2:a,points:[{x:l.minX,y:l.minY+l.height/2},{x:a.maxX,y:l.minY+l.height/2},{x:a.maxX,y:a.minY+a.height/2}]}),l.maxX<a.minX&&s.push({distance:a.minX-l.maxX,box1:l,box2:a,points:[{x:l.maxX,y:l.minY+l.height/2},{x:a.minX,y:l.minY+l.height/2},{x:a.minX,y:a.minY+a.height/2}]}),l.minY>a.maxY&&s.push({box1:l,box2:a,distance:l.minY-a.maxY,points:[{x:l.minX+l.width/2,y:l.minY},{x:l.minX+l.width/2,y:a.maxY},{x:a.minX+a.width/2,y:a.maxY}]}),l.maxY<a.minY&&s.push({box1:l,box2:a,distance:a.minY-l.maxY,points:[{x:l.minX+l.width/2,y:l.maxY},{x:l.minX+l.width/2,y:a.minY},{x:a.minX+a.width/2,y:a.minY}]}),l.minX>=a.minX&&l.maxX<=a.maxX&&l.minY>=a.minY&&l.maxY<=a.maxY&&(s.push({distance:l.minX-a.minX,box1:l,box2:a,points:[{x:l.minX,y:l.minY+l.height/2},{x:a.minX,y:l.minY+l.height/2},{x:a.minX,y:a.minY+a.height/2}]}),s.push({distance:a.maxX-l.maxX,box1:l,box2:a,points:[{x:l.maxX,y:l.minY+l.height/2},{x:a.maxX,y:l.minY+l.height/2},{x:a.maxX,y:a.minY+a.height/2}]}),s.push({box1:l,box2:a,distance:l.minY-a.minY,points:[{x:l.minX+l.width/2,y:l.minY},{x:l.minX+l.width/2,y:a.minY},{x:a.minX+a.width/2,y:a.minY}]}),s.push({box1:l,box2:a,distance:a.maxY-l.maxY,points:[{x:l.minX+l.width/2,y:l.maxY},{x:l.minX+l.width/2,y:a.maxY},{x:a.minX+a.width/2,y:a.maxY}]})),JSON.stringify(W)!==JSON.stringify(s)&&B(s)},onTouchStart:V,onDragStart:t=>{var n;const i=t.target.findAncestor(".element",!0);if(i){const r=e.getElementById(null==i?void 0:i.id()),l=null==r?void 0:r.top,o=null==l?void 0:l.id;!(e.selectedElementsIds.indexOf(o)>=0)&&o&&(e.selectElements([o]),t.target.stopDrag(),t.target.startDrag(),null===(n=M.current)||void 0===n||n.startDrag(t))}W&&B(null)},pageId:t.id,style:{position:"relative"}},n.default.createElement(l.Layer,null,n.default.createElement(E,{width:o,height:s,fill:u}),n.default.createElement(l.Group,{x:I,y:C,scaleX:e.scale,scaleY:e.scale,name:"page-container"},n.default.createElement(l.Group,{name:"page-background-group",x:R,y:R},n.default.createElement(Y,{x:-t.bleed,y:-t.bleed,width:t.computedWidth+2*t.bleed,height:t.computedHeight+2*t.bleed,background:t.background,shadowBlur:10,shadowColor:"lightgrey",name:"page-background",preventDefault:!1,scale:e.scale})),n.default.createElement(l.Group,{x:R,y:R,name:"elements-container"},n.default.createElement(l.Rect,{name:"elements-area",width:t.computedWidth,height:t.computedHeight,listening:!1}),n.default.createElement(O,{elements:t.children,store:e})),n.default.createElement(l.Rect,{stroke:P,name:"bleed",strokeWidth:t.bleed,x:t.bleed/2,y:t.bleed/2,width:t.computedWidth+t.bleed,height:t.computedHeight+t.bleed,listening:!1,visible:t.bleed>0&&e.bleedVisible,hideInExport:!0})),n.default.createElement(l.Line,{name:"workspace-background",points:[0,0,o,0,o,s,0,s,0,0,I,C,I,s-C,o-I,s-C,o-I,C,I,C],listening:!1,closed:!0,fill:u}),n.default.createElement(l.Group,{x:I,y:C,scaleX:e.scale,scaleY:e.scale,name:"page-container"},n.default.createElement(l.Rect,{name:"page-highlight",hideInExport:!0,x:-ee/2-te,y:-ee/2-te,width:T+ee+2*te,height:D+ee+2*te,stroke:Z&&e.pages.length>1?w:y,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})),n.default.createElement(l.Group,{x:I+R*e.scale,y:C+R*e.scale,scaleX:e.scale,scaleY:e.scale,name:"page-abs-container"},n.default.createElement(l.Transformer,{ref:M,boundBoxFunc:(e,t)=>{const n=t.width<1||t.height<1,i=e.width<1||e.height<1;return n&&!i?e:t},onTransform:e=>{var t,n;const i=null===(t=M.current)||void 0===t?void 0:t.__getNodeRect(),r=null===(n=M.current)||void 0===n?void 0:n.getActiveAnchor();G({anchor:r,x:i.x,y:i.y,rotation:i.rotation,width:i.width,height:i.height})},onTransformEnd:e=>{G({})}}),W&&W.map(({points:t,distance:i,box1:r,box2:o},a)=>n.default.createElement(l.Group,{name:"distances-container",hideInExport:!0,key:a,listening:!1},n.default.createElement(l.Rect,Object.assign({},r,{stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1})),n.default.createElement(l.Rect,Object.assign({},o,{stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1})),n.default.createElement(l.Line,{points:[t[0].x,t[0].y,t[1].x,t[1].y],stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1}),n.default.createElement(l.Line,{points:[t[1].x,t[1].y,t[2].x,t[2].y],stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1}),n.default.createElement(l.Label,{x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2,offsetY:-10,scaleX:1/e.scale,scaleY:1/e.scale},n.default.createElement(l.Tag,{cornerRadius:5,fill:"rgb(0, 161, 255)",pointerDirection:"down"}),n.default.createElement(l.Text,{align:"center",verticalAlign:"middle",fill:"white",padding:5,text:(0,f.pxToUnitString)({unit:e.unit,dpi:e.dpi,px:i})}))))),n.default.createElement(A,Object.assign({},_,{store:e})),n.default.createElement(k,{selection:F}),g.shouldShowCredit.value&&n.default.createElement(l.Text,{text:"Powered by polotno.dev",fontSize:14,fill:"rgba(0,0,0,0.6)",x:o-170,y:s-18,onMouseEnter:e=>{e.target.getStage().container().style.cursor="pointer"},onMouseLeave:e=>{e.target.getStage().container().style.cursor=""},onTouchStart:e=>{e.cancelBubble=!0},onMouseDown:e=>{e.cancelBubble=!0},onClick:()=>{window.open("https://polotno.dev")},onTap:()=>{window.open("https://polotno.dev")}}),n.default.createElement(l.Group,{name:"line-guides"}))),q&&Z&&n.default.createElement($,{store:e,page:t,xPadding:I,yPadding:C}))});
3312
+ "use strict";var e=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n},t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.registerNextDomDrop=exports.registerTransformerAttrs=void 0;const n=t(require("react")),i=require("mobx-react-lite"),r=require("mobx"),l=require("react-konva"),a=t(require("use-image")),o=t(require("konva")),s=t(require("./element")),d=require("./use-transformer-snap"),c=require("./image-element"),u=require("../utils/crop"),m=require("./page-controls"),g=require("../utils/validate-key"),h=require("../utils/math"),f=require("../utils/unit"),p=require("../utils/flags"),b=require("../utils/screen"),x=new o.default.Group,v=20;x.add(new o.default.Rect({width:20,height:20,fill:"white"})),x.add(new o.default.Path({scaleX:20/24,scaleY:20/24,data:"M4.98313549,11.0001422 C5.49589839,10.9914935 5.92501998,11.3703506 5.99116425,11.8666444 L5.99985778,11.9831355 L6.00348884,12.2068855 C6.11245031,15.4321748 8.76323537,17.9999971 11.9999971,17.9999971 C12.1869612,17.9999971 12.3726725,17.9914753 12.5567465,17.9745765 L12.2928932,17.7071068 C11.9023689,17.3165825 11.9023689,16.6834175 12.2928932,16.2928932 C12.6834175,15.9023689 13.3165825,15.9023689 13.7071068,16.2928932 L15.7071068,18.2928932 C16.0976311,18.6834175 16.0976311,19.3165825 15.7071068,19.7071068 L13.7071068,21.7071068 C13.3165825,22.0976311 12.6834175,22.0976311 12.2928932,21.7071068 C11.9023689,21.3165825 11.9023689,20.6834175 12.2928932,20.2928932 L12.6111505,19.9769552 C12.4086045,19.9922816 12.2047796,19.9999971 11.9999971,19.9999971 C7.7687005,19.9999971 4.28886152,16.7094374 4.01666425,12.5105203 L4.00420123,12.2575143 L4.00014222,12.0168645 C3.9908282,11.4646583 4.43092928,11.0094562 4.98313549,11.0001422 Z M11.7071068,2.29289322 C12.0675907,2.65337718 12.0953203,3.22060824 11.7902954,3.61289944 L11.7071068,3.70710678 L11.3891629,4.0230186 C11.5916051,4.00770767 11.7953244,4 12,4 C16.418278,4 20,7.581722 20,12 C20,12.5522847 19.5522847,13 19,13 C18.4477153,13 18,12.5522847 18,12 C18,8.6862915 15.3137085,6 12,6 C11.8129339,6 11.6271216,6.00853145 11.4429483,6.02544919 L11.7071068,6.29289322 C12.0976311,6.68341751 12.0976311,7.31658249 11.7071068,7.70710678 C11.3466228,8.06759074 10.7793918,8.09532028 10.3871006,7.79029539 L10.2928932,7.70710678 L8.29289322,5.70710678 C7.93240926,5.34662282 7.90467972,4.77939176 8.20970461,4.38710056 L8.29289322,4.29289322 L10.2928932,2.29289322 C10.6834175,1.90236893 11.3165825,1.90236893 11.7071068,2.29289322 Z",fill:"black"}));const y=x.toCanvas({pixelRatio:2,width:20,height:20}),E={enabledAnchors:["top-left","top-center","top-right","middle-left","bottom-left","bottom-right","bottom-center","middle-right"],borderEnabled:!0,rotateEnabled:!0,rotationSnaps:[0,45,90,135,180,225,270,315],ignoreStroke:!0,anchorStrokeWidth:2,borderStrokeWidth:2,anchorStyleFunc:e=>{if(e.hasName("rotater")){const t=20;e.setAttrs({width:t,height:t,cornerRadius:t/2,offsetX:t/2,offsetY:t/2,fillPatternImage:y,fillPatternScaleX:t/20/2,fillPatternScaleY:t/20/2,fillPriority:"pattern",fillPatternRepeat:"no-repeat"})}}},w={text:{enabledAnchors:["top-left","top-right","middle-left","bottom-left","bottom-right","middle-right"]},svg:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},line:{enabledAnchors:[],borderEnabled:!1,rotateEnabled:!1},image:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},many:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},group:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]}};function X(e,t){w[e]=w[e]||t,Object.assign(w[e],t)}exports.registerTransformerAttrs=X;const Y=e=>n.default.createElement(l.Rect,Object.assign({},e,{preventDefault:!1})),C=t=>{var{url:i}=t,r=e(t,["url"]);const[o,s]=(0,a.default)(i,"anonymous"),d=o?(0,u.getCrop)(o,{width:r.width,height:r.height},"center-middle"):{};return(0,c.useImageLoader)(s,"background"),n.default.createElement(l.Image,Object.assign({image:o},r,d))},k=e=>n.default.createElement(l.Rect,Object.assign({},e)),P=t=>{const{background:i,scale:r,borderColor:a}=t,s=e(t,["background","scale","borderColor"]),d=n.default.useMemo(()=>!!o.default.Util.colorToRGBA(i),[i]),c=n.default.useMemo(()=>{const e=document.createElement("canvas"),t=30;e.width=60,e.height=60;const n=e.getContext("2d");return n&&(n.fillStyle="black",n.fillRect(t,0,t,t),n.fillRect(0,t,t,t)),e},[]);return n.default.createElement(n.default.Fragment,null,n.default.createElement(l.Rect,Object.assign({fillPatternImage:c},s,{opacity:.1,hideInExport:!0})),d?n.default.createElement(k,Object.assign({fill:i},s)):n.default.createElement(C,Object.assign({url:i},s)))},S=(0,i.observer)(({selection:e})=>e.visible?n.default.createElement(l.Rect,{name:"selection",x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),width:Math.abs(e.x1-e.x2),height:Math.abs(e.y1-e.y2),fill:"rgba(0, 161, 255, 0.3)"}):null),A=(0,i.observer)(({x:e,y:t,width:i,height:r,rotation:a,anchor:s,store:d})=>{const c=(0,h.getClientRect)({x:e,y:t,width:i,height:r,rotation:o.default.Util.radToDeg(a)});if(void 0===s)return null;const u=(r/2+90)*Math.cos(a-Math.PI/2),m=(r/2+90)*Math.sin(a-Math.PI/2),g=(0,f.pxToUnitRounded)({unit:d.unit,dpi:d.dpi,px:i/d.scale,precious:"px"===d.unit?0:1})+" x "+(0,f.pxToUnitRounded)({unit:d.unit,dpi:d.dpi,px:r/d.scale,precious:"px"===d.unit?0:1})+("px"===d.unit?"":" "+d.unit);return n.default.createElement(n.default.Fragment,null,n.default.createElement(l.Label,{x:(c.minX+c.maxX)/2+u,y:(c.minY+c.maxY)/2+m,offsetX:14,offsetY:14,visible:"rotater"===s},n.default.createElement(l.Tag,{cornerRadius:5,fill:"rgb(0, 161, 255)"}),n.default.createElement(l.Text,{align:"center",verticalAlign:"middle",fill:"white",padding:8,text:Math.round(o.default.Util.radToDeg(a)).toString()+"°"})),n.default.createElement(l.Label,{x:(c.minX+c.maxX)/2,y:c.maxY+20,visible:"rotater"!==s},n.default.createElement(l.Tag,{cornerRadius:5,fill:"rgb(0, 161, 255)",pointerDirection:"up",pointerHeight:0,pointerWidth:0}),n.default.createElement(l.Text,{align:"center",verticalAlign:"middle",fill:"white",padding:8,text:g})))}),L=(0,i.observer)(({elements:e,store:t})=>{const i=e.filter(e=>e.alwaysOnTop),r=e.filter(e=>!e.alwaysOnTop).concat(i);return n.default.createElement(n.default.Fragment,null,r.map(e=>n.default.createElement(s.default,{key:e.id,store:t,element:e,onClick:()=>{console.warn("Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.")}})))});let R=null;const O=e=>{R=e};exports.registerNextDomDrop=O,exports.default=(0,i.observer)(({store:e,page:t,width:a,height:s,pageControlsEnabled:c,backColor:u,pageBorderColor:x,activePageBorderColor:v,components:y,bleedColor:X})=>{const C=e.bleedVisible?t.bleed:0,k=t.computedWidth+2*C,O=t.computedHeight+2*C,T=(a-k*e.scale)/2,D=(s-O*e.scale)/2,I=n.default.useRef(null),M=n.default.useRef(null),j=n.default.useRef(null),q=null==c||c,[W,B]=n.default.useState(null),[_,G]=n.default.useState({}),N=e.selectedElements.find(e=>e._cropModeEnabled),U=e.selectedShapes.filter(e=>!e.resizable).length>0,H=e.selectedShapes.filter(e=>!e.draggable).length>0,F=e.selectedElements.filter(e=>!e.visible).length>0;n.default.useLayoutEffect(()=>{var t,n,i;if(!I.current)return;const r=I.current.getStage(),l=e.selectedShapes.map(e=>e._cropModeEnabled?null:r.findOne("#"+e.id)).filter(e=>e),a=1===e.selectedElements.length&&(null===(t=e.selectedElements[0])||void 0===t?void 0:t.type)||"many";w[a]?(I.current.setAttrs(Object.assign(Object.assign({},E),w[a])),"svg"!==a&&"image"!==a||e.selectedElements[0].keepRatio||I.current.setAttrs({enabledAnchors:E.enabledAnchors}),"text"===a&&p.flags.textVerticalResizeEnabled&&I.current.setAttrs({enabledAnchors:null===(n=w.text.enabledAnchors)||void 0===n?void 0:n.concat(["bottom-center"])})):I.current.setAttrs(E),U&&I.current.enabledAnchors([]),H&&I.current.rotateEnabled(!1),l.find(e=>null==e?void 0:e.isDragging())&&l.forEach(e=>{null==e||e.startDrag()}),I.current.nodes(l),null===(i=I.current.getLayer())||void 0===i||i.batchDraw()},[e.selectedElements,N,U,F,H]);const K=(0,i.useLocalObservable)(()=>({visible:!1,x1:0,y1:0,x2:0,y2:0})),z=n.default.useRef(!1),J=(0,b.useMobile)(),V=(0,r.action)(n=>{var i,r;if(J)return;z.current=!1,e.activePage!==t&&t.select();const l=n.target.findAncestor(".elements-container"),a=n.target.findAncestor("Transformer"),o=n.target.findAncestor(".page-abs-container");if(l||a||o)return;const s=null===(i=n.target.getStage())||void 0===i?void 0:i.getPointerPosition();s&&(K.visible=!0,K.x1=s.x,K.y1=s.y,K.x2=s.x,K.y2=s.y,(null===(r=n.target.getStage())||void 0===r?void 0:r.getPointersPositions().length)>=2&&(K.visible=!1))});n.default.useEffect(()=>{const t=(0,r.action)(e=>{var t,n;if(!K.visible)return;null===(t=M.current)||void 0===t||t.setPointersPositions(e);let i=(null===(n=M.current)||void 0===n?void 0:n.getPointerPosition())||{x:K.x2,y:K.y2};K.x2=i.x,K.y2=i.y}),n=(0,r.action)(()=>{if(!K.visible)return;if(!M.current)return;const t=M.current.findOne(".selection"),n=t?t.getClientRect():{width:0,height:0,x:0,y:0};if(n.width&&n.height){const t=[];M.current.find(".element").forEach(i=>{const r=i.getClientRect(),l=e.getElementById(i.id()),a=null==l?void 0:l.draggable,s=null==l?void 0:l.selectable;o.default.Util.haveIntersection(n,r)&&a&&s&&t.push(i.id())}),e.selectElements(t)}K.visible=!1,z.current=!0});return window.addEventListener("mousemove",t),window.addEventListener("touchmove",t),window.addEventListener("mouseup",n),window.addEventListener("touchend",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("touchmove",t),window.removeEventListener("mouseup",n),window.removeEventListener("touchend",n)}},[]);const Z=t=>{if(z.current)return;const n=t.evt.ctrlKey||t.evt.metaKey||t.evt.shiftKey,i=t.target.findAncestor(".elements-container"),r=t.target.findAncestor(".page-abs-container"),l=t.target.findAncestor("Transformer");if(!(n||i||l||r))return void e.selectElements([]);const a=t.target.findAncestor(".element",!0),o=e.getElementById(null==a?void 0:a.id()),s=null==o?void 0:o.top,d=null==s?void 0:s.id,c=e.selectedElementsIds.indexOf(d)>=0;d&&n&&!c?e.selectElements(e.selectedElementsIds.concat([d])):d&&n&&c?e.selectElements(e.selectedElementsIds.filter(e=>e!==d)):!d||n||c||e.selectElements([d])};(0,d.useSnap)(I);const Q=e.activePage===t,$=(null==y?void 0:y.PageControls)||m.PageControls,ee=1/e.scale,te=0/e.scale;return n.default.createElement("div",{ref:j,onDragOver:e=>e.preventDefault(),onDrop:n=>{if(n.preventDefault(),!M.current)return;M.current.setPointersPositions(n);const i=M.current.findOne(".elements-container").getRelativePointerPosition(),r=M.current.getPointerPosition(),l=M.current.getAllIntersections(r).map(e=>e.findAncestor(".element",!0)).filter(Boolean),a=[...new Set(l.reverse())].map(t=>e.getElementById(t.id())),o=a[0];R&&(R(i,o,{elements:a,page:t}),R=null)},style:{position:"relative",width:a+"px"},className:"polotno-page-container"+(Q?" active-page":"")},n.default.createElement(l.Stage,{ref:M,width:a,height:s,onClick:Z,onTap:Z,onMouseDown:V,onMouseMove:n=>{if(!n.evt.altKey&&W)return void B(null);if(!n.evt.altKey)return;const i=n.target.findAncestor(".element",!0),r=null==i?void 0:i.id();if(!e.selectedElements[0])return;if(e.selectedElementsIds.includes(r))return;const l=(0,h.getTotalClientRect)(e.selectedElements),a=r?e.getElementById(r):{x:0,y:0,width:t.computedWidth,height:t.computedHeight,rotation:0},o=(0,h.getClientRect)(a),s=[];l.minX>o.maxX&&s.push({distance:l.minX-o.maxX,box1:l,box2:o,points:[{x:l.minX,y:l.minY+l.height/2},{x:o.maxX,y:l.minY+l.height/2},{x:o.maxX,y:o.minY+o.height/2}]}),l.maxX<o.minX&&s.push({distance:o.minX-l.maxX,box1:l,box2:o,points:[{x:l.maxX,y:l.minY+l.height/2},{x:o.minX,y:l.minY+l.height/2},{x:o.minX,y:o.minY+o.height/2}]}),l.minY>o.maxY&&s.push({box1:l,box2:o,distance:l.minY-o.maxY,points:[{x:l.minX+l.width/2,y:l.minY},{x:l.minX+l.width/2,y:o.maxY},{x:o.minX+o.width/2,y:o.maxY}]}),l.maxY<o.minY&&s.push({box1:l,box2:o,distance:o.minY-l.maxY,points:[{x:l.minX+l.width/2,y:l.maxY},{x:l.minX+l.width/2,y:o.minY},{x:o.minX+o.width/2,y:o.minY}]}),l.minX>=o.minX&&l.maxX<=o.maxX&&l.minY>=o.minY&&l.maxY<=o.maxY&&(s.push({distance:l.minX-o.minX,box1:l,box2:o,points:[{x:l.minX,y:l.minY+l.height/2},{x:o.minX,y:l.minY+l.height/2},{x:o.minX,y:o.minY+o.height/2}]}),s.push({distance:o.maxX-l.maxX,box1:l,box2:o,points:[{x:l.maxX,y:l.minY+l.height/2},{x:o.maxX,y:l.minY+l.height/2},{x:o.maxX,y:o.minY+o.height/2}]}),s.push({box1:l,box2:o,distance:l.minY-o.minY,points:[{x:l.minX+l.width/2,y:l.minY},{x:l.minX+l.width/2,y:o.minY},{x:o.minX+o.width/2,y:o.minY}]}),s.push({box1:l,box2:o,distance:o.maxY-l.maxY,points:[{x:l.minX+l.width/2,y:l.maxY},{x:l.minX+l.width/2,y:o.maxY},{x:o.minX+o.width/2,y:o.maxY}]})),JSON.stringify(W)!==JSON.stringify(s)&&B(s)},onTouchStart:V,onDragStart:t=>{var n;const i=t.target.findAncestor(".element",!0);if(i){const r=e.getElementById(null==i?void 0:i.id()),l=null==r?void 0:r.top,a=null==l?void 0:l.id;!(e.selectedElementsIds.indexOf(a)>=0)&&a&&(e.selectElements([a]),t.target.stopDrag(),t.target.startDrag(),null===(n=I.current)||void 0===n||n.startDrag(t))}W&&B(null)},pageId:t.id,style:{position:"relative"}},n.default.createElement(l.Layer,null,n.default.createElement(Y,{width:a,height:s,fill:u}),n.default.createElement(l.Group,{x:T,y:D,scaleX:e.scale,scaleY:e.scale,name:"page-container"},n.default.createElement(l.Group,{name:"page-background-group",x:C,y:C},n.default.createElement(P,{x:-t.bleed,y:-t.bleed,width:t.computedWidth+2*t.bleed,height:t.computedHeight+2*t.bleed,background:t.background,shadowBlur:10,shadowColor:"lightgrey",name:"page-background",preventDefault:!1,scale:e.scale})),n.default.createElement(l.Group,{x:C,y:C,name:"elements-container"},n.default.createElement(l.Rect,{name:"elements-area",width:t.computedWidth,height:t.computedHeight,listening:!1}),n.default.createElement(L,{elements:t.children,store:e})),n.default.createElement(l.Rect,{stroke:X,name:"bleed",strokeWidth:t.bleed,x:t.bleed/2,y:t.bleed/2,width:t.computedWidth+t.bleed,height:t.computedHeight+t.bleed,listening:!1,visible:t.bleed>0&&e.bleedVisible,hideInExport:!0})),n.default.createElement(l.Line,{name:"workspace-background",points:[0,0,a,0,a,s,0,s,0,0,T,D,T,s-D,a-T,s-D,a-T,D,T,D],listening:!1,closed:!0,fill:u}),n.default.createElement(l.Group,{x:T,y:D,scaleX:e.scale,scaleY:e.scale,name:"page-container"},n.default.createElement(l.Rect,{name:"page-highlight",hideInExport:!0,x:-ee/2-te,y:-ee/2-te,width:k+ee+2*te,height:O+ee+2*te,stroke:Q&&e.pages.length>1?v:x,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})),n.default.createElement(l.Group,{x:T+C*e.scale,y:D+C*e.scale,scaleX:e.scale,scaleY:e.scale,name:"page-abs-container"},n.default.createElement(l.Transformer,{ref:I,boundBoxFunc:(e,t)=>{const n=t.width<1||t.height<1,i=e.width<1||e.height<1;return n&&!i?e:t},onTransform:e=>{var t,n;const i=null===(t=I.current)||void 0===t?void 0:t.__getNodeRect(),r=null===(n=I.current)||void 0===n?void 0:n.getActiveAnchor();G({anchor:r,x:i.x,y:i.y,rotation:i.rotation,width:i.width,height:i.height})},onTransformEnd:e=>{G({})}}),W&&W.map(({points:t,distance:i,box1:r,box2:a},o)=>n.default.createElement(l.Group,{name:"distances-container",hideInExport:!0,key:o,listening:!1},n.default.createElement(l.Rect,Object.assign({},r,{stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1})),n.default.createElement(l.Rect,Object.assign({},a,{stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1})),n.default.createElement(l.Line,{points:[t[0].x,t[0].y,t[1].x,t[1].y],stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1}),n.default.createElement(l.Line,{points:[t[1].x,t[1].y,t[2].x,t[2].y],stroke:"rgb(0, 161, 255)",strokeWidth:1,strokeScaleEnabled:!1}),n.default.createElement(l.Label,{x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2,offsetY:-10,scaleX:1/e.scale,scaleY:1/e.scale},n.default.createElement(l.Tag,{cornerRadius:5,fill:"rgb(0, 161, 255)",pointerDirection:"down"}),n.default.createElement(l.Text,{align:"center",verticalAlign:"middle",fill:"white",padding:5,text:(0,f.pxToUnitString)({unit:e.unit,dpi:e.dpi,px:i})}))))),n.default.createElement(A,Object.assign({},_,{store:e})),n.default.createElement(S,{selection:K}),g.shouldShowCredit.value&&n.default.createElement(l.Text,{text:"Powered by polotno.com",fontSize:14,fill:"rgba(0,0,0,0.6)",x:a-170,y:s-18,onMouseEnter:e=>{e.target.getStage().container().style.cursor="pointer"},onMouseLeave:e=>{e.target.getStage().container().style.cursor=""},onTouchStart:e=>{e.cancelBubble=!0},onMouseDown:e=>{e.cancelBubble=!0},onClick:()=>{window.open("https://polotno.dev")},onTap:()=>{window.open("https://polotno.dev")}}),n.default.createElement(l.Group,{name:"line-guides"}))),q&&Q&&n.default.createElement($,{store:e,page:t,xPadding:T,yPadding:D}))});
3305
3313
  },{"react":"HdMw","mobx-react-lite":"ZfSi","mobx":"BzvP","react-konva":"Sgug","use-image":"MJM3","konva":"aTGn","./element":"XEPK","./use-transformer-snap":"F86d","./image-element":"VbEp","../utils/crop":"hfHf","./page-controls":"smDv","../utils/validate-key":"zree","../utils/math":"RXmf","../utils/unit":"BUt3","../utils/flags":"IDY9","../utils/screen":"aH85"}],"s1Tm":[function(require,module,exports) {
3306
3314
  "use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.LeftRules=exports.TopRules=void 0;const t=e(require("react")),i=require("../utils/math"),o=require("../utils/unit"),l=require("mobx-react-lite"),r=[.1,.2,.5,1,2,5,10,20,25,50,100,200,500,1e3,2e3,5e3,1e4],d=30,n=e=>r.find(t=>e(t)>30)||1e4;function s(){return t.default.createElement("div",null,t.default.createElement("h1",null,"Top rules"))}exports.TopRules=(0,l.observer)(({store:e,width:l,height:d})=>{const n=t.default.useRef(null),s=e.activePage,a=(e.bleedVisible&&s.bleed,s.computedWidth*e.scale),p=s.computedHeight*e.scale,u=(l-a)/2,c=(f=(t=>(0,o.unitToPx)({unitVal:t,dpi:e.dpi,unit:e.unit})*e.scale),r.find(e=>f(e)>30)||1e4);var f;const x=(0,o.unitToPx)({unitVal:c,dpi:e.dpi,unit:e.unit})*e.scale,h=Math.round(a/x)+1,g=Math.round(p/x)+1,m=(0,i.getTotalClientRect)(e.selectedElements);return t.default.createElement("div",{style:{position:"absolute",top:0,left:0,pointerEvents:"none"},ref:n},t.default.createElement("div",{style:{width:l+"px",height:"14px",position:"sticky",fontSize:"8px",lineHeight:"14px",top:"0px",left:"0px",color:"grey",borderBottom:"1px solid grey",backgroundColor:"#e8e8e8",overflow:"hidden"}},[...Array(h)].map((i,o)=>t.default.createElement("div",{key:o,style:{position:"absolute",left:u+o*x+"px",borderLeft:"1px solid grey",paddingLeft:"2px",width:x+"px"}},"px"===e.unit||c>=1?Math.round(c*o):(c*o).toFixed(1))),!!e.selectedElements.length&&t.default.createElement("div",{style:{position:"absolute",left:u+m.x*e.scale+"px",height:"14px",width:m.width*e.scale,backgroundColor:"rgba(0,0,0,0.15)"}})),e.pages.map((i,o)=>{var l;const r=i.computedHeight*e.scale,n=(d-r)/2;return t.default.createElement("div",{key:i.id,style:{left:"0px",width:"14px",height:d+"px",position:"sticky",fontSize:"8px",lineHeight:"14px",color:"grey",borderRight:"1px solid grey",backgroundColor:"#e8e8e8",overflow:"hidden"}},[...Array(g)].map((i,o)=>t.default.createElement("div",{key:o,style:{position:"absolute",left:"14px",top:n+o*x-14+"px",borderLeft:"1px solid grey",paddingLeft:"2px",transform:"rotate(90deg)",transformOrigin:"left top",width:x+"px",overflow:"hidden"}},"px"===e.unit||c>=1?Math.round(c*o):(c*o).toFixed(1))),(null===(l=e.selectedElements[0])||void 0===l?void 0:l.page)===i&&t.default.createElement("div",{style:{position:"absolute",top:n+m.y*e.scale-14+"px",width:"14px",height:m.height*e.scale,backgroundColor:"rgba(0,0,0,0.15)"}}))}))}),exports.LeftRules=s;
3307
3315
  },{"react":"HdMw","../utils/math":"RXmf","../utils/unit":"BUt3","mobx-react-lite":"ZfSi"}],"NI5R":[function(require,module,exports) {
@@ -3326,7 +3334,7 @@ var e=require("process");Object.defineProperty(exports,"__esModule",{value:!0}),
3326
3334
  },{}],"uddG":[function(require,module,exports) {
3327
3335
  "use strict";async function e(e){for(let t=0;t<30;t++){const t=await e();if(t)return t;await new Promise(e=>setTimeout(e,50))}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.waitTillAvailable=void 0,exports.waitTillAvailable=e;
3328
3336
  },{}],"GGhN":[function(require,module,exports) {
3329
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCrop=exports.getImageSize=void 0;const t=require("./svg");function e(e){return new Promise(i=>{const h=document.createElement("img");h.onload=(async()=>{0===h.width||0===h.height?i(await(0,t.getSvgSize)(e)):i({width:h.width,height:h.height})}),h.src=e})}function i(t,e){const{width:i,height:h}=t,o=i/h;let r,g;o>=e.width/e.height?(r=e.width,g=e.width/o):(r=e.height*o,g=e.height);const c=(e.width-r)/2,d=(e.height-g)/2;return{cropX:c/e.width,cropY:d/e.height,cropWidth:r/e.width,cropHeight:g/e.height}}exports.getImageSize=e,exports.getCrop=i;
3337
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCrop=exports.getImageSize=void 0;const t=require("./svg");function e(e){return new Promise(i=>{const h=document.createElement("img");h.onload=(async()=>{0===h.width||0===h.height?i(await(0,t.getSvgSize)(e)):i({width:h.width,height:h.height})}),h.crossOrigin="anonymous",h.src=e})}function i(t,e){const{width:i,height:h}=t,o=i/h;let r,g;o>=e.width/e.height?(r=e.width,g=e.width/o):(r=e.height*o,g=e.height);const n=(e.width-r)/2,s=(e.height-g)/2;return{cropX:n/e.width,cropY:s/e.height,cropWidth:r/e.width,cropHeight:g/e.height}}exports.getImageSize=e,exports.getCrop=i;
3330
3338
  },{"./svg":"B1DI"}],"YsBD":[function(require,module,exports) {
3331
3339
  "use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,i,o){void 0===o&&(o=i);var n=Object.getOwnPropertyDescriptor(t,i);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,o,n)}:function(e,t,i,o){void 0===o&&(o=i),e[o]=t[i]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(null!=i)for(var n in i)"default"!==n&&Object.prototype.hasOwnProperty.call(i,n)&&e(o,i,n);return t(o,i),o};Object.defineProperty(exports,"__esModule",{value:!0}),exports.jsonToHTML=exports.jsonToDOM=exports.fixRatio=void 0;const o=require("./image"),n=i(require("./svg"));async function r(e,t){const i=await l(e),o=document.createElement("canvas");o.width=2*i.width,o.height=2*i.height,o.getContext("2d").drawImage(i,0,0,o.width,o.height);const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const r=n.getContext("2d");let{cropX:s,cropY:a}=t;const h=o.width*t.cropWidth,c=o.height*t.cropHeight,g=t.width/t.height;let p,d;const u=h/c;return"svg"===t.type?(p=h,d=c):g>=u?(p=h,d=h/g):(p=c*g,d=c),r.drawImage(o,s*o.width,a*o.height,p,d,0,0,n.width,n.height),n.toDataURL("image/png")}const s=(e,t,...i)=>({type:e,props:t,children:i||[]});function a(e){var t=(new DOMParser).parseFromString(e,"image/svg+xml");return t.documentElement.setAttribute("preserveAspectRatio","none"),(new XMLSerializer).serializeToString(t)}exports.fixRatio=a;const l=e=>new Promise(t=>{const i=new window.Image;i.onload=(()=>{t(i)}),i.src=e,i.crossOrigin="anonymous"}),h=async({element:e,page:t,store:i})=>{let{src:o}=e;if("svg"===e.type){const t=await n.urlToString(o);o=n.replaceColors(t,new Map(Object.entries(e.colorsReplace)))}o=await r(o,e);let a="";return e.flipX&&(a+="scaleX(-1)"),e.flipY&&(a+="scaleY(-1)"),s("img",{src:o,width:"100%",height:"100%",style:Object.assign(Object.assign({},{}),{"border-radius":e.cornerRadius+"px",border:e.borderSize?`${e.borderSize}px solid ${e.borderColor}`:"none",transform:a})})},c=async({element:e,page:t,store:i})=>{let o={};e.fill.indexOf("gradient")>=0&&(o=Object.assign(Object.assign({},o),{"background-color":e.fill,"background-image":e.fill,"background-clip":"text","text-fill-color":"transparent","-webkit-background-clip":"text","-webkit-text-fill-color":"transparent"}));const n=e.backgroundPadding*(e.fontSize*e.lineHeight),r=s("div",{style:{position:"absolute",top:-n/2+"px",left:-n/2+"px",display:e.backgroundEnabled?"block":"none",width:e.width+n+"px",height:e.height+n+"px","background-color":e.backgroundColor,"border-radius":e.backgroundCornerRadius*(e.fontSize*e.lineHeight*.5)+"px"}}),a=s("div",{style:Object.assign(Object.assign({},o),{position:"absolute",top:0,left:0,width:e.width+"px",color:e.fill,"white-space":"pre-wrap","font-size":e.fontSize+"px","text-align":e.align,"font-family":e.fontFamily,"text-decoration":e.textDecoration||"none","line-height":e.lineHeight,"letter-spacing":e.letterSpacing+"em","font-style":e.fontStyle,"font-weight":e.fontWeight,"-webkit-text-stroke":`${e.strokeWidth}px ${e.stroke}`,"text-stroke":`${e.strokeWidth}px ${e.stroke}`})},e.text.split("\n").join("<br />"));return s("div",{style:{position:"relative"}},r,a)},g=({element:e,type:t})=>{const i={"stroke-width":e.height,stroke:e.color,"line-cap":"round","stroke-linejoin":"round",opacity:e.opacity};return"arrow"===t||"triangle"===t?s("polyline",Object.assign({points:`${3*e.height},${2*-e.height} 0,0 ${3*e.height},${2*e.height}`},i)):"bar"===t?s("polyline",Object.assign({points:`0,${2*-e.height} 0,${2*e.height}`},i)):"circle"===t?s("circle",Object.assign({r:e.height},i)):"square"===t?s("polyline",Object.assign({points:`${-e.height},${-e.height} ${-e.height},${e.height} ${e.height},${e.height} ${e.height},${-e.height}`},i)):null},p=async({element:e,page:t,store:i})=>s("svg",{style:{width:"100%",height:"100%",contain:"layout style size",overflow:"visible"}},s("rect",{x:0,y:0,width:e.width,height:e.height,fill:e.color}),s("g",{transform:`translate(0 ${e.height/2})`},g({element:e,type:e.startHead})),s("g",{transform:`translate(${e.width} ${e.height/2}) rotate(180)`},g({element:e,type:e.endHead}))),d=async({element:e,page:t,store:i,elementHook:o})=>{const n=await Promise.all(e.children.map(e=>f({element:e,page:t,store:i,elementHook:o}))),r=s("div",{style:{"transform-origin":"top left",opacity:e.opacity}},...n);return o&&o({dom:r,element:e})||r},u={image:h,svg:h,text:c,line:p,group:d};async function f({element:e,page:t,store:i,elementHook:o}){let n=await u[e.type];n||(n=(()=>s("div",{})),console.error(`HTML export does not support ${e.type} type...`));const r=await n({element:e,page:t,store:i}),a=[];e.blurEnabled&&a.push(`blur(${e.blurRadius/2}px)`),e.brightnessEnabled&&a.push(`brightness(${100*e.brightness+100}%)`),e.sepiaEnabled&&a.push("sepia()"),e.grayscaleEnabled&&a.push("grayscale()"),e.shadowEnabled&&a.push(`drop-shadow(${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur}px ${e.shadowColor})`);const l=s("div",{style:{position:"absolute",left:e.x+"px",top:e.y+"px",width:e.width+"px",height:e.height+"px",transform:`rotate(${e.rotation}deg)`,"transform-origin":"top left",opacity:e.opacity,filter:a.join(" ")}},r);return o&&o({dom:l,element:e})||l}async function b({page:e,store:t,elementHook:i}){const n=await Promise.all(e.children.map(o=>f({element:o,page:e,store:t,elementHook:i})));let a={};if(e.background.indexOf("url")>=0||e.background.indexOf("http")>=0||e.background.indexOf(".jpg")>=0||e.background.indexOf(".png")>=0||e.background.indexOf(".jpeg")>=0){const i=await l(e.background),n=await r(e.background,Object.assign({width:t.width,height:t.height,x:0,y:0},(0,o.getCrop)({width:t.width,height:t.height},{width:i.width,height:i.height})));a=Object.assign(Object.assign({},a),{"background-image":`url(${n})`})}return s("div",{className:"page",style:Object.assign(Object.assign({},a),{width:t.width+"px",height:t.height+"px",background:e.background,border:"1px solid grey",overflow:"hidden",position:"relative"})},...n)}async function m({json:e,elementHook:t}){const i=await Promise.all(e.pages.map(i=>b({page:i,store:e,elementHook:t}))),o=[];e.pages.forEach(e=>{e.children.forEach(e=>{"text"===e.type&&-1===o.indexOf(e.fontFamily)&&o.push(e.fontFamily)})});const n=o.map(t=>e.fonts.find(e=>e.fontFamily===t)?s("style",{},""):s("link",{href:`https://fonts.googleapis.com/css?family=${t}`,rel:"stylesheet"}));return s("div",{className:"design"},...n,...i)}exports.jsonToDOM=m;const y=(e,t)=>"object"==typeof t?`${e}="${Object.keys(t).map(e=>`${e}:${t[e]};`).join(" ")}"`:`${e}="${t}"`,w=({dom:e})=>"string"==typeof e?e:e?`<${e.type} ${Object.keys(e.props).map(t=>y(t,e.props[t])).join(" ")}>${e.children.map(e=>w({dom:e})).join("")}</${e.type}>`:"";async function x({json:e,elementHook:t}){const i=await m({json:e,elementHook:t});return w({dom:i})}exports.jsonToHTML=x;
3332
3340
  },{"./image":"GGhN","./svg":"B1DI"}],"GRkH":[function(require,module,exports) {
@@ -3380,7 +3388,7 @@ var e=require("process");Object.defineProperty(exports,"__esModule",{value:!0}),
3380
3388
  `,g=(0,r.default)("p")`
3381
3389
  text-align: center;
3382
3390
  padding: 30px;
3383
- `,f=({url:e,credit:r,onSelect:l,crossOrigin:a,shadowEnabled:i,itemHeight:n,className:g,onLoad:f})=>{const p=null==i||i;return t.default.createElement(d,{onClick:()=>{l()},className:"polotno-close-panel"},t.default.createElement(s,{"data-shadowenabled":p},t.default.createElement(u,{className:g,style:{height:null!=n?n:"auto"},src:e,draggable:!0,crossOrigin:a,onDragStart:()=>{(0,o.registerNextDomDrop)(({x:e,y:t},r)=>{l({x:e,y:t},r)})},onDragEnd:()=>{(0,o.registerNextDomDrop)(null)},onLoad:f}),r&&t.default.createElement(c,{className:"credit"},r)))},p=({images:e,onSelect:r,isLoading:o,getPreview:d,loadMore:s,getCredit:u,getImageClassName:c,rowsNumber:p,crossOrigin:m="anonymous",shadowEnabled:h,itemHeight:v,error:w})=>{const x=p||2,b=t.default.useRef(null),y=[];for(var E=0;E<x;E++)y.push((e||[]).filter((e,t)=>t%x===E));const N=t.default.useRef(null),D=()=>{var t,r,l;const a=(null===(t=b.current)||void 0===t?void 0:t.scrollHeight)>(null===(r=b.current)||void 0===r?void 0:r.offsetHeight)+5,i=e&&e.length,n=Array.from(null===(l=b.current)||void 0===l?void 0:l.querySelectorAll("img")).every(e=>e.complete);!a&&s&&!o&&i&&n&&(N.current||(N.current=window.setTimeout(()=>{N.current=null,s&&s()},100)))},H=()=>{D()};return t.default.useEffect(()=>(D(),()=>{window.clearTimeout(N.current),N.current=null}),[e&&e.length,o]),t.default.createElement(i,{onScroll:e=>{const t=e.target.scrollHeight-e.target.scrollTop-e.target.offsetHeight;s&&!o&&t<200&&s()},ref:b},y.map((e,a)=>t.default.createElement(n,{key:a,style:{width:100/x+"%"}},e.map(e=>t.default.createElement(f,{url:d(e),onSelect:(t,l)=>r(e,t,l),key:d(e),credit:u&&u(e),crossOrigin:m,shadowEnabled:h,itemHeight:v,className:c&&c(e),onLoad:H})),o&&t.default.createElement("div",{style:{padding:"30px"}},t.default.createElement(l.Spinner,null)))),!o&&(!e||!e.length)&&!w&&t.default.createElement(g,null,(0,a.t)("sidePanel.noResults")),w&&t.default.createElement(g,null,(0,a.t)("sidePanel.error")))};exports.ImagesGrid=p;
3391
+ `,f=({url:e,credit:r,onSelect:l,crossOrigin:a,shadowEnabled:i,itemHeight:n,className:g,onLoad:f})=>{const p=null==i||i;return t.default.createElement(d,{onClick:()=>{l()},className:"polotno-close-panel"},t.default.createElement(s,{"data-shadowenabled":p},t.default.createElement(u,{className:g,style:{height:null!=n?n:"auto"},src:e,draggable:!0,crossOrigin:a,onDragStart:()=>{(0,o.registerNextDomDrop)(({x:e,y:t},r,a)=>{l({x:e,y:t},r,a)})},onDragEnd:()=>{(0,o.registerNextDomDrop)(null)},onLoad:f}),r&&t.default.createElement(c,{className:"credit"},r)))},p=({images:e,onSelect:r,isLoading:o,getPreview:d,loadMore:s,getCredit:u,getImageClassName:c,rowsNumber:p,crossOrigin:m="anonymous",shadowEnabled:h,itemHeight:v,error:w})=>{const x=p||2,b=t.default.useRef(null),y=[];for(var E=0;E<x;E++)y.push((e||[]).filter((e,t)=>t%x===E));const N=t.default.useRef(null),D=()=>{var t,r,l;const a=(null===(t=b.current)||void 0===t?void 0:t.scrollHeight)>(null===(r=b.current)||void 0===r?void 0:r.offsetHeight)+5,i=e&&e.length,n=Array.from(null===(l=b.current)||void 0===l?void 0:l.querySelectorAll("img")).every(e=>e.complete);!a&&s&&!o&&i&&n&&(N.current||(N.current=window.setTimeout(()=>{N.current=null,s&&s()},100)))},H=()=>{D()};return t.default.useEffect(()=>(D(),()=>{window.clearTimeout(N.current),N.current=null}),[e&&e.length,o]),t.default.createElement(i,{onScroll:e=>{const t=e.target.scrollHeight-e.target.scrollTop-e.target.offsetHeight;s&&!o&&t<200&&s()},ref:b},y.map((e,a)=>t.default.createElement(n,{key:a,style:{width:100/x+"%"}},e.map(e=>t.default.createElement(f,{url:d(e),onSelect:(t,l,a)=>r(e,t,l,a),key:d(e),credit:u&&u(e),crossOrigin:m,shadowEnabled:h,itemHeight:v,className:c&&c(e),onLoad:H})),o&&t.default.createElement("div",{style:{padding:"30px"}},t.default.createElement(l.Spinner,null)))),!o&&(!e||!e.length)&&!w&&t.default.createElement(g,null,(0,a.t)("sidePanel.noResults")),w&&t.default.createElement(g,null,(0,a.t)("sidePanel.error")))};exports.ImagesGrid=p;
3384
3392
  },{"react":"HdMw","../utils/styled":"PsiH","@blueprintjs/core":"Ydrz","../utils/l10n":"FlVj","../canvas/page":"Co9b"}],"ioqf":[function(require,module,exports) {
3385
3393
  "use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.UploadPanel=exports.setUploadFunc=void 0;const t=e(require("react")),i=require("@blueprintjs/core"),l=require("../utils/image"),a=require("../utils/file"),n=require("./images-grid"),s=require("../utils/l10n"),r=require("../utils/image");let o=async e=>(0,a.localFileToURL)(e);function u(e){o=e}exports.setUploadFunc=u;let d=[];const c=({store:e})=>{const[a,u]=t.default.useState(d),[c,g]=t.default.useState(!1),f=t.default.useRef(null);return t.default.useEffect(()=>{d=a},[a]),t.default.createElement("div",{style:{height:"100%",display:"flex",flexDirection:"column"}},t.default.createElement("div",{style:{height:"45px",paddingTop:"5px"}},(0,s.t)("sidePanel.uploadTip")),t.default.createElement("div",{style:{marginBottom:"20px"}},t.default.createElement("label",{htmlFor:"input-file"},t.default.createElement(i.Button,{icon:"upload",style:{width:"100%"},onClick:()=>{var e;null===(e=f.current)||void 0===e||e.click()}},(0,s.t)("sidePanel.uploadImage")),t.default.createElement("input",{type:"file",ref:f,style:{display:"none"},onChange:async e=>{const{target:t}=e;g(!0);for(const i of t.files){const e=await o(i);u(t=>t.concat([e]))}g(!1),t.value=""},multiple:!0}))),t.default.createElement(n.ImagesGrid,{images:a,isLoading:c,getPreview:e=>e,onSelect:async(t,i,a)=>{var n;let{width:s,height:o}=await(0,l.getImageSize)(t);const u=t.indexOf("svg+xml")>=0||t.indexOf(".svg")>=0?"svg":"image";if(a&&"svg"===a.type&&a.contentEditable&&"image"===u)return void a.set({maskSrc:t});if(a&&"image"===a.type&&a.contentEditable&&"image"==u){const e=(0,r.getCrop)(a,{width:s,height:o});return void a.set(Object.assign({src:t},e))}const d=Math.min(e.width/s,e.height/o,1);s*=d,o*=d;const c=((null==i?void 0:i.x)||e.width/2)-s/2,g=((null==i?void 0:i.y)||e.height/2)-o/2;null===(n=e.activePage)||void 0===n||n.addElement({type:u,src:t,x:c,y:g,width:s,height:o})}}))};exports.UploadPanel=c;
3386
3394
  },{"react":"HdMw","@blueprintjs/core":"Ydrz","../utils/image":"GGhN","../utils/file":"oiQN","./images-grid":"Tz78","../utils/l10n":"FlVj"}],"APqM":[function(require,module,exports) {
@@ -3931,4 +3939,4 @@ var r=require("../lib").GenIcon;module.exports=function(t){return r({tag:"svg",a
3931
3939
  },{"./utils/fonts":"XXLd","./side-panel/upload-panel":"ioqf","./canvas/use-fadein":"N3c2","./canvas/image-element":"VbEp","./model/store":"GRkH","./canvas/element":"XEPK","./canvas/page":"Co9b","./toolbar/toolbar":"CetC","./utils/loader":"bN4e","./utils/l10n":"FlVj","./utils/api":"Ic0q","./toolbar/color-picker":"zFB1","./utils/flags":"IDY9"}],"IVsl":[function(require,module,exports) {
3932
3940
  "use strict";var e=l(require("react")),t=l(require("react-dom/client")),o=require("polotno/canvas/workspace"),r=require("polotno/model/store"),a=require("polotno/canvas/use-fadein"),n=require("polotno/config"),s=require("polotno/utils/fonts");function l(e){return e&&e.__esModule?e:{default:e}}(0,a.toggleFadeInAnimation)(!1),(0,n.unstable_setTextOverflow)("change-font-size");var u=new URLSearchParams(location.search).get("key"),i=(0,r.createStore)({key:u});window.store=i,window.config={addGlobalFont:s.addGlobalFont,unstable_useHtmlTextRender:n.unstable_useHtmlTextRender,unstable_setTextVerticalResizeEnabled:n.unstable_setTextVerticalResizeEnabled,unstable_setTextOverflow:n.unstable_setTextOverflow,onLoadError:n.onLoadError,setAssetLoadTimeout:n.setAssetLoadTimeout};var d=t.default.createRoot(document.getElementById("root"));d.render(e.default.createElement(o.Workspace,{store:i}));
3933
3941
  },{"react":"HdMw","react-dom/client":"U1bq","polotno/canvas/workspace":"twsc","polotno/model/store":"GRkH","polotno/canvas/use-fadein":"N3c2","polotno/config":"Otsg","polotno/utils/fonts":"XXLd"}]},{},["IVsl"], null)
3934
- //# sourceMappingURL=client.7c21efff.js.map
3942
+ //# sourceMappingURL=client.3517c032.js.map