diff --git "a/assets/index-UgHUO9ec.js" "b/assets/index-UgHUO9ec.js" new file mode 100644--- /dev/null +++ "b/assets/index-UgHUO9ec.js" @@ -0,0 +1,132 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();var g1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mm={exports:{}},oc={},ym={exports:{}},Ie={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Wl=Symbol.for("react.element"),L3=Symbol.for("react.portal"),z3=Symbol.for("react.fragment"),I3=Symbol.for("react.strict_mode"),D3=Symbol.for("react.profiler"),A3=Symbol.for("react.provider"),O3=Symbol.for("react.context"),H3=Symbol.for("react.forward_ref"),U3=Symbol.for("react.suspense"),G3=Symbol.for("react.memo"),B3=Symbol.for("react.lazy"),p1=Symbol.iterator;function V3(t){return t===null||typeof t!="object"?null:(t=p1&&t[p1]||t["@@iterator"],typeof t=="function"?t:null)}var vm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xm=Object.assign,Sm={};function vs(t,e,n){this.props=t,this.context=e,this.refs=Sm,this.updater=n||vm}vs.prototype.isReactComponent={};vs.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};vs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function _m(){}_m.prototype=vs.prototype;function x0(t,e,n){this.props=t,this.context=e,this.refs=Sm,this.updater=n||vm}var S0=x0.prototype=new _m;S0.constructor=x0;xm(S0,vs.prototype);S0.isPureReactComponent=!0;var m1=Array.isArray,wm=Object.prototype.hasOwnProperty,_0={current:null},Cm={key:!0,ref:!0,__self:!0,__source:!0};function km(t,e,n){var r,s={},l=null,a=null;if(e!=null)for(r in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(l=""+e.key),e)wm.call(e,r)&&!Cm.hasOwnProperty(r)&&(s[r]=e[r]);var c=arguments.length-2;if(c===1)s.children=n;else if(1>>1,me=U[Y];if(0>>1;Ys(vt,$))Kes(D,vt)?(U[Y]=D,U[Ke]=$,Y=Ke):(U[Y]=vt,U[Qe]=$,Y=Qe);else if(Kes(D,$))U[Y]=D,U[Ke]=$,Y=Ke;else break e}}return Q}function s(U,Q){var $=U.sortIndex-Q.sortIndex;return $!==0?$:U.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var d=[],g=[],y=1,w=null,x=3,_=!1,v=!1,E=!1,P=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(U){for(var Q=n(g);Q!==null;){if(Q.callback===null)r(g);else if(Q.startTime<=U)r(g),Q.sortIndex=Q.expirationTime,e(d,Q);else break;Q=n(g)}}function S(U){if(E=!1,p(U),!v)if(n(d)!==null)v=!0,pe(R);else{var Q=n(g);Q!==null&&Ce(S,Q.startTime-U)}}function R(U,Q){v=!1,E&&(E=!1,k(N),N=-1),_=!0;var $=x;try{for(p(Q),w=n(d);w!==null&&(!(w.expirationTime>Q)||U&&!H());){var Y=w.callback;if(typeof Y=="function"){w.callback=null,x=w.priorityLevel;var me=Y(w.expirationTime<=Q);Q=t.unstable_now(),typeof me=="function"?w.callback=me:w===n(d)&&r(d),p(Q)}else r(d);w=n(d)}if(w!==null)var ze=!0;else{var Qe=n(g);Qe!==null&&Ce(S,Qe.startTime-Q),ze=!1}return ze}finally{w=null,x=$,_=!1}}var F=!1,L=null,N=-1,z=5,M=-1;function H(){return!(t.unstable_now()-MU||125Y?(U.sortIndex=$,e(g,U),n(d)===null&&U===n(g)&&(E?(k(N),N=-1):E=!0,Ce(S,$-Y))):(U.sortIndex=me,e(d,U),v||_||(v=!0,pe(R))),U},t.unstable_shouldYield=H,t.unstable_wrapCallback=function(U){var Q=x;return function(){var $=x;x=Q;try{return U.apply(this,arguments)}finally{x=$}}}})(Rm);Nm.exports=Rm;var hl=Nm.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var J3=X,En=hl;function J(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gf=Object.prototype.hasOwnProperty,ev=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v1={},x1={};function tv(t){return gf.call(x1,t)?!0:gf.call(v1,t)?!1:ev.test(t)?x1[t]=!0:(v1[t]=!0,!1)}function nv(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function rv(t,e,n,r){if(e===null||typeof e>"u"||nv(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ln(t,e,n,r,s,l,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=l,this.removeEmptyString=a}var Wt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Wt[t]=new ln(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Wt[e]=new ln(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Wt[t]=new ln(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Wt[t]=new ln(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Wt[t]=new ln(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Wt[t]=new ln(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Wt[t]=new ln(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Wt[t]=new ln(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Wt[t]=new ln(t,5,!1,t.toLowerCase(),null,!1,!1)});var C0=/[\-:]([a-z])/g;function k0(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(C0,k0);Wt[e]=new ln(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(C0,k0);Wt[e]=new ln(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(C0,k0);Wt[e]=new ln(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Wt[t]=new ln(t,1,!1,t.toLowerCase(),null,!1,!1)});Wt.xlinkHref=new ln("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Wt[t]=new ln(t,1,!1,t.toLowerCase(),null,!0,!0)});function E0(t,e,n,r){var s=Wt.hasOwnProperty(e)?Wt[e]:null;(s!==null?s.type!==0:r||!(2c||s[a]!==l[c]){var d=` +`+s[a].replace(" at new "," at ");return t.displayName&&d.includes("")&&(d=d.replace("",t.displayName)),d}while(1<=a&&0<=c);break}}}finally{Mh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?sl(t):""}function iv(t){switch(t.tag){case 5:return sl(t.type);case 16:return sl("Lazy");case 13:return sl("Suspense");case 19:return sl("SuspenseList");case 0:case 2:case 15:return t=Lh(t.type,!1),t;case 11:return t=Lh(t.type.render,!1),t;case 1:return t=Lh(t.type,!0),t;default:return""}}function vf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case jo:return"Fragment";case bo:return"Portal";case pf:return"Profiler";case P0:return"StrictMode";case mf:return"Suspense";case yf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Lm:return(t.displayName||"Context")+".Consumer";case Mm:return(t._context.displayName||"Context")+".Provider";case T0:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case N0:return e=t.displayName||null,e!==null?e:vf(t.type)||"Memo";case ci:e=t._payload,t=t._init;try{return vf(t(e))}catch{}}return null}function ov(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return vf(e);case 8:return e===P0?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function ki(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Im(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function sv(t){var e=Im(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,l=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,l.call(this,a)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Qa(t){t._valueTracker||(t._valueTracker=sv(t))}function Dm(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Im(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Fu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function xf(t,e){var n=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function _1(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=ki(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Am(t,e){e=e.checked,e!=null&&E0(t,"checked",e,!1)}function Sf(t,e){Am(t,e);var n=ki(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?_f(t,e.type,n):e.hasOwnProperty("defaultValue")&&_f(t,e.type,ki(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function w1(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function _f(t,e,n){(e!=="number"||Fu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var ll=Array.isArray;function ns(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s"+e.valueOf().toString()+"",e=qa.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Cl(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var fl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},lv=["Webkit","ms","Moz","O"];Object.keys(fl).forEach(function(t){lv.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),fl[e]=fl[t]})});function Gm(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||fl.hasOwnProperty(t)&&fl[t]?(""+e).trim():e+"px"}function Bm(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Gm(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var av=ft({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function kf(t,e){if(e){if(av[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(J(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(J(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(J(61))}if(e.style!=null&&typeof e.style!="object")throw Error(J(62))}}function Ef(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Pf=null;function R0(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Tf=null,rs=null,is=null;function E1(t){if(t=Kl(t)){if(typeof Tf!="function")throw Error(J(280));var e=t.stateNode;e&&(e=cc(e),Tf(t.stateNode,t.type,e))}}function Vm(t){rs?is?is.push(t):is=[t]:rs=t}function Wm(){if(rs){var t=rs,e=is;if(is=rs=null,E1(t),e)for(t=0;t>>=0,t===0?32:31-(xv(t)/Sv|0)|0}var Za=64,Ja=4194304;function al(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Iu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,l=t.pingedLanes,a=n&268435455;if(a!==0){var c=a&~s;c!==0?r=al(c):(l&=a,l!==0&&(r=al(l)))}else a=n&~s,a!==0?r=al(a):l!==0&&(r=al(l));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,l=e&-e,s>=l||s===16&&(l&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function bl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-nr(e),t[e]=n}function kv(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=pl),I1=" ",D1=!1;function uy(t,e){switch(t){case"keyup":return Zv.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cy(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ko=!1;function e6(t,e){switch(t){case"compositionend":return cy(e);case"keypress":return e.which!==32?null:(D1=!0,I1);case"textInput":return t=e.data,t===I1&&D1?null:t;default:return null}}function t6(t,e){if(Ko)return t==="compositionend"||!O0&&uy(t,e)?(t=ly(),xu=I0=gi=null,Ko=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=U1(n)}}function gy(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?gy(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function py(){for(var t=window,e=Fu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Fu(t.document)}return e}function H0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function c6(t){var e=py(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&gy(n.ownerDocument.documentElement,n)){if(r!==null&&H0(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,l=Math.min(r.start,s);r=r.end===void 0?l:Math.min(r.end,s),!t.extend&&l>r&&(s=r,r=l,l=s),s=G1(n,l);var a=G1(n,r);s&&a&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),l>r?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Yo=null,zf=null,yl=null,If=!1;function B1(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;If||Yo==null||Yo!==Fu(r)||(r=Yo,"selectionStart"in r&&H0(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),yl&&Rl(yl,r)||(yl=r,r=Ou(zf,"onSelect"),0Qo||(t.current=Gf[Qo],Gf[Qo]=null,Qo--)}function et(t,e){Qo++,Gf[Qo]=t.current,t.current=e}var Ei={},Zt=Ni(Ei),mn=Ni(!1),lo=Ei;function us(t,e){var n=t.type.contextTypes;if(!n)return Ei;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},l;for(l in n)s[l]=e[l];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function yn(t){return t=t.childContextTypes,t!=null}function Uu(){it(mn),it(Zt)}function X1(t,e,n){if(Zt.current!==Ei)throw Error(J(168));et(Zt,e),et(mn,n)}function ky(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(J(108,ov(t)||"Unknown",s));return ft({},n,r)}function Gu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ei,lo=Zt.current,et(Zt,t),et(mn,mn.current),!0}function $1(t,e,n){var r=t.stateNode;if(!r)throw Error(J(169));n?(t=ky(t,e,lo),r.__reactInternalMemoizedMergedChildContext=t,it(mn),it(Zt),et(Zt,t)):it(mn),et(mn,n)}var Dr=null,dc=!1,Kh=!1;function Ey(t){Dr===null?Dr=[t]:Dr.push(t)}function w6(t){dc=!0,Ey(t)}function Ri(){if(!Kh&&Dr!==null){Kh=!0;var t=0,e=Ye;try{var n=Dr;for(Ye=1;t>=a,s-=a,Ar=1<<32-nr(e)+s|n<N?(z=L,L=null):z=L.sibling;var M=x(k,L,p[N],S);if(M===null){L===null&&(L=z);break}t&&L&&M.alternate===null&&e(k,L),C=l(M,C,N),F===null?R=M:F.sibling=M,F=M,L=z}if(N===p.length)return n(k,L),lt&&Zi(k,N),R;if(L===null){for(;NN?(z=L,L=null):z=L.sibling;var H=x(k,L,M.value,S);if(H===null){L===null&&(L=z);break}t&&L&&H.alternate===null&&e(k,L),C=l(H,C,N),F===null?R=H:F.sibling=H,F=H,L=z}if(M.done)return n(k,L),lt&&Zi(k,N),R;if(L===null){for(;!M.done;N++,M=p.next())M=w(k,M.value,S),M!==null&&(C=l(M,C,N),F===null?R=M:F.sibling=M,F=M);return lt&&Zi(k,N),R}for(L=r(k,L);!M.done;N++,M=p.next())M=_(L,k,N,M.value,S),M!==null&&(t&&M.alternate!==null&&L.delete(M.key===null?N:M.key),C=l(M,C,N),F===null?R=M:F.sibling=M,F=M);return t&&L.forEach(function(b){return e(k,b)}),lt&&Zi(k,N),R}function P(k,C,p,S){if(typeof p=="object"&&p!==null&&p.type===jo&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case $a:e:{for(var R=p.key,F=C;F!==null;){if(F.key===R){if(R=p.type,R===jo){if(F.tag===7){n(k,F.sibling),C=s(F,p.props.children),C.return=k,k=C;break e}}else if(F.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===ci&&Z1(R)===F.type){n(k,F.sibling),C=s(F,p.props),C.ref=el(k,F,p),C.return=k,k=C;break e}n(k,F);break}else e(k,F);F=F.sibling}p.type===jo?(C=so(p.props.children,k.mode,S,p.key),C.return=k,k=C):(S=Tu(p.type,p.key,p.props,null,k.mode,S),S.ref=el(k,C,p),S.return=k,k=S)}return a(k);case bo:e:{for(F=p.key;C!==null;){if(C.key===F)if(C.tag===4&&C.stateNode.containerInfo===p.containerInfo&&C.stateNode.implementation===p.implementation){n(k,C.sibling),C=s(C,p.children||[]),C.return=k,k=C;break e}else{n(k,C);break}else e(k,C);C=C.sibling}C=ef(p,k.mode,S),C.return=k,k=C}return a(k);case ci:return F=p._init,P(k,C,F(p._payload),S)}if(ll(p))return v(k,C,p,S);if($s(p))return E(k,C,p,S);su(k,p)}return typeof p=="string"&&p!==""||typeof p=="number"?(p=""+p,C!==null&&C.tag===6?(n(k,C.sibling),C=s(C,p),C.return=k,k=C):(n(k,C),C=Jh(p,k.mode,S),C.return=k,k=C),a(k)):n(k,C)}return P}var ds=Ry(!0),Fy=Ry(!1),Wu=Ni(null),bu=null,Jo=null,V0=null;function W0(){V0=Jo=bu=null}function b0(t){var e=Wu.current;it(Wu),t._currentValue=e}function Wf(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function ss(t,e){bu=t,V0=Jo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(pn=!0),t.firstContext=null)}function Vn(t){var e=t._currentValue;if(V0!==t)if(t={context:t,memoizedValue:e,next:null},Jo===null){if(bu===null)throw Error(J(308));Jo=t,bu.dependencies={lanes:0,firstContext:t}}else Jo=Jo.next=t;return e}var ro=null;function j0(t){ro===null?ro=[t]:ro.push(t)}function My(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,j0(e)):(n.next=s.next,s.next=n),e.interleaved=n,Wr(t,r)}function Wr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var di=!1;function K0(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ly(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Ur(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Si(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Ue&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Wr(t,n)}return s=r.interleaved,s===null?(e.next=e,j0(r)):(e.next=s.next,s.next=e),r.interleaved=e,Wr(t,n)}function _u(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,M0(t,n)}}function J1(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?s=l=a:l=l.next=a,n=n.next}while(n!==null);l===null?s=l=e:l=l.next=e}else s=l=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:l,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function ju(t,e,n,r){var s=t.updateQueue;di=!1;var l=s.firstBaseUpdate,a=s.lastBaseUpdate,c=s.shared.pending;if(c!==null){s.shared.pending=null;var d=c,g=d.next;d.next=null,a===null?l=g:a.next=g,a=d;var y=t.alternate;y!==null&&(y=y.updateQueue,c=y.lastBaseUpdate,c!==a&&(c===null?y.firstBaseUpdate=g:c.next=g,y.lastBaseUpdate=d))}if(l!==null){var w=s.baseState;a=0,y=g=d=null,c=l;do{var x=c.lane,_=c.eventTime;if((r&x)===x){y!==null&&(y=y.next={eventTime:_,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var v=t,E=c;switch(x=e,_=n,E.tag){case 1:if(v=E.payload,typeof v=="function"){w=v.call(_,w,x);break e}w=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=E.payload,x=typeof v=="function"?v.call(_,w,x):v,x==null)break e;w=ft({},w,x);break e;case 2:di=!0}}c.callback!==null&&c.lane!==0&&(t.flags|=64,x=s.effects,x===null?s.effects=[c]:x.push(c))}else _={eventTime:_,lane:x,tag:c.tag,payload:c.payload,callback:c.callback,next:null},y===null?(g=y=_,d=w):y=y.next=_,a|=x;if(c=c.next,c===null){if(c=s.shared.pending,c===null)break;x=c,c=x.next,x.next=null,s.lastBaseUpdate=x,s.shared.pending=null}}while(!0);if(y===null&&(d=w),s.baseState=d,s.firstBaseUpdate=g,s.lastBaseUpdate=y,e=s.shared.interleaved,e!==null){s=e;do a|=s.lane,s=s.next;while(s!==e)}else l===null&&(s.shared.lanes=0);co|=a,t.lanes=a,t.memoizedState=w}}function e2(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Xh.transition;Xh.transition={};try{t(!1),e()}finally{Ye=n,Xh.transition=r}}function $y(){return Wn().memoizedState}function P6(t,e,n){var r=wi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Qy(t))qy(e,n);else if(n=My(t,e,n,r),n!==null){var s=on();rr(n,t,r,s),Zy(n,e,r)}}function T6(t,e,n){var r=wi(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qy(t))qy(e,s);else{var l=t.alternate;if(t.lanes===0&&(l===null||l.lanes===0)&&(l=e.lastRenderedReducer,l!==null))try{var a=e.lastRenderedState,c=l(a,n);if(s.hasEagerState=!0,s.eagerState=c,or(c,a)){var d=e.interleaved;d===null?(s.next=s,j0(e)):(s.next=d.next,d.next=s),e.interleaved=s;return}}catch{}finally{}n=My(t,e,s,r),n!==null&&(s=on(),rr(n,t,r,s),Zy(n,e,r))}}function Qy(t){var e=t.alternate;return t===ht||e!==null&&e===ht}function qy(t,e){vl=Yu=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Zy(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,M0(t,n)}}var Xu={readContext:Vn,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useInsertionEffect:$t,useLayoutEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useMutableSource:$t,useSyncExternalStore:$t,useId:$t,unstable_isNewReconciler:!1},N6={readContext:Vn,useCallback:function(t,e){return yr().memoizedState=[t,e===void 0?null:e],t},useContext:Vn,useEffect:n2,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Cu(4194308,4,by.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Cu(4194308,4,t,e)},useInsertionEffect:function(t,e){return Cu(4,2,t,e)},useMemo:function(t,e){var n=yr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=yr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=P6.bind(null,ht,t),[r.memoizedState,t]},useRef:function(t){var e=yr();return t={current:t},e.memoizedState=t},useState:t2,useDebugValue:eg,useDeferredValue:function(t){return yr().memoizedState=t},useTransition:function(){var t=t2(!1),e=t[0];return t=E6.bind(null,t[1]),yr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ht,s=yr();if(lt){if(n===void 0)throw Error(J(407));n=n()}else{if(n=e(),Ot===null)throw Error(J(349));uo&30||Ay(r,e,n)}s.memoizedState=n;var l={value:n,getSnapshot:e};return s.queue=l,n2(Hy.bind(null,r,l,t),[t]),r.flags|=2048,Ol(9,Oy.bind(null,r,l,n,e),void 0,null),n},useId:function(){var t=yr(),e=Ot.identifierPrefix;if(lt){var n=Or,r=Ar;n=(r&~(1<<32-nr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Dl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=a.createElement(n,{is:r.is}):(t=a.createElement(n),n==="select"&&(a=t,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):t=a.createElementNS(t,n),t[vr]=e,t[Ll]=r,a5(t,e,!1,!1),e.stateNode=t;e:{switch(a=Ef(n,r),n){case"dialog":rt("cancel",t),rt("close",t),s=r;break;case"iframe":case"object":case"embed":rt("load",t),s=r;break;case"video":case"audio":for(s=0;sgs&&(e.flags|=128,r=!0,tl(l,!1),e.lanes=4194304)}else{if(!r)if(t=Ku(a),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),tl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!lt)return Qt(e),null}else 2*St()-l.renderingStartTime>gs&&n!==1073741824&&(e.flags|=128,r=!0,tl(l,!1),e.lanes=4194304);l.isBackwards?(a.sibling=e.child,e.child=a):(n=l.last,n!==null?n.sibling=a:e.child=a,l.last=a)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=St(),e.sibling=null,n=dt.current,et(dt,r?n&1|2:n&1),e):(Qt(e),null);case 22:case 23:return sg(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?wn&1073741824&&(Qt(e),e.subtreeFlags&6&&(e.flags|=8192)):Qt(e),null;case 24:return null;case 25:return null}throw Error(J(156,e.tag))}function A6(t,e){switch(G0(e),e.tag){case 1:return yn(e.type)&&Uu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return hs(),it(mn),it(Zt),$0(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return X0(e),null;case 13:if(it(dt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(J(340));cs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return it(dt),null;case 4:return hs(),null;case 10:return b0(e.type._context),null;case 22:case 23:return sg(),null;case 24:return null;default:return null}}var au=!1,qt=!1,O6=typeof WeakSet=="function"?WeakSet:Set,de=null;function es(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){pt(t,e,r)}else n.current=null}function Zf(t,e,n){try{n()}catch(r){pt(t,e,r)}}var f2=!1;function H6(t,e){if(Df=Du,t=py(),H0(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var a=0,c=-1,d=-1,g=0,y=0,w=t,x=null;t:for(;;){for(var _;w!==n||s!==0&&w.nodeType!==3||(c=a+s),w!==l||r!==0&&w.nodeType!==3||(d=a+r),w.nodeType===3&&(a+=w.nodeValue.length),(_=w.firstChild)!==null;)x=w,w=_;for(;;){if(w===t)break t;if(x===n&&++g===s&&(c=a),x===l&&++y===r&&(d=a),(_=w.nextSibling)!==null)break;w=x,x=w.parentNode}w=_}n=c===-1||d===-1?null:{start:c,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(Af={focusedElem:t,selectionRange:n},Du=!1,de=e;de!==null;)if(e=de,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,de=t;else for(;de!==null;){e=de;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var E=v.memoizedProps,P=v.memoizedState,k=e.stateNode,C=k.getSnapshotBeforeUpdate(e.elementType===e.type?E:Jn(e.type,E),P);k.__reactInternalSnapshotBeforeUpdate=C}break;case 3:var p=e.stateNode.containerInfo;p.nodeType===1?p.textContent="":p.nodeType===9&&p.documentElement&&p.removeChild(p.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(S){pt(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,de=t;break}de=e.return}return v=f2,f2=!1,v}function xl(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var l=s.destroy;s.destroy=void 0,l!==void 0&&Zf(e,n,l)}s=s.next}while(s!==r)}}function gc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Jf(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function d5(t){var e=t.alternate;e!==null&&(t.alternate=null,d5(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[vr],delete e[Ll],delete e[Uf],delete e[S6],delete e[_6])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function h5(t){return t.tag===5||t.tag===3||t.tag===4}function g2(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||h5(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function e0(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Hu));else if(r!==4&&(t=t.child,t!==null))for(e0(t,e,n),t=t.sibling;t!==null;)e0(t,e,n),t=t.sibling}function t0(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(t0(t,e,n),t=t.sibling;t!==null;)t0(t,e,n),t=t.sibling}var Bt=null,er=!1;function li(t,e,n){for(n=n.child;n!==null;)f5(t,e,n),n=n.sibling}function f5(t,e,n){if(Sr&&typeof Sr.onCommitFiberUnmount=="function")try{Sr.onCommitFiberUnmount(sc,n)}catch{}switch(n.tag){case 5:qt||es(n,e);case 6:var r=Bt,s=er;Bt=null,li(t,e,n),Bt=r,er=s,Bt!==null&&(er?(t=Bt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Bt.removeChild(n.stateNode));break;case 18:Bt!==null&&(er?(t=Bt,n=n.stateNode,t.nodeType===8?jh(t.parentNode,n):t.nodeType===1&&jh(t,n),Tl(t)):jh(Bt,n.stateNode));break;case 4:r=Bt,s=er,Bt=n.stateNode.containerInfo,er=!0,li(t,e,n),Bt=r,er=s;break;case 0:case 11:case 14:case 15:if(!qt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var l=s,a=l.destroy;l=l.tag,a!==void 0&&(l&2||l&4)&&Zf(n,e,a),s=s.next}while(s!==r)}li(t,e,n);break;case 1:if(!qt&&(es(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){pt(n,e,c)}li(t,e,n);break;case 21:li(t,e,n);break;case 22:n.mode&1?(qt=(r=qt)||n.memoizedState!==null,li(t,e,n),qt=r):li(t,e,n);break;default:li(t,e,n)}}function p2(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new O6),e.forEach(function(r){var s=Y6.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function qn(t,e){var n=e.deletions;if(n!==null)for(var r=0;rs&&(s=a),r&=~l}if(r=s,r=St()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*G6(r/1960))-r,10t?16:t,pi===null)var r=!1;else{if(t=pi,pi=null,qu=0,Ue&6)throw Error(J(331));var s=Ue;for(Ue|=4,de=t.current;de!==null;){var l=de,a=l.child;if(de.flags&16){var c=l.deletions;if(c!==null){for(var d=0;dSt()-ig?oo(t,0):rg|=n),vn(t,e)}function _5(t,e){e===0&&(t.mode&1?(e=Ja,Ja<<=1,!(Ja&130023424)&&(Ja=4194304)):e=1);var n=on();t=Wr(t,e),t!==null&&(bl(t,e,n),vn(t,n))}function K6(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),_5(t,n)}function Y6(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(J(314))}r!==null&&r.delete(e),_5(t,n)}var w5;w5=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||mn.current)pn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return pn=!1,I6(t,e,n);pn=!!(t.flags&131072)}else pn=!1,lt&&e.flags&1048576&&Py(e,Vu,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;ku(t,e),t=e.pendingProps;var s=us(e,Zt.current);ss(e,n),s=q0(null,e,r,t,s,n);var l=Z0();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,yn(r)?(l=!0,Gu(e)):l=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,K0(e),s.updater=fc,e.stateNode=s,s._reactInternals=e,jf(e,r,t,n),e=Xf(null,e,r,!0,l,n)):(e.tag=0,lt&&l&&U0(e),nn(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(ku(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=$6(r),t=Jn(r,t),s){case 0:e=Yf(null,e,r,t,n);break e;case 1:e=c2(null,e,r,t,n);break e;case 11:e=a2(null,e,r,t,n);break e;case 14:e=u2(null,e,r,Jn(r.type,t),n);break e}throw Error(J(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Jn(r,s),Yf(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Jn(r,s),c2(t,e,r,s,n);case 3:e:{if(o5(e),t===null)throw Error(J(387));r=e.pendingProps,l=e.memoizedState,s=l.element,Ly(t,e),ju(e,r,null,n);var a=e.memoizedState;if(r=a.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=l,e.memoizedState=l,e.flags&256){s=fs(Error(J(423)),e),e=d2(t,e,r,n,s);break e}else if(r!==s){s=fs(Error(J(424)),e),e=d2(t,e,r,n,s);break e}else for(Cn=xi(e.stateNode.containerInfo.firstChild),kn=e,lt=!0,tr=null,n=Fy(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(cs(),r===s){e=br(t,e,n);break e}nn(t,e,r,n)}e=e.child}return e;case 5:return zy(e),t===null&&Vf(e),r=e.type,s=e.pendingProps,l=t!==null?t.memoizedProps:null,a=s.children,Of(r,s)?a=null:l!==null&&Of(r,l)&&(e.flags|=32),i5(t,e),nn(t,e,a,n),e.child;case 6:return t===null&&Vf(e),null;case 13:return s5(t,e,n);case 4:return Y0(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ds(e,null,r,n):nn(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Jn(r,s),a2(t,e,r,s,n);case 7:return nn(t,e,e.pendingProps,n),e.child;case 8:return nn(t,e,e.pendingProps.children,n),e.child;case 12:return nn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,l=e.memoizedProps,a=s.value,et(Wu,r._currentValue),r._currentValue=a,l!==null)if(or(l.value,a)){if(l.children===s.children&&!mn.current){e=br(t,e,n);break e}}else for(l=e.child,l!==null&&(l.return=e);l!==null;){var c=l.dependencies;if(c!==null){a=l.child;for(var d=c.firstContext;d!==null;){if(d.context===r){if(l.tag===1){d=Ur(-1,n&-n),d.tag=2;var g=l.updateQueue;if(g!==null){g=g.shared;var y=g.pending;y===null?d.next=d:(d.next=y.next,y.next=d),g.pending=d}}l.lanes|=n,d=l.alternate,d!==null&&(d.lanes|=n),Wf(l.return,n,e),c.lanes|=n;break}d=d.next}}else if(l.tag===10)a=l.type===e.type?null:l.child;else if(l.tag===18){if(a=l.return,a===null)throw Error(J(341));a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Wf(a,n,e),a=l.sibling}else a=l.child;if(a!==null)a.return=l;else for(a=l;a!==null;){if(a===e){a=null;break}if(l=a.sibling,l!==null){l.return=a.return,a=l;break}a=a.return}l=a}nn(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,ss(e,n),s=Vn(s),r=r(s),e.flags|=1,nn(t,e,r,n),e.child;case 14:return r=e.type,s=Jn(r,e.pendingProps),s=Jn(r.type,s),u2(t,e,r,s,n);case 15:return n5(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Jn(r,s),ku(t,e),e.tag=1,yn(r)?(t=!0,Gu(e)):t=!1,ss(e,n),Jy(e,r,s),jf(e,r,s,n),Xf(null,e,r,!0,t,n);case 19:return l5(t,e,n);case 22:return r5(t,e,n)}throw Error(J(156,e.tag))};function C5(t,e){return Qm(t,e)}function X6(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(t,e,n,r){return new X6(t,e,n,r)}function ag(t){return t=t.prototype,!(!t||!t.isReactComponent)}function $6(t){if(typeof t=="function")return ag(t)?1:0;if(t!=null){if(t=t.$$typeof,t===T0)return 11;if(t===N0)return 14}return 2}function Ci(t,e){var n=t.alternate;return n===null?(n=Gn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Tu(t,e,n,r,s,l){var a=2;if(r=t,typeof t=="function")ag(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case jo:return so(n.children,s,l,e);case P0:a=8,s|=8;break;case pf:return t=Gn(12,n,e,s|2),t.elementType=pf,t.lanes=l,t;case mf:return t=Gn(13,n,e,s),t.elementType=mf,t.lanes=l,t;case yf:return t=Gn(19,n,e,s),t.elementType=yf,t.lanes=l,t;case zm:return mc(n,s,l,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Mm:a=10;break e;case Lm:a=9;break e;case T0:a=11;break e;case N0:a=14;break e;case ci:a=16,r=null;break e}throw Error(J(130,t==null?t:typeof t,""))}return e=Gn(a,n,e,s),e.elementType=t,e.type=r,e.lanes=l,e}function so(t,e,n,r){return t=Gn(7,t,r,e),t.lanes=n,t}function mc(t,e,n,r){return t=Gn(22,t,r,e),t.elementType=zm,t.lanes=n,t.stateNode={isHidden:!1},t}function Jh(t,e,n){return t=Gn(6,t,null,e),t.lanes=n,t}function ef(t,e,n){return e=Gn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Q6(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ih(0),this.expirationTimes=Ih(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ih(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function ug(t,e,n,r,s,l,a,c,d){return t=new Q6(t,e,n,c,d),e===1?(e=1,l===!0&&(e|=8)):e=0,l=Gn(3,null,null,e),t.current=l,l.stateNode=t,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},K0(l),t}function q6(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(T5)}catch(t){console.error(t)}}T5(),Tm.exports=Pn;var n8=Tm.exports,N5,C2=n8;N5=C2.createRoot,C2.hydrateRoot;function r8({selected:t=!1}){return I.jsx("div",{style:{position:"relative",width:"32px",height:"32px"},children:I.jsx("img",{alt:"Layout",style:{display:"block",width:"100%",height:"100%"},src:t?"/assets/sidebar icons/icon-Layout-selected.svg":"/assets/sidebar icons/icon-Layout-default.svg"})})}function i8(){return I.jsx("div",{style:{width:"32px",height:"32px",position:"relative"},children:I.jsx("img",{alt:"Huggy",style:{display:"block",width:"100%",height:"100%"},src:"/assets/sidebar icons/icon-addHuggy.svg"})})}function o8({selected:t=!1}){return I.jsx("div",{style:{position:"relative",width:"32px",height:"32px"},children:I.jsx("img",{alt:"Image",style:{display:"block",width:"100%",height:"100%"},src:t?"/assets/sidebar icons/icon-addImage-selected.svg":"/assets/sidebar icons/icon-addImage-default.svg"})})}function s8({selected:t=!1}){return I.jsx("div",{style:{position:"relative",width:"32px",height:"32px"},children:I.jsx("img",{alt:"Text",style:{display:"block",width:"100%",height:"100%"},src:t?"/assets/sidebar icons/icon-addText-selected.svg":"/assets/sidebar icons/icon-addText-default.svg"})})}const R5={seriousCollab:{id:"seriousCollab",name:"Serious Collab",thumbnail:"/assets/layouts/sCollab_thumbnail.png",objects:[{id:"hf-logo",type:"image",x:716.18,y:235.81,width:220.16,height:204.39,rotation:0,zIndex:1,src:"/assets/layouts/HF logo.png",name:"HF Logo"},{id:"logo-placeholder",type:"image",x:241.94,y:210.44,width:262.31,height:255.13,rotation:0,zIndex:2,src:"/assets/layouts/logo_placehoder.png",name:"Logo Placeholder"},{id:"x-icon",type:"image",x:619.01,y:329.12,width:16.76,height:16.76,rotation:0,zIndex:3,src:"/assets/layouts/collabX.svg",name:"X Icon"}]},funCollab:{id:"funCollab",name:"Fun Collab",thumbnail:"/assets/layouts/fCollab_thumbnail.png",objects:[{id:"title-text",type:"text",x:124,y:81.58,width:945.2583618164062,height:140,rotation:0,zIndex:1,text:"Pretty Short Title",fontSize:111.43,fontFamily:"Inter",fill:"#8a97ba",bold:!0,italic:!1,align:"center"},{id:"logo-placeholder",type:"image",x:278.6,y:232.76,width:311.73,height:306.01,rotation:351.366,zIndex:3,src:"/assets/layouts/logo_placehoder.png",name:"Logo Placeholder"},{id:"huggy-hand",type:"image",x:444.31341928814203,y:195.24545949041132,width:249.0715804458829,height:249.0715804458829,rotation:0,zIndex:2,src:"/assets/layouts/fCollab_huggy_hand_asset.png",name:"Huggy Hand"},{id:"huggy-group",type:"image",x:540.8452299149437,y:66.99999999999994,width:536.0247700850559,height:524.6602873270689,rotation:0,zIndex:4,src:"/assets/layouts/fCollab_huggy_asset.png",name:"Huggy Group"}]},sandwich:{id:"sandwich",name:"Sandwich",thumbnail:"/assets/layouts/sandwitch_thumbnail.png",objects:[{id:"title-text",type:"text",x:112.57,y:51.67,width:1050,height:190,rotation:0,zIndex:1,text:"Pretty short title",fontSize:161.62,fontFamily:"Bison",fill:"#8a97ba",bold:!0,italic:!1,align:"left",isFixedSize:!0},{id:"description-text",type:"text",x:92.5,y:503.48,width:1015,height:107,rotation:0,zIndex:2,text:"supportive description",fontSize:89.05,fontFamily:"Inter",fill:"#8a97ba",bold:!1,italic:!1,align:"center",isFixedSize:!0},{id:"singing-huggy",type:"image",x:336.34,y:130,width:565,height:389,rotation:0,zIndex:3,src:"/assets/layouts/snadwithc_huggy_asset.png",name:"Singing Huggy"}]},docs:{id:"docs",name:"Docs",thumbnail:"/assets/layouts/docs_thumbnail.png",objects:[{id:"docs-huggy-logo",type:"image",x:466,y:145.67,width:268,height:268,rotation:0,zIndex:1,src:"/assets/layouts/docsHFLogo.png",name:"Docs HF Logo"},{id:"title-text",type:"text",x:237.9214782714844,y:329.67,width:724.1570434570312,height:115.93,rotation:0,zIndex:2,text:"Transformers",fontSize:105.93,fontFamily:"Source Sans 3",fill:"#121212",bold:!0,italic:!1,align:"center",isFixedSize:!0,fontWeight:"black"},{id:"subtitle-text",type:"text",x:379.6729888916016,y:441.535,width:440.6540222167969,height:63.93,rotation:0,zIndex:3,text:"Documentation",fontSize:53.93,fontFamily:"IBM Plex Mono",fill:"#747474",bold:!1,italic:!1,align:"center",isFixedSize:!0}]},academiaHub:{id:"academiaHub",name:"Academia Hub",thumbnail:"/assets/layouts/academia_thumbnail.png",objects:[{id:"welcome-academia-hub",type:"image",x:342.0207815174148,y:96.80554723334625,width:515.9584369651704,height:68.45097665871741,rotation:0,zIndex:0,src:"/assets/layouts/welcome_academia_hub.png",name:"Welcome Academia Hub"},{id:"hf-logo",type:"image",x:750.0004969914753,y:259.12208128610206,width:259.950483451221,height:241.33030211026127,rotation:0,zIndex:1,src:"/assets/layouts/HF logo.png",name:"HF Logo"},{id:"logo-placeholder",type:"image",x:190.04901955730372,y:226.16684979465253,width:309.718438018213,height:301.24076509315995,rotation:0,zIndex:2,src:"/assets/layouts/logo_placehoder.png",name:"Logo Placeholder"},{id:"x-icon",type:"image",x:635.2685362494915,y:369.29640728007695,width:19.789108387729218,height:19.78910838772924,rotation:0,zIndex:3,src:"/assets/layouts/collabX.svg",name:"X Icon"}]}};function k2(t){return R5[t]}function l8(){return Object.values(R5)}function a8({onSelectLayout:t}){const e=l8();return I.jsx("div",{className:"layout-selector absolute left-[calc(100%+4px)] top-[5px] bg-[#f8f9fa] border border-[#3faee6] rounded-[10px] p-[5px] shadow-lg inline-block",children:I.jsxs("div",{className:"flex flex-col gap-0",children:[I.jsx("div",{className:"flex gap-0",children:e.slice(0,2).map(n=>I.jsxs("button",{onClick:()=>t(n.id),className:"flex flex-col items-center gap-[5px] p-[10px] rounded-[5px] hover:bg-[#e9ecef] transition-colors flex-1",children:[I.jsx("div",{className:"w-[96.5px] h-[47.291px] rounded-[5px] flex items-center justify-center overflow-hidden",children:I.jsx("img",{src:n.thumbnail,alt:n.name,className:"w-full h-full object-cover"})}),I.jsx("p",{className:"text-[14px] font-normal text-[#545865] text-center",children:n.name})]},n.id))}),I.jsx("div",{className:"flex gap-0",children:e.slice(2,4).map(n=>I.jsxs("button",{onClick:()=>t(n.id),className:"flex flex-col items-center gap-[5px] p-[10px] rounded-[5px] hover:bg-[#e9ecef] transition-colors flex-1",children:[I.jsx("div",{className:"w-[96.5px] h-[47.291px] rounded-[5px] flex items-center justify-center overflow-hidden",children:I.jsx("img",{src:n.thumbnail,alt:n.name,className:"w-full h-full object-cover"})}),I.jsx("p",{className:"text-[14px] font-normal text-[#545865] text-center",children:n.name})]},n.id))}),I.jsx("div",{className:"flex gap-0",children:e.slice(4,6).map(n=>I.jsxs("button",{onClick:()=>t(n.id),className:"flex flex-col items-center gap-[5px] p-[10px] rounded-[5px] hover:bg-[#e9ecef] transition-colors flex-1",children:[I.jsx("div",{className:"w-[96.5px] h-[47.291px] rounded-[5px] flex items-center justify-center overflow-hidden",children:I.jsx("img",{src:n.thumbnail,alt:n.name,className:"w-full h-full object-cover"})}),I.jsx("p",{className:"text-[14px] font-normal text-[#545865] text-center",children:n.name})]},n.id))})]})})}const Pe="https://huggingface.co/datasets/Chunte/Huggy/resolve/main",u8=[{id:"acedemic-huggy",name:"Acedemic Huggy",thumbnail:`${Pe}/modern%20Huggies/Acedemic%20Huggy.png`,category:"modern",tags:["acedemic","academic","education","modern"]},{id:"back-of-huggy",name:"Back of a Huggy",thumbnail:`${Pe}/modern%20Huggies/Back%20of%20a%20Huggy.png`,category:"modern",tags:["back","modern"]},{id:"d-huggy",name:"D Huggy",thumbnail:`${Pe}/modern%20Huggies/D%20Huggy.png`,category:"modern",tags:["d","letter","modern"]},{id:"dragon-huggy",name:"Dragon Huggy",thumbnail:`${Pe}/modern%20Huggies/Dragon%20Huggy.png`,category:"modern",tags:["dragon","fantasy","modern"]},{id:"game-jam-huggy",name:"Game Jam Huggy",thumbnail:`${Pe}/modern%20Huggies/Game%20Jam%20Huggy.png`,category:"modern",tags:["game","jam","gaming","modern"]},{id:"huggy-chef",name:"Huggy Chef",thumbnail:`${Pe}/modern%20Huggies/Huggy%20Chef.png`,category:"modern",tags:["chef","cooking","food","modern"]},{id:"huggy-hi",name:"Huggy Hi",thumbnail:`${Pe}/modern%20Huggies/Huggy%20Hi.png`,category:"modern",tags:["hi","hello","greeting","wave","modern"]},{id:"huggy-lab",name:"Huggy Lab",thumbnail:`${Pe}/modern%20Huggies/Huggy%20Lab.png`,category:"modern",tags:["lab","laboratory","science","modern"]},{id:"huggy-medic",name:"Huggy Medic",thumbnail:`${Pe}/modern%20Huggies/Huggy%20Medic.png`,category:"modern",tags:["medic","medical","doctor","health","modern"]},{id:"huggy-okay",name:"Huggy Okay",thumbnail:`${Pe}/modern%20Huggies/Huggy%20Okay.png`,category:"modern",tags:["okay","ok","thumbs up","modern"]},{id:"huggy-sunny-hello",name:"Huggy Sunny hello",thumbnail:`${Pe}/modern%20Huggies/Huggy%20Sunny%20hello.png`,category:"modern",tags:["sunny","hello","greeting","summer","modern"]},{id:"huggy-sunny",name:"Huggy Sunny",thumbnail:`${Pe}/modern%20Huggies/Huggy%20Sunny.png`,category:"modern",tags:["sunny","summer","sun","modern"]},{id:"huggy-yolk",name:"Huggy Yolk",thumbnail:`${Pe}/modern%20Huggies/Huggy%20Yolk.png`,category:"modern",tags:["yolk","egg","food","modern"]},{id:"huggy-blink-okay",name:"Huggy blink Okay",thumbnail:`${Pe}/modern%20Huggies/Huggy%20blink%20Okay.png`,category:"modern",tags:["blink","okay","wink","modern"]},{id:"huggy-the-pooh-meme",name:"Huggy the Pooh meme",thumbnail:`${Pe}/modern%20Huggies/Huggy%20the%20Pooh%20meme.png`,category:"modern",tags:["pooh","meme","funny","modern"]},{id:"idefics-huggy",name:"IDEFICS Huggy",thumbnail:`${Pe}/modern%20Huggies/IDEFICS%20Huggy.png`,category:"modern",tags:["idefics","vision","multimodal","ai","modern"]},{id:"karaoke-huggy",name:"Karaoke Huggy",thumbnail:`${Pe}/modern%20Huggies/Karaoke%20Huggy.png`,category:"modern",tags:["karaoke","singing","music","modern"]},{id:"lora-huggy",name:"Lora Huggy",thumbnail:`${Pe}/modern%20Huggies/Lora%20Huggy.png`,category:"modern",tags:["lora","ai","model","modern"]},{id:"optimum-huggy",name:"Optimum Huggy",thumbnail:`${Pe}/modern%20Huggies/Optimum%20Huggy.png`,category:"modern",tags:["optimum","optimization","ai","modern"]},{id:"robot-huggy",name:"Robot Huggy",thumbnail:`${Pe}/modern%20Huggies/Robot%20Huggy.png`,category:"modern",tags:["robot","automation","ai","modern"]},{id:"snake-huggy",name:"Snake Huggy",thumbnail:`${Pe}/modern%20Huggies/Snake%20Huggy.png`,category:"modern",tags:["snake","python","code","modern"]},{id:"super-huggy",name:"Super Huggy",thumbnail:`${Pe}/modern%20Huggies/Super%20Huggy.png`,category:"modern",tags:["super","hero","superhero","modern"]},{id:"text-generation-wizard-huggy",name:"Text Generation Wizard Huggy",thumbnail:`${Pe}/modern%20Huggies/Text%20Generation%20Wizard%20Huggy.png`,category:"modern",tags:["text","generation","wizard","nlp","ai","modern"]},{id:"transformer-agent-huggy",name:"Transformer Agent Huggy",thumbnail:`${Pe}/modern%20Huggies/Transformer%20Agent%20Huggy.png`,category:"modern",tags:["transformer","agent","ai","nlp","modern"]},{id:"wine-huggy",name:"Wine Huggy",thumbnail:`${Pe}/modern%20Huggies/Wine%20Huggy.png`,category:"modern",tags:["wine","drink","celebration","modern"]},{id:"computer-vision-huggy",name:"computer vision Huggy",thumbnail:`${Pe}/modern%20Huggies/computer%20vision%20Huggy.png`,category:"modern",tags:["computer","vision","cv","ai","model","modern"]}],c8=[{id:"catching-huggy",name:"Catching Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Catching%20Huggy.png`,category:"outlined",tags:["catching","catch","outlined"]},{id:"comic-huggy",name:"Comic Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Comic%20Huggy.png`,category:"outlined",tags:["comic","cartoon","outlined"]},{id:"curious-huggy",name:"Curious Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Curious%20Huggy.png`,category:"outlined",tags:["curious","wondering","thinking","outlined"]},{id:"diffusor-guide-huggy",name:"Diffusor guide Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Diffusor%20guide%20Huggy.png`,category:"outlined",tags:["diffusor","diffusion","guide","ai","outlined"]},{id:"fishing-huggy",name:"Fishing Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Fishing%20Huggy.png`,category:"outlined",tags:["fishing","fish","outdoor","outlined"]},{id:"gpu-huggy",name:"GPU Huggy",thumbnail:`${Pe}/Outlined%20Huggies/GPU%20Huggy.png`,category:"outlined",tags:["gpu","graphics","computing","hardware","outlined"]},{id:"global-huggy",name:"Global Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Global%20Huggy.png`,category:"outlined",tags:["global","world","international","outlined"]},{id:"greeting-huggy-left",name:"Greeting Huggy left",thumbnail:`${Pe}/Outlined%20Huggies/Greeting%20Huggy%20left.png`,category:"outlined",tags:["greeting","hello","wave","left","outlined"]},{id:"greeting-huggy-right",name:"Greeting Huggy right",thumbnail:`${Pe}/Outlined%20Huggies/Greeting%20Huggy%20right.png`,category:"outlined",tags:["greeting","hello","wave","right","outlined"]},{id:"growing-model-huggy",name:"Growing model Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Growing%20model%20Huggy.png`,category:"outlined",tags:["growing","model","ai","growth","outlined"]},{id:"guide-huggy",name:"Guide Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Guide%20Huggy.png`,category:"outlined",tags:["guide","help","tutorial","outlined"]},{id:"loving-modelndataset-huggy",name:"Loving modelndataset Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Loving%20modelndataset%20Huggy.png`,category:"outlined",tags:["loving","model","dataset","heart","outlined"]},{id:"manager-huggy",name:"Manager Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Manager%20Huggy.png`,category:"outlined",tags:["manager","management","business","outlined"]},{id:"paper-huggy",name:"Paper Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Paper%20Huggy.png`,category:"outlined",tags:["paper","research","document","outlined"]},{id:"rocket-huggy",name:"Rocket Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Rocket%20Huggy.png`,category:"outlined",tags:["rocket","space","launch","fast","outlined"]},{id:"scan-huggy",name:"Scan Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Scan%20Huggy.png`,category:"outlined",tags:["scan","search","find","outlined"]},{id:"violinist-huggy",name:"Violinist Huggy",thumbnail:`${Pe}/Outlined%20Huggies/Violinist%20Huggy.png`,category:"outlined",tags:["violinist","violin","music","classical","outlined"]},{id:"xray-huggy",name:"X-ray Huggy",thumbnail:`${Pe}/Outlined%20Huggies/X-ray%20Huggy.png`,category:"outlined",tags:["xray","x-ray","medical","scan","outlined"]}],E2=[...u8,...c8];function d8(t){if(!t.trim())return E2;const e=t.toLowerCase().trim();return E2.filter(n=>!!(n.name.toLowerCase().replace("huggy","").trim().includes(e)||n.name.toLowerCase().includes(e)||n.category.toLowerCase().includes(e)||n.tags&&n.tags.some(s=>s.toLowerCase().includes(e))))}const P2=12,T2=6;function h8({onSelectHuggy:t,onClose:e}){const[n,r]=X.useState(""),[s,l]=X.useState(P2),[a,c]=X.useState(new Set),d=X.useRef(null),g=X.useMemo(()=>d8(n),[n]),y=g.slice(0,s),w=s{const P=d.current;if(!P||!w)return;const C=setTimeout(()=>{const{scrollHeight:p,clientHeight:S}=P;p<=S&&w&&l(R=>Math.min(R+T2,g.length))},100);return()=>clearTimeout(C)},[s,w,g.length]),X.useEffect(()=>{const P=d.current;if(!P)return;const k=()=>{const{scrollTop:C,scrollHeight:p,clientHeight:S}=P;(C+S)/p>.8&&w&&l(F=>Math.min(F+T2,g.length))};return P.addEventListener("scroll",k),()=>P.removeEventListener("scroll",k)},[w,g.length]);const x=P=>{t(P),e()},_=P=>{c(k=>{const C=new Set(k);return C.delete(P),C})},v=P=>{c(k=>new Set(k).add(P))},E=P=>{r(P.target.value),l(P2)};return I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"fixed inset-0 z-10",onClick:e}),I.jsxs("div",{className:"huggy-menu fixed left-[107px] top-[20px] z-20 w-[340px] bg-[#f8f9fa] border border-[#3faee6] rounded-[10px] flex flex-col overflow-hidden shadow-lg",children:[I.jsx("div",{className:"border-b border-[#ebebeb] p-[5px]",children:I.jsx("input",{type:"text",placeholder:"Search Huggy",value:n,onChange:E,className:"w-full bg-transparent border-none outline-none text-[14px] text-[#999999] font-['Inter'] placeholder-[#999999]",autoFocus:!0})}),I.jsx("div",{ref:d,className:"overflow-y-auto p-[5px]",style:{maxHeight:"430px"},children:g.length===0?I.jsx("div",{className:"text-center text-[#999999] text-[14px] py-8",children:"No Huggys found"}):I.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 gap-[5px] p-[5px]",children:y.map(P=>I.jsxs("button",{onClick:()=>x(P),className:"relative w-full aspect-square rounded-[5px] overflow-hidden hover:bg-[#e9ecef] transition-colors cursor-pointer border-none p-0",title:P.name,children:[a.has(P.id)&&I.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#f0f0f0]",children:I.jsx("div",{className:"w-6 h-6 border-2 border-[#3faee6] border-t-transparent rounded-full animate-spin"})}),I.jsx("img",{src:P.thumbnail,alt:P.name,className:"w-full h-full object-cover",loading:"lazy",onLoadStart:()=>v(P.id),onLoad:()=>_(P.id),onError:()=>_(P.id)})]},P.id))})}),I.jsx("div",{className:"border-t border-[#ebebeb] p-[5px] text-center",children:I.jsxs("p",{className:"text-[#999999] text-[12px]",children:["Showing ",y.length," of ",g.length," Huggys"]})})]})]})}function f8({onLayoutClick:t,onHuggyClick:e,onImageClick:n,onTextClick:r,onSelectLayout:s,onSelectHuggy:l,activeButton:a}){return I.jsx("div",{className:"fixed left-5 top-1/2 -translate-y-1/2 z-50",children:I.jsxs("div",{className:"sidebar-container bg-[#f8f9fa] border border-[#D7DCE2] rounded-[12px] p-[5px] flex flex-col gap-[15px] w-[87px] relative",children:[I.jsxs("button",{onClick:t,className:`flex flex-col items-center gap-[3px] px-[13px] py-[5px] rounded-[7px] transition-colors ${a==="layout"?"bg-[#3faee6]":"hover:bg-[#e9ecef]"}`,children:[I.jsx("div",{className:"w-[32px] h-[32px] flex items-center justify-center",children:I.jsx(r8,{selected:a==="layout"})}),I.jsx("p",{className:`text-[16px] font-normal ${a==="layout"?"text-white":"text-[#545865]"}`,children:"Layout"})]}),I.jsxs("button",{onClick:e,className:`flex flex-col items-center gap-[3px] px-[13px] py-[5px] rounded-[7px] transition-colors ${a==="huggy"?"bg-[#3faee6]":"hover:bg-[#e9ecef]"}`,children:[I.jsx("div",{className:"w-[32px] h-[32px] flex items-center justify-center",children:I.jsx(i8,{})}),I.jsx("p",{className:`text-[16px] font-normal ${a==="huggy"?"text-white":"text-[#545865]"}`,children:"Huggy"})]}),I.jsxs("button",{onClick:n,className:`flex flex-col items-center gap-[3px] px-[13px] py-[5px] rounded-[7px] transition-colors ${a==="image"?"bg-[#3faee6]":"hover:bg-[#e9ecef]"}`,children:[I.jsx("div",{className:"w-[32px] h-[32px] flex items-center justify-center",children:I.jsx(o8,{selected:a==="image"})}),I.jsx("p",{className:`text-[16px] font-normal ${a==="image"?"text-white":"text-[#545865]"}`,children:"Image"})]}),I.jsxs("button",{onClick:r,className:`flex flex-col items-center gap-[3px] px-[13px] py-[5px] rounded-[7px] transition-colors ${a==="text"?"bg-[#3faee6]":"hover:bg-[#e9ecef]"}`,children:[I.jsx("div",{className:"w-[32px] h-[32px] flex items-center justify-center",children:I.jsx(s8,{selected:a==="text"})}),I.jsx("p",{className:`text-[16px] font-normal ${a==="text"?"text-white":"text-[#545865]"}`,children:"Text"})]}),a==="layout"&&I.jsx(a8,{onSelectLayout:s}),a==="huggy"&&I.jsx(h8,{onSelectHuggy:l,onClose:()=>e()}),a==="text"&&I.jsx("div",{className:"text-hint absolute left-[calc(100%+4px)] bottom-[5px] bg-[#3faee6] rounded-[10px] p-[10px] w-[233px]",children:I.jsx("p",{className:"text-white text-[16px] font-normal leading-normal",children:"Click anywhere on the canvas to add texts"})})]})})}/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var g8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),po=(t,e)=>{const n=X.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:a,className:c="",children:d,...g},y)=>X.createElement("svg",{ref:y,...g8,width:s,height:s,stroke:r,strokeWidth:a?Number(l)*24/Number(s):l,className:["lucide",`lucide-${p8(t)}`,c].join(" "),...g},[...e.map(([w,x])=>X.createElement(w,x)),...Array.isArray(d)?d:[d]]));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m8=po("Bold",[["path",{d:"M14 12a4 4 0 0 0 0-8H6v8",key:"v2sylx"}],["path",{d:"M15 20a4 4 0 0 0 0-8H6v8Z",key:"1ef5ya"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y8=po("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v8=po("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x8=po("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const S8=po("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _8=po("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w8=po("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function C8({onExport:t,isExporting:e=!1,currentLayout:n,canvasSize:r}){const s=P=>{switch(P){case"1200x675":return"Twitter";case"linkedin":return"LinkedIn";case"hf":return"HF";default:return"Twitter"}},l=()=>{const P=s(r);return n?`${n}_${P}`:`thumbnail_${P}`},[a,c]=X.useState(l()),[d,g]=X.useState(!1),[y,w]=X.useState(0),[x,_]=X.useState(!1),v=X.useRef(null);X.useEffect(()=>{c(l())},[n,r]),X.useEffect(()=>{v.current&&w(v.current.offsetWidth)},[a]);const E=()=>{e||t(a)};return I.jsxs("div",{style:{position:"fixed",top:"30px",right:"22px",zIndex:50,backgroundColor:"#262933",borderRadius:"10px",padding:"5px",display:"inline-flex",alignItems:"stretch",gap:"5px",boxShadow:"0px 0px 0px 0px rgba(0,0,0,0), 0px 0px 0px 0px rgba(0,0,0,0.03), 0px 0px 6.417px 0px rgba(0,0,0,0.09), 0px 0px 4.583px 0px rgba(0,0,0,0.15), 0px 0px 2.75px 0px rgba(0,0,0,0.17), 0px 16.847px 21.059px -4.212px rgba(14,13,13,0.1), 0px 8.423px 8.423px -4.212px rgba(0,0,0,0.04)",opacity:e?.5:1,transition:"all 0.2s ease-in-out",width:"fit-content"},children:[I.jsx("button",{onClick:E,disabled:e,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:x?"#0d6ecc":"#1888ff",borderRadius:"5px",width:"32px",aspectRatio:"1",flexShrink:0,border:"none",cursor:e?"not-allowed":"pointer",padding:0},children:e?I.jsx(S8,{size:16,color:"white",style:{animation:"spin 1s linear infinite"}}):I.jsx(v8,{size:16,color:"white"})}),I.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",paddingRight:"5px",minHeight:"32px"},children:[I.jsx("span",{ref:v,style:{position:"absolute",visibility:"hidden",whiteSpace:"pre",fontSize:"16px",fontFamily:"Inter, sans-serif",fontWeight:"normal",padding:"5px"},children:a||"thumbnail_name"}),I.jsx("input",{type:"text",value:a,onChange:P=>c(P.target.value),onFocus:()=>g(!0),onBlur:()=>g(!1),disabled:e,placeholder:"thumbnail_name",style:{backgroundColor:"rgba(255, 255, 255, 0.05)",color:"white",fontSize:"16px",fontFamily:"Inter, sans-serif",fontWeight:"normal",outline:"none",border:"none",padding:"5px",borderRadius:"4px",width:`${y}px`,cursor:e?"not-allowed":"text",opacity:d?1:.5,transition:"opacity 0.2s"},onClick:P=>P.stopPropagation()}),I.jsx("span",{style:{color:"white",fontSize:"16px",fontFamily:"Inter, sans-serif",fontWeight:"normal"},children:".png"})]})]})}function k8({children:t,scale:e=1}){return I.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:I.jsx("div",{className:"canvas-container",style:{display:"flex",flexDirection:"column",gap:"10px"},children:t})})}var fg={exports:{}},_c={},ec={},Fe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const e=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}t.glob=typeof g1<"u"?g1:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},t.Konva={_global:t.glob,version:"9.3.22",isBrowser:n(),isUnminified:/param/.test((function(s){}).toString()),dblClickWindow:400,getAngle(s){return t.Konva.angleDeg?s*e:s},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return t.Konva.DD.isDragging},isTransforming(){var s;return(s=t.Konva.Transformer)===null||s===void 0?void 0:s.isTransforming()},isDragReady(){return!!t.Konva.DD.node},releaseCanvasOnDestroy:!0,document:t.glob.document,_injectGlobal(s){t.glob.Konva=s}};const r=s=>{t.Konva[s.prototype.getClassName()]=s};t._registerNode=r,t.Konva._injectGlobal(t.Konva)})(Fe);var gt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const e=Fe;class n{constructor(S=[1,0,0,1,0,0]){this.dirty=!1,this.m=S&&S.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(S){S.m[0]=this.m[0],S.m[1]=this.m[1],S.m[2]=this.m[2],S.m[3]=this.m[3],S.m[4]=this.m[4],S.m[5]=this.m[5]}point(S){const R=this.m;return{x:R[0]*S.x+R[2]*S.y+R[4],y:R[1]*S.x+R[3]*S.y+R[5]}}translate(S,R){return this.m[4]+=this.m[0]*S+this.m[2]*R,this.m[5]+=this.m[1]*S+this.m[3]*R,this}scale(S,R){return this.m[0]*=S,this.m[1]*=S,this.m[2]*=R,this.m[3]*=R,this}rotate(S){const R=Math.cos(S),F=Math.sin(S),L=this.m[0]*R+this.m[2]*F,N=this.m[1]*R+this.m[3]*F,z=this.m[0]*-F+this.m[2]*R,M=this.m[1]*-F+this.m[3]*R;return this.m[0]=L,this.m[1]=N,this.m[2]=z,this.m[3]=M,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(S,R){const F=this.m[0]+this.m[2]*R,L=this.m[1]+this.m[3]*R,N=this.m[2]+this.m[0]*S,z=this.m[3]+this.m[1]*S;return this.m[0]=F,this.m[1]=L,this.m[2]=N,this.m[3]=z,this}multiply(S){const R=this.m[0]*S.m[0]+this.m[2]*S.m[1],F=this.m[1]*S.m[0]+this.m[3]*S.m[1],L=this.m[0]*S.m[2]+this.m[2]*S.m[3],N=this.m[1]*S.m[2]+this.m[3]*S.m[3],z=this.m[0]*S.m[4]+this.m[2]*S.m[5]+this.m[4],M=this.m[1]*S.m[4]+this.m[3]*S.m[5]+this.m[5];return this.m[0]=R,this.m[1]=F,this.m[2]=L,this.m[3]=N,this.m[4]=z,this.m[5]=M,this}invert(){const S=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),R=this.m[3]*S,F=-this.m[1]*S,L=-this.m[2]*S,N=this.m[0]*S,z=S*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),M=S*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=R,this.m[1]=F,this.m[2]=L,this.m[3]=N,this.m[4]=z,this.m[5]=M,this}getMatrix(){return this.m}decompose(){const S=this.m[0],R=this.m[1],F=this.m[2],L=this.m[3],N=this.m[4],z=this.m[5],M=S*L-R*F,H={x:N,y:z,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(S!=0||R!=0){const b=Math.sqrt(S*S+R*R);H.rotation=R>0?Math.acos(S/b):-Math.acos(S/b),H.scaleX=b,H.scaleY=M/b,H.skewX=(S*F+R*L)/M,H.skewY=0}else if(F!=0||L!=0){const b=Math.sqrt(F*F+L*L);H.rotation=Math.PI/2-(L>0?Math.acos(-F/b):-Math.acos(F/b)),H.scaleX=M/b,H.scaleY=b,H.skewX=0,H.skewY=(S*F+R*L)/M}return H.rotation=t.Util._getRotation(H.rotation),H}}t.Transform=n;const r="[object Array]",s="[object Number]",l="[object String]",a="[object Boolean]",c=Math.PI/180,d=180/Math.PI,g="#",y="",w="0",x="Konva warning: ",_="Konva error: ",v="rgb(",E={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})\)/;let k=[];const C=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(p){setTimeout(p,60)};t.Util={_isElement(p){return!!(p&&p.nodeType==1)},_isFunction(p){return!!(p&&p.constructor&&p.call&&p.apply)},_isPlainObject(p){return!!p&&p.constructor===Object},_isArray(p){return Object.prototype.toString.call(p)===r},_isNumber(p){return Object.prototype.toString.call(p)===s&&!isNaN(p)&&isFinite(p)},_isString(p){return Object.prototype.toString.call(p)===l},_isBoolean(p){return Object.prototype.toString.call(p)===a},isObject(p){return p instanceof Object},isValidSelector(p){if(typeof p!="string")return!1;const S=p[0];return S==="#"||S==="."||S===S.toUpperCase()},_sign(p){return p===0||p>0?1:-1},requestAnimFrame(p){k.push(p),k.length===1&&C(function(){const S=k;k=[],S.forEach(function(R){R()})})},createCanvasElement(){const p=document.createElement("canvas");try{p.style=p.style||{}}catch{}return p},createImageElement(){return document.createElement("img")},_isInDocument(p){for(;p=p.parentNode;)if(p==document)return!0;return!1},_urlToImage(p,S){const R=t.Util.createImageElement();R.onload=function(){S(R)},R.src=p},_rgbToHex(p,S,R){return((1<<24)+(p<<16)+(S<<8)+R).toString(16).slice(1)},_hexToRgb(p){p=p.replace(g,y);const S=parseInt(p,16);return{r:S>>16&255,g:S>>8&255,b:S&255}},getRandomColor(){let p=(Math.random()*16777215<<0).toString(16);for(;p.length<6;)p=w+p;return g+p},getRGB(p){let S;return p in E?(S=E[p],{r:S[0],g:S[1],b:S[2]}):p[0]===g?this._hexToRgb(p.substring(1)):p.substr(0,4)===v?(S=P.exec(p.replace(/ /g,"")),{r:parseInt(S[1],10),g:parseInt(S[2],10),b:parseInt(S[3],10)}):{r:0,g:0,b:0}},colorToRGBA(p){return p=p||"black",t.Util._namedColorToRBA(p)||t.Util._hex3ColorToRGBA(p)||t.Util._hex4ColorToRGBA(p)||t.Util._hex6ColorToRGBA(p)||t.Util._hex8ColorToRGBA(p)||t.Util._rgbColorToRGBA(p)||t.Util._rgbaColorToRGBA(p)||t.Util._hslColorToRGBA(p)},_namedColorToRBA(p){const S=E[p.toLowerCase()];return S?{r:S[0],g:S[1],b:S[2],a:1}:null},_rgbColorToRGBA(p){if(p.indexOf("rgb(")===0){p=p.match(/rgb\(([^)]+)\)/)[1];const S=p.split(/ *, */).map(Number);return{r:S[0],g:S[1],b:S[2],a:1}}},_rgbaColorToRGBA(p){if(p.indexOf("rgba(")===0){p=p.match(/rgba\(([^)]+)\)/)[1];const S=p.split(/ *, */).map((R,F)=>R.slice(-1)==="%"?F===3?parseInt(R)/100:parseInt(R)/100*255:Number(R));return{r:S[0],g:S[1],b:S[2],a:S[3]}}},_hex8ColorToRGBA(p){if(p[0]==="#"&&p.length===9)return{r:parseInt(p.slice(1,3),16),g:parseInt(p.slice(3,5),16),b:parseInt(p.slice(5,7),16),a:parseInt(p.slice(7,9),16)/255}},_hex6ColorToRGBA(p){if(p[0]==="#"&&p.length===7)return{r:parseInt(p.slice(1,3),16),g:parseInt(p.slice(3,5),16),b:parseInt(p.slice(5,7),16),a:1}},_hex4ColorToRGBA(p){if(p[0]==="#"&&p.length===5)return{r:parseInt(p[1]+p[1],16),g:parseInt(p[2]+p[2],16),b:parseInt(p[3]+p[3],16),a:parseInt(p[4]+p[4],16)/255}},_hex3ColorToRGBA(p){if(p[0]==="#"&&p.length===4)return{r:parseInt(p[1]+p[1],16),g:parseInt(p[2]+p[2],16),b:parseInt(p[3]+p[3],16),a:1}},_hslColorToRGBA(p){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(p)){const[S,...R]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(p),F=Number(R[0])/360,L=Number(R[1])/100,N=Number(R[2])/100;let z,M,H;if(L===0)return H=N*255,{r:Math.round(H),g:Math.round(H),b:Math.round(H),a:1};N<.5?z=N*(1+L):z=N+L-N*L;const b=2*N-z,q=[0,0,0];for(let ie=0;ie<3;ie++)M=F+1/3*-(ie-1),M<0&&M++,M>1&&M--,6*M<1?H=b+(z-b)*6*M:2*M<1?H=z:3*M<2?H=b+(z-b)*(2/3-M)*6:H=b,q[ie]=H*255;return{r:Math.round(q[0]),g:Math.round(q[1]),b:Math.round(q[2]),a:1}}},haveIntersection(p,S){return!(S.x>p.x+p.width||S.x+S.widthp.y+p.height||S.y+S.height1?(z=R,M=F,H=(R-L)*(R-L)+(F-N)*(F-N)):(z=p+q*(R-p),M=S+q*(F-S),H=(z-L)*(z-L)+(M-N)*(M-N))}return[z,M,H]},_getProjectionToLine(p,S,R){const F=t.Util.cloneObject(p);let L=Number.MAX_VALUE;return S.forEach(function(N,z){if(!R&&z===S.length-1)return;const M=S[(z+1)%S.length],H=t.Util._getProjectionToSegment(N.x,N.y,M.x,M.y,p.x,p.y),b=H[0],q=H[1],ie=H[2];ieS.length){const z=S;S=p,p=z}for(let z=0;z{S.width=0,S.height=0})},drawRoundedRectPath(p,S,R,F){let L=0,N=0,z=0,M=0;typeof F=="number"?L=N=z=M=Math.min(F,S/2,R/2):(L=Math.min(F[0]||0,S/2,R/2),N=Math.min(F[1]||0,S/2,R/2),M=Math.min(F[2]||0,S/2,R/2),z=Math.min(F[3]||0,S/2,R/2)),p.moveTo(L,0),p.lineTo(S-N,0),p.arc(S-N,N,N,Math.PI*3/2,0,!1),p.lineTo(S,R-M),p.arc(S-M,R-M,M,0,Math.PI/2,!1),p.lineTo(z,R),p.arc(z,R-z,z,Math.PI/2,Math.PI,!1),p.lineTo(0,L),p.arc(L,L,L,Math.PI,Math.PI*3/2,!1)}}})(gt);var at={},ir={},Gr={};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.HitContext=Gr.SceneContext=Gr.Context=void 0;const F5=gt,E8=Fe;function P8(t){const e=[],n=t.length,r=F5.Util;for(let s=0;stypeof y=="number"?Math.floor(y):y)),l+=T8+g.join(N2)+N8)):(l+=c.property,e||(l+=z8+c.val)),l+=M8;return l}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,r;n.push(e),r=n.length,r>=D8&&n.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){const n=e.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(e){const n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){const n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,r,s,l,a){this._context.arc(e,n,r,s,l,a)}arcTo(e,n,r,s,l){this._context.arcTo(e,n,r,s,l)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,s,l,a){this._context.bezierCurveTo(e,n,r,s,l,a)}clearRect(e,n,r,s){this._context.clearRect(e,n,r,s)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){const r=arguments;if(r.length===2)return this._context.createImageData(e,n);if(r.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,r,s){return this._context.createLinearGradient(e,n,r,s)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,r,s,l,a){return this._context.createRadialGradient(e,n,r,s,l,a)}drawImage(e,n,r,s,l,a,c,d,g){const y=arguments,w=this._context;y.length===3?w.drawImage(e,n,r):y.length===5?w.drawImage(e,n,r,s,l):y.length===9&&w.drawImage(e,n,r,s,l,a,c,d,g)}ellipse(e,n,r,s,l,a,c,d){this._context.ellipse(e,n,r,s,l,a,c,d)}isPointInPath(e,n,r,s){return r?this._context.isPointInPath(r,e,n,s):this._context.isPointInPath(e,n,s)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,r,s){this._context.fillRect(e,n,r,s)}strokeRect(e,n,r,s){this._context.strokeRect(e,n,r,s)}fillText(e,n,r,s){s?this._context.fillText(e,n,r,s):this._context.fillText(e,n,r)}measureText(e){return this._context.measureText(e)}getImageData(e,n,r,s){return this._context.getImageData(e,n,r,s)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,r,s){this._context.rect(e,n,r,s)}roundRect(e,n,r,s,l){this._context.roundRect(e,n,r,s,l)}putImageData(e,n,r){this._context.putImageData(e,n,r)}quadraticCurveTo(e,n,r,s){this._context.quadraticCurveTo(e,n,r,s)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,r,s,l,a){this._context.setTransform(e,n,r,s,l,a)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,r,s){this._context.strokeText(e,n,r,s)}transform(e,n,r,s,l,a){this._context.transform(e,n,r,s,l,a)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=R2.length,r=this.setAttr,s,l;const a=function(c){let d=e[c],g;e[c]=function(){return l=P8(Array.prototype.slice.call(arguments,0)),g=d.apply(e,arguments),e._trace({method:c,args:l}),g}};for(s=0;s{s.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){let r;return t.DD._dragElements.forEach(s=>{r=s.node}),r},_dragElements:new Map,_drag(r){const s=[];t.DD._dragElements.forEach((l,a)=>{const{node:c}=l,d=c.getStage();d.setPointersPositions(r),l.pointerId===void 0&&(l.pointerId=n.Util._getFirstPointerId(r));const g=d._changedPointerPositions.find(y=>y.id===l.pointerId);if(g){if(l.dragStatus!=="dragging"){const y=c.dragDistance();if(Math.max(Math.abs(g.x-l.startPointerPos.x),Math.abs(g.y-l.startPointerPos.y)){l.fire("dragmove",{type:"dragmove",target:l,evt:r},!0)})},_endDragBefore(r){const s=[];t.DD._dragElements.forEach(l=>{const{node:a}=l,c=a.getStage();if(r&&c.setPointersPositions(r),!c._changedPointerPositions.find(y=>y.id===l.pointerId))return;(l.dragStatus==="dragging"||l.dragStatus==="stopped")&&(t.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,l.dragStatus="stopped");const g=l.node.getLayer()||l.node instanceof e.Konva.Stage&&l.node;g&&s.indexOf(g)===-1&&s.push(g)}),s.forEach(l=>{l.draw()})},_endDragAfter(r){t.DD._dragElements.forEach((s,l)=>{s.dragStatus==="stopped"&&s.node.fire("dragend",{type:"dragend",target:s.node,evt:r},!0),s.dragStatus!=="dragging"&&t.DD._dragElements.delete(l)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("touchcancel",t.DD._endDragBefore,!0),window.addEventListener("mousemove",t.DD._drag),window.addEventListener("touchmove",t.DD._drag),window.addEventListener("mouseup",t.DD._endDragAfter,!1),window.addEventListener("touchend",t.DD._endDragAfter,!1),window.addEventListener("touchcancel",t.DD._endDragAfter,!1))})(Cc);var Le={},we={};Object.defineProperty(we,"__esModule",{value:!0});we.RGBComponent=B8;we.alphaComponent=V8;we.getNumberValidator=W8;we.getNumberOrArrayOfNumbersValidator=b8;we.getNumberOrAutoValidator=j8;we.getStringValidator=K8;we.getStringOrGradientValidator=Y8;we.getFunctionValidator=X8;we.getNumberArrayValidator=$8;we.getBooleanValidator=Q8;we.getComponentValidator=q8;const Kr=Fe,mt=gt;function Yr(t){return mt.Util._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||mt.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}function B8(t){return t>255?255:t<0?0:Math.round(t)}function V8(t){return t>1?1:t<1e-4?1e-4:t}function W8(){if(Kr.Konva.isUnminified)return function(t,e){return mt.Util._isNumber(t)||mt.Util.warn(Yr(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function b8(t){if(Kr.Konva.isUnminified)return function(e,n){let r=mt.Util._isNumber(e),s=mt.Util._isArray(e)&&e.length==t;return!r&&!s&&mt.Util.warn(Yr(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function j8(){if(Kr.Konva.isUnminified)return function(t,e){return mt.Util._isNumber(t)||t==="auto"||mt.Util.warn(Yr(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function K8(){if(Kr.Konva.isUnminified)return function(t,e){return mt.Util._isString(t)||mt.Util.warn(Yr(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function Y8(){if(Kr.Konva.isUnminified)return function(t,e){const n=mt.Util._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||mt.Util.warn(Yr(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function X8(){if(Kr.Konva.isUnminified)return function(t,e){return mt.Util._isFunction(t)||mt.Util.warn(Yr(t)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),t}}function $8(){if(Kr.Konva.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(mt.Util._isArray(t)?t.forEach(function(r){mt.Util._isNumber(r)||mt.Util.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):mt.Util.warn(Yr(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function Q8(){if(Kr.Konva.isUnminified)return function(t,e){return t===!0||t===!1||mt.Util.warn(Yr(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function q8(t){if(Kr.Konva.isUnminified)return function(e,n){return e==null||mt.Util.isObject(e)||mt.Util.warn(Yr(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const e=gt,n=we,r="get",s="set";t.Factory={addGetterSetter(l,a,c,d,g){t.Factory.addGetter(l,a,c),t.Factory.addSetter(l,a,d,g),t.Factory.addOverloadedGetterSetter(l,a)},addGetter(l,a,c){const d=r+e.Util._capitalize(a);l.prototype[d]=l.prototype[d]||function(){const g=this.attrs[a];return g===void 0?c:g}},addSetter(l,a,c,d){const g=s+e.Util._capitalize(a);l.prototype[g]||t.Factory.overWriteSetter(l,a,c,d)},overWriteSetter(l,a,c,d){const g=s+e.Util._capitalize(a);l.prototype[g]=function(y){return c&&y!==void 0&&y!==null&&(y=c.call(this,y,a)),this._setAttr(a,y),d&&d.call(this),this}},addComponentsGetterSetter(l,a,c,d,g){const y=c.length,w=e.Util._capitalize,x=r+w(a),_=s+w(a);l.prototype[x]=function(){const E={};for(let P=0;P{this._setAttr(a+w(k),void 0)}),this._fireChangeEvent(a,P,E),g&&g.call(this),this},t.Factory.addOverloadedGetterSetter(l,a)},addOverloadedGetterSetter(l,a){const c=e.Util._capitalize(a),d=s+c,g=r+c;l.prototype[a]=function(){return arguments.length?(this[d](arguments[0]),this):this[g]()}},addDeprecatedGetterSetter(l,a,c,d){e.Util.error("Adding deprecated "+a);const g=r+e.Util._capitalize(a),y=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";l.prototype[g]=function(){e.Util.error(y);const w=this.attrs[a];return w===void 0?c:w},t.Factory.addSetter(l,a,d,function(){e.Util.error(y)}),t.Factory.addOverloadedGetterSetter(l,a)},backCompat(l,a){e.Util.each(a,function(c,d){const g=l.prototype[d],y=r+e.Util._capitalize(c),w=s+e.Util._capitalize(c);function x(){g.apply(this,arguments),e.Util.error('"'+c+'" method is deprecated and will be removed soon. Use ""'+d+'" instead.')}l.prototype[c]=x,l.prototype[y]=x,l.prototype[w]=x})},afterSetFilter(){this._filterUpToDate=!1}}})(Le);Object.defineProperty(at,"__esModule",{value:!0});at.Node=void 0;const Go=ir,On=Cc,Xl=Le,ai=Fe,De=gt,_t=we,Nu="absoluteOpacity",hu="allEventListeners",zr="absoluteTransform",F2="absoluteScale",Qi="canvas",Z8="Change",J8="children",e9="konva",s0="listening",t9="mouseenter",n9="mouseleave",r9="pointerenter",i9="pointerleave",o9="touchenter",s9="touchleave",M2="set",L2="Shape",Ru=" ",z2="stage",ui="transform",l9="Stage",l0="visible",a9=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Ru);let u9=1;class ke{constructor(e){this._id=u9++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===ui||e===zr)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){let r=this._cache.get(e);return(r===void 0||(e===ui||e===zr)&&r.dirty===!0)&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const s=n.map(l=>l+"Change.konva").join(Ru);this.on(s,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(Qi)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===zr&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Qi)){const{scene:e,filter:n,hit:r,buffer:s}=this._cache.get(Qi);De.Util.releaseCanvas(e,n,r,s),this._cache.delete(Qi)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const n=e||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let s=Math.ceil(n.width||r.width),l=Math.ceil(n.height||r.height),a=n.pixelRatio,c=n.x===void 0?Math.floor(r.x):n.x,d=n.y===void 0?Math.floor(r.y):n.y,g=n.offset||0,y=n.drawBorder||!1,w=n.hitCanvasPixelRatio||1;if(!s||!l){De.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const x=Math.abs(Math.round(r.x)-c)>.5?1:0,_=Math.abs(Math.round(r.y)-d)>.5?1:0;s+=g*2+x,l+=g*2+_,c-=g,d-=g;const v=new Go.SceneCanvas({pixelRatio:a,width:s,height:l}),E=new Go.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),P=new Go.HitCanvas({pixelRatio:w,width:s,height:l}),k=v.getContext(),C=P.getContext(),p=new Go.SceneCanvas({width:v.width/v.pixelRatio+Math.abs(c),height:v.height/v.pixelRatio+Math.abs(d),pixelRatio:v.pixelRatio}),S=p.getContext();return P.isCache=!0,v.isCache=!0,this._cache.delete(Qi),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(v.getContext()._context.imageSmoothingEnabled=!1,E.getContext()._context.imageSmoothingEnabled=!1),k.save(),C.save(),S.save(),k.translate(-c,-d),C.translate(-c,-d),S.translate(-c,-d),p.x=c,p.y=d,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Nu),this._clearSelfAndDescendantCache(F2),this.drawScene(v,this,p),this.drawHit(P,this),this._isUnderCache=!1,k.restore(),C.restore(),y&&(k.save(),k.beginPath(),k.rect(0,0,s,l),k.closePath(),k.setAttr("strokeStyle","red"),k.setAttr("lineWidth",5),k.stroke(),k.restore()),this._cache.set(Qi,{scene:v,filter:E,hit:P,buffer:p,x:c,y:d}),this._requestDraw(),this}isCached(){return this._cache.has(Qi)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){const r=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];let s=1/0,l=1/0,a=-1/0,c=-1/0;const d=this.getAbsoluteTransform(n);return r.forEach(function(g){const y=d.point(g);s===void 0&&(s=a=y.x,l=c=y.y),s=Math.min(s,y.x),l=Math.min(l,y.y),a=Math.max(a,y.x),c=Math.max(c,y.y)}),{x:s,y:l,width:a-s,height:c-l}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),s=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/s,r.height/s),e.restore()}_drawCachedHitCanvas(e){const n=this._getCanvasCache(),r=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),n=this._getCanvasCache(),r=n.scene,s=n.filter,l=s.getContext(),a,c,d,g;if(e){if(!this._filterUpToDate){const y=r.pixelRatio;s.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(a=e.length,l.clear(),l.drawImage(r._canvas,0,0,r.getWidth()/y,r.getHeight()/y),c=l.getImageData(0,0,s.getWidth(),s.getHeight()),d=0;d{let n,r;if(!e)return this;for(n in e)n!==J8&&(r=M2+De.Util._capitalize(n),De.Util._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(s0,this._isListening)}_isListening(e){if(!this.listening())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isListening(e):!0}isVisible(){return this._getCache(l0,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);const r=this.getLayer();let s=!1;On.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(s=!0)});const l=!n&&!ai.Konva.hitOnDragEnabled&&(s||ai.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!l}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),n=this,r=0,s,l,a,c;function d(y){for(s=[],l=y.length,a=0;a0&&s[0].getDepth()<=e&&d(s)}const g=this.getStage();return n.nodeType!==l9&&g&&d(g.getChildren()),r}getDepth(){let e=0,n=this.parent;for(;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(ui),this._clearSelfAndDescendantCache(zr)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;const n=e.getPointerPosition();if(!n)return null;const r=this.getAbsoluteTransform().copy();return r.invert(),r.point(n)}getAbsolutePosition(e){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!e&&(e=!0);const s=this.getAbsoluteTransform(e).getMatrix(),l=new De.Transform,a=this.offset();return l.m=s.slice(),l.translate(a.x,a.y),l.getTranslation()}setAbsolutePosition(e){const{x:n,y:r,...s}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(ui);const l=this._getAbsoluteTransform().copy();return l.invert(),l.translate(e.x,e.y),e={x:this.attrs.x+l.getTranslation().x,y:this.attrs.y+l.getTranslation().y},this._setTransform(s),this.setPosition({x:e.x,y:e.y}),this._clearCache(ui),this._clearSelfAndDescendantCache(zr),this}_setTransform(e){let n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){const e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let n=e.x,r=e.y,s=this.x(),l=this.y();return n!==void 0&&(s+=n),r!==void 0&&(l+=r),this.setPosition({x:s,y:l}),this}_eachAncestorReverse(e,n){let r=[],s=this.getParent(),l,a;if(!(n&&n._id===this._id)){for(r.unshift(this);s&&(!n||s._id!==n._id);)r.unshift(s),s=s.parent;for(l=r.length,a=0;a0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return De.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return De.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&De.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)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Nu,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),n,r,s,l,a;const c={attrs:{},className:this.getClassName()};for(n in e)r=e[n],a=De.Util.isObject(r)&&!De.Util._isPlainObject(r)&&!De.Util._isArray(r),!a&&(s=typeof this[n]=="function"&&this[n],delete e[n],l=s?s.call(this):null,e[n]=r,l!==r&&(c.attrs[n]=r));return De.Util._prepareToStringify(c)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){const s=[];n&&this._isMatch(e)&&s.push(this);let l=this.parent;for(;l;){if(l===r)return s;l._isMatch(e)&&s.push(l),l=l.parent}return s}isAncestorOf(e){return!1}findAncestor(e,n,r){return this.findAncestors(e,n,r)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);let n=e.replace(/ /g,"").split(","),r=n.length,s,l;for(s=0;s{try{const s=e==null?void 0:e.callback;s&&delete e.callback,De.Util._urlToImage(this.toDataURL(e),function(l){n(l),s==null||s(l)})}catch(s){r(s)}})}toBlob(e){return new Promise((n,r)=>{try{const s=e==null?void 0:e.callback;s&&delete e.callback,this.toCanvas(e).toBlob(l=>{n(l),s==null||s(l)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(s){r(s)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():ai.Konva.dragDistance}_off(e,n,r){let s=this.eventListeners[e],l,a,c;for(l=0;l=0)||this.isDragging())return;let s=!1;On.DD._dragElements.forEach(l=>{this.isAncestorOf(l.node)&&(s=!0)}),s||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const n=On.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",s=n&&n.dragStatus==="ready";r?this.stopDrag():s&&On.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return De.Util.haveIntersection(r,this.getClientRect())}static create(e,n){return De.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){let r=ke.prototype.getClassName.call(e),s=e.children,l,a,c;n&&(e.attrs.container=n),ai.Konva[r]||(De.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const d=ai.Konva[r];if(l=new d(e.attrs),s)for(a=s.length,c=0;c0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let r=0;r0?n[0]:void 0}_generalFind(e,n){const r=[];return this._descendants(s=>{const l=s._isMatch(e);return l&&r.push(s),!!(l&&n)}),r}_descendants(e){let n=!1;const r=this.getChildren();for(const s of r){if(n=e(s),n)return!0;if(s.hasChildren()&&(n=s._descendants(e),n))return!0}return!1}toObject(){const e=tf.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){let n=e.getParent();for(;n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){const n=tf.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(e){const n=[];return this.find("Shape").forEach(r=>{r.isVisible()&&r.intersects(e)&&n.push(r)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(e,n,r){const s=this.getLayer(),l=e||s&&s.getCanvas(),a=l&&l.getContext(),c=this._getCanvasCache(),d=c&&c.scene,g=l&&l.isCache;if(!this.isVisible()&&!g)return this;if(d){a.save();const y=this.getAbsoluteTransform(n).getMatrix();a.transform(y[0],y[1],y[2],y[3],y[4],y[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",l,n,r);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;const r=this.getLayer(),s=e||r&&r.hitCanvas,l=s&&s.getContext(),a=this._getCanvasCache();if(a&&a.hit){l.save();const d=this.getAbsoluteTransform(n).getMatrix();l.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedHitCanvas(l),l.restore()}else this._drawChildren("drawHit",s,n);return this}_drawChildren(e,n,r,s){var l;const a=n&&n.getContext(),c=this.clipWidth(),d=this.clipHeight(),g=this.clipFunc(),y=typeof c=="number"&&typeof d=="number"||g,w=r===this;if(y){a.save();const _=this.getAbsoluteTransform(r);let v=_.getMatrix();a.transform(v[0],v[1],v[2],v[3],v[4],v[5]),a.beginPath();let E;if(g)E=g.call(this,a,this);else{const P=this.clipX(),k=this.clipY();a.rect(P||0,k||0,c,d)}a.clip.apply(a,E),v=_.copy().invert().getMatrix(),a.transform(v[0],v[1],v[2],v[3],v[4],v[5])}const x=!w&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";x&&(a.save(),a._applyGlobalCompositeOperation(this)),(l=this.children)===null||l===void 0||l.forEach(function(_){_[e](n,r,s)}),x&&a.restore(),y&&a.restore()}getClientRect(e={}){var n;const r=e.skipTransform,s=e.relativeTo;let l,a,c,d,g={x:1/0,y:1/0,width:0,height:0};const y=this;(n=this.children)===null||n===void 0||n.forEach(function(_){if(!_.visible())return;const v=_.getClientRect({relativeTo:y,skipShadow:e.skipShadow,skipStroke:e.skipStroke});v.width===0&&v.height===0||(l===void 0?(l=v.x,a=v.y,c=v.x+v.width,d=v.y+v.height):(l=Math.min(l,v.x),a=Math.min(a,v.y),c=Math.max(c,v.x+v.width),d=Math.max(d,v.y+v.height)))});const w=this.find("Shape");let x=!1;for(let _=0;_Ke.indexOf("pointer")>=0?"pointer":Ke.indexOf("touch")>=0?"touch":"mouse",me=Ke=>{const D=Y(Ke);if(D==="pointer")return s.Konva.pointerEventsEnabled&&$.pointer;if(D==="touch")return $.touch;if(D==="mouse")return $.mouse};function ze(Ke={}){return(Ke.clipFunc||Ke.clipWidth||Ke.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Ke}const Qe="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);";t.stages=[];class vt extends r.Container{constructor(D){super(ze(D)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),t.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",()=>{ze(this.attrs)}),this._checkVisibility()}_validateAdd(D){const Z=D.getType()==="Layer",ge=D.getType()==="FastLayer";Z||ge||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const D=this.visible()?"":"none";this.content.style.display=D}setContainer(D){if(typeof D===y){let Z;if(D.charAt(0)==="."){const ge=D.slice(1);D=document.getElementsByClassName(ge)[0]}else D.charAt(0)!=="#"?Z=D:Z=D.slice(1),D=document.getElementById(Z);if(!D)throw"Can not find container in document with id "+Z}return this._setAttr("container",D),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),D.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const D=this.children,Z=D.length;for(let ge=0;ge-1&&t.stages.splice(Z,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const D=this._pointerPositions[0]||this._changedPointerPositions[0];return D?{x:D.x,y:D.y}:(e.Util.warn(Qe),null)}_getPointerById(D){return this._pointerPositions.find(Z=>Z.id===D)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(D){D=D||{},D.x=D.x||0,D.y=D.y||0,D.width=D.width||this.width(),D.height=D.height||this.height();const Z=new l.SceneCanvas({width:D.width,height:D.height,pixelRatio:D.pixelRatio||1}),ge=Z.getContext()._context,Oe=this.children;return(D.x||D.y)&&ge.translate(-1*D.x,-1*D.y),Oe.forEach(function(Ee){if(!Ee.isVisible())return;const We=Ee._toKonvaCanvas(D);ge.drawImage(We._canvas,D.x,D.y,We.getWidth()/We.getPixelRatio(),We.getHeight()/We.getPixelRatio())}),Z}getIntersection(D){if(!D)return null;const Z=this.children,ge=Z.length,Oe=ge-1;for(let Ee=Oe;Ee>=0;Ee--){const We=Z[Ee].getIntersection(D);if(We)return We}return null}_resizeDOM(){const D=this.width(),Z=this.height();this.content&&(this.content.style.width=D+w,this.content.style.height=Z+w),this.bufferCanvas.setSize(D,Z),this.bufferHitCanvas.setSize(D,Z),this.children.forEach(ge=>{ge.setSize({width:D,height:Z}),ge.draw()})}add(D,...Z){if(arguments.length>1){for(let Oe=0;OeU&&e.Util.warn("The stage has "+ge+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),D.setSize({width:this.width(),height:this.height()}),D.draw(),s.Konva.isBrowser&&this.content.appendChild(D.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(D){return d.hasPointerCapture(D,this)}setPointerCapture(D){d.setPointerCapture(D,this)}releaseCapture(D){d.releaseCapture(D,this)}getLayers(){return this.children}_bindContentEvents(){s.Konva.isBrowser&&Q.forEach(([D,Z])=>{this.content.addEventListener(D,ge=>{this[Z](ge)},{passive:!1})})}_pointerenter(D){this.setPointersPositions(D);const Z=me(D.type);Z&&this._fire(Z.pointerenter,{evt:D,target:this,currentTarget:this})}_pointerover(D){this.setPointersPositions(D);const Z=me(D.type);Z&&this._fire(Z.pointerover,{evt:D,target:this,currentTarget:this})}_getTargetShape(D){let Z=this[D+"targetShape"];return Z&&!Z.getStage()&&(Z=null),Z}_pointerleave(D){const Z=me(D.type),ge=Y(D.type);if(!Z)return;this.setPointersPositions(D);const Oe=this._getTargetShape(ge),Ee=!(s.Konva.isDragging()||s.Konva.isTransforming())||s.Konva.hitOnDragEnabled;Oe&&Ee?(Oe._fireAndBubble(Z.pointerout,{evt:D}),Oe._fireAndBubble(Z.pointerleave,{evt:D}),this._fire(Z.pointerleave,{evt:D,target:this,currentTarget:this}),this[ge+"targetShape"]=null):Ee&&(this._fire(Z.pointerleave,{evt:D,target:this,currentTarget:this}),this._fire(Z.pointerout,{evt:D,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(D){const Z=me(D.type),ge=Y(D.type);if(!Z)return;this.setPointersPositions(D);let Oe=!1;this._changedPointerPositions.forEach(Ee=>{const We=this.getIntersection(Ee);if(a.DD.justDragged=!1,s.Konva["_"+ge+"ListenClick"]=!0,!We||!We.isListening()){this[ge+"ClickStartShape"]=void 0;return}s.Konva.capturePointerEventsEnabled&&We.setPointerCapture(Ee.id),this[ge+"ClickStartShape"]=We,We._fireAndBubble(Z.pointerdown,{evt:D,pointerId:Ee.id}),Oe=!0;const Xe=D.type.indexOf("touch")>=0;We.preventDefault()&&D.cancelable&&Xe&&D.preventDefault()}),Oe||this._fire(Z.pointerdown,{evt:D,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(D){const Z=me(D.type),ge=Y(D.type);if(!Z||(s.Konva.isDragging()&&a.DD.node.preventDefault()&&D.cancelable&&D.preventDefault(),this.setPointersPositions(D),!(!(s.Konva.isDragging()||s.Konva.isTransforming())||s.Konva.hitOnDragEnabled)))return;const Ee={};let We=!1;const Xe=this._getTargetShape(ge);this._changedPointerPositions.forEach(en=>{const ne=d.getCapturedShape(en.id)||this.getIntersection(en),oe=en.id,le={evt:D,pointerId:oe},ve=Xe!==ne;if(ve&&Xe&&(Xe._fireAndBubble(Z.pointerout,{...le},ne),Xe._fireAndBubble(Z.pointerleave,{...le},ne)),ne){if(Ee[ne._id])return;Ee[ne._id]=!0}ne&&ne.isListening()?(We=!0,ve&&(ne._fireAndBubble(Z.pointerover,{...le},Xe),ne._fireAndBubble(Z.pointerenter,{...le},Xe),this[ge+"targetShape"]=ne),ne._fireAndBubble(Z.pointermove,{...le})):Xe&&(this._fire(Z.pointerover,{evt:D,target:this,currentTarget:this,pointerId:oe}),this[ge+"targetShape"]=null)}),We||this._fire(Z.pointermove,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(D){const Z=me(D.type),ge=Y(D.type);if(!Z)return;this.setPointersPositions(D);const Oe=this[ge+"ClickStartShape"],Ee=this[ge+"ClickEndShape"],We={};let Xe=!1;this._changedPointerPositions.forEach(en=>{const ne=d.getCapturedShape(en.id)||this.getIntersection(en);if(ne){if(ne.releaseCapture(en.id),We[ne._id])return;We[ne._id]=!0}const oe=en.id,le={evt:D,pointerId:oe};let ve=!1;s.Konva["_"+ge+"InDblClickWindow"]?(ve=!0,clearTimeout(this[ge+"DblTimeout"])):a.DD.justDragged||(s.Konva["_"+ge+"InDblClickWindow"]=!0,clearTimeout(this[ge+"DblTimeout"])),this[ge+"DblTimeout"]=setTimeout(function(){s.Konva["_"+ge+"InDblClickWindow"]=!1},s.Konva.dblClickWindow),ne&&ne.isListening()?(Xe=!0,this[ge+"ClickEndShape"]=ne,ne._fireAndBubble(Z.pointerup,{...le}),s.Konva["_"+ge+"ListenClick"]&&Oe&&Oe===ne&&(ne._fireAndBubble(Z.pointerclick,{...le}),ve&&Ee&&Ee===ne&&ne._fireAndBubble(Z.pointerdblclick,{...le}))):(this[ge+"ClickEndShape"]=null,s.Konva["_"+ge+"ListenClick"]&&this._fire(Z.pointerclick,{evt:D,target:this,currentTarget:this,pointerId:oe}),ve&&this._fire(Z.pointerdblclick,{evt:D,target:this,currentTarget:this,pointerId:oe}))}),Xe||this._fire(Z.pointerup,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s.Konva["_"+ge+"ListenClick"]=!1,D.cancelable&&ge!=="touch"&&ge!=="pointer"&&D.preventDefault()}_contextmenu(D){this.setPointersPositions(D);const Z=this.getIntersection(this.getPointerPosition());Z&&Z.isListening()?Z._fireAndBubble(b,{evt:D}):this._fire(b,{evt:D,target:this,currentTarget:this})}_wheel(D){this.setPointersPositions(D);const Z=this.getIntersection(this.getPointerPosition());Z&&Z.isListening()?Z._fireAndBubble(Ce,{evt:D}):this._fire(Ce,{evt:D,target:this,currentTarget:this})}_pointercancel(D){this.setPointersPositions(D);const Z=d.getCapturedShape(D.pointerId)||this.getIntersection(this.getPointerPosition());Z&&Z._fireAndBubble(R,d.createEvent(D)),d.releaseCapture(D.pointerId)}_lostpointercapture(D){d.releaseCapture(D.pointerId)}setPointersPositions(D){const Z=this._getContentPosition();let ge=null,Oe=null;D=D||window.event,D.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(D.touches,Ee=>{this._pointerPositions.push({id:Ee.identifier,x:(Ee.clientX-Z.left)/Z.scaleX,y:(Ee.clientY-Z.top)/Z.scaleY})}),Array.prototype.forEach.call(D.changedTouches||D.touches,Ee=>{this._changedPointerPositions.push({id:Ee.identifier,x:(Ee.clientX-Z.left)/Z.scaleX,y:(Ee.clientY-Z.top)/Z.scaleY})})):(ge=(D.clientX-Z.left)/Z.scaleX,Oe=(D.clientY-Z.top)/Z.scaleY,this.pointerPos={x:ge,y:Oe},this._pointerPositions=[{x:ge,y:Oe,id:e.Util._getFirstPointerId(D)}],this._changedPointerPositions=[{x:ge,y:Oe,id:e.Util._getFirstPointerId(D)}])}_setPointerPosition(D){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(D)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const D=this.content.getBoundingClientRect();return{top:D.top,left:D.left,scaleX:D.width/this.content.clientWidth||1,scaleY:D.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new l.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new l.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!s.Konva.isBrowser)return;const D=this.container();if(!D)throw"Stage has no container. A container is required.";D.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),D.appendChild(this.content),this._resizeDOM()}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(D){D.batchDraw()}),this}}t.Stage=vt,vt.prototype.nodeType=g,(0,c._registerNode)(vt),n.Factory.addGetterSetter(vt,"container"),s.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{t.stages.forEach(Ke=>{Ke.batchDraw()})})})(z5);var $l={},Ft={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const e=Fe,n=gt,r=Le,s=at,l=we,a=Fe,c=Fi,d="hasShadow",g="shadowRGBA",y="patternImage",w="linearGradient",x="radialGradient";let _;function v(){return _||(_=n.Util.createCanvasElement().getContext("2d"),_)}t.shapes={};function E(z){const M=this.attrs.fillRule;M?z.fill(M):z.fill()}function P(z){z.stroke()}function k(z){const M=this.attrs.fillRule;M?z.fill(M):z.fill()}function C(z){z.stroke()}function p(){this._clearCache(d)}function S(){this._clearCache(g)}function R(){this._clearCache(y)}function F(){this._clearCache(w)}function L(){this._clearCache(x)}class N extends s.Node{constructor(M){super(M);let H;for(;H=n.Util.getRandomColor(),!(H&&!(H in t.shapes)););this.colorKey=H,t.shapes[H]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(d,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(y,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const H=v().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(H&&H.setTransform){const b=new n.Transform;b.translate(this.fillPatternX(),this.fillPatternY()),b.rotate(e.Konva.getAngle(this.fillPatternRotation())),b.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),b.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const q=b.getMatrix(),ie=typeof DOMMatrix>"u"?{a:q[0],b:q[1],c:q[2],d:q[3],e:q[4],f:q[5]}:new DOMMatrix(q);H.setTransform(ie)}return H}}_getLinearGradient(){return this._getCache(w,this.__getLinearGradient)}__getLinearGradient(){const M=this.fillLinearGradientColorStops();if(M){const H=v(),b=this.fillLinearGradientStartPoint(),q=this.fillLinearGradientEndPoint(),ie=H.createLinearGradient(b.x,b.y,q.x,q.y);for(let ee=0;eethis.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 M=this.hitStrokeWidth();return M==="auto"?this.hasStroke():this.strokeEnabled()&&!!M}intersects(M){const H=this.getStage();if(!H)return!1;const b=H.bufferHitCanvas;return b.getContext().clear(),this.drawHit(b,void 0,!0),b.context.getImageData(Math.round(M.x),Math.round(M.y),1,1).data[3]>0}destroy(){return s.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(M){var H;if(!((H=this.attrs.perfectDrawEnabled)!==null&&H!==void 0?H:!0))return!1;const q=M||this.hasFill(),ie=this.hasStroke(),ee=this.getAbsoluteOpacity()!==1;if(q&&ie&&ee)return!0;const pe=this.hasShadow(),Ce=this.shadowForStrokeEnabled();return!!(q&&ie&&pe&&Ce)}setStrokeHitEnabled(M){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),M?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const M=this.size();return{x:this._centroid?-M.width/2:0,y:this._centroid?-M.height/2:0,width:M.width,height:M.height}}getClientRect(M={}){let H=!1,b=this.getParent();for(;b;){if(b.isCached()){H=!0;break}b=b.getParent()}const q=M.skipTransform,ie=M.relativeTo||H&&this.getStage()||void 0,ee=this.getSelfRect(),Ce=!M.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,U=ee.width+Ce,Q=ee.height+Ce,$=!M.skipShadow&&this.hasShadow(),Y=$?this.shadowOffsetX():0,me=$?this.shadowOffsetY():0,ze=U+Math.abs(Y),Qe=Q+Math.abs(me),vt=$&&this.shadowBlur()||0,Ke=ze+vt*2,D=Qe+vt*2,Z={width:Ke,height:D,x:-(Ce/2+vt)+Math.min(Y,0)+ee.x,y:-(Ce/2+vt)+Math.min(me,0)+ee.y};return q?Z:this._transformedRect(Z,ie)}drawScene(M,H,b){const q=this.getLayer(),ie=M||q.getCanvas(),ee=ie.getContext(),pe=this._getCanvasCache(),Ce=this.getSceneFunc(),U=this.hasShadow();let Q;const $=H===this;if(!this.isVisible()&&!$)return this;if(pe){ee.save();const Y=this.getAbsoluteTransform(H).getMatrix();return ee.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),this._drawCachedSceneCanvas(ee),ee.restore(),this}if(!Ce)return this;if(ee.save(),this._useBufferCanvas()){Q=this.getStage();const Y=b||Q.bufferCanvas,me=Y.getContext();me.clear(),me.save(),me._applyLineJoin(this);const ze=this.getAbsoluteTransform(H).getMatrix();me.transform(ze[0],ze[1],ze[2],ze[3],ze[4],ze[5]),Ce.call(this,me,this),me.restore();const Qe=Y.pixelRatio;U&&ee._applyShadow(this),ee._applyOpacity(this),ee._applyGlobalCompositeOperation(this),ee.drawImage(Y._canvas,Y.x||0,Y.y||0,Y.width/Qe,Y.height/Qe)}else{if(ee._applyLineJoin(this),!$){const Y=this.getAbsoluteTransform(H).getMatrix();ee.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),ee._applyOpacity(this),ee._applyGlobalCompositeOperation(this)}U&&ee._applyShadow(this),Ce.call(this,ee,this)}return ee.restore(),this}drawHit(M,H,b=!1){if(!this.shouldDrawHit(H,b))return this;const q=this.getLayer(),ie=M||q.hitCanvas,ee=ie&&ie.getContext(),pe=this.hitFunc()||this.sceneFunc(),Ce=this._getCanvasCache(),U=Ce&&Ce.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),U){ee.save();const $=this.getAbsoluteTransform(H).getMatrix();return ee.transform($[0],$[1],$[2],$[3],$[4],$[5]),this._drawCachedHitCanvas(ee),ee.restore(),this}if(!pe)return this;if(ee.save(),ee._applyLineJoin(this),!(this===H)){const $=this.getAbsoluteTransform(H).getMatrix();ee.transform($[0],$[1],$[2],$[3],$[4],$[5])}return pe.call(this,ee,this),ee.restore(),this}drawHitFromCache(M=0){const H=this._getCanvasCache(),b=this._getCachedSceneCanvas(),q=H.hit,ie=q.getContext(),ee=q.getWidth(),pe=q.getHeight();ie.clear(),ie.drawImage(b._canvas,0,0,ee,pe);try{const Ce=ie.getImageData(0,0,ee,pe),U=Ce.data,Q=U.length,$=n.Util._hexToRgb(this.colorKey);for(let Y=0;YM?(U[Y]=$.r,U[Y+1]=$.g,U[Y+2]=$.b,U[Y+3]=255):U[Y+3]=0;ie.putImageData(Ce,0,0)}catch(Ce){n.Util.error("Unable to draw hit graph from cached scene canvas. "+Ce.message)}return this}hasPointerCapture(M){return c.hasPointerCapture(M,this)}setPointerCapture(M){c.setPointerCapture(M,this)}releaseCapture(M){c.releaseCapture(M,this)}}t.Shape=N,N.prototype._fillFunc=E,N.prototype._strokeFunc=P,N.prototype._fillFuncHit=k,N.prototype._strokeFuncHit=C,N.prototype._centroid=!1,N.prototype.nodeType="Shape",(0,a._registerNode)(N),N.prototype.eventListeners={},N.prototype.on.call(N.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",p),N.prototype.on.call(N.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",S),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",R),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",F),N.prototype.on.call(N.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",L),r.Factory.addGetterSetter(N,"stroke",void 0,(0,l.getStringOrGradientValidator)()),r.Factory.addGetterSetter(N,"strokeWidth",2,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(N,"hitStrokeWidth","auto",(0,l.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(N,"strokeHitEnabled",!0,(0,l.getBooleanValidator)()),r.Factory.addGetterSetter(N,"perfectDrawEnabled",!0,(0,l.getBooleanValidator)()),r.Factory.addGetterSetter(N,"shadowForStrokeEnabled",!0,(0,l.getBooleanValidator)()),r.Factory.addGetterSetter(N,"lineJoin"),r.Factory.addGetterSetter(N,"lineCap"),r.Factory.addGetterSetter(N,"sceneFunc"),r.Factory.addGetterSetter(N,"hitFunc"),r.Factory.addGetterSetter(N,"dash"),r.Factory.addGetterSetter(N,"dashOffset",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"shadowColor",void 0,(0,l.getStringValidator)()),r.Factory.addGetterSetter(N,"shadowBlur",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"shadowOpacity",1,(0,l.getNumberValidator)()),r.Factory.addComponentsGetterSetter(N,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(N,"shadowOffsetX",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"shadowOffsetY",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillPatternImage"),r.Factory.addGetterSetter(N,"fill",void 0,(0,l.getStringOrGradientValidator)()),r.Factory.addGetterSetter(N,"fillPatternX",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillPatternY",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(N,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(N,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(N,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(N,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(N,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(N,"fillEnabled",!0),r.Factory.addGetterSetter(N,"strokeEnabled",!0),r.Factory.addGetterSetter(N,"shadowEnabled",!0),r.Factory.addGetterSetter(N,"dashEnabled",!0),r.Factory.addGetterSetter(N,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(N,"fillPriority","color"),r.Factory.addComponentsGetterSetter(N,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(N,"fillPatternOffsetX",0,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillPatternOffsetY",0,(0,l.getNumberValidator)()),r.Factory.addComponentsGetterSetter(N,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(N,"fillPatternScaleX",1,(0,l.getNumberValidator)()),r.Factory.addGetterSetter(N,"fillPatternScaleY",1,(0,l.getNumberValidator)()),r.Factory.addComponentsGetterSetter(N,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(N,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(N,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(N,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(N,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(N,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(N,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(N,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(N,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(N,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(N,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(N,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(N,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(N,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(N,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(N,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(N,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(N,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(N,"fillPatternRotation",0),r.Factory.addGetterSetter(N,"fillRule",void 0,(0,l.getStringValidator)()),r.Factory.backCompat(N,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Ft);Object.defineProperty($l,"__esModule",{value:!0});$l.Layer=void 0;const Lr=gt,nf=mo,Bo=at,mg=Le,I2=ir,g9=we,p9=Ft,m9=Fe,y9="#",v9="beforeDraw",x9="draw",A5=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],S9=A5.length;let ws=class extends nf.Container{constructor(e){super(e),this.canvas=new I2.SceneCanvas,this.hitCanvas=new I2.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(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let n=1,r=!1;for(;;){for(let s=0;s0)return{antialiased:!0};return{}}drawScene(e,n,r){const s=this.getLayer(),l=e||s&&s.getCanvas();return this._fire(v9,{node:this}),this.clearBeforeDraw()&&l.getContext().clear(),nf.Container.prototype.drawScene.call(this,l,n,r),this._fire(x9,{node:this}),this}drawHit(e,n){const r=this.getLayer(),s=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),nf.Container.prototype.drawHit.call(this,s,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Lr.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Lr.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return Lr.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};$l.Layer=ws;ws.prototype.nodeType="Layer";(0,m9._registerNode)(ws);mg.Factory.addGetterSetter(ws,"imageSmoothingEnabled",!0);mg.Factory.addGetterSetter(ws,"clearBeforeDraw",!0);mg.Factory.addGetterSetter(ws,"hitGraphEnabled",!0,(0,g9.getBooleanValidator)());var Ec={};Object.defineProperty(Ec,"__esModule",{value:!0});Ec.FastLayer=void 0;const _9=gt,w9=$l,C9=Fe;class yg extends w9.Layer{constructor(e){super(e),this.listening(!1),_9.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Ec.FastLayer=yg;yg.prototype.nodeType="FastLayer";(0,C9._registerNode)(yg);var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});Cs.Group=void 0;const k9=gt,E9=mo,P9=Fe;class vg extends E9.Container{_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&k9.Util.throw("You may only add groups and shapes to groups.")}}Cs.Group=vg;vg.prototype.nodeType="Group";(0,P9._registerNode)(vg);var ks={};Object.defineProperty(ks,"__esModule",{value:!0});ks.Animation=void 0;const rf=Fe,D2=gt,of=function(){return rf.glob.performance&&rf.glob.performance.now?function(){return rf.glob.performance.now()}:function(){return new Date().getTime()}}();class xr{constructor(e,n){this.id=xr.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:of(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];return e&&(n=Array.isArray(e)?e:[e]),this.layers=n,this}getLayers(){return this.layers}addLayer(e){const n=this.layers,r=n.length;for(let s=0;sthis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():v<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=v,this.update())}getTime(){return this._time}setPosition(v){this.prevPos=this._pos,this.propFunc(v),this._pos=v}getPosition(v){return v===void 0&&(v=this._time),this.func(v,this.begin,this._change,this.duration)}play(){this.state=c,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=d,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(v){this.pause(),this._time=v,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const v=this.getTimer()-this._startTime;this.state===c?this.setTime(v):this.state===d&&this.setTime(this.duration-v)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class x{constructor(v){const E=this,P=v.node,k=P._id,C=v.easing||t.Easings.Linear,p=!!v.yoyo;let S,R;typeof v.duration>"u"?S=.3:v.duration===0?S=.001:S=v.duration,this.node=P,this._id=y++;const F=P.getLayer()||(P instanceof s.Konva.Stage?P.getLayers():null);F||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){E.tween.onEnterFrame()},F),this.tween=new w(R,function(L){E._tweenFunc(L)},C,0,1,S*1e3,p),this._addListeners(),x.attrs[k]||(x.attrs[k]={}),x.attrs[k][this._id]||(x.attrs[k][this._id]={}),x.tweens[k]||(x.tweens[k]={});for(R in v)l[R]===void 0&&this._addAttr(R,v[R]);this.reset(),this.onFinish=v.onFinish,this.onReset=v.onReset,this.onUpdate=v.onUpdate}_addAttr(v,E){const P=this.node,k=P._id;let C,p,S,R,F;const L=x.tweens[k][v];L&&delete x.attrs[k][L][v];let N=P.getAttr(v);if(e.Util._isArray(E))if(C=[],p=Math.max(E.length,N.length),v==="points"&&E.length!==N.length&&(E.length>N.length?(R=N,N=e.Util._prepareArrayForTween(N,E,P.closed())):(S=E,E=e.Util._prepareArrayForTween(E,N,P.closed()))),v.indexOf("fill")===0)for(let z=0;z{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const v=this.node,E=x.attrs[v._id][this._id];E.points&&E.points.trueEnd&&v.setAttr("points",E.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const v=this.node,E=x.attrs[v._id][this._id];E.points&&E.points.trueStart&&v.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(v){return this.tween.seek(v*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const v=this.node._id,E=this._id,P=x.tweens[v];this.pause(),this.anim&&this.anim.stop();for(const k in P)delete x.tweens[v][k];delete x.attrs[v][E],x.tweens[v]&&(Object.keys(x.tweens[v]).length===0&&delete x.tweens[v],Object.keys(x.attrs[v]).length===0&&delete x.attrs[v])}}t.Tween=x,x.attrs={},x.tweens={},r.Node.prototype.to=function(_){const v=_.onFinish;_.node=this,_.onFinish=function(){this.destroy(),v&&v()},new x(_).play()},t.Easings={BackEaseIn(_,v,E,P){return E*(_/=P)*_*((1.70158+1)*_-1.70158)+v},BackEaseOut(_,v,E,P){return E*((_=_/P-1)*_*((1.70158+1)*_+1.70158)+1)+v},BackEaseInOut(_,v,E,P){let k=1.70158;return(_/=P/2)<1?E/2*(_*_*(((k*=1.525)+1)*_-k))+v:E/2*((_-=2)*_*(((k*=1.525)+1)*_+k)+2)+v},ElasticEaseIn(_,v,E,P,k,C){let p=0;return _===0?v:(_/=P)===1?v+E:(C||(C=P*.3),!k||k0?e:n),y=a*n,w=c*(c>0?e:n),x=d*(d>0?n:e);return{x:g,y:r?-1*x:w,width:y-g,height:x-w}}}Pc.Arc=Xr;Xr.prototype._centroid=!0;Xr.prototype.className="Arc";Xr.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];(0,N9._registerNode)(Xr);Tc.Factory.addGetterSetter(Xr,"innerRadius",0,(0,Nc.getNumberValidator)());Tc.Factory.addGetterSetter(Xr,"outerRadius",0,(0,Nc.getNumberValidator)());Tc.Factory.addGetterSetter(Xr,"angle",0,(0,Nc.getNumberValidator)());Tc.Factory.addGetterSetter(Xr,"clockwise",!1,(0,Nc.getBooleanValidator)());var Rc={},Ql={};Object.defineProperty(Ql,"__esModule",{value:!0});Ql.Line=void 0;const Fc=Le,R9=Fe,F9=Ft,H5=we;function a0(t,e,n,r,s,l,a){const c=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),d=Math.sqrt(Math.pow(s-n,2)+Math.pow(l-r,2)),g=a*c/(c+d),y=a*d/(c+d),w=n-g*(s-t),x=r-g*(l-e),_=n+y*(s-t),v=r+y*(l-e);return[w,x,_,v]}function O2(t,e){const n=t.length,r=[];for(let s=2;s4){const d=this.getTensionPoints(),g=d.length;for(c=l?0:4,l||e.quadraticCurveTo(d[0],d[1],d[2],d[3]);c{let g,y;const x=d/2;g=0;for(let _=0;_<20;_++)y=x*t.tValues[20][_]+x,g+=t.cValues[20][_]*r(a,c,y);return x*g};t.getCubicArcLength=e;const n=(a,c,d)=>{d===void 0&&(d=1);const g=a[0]-2*a[1]+a[2],y=c[0]-2*c[1]+c[2],w=2*a[1]-2*a[0],x=2*c[1]-2*c[0],_=4*(g*g+y*y),v=4*(g*w+y*x),E=w*w+x*x;if(_===0)return d*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(c[2]-c[0],2));const P=v/(2*_),k=E/_,C=d+P,p=k-P*P,S=C*C+p>0?Math.sqrt(C*C+p):0,R=P*P+p>0?Math.sqrt(P*P+p):0,F=P+Math.sqrt(P*P+p)!==0?p*Math.log(Math.abs((C+S)/(P+R))):0;return Math.sqrt(_)/2*(C*S-P*R+F)};t.getQuadraticArcLength=n;function r(a,c,d){const g=s(1,d,a),y=s(1,d,c),w=g*g+y*y;return Math.sqrt(w)}const s=(a,c,d)=>{const g=d.length-1;let y,w;if(g===0)return 0;if(a===0){w=0;for(let x=0;x<=g;x++)w+=t.binomialCoefficients[g][x]*Math.pow(1-c,g-x)*Math.pow(c,x)*d[x];return w}else{y=new Array(g);for(let x=0;x{let g=1,y=a/c,w=(a-d(y))/c,x=0;for(;g>.001;){const _=d(y+w),v=Math.abs(a-_)/c;if(v500)break}return y};t.t2length=l})(U5);Object.defineProperty(Es,"__esModule",{value:!0});Es.Path=void 0;const M9=Le,L9=Fe,z9=Ft,Vo=U5;class Tt extends z9.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Tt.parsePathData(this.data()),this.pathLength=Tt.getPathLength(this.dataArray)}_sceneFunc(e){const n=this.dataArray;e.beginPath();let r=!1;for(let s=0;sy?g:y,P=g>y?1:g/y,k=g>y?y/g:1;e.translate(c,d),e.rotate(_),e.scale(P,k),e.arc(0,0,E,w,w+x,1-v),e.scale(1/P,1/k),e.rotate(-_),e.translate(-c,-d);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(d){if(d.command==="A"){const g=d.points[4],y=d.points[5],w=d.points[4]+y;let x=Math.PI/180;if(Math.abs(g-w)w;_-=x){const v=Tt.getPointOnEllipticalArc(d.points[0],d.points[1],d.points[2],d.points[3],_,0);e.push(v.x,v.y)}else for(let _=g+x;_n[s].pathLength;)e-=n[s].pathLength,++s;if(s===l)return r=n[s-1].points.slice(-2),{x:r[0],y:r[1]};if(e<.01)return n[s].command==="M"?(r=n[s].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[s].start.x,y:n[s].start.y};const a=n[s],c=a.points;switch(a.command){case"L":return Tt.getPointOnLine(e,a.start.x,a.start.y,c[0],c[1]);case"C":return Tt.getPointOnCubicBezier((0,Vo.t2length)(e,Tt.getPathLength(n),E=>(0,Vo.getCubicArcLength)([a.start.x,c[0],c[2],c[4]],[a.start.y,c[1],c[3],c[5]],E)),a.start.x,a.start.y,c[0],c[1],c[2],c[3],c[4],c[5]);case"Q":return Tt.getPointOnQuadraticBezier((0,Vo.t2length)(e,Tt.getPathLength(n),E=>(0,Vo.getQuadraticArcLength)([a.start.x,c[0],c[2]],[a.start.y,c[1],c[3]],E)),a.start.x,a.start.y,c[0],c[1],c[2],c[3]);case"A":const d=c[0],g=c[1],y=c[2],w=c[3],x=c[5],_=c[6];let v=c[4];return v+=x*e/a.pathLength,Tt.getPointOnEllipticalArc(d,g,y,w,v,_)}return null}static getPointOnLine(e,n,r,s,l,a,c){a=a??n,c=c??r;const d=this.getLineLength(n,r,s,l);if(d<1e-10)return{x:n,y:r};if(s===n)return{x:a,y:c+(l>r?e:-e)};const g=(l-r)/(s-n),y=Math.sqrt(e*e/(1+g*g))*(s0&&!isNaN(v[0]);){let E="",P=[];const k=c,C=d;let p,S,R,F,L,N,z,M,H,b;switch(_){case"l":c+=v.shift(),d+=v.shift(),E="L",P.push(c,d);break;case"L":c=v.shift(),d=v.shift(),P.push(c,d);break;case"m":const q=v.shift(),ie=v.shift();if(c+=q,d+=ie,E="M",l.length>2&&l[l.length-1].command==="z"){for(let ee=l.length-2;ee>=0;ee--)if(l[ee].command==="M"){c=l[ee].points[0]+q,d=l[ee].points[1]+ie;break}}P.push(c,d),_="l";break;case"M":c=v.shift(),d=v.shift(),E="M",P.push(c,d),_="L";break;case"h":c+=v.shift(),E="L",P.push(c,d);break;case"H":c=v.shift(),E="L",P.push(c,d);break;case"v":d+=v.shift(),E="L",P.push(c,d);break;case"V":d=v.shift(),E="L",P.push(c,d);break;case"C":P.push(v.shift(),v.shift(),v.shift(),v.shift()),c=v.shift(),d=v.shift(),P.push(c,d);break;case"c":P.push(c+v.shift(),d+v.shift(),c+v.shift(),d+v.shift()),c+=v.shift(),d+=v.shift(),E="C",P.push(c,d);break;case"S":S=c,R=d,p=l[l.length-1],p.command==="C"&&(S=c+(c-p.points[2]),R=d+(d-p.points[3])),P.push(S,R,v.shift(),v.shift()),c=v.shift(),d=v.shift(),E="C",P.push(c,d);break;case"s":S=c,R=d,p=l[l.length-1],p.command==="C"&&(S=c+(c-p.points[2]),R=d+(d-p.points[3])),P.push(S,R,c+v.shift(),d+v.shift()),c+=v.shift(),d+=v.shift(),E="C",P.push(c,d);break;case"Q":P.push(v.shift(),v.shift()),c=v.shift(),d=v.shift(),P.push(c,d);break;case"q":P.push(c+v.shift(),d+v.shift()),c+=v.shift(),d+=v.shift(),E="Q",P.push(c,d);break;case"T":S=c,R=d,p=l[l.length-1],p.command==="Q"&&(S=c+(c-p.points[0]),R=d+(d-p.points[1])),c=v.shift(),d=v.shift(),E="Q",P.push(S,R,c,d);break;case"t":S=c,R=d,p=l[l.length-1],p.command==="Q"&&(S=c+(c-p.points[0]),R=d+(d-p.points[1])),c+=v.shift(),d+=v.shift(),E="Q",P.push(S,R,c,d);break;case"A":F=v.shift(),L=v.shift(),N=v.shift(),z=v.shift(),M=v.shift(),H=c,b=d,c=v.shift(),d=v.shift(),E="A",P=this.convertEndpointToCenterParameterization(H,b,c,d,z,M,F,L,N);break;case"a":F=v.shift(),L=v.shift(),N=v.shift(),z=v.shift(),M=v.shift(),H=c,b=d,c+=v.shift(),d+=v.shift(),E="A",P=this.convertEndpointToCenterParameterization(H,b,c,d,z,M,F,L,N);break}l.push({command:E||_,points:P,start:{x:k,y:C},pathLength:this.calcLength(k,C,E||_,P)})}(_==="z"||_==="Z")&&l.push({command:"z",points:[],start:void 0,pathLength:0})}return l}static calcLength(e,n,r,s){let l,a,c,d;const g=Tt;switch(r){case"L":return g.getLineLength(e,n,s[0],s[1]);case"C":return(0,Vo.getCubicArcLength)([e,s[0],s[2],s[4]],[n,s[1],s[3],s[5]],1);case"Q":return(0,Vo.getQuadraticArcLength)([e,s[0],s[2]],[n,s[1],s[3]],1);case"A":l=0;const y=s[4],w=s[5],x=s[4]+w;let _=Math.PI/180;if(Math.abs(y-x)<_&&(_=Math.abs(y-x)),a=g.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],y,0),w<0)for(d=y-_;d>x;d-=_)c=g.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],d,0),l+=g.getLineLength(a.x,a.y,c.x,c.y),a=c;else for(d=y+_;d1&&(c*=Math.sqrt(_),d*=Math.sqrt(_));let v=Math.sqrt((c*c*(d*d)-c*c*(x*x)-d*d*(w*w))/(c*c*(x*x)+d*d*(w*w)));l===a&&(v*=-1),isNaN(v)&&(v=0);const E=v*c*x/d,P=v*-d*w/c,k=(e+r)/2+Math.cos(y)*E-Math.sin(y)*P,C=(n+s)/2+Math.sin(y)*E+Math.cos(y)*P,p=function(M){return Math.sqrt(M[0]*M[0]+M[1]*M[1])},S=function(M,H){return(M[0]*H[0]+M[1]*H[1])/(p(M)*p(H))},R=function(M,H){return(M[0]*H[1]=1&&(z=0),a===0&&z>0&&(z=z-2*Math.PI),a===1&&z<0&&(z=z+2*Math.PI),[k,C,c,d,F,z,y,a]}}Es.Path=Tt;Tt.prototype.className="Path";Tt.prototype._attrsAffectingSize=["data"];(0,L9._registerNode)(Tt);M9.Factory.addGetterSetter(Tt,"data");Object.defineProperty(Rc,"__esModule",{value:!0});Rc.Arrow=void 0;const Mc=Le,I9=Ql,G5=we,D9=Fe,H2=Es;class vo extends I9.Line{_sceneFunc(e){super._sceneFunc(e);const n=Math.PI*2,r=this.points();let s=r;const l=this.tension()!==0&&r.length>4;l&&(s=this.getTensionPoints());const a=this.pointerLength(),c=r.length;let d,g;if(l){const x=[s[s.length-4],s[s.length-3],s[s.length-2],s[s.length-1],r[c-2],r[c-1]],_=H2.Path.calcLength(s[s.length-4],s[s.length-3],"C",x),v=H2.Path.getPointOnQuadraticBezier(Math.min(1,1-a/_),x[0],x[1],x[2],x[3],x[4],x[5]);d=r[c-2]-v.x,g=r[c-1]-v.y}else d=r[c-2]-r[c-4],g=r[c-1]-r[c-3];const y=(Math.atan2(g,d)+n)%n,w=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[c-2],r[c-1]),e.rotate(y),e.moveTo(0,0),e.lineTo(-a,w/2),e.lineTo(-a,-w/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),l?(d=(s[0]+s[2])/2-r[0],g=(s[1]+s[3])/2-r[1]):(d=r[2]-r[0],g=r[3]-r[1]),e.rotate((Math.atan2(-g,-d)+n)%n),e.moveTo(0,0),e.lineTo(-a,w/2),e.lineTo(-a,-w/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x,y:e.y-n,width:e.width,height:e.height+n*2}}}Rc.Arrow=vo;vo.prototype.className="Arrow";(0,D9._registerNode)(vo);Mc.Factory.addGetterSetter(vo,"pointerLength",10,(0,G5.getNumberValidator)());Mc.Factory.addGetterSetter(vo,"pointerWidth",10,(0,G5.getNumberValidator)());Mc.Factory.addGetterSetter(vo,"pointerAtBeginning",!1);Mc.Factory.addGetterSetter(vo,"pointerAtEnding",!0);var Lc={};Object.defineProperty(Lc,"__esModule",{value:!0});Lc.Circle=void 0;const A9=Le,O9=Ft,H9=we,U9=Fe;class Ps extends O9.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Lc.Circle=Ps;Ps.prototype._centroid=!0;Ps.prototype.className="Circle";Ps.prototype._attrsAffectingSize=["radius"];(0,U9._registerNode)(Ps);A9.Factory.addGetterSetter(Ps,"radius",0,(0,H9.getNumberValidator)());var zc={};Object.defineProperty(zc,"__esModule",{value:!0});zc.Ellipse=void 0;const xg=Le,G9=Ft,B5=we,B9=Fe;class Li extends G9.Shape{_sceneFunc(e){const n=this.radiusX(),r=this.radiusY();e.beginPath(),e.save(),n!==r&&e.scale(1,r/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}zc.Ellipse=Li;Li.prototype.className="Ellipse";Li.prototype._centroid=!0;Li.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,B9._registerNode)(Li);xg.Factory.addComponentsGetterSetter(Li,"radius",["x","y"]);xg.Factory.addGetterSetter(Li,"radiusX",0,(0,B5.getNumberValidator)());xg.Factory.addGetterSetter(Li,"radiusY",0,(0,B5.getNumberValidator)());var Ic={};Object.defineProperty(Ic,"__esModule",{value:!0});Ic.Image=void 0;const sf=gt,xo=Le,V9=Ft,W9=Fe,ql=we;let wr=class V5 extends V9.Shape{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",n=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",this._loadListener)}_removeImageLoad(e){e&&e.removeEventListener&&e.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const e=!!this.cornerRadius(),n=this.hasShadow();return e&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),r=this.getHeight(),s=this.cornerRadius(),l=this.attrs.image;let a;if(l){const c=this.attrs.cropWidth,d=this.attrs.cropHeight;c&&d?a=[l,this.cropX(),this.cropY(),c,d,0,0,n,r]:a=[l,0,0,n,r]}(this.hasFill()||this.hasStroke()||s)&&(e.beginPath(),s?sf.Util.drawRoundedRectPath(e,n,r,s):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),l&&(s&&e.clip(),e.drawImage.apply(e,a))}_hitFunc(e){const n=this.width(),r=this.height(),s=this.cornerRadius();e.beginPath(),s?sf.Util.drawRoundedRectPath(e,n,r,s):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,r=null){const s=sf.Util.createImageElement();s.onload=function(){const l=new V5({image:s});n(l)},s.onerror=r,s.crossOrigin="Anonymous",s.src=e}};Ic.Image=wr;wr.prototype.className="Image";(0,W9._registerNode)(wr);xo.Factory.addGetterSetter(wr,"cornerRadius",0,(0,ql.getNumberOrArrayOfNumbersValidator)(4));xo.Factory.addGetterSetter(wr,"image");xo.Factory.addComponentsGetterSetter(wr,"crop",["x","y","width","height"]);xo.Factory.addGetterSetter(wr,"cropX",0,(0,ql.getNumberValidator)());xo.Factory.addGetterSetter(wr,"cropY",0,(0,ql.getNumberValidator)());xo.Factory.addGetterSetter(wr,"cropWidth",0,(0,ql.getNumberValidator)());xo.Factory.addGetterSetter(wr,"cropHeight",0,(0,ql.getNumberValidator)());var ps={};Object.defineProperty(ps,"__esModule",{value:!0});ps.Tag=ps.Label=void 0;const Dc=Le,b9=Ft,j9=Cs,Sg=we,W5=Fe,b5=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],K9="Change.konva",Y9="none",u0="up",c0="right",d0="down",h0="left",X9=b5.length;class _g extends j9.Group{constructor(e){super(e),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let n=this,r;const s=function(){n._sync()};for(r=0;r{n=Math.min(n,a.x),r=Math.max(r,a.x),s=Math.min(s,a.y),l=Math.max(l,a.y)}),{x:n,y:s,width:r-n,height:l-s}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Oc.RegularPolygon=_o;_o.prototype.className="RegularPolygon";_o.prototype._centroid=!0;_o.prototype._attrsAffectingSize=["radius"];(0,t7._registerNode)(_o);j5.Factory.addGetterSetter(_o,"radius",0,(0,K5.getNumberValidator)());j5.Factory.addGetterSetter(_o,"sides",0,(0,K5.getNumberValidator)());var Hc={};Object.defineProperty(Hc,"__esModule",{value:!0});Hc.Ring=void 0;const Y5=Le,n7=Ft,X5=we,r7=Fe,U2=Math.PI*2;class wo extends n7.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,U2,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),U2,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Hc.Ring=wo;wo.prototype.className="Ring";wo.prototype._centroid=!0;wo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,r7._registerNode)(wo);Y5.Factory.addGetterSetter(wo,"innerRadius",0,(0,X5.getNumberValidator)());Y5.Factory.addGetterSetter(wo,"outerRadius",0,(0,X5.getNumberValidator)());var Uc={};Object.defineProperty(Uc,"__esModule",{value:!0});Uc.Sprite=void 0;const Co=Le,i7=Ft,o7=ks,$5=we,s7=Fe;class Cr extends i7.Shape{constructor(e){super(e),this._updated=!0,this.anim=new o7.Animation(()=>{const n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const n=this.animation(),r=this.frameIndex(),s=r*4,l=this.animations()[n],a=this.frameOffsets(),c=l[s+0],d=l[s+1],g=l[s+2],y=l[s+3],w=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,g,y),e.closePath(),e.fillStrokeShape(this)),w)if(a){const x=a[n],_=r*2;e.drawImage(w,c,d,g,y,x[_+0],x[_+1],g,y)}else e.drawImage(w,c,d,g,y,0,0,g,y)}_hitFunc(e){const n=this.animation(),r=this.frameIndex(),s=r*4,l=this.animations()[n],a=this.frameOffsets(),c=l[s+2],d=l[s+3];if(e.beginPath(),a){const g=a[n],y=r*2;e.rect(g[y+0],g[y+1],c,d)}else e.rect(0,0,c,d);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),n=this.animation(),r=this.animations(),s=r[n],l=s.length/4;e{if(new RegExp("\\p{Emoji}","u").test(n)){const l=s[r+1];l&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(l)?(e.push(n+l),s[r+1]=""):e.push(n)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(n+(s[r+1]||""))?e.push(n+s[r+1]):r>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(n)?e[e.length-1]+=n:n&&e.push(n);return e},[])}const Wo="auto",d7="center",Q5="inherit",rl="justify",h7="Change.konva",f7="2d",G2="-",q5="left",g7="text",p7="Text",m7="top",y7="bottom",B2="middle",Z5="normal",v7="px ",fu=" ",x7="right",V2="rtl",S7="word",_7="char",W2="none",af="…",J5=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],w7=J5.length;function C7(t){return t.split(",").map(e=>{e=e.trim();const n=e.indexOf(" ")>=0,r=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!r&&(e=`"${e}"`),e}).join(", ")}let gu;function uf(){return gu||(gu=f0.Util.createCanvasElement().getContext(f7),gu)}function k7(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function E7(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function P7(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let yt=class extends u7.Shape{constructor(e){super(P7(e)),this._partialTextX=0,this._partialTextY=0;for(let n=0;n1&&(C+=a)}}_hitFunc(e){const n=this.getWidth(),r=this.getHeight();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}setText(e){const n=f0.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(g7,n),this}getWidth(){return this.attrs.width===Wo||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Wo||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return f0.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n,r,s,l,a,c,d,g,y,w,x;let _=uf(),v=this.fontSize(),E;_.save(),_.font=this._getContextFont(),E=_.measureText(e),_.restore();const P=v/100;return{actualBoundingBoxAscent:(n=E.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*P,actualBoundingBoxDescent:(r=E.actualBoundingBoxDescent)!==null&&r!==void 0?r:0,actualBoundingBoxLeft:(s=E.actualBoundingBoxLeft)!==null&&s!==void 0?s:-7.421875*P,actualBoundingBoxRight:(l=E.actualBoundingBoxRight)!==null&&l!==void 0?l:75.732421875*P,alphabeticBaseline:(a=E.alphabeticBaseline)!==null&&a!==void 0?a:0,emHeightAscent:(c=E.emHeightAscent)!==null&&c!==void 0?c:100*P,emHeightDescent:(d=E.emHeightDescent)!==null&&d!==void 0?d:-20*P,fontBoundingBoxAscent:(g=E.fontBoundingBoxAscent)!==null&&g!==void 0?g:91*P,fontBoundingBoxDescent:(y=E.fontBoundingBoxDescent)!==null&&y!==void 0?y:21*P,hangingBaseline:(w=E.hangingBaseline)!==null&&w!==void 0?w:72.80000305175781*P,ideographicBaseline:(x=E.ideographicBaseline)!==null&&x!==void 0?x:-21*P,width:E.width,height:v}}_getContextFont(){return this.fontStyle()+fu+this.fontVariant()+fu+(this.fontSize()+v7)+C7(this.fontFamily())}_addTextLine(e){this.align()===rl&&(e=e.trim());const r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){const n=this.letterSpacing(),r=e.length;return uf().measureText(e).width+n*r}_setTextData(){let e=this.text().split(` +`),n=+this.fontSize(),r=0,s=this.lineHeight()*n,l=this.attrs.width,a=this.attrs.height,c=l!==Wo&&l!==void 0,d=a!==Wo&&a!==void 0,g=this.padding(),y=l-g*2,w=a-g*2,x=0,_=this.wrap(),v=_!==W2,E=_!==_7&&v,P=this.ellipsis();this.textArr=[],uf().font=this._getContextFont();const k=P?this._getTextWidth(af):0;for(let C=0,p=e.length;Cy)for(;S.length>0;){let F=0,L=eo(S).length,N="",z=0;for(;F>>1,H=eo(S),b=H.slice(0,M+1).join(""),q=this._getTextWidth(b);(P&&d&&x+s>w?q+k:q)<=y?(F=M+1,N=b,z=q):L=M}if(N){if(E){const b=eo(S),q=eo(N),ie=b[q.length],ee=ie===fu||ie===G2;let pe;if(ee&&z<=y)pe=q.length;else{const Ce=q.lastIndexOf(fu),U=q.lastIndexOf(G2);pe=Math.max(Ce,U)+1}pe>0&&(F=pe,N=b.slice(0,F).join(""),z=this._getTextWidth(N))}if(N=N.trimRight(),this._addTextLine(N),r=Math.max(r,z),x+=s,this._shouldHandleEllipsis(x)){this._tryToAddEllipsisToLastLine();break}if(S=eo(S).slice(F).join("").trimLeft(),S.length>0&&(R=this._getTextWidth(S),R<=y)){this._addTextLine(S),x+=s,r=Math.max(r,R);break}}else break}else this._addTextLine(S),x+=s,r=Math.max(r,R),this._shouldHandleEllipsis(x)&&Cw)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){const n=+this.fontSize(),r=this.lineHeight()*n,s=this.attrs.height,l=s!==Wo&&s!==void 0,a=this.padding(),c=s-a*2;return!(this.wrap()!==W2)||l&&e+r>c}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,n=e!==Wo&&e!==void 0,r=this.padding(),s=e-r*2,l=this.ellipsis(),a=this.textArr[this.textArr.length-1];!a||!l||(n&&(this._getTextWidth(a.text+af)n?null:il.Path.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=il.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const n=this.textDecoration(),r=this.fill(),s=this.fontSize(),l=this.glyphInfo;n==="underline"&&e.beginPath();for(let a=0;a=1){const r=n[0].p0;e.moveTo(r.x,r.y)}for(let r=0;rt+`.${i4}`).join(" "),K2="nodesRect",I7=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],D7={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},A7="ontouchstart"in Zn.Konva._global;function O7(t,e,n){if(t==="rotater")return n;e+=$e.Util.degToRad(D7[t]||0);const r=($e.Util.radToDeg(e)%360+360)%360;return $e.Util._inRange(r,315+22.5,360)||$e.Util._inRange(r,0,22.5)?"ns-resize":$e.Util._inRange(r,45-22.5,45+22.5)?"nesw-resize":$e.Util._inRange(r,90-22.5,90+22.5)?"ew-resize":$e.Util._inRange(r,135-22.5,135+22.5)?"nwse-resize":$e.Util._inRange(r,180-22.5,180+22.5)?"ns-resize":$e.Util._inRange(r,225-22.5,225+22.5)?"nesw-resize":$e.Util._inRange(r,270-22.5,270+22.5)?"ew-resize":$e.Util._inRange(r,315-22.5,315+22.5)?"nwse-resize":($e.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}const nc=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function H7(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 o4(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),s=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:r,y:s}}function U7(t,e){const n=H7(t);return o4(t,e,n)}function G7(t,e,n){let r=e;for(let s=0;ss.isAncestorOf(this)?($e.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=n,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(s=>{const l=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(s._attrsAffectingSize.length){const a=s._attrsAffectingSize.map(c=>c+"Change."+this._getEventNamespace()).join(" ");s.on(a,l)}s.on(I7.map(a=>a+`.${this._getEventNamespace()}`).join(" "),l),s.on(`absoluteTransformChange.${this._getEventNamespace()}`,l),this._proxyDrag(s)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const s=e.getAbsolutePosition(),l=s.x-n.x,a=s.y-n.y;this.nodes().forEach(c=>{if(c===e||c.isDragging())return;const d=c.getAbsolutePosition();c.setAbsolutePosition({x:d.x+l,y:d.y+a}),c.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(K2),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(K2,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){const s=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),l=e.getAbsoluteScale(r),a=e.getAbsolutePosition(r),c=s.x*l.x-e.offsetX()*l.x,d=s.y*l.y-e.offsetY()*l.y,g=(Zn.Konva.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),y={x:a.x+c*Math.cos(g)+d*Math.sin(-g),y:a.y+d*Math.cos(g)+c*Math.sin(g),width:s.width*l.x,height:s.height*l.y,rotation:g};return o4(y,-Zn.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const n=[];this.nodes().map(g=>{const y=g.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),w=[{x:y.x,y:y.y},{x:y.x+y.width,y:y.y},{x:y.x+y.width,y:y.y+y.height},{x:y.x,y:y.y+y.height}],x=g.getAbsoluteTransform();w.forEach(function(_){const v=x.point(_);n.push(v)})});const r=new $e.Transform;r.rotate(-Zn.Konva.getAngle(this.rotation()));let s=1/0,l=1/0,a=-1/0,c=-1/0;n.forEach(function(g){const y=r.point(g);s===void 0&&(s=a=y.x,l=c=y.y),s=Math.min(s,y.x),l=Math.min(l,y.y),a=Math.max(a,y.x),c=Math.max(c,y.y)}),r.invert();const d=r.point({x:s,y:l});return{x:d.x,y:d.y,width:a-s,height:c-l,rotation:Zn.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(),nc.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const n=new M7.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:A7?10:"auto"}),r=this;n.on("mousedown touchstart",function(s){r._handleMouseDown(s)}),n.on("dragstart",s=>{n.stopDrag(),s.cancelBubble=!0}),n.on("dragend",s=>{s.cancelBubble=!0}),n.on("mouseenter",()=>{const s=Zn.Konva.getAngle(this.rotation()),l=this.rotateAnchorCursor(),a=O7(e,s,l);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){const e=new F7.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n,r){const s=r.getParent(),l=s.padding();n.beginPath(),n.rect(-l,-l,r.width()+l*2,r.height()+l*2),n.moveTo(r.width()/2,-l),s.rotateEnabled()&&s.rotateLineVisible()&&n.lineTo(r.width()/2,-s.rotateAnchorOffset()*$e.Util._sign(r.height())-l),n.fillStrokeShape(r)},hitFunc:(n,r)=>{if(!this.shouldOverdrawWholeArea())return;const s=this.padding();n.beginPath(),n.rect(-s,-s,r.width()+s*2,r.height()+s*2),n.fillStrokeShape(r)}});this.add(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const n=this._getNodeRect(),r=n.width,s=n.height,l=Math.sqrt(Math.pow(r,2)+Math.pow(s,2));this.sin=Math.abs(s/l),this.cos=Math.abs(r/l),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const a=e.target.getAbsolutePosition(),c=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:c.x-a.x,y:c.y-a.y},g0++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(d=>{d._fire("transformstart",{evt:e.evt,target:d})})}_handleMouseMove(e){let n,r,s;const l=this.findOne("."+this._movingAnchorName),a=l.getStage();a.setPointersPositions(e);const c=a.getPointerPosition();let d={x:c.x-this._anchorDragOffset.x,y:c.y-this._anchorDragOffset.y};const g=l.getAbsolutePosition();this.anchorDragBoundFunc()&&(d=this.anchorDragBoundFunc()(g,d,e)),l.setAbsolutePosition(d);const y=l.getAbsolutePosition();if(g.x===y.x&&g.y===y.y)return;if(this._movingAnchorName==="rotater"){const C=this._getNodeRect();n=l.x()-C.width/2,r=-l.y()+C.height/2;let p=Math.atan2(-r,n)+Math.PI/2;C.height<0&&(p-=Math.PI);const R=Zn.Konva.getAngle(this.rotation())+p,F=Zn.Konva.getAngle(this.rotationSnapTolerance()),N=G7(this.rotationSnaps(),R,F)-C.rotation,z=U7(C,N);this._fitNodesInto(z,e);return}const w=this.shiftBehavior();let x;w==="inverted"?x=this.keepRatio()&&!e.shiftKey:w==="none"?x=this.keepRatio():x=this.keepRatio()||e.shiftKey;let _=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(x){const C=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};s=Math.sqrt(Math.pow(C.x-l.x(),2)+Math.pow(C.y-l.y(),2));const p=this.findOne(".top-left").x()>C.x?-1:1,S=this.findOne(".top-left").y()>C.y?-1:1;n=s*this.cos*p,r=s*this.sin*S,this.findOne(".top-left").x(C.x-n),this.findOne(".top-left").y(C.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(l.y());else if(this._movingAnchorName==="top-right"){if(x){const C=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};s=Math.sqrt(Math.pow(l.x()-C.x,2)+Math.pow(C.y-l.y(),2));const p=this.findOne(".top-right").x()C.y?-1:1;n=s*this.cos*p,r=s*this.sin*S,this.findOne(".top-right").x(C.x+n),this.findOne(".top-right").y(C.y-r)}var v=l.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(l.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(l.x());else if(this._movingAnchorName==="bottom-left"){if(x){const C=_?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};s=Math.sqrt(Math.pow(C.x-l.x(),2)+Math.pow(l.y()-C.y,2));const p=C.x{var l;s._fire("transformend",{evt:e,target:s}),(l=s.getLayer())===null||l===void 0||l.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,n){const r=this._getNodeRect(),s=1;if($e.Util._inRange(e.width,-this.padding()*2-s,s)){this.update();return}if($e.Util._inRange(e.height,-this.padding()*2-s,s)){this.update();return}const l=new $e.Transform;if(l.rotate(Zn.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const x=l.point({x:-this.padding()*2,y:0});e.x+=x.x,e.y+=x.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const x=l.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const x=l.point({x:0,y:-this.padding()*2});e.x+=x.x,e.y+=x.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const x=l.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const x=this.boundBoxFunc()(r,e);x?e=x:$e.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,c=new $e.Transform;c.translate(r.x,r.y),c.rotate(r.rotation),c.scale(r.width/a,r.height/a);const d=new $e.Transform,g=e.width/a,y=e.height/a;this.flipEnabled()===!1?(d.translate(e.x,e.y),d.rotate(e.rotation),d.translate(e.width<0?e.width:0,e.height<0?e.height:0),d.scale(Math.abs(g),Math.abs(y))):(d.translate(e.x,e.y),d.rotate(e.rotation),d.scale(g,y));const w=d.multiply(c.invert());this._nodes.forEach(x=>{var _;const v=x.getParent().getAbsoluteTransform(),E=x.getTransform().copy();E.translate(x.offsetX(),x.offsetY());const P=new $e.Transform;P.multiply(v.copy().invert()).multiply(w).multiply(v).multiply(E);const k=P.decompose();x.setAttrs(k),(_=x.getLayer())===null||_===void 0||_.batchDraw()}),this.rotation($e.Util._getRotation(e.rotation)),this._nodes.forEach(x=>{this._fire("transform",{evt:n,target:x}),x._fire("transform",{evt:n,target:x})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e;const n=this._getNodeRect();this.rotation($e.Util._getRotation(n.rotation));const r=n.width,s=n.height,l=this.enabledAnchors(),a=this.resizeEnabled(),c=this.padding(),d=this.anchorSize(),g=this.find("._anchor");g.forEach(w=>{w.setAttrs({width:d,height:d,offsetX:d/2,offsetY:d/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:d/2+c,offsetY:d/2+c,visible:a&&l.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:d/2+c,visible:a&&l.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:d/2-c,offsetY:d/2+c,visible:a&&l.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:s/2,offsetX:d/2+c,visible:a&&l.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:s/2,offsetX:d/2-c,visible:a&&l.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:s,offsetX:d/2+c,offsetY:d/2-c,visible:a&&l.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:s,offsetY:d/2-c,visible:a&&l.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:s,offsetX:d/2-c,offsetY:d/2-c,visible:a&&l.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*$e.Util._sign(s)-c,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:s,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const y=this.anchorStyleFunc();y&&g.forEach(w=>{y(w)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),j2.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return b2.Node.prototype.toObject.call(this)}clone(e){return b2.Node.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Vc.Transformer=Ae;Ae.isTransforming=()=>g0>0;function B7(t){return t instanceof Array||$e.Util.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){nc.indexOf(e)===-1&&$e.Util.warn("Unknown anchor name: "+e+". Available names are: "+nc.join(", "))}),t||[]}Ae.prototype.className="Transformer";(0,L7._registerNode)(Ae);je.Factory.addGetterSetter(Ae,"enabledAnchors",nc,B7);je.Factory.addGetterSetter(Ae,"flipEnabled",!0,(0,Di.getBooleanValidator)());je.Factory.addGetterSetter(Ae,"resizeEnabled",!0);je.Factory.addGetterSetter(Ae,"anchorSize",10,(0,Di.getNumberValidator)());je.Factory.addGetterSetter(Ae,"rotateEnabled",!0);je.Factory.addGetterSetter(Ae,"rotateLineVisible",!0);je.Factory.addGetterSetter(Ae,"rotationSnaps",[]);je.Factory.addGetterSetter(Ae,"rotateAnchorOffset",50,(0,Di.getNumberValidator)());je.Factory.addGetterSetter(Ae,"rotateAnchorCursor","crosshair");je.Factory.addGetterSetter(Ae,"rotationSnapTolerance",5,(0,Di.getNumberValidator)());je.Factory.addGetterSetter(Ae,"borderEnabled",!0);je.Factory.addGetterSetter(Ae,"anchorStroke","rgb(0, 161, 255)");je.Factory.addGetterSetter(Ae,"anchorStrokeWidth",1,(0,Di.getNumberValidator)());je.Factory.addGetterSetter(Ae,"anchorFill","white");je.Factory.addGetterSetter(Ae,"anchorCornerRadius",0,(0,Di.getNumberValidator)());je.Factory.addGetterSetter(Ae,"borderStroke","rgb(0, 161, 255)");je.Factory.addGetterSetter(Ae,"borderStrokeWidth",1,(0,Di.getNumberValidator)());je.Factory.addGetterSetter(Ae,"borderDash");je.Factory.addGetterSetter(Ae,"keepRatio",!0);je.Factory.addGetterSetter(Ae,"shiftBehavior","default");je.Factory.addGetterSetter(Ae,"centeredScaling",!1);je.Factory.addGetterSetter(Ae,"ignoreStroke",!1);je.Factory.addGetterSetter(Ae,"padding",0,(0,Di.getNumberValidator)());je.Factory.addGetterSetter(Ae,"nodes");je.Factory.addGetterSetter(Ae,"node");je.Factory.addGetterSetter(Ae,"boundBoxFunc");je.Factory.addGetterSetter(Ae,"anchorDragBoundFunc");je.Factory.addGetterSetter(Ae,"anchorStyleFunc");je.Factory.addGetterSetter(Ae,"shouldOverdrawWholeArea",!1);je.Factory.addGetterSetter(Ae,"useSingleNodeRotation",!0);je.Factory.backCompat(Ae,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Wc={};Object.defineProperty(Wc,"__esModule",{value:!0});Wc.Wedge=void 0;const bc=Le,V7=Ft,W7=Fe,s4=we,b7=Fe;class $r extends V7.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,W7.Konva.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Wc.Wedge=$r;$r.prototype.className="Wedge";$r.prototype._centroid=!0;$r.prototype._attrsAffectingSize=["radius"];(0,b7._registerNode)($r);bc.Factory.addGetterSetter($r,"radius",0,(0,s4.getNumberValidator)());bc.Factory.addGetterSetter($r,"angle",0,(0,s4.getNumberValidator)());bc.Factory.addGetterSetter($r,"clockwise",!1);bc.Factory.backCompat($r,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var jc={};Object.defineProperty(jc,"__esModule",{value:!0});jc.Blur=void 0;const Y2=Le,j7=at,K7=we;function X2(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const Y7=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],X7=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function $7(t,e){const n=t.data,r=t.width,s=t.height;let l,a,c,d,g,y,w,x,_,v,E,P,k,C,p,S,R,F,L,N;const z=e+e+1,M=r-1,H=s-1,b=e+1,q=b*(b+1)/2,ie=new X2,ee=Y7[e],pe=X7[e];let Ce=null,U=ie,Q=null,$=null;for(let Y=1;Y>pe,L!==0?(L=255/L,n[a]=(d*ee>>pe)*L,n[a+1]=(g*ee>>pe)*L,n[a+2]=(y*ee>>pe)*L):n[a]=n[a+1]=n[a+2]=0,d-=x,g-=_,y-=v,w-=E,x-=Q.r,_-=Q.g,v-=Q.b,E-=Q.a,l=c+((l=me+e+1)>pe,L>0?(L=255/L,n[l]=(d*ee>>pe)*L,n[l+1]=(g*ee>>pe)*L,n[l+2]=(y*ee>>pe)*L):n[l]=n[l+1]=n[l+2]=0,d-=x,g-=_,y-=v,w-=E,x-=Q.r,_-=Q.g,v-=Q.b,E-=Q.a,l=Y+((l=ze+b)0&&$7(e,n)};jc.Blur=Q7;Y2.Factory.addGetterSetter(j7.Node,"blurRadius",0,(0,K7.getNumberValidator)(),Y2.Factory.afterSetFilter);var Kc={};Object.defineProperty(Kc,"__esModule",{value:!0});Kc.Brighten=void 0;const $2=Le,q7=at,Z7=we,J7=function(t){const e=this.brightness()*255,n=t.data,r=n.length;for(let s=0;s255?255:s,l=l<0?0:l>255?255:l,a=a<0?0:a>255?255:a,n[c]=s,n[c+1]=l,n[c+2]=a};Yc.Contrast=nx;Q2.Factory.addGetterSetter(ex.Node,"contrast",0,(0,tx.getNumberValidator)(),Q2.Factory.afterSetFilter);var Xc={};Object.defineProperty(Xc,"__esModule",{value:!0});Xc.Emboss=void 0;const Pi=Le,$c=at,rx=gt,l4=we,ix=function(t){const e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),s=this.embossBlend(),l=t.data,a=t.width,c=t.height,d=a*4;let g=0,y=0,w=c;switch(r){case"top-left":g=-1,y=-1;break;case"top":g=-1,y=0;break;case"top-right":g=-1,y=1;break;case"right":g=0,y=1;break;case"bottom-right":g=1,y=1;break;case"bottom":g=1,y=0;break;case"bottom-left":g=1,y=-1;break;case"left":g=0,y=-1;break;default:rx.Util.error("Unknown emboss direction: "+r)}do{const x=(w-1)*d;let _=g;w+_<1&&(_=0),w+_>c&&(_=0);const v=(w-1+_)*a*4;let E=a;do{const P=x+(E-1)*4;let k=y;E+k<1&&(k=0),E+k>a&&(k=0);const C=v+(E-1+k)*4,p=l[P]-l[C],S=l[P+1]-l[C+1],R=l[P+2]-l[C+2];let F=p;const L=F>0?F:-F,N=S>0?S:-S,z=R>0?R:-R;if(N>L&&(F=S),z>L&&(F=R),F*=e,s){const M=l[P]+F,H=l[P+1]+F,b=l[P+2]+F;l[P]=M>255?255:M<0?0:M,l[P+1]=H>255?255:H<0?0:H,l[P+2]=b>255?255:b<0?0:b}else{let M=n-F;M<0?M=0:M>255&&(M=255),l[P]=l[P+1]=l[P+2]=M}}while(--E)}while(--w)};Xc.Emboss=ix;Pi.Factory.addGetterSetter($c.Node,"embossStrength",.5,(0,l4.getNumberValidator)(),Pi.Factory.afterSetFilter);Pi.Factory.addGetterSetter($c.Node,"embossWhiteLevel",.5,(0,l4.getNumberValidator)(),Pi.Factory.afterSetFilter);Pi.Factory.addGetterSetter($c.Node,"embossDirection","top-left",void 0,Pi.Factory.afterSetFilter);Pi.Factory.addGetterSetter($c.Node,"embossBlend",!1,void 0,Pi.Factory.afterSetFilter);var Qc={};Object.defineProperty(Qc,"__esModule",{value:!0});Qc.Enhance=void 0;const q2=Le,ox=at,sx=we;function hf(t,e,n,r,s){const l=n-e,a=s-r;if(l===0)return r+a/2;if(a===0)return r;let c=(t-e)/l;return c=a*c+r,c}const lx=function(t){const e=t.data,n=e.length;let r=e[0],s=r,l,a=e[1],c=a,d,g=e[2],y=g,w;const x=this.enhance();if(x===0)return;for(let p=0;ps&&(s=l),d=e[p+1],dc&&(c=d),w=e[p+2],wy&&(y=w);s===r&&(s=255,r=0),c===a&&(c=255,a=0),y===g&&(y=255,g=0);let _,v,E,P,k,C;if(x>0)_=s+x*(255-s),v=r-x*(r-0),E=c+x*(255-c),P=a-x*(a-0),k=y+x*(255-y),C=g-x*(g-0);else{const p=(s+r)*.5;_=s+x*(s-p),v=r+x*(r-p);const S=(c+a)*.5;E=c+x*(c-S),P=a+x*(a-S);const R=(y+g)*.5;k=y+x*(y-R),C=g+x*(g-R)}for(let p=0;pg?x:g;const _=a,v=l,E=360/v*Math.PI/180;for(let P=0;Pg?x:g;const _=a,v=l,E=0;let P,k;for(y=0;ye&&(S=p,R=0,F=-1),s=0;s=0&&_=0&&v=0&&_=0&&v=255*4?255:0}return a}function wx(t,e,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],s=Math.round(Math.sqrt(r.length)),l=Math.floor(s/2),a=[];for(let c=0;c=0&&_=0&&v=n))for(let p=E;p=r)continue;const S=(n*p+C)*4;g+=a[S+0],y+=a[S+1],w+=a[S+2],x+=a[S+3],k+=1}g=g/k,y=y/k,w=w/k,x=x/k;for(let C=_;C=n))for(let p=E;p=r)continue;const S=(n*p+C)*4;a[S+0]=g,a[S+1]=y,a[S+2]=w,a[S+3]=x}}};id.Pixelate=Fx;tm.Factory.addGetterSetter(Nx.Node,"pixelSize",8,(0,Rx.getNumberValidator)(),tm.Factory.afterSetFilter);var od={};Object.defineProperty(od,"__esModule",{value:!0});od.Posterize=void 0;const nm=Le,Mx=at,Lx=we,zx=function(t){const e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,s=255/e;for(let l=0;l255?255:t<0?0:Math.round(t)});ic.Factory.addGetterSetter(Ng.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});ic.Factory.addGetterSetter(Ng.Node,"blue",0,Ix.RGBComponent,ic.Factory.afterSetFilter);var ld={};Object.defineProperty(ld,"__esModule",{value:!0});ld.RGBA=void 0;const Gl=Le,ad=at,Ax=we,Ox=function(t){const e=t.data,n=e.length,r=this.red(),s=this.green(),l=this.blue(),a=this.alpha();for(let c=0;c255?255:t<0?0:Math.round(t)});Gl.Factory.addGetterSetter(ad.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});Gl.Factory.addGetterSetter(ad.Node,"blue",0,Ax.RGBComponent,Gl.Factory.afterSetFilter);Gl.Factory.addGetterSetter(ad.Node,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});var ud={};Object.defineProperty(ud,"__esModule",{value:!0});ud.Sepia=void 0;const Hx=function(t){const e=t.data,n=e.length;for(let r=0;r127&&(g=255-g),y>127&&(y=255-y),w>127&&(w=255-w),e[d]=g,e[d+1]=y,e[d+2]=w}while(--c)}while(--l)};cd.Solarize=Ux;var dd={};Object.defineProperty(dd,"__esModule",{value:!0});dd.Threshold=void 0;const rm=Le,Gx=at,Bx=we,Vx=function(t){const e=this.threshold()*255,n=t.data,r=n.length;for(let s=0;sA||f[T]!==m[A]){var B=` +`+f[T].replace(" at new "," at ");return i.displayName&&B.includes("")&&(B=B.replace("",i.displayName)),B}while(1<=T&&0<=A);break}}}finally{vd=!1,Error.prepareStackTrace=u}return(i=i?i.displayName||i.name:"")?Fs(i):""}var G4=Object.prototype.hasOwnProperty,Sd=[],Eo=-1;function qr(i){return{current:i}}function tt(i){0>Eo||(i.current=Sd[Eo],Sd[Eo]=null,Eo--)}function Je(i,o){Eo++,Sd[Eo]=i.current,i.current=o}var Zr={},bt=qr(Zr),an=qr(!1),Gi=Zr;function Po(i,o){var u=i.type.contextTypes;if(!u)return Zr;var h=i.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===o)return h.__reactInternalMemoizedMaskedChildContext;var f={},m;for(m in u)f[m]=o[m];return h&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=o,i.__reactInternalMemoizedMaskedChildContext=f),f}function un(i){return i=i.childContextTypes,i!=null}function ra(){tt(an),tt(bt)}function zg(i,o,u){if(bt.current!==Zr)throw Error(a(168));Je(bt,o),Je(an,u)}function Ig(i,o,u){var h=i.stateNode;if(o=o.childContextTypes,typeof h.getChildContext!="function")return u;h=h.getChildContext();for(var f in h)if(!(f in o))throw Error(a(108,N(i)||"Unknown",f));return l({},u,h)}function ia(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Zr,Gi=bt.current,Je(bt,i),Je(an,an.current),!0}function Dg(i,o,u){var h=i.stateNode;if(!h)throw Error(a(169));u?(i=Ig(i,o,Gi),h.__reactInternalMemoizedMergedChildContext=i,tt(an),tt(bt),Je(bt,i)):tt(an),Je(an,u)}var jn=Math.clz32?Math.clz32:W4,B4=Math.log,V4=Math.LN2;function W4(i){return i>>>=0,i===0?32:31-(B4(i)/V4|0)|0}var oa=64,sa=4194304;function Ms(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function la(i,o){var u=i.pendingLanes;if(u===0)return 0;var h=0,f=i.suspendedLanes,m=i.pingedLanes,T=u&268435455;if(T!==0){var A=T&~f;A!==0?h=Ms(A):(m&=T,m!==0&&(h=Ms(m)))}else T=u&~f,T!==0?h=Ms(T):m!==0&&(h=Ms(m));if(h===0)return 0;if(o!==0&&o!==h&&!(o&f)&&(f=h&-h,m=o&-o,f>=m||f===16&&(m&4194240)!==0))return o;if(h&4&&(h|=u&16),o=i.entangledLanes,o!==0)for(i=i.entanglements,o&=h;0u;u++)o.push(i);return o}function Ls(i,o,u){i.pendingLanes|=o,o!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,o=31-jn(o),i[o]=u}function K4(i,o){var u=i.pendingLanes&~o;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=o,i.mutableReadLanes&=o,i.entangledLanes&=o,o=i.entanglements;var h=i.eventTimes;for(i=i.expirationTimes;0>=T,f-=T,Pr=1<<32-jn(o)+f|u<Be?(Dt=Ne,Ne=null):Dt=Ne.sibling;var Ve=se(G,Ne,W[Be],ae);if(Ve===null){Ne===null&&(Ne=Dt);break}i&&Ne&&Ve.alternate===null&&o(G,Ne),O=m(Ve,O,Be),Re===null?_e=Ve:Re.sibling=Ve,Re=Ve,Ne=Dt}if(Be===W.length)return u(G,Ne),ot&&Vi(G,Be),_e;if(Ne===null){for(;BeBe?(Dt=Ne,Ne=null):Dt=Ne.sibling;var si=se(G,Ne,Ve.value,ae);if(si===null){Ne===null&&(Ne=Dt);break}i&&Ne&&si.alternate===null&&o(G,Ne),O=m(si,O,Be),Re===null?_e=si:Re.sibling=si,Re=si,Ne=Dt}if(Ve.done)return u(G,Ne),ot&&Vi(G,Be),_e;if(Ne===null){for(;!Ve.done;Be++,Ve=W.next())Ve=Te(G,Ve.value,ae),Ve!==null&&(O=m(Ve,O,Be),Re===null?_e=Ve:Re.sibling=Ve,Re=Ve);return ot&&Vi(G,Be),_e}for(Ne=h(G,Ne);!Ve.done;Be++,Ve=W.next())Ve=nt(Ne,G,Be,Ve.value,ae),Ve!==null&&(i&&Ve.alternate!==null&&Ne.delete(Ve.key===null?Be:Ve.key),O=m(Ve,O,Be),Re===null?_e=Ve:Re.sibling=Ve,Re=Ve);return i&&Ne.forEach(function(M3){return o(G,M3)}),ot&&Vi(G,Be),_e}function Mr(G,O,W,ae){if(typeof W=="object"&&W!==null&&W.type===y&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case d:e:{for(var _e=W.key,Re=O;Re!==null;){if(Re.key===_e){if(_e=W.type,_e===y){if(Re.tag===7){u(G,Re.sibling),O=f(Re,W.props.children),O.return=G,G=O;break e}}else if(Re.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===p&&jg(_e)===Re.type){u(G,Re.sibling),O=f(Re,W.props),O.ref=Is(G,Re,W),O.return=G,G=O;break e}u(G,Re);break}else o(G,Re);Re=Re.sibling}W.type===y?(O=$i(W.props.children,G.mode,ae,W.key),O.return=G,G=O):(ae=ja(W.type,W.key,W.props,null,G.mode,ae),ae.ref=Is(G,O,W),ae.return=G,G=ae)}return T(G);case g:e:{for(Re=W.key;O!==null;){if(O.key===Re)if(O.tag===4&&O.stateNode.containerInfo===W.containerInfo&&O.stateNode.implementation===W.implementation){u(G,O.sibling),O=f(O,W.children||[]),O.return=G,G=O;break e}else{u(G,O);break}else o(G,O);O=O.sibling}O=Nh(W,G.mode,ae),O.return=G,G=O}return T(G);case p:return Re=W._init,Mr(G,O,Re(W._payload),ae)}if(ee(W))return qe(G,O,W,ae);if(F(W))return fn(G,O,W,ae);ga(G,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,O!==null&&O.tag===6?(u(G,O.sibling),O=f(O,W),O.return=G,G=O):(u(G,O),O=Th(W,G.mode,ae),O.return=G,G=O),T(G)):u(G,O)}return Mr}var Fo=Kg(!0),Yg=Kg(!1),pa=qr(null),ma=null,Mo=null,zd=null;function Id(){zd=Mo=ma=null}function Xg(i,o,u){Oe?(Je(pa,o._currentValue),o._currentValue=u):(Je(pa,o._currentValue2),o._currentValue2=u)}function Dd(i){var o=pa.current;tt(pa),Oe?i._currentValue=o:i._currentValue2=o}function Ad(i,o,u){for(;i!==null;){var h=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,h!==null&&(h.childLanes|=o)):h!==null&&(h.childLanes&o)!==o&&(h.childLanes|=o),i===u)break;i=i.return}}function Lo(i,o){ma=i,zd=Mo=null,i=i.dependencies,i!==null&&i.firstContext!==null&&(i.lanes&o&&(cn=!0),i.firstContext=null)}function Ln(i){var o=Oe?i._currentValue:i._currentValue2;if(zd!==i)if(i={context:i,memoizedValue:o,next:null},Mo===null){if(ma===null)throw Error(a(308));Mo=i,ma.dependencies={lanes:0,firstContext:i}}else Mo=Mo.next=i;return o}var Wi=null;function Od(i){Wi===null?Wi=[i]:Wi.push(i)}function $g(i,o,u,h){var f=o.interleaved;return f===null?(u.next=u,Od(o)):(u.next=f.next,f.next=u),o.interleaved=u,cr(i,h)}function cr(i,o){i.lanes|=o;var u=i.alternate;for(u!==null&&(u.lanes|=o),u=i,i=i.return;i!==null;)i.childLanes|=o,u=i.alternate,u!==null&&(u.childLanes|=o),u=i,i=i.return;return u.tag===3?u.stateNode:null}var Jr=!1;function Hd(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qg(i,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Nr(i,o){return{eventTime:i,lane:o,tag:0,payload:null,callback:null,next:null}}function ei(i,o,u){var h=i.updateQueue;if(h===null)return null;if(h=h.shared,Me&2){var f=h.pending;return f===null?o.next=o:(o.next=f.next,f.next=o),h.pending=o,cr(i,u)}return f=h.interleaved,f===null?(o.next=o,Od(h)):(o.next=f.next,f.next=o),h.interleaved=o,cr(i,u)}function ya(i,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var h=o.lanes;h&=i.pendingLanes,u|=h,o.lanes=u,Cd(i,u)}}function qg(i,o){var u=i.updateQueue,h=i.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var f=null,m=null;if(u=u.firstBaseUpdate,u!==null){do{var T={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};m===null?f=m=T:m=m.next=T,u=u.next}while(u!==null);m===null?f=m=o:m=m.next=o}else f=m=o;u={baseState:h.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:h.shared,effects:h.effects},i.updateQueue=u;return}i=u.lastBaseUpdate,i===null?u.firstBaseUpdate=o:i.next=o,u.lastBaseUpdate=o}function va(i,o,u,h){var f=i.updateQueue;Jr=!1;var m=f.firstBaseUpdate,T=f.lastBaseUpdate,A=f.shared.pending;if(A!==null){f.shared.pending=null;var B=A,te=B.next;B.next=null,T===null?m=te:T.next=te,T=B;var fe=i.alternate;fe!==null&&(fe=fe.updateQueue,A=fe.lastBaseUpdate,A!==T&&(A===null?fe.firstBaseUpdate=te:A.next=te,fe.lastBaseUpdate=B))}if(m!==null){var Te=f.baseState;T=0,fe=te=B=null,A=m;do{var se=A.lane,nt=A.eventTime;if((h&se)===se){fe!==null&&(fe=fe.next={eventTime:nt,lane:0,tag:A.tag,payload:A.payload,callback:A.callback,next:null});e:{var qe=i,fn=A;switch(se=o,nt=u,fn.tag){case 1:if(qe=fn.payload,typeof qe=="function"){Te=qe.call(nt,Te,se);break e}Te=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=fn.payload,se=typeof qe=="function"?qe.call(nt,Te,se):qe,se==null)break e;Te=l({},Te,se);break e;case 2:Jr=!0}}A.callback!==null&&A.lane!==0&&(i.flags|=64,se=f.effects,se===null?f.effects=[A]:se.push(A))}else nt={eventTime:nt,lane:se,tag:A.tag,payload:A.payload,callback:A.callback,next:null},fe===null?(te=fe=nt,B=Te):fe=fe.next=nt,T|=se;if(A=A.next,A===null){if(A=f.shared.pending,A===null)break;se=A,A=se.next,se.next=null,f.lastBaseUpdate=se,f.shared.pending=null}}while(!0);if(fe===null&&(B=Te),f.baseState=B,f.firstBaseUpdate=te,f.lastBaseUpdate=fe,o=f.shared.interleaved,o!==null){f=o;do T|=f.lane,f=f.next;while(f!==o)}else m===null&&(f.shared.lanes=0);ji|=T,i.lanes=T,i.memoizedState=Te}}function Zg(i,o,u){if(i=o.effects,o.effects=null,i!==null)for(o=0;ou?u:4,i(!0);var h=Wd.transition;Wd.transition={};try{i(!1),o()}finally{Ge=u,Wd.transition=h}}function yp(){return In().memoizedState}function i3(i,o,u){var h=ri(i);if(u={lane:h,action:u,hasEagerState:!1,eagerState:null,next:null},vp(i))xp(o,u);else if(u=$g(i,o,u,h),u!==null){var f=Xt();Dn(u,i,h,f),Sp(u,o,h)}}function o3(i,o,u){var h=ri(i),f={lane:h,action:u,hasEagerState:!1,eagerState:null,next:null};if(vp(i))xp(o,f);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=o.lastRenderedReducer,m!==null))try{var T=o.lastRenderedState,A=m(T,u);if(f.hasEagerState=!0,f.eagerState=A,Kn(A,T)){var B=o.interleaved;B===null?(f.next=f,Od(o)):(f.next=B.next,B.next=f),o.interleaved=f;return}}catch{}finally{}u=$g(i,o,f,h),u!==null&&(f=Xt(),Dn(u,i,h,f),Sp(u,o,h))}}function vp(i){var o=i.alternate;return i===ct||o!==null&&o===ct}function xp(i,o){Os=_a=!0;var u=i.pending;u===null?o.next=o:(o.next=u.next,u.next=o),i.pending=o}function Sp(i,o,u){if(u&4194240){var h=o.lanes;h&=i.pendingLanes,u|=h,o.lanes=u,Cd(i,u)}}var ka={readContext:Ln,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useInsertionEffect:jt,useLayoutEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useMutableSource:jt,useSyncExternalStore:jt,useId:jt,unstable_isNewReconciler:!1},s3={readContext:Ln,useCallback:function(i,o){return hr().memoizedState=[i,o===void 0?null:o],i},useContext:Ln,useEffect:up,useImperativeHandle:function(i,o,u){return u=u!=null?u.concat([i]):null,wa(4194308,4,hp.bind(null,o,i),u)},useLayoutEffect:function(i,o){return wa(4194308,4,i,o)},useInsertionEffect:function(i,o){return wa(4,2,i,o)},useMemo:function(i,o){var u=hr();return o=o===void 0?null:o,i=i(),u.memoizedState=[i,o],i},useReducer:function(i,o,u){var h=hr();return o=u!==void 0?u(o):o,h.memoizedState=h.baseState=o,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:o},h.queue=i,i=i.dispatch=i3.bind(null,ct,i),[h.memoizedState,i]},useRef:function(i){var o=hr();return i={current:i},o.memoizedState=i},useState:lp,useDebugValue:Qd,useDeferredValue:function(i){return hr().memoizedState=i},useTransition:function(){var i=lp(!1),o=i[0];return i=r3.bind(null,i[1]),hr().memoizedState=i,[o,i]},useMutableSource:function(){},useSyncExternalStore:function(i,o,u){var h=ct,f=hr();if(ot){if(u===void 0)throw Error(a(407));u=u()}else{if(u=o(),It===null)throw Error(a(349));bi&30||np(h,o,u)}f.memoizedState=u;var m={value:u,getSnapshot:o};return f.queue=m,up(ip.bind(null,h,m,i),[i]),h.flags|=2048,Gs(9,rp.bind(null,h,m,u,o),void 0,null),u},useId:function(){var i=hr(),o=It.identifierPrefix;if(ot){var u=Tr,h=Pr;u=(h&~(1<<32-jn(h)-1)).toString(32)+u,o=":"+o+"R"+u,u=Hs++,0xh&&(o.flags|=128,h=!0,Ws(f,!1),o.lanes=4194304)}else{if(!h)if(i=xa(m),i!==null){if(o.flags|=128,h=!0,i=i.updateQueue,i!==null&&(o.updateQueue=i,o.flags|=4),Ws(f,!0),f.tail===null&&f.tailMode==="hidden"&&!m.alternate&&!ot)return Kt(o),null}else 2*Lt()-f.renderingStartTime>xh&&u!==1073741824&&(o.flags|=128,h=!0,Ws(f,!1),o.lanes=4194304);f.isBackwards?(m.sibling=o.child,o.child=m):(i=f.last,i!==null?i.sibling=m:o.child=m,f.last=m)}return f.tail!==null?(o=f.tail,f.rendering=o,f.tail=o.sibling,f.renderingStartTime=Lt(),o.sibling=null,i=ut.current,Je(ut,h?i&1|2:i&1),o):(Kt(o),null);case 22:case 23:return kh(),u=o.memoizedState!==null,i!==null&&i.memoizedState!==null!==u&&(o.flags|=8192),u&&o.mode&1?_n&1073741824&&(Kt(o),Ee&&o.subtreeFlags&6&&(o.flags|=8192)):Kt(o),null;case 24:return null;case 25:return null}throw Error(a(156,o.tag))}function g3(i,o){switch(Rd(o),o.tag){case 1:return un(o.type)&&ra(),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return Io(),tt(an),tt(bt),Vd(),i=o.flags,i&65536&&!(i&128)?(o.flags=i&-65537|128,o):null;case 5:return Gd(o),null;case 13:if(tt(ut),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(a(340));Ro()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return tt(ut),null;case 4:return Io(),null;case 10:return Dd(o.type._context),null;case 22:case 23:return kh(),null;case 24:return null;default:return null}}var Fa=!1,Yt=!1,p3=typeof WeakSet=="function"?WeakSet:Set,ce=null;function Ao(i,o){var u=i.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(h){st(i,o,h)}else u.current=null}function lh(i,o,u){try{u()}catch(h){st(i,o,h)}}var Vp=!1;function m3(i,o){for(Q(i.containerInfo),ce=o;ce!==null;)if(i=ce,o=i.child,(i.subtreeFlags&1028)!==0&&o!==null)o.return=i,ce=o;else for(;ce!==null;){i=ce;try{var u=i.alternate;if(i.flags&1024)switch(i.tag){case 0:case 11:case 15:break;case 1:if(u!==null){var h=u.memoizedProps,f=u.memoizedState,m=i.stateNode,T=m.getSnapshotBeforeUpdate(i.elementType===i.type?h:Xn(i.type,h),f);m.__reactInternalSnapshotBeforeUpdate=T}break;case 3:Ee&&gd(i.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(A){st(i,i.return,A)}if(o=i.sibling,o!==null){o.return=i.return,ce=o;break}ce=i.return}return u=Vp,Vp=!1,u}function bs(i,o,u){var h=o.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var f=h=h.next;do{if((f.tag&i)===i){var m=f.destroy;f.destroy=void 0,m!==void 0&&lh(o,u,m)}f=f.next}while(f!==h)}}function Ma(i,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&i)===i){var h=u.create;u.destroy=h()}u=u.next}while(u!==o)}}function ah(i){var o=i.ref;if(o!==null){var u=i.stateNode;switch(i.tag){case 5:i=pe(u);break;default:i=u}typeof o=="function"?o(i):o.current=i}}function Wp(i){var o=i.alternate;o!==null&&(i.alternate=null,Wp(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&le(o)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function bp(i){return i.tag===5||i.tag===3||i.tag===4}function jp(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||bp(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function uh(i,o,u){var h=i.tag;if(h===5||h===6)i=i.stateNode,o?Oi(u,i,o):be(u,i);else if(h!==4&&(i=i.child,i!==null))for(uh(i,o,u),i=i.sibling;i!==null;)uh(i,o,u),i=i.sibling}function ch(i,o,u){var h=i.tag;if(h===5||h===6)i=i.stateNode,o?xn(u,i,o):He(u,i);else if(h!==4&&(i=i.child,i!==null))for(ch(i,o,u),i=i.sibling;i!==null;)ch(i,o,u),i=i.sibling}var Ut=null,$n=!1;function gr(i,o,u){for(u=u.child;u!==null;)dh(i,o,u),u=u.sibling}function dh(i,o,u){if(ar&&typeof ar.onCommitFiberUnmount=="function")try{ar.onCommitFiberUnmount(aa,u)}catch{}switch(u.tag){case 5:Yt||Ao(u,o);case 6:if(Ee){var h=Ut,f=$n;Ut=null,gr(i,o,u),Ut=h,$n=f,Ut!==null&&($n?kr(Ut,u.stateNode):Qr(Ut,u.stateNode))}else gr(i,o,u);break;case 18:Ee&&Ut!==null&&($n?A4(Ut,u.stateNode):D4(Ut,u.stateNode));break;case 4:Ee?(h=Ut,f=$n,Ut=u.stateNode.containerInfo,$n=!0,gr(i,o,u),Ut=h,$n=f):(We&&(h=u.stateNode.containerInfo,f=Jl(h),Rs(h,f)),gr(i,o,u));break;case 0:case 11:case 14:case 15:if(!Yt&&(h=u.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){f=h=h.next;do{var m=f,T=m.destroy;m=m.tag,T!==void 0&&(m&2||m&4)&&lh(u,o,T),f=f.next}while(f!==h)}gr(i,o,u);break;case 1:if(!Yt&&(Ao(u,o),h=u.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=u.memoizedProps,h.state=u.memoizedState,h.componentWillUnmount()}catch(A){st(u,o,A)}gr(i,o,u);break;case 21:gr(i,o,u);break;case 22:u.mode&1?(Yt=(h=Yt)||u.memoizedState!==null,gr(i,o,u),Yt=h):gr(i,o,u);break;default:gr(i,o,u)}}function Kp(i){var o=i.updateQueue;if(o!==null){i.updateQueue=null;var u=i.stateNode;u===null&&(u=i.stateNode=new p3),o.forEach(function(h){var f=E3.bind(null,i,h);u.has(h)||(u.add(h),h.then(f,f))})}}function Qn(i,o){var u=o.deletions;if(u!==null)for(var h=0;h";case za:return":has("+(gh(i)||"")+")";case Ia:return'[role="'+i.value+'"]';case Aa:return'"'+i.value+'"';case Da:return'[data-testname="'+i.value+'"]';default:throw Error(a(365))}}function Zp(i,o){var u=[];i=[i,0];for(var h=0;hf&&(f=T),h&=~m}if(h=f,h=Lt()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*v3(h/1960))-h,10i?16:i,ni===null)var h=!1;else{if(i=ni,ni=null,Ba=0,Me&6)throw Error(a(331));var f=Me;for(Me|=4,ce=i.current;ce!==null;){var m=ce,T=m.child;if(ce.flags&16){var A=m.deletions;if(A!==null){for(var B=0;BLt()-vh?Ki(i,0):yh|=u),hn(i,o)}function l1(i,o){o===0&&(i.mode&1?(o=sa,sa<<=1,!(sa&130023424)&&(sa=4194304)):o=1);var u=Xt();i=cr(i,o),i!==null&&(Ls(i,o,u),hn(i,u))}function k3(i){var o=i.memoizedState,u=0;o!==null&&(u=o.retryLane),l1(i,u)}function E3(i,o){var u=0;switch(i.tag){case 13:var h=i.stateNode,f=i.memoizedState;f!==null&&(u=f.retryLane);break;case 19:h=i.stateNode;break;default:throw Error(a(314))}h!==null&&h.delete(o),l1(i,u)}var a1;a1=function(i,o,u){if(i!==null)if(i.memoizedProps!==o.pendingProps||an.current)cn=!0;else{if(!(i.lanes&u)&&!(o.flags&128))return cn=!1,h3(i,o,u);cn=!!(i.flags&131072)}else cn=!1,ot&&o.flags&1048576&&Gg(o,da,o.index);switch(o.lanes=0,o.tag){case 2:var h=o.type;Ta(i,o),i=o.pendingProps;var f=Po(o,bt.current);Lo(o,u),f=jd(null,o,h,i,f,u);var m=Kd();return o.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,un(h)?(m=!0,ia(o)):m=!1,o.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Hd(o),f.updater=Ea,o.stateNode=f,f._reactInternals=o,Zd(o,h,i,u),o=nh(null,o,h,!0,m,u)):(o.tag=0,ot&&m&&Nd(o),tn(null,o,f,u),o=o.child),o;case 16:h=o.elementType;e:{switch(Ta(i,o),i=o.pendingProps,f=h._init,h=f(h._payload),o.type=h,f=o.tag=T3(h),i=Xn(h,i),f){case 0:o=th(null,o,h,i,u);break e;case 1:o=Ip(null,o,h,i,u);break e;case 11:o=Rp(null,o,h,i,u);break e;case 14:o=Fp(null,o,h,Xn(h.type,i),u);break e}throw Error(a(306,h,""))}return o;case 0:return h=o.type,f=o.pendingProps,f=o.elementType===h?f:Xn(h,f),th(i,o,h,f,u);case 1:return h=o.type,f=o.pendingProps,f=o.elementType===h?f:Xn(h,f),Ip(i,o,h,f,u);case 3:e:{if(Dp(o),i===null)throw Error(a(387));h=o.pendingProps,m=o.memoizedState,f=m.element,Qg(i,o),va(o,h,null,u);var T=o.memoizedState;if(h=T.element,Xe&&m.isDehydrated)if(m={element:h,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=m,o.memoizedState=m,o.flags&256){f=Do(Error(a(423)),o),o=Ap(i,o,h,u,f);break e}else if(h!==f){f=Do(Error(a(424)),o),o=Ap(i,o,h,u,f);break e}else for(Xe&&(Mn=T4(o.stateNode.containerInfo),Sn=o,ot=!0,Yn=null,zs=!1),u=Yg(o,null,h,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Ro(),h===f){o=Rr(i,o,u);break e}tn(i,o,h,u)}o=o.child}return o;case 5:return Jg(o),i===null&&Md(o),h=o.type,f=o.pendingProps,m=i!==null?i.memoizedProps:null,T=f.children,vt(h,f)?T=null:m!==null&&vt(h,m)&&(o.flags|=32),zp(i,o),tn(i,o,T,u),o.child;case 6:return i===null&&Md(o),null;case 13:return Op(i,o,u);case 4:return Ud(o,o.stateNode.containerInfo),h=o.pendingProps,i===null?o.child=Fo(o,null,h,u):tn(i,o,h,u),o.child;case 11:return h=o.type,f=o.pendingProps,f=o.elementType===h?f:Xn(h,f),Rp(i,o,h,f,u);case 7:return tn(i,o,o.pendingProps,u),o.child;case 8:return tn(i,o,o.pendingProps.children,u),o.child;case 12:return tn(i,o,o.pendingProps.children,u),o.child;case 10:e:{if(h=o.type._context,f=o.pendingProps,m=o.memoizedProps,T=f.value,Xg(o,h,T),m!==null)if(Kn(m.value,T)){if(m.children===f.children&&!an.current){o=Rr(i,o,u);break e}}else for(m=o.child,m!==null&&(m.return=o);m!==null;){var A=m.dependencies;if(A!==null){T=m.child;for(var B=A.firstContext;B!==null;){if(B.context===h){if(m.tag===1){B=Nr(-1,u&-u),B.tag=2;var te=m.updateQueue;if(te!==null){te=te.shared;var fe=te.pending;fe===null?B.next=B:(B.next=fe.next,fe.next=B),te.pending=B}}m.lanes|=u,B=m.alternate,B!==null&&(B.lanes|=u),Ad(m.return,u,o),A.lanes|=u;break}B=B.next}}else if(m.tag===10)T=m.type===o.type?null:m.child;else if(m.tag===18){if(T=m.return,T===null)throw Error(a(341));T.lanes|=u,A=T.alternate,A!==null&&(A.lanes|=u),Ad(T,u,o),T=m.sibling}else T=m.child;if(T!==null)T.return=m;else for(T=m;T!==null;){if(T===o){T=null;break}if(m=T.sibling,m!==null){m.return=T.return,T=m;break}T=T.return}m=T}tn(i,o,f.children,u),o=o.child}return o;case 9:return f=o.type,h=o.pendingProps.children,Lo(o,u),f=Ln(f),h=h(f),o.flags|=1,tn(i,o,h,u),o.child;case 14:return h=o.type,f=Xn(h,o.pendingProps),f=Xn(h.type,f),Fp(i,o,h,f,u);case 15:return Mp(i,o,o.type,o.pendingProps,u);case 17:return h=o.type,f=o.pendingProps,f=o.elementType===h?f:Xn(h,f),Ta(i,o),o.tag=1,un(h)?(i=!0,ia(o)):i=!1,Lo(o,u),wp(o,h,f),Zd(o,h,f,u),nh(null,o,h,!0,i,u);case 19:return Up(i,o,u);case 22:return Lp(i,o,u)}throw Error(a(156,o.tag))};function u1(i,o){return kd(i,o)}function P3(i,o,u,h){this.tag=i,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function An(i,o,u,h){return new P3(i,o,u,h)}function Ph(i){return i=i.prototype,!(!i||!i.isReactComponent)}function T3(i){if(typeof i=="function")return Ph(i)?1:0;if(i!=null){if(i=i.$$typeof,i===E)return 11;if(i===C)return 14}return 2}function oi(i,o){var u=i.alternate;return u===null?(u=An(i.tag,o,i.key,i.mode),u.elementType=i.elementType,u.type=i.type,u.stateNode=i.stateNode,u.alternate=i,i.alternate=u):(u.pendingProps=o,u.type=i.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=i.flags&14680064,u.childLanes=i.childLanes,u.lanes=i.lanes,u.child=i.child,u.memoizedProps=i.memoizedProps,u.memoizedState=i.memoizedState,u.updateQueue=i.updateQueue,o=i.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=i.sibling,u.index=i.index,u.ref=i.ref,u}function ja(i,o,u,h,f,m){var T=2;if(h=i,typeof i=="function")Ph(i)&&(T=1);else if(typeof i=="string")T=5;else e:switch(i){case y:return $i(u.children,f,m,o);case w:T=8,f|=8;break;case x:return i=An(12,u,o,f|2),i.elementType=x,i.lanes=m,i;case P:return i=An(13,u,o,f),i.elementType=P,i.lanes=m,i;case k:return i=An(19,u,o,f),i.elementType=k,i.lanes=m,i;case S:return Ka(u,f,m,o);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case _:T=10;break e;case v:T=9;break e;case E:T=11;break e;case C:T=14;break e;case p:T=16,h=null;break e}throw Error(a(130,i==null?i:typeof i,""))}return o=An(T,u,o,f),o.elementType=i,o.type=h,o.lanes=m,o}function $i(i,o,u,h){return i=An(7,i,h,o),i.lanes=u,i}function Ka(i,o,u,h){return i=An(22,i,h,o),i.elementType=S,i.lanes=u,i.stateNode={isHidden:!1},i}function Th(i,o,u){return i=An(6,i,null,o),i.lanes=u,i}function Nh(i,o,u){return o=An(4,i.children!==null?i.children:[],i.key,o),o.lanes=u,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}function N3(i,o,u,h,f){this.tag=o,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ge,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=wd(0),this.expirationTimes=wd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wd(0),this.identifierPrefix=h,this.onRecoverableError=f,Xe&&(this.mutableSourceEagerHydrationData=null)}function c1(i,o,u,h,f,m,T,A,B){return i=new N3(i,o,u,A,B),o===1?(o=1,m===!0&&(o|=8)):o=0,m=An(3,null,null,o),i.current=m,m.stateNode=i,m.memoizedState={element:h,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hd(m),i}function d1(i){if(!i)return Zr;i=i._reactInternals;e:{if(z(i)!==i||i.tag!==1)throw Error(a(170));var o=i;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(un(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(a(171))}if(i.tag===1){var u=i.type;if(un(u))return Ig(i,u,o)}return o}function h1(i){var o=i._reactInternals;if(o===void 0)throw typeof i.render=="function"?Error(a(188)):(i=Object.keys(i).join(","),Error(a(268,i)));return i=b(o),i===null?null:i.stateNode}function f1(i,o){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var u=i.retryLane;i.retryLane=u!==0&&u=te&&m>=Te&&f<=fe&&T<=se){i.splice(o,1);break}else if(h!==te||u.width!==B.width||seT){if(!(m!==Te||u.height!==B.height||fef)){te>h&&(B.width+=te-h,B.x=h),fem&&(B.height+=Te-m,B.y=m),seu&&(u=T)),T ")+` + +No matching component was found for: + `)+i.join(" > ")}return null},n.getPublicRootInstance=function(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return pe(i.child.stateNode);default:return i.child.stateNode}},n.injectIntoDevTools=function(i){if(i={bundleType:i.bundleType,version:i.version,rendererPackageName:i.rendererPackageName,rendererConfig:i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:R3,findFiberByHostInstance:i.findFiberByHostInstance||F3,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")i=!1;else{var o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(o.isDisabled||!o.supportsFiber)i=!0;else{try{aa=o.inject(i),ar=o}catch{}i=!!o.checkDCE}}return i},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(i,o,u,h){if(!V)throw Error(a(363));i=ph(i,o);var f=Se(i,u,h).disconnect;return{disconnect:function(){f()}}},n.registerMutableSourceForHydration=function(i,o){var u=o._getVersion;u=u(o._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[o,u]:i.mutableSourceEagerHydrationData.push(o,u)},n.runWithPriority=function(i,o){var u=Ge;try{return Ge=i,o()}finally{Ge=u}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(i,o,u,h){var f=o.current,m=Xt(),T=ri(f);return u=d1(u),o.context===null?o.context=u:o.pendingContext=u,o=Nr(m,T),o.payload={element:i},h=h===void 0?null:h,h!==null&&(o.callback=h),i=ei(f,o,T),i!==null&&(Dn(i,f,T,m),ya(i,f,T)),T},n};c4.exports=NS;var RS=c4.exports;const FS=Vl(RS);var d4={exports:{}},ko={};/** + * @license React + * react-reconciler-constants.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ko.ConcurrentRoot=1;ko.ContinuousEventPriority=4;ko.DefaultEventPriority=16;ko.DiscreteEventPriority=1;ko.IdleEventPriority=536870912;ko.LegacyRoot=0;d4.exports=ko;var h4=d4.exports;const sm={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let lm=!1,am=!1;const Rg=".react-konva-event",MS=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. +Position of a node will be changed during drag&drop, so you should update state of the react app as well. +Consider to add onDragMove or onDragEnd events. +For more info see: https://github.com/konvajs/react-konva/issues/256 +`,LS=`ReactKonva: You are using "zIndex" attribute for a Konva node. +react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. +For more info see: https://github.com/konvajs/react-konva/issues/194 +`,zS={};function hd(t,e,n=zS){if(!lm&&"zIndex"in e&&(console.warn(LS),lm=!0),!am&&e.draggable){var r=e.x!==void 0||e.y!==void 0,s=e.onDragEnd||e.onDragMove;r&&!s&&(console.warn(MS),am=!0)}for(var l in n)if(!sm[l]){var a=l.slice(0,2)==="on",c=n[l]!==e[l];if(a&&c){var d=l.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),t.off(d,n[l])}var g=!e.hasOwnProperty(l);g&&t.setAttr(l,void 0)}var y=e._useStrictMode,w={},x=!1;const _={};for(var l in e)if(!sm[l]){var a=l.slice(0,2)==="on",v=n[l]!==e[l];if(a&&v){var d=l.substr(2).toLowerCase();d.substr(0,7)==="content"&&(d="content"+d.substr(7,1).toUpperCase()+d.substr(8)),e[l]&&(_[d]=e[l])}!a&&(e[l]!==n[l]||y&&e[l]!==t.getAttr(l))&&(x=!0,w[l]=e[l])}x&&(t.setAttrs(w),Ai(t));for(var d in _)t.on(d+Rg,_[d])}function Ai(t){if(!Fe.Konva.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}const f4={},IS={};Bl.Node.prototype._applyProps=hd;function DS(t,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}t.add(e),Ai(t)}function AS(t,e,n){let r=Bl[t];r||(console.error(`Konva has no node with the type ${t}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${t}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=Bl.Group);const s={},l={};for(var a in e){var c=a.slice(0,2)==="on";c?l[a]=e[a]:s[a]=e[a]}const d=new r(s);return hd(d,l),d}function OS(t,e,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function HS(t,e,n){return!1}function US(t){return t}function GS(){return null}function BS(){return null}function VS(t,e,n,r){return IS}function WS(){}function bS(t){}function jS(t,e){return!1}function KS(){return f4}function YS(){return f4}const XS=setTimeout,$S=clearTimeout,QS=-1;function qS(t,e){return!1}const ZS=!1,JS=!0,e_=!0;function t_(t,e){e.parent===t?e.moveToTop():t.add(e),Ai(t)}function n_(t,e){e.parent===t?e.moveToTop():t.add(e),Ai(t)}function g4(t,e,n){e._remove(),t.add(e),e.setZIndex(n.getZIndex()),Ai(t)}function r_(t,e,n){g4(t,e,n)}function i_(t,e){e.destroy(),e.off(Rg),Ai(t)}function o_(t,e){e.destroy(),e.off(Rg),Ai(t)}function s_(t,e,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function l_(t,e,n){}function a_(t,e,n,r,s){hd(t,s,r)}function u_(t){t.hide(),Ai(t)}function c_(t){}function d_(t,e){(e.visible==null||e.visible)&&t.show()}function h_(t,e){}function f_(t){}function g_(){}const p_=()=>h4.DefaultEventPriority,m_=Object.freeze(Object.defineProperty({__proto__:null,appendChild:t_,appendChildToContainer:n_,appendInitialChild:DS,cancelTimeout:$S,clearContainer:f_,commitMount:l_,commitTextUpdate:s_,commitUpdate:a_,createInstance:AS,createTextInstance:OS,detachDeletedInstance:g_,finalizeInitialChildren:HS,getChildHostContext:YS,getCurrentEventPriority:p_,getPublicInstance:US,getRootHostContext:KS,hideInstance:u_,hideTextInstance:c_,idlePriority:hl.unstable_IdlePriority,insertBefore:g4,insertInContainerBefore:r_,isPrimaryRenderer:ZS,noTimeout:QS,now:hl.unstable_now,prepareForCommit:GS,preparePortalMount:BS,prepareUpdate:VS,removeChild:i_,removeChildFromContainer:o_,resetAfterCommit:WS,resetTextContent:bS,run:hl.unstable_runWithPriority,scheduleTimeout:XS,shouldDeprioritizeSubtree:jS,shouldSetTextContent:qS,supportsMutation:e_,unhideInstance:d_,unhideTextInstance:h_,warnsIfNotActing:JS},Symbol.toStringTag,{value:"Module"}));var y_=Object.defineProperty,v_=Object.defineProperties,x_=Object.getOwnPropertyDescriptors,um=Object.getOwnPropertySymbols,S_=Object.prototype.hasOwnProperty,__=Object.prototype.propertyIsEnumerable,cm=(t,e,n)=>e in t?y_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,dm=(t,e)=>{for(var n in e||(e={}))S_.call(e,n)&&cm(t,n,e[n]);if(um)for(var n of um(e))__.call(e,n)&&cm(t,n,e[n]);return t},w_=(t,e)=>v_(t,x_(e)),hm,fm;typeof window<"u"&&((hm=window.document)!=null&&hm.createElement||((fm=window.navigator)==null?void 0:fm.product)==="ReactNative")?X.useLayoutEffect:X.useEffect;function p4(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const s=p4(r,e,n);if(s)return s;r=r.sibling}}function m4(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const gm=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=gm;return}return gm.apply(this,arguments)};const Fg=m4(X.createContext(null));class y4 extends X.Component{render(){return X.createElement(Fg.Provider,{value:this._reactInternals},this.props.children)}}function C_(){const t=X.useContext(Fg);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=X.useId();return X.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const s=p4(r,!1,l=>{let a=l.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(s)return s}},[t,e])}function k_(){const t=C_(),[e]=X.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const s=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;s&&s!==Fg&&!e.has(s)&&e.set(s,X.useContext(m4(s)))}n=n.return}return e}function E_(){const t=k_();return X.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>X.createElement(e,null,X.createElement(n.Provider,w_(dm({},r),{value:t.get(n)}))),e=>X.createElement(y4,dm({},e))),[t])}function P_(t){const e=rn.useRef({});return rn.useLayoutEffect(()=>{e.current=t}),rn.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const T_=t=>{const e=rn.useRef(null),n=rn.useRef(null),r=rn.useRef(null),s=P_(t),l=E_(),a=c=>{const{forwardedRef:d}=t;d&&(typeof d=="function"?d(c):d.current=c)};return rn.useLayoutEffect(()=>(n.current=new Bl.Stage({width:t.width,height:t.height,container:e.current}),a(n.current),r.current=cl.createContainer(n.current,h4.LegacyRoot,!1,null),cl.updateContainer(rn.createElement(l,{},t.children),r.current),()=>{Bl.isBrowser&&(a(null),cl.updateContainer(null,r.current,null),n.current.destroy())}),[]),rn.useLayoutEffect(()=>{a(n.current),hd(n.current,t,s),cl.updateContainer(rn.createElement(l,{},t.children),r.current,null)}),rn.createElement("div",{ref:e,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})},N_="Layer",to="Rect",v4="Image",R_="Text",F_="Transformer",cl=FS(m_);cl.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:rn.version,rendererPackageName:"react-konva"});const M_=rn.forwardRef((t,e)=>rn.createElement(y4,{},rn.createElement(T_,{...t,forwardedRef:e}))),L_={"1200x675":{width:1200,height:675,label:"1200×675"},linkedin:{width:1200,height:627,label:"LinkedIn"},hf:{width:1160,height:580,label:"HF Custom"}};function dl(t){return L_[t]}function x4(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function m0(t){return[...t].sort((e,n)=>e.zIndex-n.zIndex)}function y0(t){return t.length===0?1:Math.max(...t.map(e=>e.zIndex))+1}function pm(t,e,n){return`${n==="black"?"900":t?"bold":"normal"} ${e?"italic":""}`.trim()}function z_({object:t,isSelected:e,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onEditingChange:c,onMouseEnter:d,onMouseLeave:g,shapeRef:y}){const w=X.useRef(null);X.useEffect(()=>{if(t.text===""&&e&&!t.isFixedSize&&!t.isEditing){const E=setTimeout(()=>{c(t.id,!0)},100);return()=>clearTimeout(E)}},[t.text,e,t.isFixedSize,t.isEditing,t.id,c]);const x=E=>{if(!t.isEditing){const P=E.target.getStage(),k=P==null?void 0:P.getPointerPosition();if(k){const C=k.x-t.x,p=k.y-t.y;c(t.id,!0,C,p)}else c(t.id,!0)}},_=()=>{if(!t.isFixedSize||!t.text)return t.fontSize;try{const E=new Hr.Text({text:t.text||"M",fontSize:t.fontSize,fontFamily:t.fontFamily,fontStyle:pm(t.bold,t.italic,t.fontWeight),width:t.width,height:t.height});let P=t.fontSize;const k=t.width,C=t.height;for(;P>10;){E.fontSize(P);const p=E.measureSize(t.text||"M");if(p.width<=k&&p.height<=C)break;P-=1}return E.destroy(),P}catch(E){return console.error("Error calculating fit font size:",E),t.fontSize}},v=t.isFixedSize?_():t.fontSize;return I.jsx(R_,{id:t.id,ref:E=>{typeof y=="function"?y(E):y&&(y.current=E),w.current=E},x:t.x,y:t.y,width:t.width,height:t.height,text:t.text,fontSize:v,fontFamily:t.fontFamily,fill:t.fill,fontStyle:pm(t.bold,t.italic,t.fontWeight),align:t.align||"left",verticalAlign:"top",rotation:t.rotation,padding:0,lineHeight:1,draggable:!0,onClick:E=>n(E),onTap:E=>n(E),onDblClick:x,onDblTap:x,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onMouseEnter:d,onMouseLeave:g,opacity:t.isEditing?0:1,listening:!t.isEditing})}function I_({object:t,isSelected:e,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onEditingChange:c,onMouseEnter:d,onMouseLeave:g,shapeRef:y}){switch(t.type){case"rect":return I.jsx(to,{id:t.id,ref:w=>{typeof y=="function"?y(w):y&&(y.current=w)},x:t.x,y:t.y,width:t.width,height:t.height,fill:t.fill,stroke:t.stroke,strokeWidth:t.strokeWidth,rotation:t.rotation,draggable:!0,onClick:w=>n(w),onTap:w=>n(w),onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onMouseEnter:d,onMouseLeave:g});case"image":case"huggy":return I.jsx(D_,{object:t,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onMouseEnter:d,onMouseLeave:g,shapeRef:y});case"text":return I.jsx(z_,{object:t,isSelected:e,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onEditingChange:c||(()=>{}),onMouseEnter:d,onMouseLeave:g,shapeRef:y});case"logoPlaceholder":return I.jsx(A_,{object:t,onSelect:n,onDragStart:r,onDragMove:s,onDragEnd:l,onTransformEnd:a,onMouseEnter:d,onMouseLeave:g,shapeRef:y});default:return null}}function D_({object:t,onSelect:e,onDragStart:n,onDragMove:r,onDragEnd:s,onTransformEnd:l,onMouseEnter:a,onMouseLeave:c,shapeRef:d}){const[g,y]=X.useState(null),w=X.useRef(null),x=X.useRef(null);return X.useEffect(()=>{const _=new window.Image;return _.src=t.type==="image"||t.type==="huggy"?t.src:"",_.crossOrigin="anonymous",_.onload=()=>{y(_),w.current=_,setTimeout(()=>{if(x.current){const v=x.current.getLayer();v&&v.batchDraw()}},10)},()=>{w.current=null}},[t]),g?I.jsx(v4,{id:t.id,ref:_=>{x.current=_,console.log("ImageRenderer ref callback:",t.id,"Node:",_),typeof d=="function"?d(_):d&&(d.current=_)},x:t.x,y:t.y,width:t.width,height:t.height,image:g,rotation:t.rotation,draggable:!0,onClick:_=>e(_),onTap:_=>e(_),onDragStart:n,onDragMove:r,onDragEnd:s,onTransformEnd:l,onMouseEnter:a,onMouseLeave:c}):null}function A_({object:t,onSelect:e,onDragStart:n,onDragMove:r,onDragEnd:s,onTransformEnd:l,onMouseEnter:a,onMouseLeave:c,shapeRef:d}){const g=X.useRef(null);return X.useEffect(()=>{g.current&&t.type==="logoPlaceholder"&&(g.current.cache(),g.current.filters([Hr.Filters.Blur]),g.current.blurRadius(t.blurRadius))},[t]),t.type!=="logoPlaceholder"?null:I.jsx(to,{id:t.id,ref:y=>{g.current=y,typeof d=="function"?d(y):d&&(d.current=y)},x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgba(255, 255, 255, 0.3)",stroke:"rgba(200, 200, 200, 0.5)",strokeWidth:2,rotation:t.rotation,draggable:!0,onClick:y=>e(y),onTap:y=>e(y),onDragStart:n,onDragMove:r,onDragEnd:s,onTransformEnd:l,onMouseEnter:a,onMouseLeave:c})}var qi=X,O_=function(e,n,r){const s=qi.useRef("loading"),l=qi.useRef(),[a,c]=qi.useState(0),d=qi.useRef(),g=qi.useRef(),y=qi.useRef();return(d.current!==e||g.current!==n||y.current!==r)&&(s.current="loading",l.current=void 0,d.current=e,g.current=n,y.current=r),qi.useLayoutEffect(function(){if(!e)return;var w=document.createElement("img");function x(){w.decode().catch(()=>{}).finally(()=>{s.current="loaded",l.current=w,c(Math.random())})}function _(){s.current="failed",l.current=void 0,c(Math.random())}return w.addEventListener("load",x),w.addEventListener("error",_),n&&(w.crossOrigin=n),r&&(w.referrerPolicy=r),w.src=e,function(){w.removeEventListener("load",x),w.removeEventListener("error",_)}},[e,n,r]),[l.current,s.current]};const H_=Vl(O_);function v0(t,e,n){return`${n==="black"?"900":t?"bold":"normal"} ${e?"italic":""}`.trim()}function U_(t,e,n,r,s,l,a){if(!t||e<=0)return 0;try{const c=new Hr.Text({text:t,fontSize:n,fontFamily:r,fontStyle:v0(s,l,a)});let d=0,g=1/0;for(let y=0;y<=t.length;y++){const w=t.substring(0,y);c.text(w);const x=c.width(),_=Math.abs(x-e);_{(async()=>{if(document.fonts)try{if(await Promise.all([document.fonts.load("bold 100px Bison"),document.fonts.load("bold 100px Inter"),document.fonts.load('400 50px "IBM Plex Mono"')]),await document.fonts.ready,await new Promise(V=>setTimeout(V,50)),p(!0),x.current){const V=x.current.getLayers()[0];V&&V.batchDraw()}}catch(V){console.error("Font loading error:",V),p(!0)}else p(!0)})()},[]),X.useEffect(()=>{if(C&&x.current){const j=x.current.getLayers()[0];j&&j.batchDraw()}},[n,C]);const Y=n.find(j=>j.type==="text"&&j.isEditing),me=m0(n);X.useEffect(()=>{if(!v.current)return;const j=(V=0)=>{if(r.length>0){const K=r.map(ue=>E.current.get(ue)).filter(ue=>ue!==void 0);if(console.log(`Attempt ${V}: Attaching transformer to:`,r,"Found nodes:",K.length),K.length>0){console.log("SUCCESS: Attaching transformer to",K.length,"nodes"),v.current.nodes(K),v.current.show(),v.current.forceUpdate();const ue=v.current.getLayer();ue&&ue.batchDraw(),console.log("Transformer attached and layer redrawn")}else if(V<10){const ue=Math.min(50*(V+1),100);setTimeout(()=>j(V+1),ue)}else console.error("Failed to attach transformer after 10 attempts. Selected IDs:",r)}else v.current.nodes([])};j(0)},[r,n]);const ze=(j,V=!1)=>{V?r.includes(j)?s(r.filter(K=>K!==j)):s([...r,j]):s([j])},Qe=X.useRef(null),vt=j=>{const V=j.target;Qe.current={x:V.x(),y:V.y()},r.length>1&&(z.current.clear(),r.forEach(ue=>{const ye=E.current.get(ue);ye&&z.current.set(ue,{x:ye.x(),y:ye.y()})}))},Ke=j=>{const V=j.target,K=j.evt.shiftKey,ue=r.length>1;if(K&&!ue&&Qe.current){const ye=Qe.current,re=V.x(),he=V.y(),xe=Math.abs(re-ye.x),Se=Math.abs(he-ye.y);xe>Se?V.y(ye.y):V.x(ye.x)}{const re=pe.width/2,he=pe.height/2;if(r.length>1){const Se=r.map(He=>E.current.get(He)).filter(He=>He!==void 0);if(Se.length===r.length&&Se.length>1){let He=1/0,be=1/0,wt=-1/0,Ht=-1/0;Se.forEach(bn=>{const fd=bn.width(),gd=bn.height(),pd=bn.x(),Jl=bn.y(),Ns=pd,ea=Jl,Rs=Ns+fd,ta=ea+gd;He=Math.min(He,Ns),be=Math.min(be,ea),wt=Math.max(wt,Rs),Ht=Math.max(Ht,ta)});const Nn=wt-He,xn=Ht-be,Oi=He+Nn/2,Qr=be+xn/2;let kr=0,lr=0,Hi=!1,Ui=!1;K||(Math.abs(Oi-re)<10&&(kr=re-Oi,Hi=!0),Math.abs(Qr-he)<10&&(lr=he-Qr,Ui=!0)),Hi||Ui?(Se.forEach(bn=>{kr!==0&&bn.x(bn.x()+kr),lr!==0&&bn.y(bn.y()+lr)}),ee({vertical:Hi,horizontal:Ui})):ee({vertical:!1,horizontal:!1})}}else{const Se=V.width(),He=V.height(),be=V.x(),wt=V.y(),Ht=be+Se/2,Nn=wt+He/2;let xn=be,Oi=wt,Qr=!1,kr=!1,lr=!1;if(K&&Qe.current){const Hi=Math.abs(be-Qe.current.x),Ui=Math.abs(wt-Qe.current.y);lr=Hi>Ui}Math.abs(Ht-re)<10&&(!K||lr)&&(xn=re-Se/2,Qr=!0),Math.abs(Nn-he)<10&&(!K||!lr)&&(Oi=he-He/2,kr=!0),Qr||kr?(V.x(xn),V.y(Oi),ee({vertical:Qr,horizontal:kr})):ee({vertical:!1,horizontal:!1})}}},D=j=>V=>{const K=V.target;if(Qe.current=null,z.current.clear(),ee({vertical:!1,horizontal:!1}),r.length>1&&r.includes(j))N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{const ye=n.map(re=>{if(r.includes(re.id)){const he=E.current.get(re.id);if(he)return{...re,x:he.x(),y:he.y()}}return re});l(ye),N.current=null},10);else{const ye=n.map(re=>re.id===j?{...re,x:K.x(),y:K.y()}:re);l(ye)}},Z=j=>V=>{const K=V.target,ue=K.scaleX(),ye=K.scaleY();if(r.length>1)L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{const he=n.map(xe=>{if(r.includes(xe.id)){const Se=E.current.get(xe.id);if(Se){const He=Se.scaleX(),be=Se.scaleY();Se.scaleX(1),Se.scaleY(1);const wt={...xe,x:Se.x(),y:Se.y(),width:Math.max(5,Se.width()*He),height:Math.max(5,Se.height()*be),rotation:Se.rotation()};if(xe.type==="text"){const Ht=Math.min(He,be),Nn=Math.max(10,xe.fontSize*Ht);return{...wt,fontSize:Nn,isFixedSize:!0}}return wt}}return xe});l(he),L.current=null},10);else{K.scaleX(1),K.scaleY(1);const he=n.map(xe=>{if(xe.id===j){const Se={...xe,x:K.x(),y:K.y(),width:Math.max(5,K.width()*ue),height:Math.max(5,K.height()*ye),rotation:K.rotation()};if(xe.type==="text"){const He=Math.min(ue,ye),be=Math.max(10,xe.fontSize*He);return{...Se,fontSize:be,isFixedSize:!0}}return Se}return xe});l(he)}},ge=(j,V,K,ue)=>{const ye=n.map(re=>re.id===j&&re.type==="text"?{...re,text:V,width:K,height:ue}:re);l(ye)},Oe=(j,V,K,ue)=>{if(!V){const re=n.find(he=>he.id===j&&he.type==="text");if(re&&re.text.trim()===""){const he=n.filter(xe=>xe.id!==j);l(he);return}}const ye=n.map(re=>re.id===j&&re.type==="text"?{...re,isEditing:V,isFixedSize:V?re.isFixedSize:!0}:re);if(l(ye),V&&K!==void 0&&ue!==void 0){const re=n.find(he=>he.id===j&&he.type==="text");if(re){const he=U_(re.text,K,re.fontSize,re.fontFamily,re.bold,re.italic,re.fontWeight);k.current=he}}else V&&(k.current=null)};X.useEffect(()=>{if(Y&&P.current)if(P.current.focus(),k.current!==null){const j=k.current;P.current.setSelectionRange(j,j),k.current=null}else{const j=P.current.value.length;P.current.setSelectionRange(j,j)}},[Y==null?void 0:Y.id]);const Ee=j=>{if(!Y)return;const V=j.target.value;try{const K=new Hr.Text({text:V||"M",fontSize:Y.fontSize,fontFamily:Y.fontFamily,fontStyle:v0(Y.bold,Y.italic,Y.fontWeight)}),ue=Math.max(100,K.width()+20),ye=Math.max(40,K.height()+10);K.destroy(),ge(Y.id,V,ue,ye)}catch(K){console.error("Error in textarea change:",K),ge(Y.id,V,Y.width,Y.height)}},We=()=>{Y&&Oe(Y.id,!1)},en=Y?(()=>{if(!Y||!x.current)return{top:0,left:0};const K=x.current.container().getBoundingClientRect();return{top:K.top+Y.y,left:K.left+Y.x}})():{top:0,left:0},ne=j=>{if(!j.isFixedSize||!j.text)return j.fontSize;try{const V=new Hr.Text({text:j.text,fontSize:j.fontSize,fontFamily:j.fontFamily,fontStyle:v0(j.bold,j.italic,j.fontWeight),width:j.width,height:j.height});let K=j.fontSize;const ue=j.width,ye=j.height;for(;K>10;){V.fontSize(K);const re=V.measureSize(j.text);if(re.width<=ue&&re.height<=ye)break;K-=1}return V.destroy(),K}catch{return j.fontSize}},oe=j=>{if(j.target!==j.target.getStage()||a)return;const V=j.target.getStage(),K=V==null?void 0:V.getPointerPosition();K&&(F.current=K,R({x:K.x,y:K.y,width:0,height:0}))},le=j=>{if(!F.current)return;const V=j.target.getStage(),K=V==null?void 0:V.getPointerPosition();if(K){const ue=F.current;R({x:Math.min(ue.x,K.x),y:Math.min(ue.y,K.y),width:Math.abs(K.x-ue.x),height:Math.abs(K.y-ue.y)})}},ve=j=>{if(!F.current)return;if(S&&(S.width>5||S.height>5)){const K=[];n.forEach(ue=>{const ye={x:ue.x,y:ue.y,width:ue.width,height:ue.height};!(S.x>ye.x+ye.width||S.x+S.widthye.y+ye.height||S.y+S.height0?s(K):s([])}else j.target===j.target.getStage()&&s([]);F.current=null,R(null)};return I.jsxs("div",{onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),style:{width:pe.width,height:pe.height,backgroundImage:$?`url(${Q})`:"none",backgroundColor:$?"transparent":"#ffffff",backgroundSize:"cover",backgroundPosition:"center",border:"1px solid #EBEBEB",borderRadius:b?"0px":"10px",boxShadow:"0 4px 6px -2px rgba(5, 32, 81, 0.04), 0 12px 16px -4px rgba(5, 32, 81, 0.09)",overflow:"visible",transition:"width 0.15s ease-in-out, height 0.15s ease-in-out, border-radius 0.15s ease-in-out"},children:[I.jsx(M_,{ref:x,width:pe.width,height:pe.height,onMouseDown:oe,onMouseMove:le,onMouseUp:ve,onClick:j=>{if(j.target===j.target.getStage()&&a&&c){const V=j.target.getStage(),K=V==null?void 0:V.getPointerPosition();K&&c(K.x,K.y)}},style:{cursor:a?"text":"default"},children:I.jsxs(N_,{children:[$?I.jsx(v4,{x:0,y:0,width:pe.width,height:pe.height,image:$,listening:!1}):I.jsx(to,{x:0,y:0,width:pe.width,height:pe.height,fill:"#ffffff",listening:!1}),me.map(j=>I.jsx(I_,{object:j,isSelected:r.includes(j.id),onSelect:V=>{var ue;const K=((ue=V==null?void 0:V.evt)==null?void 0:ue.shiftKey)||!1;ze(j.id,K)},onDragStart:vt,onDragMove:Ke,onDragEnd:D(j.id),onTransformEnd:Z(j.id),onEditingChange:Oe,onMouseEnter:()=>H(j.id),onMouseLeave:()=>H(null),shapeRef:V=>{V?E.current.set(j.id,V):E.current.delete(j.id)}},j.id)),S&&I.jsx(to,{x:S.x,y:S.y,width:S.width,height:S.height,fill:"rgba(63, 174, 230, 0.1)",stroke:"#3faee6",strokeWidth:1,dash:[5,5],listening:!1}),ie.vertical&&I.jsx(to,{x:pe.width/2,y:0,width:1,height:pe.height,fill:"#FF6B6B",listening:!1,opacity:.8}),ie.horizontal&&I.jsx(to,{x:0,y:pe.height/2,width:pe.width,height:1,fill:"#FF6B6B",listening:!1,opacity:.8}),M&&!r.includes(M)&&(()=>{const j=E.current.get(M);if(j){const V=j.getClientRect();return I.jsx(to,{x:V.x,y:V.y,width:V.width,height:V.height,stroke:"#3faee6",strokeWidth:1,dash:[4,4],listening:!1,opacity:.5})}return null})(),I.jsx(F_,{ref:v,keepRatio:!0,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],rotateEnabled:!0,anchorSize:8,anchorCornerRadius:2,borderStroke:"#3faee6",borderStrokeWidth:2,anchorStroke:"#3faee6",anchorFill:"#ffffff",anchorStrokeWidth:2,boundBoxFunc:(j,V)=>V.width<5||V.height<5?j:V})]})}),Y&&I.jsx("textarea",{ref:P,value:Y.text,onChange:Ee,onBlur:We,onKeyDown:j=>{j.key==="Escape"&&We()},style:{position:"fixed",top:`${en.top}px`,left:`${en.left}px`,width:`${Y.width}px`,height:`${Y.height}px`,fontSize:`${Y.isFixedSize?ne(Y):Y.fontSize}px`,fontFamily:Y.fontFamily,fontWeight:Y.bold?"bold":"normal",fontStyle:Y.italic?"italic":"normal",color:Y.fill,background:"transparent",border:"none",borderRadius:"0",padding:"0",margin:"0",resize:"none",outline:"none",overflow:"hidden",lineHeight:"1",verticalAlign:"top",zIndex:999,pointerEvents:"auto",boxSizing:"border-box"}})]})}function B_(){return I.jsx("div",{style:{width:"18px",height:"18px",borderRadius:"999px",border:"1px solid #e5e9ed",background:"linear-gradient(180deg, #ffffff 27.928%, #e7e9f5 100%)",overflow:"hidden"}})}function V_(){return I.jsx("div",{style:{width:"18px",height:"18px",borderRadius:"999px",border:"1px solid #e5e9ed",background:"linear-gradient(135deg, rgba(232, 199, 255, 0.8) 0%, rgba(173, 216, 255, 0.8) 100%)",overflow:"hidden"}})}function W_(){return I.jsx("div",{style:{width:"18px",height:"18px",borderRadius:"999px",border:"1px solid #e5e9ed",background:"linear-gradient(130.786deg, rgba(147, 28, 186, 1) 15.907%, rgba(26, 26, 48, 1) 52.739%, rgba(4, 107, 226, 1) 90.547%)",overflow:"hidden"}})}function b_({bgColor:t,onChange:e}){const[n,r]=X.useState(null);return I.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[I.jsx("span",{style:{color:"#999999",fontSize:"16px",fontWeight:"normal",fontFamily:"Inter, sans-serif"},children:"Background color:"}),I.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",height:"40px",padding:"4px",background:"#EDF0F2",border:"1px solid #F8F9FA",borderRadius:"99px"},children:[I.jsx("button",{onClick:()=>e("seriousLight"),onMouseEnter:()=>r("seriousLight"),onMouseLeave:()=>r(null),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"38px",height:"32px",padding:"10px",background:t==="seriousLight"?"#DEE2E7":n==="seriousLight"?"#f0f2f4":"transparent",border:"none",borderRadius:"99px",cursor:"pointer",transition:"background 0.15s ease-in-out"},title:"Serious Light background",children:I.jsx(B_,{})}),I.jsx("button",{onClick:()=>e("light"),onMouseEnter:()=>r("light"),onMouseLeave:()=>r(null),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"38px",height:"32px",padding:"10px",background:t==="light"?"#DEE2E7":n==="light"?"#f0f2f4":"transparent",border:"none",borderRadius:"99px",cursor:"pointer",transition:"background 0.15s ease-in-out"},title:"Light background with gradients",children:I.jsx(V_,{})}),I.jsx("button",{onClick:()=>e("dark"),onMouseEnter:()=>r("dark"),onMouseLeave:()=>r(null),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"38px",height:"32px",padding:"10px",background:t==="dark"?"#DEE2E7":n==="dark"?"#f0f2f4":"transparent",border:"none",borderRadius:"99px",cursor:"pointer",transition:"background 0.15s ease-in-out"},title:"Dark background",children:I.jsx(W_,{})})]})]})}function j_({selected:t=!1}){return I.jsx("div",{style:{position:"relative",width:"16px",height:"16px"},children:I.jsx("div",{style:{position:"absolute",inset:"4.17%",width:"calc(100% - 8.34%)",height:"calc(100% - 8.34%)"},children:I.jsx("img",{alt:"X",style:{display:"block",maxWidth:"none",width:"100%",height:"100%"},src:t?"/assets/sizes/Property 1=selected.svg":"/assets/sizes/Property 1=Default.svg"})})})}function K_({selected:t=!1}){const e=t?"/assets/sizes/Property 1=selected-1.svg":"/assets/sizes/Property 1=Default-1.svg";return I.jsx("div",{style:{position:"relative",width:"16px",height:"16px"},children:I.jsx("img",{alt:"LinkedIn",style:{display:"block",width:"100%",height:"100%"},src:e})})}function Y_({selected:t=!1}){const e=t?"/assets/sizes/Property 1=selected-2.svg":"/assets/sizes/Property 1=Default-2.svg";return I.jsx("div",{style:{position:"relative",width:"16px",height:"16px"},children:I.jsx("img",{alt:"HF",style:{display:"block",width:"100%",height:"100%"},src:e})})}const X_={"1200x675":"1200x675",linkedin:"1200x627",hf:"1160x580"};function $_({canvasSize:t,onChange:e}){const[n,r]=X.useState(null),s=(l,a,c)=>{const d=t===l,g=n===l;return I.jsxs("button",{onClick:()=>e(l),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null),style:{display:"flex",alignItems:"center",justifyContent:d?"flex-start":"center",gap:"5px",height:"32px",minWidth:"38px",paddingLeft:d?"10px":"9px",paddingRight:d?"10px":"9px",background:d?"#DEE2E7":g?"#f0f2f4":"transparent",border:"none",borderRadius:"99px",cursor:"pointer",transition:"background 0.15s ease-in-out, padding 0.15s ease-in-out, min-width 0.15s ease-in-out",overflow:"hidden"},title:c,children:[I.jsx(a,{selected:d}),I.jsx("span",{style:{color:"#32343d",fontSize:"16px",fontWeight:"normal",fontFamily:"Inter, sans-serif",whiteSpace:"nowrap",opacity:d?.6:0,transform:d?"translateX(0)":"translateX(-10px)",transition:"opacity 0.15s ease-in-out, transform 0.15s ease-in-out",width:d?"auto":"0",overflow:"hidden"},children:X_[l]})]})};return I.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[I.jsx("span",{style:{color:"#999999",fontSize:"16px",fontWeight:"normal",fontFamily:"Inter, sans-serif"},children:"Size:"}),I.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",height:"40px",padding:"4px",background:"#EDF0F2",border:"1px solid #F8F9FA",borderRadius:"99px"},children:[s("1200x675",j_,"1200×675 (Default)"),s("linkedin",K_,"LinkedIn size (1200x627)"),s("hf",Y_,"HF custom size (1160x580)")]})]})}function Q_({canvasSize:t,bgColor:e,onCanvasSizeChange:n,onBgColorChange:r}){return I.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px",transition:"all 0.15s ease-in-out"},children:[I.jsx(b_,{bgColor:e,onChange:r}),I.jsx($_,{canvasSize:t,onChange:n})]})}function q_({onKeep:t,onReplace:e,onCancel:n}){return I.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm",onClick:n,children:I.jsxs("div",{className:"bg-[#2b2d31] rounded-[12px] shadow-2xl max-w-[480px] w-full mx-4 overflow-hidden",onClick:r=>r.stopPropagation(),children:[I.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#3e4044]",children:[I.jsx("h2",{className:"text-white text-[18px] font-semibold",children:"Switch Layout"}),I.jsx("button",{onClick:n,className:"text-gray-400 hover:text-white transition-colors p-1 hover:bg-[#3e4044] rounded",children:I.jsx(w8,{size:20})})]}),I.jsxs("div",{className:"px-6 py-5",children:[I.jsx("p",{className:"text-gray-300 text-[15px] leading-relaxed mb-4",children:"You have custom objects on the canvas. What would you like to do?"}),I.jsxs("div",{className:"space-y-3",children:[I.jsx("div",{className:"bg-[#1e1f22] rounded-[8px] p-4 border border-[#3e4044]",children:I.jsxs("div",{className:"flex items-start gap-3",children:[I.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-[#5865f2] flex-shrink-0 mt-0.5"}),I.jsxs("div",{children:[I.jsx("p",{className:"text-white font-medium text-[14px] mb-1",children:"Keep my objects"}),I.jsx("p",{className:"text-gray-400 text-[13px]",children:"Add the new layout objects alongside your existing work"})]})]})}),I.jsx("div",{className:"bg-[#1e1f22] rounded-[8px] p-4 border border-[#3e4044]",children:I.jsxs("div",{className:"flex items-start gap-3",children:[I.jsx("div",{className:"w-5 h-5 rounded-full border-2 border-[#ed4245] flex-shrink-0 mt-0.5"}),I.jsxs("div",{children:[I.jsx("p",{className:"text-white font-medium text-[14px] mb-1",children:"Replace everything"}),I.jsx("p",{className:"text-gray-400 text-[13px]",children:"Remove all objects and load a fresh layout"})]})]})})]})]}),I.jsxs("div",{className:"px-6 py-4 bg-[#1e1f22] flex items-center justify-end gap-3",children:[I.jsx("button",{onClick:n,className:"px-4 py-2 rounded-[6px] text-white text-[14px] font-medium hover:bg-[#3e4044] transition-colors",children:"Cancel"}),I.jsx("button",{onClick:e,className:"px-4 py-2 rounded-[6px] bg-[#ed4245] text-white text-[14px] font-medium hover:bg-[#d13438] transition-colors",children:"Replace"}),I.jsx("button",{onClick:t,className:"px-4 py-2 rounded-[6px] bg-[#5865f2] text-white text-[14px] font-medium hover:bg-[#4752c4] transition-colors",children:"Keep"})]})]})})}function ff(t){const e=parseInt(t.slice(1,3),16)/255,n=parseInt(t.slice(3,5),16)/255,r=parseInt(t.slice(5,7),16)/255,s=Math.max(e,n,r),l=Math.min(e,n,r),a=s-l;let c=0;a!==0&&(s===e?c=((n-r)/a+(n{const _=Math.round(x*255).toString(16);return _.length===1?"0"+_:_};return`#${w(d)}${w(g)}${w(y)}`}function J_({color:t,onChange:e,onClose:n}){const r=ff(t),[s,l]=X.useState(r.h),[a,c]=X.useState(r.s),[d,g]=X.useState(r.v),[y,w]=X.useState(t.toUpperCase()),x=X.useRef(null),_=X.useRef(null),v=X.useRef(null),[E,P]=X.useState(!1),[k,C]=X.useState(!1),[p,S]=X.useState(!1),[R,F]=X.useState(!1);X.useEffect(()=>{if(!R){const U=Z_(s,a,d);w(U.toUpperCase()),e(U)}},[s,a,d,e,R]);const L=U=>{P(!0),N(U)},N=U=>{if(!x.current)return;const Q=x.current.getBoundingClientRect(),$=Math.max(0,Math.min(U.clientX-Q.left,Q.width)),Y=Math.max(0,Math.min(U.clientY-Q.top,Q.height));c($/Q.width*100),g(100-Y/Q.height*100)},z=U=>{C(!0),M(U)},M=U=>{if(!_.current)return;const Q=_.current.getBoundingClientRect(),$=Math.max(0,Math.min(U.clientX-Q.left,Q.width));l($/Q.width*360)},H=U=>{S(!0),b(U)},b=U=>{if(!v.current)return;const Q=v.current.getBoundingClientRect(),$=Math.max(0,Math.min(U.clientX-Q.left,Q.width));c($/Q.width*100)};X.useEffect(()=>{const U=$=>{E&&N($),k&&M($),p&&b($)},Q=()=>{P(!1),C(!1),S(!1)};if(E||k||p)return document.addEventListener("mousemove",U),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",Q)}},[E,k,p]);const q=U=>{F(!0);let Q=U.target.value.toUpperCase();if(Q.startsWith("#")||(Q="#"+Q),w(Q),/^#[0-9A-F]{6}$/i.test(Q)){const $=ff(Q);l($.h),c($.s),g($.v),e(Q),F(!1)}},ie=async()=>{if(!window.EyeDropper){alert("EyeDropper API is not supported in your browser. Please use Chrome or Edge.");return}try{const $=(await new window.EyeDropper().open()).sRGBHex,Y=ff($);l(Y.h),c(Y.s),g(Y.v),w($.toUpperCase()),e($)}catch{console.log("Eyedropper cancelled")}},ee=a/100*100,pe=(1-d/100)*100,Ce=s/360*100;return I.jsxs("div",{onMouseDown:U=>U.stopPropagation(),onClick:U=>U.stopPropagation(),style:{position:"absolute",bottom:"calc(100% + 8px)",right:0,width:"280px",backgroundColor:"#252525",border:"1px solid #1b1b1b",borderRadius:"8px",padding:"16px",boxShadow:"0 4px 6px -2px rgba(0, 0, 0, 0.1), 0 12px 16px -4px rgba(0, 0, 0, 0.17)",zIndex:1e3},children:[I.jsx("div",{ref:x,onMouseDown:L,style:{position:"relative",width:"100%",height:"112px",borderRadius:"8px",marginBottom:"16px",cursor:"crosshair",background:` + linear-gradient(to bottom, transparent, black), + linear-gradient(to right, white, transparent), + hsl(${s}, 100%, 50%) + `},children:I.jsx("div",{style:{position:"absolute",left:`${ee}%`,top:`${pe}%`,width:"12px",height:"12px",border:"2px solid white",borderRadius:"50%",transform:"translate(-50%, -50%)",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.3)",pointerEvents:"none"}})}),I.jsxs("div",{style:{display:"flex",gap:"10px",marginBottom:"16px"},children:[I.jsx("button",{onClick:ie,title:"Pick color from screen",style:{width:"24px",height:"24px",borderRadius:"4px",backgroundColor:"rgba(255, 255, 255, 0.05)",border:"1px solid rgba(255, 255, 255, 0.1)",flexShrink:0,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0},children:I.jsx(_8,{size:14,color:"white"})}),I.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[I.jsx("div",{ref:_,onMouseDown:z,style:{position:"relative",width:"100%",height:"12px",borderRadius:"100px",background:"linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",cursor:"pointer"},children:I.jsx("div",{style:{position:"absolute",left:`${Ce}%`,top:"50%",width:"12px",height:"12px",border:"2px solid white",borderRadius:"50%",transform:"translate(-50%, -50%)",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.3)",pointerEvents:"none"}})}),I.jsx("div",{ref:v,onMouseDown:H,style:{position:"relative",width:"100%",height:"12px",borderRadius:"100px",background:`linear-gradient(to right, white, hsl(${s}, 100%, 50%))`,cursor:"pointer"},children:I.jsx("div",{style:{position:"absolute",left:`${a}%`,top:"50%",width:"12px",height:"12px",border:"2px solid white",borderRadius:"50%",transform:"translate(-50%, -50%)",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.3)",pointerEvents:"none"}})})]})]}),I.jsxs("div",{style:{display:"flex",gap:"4px"},children:[I.jsx("div",{style:{padding:"8px",borderRadius:"8px",color:"#eeeeee",fontSize:"14px",fontFamily:"Inter, sans-serif",opacity:.8,width:"72px",textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center"},children:"Hex"}),I.jsx("input",{type:"text",value:y,onChange:q,onBlur:()=>F(!1),onKeyDown:U=>U.stopPropagation(),onKeyUp:U=>U.stopPropagation(),onKeyPress:U=>U.stopPropagation(),maxLength:7,style:{flex:1,padding:"8px 4px",backgroundColor:"#1b1b1b",border:"none",borderRadius:"6px",color:"#eeeeee",fontSize:"12px",fontFamily:"Inter, sans-serif",fontWeight:500,textAlign:"center",outline:"none"},onClick:U=>U.stopPropagation(),onMouseDown:U=>U.stopPropagation()})]})]})}function ew({fontFamily:t,fill:e,bold:n,italic:r,canvasWidth:s,canvasHeight:l,scale:a=1,stageRef:c,onFontFamilyChange:d,onFillChange:g,onBoldToggle:y,onItalicToggle:w,fontWeight:x="normal"}){const[_,v]=X.useState(!1),[E,P]=X.useState(!1),[k,C]=X.useState("down"),p=X.useRef(null),S=["Inter","IBM Plex Mono","Bison","Source Sans 3"],R={Inter:{bold:!0,italic:!0,black:!1},"IBM Plex Mono":{bold:!0,italic:!0,black:!1},Bison:{bold:!1,italic:!1,black:!1},"Source Sans 3":{bold:!0,italic:!0,black:!0}},F=R[t].bold,L=R[t].italic,N=R[t].black;X.useEffect(()=>{if(_&&p.current){const ie=p.current.getBoundingClientRect(),ee=S.length*40+8,pe=window.innerHeight-ie.bottom,Ce=ie.top;pepe?C("up"):C("down")}},[_,S.length]);const z=s*a,M=l*a,H=80*a,b=`calc((100vw - ${z}px) / 2)`,q=`calc((100vh - ${M}px - ${H}px) / 2 - 10px - 44px)`;return I.jsx("div",{className:"text-toolbar",onMouseDown:ie=>{ie.stopPropagation()},onClick:ie=>{ie.stopPropagation()},style:{position:"fixed",right:b,bottom:q,zIndex:100,backgroundColor:"#27272A",borderRadius:"8px",padding:"4px",boxShadow:"0 4px 6px -2px rgba(0, 0, 0, 0.1), 0 12px 16px -4px rgba(0, 0, 0, 0.17)",transition:"right 0.15s ease-in-out, bottom 0.15s ease-in-out"},children:I.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[I.jsxs("div",{style:{position:"relative"},children:[I.jsxs("button",{ref:p,onClick:()=>v(!_),style:{display:"flex",alignItems:"center",gap:"20px",padding:"8px",backgroundColor:"rgba(255, 255, 255, 0.05)",border:"none",borderRadius:"4px",color:"white",fontSize:"16px",fontFamily:"Source Sans Pro, sans-serif",cursor:"pointer",whiteSpace:"nowrap"},children:[t,I.jsx(y8,{size:14,style:{transform:_&&k==="up"?"rotate(180deg)":"none",transition:"transform 0.15s ease-in-out"}})]}),_&&I.jsx("div",{style:{position:"absolute",...k==="down"?{top:"calc(100% + 4px)"}:{bottom:"calc(100% + 4px)"},left:0,backgroundColor:"#27272A",border:"1px solid #09090B",borderRadius:"8px",padding:"4px",minWidth:"160px",zIndex:1e3},children:S.map(ie=>I.jsx("button",{onClick:()=>{d(ie),v(!1)},style:{display:"block",width:"100%",padding:"8px 12px",backgroundColor:t===ie?"rgba(255, 255, 255, 0.1)":"transparent",border:"none",borderRadius:"4px",color:"white",fontSize:"14px",fontFamily:ie,textAlign:"left",cursor:"pointer"},onMouseEnter:ee=>{t!==ie&&(ee.currentTarget.style.backgroundColor="rgba(255, 255, 255, 0.05)")},onMouseLeave:ee=>{t!==ie&&(ee.currentTarget.style.backgroundColor="transparent")},children:ie},ie))})]}),I.jsx("div",{style:{width:"1px",height:"18px",backgroundColor:"rgba(255, 255, 255, 0.2)"}}),I.jsxs("div",{style:{position:"relative"},children:[I.jsx("button",{onClick:()=>P(!E),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"10px",backgroundColor:"transparent",border:"none",borderRadius:"99px",cursor:"pointer"},children:I.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"999px",backgroundColor:e,border:"1px solid #e5e9ed"}})}),E&&I.jsx(J_,{color:e,onChange:g,onClose:()=>P(!1)})]}),I.jsxs("button",{onClick:F?y:void 0,disabled:!F,style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"8px",backgroundColor:n||x==="black"?"rgba(255, 255, 255, 0.1)":"transparent",border:"none",borderRadius:"4px",cursor:F?"pointer":"not-allowed",color:"white",opacity:F?1:.3},children:[I.jsx(m8,{size:20}),N&&x==="black"&&I.jsx("div",{style:{position:"absolute",bottom:"2px",right:"2px",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#3faee6"}})]}),I.jsx("button",{onClick:L?w:void 0,disabled:!L,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px",backgroundColor:r?"rgba(255, 255, 255, 0.1)":"transparent",border:"none",borderRadius:"4px",cursor:L?"pointer":"not-allowed",color:"white",opacity:L?1:.3},children:I.jsx(x8,{size:20})})]})})}const tw=50;function nw(){const[t,e]=X.useState([]),[n,r]=X.useState([]),[s,l]=X.useState("1200x675"),[a,c]=X.useState("seriousLight"),d=X.useRef([[]]),g=X.useRef(0),y=X.useRef(!1),w=X.useRef(!1),x=X.useCallback(L=>{e(L),!y.current&&setTimeout(()=>{if(w.current)return;g.currentb.map(q=>{if(q.type==="text"){const{isEditing:ie,isFixedSize:ee,...pe}=q;return pe}return q}),z=N(L),M=d.current[g.current]?N(d.current[g.current]):[];if(JSON.stringify(M)!==JSON.stringify(z)){const b=JSON.parse(JSON.stringify(z));console.log("Recording history:",{textObjects:b.filter(q=>q.type==="text").map(q=>({text:q.text,width:q.width,height:q.height,fontSize:q.fontSize}))}),d.current.push(b),g.current++,d.current.length>tw&&(d.current.shift(),g.current--)}},0)},[]),_=X.useCallback(()=>{if(g.current>0){y.current=!0,g.current--;const N=JSON.parse(JSON.stringify(d.current[g.current])).map(z=>{if(z.type==="text"&&z.text)try{const M=require("konva").default,H=new M.Text({text:z.text,fontSize:z.fontSize,fontFamily:z.fontFamily,fontStyle:`${z.bold?"bold":"normal"} ${z.italic?"italic":""}`}),b=Math.max(100,H.width()+20),q=Math.max(40,H.height()+10);return console.log("UNDO - Recalculating text:",{text:z.text,oldWidth:z.width,oldHeight:z.height,newWidth:b,newHeight:q,fontSize:z.fontSize,fontFamily:z.fontFamily}),H.destroy(),{...z,width:b,height:q,isEditing:!1}}catch(M){return console.error("Error recalculating text dimensions:",M),z}return z});e(N),r([]),setTimeout(()=>{y.current=!1},0)}},[]),v=X.useCallback(()=>{if(g.current{if(z.type==="text"&&z.text)try{const M=require("konva").default,H=new M.Text({text:z.text,fontSize:z.fontSize,fontFamily:z.fontFamily,fontStyle:`${z.bold?"bold":"normal"} ${z.italic?"italic":""}`}),b=Math.max(100,H.width()+20),q=Math.max(40,H.height()+10);return H.destroy(),{...z,width:b,height:q,isEditing:!1}}catch(M){return console.error("Error recalculating text dimensions:",M),z}return z});e(N),r([]),setTimeout(()=>{y.current=!1},0)}},[]),E=L=>{const N={...L,id:x4(),zIndex:y0(t)};x([...t,N]),r([N.id])},P=()=>{n.length>0&&(x(t.filter(L=>!n.includes(L.id))),r([]))},k=L=>{n.length>0&&x(t.map(N=>n.includes(N.id)?{...N,...L}:N))},C=L=>{const N=y0(t);x(t.map(z=>z.id===L?{...z,zIndex:N}:z))},p=L=>{const N=Math.min(...t.map(z=>z.zIndex));x(t.map(z=>z.id===L?{...z,zIndex:N-1}:z))},S=L=>{const N=t.find(H=>H.id===L);if(!N)return;const z=t.filter(H=>H.zIndex>N.zIndex);if(z.length===0)return;const M=Math.min(...z.map(H=>H.zIndex));x(t.map(H=>H.id===L?{...H,zIndex:M+.5}:H))},R=L=>{const N=t.find(H=>H.id===L);if(!N)return;const z=t.filter(H=>H.zIndexH.zIndex));x(t.map(H=>H.id===L?{...H,zIndex:M-.5}:H))},F=X.useCallback(L=>{w.current=L},[]);return{objects:t,selectedIds:n,canvasSize:s,bgColor:a,setObjects:x,setSelectedIds:r,setCanvasSize:l,setBgColor:c,addObject:E,deleteSelected:P,updateSelected:k,bringToFront:C,sendToBack:p,moveForward:S,moveBackward:R,undo:_,redo:v,setSkipHistoryRecording:F}}function rw(t,e){const[n,r]=X.useState(1),[s,l]=X.useState(!0);return X.useEffect(()=>{const a=()=>{const c=window.innerWidth,d=window.innerHeight,g=187,y=200,w=c-g,x=d-y,_=w/t,v=x/e,E=Math.min(_,v,1),P=E>=1;r(E),l(P)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[t,e]),{scale:n,canFit:s}}function S4(t,e,n,r){const s=t.map(l=>{const a=" ";let c=[`${a}{`,`${a} id: '${l.id}',`,`${a} type: '${l.type}',`,`${a} x: ${l.x},`,`${a} y: ${l.y},`,`${a} width: ${l.width},`,`${a} height: ${l.height},`,`${a} rotation: ${l.rotation},`,`${a} zIndex: ${l.zIndex},`];return l.type==="text"?(c.push(`${a} text: '${l.text}',`),c.push(`${a} fontSize: ${l.fontSize},`),c.push(`${a} fontFamily: '${l.fontFamily}',`),c.push(`${a} fill: '${l.fill}',`),c.push(`${a} bold: ${l.bold},`),c.push(`${a} italic: ${l.italic},`),l.align&&c.push(`${a} align: '${l.align}',`),l.isFixedSize&&c.push(`${a} isFixedSize: ${l.isFixedSize},`),l.fontWeight&&l.fontWeight!=="normal"&&c.push(`${a} fontWeight: '${l.fontWeight}',`)):l.type==="image"||l.type==="huggy"?(c.push(`${a} src: '${l.src}',`),c.push(`${a} name: '${l.name||"Untitled"}',`)):l.type==="rect"&&(c.push(`${a} fill: '${l.fill}',`),l.stroke&&c.push(`${a} stroke: '${l.stroke}',`),l.strokeWidth!==void 0&&c.push(`${a} strokeWidth: ${l.strokeWidth},`)),c.push(`${a}},`),c.join(` +`)}).join(` +`);return` ${e}: { + id: '${e}', + name: '${n}', + thumbnail: '${r}', + objects: [ +${s} + ], + },`}function iw(t){console.group("📐 Canvas Objects Export"),console.log(`Total objects: ${t.length}`),console.log("Object types:",t.map(n=>n.type).join(", ")),console.group("🔍 Individual Objects"),t.forEach((n,r)=>{console.group(`${r+1}. ${n.type.toUpperCase()}: ${n.id}`),console.log("Position:",{x:n.x,y:n.y}),console.log("Size:",{width:n.width,height:n.height}),console.log("Rotation:",n.rotation),console.log("Z-Index:",n.zIndex),n.type==="text"?(console.log("Text:",n.text),console.log("Font:",`${n.fontSize}px ${n.fontFamily}`),console.log("Color:",n.fill),console.log("Styles:",{bold:n.bold,italic:n.italic,fontWeight:n.fontWeight})):n.type==="image"||n.type==="huggy"?(console.log("Source:",n.src),console.log("Name:",n.name)):n.type==="rect"&&(console.log("Fill:",n.fill),n.stroke&&console.log("Stroke:",n.stroke)),console.log("Full object:",n),console.groupEnd()}),console.groupEnd(),console.group("📋 Ready for layouts.ts"),console.log("Use the following format:");const e=S4(t,"myNewLayout","My New Layout","/assets/layouts/myNewLayout_thumbnail.png");console.log(e),console.groupEnd(),console.groupEnd()}function ow(t){return JSON.stringify(t,null,2)}function sw(){const{objects:t,selectedIds:e,canvasSize:n,bgColor:r,setObjects:s,setSelectedIds:l,setCanvasSize:a,setBgColor:c,addObject:d,deleteSelected:g,undo:y,redo:w,setSkipHistoryRecording:x}=nw(),[_,v]=X.useState(!1),[E,P]=X.useState(null),[k,C]=X.useState(!1),[p,S]=X.useState(!1),[R,F]=X.useState(!1),[L,N]=X.useState(null),[z,M]=X.useState(null),H=X.useRef(null),b=X.useRef(null),q=X.useRef(null),ie=ne=>{const oe=ne.some(le=>le.type==="text"&&le.isEditing);x(oe),s(ne)},ee=ne=>{a(ne)},pe=dl(n),{scale:Ce}=rw(pe.width,pe.height),U=()=>{console.log("Layout clicked"),P(E==="layout"?null:"layout"),v(!1)},Q=()=>{console.log("Huggy clicked"),P(E==="huggy"?null:"huggy"),v(!1)},$=()=>{var ne;console.log("Image clicked"),(ne=H.current)==null||ne.click()},Y=()=>{E==="text"?(v(!1),P(null)):(v(!0),P("text"))},me=ne=>{if(!k2(ne))return;t.some(ve=>!ve.isFromLayout)?(N(ne),F(!0)):ze(ne,!1)},ze=(ne,oe)=>{const le=k2(ne);if(!le)return;const ve=t.length>0?Math.max(...t.map(V=>V.zIndex)):0,j=le.objects.map(V=>{const K={...V,id:`${V.id}-${Date.now()}`,isFromLayout:!0,zIndex:oe?V.zIndex-ve-100:V.zIndex};if(V.type==="text"&&V.text)try{const ue=new Hr.Text({text:V.text,fontSize:V.fontSize,fontFamily:V.fontFamily,fontStyle:`${V.bold?"bold":"normal"} ${V.italic?"italic":""}`}),ye=Math.max(100,ue.width()+20),re=Math.max(40,ue.height()+10);return ue.destroy(),{...K,width:Math.max(V.width,ye),height:Math.max(V.height,re)}}catch(ue){return console.error("Error recalculating layout text dimensions:",ue),K}return K});s(oe?[...j,...t]:j),M(ne),l([]),P(null)},Qe=()=>{L&&ze(L,!0),F(!1),N(null)},vt=()=>{L&&ze(L,!1),F(!1),N(null)},Ke=()=>{F(!1),N(null)},D=ne=>{const oe=dl(n),le=200,ve=Math.floor(Math.random()*200)-100,j=Math.floor(Math.random()*200)-100,V=oe.width/2-le/2,K=oe.height/2-le/2;d({type:"image",x:V+ve,y:K+j,width:le,height:le,src:ne.thumbnail,rotation:0,isFromLayout:!1}),P(null)},Z=(ne,oe)=>{d({type:"text",x:ne,y:oe,width:100,height:80,rotation:0,text:"",fontSize:68,fontFamily:"Inter",fill:"#000000",bold:!1,italic:!1,isFixedSize:!1,isEditing:!1}),v(!1),P(null)},ge=(ne,oe,le)=>{if(!["image/png","image/jpeg","image/jpg","image/webp"].includes(ne.type)){alert("Please upload a valid image file (PNG, JPG, or WebP)");return}const j=10*1024*1024;if(ne.size>j){alert("File size must be less than 10MB");return}const V=new FileReader;V.onload=K=>{var re;const ue=(re=K.target)==null?void 0:re.result,ye=new Image;ye.onload=()=>{const he=dl(n);let xe=ye.width,Se=ye.height;const He=Math.max(he.width,he.height),be=Math.max(xe,Se);if(be>He){const xn=He*.5/be;xe=xe*xn,Se=Se*xn}let wt,Ht;if(oe!==void 0&&le!==void 0)wt=oe-xe/2,Ht=le-Se/2;else{const Nn=Math.floor(Math.random()*200)-100,xn=Math.floor(Math.random()*200)-100;wt=he.width/2-xe/2+Nn,Ht=he.height/2-Se/2+xn}d({type:"image",x:wt,y:Ht,width:xe,height:Se,src:ue,rotation:0,isFromLayout:!1})},ye.src=ue},V.readAsDataURL(ne)},Oe=ne=>{var le;const oe=(le=ne.target.files)==null?void 0:le[0];oe&&ge(oe),ne.target.value=""},Ee=ne=>{ne.preventDefault(),C(!0)},We=ne=>{ne.preventDefault(),C(!1)},Xe=ne=>{var le;ne.preventDefault(),C(!1);const oe=(le=ne.dataTransfer.files)==null?void 0:le[0];if(oe){const ve=document.querySelector(".canvas-container");if(ve){const j=ve.querySelector(".konvajs-content");if(j){const V=j.getBoundingClientRect(),K=ne.clientX-V.left,ue=ne.clientY-V.top;if(K>=0&&K<=V.width&&ue>=0&&ue<=V.height){ge(oe,K,ue);return}}}ge(oe)}},en=async ne=>{if(!b.current){console.error("Stage ref not available");return}S(!0);try{const oe=e;l([]),await new Promise(K=>setTimeout(K,50));const le=b.current,ve=window.devicePixelRatio||1,j=le.toDataURL({mimeType:"image/png",quality:1,pixelRatio:ve}),V=document.createElement("a");V.download=`${ne}.png`,V.href=j,document.body.appendChild(V),V.click(),document.body.removeChild(V),l(oe)}catch(oe){console.error("Error exporting canvas:",oe),alert("Failed to export canvas. Please try again.")}finally{S(!1)}};return X.useEffect(()=>{const ne=oe=>{const le=document.querySelector(".canvas-container"),ve=document.querySelector(".text-toolbar"),j=le&&le.contains(oe.target),V=ve&&ve.contains(oe.target);!j&&!V&&e.length>0&&l([])};return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[e,l]),X.useEffect(()=>{const ne=oe=>{if(!E)return;const le=document.querySelector(".sidebar-container"),ve=document.querySelector(".layout-selector"),j=document.querySelector(".huggy-menu"),V=document.querySelector(".text-hint"),K=document.querySelector(".canvas-container");if(K&&K.contains(oe.target)&&_)return;const ye=le&&!le.contains(oe.target),re=!ve||!ve.contains(oe.target),he=!j||!j.contains(oe.target),xe=!V||!V.contains(oe.target);ye&&re&&he&&xe&&(P(null),v(!1))};return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[E,_]),X.useEffect(()=>(window.exportCanvas={log:()=>iw(t),asLayout:(ne,oe,le)=>{const ve=S4(t,ne,oe,le);return console.log("📋 Copy this to layouts.ts:"),console.log(ve),ve},asJSON:()=>{const ne=ow(t);return console.log("📋 JSON Export:"),console.log(ne),ne},objects:()=>t,info:()=>({objectCount:t.length,canvasSize:n,dimensions:pe,bgColor:r,selectedIds:e})},t.length===0&&(console.log("🎨 Canvas Export Utilities loaded! Use these commands:"),console.log(" • exportCanvas.log() - View all objects in detail"),console.log(" • exportCanvas.asLayout(id, name, thumbnail) - Export as layout definition"),console.log(" • exportCanvas.asJSON() - Export as JSON"),console.log(" • exportCanvas.objects() - Get raw objects array"),console.log(" • exportCanvas.info() - Get canvas info")),()=>{delete window.exportCanvas}),[t,n,pe,r,e]),X.useEffect(()=>{const ne=oe=>{const le=t.some(ve=>ve.type==="text"&&ve.isEditing);if((oe.ctrlKey||oe.metaKey)&&oe.key.toLowerCase()==="z"&&!oe.shiftKey&&!le){oe.preventDefault(),y();return}if((oe.ctrlKey||oe.metaKey)&&(oe.key.toLowerCase()==="z"&&oe.shiftKey||oe.key.toLowerCase()==="y")&&!le){oe.preventDefault(),w();return}if(!le&&e.length>0&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(oe.key)){oe.preventDefault();const ve=oe.shiftKey?10:1,j=t.map(V=>{if(e.includes(V.id)){let K=V.x,ue=V.y;switch(oe.key){case"ArrowUp":ue-=ve;break;case"ArrowDown":ue+=ve;break;case"ArrowLeft":K-=ve;break;case"ArrowRight":K+=ve;break}return{...V,x:K,y:ue}}return V});s(j);return}if((oe.key==="Delete"||oe.key==="Backspace")&&e.length>0&&!le&&(oe.preventDefault(),g()),(oe.ctrlKey||oe.metaKey)&&oe.key.toLowerCase()==="d"&&e.length>0&&!le){oe.preventDefault();const ve=t.filter(K=>e.includes(K.id)),j=20,V=ve.map(K=>({...K,id:x4(),x:K.x+j,y:K.y+j,zIndex:y0(t),isFromLayout:!1}));s([...t,...V]),l(V.map(K=>K.id))}if(e.length>0&&!le){if(oe.key==="]"){oe.preventDefault();const ve=m0(t),j=ve.map((K,ue)=>e.includes(K.id)?ue:-1).filter(K=>K!==-1);if(Math.max(...j)=0;ye--){const re=j[ye];re({...ye,zIndex:re}));s(ue)}return}if(oe.key==="["){oe.preventDefault();const ve=m0(t),j=ve.map((K,ue)=>e.includes(K.id)?ue:-1).filter(K=>K!==-1);if(Math.min(...j)>0){const K=[...ve];for(let ye=0;ye0&&([K[re],K[re-1]]=[K[re-1],K[re]])}const ue=K.map((ye,re)=>({...ye,zIndex:re}));s(ue)}return}}if(oe.key==="t"||oe.key==="T"){const ve=oe.target;ve.tagName!=="INPUT"&&ve.tagName!=="TEXTAREA"&&Y()}};return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[e,g,t,s,y,w]),I.jsxs("div",{className:"w-full h-full bg-[#F8F9FB] relative dotted-background",style:{overflow:"visible"},onDragOver:Ee,onDragLeave:We,onDrop:Xe,children:[I.jsx("input",{ref:H,type:"file",accept:"image/png,image/jpeg,image/jpg,image/webp",onChange:Oe,style:{display:"none"}}),k&&I.jsx("div",{className:"absolute inset-0 z-50 bg-blue-500 bg-opacity-10 border-4 border-dashed border-blue-500 flex items-center justify-center pointer-events-none",children:I.jsx("div",{className:"bg-white rounded-lg shadow-lg px-8 py-6",children:I.jsx("p",{className:"text-xl font-semibold text-gray-800",children:"Drop your image anywhere to upload"})})}),I.jsx(f8,{onLayoutClick:U,onHuggyClick:Q,onImageClick:$,onTextClick:Y,onSelectLayout:me,onSelectHuggy:D,activeButton:E}),I.jsx(C8,{onExport:en,isExporting:p,currentLayout:z,canvasSize:n}),I.jsxs(k8,{scale:Ce,children:[I.jsx(Q_,{canvasSize:n,bgColor:r,onCanvasSizeChange:ee,onBgColorChange:c}),I.jsx(G_,{canvasSize:n,bgColor:r,objects:t,selectedIds:e,onSelect:l,onObjectsChange:ie,textCreationMode:_,onTextCreate:Z,stageRef:b,transformerRef:q,scale:Ce})]}),R&&I.jsx(q_,{onKeep:Qe,onReplace:vt,onCancel:Ke}),(()=>{const ne=t.filter(re=>re.type==="text"&&(e.includes(re.id)||re.isEditing));if(!(_||ne.length>0))return null;const le=ne[0],ve=(le==null?void 0:le.fontFamily)||"Inter",j=(le==null?void 0:le.fill)||"#000000",V=(le==null?void 0:le.bold)??!1,K=(le==null?void 0:le.italic)??!1,ue=(le==null?void 0:le.fontWeight)||"normal",ye=dl(n);return I.jsx(ew,{fontFamily:ve,fontSize:(le==null?void 0:le.fontSize)||68,fill:j,bold:V,italic:K,fontWeight:ue,canvasWidth:ye.width,canvasHeight:ye.height,scale:Ce,stageRef:b,onFontFamilyChange:re=>{const he=t.map(xe=>{if(xe.type==="text"&&ne.some(Se=>Se.id===xe.id))try{const Se=new Hr.Text({text:xe.text||"M",fontSize:xe.fontSize,fontFamily:re,fontStyle:`${xe.bold?"bold":"normal"} ${xe.italic?"italic":""}`}),He=Math.max(100,Se.width()+20),be=Math.max(40,Se.height()+10);return Se.destroy(),{...xe,fontFamily:re,width:He,height:be}}catch(Se){return console.error("Error recalculating text size:",Se),{...xe,fontFamily:re}}return xe});s(he)},onFillChange:re=>{const he=t.map(xe=>xe.type==="text"&&ne.some(Se=>Se.id===xe.id)?{...xe,fill:re}:xe);s(he)},onBoldToggle:()=>{const re=t.map(he=>{if(he.type==="text"&&ne.some(xe=>xe.id===he.id)){const xe=he.fontFamily==="Source Sans 3",Se=he.fontWeight||"normal";let He=he.bold,be="normal";xe?Se==="normal"&&!he.bold?(He=!0,be="bold"):Se==="bold"||he.bold&&Se==="normal"?(He=!0,be="black"):(He=!1,be="normal"):(He=!he.bold,be=He?"bold":"normal");try{const wt=be==="black"?"900":be==="bold"?"bold":"normal",Ht=new Hr.Text({text:he.text||"M",fontSize:he.fontSize,fontFamily:he.fontFamily,fontStyle:`${he.italic?"italic":"normal"}`,fontVariant:wt}),Nn=Math.max(100,Ht.width()+20),xn=Math.max(40,Ht.height()+10);return Ht.destroy(),{...he,bold:He,fontWeight:be,width:Nn,height:xn}}catch(wt){return console.error("Error recalculating text size:",wt),{...he,bold:He,fontWeight:be}}}return he});s(re)},onItalicToggle:()=>{const re=t.map(he=>{if(he.type==="text"&&ne.some(xe=>xe.id===he.id)){const xe=!he.italic;try{const Se=new Hr.Text({text:he.text||"M",fontSize:he.fontSize,fontFamily:he.fontFamily,fontStyle:`${he.bold?"bold":"normal"} ${xe?"italic":""}`}),He=Math.max(100,Se.width()+20),be=Math.max(40,Se.height()+10);return Se.destroy(),{...he,italic:xe,width:He,height:be}}catch(Se){return console.error("Error recalculating text size:",Se),{...he,italic:xe}}}return he});s(re)}})})()]})}N5(document.getElementById("root")).render(I.jsx(X.StrictMode,{children:I.jsx(sw,{})}));