mjpic 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -156,7 +156,7 @@ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}
|
|
|
156
156
|
*
|
|
157
157
|
* This source code is licensed under the MIT license found in the
|
|
158
158
|
* LICENSE file in the root directory of this source tree.
|
|
159
|
-
*/var W2;function z3(){if(W2)return bf;W2=1;var n=Pl();function r(x,R){return x===R&&(x!==0||1/x===1/R)||x!==x&&R!==R}var o=typeof Object.is=="function"?Object.is:r,l=n.useState,c=n.useEffect,u=n.useLayoutEffect,d=n.useDebugValue;function f(x,R){var w=R(),_=l({inst:{value:w,getSnapshot:R}}),b=_[0].inst,E=_[1];return u(function(){b.value=w,b.getSnapshot=R,g(b)&&E({inst:b})},[x,w,R]),c(function(){return g(b)&&E({inst:b}),x(function(){g(b)&&E({inst:b})})},[x]),d(w),w}function g(x){var R=x.getSnapshot;x=x.value;try{var w=R();return!o(x,w)}catch{return!0}}function m(x,R){return R()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:f;return bf.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:y,bf}var K2;function M3(){return K2||(K2=1,Ef.exports=z3()),Ef.exports}var O3=M3();const I3=(n,r)=>Sa(r)?r:_3(r)&&Sa(r.defaultValue)?r.defaultValue:Array.isArray(n)?n[n.length-1]:n,j3={t:I3,ready:!1},U3=()=>()=>{},Dl=(n,r={})=>{var U,I,V;const{i18n:o}=r,{i18n:l,defaultNS:c}=q.useContext(L3)||{},u=o||l||N3();u&&!u.reportNamespaces&&(u.reportNamespaces=new T3),u||cm(u,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const d=q.useMemo(()=>{var J;return{...P3(),...(J=u==null?void 0:u.options)==null?void 0:J.react,...r}},[u,r]),{useSuspense:f,keyPrefix:g}=d,m=c||((U=u==null?void 0:u.options)==null?void 0:U.defaultNS),y=Sa(m)?[m]:m||["translation"],x=q.useMemo(()=>y,y);(V=(I=u==null?void 0:u.reportNamespaces)==null?void 0:I.addUsedNamespaces)==null||V.call(I,x);const R=q.useRef(0),w=q.useCallback(J=>{if(!u)return U3;const{bindI18n:A,bindI18nStore:M}=d,T=()=>{R.current+=1,J()};return A&&u.on(A,T),M&&u.store.on(M,T),()=>{A&&A.split(" ").forEach(H=>u.off(H,T)),M&&M.split(" ").forEach(H=>u.store.off(H,T))}},[u,d]),_=q.useRef(),b=q.useCallback(()=>{if(!u)return j3;const J=!!(u.isInitialized||u.initializedStoreOnce)&&x.every(X=>k3(X,u,d)),A=r.lng||u.language,M=R.current,T=_.current;if(T&&T.ready===J&&T.lng===A&&T.keyPrefix===g&&T.revision===M)return T;const G={t:u.getFixedT(A,d.nsMode==="fallback"?x:x[0],g),ready:J,lng:A,keyPrefix:g,revision:M};return _.current=G,G},[u,x,g,d,r.lng]),[E,z]=q.useState(0),{t:F,ready:k}=O3.useSyncExternalStore(w,b,b);q.useEffect(()=>{if(u&&!k&&!f){const J=()=>z(A=>A+1);r.lng?V2(u,r.lng,x,J):ep(u,x,J)}},[u,r.lng,x,k,f,E]);const N=u||{},L=q.useRef(null),j=q.useRef(),Y=J=>{const A=Object.getOwnPropertyDescriptors(J);A.__original&&delete A.__original;const M=Object.create(Object.getPrototypeOf(J),A);if(!Object.prototype.hasOwnProperty.call(M,"__original"))try{Object.defineProperty(M,"__original",{value:J,writable:!1,enumerable:!1,configurable:!1})}catch{}return M},O=q.useMemo(()=>{const J=N,A=J==null?void 0:J.language;let M=J;J&&(L.current&&L.current.__original===J?j.current!==A?(M=Y(J),L.current=M,j.current=A):M=L.current:(M=Y(J),L.current=M,j.current=A));const T=[F,M,k];return T.t=F,T.i18n=M,T.ready=k,T},[F,N,k,N.resolvedLanguage,N.language,N.languages]);if(u&&f&&!k)throw new Promise(J=>{const A=()=>J();r.lng?V2(u,r.lng,x,A):ep(u,x,A)});return O},B3=({isOpen:n,onClose:r,onConfirm:o,defaultPath:l,defaultFileName:c})=>{const{t:u}=Dl(),[d,f]=q.useState("image/jpeg"),[g,m]=q.useState(85),[y,x]=q.useState(""),[R,w]=q.useState("");return q.useEffect(()=>{if(n){f("image/jpeg"),m(85);const _={"image/jpeg":".jpg"},b=u("common.copySuffix",{defaultValue:"_copy"}),E=_["image/jpeg"];if(l){const z=l.replace(/\.[^/.]+$/,"");x(`${z}${b}${E}`),w("")}else{const z=c?c.replace(/\.[^/.]+$/,""):"image";w(`${z}${b}${E}`),x("")}}},[n,l,c,u]),q.useEffect(()=>{const b={"image/jpeg":".jpg","image/png":".png","image/webp":".webp"}[d];b&&(y&&x(E=>E.replace(/\.[^/.]+$/,b)),R&&w(E=>E.replace(/\.[^/.]+$/,b)))},[d]),n?Z.jsx("div",{"trae-inspector-start-line":"70","trae-inspector-start-column":"4","trae-inspector-end-line":"148","trae-inspector-end-column":"10","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:Z.jsxs("div",{"trae-inspector-start-line":"71","trae-inspector-start-column":"6","trae-inspector-end-line":"147","trae-inspector-end-column":"12","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"bg-zinc-900 border border-zinc-800 rounded-lg shadow-xl w-96 p-4",children:[Z.jsxs("div",{"trae-inspector-start-line":"72","trae-inspector-start-column":"8","trae-inspector-end-line":"77","trae-inspector-end-column":"14","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex justify-between items-center mb-4",children:[Z.jsx("h3",{"trae-inspector-start-line":"73","trae-inspector-start-column":"10","trae-inspector-end-line":"73","trae-inspector-end-column":"85","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-zinc-100 font-semibold",children:u("common.saveSettings")}),Z.jsx("button",{"trae-inspector-start-line":"74","trae-inspector-start-column":"10","trae-inspector-end-line":"76","trae-inspector-end-column":"19","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:r,className:"text-zinc-400 hover:text-white",children:Z.jsx(sm,{size:18})})]}),Z.jsxs("div",{"trae-inspector-start-line":"79","trae-inspector-start-column":"8","trae-inspector-end-line":"146","trae-inspector-end-column":"14","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-4",children:[l?Z.jsxs("div",{"trae-inspector-start-line":"81","trae-inspector-start-column":"13","trae-inspector-end-line":"89","trae-inspector-end-column":"19","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-2",children:[Z.jsx("label",{"trae-inspector-start-line":"82","trae-inspector-start-column":"16","trae-inspector-end-line":"82","trae-inspector-end-column":"93","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-xs text-zinc-400 block",children:u("common.savePath")}),Z.jsx("input",{"trae-inspector-start-line":"83","trae-inspector-start-column":"16","trae-inspector-end-line":"88","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",type:"text",value:y,onChange:_=>x(_.target.value),className:"w-full bg-zinc-800 text-zinc-100 p-2 rounded border border-zinc-700 outline-none text-sm font-mono"})]}):Z.jsxs("div",{"trae-inspector-start-line":"91","trae-inspector-start-column":"13","trae-inspector-end-line":"99","trae-inspector-end-column":"19","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-2",children:[Z.jsx("label",{"trae-inspector-start-line":"92","trae-inspector-start-column":"16","trae-inspector-end-line":"92","trae-inspector-end-column":"93","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-xs text-zinc-400 block",children:u("common.fileName")}),Z.jsx("input",{"trae-inspector-start-line":"93","trae-inspector-start-column":"16","trae-inspector-end-line":"98","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",type:"text",value:R,onChange:_=>w(_.target.value),className:"w-full bg-zinc-800 text-zinc-100 p-2 rounded border border-zinc-700 outline-none text-sm"})]}),Z.jsxs("div",{"trae-inspector-start-line":"102","trae-inspector-start-column":"10","trae-inspector-end-line":"113","trae-inspector-end-column":"16","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-2",children:[Z.jsx("label",{"trae-inspector-start-line":"103","trae-inspector-start-column":"12","trae-inspector-end-line":"103","trae-inspector-end-column":"87","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-xs text-zinc-400 block",children:u("common.format")}),Z.jsxs("select",{"trae-inspector-start-line":"104","trae-inspector-start-column":"12","trae-inspector-end-line":"112","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",value:d,onChange:_=>f(_.target.value),className:"w-full bg-zinc-800 text-zinc-100 p-2 rounded border border-zinc-700 outline-none text-sm",children:[Z.jsx("option",{"trae-inspector-start-line":"109","trae-inspector-start-column":"14","trae-inspector-end-line":"109","trae-inspector-end-column":"53","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22text%22%3A%22JPG%22%2C%22textStartLine%22%3A%22109%22%2C%22textStartColumn%22%3A%2241%22%2C%22textEndLine%22%3A%22109%22%2C%22textEndColumn%22%3A%2244%22%2C%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",value:"image/jpeg",children:"JPG"}),Z.jsx("option",{"trae-inspector-start-line":"110","trae-inspector-start-column":"14","trae-inspector-end-line":"110","trae-inspector-end-column":"52","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22text%22%3A%22PNG%22%2C%22textStartLine%22%3A%22110%22%2C%22textStartColumn%22%3A%2240%22%2C%22textEndLine%22%3A%22110%22%2C%22textEndColumn%22%3A%2243%22%2C%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",value:"image/png",children:"PNG"}),Z.jsx("option",{"trae-inspector-start-line":"111","trae-inspector-start-column":"14","trae-inspector-end-line":"111","trae-inspector-end-column":"54","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22text%22%3A%22WEBP%22%2C%22textStartLine%22%3A%22111%22%2C%22textStartColumn%22%3A%2241%22%2C%22textEndLine%22%3A%22111%22%2C%22textEndColumn%22%3A%2245%22%2C%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",value:"image/webp",children:"WEBP"})]})]}),d!=="image/png"&&Z.jsxs("div",{"trae-inspector-start-line":"116","trae-inspector-start-column":"12","trae-inspector-end-line":"129","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-2",children:[Z.jsxs("div",{"trae-inspector-start-line":"117","trae-inspector-start-column":"14","trae-inspector-end-line":"120","trae-inspector-end-column":"20","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex justify-between text-xs text-zinc-400",children:[Z.jsx("span",{"trae-inspector-start-line":"118","trae-inspector-start-column":"16","trae-inspector-end-line":"118","trae-inspector-end-column":"50","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",children:u("common.quality")}),Z.jsx("span",{"trae-inspector-start-line":"119","trae-inspector-start-column":"16","trae-inspector-end-line":"119","trae-inspector-end-column":"38","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",children:g})]}),Z.jsx("input",{"trae-inspector-start-line":"121","trae-inspector-start-column":"14","trae-inspector-end-line":"128","trae-inspector-end-column":"16","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",type:"range",min:"1",max:"100",value:g,onChange:_=>m(parseInt(_.target.value)),className:"w-full h-1 bg-zinc-700 rounded-lg appearance-none cursor-pointer accent-blue-500"})]}),Z.jsxs("div",{"trae-inspector-start-line":"132","trae-inspector-start-column":"10","trae-inspector-end-line":"145","trae-inspector-end-column":"16","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex gap-2 mt-6",children:[Z.jsx("button",{"trae-inspector-start-line":"133","trae-inspector-start-column":"12","trae-inspector-end-line":"138","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:r,className:"flex-1 px-3 py-2 rounded bg-zinc-800 hover:bg-zinc-700 text-zinc-300 text-sm transition-colors",children:u("common.cancel")}),Z.jsx("button",{"trae-inspector-start-line":"139","trae-inspector-start-column":"12","trae-inspector-end-line":"144","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:()=>o(d,g,y,R),className:"flex-1 px-3 py-2 rounded bg-blue-600 hover:bg-blue-500 text-white text-sm transition-colors",children:u("common.confirm")})]})]})]})}):null},G3=({stageRef:n})=>{const{undo:r,redo:o,loadImage:l,fileName:c}=bl(),{t:u,i18n:d}=Dl(),[f,g]=q.useState(!1),[m,y]=q.useState(void 0),x=async()=>{if(n.current){try{const b=await fetch("/api/current-image"),E=b.ok?await b.json():null;E&&E.path?y(E.path):y(void 0)}catch{y(void 0)}g(!0)}},R=async(b,E,z,F)=>{if(g(!1),!!n.current)try{const{previewImage:k,config:N,originalWidth:L,originalHeight:j}=bl.getState();if(!k){console.error("No image found to save");return}let Y=L||800,O=j||600;N.resize&&N.resize.width>0&&N.resize.height>0&&(Y=N.resize.width,O=N.resize.height);const U=document.createElement("canvas");U.width=Y,U.height=O;const I=U.getContext("2d");if(!I){console.error("Failed to create canvas context");return}I.imageSmoothingEnabled=!0,I.imageSmoothingQuality="high";const V=new Image;V.crossOrigin="anonymous",await new Promise((A,M)=>{V.onload=()=>{I.drawImage(V,0,0,Y,O),A()},V.onerror=M,V.src=k});const J=U.toDataURL(b,E/100);if(z)if((await fetch("/api/image/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:J,filePath:z})})).ok)alert(u("common.saveSuccess"));else throw new Error("Save API failed");else{const A=document.createElement("a");A.download=F||"mjpic-edit.png",A.href=J,document.body.appendChild(A),A.click(),document.body.removeChild(A)}}catch(k){console.error("Save failed:",k),alert("Failed to save image.")}},w=async()=>{const b=document.createElement("input");b.type="file",b.accept="image/*",b.onchange=E=>{var F;const z=(F=E.target.files)==null?void 0:F[0];if(z){const k=URL.createObjectURL(z);l(k,z.name,z.name)}},b.click()},_=()=>{const b=d.language==="en"?"zh":"en";d.changeLanguage(b)};return Z.jsxs("div",{"trae-inspector-start-line":"142","trae-inspector-start-column":"4","trae-inspector-end-line":"179","trae-inspector-end-column":"10","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"h-12 bg-zinc-900 border-b border-zinc-800 flex items-center px-4 justify-between z-20 shrink-0",children:[Z.jsxs("div",{"trae-inspector-start-line":"143","trae-inspector-start-column":"6","trae-inspector-end-line":"153","trae-inspector-end-column":"12","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex items-center gap-4",children:[Z.jsx("h1",{"trae-inspector-start-line":"144","trae-inspector-start-column":"8","trae-inspector-end-line":"144","trae-inspector-end-column":"87","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-zinc-100 font-bold text-lg mr-4",children:u("common.appName")}),Z.jsxs("div",{"trae-inspector-start-line":"145","trae-inspector-start-column":"8","trae-inspector-end-line":"152","trae-inspector-end-column":"14","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex items-center gap-2",children:[Z.jsxs("button",{"trae-inspector-start-line":"146","trae-inspector-start-column":"12","trae-inspector-end-line":"148","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:w,className:"px-3 py-1.5 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 text-sm flex items-center gap-1 transition-colors",children:[Z.jsx(by,{size:16})," ",u("common.open")]}),Z.jsxs("button",{"trae-inspector-start-line":"149","trae-inspector-start-column":"12","trae-inspector-end-line":"151","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:x,className:"px-3 py-1.5 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 text-sm flex items-center gap-1 transition-colors",children:[Z.jsx(By,{size:16})," ",u("common.save")]})]})]}),Z.jsxs("div",{"trae-inspector-start-line":"155","trae-inspector-start-column":"6","trae-inspector-end-line":"170","trae-inspector-end-column":"12","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex items-center gap-1",children:[Z.jsxs("button",{"trae-inspector-start-line":"156","trae-inspector-start-column":"9","trae-inspector-end-line":"163","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:_,className:"px-3 py-1.5 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 text-sm flex items-center gap-1 transition-colors mr-2",title:d.language==="en"?"Switch to Chinese":"Switch to English",children:[Z.jsx(Dy,{size:16}),d.language==="en"?"中文":"English"]}),Z.jsx("button",{"trae-inspector-start-line":"164","trae-inspector-start-column":"9","trae-inspector-end-line":"166","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:r,className:"p-2 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 transition-colors",title:u("common.undo"),children:Z.jsx($y,{size:18})}),Z.jsx("button",{"trae-inspector-start-line":"167","trae-inspector-start-column":"9","trae-inspector-end-line":"169","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:o,className:"p-2 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 transition-colors",title:u("common.redo"),children:Z.jsx(My,{size:18})})]}),Z.jsx(B3,{isOpen:f,onClose:()=>g(!1),onConfirm:R,defaultPath:m,defaultFileName:c||void 0})]})},yp=vp(n=>({activeTool:"enhance",isStraightenToolActive:!1,setActiveTool:r=>n({activeTool:r,isStraightenToolActive:!1}),setStraightenToolActive:r=>n({isStraightenToolActive:r})}));function hm(n){var r,o,l="";if(typeof n=="string"||typeof n=="number")l+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(r=0;r<c;r++)n[r]&&(o=hm(n[r]))&&(l&&(l+=" "),l+=o)}else for(o in n)n[o]&&(l&&(l+=" "),l+=o);return l}function H3(){for(var n,r,o=0,l="",c=arguments.length;o<c;o++)(n=arguments[o])&&(r=hm(n))&&(l&&(l+=" "),l+=r);return l}const V3=(n,r)=>{const o=new Array(n.length+r.length);for(let l=0;l<n.length;l++)o[l]=n[l];for(let l=0;l<r.length;l++)o[n.length+l]=r[l];return o},W3=(n,r)=>({classGroupId:n,validator:r}),fm=(n=new Map,r=null,o)=>({nextPart:n,validators:r,classGroupId:o}),vh="-",q2=[],K3="arbitrary..",q3=n=>{const r=X3(n),{conflictingClassGroups:o,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return Y3(d);const f=d.split(vh),g=f[0]===""&&f.length>1?1:0;return pm(f,g,r)},getConflictingClassGroupIds:(d,f)=>{if(f){const g=l[d],m=o[d];return g?m?V3(m,g):g:m||q2}return o[d]||q2}}},pm=(n,r,o)=>{if(n.length-r===0)return o.classGroupId;const c=n[r],u=o.nextPart.get(c);if(u){const m=pm(n,r+1,u);if(m)return m}const d=o.validators;if(d===null)return;const f=r===0?n.join(vh):n.slice(r).join(vh),g=d.length;for(let m=0;m<g;m++){const y=d[m];if(y.validator(f))return y.classGroupId}},Y3=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=n.slice(1,-1),o=r.indexOf(":"),l=r.slice(0,o);return l?K3+l:void 0})(),X3=n=>{const{theme:r,classGroups:o}=n;return Q3(o,r)},Q3=(n,r)=>{const o=fm();for(const l in n){const c=n[l];xp(c,o,l,r)}return o},xp=(n,r,o,l)=>{const c=n.length;for(let u=0;u<c;u++){const d=n[u];$3(d,r,o,l)}},$3=(n,r,o,l)=>{if(typeof n=="string"){J3(n,r,o);return}if(typeof n=="function"){Z3(n,r,o,l);return}e4(n,r,o,l)},J3=(n,r,o)=>{const l=n===""?r:gm(r,n);l.classGroupId=o},Z3=(n,r,o,l)=>{if(t4(n)){xp(n(l),r,o,l);return}r.validators===null&&(r.validators=[]),r.validators.push(W3(o,n))},e4=(n,r,o,l)=>{const c=Object.entries(n),u=c.length;for(let d=0;d<u;d++){const[f,g]=c[d];xp(g,gm(r,f),o,l)}},gm=(n,r)=>{let o=n;const l=r.split(vh),c=l.length;for(let u=0;u<c;u++){const d=l[u];let f=o.nextPart.get(d);f||(f=fm(),o.nextPart.set(d,f)),o=f}return o},t4=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,n4=n=>{if(n<1)return{get:()=>{},set:()=>{}};let r=0,o=Object.create(null),l=Object.create(null);const c=(u,d)=>{o[u]=d,r++,r>n&&(r=0,l=o,o=Object.create(null))};return{get(u){let d=o[u];if(d!==void 0)return d;if((d=l[u])!==void 0)return c(u,d),d},set(u,d){u in o?o[u]=d:c(u,d)}}},np="!",Y2=":",r4=[],X2=(n,r,o,l,c)=>({modifiers:n,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:l,isExternal:c}),i4=n=>{const{prefix:r,experimentalParseClassName:o}=n;let l=c=>{const u=[];let d=0,f=0,g=0,m;const y=c.length;for(let b=0;b<y;b++){const E=c[b];if(d===0&&f===0){if(E===Y2){u.push(c.slice(g,b)),g=b+1;continue}if(E==="/"){m=b;continue}}E==="["?d++:E==="]"?d--:E==="("?f++:E===")"&&f--}const x=u.length===0?c:c.slice(g);let R=x,w=!1;x.endsWith(np)?(R=x.slice(0,-1),w=!0):x.startsWith(np)&&(R=x.slice(1),w=!0);const _=m&&m>g?m-g:void 0;return X2(u,w,R,_)};if(r){const c=r+Y2,u=l;l=d=>d.startsWith(c)?u(d.slice(c.length)):X2(r4,!1,d,void 0,!0)}if(o){const c=l;l=u=>o({className:u,parseClassName:c})}return l},s4=n=>{const r=new Map;return n.orderSensitiveModifiers.forEach((o,l)=>{r.set(o,1e6+l)}),o=>{const l=[];let c=[];for(let u=0;u<o.length;u++){const d=o[u],f=d[0]==="[",g=r.has(d);f||g?(c.length>0&&(c.sort(),l.push(...c),c=[]),l.push(d)):c.push(d)}return c.length>0&&(c.sort(),l.push(...c)),l}},o4=n=>({cache:n4(n.cacheSize),parseClassName:i4(n),sortModifiers:s4(n),...q3(n)}),a4=/\s+/,l4=(n,r)=>{const{parseClassName:o,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:u}=r,d=[],f=n.trim().split(a4);let g="";for(let m=f.length-1;m>=0;m-=1){const y=f[m],{isExternal:x,modifiers:R,hasImportantModifier:w,baseClassName:_,maybePostfixModifierPosition:b}=o(y);if(x){g=y+(g.length>0?" "+g:g);continue}let E=!!b,z=l(E?_.substring(0,b):_);if(!z){if(!E){g=y+(g.length>0?" "+g:g);continue}if(z=l(_),!z){g=y+(g.length>0?" "+g:g);continue}E=!1}const F=R.length===0?"":R.length===1?R[0]:u(R).join(":"),k=w?F+np:F,N=k+z;if(d.indexOf(N)>-1)continue;d.push(N);const L=c(z,E);for(let j=0;j<L.length;++j){const Y=L[j];d.push(k+Y)}g=y+(g.length>0?" "+g:g)}return g},c4=(...n)=>{let r=0,o,l,c="";for(;r<n.length;)(o=n[r++])&&(l=mm(o))&&(c&&(c+=" "),c+=l);return c},mm=n=>{if(typeof n=="string")return n;let r,o="";for(let l=0;l<n.length;l++)n[l]&&(r=mm(n[l]))&&(o&&(o+=" "),o+=r);return o},u4=(n,...r)=>{let o,l,c,u;const d=g=>{const m=r.reduce((y,x)=>x(y),n());return o=o4(m),l=o.cache.get,c=o.cache.set,u=f,f(g)},f=g=>{const m=l(g);if(m)return m;const y=l4(g,o);return c(g,y),y};return u=d,(...g)=>u(c4(...g))},d4=[],Hn=n=>{const r=o=>o[n]||d4;return r.isThemeGetter=!0,r},vm=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ym=/^\((?:(\w[\w-]*):)?(.+)\)$/i,h4=/^\d+\/\d+$/,f4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,p4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,g4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,m4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,v4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kl=n=>h4.test(n),ft=n=>!!n&&!Number.isNaN(Number(n)),Oo=n=>!!n&&Number.isInteger(Number(n)),Pf=n=>n.endsWith("%")&&ft(n.slice(0,-1)),Bs=n=>f4.test(n),y4=()=>!0,x4=n=>p4.test(n)&&!g4.test(n),xm=()=>!1,w4=n=>m4.test(n),S4=n=>v4.test(n),k4=n=>!je(n)&&!Ue(n),_4=n=>Ll(n,km,xm),je=n=>vm.test(n),xa=n=>Ll(n,_m,x4),Af=n=>Ll(n,b4,ft),Q2=n=>Ll(n,wm,xm),C4=n=>Ll(n,Sm,S4),nh=n=>Ll(n,Cm,w4),Ue=n=>ym.test(n),Tc=n=>Tl(n,_m),F4=n=>Tl(n,P4),$2=n=>Tl(n,wm),R4=n=>Tl(n,km),E4=n=>Tl(n,Sm),rh=n=>Tl(n,Cm,!0),Ll=(n,r,o)=>{const l=vm.exec(n);return l?l[1]?r(l[1]):o(l[2]):!1},Tl=(n,r,o=!1)=>{const l=ym.exec(n);return l?l[1]?r(l[1]):o:!1},wm=n=>n==="position"||n==="percentage",Sm=n=>n==="image"||n==="url",km=n=>n==="length"||n==="size"||n==="bg-size",_m=n=>n==="length",b4=n=>n==="number",P4=n=>n==="family-name",Cm=n=>n==="shadow",A4=()=>{const n=Hn("color"),r=Hn("font"),o=Hn("text"),l=Hn("font-weight"),c=Hn("tracking"),u=Hn("leading"),d=Hn("breakpoint"),f=Hn("container"),g=Hn("spacing"),m=Hn("radius"),y=Hn("shadow"),x=Hn("inset-shadow"),R=Hn("text-shadow"),w=Hn("drop-shadow"),_=Hn("blur"),b=Hn("perspective"),E=Hn("aspect"),z=Hn("ease"),F=Hn("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...N(),Ue,je],j=()=>["auto","hidden","clip","visible","scroll"],Y=()=>["auto","contain","none"],O=()=>[Ue,je,g],U=()=>[kl,"full","auto",...O()],I=()=>[Oo,"none","subgrid",Ue,je],V=()=>["auto",{span:["full",Oo,Ue,je]},Oo,Ue,je],J=()=>[Oo,"auto",Ue,je],A=()=>["auto","min","max","fr",Ue,je],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],T=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...O()],G=()=>[kl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],X=()=>[n,Ue,je],oe=()=>[...N(),$2,Q2,{position:[Ue,je]}],te=()=>["no-repeat",{repeat:["","x","y","space","round"]}],K=()=>["auto","cover","contain",R4,_4,{size:[Ue,je]}],ne=()=>[Pf,Tc,xa],se=()=>["","none","full",m,Ue,je],$=()=>["",ft,Tc,xa],ue=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[ft,Pf,$2,Q2],re=()=>["","none",_,Ue,je],de=()=>["none",ft,Ue,je],xe=()=>["none",ft,Ue,je],Re=()=>[ft,Ue,je],be=()=>[kl,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Bs],breakpoint:[Bs],color:[y4],container:[Bs],"drop-shadow":[Bs],ease:["in","out","in-out"],font:[k4],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Bs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Bs],shadow:[Bs],spacing:["px",ft],text:[Bs],"text-shadow":[Bs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",kl,je,Ue,E]}],container:["container"],columns:[{columns:[ft,je,Ue,f]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[Oo,"auto",Ue,je]}],basis:[{basis:[kl,"full","auto",f,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ft,kl,"auto","initial","none",je]}],grow:[{grow:["",ft,Ue,je]}],shrink:[{shrink:["",ft,Ue,je]}],order:[{order:[Oo,"first","last","none",Ue,je]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...T(),"normal"]}],"justify-self":[{"justify-self":["auto",...T()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...T(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...T(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...T(),"baseline"]}],"place-self":[{"place-self":["auto",...T()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],w:[{w:[f,"screen",...G()]}],"min-w":[{"min-w":[f,"screen","none",...G()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",o,Tc,xa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,Ue,Af]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Pf,je]}],"font-family":[{font:[F4,je,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Ue,je]}],"line-clamp":[{"line-clamp":[ft,"none",Ue,Af]}],leading:[{leading:[u,...O()]}],"list-image":[{"list-image":["none",Ue,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ue,je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:X()}],"text-color":[{text:X()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:[ft,"from-font","auto",Ue,xa]}],"text-decoration-color":[{decoration:X()}],"underline-offset":[{"underline-offset":[ft,"auto",Ue,je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ue,je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ue,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:K()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Oo,Ue,je],radial:["",Ue,je],conic:[Oo,Ue,je]},E4,C4]}],"bg-color":[{bg:X()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:X()}],"gradient-via":[{via:X()}],"gradient-to":[{to:X()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ue(),"hidden","none"]}],"divide-style":[{divide:[...ue(),"hidden","none"]}],"border-color":[{border:X()}],"border-color-x":[{"border-x":X()}],"border-color-y":[{"border-y":X()}],"border-color-s":[{"border-s":X()}],"border-color-e":[{"border-e":X()}],"border-color-t":[{"border-t":X()}],"border-color-r":[{"border-r":X()}],"border-color-b":[{"border-b":X()}],"border-color-l":[{"border-l":X()}],"divide-color":[{divide:X()}],"outline-style":[{outline:[...ue(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ft,Ue,je]}],"outline-w":[{outline:["",ft,Tc,xa]}],"outline-color":[{outline:X()}],shadow:[{shadow:["","none",y,rh,nh]}],"shadow-color":[{shadow:X()}],"inset-shadow":[{"inset-shadow":["none",x,rh,nh]}],"inset-shadow-color":[{"inset-shadow":X()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:X()}],"ring-offset-w":[{"ring-offset":[ft,xa]}],"ring-offset-color":[{"ring-offset":X()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":X()}],"text-shadow":[{"text-shadow":["none",R,rh,nh]}],"text-shadow-color":[{"text-shadow":X()}],opacity:[{opacity:[ft,Ue,je]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ft]}],"mask-image-linear-from-pos":[{"mask-linear-from":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"mask-image-linear-from-color":[{"mask-linear-from":X()}],"mask-image-linear-to-color":[{"mask-linear-to":X()}],"mask-image-t-from-pos":[{"mask-t-from":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"mask-image-t-from-color":[{"mask-t-from":X()}],"mask-image-t-to-color":[{"mask-t-to":X()}],"mask-image-r-from-pos":[{"mask-r-from":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"mask-image-r-from-color":[{"mask-r-from":X()}],"mask-image-r-to-color":[{"mask-r-to":X()}],"mask-image-b-from-pos":[{"mask-b-from":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"mask-image-b-from-color":[{"mask-b-from":X()}],"mask-image-b-to-color":[{"mask-b-to":X()}],"mask-image-l-from-pos":[{"mask-l-from":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"mask-image-l-from-color":[{"mask-l-from":X()}],"mask-image-l-to-color":[{"mask-l-to":X()}],"mask-image-x-from-pos":[{"mask-x-from":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"mask-image-x-from-color":[{"mask-x-from":X()}],"mask-image-x-to-color":[{"mask-x-to":X()}],"mask-image-y-from-pos":[{"mask-y-from":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":X()}],"mask-image-y-to-color":[{"mask-y-to":X()}],"mask-image-radial":[{"mask-radial":[Ue,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"mask-image-radial-from-color":[{"mask-radial-from":X()}],"mask-image-radial-to-color":[{"mask-radial-to":X()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[ft]}],"mask-image-conic-from-pos":[{"mask-conic-from":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"mask-image-conic-from-color":[{"mask-conic-from":X()}],"mask-image-conic-to-color":[{"mask-conic-to":X()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:K()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ue,je]}],filter:[{filter:["","none",Ue,je]}],blur:[{blur:re()}],brightness:[{brightness:[ft,Ue,je]}],contrast:[{contrast:[ft,Ue,je]}],"drop-shadow":[{"drop-shadow":["","none",w,rh,nh]}],"drop-shadow-color":[{"drop-shadow":X()}],grayscale:[{grayscale:["",ft,Ue,je]}],"hue-rotate":[{"hue-rotate":[ft,Ue,je]}],invert:[{invert:["",ft,Ue,je]}],saturate:[{saturate:[ft,Ue,je]}],sepia:[{sepia:["",ft,Ue,je]}],"backdrop-filter":[{"backdrop-filter":["","none",Ue,je]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[ft,Ue,je]}],"backdrop-contrast":[{"backdrop-contrast":[ft,Ue,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ft,Ue,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ft,Ue,je]}],"backdrop-invert":[{"backdrop-invert":["",ft,Ue,je]}],"backdrop-opacity":[{"backdrop-opacity":[ft,Ue,je]}],"backdrop-saturate":[{"backdrop-saturate":[ft,Ue,je]}],"backdrop-sepia":[{"backdrop-sepia":["",ft,Ue,je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ue,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ft,"initial",Ue,je]}],ease:[{ease:["linear","initial",z,Ue,je]}],delay:[{delay:[ft,Ue,je]}],animate:[{animate:["none",F,Ue,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Ue,je]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[Ue,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:X()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:X()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ue,je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ue,je]}],fill:[{fill:["none",...X()]}],"stroke-w":[{stroke:[ft,Tc,xa,Af]}],stroke:[{stroke:["none",...X()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},N4=u4(A4);function D4(...n){return N4(H3(n))}const zc=[{ratio:1,label:"1:1"},{ratio:1.333,label:"4:3"},{ratio:1.5,label:"3:2"},{ratio:1.6,label:"16:10"},{ratio:1.778,label:"16:9"},{ratio:.667,label:"2:3"},{ratio:.75,label:"3:4"},{ratio:.5625,label:"9:16"}];function Fm(n,r){return r===0?n:Fm(r,n%r)}function L4(n,r){if(n<=0||r<=0)return null;const o=n/r;for(const d of zc)if(Math.abs(o-d.ratio)<.02)return{label:d.label,isApproximate:!1};for(const d of zc)if(Math.abs(o-d.ratio)<.05)return{label:d.label,isApproximate:!0};const l=Fm(n,r),c=n/l,u=r/l;if(c>100||u>100){let d=zc[0],f=Math.abs(o-zc[0].ratio);for(const g of zc){const m=Math.abs(o-g.ratio);m<f&&(f=m,d=g)}return{label:d.label,isApproximate:!0}}return{label:`${c}:${u}`,isApproximate:!1}}const T4=()=>{const{activeTool:n,setActiveTool:r}=yp(),{t:o}=Dl(),l=[{id:"enhance",icon:Zy,label:o("sidebar.enhance")},{id:"adjust",icon:Wy,label:o("sidebar.adjust")},{id:"resize",icon:im,label:o("sidebar.resize")},{id:"crop",icon:Ry,label:o("sidebar.crop")},{id:"rotate",icon:Iy,label:o("sidebar.rotate")},{id:"border",icon:qy,label:o("sidebar.border")}];return Z.jsx("div",{"trae-inspector-start-line":"20","trae-inspector-start-column":"4","trae-inspector-end-line":"34","trae-inspector-end-column":"10","trae-inspector-file-path":"src/components/layout/Sidebar.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"w-[80px] bg-zinc-900 border-r border-zinc-800 flex flex-col items-center py-4 gap-2 h-full z-10",children:l.map(c=>Z.jsxs("button",{"trae-inspector-start-line":"22","trae-inspector-start-column":"8","trae-inspector-end-line":"32","trae-inspector-end-column":"17","trae-inspector-file-path":"src/components/layout/Sidebar.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:()=>r(c.id),className:D4("flex flex-col items-center justify-center w-16 h-16 rounded-lg transition-colors text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",n===c.id&&"bg-zinc-800 text-blue-500 hover:text-blue-400"),children:[Z.jsx(c.icon,{className:"w-6 h-6 mb-1"}),Z.jsx("span",{"trae-inspector-start-line":"31","trae-inspector-start-column":"10","trae-inspector-end-line":"31","trae-inspector-end-column":"59","trae-inspector-file-path":"src/components/layout/Sidebar.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-[10px]",children:c.label})]},c.id))})};var dh={exports:{}},Mc={},Nf={},Df={},J2;function pt(){return J2||(J2=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n._registerNode=n.Konva=n.glob=void 0;const r=Math.PI/180;function o(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}n.glob=typeof u2<"u"?u2:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},n.Konva={_global:n.glob,version:"9.3.16",isBrowser:o(),isUnminified:/param/.test((function(c){}).toString()),dblClickWindow:400,getAngle(c){return n.Konva.angleDeg?c*r:c},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 n.Konva.DD.isDragging},isTransforming(){var c;return(c=n.Konva.Transformer)===null||c===void 0?void 0:c.isTransforming()},isDragReady(){return!!n.Konva.DD.node},releaseCanvasOnDestroy:!0,document:n.glob.document,_injectGlobal(c){n.glob.Konva=c}};const l=c=>{n.Konva[c.prototype.getClassName()]=c};n._registerNode=l,n.Konva._injectGlobal(n.Konva)})(Df)),Df}var Lf={},Z2;function gn(){return Z2||(Z2=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Util=n.Transform=void 0;const r=pt();class o{constructor(N=[1,0,0,1,0,0]){this.dirty=!1,this.m=N&&N.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 o(this.m)}copyInto(N){N.m[0]=this.m[0],N.m[1]=this.m[1],N.m[2]=this.m[2],N.m[3]=this.m[3],N.m[4]=this.m[4],N.m[5]=this.m[5]}point(N){const L=this.m;return{x:L[0]*N.x+L[2]*N.y+L[4],y:L[1]*N.x+L[3]*N.y+L[5]}}translate(N,L){return this.m[4]+=this.m[0]*N+this.m[2]*L,this.m[5]+=this.m[1]*N+this.m[3]*L,this}scale(N,L){return this.m[0]*=N,this.m[1]*=N,this.m[2]*=L,this.m[3]*=L,this}rotate(N){const L=Math.cos(N),j=Math.sin(N),Y=this.m[0]*L+this.m[2]*j,O=this.m[1]*L+this.m[3]*j,U=this.m[0]*-j+this.m[2]*L,I=this.m[1]*-j+this.m[3]*L;return this.m[0]=Y,this.m[1]=O,this.m[2]=U,this.m[3]=I,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(N,L){const j=this.m[0]+this.m[2]*L,Y=this.m[1]+this.m[3]*L,O=this.m[2]+this.m[0]*N,U=this.m[3]+this.m[1]*N;return this.m[0]=j,this.m[1]=Y,this.m[2]=O,this.m[3]=U,this}multiply(N){const L=this.m[0]*N.m[0]+this.m[2]*N.m[1],j=this.m[1]*N.m[0]+this.m[3]*N.m[1],Y=this.m[0]*N.m[2]+this.m[2]*N.m[3],O=this.m[1]*N.m[2]+this.m[3]*N.m[3],U=this.m[0]*N.m[4]+this.m[2]*N.m[5]+this.m[4],I=this.m[1]*N.m[4]+this.m[3]*N.m[5]+this.m[5];return this.m[0]=L,this.m[1]=j,this.m[2]=Y,this.m[3]=O,this.m[4]=U,this.m[5]=I,this}invert(){const N=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),L=this.m[3]*N,j=-this.m[1]*N,Y=-this.m[2]*N,O=this.m[0]*N,U=N*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),I=N*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=L,this.m[1]=j,this.m[2]=Y,this.m[3]=O,this.m[4]=U,this.m[5]=I,this}getMatrix(){return this.m}decompose(){const N=this.m[0],L=this.m[1],j=this.m[2],Y=this.m[3],O=this.m[4],U=this.m[5],I=N*Y-L*j,V={x:O,y:U,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(N!=0||L!=0){const J=Math.sqrt(N*N+L*L);V.rotation=L>0?Math.acos(N/J):-Math.acos(N/J),V.scaleX=J,V.scaleY=I/J,V.skewX=(N*j+L*Y)/I,V.skewY=0}else if(j!=0||Y!=0){const J=Math.sqrt(j*j+Y*Y);V.rotation=Math.PI/2-(Y>0?Math.acos(-j/J):-Math.acos(j/J)),V.scaleX=I/J,V.scaleY=J,V.skewX=0,V.skewY=(N*j+L*Y)/I}return V.rotation=n.Util._getRotation(V.rotation),V}}n.Transform=o;let l="[object Array]",c="[object Number]",u="[object String]",d="[object Boolean]",f=Math.PI/180,g=180/Math.PI,m="#",y="",x="0",R="Konva warning: ",w="Konva error: ",_="rgb(",b={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]},E=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,z=[];const F=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(k){setTimeout(k,60)};n.Util={_isElement(k){return!!(k&&k.nodeType==1)},_isFunction(k){return!!(k&&k.constructor&&k.call&&k.apply)},_isPlainObject(k){return!!k&&k.constructor===Object},_isArray(k){return Object.prototype.toString.call(k)===l},_isNumber(k){return Object.prototype.toString.call(k)===c&&!isNaN(k)&&isFinite(k)},_isString(k){return Object.prototype.toString.call(k)===u},_isBoolean(k){return Object.prototype.toString.call(k)===d},isObject(k){return k instanceof Object},isValidSelector(k){if(typeof k!="string")return!1;const N=k[0];return N==="#"||N==="."||N===N.toUpperCase()},_sign(k){return k===0||k>0?1:-1},requestAnimFrame(k){z.push(k),z.length===1&&F(function(){const N=z;z=[],N.forEach(function(L){L()})})},createCanvasElement(){const k=document.createElement("canvas");try{k.style=k.style||{}}catch{}return k},createImageElement(){return document.createElement("img")},_isInDocument(k){for(;k=k.parentNode;)if(k==document)return!0;return!1},_urlToImage(k,N){const L=n.Util.createImageElement();L.onload=function(){N(L)},L.src=k},_rgbToHex(k,N,L){return((1<<24)+(k<<16)+(N<<8)+L).toString(16).slice(1)},_hexToRgb(k){k=k.replace(m,y);const N=parseInt(k,16);return{r:N>>16&255,g:N>>8&255,b:N&255}},getRandomColor(){let k=(Math.random()*16777215<<0).toString(16);for(;k.length<6;)k=x+k;return m+k},getRGB(k){let N;return k in b?(N=b[k],{r:N[0],g:N[1],b:N[2]}):k[0]===m?this._hexToRgb(k.substring(1)):k.substr(0,4)===_?(N=E.exec(k.replace(/ /g,"")),{r:parseInt(N[1],10),g:parseInt(N[2],10),b:parseInt(N[3],10)}):{r:0,g:0,b:0}},colorToRGBA(k){return k=k||"black",n.Util._namedColorToRBA(k)||n.Util._hex3ColorToRGBA(k)||n.Util._hex4ColorToRGBA(k)||n.Util._hex6ColorToRGBA(k)||n.Util._hex8ColorToRGBA(k)||n.Util._rgbColorToRGBA(k)||n.Util._rgbaColorToRGBA(k)||n.Util._hslColorToRGBA(k)},_namedColorToRBA(k){const N=b[k.toLowerCase()];return N?{r:N[0],g:N[1],b:N[2],a:1}:null},_rgbColorToRGBA(k){if(k.indexOf("rgb(")===0){k=k.match(/rgb\(([^)]+)\)/)[1];const N=k.split(/ *, */).map(Number);return{r:N[0],g:N[1],b:N[2],a:1}}},_rgbaColorToRGBA(k){if(k.indexOf("rgba(")===0){k=k.match(/rgba\(([^)]+)\)/)[1];const N=k.split(/ *, */).map((L,j)=>L.slice(-1)==="%"?j===3?parseInt(L)/100:parseInt(L)/100*255:Number(L));return{r:N[0],g:N[1],b:N[2],a:N[3]}}},_hex8ColorToRGBA(k){if(k[0]==="#"&&k.length===9)return{r:parseInt(k.slice(1,3),16),g:parseInt(k.slice(3,5),16),b:parseInt(k.slice(5,7),16),a:parseInt(k.slice(7,9),16)/255}},_hex6ColorToRGBA(k){if(k[0]==="#"&&k.length===7)return{r:parseInt(k.slice(1,3),16),g:parseInt(k.slice(3,5),16),b:parseInt(k.slice(5,7),16),a:1}},_hex4ColorToRGBA(k){if(k[0]==="#"&&k.length===5)return{r:parseInt(k[1]+k[1],16),g:parseInt(k[2]+k[2],16),b:parseInt(k[3]+k[3],16),a:parseInt(k[4]+k[4],16)/255}},_hex3ColorToRGBA(k){if(k[0]==="#"&&k.length===4)return{r:parseInt(k[1]+k[1],16),g:parseInt(k[2]+k[2],16),b:parseInt(k[3]+k[3],16),a:1}},_hslColorToRGBA(k){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(k)){const[N,...L]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(k),j=Number(L[0])/360,Y=Number(L[1])/100,O=Number(L[2])/100;let U,I,V;if(Y===0)return V=O*255,{r:Math.round(V),g:Math.round(V),b:Math.round(V),a:1};O<.5?U=O*(1+Y):U=O+Y-O*Y;const J=2*O-U,A=[0,0,0];for(let M=0;M<3;M++)I=j+1/3*-(M-1),I<0&&I++,I>1&&I--,6*I<1?V=J+(U-J)*6*I:2*I<1?V=U:3*I<2?V=J+(U-J)*(2/3-I)*6:V=J,A[M]=V*255;return{r:Math.round(A[0]),g:Math.round(A[1]),b:Math.round(A[2]),a:1}}},haveIntersection(k,N){return!(N.x>k.x+k.width||N.x+N.width<k.x||N.y>k.y+k.height||N.y+N.height<k.y)},cloneObject(k){const N={};for(const L in k)this._isPlainObject(k[L])?N[L]=this.cloneObject(k[L]):this._isArray(k[L])?N[L]=this.cloneArray(k[L]):N[L]=k[L];return N},cloneArray(k){return k.slice(0)},degToRad(k){return k*f},radToDeg(k){return k*g},_degToRad(k){return n.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),n.Util.degToRad(k)},_radToDeg(k){return n.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),n.Util.radToDeg(k)},_getRotation(k){return r.Konva.angleDeg?n.Util.radToDeg(k):k},_capitalize(k){return k.charAt(0).toUpperCase()+k.slice(1)},throw(k){throw new Error(w+k)},error(k){console.error(w+k)},warn(k){r.Konva.showWarnings&&console.warn(R+k)},each(k,N){for(const L in k)N(L,k[L])},_inRange(k,N,L){return N<=k&&k<L},_getProjectionToSegment(k,N,L,j,Y,O){let U,I,V;const J=(k-L)*(k-L)+(N-j)*(N-j);if(J==0)U=k,I=N,V=(Y-L)*(Y-L)+(O-j)*(O-j);else{const A=((Y-k)*(L-k)+(O-N)*(j-N))/J;A<0?(U=k,I=N,V=(k-Y)*(k-Y)+(N-O)*(N-O)):A>1?(U=L,I=j,V=(L-Y)*(L-Y)+(j-O)*(j-O)):(U=k+A*(L-k),I=N+A*(j-N),V=(U-Y)*(U-Y)+(I-O)*(I-O))}return[U,I,V]},_getProjectionToLine(k,N,L){const j=n.Util.cloneObject(k);let Y=Number.MAX_VALUE;return N.forEach(function(O,U){if(!L&&U===N.length-1)return;const I=N[(U+1)%N.length],V=n.Util._getProjectionToSegment(O.x,O.y,I.x,I.y,k.x,k.y),J=V[0],A=V[1],M=V[2];M<Y&&(j.x=J,j.y=A,Y=M)}),j},_prepareArrayForTween(k,N,L){let j,Y=[],O=[];if(k.length>N.length){const I=N;N=k,k=I}for(j=0;j<k.length;j+=2)Y.push({x:k[j],y:k[j+1]});for(j=0;j<N.length;j+=2)O.push({x:N[j],y:N[j+1]});const U=[];return O.forEach(function(I){const V=n.Util._getProjectionToLine(I,Y,L);U.push(V.x),U.push(V.y)}),U},_prepareToStringify(k){let N;k.visitedByCircularReferenceRemoval=!0;for(const L in k)if(k.hasOwnProperty(L)&&k[L]&&typeof k[L]=="object"){if(N=Object.getOwnPropertyDescriptor(k,L),k[L].visitedByCircularReferenceRemoval||n.Util._isElement(k[L]))if(N.configurable)delete k[L];else return null;else if(n.Util._prepareToStringify(k[L])===null)if(N.configurable)delete k[L];else return null}return delete k.visitedByCircularReferenceRemoval,k},_assign(k,N){for(const L in N)k[L]=N[L];return k},_getFirstPointerId(k){return k.touches?k.changedTouches[0].identifier:k.pointerId||999},releaseCanvas(...k){r.Konva.releaseCanvasOnDestroy&&k.forEach(N=>{N.width=0,N.height=0})},drawRoundedRectPath(k,N,L,j){let Y=0,O=0,U=0,I=0;typeof j=="number"?Y=O=U=I=Math.min(j,N/2,L/2):(Y=Math.min(j[0]||0,N/2,L/2),O=Math.min(j[1]||0,N/2,L/2),I=Math.min(j[2]||0,N/2,L/2),U=Math.min(j[3]||0,N/2,L/2)),k.moveTo(Y,0),k.lineTo(N-O,0),k.arc(N-O,O,O,Math.PI*3/2,0,!1),k.lineTo(N,L-I),k.arc(N-I,L-I,I,0,Math.PI/2,!1),k.lineTo(U,L),k.arc(U,L-U,U,Math.PI/2,Math.PI,!1),k.lineTo(0,Y),k.arc(Y,Y,Y,Math.PI,Math.PI*3/2,!1)}}})(Lf)),Lf}var Oc={},Tf={},Yr={},e0;function wt(){if(e0)return Yr;e0=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.RGBComponent=l,Yr.alphaComponent=c,Yr.getNumberValidator=u,Yr.getNumberOrArrayOfNumbersValidator=d,Yr.getNumberOrAutoValidator=f,Yr.getStringValidator=g,Yr.getStringOrGradientValidator=m,Yr.getFunctionValidator=y,Yr.getNumberArrayValidator=x,Yr.getBooleanValidator=R,Yr.getComponentValidator=w;const n=pt(),r=gn();function o(_){return r.Util._isString(_)?'"'+_+'"':Object.prototype.toString.call(_)==="[object Number]"||r.Util._isBoolean(_)?_:Object.prototype.toString.call(_)}function l(_){return _>255?255:_<0?0:Math.round(_)}function c(_){return _>1?1:_<1e-4?1e-4:_}function u(){if(n.Konva.isUnminified)return function(_,b){return r.Util._isNumber(_)||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a number.'),_}}function d(_){if(n.Konva.isUnminified)return function(b,E){const z=r.Util._isNumber(b),F=r.Util._isArray(b)&&b.length==_;return!z&&!F&&r.Util.warn(o(b)+' is a not valid value for "'+E+'" attribute. The value should be a number or Array<number>('+_+")"),b}}function f(){if(n.Konva.isUnminified)return function(_,b){return r.Util._isNumber(_)||_==="auto"||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a number or "auto".'),_}}function g(){if(n.Konva.isUnminified)return function(_,b){return r.Util._isString(_)||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a string.'),_}}function m(){if(n.Konva.isUnminified)return function(_,b){const E=r.Util._isString(_),z=Object.prototype.toString.call(_)==="[object CanvasGradient]"||_&&_.addColorStop;return E||z||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a string or a native gradient.'),_}}function y(){if(n.Konva.isUnminified)return function(_,b){return r.Util._isFunction(_)||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a function.'),_}}function x(){if(n.Konva.isUnminified)return function(_,b){const E=Int8Array?Object.getPrototypeOf(Int8Array):null;return E&&_ instanceof E||(r.Util._isArray(_)?_.forEach(function(z){r.Util._isNumber(z)||r.Util.warn('"'+b+'" attribute has non numeric element '+z+". Make sure that all elements are numbers.")}):r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a array of numbers.')),_}}function R(){if(n.Konva.isUnminified)return function(_,b){return _===!0||_===!1||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a boolean.'),_}}function w(_){if(n.Konva.isUnminified)return function(b,E){return b==null||r.Util.isObject(b)||r.Util.warn(o(b)+' is a not valid value for "'+E+'" attribute. The value should be an object with properties '+_),b}}return Yr}var t0;function yt(){return t0||(t0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Factory=void 0;const r=gn(),o=wt(),l="get",c="set";n.Factory={addGetterSetter(u,d,f,g,m){n.Factory.addGetter(u,d,f),n.Factory.addSetter(u,d,g,m),n.Factory.addOverloadedGetterSetter(u,d)},addGetter(u,d,f){const g=l+r.Util._capitalize(d);u.prototype[g]=u.prototype[g]||function(){const m=this.attrs[d];return m===void 0?f:m}},addSetter(u,d,f,g){const m=c+r.Util._capitalize(d);u.prototype[m]||n.Factory.overWriteSetter(u,d,f,g)},overWriteSetter(u,d,f,g){const m=c+r.Util._capitalize(d);u.prototype[m]=function(y){return f&&y!==void 0&&y!==null&&(y=f.call(this,y,d)),this._setAttr(d,y),g&&g.call(this),this}},addComponentsGetterSetter(u,d,f,g,m){let y=f.length,x=r.Util._capitalize,R=l+x(d),w=c+x(d),_,b;u.prototype[R]=function(){const z={};for(_=0;_<y;_++)b=f[_],z[b]=this.getAttr(d+x(b));return z};const E=(0,o.getComponentValidator)(f);u.prototype[w]=function(z){let F=this.attrs[d],k;g&&(z=g.call(this,z)),E&&E.call(this,z,d);for(k in z)z.hasOwnProperty(k)&&this._setAttr(d+x(k),z[k]);return z||f.forEach(N=>{this._setAttr(d+x(N),void 0)}),this._fireChangeEvent(d,F,z),m&&m.call(this),this},n.Factory.addOverloadedGetterSetter(u,d)},addOverloadedGetterSetter(u,d){const f=r.Util._capitalize(d),g=c+f,m=l+f;u.prototype[d]=function(){return arguments.length?(this[g](arguments[0]),this):this[m]()}},addDeprecatedGetterSetter(u,d,f,g){r.Util.error("Adding deprecated "+d);const m=l+r.Util._capitalize(d),y=d+" property is deprecated and will be removed soon. Look at Konva change log for more information.";u.prototype[m]=function(){r.Util.error(y);const x=this.attrs[d];return x===void 0?f:x},n.Factory.addSetter(u,d,g,function(){r.Util.error(y)}),n.Factory.addOverloadedGetterSetter(u,d)},backCompat(u,d){r.Util.each(d,function(f,g){const m=u.prototype[g],y=l+r.Util._capitalize(f),x=c+r.Util._capitalize(f);function R(){m.apply(this,arguments),r.Util.error('"'+f+'" method is deprecated and will be removed soon. Use ""'+g+'" instead.')}u.prototype[f]=R,u.prototype[y]=R,u.prototype[x]=R})},afterSetFilter(){this._filterUpToDate=!1}}})(Tf)),Tf}var Gs={},Hs={},n0;function Rm(){if(n0)return Hs;n0=1,Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.HitContext=Hs.SceneContext=Hs.Context=void 0;const n=gn(),r=pt();function o(z){let F=[],k=z.length,N=n.Util,L,j;for(L=0;L<k;L++)j=z[L],N._isNumber(j)?j=Math.round(j*1e3)/1e3:N._isString(j)||(j=j+""),F.push(j);return F}const l=",",c="(",u=")",d="([",f="])",g=";",m="()",y="=",x=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],R=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"],w=100;class _{constructor(F){this.canvas=F,r.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(F){F.fillEnabled()&&this._fill(F)}_fill(F){}strokeShape(F){F.hasStroke()&&this._stroke(F)}_stroke(F){}fillStrokeShape(F){F.attrs.fillAfterStrokeEnabled?(this.strokeShape(F),this.fillShape(F)):(this.fillShape(F),this.strokeShape(F))}getTrace(F,k){let N=this.traceArr,L=N.length,j="",Y,O,U,I;for(Y=0;Y<L;Y++)O=N[Y],U=O.method,U?(I=O.args,j+=U,F?j+=m:n.Util._isArray(I[0])?j+=d+I.join(l)+f:(k&&(I=I.map(V=>typeof V=="number"?Math.floor(V):V)),j+=c+I.join(l)+u)):(j+=O.property,F||(j+=y+O.val)),j+=g;return j}clearTrace(){this.traceArr=[]}_trace(F){let k=this.traceArr,N;k.push(F),N=k.length,N>=w&&k.shift()}reset(){const F=this.getCanvas().getPixelRatio();this.setTransform(1*F,0,0,1*F,0,0)}getCanvas(){return this.canvas}clear(F){const k=this.getCanvas();F?this.clearRect(F.x||0,F.y||0,F.width||0,F.height||0):this.clearRect(0,0,k.getWidth()/k.pixelRatio,k.getHeight()/k.pixelRatio)}_applyLineCap(F){const k=F.attrs.lineCap;k&&this.setAttr("lineCap",k)}_applyOpacity(F){const k=F.getAbsoluteOpacity();k!==1&&this.setAttr("globalAlpha",k)}_applyLineJoin(F){const k=F.attrs.lineJoin;k&&this.setAttr("lineJoin",k)}setAttr(F,k){this._context[F]=k}arc(F,k,N,L,j,Y){this._context.arc(F,k,N,L,j,Y)}arcTo(F,k,N,L,j){this._context.arcTo(F,k,N,L,j)}beginPath(){this._context.beginPath()}bezierCurveTo(F,k,N,L,j,Y){this._context.bezierCurveTo(F,k,N,L,j,Y)}clearRect(F,k,N,L){this._context.clearRect(F,k,N,L)}clip(...F){this._context.clip.apply(this._context,F)}closePath(){this._context.closePath()}createImageData(F,k){const N=arguments;if(N.length===2)return this._context.createImageData(F,k);if(N.length===1)return this._context.createImageData(F)}createLinearGradient(F,k,N,L){return this._context.createLinearGradient(F,k,N,L)}createPattern(F,k){return this._context.createPattern(F,k)}createRadialGradient(F,k,N,L,j,Y){return this._context.createRadialGradient(F,k,N,L,j,Y)}drawImage(F,k,N,L,j,Y,O,U,I){const V=arguments,J=this._context;V.length===3?J.drawImage(F,k,N):V.length===5?J.drawImage(F,k,N,L,j):V.length===9&&J.drawImage(F,k,N,L,j,Y,O,U,I)}ellipse(F,k,N,L,j,Y,O,U){this._context.ellipse(F,k,N,L,j,Y,O,U)}isPointInPath(F,k,N,L){return N?this._context.isPointInPath(N,F,k,L):this._context.isPointInPath(F,k,L)}fill(...F){this._context.fill.apply(this._context,F)}fillRect(F,k,N,L){this._context.fillRect(F,k,N,L)}strokeRect(F,k,N,L){this._context.strokeRect(F,k,N,L)}fillText(F,k,N,L){L?this._context.fillText(F,k,N,L):this._context.fillText(F,k,N)}measureText(F){return this._context.measureText(F)}getImageData(F,k,N,L){return this._context.getImageData(F,k,N,L)}lineTo(F,k){this._context.lineTo(F,k)}moveTo(F,k){this._context.moveTo(F,k)}rect(F,k,N,L){this._context.rect(F,k,N,L)}roundRect(F,k,N,L,j){this._context.roundRect(F,k,N,L,j)}putImageData(F,k,N){this._context.putImageData(F,k,N)}quadraticCurveTo(F,k,N,L){this._context.quadraticCurveTo(F,k,N,L)}restore(){this._context.restore()}rotate(F){this._context.rotate(F)}save(){this._context.save()}scale(F,k){this._context.scale(F,k)}setLineDash(F){this._context.setLineDash?this._context.setLineDash(F):"mozDash"in this._context?this._context.mozDash=F:"webkitLineDash"in this._context&&(this._context.webkitLineDash=F)}getLineDash(){return this._context.getLineDash()}setTransform(F,k,N,L,j,Y){this._context.setTransform(F,k,N,L,j,Y)}stroke(F){F?this._context.stroke(F):this._context.stroke()}strokeText(F,k,N,L){this._context.strokeText(F,k,N,L)}transform(F,k,N,L,j,Y){this._context.transform(F,k,N,L,j,Y)}translate(F,k){this._context.translate(F,k)}_enableTrace(){let F=this,k=x.length,N=this.setAttr,L,j;const Y=function(O){let U=F[O],I;F[O]=function(){return j=o(Array.prototype.slice.call(arguments,0)),I=U.apply(F,arguments),F._trace({method:O,args:j}),I}};for(L=0;L<k;L++)Y(x[L]);F.setAttr=function(){N.apply(F,arguments);const O=arguments[0];let U=arguments[1];(O==="shadowOffsetX"||O==="shadowOffsetY"||O==="shadowBlur")&&(U=U/this.canvas.getPixelRatio()),F._trace({property:O,val:U})}}_applyGlobalCompositeOperation(F){const k=F.attrs.globalCompositeOperation;!k||k==="source-over"||this.setAttr("globalCompositeOperation",k)}}Hs.Context=_,R.forEach(function(z){Object.defineProperty(_.prototype,z,{get(){return this._context[z]},set(F){this._context[z]=F}})});class b extends _{constructor(F,{willReadFrequently:k=!1}={}){super(F),this._context=F._canvas.getContext("2d",{willReadFrequently:k})}_fillColor(F){const k=F.fill();this.setAttr("fillStyle",k),F._fillFunc(this)}_fillPattern(F){this.setAttr("fillStyle",F._getFillPattern()),F._fillFunc(this)}_fillLinearGradient(F){const k=F._getLinearGradient();k&&(this.setAttr("fillStyle",k),F._fillFunc(this))}_fillRadialGradient(F){const k=F._getRadialGradient();k&&(this.setAttr("fillStyle",k),F._fillFunc(this))}_fill(F){const k=F.fill(),N=F.getFillPriority();if(k&&N==="color"){this._fillColor(F);return}const L=F.getFillPatternImage();if(L&&N==="pattern"){this._fillPattern(F);return}const j=F.getFillLinearGradientColorStops();if(j&&N==="linear-gradient"){this._fillLinearGradient(F);return}const Y=F.getFillRadialGradientColorStops();if(Y&&N==="radial-gradient"){this._fillRadialGradient(F);return}k?this._fillColor(F):L?this._fillPattern(F):j?this._fillLinearGradient(F):Y&&this._fillRadialGradient(F)}_strokeLinearGradient(F){const k=F.getStrokeLinearGradientStartPoint(),N=F.getStrokeLinearGradientEndPoint(),L=F.getStrokeLinearGradientColorStops(),j=this.createLinearGradient(k.x,k.y,N.x,N.y);if(L){for(let Y=0;Y<L.length;Y+=2)j.addColorStop(L[Y],L[Y+1]);this.setAttr("strokeStyle",j)}}_stroke(F){const k=F.dash(),N=F.getStrokeScaleEnabled();if(F.hasStroke()){if(!N){this.save();const j=this.getCanvas().getPixelRatio();this.setTransform(j,0,0,j,0,0)}this._applyLineCap(F),k&&F.dashEnabled()&&(this.setLineDash(k),this.setAttr("lineDashOffset",F.dashOffset())),this.setAttr("lineWidth",F.strokeWidth()),F.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),F.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(F):this.setAttr("strokeStyle",F.stroke()),F._strokeFunc(this),N||this.restore()}}_applyShadow(F){var k,N,L;const j=(k=F.getShadowRGBA())!==null&&k!==void 0?k:"black",Y=(N=F.getShadowBlur())!==null&&N!==void 0?N:5,O=(L=F.getShadowOffset())!==null&&L!==void 0?L:{x:0,y:0},U=F.getAbsoluteScale(),I=this.canvas.getPixelRatio(),V=U.x*I,J=U.y*I;this.setAttr("shadowColor",j),this.setAttr("shadowBlur",Y*Math.min(Math.abs(V),Math.abs(J))),this.setAttr("shadowOffsetX",O.x*V),this.setAttr("shadowOffsetY",O.y*J)}}Hs.SceneContext=b;class E extends _{constructor(F){super(F),this._context=F._canvas.getContext("2d",{willReadFrequently:!0})}_fill(F){this.save(),this.setAttr("fillStyle",F.colorKey),F._fillFuncHit(this),this.restore()}strokeShape(F){F.hasHitStroke()&&this._stroke(F)}_stroke(F){if(F.hasHitStroke()){const k=F.getStrokeScaleEnabled();if(!k){this.save();const j=this.getCanvas().getPixelRatio();this.setTransform(j,0,0,j,0,0)}this._applyLineCap(F);const N=F.hitStrokeWidth(),L=N==="auto"?F.strokeWidth():N;this.setAttr("lineWidth",L),this.setAttr("strokeStyle",F.colorKey),F._strokeFuncHit(this),k||this.restore()}}}return Hs.HitContext=E,Hs}var r0;function Fh(){if(r0)return Gs;r0=1,Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.HitCanvas=Gs.SceneCanvas=Gs.Canvas=void 0;const n=gn(),r=Rm(),o=pt(),l=yt(),c=wt();let u;function d(){if(u)return u;const y=n.Util.createCanvasElement(),x=y.getContext("2d");return u=(function(){const R=o.Konva._global.devicePixelRatio||1,w=x.webkitBackingStorePixelRatio||x.mozBackingStorePixelRatio||x.msBackingStorePixelRatio||x.oBackingStorePixelRatio||x.backingStorePixelRatio||1;return R/w})(),n.Util.releaseCanvas(y),u}let f=class{constructor(x){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const w=(x||{}).pixelRatio||o.Konva.pixelRatio||d();this.pixelRatio=w,this._canvas=n.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(x){const R=this.pixelRatio;this.pixelRatio=x,this.setSize(this.getWidth()/R,this.getHeight()/R)}setWidth(x){this.width=this._canvas.width=x*this.pixelRatio,this._canvas.style.width=x+"px";const R=this.pixelRatio;this.getContext()._context.scale(R,R)}setHeight(x){this.height=this._canvas.height=x*this.pixelRatio,this._canvas.style.height=x+"px";const R=this.pixelRatio;this.getContext()._context.scale(R,R)}getWidth(){return this.width}getHeight(){return this.height}setSize(x,R){this.setWidth(x||0),this.setHeight(R||0)}toDataURL(x,R){try{return this._canvas.toDataURL(x,R)}catch{try{return this._canvas.toDataURL()}catch(_){return n.Util.error("Unable to get data URL. "+_.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}};Gs.Canvas=f,l.Factory.addGetterSetter(f,"pixelRatio",void 0,(0,c.getNumberValidator)());class g extends f{constructor(x={width:0,height:0,willReadFrequently:!1}){super(x),this.context=new r.SceneContext(this,{willReadFrequently:x.willReadFrequently}),this.setSize(x.width,x.height)}}Gs.SceneCanvas=g;class m extends f{constructor(x={width:0,height:0}){super(x),this.hitCanvas=!0,this.context=new r.HitContext(this),this.setSize(x.width,x.height)}}return Gs.HitCanvas=m,Gs}var zf={},i0;function wp(){return i0||(i0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.DD=void 0;const r=pt(),o=gn();n.DD={get isDragging(){let l=!1;return n.DD._dragElements.forEach(c=>{c.dragStatus==="dragging"&&(l=!0)}),l},justDragged:!1,get node(){let l;return n.DD._dragElements.forEach(c=>{l=c.node}),l},_dragElements:new Map,_drag(l){const c=[];n.DD._dragElements.forEach((u,d)=>{const{node:f}=u,g=f.getStage();g.setPointersPositions(l),u.pointerId===void 0&&(u.pointerId=o.Util._getFirstPointerId(l));const m=g._changedPointerPositions.find(y=>y.id===u.pointerId);if(m){if(u.dragStatus!=="dragging"){const y=f.dragDistance();if(Math.max(Math.abs(m.x-u.startPointerPos.x),Math.abs(m.y-u.startPointerPos.y))<y||(f.startDrag({evt:l}),!f.isDragging()))return}f._setDragPosition(l,u),c.push(f)}}),c.forEach(u=>{u.fire("dragmove",{type:"dragmove",target:u,evt:l},!0)})},_endDragBefore(l){const c=[];n.DD._dragElements.forEach(u=>{const{node:d}=u,f=d.getStage();if(l&&f.setPointersPositions(l),!f._changedPointerPositions.find(y=>y.id===u.pointerId))return;(u.dragStatus==="dragging"||u.dragStatus==="stopped")&&(n.DD.justDragged=!0,r.Konva._mouseListenClick=!1,r.Konva._touchListenClick=!1,r.Konva._pointerListenClick=!1,u.dragStatus="stopped");const m=u.node.getLayer()||u.node instanceof r.Konva.Stage&&u.node;m&&c.indexOf(m)===-1&&c.push(m)}),c.forEach(u=>{u.draw()})},_endDragAfter(l){n.DD._dragElements.forEach((c,u)=>{c.dragStatus==="stopped"&&c.node.fire("dragend",{type:"dragend",target:c.node,evt:l},!0),c.dragStatus!=="dragging"&&n.DD._dragElements.delete(u)})}},r.Konva.isBrowser&&(window.addEventListener("mouseup",n.DD._endDragBefore,!0),window.addEventListener("touchend",n.DD._endDragBefore,!0),window.addEventListener("touchcancel",n.DD._endDragBefore,!0),window.addEventListener("mousemove",n.DD._drag),window.addEventListener("touchmove",n.DD._drag),window.addEventListener("mouseup",n.DD._endDragAfter,!1),window.addEventListener("touchend",n.DD._endDragAfter,!1),window.addEventListener("touchcancel",n.DD._endDragAfter,!1))})(zf)),zf}var s0;function Rn(){if(s0)return Oc;s0=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.Node=void 0;const n=gn(),r=yt(),o=Fh(),l=pt(),c=wp(),u=wt(),d="absoluteOpacity",f="allEventListeners",g="absoluteTransform",m="absoluteScale",y="canvas",x="Change",R="children",w="konva",_="listening",b="mouseenter",E="mouseleave",z="set",F="Shape",k=" ",N="stage",L="transform",j="Stage",Y="visible",O=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(k);let U=1,I=class rp{constructor(A){this._id=U++,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(A),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(A){(A===L||A===g)&&this._cache.get(A)?this._cache.get(A).dirty=!0:A?this._cache.delete(A):this._cache.clear()}_getCache(A,M){let T=this._cache.get(A);return(T===void 0||(A===L||A===g)&&T.dirty===!0)&&(T=M.call(this),this._cache.set(A,T)),T}_calculate(A,M,T){if(!this._attachedDepsListeners.get(A)){const H=M.map(G=>G+"Change.konva").join(k);this.on(H,()=>{this._clearCache(A)}),this._attachedDepsListeners.set(A,!0)}return this._getCache(A,T)}_getCanvasCache(){return this._cache.get(y)}_clearSelfAndDescendantCache(A){this._clearCache(A),A===g&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(y)){const{scene:A,filter:M,hit:T}=this._cache.get(y);n.Util.releaseCanvas(A,M,T),this._cache.delete(y)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(A){const M=A||{};let T={};(M.x===void 0||M.y===void 0||M.width===void 0||M.height===void 0)&&(T=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let H=Math.ceil(M.width||T.width),G=Math.ceil(M.height||T.height),X=M.pixelRatio,oe=M.x===void 0?Math.floor(T.x):M.x,te=M.y===void 0?Math.floor(T.y):M.y,K=M.offset||0,ne=M.drawBorder||!1,se=M.hitCanvasPixelRatio||1;if(!H||!G){n.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const $=Math.abs(Math.round(T.x)-oe)>.5?1:0,ue=Math.abs(Math.round(T.y)-te)>.5?1:0;H+=K*2+$,G+=K*2+ue,oe-=K,te-=K;const pe=new o.SceneCanvas({pixelRatio:X,width:H,height:G}),Q=new o.SceneCanvas({pixelRatio:X,width:0,height:0,willReadFrequently:!0}),re=new o.HitCanvas({pixelRatio:se,width:H,height:G}),de=pe.getContext(),xe=re.getContext();return re.isCache=!0,pe.isCache=!0,this._cache.delete(y),this._filterUpToDate=!1,M.imageSmoothingEnabled===!1&&(pe.getContext()._context.imageSmoothingEnabled=!1,Q.getContext()._context.imageSmoothingEnabled=!1),de.save(),xe.save(),de.translate(-oe,-te),xe.translate(-oe,-te),this._isUnderCache=!0,this._clearSelfAndDescendantCache(d),this._clearSelfAndDescendantCache(m),this.drawScene(pe,this),this.drawHit(re,this),this._isUnderCache=!1,de.restore(),xe.restore(),ne&&(de.save(),de.beginPath(),de.rect(0,0,H,G),de.closePath(),de.setAttr("strokeStyle","red"),de.setAttr("lineWidth",5),de.stroke(),de.restore()),this._cache.set(y,{scene:pe,filter:Q,hit:re,x:oe,y:te}),this._requestDraw(),this}isCached(){return this._cache.has(y)}getClientRect(A){throw new Error('abstract "getClientRect" method call')}_transformedRect(A,M){const T=[{x:A.x,y:A.y},{x:A.x+A.width,y:A.y},{x:A.x+A.width,y:A.y+A.height},{x:A.x,y:A.y+A.height}];let H=1/0,G=1/0,X=-1/0,oe=-1/0;const te=this.getAbsoluteTransform(M);return T.forEach(function(K){const ne=te.point(K);H===void 0&&(H=X=ne.x,G=oe=ne.y),H=Math.min(H,ne.x),G=Math.min(G,ne.y),X=Math.max(X,ne.x),oe=Math.max(oe,ne.y)}),{x:H,y:G,width:X-H,height:oe-G}}_drawCachedSceneCanvas(A){A.save(),A._applyOpacity(this),A._applyGlobalCompositeOperation(this);const M=this._getCanvasCache();A.translate(M.x,M.y);const T=this._getCachedSceneCanvas(),H=T.pixelRatio;A.drawImage(T._canvas,0,0,T.width/H,T.height/H),A.restore()}_drawCachedHitCanvas(A){const M=this._getCanvasCache(),T=M.hit;A.save(),A.translate(M.x,M.y),A.drawImage(T._canvas,0,0,T.width/T.pixelRatio,T.height/T.pixelRatio),A.restore()}_getCachedSceneCanvas(){let A=this.filters(),M=this._getCanvasCache(),T=M.scene,H=M.filter,G=H.getContext(),X,oe,te,K;if(A){if(!this._filterUpToDate){const ne=T.pixelRatio;H.setSize(T.width/T.pixelRatio,T.height/T.pixelRatio);try{for(X=A.length,G.clear(),G.drawImage(T._canvas,0,0,T.getWidth()/ne,T.getHeight()/ne),oe=G.getImageData(0,0,H.getWidth(),H.getHeight()),te=0;te<X;te++){if(K=A[te],typeof K!="function"){n.Util.error("Filter should be type of function, but got "+typeof K+" instead. Please check correct filters");continue}K.call(this,oe),G.putImageData(oe,0,0)}}catch(se){n.Util.error("Unable to apply filter. "+se.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return H}return T}on(A,M){if(this._cache&&this._cache.delete(f),arguments.length===3)return this._delegate.apply(this,arguments);let T=A.split(k),H=T.length,G,X,oe,te,K;for(G=0;G<H;G++)X=T[G],oe=X.split("."),te=oe[0],K=oe[1]||"",this.eventListeners[te]||(this.eventListeners[te]=[]),this.eventListeners[te].push({name:K,handler:M});return this}off(A,M){let T=(A||"").split(k),H=T.length,G,X,oe,te,K,ne;if(this._cache&&this._cache.delete(f),!A)for(X in this.eventListeners)this._off(X);for(G=0;G<H;G++)if(oe=T[G],te=oe.split("."),K=te[0],ne=te[1],K)this.eventListeners[K]&&this._off(K,ne,M);else for(X in this.eventListeners)this._off(X,ne,M);return this}dispatchEvent(A){const M={target:this,type:A.type,evt:A};return this.fire(A.type,M),this}addEventListener(A,M){return this.on(A,function(T){M.call(this,T.evt)}),this}removeEventListener(A){return this.off(A),this}_delegate(A,M,T){const H=this;this.on(A,function(G){const X=G.target.findAncestors(M,!0,H);for(let oe=0;oe<X.length;oe++)G=n.Util.cloneObject(G),G.currentTarget=X[oe],T.call(X[oe],G)})}remove(){return this.isDragging()&&this.stopDrag(),c.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(g),this._clearSelfAndDescendantCache(d),this._clearSelfAndDescendantCache(m),this._clearSelfAndDescendantCache(N),this._clearSelfAndDescendantCache(Y),this._clearSelfAndDescendantCache(_)}_remove(){this._clearCaches();const A=this.getParent();A&&A.children&&(A.children.splice(this.index,1),A._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(A){const M="get"+n.Util._capitalize(A);return n.Util._isFunction(this[M])?this[M]():this.attrs[A]}getAncestors(){let A=this.getParent(),M=[];for(;A;)M.push(A),A=A.getParent();return M}getAttrs(){return this.attrs||{}}setAttrs(A){return this._batchTransformChanges(()=>{let M,T;if(!A)return this;for(M in A)M!==R&&(T=z+n.Util._capitalize(M),n.Util._isFunction(this[T])?this[T](A[M]):this._setAttr(M,A[M]))}),this}isListening(){return this._getCache(_,this._isListening)}_isListening(A){if(!this.listening())return!1;const T=this.getParent();return T&&T!==A&&this!==A?T._isListening(A):!0}isVisible(){return this._getCache(Y,this._isVisible)}_isVisible(A){if(!this.visible())return!1;const T=this.getParent();return T&&T!==A&&this!==A?T._isVisible(A):!0}shouldDrawHit(A,M=!1){if(A)return this._isVisible(A)&&this._isListening(A);const T=this.getLayer();let H=!1;c.DD._dragElements.forEach(X=>{X.dragStatus==="dragging"&&(X.node.nodeType==="Stage"||X.node.getLayer()===T)&&(H=!0)});const G=!M&&!l.Konva.hitOnDragEnabled&&(H||l.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!G}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let A=this.getDepth(),M=this,T=0,H,G,X,oe;function te(ne){for(H=[],G=ne.length,X=0;X<G;X++)oe=ne[X],T++,oe.nodeType!==F&&(H=H.concat(oe.getChildren().slice())),oe._id===M._id&&(X=G);H.length>0&&H[0].getDepth()<=A&&te(H)}const K=this.getStage();return M.nodeType!==j&&K&&te(K.getChildren()),T}getDepth(){let A=0,M=this.parent;for(;M;)A++,M=M.parent;return A}_batchTransformChanges(A){this._batchingTransformChange=!0,A(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(L),this._clearSelfAndDescendantCache(g)),this._needClearTransformCache=!1}setPosition(A){return this._batchTransformChanges(()=>{this.x(A.x),this.y(A.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const A=this.getStage();if(!A)return null;const M=A.getPointerPosition();if(!M)return null;const T=this.getAbsoluteTransform().copy();return T.invert(),T.point(M)}getAbsolutePosition(A){let M=!1,T=this.parent;for(;T;){if(T.isCached()){M=!0;break}T=T.parent}M&&!A&&(A=!0);const H=this.getAbsoluteTransform(A).getMatrix(),G=new n.Transform,X=this.offset();return G.m=H.slice(),G.translate(X.x,X.y),G.getTranslation()}setAbsolutePosition(A){const{x:M,y:T,...H}=this._clearTransform();this.attrs.x=M,this.attrs.y=T,this._clearCache(L);const G=this._getAbsoluteTransform().copy();return G.invert(),G.translate(A.x,A.y),A={x:this.attrs.x+G.getTranslation().x,y:this.attrs.y+G.getTranslation().y},this._setTransform(H),this.setPosition({x:A.x,y:A.y}),this._clearCache(L),this._clearSelfAndDescendantCache(g),this}_setTransform(A){let M;for(M in A)this.attrs[M]=A[M]}_clearTransform(){const A={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,A}move(A){let M=A.x,T=A.y,H=this.x(),G=this.y();return M!==void 0&&(H+=M),T!==void 0&&(G+=T),this.setPosition({x:H,y:G}),this}_eachAncestorReverse(A,M){let T=[],H=this.getParent(),G,X;if(!(M&&M._id===this._id)){for(T.unshift(this);H&&(!M||H._id!==M._id);)T.unshift(H),H=H.parent;for(G=T.length,X=0;X<G;X++)A(T[X])}}rotate(A){return this.rotation(this.rotation()+A),this}moveToTop(){if(!this.parent)return n.Util.warn("Node has no parent. moveToTop function is ignored."),!1;const A=this.index,M=this.parent.getChildren().length;return A<M-1?(this.parent.children.splice(A,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return n.Util.warn("Node has no parent. moveUp function is ignored."),!1;const A=this.index,M=this.parent.getChildren().length;return A<M-1?(this.parent.children.splice(A,1),this.parent.children.splice(A+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return n.Util.warn("Node has no parent. moveDown function is ignored."),!1;const A=this.index;return A>0?(this.parent.children.splice(A,1),this.parent.children.splice(A-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return n.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const A=this.index;return A>0?(this.parent.children.splice(A,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(A){if(!this.parent)return n.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(A<0||A>=this.parent.children.length)&&n.Util.warn("Unexpected value "+A+" 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 M=this.index;return this.parent.children.splice(M,1),this.parent.children.splice(A,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(d,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let A=this.opacity();const M=this.getParent();return M&&!M._isUnderCache&&(A*=M.getAbsoluteOpacity()),A}moveTo(A){return this.getParent()!==A&&(this._remove(),A.add(this)),this}toObject(){let A=this.getAttrs(),M,T,H,G,X;const oe={attrs:{},className:this.getClassName()};for(M in A)T=A[M],X=n.Util.isObject(T)&&!n.Util._isPlainObject(T)&&!n.Util._isArray(T),!X&&(H=typeof this[M]=="function"&&this[M],delete A[M],G=H?H.call(this):null,A[M]=T,G!==T&&(oe.attrs[M]=T));return n.Util._prepareToStringify(oe)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(A,M,T){const H=[];M&&this._isMatch(A)&&H.push(this);let G=this.parent;for(;G;){if(G===T)return H;G._isMatch(A)&&H.push(G),G=G.parent}return H}isAncestorOf(A){return!1}findAncestor(A,M,T){return this.findAncestors(A,M,T)[0]}_isMatch(A){if(!A)return!1;if(typeof A=="function")return A(this);let M=A.replace(/ /g,"").split(","),T=M.length,H,G;for(H=0;H<T;H++)if(G=M[H],n.Util.isValidSelector(G)||(n.Util.warn('Selector "'+G+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),n.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),n.Util.warn("Konva is awesome, right?")),G.charAt(0)==="#"){if(this.id()===G.slice(1))return!0}else if(G.charAt(0)==="."){if(this.hasName(G.slice(1)))return!0}else if(this.className===G||this.nodeType===G)return!0;return!1}getLayer(){const A=this.getParent();return A?A.getLayer():null}getStage(){return this._getCache(N,this._getStage)}_getStage(){const A=this.getParent();return A?A.getStage():null}fire(A,M={},T){return M.target=M.target||this,T?this._fireAndBubble(A,M):this._fire(A,M),this}getAbsoluteTransform(A){return A?this._getAbsoluteTransform(A):this._getCache(g,this._getAbsoluteTransform)}_getAbsoluteTransform(A){let M;if(A)return M=new n.Transform,this._eachAncestorReverse(function(T){const H=T.transformsEnabled();H==="all"?M.multiply(T.getTransform()):H==="position"&&M.translate(T.x()-T.offsetX(),T.y()-T.offsetY())},A),M;{M=this._cache.get(g)||new n.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(M):M.reset();const T=this.transformsEnabled();if(T==="all")M.multiply(this.getTransform());else if(T==="position"){const H=this.attrs.x||0,G=this.attrs.y||0,X=this.attrs.offsetX||0,oe=this.attrs.offsetY||0;M.translate(H-X,G-oe)}return M.dirty=!1,M}}getAbsoluteScale(A){let M=this;for(;M;)M._isUnderCache&&(A=M),M=M.getParent();const H=this.getAbsoluteTransform(A).decompose();return{x:H.scaleX,y:H.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(L,this._getTransform)}_getTransform(){var A,M;const T=this._cache.get(L)||new n.Transform;T.reset();const H=this.x(),G=this.y(),X=l.Konva.getAngle(this.rotation()),oe=(A=this.attrs.scaleX)!==null&&A!==void 0?A:1,te=(M=this.attrs.scaleY)!==null&&M!==void 0?M:1,K=this.attrs.skewX||0,ne=this.attrs.skewY||0,se=this.attrs.offsetX||0,$=this.attrs.offsetY||0;return(H!==0||G!==0)&&T.translate(H,G),X!==0&&T.rotate(X),(K!==0||ne!==0)&&T.skew(K,ne),(oe!==1||te!==1)&&T.scale(oe,te),(se!==0||$!==0)&&T.translate(-1*se,-1*$),T.dirty=!1,T}clone(A){let M=n.Util.cloneObject(this.attrs),T,H,G,X,oe;for(T in A)M[T]=A[T];const te=new this.constructor(M);for(T in this.eventListeners)for(H=this.eventListeners[T],G=H.length,X=0;X<G;X++)oe=H[X],oe.name.indexOf(w)<0&&(te.eventListeners[T]||(te.eventListeners[T]=[]),te.eventListeners[T].push(oe));return te}_toKonvaCanvas(A){A=A||{};const M=this.getClientRect(),T=this.getStage(),H=A.x!==void 0?A.x:Math.floor(M.x),G=A.y!==void 0?A.y:Math.floor(M.y),X=A.pixelRatio||1,oe=new o.SceneCanvas({width:A.width||Math.ceil(M.width)||(T?T.width():0),height:A.height||Math.ceil(M.height)||(T?T.height():0),pixelRatio:X}),te=oe.getContext(),K=new o.SceneCanvas({width:oe.width/oe.pixelRatio+Math.abs(H),height:oe.height/oe.pixelRatio+Math.abs(G),pixelRatio:oe.pixelRatio});return A.imageSmoothingEnabled===!1&&(te._context.imageSmoothingEnabled=!1),te.save(),(H||G)&&te.translate(-1*H,-1*G),this.drawScene(oe,void 0,K),te.restore(),oe}toCanvas(A){return this._toKonvaCanvas(A)._canvas}toDataURL(A){A=A||{};const M=A.mimeType||null,T=A.quality||null,H=this._toKonvaCanvas(A).toDataURL(M,T);return A.callback&&A.callback(H),H}toImage(A){return new Promise((M,T)=>{try{const H=A==null?void 0:A.callback;H&&delete A.callback,n.Util._urlToImage(this.toDataURL(A),function(G){M(G),H==null||H(G)})}catch(H){T(H)}})}toBlob(A){return new Promise((M,T)=>{try{const H=A==null?void 0:A.callback;H&&delete A.callback,this.toCanvas(A).toBlob(G=>{M(G),H==null||H(G)},A==null?void 0:A.mimeType,A==null?void 0:A.quality)}catch(H){T(H)}})}setSize(A){return this.width(A.width),this.height(A.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():l.Konva.dragDistance}_off(A,M,T){let H=this.eventListeners[A],G,X,oe;for(G=0;G<H.length;G++)if(X=H[G].name,oe=H[G].handler,(X!=="konva"||M==="konva")&&(!M||X===M)&&(!T||T===oe)){if(H.splice(G,1),H.length===0){delete this.eventListeners[A];break}G--}}_fireChangeEvent(A,M,T){this._fire(A+x,{oldVal:M,newVal:T})}addName(A){if(!this.hasName(A)){const M=this.name(),T=M?M+" "+A:A;this.name(T)}return this}hasName(A){if(!A)return!1;const M=this.name();return M?(M||"").split(/\s/g).indexOf(A)!==-1:!1}removeName(A){const M=(this.name()||"").split(/\s/g),T=M.indexOf(A);return T!==-1&&(M.splice(T,1),this.name(M.join(" "))),this}setAttr(A,M){const T=this[z+n.Util._capitalize(A)];return n.Util._isFunction(T)?T.call(this,M):this._setAttr(A,M),this}_requestDraw(){if(l.Konva.autoDrawEnabled){const A=this.getLayer()||this.getStage();A==null||A.batchDraw()}}_setAttr(A,M){const T=this.attrs[A];T===M&&!n.Util.isObject(M)||(M==null?delete this.attrs[A]:this.attrs[A]=M,this._shouldFireChangeEvents&&this._fireChangeEvent(A,T,M),this._requestDraw())}_setComponentAttr(A,M,T){let H;T!==void 0&&(H=this.attrs[A],H||(this.attrs[A]=this.getAttr(A)),this.attrs[A][M]=T,this._fireChangeEvent(A,H,T))}_fireAndBubble(A,M,T){if(M&&this.nodeType===F&&(M.target=this),!((A===b||A===E)&&(T&&(this===T||this.isAncestorOf&&this.isAncestorOf(T))||this.nodeType==="Stage"&&!T))){this._fire(A,M);const G=(A===b||A===E)&&T&&T.isAncestorOf&&T.isAncestorOf(this)&&!T.isAncestorOf(this.parent);(M&&!M.cancelBubble||!M)&&this.parent&&this.parent.isListening()&&!G&&(T&&T.parent?this._fireAndBubble.call(this.parent,A,M,T):this._fireAndBubble.call(this.parent,A,M))}}_getProtoListeners(A){var M,T,H;const G=(M=this._cache.get(f))!==null&&M!==void 0?M:{};let X=G==null?void 0:G[A];if(X===void 0){X=[];let oe=Object.getPrototypeOf(this);for(;oe;){const te=(H=(T=oe.eventListeners)===null||T===void 0?void 0:T[A])!==null&&H!==void 0?H:[];X.push(...te),oe=Object.getPrototypeOf(oe)}G[A]=X,this._cache.set(f,G)}return X}_fire(A,M){M=M||{},M.currentTarget=this,M.type=A;const T=this._getProtoListeners(A);if(T)for(var H=0;H<T.length;H++)T[H].handler.call(this,M);const G=this.eventListeners[A];if(G)for(var H=0;H<G.length;H++)G[H].handler.call(this,M)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(A){const M=A?A.pointerId:void 0,T=this.getStage(),H=this.getAbsolutePosition();if(!T)return;const G=T._getPointerById(M)||T._changedPointerPositions[0]||H;c.DD._dragElements.set(this._id,{node:this,startPointerPos:G,offset:{x:G.x-H.x,y:G.y-H.y},dragStatus:"ready",pointerId:M})}startDrag(A,M=!0){c.DD._dragElements.has(this._id)||this._createDragElement(A);const T=c.DD._dragElements.get(this._id);T.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:A&&A.evt},M)}_setDragPosition(A,M){const T=this.getStage()._getPointerById(M.pointerId);if(!T)return;let H={x:T.x-M.offset.x,y:T.y-M.offset.y};const G=this.dragBoundFunc();if(G!==void 0){const X=G.call(this,H,A);X?H=X:n.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==H.x||this._lastPos.y!==H.y)&&(this.setAbsolutePosition(H),this._requestDraw()),this._lastPos=H}stopDrag(A){const M=c.DD._dragElements.get(this._id);M&&(M.dragStatus="stopped"),c.DD._endDragBefore(A),c.DD._endDragAfter(A)}setDraggable(A){this._setAttr("draggable",A),this._dragChange()}isDragging(){const A=c.DD._dragElements.get(this._id);return A?A.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(A){if(!(!(A.evt.button!==void 0)||l.Konva.dragButtons.indexOf(A.evt.button)>=0)||this.isDragging())return;let H=!1;c.DD._dragElements.forEach(G=>{this.isAncestorOf(G.node)&&(H=!0)}),H||this._createDragElement(A)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const M=c.DD._dragElements.get(this._id),T=M&&M.dragStatus==="dragging",H=M&&M.dragStatus==="ready";T?this.stopDrag():H&&c.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(A={x:0,y:0}){const M=this.getStage();if(!M)return!1;const T={x:-A.x,y:-A.y,width:M.width()+2*A.x,height:M.height()+2*A.y};return n.Util.haveIntersection(T,this.getClientRect())}static create(A,M){return n.Util._isString(A)&&(A=JSON.parse(A)),this._createNode(A,M)}static _createNode(A,M){let T=rp.prototype.getClassName.call(A),H=A.children,G,X,oe;M&&(A.attrs.container=M),l.Konva[T]||(n.Util.warn('Can not find a node with class name "'+T+'". Fallback to "Shape".'),T="Shape");const te=l.Konva[T];if(G=new te(A.attrs),H)for(X=H.length,oe=0;oe<X;oe++)G.add(rp._createNode(H[oe]));return G}};Oc.Node=I,I.prototype.nodeType="Node",I.prototype._attrsAffectingSize=[],I.prototype.eventListeners={},I.prototype.on.call(I.prototype,O,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(L),this._clearSelfAndDescendantCache(g)}),I.prototype.on.call(I.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Y)}),I.prototype.on.call(I.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(_)}),I.prototype.on.call(I.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(d)});const V=r.Factory.addGetterSetter;return V(I,"zIndex"),V(I,"absolutePosition"),V(I,"position"),V(I,"x",0,(0,u.getNumberValidator)()),V(I,"y",0,(0,u.getNumberValidator)()),V(I,"globalCompositeOperation","source-over",(0,u.getStringValidator)()),V(I,"opacity",1,(0,u.getNumberValidator)()),V(I,"name","",(0,u.getStringValidator)()),V(I,"id","",(0,u.getStringValidator)()),V(I,"rotation",0,(0,u.getNumberValidator)()),r.Factory.addComponentsGetterSetter(I,"scale",["x","y"]),V(I,"scaleX",1,(0,u.getNumberValidator)()),V(I,"scaleY",1,(0,u.getNumberValidator)()),r.Factory.addComponentsGetterSetter(I,"skew",["x","y"]),V(I,"skewX",0,(0,u.getNumberValidator)()),V(I,"skewY",0,(0,u.getNumberValidator)()),r.Factory.addComponentsGetterSetter(I,"offset",["x","y"]),V(I,"offsetX",0,(0,u.getNumberValidator)()),V(I,"offsetY",0,(0,u.getNumberValidator)()),V(I,"dragDistance",null,(0,u.getNumberValidator)()),V(I,"width",0,(0,u.getNumberValidator)()),V(I,"height",0,(0,u.getNumberValidator)()),V(I,"listening",!0,(0,u.getBooleanValidator)()),V(I,"preventDefault",!0,(0,u.getBooleanValidator)()),V(I,"filters",null,function(J){return this._filterUpToDate=!1,J}),V(I,"visible",!0,(0,u.getBooleanValidator)()),V(I,"transformsEnabled","all",(0,u.getStringValidator)()),V(I,"size"),V(I,"dragBoundFunc"),V(I,"draggable",!1,(0,u.getBooleanValidator)()),r.Factory.backCompat(I,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"}),Oc}var Ic={},o0;function Rh(){if(o0)return Ic;o0=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.Container=void 0;const n=yt(),r=Rn(),o=wt();let l=class extends r.Node{constructor(){super(...arguments),this.children=[]}getChildren(u){if(!u)return this.children||[];const d=this.children||[],f=[];return d.forEach(function(g){u(g)&&f.push(g)}),f}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(u=>{u.parent=null,u.index=0,u.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(u=>{u.parent=null,u.index=0,u.destroy()}),this.children=[],this._requestDraw(),this}add(...u){if(u.length===0)return this;if(u.length>1){for(let f=0;f<u.length;f++)this.add(u[f]);return this}const d=u[0];return d.getParent()?(d.moveTo(this),this):(this._validateAdd(d),d.index=this.getChildren().length,d.parent=this,d._clearCaches(),this.getChildren().push(d),this._fire("add",{child:d}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(u){return this._generalFind(u,!1)}findOne(u){const d=this._generalFind(u,!0);return d.length>0?d[0]:void 0}_generalFind(u,d){const f=[];return this._descendants(g=>{const m=g._isMatch(u);return m&&f.push(g),!!(m&&d)}),f}_descendants(u){let d=!1;const f=this.getChildren();for(const g of f){if(d=u(g),d)return!0;if(g.hasChildren()&&(d=g._descendants(u),d))return!0}return!1}toObject(){const u=r.Node.prototype.toObject.call(this);return u.children=[],this.getChildren().forEach(d=>{u.children.push(d.toObject())}),u}isAncestorOf(u){let d=u.getParent();for(;d;){if(d._id===this._id)return!0;d=d.getParent()}return!1}clone(u){const d=r.Node.prototype.clone.call(this,u);return this.getChildren().forEach(function(f){d.add(f.clone())}),d}getAllIntersections(u){const d=[];return this.find("Shape").forEach(f=>{f.isVisible()&&f.intersects(u)&&d.push(f)}),d}_clearSelfAndDescendantCache(u){var d;super._clearSelfAndDescendantCache(u),!this.isCached()&&((d=this.children)===null||d===void 0||d.forEach(function(f){f._clearSelfAndDescendantCache(u)}))}_setChildrenIndices(){var u;(u=this.children)===null||u===void 0||u.forEach(function(d,f){d.index=f}),this._requestDraw()}drawScene(u,d,f){const g=this.getLayer(),m=u||g&&g.getCanvas(),y=m&&m.getContext(),x=this._getCanvasCache(),R=x&&x.scene,w=m&&m.isCache;if(!this.isVisible()&&!w)return this;if(R){y.save();const _=this.getAbsoluteTransform(d).getMatrix();y.transform(_[0],_[1],_[2],_[3],_[4],_[5]),this._drawCachedSceneCanvas(y),y.restore()}else this._drawChildren("drawScene",m,d,f);return this}drawHit(u,d){if(!this.shouldDrawHit(d))return this;const f=this.getLayer(),g=u||f&&f.hitCanvas,m=g&&g.getContext(),y=this._getCanvasCache();if(y&&y.hit){m.save();const R=this.getAbsoluteTransform(d).getMatrix();m.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedHitCanvas(m),m.restore()}else this._drawChildren("drawHit",g,d);return this}_drawChildren(u,d,f,g){var m;const y=d&&d.getContext(),x=this.clipWidth(),R=this.clipHeight(),w=this.clipFunc(),_=typeof x=="number"&&typeof R=="number"||w,b=f===this;if(_){y.save();const z=this.getAbsoluteTransform(f);let F=z.getMatrix();y.transform(F[0],F[1],F[2],F[3],F[4],F[5]),y.beginPath();let k;if(w)k=w.call(this,y,this);else{const N=this.clipX(),L=this.clipY();y.rect(N||0,L||0,x,R)}y.clip.apply(y,k),F=z.copy().invert().getMatrix(),y.transform(F[0],F[1],F[2],F[3],F[4],F[5])}const E=!b&&this.globalCompositeOperation()!=="source-over"&&u==="drawScene";E&&(y.save(),y._applyGlobalCompositeOperation(this)),(m=this.children)===null||m===void 0||m.forEach(function(z){z[u](d,f,g)}),E&&y.restore(),_&&y.restore()}getClientRect(u={}){var d;const f=u.skipTransform,g=u.relativeTo;let m,y,x,R,w={x:1/0,y:1/0,width:0,height:0};const _=this;(d=this.children)===null||d===void 0||d.forEach(function(z){if(!z.visible())return;const F=z.getClientRect({relativeTo:_,skipShadow:u.skipShadow,skipStroke:u.skipStroke});F.width===0&&F.height===0||(m===void 0?(m=F.x,y=F.y,x=F.x+F.width,R=F.y+F.height):(m=Math.min(m,F.x),y=Math.min(y,F.y),x=Math.max(x,F.x+F.width),R=Math.max(R,F.y+F.height)))});const b=this.find("Shape");let E=!1;for(let z=0;z<b.length;z++)if(b[z]._isVisible(this)){E=!0;break}return E&&m!==void 0?w={x:m,y,width:x-m,height:R-y}:w={x:0,y:0,width:0,height:0},f?w:this._transformedRect(w,g)}};return Ic.Container=l,n.Factory.addComponentsGetterSetter(l,"clip",["x","y","width","height"]),n.Factory.addGetterSetter(l,"clipX",void 0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(l,"clipY",void 0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(l,"clipWidth",void 0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(l,"clipHeight",void 0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(l,"clipFunc"),Ic}var Mf={},Io={},a0;function Em(){if(a0)return Io;a0=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.getCapturedShape=l,Io.createEvent=c,Io.hasPointerCapture=u,Io.setPointerCapture=d,Io.releaseCapture=f;const n=pt(),r=new Map,o=n.Konva._global.PointerEvent!==void 0;function l(g){return r.get(g)}function c(g){return{evt:g,pointerId:g.pointerId}}function u(g,m){return r.get(g)===m}function d(g,m){f(g),m.getStage()&&(r.set(g,m),o&&m._fire("gotpointercapture",c(new PointerEvent("gotpointercapture"))))}function f(g,m){const y=r.get(g);if(!y)return;const x=y.getStage();x&&x.content,r.delete(g),o&&y._fire("lostpointercapture",c(new PointerEvent("lostpointercapture")))}return Io}var l0;function z4(){return l0||(l0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Stage=n.stages=void 0;const r=gn(),o=yt(),l=Rh(),c=pt(),u=Fh(),d=wp(),f=pt(),g=Em(),m="Stage",y="string",x="px",R="mouseout",w="mouseleave",_="mouseover",b="mouseenter",E="mousemove",z="mousedown",F="mouseup",k="pointermove",N="pointerdown",L="pointerup",j="pointercancel",Y="lostpointercapture",O="pointerout",U="pointerleave",I="pointerover",V="pointerenter",J="contextmenu",A="touchstart",M="touchend",T="touchmove",H="touchcancel",G="wheel",X=5,oe=[[b,"_pointerenter"],[z,"_pointerdown"],[E,"_pointermove"],[F,"_pointerup"],[w,"_pointerleave"],[A,"_pointerdown"],[T,"_pointermove"],[M,"_pointerup"],[H,"_pointercancel"],[_,"_pointerover"],[G,"_wheel"],[J,"_contextmenu"],[N,"_pointerdown"],[k,"_pointermove"],[L,"_pointerup"],[j,"_pointercancel"],[Y,"_lostpointercapture"]],te={mouse:{[O]:R,[U]:w,[I]:_,[V]:b,[k]:E,[N]:z,[L]:F,[j]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[O]:"touchout",[U]:"touchleave",[I]:"touchover",[V]:"touchenter",[k]:T,[N]:A,[L]:M,[j]:H,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[O]:O,[U]:U,[I]:I,[V]:V,[k]:k,[N]:N,[L]:L,[j]:j,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},K=pe=>pe.indexOf("pointer")>=0?"pointer":pe.indexOf("touch")>=0?"touch":"mouse",ne=pe=>{const Q=K(pe);if(Q==="pointer")return c.Konva.pointerEventsEnabled&&te.pointer;if(Q==="touch")return te.touch;if(Q==="mouse")return te.mouse};function se(pe={}){return(pe.clipFunc||pe.clipWidth||pe.clipHeight)&&r.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),pe}const $="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);";n.stages=[];class ue extends l.Container{constructor(Q){super(se(Q)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),n.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",()=>{se(this.attrs)}),this._checkVisibility()}_validateAdd(Q){const re=Q.getType()==="Layer",de=Q.getType()==="FastLayer";re||de||r.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const Q=this.visible()?"":"none";this.content.style.display=Q}setContainer(Q){if(typeof Q===y){if(Q.charAt(0)==="."){const de=Q.slice(1);Q=document.getElementsByClassName(de)[0]}else{var re;Q.charAt(0)!=="#"?re=Q:re=Q.slice(1),Q=document.getElementById(re)}if(!Q)throw"Can not find container in document with id "+re}return this._setAttr("container",Q),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),Q.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){let Q=this.children,re=Q.length,de;for(de=0;de<re;de++)Q[de].clear();return this}clone(Q){return Q||(Q={}),Q.container=typeof document<"u"&&document.createElement("div"),l.Container.prototype.clone.call(this,Q)}destroy(){super.destroy();const Q=this.content;Q&&r.Util._isInDocument(Q)&&this.container().removeChild(Q);const re=n.stages.indexOf(this);return re>-1&&n.stages.splice(re,1),r.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const Q=this._pointerPositions[0]||this._changedPointerPositions[0];return Q?{x:Q.x,y:Q.y}:(r.Util.warn($),null)}_getPointerById(Q){return this._pointerPositions.find(re=>re.id===Q)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(Q){Q=Q||{},Q.x=Q.x||0,Q.y=Q.y||0,Q.width=Q.width||this.width(),Q.height=Q.height||this.height();const re=new u.SceneCanvas({width:Q.width,height:Q.height,pixelRatio:Q.pixelRatio||1}),de=re.getContext()._context,xe=this.children;return(Q.x||Q.y)&&de.translate(-1*Q.x,-1*Q.y),xe.forEach(function(Re){if(!Re.isVisible())return;const be=Re._toKonvaCanvas(Q);de.drawImage(be._canvas,Q.x,Q.y,be.getWidth()/be.getPixelRatio(),be.getHeight()/be.getPixelRatio())}),re}getIntersection(Q){if(!Q)return null;let re=this.children,de=re.length,xe=de-1,Re;for(Re=xe;Re>=0;Re--){const be=re[Re].getIntersection(Q);if(be)return be}return null}_resizeDOM(){const Q=this.width(),re=this.height();this.content&&(this.content.style.width=Q+x,this.content.style.height=re+x),this.bufferCanvas.setSize(Q,re),this.bufferHitCanvas.setSize(Q,re),this.children.forEach(de=>{de.setSize({width:Q,height:re}),de.draw()})}add(Q,...re){if(arguments.length>1){for(let xe=0;xe<arguments.length;xe++)this.add(arguments[xe]);return this}super.add(Q);const de=this.children.length;return de>X&&r.Util.warn("The stage has "+de+" 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."),Q.setSize({width:this.width(),height:this.height()}),Q.draw(),c.Konva.isBrowser&&this.content.appendChild(Q.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(Q){return g.hasPointerCapture(Q,this)}setPointerCapture(Q){g.setPointerCapture(Q,this)}releaseCapture(Q){g.releaseCapture(Q,this)}getLayers(){return this.children}_bindContentEvents(){c.Konva.isBrowser&&oe.forEach(([Q,re])=>{this.content.addEventListener(Q,de=>{this[re](de)},{passive:!1})})}_pointerenter(Q){this.setPointersPositions(Q);const re=ne(Q.type);re&&this._fire(re.pointerenter,{evt:Q,target:this,currentTarget:this})}_pointerover(Q){this.setPointersPositions(Q);const re=ne(Q.type);re&&this._fire(re.pointerover,{evt:Q,target:this,currentTarget:this})}_getTargetShape(Q){let re=this[Q+"targetShape"];return re&&!re.getStage()&&(re=null),re}_pointerleave(Q){const re=ne(Q.type),de=K(Q.type);if(!re)return;this.setPointersPositions(Q);const xe=this._getTargetShape(de),Re=!(c.Konva.isDragging()||c.Konva.isTransforming())||c.Konva.hitOnDragEnabled;xe&&Re?(xe._fireAndBubble(re.pointerout,{evt:Q}),xe._fireAndBubble(re.pointerleave,{evt:Q}),this._fire(re.pointerleave,{evt:Q,target:this,currentTarget:this}),this[de+"targetShape"]=null):Re&&(this._fire(re.pointerleave,{evt:Q,target:this,currentTarget:this}),this._fire(re.pointerout,{evt:Q,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(Q){const re=ne(Q.type),de=K(Q.type);if(!re)return;this.setPointersPositions(Q);let xe=!1;this._changedPointerPositions.forEach(Re=>{const be=this.getIntersection(Re);if(d.DD.justDragged=!1,c.Konva["_"+de+"ListenClick"]=!0,!be||!be.isListening()){this[de+"ClickStartShape"]=void 0;return}c.Konva.capturePointerEventsEnabled&&be.setPointerCapture(Re.id),this[de+"ClickStartShape"]=be,be._fireAndBubble(re.pointerdown,{evt:Q,pointerId:Re.id}),xe=!0;const Ye=Q.type.indexOf("touch")>=0;be.preventDefault()&&Q.cancelable&&Ye&&Q.preventDefault()}),xe||this._fire(re.pointerdown,{evt:Q,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(Q){const re=ne(Q.type),de=K(Q.type);if(!re||(c.Konva.isDragging()&&d.DD.node.preventDefault()&&Q.cancelable&&Q.preventDefault(),this.setPointersPositions(Q),!(!(c.Konva.isDragging()||c.Konva.isTransforming())||c.Konva.hitOnDragEnabled)))return;const Re={};let be=!1;const Ye=this._getTargetShape(de);this._changedPointerPositions.forEach(at=>{const Xe=g.getCapturedShape(at.id)||this.getIntersection(at),Pt=at.id,ht={evt:Q,pointerId:Pt},Pe=Ye!==Xe;if(Pe&&Ye&&(Ye._fireAndBubble(re.pointerout,{...ht},Xe),Ye._fireAndBubble(re.pointerleave,{...ht},Xe)),Xe){if(Re[Xe._id])return;Re[Xe._id]=!0}Xe&&Xe.isListening()?(be=!0,Pe&&(Xe._fireAndBubble(re.pointerover,{...ht},Ye),Xe._fireAndBubble(re.pointerenter,{...ht},Ye),this[de+"targetShape"]=Xe),Xe._fireAndBubble(re.pointermove,{...ht})):Ye&&(this._fire(re.pointerover,{evt:Q,target:this,currentTarget:this,pointerId:Pt}),this[de+"targetShape"]=null)}),be||this._fire(re.pointermove,{evt:Q,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(Q){const re=ne(Q.type),de=K(Q.type);if(!re)return;this.setPointersPositions(Q);const xe=this[de+"ClickStartShape"],Re=this[de+"ClickEndShape"],be={};let Ye=!1;this._changedPointerPositions.forEach(at=>{const Xe=g.getCapturedShape(at.id)||this.getIntersection(at);if(Xe){if(Xe.releaseCapture(at.id),be[Xe._id])return;be[Xe._id]=!0}const Pt=at.id,ht={evt:Q,pointerId:Pt};let Pe=!1;c.Konva["_"+de+"InDblClickWindow"]?(Pe=!0,clearTimeout(this[de+"DblTimeout"])):d.DD.justDragged||(c.Konva["_"+de+"InDblClickWindow"]=!0,clearTimeout(this[de+"DblTimeout"])),this[de+"DblTimeout"]=setTimeout(function(){c.Konva["_"+de+"InDblClickWindow"]=!1},c.Konva.dblClickWindow),Xe&&Xe.isListening()?(Ye=!0,this[de+"ClickEndShape"]=Xe,Xe._fireAndBubble(re.pointerup,{...ht}),c.Konva["_"+de+"ListenClick"]&&xe&&xe===Xe&&(Xe._fireAndBubble(re.pointerclick,{...ht}),Pe&&Re&&Re===Xe&&Xe._fireAndBubble(re.pointerdblclick,{...ht}))):(this[de+"ClickEndShape"]=null,c.Konva["_"+de+"ListenClick"]&&this._fire(re.pointerclick,{evt:Q,target:this,currentTarget:this,pointerId:Pt}),Pe&&this._fire(re.pointerdblclick,{evt:Q,target:this,currentTarget:this,pointerId:Pt}))}),Ye||this._fire(re.pointerup,{evt:Q,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),c.Konva["_"+de+"ListenClick"]=!1,Q.cancelable&&de!=="touch"&&Q.preventDefault()}_contextmenu(Q){this.setPointersPositions(Q);const re=this.getIntersection(this.getPointerPosition());re&&re.isListening()?re._fireAndBubble(J,{evt:Q}):this._fire(J,{evt:Q,target:this,currentTarget:this})}_wheel(Q){this.setPointersPositions(Q);const re=this.getIntersection(this.getPointerPosition());re&&re.isListening()?re._fireAndBubble(G,{evt:Q}):this._fire(G,{evt:Q,target:this,currentTarget:this})}_pointercancel(Q){this.setPointersPositions(Q);const re=g.getCapturedShape(Q.pointerId)||this.getIntersection(this.getPointerPosition());re&&re._fireAndBubble(L,g.createEvent(Q)),g.releaseCapture(Q.pointerId)}_lostpointercapture(Q){g.releaseCapture(Q.pointerId)}setPointersPositions(Q){let re=this._getContentPosition(),de=null,xe=null;Q=Q||window.event,Q.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(Q.touches,Re=>{this._pointerPositions.push({id:Re.identifier,x:(Re.clientX-re.left)/re.scaleX,y:(Re.clientY-re.top)/re.scaleY})}),Array.prototype.forEach.call(Q.changedTouches||Q.touches,Re=>{this._changedPointerPositions.push({id:Re.identifier,x:(Re.clientX-re.left)/re.scaleX,y:(Re.clientY-re.top)/re.scaleY})})):(de=(Q.clientX-re.left)/re.scaleX,xe=(Q.clientY-re.top)/re.scaleY,this.pointerPos={x:de,y:xe},this._pointerPositions=[{x:de,y:xe,id:r.Util._getFirstPointerId(Q)}],this._changedPointerPositions=[{x:de,y:xe,id:r.Util._getFirstPointerId(Q)}])}_setPointerPosition(Q){r.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(Q)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const Q=this.content.getBoundingClientRect();return{top:Q.top,left:Q.left,scaleX:Q.width/this.content.clientWidth||1,scaleY:Q.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new u.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new u.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!c.Konva.isBrowser)return;const Q=this.container();if(!Q)throw"Stage has no container. A container is required.";Q.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"),Q.appendChild(this.content),this._resizeDOM()}cache(){return r.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(Q){Q.batchDraw()}),this}}n.Stage=ue,ue.prototype.nodeType=m,(0,f._registerNode)(ue),o.Factory.addGetterSetter(ue,"container"),c.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{n.stages.forEach(pe=>{pe.batchDraw()})})})(Mf)),Mf}var jc={},Of={},c0;function tr(){return c0||(c0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Shape=n.shapes=void 0;const r=pt(),o=gn(),l=yt(),c=Rn(),u=wt(),d=pt(),f=Em(),g="hasShadow",m="shadowRGBA",y="patternImage",x="linearGradient",R="radialGradient";let w;function _(){return w||(w=o.Util.createCanvasElement().getContext("2d"),w)}n.shapes={};function b(U){const I=this.attrs.fillRule;I?U.fill(I):U.fill()}function E(U){U.stroke()}function z(U){const I=this.attrs.fillRule;I?U.fill(I):U.fill()}function F(U){U.stroke()}function k(){this._clearCache(g)}function N(){this._clearCache(m)}function L(){this._clearCache(y)}function j(){this._clearCache(x)}function Y(){this._clearCache(R)}class O extends c.Node{constructor(I){super(I);let V;for(;V=o.Util.getRandomColor(),!(V&&!(V in n.shapes)););this.colorKey=V,n.shapes[V]=this}getContext(){return o.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return o.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(g,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 V=_().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(V&&V.setTransform){const J=new o.Transform;J.translate(this.fillPatternX(),this.fillPatternY()),J.rotate(r.Konva.getAngle(this.fillPatternRotation())),J.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),J.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const A=J.getMatrix(),M=typeof DOMMatrix>"u"?{a:A[0],b:A[1],c:A[2],d:A[3],e:A[4],f:A[5]}:new DOMMatrix(A);V.setTransform(M)}return V}}_getLinearGradient(){return this._getCache(x,this.__getLinearGradient)}__getLinearGradient(){const I=this.fillLinearGradientColorStops();if(I){const V=_(),J=this.fillLinearGradientStartPoint(),A=this.fillLinearGradientEndPoint(),M=V.createLinearGradient(J.x,J.y,A.x,A.y);for(let T=0;T<I.length;T+=2)M.addColorStop(I[T],I[T+1]);return M}}_getRadialGradient(){return this._getCache(R,this.__getRadialGradient)}__getRadialGradient(){const I=this.fillRadialGradientColorStops();if(I){const V=_(),J=this.fillRadialGradientStartPoint(),A=this.fillRadialGradientEndPoint(),M=V.createRadialGradient(J.x,J.y,this.fillRadialGradientStartRadius(),A.x,A.y,this.fillRadialGradientEndRadius());for(let T=0;T<I.length;T+=2)M.addColorStop(I[T],I[T+1]);return M}}getShadowRGBA(){return this._getCache(m,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const I=o.Util.colorToRGBA(this.shadowColor());if(I)return"rgba("+I.r+","+I.g+","+I.b+","+I.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const I=this.hitStrokeWidth();return I==="auto"?this.hasStroke():this.strokeEnabled()&&!!I}intersects(I){const V=this.getStage();if(!V)return!1;const J=V.bufferHitCanvas;return J.getContext().clear(),this.drawHit(J,void 0,!0),J.context.getImageData(Math.round(I.x),Math.round(I.y),1,1).data[3]>0}destroy(){return c.Node.prototype.destroy.call(this),delete n.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(I){var V;if(!((V=this.attrs.perfectDrawEnabled)!==null&&V!==void 0?V:!0))return!1;const A=I||this.hasFill(),M=this.hasStroke(),T=this.getAbsoluteOpacity()!==1;if(A&&M&&T)return!0;const H=this.hasShadow(),G=this.shadowForStrokeEnabled();return!!(A&&M&&H&&G)}setStrokeHitEnabled(I){o.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),I?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const I=this.size();return{x:this._centroid?-I.width/2:0,y:this._centroid?-I.height/2:0,width:I.width,height:I.height}}getClientRect(I={}){let V=!1,J=this.getParent();for(;J;){if(J.isCached()){V=!0;break}J=J.getParent()}const A=I.skipTransform,M=I.relativeTo||V&&this.getStage()||void 0,T=this.getSelfRect(),G=!I.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,X=T.width+G,oe=T.height+G,te=!I.skipShadow&&this.hasShadow(),K=te?this.shadowOffsetX():0,ne=te?this.shadowOffsetY():0,se=X+Math.abs(K),$=oe+Math.abs(ne),ue=te&&this.shadowBlur()||0,pe=se+ue*2,Q=$+ue*2,re={width:pe,height:Q,x:-(G/2+ue)+Math.min(K,0)+T.x,y:-(G/2+ue)+Math.min(ne,0)+T.y};return A?re:this._transformedRect(re,M)}drawScene(I,V,J){const A=this.getLayer();let M=I||A.getCanvas(),T=M.getContext(),H=this._getCanvasCache(),G=this.getSceneFunc(),X=this.hasShadow(),oe,te;const K=M.isCache,ne=V===this;if(!this.isVisible()&&!ne)return this;if(H){T.save();const $=this.getAbsoluteTransform(V).getMatrix();return T.transform($[0],$[1],$[2],$[3],$[4],$[5]),this._drawCachedSceneCanvas(T),T.restore(),this}if(!G)return this;if(T.save(),this._useBufferCanvas()&&!K){oe=this.getStage();const $=J||oe.bufferCanvas;te=$.getContext(),te.clear(),te.save(),te._applyLineJoin(this);var se=this.getAbsoluteTransform(V).getMatrix();te.transform(se[0],se[1],se[2],se[3],se[4],se[5]),G.call(this,te,this),te.restore();const ue=$.pixelRatio;X&&T._applyShadow(this),T._applyOpacity(this),T._applyGlobalCompositeOperation(this),T.drawImage($._canvas,0,0,$.width/ue,$.height/ue)}else{if(T._applyLineJoin(this),!ne){var se=this.getAbsoluteTransform(V).getMatrix();T.transform(se[0],se[1],se[2],se[3],se[4],se[5]),T._applyOpacity(this),T._applyGlobalCompositeOperation(this)}X&&T._applyShadow(this),G.call(this,T,this)}return T.restore(),this}drawHit(I,V,J=!1){if(!this.shouldDrawHit(V,J))return this;const A=this.getLayer(),M=I||A.hitCanvas,T=M&&M.getContext(),H=this.hitFunc()||this.sceneFunc(),G=this._getCanvasCache(),X=G&&G.hit;if(this.colorKey||o.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()"),X){T.save();const te=this.getAbsoluteTransform(V).getMatrix();return T.transform(te[0],te[1],te[2],te[3],te[4],te[5]),this._drawCachedHitCanvas(T),T.restore(),this}if(!H)return this;if(T.save(),T._applyLineJoin(this),!(this===V)){const te=this.getAbsoluteTransform(V).getMatrix();T.transform(te[0],te[1],te[2],te[3],te[4],te[5])}return H.call(this,T,this),T.restore(),this}drawHitFromCache(I=0){let V=this._getCanvasCache(),J=this._getCachedSceneCanvas(),A=V.hit,M=A.getContext(),T=A.getWidth(),H=A.getHeight(),G,X,oe,te,K,ne;M.clear(),M.drawImage(J._canvas,0,0,T,H);try{for(G=M.getImageData(0,0,T,H),X=G.data,oe=X.length,te=o.Util._hexToRgb(this.colorKey),K=0;K<oe;K+=4)ne=X[K+3],ne>I?(X[K]=te.r,X[K+1]=te.g,X[K+2]=te.b,X[K+3]=255):X[K+3]=0;M.putImageData(G,0,0)}catch(se){o.Util.error("Unable to draw hit graph from cached scene canvas. "+se.message)}return this}hasPointerCapture(I){return f.hasPointerCapture(I,this)}setPointerCapture(I){f.setPointerCapture(I,this)}releaseCapture(I){f.releaseCapture(I,this)}}n.Shape=O,O.prototype._fillFunc=b,O.prototype._strokeFunc=E,O.prototype._fillFuncHit=z,O.prototype._strokeFuncHit=F,O.prototype._centroid=!1,O.prototype.nodeType="Shape",(0,d._registerNode)(O),O.prototype.eventListeners={},O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",k),O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",N),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",L),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",j),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",Y),l.Factory.addGetterSetter(O,"stroke",void 0,(0,u.getStringOrGradientValidator)()),l.Factory.addGetterSetter(O,"strokeWidth",2,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillAfterStrokeEnabled",!1),l.Factory.addGetterSetter(O,"hitStrokeWidth","auto",(0,u.getNumberOrAutoValidator)()),l.Factory.addGetterSetter(O,"strokeHitEnabled",!0,(0,u.getBooleanValidator)()),l.Factory.addGetterSetter(O,"perfectDrawEnabled",!0,(0,u.getBooleanValidator)()),l.Factory.addGetterSetter(O,"shadowForStrokeEnabled",!0,(0,u.getBooleanValidator)()),l.Factory.addGetterSetter(O,"lineJoin"),l.Factory.addGetterSetter(O,"lineCap"),l.Factory.addGetterSetter(O,"sceneFunc"),l.Factory.addGetterSetter(O,"hitFunc"),l.Factory.addGetterSetter(O,"dash"),l.Factory.addGetterSetter(O,"dashOffset",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"shadowColor",void 0,(0,u.getStringValidator)()),l.Factory.addGetterSetter(O,"shadowBlur",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"shadowOpacity",1,(0,u.getNumberValidator)()),l.Factory.addComponentsGetterSetter(O,"shadowOffset",["x","y"]),l.Factory.addGetterSetter(O,"shadowOffsetX",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"shadowOffsetY",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillPatternImage"),l.Factory.addGetterSetter(O,"fill",void 0,(0,u.getStringOrGradientValidator)()),l.Factory.addGetterSetter(O,"fillPatternX",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillPatternY",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillLinearGradientColorStops"),l.Factory.addGetterSetter(O,"strokeLinearGradientColorStops"),l.Factory.addGetterSetter(O,"fillRadialGradientStartRadius",0),l.Factory.addGetterSetter(O,"fillRadialGradientEndRadius",0),l.Factory.addGetterSetter(O,"fillRadialGradientColorStops"),l.Factory.addGetterSetter(O,"fillPatternRepeat","repeat"),l.Factory.addGetterSetter(O,"fillEnabled",!0),l.Factory.addGetterSetter(O,"strokeEnabled",!0),l.Factory.addGetterSetter(O,"shadowEnabled",!0),l.Factory.addGetterSetter(O,"dashEnabled",!0),l.Factory.addGetterSetter(O,"strokeScaleEnabled",!0),l.Factory.addGetterSetter(O,"fillPriority","color"),l.Factory.addComponentsGetterSetter(O,"fillPatternOffset",["x","y"]),l.Factory.addGetterSetter(O,"fillPatternOffsetX",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillPatternOffsetY",0,(0,u.getNumberValidator)()),l.Factory.addComponentsGetterSetter(O,"fillPatternScale",["x","y"]),l.Factory.addGetterSetter(O,"fillPatternScaleX",1,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillPatternScaleY",1,(0,u.getNumberValidator)()),l.Factory.addComponentsGetterSetter(O,"fillLinearGradientStartPoint",["x","y"]),l.Factory.addComponentsGetterSetter(O,"strokeLinearGradientStartPoint",["x","y"]),l.Factory.addGetterSetter(O,"fillLinearGradientStartPointX",0),l.Factory.addGetterSetter(O,"strokeLinearGradientStartPointX",0),l.Factory.addGetterSetter(O,"fillLinearGradientStartPointY",0),l.Factory.addGetterSetter(O,"strokeLinearGradientStartPointY",0),l.Factory.addComponentsGetterSetter(O,"fillLinearGradientEndPoint",["x","y"]),l.Factory.addComponentsGetterSetter(O,"strokeLinearGradientEndPoint",["x","y"]),l.Factory.addGetterSetter(O,"fillLinearGradientEndPointX",0),l.Factory.addGetterSetter(O,"strokeLinearGradientEndPointX",0),l.Factory.addGetterSetter(O,"fillLinearGradientEndPointY",0),l.Factory.addGetterSetter(O,"strokeLinearGradientEndPointY",0),l.Factory.addComponentsGetterSetter(O,"fillRadialGradientStartPoint",["x","y"]),l.Factory.addGetterSetter(O,"fillRadialGradientStartPointX",0),l.Factory.addGetterSetter(O,"fillRadialGradientStartPointY",0),l.Factory.addComponentsGetterSetter(O,"fillRadialGradientEndPoint",["x","y"]),l.Factory.addGetterSetter(O,"fillRadialGradientEndPointX",0),l.Factory.addGetterSetter(O,"fillRadialGradientEndPointY",0),l.Factory.addGetterSetter(O,"fillPatternRotation",0),l.Factory.addGetterSetter(O,"fillRule",void 0,(0,u.getStringValidator)()),l.Factory.backCompat(O,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Of)),Of}var u0;function bm(){if(u0)return jc;u0=1,Object.defineProperty(jc,"__esModule",{value:!0}),jc.Layer=void 0;const n=gn(),r=Rh(),o=Rn(),l=yt(),c=Fh(),u=wt(),d=tr(),f=pt(),g="#",m="beforeDraw",y="draw",x=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],R=x.length;class w extends r.Container{constructor(b){super(b),this.canvas=new c.SceneCanvas,this.hitCanvas=new c.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(b){return this.getContext().clear(b),this.getHitCanvas().getContext().clear(b),this}setZIndex(b){super.setZIndex(b);const E=this.getStage();return E&&E.content&&(E.content.removeChild(this.getNativeCanvasElement()),b<E.children.length-1?E.content.insertBefore(this.getNativeCanvasElement(),E.children[b+1].getCanvas()._canvas):E.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){o.Node.prototype.moveToTop.call(this);const b=this.getStage();return b&&b.content&&(b.content.removeChild(this.getNativeCanvasElement()),b.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!o.Node.prototype.moveUp.call(this))return!1;const E=this.getStage();return!E||!E.content?!1:(E.content.removeChild(this.getNativeCanvasElement()),this.index<E.children.length-1?E.content.insertBefore(this.getNativeCanvasElement(),E.children[this.index+1].getCanvas()._canvas):E.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(o.Node.prototype.moveDown.call(this)){const b=this.getStage();if(b){const E=b.children;b.content&&(b.content.removeChild(this.getNativeCanvasElement()),b.content.insertBefore(this.getNativeCanvasElement(),E[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(o.Node.prototype.moveToBottom.call(this)){const b=this.getStage();if(b){const E=b.children;b.content&&(b.content.removeChild(this.getNativeCanvasElement()),b.content.insertBefore(this.getNativeCanvasElement(),E[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const b=this.getNativeCanvasElement();return o.Node.prototype.remove.call(this),b&&b.parentNode&&n.Util._isInDocument(b)&&b.parentNode.removeChild(b),this}getStage(){return this.parent}setSize({width:b,height:E}){return this.canvas.setSize(b,E),this.hitCanvas.setSize(b,E),this._setSmoothEnabled(),this}_validateAdd(b){const E=b.getType();E!=="Group"&&E!=="Shape"&&n.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(b){return b=b||{},b.width=b.width||this.getWidth(),b.height=b.height||this.getHeight(),b.x=b.x!==void 0?b.x:this.x(),b.y=b.y!==void 0?b.y:this.y(),o.Node.prototype._toKonvaCanvas.call(this,b)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){n.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){n.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,n.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(b){if(!this.isListening()||!this.isVisible())return null;let E=1,z=!1;for(;;){for(let F=0;F<R;F++){const k=x[F],N=this._getIntersection({x:b.x+k.x*E,y:b.y+k.y*E}),L=N.shape;if(L)return L;if(z=!!N.antialiased,!N.antialiased)break}if(z)E+=1;else return null}}_getIntersection(b){const E=this.hitCanvas.pixelRatio,z=this.hitCanvas.context.getImageData(Math.round(b.x*E),Math.round(b.y*E),1,1).data,F=z[3];if(F===255){const k=n.Util._rgbToHex(z[0],z[1],z[2]),N=d.shapes[g+k];return N?{shape:N}:{antialiased:!0}}else if(F>0)return{antialiased:!0};return{}}drawScene(b,E){const z=this.getLayer(),F=b||z&&z.getCanvas();return this._fire(m,{node:this}),this.clearBeforeDraw()&&F.getContext().clear(),r.Container.prototype.drawScene.call(this,F,E),this._fire(y,{node:this}),this}drawHit(b,E){const z=this.getLayer(),F=b||z&&z.hitCanvas;return z&&z.clearBeforeDraw()&&z.getHitCanvas().getContext().clear(),r.Container.prototype.drawHit.call(this,F,E),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(b){n.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(b)}getHitGraphEnabled(b){return n.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const b=this.parent;!!this.hitCanvas._canvas.parentNode?b.content.removeChild(this.hitCanvas._canvas):b.content.appendChild(this.hitCanvas._canvas)}destroy(){return n.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}return jc.Layer=w,w.prototype.nodeType="Layer",(0,f._registerNode)(w),l.Factory.addGetterSetter(w,"imageSmoothingEnabled",!0),l.Factory.addGetterSetter(w,"clearBeforeDraw",!0),l.Factory.addGetterSetter(w,"hitGraphEnabled",!0,(0,u.getBooleanValidator)()),jc}var Uc={},d0;function M4(){if(d0)return Uc;d0=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.FastLayer=void 0;const n=gn(),r=bm(),o=pt();let l=class extends r.Layer{constructor(u){super(u),this.listening(!1),n.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};return Uc.FastLayer=l,l.prototype.nodeType="FastLayer",(0,o._registerNode)(l),Uc}var Bc={},h0;function Sp(){if(h0)return Bc;h0=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.Group=void 0;const n=gn(),r=Rh(),o=pt();class l extends r.Container{_validateAdd(u){const d=u.getType();d!=="Group"&&d!=="Shape"&&n.Util.throw("You may only add groups and shapes to groups.")}}return Bc.Group=l,l.prototype.nodeType="Group",(0,o._registerNode)(l),Bc}var Gc={},f0;function kp(){if(f0)return Gc;f0=1,Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.Animation=void 0;const n=pt(),r=gn(),o=(function(){return n.glob.performance&&n.glob.performance.now?function(){return n.glob.performance.now()}:function(){return new Date().getTime()}})();let l=class Rl{constructor(u,d){this.id=Rl.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:o(),frameRate:0},this.func=u,this.setLayers(d)}setLayers(u){let d=[];return u&&(d=Array.isArray(u)?u:[u]),this.layers=d,this}getLayers(){return this.layers}addLayer(u){const d=this.layers,f=d.length;for(let g=0;g<f;g++)if(d[g]._id===u._id)return!1;return this.layers.push(u),!0}isRunning(){const d=Rl.animations,f=d.length;for(let g=0;g<f;g++)if(d[g].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=o(),Rl._addAnimation(this),this}stop(){return Rl._removeAnimation(this),this}_updateFrameObject(u){this.frame.timeDiff=u-this.frame.lastTime,this.frame.lastTime=u,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(u){this.animations.push(u),this._handleAnimation()}static _removeAnimation(u){const d=u.id,f=this.animations,g=f.length;for(let m=0;m<g;m++)if(f[m].id===d){this.animations.splice(m,1);break}}static _runFrames(){const u={},d=this.animations;for(let f=0;f<d.length;f++){const g=d[f],m=g.layers,y=g.func;g._updateFrameObject(o());const x=m.length;let R;if(y?R=y.call(g,g.frame)!==!1:R=!0,!!R)for(let w=0;w<x;w++){const _=m[w];_._id!==void 0&&(u[_._id]=_)}}for(const f in u)u.hasOwnProperty(f)&&u[f].batchDraw()}static _animationLoop(){const u=Rl;u.animations.length?(u._runFrames(),r.Util.requestAnimFrame(u._animationLoop)):u.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,r.Util.requestAnimFrame(this._animationLoop))}};return Gc.Animation=l,l.animations=[],l.animIdCounter=0,l.animRunning=!1,Gc}var If={},p0;function O4(){return p0||(p0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Easings=n.Tween=void 0;const r=gn(),o=kp(),l=Rn(),c=pt();let u={node:1,duration:1,easing:1,onFinish:1,yoyo:1},d=1,f=2,g=3,m=0,y=["fill","stroke","shadowColor"];class x{constructor(_,b,E,z,F,k,N){this.prop=_,this.propFunc=b,this.begin=z,this._pos=z,this.duration=k,this._change=0,this.prevPos=0,this.yoyo=N,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=E,this._change=F-this.begin,this.pause()}fire(_){const b=this[_];b&&b()}setTime(_){_>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():_<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=_,this.update())}getTime(){return this._time}setPosition(_){this.prevPos=this._pos,this.propFunc(_),this._pos=_}getPosition(_){return _===void 0&&(_=this._time),this.func(_,this.begin,this._change,this.duration)}play(){this.state=f,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=g,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(_){this.pause(),this._time=_,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 _=this.getTimer()-this._startTime;this.state===f?this.setTime(_):this.state===g&&this.setTime(this.duration-_)}pause(){this.state=d,this.fire("onPause")}getTimer(){return new Date().getTime()}}class R{constructor(_){let b=this,E=_.node,z=E._id,F,k=_.easing||n.Easings.Linear,N=!!_.yoyo,L;typeof _.duration>"u"?F=.3:_.duration===0?F=.001:F=_.duration,this.node=E,this._id=m++;const j=E.getLayer()||(E instanceof c.Konva.Stage?E.getLayers():null);j||r.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new o.Animation(function(){b.tween.onEnterFrame()},j),this.tween=new x(L,function(Y){b._tweenFunc(Y)},k,0,1,F*1e3,N),this._addListeners(),R.attrs[z]||(R.attrs[z]={}),R.attrs[z][this._id]||(R.attrs[z][this._id]={}),R.tweens[z]||(R.tweens[z]={});for(L in _)u[L]===void 0&&this._addAttr(L,_[L]);this.reset(),this.onFinish=_.onFinish,this.onReset=_.onReset,this.onUpdate=_.onUpdate}_addAttr(_,b){let E=this.node,z=E._id,F,k,N,L,j,Y,O,U;if(N=R.tweens[z][_],N&&delete R.attrs[z][N][_],F=E.getAttr(_),r.Util._isArray(b))if(k=[],j=Math.max(b.length,F.length),_==="points"&&b.length!==F.length&&(b.length>F.length?(O=F,F=r.Util._prepareArrayForTween(F,b,E.closed())):(Y=b,b=r.Util._prepareArrayForTween(b,F,E.closed()))),_.indexOf("fill")===0)for(L=0;L<j;L++)if(L%2===0)k.push(b[L]-F[L]);else{const I=r.Util.colorToRGBA(F[L]);U=r.Util.colorToRGBA(b[L]),F[L]=I,k.push({r:U.r-I.r,g:U.g-I.g,b:U.b-I.b,a:U.a-I.a})}else for(L=0;L<j;L++)k.push(b[L]-F[L]);else y.indexOf(_)!==-1?(F=r.Util.colorToRGBA(F),U=r.Util.colorToRGBA(b),k={r:U.r-F.r,g:U.g-F.g,b:U.b-F.b,a:U.a-F.a}):k=b-F;R.attrs[z][this._id][_]={start:F,diff:k,end:b,trueEnd:Y,trueStart:O},R.tweens[z][_]=this._id}_tweenFunc(_){let b=this.node,E=R.attrs[b._id][this._id],z,F,k,N,L,j,Y,O;for(z in E){if(F=E[z],k=F.start,N=F.diff,O=F.end,r.Util._isArray(k))if(L=[],Y=Math.max(k.length,O.length),z.indexOf("fill")===0)for(j=0;j<Y;j++)j%2===0?L.push((k[j]||0)+N[j]*_):L.push("rgba("+Math.round(k[j].r+N[j].r*_)+","+Math.round(k[j].g+N[j].g*_)+","+Math.round(k[j].b+N[j].b*_)+","+(k[j].a+N[j].a*_)+")");else for(j=0;j<Y;j++)L.push((k[j]||0)+N[j]*_);else y.indexOf(z)!==-1?L="rgba("+Math.round(k.r+N.r*_)+","+Math.round(k.g+N.g*_)+","+Math.round(k.b+N.b*_)+","+(k.a+N.a*_)+")":L=k+N*_;b.setAttr(z,L)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const _=this.node,b=R.attrs[_._id][this._id];b.points&&b.points.trueEnd&&_.setAttr("points",b.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const _=this.node,b=R.attrs[_._id][this._id];b.points&&b.points.trueStart&&_.points(b.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(_){return this.tween.seek(_*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let _=this.node._id,b=this._id,E=R.tweens[_],z;this.pause();for(z in E)delete R.tweens[_][z];delete R.attrs[_][b]}}n.Tween=R,R.attrs={},R.tweens={},l.Node.prototype.to=function(w){const _=w.onFinish;w.node=this,w.onFinish=function(){this.destroy(),_&&_()},new R(w).play()},n.Easings={BackEaseIn(w,_,b,E){return b*(w/=E)*w*((1.70158+1)*w-1.70158)+_},BackEaseOut(w,_,b,E){return b*((w=w/E-1)*w*((1.70158+1)*w+1.70158)+1)+_},BackEaseInOut(w,_,b,E){let z=1.70158;return(w/=E/2)<1?b/2*(w*w*(((z*=1.525)+1)*w-z))+_:b/2*((w-=2)*w*(((z*=1.525)+1)*w+z)+2)+_},ElasticEaseIn(w,_,b,E,z,F){let k=0;return w===0?_:(w/=E)===1?_+b:(F||(F=E*.3),!z||z<Math.abs(b)?(z=b,k=F/4):k=F/(2*Math.PI)*Math.asin(b/z),-(z*Math.pow(2,10*(w-=1))*Math.sin((w*E-k)*(2*Math.PI)/F))+_)},ElasticEaseOut(w,_,b,E,z,F){let k=0;return w===0?_:(w/=E)===1?_+b:(F||(F=E*.3),!z||z<Math.abs(b)?(z=b,k=F/4):k=F/(2*Math.PI)*Math.asin(b/z),z*Math.pow(2,-10*w)*Math.sin((w*E-k)*(2*Math.PI)/F)+b+_)},ElasticEaseInOut(w,_,b,E,z,F){let k=0;return w===0?_:(w/=E/2)===2?_+b:(F||(F=E*(.3*1.5)),!z||z<Math.abs(b)?(z=b,k=F/4):k=F/(2*Math.PI)*Math.asin(b/z),w<1?-.5*(z*Math.pow(2,10*(w-=1))*Math.sin((w*E-k)*(2*Math.PI)/F))+_:z*Math.pow(2,-10*(w-=1))*Math.sin((w*E-k)*(2*Math.PI)/F)*.5+b+_)},BounceEaseOut(w,_,b,E){return(w/=E)<1/2.75?b*(7.5625*w*w)+_:w<2/2.75?b*(7.5625*(w-=1.5/2.75)*w+.75)+_:w<2.5/2.75?b*(7.5625*(w-=2.25/2.75)*w+.9375)+_:b*(7.5625*(w-=2.625/2.75)*w+.984375)+_},BounceEaseIn(w,_,b,E){return b-n.Easings.BounceEaseOut(E-w,0,b,E)+_},BounceEaseInOut(w,_,b,E){return w<E/2?n.Easings.BounceEaseIn(w*2,0,b,E)*.5+_:n.Easings.BounceEaseOut(w*2-E,0,b,E)*.5+b*.5+_},EaseIn(w,_,b,E){return b*(w/=E)*w+_},EaseOut(w,_,b,E){return-b*(w/=E)*(w-2)+_},EaseInOut(w,_,b,E){return(w/=E/2)<1?b/2*w*w+_:-b/2*(--w*(w-2)-1)+_},StrongEaseIn(w,_,b,E){return b*(w/=E)*w*w*w*w+_},StrongEaseOut(w,_,b,E){return b*((w=w/E-1)*w*w*w*w+1)+_},StrongEaseInOut(w,_,b,E){return(w/=E/2)<1?b/2*w*w*w*w*w+_:b/2*((w-=2)*w*w*w*w+2)+_},Linear(w,_,b,E){return b*w/E+_}}})(If)),If}var g0;function ip(){return g0||(g0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Konva=void 0;const r=pt(),o=gn(),l=Rn(),c=Rh(),u=z4(),d=bm(),f=M4(),g=Sp(),m=wp(),y=tr(),x=kp(),R=O4(),w=Rm(),_=Fh();n.Konva=o.Util._assign(r.Konva,{Util:o.Util,Transform:o.Transform,Node:l.Node,Container:c.Container,Stage:u.Stage,stages:u.stages,Layer:d.Layer,FastLayer:f.FastLayer,Group:g.Group,DD:m.DD,Shape:y.Shape,shapes:y.shapes,Animation:x.Animation,Tween:R.Tween,Easings:R.Easings,Context:w.Context,Canvas:_.Canvas}),n.default=n.Konva})(Nf)),Nf}var Hc={},m0;function I4(){if(m0)return Hc;m0=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.Arc=void 0;const n=yt(),r=tr(),o=pt(),l=wt(),c=pt();let u=class extends r.Shape{_sceneFunc(f){const g=o.Konva.getAngle(this.angle()),m=this.clockwise();f.beginPath(),f.arc(0,0,this.outerRadius(),0,g,m),f.arc(0,0,this.innerRadius(),g,0,!m),f.closePath(),f.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(f){this.outerRadius(f/2)}setHeight(f){this.outerRadius(f/2)}getSelfRect(){const f=this.innerRadius(),g=this.outerRadius(),m=this.clockwise(),y=o.Konva.getAngle(m?360-this.angle():this.angle()),x=Math.cos(Math.min(y,Math.PI)),R=1,w=Math.sin(Math.min(Math.max(Math.PI,y),3*Math.PI/2)),_=Math.sin(Math.min(y,Math.PI/2)),b=x*(x>0?f:g),E=R*g,z=w*(w>0?f:g),F=_*(_>0?g:f);return{x:b,y:m?-1*F:z,width:E-b,height:F-z}}};return Hc.Arc=u,u.prototype._centroid=!0,u.prototype.className="Arc",u.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,c._registerNode)(u),n.Factory.addGetterSetter(u,"innerRadius",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"outerRadius",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"angle",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"clockwise",!1,(0,l.getBooleanValidator)()),Hc}var Vc={},Wc={},v0;function Pm(){if(v0)return Wc;v0=1,Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.Line=void 0;const n=yt(),r=pt(),o=tr(),l=wt();function c(f,g,m,y,x,R,w){const _=Math.sqrt(Math.pow(m-f,2)+Math.pow(y-g,2)),b=Math.sqrt(Math.pow(x-m,2)+Math.pow(R-y,2)),E=w*_/(_+b),z=w*b/(_+b),F=m-E*(x-f),k=y-E*(R-g),N=m+z*(x-f),L=y+z*(R-g);return[F,k,N,L]}function u(f,g){const m=f.length,y=[];for(let x=2;x<m-2;x+=2){const R=c(f[x-2],f[x-1],f[x],f[x+1],f[x+2],f[x+3],g);isNaN(R[0])||(y.push(R[0]),y.push(R[1]),y.push(f[x]),y.push(f[x+1]),y.push(R[2]),y.push(R[3]))}return y}class d extends o.Shape{constructor(g){super(g),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(g){let m=this.points(),y=m.length,x=this.tension(),R=this.closed(),w=this.bezier(),_,b,E;if(y){if(g.beginPath(),g.moveTo(m[0],m[1]),x!==0&&y>4){for(_=this.getTensionPoints(),b=_.length,E=R?0:4,R||g.quadraticCurveTo(_[0],_[1],_[2],_[3]);E<b-2;)g.bezierCurveTo(_[E++],_[E++],_[E++],_[E++],_[E++],_[E++]);R||g.quadraticCurveTo(_[b-2],_[b-1],m[y-2],m[y-1])}else if(w)for(E=2;E<y;)g.bezierCurveTo(m[E++],m[E++],m[E++],m[E++],m[E++],m[E++]);else for(E=2;E<y;E+=2)g.lineTo(m[E],m[E+1]);R?(g.closePath(),g.fillStrokeShape(this)):g.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():u(this.points(),this.tension())}_getTensionPointsClosed(){const g=this.points(),m=g.length,y=this.tension(),x=c(g[m-2],g[m-1],g[0],g[1],g[2],g[3],y),R=c(g[m-4],g[m-3],g[m-2],g[m-1],g[0],g[1],y),w=u(g,y);return[x[2],x[3]].concat(w).concat([R[0],R[1],g[m-2],g[m-1],R[2],R[3],x[0],x[1],g[0],g[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let g=this.points();if(g.length<4)return{x:g[0]||0,y:g[1]||0,width:0,height:0};this.tension()!==0?g=[g[0],g[1],...this._getTensionPoints(),g[g.length-2],g[g.length-1]]:g=this.points();let m=g[0],y=g[0],x=g[1],R=g[1],w,_;for(let b=0;b<g.length/2;b++)w=g[b*2],_=g[b*2+1],m=Math.min(m,w),y=Math.max(y,w),x=Math.min(x,_),R=Math.max(R,_);return{x:m,y:x,width:y-m,height:R-x}}}return Wc.Line=d,d.prototype.className="Line",d.prototype._attrsAffectingSize=["points","bezier","tension"],(0,r._registerNode)(d),n.Factory.addGetterSetter(d,"closed",!1),n.Factory.addGetterSetter(d,"bezier",!1),n.Factory.addGetterSetter(d,"tension",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(d,"points",[],(0,l.getNumberArrayValidator)()),Wc}var Kc={},jf={},y0;function j4(){return y0||(y0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.t2length=n.getQuadraticArcLength=n.getCubicArcLength=n.binomialCoefficients=n.cValues=n.tValues=void 0,n.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],n.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],n.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const r=(d,f,g)=>{let m,y;const R=g/2;m=0;for(let w=0;w<20;w++)y=R*n.tValues[20][w]+R,m+=n.cValues[20][w]*l(d,f,y);return R*m};n.getCubicArcLength=r;const o=(d,f,g)=>{g===void 0&&(g=1);const m=d[0]-2*d[1]+d[2],y=f[0]-2*f[1]+f[2],x=2*d[1]-2*d[0],R=2*f[1]-2*f[0],w=4*(m*m+y*y),_=4*(m*x+y*R),b=x*x+R*R;if(w===0)return g*Math.sqrt(Math.pow(d[2]-d[0],2)+Math.pow(f[2]-f[0],2));const E=_/(2*w),z=b/w,F=g+E,k=z-E*E,N=F*F+k>0?Math.sqrt(F*F+k):0,L=E*E+k>0?Math.sqrt(E*E+k):0,j=E+Math.sqrt(E*E+k)!==0?k*Math.log(Math.abs((F+N)/(E+L))):0;return Math.sqrt(w)/2*(F*N-E*L+j)};n.getQuadraticArcLength=o;function l(d,f,g){const m=c(1,g,d),y=c(1,g,f),x=m*m+y*y;return Math.sqrt(x)}const c=(d,f,g)=>{const m=g.length-1;let y,x;if(m===0)return 0;if(d===0){x=0;for(let R=0;R<=m;R++)x+=n.binomialCoefficients[m][R]*Math.pow(1-f,m-R)*Math.pow(f,R)*g[R];return x}else{y=new Array(m);for(let R=0;R<m;R++)y[R]=m*(g[R+1]-g[R]);return c(d-1,f,y)}},u=(d,f,g)=>{let m=1,y=d/f,x=(d-g(y))/f,R=0;for(;m>.001;){const w=g(y+x),_=Math.abs(d-w)/f;if(_<m)m=_,y+=x;else{const b=g(y-x),E=Math.abs(d-b)/f;E<m?(m=E,y-=x):x/=2}if(R++,R>500)break}return y};n.t2length=u})(jf)),jf}var x0;function _p(){if(x0)return Kc;x0=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.Path=void 0;const n=yt(),r=tr(),o=pt(),l=j4();let c=class Xr extends r.Shape{constructor(d){super(d),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Xr.parsePathData(this.data()),this.pathLength=Xr.getPathLength(this.dataArray)}_sceneFunc(d){const f=this.dataArray;d.beginPath();let g=!1;for(let N=0;N<f.length;N++){const L=f[N].command,j=f[N].points;switch(L){case"L":d.lineTo(j[0],j[1]);break;case"M":d.moveTo(j[0],j[1]);break;case"C":d.bezierCurveTo(j[0],j[1],j[2],j[3],j[4],j[5]);break;case"Q":d.quadraticCurveTo(j[0],j[1],j[2],j[3]);break;case"A":var m=j[0],y=j[1],x=j[2],R=j[3],w=j[4],_=j[5],b=j[6],E=j[7],z=x>R?x:R,F=x>R?1:x/R,k=x>R?R/x:1;d.translate(m,y),d.rotate(b),d.scale(F,k),d.arc(0,0,z,w,w+_,1-E),d.scale(1/F,1/k),d.rotate(-b),d.translate(-m,-y);break;case"z":g=!0,d.closePath();break}}!g&&!this.hasFill()?d.strokeShape(this):d.fillStrokeShape(this)}getSelfRect(){let d=[];this.dataArray.forEach(function(w){if(w.command==="A"){const _=w.points[4],b=w.points[5],E=w.points[4]+b;let z=Math.PI/180;if(Math.abs(_-E)<z&&(z=Math.abs(_-E)),b<0)for(let F=_-z;F>E;F-=z){const k=Xr.getPointOnEllipticalArc(w.points[0],w.points[1],w.points[2],w.points[3],F,0);d.push(k.x,k.y)}else for(let F=_+z;F<E;F+=z){const k=Xr.getPointOnEllipticalArc(w.points[0],w.points[1],w.points[2],w.points[3],F,0);d.push(k.x,k.y)}}else if(w.command==="C")for(let _=0;_<=1;_+=.01){const b=Xr.getPointOnCubicBezier(_,w.start.x,w.start.y,w.points[0],w.points[1],w.points[2],w.points[3],w.points[4],w.points[5]);d.push(b.x,b.y)}else d=d.concat(w.points)});let f=d[0],g=d[0],m=d[1],y=d[1],x,R;for(let w=0;w<d.length/2;w++)x=d[w*2],R=d[w*2+1],isNaN(x)||(f=Math.min(f,x),g=Math.max(g,x)),isNaN(R)||(m=Math.min(m,R),y=Math.max(y,R));return{x:f,y:m,width:g-f,height:y-m}}getLength(){return this.pathLength}getPointAtLength(d){return Xr.getPointAtLengthOfDataArray(d,this.dataArray)}static getLineLength(d,f,g,m){return Math.sqrt((g-d)*(g-d)+(m-f)*(m-f))}static getPathLength(d){let f=0;for(let g=0;g<d.length;++g)f+=d[g].pathLength;return f}static getPointAtLengthOfDataArray(d,f){let g,m=0,y=f.length;if(!y)return null;for(;m<y&&d>f[m].pathLength;)d-=f[m].pathLength,++m;if(m===y)return g=f[m-1].points.slice(-2),{x:g[0],y:g[1]};if(d<.01)return g=f[m].points.slice(0,2),{x:g[0],y:g[1]};const x=f[m],R=x.points;switch(x.command){case"L":return Xr.getPointOnLine(d,x.start.x,x.start.y,R[0],R[1]);case"C":return Xr.getPointOnCubicBezier((0,l.t2length)(d,Xr.getPathLength(f),N=>(0,l.getCubicArcLength)([x.start.x,R[0],R[2],R[4]],[x.start.y,R[1],R[3],R[5]],N)),x.start.x,x.start.y,R[0],R[1],R[2],R[3],R[4],R[5]);case"Q":return Xr.getPointOnQuadraticBezier((0,l.t2length)(d,Xr.getPathLength(f),N=>(0,l.getQuadraticArcLength)([x.start.x,R[0],R[2]],[x.start.y,R[1],R[3]],N)),x.start.x,x.start.y,R[0],R[1],R[2],R[3]);case"A":var w=R[0],_=R[1],b=R[2],E=R[3],z=R[4],F=R[5],k=R[6];return z+=F*d/x.pathLength,Xr.getPointOnEllipticalArc(w,_,b,E,z,k)}return null}static getPointOnLine(d,f,g,m,y,x,R){x=x??f,R=R??g;const w=this.getLineLength(f,g,m,y);if(w<1e-10)return{x:f,y:g};if(m===f)return{x,y:R+(y>g?d:-d)};const _=(y-g)/(m-f),b=Math.sqrt(d*d/(1+_*_))*(m<f?-1:1),E=_*b;if(Math.abs(R-g-_*(x-f))<1e-10)return{x:x+b,y:R+E};const z=((x-f)*(m-f)+(R-g)*(y-g))/(w*w),F=f+z*(m-f),k=g+z*(y-g),N=this.getLineLength(x,R,F,k),L=Math.sqrt(d*d-N*N),j=Math.sqrt(L*L/(1+_*_))*(m<f?-1:1),Y=_*j;return{x:F+j,y:k+Y}}static getPointOnCubicBezier(d,f,g,m,y,x,R,w,_){function b(L){return L*L*L}function E(L){return 3*L*L*(1-L)}function z(L){return 3*L*(1-L)*(1-L)}function F(L){return(1-L)*(1-L)*(1-L)}const k=w*b(d)+x*E(d)+m*z(d)+f*F(d),N=_*b(d)+R*E(d)+y*z(d)+g*F(d);return{x:k,y:N}}static getPointOnQuadraticBezier(d,f,g,m,y,x,R){function w(F){return F*F}function _(F){return 2*F*(1-F)}function b(F){return(1-F)*(1-F)}const E=x*w(d)+m*_(d)+f*b(d),z=R*w(d)+y*_(d)+g*b(d);return{x:E,y:z}}static getPointOnEllipticalArc(d,f,g,m,y,x){const R=Math.cos(x),w=Math.sin(x),_={x:g*Math.cos(y),y:m*Math.sin(y)};return{x:d+(_.x*R-_.y*w),y:f+(_.x*w+_.y*R)}}static parsePathData(d){if(!d)return[];let f=d;const g=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];f=f.replace(new RegExp(" ","g"),",");for(var m=0;m<g.length;m++)f=f.replace(new RegExp(g[m],"g"),"|"+g[m]);const y=f.split("|"),x=[],R=[];let w=0,_=0;const b=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let E;for(m=1;m<y.length;m++){let A=y[m],M=A.charAt(0);for(A=A.slice(1),R.length=0;E=b.exec(A);)R.push(E[0]);const T=[];for(let H=0,G=R.length;H<G;H++){if(R[H]==="00"){T.push(0,0);continue}const X=parseFloat(R[H]);isNaN(X)?T.push(0):T.push(X)}for(;T.length>0&&!isNaN(T[0]);){let H="",G=[];const X=w,oe=_;var z,F,k,N,L,j,Y,O,U,I;switch(M){case"l":w+=T.shift(),_+=T.shift(),H="L",G.push(w,_);break;case"L":w=T.shift(),_=T.shift(),G.push(w,_);break;case"m":var V=T.shift(),J=T.shift();if(w+=V,_+=J,H="M",x.length>2&&x[x.length-1].command==="z"){for(let te=x.length-2;te>=0;te--)if(x[te].command==="M"){w=x[te].points[0]+V,_=x[te].points[1]+J;break}}G.push(w,_),M="l";break;case"M":w=T.shift(),_=T.shift(),H="M",G.push(w,_),M="L";break;case"h":w+=T.shift(),H="L",G.push(w,_);break;case"H":w=T.shift(),H="L",G.push(w,_);break;case"v":_+=T.shift(),H="L",G.push(w,_);break;case"V":_=T.shift(),H="L",G.push(w,_);break;case"C":G.push(T.shift(),T.shift(),T.shift(),T.shift()),w=T.shift(),_=T.shift(),G.push(w,_);break;case"c":G.push(w+T.shift(),_+T.shift(),w+T.shift(),_+T.shift()),w+=T.shift(),_+=T.shift(),H="C",G.push(w,_);break;case"S":F=w,k=_,z=x[x.length-1],z.command==="C"&&(F=w+(w-z.points[2]),k=_+(_-z.points[3])),G.push(F,k,T.shift(),T.shift()),w=T.shift(),_=T.shift(),H="C",G.push(w,_);break;case"s":F=w,k=_,z=x[x.length-1],z.command==="C"&&(F=w+(w-z.points[2]),k=_+(_-z.points[3])),G.push(F,k,w+T.shift(),_+T.shift()),w+=T.shift(),_+=T.shift(),H="C",G.push(w,_);break;case"Q":G.push(T.shift(),T.shift()),w=T.shift(),_=T.shift(),G.push(w,_);break;case"q":G.push(w+T.shift(),_+T.shift()),w+=T.shift(),_+=T.shift(),H="Q",G.push(w,_);break;case"T":F=w,k=_,z=x[x.length-1],z.command==="Q"&&(F=w+(w-z.points[0]),k=_+(_-z.points[1])),w=T.shift(),_=T.shift(),H="Q",G.push(F,k,w,_);break;case"t":F=w,k=_,z=x[x.length-1],z.command==="Q"&&(F=w+(w-z.points[0]),k=_+(_-z.points[1])),w+=T.shift(),_+=T.shift(),H="Q",G.push(F,k,w,_);break;case"A":N=T.shift(),L=T.shift(),j=T.shift(),Y=T.shift(),O=T.shift(),U=w,I=_,w=T.shift(),_=T.shift(),H="A",G=this.convertEndpointToCenterParameterization(U,I,w,_,Y,O,N,L,j);break;case"a":N=T.shift(),L=T.shift(),j=T.shift(),Y=T.shift(),O=T.shift(),U=w,I=_,w+=T.shift(),_+=T.shift(),H="A",G=this.convertEndpointToCenterParameterization(U,I,w,_,Y,O,N,L,j);break}x.push({command:H||M,points:G,start:{x:X,y:oe},pathLength:this.calcLength(X,oe,H||M,G)})}(M==="z"||M==="Z")&&x.push({command:"z",points:[],start:void 0,pathLength:0})}return x}static calcLength(d,f,g,m){let y,x,R,w;const _=Xr;switch(g){case"L":return _.getLineLength(d,f,m[0],m[1]);case"C":return(0,l.getCubicArcLength)([d,m[0],m[2],m[4]],[f,m[1],m[3],m[5]],1);case"Q":return(0,l.getQuadraticArcLength)([d,m[0],m[2]],[f,m[1],m[3]],1);case"A":y=0;var b=m[4],E=m[5],z=m[4]+E,F=Math.PI/180;if(Math.abs(b-z)<F&&(F=Math.abs(b-z)),x=_.getPointOnEllipticalArc(m[0],m[1],m[2],m[3],b,0),E<0)for(w=b-F;w>z;w-=F)R=_.getPointOnEllipticalArc(m[0],m[1],m[2],m[3],w,0),y+=_.getLineLength(x.x,x.y,R.x,R.y),x=R;else for(w=b+F;w<z;w+=F)R=_.getPointOnEllipticalArc(m[0],m[1],m[2],m[3],w,0),y+=_.getLineLength(x.x,x.y,R.x,R.y),x=R;return R=_.getPointOnEllipticalArc(m[0],m[1],m[2],m[3],z,0),y+=_.getLineLength(x.x,x.y,R.x,R.y),y}return 0}static convertEndpointToCenterParameterization(d,f,g,m,y,x,R,w,_){const b=_*(Math.PI/180),E=Math.cos(b)*(d-g)/2+Math.sin(b)*(f-m)/2,z=-1*Math.sin(b)*(d-g)/2+Math.cos(b)*(f-m)/2,F=E*E/(R*R)+z*z/(w*w);F>1&&(R*=Math.sqrt(F),w*=Math.sqrt(F));let k=Math.sqrt((R*R*(w*w)-R*R*(z*z)-w*w*(E*E))/(R*R*(z*z)+w*w*(E*E)));y===x&&(k*=-1),isNaN(k)&&(k=0);const N=k*R*z/w,L=k*-w*E/R,j=(d+g)/2+Math.cos(b)*N-Math.sin(b)*L,Y=(f+m)/2+Math.sin(b)*N+Math.cos(b)*L,O=function(T){return Math.sqrt(T[0]*T[0]+T[1]*T[1])},U=function(T,H){return(T[0]*H[0]+T[1]*H[1])/(O(T)*O(H))},I=function(T,H){return(T[0]*H[1]<T[1]*H[0]?-1:1)*Math.acos(U(T,H))},V=I([1,0],[(E-N)/R,(z-L)/w]),J=[(E-N)/R,(z-L)/w],A=[(-1*E-N)/R,(-1*z-L)/w];let M=I(J,A);return U(J,A)<=-1&&(M=Math.PI),U(J,A)>=1&&(M=0),x===0&&M>0&&(M=M-2*Math.PI),x===1&&M<0&&(M=M+2*Math.PI),[j,Y,R,w,V,M,b,x]}};return Kc.Path=c,c.prototype.className="Path",c.prototype._attrsAffectingSize=["data"],(0,o._registerNode)(c),n.Factory.addGetterSetter(c,"data"),Kc}var w0;function U4(){if(w0)return Vc;w0=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.Arrow=void 0;const n=yt(),r=Pm(),o=wt(),l=pt(),c=_p();let u=class extends r.Line{_sceneFunc(f){super._sceneFunc(f);const g=Math.PI*2,m=this.points();let y=m;const x=this.tension()!==0&&m.length>4;x&&(y=this.getTensionPoints());const R=this.pointerLength(),w=m.length;let _,b;if(x){const F=[y[y.length-4],y[y.length-3],y[y.length-2],y[y.length-1],m[w-2],m[w-1]],k=c.Path.calcLength(y[y.length-4],y[y.length-3],"C",F),N=c.Path.getPointOnQuadraticBezier(Math.min(1,1-R/k),F[0],F[1],F[2],F[3],F[4],F[5]);_=m[w-2]-N.x,b=m[w-1]-N.y}else _=m[w-2]-m[w-4],b=m[w-1]-m[w-3];const E=(Math.atan2(b,_)+g)%g,z=this.pointerWidth();this.pointerAtEnding()&&(f.save(),f.beginPath(),f.translate(m[w-2],m[w-1]),f.rotate(E),f.moveTo(0,0),f.lineTo(-R,z/2),f.lineTo(-R,-z/2),f.closePath(),f.restore(),this.__fillStroke(f)),this.pointerAtBeginning()&&(f.save(),f.beginPath(),f.translate(m[0],m[1]),x?(_=(y[0]+y[2])/2-m[0],b=(y[1]+y[3])/2-m[1]):(_=m[2]-m[0],b=m[3]-m[1]),f.rotate((Math.atan2(-b,-_)+g)%g),f.moveTo(0,0),f.lineTo(-R,z/2),f.lineTo(-R,-z/2),f.closePath(),f.restore(),this.__fillStroke(f))}__fillStroke(f){const g=this.dashEnabled();g&&(this.attrs.dashEnabled=!1,f.setLineDash([])),f.fillStrokeShape(this),g&&(this.attrs.dashEnabled=!0)}getSelfRect(){const f=super.getSelfRect(),g=this.pointerWidth()/2;return{x:f.x-g,y:f.y-g,width:f.width+g*2,height:f.height+g*2}}};return Vc.Arrow=u,u.prototype.className="Arrow",(0,l._registerNode)(u),n.Factory.addGetterSetter(u,"pointerLength",10,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(u,"pointerWidth",10,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(u,"pointerAtBeginning",!1),n.Factory.addGetterSetter(u,"pointerAtEnding",!0),Vc}var qc={},S0;function B4(){if(S0)return qc;S0=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.Circle=void 0;const n=yt(),r=tr(),o=wt(),l=pt();let c=class extends r.Shape{_sceneFunc(d){d.beginPath(),d.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),d.closePath(),d.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(d){this.radius()!==d/2&&this.radius(d/2)}setHeight(d){this.radius()!==d/2&&this.radius(d/2)}};return qc.Circle=c,c.prototype._centroid=!0,c.prototype.className="Circle",c.prototype._attrsAffectingSize=["radius"],(0,l._registerNode)(c),n.Factory.addGetterSetter(c,"radius",0,(0,o.getNumberValidator)()),qc}var Yc={},k0;function G4(){if(k0)return Yc;k0=1,Object.defineProperty(Yc,"__esModule",{value:!0}),Yc.Ellipse=void 0;const n=yt(),r=tr(),o=wt(),l=pt();let c=class extends r.Shape{_sceneFunc(d){const f=this.radiusX(),g=this.radiusY();d.beginPath(),d.save(),f!==g&&d.scale(1,g/f),d.arc(0,0,f,0,Math.PI*2,!1),d.restore(),d.closePath(),d.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(d){this.radiusX(d/2)}setHeight(d){this.radiusY(d/2)}};return Yc.Ellipse=c,c.prototype.className="Ellipse",c.prototype._centroid=!0,c.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,l._registerNode)(c),n.Factory.addComponentsGetterSetter(c,"radius",["x","y"]),n.Factory.addGetterSetter(c,"radiusX",0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(c,"radiusY",0,(0,o.getNumberValidator)()),Yc}var Xc={},_0;function H4(){if(_0)return Xc;_0=1,Object.defineProperty(Xc,"__esModule",{value:!0}),Xc.Image=void 0;const n=gn(),r=yt(),o=tr(),l=pt(),c=wt();class u extends o.Shape{constructor(f){super(f),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const f=this.image();f&&f.complete||f&&f.readyState===4||f&&f.addEventListener&&f.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){const f=!!this.cornerRadius(),g=this.hasShadow();return f&&g?!0:super._useBufferCanvas(!0)}_sceneFunc(f){const g=this.getWidth(),m=this.getHeight(),y=this.cornerRadius(),x=this.attrs.image;let R;if(x){const w=this.attrs.cropWidth,_=this.attrs.cropHeight;w&&_?R=[x,this.cropX(),this.cropY(),w,_,0,0,g,m]:R=[x,0,0,g,m]}(this.hasFill()||this.hasStroke()||y)&&(f.beginPath(),y?n.Util.drawRoundedRectPath(f,g,m,y):f.rect(0,0,g,m),f.closePath(),f.fillStrokeShape(this)),x&&(y&&f.clip(),f.drawImage.apply(f,R))}_hitFunc(f){const g=this.width(),m=this.height(),y=this.cornerRadius();f.beginPath(),y?n.Util.drawRoundedRectPath(f,g,m,y):f.rect(0,0,g,m),f.closePath(),f.fillStrokeShape(this)}getWidth(){var f,g;return(f=this.attrs.width)!==null&&f!==void 0?f:(g=this.image())===null||g===void 0?void 0:g.width}getHeight(){var f,g;return(f=this.attrs.height)!==null&&f!==void 0?f:(g=this.image())===null||g===void 0?void 0:g.height}static fromURL(f,g,m=null){const y=n.Util.createImageElement();y.onload=function(){const x=new u({image:y});g(x)},y.onerror=m,y.crossOrigin="Anonymous",y.src=f}}return Xc.Image=u,u.prototype.className="Image",(0,l._registerNode)(u),r.Factory.addGetterSetter(u,"cornerRadius",0,(0,c.getNumberOrArrayOfNumbersValidator)(4)),r.Factory.addGetterSetter(u,"image"),r.Factory.addComponentsGetterSetter(u,"crop",["x","y","width","height"]),r.Factory.addGetterSetter(u,"cropX",0,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(u,"cropY",0,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(u,"cropWidth",0,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(u,"cropHeight",0,(0,c.getNumberValidator)()),Xc}var wa={},C0;function V4(){if(C0)return wa;C0=1,Object.defineProperty(wa,"__esModule",{value:!0}),wa.Tag=wa.Label=void 0;const n=yt(),r=tr(),o=Sp(),l=wt(),c=pt(),u=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],d="Change.konva",f="none",g="up",m="right",y="down",x="left",R=u.length;let w=class extends o.Group{constructor(E){super(E),this.on("add.konva",function(z){this._addListeners(z.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(E){let z=this,F;const k=function(){z._sync()};for(F=0;F<R;F++)E.on(u[F]+d,k)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let E=this.getText(),z=this.getTag(),F,k,N,L,j,Y,O;if(E&&z){switch(F=E.width(),k=E.height(),N=z.pointerDirection(),L=z.pointerWidth(),O=z.pointerHeight(),j=0,Y=0,N){case g:j=F/2,Y=-1*O;break;case m:j=F+L,Y=k/2;break;case y:j=F/2,Y=k+O;break;case x:j=-1*L,Y=k/2;break}z.setAttrs({x:-1*j,y:-1*Y,width:F,height:k}),E.setAttrs({x:-1*j,y:-1*Y})}}};wa.Label=w,w.prototype.className="Label",(0,c._registerNode)(w);class _ extends r.Shape{_sceneFunc(E){const z=this.width(),F=this.height(),k=this.pointerDirection(),N=this.pointerWidth(),L=this.pointerHeight(),j=this.cornerRadius();let Y=0,O=0,U=0,I=0;typeof j=="number"?Y=O=U=I=Math.min(j,z/2,F/2):(Y=Math.min(j[0]||0,z/2,F/2),O=Math.min(j[1]||0,z/2,F/2),I=Math.min(j[2]||0,z/2,F/2),U=Math.min(j[3]||0,z/2,F/2)),E.beginPath(),E.moveTo(Y,0),k===g&&(E.lineTo((z-N)/2,0),E.lineTo(z/2,-1*L),E.lineTo((z+N)/2,0)),E.lineTo(z-O,0),E.arc(z-O,O,O,Math.PI*3/2,0,!1),k===m&&(E.lineTo(z,(F-L)/2),E.lineTo(z+N,F/2),E.lineTo(z,(F+L)/2)),E.lineTo(z,F-I),E.arc(z-I,F-I,I,0,Math.PI/2,!1),k===y&&(E.lineTo((z+N)/2,F),E.lineTo(z/2,F+L),E.lineTo((z-N)/2,F)),E.lineTo(U,F),E.arc(U,F-U,U,Math.PI/2,Math.PI,!1),k===x&&(E.lineTo(0,(F+L)/2),E.lineTo(-1*N,F/2),E.lineTo(0,(F-L)/2)),E.lineTo(0,Y),E.arc(Y,Y,Y,Math.PI,Math.PI*3/2,!1),E.closePath(),E.fillStrokeShape(this)}getSelfRect(){let E=0,z=0,F=this.pointerWidth(),k=this.pointerHeight(),N=this.pointerDirection(),L=this.width(),j=this.height();return N===g?(z-=k,j+=k):N===y?j+=k:N===x?(E-=F*1.5,L+=F):N===m&&(L+=F*1.5),{x:E,y:z,width:L,height:j}}}return wa.Tag=_,_.prototype.className="Tag",(0,c._registerNode)(_),n.Factory.addGetterSetter(_,"pointerDirection",f),n.Factory.addGetterSetter(_,"pointerWidth",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(_,"pointerHeight",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(_,"cornerRadius",0,(0,l.getNumberOrArrayOfNumbersValidator)(4)),wa}var Qc={},F0;function Am(){if(F0)return Qc;F0=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.Rect=void 0;const n=yt(),r=tr(),o=pt(),l=gn(),c=wt();class u extends r.Shape{_sceneFunc(f){const g=this.cornerRadius(),m=this.width(),y=this.height();f.beginPath(),g?l.Util.drawRoundedRectPath(f,m,y,g):f.rect(0,0,m,y),f.closePath(),f.fillStrokeShape(this)}}return Qc.Rect=u,u.prototype.className="Rect",(0,o._registerNode)(u),n.Factory.addGetterSetter(u,"cornerRadius",0,(0,c.getNumberOrArrayOfNumbersValidator)(4)),Qc}var $c={},R0;function W4(){if(R0)return $c;R0=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.RegularPolygon=void 0;const n=yt(),r=tr(),o=wt(),l=pt();let c=class extends r.Shape{_sceneFunc(d){const f=this._getPoints();d.beginPath(),d.moveTo(f[0].x,f[0].y);for(let g=1;g<f.length;g++)d.lineTo(f[g].x,f[g].y);d.closePath(),d.fillStrokeShape(this)}_getPoints(){const d=this.attrs.sides,f=this.attrs.radius||0,g=[];for(let m=0;m<d;m++)g.push({x:f*Math.sin(m*2*Math.PI/d),y:-1*f*Math.cos(m*2*Math.PI/d)});return g}getSelfRect(){const d=this._getPoints();let f=d[0].x,g=d[0].y,m=d[0].x,y=d[0].y;return d.forEach(x=>{f=Math.min(f,x.x),g=Math.max(g,x.x),m=Math.min(m,x.y),y=Math.max(y,x.y)}),{x:f,y:m,width:g-f,height:y-m}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(d){this.radius(d/2)}setHeight(d){this.radius(d/2)}};return $c.RegularPolygon=c,c.prototype.className="RegularPolygon",c.prototype._centroid=!0,c.prototype._attrsAffectingSize=["radius"],(0,l._registerNode)(c),n.Factory.addGetterSetter(c,"radius",0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(c,"sides",0,(0,o.getNumberValidator)()),$c}var Jc={},E0;function K4(){if(E0)return Jc;E0=1,Object.defineProperty(Jc,"__esModule",{value:!0}),Jc.Ring=void 0;const n=yt(),r=tr(),o=wt(),l=pt(),c=Math.PI*2;let u=class extends r.Shape{_sceneFunc(f){f.beginPath(),f.arc(0,0,this.innerRadius(),0,c,!1),f.moveTo(this.outerRadius(),0),f.arc(0,0,this.outerRadius(),c,0,!0),f.closePath(),f.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(f){this.outerRadius(f/2)}setHeight(f){this.outerRadius(f/2)}};return Jc.Ring=u,u.prototype.className="Ring",u.prototype._centroid=!0,u.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,l._registerNode)(u),n.Factory.addGetterSetter(u,"innerRadius",0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(u,"outerRadius",0,(0,o.getNumberValidator)()),Jc}var Zc={},b0;function q4(){if(b0)return Zc;b0=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.Sprite=void 0;const n=yt(),r=tr(),o=kp(),l=wt(),c=pt();let u=class extends r.Shape{constructor(f){super(f),this._updated=!0,this.anim=new o.Animation(()=>{const g=this._updated;return this._updated=!1,g}),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(f){const g=this.animation(),m=this.frameIndex(),y=m*4,x=this.animations()[g],R=this.frameOffsets(),w=x[y+0],_=x[y+1],b=x[y+2],E=x[y+3],z=this.image();if((this.hasFill()||this.hasStroke())&&(f.beginPath(),f.rect(0,0,b,E),f.closePath(),f.fillStrokeShape(this)),z)if(R){const F=R[g],k=m*2;f.drawImage(z,w,_,b,E,F[k+0],F[k+1],b,E)}else f.drawImage(z,w,_,b,E,0,0,b,E)}_hitFunc(f){const g=this.animation(),m=this.frameIndex(),y=m*4,x=this.animations()[g],R=this.frameOffsets(),w=x[y+2],_=x[y+3];if(f.beginPath(),R){const b=R[g],E=m*2;f.rect(b[E+0],b[E+1],w,_)}else f.rect(0,0,w,_);f.closePath(),f.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const f=this;this.interval=setInterval(function(){f._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const f=this.getLayer();this.anim.setLayers(f),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const f=this.frameIndex(),g=this.animation(),m=this.animations(),y=m[g],x=y.length/4;f<x-1?this.frameIndex(f+1):this.frameIndex(0)}};return Zc.Sprite=u,u.prototype.className="Sprite",(0,c._registerNode)(u),n.Factory.addGetterSetter(u,"animation"),n.Factory.addGetterSetter(u,"animations"),n.Factory.addGetterSetter(u,"frameOffsets"),n.Factory.addGetterSetter(u,"image"),n.Factory.addGetterSetter(u,"frameIndex",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"frameRate",17,(0,l.getNumberValidator)()),n.Factory.backCompat(u,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"}),Zc}var eu={},P0;function Y4(){if(P0)return eu;P0=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.Star=void 0;const n=yt(),r=tr(),o=wt(),l=pt();let c=class extends r.Shape{_sceneFunc(d){const f=this.innerRadius(),g=this.outerRadius(),m=this.numPoints();d.beginPath(),d.moveTo(0,0-g);for(let y=1;y<m*2;y++){const x=y%2===0?g:f,R=x*Math.sin(y*Math.PI/m),w=-1*x*Math.cos(y*Math.PI/m);d.lineTo(R,w)}d.closePath(),d.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(d){this.outerRadius(d/2)}setHeight(d){this.outerRadius(d/2)}};return eu.Star=c,c.prototype.className="Star",c.prototype._centroid=!0,c.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,l._registerNode)(c),n.Factory.addGetterSetter(c,"numPoints",5,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(c,"innerRadius",0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(c,"outerRadius",0,(0,o.getNumberValidator)()),eu}var _l={},A0;function Nm(){if(A0)return _l;A0=1,Object.defineProperty(_l,"__esModule",{value:!0}),_l.Text=void 0,_l.stringToArray=d;const n=gn(),r=yt(),o=tr(),l=pt(),c=wt(),u=pt();function d(ne){return[...ne].reduce((se,$,ue,pe)=>(new RegExp("\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?(?:\\u200D\\p{Emoji_Presentation})+","u").test($)?se.push($):new RegExp("\\p{Regional_Indicator}{2}","u").test($+(pe[ue+1]||""))?se.push($+pe[ue+1]):ue>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test($)?se[se.length-1]+=$:se.push($),se),[])}const f="auto",g="center",m="inherit",y="justify",x="Change.konva",R="2d",w="-",_="left",b="text",E="Text",z="top",F="bottom",k="middle",N="normal",L="px ",j=" ",Y="right",O="rtl",U="word",I="char",V="none",J="…",A=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],M=A.length;function T(ne){return ne.split(",").map(se=>{se=se.trim();const $=se.indexOf(" ")>=0,ue=se.indexOf('"')>=0||se.indexOf("'")>=0;return $&&!ue&&(se=`"${se}"`),se}).join(", ")}let H;function G(){return H||(H=n.Util.createCanvasElement().getContext(R),H)}function X(ne){ne.fillText(this._partialText,this._partialTextX,this._partialTextY)}function oe(ne){ne.setAttr("miterLimit",2),ne.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function te(ne){return ne=ne||{},!ne.fillLinearGradientColorStops&&!ne.fillRadialGradientColorStops&&!ne.fillPatternImage&&(ne.fill=ne.fill||"black"),ne}let K=class extends o.Shape{constructor(se){super(te(se)),this._partialTextX=0,this._partialTextY=0;for(let $=0;$<M;$++)this.on(A[$]+x,this._setTextData);this._setTextData()}_sceneFunc(se){const $=this.textArr,ue=$.length;if(!this.text())return;let pe=this.padding(),Q=this.fontSize(),re=this.lineHeight()*Q,de=this.verticalAlign(),xe=this.direction(),Re=0,be=this.align(),Ye=this.getWidth(),at=this.letterSpacing(),Xe=this.fill(),Pt=this.textDecoration(),ht=Pt.indexOf("underline")!==-1,Pe=Pt.indexOf("line-through")!==-1,De;xe=xe===m?se.direction:xe;let Te=re/2,qe=k;if(l.Konva._fixTextRendering){const lt=this.measureSize("M");qe="alphabetic",Te=(lt.fontBoundingBoxAscent-lt.fontBoundingBoxDescent)/2+re/2}var He=0,Ve=0;for(xe===O&&se.setAttr("direction",xe),se.setAttr("font",this._getContextFont()),se.setAttr("textBaseline",qe),se.setAttr("textAlign",_),de===k?Re=(this.getHeight()-ue*re-pe*2)/2:de===F&&(Re=this.getHeight()-ue*re-pe*2),se.translate(pe,Re+pe),De=0;De<ue;De++){var He=0,Ve=0,Ze=$[De],tt=Ze.text,ke=Ze.width,Qe=Ze.lastInParagraph,rt,St,ut;if(se.save(),be===Y?He+=Ye-ke-pe*2:be===g&&(He+=(Ye-ke-pe*2)/2),ht){se.save(),se.beginPath();const We=l.Konva._fixTextRendering?Math.round(Q/4):Math.round(Q/2),Ct=He,et=Te+Ve+We;se.moveTo(Ct,et),rt=tt.split(" ").length-1,St=rt===0,ut=be===y&&!Qe?Ye-pe*2:ke,se.lineTo(Ct+Math.round(ut),et),se.lineWidth=Q/15;const En=this._getLinearGradient();se.strokeStyle=En||Xe,se.stroke(),se.restore()}if(Pe){se.save(),se.beginPath();const We=l.Konva._fixTextRendering?-Math.round(Q/4):0;se.moveTo(He,Te+Ve+We),rt=tt.split(" ").length-1,St=rt===0,ut=be===y&&Qe&&!St?Ye-pe*2:ke,se.lineTo(He+Math.round(ut),Te+Ve+We),se.lineWidth=Q/15;const Ct=this._getLinearGradient();se.strokeStyle=Ct||Xe,se.stroke(),se.restore()}if(xe!==O&&(at!==0||be===y)){rt=tt.split(" ").length-1;const We=d(tt);for(let Ct=0;Ct<We.length;Ct++){const et=We[Ct];et===" "&&!Qe&&be===y&&(He+=(Ye-pe*2-ke)/rt),this._partialTextX=He,this._partialTextY=Te+Ve,this._partialText=et,se.fillStrokeShape(this),He+=this.measureSize(et).width+at}}else at!==0&&se.setAttr("letterSpacing",`${at}px`),this._partialTextX=He,this._partialTextY=Te+Ve,this._partialText=tt,se.fillStrokeShape(this);se.restore(),ue>1&&(Te+=re)}}_hitFunc(se){const $=this.getWidth(),ue=this.getHeight();se.beginPath(),se.rect(0,0,$,ue),se.closePath(),se.fillStrokeShape(this)}setText(se){const $=n.Util._isString(se)?se:se==null?"":se+"";return this._setAttr(b,$),this}getWidth(){return this.attrs.width===f||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===f||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return n.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(se){var $,ue,pe,Q,re,de,xe,Re,be,Ye,at;let Xe=G(),Pt=this.fontSize(),ht;Xe.save(),Xe.font=this._getContextFont(),ht=Xe.measureText(se),Xe.restore();const Pe=Pt/100;return{actualBoundingBoxAscent:($=ht.actualBoundingBoxAscent)!==null&&$!==void 0?$:71.58203125*Pe,actualBoundingBoxDescent:(ue=ht.actualBoundingBoxDescent)!==null&&ue!==void 0?ue:0,actualBoundingBoxLeft:(pe=ht.actualBoundingBoxLeft)!==null&&pe!==void 0?pe:-7.421875*Pe,actualBoundingBoxRight:(Q=ht.actualBoundingBoxRight)!==null&&Q!==void 0?Q:75.732421875*Pe,alphabeticBaseline:(re=ht.alphabeticBaseline)!==null&&re!==void 0?re:0,emHeightAscent:(de=ht.emHeightAscent)!==null&&de!==void 0?de:100*Pe,emHeightDescent:(xe=ht.emHeightDescent)!==null&&xe!==void 0?xe:-20*Pe,fontBoundingBoxAscent:(Re=ht.fontBoundingBoxAscent)!==null&&Re!==void 0?Re:91*Pe,fontBoundingBoxDescent:(be=ht.fontBoundingBoxDescent)!==null&&be!==void 0?be:21*Pe,hangingBaseline:(Ye=ht.hangingBaseline)!==null&&Ye!==void 0?Ye:72.80000305175781*Pe,ideographicBaseline:(at=ht.ideographicBaseline)!==null&&at!==void 0?at:-21*Pe,width:ht.width,height:Pt}}_getContextFont(){return this.fontStyle()+j+this.fontVariant()+j+(this.fontSize()+L)+T(this.fontFamily())}_addTextLine(se){this.align()===y&&(se=se.trim());const ue=this._getTextWidth(se);return this.textArr.push({text:se,width:ue,lastInParagraph:!1})}_getTextWidth(se){const $=this.letterSpacing(),ue=se.length;return G().measureText(se).width+(ue?$*(ue-1):0)}_setTextData(){let se=this.text().split(`
|
|
159
|
+
*/var W2;function z3(){if(W2)return bf;W2=1;var n=Pl();function r(x,R){return x===R&&(x!==0||1/x===1/R)||x!==x&&R!==R}var o=typeof Object.is=="function"?Object.is:r,l=n.useState,c=n.useEffect,u=n.useLayoutEffect,d=n.useDebugValue;function f(x,R){var w=R(),_=l({inst:{value:w,getSnapshot:R}}),b=_[0].inst,E=_[1];return u(function(){b.value=w,b.getSnapshot=R,g(b)&&E({inst:b})},[x,w,R]),c(function(){return g(b)&&E({inst:b}),x(function(){g(b)&&E({inst:b})})},[x]),d(w),w}function g(x){var R=x.getSnapshot;x=x.value;try{var w=R();return!o(x,w)}catch{return!0}}function m(x,R){return R()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:f;return bf.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:y,bf}var K2;function M3(){return K2||(K2=1,Ef.exports=z3()),Ef.exports}var O3=M3();const I3=(n,r)=>Sa(r)?r:_3(r)&&Sa(r.defaultValue)?r.defaultValue:Array.isArray(n)?n[n.length-1]:n,j3={t:I3,ready:!1},U3=()=>()=>{},Dl=(n,r={})=>{var U,I,V;const{i18n:o}=r,{i18n:l,defaultNS:c}=q.useContext(L3)||{},u=o||l||N3();u&&!u.reportNamespaces&&(u.reportNamespaces=new T3),u||cm(u,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const d=q.useMemo(()=>{var J;return{...P3(),...(J=u==null?void 0:u.options)==null?void 0:J.react,...r}},[u,r]),{useSuspense:f,keyPrefix:g}=d,m=c||((U=u==null?void 0:u.options)==null?void 0:U.defaultNS),y=Sa(m)?[m]:m||["translation"],x=q.useMemo(()=>y,y);(V=(I=u==null?void 0:u.reportNamespaces)==null?void 0:I.addUsedNamespaces)==null||V.call(I,x);const R=q.useRef(0),w=q.useCallback(J=>{if(!u)return U3;const{bindI18n:A,bindI18nStore:M}=d,T=()=>{R.current+=1,J()};return A&&u.on(A,T),M&&u.store.on(M,T),()=>{A&&A.split(" ").forEach(H=>u.off(H,T)),M&&M.split(" ").forEach(H=>u.store.off(H,T))}},[u,d]),_=q.useRef(),b=q.useCallback(()=>{if(!u)return j3;const J=!!(u.isInitialized||u.initializedStoreOnce)&&x.every(X=>k3(X,u,d)),A=r.lng||u.language,M=R.current,T=_.current;if(T&&T.ready===J&&T.lng===A&&T.keyPrefix===g&&T.revision===M)return T;const G={t:u.getFixedT(A,d.nsMode==="fallback"?x:x[0],g),ready:J,lng:A,keyPrefix:g,revision:M};return _.current=G,G},[u,x,g,d,r.lng]),[E,z]=q.useState(0),{t:F,ready:k}=O3.useSyncExternalStore(w,b,b);q.useEffect(()=>{if(u&&!k&&!f){const J=()=>z(A=>A+1);r.lng?V2(u,r.lng,x,J):ep(u,x,J)}},[u,r.lng,x,k,f,E]);const N=u||{},L=q.useRef(null),j=q.useRef(),Y=J=>{const A=Object.getOwnPropertyDescriptors(J);A.__original&&delete A.__original;const M=Object.create(Object.getPrototypeOf(J),A);if(!Object.prototype.hasOwnProperty.call(M,"__original"))try{Object.defineProperty(M,"__original",{value:J,writable:!1,enumerable:!1,configurable:!1})}catch{}return M},O=q.useMemo(()=>{const J=N,A=J==null?void 0:J.language;let M=J;J&&(L.current&&L.current.__original===J?j.current!==A?(M=Y(J),L.current=M,j.current=A):M=L.current:(M=Y(J),L.current=M,j.current=A));const T=[F,M,k];return T.t=F,T.i18n=M,T.ready=k,T},[F,N,k,N.resolvedLanguage,N.language,N.languages]);if(u&&f&&!k)throw new Promise(J=>{const A=()=>J();r.lng?V2(u,r.lng,x,A):ep(u,x,A)});return O},B3=({isOpen:n,onClose:r,onConfirm:o,defaultPath:l,defaultFileName:c})=>{const{t:u}=Dl(),[d,f]=q.useState("image/jpeg"),[g,m]=q.useState(95),[y,x]=q.useState(""),[R,w]=q.useState("");return q.useEffect(()=>{if(n){f("image/jpeg"),m(95);const _={"image/jpeg":".jpg"},b=u("common.copySuffix",{defaultValue:"_copy"}),E=_["image/jpeg"];if(l){const z=l.replace(/\.[^/.]+$/,"");x(`${z}${b}${E}`),w("")}else{const z=c?c.replace(/\.[^/.]+$/,""):"image";w(`${z}${b}${E}`),x("")}}},[n,l,c,u]),q.useEffect(()=>{const b={"image/jpeg":".jpg","image/png":".png","image/webp":".webp"}[d];b&&(y&&x(E=>E.replace(/\.[^/.]+$/,b)),R&&w(E=>E.replace(/\.[^/.]+$/,b)))},[d]),n?Z.jsx("div",{"trae-inspector-start-line":"70","trae-inspector-start-column":"4","trae-inspector-end-line":"148","trae-inspector-end-column":"10","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:Z.jsxs("div",{"trae-inspector-start-line":"71","trae-inspector-start-column":"6","trae-inspector-end-line":"147","trae-inspector-end-column":"12","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"bg-zinc-900 border border-zinc-800 rounded-lg shadow-xl w-96 p-4",children:[Z.jsxs("div",{"trae-inspector-start-line":"72","trae-inspector-start-column":"8","trae-inspector-end-line":"77","trae-inspector-end-column":"14","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex justify-between items-center mb-4",children:[Z.jsx("h3",{"trae-inspector-start-line":"73","trae-inspector-start-column":"10","trae-inspector-end-line":"73","trae-inspector-end-column":"85","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-zinc-100 font-semibold",children:u("common.saveSettings")}),Z.jsx("button",{"trae-inspector-start-line":"74","trae-inspector-start-column":"10","trae-inspector-end-line":"76","trae-inspector-end-column":"19","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:r,className:"text-zinc-400 hover:text-white",children:Z.jsx(sm,{size:18})})]}),Z.jsxs("div",{"trae-inspector-start-line":"79","trae-inspector-start-column":"8","trae-inspector-end-line":"146","trae-inspector-end-column":"14","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-4",children:[l?Z.jsxs("div",{"trae-inspector-start-line":"81","trae-inspector-start-column":"13","trae-inspector-end-line":"89","trae-inspector-end-column":"19","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-2",children:[Z.jsx("label",{"trae-inspector-start-line":"82","trae-inspector-start-column":"16","trae-inspector-end-line":"82","trae-inspector-end-column":"93","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-xs text-zinc-400 block",children:u("common.savePath")}),Z.jsx("input",{"trae-inspector-start-line":"83","trae-inspector-start-column":"16","trae-inspector-end-line":"88","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",type:"text",value:y,onChange:_=>x(_.target.value),className:"w-full bg-zinc-800 text-zinc-100 p-2 rounded border border-zinc-700 outline-none text-sm font-mono"})]}):Z.jsxs("div",{"trae-inspector-start-line":"91","trae-inspector-start-column":"13","trae-inspector-end-line":"99","trae-inspector-end-column":"19","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-2",children:[Z.jsx("label",{"trae-inspector-start-line":"92","trae-inspector-start-column":"16","trae-inspector-end-line":"92","trae-inspector-end-column":"93","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-xs text-zinc-400 block",children:u("common.fileName")}),Z.jsx("input",{"trae-inspector-start-line":"93","trae-inspector-start-column":"16","trae-inspector-end-line":"98","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",type:"text",value:R,onChange:_=>w(_.target.value),className:"w-full bg-zinc-800 text-zinc-100 p-2 rounded border border-zinc-700 outline-none text-sm"})]}),Z.jsxs("div",{"trae-inspector-start-line":"102","trae-inspector-start-column":"10","trae-inspector-end-line":"113","trae-inspector-end-column":"16","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-2",children:[Z.jsx("label",{"trae-inspector-start-line":"103","trae-inspector-start-column":"12","trae-inspector-end-line":"103","trae-inspector-end-column":"87","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-xs text-zinc-400 block",children:u("common.format")}),Z.jsxs("select",{"trae-inspector-start-line":"104","trae-inspector-start-column":"12","trae-inspector-end-line":"112","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",value:d,onChange:_=>f(_.target.value),className:"w-full bg-zinc-800 text-zinc-100 p-2 rounded border border-zinc-700 outline-none text-sm",children:[Z.jsx("option",{"trae-inspector-start-line":"109","trae-inspector-start-column":"14","trae-inspector-end-line":"109","trae-inspector-end-column":"53","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22text%22%3A%22JPG%22%2C%22textStartLine%22%3A%22109%22%2C%22textStartColumn%22%3A%2241%22%2C%22textEndLine%22%3A%22109%22%2C%22textEndColumn%22%3A%2244%22%2C%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",value:"image/jpeg",children:"JPG"}),Z.jsx("option",{"trae-inspector-start-line":"110","trae-inspector-start-column":"14","trae-inspector-end-line":"110","trae-inspector-end-column":"52","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22text%22%3A%22PNG%22%2C%22textStartLine%22%3A%22110%22%2C%22textStartColumn%22%3A%2240%22%2C%22textEndLine%22%3A%22110%22%2C%22textEndColumn%22%3A%2243%22%2C%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",value:"image/png",children:"PNG"}),Z.jsx("option",{"trae-inspector-start-line":"111","trae-inspector-start-column":"14","trae-inspector-end-line":"111","trae-inspector-end-column":"54","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22text%22%3A%22WEBP%22%2C%22textStartLine%22%3A%22111%22%2C%22textStartColumn%22%3A%2241%22%2C%22textEndLine%22%3A%22111%22%2C%22textEndColumn%22%3A%2245%22%2C%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",value:"image/webp",children:"WEBP"})]})]}),d!=="image/png"&&Z.jsxs("div",{"trae-inspector-start-line":"116","trae-inspector-start-column":"12","trae-inspector-end-line":"129","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"space-y-2",children:[Z.jsxs("div",{"trae-inspector-start-line":"117","trae-inspector-start-column":"14","trae-inspector-end-line":"120","trae-inspector-end-column":"20","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex justify-between text-xs text-zinc-400",children:[Z.jsx("span",{"trae-inspector-start-line":"118","trae-inspector-start-column":"16","trae-inspector-end-line":"118","trae-inspector-end-column":"50","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",children:u("common.quality")}),Z.jsx("span",{"trae-inspector-start-line":"119","trae-inspector-start-column":"16","trae-inspector-end-line":"119","trae-inspector-end-column":"38","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",children:g})]}),Z.jsx("input",{"trae-inspector-start-line":"121","trae-inspector-start-column":"14","trae-inspector-end-line":"128","trae-inspector-end-column":"16","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",type:"range",min:"1",max:"100",value:g,onChange:_=>m(parseInt(_.target.value)),className:"w-full h-1 bg-zinc-700 rounded-lg appearance-none cursor-pointer accent-blue-500"})]}),Z.jsxs("div",{"trae-inspector-start-line":"132","trae-inspector-start-column":"10","trae-inspector-end-line":"145","trae-inspector-end-column":"16","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex gap-2 mt-6",children:[Z.jsx("button",{"trae-inspector-start-line":"133","trae-inspector-start-column":"12","trae-inspector-end-line":"138","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:r,className:"flex-1 px-3 py-2 rounded bg-zinc-800 hover:bg-zinc-700 text-zinc-300 text-sm transition-colors",children:u("common.cancel")}),Z.jsx("button",{"trae-inspector-start-line":"139","trae-inspector-start-column":"12","trae-inspector-end-line":"144","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/dialogs/SaveDialog.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:()=>o(d,g,y,R),className:"flex-1 px-3 py-2 rounded bg-blue-600 hover:bg-blue-500 text-white text-sm transition-colors",children:u("common.confirm")})]})]})]})}):null},G3=({stageRef:n})=>{const{undo:r,redo:o,loadImage:l,fileName:c}=bl(),{t:u,i18n:d}=Dl(),[f,g]=q.useState(!1),[m,y]=q.useState(void 0),x=async()=>{if(n.current){try{const b=await fetch("/api/current-image"),E=b.ok?await b.json():null;E&&E.path?y(E.path):y(void 0)}catch{y(void 0)}g(!0)}},R=async(b,E,z,F)=>{if(g(!1),!!n.current)try{const{previewImage:k,config:N,originalWidth:L,originalHeight:j}=bl.getState();if(!k){console.error("No image found to save");return}let Y=L||800,O=j||600;N.resize&&N.resize.width>0&&N.resize.height>0&&(Y=N.resize.width,O=N.resize.height);const U=document.createElement("canvas");U.width=Y,U.height=O;const I=U.getContext("2d");if(!I){console.error("Failed to create canvas context");return}I.imageSmoothingEnabled=!0,I.imageSmoothingQuality="high";const V=new Image;V.crossOrigin="anonymous",await new Promise((A,M)=>{V.onload=()=>{I.drawImage(V,0,0,Y,O),A()},V.onerror=M,V.src=k});const J=U.toDataURL(b,E/100);if(z)if((await fetch("/api/image/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:J,filePath:z})})).ok)alert(u("common.saveSuccess"));else throw new Error("Save API failed");else{const A=document.createElement("a");A.download=F||"mjpic-edit.png",A.href=J,document.body.appendChild(A),A.click(),document.body.removeChild(A)}}catch(k){console.error("Save failed:",k),alert("Failed to save image.")}},w=async()=>{const b=document.createElement("input");b.type="file",b.accept="image/*",b.onchange=E=>{var F;const z=(F=E.target.files)==null?void 0:F[0];if(z){const k=URL.createObjectURL(z);l(k,z.name,z.name)}},b.click()},_=()=>{const b=d.language==="en"?"zh":"en";d.changeLanguage(b)};return Z.jsxs("div",{"trae-inspector-start-line":"142","trae-inspector-start-column":"4","trae-inspector-end-line":"179","trae-inspector-end-column":"10","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"h-12 bg-zinc-900 border-b border-zinc-800 flex items-center px-4 justify-between z-20 shrink-0",children:[Z.jsxs("div",{"trae-inspector-start-line":"143","trae-inspector-start-column":"6","trae-inspector-end-line":"153","trae-inspector-end-column":"12","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex items-center gap-4",children:[Z.jsx("h1",{"trae-inspector-start-line":"144","trae-inspector-start-column":"8","trae-inspector-end-line":"144","trae-inspector-end-column":"87","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-zinc-100 font-bold text-lg mr-4",children:u("common.appName")}),Z.jsxs("div",{"trae-inspector-start-line":"145","trae-inspector-start-column":"8","trae-inspector-end-line":"152","trae-inspector-end-column":"14","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex items-center gap-2",children:[Z.jsxs("button",{"trae-inspector-start-line":"146","trae-inspector-start-column":"12","trae-inspector-end-line":"148","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:w,className:"px-3 py-1.5 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 text-sm flex items-center gap-1 transition-colors",children:[Z.jsx(by,{size:16})," ",u("common.open")]}),Z.jsxs("button",{"trae-inspector-start-line":"149","trae-inspector-start-column":"12","trae-inspector-end-line":"151","trae-inspector-end-column":"21","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:x,className:"px-3 py-1.5 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 text-sm flex items-center gap-1 transition-colors",children:[Z.jsx(By,{size:16})," ",u("common.save")]})]})]}),Z.jsxs("div",{"trae-inspector-start-line":"155","trae-inspector-start-column":"6","trae-inspector-end-line":"170","trae-inspector-end-column":"12","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"flex items-center gap-1",children:[Z.jsxs("button",{"trae-inspector-start-line":"156","trae-inspector-start-column":"9","trae-inspector-end-line":"163","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:_,className:"px-3 py-1.5 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 text-sm flex items-center gap-1 transition-colors mr-2",title:d.language==="en"?"Switch to Chinese":"Switch to English",children:[Z.jsx(Dy,{size:16}),d.language==="en"?"中文":"English"]}),Z.jsx("button",{"trae-inspector-start-line":"164","trae-inspector-start-column":"9","trae-inspector-end-line":"166","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:r,className:"p-2 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 transition-colors",title:u("common.undo"),children:Z.jsx($y,{size:18})}),Z.jsx("button",{"trae-inspector-start-line":"167","trae-inspector-start-column":"9","trae-inspector-end-line":"169","trae-inspector-end-column":"18","trae-inspector-file-path":"src/components/layout/Header.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:o,className:"p-2 rounded hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 transition-colors",title:u("common.redo"),children:Z.jsx(My,{size:18})})]}),Z.jsx(B3,{isOpen:f,onClose:()=>g(!1),onConfirm:R,defaultPath:m,defaultFileName:c||void 0})]})},yp=vp(n=>({activeTool:"enhance",isStraightenToolActive:!1,setActiveTool:r=>n({activeTool:r,isStraightenToolActive:!1}),setStraightenToolActive:r=>n({isStraightenToolActive:r})}));function hm(n){var r,o,l="";if(typeof n=="string"||typeof n=="number")l+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(r=0;r<c;r++)n[r]&&(o=hm(n[r]))&&(l&&(l+=" "),l+=o)}else for(o in n)n[o]&&(l&&(l+=" "),l+=o);return l}function H3(){for(var n,r,o=0,l="",c=arguments.length;o<c;o++)(n=arguments[o])&&(r=hm(n))&&(l&&(l+=" "),l+=r);return l}const V3=(n,r)=>{const o=new Array(n.length+r.length);for(let l=0;l<n.length;l++)o[l]=n[l];for(let l=0;l<r.length;l++)o[n.length+l]=r[l];return o},W3=(n,r)=>({classGroupId:n,validator:r}),fm=(n=new Map,r=null,o)=>({nextPart:n,validators:r,classGroupId:o}),vh="-",q2=[],K3="arbitrary..",q3=n=>{const r=X3(n),{conflictingClassGroups:o,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return Y3(d);const f=d.split(vh),g=f[0]===""&&f.length>1?1:0;return pm(f,g,r)},getConflictingClassGroupIds:(d,f)=>{if(f){const g=l[d],m=o[d];return g?m?V3(m,g):g:m||q2}return o[d]||q2}}},pm=(n,r,o)=>{if(n.length-r===0)return o.classGroupId;const c=n[r],u=o.nextPart.get(c);if(u){const m=pm(n,r+1,u);if(m)return m}const d=o.validators;if(d===null)return;const f=r===0?n.join(vh):n.slice(r).join(vh),g=d.length;for(let m=0;m<g;m++){const y=d[m];if(y.validator(f))return y.classGroupId}},Y3=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=n.slice(1,-1),o=r.indexOf(":"),l=r.slice(0,o);return l?K3+l:void 0})(),X3=n=>{const{theme:r,classGroups:o}=n;return Q3(o,r)},Q3=(n,r)=>{const o=fm();for(const l in n){const c=n[l];xp(c,o,l,r)}return o},xp=(n,r,o,l)=>{const c=n.length;for(let u=0;u<c;u++){const d=n[u];$3(d,r,o,l)}},$3=(n,r,o,l)=>{if(typeof n=="string"){J3(n,r,o);return}if(typeof n=="function"){Z3(n,r,o,l);return}e4(n,r,o,l)},J3=(n,r,o)=>{const l=n===""?r:gm(r,n);l.classGroupId=o},Z3=(n,r,o,l)=>{if(t4(n)){xp(n(l),r,o,l);return}r.validators===null&&(r.validators=[]),r.validators.push(W3(o,n))},e4=(n,r,o,l)=>{const c=Object.entries(n),u=c.length;for(let d=0;d<u;d++){const[f,g]=c[d];xp(g,gm(r,f),o,l)}},gm=(n,r)=>{let o=n;const l=r.split(vh),c=l.length;for(let u=0;u<c;u++){const d=l[u];let f=o.nextPart.get(d);f||(f=fm(),o.nextPart.set(d,f)),o=f}return o},t4=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,n4=n=>{if(n<1)return{get:()=>{},set:()=>{}};let r=0,o=Object.create(null),l=Object.create(null);const c=(u,d)=>{o[u]=d,r++,r>n&&(r=0,l=o,o=Object.create(null))};return{get(u){let d=o[u];if(d!==void 0)return d;if((d=l[u])!==void 0)return c(u,d),d},set(u,d){u in o?o[u]=d:c(u,d)}}},np="!",Y2=":",r4=[],X2=(n,r,o,l,c)=>({modifiers:n,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:l,isExternal:c}),i4=n=>{const{prefix:r,experimentalParseClassName:o}=n;let l=c=>{const u=[];let d=0,f=0,g=0,m;const y=c.length;for(let b=0;b<y;b++){const E=c[b];if(d===0&&f===0){if(E===Y2){u.push(c.slice(g,b)),g=b+1;continue}if(E==="/"){m=b;continue}}E==="["?d++:E==="]"?d--:E==="("?f++:E===")"&&f--}const x=u.length===0?c:c.slice(g);let R=x,w=!1;x.endsWith(np)?(R=x.slice(0,-1),w=!0):x.startsWith(np)&&(R=x.slice(1),w=!0);const _=m&&m>g?m-g:void 0;return X2(u,w,R,_)};if(r){const c=r+Y2,u=l;l=d=>d.startsWith(c)?u(d.slice(c.length)):X2(r4,!1,d,void 0,!0)}if(o){const c=l;l=u=>o({className:u,parseClassName:c})}return l},s4=n=>{const r=new Map;return n.orderSensitiveModifiers.forEach((o,l)=>{r.set(o,1e6+l)}),o=>{const l=[];let c=[];for(let u=0;u<o.length;u++){const d=o[u],f=d[0]==="[",g=r.has(d);f||g?(c.length>0&&(c.sort(),l.push(...c),c=[]),l.push(d)):c.push(d)}return c.length>0&&(c.sort(),l.push(...c)),l}},o4=n=>({cache:n4(n.cacheSize),parseClassName:i4(n),sortModifiers:s4(n),...q3(n)}),a4=/\s+/,l4=(n,r)=>{const{parseClassName:o,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:u}=r,d=[],f=n.trim().split(a4);let g="";for(let m=f.length-1;m>=0;m-=1){const y=f[m],{isExternal:x,modifiers:R,hasImportantModifier:w,baseClassName:_,maybePostfixModifierPosition:b}=o(y);if(x){g=y+(g.length>0?" "+g:g);continue}let E=!!b,z=l(E?_.substring(0,b):_);if(!z){if(!E){g=y+(g.length>0?" "+g:g);continue}if(z=l(_),!z){g=y+(g.length>0?" "+g:g);continue}E=!1}const F=R.length===0?"":R.length===1?R[0]:u(R).join(":"),k=w?F+np:F,N=k+z;if(d.indexOf(N)>-1)continue;d.push(N);const L=c(z,E);for(let j=0;j<L.length;++j){const Y=L[j];d.push(k+Y)}g=y+(g.length>0?" "+g:g)}return g},c4=(...n)=>{let r=0,o,l,c="";for(;r<n.length;)(o=n[r++])&&(l=mm(o))&&(c&&(c+=" "),c+=l);return c},mm=n=>{if(typeof n=="string")return n;let r,o="";for(let l=0;l<n.length;l++)n[l]&&(r=mm(n[l]))&&(o&&(o+=" "),o+=r);return o},u4=(n,...r)=>{let o,l,c,u;const d=g=>{const m=r.reduce((y,x)=>x(y),n());return o=o4(m),l=o.cache.get,c=o.cache.set,u=f,f(g)},f=g=>{const m=l(g);if(m)return m;const y=l4(g,o);return c(g,y),y};return u=d,(...g)=>u(c4(...g))},d4=[],Hn=n=>{const r=o=>o[n]||d4;return r.isThemeGetter=!0,r},vm=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ym=/^\((?:(\w[\w-]*):)?(.+)\)$/i,h4=/^\d+\/\d+$/,f4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,p4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,g4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,m4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,v4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kl=n=>h4.test(n),ft=n=>!!n&&!Number.isNaN(Number(n)),Oo=n=>!!n&&Number.isInteger(Number(n)),Pf=n=>n.endsWith("%")&&ft(n.slice(0,-1)),Bs=n=>f4.test(n),y4=()=>!0,x4=n=>p4.test(n)&&!g4.test(n),xm=()=>!1,w4=n=>m4.test(n),S4=n=>v4.test(n),k4=n=>!je(n)&&!Ue(n),_4=n=>Ll(n,km,xm),je=n=>vm.test(n),xa=n=>Ll(n,_m,x4),Af=n=>Ll(n,b4,ft),Q2=n=>Ll(n,wm,xm),C4=n=>Ll(n,Sm,S4),nh=n=>Ll(n,Cm,w4),Ue=n=>ym.test(n),Tc=n=>Tl(n,_m),F4=n=>Tl(n,P4),$2=n=>Tl(n,wm),R4=n=>Tl(n,km),E4=n=>Tl(n,Sm),rh=n=>Tl(n,Cm,!0),Ll=(n,r,o)=>{const l=vm.exec(n);return l?l[1]?r(l[1]):o(l[2]):!1},Tl=(n,r,o=!1)=>{const l=ym.exec(n);return l?l[1]?r(l[1]):o:!1},wm=n=>n==="position"||n==="percentage",Sm=n=>n==="image"||n==="url",km=n=>n==="length"||n==="size"||n==="bg-size",_m=n=>n==="length",b4=n=>n==="number",P4=n=>n==="family-name",Cm=n=>n==="shadow",A4=()=>{const n=Hn("color"),r=Hn("font"),o=Hn("text"),l=Hn("font-weight"),c=Hn("tracking"),u=Hn("leading"),d=Hn("breakpoint"),f=Hn("container"),g=Hn("spacing"),m=Hn("radius"),y=Hn("shadow"),x=Hn("inset-shadow"),R=Hn("text-shadow"),w=Hn("drop-shadow"),_=Hn("blur"),b=Hn("perspective"),E=Hn("aspect"),z=Hn("ease"),F=Hn("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...N(),Ue,je],j=()=>["auto","hidden","clip","visible","scroll"],Y=()=>["auto","contain","none"],O=()=>[Ue,je,g],U=()=>[kl,"full","auto",...O()],I=()=>[Oo,"none","subgrid",Ue,je],V=()=>["auto",{span:["full",Oo,Ue,je]},Oo,Ue,je],J=()=>[Oo,"auto",Ue,je],A=()=>["auto","min","max","fr",Ue,je],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],T=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...O()],G=()=>[kl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],X=()=>[n,Ue,je],oe=()=>[...N(),$2,Q2,{position:[Ue,je]}],te=()=>["no-repeat",{repeat:["","x","y","space","round"]}],K=()=>["auto","cover","contain",R4,_4,{size:[Ue,je]}],ne=()=>[Pf,Tc,xa],se=()=>["","none","full",m,Ue,je],$=()=>["",ft,Tc,xa],ue=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[ft,Pf,$2,Q2],re=()=>["","none",_,Ue,je],de=()=>["none",ft,Ue,je],xe=()=>["none",ft,Ue,je],Re=()=>[ft,Ue,je],be=()=>[kl,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Bs],breakpoint:[Bs],color:[y4],container:[Bs],"drop-shadow":[Bs],ease:["in","out","in-out"],font:[k4],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Bs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Bs],shadow:[Bs],spacing:["px",ft],text:[Bs],"text-shadow":[Bs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",kl,je,Ue,E]}],container:["container"],columns:[{columns:[ft,je,Ue,f]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[Oo,"auto",Ue,je]}],basis:[{basis:[kl,"full","auto",f,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ft,kl,"auto","initial","none",je]}],grow:[{grow:["",ft,Ue,je]}],shrink:[{shrink:["",ft,Ue,je]}],order:[{order:[Oo,"first","last","none",Ue,je]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...T(),"normal"]}],"justify-self":[{"justify-self":["auto",...T()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...T(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...T(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...T(),"baseline"]}],"place-self":[{"place-self":["auto",...T()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],w:[{w:[f,"screen",...G()]}],"min-w":[{"min-w":[f,"screen","none",...G()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",o,Tc,xa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,Ue,Af]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Pf,je]}],"font-family":[{font:[F4,je,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Ue,je]}],"line-clamp":[{"line-clamp":[ft,"none",Ue,Af]}],leading:[{leading:[u,...O()]}],"list-image":[{"list-image":["none",Ue,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ue,je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:X()}],"text-color":[{text:X()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:[ft,"from-font","auto",Ue,xa]}],"text-decoration-color":[{decoration:X()}],"underline-offset":[{"underline-offset":[ft,"auto",Ue,je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ue,je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ue,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:K()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Oo,Ue,je],radial:["",Ue,je],conic:[Oo,Ue,je]},E4,C4]}],"bg-color":[{bg:X()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:X()}],"gradient-via":[{via:X()}],"gradient-to":[{to:X()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ue(),"hidden","none"]}],"divide-style":[{divide:[...ue(),"hidden","none"]}],"border-color":[{border:X()}],"border-color-x":[{"border-x":X()}],"border-color-y":[{"border-y":X()}],"border-color-s":[{"border-s":X()}],"border-color-e":[{"border-e":X()}],"border-color-t":[{"border-t":X()}],"border-color-r":[{"border-r":X()}],"border-color-b":[{"border-b":X()}],"border-color-l":[{"border-l":X()}],"divide-color":[{divide:X()}],"outline-style":[{outline:[...ue(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ft,Ue,je]}],"outline-w":[{outline:["",ft,Tc,xa]}],"outline-color":[{outline:X()}],shadow:[{shadow:["","none",y,rh,nh]}],"shadow-color":[{shadow:X()}],"inset-shadow":[{"inset-shadow":["none",x,rh,nh]}],"inset-shadow-color":[{"inset-shadow":X()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:X()}],"ring-offset-w":[{"ring-offset":[ft,xa]}],"ring-offset-color":[{"ring-offset":X()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":X()}],"text-shadow":[{"text-shadow":["none",R,rh,nh]}],"text-shadow-color":[{"text-shadow":X()}],opacity:[{opacity:[ft,Ue,je]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ft]}],"mask-image-linear-from-pos":[{"mask-linear-from":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"mask-image-linear-from-color":[{"mask-linear-from":X()}],"mask-image-linear-to-color":[{"mask-linear-to":X()}],"mask-image-t-from-pos":[{"mask-t-from":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"mask-image-t-from-color":[{"mask-t-from":X()}],"mask-image-t-to-color":[{"mask-t-to":X()}],"mask-image-r-from-pos":[{"mask-r-from":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"mask-image-r-from-color":[{"mask-r-from":X()}],"mask-image-r-to-color":[{"mask-r-to":X()}],"mask-image-b-from-pos":[{"mask-b-from":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"mask-image-b-from-color":[{"mask-b-from":X()}],"mask-image-b-to-color":[{"mask-b-to":X()}],"mask-image-l-from-pos":[{"mask-l-from":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"mask-image-l-from-color":[{"mask-l-from":X()}],"mask-image-l-to-color":[{"mask-l-to":X()}],"mask-image-x-from-pos":[{"mask-x-from":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"mask-image-x-from-color":[{"mask-x-from":X()}],"mask-image-x-to-color":[{"mask-x-to":X()}],"mask-image-y-from-pos":[{"mask-y-from":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":X()}],"mask-image-y-to-color":[{"mask-y-to":X()}],"mask-image-radial":[{"mask-radial":[Ue,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"mask-image-radial-from-color":[{"mask-radial-from":X()}],"mask-image-radial-to-color":[{"mask-radial-to":X()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[ft]}],"mask-image-conic-from-pos":[{"mask-conic-from":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"mask-image-conic-from-color":[{"mask-conic-from":X()}],"mask-image-conic-to-color":[{"mask-conic-to":X()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:K()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ue,je]}],filter:[{filter:["","none",Ue,je]}],blur:[{blur:re()}],brightness:[{brightness:[ft,Ue,je]}],contrast:[{contrast:[ft,Ue,je]}],"drop-shadow":[{"drop-shadow":["","none",w,rh,nh]}],"drop-shadow-color":[{"drop-shadow":X()}],grayscale:[{grayscale:["",ft,Ue,je]}],"hue-rotate":[{"hue-rotate":[ft,Ue,je]}],invert:[{invert:["",ft,Ue,je]}],saturate:[{saturate:[ft,Ue,je]}],sepia:[{sepia:["",ft,Ue,je]}],"backdrop-filter":[{"backdrop-filter":["","none",Ue,je]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[ft,Ue,je]}],"backdrop-contrast":[{"backdrop-contrast":[ft,Ue,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ft,Ue,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ft,Ue,je]}],"backdrop-invert":[{"backdrop-invert":["",ft,Ue,je]}],"backdrop-opacity":[{"backdrop-opacity":[ft,Ue,je]}],"backdrop-saturate":[{"backdrop-saturate":[ft,Ue,je]}],"backdrop-sepia":[{"backdrop-sepia":["",ft,Ue,je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ue,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ft,"initial",Ue,je]}],ease:[{ease:["linear","initial",z,Ue,je]}],delay:[{delay:[ft,Ue,je]}],animate:[{animate:["none",F,Ue,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Ue,je]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[Ue,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:X()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:X()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ue,je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ue,je]}],fill:[{fill:["none",...X()]}],"stroke-w":[{stroke:[ft,Tc,xa,Af]}],stroke:[{stroke:["none",...X()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},N4=u4(A4);function D4(...n){return N4(H3(n))}const zc=[{ratio:1,label:"1:1"},{ratio:1.333,label:"4:3"},{ratio:1.5,label:"3:2"},{ratio:1.6,label:"16:10"},{ratio:1.778,label:"16:9"},{ratio:.667,label:"2:3"},{ratio:.75,label:"3:4"},{ratio:.5625,label:"9:16"}];function Fm(n,r){return r===0?n:Fm(r,n%r)}function L4(n,r){if(n<=0||r<=0)return null;const o=n/r;for(const d of zc)if(Math.abs(o-d.ratio)<.02)return{label:d.label,isApproximate:!1};for(const d of zc)if(Math.abs(o-d.ratio)<.05)return{label:d.label,isApproximate:!0};const l=Fm(n,r),c=n/l,u=r/l;if(c>100||u>100){let d=zc[0],f=Math.abs(o-zc[0].ratio);for(const g of zc){const m=Math.abs(o-g.ratio);m<f&&(f=m,d=g)}return{label:d.label,isApproximate:!0}}return{label:`${c}:${u}`,isApproximate:!1}}const T4=()=>{const{activeTool:n,setActiveTool:r}=yp(),{t:o}=Dl(),l=[{id:"enhance",icon:Zy,label:o("sidebar.enhance")},{id:"adjust",icon:Wy,label:o("sidebar.adjust")},{id:"resize",icon:im,label:o("sidebar.resize")},{id:"crop",icon:Ry,label:o("sidebar.crop")},{id:"rotate",icon:Iy,label:o("sidebar.rotate")},{id:"border",icon:qy,label:o("sidebar.border")}];return Z.jsx("div",{"trae-inspector-start-line":"20","trae-inspector-start-column":"4","trae-inspector-end-line":"34","trae-inspector-end-column":"10","trae-inspector-file-path":"src/components/layout/Sidebar.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"w-[80px] bg-zinc-900 border-r border-zinc-800 flex flex-col items-center py-4 gap-2 h-full z-10",children:l.map(c=>Z.jsxs("button",{"trae-inspector-start-line":"22","trae-inspector-start-column":"8","trae-inspector-end-line":"32","trae-inspector-end-column":"17","trae-inspector-file-path":"src/components/layout/Sidebar.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",onClick:()=>r(c.id),className:D4("flex flex-col items-center justify-center w-16 h-16 rounded-lg transition-colors text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",n===c.id&&"bg-zinc-800 text-blue-500 hover:text-blue-400"),children:[Z.jsx(c.icon,{className:"w-6 h-6 mb-1"}),Z.jsx("span",{"trae-inspector-start-line":"31","trae-inspector-start-column":"10","trae-inspector-end-line":"31","trae-inspector-end-column":"59","trae-inspector-file-path":"src/components/layout/Sidebar.tsx","trae-inspector-static-props":"%7B%22cwd%22%3A%22%2FUsers%2Fchinakr%2Fworkspace%2Ftrae%2Fmjpic%22%7D",className:"text-[10px]",children:c.label})]},c.id))})};var dh={exports:{}},Mc={},Nf={},Df={},J2;function pt(){return J2||(J2=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n._registerNode=n.Konva=n.glob=void 0;const r=Math.PI/180;function o(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}n.glob=typeof u2<"u"?u2:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},n.Konva={_global:n.glob,version:"9.3.16",isBrowser:o(),isUnminified:/param/.test((function(c){}).toString()),dblClickWindow:400,getAngle(c){return n.Konva.angleDeg?c*r:c},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 n.Konva.DD.isDragging},isTransforming(){var c;return(c=n.Konva.Transformer)===null||c===void 0?void 0:c.isTransforming()},isDragReady(){return!!n.Konva.DD.node},releaseCanvasOnDestroy:!0,document:n.glob.document,_injectGlobal(c){n.glob.Konva=c}};const l=c=>{n.Konva[c.prototype.getClassName()]=c};n._registerNode=l,n.Konva._injectGlobal(n.Konva)})(Df)),Df}var Lf={},Z2;function gn(){return Z2||(Z2=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Util=n.Transform=void 0;const r=pt();class o{constructor(N=[1,0,0,1,0,0]){this.dirty=!1,this.m=N&&N.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 o(this.m)}copyInto(N){N.m[0]=this.m[0],N.m[1]=this.m[1],N.m[2]=this.m[2],N.m[3]=this.m[3],N.m[4]=this.m[4],N.m[5]=this.m[5]}point(N){const L=this.m;return{x:L[0]*N.x+L[2]*N.y+L[4],y:L[1]*N.x+L[3]*N.y+L[5]}}translate(N,L){return this.m[4]+=this.m[0]*N+this.m[2]*L,this.m[5]+=this.m[1]*N+this.m[3]*L,this}scale(N,L){return this.m[0]*=N,this.m[1]*=N,this.m[2]*=L,this.m[3]*=L,this}rotate(N){const L=Math.cos(N),j=Math.sin(N),Y=this.m[0]*L+this.m[2]*j,O=this.m[1]*L+this.m[3]*j,U=this.m[0]*-j+this.m[2]*L,I=this.m[1]*-j+this.m[3]*L;return this.m[0]=Y,this.m[1]=O,this.m[2]=U,this.m[3]=I,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(N,L){const j=this.m[0]+this.m[2]*L,Y=this.m[1]+this.m[3]*L,O=this.m[2]+this.m[0]*N,U=this.m[3]+this.m[1]*N;return this.m[0]=j,this.m[1]=Y,this.m[2]=O,this.m[3]=U,this}multiply(N){const L=this.m[0]*N.m[0]+this.m[2]*N.m[1],j=this.m[1]*N.m[0]+this.m[3]*N.m[1],Y=this.m[0]*N.m[2]+this.m[2]*N.m[3],O=this.m[1]*N.m[2]+this.m[3]*N.m[3],U=this.m[0]*N.m[4]+this.m[2]*N.m[5]+this.m[4],I=this.m[1]*N.m[4]+this.m[3]*N.m[5]+this.m[5];return this.m[0]=L,this.m[1]=j,this.m[2]=Y,this.m[3]=O,this.m[4]=U,this.m[5]=I,this}invert(){const N=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),L=this.m[3]*N,j=-this.m[1]*N,Y=-this.m[2]*N,O=this.m[0]*N,U=N*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),I=N*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=L,this.m[1]=j,this.m[2]=Y,this.m[3]=O,this.m[4]=U,this.m[5]=I,this}getMatrix(){return this.m}decompose(){const N=this.m[0],L=this.m[1],j=this.m[2],Y=this.m[3],O=this.m[4],U=this.m[5],I=N*Y-L*j,V={x:O,y:U,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(N!=0||L!=0){const J=Math.sqrt(N*N+L*L);V.rotation=L>0?Math.acos(N/J):-Math.acos(N/J),V.scaleX=J,V.scaleY=I/J,V.skewX=(N*j+L*Y)/I,V.skewY=0}else if(j!=0||Y!=0){const J=Math.sqrt(j*j+Y*Y);V.rotation=Math.PI/2-(Y>0?Math.acos(-j/J):-Math.acos(j/J)),V.scaleX=I/J,V.scaleY=J,V.skewX=0,V.skewY=(N*j+L*Y)/I}return V.rotation=n.Util._getRotation(V.rotation),V}}n.Transform=o;let l="[object Array]",c="[object Number]",u="[object String]",d="[object Boolean]",f=Math.PI/180,g=180/Math.PI,m="#",y="",x="0",R="Konva warning: ",w="Konva error: ",_="rgb(",b={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]},E=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,z=[];const F=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(k){setTimeout(k,60)};n.Util={_isElement(k){return!!(k&&k.nodeType==1)},_isFunction(k){return!!(k&&k.constructor&&k.call&&k.apply)},_isPlainObject(k){return!!k&&k.constructor===Object},_isArray(k){return Object.prototype.toString.call(k)===l},_isNumber(k){return Object.prototype.toString.call(k)===c&&!isNaN(k)&&isFinite(k)},_isString(k){return Object.prototype.toString.call(k)===u},_isBoolean(k){return Object.prototype.toString.call(k)===d},isObject(k){return k instanceof Object},isValidSelector(k){if(typeof k!="string")return!1;const N=k[0];return N==="#"||N==="."||N===N.toUpperCase()},_sign(k){return k===0||k>0?1:-1},requestAnimFrame(k){z.push(k),z.length===1&&F(function(){const N=z;z=[],N.forEach(function(L){L()})})},createCanvasElement(){const k=document.createElement("canvas");try{k.style=k.style||{}}catch{}return k},createImageElement(){return document.createElement("img")},_isInDocument(k){for(;k=k.parentNode;)if(k==document)return!0;return!1},_urlToImage(k,N){const L=n.Util.createImageElement();L.onload=function(){N(L)},L.src=k},_rgbToHex(k,N,L){return((1<<24)+(k<<16)+(N<<8)+L).toString(16).slice(1)},_hexToRgb(k){k=k.replace(m,y);const N=parseInt(k,16);return{r:N>>16&255,g:N>>8&255,b:N&255}},getRandomColor(){let k=(Math.random()*16777215<<0).toString(16);for(;k.length<6;)k=x+k;return m+k},getRGB(k){let N;return k in b?(N=b[k],{r:N[0],g:N[1],b:N[2]}):k[0]===m?this._hexToRgb(k.substring(1)):k.substr(0,4)===_?(N=E.exec(k.replace(/ /g,"")),{r:parseInt(N[1],10),g:parseInt(N[2],10),b:parseInt(N[3],10)}):{r:0,g:0,b:0}},colorToRGBA(k){return k=k||"black",n.Util._namedColorToRBA(k)||n.Util._hex3ColorToRGBA(k)||n.Util._hex4ColorToRGBA(k)||n.Util._hex6ColorToRGBA(k)||n.Util._hex8ColorToRGBA(k)||n.Util._rgbColorToRGBA(k)||n.Util._rgbaColorToRGBA(k)||n.Util._hslColorToRGBA(k)},_namedColorToRBA(k){const N=b[k.toLowerCase()];return N?{r:N[0],g:N[1],b:N[2],a:1}:null},_rgbColorToRGBA(k){if(k.indexOf("rgb(")===0){k=k.match(/rgb\(([^)]+)\)/)[1];const N=k.split(/ *, */).map(Number);return{r:N[0],g:N[1],b:N[2],a:1}}},_rgbaColorToRGBA(k){if(k.indexOf("rgba(")===0){k=k.match(/rgba\(([^)]+)\)/)[1];const N=k.split(/ *, */).map((L,j)=>L.slice(-1)==="%"?j===3?parseInt(L)/100:parseInt(L)/100*255:Number(L));return{r:N[0],g:N[1],b:N[2],a:N[3]}}},_hex8ColorToRGBA(k){if(k[0]==="#"&&k.length===9)return{r:parseInt(k.slice(1,3),16),g:parseInt(k.slice(3,5),16),b:parseInt(k.slice(5,7),16),a:parseInt(k.slice(7,9),16)/255}},_hex6ColorToRGBA(k){if(k[0]==="#"&&k.length===7)return{r:parseInt(k.slice(1,3),16),g:parseInt(k.slice(3,5),16),b:parseInt(k.slice(5,7),16),a:1}},_hex4ColorToRGBA(k){if(k[0]==="#"&&k.length===5)return{r:parseInt(k[1]+k[1],16),g:parseInt(k[2]+k[2],16),b:parseInt(k[3]+k[3],16),a:parseInt(k[4]+k[4],16)/255}},_hex3ColorToRGBA(k){if(k[0]==="#"&&k.length===4)return{r:parseInt(k[1]+k[1],16),g:parseInt(k[2]+k[2],16),b:parseInt(k[3]+k[3],16),a:1}},_hslColorToRGBA(k){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(k)){const[N,...L]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(k),j=Number(L[0])/360,Y=Number(L[1])/100,O=Number(L[2])/100;let U,I,V;if(Y===0)return V=O*255,{r:Math.round(V),g:Math.round(V),b:Math.round(V),a:1};O<.5?U=O*(1+Y):U=O+Y-O*Y;const J=2*O-U,A=[0,0,0];for(let M=0;M<3;M++)I=j+1/3*-(M-1),I<0&&I++,I>1&&I--,6*I<1?V=J+(U-J)*6*I:2*I<1?V=U:3*I<2?V=J+(U-J)*(2/3-I)*6:V=J,A[M]=V*255;return{r:Math.round(A[0]),g:Math.round(A[1]),b:Math.round(A[2]),a:1}}},haveIntersection(k,N){return!(N.x>k.x+k.width||N.x+N.width<k.x||N.y>k.y+k.height||N.y+N.height<k.y)},cloneObject(k){const N={};for(const L in k)this._isPlainObject(k[L])?N[L]=this.cloneObject(k[L]):this._isArray(k[L])?N[L]=this.cloneArray(k[L]):N[L]=k[L];return N},cloneArray(k){return k.slice(0)},degToRad(k){return k*f},radToDeg(k){return k*g},_degToRad(k){return n.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),n.Util.degToRad(k)},_radToDeg(k){return n.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),n.Util.radToDeg(k)},_getRotation(k){return r.Konva.angleDeg?n.Util.radToDeg(k):k},_capitalize(k){return k.charAt(0).toUpperCase()+k.slice(1)},throw(k){throw new Error(w+k)},error(k){console.error(w+k)},warn(k){r.Konva.showWarnings&&console.warn(R+k)},each(k,N){for(const L in k)N(L,k[L])},_inRange(k,N,L){return N<=k&&k<L},_getProjectionToSegment(k,N,L,j,Y,O){let U,I,V;const J=(k-L)*(k-L)+(N-j)*(N-j);if(J==0)U=k,I=N,V=(Y-L)*(Y-L)+(O-j)*(O-j);else{const A=((Y-k)*(L-k)+(O-N)*(j-N))/J;A<0?(U=k,I=N,V=(k-Y)*(k-Y)+(N-O)*(N-O)):A>1?(U=L,I=j,V=(L-Y)*(L-Y)+(j-O)*(j-O)):(U=k+A*(L-k),I=N+A*(j-N),V=(U-Y)*(U-Y)+(I-O)*(I-O))}return[U,I,V]},_getProjectionToLine(k,N,L){const j=n.Util.cloneObject(k);let Y=Number.MAX_VALUE;return N.forEach(function(O,U){if(!L&&U===N.length-1)return;const I=N[(U+1)%N.length],V=n.Util._getProjectionToSegment(O.x,O.y,I.x,I.y,k.x,k.y),J=V[0],A=V[1],M=V[2];M<Y&&(j.x=J,j.y=A,Y=M)}),j},_prepareArrayForTween(k,N,L){let j,Y=[],O=[];if(k.length>N.length){const I=N;N=k,k=I}for(j=0;j<k.length;j+=2)Y.push({x:k[j],y:k[j+1]});for(j=0;j<N.length;j+=2)O.push({x:N[j],y:N[j+1]});const U=[];return O.forEach(function(I){const V=n.Util._getProjectionToLine(I,Y,L);U.push(V.x),U.push(V.y)}),U},_prepareToStringify(k){let N;k.visitedByCircularReferenceRemoval=!0;for(const L in k)if(k.hasOwnProperty(L)&&k[L]&&typeof k[L]=="object"){if(N=Object.getOwnPropertyDescriptor(k,L),k[L].visitedByCircularReferenceRemoval||n.Util._isElement(k[L]))if(N.configurable)delete k[L];else return null;else if(n.Util._prepareToStringify(k[L])===null)if(N.configurable)delete k[L];else return null}return delete k.visitedByCircularReferenceRemoval,k},_assign(k,N){for(const L in N)k[L]=N[L];return k},_getFirstPointerId(k){return k.touches?k.changedTouches[0].identifier:k.pointerId||999},releaseCanvas(...k){r.Konva.releaseCanvasOnDestroy&&k.forEach(N=>{N.width=0,N.height=0})},drawRoundedRectPath(k,N,L,j){let Y=0,O=0,U=0,I=0;typeof j=="number"?Y=O=U=I=Math.min(j,N/2,L/2):(Y=Math.min(j[0]||0,N/2,L/2),O=Math.min(j[1]||0,N/2,L/2),I=Math.min(j[2]||0,N/2,L/2),U=Math.min(j[3]||0,N/2,L/2)),k.moveTo(Y,0),k.lineTo(N-O,0),k.arc(N-O,O,O,Math.PI*3/2,0,!1),k.lineTo(N,L-I),k.arc(N-I,L-I,I,0,Math.PI/2,!1),k.lineTo(U,L),k.arc(U,L-U,U,Math.PI/2,Math.PI,!1),k.lineTo(0,Y),k.arc(Y,Y,Y,Math.PI,Math.PI*3/2,!1)}}})(Lf)),Lf}var Oc={},Tf={},Yr={},e0;function wt(){if(e0)return Yr;e0=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.RGBComponent=l,Yr.alphaComponent=c,Yr.getNumberValidator=u,Yr.getNumberOrArrayOfNumbersValidator=d,Yr.getNumberOrAutoValidator=f,Yr.getStringValidator=g,Yr.getStringOrGradientValidator=m,Yr.getFunctionValidator=y,Yr.getNumberArrayValidator=x,Yr.getBooleanValidator=R,Yr.getComponentValidator=w;const n=pt(),r=gn();function o(_){return r.Util._isString(_)?'"'+_+'"':Object.prototype.toString.call(_)==="[object Number]"||r.Util._isBoolean(_)?_:Object.prototype.toString.call(_)}function l(_){return _>255?255:_<0?0:Math.round(_)}function c(_){return _>1?1:_<1e-4?1e-4:_}function u(){if(n.Konva.isUnminified)return function(_,b){return r.Util._isNumber(_)||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a number.'),_}}function d(_){if(n.Konva.isUnminified)return function(b,E){const z=r.Util._isNumber(b),F=r.Util._isArray(b)&&b.length==_;return!z&&!F&&r.Util.warn(o(b)+' is a not valid value for "'+E+'" attribute. The value should be a number or Array<number>('+_+")"),b}}function f(){if(n.Konva.isUnminified)return function(_,b){return r.Util._isNumber(_)||_==="auto"||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a number or "auto".'),_}}function g(){if(n.Konva.isUnminified)return function(_,b){return r.Util._isString(_)||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a string.'),_}}function m(){if(n.Konva.isUnminified)return function(_,b){const E=r.Util._isString(_),z=Object.prototype.toString.call(_)==="[object CanvasGradient]"||_&&_.addColorStop;return E||z||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a string or a native gradient.'),_}}function y(){if(n.Konva.isUnminified)return function(_,b){return r.Util._isFunction(_)||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a function.'),_}}function x(){if(n.Konva.isUnminified)return function(_,b){const E=Int8Array?Object.getPrototypeOf(Int8Array):null;return E&&_ instanceof E||(r.Util._isArray(_)?_.forEach(function(z){r.Util._isNumber(z)||r.Util.warn('"'+b+'" attribute has non numeric element '+z+". Make sure that all elements are numbers.")}):r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a array of numbers.')),_}}function R(){if(n.Konva.isUnminified)return function(_,b){return _===!0||_===!1||r.Util.warn(o(_)+' is a not valid value for "'+b+'" attribute. The value should be a boolean.'),_}}function w(_){if(n.Konva.isUnminified)return function(b,E){return b==null||r.Util.isObject(b)||r.Util.warn(o(b)+' is a not valid value for "'+E+'" attribute. The value should be an object with properties '+_),b}}return Yr}var t0;function yt(){return t0||(t0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Factory=void 0;const r=gn(),o=wt(),l="get",c="set";n.Factory={addGetterSetter(u,d,f,g,m){n.Factory.addGetter(u,d,f),n.Factory.addSetter(u,d,g,m),n.Factory.addOverloadedGetterSetter(u,d)},addGetter(u,d,f){const g=l+r.Util._capitalize(d);u.prototype[g]=u.prototype[g]||function(){const m=this.attrs[d];return m===void 0?f:m}},addSetter(u,d,f,g){const m=c+r.Util._capitalize(d);u.prototype[m]||n.Factory.overWriteSetter(u,d,f,g)},overWriteSetter(u,d,f,g){const m=c+r.Util._capitalize(d);u.prototype[m]=function(y){return f&&y!==void 0&&y!==null&&(y=f.call(this,y,d)),this._setAttr(d,y),g&&g.call(this),this}},addComponentsGetterSetter(u,d,f,g,m){let y=f.length,x=r.Util._capitalize,R=l+x(d),w=c+x(d),_,b;u.prototype[R]=function(){const z={};for(_=0;_<y;_++)b=f[_],z[b]=this.getAttr(d+x(b));return z};const E=(0,o.getComponentValidator)(f);u.prototype[w]=function(z){let F=this.attrs[d],k;g&&(z=g.call(this,z)),E&&E.call(this,z,d);for(k in z)z.hasOwnProperty(k)&&this._setAttr(d+x(k),z[k]);return z||f.forEach(N=>{this._setAttr(d+x(N),void 0)}),this._fireChangeEvent(d,F,z),m&&m.call(this),this},n.Factory.addOverloadedGetterSetter(u,d)},addOverloadedGetterSetter(u,d){const f=r.Util._capitalize(d),g=c+f,m=l+f;u.prototype[d]=function(){return arguments.length?(this[g](arguments[0]),this):this[m]()}},addDeprecatedGetterSetter(u,d,f,g){r.Util.error("Adding deprecated "+d);const m=l+r.Util._capitalize(d),y=d+" property is deprecated and will be removed soon. Look at Konva change log for more information.";u.prototype[m]=function(){r.Util.error(y);const x=this.attrs[d];return x===void 0?f:x},n.Factory.addSetter(u,d,g,function(){r.Util.error(y)}),n.Factory.addOverloadedGetterSetter(u,d)},backCompat(u,d){r.Util.each(d,function(f,g){const m=u.prototype[g],y=l+r.Util._capitalize(f),x=c+r.Util._capitalize(f);function R(){m.apply(this,arguments),r.Util.error('"'+f+'" method is deprecated and will be removed soon. Use ""'+g+'" instead.')}u.prototype[f]=R,u.prototype[y]=R,u.prototype[x]=R})},afterSetFilter(){this._filterUpToDate=!1}}})(Tf)),Tf}var Gs={},Hs={},n0;function Rm(){if(n0)return Hs;n0=1,Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.HitContext=Hs.SceneContext=Hs.Context=void 0;const n=gn(),r=pt();function o(z){let F=[],k=z.length,N=n.Util,L,j;for(L=0;L<k;L++)j=z[L],N._isNumber(j)?j=Math.round(j*1e3)/1e3:N._isString(j)||(j=j+""),F.push(j);return F}const l=",",c="(",u=")",d="([",f="])",g=";",m="()",y="=",x=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],R=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"],w=100;class _{constructor(F){this.canvas=F,r.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(F){F.fillEnabled()&&this._fill(F)}_fill(F){}strokeShape(F){F.hasStroke()&&this._stroke(F)}_stroke(F){}fillStrokeShape(F){F.attrs.fillAfterStrokeEnabled?(this.strokeShape(F),this.fillShape(F)):(this.fillShape(F),this.strokeShape(F))}getTrace(F,k){let N=this.traceArr,L=N.length,j="",Y,O,U,I;for(Y=0;Y<L;Y++)O=N[Y],U=O.method,U?(I=O.args,j+=U,F?j+=m:n.Util._isArray(I[0])?j+=d+I.join(l)+f:(k&&(I=I.map(V=>typeof V=="number"?Math.floor(V):V)),j+=c+I.join(l)+u)):(j+=O.property,F||(j+=y+O.val)),j+=g;return j}clearTrace(){this.traceArr=[]}_trace(F){let k=this.traceArr,N;k.push(F),N=k.length,N>=w&&k.shift()}reset(){const F=this.getCanvas().getPixelRatio();this.setTransform(1*F,0,0,1*F,0,0)}getCanvas(){return this.canvas}clear(F){const k=this.getCanvas();F?this.clearRect(F.x||0,F.y||0,F.width||0,F.height||0):this.clearRect(0,0,k.getWidth()/k.pixelRatio,k.getHeight()/k.pixelRatio)}_applyLineCap(F){const k=F.attrs.lineCap;k&&this.setAttr("lineCap",k)}_applyOpacity(F){const k=F.getAbsoluteOpacity();k!==1&&this.setAttr("globalAlpha",k)}_applyLineJoin(F){const k=F.attrs.lineJoin;k&&this.setAttr("lineJoin",k)}setAttr(F,k){this._context[F]=k}arc(F,k,N,L,j,Y){this._context.arc(F,k,N,L,j,Y)}arcTo(F,k,N,L,j){this._context.arcTo(F,k,N,L,j)}beginPath(){this._context.beginPath()}bezierCurveTo(F,k,N,L,j,Y){this._context.bezierCurveTo(F,k,N,L,j,Y)}clearRect(F,k,N,L){this._context.clearRect(F,k,N,L)}clip(...F){this._context.clip.apply(this._context,F)}closePath(){this._context.closePath()}createImageData(F,k){const N=arguments;if(N.length===2)return this._context.createImageData(F,k);if(N.length===1)return this._context.createImageData(F)}createLinearGradient(F,k,N,L){return this._context.createLinearGradient(F,k,N,L)}createPattern(F,k){return this._context.createPattern(F,k)}createRadialGradient(F,k,N,L,j,Y){return this._context.createRadialGradient(F,k,N,L,j,Y)}drawImage(F,k,N,L,j,Y,O,U,I){const V=arguments,J=this._context;V.length===3?J.drawImage(F,k,N):V.length===5?J.drawImage(F,k,N,L,j):V.length===9&&J.drawImage(F,k,N,L,j,Y,O,U,I)}ellipse(F,k,N,L,j,Y,O,U){this._context.ellipse(F,k,N,L,j,Y,O,U)}isPointInPath(F,k,N,L){return N?this._context.isPointInPath(N,F,k,L):this._context.isPointInPath(F,k,L)}fill(...F){this._context.fill.apply(this._context,F)}fillRect(F,k,N,L){this._context.fillRect(F,k,N,L)}strokeRect(F,k,N,L){this._context.strokeRect(F,k,N,L)}fillText(F,k,N,L){L?this._context.fillText(F,k,N,L):this._context.fillText(F,k,N)}measureText(F){return this._context.measureText(F)}getImageData(F,k,N,L){return this._context.getImageData(F,k,N,L)}lineTo(F,k){this._context.lineTo(F,k)}moveTo(F,k){this._context.moveTo(F,k)}rect(F,k,N,L){this._context.rect(F,k,N,L)}roundRect(F,k,N,L,j){this._context.roundRect(F,k,N,L,j)}putImageData(F,k,N){this._context.putImageData(F,k,N)}quadraticCurveTo(F,k,N,L){this._context.quadraticCurveTo(F,k,N,L)}restore(){this._context.restore()}rotate(F){this._context.rotate(F)}save(){this._context.save()}scale(F,k){this._context.scale(F,k)}setLineDash(F){this._context.setLineDash?this._context.setLineDash(F):"mozDash"in this._context?this._context.mozDash=F:"webkitLineDash"in this._context&&(this._context.webkitLineDash=F)}getLineDash(){return this._context.getLineDash()}setTransform(F,k,N,L,j,Y){this._context.setTransform(F,k,N,L,j,Y)}stroke(F){F?this._context.stroke(F):this._context.stroke()}strokeText(F,k,N,L){this._context.strokeText(F,k,N,L)}transform(F,k,N,L,j,Y){this._context.transform(F,k,N,L,j,Y)}translate(F,k){this._context.translate(F,k)}_enableTrace(){let F=this,k=x.length,N=this.setAttr,L,j;const Y=function(O){let U=F[O],I;F[O]=function(){return j=o(Array.prototype.slice.call(arguments,0)),I=U.apply(F,arguments),F._trace({method:O,args:j}),I}};for(L=0;L<k;L++)Y(x[L]);F.setAttr=function(){N.apply(F,arguments);const O=arguments[0];let U=arguments[1];(O==="shadowOffsetX"||O==="shadowOffsetY"||O==="shadowBlur")&&(U=U/this.canvas.getPixelRatio()),F._trace({property:O,val:U})}}_applyGlobalCompositeOperation(F){const k=F.attrs.globalCompositeOperation;!k||k==="source-over"||this.setAttr("globalCompositeOperation",k)}}Hs.Context=_,R.forEach(function(z){Object.defineProperty(_.prototype,z,{get(){return this._context[z]},set(F){this._context[z]=F}})});class b extends _{constructor(F,{willReadFrequently:k=!1}={}){super(F),this._context=F._canvas.getContext("2d",{willReadFrequently:k})}_fillColor(F){const k=F.fill();this.setAttr("fillStyle",k),F._fillFunc(this)}_fillPattern(F){this.setAttr("fillStyle",F._getFillPattern()),F._fillFunc(this)}_fillLinearGradient(F){const k=F._getLinearGradient();k&&(this.setAttr("fillStyle",k),F._fillFunc(this))}_fillRadialGradient(F){const k=F._getRadialGradient();k&&(this.setAttr("fillStyle",k),F._fillFunc(this))}_fill(F){const k=F.fill(),N=F.getFillPriority();if(k&&N==="color"){this._fillColor(F);return}const L=F.getFillPatternImage();if(L&&N==="pattern"){this._fillPattern(F);return}const j=F.getFillLinearGradientColorStops();if(j&&N==="linear-gradient"){this._fillLinearGradient(F);return}const Y=F.getFillRadialGradientColorStops();if(Y&&N==="radial-gradient"){this._fillRadialGradient(F);return}k?this._fillColor(F):L?this._fillPattern(F):j?this._fillLinearGradient(F):Y&&this._fillRadialGradient(F)}_strokeLinearGradient(F){const k=F.getStrokeLinearGradientStartPoint(),N=F.getStrokeLinearGradientEndPoint(),L=F.getStrokeLinearGradientColorStops(),j=this.createLinearGradient(k.x,k.y,N.x,N.y);if(L){for(let Y=0;Y<L.length;Y+=2)j.addColorStop(L[Y],L[Y+1]);this.setAttr("strokeStyle",j)}}_stroke(F){const k=F.dash(),N=F.getStrokeScaleEnabled();if(F.hasStroke()){if(!N){this.save();const j=this.getCanvas().getPixelRatio();this.setTransform(j,0,0,j,0,0)}this._applyLineCap(F),k&&F.dashEnabled()&&(this.setLineDash(k),this.setAttr("lineDashOffset",F.dashOffset())),this.setAttr("lineWidth",F.strokeWidth()),F.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),F.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(F):this.setAttr("strokeStyle",F.stroke()),F._strokeFunc(this),N||this.restore()}}_applyShadow(F){var k,N,L;const j=(k=F.getShadowRGBA())!==null&&k!==void 0?k:"black",Y=(N=F.getShadowBlur())!==null&&N!==void 0?N:5,O=(L=F.getShadowOffset())!==null&&L!==void 0?L:{x:0,y:0},U=F.getAbsoluteScale(),I=this.canvas.getPixelRatio(),V=U.x*I,J=U.y*I;this.setAttr("shadowColor",j),this.setAttr("shadowBlur",Y*Math.min(Math.abs(V),Math.abs(J))),this.setAttr("shadowOffsetX",O.x*V),this.setAttr("shadowOffsetY",O.y*J)}}Hs.SceneContext=b;class E extends _{constructor(F){super(F),this._context=F._canvas.getContext("2d",{willReadFrequently:!0})}_fill(F){this.save(),this.setAttr("fillStyle",F.colorKey),F._fillFuncHit(this),this.restore()}strokeShape(F){F.hasHitStroke()&&this._stroke(F)}_stroke(F){if(F.hasHitStroke()){const k=F.getStrokeScaleEnabled();if(!k){this.save();const j=this.getCanvas().getPixelRatio();this.setTransform(j,0,0,j,0,0)}this._applyLineCap(F);const N=F.hitStrokeWidth(),L=N==="auto"?F.strokeWidth():N;this.setAttr("lineWidth",L),this.setAttr("strokeStyle",F.colorKey),F._strokeFuncHit(this),k||this.restore()}}}return Hs.HitContext=E,Hs}var r0;function Fh(){if(r0)return Gs;r0=1,Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.HitCanvas=Gs.SceneCanvas=Gs.Canvas=void 0;const n=gn(),r=Rm(),o=pt(),l=yt(),c=wt();let u;function d(){if(u)return u;const y=n.Util.createCanvasElement(),x=y.getContext("2d");return u=(function(){const R=o.Konva._global.devicePixelRatio||1,w=x.webkitBackingStorePixelRatio||x.mozBackingStorePixelRatio||x.msBackingStorePixelRatio||x.oBackingStorePixelRatio||x.backingStorePixelRatio||1;return R/w})(),n.Util.releaseCanvas(y),u}let f=class{constructor(x){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const w=(x||{}).pixelRatio||o.Konva.pixelRatio||d();this.pixelRatio=w,this._canvas=n.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(x){const R=this.pixelRatio;this.pixelRatio=x,this.setSize(this.getWidth()/R,this.getHeight()/R)}setWidth(x){this.width=this._canvas.width=x*this.pixelRatio,this._canvas.style.width=x+"px";const R=this.pixelRatio;this.getContext()._context.scale(R,R)}setHeight(x){this.height=this._canvas.height=x*this.pixelRatio,this._canvas.style.height=x+"px";const R=this.pixelRatio;this.getContext()._context.scale(R,R)}getWidth(){return this.width}getHeight(){return this.height}setSize(x,R){this.setWidth(x||0),this.setHeight(R||0)}toDataURL(x,R){try{return this._canvas.toDataURL(x,R)}catch{try{return this._canvas.toDataURL()}catch(_){return n.Util.error("Unable to get data URL. "+_.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}};Gs.Canvas=f,l.Factory.addGetterSetter(f,"pixelRatio",void 0,(0,c.getNumberValidator)());class g extends f{constructor(x={width:0,height:0,willReadFrequently:!1}){super(x),this.context=new r.SceneContext(this,{willReadFrequently:x.willReadFrequently}),this.setSize(x.width,x.height)}}Gs.SceneCanvas=g;class m extends f{constructor(x={width:0,height:0}){super(x),this.hitCanvas=!0,this.context=new r.HitContext(this),this.setSize(x.width,x.height)}}return Gs.HitCanvas=m,Gs}var zf={},i0;function wp(){return i0||(i0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.DD=void 0;const r=pt(),o=gn();n.DD={get isDragging(){let l=!1;return n.DD._dragElements.forEach(c=>{c.dragStatus==="dragging"&&(l=!0)}),l},justDragged:!1,get node(){let l;return n.DD._dragElements.forEach(c=>{l=c.node}),l},_dragElements:new Map,_drag(l){const c=[];n.DD._dragElements.forEach((u,d)=>{const{node:f}=u,g=f.getStage();g.setPointersPositions(l),u.pointerId===void 0&&(u.pointerId=o.Util._getFirstPointerId(l));const m=g._changedPointerPositions.find(y=>y.id===u.pointerId);if(m){if(u.dragStatus!=="dragging"){const y=f.dragDistance();if(Math.max(Math.abs(m.x-u.startPointerPos.x),Math.abs(m.y-u.startPointerPos.y))<y||(f.startDrag({evt:l}),!f.isDragging()))return}f._setDragPosition(l,u),c.push(f)}}),c.forEach(u=>{u.fire("dragmove",{type:"dragmove",target:u,evt:l},!0)})},_endDragBefore(l){const c=[];n.DD._dragElements.forEach(u=>{const{node:d}=u,f=d.getStage();if(l&&f.setPointersPositions(l),!f._changedPointerPositions.find(y=>y.id===u.pointerId))return;(u.dragStatus==="dragging"||u.dragStatus==="stopped")&&(n.DD.justDragged=!0,r.Konva._mouseListenClick=!1,r.Konva._touchListenClick=!1,r.Konva._pointerListenClick=!1,u.dragStatus="stopped");const m=u.node.getLayer()||u.node instanceof r.Konva.Stage&&u.node;m&&c.indexOf(m)===-1&&c.push(m)}),c.forEach(u=>{u.draw()})},_endDragAfter(l){n.DD._dragElements.forEach((c,u)=>{c.dragStatus==="stopped"&&c.node.fire("dragend",{type:"dragend",target:c.node,evt:l},!0),c.dragStatus!=="dragging"&&n.DD._dragElements.delete(u)})}},r.Konva.isBrowser&&(window.addEventListener("mouseup",n.DD._endDragBefore,!0),window.addEventListener("touchend",n.DD._endDragBefore,!0),window.addEventListener("touchcancel",n.DD._endDragBefore,!0),window.addEventListener("mousemove",n.DD._drag),window.addEventListener("touchmove",n.DD._drag),window.addEventListener("mouseup",n.DD._endDragAfter,!1),window.addEventListener("touchend",n.DD._endDragAfter,!1),window.addEventListener("touchcancel",n.DD._endDragAfter,!1))})(zf)),zf}var s0;function Rn(){if(s0)return Oc;s0=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.Node=void 0;const n=gn(),r=yt(),o=Fh(),l=pt(),c=wp(),u=wt(),d="absoluteOpacity",f="allEventListeners",g="absoluteTransform",m="absoluteScale",y="canvas",x="Change",R="children",w="konva",_="listening",b="mouseenter",E="mouseleave",z="set",F="Shape",k=" ",N="stage",L="transform",j="Stage",Y="visible",O=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(k);let U=1,I=class rp{constructor(A){this._id=U++,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(A),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(A){(A===L||A===g)&&this._cache.get(A)?this._cache.get(A).dirty=!0:A?this._cache.delete(A):this._cache.clear()}_getCache(A,M){let T=this._cache.get(A);return(T===void 0||(A===L||A===g)&&T.dirty===!0)&&(T=M.call(this),this._cache.set(A,T)),T}_calculate(A,M,T){if(!this._attachedDepsListeners.get(A)){const H=M.map(G=>G+"Change.konva").join(k);this.on(H,()=>{this._clearCache(A)}),this._attachedDepsListeners.set(A,!0)}return this._getCache(A,T)}_getCanvasCache(){return this._cache.get(y)}_clearSelfAndDescendantCache(A){this._clearCache(A),A===g&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(y)){const{scene:A,filter:M,hit:T}=this._cache.get(y);n.Util.releaseCanvas(A,M,T),this._cache.delete(y)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(A){const M=A||{};let T={};(M.x===void 0||M.y===void 0||M.width===void 0||M.height===void 0)&&(T=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let H=Math.ceil(M.width||T.width),G=Math.ceil(M.height||T.height),X=M.pixelRatio,oe=M.x===void 0?Math.floor(T.x):M.x,te=M.y===void 0?Math.floor(T.y):M.y,K=M.offset||0,ne=M.drawBorder||!1,se=M.hitCanvasPixelRatio||1;if(!H||!G){n.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const $=Math.abs(Math.round(T.x)-oe)>.5?1:0,ue=Math.abs(Math.round(T.y)-te)>.5?1:0;H+=K*2+$,G+=K*2+ue,oe-=K,te-=K;const pe=new o.SceneCanvas({pixelRatio:X,width:H,height:G}),Q=new o.SceneCanvas({pixelRatio:X,width:0,height:0,willReadFrequently:!0}),re=new o.HitCanvas({pixelRatio:se,width:H,height:G}),de=pe.getContext(),xe=re.getContext();return re.isCache=!0,pe.isCache=!0,this._cache.delete(y),this._filterUpToDate=!1,M.imageSmoothingEnabled===!1&&(pe.getContext()._context.imageSmoothingEnabled=!1,Q.getContext()._context.imageSmoothingEnabled=!1),de.save(),xe.save(),de.translate(-oe,-te),xe.translate(-oe,-te),this._isUnderCache=!0,this._clearSelfAndDescendantCache(d),this._clearSelfAndDescendantCache(m),this.drawScene(pe,this),this.drawHit(re,this),this._isUnderCache=!1,de.restore(),xe.restore(),ne&&(de.save(),de.beginPath(),de.rect(0,0,H,G),de.closePath(),de.setAttr("strokeStyle","red"),de.setAttr("lineWidth",5),de.stroke(),de.restore()),this._cache.set(y,{scene:pe,filter:Q,hit:re,x:oe,y:te}),this._requestDraw(),this}isCached(){return this._cache.has(y)}getClientRect(A){throw new Error('abstract "getClientRect" method call')}_transformedRect(A,M){const T=[{x:A.x,y:A.y},{x:A.x+A.width,y:A.y},{x:A.x+A.width,y:A.y+A.height},{x:A.x,y:A.y+A.height}];let H=1/0,G=1/0,X=-1/0,oe=-1/0;const te=this.getAbsoluteTransform(M);return T.forEach(function(K){const ne=te.point(K);H===void 0&&(H=X=ne.x,G=oe=ne.y),H=Math.min(H,ne.x),G=Math.min(G,ne.y),X=Math.max(X,ne.x),oe=Math.max(oe,ne.y)}),{x:H,y:G,width:X-H,height:oe-G}}_drawCachedSceneCanvas(A){A.save(),A._applyOpacity(this),A._applyGlobalCompositeOperation(this);const M=this._getCanvasCache();A.translate(M.x,M.y);const T=this._getCachedSceneCanvas(),H=T.pixelRatio;A.drawImage(T._canvas,0,0,T.width/H,T.height/H),A.restore()}_drawCachedHitCanvas(A){const M=this._getCanvasCache(),T=M.hit;A.save(),A.translate(M.x,M.y),A.drawImage(T._canvas,0,0,T.width/T.pixelRatio,T.height/T.pixelRatio),A.restore()}_getCachedSceneCanvas(){let A=this.filters(),M=this._getCanvasCache(),T=M.scene,H=M.filter,G=H.getContext(),X,oe,te,K;if(A){if(!this._filterUpToDate){const ne=T.pixelRatio;H.setSize(T.width/T.pixelRatio,T.height/T.pixelRatio);try{for(X=A.length,G.clear(),G.drawImage(T._canvas,0,0,T.getWidth()/ne,T.getHeight()/ne),oe=G.getImageData(0,0,H.getWidth(),H.getHeight()),te=0;te<X;te++){if(K=A[te],typeof K!="function"){n.Util.error("Filter should be type of function, but got "+typeof K+" instead. Please check correct filters");continue}K.call(this,oe),G.putImageData(oe,0,0)}}catch(se){n.Util.error("Unable to apply filter. "+se.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return H}return T}on(A,M){if(this._cache&&this._cache.delete(f),arguments.length===3)return this._delegate.apply(this,arguments);let T=A.split(k),H=T.length,G,X,oe,te,K;for(G=0;G<H;G++)X=T[G],oe=X.split("."),te=oe[0],K=oe[1]||"",this.eventListeners[te]||(this.eventListeners[te]=[]),this.eventListeners[te].push({name:K,handler:M});return this}off(A,M){let T=(A||"").split(k),H=T.length,G,X,oe,te,K,ne;if(this._cache&&this._cache.delete(f),!A)for(X in this.eventListeners)this._off(X);for(G=0;G<H;G++)if(oe=T[G],te=oe.split("."),K=te[0],ne=te[1],K)this.eventListeners[K]&&this._off(K,ne,M);else for(X in this.eventListeners)this._off(X,ne,M);return this}dispatchEvent(A){const M={target:this,type:A.type,evt:A};return this.fire(A.type,M),this}addEventListener(A,M){return this.on(A,function(T){M.call(this,T.evt)}),this}removeEventListener(A){return this.off(A),this}_delegate(A,M,T){const H=this;this.on(A,function(G){const X=G.target.findAncestors(M,!0,H);for(let oe=0;oe<X.length;oe++)G=n.Util.cloneObject(G),G.currentTarget=X[oe],T.call(X[oe],G)})}remove(){return this.isDragging()&&this.stopDrag(),c.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(g),this._clearSelfAndDescendantCache(d),this._clearSelfAndDescendantCache(m),this._clearSelfAndDescendantCache(N),this._clearSelfAndDescendantCache(Y),this._clearSelfAndDescendantCache(_)}_remove(){this._clearCaches();const A=this.getParent();A&&A.children&&(A.children.splice(this.index,1),A._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(A){const M="get"+n.Util._capitalize(A);return n.Util._isFunction(this[M])?this[M]():this.attrs[A]}getAncestors(){let A=this.getParent(),M=[];for(;A;)M.push(A),A=A.getParent();return M}getAttrs(){return this.attrs||{}}setAttrs(A){return this._batchTransformChanges(()=>{let M,T;if(!A)return this;for(M in A)M!==R&&(T=z+n.Util._capitalize(M),n.Util._isFunction(this[T])?this[T](A[M]):this._setAttr(M,A[M]))}),this}isListening(){return this._getCache(_,this._isListening)}_isListening(A){if(!this.listening())return!1;const T=this.getParent();return T&&T!==A&&this!==A?T._isListening(A):!0}isVisible(){return this._getCache(Y,this._isVisible)}_isVisible(A){if(!this.visible())return!1;const T=this.getParent();return T&&T!==A&&this!==A?T._isVisible(A):!0}shouldDrawHit(A,M=!1){if(A)return this._isVisible(A)&&this._isListening(A);const T=this.getLayer();let H=!1;c.DD._dragElements.forEach(X=>{X.dragStatus==="dragging"&&(X.node.nodeType==="Stage"||X.node.getLayer()===T)&&(H=!0)});const G=!M&&!l.Konva.hitOnDragEnabled&&(H||l.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!G}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let A=this.getDepth(),M=this,T=0,H,G,X,oe;function te(ne){for(H=[],G=ne.length,X=0;X<G;X++)oe=ne[X],T++,oe.nodeType!==F&&(H=H.concat(oe.getChildren().slice())),oe._id===M._id&&(X=G);H.length>0&&H[0].getDepth()<=A&&te(H)}const K=this.getStage();return M.nodeType!==j&&K&&te(K.getChildren()),T}getDepth(){let A=0,M=this.parent;for(;M;)A++,M=M.parent;return A}_batchTransformChanges(A){this._batchingTransformChange=!0,A(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(L),this._clearSelfAndDescendantCache(g)),this._needClearTransformCache=!1}setPosition(A){return this._batchTransformChanges(()=>{this.x(A.x),this.y(A.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const A=this.getStage();if(!A)return null;const M=A.getPointerPosition();if(!M)return null;const T=this.getAbsoluteTransform().copy();return T.invert(),T.point(M)}getAbsolutePosition(A){let M=!1,T=this.parent;for(;T;){if(T.isCached()){M=!0;break}T=T.parent}M&&!A&&(A=!0);const H=this.getAbsoluteTransform(A).getMatrix(),G=new n.Transform,X=this.offset();return G.m=H.slice(),G.translate(X.x,X.y),G.getTranslation()}setAbsolutePosition(A){const{x:M,y:T,...H}=this._clearTransform();this.attrs.x=M,this.attrs.y=T,this._clearCache(L);const G=this._getAbsoluteTransform().copy();return G.invert(),G.translate(A.x,A.y),A={x:this.attrs.x+G.getTranslation().x,y:this.attrs.y+G.getTranslation().y},this._setTransform(H),this.setPosition({x:A.x,y:A.y}),this._clearCache(L),this._clearSelfAndDescendantCache(g),this}_setTransform(A){let M;for(M in A)this.attrs[M]=A[M]}_clearTransform(){const A={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,A}move(A){let M=A.x,T=A.y,H=this.x(),G=this.y();return M!==void 0&&(H+=M),T!==void 0&&(G+=T),this.setPosition({x:H,y:G}),this}_eachAncestorReverse(A,M){let T=[],H=this.getParent(),G,X;if(!(M&&M._id===this._id)){for(T.unshift(this);H&&(!M||H._id!==M._id);)T.unshift(H),H=H.parent;for(G=T.length,X=0;X<G;X++)A(T[X])}}rotate(A){return this.rotation(this.rotation()+A),this}moveToTop(){if(!this.parent)return n.Util.warn("Node has no parent. moveToTop function is ignored."),!1;const A=this.index,M=this.parent.getChildren().length;return A<M-1?(this.parent.children.splice(A,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return n.Util.warn("Node has no parent. moveUp function is ignored."),!1;const A=this.index,M=this.parent.getChildren().length;return A<M-1?(this.parent.children.splice(A,1),this.parent.children.splice(A+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return n.Util.warn("Node has no parent. moveDown function is ignored."),!1;const A=this.index;return A>0?(this.parent.children.splice(A,1),this.parent.children.splice(A-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return n.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const A=this.index;return A>0?(this.parent.children.splice(A,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(A){if(!this.parent)return n.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(A<0||A>=this.parent.children.length)&&n.Util.warn("Unexpected value "+A+" 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 M=this.index;return this.parent.children.splice(M,1),this.parent.children.splice(A,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(d,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let A=this.opacity();const M=this.getParent();return M&&!M._isUnderCache&&(A*=M.getAbsoluteOpacity()),A}moveTo(A){return this.getParent()!==A&&(this._remove(),A.add(this)),this}toObject(){let A=this.getAttrs(),M,T,H,G,X;const oe={attrs:{},className:this.getClassName()};for(M in A)T=A[M],X=n.Util.isObject(T)&&!n.Util._isPlainObject(T)&&!n.Util._isArray(T),!X&&(H=typeof this[M]=="function"&&this[M],delete A[M],G=H?H.call(this):null,A[M]=T,G!==T&&(oe.attrs[M]=T));return n.Util._prepareToStringify(oe)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(A,M,T){const H=[];M&&this._isMatch(A)&&H.push(this);let G=this.parent;for(;G;){if(G===T)return H;G._isMatch(A)&&H.push(G),G=G.parent}return H}isAncestorOf(A){return!1}findAncestor(A,M,T){return this.findAncestors(A,M,T)[0]}_isMatch(A){if(!A)return!1;if(typeof A=="function")return A(this);let M=A.replace(/ /g,"").split(","),T=M.length,H,G;for(H=0;H<T;H++)if(G=M[H],n.Util.isValidSelector(G)||(n.Util.warn('Selector "'+G+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),n.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),n.Util.warn("Konva is awesome, right?")),G.charAt(0)==="#"){if(this.id()===G.slice(1))return!0}else if(G.charAt(0)==="."){if(this.hasName(G.slice(1)))return!0}else if(this.className===G||this.nodeType===G)return!0;return!1}getLayer(){const A=this.getParent();return A?A.getLayer():null}getStage(){return this._getCache(N,this._getStage)}_getStage(){const A=this.getParent();return A?A.getStage():null}fire(A,M={},T){return M.target=M.target||this,T?this._fireAndBubble(A,M):this._fire(A,M),this}getAbsoluteTransform(A){return A?this._getAbsoluteTransform(A):this._getCache(g,this._getAbsoluteTransform)}_getAbsoluteTransform(A){let M;if(A)return M=new n.Transform,this._eachAncestorReverse(function(T){const H=T.transformsEnabled();H==="all"?M.multiply(T.getTransform()):H==="position"&&M.translate(T.x()-T.offsetX(),T.y()-T.offsetY())},A),M;{M=this._cache.get(g)||new n.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(M):M.reset();const T=this.transformsEnabled();if(T==="all")M.multiply(this.getTransform());else if(T==="position"){const H=this.attrs.x||0,G=this.attrs.y||0,X=this.attrs.offsetX||0,oe=this.attrs.offsetY||0;M.translate(H-X,G-oe)}return M.dirty=!1,M}}getAbsoluteScale(A){let M=this;for(;M;)M._isUnderCache&&(A=M),M=M.getParent();const H=this.getAbsoluteTransform(A).decompose();return{x:H.scaleX,y:H.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(L,this._getTransform)}_getTransform(){var A,M;const T=this._cache.get(L)||new n.Transform;T.reset();const H=this.x(),G=this.y(),X=l.Konva.getAngle(this.rotation()),oe=(A=this.attrs.scaleX)!==null&&A!==void 0?A:1,te=(M=this.attrs.scaleY)!==null&&M!==void 0?M:1,K=this.attrs.skewX||0,ne=this.attrs.skewY||0,se=this.attrs.offsetX||0,$=this.attrs.offsetY||0;return(H!==0||G!==0)&&T.translate(H,G),X!==0&&T.rotate(X),(K!==0||ne!==0)&&T.skew(K,ne),(oe!==1||te!==1)&&T.scale(oe,te),(se!==0||$!==0)&&T.translate(-1*se,-1*$),T.dirty=!1,T}clone(A){let M=n.Util.cloneObject(this.attrs),T,H,G,X,oe;for(T in A)M[T]=A[T];const te=new this.constructor(M);for(T in this.eventListeners)for(H=this.eventListeners[T],G=H.length,X=0;X<G;X++)oe=H[X],oe.name.indexOf(w)<0&&(te.eventListeners[T]||(te.eventListeners[T]=[]),te.eventListeners[T].push(oe));return te}_toKonvaCanvas(A){A=A||{};const M=this.getClientRect(),T=this.getStage(),H=A.x!==void 0?A.x:Math.floor(M.x),G=A.y!==void 0?A.y:Math.floor(M.y),X=A.pixelRatio||1,oe=new o.SceneCanvas({width:A.width||Math.ceil(M.width)||(T?T.width():0),height:A.height||Math.ceil(M.height)||(T?T.height():0),pixelRatio:X}),te=oe.getContext(),K=new o.SceneCanvas({width:oe.width/oe.pixelRatio+Math.abs(H),height:oe.height/oe.pixelRatio+Math.abs(G),pixelRatio:oe.pixelRatio});return A.imageSmoothingEnabled===!1&&(te._context.imageSmoothingEnabled=!1),te.save(),(H||G)&&te.translate(-1*H,-1*G),this.drawScene(oe,void 0,K),te.restore(),oe}toCanvas(A){return this._toKonvaCanvas(A)._canvas}toDataURL(A){A=A||{};const M=A.mimeType||null,T=A.quality||null,H=this._toKonvaCanvas(A).toDataURL(M,T);return A.callback&&A.callback(H),H}toImage(A){return new Promise((M,T)=>{try{const H=A==null?void 0:A.callback;H&&delete A.callback,n.Util._urlToImage(this.toDataURL(A),function(G){M(G),H==null||H(G)})}catch(H){T(H)}})}toBlob(A){return new Promise((M,T)=>{try{const H=A==null?void 0:A.callback;H&&delete A.callback,this.toCanvas(A).toBlob(G=>{M(G),H==null||H(G)},A==null?void 0:A.mimeType,A==null?void 0:A.quality)}catch(H){T(H)}})}setSize(A){return this.width(A.width),this.height(A.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():l.Konva.dragDistance}_off(A,M,T){let H=this.eventListeners[A],G,X,oe;for(G=0;G<H.length;G++)if(X=H[G].name,oe=H[G].handler,(X!=="konva"||M==="konva")&&(!M||X===M)&&(!T||T===oe)){if(H.splice(G,1),H.length===0){delete this.eventListeners[A];break}G--}}_fireChangeEvent(A,M,T){this._fire(A+x,{oldVal:M,newVal:T})}addName(A){if(!this.hasName(A)){const M=this.name(),T=M?M+" "+A:A;this.name(T)}return this}hasName(A){if(!A)return!1;const M=this.name();return M?(M||"").split(/\s/g).indexOf(A)!==-1:!1}removeName(A){const M=(this.name()||"").split(/\s/g),T=M.indexOf(A);return T!==-1&&(M.splice(T,1),this.name(M.join(" "))),this}setAttr(A,M){const T=this[z+n.Util._capitalize(A)];return n.Util._isFunction(T)?T.call(this,M):this._setAttr(A,M),this}_requestDraw(){if(l.Konva.autoDrawEnabled){const A=this.getLayer()||this.getStage();A==null||A.batchDraw()}}_setAttr(A,M){const T=this.attrs[A];T===M&&!n.Util.isObject(M)||(M==null?delete this.attrs[A]:this.attrs[A]=M,this._shouldFireChangeEvents&&this._fireChangeEvent(A,T,M),this._requestDraw())}_setComponentAttr(A,M,T){let H;T!==void 0&&(H=this.attrs[A],H||(this.attrs[A]=this.getAttr(A)),this.attrs[A][M]=T,this._fireChangeEvent(A,H,T))}_fireAndBubble(A,M,T){if(M&&this.nodeType===F&&(M.target=this),!((A===b||A===E)&&(T&&(this===T||this.isAncestorOf&&this.isAncestorOf(T))||this.nodeType==="Stage"&&!T))){this._fire(A,M);const G=(A===b||A===E)&&T&&T.isAncestorOf&&T.isAncestorOf(this)&&!T.isAncestorOf(this.parent);(M&&!M.cancelBubble||!M)&&this.parent&&this.parent.isListening()&&!G&&(T&&T.parent?this._fireAndBubble.call(this.parent,A,M,T):this._fireAndBubble.call(this.parent,A,M))}}_getProtoListeners(A){var M,T,H;const G=(M=this._cache.get(f))!==null&&M!==void 0?M:{};let X=G==null?void 0:G[A];if(X===void 0){X=[];let oe=Object.getPrototypeOf(this);for(;oe;){const te=(H=(T=oe.eventListeners)===null||T===void 0?void 0:T[A])!==null&&H!==void 0?H:[];X.push(...te),oe=Object.getPrototypeOf(oe)}G[A]=X,this._cache.set(f,G)}return X}_fire(A,M){M=M||{},M.currentTarget=this,M.type=A;const T=this._getProtoListeners(A);if(T)for(var H=0;H<T.length;H++)T[H].handler.call(this,M);const G=this.eventListeners[A];if(G)for(var H=0;H<G.length;H++)G[H].handler.call(this,M)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(A){const M=A?A.pointerId:void 0,T=this.getStage(),H=this.getAbsolutePosition();if(!T)return;const G=T._getPointerById(M)||T._changedPointerPositions[0]||H;c.DD._dragElements.set(this._id,{node:this,startPointerPos:G,offset:{x:G.x-H.x,y:G.y-H.y},dragStatus:"ready",pointerId:M})}startDrag(A,M=!0){c.DD._dragElements.has(this._id)||this._createDragElement(A);const T=c.DD._dragElements.get(this._id);T.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:A&&A.evt},M)}_setDragPosition(A,M){const T=this.getStage()._getPointerById(M.pointerId);if(!T)return;let H={x:T.x-M.offset.x,y:T.y-M.offset.y};const G=this.dragBoundFunc();if(G!==void 0){const X=G.call(this,H,A);X?H=X:n.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==H.x||this._lastPos.y!==H.y)&&(this.setAbsolutePosition(H),this._requestDraw()),this._lastPos=H}stopDrag(A){const M=c.DD._dragElements.get(this._id);M&&(M.dragStatus="stopped"),c.DD._endDragBefore(A),c.DD._endDragAfter(A)}setDraggable(A){this._setAttr("draggable",A),this._dragChange()}isDragging(){const A=c.DD._dragElements.get(this._id);return A?A.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(A){if(!(!(A.evt.button!==void 0)||l.Konva.dragButtons.indexOf(A.evt.button)>=0)||this.isDragging())return;let H=!1;c.DD._dragElements.forEach(G=>{this.isAncestorOf(G.node)&&(H=!0)}),H||this._createDragElement(A)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const M=c.DD._dragElements.get(this._id),T=M&&M.dragStatus==="dragging",H=M&&M.dragStatus==="ready";T?this.stopDrag():H&&c.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(A={x:0,y:0}){const M=this.getStage();if(!M)return!1;const T={x:-A.x,y:-A.y,width:M.width()+2*A.x,height:M.height()+2*A.y};return n.Util.haveIntersection(T,this.getClientRect())}static create(A,M){return n.Util._isString(A)&&(A=JSON.parse(A)),this._createNode(A,M)}static _createNode(A,M){let T=rp.prototype.getClassName.call(A),H=A.children,G,X,oe;M&&(A.attrs.container=M),l.Konva[T]||(n.Util.warn('Can not find a node with class name "'+T+'". Fallback to "Shape".'),T="Shape");const te=l.Konva[T];if(G=new te(A.attrs),H)for(X=H.length,oe=0;oe<X;oe++)G.add(rp._createNode(H[oe]));return G}};Oc.Node=I,I.prototype.nodeType="Node",I.prototype._attrsAffectingSize=[],I.prototype.eventListeners={},I.prototype.on.call(I.prototype,O,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(L),this._clearSelfAndDescendantCache(g)}),I.prototype.on.call(I.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Y)}),I.prototype.on.call(I.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(_)}),I.prototype.on.call(I.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(d)});const V=r.Factory.addGetterSetter;return V(I,"zIndex"),V(I,"absolutePosition"),V(I,"position"),V(I,"x",0,(0,u.getNumberValidator)()),V(I,"y",0,(0,u.getNumberValidator)()),V(I,"globalCompositeOperation","source-over",(0,u.getStringValidator)()),V(I,"opacity",1,(0,u.getNumberValidator)()),V(I,"name","",(0,u.getStringValidator)()),V(I,"id","",(0,u.getStringValidator)()),V(I,"rotation",0,(0,u.getNumberValidator)()),r.Factory.addComponentsGetterSetter(I,"scale",["x","y"]),V(I,"scaleX",1,(0,u.getNumberValidator)()),V(I,"scaleY",1,(0,u.getNumberValidator)()),r.Factory.addComponentsGetterSetter(I,"skew",["x","y"]),V(I,"skewX",0,(0,u.getNumberValidator)()),V(I,"skewY",0,(0,u.getNumberValidator)()),r.Factory.addComponentsGetterSetter(I,"offset",["x","y"]),V(I,"offsetX",0,(0,u.getNumberValidator)()),V(I,"offsetY",0,(0,u.getNumberValidator)()),V(I,"dragDistance",null,(0,u.getNumberValidator)()),V(I,"width",0,(0,u.getNumberValidator)()),V(I,"height",0,(0,u.getNumberValidator)()),V(I,"listening",!0,(0,u.getBooleanValidator)()),V(I,"preventDefault",!0,(0,u.getBooleanValidator)()),V(I,"filters",null,function(J){return this._filterUpToDate=!1,J}),V(I,"visible",!0,(0,u.getBooleanValidator)()),V(I,"transformsEnabled","all",(0,u.getStringValidator)()),V(I,"size"),V(I,"dragBoundFunc"),V(I,"draggable",!1,(0,u.getBooleanValidator)()),r.Factory.backCompat(I,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"}),Oc}var Ic={},o0;function Rh(){if(o0)return Ic;o0=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.Container=void 0;const n=yt(),r=Rn(),o=wt();let l=class extends r.Node{constructor(){super(...arguments),this.children=[]}getChildren(u){if(!u)return this.children||[];const d=this.children||[],f=[];return d.forEach(function(g){u(g)&&f.push(g)}),f}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(u=>{u.parent=null,u.index=0,u.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(u=>{u.parent=null,u.index=0,u.destroy()}),this.children=[],this._requestDraw(),this}add(...u){if(u.length===0)return this;if(u.length>1){for(let f=0;f<u.length;f++)this.add(u[f]);return this}const d=u[0];return d.getParent()?(d.moveTo(this),this):(this._validateAdd(d),d.index=this.getChildren().length,d.parent=this,d._clearCaches(),this.getChildren().push(d),this._fire("add",{child:d}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(u){return this._generalFind(u,!1)}findOne(u){const d=this._generalFind(u,!0);return d.length>0?d[0]:void 0}_generalFind(u,d){const f=[];return this._descendants(g=>{const m=g._isMatch(u);return m&&f.push(g),!!(m&&d)}),f}_descendants(u){let d=!1;const f=this.getChildren();for(const g of f){if(d=u(g),d)return!0;if(g.hasChildren()&&(d=g._descendants(u),d))return!0}return!1}toObject(){const u=r.Node.prototype.toObject.call(this);return u.children=[],this.getChildren().forEach(d=>{u.children.push(d.toObject())}),u}isAncestorOf(u){let d=u.getParent();for(;d;){if(d._id===this._id)return!0;d=d.getParent()}return!1}clone(u){const d=r.Node.prototype.clone.call(this,u);return this.getChildren().forEach(function(f){d.add(f.clone())}),d}getAllIntersections(u){const d=[];return this.find("Shape").forEach(f=>{f.isVisible()&&f.intersects(u)&&d.push(f)}),d}_clearSelfAndDescendantCache(u){var d;super._clearSelfAndDescendantCache(u),!this.isCached()&&((d=this.children)===null||d===void 0||d.forEach(function(f){f._clearSelfAndDescendantCache(u)}))}_setChildrenIndices(){var u;(u=this.children)===null||u===void 0||u.forEach(function(d,f){d.index=f}),this._requestDraw()}drawScene(u,d,f){const g=this.getLayer(),m=u||g&&g.getCanvas(),y=m&&m.getContext(),x=this._getCanvasCache(),R=x&&x.scene,w=m&&m.isCache;if(!this.isVisible()&&!w)return this;if(R){y.save();const _=this.getAbsoluteTransform(d).getMatrix();y.transform(_[0],_[1],_[2],_[3],_[4],_[5]),this._drawCachedSceneCanvas(y),y.restore()}else this._drawChildren("drawScene",m,d,f);return this}drawHit(u,d){if(!this.shouldDrawHit(d))return this;const f=this.getLayer(),g=u||f&&f.hitCanvas,m=g&&g.getContext(),y=this._getCanvasCache();if(y&&y.hit){m.save();const R=this.getAbsoluteTransform(d).getMatrix();m.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedHitCanvas(m),m.restore()}else this._drawChildren("drawHit",g,d);return this}_drawChildren(u,d,f,g){var m;const y=d&&d.getContext(),x=this.clipWidth(),R=this.clipHeight(),w=this.clipFunc(),_=typeof x=="number"&&typeof R=="number"||w,b=f===this;if(_){y.save();const z=this.getAbsoluteTransform(f);let F=z.getMatrix();y.transform(F[0],F[1],F[2],F[3],F[4],F[5]),y.beginPath();let k;if(w)k=w.call(this,y,this);else{const N=this.clipX(),L=this.clipY();y.rect(N||0,L||0,x,R)}y.clip.apply(y,k),F=z.copy().invert().getMatrix(),y.transform(F[0],F[1],F[2],F[3],F[4],F[5])}const E=!b&&this.globalCompositeOperation()!=="source-over"&&u==="drawScene";E&&(y.save(),y._applyGlobalCompositeOperation(this)),(m=this.children)===null||m===void 0||m.forEach(function(z){z[u](d,f,g)}),E&&y.restore(),_&&y.restore()}getClientRect(u={}){var d;const f=u.skipTransform,g=u.relativeTo;let m,y,x,R,w={x:1/0,y:1/0,width:0,height:0};const _=this;(d=this.children)===null||d===void 0||d.forEach(function(z){if(!z.visible())return;const F=z.getClientRect({relativeTo:_,skipShadow:u.skipShadow,skipStroke:u.skipStroke});F.width===0&&F.height===0||(m===void 0?(m=F.x,y=F.y,x=F.x+F.width,R=F.y+F.height):(m=Math.min(m,F.x),y=Math.min(y,F.y),x=Math.max(x,F.x+F.width),R=Math.max(R,F.y+F.height)))});const b=this.find("Shape");let E=!1;for(let z=0;z<b.length;z++)if(b[z]._isVisible(this)){E=!0;break}return E&&m!==void 0?w={x:m,y,width:x-m,height:R-y}:w={x:0,y:0,width:0,height:0},f?w:this._transformedRect(w,g)}};return Ic.Container=l,n.Factory.addComponentsGetterSetter(l,"clip",["x","y","width","height"]),n.Factory.addGetterSetter(l,"clipX",void 0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(l,"clipY",void 0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(l,"clipWidth",void 0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(l,"clipHeight",void 0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(l,"clipFunc"),Ic}var Mf={},Io={},a0;function Em(){if(a0)return Io;a0=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.getCapturedShape=l,Io.createEvent=c,Io.hasPointerCapture=u,Io.setPointerCapture=d,Io.releaseCapture=f;const n=pt(),r=new Map,o=n.Konva._global.PointerEvent!==void 0;function l(g){return r.get(g)}function c(g){return{evt:g,pointerId:g.pointerId}}function u(g,m){return r.get(g)===m}function d(g,m){f(g),m.getStage()&&(r.set(g,m),o&&m._fire("gotpointercapture",c(new PointerEvent("gotpointercapture"))))}function f(g,m){const y=r.get(g);if(!y)return;const x=y.getStage();x&&x.content,r.delete(g),o&&y._fire("lostpointercapture",c(new PointerEvent("lostpointercapture")))}return Io}var l0;function z4(){return l0||(l0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Stage=n.stages=void 0;const r=gn(),o=yt(),l=Rh(),c=pt(),u=Fh(),d=wp(),f=pt(),g=Em(),m="Stage",y="string",x="px",R="mouseout",w="mouseleave",_="mouseover",b="mouseenter",E="mousemove",z="mousedown",F="mouseup",k="pointermove",N="pointerdown",L="pointerup",j="pointercancel",Y="lostpointercapture",O="pointerout",U="pointerleave",I="pointerover",V="pointerenter",J="contextmenu",A="touchstart",M="touchend",T="touchmove",H="touchcancel",G="wheel",X=5,oe=[[b,"_pointerenter"],[z,"_pointerdown"],[E,"_pointermove"],[F,"_pointerup"],[w,"_pointerleave"],[A,"_pointerdown"],[T,"_pointermove"],[M,"_pointerup"],[H,"_pointercancel"],[_,"_pointerover"],[G,"_wheel"],[J,"_contextmenu"],[N,"_pointerdown"],[k,"_pointermove"],[L,"_pointerup"],[j,"_pointercancel"],[Y,"_lostpointercapture"]],te={mouse:{[O]:R,[U]:w,[I]:_,[V]:b,[k]:E,[N]:z,[L]:F,[j]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[O]:"touchout",[U]:"touchleave",[I]:"touchover",[V]:"touchenter",[k]:T,[N]:A,[L]:M,[j]:H,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[O]:O,[U]:U,[I]:I,[V]:V,[k]:k,[N]:N,[L]:L,[j]:j,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},K=pe=>pe.indexOf("pointer")>=0?"pointer":pe.indexOf("touch")>=0?"touch":"mouse",ne=pe=>{const Q=K(pe);if(Q==="pointer")return c.Konva.pointerEventsEnabled&&te.pointer;if(Q==="touch")return te.touch;if(Q==="mouse")return te.mouse};function se(pe={}){return(pe.clipFunc||pe.clipWidth||pe.clipHeight)&&r.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),pe}const $="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);";n.stages=[];class ue extends l.Container{constructor(Q){super(se(Q)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),n.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",()=>{se(this.attrs)}),this._checkVisibility()}_validateAdd(Q){const re=Q.getType()==="Layer",de=Q.getType()==="FastLayer";re||de||r.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const Q=this.visible()?"":"none";this.content.style.display=Q}setContainer(Q){if(typeof Q===y){if(Q.charAt(0)==="."){const de=Q.slice(1);Q=document.getElementsByClassName(de)[0]}else{var re;Q.charAt(0)!=="#"?re=Q:re=Q.slice(1),Q=document.getElementById(re)}if(!Q)throw"Can not find container in document with id "+re}return this._setAttr("container",Q),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),Q.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){let Q=this.children,re=Q.length,de;for(de=0;de<re;de++)Q[de].clear();return this}clone(Q){return Q||(Q={}),Q.container=typeof document<"u"&&document.createElement("div"),l.Container.prototype.clone.call(this,Q)}destroy(){super.destroy();const Q=this.content;Q&&r.Util._isInDocument(Q)&&this.container().removeChild(Q);const re=n.stages.indexOf(this);return re>-1&&n.stages.splice(re,1),r.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const Q=this._pointerPositions[0]||this._changedPointerPositions[0];return Q?{x:Q.x,y:Q.y}:(r.Util.warn($),null)}_getPointerById(Q){return this._pointerPositions.find(re=>re.id===Q)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(Q){Q=Q||{},Q.x=Q.x||0,Q.y=Q.y||0,Q.width=Q.width||this.width(),Q.height=Q.height||this.height();const re=new u.SceneCanvas({width:Q.width,height:Q.height,pixelRatio:Q.pixelRatio||1}),de=re.getContext()._context,xe=this.children;return(Q.x||Q.y)&&de.translate(-1*Q.x,-1*Q.y),xe.forEach(function(Re){if(!Re.isVisible())return;const be=Re._toKonvaCanvas(Q);de.drawImage(be._canvas,Q.x,Q.y,be.getWidth()/be.getPixelRatio(),be.getHeight()/be.getPixelRatio())}),re}getIntersection(Q){if(!Q)return null;let re=this.children,de=re.length,xe=de-1,Re;for(Re=xe;Re>=0;Re--){const be=re[Re].getIntersection(Q);if(be)return be}return null}_resizeDOM(){const Q=this.width(),re=this.height();this.content&&(this.content.style.width=Q+x,this.content.style.height=re+x),this.bufferCanvas.setSize(Q,re),this.bufferHitCanvas.setSize(Q,re),this.children.forEach(de=>{de.setSize({width:Q,height:re}),de.draw()})}add(Q,...re){if(arguments.length>1){for(let xe=0;xe<arguments.length;xe++)this.add(arguments[xe]);return this}super.add(Q);const de=this.children.length;return de>X&&r.Util.warn("The stage has "+de+" 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."),Q.setSize({width:this.width(),height:this.height()}),Q.draw(),c.Konva.isBrowser&&this.content.appendChild(Q.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(Q){return g.hasPointerCapture(Q,this)}setPointerCapture(Q){g.setPointerCapture(Q,this)}releaseCapture(Q){g.releaseCapture(Q,this)}getLayers(){return this.children}_bindContentEvents(){c.Konva.isBrowser&&oe.forEach(([Q,re])=>{this.content.addEventListener(Q,de=>{this[re](de)},{passive:!1})})}_pointerenter(Q){this.setPointersPositions(Q);const re=ne(Q.type);re&&this._fire(re.pointerenter,{evt:Q,target:this,currentTarget:this})}_pointerover(Q){this.setPointersPositions(Q);const re=ne(Q.type);re&&this._fire(re.pointerover,{evt:Q,target:this,currentTarget:this})}_getTargetShape(Q){let re=this[Q+"targetShape"];return re&&!re.getStage()&&(re=null),re}_pointerleave(Q){const re=ne(Q.type),de=K(Q.type);if(!re)return;this.setPointersPositions(Q);const xe=this._getTargetShape(de),Re=!(c.Konva.isDragging()||c.Konva.isTransforming())||c.Konva.hitOnDragEnabled;xe&&Re?(xe._fireAndBubble(re.pointerout,{evt:Q}),xe._fireAndBubble(re.pointerleave,{evt:Q}),this._fire(re.pointerleave,{evt:Q,target:this,currentTarget:this}),this[de+"targetShape"]=null):Re&&(this._fire(re.pointerleave,{evt:Q,target:this,currentTarget:this}),this._fire(re.pointerout,{evt:Q,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(Q){const re=ne(Q.type),de=K(Q.type);if(!re)return;this.setPointersPositions(Q);let xe=!1;this._changedPointerPositions.forEach(Re=>{const be=this.getIntersection(Re);if(d.DD.justDragged=!1,c.Konva["_"+de+"ListenClick"]=!0,!be||!be.isListening()){this[de+"ClickStartShape"]=void 0;return}c.Konva.capturePointerEventsEnabled&&be.setPointerCapture(Re.id),this[de+"ClickStartShape"]=be,be._fireAndBubble(re.pointerdown,{evt:Q,pointerId:Re.id}),xe=!0;const Ye=Q.type.indexOf("touch")>=0;be.preventDefault()&&Q.cancelable&&Ye&&Q.preventDefault()}),xe||this._fire(re.pointerdown,{evt:Q,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(Q){const re=ne(Q.type),de=K(Q.type);if(!re||(c.Konva.isDragging()&&d.DD.node.preventDefault()&&Q.cancelable&&Q.preventDefault(),this.setPointersPositions(Q),!(!(c.Konva.isDragging()||c.Konva.isTransforming())||c.Konva.hitOnDragEnabled)))return;const Re={};let be=!1;const Ye=this._getTargetShape(de);this._changedPointerPositions.forEach(at=>{const Xe=g.getCapturedShape(at.id)||this.getIntersection(at),Pt=at.id,ht={evt:Q,pointerId:Pt},Pe=Ye!==Xe;if(Pe&&Ye&&(Ye._fireAndBubble(re.pointerout,{...ht},Xe),Ye._fireAndBubble(re.pointerleave,{...ht},Xe)),Xe){if(Re[Xe._id])return;Re[Xe._id]=!0}Xe&&Xe.isListening()?(be=!0,Pe&&(Xe._fireAndBubble(re.pointerover,{...ht},Ye),Xe._fireAndBubble(re.pointerenter,{...ht},Ye),this[de+"targetShape"]=Xe),Xe._fireAndBubble(re.pointermove,{...ht})):Ye&&(this._fire(re.pointerover,{evt:Q,target:this,currentTarget:this,pointerId:Pt}),this[de+"targetShape"]=null)}),be||this._fire(re.pointermove,{evt:Q,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(Q){const re=ne(Q.type),de=K(Q.type);if(!re)return;this.setPointersPositions(Q);const xe=this[de+"ClickStartShape"],Re=this[de+"ClickEndShape"],be={};let Ye=!1;this._changedPointerPositions.forEach(at=>{const Xe=g.getCapturedShape(at.id)||this.getIntersection(at);if(Xe){if(Xe.releaseCapture(at.id),be[Xe._id])return;be[Xe._id]=!0}const Pt=at.id,ht={evt:Q,pointerId:Pt};let Pe=!1;c.Konva["_"+de+"InDblClickWindow"]?(Pe=!0,clearTimeout(this[de+"DblTimeout"])):d.DD.justDragged||(c.Konva["_"+de+"InDblClickWindow"]=!0,clearTimeout(this[de+"DblTimeout"])),this[de+"DblTimeout"]=setTimeout(function(){c.Konva["_"+de+"InDblClickWindow"]=!1},c.Konva.dblClickWindow),Xe&&Xe.isListening()?(Ye=!0,this[de+"ClickEndShape"]=Xe,Xe._fireAndBubble(re.pointerup,{...ht}),c.Konva["_"+de+"ListenClick"]&&xe&&xe===Xe&&(Xe._fireAndBubble(re.pointerclick,{...ht}),Pe&&Re&&Re===Xe&&Xe._fireAndBubble(re.pointerdblclick,{...ht}))):(this[de+"ClickEndShape"]=null,c.Konva["_"+de+"ListenClick"]&&this._fire(re.pointerclick,{evt:Q,target:this,currentTarget:this,pointerId:Pt}),Pe&&this._fire(re.pointerdblclick,{evt:Q,target:this,currentTarget:this,pointerId:Pt}))}),Ye||this._fire(re.pointerup,{evt:Q,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),c.Konva["_"+de+"ListenClick"]=!1,Q.cancelable&&de!=="touch"&&Q.preventDefault()}_contextmenu(Q){this.setPointersPositions(Q);const re=this.getIntersection(this.getPointerPosition());re&&re.isListening()?re._fireAndBubble(J,{evt:Q}):this._fire(J,{evt:Q,target:this,currentTarget:this})}_wheel(Q){this.setPointersPositions(Q);const re=this.getIntersection(this.getPointerPosition());re&&re.isListening()?re._fireAndBubble(G,{evt:Q}):this._fire(G,{evt:Q,target:this,currentTarget:this})}_pointercancel(Q){this.setPointersPositions(Q);const re=g.getCapturedShape(Q.pointerId)||this.getIntersection(this.getPointerPosition());re&&re._fireAndBubble(L,g.createEvent(Q)),g.releaseCapture(Q.pointerId)}_lostpointercapture(Q){g.releaseCapture(Q.pointerId)}setPointersPositions(Q){let re=this._getContentPosition(),de=null,xe=null;Q=Q||window.event,Q.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(Q.touches,Re=>{this._pointerPositions.push({id:Re.identifier,x:(Re.clientX-re.left)/re.scaleX,y:(Re.clientY-re.top)/re.scaleY})}),Array.prototype.forEach.call(Q.changedTouches||Q.touches,Re=>{this._changedPointerPositions.push({id:Re.identifier,x:(Re.clientX-re.left)/re.scaleX,y:(Re.clientY-re.top)/re.scaleY})})):(de=(Q.clientX-re.left)/re.scaleX,xe=(Q.clientY-re.top)/re.scaleY,this.pointerPos={x:de,y:xe},this._pointerPositions=[{x:de,y:xe,id:r.Util._getFirstPointerId(Q)}],this._changedPointerPositions=[{x:de,y:xe,id:r.Util._getFirstPointerId(Q)}])}_setPointerPosition(Q){r.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(Q)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const Q=this.content.getBoundingClientRect();return{top:Q.top,left:Q.left,scaleX:Q.width/this.content.clientWidth||1,scaleY:Q.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new u.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new u.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!c.Konva.isBrowser)return;const Q=this.container();if(!Q)throw"Stage has no container. A container is required.";Q.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"),Q.appendChild(this.content),this._resizeDOM()}cache(){return r.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(Q){Q.batchDraw()}),this}}n.Stage=ue,ue.prototype.nodeType=m,(0,f._registerNode)(ue),o.Factory.addGetterSetter(ue,"container"),c.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{n.stages.forEach(pe=>{pe.batchDraw()})})})(Mf)),Mf}var jc={},Of={},c0;function tr(){return c0||(c0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Shape=n.shapes=void 0;const r=pt(),o=gn(),l=yt(),c=Rn(),u=wt(),d=pt(),f=Em(),g="hasShadow",m="shadowRGBA",y="patternImage",x="linearGradient",R="radialGradient";let w;function _(){return w||(w=o.Util.createCanvasElement().getContext("2d"),w)}n.shapes={};function b(U){const I=this.attrs.fillRule;I?U.fill(I):U.fill()}function E(U){U.stroke()}function z(U){const I=this.attrs.fillRule;I?U.fill(I):U.fill()}function F(U){U.stroke()}function k(){this._clearCache(g)}function N(){this._clearCache(m)}function L(){this._clearCache(y)}function j(){this._clearCache(x)}function Y(){this._clearCache(R)}class O extends c.Node{constructor(I){super(I);let V;for(;V=o.Util.getRandomColor(),!(V&&!(V in n.shapes)););this.colorKey=V,n.shapes[V]=this}getContext(){return o.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return o.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(g,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 V=_().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(V&&V.setTransform){const J=new o.Transform;J.translate(this.fillPatternX(),this.fillPatternY()),J.rotate(r.Konva.getAngle(this.fillPatternRotation())),J.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),J.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const A=J.getMatrix(),M=typeof DOMMatrix>"u"?{a:A[0],b:A[1],c:A[2],d:A[3],e:A[4],f:A[5]}:new DOMMatrix(A);V.setTransform(M)}return V}}_getLinearGradient(){return this._getCache(x,this.__getLinearGradient)}__getLinearGradient(){const I=this.fillLinearGradientColorStops();if(I){const V=_(),J=this.fillLinearGradientStartPoint(),A=this.fillLinearGradientEndPoint(),M=V.createLinearGradient(J.x,J.y,A.x,A.y);for(let T=0;T<I.length;T+=2)M.addColorStop(I[T],I[T+1]);return M}}_getRadialGradient(){return this._getCache(R,this.__getRadialGradient)}__getRadialGradient(){const I=this.fillRadialGradientColorStops();if(I){const V=_(),J=this.fillRadialGradientStartPoint(),A=this.fillRadialGradientEndPoint(),M=V.createRadialGradient(J.x,J.y,this.fillRadialGradientStartRadius(),A.x,A.y,this.fillRadialGradientEndRadius());for(let T=0;T<I.length;T+=2)M.addColorStop(I[T],I[T+1]);return M}}getShadowRGBA(){return this._getCache(m,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const I=o.Util.colorToRGBA(this.shadowColor());if(I)return"rgba("+I.r+","+I.g+","+I.b+","+I.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const I=this.hitStrokeWidth();return I==="auto"?this.hasStroke():this.strokeEnabled()&&!!I}intersects(I){const V=this.getStage();if(!V)return!1;const J=V.bufferHitCanvas;return J.getContext().clear(),this.drawHit(J,void 0,!0),J.context.getImageData(Math.round(I.x),Math.round(I.y),1,1).data[3]>0}destroy(){return c.Node.prototype.destroy.call(this),delete n.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(I){var V;if(!((V=this.attrs.perfectDrawEnabled)!==null&&V!==void 0?V:!0))return!1;const A=I||this.hasFill(),M=this.hasStroke(),T=this.getAbsoluteOpacity()!==1;if(A&&M&&T)return!0;const H=this.hasShadow(),G=this.shadowForStrokeEnabled();return!!(A&&M&&H&&G)}setStrokeHitEnabled(I){o.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),I?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const I=this.size();return{x:this._centroid?-I.width/2:0,y:this._centroid?-I.height/2:0,width:I.width,height:I.height}}getClientRect(I={}){let V=!1,J=this.getParent();for(;J;){if(J.isCached()){V=!0;break}J=J.getParent()}const A=I.skipTransform,M=I.relativeTo||V&&this.getStage()||void 0,T=this.getSelfRect(),G=!I.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,X=T.width+G,oe=T.height+G,te=!I.skipShadow&&this.hasShadow(),K=te?this.shadowOffsetX():0,ne=te?this.shadowOffsetY():0,se=X+Math.abs(K),$=oe+Math.abs(ne),ue=te&&this.shadowBlur()||0,pe=se+ue*2,Q=$+ue*2,re={width:pe,height:Q,x:-(G/2+ue)+Math.min(K,0)+T.x,y:-(G/2+ue)+Math.min(ne,0)+T.y};return A?re:this._transformedRect(re,M)}drawScene(I,V,J){const A=this.getLayer();let M=I||A.getCanvas(),T=M.getContext(),H=this._getCanvasCache(),G=this.getSceneFunc(),X=this.hasShadow(),oe,te;const K=M.isCache,ne=V===this;if(!this.isVisible()&&!ne)return this;if(H){T.save();const $=this.getAbsoluteTransform(V).getMatrix();return T.transform($[0],$[1],$[2],$[3],$[4],$[5]),this._drawCachedSceneCanvas(T),T.restore(),this}if(!G)return this;if(T.save(),this._useBufferCanvas()&&!K){oe=this.getStage();const $=J||oe.bufferCanvas;te=$.getContext(),te.clear(),te.save(),te._applyLineJoin(this);var se=this.getAbsoluteTransform(V).getMatrix();te.transform(se[0],se[1],se[2],se[3],se[4],se[5]),G.call(this,te,this),te.restore();const ue=$.pixelRatio;X&&T._applyShadow(this),T._applyOpacity(this),T._applyGlobalCompositeOperation(this),T.drawImage($._canvas,0,0,$.width/ue,$.height/ue)}else{if(T._applyLineJoin(this),!ne){var se=this.getAbsoluteTransform(V).getMatrix();T.transform(se[0],se[1],se[2],se[3],se[4],se[5]),T._applyOpacity(this),T._applyGlobalCompositeOperation(this)}X&&T._applyShadow(this),G.call(this,T,this)}return T.restore(),this}drawHit(I,V,J=!1){if(!this.shouldDrawHit(V,J))return this;const A=this.getLayer(),M=I||A.hitCanvas,T=M&&M.getContext(),H=this.hitFunc()||this.sceneFunc(),G=this._getCanvasCache(),X=G&&G.hit;if(this.colorKey||o.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()"),X){T.save();const te=this.getAbsoluteTransform(V).getMatrix();return T.transform(te[0],te[1],te[2],te[3],te[4],te[5]),this._drawCachedHitCanvas(T),T.restore(),this}if(!H)return this;if(T.save(),T._applyLineJoin(this),!(this===V)){const te=this.getAbsoluteTransform(V).getMatrix();T.transform(te[0],te[1],te[2],te[3],te[4],te[5])}return H.call(this,T,this),T.restore(),this}drawHitFromCache(I=0){let V=this._getCanvasCache(),J=this._getCachedSceneCanvas(),A=V.hit,M=A.getContext(),T=A.getWidth(),H=A.getHeight(),G,X,oe,te,K,ne;M.clear(),M.drawImage(J._canvas,0,0,T,H);try{for(G=M.getImageData(0,0,T,H),X=G.data,oe=X.length,te=o.Util._hexToRgb(this.colorKey),K=0;K<oe;K+=4)ne=X[K+3],ne>I?(X[K]=te.r,X[K+1]=te.g,X[K+2]=te.b,X[K+3]=255):X[K+3]=0;M.putImageData(G,0,0)}catch(se){o.Util.error("Unable to draw hit graph from cached scene canvas. "+se.message)}return this}hasPointerCapture(I){return f.hasPointerCapture(I,this)}setPointerCapture(I){f.setPointerCapture(I,this)}releaseCapture(I){f.releaseCapture(I,this)}}n.Shape=O,O.prototype._fillFunc=b,O.prototype._strokeFunc=E,O.prototype._fillFuncHit=z,O.prototype._strokeFuncHit=F,O.prototype._centroid=!1,O.prototype.nodeType="Shape",(0,d._registerNode)(O),O.prototype.eventListeners={},O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",k),O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",N),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",L),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",j),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",Y),l.Factory.addGetterSetter(O,"stroke",void 0,(0,u.getStringOrGradientValidator)()),l.Factory.addGetterSetter(O,"strokeWidth",2,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillAfterStrokeEnabled",!1),l.Factory.addGetterSetter(O,"hitStrokeWidth","auto",(0,u.getNumberOrAutoValidator)()),l.Factory.addGetterSetter(O,"strokeHitEnabled",!0,(0,u.getBooleanValidator)()),l.Factory.addGetterSetter(O,"perfectDrawEnabled",!0,(0,u.getBooleanValidator)()),l.Factory.addGetterSetter(O,"shadowForStrokeEnabled",!0,(0,u.getBooleanValidator)()),l.Factory.addGetterSetter(O,"lineJoin"),l.Factory.addGetterSetter(O,"lineCap"),l.Factory.addGetterSetter(O,"sceneFunc"),l.Factory.addGetterSetter(O,"hitFunc"),l.Factory.addGetterSetter(O,"dash"),l.Factory.addGetterSetter(O,"dashOffset",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"shadowColor",void 0,(0,u.getStringValidator)()),l.Factory.addGetterSetter(O,"shadowBlur",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"shadowOpacity",1,(0,u.getNumberValidator)()),l.Factory.addComponentsGetterSetter(O,"shadowOffset",["x","y"]),l.Factory.addGetterSetter(O,"shadowOffsetX",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"shadowOffsetY",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillPatternImage"),l.Factory.addGetterSetter(O,"fill",void 0,(0,u.getStringOrGradientValidator)()),l.Factory.addGetterSetter(O,"fillPatternX",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillPatternY",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillLinearGradientColorStops"),l.Factory.addGetterSetter(O,"strokeLinearGradientColorStops"),l.Factory.addGetterSetter(O,"fillRadialGradientStartRadius",0),l.Factory.addGetterSetter(O,"fillRadialGradientEndRadius",0),l.Factory.addGetterSetter(O,"fillRadialGradientColorStops"),l.Factory.addGetterSetter(O,"fillPatternRepeat","repeat"),l.Factory.addGetterSetter(O,"fillEnabled",!0),l.Factory.addGetterSetter(O,"strokeEnabled",!0),l.Factory.addGetterSetter(O,"shadowEnabled",!0),l.Factory.addGetterSetter(O,"dashEnabled",!0),l.Factory.addGetterSetter(O,"strokeScaleEnabled",!0),l.Factory.addGetterSetter(O,"fillPriority","color"),l.Factory.addComponentsGetterSetter(O,"fillPatternOffset",["x","y"]),l.Factory.addGetterSetter(O,"fillPatternOffsetX",0,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillPatternOffsetY",0,(0,u.getNumberValidator)()),l.Factory.addComponentsGetterSetter(O,"fillPatternScale",["x","y"]),l.Factory.addGetterSetter(O,"fillPatternScaleX",1,(0,u.getNumberValidator)()),l.Factory.addGetterSetter(O,"fillPatternScaleY",1,(0,u.getNumberValidator)()),l.Factory.addComponentsGetterSetter(O,"fillLinearGradientStartPoint",["x","y"]),l.Factory.addComponentsGetterSetter(O,"strokeLinearGradientStartPoint",["x","y"]),l.Factory.addGetterSetter(O,"fillLinearGradientStartPointX",0),l.Factory.addGetterSetter(O,"strokeLinearGradientStartPointX",0),l.Factory.addGetterSetter(O,"fillLinearGradientStartPointY",0),l.Factory.addGetterSetter(O,"strokeLinearGradientStartPointY",0),l.Factory.addComponentsGetterSetter(O,"fillLinearGradientEndPoint",["x","y"]),l.Factory.addComponentsGetterSetter(O,"strokeLinearGradientEndPoint",["x","y"]),l.Factory.addGetterSetter(O,"fillLinearGradientEndPointX",0),l.Factory.addGetterSetter(O,"strokeLinearGradientEndPointX",0),l.Factory.addGetterSetter(O,"fillLinearGradientEndPointY",0),l.Factory.addGetterSetter(O,"strokeLinearGradientEndPointY",0),l.Factory.addComponentsGetterSetter(O,"fillRadialGradientStartPoint",["x","y"]),l.Factory.addGetterSetter(O,"fillRadialGradientStartPointX",0),l.Factory.addGetterSetter(O,"fillRadialGradientStartPointY",0),l.Factory.addComponentsGetterSetter(O,"fillRadialGradientEndPoint",["x","y"]),l.Factory.addGetterSetter(O,"fillRadialGradientEndPointX",0),l.Factory.addGetterSetter(O,"fillRadialGradientEndPointY",0),l.Factory.addGetterSetter(O,"fillPatternRotation",0),l.Factory.addGetterSetter(O,"fillRule",void 0,(0,u.getStringValidator)()),l.Factory.backCompat(O,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Of)),Of}var u0;function bm(){if(u0)return jc;u0=1,Object.defineProperty(jc,"__esModule",{value:!0}),jc.Layer=void 0;const n=gn(),r=Rh(),o=Rn(),l=yt(),c=Fh(),u=wt(),d=tr(),f=pt(),g="#",m="beforeDraw",y="draw",x=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],R=x.length;class w extends r.Container{constructor(b){super(b),this.canvas=new c.SceneCanvas,this.hitCanvas=new c.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(b){return this.getContext().clear(b),this.getHitCanvas().getContext().clear(b),this}setZIndex(b){super.setZIndex(b);const E=this.getStage();return E&&E.content&&(E.content.removeChild(this.getNativeCanvasElement()),b<E.children.length-1?E.content.insertBefore(this.getNativeCanvasElement(),E.children[b+1].getCanvas()._canvas):E.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){o.Node.prototype.moveToTop.call(this);const b=this.getStage();return b&&b.content&&(b.content.removeChild(this.getNativeCanvasElement()),b.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!o.Node.prototype.moveUp.call(this))return!1;const E=this.getStage();return!E||!E.content?!1:(E.content.removeChild(this.getNativeCanvasElement()),this.index<E.children.length-1?E.content.insertBefore(this.getNativeCanvasElement(),E.children[this.index+1].getCanvas()._canvas):E.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(o.Node.prototype.moveDown.call(this)){const b=this.getStage();if(b){const E=b.children;b.content&&(b.content.removeChild(this.getNativeCanvasElement()),b.content.insertBefore(this.getNativeCanvasElement(),E[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(o.Node.prototype.moveToBottom.call(this)){const b=this.getStage();if(b){const E=b.children;b.content&&(b.content.removeChild(this.getNativeCanvasElement()),b.content.insertBefore(this.getNativeCanvasElement(),E[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const b=this.getNativeCanvasElement();return o.Node.prototype.remove.call(this),b&&b.parentNode&&n.Util._isInDocument(b)&&b.parentNode.removeChild(b),this}getStage(){return this.parent}setSize({width:b,height:E}){return this.canvas.setSize(b,E),this.hitCanvas.setSize(b,E),this._setSmoothEnabled(),this}_validateAdd(b){const E=b.getType();E!=="Group"&&E!=="Shape"&&n.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(b){return b=b||{},b.width=b.width||this.getWidth(),b.height=b.height||this.getHeight(),b.x=b.x!==void 0?b.x:this.x(),b.y=b.y!==void 0?b.y:this.y(),o.Node.prototype._toKonvaCanvas.call(this,b)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){n.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){n.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,n.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(b){if(!this.isListening()||!this.isVisible())return null;let E=1,z=!1;for(;;){for(let F=0;F<R;F++){const k=x[F],N=this._getIntersection({x:b.x+k.x*E,y:b.y+k.y*E}),L=N.shape;if(L)return L;if(z=!!N.antialiased,!N.antialiased)break}if(z)E+=1;else return null}}_getIntersection(b){const E=this.hitCanvas.pixelRatio,z=this.hitCanvas.context.getImageData(Math.round(b.x*E),Math.round(b.y*E),1,1).data,F=z[3];if(F===255){const k=n.Util._rgbToHex(z[0],z[1],z[2]),N=d.shapes[g+k];return N?{shape:N}:{antialiased:!0}}else if(F>0)return{antialiased:!0};return{}}drawScene(b,E){const z=this.getLayer(),F=b||z&&z.getCanvas();return this._fire(m,{node:this}),this.clearBeforeDraw()&&F.getContext().clear(),r.Container.prototype.drawScene.call(this,F,E),this._fire(y,{node:this}),this}drawHit(b,E){const z=this.getLayer(),F=b||z&&z.hitCanvas;return z&&z.clearBeforeDraw()&&z.getHitCanvas().getContext().clear(),r.Container.prototype.drawHit.call(this,F,E),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(b){n.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(b)}getHitGraphEnabled(b){return n.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const b=this.parent;!!this.hitCanvas._canvas.parentNode?b.content.removeChild(this.hitCanvas._canvas):b.content.appendChild(this.hitCanvas._canvas)}destroy(){return n.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}return jc.Layer=w,w.prototype.nodeType="Layer",(0,f._registerNode)(w),l.Factory.addGetterSetter(w,"imageSmoothingEnabled",!0),l.Factory.addGetterSetter(w,"clearBeforeDraw",!0),l.Factory.addGetterSetter(w,"hitGraphEnabled",!0,(0,u.getBooleanValidator)()),jc}var Uc={},d0;function M4(){if(d0)return Uc;d0=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.FastLayer=void 0;const n=gn(),r=bm(),o=pt();let l=class extends r.Layer{constructor(u){super(u),this.listening(!1),n.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};return Uc.FastLayer=l,l.prototype.nodeType="FastLayer",(0,o._registerNode)(l),Uc}var Bc={},h0;function Sp(){if(h0)return Bc;h0=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.Group=void 0;const n=gn(),r=Rh(),o=pt();class l extends r.Container{_validateAdd(u){const d=u.getType();d!=="Group"&&d!=="Shape"&&n.Util.throw("You may only add groups and shapes to groups.")}}return Bc.Group=l,l.prototype.nodeType="Group",(0,o._registerNode)(l),Bc}var Gc={},f0;function kp(){if(f0)return Gc;f0=1,Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.Animation=void 0;const n=pt(),r=gn(),o=(function(){return n.glob.performance&&n.glob.performance.now?function(){return n.glob.performance.now()}:function(){return new Date().getTime()}})();let l=class Rl{constructor(u,d){this.id=Rl.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:o(),frameRate:0},this.func=u,this.setLayers(d)}setLayers(u){let d=[];return u&&(d=Array.isArray(u)?u:[u]),this.layers=d,this}getLayers(){return this.layers}addLayer(u){const d=this.layers,f=d.length;for(let g=0;g<f;g++)if(d[g]._id===u._id)return!1;return this.layers.push(u),!0}isRunning(){const d=Rl.animations,f=d.length;for(let g=0;g<f;g++)if(d[g].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=o(),Rl._addAnimation(this),this}stop(){return Rl._removeAnimation(this),this}_updateFrameObject(u){this.frame.timeDiff=u-this.frame.lastTime,this.frame.lastTime=u,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(u){this.animations.push(u),this._handleAnimation()}static _removeAnimation(u){const d=u.id,f=this.animations,g=f.length;for(let m=0;m<g;m++)if(f[m].id===d){this.animations.splice(m,1);break}}static _runFrames(){const u={},d=this.animations;for(let f=0;f<d.length;f++){const g=d[f],m=g.layers,y=g.func;g._updateFrameObject(o());const x=m.length;let R;if(y?R=y.call(g,g.frame)!==!1:R=!0,!!R)for(let w=0;w<x;w++){const _=m[w];_._id!==void 0&&(u[_._id]=_)}}for(const f in u)u.hasOwnProperty(f)&&u[f].batchDraw()}static _animationLoop(){const u=Rl;u.animations.length?(u._runFrames(),r.Util.requestAnimFrame(u._animationLoop)):u.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,r.Util.requestAnimFrame(this._animationLoop))}};return Gc.Animation=l,l.animations=[],l.animIdCounter=0,l.animRunning=!1,Gc}var If={},p0;function O4(){return p0||(p0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Easings=n.Tween=void 0;const r=gn(),o=kp(),l=Rn(),c=pt();let u={node:1,duration:1,easing:1,onFinish:1,yoyo:1},d=1,f=2,g=3,m=0,y=["fill","stroke","shadowColor"];class x{constructor(_,b,E,z,F,k,N){this.prop=_,this.propFunc=b,this.begin=z,this._pos=z,this.duration=k,this._change=0,this.prevPos=0,this.yoyo=N,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=E,this._change=F-this.begin,this.pause()}fire(_){const b=this[_];b&&b()}setTime(_){_>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():_<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=_,this.update())}getTime(){return this._time}setPosition(_){this.prevPos=this._pos,this.propFunc(_),this._pos=_}getPosition(_){return _===void 0&&(_=this._time),this.func(_,this.begin,this._change,this.duration)}play(){this.state=f,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=g,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(_){this.pause(),this._time=_,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 _=this.getTimer()-this._startTime;this.state===f?this.setTime(_):this.state===g&&this.setTime(this.duration-_)}pause(){this.state=d,this.fire("onPause")}getTimer(){return new Date().getTime()}}class R{constructor(_){let b=this,E=_.node,z=E._id,F,k=_.easing||n.Easings.Linear,N=!!_.yoyo,L;typeof _.duration>"u"?F=.3:_.duration===0?F=.001:F=_.duration,this.node=E,this._id=m++;const j=E.getLayer()||(E instanceof c.Konva.Stage?E.getLayers():null);j||r.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new o.Animation(function(){b.tween.onEnterFrame()},j),this.tween=new x(L,function(Y){b._tweenFunc(Y)},k,0,1,F*1e3,N),this._addListeners(),R.attrs[z]||(R.attrs[z]={}),R.attrs[z][this._id]||(R.attrs[z][this._id]={}),R.tweens[z]||(R.tweens[z]={});for(L in _)u[L]===void 0&&this._addAttr(L,_[L]);this.reset(),this.onFinish=_.onFinish,this.onReset=_.onReset,this.onUpdate=_.onUpdate}_addAttr(_,b){let E=this.node,z=E._id,F,k,N,L,j,Y,O,U;if(N=R.tweens[z][_],N&&delete R.attrs[z][N][_],F=E.getAttr(_),r.Util._isArray(b))if(k=[],j=Math.max(b.length,F.length),_==="points"&&b.length!==F.length&&(b.length>F.length?(O=F,F=r.Util._prepareArrayForTween(F,b,E.closed())):(Y=b,b=r.Util._prepareArrayForTween(b,F,E.closed()))),_.indexOf("fill")===0)for(L=0;L<j;L++)if(L%2===0)k.push(b[L]-F[L]);else{const I=r.Util.colorToRGBA(F[L]);U=r.Util.colorToRGBA(b[L]),F[L]=I,k.push({r:U.r-I.r,g:U.g-I.g,b:U.b-I.b,a:U.a-I.a})}else for(L=0;L<j;L++)k.push(b[L]-F[L]);else y.indexOf(_)!==-1?(F=r.Util.colorToRGBA(F),U=r.Util.colorToRGBA(b),k={r:U.r-F.r,g:U.g-F.g,b:U.b-F.b,a:U.a-F.a}):k=b-F;R.attrs[z][this._id][_]={start:F,diff:k,end:b,trueEnd:Y,trueStart:O},R.tweens[z][_]=this._id}_tweenFunc(_){let b=this.node,E=R.attrs[b._id][this._id],z,F,k,N,L,j,Y,O;for(z in E){if(F=E[z],k=F.start,N=F.diff,O=F.end,r.Util._isArray(k))if(L=[],Y=Math.max(k.length,O.length),z.indexOf("fill")===0)for(j=0;j<Y;j++)j%2===0?L.push((k[j]||0)+N[j]*_):L.push("rgba("+Math.round(k[j].r+N[j].r*_)+","+Math.round(k[j].g+N[j].g*_)+","+Math.round(k[j].b+N[j].b*_)+","+(k[j].a+N[j].a*_)+")");else for(j=0;j<Y;j++)L.push((k[j]||0)+N[j]*_);else y.indexOf(z)!==-1?L="rgba("+Math.round(k.r+N.r*_)+","+Math.round(k.g+N.g*_)+","+Math.round(k.b+N.b*_)+","+(k.a+N.a*_)+")":L=k+N*_;b.setAttr(z,L)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const _=this.node,b=R.attrs[_._id][this._id];b.points&&b.points.trueEnd&&_.setAttr("points",b.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const _=this.node,b=R.attrs[_._id][this._id];b.points&&b.points.trueStart&&_.points(b.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(_){return this.tween.seek(_*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let _=this.node._id,b=this._id,E=R.tweens[_],z;this.pause();for(z in E)delete R.tweens[_][z];delete R.attrs[_][b]}}n.Tween=R,R.attrs={},R.tweens={},l.Node.prototype.to=function(w){const _=w.onFinish;w.node=this,w.onFinish=function(){this.destroy(),_&&_()},new R(w).play()},n.Easings={BackEaseIn(w,_,b,E){return b*(w/=E)*w*((1.70158+1)*w-1.70158)+_},BackEaseOut(w,_,b,E){return b*((w=w/E-1)*w*((1.70158+1)*w+1.70158)+1)+_},BackEaseInOut(w,_,b,E){let z=1.70158;return(w/=E/2)<1?b/2*(w*w*(((z*=1.525)+1)*w-z))+_:b/2*((w-=2)*w*(((z*=1.525)+1)*w+z)+2)+_},ElasticEaseIn(w,_,b,E,z,F){let k=0;return w===0?_:(w/=E)===1?_+b:(F||(F=E*.3),!z||z<Math.abs(b)?(z=b,k=F/4):k=F/(2*Math.PI)*Math.asin(b/z),-(z*Math.pow(2,10*(w-=1))*Math.sin((w*E-k)*(2*Math.PI)/F))+_)},ElasticEaseOut(w,_,b,E,z,F){let k=0;return w===0?_:(w/=E)===1?_+b:(F||(F=E*.3),!z||z<Math.abs(b)?(z=b,k=F/4):k=F/(2*Math.PI)*Math.asin(b/z),z*Math.pow(2,-10*w)*Math.sin((w*E-k)*(2*Math.PI)/F)+b+_)},ElasticEaseInOut(w,_,b,E,z,F){let k=0;return w===0?_:(w/=E/2)===2?_+b:(F||(F=E*(.3*1.5)),!z||z<Math.abs(b)?(z=b,k=F/4):k=F/(2*Math.PI)*Math.asin(b/z),w<1?-.5*(z*Math.pow(2,10*(w-=1))*Math.sin((w*E-k)*(2*Math.PI)/F))+_:z*Math.pow(2,-10*(w-=1))*Math.sin((w*E-k)*(2*Math.PI)/F)*.5+b+_)},BounceEaseOut(w,_,b,E){return(w/=E)<1/2.75?b*(7.5625*w*w)+_:w<2/2.75?b*(7.5625*(w-=1.5/2.75)*w+.75)+_:w<2.5/2.75?b*(7.5625*(w-=2.25/2.75)*w+.9375)+_:b*(7.5625*(w-=2.625/2.75)*w+.984375)+_},BounceEaseIn(w,_,b,E){return b-n.Easings.BounceEaseOut(E-w,0,b,E)+_},BounceEaseInOut(w,_,b,E){return w<E/2?n.Easings.BounceEaseIn(w*2,0,b,E)*.5+_:n.Easings.BounceEaseOut(w*2-E,0,b,E)*.5+b*.5+_},EaseIn(w,_,b,E){return b*(w/=E)*w+_},EaseOut(w,_,b,E){return-b*(w/=E)*(w-2)+_},EaseInOut(w,_,b,E){return(w/=E/2)<1?b/2*w*w+_:-b/2*(--w*(w-2)-1)+_},StrongEaseIn(w,_,b,E){return b*(w/=E)*w*w*w*w+_},StrongEaseOut(w,_,b,E){return b*((w=w/E-1)*w*w*w*w+1)+_},StrongEaseInOut(w,_,b,E){return(w/=E/2)<1?b/2*w*w*w*w*w+_:b/2*((w-=2)*w*w*w*w+2)+_},Linear(w,_,b,E){return b*w/E+_}}})(If)),If}var g0;function ip(){return g0||(g0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Konva=void 0;const r=pt(),o=gn(),l=Rn(),c=Rh(),u=z4(),d=bm(),f=M4(),g=Sp(),m=wp(),y=tr(),x=kp(),R=O4(),w=Rm(),_=Fh();n.Konva=o.Util._assign(r.Konva,{Util:o.Util,Transform:o.Transform,Node:l.Node,Container:c.Container,Stage:u.Stage,stages:u.stages,Layer:d.Layer,FastLayer:f.FastLayer,Group:g.Group,DD:m.DD,Shape:y.Shape,shapes:y.shapes,Animation:x.Animation,Tween:R.Tween,Easings:R.Easings,Context:w.Context,Canvas:_.Canvas}),n.default=n.Konva})(Nf)),Nf}var Hc={},m0;function I4(){if(m0)return Hc;m0=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.Arc=void 0;const n=yt(),r=tr(),o=pt(),l=wt(),c=pt();let u=class extends r.Shape{_sceneFunc(f){const g=o.Konva.getAngle(this.angle()),m=this.clockwise();f.beginPath(),f.arc(0,0,this.outerRadius(),0,g,m),f.arc(0,0,this.innerRadius(),g,0,!m),f.closePath(),f.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(f){this.outerRadius(f/2)}setHeight(f){this.outerRadius(f/2)}getSelfRect(){const f=this.innerRadius(),g=this.outerRadius(),m=this.clockwise(),y=o.Konva.getAngle(m?360-this.angle():this.angle()),x=Math.cos(Math.min(y,Math.PI)),R=1,w=Math.sin(Math.min(Math.max(Math.PI,y),3*Math.PI/2)),_=Math.sin(Math.min(y,Math.PI/2)),b=x*(x>0?f:g),E=R*g,z=w*(w>0?f:g),F=_*(_>0?g:f);return{x:b,y:m?-1*F:z,width:E-b,height:F-z}}};return Hc.Arc=u,u.prototype._centroid=!0,u.prototype.className="Arc",u.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,c._registerNode)(u),n.Factory.addGetterSetter(u,"innerRadius",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"outerRadius",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"angle",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"clockwise",!1,(0,l.getBooleanValidator)()),Hc}var Vc={},Wc={},v0;function Pm(){if(v0)return Wc;v0=1,Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.Line=void 0;const n=yt(),r=pt(),o=tr(),l=wt();function c(f,g,m,y,x,R,w){const _=Math.sqrt(Math.pow(m-f,2)+Math.pow(y-g,2)),b=Math.sqrt(Math.pow(x-m,2)+Math.pow(R-y,2)),E=w*_/(_+b),z=w*b/(_+b),F=m-E*(x-f),k=y-E*(R-g),N=m+z*(x-f),L=y+z*(R-g);return[F,k,N,L]}function u(f,g){const m=f.length,y=[];for(let x=2;x<m-2;x+=2){const R=c(f[x-2],f[x-1],f[x],f[x+1],f[x+2],f[x+3],g);isNaN(R[0])||(y.push(R[0]),y.push(R[1]),y.push(f[x]),y.push(f[x+1]),y.push(R[2]),y.push(R[3]))}return y}class d extends o.Shape{constructor(g){super(g),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(g){let m=this.points(),y=m.length,x=this.tension(),R=this.closed(),w=this.bezier(),_,b,E;if(y){if(g.beginPath(),g.moveTo(m[0],m[1]),x!==0&&y>4){for(_=this.getTensionPoints(),b=_.length,E=R?0:4,R||g.quadraticCurveTo(_[0],_[1],_[2],_[3]);E<b-2;)g.bezierCurveTo(_[E++],_[E++],_[E++],_[E++],_[E++],_[E++]);R||g.quadraticCurveTo(_[b-2],_[b-1],m[y-2],m[y-1])}else if(w)for(E=2;E<y;)g.bezierCurveTo(m[E++],m[E++],m[E++],m[E++],m[E++],m[E++]);else for(E=2;E<y;E+=2)g.lineTo(m[E],m[E+1]);R?(g.closePath(),g.fillStrokeShape(this)):g.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():u(this.points(),this.tension())}_getTensionPointsClosed(){const g=this.points(),m=g.length,y=this.tension(),x=c(g[m-2],g[m-1],g[0],g[1],g[2],g[3],y),R=c(g[m-4],g[m-3],g[m-2],g[m-1],g[0],g[1],y),w=u(g,y);return[x[2],x[3]].concat(w).concat([R[0],R[1],g[m-2],g[m-1],R[2],R[3],x[0],x[1],g[0],g[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let g=this.points();if(g.length<4)return{x:g[0]||0,y:g[1]||0,width:0,height:0};this.tension()!==0?g=[g[0],g[1],...this._getTensionPoints(),g[g.length-2],g[g.length-1]]:g=this.points();let m=g[0],y=g[0],x=g[1],R=g[1],w,_;for(let b=0;b<g.length/2;b++)w=g[b*2],_=g[b*2+1],m=Math.min(m,w),y=Math.max(y,w),x=Math.min(x,_),R=Math.max(R,_);return{x:m,y:x,width:y-m,height:R-x}}}return Wc.Line=d,d.prototype.className="Line",d.prototype._attrsAffectingSize=["points","bezier","tension"],(0,r._registerNode)(d),n.Factory.addGetterSetter(d,"closed",!1),n.Factory.addGetterSetter(d,"bezier",!1),n.Factory.addGetterSetter(d,"tension",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(d,"points",[],(0,l.getNumberArrayValidator)()),Wc}var Kc={},jf={},y0;function j4(){return y0||(y0=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.t2length=n.getQuadraticArcLength=n.getCubicArcLength=n.binomialCoefficients=n.cValues=n.tValues=void 0,n.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],n.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],n.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const r=(d,f,g)=>{let m,y;const R=g/2;m=0;for(let w=0;w<20;w++)y=R*n.tValues[20][w]+R,m+=n.cValues[20][w]*l(d,f,y);return R*m};n.getCubicArcLength=r;const o=(d,f,g)=>{g===void 0&&(g=1);const m=d[0]-2*d[1]+d[2],y=f[0]-2*f[1]+f[2],x=2*d[1]-2*d[0],R=2*f[1]-2*f[0],w=4*(m*m+y*y),_=4*(m*x+y*R),b=x*x+R*R;if(w===0)return g*Math.sqrt(Math.pow(d[2]-d[0],2)+Math.pow(f[2]-f[0],2));const E=_/(2*w),z=b/w,F=g+E,k=z-E*E,N=F*F+k>0?Math.sqrt(F*F+k):0,L=E*E+k>0?Math.sqrt(E*E+k):0,j=E+Math.sqrt(E*E+k)!==0?k*Math.log(Math.abs((F+N)/(E+L))):0;return Math.sqrt(w)/2*(F*N-E*L+j)};n.getQuadraticArcLength=o;function l(d,f,g){const m=c(1,g,d),y=c(1,g,f),x=m*m+y*y;return Math.sqrt(x)}const c=(d,f,g)=>{const m=g.length-1;let y,x;if(m===0)return 0;if(d===0){x=0;for(let R=0;R<=m;R++)x+=n.binomialCoefficients[m][R]*Math.pow(1-f,m-R)*Math.pow(f,R)*g[R];return x}else{y=new Array(m);for(let R=0;R<m;R++)y[R]=m*(g[R+1]-g[R]);return c(d-1,f,y)}},u=(d,f,g)=>{let m=1,y=d/f,x=(d-g(y))/f,R=0;for(;m>.001;){const w=g(y+x),_=Math.abs(d-w)/f;if(_<m)m=_,y+=x;else{const b=g(y-x),E=Math.abs(d-b)/f;E<m?(m=E,y-=x):x/=2}if(R++,R>500)break}return y};n.t2length=u})(jf)),jf}var x0;function _p(){if(x0)return Kc;x0=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.Path=void 0;const n=yt(),r=tr(),o=pt(),l=j4();let c=class Xr extends r.Shape{constructor(d){super(d),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Xr.parsePathData(this.data()),this.pathLength=Xr.getPathLength(this.dataArray)}_sceneFunc(d){const f=this.dataArray;d.beginPath();let g=!1;for(let N=0;N<f.length;N++){const L=f[N].command,j=f[N].points;switch(L){case"L":d.lineTo(j[0],j[1]);break;case"M":d.moveTo(j[0],j[1]);break;case"C":d.bezierCurveTo(j[0],j[1],j[2],j[3],j[4],j[5]);break;case"Q":d.quadraticCurveTo(j[0],j[1],j[2],j[3]);break;case"A":var m=j[0],y=j[1],x=j[2],R=j[3],w=j[4],_=j[5],b=j[6],E=j[7],z=x>R?x:R,F=x>R?1:x/R,k=x>R?R/x:1;d.translate(m,y),d.rotate(b),d.scale(F,k),d.arc(0,0,z,w,w+_,1-E),d.scale(1/F,1/k),d.rotate(-b),d.translate(-m,-y);break;case"z":g=!0,d.closePath();break}}!g&&!this.hasFill()?d.strokeShape(this):d.fillStrokeShape(this)}getSelfRect(){let d=[];this.dataArray.forEach(function(w){if(w.command==="A"){const _=w.points[4],b=w.points[5],E=w.points[4]+b;let z=Math.PI/180;if(Math.abs(_-E)<z&&(z=Math.abs(_-E)),b<0)for(let F=_-z;F>E;F-=z){const k=Xr.getPointOnEllipticalArc(w.points[0],w.points[1],w.points[2],w.points[3],F,0);d.push(k.x,k.y)}else for(let F=_+z;F<E;F+=z){const k=Xr.getPointOnEllipticalArc(w.points[0],w.points[1],w.points[2],w.points[3],F,0);d.push(k.x,k.y)}}else if(w.command==="C")for(let _=0;_<=1;_+=.01){const b=Xr.getPointOnCubicBezier(_,w.start.x,w.start.y,w.points[0],w.points[1],w.points[2],w.points[3],w.points[4],w.points[5]);d.push(b.x,b.y)}else d=d.concat(w.points)});let f=d[0],g=d[0],m=d[1],y=d[1],x,R;for(let w=0;w<d.length/2;w++)x=d[w*2],R=d[w*2+1],isNaN(x)||(f=Math.min(f,x),g=Math.max(g,x)),isNaN(R)||(m=Math.min(m,R),y=Math.max(y,R));return{x:f,y:m,width:g-f,height:y-m}}getLength(){return this.pathLength}getPointAtLength(d){return Xr.getPointAtLengthOfDataArray(d,this.dataArray)}static getLineLength(d,f,g,m){return Math.sqrt((g-d)*(g-d)+(m-f)*(m-f))}static getPathLength(d){let f=0;for(let g=0;g<d.length;++g)f+=d[g].pathLength;return f}static getPointAtLengthOfDataArray(d,f){let g,m=0,y=f.length;if(!y)return null;for(;m<y&&d>f[m].pathLength;)d-=f[m].pathLength,++m;if(m===y)return g=f[m-1].points.slice(-2),{x:g[0],y:g[1]};if(d<.01)return g=f[m].points.slice(0,2),{x:g[0],y:g[1]};const x=f[m],R=x.points;switch(x.command){case"L":return Xr.getPointOnLine(d,x.start.x,x.start.y,R[0],R[1]);case"C":return Xr.getPointOnCubicBezier((0,l.t2length)(d,Xr.getPathLength(f),N=>(0,l.getCubicArcLength)([x.start.x,R[0],R[2],R[4]],[x.start.y,R[1],R[3],R[5]],N)),x.start.x,x.start.y,R[0],R[1],R[2],R[3],R[4],R[5]);case"Q":return Xr.getPointOnQuadraticBezier((0,l.t2length)(d,Xr.getPathLength(f),N=>(0,l.getQuadraticArcLength)([x.start.x,R[0],R[2]],[x.start.y,R[1],R[3]],N)),x.start.x,x.start.y,R[0],R[1],R[2],R[3]);case"A":var w=R[0],_=R[1],b=R[2],E=R[3],z=R[4],F=R[5],k=R[6];return z+=F*d/x.pathLength,Xr.getPointOnEllipticalArc(w,_,b,E,z,k)}return null}static getPointOnLine(d,f,g,m,y,x,R){x=x??f,R=R??g;const w=this.getLineLength(f,g,m,y);if(w<1e-10)return{x:f,y:g};if(m===f)return{x,y:R+(y>g?d:-d)};const _=(y-g)/(m-f),b=Math.sqrt(d*d/(1+_*_))*(m<f?-1:1),E=_*b;if(Math.abs(R-g-_*(x-f))<1e-10)return{x:x+b,y:R+E};const z=((x-f)*(m-f)+(R-g)*(y-g))/(w*w),F=f+z*(m-f),k=g+z*(y-g),N=this.getLineLength(x,R,F,k),L=Math.sqrt(d*d-N*N),j=Math.sqrt(L*L/(1+_*_))*(m<f?-1:1),Y=_*j;return{x:F+j,y:k+Y}}static getPointOnCubicBezier(d,f,g,m,y,x,R,w,_){function b(L){return L*L*L}function E(L){return 3*L*L*(1-L)}function z(L){return 3*L*(1-L)*(1-L)}function F(L){return(1-L)*(1-L)*(1-L)}const k=w*b(d)+x*E(d)+m*z(d)+f*F(d),N=_*b(d)+R*E(d)+y*z(d)+g*F(d);return{x:k,y:N}}static getPointOnQuadraticBezier(d,f,g,m,y,x,R){function w(F){return F*F}function _(F){return 2*F*(1-F)}function b(F){return(1-F)*(1-F)}const E=x*w(d)+m*_(d)+f*b(d),z=R*w(d)+y*_(d)+g*b(d);return{x:E,y:z}}static getPointOnEllipticalArc(d,f,g,m,y,x){const R=Math.cos(x),w=Math.sin(x),_={x:g*Math.cos(y),y:m*Math.sin(y)};return{x:d+(_.x*R-_.y*w),y:f+(_.x*w+_.y*R)}}static parsePathData(d){if(!d)return[];let f=d;const g=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];f=f.replace(new RegExp(" ","g"),",");for(var m=0;m<g.length;m++)f=f.replace(new RegExp(g[m],"g"),"|"+g[m]);const y=f.split("|"),x=[],R=[];let w=0,_=0;const b=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let E;for(m=1;m<y.length;m++){let A=y[m],M=A.charAt(0);for(A=A.slice(1),R.length=0;E=b.exec(A);)R.push(E[0]);const T=[];for(let H=0,G=R.length;H<G;H++){if(R[H]==="00"){T.push(0,0);continue}const X=parseFloat(R[H]);isNaN(X)?T.push(0):T.push(X)}for(;T.length>0&&!isNaN(T[0]);){let H="",G=[];const X=w,oe=_;var z,F,k,N,L,j,Y,O,U,I;switch(M){case"l":w+=T.shift(),_+=T.shift(),H="L",G.push(w,_);break;case"L":w=T.shift(),_=T.shift(),G.push(w,_);break;case"m":var V=T.shift(),J=T.shift();if(w+=V,_+=J,H="M",x.length>2&&x[x.length-1].command==="z"){for(let te=x.length-2;te>=0;te--)if(x[te].command==="M"){w=x[te].points[0]+V,_=x[te].points[1]+J;break}}G.push(w,_),M="l";break;case"M":w=T.shift(),_=T.shift(),H="M",G.push(w,_),M="L";break;case"h":w+=T.shift(),H="L",G.push(w,_);break;case"H":w=T.shift(),H="L",G.push(w,_);break;case"v":_+=T.shift(),H="L",G.push(w,_);break;case"V":_=T.shift(),H="L",G.push(w,_);break;case"C":G.push(T.shift(),T.shift(),T.shift(),T.shift()),w=T.shift(),_=T.shift(),G.push(w,_);break;case"c":G.push(w+T.shift(),_+T.shift(),w+T.shift(),_+T.shift()),w+=T.shift(),_+=T.shift(),H="C",G.push(w,_);break;case"S":F=w,k=_,z=x[x.length-1],z.command==="C"&&(F=w+(w-z.points[2]),k=_+(_-z.points[3])),G.push(F,k,T.shift(),T.shift()),w=T.shift(),_=T.shift(),H="C",G.push(w,_);break;case"s":F=w,k=_,z=x[x.length-1],z.command==="C"&&(F=w+(w-z.points[2]),k=_+(_-z.points[3])),G.push(F,k,w+T.shift(),_+T.shift()),w+=T.shift(),_+=T.shift(),H="C",G.push(w,_);break;case"Q":G.push(T.shift(),T.shift()),w=T.shift(),_=T.shift(),G.push(w,_);break;case"q":G.push(w+T.shift(),_+T.shift()),w+=T.shift(),_+=T.shift(),H="Q",G.push(w,_);break;case"T":F=w,k=_,z=x[x.length-1],z.command==="Q"&&(F=w+(w-z.points[0]),k=_+(_-z.points[1])),w=T.shift(),_=T.shift(),H="Q",G.push(F,k,w,_);break;case"t":F=w,k=_,z=x[x.length-1],z.command==="Q"&&(F=w+(w-z.points[0]),k=_+(_-z.points[1])),w+=T.shift(),_+=T.shift(),H="Q",G.push(F,k,w,_);break;case"A":N=T.shift(),L=T.shift(),j=T.shift(),Y=T.shift(),O=T.shift(),U=w,I=_,w=T.shift(),_=T.shift(),H="A",G=this.convertEndpointToCenterParameterization(U,I,w,_,Y,O,N,L,j);break;case"a":N=T.shift(),L=T.shift(),j=T.shift(),Y=T.shift(),O=T.shift(),U=w,I=_,w+=T.shift(),_+=T.shift(),H="A",G=this.convertEndpointToCenterParameterization(U,I,w,_,Y,O,N,L,j);break}x.push({command:H||M,points:G,start:{x:X,y:oe},pathLength:this.calcLength(X,oe,H||M,G)})}(M==="z"||M==="Z")&&x.push({command:"z",points:[],start:void 0,pathLength:0})}return x}static calcLength(d,f,g,m){let y,x,R,w;const _=Xr;switch(g){case"L":return _.getLineLength(d,f,m[0],m[1]);case"C":return(0,l.getCubicArcLength)([d,m[0],m[2],m[4]],[f,m[1],m[3],m[5]],1);case"Q":return(0,l.getQuadraticArcLength)([d,m[0],m[2]],[f,m[1],m[3]],1);case"A":y=0;var b=m[4],E=m[5],z=m[4]+E,F=Math.PI/180;if(Math.abs(b-z)<F&&(F=Math.abs(b-z)),x=_.getPointOnEllipticalArc(m[0],m[1],m[2],m[3],b,0),E<0)for(w=b-F;w>z;w-=F)R=_.getPointOnEllipticalArc(m[0],m[1],m[2],m[3],w,0),y+=_.getLineLength(x.x,x.y,R.x,R.y),x=R;else for(w=b+F;w<z;w+=F)R=_.getPointOnEllipticalArc(m[0],m[1],m[2],m[3],w,0),y+=_.getLineLength(x.x,x.y,R.x,R.y),x=R;return R=_.getPointOnEllipticalArc(m[0],m[1],m[2],m[3],z,0),y+=_.getLineLength(x.x,x.y,R.x,R.y),y}return 0}static convertEndpointToCenterParameterization(d,f,g,m,y,x,R,w,_){const b=_*(Math.PI/180),E=Math.cos(b)*(d-g)/2+Math.sin(b)*(f-m)/2,z=-1*Math.sin(b)*(d-g)/2+Math.cos(b)*(f-m)/2,F=E*E/(R*R)+z*z/(w*w);F>1&&(R*=Math.sqrt(F),w*=Math.sqrt(F));let k=Math.sqrt((R*R*(w*w)-R*R*(z*z)-w*w*(E*E))/(R*R*(z*z)+w*w*(E*E)));y===x&&(k*=-1),isNaN(k)&&(k=0);const N=k*R*z/w,L=k*-w*E/R,j=(d+g)/2+Math.cos(b)*N-Math.sin(b)*L,Y=(f+m)/2+Math.sin(b)*N+Math.cos(b)*L,O=function(T){return Math.sqrt(T[0]*T[0]+T[1]*T[1])},U=function(T,H){return(T[0]*H[0]+T[1]*H[1])/(O(T)*O(H))},I=function(T,H){return(T[0]*H[1]<T[1]*H[0]?-1:1)*Math.acos(U(T,H))},V=I([1,0],[(E-N)/R,(z-L)/w]),J=[(E-N)/R,(z-L)/w],A=[(-1*E-N)/R,(-1*z-L)/w];let M=I(J,A);return U(J,A)<=-1&&(M=Math.PI),U(J,A)>=1&&(M=0),x===0&&M>0&&(M=M-2*Math.PI),x===1&&M<0&&(M=M+2*Math.PI),[j,Y,R,w,V,M,b,x]}};return Kc.Path=c,c.prototype.className="Path",c.prototype._attrsAffectingSize=["data"],(0,o._registerNode)(c),n.Factory.addGetterSetter(c,"data"),Kc}var w0;function U4(){if(w0)return Vc;w0=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.Arrow=void 0;const n=yt(),r=Pm(),o=wt(),l=pt(),c=_p();let u=class extends r.Line{_sceneFunc(f){super._sceneFunc(f);const g=Math.PI*2,m=this.points();let y=m;const x=this.tension()!==0&&m.length>4;x&&(y=this.getTensionPoints());const R=this.pointerLength(),w=m.length;let _,b;if(x){const F=[y[y.length-4],y[y.length-3],y[y.length-2],y[y.length-1],m[w-2],m[w-1]],k=c.Path.calcLength(y[y.length-4],y[y.length-3],"C",F),N=c.Path.getPointOnQuadraticBezier(Math.min(1,1-R/k),F[0],F[1],F[2],F[3],F[4],F[5]);_=m[w-2]-N.x,b=m[w-1]-N.y}else _=m[w-2]-m[w-4],b=m[w-1]-m[w-3];const E=(Math.atan2(b,_)+g)%g,z=this.pointerWidth();this.pointerAtEnding()&&(f.save(),f.beginPath(),f.translate(m[w-2],m[w-1]),f.rotate(E),f.moveTo(0,0),f.lineTo(-R,z/2),f.lineTo(-R,-z/2),f.closePath(),f.restore(),this.__fillStroke(f)),this.pointerAtBeginning()&&(f.save(),f.beginPath(),f.translate(m[0],m[1]),x?(_=(y[0]+y[2])/2-m[0],b=(y[1]+y[3])/2-m[1]):(_=m[2]-m[0],b=m[3]-m[1]),f.rotate((Math.atan2(-b,-_)+g)%g),f.moveTo(0,0),f.lineTo(-R,z/2),f.lineTo(-R,-z/2),f.closePath(),f.restore(),this.__fillStroke(f))}__fillStroke(f){const g=this.dashEnabled();g&&(this.attrs.dashEnabled=!1,f.setLineDash([])),f.fillStrokeShape(this),g&&(this.attrs.dashEnabled=!0)}getSelfRect(){const f=super.getSelfRect(),g=this.pointerWidth()/2;return{x:f.x-g,y:f.y-g,width:f.width+g*2,height:f.height+g*2}}};return Vc.Arrow=u,u.prototype.className="Arrow",(0,l._registerNode)(u),n.Factory.addGetterSetter(u,"pointerLength",10,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(u,"pointerWidth",10,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(u,"pointerAtBeginning",!1),n.Factory.addGetterSetter(u,"pointerAtEnding",!0),Vc}var qc={},S0;function B4(){if(S0)return qc;S0=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.Circle=void 0;const n=yt(),r=tr(),o=wt(),l=pt();let c=class extends r.Shape{_sceneFunc(d){d.beginPath(),d.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),d.closePath(),d.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(d){this.radius()!==d/2&&this.radius(d/2)}setHeight(d){this.radius()!==d/2&&this.radius(d/2)}};return qc.Circle=c,c.prototype._centroid=!0,c.prototype.className="Circle",c.prototype._attrsAffectingSize=["radius"],(0,l._registerNode)(c),n.Factory.addGetterSetter(c,"radius",0,(0,o.getNumberValidator)()),qc}var Yc={},k0;function G4(){if(k0)return Yc;k0=1,Object.defineProperty(Yc,"__esModule",{value:!0}),Yc.Ellipse=void 0;const n=yt(),r=tr(),o=wt(),l=pt();let c=class extends r.Shape{_sceneFunc(d){const f=this.radiusX(),g=this.radiusY();d.beginPath(),d.save(),f!==g&&d.scale(1,g/f),d.arc(0,0,f,0,Math.PI*2,!1),d.restore(),d.closePath(),d.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(d){this.radiusX(d/2)}setHeight(d){this.radiusY(d/2)}};return Yc.Ellipse=c,c.prototype.className="Ellipse",c.prototype._centroid=!0,c.prototype._attrsAffectingSize=["radiusX","radiusY"],(0,l._registerNode)(c),n.Factory.addComponentsGetterSetter(c,"radius",["x","y"]),n.Factory.addGetterSetter(c,"radiusX",0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(c,"radiusY",0,(0,o.getNumberValidator)()),Yc}var Xc={},_0;function H4(){if(_0)return Xc;_0=1,Object.defineProperty(Xc,"__esModule",{value:!0}),Xc.Image=void 0;const n=gn(),r=yt(),o=tr(),l=pt(),c=wt();class u extends o.Shape{constructor(f){super(f),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const f=this.image();f&&f.complete||f&&f.readyState===4||f&&f.addEventListener&&f.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){const f=!!this.cornerRadius(),g=this.hasShadow();return f&&g?!0:super._useBufferCanvas(!0)}_sceneFunc(f){const g=this.getWidth(),m=this.getHeight(),y=this.cornerRadius(),x=this.attrs.image;let R;if(x){const w=this.attrs.cropWidth,_=this.attrs.cropHeight;w&&_?R=[x,this.cropX(),this.cropY(),w,_,0,0,g,m]:R=[x,0,0,g,m]}(this.hasFill()||this.hasStroke()||y)&&(f.beginPath(),y?n.Util.drawRoundedRectPath(f,g,m,y):f.rect(0,0,g,m),f.closePath(),f.fillStrokeShape(this)),x&&(y&&f.clip(),f.drawImage.apply(f,R))}_hitFunc(f){const g=this.width(),m=this.height(),y=this.cornerRadius();f.beginPath(),y?n.Util.drawRoundedRectPath(f,g,m,y):f.rect(0,0,g,m),f.closePath(),f.fillStrokeShape(this)}getWidth(){var f,g;return(f=this.attrs.width)!==null&&f!==void 0?f:(g=this.image())===null||g===void 0?void 0:g.width}getHeight(){var f,g;return(f=this.attrs.height)!==null&&f!==void 0?f:(g=this.image())===null||g===void 0?void 0:g.height}static fromURL(f,g,m=null){const y=n.Util.createImageElement();y.onload=function(){const x=new u({image:y});g(x)},y.onerror=m,y.crossOrigin="Anonymous",y.src=f}}return Xc.Image=u,u.prototype.className="Image",(0,l._registerNode)(u),r.Factory.addGetterSetter(u,"cornerRadius",0,(0,c.getNumberOrArrayOfNumbersValidator)(4)),r.Factory.addGetterSetter(u,"image"),r.Factory.addComponentsGetterSetter(u,"crop",["x","y","width","height"]),r.Factory.addGetterSetter(u,"cropX",0,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(u,"cropY",0,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(u,"cropWidth",0,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(u,"cropHeight",0,(0,c.getNumberValidator)()),Xc}var wa={},C0;function V4(){if(C0)return wa;C0=1,Object.defineProperty(wa,"__esModule",{value:!0}),wa.Tag=wa.Label=void 0;const n=yt(),r=tr(),o=Sp(),l=wt(),c=pt(),u=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],d="Change.konva",f="none",g="up",m="right",y="down",x="left",R=u.length;let w=class extends o.Group{constructor(E){super(E),this.on("add.konva",function(z){this._addListeners(z.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(E){let z=this,F;const k=function(){z._sync()};for(F=0;F<R;F++)E.on(u[F]+d,k)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let E=this.getText(),z=this.getTag(),F,k,N,L,j,Y,O;if(E&&z){switch(F=E.width(),k=E.height(),N=z.pointerDirection(),L=z.pointerWidth(),O=z.pointerHeight(),j=0,Y=0,N){case g:j=F/2,Y=-1*O;break;case m:j=F+L,Y=k/2;break;case y:j=F/2,Y=k+O;break;case x:j=-1*L,Y=k/2;break}z.setAttrs({x:-1*j,y:-1*Y,width:F,height:k}),E.setAttrs({x:-1*j,y:-1*Y})}}};wa.Label=w,w.prototype.className="Label",(0,c._registerNode)(w);class _ extends r.Shape{_sceneFunc(E){const z=this.width(),F=this.height(),k=this.pointerDirection(),N=this.pointerWidth(),L=this.pointerHeight(),j=this.cornerRadius();let Y=0,O=0,U=0,I=0;typeof j=="number"?Y=O=U=I=Math.min(j,z/2,F/2):(Y=Math.min(j[0]||0,z/2,F/2),O=Math.min(j[1]||0,z/2,F/2),I=Math.min(j[2]||0,z/2,F/2),U=Math.min(j[3]||0,z/2,F/2)),E.beginPath(),E.moveTo(Y,0),k===g&&(E.lineTo((z-N)/2,0),E.lineTo(z/2,-1*L),E.lineTo((z+N)/2,0)),E.lineTo(z-O,0),E.arc(z-O,O,O,Math.PI*3/2,0,!1),k===m&&(E.lineTo(z,(F-L)/2),E.lineTo(z+N,F/2),E.lineTo(z,(F+L)/2)),E.lineTo(z,F-I),E.arc(z-I,F-I,I,0,Math.PI/2,!1),k===y&&(E.lineTo((z+N)/2,F),E.lineTo(z/2,F+L),E.lineTo((z-N)/2,F)),E.lineTo(U,F),E.arc(U,F-U,U,Math.PI/2,Math.PI,!1),k===x&&(E.lineTo(0,(F+L)/2),E.lineTo(-1*N,F/2),E.lineTo(0,(F-L)/2)),E.lineTo(0,Y),E.arc(Y,Y,Y,Math.PI,Math.PI*3/2,!1),E.closePath(),E.fillStrokeShape(this)}getSelfRect(){let E=0,z=0,F=this.pointerWidth(),k=this.pointerHeight(),N=this.pointerDirection(),L=this.width(),j=this.height();return N===g?(z-=k,j+=k):N===y?j+=k:N===x?(E-=F*1.5,L+=F):N===m&&(L+=F*1.5),{x:E,y:z,width:L,height:j}}}return wa.Tag=_,_.prototype.className="Tag",(0,c._registerNode)(_),n.Factory.addGetterSetter(_,"pointerDirection",f),n.Factory.addGetterSetter(_,"pointerWidth",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(_,"pointerHeight",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(_,"cornerRadius",0,(0,l.getNumberOrArrayOfNumbersValidator)(4)),wa}var Qc={},F0;function Am(){if(F0)return Qc;F0=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.Rect=void 0;const n=yt(),r=tr(),o=pt(),l=gn(),c=wt();class u extends r.Shape{_sceneFunc(f){const g=this.cornerRadius(),m=this.width(),y=this.height();f.beginPath(),g?l.Util.drawRoundedRectPath(f,m,y,g):f.rect(0,0,m,y),f.closePath(),f.fillStrokeShape(this)}}return Qc.Rect=u,u.prototype.className="Rect",(0,o._registerNode)(u),n.Factory.addGetterSetter(u,"cornerRadius",0,(0,c.getNumberOrArrayOfNumbersValidator)(4)),Qc}var $c={},R0;function W4(){if(R0)return $c;R0=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.RegularPolygon=void 0;const n=yt(),r=tr(),o=wt(),l=pt();let c=class extends r.Shape{_sceneFunc(d){const f=this._getPoints();d.beginPath(),d.moveTo(f[0].x,f[0].y);for(let g=1;g<f.length;g++)d.lineTo(f[g].x,f[g].y);d.closePath(),d.fillStrokeShape(this)}_getPoints(){const d=this.attrs.sides,f=this.attrs.radius||0,g=[];for(let m=0;m<d;m++)g.push({x:f*Math.sin(m*2*Math.PI/d),y:-1*f*Math.cos(m*2*Math.PI/d)});return g}getSelfRect(){const d=this._getPoints();let f=d[0].x,g=d[0].y,m=d[0].x,y=d[0].y;return d.forEach(x=>{f=Math.min(f,x.x),g=Math.max(g,x.x),m=Math.min(m,x.y),y=Math.max(y,x.y)}),{x:f,y:m,width:g-f,height:y-m}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(d){this.radius(d/2)}setHeight(d){this.radius(d/2)}};return $c.RegularPolygon=c,c.prototype.className="RegularPolygon",c.prototype._centroid=!0,c.prototype._attrsAffectingSize=["radius"],(0,l._registerNode)(c),n.Factory.addGetterSetter(c,"radius",0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(c,"sides",0,(0,o.getNumberValidator)()),$c}var Jc={},E0;function K4(){if(E0)return Jc;E0=1,Object.defineProperty(Jc,"__esModule",{value:!0}),Jc.Ring=void 0;const n=yt(),r=tr(),o=wt(),l=pt(),c=Math.PI*2;let u=class extends r.Shape{_sceneFunc(f){f.beginPath(),f.arc(0,0,this.innerRadius(),0,c,!1),f.moveTo(this.outerRadius(),0),f.arc(0,0,this.outerRadius(),c,0,!0),f.closePath(),f.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(f){this.outerRadius(f/2)}setHeight(f){this.outerRadius(f/2)}};return Jc.Ring=u,u.prototype.className="Ring",u.prototype._centroid=!0,u.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,l._registerNode)(u),n.Factory.addGetterSetter(u,"innerRadius",0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(u,"outerRadius",0,(0,o.getNumberValidator)()),Jc}var Zc={},b0;function q4(){if(b0)return Zc;b0=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.Sprite=void 0;const n=yt(),r=tr(),o=kp(),l=wt(),c=pt();let u=class extends r.Shape{constructor(f){super(f),this._updated=!0,this.anim=new o.Animation(()=>{const g=this._updated;return this._updated=!1,g}),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(f){const g=this.animation(),m=this.frameIndex(),y=m*4,x=this.animations()[g],R=this.frameOffsets(),w=x[y+0],_=x[y+1],b=x[y+2],E=x[y+3],z=this.image();if((this.hasFill()||this.hasStroke())&&(f.beginPath(),f.rect(0,0,b,E),f.closePath(),f.fillStrokeShape(this)),z)if(R){const F=R[g],k=m*2;f.drawImage(z,w,_,b,E,F[k+0],F[k+1],b,E)}else f.drawImage(z,w,_,b,E,0,0,b,E)}_hitFunc(f){const g=this.animation(),m=this.frameIndex(),y=m*4,x=this.animations()[g],R=this.frameOffsets(),w=x[y+2],_=x[y+3];if(f.beginPath(),R){const b=R[g],E=m*2;f.rect(b[E+0],b[E+1],w,_)}else f.rect(0,0,w,_);f.closePath(),f.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const f=this;this.interval=setInterval(function(){f._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const f=this.getLayer();this.anim.setLayers(f),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const f=this.frameIndex(),g=this.animation(),m=this.animations(),y=m[g],x=y.length/4;f<x-1?this.frameIndex(f+1):this.frameIndex(0)}};return Zc.Sprite=u,u.prototype.className="Sprite",(0,c._registerNode)(u),n.Factory.addGetterSetter(u,"animation"),n.Factory.addGetterSetter(u,"animations"),n.Factory.addGetterSetter(u,"frameOffsets"),n.Factory.addGetterSetter(u,"image"),n.Factory.addGetterSetter(u,"frameIndex",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"frameRate",17,(0,l.getNumberValidator)()),n.Factory.backCompat(u,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"}),Zc}var eu={},P0;function Y4(){if(P0)return eu;P0=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.Star=void 0;const n=yt(),r=tr(),o=wt(),l=pt();let c=class extends r.Shape{_sceneFunc(d){const f=this.innerRadius(),g=this.outerRadius(),m=this.numPoints();d.beginPath(),d.moveTo(0,0-g);for(let y=1;y<m*2;y++){const x=y%2===0?g:f,R=x*Math.sin(y*Math.PI/m),w=-1*x*Math.cos(y*Math.PI/m);d.lineTo(R,w)}d.closePath(),d.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(d){this.outerRadius(d/2)}setHeight(d){this.outerRadius(d/2)}};return eu.Star=c,c.prototype.className="Star",c.prototype._centroid=!0,c.prototype._attrsAffectingSize=["innerRadius","outerRadius"],(0,l._registerNode)(c),n.Factory.addGetterSetter(c,"numPoints",5,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(c,"innerRadius",0,(0,o.getNumberValidator)()),n.Factory.addGetterSetter(c,"outerRadius",0,(0,o.getNumberValidator)()),eu}var _l={},A0;function Nm(){if(A0)return _l;A0=1,Object.defineProperty(_l,"__esModule",{value:!0}),_l.Text=void 0,_l.stringToArray=d;const n=gn(),r=yt(),o=tr(),l=pt(),c=wt(),u=pt();function d(ne){return[...ne].reduce((se,$,ue,pe)=>(new RegExp("\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?(?:\\u200D\\p{Emoji_Presentation})+","u").test($)?se.push($):new RegExp("\\p{Regional_Indicator}{2}","u").test($+(pe[ue+1]||""))?se.push($+pe[ue+1]):ue>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test($)?se[se.length-1]+=$:se.push($),se),[])}const f="auto",g="center",m="inherit",y="justify",x="Change.konva",R="2d",w="-",_="left",b="text",E="Text",z="top",F="bottom",k="middle",N="normal",L="px ",j=" ",Y="right",O="rtl",U="word",I="char",V="none",J="…",A=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],M=A.length;function T(ne){return ne.split(",").map(se=>{se=se.trim();const $=se.indexOf(" ")>=0,ue=se.indexOf('"')>=0||se.indexOf("'")>=0;return $&&!ue&&(se=`"${se}"`),se}).join(", ")}let H;function G(){return H||(H=n.Util.createCanvasElement().getContext(R),H)}function X(ne){ne.fillText(this._partialText,this._partialTextX,this._partialTextY)}function oe(ne){ne.setAttr("miterLimit",2),ne.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function te(ne){return ne=ne||{},!ne.fillLinearGradientColorStops&&!ne.fillRadialGradientColorStops&&!ne.fillPatternImage&&(ne.fill=ne.fill||"black"),ne}let K=class extends o.Shape{constructor(se){super(te(se)),this._partialTextX=0,this._partialTextY=0;for(let $=0;$<M;$++)this.on(A[$]+x,this._setTextData);this._setTextData()}_sceneFunc(se){const $=this.textArr,ue=$.length;if(!this.text())return;let pe=this.padding(),Q=this.fontSize(),re=this.lineHeight()*Q,de=this.verticalAlign(),xe=this.direction(),Re=0,be=this.align(),Ye=this.getWidth(),at=this.letterSpacing(),Xe=this.fill(),Pt=this.textDecoration(),ht=Pt.indexOf("underline")!==-1,Pe=Pt.indexOf("line-through")!==-1,De;xe=xe===m?se.direction:xe;let Te=re/2,qe=k;if(l.Konva._fixTextRendering){const lt=this.measureSize("M");qe="alphabetic",Te=(lt.fontBoundingBoxAscent-lt.fontBoundingBoxDescent)/2+re/2}var He=0,Ve=0;for(xe===O&&se.setAttr("direction",xe),se.setAttr("font",this._getContextFont()),se.setAttr("textBaseline",qe),se.setAttr("textAlign",_),de===k?Re=(this.getHeight()-ue*re-pe*2)/2:de===F&&(Re=this.getHeight()-ue*re-pe*2),se.translate(pe,Re+pe),De=0;De<ue;De++){var He=0,Ve=0,Ze=$[De],tt=Ze.text,ke=Ze.width,Qe=Ze.lastInParagraph,rt,St,ut;if(se.save(),be===Y?He+=Ye-ke-pe*2:be===g&&(He+=(Ye-ke-pe*2)/2),ht){se.save(),se.beginPath();const We=l.Konva._fixTextRendering?Math.round(Q/4):Math.round(Q/2),Ct=He,et=Te+Ve+We;se.moveTo(Ct,et),rt=tt.split(" ").length-1,St=rt===0,ut=be===y&&!Qe?Ye-pe*2:ke,se.lineTo(Ct+Math.round(ut),et),se.lineWidth=Q/15;const En=this._getLinearGradient();se.strokeStyle=En||Xe,se.stroke(),se.restore()}if(Pe){se.save(),se.beginPath();const We=l.Konva._fixTextRendering?-Math.round(Q/4):0;se.moveTo(He,Te+Ve+We),rt=tt.split(" ").length-1,St=rt===0,ut=be===y&&Qe&&!St?Ye-pe*2:ke,se.lineTo(He+Math.round(ut),Te+Ve+We),se.lineWidth=Q/15;const Ct=this._getLinearGradient();se.strokeStyle=Ct||Xe,se.stroke(),se.restore()}if(xe!==O&&(at!==0||be===y)){rt=tt.split(" ").length-1;const We=d(tt);for(let Ct=0;Ct<We.length;Ct++){const et=We[Ct];et===" "&&!Qe&&be===y&&(He+=(Ye-pe*2-ke)/rt),this._partialTextX=He,this._partialTextY=Te+Ve,this._partialText=et,se.fillStrokeShape(this),He+=this.measureSize(et).width+at}}else at!==0&&se.setAttr("letterSpacing",`${at}px`),this._partialTextX=He,this._partialTextY=Te+Ve,this._partialText=tt,se.fillStrokeShape(this);se.restore(),ue>1&&(Te+=re)}}_hitFunc(se){const $=this.getWidth(),ue=this.getHeight();se.beginPath(),se.rect(0,0,$,ue),se.closePath(),se.fillStrokeShape(this)}setText(se){const $=n.Util._isString(se)?se:se==null?"":se+"";return this._setAttr(b,$),this}getWidth(){return this.attrs.width===f||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===f||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return n.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(se){var $,ue,pe,Q,re,de,xe,Re,be,Ye,at;let Xe=G(),Pt=this.fontSize(),ht;Xe.save(),Xe.font=this._getContextFont(),ht=Xe.measureText(se),Xe.restore();const Pe=Pt/100;return{actualBoundingBoxAscent:($=ht.actualBoundingBoxAscent)!==null&&$!==void 0?$:71.58203125*Pe,actualBoundingBoxDescent:(ue=ht.actualBoundingBoxDescent)!==null&&ue!==void 0?ue:0,actualBoundingBoxLeft:(pe=ht.actualBoundingBoxLeft)!==null&&pe!==void 0?pe:-7.421875*Pe,actualBoundingBoxRight:(Q=ht.actualBoundingBoxRight)!==null&&Q!==void 0?Q:75.732421875*Pe,alphabeticBaseline:(re=ht.alphabeticBaseline)!==null&&re!==void 0?re:0,emHeightAscent:(de=ht.emHeightAscent)!==null&&de!==void 0?de:100*Pe,emHeightDescent:(xe=ht.emHeightDescent)!==null&&xe!==void 0?xe:-20*Pe,fontBoundingBoxAscent:(Re=ht.fontBoundingBoxAscent)!==null&&Re!==void 0?Re:91*Pe,fontBoundingBoxDescent:(be=ht.fontBoundingBoxDescent)!==null&&be!==void 0?be:21*Pe,hangingBaseline:(Ye=ht.hangingBaseline)!==null&&Ye!==void 0?Ye:72.80000305175781*Pe,ideographicBaseline:(at=ht.ideographicBaseline)!==null&&at!==void 0?at:-21*Pe,width:ht.width,height:Pt}}_getContextFont(){return this.fontStyle()+j+this.fontVariant()+j+(this.fontSize()+L)+T(this.fontFamily())}_addTextLine(se){this.align()===y&&(se=se.trim());const ue=this._getTextWidth(se);return this.textArr.push({text:se,width:ue,lastInParagraph:!1})}_getTextWidth(se){const $=this.letterSpacing(),ue=se.length;return G().measureText(se).width+(ue?$*(ue-1):0)}_setTextData(){let se=this.text().split(`
|
|
160
160
|
`),$=+this.fontSize(),ue=0,pe=this.lineHeight()*$,Q=this.attrs.width,re=this.attrs.height,de=Q!==f&&Q!==void 0,xe=re!==f&&re!==void 0,Re=this.padding(),be=Q-Re*2,Ye=re-Re*2,at=0,Xe=this.wrap(),Pt=Xe!==V,ht=Xe!==I&&Pt,Pe=this.ellipsis();this.textArr=[],G().font=this._getContextFont();const De=Pe?this._getTextWidth(J):0;for(let qe=0,He=se.length;qe<He;++qe){let Ve=se[qe],Ze=this._getTextWidth(Ve);if(de&&Ze>be)for(;Ve.length>0;){let tt=0,ke=Ve.length,Qe="",rt=0;for(;tt<ke;){const St=tt+ke>>>1,ut=Ve.slice(0,St+1),lt=this._getTextWidth(ut)+De;lt<=be?(tt=St+1,Qe=ut,rt=lt):ke=St}if(Qe){if(ht){var Te;const ut=Ve[Qe.length];(ut===j||ut===w)&&rt<=be?Te=Qe.length:Te=Math.max(Qe.lastIndexOf(j),Qe.lastIndexOf(w))+1,Te>0&&(tt=Te,Qe=Qe.slice(0,tt),rt=this._getTextWidth(Qe))}if(Qe=Qe.trimRight(),this._addTextLine(Qe),ue=Math.max(ue,rt),at+=pe,this._shouldHandleEllipsis(at)){this._tryToAddEllipsisToLastLine();break}if(Ve=Ve.slice(tt),Ve=Ve.trimLeft(),Ve.length>0&&(Ze=this._getTextWidth(Ve),Ze<=be)){this._addTextLine(Ve),at+=pe,ue=Math.max(ue,Ze);break}}else break}else this._addTextLine(Ve),at+=pe,ue=Math.max(ue,Ze),this._shouldHandleEllipsis(at)&&qe<He-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),xe&&at+pe>Ye)break}this.textHeight=$,this.textWidth=ue}_shouldHandleEllipsis(se){const $=+this.fontSize(),ue=this.lineHeight()*$,pe=this.attrs.height,Q=pe!==f&&pe!==void 0,re=this.padding(),de=pe-re*2;return!(this.wrap()!==V)||Q&&se+ue>de}_tryToAddEllipsisToLastLine(){const se=this.attrs.width,$=se!==f&&se!==void 0,ue=this.padding(),pe=se-ue*2,Q=this.ellipsis(),re=this.textArr[this.textArr.length-1];!re||!Q||($&&(this._getTextWidth(re.text+J)<pe||(re.text=re.text.slice(0,re.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(re.text+J))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const se=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,$=this.hasShadow();return se&&$?!0:super._useBufferCanvas()}};return _l.Text=K,K.prototype._fillFunc=X,K.prototype._strokeFunc=oe,K.prototype.className=E,K.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],(0,u._registerNode)(K),r.Factory.overWriteSetter(K,"width",(0,c.getNumberOrAutoValidator)()),r.Factory.overWriteSetter(K,"height",(0,c.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(K,"direction",m),r.Factory.addGetterSetter(K,"fontFamily","Arial"),r.Factory.addGetterSetter(K,"fontSize",12,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(K,"fontStyle",N),r.Factory.addGetterSetter(K,"fontVariant",N),r.Factory.addGetterSetter(K,"padding",0,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(K,"align",_),r.Factory.addGetterSetter(K,"verticalAlign",z),r.Factory.addGetterSetter(K,"lineHeight",1,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(K,"wrap",U),r.Factory.addGetterSetter(K,"ellipsis",!1,(0,c.getBooleanValidator)()),r.Factory.addGetterSetter(K,"letterSpacing",0,(0,c.getNumberValidator)()),r.Factory.addGetterSetter(K,"text","",(0,c.getStringValidator)()),r.Factory.addGetterSetter(K,"textDecoration",""),_l}var tu={},N0;function X4(){if(N0)return tu;N0=1,Object.defineProperty(tu,"__esModule",{value:!0}),tu.TextPath=void 0;const n=gn(),r=yt(),o=tr(),l=_p(),c=Nm(),u=wt(),d=pt(),f="",g="normal";function m(R){R.fillText(this.partialText,0,0)}function y(R){R.strokeText(this.partialText,0,0)}let x=class extends o.Shape{constructor(w){super(w),this.dummyCanvas=n.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return l.Path.getPathLength(this.dataArray)}_getPointAtLength(w){if(!this.attrs.data)return null;const _=this.pathLength;return w-1>_?null:l.Path.getPointAtLengthOfDataArray(w,this.dataArray)}_readDataAttribute(){this.dataArray=l.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(w){w.setAttr("font",this._getContextFont()),w.setAttr("textBaseline",this.textBaseline()),w.setAttr("textAlign","left"),w.save();const _=this.textDecoration(),b=this.fill(),E=this.fontSize(),z=this.glyphInfo;_==="underline"&&w.beginPath();for(let F=0;F<z.length;F++){w.save();const k=z[F].p0;w.translate(k.x,k.y),w.rotate(z[F].rotation),this.partialText=z[F].text,w.fillStrokeShape(this),_==="underline"&&(F===0&&w.moveTo(0,E/2+1),w.lineTo(E,E/2+1)),w.restore()}_==="underline"&&(w.strokeStyle=b,w.lineWidth=E/20,w.stroke()),w.restore()}_hitFunc(w){w.beginPath();const _=this.glyphInfo;if(_.length>=1){const b=_[0].p0;w.moveTo(b.x,b.y)}for(let b=0;b<_.length;b++){const E=_[b].p1;w.lineTo(E.x,E.y)}w.setAttr("lineWidth",this.fontSize()),w.setAttr("strokeStyle",this.colorKey),w.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return n.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(w){return c.Text.prototype.setText.call(this,w)}_getContextFont(){return c.Text.prototype._getContextFont.call(this)}_getTextSize(w){const b=this.dummyCanvas.getContext("2d");b.save(),b.font=this._getContextFont();const E=b.measureText(w);return b.restore(),{width:E.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:w,height:_}=this._getTextSize(this.attrs.text);if(this.textWidth=w,this.textHeight=_,this.glyphInfo=[],!this.attrs.data)return null;const b=this.letterSpacing(),E=this.align(),z=this.kerningFunc(),F=Math.max(this.textWidth+((this.attrs.text||"").length-1)*b,0);let k=0;E==="center"&&(k=Math.max(0,this.pathLength/2-F/2)),E==="right"&&(k=Math.max(0,this.pathLength-F));const N=(0,c.stringToArray)(this.text());let L=k;for(let j=0;j<N.length;j++){const Y=this._getPointAtLength(L);if(!Y)return;let O=this._getTextSize(N[j]).width+b;if(N[j]===" "&&E==="justify"){const M=this.text().split(" ").length-1;O+=(this.pathLength-F)/M}const U=this._getPointAtLength(L+O);if(!U)return;const I=l.Path.getLineLength(Y.x,Y.y,U.x,U.y);let V=0;if(z)try{V=z(N[j-1],N[j])*this.fontSize()}catch{V=0}Y.x+=V,U.x+=V,this.textWidth+=V;const J=l.Path.getPointOnLine(V+I/2,Y.x,Y.y,U.x,U.y),A=Math.atan2(U.y-Y.y,U.x-Y.x);this.glyphInfo.push({transposeX:J.x,transposeY:J.y,text:N[j],rotation:A,p0:Y,p1:U}),L+=O}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const w=[];this.glyphInfo.forEach(function(L){w.push(L.p0.x),w.push(L.p0.y),w.push(L.p1.x),w.push(L.p1.y)});let _=w[0]||0,b=w[0]||0,E=w[1]||0,z=w[1]||0,F,k;for(let L=0;L<w.length/2;L++)F=w[L*2],k=w[L*2+1],_=Math.min(_,F),b=Math.max(b,F),E=Math.min(E,k),z=Math.max(z,k);const N=this.fontSize();return{x:_-N/2,y:E-N/2,width:b-_+N,height:z-E+N}}destroy(){return n.Util.releaseCanvas(this.dummyCanvas),super.destroy()}};return tu.TextPath=x,x.prototype._fillFunc=m,x.prototype._strokeFunc=y,x.prototype._fillFuncHit=m,x.prototype._strokeFuncHit=y,x.prototype.className="TextPath",x.prototype._attrsAffectingSize=["text","fontSize","data"],(0,d._registerNode)(x),r.Factory.addGetterSetter(x,"data"),r.Factory.addGetterSetter(x,"fontFamily","Arial"),r.Factory.addGetterSetter(x,"fontSize",12,(0,u.getNumberValidator)()),r.Factory.addGetterSetter(x,"fontStyle",g),r.Factory.addGetterSetter(x,"align","left"),r.Factory.addGetterSetter(x,"letterSpacing",0,(0,u.getNumberValidator)()),r.Factory.addGetterSetter(x,"textBaseline","middle"),r.Factory.addGetterSetter(x,"fontVariant",g),r.Factory.addGetterSetter(x,"text",f),r.Factory.addGetterSetter(x,"textDecoration",null),r.Factory.addGetterSetter(x,"kerningFunc",null),tu}var nu={},D0;function Q4(){if(D0)return nu;D0=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Transformer=void 0;const n=gn(),r=yt(),o=Rn(),l=tr(),c=Am(),u=Sp(),d=pt(),f=wt(),g=pt(),m="tr-konva",y=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(O=>O+`.${m}`).join(" "),x="nodesRect",R=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],w={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},_="ontouchstart"in d.Konva._global;function b(O,U,I){if(O==="rotater")return I;U+=n.Util.degToRad(w[O]||0);const V=(n.Util.radToDeg(U)%360+360)%360;return n.Util._inRange(V,315+22.5,360)||n.Util._inRange(V,0,22.5)?"ns-resize":n.Util._inRange(V,45-22.5,45+22.5)?"nesw-resize":n.Util._inRange(V,90-22.5,90+22.5)?"ew-resize":n.Util._inRange(V,135-22.5,135+22.5)?"nwse-resize":n.Util._inRange(V,180-22.5,180+22.5)?"ns-resize":n.Util._inRange(V,225-22.5,225+22.5)?"nesw-resize":n.Util._inRange(V,270-22.5,270+22.5)?"ew-resize":n.Util._inRange(V,315-22.5,315+22.5)?"nwse-resize":(n.Util.error("Transformer has unknown angle for cursor detection: "+V),"pointer")}const E=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function z(O){return{x:O.x+O.width/2*Math.cos(O.rotation)+O.height/2*Math.sin(-O.rotation),y:O.y+O.height/2*Math.cos(O.rotation)+O.width/2*Math.sin(O.rotation)}}function F(O,U,I){const V=I.x+(O.x-I.x)*Math.cos(U)-(O.y-I.y)*Math.sin(U),J=I.y+(O.x-I.x)*Math.sin(U)+(O.y-I.y)*Math.cos(U);return{...O,rotation:O.rotation+U,x:V,y:J}}function k(O,U){const I=z(O);return F(O,U,I)}function N(O,U,I){let V=U;for(let J=0;J<O.length;J++){const A=d.Konva.getAngle(O[J]),M=Math.abs(A-U)%(Math.PI*2);Math.min(M,Math.PI*2-M)<I&&(V=A)}return V}let L=0;class j extends u.Group{constructor(U){super(U),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(y,this.update),this.getNode()&&this.update()}attachTo(U){return this.setNode(U),this}setNode(U){return n.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([U])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return m+this._id}setNodes(U=[]){this._nodes&&this._nodes.length&&this.detach();const I=U.filter(J=>J.isAncestorOf(this)?(n.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=U=I,U.length===1&&this.useSingleNodeRotation()?this.rotation(U[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(J=>{const A=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},M=J._attrsAffectingSize.map(T=>T+"Change."+this._getEventNamespace()).join(" ");J.on(M,A),J.on(R.map(T=>T+`.${this._getEventNamespace()}`).join(" "),A),J.on(`absoluteTransformChange.${this._getEventNamespace()}`,A),this._proxyDrag(J)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(U){let I;U.on(`dragstart.${this._getEventNamespace()}`,V=>{I=U.getAbsolutePosition(),!this.isDragging()&&U!==this.findOne(".back")&&this.startDrag(V,!1)}),U.on(`dragmove.${this._getEventNamespace()}`,V=>{if(!I)return;const J=U.getAbsolutePosition(),A=J.x-I.x,M=J.y-I.y;this.nodes().forEach(T=>{if(T===U||T.isDragging())return;const H=T.getAbsolutePosition();T.setAbsolutePosition({x:H.x+A,y:H.y+M}),T.startDrag(V)}),I=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(U=>{U.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(x),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(x,this.__getNodeRect)}__getNodeShape(U,I=this.rotation(),V){const J=U.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),A=U.getAbsoluteScale(V),M=U.getAbsolutePosition(V),T=J.x*A.x-U.offsetX()*A.x,H=J.y*A.y-U.offsetY()*A.y,G=(d.Konva.getAngle(U.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),X={x:M.x+T*Math.cos(G)+H*Math.sin(-G),y:M.y+H*Math.cos(G)+T*Math.sin(G),width:J.width*A.x,height:J.height*A.y,rotation:G};return F(X,-d.Konva.getAngle(I),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const I=[];this.nodes().map(G=>{const X=G.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),oe=[{x:X.x,y:X.y},{x:X.x+X.width,y:X.y},{x:X.x+X.width,y:X.y+X.height},{x:X.x,y:X.y+X.height}],te=G.getAbsoluteTransform();oe.forEach(function(K){const ne=te.point(K);I.push(ne)})});const V=new n.Transform;V.rotate(-d.Konva.getAngle(this.rotation()));let J=1/0,A=1/0,M=-1/0,T=-1/0;I.forEach(function(G){const X=V.point(G);J===void 0&&(J=M=X.x,A=T=X.y),J=Math.min(J,X.x),A=Math.min(A,X.y),M=Math.max(M,X.x),T=Math.max(T,X.y)}),V.invert();const H=V.point({x:J,y:A});return{x:H.x,y:H.y,width:M-J,height:T-A,rotation:d.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(),E.forEach(U=>{this._createAnchor(U)}),this._createAnchor("rotater")}_createAnchor(U){const I=new c.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:U+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:_?10:"auto"}),V=this;I.on("mousedown touchstart",function(J){V._handleMouseDown(J)}),I.on("dragstart",J=>{I.stopDrag(),J.cancelBubble=!0}),I.on("dragend",J=>{J.cancelBubble=!0}),I.on("mouseenter",()=>{const J=d.Konva.getAngle(this.rotation()),A=this.rotateAnchorCursor(),M=b(U,J,A);I.getStage().content&&(I.getStage().content.style.cursor=M),this._cursorChange=!0}),I.on("mouseout",()=>{I.getStage().content&&(I.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(I)}_createBack(){const U=new l.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(I,V){const J=V.getParent(),A=J.padding();I.beginPath(),I.rect(-A,-A,V.width()+A*2,V.height()+A*2),I.moveTo(V.width()/2,-A),J.rotateEnabled()&&J.rotateLineVisible()&&I.lineTo(V.width()/2,-J.rotateAnchorOffset()*n.Util._sign(V.height())-A),I.fillStrokeShape(V)},hitFunc:(I,V)=>{if(!this.shouldOverdrawWholeArea())return;const J=this.padding();I.beginPath(),I.rect(-J,-J,V.width()+J*2,V.height()+J*2),I.fillStrokeShape(V)}});this.add(U),this._proxyDrag(U),U.on("dragstart",I=>{I.cancelBubble=!0}),U.on("dragmove",I=>{I.cancelBubble=!0}),U.on("dragend",I=>{I.cancelBubble=!0}),this.on("dragmove",I=>{this.update()})}_handleMouseDown(U){if(this._transforming)return;this._movingAnchorName=U.target.name().split(" ")[0];const I=this._getNodeRect(),V=I.width,J=I.height,A=Math.sqrt(Math.pow(V,2)+Math.pow(J,2));this.sin=Math.abs(J/A),this.cos=Math.abs(V/A),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 M=U.target.getAbsolutePosition(),T=U.target.getStage().getPointerPosition();this._anchorDragOffset={x:T.x-M.x,y:T.y-M.y},L++,this._fire("transformstart",{evt:U.evt,target:this.getNode()}),this._nodes.forEach(H=>{H._fire("transformstart",{evt:U.evt,target:H})})}_handleMouseMove(U){let I,V,J;const A=this.findOne("."+this._movingAnchorName),M=A.getStage();M.setPointersPositions(U);const T=M.getPointerPosition();let H={x:T.x-this._anchorDragOffset.x,y:T.y-this._anchorDragOffset.y};const G=A.getAbsolutePosition();this.anchorDragBoundFunc()&&(H=this.anchorDragBoundFunc()(G,H,U)),A.setAbsolutePosition(H);const X=A.getAbsolutePosition();if(G.x===X.x&&G.y===X.y)return;if(this._movingAnchorName==="rotater"){const de=this._getNodeRect();I=A.x()-de.width/2,V=-A.y()+de.height/2;let xe=Math.atan2(-V,I)+Math.PI/2;de.height<0&&(xe-=Math.PI);const be=d.Konva.getAngle(this.rotation())+xe,Ye=d.Konva.getAngle(this.rotationSnapTolerance()),Xe=N(this.rotationSnaps(),be,Ye)-de.rotation,Pt=k(de,Xe);this._fitNodesInto(Pt,U);return}const oe=this.shiftBehavior();let te;oe==="inverted"?te=this.keepRatio()&&!U.shiftKey:oe==="none"?te=this.keepRatio():te=this.keepRatio()||U.shiftKey;var ue=this.centeredScaling()||U.altKey;if(this._movingAnchorName==="top-left"){if(te){var K=ue?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};J=Math.sqrt(Math.pow(K.x-A.x(),2)+Math.pow(K.y-A.y(),2));var ne=this.findOne(".top-left").x()>K.x?-1:1,se=this.findOne(".top-left").y()>K.y?-1:1;I=J*this.cos*ne,V=J*this.sin*se,this.findOne(".top-left").x(K.x-I),this.findOne(".top-left").y(K.y-V)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(A.y());else if(this._movingAnchorName==="top-right"){if(te){var K=ue?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};J=Math.sqrt(Math.pow(A.x()-K.x,2)+Math.pow(K.y-A.y(),2));var ne=this.findOne(".top-right").x()<K.x?-1:1,se=this.findOne(".top-right").y()>K.y?-1:1;I=J*this.cos*ne,V=J*this.sin*se,this.findOne(".top-right").x(K.x+I),this.findOne(".top-right").y(K.y-V)}var $=A.position();this.findOne(".top-left").y($.y),this.findOne(".bottom-right").x($.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(A.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(A.x());else if(this._movingAnchorName==="bottom-left"){if(te){var K=ue?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};J=Math.sqrt(Math.pow(K.x-A.x(),2)+Math.pow(A.y()-K.y,2));var ne=K.x<A.x()?-1:1,se=A.y()<K.y?-1:1;I=J*this.cos*ne,V=J*this.sin*se,A.x(K.x-I),A.y(K.y+V)}$=A.position(),this.findOne(".top-left").x($.x),this.findOne(".bottom-right").y($.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(A.y());else if(this._movingAnchorName==="bottom-right"){if(te){var K=ue?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};J=Math.sqrt(Math.pow(A.x()-K.x,2)+Math.pow(A.y()-K.y,2));var ne=this.findOne(".bottom-right").x()<K.x?-1:1,se=this.findOne(".bottom-right").y()<K.y?-1:1;I=J*this.cos*ne,V=J*this.sin*se,this.findOne(".bottom-right").x(K.x+I),this.findOne(".bottom-right").y(K.y+V)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));var ue=this.centeredScaling()||U.altKey;if(ue){const de=this.findOne(".top-left"),xe=this.findOne(".bottom-right"),Re=de.x(),be=de.y(),Ye=this.getWidth()-xe.x(),at=this.getHeight()-xe.y();xe.move({x:-Re,y:-be}),de.move({x:Ye,y:at})}const pe=this.findOne(".top-left").getAbsolutePosition();I=pe.x,V=pe.y;const Q=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),re=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:I,y:V,width:Q,height:re,rotation:d.Konva.getAngle(this.rotation())},U)}_handleMouseUp(U){this._removeEvents(U)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(U){var I;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const V=this.getNode();L--,this._fire("transformend",{evt:U,target:V}),(I=this.getLayer())===null||I===void 0||I.batchDraw(),V&&this._nodes.forEach(J=>{var A;J._fire("transformend",{evt:U,target:J}),(A=J.getLayer())===null||A===void 0||A.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(U,I){const V=this._getNodeRect(),J=1;if(n.Util._inRange(U.width,-this.padding()*2-J,J)){this.update();return}if(n.Util._inRange(U.height,-this.padding()*2-J,J)){this.update();return}const A=new n.Transform;if(A.rotate(d.Konva.getAngle(this.rotation())),this._movingAnchorName&&U.width<0&&this._movingAnchorName.indexOf("left")>=0){const te=A.point({x:-this.padding()*2,y:0});U.x+=te.x,U.y+=te.y,U.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=te.x,this._anchorDragOffset.y-=te.y}else if(this._movingAnchorName&&U.width<0&&this._movingAnchorName.indexOf("right")>=0){const te=A.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=te.x,this._anchorDragOffset.y-=te.y,U.width+=this.padding()*2}if(this._movingAnchorName&&U.height<0&&this._movingAnchorName.indexOf("top")>=0){const te=A.point({x:0,y:-this.padding()*2});U.x+=te.x,U.y+=te.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=te.x,this._anchorDragOffset.y-=te.y,U.height+=this.padding()*2}else if(this._movingAnchorName&&U.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const te=A.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=te.x,this._anchorDragOffset.y-=te.y,U.height+=this.padding()*2}if(this.boundBoxFunc()){const te=this.boundBoxFunc()(V,U);te?U=te:n.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const M=1e7,T=new n.Transform;T.translate(V.x,V.y),T.rotate(V.rotation),T.scale(V.width/M,V.height/M);const H=new n.Transform,G=U.width/M,X=U.height/M;this.flipEnabled()===!1?(H.translate(U.x,U.y),H.rotate(U.rotation),H.translate(U.width<0?U.width:0,U.height<0?U.height:0),H.scale(Math.abs(G),Math.abs(X))):(H.translate(U.x,U.y),H.rotate(U.rotation),H.scale(G,X));const oe=H.multiply(T.invert());this._nodes.forEach(te=>{var K;const ne=te.getParent().getAbsoluteTransform(),se=te.getTransform().copy();se.translate(te.offsetX(),te.offsetY());const $=new n.Transform;$.multiply(ne.copy().invert()).multiply(oe).multiply(ne).multiply(se);const ue=$.decompose();te.setAttrs(ue),(K=te.getLayer())===null||K===void 0||K.batchDraw()}),this.rotation(n.Util._getRotation(U.rotation)),this._nodes.forEach(te=>{this._fire("transform",{evt:I,target:te}),te._fire("transform",{evt:I,target:te})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(U,I){this.findOne(U).setAttrs(I)}update(){var U;const I=this._getNodeRect();this.rotation(n.Util._getRotation(I.rotation));const V=I.width,J=I.height,A=this.enabledAnchors(),M=this.resizeEnabled(),T=this.padding(),H=this.anchorSize(),G=this.find("._anchor");G.forEach(oe=>{oe.setAttrs({width:H,height:H,offsetX:H/2,offsetY:H/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:H/2+T,offsetY:H/2+T,visible:M&&A.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:V/2,y:0,offsetY:H/2+T,visible:M&&A.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:V,y:0,offsetX:H/2-T,offsetY:H/2+T,visible:M&&A.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:J/2,offsetX:H/2+T,visible:M&&A.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:V,y:J/2,offsetX:H/2-T,visible:M&&A.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:J,offsetX:H/2+T,offsetY:H/2-T,visible:M&&A.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:V/2,y:J,offsetY:H/2-T,visible:M&&A.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:V,y:J,offsetX:H/2-T,offsetY:H/2-T,visible:M&&A.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:V/2,y:-this.rotateAnchorOffset()*n.Util._sign(J)-T,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:V,height:J,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const X=this.anchorStyleFunc();X&&G.forEach(oe=>{X(oe)}),(U=this.getLayer())===null||U===void 0||U.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const U=this.findOne("."+this._movingAnchorName);U&&U.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),u.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return o.Node.prototype.toObject.call(this)}clone(U){return o.Node.prototype.clone.call(this,U)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}nu.Transformer=j,j.isTransforming=()=>L>0;function Y(O){return O instanceof Array||n.Util.warn("enabledAnchors value should be an array"),O instanceof Array&&O.forEach(function(U){E.indexOf(U)===-1&&n.Util.warn("Unknown anchor name: "+U+". Available names are: "+E.join(", "))}),O||[]}return j.prototype.className="Transformer",(0,g._registerNode)(j),r.Factory.addGetterSetter(j,"enabledAnchors",E,Y),r.Factory.addGetterSetter(j,"flipEnabled",!0,(0,f.getBooleanValidator)()),r.Factory.addGetterSetter(j,"resizeEnabled",!0),r.Factory.addGetterSetter(j,"anchorSize",10,(0,f.getNumberValidator)()),r.Factory.addGetterSetter(j,"rotateEnabled",!0),r.Factory.addGetterSetter(j,"rotateLineVisible",!0),r.Factory.addGetterSetter(j,"rotationSnaps",[]),r.Factory.addGetterSetter(j,"rotateAnchorOffset",50,(0,f.getNumberValidator)()),r.Factory.addGetterSetter(j,"rotateAnchorCursor","crosshair"),r.Factory.addGetterSetter(j,"rotationSnapTolerance",5,(0,f.getNumberValidator)()),r.Factory.addGetterSetter(j,"borderEnabled",!0),r.Factory.addGetterSetter(j,"anchorStroke","rgb(0, 161, 255)"),r.Factory.addGetterSetter(j,"anchorStrokeWidth",1,(0,f.getNumberValidator)()),r.Factory.addGetterSetter(j,"anchorFill","white"),r.Factory.addGetterSetter(j,"anchorCornerRadius",0,(0,f.getNumberValidator)()),r.Factory.addGetterSetter(j,"borderStroke","rgb(0, 161, 255)"),r.Factory.addGetterSetter(j,"borderStrokeWidth",1,(0,f.getNumberValidator)()),r.Factory.addGetterSetter(j,"borderDash"),r.Factory.addGetterSetter(j,"keepRatio",!0),r.Factory.addGetterSetter(j,"shiftBehavior","default"),r.Factory.addGetterSetter(j,"centeredScaling",!1),r.Factory.addGetterSetter(j,"ignoreStroke",!1),r.Factory.addGetterSetter(j,"padding",0,(0,f.getNumberValidator)()),r.Factory.addGetterSetter(j,"node"),r.Factory.addGetterSetter(j,"nodes"),r.Factory.addGetterSetter(j,"boundBoxFunc"),r.Factory.addGetterSetter(j,"anchorDragBoundFunc"),r.Factory.addGetterSetter(j,"anchorStyleFunc"),r.Factory.addGetterSetter(j,"shouldOverdrawWholeArea",!1),r.Factory.addGetterSetter(j,"useSingleNodeRotation",!0),r.Factory.backCompat(j,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"}),nu}var ru={},L0;function $4(){if(L0)return ru;L0=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.Wedge=void 0;const n=yt(),r=tr(),o=pt(),l=wt(),c=pt();let u=class extends r.Shape{_sceneFunc(f){f.beginPath(),f.arc(0,0,this.radius(),0,o.Konva.getAngle(this.angle()),this.clockwise()),f.lineTo(0,0),f.closePath(),f.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(f){this.radius(f/2)}setHeight(f){this.radius(f/2)}};return ru.Wedge=u,u.prototype.className="Wedge",u.prototype._centroid=!0,u.prototype._attrsAffectingSize=["radius"],(0,c._registerNode)(u),n.Factory.addGetterSetter(u,"radius",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"angle",0,(0,l.getNumberValidator)()),n.Factory.addGetterSetter(u,"clockwise",!1),n.Factory.backCompat(u,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"}),ru}var iu={},T0;function J4(){if(T0)return iu;T0=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.Blur=void 0;const n=yt(),r=Rn(),o=wt();function l(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const c=[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],u=[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 d(g,m){const y=g.data,x=g.width,R=g.height;let w,_,b,E,z,F,k,N,L,j,Y,O,U,I,V,J,A,M,T,H,G,X,oe,te,K=m+m+1,ne=x-1,se=R-1,$=m+1,ue=$*($+1)/2,pe=new l,Q=null,re=pe,de=null,xe=null,Re=c[m],be=u[m];for(b=1;b<K;b++)re=re.next=new l,b===$&&(Q=re);for(re.next=pe,k=F=0,_=0;_<R;_++){for(J=A=M=T=N=L=j=Y=0,O=$*(H=y[F]),U=$*(G=y[F+1]),I=$*(X=y[F+2]),V=$*(oe=y[F+3]),N+=ue*H,L+=ue*G,j+=ue*X,Y+=ue*oe,re=pe,b=0;b<$;b++)re.r=H,re.g=G,re.b=X,re.a=oe,re=re.next;for(b=1;b<$;b++)E=F+((ne<b?ne:b)<<2),N+=(re.r=H=y[E])*(te=$-b),L+=(re.g=G=y[E+1])*te,j+=(re.b=X=y[E+2])*te,Y+=(re.a=oe=y[E+3])*te,J+=H,A+=G,M+=X,T+=oe,re=re.next;for(de=pe,xe=Q,w=0;w<x;w++)y[F+3]=oe=Y*Re>>be,oe!==0?(oe=255/oe,y[F]=(N*Re>>be)*oe,y[F+1]=(L*Re>>be)*oe,y[F+2]=(j*Re>>be)*oe):y[F]=y[F+1]=y[F+2]=0,N-=O,L-=U,j-=I,Y-=V,O-=de.r,U-=de.g,I-=de.b,V-=de.a,E=k+((E=w+m+1)<ne?E:ne)<<2,J+=de.r=y[E],A+=de.g=y[E+1],M+=de.b=y[E+2],T+=de.a=y[E+3],N+=J,L+=A,j+=M,Y+=T,de=de.next,O+=H=xe.r,U+=G=xe.g,I+=X=xe.b,V+=oe=xe.a,J-=H,A-=G,M-=X,T-=oe,xe=xe.next,F+=4;k+=x}for(w=0;w<x;w++){for(A=M=T=J=L=j=Y=N=0,F=w<<2,O=$*(H=y[F]),U=$*(G=y[F+1]),I=$*(X=y[F+2]),V=$*(oe=y[F+3]),N+=ue*H,L+=ue*G,j+=ue*X,Y+=ue*oe,re=pe,b=0;b<$;b++)re.r=H,re.g=G,re.b=X,re.a=oe,re=re.next;for(z=x,b=1;b<=m;b++)F=z+w<<2,N+=(re.r=H=y[F])*(te=$-b),L+=(re.g=G=y[F+1])*te,j+=(re.b=X=y[F+2])*te,Y+=(re.a=oe=y[F+3])*te,J+=H,A+=G,M+=X,T+=oe,re=re.next,b<se&&(z+=x);for(F=w,de=pe,xe=Q,_=0;_<R;_++)E=F<<2,y[E+3]=oe=Y*Re>>be,oe>0?(oe=255/oe,y[E]=(N*Re>>be)*oe,y[E+1]=(L*Re>>be)*oe,y[E+2]=(j*Re>>be)*oe):y[E]=y[E+1]=y[E+2]=0,N-=O,L-=U,j-=I,Y-=V,O-=de.r,U-=de.g,I-=de.b,V-=de.a,E=w+((E=_+$)<se?E:se)*x<<2,N+=J+=de.r=y[E],L+=A+=de.g=y[E+1],j+=M+=de.b=y[E+2],Y+=T+=de.a=y[E+3],de=de.next,O+=H=xe.r,U+=G=xe.g,I+=X=xe.b,V+=oe=xe.a,J-=H,A-=G,M-=X,T-=oe,xe=xe.next,F+=x}}const f=function(m){const y=Math.round(this.blurRadius());y>0&&d(m,y)};return iu.Blur=f,n.Factory.addGetterSetter(r.Node,"blurRadius",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),iu}var su={},z0;function Z4(){if(z0)return su;z0=1,Object.defineProperty(su,"__esModule",{value:!0}),su.Brighten=void 0;const n=yt(),r=Rn(),o=wt(),l=function(c){let u=this.brightness()*255,d=c.data,f=d.length,g;for(g=0;g<f;g+=4)d[g]+=u,d[g+1]+=u,d[g+2]+=u};return su.Brighten=l,n.Factory.addGetterSetter(r.Node,"brightness",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),su}var ou={},M0;function e5(){if(M0)return ou;M0=1,Object.defineProperty(ou,"__esModule",{value:!0}),ou.Contrast=void 0;const n=yt(),r=Rn(),o=wt(),l=function(c){const u=Math.pow((this.contrast()+100)/100,2);let d=c.data,f=d.length,g=150,m=150,y=150,x;for(x=0;x<f;x+=4)g=d[x],m=d[x+1],y=d[x+2],g/=255,g-=.5,g*=u,g+=.5,g*=255,m/=255,m-=.5,m*=u,m+=.5,m*=255,y/=255,y-=.5,y*=u,y+=.5,y*=255,g=g<0?0:g>255?255:g,m=m<0?0:m>255?255:m,y=y<0?0:y>255?255:y,d[x]=g,d[x+1]=m,d[x+2]=y};return ou.Contrast=l,n.Factory.addGetterSetter(r.Node,"contrast",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),ou}var au={},O0;function t5(){if(O0)return au;O0=1,Object.defineProperty(au,"__esModule",{value:!0}),au.Emboss=void 0;const n=yt(),r=Rn(),o=gn(),l=wt(),c=function(u){let d=this.embossStrength()*10,f=this.embossWhiteLevel()*255,g=this.embossDirection(),m=this.embossBlend(),y=0,x=0,R=u.data,w=u.width,_=u.height,b=w*4,E=_;switch(g){case"top-left":y=-1,x=-1;break;case"top":y=-1,x=0;break;case"top-right":y=-1,x=1;break;case"right":y=0,x=1;break;case"bottom-right":y=1,x=1;break;case"bottom":y=1,x=0;break;case"bottom-left":y=1,x=-1;break;case"left":y=0,x=-1;break;default:o.Util.error("Unknown emboss direction: "+g)}do{const z=(E-1)*b;let F=y;E+F<1&&(F=0),E+F>_&&(F=0);const k=(E-1+F)*w*4;let N=w;do{const L=z+(N-1)*4;let j=x;N+j<1&&(j=0),N+j>w&&(j=0);const Y=k+(N-1+j)*4,O=R[L]-R[Y],U=R[L+1]-R[Y+1],I=R[L+2]-R[Y+2];let V=O;const J=V>0?V:-V,A=U>0?U:-U,M=I>0?I:-I;if(A>J&&(V=U),M>J&&(V=I),V*=d,m){const T=R[L]+V,H=R[L+1]+V,G=R[L+2]+V;R[L]=T>255?255:T<0?0:T,R[L+1]=H>255?255:H<0?0:H,R[L+2]=G>255?255:G<0?0:G}else{let T=f-V;T<0?T=0:T>255&&(T=255),R[L]=R[L+1]=R[L+2]=T}}while(--N)}while(--E)};return au.Emboss=c,n.Factory.addGetterSetter(r.Node,"embossStrength",.5,(0,l.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"embossWhiteLevel",.5,(0,l.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"embossDirection","top-left",null,n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"embossBlend",!1,null,n.Factory.afterSetFilter),au}var lu={},I0;function n5(){if(I0)return lu;I0=1,Object.defineProperty(lu,"__esModule",{value:!0}),lu.Enhance=void 0;const n=yt(),r=Rn(),o=wt();function l(u,d,f,g,m){let y=f-d,x=m-g,R;return y===0?g+x/2:x===0?g:(R=(u-d)/y,R=x*R+g,R)}const c=function(u){let d=u.data,f=d.length,g=d[0],m=g,y,x=d[1],R=x,w,_=d[2],b=_,E,z;const F=this.enhance();if(F===0)return;for(z=0;z<f;z+=4)y=d[z+0],y<g?g=y:y>m&&(m=y),w=d[z+1],w<x?x=w:w>R&&(R=w),E=d[z+2],E<_?_=E:E>b&&(b=E);m===g&&(m=255,g=0),R===x&&(R=255,x=0),b===_&&(b=255,_=0);let k,N,L,j,Y,O,U,I,V;for(F>0?(N=m+F*(255-m),L=g-F*(g-0),Y=R+F*(255-R),O=x-F*(x-0),I=b+F*(255-b),V=_-F*(_-0)):(k=(m+g)*.5,N=m+F*(m-k),L=g+F*(g-k),j=(R+x)*.5,Y=R+F*(R-j),O=x+F*(x-j),U=(b+_)*.5,I=b+F*(b-U),V=_+F*(_-U)),z=0;z<f;z+=4)d[z+0]=l(d[z+0],g,m,L,N),d[z+1]=l(d[z+1],x,R,O,Y),d[z+2]=l(d[z+2],_,b,V,I)};return lu.Enhance=c,n.Factory.addGetterSetter(r.Node,"enhance",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),lu}var cu={},j0;function r5(){if(j0)return cu;j0=1,Object.defineProperty(cu,"__esModule",{value:!0}),cu.Grayscale=void 0;const n=function(r){let o=r.data,l=o.length,c,u;for(c=0;c<l;c+=4)u=.34*o[c]+.5*o[c+1]+.16*o[c+2],o[c]=u,o[c+1]=u,o[c+2]=u};return cu.Grayscale=n,cu}var uu={},U0;function i5(){if(U0)return uu;U0=1,Object.defineProperty(uu,"__esModule",{value:!0}),uu.HSL=void 0;const n=yt(),r=Rn(),o=wt();n.Factory.addGetterSetter(r.Node,"hue",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"saturation",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"luminance",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter);const l=function(c){let u=c.data,d=u.length,f=1,g=Math.pow(2,this.saturation()),m=Math.abs(this.hue()+360)%360,y=this.luminance()*127,x;const R=f*g*Math.cos(m*Math.PI/180),w=f*g*Math.sin(m*Math.PI/180),_=.299*f+.701*R+.167*w,b=.587*f-.587*R+.33*w,E=.114*f-.114*R-.497*w,z=.299*f-.299*R-.328*w,F=.587*f+.413*R+.035*w,k=.114*f-.114*R+.293*w,N=.299*f-.3*R+1.25*w,L=.587*f-.586*R-1.05*w,j=.114*f+.886*R-.2*w;let Y,O,U,I;for(x=0;x<d;x+=4)Y=u[x+0],O=u[x+1],U=u[x+2],I=u[x+3],u[x+0]=_*Y+b*O+E*U+y,u[x+1]=z*Y+F*O+k*U+y,u[x+2]=N*Y+L*O+j*U+y,u[x+3]=I};return uu.HSL=l,uu}var du={},B0;function s5(){if(B0)return du;B0=1,Object.defineProperty(du,"__esModule",{value:!0}),du.HSV=void 0;const n=yt(),r=Rn(),o=wt(),l=function(c){const u=c.data,d=u.length,f=Math.pow(2,this.value()),g=Math.pow(2,this.saturation()),m=Math.abs(this.hue()+360)%360,y=f*g*Math.cos(m*Math.PI/180),x=f*g*Math.sin(m*Math.PI/180),R=.299*f+.701*y+.167*x,w=.587*f-.587*y+.33*x,_=.114*f-.114*y-.497*x,b=.299*f-.299*y-.328*x,E=.587*f+.413*y+.035*x,z=.114*f-.114*y+.293*x,F=.299*f-.3*y+1.25*x,k=.587*f-.586*y-1.05*x,N=.114*f+.886*y-.2*x;let L,j,Y,O;for(let U=0;U<d;U+=4)L=u[U+0],j=u[U+1],Y=u[U+2],O=u[U+3],u[U+0]=R*L+w*j+_*Y,u[U+1]=b*L+E*j+z*Y,u[U+2]=F*L+k*j+N*Y,u[U+3]=O};return du.HSV=l,n.Factory.addGetterSetter(r.Node,"hue",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"saturation",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"value",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),du}var hu={},G0;function o5(){if(G0)return hu;G0=1,Object.defineProperty(hu,"__esModule",{value:!0}),hu.Invert=void 0;const n=function(r){let o=r.data,l=o.length,c;for(c=0;c<l;c+=4)o[c]=255-o[c],o[c+1]=255-o[c+1],o[c+2]=255-o[c+2]};return hu.Invert=n,hu}var fu={},H0;function a5(){if(H0)return fu;H0=1,Object.defineProperty(fu,"__esModule",{value:!0}),fu.Kaleidoscope=void 0;const n=yt(),r=Rn(),o=gn(),l=wt(),c=function(f,g,m){let y=f.data,x=g.data,R=f.width,w=f.height,_=m.polarCenterX||R/2,b=m.polarCenterY||w/2,E,z,F,k=0,N=0,L=0,j=0,Y,O=Math.sqrt(_*_+b*b);z=R-_,F=w-b,Y=Math.sqrt(z*z+F*F),O=Y>O?Y:O;let U=w,I=R,V,J,A=360/I*Math.PI/180,M,T;for(J=0;J<I;J+=1)for(M=Math.sin(J*A),T=Math.cos(J*A),V=0;V<U;V+=1)z=Math.floor(_+O*V/U*T),F=Math.floor(b+O*V/U*M),E=(F*R+z)*4,k=y[E+0],N=y[E+1],L=y[E+2],j=y[E+3],E=(J+V*R)*4,x[E+0]=k,x[E+1]=N,x[E+2]=L,x[E+3]=j},u=function(f,g,m){let y=f.data,x=g.data,R=f.width,w=f.height,_=m.polarCenterX||R/2,b=m.polarCenterY||w/2,E,z,F,k,N,L=0,j=0,Y=0,O=0,U,I=Math.sqrt(_*_+b*b);z=R-_,F=w-b,U=Math.sqrt(z*z+F*F),I=U>I?U:I;let V=w,J=R,A,M,T=0,H,G;for(z=0;z<R;z+=1)for(F=0;F<w;F+=1)k=z-_,N=F-b,A=Math.sqrt(k*k+N*N)*V/I,M=(Math.atan2(N,k)*180/Math.PI+360+T)%360,M=M*J/360,H=Math.floor(M),G=Math.floor(A),E=(G*R+H)*4,L=y[E+0],j=y[E+1],Y=y[E+2],O=y[E+3],E=(F*R+z)*4,x[E+0]=L,x[E+1]=j,x[E+2]=Y,x[E+3]=O},d=function(f){const g=f.width,m=f.height;let y,x,R,w,_,b,E,z,F,k,N=Math.round(this.kaleidoscopePower());const L=Math.round(this.kaleidoscopeAngle()),j=Math.floor(g*(L%360)/360);if(N<1)return;const Y=o.Util.createCanvasElement();Y.width=g,Y.height=m;const O=Y.getContext("2d").getImageData(0,0,g,m);o.Util.releaseCanvas(Y),c(f,O,{polarCenterX:g/2,polarCenterY:m/2});let U=g/Math.pow(2,N);for(;U<=8;)U=U*2,N-=1;U=Math.ceil(U);let I=U,V=0,J=I,A=1;for(j+U>g&&(V=I,J=0,A=-1),x=0;x<m;x+=1)for(y=V;y!==J;y+=A)R=Math.round(y+j)%g,F=(g*x+R)*4,_=O.data[F+0],b=O.data[F+1],E=O.data[F+2],z=O.data[F+3],k=(g*x+y)*4,O.data[k+0]=_,O.data[k+1]=b,O.data[k+2]=E,O.data[k+3]=z;for(x=0;x<m;x+=1)for(I=Math.floor(U),w=0;w<N;w+=1){for(y=0;y<I+1;y+=1)F=(g*x+y)*4,_=O.data[F+0],b=O.data[F+1],E=O.data[F+2],z=O.data[F+3],k=(g*x+I*2-y-1)*4,O.data[k+0]=_,O.data[k+1]=b,O.data[k+2]=E,O.data[k+3]=z;I*=2}u(O,f,{})};return fu.Kaleidoscope=d,n.Factory.addGetterSetter(r.Node,"kaleidoscopePower",2,(0,l.getNumberValidator)(),n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"kaleidoscopeAngle",0,(0,l.getNumberValidator)(),n.Factory.afterSetFilter),fu}var pu={},V0;function l5(){if(V0)return pu;V0=1,Object.defineProperty(pu,"__esModule",{value:!0}),pu.Mask=void 0;const n=yt(),r=Rn(),o=wt();function l(R,w,_){let b=(_*R.width+w)*4;const E=[];return E.push(R.data[b++],R.data[b++],R.data[b++],R.data[b++]),E}function c(R,w){return Math.sqrt(Math.pow(R[0]-w[0],2)+Math.pow(R[1]-w[1],2)+Math.pow(R[2]-w[2],2))}function u(R){const w=[0,0,0];for(let _=0;_<R.length;_++)w[0]+=R[_][0],w[1]+=R[_][1],w[2]+=R[_][2];return w[0]/=R.length,w[1]/=R.length,w[2]/=R.length,w}function d(R,w){const _=l(R,0,0),b=l(R,R.width-1,0),E=l(R,0,R.height-1),z=l(R,R.width-1,R.height-1),F=w||10;if(c(_,b)<F&&c(b,z)<F&&c(z,E)<F&&c(E,_)<F){const k=u([b,_,z,E]),N=[];for(let L=0;L<R.width*R.height;L++){const j=c(k,[R.data[L*4],R.data[L*4+1],R.data[L*4+2]]);N[L]=j<F?0:255}return N}}function f(R,w){for(let _=0;_<R.width*R.height;_++)R.data[4*_+3]=w[_]}function g(R,w,_){const b=[1,1,1,1,0,1,1,1,1],E=Math.round(Math.sqrt(b.length)),z=Math.floor(E/2),F=[];for(let k=0;k<_;k++)for(let N=0;N<w;N++){const L=k*w+N;let j=0;for(let Y=0;Y<E;Y++)for(let O=0;O<E;O++){const U=k+Y-z,I=N+O-z;if(U>=0&&U<_&&I>=0&&I<w){const V=U*w+I,J=b[Y*E+O];j+=R[V]*J}}F[L]=j===2040?255:0}return F}function m(R,w,_){const b=[1,1,1,1,1,1,1,1,1],E=Math.round(Math.sqrt(b.length)),z=Math.floor(E/2),F=[];for(let k=0;k<_;k++)for(let N=0;N<w;N++){const L=k*w+N;let j=0;for(let Y=0;Y<E;Y++)for(let O=0;O<E;O++){const U=k+Y-z,I=N+O-z;if(U>=0&&U<_&&I>=0&&I<w){const V=U*w+I,J=b[Y*E+O];j+=R[V]*J}}F[L]=j>=1020?255:0}return F}function y(R,w,_){const b=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],E=Math.round(Math.sqrt(b.length)),z=Math.floor(E/2),F=[];for(let k=0;k<_;k++)for(let N=0;N<w;N++){const L=k*w+N;let j=0;for(let Y=0;Y<E;Y++)for(let O=0;O<E;O++){const U=k+Y-z,I=N+O-z;if(U>=0&&U<_&&I>=0&&I<w){const V=U*w+I,J=b[Y*E+O];j+=R[V]*J}}F[L]=j}return F}const x=function(R){let w=this.threshold(),_=d(R,w);return _&&(_=g(_,R.width,R.height),_=m(_,R.width,R.height),_=y(_,R.width,R.height),f(R,_)),R};return pu.Mask=x,n.Factory.addGetterSetter(r.Node,"threshold",0,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),pu}var gu={},W0;function c5(){if(W0)return gu;W0=1,Object.defineProperty(gu,"__esModule",{value:!0}),gu.Noise=void 0;const n=yt(),r=Rn(),o=wt(),l=function(c){const u=this.noise()*255,d=c.data,f=d.length,g=u/2;for(let m=0;m<f;m+=4)d[m+0]+=g-2*g*Math.random(),d[m+1]+=g-2*g*Math.random(),d[m+2]+=g-2*g*Math.random()};return gu.Noise=l,n.Factory.addGetterSetter(r.Node,"noise",.2,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),gu}var mu={},K0;function u5(){if(K0)return mu;K0=1,Object.defineProperty(mu,"__esModule",{value:!0}),mu.Pixelate=void 0;const n=yt(),r=gn(),o=Rn(),l=wt(),c=function(u){let d=Math.ceil(this.pixelSize()),f=u.width,g=u.height,m,y,x,R,w,_,b,E=Math.ceil(f/d),z=Math.ceil(g/d),F,k,N,L,j,Y,O,U=u.data;if(d<=0){r.Util.error("pixelSize value can not be <= 0");return}for(j=0;j<E;j+=1)for(Y=0;Y<z;Y+=1){for(R=0,w=0,_=0,b=0,F=j*d,k=F+d,N=Y*d,L=N+d,O=0,m=F;m<k;m+=1)if(!(m>=f))for(y=N;y<L;y+=1)y>=g||(x=(f*y+m)*4,R+=U[x+0],w+=U[x+1],_+=U[x+2],b+=U[x+3],O+=1);for(R=R/O,w=w/O,_=_/O,b=b/O,m=F;m<k;m+=1)if(!(m>=f))for(y=N;y<L;y+=1)y>=g||(x=(f*y+m)*4,U[x+0]=R,U[x+1]=w,U[x+2]=_,U[x+3]=b)}};return mu.Pixelate=c,n.Factory.addGetterSetter(o.Node,"pixelSize",8,(0,l.getNumberValidator)(),n.Factory.afterSetFilter),mu}var vu={},q0;function d5(){if(q0)return vu;q0=1,Object.defineProperty(vu,"__esModule",{value:!0}),vu.Posterize=void 0;const n=yt(),r=Rn(),o=wt(),l=function(c){let u=Math.round(this.levels()*254)+1,d=c.data,f=d.length,g=255/u,m;for(m=0;m<f;m+=1)d[m]=Math.floor(d[m]/g)*g};return vu.Posterize=l,n.Factory.addGetterSetter(r.Node,"levels",.5,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),vu}var yu={},Y0;function h5(){if(Y0)return yu;Y0=1,Object.defineProperty(yu,"__esModule",{value:!0}),yu.RGB=void 0;const n=yt(),r=Rn(),o=wt(),l=function(c){let u=c.data,d=u.length,f=this.red(),g=this.green(),m=this.blue(),y,x;for(y=0;y<d;y+=4)x=(.34*u[y]+.5*u[y+1]+.16*u[y+2])/255,u[y]=x*f,u[y+1]=x*g,u[y+2]=x*m,u[y+3]=u[y+3]};return yu.RGB=l,n.Factory.addGetterSetter(r.Node,"red",0,function(c){return this._filterUpToDate=!1,c>255?255:c<0?0:Math.round(c)}),n.Factory.addGetterSetter(r.Node,"green",0,function(c){return this._filterUpToDate=!1,c>255?255:c<0?0:Math.round(c)}),n.Factory.addGetterSetter(r.Node,"blue",0,o.RGBComponent,n.Factory.afterSetFilter),yu}var xu={},X0;function f5(){if(X0)return xu;X0=1,Object.defineProperty(xu,"__esModule",{value:!0}),xu.RGBA=void 0;const n=yt(),r=Rn(),o=wt(),l=function(c){const u=c.data,d=u.length,f=this.red(),g=this.green(),m=this.blue(),y=this.alpha();for(let x=0;x<d;x+=4){const R=1-y;u[x]=f*y+u[x]*R,u[x+1]=g*y+u[x+1]*R,u[x+2]=m*y+u[x+2]*R}};return xu.RGBA=l,n.Factory.addGetterSetter(r.Node,"red",0,function(c){return this._filterUpToDate=!1,c>255?255:c<0?0:Math.round(c)}),n.Factory.addGetterSetter(r.Node,"green",0,function(c){return this._filterUpToDate=!1,c>255?255:c<0?0:Math.round(c)}),n.Factory.addGetterSetter(r.Node,"blue",0,o.RGBComponent,n.Factory.afterSetFilter),n.Factory.addGetterSetter(r.Node,"alpha",1,function(c){return this._filterUpToDate=!1,c>1?1:c<0?0:c}),xu}var wu={},Q0;function p5(){if(Q0)return wu;Q0=1,Object.defineProperty(wu,"__esModule",{value:!0}),wu.Sepia=void 0;const n=function(r){let o=r.data,l=o.length,c,u,d,f;for(c=0;c<l;c+=4)u=o[c+0],d=o[c+1],f=o[c+2],o[c+0]=Math.min(255,u*.393+d*.769+f*.189),o[c+1]=Math.min(255,u*.349+d*.686+f*.168),o[c+2]=Math.min(255,u*.272+d*.534+f*.131)};return wu.Sepia=n,wu}var Su={},$0;function g5(){if($0)return Su;$0=1,Object.defineProperty(Su,"__esModule",{value:!0}),Su.Solarize=void 0;const n=function(r){const o=r.data,l=r.width,c=r.height,u=l*4;let d=c;do{const f=(d-1)*u;let g=l;do{const m=f+(g-1)*4;let y=o[m],x=o[m+1],R=o[m+2];y>127&&(y=255-y),x>127&&(x=255-x),R>127&&(R=255-R),o[m]=y,o[m+1]=x,o[m+2]=R}while(--g)}while(--d)};return Su.Solarize=n,Su}var ku={},J0;function m5(){if(J0)return ku;J0=1,Object.defineProperty(ku,"__esModule",{value:!0}),ku.Threshold=void 0;const n=yt(),r=Rn(),o=wt(),l=function(c){const u=this.threshold()*255,d=c.data,f=d.length;for(let g=0;g<f;g+=1)d[g]=d[g]<u?0:255};return ku.Threshold=l,n.Factory.addGetterSetter(r.Node,"threshold",.5,(0,o.getNumberValidator)(),n.Factory.afterSetFilter),ku}var Z0;function v5(){if(Z0)return Mc;Z0=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.Konva=void 0;const n=ip(),r=I4(),o=U4(),l=B4(),c=G4(),u=H4(),d=V4(),f=Pm(),g=_p(),m=Am(),y=W4(),x=K4(),R=q4(),w=Y4(),_=Nm(),b=X4(),E=Q4(),z=$4(),F=J4(),k=Z4(),N=e5(),L=t5(),j=n5(),Y=r5(),O=i5(),U=s5(),I=o5(),V=a5(),J=l5(),A=c5(),M=u5(),T=d5(),H=h5(),G=f5(),X=p5(),oe=g5(),te=m5();return Mc.Konva=n.Konva.Util._assign(n.Konva,{Arc:r.Arc,Arrow:o.Arrow,Circle:l.Circle,Ellipse:c.Ellipse,Image:u.Image,Label:d.Label,Tag:d.Tag,Line:f.Line,Path:g.Path,Rect:m.Rect,RegularPolygon:y.RegularPolygon,Ring:x.Ring,Sprite:R.Sprite,Star:w.Star,Text:_.Text,TextPath:b.TextPath,Transformer:E.Transformer,Wedge:z.Wedge,Filters:{Blur:F.Blur,Brighten:k.Brighten,Contrast:N.Contrast,Emboss:L.Emboss,Enhance:j.Enhance,Grayscale:Y.Grayscale,HSL:O.HSL,HSV:U.HSV,Invert:I.Invert,Kaleidoscope:V.Kaleidoscope,Mask:J.Mask,Noise:A.Noise,Pixelate:M.Pixelate,Posterize:T.Posterize,RGB:H.RGB,RGBA:G.RGBA,Sepia:X.Sepia,Solarize:oe.Solarize,Threshold:te.Threshold}}),Mc}var y5=dh.exports,eg;function x5(){if(eg)return dh.exports;eg=1,Object.defineProperty(y5,"__esModule",{value:!0});const n=v5();return dh.exports=n.Konva,dh.exports}var w5=x5();const tg=Iu(w5);var ih={exports:{}},ng;function S5(){return ng||(ng=1,(function(n,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Konva=void 0;var o=ip();Object.defineProperty(r,"Konva",{enumerable:!0,get:function(){return o.Konva}});const l=ip();n.exports=l.Konva})(ih,ih.exports)),ih.exports}var k5=S5();const Lu=Iu(k5);var Uf={exports:{}};/**
|
|
161
161
|
* @license React
|
|
162
162
|
* react-reconciler.production.min.js
|