drawui-core 0.6.0 → 0.6.1
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.
- package/dist/index.cjs +24 -24
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +24 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var kn=r=>!!r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.width)&&Number.isFinite(r.height);function He(r){return !kn(r)||r.width<=0||r.height<=0}function lt(r,e){if(He(r))return kn(e)?{...e}:null;if(He(e))return {...r};let t=r,i=e,n=Math.min(t.x,i.x),o=Math.min(t.y,i.y),s=Math.max(t.x+t.width,i.x+i.width),a=Math.max(t.y+t.height,i.y+i.height);return {x:n,y:o,width:s-n,height:a-o}}function Pn(r,e){if(He(r)||He(e))return false;let t=r,i=e;return t.x<i.x+i.width&&i.x<t.x+t.width&&t.y<i.y+i.height&&i.y<t.y+t.height}function $i(r,e){if(!Pn(r,e))return [{...r}];let t=[],i=r.x+r.width,n=r.y+r.height,o=e.x+e.width,s=e.y+e.height;e.y>r.y&&t.push({x:r.x,y:r.y,width:r.width,height:e.y-r.y}),s<n&&t.push({x:r.x,y:s,width:r.width,height:n-s});let a=Math.max(r.y,Math.min(e.y,n)),l=Math.max(0,Math.min(s,n)-a);return l>0&&e.x>r.x&&t.push({x:r.x,y:a,width:e.x-r.x,height:l}),l>0&&o<i&&t.push({x:o,y:a,width:i-o,height:l}),t}var Vi=(r,e)=>({x:r.x-e,y:r.y-e,width:r.width+e*2,height:r.height+e*2}),vn=class{current=null;reset(e=null){this.current=kn(e)?{...e}:null;}get(){return this.current?{...this.current}:null}desiredOf(e){let t=e.padding??40,i=e.viewport,n=e.minSize?.width??i.width,o=e.minSize?.height??i.height,s=e.anchor??{x:0,y:0},a;return He(e.content)?a={x:s.x,y:s.y,width:Math.max(i.width,n),height:Math.max(i.height,o)}:a=Vi(e.content,t),e.includeViewport===false?a:lt(a,Vi(i,t))}update(e){let t=e.viewport,i=this.desiredOf(e);if(He(this.current))return this.current=i,{extent:{...i},changed:true,action:"init"};let n=this.current;if(i.x<n.x-.5||i.y<n.y-.5||i.x+i.width>n.x+n.width+.5||i.y+i.height>n.y+n.height+.5){let c=lt(n,i),h=Math.abs(c.x-n.x)>.5||Math.abs(c.y-n.y)>.5||Math.abs(c.width-n.width)>.5||Math.abs(c.height-n.height)>.5;return this.current=c,{extent:{...c},changed:h,action:h?"grow":"hold"}}if(!e.pointerMoved)return {extent:{...n},changed:false,action:"hold",holdReason:"pointer-still"};if($i(n,i).some(c=>Pn(c,t)))return {extent:{...n},changed:false,action:"hold",holdReason:"still-visible"};let l=Math.abs(i.x-n.x)>.5||Math.abs(i.y-n.y)>.5||Math.abs(i.width-n.width)>.5||Math.abs(i.height-n.height)>.5;return this.current=i,{extent:{...i},changed:l,action:l?"shrink":"hold"}}};var pe=new Map,Bt=new Set,Ln="anonymous",_t=new Map,An=new Set;function Dn(r){return An.add(r),()=>An.delete(r)}function Oi(){for(let r of Array.from(An))try{r();}catch{}}function Oo(r){Ln=r;}var zo=r=>/^https?:/i.test(r);function Vt(r){if(!r)return null;let e=pe.get(r);return e?e.status==="ready"?e.loaded:null:(Fe(r),null)}function Hn(r){return pe.get(r)?.status==="error"}function Go(r){return pe.get(r)?.status==="loading"}function Fe(r){if(!r)return Promise.resolve(null);let e=pe.get(r);return e?e.status==="ready"?Promise.resolve(e.loaded):e.status==="error"?Promise.resolve(null):Uo(r):(pe.set(r,{status:"loading"}),new Promise(t=>{let i=new Image;Ln&&zo(r)&&(i.crossOrigin=Ln);let n=o=>{if(o&&i.naturalWidth>0){let s={img:i,width:i.naturalWidth,height:i.naturalHeight,src:r};pe.set(r,{status:"ready",loaded:s}),Oi(),t(s);}else pe.set(r,{status:"error"}),Oi(),t(null);};i.onload=()=>n(true),i.onerror=()=>n(false);try{i.src=r;}catch{n(false);}}))}function Uo(r){return new Promise(e=>{let t=0,i=()=>{let n=pe.get(r);if(!n||n.status==="ready")return e(n&&n.status==="ready"?n.loaded:null);if(n.status==="error"||++t>600)return e(null);setTimeout(i,50);};i();})}async function Rn(r){let e=new Set;for(let t of r)t.type==="image"&&t.src&&e.add(t.src);await Promise.all(Array.from(e).map(t=>Fe(t)));}function En(r){if(!r)return null;if(r.startsWith("data:"))return r;let e=_t.get(r);if(e)return e;let t=Vt(r);if(!t)return null;try{let i=document.createElement("canvas");i.width=t.width,i.height=t.height;let n=i.getContext("2d");if(!n)return null;n.drawImage(t.img,0,0);let o=i.toDataURL("image/png");return _t.set(r,o),o}catch{return null}}function zi(r){r.startsWith("blob:")&&Bt.add(r);}function Nn(r){if(!(!r.startsWith("blob:")||!Bt.has(r))){Bt.delete(r),pe.delete(r),_t.delete(r);try{URL.revokeObjectURL(r);}catch{}}}function Wo(){for(let r of Array.from(Bt))Nn(r);pe.clear(),_t.clear();}var $t=31457280;function Gi(r){return typeof r=="function"}var Fo=r=>!!r&&typeof r=="object"&&typeof r.url=="string";function Ui(r,e){return e.split(".").reduce((t,i)=>{if(t&&typeof t=="object")return t[i]},r)}function Ko(r){if(typeof r=="string")return r.trim()||null;if(!r||typeof r!="object")return null;let e=r,t=["url","data.url","data","data.src","location","path","src","href","fileUrl","imageUrl","data.fileUrl"];for(let i of t){let n=Ui(e,i);if(typeof n=="string"&&n.trim())return n.trim()}return null}function Wi(r,e){let t=(r||"").trim();if(!t)throw new Error("\u4E0A\u4F20\u63A5\u53E3\u8FD4\u56DE\u4E3A\u7A7A");let i;try{i=JSON.parse(t);}catch{if(/^(https?:)?\/\//.test(t)||t.startsWith("data:")||t.startsWith("/"))return t;throw new Error(`\u4E0A\u4F20\u63A5\u53E3\u8FD4\u56DE\u65E0\u6CD5\u89E3\u6790\uFF1A${t.slice(0,120)}`)}let n=e?Ui(i,e):Ko(i);if(typeof n=="string"&&n.trim())return n.trim();throw new Error(`\u4E0A\u4F20\u63A5\u53E3\u8FD4\u56DE\u91CC\u6CA1\u6709\u56FE\u7247\u5730\u5740\uFF1A${t.slice(0,120)}`)}async function Fi(r,e){let t=e.maxSizeBytes??31457280;if(r.size>t)throw new Error(`image.tooLarge: \u56FE\u7247\u5927\u5C0F ${(r.size/1024/1024).toFixed(2)} MB \u8D85\u8FC7\u4E0A\u9650 ${(t/1024/1024).toFixed(2)} MB`);let i=new FormData;i.append(e.fieldName||"file",r,r.name||"image.png");for(let[a,l]of Object.entries(e.fields||{}))i.append(a,l);let n=new AbortController,o=e.timeoutMs??6e4,s=setTimeout(()=>n.abort(),o);try{let a=await fetch(e.url,{method:e.method||"POST",body:i,headers:e.headers,credentials:e.withCredentials?"include":"same-origin",signal:n.signal}),l=await a.text();if(!a.ok)throw new Error(`\u4E0A\u4F20\u5931\u8D25\uFF08HTTP ${a.status}\uFF09\uFF1A${l.slice(0,120)}`);return Wi(l,e.responseUrlPath)}catch(a){throw a?.name==="AbortError"?new Error(`\u4E0A\u4F20\u8D85\u65F6\uFF08${o}ms\uFF09`):a instanceof Error?a:new Error(String(a))}finally{clearTimeout(s);}}async function Ki(r,e){if(Gi(r)){let t=await r(e);if(!t||typeof t!="string")throw new Error("\u4E0A\u4F20\u51FD\u6570\u6CA1\u6709\u8FD4\u56DE\u56FE\u7247\u5730\u5740");return t}if(Fo(r))return Fi(e,r);throw new Error("\u4E0A\u4F20\u914D\u7F6E\u4E0D\u5408\u6CD5\uFF1A\u9700\u8981 { url } \u6216\u4E0A\u4F20\u51FD\u6570")}function Bn(r){let e=[];for(let t of r){if(t.type!=="image")continue;let i=t;i.src&&(i.temporary||i.src.startsWith("blob:"))&&e.push(i.src);}return e}var Yo=new Set(["text","line","arrow","draw","table","uml-class","uml-interface","mind-map","sticky-note"]);function _n(r){return !Yo.has(r)}var be={identity(){return {a:1,b:0,c:0,d:1,e:0,f:0}},translation(r,e){return {a:1,b:0,c:0,d:1,e:r,f:e}},rotation(r){let e=Math.cos(r),t=Math.sin(r);return {a:e,b:t,c:-t,d:e,e:0,f:0}},scale(r,e){return {a:r,b:0,c:0,d:e,e:0,f:0}},multiply(r,e){return {a:r.a*e.a+r.b*e.c,b:r.a*e.b+r.b*e.d,c:r.c*e.a+r.d*e.c,d:r.c*e.b+r.d*e.d,e:r.e*e.a+r.f*e.c+e.e,f:r.e*e.b+r.f*e.d+e.f}},apply(r,e){return {x:r.a*e.x+r.c*e.y+r.e,y:r.b*e.x+r.d*e.y+r.f}},invert(r){let e=r.a*r.d-r.b*r.c;if(Math.abs(e)<1e-10)return null;let t=1/e;return {a:r.d*t,b:-r.b*t,c:-r.c*t,d:r.a*t,e:(r.c*r.f-r.d*r.e)*t,f:(r.b*r.e-r.a*r.f)*t}},createCameraMatrix(r){let e=be.scale(r.zoom,r.zoom),t=be.translation(r.x,r.y);return be.multiply(t,e)}};var Re=class{x=0;y=0;zoom=1;minZoom=.1;maxZoom=10;getMatrix(){return be.createCameraMatrix({x:this.x,y:this.y,zoom:this.zoom})}getInverseMatrix(){return be.invert(this.getMatrix())}screenToPage(e){let t=this.getInverseMatrix();return t?be.apply(t,e):e}pageToScreen(e){return be.apply(this.getMatrix(),e)}translate(e,t){this.x+=e,this.y+=t;}zoomAt(e,t){let i=this.screenToPage(e);this.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.zoom*t));let n=this.pageToScreen(i);this.x+=e.x-n.x,this.y+=e.y-n.y;}reset(){this.x=0,this.y=0,this.zoom=1;}getZoom(){return this.zoom}fitBounds(e,t=50){let i=window.innerWidth,n=window.innerHeight,o=(i-t*2)/e.width,s=(n-t*2)/e.height,a=Math.min(o,s,this.maxZoom);this.zoom=Math.max(this.minZoom,a),this.x=(i-e.width*this.zoom)/2-e.x*this.zoom,this.y=(n-e.height*this.zoom)/2-e.y*this.zoom;}};var Xo=40;var Zo=20;function Ot(r,e,t){let i=t.x-e.x,n=t.y-e.y,o=i*i+n*n;if(o<1e-9)return Math.hypot(r.x-e.x,r.y-e.y);let s=((r.x-e.x)*i+(r.y-e.y)*n)/o;return s=Math.max(0,Math.min(1,s)),Math.hypot(r.x-(e.x+i*s),r.y-(e.y+n*s))}function ct(r){return r==="polyline"||r==="orthogonal"}function ht(r){return r.type==="arrow"&&(!!r.startBinding||!!r.endBinding)}function zt(r,e=40){let t=[];for(let i=0;i+1<r.length;i++){let n=r[i],o=r[i+1],s=o.x-n.x,a=o.y-n.y,l=Math.hypot(s,a);l<e||t.push({index:i,center:{x:(n.x+o.x)/2,y:(n.y+o.y)/2},axis:Math.abs(s)>=Math.abs(a)?"H":"V",length:l});}return t}function $n(r,e,t=10,i=14){let n=zt(r);if(n.length===0)return null;let o=null,s=1/0;for(let a of n){if(Math.hypot(e.x-a.center.x,e.y-a.center.y)<=t)return a;let c=Ot(e,r[a.index],r[a.index+1]);c<=i&&c<s&&(s=c,o=a);}return o}function On(r,e,t,i=[]){if(e<0||e+1>=r.length)return r;let n=r[e],o=r[e+1],s=Math.abs(o.x-n.x)>=Math.abs(o.y-n.y),a=e===0,l=e+1===r.length-1,c=s?Math.sign(o.x-n.x)||1:Math.sign(o.y-n.y)||1,h=Math.abs(s?o.x-n.x:o.y-n.y),d=Math.min(24,h/2),u=s?(n.y+o.y)/2:(n.x+o.x)/2,p=I=>s?I.y:I.x,g=[];a?g.push(p(r[0])):g.push(p(r[e-1])),l?g.push(p(r[r.length-1])):g.push(p(r[e+2]));let m=u+t,f=1/0,b=null;for(let I of [...g,...i]){let T=Math.abs(m-I);T<20&&T<f&&(f=T,b=I);}b!==null&&(m=b);let x=[];if(a){let I=s?{x:n.x+c*d,y:n.y}:{x:n.x,y:n.y+c*d};x.push({x:n.x,y:n.y},I,s?{x:I.x,y:m}:{x:m,y:I.y});}else x.push(s?{x:n.x,y:m}:{x:m,y:n.y});if(l){let I=s?{x:o.x-c*d,y:o.y}:{x:o.x,y:o.y-c*d};x.push(s?{x:I.x,y:m}:{x:m,y:I.y},I,{x:o.x,y:o.y});}else x.push(s?{x:o.x,y:m}:{x:m,y:o.y});return [...r.slice(0,e),...x,...r.slice(e+2)]}function dt(r){let e=[];for(let t of r){let i=e.length;if(!(i>0&&Math.abs(e[i-1].x-t.x)<1e-6&&Math.abs(e[i-1].y-t.y)<1e-6)){if(i>=2){let n=e[i-2],o=e[i-1];if(Math.abs(n.y-o.y)<1e-6&&Math.abs(o.y-t.y)<1e-6||Math.abs(n.x-o.x)<1e-6&&Math.abs(o.x-t.x)<1e-6){e[i-1]=t;continue}}e.push(t);}}return e}function zn(r){return r.length<=2?[]:r.slice(1,-1).map(e=>({x:e.x,y:e.y}))}var Yi=(r,e)=>Math.hypot(r.x-e.x,r.y-e.y);function jo(r,e,t,i){if(!e||r.length===0)return r;let n={x:t.x-e.start.x,y:t.y-e.start.y},o={x:i.x-e.end.x,y:i.y-e.end.y},s=Yi({x:0,y:0},n)>=Yi({x:0,y:0},o)?n:o;return Math.abs(s.x)<.01&&Math.abs(s.y)<.01?r:r.map(a=>({x:a.x+s.x,y:a.y+s.y}))}function qo(r,e,t,i,n,o=20/2){if(r.length===0)return r;let s=r.map(l=>({x:l.x,y:l.y})),a=(l,c,h)=>{h&&(h.x!==0?Math.abs(l.y-c.y)<=o&&(l.y=c.y):h.y!==0&&Math.abs(l.x-c.x)<=o&&(l.x=c.x));};return a(s[0],e,i),a(s[s.length-1],t,n),s}function Gt(r,e,t,i,n,o){return r.length===0?r:qo(jo(r,e,t,i),t,i,n,o)}function Gn(r,e,t=.75){return r.length!==e.length||r.length===0?false:r.every((i,n)=>Math.abs(i.x-e[n].x)<=t&&Math.abs(i.y-e[n].y)<=t)}function Vn(r,e,t=24,i=.75){let n=Math.abs(e.x-r.x),o=Math.abs(e.y-r.y);return n<=t+.001&&o<=i||o<=t+.001&&n<=i}function Xi(r,e,t=.5){if(!e||r.length<2)return false;for(let i=1;i<r.length;i++){let n=r[i-1],o=r[i],s=Math.min(n.x,o.x),a=Math.max(n.x,o.x),l=Math.min(n.y,o.y),c=Math.max(n.y,o.y);if(s<e.x+e.width-t&&a>e.x+t&&l<e.y+e.height-t&&c>e.y+t)return true}return false}function Zi(r){if(r.length<2)return "0";let e=(t,i)=>Math.abs(i.x-t.x)>=Math.abs(i.y-t.y)?"H":"V";return `${r.length}:${e(r[0],r[1])}${e(r[r.length-2],r[r.length-1])}`}function Ut(r){let{userRoute:e,autoRoute:t,base:i,fromBox:n,toBox:o}=r;return e.length<2?false:Xi(e,n)||Xi(e,o)?true:i&&i.length>=2&&t.length>=2?Zi(i)!==Zi(t):t.length===2&&e.length>=4}function Un(r,e,t=24,i=.75){if(r.length===0||e.length<3)return r;let n=[e[0],e[e.length-1]],o=[Vn(n[0],e[1],t,i)?e[1]:null,Vn(n[1],e[e.length-2],t,i)?e[e.length-2]:null].filter(s=>!!s);return o.length===0?r:r.filter(s=>!o.some(a=>Math.abs(s.x-a.x)<=i&&Math.abs(s.y-a.y)<=i))}var ji={primary:"#3b82f6",selection:{outline:"#3b82f6",handleStroke:"#3b82f6",handleFill:"#ffffff",outlineFill:"rgba(59, 130, 246, 0.1)",shadow:"#3b82f6"},grid:"#e5e7eb",text:"#1f2937",editBorder:"#3b82f6",brushFill:"rgba(59, 130, 246, 0.08)",brushStroke:"rgba(59, 130, 246, 0.8)",guide:"rgba(59, 130, 246, 0.6)",lineHighlight:"rgba(59, 130, 246, 0.4)",genDot:"#3b82f6",genLine:"rgba(59, 130, 246, 0.55)"},H={...ji,selection:{...ji.selection}},Wn=new Set;function Jo(r){return Wn.add(r),()=>Wn.delete(r)}function Wt(r){r.selection&&Object.assign(H.selection,r.selection);for(let e of Object.keys(r)){if(e==="selection")continue;let t=r[e];t!==void 0&&(H[e]=t);}Wn.forEach(e=>e());}function Qo(){return H}function z(r,e){let t=qi(r);if(!t)return r;let i=parseInt(t,16),n=i>>16&255,o=i>>8&255,s=i&255;return `rgba(${n}, ${o}, ${s}, ${e})`}function Fn(r,e){let t=qi(r);if(!t)return r;let i=parseInt(t,16),n=e<0?0:255,o=Math.abs(e),s=a=>Math.round((n-a)*o+a).toString(16).padStart(2,"0");return `#${s(i>>16&255)}${s(i>>8&255)}${s(i&255)}`}var er={light:{grid:"#e5e7eb"},warm:{grid:"#e0dcc8"},gray:{grid:"#d1d5db"},purple:{grid:"#e0dcfa"},green:{grid:"#d1fae5"},"eye-care":{grid:"#e3dcc6"}},tr="light";function qi(r){let e=r.replace("#","").trim();return /^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/.test(e)?e.length===3?e.split("").map(t=>t+t).join(""):e:null}var X=class{context;constructor(e){this.context=e;}getCursor(e){return null}hasTransientState(){return false}cancelTransient(){return false}isDragging(){return false}dispose(){}};var nr=[{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587"},{code:"en-US",label:"English"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4"},{code:"de-DE",label:"Deutsch"},{code:"fr-FR",label:"Fran\xE7ais"}],ir={"save.success":"\u5DF2\u4FDD\u5B58","save.fail":"\u4FDD\u5B58\u5931\u8D25","tool.select":"\u9009\u62E9\u5DE5\u5177","tool.hand":"\u62D6\u62FD\u89C6\u53E3","tool.rectangle":"\u77E9\u5F62","tool.rounded-rectangle":"\u5706\u89D2\u77E9\u5F62","tool.circle":"\u5706\u5F62","tool.ellipse":"\u692D\u5706","tool.diamond":"\u83F1\u5F62","tool.triangle":"\u4E09\u89D2\u5F62","tool.hexagon":"\u516D\u8FB9\u5F62","tool.parallelogram":"\u5E73\u884C\u56DB\u8FB9\u5F62","tool.trapezoid":"\u68AF\u5F62","tool.pentagon":"\u4E94\u8FB9\u5F62","tool.octagon":"\u516B\u8FB9\u5F62","tool.star":"\u661F\u5F62","tool.cylinder":"\u5706\u67F1\u4F53","tool.cloud":"\u4E91\u5F62","tool.heart":"\u5FC3\u5F62","tool.block-arrow-right":"\u53F3\u7BAD\u5934","tool.block-arrow-left":"\u5DE6\u7BAD\u5934","tool.block-arrow-up":"\u4E0A\u7BAD\u5934","tool.block-arrow-down":"\u4E0B\u7BAD\u5934","tool.block-arrow-double":"\u53CC\u5411\u7BAD\u5934","tool.right-triangle":"\u76F4\u89D2\u4E09\u89D2\u5F62","tool.cross":"\u5341\u5B57","tool.speech-rect":"\u65B9\u5F62\u5BF9\u8BDD\u6846","tool.speech-round":"\u5706\u5F62\u5BF9\u8BDD\u6846","tool.cube":"\u7ACB\u65B9\u4F53","tool.sector":"\u6247\u5F62","tool.delay":"D \u5F62","tool.predefined-process":"\u9884\u5B9A\u4E49\u6D41\u7A0B","tool.document":"\u6587\u6863","tool.stadium":"\u5168\u5706\u89D2\u77E9\u5F62","tool.class-catalog":"\u7C7B\u76EE","tool.envelope":"\u4FE1\u5C01","tool.checkbox":"\u590D\u9009\u6846","tool.sticky-note":"\u4FBF\u7B7E","shape.sticky-note":"\u4FBF\u7B7E","tool.triangular-pyramid":"\u4E09\u68F1\u9525","tool.quadrangular-pyramid":"\u56DB\u68F1\u9525","tool.cuboid":"\u957F\u65B9\u4F53","tool.sphere":"\u7403","tool.ellipsoid":"\u692D\u7403","tool.pie":"\u997C\u72B6","tool.hollow-pie":"\u7A7A\u5FC3\u997C\u72B6","class.plain":"\u7C7B","flow.process":"\u5904\u7406","flow.step":"\u6D41\u7A0B","flow.startEnd":"\u5F00\u59CB/\u7ED3\u675F","flow.decision":"\u5224\u5B9A","flow.data":"\u6570\u636E","flow.manual":"\u624B\u52A8\u64CD\u4F5C","flow.preparation":"\u51C6\u5907","flow.database":"\u6570\u636E\u5E93","flow.delay":"\u5EF6\u65F6","shapeGroup.basic":"\u57FA\u7840","shapeGroup.flowchart":"\u6D41\u7A0B\u56FE","shapeGroup.other":"\u5176\u4ED6","shapeGroup.solid":"\u7ACB\u4F53","shapeGroup.uml":"\u7C7B\u56FE","shapeMenu.hint":"\u60AC\u505C\u67E5\u770B\u540D\u79F0","tool.chevron":"\u5C16\u89D2","tool.brace-left":"\u5DE6\u62EC\u53F7","tool.brace-right":"\u53F3\u62EC\u53F7","tool.uml-class":"UML \u7C7B\u56FE","tool.uml-interface":"UML \u63A5\u53E3","tool.line":"\u76F4\u7EBF","tool.arrow":"\u7EBF\u6761","tool.text":"\u6587\u672C","tool.draw":"\u753B\u7B14","tool.pen":"\u753B\u7B14","tool.highlighter":"\u8367\u5149\u7B14","tool.eraser":"\u6A61\u76AE\u64E6","status.none":"\u672A\u9009\u62E9","status.selected":"\u5DF2\u9009\u62E9 {n} \u4E2A\u56FE\u5F62","toolbar.select":"\u9009\u62E9 (V)","toolbar.hand":"\u62D6\u62FD\u89C6\u53E3 (H)","toolbar.shapes":"\u5F62\u72B6","toolbar.grid":"\u7F51\u683C","toolbar.undo":"\u64A4\u9500 (Ctrl+Z)","toolbar.redo":"\u91CD\u505A (Ctrl+Shift+Z)","toolbar.arrow":"\u7BAD\u5934 (A)","toolbar.text":"\u6587\u672C (T)","toolbar.pen":"\u753B\u7B14","toolbar.highlighter":"\u8367\u5149\u7B14","toolbar.eraser":"\u6A61\u76AE\u64E6 (E)","toolbar.uml-class":"UML \u7C7B\u56FE","toolbar.uml-interface":"UML \u63A5\u53E3","zoom.in":"\u653E\u5927","zoom.out":"\u7F29\u5C0F","zoom.reset":"\u91CD\u7F6E","style.stroke":"\u8FB9\u6846","style.line":"\u7EBF\u6761","style.fill":"\u586B\u5145","style.text":"\u6587\u5B57","style.highlight":"\u9AD8\u4EAE","style.prefix":"\u524D\u7F00\u7B26\u53F7","style.prefix.soon":"\u524D\u7F00\u7B26\u53F7\u5F00\u53D1\u4E2D\uFF0C\u656C\u8BF7\u671F\u5F85","style.none":"\u65E0","style.addColor":"\u6DFB\u52A0\u989C\u8272","style.connection":"\u8FDE\u7EBF","style.arrow":"\u7BAD\u5934","style.dashed":"\u865A\u7EBF","style.solid":"\u5B9E\u7EBF","style.opacity":"\u4E0D\u900F\u660E\u5EA6","style.connection.straight":"\u76F4\u7EBF","style.connection.polyline":"\u5706\u89D2\u6298\u7EBF","style.connection.orthogonal":"\u76F4\u89D2\u6298\u7EBF","style.connection.curve":"\u66F2\u7EBF","style.arrowhead.none":"\u65E0\u7BAD\u5934","style.arrowhead.end":"\u7EC8\u70B9\u7BAD\u5934","style.arrowhead.start":"\u8D77\u70B9\u7BAD\u5934","style.arrowhead.both":"\u53CC\u7BAD\u5934","style.arrowhead.none-dashed":"\u65E0\u7BAD\u5934\u865A\u7EBF","style.arrowhead.both-dashed":"\u53CC\u7BAD\u5934\u865A\u7EBF","style.uml":"UML","style.arrowhead.inheritance":"\u7EE7\u627F","style.arrowhead.composition":"\u7EC4\u5408","style.arrowhead.aggregation":"\u805A\u5408","style.arrowhead.dependency":"\u4F9D\u8D56","style.arrowhead.realization":"\u5B9E\u73B0","menu.title":"\u9009\u62E9\u65B0\u56FE\u5F62","menu.cancel":"\u70B9\u51FB\u7A7A\u767D\u5904\u53D6\u6D88","shape.rectangle":"\u77E9\u5F62","shape.rounded-rectangle":"\u5706\u89D2","shape.circle":"\u5706\u5F62","shape.ellipse":"\u692D\u5706","shape.diamond":"\u83F1\u5F62","shape.triangle":"\u4E09\u89D2","shape.hexagon":"\u516D\u8FB9\u5F62","shape.parallelogram":"\u5E73\u884C","shape.trapezoid":"\u68AF\u5F62","shape.pentagon":"\u4E94\u8FB9\u5F62","shape.octagon":"\u516B\u8FB9\u5F62","shape.star":"\u661F\u5F62","shape.uml-class":"\u7C7B\u56FE","shape.uml-interface":"\u63A5\u53E3","uml.drag":"\u62D6\u62FD\u6392\u5E8F","uml.delete":"\u5220\u9664\u8BE5\u884C","uml.textColor":"\u6587\u5B57\u989C\u8272","uml.defaultColor":"\u9ED8\u8BA4\u989C\u8272","uml.fontSize":"\u5B57\u53F7","uml.strikethrough":"\u5220\u9664\u7EBF","uml.attribute":"\u5C5E\u6027","uml.method":"\u65B9\u6CD5","minimap.title":"\u5C0F\u5730\u56FE","minimap.expand":"\u5C55\u5F00\u5C0F\u5730\u56FE","minimap.collapse":"\u6536\u8D77\u5C0F\u5730\u56FE","tool.mind-map":"\u601D\u7EF4\u5BFC\u56FE","toolbar.mind-map":"\u601D\u7EF4\u5BFC\u56FE","toolbar.export":"\u5BFC\u51FA","toolbar.export.png":"PNG \u56FE\u7247","toolbar.export.svg":"SVG \u77E2\u91CF\u56FE","toolbar.export.pdf":"PDF \u6587\u6863","toolbar.export.data":"\u5BFC\u51FA\u6570\u636E","toolbar.import.data":"\u5BFC\u5165\u6570\u636E","import.success":"\u5BFC\u5165\u6210\u529F\uFF0C\u5DF2\u6062\u590D {n} \u4E2A\u56FE\u5F62","import.fail":"\u5BFC\u5165\u5931\u8D25\uFF0C\u6587\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E","shape.mind-map":"\u601D\u7EF4\u5BFC\u56FE","mindmap.defaultRoot":"\u4E2D\u5FC3\u4E3B\u9898","mindmap.defaultBranch":"\u5206\u652F\u4E3B\u9898","mindmap.nodeText":"\u8282\u70B9\u6587\u672C","mindmap.addChild":"\u5B50\u8282\u70B9","mindmap.addSibling":"\u5144\u5F1F\u8282\u70B9","mindmap.deleteNode":"\u5220\u9664\u8282\u70B9","mindmap.color":"\u989C\u8272","mindmap.levelColor":"\u9ED8\u8BA4\u5C42\u7EA7\u8272","mindmap.icon":"\u56FE\u6807","mindmap.noIcon":"\u65E0\u56FE\u6807","mindmap.note":"\u5C5E\u6027\u8BF4\u660E","mindmap.notePlaceholder":"\u8BF4\u660E\u5185\u5BB9\uFF08\u53EF\u9009\uFF09","mindmap.noteColor":"\u8BF4\u660E\u989C\u8272","mindmap.noteColorDefault":"\u540C\u8282\u70B9\u8272","mindmap.collapse":"\u6298\u53E0","mindmap.expand":"\u5C55\u5F00","mindmap.close":"\u5173\u95ED\u7F16\u8F91","mindmap.more":"\u66F4\u591A\u8BBE\u7F6E","mindmap.level":"\u5C42\u7EA7","mindmap.promote1":"\u5347\u4E00\u7EA7","mindmap.promote2":"\u5347\u4E24\u7EA7","mindmap.promoteDisabled":"\u5DF2\u81F3\u9876\u5C42","tool.table":"\u8868\u683C","toolbar.table":"\u8868\u683C","shape.table":"\u8868\u683C","table.insertRow":"\u63D2\u5165\u884C","table.deleteRow":"\u5220\u9664\u884C","table.insertCol":"\u63D2\u5165\u5217","table.deleteCol":"\u5220\u9664\u5217","table.merge":"\u5408\u5E76\u5355\u5143\u683C","table.split":"\u62C6\u5206\u5355\u5143\u683C","table.insertRowAbove":"\u5728\u4E0A\u65B9\u63D2\u5165\u884C","table.insertRowBelow":"\u5728\u4E0B\u65B9\u63D2\u5165\u884C","table.insertColLeft":"\u5728\u5DE6\u4FA7\u63D2\u5165\u5217","table.insertColRight":"\u5728\u53F3\u4FA7\u63D2\u5165\u5217","table.pickHint":"\u62D6\u9009\u884C\u5217\u6570","ctx.copy":"\u590D\u5236","ctx.paste":"\u7C98\u8D34","ctx.duplicate":"\u521B\u5EFA\u526F\u672C","ctx.layer":"\u5C42\u7EA7","ctx.bringToFront":"\u7F6E\u4E8E\u9876\u5C42","ctx.bringForward":"\u4E0A\u79FB\u4E00\u5C42","ctx.sendBackward":"\u4E0B\u79FB\u4E00\u5C42","ctx.sendToBack":"\u7F6E\u4E8E\u5E95\u5C42","ctx.copyStyle":"\u590D\u5236\u6837\u5F0F","ctx.pasteStyle":"\u7C98\u8D34\u6837\u5F0F","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"\u65CB\u8F6C","ctx.group":"\u6210\u7EC4","ctx.ungroup":"\u89E3\u7EC4","ctx.lock":"\u9501\u5B9A","ctx.unlock":"\u89E3\u9501","ctx.unlockAll":"\u5168\u90E8\u89E3\u9501","ctx.delete":"\u5220\u9664","toolbar.icon":"\u56FE\u6807 (S)","toolbar.template":"\u6A21\u677F","template.search":"\u641C\u7D22\u6A21\u677F","template.all":"\u5168\u90E8","template.empty":"\u6CA1\u6709\u5339\u914D\u7684\u6A21\u677F","toolbar.image":"\u56FE\u7247","toolbar.more":"\u66F4\u591A","toolbar.pageTheme":"\u9875\u9762\u4E3B\u9898","pageTheme.light":"\u9ED8\u8BA4","pageTheme.warm":"\u6696\u9EC4","pageTheme.gray":"\u6D45\u7070","pageTheme.purple":"\u6D45\u7D2B","pageTheme.green":"\u6D45\u7EFF","pageTheme.eye-care":"\u62A4\u773C","tool.image":"\u56FE\u7247","image.uploadFailed":"\u56FE\u7247\u4E0A\u4F20\u5931\u8D25","image.insertFailed":"\u56FE\u7247\u63D2\u5165\u5931\u8D25","image.tooLarge":"\u56FE\u7247\u8D85\u8FC7 30 MB\uFF0C\u65E0\u6CD5\u4E0A\u4F20","image.temporaryInserted":"\u5DF2\u63D2\u5165\u4E34\u65F6\u56FE\u7247\uFF08\u672A\u914D\u7F6E\u4E0A\u4F20\u63A5\u53E3\uFF0C\u5237\u65B0\u540E\u4F1A\u4E22\u5931\uFF09","image.naturalSize":"\u539F\u56FE\u5C3A\u5BF8","icon.search":"\u641C\u7D22\u56FE\u6807","icon.empty":"\u6CA1\u6709\u5339\u914D\u7684\u56FE\u6807","icon.recent":"\u6700\u8FD1\u4F7F\u7528","iconCat.status":"\u72B6\u6001\u6807\u8BB0","iconCat.number":"\u6570\u5B57\u5FBD\u6807","iconCat.tech":"\u4E91\u4E0E\u6280\u672F","iconCat.chart":"\u6570\u636E\u56FE\u8868","iconCat.office":"\u529E\u516C\u6587\u6863","iconCat.media":"\u5A92\u4F53\u534F\u4F5C","iconCat.arrow":"\u7BAD\u5934\u65B9\u5411","iconCat.misc":"\u5E38\u7528","iconCat.emoji":"\u8868\u60C5","iconCat.sticker":"\u8D34\u7EB8","iconCat.device":"\u7535\u8111\u8BBE\u5907","iconCat.weather":"\u5929\u6C14","iconCat.transport":"\u4EA4\u901A","iconCat.nature":"\u81EA\u7136","iconCat.building":"\u5EFA\u7B51","iconCat.medical":"\u533B\u7597","iconCat.shopping":"\u8D2D\u7269","iconCat.science":"\u79D1\u5B66","iconCat.animal":"\u52A8\u7269","iconCat.time":"\u65F6\u95F4","iconCat.edit":"\u7F16\u8F91","iconCat.food":"\u98DF\u7269","iconCat.communication":"\u901A\u8BAF"},Ji={"zh-CN":ir,"zh-TW":{"save.success":"\u5DF2\u5132\u5B58","save.fail":"\u5132\u5B58\u5931\u6557","tool.select":"\u9078\u53D6\u5DE5\u5177","tool.hand":"\u62D6\u66F3\u8996\u7A97","tool.rectangle":"\u77E9\u5F62","tool.rounded-rectangle":"\u5713\u89D2\u77E9\u5F62","tool.circle":"\u5713\u5F62","tool.ellipse":"\u6A62\u5713","tool.diamond":"\u83F1\u5F62","tool.triangle":"\u4E09\u89D2\u5F62","tool.hexagon":"\u516D\u908A\u5F62","tool.parallelogram":"\u5E73\u884C\u56DB\u908A\u5F62","tool.trapezoid":"\u68AF\u5F62","tool.pentagon":"\u4E94\u908A\u5F62","tool.octagon":"\u516B\u908A\u5F62","tool.star":"\u661F\u5F62","tool.cylinder":"\u5713\u67F1\u9AD4","tool.cloud":"\u96F2\u5F62","tool.heart":"\u5FC3\u5F62","tool.block-arrow-right":"\u53F3\u7BAD\u982D","tool.block-arrow-left":"\u5DE6\u7BAD\u982D","tool.block-arrow-up":"\u4E0A\u7BAD\u982D","tool.block-arrow-down":"\u4E0B\u7BAD\u982D","tool.block-arrow-double":"\u96D9\u5411\u7BAD\u982D","tool.right-triangle":"\u76F4\u89D2\u4E09\u89D2\u5F62","tool.cross":"\u5341\u5B57","tool.speech-rect":"\u65B9\u5F62\u5C0D\u8A71\u6846","tool.speech-round":"\u5713\u5F62\u5C0D\u8A71\u6846","tool.cube":"\u7ACB\u65B9\u9AD4","tool.sector":"\u6247\u5F62","tool.delay":"D \u5F62","tool.predefined-process":"\u9810\u5B9A\u7FA9\u6D41\u7A0B","tool.document":"\u6587\u4EF6","tool.stadium":"\u5168\u5713\u89D2\u77E9\u5F62","tool.class-catalog":"\u985E\u76EE","tool.envelope":"\u4FE1\u5C01","tool.checkbox":"\u6838\u53D6\u65B9\u584A","tool.sticky-note":"\u4FBF\u5229\u8CBC","shape.sticky-note":"\u4FBF\u5229\u8CBC","tool.triangular-pyramid":"\u4E09\u7A1C\u9310","tool.quadrangular-pyramid":"\u56DB\u7A1C\u9310","tool.cuboid":"\u9577\u65B9\u9AD4","tool.sphere":"\u7403","tool.ellipsoid":"\u6A62\u7403","tool.pie":"\u9905\u72C0","tool.hollow-pie":"\u7A7A\u5FC3\u9905\u72C0","class.plain":"\u985E\u5225","flow.process":"\u8655\u7406","flow.step":"\u6D41\u7A0B","flow.startEnd":"\u958B\u59CB/\u7D50\u675F","flow.decision":"\u5224\u65B7","flow.data":"\u8CC7\u6599","flow.manual":"\u624B\u52D5\u64CD\u4F5C","flow.preparation":"\u6E96\u5099","flow.database":"\u8CC7\u6599\u5EAB","flow.delay":"\u5EF6\u9072","shapeGroup.basic":"\u57FA\u790E","shapeGroup.flowchart":"\u6D41\u7A0B\u5716","shapeGroup.other":"\u5176\u4ED6","shapeGroup.solid":"\u7ACB\u9AD4","shapeGroup.uml":"\u985E\u5225\u5716","shapeMenu.hint":"\u61F8\u505C\u67E5\u770B\u540D\u7A31","tool.chevron":"\u5C16\u89D2","tool.brace-left":"\u5DE6\u62EC\u865F","tool.brace-right":"\u53F3\u62EC\u865F","tool.uml-class":"UML \u985E\u5225\u5716","tool.uml-interface":"UML \u4ECB\u9762","tool.line":"\u76F4\u7DDA","tool.arrow":"\u7DDA\u689D","tool.text":"\u6587\u5B57","tool.draw":"\u756B\u7B46","tool.pen":"\u756B\u7B46","tool.highlighter":"\u87A2\u5149\u7B46","tool.eraser":"\u6A61\u76AE\u64E6","status.none":"\u672A\u9078\u53D6","status.selected":"\u5DF2\u9078\u53D6 {n} \u500B\u5716\u5F62","toolbar.select":"\u9078\u53D6 (V)","toolbar.hand":"\u62D6\u66F3\u8996\u7A97 (H)","toolbar.shapes":"\u5F62\u72C0","toolbar.grid":"\u683C\u7DDA","toolbar.undo":"\u5FA9\u539F (Ctrl+Z)","toolbar.redo":"\u91CD\u505A (Ctrl+Shift+Z)","toolbar.arrow":"\u7BAD\u982D (A)","toolbar.text":"\u6587\u5B57 (T)","toolbar.pen":"\u756B\u7B46","toolbar.highlighter":"\u87A2\u5149\u7B46","toolbar.eraser":"\u6A61\u76AE\u64E6 (E)","toolbar.uml-class":"UML \u985E\u5225\u5716","toolbar.uml-interface":"UML \u4ECB\u9762","zoom.in":"\u653E\u5927","zoom.out":"\u7E2E\u5C0F","zoom.reset":"\u91CD\u8A2D","style.stroke":"\u908A\u6846","style.line":"\u7DDA\u689D","style.fill":"\u586B\u8272","style.text":"\u6587\u5B57","style.highlight":"\u6A19\u793A","style.prefix":"\u524D\u7F6E\u7B26\u865F","style.prefix.soon":"\u524D\u7F6E\u7B26\u865F\u958B\u767C\u4E2D\uFF0C\u656C\u8ACB\u671F\u5F85","style.none":"\u7121","style.addColor":"\u65B0\u589E\u984F\u8272","style.connection":"\u9023\u7DDA","style.arrow":"\u7BAD\u982D","style.dashed":"\u865B\u7DDA","style.solid":"\u5BE6\u7DDA","style.opacity":"\u4E0D\u900F\u660E\u5EA6","style.connection.straight":"\u76F4\u7DDA","style.connection.polyline":"\u5713\u89D2\u6298\u7DDA","style.connection.orthogonal":"\u76F4\u89D2\u6298\u7DDA","style.connection.curve":"\u66F2\u7DDA","style.arrowhead.none":"\u7121\u7BAD\u982D","style.arrowhead.end":"\u7D42\u9EDE\u7BAD\u982D","style.arrowhead.start":"\u8D77\u9EDE\u7BAD\u982D","style.arrowhead.both":"\u96D9\u7BAD\u982D","style.arrowhead.none-dashed":"\u7121\u7BAD\u982D\u865B\u7DDA","style.arrowhead.both-dashed":"\u96D9\u7BAD\u982D\u865B\u7DDA","style.uml":"UML","style.arrowhead.inheritance":"\u7E7C\u627F","style.arrowhead.composition":"\u7D44\u5408","style.arrowhead.aggregation":"\u805A\u5408","style.arrowhead.dependency":"\u4F9D\u8CF4","style.arrowhead.realization":"\u5BE6\u73FE","menu.title":"\u9078\u64C7\u65B0\u5716\u5F62","menu.cancel":"\u9EDE\u64CA\u7A7A\u767D\u8655\u53D6\u6D88","shape.rectangle":"\u77E9\u5F62","shape.rounded-rectangle":"\u5713\u89D2","shape.circle":"\u5713\u5F62","shape.ellipse":"\u6A62\u5713","shape.diamond":"\u83F1\u5F62","shape.triangle":"\u4E09\u89D2","shape.hexagon":"\u516D\u908A\u5F62","shape.parallelogram":"\u5E73\u884C","shape.trapezoid":"\u68AF\u5F62","shape.pentagon":"\u4E94\u908A\u5F62","shape.octagon":"\u516B\u908A\u5F62","shape.star":"\u661F\u5F62","shape.uml-class":"\u985E\u5225\u5716","shape.uml-interface":"\u4ECB\u9762","uml.drag":"\u62D6\u66F3\u6392\u5E8F","uml.delete":"\u522A\u9664\u8A72\u5217","uml.textColor":"\u6587\u5B57\u984F\u8272","uml.defaultColor":"\u9810\u8A2D\u984F\u8272","uml.fontSize":"\u5B57\u7D1A","uml.strikethrough":"\u522A\u9664\u7DDA","uml.attribute":"\u5C6C\u6027","uml.method":"\u65B9\u6CD5","minimap.title":"\u5C0F\u5730\u5716","minimap.expand":"\u5C55\u958B\u5C0F\u5730\u5716","minimap.collapse":"\u6536\u5408\u5C0F\u5730\u5716","tool.mind-map":"\u5FC3\u667A\u5716","toolbar.mind-map":"\u5FC3\u667A\u5716","toolbar.export":"\u532F\u51FA","toolbar.export.png":"PNG \u5716\u7247","toolbar.export.svg":"SVG \u5411\u91CF\u5716","toolbar.export.pdf":"PDF \u6587\u4EF6","toolbar.export.data":"\u532F\u51FA\u8CC7\u6599","toolbar.import.data":"\u532F\u5165\u8CC7\u6599","import.success":"\u532F\u5165\u6210\u529F\uFF0C\u5DF2\u9084\u539F {n} \u500B\u5716\u5F62","import.fail":"\u532F\u5165\u5931\u6557\uFF0C\u6A94\u6848\u683C\u5F0F\u4E0D\u6B63\u78BA","shape.mind-map":"\u5FC3\u667A\u5716","mindmap.defaultRoot":"\u4E2D\u5FC3\u4E3B\u984C","mindmap.defaultBranch":"\u5206\u652F\u4E3B\u984C","mindmap.nodeText":"\u7BC0\u9EDE\u6587\u5B57","mindmap.addChild":"\u5B50\u7BC0\u9EDE","mindmap.addSibling":"\u5144\u5F1F\u7BC0\u9EDE","mindmap.deleteNode":"\u522A\u9664\u7BC0\u9EDE","mindmap.color":"\u984F\u8272","mindmap.levelColor":"\u9810\u8A2D\u5C64\u7D1A\u8272","mindmap.icon":"\u5716\u793A","mindmap.noIcon":"\u7121\u5716\u793A","mindmap.note":"\u5C6C\u6027\u8AAA\u660E","mindmap.notePlaceholder":"\u8AAA\u660E\u5167\u5BB9\uFF08\u9078\u586B\uFF09","mindmap.noteColor":"\u8AAA\u660E\u984F\u8272","mindmap.noteColorDefault":"\u540C\u7BC0\u9EDE\u8272","mindmap.collapse":"\u6536\u5408","mindmap.expand":"\u5C55\u958B","mindmap.close":"\u95DC\u9589\u7DE8\u8F2F","mindmap.more":"\u66F4\u591A\u8A2D\u5B9A","mindmap.level":"\u5C64\u7D1A","mindmap.promote1":"\u5347\u4E00\u7D1A","mindmap.promote2":"\u5347\u5169\u7D1A","mindmap.promoteDisabled":"\u5DF2\u81F3\u9802\u5C64","tool.table":"\u8868\u683C","toolbar.table":"\u8868\u683C","shape.table":"\u8868\u683C","table.insertRow":"\u63D2\u5165\u6A6B\u5217","table.deleteRow":"\u522A\u9664\u6A6B\u5217","table.insertCol":"\u63D2\u5165\u76F4\u6B04","table.deleteCol":"\u522A\u9664\u76F4\u6B04","table.merge":"\u5408\u4F75\u5132\u5B58\u683C","table.split":"\u5206\u5272\u5132\u5B58\u683C","table.insertRowAbove":"\u5728\u4E0A\u65B9\u63D2\u5165\u6A6B\u5217","table.insertRowBelow":"\u5728\u4E0B\u65B9\u63D2\u5165\u6A6B\u5217","table.insertColLeft":"\u5728\u5DE6\u5074\u63D2\u5165\u76F4\u6B04","table.insertColRight":"\u5728\u53F3\u5074\u63D2\u5165\u76F4\u6B04","table.pickHint":"\u62D6\u9078\u884C\u5217\u6578","ctx.copy":"\u8907\u88FD","ctx.paste":"\u8CBC\u4E0A","ctx.duplicate":"\u5EFA\u7ACB\u526F\u672C","ctx.layer":"\u5716\u5C64","ctx.bringToFront":"\u79FB\u5230\u6700\u4E0A\u5C64","ctx.bringForward":"\u4E0A\u79FB\u4E00\u5C64","ctx.sendBackward":"\u4E0B\u79FB\u4E00\u5C64","ctx.sendToBack":"\u79FB\u5230\u6700\u4E0B\u5C64","ctx.copyStyle":"\u8907\u88FD\u6A23\u5F0F","ctx.pasteStyle":"\u8CBC\u4E0A\u6A23\u5F0F","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"\u65CB\u8F49","ctx.group":"\u6210\u7D44","ctx.ungroup":"\u89E3\u7D44","ctx.lock":"\u9396\u5B9A","ctx.unlock":"\u89E3\u9396","ctx.unlockAll":"\u5168\u90E8\u89E3\u9396","ctx.delete":"\u522A\u9664","toolbar.icon":"\u5716\u793A (S)","toolbar.template":"\u7BC4\u672C","template.search":"\u641C\u5C0B\u7BC4\u672C","template.all":"\u5168\u90E8","template.empty":"\u6C92\u6709\u7B26\u5408\u7684\u7BC4\u672C","toolbar.image":"\u5716\u7247","toolbar.more":"\u66F4\u591A","toolbar.pageTheme":"\u9801\u9762\u4E3B\u984C","pageTheme.light":"\u9810\u8A2D","pageTheme.warm":"\u6696\u9EC3","pageTheme.gray":"\u6DFA\u7070","pageTheme.purple":"\u6DFA\u7D2B","pageTheme.green":"\u6DFA\u7DA0","pageTheme.eye-care":"\u8B77\u773C","tool.image":"\u5716\u7247","image.uploadFailed":"\u5716\u7247\u4E0A\u50B3\u5931\u6557","image.insertFailed":"\u5716\u7247\u63D2\u5165\u5931\u6557","image.tooLarge":"\u5716\u7247\u8D85\u904E 30 MB\uFF0C\u7121\u6CD5\u4E0A\u50B3","image.temporaryInserted":"\u5DF2\u63D2\u5165\u81E8\u6642\u5716\u7247\uFF08\u672A\u914D\u7F6E\u4E0A\u50B3\u4ECB\u9762\uFF0C\u91CD\u65B0\u6574\u7406\u5F8C\u6703\u907A\u5931\uFF09","image.naturalSize":"\u539F\u5716\u5C3A\u5BF8","icon.search":"\u641C\u5C0B\u5716\u793A","icon.empty":"\u6C92\u6709\u7B26\u5408\u7684\u5716\u793A","icon.recent":"\u6700\u8FD1\u4F7F\u7528","iconCat.status":"\u72C0\u614B\u6A19\u8A18","iconCat.number":"\u6578\u5B57\u5FBD\u6A19","iconCat.tech":"\u96F2\u7AEF\u8207\u6280\u8853","iconCat.chart":"\u8CC7\u6599\u5716\u8868","iconCat.office":"\u8FA6\u516C\u6587\u4EF6","iconCat.media":"\u5A92\u9AD4\u5354\u4F5C","iconCat.arrow":"\u7BAD\u982D\u65B9\u5411","iconCat.misc":"\u5E38\u7528","iconCat.emoji":"\u8868\u60C5","iconCat.sticker":"\u8CBC\u7D19","iconCat.device":"\u96FB\u8166\u8A2D\u5099","iconCat.weather":"\u5929\u6C23","iconCat.transport":"\u4EA4\u901A","iconCat.nature":"\u81EA\u7136","iconCat.building":"\u5EFA\u7BC9","iconCat.medical":"\u91AB\u7642","iconCat.shopping":"\u8CFC\u7269","iconCat.science":"\u79D1\u5B78","iconCat.animal":"\u52D5\u7269","iconCat.time":"\u6642\u9593","iconCat.edit":"\u7DE8\u8F2F","iconCat.food":"\u98DF\u7269","iconCat.communication":"\u901A\u8A0A"},"en-US":{"save.success":"Saved","save.fail":"Save failed","tool.select":"Select tool","tool.hand":"Pan view","tool.rectangle":"Rectangle","tool.rounded-rectangle":"Rounded rectangle","tool.circle":"Circle","tool.ellipse":"Ellipse","tool.diamond":"Diamond","tool.triangle":"Triangle","tool.hexagon":"Hexagon","tool.parallelogram":"Parallelogram","tool.trapezoid":"Trapezoid","tool.pentagon":"Pentagon","tool.octagon":"Octagon","tool.star":"Star","tool.cylinder":"Cylinder","tool.cloud":"Cloud","tool.heart":"Heart","tool.block-arrow-right":"Arrow right","tool.block-arrow-left":"Arrow left","tool.block-arrow-up":"Arrow up","tool.block-arrow-down":"Arrow down","tool.block-arrow-double":"Double arrow","tool.right-triangle":"Right triangle","tool.cross":"Cross","tool.speech-rect":"Speech bubble","tool.speech-round":"Round bubble","tool.cube":"Cube","tool.sector":"Sector","tool.delay":"Delay","tool.predefined-process":"Predefined process","tool.document":"Document","tool.stadium":"Stadium","tool.class-catalog":"Category","tool.envelope":"Envelope","tool.checkbox":"Checkbox","tool.sticky-note":"Sticky note","shape.sticky-note":"Sticky note","tool.triangular-pyramid":"Triangular pyramid","tool.quadrangular-pyramid":"Square pyramid","tool.cuboid":"Cuboid","tool.sphere":"Sphere","tool.ellipsoid":"Ellipsoid","tool.pie":"Pie","tool.hollow-pie":"Donut","class.plain":"Class","flow.process":"Process","flow.step":"Step","flow.startEnd":"Start / End","flow.decision":"Decision","flow.data":"Data","flow.manual":"Manual operation","flow.preparation":"Preparation","flow.database":"Database","flow.delay":"Delay","shapeGroup.basic":"Basic","shapeGroup.flowchart":"Flowchart","shapeGroup.other":"Other","shapeGroup.solid":"3D","shapeGroup.uml":"Class diagram","shapeMenu.hint":"Hover to see name","tool.chevron":"Chevron","tool.brace-left":"Left brace","tool.brace-right":"Right brace","tool.uml-class":"UML class","tool.uml-interface":"UML interface","tool.line":"Line","tool.arrow":"Line","tool.text":"Text","tool.draw":"Pen","tool.pen":"Pen","tool.highlighter":"Highlighter","tool.eraser":"Eraser","status.none":"Nothing selected","status.selected":"{n} shapes selected","toolbar.select":"Select (V)","toolbar.hand":"Pan view (H)","toolbar.shapes":"Shapes","toolbar.grid":"Grid","toolbar.undo":"Undo (Ctrl+Z)","toolbar.redo":"Redo (Ctrl+Shift+Z)","toolbar.arrow":"Arrow (A)","toolbar.text":"Text (T)","toolbar.pen":"Pen","toolbar.highlighter":"Highlighter","toolbar.eraser":"Eraser (E)","toolbar.uml-class":"UML class","toolbar.uml-interface":"UML interface","zoom.in":"Zoom in","zoom.out":"Zoom out","zoom.reset":"Reset","style.stroke":"Border","style.line":"Line","style.fill":"Fill","style.text":"Text","style.highlight":"Highlight","style.prefix":"Prefix","style.prefix.soon":"Prefix symbols are coming soon","style.none":"None","style.addColor":"Add color","style.connection":"Connection","style.arrow":"Arrow head","style.dashed":"Dashed","style.solid":"Solid","style.opacity":"Opacity","style.connection.straight":"Straight","style.connection.polyline":"Rounded polyline","style.connection.orthogonal":"Orthogonal","style.connection.curve":"Curve","style.arrowhead.none":"None","style.arrowhead.end":"End","style.arrowhead.start":"Start","style.arrowhead.both":"Both","style.arrowhead.none-dashed":"Dashed","style.arrowhead.both-dashed":"Dashed both","style.uml":"UML","style.arrowhead.inheritance":"Inheritance","style.arrowhead.composition":"Composition","style.arrowhead.aggregation":"Aggregation","style.arrowhead.dependency":"Dependency","style.arrowhead.realization":"Realization","menu.title":"Create shape","menu.cancel":"Click empty space to cancel","shape.rectangle":"Rectangle","shape.rounded-rectangle":"Rounded","shape.circle":"Circle","shape.ellipse":"Ellipse","shape.diamond":"Diamond","shape.triangle":"Triangle","shape.hexagon":"Hexagon","shape.parallelogram":"Parallelogram","shape.trapezoid":"Trapezoid","shape.pentagon":"Pentagon","shape.octagon":"Octagon","shape.star":"Star","shape.uml-class":"Class","shape.uml-interface":"Interface","uml.drag":"Drag to reorder","uml.delete":"Delete row","uml.textColor":"Text color","uml.defaultColor":"Default color","uml.fontSize":"Font size","uml.strikethrough":"Strikethrough","uml.attribute":"Attributes","uml.method":"Methods","minimap.title":"Minimap","minimap.expand":"Expand minimap","minimap.collapse":"Collapse minimap","tool.mind-map":"Mind map","toolbar.mind-map":"Mind map","toolbar.export":"Export","toolbar.export.png":"PNG image","toolbar.export.svg":"SVG vector","toolbar.export.pdf":"PDF document","toolbar.export.data":"Export data","toolbar.import.data":"Import data","import.success":"Import succeeded: {n} shapes restored","import.fail":"Import failed: invalid file format","shape.mind-map":"Mind map","mindmap.defaultRoot":"Central topic","mindmap.defaultBranch":"Branch topic","mindmap.nodeText":"Node text","mindmap.addChild":"Child","mindmap.addSibling":"Sibling","mindmap.deleteNode":"Delete node","mindmap.color":"Color","mindmap.levelColor":"Default level color","mindmap.icon":"Icon","mindmap.noIcon":"No icon","mindmap.note":"Note","mindmap.notePlaceholder":"Note content (optional)","mindmap.noteColor":"Note color","mindmap.noteColorDefault":"Same as node","mindmap.collapse":"Collapse","mindmap.expand":"Expand","mindmap.close":"Close editor","mindmap.more":"More settings","mindmap.level":"Level","mindmap.promote1":"Promote","mindmap.promote2":"Promote 2","mindmap.promoteDisabled":"Already at top","tool.table":"Table","toolbar.table":"Table","shape.table":"Table","table.insertRow":"Insert row","table.deleteRow":"Delete row","table.insertCol":"Insert column","table.deleteCol":"Delete column","table.merge":"Merge cells","table.split":"Split cell","table.insertRowAbove":"Insert row above","table.insertRowBelow":"Insert row below","table.insertColLeft":"Insert column left","table.insertColRight":"Insert column right","table.pickHint":"Drag to pick size","ctx.copy":"Copy","ctx.paste":"Paste","ctx.duplicate":"Duplicate","ctx.layer":"Layer","ctx.bringToFront":"Bring to front","ctx.bringForward":"Bring forward","ctx.sendBackward":"Send backward","ctx.sendToBack":"Send to back","ctx.copyStyle":"Copy style","ctx.pasteStyle":"Paste style","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"Rotate","ctx.group":"Group","ctx.ungroup":"Ungroup","ctx.lock":"Lock","ctx.unlock":"Unlock","ctx.unlockAll":"Unlock all","ctx.delete":"Delete","toolbar.icon":"Icons (S)","toolbar.template":"Templates","template.search":"Search templates","template.all":"All","template.empty":"No matching template","toolbar.image":"Image","toolbar.more":"More","toolbar.pageTheme":"Page theme","pageTheme.light":"Default","pageTheme.warm":"Warm","pageTheme.gray":"Light gray","pageTheme.purple":"Light purple","pageTheme.green":"Light green","pageTheme.eye-care":"Eye care","tool.image":"Image","image.uploadFailed":"Image upload failed","image.insertFailed":"Failed to insert image","image.tooLarge":"Image exceeds the 30 MB upload limit","image.temporaryInserted":"Temporary image inserted (no upload endpoint configured, it will be lost on refresh)","image.naturalSize":"Original size","icon.search":"Search icons","icon.empty":"No matching icons","icon.recent":"Recent","iconCat.status":"Status","iconCat.number":"Number badges","iconCat.tech":"Cloud & tech","iconCat.chart":"Charts","iconCat.office":"Documents","iconCat.media":"Media & collab","iconCat.arrow":"Arrows","iconCat.misc":"Essentials","iconCat.emoji":"Emoji","iconCat.sticker":"Stickers","iconCat.device":"Devices","iconCat.weather":"Weather","iconCat.transport":"Transport","iconCat.nature":"Nature","iconCat.building":"Building","iconCat.medical":"Medical","iconCat.shopping":"Shopping","iconCat.science":"Science","iconCat.animal":"Animal","iconCat.time":"Time","iconCat.edit":"Editing","iconCat.food":"Food","iconCat.communication":"Communication"},"ja-JP":{"save.success":"\u4FDD\u5B58\u3057\u307E\u3057\u305F","save.fail":"\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F","tool.select":"\u9078\u629E\u30C4\u30FC\u30EB","tool.hand":"\u30AD\u30E3\u30F3\u30D0\u30B9\u3092\u79FB\u52D5","tool.rectangle":"\u56DB\u89D2\u5F62","tool.rounded-rectangle":"\u89D2\u4E38\u56DB\u89D2\u5F62","tool.circle":"\u5186","tool.ellipse":"\u6955\u5186","tool.diamond":"\u3072\u3057\u5F62","tool.triangle":"\u4E09\u89D2\u5F62","tool.hexagon":"\u516D\u89D2\u5F62","tool.parallelogram":"\u5E73\u884C\u56DB\u8FBA\u5F62","tool.trapezoid":"\u53F0\u5F62","tool.pentagon":"\u4E94\u89D2\u5F62","tool.octagon":"\u516B\u89D2\u5F62","tool.star":"\u661F\u5F62","tool.cylinder":"\u5186\u67F1","tool.cloud":"\u96F2","tool.heart":"\u30CF\u30FC\u30C8","tool.block-arrow-right":"\u53F3\u77E2\u5370","tool.block-arrow-left":"\u5DE6\u77E2\u5370","tool.block-arrow-up":"\u4E0A\u77E2\u5370","tool.block-arrow-down":"\u4E0B\u77E2\u5370","tool.block-arrow-double":"\u53CC\u65B9\u5411\u77E2\u5370","tool.right-triangle":"\u76F4\u89D2\u4E09\u89D2\u5F62","tool.cross":"\u5341\u5B57","tool.speech-rect":"\u56DB\u89D2\u3044\u5439\u304D\u51FA\u3057","tool.speech-round":"\u4E38\u3044\u5439\u304D\u51FA\u3057","tool.cube":"\u7ACB\u65B9\u4F53","tool.sector":"\u6247\u5F62","tool.delay":"D \u5B57","tool.predefined-process":"\u5B9A\u7FA9\u6E08\u307F\u51E6\u7406","tool.document":"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","tool.stadium":"\u4E21\u7AEF\u304C\u4E38\u3044\u9577\u65B9\u5F62","tool.class-catalog":"\u30AB\u30C6\u30B4\u30EA","tool.envelope":"\u5C01\u7B52","tool.checkbox":"\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9","tool.sticky-note":"\u4ED8\u7B8B","shape.sticky-note":"\u4ED8\u7B8B","tool.triangular-pyramid":"\u4E09\u89D2\u9310","tool.quadrangular-pyramid":"\u56DB\u89D2\u9310","tool.cuboid":"\u76F4\u65B9\u4F53","tool.sphere":"\u7403","tool.ellipsoid":"\u6955\u5186\u4F53","tool.pie":"\u5186\u30B0\u30E9\u30D5","tool.hollow-pie":"\u30C9\u30FC\u30CA\u30C4","class.plain":"\u30AF\u30E9\u30B9","flow.process":"\u51E6\u7406","flow.step":"\u30B9\u30C6\u30C3\u30D7","flow.startEnd":"\u958B\u59CB/\u7D42\u4E86","flow.decision":"\u5224\u65AD","flow.data":"\u30C7\u30FC\u30BF","flow.manual":"\u624B\u52D5\u64CD\u4F5C","flow.preparation":"\u6E96\u5099","flow.database":"\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9","flow.delay":"\u9045\u5EF6","shapeGroup.basic":"\u57FA\u672C","shapeGroup.flowchart":"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8","shapeGroup.other":"\u305D\u306E\u4ED6","shapeGroup.solid":"\u7ACB\u4F53","shapeGroup.uml":"\u30AF\u30E9\u30B9\u56F3","shapeMenu.hint":"\u30DB\u30D0\u30FC\u3067\u540D\u524D\u3092\u8868\u793A","tool.chevron":"\u5C71\u5F62","tool.brace-left":"\u5DE6\u4E2D\u62EC\u5F27","tool.brace-right":"\u53F3\u4E2D\u62EC\u5F27","tool.uml-class":"UML \u30AF\u30E9\u30B9\u56F3","tool.uml-interface":"UML \u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30FC\u30B9","tool.line":"\u76F4\u7DDA","tool.arrow":"\u7DDA","tool.text":"\u30C6\u30AD\u30B9\u30C8","tool.draw":"\u30DA\u30F3","tool.pen":"\u30DA\u30F3","tool.highlighter":"\u86CD\u5149\u30DA\u30F3","tool.eraser":"\u6D88\u3057\u30B4\u30E0","status.none":"\u672A\u9078\u629E","status.selected":"{n} \u500B\u306E\u56F3\u5F62\u3092\u9078\u629E\u4E2D","toolbar.select":"\u9078\u629E (V)","toolbar.hand":"\u30AD\u30E3\u30F3\u30D0\u30B9\u3092\u79FB\u52D5 (H)","toolbar.shapes":"\u56F3\u5F62","toolbar.grid":"\u30B0\u30EA\u30C3\u30C9","toolbar.undo":"\u5143\u306B\u623B\u3059 (Ctrl+Z)","toolbar.redo":"\u3084\u308A\u76F4\u3059 (Ctrl+Shift+Z)","toolbar.arrow":"\u77E2\u5370 (A)","toolbar.text":"\u30C6\u30AD\u30B9\u30C8 (T)","toolbar.pen":"\u30DA\u30F3","toolbar.highlighter":"\u86CD\u5149\u30DA\u30F3","toolbar.eraser":"\u6D88\u3057\u30B4\u30E0 (E)","toolbar.uml-class":"UML \u30AF\u30E9\u30B9\u56F3","toolbar.uml-interface":"UML \u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30FC\u30B9","zoom.in":"\u62E1\u5927","zoom.out":"\u7E2E\u5C0F","zoom.reset":"\u30EA\u30BB\u30C3\u30C8","style.stroke":"\u67A0\u7DDA","style.line":"\u7DDA","style.fill":"\u5857\u308A","style.text":"\u30C6\u30AD\u30B9\u30C8","style.highlight":"\u30CF\u30A4\u30E9\u30A4\u30C8","style.prefix":"\u63A5\u982D\u8A18\u53F7","style.prefix.soon":"\u63A5\u982D\u8A18\u53F7\u306F\u958B\u767A\u4E2D\u3067\u3059\u3002\u3057\u3070\u3089\u304F\u304A\u5F85\u3061\u304F\u3060\u3055\u3044","style.none":"\u306A\u3057","style.addColor":"\u8272\u3092\u8FFD\u52A0","style.connection":"\u63A5\u7D9A","style.arrow":"\u77E2\u5370","style.dashed":"\u7834\u7DDA","style.solid":"\u5B9F\u7DDA","style.opacity":"\u4E0D\u900F\u660E\u5EA6","style.connection.straight":"\u76F4\u7DDA","style.connection.polyline":"\u89D2\u4E38\u6298\u308C\u7DDA","style.connection.orthogonal":"\u76F4\u89D2\u6298\u308C\u7DDA","style.connection.curve":"\u66F2\u7DDA","style.arrowhead.none":"\u77E2\u5370\u306A\u3057","style.arrowhead.end":"\u7D42\u70B9\u306E\u77E2\u5370","style.arrowhead.start":"\u59CB\u70B9\u306E\u77E2\u5370","style.arrowhead.both":"\u4E21\u7AEF\u306E\u77E2\u5370","style.arrowhead.none-dashed":"\u77E2\u5370\u306A\u3057\u306E\u7834\u7DDA","style.arrowhead.both-dashed":"\u4E21\u7AEF\u77E2\u5370\u306E\u7834\u7DDA","style.uml":"UML","style.arrowhead.inheritance":"\u7D99\u627F","style.arrowhead.composition":"\u30B3\u30F3\u30DD\u30B8\u30B7\u30E7\u30F3","style.arrowhead.aggregation":"\u96C6\u7D04","style.arrowhead.dependency":"\u4F9D\u5B58","style.arrowhead.realization":"\u5B9F\u73FE","menu.title":"\u65B0\u3057\u3044\u56F3\u5F62\u3092\u9078\u629E","menu.cancel":"\u7A7A\u767D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30AD\u30E3\u30F3\u30BB\u30EB","shape.rectangle":"\u56DB\u89D2\u5F62","shape.rounded-rectangle":"\u89D2\u4E38","shape.circle":"\u5186","shape.ellipse":"\u6955\u5186","shape.diamond":"\u3072\u3057\u5F62","shape.triangle":"\u4E09\u89D2","shape.hexagon":"\u516D\u89D2\u5F62","shape.parallelogram":"\u5E73\u884C","shape.trapezoid":"\u53F0\u5F62","shape.pentagon":"\u4E94\u89D2\u5F62","shape.octagon":"\u516B\u89D2\u5F62","shape.star":"\u661F\u5F62","shape.uml-class":"\u30AF\u30E9\u30B9\u56F3","shape.uml-interface":"\u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30FC\u30B9","uml.drag":"\u30C9\u30E9\u30C3\u30B0\u3067\u4E26\u3079\u66FF\u3048","uml.delete":"\u3053\u306E\u884C\u3092\u524A\u9664","uml.textColor":"\u6587\u5B57\u8272","uml.defaultColor":"\u65E2\u5B9A\u306E\u8272","uml.fontSize":"\u6587\u5B57\u30B5\u30A4\u30BA","uml.strikethrough":"\u53D6\u308A\u6D88\u3057\u7DDA","uml.attribute":"\u5C5E\u6027","uml.method":"\u30E1\u30BD\u30C3\u30C9","minimap.title":"\u30DF\u30CB\u30DE\u30C3\u30D7","minimap.expand":"\u30DF\u30CB\u30DE\u30C3\u30D7\u3092\u5C55\u958B","minimap.collapse":"\u30DF\u30CB\u30DE\u30C3\u30D7\u3092\u6298\u308A\u305F\u305F\u3080","tool.mind-map":"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7","toolbar.mind-map":"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7","toolbar.export":"\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8","toolbar.export.png":"PNG \u753B\u50CF","toolbar.export.svg":"SVG \u30D9\u30AF\u30BF\u30FC","toolbar.export.pdf":"PDF \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","toolbar.export.data":"\u30C7\u30FC\u30BF\u3092\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8","toolbar.import.data":"\u30C7\u30FC\u30BF\u3092\u30A4\u30F3\u30DD\u30FC\u30C8","import.success":"\u30A4\u30F3\u30DD\u30FC\u30C8\u6210\u529F\uFF1A{n} \u500B\u306E\u56F3\u5F62\u3092\u5FA9\u5143\u3057\u307E\u3057\u305F","import.fail":"\u30A4\u30F3\u30DD\u30FC\u30C8\u5931\u6557\uFF1A\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093","shape.mind-map":"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7","mindmap.defaultRoot":"\u4E2D\u5FC3\u30C8\u30D4\u30C3\u30AF","mindmap.defaultBranch":"\u30D6\u30E9\u30F3\u30C1\u30C8\u30D4\u30C3\u30AF","mindmap.nodeText":"\u30CE\u30FC\u30C9\u306E\u30C6\u30AD\u30B9\u30C8","mindmap.addChild":"\u5B50\u30CE\u30FC\u30C9","mindmap.addSibling":"\u5144\u5F1F\u30CE\u30FC\u30C9","mindmap.deleteNode":"\u30CE\u30FC\u30C9\u3092\u524A\u9664","mindmap.color":"\u8272","mindmap.levelColor":"\u65E2\u5B9A\u306E\u968E\u5C64\u8272","mindmap.icon":"\u30A2\u30A4\u30B3\u30F3","mindmap.noIcon":"\u30A2\u30A4\u30B3\u30F3\u306A\u3057","mindmap.note":"\u88DC\u8DB3\u8AAC\u660E","mindmap.notePlaceholder":"\u8AAC\u660E\uFF08\u4EFB\u610F\uFF09","mindmap.noteColor":"\u8AAC\u660E\u306E\u8272","mindmap.noteColorDefault":"\u30CE\u30FC\u30C9\u3068\u540C\u3058","mindmap.collapse":"\u6298\u308A\u305F\u305F\u3080","mindmap.expand":"\u5C55\u958B","mindmap.close":"\u7DE8\u96C6\u3092\u9589\u3058\u308B","mindmap.more":"\u8A73\u7D30\u8A2D\u5B9A","mindmap.level":"Level","mindmap.promote1":"Promote","mindmap.promote2":"Promote 2","mindmap.promoteDisabled":"Already at top","tool.table":"\u30C6\u30FC\u30D6\u30EB","toolbar.table":"\u30C6\u30FC\u30D6\u30EB","shape.table":"\u30C6\u30FC\u30D6\u30EB","table.insertRow":"\u884C\u3092\u633F\u5165","table.deleteRow":"\u884C\u3092\u524A\u9664","table.insertCol":"\u5217\u3092\u633F\u5165","table.deleteCol":"\u5217\u3092\u524A\u9664","table.merge":"\u30BB\u30EB\u3092\u7D50\u5408","table.split":"\u30BB\u30EB\u3092\u5206\u5272","table.insertRowAbove":"\u4E0A\u306B\u884C\u3092\u633F\u5165","table.insertRowBelow":"\u4E0B\u306B\u884C\u3092\u633F\u5165","table.insertColLeft":"\u5DE6\u306B\u5217\u3092\u633F\u5165","table.insertColRight":"\u53F3\u306B\u5217\u3092\u633F\u5165","table.pickHint":"\u884C\u6570\u30FB\u5217\u6570\u3092\u9078\u629E","ctx.copy":"\u30B3\u30D4\u30FC","ctx.paste":"\u8CBC\u308A\u4ED8\u3051","ctx.duplicate":"\u8907\u88FD\u3092\u4F5C\u6210","ctx.layer":"\u30EC\u30A4\u30E4\u30FC","ctx.bringToFront":"\u6700\u524D\u9762\u3078","ctx.bringForward":"\u4E00\u3064\u524D\u3078","ctx.sendBackward":"\u4E00\u3064\u5F8C\u308D\u3078","ctx.sendToBack":"\u6700\u80CC\u9762\u3078","ctx.copyStyle":"\u30B9\u30BF\u30A4\u30EB\u3092\u30B3\u30D4\u30FC","ctx.pasteStyle":"\u30B9\u30BF\u30A4\u30EB\u3092\u8CBC\u308A\u4ED8\u3051","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"\u56DE\u8EE2","ctx.group":"\u30B0\u30EB\u30FC\u30D7\u5316","ctx.ungroup":"\u30B0\u30EB\u30FC\u30D7\u89E3\u9664","ctx.lock":"\u30ED\u30C3\u30AF","ctx.unlock":"\u30ED\u30C3\u30AF\u89E3\u9664","ctx.unlockAll":"\u3059\u3079\u3066\u30ED\u30C3\u30AF\u89E3\u9664","ctx.delete":"\u524A\u9664","toolbar.icon":"\u30A2\u30A4\u30B3\u30F3 (S)","toolbar.template":"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8","template.search":"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u691C\u7D22","template.all":"\u3059\u3079\u3066","template.empty":"\u4E00\u81F4\u3059\u308B\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u304C\u3042\u308A\u307E\u305B\u3093","toolbar.image":"\u753B\u50CF","toolbar.more":"\u305D\u306E\u4ED6","toolbar.pageTheme":"\u30DA\u30FC\u30B8\u30C6\u30FC\u30DE","pageTheme.light":"\u30C7\u30D5\u30A9\u30EB\u30C8","pageTheme.warm":"\u30A6\u30A9\u30FC\u30E0","pageTheme.gray":"\u30E9\u30A4\u30C8\u30B0\u30EC\u30FC","pageTheme.purple":"\u30E9\u30A4\u30C8\u30D1\u30FC\u30D7\u30EB","pageTheme.green":"\u30E9\u30A4\u30C8\u30B0\u30EA\u30FC\u30F3","pageTheme.eye-care":"\u30A2\u30A4\u30B1\u30A2","tool.image":"\u753B\u50CF","image.uploadFailed":"\u753B\u50CF\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F","image.insertFailed":"\u753B\u50CF\u306E\u633F\u5165\u306B\u5931\u6557\u3057\u307E\u3057\u305F","image.tooLarge":"\u753B\u50CF\u304C 30 MB \u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093","image.temporaryInserted":"\u4E00\u6642\u753B\u50CF\u3092\u633F\u5165\u3057\u307E\u3057\u305F\uFF08\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5148\u304C\u672A\u8A2D\u5B9A\u306E\u305F\u3081\u3001\u518D\u8AAD\u307F\u8FBC\u307F\u3067\u5931\u308F\u308C\u307E\u3059\uFF09","image.naturalSize":"\u5143\u306E\u30B5\u30A4\u30BA","icon.search":"\u30A2\u30A4\u30B3\u30F3\u3092\u691C\u7D22","icon.empty":"\u4E00\u81F4\u3059\u308B\u30A2\u30A4\u30B3\u30F3\u304C\u3042\u308A\u307E\u305B\u3093","icon.recent":"\u6700\u8FD1\u4F7F\u3063\u305F\u3082\u306E","iconCat.status":"\u30B9\u30C6\u30FC\u30BF\u30B9","iconCat.number":"\u6570\u5B57\u30D0\u30C3\u30B8","iconCat.tech":"\u30AF\u30E9\u30A6\u30C9\u3068\u6280\u8853","iconCat.chart":"\u30B0\u30E9\u30D5","iconCat.office":"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","iconCat.media":"\u30E1\u30C7\u30A3\u30A2\u3068\u5171\u540C\u4F5C\u696D","iconCat.arrow":"\u77E2\u5370","iconCat.misc":"\u3088\u304F\u4F7F\u3046","iconCat.emoji":"\u7D75\u6587\u5B57","iconCat.sticker":"\u30B9\u30C6\u30C3\u30AB\u30FC","iconCat.device":"\u30C7\u30D0\u30A4\u30B9","iconCat.weather":"\u5929\u6C17","iconCat.transport":"\u4EA4\u901A","iconCat.nature":"\u81EA\u7136","iconCat.building":"\u5EFA\u7269","iconCat.medical":"\u533B\u7642","iconCat.shopping":"\u30B7\u30E7\u30C3\u30D4\u30F3\u30B0","iconCat.science":"\u30B5\u30A4\u30A8\u30F3\u30B9","iconCat.animal":"\u52D5\u7269","iconCat.time":"\u6642\u9593","iconCat.edit":"\u7DE8\u96C6","iconCat.food":"\u98DF\u3079\u7269","iconCat.communication":"\u901A\u4FE1"},"ko-KR":{"save.success":"\uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4","save.fail":"\uC800\uC7A5 \uC2E4\uD328","tool.select":"\uC120\uD0DD \uB3C4\uAD6C","tool.hand":"\uD654\uBA74 \uC774\uB3D9","tool.rectangle":"\uC0AC\uAC01\uD615","tool.rounded-rectangle":"\uB465\uADFC \uC0AC\uAC01\uD615","tool.circle":"\uC6D0","tool.ellipse":"\uD0C0\uC6D0","tool.diamond":"\uB2E4\uC774\uC544\uBAAC\uB4DC","tool.triangle":"\uC0BC\uAC01\uD615","tool.hexagon":"\uC721\uAC01\uD615","tool.parallelogram":"\uD3C9\uD589\uC0AC\uBCC0\uD615","tool.trapezoid":"\uC0AC\uB2E4\uB9AC\uAF34","tool.pentagon":"\uC624\uAC01\uD615","tool.octagon":"\uD314\uAC01\uD615","tool.star":"\uBCC4","tool.cylinder":"\uC6D0\uAE30\uB465","tool.cloud":"\uAD6C\uB984","tool.heart":"\uD558\uD2B8","tool.block-arrow-right":"\uC624\uB978\uCABD \uD654\uC0B4\uD45C","tool.block-arrow-left":"\uC67C\uCABD \uD654\uC0B4\uD45C","tool.block-arrow-up":"\uC704\uCABD \uD654\uC0B4\uD45C","tool.block-arrow-down":"\uC544\uB798\uCABD \uD654\uC0B4\uD45C","tool.block-arrow-double":"\uC591\uBC29\uD5A5 \uD654\uC0B4\uD45C","tool.right-triangle":"\uC9C1\uAC01\uC0BC\uAC01\uD615","tool.cross":"\uC2ED\uC790","tool.speech-rect":"\uC0AC\uAC01\uD615 \uB9D0\uD48D\uC120","tool.speech-round":"\uC6D0\uD615 \uB9D0\uD48D\uC120","tool.cube":"\uC815\uC721\uBA74\uCCB4","tool.sector":"\uBD80\uCC44\uAF34","tool.delay":"D \uC790","tool.predefined-process":"\uC0AC\uC804 \uC815\uC758 \uD504\uB85C\uC138\uC2A4","tool.document":"\uBB38\uC11C","tool.stadium":"\uC591\uB05D\uC774 \uB465\uADFC \uC0AC\uAC01\uD615","tool.class-catalog":"\uCE74\uD14C\uACE0\uB9AC","tool.envelope":"\uBD09\uD22C","tool.checkbox":"\uCCB4\uD06C\uBC15\uC2A4","tool.sticky-note":"\uC2A4\uD2F0\uD0A4 \uB178\uD2B8","shape.sticky-note":"\uC2A4\uD2F0\uD0A4 \uB178\uD2B8","tool.triangular-pyramid":"\uC0BC\uAC01\uBFD4","tool.quadrangular-pyramid":"\uC0AC\uAC01\uBFD4","tool.cuboid":"\uC9C1\uC721\uBA74\uCCB4","tool.sphere":"\uAD6C","tool.ellipsoid":"\uD0C0\uC6D0\uCCB4","tool.pie":"\uD30C\uC774","tool.hollow-pie":"\uB3C4\uB11B","class.plain":"\uD074\uB798\uC2A4","flow.process":"\uCC98\uB9AC","flow.step":"\uB2E8\uACC4","flow.startEnd":"\uC2DC\uC791/\uC885\uB8CC","flow.decision":"\uD310\uB2E8","flow.data":"\uB370\uC774\uD130","flow.manual":"\uC218\uB3D9 \uC791\uC5C5","flow.preparation":"\uC900\uBE44","flow.database":"\uB370\uC774\uD130\uBCA0\uC774\uC2A4","flow.delay":"\uC9C0\uC5F0","shapeGroup.basic":"\uAE30\uBCF8","shapeGroup.flowchart":"\uC21C\uC11C\uB3C4","shapeGroup.other":"\uAE30\uD0C0","shapeGroup.solid":"\uC785\uCCB4","shapeGroup.uml":"\uD074\uB798\uC2A4 \uB2E4\uC774\uC5B4\uADF8\uB7A8","shapeMenu.hint":"\uB9C8\uC6B0\uC2A4\uB97C \uC62C\uB824 \uC774\uB984 \uD655\uC778","tool.chevron":"\uAEBE\uC1E0","tool.brace-left":"\uC67C\uCABD \uC911\uAD04\uD638","tool.brace-right":"\uC624\uB978\uCABD \uC911\uAD04\uD638","tool.uml-class":"UML \uD074\uB798\uC2A4","tool.uml-interface":"UML \uC778\uD130\uD398\uC774\uC2A4","tool.line":"\uC9C1\uC120","tool.arrow":"\uC120","tool.text":"\uD14D\uC2A4\uD2B8","tool.draw":"\uD39C","tool.pen":"\uD39C","tool.highlighter":"\uD615\uAD11\uD39C","tool.eraser":"\uC9C0\uC6B0\uAC1C","status.none":"\uC120\uD0DD \uC5C6\uC74C","status.selected":"\uB3C4\uD615 {n}\uAC1C \uC120\uD0DD\uB428","toolbar.select":"\uC120\uD0DD (V)","toolbar.hand":"\uD654\uBA74 \uC774\uB3D9 (H)","toolbar.shapes":"\uB3C4\uD615","toolbar.grid":"\uADF8\uB9AC\uB4DC","toolbar.undo":"\uC2E4\uD589 \uCDE8\uC18C (Ctrl+Z)","toolbar.redo":"\uB2E4\uC2DC \uC2E4\uD589 (Ctrl+Shift+Z)","toolbar.arrow":"\uD654\uC0B4\uD45C (A)","toolbar.text":"\uD14D\uC2A4\uD2B8 (T)","toolbar.pen":"\uD39C","toolbar.highlighter":"\uD615\uAD11\uD39C","toolbar.eraser":"\uC9C0\uC6B0\uAC1C (E)","toolbar.uml-class":"UML \uD074\uB798\uC2A4","toolbar.uml-interface":"UML \uC778\uD130\uD398\uC774\uC2A4","zoom.in":"\uD655\uB300","zoom.out":"\uCD95\uC18C","zoom.reset":"\uCD08\uAE30\uD654","style.stroke":"\uD14C\uB450\uB9AC","style.line":"\uC120","style.fill":"\uCC44\uC6B0\uAE30","style.text":"\uD14D\uC2A4\uD2B8","style.highlight":"\uD615\uAD11","style.prefix":"\uC811\uB450 \uAE30\uD638","style.prefix.soon":"\uC811\uB450 \uAE30\uD638\uB294 \uC900\uBE44 \uC911\uC785\uB2C8\uB2E4","style.none":"\uC5C6\uC74C","style.addColor":"\uC0C9\uC0C1 \uCD94\uAC00","style.connection":"\uC5F0\uACB0","style.arrow":"\uD654\uC0B4\uD45C","style.dashed":"\uC810\uC120","style.solid":"\uC2E4\uC120","style.opacity":"\uBD88\uD22C\uBA85\uB3C4","style.connection.straight":"\uC9C1\uC120","style.connection.polyline":"\uB465\uADFC \uAEBE\uC740\uC120","style.connection.orthogonal":"\uC9C1\uAC01 \uAEBE\uC740\uC120","style.connection.curve":"\uACE1\uC120","style.arrowhead.none":"\uD654\uC0B4\uD45C \uC5C6\uC74C","style.arrowhead.end":"\uB05D \uD654\uC0B4\uD45C","style.arrowhead.start":"\uC2DC\uC791 \uD654\uC0B4\uD45C","style.arrowhead.both":"\uC591\uBC29\uD5A5 \uD654\uC0B4\uD45C","style.arrowhead.none-dashed":"\uD654\uC0B4\uD45C \uC5C6\uB294 \uC810\uC120","style.arrowhead.both-dashed":"\uC591\uBC29\uD5A5 \uD654\uC0B4\uD45C \uC810\uC120","style.uml":"UML","style.arrowhead.inheritance":"\uC0C1\uC18D","style.arrowhead.composition":"\uD569\uC131","style.arrowhead.aggregation":"\uC9D1\uD569","style.arrowhead.dependency":"\uC758\uC874","style.arrowhead.realization":"\uC2E4\uD604","menu.title":"\uC0C8 \uB3C4\uD615 \uC120\uD0DD","menu.cancel":"\uBE48 \uACF3\uC744 \uD074\uB9AD\uD574 \uCDE8\uC18C","shape.rectangle":"\uC0AC\uAC01\uD615","shape.rounded-rectangle":"\uB465\uADFC","shape.circle":"\uC6D0","shape.ellipse":"\uD0C0\uC6D0","shape.diamond":"\uB2E4\uC774\uC544\uBAAC\uB4DC","shape.triangle":"\uC0BC\uAC01","shape.hexagon":"\uC721\uAC01\uD615","shape.parallelogram":"\uD3C9\uD589","shape.trapezoid":"\uC0AC\uB2E4\uB9AC\uAF34","shape.pentagon":"\uC624\uAC01\uD615","shape.octagon":"\uD314\uAC01\uD615","shape.star":"\uBCC4","shape.uml-class":"\uD074\uB798\uC2A4","shape.uml-interface":"\uC778\uD130\uD398\uC774\uC2A4","uml.drag":"\uB4DC\uB798\uADF8\uD558\uC5EC \uC815\uB82C","uml.delete":"\uC774 \uD589 \uC0AD\uC81C","uml.textColor":"\uAE00\uC790\uC0C9","uml.defaultColor":"\uAE30\uBCF8 \uC0C9\uC0C1","uml.fontSize":"\uAE00\uC790 \uD06C\uAE30","uml.strikethrough":"\uCDE8\uC18C\uC120","uml.attribute":"\uC18D\uC131","uml.method":"\uBA54\uC11C\uB4DC","minimap.title":"\uBBF8\uB2C8\uB9F5","minimap.expand":"\uBBF8\uB2C8\uB9F5 \uD3BC\uCE58\uAE30","minimap.collapse":"\uBBF8\uB2C8\uB9F5 \uC811\uAE30","tool.mind-map":"\uB9C8\uC778\uB4DC\uB9F5","toolbar.mind-map":"\uB9C8\uC778\uB4DC\uB9F5","toolbar.export":"\uB0B4\uBCF4\uB0B4\uAE30","toolbar.export.png":"PNG \uC774\uBBF8\uC9C0","toolbar.export.svg":"SVG \uBCA1\uD130","toolbar.export.pdf":"PDF \uBB38\uC11C","toolbar.export.data":"\uB370\uC774\uD130 \uB0B4\uBCF4\uB0B4\uAE30","toolbar.import.data":"\uB370\uC774\uD130 \uAC00\uC838\uC624\uAE30","import.success":"\uAC00\uC838\uC624\uAE30 \uC131\uACF5: \uB3C4\uD615 {n}\uAC1C \uBCF5\uC6D0\uB428","import.fail":"\uAC00\uC838\uC624\uAE30 \uC2E4\uD328: \uD30C\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4","shape.mind-map":"\uB9C8\uC778\uB4DC\uB9F5","mindmap.defaultRoot":"\uC911\uC2EC \uC8FC\uC81C","mindmap.defaultBranch":"\uBD84\uAE30 \uC8FC\uC81C","mindmap.nodeText":"\uB178\uB4DC \uD14D\uC2A4\uD2B8","mindmap.addChild":"\uD558\uC704 \uB178\uB4DC","mindmap.addSibling":"\uD615\uC81C \uB178\uB4DC","mindmap.deleteNode":"\uB178\uB4DC \uC0AD\uC81C","mindmap.color":"\uC0C9\uC0C1","mindmap.levelColor":"\uAE30\uBCF8 \uB2E8\uACC4 \uC0C9\uC0C1","mindmap.icon":"\uC544\uC774\uCF58","mindmap.noIcon":"\uC544\uC774\uCF58 \uC5C6\uC74C","mindmap.note":"\uC18D\uC131 \uC124\uBA85","mindmap.notePlaceholder":"\uC124\uBA85 \uB0B4\uC6A9(\uC120\uD0DD)","mindmap.noteColor":"\uC124\uBA85 \uC0C9\uC0C1","mindmap.noteColorDefault":"\uB178\uB4DC\uC640 \uB3D9\uC77C","mindmap.collapse":"\uC811\uAE30","mindmap.expand":"\uD3BC\uCE58\uAE30","mindmap.close":"\uD3B8\uC9D1 \uB2EB\uAE30","mindmap.more":"\uCD94\uAC00 \uC124\uC815","mindmap.level":"Level","mindmap.promote1":"Promote","mindmap.promote2":"Promote 2","mindmap.promoteDisabled":"Already at top","tool.table":"\uD45C","toolbar.table":"\uD45C","shape.table":"\uD45C","table.insertRow":"\uD589 \uC0BD\uC785","table.deleteRow":"\uD589 \uC0AD\uC81C","table.insertCol":"\uC5F4 \uC0BD\uC785","table.deleteCol":"\uC5F4 \uC0AD\uC81C","table.merge":"\uC140 \uBCD1\uD569","table.split":"\uC140 \uBD84\uD560","table.insertRowAbove":"\uC704\uC5D0 \uD589 \uC0BD\uC785","table.insertRowBelow":"\uC544\uB798\uC5D0 \uD589 \uC0BD\uC785","table.insertColLeft":"\uC67C\uCABD\uC5D0 \uC5F4 \uC0BD\uC785","table.insertColRight":"\uC624\uB978\uCABD\uC5D0 \uC5F4 \uC0BD\uC785","table.pickHint":"\uD589\xB7\uC5F4 \uC218 \uC120\uD0DD","ctx.copy":"\uBCF5\uC0AC","ctx.paste":"\uBD99\uC5EC\uB123\uAE30","ctx.duplicate":"\uC0AC\uBCF8 \uB9CC\uB4E4\uAE30","ctx.layer":"\uB808\uC774\uC5B4","ctx.bringToFront":"\uB9E8 \uC55E\uC73C\uB85C","ctx.bringForward":"\uD55C \uCE78 \uC55E\uC73C\uB85C","ctx.sendBackward":"\uD55C \uCE78 \uB4A4\uB85C","ctx.sendToBack":"\uB9E8 \uB4A4\uB85C","ctx.copyStyle":"\uC2A4\uD0C0\uC77C \uBCF5\uC0AC","ctx.pasteStyle":"\uC2A4\uD0C0\uC77C \uBD99\uC5EC\uB123\uAE30","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"\uD68C\uC804","ctx.group":"\uADF8\uB8F9 \uB9CC\uB4E4\uAE30","ctx.ungroup":"\uADF8\uB8F9 \uD574\uC81C","ctx.lock":"\uC7A0\uAE08","ctx.unlock":"\uC7A0\uAE08 \uD574\uC81C","ctx.unlockAll":"\uBAA8\uB450 \uC7A0\uAE08 \uD574\uC81C","ctx.delete":"\uC0AD\uC81C","toolbar.icon":"\uC544\uC774\uCF58 (S)","toolbar.template":"\uD15C\uD50C\uB9BF","template.search":"\uD15C\uD50C\uB9BF \uAC80\uC0C9","template.all":"\uC804\uCCB4","template.empty":"\uC77C\uCE58\uD558\uB294 \uD15C\uD50C\uB9BF\uC774 \uC5C6\uC2B5\uB2C8\uB2E4","toolbar.image":"\uC774\uBBF8\uC9C0","toolbar.more":"\uB354\uBCF4\uAE30","toolbar.pageTheme":"\uD398\uC774\uC9C0 \uD14C\uB9C8","pageTheme.light":"\uAE30\uBCF8","pageTheme.warm":"\uB530\uB73B\uD55C","pageTheme.gray":"\uBC1D\uC740 \uD68C\uC0C9","pageTheme.purple":"\uBC1D\uC740 \uBCF5\uC22D\uC544","pageTheme.green":"\uBC1D\uC740 \uCD08\uB85D","pageTheme.eye-care":"\uB208 \uBCF4\uD638","tool.image":"\uC774\uBBF8\uC9C0","image.uploadFailed":"\uC774\uBBF8\uC9C0 \uC5C5\uB85C\uB4DC \uC2E4\uD328","image.insertFailed":"\uC774\uBBF8\uC9C0 \uC0BD\uC785 \uC2E4\uD328","image.tooLarge":"\uC774\uBBF8\uC9C0\uAC00 30 MB\uB97C \uCD08\uACFC\uD558\uC5EC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4","image.temporaryInserted":"\uC784\uC2DC \uC774\uBBF8\uC9C0\uB97C \uC0BD\uC785\uD588\uC2B5\uB2C8\uB2E4(\uC5C5\uB85C\uB4DC \uC8FC\uC18C\uAC00 \uC5C6\uC5B4 \uC0C8\uB85C\uACE0\uCE68\uD558\uBA74 \uC0AC\uB77C\uC9D1\uB2C8\uB2E4)","image.naturalSize":"\uC6D0\uBCF8 \uD06C\uAE30","icon.search":"\uC544\uC774\uCF58 \uAC80\uC0C9","icon.empty":"\uC77C\uCE58\uD558\uB294 \uC544\uC774\uCF58\uC774 \uC5C6\uC2B5\uB2C8\uB2E4","icon.recent":"\uCD5C\uADFC \uC0AC\uC6A9","iconCat.status":"\uC0C1\uD0DC \uD45C\uC2DC","iconCat.number":"\uC22B\uC790 \uBC30\uC9C0","iconCat.tech":"\uD074\uB77C\uC6B0\uB4DC\uC640 \uAE30\uC220","iconCat.chart":"\uCC28\uD2B8","iconCat.office":"\uBB38\uC11C","iconCat.media":"\uBBF8\uB514\uC5B4\uC640 \uD611\uC5C5","iconCat.arrow":"\uD654\uC0B4\uD45C","iconCat.misc":"\uC790\uC8FC \uC4F0\uB294","iconCat.emoji":"\uC774\uBAA8\uD2F0\uCF58","iconCat.sticker":"\uC2A4\uD2F0\uCEE4","iconCat.device":"\uAE30\uAE30","iconCat.weather":"\uB0A0\uC528","iconCat.transport":"\uAD50\uD1B5","iconCat.nature":"\uC790\uC5F0","iconCat.building":"\uAC74\uBB3C","iconCat.medical":"\uC758\uB8CC","iconCat.shopping":"\uC1FC\uD551","iconCat.science":"\uACFC\uD559","iconCat.animal":"\uB3D9\uBB3C","iconCat.time":"\uC2DC\uAC04","iconCat.edit":"\uD3B8\uC9D1","iconCat.food":"\uC74C\uC2DD","iconCat.communication":"\uD1B5\uC2E0"},"de-DE":{"save.success":"Gespeichert","save.fail":"Speichern fehlgeschlagen","tool.select":"Auswahlwerkzeug","tool.hand":"Ansicht verschieben","tool.rectangle":"Rechteck","tool.rounded-rectangle":"Abgerundetes Rechteck","tool.circle":"Kreis","tool.ellipse":"Ellipse","tool.diamond":"Raute","tool.triangle":"Dreieck","tool.hexagon":"Sechseck","tool.parallelogram":"Parallelogramm","tool.trapezoid":"Trapez","tool.pentagon":"F\xFCnfeck","tool.octagon":"Achteck","tool.star":"Stern","tool.cylinder":"Zylinder","tool.cloud":"Wolke","tool.heart":"Herz","tool.block-arrow-right":"Pfeil rechts","tool.block-arrow-left":"Pfeil links","tool.block-arrow-up":"Pfeil oben","tool.block-arrow-down":"Pfeil unten","tool.block-arrow-double":"Doppelpfeil","tool.right-triangle":"Rechtwinkliges Dreieck","tool.cross":"Kreuz","tool.speech-rect":"Eckige Sprechblase","tool.speech-round":"Runde Sprechblase","tool.cube":"W\xFCrfel","tool.sector":"Kreissektor","tool.delay":"D-Form","tool.predefined-process":"Vordefinierter Prozess","tool.document":"Dokument","tool.stadium":"Stadionform","tool.class-catalog":"Kategorie","tool.envelope":"Umschlag","tool.checkbox":"Kontrollk\xE4stchen","tool.sticky-note":"Haftnotiz","shape.sticky-note":"Haftnotiz","tool.triangular-pyramid":"Dreieckspyramide","tool.quadrangular-pyramid":"Viereckspyramide","tool.cuboid":"Quader","tool.sphere":"Kugel","tool.ellipsoid":"Ellipsoid","tool.pie":"Tortenst\xFCck","tool.hollow-pie":"Donut","class.plain":"Klasse","flow.process":"Prozess","flow.step":"Schritt","flow.startEnd":"Start / Ende","flow.decision":"Entscheidung","flow.data":"Daten","flow.manual":"Manueller Vorgang","flow.preparation":"Vorbereitung","flow.database":"Datenbank","flow.delay":"Verz\xF6gerung","shapeGroup.basic":"Basis","shapeGroup.flowchart":"Flussdiagramm","shapeGroup.other":"Sonstige","shapeGroup.solid":"3D","shapeGroup.uml":"Klassendiagramm","shapeMenu.hint":"Zum Anzeigen des Namens \xFCberfahren","tool.chevron":"Winkelform","tool.brace-left":"Linke Klammer","tool.brace-right":"Rechte Klammer","tool.uml-class":"UML-Klasse","tool.uml-interface":"UML-Schnittstelle","tool.line":"Linie","tool.arrow":"Linie","tool.text":"Text","tool.draw":"Stift","tool.pen":"Stift","tool.highlighter":"Textmarker","tool.eraser":"Radiergummi","status.none":"Nichts ausgew\xE4hlt","status.selected":"{n} Objekte ausgew\xE4hlt","toolbar.select":"Auswahl (V)","toolbar.hand":"Ansicht verschieben (H)","toolbar.shapes":"Formen","toolbar.grid":"Raster","toolbar.undo":"R\xFCckg\xE4ngig (Strg+Z)","toolbar.redo":"Wiederholen (Strg+Umschalt+Z)","toolbar.arrow":"Pfeil (A)","toolbar.text":"Text (T)","toolbar.pen":"Stift","toolbar.highlighter":"Textmarker","toolbar.eraser":"Radiergummi (E)","toolbar.uml-class":"UML-Klasse","toolbar.uml-interface":"UML-Schnittstelle","zoom.in":"Vergr\xF6\xDFern","zoom.out":"Verkleinern","zoom.reset":"Zur\xFCcksetzen","style.stroke":"Rahmen","style.line":"Linie","style.fill":"F\xFCllung","style.text":"Text","style.highlight":"Hervorhebung","style.prefix":"Pr\xE4fix","style.prefix.soon":"Pr\xE4fixsymbole folgen in K\xFCrze","style.none":"Keine","style.addColor":"Farbe hinzuf\xFCgen","style.connection":"Verbindung","style.arrow":"Pfeilspitze","style.dashed":"Gestrichelt","style.solid":"Durchgezogen","style.opacity":"Deckkraft","style.connection.straight":"Gerade","style.connection.polyline":"Abgerundete Polylinie","style.connection.orthogonal":"Rechtwinklig","style.connection.curve":"Kurve","style.arrowhead.none":"Keine","style.arrowhead.end":"Ende","style.arrowhead.start":"Start","style.arrowhead.both":"Beide","style.arrowhead.none-dashed":"Gestrichelt","style.arrowhead.both-dashed":"Gestrichelt beidseitig","style.uml":"UML","style.arrowhead.inheritance":"Vererbung","style.arrowhead.composition":"Komposition","style.arrowhead.aggregation":"Aggregation","style.arrowhead.dependency":"Abh\xE4ngigkeit","style.arrowhead.realization":"Realisierung","menu.title":"Neue Form w\xE4hlen","menu.cancel":"Zum Abbrechen ins Leere klicken","shape.rectangle":"Rechteck","shape.rounded-rectangle":"Abgerundet","shape.circle":"Kreis","shape.ellipse":"Ellipse","shape.diamond":"Raute","shape.triangle":"Dreieck","shape.hexagon":"Sechseck","shape.parallelogram":"Parallelogramm","shape.trapezoid":"Trapez","shape.pentagon":"F\xFCnfeck","shape.octagon":"Achteck","shape.star":"Stern","shape.uml-class":"Klasse","shape.uml-interface":"Schnittstelle","uml.drag":"Zum Sortieren ziehen","uml.delete":"Zeile l\xF6schen","uml.textColor":"Textfarbe","uml.defaultColor":"Standardfarbe","uml.fontSize":"Schriftgr\xF6\xDFe","uml.strikethrough":"Durchgestrichen","uml.attribute":"Attribute","uml.method":"Methoden","minimap.title":"Minikarte","minimap.expand":"Minikarte einblenden","minimap.collapse":"Minikarte ausblenden","tool.mind-map":"Mindmap","toolbar.mind-map":"Mindmap","toolbar.export":"Exportieren","toolbar.export.png":"PNG-Bild","toolbar.export.svg":"SVG-Vektor","toolbar.export.pdf":"PDF-Dokument","toolbar.export.data":"Daten exportieren","toolbar.import.data":"Daten importieren","import.success":"Import erfolgreich: {n} Formen wiederhergestellt","import.fail":"Import fehlgeschlagen: ung\xFCltiges Dateiformat","shape.mind-map":"Mindmap","mindmap.defaultRoot":"Zentrales Thema","mindmap.defaultBranch":"Unterthema","mindmap.nodeText":"Knotentext","mindmap.addChild":"Unterknoten","mindmap.addSibling":"Geschwisterknoten","mindmap.deleteNode":"Knoten l\xF6schen","mindmap.color":"Farbe","mindmap.levelColor":"Standard-Ebenenfarbe","mindmap.icon":"Symbol","mindmap.noIcon":"Kein Symbol","mindmap.note":"Notiz","mindmap.notePlaceholder":"Notizinhalt (optional)","mindmap.noteColor":"Notizfarbe","mindmap.noteColorDefault":"Wie Knoten","mindmap.collapse":"Einklappen","mindmap.expand":"Ausklappen","mindmap.close":"Editor schlie\xDFen","mindmap.more":"Weitere Einstellungen","mindmap.level":"Ebene","mindmap.promote1":"Ebene h\xF6her","mindmap.promote2":"2 Ebenen h\xF6her","mindmap.promoteDisabled":"Bereits oben","tool.table":"Tabelle","toolbar.table":"Tabelle","shape.table":"Tabelle","table.insertRow":"Zeile einf\xFCgen","table.deleteRow":"Zeile l\xF6schen","table.insertCol":"Spalte einf\xFCgen","table.deleteCol":"Spalte l\xF6schen","table.merge":"Zellen verbinden","table.split":"Zelle teilen","table.insertRowAbove":"Zeile dar\xFCber einf\xFCgen","table.insertRowBelow":"Zeile darunter einf\xFCgen","table.insertColLeft":"Spalte links einf\xFCgen","table.insertColRight":"Spalte rechts einf\xFCgen","table.pickHint":"Zeilen & Spalten w\xE4hlen","ctx.copy":"Kopieren","ctx.paste":"Einf\xFCgen","ctx.duplicate":"Duplizieren","ctx.layer":"Ebene","ctx.bringToFront":"Ganz nach vorn","ctx.bringForward":"Nach vorn","ctx.sendBackward":"Nach hint","ctx.sendToBack":"Ganz nach hint","ctx.copyStyle":"Stil kopieren","ctx.pasteStyle":"Stil einf\xFCgen","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"Drehen","ctx.group":"Gruppieren","ctx.ungroup":"Gruppierung aufheben","ctx.lock":"Sperren","ctx.unlock":"Entsperren","ctx.unlockAll":"Alle entsperren","ctx.delete":"L\xF6schen","toolbar.icon":"Symbole (S)","toolbar.template":"Vorlagen","template.search":"Vorlagen suchen","template.all":"Alle","template.empty":"Keine passende Vorlage","toolbar.image":"Bild","toolbar.more":"Mehr","toolbar.pageTheme":"Seitenthema","pageTheme.light":"Standard","pageTheme.warm":"Warm","pageTheme.gray":"Hellgrau","pageTheme.purple":"Helllila","pageTheme.green":"Hellgr\xFCn","pageTheme.eye-care":"Augenschonend","tool.image":"Bild","image.uploadFailed":"Bild-Upload fehlgeschlagen","image.insertFailed":"Bild konnte nicht eingef\xFCgt werden","image.tooLarge":"Bild \xFCberschreitet das Upload-Limit von 30 MB","image.temporaryInserted":"Tempor\xE4res Bild eingef\xFCgt (kein Upload-Endpunkt konfiguriert, geht beim Neuladen verloren)","image.naturalSize":"Originalgr\xF6\xDFe","icon.search":"Symbole suchen","icon.empty":"Keine passenden Symbole","icon.recent":"Zuletzt verwendet","iconCat.status":"Status","iconCat.number":"Zahlen-Badges","iconCat.tech":"Cloud & Technik","iconCat.chart":"Diagramme","iconCat.office":"Dokumente","iconCat.media":"Medien & Teamarbeit","iconCat.arrow":"Pfeile","iconCat.misc":"H\xE4ufig genutzt","iconCat.emoji":"Emotionen","iconCat.sticker":"Sticker","iconCat.device":"Ger\xE4te","iconCat.weather":"Wetter","iconCat.transport":"Verkehr","iconCat.nature":"Natur","iconCat.building":"Geb\xE4ude","iconCat.medical":"Medizin","iconCat.shopping":"Einkaufen","iconCat.science":"Wissenschaft","iconCat.animal":"Tier","iconCat.time":"Zeit","iconCat.edit":"Bearbeiten","iconCat.food":"Essen","iconCat.communication":"Kommunikation"},"fr-FR":{"save.success":"Enregistr\xE9","save.fail":"\xC9chec de l'enregistrement","tool.select":"Outil de s\xE9lection","tool.hand":"D\xE9placer la vue","tool.rectangle":"Rectangle","tool.rounded-rectangle":"Rectangle arrondi","tool.circle":"Cercle","tool.ellipse":"Ellipse","tool.diamond":"Losange","tool.triangle":"Triangle","tool.hexagon":"Hexagone","tool.parallelogram":"Parall\xE9logramme","tool.trapezoid":"Trap\xE8ze","tool.pentagon":"Pentagone","tool.octagon":"Octogone","tool.star":"\xC9toile","tool.cylinder":"Cylindre","tool.cloud":"Nuage","tool.heart":"C\u0153ur","tool.block-arrow-right":"Fl\xE8che droite","tool.block-arrow-left":"Fl\xE8che gauche","tool.block-arrow-up":"Fl\xE8che haut","tool.block-arrow-down":"Fl\xE8che bas","tool.block-arrow-double":"Double fl\xE8che","tool.right-triangle":"Triangle rectangle","tool.cross":"Croix","tool.speech-rect":"Bulle rectangulaire","tool.speech-round":"Bulle ronde","tool.cube":"Cube","tool.sector":"Secteur","tool.delay":"Forme D","tool.predefined-process":"Processus pr\xE9d\xE9fini","tool.document":"Document","tool.stadium":"Forme stade","tool.class-catalog":"Cat\xE9gorie","tool.envelope":"Enveloppe","tool.checkbox":"Case \xE0 cocher","tool.sticky-note":"Note adh\xE9sive","shape.sticky-note":"Note adh\xE9sive","tool.triangular-pyramid":"Pyramide triangulaire","tool.quadrangular-pyramid":"Pyramide \xE0 base carr\xE9e","tool.cuboid":"Pav\xE9 droit","tool.sphere":"Sph\xE8re","tool.ellipsoid":"Ellipso\xEFde","tool.pie":"Camembert","tool.hollow-pie":"Anneau","class.plain":"Classe","flow.process":"Traitement","flow.step":"\xC9tape","flow.startEnd":"D\xE9but / Fin","flow.decision":"D\xE9cision","flow.data":"Donn\xE9es","flow.manual":"Op\xE9ration manuelle","flow.preparation":"Pr\xE9paration","flow.database":"Base de donn\xE9es","flow.delay":"D\xE9lai","shapeGroup.basic":"De base","shapeGroup.flowchart":"Organigramme","shapeGroup.other":"Autres","shapeGroup.solid":"3D","shapeGroup.uml":"Diagramme de classes","shapeMenu.hint":"Survolez pour voir le nom","tool.chevron":"Chevron","tool.brace-left":"Accolade gauche","tool.brace-right":"Accolade droite","tool.uml-class":"Classe UML","tool.uml-interface":"Interface UML","tool.line":"Ligne","tool.arrow":"Ligne","tool.text":"Texte","tool.draw":"Stylo","tool.pen":"Stylo","tool.highlighter":"Surligneur","tool.eraser":"Gomme","status.none":"Aucune s\xE9lection","status.selected":"{n} formes s\xE9lectionn\xE9es","toolbar.select":"S\xE9lection (V)","toolbar.hand":"D\xE9placer la vue (H)","toolbar.shapes":"Formes","toolbar.grid":"Grille","toolbar.undo":"Annuler (Ctrl+Z)","toolbar.redo":"R\xE9tablir (Ctrl+Maj+Z)","toolbar.arrow":"Fl\xE8che (A)","toolbar.text":"Texte (T)","toolbar.pen":"Stylo","toolbar.highlighter":"Surligneur","toolbar.eraser":"Gomme (E)","toolbar.uml-class":"Classe UML","toolbar.uml-interface":"Interface UML","zoom.in":"Zoom avant","zoom.out":"Zoom arri\xE8re","zoom.reset":"R\xE9initialiser","style.stroke":"Bordure","style.line":"Ligne","style.fill":"Remplissage","style.text":"Texte","style.highlight":"Surlignage","style.prefix":"Pr\xE9fixe","style.prefix.soon":"Les symboles de pr\xE9fixe arrivent bient\xF4t","style.none":"Aucun","style.addColor":"Ajouter une couleur","style.connection":"Connexion","style.arrow":"Pointe de fl\xE8che","style.dashed":"Pointill\xE9","style.solid":"Continu","style.opacity":"Opacit\xE9","style.connection.straight":"Droite","style.connection.polyline":"Polyligne arrondie","style.connection.orthogonal":"Orthogonale","style.connection.curve":"Courbe","style.arrowhead.none":"Aucune","style.arrowhead.end":"Fin","style.arrowhead.start":"D\xE9but","style.arrowhead.both":"Les deux","style.arrowhead.none-dashed":"Pointill\xE9","style.arrowhead.both-dashed":"Pointill\xE9 double","style.uml":"UML","style.arrowhead.inheritance":"H\xE9ritage","style.arrowhead.composition":"Composition","style.arrowhead.aggregation":"Agr\xE9gation","style.arrowhead.dependency":"D\xE9pendance","style.arrowhead.realization":"R\xE9alisation","menu.title":"Choisir une nouvelle forme","menu.cancel":"Cliquez dans le vide pour annuler","shape.rectangle":"Rectangle","shape.rounded-rectangle":"Arrondi","shape.circle":"Cercle","shape.ellipse":"Ellipse","shape.diamond":"Losange","shape.triangle":"Triangle","shape.hexagon":"Hexagone","shape.parallelogram":"Parall\xE9logramme","shape.trapezoid":"Trap\xE8ze","shape.pentagon":"Pentagone","shape.octagon":"Octogone","shape.star":"\xC9toile","shape.uml-class":"Classe","shape.uml-interface":"Interface","uml.drag":"Glisser pour r\xE9ordonner","uml.delete":"Supprimer la ligne","uml.textColor":"Couleur du texte","uml.defaultColor":"Couleur par d\xE9faut","uml.fontSize":"Taille de police","uml.strikethrough":"Barr\xE9","uml.attribute":"Attributs","uml.method":"M\xE9thodes","minimap.title":"Mini-carte","minimap.expand":"D\xE9velopper la mini-carte","minimap.collapse":"R\xE9duire la mini-carte","tool.mind-map":"Carte mentale","toolbar.mind-map":"Carte mentale","toolbar.export":"Exporter","toolbar.export.png":"Image PNG","toolbar.export.svg":"Vecteur SVG","toolbar.export.pdf":"Document PDF","toolbar.export.data":"Exporter les donn\xE9es","toolbar.import.data":"Importer les donn\xE9es","import.success":"Import r\xE9ussi : {n} formes restaur\xE9es","import.fail":"\xC9chec de l'import : format de fichier invalide","shape.mind-map":"Carte mentale","mindmap.defaultRoot":"Sujet central","mindmap.defaultBranch":"Sous-sujet","mindmap.nodeText":"Texte du n\u0153ud","mindmap.addChild":"N\u0153ud enfant","mindmap.addSibling":"N\u0153ud fr\xE8re","mindmap.deleteNode":"Supprimer le n\u0153ud","mindmap.color":"Couleur","mindmap.levelColor":"Couleur de niveau par d\xE9faut","mindmap.icon":"Ic\xF4ne","mindmap.noIcon":"Aucune ic\xF4ne","mindmap.note":"Note","mindmap.notePlaceholder":"Contenu de la note (facultatif)","mindmap.noteColor":"Couleur de la note","mindmap.noteColorDefault":"Comme le n\u0153ud","mindmap.collapse":"R\xE9duire","mindmap.expand":"D\xE9velopper","mindmap.close":"Fermer l'\xE9diteur","mindmap.more":"Plus de r\xE9glages","mindmap.level":"Niveau","mindmap.promote1":"Monter","mindmap.promote2":"Monter de 2","mindmap.promoteDisabled":"D\xE9j\xE0 en haut","tool.table":"Tableau","toolbar.table":"Tableau","shape.table":"Tableau","table.insertRow":"Ins\xE9rer une ligne","table.deleteRow":"Supprimer la ligne","table.insertCol":"Ins\xE9rer une colonne","table.deleteCol":"Supprimer la colonne","table.merge":"Fusionner les cellules","table.split":"Scinder la cellule","table.insertRowAbove":"Ins\xE9rer une ligne au-dessus","table.insertRowBelow":"Ins\xE9rer une ligne en dessous","table.insertColLeft":"Ins\xE9rer une colonne \xE0 gauche","table.insertColRight":"Ins\xE9rer une colonne \xE0 droite","table.pickHint":"Choisir lignes et colonnes","ctx.copy":"Copier","ctx.paste":"Coller","ctx.duplicate":"Dupliquer","ctx.layer":"Calque","ctx.bringToFront":"Premier plan","ctx.bringForward":"Vers l'avant","ctx.sendBackward":"Vers l'arri\xE8re","ctx.sendToBack":"Arri\xE8re-plan","ctx.copyStyle":"Copier le style","ctx.pasteStyle":"Coller le style","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"Pivoter","ctx.group":"Grouper","ctx.ungroup":"Dissocier","ctx.lock":"Verrouiller","ctx.unlock":"D\xE9verrouiller","ctx.unlockAll":"Tout d\xE9verrouiller","ctx.delete":"Supprimer","toolbar.icon":"Ic\xF4nes (S)","toolbar.template":"Mod\xE8les","template.search":"Rechercher un mod\xE8le","template.all":"Tout","template.empty":"Aucun mod\xE8le correspondant","toolbar.image":"Image","toolbar.more":"Plus","toolbar.pageTheme":"Th\xE8me de page","pageTheme.light":"D\xE9faut","pageTheme.warm":"Chaud","pageTheme.gray":"Gris clair","pageTheme.purple":"Violet clair","pageTheme.green":"Vert clair","pageTheme.eye-care":"Protecteur","tool.image":"Image","image.uploadFailed":"\xC9chec de l'envoi de l'image","image.insertFailed":"\xC9chec de l'insertion de l'image","image.tooLarge":"L'image d\xE9passe la limite d'envoi de 30 Mo","image.temporaryInserted":"Image temporaire ins\xE9r\xE9e (aucun point d'envoi configur\xE9, elle sera perdue au rechargement)","image.naturalSize":"Taille d\u2019origine","icon.search":"Rechercher une ic\xF4ne","icon.empty":"Aucune ic\xF4ne correspondante","icon.recent":"R\xE9cemment utilis\xE9s","iconCat.status":"Statut","iconCat.number":"Badges num\xE9rot\xE9s","iconCat.tech":"Cloud et technique","iconCat.chart":"Graphiques","iconCat.office":"Documents","iconCat.media":"M\xE9dias et collaboration","iconCat.arrow":"Fl\xE8ches","iconCat.misc":"Essentiels","iconCat.emoji":"\xC9motions","iconCat.sticker":"Autocollants","iconCat.device":"Appareils","iconCat.weather":"M\xE9t\xE9o","iconCat.transport":"Transport","iconCat.nature":"Nature","iconCat.building":"B\xE2timent","iconCat.medical":"M\xE9dical","iconCat.shopping":"Shopping","iconCat.science":"Science","iconCat.animal":"Animal","iconCat.time":"Temps","iconCat.edit":"\xC9dition","iconCat.food":"Nourriture","iconCat.communication":"Communication"}},Ft="zh-CN",Kn=new Set;function Kt(r){Ft!==r&&(Ft=r,Kn.forEach(e=>e()));}function or(){return Ft}function rr(r){return Kn.add(r),()=>Kn.delete(r)}function le(r,e){let i=Ji[Ft][r]??Ji["zh-CN"][r];if(e)for(let[n,o]of Object.entries(e))i=i.replace(new RegExp(`\\{${n}\\}`,"g"),String(o));return i}function Ee(r){let e=r.visibility??"",t=(r.name??"").trim(),i=(r.type??"").trim();if(!t&&!i)return "";let n=`${t}${i?`: ${i}`:""}`;return e?`${e} ${n}`:n}function xe(r){let e=r.visibility??"",t=(r.name??"").trim(),i=(r.params??"").trim(),n=(r.returnType??"").trim();if(!t&&!i&&!n)return "";let o=`${t}(${i})${n?`: ${n}`:""}`;return e?`${e} ${o}`:o}var Xn=["#ef4444","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899"],Ce=14,sr=40,ar=80,lr=240;var ut=9,cr=12;var Ye=["right","left","up","down"];function ce(r){return r==="right"||r==="left"}function Ke(r){return r==="right"||r==="down"?1:-1}function Z(r,e="right"){return r.direction??e}function Ne(r,e){return r.color??Xn[e%Xn.length]}function Qi(r){let e=r.text||"",t=0;for(let n of e)t+=/[\u2e80-\u9fff\uf900-\ufaff\uff00-\uffef\u3000-\u303f]/.test(n)?1:.6;let i=Math.max(80,Math.min(240,Math.ceil(t*14)+24));return r.icon&&(i+=26),{width:i,height:40}}function Yt(r){let e={...r};return r.children&&(e.children=r.children.map(t=>Yt(t))),e}function Xe(r,e,t){if(r.id===e)return {...r,...t};let i=r.children??[],n=i.map(o=>Xe(o,e,t));return n.some((o,s)=>o!==i[s])?{...r,children:n}:r}function Zn(r,e,t){if(r.id===e)return {...r,children:[...r.children??[],t],collapsed:false};let i=r.children??[],n=i.map(o=>Zn(o,e,t));return n.some((o,s)=>o!==i[s])?{...r,children:n}:r}function jn(r,e,t){let i=r.children??[];for(let n=0;n<i.length;n++){if(i[n].id===e){let s=[...i];return s.splice(n+1,0,t),{...r,children:s}}let o=jn(i[n],e,t);if(o!==i[n])return {...r,children:i.map(s=>s===i[n]?o:s)}}return r}function Xt(r,e){if(r.id===e)return null;let t=r.children??[],i=t.map(n=>Xt(n,e)).filter(n=>n!==null);return i.length!==t.length||i.some((n,o)=>n!==t[o])?{...r,children:i}:r}function W(r,e){if(r.id===e)return r;for(let t of r.children??[]){let i=W(t,e);if(i)return i}return null}function Zt(r,e){if(r.id===e)return 0;for(let t of r.children??[]){let i=Zt(t,e);if(i!==-1)return i+1}return -1}function Ze(r,e){for(let t of r.children??[]){if(t.id===e)return r;let i=Ze(t,e);if(i)return i}return null}function eo(r){let e=1;for(let t of r.children??[])e+=eo(t);return e}function hr(r){let e=new Map;for(let t of Ye)e.set(t,[]);for(let t of r.children??[]){let i=t.direction??"right";e.get(i).push(t);}return e}function to(r,e){e.set(r.id,Qi(r));for(let t of r.children??[])to(t,e);}function N(r){let e=new Map;to(r,e);let t=new Map,i=new Map,n=w=>e.get(w),o=(w,S)=>{let C=Z(w,S),v=`${w.id}:${C}`,k=i.get(v);if(k)return k;let L=n(w.id);if(w.collapsed)return i.set(v,L),L;let E=w.children??[];if(E.length===0)return i.set(v,L),L;let U=E.map(fe=>o(fe,C)),ae;if(ce(C)){let fe=U.reduce((O,te)=>O+te.height,0)+16*(E.length-1),ye=Math.max(...U.map(O=>O.width));ae={width:L.width+48+ye,height:Math.max(L.height,fe)};}else {let fe=U.reduce((O,te)=>O+te.width,0)+16*(E.length-1),ye=Math.max(...U.map(O=>O.height));ae={width:Math.max(L.width,fe),height:L.height+48+ye};}return i.set(v,ae),ae},s=(w,S,C,v,k)=>{let L=Z(w,S),E=n(w.id);if(t.set(w.id,{x:v,y:k,depth:C,width:E.width,height:E.height,direction:L}),w.collapsed)return;let U=w.children??[];if(U.length!==0)if(ce(L)){let ae=v+Ke(L)*(E.width/2+48),fe=U.reduce((O,te)=>O+o(te,L).height,0)+16*(U.length-1),ye=k-fe/2;for(let O of U){let te=Z(O,L),at=o(O,te),Tn=n(O.id);s(O,te,C+1,ae+Ke(te)*Tn.width/2,ye+at.height/2),ye+=at.height+16;}}else {let ae=k+Ke(L)*(E.height/2+48),fe=U.reduce((O,te)=>O+o(te,L).width,0)+16*(U.length-1),ye=v-fe/2;for(let O of U){let te=Z(O,L),at=o(O,te),Tn=n(O.id);s(O,te,C+1,ye+at.width/2,ae+Ke(te)*Tn.height/2),ye+=at.width+16;}}},a=n(r.id);t.set(r.id,{x:0,y:0,depth:0,width:a.width,height:a.height,direction:"right"});let l=hr(r);for(let w of Ye){let S=l.get(w);if(S.length!==0)if(ce(w)){let v=-(S.reduce((k,L)=>k+o(L,w).height,0)+16*(S.length-1))/2;for(let k of S){let L=o(k,w),E=n(k.id);s(k,w,1,Ke(w)*(a.width/2+48+E.width/2),v+L.height/2),v+=L.height+16;}}else {let v=-(S.reduce((k,L)=>k+o(L,w).width,0)+16*(S.length-1))/2;for(let k of S){let L=o(k,w),E=n(k.id);s(k,w,1,v+L.width/2,Ke(w)*(a.height/2+48+E.height/2)),v+=L.width+16;}}}let c=new Map,h=(w,S)=>{let C=w.offset,v={dx:S.dx+(C?.dx??0),dy:S.dy+(C?.dy??0)};c.set(w.id,v);for(let k of w.children??[])h(k,v);};h(r,{dx:0,dy:0}),t.forEach((w,S)=>{let C=c.get(S);C&&(w.x+=C.dx,w.y+=C.dy);});let d=1/0,u=-1/0,p=1/0,g=-1/0;t.forEach(w=>{d=Math.min(d,w.x-w.width/2),u=Math.max(u,w.x+w.width/2),p=Math.min(p,w.y-w.height/2),g=Math.max(g,w.y+w.height/2);});let m=(d+u)/2,f=(p+g)/2;t.forEach(w=>{w.x-=m,w.y-=f;});let b=1/0,x=-1/0,I=1/0,T=-1/0;return t.forEach(w=>{b=Math.min(b,w.x-w.width/2),x=Math.max(x,w.x+w.width/2),I=Math.min(I,w.y-w.height/2),T=Math.max(T,w.y+w.height/2);}),{positions:t,width:x-b,height:T-I}}function jt(r,e){return e==="right"?{x:r.x+r.width/2+10,y:r.y}:e==="left"?{x:r.x-r.width/2-10,y:r.y}:e==="down"?{x:r.x,y:r.y+r.height/2+10}:{x:r.x,y:r.y-r.height/2-10}}function no(r,e,t){let i=!!(r.children&&r.children.length>0),n=e.direction,o=i?16:0,s=[];if(t)for(let a of Ye)s.push(Yn(a,e,o));else {s.push(Yn(n,e,o));let a=ce(n)?"down":"right";s.push(Yn(a,e,0,"sibling"));}return s}function Yn(r,e,t,i="child"){let n=18+t;return r==="right"?{kind:i,direction:r,x:e.x+e.width/2+n,y:e.y}:r==="left"?{kind:i,direction:r,x:e.x-e.width/2-n,y:e.y}:r==="down"?{kind:i,direction:r,x:e.x,y:e.y+e.height/2+n}:{kind:i,direction:r,x:e.x,y:e.y-e.height/2-n}}function qn(r,e){let t=W(r,e);if(!t)return [];let i=N(r).positions.get(e);return i?no(t,i,t.id===r.id):[]}function Jn(r,e,t,i){let o=s=>{let a=e.get(s.id);if(a)for(let l of no(s,a,s===r)){let c=t-l.x,h=i-l.y;if(c*c+h*h<=144)return {nodeId:s.id,kind:l.kind,direction:l.direction}}if(!s.collapsed)for(let l of s.children??[]){let c=o(l);if(c)return c}return null};return o(r)}function Be(r,e){let t=Ze(r,e);if(!t)return null;let i=W(r,e);if(!i)return null;let n=t===r?i.direction??"right":Z(i,Z(t)),o;t===r?o=(t.children??[]).filter(a=>Z(a,"right")===n):o=t.children??[];let s=o.findIndex(a=>a.id===e);return s===-1?null:{parent:t,siblings:o,index:s,direction:n}}function Qn(r,e,t){let i=Be(r,e);if(!i)return r;let{parent:n,siblings:o,index:s,direction:a}=i;if(t<0&&(t=0),t>o.length-1&&(t=o.length-1),t===s)return r;let l=[...o],[c]=l.splice(s,1);if(l.splice(t,0,c),n!==r)return Xe(r,n.id,{children:l});let h=[],d=0;for(let u of r.children??[])Z(u,"right")===a?h.push(l[d++]):h.push(u);return {...r,children:h}}function ei(r,e,t){let i=oo(r,e);if(!i)return r;let n=i.length-1;if(n<t+1)return r;let o=i[n-1-t],s=i[n-t],a=W(r,e);if(!a)return r;let l=a;if(!l.direction&&o===r.id){let h=W(r,s),d=h?Z(h):Z(a,"right");l={...l,direction:d};}let c=ro(r,e);return c===r?r:so(c,o,s,l)}function ti(r,e,t,i,n){if(e===r.id||e===t)return r;let o=W(r,e);if(!o||t!==r.id&&W(o,t))return r;let s=Xt(r,e);if(!s)return r;let a=t===r.id,l;return a?l={...o,direction:i}:(l={...o},delete l.direction),io(s,t,i,n,l)}function dr(r,e,t){let i=0;for(let o=0;o<r.length;o++)if(Z(r[o],"right")===e){if(i===t)return o;i++;}let n=-1;for(let o=0;o<r.length;o++)Z(r[o],"right")===e&&(n=o);return n===-1?r.length:n+1}function io(r,e,t,i,n){if(r.id===e){let s=r.children??[],a=dr(s,t,Math.max(0,i)),l=[...s];return l.splice(a,0,n),{...r,children:l}}let o=r.children??[];for(let s=0;s<o.length;s++){let a=o[s];if(a.id===e){let c=[...a.children??[]],h=Math.max(0,Math.min(i,c.length));return c.splice(h,0,n),{...r,children:o.map((d,u)=>u===s?{...a,children:c}:d)}}let l=io(a,e,t,i,n);if(l!==a)return {...r,children:o.map((c,h)=>h===s?l:c)}}return r}function oo(r,e,t=[]){let i=[...t,r.id];if(r.id===e)return i;for(let n of r.children??[]){let o=oo(n,e,i);if(o)return o}return null}function ro(r,e){let t=r.children??[];if(t.findIndex(o=>o.id===e)!==-1)return {...r,children:t.filter(o=>o.id!==e)};let n=t.map(o=>ro(o,e));return n.some((o,s)=>o!==t[s])?{...r,children:n}:r}function so(r,e,t,i){if(r.id===e){let s=r.children??[],a=s.findIndex(h=>h.id===t),l=a===-1?s.length:a+1,c=[...s];return c.splice(l,0,i),{...r,children:c}}let n=r.children??[],o=n.map(s=>so(s,e,t,i));return o.some((s,a)=>s!==n[a])?{...r,children:o}:r}var ao=["#fde68a","#fcd34d","#fdba74","#fca5a5","#f9a8d4","#e9d5ff","#c4b5fd","#a5b4fc","#7dd3fc","#a7f3d0","#86efac","#d9f99d"],qt=ao[0];function ni(r){return typeof r=="string"&&/^#[0-9a-fA-F]{6}$/.test(r.trim())}var re=.2,je=.85-re/2;function lo(r){return !r||r==="transparent"?r:Fn(r,-0.14)}function co(r,e){return {...r,fillColor:ni(e)?e:qt,fillOpacity:1,strokeColor:"transparent"}}var ho={color:"#0f172a",opacity:.2,blur:16,offsetX:0,offsetY:5};var pr=[{id:"status",labelKey:"iconCat.status"},{id:"number",labelKey:"iconCat.number"},{id:"emoji",labelKey:"iconCat.emoji"},{id:"sticker",labelKey:"iconCat.sticker"},{id:"device",labelKey:"iconCat.device"},{id:"tech",labelKey:"iconCat.tech"},{id:"chart",labelKey:"iconCat.chart"},{id:"office",labelKey:"iconCat.office"},{id:"media",labelKey:"iconCat.media"},{id:"arrow",labelKey:"iconCat.arrow"},{id:"misc",labelKey:"iconCat.misc"},{id:"weather",labelKey:"iconCat.weather"},{id:"transport",labelKey:"iconCat.transport"},{id:"nature",labelKey:"iconCat.nature"},{id:"building",labelKey:"iconCat.building"},{id:"medical",labelKey:"iconCat.medical"},{id:"shopping",labelKey:"iconCat.shopping"},{id:"science",labelKey:"iconCat.science"},{id:"animal",labelKey:"iconCat.animal"},{id:"time",labelKey:"iconCat.time"},{id:"edit",labelKey:"iconCat.edit"},{id:"food",labelKey:"iconCat.food"},{id:"communication",labelKey:"iconCat.communication"}],y=(r,e)=>({d:r,fill:"none",...e?{w:e}:{}}),pt=(r,e="ink")=>({d:r,fill:e,stroke:"none"}),$=(r,e,t)=>`M${r-t} ${e}A${t} ${t} 0 1 0 ${r+t} ${e}A${t} ${t} 0 1 0 ${r-t} ${e}Z`,gr=["#e11d48","#f97316","#eab308","#22c55e","#14b8a6","#0ea5e9","#6366f1","#a855f7","#ec4899","#64748b"],mr=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],fr=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"],yr=gr.map((r,e)=>({id:`num-${e}`,cat:"number",zh:`\u6570\u5B57 ${e}`,en:`${fr[e]} badge`,kw:`number badge \u6570\u5B57 \u5FBD\u6807 \u5E8F\u53F7 ${mr[e]} ${e}`,layers:[],disc:r,label:{text:String(e),color:"#ffffff",size:13}})),qe=[{id:"check-circle",cat:"status",zh:"\u901A\u8FC7",en:"Check circle",kw:"check ok success done \u5B8C\u6210 \u5BF9\u52FE \u6210\u529F \u901A\u8FC7 \u6B63\u786E",layers:[y($(12,12,9)),y("M7.6 12.3L10.6 15.3L16.3 8.9")]},{id:"alert-circle",cat:"status",zh:"\u8B66\u544A",en:"Alert circle",kw:"alert warning danger \u8B66\u544A \u6CE8\u610F \u5371\u9669 \u611F\u53F9\u53F7",layers:[y($(12,12,9)),y("M12 7.4V13"),y("M12 16.4H12.01",2.2)]},{id:"question-circle",cat:"status",zh:"\u7591\u95EE",en:"Question circle",kw:"question help faq \u7591\u95EE \u5E2E\u52A9 \u95EE\u53F7",layers:[y($(12,12,9)),y("M9.4 9.4A2.7 2.7 0 0 1 14.7 10C14.7 11.8 12 12.2 12 14"),y("M12 16.6H12.01",2.2)]},{id:"close-circle",cat:"status",zh:"\u5931\u8D25",en:"Close circle",kw:"close fail error cancel \u5931\u8D25 \u5173\u95ED \u9519\u8BEF \u53C9",layers:[y($(12,12,9)),y("M9.2 9.2L14.8 14.8"),y("M14.8 9.2L9.2 14.8")]},{id:"info-circle",cat:"status",zh:"\u4FE1\u606F",en:"Info circle",kw:"info note tip \u4FE1\u606F \u63D0\u793A \u8BF4\u660E",layers:[y($(12,12,9)),y("M12 11V16.4"),y("M12 7.6H12.01",2.2)]},{id:"star",cat:"status",zh:"\u661F\u6807",en:"Star",kw:"star favorite bookmark \u661F \u6536\u85CF \u6807\u8BB0 \u91CD\u70B9",layers:[y("M12 3.4L14.7 8.9L20.7 9.8L16.3 14L17.4 20L12 17.1L6.6 20L7.7 14L3.3 9.8L9.3 8.9Z")]},{id:"flag",cat:"status",zh:"\u65D7\u6807",en:"Flag",kw:"flag mark milestone \u65D7\u5E1C \u6807\u8BB0 \u91CC\u7A0B\u7891",layers:[y("M5.5 20.5V4"),y("M5.5 5H16.5L14.8 8.6L16.5 12.2H5.5")]},{id:"heart",cat:"status",zh:"\u559C\u6B22",en:"Heart",kw:"heart like love \u5FC3 \u559C\u6B22 \u70B9\u8D5E \u6536\u85CF",layers:[y("M12 20.2C12 20.2 4.8 15.6 4.8 10.4A4 4 0 0 1 12 7.7A4 4 0 0 1 19.2 10.4C19.2 15.6 12 20.2 12 20.2Z")]},...yr,{id:"cloud",cat:"tech",zh:"\u4E91",en:"Cloud",kw:"cloud saas \u4E91 \u670D\u52A1 \u8BA1\u7B97 \u5929\u6C14",layers:[y("M7 18.5H16.6A3.6 3.6 0 0 0 17.1 11.3A5.4 5.4 0 0 0 6.8 9.9A4 4 0 0 0 7 18.5Z")]},{id:"cloud-up",cat:"tech",zh:"\u4E91\u4E0A\u4F20",en:"Cloud upload",kw:"cloud upload sync \u4E91 \u4E0A\u4F20 \u540C\u6B65 \u5BFC\u5165",layers:[y("M7 18.5H16.6A3.6 3.6 0 0 0 17.1 11.3A5.4 5.4 0 0 0 6.8 9.9A4 4 0 0 0 7 18.5Z"),y("M12 17V11.4"),y("M9.8 13.6L12 11.4L14.2 13.6")]},{id:"cloud-down",cat:"tech",zh:"\u4E91\u4E0B\u8F7D",en:"Cloud download",kw:"cloud download \u4E91 \u4E0B\u8F7D \u5BFC\u51FA \u62C9\u53D6",layers:[y("M7 18.5H16.6A3.6 3.6 0 0 0 17.1 11.3A5.4 5.4 0 0 0 6.8 9.9A4 4 0 0 0 7 18.5Z"),y("M12 11.2V17"),y("M9.8 14.8L12 17L14.2 14.8")]},{id:"server",cat:"tech",zh:"\u670D\u52A1\u5668",en:"Server",kw:"server host machine \u670D\u52A1\u5668 \u4E3B\u673A \u673A\u623F \u5B9E\u4F8B",layers:[y("M4 5H20V10H4Z"),y("M4 14H20V19H4Z"),y("M7.6 7.5H7.61",2.2),y("M7.6 16.5H7.61",2.2),y("M11 7.5H16.5"),y("M11 16.5H16.5")]},{id:"database",cat:"tech",zh:"\u6570\u636E\u5E93",en:"Database",kw:"database db storage mysql \u6570\u636E\u5E93 \u5B58\u50A8 \u8868 \u6570\u636E",layers:[y("M4 6.4C4 5 7.6 3.9 12 3.9C16.4 3.9 20 5 20 6.4C20 7.8 16.4 8.9 12 8.9C7.6 8.9 4 7.8 4 6.4Z"),y("M4 6.4V17.6C4 19 7.6 20.1 12 20.1C16.4 20.1 20 19 20 17.6V6.4"),y("M4 12C4 13.4 7.6 14.5 12 14.5C16.4 14.5 20 13.4 20 12")]},{id:"chip",cat:"tech",zh:"\u82AF\u7247",en:"Chip",kw:"chip cpu gpu ai \u82AF\u7247 \u5904\u7406\u5668 \u7B97\u529B \u6A21\u578B",layers:[y("M8 8H16V16H8Z"),y("M12 4V8"),y("M12 16V20"),y("M4 12H8"),y("M16 12H20"),y("M10 4V8"),y("M14 4V8"),y("M10 16V20"),y("M14 16V20"),y("M4 10H8"),y("M4 14H8"),y("M16 10H20"),y("M16 14H20")]},{id:"terminal",cat:"tech",zh:"\u547D\u4EE4\u884C",en:"Terminal",kw:"terminal shell cli code \u547D\u4EE4\u884C \u7EC8\u7AEF \u547D\u4EE4 ssh",layers:[y("M4 5H20V19H4Z"),y("M7.6 9.4L10.2 12L7.6 14.6"),y("M13 14.8H16.6")]},{id:"globe",cat:"tech",zh:"\u7F51\u7EDC",en:"Network",kw:"network internet globe cdn \u7F51\u7EDC \u5168\u7403 \u4E92\u8054\u7F51 \u62D3\u6251",layers:[y($(12,12,8.6)),y("M3.4 12H20.6"),y("M12 3.4C14.4 5.7 15.6 8.7 15.6 12C15.6 15.3 14.4 18.3 12 20.6C9.6 18.3 8.4 15.3 8.4 12C8.4 8.7 9.6 5.7 12 3.4Z")]},{id:"shield",cat:"tech",zh:"\u5B89\u5168",en:"Shield",kw:"shield security safe privacy \u5B89\u5168 \u9632\u62A4 \u76FE \u52A0\u5BC6 \u5408\u89C4",layers:[y("M12 3.4L19 6V12C19 16 16 19.2 12 20.6C8 19.2 5 16 5 12V6Z"),y("M9 12.2L11.2 14.4L15.2 9.9")]},{id:"bar-chart",cat:"chart",zh:"\u67F1\u72B6\u56FE",en:"Bar chart",kw:"bar chart column \u67F1\u72B6 \u56FE\u8868 \u7EDF\u8BA1 \u6570\u636E",layers:[y("M4.5 20H19.5"),y("M7.5 20V11.5"),y("M12 20V5.5"),y("M16.5 20V14")]},{id:"line-chart",cat:"chart",zh:"\u6298\u7EBF\u56FE",en:"Line chart",kw:"line chart trend \u6298\u7EBF \u8D8B\u52BF \u589E\u957F \u56FE\u8868",layers:[y("M4.5 4.5V19.5H19.5"),y("M7.5 15.6L11 11.4L14 13.9L18.4 8")]},{id:"pie-chart",cat:"chart",zh:"\u997C\u56FE",en:"Pie chart",kw:"pie chart share \u997C\u56FE \u5360\u6BD4 \u4EFD\u989D \u56FE\u8868",layers:[y($(12,12,8.6)),y("M12 12V3.4"),y("M12 12L19.4 16.2")]},{id:"gauge",cat:"chart",zh:"\u4EEA\u8868\u76D8",en:"Gauge",kw:"gauge dashboard monitor \u4EEA\u8868\u76D8 \u76D1\u63A7 \u6027\u80FD \u6C34\u4F4D",layers:[y("M3.6 17.6A8.8 8.8 0 0 1 20.4 17.6"),y("M12 17.6L15.8 12.4"),y("M12 5.6V7.4"),y("M5.6 8.4L6.9 9.7"),y("M18.4 8.4L17.1 9.7")]},{id:"table",cat:"chart",zh:"\u6570\u636E\u8868",en:"Table",kw:"table grid sheet data \u8868\u683C \u6570\u636E \u7F51\u683C \u660E\u7EC6",layers:[y("M4 5H20V19H4Z"),y("M4 9.8H20"),y("M9.6 5V19"),y("M15.2 9.8V19")]},{id:"funnel",cat:"chart",zh:"\u6F0F\u6597",en:"Funnel",kw:"funnel filter convert \u6F0F\u6597 \u8F6C\u5316 \u7B5B\u9009 \u6D41\u7A0B",layers:[y("M4 5H20L14 12.2V18.6L10 16.6V12.2Z")]},{id:"target",cat:"chart",zh:"\u76EE\u6807",en:"Target",kw:"target goal okr kpi \u76EE\u6807 \u9776\u5FC3 \u6307\u6807 \u5B8C\u6210\u5EA6",layers:[y($(12,12,8.6)),y($(12,12,4.6)),pt($(12,12,1.5))]},{id:"trend-up",cat:"chart",zh:"\u589E\u957F",en:"Trend up",kw:"growth up increase kpi \u589E\u957F \u4E0A\u5347 \u63D0\u5347 \u4E0A\u6DA8",layers:[y("M4 17.5L9.2 12.2L12.6 15.4L20 7.8"),y("M15.4 7.8H20V12.4")]},{id:"doc",cat:"office",zh:"\u6587\u6863",en:"Document",kw:"doc file page \u6587\u6863 \u6587\u4EF6 \u9875\u9762 \u62A5\u544A \u9700\u6C42",layers:[y("M6.5 3.5H13.5L17.5 7.5V20.5H6.5Z"),y("M13.4 3.6V7.6H17.4"),y("M9.5 12.5H14.5"),y("M9.5 16H14.5")]},{id:"sheet",cat:"office",zh:"\u8868\u683C",en:"Spreadsheet",kw:"excel sheet cell \u8868\u683C \u5355\u5143\u683C \u62A5\u8868 \u8BA1\u7B97",layers:[y("M6.5 3.5H13.5L17.5 7.5V20.5H6.5Z"),y("M13.4 3.6V7.6H17.4"),y("M9.5 11.5H14.5M9.5 15H14.5M9.5 18.2H12.5")]},{id:"slide",cat:"office",zh:"\u6F14\u793A",en:"Slide",kw:"slide ppt presentation \u6F14\u793A \u5E7B\u706F\u7247 ppt \u6C47\u62A5",layers:[y("M4 5H20V15.5H4Z"),y("M12 15.5V19"),y("M8.8 20.5H15.2")]},{id:"folder",cat:"office",zh:"\u6587\u4EF6\u5939",en:"Folder",kw:"folder directory \u6587\u4EF6\u5939 \u76EE\u5F55 \u5F52\u6863 \u9879\u76EE",layers:[y("M4 6.5H9.6L11.6 9H20V19H4Z")]},{id:"mail",cat:"office",zh:"\u90AE\u4EF6",en:"Mail",kw:"mail email message \u90AE\u4EF6 \u6D88\u606F \u901A\u77E5 \u90AE\u7BB1",layers:[y("M3.5 6H20.5V18H3.5Z"),y("M3.7 6.4L12 12.6L20.3 6.4")]},{id:"calendar",cat:"office",zh:"\u65E5\u5386",en:"Calendar",kw:"calendar date schedule \u65E5\u5386 \u65E5\u7A0B \u65E5\u671F \u6392\u671F",layers:[y("M4 6.5H20V19.5H4Z"),y("M4 10.8H20"),y("M8.4 3.8V7.4"),y("M15.6 3.8V7.4"),y("M8 14.4H10.4")]},{id:"clipboard",cat:"office",zh:"\u526A\u8D34\u677F",en:"Clipboard",kw:"clipboard copy paste \u526A\u8D34\u677F \u590D\u5236 \u7C98\u8D34 \u6E05\u5355",layers:[y("M7.5 5H5.5V20.5H18.5V5H16.5"),y("M9.5 3.5H14.5V6.6H9.5Z"),y("M8.6 12H15.4"),y("M8.6 16H13")]},{id:"paperclip",cat:"office",zh:"\u9644\u4EF6",en:"Attachment",kw:"attach paperclip file \u9644\u4EF6 \u4E0A\u4F20 \u6587\u4EF6 \u9644\u52A0",layers:[y("M16.6 7.4V15.6A4.6 4.6 0 0 1 7.4 15.6V7A2.9 2.9 0 0 1 13.2 7V15.8A1.3 1.3 0 0 1 10.6 15.8V8.2")]},{id:"image",cat:"media",zh:"\u56FE\u7247",en:"Image",kw:"image photo picture \u56FE\u7247 \u7167\u7247 \u56FE \u76F8\u518C",layers:[y("M4 5H20V19H4Z"),y($(9,9.8,1.7)),y("M4.4 16.8L9 12.2L12.6 15.6L15.4 12.8L19.6 17")]},{id:"video",cat:"media",zh:"\u89C6\u9891",en:"Video",kw:"video movie play \u89C6\u9891 \u5F71\u7247 \u64AD\u653E \u5F55\u5236",layers:[y("M4 6.5H14.6V17.5H4Z"),y("M14.6 10.6L20 7.8V16.2L14.6 13.4Z")]},{id:"mic",cat:"media",zh:"\u9EA6\u514B\u98CE",en:"Microphone",kw:"mic voice audio record \u9EA6\u514B\u98CE \u8BED\u97F3 \u5F55\u97F3 \u97F3\u9891",layers:[y("M12 4.2A2.9 2.9 0 0 1 14.9 7.1V11.9A2.9 2.9 0 0 1 9.1 11.9V7.1A2.9 2.9 0 0 1 12 4.2Z"),y("M6.4 11.5A5.6 5.6 0 0 0 17.6 11.5"),y("M12 17.1V20.4")]},{id:"camera",cat:"media",zh:"\u6444\u50CF\u5934",en:"Camera",kw:"camera photo live \u6444\u50CF\u5934 \u62CD\u7167 \u76F4\u64AD \u4F1A\u8BAE",layers:[y("M4 7.5H7.8L9.3 5H14.7L16.2 7.5H20V19.5H4Z"),y($(12,13.4,3.3))]},{id:"chat",cat:"media",zh:"\u5BF9\u8BDD",en:"Chat",kw:"chat message comment \u5BF9\u8BDD \u8BC4\u8BBA \u6D88\u606F \u6C9F\u901A \u53CD\u9988",layers:[y("M4.5 5.5H19.5V15.5H11L7 19.5V15.5H4.5Z")]},{id:"user",cat:"media",zh:"\u6210\u5458",en:"User",kw:"user person member \u7528\u6237 \u6210\u5458 \u4EBA \u8D26\u53F7 \u8D1F\u8D23\u4EBA",layers:[y($(12,8.4,3.7)),y("M5.4 20.4C6 16.7 8.7 14.6 12 14.6C15.3 14.6 18 16.7 18.6 20.4")]},{id:"users",cat:"media",zh:"\u6210\u5458\u7EC4",en:"User group",kw:"users team group \u56E2\u961F \u7FA4\u7EC4 \u6210\u5458 \u7EC4\u7EC7 \u534F\u4F5C",layers:[y($(9.6,8.6,3.1)),y("M3.6 19.8C4.1 16.8 6.4 15 9.6 15C12.8 15 15.1 16.8 15.6 19.8"),y("M16.4 6A3.1 3.1 0 0 1 16.4 11.2"),y("M17.6 15.2C19.5 15.8 20.7 17.4 21 19.8")]},{id:"bell",cat:"media",zh:"\u901A\u77E5",en:"Bell",kw:"bell notification alert \u901A\u77E5 \u63D0\u9192 \u6D88\u606F \u544A\u8B66",layers:[y("M6.6 16.6V11.4A5.4 5.4 0 0 1 17.4 11.4V16.6L19 19.4H5L6.6 16.6Z"),y("M10.2 19.6A1.9 1.9 0 0 0 13.8 19.6")]},{id:"arrow-up",cat:"arrow",zh:"\u5411\u4E0A",en:"Arrow up",kw:"up arrow top \u4E0A \u5411\u4E0A \u7BAD\u5934 \u4E0A\u5347",layers:[y("M12 20.5V4"),y("M6 10L12 4L18 10")]},{id:"arrow-down",cat:"arrow",zh:"\u5411\u4E0B",en:"Arrow down",kw:"down arrow bottom \u4E0B \u5411\u4E0B \u7BAD\u5934 \u4E0B\u964D",layers:[y("M12 3.5V20"),y("M6 14L12 20L18 14")]},{id:"arrow-left",cat:"arrow",zh:"\u5411\u5DE6",en:"Arrow left",kw:"left arrow back \u5DE6 \u5411\u5DE6 \u7BAD\u5934 \u8FD4\u56DE",layers:[y("M20.5 12H4"),y("M10 6L4 12L10 18")]},{id:"arrow-right",cat:"arrow",zh:"\u5411\u53F3",en:"Arrow right",kw:"right arrow next \u53F3 \u5411\u53F3 \u7BAD\u5934 \u524D\u8FDB",layers:[y("M3.5 12H20"),y("M14 6L20 12L14 18")]},{id:"refresh",cat:"arrow",zh:"\u5237\u65B0",en:"Refresh",kw:"refresh reload retry \u5237\u65B0 \u91CD\u8BD5 \u91CD\u65B0\u52A0\u8F7D",layers:[y("M19.6 12A7.6 7.6 0 1 1 17 6.1"),y("M19.9 4.2V8.4H15.7")]},{id:"sync",cat:"arrow",zh:"\u53CC\u5411\u540C\u6B65",en:"Sync",kw:"sync exchange swap \u540C\u6B65 \u4EA4\u6362 \u53CC\u5411 \u4E92\u8F6C",layers:[y("M4 9.2H19L15.6 5.8"),y("M20 14.8H5L8.4 18.2")]},{id:"upload",cat:"arrow",zh:"\u4E0A\u4F20",en:"Upload",kw:"upload import push \u4E0A\u4F20 \u5BFC\u5165 \u53D1\u5E03 \u63D0\u4EA4",layers:[y("M12 16.5V4.6"),y("M7.4 9.2L12 4.6L16.6 9.2"),y("M4.5 20H19.5")]},{id:"download",cat:"arrow",zh:"\u4E0B\u8F7D",en:"Download",kw:"download export pull \u4E0B\u8F7D \u5BFC\u51FA \u62C9\u53D6 \u4FDD\u5B58",layers:[y("M12 4V15.9"),y("M7.4 11.3L12 15.9L16.6 11.3"),y("M4.5 20H19.5")]},{id:"bulb",cat:"misc",zh:"\u60F3\u6CD5",en:"Idea",kw:"idea bulb tip \u60F3\u6CD5 \u521B\u610F \u63D0\u793A \u8981\u70B9 \u7075\u611F",layers:[y("M8.8 15.6A6 6 0 1 1 15.2 15.6V17.4H8.8Z"),y("M9.8 20.2H14.2")]},{id:"settings",cat:"misc",zh:"\u8BBE\u7F6E",en:"Settings",kw:"settings config option \u8BBE\u7F6E \u914D\u7F6E \u53C2\u6570 \u9009\u9879",layers:[y("M4 7.5H20"),y("M4 12H20"),y("M4 16.5H20"),y($(9,7.5,1.9)),y($(15.4,12,1.9)),y($(8,16.5,1.9))]},{id:"key",cat:"misc",zh:"\u5BC6\u94A5",en:"Key",kw:"key token secret \u5BC6\u94A5 \u4EE4\u724C \u6743\u9650 \u5BC6\u7801",layers:[y($(8.6,8.6,4.6)),y("M11.9 11.9L20 20"),y("M15.6 15.6L17.6 13.6"),y("M18 18L20 16")]},{id:"lock",cat:"misc",zh:"\u9501\u5B9A",en:"Lock",kw:"lock secure private \u9501 \u52A0\u5BC6 \u79C1\u6709 \u5B89\u5168",layers:[y("M6.4 10.6H17.6V20.4H6.4Z"),y("M9.2 10.6V7.8A2.8 2.8 0 0 1 14.8 7.8V10.6")]},{id:"eye",cat:"misc",zh:"\u67E5\u770B",en:"Eye",kw:"eye view preview \u67E5\u770B \u9884\u89C8 \u53EF\u89C1 \u89C2\u5BDF",layers:[y("M2.8 12C2.8 12 6.6 6.4 12 6.4C17.4 6.4 21.2 12 21.2 12C21.2 12 17.4 17.6 12 17.6C6.6 17.6 2.8 12 2.8 12Z"),y($(12,12,2.6))]},{id:"lightning",cat:"misc",zh:"\u9AD8\u6548",en:"Lightning",kw:"fast flash speed \u95EA\u7535 \u5FEB\u901F \u9AD8\u6548 \u6027\u80FD",layers:[y("M13.6 2.8L6 13.6H10.8L10.4 21.2L18 10.4H13.2Z")]},{id:"pin",cat:"misc",zh:"\u5B9A\u4F4D",en:"Location",kw:"location pin map \u5B9A\u4F4D \u4F4D\u7F6E \u5730\u56FE \u5730\u5740",layers:[y("M12 21C12 21 18.6 15.1 18.6 10.4A6.6 6.6 0 0 0 5.4 10.4C5.4 15.1 12 21 12 21Z"),y($(12,10.4,2.5))]},{id:"link",cat:"misc",zh:"\u94FE\u63A5",en:"Link",kw:"link url chain \u94FE\u63A5 \u7F51\u5740 \u5F15\u7528 \u8DF3\u8F6C",layers:[y("M10.4 13.6A4.2 4.2 0 0 0 16.4 13.6L19.2 10.8A4.2 4.2 0 0 0 13.2 4.8L11.8 6.2"),y("M13.6 10.4A4.2 4.2 0 0 0 7.6 10.4L4.8 13.2A4.2 4.2 0 0 0 10.8 19.2L12.2 17.8")]},{id:"device-desktop",cat:"device",zh:"\u53F0\u5F0F\u7535\u8111",en:"Desktop",kw:"desktop monitor computer pc \u53F0\u5F0F \u7535\u8111 \u663E\u793A\u5668 \u5C4F\u5E55 \u8BA1\u7B97\u673A",layers:[y("M4.5 4.5H19.5V15.5H4.5Z"),y("M12 15.5V19.3"),y("M8.2 19.5H15.8")]},{id:"device-laptop",cat:"device",zh:"\u7B14\u8BB0\u672C",en:"Laptop",kw:"laptop notebook computer \u7B14\u8BB0\u672C \u4FBF\u643A \u7535\u8111 \u7B14\u8BB0\u672C\u7535\u8111",layers:[y("M6.5 5H17.5V14.5H6.5Z"),y("M8.5 14.5L7.4 17.5"),y("M15.5 14.5L16.6 17.5"),y("M4.5 17.5H19.5")]},{id:"device-phone",cat:"device",zh:"\u624B\u673A",en:"Phone",kw:"phone mobile smartphone \u624B\u673A \u79FB\u52A8 \u7535\u8BDD \u82F9\u679C \u5B89\u5353",layers:[y("M8 3.5H16A1.6 1.6 0 0 1 17.6 5.1V18.9A1.6 1.6 0 0 1 16 20.5H8A1.6 1.6 0 0 1 6.4 18.9V5.1A1.6 1.6 0 0 1 8 3.5Z"),y("M10.4 17.6H13.6")]},{id:"device-tablet",cat:"device",zh:"\u5E73\u677F",en:"Tablet",kw:"tablet ipad \u5E73\u677F \u57AB\u5B50 \u89E6\u5C4F",layers:[y("M5.5 4.5H18.5A1.6 1.6 0 0 1 20.1 6.1V17.9A1.6 1.6 0 0 1 18.5 19.5H5.5A1.6 1.6 0 0 1 3.9 17.9V6.1A1.6 1.6 0 0 1 5.5 4.5Z"),pt($(12,16.8,1))]},{id:"device-keyboard",cat:"device",zh:"\u952E\u76D8",en:"Keyboard",kw:"keyboard typing \u952E\u76D8 \u6253\u5B57 \u8F93\u5165 \u5916\u8BBE",layers:[y("M3.5 7H20.5V17H3.5Z"),y("M6.3 10H6.31",2.2),y("M9.1 10H9.11",2.2),y("M11.9 10H11.91",2.2),y("M14.7 10H14.71",2.2),y("M17.5 10H17.51",2.2),y("M8 14.2H16")]},{id:"device-mouse",cat:"device",zh:"\u9F20\u6807",en:"Mouse",kw:"mouse click \u9F20\u6807 \u70B9\u51FB \u6EDA\u8F6E \u5916\u8BBE",layers:[y("M12 3.5C15.3 3.5 17 5.7 17 8.9V14.1C17 17.3 15.3 20.5 12 20.5C8.7 20.5 7 17.3 7 14.1V8.9C7 5.7 8.7 3.5 12 3.5Z"),y("M12 3.5V8.8"),y("M7 8.8H17")]},{id:"device-printer",cat:"device",zh:"\u6253\u5370\u673A",en:"Printer",kw:"printer print \u6253\u5370\u673A \u6253\u5370 \u590D\u5370 \u8F93\u51FA",layers:[y("M7.5 7.5V3.5H16.5V7.5"),y("M4.5 7.5H19.5V14.5H4.5Z"),y("M8 14.5V20.5H16V14.5"),y("M17.2 10.2H17.21",2.2)]},{id:"device-headset",cat:"device",zh:"\u8033\u673A",en:"Headset",kw:"headset headphone earphone \u8033\u673A \u901A\u8BDD \u5BA2\u670D \u8BED\u97F3",layers:[y("M4.5 13.4V12A7.5 7.5 0 0 1 19.5 12V13.4"),y("M4.5 12.4H6.6A1.6 1.6 0 0 1 8.2 14V16.8A1.6 1.6 0 0 1 6.6 18.4H6.1A1.6 1.6 0 0 1 4.5 16.8Z"),y("M19.5 12.4H17.4A1.6 1.6 0 0 0 15.8 14V16.8A1.6 1.6 0 0 0 17.4 18.4H17.9A1.6 1.6 0 0 0 19.5 16.8Z")]},{id:"device-router",cat:"device",zh:"\u8DEF\u7531\u5668",en:"Router",kw:"router wifi network \u8DEF\u7531\u5668 \u65E0\u7EBF \u7F51\u7EDC \u4FE1\u53F7 \u4E0A\u7F51",layers:[y("M4 13.5H20V19.5H4Z"),y("M7.5 13.5V6"),y("M16.5 13.5V6"),y("M7 16.5H7.01",2.2),y("M10.2 16.5H10.21",2.2)]},{id:"device-usb",cat:"device",zh:"\u4F18\u76D8",en:"USB drive",kw:"usb disk drive \u4F18\u76D8 U\u76D8 \u5B58\u50A8 \u95EA\u5B58 \u63D2\u5165",layers:[y("M9.5 3.5H14.5V8H9.5Z"),y("M8.5 8H15.5V17A3.5 3.5 0 0 1 12 20.5A3.5 3.5 0 0 1 8.5 17Z"),y("M11 5.5H11.01",2.2),y("M13 5.5H13.01",2.2)]},{id:"device-wifi",cat:"device",zh:"\u65E0\u7EBF\u7F51\u7EDC",en:"Wi-Fi",kw:"wifi wireless signal \u65E0\u7EBF \u7F51\u7EDC \u4FE1\u53F7 wifi \u70ED\u70B9",layers:[y("M3.8 9.6C8.2 5.2 15.8 5.2 20.2 9.6"),y("M6.6 12.7C9.6 9.7 14.4 9.7 17.4 12.7"),y("M9.4 15.7C10.8 14.3 13.2 14.3 14.6 15.7"),pt($(12,18.5,1.35))]},{id:"device-battery",cat:"device",zh:"\u7535\u91CF",en:"Battery",kw:"battery power charge \u7535\u91CF \u7535\u6C60 \u5145\u7535 \u80FD\u91CF",layers:[y("M3.5 8.5H18.5V15.5H3.5Z"),y("M20.5 10.5V13.5",2.2),pt("M6 10.4H8.7V13.6H6Z"),pt("M10.3 10.4H13V13.6H10.3Z")]}],gt=new Map(qe.map(r=>[r.id,r])),uo=false,_e=null;function br(){return uo}function po(){return _e||(_e=import('./icons-catalog-TDWDJPEW.js').then(r=>{for(let e of r.CATALOG_ICONS)gt.has(e.id)||(qe.push(e),gt.set(e.id,e));uo=true;}).catch(r=>{throw _e=null,r}),_e)}async function mt(r){if(_e)return _e;let e=false;for(let t of r)if(!gt.has(t)){e=true;break}e&&await po();}function Ve(r){return gt.get(r)}function ii(r){return gt.has(r)}function xr(r){return qe.filter(e=>e.cat===r)}function wr(r){let e=r.trim().toLowerCase();if(!e)return qe;let t=e.split(/\s+/),i=o=>{let s=`${o.zh} ${o.en} ${o.kw??""}`.toLowerCase();return t.every(a=>s.includes(a))},n=o=>`${o.zh} ${o.en}`.toLowerCase().includes(e);return qe.filter(i).sort((o,s)=>Number(n(s))-Number(n(o)))}var oi=48,go="star",K=24,ft="#3b82f6",mo={status:"#f59e0b",number:"#ef4444",emoji:"#ec4899",sticker:"#f43f5e",device:"#64748b",tech:"#0ea5e9",chart:"#6366f1",office:"#2563eb",media:"#8b5cf6",arrow:"#14b8a6",misc:"#94a3b8",weather:"#06b6d4",transport:"#0d9488",nature:"#22c55e",building:"#78716c",medical:"#e11d48",shopping:"#db2777",science:"#7c3aed",animal:"#a16207",time:"#0891b2",edit:"#475569",food:"#ea580c",communication:"#16a34a"};function ri(r){return r.ink??mo[r.cat]??ft}var bt=14,we=10,xt=4,Je=1.3,Sr=10,si=40,ai=24,$e=140,Oe=36;var li="#f1f3f5",Jt="#d9dce1",Qt="#1f2937",Mr=18,Cr=22,Ir=4;function Ie(r,e){let t=e.x-r.x,i=e.y-r.y,n=Math.cos(r.rotation),o=Math.sin(r.rotation);return {x:t*n+i*o+r.width/2,y:-t*o+i*n+r.height/2}}function Tr(r,e){let t=e.x-r.width/2,i=e.y-r.height/2,n=Math.cos(r.rotation),o=Math.sin(r.rotation);return {x:r.x+t*n-i*o,y:r.y+t*o+i*n}}function en(r,e){let t=18/e,i=22/e,n=4/e;return {x:-r.width/2-n-t,y:-r.height/2+2/e,width:t,height:i}}function Qe(r,e,t,i=3){let n=Ie(r,e),o={x:n.x-r.width/2,y:n.y-r.height/2},s=en(r,t),a=i/t;return o.x>=s.x-a&&o.x<=s.x+s.width+a&&o.y>=s.y-a&&o.y<=s.y+s.height+a}function vr(r,e,t=0){let i=Ie(r,e);return i.x>=-t&&i.x<=r.width+t&&i.y>=-t&&i.y<=r.height+t}function wt(r,e){let t=r.cells[0]?.length??0,i=r.cells.length,n=t-1,o=0;for(let a=0;a<t;a++)if(o+=r.colWidths[a]??140,e.x<o){n=a;break}e.x<=0&&(n=0);let s=i-1;o=0;for(let a=0;a<i;a++)if(o+=r.rowHeights[a]??36,e.y<o){s=a;break}return e.y<=0&&(s=0),{row:Math.max(0,s),col:Math.max(0,n)}}function ci(r,e,t,i,n){let o=Math.min(e,i),s=Math.max(e,i),a=Math.min(t,n),l=Math.max(t,n),c=r.colWidths.slice(0,a).reduce((p,g)=>p+g,0),h=r.rowHeights.slice(0,o).reduce((p,g)=>p+g,0),d=r.colWidths.slice(a,l+1).reduce((p,g)=>p+g,0),u=r.rowHeights.slice(o,s+1).reduce((p,g)=>p+g,0);return {x:c-r.width/2,y:h-r.height/2,width:d,height:u}}function et(r){return r.reduce((e,t)=>e+t,0)}function tt(r){return r.reduce((e,t)=>e+t,0)}function St(r,e,t){let i=r*e;return i<=t?t/2-i/2+e/2:4+e/2}function Mt(r,e,t=true){return Array.from({length:r},(i,n)=>Array.from({length:e},()=>n===0&&t?{text:"",bold:true,fillColor:li}:{text:""}))}var kr=["textColor","fontSize","bold","align","fillColor"];function fo(r){if(!r)return null;let e={},t=false;for(let i of kr){let n=r[i];n!==void 0&&(e[i]=n,t=true);}return t?e:null}function yo(r,e){return {text:"",...fo(r)??fo(e)??{}}}var yt;function Pr(r,e){return yt===void 0&&(yt=typeof document<"u"?document.createElement("canvas").getContext("2d"):null),yt?(yt.font=e,yt.measureText(r).width):r.length*8}function bo(r,e,t,i){if(!r||i<=0)return 1;let n=`${t?"bold ":""}${e}px sans-serif`,o=0;for(let s of r.split(`
|
|
2
|
-
`)){if(!s){o+=1;continue}let a="",l=0;for(let c of s){let h=a+c;
|
|
3
|
-
`));for(let u=o;u<=s;u++)for(let p=a;p<=l;p++)(u!==o||p!==a)&&(c[u][p]={text:""});return c}function tn(r,e,t){let i=r[e]?.[t];if(!i||!i.rowSpan&&!i.colSpan)return r;let n=he(r);return xo(n[e][t]),n}function ui(r,e,t){let i=r.cells[e]?.[t];if(!i)return {row:e,col:t};if((i.rowSpan??1)>1||(i.colSpan??1)>1)return {row:e,col:t};for(let n=e;n>=0;n--)for(let o=t;o>=0;o--){let s=r.cells[n]?.[o];if(!s)continue;let a=s.rowSpan??1,l=s.colSpan??1;if(!(a===1&&l===1)&&n<=e&&e<=n+a-1&&o<=t&&t<=o+l-1)return {row:n,col:o}}return {row:e,col:t}}function Ct(r,e,t,i,n){let o=Math.min(e,i),s=Math.max(e,i),a=Math.min(t,n),l=Math.max(t,n),c=true,h=0;for(;c&&h++<32;){c=false;for(let d=0;d<r.cells.length;d++)for(let u=0;u<(r.cells[d]?.length??0);u++){let p=r.cells[d][u],g=p.rowSpan??1,m=p.colSpan??1;if(g===1&&m===1)continue;let f=d+g-1,b=u+m-1;d<=s&&f>=o&&u<=l&&b>=a&&(d<o&&(o=d,c=true),f>s&&(s=f,c=true),u<a&&(a=u,c=true),b>l&&(l=b,c=true));}}return {r1:o,c1:a,r2:s,c2:l}}function Ar(r,e,t,i,n){let o=Math.min(e,i),s=Math.max(e,i),a=Math.min(t,n),l=Math.max(t,n);for(let c=o;c<=s;c++)for(let h=a;h<=l;h++){let d=r.cells[c]?.[h];if(d&&((d.rowSpan??1)>1||(d.colSpan??1)>1))return true}return false}function pi(r,e,t,i,n){let o=Math.min(e,i),s=Math.max(e,i),a=Math.min(t,n),l=Math.max(t,n),c=r.cells,h=false;for(let d=o;d<=s;d++)for(let u=a;u<=l;u++){let p=c[d]?.[u];p&&((p.rowSpan??1)>1||(p.colSpan??1)>1)&&(c=tn(c,d,u),h=true);}return h?c:r.cells}function nn(r,e,t){let i=r.length,n=Math.max(0,Math.min(i,t)),o=r[0]?.length??0,s=he(r);if(n<i)for(let p=0;p<i;p++)for(let g=0;g<(s[p]?.length??0);g++){let m=s[p][g],f=m.rowSpan??1;f>1&&p<n&&n<p+f&&(m.rowSpan=f+1);}let a=(()=>{let p=r[0]?.[0];return i>1&&!!p&&(p.bold===true||p.fillColor===li)})(),l=n===0?0:n-1;l===0&&a&&(l=1);let c=r[l],h=r[Math.min(n,i-1)],d=Array.from({length:o},(p,g)=>yo(c?.[g],h?.[g]));s.splice(n,0,d);let u=[...e];return u.splice(n,0,e[l]??36),{cells:s,rowHeights:u}}function on(r,e,t){let i=r[0]?.length??0,n=Math.max(0,Math.min(i,t)),o=he(r);for(let c=0;c<o.length;c++){let h=o[c];for(let d=0;d<h.length;d++){let u=h[d],p=u.colSpan??1;p>1&&d<n&&n<d+p&&(u.colSpan=p+1);}}let s=n>0?n-1:0,a=n<i?n:i-1;for(let c=0;c<o.length;c++)o[c].splice(n,0,yo(r[c]?.[s],r[c]?.[a]));let l=[...e];return l.splice(n,0,e[s]??140),{cells:o,colWidths:l}}function rn(r,e,t){let i=r.length;if(i<=1)return null;let n=Math.max(0,Math.min(i-1,t)),o=he(r),s=o[n];for(let l=0;l<(s?.length??0);l++){let c=s[l],h=c.rowSpan??1;h>1&&o[n+1]?.[l]&&(o[n+1][l]={text:c.text,textColor:c.textColor,fontSize:c.fontSize,bold:c.bold,fillColor:c.fillColor,align:c.align,rowSpan:h-1>1?h-1:void 0,colSpan:c.colSpan});}for(let l=0;l<n;l++)for(let c=0;c<(o[l]?.length??0);c++){let h=o[l][c],d=h.rowSpan??1;d>1&&l+d>n&&(h.rowSpan=d-1>1?d-1:void 0);}o.splice(n,1);let a=[...e];return a.splice(n,1),{cells:o,rowHeights:a}}function sn(r,e,t){let i=r[0]?.length??0;if(i<=1)return null;let n=Math.max(0,Math.min(i-1,t)),o=he(r);for(let a=0;a<o.length;a++){let l=o[a],c=l[n];if(c){let h=c.colSpan??1;h>1&&l[n+1]&&(l[n+1]={text:c.text,textColor:c.textColor,fontSize:c.fontSize,bold:c.bold,fillColor:c.fillColor,align:c.align,rowSpan:c.rowSpan,colSpan:h-1>1?h-1:void 0});}for(let h=0;h<n;h++){let d=l[h],u=d.colSpan??1;u>1&&h+u>n&&(d.colSpan=u-1>1?u-1:void 0);}l.splice(n,1);}let s=[...e];return s.splice(n,1),{cells:o,colWidths:s}}function ie(r,e,t){let i=r.cells[e]?.[t],n=i?.rowSpan??1,o=i?.colSpan??1,s=r.colWidths.slice(0,t).reduce((h,d)=>h+d,0),a=r.rowHeights.slice(0,e).reduce((h,d)=>h+d,0),l=r.colWidths.slice(t,t+o).reduce((h,d)=>h+d,0),c=r.rowHeights.slice(e,e+n).reduce((h,d)=>h+d,0);return {ox:s,oy:a,width:l,height:c}}function gi(r,e,t){if(e<0||t<0||e>r.width||t>r.height)return null;let i=ze(r.cells),n=-1,o=0;for(let a=0;a<r.rowHeights.length;a++)if(o+=r.rowHeights[a],t<o){n=a;break}n===-1&&(n=r.rowHeights.length-1);let s=-1;o=0;for(let a=0;a<r.colWidths.length;a++)if(o+=r.colWidths[a],e<o){s=a;break}if(s===-1&&(s=r.colWidths.length-1),i[n]?.[s])for(let a=0;a<=n;a++)for(let l=0;l<=s;l++){let c=r.cells[a]?.[l],h=c?.rowSpan??1,d=c?.colSpan??1;if((h>1||d>1)&&a+h>n&&l+d>s)return {row:a,col:l}}return {row:n,col:s}}var Dr={strokeColor:"#1f2937",fillColor:"#f8fafc",fillOpacity:.9,strokeWidth:2,strokeDash:null},fi={rectangle:{width:120,height:60},"rounded-rectangle":{width:120,height:60,borderRadius:8},circle:{width:80,height:80},ellipse:{width:100,height:70},diamond:{width:100,height:80},triangle:{width:100,height:90},hexagon:{width:100,height:90},parallelogram:{width:120,height:60},trapezoid:{width:120,height:70},pentagon:{width:100,height:90},octagon:{width:100,height:90},star:{width:100,height:100},cylinder:{width:100,height:110},cloud:{width:140,height:90},heart:{width:100,height:95},"block-arrow-right":{width:140,height:80},"block-arrow-left":{width:140,height:80},"block-arrow-up":{width:80,height:140},"block-arrow-down":{width:80,height:140},"block-arrow-double":{width:150,height:80},"right-triangle":{width:100,height:90},cross:{width:90,height:90},"speech-rect":{width:130,height:92},"speech-round":{width:130,height:92},cube:{width:110,height:110},sector:{width:100,height:100},delay:{width:120,height:80},"predefined-process":{width:130,height:80},document:{width:120,height:90},stadium:{width:130,height:60},"class-catalog":{width:160,height:90},chevron:{width:110,height:80},"brace-left":{width:220,height:120},"brace-right":{width:220,height:120},envelope:{width:120,height:84},checkbox:{width:90,height:90},"triangular-pyramid":{width:100,height:100},"quadrangular-pyramid":{width:110,height:110},cuboid:{width:150,height:90},sphere:{width:100,height:100},ellipsoid:{width:130,height:90},pie:{width:130,height:90},"hollow-pie":{width:130,height:90},"sticky-note":{width:140,height:140},icon:{width:48,height:48},image:{width:320,height:240}},ee=14,V=22,ge=36,ne=14,_=8,yi=160,Hr=["rectangle","rounded-rectangle","circle","ellipse","diamond","triangle","hexagon","parallelogram","trapezoid","pentagon","octagon","star","cylinder","cloud","heart","block-arrow-right","block-arrow-left","block-arrow-up","block-arrow-down","block-arrow-double","right-triangle","cross","speech-rect","speech-round","cube","sector","delay","predefined-process","document","stadium","class-catalog","chevron","brace-left","brace-right","envelope","checkbox","triangular-pyramid","quadrangular-pyramid","cuboid","sphere","ellipsoid","pie","hollow-pie","sticky-note","icon","uml-class","uml-interface","mind-map","table","image"];function an(r){return Hr.includes(r)}function Te(r,e,t,i,n){let o=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,s=fi[r]||{width:120,height:60},a=n?.width??s.width,l=n?.height??s.height,c=n?n.width/2:s.radius??a/2,h=s.borderRadius??8,d=t??{...Dr};switch(r){case "rounded-rectangle":return {id:o,type:"rounded-rectangle",x:e.x,y:e.y,width:a,height:l,borderRadius:h,rotation:0,style:d};case "circle":return {id:o,type:"circle",x:e.x,y:e.y,radius:c,rotation:0,style:d};case "ellipse":return {id:o,type:"ellipse",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "diamond":return {id:o,type:"diamond",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "triangle":return {id:o,type:"triangle",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "hexagon":return {id:o,type:"hexagon",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "parallelogram":return {id:o,type:"parallelogram",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "trapezoid":return {id:o,type:"trapezoid",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "pentagon":return {id:o,type:"pentagon",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "octagon":return {id:o,type:"octagon",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "star":return {id:o,type:"star",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "icon":return {id:o,type:"icon",iconId:go,x:e.x,y:e.y,width:a,height:l,rotation:0,style:{...d,strokeColor:ft,fillColor:ft,fillOpacity:1}};case "image":return {id:o,type:"image",src:"",x:e.x,y:e.y,width:a,height:l,rotation:0,borderRadius:4,style:{...d,strokeColor:"transparent",fillColor:"#f3f4f6",fillOpacity:1}};case "sticky-note":return {id:o,type:"sticky-note",x:e.x,y:e.y,width:a,height:l,rotation:0,style:co(d,i)};case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":return {id:o,type:r,x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "uml-class":{let u="ClassName",p=[{id:`attr_${Date.now()}_1`,visibility:"+",name:"field",type:"string"}],g=[{id:`meth_${Date.now()}_1`,visibility:"+",name:"method",params:"param",returnType:"void"}],{width:m,height:f}=n??cn(u,p,g);return {id:o,type:"uml-class",x:e.x,y:e.y,width:m,height:f,className:u,attributes:p,methods:g,rotation:0,style:{...d,fillColor:"#ffffff"}}}case "uml-interface":{let u="Interface",p=[{id:`meth_${Date.now()}_1`,visibility:"+",name:"method",params:"type",returnType:"type"}],{width:g,height:m}=n??bi(u,p);return {id:o,type:"uml-interface",x:e.x,y:e.y,width:g,height:m,className:u,methods:p,rotation:0,style:{...d,fillColor:"#ffffff"}}}case "mind-map":{let u=f=>`mm_${f}_${Date.now()}_${Math.random().toString(36).substr(2,6)}`,p={id:u("root"),text:le("mindmap.defaultRoot"),children:[{id:u("b1"),text:le("mindmap.defaultBranch")},{id:u("b2"),text:le("mindmap.defaultBranch")},{id:u("b3"),text:le("mindmap.defaultBranch")}]},{width:g,height:m}=N(p);return {id:o,type:"mind-map",x:e.x,y:e.y,width:g,height:m,root:p,rotation:0,style:{...d,fillColor:"#ffffff"}}}case "table":{let u=[140,140,140],p=[36,36,36];return {id:o,type:"table",x:e.x,y:e.y,width:et(u),height:tt(p),colWidths:u,rowHeights:p,cells:Mt(3,3,false),rotation:0,style:{...d,fillColor:"#ffffff",strokeWidth:2}}}default:return {id:o,type:"rectangle",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d}}}var Rr=new Set(["table","mind-map"]);function ln(r,e){if(!(!e||e.type!==r)&&!Rr.has(r)){if(r==="circle"){let t=e.radius;return typeof t=="number"&&t>0?{width:t*2,height:t*2}:void 0}if("width"in e&&"height"in e){let{width:t,height:i}=e;if(t>0&&i>0)return {width:t,height:i}}}}function cn(r,e,t){let i=ee*.6,n=[r];for(let d of e)n.push(Ee(d));for(let d of t)n.push(xe(d));let s=Math.max(...n.map(d=>d.length),0)*i+ne*2,a=Math.max(yi,s),l=e.length>0?e.length*V+_*2:_*2,c=t.length>0?t.length*V+_*2:_*2,h=ge+l+c;return {width:a,height:h}}function bi(r,e){let t=ee*.6,i=[r,...e.map(a=>xe(a))],n=Math.max(...i.map(a=>a.length),0),o=Math.max(yi,n*t+ne*2),s=e.length>0?e.length*V+_*2:_*2;return {width:o,height:ge+s}}var Er=new Set(["rectangle","rounded-rectangle","circle","ellipse","diamond","triangle","hexagon","parallelogram","trapezoid","pentagon","octagon","star","cylinder","cloud","heart","block-arrow-right","block-arrow-left","block-arrow-up","block-arrow-down","block-arrow-double","right-triangle","cross","speech-rect","speech-round","cube","sector","delay","predefined-process","document","stadium","class-catalog","chevron","brace-left","brace-right","envelope","checkbox","triangular-pyramid","quadrangular-pyramid","cuboid","sphere","ellipsoid","pie","hollow-pie","sticky-note","icon"]),mi=12,Nr=5,A=class extends X{type;pressPoint=null;draftId=null;dragging=false;constructor(e,t){super(e),this.type=t;}onPointerDown(e,t){let i=this.type==="sticky-note"?this.context.getStickyNoteColor():void 0;this.pressPoint=e,this.dragging=false,this.draftId=null;let n=Te(this.type,e,void 0,i);this.context.commitHistory(),this.context.addShape(n),this.context.selectShape(n.id,false),this.draftId=n.id;}onPointerMove(e,t){if(!this.pressPoint||!this.draftId||!Er.has(this.type))return;let i=e.x-this.pressPoint.x,n=e.y-this.pressPoint.y;if(!this.dragging){let d=this.context.getCamera().getZoom();if(Math.hypot(i,n)*d<Nr)return;this.dragging=true;}if(!this.context.getShapes().find(d=>d.id===this.draftId))return;let s=fi[this.type]||{width:120,height:60},a=i===0?0:i<0?-1:1,l=n===0?0:n<0?-1:1;if(this.type==="circle"){let d=Math.max(Math.abs(i),Math.abs(n))/2;this.context.updateShape(this.draftId,{x:this.pressPoint.x+a*d,y:this.pressPoint.y+l*d,radius:Math.max(d,mi/2)});return}let c=Math.abs(i),h=Math.abs(n);if(t.shiftKey){let d=s.height/s.width;c/s.width>=h/(s.width*d)?h=c*d:c=h/d;}c=Math.max(c,mi),h=Math.max(h,mi),this.context.updateShape(this.draftId,{x:this.pressPoint.x+a*c/2,y:this.pressPoint.y+l*h/2,width:c,height:h,...this.type==="rounded-rectangle"?{borderRadius:Math.min(16,(s.borderRadius??8)*Math.max(1,c/s.width))}:{}});}onPointerUp(e,t){this.pressPoint=null,this.draftId=null,this.dragging=false,this.context.setActiveTool("select");}onKeyDown(e){if(e.key==="Escape"&&this.dragging&&this.pressPoint&&this.draftId){let t=fi[this.type]||{width:120,height:60};this.context.getShapes().find(n=>n.id===this.draftId)&&(this.type==="circle"?this.context.updateShape(this.draftId,{x:this.pressPoint.x,y:this.pressPoint.y,radius:t.radius??t.width/2}):this.context.updateShape(this.draftId,{x:this.pressPoint.x,y:this.pressPoint.y,width:t.width,height:t.height,...this.type==="rounded-rectangle"?{borderRadius:t.borderRadius??8}:{}})),this.pressPoint=null,this.draftId=null,this.dragging=false;}}onKeyUp(e){}hasTransientState(){return this.dragging}cancelTransient(){return this.dragging?(this.pressPoint=null,this.draftId=null,this.dragging=false,true):false}getCursor(e){return this.context.getMindMapCursorHitAtPoint(e)?"pointer":"crosshair"}};var xi={n:"top",e:"right",s:"bottom",w:"left"},It={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}};function dn(r,e,t){return Tt(r,e,t?It[xi[t]]:void 0)}function Tt(r,e,t){let i=e.x-r.x,n=e.y-r.y;return t&&t.x!==0?i>=0?"left":"right":t&&t.y!==0?n>=0?"top":"bottom":Math.abs(i)>=Math.abs(n)?i>=0?"left":"right":n>=0?"top":"bottom"}function wo(r,e,t){switch(t){case "top":return {x:r.x,y:r.y-e.height/2};case "bottom":return {x:r.x,y:r.y+e.height/2};case "left":return {x:r.x-e.width/2,y:r.y};case "right":return {x:r.x+e.width/2,y:r.y}}}function q(r,e,t,i=.5){let n=Math.min(r.x,e.x),o=Math.max(r.x,e.x),s=Math.min(r.y,e.y),a=Math.max(r.y,e.y);return n<t.x+t.width-i&&o>t.x+i&&s<t.y+t.height-i&&a>t.y+i}function hn(r,e,t,i,n){let o=t==="x"?e.x:e.y,s=t==="x"?e.x+e.width:e.y+e.height;if(r>o&&r<s){let a=o-n,l=s+n;return Math.abs(i-a)<=Math.abs(i-l)?a:l}return r}function So(r,e,t,i,n,o){let s=e.x-r.x,a=e.y-r.y;if((Math.abs(s)<1||Math.abs(a)<1)&&!(n?.box&&q(r,e,n.box)||o?.box&&q(r,e,o.box)))return [e];let l=r.x+s/2,c=r.y+a/2,h=(p,g)=>{if(!g)return false;let m=r;for(let f of p){if(q(m,f,g))return true;m=f;}return false},d=p=>{if(!(p==="H"?!!n?.n&&n.n.x!==0&&!!o?.n&&o.n.x!==0:!!n?.n&&n.n.y!==0&&!!o?.n&&o.n.y!==0))return null;let m=[n?.box,o?.box].filter(S=>!!S);if(m.length===0)return null;if(p==="H"){let S=Math.min(r.y,e.y,...m.map(U=>U.y))-i,C=Math.max(r.y,e.y,...m.map(U=>U.y+U.height))+i,v=Math.abs(r.y-S)+Math.abs(e.y-S),k=Math.abs(r.y-C)+Math.abs(e.y-C),L=v<=k?S:C,E=[{x:r.x,y:L},{x:e.x,y:L},e];return h(E,n?.box)||h(E,o?.box)?null:E}let f=Math.min(r.x,e.x,...m.map(S=>S.x))-i,b=Math.max(r.x,e.x,...m.map(S=>S.x+S.width))+i,x=Math.abs(r.x-f)+Math.abs(e.x-f),I=Math.abs(r.x-b)+Math.abs(e.x-b),T=x<=I?f:b,w=[{x:T,y:r.y},{x:T,y:e.y},e];return h(w,n?.box)||h(w,o?.box)?null:w},u=p=>{let g;p==="H"?(g=Math.max(r.x,Math.min(l,e.x)),n?.box&&n.n&&n.n.x!==0&&(n.n.x<0&&g>r.x&&(g=r.x),n.n.x>0&&g<r.x&&(g=r.x)),o?.box&&o.n&&o.n.x!==0&&(o.n.x<0&&g>e.x&&(g=e.x),o.n.x>0&&g<e.x&&(g=e.x)),n?.box&&q({x:g,y:r.y},{x:g,y:e.y},n.box)&&(g=n.n&&n.n.x!==0?r.x:hn(g,n.box,"x",e.x,i)),o?.box&&q({x:g,y:r.y},{x:g,y:e.y},o.box)&&(g=o.n&&o.n.x!==0?e.x:hn(g,o.box,"x",r.x,i)),n?.box&&q(r,{x:g,y:r.y},n.box)?g=r.x:o?.box&&q({x:g,y:e.y},e,o.box)&&(g=e.x)):(g=Math.max(r.y,Math.min(c,e.y)),n?.box&&n.n&&n.n.y!==0&&(n.n.y<0&&g>r.y&&(g=r.y),n.n.y>0&&g<r.y&&(g=r.y)),o?.box&&o.n&&o.n.y!==0&&(o.n.y<0&&g>e.y&&(g=e.y),o.n.y>0&&g<e.y&&(g=e.y)),n?.box&&q({x:r.x,y:g},{x:e.x,y:g},n.box)&&(g=n.n&&n.n.y!==0?r.y:hn(g,n.box,"y",e.y,i)),o?.box&&q({x:r.x,y:g},{x:e.x,y:g},o.box)&&(g=o.n&&o.n.y!==0?e.y:hn(g,o.box,"y",r.y,i)),n?.box&&q(r,{x:r.x,y:g},n.box)?g=r.y:o?.box&&q({x:e.x,y:g},e,o.box)&&(g=e.y));let m=p==="H"?[{x:g,y:r.y},{x:g,y:e.y},e]:[{x:r.x,y:g},{x:e.x,y:g},e],f=!!n?.box&&(q(r,m[0],n.box)||q(m[0],m[1],n.box)||q(m[1],e,n.box))||!!o?.box&&(q(r,m[0],o.box)||q(m[0],m[1],o.box)||q(m[1],e,o.box));return {pts:m,crosses:f}};if(t){let p=u(t);if(p.crosses&&(n?.box||o?.box)){let g=u(t==="H"?"V":"H");if(!g.crosses)return g.pts;let m=d(t);if(m)return m}return p.pts}return Math.abs(s)>=Math.abs(a)?[{x:l,y:r.y},{x:l,y:e.y},e]:[{x:r.x,y:c},{x:e.x,y:c},e]}var wi=24;function Br(r,e){if(r.length<2)return r;let t=r[r.length-1],i=r[r.length-2],n=Math.abs(t.y-i.y)<1e-6;if(e==="H"?n:!n)return r;let o=e==="H"?{x:i.x,y:t.y}:{x:t.x,y:i.y},s=r.slice(0,-1);return s.push(o,t),s}function vt(r,e={},t=wi,i=r.length===2){if(r.length<2)return r;let n=[];n.push(r[0]);let o=r.length-1,s=t,a=r[0],l=r[o];e.fromN&&e.toN&&(e.fromN.x!==0&&e.toN.x!==0?s=Math.min(s,Math.abs(l.x-a.x)/2):e.fromN.y!==0&&e.toN.y!==0&&(s=Math.min(s,Math.abs(l.y-a.y)/2)));for(let c=1;c<r.length;c++){let h=r[c-1],d=r[c],u=c===1,p=c===o,g=u&&e.fromN?{x:h.x+e.fromN.x*s,y:h.y+e.fromN.y*s}:h,m=p&&e.toN?{x:d.x+e.toN.x*s,y:d.y+e.toN.y*s}:d;u&&e.fromN&&n.push(g);let f=u?e.fromN:void 0,b=p?e.toN:void 0,x=b?b.x!==0?"H":"V":f?f.x!==0?"H":"V":void 0,I=i&&u&&e.fromN&&e.fromBox?{box:e.fromBox,n:e.fromN}:void 0,T=i&&p&&e.toN&&e.toBox?{box:e.toBox,n:e.toN}:void 0,w=So(g,m,x,s,I,T);x&&(w=Br(w,x));for(let S of w)n.push(S);p&&e.toN&&n.push(d);}return dt(n)}var Si=14,Mi=200,un=class extends X{type="eraser";erasing=false;lastPoint=null;erasedIds=new Set;onPointerDown(e){this.erasing=true,this.lastPoint=e,this.erasedIds.clear(),this.context.commitHistory(),this.context.setEraserPoint(e),this.eraseAt(e);}onPointerMove(e){if(!this.erasing||!this.lastPoint)return;let t=this.lastPoint,i=Math.hypot(e.x-t.x,e.y-t.y),n=Math.max(1,Math.ceil(i/Math.max(this.brushRadius()*.5,1)));for(let o=1;o<=n;o++){let s=o/n;this.eraseAt({x:t.x+(e.x-t.x)*s,y:t.y+(e.y-t.y)*s});}this.lastPoint=e,this.context.setEraserPoint(e);}onPointerUp(){this.erasing=false,this.lastPoint=null,this.erasedIds.clear(),this.context.setEraserPoint(null);}onKeyDown(){}onKeyUp(){}getCursor(){return this.erasing?"grabbing":"crosshair"}dispose(){this.erasing=false,this.lastPoint=null,this.erasedIds.clear(),this.context.setEraserPoint(null);}brushRadius(){return Si/this.context.getCamera().getZoom()}eraseAt(e){let t=this.context.getShapesInBrushRadius(e,this.brushRadius());for(let i of t)this.erasedIds.has(i.id)||(this.erasedIds.add(i.id),this.context.eraseShape(i.id));}};var ot=[3,2.2];function de(r,e,t){let i=o=>(o-.5)*e,n=o=>(o-.5)*t;return r.map(o=>o[0]==="Z"?o:o[0]==="M"||o[0]==="L"?[o[0],i(o[1]),n(o[2])]:["C",i(o[1]),n(o[2]),i(o[3]),n(o[4]),i(o[5]),n(o[6])])}function G(r,e,t,i,n,o,s){let a=[],l=o-n,c=Math.max(1,Math.ceil(Math.abs(l)/90)),h=l/c,d=4/3*Math.tan(h*Math.PI/180/4),u=m=>{let f=m*Math.PI/180;return [r+t*Math.cos(f),e+i*Math.sin(f)]},[p,g]=u(n);a.push(s?["M",p,g]:["L",p,g]);for(let m=0;m<c;m++){let f=n+h*m,b=f+h,x=f*Math.PI/180,I=b*Math.PI/180,[T,w]=u(f),[S,C]=u(b);a.push(["C",T-d*t*Math.sin(x),w+d*i*Math.cos(x),S+d*t*Math.sin(I),C-d*i*Math.cos(I),S,C]);}return a}function _r(r){let e=1/0,t=1/0,i=-1/0,n=-1/0,o=(p,g)=>{p<e&&(e=p),g<t&&(t=g),p>i&&(i=p),g>n&&(n=g);},s=0,a=0,l=0,c=0;for(let p of r){if(p[0]==="Z"){o(l,c);continue}if(p[0]==="M"||p[0]==="L"){s=p[1],a=p[2],p[0]==="M"&&(l=s,c=a),o(s,a);continue}let g=p[1],m=p[2],f=p[3],b=p[4],x=p[5],I=p[6];for(let T=0;T<=12;T++){let w=T/12,S=1-w,C=S*S*S,v=3*S*S*w,k=3*S*w*w,L=w*w*w;o(C*s+v*g+k*f+L*x,C*a+v*m+k*b+L*I);}s=x,a=I;}let h=i-e||1,d=n-t||1,u=(p,g)=>[(p-e)/h,(g-t)/d];return r.map(p=>{if(p[0]==="Z")return p;if(p[0]==="M"||p[0]==="L"){let[T,w]=u(p[1],p[2]);return [p[0],T,w]}let[g,m]=u(p[1],p[2]),[f,b]=u(p[3],p[4]),[x,I]=u(p[5],p[6]);return ["C",g,m,f,b,x,I]})}function Vr(){let r={x:.24,y:.7,r:.24},e={x:.5,y:.48,r:.36},t={x:.76,y:.7,r:.24},i=[...G(r.x,r.y,r.r,r.r,90,246,true),...G(e.x,e.y,e.r,e.r,180,360,false),...G(t.x,t.y,t.r,t.r,294,450,false),["Z"]];return _r(i)}var Q=.14,Ti=.5523,nt=Q*Ti,kt=1-Q,it=.5-.5*Ti,$r={outline:[["M",0,Q],["L",0,kt],["C",0,kt+nt,it,1,.5,1],["C",1-it,1,1,kt+nt,1,kt],["L",1,Q],["C",1,Q-nt,1-it,0,.5,0],["C",it,0,0,Q-nt,0,Q],["Z"]],seams:[[["M",0,Q],["C",0,Q+nt,it,Q*2,.5,Q*2],["C",1-it,Q*2,1,Q+nt,1,Q]]],hiddenSeams:[G(.5,kt,.5,Q,180,360,true)]},Or={outline:Vr()},zr={outline:[["M",.5,.97],["C",.5,.97,.03,.66,.03,.35],["C",.03,.17,.16,.04,.31,.04],["C",.41,.04,.47,.1,.5,.17],["C",.53,.1,.59,.04,.69,.04],["C",.84,.04,.97,.17,.97,.35],["C",.97,.66,.5,.97,.5,.97],["Z"]]},pn=[["M",0,.25],["L",.58,.25],["L",.58,0],["L",1,.5],["L",.58,1],["L",.58,.75],["L",0,.75],["Z"]];function Ci(r,e){let t=(i,n)=>{switch(e){case "down":return [1-n,i];case "left":return [1-i,1-n];case "up":return [n,1-i];default:return [i,n]}};return r.map(i=>{if(i[0]==="Z")return i;if(i[0]==="M"||i[0]==="L"){let[h,d]=t(i[1],i[2]);return [i[0],h,d]}let[n,o]=t(i[1],i[2]),[s,a]=t(i[3],i[4]),[l,c]=t(i[5],i[6]);return ["C",n,o,s,a,l,c]})}var gn={right:pn,left:Ci(pn,"left"),up:Ci(pn,"up"),down:Ci(pn,"down")},Gr={outline:[["M",0,0],["L",0,1],["L",1,1],["Z"]]},Ur={outline:[["M",.34,0],["L",.66,0],["L",.66,.34],["L",1,.34],["L",1,.66],["L",.66,.66],["L",.66,1],["L",.34,1],["L",.34,.66],["L",0,.66],["L",0,.34],["L",.34,.34],["Z"]]},Wr={outline:[["M",0,.5],["L",.22,.13],["L",.22,.34],["L",.78,.34],["L",.78,.13],["L",1,.5],["L",.78,.87],["L",.78,.66],["L",.22,.66],["L",.22,.87],["Z"]]},Fr={outline:[["M",0,0],["L",1,0],["L",1,.8],["L",.32,.8],["L",.2,1],["L",.15,.8],["L",0,.8],["Z"]]},Kr={outline:[...G(.5,.4,.5,.4,100,-228,true),["L",.19,1],["Z"]]},Mo={outline:[["M",.5,0],["L",1,.25],["L",1,.75],["L",.5,1],["L",0,.75],["L",0,.25],["Z"]],seams:[[["M",.5,.5],["L",.5,1]],[["M",.5,.5],["L",0,.25]],[["M",.5,.5],["L",1,.25]]],hiddenSeams:[[["M",.5,.5],["L",.5,0]],[["M",.5,.5],["L",0,.75]],[["M",.5,.5],["L",1,.75]]]},Yr={outline:[...G(.5,.5,.5,.5,0,-270,true),["L",.5,.5],["Z"]]},Xr={outline:[["M",0,0],...G(.6,.5,.4,.5,270,450,false),["L",0,1],["Z"]]},Zr={outline:[["M",0,0],["L",1,0],["L",1,1],["L",0,1],["Z"]],seams:[[["M",.12,0],["L",.12,1]],[["M",.88,0],["L",.88,1]]]},jr={outline:[["M",0,0],["L",1,0],["L",1,.84],["C",.72,1.06,.28,.62,0,.84],["Z"]]},qr={outline:[["M",0,0],["L",1,0],["L",1,1-re],["L",1-re,1],["L",0,1],["Z"]],shadow:ho,overlays:[{cmds:[["M",1-re,1],["L",1-re,1-re],["L",1,1-re],["Z"]],fill:"auto",deriveFill:lo}]},Jr={outline:[["M",0,0],["L",.45,0],["L",1,.5],["L",.45,1],["L",0,1],["L",.42,.5],["Z"]]};function Qr(r){let e=t=>1-t;return r.map(t=>t[0]==="Z"?t:t[0]==="M"||t[0]==="L"?[t[0],e(t[1]),t[2]]:["C",e(t[1]),t[2],e(t[3]),t[4],e(t[5]),t[6]])}var Pt=.16,Io={outline:[["M",.015,.02],["C",.075,.02,.1,.08,.1,.2],["C",.1,.36,.125,.5,.16,.5],["C",.125,.5,.1,.64,.1,.8],["C",.1,.92,.075,.98,.015,.98]],strokeOnly:true},es={outline:Qr(Io.outline),strokeOnly:true};function fn(r){if(r.type!=="brace-left"&&r.type!=="brace-right")return 0;let e=(r.width??0)*Pt/2;return r.type==="brace-left"?e:-e}var ts={outline:[["M",0,0],["L",1,0],["L",1,1],["L",0,1],["Z"]],seams:[[["M",.1,0],["L",.1,1]],[["M",.9,0],["L",.9,1]]]},ns={outline:[["M",0,0],["L",1,0],["L",1,1],["L",0,1],["Z"]],seams:[[["M",0,0],["L",1,1]],[["M",1,0],["L",0,1]]]},J=.12,ve=J*Ti,is={outline:[["M",J,0],["L",1-J,0],["C",1-J+ve,0,1,ve,1,J],["L",1,1-J],["C",1,1-J+ve,1-J+ve,1,1-J,1],["L",J,1],["C",J-ve,1,0,1-J+ve,0,1-J],["L",0,J],["C",0,J-ve,J-ve,0,J,0],["Z"]],seams:[[["M",.26,.53],["L",.43,.72],["L",.77,.29]]]},os={outline:[["M",.5,.03],["L",.94,.75],["L",.5,.97],["L",.06,.75],["Z"]],seams:[[["M",.5,.03],["L",.5,.97]]],hiddenSeams:[[["M",.06,.75],["L",.94,.75]]]},rs={outline:[["M",.5,.03],["L",.96,.74],["L",.5,.97],["L",.04,.74],["Z"]],seams:[[["M",.5,.03],["L",.5,.97]]],hiddenSeams:[[["M",.5,.51],["L",.04,.74]],[["M",.5,.51],["L",.96,.74]]]},ss={outline:G(.5,.5,.5,.5,0,360,true),seams:[G(.5,.5,.5,Q,0,180,true)],hiddenSeams:[G(.5,.5,.5,Q,180,360,true)]},Se=.5,me=.35,ke=.3,j=me;function Co(r){let e=r*Math.PI/180;return [["M",.5,j],["L",.5+Se*Math.cos(e),j+me*Math.sin(e)]]}var as={outline:[...G(.5,j,Se,me,180,0,true),["L",1,j+ke],...G(.5,j+ke,Se,me,0,180,false),["L",0,j],["Z"]],seams:[G(.5,j,Se,me,180,360,true),Co(300),Co(120)],hiddenSeams:[G(.5,j+ke,Se,me,180,360,true)]},mn=.2,Ii=.14,ls={outline:[...G(.5,j,Se,me,180,0,true),["L",1,j+ke],...G(.5,j+ke,Se,me,0,180,false),["L",0,j],["Z"],...G(.5,j,mn,Ii,0,180,true),["L",.5-mn,j+ke],...G(.5,j+ke,mn,Ii,180,0,false),["Z"]],seams:[G(.5,j,Se,me,180,360,true),G(.5,j,mn,Ii,180,360,true)],hiddenSeams:[G(.5,j+ke,Se,me,180,360,true)]};function Lt(r){switch(r){case "cylinder":return $r;case "envelope":return ns;case "checkbox":return is;case "cuboid":return Mo;case "triangular-pyramid":return os;case "quadrangular-pyramid":return rs;case "sphere":case "ellipsoid":return ss;case "pie":return as;case "hollow-pie":return ls;case "cloud":return Or;case "heart":return zr;case "class-catalog":return ts;case "block-arrow-right":return {outline:gn.right};case "block-arrow-left":return {outline:gn.left};case "block-arrow-up":return {outline:gn.up};case "block-arrow-down":return {outline:gn.down};case "block-arrow-double":return Wr;case "right-triangle":return Gr;case "cross":return Ur;case "speech-rect":return Fr;case "speech-round":return Kr;case "cube":return Mo;case "sector":return Yr;case "delay":return Xr;case "predefined-process":return Zr;case "document":return jr;case "sticky-note":return qr;case "chevron":return Jr;case "brace-left":return Io;case "brace-right":return es;default:return}}function cs(r){if(r.length===0)return null;if(r.length===1)return r[0];let e=0;for(let n=1;n<r.length;n++)e+=Math.hypot(r[n].x-r[n-1].x,r[n].y-r[n-1].y);let t=0,i=e/2;for(let n=1;n<r.length;n++){let o=r[n-1],s=r[n],a=Math.hypot(s.x-o.x,s.y-o.y);if(t+a>=i&&a>1e-6){let l=(i-t)/a;return {x:o.x+(s.x-o.x)*l,y:o.y+(s.y-o.y)*l}}t+=a;}return r[r.length-1]}var Ge=class r{ctx;width=0;height=0;dpr=window.devicePixelRatio||1;showGrid=false;textLayoutCache=new Map;tableSelection=null;setTableSelection(e){this.tableSelection=e;}hoverShapeId=null;multiSelection=false;static TEXT_CACHE_LIMIT=500;constructor(e,t){let i=e.getContext("2d");if(!i)throw new Error("Failed to get Canvas 2D context");this.ctx=i,typeof t=="number"&&t>0&&(this.dpr=t);}resize(e,t){let i=Math.max(1,Math.round(e*this.dpr)/this.dpr),n=Math.max(1,Math.round(t*this.dpr)/this.dpr);this.width=i,this.height=n;let o=Math.round(i*this.dpr),s=Math.round(n*this.dpr);(this.ctx.canvas.width!==o||this.ctx.canvas.height!==s)&&(this.ctx.canvas.width=o,this.ctx.canvas.height=s,this.ctx.canvas.style.width=`${i}px`,this.ctx.canvas.style.height=`${n}px`);}setShowGrid(e){this.showGrid=e;}render(e,t,i,n,o,s,a,l,c,h,d,u,p,g,m){let f=this.ctx,b=t.getZoom(),x=t.x,I=t.y;this.hoverShapeId=p??null,f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),f.setLineDash([]),f.lineCap="butt",f.lineJoin="miter",f.globalAlpha=1,u&&(f.fillStyle=u,f.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height));let T=this.dpr*b;f.setTransform(T,0,0,T,T*x,T*I),this.showGrid&&this.drawGrid(f,b,x,I);let w=null;for(let C of e)if(C.type==="arrow"&&(C.startBinding||C.endBinding)){w=new Map,e.forEach(v=>w.set(v.id,v));break}let S=w??new Map;this.multiSelection=i.size>1,e.forEach(C=>{f.save();let v=m?.get(C.id);v!==void 0&&(f.globalAlpha=f.globalAlpha*Math.max(0,Math.min(1,v))),f.translate(C.x,C.y),f.rotate(C.rotation),(C.flipX||C.flipY)&&f.scale(C.flipX?-1:1,C.flipY?-1:1);let k=i.has(C.id);this.drawShape(f,C,k,b,S,c,h,d),f.restore();}),i.size>0&&this.drawGroupFrames(f,e,i,b),this.multiSelection&&this.drawMultiSelectionBounds(f,e,i,b);for(let C of this.visibleLockBadges(e,i,b))this.drawLockBadgeAt(f,C.x,C.y,b);if(a&&this.drawGenerationPreview(f,a,b,e,S),p&&!i.has(p)){let C=e.find(v=>v.id===p);C&&this.drawConnectionDots(f,this.getShapeWorldBounds(C),b,.6);}if(g&&!i.has(g)){let C=e.find(v=>v.id===g);if(C){let v=this.getConnectorRoute(C,S);v.length>=2&&this.drawLinearHighlight(f,v,b,.22,9);}}n&&this.drawBrushRect(f,n,b),o&&o.length>0&&this.drawSnapGuides(f,o,b),s&&this.drawConnectingTargetHighlight(f,s,e,b),l&&this.drawEraserBrush(f,l,b),f.setTransform(1,0,0,1,0,0);}drawEraserBrush(e,t,i){let n=Si/i;e.beginPath(),e.arc(t.x,t.y,n,0,Math.PI*2),e.fillStyle=z(H.primary,.12),e.fill(),e.strokeStyle=z(H.primary,.55),e.lineWidth=1.5/i,e.stroke();}drawConnectingTargetHighlight(e,t,i,n){let o=i.find(c=>c.id===t);if(!o||o.type==="line"||o.type==="arrow"||o.type==="draw")return;let s=this.getShapeWorldBounds(o),a=[{x:s.x+s.width/2,y:s.y},{x:s.x+s.width,y:s.y+s.height/2},{x:s.x+s.width/2,y:s.y+s.height},{x:s.x,y:s.y+s.height/2}],l=6/n;e.save(),a.forEach(c=>{e.beginPath(),e.arc(c.x,c.y,l,0,Math.PI*2),e.fillStyle=H.selection.handleFill,e.fill(),e.strokeStyle=H.primary,e.lineWidth=2/n,e.stroke();}),e.restore();}getShapeWorldBounds(e){let t=this.getShapeBounds(e);return {x:e.x+t.x,y:e.y+t.y,width:t.width,height:t.height}}drawBrushRect(e,t,i){e.save(),e.fillStyle=H.brushFill,e.strokeStyle=H.brushStroke,e.lineWidth=1.5/i,e.setLineDash([4/i,4/i]),e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.fill(),e.stroke(),e.restore();}drawGrid(e,t,i,n){let o=-i,s=-n,a=o+this.width/t,l=s+this.height/t,c=20;for(;c*t<10;)c*=2;let h=this.dpr*t,d=Math.max(1,Math.round(c*h)),u=(b,x)=>(b%x+x)%x,p=u(Math.round(i*h),d)+.5,g=u(Math.round(n*h),d)+.5,m=this.width*this.dpr,f=this.height*this.dpr;e.strokeStyle=H.grid,e.lineWidth=1/h,e.setLineDash([]),e.beginPath();for(let b=p;b<=m;b+=d){let x=b/h-i;e.moveTo(x,s),e.lineTo(x,l);}for(let b=g;b<=f;b+=d){let x=b/h-n;e.moveTo(o,x),e.lineTo(a,x);}e.stroke();}drawShape(e,t,i,n,o,s,a,l){switch(this.applyStyle(e,t.style,n),t.type){case "rectangle":this.drawRectangle(e,t,i);break;case "rounded-rectangle":this.drawRoundedRectangle(e,t,i);break;case "circle":this.drawCircle(e,t,i);break;case "ellipse":this.drawEllipse(e,t,i);break;case "diamond":this.drawDiamond(e,t,i);break;case "triangle":this.drawTriangle(e,t,i);break;case "hexagon":this.drawHexagon(e,t,i);break;case "parallelogram":this.drawParallelogram(e,t,i);break;case "trapezoid":this.drawTrapezoid(e,t,i);break;case "pentagon":this.drawPentagon(e,t,i);break;case "octagon":this.drawOctagon(e,t,i);break;case "star":this.drawStar(e,t,i);break;case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "sticky-note":this.drawPathShape(e,t,i,n);break;case "stadium":this.drawStadium(e,t,i);break;case "uml-class":this.drawUmlClass(e,t,i);break;case "uml-interface":this.drawUmlInterface(e,t,i);break;case "mind-map":this.drawMindMap(e,t,i,s,a,l);break;case "table":this.drawTable(e,t,n);break;case "icon":this.drawIcon(e,t);break;case "image":this.drawImageShape(e,t);break;case "line":this.drawLine(e,t,o,i,n);break;case "arrow":this.drawArrow(e,t,o,i,n);break;case "text":this.drawText(e,t);break;case "draw":this.drawFreehand(e,t);break}if(t.text&&t.type!=="text"&&t.type!=="line"&&t.type!=="arrow"&&t.type!=="draw"&&t.type!=="table"&&(t.flipX||t.flipY?(e.save(),e.scale(t.flipX?-1:1,t.flipY?-1:1),this.drawShapeText(e,t),e.restore()):this.drawShapeText(e,t)),i){let c=t.type==="line"||t.type==="arrow";this.multiSelection?this.drawMultiSelectOutline(e,t,n):t.type==="mind-map"?s&&s.shapeId===t.id||this.drawSelectionOutline(e,t,n):c?this.drawSelectionHandles(e,t,n,o):(this.drawSelectionOutline(e,t,n),this.drawSelectionHandles(e,t,n));}t.type==="table"&&(i||this.hoverShapeId===t.id)&&this.drawTableMoveHandle(e,t,n);}drawTableMoveHandle(e,t,i){let n=en(t,i),o=4/i;e.save(),e.setLineDash([]),e.fillStyle="#ffffff",e.strokeStyle=z(H.selection.outline,.55),e.lineWidth=1/i,e.beginPath(),e.roundRect(n.x,n.y,n.width,n.height,o),e.fill(),e.stroke(),e.fillStyle=z(H.selection.outline,.85);let s=1.4/i,a=n.width/3,l=n.height/4;for(let c=1;c<=2;c++)for(let h=1;h<=3;h++)e.beginPath(),e.arc(n.x+a*c,n.y+l*h,s,0,Math.PI*2),e.fill();e.restore();}applyStyle(e,t,i){let n=t.strokeOpacity??1;e.strokeStyle=n<1&&t.strokeColor!=="transparent"?z(t.strokeColor,n):t.strokeColor,e.lineWidth=t.strokeWidth/i,e.lineCap="round",e.lineJoin="round";let o=t.fillOpacity??1;o<1&&t.fillColor!=="transparent"?e.fillStyle=z(t.fillColor,o):e.fillStyle=t.fillColor,t.strokeDash?e.setLineDash(t.strokeDash):e.setLineDash([]);}drawRectangle(e,t,i){e.beginPath(),e.rect(-t.width/2,-t.height/2,t.width,t.height),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawRoundedRectangle(e,t,i){let{width:n,height:o,borderRadius:s}=t;e.beginPath(),e.roundRect(-n/2,-o/2,n,o,s),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawStadium(e,t,i){let{width:n,height:o}=t;e.beginPath(),e.roundRect(-n/2,-o/2,n,o,Math.min(n,o)/2),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawCircle(e,t,i){e.beginPath(),e.arc(0,0,t.radius,0,Math.PI*2),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawEllipse(e,t,i){e.beginPath(),e.ellipse(0,0,t.width/2,t.height/2,0,0,Math.PI*2),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawDiamond(e,t,i){e.beginPath(),e.moveTo(0,-t.height/2),e.lineTo(t.width/2,0),e.lineTo(0,t.height/2),e.lineTo(-t.width/2,0),e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawTriangle(e,t,i){e.beginPath(),e.moveTo(0,-t.height/2),e.lineTo(t.width/2,t.height/2),e.lineTo(-t.width/2,t.height/2),e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawHexagon(e,t,i){let n=t.width/2,o=t.height/2,s=t.orientation==="flat"?Math.PI/6:0;e.beginPath();for(let a=0;a<6;a++){let l=a*Math.PI/3-Math.PI/2+s,c=n*Math.cos(l),h=o*Math.sin(l);a===0?e.moveTo(c,h):e.lineTo(c,h);}e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawParallelogram(e,t,i){let{width:n,height:o}=t,s=n*.2;e.beginPath(),e.moveTo(-n/2+s,-o/2),e.lineTo(n/2,-o/2),e.lineTo(n/2-s,o/2),e.lineTo(-n/2,o/2),e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawTrapezoid(e,t,i){let{width:n,height:o}=t,s=t.topInset??n*.15;e.beginPath(),e.moveTo(-n/2+s,-o/2),e.lineTo(n/2-s,-o/2),e.lineTo(n/2,o/2),e.lineTo(-n/2,o/2),e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawPentagon(e,t,i){let n=t.width/2,o=t.height/2;e.beginPath();for(let s=0;s<5;s++){let a=s*2*Math.PI/5-Math.PI/2,l=n*Math.cos(a),c=o*Math.sin(a);s===0?e.moveTo(l,c):e.lineTo(l,c);}e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawOctagon(e,t,i){let n=t.width/2,o=t.height/2;e.beginPath();for(let s=0;s<8;s++){let a=s*Math.PI/4-Math.PI/8,l=n*Math.cos(a),c=o*Math.sin(a);s===0?e.moveTo(l,c):e.lineTo(l,c);}e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawStar(e,t,i){let n=t.width/2,o=t.height/2,s=5,a=.4;e.beginPath();for(let l=0;l<s*2;l++){let c=l*Math.PI/s-Math.PI/2,h=l%2===0?1:a,d=n*h*Math.cos(c),u=o*h*Math.sin(c);l===0?e.moveTo(d,u):e.lineTo(d,u);}e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawPathShape(e,t,i,n){let o=Lt(t.type);if(o){if(this.tracePath(e,de(o.outline,t.width,t.height)),!o.strokeOnly&&t.style.fillColor!=="transparent"&&(o.shadow?(e.save(),e.shadowColor=z(o.shadow.color,o.shadow.opacity??.2),e.shadowBlur=o.shadow.blur,e.shadowOffsetX=o.shadow.offsetX??0,e.shadowOffsetY=o.shadow.offsetY??0,e.fill(),e.restore()):e.fill()),e.stroke(),o.overlays){let s=e.fillStyle;for(let a of o.overlays){let l=a.fill??"auto";if(l!=="none"){let c=l==="auto"?a.deriveFill?a.deriveFill(t.style.fillColor):t.style.fillColor:l;if(c&&c!=="transparent"){let h=t.style.fillOpacity??1;e.fillStyle=h<1?z(c,h):c,this.tracePath(e,de(a.cmds,t.width,t.height)),e.fill();}}a.stroke!==false&&(this.tracePath(e,de(a.cmds,t.width,t.height)),e.stroke());}e.fillStyle=s;}if(o.seams)for(let s of o.seams)this.tracePath(e,de(s,t.width,t.height)),e.stroke();if(o.hiddenSeams){let s=t.style.strokeWidth||1;e.setLineDash([s*ot[0]/n,s*ot[1]/n]);for(let a of o.hiddenSeams)this.tracePath(e,de(a,t.width,t.height)),e.stroke();e.setLineDash([]);}}}tracePath(e,t){e.beginPath();for(let i of t)switch(i[0]){case "M":e.moveTo(i[1],i[2]);break;case "L":e.lineTo(i[1],i[2]);break;case "C":e.bezierCurveTo(i[1],i[2],i[3],i[4],i[5],i[6]);break;case "Z":e.closePath();break}}drawImageShape(e,t){let i=t.width,n=t.height;if(!(i>0)||!(n>0))return;let o=-i/2,s=-n/2,a=Math.max(0,Math.min(t.borderRadius??0,i/2,n/2)),l=t.src?Vt(t.src):null,c=!!t.src&&Hn(t.src);e.save(),a>0&&(e.beginPath(),e.roundRect(o,s,i,n,a),e.clip()),l?e.drawImage(l.img,o,s,i,n):(e.fillStyle=c?"#fee2e2":"#f3f4f6",e.fillRect(o,s,i,n),e.strokeStyle=c?"#fca5a5":"#e5e7eb",e.lineWidth=1,e.beginPath(),e.moveTo(o,s),e.lineTo(o+i,s+n),e.moveTo(o+i,s),e.lineTo(o,s+n),e.stroke()),e.restore();let h=t.style.strokeWidth??0;t.style.strokeColor&&t.style.strokeColor!=="transparent"&&h>0&&(e.save(),e.beginPath(),a>0?e.roundRect(o,s,i,n,a):e.rect(o,s,i,n),e.strokeStyle=t.style.strokeColor,e.lineWidth=h,e.stroke(),e.restore());}drawIcon(e,t){let i=Ve(t.iconId),n=t.style.fillColor!=="transparent"?t.style.fillColor:t.textColor||"#1f2937";if(e.save(),e.translate(-t.width/2,-t.height/2),e.scale(t.width/K,t.height/K),e.lineCap="round",e.lineJoin="round",!i){e.strokeStyle=n,e.lineWidth=1.4,e.setLineDash([3,3]),e.strokeRect(4,4,K-8,K-8),e.setLineDash([]),e.restore();return}i.disc&&(e.beginPath(),e.arc(K/2,K/2,K/2-1,0,Math.PI*2),e.fillStyle=i.disc,e.fill());for(let s of i.layers){let a=new Path2D(s.d),l=s.fill??"ink",c=s.stroke??"ink";l!=="none"&&(e.fillStyle=l==="ink"?n:l,e.fill(a)),c!=="none"&&(e.strokeStyle=c==="ink"?n:c,e.lineWidth=s.w??1.8,e.stroke(a));}let o=i.label;o&&(e.fillStyle=o.color,e.font=`${o.size??13}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.fillText(o.text,K/2,K/2+.5)),e.restore();}drawUmlClass(e,t,i){let{width:n,height:o,className:s,attributes:a,methods:l}=t,c=n/2,h=o/2,d=ge,u=a.length>0?a.length*V+_*2:_*2;e.beginPath(),e.rect(-c,-h,n,o),t.style.fillColor!=="transparent"&&(e.fillStyle=t.style.fillColor,e.fill()),e.stroke(),e.beginPath(),e.moveTo(-c,-h+d),e.lineTo(c,-h+d),e.moveTo(-c,-h+d+u),e.lineTo(c,-h+d+u),e.stroke(),e.save(),e.textBaseline="middle";let p=n-ne*2,g=x=>{if(e.measureText(x).width<=p)return x;let I="\u2026",T=0,w=x.length;for(;T<w;){let S=T+w+1>>1;e.measureText(x.slice(0,S)+I).width<=p?T=S:w=S-1;}return x.slice(0,T)+I},m=(x,I,T,w,S,C,v)=>{let k=w||ee,L=S||"#1f2937";e.font=`${k}px sans-serif`,e.fillStyle=L,e.textAlign=v;let E=g(x);if(e.fillText(E,I,T),C){let U=e.measureText(E).width,ae=I;e.strokeStyle=L,e.beginPath(),e.moveTo(ae,T),e.lineTo(ae+U,T),e.stroke();}};e.font=`bold ${t.fontSize||ee}px sans-serif`,e.textAlign="center",e.fillStyle=t.textColor||"#1f2937",e.fillText(g(s),0,-h+d/2);let f=-h+d+_+V/2;a.forEach((x,I)=>{let T=Ee(x);T&&m(T,-c+ne,f+I*V,x.fontSize||t.fontSize||0,x.textColor||t.textColor||"",!!x.strikethrough,"left");});let b=-h+d+u+_+V/2;l.forEach((x,I)=>{let T=xe(x);T&&m(T,-c+ne,b+I*V,x.fontSize||t.fontSize||0,x.textColor||t.textColor||"",!!x.strikethrough,"left");}),e.restore();}drawTable(e,t,i){let{width:n,height:o}=t,s=n/2,a=o/2,l=ze(t.cells);t.style.fillColor!=="transparent"&&(e.beginPath(),e.rect(-s,-a,n,o),e.fillStyle=t.style.fillColor,e.fill());for(let c=0;c<t.cells.length;c++)for(let h=0;h<(t.cells[c]?.length??0);h++){if(l[c]?.[h])continue;let d=t.cells[c][h];if(!d.fillColor)continue;let u=ie(t,c,h);e.fillStyle=d.fillColor,e.fillRect(u.ox-s,u.oy-a,u.width,u.height);}e.save(),e.strokeStyle=Jt,e.lineWidth=1/i;for(let c=1;c<t.rowHeights.length;c++){let h=-a+t.rowHeights.slice(0,c).reduce((u,p)=>u+p,0),d=[];for(let u=0;u<c;u++)for(let p=0;p<(t.cells[u]?.length??0);p++){let m=t.cells[u][p].rowSpan??1;if(m>1&&u+m>c){let f=ie(t,u,p);d.push([f.ox-s,f.ox-s+f.width]);}}this.drawSegmentsWithGaps(e,-s,s,h,d,true);}for(let c=1;c<t.colWidths.length;c++){let h=-s+t.colWidths.slice(0,c).reduce((u,p)=>u+p,0),d=[];for(let u=0;u<c;u++)for(let p=0;p<t.cells.length;p++){let g=t.cells[p]?.[u];if(!g)continue;let m=g.colSpan??1;if(m>1&&u+m>c){let f=ie(t,p,u);d.push([f.oy-a,f.oy-a+f.height]);}}this.drawSegmentsWithGaps(e,-a,a,h,d,false);}e.restore(),e.beginPath(),e.rect(-s,-a,n,o),e.stroke(),e.save(),e.textBaseline="middle";for(let c=0;c<t.cells.length;c++)for(let h=0;h<(t.cells[c]?.length??0);h++){if(l[c]?.[h])continue;let d=t.cells[c][h];if(!d.text)continue;let u=ie(t,c,h),p=d.fontSize||t.fontSize||14;e.font=`${d.bold?"bold ":""}${p}px sans-serif`,e.fillStyle=d.textColor||t.textColor||Qt;let g=u.width-20,m=u.height-8,f=p*1.3,b=this.getDisplayLines(e,t,d.text,p,g,Math.max(f,m),`cell:${d.bold?"b":"n"}`),x=u.ox-s,I=u.oy-a,T=I+St(b.length,f,u.height);e.save(),e.beginPath(),e.rect(x,I,u.width,u.height),e.clip(),b.forEach((w,S)=>{let C=T+S*f;d.align==="center"?(e.textAlign="center",e.fillText(w,x+u.width/2,C)):d.align==="right"?(e.textAlign="right",e.fillText(w,x+u.width-10,C)):(e.textAlign="left",e.fillText(w,x+10,C));}),e.restore();}if(e.restore(),this.tableSelection&&this.tableSelection.shapeId===t.id){let c=this.tableSelection,h=Ct(t,c.anchor.row,c.anchor.col,c.focus.row,c.focus.col),d=ci(t,h.r1,h.c1,h.r2,h.c2);e.save(),e.fillStyle=z(H.primary,.12),e.beginPath(),e.rect(d.x,d.y,d.width,d.height),e.fill(),e.strokeStyle=H.primary,e.lineWidth=1.5/i,e.setLineDash([]),e.stroke(),e.restore();}}drawSegmentsWithGaps(e,t,i,n,o,s){let a=[...o].sort((c,h)=>c[0]-h[0]),l=t;for(let[c,h]of a)if(c>l&&this.strokeGridSegment(e,l,Math.min(c,i),n,s),l=Math.max(l,h),l>=i)break;l<i&&this.strokeGridSegment(e,l,i,n,s);}strokeGridSegment(e,t,i,n,o){i-t<.5||(e.beginPath(),o?(e.moveTo(t,n),e.lineTo(i,n)):(e.moveTo(n,t),e.lineTo(n,i)),e.stroke());}drawUmlInterface(e,t,i){let{width:n,height:o,className:s,methods:a}=t,l=n/2,c=o/2,h=ge;e.beginPath(),e.rect(-l,-c,n,o),t.style.fillColor!=="transparent"&&(e.fillStyle=t.style.fillColor,e.fill()),e.stroke(),e.beginPath(),e.moveTo(-l,-c+h),e.lineTo(l,-c+h),e.stroke(),e.save(),e.textBaseline="middle";let d=n-ne*2,u=f=>{if(e.measureText(f).width<=d)return f;let b="\u2026",x=0,I=f.length;for(;x<I;){let T=x+I+1>>1;e.measureText(f.slice(0,T)+b).width<=d?x=T:I=T-1;}return f.slice(0,x)+b},p=(f,b,x,I,T,w,S)=>{let C=I||ee,v=T||"#1f2937";e.font=`${C}px sans-serif`,e.fillStyle=v,e.textAlign=S;let k=u(f);if(e.fillText(k,b,x),w){let L=e.measureText(k).width,E=b;e.strokeStyle=v,e.beginPath(),e.moveTo(E,x),e.lineTo(E+L,x),e.stroke();}};e.font=`bold ${t.fontSize||ee}px sans-serif`,e.textAlign="center",e.fillStyle=t.textColor||"#1f2937";let g=`<<${s||"Interface"}>>`;e.fillText(u(g),0,-c+h/2);let m=-c+h+_+V/2;a.forEach((f,b)=>{let x=xe(f);x&&p(x,-l+ne,m+b*V,f.fontSize||t.fontSize||0,f.textColor||t.textColor||"",!!f.strikethrough,"left");}),e.restore();}static DEFAULT_CORNER_RADIUS=10;static CONNECTION_LEAD=24;drawMindMap(e,t,i,n,o,s){let l=N(t.root).positions;this.drawMindMapConnections(e,t.root,l),this.drawMindMapNodes(e,t,l,i,n,o),this.drawMindMapReorderIndicator(e,t,l,s);}drawMindMapConnections(e,t,i){let n=o=>{if(o.collapsed)return;let s=i.get(o.id);if(s)for(let a of o.children??[]){let l=i.get(a.id);if(!l)continue;let c=Ne(a,l.depth);e.strokeStyle=c,e.lineWidth=2,e.lineCap="round",e.beginPath();let h=l.direction,d,u,p,g;if(h==="right"?(d=s.x+s.width/2,u=s.y,p=l.x-l.width/2,g=l.y):h==="left"?(d=s.x-s.width/2,u=s.y,p=l.x+l.width/2,g=l.y):h==="down"?(d=s.x,u=s.y+s.height/2,p=l.x,g=l.y-l.height/2):(d=s.x,u=s.y-s.height/2,p=l.x,g=l.y+l.height/2),e.moveTo(d,u),h==="right"||h==="left"){let m=(d+p)/2;e.bezierCurveTo(m,u,m,g,p,g);}else {let m=(u+g)/2;e.bezierCurveTo(d,m,p,m,p,g);}e.stroke(),n(a);}};n(t);}drawMindMapNodes(e,t,i,n,o,s){let a=t.root,l=c=>{let h=i.get(c.id);if(!h)return;let d=Ne(c,h.depth),u=h.width/2,p=h.height/2;if(e.fillStyle="#ffffff",e.strokeStyle=d,e.lineWidth=2,e.beginPath(),e.roundRect(h.x-u,h.y-p,h.width,h.height,6),e.fill(),e.stroke(),s&&s.shapeId===t.id&&s.nodeId===c.id&&(e.fillStyle=z(H.primary,.06),e.strokeStyle=z(H.primary,.55),e.lineWidth=2,e.beginPath(),e.roundRect(h.x-u,h.y-p,h.width,h.height,6),e.fill(),e.stroke()),o&&o.shapeId===t.id&&o.nodeId===c.id&&(e.fillStyle=z(H.primary,.12),e.strokeStyle=H.primary,e.lineWidth=2.5,e.beginPath(),e.roundRect(h.x-u,h.y-p,h.width,h.height,6),e.fill(),e.stroke()),!!(c.children&&c.children.length>0)){let C=jt(h,h.direction);e.fillStyle="#ffffff",e.strokeStyle=d,e.lineWidth=2,e.beginPath(),e.arc(C.x,C.y,8,0,Math.PI*2),e.fill(),e.stroke(),e.fillStyle=d,e.font="bold 13px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(c.collapsed?"+":"\u2212",C.x,C.y+.5);}if(c.note){let C=c.noteColor??d;e.font="11px sans-serif";let v=Math.min(e.measureText(c.note).width+12,130),k=16;e.fillStyle=C,e.beginPath(),e.roundRect(h.x-u,h.y-p-k+2,v,k,4),e.fill(),e.fillStyle="#ffffff",e.font="11px sans-serif",e.textAlign="left",e.textBaseline="middle",e.fillText(e.measureText(c.note).width+12>130?c.note.slice(0,12)+"\u2026":c.note,h.x-u+6,h.y-p-k/2+2);}e.font=`${14}px sans-serif`;let b=c.icon?18:0,x=h.width-b-(c.icon?8:0)-16,I=this.ellipsizeText(e,c.text||"",x),T=e.measureText(I).width,w=b+(b?8:0)+T,S=h.x-w/2;if(e.textBaseline="middle",c.icon&&(e.font="16px sans-serif",e.textAlign="left",e.fillStyle="#1f2937",e.fillText(c.icon,S,h.y+1),S+=b+8),e.font=`${14}px sans-serif`,e.textAlign="left",e.fillStyle="#1f2937",e.fillText(I,S,h.y),!c.collapsed)for(let C of c.children??[])l(C);};if(l(a),n){let c=s&&s.shapeId===t.id?s.nodeId:o&&o.shapeId===t.id?o.nodeId:null;c&&this.drawMindMapHandles(e,qn(a,c));}}drawMindMapReorderIndicator(e,t,i,n){if(!n||n.shapeId!==t.id)return;let{targetIndex:o,direction:s,siblingIds:a,nodeId:l,childParentId:c}=n,h=ce(s),d=i.get(l);if(!d)return;let u=d.width,p=d.height,g=16,m=48;if(c){let S=i.get(c);S&&(e.save(),e.setLineDash([4,4]),e.lineWidth=2,e.strokeStyle=H.primary,e.beginPath(),e.roundRect(S.x-S.width/2-5,S.y-S.height/2-5,S.width+10,S.height+10,8),e.stroke(),e.restore());}let f=a.map(S=>({id:S,pos:i.get(S)})).filter(S=>!!S.pos).sort((S,C)=>h?S.pos.y-C.pos.y:S.pos.x-C.pos.x),b=f.findIndex(S=>S.id===l);if(b!==-1&&o===b)return;let x=f.filter(S=>S.id!==l).map(S=>S.pos),I=o;I<0&&(I=0),I>x.length&&(I=x.length);let T,w;if(x.length===0){if(!c)return;let S=i.get(c);if(!S)return;let C=h?S.y:S.x,v=h?s==="right"?S.x+S.width/2+m+u/2:S.x-S.width/2-m-u/2:s==="down"?S.y+S.height/2+m+p/2:S.y-S.height/2-m-p/2;T=h?v:C,w=h?C:v;}else {let S=(()=>{if(I<=0){let L=x[0];return h?L.y-L.height/2-g-p/2:L.x-L.width/2-g-u/2}if(I>=x.length){let L=x[x.length-1];return h?L.y+L.height/2+g+p/2:L.x+L.width/2+g+u/2}let v=x[I-1],k=x[I];return h?(v.y+v.height/2+k.y-k.height/2)/2:(v.x+v.width/2+k.x-k.width/2)/2})(),C=(()=>{if(h){let k=s==="right"?x[0].x-x[0].width/2:x[0].x+x[0].width/2;return s==="right"?k+u/2:k-u/2}let v=s==="down"?x[0].y-x[0].height/2:x[0].y+x[0].height/2;return s==="down"?v+p/2:v-p/2})();T=h?C:S,w=h?S:C;}if(c){let S=i.get(c);if(S){let C=h?s==="right"?S.x+S.width/2:S.x-S.width/2:S.x,v=h?S.y:s==="down"?S.y+S.height/2:S.y-S.height/2,k=h?s==="right"?T-u/2:T+u/2:T,L=h?w:s==="down"?w-p/2:w+p/2;if(e.save(),e.setLineDash([5,4]),e.lineWidth=2,e.strokeStyle=H.primary,e.beginPath(),e.moveTo(C,v),h){let E=(C+k)/2;e.bezierCurveTo(E,v,E,L,k,L);}else {let E=(v+L)/2;e.bezierCurveTo(C,E,k,E,k,L);}e.stroke(),e.restore();}}e.save(),e.setLineDash([5,4]),e.lineJoin="round",e.lineWidth=2,e.strokeStyle=H.primary,e.fillStyle=z(H.primary,.12),e.beginPath(),e.roundRect(T-u/2,w-p/2,u,p,6),e.fill(),e.stroke(),e.restore();}drawMindMapHandles(e,t){e.save(),e.setLineDash([]),e.lineCap="round";for(let i of t){e.beginPath(),e.arc(i.x,i.y,11,0,Math.PI*2),e.fillStyle="#ffffff",e.fill(),e.beginPath(),e.arc(i.x,i.y,9,0,Math.PI*2),e.fillStyle=H.primary,e.fill();let n=9*.5;e.beginPath(),e.moveTo(i.x-n,i.y),e.lineTo(i.x+n,i.y),e.moveTo(i.x,i.y-n),e.lineTo(i.x,i.y+n),e.strokeStyle="#ffffff",e.lineWidth=2,e.stroke();}e.restore();}ellipsizeText(e,t,i){if(i<=0)return "";if(e.measureText(t).width<=i)return t;let n="\u2026",o=0,s=t.length;for(;o<s;){let a=o+s+1>>1;e.measureText(t.slice(0,a)+n).width<=i?o=a:s=a-1;}return t.slice(0,o)+n}resolveConnectorEnds(e,t){let i=e.points.map(l=>({x:l.x,y:l.y}));if(i.length<2)return {world:i};let n=i.length-1;if(e.type==="line")return e.freeform||(i[0]=this.clampToShapeOutline(i[0],t,e.id,i[n]),i[n]=this.clampToShapeOutline(i[n],t,e.id,i[0])),{world:i,fromN:this.getDockNormal(i[0],t,e.id),toN:this.getDockNormal(i[n],t,e.id)};let o=e.endBinding,s,a;if(e.startBinding){let l=t.get(e.startBinding.toShapeId);l&&(i[0]=this.getBindingPoint(l,e.startBinding),s=this.localDockBox(l,e));}if(e.endBinding){let l=t.get(e.endBinding.toShapeId);l&&(o=this.resolveAutoEndBinding(e.endBinding,e,i[0],l),i[n]=this.getBindingPoint(l,o),a=this.localDockBox(l,e));}return e.freeform||(e.startBinding||(i[0]=this.clampToShapeOutline(i[0],t,e.id,i[n])),e.endBinding||(i[n]=this.clampToShapeOutline(i[n],t,e.id,i[0]))),{world:i,fromN:this.resolveDockNormal(e.startBinding,i[0],t,e.id),toN:this.resolveDockNormal(o,i[n],t,e.id),fromBox:s,toBox:a}}localDockBox(e,t){let i=this.getShapePageBounds(e);return {x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}withUserPoints(e,t,i,n){let o=e,s=o.userPoints;if(!s||s.length===0||t.length<2)return t;let a=this.effectiveConnType(o),l=[t[0],t[t.length-1]],[c,h]=a==="curve"?l:this.getAlignedPoints(l),d=a==="curve"?s:Gt(s,o.userPointsRef,c,h,i,n);return [c,...d.map(u=>({x:u.x,y:u.y})),h]}getConnectorRoute(e,t,i={}){return e.type!=="arrow"&&e.type!=="line"?[]:!e.points||e.points.length<2?[]:this.connectorWorldPath(e,t,i).world}connectorWorldPath(e,t,i={}){let{world:n,fromN:o,toN:s,fromBox:a,toBox:l}=this.resolveConnectorEnds(e,t),c=this.effectiveConnType(e),h={fromN:o,toN:s,fromBox:a,toBox:l},d=b=>b.map(x=>({x:x.x-e.x,y:x.y-e.y})),u=b=>b.map(x=>({x:x.x+e.x,y:x.y+e.y})),p=b=>c==="straight"?this.straightAligned(b):this.buildPathPoints(b,c,h),g=p(d(n)),m=e.userPoints;if(i.ignoreUserPoints||!m||m.length===0||n.length<2)return {world:u(g),connType:c};let f=p(d(this.withUserPoints(e,n,o,s)));return Ut({userRoute:f,autoRoute:g,base:e.userPointsBase,fromBox:a,toBox:l})?{world:u(g),connType:c}:{world:u(f),connType:c}}drawSegmentHandles(e,t,i){let n=zt(t);if(n.length===0)return;let o=20/i,s=6/i;e.save(),e.setLineDash([]),e.lineWidth=1.5/i,e.strokeStyle="#ffffff",e.fillStyle=H.primary;for(let a of n){let l=a.axis==="H"?o:s,c=a.axis==="H"?s:o;e.beginPath(),e.roundRect(a.center.x-l/2,a.center.y-c/2,l,c,s/2),e.fill(),e.stroke();}e.restore();}drawLine(e,t,i,n,o){if(t.points.length<2)return;let s=t,{world:a,connType:l}=this.connectorWorldPath(s,i),c=a.map(h=>({x:h.x-t.x,y:h.y-t.y}));if(l==="straight"){e.beginPath(),e.moveTo(c[0].x,c[0].y);for(let h=1;h<c.length;h++)e.lineTo(c[h].x,c[h].y);e.stroke(),e.setLineDash([]);}else l==="orthogonal"?this.drawSharpPolyline(e,c):this.drawRoundedPolyline(e,c,r.DEFAULT_CORNER_RADIUS),e.stroke(),e.setLineDash([]);n&&(this.drawLinearHighlight(e,c,o),!this.multiSelection&&ht(t)&&ct(l)&&this.drawSegmentHandles(e,c,o));}drawArrow(e,t,i,n,o){if(t.points.length<2)return;let{world:s,connType:a}=this.connectorWorldPath(t,i),l=s.map(d=>({x:d.x-t.x,y:d.y-t.y})),c=t.arrowHead??"end";if(!!t.dashed||c==="dependency"||c==="realization"?e.setLineDash([8,5]):e.setLineDash([]),a==="straight"){e.beginPath(),e.moveTo(l[0].x,l[0].y);for(let d=1;d<l.length;d++)e.lineTo(l[d].x,l[d].y);e.stroke();}else a==="orthogonal"?this.drawSharpPolyline(e,l):this.drawRoundedPolyline(e,l,r.DEFAULT_CORNER_RADIUS),e.stroke();this.drawArrowHeads(e,l,c),e.setLineDash([]),n&&(this.drawLinearHighlight(e,l,o),!this.multiSelection&&ht(t)&&ct(a)&&this.drawSegmentHandles(e,l,o));}drawLinearHighlight(e,t,i,n=1,o=7){if(!(!t||t.length<2)){e.save(),e.globalAlpha=n,e.strokeStyle=H.lineHighlight,e.lineWidth=o/i,e.lineCap="round",e.lineJoin="round",e.setLineDash([]),e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let s=1;s<t.length;s++)e.lineTo(t[s].x,t[s].y);e.stroke(),e.restore();}}drawGenerationPreview(e,t,i,n,o){let{from:s,to:a}=t,l=t.arrowStyle??{connectionType:"polyline",arrowHead:"end",dashed:false},c=new Map(o);n.forEach(m=>c.set(m.id,m));let h=t.targetShapeId;if(!h&&t.type){let m=Te(t.type,a,void 0,void 0,t.size);m.id=r.GEN_GHOST_ID,c.set(r.GEN_GHOST_ID,m),h=r.GEN_GHOST_ID;}let d=t.sourceEdge?xi[t.sourceEdge]:void 0,u=t.sourceShapeId&&d?{toShapeId:t.sourceShapeId,handle:d}:void 0,p=h?{...t.targetBinding??{auto:true,handle:"left"},toShapeId:h}:void 0,g={id:r.GEN_PREVIEW_ID,type:"arrow",x:s.x,y:s.y,points:[s,a],rotation:0,style:t.lineStyle??r.PREVIEW_LINE_STYLE,startBinding:u,endBinding:p,connectionType:l.connectionType,arrowHead:l.arrowHead,dashed:l.dashed};if(e.save(),t.dragging||(e.globalAlpha=.65),e.translate(s.x,s.y),this.applyStyle(e,g.style,i),this.drawArrow(e,g,c,false,i),e.restore(),t.type){let m=c.get(r.GEN_GHOST_ID),f=m?this.getShapeBounds(m):{x:-60,y:-30,width:120,height:60};this.drawPreviewShapeOutline(e,a,t.type,f,i);}e.save(),e.beginPath(),e.arc(s.x,s.y,5/i,0,Math.PI*2),e.fillStyle=H.genDot,e.fill(),e.restore();}drawPreviewShapeOutline(e,t,i,n,o){let s=n.width,a=n.height,l=s/2,c=a/2,h=t.x,d=t.y;switch(e.strokeStyle=H.genLine,e.lineWidth=1.5/o,e.setLineDash([6/o,4/o]),e.beginPath(),i){case "circle":case "ellipse":e.ellipse(h,d,s/2,a/2,0,0,Math.PI*2);break;case "diamond":e.moveTo(h,d-c),e.lineTo(h+l,d),e.lineTo(h,d+c),e.lineTo(h-l,d),e.closePath();break;case "triangle":e.moveTo(h,d-c),e.lineTo(h+l,d+c),e.lineTo(h-l,d+c),e.closePath();break;case "image":{e.roundRect(h-l,d-c,s,a,4);break}case "sticky-note":{let u=s*re,p=a*re;e.moveTo(h-l,d-c),e.lineTo(h+l,d-c),e.lineTo(h+l,d+c-p),e.lineTo(h+l-u,d+c),e.lineTo(h-l,d+c),e.closePath();break}case "hexagon":for(let u=0;u<6;u++){let p=u*Math.PI/3-Math.PI/2,g=h+l*Math.cos(p),m=d+c*Math.sin(p);u===0?e.moveTo(g,m):e.lineTo(g,m);}e.closePath();break;case "parallelogram":{let u=s*.15;e.moveTo(h-l+u,d-c),e.lineTo(h+l,d-c),e.lineTo(h+l-u,d+c),e.lineTo(h-l,d+c),e.closePath();break}default:e.roundRect(h-l,d-c,s,a,i==="rounded-rectangle"?8:4);break}e.stroke();}static ALIGN_TOLERANCE=8;static GEN_PREVIEW_ID="__gen_preview_line__";static GEN_GHOST_ID="__gen_preview_ghost__";static PREVIEW_LINE_STYLE={strokeColor:"#1f2937",fillColor:"transparent",strokeWidth:2,strokeDash:null};straightAligned(e){return e.length===2?this.getAlignedPoints(e):e}effectiveConnType(e){let t=e.connectionType||"straight";return t==="straight"&&e.userPoints&&e.userPoints.length>0?"polyline":t}getAlignedPoints(e){if(e.length<2)return e;let t=e[0],i=e[e.length-1],n=i.x-t.x,o=i.y-t.y,s=r.ALIGN_TOLERANCE;if(Math.abs(o)<=s){let a=(t.y+i.y)/2;return e.map(l=>({x:l.x,y:a}))}if(Math.abs(n)<=s){let a=(t.x+i.x)/2;return e.map(l=>({x:a,y:l.y}))}return e}buildPathPoints(e,t,i={}){if(e.length<2)return e;if(t==="straight")return this.straightAligned(e);if(t==="polyline"||t==="orthogonal"){let n=e.length===2?this.getAlignedPoints(e):e;return this.generatePolylinePoints(n,i)}return t==="curve"?this.generateCurvePoints(e,i):e}drawRoundedPolyline(e,t,i){if(e.beginPath(),!(t.length<2)){if(t.length===2||i<=0){e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y);return}e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length-1;n++){let o=t[n-1],s=t[n],a=t[n+1],l=s.x-o.x,c=s.y-o.y,h=a.x-s.x,d=a.y-s.y,u=Math.hypot(l,c),p=Math.hypot(h,d);if(u<1e-6||p<1e-6){e.lineTo(s.x,s.y);continue}let g=Math.min(i,u*.5,p*.5),m=s.x-l/u*g,f=s.y-c/u*g,b=s.x+h/p*g,x=s.y+d/p*g;e.lineTo(m,f),e.arcTo(s.x,s.y,b,x,g);}e.lineTo(t[t.length-1].x,t[t.length-1].y);}}drawSharpPolyline(e,t){if(e.beginPath(),!(t.length<2)){e.moveTo(t[0].x,t[0].y);for(let i=1;i<t.length;i++)e.lineTo(t[i].x,t[i].y);}}drawSnapGuides(e,t,i){e.save(),e.strokeStyle=H.guide,e.lineWidth=1/i,e.setLineDash([6/i,4/i]),e.beginPath();for(let n of t)n.type==="horizontal"?(e.moveTo(n.start,n.position),e.lineTo(n.end,n.position)):(e.moveTo(n.position,n.start),e.lineTo(n.position,n.end));e.stroke(),e.restore();}generatePolylinePoints(e,t={}){return vt(e,t,r.CONNECTION_LEAD)}generateCurvePoints(e,t={}){if(e.length<2)return e;let i=e.length,n=[e[0]],o=l=>{let c=e[l],h=e[l+1];return Math.hypot(h.x-c.x,h.y-c.y)},s=l=>Math.max(16,Math.min(l*.32,150)),a=l=>{let c=e[Math.max(0,l-1)],h=e[Math.min(i-1,l+1)],d=h.x-c.x,u=h.y-c.y,p=Math.hypot(d,u);return p<1e-6?{x:1,y:0}:{x:d/p,y:u/p}};for(let l=0;l<i-1;l++){let c=e[l],h=e[l+1],d=o(l),u;if(l===0&&t.fromN)u={x:c.x+t.fromN.x*s(d),y:c.y+t.fromN.y*s(d)};else {let m=a(l);u={x:c.x+m.x*s(d),y:c.y+m.y*s(d)};}let p;if(l===i-2&&t.toN)p={x:h.x+t.toN.x*s(d),y:h.y+t.toN.y*s(d)};else {let m=a(l+1);p={x:h.x-m.x*s(d),y:h.y-m.y*s(d)};}let g=20;for(let m=1;m<=g;m++){let f=m/g,b=1-f,x=b*b*b*c.x+3*b*b*f*u.x+3*b*f*f*p.x+f*f*f*h.x,I=b*b*b*c.y+3*b*b*f*u.y+3*b*f*f*p.y+f*f*f*h.y;n.push({x,y:I});}}return n}getDisplayLines(e,t,i,n,o,s,a=""){let l=n*1.3,c=Math.max(1,Math.floor(s/l)),h=`${t.id}\0${i}\0${n}\0${o}x${s}\0${c}\0${a}`,d=this.textLayoutCache.get(h);if(d)return d;let u=i.split(`
|
|
4
|
-
`),p=[];for(let m of u){let f=this.wrapLine(e,m,o);for(let b of f)p.push(b);}let g=p.slice(0,c);return p.length>c&&g.length>0&&(g[g.length-1]=this.truncateLine(e,g[g.length-1],o)),this.textLayoutCache.size>=r.TEXT_CACHE_LIMIT&&this.textLayoutCache.clear(),this.textLayoutCache.set(h,g),g}drawShapeText(e,t){let i=t.text||"";if(!i)return;let n=t.fontSize||16;e.font=`${n}px sans-serif`,e.fillStyle=t.textColor||"#1f2937";let o=this.getTextBounds(t),s=n*1.3,a=this.getDisplayLines(e,t,i,n,o.width,o.height),c=-(a.length*s)/2+s/2,h=
|
|
5
|
-
`))if(l+=Math.max(1,this.wrapLine(e,c,n).length),l>a)return true;return false}isUmlRowTextTruncated(e,t,i,n=false){if(!t||e.type==="circle")return false;let o=e.width??0;if(o<=0)return false;let s=this.ctx;s.save();try{return s.font=`${n?"bold ":""}${i||ee}px sans-serif`,s.measureText(t).width>o-ne*2}finally{s.restore();}}static HANDLE_NORMALS=It;pickAutoHandle(e,t,i){return Tt(e,t,i)}resolveAutoEndBinding(e,t,i,n){if(!e.auto||e.isPrecise)return e;let o=t.startBinding?.handle?r.HANDLE_NORMALS[t.startBinding.handle]:void 0;return {...e,handle:this.pickAutoHandle(i,{x:n.x,y:n.y},o)}}getBindingPoint(e,t){if(t.isPrecise&&t.normalizedAnchor){let i=this.getShapePageBounds(e),n={x:i.x+i.width*t.normalizedAnchor.x,y:i.y+i.height*t.normalizedAnchor.y},o={x:e.x,y:e.y};return this.nearestPointOnShapeOutline(e,o,n)}if(t.handle){let i=this.getShapeBounds(e);switch(t.handle){case "top":return {x:e.x,y:e.y+i.y};case "bottom":return {x:e.x,y:e.y+i.y+i.height};case "left":return {x:e.x+i.x,y:e.y};case "right":return {x:e.x+i.x+i.width,y:e.y}}}return {x:e.x,y:e.y}}resolveDockNormal(e,t,i,n){return e&&!e.isPrecise&&e.handle?r.HANDLE_NORMALS[e.handle]:this.getDockNormal(t,i,n,e?.toShapeId)}getDockNormal(e,t,i,n){if(!t||t.size===0)return;let o=null,s=1/0,a=.5;if(t.forEach((d,u)=>{if(u===i||d.type==="line"||d.type==="arrow")return;let p=this.getShapePageBounds(d);if(e.x>=p.x-a&&e.x<=p.x+p.width+a&&e.y>=p.y-a&&e.y<=p.y+p.height+a){let g=d.id===n?-1:(e.x-d.x)**2+(e.y-d.y)**2;g<s&&(s=g,o=d);}}),!o)return;let l=o,c=e.x-l.x,h=e.y-l.y;return Math.abs(h)>Math.abs(c)?{x:0,y:h<0?-1:1}:{x:c<0?-1:1,y:0}}getShapePageBounds(e){let t=this.getShapeBounds(e);return {x:e.x+t.x,y:e.y+t.y,width:t.width,height:t.height}}clampToShapeOutline(e,t,i,n){if(!t||t.size===0)return e;let o=null,s=1/0;if(t.forEach((l,c)=>{if(c===i)return;let h=this.getShapePageBounds(l);if(e.x>h.x&&e.x<h.x+h.width&&e.y>h.y&&e.y<h.y+h.height){let d=(l.x-n.x)**2+(l.y-n.y)**2;d<s&&(s=d,o=l);}}),!o)return e;let a=o;return this.nearestPointOnShapeOutline(a,{x:a.x,y:a.y},e)}nearestPointOnShapeOutline(e,t,i){let n=i.x-t.x,o=i.y-t.y,s=Math.hypot(n,o);if(s<1e-6)return {x:t.x,y:t.y};let a=n/s,l=o/s,c=Math.max(1e4,s*2),h={x:t.x+a*c,y:t.y+l*c},d=this.intersectShapeOutlineWithSegment(e,t,h);if(d.length===0)return i;let u=d[0],p=(u.x-t.x)**2+(u.y-t.y)**2;for(let g=1;g<d.length;g++){let m=(d[g].x-t.x)**2+(d[g].y-t.y)**2;m<p&&(p=m,u=d[g]);}return u}intersectShapeOutlineWithSegment(e,t,i){let n={x:t.x-e.x,y:t.y-e.y},o={x:i.x-e.x,y:i.y-e.y};return this.intersectLocalShapeOutlineWithSegment(e,n,o).map(a=>({x:a.x+e.x,y:a.y+e.y}))}intersectLocalShapeOutlineWithSegment(e,t,i){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":{let n=e.width,o=e.height,s={x:-n/2,y:-o/2,width:n,height:o};return this.intersectSegmentRect(t,i,s)}case "ellipse":case "diamond":case "triangle":{let n=e.width,o=e.height,s={x:-n/2,y:-o/2,width:n,height:o};return this.intersectSegmentRect(t,i,s)}case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":{let n=e.width,o=e.height,s={x:-n/2,y:-o/2,width:n,height:o};return this.intersectSegmentRect(t,i,s)}case "circle":{let n=e.radius;return this.intersectSegmentCircle(t,i,{x:0,y:0},n)}default:return []}}intersectSegmentRect(e,t,i){let n=i.x,o=i.y,s=i.width,a=i.height,l=[[{x:n,y:o},{x:n+s,y:o}],[{x:n+s,y:o},{x:n+s,y:o+a}],[{x:n+s,y:o+a},{x:n,y:o+a}],[{x:n,y:o+a},{x:n,y:o}]],c=[];for(let[h,d]of l){let u=this.segmentIntersection(e,t,h,d);u&&c.push(u);}return c}segmentIntersection(e,t,i,n){let o=e.x,s=e.y,a=t.x,l=t.y,c=i.x,h=i.y,d=n.x,u=n.y,p=(o-a)*(h-u)-(s-l)*(c-d);if(Math.abs(p)<1e-9)return null;let g=((o-c)*(h-u)-(s-h)*(c-d))/p,m=-((o-a)*(s-h)-(s-l)*(o-c))/p;return g<0||g>1||m<0||m>1?null:{x:o+g*(a-o),y:s+g*(l-s)}}intersectSegmentCircle(e,t,i,n){let o=t.x-e.x,s=t.y-e.y,a=e.x-i.x,l=e.y-i.y,c=o*o+s*s,h=2*(a*o+l*s),d=a*a+l*l-n*n,u=h*h-4*c*d;if(u<0)return [];u=Math.sqrt(u);let p=(-h-u)/(2*c),g=(-h+u)/(2*c),m=[];return p>=0&&p<=1&&m.push({x:e.x+p*o,y:e.y+p*s}),g>=0&&g<=1&&Math.abs(g-p)>1e-6&&m.push({x:e.x+g*o,y:e.y+g*s}),m}drawArrowHead(e,t,i){let n=Math.atan2(i.y-t.y,i.x-t.x),o=12;e.save(),e.setLineDash([]),e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(i.x-o*Math.cos(n-Math.PI/6),i.y-o*Math.sin(n-Math.PI/6)),e.moveTo(i.x,i.y),e.lineTo(i.x-o*Math.cos(n+Math.PI/6),i.y-o*Math.sin(n+Math.PI/6)),e.stroke(),e.restore();}drawInheritanceHead(e,t,i){let n=Math.atan2(i.y-t.y,i.x-t.x),o=14,s=i.x,a=i.y,l=i.x-o*Math.cos(n),c=i.y-o*Math.sin(n),h=l+o*.5*Math.cos(n-Math.PI/2),d=c+o*.5*Math.sin(n-Math.PI/2),u=l+o*.5*Math.cos(n+Math.PI/2),p=c+o*.5*Math.sin(n+Math.PI/2);e.save(),e.setLineDash([]),e.fillStyle="#ffffff",e.beginPath(),e.moveTo(s,a),e.lineTo(h,d),e.lineTo(u,p),e.closePath(),e.fill(),e.stroke(),e.restore();}drawDiamondHead(e,t,i,n){let o=Math.atan2(i.y-t.y,i.x-t.x),s=14,a=i.x,l=i.y,c=i.x-s*.5*Math.cos(o),h=i.y-s*.5*Math.sin(o),d=i.x-s*Math.cos(o),u=i.y-s*Math.sin(o),p=c+s*.4*Math.cos(o-Math.PI/2),g=h+s*.4*Math.sin(o-Math.PI/2),m=c+s*.4*Math.cos(o+Math.PI/2),f=h+s*.4*Math.sin(o+Math.PI/2);e.save(),e.setLineDash([]),e.fillStyle=n?"#1f2937":"#ffffff",e.beginPath(),e.moveTo(a,l),e.lineTo(p,g),e.lineTo(d,u),e.lineTo(m,f),e.closePath(),e.fill(),e.stroke(),e.restore();}drawArrowHeads(e,t,i){if(i!=="none"){if(i==="start"||i==="both"){let n=t[0],o=t[1];this.drawArrowHead(e,o,n);}if(i==="end"||i==="both"){let n=t.length,o=t[n-2],s=t[n-1];this.drawArrowHead(e,o,s);}if(i==="inheritance"){let n=t.length,o=t[n-2],s=t[n-1];this.drawInheritanceHead(e,o,s);}if(i==="aggregation"){let n=t[0],o=t[1];this.drawDiamondHead(e,o,n,false);}if(i==="composition"){let n=t[0],o=t[1];this.drawDiamondHead(e,o,n,true);}if(i==="dependency"){let n=t.length;this.drawArrowHead(e,t[n-2],t[n-1]);}if(i==="realization"){let n=t.length;this.drawInheritanceHead(e,t[n-2],t[n-1]);}}}drawText(e,t){if(!t.text)return;let i=t.fontSize;e.font=`${i}px sans-serif`,e.textAlign="center",e.textBaseline="middle";let n=t.width,o=t.height,s=i*1.3,a=this.getDisplayLines(e,t,t.text,i,n,o),l=a.length*s,c=-l/2+s/2;if(t.highlightColor&&t.highlightColor!=="transparent"){let h=t.highlightOpacity??1;e.fillStyle=h<1?z(t.highlightColor,h):t.highlightColor;let d=i*.15;e.beginPath(),e.roundRect(-n/2-d,-l/2-d,n+d*2,l+d*2,4),e.fill();}e.fillStyle=t.textColor||"#1f2937",a.forEach((h,d)=>{let u=c+d*s;e.fillText(h,0,u);});}drawFreehand(e,t){if(t.points.length<2)return;let i=t.points;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(let n=1;n<i.length-1;n++){let o=(i[n].x+i[n+1].x)/2,s=(i[n].y+i[n+1].y)/2;e.quadraticCurveTo(i[n].x,i[n].y,o,s);}e.lineTo(i[i.length-1].x,i[i.length-1].y),e.stroke();}visibleLockBadges(e,t,i){return this.allLockBadges(e,i).filter(n=>(n.memberIds.length?n.memberIds:n.shapeId?[n.shapeId]:[]).some(o=>t.has(o)||this.lockHoverId===o))}lockBadgeTargets(e,t){return this.allLockBadges(e,t)}allLockBadges(e,t){let i=1/t,n=20*i,o=[],s=new Map,a=null;for(let l of e){if(!l.locked)continue;if(l.groupId){let h=s.get(l.groupId);h?h.push(l):s.set(l.groupId,[l]);continue}if(l.type==="arrow"||l.type==="line"){a||(a=new Map(e.map(u=>[u.id,u])));let h=this.getConnectorRoute(l,a),d=cs(h);if(!d)continue;o.push({x:d.x+6*i,y:d.y-n-6*i,size:n,shapeId:l.id,memberIds:[]});continue}let c=this.getShapeWorldBounds(l);o.push({x:c.x+c.width+2*i,y:c.y-n+4*i,size:n,shapeId:l.id,memberIds:[]});}for(let[l,c]of s){let h=1/0,d=1/0,u=-1/0;for(let p of c){let g=this.getShapeWorldBounds(p);h=Math.min(h,g.x),d=Math.min(d,g.y),u=Math.max(u,g.x+g.width);}Number.isFinite(h)&&o.push({x:(h+u)/2-n/2,y:d-n+4*i,size:n,groupId:l,memberIds:c.map(p=>p.id)});}return o}lockHoverId=null;setLockHover(e){this.lockHoverId=e;}drawLockBadgeAt(e,t,i,n){let o=1/n,s=20*o,a=t+s/2;e.save(),e.setLineDash([]),e.lineJoin="round",e.lineCap="round",e.beginPath(),e.roundRect(t,i,s,s,6*o),e.fillStyle="rgba(255,255,255,0.97)",e.fill(),e.strokeStyle="#cbd5e1",e.lineWidth=o,e.stroke(),e.beginPath(),e.arc(a,i+8.5*o,3.4*o,Math.PI,0),e.strokeStyle="#4b5563",e.lineWidth=1.7*o,e.stroke(),e.beginPath(),e.roundRect(t+4.5*o,i+8.5*o,11*o,8*o,1.8*o),e.fillStyle="#4b5563",e.fill(),e.beginPath(),e.arc(a,i+11.6*o,1.2*o,0,Math.PI*2),e.fillStyle="#ffffff",e.fill(),e.restore();}drawGroupFrames(e,t,i,n){let o=t.filter(p=>i.has(p.id));if(o.length<2)return;let s=o[0].groupId;if(!s||!o.every(p=>p.groupId===s))return;let a=t.filter(p=>p.groupId===s);if(a.length!==o.length)return;let l=1/0,c=1/0,h=-1/0,d=-1/0;for(let p of a){let g=this.getShapeWorldBounds(p);l=Math.min(l,g.x),c=Math.min(c,g.y),h=Math.max(h,g.x+g.width),d=Math.max(d,g.y+g.height);}if(!Number.isFinite(l))return;let u=6/n;e.save(),e.strokeStyle=z(H.selection.outline,.7),e.lineWidth=1/n,e.setLineDash([6/n,5/n]),e.beginPath(),e.roundRect(l-u,c-u,h-l+u*2,d-c+u*2,6/n),e.stroke(),e.restore();}drawMultiSelectOutline(e,t,i){let n=this.getShapeBounds(t);e.save(),e.setLineDash([]),e.strokeStyle=z(H.selection.outline,.6),e.lineWidth=1/i,e.beginPath();let o=1.5/i;e.roundRect(n.x-o,n.y-o,n.width+o*2,n.height+o*2,3/i),e.stroke(),e.restore();}drawMultiSelectionBounds(e,t,i,n){let o=1/0,s=1/0,a=-1/0,l=-1/0;for(let h of t){if(!i.has(h.id))continue;let d=this.getShapeWorldBounds(h);o=Math.min(o,d.x),s=Math.min(s,d.y),a=Math.max(a,d.x+d.width),l=Math.max(l,d.y+d.height);}if(!Number.isFinite(o))return;let c=4/n;e.save(),e.setLineDash([]),e.strokeStyle=z(H.selection.outline,.9),e.lineWidth=1.5/n,e.beginPath(),e.roundRect(o-c,s-c,a-o+c*2,l-s+c*2,4/n),e.stroke(),e.restore();}drawSelectionOutline(e,t,i){let n=this.getShapeBounds(t);e.strokeStyle=H.selection.outline,e.lineWidth=1/i,e.setLineDash([]),e.save(),e.shadowColor=H.selection.shadow,e.shadowBlur=8,e.shadowOffsetX=0,e.shadowOffsetY=0,e.beginPath(),e.roundRect(n.x-2,n.y-2,n.width+4,n.height+4,4),e.stroke(),e.restore(),t.type!=="table"&&(e.fillStyle=H.selection.outlineFill,e.beginPath(),e.roundRect(n.x-2,n.y-2,n.width+4,n.height+4,4),e.fill());}drawSelectionHandles(e,t,i,n){let o=8/i;if((t.type==="line"||t.type==="arrow")&&t.points&&t.points.length>=2){let a=n?this.getConnectorRoute(t,n):[],l=a.length>=2?a:t.points,c={x:l[0].x-t.x,y:l[0].y-t.y},h={x:l[l.length-1].x-t.x,y:l[l.length-1].y-t.y};e.fillStyle=H.selection.handleFill,e.strokeStyle=H.selection.handleStroke,e.lineWidth=2/i,e.setLineDash([]),[c,h].forEach(d=>{e.beginPath(),e.arc(d.x,d.y,o/2,0,Math.PI*2),e.fill(),e.stroke();});}else {let a=this.getShapeBounds(t),l=o,c=[{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}];e.fillStyle=H.selection.handleFill,e.strokeStyle=H.selection.handleStroke,e.lineWidth=2/i,e.setLineDash([]),c.forEach(p=>{e.beginPath(),e.roundRect(p.x-l/2,p.y-l/2,l,l,2),e.fill(),e.stroke();}),this.drawConnectionDots(e,a,i,1);let h=26/i,d=a.x+a.width/2,u=a.y-h;e.strokeStyle="#94a3b8",e.lineWidth=1.5/i,e.setLineDash([]),e.beginPath(),e.moveTo(d,a.y),e.lineTo(d,u),e.stroke(),e.beginPath(),e.arc(d,u,8/i,0,Math.PI*2),e.fillStyle=H.selection.handleFill,e.fill(),e.strokeStyle=H.primary,e.lineWidth=1.6/i,e.stroke(),this.drawRotateIcon(e,d,u,i);}}drawConnectionDots(e,t,i,n=1){let o=9/i,s=[{x:t.x+t.width/2,y:t.y},{x:t.x+t.width,y:t.y+t.height/2},{x:t.x+t.width/2,y:t.y+t.height},{x:t.x,y:t.y+t.height/2}];e.save(),e.globalAlpha=n,s.forEach(a=>{e.beginPath(),e.arc(a.x,a.y,o,0,Math.PI*2),e.fillStyle=H.selection.handleFill,e.fill(),e.strokeStyle=H.primary,e.lineWidth=1.5/i,e.stroke(),e.beginPath(),e.arc(a.x,a.y,o*.45,0,Math.PI*2),e.fillStyle=H.primary,e.fill();}),e.restore();}drawRotateIcon(e,t,i,n){let o=8/n;e.save(),e.translate(t,i),e.strokeStyle=H.primary,e.lineWidth=1.8/n,e.lineCap="round",e.beginPath(),e.arc(0,0,o*.5,Math.PI*.18,Math.PI*1.6,false),e.stroke();let s=Math.PI*.18,a=Math.cos(s)*o*.5,l=Math.sin(s)*o*.5,c=1;e.beginPath(),e.moveTo(a,l),e.lineTo(a-Math.cos(s)*o*.26+c*Math.sin(s)*o*.16,l-Math.sin(s)*o*.26-c*Math.cos(s)*o*.16),e.moveTo(a,l),e.lineTo(a-Math.cos(s)*o*.26-c*Math.sin(s)*o*.16,l-Math.sin(s)*o*.26+c*Math.cos(s)*o*.16),e.stroke(),e.restore();}getShapeBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":return {x:-e.width/2,y:-e.height/2,width:e.width,height:e.height};case "circle":return {x:-e.radius,y:-e.radius,width:e.radius*2,height:e.radius*2};case "line":case "arrow":{if(e.points.length===0)return {x:0,y:0,width:0,height:0};let t=1/0,i=1/0,n=-1/0,o=-1/0;return e.points.forEach(s=>{t=Math.min(t,s.x-e.x),i=Math.min(i,s.y-e.y),n=Math.max(n,s.x-e.x),o=Math.max(o,s.y-e.y);}),{x:t,y:i,width:n-t,height:o-i}}case "draw":{let t=e;if(typeof t.width=="number"&&typeof t.height=="number")return {x:-t.width/2,y:-t.height/2,width:t.width,height:t.height};if(t.points.length===0)return {x:0,y:0,width:0,height:0};let i=1/0,n=1/0,o=-1/0,s=-1/0;return t.points.forEach(a=>{let l=a.x-t.x,c=a.y-t.y;i=Math.min(i,l),n=Math.min(n,c),o=Math.max(o,l),s=Math.max(s,c);}),{x:i,y:n,width:o-i,height:s-n}}case "text":{let t=e;return {x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}}default:return {x:0,y:0,width:0,height:0}}}};var Ue={create(r=0,e=0){return {x:r,y:e}},add(r,e){return {x:r.x+e.x,y:r.y+e.y}},subtract(r,e){return {x:r.x-e.x,y:r.y-e.y}},multiply(r,e){return {x:r.x*e,y:r.y*e}},divide(r,e){return {x:r.x/e,y:r.y/e}},dot(r,e){return r.x*e.x+r.y*e.y},length(r){return Math.sqrt(r.x*r.x+r.y*r.y)},normalize(r){let e=Ue.length(r);return e===0?{x:0,y:0}:{x:r.x/e,y:r.y/e}},distance(r,e){return Ue.length(Ue.subtract(r,e))},rotate(r,e){let t=Math.cos(e),i=Math.sin(e);return {x:r.x*t-r.y*i,y:r.x*i+r.y*t}},clone(r){return {x:r.x,y:r.y}},equals(r,e){return r.x===e.x&&r.y===e.y}};function Pe(r,e,t,i=8){let n=[];if(t==="horizontal"){let o=Math.min(r.x,e.x),s=Math.max(r.x+r.width,e.x+e.width),a=Math.abs(r.y-e.y)<=i,l=Math.abs(r.y+r.height-(e.y+e.height))<=i,c=Math.abs(r.y+r.height/2-(e.y+e.height/2))<=i;a&&n.push({type:"horizontal",position:(r.y+e.y)/2,start:o,end:s}),l&&n.push({type:"horizontal",position:(r.y+r.height+e.y+e.height)/2,start:o,end:s}),c&&!(a&&l)&&n.push({type:"horizontal",position:(r.y+r.height/2+e.y+e.height/2)/2,start:o,end:s});}else {let o=Math.min(r.y,e.y),s=Math.max(r.y+r.height,e.y+e.height),a=Math.abs(r.x-e.x)<=i,l=Math.abs(r.x+r.width-(e.x+e.width))<=i,c=Math.abs(r.x+r.width/2-(e.x+e.width/2))<=i;a&&n.push({type:"vertical",position:(r.x+e.x)/2,start:o,end:s}),l&&n.push({type:"vertical",position:(r.x+r.width+e.x+e.width)/2,start:o,end:s}),c&&!(a&&l)&&n.push({type:"vertical",position:(r.x+r.width/2+e.x+e.width/2)/2,start:o,end:s});}return n}var At=class r extends X{type="select";state="idle";cellSelectShapeId=null;translatingState=null;resizingState=null;generatingState=null;hoverGenPoint=null;hoverShapeId=null;hoverConnectorId=null;draggingSegment=null;rotatingState=null;draggingArrowId=null;draggingTerminal=null;pendingHistoryCommit=false;brushStart={x:0,y:0};brushShiftKey=false;defaultGenType(e){if(e){let t=this.context.getShapes().find(i=>i.id===e);if(t&&an(t.type))return t.type}return "rectangle"}genPreviewOf(e,t,i={}){let n=this.context.getArrowStyle();return {from:e.point,to:t,type:i.type,size:i.type?this.genGhostSize(i.type,e.sourceShapeId):void 0,sourceShapeId:e.sourceShapeId,sourceEdge:e.edge,targetShapeId:i.targetShapeId,targetBinding:i.targetBinding,dragging:i.dragging,arrowStyle:{connectionType:"polyline",arrowHead:n.arrowHead,dashed:n.dashed},lineStyle:this.context.getLineStyle()}}genContext(e,t){return {from:e.point,to:t,sourceShapeId:e.sourceShapeId,edge:e.edge}}onPointerDown(e,t){let i=this.context.getShapes(),n=this.context.getSelectedIds(),o=n.length===1?this.hitTestArrowTerminal(e,i):null;if(o&&n.includes(o.shapeId)){this.state="dragging-terminal",this.draggingArrowId=o.shapeId,this.draggingTerminal=o.terminal,this.pendingHistoryCommit=true,this.context.updateArrowBinding(o.shapeId,o.terminal,null);return}let s=n.length===1?this.hitConnectorSegmentHandle(e,i,n):null;if(s){this.state="dragging-segment",this.draggingSegment={...s,startPoint:e,moved:false,...this.segmentSnapContext(s.shapeId,s.route,s.index,s.axis)},this.pendingHistoryCommit=true;return}let a=this.hoverShapeId??this.findHoverAnchorShape(e,i,n),l=this.hitGenPoint(e,i,n,a);if(l){this.state="generating",this.hoverShapeId=a,this.generatingState={source:l,startPoint:e,hasMoved:false,sourceWasSelected:!!l.sourceShapeId&&n.includes(l.sourceShapeId)},this.pendingHistoryCommit=true,this.context.setGenerationPreview(this.genPreviewOf(l,this.genPreviewTarget(l,e,false),{type:this.defaultGenType(l.sourceShapeId)}));return}let c=this.hitTest(e,i,n),h=this.findTableMoveHandleAt(e,i,n);if(h){this.context.selectShape(h.id,t.shiftKey),this.beginTranslating(e,i);return}if(c.handle==="rotation"){this.state="rotating",this.pendingHistoryCommit=true;let d=c.shape;this.rotatingState={shapeId:d.id,center:{x:d.x,y:d.y},startAngle:Math.atan2(e.y-d.y,e.x-d.x),startRotation:d.rotation};return}if(c.handle&&c.shape&&c.shape.type!=="mind-map"){this.state="resizing",this.resizingState={startPoint:e,startShape:c.shape,handle:c.handle},this.pendingHistoryCommit=true;return}if(c.shape){let d=c.shape,u=d.type==="line"||d.type==="arrow",p=n.includes(d.id);if(d.type==="table"){let m=d,f=this.context.getCamera().getZoom();if(!Qe(m,e,f)){this.state="selecting-cells",this.cellSelectShapeId=m.id,this.pendingHistoryCommit=false;return}this.context.selectShape(d.id,t.shiftKey);}if(u&&!p){this.context.selectShape(d.id,t.shiftKey);return}if(d.type==="arrow"&&(!!d.startBinding||!!d.endBinding)){this.context.selectShape(d.id,t.shiftKey);return}this.state="translating",this.pendingHistoryCommit=true,p||(this.isInsideGroup(d,n)?this.context.selectShapeRaw(d.id):this.context.selectShape(d.id,t.shiftKey)),this.captureTranslatingStart(e,i),this.translatingState&&(this.translatingState.clickShapeId=d.id,this.translatingState.clickWasSelected=p,this.translatingState.clickShift=t.shiftKey,this.translatingState.moved=false);}else this.state="brushing",this.brushStart=e,this.brushShiftKey=t.shiftKey,t.shiftKey||this.context.selectShape("",false);}isInsideGroup(e,t){let i=e.groupId;if(!i||t.length===0)return false;let n=this.context.getShapes().filter(s=>s.groupId===i);if(n.length===0||t.length>=n.length)return false;let o=new Set(n.map(s=>s.id));return t.every(s=>o.has(s))}findTableMoveHandleAt(e,t,i){let n=this.context.getCamera().getZoom(),o=this.hitTest(e,t,i);if(o.shape&&o.shape.type!=="table")return null;for(let s=t.length-1;s>=0;s--){let a=t[s];if(a.type!=="table"||a.locked)continue;let l=a;if(Qe(l,e,n))return l}return null}beginTranslating(e,t){this.state="translating",this.pendingHistoryCommit=true,this.captureTranslatingStart(e,t);}captureTranslatingStart(e,t){let i=this.context.getSelectedIds(),n=new Map,o=new Map,s=new Map,a=new Map,l=new Map;i.forEach(c=>{let h=t.find(d=>d.id===c);if(h&&(n.set(c,{x:h.x,y:h.y}),o.set(c,h.rotation),s.set(c,this.getShapeWorldBounds(h)),(h.type==="line"||h.type==="arrow")&&Array.isArray(h.points))){a.set(c,h.points.map(u=>({x:u.x,y:u.y})));let d=h.userPoints;d?.length&&l.set(c,d.map(u=>({x:u.x,y:u.y})));}}),this.translatingState={startPoint:e,startPositions:n,startRotation:o,startBounds:s,startPoints:a,startUserPoints:l};}onPointerMove(e,t){let i=this.context.getShapes();if(this.state==="translating"&&this.translatingState)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleTranslating(e,t);else if(this.state==="selecting-cells"&&this.cellSelectShapeId){let n=i.find(o=>o.id===this.cellSelectShapeId);if(!n)this.state="idle",this.cellSelectShapeId=null;else {let o=wt(n,Ie(n,e));this.context.selectTableCell(this.cellSelectShapeId,o.row,o.col,true);}}else if(this.state==="generating"&&this.generatingState)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleGenerating(e,i);else if(this.state==="rotating"&&this.rotatingState)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleRotating(e,t);else if(this.state==="resizing"&&this.resizingState)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleResizing(e);else if(this.state==="dragging-terminal"&&this.draggingArrowId&&this.draggingTerminal){this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false);let n=i.find(o=>o.id===this.draggingArrowId);if(n){let o=this.draggingTerminal==="start"?e:n.points[n.points.length-1],s=this.draggingTerminal==="start"?n.points[0]:e,a=this.computeSnapGuidesForArrow(o,s,e,n,i);this.context.setSnapGuides(a);let l=e;if(a.length>0){let d=a.filter(p=>p.type==="horizontal"),u=a.filter(p=>p.type==="vertical");if(d.length>0){let p=d[0].position,g=Math.abs(e.y-p);for(let m of d){let f=Math.abs(e.y-m.position);f<g&&(g=f,p=m.position);}l={...l,y:p};}else if(u.length>0){let p=u[0].position,g=Math.abs(e.x-p);for(let m of u){let f=Math.abs(e.x-m.position);f<g&&(g=f,p=m.position);}l={...l,x:p};}}let c=this.draggingTerminal==="start"?0:n.points.length-1,h=[...n.points];h[c]=l,this.context.updateShape(this.draggingArrowId,{points:h});}}else if(this.state==="dragging-segment"&&this.draggingSegment)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleDraggingSegment(e);else if(this.state==="brushing")this.handleBrushing(e);else {let n=this.context.getSelectedIds(),o=this.hitGenPoint(e,i,n,this.hoverShapeId);o?(this.hoverGenPoint=o,this.context.setGenerationPreview(this.genPreviewOf(o,this.genPreviewTarget(o,e,false),{type:this.defaultGenType(o.sourceShapeId)}))):(this.hoverGenPoint=null,this.context.setGenerationPreview(null));let s=this.findTableMoveHandleAt(e,i,n),a=s?s.id:this.findHoverAnchorShape(e,i,n);a!==this.hoverShapeId&&(this.hoverShapeId=a,this.context.setHoverAnchorShape(a));let l=this.findHoverConnector(e,i,n);l!==this.hoverConnectorId&&(this.hoverConnectorId=l,this.context.setHoverConnector(l));}}onPointerUp(e,t){if(this.state==="translating"&&this.translatingState){let i=this.translatingState;!i.moved&&i.clickWasSelected&&i.clickShapeId&&this.context.getSelectedIds().length>1&&(this.context.selectShape(i.clickShapeId,!!i.clickShift),!i.clickShift&&this.context.getSelectedIds().length>1&&this.context.getSelectedIds().includes(i.clickShapeId)&&this.context.selectShapeRaw(i.clickShapeId));}if(this.state==="dragging-segment"&&this.draggingSegment&&this.finishSegmentDrag(this.draggingSegment.shapeId,this.draggingSegment.autoRoute,this.draggingSegment.moved),this.state==="dragging-terminal"&&this.draggingArrowId&&this.draggingTerminal){let i=this.context.getShapes(),n=this.findBindingNearPoint(e,i,this.draggingArrowId);n&&this.context.updateArrowBinding(this.draggingArrowId,this.draggingTerminal,n.toShapeId,n.binding);}if(this.state==="generating"&&this.generatingState){let i=this.generatingState,n=this.context.getShapes(),o=i.source,s=this.findBindingNearPoint(e,n,o.sourceShapeId);if(s)this.context.connectToExisting(this.genContext(o,e),s.toShapeId,s.binding);else if(!i.hasMoved)i.sourceWasSelected?this.context.createGeneratedConnection(this.genContext(o,this.genPreviewTarget(o,o.point,false)),{type:this.defaultGenType(o.sourceShapeId)}):o.sourceShapeId&&this.context.selectShape(o.sourceShapeId,false);else {let a=this.defaultGenType(o.sourceShapeId),l=this.avoidSourceOverlap(o,e,a),c=this.context.createFloatingLine(this.genContext(o,this.futureDockPoint(o,l,a)));this.context.openGenerationMenu({context:this.genContext(o,l),existingArrowId:c,defaultShapeType:a});}this.generatingState=null;}this.state==="brushing"&&this.context.setBrushRect(null),this.context.setGenerationPreview(null),this.context.setConnectingTarget(null),this.hoverGenPoint=null,this.pendingHistoryCommit=false,this.state="idle",this.draggingArrowId=null,this.draggingTerminal=null,this.draggingSegment=null,this.translatingState=null,this.resizingState=null,this.rotatingState=null,this.cellSelectShapeId=null,this.context.setSnapGuides([]);}isPointOnConnector(e,t,i,n=10){let o=this.context.getConnectorRoute(t),s=o.length>=2?o:i.points;for(let a=1;a<s.length;a++)if(this.pointToLineDistance(e,s[a-1],s[a])<=n)return true;return false}findHoverConnector(e,t,i){for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(o.type!=="arrow"&&o.type!=="line")&&!i.includes(o.id)&&this.isPointOnConnector(e,o.id,o))return o.id}return null}hitConnectorSegmentHandle(e,t,i){for(let n of i){let o=t.find(d=>d.id===n);if(!o||o.type!=="arrow"&&o.type!=="line"||!ht(o))continue;let s=o.connectionType||"straight",a=!!o.userPoints?.length;if(!ct(s==="straight"&&a?"polyline":s))continue;let c=this.context.getConnectorRoute(n);if(c.length<2)continue;let h=$n(c,e);if(h)return {shapeId:n,index:h.index,route:c,axis:h.axis}}return null}segmentSnapContext(e,t,i,n){let o=t[i],s=t[i+1],a=new Set;o&&s&&a.add(n==="H"?(o.y+s.y)/2:(o.x+s.x)/2);let l=this.context.getAutoConnectorRoute?.(e)??[];for(let c=0;c+1<l.length;c++){let h=l[c],d=l[c+1];(Math.abs(d.x-h.x)>=Math.abs(d.y-h.y)?"H":"V")===n&&a.add(n==="H"?(h.y+d.y)/2:(h.x+d.x)/2);}return {extraLevels:[...a],autoRoute:l}}segmentCursor(e){return e==="H"?"ns-resize":"ew-resize"}handleDraggingSegment(e){let t=this.draggingSegment;if(!t||Math.hypot(e.x-t.startPoint.x,e.y-t.startPoint.y)<3)return;let i=t.route[t.index],n=t.route[t.index+1],s=Math.abs(n.x-i.x)>=Math.abs(n.y-i.y)?e.y-(i.y+n.y)/2:e.x-(i.x+n.x)/2;t.moved=true,this.writeConnectorRoute(t.shapeId,On(t.route,t.index,s,t.extraLevels));}writeConnectorRoute(e,t){let i=this.context.getShapes().find(s=>s.id===e);if(!i)return;let n=dt(t);if(i.type==="arrow"&&(!!i.startBinding||!!i.endBinding)){let s=this.draggingSegment?.autoRoute??[],a=Un(zn(n),s);this.context.updateShape(e,{userPoints:a.length?a:void 0,userPointsRef:a.length?{start:{...n[0]},end:{...n[n.length-1]}}:void 0,userPointsBase:a.length&&s.length>=2?s.map(l=>({...l})):void 0});}else this.context.updateShape(e,{points:n});}finishSegmentDrag(e,t,i){if(!i||!t||t.length<2)return;let n=this.context.getConnectorRoute(e);n.length<2||Gn(n,t)&&this.context.updateShape(e,{userPoints:void 0,userPointsRef:void 0,userPointsBase:void 0});}hasTransientState(){return this.state!=="idle"||!!this.generatingState}isDragging(){return this.state==="translating"||this.state==="resizing"||this.state==="rotating"||this.state==="dragging-terminal"||this.state==="dragging-segment"||this.state==="generating"}cancelTransient(){let e=this.state!=="idle"||!!this.generatingState||!!this.hoverGenPoint||!!this.hoverShapeId||!!this.hoverConnectorId||this.pendingHistoryCommit;return this.state="idle",this.generatingState=null,this.translatingState=null,this.resizingState=null,this.rotatingState=null,this.draggingArrowId=null,this.draggingTerminal=null,this.draggingSegment=null,this.pendingHistoryCommit=false,this.hoverGenPoint=null,this.hoverShapeId&&(this.hoverShapeId=null,this.context.setHoverAnchorShape(null)),this.hoverConnectorId&&(this.hoverConnectorId=null,this.context.setHoverConnector(null)),this.context.setGenerationPreview(null),this.context.setConnectingTarget(null),this.context.setSnapGuides([]),e}onKeyDown(e){let t=e.target;if(!(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable))){if(e.key==="Delete"||e.key==="Backspace"){let i=this.context.getShapes(),n=this.context.getSelectedIds().filter(o=>{let s=i.find(a=>a.id===o);return s&&!s.locked});n.length>0&&(this.context.commitHistory(),n.forEach(o=>{this.context.deleteShape(o);}));}e.key==="Escape"&&(this.context.selectShape("",false),this.cancelTransient()),(e.key==="+"||e.key==="=")&&e.shiftKey&&(this.context.commitHistory(),this.handleRotation(15)),e.key==="-"&&e.shiftKey&&(this.context.commitHistory(),this.handleRotation(-15)),e.key==="ArrowUp"&&(e.preventDefault(),this.context.commitHistory(),this.handleNudge(0,-5)),e.key==="ArrowDown"&&(e.preventDefault(),this.context.commitHistory(),this.handleNudge(0,5)),e.key==="ArrowLeft"&&(e.preventDefault(),this.context.commitHistory(),this.handleNudge(-5,0)),e.key==="ArrowRight"&&(e.preventDefault(),this.context.commitHistory(),this.handleNudge(5,0));}}onKeyUp(e){}getCursor(e){switch(this.state){case "translating":return "grabbing";case "generating":return "crosshair";case "rotating":return "grabbing";case "resizing":return this.resizingState?this.getHandleCursor(this.resizingState.handle,this.resizingState.startShape):"default";case "dragging-terminal":return "crosshair";case "dragging-segment":return this.segmentCursor(this.draggingSegment?.axis??"H");case "selecting-cells":return "cell";case "brushing":return "crosshair"}let t=this.context.getShapes(),i=this.context.getSelectedIds(),n=this.hitConnectorSegmentHandle(e,t,i);if(n)return this.segmentCursor(n.axis);if(this.hoverConnectorId||this.context.getMindMapCursorHitAtPoint(e))return "pointer";if(this.hitGenPoint(e,t,i,this.hoverShapeId))return "crosshair";if(this.hitTestArrowTerminal(e,t)&&i.includes(this.hitTestArrowTerminal(e,t).shapeId)||this.findTableMoveHandleAt(e,t,i))return "move";let o=this.hitTest(e,t,i);return o.handle==="rotation"?"grab":o.handle?this.getHandleCursor(o.handle,o.shape):o.shape?o.shape.type==="table"?"cell":"move":null}getHandleCursor(e,t){let n={e:0,se:45,s:90,sw:135,w:180,nw:225,n:270,ne:315}[e];if(n===void 0)return "grab";let o=((n+t.rotation*180/Math.PI)%360+360)%360,s=Math.round(o/45)%4;return ["ew-resize","nwse-resize","ns-resize","nesw-resize"][s]}static ALIGN_SNAP_THRESHOLD=8;handleTranslating(e,t){if(!this.translatingState)return;let i=Ue.subtract(e,this.translatingState.startPoint),n={...i};if(Math.hypot(i.x,i.y)<r.DRAG_START_THRESHOLD)return;this.translatingState.moved=true,t.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?n.y=0:n.x=0);let o=this.context.getShapes(),s=this.context.getSelectedIds(),a=new Set(s),l=[],c=[];if(this.translatingState.startBounds.forEach(h=>{c.push({x:h.x+n.x,y:h.y+n.y,width:h.width,height:h.height});}),!t.shiftKey&&c.length>0){let h=[];for(let p of o)a.has(p.id)||p.type==="line"||p.type==="arrow"||p.type==="draw"||h.push(this.getShapeWorldBounds(p));let d=[],u=[];for(let p of c){let g=[p.y,p.y+p.height/2,p.y+p.height],m=[p.x,p.x+p.width/2,p.x+p.width];for(let f of h){let b=[f.y,f.y+f.height/2,f.y+f.height];for(let I of g)for(let T of b){let w=T-I;Math.abs(w)<=r.ALIGN_SNAP_THRESHOLD&&d.push(w);}let x=[f.x,f.x+f.width/2,f.x+f.width];for(let I of m)for(let T of x){let w=T-I;Math.abs(w)<=r.ALIGN_SNAP_THRESHOLD&&u.push(w);}}}if(d.length>0){let p=d[0];for(let g of d)Math.abs(g)<Math.abs(p)&&(p=g);n.y+=p;}if(u.length>0){let p=u[0];for(let g of u)Math.abs(g)<Math.abs(p)&&(p=g);n.x+=p;}this.translatingState.startBounds.forEach(p=>{let g={x:p.x+n.x,y:p.y+n.y,width:p.width,height:p.height};for(let m of h)l.push(...Pe(g,m,"horizontal",1)),l.push(...Pe(g,m,"vertical",1));});}this.translatingState.startPositions.forEach((h,d)=>{let u=o.find(m=>m.id===d);if(u&&u.type==="arrow"&&(u.startBinding||u.endBinding))return;let p={x:h.x+n.x,y:h.y+n.y},g=this.translatingState?.startPoints.get(d);if(g){p.points=g.map(f=>({x:f.x+n.x,y:f.y+n.y}));let m=this.translatingState?.startUserPoints.get(d);m&&(p.userPoints=m.map(f=>({x:f.x+n.x,y:f.y+n.y})));}this.context.updateShape(d,p);}),this.context.setSnapGuides(this.mergeGuides(l));}handleResizing(e){if(!this.resizingState)return;let t=this.resizingState.startShape,i=this.resizingState.handle,n=this.resizingState.startPoint;if(!i||i==="rotation")return;let s={nw:[-1,-1],n:[0,-1],ne:[1,-1],w:[-1,0],e:[1,0],sw:[-1,1],s:[0,1],se:[1,1]}[i];if(!s)return;let[a,l]=s,c=Ue.subtract(e,n),h=[];for(let w of this.context.getShapes())w.id!==t.id&&(w.type==="line"||w.type==="arrow"||w.type==="draw"||h.push(this.getShapeWorldBounds(w)));let d=20,u=this.getShapeWorldBounds(t),p=u.x,g=u.y,m=u.x+u.width,f=u.y+u.height;a===1?m=Math.max(p+d,m+c.x):a===-1&&(p=Math.min(m-d,p+c.x)),l===1?f=Math.max(g+d,f+c.y):l===-1&&(g=Math.min(f-d,g+c.y));let b=(w,S)=>{let C=null;for(let v of S){let k=v-w;Math.abs(k)<=r.ALIGN_SNAP_THRESHOLD&&(C===null||Math.abs(k)<Math.abs(C))&&(C=k);}return C};if(a!==0&&h.length>0){let w=[];for(let C of h)w.push(C.x,C.x+C.width/2,C.x+C.width);let S=b(a===1?m:p,w);S!==null&&(a===1?m+=S:p+=S);}if(l!==0&&h.length>0){let w=[];for(let C of h)w.push(C.y,C.y+C.height/2,C.y+C.height);let S=b(l===1?f:g,w);S!==null&&(l===1?f+=S:g+=S);}let x={x:p,y:g,width:m-p,height:f-g},I=[];for(let w of h)a!==0&&I.push(...Pe(x,w,"vertical",1)),l!==0&&I.push(...Pe(x,w,"horizontal",1));this.context.setSnapGuides(this.mergeGuides(I));let T={};if(t.type==="circle"){let w=Math.max(10,Math.max(a!==0?x.width/2:0,l!==0?x.height/2:0));if(T.radius=w,a!==0){let S=a===1?u.x:u.x+u.width;T.x=a===1?S+w:S-w;}if(l!==0){let S=l===1?u.y:u.y+u.height;T.y=l===1?S+w:S-w;}}else if(t.type==="image"){let w=t,S=w.naturalWidth&&w.naturalHeight?w.naturalWidth/w.naturalHeight:Math.max(1,w.width)/Math.max(1,w.height),C=Math.max(d,x.width),v=Math.max(d,x.height);if(C/v>S?C=v*S:v=C/S,C=Math.max(d,C),v=Math.max(d,v),T.width=C,T.height=v,a!==0){let k=a===1?u.x:u.x+u.width;T.x=a===1?k+C/2:k-C/2;}if(l!==0){let k=l===1?u.y:u.y+u.height;T.y=l===1?k+v/2:k-v/2;}}else {if("width"in t&&a!==0&&(T.width=x.width,T.x=x.x+x.width/2),"height"in t&&l!==0&&(T.height=x.height,T.y=x.y+x.height/2),t.type==="draw"){let w=this.getShapeWorldBounds(t),S=a!==0?x.width/Math.max(1,w.width):1,C=l!==0?x.height/Math.max(1,w.height):1;T.points=t.points.map(v=>({x:v.x*S,y:v.y*C}));}if(t.type==="table"){let w=t,S=a!==0?x.width/Math.max(1,w.width):1,C=l!==0?x.height/Math.max(1,w.height):1;a!==0&&(T.colWidths=w.colWidths.map(v=>Math.max(40,Math.round(v*S)))),l!==0&&Math.abs(C-1)>1e-6&&(T.rowHeights=w.rowHeights.map(v=>Math.max(24,Math.round(v*C))));}}Object.keys(T).length>0&&this.context.updateShape(t.id,T);}mergeGuides(e){let t=new Map;for(let i of e){let n=`${i.type}\0${Math.round(i.position*2)/2}`,o=t.get(n);o?(o.start=Math.min(o.start,i.start),o.end=Math.max(o.end,i.end)):t.set(n,{...i});}return [...t.values()]}handleRotation(e){let t=this.context.getSelectedIds(),i=this.context.getShapes();t.forEach(n=>{let o=i.find(s=>s.id===n);o&&this.context.updateShape(n,{rotation:o.rotation+e*Math.PI/180});});}handleNudge(e,t){let i=this.context.getSelectedIds(),n=this.context.getShapes();i.forEach(o=>{let s=n.find(a=>a.id===o);s&&!s.locked&&this.context.updateShape(o,{x:s.x+e,y:s.y+t});});}handleBrushing(e){let t=Math.min(this.brushStart.x,e.x),i=Math.min(this.brushStart.y,e.y),n=Math.abs(e.x-this.brushStart.x),o=Math.abs(e.y-this.brushStart.y);this.context.setBrushRect({x:t,y:i,width:n,height:o});let s=this.context.getShapes(),a=[];for(let l of s){if(l.locked)continue;let c=this.getShapeWorldBounds(l);this.rectsIntersect({x:t,y:i,width:n,height:o},c)&&a.push(l.id);}if(this.brushShiftKey){let l=this.context.getSelectedIds(),c=new Set([...l,...a]);this.context.selectShapes([...c]);}else this.context.selectShapes(a);}getShapeWorldBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":return {x:e.x-e.width/2,y:e.y-e.height/2,width:e.width,height:e.height};case "circle":return {x:e.x-e.radius,y:e.y-e.radius,width:e.radius*2,height:e.radius*2};case "line":case "arrow":{if(!e.points||e.points.length===0)return {x:e.x,y:e.y,width:0,height:0};let t=1/0,i=1/0,n=-1/0,o=-1/0;return e.points.forEach(s=>{t=Math.min(t,s.x),i=Math.min(i,s.y),n=Math.max(n,s.x),o=Math.max(o,s.y);}),{x:t,y:i,width:n-t,height:o-i}}case "draw":{let t=e,i=t.width,n=t.height;if(typeof i=="number"&&typeof n=="number"&&i>0&&n>0)return {x:t.x-i/2,y:t.y-n/2,width:i,height:n};if(!t.points||t.points.length===0)return {x:t.x,y:t.y,width:0,height:0};let o=1/0,s=1/0,a=-1/0,l=-1/0;return t.points.forEach(c=>{let h=c.x+t.x,d=c.y+t.y;o=Math.min(o,h),s=Math.min(s,d),a=Math.max(a,h),l=Math.max(l,d);}),{x:o,y:s,width:a-o,height:l-s}}case "text":{let t=e;return {x:e.x-t.width/2,y:e.y-t.height/2,width:t.width,height:t.height}}default:{let t=e;return {x:t.x,y:t.y,width:0,height:0}}}}rectsIntersect(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}hitTest(e,t,i){let n=i.length===1;for(let o=t.length-1;o>=0;o--){let s=t[o];if(!s.locked){if(n&&i.includes(s.id)){let a=this.getHitHandle(e,s);if(a)return {shape:s,handle:a}}if(this.isPointInShape(e,s))return {shape:s,handle:null}}}return {shape:null,handle:null}}getHitHandle(e,t){if(t.type==="mind-map")return null;let i=14,n=this.getShapeBounds(t),o=Math.cos(-t.rotation),s=Math.sin(-t.rotation),a=e.x-t.x,l=e.y-t.y,c=a*o-l*s,h=a*s+l*o,d=[{type:"nw",x:n.x,y:n.y},{type:"ne",x:n.x+n.width,y:n.y},{type:"se",x:n.x+n.width,y:n.y+n.height},{type:"sw",x:n.x,y:n.y+n.height},{type:"rotation",x:n.x+n.width/2,y:n.y-26}];for(let u of d)if(Math.abs(c-u.x)<i&&Math.abs(h-u.y)<i)return u.type;return null}static GEN_HIT_THRESHOLD=14;static CLICK_MOVE_THRESHOLD=6;static DRAG_START_THRESHOLD=2;static GEN_GAP=76;static GEN_SUPPORTED_TYPES=new Set(["rectangle","sticky-note","rounded-rectangle","ellipse","diamond","triangle","hexagon","parallelogram","trapezoid","pentagon","octagon","star","uml-class","uml-interface","circle","draw","cylinder","cloud","heart","block-arrow-right","block-arrow-left","block-arrow-up","block-arrow-down","block-arrow-double","right-triangle","cross","speech-rect","speech-round","cube","sector","delay","predefined-process","document","stadium","class-catalog","chevron","brace-left","brace-right","envelope","checkbox","triangular-pyramid","quadrangular-pyramid","cuboid","sphere","ellipsoid","pie","hollow-pie","table"]);computeGenPoints(e,t,i){let n=[],o=new Set(t);i&&o.add(i);for(let s of o){let a=e.find(l=>l.id===s);if(a&&r.GEN_SUPPORTED_TYPES.has(a.type)){let l=this.getShapeBounds(a),c={x:a.x,y:a.y};n.push({point:{x:c.x+l.x+l.width/2,y:c.y+l.y},edge:"n",sourceShapeId:a.id}),n.push({point:{x:c.x+l.x+l.width,y:c.y+l.y+l.height/2},edge:"e",sourceShapeId:a.id}),n.push({point:{x:c.x+l.x+l.width/2,y:c.y+l.y+l.height},edge:"s",sourceShapeId:a.id}),n.push({point:{x:c.x+l.x,y:c.y+l.y+l.height/2},edge:"w",sourceShapeId:a.id});}}return n}hitGenPoint(e,t,i,n){let o=r.GEN_HIT_THRESHOLD,s=null,a=o;for(let l of this.computeGenPoints(t,i,n)){let c=Math.hypot(l.point.x-e.x,l.point.y-e.y);c<=a&&(a=c,s=l);}return s}findHoverAnchorShape(e,t,i){for(let o=t.length-1;o>=0;o--){let s=t[o];if(i.includes(s.id)||s.locked||!r.GEN_SUPPORTED_TYPES.has(s.type))continue;let a=this.getShapeWorldBounds(s);if(!(e.x<a.x-12||e.x>a.x+a.width+12||e.y<a.y-12||e.y>a.y+a.height+12))return s.id}return null}genPreviewTarget(e,t,i){if(i)return t;let{width:n,height:o}=this.genGhostSize(this.defaultGenType(e.sourceShapeId),e.sourceShapeId),s=r.GEN_GAP;if(e.edge)switch(e.edge){case "n":return {x:e.point.x,y:e.point.y-(s+o/2)};case "s":return {x:e.point.x,y:e.point.y+(s+o/2)};case "e":return {x:e.point.x+(s+n/2),y:e.point.y};case "w":return {x:e.point.x-(s+n/2),y:e.point.y}}return {x:e.point.x,y:e.point.y-(s+o/2)}}genGhostShape(e,t,i){let n=i?this.context.getShapes().find(o=>o.id===i):void 0;return Te(e,t,void 0,void 0,ln(e,n))}genGhostSize(e,t){let i=this.getShapeBounds(this.genGhostShape(e,{x:0,y:0},t));return {width:i.width,height:i.height}}handleGenerating(e,t){if(!this.generatingState)return;let i=this.generatingState,n=i.source;Math.hypot(e.x-i.startPoint.x,e.y-i.startPoint.y)>r.CLICK_MOVE_THRESHOLD&&(i.hasMoved=true);let s=this.findBindingNearPoint(e,t,n.sourceShapeId),a=this.defaultGenType(n.sourceShapeId),l=this.avoidSourceOverlap(n,e,a),c=s?this.bindingPosition(s.toShapeId,s.binding,t):i.hasMoved?l:this.genPreviewTarget(n,e,false);this.context.setConnectingTarget(s?s.toShapeId:null),this.context.setGenerationPreview(this.genPreviewOf(n,c,{dragging:i.hasMoved,targetShapeId:s?.toShapeId,targetBinding:s?.binding,type:s?void 0:a}));}handleRotating(e,t){if(!this.rotatingState)return;let i=this.rotatingState,n=Math.atan2(e.y-i.center.y,e.x-i.center.x),o=i.startRotation+(n-i.startAngle);t.shiftKey&&(o=Math.round(o/(Math.PI/12))*(Math.PI/12)),this.context.updateShape(i.shapeId,{rotation:o});}bindingPosition(e,t,i){let n=i.find(s=>s.id===e);if(!n)return {x:0,y:0};let o=this.getShapeWorldBounds(n);if(t.handle)switch(t.handle){case "top":return {x:n.x,y:o.y};case "bottom":return {x:n.x,y:o.y+o.height};case "left":return {x:o.x,y:n.y};case "right":return {x:o.x+o.width,y:n.y}}return t.normalizedAnchor?{x:o.x+o.width*t.normalizedAnchor.x,y:o.y+o.height*t.normalizedAnchor.y}:{x:n.x,y:n.y}}isPointInShape(e,t){let i=e.x-t.x,n=e.y-t.y;switch(t.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":return Math.abs(i)<=t.width/2&&Math.abs(n)<=t.height/2;case "circle":return i*i+n*n<=t.radius*t.radius;case "hexagon":return this.isPointInHexagon(i,n,t.width,t.height);case "line":case "arrow":return this.isPointOnConnector(e,t.id,t);case "draw":{let o=t,s=Math.max((o.style?.strokeWidth??2)/2+3,6/this.context.getCamera().getZoom()),a=o.points||[];for(let l=1;l<a.length;l++)if(this.pointToLineDistance({x:i,y:n},a[l-1],a[l])<=s)return true;return a.length===1&&Math.hypot(i-a[0].x,n-a[0].y)<=s}case "text":return Math.abs(i)<=50&&Math.abs(n)<=t.fontSize/2;default:return false}}isPointInHexagon(e,t,i,n){let o=Math.abs(e),s=Math.abs(t),a=i/2,l=n/2;return o<=a&&s<=l&&o/a+s/l<=1.5}pointToLineDistance(e,t,i){return Ot(e,t,i)}avoidSourceOverlap(e,t,i){if(!e.sourceShapeId)return t;let n=this.context.getShapes().find(g=>g.id===e.sourceShapeId);if(!n)return t;let o=this.genGhostShape(i,t,e.sourceShapeId),s=this.getShapeWorldBounds(o),a=this.getShapeWorldBounds(n),l=Math.min(s.x+s.width,a.x+a.width)-Math.max(s.x,a.x),c=Math.min(s.y+s.height,a.y+a.height)-Math.max(s.y,a.y);if(l<=0||c<=0)return t;let h=24,d={...t},u=t.x-n.x,p=t.y-n.y;return Math.abs(u)>=Math.abs(p)?d.x=u>=0?a.x+a.width+h+s.width/2:a.x-h-s.width/2:d.y=p>=0?a.y+a.height+h+s.height/2:a.y-h-s.height/2,d}futureDockPoint(e,t,i){let n=this.genGhostShape(i,t,e.sourceShapeId),o=this.getShapeBounds(n),s=dn(e.point,t,e.edge);return wo(t,{width:o.width,height:o.height},s)}getShapeBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":return {x:-e.width/2,y:-e.height/2,width:e.width,height:e.height};case "circle":return {x:-e.radius,y:-e.radius,width:e.radius*2,height:e.radius*2};case "line":case "arrow":{if(e.points.length===0)return {x:0,y:0,width:0,height:0};let t=1/0,i=1/0,n=-1/0,o=-1/0;return e.points.forEach(s=>{t=Math.min(t,s.x-e.x),i=Math.min(i,s.y-e.y),n=Math.max(n,s.x-e.x),o=Math.max(o,s.y-e.y);}),{x:t,y:i,width:n-t,height:o-i}}case "draw":{let t=e;if(typeof t.width=="number"&&typeof t.height=="number")return {x:-t.width/2,y:-t.height/2,width:t.width,height:t.height};if(t.points.length===0)return {x:0,y:0,width:0,height:0};let i=1/0,n=1/0,o=-1/0,s=-1/0;return t.points.forEach(a=>{let l=a.x-t.x,c=a.y-t.y;i=Math.min(i,l),n=Math.min(n,c),o=Math.max(o,l),s=Math.max(s,c);}),{x:i,y:n,width:o-i,height:s-n}}case "text":return {x:-50,y:-e.fontSize/2,width:100,height:e.fontSize};default:return {x:0,y:0,width:0,height:0}}}hitTestArrowTerminal(e,t){for(let n of t){if(n.type!=="arrow")continue;let o=n;if(o.points.length<2)continue;let s=this.context.getConnectorRoute(o.id),a=s.length>=2?s[0]:o.points[0],l=s.length>=2?s[s.length-1]:o.points[o.points.length-1],c=Math.sqrt(Math.pow(e.x-a.x,2)+Math.pow(e.y-a.y,2)),h=Math.sqrt(Math.pow(e.x-l.x,2)+Math.pow(e.y-l.y,2));if(c<20)return {shapeId:o.id,terminal:"start"};if(h<20)return {shapeId:o.id,terminal:"end"}}return null}findShapeNearPoint(e,t,i){for(let o=t.length-1;o>=0;o--){let s=t[o];if(i&&s.id===i||s.type==="arrow"||s.type==="line"||s.type==="draw")continue;let a;switch(s.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":a=this.pointToRectDistance(e,{x:s.x-s.width/2,y:s.y-s.height/2,width:s.width,height:s.height});break;case "circle":a=Math.sqrt(Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2))-s.radius;break;case "hexagon":{let l=s.width/2,c=s.height/2,h=Math.abs(e.x-s.x),d=Math.abs(e.y-s.y);a=h/l+d/c-1;break}default:continue}if(a<=30)return s}return null}pointToRectDistance(e,t){let i=Math.max(t.x,Math.min(e.x,t.x+t.width)),n=Math.max(t.y,Math.min(e.y,t.y+t.height));return Math.sqrt(Math.pow(e.x-i,2)+Math.pow(e.y-n,2))}static SNAP_THRESHOLD=32;static HANDLE_SNAP_DISTANCE=40;static ON_EDGE_SNAP=12;static ANCHOR_EPS=.001;computeSnapGuidesForArrow(e,t,i,n,o){let s=this.draggingTerminal==="start"?n.endBinding:n.startBinding,a=s?o.find(g=>g.id===s.toShapeId):null;if(!a)return [];let l=this.findShapeNearPoint(i,o,n.id);if(!l)return [];let c=this.getShapeWorldBounds(a),h=this.getShapeWorldBounds(l),d=t.x-e.x,u=t.y-e.y,p=Math.abs(d)>=Math.abs(u)?"horizontal":"vertical";return Pe(c,h,p)}findBindingNearPoint(e,t,i){let n,o;for(let a=t.length-1;a>=0;a--){let l=t[a];if(i&&l.id===i||l.type==="arrow"||l.type==="line"||l.type==="draw")continue;let c=this.getPageBounds(l),h={x:l.x,y:l.y},d=[{handle:"top",pos:{x:h.x,y:c.y}},{handle:"bottom",pos:{x:h.x,y:c.y+c.height}},{handle:"left",pos:{x:c.x,y:h.y}},{handle:"right",pos:{x:c.x+c.width,y:h.y}}];for(let m of d){let f=Math.hypot(m.pos.x-e.x,m.pos.y-e.y);f<=r.HANDLE_SNAP_DISTANCE&&(!n||f<n.distance)&&(n={toShapeId:l.id,binding:{toShapeId:l.id,handle:m.handle,isPrecise:false},distance:f});}let u=r.SNAP_THRESHOLD;if(e.x<c.x-u||e.x>c.x+c.width+u||e.y<c.y-u||e.y>c.y+c.height+u)continue;let p=this.nearestPointOnShapeOutline(l,e);if(p&&p.distance<=r.SNAP_THRESHOLD&&!n)if(p.distance<=r.ON_EDGE_SNAP){let m=[{handle:"top",d:Math.abs(p.point.y-c.y)},{handle:"bottom",d:Math.abs(c.y+c.height-p.point.y)},{handle:"left",d:Math.abs(p.point.x-c.x)},{handle:"right",d:Math.abs(c.x+c.width-p.point.x)}];m.sort((b,x)=>b.d-x.d);let f=d.find(b=>b.handle===m[0].handle);n={toShapeId:l.id,binding:{toShapeId:l.id,handle:f.handle,isPrecise:false},distance:Math.hypot(f.pos.x-e.x,f.pos.y-e.y)};}else {let m=this.computeNormalizedAnchor(c,p.point);(!o||p.distance<o.distance)&&(o={toShapeId:l.id,binding:{toShapeId:l.id,isPrecise:true,normalizedAnchor:m},distance:p.distance});}if(e.x>c.x&&e.x<c.x+c.width&&e.y>c.y&&e.y<c.y+c.height&&!n){let m=e.x-(c.x+c.width/2),f=e.y-(c.y+c.height/2),b=Math.abs(m)>=Math.abs(f)?m>=0?"right":"left":f>=0?"bottom":"top";n={toShapeId:l.id,binding:{toShapeId:l.id,handle:b,isPrecise:false},distance:0};}}let s=n??o;if(s)return {toShapeId:s.toShapeId,binding:s.binding}}getPageBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":return {x:e.x-e.width/2,y:e.y-e.height/2,width:e.width,height:e.height};case "circle":return {x:e.x-e.radius,y:e.y-e.radius,width:e.radius*2,height:e.radius*2};default:return {x:e.x-50,y:e.y-50,width:100,height:100}}}computeNormalizedAnchor(e,t){let i=r.ANCHOR_EPS,n=e.width>0?(t.x-e.x)/e.width:.5,o=e.height>0?(t.y-e.y)/e.height:.5;return n=Math.max(i,Math.min(1-i,n)),o=Math.max(i,Math.min(1-i,o)),{x:n,y:o}}nearestPointOnShapeOutline(e,t){let i={x:t.x-e.x,y:t.y-e.y},n=this.nearestLocalPointOnShapeOutline(e,i);if(!n)return null;let o={x:n.point.x+e.x,y:n.point.y+e.y};return {point:o,distance:Math.hypot(o.x-t.x,o.y-t.y)}}nearestLocalPointOnShapeOutline(e,t){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":{let i=e.width,n=e.height;return this.nearestPointOnRectOutlineLocal(t,{x:-i/2,y:-n/2,width:i,height:n})}case "circle":{let i=e.radius;return this.nearestPointOnCircleOutlineLocal(t,{x:0,y:0},i)}default:return null}}nearestPointOnRectOutlineLocal(e,t){let i=[[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y}],[{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height}],[{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],[{x:t.x,y:t.y+t.height},{x:t.x,y:t.y}]],n=null;for(let[o,s]of i){let a=this.nearestPointOnSegment(e,o,s);(!n||a.distance<n.distance)&&(n=a);}return n}nearestPointOnCircleOutlineLocal(e,t,i){let n=e.x-t.x,o=e.y-t.y,s=Math.hypot(n,o);if(s<1e-9)return {point:{x:t.x+i,y:t.y},distance:i};let a=t.x+n/s*i,l=t.y+o/s*i,c={x:a,y:l};return {point:c,distance:Math.hypot(c.x-e.x,c.y-e.y)}}nearestPointOnSegment(e,t,i){let n=i.x-t.x,o=i.y-t.y,s=n*n+o*o,a=s>0?((e.x-t.x)*n+(e.y-t.y)*o)/s:0;a=Math.max(0,Math.min(1,a));let l=t.x+a*n,c=t.y+a*o,h={x:l,y:c};return {point:h,distance:Math.hypot(h.x-e.x,h.y-e.y)}}};var Dt=class r extends X{type="hand";state="idle";startScreenPoint={x:0,y:0};initialCameraPos={x:0,y:0};static DRAG_THRESHOLD=4;onPointerDown(e,t){this.startScreenPoint={x:t.clientX,y:t.clientY};let i=this.context.getCamera();this.initialCameraPos={x:i.x,y:i.y},this.state="pointing";}onPointerMove(e,t){if(this.state!=="idle"){if(this.state==="pointing"){let i=t.clientX-this.startScreenPoint.x,n=t.clientY-this.startScreenPoint.y;if(Math.hypot(i,n)<r.DRAG_THRESHOLD)return;this.state="dragging",this.applyCameraDelta(i,n);return}if(this.state==="dragging"){let i=t.clientX-this.startScreenPoint.x,n=t.clientY-this.startScreenPoint.y;this.applyCameraDelta(i,n);}}}onPointerUp(e,t){if(this.state!=="idle"){if(this.state==="dragging"){let i=this.context.getCamera();this.initialCameraPos={x:i.x,y:i.y},this.startScreenPoint={x:t.clientX,y:t.clientY};}this.state="idle";}}onKeyDown(e){e.key==="Escape"&&this.state!=="idle"&&(this.context.setCameraPosition(this.initialCameraPos.x,this.initialCameraPos.y),this.state="idle");}onKeyUp(e){}getCursor(e){return this.state==="dragging"||this.state==="pointing"?"grabbing":"grab"}applyCameraDelta(e,t){this.context.setCameraPosition(this.initialCameraPos.x+e,this.initialCameraPos.y+t);}};var hs={strokeColor:"#1f2937",fillColor:"transparent",strokeWidth:2,strokeDash:null},Ht=class extends X{type="line";isDrawing=false;startPoint={x:0,y:0};currentShape=null;onPointerDown(e,t){this.isDrawing=true,this.startPoint=e,this.currentShape={id:`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"line",x:e.x,y:e.y,points:[e],rotation:0,style:{...hs}},this.context.commitHistory(),this.context.addShape(this.currentShape);}onPointerMove(e,t){!this.isDrawing||!this.currentShape||this.context.updateShape(this.currentShape.id,{points:[this.startPoint,e]});}onPointerUp(e,t){let i=this.currentShape;this.isDrawing=false,this.currentShape=null,this.context.setActiveTool("select"),i&&i.points.length>=2&&this.context.selectShape(i.id,false);}onKeyDown(e){}onKeyUp(e){}getCursor(){return "crosshair"}};var ds={strokeColor:"#1f2937",fillColor:"transparent",fillOpacity:1,strokeWidth:4,strokeDash:null},us=.5,ps=16,yn="#ffeb3b",gs=4200,Le=class extends X{type;mode;isDrawing=false;points=[];currentShapeId=null;committed=false;fadeTimer=null;highlighterColor=yn;constructor(e,t){super(e),this.mode=t,this.type=t==="pen"?"pen":"highlighter";}setHighlighterColor(e){this.highlighterColor=e;}getHighlighterColor(){return this.highlighterColor}buildStyle(){return this.mode==="pen"?{...ds}:{strokeColor:z(this.highlighterColor,us),fillColor:"transparent",fillOpacity:1,strokeWidth:ps,strokeDash:null}}onPointerDown(e,t){this.isDrawing=true,this.committed=false,this.currentShapeId=null,this.points=[{...e}];}buildGeometry(e){let t=1/0,i=1/0,n=-1/0,o=-1/0;for(let u of e)u.x<t&&(t=u.x),u.y<i&&(i=u.y),u.x>n&&(n=u.x),u.y>o&&(o=u.y);let s=(t+n)/2,a=(i+o)/2,l=6,c=Math.max(1,n-t)+l*2,h=Math.max(1,o-i)+l*2,d=e.map(u=>({x:u.x-s,y:u.y-a}));return {x:s,y:a,width:c,height:h,points:d}}onPointerMove(e,t){if(this.isDrawing){if(this.points.push({...e}),!this.committed&&this.points.length>=2){this.context.commitHistory();let i=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;this.currentShapeId=i;let n=this.buildGeometry(this.points),o=this.buildStyle(),s={id:i,type:"draw",x:n.x,y:n.y,width:n.width,height:n.height,points:n.points,rotation:0,style:o};this.context.addShape(s),this.committed=true;}else if(this.committed&&this.currentShapeId){let i=this.buildGeometry(this.points);this.context.updateShape(this.currentShapeId,{x:i.x,y:i.y,width:i.width,height:i.height,points:i.points});}}}onPointerUp(e,t){if(!this.isDrawing||(this.isDrawing=false,!this.committed||!this.currentShapeId))return;let i=this.currentShapeId;this.currentShapeId=null,this.mode==="highlighter"&&(this.fadeTimer=setTimeout(()=>{this.context.deleteShape(i);},gs));}onKeyDown(e){}onKeyUp(e){}getCursor(){return "crosshair"}dispose(){this.fadeTimer&&(clearTimeout(this.fadeTimer),this.fadeTimer=null);}};var ms={strokeColor:"#1f2937",fillColor:"transparent",strokeWidth:2,strokeDash:null},fs=4,Rt=class extends X{type="arrow";isDrawing=false;startPoint={x:0,y:0};currentShapeId=null;startBindingInfo=null;startBinding;onPointerDown(e,t){this.isDrawing=true,this.startPoint=e,this.startBindingInfo=null,this.currentShapeId=null;let i=this.context.getShapes(),n=this.findShapeBinding(e,i),o=e;n&&(o=this.getBindingPosition(n.toShapeId,n.handle,i),this.startBindingInfo={...n,position:o}),this.startPoint=o,this.startBinding=n?{toShapeId:n.toShapeId,handle:n.handle}:void 0;}onPointerMove(e,t){if(!this.isDrawing)return;let i=this.context.getShapes(),n=this.findShapeBinding(e,i),o=e;n&&(o=this.getBindingPosition(n.toShapeId,n.handle,i));let s=this.startPoint;if(!this.currentShapeId){if(Math.hypot(o.x-s.x,o.y-s.y)<fs)return;let c=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,h=this.context.getArrowStyle(),d={id:c,type:"arrow",x:s.x,y:s.y,points:[s,o],rotation:0,style:{...ms},startBinding:this.startBinding,connectionType:h.connectionType,arrowHead:h.arrowHead,dashed:h.dashed};this.context.commitHistory(),this.context.addShape(d),this.currentShapeId=c;}let a=this.computeSnapGuides(s,o,n,i);this.context.setSnapGuides(a),this.context.updateShape(this.currentShapeId,{points:[s,o],endBinding:n?{toShapeId:n.toShapeId,handle:n.handle}:void 0});}onPointerUp(e,t){let i=this.currentShapeId;this.isDrawing=false,this.currentShapeId=null,this.startBindingInfo=null,this.startBinding=void 0,this.context.setSnapGuides([]),i&&(this.context.setActiveTool("select"),this.context.selectShape(i,false));}onKeyDown(e){}onKeyUp(e){}getCursor(){return "crosshair"}computeSnapGuides(e,t,i,n){let o=this.startBindingInfo?n.find(u=>u.id===this.startBindingInfo.toShapeId):null,s=i?n.find(u=>u.id===i.toShapeId):null;if(!o||!s)return [];let a=this.getShapeBounds(o),l=this.getShapeBounds(s),c=t.x-e.x,h=t.y-e.y,d=Math.abs(c)>=Math.abs(h)?"horizontal":"vertical";return Pe(a,l,d)}getShapeBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":return {x:e.x-e.width/2,y:e.y-e.height/2,width:e.width,height:e.height};case "circle":return {x:e.x-e.radius,y:e.y-e.radius,width:e.radius*2,height:e.radius*2};case "text":return {x:e.x-e.width/2,y:e.y-e.height/2,width:e.width,height:e.height};default:return {x:e.x-50,y:e.y-20,width:100,height:40}}}findShapeBinding(e,t){for(let n=t.length-1;n>=0;n--){let o=t[n];if(o.type==="arrow"||o.type==="line"||o.type==="draw")continue;let s;switch(o.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "uml-class":case "uml-interface":s=this.pointToRectDistance(e,{x:o.x-o.width/2,y:o.y-o.height/2,width:o.width,height:o.height});break;case "circle":{let a=Math.sqrt(Math.pow(e.x-o.x,2)+Math.pow(e.y-o.y,2));s=Math.abs(a-o.radius);break}case "hexagon":{let a=o.width/2,l=o.height/2,c=Math.abs(e.x-o.x),h=Math.abs(e.y-o.y);s=c/a+h/l-1;break}default:continue}if(s<=40){let a=this.getClosestHandle(e,o);return {toShapeId:o.id,handle:a}}}}pointToRectDistance(e,t){let i=Math.max(t.x,Math.min(e.x,t.x+t.width)),n=Math.max(t.y,Math.min(e.y,t.y+t.height));return Math.sqrt(Math.pow(e.x-i,2)+Math.pow(e.y-n,2))}getClosestHandle(e,t){let i=e.x-t.x,n=e.y-t.y;if(t.type==="circle"||t.type==="hexagon"){let c=Math.atan2(n,i);return c>=-Math.PI/4&&c<Math.PI/4?"right":c>=Math.PI/4&&c<3*Math.PI/4?"bottom":c>=3*Math.PI/4||c<-(3*Math.PI)/4?"left":"top"}let o="width"in t?t.width:100,s="height"in t?t.height:100,a=Math.abs(i)/(o/2),l=Math.abs(n)/(s/2);return a>l?i>0?"right":"left":n>0?"bottom":"top"}getBindingPosition(e,t,i){let n=i.find(o=>o.id===e);if(!n)return {x:0,y:0};switch(n.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":return this.getRectBindingPosition(n,t);case "circle":return this.getCircleBindingPosition(n,t);case "hexagon":return this.getRectBindingPosition(n,t);default:return {x:n.x,y:n.y}}}getRectBindingPosition(e,t){switch(t){case "top":return {x:e.x,y:e.y-e.height/2};case "bottom":return {x:e.x,y:e.y+e.height/2};case "left":return {x:e.x-e.width/2,y:e.y};case "right":return {x:e.x+e.width/2,y:e.y}}}getCircleBindingPosition(e,t){switch(t){case "top":return {x:e.x,y:e.y-e.radius};case "bottom":return {x:e.x,y:e.y+e.radius};case "left":return {x:e.x-e.radius,y:e.y};case "right":return {x:e.x+e.radius,y:e.y}}}};var ys={strokeColor:"transparent",fillColor:"transparent",strokeWidth:0,strokeDash:null},bn=class extends X{type="text";onPointerDown(e,t){let i=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n={id:i,type:"text",x:e.x,y:e.y,rotation:0,style:{...ys},text:"",fontSize:16,textColor:"#1f2937",width:200,height:24};this.context.commitHistory(),this.context.addShape(n),this.context.enterEditing(i);}onPointerMove(e,t){}onPointerUp(e,t){}onKeyDown(e){}onKeyUp(e){}getCursor(){return "text"}};var We="#1f2937";function wn(r){switch(r.type){case "rectangle":case "image":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":case "text":return {x:-(r.width/2),y:-(r.height/2),width:r.width,height:r.height};case "circle":return {x:-r.radius,y:-r.radius,width:r.radius*2,height:r.radius*2};case "line":case "arrow":{let e=r.points;if(!e||e.length===0)return {x:0,y:0,width:0,height:0};let t=1/0,i=1/0,n=-1/0,o=-1/0;for(let s of e){let a=s.x-r.x,l=s.y-r.y;t=Math.min(t,a),i=Math.min(i,l),n=Math.max(n,a),o=Math.max(o,l);}return {x:t,y:i,width:n-t,height:o-i}}case "draw":{let e=r,t=e.width,i=e.height;if(typeof t=="number"&&typeof i=="number")return {x:-t/2,y:-i/2,width:t,height:i};let n=e.points;if(!n||n.length===0)return {x:0,y:0,width:0,height:0};let o=1/0,s=1/0,a=-1/0,l=-1/0;for(let c of n)o=Math.min(o,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),l=Math.max(l,c.y);return {x:o,y:s,width:a-o,height:l-s}}default:return {x:0,y:0,width:0,height:0}}}function bs(r){let e=wn(r),t=Math.cos(r.rotation),i=Math.sin(r.rotation),n=1/0,o=1/0,s=-1/0,a=-1/0,l=[[e.x,e.y],[e.x+e.width,e.y],[e.x+e.width,e.y+e.height],[e.x,e.y+e.height]];for(let[c,h]of l){let d=c*t-h*i+r.x,u=c*i+h*t+r.y;n=Math.min(n,d),o=Math.min(o,u),s=Math.max(s,d),a=Math.max(a,u);}return {x:n,y:o,width:s-n,height:a-o}}function rt(r,e=24){if(!r||r.length===0)return {x:0,y:0,width:400,height:300};let t=1/0,i=1/0,n=-1/0,o=-1/0;for(let s of r){let a=bs(s);t=Math.min(t,a.x),i=Math.min(i,a.y),n=Math.max(n,a.x+a.width),o=Math.max(o,a.y+a.height);}return {x:t-e,y:i-e,width:n-t+e*2,height:o-i+e*2}}function Ro(r,e={}){let t=e.padding??24,i=e.background===void 0?"#ffffff":e.background??null,n=rt(r,t),o=Math.max(1,Math.ceil(n.width)),s=Math.max(1,Math.ceil(n.height)),a=Math.max(.01,e.scale??2);e.maxSize&&e.maxSize>0&&(a=Math.min(a,e.maxSize/Math.max(o,s))),a=Math.max(.01,a);let l=document.createElement("canvas");l.width=Math.max(1,Math.round(o*a)),l.height=Math.max(1,Math.round(s*a));let c=new Ge(l,a);c.resize(o,s);let h=new Re;return h.zoom=1,h.x=-n.x,h.y=-n.y,c.render(r,h,new Set,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,i),l}function xs(r,e,t){return new Promise((i,n)=>{r.toBlob(o=>{o?i(o):n(new Error("canvas.toBlob failed"));},e,t);})}function ws(r,e,t){return r.toDataURL(e,t)}var Et=null;function De(r,e){return Et||(Et=document.createElement("canvas").getContext("2d")),Et?(Et.font=e,Et.measureText(r).width):r.length*8}function Me(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Sn(r,e,t,i,n=false){let o=e*1.3,s=Math.max(1,Math.floor(i/o)),a=`${n?"bold ":""}${e}px sans-serif`,l=r.split(`
|
|
6
|
-
`),c=[];for(let d of l){let u="";for(let p of d){let g=u+p;De(g,a)>t&&u?(c.push(u),u=p):u=g;}u&&c.push(u);}let h=c.slice(0,s);if(c.length>s&&h.length>0){let d=h[h.length-1],u="...";for(;d.length>0&&De(d+u,a)>t;)d=d.slice(0,-1);h[h.length-1]=d+u;}return h}function Li(r,e,t){if(De(r,t)<=e)return r;let i="\u2026",n=0,o=r.length;for(;n<o;){let s=n+o+1>>1;De(r.slice(0,s)+i,t)<=e?n=s:o=s-1;}return r.slice(0,n)+i}function Ae(r){return r.map(([e,t])=>`${M(e)},${M(t)}`).join(" ")}function xn(r){return r.map(e=>e[0]==="Z"?"Z":e[0]==="M"||e[0]==="L"?`${e[0]} ${M(e[1])} ${M(e[2])}`:`C ${M(e[1])} ${M(e[2])} ${M(e[3])} ${M(e[4])} ${M(e[5])} ${M(e[6])}`).join(" ")}function Ss(r){let e=r;if(!e.text||r.type==="text"||r.type==="line"||r.type==="arrow"||r.type==="draw")return "";let t=e.fontSize||16,i=r.type==="brace-left"||r.type==="brace-right",n=r.type==="sticky-note",o=e.width??(e.radius?e.radius*2:100),s=e.height??(e.radius?e.radius*2:40),a=n?je:.85,l=o*(i?1-Pt:1)*a,c=s*a,h=Sn(String(e.text),t,l,c);return Hi(h,t,e.textColor||We,M(fn(r)),0)}function M(r){return Math.round(r*100)/100}var Eo="drawui-paper-shadow";function Ms(r){let e=M(r.offsetY??0),t=M(r.offsetX??0);return `<filter id="${Eo}" x="-40%" y="-40%" width="180%" height="180%"><feDropShadow dx="${t}" dy="${e}" stdDeviation="${M(r.blur*.45)}" flood-color="${r.color}" flood-opacity="${M(r.opacity??.2)}" /></filter>`}function No(r){return r.strokeDash&&r.strokeDash.length?r.strokeDash.join(","):void 0}function To(r,e){let t=e.x-r.x,i=e.y-r.y,n=Math.cos(r.rotation),o=Math.sin(r.rotation);return {x:t*n-i*o+r.x,y:t*o+i*n+r.y}}var Ai=It;function Cs(r,e,t){return Tt(r,e,t)}function Is(r,e,t){let i=r.endBinding;if(!i||!i.auto||i.isPrecise)return i;let n=r.startBinding?.handle?Ai[r.startBinding.handle]:void 0;return {...i,handle:Cs(e,{x:t.x,y:t.y},n)}}function vo(r,e){if(e.isPrecise&&e.normalizedAnchor){let t=wn(r),i=r.x+t.x+t.width*e.normalizedAnchor.x,n=r.y+t.y+t.height*e.normalizedAnchor.y;return {x:i,y:n}}if(e.handle){let t=wn(r);switch(e.handle){case "top":return {x:r.x,y:r.y+t.y};case "bottom":return {x:r.x,y:r.y+t.y+t.height};case "left":return {x:r.x+t.x,y:r.y};case "right":return {x:r.x+t.x+t.width,y:r.y}}}return {x:r.x,y:r.y}}function Ts(r,e){let t=r.points.map(c=>({...c})),i,n,o,s;if(t.length===0)return {raw:t,pts:t,fromN:i,toN:n};if(r.startBinding){let c=e.get(r.startBinding.toShapeId);c&&(t[0]=vo(c,r.startBinding),!r.startBinding.isPrecise&&r.startBinding.handle&&(i=Ai[r.startBinding.handle]),o=ko(c));}if(r.endBinding){let c=e.get(r.endBinding.toShapeId);if(c){let h=Is(r,t[0],c)??r.endBinding;t[t.length-1]=vo(c,h),!h.isPrecise&&h.handle&&(n=Ai[h.handle]),s=ko(c);}}let a=t.map(c=>({...c})),l=t;if(r.userPoints&&r.userPoints.length>0&&t.length>=2){let c=Di([t[0],t[t.length-1]]),h=r.connectionType||"straight",[d,u]=h==="curve"?[t[0],t[t.length-1]]:c,p=h==="curve"?r.userPoints.map(g=>({...g})):Gt(r.userPoints,r.userPointsRef,d,u,i,n);l=[d,...p,u];}return {raw:a.map(c=>To(r,c)),pts:l.map(c=>To(r,c)),fromN:i,toN:n,fromBox:o,toBox:s}}function ko(r){let e=wn(r);return {x:r.x+e.x,y:r.y+e.y,width:e.width,height:e.height}}function Di(r){if(r.length<2)return r;let e=r[0],t=r[r.length-1],i=t.x-e.x,n=t.y-e.y,o=8;if(Math.abs(n)<=o){let s=(e.y+t.y)/2;return r.map(a=>({x:a.x,y:s}))}if(Math.abs(i)<=o){let s=(e.x+t.x)/2;return r.map(a=>({x:s,y:a.y}))}return r}function vs(r){if(r.length<2)return "";let e=`M ${M(r[0].x)} ${M(r[0].y)}`,t=r[0];for(let i=1;i<r.length;i++){let n=r[i],o=n.x-t.x,s=n.y-t.y,a=Math.hypot(o,s),l={x:(t.x+n.x)/2,y:(t.y+n.y)/2};if(a>=1){let c=-s/a,h=o/a,d=Math.min(a*.2,30);l={x:l.x+c*d,y:l.y+h*d};}e+=` Q ${M(l.x)} ${M(l.y)} ${M(n.x)} ${M(n.y)}`,t=n;}return e}function Po(r,e,t,i,n=false,o,s){let a=n&&e==="straight"?"polyline":e;return a==="curve"?r:a==="straight"?r.length===2?Di(r):r:r.length===2?vt(Di(r),{fromN:t,toN:i,fromBox:o,toBox:s}):vt(r,{fromN:t,toN:i,fromBox:o,toBox:s},wi,false)}function ks(r){if(r.length<2)return "";let e=`M ${M(r[0].x)} ${M(r[0].y)}`;for(let t=1;t<r.length;t++)e+=` L ${M(r[t].x)} ${M(r[t].y)}`;return e}function ki(r,e,t,i){let n=Math.atan2(e.y-r.y,e.x-r.x),o=12,s={x:e.x-o*Math.cos(n-Math.PI/6),y:e.y-o*Math.sin(n-Math.PI/6)},a={x:e.x-o*Math.cos(n+Math.PI/6),y:e.y-o*Math.sin(n+Math.PI/6)};return `<path d="M ${M(e.x)} ${M(e.y)} L ${M(s.x)} ${M(s.y)} M ${M(e.x)} ${M(e.y)} L ${M(a.x)} ${M(a.y)}" stroke="${t}" stroke-width="${i}" stroke-linecap="round" fill="none" />`}function Lo(r,e,t,i){let n=Math.atan2(e.y-r.y,e.x-r.x),o=14,s=e.x,a=e.y,l=e.x-o*Math.cos(n),c=e.y-o*Math.sin(n),h=l+o*.5*Math.cos(n-Math.PI/2),d=c+o*.5*Math.sin(n-Math.PI/2),u=l+o*.5*Math.cos(n+Math.PI/2),p=c+o*.5*Math.sin(n+Math.PI/2);return `<polygon points="${M(s)},${M(a)} ${M(h)},${M(d)} ${M(u)},${M(p)}" fill="#ffffff" stroke="${t}" stroke-width="${i}" />`}function Ao(r,e,t,i,n){let o=Math.atan2(e.y-r.y,e.x-r.x),s=14,a=e.x,l=e.y,c=e.x-s*.5*Math.cos(o),h=e.y-s*.5*Math.sin(o),d=e.x-s*Math.cos(o),u=e.y-s*Math.sin(o),p=c+s*.4*Math.cos(o-Math.PI/2),g=h+s*.4*Math.sin(o-Math.PI/2),m=c+s*.4*Math.cos(o+Math.PI/2),f=h+s*.4*Math.sin(o+Math.PI/2);return `<polygon points="${M(a)},${M(l)} ${M(p)},${M(g)} ${M(d)},${M(u)} ${M(m)},${M(f)}" fill="${n?t:"#ffffff"}" stroke="${t}" stroke-width="${i}" />`}function Ps(r,e,t,i){if(e==="none"||r.length<2)return "";let n="";return (e==="start"||e==="both")&&(n+=ki(r[1],r[0],t,i)),(e==="end"||e==="both")&&(n+=ki(r[r.length-2],r[r.length-1],t,i)),e==="inheritance"&&(n+=Lo(r[r.length-2],r[r.length-1],t,i)),e==="aggregation"&&(n+=Ao(r[1],r[0],t,i,false)),e==="composition"&&(n+=Ao(r[1],r[0],t,i,true)),e==="dependency"&&(n+=ki(r[r.length-2],r[r.length-1],t,i)),e==="realization"&&(n+=Lo(r[r.length-2],r[r.length-1],t,i)),n}function Hi(r,e,t,i=0,n=0){if(r.length===0)return "";let o=e*1.3,a=-(r.length*o)/2+o/2,l=r.map((c,h)=>`<tspan x="${M(i)}" y="${M(n+a+h*o)}">${Me(c)}</tspan>`).join("");return `<text text-anchor="middle" dominant-baseline="central" font-family="sans-serif" font-size="${e}" fill="${t}">${l}</text>`}function F(r,e,t){let i=t??No(r),n=e&&r.fillColor!=="transparent",o=r.fillOpacity??1,s=r.strokeOpacity??1;return [n?`fill="${r.fillColor}"`:'fill="none"',n&&o<1?`fill-opacity="${M(o)}"`:"",`stroke="${r.strokeColor}"`,s<1&&r.strokeColor!=="transparent"?`stroke-opacity="${M(s)}"`:"",`stroke-width="${r.strokeWidth}"`,'stroke-linecap="round"','stroke-linejoin="round"',i?`stroke-dasharray="${i}"`:""].filter(Boolean).join(" ")}function Do(r,e){let{width:t,height:i}=r,n=t/2,o=i/2,s=`${ee}px sans-serif`,a=ge,l=e?0:r.attributes.length>0?r.attributes.length*V+_*2:_*2,c=t-ne*2,h=[];h.push(`<rect x="${M(-n)}" y="${M(-o)}" width="${t}" height="${i}" ${F(r.style,true)} />`),h.push(`<line x1="${M(-n)}" y1="${M(-o+a)}" x2="${M(n)}" y2="${M(-o+a)}" stroke="${r.style.strokeColor}" stroke-width="${r.style.strokeWidth}" />`),e||h.push(`<line x1="${M(-n)}" y1="${M(-o+a+l)}" x2="${M(n)}" y2="${M(-o+a+l)}" stroke="${r.style.strokeColor}" stroke-width="${r.style.strokeWidth}" />`);let d=e?`<<${r.className||"Interface"}>>`:r.className;h.push(`<text text-anchor="middle" dominant-baseline="central" font-family="sans-serif" font-weight="bold" font-size="${ee}" fill="${r.textColor||We}" x="0" y="${M(-o+a/2)}">${Me(Li(d,c,s))}</text>`);let u=(g,m,f,b,x)=>{let I=`${f||ee}px sans-serif`,T=Li(g,c,I),w=`<text text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-size="${f||ee}" fill="${b||We}" x="${M(-n+ne)}" y="${M(m)}">${Me(T)}</text>`;if(x){let S=De(T,I);w+=`<line x1="${M(-n+ne)}" y1="${M(m)}" x2="${M(-n+ne+S)}" y2="${M(m)}" stroke="${b||We}" stroke-width="1" />`;}return w};if(!e){let g=-o+a+_+V/2;r.attributes.forEach((m,f)=>{let b=Ee(m);b&&h.push(u(b,g+f*V,m.fontSize||r.fontSize||0,m.textColor||r.textColor||"",!!m.strikethrough));});}let p=-o+a+l+_+V/2;return r.methods.forEach((g,m)=>{let f=xe(g);f&&h.push(u(f,p+m*V,g.fontSize||r.fontSize||0,g.textColor||r.textColor||"",!!g.strikethrough));}),h.join("")}function Ls(r){let{width:e,height:t}=r,i=e/2,n=t/2,o=ze(r.cells),s=[];r.style.fillColor!=="transparent"&&s.push(`<rect x="${M(-i)}" y="${M(-n)}" width="${M(e)}" height="${M(t)}" fill="${r.style.fillColor}" />`);for(let l=0;l<r.cells.length;l++)for(let c=0;c<(r.cells[l]?.length??0);c++){if(o[l]?.[c])continue;let h=r.cells[l][c];if(!h.fillColor)continue;let d=ie(r,l,c);s.push(`<rect x="${M(d.ox-i)}" y="${M(d.oy-n)}" width="${M(d.width)}" height="${M(d.height)}" fill="${h.fillColor}" />`);}let a=`stroke="${Jt}" stroke-width="${1}"`;for(let l=1;l<r.rowHeights.length;l++){let c=-n+r.rowHeights.slice(0,l).reduce((d,u)=>d+u,0),h=[];for(let d=0;d<l;d++)for(let u=0;u<(r.cells[d]?.length??0);u++){let g=r.cells[d][u].rowSpan??1;if(g>1&&d+g>l){let m=ie(r,d,u);h.push([m.ox-i,m.ox-i+m.width]);}}for(let[d,u]of Ho(-i,i,h))s.push(`<line x1="${M(d)}" y1="${M(c)}" x2="${M(u)}" y2="${M(c)}" ${a} />`);}for(let l=1;l<r.colWidths.length;l++){let c=-i+r.colWidths.slice(0,l).reduce((d,u)=>d+u,0),h=[];for(let d=0;d<l;d++)for(let u=0;u<r.cells.length;u++){let p=r.cells[u]?.[d];if(!p)continue;let g=p.colSpan??1;if(g>1&&d+g>l){let m=ie(r,u,d);h.push([m.oy-n,m.oy-n+m.height]);}}for(let[d,u]of Ho(-n,n,h))s.push(`<line x1="${M(c)}" y1="${M(d)}" x2="${M(c)}" y2="${M(u)}" ${a} />`);}s.push(`<rect x="${M(-i)}" y="${M(-n)}" width="${M(e)}" height="${M(t)}" ${F(r.style,true)} />`);for(let l=0;l<r.cells.length;l++)for(let c=0;c<(r.cells[l]?.length??0);c++){if(o[l]?.[c])continue;let h=r.cells[l][c];if(!h.text)continue;let d=ie(r,l,c),u=h.fontSize||r.fontSize||14,p=d.width-20,g=Math.max(u*1.3,d.height-8),m=Sn(h.text,u,p,g,!!h.bold),f=h.align==="center"?"middle":h.align==="right"?"end":"start",b=h.align==="center"?d.ox-i+d.width/2:h.align==="right"?d.ox-i+d.width-10:d.ox-i+10,x=h.bold?'font-weight="bold" ':"",I=u*1.3,T=d.oy-n+St(m.length,I,d.height);s.push(`<text text-anchor="${f}" dominant-baseline="central" font-family="sans-serif" ${x}font-size="${u}" fill="${h.textColor||r.textColor||Qt}">${m.map((w,S)=>`<tspan x="${M(b)}" y="${M(T+S*I)}">${Me(w)}</tspan>`).join("")}</text>`);}return s.join("")}function Ho(r,e,t){let i=[...t].sort((s,a)=>s[0]-a[0]),n=[],o=r;for(let[s,a]of i)if(s>o&&n.push([o,Math.min(s,e)]),o=Math.max(o,a),o>=e)break;return o<e&&n.push([o,e]),n.filter(([s,a])=>a-s>=.5)}function As(r){let t=N(r.root).positions,i=[],n=s=>{if(s.collapsed)return;let a=t.get(s.id);if(a)for(let l of s.children??[]){let c=t.get(l.id);if(!c)continue;let h=c.direction,d=Ne(l,c.depth),u=h==="right"?r.x+a.x+a.width/2:h==="left"?r.x+a.x-a.width/2:r.x+a.x,p=h==="down"?r.y+a.y+a.height/2:h==="up"?r.y+a.y-a.height/2:r.y+a.y,g=h==="right"?r.x+c.x-c.width/2:h==="left"?r.x+c.x+c.width/2:r.x+c.x,m=h==="down"?r.y+c.y-c.height/2:h==="up"?r.y+c.y+c.height/2:r.y+c.y,f;if(h==="right"||h==="left"){let b=(u+g)/2;f=`M ${M(u)} ${M(p)} C ${M(b)} ${M(p)} ${M(b)} ${M(m)} ${M(g)} ${M(m)}`;}else {let b=(p+m)/2;f=`M ${M(u)} ${M(p)} C ${M(u)} ${M(b)} ${M(g)} ${M(b)} ${M(g)} ${M(m)}`;}i.push(`<path d="${f}" stroke="${d}" stroke-width="2" fill="none" stroke-linecap="round" />`),n(l);}};n(r.root);let o=s=>{let a=t.get(s.id);if(!a)return;let l=Ne(s,a.depth),c=a.width/2,h=a.height/2,d=r.x+a.x,u=r.y+a.y;if(i.push(`<rect x="${M(d-c)}" y="${M(u-h)}" width="${a.width}" height="${a.height}" rx="6" ry="6" fill="#ffffff" stroke="${l}" stroke-width="2" />`),s.note){let I="11px sans-serif",T=s.noteColor??l,w=Math.min(De(s.note,I)+12,130),S=16,C=De(s.note,I)+12>130?s.note.slice(0,12)+"\u2026":s.note;i.push(`<rect x="${M(d-c)}" y="${M(u-h-S+2)}" width="${w}" height="${S}" rx="4" ry="4" fill="${T}" />`),i.push(`<text text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-size="11" fill="#ffffff" x="${M(d-c+6)}" y="${M(u-h-S/2+2)}">${Me(C)}</text>`);}let p=s.icon?18:0,g=a.width-p-(s.icon?8:0)-16,m=Li(s.text||"",g,`${14}px sans-serif`),f=De(m,`${14}px sans-serif`),b=p+(p?8:0)+f,x=d-b/2;if(s.icon&&(i.push(`<text text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-size="16" fill="#1f2937" x="${M(x)}" y="${M(u)}">${Me(s.icon)}</text>`),x+=p+8),i.push(`<text text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-size="${14}" fill="#1f2937" x="${M(x)}" y="${M(u)}">${Me(m)}</text>`),s.children&&s.children.length>0&&!s.collapsed)for(let I of s.children)o(I);};return o(r.root),i.join("")}function Ds(r,e){let t=r.rotation*180/Math.PI,i=r.flipX||r.flipY?`<g transform="scale(${r.flipX?-1:1} ${r.flipY?-1:1})">`:"",n=i?"</g>":"",o=`<g transform="translate(${M(r.x)} ${M(r.y)}) rotate(${M(t)})">${i}`,s=`${n}${Ss(r)}</g>`,a=r.style;switch(r.type){case "image":{let l=r,c=l.width??0,h=l.height??0,d=Math.max(0,Math.min(l.borderRadius??0,c/2,h/2)),u=`x="${M(-c/2)}" y="${M(-h/2)}" width="${M(c)}" height="${M(h)}"`;if(!l.src)return `${o}<rect ${u}${d>0?` rx="${M(d)}"`:""} fill="#f3f4f6" stroke="#e5e7eb" />${s}`;let p=En(l.src)||l.src,g=`<image href="${Me(p)}" ${u} preserveAspectRatio="none" />`;if(d>0){let m=`dw-img-clip-${String(l.id).replace(/[^a-zA-Z0-9_-]/g,"")}`;return `${o}<defs><clipPath id="${m}"><rect ${u} rx="${M(d)}" /></clipPath></defs><g clip-path="url(#${m})">${g}</g>${s}`}return `${o}${g}${s}`}case "rectangle":{let l=r.width,c=r.height;return `${o}<rect x="${M(-l/2)}" y="${M(-c/2)}" width="${l}" height="${c}" ${F(a,true)} />${s}`}case "rounded-rectangle":{let l=r.width,c=r.height,h=r.borderRadius||8;return `${o}<rect x="${M(-l/2)}" y="${M(-c/2)}" width="${l}" height="${c}" rx="${h}" ry="${h}" ${F(a,true)} />${s}`}case "stadium":{let l=r.width,c=r.height,h=Math.min(l,c)/2;return `${o}<rect x="${M(-l/2)}" y="${M(-c/2)}" width="${l}" height="${c}" rx="${h}" ry="${h}" ${F(a,true)} />${s}`}case "circle":{let l=r.radius;return `${o}<circle cx="0" cy="0" r="${l}" ${F(a,true)} />${s}`}case "ellipse":{let l=r.width,c=r.height;return `${o}<ellipse cx="0" cy="0" rx="${l/2}" ry="${c/2}" ${F(a,true)} />${s}`}case "diamond":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae([[0,-c/2],[l/2,0],[0,c/2],[-l/2,0]])}" ${F(a,true)} />${s}`}case "triangle":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae([[0,-c/2],[l/2,c/2],[-l/2,c/2]])}" ${F(a,true)} />${s}`}case "hexagon":{let l=r.width,c=r.height,h=r.orientation==="flat"?Math.PI/6:0;return `${o}<polygon points="${Ae(Pi(l,c,6,-Math.PI/2+h))}" ${F(a,true)} />${s}`}case "pentagon":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae(Pi(l,c,5,-Math.PI/2))}" ${F(a,true)} />${s}`}case "octagon":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae(Pi(l,c,8,-Math.PI/8))}" ${F(a,true)} />${s}`}case "star":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae(Hs(l,c))}" ${F(a,true)} />${s}`}case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "sticky-note":{let l=r.width,c=r.height,h=Lt(r.type);if(!h)return "";let d=h.shadow?` filter="url(#${Eo})"`:"",u=`<path d="${xn(de(h.outline,l,c))}" ${F(a,!h.strokeOnly)}${d} />`,p=(h.overlays??[]).map(b=>{let x=b.fill??"auto",I=x==="none"?"transparent":x==="auto"?b.deriveFill?b.deriveFill(a.fillColor):a.fillColor:x,T={...a,fillColor:I,strokeColor:b.stroke===false?"transparent":a.strokeColor};return `<path d="${xn(de(b.cmds,l,c))}" ${F(T,x!=="none")} />`}).join(""),g=(h.seams??[]).map(b=>`<path d="${xn(de(b,l,c))}" ${F({...a,fillColor:"transparent"},true)} />`).join(""),m=`${M(a.strokeWidth*ot[0])},${M(a.strokeWidth*ot[1])}`,f=(h.hiddenSeams??[]).map(b=>`<path d="${xn(de(b,l,c))}" ${F({...a,fillColor:"transparent"},true,m)} />`).join("");return `${o}${u}${p}${g}${f}${s}`}case "icon":{let l=r.width,c=r.height,h=Ve(r.iconId);if(!h)return `${o}${s}`;let d=a.fillColor!=="transparent"?a.fillColor:We,u=[];h.disc&&u.push(`<circle cx="${K/2}" cy="${K/2}" r="${K/2-1}" fill="${h.disc}" />`);for(let g of h.layers){let m=g.fill??"ink",f=g.stroke??"ink",b=[m==="none"?'fill="none"':`fill="${m==="ink"?d:m}"`,f==="none"?"":`stroke="${f==="ink"?d:f}" stroke-width="${g.w??1.8}" stroke-linecap="round" stroke-linejoin="round"`].filter(Boolean).join(" ");u.push(`<path d="${g.d}" ${b} />`);}let p=h.label;return p&&u.push(`<text x="${K/2}" y="${K/2+.5}" text-anchor="middle" dominant-baseline="central" font-family="sans-serif" font-size="${p.size??13}" fill="${p.color}">${Me(p.text)}</text>`),`${o}<g transform="translate(${M(-l/2)} ${M(-c/2)}) scale(${M(l/K)} ${M(c/K)})">${u.join("")}</g>${s}`}case "parallelogram":{let l=r.width,c=r.height,h=l*.2;return `${o}<polygon points="${Ae([[-l/2+h,-c/2],[l/2,-c/2],[l/2-h,c/2],[-l/2,c/2]])}" ${F(a,true)} />${s}`}case "trapezoid":{let l=r.width,c=r.height,h=r.topInset??l*.15;return `${o}<polygon points="${Ae([[-l/2+h,-c/2],[l/2-h,-c/2],[l/2,c/2],[-l/2,c/2]])}" ${F(a,true)} />${s}`}case "uml-class":return `${o}${Do(r,false)}${s}`;case "uml-interface":return `${o}${Do(r,true)}${s}`;case "table":return `${o}${Ls(r)}${s}`;case "mind-map":return As(r);case "line":case "arrow":{let l=r,c=l.connectionType||"straight",{raw:h,pts:d,fromN:u,toN:p,fromBox:g,toBox:m}=Ts(l,e);if(d.length<2)return "";let f=!!(l.userPoints&&l.userPoints.length),b=Po(h,c,u,p,false,g,m),x=b;if(f){let L=Po(d,c,u,p,true,g,m);Ut({userRoute:L,autoRoute:b,base:l.userPointsBase,fromBox:g,toBox:m})||(x=L);}if(x.length<2)return "";let I=l.style.strokeColor,T=l.style.strokeWidth,S=l.type==="arrow"&&(!!l.dashed||l.arrowHead==="dependency"||l.arrowHead==="realization")?"8,5":No(l.style),v=`<path d="${c==="curve"?vs(x):ks(x)}" fill="none" stroke="${I}" stroke-width="${T}" stroke-linecap="round" stroke-linejoin="round"${S?` stroke-dasharray="${S}"`:""} />`,k=Ps(x,l.arrowHead||"end",I,T);return `${v}${k}`}case "draw":{let l=r,c=l.points;if(!c||c.length<2)return "";let h=Math.cos(l.rotation||0),d=Math.sin(l.rotation||0),u=c.map(g=>({x:g.x*h-g.y*d+l.x,y:g.x*d+g.y*h+l.y}));if(u.length<2)return "";let p=`M ${M(u[0].x)} ${M(u[0].y)}`;for(let g=1;g<u.length-1;g++){let m=(u[g].x+u[g+1].x)/2,f=(u[g].y+u[g+1].y)/2;p+=` Q ${M(u[g].x)} ${M(u[g].y)} ${M(m)} ${M(f)}`;}return p+=` L ${M(u[u.length-1].x)} ${M(u[u.length-1].y)}`,`<path d="${p}" fill="none" stroke="${a.strokeColor}" stroke-width="${a.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" />`}case "text":{let l=r,c=l.fontSize||16,h=l.textColor||We,d=Sn(l.text||"",c,l.width,l.height),u="";if(l.highlightColor&&l.highlightColor!=="transparent"){let p=c*.15,g=typeof l.highlightOpacity=="number"?l.highlightOpacity:1,m=g<1?` fill-opacity="${M(g)}"`:"";u+=`<rect x="${M(-l.width/2-p)}" y="${M(-(d.length*c*1.3)/2-p)}" width="${l.width+p*2}" height="${d.length*c*1.3+p*2}" rx="4" fill="${l.highlightColor}"${m} />`;}return u+=Hi(d,c,h),`${o}${u}${s}`}default:{let l=r,c=l.width||100,h=l.height||40,d="";if(l.text){let u=l.fontSize||16,p=Sn(l.text,u,c*.85,h*.85);d+=Hi(p,u,l.textColor||We);}return `${o}<rect x="${M(-c/2)}" y="${M(-h/2)}" width="${c}" height="${h}" ${F(a,true)} />${d}${s}`}}}function Pi(r,e,t,i){let n=r/2,o=e/2,s=[];for(let a=0;a<t;a++){let l=a*2*Math.PI/t+i;s.push([n*Math.cos(l),o*Math.sin(l)]);}return s}function Hs(r,e){let t=r/2,i=e/2,n=5,o=.4,s=[];for(let a=0;a<n*2;a++){let l=a*Math.PI/n-Math.PI/2,c=a%2===0?1:o;s.push([t*c*Math.cos(l),i*c*Math.sin(l)]);}return s}function Bo(r,e={}){let t=e.padding??24,i=e.background===void 0?"#ffffff":e.background??null,n=rt(r,t),o=Math.max(1,Math.ceil(n.width)),s=Math.max(1,Math.ceil(n.height)),a=new Map(r.map(u=>[u.id,u])),l=r.map(u=>Ds(u,a)).filter(Boolean).join(`
|
|
7
|
-
`),c=i?`<rect x="${M(n.x)}" y="${M(n.y)}" width="${o}" height="${s}" fill="${i}" />`:"",h=r.map(u=>
|
|
1
|
+
var Pn=r=>!!r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.width)&&Number.isFinite(r.height);function He(r){return !Pn(r)||r.width<=0||r.height<=0}function ht(r,e){if(He(r))return Pn(e)?{...e}:null;if(He(e))return {...r};let t=r,i=e,n=Math.min(t.x,i.x),o=Math.min(t.y,i.y),s=Math.max(t.x+t.width,i.x+i.width),a=Math.max(t.y+t.height,i.y+i.height);return {x:n,y:o,width:s-n,height:a-o}}function Ln(r,e){if(He(r)||He(e))return false;let t=r,i=e;return t.x<i.x+i.width&&i.x<t.x+t.width&&t.y<i.y+i.height&&i.y<t.y+t.height}function Oi(r,e){if(!Ln(r,e))return [{...r}];let t=[],i=r.x+r.width,n=r.y+r.height,o=e.x+e.width,s=e.y+e.height;e.y>r.y&&t.push({x:r.x,y:r.y,width:r.width,height:e.y-r.y}),s<n&&t.push({x:r.x,y:s,width:r.width,height:n-s});let a=Math.max(r.y,Math.min(e.y,n)),l=Math.max(0,Math.min(s,n)-a);return l>0&&e.x>r.x&&t.push({x:r.x,y:a,width:e.x-r.x,height:l}),l>0&&o<i&&t.push({x:o,y:a,width:i-o,height:l}),t}var $i=(r,e)=>({x:r.x-e,y:r.y-e,width:r.width+e*2,height:r.height+e*2}),kn=class{current=null;reset(e=null){this.current=Pn(e)?{...e}:null;}get(){return this.current?{...this.current}:null}desiredOf(e){let t=e.padding??40,i=e.viewport,n=e.minSize?.width??i.width,o=e.minSize?.height??i.height,s=e.anchor??{x:0,y:0},a;return He(e.content)?a={x:s.x,y:s.y,width:Math.max(i.width,n),height:Math.max(i.height,o)}:a=$i(e.content,t),e.includeViewport===false?a:ht(a,$i(i,t))}update(e){let t=e.viewport,i=this.desiredOf(e);if(He(this.current))return this.current=i,{extent:{...i},changed:true,action:"init"};let n=this.current;if(i.x<n.x-.5||i.y<n.y-.5||i.x+i.width>n.x+n.width+.5||i.y+i.height>n.y+n.height+.5){let c=ht(n,i),h=Math.abs(c.x-n.x)>.5||Math.abs(c.y-n.y)>.5||Math.abs(c.width-n.width)>.5||Math.abs(c.height-n.height)>.5;return this.current=c,{extent:{...c},changed:h,action:h?"grow":"hold"}}if(!e.pointerMoved)return {extent:{...n},changed:false,action:"hold",holdReason:"pointer-still"};if(Oi(n,i).some(c=>Ln(c,t)))return {extent:{...n},changed:false,action:"hold",holdReason:"still-visible"};let l=Math.abs(i.x-n.x)>.5||Math.abs(i.y-n.y)>.5||Math.abs(i.width-n.width)>.5||Math.abs(i.height-n.height)>.5;return this.current=i,{extent:{...i},changed:l,action:l?"shrink":"hold"}}};var pe=new Map,_t=new Set,An="anonymous",Vt=new Map,Dn=new Set;function Hn(r){return Dn.add(r),()=>Dn.delete(r)}function zi(){for(let r of Array.from(Dn))try{r();}catch{}}function zo(r){An=r;}var Go=r=>/^https?:/i.test(r);function $t(r){if(!r)return null;let e=pe.get(r);return e?e.status==="ready"?e.loaded:null:(Ke(r),null)}function Rn(r){return pe.get(r)?.status==="error"}function Uo(r){return pe.get(r)?.status==="loading"}function Ke(r){if(!r)return Promise.resolve(null);let e=pe.get(r);return e?e.status==="ready"?Promise.resolve(e.loaded):e.status==="error"?Promise.resolve(null):Wo(r):(pe.set(r,{status:"loading"}),new Promise(t=>{let i=new Image;An&&Go(r)&&(i.crossOrigin=An);let n=o=>{if(o&&i.naturalWidth>0){let s={img:i,width:i.naturalWidth,height:i.naturalHeight,src:r};pe.set(r,{status:"ready",loaded:s}),zi(),t(s);}else pe.set(r,{status:"error"}),zi(),t(null);};i.onload=()=>n(true),i.onerror=()=>n(false);try{i.src=r;}catch{n(false);}}))}function Wo(r){return new Promise(e=>{let t=0,i=()=>{let n=pe.get(r);if(!n||n.status==="ready")return e(n&&n.status==="ready"?n.loaded:null);if(n.status==="error"||++t>600)return e(null);setTimeout(i,50);};i();})}async function En(r){let e=new Set;for(let t of r)t.type==="image"&&t.src&&e.add(t.src);await Promise.all(Array.from(e).map(t=>Ke(t)));}function Nn(r){if(!r)return null;if(r.startsWith("data:"))return r;let e=Vt.get(r);if(e)return e;let t=$t(r);if(!t)return null;try{let i=document.createElement("canvas");i.width=t.width,i.height=t.height;let n=i.getContext("2d");if(!n)return null;n.drawImage(t.img,0,0);let o=i.toDataURL("image/png");return Vt.set(r,o),o}catch{return null}}function Gi(r){r.startsWith("blob:")&&_t.add(r);}function Bn(r){if(!(!r.startsWith("blob:")||!_t.has(r))){_t.delete(r),pe.delete(r),Vt.delete(r);try{URL.revokeObjectURL(r);}catch{}}}function Fo(){for(let r of Array.from(_t))Bn(r);pe.clear(),Vt.clear();}var Ot=31457280;function Ui(r){return typeof r=="function"}var Ko=r=>!!r&&typeof r=="object"&&typeof r.url=="string";function Wi(r,e){return e.split(".").reduce((t,i)=>{if(t&&typeof t=="object")return t[i]},r)}function Yo(r){if(typeof r=="string")return r.trim()||null;if(!r||typeof r!="object")return null;let e=r,t=["url","data.url","data","data.src","location","path","src","href","fileUrl","imageUrl","data.fileUrl"];for(let i of t){let n=Wi(e,i);if(typeof n=="string"&&n.trim())return n.trim()}return null}function Fi(r,e){let t=(r||"").trim();if(!t)throw new Error("\u4E0A\u4F20\u63A5\u53E3\u8FD4\u56DE\u4E3A\u7A7A");let i;try{i=JSON.parse(t);}catch{if(/^(https?:)?\/\//.test(t)||t.startsWith("data:")||t.startsWith("/"))return t;throw new Error(`\u4E0A\u4F20\u63A5\u53E3\u8FD4\u56DE\u65E0\u6CD5\u89E3\u6790\uFF1A${t.slice(0,120)}`)}let n=e?Wi(i,e):Yo(i);if(typeof n=="string"&&n.trim())return n.trim();throw new Error(`\u4E0A\u4F20\u63A5\u53E3\u8FD4\u56DE\u91CC\u6CA1\u6709\u56FE\u7247\u5730\u5740\uFF1A${t.slice(0,120)}`)}async function Ki(r,e){let t=e.maxSizeBytes??31457280;if(r.size>t)throw new Error(`image.tooLarge: \u56FE\u7247\u5927\u5C0F ${(r.size/1024/1024).toFixed(2)} MB \u8D85\u8FC7\u4E0A\u9650 ${(t/1024/1024).toFixed(2)} MB`);let i=new FormData;i.append(e.fieldName||"file",r,r.name||"image.png");for(let[a,l]of Object.entries(e.fields||{}))i.append(a,l);let n=new AbortController,o=e.timeoutMs??6e4,s=setTimeout(()=>n.abort(),o);try{let a=await fetch(e.url,{method:e.method||"POST",body:i,headers:e.headers,credentials:e.withCredentials?"include":"same-origin",signal:n.signal}),l=await a.text();if(!a.ok)throw new Error(`\u4E0A\u4F20\u5931\u8D25\uFF08HTTP ${a.status}\uFF09\uFF1A${l.slice(0,120)}`);return Fi(l,e.responseUrlPath)}catch(a){throw a?.name==="AbortError"?new Error(`\u4E0A\u4F20\u8D85\u65F6\uFF08${o}ms\uFF09`):a instanceof Error?a:new Error(String(a))}finally{clearTimeout(s);}}async function Yi(r,e){if(Ui(r)){let t=await r(e);if(!t||typeof t!="string")throw new Error("\u4E0A\u4F20\u51FD\u6570\u6CA1\u6709\u8FD4\u56DE\u56FE\u7247\u5730\u5740");return t}if(Ko(r))return Ki(e,r);throw new Error("\u4E0A\u4F20\u914D\u7F6E\u4E0D\u5408\u6CD5\uFF1A\u9700\u8981 { url } \u6216\u4E0A\u4F20\u51FD\u6570")}function _n(r){let e=[];for(let t of r){if(t.type!=="image")continue;let i=t;i.src&&(i.temporary||i.src.startsWith("blob:"))&&e.push(i.src);}return e}var Xo=new Set(["text","line","arrow","draw","table","uml-class","uml-interface","mind-map","sticky-note"]);function Vn(r){return !Xo.has(r)}var be={identity(){return {a:1,b:0,c:0,d:1,e:0,f:0}},translation(r,e){return {a:1,b:0,c:0,d:1,e:r,f:e}},rotation(r){let e=Math.cos(r),t=Math.sin(r);return {a:e,b:t,c:-t,d:e,e:0,f:0}},scale(r,e){return {a:r,b:0,c:0,d:e,e:0,f:0}},multiply(r,e){return {a:r.a*e.a+r.b*e.c,b:r.a*e.b+r.b*e.d,c:r.c*e.a+r.d*e.c,d:r.c*e.b+r.d*e.d,e:r.e*e.a+r.f*e.c+e.e,f:r.e*e.b+r.f*e.d+e.f}},apply(r,e){return {x:r.a*e.x+r.c*e.y+r.e,y:r.b*e.x+r.d*e.y+r.f}},invert(r){let e=r.a*r.d-r.b*r.c;if(Math.abs(e)<1e-10)return null;let t=1/e;return {a:r.d*t,b:-r.b*t,c:-r.c*t,d:r.a*t,e:(r.c*r.f-r.d*r.e)*t,f:(r.b*r.e-r.a*r.f)*t}},createCameraMatrix(r){let e=be.scale(r.zoom,r.zoom),t=be.translation(r.x,r.y);return be.multiply(t,e)}};var Re=class{x=0;y=0;zoom=1;minZoom=.1;maxZoom=10;getMatrix(){return be.createCameraMatrix({x:this.x,y:this.y,zoom:this.zoom})}getInverseMatrix(){return be.invert(this.getMatrix())}screenToPage(e){let t=this.getInverseMatrix();return t?be.apply(t,e):e}pageToScreen(e){return be.apply(this.getMatrix(),e)}translate(e,t){this.x+=e,this.y+=t;}zoomAt(e,t){let i=this.screenToPage(e);this.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.zoom*t));let n=this.pageToScreen(i);this.x+=e.x-n.x,this.y+=e.y-n.y;}reset(){this.x=0,this.y=0,this.zoom=1;}getZoom(){return this.zoom}fitBounds(e,t=50){let i=window.innerWidth,n=window.innerHeight,o=(i-t*2)/e.width,s=(n-t*2)/e.height,a=Math.min(o,s,this.maxZoom);this.zoom=Math.max(this.minZoom,a),this.x=(i-e.width*this.zoom)/2-e.x*this.zoom,this.y=(n-e.height*this.zoom)/2-e.y*this.zoom;}};var Zo=40;var jo=20;function zt(r,e,t){let i=t.x-e.x,n=t.y-e.y,o=i*i+n*n;if(o<1e-9)return Math.hypot(r.x-e.x,r.y-e.y);let s=((r.x-e.x)*i+(r.y-e.y)*n)/o;return s=Math.max(0,Math.min(1,s)),Math.hypot(r.x-(e.x+i*s),r.y-(e.y+n*s))}function dt(r){return r==="polyline"||r==="orthogonal"}function ut(r){return r.type==="arrow"&&(!!r.startBinding||!!r.endBinding)}function Gt(r,e=40){let t=[];for(let i=0;i+1<r.length;i++){let n=r[i],o=r[i+1],s=o.x-n.x,a=o.y-n.y,l=Math.hypot(s,a);l<e||t.push({index:i,center:{x:(n.x+o.x)/2,y:(n.y+o.y)/2},axis:Math.abs(s)>=Math.abs(a)?"H":"V",length:l});}return t}function On(r,e,t=10,i=14){let n=Gt(r);if(n.length===0)return null;let o=null,s=1/0;for(let a of n){if(Math.hypot(e.x-a.center.x,e.y-a.center.y)<=t)return a;let c=zt(e,r[a.index],r[a.index+1]);c<=i&&c<s&&(s=c,o=a);}return o}function zn(r,e,t,i=[]){if(e<0||e+1>=r.length)return r;let n=r[e],o=r[e+1],s=Math.abs(o.x-n.x)>=Math.abs(o.y-n.y),a=e===0,l=e+1===r.length-1,c=s?Math.sign(o.x-n.x)||1:Math.sign(o.y-n.y)||1,h=Math.abs(s?o.x-n.x:o.y-n.y),d=Math.min(24,h/2),u=s?(n.y+o.y)/2:(n.x+o.x)/2,p=I=>s?I.y:I.x,g=[];a?g.push(p(r[0])):g.push(p(r[e-1])),l?g.push(p(r[r.length-1])):g.push(p(r[e+2]));let m=u+t,f=1/0,b=null;for(let I of [...g,...i]){let T=Math.abs(m-I);T<20&&T<f&&(f=T,b=I);}b!==null&&(m=b);let x=[];if(a){let I=s?{x:n.x+c*d,y:n.y}:{x:n.x,y:n.y+c*d};x.push({x:n.x,y:n.y},I,s?{x:I.x,y:m}:{x:m,y:I.y});}else x.push(s?{x:n.x,y:m}:{x:m,y:n.y});if(l){let I=s?{x:o.x-c*d,y:o.y}:{x:o.x,y:o.y-c*d};x.push(s?{x:I.x,y:m}:{x:m,y:I.y},I,{x:o.x,y:o.y});}else x.push(s?{x:o.x,y:m}:{x:m,y:o.y});return [...r.slice(0,e),...x,...r.slice(e+2)]}function Ye(r){let e=[];for(let t of r){let i=e.length;if(!(i>0&&Math.abs(e[i-1].x-t.x)<1e-6&&Math.abs(e[i-1].y-t.y)<1e-6)){if(i>=2){let n=e[i-2],o=e[i-1];if(Math.abs(n.y-o.y)<1e-6&&Math.abs(o.y-t.y)<1e-6||Math.abs(n.x-o.x)<1e-6&&Math.abs(o.x-t.x)<1e-6){e[i-1]=t;continue}}e.push(t);}}return e}function Gn(r){return r.length<=2?[]:r.slice(1,-1).map(e=>({x:e.x,y:e.y}))}function qo(r,e,t,i){if(!e||r.length===0)return r;let n={x:t.x-e.start.x,y:t.y-e.start.y},o={x:i.x-e.end.x,y:i.y-e.end.y},s=d=>Math.abs(d.x)<.01&&Math.abs(d.y)<.01;if(s(n)&&s(o))return r;if(Math.abs(n.x-o.x)<.01&&Math.abs(n.y-o.y)<.01)return r.map(d=>({x:d.x+n.x,y:d.y+n.y}));let a=[t,...r,i],l=a.length-1,c=d=>{let u=l<=1?0:d/(l-1);return {x:n.x+(o.x-n.x)*u,y:n.y+(o.y-n.y)*u}},h=d=>{let u=a[d],p=a[d+1];return Math.abs(p.x-u.x)>=Math.abs(p.y-u.y)};return r.map((d,u)=>{let p=h(u),g=p?u:u+1,m=p?u+1:u;return {x:d.x+c(m).x,y:d.y+c(g).y}})}function Jo(r,e,t,i,n,o=20){if(r.length===0)return r;let s=r.map(l=>({x:l.x,y:l.y})),a=(l,c,h)=>{h&&(h.x!==0?Math.abs(l.y-c.y)<=o&&(l.y=c.y):h.y!==0&&Math.abs(l.x-c.x)<=o&&(l.x=c.x));};return a(s[0],e,i),a(s[s.length-1],t,n),s}function Ut(r,e,t,i,n,o){return r.length===0?r:Jo(qo(r,e,t,i),t,i,n,o)}function Un(r,e,t=.75){return r.length!==e.length||r.length===0?false:r.every((i,n)=>Math.abs(i.x-e[n].x)<=t&&Math.abs(i.y-e[n].y)<=t)}function Ee(r,e=20){let t=r.length;if(t<4)return r;let i=[];for(let a=0;a+1<t;a++){let l=r[a],c=r[a+1],h=Math.abs(c.y-l.y)<=Math.abs(c.x-l.x);i.push({axis:h?"H":"V",level:h?l.y:l.x});}let n={H:null,V:null},o=false;for(let a=0;a<i.length;a++){let l=i[a],c=n[l.axis];c!==null&&a!==i.length-1&&Math.abs(l.level-c)<e-.001&&(l.level=c,o=true),n[l.axis]=l.level;}if(!o)return r;let s=[{x:r[0].x,y:r[0].y}];for(let a=1;a<i.length;a++){let l=i[a-1],c=i[a];s.push({x:l.axis==="V"?l.level:c.level,y:l.axis==="H"?l.level:c.level});}return s.push({x:r[t-1].x,y:r[t-1].y}),Ye(s)}function $n(r,e,t=24,i=.75){let n=Math.abs(e.x-r.x),o=Math.abs(e.y-r.y);return n<=t+.001&&o<=i||o<=t+.001&&n<=i}function Xi(r,e,t=.5){if(!e||r.length<2)return false;for(let i=1;i<r.length;i++){let n=r[i-1],o=r[i],s=Math.min(n.x,o.x),a=Math.max(n.x,o.x),l=Math.min(n.y,o.y),c=Math.max(n.y,o.y);if(s<e.x+e.width-t&&a>e.x+t&&l<e.y+e.height-t&&c>e.y+t)return true}return false}function Zi(r){if(r.length<2)return "0";let e=(t,i)=>Math.abs(i.x-t.x)>=Math.abs(i.y-t.y)?"H":"V";return `${r.length}:${e(r[0],r[1])}${e(r[r.length-2],r[r.length-1])}`}function Wt(r){let{userRoute:e,autoRoute:t,base:i,fromBox:n,toBox:o}=r;return e.length<2?false:Xi(e,n)||Xi(e,o)?true:i&&i.length>=2&&t.length>=2?Zi(i)!==Zi(t):t.length===2&&e.length>=4}function Wn(r,e,t=24,i=.75){if(r.length===0||e.length<2)return r;let n=e[0],o=e[e.length-1];return r.filter(s=>!$n(n,s,t,i)&&!$n(o,s,t,i))}var ji={primary:"#3b82f6",selection:{outline:"#3b82f6",handleStroke:"#3b82f6",handleFill:"#ffffff",outlineFill:"rgba(59, 130, 246, 0.1)",shadow:"#3b82f6"},grid:"#e5e7eb",text:"#1f2937",editBorder:"#3b82f6",brushFill:"rgba(59, 130, 246, 0.08)",brushStroke:"rgba(59, 130, 246, 0.8)",guide:"rgba(59, 130, 246, 0.6)",lineHighlight:"rgba(59, 130, 246, 0.4)",genDot:"#3b82f6",genLine:"rgba(59, 130, 246, 0.55)"},H={...ji,selection:{...ji.selection}},Fn=new Set;function Qo(r){return Fn.add(r),()=>Fn.delete(r)}function Ft(r){r.selection&&Object.assign(H.selection,r.selection);for(let e of Object.keys(r)){if(e==="selection")continue;let t=r[e];t!==void 0&&(H[e]=t);}Fn.forEach(e=>e());}function er(){return H}function z(r,e){let t=qi(r);if(!t)return r;let i=parseInt(t,16),n=i>>16&255,o=i>>8&255,s=i&255;return `rgba(${n}, ${o}, ${s}, ${e})`}function Kn(r,e){let t=qi(r);if(!t)return r;let i=parseInt(t,16),n=e<0?0:255,o=Math.abs(e),s=a=>Math.round((n-a)*o+a).toString(16).padStart(2,"0");return `#${s(i>>16&255)}${s(i>>8&255)}${s(i&255)}`}var tr={light:{grid:"#e5e7eb"},warm:{grid:"#e0dcc8"},gray:{grid:"#d1d5db"},purple:{grid:"#e0dcfa"},green:{grid:"#d1fae5"},"eye-care":{grid:"#e3dcc6"}},nr="light";function qi(r){let e=r.replace("#","").trim();return /^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/.test(e)?e.length===3?e.split("").map(t=>t+t).join(""):e:null}var X=class{context;constructor(e){this.context=e;}getCursor(e){return null}hasTransientState(){return false}cancelTransient(){return false}isDragging(){return false}dispose(){}};var ir=[{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587"},{code:"en-US",label:"English"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4"},{code:"de-DE",label:"Deutsch"},{code:"fr-FR",label:"Fran\xE7ais"}],or={"save.success":"\u5DF2\u4FDD\u5B58","save.fail":"\u4FDD\u5B58\u5931\u8D25","tool.select":"\u9009\u62E9\u5DE5\u5177","tool.hand":"\u62D6\u62FD\u89C6\u53E3","tool.rectangle":"\u77E9\u5F62","tool.rounded-rectangle":"\u5706\u89D2\u77E9\u5F62","tool.circle":"\u5706\u5F62","tool.ellipse":"\u692D\u5706","tool.diamond":"\u83F1\u5F62","tool.triangle":"\u4E09\u89D2\u5F62","tool.hexagon":"\u516D\u8FB9\u5F62","tool.parallelogram":"\u5E73\u884C\u56DB\u8FB9\u5F62","tool.trapezoid":"\u68AF\u5F62","tool.pentagon":"\u4E94\u8FB9\u5F62","tool.octagon":"\u516B\u8FB9\u5F62","tool.star":"\u661F\u5F62","tool.cylinder":"\u5706\u67F1\u4F53","tool.cloud":"\u4E91\u5F62","tool.heart":"\u5FC3\u5F62","tool.block-arrow-right":"\u53F3\u7BAD\u5934","tool.block-arrow-left":"\u5DE6\u7BAD\u5934","tool.block-arrow-up":"\u4E0A\u7BAD\u5934","tool.block-arrow-down":"\u4E0B\u7BAD\u5934","tool.block-arrow-double":"\u53CC\u5411\u7BAD\u5934","tool.right-triangle":"\u76F4\u89D2\u4E09\u89D2\u5F62","tool.cross":"\u5341\u5B57","tool.speech-rect":"\u65B9\u5F62\u5BF9\u8BDD\u6846","tool.speech-round":"\u5706\u5F62\u5BF9\u8BDD\u6846","tool.cube":"\u7ACB\u65B9\u4F53","tool.sector":"\u6247\u5F62","tool.delay":"D \u5F62","tool.predefined-process":"\u9884\u5B9A\u4E49\u6D41\u7A0B","tool.document":"\u6587\u6863","tool.stadium":"\u5168\u5706\u89D2\u77E9\u5F62","tool.class-catalog":"\u7C7B\u76EE","tool.envelope":"\u4FE1\u5C01","tool.checkbox":"\u590D\u9009\u6846","tool.sticky-note":"\u4FBF\u7B7E","shape.sticky-note":"\u4FBF\u7B7E","tool.triangular-pyramid":"\u4E09\u68F1\u9525","tool.quadrangular-pyramid":"\u56DB\u68F1\u9525","tool.cuboid":"\u957F\u65B9\u4F53","tool.sphere":"\u7403","tool.ellipsoid":"\u692D\u7403","tool.pie":"\u997C\u72B6","tool.hollow-pie":"\u7A7A\u5FC3\u997C\u72B6","class.plain":"\u7C7B","flow.process":"\u5904\u7406","flow.step":"\u6D41\u7A0B","flow.startEnd":"\u5F00\u59CB/\u7ED3\u675F","flow.decision":"\u5224\u5B9A","flow.data":"\u6570\u636E","flow.manual":"\u624B\u52A8\u64CD\u4F5C","flow.preparation":"\u51C6\u5907","flow.database":"\u6570\u636E\u5E93","flow.delay":"\u5EF6\u65F6","shapeGroup.basic":"\u57FA\u7840","shapeGroup.flowchart":"\u6D41\u7A0B\u56FE","shapeGroup.other":"\u5176\u4ED6","shapeGroup.solid":"\u7ACB\u4F53","shapeGroup.uml":"\u7C7B\u56FE","shapeMenu.hint":"\u60AC\u505C\u67E5\u770B\u540D\u79F0","tool.chevron":"\u5C16\u89D2","tool.brace-left":"\u5DE6\u62EC\u53F7","tool.brace-right":"\u53F3\u62EC\u53F7","tool.uml-class":"UML \u7C7B\u56FE","tool.uml-interface":"UML \u63A5\u53E3","tool.line":"\u76F4\u7EBF","tool.arrow":"\u7EBF\u6761","tool.text":"\u6587\u672C","tool.draw":"\u753B\u7B14","tool.pen":"\u753B\u7B14","tool.highlighter":"\u8367\u5149\u7B14","tool.eraser":"\u6A61\u76AE\u64E6","status.none":"\u672A\u9009\u62E9","status.selected":"\u5DF2\u9009\u62E9 {n} \u4E2A\u56FE\u5F62","toolbar.select":"\u9009\u62E9 (V)","toolbar.hand":"\u62D6\u62FD\u89C6\u53E3 (H)","toolbar.shapes":"\u5F62\u72B6","toolbar.grid":"\u7F51\u683C","toolbar.undo":"\u64A4\u9500 (Ctrl+Z)","toolbar.redo":"\u91CD\u505A (Ctrl+Shift+Z)","toolbar.arrow":"\u7BAD\u5934 (A)","toolbar.text":"\u6587\u672C (T)","toolbar.pen":"\u753B\u7B14","toolbar.highlighter":"\u8367\u5149\u7B14","toolbar.eraser":"\u6A61\u76AE\u64E6 (E)","toolbar.uml-class":"UML \u7C7B\u56FE","toolbar.uml-interface":"UML \u63A5\u53E3","zoom.in":"\u653E\u5927","zoom.out":"\u7F29\u5C0F","zoom.reset":"\u91CD\u7F6E","style.stroke":"\u8FB9\u6846","style.line":"\u7EBF\u6761","style.fill":"\u586B\u5145","style.text":"\u6587\u5B57","style.highlight":"\u9AD8\u4EAE","style.prefix":"\u524D\u7F00\u7B26\u53F7","style.prefix.soon":"\u524D\u7F00\u7B26\u53F7\u5F00\u53D1\u4E2D\uFF0C\u656C\u8BF7\u671F\u5F85","style.none":"\u65E0","style.addColor":"\u6DFB\u52A0\u989C\u8272","style.connection":"\u8FDE\u7EBF","style.arrow":"\u7BAD\u5934","style.dashed":"\u865A\u7EBF","style.solid":"\u5B9E\u7EBF","style.opacity":"\u4E0D\u900F\u660E\u5EA6","style.connection.straight":"\u76F4\u7EBF","style.connection.polyline":"\u5706\u89D2\u6298\u7EBF","style.connection.orthogonal":"\u76F4\u89D2\u6298\u7EBF","style.connection.curve":"\u66F2\u7EBF","style.arrowhead.none":"\u65E0\u7BAD\u5934","style.arrowhead.end":"\u7EC8\u70B9\u7BAD\u5934","style.arrowhead.start":"\u8D77\u70B9\u7BAD\u5934","style.arrowhead.both":"\u53CC\u7BAD\u5934","style.arrowhead.none-dashed":"\u65E0\u7BAD\u5934\u865A\u7EBF","style.arrowhead.both-dashed":"\u53CC\u7BAD\u5934\u865A\u7EBF","style.uml":"UML","style.arrowhead.inheritance":"\u7EE7\u627F","style.arrowhead.composition":"\u7EC4\u5408","style.arrowhead.aggregation":"\u805A\u5408","style.arrowhead.dependency":"\u4F9D\u8D56","style.arrowhead.realization":"\u5B9E\u73B0","menu.title":"\u9009\u62E9\u65B0\u56FE\u5F62","menu.cancel":"\u70B9\u51FB\u7A7A\u767D\u5904\u53D6\u6D88","shape.rectangle":"\u77E9\u5F62","shape.rounded-rectangle":"\u5706\u89D2","shape.circle":"\u5706\u5F62","shape.ellipse":"\u692D\u5706","shape.diamond":"\u83F1\u5F62","shape.triangle":"\u4E09\u89D2","shape.hexagon":"\u516D\u8FB9\u5F62","shape.parallelogram":"\u5E73\u884C","shape.trapezoid":"\u68AF\u5F62","shape.pentagon":"\u4E94\u8FB9\u5F62","shape.octagon":"\u516B\u8FB9\u5F62","shape.star":"\u661F\u5F62","shape.uml-class":"\u7C7B\u56FE","shape.uml-interface":"\u63A5\u53E3","uml.drag":"\u62D6\u62FD\u6392\u5E8F","uml.delete":"\u5220\u9664\u8BE5\u884C","uml.textColor":"\u6587\u5B57\u989C\u8272","uml.defaultColor":"\u9ED8\u8BA4\u989C\u8272","uml.fontSize":"\u5B57\u53F7","uml.strikethrough":"\u5220\u9664\u7EBF","uml.attribute":"\u5C5E\u6027","uml.method":"\u65B9\u6CD5","minimap.title":"\u5C0F\u5730\u56FE","minimap.expand":"\u5C55\u5F00\u5C0F\u5730\u56FE","minimap.collapse":"\u6536\u8D77\u5C0F\u5730\u56FE","tool.mind-map":"\u601D\u7EF4\u5BFC\u56FE","toolbar.mind-map":"\u601D\u7EF4\u5BFC\u56FE","toolbar.export":"\u5BFC\u51FA","toolbar.export.png":"PNG \u56FE\u7247","toolbar.export.svg":"SVG \u77E2\u91CF\u56FE","toolbar.export.pdf":"PDF \u6587\u6863","toolbar.export.data":"\u5BFC\u51FA\u6570\u636E","toolbar.import.data":"\u5BFC\u5165\u6570\u636E","import.success":"\u5BFC\u5165\u6210\u529F\uFF0C\u5DF2\u6062\u590D {n} \u4E2A\u56FE\u5F62","import.fail":"\u5BFC\u5165\u5931\u8D25\uFF0C\u6587\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E","shape.mind-map":"\u601D\u7EF4\u5BFC\u56FE","mindmap.defaultRoot":"\u4E2D\u5FC3\u4E3B\u9898","mindmap.defaultBranch":"\u5206\u652F\u4E3B\u9898","mindmap.nodeText":"\u8282\u70B9\u6587\u672C","mindmap.addChild":"\u5B50\u8282\u70B9","mindmap.addSibling":"\u5144\u5F1F\u8282\u70B9","mindmap.deleteNode":"\u5220\u9664\u8282\u70B9","mindmap.color":"\u989C\u8272","mindmap.levelColor":"\u9ED8\u8BA4\u5C42\u7EA7\u8272","mindmap.icon":"\u56FE\u6807","mindmap.noIcon":"\u65E0\u56FE\u6807","mindmap.note":"\u5C5E\u6027\u8BF4\u660E","mindmap.notePlaceholder":"\u8BF4\u660E\u5185\u5BB9\uFF08\u53EF\u9009\uFF09","mindmap.noteColor":"\u8BF4\u660E\u989C\u8272","mindmap.noteColorDefault":"\u540C\u8282\u70B9\u8272","mindmap.collapse":"\u6298\u53E0","mindmap.expand":"\u5C55\u5F00","mindmap.close":"\u5173\u95ED\u7F16\u8F91","mindmap.more":"\u66F4\u591A\u8BBE\u7F6E","mindmap.level":"\u5C42\u7EA7","mindmap.promote1":"\u5347\u4E00\u7EA7","mindmap.promote2":"\u5347\u4E24\u7EA7","mindmap.promoteDisabled":"\u5DF2\u81F3\u9876\u5C42","tool.table":"\u8868\u683C","toolbar.table":"\u8868\u683C","shape.table":"\u8868\u683C","table.insertRow":"\u63D2\u5165\u884C","table.deleteRow":"\u5220\u9664\u884C","table.insertCol":"\u63D2\u5165\u5217","table.deleteCol":"\u5220\u9664\u5217","table.merge":"\u5408\u5E76\u5355\u5143\u683C","table.split":"\u62C6\u5206\u5355\u5143\u683C","table.insertRowAbove":"\u5728\u4E0A\u65B9\u63D2\u5165\u884C","table.insertRowBelow":"\u5728\u4E0B\u65B9\u63D2\u5165\u884C","table.insertColLeft":"\u5728\u5DE6\u4FA7\u63D2\u5165\u5217","table.insertColRight":"\u5728\u53F3\u4FA7\u63D2\u5165\u5217","table.pickHint":"\u62D6\u9009\u884C\u5217\u6570","ctx.copy":"\u590D\u5236","ctx.paste":"\u7C98\u8D34","ctx.duplicate":"\u521B\u5EFA\u526F\u672C","ctx.layer":"\u5C42\u7EA7","ctx.bringToFront":"\u7F6E\u4E8E\u9876\u5C42","ctx.bringForward":"\u4E0A\u79FB\u4E00\u5C42","ctx.sendBackward":"\u4E0B\u79FB\u4E00\u5C42","ctx.sendToBack":"\u7F6E\u4E8E\u5E95\u5C42","ctx.copyStyle":"\u590D\u5236\u6837\u5F0F","ctx.pasteStyle":"\u7C98\u8D34\u6837\u5F0F","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"\u65CB\u8F6C","ctx.group":"\u6210\u7EC4","ctx.ungroup":"\u89E3\u7EC4","ctx.lock":"\u9501\u5B9A","ctx.unlock":"\u89E3\u9501","ctx.unlockAll":"\u5168\u90E8\u89E3\u9501","ctx.delete":"\u5220\u9664","toolbar.icon":"\u56FE\u6807 (S)","toolbar.template":"\u6A21\u677F","template.search":"\u641C\u7D22\u6A21\u677F","template.all":"\u5168\u90E8","template.empty":"\u6CA1\u6709\u5339\u914D\u7684\u6A21\u677F","toolbar.image":"\u56FE\u7247","toolbar.more":"\u66F4\u591A","toolbar.pageTheme":"\u9875\u9762\u4E3B\u9898","pageTheme.light":"\u9ED8\u8BA4","pageTheme.warm":"\u6696\u9EC4","pageTheme.gray":"\u6D45\u7070","pageTheme.purple":"\u6D45\u7D2B","pageTheme.green":"\u6D45\u7EFF","pageTheme.eye-care":"\u62A4\u773C","tool.image":"\u56FE\u7247","image.uploadFailed":"\u56FE\u7247\u4E0A\u4F20\u5931\u8D25","image.insertFailed":"\u56FE\u7247\u63D2\u5165\u5931\u8D25","image.tooLarge":"\u56FE\u7247\u8D85\u8FC7 30 MB\uFF0C\u65E0\u6CD5\u4E0A\u4F20","image.temporaryInserted":"\u5DF2\u63D2\u5165\u4E34\u65F6\u56FE\u7247\uFF08\u672A\u914D\u7F6E\u4E0A\u4F20\u63A5\u53E3\uFF0C\u5237\u65B0\u540E\u4F1A\u4E22\u5931\uFF09","image.naturalSize":"\u539F\u56FE\u5C3A\u5BF8","icon.search":"\u641C\u7D22\u56FE\u6807","icon.empty":"\u6CA1\u6709\u5339\u914D\u7684\u56FE\u6807","icon.recent":"\u6700\u8FD1\u4F7F\u7528","iconCat.status":"\u72B6\u6001\u6807\u8BB0","iconCat.number":"\u6570\u5B57\u5FBD\u6807","iconCat.tech":"\u4E91\u4E0E\u6280\u672F","iconCat.chart":"\u6570\u636E\u56FE\u8868","iconCat.office":"\u529E\u516C\u6587\u6863","iconCat.media":"\u5A92\u4F53\u534F\u4F5C","iconCat.arrow":"\u7BAD\u5934\u65B9\u5411","iconCat.misc":"\u5E38\u7528","iconCat.emoji":"\u8868\u60C5","iconCat.sticker":"\u8D34\u7EB8","iconCat.device":"\u7535\u8111\u8BBE\u5907","iconCat.weather":"\u5929\u6C14","iconCat.transport":"\u4EA4\u901A","iconCat.nature":"\u81EA\u7136","iconCat.building":"\u5EFA\u7B51","iconCat.medical":"\u533B\u7597","iconCat.shopping":"\u8D2D\u7269","iconCat.science":"\u79D1\u5B66","iconCat.animal":"\u52A8\u7269","iconCat.time":"\u65F6\u95F4","iconCat.edit":"\u7F16\u8F91","iconCat.food":"\u98DF\u7269","iconCat.communication":"\u901A\u8BAF"},Ji={"zh-CN":or,"zh-TW":{"save.success":"\u5DF2\u5132\u5B58","save.fail":"\u5132\u5B58\u5931\u6557","tool.select":"\u9078\u53D6\u5DE5\u5177","tool.hand":"\u62D6\u66F3\u8996\u7A97","tool.rectangle":"\u77E9\u5F62","tool.rounded-rectangle":"\u5713\u89D2\u77E9\u5F62","tool.circle":"\u5713\u5F62","tool.ellipse":"\u6A62\u5713","tool.diamond":"\u83F1\u5F62","tool.triangle":"\u4E09\u89D2\u5F62","tool.hexagon":"\u516D\u908A\u5F62","tool.parallelogram":"\u5E73\u884C\u56DB\u908A\u5F62","tool.trapezoid":"\u68AF\u5F62","tool.pentagon":"\u4E94\u908A\u5F62","tool.octagon":"\u516B\u908A\u5F62","tool.star":"\u661F\u5F62","tool.cylinder":"\u5713\u67F1\u9AD4","tool.cloud":"\u96F2\u5F62","tool.heart":"\u5FC3\u5F62","tool.block-arrow-right":"\u53F3\u7BAD\u982D","tool.block-arrow-left":"\u5DE6\u7BAD\u982D","tool.block-arrow-up":"\u4E0A\u7BAD\u982D","tool.block-arrow-down":"\u4E0B\u7BAD\u982D","tool.block-arrow-double":"\u96D9\u5411\u7BAD\u982D","tool.right-triangle":"\u76F4\u89D2\u4E09\u89D2\u5F62","tool.cross":"\u5341\u5B57","tool.speech-rect":"\u65B9\u5F62\u5C0D\u8A71\u6846","tool.speech-round":"\u5713\u5F62\u5C0D\u8A71\u6846","tool.cube":"\u7ACB\u65B9\u9AD4","tool.sector":"\u6247\u5F62","tool.delay":"D \u5F62","tool.predefined-process":"\u9810\u5B9A\u7FA9\u6D41\u7A0B","tool.document":"\u6587\u4EF6","tool.stadium":"\u5168\u5713\u89D2\u77E9\u5F62","tool.class-catalog":"\u985E\u76EE","tool.envelope":"\u4FE1\u5C01","tool.checkbox":"\u6838\u53D6\u65B9\u584A","tool.sticky-note":"\u4FBF\u5229\u8CBC","shape.sticky-note":"\u4FBF\u5229\u8CBC","tool.triangular-pyramid":"\u4E09\u7A1C\u9310","tool.quadrangular-pyramid":"\u56DB\u7A1C\u9310","tool.cuboid":"\u9577\u65B9\u9AD4","tool.sphere":"\u7403","tool.ellipsoid":"\u6A62\u7403","tool.pie":"\u9905\u72C0","tool.hollow-pie":"\u7A7A\u5FC3\u9905\u72C0","class.plain":"\u985E\u5225","flow.process":"\u8655\u7406","flow.step":"\u6D41\u7A0B","flow.startEnd":"\u958B\u59CB/\u7D50\u675F","flow.decision":"\u5224\u65B7","flow.data":"\u8CC7\u6599","flow.manual":"\u624B\u52D5\u64CD\u4F5C","flow.preparation":"\u6E96\u5099","flow.database":"\u8CC7\u6599\u5EAB","flow.delay":"\u5EF6\u9072","shapeGroup.basic":"\u57FA\u790E","shapeGroup.flowchart":"\u6D41\u7A0B\u5716","shapeGroup.other":"\u5176\u4ED6","shapeGroup.solid":"\u7ACB\u9AD4","shapeGroup.uml":"\u985E\u5225\u5716","shapeMenu.hint":"\u61F8\u505C\u67E5\u770B\u540D\u7A31","tool.chevron":"\u5C16\u89D2","tool.brace-left":"\u5DE6\u62EC\u865F","tool.brace-right":"\u53F3\u62EC\u865F","tool.uml-class":"UML \u985E\u5225\u5716","tool.uml-interface":"UML \u4ECB\u9762","tool.line":"\u76F4\u7DDA","tool.arrow":"\u7DDA\u689D","tool.text":"\u6587\u5B57","tool.draw":"\u756B\u7B46","tool.pen":"\u756B\u7B46","tool.highlighter":"\u87A2\u5149\u7B46","tool.eraser":"\u6A61\u76AE\u64E6","status.none":"\u672A\u9078\u53D6","status.selected":"\u5DF2\u9078\u53D6 {n} \u500B\u5716\u5F62","toolbar.select":"\u9078\u53D6 (V)","toolbar.hand":"\u62D6\u66F3\u8996\u7A97 (H)","toolbar.shapes":"\u5F62\u72C0","toolbar.grid":"\u683C\u7DDA","toolbar.undo":"\u5FA9\u539F (Ctrl+Z)","toolbar.redo":"\u91CD\u505A (Ctrl+Shift+Z)","toolbar.arrow":"\u7BAD\u982D (A)","toolbar.text":"\u6587\u5B57 (T)","toolbar.pen":"\u756B\u7B46","toolbar.highlighter":"\u87A2\u5149\u7B46","toolbar.eraser":"\u6A61\u76AE\u64E6 (E)","toolbar.uml-class":"UML \u985E\u5225\u5716","toolbar.uml-interface":"UML \u4ECB\u9762","zoom.in":"\u653E\u5927","zoom.out":"\u7E2E\u5C0F","zoom.reset":"\u91CD\u8A2D","style.stroke":"\u908A\u6846","style.line":"\u7DDA\u689D","style.fill":"\u586B\u8272","style.text":"\u6587\u5B57","style.highlight":"\u6A19\u793A","style.prefix":"\u524D\u7F6E\u7B26\u865F","style.prefix.soon":"\u524D\u7F6E\u7B26\u865F\u958B\u767C\u4E2D\uFF0C\u656C\u8ACB\u671F\u5F85","style.none":"\u7121","style.addColor":"\u65B0\u589E\u984F\u8272","style.connection":"\u9023\u7DDA","style.arrow":"\u7BAD\u982D","style.dashed":"\u865B\u7DDA","style.solid":"\u5BE6\u7DDA","style.opacity":"\u4E0D\u900F\u660E\u5EA6","style.connection.straight":"\u76F4\u7DDA","style.connection.polyline":"\u5713\u89D2\u6298\u7DDA","style.connection.orthogonal":"\u76F4\u89D2\u6298\u7DDA","style.connection.curve":"\u66F2\u7DDA","style.arrowhead.none":"\u7121\u7BAD\u982D","style.arrowhead.end":"\u7D42\u9EDE\u7BAD\u982D","style.arrowhead.start":"\u8D77\u9EDE\u7BAD\u982D","style.arrowhead.both":"\u96D9\u7BAD\u982D","style.arrowhead.none-dashed":"\u7121\u7BAD\u982D\u865B\u7DDA","style.arrowhead.both-dashed":"\u96D9\u7BAD\u982D\u865B\u7DDA","style.uml":"UML","style.arrowhead.inheritance":"\u7E7C\u627F","style.arrowhead.composition":"\u7D44\u5408","style.arrowhead.aggregation":"\u805A\u5408","style.arrowhead.dependency":"\u4F9D\u8CF4","style.arrowhead.realization":"\u5BE6\u73FE","menu.title":"\u9078\u64C7\u65B0\u5716\u5F62","menu.cancel":"\u9EDE\u64CA\u7A7A\u767D\u8655\u53D6\u6D88","shape.rectangle":"\u77E9\u5F62","shape.rounded-rectangle":"\u5713\u89D2","shape.circle":"\u5713\u5F62","shape.ellipse":"\u6A62\u5713","shape.diamond":"\u83F1\u5F62","shape.triangle":"\u4E09\u89D2","shape.hexagon":"\u516D\u908A\u5F62","shape.parallelogram":"\u5E73\u884C","shape.trapezoid":"\u68AF\u5F62","shape.pentagon":"\u4E94\u908A\u5F62","shape.octagon":"\u516B\u908A\u5F62","shape.star":"\u661F\u5F62","shape.uml-class":"\u985E\u5225\u5716","shape.uml-interface":"\u4ECB\u9762","uml.drag":"\u62D6\u66F3\u6392\u5E8F","uml.delete":"\u522A\u9664\u8A72\u5217","uml.textColor":"\u6587\u5B57\u984F\u8272","uml.defaultColor":"\u9810\u8A2D\u984F\u8272","uml.fontSize":"\u5B57\u7D1A","uml.strikethrough":"\u522A\u9664\u7DDA","uml.attribute":"\u5C6C\u6027","uml.method":"\u65B9\u6CD5","minimap.title":"\u5C0F\u5730\u5716","minimap.expand":"\u5C55\u958B\u5C0F\u5730\u5716","minimap.collapse":"\u6536\u5408\u5C0F\u5730\u5716","tool.mind-map":"\u5FC3\u667A\u5716","toolbar.mind-map":"\u5FC3\u667A\u5716","toolbar.export":"\u532F\u51FA","toolbar.export.png":"PNG \u5716\u7247","toolbar.export.svg":"SVG \u5411\u91CF\u5716","toolbar.export.pdf":"PDF \u6587\u4EF6","toolbar.export.data":"\u532F\u51FA\u8CC7\u6599","toolbar.import.data":"\u532F\u5165\u8CC7\u6599","import.success":"\u532F\u5165\u6210\u529F\uFF0C\u5DF2\u9084\u539F {n} \u500B\u5716\u5F62","import.fail":"\u532F\u5165\u5931\u6557\uFF0C\u6A94\u6848\u683C\u5F0F\u4E0D\u6B63\u78BA","shape.mind-map":"\u5FC3\u667A\u5716","mindmap.defaultRoot":"\u4E2D\u5FC3\u4E3B\u984C","mindmap.defaultBranch":"\u5206\u652F\u4E3B\u984C","mindmap.nodeText":"\u7BC0\u9EDE\u6587\u5B57","mindmap.addChild":"\u5B50\u7BC0\u9EDE","mindmap.addSibling":"\u5144\u5F1F\u7BC0\u9EDE","mindmap.deleteNode":"\u522A\u9664\u7BC0\u9EDE","mindmap.color":"\u984F\u8272","mindmap.levelColor":"\u9810\u8A2D\u5C64\u7D1A\u8272","mindmap.icon":"\u5716\u793A","mindmap.noIcon":"\u7121\u5716\u793A","mindmap.note":"\u5C6C\u6027\u8AAA\u660E","mindmap.notePlaceholder":"\u8AAA\u660E\u5167\u5BB9\uFF08\u9078\u586B\uFF09","mindmap.noteColor":"\u8AAA\u660E\u984F\u8272","mindmap.noteColorDefault":"\u540C\u7BC0\u9EDE\u8272","mindmap.collapse":"\u6536\u5408","mindmap.expand":"\u5C55\u958B","mindmap.close":"\u95DC\u9589\u7DE8\u8F2F","mindmap.more":"\u66F4\u591A\u8A2D\u5B9A","mindmap.level":"\u5C64\u7D1A","mindmap.promote1":"\u5347\u4E00\u7D1A","mindmap.promote2":"\u5347\u5169\u7D1A","mindmap.promoteDisabled":"\u5DF2\u81F3\u9802\u5C64","tool.table":"\u8868\u683C","toolbar.table":"\u8868\u683C","shape.table":"\u8868\u683C","table.insertRow":"\u63D2\u5165\u6A6B\u5217","table.deleteRow":"\u522A\u9664\u6A6B\u5217","table.insertCol":"\u63D2\u5165\u76F4\u6B04","table.deleteCol":"\u522A\u9664\u76F4\u6B04","table.merge":"\u5408\u4F75\u5132\u5B58\u683C","table.split":"\u5206\u5272\u5132\u5B58\u683C","table.insertRowAbove":"\u5728\u4E0A\u65B9\u63D2\u5165\u6A6B\u5217","table.insertRowBelow":"\u5728\u4E0B\u65B9\u63D2\u5165\u6A6B\u5217","table.insertColLeft":"\u5728\u5DE6\u5074\u63D2\u5165\u76F4\u6B04","table.insertColRight":"\u5728\u53F3\u5074\u63D2\u5165\u76F4\u6B04","table.pickHint":"\u62D6\u9078\u884C\u5217\u6578","ctx.copy":"\u8907\u88FD","ctx.paste":"\u8CBC\u4E0A","ctx.duplicate":"\u5EFA\u7ACB\u526F\u672C","ctx.layer":"\u5716\u5C64","ctx.bringToFront":"\u79FB\u5230\u6700\u4E0A\u5C64","ctx.bringForward":"\u4E0A\u79FB\u4E00\u5C64","ctx.sendBackward":"\u4E0B\u79FB\u4E00\u5C64","ctx.sendToBack":"\u79FB\u5230\u6700\u4E0B\u5C64","ctx.copyStyle":"\u8907\u88FD\u6A23\u5F0F","ctx.pasteStyle":"\u8CBC\u4E0A\u6A23\u5F0F","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"\u65CB\u8F49","ctx.group":"\u6210\u7D44","ctx.ungroup":"\u89E3\u7D44","ctx.lock":"\u9396\u5B9A","ctx.unlock":"\u89E3\u9396","ctx.unlockAll":"\u5168\u90E8\u89E3\u9396","ctx.delete":"\u522A\u9664","toolbar.icon":"\u5716\u793A (S)","toolbar.template":"\u7BC4\u672C","template.search":"\u641C\u5C0B\u7BC4\u672C","template.all":"\u5168\u90E8","template.empty":"\u6C92\u6709\u7B26\u5408\u7684\u7BC4\u672C","toolbar.image":"\u5716\u7247","toolbar.more":"\u66F4\u591A","toolbar.pageTheme":"\u9801\u9762\u4E3B\u984C","pageTheme.light":"\u9810\u8A2D","pageTheme.warm":"\u6696\u9EC3","pageTheme.gray":"\u6DFA\u7070","pageTheme.purple":"\u6DFA\u7D2B","pageTheme.green":"\u6DFA\u7DA0","pageTheme.eye-care":"\u8B77\u773C","tool.image":"\u5716\u7247","image.uploadFailed":"\u5716\u7247\u4E0A\u50B3\u5931\u6557","image.insertFailed":"\u5716\u7247\u63D2\u5165\u5931\u6557","image.tooLarge":"\u5716\u7247\u8D85\u904E 30 MB\uFF0C\u7121\u6CD5\u4E0A\u50B3","image.temporaryInserted":"\u5DF2\u63D2\u5165\u81E8\u6642\u5716\u7247\uFF08\u672A\u914D\u7F6E\u4E0A\u50B3\u4ECB\u9762\uFF0C\u91CD\u65B0\u6574\u7406\u5F8C\u6703\u907A\u5931\uFF09","image.naturalSize":"\u539F\u5716\u5C3A\u5BF8","icon.search":"\u641C\u5C0B\u5716\u793A","icon.empty":"\u6C92\u6709\u7B26\u5408\u7684\u5716\u793A","icon.recent":"\u6700\u8FD1\u4F7F\u7528","iconCat.status":"\u72C0\u614B\u6A19\u8A18","iconCat.number":"\u6578\u5B57\u5FBD\u6A19","iconCat.tech":"\u96F2\u7AEF\u8207\u6280\u8853","iconCat.chart":"\u8CC7\u6599\u5716\u8868","iconCat.office":"\u8FA6\u516C\u6587\u4EF6","iconCat.media":"\u5A92\u9AD4\u5354\u4F5C","iconCat.arrow":"\u7BAD\u982D\u65B9\u5411","iconCat.misc":"\u5E38\u7528","iconCat.emoji":"\u8868\u60C5","iconCat.sticker":"\u8CBC\u7D19","iconCat.device":"\u96FB\u8166\u8A2D\u5099","iconCat.weather":"\u5929\u6C23","iconCat.transport":"\u4EA4\u901A","iconCat.nature":"\u81EA\u7136","iconCat.building":"\u5EFA\u7BC9","iconCat.medical":"\u91AB\u7642","iconCat.shopping":"\u8CFC\u7269","iconCat.science":"\u79D1\u5B78","iconCat.animal":"\u52D5\u7269","iconCat.time":"\u6642\u9593","iconCat.edit":"\u7DE8\u8F2F","iconCat.food":"\u98DF\u7269","iconCat.communication":"\u901A\u8A0A"},"en-US":{"save.success":"Saved","save.fail":"Save failed","tool.select":"Select tool","tool.hand":"Pan view","tool.rectangle":"Rectangle","tool.rounded-rectangle":"Rounded rectangle","tool.circle":"Circle","tool.ellipse":"Ellipse","tool.diamond":"Diamond","tool.triangle":"Triangle","tool.hexagon":"Hexagon","tool.parallelogram":"Parallelogram","tool.trapezoid":"Trapezoid","tool.pentagon":"Pentagon","tool.octagon":"Octagon","tool.star":"Star","tool.cylinder":"Cylinder","tool.cloud":"Cloud","tool.heart":"Heart","tool.block-arrow-right":"Arrow right","tool.block-arrow-left":"Arrow left","tool.block-arrow-up":"Arrow up","tool.block-arrow-down":"Arrow down","tool.block-arrow-double":"Double arrow","tool.right-triangle":"Right triangle","tool.cross":"Cross","tool.speech-rect":"Speech bubble","tool.speech-round":"Round bubble","tool.cube":"Cube","tool.sector":"Sector","tool.delay":"Delay","tool.predefined-process":"Predefined process","tool.document":"Document","tool.stadium":"Stadium","tool.class-catalog":"Category","tool.envelope":"Envelope","tool.checkbox":"Checkbox","tool.sticky-note":"Sticky note","shape.sticky-note":"Sticky note","tool.triangular-pyramid":"Triangular pyramid","tool.quadrangular-pyramid":"Square pyramid","tool.cuboid":"Cuboid","tool.sphere":"Sphere","tool.ellipsoid":"Ellipsoid","tool.pie":"Pie","tool.hollow-pie":"Donut","class.plain":"Class","flow.process":"Process","flow.step":"Step","flow.startEnd":"Start / End","flow.decision":"Decision","flow.data":"Data","flow.manual":"Manual operation","flow.preparation":"Preparation","flow.database":"Database","flow.delay":"Delay","shapeGroup.basic":"Basic","shapeGroup.flowchart":"Flowchart","shapeGroup.other":"Other","shapeGroup.solid":"3D","shapeGroup.uml":"Class diagram","shapeMenu.hint":"Hover to see name","tool.chevron":"Chevron","tool.brace-left":"Left brace","tool.brace-right":"Right brace","tool.uml-class":"UML class","tool.uml-interface":"UML interface","tool.line":"Line","tool.arrow":"Line","tool.text":"Text","tool.draw":"Pen","tool.pen":"Pen","tool.highlighter":"Highlighter","tool.eraser":"Eraser","status.none":"Nothing selected","status.selected":"{n} shapes selected","toolbar.select":"Select (V)","toolbar.hand":"Pan view (H)","toolbar.shapes":"Shapes","toolbar.grid":"Grid","toolbar.undo":"Undo (Ctrl+Z)","toolbar.redo":"Redo (Ctrl+Shift+Z)","toolbar.arrow":"Arrow (A)","toolbar.text":"Text (T)","toolbar.pen":"Pen","toolbar.highlighter":"Highlighter","toolbar.eraser":"Eraser (E)","toolbar.uml-class":"UML class","toolbar.uml-interface":"UML interface","zoom.in":"Zoom in","zoom.out":"Zoom out","zoom.reset":"Reset","style.stroke":"Border","style.line":"Line","style.fill":"Fill","style.text":"Text","style.highlight":"Highlight","style.prefix":"Prefix","style.prefix.soon":"Prefix symbols are coming soon","style.none":"None","style.addColor":"Add color","style.connection":"Connection","style.arrow":"Arrow head","style.dashed":"Dashed","style.solid":"Solid","style.opacity":"Opacity","style.connection.straight":"Straight","style.connection.polyline":"Rounded polyline","style.connection.orthogonal":"Orthogonal","style.connection.curve":"Curve","style.arrowhead.none":"None","style.arrowhead.end":"End","style.arrowhead.start":"Start","style.arrowhead.both":"Both","style.arrowhead.none-dashed":"Dashed","style.arrowhead.both-dashed":"Dashed both","style.uml":"UML","style.arrowhead.inheritance":"Inheritance","style.arrowhead.composition":"Composition","style.arrowhead.aggregation":"Aggregation","style.arrowhead.dependency":"Dependency","style.arrowhead.realization":"Realization","menu.title":"Create shape","menu.cancel":"Click empty space to cancel","shape.rectangle":"Rectangle","shape.rounded-rectangle":"Rounded","shape.circle":"Circle","shape.ellipse":"Ellipse","shape.diamond":"Diamond","shape.triangle":"Triangle","shape.hexagon":"Hexagon","shape.parallelogram":"Parallelogram","shape.trapezoid":"Trapezoid","shape.pentagon":"Pentagon","shape.octagon":"Octagon","shape.star":"Star","shape.uml-class":"Class","shape.uml-interface":"Interface","uml.drag":"Drag to reorder","uml.delete":"Delete row","uml.textColor":"Text color","uml.defaultColor":"Default color","uml.fontSize":"Font size","uml.strikethrough":"Strikethrough","uml.attribute":"Attributes","uml.method":"Methods","minimap.title":"Minimap","minimap.expand":"Expand minimap","minimap.collapse":"Collapse minimap","tool.mind-map":"Mind map","toolbar.mind-map":"Mind map","toolbar.export":"Export","toolbar.export.png":"PNG image","toolbar.export.svg":"SVG vector","toolbar.export.pdf":"PDF document","toolbar.export.data":"Export data","toolbar.import.data":"Import data","import.success":"Import succeeded: {n} shapes restored","import.fail":"Import failed: invalid file format","shape.mind-map":"Mind map","mindmap.defaultRoot":"Central topic","mindmap.defaultBranch":"Branch topic","mindmap.nodeText":"Node text","mindmap.addChild":"Child","mindmap.addSibling":"Sibling","mindmap.deleteNode":"Delete node","mindmap.color":"Color","mindmap.levelColor":"Default level color","mindmap.icon":"Icon","mindmap.noIcon":"No icon","mindmap.note":"Note","mindmap.notePlaceholder":"Note content (optional)","mindmap.noteColor":"Note color","mindmap.noteColorDefault":"Same as node","mindmap.collapse":"Collapse","mindmap.expand":"Expand","mindmap.close":"Close editor","mindmap.more":"More settings","mindmap.level":"Level","mindmap.promote1":"Promote","mindmap.promote2":"Promote 2","mindmap.promoteDisabled":"Already at top","tool.table":"Table","toolbar.table":"Table","shape.table":"Table","table.insertRow":"Insert row","table.deleteRow":"Delete row","table.insertCol":"Insert column","table.deleteCol":"Delete column","table.merge":"Merge cells","table.split":"Split cell","table.insertRowAbove":"Insert row above","table.insertRowBelow":"Insert row below","table.insertColLeft":"Insert column left","table.insertColRight":"Insert column right","table.pickHint":"Drag to pick size","ctx.copy":"Copy","ctx.paste":"Paste","ctx.duplicate":"Duplicate","ctx.layer":"Layer","ctx.bringToFront":"Bring to front","ctx.bringForward":"Bring forward","ctx.sendBackward":"Send backward","ctx.sendToBack":"Send to back","ctx.copyStyle":"Copy style","ctx.pasteStyle":"Paste style","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"Rotate","ctx.group":"Group","ctx.ungroup":"Ungroup","ctx.lock":"Lock","ctx.unlock":"Unlock","ctx.unlockAll":"Unlock all","ctx.delete":"Delete","toolbar.icon":"Icons (S)","toolbar.template":"Templates","template.search":"Search templates","template.all":"All","template.empty":"No matching template","toolbar.image":"Image","toolbar.more":"More","toolbar.pageTheme":"Page theme","pageTheme.light":"Default","pageTheme.warm":"Warm","pageTheme.gray":"Light gray","pageTheme.purple":"Light purple","pageTheme.green":"Light green","pageTheme.eye-care":"Eye care","tool.image":"Image","image.uploadFailed":"Image upload failed","image.insertFailed":"Failed to insert image","image.tooLarge":"Image exceeds the 30 MB upload limit","image.temporaryInserted":"Temporary image inserted (no upload endpoint configured, it will be lost on refresh)","image.naturalSize":"Original size","icon.search":"Search icons","icon.empty":"No matching icons","icon.recent":"Recent","iconCat.status":"Status","iconCat.number":"Number badges","iconCat.tech":"Cloud & tech","iconCat.chart":"Charts","iconCat.office":"Documents","iconCat.media":"Media & collab","iconCat.arrow":"Arrows","iconCat.misc":"Essentials","iconCat.emoji":"Emoji","iconCat.sticker":"Stickers","iconCat.device":"Devices","iconCat.weather":"Weather","iconCat.transport":"Transport","iconCat.nature":"Nature","iconCat.building":"Building","iconCat.medical":"Medical","iconCat.shopping":"Shopping","iconCat.science":"Science","iconCat.animal":"Animal","iconCat.time":"Time","iconCat.edit":"Editing","iconCat.food":"Food","iconCat.communication":"Communication"},"ja-JP":{"save.success":"\u4FDD\u5B58\u3057\u307E\u3057\u305F","save.fail":"\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F","tool.select":"\u9078\u629E\u30C4\u30FC\u30EB","tool.hand":"\u30AD\u30E3\u30F3\u30D0\u30B9\u3092\u79FB\u52D5","tool.rectangle":"\u56DB\u89D2\u5F62","tool.rounded-rectangle":"\u89D2\u4E38\u56DB\u89D2\u5F62","tool.circle":"\u5186","tool.ellipse":"\u6955\u5186","tool.diamond":"\u3072\u3057\u5F62","tool.triangle":"\u4E09\u89D2\u5F62","tool.hexagon":"\u516D\u89D2\u5F62","tool.parallelogram":"\u5E73\u884C\u56DB\u8FBA\u5F62","tool.trapezoid":"\u53F0\u5F62","tool.pentagon":"\u4E94\u89D2\u5F62","tool.octagon":"\u516B\u89D2\u5F62","tool.star":"\u661F\u5F62","tool.cylinder":"\u5186\u67F1","tool.cloud":"\u96F2","tool.heart":"\u30CF\u30FC\u30C8","tool.block-arrow-right":"\u53F3\u77E2\u5370","tool.block-arrow-left":"\u5DE6\u77E2\u5370","tool.block-arrow-up":"\u4E0A\u77E2\u5370","tool.block-arrow-down":"\u4E0B\u77E2\u5370","tool.block-arrow-double":"\u53CC\u65B9\u5411\u77E2\u5370","tool.right-triangle":"\u76F4\u89D2\u4E09\u89D2\u5F62","tool.cross":"\u5341\u5B57","tool.speech-rect":"\u56DB\u89D2\u3044\u5439\u304D\u51FA\u3057","tool.speech-round":"\u4E38\u3044\u5439\u304D\u51FA\u3057","tool.cube":"\u7ACB\u65B9\u4F53","tool.sector":"\u6247\u5F62","tool.delay":"D \u5B57","tool.predefined-process":"\u5B9A\u7FA9\u6E08\u307F\u51E6\u7406","tool.document":"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","tool.stadium":"\u4E21\u7AEF\u304C\u4E38\u3044\u9577\u65B9\u5F62","tool.class-catalog":"\u30AB\u30C6\u30B4\u30EA","tool.envelope":"\u5C01\u7B52","tool.checkbox":"\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9","tool.sticky-note":"\u4ED8\u7B8B","shape.sticky-note":"\u4ED8\u7B8B","tool.triangular-pyramid":"\u4E09\u89D2\u9310","tool.quadrangular-pyramid":"\u56DB\u89D2\u9310","tool.cuboid":"\u76F4\u65B9\u4F53","tool.sphere":"\u7403","tool.ellipsoid":"\u6955\u5186\u4F53","tool.pie":"\u5186\u30B0\u30E9\u30D5","tool.hollow-pie":"\u30C9\u30FC\u30CA\u30C4","class.plain":"\u30AF\u30E9\u30B9","flow.process":"\u51E6\u7406","flow.step":"\u30B9\u30C6\u30C3\u30D7","flow.startEnd":"\u958B\u59CB/\u7D42\u4E86","flow.decision":"\u5224\u65AD","flow.data":"\u30C7\u30FC\u30BF","flow.manual":"\u624B\u52D5\u64CD\u4F5C","flow.preparation":"\u6E96\u5099","flow.database":"\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9","flow.delay":"\u9045\u5EF6","shapeGroup.basic":"\u57FA\u672C","shapeGroup.flowchart":"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8","shapeGroup.other":"\u305D\u306E\u4ED6","shapeGroup.solid":"\u7ACB\u4F53","shapeGroup.uml":"\u30AF\u30E9\u30B9\u56F3","shapeMenu.hint":"\u30DB\u30D0\u30FC\u3067\u540D\u524D\u3092\u8868\u793A","tool.chevron":"\u5C71\u5F62","tool.brace-left":"\u5DE6\u4E2D\u62EC\u5F27","tool.brace-right":"\u53F3\u4E2D\u62EC\u5F27","tool.uml-class":"UML \u30AF\u30E9\u30B9\u56F3","tool.uml-interface":"UML \u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30FC\u30B9","tool.line":"\u76F4\u7DDA","tool.arrow":"\u7DDA","tool.text":"\u30C6\u30AD\u30B9\u30C8","tool.draw":"\u30DA\u30F3","tool.pen":"\u30DA\u30F3","tool.highlighter":"\u86CD\u5149\u30DA\u30F3","tool.eraser":"\u6D88\u3057\u30B4\u30E0","status.none":"\u672A\u9078\u629E","status.selected":"{n} \u500B\u306E\u56F3\u5F62\u3092\u9078\u629E\u4E2D","toolbar.select":"\u9078\u629E (V)","toolbar.hand":"\u30AD\u30E3\u30F3\u30D0\u30B9\u3092\u79FB\u52D5 (H)","toolbar.shapes":"\u56F3\u5F62","toolbar.grid":"\u30B0\u30EA\u30C3\u30C9","toolbar.undo":"\u5143\u306B\u623B\u3059 (Ctrl+Z)","toolbar.redo":"\u3084\u308A\u76F4\u3059 (Ctrl+Shift+Z)","toolbar.arrow":"\u77E2\u5370 (A)","toolbar.text":"\u30C6\u30AD\u30B9\u30C8 (T)","toolbar.pen":"\u30DA\u30F3","toolbar.highlighter":"\u86CD\u5149\u30DA\u30F3","toolbar.eraser":"\u6D88\u3057\u30B4\u30E0 (E)","toolbar.uml-class":"UML \u30AF\u30E9\u30B9\u56F3","toolbar.uml-interface":"UML \u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30FC\u30B9","zoom.in":"\u62E1\u5927","zoom.out":"\u7E2E\u5C0F","zoom.reset":"\u30EA\u30BB\u30C3\u30C8","style.stroke":"\u67A0\u7DDA","style.line":"\u7DDA","style.fill":"\u5857\u308A","style.text":"\u30C6\u30AD\u30B9\u30C8","style.highlight":"\u30CF\u30A4\u30E9\u30A4\u30C8","style.prefix":"\u63A5\u982D\u8A18\u53F7","style.prefix.soon":"\u63A5\u982D\u8A18\u53F7\u306F\u958B\u767A\u4E2D\u3067\u3059\u3002\u3057\u3070\u3089\u304F\u304A\u5F85\u3061\u304F\u3060\u3055\u3044","style.none":"\u306A\u3057","style.addColor":"\u8272\u3092\u8FFD\u52A0","style.connection":"\u63A5\u7D9A","style.arrow":"\u77E2\u5370","style.dashed":"\u7834\u7DDA","style.solid":"\u5B9F\u7DDA","style.opacity":"\u4E0D\u900F\u660E\u5EA6","style.connection.straight":"\u76F4\u7DDA","style.connection.polyline":"\u89D2\u4E38\u6298\u308C\u7DDA","style.connection.orthogonal":"\u76F4\u89D2\u6298\u308C\u7DDA","style.connection.curve":"\u66F2\u7DDA","style.arrowhead.none":"\u77E2\u5370\u306A\u3057","style.arrowhead.end":"\u7D42\u70B9\u306E\u77E2\u5370","style.arrowhead.start":"\u59CB\u70B9\u306E\u77E2\u5370","style.arrowhead.both":"\u4E21\u7AEF\u306E\u77E2\u5370","style.arrowhead.none-dashed":"\u77E2\u5370\u306A\u3057\u306E\u7834\u7DDA","style.arrowhead.both-dashed":"\u4E21\u7AEF\u77E2\u5370\u306E\u7834\u7DDA","style.uml":"UML","style.arrowhead.inheritance":"\u7D99\u627F","style.arrowhead.composition":"\u30B3\u30F3\u30DD\u30B8\u30B7\u30E7\u30F3","style.arrowhead.aggregation":"\u96C6\u7D04","style.arrowhead.dependency":"\u4F9D\u5B58","style.arrowhead.realization":"\u5B9F\u73FE","menu.title":"\u65B0\u3057\u3044\u56F3\u5F62\u3092\u9078\u629E","menu.cancel":"\u7A7A\u767D\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30AD\u30E3\u30F3\u30BB\u30EB","shape.rectangle":"\u56DB\u89D2\u5F62","shape.rounded-rectangle":"\u89D2\u4E38","shape.circle":"\u5186","shape.ellipse":"\u6955\u5186","shape.diamond":"\u3072\u3057\u5F62","shape.triangle":"\u4E09\u89D2","shape.hexagon":"\u516D\u89D2\u5F62","shape.parallelogram":"\u5E73\u884C","shape.trapezoid":"\u53F0\u5F62","shape.pentagon":"\u4E94\u89D2\u5F62","shape.octagon":"\u516B\u89D2\u5F62","shape.star":"\u661F\u5F62","shape.uml-class":"\u30AF\u30E9\u30B9\u56F3","shape.uml-interface":"\u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30FC\u30B9","uml.drag":"\u30C9\u30E9\u30C3\u30B0\u3067\u4E26\u3079\u66FF\u3048","uml.delete":"\u3053\u306E\u884C\u3092\u524A\u9664","uml.textColor":"\u6587\u5B57\u8272","uml.defaultColor":"\u65E2\u5B9A\u306E\u8272","uml.fontSize":"\u6587\u5B57\u30B5\u30A4\u30BA","uml.strikethrough":"\u53D6\u308A\u6D88\u3057\u7DDA","uml.attribute":"\u5C5E\u6027","uml.method":"\u30E1\u30BD\u30C3\u30C9","minimap.title":"\u30DF\u30CB\u30DE\u30C3\u30D7","minimap.expand":"\u30DF\u30CB\u30DE\u30C3\u30D7\u3092\u5C55\u958B","minimap.collapse":"\u30DF\u30CB\u30DE\u30C3\u30D7\u3092\u6298\u308A\u305F\u305F\u3080","tool.mind-map":"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7","toolbar.mind-map":"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7","toolbar.export":"\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8","toolbar.export.png":"PNG \u753B\u50CF","toolbar.export.svg":"SVG \u30D9\u30AF\u30BF\u30FC","toolbar.export.pdf":"PDF \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","toolbar.export.data":"\u30C7\u30FC\u30BF\u3092\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8","toolbar.import.data":"\u30C7\u30FC\u30BF\u3092\u30A4\u30F3\u30DD\u30FC\u30C8","import.success":"\u30A4\u30F3\u30DD\u30FC\u30C8\u6210\u529F\uFF1A{n} \u500B\u306E\u56F3\u5F62\u3092\u5FA9\u5143\u3057\u307E\u3057\u305F","import.fail":"\u30A4\u30F3\u30DD\u30FC\u30C8\u5931\u6557\uFF1A\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093","shape.mind-map":"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7","mindmap.defaultRoot":"\u4E2D\u5FC3\u30C8\u30D4\u30C3\u30AF","mindmap.defaultBranch":"\u30D6\u30E9\u30F3\u30C1\u30C8\u30D4\u30C3\u30AF","mindmap.nodeText":"\u30CE\u30FC\u30C9\u306E\u30C6\u30AD\u30B9\u30C8","mindmap.addChild":"\u5B50\u30CE\u30FC\u30C9","mindmap.addSibling":"\u5144\u5F1F\u30CE\u30FC\u30C9","mindmap.deleteNode":"\u30CE\u30FC\u30C9\u3092\u524A\u9664","mindmap.color":"\u8272","mindmap.levelColor":"\u65E2\u5B9A\u306E\u968E\u5C64\u8272","mindmap.icon":"\u30A2\u30A4\u30B3\u30F3","mindmap.noIcon":"\u30A2\u30A4\u30B3\u30F3\u306A\u3057","mindmap.note":"\u88DC\u8DB3\u8AAC\u660E","mindmap.notePlaceholder":"\u8AAC\u660E\uFF08\u4EFB\u610F\uFF09","mindmap.noteColor":"\u8AAC\u660E\u306E\u8272","mindmap.noteColorDefault":"\u30CE\u30FC\u30C9\u3068\u540C\u3058","mindmap.collapse":"\u6298\u308A\u305F\u305F\u3080","mindmap.expand":"\u5C55\u958B","mindmap.close":"\u7DE8\u96C6\u3092\u9589\u3058\u308B","mindmap.more":"\u8A73\u7D30\u8A2D\u5B9A","mindmap.level":"Level","mindmap.promote1":"Promote","mindmap.promote2":"Promote 2","mindmap.promoteDisabled":"Already at top","tool.table":"\u30C6\u30FC\u30D6\u30EB","toolbar.table":"\u30C6\u30FC\u30D6\u30EB","shape.table":"\u30C6\u30FC\u30D6\u30EB","table.insertRow":"\u884C\u3092\u633F\u5165","table.deleteRow":"\u884C\u3092\u524A\u9664","table.insertCol":"\u5217\u3092\u633F\u5165","table.deleteCol":"\u5217\u3092\u524A\u9664","table.merge":"\u30BB\u30EB\u3092\u7D50\u5408","table.split":"\u30BB\u30EB\u3092\u5206\u5272","table.insertRowAbove":"\u4E0A\u306B\u884C\u3092\u633F\u5165","table.insertRowBelow":"\u4E0B\u306B\u884C\u3092\u633F\u5165","table.insertColLeft":"\u5DE6\u306B\u5217\u3092\u633F\u5165","table.insertColRight":"\u53F3\u306B\u5217\u3092\u633F\u5165","table.pickHint":"\u884C\u6570\u30FB\u5217\u6570\u3092\u9078\u629E","ctx.copy":"\u30B3\u30D4\u30FC","ctx.paste":"\u8CBC\u308A\u4ED8\u3051","ctx.duplicate":"\u8907\u88FD\u3092\u4F5C\u6210","ctx.layer":"\u30EC\u30A4\u30E4\u30FC","ctx.bringToFront":"\u6700\u524D\u9762\u3078","ctx.bringForward":"\u4E00\u3064\u524D\u3078","ctx.sendBackward":"\u4E00\u3064\u5F8C\u308D\u3078","ctx.sendToBack":"\u6700\u80CC\u9762\u3078","ctx.copyStyle":"\u30B9\u30BF\u30A4\u30EB\u3092\u30B3\u30D4\u30FC","ctx.pasteStyle":"\u30B9\u30BF\u30A4\u30EB\u3092\u8CBC\u308A\u4ED8\u3051","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"\u56DE\u8EE2","ctx.group":"\u30B0\u30EB\u30FC\u30D7\u5316","ctx.ungroup":"\u30B0\u30EB\u30FC\u30D7\u89E3\u9664","ctx.lock":"\u30ED\u30C3\u30AF","ctx.unlock":"\u30ED\u30C3\u30AF\u89E3\u9664","ctx.unlockAll":"\u3059\u3079\u3066\u30ED\u30C3\u30AF\u89E3\u9664","ctx.delete":"\u524A\u9664","toolbar.icon":"\u30A2\u30A4\u30B3\u30F3 (S)","toolbar.template":"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8","template.search":"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u691C\u7D22","template.all":"\u3059\u3079\u3066","template.empty":"\u4E00\u81F4\u3059\u308B\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u304C\u3042\u308A\u307E\u305B\u3093","toolbar.image":"\u753B\u50CF","toolbar.more":"\u305D\u306E\u4ED6","toolbar.pageTheme":"\u30DA\u30FC\u30B8\u30C6\u30FC\u30DE","pageTheme.light":"\u30C7\u30D5\u30A9\u30EB\u30C8","pageTheme.warm":"\u30A6\u30A9\u30FC\u30E0","pageTheme.gray":"\u30E9\u30A4\u30C8\u30B0\u30EC\u30FC","pageTheme.purple":"\u30E9\u30A4\u30C8\u30D1\u30FC\u30D7\u30EB","pageTheme.green":"\u30E9\u30A4\u30C8\u30B0\u30EA\u30FC\u30F3","pageTheme.eye-care":"\u30A2\u30A4\u30B1\u30A2","tool.image":"\u753B\u50CF","image.uploadFailed":"\u753B\u50CF\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F","image.insertFailed":"\u753B\u50CF\u306E\u633F\u5165\u306B\u5931\u6557\u3057\u307E\u3057\u305F","image.tooLarge":"\u753B\u50CF\u304C 30 MB \u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093","image.temporaryInserted":"\u4E00\u6642\u753B\u50CF\u3092\u633F\u5165\u3057\u307E\u3057\u305F\uFF08\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5148\u304C\u672A\u8A2D\u5B9A\u306E\u305F\u3081\u3001\u518D\u8AAD\u307F\u8FBC\u307F\u3067\u5931\u308F\u308C\u307E\u3059\uFF09","image.naturalSize":"\u5143\u306E\u30B5\u30A4\u30BA","icon.search":"\u30A2\u30A4\u30B3\u30F3\u3092\u691C\u7D22","icon.empty":"\u4E00\u81F4\u3059\u308B\u30A2\u30A4\u30B3\u30F3\u304C\u3042\u308A\u307E\u305B\u3093","icon.recent":"\u6700\u8FD1\u4F7F\u3063\u305F\u3082\u306E","iconCat.status":"\u30B9\u30C6\u30FC\u30BF\u30B9","iconCat.number":"\u6570\u5B57\u30D0\u30C3\u30B8","iconCat.tech":"\u30AF\u30E9\u30A6\u30C9\u3068\u6280\u8853","iconCat.chart":"\u30B0\u30E9\u30D5","iconCat.office":"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","iconCat.media":"\u30E1\u30C7\u30A3\u30A2\u3068\u5171\u540C\u4F5C\u696D","iconCat.arrow":"\u77E2\u5370","iconCat.misc":"\u3088\u304F\u4F7F\u3046","iconCat.emoji":"\u7D75\u6587\u5B57","iconCat.sticker":"\u30B9\u30C6\u30C3\u30AB\u30FC","iconCat.device":"\u30C7\u30D0\u30A4\u30B9","iconCat.weather":"\u5929\u6C17","iconCat.transport":"\u4EA4\u901A","iconCat.nature":"\u81EA\u7136","iconCat.building":"\u5EFA\u7269","iconCat.medical":"\u533B\u7642","iconCat.shopping":"\u30B7\u30E7\u30C3\u30D4\u30F3\u30B0","iconCat.science":"\u30B5\u30A4\u30A8\u30F3\u30B9","iconCat.animal":"\u52D5\u7269","iconCat.time":"\u6642\u9593","iconCat.edit":"\u7DE8\u96C6","iconCat.food":"\u98DF\u3079\u7269","iconCat.communication":"\u901A\u4FE1"},"ko-KR":{"save.success":"\uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4","save.fail":"\uC800\uC7A5 \uC2E4\uD328","tool.select":"\uC120\uD0DD \uB3C4\uAD6C","tool.hand":"\uD654\uBA74 \uC774\uB3D9","tool.rectangle":"\uC0AC\uAC01\uD615","tool.rounded-rectangle":"\uB465\uADFC \uC0AC\uAC01\uD615","tool.circle":"\uC6D0","tool.ellipse":"\uD0C0\uC6D0","tool.diamond":"\uB2E4\uC774\uC544\uBAAC\uB4DC","tool.triangle":"\uC0BC\uAC01\uD615","tool.hexagon":"\uC721\uAC01\uD615","tool.parallelogram":"\uD3C9\uD589\uC0AC\uBCC0\uD615","tool.trapezoid":"\uC0AC\uB2E4\uB9AC\uAF34","tool.pentagon":"\uC624\uAC01\uD615","tool.octagon":"\uD314\uAC01\uD615","tool.star":"\uBCC4","tool.cylinder":"\uC6D0\uAE30\uB465","tool.cloud":"\uAD6C\uB984","tool.heart":"\uD558\uD2B8","tool.block-arrow-right":"\uC624\uB978\uCABD \uD654\uC0B4\uD45C","tool.block-arrow-left":"\uC67C\uCABD \uD654\uC0B4\uD45C","tool.block-arrow-up":"\uC704\uCABD \uD654\uC0B4\uD45C","tool.block-arrow-down":"\uC544\uB798\uCABD \uD654\uC0B4\uD45C","tool.block-arrow-double":"\uC591\uBC29\uD5A5 \uD654\uC0B4\uD45C","tool.right-triangle":"\uC9C1\uAC01\uC0BC\uAC01\uD615","tool.cross":"\uC2ED\uC790","tool.speech-rect":"\uC0AC\uAC01\uD615 \uB9D0\uD48D\uC120","tool.speech-round":"\uC6D0\uD615 \uB9D0\uD48D\uC120","tool.cube":"\uC815\uC721\uBA74\uCCB4","tool.sector":"\uBD80\uCC44\uAF34","tool.delay":"D \uC790","tool.predefined-process":"\uC0AC\uC804 \uC815\uC758 \uD504\uB85C\uC138\uC2A4","tool.document":"\uBB38\uC11C","tool.stadium":"\uC591\uB05D\uC774 \uB465\uADFC \uC0AC\uAC01\uD615","tool.class-catalog":"\uCE74\uD14C\uACE0\uB9AC","tool.envelope":"\uBD09\uD22C","tool.checkbox":"\uCCB4\uD06C\uBC15\uC2A4","tool.sticky-note":"\uC2A4\uD2F0\uD0A4 \uB178\uD2B8","shape.sticky-note":"\uC2A4\uD2F0\uD0A4 \uB178\uD2B8","tool.triangular-pyramid":"\uC0BC\uAC01\uBFD4","tool.quadrangular-pyramid":"\uC0AC\uAC01\uBFD4","tool.cuboid":"\uC9C1\uC721\uBA74\uCCB4","tool.sphere":"\uAD6C","tool.ellipsoid":"\uD0C0\uC6D0\uCCB4","tool.pie":"\uD30C\uC774","tool.hollow-pie":"\uB3C4\uB11B","class.plain":"\uD074\uB798\uC2A4","flow.process":"\uCC98\uB9AC","flow.step":"\uB2E8\uACC4","flow.startEnd":"\uC2DC\uC791/\uC885\uB8CC","flow.decision":"\uD310\uB2E8","flow.data":"\uB370\uC774\uD130","flow.manual":"\uC218\uB3D9 \uC791\uC5C5","flow.preparation":"\uC900\uBE44","flow.database":"\uB370\uC774\uD130\uBCA0\uC774\uC2A4","flow.delay":"\uC9C0\uC5F0","shapeGroup.basic":"\uAE30\uBCF8","shapeGroup.flowchart":"\uC21C\uC11C\uB3C4","shapeGroup.other":"\uAE30\uD0C0","shapeGroup.solid":"\uC785\uCCB4","shapeGroup.uml":"\uD074\uB798\uC2A4 \uB2E4\uC774\uC5B4\uADF8\uB7A8","shapeMenu.hint":"\uB9C8\uC6B0\uC2A4\uB97C \uC62C\uB824 \uC774\uB984 \uD655\uC778","tool.chevron":"\uAEBE\uC1E0","tool.brace-left":"\uC67C\uCABD \uC911\uAD04\uD638","tool.brace-right":"\uC624\uB978\uCABD \uC911\uAD04\uD638","tool.uml-class":"UML \uD074\uB798\uC2A4","tool.uml-interface":"UML \uC778\uD130\uD398\uC774\uC2A4","tool.line":"\uC9C1\uC120","tool.arrow":"\uC120","tool.text":"\uD14D\uC2A4\uD2B8","tool.draw":"\uD39C","tool.pen":"\uD39C","tool.highlighter":"\uD615\uAD11\uD39C","tool.eraser":"\uC9C0\uC6B0\uAC1C","status.none":"\uC120\uD0DD \uC5C6\uC74C","status.selected":"\uB3C4\uD615 {n}\uAC1C \uC120\uD0DD\uB428","toolbar.select":"\uC120\uD0DD (V)","toolbar.hand":"\uD654\uBA74 \uC774\uB3D9 (H)","toolbar.shapes":"\uB3C4\uD615","toolbar.grid":"\uADF8\uB9AC\uB4DC","toolbar.undo":"\uC2E4\uD589 \uCDE8\uC18C (Ctrl+Z)","toolbar.redo":"\uB2E4\uC2DC \uC2E4\uD589 (Ctrl+Shift+Z)","toolbar.arrow":"\uD654\uC0B4\uD45C (A)","toolbar.text":"\uD14D\uC2A4\uD2B8 (T)","toolbar.pen":"\uD39C","toolbar.highlighter":"\uD615\uAD11\uD39C","toolbar.eraser":"\uC9C0\uC6B0\uAC1C (E)","toolbar.uml-class":"UML \uD074\uB798\uC2A4","toolbar.uml-interface":"UML \uC778\uD130\uD398\uC774\uC2A4","zoom.in":"\uD655\uB300","zoom.out":"\uCD95\uC18C","zoom.reset":"\uCD08\uAE30\uD654","style.stroke":"\uD14C\uB450\uB9AC","style.line":"\uC120","style.fill":"\uCC44\uC6B0\uAE30","style.text":"\uD14D\uC2A4\uD2B8","style.highlight":"\uD615\uAD11","style.prefix":"\uC811\uB450 \uAE30\uD638","style.prefix.soon":"\uC811\uB450 \uAE30\uD638\uB294 \uC900\uBE44 \uC911\uC785\uB2C8\uB2E4","style.none":"\uC5C6\uC74C","style.addColor":"\uC0C9\uC0C1 \uCD94\uAC00","style.connection":"\uC5F0\uACB0","style.arrow":"\uD654\uC0B4\uD45C","style.dashed":"\uC810\uC120","style.solid":"\uC2E4\uC120","style.opacity":"\uBD88\uD22C\uBA85\uB3C4","style.connection.straight":"\uC9C1\uC120","style.connection.polyline":"\uB465\uADFC \uAEBE\uC740\uC120","style.connection.orthogonal":"\uC9C1\uAC01 \uAEBE\uC740\uC120","style.connection.curve":"\uACE1\uC120","style.arrowhead.none":"\uD654\uC0B4\uD45C \uC5C6\uC74C","style.arrowhead.end":"\uB05D \uD654\uC0B4\uD45C","style.arrowhead.start":"\uC2DC\uC791 \uD654\uC0B4\uD45C","style.arrowhead.both":"\uC591\uBC29\uD5A5 \uD654\uC0B4\uD45C","style.arrowhead.none-dashed":"\uD654\uC0B4\uD45C \uC5C6\uB294 \uC810\uC120","style.arrowhead.both-dashed":"\uC591\uBC29\uD5A5 \uD654\uC0B4\uD45C \uC810\uC120","style.uml":"UML","style.arrowhead.inheritance":"\uC0C1\uC18D","style.arrowhead.composition":"\uD569\uC131","style.arrowhead.aggregation":"\uC9D1\uD569","style.arrowhead.dependency":"\uC758\uC874","style.arrowhead.realization":"\uC2E4\uD604","menu.title":"\uC0C8 \uB3C4\uD615 \uC120\uD0DD","menu.cancel":"\uBE48 \uACF3\uC744 \uD074\uB9AD\uD574 \uCDE8\uC18C","shape.rectangle":"\uC0AC\uAC01\uD615","shape.rounded-rectangle":"\uB465\uADFC","shape.circle":"\uC6D0","shape.ellipse":"\uD0C0\uC6D0","shape.diamond":"\uB2E4\uC774\uC544\uBAAC\uB4DC","shape.triangle":"\uC0BC\uAC01","shape.hexagon":"\uC721\uAC01\uD615","shape.parallelogram":"\uD3C9\uD589","shape.trapezoid":"\uC0AC\uB2E4\uB9AC\uAF34","shape.pentagon":"\uC624\uAC01\uD615","shape.octagon":"\uD314\uAC01\uD615","shape.star":"\uBCC4","shape.uml-class":"\uD074\uB798\uC2A4","shape.uml-interface":"\uC778\uD130\uD398\uC774\uC2A4","uml.drag":"\uB4DC\uB798\uADF8\uD558\uC5EC \uC815\uB82C","uml.delete":"\uC774 \uD589 \uC0AD\uC81C","uml.textColor":"\uAE00\uC790\uC0C9","uml.defaultColor":"\uAE30\uBCF8 \uC0C9\uC0C1","uml.fontSize":"\uAE00\uC790 \uD06C\uAE30","uml.strikethrough":"\uCDE8\uC18C\uC120","uml.attribute":"\uC18D\uC131","uml.method":"\uBA54\uC11C\uB4DC","minimap.title":"\uBBF8\uB2C8\uB9F5","minimap.expand":"\uBBF8\uB2C8\uB9F5 \uD3BC\uCE58\uAE30","minimap.collapse":"\uBBF8\uB2C8\uB9F5 \uC811\uAE30","tool.mind-map":"\uB9C8\uC778\uB4DC\uB9F5","toolbar.mind-map":"\uB9C8\uC778\uB4DC\uB9F5","toolbar.export":"\uB0B4\uBCF4\uB0B4\uAE30","toolbar.export.png":"PNG \uC774\uBBF8\uC9C0","toolbar.export.svg":"SVG \uBCA1\uD130","toolbar.export.pdf":"PDF \uBB38\uC11C","toolbar.export.data":"\uB370\uC774\uD130 \uB0B4\uBCF4\uB0B4\uAE30","toolbar.import.data":"\uB370\uC774\uD130 \uAC00\uC838\uC624\uAE30","import.success":"\uAC00\uC838\uC624\uAE30 \uC131\uACF5: \uB3C4\uD615 {n}\uAC1C \uBCF5\uC6D0\uB428","import.fail":"\uAC00\uC838\uC624\uAE30 \uC2E4\uD328: \uD30C\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4","shape.mind-map":"\uB9C8\uC778\uB4DC\uB9F5","mindmap.defaultRoot":"\uC911\uC2EC \uC8FC\uC81C","mindmap.defaultBranch":"\uBD84\uAE30 \uC8FC\uC81C","mindmap.nodeText":"\uB178\uB4DC \uD14D\uC2A4\uD2B8","mindmap.addChild":"\uD558\uC704 \uB178\uB4DC","mindmap.addSibling":"\uD615\uC81C \uB178\uB4DC","mindmap.deleteNode":"\uB178\uB4DC \uC0AD\uC81C","mindmap.color":"\uC0C9\uC0C1","mindmap.levelColor":"\uAE30\uBCF8 \uB2E8\uACC4 \uC0C9\uC0C1","mindmap.icon":"\uC544\uC774\uCF58","mindmap.noIcon":"\uC544\uC774\uCF58 \uC5C6\uC74C","mindmap.note":"\uC18D\uC131 \uC124\uBA85","mindmap.notePlaceholder":"\uC124\uBA85 \uB0B4\uC6A9(\uC120\uD0DD)","mindmap.noteColor":"\uC124\uBA85 \uC0C9\uC0C1","mindmap.noteColorDefault":"\uB178\uB4DC\uC640 \uB3D9\uC77C","mindmap.collapse":"\uC811\uAE30","mindmap.expand":"\uD3BC\uCE58\uAE30","mindmap.close":"\uD3B8\uC9D1 \uB2EB\uAE30","mindmap.more":"\uCD94\uAC00 \uC124\uC815","mindmap.level":"Level","mindmap.promote1":"Promote","mindmap.promote2":"Promote 2","mindmap.promoteDisabled":"Already at top","tool.table":"\uD45C","toolbar.table":"\uD45C","shape.table":"\uD45C","table.insertRow":"\uD589 \uC0BD\uC785","table.deleteRow":"\uD589 \uC0AD\uC81C","table.insertCol":"\uC5F4 \uC0BD\uC785","table.deleteCol":"\uC5F4 \uC0AD\uC81C","table.merge":"\uC140 \uBCD1\uD569","table.split":"\uC140 \uBD84\uD560","table.insertRowAbove":"\uC704\uC5D0 \uD589 \uC0BD\uC785","table.insertRowBelow":"\uC544\uB798\uC5D0 \uD589 \uC0BD\uC785","table.insertColLeft":"\uC67C\uCABD\uC5D0 \uC5F4 \uC0BD\uC785","table.insertColRight":"\uC624\uB978\uCABD\uC5D0 \uC5F4 \uC0BD\uC785","table.pickHint":"\uD589\xB7\uC5F4 \uC218 \uC120\uD0DD","ctx.copy":"\uBCF5\uC0AC","ctx.paste":"\uBD99\uC5EC\uB123\uAE30","ctx.duplicate":"\uC0AC\uBCF8 \uB9CC\uB4E4\uAE30","ctx.layer":"\uB808\uC774\uC5B4","ctx.bringToFront":"\uB9E8 \uC55E\uC73C\uB85C","ctx.bringForward":"\uD55C \uCE78 \uC55E\uC73C\uB85C","ctx.sendBackward":"\uD55C \uCE78 \uB4A4\uB85C","ctx.sendToBack":"\uB9E8 \uB4A4\uB85C","ctx.copyStyle":"\uC2A4\uD0C0\uC77C \uBCF5\uC0AC","ctx.pasteStyle":"\uC2A4\uD0C0\uC77C \uBD99\uC5EC\uB123\uAE30","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"\uD68C\uC804","ctx.group":"\uADF8\uB8F9 \uB9CC\uB4E4\uAE30","ctx.ungroup":"\uADF8\uB8F9 \uD574\uC81C","ctx.lock":"\uC7A0\uAE08","ctx.unlock":"\uC7A0\uAE08 \uD574\uC81C","ctx.unlockAll":"\uBAA8\uB450 \uC7A0\uAE08 \uD574\uC81C","ctx.delete":"\uC0AD\uC81C","toolbar.icon":"\uC544\uC774\uCF58 (S)","toolbar.template":"\uD15C\uD50C\uB9BF","template.search":"\uD15C\uD50C\uB9BF \uAC80\uC0C9","template.all":"\uC804\uCCB4","template.empty":"\uC77C\uCE58\uD558\uB294 \uD15C\uD50C\uB9BF\uC774 \uC5C6\uC2B5\uB2C8\uB2E4","toolbar.image":"\uC774\uBBF8\uC9C0","toolbar.more":"\uB354\uBCF4\uAE30","toolbar.pageTheme":"\uD398\uC774\uC9C0 \uD14C\uB9C8","pageTheme.light":"\uAE30\uBCF8","pageTheme.warm":"\uB530\uB73B\uD55C","pageTheme.gray":"\uBC1D\uC740 \uD68C\uC0C9","pageTheme.purple":"\uBC1D\uC740 \uBCF5\uC22D\uC544","pageTheme.green":"\uBC1D\uC740 \uCD08\uB85D","pageTheme.eye-care":"\uB208 \uBCF4\uD638","tool.image":"\uC774\uBBF8\uC9C0","image.uploadFailed":"\uC774\uBBF8\uC9C0 \uC5C5\uB85C\uB4DC \uC2E4\uD328","image.insertFailed":"\uC774\uBBF8\uC9C0 \uC0BD\uC785 \uC2E4\uD328","image.tooLarge":"\uC774\uBBF8\uC9C0\uAC00 30 MB\uB97C \uCD08\uACFC\uD558\uC5EC \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4","image.temporaryInserted":"\uC784\uC2DC \uC774\uBBF8\uC9C0\uB97C \uC0BD\uC785\uD588\uC2B5\uB2C8\uB2E4(\uC5C5\uB85C\uB4DC \uC8FC\uC18C\uAC00 \uC5C6\uC5B4 \uC0C8\uB85C\uACE0\uCE68\uD558\uBA74 \uC0AC\uB77C\uC9D1\uB2C8\uB2E4)","image.naturalSize":"\uC6D0\uBCF8 \uD06C\uAE30","icon.search":"\uC544\uC774\uCF58 \uAC80\uC0C9","icon.empty":"\uC77C\uCE58\uD558\uB294 \uC544\uC774\uCF58\uC774 \uC5C6\uC2B5\uB2C8\uB2E4","icon.recent":"\uCD5C\uADFC \uC0AC\uC6A9","iconCat.status":"\uC0C1\uD0DC \uD45C\uC2DC","iconCat.number":"\uC22B\uC790 \uBC30\uC9C0","iconCat.tech":"\uD074\uB77C\uC6B0\uB4DC\uC640 \uAE30\uC220","iconCat.chart":"\uCC28\uD2B8","iconCat.office":"\uBB38\uC11C","iconCat.media":"\uBBF8\uB514\uC5B4\uC640 \uD611\uC5C5","iconCat.arrow":"\uD654\uC0B4\uD45C","iconCat.misc":"\uC790\uC8FC \uC4F0\uB294","iconCat.emoji":"\uC774\uBAA8\uD2F0\uCF58","iconCat.sticker":"\uC2A4\uD2F0\uCEE4","iconCat.device":"\uAE30\uAE30","iconCat.weather":"\uB0A0\uC528","iconCat.transport":"\uAD50\uD1B5","iconCat.nature":"\uC790\uC5F0","iconCat.building":"\uAC74\uBB3C","iconCat.medical":"\uC758\uB8CC","iconCat.shopping":"\uC1FC\uD551","iconCat.science":"\uACFC\uD559","iconCat.animal":"\uB3D9\uBB3C","iconCat.time":"\uC2DC\uAC04","iconCat.edit":"\uD3B8\uC9D1","iconCat.food":"\uC74C\uC2DD","iconCat.communication":"\uD1B5\uC2E0"},"de-DE":{"save.success":"Gespeichert","save.fail":"Speichern fehlgeschlagen","tool.select":"Auswahlwerkzeug","tool.hand":"Ansicht verschieben","tool.rectangle":"Rechteck","tool.rounded-rectangle":"Abgerundetes Rechteck","tool.circle":"Kreis","tool.ellipse":"Ellipse","tool.diamond":"Raute","tool.triangle":"Dreieck","tool.hexagon":"Sechseck","tool.parallelogram":"Parallelogramm","tool.trapezoid":"Trapez","tool.pentagon":"F\xFCnfeck","tool.octagon":"Achteck","tool.star":"Stern","tool.cylinder":"Zylinder","tool.cloud":"Wolke","tool.heart":"Herz","tool.block-arrow-right":"Pfeil rechts","tool.block-arrow-left":"Pfeil links","tool.block-arrow-up":"Pfeil oben","tool.block-arrow-down":"Pfeil unten","tool.block-arrow-double":"Doppelpfeil","tool.right-triangle":"Rechtwinkliges Dreieck","tool.cross":"Kreuz","tool.speech-rect":"Eckige Sprechblase","tool.speech-round":"Runde Sprechblase","tool.cube":"W\xFCrfel","tool.sector":"Kreissektor","tool.delay":"D-Form","tool.predefined-process":"Vordefinierter Prozess","tool.document":"Dokument","tool.stadium":"Stadionform","tool.class-catalog":"Kategorie","tool.envelope":"Umschlag","tool.checkbox":"Kontrollk\xE4stchen","tool.sticky-note":"Haftnotiz","shape.sticky-note":"Haftnotiz","tool.triangular-pyramid":"Dreieckspyramide","tool.quadrangular-pyramid":"Viereckspyramide","tool.cuboid":"Quader","tool.sphere":"Kugel","tool.ellipsoid":"Ellipsoid","tool.pie":"Tortenst\xFCck","tool.hollow-pie":"Donut","class.plain":"Klasse","flow.process":"Prozess","flow.step":"Schritt","flow.startEnd":"Start / Ende","flow.decision":"Entscheidung","flow.data":"Daten","flow.manual":"Manueller Vorgang","flow.preparation":"Vorbereitung","flow.database":"Datenbank","flow.delay":"Verz\xF6gerung","shapeGroup.basic":"Basis","shapeGroup.flowchart":"Flussdiagramm","shapeGroup.other":"Sonstige","shapeGroup.solid":"3D","shapeGroup.uml":"Klassendiagramm","shapeMenu.hint":"Zum Anzeigen des Namens \xFCberfahren","tool.chevron":"Winkelform","tool.brace-left":"Linke Klammer","tool.brace-right":"Rechte Klammer","tool.uml-class":"UML-Klasse","tool.uml-interface":"UML-Schnittstelle","tool.line":"Linie","tool.arrow":"Linie","tool.text":"Text","tool.draw":"Stift","tool.pen":"Stift","tool.highlighter":"Textmarker","tool.eraser":"Radiergummi","status.none":"Nichts ausgew\xE4hlt","status.selected":"{n} Objekte ausgew\xE4hlt","toolbar.select":"Auswahl (V)","toolbar.hand":"Ansicht verschieben (H)","toolbar.shapes":"Formen","toolbar.grid":"Raster","toolbar.undo":"R\xFCckg\xE4ngig (Strg+Z)","toolbar.redo":"Wiederholen (Strg+Umschalt+Z)","toolbar.arrow":"Pfeil (A)","toolbar.text":"Text (T)","toolbar.pen":"Stift","toolbar.highlighter":"Textmarker","toolbar.eraser":"Radiergummi (E)","toolbar.uml-class":"UML-Klasse","toolbar.uml-interface":"UML-Schnittstelle","zoom.in":"Vergr\xF6\xDFern","zoom.out":"Verkleinern","zoom.reset":"Zur\xFCcksetzen","style.stroke":"Rahmen","style.line":"Linie","style.fill":"F\xFCllung","style.text":"Text","style.highlight":"Hervorhebung","style.prefix":"Pr\xE4fix","style.prefix.soon":"Pr\xE4fixsymbole folgen in K\xFCrze","style.none":"Keine","style.addColor":"Farbe hinzuf\xFCgen","style.connection":"Verbindung","style.arrow":"Pfeilspitze","style.dashed":"Gestrichelt","style.solid":"Durchgezogen","style.opacity":"Deckkraft","style.connection.straight":"Gerade","style.connection.polyline":"Abgerundete Polylinie","style.connection.orthogonal":"Rechtwinklig","style.connection.curve":"Kurve","style.arrowhead.none":"Keine","style.arrowhead.end":"Ende","style.arrowhead.start":"Start","style.arrowhead.both":"Beide","style.arrowhead.none-dashed":"Gestrichelt","style.arrowhead.both-dashed":"Gestrichelt beidseitig","style.uml":"UML","style.arrowhead.inheritance":"Vererbung","style.arrowhead.composition":"Komposition","style.arrowhead.aggregation":"Aggregation","style.arrowhead.dependency":"Abh\xE4ngigkeit","style.arrowhead.realization":"Realisierung","menu.title":"Neue Form w\xE4hlen","menu.cancel":"Zum Abbrechen ins Leere klicken","shape.rectangle":"Rechteck","shape.rounded-rectangle":"Abgerundet","shape.circle":"Kreis","shape.ellipse":"Ellipse","shape.diamond":"Raute","shape.triangle":"Dreieck","shape.hexagon":"Sechseck","shape.parallelogram":"Parallelogramm","shape.trapezoid":"Trapez","shape.pentagon":"F\xFCnfeck","shape.octagon":"Achteck","shape.star":"Stern","shape.uml-class":"Klasse","shape.uml-interface":"Schnittstelle","uml.drag":"Zum Sortieren ziehen","uml.delete":"Zeile l\xF6schen","uml.textColor":"Textfarbe","uml.defaultColor":"Standardfarbe","uml.fontSize":"Schriftgr\xF6\xDFe","uml.strikethrough":"Durchgestrichen","uml.attribute":"Attribute","uml.method":"Methoden","minimap.title":"Minikarte","minimap.expand":"Minikarte einblenden","minimap.collapse":"Minikarte ausblenden","tool.mind-map":"Mindmap","toolbar.mind-map":"Mindmap","toolbar.export":"Exportieren","toolbar.export.png":"PNG-Bild","toolbar.export.svg":"SVG-Vektor","toolbar.export.pdf":"PDF-Dokument","toolbar.export.data":"Daten exportieren","toolbar.import.data":"Daten importieren","import.success":"Import erfolgreich: {n} Formen wiederhergestellt","import.fail":"Import fehlgeschlagen: ung\xFCltiges Dateiformat","shape.mind-map":"Mindmap","mindmap.defaultRoot":"Zentrales Thema","mindmap.defaultBranch":"Unterthema","mindmap.nodeText":"Knotentext","mindmap.addChild":"Unterknoten","mindmap.addSibling":"Geschwisterknoten","mindmap.deleteNode":"Knoten l\xF6schen","mindmap.color":"Farbe","mindmap.levelColor":"Standard-Ebenenfarbe","mindmap.icon":"Symbol","mindmap.noIcon":"Kein Symbol","mindmap.note":"Notiz","mindmap.notePlaceholder":"Notizinhalt (optional)","mindmap.noteColor":"Notizfarbe","mindmap.noteColorDefault":"Wie Knoten","mindmap.collapse":"Einklappen","mindmap.expand":"Ausklappen","mindmap.close":"Editor schlie\xDFen","mindmap.more":"Weitere Einstellungen","mindmap.level":"Ebene","mindmap.promote1":"Ebene h\xF6her","mindmap.promote2":"2 Ebenen h\xF6her","mindmap.promoteDisabled":"Bereits oben","tool.table":"Tabelle","toolbar.table":"Tabelle","shape.table":"Tabelle","table.insertRow":"Zeile einf\xFCgen","table.deleteRow":"Zeile l\xF6schen","table.insertCol":"Spalte einf\xFCgen","table.deleteCol":"Spalte l\xF6schen","table.merge":"Zellen verbinden","table.split":"Zelle teilen","table.insertRowAbove":"Zeile dar\xFCber einf\xFCgen","table.insertRowBelow":"Zeile darunter einf\xFCgen","table.insertColLeft":"Spalte links einf\xFCgen","table.insertColRight":"Spalte rechts einf\xFCgen","table.pickHint":"Zeilen & Spalten w\xE4hlen","ctx.copy":"Kopieren","ctx.paste":"Einf\xFCgen","ctx.duplicate":"Duplizieren","ctx.layer":"Ebene","ctx.bringToFront":"Ganz nach vorn","ctx.bringForward":"Nach vorn","ctx.sendBackward":"Nach hint","ctx.sendToBack":"Ganz nach hint","ctx.copyStyle":"Stil kopieren","ctx.pasteStyle":"Stil einf\xFCgen","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"Drehen","ctx.group":"Gruppieren","ctx.ungroup":"Gruppierung aufheben","ctx.lock":"Sperren","ctx.unlock":"Entsperren","ctx.unlockAll":"Alle entsperren","ctx.delete":"L\xF6schen","toolbar.icon":"Symbole (S)","toolbar.template":"Vorlagen","template.search":"Vorlagen suchen","template.all":"Alle","template.empty":"Keine passende Vorlage","toolbar.image":"Bild","toolbar.more":"Mehr","toolbar.pageTheme":"Seitenthema","pageTheme.light":"Standard","pageTheme.warm":"Warm","pageTheme.gray":"Hellgrau","pageTheme.purple":"Helllila","pageTheme.green":"Hellgr\xFCn","pageTheme.eye-care":"Augenschonend","tool.image":"Bild","image.uploadFailed":"Bild-Upload fehlgeschlagen","image.insertFailed":"Bild konnte nicht eingef\xFCgt werden","image.tooLarge":"Bild \xFCberschreitet das Upload-Limit von 30 MB","image.temporaryInserted":"Tempor\xE4res Bild eingef\xFCgt (kein Upload-Endpunkt konfiguriert, geht beim Neuladen verloren)","image.naturalSize":"Originalgr\xF6\xDFe","icon.search":"Symbole suchen","icon.empty":"Keine passenden Symbole","icon.recent":"Zuletzt verwendet","iconCat.status":"Status","iconCat.number":"Zahlen-Badges","iconCat.tech":"Cloud & Technik","iconCat.chart":"Diagramme","iconCat.office":"Dokumente","iconCat.media":"Medien & Teamarbeit","iconCat.arrow":"Pfeile","iconCat.misc":"H\xE4ufig genutzt","iconCat.emoji":"Emotionen","iconCat.sticker":"Sticker","iconCat.device":"Ger\xE4te","iconCat.weather":"Wetter","iconCat.transport":"Verkehr","iconCat.nature":"Natur","iconCat.building":"Geb\xE4ude","iconCat.medical":"Medizin","iconCat.shopping":"Einkaufen","iconCat.science":"Wissenschaft","iconCat.animal":"Tier","iconCat.time":"Zeit","iconCat.edit":"Bearbeiten","iconCat.food":"Essen","iconCat.communication":"Kommunikation"},"fr-FR":{"save.success":"Enregistr\xE9","save.fail":"\xC9chec de l'enregistrement","tool.select":"Outil de s\xE9lection","tool.hand":"D\xE9placer la vue","tool.rectangle":"Rectangle","tool.rounded-rectangle":"Rectangle arrondi","tool.circle":"Cercle","tool.ellipse":"Ellipse","tool.diamond":"Losange","tool.triangle":"Triangle","tool.hexagon":"Hexagone","tool.parallelogram":"Parall\xE9logramme","tool.trapezoid":"Trap\xE8ze","tool.pentagon":"Pentagone","tool.octagon":"Octogone","tool.star":"\xC9toile","tool.cylinder":"Cylindre","tool.cloud":"Nuage","tool.heart":"C\u0153ur","tool.block-arrow-right":"Fl\xE8che droite","tool.block-arrow-left":"Fl\xE8che gauche","tool.block-arrow-up":"Fl\xE8che haut","tool.block-arrow-down":"Fl\xE8che bas","tool.block-arrow-double":"Double fl\xE8che","tool.right-triangle":"Triangle rectangle","tool.cross":"Croix","tool.speech-rect":"Bulle rectangulaire","tool.speech-round":"Bulle ronde","tool.cube":"Cube","tool.sector":"Secteur","tool.delay":"Forme D","tool.predefined-process":"Processus pr\xE9d\xE9fini","tool.document":"Document","tool.stadium":"Forme stade","tool.class-catalog":"Cat\xE9gorie","tool.envelope":"Enveloppe","tool.checkbox":"Case \xE0 cocher","tool.sticky-note":"Note adh\xE9sive","shape.sticky-note":"Note adh\xE9sive","tool.triangular-pyramid":"Pyramide triangulaire","tool.quadrangular-pyramid":"Pyramide \xE0 base carr\xE9e","tool.cuboid":"Pav\xE9 droit","tool.sphere":"Sph\xE8re","tool.ellipsoid":"Ellipso\xEFde","tool.pie":"Camembert","tool.hollow-pie":"Anneau","class.plain":"Classe","flow.process":"Traitement","flow.step":"\xC9tape","flow.startEnd":"D\xE9but / Fin","flow.decision":"D\xE9cision","flow.data":"Donn\xE9es","flow.manual":"Op\xE9ration manuelle","flow.preparation":"Pr\xE9paration","flow.database":"Base de donn\xE9es","flow.delay":"D\xE9lai","shapeGroup.basic":"De base","shapeGroup.flowchart":"Organigramme","shapeGroup.other":"Autres","shapeGroup.solid":"3D","shapeGroup.uml":"Diagramme de classes","shapeMenu.hint":"Survolez pour voir le nom","tool.chevron":"Chevron","tool.brace-left":"Accolade gauche","tool.brace-right":"Accolade droite","tool.uml-class":"Classe UML","tool.uml-interface":"Interface UML","tool.line":"Ligne","tool.arrow":"Ligne","tool.text":"Texte","tool.draw":"Stylo","tool.pen":"Stylo","tool.highlighter":"Surligneur","tool.eraser":"Gomme","status.none":"Aucune s\xE9lection","status.selected":"{n} formes s\xE9lectionn\xE9es","toolbar.select":"S\xE9lection (V)","toolbar.hand":"D\xE9placer la vue (H)","toolbar.shapes":"Formes","toolbar.grid":"Grille","toolbar.undo":"Annuler (Ctrl+Z)","toolbar.redo":"R\xE9tablir (Ctrl+Maj+Z)","toolbar.arrow":"Fl\xE8che (A)","toolbar.text":"Texte (T)","toolbar.pen":"Stylo","toolbar.highlighter":"Surligneur","toolbar.eraser":"Gomme (E)","toolbar.uml-class":"Classe UML","toolbar.uml-interface":"Interface UML","zoom.in":"Zoom avant","zoom.out":"Zoom arri\xE8re","zoom.reset":"R\xE9initialiser","style.stroke":"Bordure","style.line":"Ligne","style.fill":"Remplissage","style.text":"Texte","style.highlight":"Surlignage","style.prefix":"Pr\xE9fixe","style.prefix.soon":"Les symboles de pr\xE9fixe arrivent bient\xF4t","style.none":"Aucun","style.addColor":"Ajouter une couleur","style.connection":"Connexion","style.arrow":"Pointe de fl\xE8che","style.dashed":"Pointill\xE9","style.solid":"Continu","style.opacity":"Opacit\xE9","style.connection.straight":"Droite","style.connection.polyline":"Polyligne arrondie","style.connection.orthogonal":"Orthogonale","style.connection.curve":"Courbe","style.arrowhead.none":"Aucune","style.arrowhead.end":"Fin","style.arrowhead.start":"D\xE9but","style.arrowhead.both":"Les deux","style.arrowhead.none-dashed":"Pointill\xE9","style.arrowhead.both-dashed":"Pointill\xE9 double","style.uml":"UML","style.arrowhead.inheritance":"H\xE9ritage","style.arrowhead.composition":"Composition","style.arrowhead.aggregation":"Agr\xE9gation","style.arrowhead.dependency":"D\xE9pendance","style.arrowhead.realization":"R\xE9alisation","menu.title":"Choisir une nouvelle forme","menu.cancel":"Cliquez dans le vide pour annuler","shape.rectangle":"Rectangle","shape.rounded-rectangle":"Arrondi","shape.circle":"Cercle","shape.ellipse":"Ellipse","shape.diamond":"Losange","shape.triangle":"Triangle","shape.hexagon":"Hexagone","shape.parallelogram":"Parall\xE9logramme","shape.trapezoid":"Trap\xE8ze","shape.pentagon":"Pentagone","shape.octagon":"Octogone","shape.star":"\xC9toile","shape.uml-class":"Classe","shape.uml-interface":"Interface","uml.drag":"Glisser pour r\xE9ordonner","uml.delete":"Supprimer la ligne","uml.textColor":"Couleur du texte","uml.defaultColor":"Couleur par d\xE9faut","uml.fontSize":"Taille de police","uml.strikethrough":"Barr\xE9","uml.attribute":"Attributs","uml.method":"M\xE9thodes","minimap.title":"Mini-carte","minimap.expand":"D\xE9velopper la mini-carte","minimap.collapse":"R\xE9duire la mini-carte","tool.mind-map":"Carte mentale","toolbar.mind-map":"Carte mentale","toolbar.export":"Exporter","toolbar.export.png":"Image PNG","toolbar.export.svg":"Vecteur SVG","toolbar.export.pdf":"Document PDF","toolbar.export.data":"Exporter les donn\xE9es","toolbar.import.data":"Importer les donn\xE9es","import.success":"Import r\xE9ussi : {n} formes restaur\xE9es","import.fail":"\xC9chec de l'import : format de fichier invalide","shape.mind-map":"Carte mentale","mindmap.defaultRoot":"Sujet central","mindmap.defaultBranch":"Sous-sujet","mindmap.nodeText":"Texte du n\u0153ud","mindmap.addChild":"N\u0153ud enfant","mindmap.addSibling":"N\u0153ud fr\xE8re","mindmap.deleteNode":"Supprimer le n\u0153ud","mindmap.color":"Couleur","mindmap.levelColor":"Couleur de niveau par d\xE9faut","mindmap.icon":"Ic\xF4ne","mindmap.noIcon":"Aucune ic\xF4ne","mindmap.note":"Note","mindmap.notePlaceholder":"Contenu de la note (facultatif)","mindmap.noteColor":"Couleur de la note","mindmap.noteColorDefault":"Comme le n\u0153ud","mindmap.collapse":"R\xE9duire","mindmap.expand":"D\xE9velopper","mindmap.close":"Fermer l'\xE9diteur","mindmap.more":"Plus de r\xE9glages","mindmap.level":"Niveau","mindmap.promote1":"Monter","mindmap.promote2":"Monter de 2","mindmap.promoteDisabled":"D\xE9j\xE0 en haut","tool.table":"Tableau","toolbar.table":"Tableau","shape.table":"Tableau","table.insertRow":"Ins\xE9rer une ligne","table.deleteRow":"Supprimer la ligne","table.insertCol":"Ins\xE9rer une colonne","table.deleteCol":"Supprimer la colonne","table.merge":"Fusionner les cellules","table.split":"Scinder la cellule","table.insertRowAbove":"Ins\xE9rer une ligne au-dessus","table.insertRowBelow":"Ins\xE9rer une ligne en dessous","table.insertColLeft":"Ins\xE9rer une colonne \xE0 gauche","table.insertColRight":"Ins\xE9rer une colonne \xE0 droite","table.pickHint":"Choisir lignes et colonnes","ctx.copy":"Copier","ctx.paste":"Coller","ctx.duplicate":"Dupliquer","ctx.layer":"Calque","ctx.bringToFront":"Premier plan","ctx.bringForward":"Vers l'avant","ctx.sendBackward":"Vers l'arri\xE8re","ctx.sendToBack":"Arri\xE8re-plan","ctx.copyStyle":"Copier le style","ctx.pasteStyle":"Coller le style","ctx.rotate90":"90\xB0","ctx.rotate180":"180\xB0","ctx.rotate270":"270\xB0","ctx.rotate":"Pivoter","ctx.group":"Grouper","ctx.ungroup":"Dissocier","ctx.lock":"Verrouiller","ctx.unlock":"D\xE9verrouiller","ctx.unlockAll":"Tout d\xE9verrouiller","ctx.delete":"Supprimer","toolbar.icon":"Ic\xF4nes (S)","toolbar.template":"Mod\xE8les","template.search":"Rechercher un mod\xE8le","template.all":"Tout","template.empty":"Aucun mod\xE8le correspondant","toolbar.image":"Image","toolbar.more":"Plus","toolbar.pageTheme":"Th\xE8me de page","pageTheme.light":"D\xE9faut","pageTheme.warm":"Chaud","pageTheme.gray":"Gris clair","pageTheme.purple":"Violet clair","pageTheme.green":"Vert clair","pageTheme.eye-care":"Protecteur","tool.image":"Image","image.uploadFailed":"\xC9chec de l'envoi de l'image","image.insertFailed":"\xC9chec de l'insertion de l'image","image.tooLarge":"L'image d\xE9passe la limite d'envoi de 30 Mo","image.temporaryInserted":"Image temporaire ins\xE9r\xE9e (aucun point d'envoi configur\xE9, elle sera perdue au rechargement)","image.naturalSize":"Taille d\u2019origine","icon.search":"Rechercher une ic\xF4ne","icon.empty":"Aucune ic\xF4ne correspondante","icon.recent":"R\xE9cemment utilis\xE9s","iconCat.status":"Statut","iconCat.number":"Badges num\xE9rot\xE9s","iconCat.tech":"Cloud et technique","iconCat.chart":"Graphiques","iconCat.office":"Documents","iconCat.media":"M\xE9dias et collaboration","iconCat.arrow":"Fl\xE8ches","iconCat.misc":"Essentiels","iconCat.emoji":"\xC9motions","iconCat.sticker":"Autocollants","iconCat.device":"Appareils","iconCat.weather":"M\xE9t\xE9o","iconCat.transport":"Transport","iconCat.nature":"Nature","iconCat.building":"B\xE2timent","iconCat.medical":"M\xE9dical","iconCat.shopping":"Shopping","iconCat.science":"Science","iconCat.animal":"Animal","iconCat.time":"Temps","iconCat.edit":"\xC9dition","iconCat.food":"Nourriture","iconCat.communication":"Communication"}},Kt="zh-CN",Yn=new Set;function Yt(r){Kt!==r&&(Kt=r,Yn.forEach(e=>e()));}function rr(){return Kt}function sr(r){return Yn.add(r),()=>Yn.delete(r)}function le(r,e){let i=Ji[Kt][r]??Ji["zh-CN"][r];if(e)for(let[n,o]of Object.entries(e))i=i.replace(new RegExp(`\\{${n}\\}`,"g"),String(o));return i}function Ne(r){let e=r.visibility??"",t=(r.name??"").trim(),i=(r.type??"").trim();if(!t&&!i)return "";let n=`${t}${i?`: ${i}`:""}`;return e?`${e} ${n}`:n}function xe(r){let e=r.visibility??"",t=(r.name??"").trim(),i=(r.params??"").trim(),n=(r.returnType??"").trim();if(!t&&!i&&!n)return "";let o=`${t}(${i})${n?`: ${n}`:""}`;return e?`${e} ${o}`:o}var Zn=["#ef4444","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899"],Ce=14,ar=40,lr=80,cr=240;var pt=9,hr=12;var Ze=["right","left","up","down"];function ce(r){return r==="right"||r==="left"}function Xe(r){return r==="right"||r==="down"?1:-1}function Z(r,e="right"){return r.direction??e}function Be(r,e){return r.color??Zn[e%Zn.length]}function Qi(r){let e=r.text||"",t=0;for(let n of e)t+=/[\u2e80-\u9fff\uf900-\ufaff\uff00-\uffef\u3000-\u303f]/.test(n)?1:.6;let i=Math.max(80,Math.min(240,Math.ceil(t*14)+24));return r.icon&&(i+=26),{width:i,height:40}}function Xt(r){let e={...r};return r.children&&(e.children=r.children.map(t=>Xt(t))),e}function je(r,e,t){if(r.id===e)return {...r,...t};let i=r.children??[],n=i.map(o=>je(o,e,t));return n.some((o,s)=>o!==i[s])?{...r,children:n}:r}function jn(r,e,t){if(r.id===e)return {...r,children:[...r.children??[],t],collapsed:false};let i=r.children??[],n=i.map(o=>jn(o,e,t));return n.some((o,s)=>o!==i[s])?{...r,children:n}:r}function qn(r,e,t){let i=r.children??[];for(let n=0;n<i.length;n++){if(i[n].id===e){let s=[...i];return s.splice(n+1,0,t),{...r,children:s}}let o=qn(i[n],e,t);if(o!==i[n])return {...r,children:i.map(s=>s===i[n]?o:s)}}return r}function Zt(r,e){if(r.id===e)return null;let t=r.children??[],i=t.map(n=>Zt(n,e)).filter(n=>n!==null);return i.length!==t.length||i.some((n,o)=>n!==t[o])?{...r,children:i}:r}function W(r,e){if(r.id===e)return r;for(let t of r.children??[]){let i=W(t,e);if(i)return i}return null}function jt(r,e){if(r.id===e)return 0;for(let t of r.children??[]){let i=jt(t,e);if(i!==-1)return i+1}return -1}function qe(r,e){for(let t of r.children??[]){if(t.id===e)return r;let i=qe(t,e);if(i)return i}return null}function eo(r){let e=1;for(let t of r.children??[])e+=eo(t);return e}function dr(r){let e=new Map;for(let t of Ze)e.set(t,[]);for(let t of r.children??[]){let i=t.direction??"right";e.get(i).push(t);}return e}function to(r,e){e.set(r.id,Qi(r));for(let t of r.children??[])to(t,e);}function N(r){let e=new Map;to(r,e);let t=new Map,i=new Map,n=S=>e.get(S),o=(S,w)=>{let C=Z(S,w),v=`${S.id}:${C}`,k=i.get(v);if(k)return k;let P=n(S.id);if(S.collapsed)return i.set(v,P),P;let E=S.children??[];if(E.length===0)return i.set(v,P),P;let U=E.map(fe=>o(fe,C)),ae;if(ce(C)){let fe=U.reduce((O,te)=>O+te.height,0)+16*(E.length-1),ye=Math.max(...U.map(O=>O.width));ae={width:P.width+48+ye,height:Math.max(P.height,fe)};}else {let fe=U.reduce((O,te)=>O+te.width,0)+16*(E.length-1),ye=Math.max(...U.map(O=>O.height));ae={width:Math.max(P.width,fe),height:P.height+48+ye};}return i.set(v,ae),ae},s=(S,w,C,v,k)=>{let P=Z(S,w),E=n(S.id);if(t.set(S.id,{x:v,y:k,depth:C,width:E.width,height:E.height,direction:P}),S.collapsed)return;let U=S.children??[];if(U.length!==0)if(ce(P)){let ae=v+Xe(P)*(E.width/2+48),fe=U.reduce((O,te)=>O+o(te,P).height,0)+16*(U.length-1),ye=k-fe/2;for(let O of U){let te=Z(O,P),ct=o(O,te),vn=n(O.id);s(O,te,C+1,ae+Xe(te)*vn.width/2,ye+ct.height/2),ye+=ct.height+16;}}else {let ae=k+Xe(P)*(E.height/2+48),fe=U.reduce((O,te)=>O+o(te,P).width,0)+16*(U.length-1),ye=v-fe/2;for(let O of U){let te=Z(O,P),ct=o(O,te),vn=n(O.id);s(O,te,C+1,ye+ct.width/2,ae+Xe(te)*vn.height/2),ye+=ct.width+16;}}},a=n(r.id);t.set(r.id,{x:0,y:0,depth:0,width:a.width,height:a.height,direction:"right"});let l=dr(r);for(let S of Ze){let w=l.get(S);if(w.length!==0)if(ce(S)){let v=-(w.reduce((k,P)=>k+o(P,S).height,0)+16*(w.length-1))/2;for(let k of w){let P=o(k,S),E=n(k.id);s(k,S,1,Xe(S)*(a.width/2+48+E.width/2),v+P.height/2),v+=P.height+16;}}else {let v=-(w.reduce((k,P)=>k+o(P,S).width,0)+16*(w.length-1))/2;for(let k of w){let P=o(k,S),E=n(k.id);s(k,S,1,v+P.width/2,Xe(S)*(a.height/2+48+E.height/2)),v+=P.width+16;}}}let c=new Map,h=(S,w)=>{let C=S.offset,v={dx:w.dx+(C?.dx??0),dy:w.dy+(C?.dy??0)};c.set(S.id,v);for(let k of S.children??[])h(k,v);};h(r,{dx:0,dy:0}),t.forEach((S,w)=>{let C=c.get(w);C&&(S.x+=C.dx,S.y+=C.dy);});let d=1/0,u=-1/0,p=1/0,g=-1/0;t.forEach(S=>{d=Math.min(d,S.x-S.width/2),u=Math.max(u,S.x+S.width/2),p=Math.min(p,S.y-S.height/2),g=Math.max(g,S.y+S.height/2);});let m=(d+u)/2,f=(p+g)/2;t.forEach(S=>{S.x-=m,S.y-=f;});let b=1/0,x=-1/0,I=1/0,T=-1/0;return t.forEach(S=>{b=Math.min(b,S.x-S.width/2),x=Math.max(x,S.x+S.width/2),I=Math.min(I,S.y-S.height/2),T=Math.max(T,S.y+S.height/2);}),{positions:t,width:x-b,height:T-I}}function qt(r,e){return e==="right"?{x:r.x+r.width/2+10,y:r.y}:e==="left"?{x:r.x-r.width/2-10,y:r.y}:e==="down"?{x:r.x,y:r.y+r.height/2+10}:{x:r.x,y:r.y-r.height/2-10}}function no(r,e,t){let i=!!(r.children&&r.children.length>0),n=e.direction,o=i?16:0,s=[];if(t)for(let a of Ze)s.push(Xn(a,e,o));else {s.push(Xn(n,e,o));let a=ce(n)?"down":"right";s.push(Xn(a,e,0,"sibling"));}return s}function Xn(r,e,t,i="child"){let n=18+t;return r==="right"?{kind:i,direction:r,x:e.x+e.width/2+n,y:e.y}:r==="left"?{kind:i,direction:r,x:e.x-e.width/2-n,y:e.y}:r==="down"?{kind:i,direction:r,x:e.x,y:e.y+e.height/2+n}:{kind:i,direction:r,x:e.x,y:e.y-e.height/2-n}}function Jn(r,e){let t=W(r,e);if(!t)return [];let i=N(r).positions.get(e);return i?no(t,i,t.id===r.id):[]}function Qn(r,e,t,i){let o=s=>{let a=e.get(s.id);if(a)for(let l of no(s,a,s===r)){let c=t-l.x,h=i-l.y;if(c*c+h*h<=144)return {nodeId:s.id,kind:l.kind,direction:l.direction}}if(!s.collapsed)for(let l of s.children??[]){let c=o(l);if(c)return c}return null};return o(r)}function _e(r,e){let t=qe(r,e);if(!t)return null;let i=W(r,e);if(!i)return null;let n=t===r?i.direction??"right":Z(i,Z(t)),o;t===r?o=(t.children??[]).filter(a=>Z(a,"right")===n):o=t.children??[];let s=o.findIndex(a=>a.id===e);return s===-1?null:{parent:t,siblings:o,index:s,direction:n}}function ei(r,e,t){let i=_e(r,e);if(!i)return r;let{parent:n,siblings:o,index:s,direction:a}=i;if(t<0&&(t=0),t>o.length-1&&(t=o.length-1),t===s)return r;let l=[...o],[c]=l.splice(s,1);if(l.splice(t,0,c),n!==r)return je(r,n.id,{children:l});let h=[],d=0;for(let u of r.children??[])Z(u,"right")===a?h.push(l[d++]):h.push(u);return {...r,children:h}}function ti(r,e,t){let i=oo(r,e);if(!i)return r;let n=i.length-1;if(n<t+1)return r;let o=i[n-1-t],s=i[n-t],a=W(r,e);if(!a)return r;let l=a;if(!l.direction&&o===r.id){let h=W(r,s),d=h?Z(h):Z(a,"right");l={...l,direction:d};}let c=ro(r,e);return c===r?r:so(c,o,s,l)}function ni(r,e,t,i,n){if(e===r.id||e===t)return r;let o=W(r,e);if(!o||t!==r.id&&W(o,t))return r;let s=Zt(r,e);if(!s)return r;let a=t===r.id,l;return a?l={...o,direction:i}:(l={...o},delete l.direction),io(s,t,i,n,l)}function ur(r,e,t){let i=0;for(let o=0;o<r.length;o++)if(Z(r[o],"right")===e){if(i===t)return o;i++;}let n=-1;for(let o=0;o<r.length;o++)Z(r[o],"right")===e&&(n=o);return n===-1?r.length:n+1}function io(r,e,t,i,n){if(r.id===e){let s=r.children??[],a=ur(s,t,Math.max(0,i)),l=[...s];return l.splice(a,0,n),{...r,children:l}}let o=r.children??[];for(let s=0;s<o.length;s++){let a=o[s];if(a.id===e){let c=[...a.children??[]],h=Math.max(0,Math.min(i,c.length));return c.splice(h,0,n),{...r,children:o.map((d,u)=>u===s?{...a,children:c}:d)}}let l=io(a,e,t,i,n);if(l!==a)return {...r,children:o.map((c,h)=>h===s?l:c)}}return r}function oo(r,e,t=[]){let i=[...t,r.id];if(r.id===e)return i;for(let n of r.children??[]){let o=oo(n,e,i);if(o)return o}return null}function ro(r,e){let t=r.children??[];if(t.findIndex(o=>o.id===e)!==-1)return {...r,children:t.filter(o=>o.id!==e)};let n=t.map(o=>ro(o,e));return n.some((o,s)=>o!==t[s])?{...r,children:n}:r}function so(r,e,t,i){if(r.id===e){let s=r.children??[],a=s.findIndex(h=>h.id===t),l=a===-1?s.length:a+1,c=[...s];return c.splice(l,0,i),{...r,children:c}}let n=r.children??[],o=n.map(s=>so(s,e,t,i));return o.some((s,a)=>s!==n[a])?{...r,children:o}:r}var ao=["#fde68a","#fcd34d","#fdba74","#fca5a5","#f9a8d4","#e9d5ff","#c4b5fd","#a5b4fc","#7dd3fc","#a7f3d0","#86efac","#d9f99d"],Jt=ao[0];function ii(r){return typeof r=="string"&&/^#[0-9a-fA-F]{6}$/.test(r.trim())}var re=.2,Je=.85-re/2;function lo(r){return !r||r==="transparent"?r:Kn(r,-0.14)}function co(r,e){return {...r,fillColor:ii(e)?e:Jt,fillOpacity:1,strokeColor:"transparent"}}var ho={color:"#0f172a",opacity:.2,blur:16,offsetX:0,offsetY:5};var gr=[{id:"status",labelKey:"iconCat.status"},{id:"number",labelKey:"iconCat.number"},{id:"emoji",labelKey:"iconCat.emoji"},{id:"sticker",labelKey:"iconCat.sticker"},{id:"device",labelKey:"iconCat.device"},{id:"tech",labelKey:"iconCat.tech"},{id:"chart",labelKey:"iconCat.chart"},{id:"office",labelKey:"iconCat.office"},{id:"media",labelKey:"iconCat.media"},{id:"arrow",labelKey:"iconCat.arrow"},{id:"misc",labelKey:"iconCat.misc"},{id:"weather",labelKey:"iconCat.weather"},{id:"transport",labelKey:"iconCat.transport"},{id:"nature",labelKey:"iconCat.nature"},{id:"building",labelKey:"iconCat.building"},{id:"medical",labelKey:"iconCat.medical"},{id:"shopping",labelKey:"iconCat.shopping"},{id:"science",labelKey:"iconCat.science"},{id:"animal",labelKey:"iconCat.animal"},{id:"time",labelKey:"iconCat.time"},{id:"edit",labelKey:"iconCat.edit"},{id:"food",labelKey:"iconCat.food"},{id:"communication",labelKey:"iconCat.communication"}],y=(r,e)=>({d:r,fill:"none",...e?{w:e}:{}}),gt=(r,e="ink")=>({d:r,fill:e,stroke:"none"}),$=(r,e,t)=>`M${r-t} ${e}A${t} ${t} 0 1 0 ${r+t} ${e}A${t} ${t} 0 1 0 ${r-t} ${e}Z`,mr=["#e11d48","#f97316","#eab308","#22c55e","#14b8a6","#0ea5e9","#6366f1","#a855f7","#ec4899","#64748b"],fr=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],yr=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"],br=mr.map((r,e)=>({id:`num-${e}`,cat:"number",zh:`\u6570\u5B57 ${e}`,en:`${yr[e]} badge`,kw:`number badge \u6570\u5B57 \u5FBD\u6807 \u5E8F\u53F7 ${fr[e]} ${e}`,layers:[],disc:r,label:{text:String(e),color:"#ffffff",size:13}})),Qe=[{id:"check-circle",cat:"status",zh:"\u901A\u8FC7",en:"Check circle",kw:"check ok success done \u5B8C\u6210 \u5BF9\u52FE \u6210\u529F \u901A\u8FC7 \u6B63\u786E",layers:[y($(12,12,9)),y("M7.6 12.3L10.6 15.3L16.3 8.9")]},{id:"alert-circle",cat:"status",zh:"\u8B66\u544A",en:"Alert circle",kw:"alert warning danger \u8B66\u544A \u6CE8\u610F \u5371\u9669 \u611F\u53F9\u53F7",layers:[y($(12,12,9)),y("M12 7.4V13"),y("M12 16.4H12.01",2.2)]},{id:"question-circle",cat:"status",zh:"\u7591\u95EE",en:"Question circle",kw:"question help faq \u7591\u95EE \u5E2E\u52A9 \u95EE\u53F7",layers:[y($(12,12,9)),y("M9.4 9.4A2.7 2.7 0 0 1 14.7 10C14.7 11.8 12 12.2 12 14"),y("M12 16.6H12.01",2.2)]},{id:"close-circle",cat:"status",zh:"\u5931\u8D25",en:"Close circle",kw:"close fail error cancel \u5931\u8D25 \u5173\u95ED \u9519\u8BEF \u53C9",layers:[y($(12,12,9)),y("M9.2 9.2L14.8 14.8"),y("M14.8 9.2L9.2 14.8")]},{id:"info-circle",cat:"status",zh:"\u4FE1\u606F",en:"Info circle",kw:"info note tip \u4FE1\u606F \u63D0\u793A \u8BF4\u660E",layers:[y($(12,12,9)),y("M12 11V16.4"),y("M12 7.6H12.01",2.2)]},{id:"star",cat:"status",zh:"\u661F\u6807",en:"Star",kw:"star favorite bookmark \u661F \u6536\u85CF \u6807\u8BB0 \u91CD\u70B9",layers:[y("M12 3.4L14.7 8.9L20.7 9.8L16.3 14L17.4 20L12 17.1L6.6 20L7.7 14L3.3 9.8L9.3 8.9Z")]},{id:"flag",cat:"status",zh:"\u65D7\u6807",en:"Flag",kw:"flag mark milestone \u65D7\u5E1C \u6807\u8BB0 \u91CC\u7A0B\u7891",layers:[y("M5.5 20.5V4"),y("M5.5 5H16.5L14.8 8.6L16.5 12.2H5.5")]},{id:"heart",cat:"status",zh:"\u559C\u6B22",en:"Heart",kw:"heart like love \u5FC3 \u559C\u6B22 \u70B9\u8D5E \u6536\u85CF",layers:[y("M12 20.2C12 20.2 4.8 15.6 4.8 10.4A4 4 0 0 1 12 7.7A4 4 0 0 1 19.2 10.4C19.2 15.6 12 20.2 12 20.2Z")]},...br,{id:"cloud",cat:"tech",zh:"\u4E91",en:"Cloud",kw:"cloud saas \u4E91 \u670D\u52A1 \u8BA1\u7B97 \u5929\u6C14",layers:[y("M7 18.5H16.6A3.6 3.6 0 0 0 17.1 11.3A5.4 5.4 0 0 0 6.8 9.9A4 4 0 0 0 7 18.5Z")]},{id:"cloud-up",cat:"tech",zh:"\u4E91\u4E0A\u4F20",en:"Cloud upload",kw:"cloud upload sync \u4E91 \u4E0A\u4F20 \u540C\u6B65 \u5BFC\u5165",layers:[y("M7 18.5H16.6A3.6 3.6 0 0 0 17.1 11.3A5.4 5.4 0 0 0 6.8 9.9A4 4 0 0 0 7 18.5Z"),y("M12 17V11.4"),y("M9.8 13.6L12 11.4L14.2 13.6")]},{id:"cloud-down",cat:"tech",zh:"\u4E91\u4E0B\u8F7D",en:"Cloud download",kw:"cloud download \u4E91 \u4E0B\u8F7D \u5BFC\u51FA \u62C9\u53D6",layers:[y("M7 18.5H16.6A3.6 3.6 0 0 0 17.1 11.3A5.4 5.4 0 0 0 6.8 9.9A4 4 0 0 0 7 18.5Z"),y("M12 11.2V17"),y("M9.8 14.8L12 17L14.2 14.8")]},{id:"server",cat:"tech",zh:"\u670D\u52A1\u5668",en:"Server",kw:"server host machine \u670D\u52A1\u5668 \u4E3B\u673A \u673A\u623F \u5B9E\u4F8B",layers:[y("M4 5H20V10H4Z"),y("M4 14H20V19H4Z"),y("M7.6 7.5H7.61",2.2),y("M7.6 16.5H7.61",2.2),y("M11 7.5H16.5"),y("M11 16.5H16.5")]},{id:"database",cat:"tech",zh:"\u6570\u636E\u5E93",en:"Database",kw:"database db storage mysql \u6570\u636E\u5E93 \u5B58\u50A8 \u8868 \u6570\u636E",layers:[y("M4 6.4C4 5 7.6 3.9 12 3.9C16.4 3.9 20 5 20 6.4C20 7.8 16.4 8.9 12 8.9C7.6 8.9 4 7.8 4 6.4Z"),y("M4 6.4V17.6C4 19 7.6 20.1 12 20.1C16.4 20.1 20 19 20 17.6V6.4"),y("M4 12C4 13.4 7.6 14.5 12 14.5C16.4 14.5 20 13.4 20 12")]},{id:"chip",cat:"tech",zh:"\u82AF\u7247",en:"Chip",kw:"chip cpu gpu ai \u82AF\u7247 \u5904\u7406\u5668 \u7B97\u529B \u6A21\u578B",layers:[y("M8 8H16V16H8Z"),y("M12 4V8"),y("M12 16V20"),y("M4 12H8"),y("M16 12H20"),y("M10 4V8"),y("M14 4V8"),y("M10 16V20"),y("M14 16V20"),y("M4 10H8"),y("M4 14H8"),y("M16 10H20"),y("M16 14H20")]},{id:"terminal",cat:"tech",zh:"\u547D\u4EE4\u884C",en:"Terminal",kw:"terminal shell cli code \u547D\u4EE4\u884C \u7EC8\u7AEF \u547D\u4EE4 ssh",layers:[y("M4 5H20V19H4Z"),y("M7.6 9.4L10.2 12L7.6 14.6"),y("M13 14.8H16.6")]},{id:"globe",cat:"tech",zh:"\u7F51\u7EDC",en:"Network",kw:"network internet globe cdn \u7F51\u7EDC \u5168\u7403 \u4E92\u8054\u7F51 \u62D3\u6251",layers:[y($(12,12,8.6)),y("M3.4 12H20.6"),y("M12 3.4C14.4 5.7 15.6 8.7 15.6 12C15.6 15.3 14.4 18.3 12 20.6C9.6 18.3 8.4 15.3 8.4 12C8.4 8.7 9.6 5.7 12 3.4Z")]},{id:"shield",cat:"tech",zh:"\u5B89\u5168",en:"Shield",kw:"shield security safe privacy \u5B89\u5168 \u9632\u62A4 \u76FE \u52A0\u5BC6 \u5408\u89C4",layers:[y("M12 3.4L19 6V12C19 16 16 19.2 12 20.6C8 19.2 5 16 5 12V6Z"),y("M9 12.2L11.2 14.4L15.2 9.9")]},{id:"bar-chart",cat:"chart",zh:"\u67F1\u72B6\u56FE",en:"Bar chart",kw:"bar chart column \u67F1\u72B6 \u56FE\u8868 \u7EDF\u8BA1 \u6570\u636E",layers:[y("M4.5 20H19.5"),y("M7.5 20V11.5"),y("M12 20V5.5"),y("M16.5 20V14")]},{id:"line-chart",cat:"chart",zh:"\u6298\u7EBF\u56FE",en:"Line chart",kw:"line chart trend \u6298\u7EBF \u8D8B\u52BF \u589E\u957F \u56FE\u8868",layers:[y("M4.5 4.5V19.5H19.5"),y("M7.5 15.6L11 11.4L14 13.9L18.4 8")]},{id:"pie-chart",cat:"chart",zh:"\u997C\u56FE",en:"Pie chart",kw:"pie chart share \u997C\u56FE \u5360\u6BD4 \u4EFD\u989D \u56FE\u8868",layers:[y($(12,12,8.6)),y("M12 12V3.4"),y("M12 12L19.4 16.2")]},{id:"gauge",cat:"chart",zh:"\u4EEA\u8868\u76D8",en:"Gauge",kw:"gauge dashboard monitor \u4EEA\u8868\u76D8 \u76D1\u63A7 \u6027\u80FD \u6C34\u4F4D",layers:[y("M3.6 17.6A8.8 8.8 0 0 1 20.4 17.6"),y("M12 17.6L15.8 12.4"),y("M12 5.6V7.4"),y("M5.6 8.4L6.9 9.7"),y("M18.4 8.4L17.1 9.7")]},{id:"table",cat:"chart",zh:"\u6570\u636E\u8868",en:"Table",kw:"table grid sheet data \u8868\u683C \u6570\u636E \u7F51\u683C \u660E\u7EC6",layers:[y("M4 5H20V19H4Z"),y("M4 9.8H20"),y("M9.6 5V19"),y("M15.2 9.8V19")]},{id:"funnel",cat:"chart",zh:"\u6F0F\u6597",en:"Funnel",kw:"funnel filter convert \u6F0F\u6597 \u8F6C\u5316 \u7B5B\u9009 \u6D41\u7A0B",layers:[y("M4 5H20L14 12.2V18.6L10 16.6V12.2Z")]},{id:"target",cat:"chart",zh:"\u76EE\u6807",en:"Target",kw:"target goal okr kpi \u76EE\u6807 \u9776\u5FC3 \u6307\u6807 \u5B8C\u6210\u5EA6",layers:[y($(12,12,8.6)),y($(12,12,4.6)),gt($(12,12,1.5))]},{id:"trend-up",cat:"chart",zh:"\u589E\u957F",en:"Trend up",kw:"growth up increase kpi \u589E\u957F \u4E0A\u5347 \u63D0\u5347 \u4E0A\u6DA8",layers:[y("M4 17.5L9.2 12.2L12.6 15.4L20 7.8"),y("M15.4 7.8H20V12.4")]},{id:"doc",cat:"office",zh:"\u6587\u6863",en:"Document",kw:"doc file page \u6587\u6863 \u6587\u4EF6 \u9875\u9762 \u62A5\u544A \u9700\u6C42",layers:[y("M6.5 3.5H13.5L17.5 7.5V20.5H6.5Z"),y("M13.4 3.6V7.6H17.4"),y("M9.5 12.5H14.5"),y("M9.5 16H14.5")]},{id:"sheet",cat:"office",zh:"\u8868\u683C",en:"Spreadsheet",kw:"excel sheet cell \u8868\u683C \u5355\u5143\u683C \u62A5\u8868 \u8BA1\u7B97",layers:[y("M6.5 3.5H13.5L17.5 7.5V20.5H6.5Z"),y("M13.4 3.6V7.6H17.4"),y("M9.5 11.5H14.5M9.5 15H14.5M9.5 18.2H12.5")]},{id:"slide",cat:"office",zh:"\u6F14\u793A",en:"Slide",kw:"slide ppt presentation \u6F14\u793A \u5E7B\u706F\u7247 ppt \u6C47\u62A5",layers:[y("M4 5H20V15.5H4Z"),y("M12 15.5V19"),y("M8.8 20.5H15.2")]},{id:"folder",cat:"office",zh:"\u6587\u4EF6\u5939",en:"Folder",kw:"folder directory \u6587\u4EF6\u5939 \u76EE\u5F55 \u5F52\u6863 \u9879\u76EE",layers:[y("M4 6.5H9.6L11.6 9H20V19H4Z")]},{id:"mail",cat:"office",zh:"\u90AE\u4EF6",en:"Mail",kw:"mail email message \u90AE\u4EF6 \u6D88\u606F \u901A\u77E5 \u90AE\u7BB1",layers:[y("M3.5 6H20.5V18H3.5Z"),y("M3.7 6.4L12 12.6L20.3 6.4")]},{id:"calendar",cat:"office",zh:"\u65E5\u5386",en:"Calendar",kw:"calendar date schedule \u65E5\u5386 \u65E5\u7A0B \u65E5\u671F \u6392\u671F",layers:[y("M4 6.5H20V19.5H4Z"),y("M4 10.8H20"),y("M8.4 3.8V7.4"),y("M15.6 3.8V7.4"),y("M8 14.4H10.4")]},{id:"clipboard",cat:"office",zh:"\u526A\u8D34\u677F",en:"Clipboard",kw:"clipboard copy paste \u526A\u8D34\u677F \u590D\u5236 \u7C98\u8D34 \u6E05\u5355",layers:[y("M7.5 5H5.5V20.5H18.5V5H16.5"),y("M9.5 3.5H14.5V6.6H9.5Z"),y("M8.6 12H15.4"),y("M8.6 16H13")]},{id:"paperclip",cat:"office",zh:"\u9644\u4EF6",en:"Attachment",kw:"attach paperclip file \u9644\u4EF6 \u4E0A\u4F20 \u6587\u4EF6 \u9644\u52A0",layers:[y("M16.6 7.4V15.6A4.6 4.6 0 0 1 7.4 15.6V7A2.9 2.9 0 0 1 13.2 7V15.8A1.3 1.3 0 0 1 10.6 15.8V8.2")]},{id:"image",cat:"media",zh:"\u56FE\u7247",en:"Image",kw:"image photo picture \u56FE\u7247 \u7167\u7247 \u56FE \u76F8\u518C",layers:[y("M4 5H20V19H4Z"),y($(9,9.8,1.7)),y("M4.4 16.8L9 12.2L12.6 15.6L15.4 12.8L19.6 17")]},{id:"video",cat:"media",zh:"\u89C6\u9891",en:"Video",kw:"video movie play \u89C6\u9891 \u5F71\u7247 \u64AD\u653E \u5F55\u5236",layers:[y("M4 6.5H14.6V17.5H4Z"),y("M14.6 10.6L20 7.8V16.2L14.6 13.4Z")]},{id:"mic",cat:"media",zh:"\u9EA6\u514B\u98CE",en:"Microphone",kw:"mic voice audio record \u9EA6\u514B\u98CE \u8BED\u97F3 \u5F55\u97F3 \u97F3\u9891",layers:[y("M12 4.2A2.9 2.9 0 0 1 14.9 7.1V11.9A2.9 2.9 0 0 1 9.1 11.9V7.1A2.9 2.9 0 0 1 12 4.2Z"),y("M6.4 11.5A5.6 5.6 0 0 0 17.6 11.5"),y("M12 17.1V20.4")]},{id:"camera",cat:"media",zh:"\u6444\u50CF\u5934",en:"Camera",kw:"camera photo live \u6444\u50CF\u5934 \u62CD\u7167 \u76F4\u64AD \u4F1A\u8BAE",layers:[y("M4 7.5H7.8L9.3 5H14.7L16.2 7.5H20V19.5H4Z"),y($(12,13.4,3.3))]},{id:"chat",cat:"media",zh:"\u5BF9\u8BDD",en:"Chat",kw:"chat message comment \u5BF9\u8BDD \u8BC4\u8BBA \u6D88\u606F \u6C9F\u901A \u53CD\u9988",layers:[y("M4.5 5.5H19.5V15.5H11L7 19.5V15.5H4.5Z")]},{id:"user",cat:"media",zh:"\u6210\u5458",en:"User",kw:"user person member \u7528\u6237 \u6210\u5458 \u4EBA \u8D26\u53F7 \u8D1F\u8D23\u4EBA",layers:[y($(12,8.4,3.7)),y("M5.4 20.4C6 16.7 8.7 14.6 12 14.6C15.3 14.6 18 16.7 18.6 20.4")]},{id:"users",cat:"media",zh:"\u6210\u5458\u7EC4",en:"User group",kw:"users team group \u56E2\u961F \u7FA4\u7EC4 \u6210\u5458 \u7EC4\u7EC7 \u534F\u4F5C",layers:[y($(9.6,8.6,3.1)),y("M3.6 19.8C4.1 16.8 6.4 15 9.6 15C12.8 15 15.1 16.8 15.6 19.8"),y("M16.4 6A3.1 3.1 0 0 1 16.4 11.2"),y("M17.6 15.2C19.5 15.8 20.7 17.4 21 19.8")]},{id:"bell",cat:"media",zh:"\u901A\u77E5",en:"Bell",kw:"bell notification alert \u901A\u77E5 \u63D0\u9192 \u6D88\u606F \u544A\u8B66",layers:[y("M6.6 16.6V11.4A5.4 5.4 0 0 1 17.4 11.4V16.6L19 19.4H5L6.6 16.6Z"),y("M10.2 19.6A1.9 1.9 0 0 0 13.8 19.6")]},{id:"arrow-up",cat:"arrow",zh:"\u5411\u4E0A",en:"Arrow up",kw:"up arrow top \u4E0A \u5411\u4E0A \u7BAD\u5934 \u4E0A\u5347",layers:[y("M12 20.5V4"),y("M6 10L12 4L18 10")]},{id:"arrow-down",cat:"arrow",zh:"\u5411\u4E0B",en:"Arrow down",kw:"down arrow bottom \u4E0B \u5411\u4E0B \u7BAD\u5934 \u4E0B\u964D",layers:[y("M12 3.5V20"),y("M6 14L12 20L18 14")]},{id:"arrow-left",cat:"arrow",zh:"\u5411\u5DE6",en:"Arrow left",kw:"left arrow back \u5DE6 \u5411\u5DE6 \u7BAD\u5934 \u8FD4\u56DE",layers:[y("M20.5 12H4"),y("M10 6L4 12L10 18")]},{id:"arrow-right",cat:"arrow",zh:"\u5411\u53F3",en:"Arrow right",kw:"right arrow next \u53F3 \u5411\u53F3 \u7BAD\u5934 \u524D\u8FDB",layers:[y("M3.5 12H20"),y("M14 6L20 12L14 18")]},{id:"refresh",cat:"arrow",zh:"\u5237\u65B0",en:"Refresh",kw:"refresh reload retry \u5237\u65B0 \u91CD\u8BD5 \u91CD\u65B0\u52A0\u8F7D",layers:[y("M19.6 12A7.6 7.6 0 1 1 17 6.1"),y("M19.9 4.2V8.4H15.7")]},{id:"sync",cat:"arrow",zh:"\u53CC\u5411\u540C\u6B65",en:"Sync",kw:"sync exchange swap \u540C\u6B65 \u4EA4\u6362 \u53CC\u5411 \u4E92\u8F6C",layers:[y("M4 9.2H19L15.6 5.8"),y("M20 14.8H5L8.4 18.2")]},{id:"upload",cat:"arrow",zh:"\u4E0A\u4F20",en:"Upload",kw:"upload import push \u4E0A\u4F20 \u5BFC\u5165 \u53D1\u5E03 \u63D0\u4EA4",layers:[y("M12 16.5V4.6"),y("M7.4 9.2L12 4.6L16.6 9.2"),y("M4.5 20H19.5")]},{id:"download",cat:"arrow",zh:"\u4E0B\u8F7D",en:"Download",kw:"download export pull \u4E0B\u8F7D \u5BFC\u51FA \u62C9\u53D6 \u4FDD\u5B58",layers:[y("M12 4V15.9"),y("M7.4 11.3L12 15.9L16.6 11.3"),y("M4.5 20H19.5")]},{id:"bulb",cat:"misc",zh:"\u60F3\u6CD5",en:"Idea",kw:"idea bulb tip \u60F3\u6CD5 \u521B\u610F \u63D0\u793A \u8981\u70B9 \u7075\u611F",layers:[y("M8.8 15.6A6 6 0 1 1 15.2 15.6V17.4H8.8Z"),y("M9.8 20.2H14.2")]},{id:"settings",cat:"misc",zh:"\u8BBE\u7F6E",en:"Settings",kw:"settings config option \u8BBE\u7F6E \u914D\u7F6E \u53C2\u6570 \u9009\u9879",layers:[y("M4 7.5H20"),y("M4 12H20"),y("M4 16.5H20"),y($(9,7.5,1.9)),y($(15.4,12,1.9)),y($(8,16.5,1.9))]},{id:"key",cat:"misc",zh:"\u5BC6\u94A5",en:"Key",kw:"key token secret \u5BC6\u94A5 \u4EE4\u724C \u6743\u9650 \u5BC6\u7801",layers:[y($(8.6,8.6,4.6)),y("M11.9 11.9L20 20"),y("M15.6 15.6L17.6 13.6"),y("M18 18L20 16")]},{id:"lock",cat:"misc",zh:"\u9501\u5B9A",en:"Lock",kw:"lock secure private \u9501 \u52A0\u5BC6 \u79C1\u6709 \u5B89\u5168",layers:[y("M6.4 10.6H17.6V20.4H6.4Z"),y("M9.2 10.6V7.8A2.8 2.8 0 0 1 14.8 7.8V10.6")]},{id:"eye",cat:"misc",zh:"\u67E5\u770B",en:"Eye",kw:"eye view preview \u67E5\u770B \u9884\u89C8 \u53EF\u89C1 \u89C2\u5BDF",layers:[y("M2.8 12C2.8 12 6.6 6.4 12 6.4C17.4 6.4 21.2 12 21.2 12C21.2 12 17.4 17.6 12 17.6C6.6 17.6 2.8 12 2.8 12Z"),y($(12,12,2.6))]},{id:"lightning",cat:"misc",zh:"\u9AD8\u6548",en:"Lightning",kw:"fast flash speed \u95EA\u7535 \u5FEB\u901F \u9AD8\u6548 \u6027\u80FD",layers:[y("M13.6 2.8L6 13.6H10.8L10.4 21.2L18 10.4H13.2Z")]},{id:"pin",cat:"misc",zh:"\u5B9A\u4F4D",en:"Location",kw:"location pin map \u5B9A\u4F4D \u4F4D\u7F6E \u5730\u56FE \u5730\u5740",layers:[y("M12 21C12 21 18.6 15.1 18.6 10.4A6.6 6.6 0 0 0 5.4 10.4C5.4 15.1 12 21 12 21Z"),y($(12,10.4,2.5))]},{id:"link",cat:"misc",zh:"\u94FE\u63A5",en:"Link",kw:"link url chain \u94FE\u63A5 \u7F51\u5740 \u5F15\u7528 \u8DF3\u8F6C",layers:[y("M10.4 13.6A4.2 4.2 0 0 0 16.4 13.6L19.2 10.8A4.2 4.2 0 0 0 13.2 4.8L11.8 6.2"),y("M13.6 10.4A4.2 4.2 0 0 0 7.6 10.4L4.8 13.2A4.2 4.2 0 0 0 10.8 19.2L12.2 17.8")]},{id:"device-desktop",cat:"device",zh:"\u53F0\u5F0F\u7535\u8111",en:"Desktop",kw:"desktop monitor computer pc \u53F0\u5F0F \u7535\u8111 \u663E\u793A\u5668 \u5C4F\u5E55 \u8BA1\u7B97\u673A",layers:[y("M4.5 4.5H19.5V15.5H4.5Z"),y("M12 15.5V19.3"),y("M8.2 19.5H15.8")]},{id:"device-laptop",cat:"device",zh:"\u7B14\u8BB0\u672C",en:"Laptop",kw:"laptop notebook computer \u7B14\u8BB0\u672C \u4FBF\u643A \u7535\u8111 \u7B14\u8BB0\u672C\u7535\u8111",layers:[y("M6.5 5H17.5V14.5H6.5Z"),y("M8.5 14.5L7.4 17.5"),y("M15.5 14.5L16.6 17.5"),y("M4.5 17.5H19.5")]},{id:"device-phone",cat:"device",zh:"\u624B\u673A",en:"Phone",kw:"phone mobile smartphone \u624B\u673A \u79FB\u52A8 \u7535\u8BDD \u82F9\u679C \u5B89\u5353",layers:[y("M8 3.5H16A1.6 1.6 0 0 1 17.6 5.1V18.9A1.6 1.6 0 0 1 16 20.5H8A1.6 1.6 0 0 1 6.4 18.9V5.1A1.6 1.6 0 0 1 8 3.5Z"),y("M10.4 17.6H13.6")]},{id:"device-tablet",cat:"device",zh:"\u5E73\u677F",en:"Tablet",kw:"tablet ipad \u5E73\u677F \u57AB\u5B50 \u89E6\u5C4F",layers:[y("M5.5 4.5H18.5A1.6 1.6 0 0 1 20.1 6.1V17.9A1.6 1.6 0 0 1 18.5 19.5H5.5A1.6 1.6 0 0 1 3.9 17.9V6.1A1.6 1.6 0 0 1 5.5 4.5Z"),gt($(12,16.8,1))]},{id:"device-keyboard",cat:"device",zh:"\u952E\u76D8",en:"Keyboard",kw:"keyboard typing \u952E\u76D8 \u6253\u5B57 \u8F93\u5165 \u5916\u8BBE",layers:[y("M3.5 7H20.5V17H3.5Z"),y("M6.3 10H6.31",2.2),y("M9.1 10H9.11",2.2),y("M11.9 10H11.91",2.2),y("M14.7 10H14.71",2.2),y("M17.5 10H17.51",2.2),y("M8 14.2H16")]},{id:"device-mouse",cat:"device",zh:"\u9F20\u6807",en:"Mouse",kw:"mouse click \u9F20\u6807 \u70B9\u51FB \u6EDA\u8F6E \u5916\u8BBE",layers:[y("M12 3.5C15.3 3.5 17 5.7 17 8.9V14.1C17 17.3 15.3 20.5 12 20.5C8.7 20.5 7 17.3 7 14.1V8.9C7 5.7 8.7 3.5 12 3.5Z"),y("M12 3.5V8.8"),y("M7 8.8H17")]},{id:"device-printer",cat:"device",zh:"\u6253\u5370\u673A",en:"Printer",kw:"printer print \u6253\u5370\u673A \u6253\u5370 \u590D\u5370 \u8F93\u51FA",layers:[y("M7.5 7.5V3.5H16.5V7.5"),y("M4.5 7.5H19.5V14.5H4.5Z"),y("M8 14.5V20.5H16V14.5"),y("M17.2 10.2H17.21",2.2)]},{id:"device-headset",cat:"device",zh:"\u8033\u673A",en:"Headset",kw:"headset headphone earphone \u8033\u673A \u901A\u8BDD \u5BA2\u670D \u8BED\u97F3",layers:[y("M4.5 13.4V12A7.5 7.5 0 0 1 19.5 12V13.4"),y("M4.5 12.4H6.6A1.6 1.6 0 0 1 8.2 14V16.8A1.6 1.6 0 0 1 6.6 18.4H6.1A1.6 1.6 0 0 1 4.5 16.8Z"),y("M19.5 12.4H17.4A1.6 1.6 0 0 0 15.8 14V16.8A1.6 1.6 0 0 0 17.4 18.4H17.9A1.6 1.6 0 0 0 19.5 16.8Z")]},{id:"device-router",cat:"device",zh:"\u8DEF\u7531\u5668",en:"Router",kw:"router wifi network \u8DEF\u7531\u5668 \u65E0\u7EBF \u7F51\u7EDC \u4FE1\u53F7 \u4E0A\u7F51",layers:[y("M4 13.5H20V19.5H4Z"),y("M7.5 13.5V6"),y("M16.5 13.5V6"),y("M7 16.5H7.01",2.2),y("M10.2 16.5H10.21",2.2)]},{id:"device-usb",cat:"device",zh:"\u4F18\u76D8",en:"USB drive",kw:"usb disk drive \u4F18\u76D8 U\u76D8 \u5B58\u50A8 \u95EA\u5B58 \u63D2\u5165",layers:[y("M9.5 3.5H14.5V8H9.5Z"),y("M8.5 8H15.5V17A3.5 3.5 0 0 1 12 20.5A3.5 3.5 0 0 1 8.5 17Z"),y("M11 5.5H11.01",2.2),y("M13 5.5H13.01",2.2)]},{id:"device-wifi",cat:"device",zh:"\u65E0\u7EBF\u7F51\u7EDC",en:"Wi-Fi",kw:"wifi wireless signal \u65E0\u7EBF \u7F51\u7EDC \u4FE1\u53F7 wifi \u70ED\u70B9",layers:[y("M3.8 9.6C8.2 5.2 15.8 5.2 20.2 9.6"),y("M6.6 12.7C9.6 9.7 14.4 9.7 17.4 12.7"),y("M9.4 15.7C10.8 14.3 13.2 14.3 14.6 15.7"),gt($(12,18.5,1.35))]},{id:"device-battery",cat:"device",zh:"\u7535\u91CF",en:"Battery",kw:"battery power charge \u7535\u91CF \u7535\u6C60 \u5145\u7535 \u80FD\u91CF",layers:[y("M3.5 8.5H18.5V15.5H3.5Z"),y("M20.5 10.5V13.5",2.2),gt("M6 10.4H8.7V13.6H6Z"),gt("M10.3 10.4H13V13.6H10.3Z")]}],mt=new Map(Qe.map(r=>[r.id,r])),uo=false,Ve=null;function xr(){return uo}function po(){return Ve||(Ve=import('./icons-catalog-TDWDJPEW.js').then(r=>{for(let e of r.CATALOG_ICONS)mt.has(e.id)||(Qe.push(e),mt.set(e.id,e));uo=true;}).catch(r=>{throw Ve=null,r}),Ve)}async function ft(r){if(Ve)return Ve;let e=false;for(let t of r)if(!mt.has(t)){e=true;break}e&&await po();}function $e(r){return mt.get(r)}function oi(r){return mt.has(r)}function wr(r){return Qe.filter(e=>e.cat===r)}function Sr(r){let e=r.trim().toLowerCase();if(!e)return Qe;let t=e.split(/\s+/),i=o=>{let s=`${o.zh} ${o.en} ${o.kw??""}`.toLowerCase();return t.every(a=>s.includes(a))},n=o=>`${o.zh} ${o.en}`.toLowerCase().includes(e);return Qe.filter(i).sort((o,s)=>Number(n(s))-Number(n(o)))}var ri=48,go="star",K=24,yt="#3b82f6",mo={status:"#f59e0b",number:"#ef4444",emoji:"#ec4899",sticker:"#f43f5e",device:"#64748b",tech:"#0ea5e9",chart:"#6366f1",office:"#2563eb",media:"#8b5cf6",arrow:"#14b8a6",misc:"#94a3b8",weather:"#06b6d4",transport:"#0d9488",nature:"#22c55e",building:"#78716c",medical:"#e11d48",shopping:"#db2777",science:"#7c3aed",animal:"#a16207",time:"#0891b2",edit:"#475569",food:"#ea580c",communication:"#16a34a"};function si(r){return r.ink??mo[r.cat]??yt}var xt=14,we=10,wt=4,et=1.3,Mr=10,ai=40,li=24,Oe=140,ze=36;var ci="#f1f3f5",Qt="#d9dce1",en="#1f2937",Cr=18,Ir=22,Tr=4;function Ie(r,e){let t=e.x-r.x,i=e.y-r.y,n=Math.cos(r.rotation),o=Math.sin(r.rotation);return {x:t*n+i*o+r.width/2,y:-t*o+i*n+r.height/2}}function vr(r,e){let t=e.x-r.width/2,i=e.y-r.height/2,n=Math.cos(r.rotation),o=Math.sin(r.rotation);return {x:r.x+t*n-i*o,y:r.y+t*o+i*n}}function tn(r,e){let t=18/e,i=22/e,n=4/e;return {x:-r.width/2-n-t,y:-r.height/2+2/e,width:t,height:i}}function tt(r,e,t,i=3){let n=Ie(r,e),o={x:n.x-r.width/2,y:n.y-r.height/2},s=tn(r,t),a=i/t;return o.x>=s.x-a&&o.x<=s.x+s.width+a&&o.y>=s.y-a&&o.y<=s.y+s.height+a}function kr(r,e,t=0){let i=Ie(r,e);return i.x>=-t&&i.x<=r.width+t&&i.y>=-t&&i.y<=r.height+t}function St(r,e){let t=r.cells[0]?.length??0,i=r.cells.length,n=t-1,o=0;for(let a=0;a<t;a++)if(o+=r.colWidths[a]??140,e.x<o){n=a;break}e.x<=0&&(n=0);let s=i-1;o=0;for(let a=0;a<i;a++)if(o+=r.rowHeights[a]??36,e.y<o){s=a;break}return e.y<=0&&(s=0),{row:Math.max(0,s),col:Math.max(0,n)}}function hi(r,e,t,i,n){let o=Math.min(e,i),s=Math.max(e,i),a=Math.min(t,n),l=Math.max(t,n),c=r.colWidths.slice(0,a).reduce((p,g)=>p+g,0),h=r.rowHeights.slice(0,o).reduce((p,g)=>p+g,0),d=r.colWidths.slice(a,l+1).reduce((p,g)=>p+g,0),u=r.rowHeights.slice(o,s+1).reduce((p,g)=>p+g,0);return {x:c-r.width/2,y:h-r.height/2,width:d,height:u}}function nt(r){return r.reduce((e,t)=>e+t,0)}function it(r){return r.reduce((e,t)=>e+t,0)}function Mt(r,e,t){let i=r*e;return i<=t?t/2-i/2+e/2:4+e/2}function Ct(r,e,t=true){return Array.from({length:r},(i,n)=>Array.from({length:e},()=>n===0&&t?{text:"",bold:true,fillColor:ci}:{text:""}))}var Pr=["textColor","fontSize","bold","align","fillColor"];function fo(r){if(!r)return null;let e={},t=false;for(let i of Pr){let n=r[i];n!==void 0&&(e[i]=n,t=true);}return t?e:null}function yo(r,e){return {text:"",...fo(r)??fo(e)??{}}}var bt;function Lr(r,e){return bt===void 0&&(bt=typeof document<"u"?document.createElement("canvas").getContext("2d"):null),bt?(bt.font=e,bt.measureText(r).width):r.length*8}function bo(r,e,t,i){if(!r||i<=0)return 1;let n=`${t?"bold ":""}${e}px sans-serif`,o=0;for(let s of r.split(`
|
|
2
|
+
`)){if(!s){o+=1;continue}let a="",l=0;for(let c of s){let h=a+c;Lr(h,n)>i&&a?(l+=1,a=c):a=h;}a&&(l+=1),o+=Math.max(1,l);}return Math.max(1,o)}function di(r){let e=r.cells.length;if(e===0)return null;let t=[...r.rowHeights],i=Ge(r.cells),n=false;for(let o=0;o<e;o++)for(let s=0;s<(r.cells[o]?.length??0);s++){if(i[o]?.[s])continue;let a=r.cells[o][s];if(!a?.text)continue;let l=ie(r,o,s),c=a.fontSize||r.fontSize||14,d=Math.min(10,bo(a.text,c,!!a.bold,l.width-20))*c*1.3+8,u=a.rowSpan??1;if(u>1){let p=t.slice(o,o+u).reduce((g,m)=>g+m,0);p<d&&(t[o+u-1]+=d-p,n=true);}else t[o]<d&&(t[o]=Math.ceil(d),n=true);}return n?t:null}function he(r){return r.map(e=>e.map(t=>({...t})))}function Ar(r){return {...r,colWidths:[...r.colWidths],rowHeights:[...r.rowHeights],cells:he(r.cells)}}function Ge(r){let e=r.length,t=r[0]?.length??0,i=Array.from({length:e},()=>new Array(t).fill(false));for(let n=0;n<e;n++)for(let o=0;o<(r[n]?.length??0);o++){let s=r[n][o],a=s.rowSpan??1,l=s.colSpan??1;if(a>1||l>1)for(let c=n;c<Math.min(n+a,e);c++)for(let h=o;h<Math.min(o+l,r[c]?.length??0);h++)(c!==n||h!==o)&&(i[c][h]=true);}return i}function xo(r){delete r.rowSpan,delete r.colSpan;}function ui(r,e,t,i,n){let o=Math.min(e,i),s=Math.max(e,i),a=Math.min(t,n),l=Math.max(t,n);if(o===s&&a===l)return r;let c=he(r);for(let u=0;u<c.length;u++)for(let p=0;p<(c[u]?.length??0);p++){let g=c[u][p],m=g.rowSpan??1,f=g.colSpan??1;(m>1||f>1)&&u<=s&&u+m-1>=o&&p<=l&&p+f-1>=a&&xo(g);}let h=c[o][a];h.rowSpan=s-o+1,h.colSpan=l-a+1;let d=[];for(let u=o;u<=s;u++)for(let p=a;p<=l;p++){let m=r[u]?.[p]?.text?.trim();m&&d.push(m);}d.length>0&&(h.text=d.join(`
|
|
3
|
+
`));for(let u=o;u<=s;u++)for(let p=a;p<=l;p++)(u!==o||p!==a)&&(c[u][p]={text:""});return c}function nn(r,e,t){let i=r[e]?.[t];if(!i||!i.rowSpan&&!i.colSpan)return r;let n=he(r);return xo(n[e][t]),n}function pi(r,e,t){let i=r.cells[e]?.[t];if(!i)return {row:e,col:t};if((i.rowSpan??1)>1||(i.colSpan??1)>1)return {row:e,col:t};for(let n=e;n>=0;n--)for(let o=t;o>=0;o--){let s=r.cells[n]?.[o];if(!s)continue;let a=s.rowSpan??1,l=s.colSpan??1;if(!(a===1&&l===1)&&n<=e&&e<=n+a-1&&o<=t&&t<=o+l-1)return {row:n,col:o}}return {row:e,col:t}}function It(r,e,t,i,n){let o=Math.min(e,i),s=Math.max(e,i),a=Math.min(t,n),l=Math.max(t,n),c=true,h=0;for(;c&&h++<32;){c=false;for(let d=0;d<r.cells.length;d++)for(let u=0;u<(r.cells[d]?.length??0);u++){let p=r.cells[d][u],g=p.rowSpan??1,m=p.colSpan??1;if(g===1&&m===1)continue;let f=d+g-1,b=u+m-1;d<=s&&f>=o&&u<=l&&b>=a&&(d<o&&(o=d,c=true),f>s&&(s=f,c=true),u<a&&(a=u,c=true),b>l&&(l=b,c=true));}}return {r1:o,c1:a,r2:s,c2:l}}function Dr(r,e,t,i,n){let o=Math.min(e,i),s=Math.max(e,i),a=Math.min(t,n),l=Math.max(t,n);for(let c=o;c<=s;c++)for(let h=a;h<=l;h++){let d=r.cells[c]?.[h];if(d&&((d.rowSpan??1)>1||(d.colSpan??1)>1))return true}return false}function gi(r,e,t,i,n){let o=Math.min(e,i),s=Math.max(e,i),a=Math.min(t,n),l=Math.max(t,n),c=r.cells,h=false;for(let d=o;d<=s;d++)for(let u=a;u<=l;u++){let p=c[d]?.[u];p&&((p.rowSpan??1)>1||(p.colSpan??1)>1)&&(c=nn(c,d,u),h=true);}return h?c:r.cells}function on(r,e,t){let i=r.length,n=Math.max(0,Math.min(i,t)),o=r[0]?.length??0,s=he(r);if(n<i)for(let p=0;p<i;p++)for(let g=0;g<(s[p]?.length??0);g++){let m=s[p][g],f=m.rowSpan??1;f>1&&p<n&&n<p+f&&(m.rowSpan=f+1);}let a=(()=>{let p=r[0]?.[0];return i>1&&!!p&&(p.bold===true||p.fillColor===ci)})(),l=n===0?0:n-1;l===0&&a&&(l=1);let c=r[l],h=r[Math.min(n,i-1)],d=Array.from({length:o},(p,g)=>yo(c?.[g],h?.[g]));s.splice(n,0,d);let u=[...e];return u.splice(n,0,e[l]??36),{cells:s,rowHeights:u}}function rn(r,e,t){let i=r[0]?.length??0,n=Math.max(0,Math.min(i,t)),o=he(r);for(let c=0;c<o.length;c++){let h=o[c];for(let d=0;d<h.length;d++){let u=h[d],p=u.colSpan??1;p>1&&d<n&&n<d+p&&(u.colSpan=p+1);}}let s=n>0?n-1:0,a=n<i?n:i-1;for(let c=0;c<o.length;c++)o[c].splice(n,0,yo(r[c]?.[s],r[c]?.[a]));let l=[...e];return l.splice(n,0,e[s]??140),{cells:o,colWidths:l}}function sn(r,e,t){let i=r.length;if(i<=1)return null;let n=Math.max(0,Math.min(i-1,t)),o=he(r),s=o[n];for(let l=0;l<(s?.length??0);l++){let c=s[l],h=c.rowSpan??1;h>1&&o[n+1]?.[l]&&(o[n+1][l]={text:c.text,textColor:c.textColor,fontSize:c.fontSize,bold:c.bold,fillColor:c.fillColor,align:c.align,rowSpan:h-1>1?h-1:void 0,colSpan:c.colSpan});}for(let l=0;l<n;l++)for(let c=0;c<(o[l]?.length??0);c++){let h=o[l][c],d=h.rowSpan??1;d>1&&l+d>n&&(h.rowSpan=d-1>1?d-1:void 0);}o.splice(n,1);let a=[...e];return a.splice(n,1),{cells:o,rowHeights:a}}function an(r,e,t){let i=r[0]?.length??0;if(i<=1)return null;let n=Math.max(0,Math.min(i-1,t)),o=he(r);for(let a=0;a<o.length;a++){let l=o[a],c=l[n];if(c){let h=c.colSpan??1;h>1&&l[n+1]&&(l[n+1]={text:c.text,textColor:c.textColor,fontSize:c.fontSize,bold:c.bold,fillColor:c.fillColor,align:c.align,rowSpan:c.rowSpan,colSpan:h-1>1?h-1:void 0});}for(let h=0;h<n;h++){let d=l[h],u=d.colSpan??1;u>1&&h+u>n&&(d.colSpan=u-1>1?u-1:void 0);}l.splice(n,1);}let s=[...e];return s.splice(n,1),{cells:o,colWidths:s}}function ie(r,e,t){let i=r.cells[e]?.[t],n=i?.rowSpan??1,o=i?.colSpan??1,s=r.colWidths.slice(0,t).reduce((h,d)=>h+d,0),a=r.rowHeights.slice(0,e).reduce((h,d)=>h+d,0),l=r.colWidths.slice(t,t+o).reduce((h,d)=>h+d,0),c=r.rowHeights.slice(e,e+n).reduce((h,d)=>h+d,0);return {ox:s,oy:a,width:l,height:c}}function mi(r,e,t){if(e<0||t<0||e>r.width||t>r.height)return null;let i=Ge(r.cells),n=-1,o=0;for(let a=0;a<r.rowHeights.length;a++)if(o+=r.rowHeights[a],t<o){n=a;break}n===-1&&(n=r.rowHeights.length-1);let s=-1;o=0;for(let a=0;a<r.colWidths.length;a++)if(o+=r.colWidths[a],e<o){s=a;break}if(s===-1&&(s=r.colWidths.length-1),i[n]?.[s])for(let a=0;a<=n;a++)for(let l=0;l<=s;l++){let c=r.cells[a]?.[l],h=c?.rowSpan??1,d=c?.colSpan??1;if((h>1||d>1)&&a+h>n&&l+d>s)return {row:a,col:l}}return {row:n,col:s}}var Hr={strokeColor:"#1f2937",fillColor:"#f8fafc",fillOpacity:.9,strokeWidth:2,strokeDash:null},yi={rectangle:{width:120,height:60},"rounded-rectangle":{width:120,height:60,borderRadius:8},circle:{width:80,height:80},ellipse:{width:100,height:70},diamond:{width:100,height:80},triangle:{width:100,height:90},hexagon:{width:100,height:90},parallelogram:{width:120,height:60},trapezoid:{width:120,height:70},pentagon:{width:100,height:90},octagon:{width:100,height:90},star:{width:100,height:100},cylinder:{width:100,height:110},cloud:{width:140,height:90},heart:{width:100,height:95},"block-arrow-right":{width:140,height:80},"block-arrow-left":{width:140,height:80},"block-arrow-up":{width:80,height:140},"block-arrow-down":{width:80,height:140},"block-arrow-double":{width:150,height:80},"right-triangle":{width:100,height:90},cross:{width:90,height:90},"speech-rect":{width:130,height:92},"speech-round":{width:130,height:92},cube:{width:110,height:110},sector:{width:100,height:100},delay:{width:120,height:80},"predefined-process":{width:130,height:80},document:{width:120,height:90},stadium:{width:130,height:60},"class-catalog":{width:160,height:90},chevron:{width:110,height:80},"brace-left":{width:220,height:120},"brace-right":{width:220,height:120},envelope:{width:120,height:84},checkbox:{width:90,height:90},"triangular-pyramid":{width:100,height:100},"quadrangular-pyramid":{width:110,height:110},cuboid:{width:150,height:90},sphere:{width:100,height:100},ellipsoid:{width:130,height:90},pie:{width:130,height:90},"hollow-pie":{width:130,height:90},"sticky-note":{width:140,height:140},icon:{width:48,height:48},image:{width:320,height:240}},ee=14,V=22,ge=36,ne=14,_=8,bi=160,Rr=["rectangle","rounded-rectangle","circle","ellipse","diamond","triangle","hexagon","parallelogram","trapezoid","pentagon","octagon","star","cylinder","cloud","heart","block-arrow-right","block-arrow-left","block-arrow-up","block-arrow-down","block-arrow-double","right-triangle","cross","speech-rect","speech-round","cube","sector","delay","predefined-process","document","stadium","class-catalog","chevron","brace-left","brace-right","envelope","checkbox","triangular-pyramid","quadrangular-pyramid","cuboid","sphere","ellipsoid","pie","hollow-pie","sticky-note","icon","uml-class","uml-interface","mind-map","table","image"];function ln(r){return Rr.includes(r)}function Te(r,e,t,i,n){let o=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,s=yi[r]||{width:120,height:60},a=n?.width??s.width,l=n?.height??s.height,c=n?n.width/2:s.radius??a/2,h=s.borderRadius??8,d=t??{...Hr};switch(r){case "rounded-rectangle":return {id:o,type:"rounded-rectangle",x:e.x,y:e.y,width:a,height:l,borderRadius:h,rotation:0,style:d};case "circle":return {id:o,type:"circle",x:e.x,y:e.y,radius:c,rotation:0,style:d};case "ellipse":return {id:o,type:"ellipse",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "diamond":return {id:o,type:"diamond",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "triangle":return {id:o,type:"triangle",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "hexagon":return {id:o,type:"hexagon",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "parallelogram":return {id:o,type:"parallelogram",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "trapezoid":return {id:o,type:"trapezoid",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "pentagon":return {id:o,type:"pentagon",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "octagon":return {id:o,type:"octagon",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "star":return {id:o,type:"star",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "icon":return {id:o,type:"icon",iconId:go,x:e.x,y:e.y,width:a,height:l,rotation:0,style:{...d,strokeColor:yt,fillColor:yt,fillOpacity:1}};case "image":return {id:o,type:"image",src:"",x:e.x,y:e.y,width:a,height:l,rotation:0,borderRadius:4,style:{...d,strokeColor:"transparent",fillColor:"#f3f4f6",fillOpacity:1}};case "sticky-note":return {id:o,type:"sticky-note",x:e.x,y:e.y,width:a,height:l,rotation:0,style:co(d,i)};case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":return {id:o,type:r,x:e.x,y:e.y,width:a,height:l,rotation:0,style:d};case "uml-class":{let u="ClassName",p=[{id:`attr_${Date.now()}_1`,visibility:"+",name:"field",type:"string"}],g=[{id:`meth_${Date.now()}_1`,visibility:"+",name:"method",params:"param",returnType:"void"}],{width:m,height:f}=n??hn(u,p,g);return {id:o,type:"uml-class",x:e.x,y:e.y,width:m,height:f,className:u,attributes:p,methods:g,rotation:0,style:{...d,fillColor:"#ffffff"}}}case "uml-interface":{let u="Interface",p=[{id:`meth_${Date.now()}_1`,visibility:"+",name:"method",params:"type",returnType:"type"}],{width:g,height:m}=n??xi(u,p);return {id:o,type:"uml-interface",x:e.x,y:e.y,width:g,height:m,className:u,methods:p,rotation:0,style:{...d,fillColor:"#ffffff"}}}case "mind-map":{let u=f=>`mm_${f}_${Date.now()}_${Math.random().toString(36).substr(2,6)}`,p={id:u("root"),text:le("mindmap.defaultRoot"),children:[{id:u("b1"),text:le("mindmap.defaultBranch")},{id:u("b2"),text:le("mindmap.defaultBranch")},{id:u("b3"),text:le("mindmap.defaultBranch")}]},{width:g,height:m}=N(p);return {id:o,type:"mind-map",x:e.x,y:e.y,width:g,height:m,root:p,rotation:0,style:{...d,fillColor:"#ffffff"}}}case "table":{let u=[140,140,140],p=[36,36,36];return {id:o,type:"table",x:e.x,y:e.y,width:nt(u),height:it(p),colWidths:u,rowHeights:p,cells:Ct(3,3,false),rotation:0,style:{...d,fillColor:"#ffffff",strokeWidth:2}}}default:return {id:o,type:"rectangle",x:e.x,y:e.y,width:a,height:l,rotation:0,style:d}}}var Er=new Set(["table","mind-map"]);function cn(r,e){if(!(!e||e.type!==r)&&!Er.has(r)){if(r==="circle"){let t=e.radius;return typeof t=="number"&&t>0?{width:t*2,height:t*2}:void 0}if("width"in e&&"height"in e){let{width:t,height:i}=e;if(t>0&&i>0)return {width:t,height:i}}}}function hn(r,e,t){let i=ee*.6,n=[r];for(let d of e)n.push(Ne(d));for(let d of t)n.push(xe(d));let s=Math.max(...n.map(d=>d.length),0)*i+ne*2,a=Math.max(bi,s),l=e.length>0?e.length*V+_*2:_*2,c=t.length>0?t.length*V+_*2:_*2,h=ge+l+c;return {width:a,height:h}}function xi(r,e){let t=ee*.6,i=[r,...e.map(a=>xe(a))],n=Math.max(...i.map(a=>a.length),0),o=Math.max(bi,n*t+ne*2),s=e.length>0?e.length*V+_*2:_*2;return {width:o,height:ge+s}}var Nr=new Set(["rectangle","rounded-rectangle","circle","ellipse","diamond","triangle","hexagon","parallelogram","trapezoid","pentagon","octagon","star","cylinder","cloud","heart","block-arrow-right","block-arrow-left","block-arrow-up","block-arrow-down","block-arrow-double","right-triangle","cross","speech-rect","speech-round","cube","sector","delay","predefined-process","document","stadium","class-catalog","chevron","brace-left","brace-right","envelope","checkbox","triangular-pyramid","quadrangular-pyramid","cuboid","sphere","ellipsoid","pie","hollow-pie","sticky-note","icon"]),fi=12,Br=5,A=class extends X{type;pressPoint=null;draftId=null;dragging=false;constructor(e,t){super(e),this.type=t;}onPointerDown(e,t){let i=this.type==="sticky-note"?this.context.getStickyNoteColor():void 0;this.pressPoint=e,this.dragging=false,this.draftId=null;let n=Te(this.type,e,void 0,i);this.context.commitHistory(),this.context.addShape(n),this.context.selectShape(n.id,false),this.draftId=n.id;}onPointerMove(e,t){if(!this.pressPoint||!this.draftId||!Nr.has(this.type))return;let i=e.x-this.pressPoint.x,n=e.y-this.pressPoint.y;if(!this.dragging){let d=this.context.getCamera().getZoom();if(Math.hypot(i,n)*d<Br)return;this.dragging=true;}if(!this.context.getShapes().find(d=>d.id===this.draftId))return;let s=yi[this.type]||{width:120,height:60},a=i===0?0:i<0?-1:1,l=n===0?0:n<0?-1:1;if(this.type==="circle"){let d=Math.max(Math.abs(i),Math.abs(n))/2;this.context.updateShape(this.draftId,{x:this.pressPoint.x+a*d,y:this.pressPoint.y+l*d,radius:Math.max(d,fi/2)});return}let c=Math.abs(i),h=Math.abs(n);if(t.shiftKey){let d=s.height/s.width;c/s.width>=h/(s.width*d)?h=c*d:c=h/d;}c=Math.max(c,fi),h=Math.max(h,fi),this.context.updateShape(this.draftId,{x:this.pressPoint.x+a*c/2,y:this.pressPoint.y+l*h/2,width:c,height:h,...this.type==="rounded-rectangle"?{borderRadius:Math.min(16,(s.borderRadius??8)*Math.max(1,c/s.width))}:{}});}onPointerUp(e,t){this.pressPoint=null,this.draftId=null,this.dragging=false,this.context.setActiveTool("select");}onKeyDown(e){if(e.key==="Escape"&&this.dragging&&this.pressPoint&&this.draftId){let t=yi[this.type]||{width:120,height:60};this.context.getShapes().find(n=>n.id===this.draftId)&&(this.type==="circle"?this.context.updateShape(this.draftId,{x:this.pressPoint.x,y:this.pressPoint.y,radius:t.radius??t.width/2}):this.context.updateShape(this.draftId,{x:this.pressPoint.x,y:this.pressPoint.y,width:t.width,height:t.height,...this.type==="rounded-rectangle"?{borderRadius:t.borderRadius??8}:{}})),this.pressPoint=null,this.draftId=null,this.dragging=false;}}onKeyUp(e){}hasTransientState(){return this.dragging}cancelTransient(){return this.dragging?(this.pressPoint=null,this.draftId=null,this.dragging=false,true):false}getCursor(e){return this.context.getMindMapCursorHitAtPoint(e)?"pointer":"crosshair"}};var wi={n:"top",e:"right",s:"bottom",w:"left"},Tt={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}};function un(r,e,t){return vt(r,e,t?Tt[wi[t]]:void 0)}function vt(r,e,t){let i=e.x-r.x,n=e.y-r.y;return t&&t.x!==0?i>=0?"left":"right":t&&t.y!==0?n>=0?"top":"bottom":Math.abs(i)>=Math.abs(n)?i>=0?"left":"right":n>=0?"top":"bottom"}function wo(r,e,t){switch(t){case "top":return {x:r.x,y:r.y-e.height/2};case "bottom":return {x:r.x,y:r.y+e.height/2};case "left":return {x:r.x-e.width/2,y:r.y};case "right":return {x:r.x+e.width/2,y:r.y}}}function q(r,e,t,i=.5){let n=Math.min(r.x,e.x),o=Math.max(r.x,e.x),s=Math.min(r.y,e.y),a=Math.max(r.y,e.y);return n<t.x+t.width-i&&o>t.x+i&&s<t.y+t.height-i&&a>t.y+i}function dn(r,e,t,i,n){let o=t==="x"?e.x:e.y,s=t==="x"?e.x+e.width:e.y+e.height;if(r>o&&r<s){let a=o-n,l=s+n;return Math.abs(i-a)<=Math.abs(i-l)?a:l}return r}function So(r,e,t,i,n,o){let s=e.x-r.x,a=e.y-r.y;if((Math.abs(s)<1||Math.abs(a)<1)&&!(n?.box&&q(r,e,n.box)||o?.box&&q(r,e,o.box)))return [e];let l=r.x+s/2,c=r.y+a/2,h=(p,g)=>{if(!g)return false;let m=r;for(let f of p){if(q(m,f,g))return true;m=f;}return false},d=p=>{if(!(p==="H"?!!n?.n&&n.n.x!==0&&!!o?.n&&o.n.x!==0:!!n?.n&&n.n.y!==0&&!!o?.n&&o.n.y!==0))return null;let m=[n?.box,o?.box].filter(w=>!!w);if(m.length===0)return null;if(p==="H"){let w=Math.min(r.y,e.y,...m.map(U=>U.y))-i,C=Math.max(r.y,e.y,...m.map(U=>U.y+U.height))+i,v=Math.abs(r.y-w)+Math.abs(e.y-w),k=Math.abs(r.y-C)+Math.abs(e.y-C),P=v<=k?w:C,E=[{x:r.x,y:P},{x:e.x,y:P},e];return h(E,n?.box)||h(E,o?.box)?null:E}let f=Math.min(r.x,e.x,...m.map(w=>w.x))-i,b=Math.max(r.x,e.x,...m.map(w=>w.x+w.width))+i,x=Math.abs(r.x-f)+Math.abs(e.x-f),I=Math.abs(r.x-b)+Math.abs(e.x-b),T=x<=I?f:b,S=[{x:T,y:r.y},{x:T,y:e.y},e];return h(S,n?.box)||h(S,o?.box)?null:S},u=p=>{let g;p==="H"?(g=Math.max(r.x,Math.min(l,e.x)),n?.box&&n.n&&n.n.x!==0&&(n.n.x<0&&g>r.x&&(g=r.x),n.n.x>0&&g<r.x&&(g=r.x)),o?.box&&o.n&&o.n.x!==0&&(o.n.x<0&&g>e.x&&(g=e.x),o.n.x>0&&g<e.x&&(g=e.x)),n?.box&&q({x:g,y:r.y},{x:g,y:e.y},n.box)&&(g=n.n&&n.n.x!==0?r.x:dn(g,n.box,"x",e.x,i)),o?.box&&q({x:g,y:r.y},{x:g,y:e.y},o.box)&&(g=o.n&&o.n.x!==0?e.x:dn(g,o.box,"x",r.x,i)),n?.box&&q(r,{x:g,y:r.y},n.box)?g=r.x:o?.box&&q({x:g,y:e.y},e,o.box)&&(g=e.x)):(g=Math.max(r.y,Math.min(c,e.y)),n?.box&&n.n&&n.n.y!==0&&(n.n.y<0&&g>r.y&&(g=r.y),n.n.y>0&&g<r.y&&(g=r.y)),o?.box&&o.n&&o.n.y!==0&&(o.n.y<0&&g>e.y&&(g=e.y),o.n.y>0&&g<e.y&&(g=e.y)),n?.box&&q({x:r.x,y:g},{x:e.x,y:g},n.box)&&(g=n.n&&n.n.y!==0?r.y:dn(g,n.box,"y",e.y,i)),o?.box&&q({x:r.x,y:g},{x:e.x,y:g},o.box)&&(g=o.n&&o.n.y!==0?e.y:dn(g,o.box,"y",r.y,i)),n?.box&&q(r,{x:r.x,y:g},n.box)?g=r.y:o?.box&&q({x:e.x,y:g},e,o.box)&&(g=e.y));let m=p==="H"?[{x:g,y:r.y},{x:g,y:e.y},e]:[{x:r.x,y:g},{x:e.x,y:g},e],f=!!n?.box&&(q(r,m[0],n.box)||q(m[0],m[1],n.box)||q(m[1],e,n.box))||!!o?.box&&(q(r,m[0],o.box)||q(m[0],m[1],o.box)||q(m[1],e,o.box));return {pts:m,crosses:f}};if(t){let p=u(t);if(p.crosses&&(n?.box||o?.box)){let g=u(t==="H"?"V":"H");if(!g.crosses)return g.pts;let m=d(t);if(m)return m}return p.pts}return Math.abs(s)>=Math.abs(a)?[{x:l,y:r.y},{x:l,y:e.y},e]:[{x:r.x,y:c},{x:e.x,y:c},e]}var Si=24,Mo=.5;function _r(r,e){if(r.length<2)return r;let t=r[r.length-1],i=r[r.length-2],n=Math.abs(t.y-i.y)<1e-6;if(e==="H"?n:!n)return r;let o=e==="H"?{x:i.x,y:t.y}:{x:t.x,y:i.y},s=r.slice(0,-1);return s.push(o,t),s}function kt(r,e={},t=Si,i=r.length===2){if(r.length<2)return r;let n=[];n.push(r[0]);let o=r.length-1,s=t,a=r[0],l=r[o];e.fromN&&e.toN&&(e.fromN.x!==0&&e.toN.x!==0?s=Math.min(s,Math.abs(l.x-a.x)/2):e.fromN.y!==0&&e.toN.y!==0&&(s=Math.min(s,Math.abs(l.y-a.y)/2)));for(let c=1;c<r.length;c++){let h=r[c-1],d=r[c],u=c===1,p=c===o,g=(C,v,k)=>{let P=(v.x-C.x)*k.x+(v.y-C.y)*k.y;return Math.max(0,Math.min(s,P))},m=u&&e.fromN?(()=>{let C=g(h,d,e.fromN);return C>Mo?{x:h.x+e.fromN.x*C,y:h.y+e.fromN.y*C}:h})():h,f=p&&e.toN?(()=>{let C=g(d,h,e.toN);return C>Mo?{x:d.x+e.toN.x*C,y:d.y+e.toN.y*C}:d})():d;u&&e.fromN&&(m.x!==h.x||m.y!==h.y)&&n.push(m);let b=u?e.fromN:void 0,x=p?e.toN:void 0,I=x?x.x!==0?"H":"V":b?b.x!==0?"H":"V":void 0,T=i&&u&&e.fromN&&e.fromBox?{box:e.fromBox,n:e.fromN}:void 0,S=i&&p&&e.toN&&e.toBox?{box:e.toBox,n:e.toN}:void 0,w=So(m,f,I,s,T,S);I&&(w=_r(w,I));for(let C of w)n.push(C);p&&e.toN&&n.push(d);}return Ye(n)}var Mi=14,Ci=200,pn=class extends X{type="eraser";erasing=false;lastPoint=null;erasedIds=new Set;onPointerDown(e){this.erasing=true,this.lastPoint=e,this.erasedIds.clear(),this.context.commitHistory(),this.context.setEraserPoint(e),this.eraseAt(e);}onPointerMove(e){if(!this.erasing||!this.lastPoint)return;let t=this.lastPoint,i=Math.hypot(e.x-t.x,e.y-t.y),n=Math.max(1,Math.ceil(i/Math.max(this.brushRadius()*.5,1)));for(let o=1;o<=n;o++){let s=o/n;this.eraseAt({x:t.x+(e.x-t.x)*s,y:t.y+(e.y-t.y)*s});}this.lastPoint=e,this.context.setEraserPoint(e);}onPointerUp(){this.erasing=false,this.lastPoint=null,this.erasedIds.clear(),this.context.setEraserPoint(null);}onKeyDown(){}onKeyUp(){}getCursor(){return this.erasing?"grabbing":"crosshair"}dispose(){this.erasing=false,this.lastPoint=null,this.erasedIds.clear(),this.context.setEraserPoint(null);}brushRadius(){return Mi/this.context.getCamera().getZoom()}eraseAt(e){let t=this.context.getShapesInBrushRadius(e,this.brushRadius());for(let i of t)this.erasedIds.has(i.id)||(this.erasedIds.add(i.id),this.context.eraseShape(i.id));}};var st=[3,2.2];function de(r,e,t){let i=o=>(o-.5)*e,n=o=>(o-.5)*t;return r.map(o=>o[0]==="Z"?o:o[0]==="M"||o[0]==="L"?[o[0],i(o[1]),n(o[2])]:["C",i(o[1]),n(o[2]),i(o[3]),n(o[4]),i(o[5]),n(o[6])])}function G(r,e,t,i,n,o,s){let a=[],l=o-n,c=Math.max(1,Math.ceil(Math.abs(l)/90)),h=l/c,d=4/3*Math.tan(h*Math.PI/180/4),u=m=>{let f=m*Math.PI/180;return [r+t*Math.cos(f),e+i*Math.sin(f)]},[p,g]=u(n);a.push(s?["M",p,g]:["L",p,g]);for(let m=0;m<c;m++){let f=n+h*m,b=f+h,x=f*Math.PI/180,I=b*Math.PI/180,[T,S]=u(f),[w,C]=u(b);a.push(["C",T-d*t*Math.sin(x),S+d*i*Math.cos(x),w+d*t*Math.sin(I),C-d*i*Math.cos(I),w,C]);}return a}function Vr(r){let e=1/0,t=1/0,i=-1/0,n=-1/0,o=(p,g)=>{p<e&&(e=p),g<t&&(t=g),p>i&&(i=p),g>n&&(n=g);},s=0,a=0,l=0,c=0;for(let p of r){if(p[0]==="Z"){o(l,c);continue}if(p[0]==="M"||p[0]==="L"){s=p[1],a=p[2],p[0]==="M"&&(l=s,c=a),o(s,a);continue}let g=p[1],m=p[2],f=p[3],b=p[4],x=p[5],I=p[6];for(let T=0;T<=12;T++){let S=T/12,w=1-S,C=w*w*w,v=3*w*w*S,k=3*w*S*S,P=S*S*S;o(C*s+v*g+k*f+P*x,C*a+v*m+k*b+P*I);}s=x,a=I;}let h=i-e||1,d=n-t||1,u=(p,g)=>[(p-e)/h,(g-t)/d];return r.map(p=>{if(p[0]==="Z")return p;if(p[0]==="M"||p[0]==="L"){let[T,S]=u(p[1],p[2]);return [p[0],T,S]}let[g,m]=u(p[1],p[2]),[f,b]=u(p[3],p[4]),[x,I]=u(p[5],p[6]);return ["C",g,m,f,b,x,I]})}function $r(){let r={x:.24,y:.7,r:.24},e={x:.5,y:.48,r:.36},t={x:.76,y:.7,r:.24},i=[...G(r.x,r.y,r.r,r.r,90,246,true),...G(e.x,e.y,e.r,e.r,180,360,false),...G(t.x,t.y,t.r,t.r,294,450,false),["Z"]];return Vr(i)}var Q=.14,vi=.5523,ot=Q*vi,Pt=1-Q,rt=.5-.5*vi,Or={outline:[["M",0,Q],["L",0,Pt],["C",0,Pt+ot,rt,1,.5,1],["C",1-rt,1,1,Pt+ot,1,Pt],["L",1,Q],["C",1,Q-ot,1-rt,0,.5,0],["C",rt,0,0,Q-ot,0,Q],["Z"]],seams:[[["M",0,Q],["C",0,Q+ot,rt,Q*2,.5,Q*2],["C",1-rt,Q*2,1,Q+ot,1,Q]]],hiddenSeams:[G(.5,Pt,.5,Q,180,360,true)]},zr={outline:$r()},Gr={outline:[["M",.5,.97],["C",.5,.97,.03,.66,.03,.35],["C",.03,.17,.16,.04,.31,.04],["C",.41,.04,.47,.1,.5,.17],["C",.53,.1,.59,.04,.69,.04],["C",.84,.04,.97,.17,.97,.35],["C",.97,.66,.5,.97,.5,.97],["Z"]]},gn=[["M",0,.25],["L",.58,.25],["L",.58,0],["L",1,.5],["L",.58,1],["L",.58,.75],["L",0,.75],["Z"]];function Ii(r,e){let t=(i,n)=>{switch(e){case "down":return [1-n,i];case "left":return [1-i,1-n];case "up":return [n,1-i];default:return [i,n]}};return r.map(i=>{if(i[0]==="Z")return i;if(i[0]==="M"||i[0]==="L"){let[h,d]=t(i[1],i[2]);return [i[0],h,d]}let[n,o]=t(i[1],i[2]),[s,a]=t(i[3],i[4]),[l,c]=t(i[5],i[6]);return ["C",n,o,s,a,l,c]})}var mn={right:gn,left:Ii(gn,"left"),up:Ii(gn,"up"),down:Ii(gn,"down")},Ur={outline:[["M",0,0],["L",0,1],["L",1,1],["Z"]]},Wr={outline:[["M",.34,0],["L",.66,0],["L",.66,.34],["L",1,.34],["L",1,.66],["L",.66,.66],["L",.66,1],["L",.34,1],["L",.34,.66],["L",0,.66],["L",0,.34],["L",.34,.34],["Z"]]},Fr={outline:[["M",0,.5],["L",.22,.13],["L",.22,.34],["L",.78,.34],["L",.78,.13],["L",1,.5],["L",.78,.87],["L",.78,.66],["L",.22,.66],["L",.22,.87],["Z"]]},Kr={outline:[["M",0,0],["L",1,0],["L",1,.8],["L",.32,.8],["L",.2,1],["L",.15,.8],["L",0,.8],["Z"]]},Yr={outline:[...G(.5,.4,.5,.4,100,-228,true),["L",.19,1],["Z"]]},Co={outline:[["M",.5,0],["L",1,.25],["L",1,.75],["L",.5,1],["L",0,.75],["L",0,.25],["Z"]],seams:[[["M",.5,.5],["L",.5,1]],[["M",.5,.5],["L",0,.25]],[["M",.5,.5],["L",1,.25]]],hiddenSeams:[[["M",.5,.5],["L",.5,0]],[["M",.5,.5],["L",0,.75]],[["M",.5,.5],["L",1,.75]]]},Xr={outline:[...G(.5,.5,.5,.5,0,-270,true),["L",.5,.5],["Z"]]},Zr={outline:[["M",0,0],...G(.6,.5,.4,.5,270,450,false),["L",0,1],["Z"]]},jr={outline:[["M",0,0],["L",1,0],["L",1,1],["L",0,1],["Z"]],seams:[[["M",.12,0],["L",.12,1]],[["M",.88,0],["L",.88,1]]]},qr={outline:[["M",0,0],["L",1,0],["L",1,.84],["C",.72,1.06,.28,.62,0,.84],["Z"]]},Jr={outline:[["M",0,0],["L",1,0],["L",1,1-re],["L",1-re,1],["L",0,1],["Z"]],shadow:ho,overlays:[{cmds:[["M",1-re,1],["L",1-re,1-re],["L",1,1-re],["Z"]],fill:"auto",deriveFill:lo}]},Qr={outline:[["M",0,0],["L",.45,0],["L",1,.5],["L",.45,1],["L",0,1],["L",.42,.5],["Z"]]};function es(r){let e=t=>1-t;return r.map(t=>t[0]==="Z"?t:t[0]==="M"||t[0]==="L"?[t[0],e(t[1]),t[2]]:["C",e(t[1]),t[2],e(t[3]),t[4],e(t[5]),t[6]])}var Lt=.16,To={outline:[["M",.015,.02],["C",.075,.02,.1,.08,.1,.2],["C",.1,.36,.125,.5,.16,.5],["C",.125,.5,.1,.64,.1,.8],["C",.1,.92,.075,.98,.015,.98]],strokeOnly:true},ts={outline:es(To.outline),strokeOnly:true};function yn(r){if(r.type!=="brace-left"&&r.type!=="brace-right")return 0;let e=(r.width??0)*Lt/2;return r.type==="brace-left"?e:-e}var ns={outline:[["M",0,0],["L",1,0],["L",1,1],["L",0,1],["Z"]],seams:[[["M",.1,0],["L",.1,1]],[["M",.9,0],["L",.9,1]]]},is={outline:[["M",0,0],["L",1,0],["L",1,1],["L",0,1],["Z"]],seams:[[["M",0,0],["L",1,1]],[["M",1,0],["L",0,1]]]},J=.12,ve=J*vi,os={outline:[["M",J,0],["L",1-J,0],["C",1-J+ve,0,1,ve,1,J],["L",1,1-J],["C",1,1-J+ve,1-J+ve,1,1-J,1],["L",J,1],["C",J-ve,1,0,1-J+ve,0,1-J],["L",0,J],["C",0,J-ve,J-ve,0,J,0],["Z"]],seams:[[["M",.26,.53],["L",.43,.72],["L",.77,.29]]]},rs={outline:[["M",.5,.03],["L",.94,.75],["L",.5,.97],["L",.06,.75],["Z"]],seams:[[["M",.5,.03],["L",.5,.97]]],hiddenSeams:[[["M",.06,.75],["L",.94,.75]]]},ss={outline:[["M",.5,.03],["L",.96,.74],["L",.5,.97],["L",.04,.74],["Z"]],seams:[[["M",.5,.03],["L",.5,.97]]],hiddenSeams:[[["M",.5,.51],["L",.04,.74]],[["M",.5,.51],["L",.96,.74]]]},as={outline:G(.5,.5,.5,.5,0,360,true),seams:[G(.5,.5,.5,Q,0,180,true)],hiddenSeams:[G(.5,.5,.5,Q,180,360,true)]},Se=.5,me=.35,ke=.3,j=me;function Io(r){let e=r*Math.PI/180;return [["M",.5,j],["L",.5+Se*Math.cos(e),j+me*Math.sin(e)]]}var ls={outline:[...G(.5,j,Se,me,180,0,true),["L",1,j+ke],...G(.5,j+ke,Se,me,0,180,false),["L",0,j],["Z"]],seams:[G(.5,j,Se,me,180,360,true),Io(300),Io(120)],hiddenSeams:[G(.5,j+ke,Se,me,180,360,true)]},fn=.2,Ti=.14,cs={outline:[...G(.5,j,Se,me,180,0,true),["L",1,j+ke],...G(.5,j+ke,Se,me,0,180,false),["L",0,j],["Z"],...G(.5,j,fn,Ti,0,180,true),["L",.5-fn,j+ke],...G(.5,j+ke,fn,Ti,180,0,false),["Z"]],seams:[G(.5,j,Se,me,180,360,true),G(.5,j,fn,Ti,180,360,true)],hiddenSeams:[G(.5,j+ke,Se,me,180,360,true)]};function At(r){switch(r){case "cylinder":return Or;case "envelope":return is;case "checkbox":return os;case "cuboid":return Co;case "triangular-pyramid":return rs;case "quadrangular-pyramid":return ss;case "sphere":case "ellipsoid":return as;case "pie":return ls;case "hollow-pie":return cs;case "cloud":return zr;case "heart":return Gr;case "class-catalog":return ns;case "block-arrow-right":return {outline:mn.right};case "block-arrow-left":return {outline:mn.left};case "block-arrow-up":return {outline:mn.up};case "block-arrow-down":return {outline:mn.down};case "block-arrow-double":return Fr;case "right-triangle":return Ur;case "cross":return Wr;case "speech-rect":return Kr;case "speech-round":return Yr;case "cube":return Co;case "sector":return Xr;case "delay":return Zr;case "predefined-process":return jr;case "document":return qr;case "sticky-note":return Jr;case "chevron":return Qr;case "brace-left":return To;case "brace-right":return ts;default:return}}function hs(r){if(r.length===0)return null;if(r.length===1)return r[0];let e=0;for(let n=1;n<r.length;n++)e+=Math.hypot(r[n].x-r[n-1].x,r[n].y-r[n-1].y);let t=0,i=e/2;for(let n=1;n<r.length;n++){let o=r[n-1],s=r[n],a=Math.hypot(s.x-o.x,s.y-o.y);if(t+a>=i&&a>1e-6){let l=(i-t)/a;return {x:o.x+(s.x-o.x)*l,y:o.y+(s.y-o.y)*l}}t+=a;}return r[r.length-1]}var Ue=class r{ctx;width=0;height=0;dpr=window.devicePixelRatio||1;showGrid=false;textLayoutCache=new Map;tableSelection=null;setTableSelection(e){this.tableSelection=e;}hoverShapeId=null;multiSelection=false;static TEXT_CACHE_LIMIT=500;constructor(e,t){let i=e.getContext("2d");if(!i)throw new Error("Failed to get Canvas 2D context");this.ctx=i,typeof t=="number"&&t>0&&(this.dpr=t);}resize(e,t){let i=Math.max(1,Math.round(e*this.dpr)/this.dpr),n=Math.max(1,Math.round(t*this.dpr)/this.dpr);this.width=i,this.height=n;let o=Math.round(i*this.dpr),s=Math.round(n*this.dpr);(this.ctx.canvas.width!==o||this.ctx.canvas.height!==s)&&(this.ctx.canvas.width=o,this.ctx.canvas.height=s,this.ctx.canvas.style.width=`${i}px`,this.ctx.canvas.style.height=`${n}px`);}setShowGrid(e){this.showGrid=e;}render(e,t,i,n,o,s,a,l,c,h,d,u,p,g,m){let f=this.ctx,b=t.getZoom(),x=t.x,I=t.y;this.hoverShapeId=p??null,f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),f.setLineDash([]),f.lineCap="butt",f.lineJoin="miter",f.globalAlpha=1,u&&(f.fillStyle=u,f.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height));let T=this.dpr*b;f.setTransform(T,0,0,T,T*x,T*I),this.showGrid&&this.drawGrid(f,b,x,I);let S=null;for(let C of e)if(C.type==="arrow"&&(C.startBinding||C.endBinding)){S=new Map,e.forEach(v=>S.set(v.id,v));break}let w=S??new Map;this.multiSelection=i.size>1,e.forEach(C=>{f.save();let v=m?.get(C.id);v!==void 0&&(f.globalAlpha=f.globalAlpha*Math.max(0,Math.min(1,v))),f.translate(C.x,C.y),f.rotate(C.rotation),(C.flipX||C.flipY)&&f.scale(C.flipX?-1:1,C.flipY?-1:1);let k=i.has(C.id);this.drawShape(f,C,k,b,w,c,h,d),f.restore();}),i.size>0&&this.drawGroupFrames(f,e,i,b),this.multiSelection&&this.drawMultiSelectionBounds(f,e,i,b);for(let C of this.visibleLockBadges(e,i,b))this.drawLockBadgeAt(f,C.x,C.y,b);if(a&&this.drawGenerationPreview(f,a,b,e,w),p&&!i.has(p)){let C=e.find(v=>v.id===p);C&&this.drawConnectionDots(f,this.getShapeWorldBounds(C),b,.6);}if(g&&!i.has(g)){let C=e.find(v=>v.id===g);if(C){let v=this.getConnectorRoute(C,w);v.length>=2&&this.drawLinearHighlight(f,v,b,.22,9);}}n&&this.drawBrushRect(f,n,b),o&&o.length>0&&this.drawSnapGuides(f,o,b),s&&this.drawConnectingTargetHighlight(f,s,e,b),l&&this.drawEraserBrush(f,l,b),f.setTransform(1,0,0,1,0,0);}drawEraserBrush(e,t,i){let n=Mi/i;e.beginPath(),e.arc(t.x,t.y,n,0,Math.PI*2),e.fillStyle=z(H.primary,.12),e.fill(),e.strokeStyle=z(H.primary,.55),e.lineWidth=1.5/i,e.stroke();}drawConnectingTargetHighlight(e,t,i,n){let o=i.find(c=>c.id===t);if(!o||o.type==="line"||o.type==="arrow"||o.type==="draw")return;let s=this.getShapeWorldBounds(o),a=[{x:s.x+s.width/2,y:s.y},{x:s.x+s.width,y:s.y+s.height/2},{x:s.x+s.width/2,y:s.y+s.height},{x:s.x,y:s.y+s.height/2}],l=6/n;e.save(),a.forEach(c=>{e.beginPath(),e.arc(c.x,c.y,l,0,Math.PI*2),e.fillStyle=H.selection.handleFill,e.fill(),e.strokeStyle=H.primary,e.lineWidth=2/n,e.stroke();}),e.restore();}getShapeWorldBounds(e){let t=this.getShapeBounds(e);return {x:e.x+t.x,y:e.y+t.y,width:t.width,height:t.height}}drawBrushRect(e,t,i){e.save(),e.fillStyle=H.brushFill,e.strokeStyle=H.brushStroke,e.lineWidth=1.5/i,e.setLineDash([4/i,4/i]),e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.fill(),e.stroke(),e.restore();}drawGrid(e,t,i,n){let o=-i,s=-n,a=o+this.width/t,l=s+this.height/t,c=20;for(;c*t<10;)c*=2;let h=this.dpr*t,d=Math.max(1,Math.round(c*h)),u=(b,x)=>(b%x+x)%x,p=u(Math.round(i*h),d)+.5,g=u(Math.round(n*h),d)+.5,m=this.width*this.dpr,f=this.height*this.dpr;e.strokeStyle=H.grid,e.lineWidth=1/h,e.setLineDash([]),e.beginPath();for(let b=p;b<=m;b+=d){let x=b/h-i;e.moveTo(x,s),e.lineTo(x,l);}for(let b=g;b<=f;b+=d){let x=b/h-n;e.moveTo(o,x),e.lineTo(a,x);}e.stroke();}drawShape(e,t,i,n,o,s,a,l){switch(this.applyStyle(e,t.style,n),t.type){case "rectangle":this.drawRectangle(e,t,i);break;case "rounded-rectangle":this.drawRoundedRectangle(e,t,i);break;case "circle":this.drawCircle(e,t,i);break;case "ellipse":this.drawEllipse(e,t,i);break;case "diamond":this.drawDiamond(e,t,i);break;case "triangle":this.drawTriangle(e,t,i);break;case "hexagon":this.drawHexagon(e,t,i);break;case "parallelogram":this.drawParallelogram(e,t,i);break;case "trapezoid":this.drawTrapezoid(e,t,i);break;case "pentagon":this.drawPentagon(e,t,i);break;case "octagon":this.drawOctagon(e,t,i);break;case "star":this.drawStar(e,t,i);break;case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "sticky-note":this.drawPathShape(e,t,i,n);break;case "stadium":this.drawStadium(e,t,i);break;case "uml-class":this.drawUmlClass(e,t,i);break;case "uml-interface":this.drawUmlInterface(e,t,i);break;case "mind-map":this.drawMindMap(e,t,i,s,a,l);break;case "table":this.drawTable(e,t,n);break;case "icon":this.drawIcon(e,t);break;case "image":this.drawImageShape(e,t);break;case "line":this.drawLine(e,t,o,i,n);break;case "arrow":this.drawArrow(e,t,o,i,n);break;case "text":this.drawText(e,t);break;case "draw":this.drawFreehand(e,t);break}if(t.text&&t.type!=="text"&&t.type!=="line"&&t.type!=="arrow"&&t.type!=="draw"&&t.type!=="table"&&(t.flipX||t.flipY?(e.save(),e.scale(t.flipX?-1:1,t.flipY?-1:1),this.drawShapeText(e,t),e.restore()):this.drawShapeText(e,t)),i){let c=t.type==="line"||t.type==="arrow";this.multiSelection?this.drawMultiSelectOutline(e,t,n):t.type==="mind-map"?s&&s.shapeId===t.id||this.drawSelectionOutline(e,t,n):c?this.drawSelectionHandles(e,t,n,o):(this.drawSelectionOutline(e,t,n),this.drawSelectionHandles(e,t,n));}t.type==="table"&&(i||this.hoverShapeId===t.id)&&this.drawTableMoveHandle(e,t,n);}drawTableMoveHandle(e,t,i){let n=tn(t,i),o=4/i;e.save(),e.setLineDash([]),e.fillStyle="#ffffff",e.strokeStyle=z(H.selection.outline,.55),e.lineWidth=1/i,e.beginPath(),e.roundRect(n.x,n.y,n.width,n.height,o),e.fill(),e.stroke(),e.fillStyle=z(H.selection.outline,.85);let s=1.4/i,a=n.width/3,l=n.height/4;for(let c=1;c<=2;c++)for(let h=1;h<=3;h++)e.beginPath(),e.arc(n.x+a*c,n.y+l*h,s,0,Math.PI*2),e.fill();e.restore();}applyStyle(e,t,i){let n=t.strokeOpacity??1;e.strokeStyle=n<1&&t.strokeColor!=="transparent"?z(t.strokeColor,n):t.strokeColor,e.lineWidth=t.strokeWidth/i,e.lineCap="round",e.lineJoin="round";let o=t.fillOpacity??1;o<1&&t.fillColor!=="transparent"?e.fillStyle=z(t.fillColor,o):e.fillStyle=t.fillColor,t.strokeDash?e.setLineDash(t.strokeDash):e.setLineDash([]);}drawRectangle(e,t,i){e.beginPath(),e.rect(-t.width/2,-t.height/2,t.width,t.height),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawRoundedRectangle(e,t,i){let{width:n,height:o,borderRadius:s}=t;e.beginPath(),e.roundRect(-n/2,-o/2,n,o,s),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawStadium(e,t,i){let{width:n,height:o}=t;e.beginPath(),e.roundRect(-n/2,-o/2,n,o,Math.min(n,o)/2),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawCircle(e,t,i){e.beginPath(),e.arc(0,0,t.radius,0,Math.PI*2),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawEllipse(e,t,i){e.beginPath(),e.ellipse(0,0,t.width/2,t.height/2,0,0,Math.PI*2),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawDiamond(e,t,i){e.beginPath(),e.moveTo(0,-t.height/2),e.lineTo(t.width/2,0),e.lineTo(0,t.height/2),e.lineTo(-t.width/2,0),e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawTriangle(e,t,i){e.beginPath(),e.moveTo(0,-t.height/2),e.lineTo(t.width/2,t.height/2),e.lineTo(-t.width/2,t.height/2),e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawHexagon(e,t,i){let n=t.width/2,o=t.height/2,s=t.orientation==="flat"?Math.PI/6:0;e.beginPath();for(let a=0;a<6;a++){let l=a*Math.PI/3-Math.PI/2+s,c=n*Math.cos(l),h=o*Math.sin(l);a===0?e.moveTo(c,h):e.lineTo(c,h);}e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawParallelogram(e,t,i){let{width:n,height:o}=t,s=n*.2;e.beginPath(),e.moveTo(-n/2+s,-o/2),e.lineTo(n/2,-o/2),e.lineTo(n/2-s,o/2),e.lineTo(-n/2,o/2),e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawTrapezoid(e,t,i){let{width:n,height:o}=t,s=t.topInset??n*.15;e.beginPath(),e.moveTo(-n/2+s,-o/2),e.lineTo(n/2-s,-o/2),e.lineTo(n/2,o/2),e.lineTo(-n/2,o/2),e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawPentagon(e,t,i){let n=t.width/2,o=t.height/2;e.beginPath();for(let s=0;s<5;s++){let a=s*2*Math.PI/5-Math.PI/2,l=n*Math.cos(a),c=o*Math.sin(a);s===0?e.moveTo(l,c):e.lineTo(l,c);}e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawOctagon(e,t,i){let n=t.width/2,o=t.height/2;e.beginPath();for(let s=0;s<8;s++){let a=s*Math.PI/4-Math.PI/8,l=n*Math.cos(a),c=o*Math.sin(a);s===0?e.moveTo(l,c):e.lineTo(l,c);}e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawStar(e,t,i){let n=t.width/2,o=t.height/2,s=5,a=.4;e.beginPath();for(let l=0;l<s*2;l++){let c=l*Math.PI/s-Math.PI/2,h=l%2===0?1:a,d=n*h*Math.cos(c),u=o*h*Math.sin(c);l===0?e.moveTo(d,u):e.lineTo(d,u);}e.closePath(),t.style.fillColor!=="transparent"&&e.fill(),e.stroke();}drawPathShape(e,t,i,n){let o=At(t.type);if(o){if(this.tracePath(e,de(o.outline,t.width,t.height)),!o.strokeOnly&&t.style.fillColor!=="transparent"&&(o.shadow?(e.save(),e.shadowColor=z(o.shadow.color,o.shadow.opacity??.2),e.shadowBlur=o.shadow.blur,e.shadowOffsetX=o.shadow.offsetX??0,e.shadowOffsetY=o.shadow.offsetY??0,e.fill(),e.restore()):e.fill()),e.stroke(),o.overlays){let s=e.fillStyle;for(let a of o.overlays){let l=a.fill??"auto";if(l!=="none"){let c=l==="auto"?a.deriveFill?a.deriveFill(t.style.fillColor):t.style.fillColor:l;if(c&&c!=="transparent"){let h=t.style.fillOpacity??1;e.fillStyle=h<1?z(c,h):c,this.tracePath(e,de(a.cmds,t.width,t.height)),e.fill();}}a.stroke!==false&&(this.tracePath(e,de(a.cmds,t.width,t.height)),e.stroke());}e.fillStyle=s;}if(o.seams)for(let s of o.seams)this.tracePath(e,de(s,t.width,t.height)),e.stroke();if(o.hiddenSeams){let s=t.style.strokeWidth||1;e.setLineDash([s*st[0]/n,s*st[1]/n]);for(let a of o.hiddenSeams)this.tracePath(e,de(a,t.width,t.height)),e.stroke();e.setLineDash([]);}}}tracePath(e,t){e.beginPath();for(let i of t)switch(i[0]){case "M":e.moveTo(i[1],i[2]);break;case "L":e.lineTo(i[1],i[2]);break;case "C":e.bezierCurveTo(i[1],i[2],i[3],i[4],i[5],i[6]);break;case "Z":e.closePath();break}}drawImageShape(e,t){let i=t.width,n=t.height;if(!(i>0)||!(n>0))return;let o=-i/2,s=-n/2,a=Math.max(0,Math.min(t.borderRadius??0,i/2,n/2)),l=t.src?$t(t.src):null,c=!!t.src&&Rn(t.src);e.save(),a>0&&(e.beginPath(),e.roundRect(o,s,i,n,a),e.clip()),l?e.drawImage(l.img,o,s,i,n):(e.fillStyle=c?"#fee2e2":"#f3f4f6",e.fillRect(o,s,i,n),e.strokeStyle=c?"#fca5a5":"#e5e7eb",e.lineWidth=1,e.beginPath(),e.moveTo(o,s),e.lineTo(o+i,s+n),e.moveTo(o+i,s),e.lineTo(o,s+n),e.stroke()),e.restore();let h=t.style.strokeWidth??0;t.style.strokeColor&&t.style.strokeColor!=="transparent"&&h>0&&(e.save(),e.beginPath(),a>0?e.roundRect(o,s,i,n,a):e.rect(o,s,i,n),e.strokeStyle=t.style.strokeColor,e.lineWidth=h,e.stroke(),e.restore());}drawIcon(e,t){let i=$e(t.iconId),n=t.style.fillColor!=="transparent"?t.style.fillColor:t.textColor||"#1f2937";if(e.save(),e.translate(-t.width/2,-t.height/2),e.scale(t.width/K,t.height/K),e.lineCap="round",e.lineJoin="round",!i){e.strokeStyle=n,e.lineWidth=1.4,e.setLineDash([3,3]),e.strokeRect(4,4,K-8,K-8),e.setLineDash([]),e.restore();return}i.disc&&(e.beginPath(),e.arc(K/2,K/2,K/2-1,0,Math.PI*2),e.fillStyle=i.disc,e.fill());for(let s of i.layers){let a=new Path2D(s.d),l=s.fill??"ink",c=s.stroke??"ink";l!=="none"&&(e.fillStyle=l==="ink"?n:l,e.fill(a)),c!=="none"&&(e.strokeStyle=c==="ink"?n:c,e.lineWidth=s.w??1.8,e.stroke(a));}let o=i.label;o&&(e.fillStyle=o.color,e.font=`${o.size??13}px sans-serif`,e.textAlign="center",e.textBaseline="middle",e.fillText(o.text,K/2,K/2+.5)),e.restore();}drawUmlClass(e,t,i){let{width:n,height:o,className:s,attributes:a,methods:l}=t,c=n/2,h=o/2,d=ge,u=a.length>0?a.length*V+_*2:_*2;e.beginPath(),e.rect(-c,-h,n,o),t.style.fillColor!=="transparent"&&(e.fillStyle=t.style.fillColor,e.fill()),e.stroke(),e.beginPath(),e.moveTo(-c,-h+d),e.lineTo(c,-h+d),e.moveTo(-c,-h+d+u),e.lineTo(c,-h+d+u),e.stroke(),e.save(),e.textBaseline="middle";let p=n-ne*2,g=x=>{if(e.measureText(x).width<=p)return x;let I="\u2026",T=0,S=x.length;for(;T<S;){let w=T+S+1>>1;e.measureText(x.slice(0,w)+I).width<=p?T=w:S=w-1;}return x.slice(0,T)+I},m=(x,I,T,S,w,C,v)=>{let k=S||ee,P=w||"#1f2937";e.font=`${k}px sans-serif`,e.fillStyle=P,e.textAlign=v;let E=g(x);if(e.fillText(E,I,T),C){let U=e.measureText(E).width,ae=I;e.strokeStyle=P,e.beginPath(),e.moveTo(ae,T),e.lineTo(ae+U,T),e.stroke();}};e.font=`bold ${t.fontSize||ee}px sans-serif`,e.textAlign="center",e.fillStyle=t.textColor||"#1f2937",e.fillText(g(s),0,-h+d/2);let f=-h+d+_+V/2;a.forEach((x,I)=>{let T=Ne(x);T&&m(T,-c+ne,f+I*V,x.fontSize||t.fontSize||0,x.textColor||t.textColor||"",!!x.strikethrough,"left");});let b=-h+d+u+_+V/2;l.forEach((x,I)=>{let T=xe(x);T&&m(T,-c+ne,b+I*V,x.fontSize||t.fontSize||0,x.textColor||t.textColor||"",!!x.strikethrough,"left");}),e.restore();}drawTable(e,t,i){let{width:n,height:o}=t,s=n/2,a=o/2,l=Ge(t.cells);t.style.fillColor!=="transparent"&&(e.beginPath(),e.rect(-s,-a,n,o),e.fillStyle=t.style.fillColor,e.fill());for(let c=0;c<t.cells.length;c++)for(let h=0;h<(t.cells[c]?.length??0);h++){if(l[c]?.[h])continue;let d=t.cells[c][h];if(!d.fillColor)continue;let u=ie(t,c,h);e.fillStyle=d.fillColor,e.fillRect(u.ox-s,u.oy-a,u.width,u.height);}e.save(),e.strokeStyle=Qt,e.lineWidth=1/i;for(let c=1;c<t.rowHeights.length;c++){let h=-a+t.rowHeights.slice(0,c).reduce((u,p)=>u+p,0),d=[];for(let u=0;u<c;u++)for(let p=0;p<(t.cells[u]?.length??0);p++){let m=t.cells[u][p].rowSpan??1;if(m>1&&u+m>c){let f=ie(t,u,p);d.push([f.ox-s,f.ox-s+f.width]);}}this.drawSegmentsWithGaps(e,-s,s,h,d,true);}for(let c=1;c<t.colWidths.length;c++){let h=-s+t.colWidths.slice(0,c).reduce((u,p)=>u+p,0),d=[];for(let u=0;u<c;u++)for(let p=0;p<t.cells.length;p++){let g=t.cells[p]?.[u];if(!g)continue;let m=g.colSpan??1;if(m>1&&u+m>c){let f=ie(t,p,u);d.push([f.oy-a,f.oy-a+f.height]);}}this.drawSegmentsWithGaps(e,-a,a,h,d,false);}e.restore(),e.beginPath(),e.rect(-s,-a,n,o),e.stroke(),e.save(),e.textBaseline="middle";for(let c=0;c<t.cells.length;c++)for(let h=0;h<(t.cells[c]?.length??0);h++){if(l[c]?.[h])continue;let d=t.cells[c][h];if(!d.text)continue;let u=ie(t,c,h),p=d.fontSize||t.fontSize||14;e.font=`${d.bold?"bold ":""}${p}px sans-serif`,e.fillStyle=d.textColor||t.textColor||en;let g=u.width-20,m=u.height-8,f=p*1.3,b=this.getDisplayLines(e,t,d.text,p,g,Math.max(f,m),`cell:${d.bold?"b":"n"}`),x=u.ox-s,I=u.oy-a,T=I+Mt(b.length,f,u.height);e.save(),e.beginPath(),e.rect(x,I,u.width,u.height),e.clip(),b.forEach((S,w)=>{let C=T+w*f;d.align==="center"?(e.textAlign="center",e.fillText(S,x+u.width/2,C)):d.align==="right"?(e.textAlign="right",e.fillText(S,x+u.width-10,C)):(e.textAlign="left",e.fillText(S,x+10,C));}),e.restore();}if(e.restore(),this.tableSelection&&this.tableSelection.shapeId===t.id){let c=this.tableSelection,h=It(t,c.anchor.row,c.anchor.col,c.focus.row,c.focus.col),d=hi(t,h.r1,h.c1,h.r2,h.c2);e.save(),e.fillStyle=z(H.primary,.12),e.beginPath(),e.rect(d.x,d.y,d.width,d.height),e.fill(),e.strokeStyle=H.primary,e.lineWidth=1.5/i,e.setLineDash([]),e.stroke(),e.restore();}}drawSegmentsWithGaps(e,t,i,n,o,s){let a=[...o].sort((c,h)=>c[0]-h[0]),l=t;for(let[c,h]of a)if(c>l&&this.strokeGridSegment(e,l,Math.min(c,i),n,s),l=Math.max(l,h),l>=i)break;l<i&&this.strokeGridSegment(e,l,i,n,s);}strokeGridSegment(e,t,i,n,o){i-t<.5||(e.beginPath(),o?(e.moveTo(t,n),e.lineTo(i,n)):(e.moveTo(n,t),e.lineTo(n,i)),e.stroke());}drawUmlInterface(e,t,i){let{width:n,height:o,className:s,methods:a}=t,l=n/2,c=o/2,h=ge;e.beginPath(),e.rect(-l,-c,n,o),t.style.fillColor!=="transparent"&&(e.fillStyle=t.style.fillColor,e.fill()),e.stroke(),e.beginPath(),e.moveTo(-l,-c+h),e.lineTo(l,-c+h),e.stroke(),e.save(),e.textBaseline="middle";let d=n-ne*2,u=f=>{if(e.measureText(f).width<=d)return f;let b="\u2026",x=0,I=f.length;for(;x<I;){let T=x+I+1>>1;e.measureText(f.slice(0,T)+b).width<=d?x=T:I=T-1;}return f.slice(0,x)+b},p=(f,b,x,I,T,S,w)=>{let C=I||ee,v=T||"#1f2937";e.font=`${C}px sans-serif`,e.fillStyle=v,e.textAlign=w;let k=u(f);if(e.fillText(k,b,x),S){let P=e.measureText(k).width,E=b;e.strokeStyle=v,e.beginPath(),e.moveTo(E,x),e.lineTo(E+P,x),e.stroke();}};e.font=`bold ${t.fontSize||ee}px sans-serif`,e.textAlign="center",e.fillStyle=t.textColor||"#1f2937";let g=`<<${s||"Interface"}>>`;e.fillText(u(g),0,-c+h/2);let m=-c+h+_+V/2;a.forEach((f,b)=>{let x=xe(f);x&&p(x,-l+ne,m+b*V,f.fontSize||t.fontSize||0,f.textColor||t.textColor||"",!!f.strikethrough,"left");}),e.restore();}static DEFAULT_CORNER_RADIUS=10;static CONNECTION_LEAD=24;drawMindMap(e,t,i,n,o,s){let l=N(t.root).positions;this.drawMindMapConnections(e,t.root,l),this.drawMindMapNodes(e,t,l,i,n,o),this.drawMindMapReorderIndicator(e,t,l,s);}drawMindMapConnections(e,t,i){let n=o=>{if(o.collapsed)return;let s=i.get(o.id);if(s)for(let a of o.children??[]){let l=i.get(a.id);if(!l)continue;let c=Be(a,l.depth);e.strokeStyle=c,e.lineWidth=2,e.lineCap="round",e.beginPath();let h=l.direction,d,u,p,g;if(h==="right"?(d=s.x+s.width/2,u=s.y,p=l.x-l.width/2,g=l.y):h==="left"?(d=s.x-s.width/2,u=s.y,p=l.x+l.width/2,g=l.y):h==="down"?(d=s.x,u=s.y+s.height/2,p=l.x,g=l.y-l.height/2):(d=s.x,u=s.y-s.height/2,p=l.x,g=l.y+l.height/2),e.moveTo(d,u),h==="right"||h==="left"){let m=(d+p)/2;e.bezierCurveTo(m,u,m,g,p,g);}else {let m=(u+g)/2;e.bezierCurveTo(d,m,p,m,p,g);}e.stroke(),n(a);}};n(t);}drawMindMapNodes(e,t,i,n,o,s){let a=t.root,l=c=>{let h=i.get(c.id);if(!h)return;let d=Be(c,h.depth),u=h.width/2,p=h.height/2;if(e.fillStyle="#ffffff",e.strokeStyle=d,e.lineWidth=2,e.beginPath(),e.roundRect(h.x-u,h.y-p,h.width,h.height,6),e.fill(),e.stroke(),s&&s.shapeId===t.id&&s.nodeId===c.id&&(e.fillStyle=z(H.primary,.06),e.strokeStyle=z(H.primary,.55),e.lineWidth=2,e.beginPath(),e.roundRect(h.x-u,h.y-p,h.width,h.height,6),e.fill(),e.stroke()),o&&o.shapeId===t.id&&o.nodeId===c.id&&(e.fillStyle=z(H.primary,.12),e.strokeStyle=H.primary,e.lineWidth=2.5,e.beginPath(),e.roundRect(h.x-u,h.y-p,h.width,h.height,6),e.fill(),e.stroke()),!!(c.children&&c.children.length>0)){let C=qt(h,h.direction);e.fillStyle="#ffffff",e.strokeStyle=d,e.lineWidth=2,e.beginPath(),e.arc(C.x,C.y,8,0,Math.PI*2),e.fill(),e.stroke(),e.fillStyle=d,e.font="bold 13px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(c.collapsed?"+":"\u2212",C.x,C.y+.5);}if(c.note){let C=c.noteColor??d;e.font="11px sans-serif";let v=Math.min(e.measureText(c.note).width+12,130),k=16;e.fillStyle=C,e.beginPath(),e.roundRect(h.x-u,h.y-p-k+2,v,k,4),e.fill(),e.fillStyle="#ffffff",e.font="11px sans-serif",e.textAlign="left",e.textBaseline="middle",e.fillText(e.measureText(c.note).width+12>130?c.note.slice(0,12)+"\u2026":c.note,h.x-u+6,h.y-p-k/2+2);}e.font=`${14}px sans-serif`;let b=c.icon?18:0,x=h.width-b-(c.icon?8:0)-16,I=this.ellipsizeText(e,c.text||"",x),T=e.measureText(I).width,S=b+(b?8:0)+T,w=h.x-S/2;if(e.textBaseline="middle",c.icon&&(e.font="16px sans-serif",e.textAlign="left",e.fillStyle="#1f2937",e.fillText(c.icon,w,h.y+1),w+=b+8),e.font=`${14}px sans-serif`,e.textAlign="left",e.fillStyle="#1f2937",e.fillText(I,w,h.y),!c.collapsed)for(let C of c.children??[])l(C);};if(l(a),n){let c=s&&s.shapeId===t.id?s.nodeId:o&&o.shapeId===t.id?o.nodeId:null;c&&this.drawMindMapHandles(e,Jn(a,c));}}drawMindMapReorderIndicator(e,t,i,n){if(!n||n.shapeId!==t.id)return;let{targetIndex:o,direction:s,siblingIds:a,nodeId:l,childParentId:c}=n,h=ce(s),d=i.get(l);if(!d)return;let u=d.width,p=d.height,g=16,m=48;if(c){let w=i.get(c);w&&(e.save(),e.setLineDash([4,4]),e.lineWidth=2,e.strokeStyle=H.primary,e.beginPath(),e.roundRect(w.x-w.width/2-5,w.y-w.height/2-5,w.width+10,w.height+10,8),e.stroke(),e.restore());}let f=a.map(w=>({id:w,pos:i.get(w)})).filter(w=>!!w.pos).sort((w,C)=>h?w.pos.y-C.pos.y:w.pos.x-C.pos.x),b=f.findIndex(w=>w.id===l);if(b!==-1&&o===b)return;let x=f.filter(w=>w.id!==l).map(w=>w.pos),I=o;I<0&&(I=0),I>x.length&&(I=x.length);let T,S;if(x.length===0){if(!c)return;let w=i.get(c);if(!w)return;let C=h?w.y:w.x,v=h?s==="right"?w.x+w.width/2+m+u/2:w.x-w.width/2-m-u/2:s==="down"?w.y+w.height/2+m+p/2:w.y-w.height/2-m-p/2;T=h?v:C,S=h?C:v;}else {let w=(()=>{if(I<=0){let P=x[0];return h?P.y-P.height/2-g-p/2:P.x-P.width/2-g-u/2}if(I>=x.length){let P=x[x.length-1];return h?P.y+P.height/2+g+p/2:P.x+P.width/2+g+u/2}let v=x[I-1],k=x[I];return h?(v.y+v.height/2+k.y-k.height/2)/2:(v.x+v.width/2+k.x-k.width/2)/2})(),C=(()=>{if(h){let k=s==="right"?x[0].x-x[0].width/2:x[0].x+x[0].width/2;return s==="right"?k+u/2:k-u/2}let v=s==="down"?x[0].y-x[0].height/2:x[0].y+x[0].height/2;return s==="down"?v+p/2:v-p/2})();T=h?C:w,S=h?w:C;}if(c){let w=i.get(c);if(w){let C=h?s==="right"?w.x+w.width/2:w.x-w.width/2:w.x,v=h?w.y:s==="down"?w.y+w.height/2:w.y-w.height/2,k=h?s==="right"?T-u/2:T+u/2:T,P=h?S:s==="down"?S-p/2:S+p/2;if(e.save(),e.setLineDash([5,4]),e.lineWidth=2,e.strokeStyle=H.primary,e.beginPath(),e.moveTo(C,v),h){let E=(C+k)/2;e.bezierCurveTo(E,v,E,P,k,P);}else {let E=(v+P)/2;e.bezierCurveTo(C,E,k,E,k,P);}e.stroke(),e.restore();}}e.save(),e.setLineDash([5,4]),e.lineJoin="round",e.lineWidth=2,e.strokeStyle=H.primary,e.fillStyle=z(H.primary,.12),e.beginPath(),e.roundRect(T-u/2,S-p/2,u,p,6),e.fill(),e.stroke(),e.restore();}drawMindMapHandles(e,t){e.save(),e.setLineDash([]),e.lineCap="round";for(let i of t){e.beginPath(),e.arc(i.x,i.y,11,0,Math.PI*2),e.fillStyle="#ffffff",e.fill(),e.beginPath(),e.arc(i.x,i.y,9,0,Math.PI*2),e.fillStyle=H.primary,e.fill();let n=9*.5;e.beginPath(),e.moveTo(i.x-n,i.y),e.lineTo(i.x+n,i.y),e.moveTo(i.x,i.y-n),e.lineTo(i.x,i.y+n),e.strokeStyle="#ffffff",e.lineWidth=2,e.stroke();}e.restore();}ellipsizeText(e,t,i){if(i<=0)return "";if(e.measureText(t).width<=i)return t;let n="\u2026",o=0,s=t.length;for(;o<s;){let a=o+s+1>>1;e.measureText(t.slice(0,a)+n).width<=i?o=a:s=a-1;}return t.slice(0,o)+n}resolveConnectorEnds(e,t){let i=e.points.map(l=>({x:l.x,y:l.y}));if(i.length<2)return {world:i};let n=i.length-1;if(e.type==="line")return e.freeform||(i[0]=this.clampToShapeOutline(i[0],t,e.id,i[n]),i[n]=this.clampToShapeOutline(i[n],t,e.id,i[0])),{world:i,fromN:this.getDockNormal(i[0],t,e.id),toN:this.getDockNormal(i[n],t,e.id)};let o=e.endBinding,s,a;if(e.startBinding){let l=t.get(e.startBinding.toShapeId);l&&(i[0]=this.getBindingPoint(l,e.startBinding),s=this.localDockBox(l,e));}if(e.endBinding){let l=t.get(e.endBinding.toShapeId);l&&(o=this.resolveAutoEndBinding(e.endBinding,e,i[0],l),i[n]=this.getBindingPoint(l,o),a=this.localDockBox(l,e));}return e.freeform||(e.startBinding||(i[0]=this.clampToShapeOutline(i[0],t,e.id,i[n])),e.endBinding||(i[n]=this.clampToShapeOutline(i[n],t,e.id,i[0]))),{world:i,fromN:this.resolveDockNormal(e.startBinding,i[0],t,e.id),toN:this.resolveDockNormal(o,i[n],t,e.id),fromBox:s,toBox:a}}localDockBox(e,t){let i=this.getShapePageBounds(e);return {x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}withUserPoints(e,t,i,n){let o=e,s=o.userPoints;if(!s||s.length===0||t.length<2)return t;let a=this.effectiveConnType(o),l=[t[0],t[t.length-1]],[c,h]=a==="curve"?l:this.getAlignedPoints(l),d=a==="curve"?s:Ut(s,o.userPointsRef,c,h,i,n);return [c,...d.map(u=>({x:u.x,y:u.y})),h]}getConnectorRoute(e,t,i={}){return e.type!=="arrow"&&e.type!=="line"?[]:!e.points||e.points.length<2?[]:this.connectorWorldPath(e,t,i).world}connectorWorldPath(e,t,i={}){let{world:n,fromN:o,toN:s,fromBox:a,toBox:l}=this.resolveConnectorEnds(e,t),c=this.effectiveConnType(e),h={fromN:o,toN:s,fromBox:a,toBox:l},d=x=>x.map(I=>({x:I.x-e.x,y:I.y-e.y})),u=x=>x.map(I=>({x:I.x+e.x,y:I.y+e.y})),p=x=>c==="straight"?this.straightAligned(x):this.buildPathPoints(x,c,h),g=p(d(n)),m=e.userPoints;if(i.ignoreUserPoints||!m||m.length===0||n.length<2)return {world:u(g),connType:c};let f=p(d(this.withUserPoints(e,n,o,s)));if(Wt({userRoute:f,autoRoute:g,base:e.userPointsBase,fromBox:a,toBox:l}))return {world:u(g),connType:c};let b=c==="curve"?f:Ee(f);return {world:u(b),connType:c}}drawSegmentHandles(e,t,i){let n=Gt(t);if(n.length===0)return;let o=20/i,s=6/i;e.save(),e.setLineDash([]),e.lineWidth=1.5/i,e.strokeStyle="#ffffff",e.fillStyle=H.primary;for(let a of n){let l=a.axis==="H"?o:s,c=a.axis==="H"?s:o;e.beginPath(),e.roundRect(a.center.x-l/2,a.center.y-c/2,l,c,s/2),e.fill(),e.stroke();}e.restore();}drawLine(e,t,i,n,o){if(t.points.length<2)return;let s=t,{world:a,connType:l}=this.connectorWorldPath(s,i),c=a.map(h=>({x:h.x-t.x,y:h.y-t.y}));if(l==="straight"){e.beginPath(),e.moveTo(c[0].x,c[0].y);for(let h=1;h<c.length;h++)e.lineTo(c[h].x,c[h].y);e.stroke(),e.setLineDash([]);}else l==="orthogonal"?this.drawSharpPolyline(e,c):this.drawRoundedPolyline(e,c,r.DEFAULT_CORNER_RADIUS),e.stroke(),e.setLineDash([]);n&&(this.drawLinearHighlight(e,c,o),!this.multiSelection&&ut(t)&&dt(l)&&this.drawSegmentHandles(e,c,o));}drawArrow(e,t,i,n,o){if(t.points.length<2)return;let{world:s,connType:a}=this.connectorWorldPath(t,i),l=s.map(d=>({x:d.x-t.x,y:d.y-t.y})),c=t.arrowHead??"end";if(!!t.dashed||c==="dependency"||c==="realization"?e.setLineDash([8,5]):e.setLineDash([]),a==="straight"){e.beginPath(),e.moveTo(l[0].x,l[0].y);for(let d=1;d<l.length;d++)e.lineTo(l[d].x,l[d].y);e.stroke();}else a==="orthogonal"?this.drawSharpPolyline(e,l):this.drawRoundedPolyline(e,l,r.DEFAULT_CORNER_RADIUS),e.stroke();this.drawArrowHeads(e,l,c),e.setLineDash([]),n&&(this.drawLinearHighlight(e,l,o),!this.multiSelection&&ut(t)&&dt(a)&&this.drawSegmentHandles(e,l,o));}drawLinearHighlight(e,t,i,n=1,o=7){if(!(!t||t.length<2)){e.save(),e.globalAlpha=n,e.strokeStyle=H.lineHighlight,e.lineWidth=o/i,e.lineCap="round",e.lineJoin="round",e.setLineDash([]),e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let s=1;s<t.length;s++)e.lineTo(t[s].x,t[s].y);e.stroke(),e.restore();}}drawGenerationPreview(e,t,i,n,o){let{from:s,to:a}=t,l=t.arrowStyle??{connectionType:"polyline",arrowHead:"end",dashed:false},c=new Map(o);n.forEach(m=>c.set(m.id,m));let h=t.targetShapeId;if(!h&&t.type){let m=Te(t.type,a,void 0,void 0,t.size);m.id=r.GEN_GHOST_ID,c.set(r.GEN_GHOST_ID,m),h=r.GEN_GHOST_ID;}let d=t.sourceEdge?wi[t.sourceEdge]:void 0,u=t.sourceShapeId&&d?{toShapeId:t.sourceShapeId,handle:d}:void 0,p=h?{...t.targetBinding??{auto:true,handle:"left"},toShapeId:h}:void 0,g={id:r.GEN_PREVIEW_ID,type:"arrow",x:s.x,y:s.y,points:[s,a],rotation:0,style:t.lineStyle??r.PREVIEW_LINE_STYLE,startBinding:u,endBinding:p,connectionType:l.connectionType,arrowHead:l.arrowHead,dashed:l.dashed};if(e.save(),t.dragging||(e.globalAlpha=.65),e.translate(s.x,s.y),this.applyStyle(e,g.style,i),this.drawArrow(e,g,c,false,i),e.restore(),t.type){let m=c.get(r.GEN_GHOST_ID),f=m?this.getShapeBounds(m):{x:-60,y:-30,width:120,height:60};this.drawPreviewShapeOutline(e,a,t.type,f,i);}e.save(),e.beginPath(),e.arc(s.x,s.y,5/i,0,Math.PI*2),e.fillStyle=H.genDot,e.fill(),e.restore();}drawPreviewShapeOutline(e,t,i,n,o){let s=n.width,a=n.height,l=s/2,c=a/2,h=t.x,d=t.y;switch(e.strokeStyle=H.genLine,e.lineWidth=1.5/o,e.setLineDash([6/o,4/o]),e.beginPath(),i){case "circle":case "ellipse":e.ellipse(h,d,s/2,a/2,0,0,Math.PI*2);break;case "diamond":e.moveTo(h,d-c),e.lineTo(h+l,d),e.lineTo(h,d+c),e.lineTo(h-l,d),e.closePath();break;case "triangle":e.moveTo(h,d-c),e.lineTo(h+l,d+c),e.lineTo(h-l,d+c),e.closePath();break;case "image":{e.roundRect(h-l,d-c,s,a,4);break}case "sticky-note":{let u=s*re,p=a*re;e.moveTo(h-l,d-c),e.lineTo(h+l,d-c),e.lineTo(h+l,d+c-p),e.lineTo(h+l-u,d+c),e.lineTo(h-l,d+c),e.closePath();break}case "hexagon":for(let u=0;u<6;u++){let p=u*Math.PI/3-Math.PI/2,g=h+l*Math.cos(p),m=d+c*Math.sin(p);u===0?e.moveTo(g,m):e.lineTo(g,m);}e.closePath();break;case "parallelogram":{let u=s*.15;e.moveTo(h-l+u,d-c),e.lineTo(h+l,d-c),e.lineTo(h+l-u,d+c),e.lineTo(h-l,d+c),e.closePath();break}default:e.roundRect(h-l,d-c,s,a,i==="rounded-rectangle"?8:4);break}e.stroke();}static ALIGN_TOLERANCE=8;static GEN_PREVIEW_ID="__gen_preview_line__";static GEN_GHOST_ID="__gen_preview_ghost__";static PREVIEW_LINE_STYLE={strokeColor:"#1f2937",fillColor:"transparent",strokeWidth:2,strokeDash:null};straightAligned(e){return e.length===2?this.getAlignedPoints(e):e}effectiveConnType(e){let t=e.connectionType||"straight";return t==="straight"&&e.userPoints&&e.userPoints.length>0?"polyline":t}getAlignedPoints(e){if(e.length<2)return e;let t=e[0],i=e[e.length-1],n=i.x-t.x,o=i.y-t.y,s=r.ALIGN_TOLERANCE;if(Math.abs(o)<=s){let a=(t.y+i.y)/2;return e.map(l=>({x:l.x,y:a}))}if(Math.abs(n)<=s){let a=(t.x+i.x)/2;return e.map(l=>({x:a,y:l.y}))}return e}buildPathPoints(e,t,i={}){if(e.length<2)return e;if(t==="straight")return this.straightAligned(e);if(t==="polyline"||t==="orthogonal"){let n=e.length===2?this.getAlignedPoints(e):e;return this.generatePolylinePoints(n,i)}return t==="curve"?this.generateCurvePoints(e,i):e}drawRoundedPolyline(e,t,i){if(e.beginPath(),!(t.length<2)){if(t.length===2||i<=0){e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y);return}e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length-1;n++){let o=t[n-1],s=t[n],a=t[n+1],l=s.x-o.x,c=s.y-o.y,h=a.x-s.x,d=a.y-s.y,u=Math.hypot(l,c),p=Math.hypot(h,d);if(u<1e-6||p<1e-6){e.lineTo(s.x,s.y);continue}let g=Math.min(i,u*.5,p*.5),m=s.x-l/u*g,f=s.y-c/u*g,b=s.x+h/p*g,x=s.y+d/p*g;e.lineTo(m,f),e.arcTo(s.x,s.y,b,x,g);}e.lineTo(t[t.length-1].x,t[t.length-1].y);}}drawSharpPolyline(e,t){if(e.beginPath(),!(t.length<2)){e.moveTo(t[0].x,t[0].y);for(let i=1;i<t.length;i++)e.lineTo(t[i].x,t[i].y);}}drawSnapGuides(e,t,i){e.save(),e.strokeStyle=H.guide,e.lineWidth=1/i,e.setLineDash([6/i,4/i]),e.beginPath();for(let n of t)n.type==="horizontal"?(e.moveTo(n.start,n.position),e.lineTo(n.end,n.position)):(e.moveTo(n.position,n.start),e.lineTo(n.position,n.end));e.stroke(),e.restore();}generatePolylinePoints(e,t={}){return kt(e,t,r.CONNECTION_LEAD)}generateCurvePoints(e,t={}){if(e.length<2)return e;let i=e.length,n=[e[0]],o=l=>{let c=e[l],h=e[l+1];return Math.hypot(h.x-c.x,h.y-c.y)},s=l=>Math.max(16,Math.min(l*.32,150)),a=l=>{let c=e[Math.max(0,l-1)],h=e[Math.min(i-1,l+1)],d=h.x-c.x,u=h.y-c.y,p=Math.hypot(d,u);return p<1e-6?{x:1,y:0}:{x:d/p,y:u/p}};for(let l=0;l<i-1;l++){let c=e[l],h=e[l+1],d=o(l),u;if(l===0&&t.fromN)u={x:c.x+t.fromN.x*s(d),y:c.y+t.fromN.y*s(d)};else {let m=a(l);u={x:c.x+m.x*s(d),y:c.y+m.y*s(d)};}let p;if(l===i-2&&t.toN)p={x:h.x+t.toN.x*s(d),y:h.y+t.toN.y*s(d)};else {let m=a(l+1);p={x:h.x-m.x*s(d),y:h.y-m.y*s(d)};}let g=20;for(let m=1;m<=g;m++){let f=m/g,b=1-f,x=b*b*b*c.x+3*b*b*f*u.x+3*b*f*f*p.x+f*f*f*h.x,I=b*b*b*c.y+3*b*b*f*u.y+3*b*f*f*p.y+f*f*f*h.y;n.push({x,y:I});}}return n}getDisplayLines(e,t,i,n,o,s,a=""){let l=n*1.3,c=Math.max(1,Math.floor(s/l)),h=`${t.id}\0${i}\0${n}\0${o}x${s}\0${c}\0${a}`,d=this.textLayoutCache.get(h);if(d)return d;let u=i.split(`
|
|
4
|
+
`),p=[];for(let m of u){let f=this.wrapLine(e,m,o);for(let b of f)p.push(b);}let g=p.slice(0,c);return p.length>c&&g.length>0&&(g[g.length-1]=this.truncateLine(e,g[g.length-1],o)),this.textLayoutCache.size>=r.TEXT_CACHE_LIMIT&&this.textLayoutCache.clear(),this.textLayoutCache.set(h,g),g}drawShapeText(e,t){let i=t.text||"";if(!i)return;let n=t.fontSize||16;e.font=`${n}px sans-serif`,e.fillStyle=t.textColor||"#1f2937";let o=this.getTextBounds(t),s=n*1.3,a=this.getDisplayLines(e,t,i,n,o.width,o.height),c=-(a.length*s)/2+s/2,h=yn(t);e.textAlign="center",e.textBaseline="middle",a.forEach((d,u)=>{let p=c+u*s;e.fillText(d,h,p);});}getTextBounds(e){switch(e.type){case "rectangle":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":return {width:e.width*.85,height:e.height*.85};case "brace-left":case "brace-right":return {width:e.width*(1-Lt)*.85,height:e.height*.85};case "icon":return {width:e.width*.85,height:e.height*.85};case "sticky-note":return {width:e.width*Je,height:e.height*Je};case "circle":return {width:e.radius*2*.85,height:e.radius*2*.85};default:return {width:100,height:40}}}wrapLine(e,t,i){if(!t)return [""];let n=[],o="";for(let s of t){let a=o+s;e.measureText(a).width>i&&o?(n.push(o),o=s):o=a;}return o&&n.push(o),n}truncateLine(e,t,i){if(!t)return "...";let n="...",o=t;for(;o.length>0&&e.measureText(o+n).width>i;)o=o.slice(0,-1);return o+n}isShapeTextTruncated(e){let t=e.text;if(!t)return false;let i=this.ctx;i.save();try{if(e.type==="text"){let s=e.fontSize;return i.font=`${s}px sans-serif`,this.isTextTruncated(i,t,s,e.width,e.height)}let n=e.fontSize||16;i.font=`${n}px sans-serif`;let o=this.getTextBounds(e);return this.isTextTruncated(i,t,n,o.width,o.height)}finally{i.restore();}}isTextTruncated(e,t,i,n,o){let s=i*1.3,a=Math.max(1,Math.floor(o/s)),l=0;for(let c of t.split(`
|
|
5
|
+
`))if(l+=Math.max(1,this.wrapLine(e,c,n).length),l>a)return true;return false}isUmlRowTextTruncated(e,t,i,n=false){if(!t||e.type==="circle")return false;let o=e.width??0;if(o<=0)return false;let s=this.ctx;s.save();try{return s.font=`${n?"bold ":""}${i||ee}px sans-serif`,s.measureText(t).width>o-ne*2}finally{s.restore();}}static HANDLE_NORMALS=Tt;pickAutoHandle(e,t,i){return vt(e,t,i)}resolveAutoEndBinding(e,t,i,n){if(!e.auto||e.isPrecise)return e;let o=t.startBinding?.handle?r.HANDLE_NORMALS[t.startBinding.handle]:void 0;return {...e,handle:this.pickAutoHandle(i,{x:n.x,y:n.y},o)}}getBindingPoint(e,t){if(t.isPrecise&&t.normalizedAnchor){let i=this.getShapePageBounds(e),n={x:i.x+i.width*t.normalizedAnchor.x,y:i.y+i.height*t.normalizedAnchor.y},o={x:e.x,y:e.y};return this.nearestPointOnShapeOutline(e,o,n)}if(t.handle){let i=this.getShapeBounds(e);switch(t.handle){case "top":return {x:e.x,y:e.y+i.y};case "bottom":return {x:e.x,y:e.y+i.y+i.height};case "left":return {x:e.x+i.x,y:e.y};case "right":return {x:e.x+i.x+i.width,y:e.y}}}return {x:e.x,y:e.y}}resolveDockNormal(e,t,i,n){return e&&!e.isPrecise&&e.handle?r.HANDLE_NORMALS[e.handle]:this.getDockNormal(t,i,n,e?.toShapeId)}getDockNormal(e,t,i,n){if(!t||t.size===0)return;let o=null,s=1/0,a=.5;if(t.forEach((d,u)=>{if(u===i||d.type==="line"||d.type==="arrow")return;let p=this.getShapePageBounds(d);if(e.x>=p.x-a&&e.x<=p.x+p.width+a&&e.y>=p.y-a&&e.y<=p.y+p.height+a){let g=d.id===n?-1:(e.x-d.x)**2+(e.y-d.y)**2;g<s&&(s=g,o=d);}}),!o)return;let l=o,c=e.x-l.x,h=e.y-l.y;return Math.abs(h)>Math.abs(c)?{x:0,y:h<0?-1:1}:{x:c<0?-1:1,y:0}}getShapePageBounds(e){let t=this.getShapeBounds(e);return {x:e.x+t.x,y:e.y+t.y,width:t.width,height:t.height}}clampToShapeOutline(e,t,i,n){if(!t||t.size===0)return e;let o=null,s=1/0;if(t.forEach((l,c)=>{if(c===i)return;let h=this.getShapePageBounds(l);if(e.x>h.x&&e.x<h.x+h.width&&e.y>h.y&&e.y<h.y+h.height){let d=(l.x-n.x)**2+(l.y-n.y)**2;d<s&&(s=d,o=l);}}),!o)return e;let a=o;return this.nearestPointOnShapeOutline(a,{x:a.x,y:a.y},e)}nearestPointOnShapeOutline(e,t,i){let n=i.x-t.x,o=i.y-t.y,s=Math.hypot(n,o);if(s<1e-6)return {x:t.x,y:t.y};let a=n/s,l=o/s,c=Math.max(1e4,s*2),h={x:t.x+a*c,y:t.y+l*c},d=this.intersectShapeOutlineWithSegment(e,t,h);if(d.length===0)return i;let u=d[0],p=(u.x-t.x)**2+(u.y-t.y)**2;for(let g=1;g<d.length;g++){let m=(d[g].x-t.x)**2+(d[g].y-t.y)**2;m<p&&(p=m,u=d[g]);}return u}intersectShapeOutlineWithSegment(e,t,i){let n={x:t.x-e.x,y:t.y-e.y},o={x:i.x-e.x,y:i.y-e.y};return this.intersectLocalShapeOutlineWithSegment(e,n,o).map(a=>({x:a.x+e.x,y:a.y+e.y}))}intersectLocalShapeOutlineWithSegment(e,t,i){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":{let n=e.width,o=e.height,s={x:-n/2,y:-o/2,width:n,height:o};return this.intersectSegmentRect(t,i,s)}case "ellipse":case "diamond":case "triangle":{let n=e.width,o=e.height,s={x:-n/2,y:-o/2,width:n,height:o};return this.intersectSegmentRect(t,i,s)}case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":{let n=e.width,o=e.height,s={x:-n/2,y:-o/2,width:n,height:o};return this.intersectSegmentRect(t,i,s)}case "circle":{let n=e.radius;return this.intersectSegmentCircle(t,i,{x:0,y:0},n)}default:return []}}intersectSegmentRect(e,t,i){let n=i.x,o=i.y,s=i.width,a=i.height,l=[[{x:n,y:o},{x:n+s,y:o}],[{x:n+s,y:o},{x:n+s,y:o+a}],[{x:n+s,y:o+a},{x:n,y:o+a}],[{x:n,y:o+a},{x:n,y:o}]],c=[];for(let[h,d]of l){let u=this.segmentIntersection(e,t,h,d);u&&c.push(u);}return c}segmentIntersection(e,t,i,n){let o=e.x,s=e.y,a=t.x,l=t.y,c=i.x,h=i.y,d=n.x,u=n.y,p=(o-a)*(h-u)-(s-l)*(c-d);if(Math.abs(p)<1e-9)return null;let g=((o-c)*(h-u)-(s-h)*(c-d))/p,m=-((o-a)*(s-h)-(s-l)*(o-c))/p;return g<0||g>1||m<0||m>1?null:{x:o+g*(a-o),y:s+g*(l-s)}}intersectSegmentCircle(e,t,i,n){let o=t.x-e.x,s=t.y-e.y,a=e.x-i.x,l=e.y-i.y,c=o*o+s*s,h=2*(a*o+l*s),d=a*a+l*l-n*n,u=h*h-4*c*d;if(u<0)return [];u=Math.sqrt(u);let p=(-h-u)/(2*c),g=(-h+u)/(2*c),m=[];return p>=0&&p<=1&&m.push({x:e.x+p*o,y:e.y+p*s}),g>=0&&g<=1&&Math.abs(g-p)>1e-6&&m.push({x:e.x+g*o,y:e.y+g*s}),m}drawArrowHead(e,t,i){let n=Math.atan2(i.y-t.y,i.x-t.x),o=12;e.save(),e.setLineDash([]),e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(i.x-o*Math.cos(n-Math.PI/6),i.y-o*Math.sin(n-Math.PI/6)),e.moveTo(i.x,i.y),e.lineTo(i.x-o*Math.cos(n+Math.PI/6),i.y-o*Math.sin(n+Math.PI/6)),e.stroke(),e.restore();}drawInheritanceHead(e,t,i){let n=Math.atan2(i.y-t.y,i.x-t.x),o=14,s=i.x,a=i.y,l=i.x-o*Math.cos(n),c=i.y-o*Math.sin(n),h=l+o*.5*Math.cos(n-Math.PI/2),d=c+o*.5*Math.sin(n-Math.PI/2),u=l+o*.5*Math.cos(n+Math.PI/2),p=c+o*.5*Math.sin(n+Math.PI/2);e.save(),e.setLineDash([]),e.fillStyle="#ffffff",e.beginPath(),e.moveTo(s,a),e.lineTo(h,d),e.lineTo(u,p),e.closePath(),e.fill(),e.stroke(),e.restore();}drawDiamondHead(e,t,i,n){let o=Math.atan2(i.y-t.y,i.x-t.x),s=14,a=i.x,l=i.y,c=i.x-s*.5*Math.cos(o),h=i.y-s*.5*Math.sin(o),d=i.x-s*Math.cos(o),u=i.y-s*Math.sin(o),p=c+s*.4*Math.cos(o-Math.PI/2),g=h+s*.4*Math.sin(o-Math.PI/2),m=c+s*.4*Math.cos(o+Math.PI/2),f=h+s*.4*Math.sin(o+Math.PI/2);e.save(),e.setLineDash([]),e.fillStyle=n?"#1f2937":"#ffffff",e.beginPath(),e.moveTo(a,l),e.lineTo(p,g),e.lineTo(d,u),e.lineTo(m,f),e.closePath(),e.fill(),e.stroke(),e.restore();}drawArrowHeads(e,t,i){if(i!=="none"){if(i==="start"||i==="both"){let n=t[0],o=t[1];this.drawArrowHead(e,o,n);}if(i==="end"||i==="both"){let n=t.length,o=t[n-2],s=t[n-1];this.drawArrowHead(e,o,s);}if(i==="inheritance"){let n=t.length,o=t[n-2],s=t[n-1];this.drawInheritanceHead(e,o,s);}if(i==="aggregation"){let n=t[0],o=t[1];this.drawDiamondHead(e,o,n,false);}if(i==="composition"){let n=t[0],o=t[1];this.drawDiamondHead(e,o,n,true);}if(i==="dependency"){let n=t.length;this.drawArrowHead(e,t[n-2],t[n-1]);}if(i==="realization"){let n=t.length;this.drawInheritanceHead(e,t[n-2],t[n-1]);}}}drawText(e,t){if(!t.text)return;let i=t.fontSize;e.font=`${i}px sans-serif`,e.textAlign="center",e.textBaseline="middle";let n=t.width,o=t.height,s=i*1.3,a=this.getDisplayLines(e,t,t.text,i,n,o),l=a.length*s,c=-l/2+s/2;if(t.highlightColor&&t.highlightColor!=="transparent"){let h=t.highlightOpacity??1;e.fillStyle=h<1?z(t.highlightColor,h):t.highlightColor;let d=i*.15;e.beginPath(),e.roundRect(-n/2-d,-l/2-d,n+d*2,l+d*2,4),e.fill();}e.fillStyle=t.textColor||"#1f2937",a.forEach((h,d)=>{let u=c+d*s;e.fillText(h,0,u);});}drawFreehand(e,t){if(t.points.length<2)return;let i=t.points;e.beginPath(),e.moveTo(i[0].x,i[0].y);for(let n=1;n<i.length-1;n++){let o=(i[n].x+i[n+1].x)/2,s=(i[n].y+i[n+1].y)/2;e.quadraticCurveTo(i[n].x,i[n].y,o,s);}e.lineTo(i[i.length-1].x,i[i.length-1].y),e.stroke();}visibleLockBadges(e,t,i){return this.allLockBadges(e,i).filter(n=>(n.memberIds.length?n.memberIds:n.shapeId?[n.shapeId]:[]).some(o=>t.has(o)||this.lockHoverId===o))}lockBadgeTargets(e,t){return this.allLockBadges(e,t)}allLockBadges(e,t){let i=1/t,n=20*i,o=[],s=new Map,a=null;for(let l of e){if(!l.locked)continue;if(l.groupId){let h=s.get(l.groupId);h?h.push(l):s.set(l.groupId,[l]);continue}if(l.type==="arrow"||l.type==="line"){a||(a=new Map(e.map(u=>[u.id,u])));let h=this.getConnectorRoute(l,a),d=hs(h);if(!d)continue;o.push({x:d.x+6*i,y:d.y-n-6*i,size:n,shapeId:l.id,memberIds:[]});continue}let c=this.getShapeWorldBounds(l);o.push({x:c.x+c.width+2*i,y:c.y-n+4*i,size:n,shapeId:l.id,memberIds:[]});}for(let[l,c]of s){let h=1/0,d=1/0,u=-1/0;for(let p of c){let g=this.getShapeWorldBounds(p);h=Math.min(h,g.x),d=Math.min(d,g.y),u=Math.max(u,g.x+g.width);}Number.isFinite(h)&&o.push({x:(h+u)/2-n/2,y:d-n+4*i,size:n,groupId:l,memberIds:c.map(p=>p.id)});}return o}lockHoverId=null;setLockHover(e){this.lockHoverId=e;}drawLockBadgeAt(e,t,i,n){let o=1/n,s=20*o,a=t+s/2;e.save(),e.setLineDash([]),e.lineJoin="round",e.lineCap="round",e.beginPath(),e.roundRect(t,i,s,s,6*o),e.fillStyle="rgba(255,255,255,0.97)",e.fill(),e.strokeStyle="#cbd5e1",e.lineWidth=o,e.stroke(),e.beginPath(),e.arc(a,i+8.5*o,3.4*o,Math.PI,0),e.strokeStyle="#4b5563",e.lineWidth=1.7*o,e.stroke(),e.beginPath(),e.roundRect(t+4.5*o,i+8.5*o,11*o,8*o,1.8*o),e.fillStyle="#4b5563",e.fill(),e.beginPath(),e.arc(a,i+11.6*o,1.2*o,0,Math.PI*2),e.fillStyle="#ffffff",e.fill(),e.restore();}drawGroupFrames(e,t,i,n){let o=t.filter(p=>i.has(p.id));if(o.length<2)return;let s=o[0].groupId;if(!s||!o.every(p=>p.groupId===s))return;let a=t.filter(p=>p.groupId===s);if(a.length!==o.length)return;let l=1/0,c=1/0,h=-1/0,d=-1/0;for(let p of a){let g=this.getShapeWorldBounds(p);l=Math.min(l,g.x),c=Math.min(c,g.y),h=Math.max(h,g.x+g.width),d=Math.max(d,g.y+g.height);}if(!Number.isFinite(l))return;let u=6/n;e.save(),e.strokeStyle=z(H.selection.outline,.7),e.lineWidth=1/n,e.setLineDash([6/n,5/n]),e.beginPath(),e.roundRect(l-u,c-u,h-l+u*2,d-c+u*2,6/n),e.stroke(),e.restore();}drawMultiSelectOutline(e,t,i){let n=this.getShapeBounds(t);e.save(),e.setLineDash([]),e.strokeStyle=z(H.selection.outline,.6),e.lineWidth=1/i,e.beginPath();let o=1.5/i;e.roundRect(n.x-o,n.y-o,n.width+o*2,n.height+o*2,3/i),e.stroke(),e.restore();}drawMultiSelectionBounds(e,t,i,n){let o=1/0,s=1/0,a=-1/0,l=-1/0;for(let h of t){if(!i.has(h.id))continue;let d=this.getShapeWorldBounds(h);o=Math.min(o,d.x),s=Math.min(s,d.y),a=Math.max(a,d.x+d.width),l=Math.max(l,d.y+d.height);}if(!Number.isFinite(o))return;let c=4/n;e.save(),e.setLineDash([]),e.strokeStyle=z(H.selection.outline,.9),e.lineWidth=1.5/n,e.beginPath(),e.roundRect(o-c,s-c,a-o+c*2,l-s+c*2,4/n),e.stroke(),e.restore();}drawSelectionOutline(e,t,i){let n=this.getShapeBounds(t);e.strokeStyle=H.selection.outline,e.lineWidth=1/i,e.setLineDash([]),e.save(),e.shadowColor=H.selection.shadow,e.shadowBlur=8,e.shadowOffsetX=0,e.shadowOffsetY=0,e.beginPath(),e.roundRect(n.x-2,n.y-2,n.width+4,n.height+4,4),e.stroke(),e.restore(),t.type!=="table"&&(e.fillStyle=H.selection.outlineFill,e.beginPath(),e.roundRect(n.x-2,n.y-2,n.width+4,n.height+4,4),e.fill());}drawSelectionHandles(e,t,i,n){let o=8/i;if((t.type==="line"||t.type==="arrow")&&t.points&&t.points.length>=2){let a=n?this.getConnectorRoute(t,n):[],l=a.length>=2?a:t.points,c={x:l[0].x-t.x,y:l[0].y-t.y},h={x:l[l.length-1].x-t.x,y:l[l.length-1].y-t.y};e.fillStyle=H.selection.handleFill,e.strokeStyle=H.selection.handleStroke,e.lineWidth=2/i,e.setLineDash([]),[c,h].forEach(d=>{e.beginPath(),e.arc(d.x,d.y,o/2,0,Math.PI*2),e.fill(),e.stroke();});}else {let a=this.getShapeBounds(t),l=o,c=[{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}];e.fillStyle=H.selection.handleFill,e.strokeStyle=H.selection.handleStroke,e.lineWidth=2/i,e.setLineDash([]),c.forEach(p=>{e.beginPath(),e.roundRect(p.x-l/2,p.y-l/2,l,l,2),e.fill(),e.stroke();}),this.drawConnectionDots(e,a,i,1);let h=26/i,d=a.x+a.width/2,u=a.y-h;e.strokeStyle="#94a3b8",e.lineWidth=1.5/i,e.setLineDash([]),e.beginPath(),e.moveTo(d,a.y),e.lineTo(d,u),e.stroke(),e.beginPath(),e.arc(d,u,8/i,0,Math.PI*2),e.fillStyle=H.selection.handleFill,e.fill(),e.strokeStyle=H.primary,e.lineWidth=1.6/i,e.stroke(),this.drawRotateIcon(e,d,u,i);}}drawConnectionDots(e,t,i,n=1){let o=9/i,s=[{x:t.x+t.width/2,y:t.y},{x:t.x+t.width,y:t.y+t.height/2},{x:t.x+t.width/2,y:t.y+t.height},{x:t.x,y:t.y+t.height/2}];e.save(),e.globalAlpha=n,s.forEach(a=>{e.beginPath(),e.arc(a.x,a.y,o,0,Math.PI*2),e.fillStyle=H.selection.handleFill,e.fill(),e.strokeStyle=H.primary,e.lineWidth=1.5/i,e.stroke(),e.beginPath(),e.arc(a.x,a.y,o*.45,0,Math.PI*2),e.fillStyle=H.primary,e.fill();}),e.restore();}drawRotateIcon(e,t,i,n){let o=8/n;e.save(),e.translate(t,i),e.strokeStyle=H.primary,e.lineWidth=1.8/n,e.lineCap="round",e.beginPath(),e.arc(0,0,o*.5,Math.PI*.18,Math.PI*1.6,false),e.stroke();let s=Math.PI*.18,a=Math.cos(s)*o*.5,l=Math.sin(s)*o*.5,c=1;e.beginPath(),e.moveTo(a,l),e.lineTo(a-Math.cos(s)*o*.26+c*Math.sin(s)*o*.16,l-Math.sin(s)*o*.26-c*Math.cos(s)*o*.16),e.moveTo(a,l),e.lineTo(a-Math.cos(s)*o*.26-c*Math.sin(s)*o*.16,l-Math.sin(s)*o*.26+c*Math.cos(s)*o*.16),e.stroke(),e.restore();}getShapeBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":return {x:-e.width/2,y:-e.height/2,width:e.width,height:e.height};case "circle":return {x:-e.radius,y:-e.radius,width:e.radius*2,height:e.radius*2};case "line":case "arrow":{if(e.points.length===0)return {x:0,y:0,width:0,height:0};let t=1/0,i=1/0,n=-1/0,o=-1/0;return e.points.forEach(s=>{t=Math.min(t,s.x-e.x),i=Math.min(i,s.y-e.y),n=Math.max(n,s.x-e.x),o=Math.max(o,s.y-e.y);}),{x:t,y:i,width:n-t,height:o-i}}case "draw":{let t=e;if(typeof t.width=="number"&&typeof t.height=="number")return {x:-t.width/2,y:-t.height/2,width:t.width,height:t.height};if(t.points.length===0)return {x:0,y:0,width:0,height:0};let i=1/0,n=1/0,o=-1/0,s=-1/0;return t.points.forEach(a=>{let l=a.x-t.x,c=a.y-t.y;i=Math.min(i,l),n=Math.min(n,c),o=Math.max(o,l),s=Math.max(s,c);}),{x:i,y:n,width:o-i,height:s-n}}case "text":{let t=e;return {x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}}default:return {x:0,y:0,width:0,height:0}}}};var We={create(r=0,e=0){return {x:r,y:e}},add(r,e){return {x:r.x+e.x,y:r.y+e.y}},subtract(r,e){return {x:r.x-e.x,y:r.y-e.y}},multiply(r,e){return {x:r.x*e,y:r.y*e}},divide(r,e){return {x:r.x/e,y:r.y/e}},dot(r,e){return r.x*e.x+r.y*e.y},length(r){return Math.sqrt(r.x*r.x+r.y*r.y)},normalize(r){let e=We.length(r);return e===0?{x:0,y:0}:{x:r.x/e,y:r.y/e}},distance(r,e){return We.length(We.subtract(r,e))},rotate(r,e){let t=Math.cos(e),i=Math.sin(e);return {x:r.x*t-r.y*i,y:r.x*i+r.y*t}},clone(r){return {x:r.x,y:r.y}},equals(r,e){return r.x===e.x&&r.y===e.y}};function Pe(r,e,t,i=8){let n=[];if(t==="horizontal"){let o=Math.min(r.x,e.x),s=Math.max(r.x+r.width,e.x+e.width),a=Math.abs(r.y-e.y)<=i,l=Math.abs(r.y+r.height-(e.y+e.height))<=i,c=Math.abs(r.y+r.height/2-(e.y+e.height/2))<=i;a&&n.push({type:"horizontal",position:(r.y+e.y)/2,start:o,end:s}),l&&n.push({type:"horizontal",position:(r.y+r.height+e.y+e.height)/2,start:o,end:s}),c&&!(a&&l)&&n.push({type:"horizontal",position:(r.y+r.height/2+e.y+e.height/2)/2,start:o,end:s});}else {let o=Math.min(r.y,e.y),s=Math.max(r.y+r.height,e.y+e.height),a=Math.abs(r.x-e.x)<=i,l=Math.abs(r.x+r.width-(e.x+e.width))<=i,c=Math.abs(r.x+r.width/2-(e.x+e.width/2))<=i;a&&n.push({type:"vertical",position:(r.x+e.x)/2,start:o,end:s}),l&&n.push({type:"vertical",position:(r.x+r.width+e.x+e.width)/2,start:o,end:s}),c&&!(a&&l)&&n.push({type:"vertical",position:(r.x+r.width/2+e.x+e.width/2)/2,start:o,end:s});}return n}var Dt=class r extends X{type="select";state="idle";cellSelectShapeId=null;translatingState=null;resizingState=null;generatingState=null;hoverGenPoint=null;hoverShapeId=null;hoverConnectorId=null;draggingSegment=null;rotatingState=null;draggingArrowId=null;draggingTerminal=null;pendingHistoryCommit=false;brushStart={x:0,y:0};brushShiftKey=false;defaultGenType(e){if(e){let t=this.context.getShapes().find(i=>i.id===e);if(t&&ln(t.type))return t.type}return "rectangle"}genPreviewOf(e,t,i={}){let n=this.context.getArrowStyle();return {from:e.point,to:t,type:i.type,size:i.type?this.genGhostSize(i.type,e.sourceShapeId):void 0,sourceShapeId:e.sourceShapeId,sourceEdge:e.edge,targetShapeId:i.targetShapeId,targetBinding:i.targetBinding,dragging:i.dragging,arrowStyle:{connectionType:"polyline",arrowHead:n.arrowHead,dashed:n.dashed},lineStyle:this.context.getLineStyle()}}genContext(e,t){return {from:e.point,to:t,sourceShapeId:e.sourceShapeId,edge:e.edge}}onPointerDown(e,t){let i=this.context.getShapes(),n=this.context.getSelectedIds(),o=n.length===1?this.hitTestArrowTerminal(e,i):null;if(o&&n.includes(o.shapeId)){this.state="dragging-terminal",this.draggingArrowId=o.shapeId,this.draggingTerminal=o.terminal,this.pendingHistoryCommit=true,this.context.updateArrowBinding(o.shapeId,o.terminal,null);return}let s=n.length===1?this.hitConnectorSegmentHandle(e,i,n):null;if(s){this.state="dragging-segment",this.draggingSegment={...s,startPoint:e,moved:false,...this.segmentSnapContext(s.shapeId,s.route,s.index,s.axis)},this.pendingHistoryCommit=true;return}let a=this.hoverShapeId??this.findHoverAnchorShape(e,i,n),l=this.hitGenPoint(e,i,n,a);if(l){this.state="generating",this.hoverShapeId=a,this.generatingState={source:l,startPoint:e,hasMoved:false,sourceWasSelected:!!l.sourceShapeId&&n.includes(l.sourceShapeId)},this.pendingHistoryCommit=true,this.context.setGenerationPreview(this.genPreviewOf(l,this.genPreviewTarget(l,e,false),{type:this.defaultGenType(l.sourceShapeId)}));return}let c=this.hitTest(e,i,n),h=this.findTableMoveHandleAt(e,i,n);if(h){this.context.selectShape(h.id,t.shiftKey),this.beginTranslating(e,i);return}if(c.handle==="rotation"){this.state="rotating",this.pendingHistoryCommit=true;let d=c.shape;this.rotatingState={shapeId:d.id,center:{x:d.x,y:d.y},startAngle:Math.atan2(e.y-d.y,e.x-d.x),startRotation:d.rotation};return}if(c.handle&&c.shape&&c.shape.type!=="mind-map"){this.state="resizing",this.resizingState={startPoint:e,startShape:c.shape,handle:c.handle},this.pendingHistoryCommit=true;return}if(c.shape){let d=c.shape,u=d.type==="line"||d.type==="arrow",p=n.includes(d.id);if(d.type==="table"){let m=d,f=this.context.getCamera().getZoom();if(!tt(m,e,f)){this.state="selecting-cells",this.cellSelectShapeId=m.id,this.pendingHistoryCommit=false;return}this.context.selectShape(d.id,t.shiftKey);}if(u&&!p){this.context.selectShape(d.id,t.shiftKey);return}if(d.type==="arrow"&&(!!d.startBinding||!!d.endBinding)){this.context.selectShape(d.id,t.shiftKey);return}this.state="translating",this.pendingHistoryCommit=true,p||(this.isInsideGroup(d,n)?this.context.selectShapeRaw(d.id):this.context.selectShape(d.id,t.shiftKey)),this.captureTranslatingStart(e,i),this.translatingState&&(this.translatingState.clickShapeId=d.id,this.translatingState.clickWasSelected=p,this.translatingState.clickShift=t.shiftKey,this.translatingState.moved=false);}else this.state="brushing",this.brushStart=e,this.brushShiftKey=t.shiftKey,t.shiftKey||this.context.selectShape("",false);}isInsideGroup(e,t){let i=e.groupId;if(!i||t.length===0)return false;let n=this.context.getShapes().filter(s=>s.groupId===i);if(n.length===0||t.length>=n.length)return false;let o=new Set(n.map(s=>s.id));return t.every(s=>o.has(s))}findTableMoveHandleAt(e,t,i){let n=this.context.getCamera().getZoom(),o=this.hitTest(e,t,i);if(o.shape&&o.shape.type!=="table")return null;for(let s=t.length-1;s>=0;s--){let a=t[s];if(a.type!=="table"||a.locked)continue;let l=a;if(tt(l,e,n))return l}return null}beginTranslating(e,t){this.state="translating",this.pendingHistoryCommit=true,this.captureTranslatingStart(e,t);}captureTranslatingStart(e,t){let i=this.context.getSelectedIds(),n=new Map,o=new Map,s=new Map,a=new Map,l=new Map;i.forEach(c=>{let h=t.find(d=>d.id===c);if(h&&(n.set(c,{x:h.x,y:h.y}),o.set(c,h.rotation),s.set(c,this.getShapeWorldBounds(h)),(h.type==="line"||h.type==="arrow")&&Array.isArray(h.points))){a.set(c,h.points.map(u=>({x:u.x,y:u.y})));let d=h.userPoints;d?.length&&l.set(c,d.map(u=>({x:u.x,y:u.y})));}}),this.translatingState={startPoint:e,startPositions:n,startRotation:o,startBounds:s,startPoints:a,startUserPoints:l};}onPointerMove(e,t){let i=this.context.getShapes();if(this.state==="translating"&&this.translatingState)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleTranslating(e,t);else if(this.state==="selecting-cells"&&this.cellSelectShapeId){let n=i.find(o=>o.id===this.cellSelectShapeId);if(!n)this.state="idle",this.cellSelectShapeId=null;else {let o=St(n,Ie(n,e));this.context.selectTableCell(this.cellSelectShapeId,o.row,o.col,true);}}else if(this.state==="generating"&&this.generatingState)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleGenerating(e,i);else if(this.state==="rotating"&&this.rotatingState)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleRotating(e,t);else if(this.state==="resizing"&&this.resizingState)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleResizing(e);else if(this.state==="dragging-terminal"&&this.draggingArrowId&&this.draggingTerminal){this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false);let n=i.find(o=>o.id===this.draggingArrowId);if(n){let o=this.draggingTerminal==="start"?e:n.points[n.points.length-1],s=this.draggingTerminal==="start"?n.points[0]:e,a=this.computeSnapGuidesForArrow(o,s,e,n,i);this.context.setSnapGuides(a);let l=e;if(a.length>0){let d=a.filter(p=>p.type==="horizontal"),u=a.filter(p=>p.type==="vertical");if(d.length>0){let p=d[0].position,g=Math.abs(e.y-p);for(let m of d){let f=Math.abs(e.y-m.position);f<g&&(g=f,p=m.position);}l={...l,y:p};}else if(u.length>0){let p=u[0].position,g=Math.abs(e.x-p);for(let m of u){let f=Math.abs(e.x-m.position);f<g&&(g=f,p=m.position);}l={...l,x:p};}}let c=this.draggingTerminal==="start"?0:n.points.length-1,h=[...n.points];h[c]=l,this.context.updateShape(this.draggingArrowId,{points:h});}}else if(this.state==="dragging-segment"&&this.draggingSegment)this.pendingHistoryCommit&&(this.context.commitHistory(),this.pendingHistoryCommit=false),this.handleDraggingSegment(e);else if(this.state==="brushing")this.handleBrushing(e);else {let n=this.context.getSelectedIds(),o=this.hitGenPoint(e,i,n,this.hoverShapeId);o?(this.hoverGenPoint=o,this.context.setGenerationPreview(this.genPreviewOf(o,this.genPreviewTarget(o,e,false),{type:this.defaultGenType(o.sourceShapeId)}))):(this.hoverGenPoint=null,this.context.setGenerationPreview(null));let s=this.findTableMoveHandleAt(e,i,n),a=s?s.id:this.findHoverAnchorShape(e,i,n);a!==this.hoverShapeId&&(this.hoverShapeId=a,this.context.setHoverAnchorShape(a));let l=this.findHoverConnector(e,i,n);l!==this.hoverConnectorId&&(this.hoverConnectorId=l,this.context.setHoverConnector(l));}}onPointerUp(e,t){if(this.state==="translating"&&this.translatingState){let i=this.translatingState;!i.moved&&i.clickWasSelected&&i.clickShapeId&&this.context.getSelectedIds().length>1&&(this.context.selectShape(i.clickShapeId,!!i.clickShift),!i.clickShift&&this.context.getSelectedIds().length>1&&this.context.getSelectedIds().includes(i.clickShapeId)&&this.context.selectShapeRaw(i.clickShapeId));}if(this.state==="dragging-segment"&&this.draggingSegment&&this.finishSegmentDrag(this.draggingSegment.shapeId,this.draggingSegment.autoRoute,this.draggingSegment.moved),this.state==="dragging-terminal"&&this.draggingArrowId&&this.draggingTerminal){let i=this.context.getShapes(),n=this.findBindingNearPoint(e,i,this.draggingArrowId);n&&this.context.updateArrowBinding(this.draggingArrowId,this.draggingTerminal,n.toShapeId,n.binding);}if(this.state==="generating"&&this.generatingState){let i=this.generatingState,n=this.context.getShapes(),o=i.source,s=this.findBindingNearPoint(e,n,o.sourceShapeId);if(s)this.context.connectToExisting(this.genContext(o,e),s.toShapeId,s.binding);else if(!i.hasMoved)i.sourceWasSelected?this.context.createGeneratedConnection(this.genContext(o,this.genPreviewTarget(o,o.point,false)),{type:this.defaultGenType(o.sourceShapeId)}):o.sourceShapeId&&this.context.selectShape(o.sourceShapeId,false);else {let a=this.defaultGenType(o.sourceShapeId),l=this.avoidSourceOverlap(o,e,a),c=this.context.createFloatingLine(this.genContext(o,this.futureDockPoint(o,l,a)));this.context.openGenerationMenu({context:this.genContext(o,l),existingArrowId:c,defaultShapeType:a});}this.generatingState=null;}this.state==="brushing"&&this.context.setBrushRect(null),this.context.setGenerationPreview(null),this.context.setConnectingTarget(null),this.hoverGenPoint=null,this.pendingHistoryCommit=false,this.state="idle",this.draggingArrowId=null,this.draggingTerminal=null,this.draggingSegment=null,this.translatingState=null,this.resizingState=null,this.rotatingState=null,this.cellSelectShapeId=null,this.context.setSnapGuides([]);}isPointOnConnector(e,t,i,n=10){let o=this.context.getConnectorRoute(t),s=o.length>=2?o:i.points;for(let a=1;a<s.length;a++)if(this.pointToLineDistance(e,s[a-1],s[a])<=n)return true;return false}findHoverConnector(e,t,i){for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(o.type!=="arrow"&&o.type!=="line")&&!i.includes(o.id)&&this.isPointOnConnector(e,o.id,o))return o.id}return null}hitConnectorSegmentHandle(e,t,i){for(let n of i){let o=t.find(d=>d.id===n);if(!o||o.type!=="arrow"&&o.type!=="line"||!ut(o))continue;let s=o.connectionType||"straight",a=!!o.userPoints?.length;if(!dt(s==="straight"&&a?"polyline":s))continue;let c=this.context.getConnectorRoute(n);if(c.length<2)continue;let h=On(c,e);if(h)return {shapeId:n,index:h.index,route:c,axis:h.axis}}return null}segmentSnapContext(e,t,i,n){let o=t[i],s=t[i+1],a=new Set;o&&s&&a.add(n==="H"?(o.y+s.y)/2:(o.x+s.x)/2);let l=this.context.getAutoConnectorRoute?.(e)??[];for(let c=0;c+1<l.length;c++){let h=l[c],d=l[c+1];(Math.abs(d.x-h.x)>=Math.abs(d.y-h.y)?"H":"V")===n&&a.add(n==="H"?(h.y+d.y)/2:(h.x+d.x)/2);}return {extraLevels:[...a],autoRoute:l}}segmentCursor(e){return e==="H"?"ns-resize":"ew-resize"}handleDraggingSegment(e){let t=this.draggingSegment;if(!t||Math.hypot(e.x-t.startPoint.x,e.y-t.startPoint.y)<3)return;let i=t.route[t.index],n=t.route[t.index+1],s=Math.abs(n.x-i.x)>=Math.abs(n.y-i.y)?e.y-(i.y+n.y)/2:e.x-(i.x+n.x)/2;t.moved=true,this.writeConnectorRoute(t.shapeId,zn(t.route,t.index,s,t.extraLevels));}writeConnectorRoute(e,t){let i=this.context.getShapes().find(s=>s.id===e);if(!i)return;let n=Ee(Ye(t));if(i.type==="arrow"&&(!!i.startBinding||!!i.endBinding)){let s=this.draggingSegment?.autoRoute??[],a=Wn(Gn(n),s);this.context.updateShape(e,{userPoints:a.length?a:void 0,userPointsRef:a.length?{start:{...n[0]},end:{...n[n.length-1]}}:void 0,userPointsBase:a.length&&s.length>=2?s.map(l=>({...l})):void 0});}else this.context.updateShape(e,{points:n});}finishSegmentDrag(e,t,i){if(!i||!t||t.length<2)return;let n=this.context.getConnectorRoute(e);n.length<2||Un(n,t)&&this.context.updateShape(e,{userPoints:void 0,userPointsRef:void 0,userPointsBase:void 0});}hasTransientState(){return this.state!=="idle"||!!this.generatingState}isDragging(){return this.state==="translating"||this.state==="resizing"||this.state==="rotating"||this.state==="dragging-terminal"||this.state==="dragging-segment"||this.state==="generating"}cancelTransient(){let e=this.state!=="idle"||!!this.generatingState||!!this.hoverGenPoint||!!this.hoverShapeId||!!this.hoverConnectorId||this.pendingHistoryCommit;return this.state="idle",this.generatingState=null,this.translatingState=null,this.resizingState=null,this.rotatingState=null,this.draggingArrowId=null,this.draggingTerminal=null,this.draggingSegment=null,this.pendingHistoryCommit=false,this.hoverGenPoint=null,this.hoverShapeId&&(this.hoverShapeId=null,this.context.setHoverAnchorShape(null)),this.hoverConnectorId&&(this.hoverConnectorId=null,this.context.setHoverConnector(null)),this.context.setGenerationPreview(null),this.context.setConnectingTarget(null),this.context.setSnapGuides([]),e}onKeyDown(e){let t=e.target;if(!(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable))){if(e.key==="Delete"||e.key==="Backspace"){let i=this.context.getShapes(),n=this.context.getSelectedIds().filter(o=>{let s=i.find(a=>a.id===o);return s&&!s.locked});n.length>0&&(this.context.commitHistory(),n.forEach(o=>{this.context.deleteShape(o);}));}e.key==="Escape"&&(this.context.selectShape("",false),this.cancelTransient()),(e.key==="+"||e.key==="=")&&e.shiftKey&&(this.context.commitHistory(),this.handleRotation(15)),e.key==="-"&&e.shiftKey&&(this.context.commitHistory(),this.handleRotation(-15)),e.key==="ArrowUp"&&(e.preventDefault(),this.context.commitHistory(),this.handleNudge(0,-5)),e.key==="ArrowDown"&&(e.preventDefault(),this.context.commitHistory(),this.handleNudge(0,5)),e.key==="ArrowLeft"&&(e.preventDefault(),this.context.commitHistory(),this.handleNudge(-5,0)),e.key==="ArrowRight"&&(e.preventDefault(),this.context.commitHistory(),this.handleNudge(5,0));}}onKeyUp(e){}getCursor(e){switch(this.state){case "translating":return "grabbing";case "generating":return "crosshair";case "rotating":return "grabbing";case "resizing":return this.resizingState?this.getHandleCursor(this.resizingState.handle,this.resizingState.startShape):"default";case "dragging-terminal":return "crosshair";case "dragging-segment":return this.segmentCursor(this.draggingSegment?.axis??"H");case "selecting-cells":return "cell";case "brushing":return "crosshair"}let t=this.context.getShapes(),i=this.context.getSelectedIds(),n=this.hitConnectorSegmentHandle(e,t,i);if(n)return this.segmentCursor(n.axis);if(this.hoverConnectorId||this.context.getMindMapCursorHitAtPoint(e))return "pointer";if(this.hitGenPoint(e,t,i,this.hoverShapeId))return "crosshair";if(this.hitTestArrowTerminal(e,t)&&i.includes(this.hitTestArrowTerminal(e,t).shapeId)||this.findTableMoveHandleAt(e,t,i))return "move";let o=this.hitTest(e,t,i);return o.handle==="rotation"?"grab":o.handle?this.getHandleCursor(o.handle,o.shape):o.shape?o.shape.type==="table"?"cell":"move":null}getHandleCursor(e,t){let n={e:0,se:45,s:90,sw:135,w:180,nw:225,n:270,ne:315}[e];if(n===void 0)return "grab";let o=((n+t.rotation*180/Math.PI)%360+360)%360,s=Math.round(o/45)%4;return ["ew-resize","nwse-resize","ns-resize","nesw-resize"][s]}static ALIGN_SNAP_THRESHOLD=8;handleTranslating(e,t){if(!this.translatingState)return;let i=We.subtract(e,this.translatingState.startPoint),n={...i};if(Math.hypot(i.x,i.y)<r.DRAG_START_THRESHOLD)return;this.translatingState.moved=true,t.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?n.y=0:n.x=0);let o=this.context.getShapes(),s=this.context.getSelectedIds(),a=new Set(s),l=[],c=[];if(this.translatingState.startBounds.forEach(h=>{c.push({x:h.x+n.x,y:h.y+n.y,width:h.width,height:h.height});}),!t.shiftKey&&c.length>0){let h=[];for(let p of o)a.has(p.id)||p.type==="line"||p.type==="arrow"||p.type==="draw"||h.push(this.getShapeWorldBounds(p));let d=[],u=[];for(let p of c){let g=[p.y,p.y+p.height/2,p.y+p.height],m=[p.x,p.x+p.width/2,p.x+p.width];for(let f of h){let b=[f.y,f.y+f.height/2,f.y+f.height];for(let I of g)for(let T of b){let S=T-I;Math.abs(S)<=r.ALIGN_SNAP_THRESHOLD&&d.push(S);}let x=[f.x,f.x+f.width/2,f.x+f.width];for(let I of m)for(let T of x){let S=T-I;Math.abs(S)<=r.ALIGN_SNAP_THRESHOLD&&u.push(S);}}}if(d.length>0){let p=d[0];for(let g of d)Math.abs(g)<Math.abs(p)&&(p=g);n.y+=p;}if(u.length>0){let p=u[0];for(let g of u)Math.abs(g)<Math.abs(p)&&(p=g);n.x+=p;}this.translatingState.startBounds.forEach(p=>{let g={x:p.x+n.x,y:p.y+n.y,width:p.width,height:p.height};for(let m of h)l.push(...Pe(g,m,"horizontal",1)),l.push(...Pe(g,m,"vertical",1));});}this.translatingState.startPositions.forEach((h,d)=>{let u=o.find(m=>m.id===d);if(u&&u.type==="arrow"&&(u.startBinding||u.endBinding))return;let p={x:h.x+n.x,y:h.y+n.y},g=this.translatingState?.startPoints.get(d);if(g){p.points=g.map(f=>({x:f.x+n.x,y:f.y+n.y}));let m=this.translatingState?.startUserPoints.get(d);m&&(p.userPoints=m.map(f=>({x:f.x+n.x,y:f.y+n.y})));}this.context.updateShape(d,p);}),this.context.setSnapGuides(this.mergeGuides(l));}handleResizing(e){if(!this.resizingState)return;let t=this.resizingState.startShape,i=this.resizingState.handle,n=this.resizingState.startPoint;if(!i||i==="rotation")return;let s={nw:[-1,-1],n:[0,-1],ne:[1,-1],w:[-1,0],e:[1,0],sw:[-1,1],s:[0,1],se:[1,1]}[i];if(!s)return;let[a,l]=s,c=We.subtract(e,n),h=[];for(let S of this.context.getShapes())S.id!==t.id&&(S.type==="line"||S.type==="arrow"||S.type==="draw"||h.push(this.getShapeWorldBounds(S)));let d=20,u=this.getShapeWorldBounds(t),p=u.x,g=u.y,m=u.x+u.width,f=u.y+u.height;a===1?m=Math.max(p+d,m+c.x):a===-1&&(p=Math.min(m-d,p+c.x)),l===1?f=Math.max(g+d,f+c.y):l===-1&&(g=Math.min(f-d,g+c.y));let b=(S,w)=>{let C=null;for(let v of w){let k=v-S;Math.abs(k)<=r.ALIGN_SNAP_THRESHOLD&&(C===null||Math.abs(k)<Math.abs(C))&&(C=k);}return C};if(a!==0&&h.length>0){let S=[];for(let C of h)S.push(C.x,C.x+C.width/2,C.x+C.width);let w=b(a===1?m:p,S);w!==null&&(a===1?m+=w:p+=w);}if(l!==0&&h.length>0){let S=[];for(let C of h)S.push(C.y,C.y+C.height/2,C.y+C.height);let w=b(l===1?f:g,S);w!==null&&(l===1?f+=w:g+=w);}let x={x:p,y:g,width:m-p,height:f-g},I=[];for(let S of h)a!==0&&I.push(...Pe(x,S,"vertical",1)),l!==0&&I.push(...Pe(x,S,"horizontal",1));this.context.setSnapGuides(this.mergeGuides(I));let T={};if(t.type==="circle"){let S=Math.max(10,Math.max(a!==0?x.width/2:0,l!==0?x.height/2:0));if(T.radius=S,a!==0){let w=a===1?u.x:u.x+u.width;T.x=a===1?w+S:w-S;}if(l!==0){let w=l===1?u.y:u.y+u.height;T.y=l===1?w+S:w-S;}}else if(t.type==="image"){let S=t,w=S.naturalWidth&&S.naturalHeight?S.naturalWidth/S.naturalHeight:Math.max(1,S.width)/Math.max(1,S.height),C=Math.max(d,x.width),v=Math.max(d,x.height);if(C/v>w?C=v*w:v=C/w,C=Math.max(d,C),v=Math.max(d,v),T.width=C,T.height=v,a!==0){let k=a===1?u.x:u.x+u.width;T.x=a===1?k+C/2:k-C/2;}if(l!==0){let k=l===1?u.y:u.y+u.height;T.y=l===1?k+v/2:k-v/2;}}else {if("width"in t&&a!==0&&(T.width=x.width,T.x=x.x+x.width/2),"height"in t&&l!==0&&(T.height=x.height,T.y=x.y+x.height/2),t.type==="draw"){let S=this.getShapeWorldBounds(t),w=a!==0?x.width/Math.max(1,S.width):1,C=l!==0?x.height/Math.max(1,S.height):1;T.points=t.points.map(v=>({x:v.x*w,y:v.y*C}));}if(t.type==="table"){let S=t,w=a!==0?x.width/Math.max(1,S.width):1,C=l!==0?x.height/Math.max(1,S.height):1;a!==0&&(T.colWidths=S.colWidths.map(v=>Math.max(40,Math.round(v*w)))),l!==0&&Math.abs(C-1)>1e-6&&(T.rowHeights=S.rowHeights.map(v=>Math.max(24,Math.round(v*C))));}}Object.keys(T).length>0&&this.context.updateShape(t.id,T);}mergeGuides(e){let t=new Map;for(let i of e){let n=`${i.type}\0${Math.round(i.position*2)/2}`,o=t.get(n);o?(o.start=Math.min(o.start,i.start),o.end=Math.max(o.end,i.end)):t.set(n,{...i});}return [...t.values()]}handleRotation(e){let t=this.context.getSelectedIds(),i=this.context.getShapes();t.forEach(n=>{let o=i.find(s=>s.id===n);o&&this.context.updateShape(n,{rotation:o.rotation+e*Math.PI/180});});}handleNudge(e,t){let i=this.context.getSelectedIds(),n=this.context.getShapes();i.forEach(o=>{let s=n.find(a=>a.id===o);s&&!s.locked&&this.context.updateShape(o,{x:s.x+e,y:s.y+t});});}handleBrushing(e){let t=Math.min(this.brushStart.x,e.x),i=Math.min(this.brushStart.y,e.y),n=Math.abs(e.x-this.brushStart.x),o=Math.abs(e.y-this.brushStart.y);this.context.setBrushRect({x:t,y:i,width:n,height:o});let s=this.context.getShapes(),a=[];for(let l of s){if(l.locked)continue;let c=this.getShapeWorldBounds(l);this.rectsIntersect({x:t,y:i,width:n,height:o},c)&&a.push(l.id);}if(this.brushShiftKey){let l=this.context.getSelectedIds(),c=new Set([...l,...a]);this.context.selectShapes([...c]);}else this.context.selectShapes(a);}getShapeWorldBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":return {x:e.x-e.width/2,y:e.y-e.height/2,width:e.width,height:e.height};case "circle":return {x:e.x-e.radius,y:e.y-e.radius,width:e.radius*2,height:e.radius*2};case "line":case "arrow":{if(!e.points||e.points.length===0)return {x:e.x,y:e.y,width:0,height:0};let t=1/0,i=1/0,n=-1/0,o=-1/0;return e.points.forEach(s=>{t=Math.min(t,s.x),i=Math.min(i,s.y),n=Math.max(n,s.x),o=Math.max(o,s.y);}),{x:t,y:i,width:n-t,height:o-i}}case "draw":{let t=e,i=t.width,n=t.height;if(typeof i=="number"&&typeof n=="number"&&i>0&&n>0)return {x:t.x-i/2,y:t.y-n/2,width:i,height:n};if(!t.points||t.points.length===0)return {x:t.x,y:t.y,width:0,height:0};let o=1/0,s=1/0,a=-1/0,l=-1/0;return t.points.forEach(c=>{let h=c.x+t.x,d=c.y+t.y;o=Math.min(o,h),s=Math.min(s,d),a=Math.max(a,h),l=Math.max(l,d);}),{x:o,y:s,width:a-o,height:l-s}}case "text":{let t=e;return {x:e.x-t.width/2,y:e.y-t.height/2,width:t.width,height:t.height}}default:{let t=e;return {x:t.x,y:t.y,width:0,height:0}}}}rectsIntersect(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}hitTest(e,t,i){let n=i.length===1;for(let o=t.length-1;o>=0;o--){let s=t[o];if(!s.locked){if(n&&i.includes(s.id)){let a=this.getHitHandle(e,s);if(a)return {shape:s,handle:a}}if(this.isPointInShape(e,s))return {shape:s,handle:null}}}return {shape:null,handle:null}}getHitHandle(e,t){if(t.type==="mind-map")return null;let i=14,n=this.getShapeBounds(t),o=Math.cos(-t.rotation),s=Math.sin(-t.rotation),a=e.x-t.x,l=e.y-t.y,c=a*o-l*s,h=a*s+l*o,d=[{type:"nw",x:n.x,y:n.y},{type:"ne",x:n.x+n.width,y:n.y},{type:"se",x:n.x+n.width,y:n.y+n.height},{type:"sw",x:n.x,y:n.y+n.height},{type:"rotation",x:n.x+n.width/2,y:n.y-26}];for(let u of d)if(Math.abs(c-u.x)<i&&Math.abs(h-u.y)<i)return u.type;return null}static GEN_HIT_THRESHOLD=14;static CLICK_MOVE_THRESHOLD=6;static DRAG_START_THRESHOLD=2;static GEN_GAP=76;static GEN_SUPPORTED_TYPES=new Set(["rectangle","sticky-note","rounded-rectangle","ellipse","diamond","triangle","hexagon","parallelogram","trapezoid","pentagon","octagon","star","uml-class","uml-interface","circle","draw","cylinder","cloud","heart","block-arrow-right","block-arrow-left","block-arrow-up","block-arrow-down","block-arrow-double","right-triangle","cross","speech-rect","speech-round","cube","sector","delay","predefined-process","document","stadium","class-catalog","chevron","brace-left","brace-right","envelope","checkbox","triangular-pyramid","quadrangular-pyramid","cuboid","sphere","ellipsoid","pie","hollow-pie","table"]);computeGenPoints(e,t,i){let n=[],o=new Set(t);i&&o.add(i);for(let s of o){let a=e.find(l=>l.id===s);if(a&&r.GEN_SUPPORTED_TYPES.has(a.type)){let l=this.getShapeBounds(a),c={x:a.x,y:a.y};n.push({point:{x:c.x+l.x+l.width/2,y:c.y+l.y},edge:"n",sourceShapeId:a.id}),n.push({point:{x:c.x+l.x+l.width,y:c.y+l.y+l.height/2},edge:"e",sourceShapeId:a.id}),n.push({point:{x:c.x+l.x+l.width/2,y:c.y+l.y+l.height},edge:"s",sourceShapeId:a.id}),n.push({point:{x:c.x+l.x,y:c.y+l.y+l.height/2},edge:"w",sourceShapeId:a.id});}}return n}hitGenPoint(e,t,i,n){let o=r.GEN_HIT_THRESHOLD,s=null,a=o;for(let l of this.computeGenPoints(t,i,n)){let c=Math.hypot(l.point.x-e.x,l.point.y-e.y);c<=a&&(a=c,s=l);}return s}findHoverAnchorShape(e,t,i){for(let o=t.length-1;o>=0;o--){let s=t[o];if(i.includes(s.id)||s.locked||!r.GEN_SUPPORTED_TYPES.has(s.type))continue;let a=this.getShapeWorldBounds(s);if(!(e.x<a.x-12||e.x>a.x+a.width+12||e.y<a.y-12||e.y>a.y+a.height+12))return s.id}return null}genPreviewTarget(e,t,i){if(i)return t;let{width:n,height:o}=this.genGhostSize(this.defaultGenType(e.sourceShapeId),e.sourceShapeId),s=r.GEN_GAP;if(e.edge)switch(e.edge){case "n":return {x:e.point.x,y:e.point.y-(s+o/2)};case "s":return {x:e.point.x,y:e.point.y+(s+o/2)};case "e":return {x:e.point.x+(s+n/2),y:e.point.y};case "w":return {x:e.point.x-(s+n/2),y:e.point.y}}return {x:e.point.x,y:e.point.y-(s+o/2)}}genGhostShape(e,t,i){let n=i?this.context.getShapes().find(o=>o.id===i):void 0;return Te(e,t,void 0,void 0,cn(e,n))}genGhostSize(e,t){let i=this.getShapeBounds(this.genGhostShape(e,{x:0,y:0},t));return {width:i.width,height:i.height}}handleGenerating(e,t){if(!this.generatingState)return;let i=this.generatingState,n=i.source;Math.hypot(e.x-i.startPoint.x,e.y-i.startPoint.y)>r.CLICK_MOVE_THRESHOLD&&(i.hasMoved=true);let s=this.findBindingNearPoint(e,t,n.sourceShapeId),a=this.defaultGenType(n.sourceShapeId),l=this.avoidSourceOverlap(n,e,a),c=s?this.bindingPosition(s.toShapeId,s.binding,t):i.hasMoved?l:this.genPreviewTarget(n,e,false);this.context.setConnectingTarget(s?s.toShapeId:null),this.context.setGenerationPreview(this.genPreviewOf(n,c,{dragging:i.hasMoved,targetShapeId:s?.toShapeId,targetBinding:s?.binding,type:s?void 0:a}));}handleRotating(e,t){if(!this.rotatingState)return;let i=this.rotatingState,n=Math.atan2(e.y-i.center.y,e.x-i.center.x),o=i.startRotation+(n-i.startAngle);t.shiftKey&&(o=Math.round(o/(Math.PI/12))*(Math.PI/12)),this.context.updateShape(i.shapeId,{rotation:o});}bindingPosition(e,t,i){let n=i.find(s=>s.id===e);if(!n)return {x:0,y:0};let o=this.getShapeWorldBounds(n);if(t.handle)switch(t.handle){case "top":return {x:n.x,y:o.y};case "bottom":return {x:n.x,y:o.y+o.height};case "left":return {x:o.x,y:n.y};case "right":return {x:o.x+o.width,y:n.y}}return t.normalizedAnchor?{x:o.x+o.width*t.normalizedAnchor.x,y:o.y+o.height*t.normalizedAnchor.y}:{x:n.x,y:n.y}}isPointInShape(e,t){let i=e.x-t.x,n=e.y-t.y;switch(t.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":return Math.abs(i)<=t.width/2&&Math.abs(n)<=t.height/2;case "circle":return i*i+n*n<=t.radius*t.radius;case "hexagon":return this.isPointInHexagon(i,n,t.width,t.height);case "line":case "arrow":return this.isPointOnConnector(e,t.id,t);case "draw":{let o=t,s=Math.max((o.style?.strokeWidth??2)/2+3,6/this.context.getCamera().getZoom()),a=o.points||[];for(let l=1;l<a.length;l++)if(this.pointToLineDistance({x:i,y:n},a[l-1],a[l])<=s)return true;return a.length===1&&Math.hypot(i-a[0].x,n-a[0].y)<=s}case "text":return Math.abs(i)<=50&&Math.abs(n)<=t.fontSize/2;default:return false}}isPointInHexagon(e,t,i,n){let o=Math.abs(e),s=Math.abs(t),a=i/2,l=n/2;return o<=a&&s<=l&&o/a+s/l<=1.5}pointToLineDistance(e,t,i){return zt(e,t,i)}avoidSourceOverlap(e,t,i){if(!e.sourceShapeId)return t;let n=this.context.getShapes().find(g=>g.id===e.sourceShapeId);if(!n)return t;let o=this.genGhostShape(i,t,e.sourceShapeId),s=this.getShapeWorldBounds(o),a=this.getShapeWorldBounds(n),l=Math.min(s.x+s.width,a.x+a.width)-Math.max(s.x,a.x),c=Math.min(s.y+s.height,a.y+a.height)-Math.max(s.y,a.y);if(l<=0||c<=0)return t;let h=24,d={...t},u=t.x-n.x,p=t.y-n.y;return Math.abs(u)>=Math.abs(p)?d.x=u>=0?a.x+a.width+h+s.width/2:a.x-h-s.width/2:d.y=p>=0?a.y+a.height+h+s.height/2:a.y-h-s.height/2,d}futureDockPoint(e,t,i){let n=this.genGhostShape(i,t,e.sourceShapeId),o=this.getShapeBounds(n),s=un(e.point,t,e.edge);return wo(t,{width:o.width,height:o.height},s)}getShapeBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":return {x:-e.width/2,y:-e.height/2,width:e.width,height:e.height};case "circle":return {x:-e.radius,y:-e.radius,width:e.radius*2,height:e.radius*2};case "line":case "arrow":{if(e.points.length===0)return {x:0,y:0,width:0,height:0};let t=1/0,i=1/0,n=-1/0,o=-1/0;return e.points.forEach(s=>{t=Math.min(t,s.x-e.x),i=Math.min(i,s.y-e.y),n=Math.max(n,s.x-e.x),o=Math.max(o,s.y-e.y);}),{x:t,y:i,width:n-t,height:o-i}}case "draw":{let t=e;if(typeof t.width=="number"&&typeof t.height=="number")return {x:-t.width/2,y:-t.height/2,width:t.width,height:t.height};if(t.points.length===0)return {x:0,y:0,width:0,height:0};let i=1/0,n=1/0,o=-1/0,s=-1/0;return t.points.forEach(a=>{let l=a.x-t.x,c=a.y-t.y;i=Math.min(i,l),n=Math.min(n,c),o=Math.max(o,l),s=Math.max(s,c);}),{x:i,y:n,width:o-i,height:s-n}}case "text":return {x:-50,y:-e.fontSize/2,width:100,height:e.fontSize};default:return {x:0,y:0,width:0,height:0}}}hitTestArrowTerminal(e,t){for(let n of t){if(n.type!=="arrow")continue;let o=n;if(o.points.length<2)continue;let s=this.context.getConnectorRoute(o.id),a=s.length>=2?s[0]:o.points[0],l=s.length>=2?s[s.length-1]:o.points[o.points.length-1],c=Math.sqrt(Math.pow(e.x-a.x,2)+Math.pow(e.y-a.y,2)),h=Math.sqrt(Math.pow(e.x-l.x,2)+Math.pow(e.y-l.y,2));if(c<20)return {shapeId:o.id,terminal:"start"};if(h<20)return {shapeId:o.id,terminal:"end"}}return null}findShapeNearPoint(e,t,i){for(let o=t.length-1;o>=0;o--){let s=t[o];if(i&&s.id===i||s.type==="arrow"||s.type==="line"||s.type==="draw")continue;let a;switch(s.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":a=this.pointToRectDistance(e,{x:s.x-s.width/2,y:s.y-s.height/2,width:s.width,height:s.height});break;case "circle":a=Math.sqrt(Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2))-s.radius;break;case "hexagon":{let l=s.width/2,c=s.height/2,h=Math.abs(e.x-s.x),d=Math.abs(e.y-s.y);a=h/l+d/c-1;break}default:continue}if(a<=30)return s}return null}pointToRectDistance(e,t){let i=Math.max(t.x,Math.min(e.x,t.x+t.width)),n=Math.max(t.y,Math.min(e.y,t.y+t.height));return Math.sqrt(Math.pow(e.x-i,2)+Math.pow(e.y-n,2))}static SNAP_THRESHOLD=32;static HANDLE_SNAP_DISTANCE=40;static ON_EDGE_SNAP=12;static ANCHOR_EPS=.001;computeSnapGuidesForArrow(e,t,i,n,o){let s=this.draggingTerminal==="start"?n.endBinding:n.startBinding,a=s?o.find(g=>g.id===s.toShapeId):null;if(!a)return [];let l=this.findShapeNearPoint(i,o,n.id);if(!l)return [];let c=this.getShapeWorldBounds(a),h=this.getShapeWorldBounds(l),d=t.x-e.x,u=t.y-e.y,p=Math.abs(d)>=Math.abs(u)?"horizontal":"vertical";return Pe(c,h,p)}findBindingNearPoint(e,t,i){let n,o;for(let a=t.length-1;a>=0;a--){let l=t[a];if(i&&l.id===i||l.type==="arrow"||l.type==="line"||l.type==="draw")continue;let c=this.getPageBounds(l),h={x:l.x,y:l.y},d=[{handle:"top",pos:{x:h.x,y:c.y}},{handle:"bottom",pos:{x:h.x,y:c.y+c.height}},{handle:"left",pos:{x:c.x,y:h.y}},{handle:"right",pos:{x:c.x+c.width,y:h.y}}];for(let m of d){let f=Math.hypot(m.pos.x-e.x,m.pos.y-e.y);f<=r.HANDLE_SNAP_DISTANCE&&(!n||f<n.distance)&&(n={toShapeId:l.id,binding:{toShapeId:l.id,handle:m.handle,isPrecise:false},distance:f});}let u=r.SNAP_THRESHOLD;if(e.x<c.x-u||e.x>c.x+c.width+u||e.y<c.y-u||e.y>c.y+c.height+u)continue;let p=this.nearestPointOnShapeOutline(l,e);if(p&&p.distance<=r.SNAP_THRESHOLD&&!n)if(p.distance<=r.ON_EDGE_SNAP){let m=[{handle:"top",d:Math.abs(p.point.y-c.y)},{handle:"bottom",d:Math.abs(c.y+c.height-p.point.y)},{handle:"left",d:Math.abs(p.point.x-c.x)},{handle:"right",d:Math.abs(c.x+c.width-p.point.x)}];m.sort((b,x)=>b.d-x.d);let f=d.find(b=>b.handle===m[0].handle);n={toShapeId:l.id,binding:{toShapeId:l.id,handle:f.handle,isPrecise:false},distance:Math.hypot(f.pos.x-e.x,f.pos.y-e.y)};}else {let m=this.computeNormalizedAnchor(c,p.point);(!o||p.distance<o.distance)&&(o={toShapeId:l.id,binding:{toShapeId:l.id,isPrecise:true,normalizedAnchor:m},distance:p.distance});}if(e.x>c.x&&e.x<c.x+c.width&&e.y>c.y&&e.y<c.y+c.height&&!n){let m=e.x-(c.x+c.width/2),f=e.y-(c.y+c.height/2),b=Math.abs(m)>=Math.abs(f)?m>=0?"right":"left":f>=0?"bottom":"top";n={toShapeId:l.id,binding:{toShapeId:l.id,handle:b,isPrecise:false},distance:0};}}let s=n??o;if(s)return {toShapeId:s.toShapeId,binding:s.binding}}getPageBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":return {x:e.x-e.width/2,y:e.y-e.height/2,width:e.width,height:e.height};case "circle":return {x:e.x-e.radius,y:e.y-e.radius,width:e.radius*2,height:e.radius*2};default:return {x:e.x-50,y:e.y-50,width:100,height:100}}}computeNormalizedAnchor(e,t){let i=r.ANCHOR_EPS,n=e.width>0?(t.x-e.x)/e.width:.5,o=e.height>0?(t.y-e.y)/e.height:.5;return n=Math.max(i,Math.min(1-i,n)),o=Math.max(i,Math.min(1-i,o)),{x:n,y:o}}nearestPointOnShapeOutline(e,t){let i={x:t.x-e.x,y:t.y-e.y},n=this.nearestLocalPointOnShapeOutline(e,i);if(!n)return null;let o={x:n.point.x+e.x,y:n.point.y+e.y};return {point:o,distance:Math.hypot(o.x-t.x,o.y-t.y)}}nearestLocalPointOnShapeOutline(e,t){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "image":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":{let i=e.width,n=e.height;return this.nearestPointOnRectOutlineLocal(t,{x:-i/2,y:-n/2,width:i,height:n})}case "circle":{let i=e.radius;return this.nearestPointOnCircleOutlineLocal(t,{x:0,y:0},i)}default:return null}}nearestPointOnRectOutlineLocal(e,t){let i=[[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y}],[{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height}],[{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],[{x:t.x,y:t.y+t.height},{x:t.x,y:t.y}]],n=null;for(let[o,s]of i){let a=this.nearestPointOnSegment(e,o,s);(!n||a.distance<n.distance)&&(n=a);}return n}nearestPointOnCircleOutlineLocal(e,t,i){let n=e.x-t.x,o=e.y-t.y,s=Math.hypot(n,o);if(s<1e-9)return {point:{x:t.x+i,y:t.y},distance:i};let a=t.x+n/s*i,l=t.y+o/s*i,c={x:a,y:l};return {point:c,distance:Math.hypot(c.x-e.x,c.y-e.y)}}nearestPointOnSegment(e,t,i){let n=i.x-t.x,o=i.y-t.y,s=n*n+o*o,a=s>0?((e.x-t.x)*n+(e.y-t.y)*o)/s:0;a=Math.max(0,Math.min(1,a));let l=t.x+a*n,c=t.y+a*o,h={x:l,y:c};return {point:h,distance:Math.hypot(h.x-e.x,h.y-e.y)}}};var Ht=class r extends X{type="hand";state="idle";startScreenPoint={x:0,y:0};initialCameraPos={x:0,y:0};static DRAG_THRESHOLD=4;onPointerDown(e,t){this.startScreenPoint={x:t.clientX,y:t.clientY};let i=this.context.getCamera();this.initialCameraPos={x:i.x,y:i.y},this.state="pointing";}onPointerMove(e,t){if(this.state!=="idle"){if(this.state==="pointing"){let i=t.clientX-this.startScreenPoint.x,n=t.clientY-this.startScreenPoint.y;if(Math.hypot(i,n)<r.DRAG_THRESHOLD)return;this.state="dragging",this.applyCameraDelta(i,n);return}if(this.state==="dragging"){let i=t.clientX-this.startScreenPoint.x,n=t.clientY-this.startScreenPoint.y;this.applyCameraDelta(i,n);}}}onPointerUp(e,t){if(this.state!=="idle"){if(this.state==="dragging"){let i=this.context.getCamera();this.initialCameraPos={x:i.x,y:i.y},this.startScreenPoint={x:t.clientX,y:t.clientY};}this.state="idle";}}onKeyDown(e){e.key==="Escape"&&this.state!=="idle"&&(this.context.setCameraPosition(this.initialCameraPos.x,this.initialCameraPos.y),this.state="idle");}onKeyUp(e){}getCursor(e){return this.state==="dragging"||this.state==="pointing"?"grabbing":"grab"}applyCameraDelta(e,t){this.context.setCameraPosition(this.initialCameraPos.x+e,this.initialCameraPos.y+t);}};var ds={strokeColor:"#1f2937",fillColor:"transparent",strokeWidth:2,strokeDash:null},Rt=class extends X{type="line";isDrawing=false;startPoint={x:0,y:0};currentShape=null;onPointerDown(e,t){this.isDrawing=true,this.startPoint=e,this.currentShape={id:`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"line",x:e.x,y:e.y,points:[e],rotation:0,style:{...ds}},this.context.commitHistory(),this.context.addShape(this.currentShape);}onPointerMove(e,t){!this.isDrawing||!this.currentShape||this.context.updateShape(this.currentShape.id,{points:[this.startPoint,e]});}onPointerUp(e,t){let i=this.currentShape;this.isDrawing=false,this.currentShape=null,this.context.setActiveTool("select"),i&&i.points.length>=2&&this.context.selectShape(i.id,false);}onKeyDown(e){}onKeyUp(e){}getCursor(){return "crosshair"}};var us={strokeColor:"#1f2937",fillColor:"transparent",fillOpacity:1,strokeWidth:4,strokeDash:null},ps=.5,gs=16,bn="#ffeb3b",ms=4200,Le=class extends X{type;mode;isDrawing=false;points=[];currentShapeId=null;committed=false;fadeTimer=null;highlighterColor=bn;constructor(e,t){super(e),this.mode=t,this.type=t==="pen"?"pen":"highlighter";}setHighlighterColor(e){this.highlighterColor=e;}getHighlighterColor(){return this.highlighterColor}buildStyle(){return this.mode==="pen"?{...us}:{strokeColor:z(this.highlighterColor,ps),fillColor:"transparent",fillOpacity:1,strokeWidth:gs,strokeDash:null}}onPointerDown(e,t){this.isDrawing=true,this.committed=false,this.currentShapeId=null,this.points=[{...e}];}buildGeometry(e){let t=1/0,i=1/0,n=-1/0,o=-1/0;for(let u of e)u.x<t&&(t=u.x),u.y<i&&(i=u.y),u.x>n&&(n=u.x),u.y>o&&(o=u.y);let s=(t+n)/2,a=(i+o)/2,l=6,c=Math.max(1,n-t)+l*2,h=Math.max(1,o-i)+l*2,d=e.map(u=>({x:u.x-s,y:u.y-a}));return {x:s,y:a,width:c,height:h,points:d}}onPointerMove(e,t){if(this.isDrawing){if(this.points.push({...e}),!this.committed&&this.points.length>=2){this.context.commitHistory();let i=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;this.currentShapeId=i;let n=this.buildGeometry(this.points),o=this.buildStyle(),s={id:i,type:"draw",x:n.x,y:n.y,width:n.width,height:n.height,points:n.points,rotation:0,style:o};this.context.addShape(s),this.committed=true;}else if(this.committed&&this.currentShapeId){let i=this.buildGeometry(this.points);this.context.updateShape(this.currentShapeId,{x:i.x,y:i.y,width:i.width,height:i.height,points:i.points});}}}onPointerUp(e,t){if(!this.isDrawing||(this.isDrawing=false,!this.committed||!this.currentShapeId))return;let i=this.currentShapeId;this.currentShapeId=null,this.mode==="highlighter"&&(this.fadeTimer=setTimeout(()=>{this.context.deleteShape(i);},ms));}onKeyDown(e){}onKeyUp(e){}getCursor(){return "crosshair"}dispose(){this.fadeTimer&&(clearTimeout(this.fadeTimer),this.fadeTimer=null);}};var fs={strokeColor:"#1f2937",fillColor:"transparent",strokeWidth:2,strokeDash:null},ys=4,Et=class extends X{type="arrow";isDrawing=false;startPoint={x:0,y:0};currentShapeId=null;startBindingInfo=null;startBinding;onPointerDown(e,t){this.isDrawing=true,this.startPoint=e,this.startBindingInfo=null,this.currentShapeId=null;let i=this.context.getShapes(),n=this.findShapeBinding(e,i),o=e;n&&(o=this.getBindingPosition(n.toShapeId,n.handle,i),this.startBindingInfo={...n,position:o}),this.startPoint=o,this.startBinding=n?{toShapeId:n.toShapeId,handle:n.handle}:void 0;}onPointerMove(e,t){if(!this.isDrawing)return;let i=this.context.getShapes(),n=this.findShapeBinding(e,i),o=e;n&&(o=this.getBindingPosition(n.toShapeId,n.handle,i));let s=this.startPoint;if(!this.currentShapeId){if(Math.hypot(o.x-s.x,o.y-s.y)<ys)return;let c=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,h=this.context.getArrowStyle(),d={id:c,type:"arrow",x:s.x,y:s.y,points:[s,o],rotation:0,style:{...fs},startBinding:this.startBinding,connectionType:h.connectionType,arrowHead:h.arrowHead,dashed:h.dashed};this.context.commitHistory(),this.context.addShape(d),this.currentShapeId=c;}let a=this.computeSnapGuides(s,o,n,i);this.context.setSnapGuides(a),this.context.updateShape(this.currentShapeId,{points:[s,o],endBinding:n?{toShapeId:n.toShapeId,handle:n.handle}:void 0});}onPointerUp(e,t){let i=this.currentShapeId;this.isDrawing=false,this.currentShapeId=null,this.startBindingInfo=null,this.startBinding=void 0,this.context.setSnapGuides([]),i&&(this.context.setActiveTool("select"),this.context.selectShape(i,false));}onKeyDown(e){}onKeyUp(e){}getCursor(){return "crosshair"}computeSnapGuides(e,t,i,n){let o=this.startBindingInfo?n.find(u=>u.id===this.startBindingInfo.toShapeId):null,s=i?n.find(u=>u.id===i.toShapeId):null;if(!o||!s)return [];let a=this.getShapeBounds(o),l=this.getShapeBounds(s),c=t.x-e.x,h=t.y-e.y,d=Math.abs(c)>=Math.abs(h)?"horizontal":"vertical";return Pe(a,l,d)}getShapeBounds(e){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":return {x:e.x-e.width/2,y:e.y-e.height/2,width:e.width,height:e.height};case "circle":return {x:e.x-e.radius,y:e.y-e.radius,width:e.radius*2,height:e.radius*2};case "text":return {x:e.x-e.width/2,y:e.y-e.height/2,width:e.width,height:e.height};default:return {x:e.x-50,y:e.y-20,width:100,height:40}}}findShapeBinding(e,t){for(let n=t.length-1;n>=0;n--){let o=t[n];if(o.type==="arrow"||o.type==="line"||o.type==="draw")continue;let s;switch(o.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "uml-class":case "uml-interface":s=this.pointToRectDistance(e,{x:o.x-o.width/2,y:o.y-o.height/2,width:o.width,height:o.height});break;case "circle":{let a=Math.sqrt(Math.pow(e.x-o.x,2)+Math.pow(e.y-o.y,2));s=Math.abs(a-o.radius);break}case "hexagon":{let a=o.width/2,l=o.height/2,c=Math.abs(e.x-o.x),h=Math.abs(e.y-o.y);s=c/a+h/l-1;break}default:continue}if(s<=40){let a=this.getClosestHandle(e,o);return {toShapeId:o.id,handle:a}}}}pointToRectDistance(e,t){let i=Math.max(t.x,Math.min(e.x,t.x+t.width)),n=Math.max(t.y,Math.min(e.y,t.y+t.height));return Math.sqrt(Math.pow(e.x-i,2)+Math.pow(e.y-n,2))}getClosestHandle(e,t){let i=e.x-t.x,n=e.y-t.y;if(t.type==="circle"||t.type==="hexagon"){let c=Math.atan2(n,i);return c>=-Math.PI/4&&c<Math.PI/4?"right":c>=Math.PI/4&&c<3*Math.PI/4?"bottom":c>=3*Math.PI/4||c<-(3*Math.PI)/4?"left":"top"}let o="width"in t?t.width:100,s="height"in t?t.height:100,a=Math.abs(i)/(o/2),l=Math.abs(n)/(s/2);return a>l?i>0?"right":"left":n>0?"bottom":"top"}getBindingPosition(e,t,i){let n=i.find(o=>o.id===e);if(!n)return {x:0,y:0};switch(n.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":return this.getRectBindingPosition(n,t);case "circle":return this.getCircleBindingPosition(n,t);case "hexagon":return this.getRectBindingPosition(n,t);default:return {x:n.x,y:n.y}}}getRectBindingPosition(e,t){switch(t){case "top":return {x:e.x,y:e.y-e.height/2};case "bottom":return {x:e.x,y:e.y+e.height/2};case "left":return {x:e.x-e.width/2,y:e.y};case "right":return {x:e.x+e.width/2,y:e.y}}}getCircleBindingPosition(e,t){switch(t){case "top":return {x:e.x,y:e.y-e.radius};case "bottom":return {x:e.x,y:e.y+e.radius};case "left":return {x:e.x-e.radius,y:e.y};case "right":return {x:e.x+e.radius,y:e.y}}}};var bs={strokeColor:"transparent",fillColor:"transparent",strokeWidth:0,strokeDash:null},xn=class extends X{type="text";onPointerDown(e,t){let i=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n={id:i,type:"text",x:e.x,y:e.y,rotation:0,style:{...bs},text:"",fontSize:16,textColor:"#1f2937",width:200,height:24};this.context.commitHistory(),this.context.addShape(n),this.context.enterEditing(i);}onPointerMove(e,t){}onPointerUp(e,t){}onKeyDown(e){}onKeyUp(e){}getCursor(){return "text"}};var Fe="#1f2937";function Sn(r){switch(r.type){case "rectangle":case "image":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "mind-map":case "table":case "text":return {x:-(r.width/2),y:-(r.height/2),width:r.width,height:r.height};case "circle":return {x:-r.radius,y:-r.radius,width:r.radius*2,height:r.radius*2};case "line":case "arrow":{let e=r.points;if(!e||e.length===0)return {x:0,y:0,width:0,height:0};let t=1/0,i=1/0,n=-1/0,o=-1/0;for(let s of e){let a=s.x-r.x,l=s.y-r.y;t=Math.min(t,a),i=Math.min(i,l),n=Math.max(n,a),o=Math.max(o,l);}return {x:t,y:i,width:n-t,height:o-i}}case "draw":{let e=r,t=e.width,i=e.height;if(typeof t=="number"&&typeof i=="number")return {x:-t/2,y:-i/2,width:t,height:i};let n=e.points;if(!n||n.length===0)return {x:0,y:0,width:0,height:0};let o=1/0,s=1/0,a=-1/0,l=-1/0;for(let c of n)o=Math.min(o,c.x),s=Math.min(s,c.y),a=Math.max(a,c.x),l=Math.max(l,c.y);return {x:o,y:s,width:a-o,height:l-s}}default:return {x:0,y:0,width:0,height:0}}}function xs(r){let e=Sn(r),t=Math.cos(r.rotation),i=Math.sin(r.rotation),n=1/0,o=1/0,s=-1/0,a=-1/0,l=[[e.x,e.y],[e.x+e.width,e.y],[e.x+e.width,e.y+e.height],[e.x,e.y+e.height]];for(let[c,h]of l){let d=c*t-h*i+r.x,u=c*i+h*t+r.y;n=Math.min(n,d),o=Math.min(o,u),s=Math.max(s,d),a=Math.max(a,u);}return {x:n,y:o,width:s-n,height:a-o}}function at(r,e=24){if(!r||r.length===0)return {x:0,y:0,width:400,height:300};let t=1/0,i=1/0,n=-1/0,o=-1/0;for(let s of r){let a=xs(s);t=Math.min(t,a.x),i=Math.min(i,a.y),n=Math.max(n,a.x+a.width),o=Math.max(o,a.y+a.height);}return {x:t-e,y:i-e,width:n-t+e*2,height:o-i+e*2}}function Eo(r,e={}){let t=e.padding??24,i=e.background===void 0?"#ffffff":e.background??null,n=at(r,t),o=Math.max(1,Math.ceil(n.width)),s=Math.max(1,Math.ceil(n.height)),a=Math.max(.01,e.scale??2);e.maxSize&&e.maxSize>0&&(a=Math.min(a,e.maxSize/Math.max(o,s))),a=Math.max(.01,a);let l=document.createElement("canvas");l.width=Math.max(1,Math.round(o*a)),l.height=Math.max(1,Math.round(s*a));let c=new Ue(l,a);c.resize(o,s);let h=new Re;return h.zoom=1,h.x=-n.x,h.y=-n.y,c.render(r,h,new Set,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,i),l}function ws(r,e,t){return new Promise((i,n)=>{r.toBlob(o=>{o?i(o):n(new Error("canvas.toBlob failed"));},e,t);})}function Ss(r,e,t){return r.toDataURL(e,t)}var Nt=null;function De(r,e){return Nt||(Nt=document.createElement("canvas").getContext("2d")),Nt?(Nt.font=e,Nt.measureText(r).width):r.length*8}function Me(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Mn(r,e,t,i,n=false){let o=e*1.3,s=Math.max(1,Math.floor(i/o)),a=`${n?"bold ":""}${e}px sans-serif`,l=r.split(`
|
|
6
|
+
`),c=[];for(let d of l){let u="";for(let p of d){let g=u+p;De(g,a)>t&&u?(c.push(u),u=p):u=g;}u&&c.push(u);}let h=c.slice(0,s);if(c.length>s&&h.length>0){let d=h[h.length-1],u="...";for(;d.length>0&&De(d+u,a)>t;)d=d.slice(0,-1);h[h.length-1]=d+u;}return h}function Ai(r,e,t){if(De(r,t)<=e)return r;let i="\u2026",n=0,o=r.length;for(;n<o;){let s=n+o+1>>1;De(r.slice(0,s)+i,t)<=e?n=s:o=s-1;}return r.slice(0,n)+i}function Ae(r){return r.map(([e,t])=>`${M(e)},${M(t)}`).join(" ")}function wn(r){return r.map(e=>e[0]==="Z"?"Z":e[0]==="M"||e[0]==="L"?`${e[0]} ${M(e[1])} ${M(e[2])}`:`C ${M(e[1])} ${M(e[2])} ${M(e[3])} ${M(e[4])} ${M(e[5])} ${M(e[6])}`).join(" ")}function Ms(r){let e=r;if(!e.text||r.type==="text"||r.type==="line"||r.type==="arrow"||r.type==="draw")return "";let t=e.fontSize||16,i=r.type==="brace-left"||r.type==="brace-right",n=r.type==="sticky-note",o=e.width??(e.radius?e.radius*2:100),s=e.height??(e.radius?e.radius*2:40),a=n?Je:.85,l=o*(i?1-Lt:1)*a,c=s*a,h=Mn(String(e.text),t,l,c);return Ri(h,t,e.textColor||Fe,M(yn(r)),0)}function M(r){return Math.round(r*100)/100}var No="drawui-paper-shadow";function Cs(r){let e=M(r.offsetY??0),t=M(r.offsetX??0);return `<filter id="${No}" x="-40%" y="-40%" width="180%" height="180%"><feDropShadow dx="${t}" dy="${e}" stdDeviation="${M(r.blur*.45)}" flood-color="${r.color}" flood-opacity="${M(r.opacity??.2)}" /></filter>`}function Bo(r){return r.strokeDash&&r.strokeDash.length?r.strokeDash.join(","):void 0}function vo(r,e){let t=e.x-r.x,i=e.y-r.y,n=Math.cos(r.rotation),o=Math.sin(r.rotation);return {x:t*n-i*o+r.x,y:t*o+i*n+r.y}}var Di=Tt;function Is(r,e,t){return vt(r,e,t)}function Ts(r,e,t){let i=r.endBinding;if(!i||!i.auto||i.isPrecise)return i;let n=r.startBinding?.handle?Di[r.startBinding.handle]:void 0;return {...i,handle:Is(e,{x:t.x,y:t.y},n)}}function ko(r,e){if(e.isPrecise&&e.normalizedAnchor){let t=Sn(r),i=r.x+t.x+t.width*e.normalizedAnchor.x,n=r.y+t.y+t.height*e.normalizedAnchor.y;return {x:i,y:n}}if(e.handle){let t=Sn(r);switch(e.handle){case "top":return {x:r.x,y:r.y+t.y};case "bottom":return {x:r.x,y:r.y+t.y+t.height};case "left":return {x:r.x+t.x,y:r.y};case "right":return {x:r.x+t.x+t.width,y:r.y}}}return {x:r.x,y:r.y}}function vs(r,e){let t=r.points.map(c=>({...c})),i,n,o,s;if(t.length===0)return {raw:t,pts:t,fromN:i,toN:n};if(r.startBinding){let c=e.get(r.startBinding.toShapeId);c&&(t[0]=ko(c,r.startBinding),!r.startBinding.isPrecise&&r.startBinding.handle&&(i=Di[r.startBinding.handle]),o=Po(c));}if(r.endBinding){let c=e.get(r.endBinding.toShapeId);if(c){let h=Ts(r,t[0],c)??r.endBinding;t[t.length-1]=ko(c,h),!h.isPrecise&&h.handle&&(n=Di[h.handle]),s=Po(c);}}let a=t.map(c=>({...c})),l=t;if(r.userPoints&&r.userPoints.length>0&&t.length>=2){let c=Hi([t[0],t[t.length-1]]),h=r.connectionType||"straight",[d,u]=h==="curve"?[t[0],t[t.length-1]]:c,p=h==="curve"?r.userPoints.map(g=>({...g})):Ut(r.userPoints,r.userPointsRef,d,u,i,n);l=[d,...p,u];}return {raw:a.map(c=>vo(r,c)),pts:l.map(c=>vo(r,c)),fromN:i,toN:n,fromBox:o,toBox:s}}function Po(r){let e=Sn(r);return {x:r.x+e.x,y:r.y+e.y,width:e.width,height:e.height}}function Hi(r){if(r.length<2)return r;let e=r[0],t=r[r.length-1],i=t.x-e.x,n=t.y-e.y,o=8;if(Math.abs(n)<=o){let s=(e.y+t.y)/2;return r.map(a=>({x:a.x,y:s}))}if(Math.abs(i)<=o){let s=(e.x+t.x)/2;return r.map(a=>({x:s,y:a.y}))}return r}function ks(r){if(r.length<2)return "";let e=`M ${M(r[0].x)} ${M(r[0].y)}`,t=r[0];for(let i=1;i<r.length;i++){let n=r[i],o=n.x-t.x,s=n.y-t.y,a=Math.hypot(o,s),l={x:(t.x+n.x)/2,y:(t.y+n.y)/2};if(a>=1){let c=-s/a,h=o/a,d=Math.min(a*.2,30);l={x:l.x+c*d,y:l.y+h*d};}e+=` Q ${M(l.x)} ${M(l.y)} ${M(n.x)} ${M(n.y)}`,t=n;}return e}function Lo(r,e,t,i,n=false,o,s){let a=n&&e==="straight"?"polyline":e;return a==="curve"?r:a==="straight"?r.length===2?Hi(r):r:r.length===2?kt(Hi(r),{fromN:t,toN:i,fromBox:o,toBox:s}):kt(r,{fromN:t,toN:i,fromBox:o,toBox:s},Si,false)}function Ps(r){if(r.length<2)return "";let e=`M ${M(r[0].x)} ${M(r[0].y)}`;for(let t=1;t<r.length;t++)e+=` L ${M(r[t].x)} ${M(r[t].y)}`;return e}function Pi(r,e,t,i){let n=Math.atan2(e.y-r.y,e.x-r.x),o=12,s={x:e.x-o*Math.cos(n-Math.PI/6),y:e.y-o*Math.sin(n-Math.PI/6)},a={x:e.x-o*Math.cos(n+Math.PI/6),y:e.y-o*Math.sin(n+Math.PI/6)};return `<path d="M ${M(e.x)} ${M(e.y)} L ${M(s.x)} ${M(s.y)} M ${M(e.x)} ${M(e.y)} L ${M(a.x)} ${M(a.y)}" stroke="${t}" stroke-width="${i}" stroke-linecap="round" fill="none" />`}function Ao(r,e,t,i){let n=Math.atan2(e.y-r.y,e.x-r.x),o=14,s=e.x,a=e.y,l=e.x-o*Math.cos(n),c=e.y-o*Math.sin(n),h=l+o*.5*Math.cos(n-Math.PI/2),d=c+o*.5*Math.sin(n-Math.PI/2),u=l+o*.5*Math.cos(n+Math.PI/2),p=c+o*.5*Math.sin(n+Math.PI/2);return `<polygon points="${M(s)},${M(a)} ${M(h)},${M(d)} ${M(u)},${M(p)}" fill="#ffffff" stroke="${t}" stroke-width="${i}" />`}function Do(r,e,t,i,n){let o=Math.atan2(e.y-r.y,e.x-r.x),s=14,a=e.x,l=e.y,c=e.x-s*.5*Math.cos(o),h=e.y-s*.5*Math.sin(o),d=e.x-s*Math.cos(o),u=e.y-s*Math.sin(o),p=c+s*.4*Math.cos(o-Math.PI/2),g=h+s*.4*Math.sin(o-Math.PI/2),m=c+s*.4*Math.cos(o+Math.PI/2),f=h+s*.4*Math.sin(o+Math.PI/2);return `<polygon points="${M(a)},${M(l)} ${M(p)},${M(g)} ${M(d)},${M(u)} ${M(m)},${M(f)}" fill="${n?t:"#ffffff"}" stroke="${t}" stroke-width="${i}" />`}function Ls(r,e,t,i){if(e==="none"||r.length<2)return "";let n="";return (e==="start"||e==="both")&&(n+=Pi(r[1],r[0],t,i)),(e==="end"||e==="both")&&(n+=Pi(r[r.length-2],r[r.length-1],t,i)),e==="inheritance"&&(n+=Ao(r[r.length-2],r[r.length-1],t,i)),e==="aggregation"&&(n+=Do(r[1],r[0],t,i,false)),e==="composition"&&(n+=Do(r[1],r[0],t,i,true)),e==="dependency"&&(n+=Pi(r[r.length-2],r[r.length-1],t,i)),e==="realization"&&(n+=Ao(r[r.length-2],r[r.length-1],t,i)),n}function Ri(r,e,t,i=0,n=0){if(r.length===0)return "";let o=e*1.3,a=-(r.length*o)/2+o/2,l=r.map((c,h)=>`<tspan x="${M(i)}" y="${M(n+a+h*o)}">${Me(c)}</tspan>`).join("");return `<text text-anchor="middle" dominant-baseline="central" font-family="sans-serif" font-size="${e}" fill="${t}">${l}</text>`}function F(r,e,t){let i=t??Bo(r),n=e&&r.fillColor!=="transparent",o=r.fillOpacity??1,s=r.strokeOpacity??1;return [n?`fill="${r.fillColor}"`:'fill="none"',n&&o<1?`fill-opacity="${M(o)}"`:"",`stroke="${r.strokeColor}"`,s<1&&r.strokeColor!=="transparent"?`stroke-opacity="${M(s)}"`:"",`stroke-width="${r.strokeWidth}"`,'stroke-linecap="round"','stroke-linejoin="round"',i?`stroke-dasharray="${i}"`:""].filter(Boolean).join(" ")}function Ho(r,e){let{width:t,height:i}=r,n=t/2,o=i/2,s=`${ee}px sans-serif`,a=ge,l=e?0:r.attributes.length>0?r.attributes.length*V+_*2:_*2,c=t-ne*2,h=[];h.push(`<rect x="${M(-n)}" y="${M(-o)}" width="${t}" height="${i}" ${F(r.style,true)} />`),h.push(`<line x1="${M(-n)}" y1="${M(-o+a)}" x2="${M(n)}" y2="${M(-o+a)}" stroke="${r.style.strokeColor}" stroke-width="${r.style.strokeWidth}" />`),e||h.push(`<line x1="${M(-n)}" y1="${M(-o+a+l)}" x2="${M(n)}" y2="${M(-o+a+l)}" stroke="${r.style.strokeColor}" stroke-width="${r.style.strokeWidth}" />`);let d=e?`<<${r.className||"Interface"}>>`:r.className;h.push(`<text text-anchor="middle" dominant-baseline="central" font-family="sans-serif" font-weight="bold" font-size="${ee}" fill="${r.textColor||Fe}" x="0" y="${M(-o+a/2)}">${Me(Ai(d,c,s))}</text>`);let u=(g,m,f,b,x)=>{let I=`${f||ee}px sans-serif`,T=Ai(g,c,I),S=`<text text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-size="${f||ee}" fill="${b||Fe}" x="${M(-n+ne)}" y="${M(m)}">${Me(T)}</text>`;if(x){let w=De(T,I);S+=`<line x1="${M(-n+ne)}" y1="${M(m)}" x2="${M(-n+ne+w)}" y2="${M(m)}" stroke="${b||Fe}" stroke-width="1" />`;}return S};if(!e){let g=-o+a+_+V/2;r.attributes.forEach((m,f)=>{let b=Ne(m);b&&h.push(u(b,g+f*V,m.fontSize||r.fontSize||0,m.textColor||r.textColor||"",!!m.strikethrough));});}let p=-o+a+l+_+V/2;return r.methods.forEach((g,m)=>{let f=xe(g);f&&h.push(u(f,p+m*V,g.fontSize||r.fontSize||0,g.textColor||r.textColor||"",!!g.strikethrough));}),h.join("")}function As(r){let{width:e,height:t}=r,i=e/2,n=t/2,o=Ge(r.cells),s=[];r.style.fillColor!=="transparent"&&s.push(`<rect x="${M(-i)}" y="${M(-n)}" width="${M(e)}" height="${M(t)}" fill="${r.style.fillColor}" />`);for(let l=0;l<r.cells.length;l++)for(let c=0;c<(r.cells[l]?.length??0);c++){if(o[l]?.[c])continue;let h=r.cells[l][c];if(!h.fillColor)continue;let d=ie(r,l,c);s.push(`<rect x="${M(d.ox-i)}" y="${M(d.oy-n)}" width="${M(d.width)}" height="${M(d.height)}" fill="${h.fillColor}" />`);}let a=`stroke="${Qt}" stroke-width="${1}"`;for(let l=1;l<r.rowHeights.length;l++){let c=-n+r.rowHeights.slice(0,l).reduce((d,u)=>d+u,0),h=[];for(let d=0;d<l;d++)for(let u=0;u<(r.cells[d]?.length??0);u++){let g=r.cells[d][u].rowSpan??1;if(g>1&&d+g>l){let m=ie(r,d,u);h.push([m.ox-i,m.ox-i+m.width]);}}for(let[d,u]of Ro(-i,i,h))s.push(`<line x1="${M(d)}" y1="${M(c)}" x2="${M(u)}" y2="${M(c)}" ${a} />`);}for(let l=1;l<r.colWidths.length;l++){let c=-i+r.colWidths.slice(0,l).reduce((d,u)=>d+u,0),h=[];for(let d=0;d<l;d++)for(let u=0;u<r.cells.length;u++){let p=r.cells[u]?.[d];if(!p)continue;let g=p.colSpan??1;if(g>1&&d+g>l){let m=ie(r,u,d);h.push([m.oy-n,m.oy-n+m.height]);}}for(let[d,u]of Ro(-n,n,h))s.push(`<line x1="${M(c)}" y1="${M(d)}" x2="${M(c)}" y2="${M(u)}" ${a} />`);}s.push(`<rect x="${M(-i)}" y="${M(-n)}" width="${M(e)}" height="${M(t)}" ${F(r.style,true)} />`);for(let l=0;l<r.cells.length;l++)for(let c=0;c<(r.cells[l]?.length??0);c++){if(o[l]?.[c])continue;let h=r.cells[l][c];if(!h.text)continue;let d=ie(r,l,c),u=h.fontSize||r.fontSize||14,p=d.width-20,g=Math.max(u*1.3,d.height-8),m=Mn(h.text,u,p,g,!!h.bold),f=h.align==="center"?"middle":h.align==="right"?"end":"start",b=h.align==="center"?d.ox-i+d.width/2:h.align==="right"?d.ox-i+d.width-10:d.ox-i+10,x=h.bold?'font-weight="bold" ':"",I=u*1.3,T=d.oy-n+Mt(m.length,I,d.height);s.push(`<text text-anchor="${f}" dominant-baseline="central" font-family="sans-serif" ${x}font-size="${u}" fill="${h.textColor||r.textColor||en}">${m.map((S,w)=>`<tspan x="${M(b)}" y="${M(T+w*I)}">${Me(S)}</tspan>`).join("")}</text>`);}return s.join("")}function Ro(r,e,t){let i=[...t].sort((s,a)=>s[0]-a[0]),n=[],o=r;for(let[s,a]of i)if(s>o&&n.push([o,Math.min(s,e)]),o=Math.max(o,a),o>=e)break;return o<e&&n.push([o,e]),n.filter(([s,a])=>a-s>=.5)}function Ds(r){let t=N(r.root).positions,i=[],n=s=>{if(s.collapsed)return;let a=t.get(s.id);if(a)for(let l of s.children??[]){let c=t.get(l.id);if(!c)continue;let h=c.direction,d=Be(l,c.depth),u=h==="right"?r.x+a.x+a.width/2:h==="left"?r.x+a.x-a.width/2:r.x+a.x,p=h==="down"?r.y+a.y+a.height/2:h==="up"?r.y+a.y-a.height/2:r.y+a.y,g=h==="right"?r.x+c.x-c.width/2:h==="left"?r.x+c.x+c.width/2:r.x+c.x,m=h==="down"?r.y+c.y-c.height/2:h==="up"?r.y+c.y+c.height/2:r.y+c.y,f;if(h==="right"||h==="left"){let b=(u+g)/2;f=`M ${M(u)} ${M(p)} C ${M(b)} ${M(p)} ${M(b)} ${M(m)} ${M(g)} ${M(m)}`;}else {let b=(p+m)/2;f=`M ${M(u)} ${M(p)} C ${M(u)} ${M(b)} ${M(g)} ${M(b)} ${M(g)} ${M(m)}`;}i.push(`<path d="${f}" stroke="${d}" stroke-width="2" fill="none" stroke-linecap="round" />`),n(l);}};n(r.root);let o=s=>{let a=t.get(s.id);if(!a)return;let l=Be(s,a.depth),c=a.width/2,h=a.height/2,d=r.x+a.x,u=r.y+a.y;if(i.push(`<rect x="${M(d-c)}" y="${M(u-h)}" width="${a.width}" height="${a.height}" rx="6" ry="6" fill="#ffffff" stroke="${l}" stroke-width="2" />`),s.note){let I="11px sans-serif",T=s.noteColor??l,S=Math.min(De(s.note,I)+12,130),w=16,C=De(s.note,I)+12>130?s.note.slice(0,12)+"\u2026":s.note;i.push(`<rect x="${M(d-c)}" y="${M(u-h-w+2)}" width="${S}" height="${w}" rx="4" ry="4" fill="${T}" />`),i.push(`<text text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-size="11" fill="#ffffff" x="${M(d-c+6)}" y="${M(u-h-w/2+2)}">${Me(C)}</text>`);}let p=s.icon?18:0,g=a.width-p-(s.icon?8:0)-16,m=Ai(s.text||"",g,`${14}px sans-serif`),f=De(m,`${14}px sans-serif`),b=p+(p?8:0)+f,x=d-b/2;if(s.icon&&(i.push(`<text text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-size="16" fill="#1f2937" x="${M(x)}" y="${M(u)}">${Me(s.icon)}</text>`),x+=p+8),i.push(`<text text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-size="${14}" fill="#1f2937" x="${M(x)}" y="${M(u)}">${Me(m)}</text>`),s.children&&s.children.length>0&&!s.collapsed)for(let I of s.children)o(I);};return o(r.root),i.join("")}function Hs(r,e){let t=r.rotation*180/Math.PI,i=r.flipX||r.flipY?`<g transform="scale(${r.flipX?-1:1} ${r.flipY?-1:1})">`:"",n=i?"</g>":"",o=`<g transform="translate(${M(r.x)} ${M(r.y)}) rotate(${M(t)})">${i}`,s=`${n}${Ms(r)}</g>`,a=r.style;switch(r.type){case "image":{let l=r,c=l.width??0,h=l.height??0,d=Math.max(0,Math.min(l.borderRadius??0,c/2,h/2)),u=`x="${M(-c/2)}" y="${M(-h/2)}" width="${M(c)}" height="${M(h)}"`;if(!l.src)return `${o}<rect ${u}${d>0?` rx="${M(d)}"`:""} fill="#f3f4f6" stroke="#e5e7eb" />${s}`;let p=Nn(l.src)||l.src,g=`<image href="${Me(p)}" ${u} preserveAspectRatio="none" />`;if(d>0){let m=`dw-img-clip-${String(l.id).replace(/[^a-zA-Z0-9_-]/g,"")}`;return `${o}<defs><clipPath id="${m}"><rect ${u} rx="${M(d)}" /></clipPath></defs><g clip-path="url(#${m})">${g}</g>${s}`}return `${o}${g}${s}`}case "rectangle":{let l=r.width,c=r.height;return `${o}<rect x="${M(-l/2)}" y="${M(-c/2)}" width="${l}" height="${c}" ${F(a,true)} />${s}`}case "rounded-rectangle":{let l=r.width,c=r.height,h=r.borderRadius||8;return `${o}<rect x="${M(-l/2)}" y="${M(-c/2)}" width="${l}" height="${c}" rx="${h}" ry="${h}" ${F(a,true)} />${s}`}case "stadium":{let l=r.width,c=r.height,h=Math.min(l,c)/2;return `${o}<rect x="${M(-l/2)}" y="${M(-c/2)}" width="${l}" height="${c}" rx="${h}" ry="${h}" ${F(a,true)} />${s}`}case "circle":{let l=r.radius;return `${o}<circle cx="0" cy="0" r="${l}" ${F(a,true)} />${s}`}case "ellipse":{let l=r.width,c=r.height;return `${o}<ellipse cx="0" cy="0" rx="${l/2}" ry="${c/2}" ${F(a,true)} />${s}`}case "diamond":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae([[0,-c/2],[l/2,0],[0,c/2],[-l/2,0]])}" ${F(a,true)} />${s}`}case "triangle":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae([[0,-c/2],[l/2,c/2],[-l/2,c/2]])}" ${F(a,true)} />${s}`}case "hexagon":{let l=r.width,c=r.height,h=r.orientation==="flat"?Math.PI/6:0;return `${o}<polygon points="${Ae(Li(l,c,6,-Math.PI/2+h))}" ${F(a,true)} />${s}`}case "pentagon":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae(Li(l,c,5,-Math.PI/2))}" ${F(a,true)} />${s}`}case "octagon":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae(Li(l,c,8,-Math.PI/8))}" ${F(a,true)} />${s}`}case "star":{let l=r.width,c=r.height;return `${o}<polygon points="${Ae(Rs(l,c))}" ${F(a,true)} />${s}`}case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "sticky-note":{let l=r.width,c=r.height,h=At(r.type);if(!h)return "";let d=h.shadow?` filter="url(#${No})"`:"",u=`<path d="${wn(de(h.outline,l,c))}" ${F(a,!h.strokeOnly)}${d} />`,p=(h.overlays??[]).map(b=>{let x=b.fill??"auto",I=x==="none"?"transparent":x==="auto"?b.deriveFill?b.deriveFill(a.fillColor):a.fillColor:x,T={...a,fillColor:I,strokeColor:b.stroke===false?"transparent":a.strokeColor};return `<path d="${wn(de(b.cmds,l,c))}" ${F(T,x!=="none")} />`}).join(""),g=(h.seams??[]).map(b=>`<path d="${wn(de(b,l,c))}" ${F({...a,fillColor:"transparent"},true)} />`).join(""),m=`${M(a.strokeWidth*st[0])},${M(a.strokeWidth*st[1])}`,f=(h.hiddenSeams??[]).map(b=>`<path d="${wn(de(b,l,c))}" ${F({...a,fillColor:"transparent"},true,m)} />`).join("");return `${o}${u}${p}${g}${f}${s}`}case "icon":{let l=r.width,c=r.height,h=$e(r.iconId);if(!h)return `${o}${s}`;let d=a.fillColor!=="transparent"?a.fillColor:Fe,u=[];h.disc&&u.push(`<circle cx="${K/2}" cy="${K/2}" r="${K/2-1}" fill="${h.disc}" />`);for(let g of h.layers){let m=g.fill??"ink",f=g.stroke??"ink",b=[m==="none"?'fill="none"':`fill="${m==="ink"?d:m}"`,f==="none"?"":`stroke="${f==="ink"?d:f}" stroke-width="${g.w??1.8}" stroke-linecap="round" stroke-linejoin="round"`].filter(Boolean).join(" ");u.push(`<path d="${g.d}" ${b} />`);}let p=h.label;return p&&u.push(`<text x="${K/2}" y="${K/2+.5}" text-anchor="middle" dominant-baseline="central" font-family="sans-serif" font-size="${p.size??13}" fill="${p.color}">${Me(p.text)}</text>`),`${o}<g transform="translate(${M(-l/2)} ${M(-c/2)}) scale(${M(l/K)} ${M(c/K)})">${u.join("")}</g>${s}`}case "parallelogram":{let l=r.width,c=r.height,h=l*.2;return `${o}<polygon points="${Ae([[-l/2+h,-c/2],[l/2,-c/2],[l/2-h,c/2],[-l/2,c/2]])}" ${F(a,true)} />${s}`}case "trapezoid":{let l=r.width,c=r.height,h=r.topInset??l*.15;return `${o}<polygon points="${Ae([[-l/2+h,-c/2],[l/2-h,-c/2],[l/2,c/2],[-l/2,c/2]])}" ${F(a,true)} />${s}`}case "uml-class":return `${o}${Ho(r,false)}${s}`;case "uml-interface":return `${o}${Ho(r,true)}${s}`;case "table":return `${o}${As(r)}${s}`;case "mind-map":return Ds(r);case "line":case "arrow":{let l=r,c=l.connectionType||"straight",{raw:h,pts:d,fromN:u,toN:p,fromBox:g,toBox:m}=vs(l,e);if(d.length<2)return "";let f=!!(l.userPoints&&l.userPoints.length),b=Lo(h,c,u,p,false,g,m),x=b;if(f){let P=Lo(d,c,u,p,true,g,m);Wt({userRoute:P,autoRoute:b,base:l.userPointsBase,fromBox:g,toBox:m})||(x=c==="curve"?P:Ee(P));}if(x.length<2)return "";let I=l.style.strokeColor,T=l.style.strokeWidth,w=l.type==="arrow"&&(!!l.dashed||l.arrowHead==="dependency"||l.arrowHead==="realization")?"8,5":Bo(l.style),v=`<path d="${c==="curve"?ks(x):Ps(x)}" fill="none" stroke="${I}" stroke-width="${T}" stroke-linecap="round" stroke-linejoin="round"${w?` stroke-dasharray="${w}"`:""} />`,k=Ls(x,l.arrowHead||"end",I,T);return `${v}${k}`}case "draw":{let l=r,c=l.points;if(!c||c.length<2)return "";let h=Math.cos(l.rotation||0),d=Math.sin(l.rotation||0),u=c.map(g=>({x:g.x*h-g.y*d+l.x,y:g.x*d+g.y*h+l.y}));if(u.length<2)return "";let p=`M ${M(u[0].x)} ${M(u[0].y)}`;for(let g=1;g<u.length-1;g++){let m=(u[g].x+u[g+1].x)/2,f=(u[g].y+u[g+1].y)/2;p+=` Q ${M(u[g].x)} ${M(u[g].y)} ${M(m)} ${M(f)}`;}return p+=` L ${M(u[u.length-1].x)} ${M(u[u.length-1].y)}`,`<path d="${p}" fill="none" stroke="${a.strokeColor}" stroke-width="${a.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" />`}case "text":{let l=r,c=l.fontSize||16,h=l.textColor||Fe,d=Mn(l.text||"",c,l.width,l.height),u="";if(l.highlightColor&&l.highlightColor!=="transparent"){let p=c*.15,g=typeof l.highlightOpacity=="number"?l.highlightOpacity:1,m=g<1?` fill-opacity="${M(g)}"`:"";u+=`<rect x="${M(-l.width/2-p)}" y="${M(-(d.length*c*1.3)/2-p)}" width="${l.width+p*2}" height="${d.length*c*1.3+p*2}" rx="4" fill="${l.highlightColor}"${m} />`;}return u+=Ri(d,c,h),`${o}${u}${s}`}default:{let l=r,c=l.width||100,h=l.height||40,d="";if(l.text){let u=l.fontSize||16,p=Mn(l.text,u,c*.85,h*.85);d+=Ri(p,u,l.textColor||Fe);}return `${o}<rect x="${M(-c/2)}" y="${M(-h/2)}" width="${c}" height="${h}" ${F(a,true)} />${d}${s}`}}}function Li(r,e,t,i){let n=r/2,o=e/2,s=[];for(let a=0;a<t;a++){let l=a*2*Math.PI/t+i;s.push([n*Math.cos(l),o*Math.sin(l)]);}return s}function Rs(r,e){let t=r/2,i=e/2,n=5,o=.4,s=[];for(let a=0;a<n*2;a++){let l=a*Math.PI/n-Math.PI/2,c=a%2===0?1:o;s.push([t*c*Math.cos(l),i*c*Math.sin(l)]);}return s}function _o(r,e={}){let t=e.padding??24,i=e.background===void 0?"#ffffff":e.background??null,n=at(r,t),o=Math.max(1,Math.ceil(n.width)),s=Math.max(1,Math.ceil(n.height)),a=new Map(r.map(u=>[u.id,u])),l=r.map(u=>Hs(u,a)).filter(Boolean).join(`
|
|
7
|
+
`),c=i?`<rect x="${M(n.x)}" y="${M(n.y)}" width="${o}" height="${s}" fill="${i}" />`:"",h=r.map(u=>At(u.type)?.shadow).find(u=>!!u),d=h?`<defs>${Cs(h)}</defs>`:"";return `<?xml version="1.0" encoding="UTF-8"?>
|
|
8
8
|
<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${s}" viewBox="${M(n.x)} ${M(n.y)} ${o} ${s}" font-family="sans-serif">
|
|
9
9
|
${d?` ${d}
|
|
10
10
|
`:""} ${c}
|
|
11
11
|
${l}
|
|
12
|
-
</svg>`}function
|
|
12
|
+
</svg>`}function Bt(r){return r.toString().padStart(10,"0")}function Es(r,e,t){let i=r.split(",")[1]||"",n=atob(i),o=new Uint8Array(n.length);for(let C=0;C<n.length;C++)o[C]=n.charCodeAt(C);let s=Math.round(e),a=Math.round(t),l=`<< /Type /XObject /Subtype /Image /Width ${s} /Height ${a} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${o.length} >>`,c=`q ${s} 0 0 ${a} 0 0 cm /Im0 Do Q`,h=`1 0 obj
|
|
13
13
|
<< /Type /Catalog /Pages 2 0 R >>
|
|
14
14
|
endobj
|
|
15
15
|
`,d=`2 0 obj
|
|
@@ -30,29 +30,29 @@ ${c}
|
|
|
30
30
|
endstream
|
|
31
31
|
endobj
|
|
32
32
|
`,f=`%PDF-1.4
|
|
33
|
-
`,b=f.length,x=b+h.length,I=x+d.length,T=I+u.length,
|
|
33
|
+
`,b=f.length,x=b+h.length,I=x+d.length,T=I+u.length,S=T+p.length+o.length+g.length,w=`xref
|
|
34
34
|
0 6
|
|
35
35
|
0000000000 65535 f
|
|
36
|
-
`+
|
|
37
|
-
`+
|
|
38
|
-
`+
|
|
39
|
-
`+
|
|
40
|
-
`+
|
|
36
|
+
`+Bt(b)+` 00000 n
|
|
37
|
+
`+Bt(x)+` 00000 n
|
|
38
|
+
`+Bt(I)+` 00000 n
|
|
39
|
+
`+Bt(T)+` 00000 n
|
|
40
|
+
`+Bt(S)+` 00000 n
|
|
41
41
|
trailer
|
|
42
42
|
<< /Size 6 /Root 1 0 R >>
|
|
43
43
|
startxref
|
|
44
|
-
${
|
|
45
|
-
%%EOF`;return new Blob([f+h+d+u+p,o,g+m+S],{type:"application/pdf"})}async function Mn(r,e,t={}){r.some(s=>s.type==="image")&&await Rn(r);let i=r.filter(s=>s.type==="icon").map(s=>s.iconId);if(i.length>0&&await mt(i),e==="svg"){let s=Bo(r,t);return new Blob([s],{type:"image/svg+xml;charset=utf-8"})}let n=Ro(r,t);if(e==="png")return xs(n,"image/png");let o=ws(n,"image/jpeg",.92);return Rs(o,n.width,n.height)}function Cn(r,e){let t=URL.createObjectURL(r),i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(t),1e3);}function Es(r,e){return !r||!e?r===e:r.length!==e.length?false:r.every((t,i)=>t===e[i])}var Ns=360,_o={width:320,height:240},Ri="drawui-canvas-data",Bs=50,Ei=()=>typeof performance<"u"?performance.now():Date.now(),Ni=class{canvas;renderer;camera;tools=new Map;activeTool="select";shapes=[];selectedIds=[];listeners=new Set;notificationListeners=new Set;uiListeners=new Set;isPanning=false;panStart={x:0,y:0};dragStartPositions=new Map;interactionDragging=false;lastClickTime=0;lastClickShapeId=null;editingShapeId=null;textInput=null;textOverlay=null;isNewTextShape=false;originalTextValue="";undoStack=[];redoStack=[];isUndoing=false;brushRect=null;snapGuides=[];connectingTargetId=null;genPreview=null;hoverAnchorShapeId=null;hoverConnectorId=null;hoverLockedShapeId=null;eraserPoint=null;eraseFades=new Map;eraseFadeRaf=null;mindMapEditingShapeId=null;mindMapSelectedNode=null;mindMapHoverNode=null;pendingMindMapHandle=null;mindMapNodeDragCandidate=null;isNodeDragging=false;mindMapReorderTarget=null;mindMapReparentPlan=null;tableSelection=null;tableEditing=null;renderScheduled=false;pointerIsDown=false;notifyScheduled=false;persist=true;arrowStyle={connectionType:"straight",arrowHead:"end",dashed:false};stickyNoteColor=qt;imageUploadOption=null;removeImageReadyListener=null;ownImageUrls=new Set;imageInsertSeq=0;imagePasteHandled=false;iconInsertSeq=0;clipboardShapes=[];pasteSeq=0;copiedStyle=null;constructor(e,t={}){this.canvas=e,this.persist=t.persist??!t.shapes,t.theme&&Wt(t.theme),t.language&&Kt(t.language);let i=e.getBoundingClientRect();this.renderer=new Ge(e),this.renderer.resize(i.width,i.height),this.camera=new Re,this.imageUploadOption=t.imageUpload??null,this.removeImageReadyListener=Dn(()=>this.requestRender()),window.addEventListener("paste",this.handlePasteEvent);let n={addShape:o=>this.addShape(o),updateShape:(o,s)=>this.updateShape(o,s),deleteShape:o=>this.deleteShape(o),eraseShape:o=>this.eraseShape(o),selectShape:(o,s)=>this.selectShape(o,s),selectShapeRaw:o=>this.selectShapeRaw(o),selectShapes:o=>this.selectShapes(o),getShapes:()=>[...this.shapes],getSelectedIds:()=>[...this.selectedIds],setActiveTool:o=>this.setActiveTool(o),screenToPage:o=>this.screenToPage(o),getCamera:()=>this.camera,panBy:(o,s)=>this.panBy(o,s),setCameraPosition:(o,s)=>this.setCameraPosition(o,s),getShapeAtPoint:(o,s)=>this.getShapeAtPoint(o,s),getShapesInBrushRadius:(o,s)=>this.getShapesInBrushRadius(o,s),setEraserPoint:o=>this.setEraserPoint(o),updateArrowBinding:(o,s,a,l)=>this.updateArrowBinding(o,s,a,l),enterEditing:o=>this.enterEditing(o),exitEditing:()=>this.exitEditing(),commitHistory:()=>this.commitHistory(),setBrushRect:o=>this.setBrushRect(o),setSnapGuides:o=>this.setSnapGuides(o),setConnectingTarget:o=>this.setConnectingTarget(o),setGenerationPreview:o=>this.setGenerationPreview(o),setHoverAnchorShape:o=>this.setHoverAnchorShape(o),setHoverConnector:o=>this.setHoverConnector(o),getConnectorRoute:o=>this.getConnectorRoute(o),getAutoConnectorRoute:o=>this.getAutoConnectorRoute(o),getLineStyle:()=>this.lineStyle(),openGenerationMenu:o=>this.openGenerationMenu(o),createGeneratedConnection:(o,s)=>this.createGeneratedConnection(o,s),createFloatingLine:o=>this.createFloatingLine(o),connectToExisting:(o,s,a)=>this.connectToExisting(o,s,a),updateSelectedShapesStyle:o=>this.updateSelectedShapesStyle(o),updateSelectedShapesText:o=>this.updateSelectedShapesText(o),updateConnectionType:o=>this.updateConnectionType(o),getArrowStyle:()=>this.getArrowStyle(),getStickyNoteColor:()=>this.getStickyNoteColor(),getMindMapCursorHitAtPoint:o=>this.getMindMapCursorHitAtPoint(o),selectMindMapNode:(o,s)=>this.selectMindMapNode(o,s),selectTableCell:(o,s,a,l)=>this.selectTableCell(o,s,a,l)};this.tools.set("select",new At(n)),this.tools.set("hand",new Dt(n)),this.tools.set("rectangle",new A(n,"rectangle")),this.tools.set("rounded-rectangle",new A(n,"rounded-rectangle")),this.tools.set("circle",new A(n,"circle")),this.tools.set("ellipse",new A(n,"ellipse")),this.tools.set("diamond",new A(n,"diamond")),this.tools.set("triangle",new A(n,"triangle")),this.tools.set("hexagon",new A(n,"hexagon")),this.tools.set("parallelogram",new A(n,"parallelogram")),this.tools.set("trapezoid",new A(n,"trapezoid")),this.tools.set("pentagon",new A(n,"pentagon")),this.tools.set("octagon",new A(n,"octagon")),this.tools.set("star",new A(n,"star")),this.tools.set("cylinder",new A(n,"cylinder")),this.tools.set("cloud",new A(n,"cloud")),this.tools.set("heart",new A(n,"heart")),this.tools.set("block-arrow-right",new A(n,"block-arrow-right")),this.tools.set("block-arrow-left",new A(n,"block-arrow-left")),this.tools.set("block-arrow-up",new A(n,"block-arrow-up")),this.tools.set("block-arrow-down",new A(n,"block-arrow-down")),this.tools.set("block-arrow-double",new A(n,"block-arrow-double")),this.tools.set("right-triangle",new A(n,"right-triangle")),this.tools.set("cross",new A(n,"cross")),this.tools.set("speech-rect",new A(n,"speech-rect")),this.tools.set("speech-round",new A(n,"speech-round")),this.tools.set("cube",new A(n,"cube")),this.tools.set("sector",new A(n,"sector")),this.tools.set("delay",new A(n,"delay")),this.tools.set("predefined-process",new A(n,"predefined-process")),this.tools.set("document",new A(n,"document")),this.tools.set("stadium",new A(n,"stadium")),this.tools.set("class-catalog",new A(n,"class-catalog")),this.tools.set("chevron",new A(n,"chevron")),this.tools.set("brace-left",new A(n,"brace-left")),this.tools.set("brace-right",new A(n,"brace-right")),this.tools.set("envelope",new A(n,"envelope")),this.tools.set("checkbox",new A(n,"checkbox")),this.tools.set("triangular-pyramid",new A(n,"triangular-pyramid")),this.tools.set("quadrangular-pyramid",new A(n,"quadrangular-pyramid")),this.tools.set("cuboid",new A(n,"cuboid")),this.tools.set("sphere",new A(n,"sphere")),this.tools.set("ellipsoid",new A(n,"ellipsoid")),this.tools.set("pie",new A(n,"pie")),this.tools.set("hollow-pie",new A(n,"hollow-pie")),this.tools.set("sticky-note",new A(n,"sticky-note")),this.tools.set("icon",new A(n,"icon")),this.tools.set("image",new A(n,"image")),this.tools.set("uml-class",new A(n,"uml-class")),this.tools.set("uml-interface",new A(n,"uml-interface")),this.tools.set("line",new Ht(n)),this.tools.set("arrow",new Rt(n)),this.tools.set("text",new bn(n)),this.tools.set("pen",new Le(n,"pen")),this.tools.set("highlighter",new Le(n,"highlighter")),this.tools.set("eraser",new un(n)),this.tools.set("mind-map",new A(n,"mind-map")),this.tools.set("table",new A(n,"table")),this.setupEventListeners(),t.shapes?this.shapes=t.shapes.map(o=>({...o,style:{...o.style}})):this.persist&&this.loadFromStorage(),this.render();}setupEventListeners(){this.canvas.addEventListener("pointerdown",this.handlePointerDown),this.canvas.addEventListener("pointerleave",this.handlePointerUp),window.addEventListener("pointermove",this.handlePointerMove),window.addEventListener("pointerup",this.handlePointerUp),window.addEventListener("pointercancel",this.handlePointerUp),window.addEventListener("blur",this.handleWindowBlur),window.addEventListener("pointerdown",this.handleGlobalPointerDown,true),this.canvas.addEventListener("wheel",this.handleWheel,{passive:false}),window.addEventListener("keydown",this.handleKeyDown),window.addEventListener("keyup",this.handleKeyUp),window.addEventListener("resize",this.handleResize);}handleWindowBlur=()=>{this.pointerIsDown=false,this.isPanning=false,this.cancelTransientInteraction(),this.scheduleRender();};handleGlobalPointerDown=e=>{e.target!==this.canvas&&(!e.isPrimary||e.button!==0||(this.pointerIsDown=false,this.isPanning=false,this.cancelTransientInteraction()&&this.scheduleRender()));};shouldRecoverTransient(){let e=this.tools.get(this.activeTool);return !!this.connectingTargetId||this.snapGuides.length>0||!!this.brushRect||!!e&&e.hasTransientState()}cancelTransientInteraction(){let e=!!this.tools.get(this.activeTool)?.cancelTransient(),t=this.clearTransientPreview();return e||t}handlePointerDown=e=>{if(e.button===2){this.clearTransientPreview();return}if(this.editingShapeId)return this.textInput&&e.target===this.textInput,void 0;this.clearTransientPreview(),this.pointerIsDown=true;try{this.canvas.hasPointerCapture(e.pointerId)||this.canvas.setPointerCapture(e.pointerId);}catch{}if(e.button===1||e.button===0&&e.altKey){this.isPanning=true,this.panStart={x:e.clientX,y:e.clientY},this.canvas.setPointerCapture(e.pointerId),this.canvas.style.cursor="grabbing";return}let t=this.screenToPage({x:e.clientX,y:e.clientY});if(this.activeTool==="select"){let s=this.lockBadgeAtPoint(t);if(s){this.unlockFromBadge(s);return}}let i=this.activeTool==="select"?this.getMindMapCollapseHitAtPoint(t):null;if(i){this.toggleMindMapCollapse(i.shapeId,i.nodeId);return}let n=this.activeTool==="select"?this.getMindMapHandleAtPoint(t):null;if(n){this.pendingMindMapHandle=n;return}if(this.activeTool==="select"){let s=Date.now(),a=this.getShapeAtPoint(t);if(s-this.lastClickTime<400&&this.lastClickShapeId&&a&&!a.locked&&a.id===this.lastClickShapeId&&this.canEditShape(a)){this.enterEditing(a.id),this.lastClickTime=0,this.lastClickShapeId=null;return}if(this.lastClickTime=s,this.lastClickShapeId=a&&!a.locked?a.id:null,a&&a.type==="mind-map"){let l=this.getMindMapNodeBoxAtPoint(t);if(l&&l.shapeId===a.id){this.lastClickTime=s,this.lastClickShapeId=a.id,this.selectedIds.includes(a.id)||(this.selectedIds=[a.id]),this.mindMapSelectedNode=l;let h=Be(a.root,l.nodeId);this.mindMapNodeDragCandidate={shapeId:l.shapeId,nodeId:l.nodeId,startPage:t,direction:h?.direction??"right",siblingIds:h?.siblings.map(d=>d.id)??[]},this.notifyListeners(),this.render();return}this.mindMapSelectedNode&&this.mindMapSelectedNode.shapeId===a.id&&(this.mindMapSelectedNode=null,this.scheduleRender());}if(a&&!a.locked&&(this.dragStartPositions.clear(),this.selectedIds.forEach(l=>{let c=this.shapes.find(h=>h.id===l);c&&this.dragStartPositions.set(l,{x:c.x,y:c.y});}),a.type==="table"&&!this.isTableMoveHandleHit(a.id,t))){let l=this.getTableAtPoint(t);l&&this.selectTableCell(l.shapeId,l.row,l.col,e.shiftKey);}}this.tools.get(this.activeTool)?.onPointerDown(t,e),this.updateCursor(t),this.render();};handlePointerMove=e=>{if(this.editingShapeId||(e.buttons===0&&this.pointerIsDown&&(this.pointerIsDown=false,this.setInteractionDragging(false),this.shouldRecoverTransient()&&(this.cancelTransientInteraction(),this.scheduleRender())),!this.pointerIsDown&&this.shouldRecoverTransient()&&this.cancelTransientInteraction(),!this.pointerIsDown&&e.target!==this.canvas))return;if(this.isPanning){let n=e.clientX-this.panStart.x,o=e.clientY-this.panStart.y;this.camera.translate(n,o),this.panStart={x:e.clientX,y:e.clientY},this.scheduleRender(),this.notifyListeners(),this.setInteractionDragging(false);return}let t=this.screenToPage({x:e.clientX,y:e.clientY});if(this.mindMapNodeDragCandidate){let{shapeId:n,nodeId:o,startPage:s,direction:a,siblingIds:l}=this.mindMapNodeDragCandidate,c=t.x-s.x,h=t.y-s.y;if(!this.isNodeDragging){if(Math.abs(c)<5&&Math.abs(h)<5)return;this.isNodeDragging=true;}let d=this.shapes.find(u=>u.id===n);if(d&&d.type==="mind-map"){let u=d,p=this.pageToMindMapLocal(u,t),m=N(u.root).positions,f=this.hitMindMapNodeBox(u.root,m,p,o,0),b=f?null:this.hitMindMapNodeBox(u.root,m,p,o);if(f){let S=this.mindMapChildGroup(u.root,m,f,p),C=S.childIds.length?this.calcMindMapReorderTarget(m,S.childIds,S.direction,p.x,p.y,o):0;this.mindMapReparentPlan={shapeId:n,nodeId:o,mode:"child",targetParentId:f,direction:S.direction,insertIndex:C},this.setReorderIndicator({shapeId:n,nodeId:o,targetIndex:C,direction:S.direction,siblingIds:this.mindMapSortByCross(S.childIds,S.direction,m),childParentId:f}),this.updateCursor(t),this.setInteractionDragging(this.isNodeDragging);return}let x=b?Be(u.root,b):null,I=Be(u.root,o),T=!!x&&!!I&&x.parent.id===I.parent.id&&x.direction===I.direction;if(x&&!T){let S=x.siblings.map(v=>v.id),C=this.calcMindMapReorderTarget(m,S,x.direction,p.x,p.y,o);this.mindMapReparentPlan={shapeId:n,nodeId:o,mode:"sibling",targetParentId:x.parent.id,direction:x.direction,insertIndex:C},this.setReorderIndicator({shapeId:n,nodeId:o,targetIndex:C,direction:x.direction,siblingIds:this.mindMapSortByCross(S,x.direction,m),childParentId:x.parent.id}),this.updateCursor(t),this.setInteractionDragging(this.isNodeDragging);return}this.mindMapReparentPlan=null;let w=this.calcMindMapReorderTarget(m,l,a,p.x,p.y,o);this.setReorderIndicator({shapeId:n,nodeId:o,targetIndex:w,direction:a,siblingIds:this.mindMapSortByCross(l,a,m)});}this.updateCursor(t),this.setInteractionDragging(this.isNodeDragging);return}let i=this.tools.get(this.activeTool);i?.onPointerMove(t,e),this.updateCursor(t),this.scheduleRender(),this.setInteractionDragging(!!i?.isDragging?.());};handlePointerUp=e=>{if(e.type==="pointerleave"){if(this.mindMapHoverNode=null,this.hoverLockedShapeId=null,this.pointerIsDown){this.scheduleRender();return}}else {if(!this.pointerIsDown&&e.target!==this.canvas)return;this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId);}if(this.pointerIsDown=false,this.setInteractionDragging(false),this.editingShapeId)return;if(this.isPanning){this.isPanning=false,this.updateCursor(this.screenToPage({x:e.clientX,y:e.clientY}));return}if(this.pendingMindMapHandle){let n=this.pendingMindMapHandle;this.pendingMindMapHandle=null;let o=this.screenToPage({x:e.clientX,y:e.clientY}),s=this.getMindMapHandleAtPoint(o);s&&s.shapeId===n.shapeId&&s.nodeId===n.nodeId&&s.kind===n.kind&&s.direction===n.direction&&this.addMindMapNodeFromHandle(s),this.updateCursor(o),this.scheduleRender();return}if(this.mindMapNodeDragCandidate){let n=this.mindMapReparentPlan,o=this.mindMapReorderTarget,{shapeId:s,nodeId:a}=this.mindMapNodeDragCandidate;this.mindMapNodeDragCandidate=null,this.isNodeDragging=false,this.mindMapReparentPlan=null,n&&n.shapeId===s&&n.nodeId===a?this.moveMindMapNodeToParent(s,a,n.targetParentId,n.direction,n.insertIndex):o&&o.shapeId===s&&o.nodeId===a?this.reorderMindMapNode(s,a,o.targetIndex):(this.mindMapReorderTarget=null,this.scheduleRender());return}let t=this.screenToPage({x:e.clientX,y:e.clientY});this.tools.get(this.activeTool)?.onPointerUp(t,e),this.updateCursor(t),this.scheduleRender();};updateCursor(e){let i=this.tools.get(this.activeTool)?.getCursor(e)??"default";if(this.canvas.style.cursor!==i&&(this.canvas.style.cursor=i),!this.pointerIsDown){let n=this.getMindMapCursorHitAtPoint(e);(n?.shapeId!==this.mindMapHoverNode?.shapeId||n?.nodeId!==this.mindMapHoverNode?.nodeId)&&(this.mindMapHoverNode=n,this.scheduleRender()),this.updateLockHover(e);}}updateLockHover(e){let t=null;if(this.activeTool==="select"){let i=this.getShapeAtPoint(e);if(i&&i.locked)t=i.id;else {let n=this.lockBadgeAtPoint(e);n&&(t=n.shapeId??n.memberIds[0]??null);}}t!==this.hoverLockedShapeId&&(this.hoverLockedShapeId=t,this.scheduleRender());}lockBadgeAtPoint(e){if(!this.hasLockedShapes())return null;let t=this.camera.getZoom(),i=4/t,n=this.renderer.lockBadgeTargets(this.shapes,t);for(let o=n.length-1;o>=0;o--){let s=n[o];if(e.x>=s.x-i&&e.x<=s.x+s.size+i&&e.y>=s.y-i&&e.y<=s.y+s.size+i)return s}return null}unlockFromBadge(e){e.groupId?this.setGroupLocked(e.groupId,false):e.shapeId&&this.setShapeLocked(e.shapeId,false),this.hoverLockedShapeId=e.shapeId??e.memberIds[0]??null,this.scheduleRender();}handleWheel=e=>{if(e.preventDefault(),e.ctrlKey||e.metaKey){let n=e.deltaY>0?.9:1.1;this.camera.zoomAt({x:e.clientX,y:e.clientY},n),this.scheduleRender(),this.notifyListeners();return}let t=e.deltaX||0,i=e.deltaY||0;e.deltaMode===1?(t*=40,i*=40):e.deltaMode===2&&(t*=120,i*=120),e.shiftKey&&(t=t||i,i=0),this.camera.translate(-t,-i),this.scheduleRender(),this.notifyListeners();};handleKeyDown=e=>{if(this.editingShapeId)return;let t=e.target;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable))return;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="z"){e.preventDefault(),e.shiftKey?this.redo():this.undo();return}if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="y"){e.preventDefault(),this.redo();return}if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="s"){e.preventDefault(),this.saveToStorage();return}if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),this.selectAll();return}let i=e.ctrlKey||e.metaKey;if(i&&e.altKey&&e.key.toLowerCase()==="c"){e.preventDefault(),this.copyStyle();return}if(i&&e.altKey&&e.key.toLowerCase()==="v"){e.preventDefault(),this.pasteStyle();return}if(i&&e.altKey&&e.key.toLowerCase()==="l"){e.preventDefault();let o=this.getSelectedShapes();o.length>0&&this.setSelectedShapesLocked(!o.every(s=>s.locked));return}if(i&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()==="c"){e.preventDefault(),this.copySelected();return}if(i&&!e.altKey&&e.key.toLowerCase()==="v"){e.preventDefault(),this.imagePasteHandled=false,setTimeout(()=>{this.imagePasteHandled||this.paste(),this.imagePasteHandled=false;},0);return}if(i&&!e.altKey&&e.key.toLowerCase()==="d"){e.preventDefault(),this.duplicateSelected();return}if(i&&!e.altKey&&e.key.toLowerCase()==="g"){e.preventDefault(),e.shiftKey?this.ungroupSelected():this.groupSelected();return}if(e.shiftKey&&!i&&!e.altKey){let o=e.key.toLowerCase();if(o==="h"){e.preventDefault(),this.flipSelected("horizontal");return}if(o==="v"){e.preventDefault(),this.flipSelected("vertical");return}}if(!e.ctrlKey&&!e.metaKey&&!e.altKey){if(e.key==="v"||e.key==="V"){this.setActiveTool("select"),e.preventDefault();return}if(e.key==="h"||e.key==="H"){this.setActiveTool("hand"),e.preventDefault();return}if(e.key==="n"||e.key==="N"){this.setActiveTool("sticky-note"),e.preventDefault();return}if(e.key==="a"||e.key==="A"){this.setActiveTool("arrow"),e.preventDefault();return}if(e.key==="t"||e.key==="T"){this.setActiveTool("text"),e.preventDefault();return}if(e.key==="e"||e.key==="E"){this.setActiveTool("eraser"),e.preventDefault();return}}if(e.key==="Delete"||e.key==="Backspace"){let o=this.mindMapSelectedNode;if(o){let s=this.shapes.find(a=>a.id===o.shapeId);if(s&&s.type==="mind-map"){e.preventDefault(),this.deleteMindMapNode(o.shapeId,o.nodeId);return}}}this.tools.get(this.activeTool)?.onKeyDown(e),this.scheduleRender();};handleKeyUp=e=>{if(this.editingShapeId)return;let t=e.target;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable))return;this.tools.get(this.activeTool)?.onKeyUp(e),this.scheduleRender();};handleResize=()=>{this.renderer.resize(window.innerWidth,window.innerHeight),this.scheduleRender();};screenToPage(e){let t=this.canvas.getBoundingClientRect();return this.camera.screenToPage({x:e.x-t.left,y:e.y-t.top})}insertTemplate(e){if(!e||e.length===0)return;let t=rt(e,0),i=this.canvas.getBoundingClientRect(),n=this.camera.screenToPage({x:i.width/2,y:i.height/2}),o=n.x-(t.x+t.width/2),s=n.y-(t.y+t.height/2),a=e.map(l=>{let c={...l,style:{...l.style}};return c.type==="arrow"||c.type==="line"?c.points=c.points.map(h=>({x:h.x+o,y:h.y+s})):(c.x+=o,c.y+=s),c});this.commitHistory(),this.shapes=[...this.shapes,...a],this.selectedIds=[],this.prefetchShapeIcons(),this.notifyListeners(),this.render();}addShape(e){this.shapes.push(e),this.prefetchShapeIcons(),this.notifyListeners();}prefetchShapeIcons(){let e=[];for(let t of this.shapes)t.type==="icon"&&e.push(t.iconId);e.length!==0&&mt(e).then(()=>this.scheduleRender()).catch(()=>{});}updateShape(e,t){let i=this.shapes.findIndex(n=>n.id===e);if(i!==-1){let n=this.shapes[i];this.shapes[i]={...n,...t};let o=this.shapes[i],s=t;if(o.type==="table"){let a=s.rowHeights!==void 0&&!Es(s.rowHeights,n.rowHeights),l=s.cells!==void 0||s.colWidths!==void 0||s.fontSize!==void 0;!a&&l&&this.autoGrowTableRows(i);}(t.x!==void 0||t.y!==void 0)&&this.updateBoundArrows(e),this.notifyListeners();}}tableTopLeftAnchored(e,t,i){let n=(t-e.width)/2,o=(i-e.height)/2,s=Math.cos(e.rotation),a=Math.sin(e.rotation);return {x:e.x+n*s-o*a,y:e.y+n*a+o*s}}writeTable(e,t,i){let n=et(i.colWidths),o=tt(i.rowHeights),s=this.tableTopLeftAnchored(t,n,o);this.shapes[e]={...t,cells:i.cells,rowHeights:i.rowHeights,colWidths:i.colWidths,width:n,height:o,x:s.x,y:s.y},this.updateBoundArrows(t.id);}autoGrowTableRows(e){let t=this.shapes[e];if(!t||t.type!=="table")return;let i=hi(t);if(!i)return;let n=t;this.writeTable(e,n,{cells:n.cells,rowHeights:i,colWidths:n.colWidths});}updateBoundArrows(e){let t=this.shapes.find(i=>i.id===e);t&&this.shapes.forEach(i=>{if(i.type==="arrow"){let n=i,o={};if(n.startBinding?.toShapeId===e){let s=this.getBindingPosition(t,n.startBinding.handle||"top");o.points=n.points.map((a,l)=>l===0?s:a);}if(n.endBinding?.toShapeId===e){let s=this.getBindingPosition(t,n.endBinding.handle||"top"),a=o.points||[...n.points];o.points=a.map((l,c)=>c===a.length-1?s:l);}o.points&&(this.shapes[this.shapes.indexOf(i)]={...n,...o});}});}getBindingPosition(e,t){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "table":switch(t){case "top":return {x:e.x,y:e.y-e.height/2};case "bottom":return {x:e.x,y:e.y+e.height/2};case "left":return {x:e.x-e.width/2,y:e.y};case "right":return {x:e.x+e.width/2,y:e.y}}case "circle":switch(t){case "top":return {x:e.x,y:e.y-e.radius};case "bottom":return {x:e.x,y:e.y+e.radius};case "left":return {x:e.x-e.radius,y:e.y};case "right":return {x:e.x+e.radius,y:e.y}}case "hexagon":switch(t){case "top":return {x:e.x,y:e.y-e.height/2};case "bottom":return {x:e.x,y:e.y+e.height/2};case "left":return {x:e.x-e.width/2,y:e.y};case "right":return {x:e.x+e.width/2,y:e.y}}default:return {x:e.x,y:e.y}}}deleteShape(e){this.shapes=this.shapes.filter(t=>t.id!==e),this.selectedIds=this.selectedIds.filter(t=>t!==e),this.shapes=this.shapes.map(t=>{if(t.type==="arrow"){let i=t;if(i.startBinding?.toShapeId===e)return {...i,startBinding:void 0};if(i.endBinding?.toShapeId===e)return {...i,endBinding:void 0}}return t}),this.notifyListeners(),this.scheduleRender();}eraseShape(e){this.eraseFades.has(e)||this.shapes.some(t=>t.id===e)&&(this.eraseFades.set(e,Ei()),this.selectedIds.includes(e)&&(this.selectedIds=this.selectedIds.filter(t=>t!==e)),this.scheduleRender(),this.tickEraseFade());}tickEraseFade(){if(this.eraseFadeRaf!==null)return;let e=()=>{this.eraseFadeRaf=null;let t=Ei(),i=false;for(let[n,o]of [...this.eraseFades])t-o>=Mi?(this.eraseFades.delete(n),this.deleteShape(n)):i=true;this.scheduleRender(),i?this.eraseFadeRaf=requestAnimationFrame(e):this.notifyListeners();};this.eraseFadeRaf=requestAnimationFrame(e);}eraseFadeMap(){if(this.eraseFades.size===0)return;let e=Ei(),t=new Map;for(let[i,n]of this.eraseFades)t.set(i,Math.max(0,1-(e-n)/Mi));return t}clearEraseFades(){this.eraseFades.size!==0&&(this.eraseFades.clear(),this.eraseFadeRaf!==null&&(cancelAnimationFrame(this.eraseFadeRaf),this.eraseFadeRaf=null));}selectShape(e,t){if(!e)this.selectedIds=[];else {let i=this.getGroupMembers(e);if(t){let n=i.filter(o=>!this.selectedIds.includes(o));n.length>0?this.selectedIds=[...this.selectedIds,...n]:this.selectedIds=this.selectedIds.filter(o=>!i.includes(o));}else this.selectedIds=i;}this.notifyListeners(),this.scheduleRender();}selectShapes(e){let t=new Set;for(let i of e)for(let n of this.getGroupMembers(i))t.add(n);this.selectedIds=[...t],this.notifyListeners(),this.scheduleRender();}selectAll(){let e=this.shapes.filter(t=>!t.locked).map(t=>t.id);return e.length===0?false:(this.selectShapes(e),true)}getGroupMembers(e){let t=this.shapes.find(i=>i.id===e);return !t||!t.groupId?[e]:this.shapes.filter(i=>i.groupId===t.groupId&&!i.locked).map(i=>i.id)}getSelectedGroupId(){let e=this.getSelectedShapes();if(e.length===0)return null;let t=e[0].groupId;return !t||!e.every(n=>n.groupId===t)||this.shapes.filter(n=>n.groupId===t).length!==e.length?null:t}hasSelectedGroup(){return this.getSelectedShapes().some(e=>!!e.groupId)}groupMemberIds(e){return this.shapes.filter(t=>t.groupId===e).map(t=>t.id)}groupSelected(){let e=this.getSelectedShapes();if(e.length<2)return null;let t=`grp_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;this.commitHistory();for(let i of e){let n=this.shapes.findIndex(o=>o.id===i.id);n!==-1&&(this.shapes[n]={...this.shapes[n],groupId:t,locked:true});}return this.selectedIds=[],this.notifyListeners(),this.render(),t}ungroupSelected(){let e=new Set(this.getSelectedShapes().filter(t=>!!t.groupId).map(t=>t.groupId));return this.ungroupIds([...e])}ungroupIds(e){if(e.length===0)return false;let t=new Set;for(let i of e)for(let n of this.groupMemberIds(i))t.add(n);if(t.size===0)return false;this.commitHistory();for(let i of this.shapes.keys()){let n=this.shapes[i];if(!t.has(n.id))continue;let o={...n};delete o.groupId,n.locked&&n.groupId&&(o.locked=false),this.shapes[i]=o;}return this.notifyListeners(),this.render(),true}setGroupLocked(e,t){let i=this.groupMemberIds(e);if(i.length===0)return false;this.commitHistory();for(let n of this.shapes.keys())i.includes(this.shapes[n].id)&&(this.shapes[n]={...this.shapes[n],locked:t});return t?this.selectedIds=this.selectedIds.filter(n=>!i.includes(n)):this.selectedIds=[...i],this.notifyListeners(),this.render(),true}selectShapeRaw(e){this.selectedIds=e?[e]:[],this.notifyListeners(),this.scheduleRender();}getGroupIdOfSelected(){for(let e of this.getSelectedShapes())if(e.groupId)return e.groupId;return null}setBrushRect(e){this.brushRect=e,this.scheduleRender();}setSnapGuides(e){this.snapGuides=e;}setConnectingTarget(e){this.connectingTargetId!==e&&(this.connectingTargetId=e,this.scheduleRender());}setGenerationPreview(e){let t=this.genPreview;t?.from.x===e?.from.x&&t?.from.y===e?.from.y&&t?.to.x===e?.to.x&&t?.to.y===e?.to.y&&t?.type===e?.type&&t?.targetShapeId===e?.targetShapeId&&t?.dragging===e?.dragging&&t?.sourceEdge===e?.sourceEdge||(this.genPreview=e,this.scheduleRender());}setHoverAnchorShape(e){this.hoverAnchorShapeId!==e&&(this.hoverAnchorShapeId=e,this.scheduleRender());}setHoverConnector(e){this.hoverConnectorId!==e&&(this.hoverConnectorId=e,this.scheduleRender());}getConnectorRoute(e){let t=this.shapes.find(n=>n.id===e);if(!t)return [];let i=new Map(this.shapes.map(n=>[n.id,n]));return this.renderer.getConnectorRoute(t,i)}getAutoConnectorRoute(e){let t=this.shapes.find(n=>n.id===e);if(!t)return [];let i=new Map(this.shapes.map(n=>[n.id,n]));return this.renderer.getConnectorRoute(t,i,{ignoreUserPoints:true})}clearTransientPreview(){return !!this.genPreview||!!this.connectingTargetId||this.snapGuides.length>0||!!this.brushRect||!!this.hoverAnchorShapeId||!!this.hoverConnectorId||!!this.pendingMindMapHandle?(this.genPreview=null,this.connectingTargetId=null,this.snapGuides=[],this.brushRect=null,this.hoverAnchorShapeId=null,this.hoverConnectorId=null,this.pendingMindMapHandle=null,true):false}openGenerationMenu(e){let t=this.camera.getZoom(),i=(e.context.to.x+this.camera.x)*t,n=(e.context.to.y+this.camera.y)*t;this.emitUi({kind:"shapeTypeMenu",screenX:i,screenY:n,context:e.context,existingArrowId:e.existingArrowId,defaultShapeType:e.defaultShapeType});}lineStyle(){return {strokeColor:"#1f2937",fillColor:"transparent",strokeWidth:2,strokeDash:null}}computeSourceBinding(e){if(!e.sourceShapeId||!e.edge)return;let t=this.shapes.find(n=>n.id===e.sourceShapeId);if(!t)return;let i={n:"top",e:"right",s:"bottom",w:"left"};return {toShapeId:t.id,handle:i[e.edge]}}connectHandle(e,t,i){return dn(e,t,i)}createFloatingLine(e){this.commitHistory();let t=e.from,i=e.to,n=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,o={id:n,type:"arrow",x:t.x,y:t.y,points:[{x:t.x,y:t.y},{x:i.x,y:i.y}],rotation:0,style:this.lineStyle(),startBinding:this.computeSourceBinding(e),connectionType:"polyline",arrowHead:this.arrowStyle.arrowHead,dashed:this.arrowStyle.dashed};return this.addShape(o),this.selectedIds=[n],this.notifyListeners(),this.render(),n}createGeneratedConnection(e,t){this.commitHistory();let i=t.type,n,o;e.sourceShapeId&&(o=this.shapes.find(h=>h.id===e.sourceShapeId),o&&an(o.type)&&(n={...o.style}));let s=n?void 0:this.stickyNoteColor,a=Te(i,e.to,n,s,ln(i,o));this.addShape(a);let l=e.from,c={toShapeId:a.id,handle:this.connectHandle(l,e.to,e.edge),auto:true};if(t.existingArrowId)this.updateArrowBinding(t.existingArrowId,"end",a.id,{toShapeId:a.id,handle:this.connectHandle(l,e.to,e.edge),auto:true});else {let d={id:`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"arrow",x:l.x,y:l.y,points:[{x:l.x,y:l.y},{x:e.to.x,y:e.to.y}],rotation:0,style:this.lineStyle(),startBinding:this.computeSourceBinding(e),endBinding:c,connectionType:"polyline",arrowHead:this.arrowStyle.arrowHead,dashed:this.arrowStyle.dashed};this.addShape(d);}this.selectedIds=[a.id],this.notifyListeners(),this.render();}connectToExisting(e,t,i){this.commitHistory();let n=this.shapes.find(h=>h.id===t);if(!n)return;let o=e.from,s=i?.handle??this.connectHandle(o,{x:n.x,y:n.y},e.edge),a=this.getBindingPosition(n,s),l=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,c={id:l,type:"arrow",x:o.x,y:o.y,points:[{x:o.x,y:o.y},{x:a.x,y:a.y}],rotation:0,style:this.lineStyle(),startBinding:this.computeSourceBinding(e),endBinding:{toShapeId:t,handle:s,auto:!i||!i.handle&&!i.isPrecise},connectionType:"polyline",arrowHead:this.arrowStyle.arrowHead,dashed:this.arrowStyle.dashed};this.addShape(c),this.selectedIds=[l],this.notifyListeners(),this.render();}subscribeUi(e){return this.uiListeners.add(e),()=>this.uiListeners.delete(e)}emitUi(e){this.uiListeners.forEach(t=>t(e));}setInteractionDragging(e){e!==this.interactionDragging&&(this.interactionDragging=e,this.emitUi({kind:"drag",active:e}));}updateSelectedShapesStyle(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(n=>n.id===t);i!==-1&&(this.shapes[i]={...this.shapes[i],style:{...this.shapes[i].style,...e}});}),this.notifyListeners(),this.render());}updateSelectedShapesText(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(n=>n.id===t);i!==-1&&(this.shapes[i]={...this.shapes[i],...e});}),this.notifyListeners(),this.render());}updateConnectionType(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(n=>n.id===t);if(i!==-1){let n=this.shapes[i];(n.type==="line"||n.type==="arrow")&&(this.shapes[i]={...n,connectionType:e});}}),this.notifyListeners(),this.render());}getSelectedShapes(){return this.shapes.filter(e=>this.selectedIds.includes(e.id))}isEditing(){return this.editingShapeId!==null}deleteSelected(){let e=this.selectedIds.filter(t=>{let i=this.shapes.find(n=>n.id===t);return i&&!i.locked});return e.length===0?false:(this.commitHistory(),e.forEach(t=>this.deleteShape(t)),this.releaseUnusedImageUrls(),true)}copySelected(){let e=this.getSelectedShapes().filter(t=>!t.locked);return e.length===0?false:(this.clipboardShapes=this.cloneShapes(e),this.pasteSeq=0,true)}hasClipboard(){return this.clipboardShapes.length>0}cloneWithOffset(e,t){let i=()=>`shape_${Date.now()}_${Math.random().toString(36).slice(2,9)}`,n=new Map,o=()=>`grp_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return this.cloneShapes(e).map(s=>{let a={...s,id:i()};if(s.groupId){let l=n.get(s.groupId);l||(l=o(),n.set(s.groupId,l)),a.groupId=l;}return a.x+=t,a.y+=t,Array.isArray(a.points)&&(a.points=a.points.map(l=>({x:l.x+t,y:l.y+t}))),Array.isArray(a.userPoints)&&(a.userPoints=a.userPoints.map(l=>({x:l.x+t,y:l.y+t}))),Array.isArray(a.userPointsBase)&&(a.userPointsBase=a.userPointsBase.map(l=>({x:l.x+t,y:l.y+t}))),delete a.startBinding,delete a.endBinding,a})}paste(){if(this.clipboardShapes.length===0)return false;let e=20*(this.pasteSeq+1);this.pasteSeq+=1,this.commitHistory();let t=this.cloneWithOffset(this.clipboardShapes,e);return this.shapes.push(...t),this.selectedIds=t.map(i=>i.id),this.notifyListeners(),this.render(),true}duplicateSelected(){let e=this.getSelectedShapes().filter(i=>!i.locked);if(e.length===0)return false;this.commitHistory();let t=this.cloneWithOffset(e,20);return this.shapes.push(...t),this.selectedIds=t.map(i=>i.id),this.notifyListeners(),this.render(),true}async copySelectedAsImage(){let e=this.getSelectedShapes().filter(t=>!t.locked);if(e.length===0)return false;try{if(!navigator.clipboard||typeof ClipboardItem>"u")return !1;let t=await Mn(e,"png",{background:null,padding:16});return await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),!0}catch{return false}}copyStyle(){let e=this.getSelectedShapes().find(t=>!t.locked);return e?(this.copiedStyle={style:{...e.style},...e.textColor!==void 0?{textColor:e.textColor}:{},...e.fontSize!==void 0?{fontSize:e.fontSize}:{}},true):false}hasCopiedStyle(){return this.copiedStyle!==null}pasteStyle(){if(!this.copiedStyle||this.selectedIds.length===0)return false;this.commitHistory();let e=this.copiedStyle;return this.selectedIds.forEach(t=>{let i=this.shapes.find(n=>n.id===t);i&&this.updateShape(t,{style:{...i.style,...e.style},...e.textColor!==void 0?{textColor:e.textColor}:{},...e.fontSize!==void 0?{fontSize:e.fontSize}:{}});}),true}flipSelected(e){let t=this.getSelectedShapes().filter(i=>!i.locked&&_n(i.type));return t.length===0?false:(this.commitHistory(),t.forEach(i=>{this.updateShape(i.id,e==="horizontal"?{flipX:!i.flipX}:{flipY:!i.flipY});}),true)}rotateSelected(e){let t=this.getSelectedShapes().filter(o=>!o.locked);if(t.length===0)return false;this.commitHistory();let i=e*Math.PI/180,n=Math.PI*2;return t.forEach(o=>{this.updateShape(o.id,{rotation:((o.rotation+i)%n+n)%n});}),true}rotateSelected90(e=true){return this.rotateSelected(e?90:-90)}setSelectedShapesLocked(e){let t=this.getSelectedShapes();return t.length===0?false:(this.commitHistory(),t.forEach(i=>this.updateShape(i.id,{locked:e})),e&&(this.selectedIds=[],this.notifyListeners(),this.render()),true)}setShapeLocked(e,t){let i=this.shapes.find(n=>n.id===e);if(!i)return false;if(this.commitHistory(),this.updateShape(e,{locked:t}),t){let n=i.groupId?this.groupMemberIds(i.groupId):[e];this.selectedIds=this.selectedIds.filter(o=>!n.includes(o)),this.notifyListeners();}return this.render(),true}isShapeLocked(e){return !!this.shapes.find(t=>t.id===e)?.locked}hasLockedShapes(){return this.shapes.some(e=>!!e.locked)}unlockAll(){let e=this.shapes.filter(i=>i.locked);if(e.length===0)return false;this.commitHistory();let t=new Set(e.map(i=>i.id));return this.shapes=this.shapes.map(i=>t.has(i.id)?{...i,locked:false}:i),this.notifyListeners(),this.render(),true}bringToFront(){if(this.selectedIds.length===0)return false;this.commitHistory();let e=new Set(this.selectedIds),t=this.shapes.filter(n=>e.has(n.id)),i=this.shapes.filter(n=>!e.has(n.id));return this.shapes=[...i,...t],this.notifyListeners(),this.render(),true}sendToBack(){if(this.selectedIds.length===0)return false;this.commitHistory();let e=new Set(this.selectedIds),t=this.shapes.filter(n=>e.has(n.id)),i=this.shapes.filter(n=>!e.has(n.id));return this.shapes=[...t,...i],this.notifyListeners(),this.render(),true}bringForward(){if(this.selectedIds.length===0)return false;this.commitHistory();let e=new Set(this.selectedIds),t=[...this.shapes];for(let i=t.length-2;i>=0;i--)e.has(t[i].id)&&!e.has(t[i+1].id)&&([t[i],t[i+1]]=[t[i+1],t[i]]);return this.shapes=t,this.notifyListeners(),this.render(),true}sendBackward(){if(this.selectedIds.length===0)return false;this.commitHistory();let e=new Set(this.selectedIds),t=[...this.shapes];for(let i=1;i<t.length;i++)e.has(t[i].id)&&!e.has(t[i-1].id)&&([t[i],t[i-1]]=[t[i-1],t[i]]);return this.shapes=t,this.notifyListeners(),this.render(),true}updateArrowHeadType(e){if(this.selectedIds.length===0)return;this.commitHistory();let t=e==="dependency"||e==="realization";this.selectedIds.forEach(i=>{let n=this.shapes.findIndex(o=>o.id===i);if(n!==-1){let o=this.shapes[n];o.type==="arrow"&&(this.shapes[n]=t?{...o,arrowHead:e,dashed:true}:{...o,arrowHead:e});}}),this.notifyListeners(),this.render();}updateArrowStyle(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(a=>a.id===t);if(i===-1)return;let n=this.shapes[i];if(n.type!=="arrow")return;let o=e.arrowHead??n.arrowHead??"end",s=o==="dependency"||o==="realization";this.shapes[i]={...n,...e,arrowHead:o,dashed:s?true:e.dashed??n.dashed??false};}),this.notifyListeners(),this.render());}getArrowStyle(){return {...this.arrowStyle}}setArrowStyle(e){let t={...this.arrowStyle,...e};(t.arrowHead==="dependency"||t.arrowHead==="realization")&&(t.dashed=true),this.arrowStyle=t,this.notifyListeners();}getStickyNoteColor(){return this.stickyNoteColor}insertIcon(e,t=oi){let i=Ve(e);if(!i||!ii(e))return;let n=this.viewportCenter(),o=this.iconInsertSeq++%6*14,s=ri(i),a={id:`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"icon",iconId:e,x:n.x+o,y:n.y+o,width:t,height:t,rotation:0,style:{strokeColor:s,fillColor:s,fillOpacity:1,strokeWidth:2,strokeDash:null}};return this.commitHistory(),this.addShape(a),this.selectShape(a.id,false),this.setActiveTool("select"),a.id}setImageUpload(e){this.imageUploadOption=e??null;}getImageUpload(){return this.imageUploadOption}hasImageUploader(){return !!this.imageUploadOption}getTemporaryImageSrcs(){return Bn(this.shapes)}hasTemporaryImages(){return this.getTemporaryImageSrcs().length>0}insertImageShape(e){let t=e.naturalWidth??0,i=e.naturalHeight??0,n=_o.width,o=_o.height;if(t>0&&i>0){let c=Math.min(1,Ns/Math.max(t,i));n=Math.max(24,Math.round(t*c)),o=Math.max(24,Math.round(i*c));}let s=e.at??this.viewportCenter(),a=this.imageInsertSeq++%6*16,l={id:`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"image",src:e.src,...e.temporary?{temporary:true}:{},...t>0?{naturalWidth:t}:{},...i>0?{naturalHeight:i}:{},x:s.x+a,y:s.y+a,width:n,height:o,rotation:0,borderRadius:4,style:{strokeColor:"transparent",fillColor:"#f3f4f6",fillOpacity:1,strokeWidth:0,strokeDash:null}};return this.commitHistory(),this.addShape(l),this.selectShape(l.id,false),this.setActiveTool("select"),l.id}async insertImageFile(e,t){if(!e||!/^image\//.test(e.type||""))throw new Error("\u4E0D\u662F\u56FE\u7247\u6587\u4EF6");let i=typeof this.imageUploadOption=="object"&&this.imageUploadOption?this.imageUploadOption.maxSizeBytes??31457280:31457280;if(e.size>i)throw new Error(`image.tooLarge: \u56FE\u7247\u5927\u5C0F ${(e.size/1024/1024).toFixed(2)} MB \u8D85\u8FC7\u4E0A\u9650 ${(i/1024/1024).toFixed(2)} MB`);let n,o=false;this.imageUploadOption?n=await Ki(this.imageUploadOption,e):(n=URL.createObjectURL(e),zi(n),this.ownImageUrls.add(n),o=true);let s=await Fe(n);return this.insertImageShape({src:n,naturalWidth:s?.width,naturalHeight:s?.height,temporary:o,at:t})}async insertImageFiles(e,t){let i=Array.from(e).filter(o=>!!o&&/^image\//.test(o.type||"")),n=[];for(let o of i)n.push(await this.insertImageFile(o,t));return n}async insertImageFromUrl(e,t){if(!e)throw new Error("\u56FE\u7247\u5730\u5740\u4E3A\u7A7A");let i=await Fe(e);return this.insertImageShape({src:e,naturalWidth:i?.width,naturalHeight:i?.height,temporary:e.startsWith("blob:"),at:t})}releaseUnusedImageUrls(){if(this.ownImageUrls.size===0)return;let e=new Set(this.shapes.filter(t=>t.type==="image").map(t=>t.src));for(let t of Array.from(this.ownImageUrls))e.has(t)||(this.ownImageUrls.delete(t),Nn(t));}handlePasteEvent=e=>{if(this.editingShapeId)return;let t=e.target;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable))return;let i=e.clipboardData?.items;if(!i)return;let n=[];for(let o of Array.from(i))if(o.kind==="file"&&(o.type||"").startsWith("image/")){let s=o.getAsFile();s&&n.push(s);}n.length!==0&&(e.preventDefault(),this.imagePasteHandled=true,this.insertImageFiles(n).catch(o=>{this.emitUi({kind:"imageError",message:o instanceof Error?o.message:String(o)});}));};viewportCenter(){let e=this.canvas.getBoundingClientRect();return this.camera.screenToPage({x:e.width/2,y:e.height/2})}setStickyNoteColor(e){if(!ni(e))return;let t=e.trim().toLowerCase();t!==this.stickyNoteColor&&(this.stickyNoteColor=t,this.notifyListeners());}updateArrowDashed(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(n=>n.id===t);if(i!==-1){let n=this.shapes[i];n.type==="arrow"&&(this.shapes[i]={...n,dashed:e});}}),this.notifyListeners(),this.render());}updateUmlClass(e,t){let i=this.shapes.findIndex(h=>h.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="uml-class")return;this.commitHistory();let o=t.className??n.className,s=t.attributes??n.attributes,a=t.methods??n.methods,{width:l,height:c}=cn(o,s,a);this.shapes[i]={...n,className:o,attributes:s,methods:a,width:l,height:c},this.notifyListeners(),this.render();}updateUmlInterface(e,t){let i=this.shapes.findIndex(h=>h.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="uml-interface")return;this.commitHistory();let o=n,s=t.className??o.className,a=t.methods??o.methods,{width:l,height:c}=bi(s,a);this.shapes[i]={...n,className:s,methods:a,width:l,height:c},this.notifyListeners(),this.render();}getSelectedUml(){if(this.selectedIds.length!==1)return null;let e=this.shapes.find(t=>t.id===this.selectedIds[0]);return e&&(e.type==="uml-class"||e.type==="uml-interface")?e:null}getUmlById(e){let t=this.shapes.find(i=>i.id===e);return t&&(t.type==="uml-class"||t.type==="uml-interface")?t:null}pageToMindMapLocal(e,t){let i=t.x-e.x,n=t.y-e.y,o=Math.cos(e.rotation),s=Math.sin(e.rotation);return {x:i*o+n*s,y:-i*s+n*o}}calcMindMapReorderTarget(e,t,i,n,o,s){if(t.length<=1)return 0;let a=ce(i),l=a?o:n,c=t.filter(d=>d!==s).map(d=>e.get(d)).filter(d=>!!d).map(d=>a?d.y:d.x).sort((d,u)=>d-u),h=0;for(let d of c)if(l>d)h++;else break;return h}anchorMindMapAtRoot(e,t,i){let n=N(t).positions.get(t.id),o=N(i).positions.get(i.id);if(!n||!o)return {x:e.x,y:e.y};let s=Math.cos(e.rotation),a=Math.sin(e.rotation),l=n.x*s-n.y*a,c=n.x*a+n.y*s,h=o.x*s-o.y*a,d=o.x*a+o.y*s;return {x:e.x+(l-h),y:e.y+(c-d)}}getSelectedMindMap(){if(this.selectedIds.length!==1)return null;let e=this.shapes.find(t=>t.id===this.selectedIds[0]);return e&&e.type==="mind-map"?e:null}getMindMapNodeAtPoint(e){for(let t=this.shapes.length-1;t>=0;t--){let i=this.shapes[t];if(i.type!=="mind-map")continue;let n=i,o=e.x-n.x,s=e.y-n.y,a=Math.cos(n.rotation),l=Math.sin(n.rotation),c=o*a+s*l,h=-o*l+s*a;if(Math.abs(c)>n.width/2||Math.abs(h)>n.height/2)continue;let d=N(n.root);for(let[u,p]of d.positions)if(Math.abs(c-p.x)<=p.width/2&&Math.abs(h-p.y)<=p.height/2)return {shapeId:n.id,nodeId:u};return {shapeId:n.id,nodeId:n.root.id}}return null}getMindMapNodeAtScreenPoint(e){return this.getMindMapNodeAtPoint(this.screenToPage(e))}getMindMapNodeBoxAtPoint(e){for(let t=this.shapes.length-1;t>=0;t--){let i=this.shapes[t];if(i.type!=="mind-map")continue;let n=i,o=e.x-n.x,s=e.y-n.y,a=Math.cos(n.rotation),l=Math.sin(n.rotation),c=o*a+s*l,h=-o*l+s*a,d=N(n.root);for(let[u,p]of d.positions)if(Math.abs(c-p.x)<=p.width/2&&Math.abs(h-p.y)<=p.height/2)return {shapeId:n.id,nodeId:u}}return null}hitMindMapNodeBox(e,t,i,n,o=48){let s=o,a=W(e,n),l=null,c=1/0;for(let[h,d]of t){if(h===n||a&&W(a,h))continue;let u=Math.abs(i.x-d.x)-(d.width/2+s),p=Math.abs(i.y-d.y)-(d.height/2+s);if(u>0||p>0)continue;let g=Math.abs(i.x-d.x)+Math.abs(i.y-d.y);g<c&&(c=g,l=h);}return l}mindMapChildGroup(e,t,i,n){let s=W(e,i)?.children??[];if(i!==e.id)return {direction:t.get(i)?.direction??"right",childIds:s.map(d=>d.id)};if(s.length===0)return {direction:"right",childIds:[]};let a="right",l=1/0;for(let h of Ye){let d=s.filter(g=>Z(g,"right")===h);if(d.length===0)continue;let u=t.get(d[0].id);if(!u)continue;let p=ce(h)?Math.abs(n.y-u.y):Math.abs(n.x-u.x);p<l&&(l=p,a=h);}let c=s.filter(h=>Z(h,"right")===a).map(h=>h.id);return {direction:a,childIds:c}}mindMapSortByCross(e,t,i){return [...e].sort((n,o)=>{let s=i.get(n),a=i.get(o);return !s||!a?0:ce(t)?s.y-a.y:s.x-a.x})}setReorderIndicator(e){let t=this.mindMapReorderTarget;!t&&!e||t&&e&&t.shapeId===e.shapeId&&t.nodeId===e.nodeId&&t.targetIndex===e.targetIndex&&t.direction===e.direction&&t.childParentId===e.childParentId&&t.siblingIds.join(",")===e.siblingIds.join(",")||(this.mindMapReorderTarget=e,this.scheduleRender());}getMindMapCursorHitAtPoint(e){let t=this.getMindMapCollapseHitAtPoint(e);if(t)return t;let i=this.getMindMapHandleAtPoint(e);if(i)return {shapeId:i.shapeId,nodeId:i.nodeId};for(let n=this.shapes.length-1;n>=0;n--){let o=this.shapes[n];if(o.type!=="mind-map")continue;let s=o,a=e.x-s.x,l=e.y-s.y,c=Math.cos(s.rotation),h=Math.sin(s.rotation),d=a*c+l*h,u=-a*h+l*c,p=N(s.root);for(let[g,m]of p.positions)if(Math.abs(d-m.x)<=m.width/2&&Math.abs(u-m.y)<=m.height/2)return {shapeId:s.id,nodeId:g}}return null}selectMindMapNode(e,t){let i=this.shapes.find(n=>n.id===e);!i||i.type!=="mind-map"||(this.selectedIds=[e],this.mindMapSelectedNode={shapeId:e,nodeId:t},this.notifyListeners(),this.render());}getMindMapEditingShapeId(){return this.mindMapEditingShapeId}getMindMapSelectedNode(){return this.mindMapSelectedNode}getMindMapNode(e,t){let i=this.shapes.find(n=>n.id===e);return !i||i.type!=="mind-map"?null:W(i.root,t)}getMindMapNodeScreenRect(e,t){let i=this.shapes.find(b=>b.id===e);if(!i||i.type!=="mind-map")return null;let n=i,s=N(n.root).positions.get(t);if(!s)return null;let a=this.camera.getZoom(),l=s.x,c=s.y,h=Math.cos(n.rotation),d=Math.sin(n.rotation),u=l*h-c*d,p=l*d+c*h,g=this.camera.pageToScreen({x:n.x,y:n.y}),m=g.x+u*a,f=g.y+p*a;return {x:m-s.width*a/2,y:f-s.height*a/2,width:s.width*a,height:s.height*a}}getMindMapCollapseHitAtPoint(e){for(let t of this.shapes){if(t.type!=="mind-map")continue;let i=t,n=N(i.root),o=this.pageToMindMapLocal(i,e);for(let[s,a]of n.positions){let l=W(i.root,s);if(!l||!l.children||l.children.length===0)continue;let c=jt(a,a.direction),h=o.x-c.x,d=o.y-c.y;if(h*h+d*d<=121)return {shapeId:t.id,nodeId:s}}}return null}getMindMapHandleAtPoint(e){for(let t=this.shapes.length-1;t>=0;t--){let i=this.shapes[t];if(i.type!=="mind-map")continue;let n=i,o=this.pageToMindMapLocal(n,e);if(Math.abs(o.x)>n.width/2+40||Math.abs(o.y)>n.height/2+40)continue;let s=Jn(n.root,N(n.root).positions,o.x,o.y);if(s)return {shapeId:i.id,nodeId:s.nodeId,kind:s.kind,direction:s.direction}}return null}addMindMapNodeFromHandle(e){e.kind==="child"?this.addMindMapChild(e.shapeId,e.nodeId,e.direction):this.addMindMapSibling(e.shapeId,e.nodeId),this.mindMapHoverNode=null;}beginMindMapEdit(e,t){let i=this.shapes.find(o=>o.id===e);if(!i||i.type!=="mind-map")return;let n=i;this.mindMapEditingShapeId=e,this.mindMapSelectedNode={shapeId:e,nodeId:t&&W(n.root,t)?t:n.root.id},this.selectedIds=[e],this.notifyListeners(),this.render();}exitMindMapEdit(){this.mindMapEditingShapeId=null,this.notifyListeners(),this.render();}updateMindMapNode(e,t,i,n=true){let o=this.shapes.findIndex(g=>g.id===e);if(o===-1)return;let s=this.shapes[o];if(s.type!=="mind-map")return;let a=s,l=W(a.root,t);if(!l||!Object.keys(i).some(g=>l[g]!==i[g]))return;n&&this.commitHistory();let h=Xe(a.root,t,i),{width:d,height:u}=N(h),p=this.anchorMindMapAtRoot(a,a.root,h);this.shapes[o]={...a,root:h,width:d,height:u,x:p.x,y:p.y},this.notifyListeners(),this.render();}setMindMapNodeOffset(e,t,i){let n=this.shapes.findIndex(u=>u.id===e);if(n===-1)return;let o=this.shapes[n];if(o.type!=="mind-map")return;let s=o,a=W(s.root,t);if(!a||a.offset?.dx===i.dx&&a.offset?.dy===i.dy)return;let l=Xe(s.root,t,{offset:i}),{width:c,height:h}=N(l),d=this.anchorMindMapAtRoot(s,s.root,l);this.shapes[n]={...s,root:l,width:c,height:h,x:d.x,y:d.y},this.render();}addMindMapChild(e,t,i){let n=this.shapes.findIndex(g=>g.id===e);if(n===-1)return;let o=this.shapes[n];if(o.type!=="mind-map")return;let s=o,a=W(s.root,t);if(!a)return;let l=i??Z(a,"right"),c={id:`mm_${Date.now()}_${Math.random().toString(36).substr(2,6)}`,text:le("mindmap.defaultBranch"),direction:l},h=Zn(s.root,t,c);this.commitHistory();let{width:d,height:u}=N(h),p=this.anchorMindMapAtRoot(s,s.root,h);this.shapes[n]={...s,root:h,width:d,height:u,x:p.x,y:p.y},this.mindMapSelectedNode={shapeId:e,nodeId:c.id},this.notifyListeners(),this.render();}addMindMapSibling(e,t){let i=this.shapes.findIndex(p=>p.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="mind-map")return;let o=n,s=W(o.root,t);if(!s||!Ze(o.root,t))return;let a=Z(s,"right"),l={id:`mm_${Date.now()}_${Math.random().toString(36).substr(2,6)}`,text:le("mindmap.defaultBranch"),direction:a},c=jn(o.root,t,l);this.commitHistory();let{width:h,height:d}=N(c),u=this.anchorMindMapAtRoot(o,o.root,c);this.shapes[i]={...o,root:c,width:h,height:d,x:u.x,y:u.y},this.mindMapSelectedNode={shapeId:e,nodeId:l.id},this.notifyListeners(),this.render();}reorderMindMapNode(e,t,i){let n=this.shapes.findIndex(u=>u.id===e);if(n===-1)return;let o=this.shapes[n];if(o.type!=="mind-map")return;let s=o,a=Be(s.root,t);if(!a||i===a.index){this.mindMapReorderTarget=null,this.scheduleRender();return}this.commitHistory();let l=Qn(s.root,t,i),{width:c,height:h}=N(l),d=this.anchorMindMapAtRoot(s,s.root,l);this.shapes[n]={...s,root:l,width:c,height:h,x:d.x,y:d.y},this.mindMapSelectedNode={shapeId:e,nodeId:t},this.mindMapReorderTarget=null,this.notifyListeners(),this.render();}moveMindMapNodeToParent(e,t,i,n,o){let s=this.shapes.findIndex(p=>p.id===e);if(s===-1)return;let a=this.shapes[s];if(a.type!=="mind-map")return;let l=a,c=ti(l.root,t,i,n,o);if(this.mindMapReorderTarget=null,this.mindMapReparentPlan=null,c===l.root){this.scheduleRender();return}this.commitHistory();let{width:h,height:d}=N(c),u=this.anchorMindMapAtRoot(l,l.root,c);this.shapes[s]={...l,root:c,width:h,height:d,x:u.x,y:u.y},this.mindMapSelectedNode={shapeId:e,nodeId:t},this.notifyListeners(),this.render();}deleteMindMapNode(e,t){let i=this.shapes.findIndex(d=>d.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="mind-map")return;let o=n;if(o.root.id===t){this.commitHistory(),this.shapes=this.shapes.filter(d=>d.id!==e),this.selectedIds=this.selectedIds.filter(d=>d!==e),this.mindMapEditingShapeId=null,this.mindMapSelectedNode=null,this.notifyListeners(),this.render();return}let s=Xt(o.root,t);if(!s)return;this.commitHistory();let{width:a,height:l}=N(s),c=this.anchorMindMapAtRoot(o,o.root,s);this.shapes[i]={...o,root:s,width:a,height:l,x:c.x,y:c.y};let h=Ze(o.root,t);this.mindMapSelectedNode=h?{shapeId:e,nodeId:h.id}:{shapeId:e,nodeId:s.id},this.notifyListeners(),this.render();}toggleMindMapCollapse(e,t){let i=this.shapes.findIndex(d=>d.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="mind-map")return;let o=n,s=W(o.root,t);if(!s||!s.children||s.children.length===0)return;this.commitHistory();let a=Xe(o.root,t,{collapsed:!s.collapsed}),{width:l,height:c}=N(a),h=this.anchorMindMapAtRoot(o,o.root,a);this.shapes[i]={...o,root:a,width:l,height:c,x:h.x,y:h.y},this.notifyListeners(),this.render();}canPromoteMindMapNode(e,t,i){let n=this.shapes.find(a=>a.id===e);if(!n||n.type!=="mind-map")return false;let o=n;return o.root.id===t?false:Zt(o.root,t)>=i+1}promoteMindMapNode(e,t,i){let n=this.shapes.findIndex(d=>d.id===e);if(n===-1)return;let o=this.shapes[n];if(o.type!=="mind-map")return;let s=o;if(s.root.id===t||!this.canPromoteMindMapNode(e,t,i))return;let a=ei(s.root,t,i);if(a===s.root)return;this.commitHistory();let{width:l,height:c}=N(a),h=this.anchorMindMapAtRoot(s,s.root,a);this.shapes[n]={...s,root:a,width:l,height:c,x:h.x,y:h.y},this.mindMapSelectedNode={shapeId:e,nodeId:t},this.notifyListeners(),this.render();}getSelectedTable(){if(this.selectedIds.length!==1)return null;let e=this.shapes.find(t=>t.id===this.selectedIds[0]);return e&&e.type==="table"?e:null}getTableById(e){let t=this.shapes.find(i=>i.id===e);return t&&t.type==="table"?t:null}getTableCell(e,t,i){return this.getTableById(e)?.cells[t]?.[i]??null}getTableAtPoint(e){for(let t=this.shapes.length-1;t>=0;t--){let i=this.shapes[t];if(i.type!=="table")continue;let n=i,o=Ie(n,e),s=gi(n,o.x,o.y);if(s)return {shapeId:n.id,row:s.row,col:s.col}}return null}getTableAtScreenPoint(e){return this.getTableAtPoint(this.screenToPage(e))}getTableCellAtPointClamped(e,t){let i=this.getTableById(e);return i?wt(i,Ie(i,t)):null}isTableMoveHandleHit(e,t){let i=this.getTableById(e);return i?Qe(i,t,this.camera.getZoom()):false}getTableScreenRect(e,t,i){let n=this.getTableById(e);if(!n)return null;let o=t!==void 0&&i!==void 0?ie(n,t,i):{ox:0,oy:0,width:n.width,height:n.height},s=this.camera.getZoom(),a=o.ox-n.width/2,l=o.oy-n.height/2,c=Math.cos(n.rotation),h=Math.sin(n.rotation),d=a*c-l*h,u=a*h+l*c,p=this.camera.pageToScreen({x:n.x,y:n.y});return {x:p.x+d*s,y:p.y+u*s,width:o.width*s,height:o.height*s}}getTableSelection(){return this.tableSelection}selectTableCell(e,t,i,n=false){let o=this.getTableById(e);!o||!o.cells[t]?.[i]||(n&&this.tableSelection&&this.tableSelection.shapeId===e?this.tableSelection.focus={row:t,col:i}:this.tableSelection={shapeId:e,anchor:{row:t,col:i},focus:{row:t,col:i}},this.tableEditing=null,this.selectedIds=[e],this.notifyListeners(),this.render());}getTableEditing(){return this.tableEditing}beginTableEdit(e,t,i){let n=this.getTableById(e);!n||!n.cells[t]?.[i]||(this.tableEditing={shapeId:e,row:t,col:i},this.tableSelection={shapeId:e,anchor:{row:t,col:i},focus:{row:t,col:i}},this.selectedIds=[e],this.notifyListeners(),this.render());}exitTableEdit(){this.tableEditing&&(this.tableEditing=null,this.notifyListeners(),this.render());}updateTableCell(e,t,i,n,o=true){let s=this.shapes.findIndex(u=>u.id===e);if(s===-1)return;let a=this.shapes[s];if(a.type!=="table")return;let l=a,c=l.cells[t]?.[i];if(!c||!Object.keys(n).some(u=>c[u]!==n[u]))return;o&&this.commitHistory();let d=he(l.cells);d[t][i]={...d[t][i],...n},this.shapes[s]={...l,cells:d},this.autoGrowTableRows(s),this.notifyListeners(),this.render();}insertTable(e=3,t=3){let i=this.viewportCenter(),n=this.iconInsertSeq++%6*14,o=Te("table",{x:i.x+n,y:i.y+n}),s=Array.from({length:t},(l,c)=>o.colWidths[c]??140),a=Array.from({length:e},(l,c)=>o.rowHeights[c]??36);return this.commitHistory(),this.addShape({...o,colWidths:s,rowHeights:a,width:et(s),height:tt(a),cells:Mt(e,t,false)}),this.selectShape(o.id,false),this.setActiveTool("select"),o.id}insertTableRow(e,t){let i=this.shapes.findIndex(l=>l.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.tableSelection,s=t??(o&&o.shapeId===e?o.focus.row+1:n.cells.length),a=nn(n.cells,n.rowHeights,s);this.commitHistory(),this.writeTable(i,n,{cells:a.cells,rowHeights:a.rowHeights,colWidths:n.colWidths}),this.notifyListeners(),this.render();}insertTableColumn(e,t){let i=this.shapes.findIndex(l=>l.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.tableSelection,s=t??(o&&o.shapeId===e?o.focus.col+1:n.colWidths.length),a=on(n.cells,n.colWidths,s);this.commitHistory(),this.writeTable(i,n,{cells:a.cells,rowHeights:n.rowHeights,colWidths:a.colWidths}),this.notifyListeners(),this.render();}deleteTableRow(e,t){let i=this.shapes.findIndex(l=>l.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.tableSelection,s=t??(o&&o.shapeId===e?o.focus.row:0),a=rn(n.cells,n.rowHeights,s);if(a){if(this.commitHistory(),this.writeTable(i,n,{cells:a.cells,rowHeights:a.rowHeights,colWidths:n.colWidths}),this.tableSelection?.shapeId===e){let l=c=>Math.min(c,a.cells.length-1);this.tableSelection.anchor={...this.tableSelection.anchor,row:l(this.tableSelection.anchor.row)},this.tableSelection.focus={...this.tableSelection.focus,row:l(this.tableSelection.focus.row)};}this.tableEditing?.shapeId===e&&this.tableEditing.row>=a.cells.length&&(this.tableEditing=null),this.notifyListeners(),this.render();}}deleteTableColumn(e,t){let i=this.shapes.findIndex(l=>l.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.tableSelection,s=t??(o&&o.shapeId===e?o.focus.col:0),a=sn(n.cells,n.colWidths,s);if(a){if(this.commitHistory(),this.writeTable(i,n,{cells:a.cells,rowHeights:n.rowHeights,colWidths:a.colWidths}),this.tableSelection?.shapeId===e){let l=a.cells[0]?.length??1,c=h=>Math.min(h,l-1);this.tableSelection.anchor={...this.tableSelection.anchor,col:c(this.tableSelection.anchor.col)},this.tableSelection.focus={...this.tableSelection.focus,col:c(this.tableSelection.focus.col)};}this.tableEditing?.shapeId===e&&this.tableEditing.col>=(a.cells[0]?.length??1)&&(this.tableEditing=null),this.notifyListeners(),this.render();}}getTableSelRange(e){let t=this.tableSelection;if(!t||t.shapeId!==e)return null;let i=this.getTableById(e);if(!i)return null;let n=i.cells.length-1,o=(i.cells[0]?.length??1)-1,s=(d,u)=>Math.max(0,Math.min(u,d)),a=s(Math.min(t.anchor.row,t.focus.row),n),l=s(Math.max(t.anchor.row,t.focus.row),n),c=s(Math.min(t.anchor.col,t.focus.col),o),h=s(Math.max(t.anchor.col,t.focus.col),o);return Ct(i,a,c,l,h)}insertTableRowRelative(e,t){let i=this.shapes.findIndex(g=>g.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.getTableSelRange(e),s=n.cells.length-1,a=(n.cells[0]?.length??1)-1,l=o?o.r1:0,c=o?o.r2:s,h=o?o.c1:0,d=o?o.c2:a,u=t==="above"?l:c+1,p=nn(n.cells,n.rowHeights,u);this.commitHistory(),this.writeTable(i,n,{cells:p.cells,rowHeights:p.rowHeights,colWidths:n.colWidths}),this.tableSelection={shapeId:e,anchor:{row:u,col:h},focus:{row:u,col:d}},this.tableEditing=null,this.notifyListeners(),this.render();}insertTableColumnRelative(e,t){let i=this.shapes.findIndex(g=>g.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.getTableSelRange(e),s=n.cells.length-1,a=(n.cells[0]?.length??1)-1,l=o?o.r1:0,c=o?o.r2:s,h=o?o.c1:0,d=o?o.c2:a,u=t==="left"?h:d+1,p=on(n.cells,n.colWidths,u);this.commitHistory(),this.writeTable(i,n,{cells:p.cells,rowHeights:n.rowHeights,colWidths:p.colWidths}),this.tableSelection={shapeId:e,anchor:{row:l,col:u},focus:{row:c,col:u}},this.tableEditing=null,this.notifyListeners(),this.render();}deleteTableRowsInSelection(e){let t=this.shapes.findIndex(l=>l.id===e);if(t===-1)return;let i=this.getTableById(e);if(!i)return;let n=this.getTableSelRange(e);if(!n||i.cells.length-(n.r2-n.r1+1)<1)return;let s=i.cells,a=i.rowHeights;for(let l=n.r2;l>=n.r1;l--){let c=rn(s,a,l);if(!c)break;s=c.cells,a=c.rowHeights;}this.commitHistory(),this.writeTable(t,i,{cells:s,rowHeights:a,colWidths:i.colWidths}),this.clampTableSelectionAfterDelete(e,s,Math.min(n.r1,s.length-1)),this.notifyListeners(),this.render();}deleteTableColsInSelection(e){let t=this.shapes.findIndex(l=>l.id===e);if(t===-1)return;let i=this.getTableById(e);if(!i)return;let n=this.getTableSelRange(e);if(!n||(i.cells[0]?.length??1)-(n.c2-n.c1+1)<1)return;let s=i.cells,a=i.colWidths;for(let l=n.c2;l>=n.c1;l--){let c=sn(s,a,l);if(!c)break;s=c.cells,a=c.colWidths;}this.commitHistory(),this.writeTable(t,i,{cells:s,rowHeights:i.rowHeights,colWidths:a}),this.clampTableSelectionAfterDelete(e,s,void 0,Math.min(n.c1,(s[0]?.length??1)-1)),this.notifyListeners(),this.render();}clampTableSelectionAfterDelete(e,t,i,n){let o=t.length-1,s=(t[0]?.length??1)-1;if(this.tableSelection?.shapeId===e){let a=this.tableSelection,l=(d,u)=>Math.max(0,Math.min(u,d)),c={row:l(i??a.anchor.row,o),col:l(n??a.anchor.col,s)},h={row:l(i??a.focus.row,o),col:l(n??a.focus.col,s)};this.tableSelection={shapeId:e,anchor:c,focus:h};}if(this.tableEditing?.shapeId===e){let a=this.tableEditing;(a.row>o||a.col>s)&&(this.tableEditing=null);}}mergeTableCells(e){let t=e??this.tableSelection?.shapeId;if(!t)return;let i=this.shapes.findIndex(a=>a.id===t);if(i===-1)return;let n=this.getTableById(t);if(!n)return;let o=this.getTableSelRange(t);if(!o)return;let s=di(n.cells,o.r1,o.c1,o.r2,o.c2);s!==n.cells&&(this.commitHistory(),this.shapes[i]={...n,cells:s},this.autoGrowTableRows(i),this.tableSelection={shapeId:t,anchor:{row:o.r1,col:o.c1},focus:{row:o.r1,col:o.c1}},this.tableEditing=null,this.notifyListeners(),this.render());}splitTableCells(e){let t=e??this.tableSelection?.shapeId;if(!t)return;let i=this.shapes.findIndex(a=>a.id===t);if(i===-1)return;let n=this.getTableById(t);if(!n)return;let o=this.getTableSelRange(t);if(!o)return;let s=pi(n,o.r1,o.c1,o.r2,o.c2);s!==n.cells&&(this.commitHistory(),this.shapes[i]={...n,cells:s},this.tableEditing=null,this.notifyListeners(),this.render());}splitTableCell(e){let t=e??this.tableSelection?.shapeId;if(!t)return;let i=this.shapes.findIndex(l=>l.id===t);if(i===-1)return;let n=this.getTableById(t);if(!n)return;let o=this.tableSelection;if(!o||o.shapeId!==t)return;let s=ui(n,o.focus.row,o.focus.col),a=tn(n.cells,s.row,s.col);a!==n.cells&&(this.commitHistory(),this.shapes[i]={...n,cells:a},this.notifyListeners(),this.render());}addUmlAttribute(e){let t=this.shapes.find(n=>n.id===e);if(!t||t.type!=="uml-class")return;let i={id:`attr_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,visibility:"+",name:"newField",type:"string"};this.updateUmlClass(e,{attributes:[...t.attributes,i]});}addUmlMethod(e){let t=this.getUmlById(e);if(!t)return;let i={id:`meth_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,visibility:"+",name:"newMethod",params:"",returnType:"void"};t.type==="uml-class"?this.updateUmlClass(e,{methods:[...t.methods,i]}):this.updateUmlInterface(e,{methods:[...t.methods,i]});}removeUmlAttribute(e,t){let i=this.shapes.find(n=>n.id===e);!i||i.type!=="uml-class"||this.updateUmlClass(e,{attributes:i.attributes.filter(n=>n.id!==t)});}removeUmlMethod(e,t){let i=this.getUmlById(e);if(!i)return;let n=i.methods.filter(o=>o.id!==t);i.type==="uml-class"?this.updateUmlClass(e,{methods:n}):this.updateUmlInterface(e,{methods:n});}reorderUmlAttribute(e,t,i){let n=this.shapes.find(a=>a.id===e);if(!n||n.type!=="uml-class"||t===i)return;let o=[...n.attributes];if(t<0||t>=o.length||i<0||i>=o.length)return;let[s]=o.splice(t,1);o.splice(i,0,s),this.updateUmlClass(e,{attributes:o});}reorderUmlMethod(e,t,i){let n=this.getUmlById(e);if(!n||t===i)return;let o=[...n.methods];if(t<0||t>=o.length||i<0||i>=o.length)return;let[s]=o.splice(t,1);o.splice(i,0,s),n.type==="uml-class"?this.updateUmlClass(e,{methods:o}):this.updateUmlInterface(e,{methods:o});}updateUmlRowStyle(e,t,i,n){let o=this.getUmlById(e);if(o)if(t==="attribute"){if(o.type!=="uml-class")return;let s=o.attributes.map(a=>a.id===i?{...a,textColor:n.textColor===null?void 0:n.textColor??a.textColor,fontSize:n.fontSize===null?void 0:n.fontSize??a.fontSize,strikethrough:n.strikethrough===null?void 0:n.strikethrough??a.strikethrough}:a);this.updateUmlClass(e,{attributes:s});}else {let s=o.methods.map(a=>a.id===i?{...a,textColor:n.textColor===null?void 0:n.textColor??a.textColor,fontSize:n.fontSize===null?void 0:n.fontSize??a.fontSize,strikethrough:n.strikethrough===null?void 0:n.strikethrough??a.strikethrough}:a);o.type==="uml-class"?this.updateUmlClass(e,{methods:s}):this.updateUmlInterface(e,{methods:s});}}getUmlRowAtScreenPoint(e){let t=this.camera.screenToPage(e);for(let i=this.shapes.length-1;i>=0;i--){let n=this.shapes[i];if(n.type!=="uml-class"&&n.type!=="uml-interface")continue;let o=n.width/2,s=n.height/2;if(t.x<n.x-o||t.x>n.x+o||t.y<n.y-s||t.y>n.y+s)continue;let a=ge,l=t.y-n.y;if(l>=-s&&l<=-s+a)return {shape:n,section:"className",rowIndex:-1,text:n.className};if(n.type==="uml-interface"){let g=-s+a,m=s;if(n.methods.length>0&&l>=g&&l<=m){let f=Math.floor((l-g-_)/V);if(f>=0&&f<n.methods.length){let b=n.methods[f];return {shape:n,section:"method",rowIndex:f,text:`${b.visibility} ${b.name}(${b.params}): ${b.returnType}`}}return {shape:n,section:"method",rowIndex:-1,text:""}}return {shape:n,section:"className",rowIndex:-1,text:n.className}}let c=n.attributes.length>0?n.attributes.length*V+_*2:_*2,h=-s+a,d=h+c;if(n.attributes.length>0&&l>=h&&l<=d){let g=Math.floor((l-h-_)/V);if(g>=0&&g<n.attributes.length){let m=n.attributes[g];return {shape:n,section:"attribute",rowIndex:g,text:`${m.visibility} ${m.name}: ${m.type}`}}return {shape:n,section:"attribute",rowIndex:-1,text:""}}let u=d,p=s;if(n.methods.length>0&&l>=u&&l<=p){let g=Math.floor((l-u-_)/V);if(g>=0&&g<n.methods.length){let m=n.methods[g];return {shape:n,section:"method",rowIndex:g,text:`${m.visibility} ${m.name}(${m.params}): ${m.returnType}`}}return {shape:n,section:"method",rowIndex:-1,text:""}}return {shape:n,section:"className",rowIndex:-1,text:n.className}}return null}setActiveTool(e){this.tools.has(e)&&(this.tools.get(this.activeTool)?.cancelTransient(),this.clearTransientPreview(),this.activeTool=e,this.eraserPoint=null,this.notifyListeners(),this.scheduleRender());}getActiveTool(){return this.activeTool}setHighlighterColor(e){let t=this.tools.get("highlighter");t instanceof Le&&t.setHighlighterColor(e);}getHighlighterColor(){let e=this.tools.get("highlighter");return e instanceof Le?e.getHighlighterColor():yn}getShapes(){return [...this.shapes]}getData(){return {shapes:this.getShapes(),camera:{x:this.camera.x,y:this.camera.y,zoom:this.camera.zoom}}}setShapes(e){return Array.isArray(e)?(this.clearEraseFades(),this.shapes=e.map(t=>({...t,style:{...t.style}})),this.selectedIds=[],this.undoStack=[],this.redoStack=[],this.releaseUnusedImageUrls(),this.prefetchShapeIcons(),this.notifyListeners(),this.render(),true):false}setTheme(e){Wt(e),this.scheduleRender();}setLanguage(e){Kt(e);}getSelectedIds(){return [...this.selectedIds]}getCamera(){return this.camera}isPointerDown(){return this.pointerIsDown}isShapeTextTruncated(e){let t=this.shapes.find(i=>i.id===e);return t?this.renderer.isShapeTextTruncated(t):false}isUmlRowTextTruncated(e){let t=e.shape,i=t.fontSize||ee,n=false;if(e.section==="className")n=true;else if(e.section==="attribute"){let o=t.attributes?.[e.rowIndex];o?.fontSize&&(i=o.fontSize);}else if(e.section==="method"){let o=t.methods[e.rowIndex];o?.fontSize&&(i=o.fontSize);}return this.renderer.isUmlRowTextTruncated(t,e.text,i,n)}getContentBounds(e=24){return rt(this.shapes,e)}getViewportBounds(){let e=this.canvas.getBoundingClientRect(),t=this.camera.getZoom(),i=this.camera.screenToPage({x:0,y:0});return {x:i.x,y:i.y,width:e.width/t,height:e.height/t}}getBoardExtent(e=40){let t=this.shapes.length?this.getContentBounds(e):null,i=this.getViewportBounds(),n=t?{x:t.x,y:t.y,width:t.width,height:t.height}:null;return lt(n,{x:i.x-e,y:i.y-e,width:i.width+e*2,height:i.height+e*2})}async exportImage(e,t={}){return Mn(this.getShapes(),e,t)}async downloadImage(e="drawui",t="png",i={}){let n=await this.exportImage(t,i);Cn(n,`${e}.${t}`);}zoomIn(){this.camera.zoomAt({x:window.innerWidth/2,y:window.innerHeight/2},1.2),this.scheduleRender(),this.notifyListeners();}zoomOut(){this.camera.zoomAt({x:window.innerWidth/2,y:window.innerHeight/2},.8),this.scheduleRender(),this.notifyListeners();}resetZoom(){this.camera.reset(),this.scheduleRender(),this.notifyListeners();}panBy(e,t){this.camera.translate(e,t),this.scheduleRender(),this.notifyListeners();}setCameraPosition(e,t){this.camera.x=e,this.camera.y=t,this.scheduleRender(),this.notifyListeners();}requestRender(){this.scheduleRender(),this.notifyListeners();}setShowGrid(e){this.renderer.setShowGrid(e),this.scheduleRender();}render(){this.renderer.setTableSelection(this.tableSelection),this.renderer.setLockHover(this.hoverLockedShapeId),this.renderer.render(this.shapes,this.camera,new Set(this.selectedIds),this.brushRect,this.snapGuides,this.connectingTargetId,this.genPreview,this.eraserPoint,this.mindMapSelectedNode,this.mindMapHoverNode,this.mindMapReorderTarget,void 0,this.hoverAnchorShapeId,this.hoverConnectorId,this.eraseFadeMap());}scheduleRender(){this.renderScheduled||(this.renderScheduled=true,requestAnimationFrame(()=>{this.renderScheduled=false,this.render();}));}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeNotifications(e){return this.notificationListeners.add(e),()=>this.notificationListeners.delete(e)}notify(e){this.notificationListeners.forEach(t=>t(e));}notifyListeners(){this.notifyScheduled||(this.notifyScheduled=true,queueMicrotask(()=>{this.notifyScheduled=false,this.mindMapEditingShapeId&&!this.selectedIds.includes(this.mindMapEditingShapeId)&&(this.mindMapEditingShapeId=null),this.mindMapSelectedNode&&!this.selectedIds.includes(this.mindMapSelectedNode.shapeId)&&(this.mindMapSelectedNode=null),this.tableSelection&&!this.selectedIds.includes(this.tableSelection.shapeId)&&(this.tableSelection=null),this.tableEditing&&!this.selectedIds.includes(this.tableEditing.shapeId)&&(this.tableEditing=null),this.listeners.forEach(e=>e());}));}cloneShapes(e){return e.map(t=>{let i={...t,style:{...t.style}};Array.isArray(t.points)&&(i.points=t.points.map(o=>({...o}))),Array.isArray(t.userPoints)&&(i.userPoints=t.userPoints.map(o=>({...o}))),Array.isArray(t.userPointsBase)&&(i.userPointsBase=t.userPointsBase.map(o=>({...o})));let n=t.userPointsRef;if(n?.start&&n?.end&&(i.userPointsRef={start:{...n.start},end:{...n.end}}),t.startBinding&&(i.startBinding={...t.startBinding}),t.endBinding&&(i.endBinding={...t.endBinding}),t.root&&(i.root=Yt(t.root)),t.type==="table"&&Array.isArray(t.cells)){let o=t;i.colWidths=[...o.colWidths],i.rowHeights=[...o.rowHeights],i.cells=he(o.cells);}return i})}commitHistory(){if(this.isUndoing)return;let e={shapes:this.cloneShapes(this.shapes),selectedIds:[...this.selectedIds]};this.undoStack.push(e),this.undoStack.length>Bs&&this.undoStack.shift(),this.redoStack=[];}mark(){this.commitHistory();}undo(){if(this.undoStack.length!==0){this.clearEraseFades(),this.isUndoing=true;try{this.redoStack.push({shapes:this.cloneShapes(this.shapes),selectedIds:[...this.selectedIds]});let e=this.undoStack.pop();this.shapes=this.cloneShapes(e.shapes),this.selectedIds=[...e.selectedIds];}finally{this.isUndoing=false;}this.notifyListeners(),this.render();}}redo(){if(this.redoStack.length!==0){this.clearEraseFades(),this.isUndoing=true;try{this.undoStack.push({shapes:this.cloneShapes(this.shapes),selectedIds:[...this.selectedIds]});let e=this.redoStack.pop();this.shapes=this.cloneShapes(e.shapes),this.selectedIds=[...e.selectedIds];}finally{this.isUndoing=false;}this.notifyListeners(),this.render();}}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}saveToStorage(){if(!this.persist)return false;try{let e=JSON.stringify({version:1,shapes:this.shapes,savedAt:Date.now()});return localStorage.setItem(Ri,e),this.notifyListeners(),this.notify(le("save.success")),!0}catch(e){return console.error("\u4FDD\u5B58\u5931\u8D25:",e),this.notify(le("save.fail")),false}}loadFromStorage(){if(!this.persist)return false;try{let e=localStorage.getItem(Ri);if(!e)return !1;let t=JSON.parse(e);return t.shapes&&Array.isArray(t.shapes)?(this.shapes=t.shapes,this.selectedIds=[],this.undoStack=[],this.redoStack=[],this.notifyListeners(),this.scheduleRender(),!0):!1}catch(e){return console.error("\u52A0\u8F7D\u5931\u8D25:",e),false}}clearStorage(){localStorage.removeItem(Ri);}exportJSON(){return JSON.stringify({app:"drawui",version:1,shapes:this.shapes,camera:{x:this.camera.x,y:this.camera.y,zoom:this.camera.zoom},savedAt:Date.now()},null,2)}importJSON(e){try{let t=JSON.parse(e);if(t.shapes&&Array.isArray(t.shapes)){this.commitHistory(),this.shapes=t.shapes,this.selectedIds=[];let i=t.camera;return i&&typeof i.x=="number"&&typeof i.y=="number"&&typeof i.zoom=="number"&&(this.camera.x=i.x,this.camera.y=i.y,this.camera.zoom=i.zoom),this.notifyListeners(),this.render(),!0}return !1}catch(t){return console.error("\u5BFC\u5165\u5931\u8D25:",t),false}}downloadJSON(e="drawui-data"){let t=this.exportJSON();Cn(new Blob([t],{type:"application/json;charset=utf-8"}),`${e}.json`);}getEditingShapeId(){return this.editingShapeId}canEditShape(e){return !(e.type==="line"||e.type==="arrow"||e.type==="draw"||e.type==="uml-class"||e.type==="uml-interface"||e.type==="mind-map"||e.type==="table"||e.type==="image")}enterEditing(e){let t=this.shapes.find(i=>i.id===e);!t||!this.canEditShape(t)||(this.editingShapeId=e,this.selectedIds=[e],this.isNewTextShape=t.type==="text"&&!t.text,this.originalTextValue=t.text||"",this.notifyListeners(),this.scheduleRender(),requestAnimationFrame(()=>{this.createTextInput(t);}));}exitEditing(){if(!this.editingShapeId)return;let e=this.editingShapeId,t=this.shapes.find(n=>n.id===e),i=this.textInput?this.textInput.value:"";if(this.removeTextInput(),t)if(t.type==="text")if(this.commitHistory(),!i.trim()&&this.isNewTextShape)this.shapes=this.shapes.filter(n=>n.id!==e),this.selectedIds=this.selectedIds.filter(n=>n!==e);else {let n=t,o=n.fontSize||16,s=o*1.3,a=n.width||200,l=i.split(`
|
|
46
|
-
`),
|
|
47
|
-
`+h.value.substring(p),h.selectionStart=h.selectionEnd=u+1;}}),t.appendChild(h),h.focus(),e.type==="text"&&!e.text&&(h.placeholder="\u8F93\u5165\u6587\u672C..."),this.textInput=h;}getShapeScreenBounds(e){let t=this.camera.getZoom(),i=this.camera.pageToScreen({x:e.x,y:e.y});switch(e.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":return {x:i.x-e.width*t/2,y:i.y-e.height*t/2,width:e.width*t,height:e.height*t};case "circle":return {x:i.x-e.radius*t,y:i.y-e.radius*t,width:e.radius*2*t,height:e.radius*2*t};case "text":{let n=e,o=n.width*t,s=n.height*t;return {x:i.x-o/2,y:i.y-s/2,width:o,height:s}}default:return {x:i.x-50*t,y:i.y-20*t,width:100*t,height:40*t}}}getShapeAtScreenPoint(e){let t=this.screenToPage(e);return this.getShapeAtPoint(t)}getShapeAtPoint(e,t){let i=null;for(let n=this.shapes.length-1;n>=0;n--){let o=this.shapes[n];if(!(t&&o.id===t)){if(o.type==="arrow"||o.type==="line"){if(i||(i=new Map(this.shapes.map(s=>[s.id,s]))),this.isPointOnConnector(e,o,i))return o;continue}if(this.isPointInShape(e,o))return o}}return null}isPointOnConnector(e,t,i){let n=this.renderer.getConnectorRoute(t,i);if(n.length<2)return false;let o=this.camera.getZoom(),s=Math.max(6/o,(t.style?.strokeWidth??2)/2+2);for(let a=1;a<n.length;a++)if(this.pointToSegmentDist(e,n[a-1],n[a])<=s)return true;return false}getShapesInBrushRadius(e,t){let i=[];for(let n of this.shapes)this.shapeIntersectsBrush(n,e,t)&&i.push(n);return i}shapeIntersectsBrush(e,t,i){switch(e.type){case "line":case "arrow":{let n=e.points,o=i+4;for(let s=1;s<n.length;s++)if(this.pointToSegmentDist(t,n[s-1],n[s])<=o)return true;return n.length>0&&Math.hypot(t.x-n[0].x,t.y-n[0].y)<=o}case "draw":{let n=e.points,o=i+4;for(let s=1;s<n.length;s++){let a={x:e.x+n[s-1].x,y:e.y+n[s-1].y},l={x:e.x+n[s].x,y:e.y+n[s].y};if(this.pointToSegmentDist(t,a,l)<=o)return true}return n.length>0&&Math.hypot(t.x-(e.x+n[0].x),t.y-(e.y+n[0].y))<=o}case "circle":return Math.hypot(t.x-e.x,t.y-e.y)<=e.radius+i;case "text":{let n=e;return Math.abs(t.x-e.x)<=n.width/2+i&&Math.abs(t.y-e.y)<=n.height/2+i}default:return Math.abs(t.x-e.x)<=e.width/2+i&&Math.abs(t.y-e.y)<=e.height/2+i}}pointToSegmentDist(e,t,i){let n=i.x-t.x,o=i.y-t.y,s=n*n+o*o,a=s===0?0:Math.max(0,Math.min(1,((e.x-t.x)*n+(e.y-t.y)*o)/s));return Math.hypot(e.x-(t.x+a*n),e.y-(t.y+a*o))}setEraserPoint(e){this.eraserPoint=e,this.scheduleRender();}isPointInShape(e,t){let i=e.x-t.x,n=e.y-t.y;switch(t.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":return Math.abs(i)<=t.width/2&&Math.abs(n)<=t.height/2;case "circle":return i*i+n*n<=t.radius*t.radius;case "hexagon":{let o=t.width/2,s=t.height/2;return Math.abs(i)<=o&&Math.abs(n)<=s&&Math.abs(i)/o+Math.abs(n)/s<=1.5}case "mind-map":return Math.abs(i)<=t.width/2&&Math.abs(n)<=t.height/2;case "draw":{let o=t,s=Math.max((o.style?.strokeWidth??2)/2+3,6/this.camera.getZoom()),a=o.points||[];for(let l=1;l<a.length;l++)if(this.pointToSegmentDist({x:i,y:n},a[l-1],a[l])<=s)return true;return a.length===1&&Math.hypot(i-a[0].x,n-a[0].y)<=s}case "text":{let o=t;return Math.abs(i)<=o.width/2&&Math.abs(n)<=o.height/2}default:return false}}updateArrowBinding(e,t,i,n){let o=this.shapes.find(l=>l.id===e);if(!o||o.type!=="arrow")return;let s=o,a={};if(i){let l=this.shapes.find(u=>u.id===i);if(!l)return;let c=n?.handle||this.getClosestHandle(s,l),h=this.getBindingPosition(l,c),d=n?.handle?{...n,toShapeId:i,auto:false}:n?.auto?n:{toShapeId:i,handle:c,auto:false};t==="start"?(a.startBinding=d,a.points=s.points.map((u,p)=>p===0?h:u)):(a.endBinding=d,a.points=s.points.map((u,p)=>p===s.points.length-1?h:u));}else t==="start"?a.startBinding=void 0:a.endBinding=void 0;this.updateShape(e,a);}getClosestHandle(e,t){let i=e.points[0],n=e.points[e.points.length-1],o=e.endBinding?n:i,s=o.x-t.x,a=o.y-t.y;return Math.abs(s)>Math.abs(a)?s>0?"right":"left":a>0?"bottom":"top"}dispose(){this.eraseFadeRaf!==null&&(cancelAnimationFrame(this.eraseFadeRaf),this.eraseFadeRaf=null),this.eraseFades.clear(),this.canvas.removeEventListener("pointerdown",this.handlePointerDown),this.canvas.removeEventListener("pointerleave",this.handlePointerUp),window.removeEventListener("pointermove",this.handlePointerMove),window.removeEventListener("pointerup",this.handlePointerUp),window.removeEventListener("pointercancel",this.handlePointerUp),window.removeEventListener("blur",this.handleWindowBlur),window.removeEventListener("pointerdown",this.handleGlobalPointerDown,true),this.canvas.removeEventListener("wheel",this.handleWheel),window.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("keyup",this.handleKeyUp),window.removeEventListener("resize",this.handleResize),window.removeEventListener("paste",this.handlePasteEvent),this.removeImageReadyListener?.(),this.removeImageReadyListener=null,this.removeTextInput(),this.tools.forEach(e=>e.dispose()),this.listeners.clear();}};var _s=[{id:"flow",zh:"\u6D41\u7A0B\u56FE",en:"Flow"},{id:"org",zh:"\u7EC4\u7EC7\u4E0E\u7ED3\u6784",en:"Org & structure"},{id:"analysis",zh:"\u5206\u6790\u6A21\u578B",en:"Analysis"},{id:"plan",zh:"\u89C4\u5212\u4E0E\u6392\u671F",en:"Planning"},{id:"tech",zh:"\u6280\u672F\u67B6\u6784",en:"Architecture"},{id:"uml",zh:"UML / \u6570\u636E\u5E93",en:"UML & data"}],Y="#1f2937";function ue(r="transparent",e=Y,t=2){return {strokeColor:e,fillColor:r,strokeWidth:t,strokeDash:null}}var $o=0,oe=r=>`tpl_${r}_${($o++).toString(36)}`;function D(r,e,t,i,n,o,s={}){return {id:oe("box"),type:s.type??"rounded-rectangle",x:r,y:e,width:t,height:i,rotation:0,text:n,textColor:s.textColor,borderRadius:s.radius??8,orientation:s.orientation,topInset:s.topInset,style:ue(o,s.stroke??Y,s.strokeWidth??2)}}function st(r,e={}){return {id:oe("deco"),type:"arrow",x:0,y:0,points:r,rotation:0,connectionType:e.straight?"straight":"orthogonal",arrowHead:e.head??"none",dashed:!!e.dashed,freeform:true,style:ue("transparent",e.stroke??Y,e.width??1)}}function Vs(r,e,t,i,n){return {id:oe("icon"),type:"icon",x:r,y:e,width:i,height:i,rotation:0,iconId:t,style:ue(n,n,2)}}function B(r,e,t,i,n,o=Y,s=14){return {id:oe("label"),type:"text",x:r,y:e,width:t,height:i,rotation:0,text:n,fontSize:s,style:ue("transparent",o,1)}}function Bi(r,e,t,i,n){let s=68+(i.length+n.length)*22;return {id:oe("uml"),type:"uml-class",x:r,y:e,width:220,height:s,rotation:0,className:t,attributes:i.map(([a,l,c])=>({id:oe("attr"),visibility:a,name:l,type:c})),methods:n.map(([a,l,c,h])=>({id:oe("meth"),visibility:a,name:l,params:c,returnType:h})),textColor:Y,style:ue("#eef2ff")}}function Vo(r,e){let t=r,i=t.width??0,n=t.height??0;switch(e){case "top":return {x:r.x,y:r.y-n/2};case "bottom":return {x:r.x,y:r.y+n/2};case "left":return {x:r.x-i/2,y:r.y};default:return {x:r.x+i/2,y:r.y}}}var $s={top:"bottom",bottom:"top",left:"right",right:"left"};function R(r,e,t={}){let i=t.aSide??(Math.abs(e.y-r.y)>=Math.abs(e.x-r.x)?e.y>r.y?"bottom":"top":e.x>r.x?"right":"left"),n=t.bSide??$s[i];return {id:oe("link"),type:"arrow",x:0,y:0,points:[Vo(r,i),Vo(e,n)],rotation:0,connectionType:"orthogonal",arrowHead:t.head??"end",dashed:!!t.dashed,startBinding:{toShapeId:r.id,handle:i},endBinding:{toShapeId:e.id,handle:n},style:ue("transparent",t.stroke??Y,t.strokeWidth??2)}}function se(r){let e=`tpl_grp_${($o++).toString(36)}`;return r.map(t=>({...t,groupId:e}))}var P={blue:"#dbeafe",blueSoft:"#eff6ff",indigo:"#e0e7ff",green:"#dcfce7",amber:"#fef3c7",red:"#fee2e2",slate:"#f1f5f9",violet:"#f3e8ff",white:"#ffffff"},Os=()=>{let r=D(0,-240,140,52,"\u5F00\u59CB",P.green),e=D(0,-130,180,64,"\u5904\u7406\u6B65\u9AA4",P.blue),t=D(0,10,190,120,"\u6761\u4EF6\u5224\u65AD\uFF1F",P.amber,{type:"diamond",strokeWidth:2}),i=D(250,10,150,62,"\u8865\u5145\u8D44\u6599",P.violet,{strokeWidth:1.5}),n=D(0,200,140,52,"\u7ED3\u675F",P.red);return [r,e,t,i,n,R(r,e),R(e,t),R(t,n,{aSide:"bottom",bSide:"top"}),B(26,112,40,24,"\u662F","#15803d",13),R(t,i,{aSide:"right",bSide:"left"}),B(150,-8,40,24,"\u5426","#b45309",13),R(i,e,{aSide:"top",bSide:"right"})]},zs=()=>{let r=D(-230,0,130,56,"\u8F93\u5165",P.green),e=D(-40,0,150,56,"\u5904\u7406",P.blue),t=D(160,0,130,56,"\u8F93\u51FA",P.amber);return [r,e,t,R(r,e,{aSide:"right",bSide:"left"}),R(e,t,{aSide:"right",bSide:"left"})]};function Gs(r,e,t){let i=1/0,n=1/0,o=-1/0,s=-1/0;for(let h of r)i=Math.min(i,h.x),n=Math.min(n,h.y),o=Math.max(o,h.x),s=Math.max(s,h.y);let a=(i+o)/2,l=(n+s)/2,c=t/2;return {id:oe("track"),type:"draw",x:a,y:l,width:o-i+c*2,height:s-n+c*2,rotation:0,points:r.map(h=>({x:h.x-a,y:h.y-l})),style:ue("transparent",e,t)}}function Us(r){let{leftX:e,rightX:t,topY:i,midY:n,botY:o,endX:s}=r,a=(n-i)/2,l=(o-n)/2,c=[],h=8,d=(p,g,m,f)=>{let b=Math.hypot(m-p,f-g),x=Math.max(1,Math.round(b/h));for(let I=0;I<=x;I++)c.push({x:p+(m-p)*I/x,y:g+(f-g)*I/x});},u=(p,g,m,f,b)=>{let x=Math.max(4,Math.round(Math.abs(b-f)*m/h));for(let I=0;I<=x;I++){let T=f+(b-f)*I/x;c.push({x:p+m*Math.cos(T),y:g+m*Math.sin(T)});}};return d(e,i,t,i),u(t,i+a,a,-Math.PI/2,Math.PI/2),d(t,n,e,n),u(e,n+l,l,Math.PI/2,Math.PI*3/2),d(e,o,s,o),c}var Ws=()=>{let l=[Gs(Us({leftX:-330,rightX:330,topY:-90,midY:30,botY:180,endX:120}),"#e7e2fb",30)],c=(u,p,g,m,f,b,x)=>{let I=x<p?p-48:p+48,T=[D(u,p,160,96,g,m,{radius:6,strokeWidth:1,stroke:f}),D(u,p+96/2-24,136,28,"\u5F97\u5206",b,{radius:4,strokeWidth:0,stroke:"#ffffff",textColor:"#ffffff"}),st([{x:u,y:I},{x:u,y:x}],{stroke:Y,width:2,straight:true}),{id:oe("dot"),type:"circle",x:u,y:x,radius:5,rotation:0,style:ue("#1f2937")}];l.push(...se(T));},h=[{x:-140,t:"\u7B2C\u4E00\u6B65"},{x:45,t:"\u7B2C\u4E8C\u6B65"},{x:230,t:"\u7B2C\u4E09\u6B65"}];for(let u of h)c(u.x,-195,u.t,"#fdf4dc","#a16207","#eab308",-90);let d=[{x:-150,t:"\u7B2C\u56DB\u6B65"},{x:30,t:"\u7B2C\u4E94\u6B65"},{x:210,t:"\u7B2C\u516D\u6B65"}];for(let u of d)c(u.x,125,u.t,"#f1edfd","#6d28d9","#8b5cf6",31);return l.push(B(-455,-232,40,40,"\u{1F4E3}",Y,26),B(-352,-238,90,22,"\u65F6\u95F4",Y,15),B(-330,-212,200,20,"xx\u6708xx\u65E5 - xx\u6708xx\u65E5","#6b7280",12),B(-412,-90,110,22,"\u5F00\u59CB \u25B6\u25B6",Y,14),B(432,22,120,22,"\u25C0\u25C0 \u8FC7\u7A0B\u4E2D",Y,14),B(150,210,100,22,"\u901A\u5173\u5566",Y,15),B(330,202,46,46,"\u{1F3C6}",Y,34),B(452,196,110,22,"\u8BE6\u7EC6\u60C5\u51B5","#6b7280",13)),l},Fs=()=>{let r=D(0,-150,160,52,"\u8D1F\u8D23\u4EBA",P.indigo),e=[D(-170,-20,140,48,"\u4EA7\u54C1",P.blue),D(0,-20,140,48,"\u7814\u53D1",P.blue),D(170,-20,140,48,"\u8BBE\u8BA1",P.blue)],t=e.map(n=>D(n.x,110,140,46,"\u6210\u5458",P.slate)),i=[r,...e,...t];for(let n of e)i.push(R(r,n,{head:"none",strokeWidth:1.5}));return e.forEach((n,o)=>i.push(R(n,t[o],{head:"none",strokeWidth:1.5}))),i},Ks=()=>{let r=[],e=[{y:-240,name:"\u63A5\u5165\u5C42",fill:P.blueSoft,stroke:"#2563eb",cells:["\u53CD\u5411\u4EE3\u7406","\u901A\u7528\u7F51\u5173","\u9274\u6743\u63D2\u4EF6","\u9650\u6D41\u63D2\u4EF6"]},{y:-110,name:"\u5E94\u7528\u5C42",fill:"#fffbeb",stroke:"#b45309",cells:["Application 1","Application 2","Application 3"]},{y:20,name:"\u9886\u57DF\u5C42",fill:"#faf5ff",stroke:"#7c3aed",cells:["Service 1","Service 2","Service 3"]},{y:150,name:"\u57FA\u5EFA\u5C42",fill:"#eef2ff",stroke:"#4338ca",cells:["\u4E2D\u53F0\u670D\u52A1 1","\u4E2D\u53F0\u670D\u52A1 2","\u4E2D\u53F0\u670D\u52A1 3"]}];for(let i of e){let n=[D(-40,i.y,780,110,"",i.fill,{stroke:i.stroke,strokeWidth:1.5,radius:10}),B(-520,i.y,120,44,i.name,i.stroke,15)],o=i.cells.length,s=Math.min(190,(760-(o-1)*10)/o),a=o*s+(o-1)*10;i.cells.forEach((l,c)=>{let h=-40-a/2+s/2+c*(s+10);n.push(D(h,i.y,s,46,l,P.white,{stroke:i.stroke,strokeWidth:1,radius:6}));}),r.push(...se(n));}let t=[D(520,150,300,116,"","#eef2ff",{stroke:"#4338ca",strokeWidth:1.5,radius:10})];return ["MySQL","Redis","MQ"].forEach((i,n)=>{t.push(D(430+n*90,152,80,72,i,P.white,{type:"cylinder",stroke:"#4338ca",strokeWidth:1}));}),r.push(...se(t)),r},Ys=()=>[D(-115,-85,210,150,"\u4F18\u52BF S",P.green),D(115,-85,210,150,"\u52A3\u52BF W",P.red),D(-115,85,210,150,"\u673A\u4F1A O",P.blue),D(115,85,210,150,"\u5A01\u80C1 T",P.amber)],Xs=()=>{let e=Math.round(Math.sqrt(3)/2*230),t=e,i=[{t:"How",d:`\u4F55\u679C\uFF1F
|
|
44
|
+
${S+m.length}
|
|
45
|
+
%%EOF`;return new Blob([f+h+d+u+p,o,g+m+w],{type:"application/pdf"})}async function Cn(r,e,t={}){r.some(s=>s.type==="image")&&await En(r);let i=r.filter(s=>s.type==="icon").map(s=>s.iconId);if(i.length>0&&await ft(i),e==="svg"){let s=_o(r,t);return new Blob([s],{type:"image/svg+xml;charset=utf-8"})}let n=Eo(r,t);if(e==="png")return ws(n,"image/png");let o=Ss(n,"image/jpeg",.92);return Es(o,n.width,n.height)}function In(r,e){let t=URL.createObjectURL(r),i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(t),1e3);}function Ns(r,e){return !r||!e?r===e:r.length!==e.length?false:r.every((t,i)=>t===e[i])}var Bs=360,Vo={width:320,height:240},Ei="drawui-canvas-data",_s=50,Ni=()=>typeof performance<"u"?performance.now():Date.now(),Bi=class{canvas;renderer;camera;tools=new Map;activeTool="select";shapes=[];selectedIds=[];listeners=new Set;notificationListeners=new Set;uiListeners=new Set;isPanning=false;panStart={x:0,y:0};dragStartPositions=new Map;interactionDragging=false;lastClickTime=0;lastClickShapeId=null;editingShapeId=null;textInput=null;textOverlay=null;textInputRaf=null;isNewTextShape=false;originalTextValue="";undoStack=[];redoStack=[];isUndoing=false;brushRect=null;snapGuides=[];connectingTargetId=null;genPreview=null;hoverAnchorShapeId=null;hoverConnectorId=null;hoverLockedShapeId=null;eraserPoint=null;eraseFades=new Map;eraseFadeRaf=null;mindMapEditingShapeId=null;mindMapSelectedNode=null;mindMapHoverNode=null;pendingMindMapHandle=null;mindMapNodeDragCandidate=null;isNodeDragging=false;mindMapReorderTarget=null;mindMapReparentPlan=null;tableSelection=null;tableEditing=null;renderScheduled=false;pointerIsDown=false;notifyScheduled=false;persist=true;arrowStyle={connectionType:"straight",arrowHead:"end",dashed:false};stickyNoteColor=Jt;imageUploadOption=null;removeImageReadyListener=null;ownImageUrls=new Set;imageInsertSeq=0;imagePasteHandled=false;iconInsertSeq=0;clipboardShapes=[];pasteSeq=0;copiedStyle=null;constructor(e,t={}){this.canvas=e,this.persist=t.persist??!t.shapes,t.theme&&Ft(t.theme),t.language&&Yt(t.language);let i=e.getBoundingClientRect();this.renderer=new Ue(e),this.renderer.resize(i.width,i.height),this.camera=new Re,this.imageUploadOption=t.imageUpload??null,this.removeImageReadyListener=Hn(()=>this.requestRender()),window.addEventListener("paste",this.handlePasteEvent);let n={addShape:o=>this.addShape(o),updateShape:(o,s)=>this.updateShape(o,s),deleteShape:o=>this.deleteShape(o),eraseShape:o=>this.eraseShape(o),selectShape:(o,s)=>this.selectShape(o,s),selectShapeRaw:o=>this.selectShapeRaw(o),selectShapes:o=>this.selectShapes(o),getShapes:()=>[...this.shapes],getSelectedIds:()=>[...this.selectedIds],setActiveTool:o=>this.setActiveTool(o),screenToPage:o=>this.screenToPage(o),getCamera:()=>this.camera,panBy:(o,s)=>this.panBy(o,s),setCameraPosition:(o,s)=>this.setCameraPosition(o,s),getShapeAtPoint:(o,s)=>this.getShapeAtPoint(o,s),getShapesInBrushRadius:(o,s)=>this.getShapesInBrushRadius(o,s),setEraserPoint:o=>this.setEraserPoint(o),updateArrowBinding:(o,s,a,l)=>this.updateArrowBinding(o,s,a,l),enterEditing:o=>this.enterEditing(o),exitEditing:()=>this.exitEditing(),commitHistory:()=>this.commitHistory(),setBrushRect:o=>this.setBrushRect(o),setSnapGuides:o=>this.setSnapGuides(o),setConnectingTarget:o=>this.setConnectingTarget(o),setGenerationPreview:o=>this.setGenerationPreview(o),setHoverAnchorShape:o=>this.setHoverAnchorShape(o),setHoverConnector:o=>this.setHoverConnector(o),getConnectorRoute:o=>this.getConnectorRoute(o),getAutoConnectorRoute:o=>this.getAutoConnectorRoute(o),getLineStyle:()=>this.lineStyle(),openGenerationMenu:o=>this.openGenerationMenu(o),createGeneratedConnection:(o,s)=>this.createGeneratedConnection(o,s),createFloatingLine:o=>this.createFloatingLine(o),connectToExisting:(o,s,a)=>this.connectToExisting(o,s,a),updateSelectedShapesStyle:o=>this.updateSelectedShapesStyle(o),updateSelectedShapesText:o=>this.updateSelectedShapesText(o),updateConnectionType:o=>this.updateConnectionType(o),getArrowStyle:()=>this.getArrowStyle(),getStickyNoteColor:()=>this.getStickyNoteColor(),getMindMapCursorHitAtPoint:o=>this.getMindMapCursorHitAtPoint(o),selectMindMapNode:(o,s)=>this.selectMindMapNode(o,s),selectTableCell:(o,s,a,l)=>this.selectTableCell(o,s,a,l)};this.tools.set("select",new Dt(n)),this.tools.set("hand",new Ht(n)),this.tools.set("rectangle",new A(n,"rectangle")),this.tools.set("rounded-rectangle",new A(n,"rounded-rectangle")),this.tools.set("circle",new A(n,"circle")),this.tools.set("ellipse",new A(n,"ellipse")),this.tools.set("diamond",new A(n,"diamond")),this.tools.set("triangle",new A(n,"triangle")),this.tools.set("hexagon",new A(n,"hexagon")),this.tools.set("parallelogram",new A(n,"parallelogram")),this.tools.set("trapezoid",new A(n,"trapezoid")),this.tools.set("pentagon",new A(n,"pentagon")),this.tools.set("octagon",new A(n,"octagon")),this.tools.set("star",new A(n,"star")),this.tools.set("cylinder",new A(n,"cylinder")),this.tools.set("cloud",new A(n,"cloud")),this.tools.set("heart",new A(n,"heart")),this.tools.set("block-arrow-right",new A(n,"block-arrow-right")),this.tools.set("block-arrow-left",new A(n,"block-arrow-left")),this.tools.set("block-arrow-up",new A(n,"block-arrow-up")),this.tools.set("block-arrow-down",new A(n,"block-arrow-down")),this.tools.set("block-arrow-double",new A(n,"block-arrow-double")),this.tools.set("right-triangle",new A(n,"right-triangle")),this.tools.set("cross",new A(n,"cross")),this.tools.set("speech-rect",new A(n,"speech-rect")),this.tools.set("speech-round",new A(n,"speech-round")),this.tools.set("cube",new A(n,"cube")),this.tools.set("sector",new A(n,"sector")),this.tools.set("delay",new A(n,"delay")),this.tools.set("predefined-process",new A(n,"predefined-process")),this.tools.set("document",new A(n,"document")),this.tools.set("stadium",new A(n,"stadium")),this.tools.set("class-catalog",new A(n,"class-catalog")),this.tools.set("chevron",new A(n,"chevron")),this.tools.set("brace-left",new A(n,"brace-left")),this.tools.set("brace-right",new A(n,"brace-right")),this.tools.set("envelope",new A(n,"envelope")),this.tools.set("checkbox",new A(n,"checkbox")),this.tools.set("triangular-pyramid",new A(n,"triangular-pyramid")),this.tools.set("quadrangular-pyramid",new A(n,"quadrangular-pyramid")),this.tools.set("cuboid",new A(n,"cuboid")),this.tools.set("sphere",new A(n,"sphere")),this.tools.set("ellipsoid",new A(n,"ellipsoid")),this.tools.set("pie",new A(n,"pie")),this.tools.set("hollow-pie",new A(n,"hollow-pie")),this.tools.set("sticky-note",new A(n,"sticky-note")),this.tools.set("icon",new A(n,"icon")),this.tools.set("image",new A(n,"image")),this.tools.set("uml-class",new A(n,"uml-class")),this.tools.set("uml-interface",new A(n,"uml-interface")),this.tools.set("line",new Rt(n)),this.tools.set("arrow",new Et(n)),this.tools.set("text",new xn(n)),this.tools.set("pen",new Le(n,"pen")),this.tools.set("highlighter",new Le(n,"highlighter")),this.tools.set("eraser",new pn(n)),this.tools.set("mind-map",new A(n,"mind-map")),this.tools.set("table",new A(n,"table")),this.setupEventListeners(),t.shapes?this.shapes=t.shapes.map(o=>({...o,style:{...o.style}})):this.persist&&this.loadFromStorage(),this.render();}setupEventListeners(){this.canvas.addEventListener("pointerdown",this.handlePointerDown),this.canvas.addEventListener("pointerleave",this.handlePointerUp),window.addEventListener("pointermove",this.handlePointerMove),window.addEventListener("pointerup",this.handlePointerUp),window.addEventListener("pointercancel",this.handlePointerUp),window.addEventListener("blur",this.handleWindowBlur),window.addEventListener("pointerdown",this.handleGlobalPointerDown,true),this.canvas.addEventListener("wheel",this.handleWheel,{passive:false}),window.addEventListener("keydown",this.handleKeyDown),window.addEventListener("keyup",this.handleKeyUp),window.addEventListener("resize",this.handleResize);}handleWindowBlur=()=>{this.pointerIsDown=false,this.isPanning=false,this.cancelTransientInteraction(),this.scheduleRender();};handleGlobalPointerDown=e=>{e.target!==this.canvas&&(!e.isPrimary||e.button!==0||(this.pointerIsDown=false,this.isPanning=false,this.cancelTransientInteraction()&&this.scheduleRender()));};shouldRecoverTransient(){let e=this.tools.get(this.activeTool);return !!this.connectingTargetId||this.snapGuides.length>0||!!this.brushRect||!!e&&e.hasTransientState()}cancelTransientInteraction(){let e=!!this.tools.get(this.activeTool)?.cancelTransient(),t=this.clearTransientPreview();return e||t}handlePointerDown=e=>{if(e.button===2){this.clearTransientPreview();return}if(this.editingShapeId){if(this.textInput&&e.target===this.textInput)return;if(!this.textInput&&e.target===this.canvas)this.exitEditing();else return}this.clearTransientPreview(),this.pointerIsDown=true;try{this.canvas.hasPointerCapture(e.pointerId)||this.canvas.setPointerCapture(e.pointerId);}catch{}if(e.button===1||e.button===0&&e.altKey){this.isPanning=true,this.panStart={x:e.clientX,y:e.clientY},this.canvas.setPointerCapture(e.pointerId),this.canvas.style.cursor="grabbing";return}let t=this.screenToPage({x:e.clientX,y:e.clientY});if(this.activeTool==="select"){let s=this.lockBadgeAtPoint(t);if(s){this.unlockFromBadge(s);return}}let i=this.activeTool==="select"?this.getMindMapCollapseHitAtPoint(t):null;if(i){this.toggleMindMapCollapse(i.shapeId,i.nodeId);return}let n=this.activeTool==="select"?this.getMindMapHandleAtPoint(t):null;if(n){this.pendingMindMapHandle=n;return}if(this.activeTool==="select"){let s=Date.now(),a=this.getShapeAtPoint(t);if(s-this.lastClickTime<400&&this.lastClickShapeId&&a&&!a.locked&&a.id===this.lastClickShapeId&&this.canEditShape(a)){this.enterEditing(a.id),this.lastClickTime=0,this.lastClickShapeId=null;return}if(this.lastClickTime=s,this.lastClickShapeId=a&&!a.locked?a.id:null,a&&a.type==="mind-map"){let l=this.getMindMapNodeBoxAtPoint(t);if(l&&l.shapeId===a.id){this.lastClickTime=s,this.lastClickShapeId=a.id,this.selectedIds.includes(a.id)||(this.selectedIds=[a.id]),this.mindMapSelectedNode=l;let h=_e(a.root,l.nodeId);this.mindMapNodeDragCandidate={shapeId:l.shapeId,nodeId:l.nodeId,startPage:t,direction:h?.direction??"right",siblingIds:h?.siblings.map(d=>d.id)??[]},this.notifyListeners(),this.render();return}this.mindMapSelectedNode&&this.mindMapSelectedNode.shapeId===a.id&&(this.mindMapSelectedNode=null,this.scheduleRender());}if(a&&!a.locked&&(this.dragStartPositions.clear(),this.selectedIds.forEach(l=>{let c=this.shapes.find(h=>h.id===l);c&&this.dragStartPositions.set(l,{x:c.x,y:c.y});}),a.type==="table"&&!this.isTableMoveHandleHit(a.id,t))){let l=this.getTableAtPoint(t);l&&this.selectTableCell(l.shapeId,l.row,l.col,e.shiftKey);}}this.tools.get(this.activeTool)?.onPointerDown(t,e),this.updateCursor(t),this.render();};handlePointerMove=e=>{if(this.editingShapeId||(e.buttons===0&&this.pointerIsDown&&(this.pointerIsDown=false,this.setInteractionDragging(false),this.shouldRecoverTransient()&&(this.cancelTransientInteraction(),this.scheduleRender())),!this.pointerIsDown&&this.shouldRecoverTransient()&&this.cancelTransientInteraction(),!this.pointerIsDown&&e.target!==this.canvas))return;if(this.isPanning){let n=e.clientX-this.panStart.x,o=e.clientY-this.panStart.y;this.camera.translate(n,o),this.panStart={x:e.clientX,y:e.clientY},this.scheduleRender(),this.notifyListeners(),this.setInteractionDragging(false);return}let t=this.screenToPage({x:e.clientX,y:e.clientY});if(this.mindMapNodeDragCandidate){let{shapeId:n,nodeId:o,startPage:s,direction:a,siblingIds:l}=this.mindMapNodeDragCandidate,c=t.x-s.x,h=t.y-s.y;if(!this.isNodeDragging){if(Math.abs(c)<5&&Math.abs(h)<5)return;this.isNodeDragging=true;}let d=this.shapes.find(u=>u.id===n);if(d&&d.type==="mind-map"){let u=d,p=this.pageToMindMapLocal(u,t),m=N(u.root).positions,f=this.hitMindMapNodeBox(u.root,m,p,o,0),b=f?null:this.hitMindMapNodeBox(u.root,m,p,o);if(f){let w=this.mindMapChildGroup(u.root,m,f,p),C=w.childIds.length?this.calcMindMapReorderTarget(m,w.childIds,w.direction,p.x,p.y,o):0;this.mindMapReparentPlan={shapeId:n,nodeId:o,mode:"child",targetParentId:f,direction:w.direction,insertIndex:C},this.setReorderIndicator({shapeId:n,nodeId:o,targetIndex:C,direction:w.direction,siblingIds:this.mindMapSortByCross(w.childIds,w.direction,m),childParentId:f}),this.updateCursor(t),this.setInteractionDragging(this.isNodeDragging);return}let x=b?_e(u.root,b):null,I=_e(u.root,o),T=!!x&&!!I&&x.parent.id===I.parent.id&&x.direction===I.direction;if(x&&!T){let w=x.siblings.map(v=>v.id),C=this.calcMindMapReorderTarget(m,w,x.direction,p.x,p.y,o);this.mindMapReparentPlan={shapeId:n,nodeId:o,mode:"sibling",targetParentId:x.parent.id,direction:x.direction,insertIndex:C},this.setReorderIndicator({shapeId:n,nodeId:o,targetIndex:C,direction:x.direction,siblingIds:this.mindMapSortByCross(w,x.direction,m),childParentId:x.parent.id}),this.updateCursor(t),this.setInteractionDragging(this.isNodeDragging);return}this.mindMapReparentPlan=null;let S=this.calcMindMapReorderTarget(m,l,a,p.x,p.y,o);this.setReorderIndicator({shapeId:n,nodeId:o,targetIndex:S,direction:a,siblingIds:this.mindMapSortByCross(l,a,m)});}this.updateCursor(t),this.setInteractionDragging(this.isNodeDragging);return}let i=this.tools.get(this.activeTool);i?.onPointerMove(t,e),this.updateCursor(t),this.scheduleRender(),this.setInteractionDragging(!!i?.isDragging?.());};handlePointerUp=e=>{if(e.type==="pointerleave"){if(this.mindMapHoverNode=null,this.hoverLockedShapeId=null,this.pointerIsDown){this.scheduleRender();return}}else {if(!this.pointerIsDown&&e.target!==this.canvas)return;this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId);}if(this.pointerIsDown=false,this.setInteractionDragging(false),this.editingShapeId)return;if(this.isPanning){this.isPanning=false,this.updateCursor(this.screenToPage({x:e.clientX,y:e.clientY}));return}if(this.pendingMindMapHandle){let n=this.pendingMindMapHandle;this.pendingMindMapHandle=null;let o=this.screenToPage({x:e.clientX,y:e.clientY}),s=this.getMindMapHandleAtPoint(o);s&&s.shapeId===n.shapeId&&s.nodeId===n.nodeId&&s.kind===n.kind&&s.direction===n.direction&&this.addMindMapNodeFromHandle(s),this.updateCursor(o),this.scheduleRender();return}if(this.mindMapNodeDragCandidate){let n=this.mindMapReparentPlan,o=this.mindMapReorderTarget,{shapeId:s,nodeId:a}=this.mindMapNodeDragCandidate;this.mindMapNodeDragCandidate=null,this.isNodeDragging=false,this.mindMapReparentPlan=null,n&&n.shapeId===s&&n.nodeId===a?this.moveMindMapNodeToParent(s,a,n.targetParentId,n.direction,n.insertIndex):o&&o.shapeId===s&&o.nodeId===a?this.reorderMindMapNode(s,a,o.targetIndex):(this.mindMapReorderTarget=null,this.scheduleRender());return}let t=this.screenToPage({x:e.clientX,y:e.clientY});this.tools.get(this.activeTool)?.onPointerUp(t,e),this.updateCursor(t),this.scheduleRender();};updateCursor(e){let i=this.tools.get(this.activeTool)?.getCursor(e)??"default";if(this.canvas.style.cursor!==i&&(this.canvas.style.cursor=i),!this.pointerIsDown){let n=this.getMindMapCursorHitAtPoint(e);(n?.shapeId!==this.mindMapHoverNode?.shapeId||n?.nodeId!==this.mindMapHoverNode?.nodeId)&&(this.mindMapHoverNode=n,this.scheduleRender()),this.updateLockHover(e);}}updateLockHover(e){let t=null;if(this.activeTool==="select"){let i=this.getShapeAtPoint(e);if(i&&i.locked)t=i.id;else {let n=this.lockBadgeAtPoint(e);n&&(t=n.shapeId??n.memberIds[0]??null);}}t!==this.hoverLockedShapeId&&(this.hoverLockedShapeId=t,this.scheduleRender());}lockBadgeAtPoint(e){if(!this.hasLockedShapes())return null;let t=this.camera.getZoom(),i=4/t,n=this.renderer.lockBadgeTargets(this.shapes,t);for(let o=n.length-1;o>=0;o--){let s=n[o];if(e.x>=s.x-i&&e.x<=s.x+s.size+i&&e.y>=s.y-i&&e.y<=s.y+s.size+i)return s}return null}unlockFromBadge(e){e.groupId?this.setGroupLocked(e.groupId,false):e.shapeId&&this.setShapeLocked(e.shapeId,false),this.hoverLockedShapeId=e.shapeId??e.memberIds[0]??null,this.scheduleRender();}handleWheel=e=>{if(e.preventDefault(),e.ctrlKey||e.metaKey){let n=e.deltaY>0?.9:1.1;this.camera.zoomAt({x:e.clientX,y:e.clientY},n),this.scheduleRender(),this.notifyListeners();return}let t=e.deltaX||0,i=e.deltaY||0;e.deltaMode===1?(t*=40,i*=40):e.deltaMode===2&&(t*=120,i*=120),e.shiftKey&&(t=t||i,i=0),this.camera.translate(-t,-i),this.scheduleRender(),this.notifyListeners();};handleKeyDown=e=>{if(this.editingShapeId)return;let t=e.target;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable))return;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="z"){e.preventDefault(),e.shiftKey?this.redo():this.undo();return}if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="y"){e.preventDefault(),this.redo();return}if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="s"){e.preventDefault(),this.saveToStorage();return}if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),this.selectAll();return}let i=e.ctrlKey||e.metaKey;if(i&&e.altKey&&e.key.toLowerCase()==="c"){e.preventDefault(),this.copyStyle();return}if(i&&e.altKey&&e.key.toLowerCase()==="v"){e.preventDefault(),this.pasteStyle();return}if(i&&e.altKey&&e.key.toLowerCase()==="l"){e.preventDefault();let o=this.getSelectedShapes();o.length>0&&this.setSelectedShapesLocked(!o.every(s=>s.locked));return}if(i&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()==="c"){e.preventDefault(),this.copySelected();return}if(i&&!e.altKey&&e.key.toLowerCase()==="v"){e.preventDefault(),this.imagePasteHandled=false,setTimeout(()=>{this.imagePasteHandled||this.paste(),this.imagePasteHandled=false;},0);return}if(i&&!e.altKey&&e.key.toLowerCase()==="d"){e.preventDefault(),this.duplicateSelected();return}if(i&&!e.altKey&&e.key.toLowerCase()==="g"){e.preventDefault(),e.shiftKey?this.ungroupSelected():this.groupSelected();return}if(e.shiftKey&&!i&&!e.altKey){let o=e.key.toLowerCase();if(o==="h"){e.preventDefault(),this.flipSelected("horizontal");return}if(o==="v"){e.preventDefault(),this.flipSelected("vertical");return}}if(!e.ctrlKey&&!e.metaKey&&!e.altKey){if(e.key==="v"||e.key==="V"){this.setActiveTool("select"),e.preventDefault();return}if(e.key==="h"||e.key==="H"){this.setActiveTool("hand"),e.preventDefault();return}if(e.key==="n"||e.key==="N"){this.setActiveTool("sticky-note"),e.preventDefault();return}if(e.key==="a"||e.key==="A"){this.setActiveTool("arrow"),e.preventDefault();return}if(e.key==="t"||e.key==="T"){this.setActiveTool("text"),e.preventDefault();return}if(e.key==="e"||e.key==="E"){this.setActiveTool("eraser"),e.preventDefault();return}}if(e.key==="Delete"||e.key==="Backspace"){let o=this.mindMapSelectedNode;if(o){let s=this.shapes.find(a=>a.id===o.shapeId);if(s&&s.type==="mind-map"){e.preventDefault(),this.deleteMindMapNode(o.shapeId,o.nodeId);return}}}this.tools.get(this.activeTool)?.onKeyDown(e),this.scheduleRender();};handleKeyUp=e=>{if(this.editingShapeId)return;let t=e.target;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable))return;this.tools.get(this.activeTool)?.onKeyUp(e),this.scheduleRender();};handleResize=()=>{this.renderer.resize(window.innerWidth,window.innerHeight),this.scheduleRender();};screenToPage(e){let t=this.canvas.getBoundingClientRect();return this.camera.screenToPage({x:e.x-t.left,y:e.y-t.top})}insertTemplate(e){if(!e||e.length===0)return;this.closeInlineEditing();let t=at(e,0),i=this.canvas.getBoundingClientRect(),n=this.camera.screenToPage({x:i.width/2,y:i.height/2}),o=n.x-(t.x+t.width/2),s=n.y-(t.y+t.height/2),a=e.map(l=>{let c={...l,style:{...l.style}};return c.type==="arrow"||c.type==="line"?c.points=c.points.map(h=>({x:h.x+o,y:h.y+s})):(c.x+=o,c.y+=s),c});this.commitHistory(),this.shapes=[...this.shapes,...a],this.selectedIds=[],this.prefetchShapeIcons(),this.notifyListeners(),this.render();}addShape(e){this.shapes.push(e),this.prefetchShapeIcons(),this.notifyListeners();}prefetchShapeIcons(){let e=[];for(let t of this.shapes)t.type==="icon"&&e.push(t.iconId);e.length!==0&&ft(e).then(()=>this.scheduleRender()).catch(()=>{});}updateShape(e,t){let i=this.shapes.findIndex(n=>n.id===e);if(i!==-1){let n=this.shapes[i];this.shapes[i]={...n,...t};let o=this.shapes[i],s=t;if(o.type==="table"){let a=s.rowHeights!==void 0&&!Ns(s.rowHeights,n.rowHeights),l=s.cells!==void 0||s.colWidths!==void 0||s.fontSize!==void 0;!a&&l&&this.autoGrowTableRows(i);}(t.x!==void 0||t.y!==void 0)&&this.updateBoundArrows(e),this.notifyListeners();}}tableTopLeftAnchored(e,t,i){let n=(t-e.width)/2,o=(i-e.height)/2,s=Math.cos(e.rotation),a=Math.sin(e.rotation);return {x:e.x+n*s-o*a,y:e.y+n*a+o*s}}writeTable(e,t,i){let n=nt(i.colWidths),o=it(i.rowHeights),s=this.tableTopLeftAnchored(t,n,o);this.shapes[e]={...t,cells:i.cells,rowHeights:i.rowHeights,colWidths:i.colWidths,width:n,height:o,x:s.x,y:s.y},this.updateBoundArrows(t.id);}autoGrowTableRows(e){let t=this.shapes[e];if(!t||t.type!=="table")return;let i=di(t);if(!i)return;let n=t;this.writeTable(e,n,{cells:n.cells,rowHeights:i,colWidths:n.colWidths});}updateBoundArrows(e){let t=this.shapes.find(i=>i.id===e);t&&this.shapes.forEach(i=>{if(i.type==="arrow"){let n=i,o={};if(n.startBinding?.toShapeId===e){let s=this.getBindingPosition(t,n.startBinding.handle||"top");o.points=n.points.map((a,l)=>l===0?s:a);}if(n.endBinding?.toShapeId===e){let s=this.getBindingPosition(t,n.endBinding.handle||"top"),a=o.points||[...n.points];o.points=a.map((l,c)=>c===a.length-1?s:l);}o.points&&(this.shapes[this.shapes.indexOf(i)]={...n,...o});}});}getBindingPosition(e,t){switch(e.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "table":switch(t){case "top":return {x:e.x,y:e.y-e.height/2};case "bottom":return {x:e.x,y:e.y+e.height/2};case "left":return {x:e.x-e.width/2,y:e.y};case "right":return {x:e.x+e.width/2,y:e.y}}case "circle":switch(t){case "top":return {x:e.x,y:e.y-e.radius};case "bottom":return {x:e.x,y:e.y+e.radius};case "left":return {x:e.x-e.radius,y:e.y};case "right":return {x:e.x+e.radius,y:e.y}}case "hexagon":switch(t){case "top":return {x:e.x,y:e.y-e.height/2};case "bottom":return {x:e.x,y:e.y+e.height/2};case "left":return {x:e.x-e.width/2,y:e.y};case "right":return {x:e.x+e.width/2,y:e.y}}default:return {x:e.x,y:e.y}}}deleteShape(e){this.shapes=this.shapes.filter(t=>t.id!==e),this.selectedIds=this.selectedIds.filter(t=>t!==e),this.shapes=this.shapes.map(t=>{if(t.type==="arrow"){let i=t;if(i.startBinding?.toShapeId===e)return {...i,startBinding:void 0};if(i.endBinding?.toShapeId===e)return {...i,endBinding:void 0}}return t}),this.notifyListeners(),this.scheduleRender();}eraseShape(e){this.eraseFades.has(e)||this.shapes.some(t=>t.id===e)&&(this.eraseFades.set(e,Ni()),this.selectedIds.includes(e)&&(this.selectedIds=this.selectedIds.filter(t=>t!==e)),this.scheduleRender(),this.tickEraseFade());}tickEraseFade(){if(this.eraseFadeRaf!==null)return;let e=()=>{this.eraseFadeRaf=null;let t=Ni(),i=false;for(let[n,o]of [...this.eraseFades])t-o>=Ci?(this.eraseFades.delete(n),this.deleteShape(n)):i=true;this.scheduleRender(),i?this.eraseFadeRaf=requestAnimationFrame(e):this.notifyListeners();};this.eraseFadeRaf=requestAnimationFrame(e);}eraseFadeMap(){if(this.eraseFades.size===0)return;let e=Ni(),t=new Map;for(let[i,n]of this.eraseFades)t.set(i,Math.max(0,1-(e-n)/Ci));return t}clearEraseFades(){this.eraseFades.size!==0&&(this.eraseFades.clear(),this.eraseFadeRaf!==null&&(cancelAnimationFrame(this.eraseFadeRaf),this.eraseFadeRaf=null));}selectShape(e,t){if(!e)this.selectedIds=[];else {let i=this.getGroupMembers(e);if(t){let n=i.filter(o=>!this.selectedIds.includes(o));n.length>0?this.selectedIds=[...this.selectedIds,...n]:this.selectedIds=this.selectedIds.filter(o=>!i.includes(o));}else this.selectedIds=i;}this.notifyListeners(),this.scheduleRender();}selectShapes(e){let t=new Set;for(let i of e)for(let n of this.getGroupMembers(i))t.add(n);this.selectedIds=[...t],this.notifyListeners(),this.scheduleRender();}selectAll(){let e=this.shapes.filter(t=>!t.locked).map(t=>t.id);return e.length===0?false:(this.selectShapes(e),true)}getGroupMembers(e){let t=this.shapes.find(i=>i.id===e);return !t||!t.groupId?[e]:this.shapes.filter(i=>i.groupId===t.groupId&&!i.locked).map(i=>i.id)}getSelectedGroupId(){let e=this.getSelectedShapes();if(e.length===0)return null;let t=e[0].groupId;return !t||!e.every(n=>n.groupId===t)||this.shapes.filter(n=>n.groupId===t).length!==e.length?null:t}hasSelectedGroup(){return this.getSelectedShapes().some(e=>!!e.groupId)}groupMemberIds(e){return this.shapes.filter(t=>t.groupId===e).map(t=>t.id)}groupSelected(){let e=this.getSelectedShapes();if(e.length<2)return null;let t=`grp_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;this.commitHistory();for(let i of e){let n=this.shapes.findIndex(o=>o.id===i.id);n!==-1&&(this.shapes[n]={...this.shapes[n],groupId:t,locked:true});}return this.selectedIds=[],this.notifyListeners(),this.render(),t}ungroupSelected(){let e=new Set(this.getSelectedShapes().filter(t=>!!t.groupId).map(t=>t.groupId));return this.ungroupIds([...e])}ungroupIds(e){if(e.length===0)return false;let t=new Set;for(let i of e)for(let n of this.groupMemberIds(i))t.add(n);if(t.size===0)return false;this.commitHistory();for(let i of this.shapes.keys()){let n=this.shapes[i];if(!t.has(n.id))continue;let o={...n};delete o.groupId,n.locked&&n.groupId&&(o.locked=false),this.shapes[i]=o;}return this.notifyListeners(),this.render(),true}setGroupLocked(e,t){let i=this.groupMemberIds(e);if(i.length===0)return false;this.commitHistory();for(let n of this.shapes.keys())i.includes(this.shapes[n].id)&&(this.shapes[n]={...this.shapes[n],locked:t});return t?this.selectedIds=this.selectedIds.filter(n=>!i.includes(n)):this.selectedIds=[...i],this.notifyListeners(),this.render(),true}selectShapeRaw(e){this.selectedIds=e?[e]:[],this.notifyListeners(),this.scheduleRender();}getGroupIdOfSelected(){for(let e of this.getSelectedShapes())if(e.groupId)return e.groupId;return null}setBrushRect(e){this.brushRect=e,this.scheduleRender();}setSnapGuides(e){this.snapGuides=e;}setConnectingTarget(e){this.connectingTargetId!==e&&(this.connectingTargetId=e,this.scheduleRender());}setGenerationPreview(e){let t=this.genPreview;t?.from.x===e?.from.x&&t?.from.y===e?.from.y&&t?.to.x===e?.to.x&&t?.to.y===e?.to.y&&t?.type===e?.type&&t?.targetShapeId===e?.targetShapeId&&t?.dragging===e?.dragging&&t?.sourceEdge===e?.sourceEdge||(this.genPreview=e,this.scheduleRender());}setHoverAnchorShape(e){this.hoverAnchorShapeId!==e&&(this.hoverAnchorShapeId=e,this.scheduleRender());}setHoverConnector(e){this.hoverConnectorId!==e&&(this.hoverConnectorId=e,this.scheduleRender());}getConnectorRoute(e){let t=this.shapes.find(n=>n.id===e);if(!t)return [];let i=new Map(this.shapes.map(n=>[n.id,n]));return this.renderer.getConnectorRoute(t,i)}getAutoConnectorRoute(e){let t=this.shapes.find(n=>n.id===e);if(!t)return [];let i=new Map(this.shapes.map(n=>[n.id,n]));return this.renderer.getConnectorRoute(t,i,{ignoreUserPoints:true})}clearTransientPreview(){return !!this.genPreview||!!this.connectingTargetId||this.snapGuides.length>0||!!this.brushRect||!!this.hoverAnchorShapeId||!!this.hoverConnectorId||!!this.pendingMindMapHandle?(this.genPreview=null,this.connectingTargetId=null,this.snapGuides=[],this.brushRect=null,this.hoverAnchorShapeId=null,this.hoverConnectorId=null,this.pendingMindMapHandle=null,true):false}openGenerationMenu(e){let t=this.camera.getZoom(),i=(e.context.to.x+this.camera.x)*t,n=(e.context.to.y+this.camera.y)*t;this.emitUi({kind:"shapeTypeMenu",screenX:i,screenY:n,context:e.context,existingArrowId:e.existingArrowId,defaultShapeType:e.defaultShapeType});}lineStyle(){return {strokeColor:"#1f2937",fillColor:"transparent",strokeWidth:2,strokeDash:null}}computeSourceBinding(e){if(!e.sourceShapeId||!e.edge)return;let t=this.shapes.find(n=>n.id===e.sourceShapeId);if(!t)return;let i={n:"top",e:"right",s:"bottom",w:"left"};return {toShapeId:t.id,handle:i[e.edge]}}connectHandle(e,t,i){return un(e,t,i)}createFloatingLine(e){this.commitHistory();let t=e.from,i=e.to,n=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,o={id:n,type:"arrow",x:t.x,y:t.y,points:[{x:t.x,y:t.y},{x:i.x,y:i.y}],rotation:0,style:this.lineStyle(),startBinding:this.computeSourceBinding(e),connectionType:"polyline",arrowHead:this.arrowStyle.arrowHead,dashed:this.arrowStyle.dashed};return this.addShape(o),this.selectedIds=[n],this.notifyListeners(),this.render(),n}createGeneratedConnection(e,t){this.commitHistory();let i=t.type,n,o;e.sourceShapeId&&(o=this.shapes.find(h=>h.id===e.sourceShapeId),o&&ln(o.type)&&(n={...o.style}));let s=n?void 0:this.stickyNoteColor,a=Te(i,e.to,n,s,cn(i,o));this.addShape(a);let l=e.from,c={toShapeId:a.id,handle:this.connectHandle(l,e.to,e.edge),auto:true};if(t.existingArrowId)this.updateArrowBinding(t.existingArrowId,"end",a.id,{toShapeId:a.id,handle:this.connectHandle(l,e.to,e.edge),auto:true});else {let d={id:`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"arrow",x:l.x,y:l.y,points:[{x:l.x,y:l.y},{x:e.to.x,y:e.to.y}],rotation:0,style:this.lineStyle(),startBinding:this.computeSourceBinding(e),endBinding:c,connectionType:"polyline",arrowHead:this.arrowStyle.arrowHead,dashed:this.arrowStyle.dashed};this.addShape(d);}this.selectedIds=[a.id],this.notifyListeners(),this.render();}connectToExisting(e,t,i){this.commitHistory();let n=this.shapes.find(h=>h.id===t);if(!n)return;let o=e.from,s=i?.handle??this.connectHandle(o,{x:n.x,y:n.y},e.edge),a=this.getBindingPosition(n,s),l=`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,c={id:l,type:"arrow",x:o.x,y:o.y,points:[{x:o.x,y:o.y},{x:a.x,y:a.y}],rotation:0,style:this.lineStyle(),startBinding:this.computeSourceBinding(e),endBinding:{toShapeId:t,handle:s,auto:!i||!i.handle&&!i.isPrecise},connectionType:"polyline",arrowHead:this.arrowStyle.arrowHead,dashed:this.arrowStyle.dashed};this.addShape(c),this.selectedIds=[l],this.notifyListeners(),this.render();}subscribeUi(e){return this.uiListeners.add(e),()=>this.uiListeners.delete(e)}emitUi(e){this.uiListeners.forEach(t=>t(e));}setInteractionDragging(e){e!==this.interactionDragging&&(this.interactionDragging=e,this.emitUi({kind:"drag",active:e}));}updateSelectedShapesStyle(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(n=>n.id===t);i!==-1&&(this.shapes[i]={...this.shapes[i],style:{...this.shapes[i].style,...e}});}),this.notifyListeners(),this.render());}updateSelectedShapesText(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(n=>n.id===t);i!==-1&&(this.shapes[i]={...this.shapes[i],...e});}),this.notifyListeners(),this.render());}updateConnectionType(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(n=>n.id===t);if(i!==-1){let n=this.shapes[i];(n.type==="line"||n.type==="arrow")&&(this.shapes[i]={...n,connectionType:e});}}),this.notifyListeners(),this.render());}getSelectedShapes(){return this.shapes.filter(e=>this.selectedIds.includes(e.id))}isEditing(){return this.editingShapeId!==null}deleteSelected(){let e=this.selectedIds.filter(t=>{let i=this.shapes.find(n=>n.id===t);return i&&!i.locked});return e.length===0?false:(this.commitHistory(),e.forEach(t=>this.deleteShape(t)),this.releaseUnusedImageUrls(),true)}copySelected(){let e=this.getSelectedShapes().filter(t=>!t.locked);return e.length===0?false:(this.clipboardShapes=this.cloneShapes(e),this.pasteSeq=0,true)}hasClipboard(){return this.clipboardShapes.length>0}cloneWithOffset(e,t){let i=()=>`shape_${Date.now()}_${Math.random().toString(36).slice(2,9)}`,n=new Map,o=()=>`grp_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return this.cloneShapes(e).map(s=>{let a={...s,id:i()};if(s.groupId){let l=n.get(s.groupId);l||(l=o(),n.set(s.groupId,l)),a.groupId=l;}return a.x+=t,a.y+=t,Array.isArray(a.points)&&(a.points=a.points.map(l=>({x:l.x+t,y:l.y+t}))),Array.isArray(a.userPoints)&&(a.userPoints=a.userPoints.map(l=>({x:l.x+t,y:l.y+t}))),Array.isArray(a.userPointsBase)&&(a.userPointsBase=a.userPointsBase.map(l=>({x:l.x+t,y:l.y+t}))),delete a.startBinding,delete a.endBinding,a})}paste(){if(this.clipboardShapes.length===0)return false;let e=20*(this.pasteSeq+1);this.pasteSeq+=1,this.commitHistory();let t=this.cloneWithOffset(this.clipboardShapes,e);return this.shapes.push(...t),this.selectedIds=t.map(i=>i.id),this.notifyListeners(),this.render(),true}duplicateSelected(){let e=this.getSelectedShapes().filter(i=>!i.locked);if(e.length===0)return false;this.commitHistory();let t=this.cloneWithOffset(e,20);return this.shapes.push(...t),this.selectedIds=t.map(i=>i.id),this.notifyListeners(),this.render(),true}async copySelectedAsImage(){let e=this.getSelectedShapes().filter(t=>!t.locked);if(e.length===0)return false;try{if(!navigator.clipboard||typeof ClipboardItem>"u")return !1;let t=await Cn(e,"png",{background:null,padding:16});return await navigator.clipboard.write([new ClipboardItem({"image/png":t})]),!0}catch{return false}}copyStyle(){let e=this.getSelectedShapes().find(t=>!t.locked);return e?(this.copiedStyle={style:{...e.style},...e.textColor!==void 0?{textColor:e.textColor}:{},...e.fontSize!==void 0?{fontSize:e.fontSize}:{}},true):false}hasCopiedStyle(){return this.copiedStyle!==null}pasteStyle(){if(!this.copiedStyle||this.selectedIds.length===0)return false;this.commitHistory();let e=this.copiedStyle;return this.selectedIds.forEach(t=>{let i=this.shapes.find(n=>n.id===t);i&&this.updateShape(t,{style:{...i.style,...e.style},...e.textColor!==void 0?{textColor:e.textColor}:{},...e.fontSize!==void 0?{fontSize:e.fontSize}:{}});}),true}flipSelected(e){let t=this.getSelectedShapes().filter(i=>!i.locked&&Vn(i.type));return t.length===0?false:(this.commitHistory(),t.forEach(i=>{this.updateShape(i.id,e==="horizontal"?{flipX:!i.flipX}:{flipY:!i.flipY});}),true)}rotateSelected(e){let t=this.getSelectedShapes().filter(o=>!o.locked);if(t.length===0)return false;this.commitHistory();let i=e*Math.PI/180,n=Math.PI*2;return t.forEach(o=>{this.updateShape(o.id,{rotation:((o.rotation+i)%n+n)%n});}),true}rotateSelected90(e=true){return this.rotateSelected(e?90:-90)}setSelectedShapesLocked(e){let t=this.getSelectedShapes();return t.length===0?false:(this.commitHistory(),t.forEach(i=>this.updateShape(i.id,{locked:e})),e&&(this.selectedIds=[],this.notifyListeners(),this.render()),true)}setShapeLocked(e,t){let i=this.shapes.find(n=>n.id===e);if(!i)return false;if(this.commitHistory(),this.updateShape(e,{locked:t}),t){let n=i.groupId?this.groupMemberIds(i.groupId):[e];this.selectedIds=this.selectedIds.filter(o=>!n.includes(o)),this.notifyListeners();}return this.render(),true}isShapeLocked(e){return !!this.shapes.find(t=>t.id===e)?.locked}hasLockedShapes(){return this.shapes.some(e=>!!e.locked)}unlockAll(){let e=this.shapes.filter(i=>i.locked);if(e.length===0)return false;this.commitHistory();let t=new Set(e.map(i=>i.id));return this.shapes=this.shapes.map(i=>t.has(i.id)?{...i,locked:false}:i),this.notifyListeners(),this.render(),true}bringToFront(){if(this.selectedIds.length===0)return false;this.commitHistory();let e=new Set(this.selectedIds),t=this.shapes.filter(n=>e.has(n.id)),i=this.shapes.filter(n=>!e.has(n.id));return this.shapes=[...i,...t],this.notifyListeners(),this.render(),true}sendToBack(){if(this.selectedIds.length===0)return false;this.commitHistory();let e=new Set(this.selectedIds),t=this.shapes.filter(n=>e.has(n.id)),i=this.shapes.filter(n=>!e.has(n.id));return this.shapes=[...t,...i],this.notifyListeners(),this.render(),true}bringForward(){if(this.selectedIds.length===0)return false;this.commitHistory();let e=new Set(this.selectedIds),t=[...this.shapes];for(let i=t.length-2;i>=0;i--)e.has(t[i].id)&&!e.has(t[i+1].id)&&([t[i],t[i+1]]=[t[i+1],t[i]]);return this.shapes=t,this.notifyListeners(),this.render(),true}sendBackward(){if(this.selectedIds.length===0)return false;this.commitHistory();let e=new Set(this.selectedIds),t=[...this.shapes];for(let i=1;i<t.length;i++)e.has(t[i].id)&&!e.has(t[i-1].id)&&([t[i],t[i-1]]=[t[i-1],t[i]]);return this.shapes=t,this.notifyListeners(),this.render(),true}updateArrowHeadType(e){if(this.selectedIds.length===0)return;this.commitHistory();let t=e==="dependency"||e==="realization";this.selectedIds.forEach(i=>{let n=this.shapes.findIndex(o=>o.id===i);if(n!==-1){let o=this.shapes[n];o.type==="arrow"&&(this.shapes[n]=t?{...o,arrowHead:e,dashed:true}:{...o,arrowHead:e});}}),this.notifyListeners(),this.render();}updateArrowStyle(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(a=>a.id===t);if(i===-1)return;let n=this.shapes[i];if(n.type!=="arrow")return;let o=e.arrowHead??n.arrowHead??"end",s=o==="dependency"||o==="realization";this.shapes[i]={...n,...e,arrowHead:o,dashed:s?true:e.dashed??n.dashed??false};}),this.notifyListeners(),this.render());}getArrowStyle(){return {...this.arrowStyle}}setArrowStyle(e){let t={...this.arrowStyle,...e};(t.arrowHead==="dependency"||t.arrowHead==="realization")&&(t.dashed=true),this.arrowStyle=t,this.notifyListeners();}getStickyNoteColor(){return this.stickyNoteColor}insertIcon(e,t=ri){let i=$e(e);if(!i||!oi(e))return;let n=this.viewportCenter(),o=this.iconInsertSeq++%6*14,s=si(i),a={id:`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"icon",iconId:e,x:n.x+o,y:n.y+o,width:t,height:t,rotation:0,style:{strokeColor:s,fillColor:s,fillOpacity:1,strokeWidth:2,strokeDash:null}};return this.commitHistory(),this.addShape(a),this.selectShape(a.id,false),this.setActiveTool("select"),a.id}setImageUpload(e){this.imageUploadOption=e??null;}getImageUpload(){return this.imageUploadOption}hasImageUploader(){return !!this.imageUploadOption}getTemporaryImageSrcs(){return _n(this.shapes)}hasTemporaryImages(){return this.getTemporaryImageSrcs().length>0}insertImageShape(e){let t=e.naturalWidth??0,i=e.naturalHeight??0,n=Vo.width,o=Vo.height;if(t>0&&i>0){let c=Math.min(1,Bs/Math.max(t,i));n=Math.max(24,Math.round(t*c)),o=Math.max(24,Math.round(i*c));}let s=e.at??this.viewportCenter(),a=this.imageInsertSeq++%6*16,l={id:`shape_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"image",src:e.src,...e.temporary?{temporary:true}:{},...t>0?{naturalWidth:t}:{},...i>0?{naturalHeight:i}:{},x:s.x+a,y:s.y+a,width:n,height:o,rotation:0,borderRadius:4,style:{strokeColor:"transparent",fillColor:"#f3f4f6",fillOpacity:1,strokeWidth:0,strokeDash:null}};return this.commitHistory(),this.addShape(l),this.selectShape(l.id,false),this.setActiveTool("select"),l.id}async insertImageFile(e,t){if(!e||!/^image\//.test(e.type||""))throw new Error("\u4E0D\u662F\u56FE\u7247\u6587\u4EF6");let i=typeof this.imageUploadOption=="object"&&this.imageUploadOption?this.imageUploadOption.maxSizeBytes??31457280:31457280;if(e.size>i)throw new Error(`image.tooLarge: \u56FE\u7247\u5927\u5C0F ${(e.size/1024/1024).toFixed(2)} MB \u8D85\u8FC7\u4E0A\u9650 ${(i/1024/1024).toFixed(2)} MB`);let n,o=false;this.imageUploadOption?n=await Yi(this.imageUploadOption,e):(n=URL.createObjectURL(e),Gi(n),this.ownImageUrls.add(n),o=true);let s=await Ke(n);return this.insertImageShape({src:n,naturalWidth:s?.width,naturalHeight:s?.height,temporary:o,at:t})}async insertImageFiles(e,t){let i=Array.from(e).filter(o=>!!o&&/^image\//.test(o.type||"")),n=[];for(let o of i)n.push(await this.insertImageFile(o,t));return n}async insertImageFromUrl(e,t){if(!e)throw new Error("\u56FE\u7247\u5730\u5740\u4E3A\u7A7A");let i=await Ke(e);return this.insertImageShape({src:e,naturalWidth:i?.width,naturalHeight:i?.height,temporary:e.startsWith("blob:"),at:t})}releaseUnusedImageUrls(){if(this.ownImageUrls.size===0)return;let e=new Set(this.shapes.filter(t=>t.type==="image").map(t=>t.src));for(let t of Array.from(this.ownImageUrls))e.has(t)||(this.ownImageUrls.delete(t),Bn(t));}handlePasteEvent=e=>{if(this.editingShapeId)return;let t=e.target;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable))return;let i=e.clipboardData?.items;if(!i)return;let n=[];for(let o of Array.from(i))if(o.kind==="file"&&(o.type||"").startsWith("image/")){let s=o.getAsFile();s&&n.push(s);}n.length!==0&&(e.preventDefault(),this.imagePasteHandled=true,this.insertImageFiles(n).catch(o=>{this.emitUi({kind:"imageError",message:o instanceof Error?o.message:String(o)});}));};viewportCenter(){let e=this.canvas.getBoundingClientRect();return this.camera.screenToPage({x:e.width/2,y:e.height/2})}setStickyNoteColor(e){if(!ii(e))return;let t=e.trim().toLowerCase();t!==this.stickyNoteColor&&(this.stickyNoteColor=t,this.notifyListeners());}updateArrowDashed(e){this.selectedIds.length!==0&&(this.commitHistory(),this.selectedIds.forEach(t=>{let i=this.shapes.findIndex(n=>n.id===t);if(i!==-1){let n=this.shapes[i];n.type==="arrow"&&(this.shapes[i]={...n,dashed:e});}}),this.notifyListeners(),this.render());}updateUmlClass(e,t){let i=this.shapes.findIndex(h=>h.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="uml-class")return;this.commitHistory();let o=t.className??n.className,s=t.attributes??n.attributes,a=t.methods??n.methods,{width:l,height:c}=hn(o,s,a);this.shapes[i]={...n,className:o,attributes:s,methods:a,width:l,height:c},this.notifyListeners(),this.render();}updateUmlInterface(e,t){let i=this.shapes.findIndex(h=>h.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="uml-interface")return;this.commitHistory();let o=n,s=t.className??o.className,a=t.methods??o.methods,{width:l,height:c}=xi(s,a);this.shapes[i]={...n,className:s,methods:a,width:l,height:c},this.notifyListeners(),this.render();}getSelectedUml(){if(this.selectedIds.length!==1)return null;let e=this.shapes.find(t=>t.id===this.selectedIds[0]);return e&&(e.type==="uml-class"||e.type==="uml-interface")?e:null}getUmlById(e){let t=this.shapes.find(i=>i.id===e);return t&&(t.type==="uml-class"||t.type==="uml-interface")?t:null}pageToMindMapLocal(e,t){let i=t.x-e.x,n=t.y-e.y,o=Math.cos(e.rotation),s=Math.sin(e.rotation);return {x:i*o+n*s,y:-i*s+n*o}}calcMindMapReorderTarget(e,t,i,n,o,s){if(t.length<=1)return 0;let a=ce(i),l=a?o:n,c=t.filter(d=>d!==s).map(d=>e.get(d)).filter(d=>!!d).map(d=>a?d.y:d.x).sort((d,u)=>d-u),h=0;for(let d of c)if(l>d)h++;else break;return h}anchorMindMapAtRoot(e,t,i){let n=N(t).positions.get(t.id),o=N(i).positions.get(i.id);if(!n||!o)return {x:e.x,y:e.y};let s=Math.cos(e.rotation),a=Math.sin(e.rotation),l=n.x*s-n.y*a,c=n.x*a+n.y*s,h=o.x*s-o.y*a,d=o.x*a+o.y*s;return {x:e.x+(l-h),y:e.y+(c-d)}}getSelectedMindMap(){if(this.selectedIds.length!==1)return null;let e=this.shapes.find(t=>t.id===this.selectedIds[0]);return e&&e.type==="mind-map"?e:null}getMindMapNodeAtPoint(e){for(let t=this.shapes.length-1;t>=0;t--){let i=this.shapes[t];if(i.type!=="mind-map")continue;let n=i,o=e.x-n.x,s=e.y-n.y,a=Math.cos(n.rotation),l=Math.sin(n.rotation),c=o*a+s*l,h=-o*l+s*a;if(Math.abs(c)>n.width/2||Math.abs(h)>n.height/2)continue;let d=N(n.root);for(let[u,p]of d.positions)if(Math.abs(c-p.x)<=p.width/2&&Math.abs(h-p.y)<=p.height/2)return {shapeId:n.id,nodeId:u};return {shapeId:n.id,nodeId:n.root.id}}return null}getMindMapNodeAtScreenPoint(e){return this.getMindMapNodeAtPoint(this.screenToPage(e))}getMindMapNodeBoxAtPoint(e){for(let t=this.shapes.length-1;t>=0;t--){let i=this.shapes[t];if(i.type!=="mind-map")continue;let n=i,o=e.x-n.x,s=e.y-n.y,a=Math.cos(n.rotation),l=Math.sin(n.rotation),c=o*a+s*l,h=-o*l+s*a,d=N(n.root);for(let[u,p]of d.positions)if(Math.abs(c-p.x)<=p.width/2&&Math.abs(h-p.y)<=p.height/2)return {shapeId:n.id,nodeId:u}}return null}hitMindMapNodeBox(e,t,i,n,o=48){let s=o,a=W(e,n),l=null,c=1/0;for(let[h,d]of t){if(h===n||a&&W(a,h))continue;let u=Math.abs(i.x-d.x)-(d.width/2+s),p=Math.abs(i.y-d.y)-(d.height/2+s);if(u>0||p>0)continue;let g=Math.abs(i.x-d.x)+Math.abs(i.y-d.y);g<c&&(c=g,l=h);}return l}mindMapChildGroup(e,t,i,n){let s=W(e,i)?.children??[];if(i!==e.id)return {direction:t.get(i)?.direction??"right",childIds:s.map(d=>d.id)};if(s.length===0)return {direction:"right",childIds:[]};let a="right",l=1/0;for(let h of Ze){let d=s.filter(g=>Z(g,"right")===h);if(d.length===0)continue;let u=t.get(d[0].id);if(!u)continue;let p=ce(h)?Math.abs(n.y-u.y):Math.abs(n.x-u.x);p<l&&(l=p,a=h);}let c=s.filter(h=>Z(h,"right")===a).map(h=>h.id);return {direction:a,childIds:c}}mindMapSortByCross(e,t,i){return [...e].sort((n,o)=>{let s=i.get(n),a=i.get(o);return !s||!a?0:ce(t)?s.y-a.y:s.x-a.x})}setReorderIndicator(e){let t=this.mindMapReorderTarget;!t&&!e||t&&e&&t.shapeId===e.shapeId&&t.nodeId===e.nodeId&&t.targetIndex===e.targetIndex&&t.direction===e.direction&&t.childParentId===e.childParentId&&t.siblingIds.join(",")===e.siblingIds.join(",")||(this.mindMapReorderTarget=e,this.scheduleRender());}getMindMapCursorHitAtPoint(e){let t=this.getMindMapCollapseHitAtPoint(e);if(t)return t;let i=this.getMindMapHandleAtPoint(e);if(i)return {shapeId:i.shapeId,nodeId:i.nodeId};for(let n=this.shapes.length-1;n>=0;n--){let o=this.shapes[n];if(o.type!=="mind-map")continue;let s=o,a=e.x-s.x,l=e.y-s.y,c=Math.cos(s.rotation),h=Math.sin(s.rotation),d=a*c+l*h,u=-a*h+l*c,p=N(s.root);for(let[g,m]of p.positions)if(Math.abs(d-m.x)<=m.width/2&&Math.abs(u-m.y)<=m.height/2)return {shapeId:s.id,nodeId:g}}return null}selectMindMapNode(e,t){let i=this.shapes.find(n=>n.id===e);!i||i.type!=="mind-map"||(this.selectedIds=[e],this.mindMapSelectedNode={shapeId:e,nodeId:t},this.notifyListeners(),this.render());}getMindMapEditingShapeId(){return this.mindMapEditingShapeId}getMindMapSelectedNode(){return this.mindMapSelectedNode}getMindMapNode(e,t){let i=this.shapes.find(n=>n.id===e);return !i||i.type!=="mind-map"?null:W(i.root,t)}getMindMapNodeScreenRect(e,t){let i=this.shapes.find(b=>b.id===e);if(!i||i.type!=="mind-map")return null;let n=i,s=N(n.root).positions.get(t);if(!s)return null;let a=this.camera.getZoom(),l=s.x,c=s.y,h=Math.cos(n.rotation),d=Math.sin(n.rotation),u=l*h-c*d,p=l*d+c*h,g=this.camera.pageToScreen({x:n.x,y:n.y}),m=g.x+u*a,f=g.y+p*a;return {x:m-s.width*a/2,y:f-s.height*a/2,width:s.width*a,height:s.height*a}}getMindMapCollapseHitAtPoint(e){for(let t of this.shapes){if(t.type!=="mind-map")continue;let i=t,n=N(i.root),o=this.pageToMindMapLocal(i,e);for(let[s,a]of n.positions){let l=W(i.root,s);if(!l||!l.children||l.children.length===0)continue;let c=qt(a,a.direction),h=o.x-c.x,d=o.y-c.y;if(h*h+d*d<=121)return {shapeId:t.id,nodeId:s}}}return null}getMindMapHandleAtPoint(e){for(let t=this.shapes.length-1;t>=0;t--){let i=this.shapes[t];if(i.type!=="mind-map")continue;let n=i,o=this.pageToMindMapLocal(n,e);if(Math.abs(o.x)>n.width/2+40||Math.abs(o.y)>n.height/2+40)continue;let s=Qn(n.root,N(n.root).positions,o.x,o.y);if(s)return {shapeId:i.id,nodeId:s.nodeId,kind:s.kind,direction:s.direction}}return null}addMindMapNodeFromHandle(e){e.kind==="child"?this.addMindMapChild(e.shapeId,e.nodeId,e.direction):this.addMindMapSibling(e.shapeId,e.nodeId),this.mindMapHoverNode=null;}beginMindMapEdit(e,t){let i=this.shapes.find(o=>o.id===e);if(!i||i.type!=="mind-map")return;let n=i;this.mindMapEditingShapeId=e,this.mindMapSelectedNode={shapeId:e,nodeId:t&&W(n.root,t)?t:n.root.id},this.selectedIds=[e],this.notifyListeners(),this.render();}exitMindMapEdit(){this.mindMapEditingShapeId=null,this.notifyListeners(),this.render();}updateMindMapNode(e,t,i,n=true){let o=this.shapes.findIndex(g=>g.id===e);if(o===-1)return;let s=this.shapes[o];if(s.type!=="mind-map")return;let a=s,l=W(a.root,t);if(!l||!Object.keys(i).some(g=>l[g]!==i[g]))return;n&&this.commitHistory();let h=je(a.root,t,i),{width:d,height:u}=N(h),p=this.anchorMindMapAtRoot(a,a.root,h);this.shapes[o]={...a,root:h,width:d,height:u,x:p.x,y:p.y},this.notifyListeners(),this.render();}setMindMapNodeOffset(e,t,i){let n=this.shapes.findIndex(u=>u.id===e);if(n===-1)return;let o=this.shapes[n];if(o.type!=="mind-map")return;let s=o,a=W(s.root,t);if(!a||a.offset?.dx===i.dx&&a.offset?.dy===i.dy)return;let l=je(s.root,t,{offset:i}),{width:c,height:h}=N(l),d=this.anchorMindMapAtRoot(s,s.root,l);this.shapes[n]={...s,root:l,width:c,height:h,x:d.x,y:d.y},this.render();}addMindMapChild(e,t,i){let n=this.shapes.findIndex(g=>g.id===e);if(n===-1)return;let o=this.shapes[n];if(o.type!=="mind-map")return;let s=o,a=W(s.root,t);if(!a)return;let l=i??Z(a,"right"),c={id:`mm_${Date.now()}_${Math.random().toString(36).substr(2,6)}`,text:le("mindmap.defaultBranch"),direction:l},h=jn(s.root,t,c);this.commitHistory();let{width:d,height:u}=N(h),p=this.anchorMindMapAtRoot(s,s.root,h);this.shapes[n]={...s,root:h,width:d,height:u,x:p.x,y:p.y},this.mindMapSelectedNode={shapeId:e,nodeId:c.id},this.notifyListeners(),this.render();}addMindMapSibling(e,t){let i=this.shapes.findIndex(p=>p.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="mind-map")return;let o=n,s=W(o.root,t);if(!s||!qe(o.root,t))return;let a=Z(s,"right"),l={id:`mm_${Date.now()}_${Math.random().toString(36).substr(2,6)}`,text:le("mindmap.defaultBranch"),direction:a},c=qn(o.root,t,l);this.commitHistory();let{width:h,height:d}=N(c),u=this.anchorMindMapAtRoot(o,o.root,c);this.shapes[i]={...o,root:c,width:h,height:d,x:u.x,y:u.y},this.mindMapSelectedNode={shapeId:e,nodeId:l.id},this.notifyListeners(),this.render();}reorderMindMapNode(e,t,i){let n=this.shapes.findIndex(u=>u.id===e);if(n===-1)return;let o=this.shapes[n];if(o.type!=="mind-map")return;let s=o,a=_e(s.root,t);if(!a||i===a.index){this.mindMapReorderTarget=null,this.scheduleRender();return}this.commitHistory();let l=ei(s.root,t,i),{width:c,height:h}=N(l),d=this.anchorMindMapAtRoot(s,s.root,l);this.shapes[n]={...s,root:l,width:c,height:h,x:d.x,y:d.y},this.mindMapSelectedNode={shapeId:e,nodeId:t},this.mindMapReorderTarget=null,this.notifyListeners(),this.render();}moveMindMapNodeToParent(e,t,i,n,o){let s=this.shapes.findIndex(p=>p.id===e);if(s===-1)return;let a=this.shapes[s];if(a.type!=="mind-map")return;let l=a,c=ni(l.root,t,i,n,o);if(this.mindMapReorderTarget=null,this.mindMapReparentPlan=null,c===l.root){this.scheduleRender();return}this.commitHistory();let{width:h,height:d}=N(c),u=this.anchorMindMapAtRoot(l,l.root,c);this.shapes[s]={...l,root:c,width:h,height:d,x:u.x,y:u.y},this.mindMapSelectedNode={shapeId:e,nodeId:t},this.notifyListeners(),this.render();}deleteMindMapNode(e,t){let i=this.shapes.findIndex(d=>d.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="mind-map")return;let o=n;if(o.root.id===t){this.commitHistory(),this.shapes=this.shapes.filter(d=>d.id!==e),this.selectedIds=this.selectedIds.filter(d=>d!==e),this.mindMapEditingShapeId=null,this.mindMapSelectedNode=null,this.notifyListeners(),this.render();return}let s=Zt(o.root,t);if(!s)return;this.commitHistory();let{width:a,height:l}=N(s),c=this.anchorMindMapAtRoot(o,o.root,s);this.shapes[i]={...o,root:s,width:a,height:l,x:c.x,y:c.y};let h=qe(o.root,t);this.mindMapSelectedNode=h?{shapeId:e,nodeId:h.id}:{shapeId:e,nodeId:s.id},this.notifyListeners(),this.render();}toggleMindMapCollapse(e,t){let i=this.shapes.findIndex(d=>d.id===e);if(i===-1)return;let n=this.shapes[i];if(n.type!=="mind-map")return;let o=n,s=W(o.root,t);if(!s||!s.children||s.children.length===0)return;this.commitHistory();let a=je(o.root,t,{collapsed:!s.collapsed}),{width:l,height:c}=N(a),h=this.anchorMindMapAtRoot(o,o.root,a);this.shapes[i]={...o,root:a,width:l,height:c,x:h.x,y:h.y},this.notifyListeners(),this.render();}canPromoteMindMapNode(e,t,i){let n=this.shapes.find(a=>a.id===e);if(!n||n.type!=="mind-map")return false;let o=n;return o.root.id===t?false:jt(o.root,t)>=i+1}promoteMindMapNode(e,t,i){let n=this.shapes.findIndex(d=>d.id===e);if(n===-1)return;let o=this.shapes[n];if(o.type!=="mind-map")return;let s=o;if(s.root.id===t||!this.canPromoteMindMapNode(e,t,i))return;let a=ti(s.root,t,i);if(a===s.root)return;this.commitHistory();let{width:l,height:c}=N(a),h=this.anchorMindMapAtRoot(s,s.root,a);this.shapes[n]={...s,root:a,width:l,height:c,x:h.x,y:h.y},this.mindMapSelectedNode={shapeId:e,nodeId:t},this.notifyListeners(),this.render();}getSelectedTable(){if(this.selectedIds.length!==1)return null;let e=this.shapes.find(t=>t.id===this.selectedIds[0]);return e&&e.type==="table"?e:null}getTableById(e){let t=this.shapes.find(i=>i.id===e);return t&&t.type==="table"?t:null}getTableCell(e,t,i){return this.getTableById(e)?.cells[t]?.[i]??null}getTableAtPoint(e){for(let t=this.shapes.length-1;t>=0;t--){let i=this.shapes[t];if(i.type!=="table")continue;let n=i,o=Ie(n,e),s=mi(n,o.x,o.y);if(s)return {shapeId:n.id,row:s.row,col:s.col}}return null}getTableAtScreenPoint(e){return this.getTableAtPoint(this.screenToPage(e))}getTableCellAtPointClamped(e,t){let i=this.getTableById(e);return i?St(i,Ie(i,t)):null}isTableMoveHandleHit(e,t){let i=this.getTableById(e);return i?tt(i,t,this.camera.getZoom()):false}getTableScreenRect(e,t,i){let n=this.getTableById(e);if(!n)return null;let o=t!==void 0&&i!==void 0?ie(n,t,i):{ox:0,oy:0,width:n.width,height:n.height},s=this.camera.getZoom(),a=o.ox-n.width/2,l=o.oy-n.height/2,c=Math.cos(n.rotation),h=Math.sin(n.rotation),d=a*c-l*h,u=a*h+l*c,p=this.camera.pageToScreen({x:n.x,y:n.y});return {x:p.x+d*s,y:p.y+u*s,width:o.width*s,height:o.height*s}}getTableSelection(){return this.tableSelection}selectTableCell(e,t,i,n=false){let o=this.getTableById(e);!o||!o.cells[t]?.[i]||(n&&this.tableSelection&&this.tableSelection.shapeId===e?this.tableSelection.focus={row:t,col:i}:this.tableSelection={shapeId:e,anchor:{row:t,col:i},focus:{row:t,col:i}},this.tableEditing=null,this.selectedIds=[e],this.notifyListeners(),this.render());}getTableEditing(){return this.tableEditing}beginTableEdit(e,t,i){let n=this.getTableById(e);!n||!n.cells[t]?.[i]||(this.tableEditing={shapeId:e,row:t,col:i},this.tableSelection={shapeId:e,anchor:{row:t,col:i},focus:{row:t,col:i}},this.selectedIds=[e],this.notifyListeners(),this.render());}exitTableEdit(){this.tableEditing&&(this.tableEditing=null,this.notifyListeners(),this.render());}updateTableCell(e,t,i,n,o=true){let s=this.shapes.findIndex(u=>u.id===e);if(s===-1)return;let a=this.shapes[s];if(a.type!=="table")return;let l=a,c=l.cells[t]?.[i];if(!c||!Object.keys(n).some(u=>c[u]!==n[u]))return;o&&this.commitHistory();let d=he(l.cells);d[t][i]={...d[t][i],...n},this.shapes[s]={...l,cells:d},this.autoGrowTableRows(s),this.notifyListeners(),this.render();}insertTable(e=3,t=3){let i=this.viewportCenter(),n=this.iconInsertSeq++%6*14,o=Te("table",{x:i.x+n,y:i.y+n}),s=Array.from({length:t},(l,c)=>o.colWidths[c]??140),a=Array.from({length:e},(l,c)=>o.rowHeights[c]??36);return this.commitHistory(),this.addShape({...o,colWidths:s,rowHeights:a,width:nt(s),height:it(a),cells:Ct(e,t,false)}),this.selectShape(o.id,false),this.setActiveTool("select"),o.id}insertTableRow(e,t){let i=this.shapes.findIndex(l=>l.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.tableSelection,s=t??(o&&o.shapeId===e?o.focus.row+1:n.cells.length),a=on(n.cells,n.rowHeights,s);this.commitHistory(),this.writeTable(i,n,{cells:a.cells,rowHeights:a.rowHeights,colWidths:n.colWidths}),this.notifyListeners(),this.render();}insertTableColumn(e,t){let i=this.shapes.findIndex(l=>l.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.tableSelection,s=t??(o&&o.shapeId===e?o.focus.col+1:n.colWidths.length),a=rn(n.cells,n.colWidths,s);this.commitHistory(),this.writeTable(i,n,{cells:a.cells,rowHeights:n.rowHeights,colWidths:a.colWidths}),this.notifyListeners(),this.render();}deleteTableRow(e,t){let i=this.shapes.findIndex(l=>l.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.tableSelection,s=t??(o&&o.shapeId===e?o.focus.row:0),a=sn(n.cells,n.rowHeights,s);if(a){if(this.commitHistory(),this.writeTable(i,n,{cells:a.cells,rowHeights:a.rowHeights,colWidths:n.colWidths}),this.tableSelection?.shapeId===e){let l=c=>Math.min(c,a.cells.length-1);this.tableSelection.anchor={...this.tableSelection.anchor,row:l(this.tableSelection.anchor.row)},this.tableSelection.focus={...this.tableSelection.focus,row:l(this.tableSelection.focus.row)};}this.tableEditing?.shapeId===e&&this.tableEditing.row>=a.cells.length&&(this.tableEditing=null),this.notifyListeners(),this.render();}}deleteTableColumn(e,t){let i=this.shapes.findIndex(l=>l.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.tableSelection,s=t??(o&&o.shapeId===e?o.focus.col:0),a=an(n.cells,n.colWidths,s);if(a){if(this.commitHistory(),this.writeTable(i,n,{cells:a.cells,rowHeights:n.rowHeights,colWidths:a.colWidths}),this.tableSelection?.shapeId===e){let l=a.cells[0]?.length??1,c=h=>Math.min(h,l-1);this.tableSelection.anchor={...this.tableSelection.anchor,col:c(this.tableSelection.anchor.col)},this.tableSelection.focus={...this.tableSelection.focus,col:c(this.tableSelection.focus.col)};}this.tableEditing?.shapeId===e&&this.tableEditing.col>=(a.cells[0]?.length??1)&&(this.tableEditing=null),this.notifyListeners(),this.render();}}getTableSelRange(e){let t=this.tableSelection;if(!t||t.shapeId!==e)return null;let i=this.getTableById(e);if(!i)return null;let n=i.cells.length-1,o=(i.cells[0]?.length??1)-1,s=(d,u)=>Math.max(0,Math.min(u,d)),a=s(Math.min(t.anchor.row,t.focus.row),n),l=s(Math.max(t.anchor.row,t.focus.row),n),c=s(Math.min(t.anchor.col,t.focus.col),o),h=s(Math.max(t.anchor.col,t.focus.col),o);return It(i,a,c,l,h)}insertTableRowRelative(e,t){let i=this.shapes.findIndex(g=>g.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.getTableSelRange(e),s=n.cells.length-1,a=(n.cells[0]?.length??1)-1,l=o?o.r1:0,c=o?o.r2:s,h=o?o.c1:0,d=o?o.c2:a,u=t==="above"?l:c+1,p=on(n.cells,n.rowHeights,u);this.commitHistory(),this.writeTable(i,n,{cells:p.cells,rowHeights:p.rowHeights,colWidths:n.colWidths}),this.tableSelection={shapeId:e,anchor:{row:u,col:h},focus:{row:u,col:d}},this.tableEditing=null,this.notifyListeners(),this.render();}insertTableColumnRelative(e,t){let i=this.shapes.findIndex(g=>g.id===e);if(i===-1)return;let n=this.getTableById(e);if(!n)return;let o=this.getTableSelRange(e),s=n.cells.length-1,a=(n.cells[0]?.length??1)-1,l=o?o.r1:0,c=o?o.r2:s,h=o?o.c1:0,d=o?o.c2:a,u=t==="left"?h:d+1,p=rn(n.cells,n.colWidths,u);this.commitHistory(),this.writeTable(i,n,{cells:p.cells,rowHeights:n.rowHeights,colWidths:p.colWidths}),this.tableSelection={shapeId:e,anchor:{row:l,col:u},focus:{row:c,col:u}},this.tableEditing=null,this.notifyListeners(),this.render();}deleteTableRowsInSelection(e){let t=this.shapes.findIndex(l=>l.id===e);if(t===-1)return;let i=this.getTableById(e);if(!i)return;let n=this.getTableSelRange(e);if(!n||i.cells.length-(n.r2-n.r1+1)<1)return;let s=i.cells,a=i.rowHeights;for(let l=n.r2;l>=n.r1;l--){let c=sn(s,a,l);if(!c)break;s=c.cells,a=c.rowHeights;}this.commitHistory(),this.writeTable(t,i,{cells:s,rowHeights:a,colWidths:i.colWidths}),this.clampTableSelectionAfterDelete(e,s,Math.min(n.r1,s.length-1)),this.notifyListeners(),this.render();}deleteTableColsInSelection(e){let t=this.shapes.findIndex(l=>l.id===e);if(t===-1)return;let i=this.getTableById(e);if(!i)return;let n=this.getTableSelRange(e);if(!n||(i.cells[0]?.length??1)-(n.c2-n.c1+1)<1)return;let s=i.cells,a=i.colWidths;for(let l=n.c2;l>=n.c1;l--){let c=an(s,a,l);if(!c)break;s=c.cells,a=c.colWidths;}this.commitHistory(),this.writeTable(t,i,{cells:s,rowHeights:i.rowHeights,colWidths:a}),this.clampTableSelectionAfterDelete(e,s,void 0,Math.min(n.c1,(s[0]?.length??1)-1)),this.notifyListeners(),this.render();}clampTableSelectionAfterDelete(e,t,i,n){let o=t.length-1,s=(t[0]?.length??1)-1;if(this.tableSelection?.shapeId===e){let a=this.tableSelection,l=(d,u)=>Math.max(0,Math.min(u,d)),c={row:l(i??a.anchor.row,o),col:l(n??a.anchor.col,s)},h={row:l(i??a.focus.row,o),col:l(n??a.focus.col,s)};this.tableSelection={shapeId:e,anchor:c,focus:h};}if(this.tableEditing?.shapeId===e){let a=this.tableEditing;(a.row>o||a.col>s)&&(this.tableEditing=null);}}mergeTableCells(e){let t=e??this.tableSelection?.shapeId;if(!t)return;let i=this.shapes.findIndex(a=>a.id===t);if(i===-1)return;let n=this.getTableById(t);if(!n)return;let o=this.getTableSelRange(t);if(!o)return;let s=ui(n.cells,o.r1,o.c1,o.r2,o.c2);s!==n.cells&&(this.commitHistory(),this.shapes[i]={...n,cells:s},this.autoGrowTableRows(i),this.tableSelection={shapeId:t,anchor:{row:o.r1,col:o.c1},focus:{row:o.r1,col:o.c1}},this.tableEditing=null,this.notifyListeners(),this.render());}splitTableCells(e){let t=e??this.tableSelection?.shapeId;if(!t)return;let i=this.shapes.findIndex(a=>a.id===t);if(i===-1)return;let n=this.getTableById(t);if(!n)return;let o=this.getTableSelRange(t);if(!o)return;let s=gi(n,o.r1,o.c1,o.r2,o.c2);s!==n.cells&&(this.commitHistory(),this.shapes[i]={...n,cells:s},this.tableEditing=null,this.notifyListeners(),this.render());}splitTableCell(e){let t=e??this.tableSelection?.shapeId;if(!t)return;let i=this.shapes.findIndex(l=>l.id===t);if(i===-1)return;let n=this.getTableById(t);if(!n)return;let o=this.tableSelection;if(!o||o.shapeId!==t)return;let s=pi(n,o.focus.row,o.focus.col),a=nn(n.cells,s.row,s.col);a!==n.cells&&(this.commitHistory(),this.shapes[i]={...n,cells:a},this.notifyListeners(),this.render());}addUmlAttribute(e){let t=this.shapes.find(n=>n.id===e);if(!t||t.type!=="uml-class")return;let i={id:`attr_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,visibility:"+",name:"newField",type:"string"};this.updateUmlClass(e,{attributes:[...t.attributes,i]});}addUmlMethod(e){let t=this.getUmlById(e);if(!t)return;let i={id:`meth_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,visibility:"+",name:"newMethod",params:"",returnType:"void"};t.type==="uml-class"?this.updateUmlClass(e,{methods:[...t.methods,i]}):this.updateUmlInterface(e,{methods:[...t.methods,i]});}removeUmlAttribute(e,t){let i=this.shapes.find(n=>n.id===e);!i||i.type!=="uml-class"||this.updateUmlClass(e,{attributes:i.attributes.filter(n=>n.id!==t)});}removeUmlMethod(e,t){let i=this.getUmlById(e);if(!i)return;let n=i.methods.filter(o=>o.id!==t);i.type==="uml-class"?this.updateUmlClass(e,{methods:n}):this.updateUmlInterface(e,{methods:n});}reorderUmlAttribute(e,t,i){let n=this.shapes.find(a=>a.id===e);if(!n||n.type!=="uml-class"||t===i)return;let o=[...n.attributes];if(t<0||t>=o.length||i<0||i>=o.length)return;let[s]=o.splice(t,1);o.splice(i,0,s),this.updateUmlClass(e,{attributes:o});}reorderUmlMethod(e,t,i){let n=this.getUmlById(e);if(!n||t===i)return;let o=[...n.methods];if(t<0||t>=o.length||i<0||i>=o.length)return;let[s]=o.splice(t,1);o.splice(i,0,s),n.type==="uml-class"?this.updateUmlClass(e,{methods:o}):this.updateUmlInterface(e,{methods:o});}updateUmlRowStyle(e,t,i,n){let o=this.getUmlById(e);if(o)if(t==="attribute"){if(o.type!=="uml-class")return;let s=o.attributes.map(a=>a.id===i?{...a,textColor:n.textColor===null?void 0:n.textColor??a.textColor,fontSize:n.fontSize===null?void 0:n.fontSize??a.fontSize,strikethrough:n.strikethrough===null?void 0:n.strikethrough??a.strikethrough}:a);this.updateUmlClass(e,{attributes:s});}else {let s=o.methods.map(a=>a.id===i?{...a,textColor:n.textColor===null?void 0:n.textColor??a.textColor,fontSize:n.fontSize===null?void 0:n.fontSize??a.fontSize,strikethrough:n.strikethrough===null?void 0:n.strikethrough??a.strikethrough}:a);o.type==="uml-class"?this.updateUmlClass(e,{methods:s}):this.updateUmlInterface(e,{methods:s});}}getUmlRowAtScreenPoint(e){let t=this.camera.screenToPage(e);for(let i=this.shapes.length-1;i>=0;i--){let n=this.shapes[i];if(n.type!=="uml-class"&&n.type!=="uml-interface")continue;let o=n.width/2,s=n.height/2;if(t.x<n.x-o||t.x>n.x+o||t.y<n.y-s||t.y>n.y+s)continue;let a=ge,l=t.y-n.y;if(l>=-s&&l<=-s+a)return {shape:n,section:"className",rowIndex:-1,text:n.className};if(n.type==="uml-interface"){let g=-s+a,m=s;if(n.methods.length>0&&l>=g&&l<=m){let f=Math.floor((l-g-_)/V);if(f>=0&&f<n.methods.length){let b=n.methods[f];return {shape:n,section:"method",rowIndex:f,text:`${b.visibility} ${b.name}(${b.params}): ${b.returnType}`}}return {shape:n,section:"method",rowIndex:-1,text:""}}return {shape:n,section:"className",rowIndex:-1,text:n.className}}let c=n.attributes.length>0?n.attributes.length*V+_*2:_*2,h=-s+a,d=h+c;if(n.attributes.length>0&&l>=h&&l<=d){let g=Math.floor((l-h-_)/V);if(g>=0&&g<n.attributes.length){let m=n.attributes[g];return {shape:n,section:"attribute",rowIndex:g,text:`${m.visibility} ${m.name}: ${m.type}`}}return {shape:n,section:"attribute",rowIndex:-1,text:""}}let u=d,p=s;if(n.methods.length>0&&l>=u&&l<=p){let g=Math.floor((l-u-_)/V);if(g>=0&&g<n.methods.length){let m=n.methods[g];return {shape:n,section:"method",rowIndex:g,text:`${m.visibility} ${m.name}(${m.params}): ${m.returnType}`}}return {shape:n,section:"method",rowIndex:-1,text:""}}return {shape:n,section:"className",rowIndex:-1,text:n.className}}return null}setActiveTool(e){this.tools.has(e)&&(this.tools.get(this.activeTool)?.cancelTransient(),this.clearTransientPreview(),this.activeTool=e,this.eraserPoint=null,this.notifyListeners(),this.scheduleRender());}getActiveTool(){return this.activeTool}setHighlighterColor(e){let t=this.tools.get("highlighter");t instanceof Le&&t.setHighlighterColor(e);}getHighlighterColor(){let e=this.tools.get("highlighter");return e instanceof Le?e.getHighlighterColor():bn}getShapes(){return [...this.shapes]}getData(){return {shapes:this.getShapes(),camera:{x:this.camera.x,y:this.camera.y,zoom:this.camera.zoom}}}setShapes(e){return Array.isArray(e)?(this.closeInlineEditing(),this.clearEraseFades(),this.shapes=e.map(t=>({...t,style:{...t.style}})),this.selectedIds=[],this.undoStack=[],this.redoStack=[],this.releaseUnusedImageUrls(),this.prefetchShapeIcons(),this.notifyListeners(),this.render(),true):false}setTheme(e){Ft(e),this.scheduleRender();}setLanguage(e){Yt(e);}getSelectedIds(){return [...this.selectedIds]}getCamera(){return this.camera}isPointerDown(){return this.pointerIsDown}isShapeTextTruncated(e){let t=this.shapes.find(i=>i.id===e);return t?this.renderer.isShapeTextTruncated(t):false}isUmlRowTextTruncated(e){let t=e.shape,i=t.fontSize||ee,n=false;if(e.section==="className")n=true;else if(e.section==="attribute"){let o=t.attributes?.[e.rowIndex];o?.fontSize&&(i=o.fontSize);}else if(e.section==="method"){let o=t.methods[e.rowIndex];o?.fontSize&&(i=o.fontSize);}return this.renderer.isUmlRowTextTruncated(t,e.text,i,n)}getContentBounds(e=24){return at(this.shapes,e)}getViewportBounds(){let e=this.canvas.getBoundingClientRect(),t=this.camera.getZoom(),i=this.camera.screenToPage({x:0,y:0});return {x:i.x,y:i.y,width:e.width/t,height:e.height/t}}getBoardExtent(e=40){let t=this.shapes.length?this.getContentBounds(e):null,i=this.getViewportBounds(),n=t?{x:t.x,y:t.y,width:t.width,height:t.height}:null;return ht(n,{x:i.x-e,y:i.y-e,width:i.width+e*2,height:i.height+e*2})}async exportImage(e,t={}){return Cn(this.getShapes(),e,t)}async downloadImage(e="drawui",t="png",i={}){let n=await this.exportImage(t,i);In(n,`${e}.${t}`);}zoomIn(){this.camera.zoomAt({x:window.innerWidth/2,y:window.innerHeight/2},1.2),this.scheduleRender(),this.notifyListeners();}zoomOut(){this.camera.zoomAt({x:window.innerWidth/2,y:window.innerHeight/2},.8),this.scheduleRender(),this.notifyListeners();}resetZoom(){this.camera.reset(),this.scheduleRender(),this.notifyListeners();}panBy(e,t){this.camera.translate(e,t),this.scheduleRender(),this.notifyListeners();}setCameraPosition(e,t){this.camera.x=e,this.camera.y=t,this.scheduleRender(),this.notifyListeners();}requestRender(){this.scheduleRender(),this.notifyListeners();}setShowGrid(e){this.renderer.setShowGrid(e),this.scheduleRender();}render(){this.renderer.setTableSelection(this.tableSelection),this.renderer.setLockHover(this.hoverLockedShapeId),this.renderer.render(this.shapes,this.camera,new Set(this.selectedIds),this.brushRect,this.snapGuides,this.connectingTargetId,this.genPreview,this.eraserPoint,this.mindMapSelectedNode,this.mindMapHoverNode,this.mindMapReorderTarget,void 0,this.hoverAnchorShapeId,this.hoverConnectorId,this.eraseFadeMap());}scheduleRender(){this.renderScheduled||(this.renderScheduled=true,requestAnimationFrame(()=>{this.renderScheduled=false,this.render();}));}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeNotifications(e){return this.notificationListeners.add(e),()=>this.notificationListeners.delete(e)}notify(e){this.notificationListeners.forEach(t=>t(e));}notifyListeners(){this.notifyScheduled||(this.notifyScheduled=true,queueMicrotask(()=>{this.notifyScheduled=false,this.mindMapEditingShapeId&&!this.selectedIds.includes(this.mindMapEditingShapeId)&&(this.mindMapEditingShapeId=null),this.mindMapSelectedNode&&!this.selectedIds.includes(this.mindMapSelectedNode.shapeId)&&(this.mindMapSelectedNode=null),this.tableSelection&&!this.selectedIds.includes(this.tableSelection.shapeId)&&(this.tableSelection=null),this.tableEditing&&!this.selectedIds.includes(this.tableEditing.shapeId)&&(this.tableEditing=null),this.listeners.forEach(e=>e());}));}cloneShapes(e){return e.map(t=>{let i={...t,style:{...t.style}};Array.isArray(t.points)&&(i.points=t.points.map(o=>({...o}))),Array.isArray(t.userPoints)&&(i.userPoints=t.userPoints.map(o=>({...o}))),Array.isArray(t.userPointsBase)&&(i.userPointsBase=t.userPointsBase.map(o=>({...o})));let n=t.userPointsRef;if(n?.start&&n?.end&&(i.userPointsRef={start:{...n.start},end:{...n.end}}),t.startBinding&&(i.startBinding={...t.startBinding}),t.endBinding&&(i.endBinding={...t.endBinding}),t.root&&(i.root=Xt(t.root)),t.type==="table"&&Array.isArray(t.cells)){let o=t;i.colWidths=[...o.colWidths],i.rowHeights=[...o.rowHeights],i.cells=he(o.cells);}return i})}commitHistory(){if(this.isUndoing)return;let e={shapes:this.cloneShapes(this.shapes),selectedIds:[...this.selectedIds]};this.undoStack.push(e),this.undoStack.length>_s&&this.undoStack.shift(),this.redoStack=[];}mark(){this.commitHistory();}undo(){if(this.undoStack.length!==0){this.clearEraseFades(),this.isUndoing=true;try{this.redoStack.push({shapes:this.cloneShapes(this.shapes),selectedIds:[...this.selectedIds]});let e=this.undoStack.pop();this.shapes=this.cloneShapes(e.shapes),this.selectedIds=[...e.selectedIds];}finally{this.isUndoing=false;}this.notifyListeners(),this.render();}}redo(){if(this.redoStack.length!==0){this.clearEraseFades(),this.isUndoing=true;try{this.undoStack.push({shapes:this.cloneShapes(this.shapes),selectedIds:[...this.selectedIds]});let e=this.redoStack.pop();this.shapes=this.cloneShapes(e.shapes),this.selectedIds=[...e.selectedIds];}finally{this.isUndoing=false;}this.notifyListeners(),this.render();}}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}saveToStorage(){if(!this.persist)return false;try{let e=JSON.stringify({version:1,shapes:this.shapes,savedAt:Date.now()});return localStorage.setItem(Ei,e),this.notifyListeners(),this.notify(le("save.success")),!0}catch(e){return console.error("\u4FDD\u5B58\u5931\u8D25:",e),this.notify(le("save.fail")),false}}loadFromStorage(){if(!this.persist)return false;try{let e=localStorage.getItem(Ei);if(!e)return !1;let t=JSON.parse(e);return t.shapes&&Array.isArray(t.shapes)?(this.shapes=t.shapes,this.selectedIds=[],this.undoStack=[],this.redoStack=[],this.notifyListeners(),this.scheduleRender(),!0):!1}catch(e){return console.error("\u52A0\u8F7D\u5931\u8D25:",e),false}}clearStorage(){localStorage.removeItem(Ei);}exportJSON(){return JSON.stringify({app:"drawui",version:1,shapes:this.shapes,camera:{x:this.camera.x,y:this.camera.y,zoom:this.camera.zoom},savedAt:Date.now()},null,2)}importJSON(e){try{let t=JSON.parse(e);if(t.shapes&&Array.isArray(t.shapes)){this.closeInlineEditing(),this.commitHistory(),this.shapes=t.shapes,this.selectedIds=[];let i=t.camera;return i&&typeof i.x=="number"&&typeof i.y=="number"&&typeof i.zoom=="number"&&(this.camera.x=i.x,this.camera.y=i.y,this.camera.zoom=i.zoom),this.notifyListeners(),this.render(),!0}return !1}catch(t){return console.error("\u5BFC\u5165\u5931\u8D25:",t),false}}downloadJSON(e="drawui-data"){let t=this.exportJSON();In(new Blob([t],{type:"application/json;charset=utf-8"}),`${e}.json`);}getEditingShapeId(){return this.editingShapeId}canEditShape(e){return !(e.type==="line"||e.type==="arrow"||e.type==="draw"||e.type==="uml-class"||e.type==="uml-interface"||e.type==="mind-map"||e.type==="table"||e.type==="image")}enterEditing(e){let t=this.shapes.find(i=>i.id===e);!t||!this.canEditShape(t)||(this.editingShapeId=e,this.selectedIds=[e],this.isNewTextShape=t.type==="text"&&!t.text,this.originalTextValue=t.text||"",this.notifyListeners(),this.scheduleRender(),this.cancelTextInputRaf(),this.textInputRaf=requestAnimationFrame(()=>{this.textInputRaf=null,!(this.editingShapeId!==e||this.textInput)&&this.createTextInput(t);}));}cancelTextInputRaf(){this.textInputRaf!==null&&(cancelAnimationFrame(this.textInputRaf),this.textInputRaf=null);}exitEditing(){if(!this.editingShapeId)return;this.cancelTextInputRaf();let e=this.editingShapeId,t=this.shapes.find(o=>o.id===e),i=this.textInput?this.textInput.value:this.originalTextValue,n=i!==this.originalTextValue;if(this.removeTextInput(),t)if(t.type==="text")if(n&&this.commitHistory(),!i.trim()&&this.isNewTextShape)this.shapes=this.shapes.filter(o=>o.id!==e),this.selectedIds=this.selectedIds.filter(o=>o!==e);else {let o=t,s=o.fontSize||16,a=s*1.3,l=o.width||200,c=i.split(`
|
|
46
|
+
`),h=0;for(let p of c){let g="";for(let m of p){let f=g+m;f.length*s*.6>l&&g?(h++,g=m):g=f;}g&&h++;}let d={...o,text:i,height:Math.max(h*a,a)},u=this.shapes.indexOf(t);u!==-1&&(this.shapes[u]=d),i.trim()||(this.shapes=this.shapes.filter(p=>p.id!==e),this.selectedIds=this.selectedIds.filter(p=>p!==e));}else n&&this.commitHistory(),this.updateShape(e,{text:i,textColor:t.textColor||H.text,fontSize:t.fontSize||16});this.editingShapeId=null,this.isNewTextShape=false,this.originalTextValue="",this.setActiveTool("select"),this.notifyListeners(),this.render();}closeInlineEditing(){if(this.isNewTextShape&&this.editingShapeId){let e=this.editingShapeId,t=this.shapes.find(i=>i.id===e);t&&t.type==="text"&&!t.text&&(this.shapes=this.shapes.filter(i=>i.id!==e),this.selectedIds=this.selectedIds.filter(i=>i!==e));}this.removeTextInput(),this.editingShapeId=null,this.isNewTextShape=false,this.originalTextValue="",this.tableEditing=null,this.mindMapEditingShapeId=null,this.lastClickTime=0,this.lastClickShapeId=null;}removeTextInput(){this.cancelTextInputRaf(),this.textOverlay&&(this.textOverlay.remove(),this.textOverlay=null),this.textInput&&(this.textInput.remove(),this.textInput=null);}createTextInput(e){this.removeTextInput();let t=this.canvas.parentElement;if(!t||!this.canvas.isConnected){this.closeInlineEditing();return}let i=this.canvas.getBoundingClientRect(),n=t.getBoundingClientRect(),o=i.left-n.left,s=i.top-n.top;this.textOverlay=document.createElement("div"),this.textOverlay.style.position="absolute",this.textOverlay.style.left=`${o}px`,this.textOverlay.style.top=`${s}px`,this.textOverlay.style.width=`${i.width}px`,this.textOverlay.style.height=`${i.height}px`,this.textOverlay.style.background="transparent",this.textOverlay.style.zIndex="1000",this.textOverlay.style.cursor="text",this.textOverlay.addEventListener("pointerdown",d=>{this.textInput&&d.target!==this.textInput&&(d.preventDefault(),this.exitEditing());}),t.appendChild(this.textOverlay);let a=this.getShapeScreenBounds(e),l=this.camera.getZoom(),c=(e.fontSize||16)*l,h=document.createElement("textarea");h.style.position="absolute",h.style.left=`${o+a.x}px`,h.style.top=`${s+a.y}px`,h.style.width=`${Math.max(a.width,60)}px`,h.style.height=`${Math.max(a.height,24)}px`,h.style.fontSize=`${c}px`,h.style.color=e.textColor||"#1f2937",h.style.textAlign="center",h.style.border=`2px solid ${H.editBorder}`,h.style.borderRadius="4px",h.style.background="rgba(255, 255, 255, 0.95)",h.style.resize="none",h.style.padding="4px 8px",h.style.boxSizing="border-box",h.style.lineHeight="1.4",h.style.fontFamily="sans-serif",h.style.outline="none",h.style.whiteSpace="pre-wrap",h.style.wordBreak="break-word",h.style.overflow="hidden",h.style.zIndex="1001",h.value=e.text||"",h.dataset.shapeId=e.id,h.addEventListener("pointerdown",d=>{d.stopPropagation();}),h.addEventListener("mousedown",d=>{d.stopPropagation();}),h.addEventListener("keydown",d=>{if(d.stopPropagation(),d.key==="Escape"&&(d.preventDefault(),this.textInput&&(this.textInput.value=this.originalTextValue),this.exitEditing()),d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),this.exitEditing()),d.key==="Enter"&&d.shiftKey){d.preventDefault();let u=h.selectionStart,p=h.selectionEnd;h.value=h.value.substring(0,u)+`
|
|
47
|
+
`+h.value.substring(p),h.selectionStart=h.selectionEnd=u+1;}}),t.appendChild(h),h.focus(),e.type==="text"&&!e.text&&(h.placeholder="\u8F93\u5165\u6587\u672C..."),this.textInput=h;}getShapeScreenBounds(e){let t=this.camera.getZoom(),i=this.camera.pageToScreen({x:e.x,y:e.y});switch(e.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "hexagon":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":return {x:i.x-e.width*t/2,y:i.y-e.height*t/2,width:e.width*t,height:e.height*t};case "circle":return {x:i.x-e.radius*t,y:i.y-e.radius*t,width:e.radius*2*t,height:e.radius*2*t};case "text":{let n=e,o=n.width*t,s=n.height*t;return {x:i.x-o/2,y:i.y-s/2,width:o,height:s}}default:return {x:i.x-50*t,y:i.y-20*t,width:100*t,height:40*t}}}getShapeAtScreenPoint(e){let t=this.screenToPage(e);return this.getShapeAtPoint(t)}getShapeAtPoint(e,t){let i=null;for(let n=this.shapes.length-1;n>=0;n--){let o=this.shapes[n];if(!(t&&o.id===t)){if(o.type==="arrow"||o.type==="line"){if(i||(i=new Map(this.shapes.map(s=>[s.id,s]))),this.isPointOnConnector(e,o,i))return o;continue}if(this.isPointInShape(e,o))return o}}return null}isPointOnConnector(e,t,i){let n=this.renderer.getConnectorRoute(t,i);if(n.length<2)return false;let o=this.camera.getZoom(),s=Math.max(6/o,(t.style?.strokeWidth??2)/2+2);for(let a=1;a<n.length;a++)if(this.pointToSegmentDist(e,n[a-1],n[a])<=s)return true;return false}getShapesInBrushRadius(e,t){let i=[];for(let n of this.shapes)this.shapeIntersectsBrush(n,e,t)&&i.push(n);return i}shapeIntersectsBrush(e,t,i){switch(e.type){case "line":case "arrow":{let n=e.points,o=i+4;for(let s=1;s<n.length;s++)if(this.pointToSegmentDist(t,n[s-1],n[s])<=o)return true;return n.length>0&&Math.hypot(t.x-n[0].x,t.y-n[0].y)<=o}case "draw":{let n=e.points,o=i+4;for(let s=1;s<n.length;s++){let a={x:e.x+n[s-1].x,y:e.y+n[s-1].y},l={x:e.x+n[s].x,y:e.y+n[s].y};if(this.pointToSegmentDist(t,a,l)<=o)return true}return n.length>0&&Math.hypot(t.x-(e.x+n[0].x),t.y-(e.y+n[0].y))<=o}case "circle":return Math.hypot(t.x-e.x,t.y-e.y)<=e.radius+i;case "text":{let n=e;return Math.abs(t.x-e.x)<=n.width/2+i&&Math.abs(t.y-e.y)<=n.height/2+i}default:return Math.abs(t.x-e.x)<=e.width/2+i&&Math.abs(t.y-e.y)<=e.height/2+i}}pointToSegmentDist(e,t,i){let n=i.x-t.x,o=i.y-t.y,s=n*n+o*o,a=s===0?0:Math.max(0,Math.min(1,((e.x-t.x)*n+(e.y-t.y)*o)/s));return Math.hypot(e.x-(t.x+a*n),e.y-(t.y+a*o))}setEraserPoint(e){this.eraserPoint=e,this.scheduleRender();}isPointInShape(e,t){let i=e.x-t.x,n=e.y-t.y;switch(t.type){case "rectangle":case "sticky-note":case "icon":case "rounded-rectangle":case "ellipse":case "diamond":case "triangle":case "parallelogram":case "trapezoid":case "pentagon":case "octagon":case "star":case "cylinder":case "cloud":case "heart":case "block-arrow-right":case "block-arrow-left":case "block-arrow-up":case "block-arrow-down":case "block-arrow-double":case "right-triangle":case "cross":case "speech-rect":case "speech-round":case "cube":case "sector":case "delay":case "predefined-process":case "document":case "stadium":case "class-catalog":case "chevron":case "brace-left":case "brace-right":case "envelope":case "checkbox":case "triangular-pyramid":case "quadrangular-pyramid":case "cuboid":case "sphere":case "ellipsoid":case "pie":case "hollow-pie":case "uml-class":case "uml-interface":case "table":return Math.abs(i)<=t.width/2&&Math.abs(n)<=t.height/2;case "circle":return i*i+n*n<=t.radius*t.radius;case "hexagon":{let o=t.width/2,s=t.height/2;return Math.abs(i)<=o&&Math.abs(n)<=s&&Math.abs(i)/o+Math.abs(n)/s<=1.5}case "mind-map":return Math.abs(i)<=t.width/2&&Math.abs(n)<=t.height/2;case "draw":{let o=t,s=Math.max((o.style?.strokeWidth??2)/2+3,6/this.camera.getZoom()),a=o.points||[];for(let l=1;l<a.length;l++)if(this.pointToSegmentDist({x:i,y:n},a[l-1],a[l])<=s)return true;return a.length===1&&Math.hypot(i-a[0].x,n-a[0].y)<=s}case "text":{let o=t;return Math.abs(i)<=o.width/2&&Math.abs(n)<=o.height/2}default:return false}}updateArrowBinding(e,t,i,n){let o=this.shapes.find(l=>l.id===e);if(!o||o.type!=="arrow")return;let s=o,a={};if(i){let l=this.shapes.find(u=>u.id===i);if(!l)return;let c=n?.handle||this.getClosestHandle(s,l),h=this.getBindingPosition(l,c),d=n?.handle?{...n,toShapeId:i,auto:false}:n?.auto?n:{toShapeId:i,handle:c,auto:false};t==="start"?(a.startBinding=d,a.points=s.points.map((u,p)=>p===0?h:u)):(a.endBinding=d,a.points=s.points.map((u,p)=>p===s.points.length-1?h:u));}else t==="start"?a.startBinding=void 0:a.endBinding=void 0;this.updateShape(e,a);}getClosestHandle(e,t){let i=e.points[0],n=e.points[e.points.length-1],o=e.endBinding?n:i,s=o.x-t.x,a=o.y-t.y;return Math.abs(s)>Math.abs(a)?s>0?"right":"left":a>0?"bottom":"top"}dispose(){this.eraseFadeRaf!==null&&(cancelAnimationFrame(this.eraseFadeRaf),this.eraseFadeRaf=null),this.eraseFades.clear(),this.canvas.removeEventListener("pointerdown",this.handlePointerDown),this.canvas.removeEventListener("pointerleave",this.handlePointerUp),window.removeEventListener("pointermove",this.handlePointerMove),window.removeEventListener("pointerup",this.handlePointerUp),window.removeEventListener("pointercancel",this.handlePointerUp),window.removeEventListener("blur",this.handleWindowBlur),window.removeEventListener("pointerdown",this.handleGlobalPointerDown,true),this.canvas.removeEventListener("wheel",this.handleWheel),window.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("keyup",this.handleKeyUp),window.removeEventListener("resize",this.handleResize),window.removeEventListener("paste",this.handlePasteEvent),this.removeImageReadyListener?.(),this.removeImageReadyListener=null,this.removeTextInput(),this.editingShapeId=null,this.tools.forEach(e=>e.dispose()),this.listeners.clear();}};var Vs=[{id:"flow",zh:"\u6D41\u7A0B\u56FE",en:"Flow"},{id:"org",zh:"\u7EC4\u7EC7\u4E0E\u7ED3\u6784",en:"Org & structure"},{id:"analysis",zh:"\u5206\u6790\u6A21\u578B",en:"Analysis"},{id:"plan",zh:"\u89C4\u5212\u4E0E\u6392\u671F",en:"Planning"},{id:"tech",zh:"\u6280\u672F\u67B6\u6784",en:"Architecture"},{id:"uml",zh:"UML / \u6570\u636E\u5E93",en:"UML & data"}],Y="#1f2937";function ue(r="transparent",e=Y,t=2){return {strokeColor:e,fillColor:r,strokeWidth:t,strokeDash:null}}var Oo=0,oe=r=>`tpl_${r}_${(Oo++).toString(36)}`;function D(r,e,t,i,n,o,s={}){return {id:oe("box"),type:s.type??"rounded-rectangle",x:r,y:e,width:t,height:i,rotation:0,text:n,textColor:s.textColor,borderRadius:s.radius??8,orientation:s.orientation,topInset:s.topInset,style:ue(o,s.stroke??Y,s.strokeWidth??2)}}function lt(r,e={}){return {id:oe("deco"),type:"arrow",x:0,y:0,points:r,rotation:0,connectionType:e.straight?"straight":"orthogonal",arrowHead:e.head??"none",dashed:!!e.dashed,freeform:true,style:ue("transparent",e.stroke??Y,e.width??1)}}function $s(r,e,t,i,n){return {id:oe("icon"),type:"icon",x:r,y:e,width:i,height:i,rotation:0,iconId:t,style:ue(n,n,2)}}function B(r,e,t,i,n,o=Y,s=14){return {id:oe("label"),type:"text",x:r,y:e,width:t,height:i,rotation:0,text:n,fontSize:s,style:ue("transparent",o,1)}}function _i(r,e,t,i,n){let s=68+(i.length+n.length)*22;return {id:oe("uml"),type:"uml-class",x:r,y:e,width:220,height:s,rotation:0,className:t,attributes:i.map(([a,l,c])=>({id:oe("attr"),visibility:a,name:l,type:c})),methods:n.map(([a,l,c,h])=>({id:oe("meth"),visibility:a,name:l,params:c,returnType:h})),textColor:Y,style:ue("#eef2ff")}}function $o(r,e){let t=r,i=t.width??0,n=t.height??0;switch(e){case "top":return {x:r.x,y:r.y-n/2};case "bottom":return {x:r.x,y:r.y+n/2};case "left":return {x:r.x-i/2,y:r.y};default:return {x:r.x+i/2,y:r.y}}}var Os={top:"bottom",bottom:"top",left:"right",right:"left"};function R(r,e,t={}){let i=t.aSide??(Math.abs(e.y-r.y)>=Math.abs(e.x-r.x)?e.y>r.y?"bottom":"top":e.x>r.x?"right":"left"),n=t.bSide??Os[i];return {id:oe("link"),type:"arrow",x:0,y:0,points:[$o(r,i),$o(e,n)],rotation:0,connectionType:"orthogonal",arrowHead:t.head??"end",dashed:!!t.dashed,startBinding:{toShapeId:r.id,handle:i},endBinding:{toShapeId:e.id,handle:n},style:ue("transparent",t.stroke??Y,t.strokeWidth??2)}}function se(r){let e=`tpl_grp_${(Oo++).toString(36)}`;return r.map(t=>({...t,groupId:e}))}var L={blue:"#dbeafe",blueSoft:"#eff6ff",indigo:"#e0e7ff",green:"#dcfce7",amber:"#fef3c7",red:"#fee2e2",slate:"#f1f5f9",violet:"#f3e8ff",white:"#ffffff"},zs=()=>{let r=D(0,-240,140,52,"\u5F00\u59CB",L.green),e=D(0,-130,180,64,"\u5904\u7406\u6B65\u9AA4",L.blue),t=D(0,10,190,120,"\u6761\u4EF6\u5224\u65AD\uFF1F",L.amber,{type:"diamond",strokeWidth:2}),i=D(250,10,150,62,"\u8865\u5145\u8D44\u6599",L.violet,{strokeWidth:1.5}),n=D(0,200,140,52,"\u7ED3\u675F",L.red);return [r,e,t,i,n,R(r,e),R(e,t),R(t,n,{aSide:"bottom",bSide:"top"}),B(26,112,40,24,"\u662F","#15803d",13),R(t,i,{aSide:"right",bSide:"left"}),B(150,-8,40,24,"\u5426","#b45309",13),R(i,e,{aSide:"top",bSide:"right"})]},Gs=()=>{let r=D(-230,0,130,56,"\u8F93\u5165",L.green),e=D(-40,0,150,56,"\u5904\u7406",L.blue),t=D(160,0,130,56,"\u8F93\u51FA",L.amber);return [r,e,t,R(r,e,{aSide:"right",bSide:"left"}),R(e,t,{aSide:"right",bSide:"left"})]};function Us(r,e,t){let i=1/0,n=1/0,o=-1/0,s=-1/0;for(let h of r)i=Math.min(i,h.x),n=Math.min(n,h.y),o=Math.max(o,h.x),s=Math.max(s,h.y);let a=(i+o)/2,l=(n+s)/2,c=t/2;return {id:oe("track"),type:"draw",x:a,y:l,width:o-i+c*2,height:s-n+c*2,rotation:0,points:r.map(h=>({x:h.x-a,y:h.y-l})),style:ue("transparent",e,t)}}function Ws(r){let{leftX:e,rightX:t,topY:i,midY:n,botY:o,endX:s}=r,a=(n-i)/2,l=(o-n)/2,c=[],h=8,d=(p,g,m,f)=>{let b=Math.hypot(m-p,f-g),x=Math.max(1,Math.round(b/h));for(let I=0;I<=x;I++)c.push({x:p+(m-p)*I/x,y:g+(f-g)*I/x});},u=(p,g,m,f,b)=>{let x=Math.max(4,Math.round(Math.abs(b-f)*m/h));for(let I=0;I<=x;I++){let T=f+(b-f)*I/x;c.push({x:p+m*Math.cos(T),y:g+m*Math.sin(T)});}};return d(e,i,t,i),u(t,i+a,a,-Math.PI/2,Math.PI/2),d(t,n,e,n),u(e,n+l,l,Math.PI/2,Math.PI*3/2),d(e,o,s,o),c}var Fs=()=>{let l=[Us(Ws({leftX:-330,rightX:330,topY:-90,midY:30,botY:180,endX:120}),"#e7e2fb",30)],c=(u,p,g,m,f,b,x)=>{let I=x<p?p-48:p+48,T=[D(u,p,160,96,g,m,{radius:6,strokeWidth:1,stroke:f}),D(u,p+96/2-24,136,28,"\u5F97\u5206",b,{radius:4,strokeWidth:0,stroke:"#ffffff",textColor:"#ffffff"}),lt([{x:u,y:I},{x:u,y:x}],{stroke:Y,width:2,straight:true}),{id:oe("dot"),type:"circle",x:u,y:x,radius:5,rotation:0,style:ue("#1f2937")}];l.push(...se(T));},h=[{x:-140,t:"\u7B2C\u4E00\u6B65"},{x:45,t:"\u7B2C\u4E8C\u6B65"},{x:230,t:"\u7B2C\u4E09\u6B65"}];for(let u of h)c(u.x,-195,u.t,"#fdf4dc","#a16207","#eab308",-90);let d=[{x:-150,t:"\u7B2C\u56DB\u6B65"},{x:30,t:"\u7B2C\u4E94\u6B65"},{x:210,t:"\u7B2C\u516D\u6B65"}];for(let u of d)c(u.x,125,u.t,"#f1edfd","#6d28d9","#8b5cf6",31);return l.push(B(-455,-232,40,40,"\u{1F4E3}",Y,26),B(-352,-238,90,22,"\u65F6\u95F4",Y,15),B(-330,-212,200,20,"xx\u6708xx\u65E5 - xx\u6708xx\u65E5","#6b7280",12),B(-412,-90,110,22,"\u5F00\u59CB \u25B6\u25B6",Y,14),B(432,22,120,22,"\u25C0\u25C0 \u8FC7\u7A0B\u4E2D",Y,14),B(150,210,100,22,"\u901A\u5173\u5566",Y,15),B(330,202,46,46,"\u{1F3C6}",Y,34),B(452,196,110,22,"\u8BE6\u7EC6\u60C5\u51B5","#6b7280",13)),l},Ks=()=>{let r=D(0,-150,160,52,"\u8D1F\u8D23\u4EBA",L.indigo),e=[D(-170,-20,140,48,"\u4EA7\u54C1",L.blue),D(0,-20,140,48,"\u7814\u53D1",L.blue),D(170,-20,140,48,"\u8BBE\u8BA1",L.blue)],t=e.map(n=>D(n.x,110,140,46,"\u6210\u5458",L.slate)),i=[r,...e,...t];for(let n of e)i.push(R(r,n,{head:"none",strokeWidth:1.5}));return e.forEach((n,o)=>i.push(R(n,t[o],{head:"none",strokeWidth:1.5}))),i},Ys=()=>{let r=[],e=[{y:-240,name:"\u63A5\u5165\u5C42",fill:L.blueSoft,stroke:"#2563eb",cells:["\u53CD\u5411\u4EE3\u7406","\u901A\u7528\u7F51\u5173","\u9274\u6743\u63D2\u4EF6","\u9650\u6D41\u63D2\u4EF6"]},{y:-110,name:"\u5E94\u7528\u5C42",fill:"#fffbeb",stroke:"#b45309",cells:["Application 1","Application 2","Application 3"]},{y:20,name:"\u9886\u57DF\u5C42",fill:"#faf5ff",stroke:"#7c3aed",cells:["Service 1","Service 2","Service 3"]},{y:150,name:"\u57FA\u5EFA\u5C42",fill:"#eef2ff",stroke:"#4338ca",cells:["\u4E2D\u53F0\u670D\u52A1 1","\u4E2D\u53F0\u670D\u52A1 2","\u4E2D\u53F0\u670D\u52A1 3"]}];for(let i of e){let n=[D(-40,i.y,780,110,"",i.fill,{stroke:i.stroke,strokeWidth:1.5,radius:10}),B(-520,i.y,120,44,i.name,i.stroke,15)],o=i.cells.length,s=Math.min(190,(760-(o-1)*10)/o),a=o*s+(o-1)*10;i.cells.forEach((l,c)=>{let h=-40-a/2+s/2+c*(s+10);n.push(D(h,i.y,s,46,l,L.white,{stroke:i.stroke,strokeWidth:1,radius:6}));}),r.push(...se(n));}let t=[D(520,150,300,116,"","#eef2ff",{stroke:"#4338ca",strokeWidth:1.5,radius:10})];return ["MySQL","Redis","MQ"].forEach((i,n)=>{t.push(D(430+n*90,152,80,72,i,L.white,{type:"cylinder",stroke:"#4338ca",strokeWidth:1}));}),r.push(...se(t)),r},Xs=()=>[D(-115,-85,210,150,"\u4F18\u52BF S",L.green),D(115,-85,210,150,"\u52A3\u52BF W",L.red),D(-115,85,210,150,"\u673A\u4F1A O",L.blue),D(115,85,210,150,"\u5A01\u80C1 T",L.amber)],Zs=()=>{let e=Math.round(Math.sqrt(3)/2*230),t=e,i=[{t:"How",d:`\u4F55\u679C\uFF1F
|
|
48
48
|
\u6700\u7EC8\u662F\u4EC0\u4E48\u7ED3\u679C`,deg:-90,fill:"#e0e7ff",stroke:"#6366f1"},{t:"What",d:`\u4F55\u4E8B\uFF1F
|
|
49
49
|
\u53D1\u751F\u4E86\u4EC0\u4E48\u4E8B\u60C5`,deg:-30,fill:"#ede9fe",stroke:"#8b5cf6"},{t:"Why",d:`\u4F55\u56E0\uFF1F
|
|
50
50
|
\u4E3A\u4EC0\u4E48\u53D1\u751F\uFF1F`,deg:30,fill:"#fee2e2",stroke:"#f87171"},{t:"When",d:`\u4F55\u65F6\uFF1F
|
|
51
51
|
\u65B0\u95FB\u53D1\u751F\u7684\u65F6\u95F4`,deg:90,fill:"#fef3c7",stroke:"#fbbf24"},{t:"Where",d:`\u4F55\u5730\uFF1F
|
|
52
52
|
\u65B0\u95FB\u53D1\u751F\u7684\u5730\u70B9`,deg:150,fill:"#dcfce7",stroke:"#4ade80"},{t:"Who",d:`\u4F55\u4EBA\uFF1F
|
|
53
|
-
\u65B0\u95FB\u7684\u4E3B\u4F53`,deg:210,fill:"#e0e7ff",stroke:"#a5b4fc"}],n=(s,a,l,c,h,d)=>se([D(s,a,230,230,"",h,{type:"hexagon",orientation:"flat",stroke:d,strokeWidth:1}),B(s,a-e*.27,230*.6,28,l,Y,15),
|
|
54
|
-
\u516D\u8981\u7D20`,Y,16)])];for(let s of i){let a=s.deg*Math.PI/180;o.push(...n(Math.cos(a)*t,Math.sin(a)*t,s.t,s.d,s.fill,s.stroke));}return o},
|
|
55
|
-
\u9A6C\u4E0A\u505A`,
|
|
56
|
-
\u8BA1\u5212\u505A`,
|
|
57
|
-
\u59D4\u6258\u505A`,
|
|
58
|
-
\u522B\u505A`,P.slate,{type:"rectangle",strokeWidth:1.5})],Js=()=>[{id:oe("axis"),type:"arrow",x:0,y:0,points:[{x:-280,y:0},{x:280,y:0}],rotation:0,connectionType:"orthogonal",arrowHead:"end",style:ue("transparent",Y,3)},D(-200,-70,120,48,"\u9636\u6BB5\u4E00",P.blue),D(-60,70,120,48,"\u9636\u6BB5\u4E8C",P.green),D(80,-70,120,48,"\u9636\u6BB5\u4E09",P.amber),D(220,70,120,48,"\u9636\u6BB5\u56DB",P.violet)],Qs=()=>{let r=[{x:-210,title:"\u5F85\u529E",fill:P.slate,cards:3},{x:0,title:"\u8FDB\u884C\u4E2D",fill:"#e0f2fe",cards:2},{x:210,title:"\u5DF2\u5B8C\u6210",fill:P.green,cards:1}],e=[];for(let t of r){let i=[D(t.x,-160,180,44,t.title,t.fill),D(t.x,20,180,300,"",P.white,{strokeWidth:1})];for(let n=0;n<t.cards;n++)i.push(D(t.x,-86+n*70,150,54,`\u4EFB\u52A1 ${n+1}`,P.amber,{radius:6,strokeWidth:1}));e.push(...se(i));}return e},ea=()=>{let r=[],e=[{name:"\u9700\u6C42\u68B3\u7406",start:0,len:2,fill:P.blue},{name:"\u65B9\u6848\u8BBE\u8BA1",start:1.5,len:2.5,fill:P.green},{name:"\u5F00\u53D1\u5B9E\u73B0",start:3,len:4,fill:P.amber},{name:"\u6D4B\u8BD5\u9A8C\u8BC1",start:6,len:2,fill:P.violet},{name:"\u4E0A\u7EBF\u53D1\u5E03",start:7.5,len:1.5,fill:P.red}],t=62,i=-220,n=e.length;for(let o=0;o<=9;o++){r.push(B(i+o*t,-n*32-30,54,26,`W${o+1}`,"#64748b",12));let s={id:oe("grid"),type:"arrow",x:0,y:0,points:[{x:i+o*t,y:-n*32-14},{x:i+o*t,y:n*32-30}],rotation:0,connectionType:"orthogonal",arrowHead:"none",style:ue("transparent","#e2e8f0",1)};r.push(s);}return e.forEach((o,s)=>{let a=-n*32+s*64+20;r.push(...se([B(i-110,a,150,34,o.name,Y,13),D(i+o.start*t+o.len*t/2,a,o.len*t,34,"",o.fill,{radius:6,strokeWidth:1})]));}),r},ta=()=>{let r=Bi(0,-240,"Base",[["+","id","string"]],[["+","save","","void"]]),e=Bi(-170,40,"ChildA",[["+","name","string"]],[["+","render","","void"]]),t=Bi(170,40,"ChildB",[["+","count","number"]],[["+","update","","void"]]);return [r,e,t,R(e,r,{head:"inheritance",strokeWidth:1.8}),R(t,r,{head:"inheritance",strokeWidth:1.8})]};function _i(r,e,t,i){let a=e+38,l=[D(r,e+38/2,200,38,t,P.blue,{type:"rectangle",strokeWidth:1.5}),D(r,a+i.length*30/2,200,i.length*30,"",P.white,{type:"rectangle",strokeWidth:1.5})];return i.forEach((c,h)=>{if(l.push(B(r,a+30/2+h*30,184,26,c,Y,13)),h>0){let d={id:oe("sep"),type:"arrow",x:0,y:0,points:[{x:r-100,y:a+h*30},{x:r+100,y:a+h*30}],rotation:0,connectionType:"orthogonal",arrowHead:"none",style:ue("transparent","#e2e8f0",1)};l.push(d);}}),se(l)}var na=()=>{let r=_i(-300,-180,"user",["id bigint PK","name varchar","email varchar"]),e=_i(190,-180,"order",["id bigint PK","user_id bigint FK","amount decimal"]),t=_i(-300,60,"address",["id bigint PK","user_id bigint FK"]),i=r[0],n=e[0],o=t[0];return [...r,...e,...t,R(i,n,{aSide:"right",bSide:"left",head:"none",strokeWidth:1.5}),R(i,o,{aSide:"bottom",bSide:"top",head:"none",strokeWidth:1.5})]},ia=()=>{let r=[{y:-170,name:"\u5BA2\u6237",fill:"#eff6ff",stroke:"#60a5fa"},{y:0,name:"\u5BA2\u670D",fill:"#f0fdf4",stroke:"#4ade80"},{y:170,name:"\u7CFB\u7EDF",fill:"#faf5ff",stroke:"#a78bfa"}],e=[];for(let a of r)e.push(...se([D(10,a.y,1060,150,"",a.fill,{type:"rectangle",stroke:a.stroke,strokeWidth:1.5,radius:6}),B(-580,a.y,120,40,a.name,a.stroke,15)]));let t=D(-330,-170,180,62,"\u63D0\u51FA\u95EE\u9898",P.white,{stroke:"#60a5fa",strokeWidth:1.5}),i=D(-90,0,180,62,"\u53D7\u7406\u5DE5\u5355",P.white,{stroke:"#4ade80",strokeWidth:1.5}),n=D(170,170,180,62,"\u81EA\u52A8\u5206\u6D3E",P.white,{stroke:"#a78bfa",strokeWidth:1.5}),o=D(430,170,180,62,"\u5904\u7406\u5B8C\u6210",P.white,{stroke:"#a78bfa",strokeWidth:1.5}),s=D(430,-170,180,62,"\u786E\u8BA4\u7ED3\u679C",P.white,{stroke:"#60a5fa",strokeWidth:1.5});return [...e,t,i,n,o,s,R(t,i),R(i,n),R(n,o),R(o,s)]},oa=()=>{let r=[st([{x:-470,y:0},{x:430,y:0}],{width:3,head:"end"}),D(510,0,150,96,"\u95EE\u9898",P.red,{type:"rectangle",strokeWidth:2})],e=[{x:-320,dir:-1,t:"\u4EBA",c:"#60a5fa"},{x:-120,dir:1,t:"\u673A",c:"#4ade80"},{x:100,dir:-1,t:"\u6599",c:"#fbbf24"},{x:300,dir:1,t:"\u6CD5",c:"#a78bfa"}];for(let t of e){let i=t.x+80,n=t.dir*150;r.push(...se([st([{x:t.x,y:0},{x:i,y:n}],{width:2,stroke:t.c,straight:true}),B(i,n+t.dir*34,90,30,t.t,t.c,16)])),r.push(B(t.x+20,t.dir*95,120,26,"\u539F\u56E0 A","#5b6572",12)),r.push(B(t.x+110,t.dir*95,120,26,"\u539F\u56E0 B","#5b6572",12));}return r},ra=()=>{let s=[B(0,-360,900,56,"\u8425\u9500\u65E5\u5386 \xB7 \u672C\u6708",Y,24)];["\u5468\u65E5","\u5468\u4E00","\u5468\u4E8C","\u5468\u4E09","\u5468\u56DB","\u5468\u4E94","\u5468\u516D"].forEach((h,d)=>{s.push(D(-532+d*152+152/2,-300,140,40,h,P.slate,{radius:20,strokeWidth:1,stroke:"#cbd5e1"}));});for(let h=0;h<=5;h++)s.push(st([{x:-532,y:-262+h*96},{x:532,y:-262+h*96}],{stroke:"#e2e8f0",width:1}));for(let h=0;h<=7;h++)s.push(st([{x:-532+h*152,y:-262},{x:-532+h*152,y:218}],{stroke:"#e2e8f0",width:1}));let l=3;for(let h=1;h<=31;h++){let d=l+h-1,u=d%7,p=Math.floor(d/7),g=-532+u*152+152/2,m=-262+p*96+96/2;s.push(B(g,m-26,128,24,String(h),"#94a3b8",12));}let c=[{d:1,t:"\u52B3\u52A8\u8282",c:"#ef4444"},{d:4,t:"\u9752\u5E74\u8282",c:"#ef4444"},{d:10,t:"\u54C1\u724C\u65E5",c:"#3b82f6"},{d:18,t:"\u535A\u7269\u9986\u65E5",c:"#3b82f6"},{d:21,t:"\u5C0F\u6EE1 \xB7 \u8282\u6C14",c:"#22c55e"},{d:30,t:"\u79D1\u6280\u5DE5\u4F5C\u8005\u65E5",c:"#ef4444"}];for(let h of c){let d=l+h.d-1,u=d%7,p=Math.floor(d/7),g=-532+u*152+152/2,m=-262+p*96+96/2;s.push(B(g,m+10,132,40,h.t,h.c,11));}return s},sa=()=>{let r=(x,I,T,w,S)=>se([D(x,I,T,w,"","#f8fafc",{type:"rectangle",stroke:"#94a3b8",strokeWidth:1,radius:4}),B(x,I-w/2+22,T-24,28,S,"#475569",13)]),e=[...r(-220,-250,540,260,"Isolation Region"),...r(460,-250,360,220,"Recovery Center")],t=(x,I,T,w,S)=>se([Vs(x,I-8,T,46,S),B(x,I+30,150,24,w,"#475569",12)]),i=t(-390,-190,"server","\u4E1A\u52A1\u670D\u52A1\u5668","#3b82f6"),n=t(-220,-190,"server","\u4E1A\u52A1\u670D\u52A1\u5668","#3b82f6"),o=t(-50,-190,"server","\u4E1A\u52A1\u670D\u52A1\u5668","#3b82f6"),s=t(-220,-80,"chip","\u8D1F\u8F7D\u5747\u8861","#8b5cf6"),a=t(390,-200,"database","\u5907\u4EFD\u6570\u636E\u5E93","#22c55e"),l=t(550,-200,"server","\u5907\u4EFD\u670D\u52A1\u5668","#22c55e"),c=t(-600,40,"cloud","\u4E91\u8D44\u6E90\u6C60","#0ea5e9"),h=t(-600,200,"shield","\u9632\u706B\u5899","#f97316"),d=t(-220,40,"device-router","\u6838\u5FC3\u4EA4\u6362\u673A","#8b5cf6"),u=t(120,40,"shield","\u9632\u706B\u5899","#f97316"),p=t(-330,230,"server","\u5E94\u7528\u670D\u52A1\u5668","#3b82f6"),g=t(-150,230,"server","\u5E94\u7528\u670D\u52A1\u5668","#3b82f6"),m=t(340,190,"device-desktop","\u529E\u516C\u7EC8\u7AEF","#64748b"),f=t(340,290,"device-wifi","\u65E0\u7EBF AP","#64748b"),b=x=>x[0];return [...e,...i,...n,...o,...s,...a,...l,...c,...h,...d,...u,...p,...g,...m,...f,R(b(i),b(s),{head:"none",strokeWidth:1.5}),R(b(n),b(s),{head:"none",strokeWidth:1.5}),R(b(o),b(s),{head:"none",strokeWidth:1.5}),R(b(s),b(a),{head:"none",strokeWidth:1.5}),R(b(a),b(l),{head:"none",strokeWidth:1.5}),R(b(c),b(d),{head:"none",strokeWidth:2}),R(b(d),b(u),{head:"none",strokeWidth:2}),R(b(u),b(m),{head:"none",strokeWidth:2}),R(b(m),b(f),{head:"none",strokeWidth:1.5}),R(b(d),b(s),{head:"none",strokeWidth:2}),R(b(d),b(p),{head:"none",strokeWidth:2}),R(b(d),b(g),{head:"none",strokeWidth:2}),R(b(h),b(d),{head:"none",strokeWidth:2})]},In=[{id:"flow-basic",cat:"flow",zh:"\u7EB5\u5411\u6D41\u7A0B\u56FE",en:"Vertical flowchart",kw:"flow chart \u6D41\u7A0B \u6B65\u9AA4 \u5F00\u59CB \u7ED3\u675F",build:Os},{id:"flow-horizontal",cat:"flow",zh:"\u6A2A\u5411\u6D41\u7A0B",en:"Horizontal flow",kw:"flow horizontal \u6D41\u7A0B \u6A2A\u5411 \u8F93\u5165 \u8F93\u51FA",build:zs},{id:"steps-s",cat:"flow",zh:"\u516D\u6B65\u95EF\u5173\u6D41\u7A0B",en:"Six-step journey",kw:"steps journey \u95EF\u5173 \u6B65\u9AA4 \u5F97\u5206 \u6E38\u620F \u52A8\u7EBF",build:Ws},{id:"swimlane",cat:"flow",zh:"\u6CF3\u9053\u6D41\u7A0B\u56FE",en:"Swimlane flow",kw:"swimlane \u6CF3\u9053 \u8DE8\u90E8\u95E8 \u6D41\u7A0B \u89D2\u8272",build:ia},{id:"org-chart",cat:"org",zh:"\u7EC4\u7EC7\u67B6\u6784",en:"Org chart",kw:"org chart team \u7EC4\u7EC7 \u67B6\u6784 \u56E2\u961F \u6C47\u62A5",build:Fs},{id:"layered-arch",cat:"tech",zh:"\u5206\u5C42\u67B6\u6784\u56FE",en:"Layered architecture",kw:"layered architecture \u5206\u5C42 \u67B6\u6784 \u63A5\u5165 \u5E94\u7528 \u9886\u57DF \u57FA\u5EFA \u4E2D\u53F0",build:Ks},{id:"net-topology",cat:"tech",zh:"\u7F51\u7EDC\u62D3\u6251\u56FE",en:"Network topology",kw:"network topology \u7F51\u7EDC \u62D3\u6251 \u673A\u623F \u670D\u52A1\u5668 \u4EA4\u6362\u673A \u9632\u706B\u5899",build:sa},{id:"swot",cat:"analysis",zh:"SWOT \u5206\u6790",en:"SWOT analysis",kw:"swot \u5206\u6790 \u4F18\u52BF \u52A3\u52BF \u673A\u4F1A \u5A01\u80C1",build:Ys},{id:"hexa-5w1h",cat:"analysis",zh:"5W1H \u8702\u5DE2",en:"5W1H honeycomb",kw:"5w1h \u516D\u8981\u7D20 \u8702\u5DE2 \u65B0\u95FB \u516D\u8FB9\u5F62 honeycomb",build:Xs},{id:"business-canvas",cat:"analysis",zh:"\u5546\u4E1A\u6A21\u5F0F\u753B\u5E03",en:"Business model canvas",kw:"business canvas \u5546\u4E1A\u6A21\u5F0F \u753B\u5E03 \u4EF7\u503C\u4E3B\u5F20 \u5BA2\u7FA4 \u6536\u5165",build:Zs},{id:"pyramid",cat:"analysis",zh:"\u91D1\u5B57\u5854",en:"Pyramid",kw:"pyramid \u91D1\u5B57\u5854 \u5C42\u7EA7 \u76EE\u6807 \u652F\u6491",build:js},{id:"quadrant",cat:"analysis",zh:"\u56DB\u8C61\u9650\u77E9\u9635",en:"2x2 matrix",kw:"quadrant matrix \u56DB\u8C61\u9650 \u77E9\u9635 \u91CD\u8981 \u7D27\u6025",build:qs},{id:"fishbone",cat:"analysis",zh:"\u9C7C\u9AA8\u56FE",en:"Fishbone / Ishikawa",kw:"fishbone ishikawa \u9C7C\u9AA8 \u56E0\u679C \u539F\u56E0 \u77F3\u5DDD",build:oa},{id:"timeline",cat:"plan",zh:"\u65F6\u95F4\u7EBF",en:"Timeline",kw:"timeline \u65F6\u95F4\u7EBF \u9636\u6BB5 \u91CC\u7A0B\u7891 \u6392\u671F",build:Js},{id:"kanban",cat:"plan",zh:"\u770B\u677F",en:"Kanban board",kw:"kanban board \u770B\u677F \u4EFB\u52A1 \u5F85\u529E \u8FDB\u884C\u4E2D",build:Qs},{id:"gantt",cat:"plan",zh:"\u7518\u7279\u56FE",en:"Gantt chart",kw:"gantt \u7518\u7279 \u6392\u671F \u8FDB\u5EA6 \u5468 \u4EFB\u52A1",build:ea},{id:"marketing-calendar",cat:"plan",zh:"\u8425\u9500\u65E5\u5386",en:"Marketing calendar",kw:"calendar \u65E5\u5386 \u6708\u5386 \u8425\u9500 \u6392\u671F \u8282\u65E5",build:ra},{id:"uml-class",cat:"uml",zh:"UML \u7C7B\u56FE",en:"UML class diagram",kw:"uml class \u7C7B\u56FE \u7EE7\u627F \u5C5E\u6027 \u65B9\u6CD5",build:ta},{id:"erd",cat:"uml",zh:"\u6570\u636E\u8868\u5173\u7CFB",en:"ER diagram",kw:"er database \u6570\u636E\u8868 \u5173\u7CFB \u8868\u7ED3\u6784 \u5916\u952E",build:na}];function aa(r){return In.find(e=>e.id===r)}function la(r){let e=r.trim().toLowerCase();if(!e)return In;let t=e.split(/\s+/);return In.filter(i=>{let n=`${i.zh} ${i.en} ${i.kw}`.toLowerCase();return t.every(o=>n.includes(o))})}export{Rt as ArrowTool,vn as BoardExtentKeeper,Re as Camera,yn as DEFAULT_HIGHLIGHTER_COLOR,$t as DEFAULT_IMAGE_MAX_SIZE_BYTES,tr as DEFAULT_PAGE_THEME,Ni as Editor,Le as FreehandTool,Dt as HandTool,qe as ICONS,pr as ICON_CATEGORIES,mo as ICON_CATEGORY_INK,ft as ICON_DEFAULT_INK,oi as ICON_DEFAULT_SIZE,K as ICON_GRID,nr as LANGUAGES,Ht as LineTool,Xn as MINDMAP_COLORS,Ye as MINDMAP_DIRECTIONS,Ce as MINDMAP_FONT_SIZE,cr as MINDMAP_HANDLE_HIT_RADIUS,ut as MINDMAP_HANDLE_RADIUS,lr as MINDMAP_MAX_WIDTH,ar as MINDMAP_MIN_WIDTH,sr as MINDMAP_NODE_HEIGHT,Xo as MIN_HANDLE_SEGMENT,Zo as MIN_JOG,be as Mat2d,er as PAGE_THEMES,Ge as Renderer,re as STICKY_FOLD_RATIO,ao as STICKY_NOTE_COLORS,qt as STICKY_NOTE_DEFAULT_COLOR,je as STICKY_TEXT_SCALE,At as SelectTool,A as ShapeTool,we as TABLE_CELL_PADDING_X,xt as TABLE_CELL_PADDING_Y,$e as TABLE_DEFAULT_COL_WIDTH,Oe as TABLE_DEFAULT_ROW_HEIGHT,bt as TABLE_FONT_SIZE,li as TABLE_HEADER_FILL,Je as TABLE_LINE_HEIGHT_RATIO,Sr as TABLE_MAX_AUTO_LINES,si as TABLE_MIN_COL_WIDTH,ai as TABLE_MIN_ROW_HEIGHT,Ir as TABLE_MOVE_HANDLE_GAP,Cr as TABLE_MOVE_HANDLE_HEIGHT,Mr as TABLE_MOVE_HANDLE_WIDTH,In as TEMPLATES,_s as TEMPLATE_CATEGORIES,H as THEME,ee as UML_FONT_SIZE,ge as UML_HEADER_HEIGHT,V as UML_LINE_HEIGHT,yi as UML_MIN_WIDTH,ne as UML_PADDING_X,_ as UML_PADDING_Y,Ue as Vec,Dn as addImageReadyListener,cn as calcUmlClassSize,Wo as clearImageCache,Yt as cloneMindMapNode,Lr as cloneTable,he as cloneTableCells,dt as collapseRoute,Bn as collectTemporaryImageSrcs,zt as connectorSegmentHandles,eo as countMindMapNodes,Mt as createTableCells,Cn as downloadBlob,Z as effectiveDirection,mt as ensureIcons,Rn as ensureImagesLoaded,Mn as exportToBlob,W as findMindMapNode,rt as getContentBounds,Ve as getIcon,or as getLanguage,Zt as getMindMapNodeDepth,Be as getMindMapNodeSiblings,Ze as getMindMapParent,Qo as getTheme,ii as hasIcon,z as hexToRgba,vr as hitTableBody,Qe as hitTableMoveHandle,ri as iconInk,xr as iconsByCategory,En as imageDataUrl,He as isEmptyRect,_n as isFlippableShapeType,ce as isHorizontalDirection,br as isIconCatalogLoaded,Hn as isImageFailed,Go as isImageLoading,Vn as isStubCorner,Gi as isUploaderFunction,N as layoutMindMap,po as loadIconCatalog,Fe as loadImage,Jn as mindMapHandleAtLocalPoint,Ne as mindMapNodeColor,qn as mindMapNodeHandles,Qi as mindMapNodeSize,ti as moveMindMapNodeInTree,On as offsetConnectorSegment,Wi as parseUploadResponse,Vt as peekImage,$n as pickSegmentHandle,Ot as pointToSegmentDistance,ei as promoteMindMapNodeInTree,Un as pruneStubBends,Pn as rectsIntersect,Bo as renderSVGString,Ro as renderToCanvas,Qn as reorderMindMapNodeInTree,zn as routeToUserPoints,Gn as sameRoute,wr as searchIcons,la as searchTemplates,Oo as setImageCrossOrigin,Kt as setLanguage,Wt as setTheme,Fn as shadeColor,rr as subscribeLanguage,Jo as subscribeTheme,$i as subtractUnion,le as t,ui as tableAnchorAt,wt as tableCellAtLocalClamped,bo as tableCellLineCount,ie as tableCellLocalRect,St as tableCellTextStartOffset,ze as tableCoveredMap,sn as tableDeleteColumn,rn as tableDeleteRow,Ct as tableExpandRangeToMerges,hi as tableGrowRowHeights,on as tableInsertColumn,nn as tableInsertRow,Ie as tableLocalPoint,di as tableMerge,en as tableMoveHandleLocalRect,Tr as tablePagePoint,Ar as tableRangeHasMerge,ci as tableRangeLocalRect,gi as tableRowAtPoint,tn as tableSplit,pi as tableSplitRange,tt as tableTotalHeight,et as tableTotalWidth,aa as templateById,Ee as umlAttrRowText,xe as umlMethodRowText,lt as unionRect,Fi as uploadImageViaConfig};
|
|
53
|
+
\u65B0\u95FB\u7684\u4E3B\u4F53`,deg:210,fill:"#e0e7ff",stroke:"#a5b4fc"}],n=(s,a,l,c,h,d)=>se([D(s,a,230,230,"",h,{type:"hexagon",orientation:"flat",stroke:d,strokeWidth:1}),B(s,a-e*.27,230*.6,28,l,Y,15),lt([{x:s-230*.18,y:a-e*.09},{x:s+230*.18,y:a-e*.09}],{stroke:d,width:1}),B(s,a+e*.17,230*.62,60,c,"#5b6572",12)]),o=[...se([D(0,0,230,230,"","#f4f4f5",{type:"hexagon",orientation:"flat",stroke:"#d4d4d8",strokeWidth:1}),B(0,0,230*.5,70,`\u65B0\u95FB
|
|
54
|
+
\u516D\u8981\u7D20`,Y,16)])];for(let s of i){let a=s.deg*Math.PI/180;o.push(...n(Math.cos(a)*t,Math.sin(a)*t,s.t,s.d,s.fill,s.stroke));}return o},js=()=>[{x:-330,y:-160,t:"\u5173\u952E\u4F19\u4F34",fill:L.blueSoft},{x:0,y:-160,t:"\u5173\u952E\u4E1A\u52A1",fill:L.blueSoft},{x:330,y:-160,t:"\u4EF7\u503C\u4E3B\u5F20",fill:L.amber},{x:-330,y:0,t:"\u6838\u5FC3\u8D44\u6E90",fill:L.blueSoft},{x:0,y:0,t:"\u6E20\u9053\u901A\u8DEF",fill:L.green},{x:330,y:0,t:"\u5BA2\u6237\u5173\u7CFB",fill:L.green},{x:-330,y:160,t:"\u6210\u672C\u7ED3\u6784",fill:L.red},{x:0,y:160,t:"\u6536\u5165\u6765\u6E90",fill:L.red},{x:330,y:160,t:"\u5BA2\u6237\u7EC6\u5206",fill:L.green}].map(e=>D(e.x,e.y,300,140,e.t,e.fill,{type:"rectangle",strokeWidth:1.5})),qs=()=>{let t=.9782608695652174,i=176,n=i/2/t,o=[i,i+180,i+360,i+540],s=[n,92,92,92],a=["\u76EE\u6807","\u6838\u5FC3\u5C42","\u652F\u6491\u5C42","\u57FA\u7840\u5C42"],l=[L.red,L.amber,L.green,L.blueSoft],h=-s.reduce((u,p)=>u+p,0)/2,d=[];for(let u=0;u<o.length;u++){let p=s[u],g=h+p/2;d.push(u===0?D(0,g,o[u],p,a[u],l[u],{type:"triangle",strokeWidth:1.5}):D(0,g,o[u],p,a[u],l[u],{type:"trapezoid",strokeWidth:1.5,topInset:90})),h+=p;}return d},Js=()=>[D(-170,-150,320,260,`\u91CD\u8981\u4E14\u7D27\u6025
|
|
55
|
+
\u9A6C\u4E0A\u505A`,L.red,{type:"rectangle",strokeWidth:1.5}),D(170,-150,320,260,`\u91CD\u8981\u4E0D\u7D27\u6025
|
|
56
|
+
\u8BA1\u5212\u505A`,L.blue,{type:"rectangle",strokeWidth:1.5}),D(-170,120,320,260,`\u7D27\u6025\u4E0D\u91CD\u8981
|
|
57
|
+
\u59D4\u6258\u505A`,L.amber,{type:"rectangle",strokeWidth:1.5}),D(170,120,320,260,`\u4E0D\u91CD\u8981\u4E0D\u7D27\u6025
|
|
58
|
+
\u522B\u505A`,L.slate,{type:"rectangle",strokeWidth:1.5})],Qs=()=>[{id:oe("axis"),type:"arrow",x:0,y:0,points:[{x:-280,y:0},{x:280,y:0}],rotation:0,connectionType:"orthogonal",arrowHead:"end",style:ue("transparent",Y,3)},D(-200,-70,120,48,"\u9636\u6BB5\u4E00",L.blue),D(-60,70,120,48,"\u9636\u6BB5\u4E8C",L.green),D(80,-70,120,48,"\u9636\u6BB5\u4E09",L.amber),D(220,70,120,48,"\u9636\u6BB5\u56DB",L.violet)],ea=()=>{let r=[{x:-210,title:"\u5F85\u529E",fill:L.slate,cards:3},{x:0,title:"\u8FDB\u884C\u4E2D",fill:"#e0f2fe",cards:2},{x:210,title:"\u5DF2\u5B8C\u6210",fill:L.green,cards:1}],e=[];for(let t of r){let i=[D(t.x,-160,180,44,t.title,t.fill),D(t.x,20,180,300,"",L.white,{strokeWidth:1})];for(let n=0;n<t.cards;n++)i.push(D(t.x,-86+n*70,150,54,`\u4EFB\u52A1 ${n+1}`,L.amber,{radius:6,strokeWidth:1}));e.push(...se(i));}return e},ta=()=>{let r=[],e=[{name:"\u9700\u6C42\u68B3\u7406",start:0,len:2,fill:L.blue},{name:"\u65B9\u6848\u8BBE\u8BA1",start:1.5,len:2.5,fill:L.green},{name:"\u5F00\u53D1\u5B9E\u73B0",start:3,len:4,fill:L.amber},{name:"\u6D4B\u8BD5\u9A8C\u8BC1",start:6,len:2,fill:L.violet},{name:"\u4E0A\u7EBF\u53D1\u5E03",start:7.5,len:1.5,fill:L.red}],t=62,i=-220,n=e.length;for(let o=0;o<=9;o++){r.push(B(i+o*t,-n*32-30,54,26,`W${o+1}`,"#64748b",12));let s={id:oe("grid"),type:"arrow",x:0,y:0,points:[{x:i+o*t,y:-n*32-14},{x:i+o*t,y:n*32-30}],rotation:0,connectionType:"orthogonal",arrowHead:"none",style:ue("transparent","#e2e8f0",1)};r.push(s);}return e.forEach((o,s)=>{let a=-n*32+s*64+20;r.push(...se([B(i-110,a,150,34,o.name,Y,13),D(i+o.start*t+o.len*t/2,a,o.len*t,34,"",o.fill,{radius:6,strokeWidth:1})]));}),r},na=()=>{let r=_i(0,-240,"Base",[["+","id","string"]],[["+","save","","void"]]),e=_i(-170,40,"ChildA",[["+","name","string"]],[["+","render","","void"]]),t=_i(170,40,"ChildB",[["+","count","number"]],[["+","update","","void"]]);return [r,e,t,R(e,r,{head:"inheritance",strokeWidth:1.8}),R(t,r,{head:"inheritance",strokeWidth:1.8})]};function Vi(r,e,t,i){let a=e+38,l=[D(r,e+38/2,200,38,t,L.blue,{type:"rectangle",strokeWidth:1.5}),D(r,a+i.length*30/2,200,i.length*30,"",L.white,{type:"rectangle",strokeWidth:1.5})];return i.forEach((c,h)=>{if(l.push(B(r,a+30/2+h*30,184,26,c,Y,13)),h>0){let d={id:oe("sep"),type:"arrow",x:0,y:0,points:[{x:r-100,y:a+h*30},{x:r+100,y:a+h*30}],rotation:0,connectionType:"orthogonal",arrowHead:"none",style:ue("transparent","#e2e8f0",1)};l.push(d);}}),se(l)}var ia=()=>{let r=Vi(-300,-180,"user",["id bigint PK","name varchar","email varchar"]),e=Vi(190,-180,"order",["id bigint PK","user_id bigint FK","amount decimal"]),t=Vi(-300,60,"address",["id bigint PK","user_id bigint FK"]),i=r[0],n=e[0],o=t[0];return [...r,...e,...t,R(i,n,{aSide:"right",bSide:"left",head:"none",strokeWidth:1.5}),R(i,o,{aSide:"bottom",bSide:"top",head:"none",strokeWidth:1.5})]},oa=()=>{let r=[{y:-170,name:"\u5BA2\u6237",fill:"#eff6ff",stroke:"#60a5fa"},{y:0,name:"\u5BA2\u670D",fill:"#f0fdf4",stroke:"#4ade80"},{y:170,name:"\u7CFB\u7EDF",fill:"#faf5ff",stroke:"#a78bfa"}],e=[];for(let a of r)e.push(...se([D(10,a.y,1060,150,"",a.fill,{type:"rectangle",stroke:a.stroke,strokeWidth:1.5,radius:6}),B(-580,a.y,120,40,a.name,a.stroke,15)]));let t=D(-330,-170,180,62,"\u63D0\u51FA\u95EE\u9898",L.white,{stroke:"#60a5fa",strokeWidth:1.5}),i=D(-90,0,180,62,"\u53D7\u7406\u5DE5\u5355",L.white,{stroke:"#4ade80",strokeWidth:1.5}),n=D(170,170,180,62,"\u81EA\u52A8\u5206\u6D3E",L.white,{stroke:"#a78bfa",strokeWidth:1.5}),o=D(430,170,180,62,"\u5904\u7406\u5B8C\u6210",L.white,{stroke:"#a78bfa",strokeWidth:1.5}),s=D(430,-170,180,62,"\u786E\u8BA4\u7ED3\u679C",L.white,{stroke:"#60a5fa",strokeWidth:1.5});return [...e,t,i,n,o,s,R(t,i),R(i,n),R(n,o),R(o,s)]},ra=()=>{let r=[lt([{x:-470,y:0},{x:430,y:0}],{width:3,head:"end"}),D(510,0,150,96,"\u95EE\u9898",L.red,{type:"rectangle",strokeWidth:2})],e=[{x:-320,dir:-1,t:"\u4EBA",c:"#60a5fa"},{x:-120,dir:1,t:"\u673A",c:"#4ade80"},{x:100,dir:-1,t:"\u6599",c:"#fbbf24"},{x:300,dir:1,t:"\u6CD5",c:"#a78bfa"}];for(let t of e){let i=t.x+80,n=t.dir*150;r.push(...se([lt([{x:t.x,y:0},{x:i,y:n}],{width:2,stroke:t.c,straight:true}),B(i,n+t.dir*34,90,30,t.t,t.c,16)])),r.push(B(t.x+20,t.dir*95,120,26,"\u539F\u56E0 A","#5b6572",12)),r.push(B(t.x+110,t.dir*95,120,26,"\u539F\u56E0 B","#5b6572",12));}return r},sa=()=>{let s=[B(0,-360,900,56,"\u8425\u9500\u65E5\u5386 \xB7 \u672C\u6708",Y,24)];["\u5468\u65E5","\u5468\u4E00","\u5468\u4E8C","\u5468\u4E09","\u5468\u56DB","\u5468\u4E94","\u5468\u516D"].forEach((h,d)=>{s.push(D(-532+d*152+152/2,-300,140,40,h,L.slate,{radius:20,strokeWidth:1,stroke:"#cbd5e1"}));});for(let h=0;h<=5;h++)s.push(lt([{x:-532,y:-262+h*96},{x:532,y:-262+h*96}],{stroke:"#e2e8f0",width:1}));for(let h=0;h<=7;h++)s.push(lt([{x:-532+h*152,y:-262},{x:-532+h*152,y:218}],{stroke:"#e2e8f0",width:1}));let l=3;for(let h=1;h<=31;h++){let d=l+h-1,u=d%7,p=Math.floor(d/7),g=-532+u*152+152/2,m=-262+p*96+96/2;s.push(B(g,m-26,128,24,String(h),"#94a3b8",12));}let c=[{d:1,t:"\u52B3\u52A8\u8282",c:"#ef4444"},{d:4,t:"\u9752\u5E74\u8282",c:"#ef4444"},{d:10,t:"\u54C1\u724C\u65E5",c:"#3b82f6"},{d:18,t:"\u535A\u7269\u9986\u65E5",c:"#3b82f6"},{d:21,t:"\u5C0F\u6EE1 \xB7 \u8282\u6C14",c:"#22c55e"},{d:30,t:"\u79D1\u6280\u5DE5\u4F5C\u8005\u65E5",c:"#ef4444"}];for(let h of c){let d=l+h.d-1,u=d%7,p=Math.floor(d/7),g=-532+u*152+152/2,m=-262+p*96+96/2;s.push(B(g,m+10,132,40,h.t,h.c,11));}return s},aa=()=>{let r=(x,I,T,S,w)=>se([D(x,I,T,S,"","#f8fafc",{type:"rectangle",stroke:"#94a3b8",strokeWidth:1,radius:4}),B(x,I-S/2+22,T-24,28,w,"#475569",13)]),e=[...r(-220,-250,540,260,"Isolation Region"),...r(460,-250,360,220,"Recovery Center")],t=(x,I,T,S,w)=>se([$s(x,I-8,T,46,w),B(x,I+30,150,24,S,"#475569",12)]),i=t(-390,-190,"server","\u4E1A\u52A1\u670D\u52A1\u5668","#3b82f6"),n=t(-220,-190,"server","\u4E1A\u52A1\u670D\u52A1\u5668","#3b82f6"),o=t(-50,-190,"server","\u4E1A\u52A1\u670D\u52A1\u5668","#3b82f6"),s=t(-220,-80,"chip","\u8D1F\u8F7D\u5747\u8861","#8b5cf6"),a=t(390,-200,"database","\u5907\u4EFD\u6570\u636E\u5E93","#22c55e"),l=t(550,-200,"server","\u5907\u4EFD\u670D\u52A1\u5668","#22c55e"),c=t(-600,40,"cloud","\u4E91\u8D44\u6E90\u6C60","#0ea5e9"),h=t(-600,200,"shield","\u9632\u706B\u5899","#f97316"),d=t(-220,40,"device-router","\u6838\u5FC3\u4EA4\u6362\u673A","#8b5cf6"),u=t(120,40,"shield","\u9632\u706B\u5899","#f97316"),p=t(-330,230,"server","\u5E94\u7528\u670D\u52A1\u5668","#3b82f6"),g=t(-150,230,"server","\u5E94\u7528\u670D\u52A1\u5668","#3b82f6"),m=t(340,190,"device-desktop","\u529E\u516C\u7EC8\u7AEF","#64748b"),f=t(340,290,"device-wifi","\u65E0\u7EBF AP","#64748b"),b=x=>x[0];return [...e,...i,...n,...o,...s,...a,...l,...c,...h,...d,...u,...p,...g,...m,...f,R(b(i),b(s),{head:"none",strokeWidth:1.5}),R(b(n),b(s),{head:"none",strokeWidth:1.5}),R(b(o),b(s),{head:"none",strokeWidth:1.5}),R(b(s),b(a),{head:"none",strokeWidth:1.5}),R(b(a),b(l),{head:"none",strokeWidth:1.5}),R(b(c),b(d),{head:"none",strokeWidth:2}),R(b(d),b(u),{head:"none",strokeWidth:2}),R(b(u),b(m),{head:"none",strokeWidth:2}),R(b(m),b(f),{head:"none",strokeWidth:1.5}),R(b(d),b(s),{head:"none",strokeWidth:2}),R(b(d),b(p),{head:"none",strokeWidth:2}),R(b(d),b(g),{head:"none",strokeWidth:2}),R(b(h),b(d),{head:"none",strokeWidth:2})]},Tn=[{id:"flow-basic",cat:"flow",zh:"\u7EB5\u5411\u6D41\u7A0B\u56FE",en:"Vertical flowchart",kw:"flow chart \u6D41\u7A0B \u6B65\u9AA4 \u5F00\u59CB \u7ED3\u675F",build:zs},{id:"flow-horizontal",cat:"flow",zh:"\u6A2A\u5411\u6D41\u7A0B",en:"Horizontal flow",kw:"flow horizontal \u6D41\u7A0B \u6A2A\u5411 \u8F93\u5165 \u8F93\u51FA",build:Gs},{id:"steps-s",cat:"flow",zh:"\u516D\u6B65\u95EF\u5173\u6D41\u7A0B",en:"Six-step journey",kw:"steps journey \u95EF\u5173 \u6B65\u9AA4 \u5F97\u5206 \u6E38\u620F \u52A8\u7EBF",build:Fs},{id:"swimlane",cat:"flow",zh:"\u6CF3\u9053\u6D41\u7A0B\u56FE",en:"Swimlane flow",kw:"swimlane \u6CF3\u9053 \u8DE8\u90E8\u95E8 \u6D41\u7A0B \u89D2\u8272",build:oa},{id:"org-chart",cat:"org",zh:"\u7EC4\u7EC7\u67B6\u6784",en:"Org chart",kw:"org chart team \u7EC4\u7EC7 \u67B6\u6784 \u56E2\u961F \u6C47\u62A5",build:Ks},{id:"layered-arch",cat:"tech",zh:"\u5206\u5C42\u67B6\u6784\u56FE",en:"Layered architecture",kw:"layered architecture \u5206\u5C42 \u67B6\u6784 \u63A5\u5165 \u5E94\u7528 \u9886\u57DF \u57FA\u5EFA \u4E2D\u53F0",build:Ys},{id:"net-topology",cat:"tech",zh:"\u7F51\u7EDC\u62D3\u6251\u56FE",en:"Network topology",kw:"network topology \u7F51\u7EDC \u62D3\u6251 \u673A\u623F \u670D\u52A1\u5668 \u4EA4\u6362\u673A \u9632\u706B\u5899",build:aa},{id:"swot",cat:"analysis",zh:"SWOT \u5206\u6790",en:"SWOT analysis",kw:"swot \u5206\u6790 \u4F18\u52BF \u52A3\u52BF \u673A\u4F1A \u5A01\u80C1",build:Xs},{id:"hexa-5w1h",cat:"analysis",zh:"5W1H \u8702\u5DE2",en:"5W1H honeycomb",kw:"5w1h \u516D\u8981\u7D20 \u8702\u5DE2 \u65B0\u95FB \u516D\u8FB9\u5F62 honeycomb",build:Zs},{id:"business-canvas",cat:"analysis",zh:"\u5546\u4E1A\u6A21\u5F0F\u753B\u5E03",en:"Business model canvas",kw:"business canvas \u5546\u4E1A\u6A21\u5F0F \u753B\u5E03 \u4EF7\u503C\u4E3B\u5F20 \u5BA2\u7FA4 \u6536\u5165",build:js},{id:"pyramid",cat:"analysis",zh:"\u91D1\u5B57\u5854",en:"Pyramid",kw:"pyramid \u91D1\u5B57\u5854 \u5C42\u7EA7 \u76EE\u6807 \u652F\u6491",build:qs},{id:"quadrant",cat:"analysis",zh:"\u56DB\u8C61\u9650\u77E9\u9635",en:"2x2 matrix",kw:"quadrant matrix \u56DB\u8C61\u9650 \u77E9\u9635 \u91CD\u8981 \u7D27\u6025",build:Js},{id:"fishbone",cat:"analysis",zh:"\u9C7C\u9AA8\u56FE",en:"Fishbone / Ishikawa",kw:"fishbone ishikawa \u9C7C\u9AA8 \u56E0\u679C \u539F\u56E0 \u77F3\u5DDD",build:ra},{id:"timeline",cat:"plan",zh:"\u65F6\u95F4\u7EBF",en:"Timeline",kw:"timeline \u65F6\u95F4\u7EBF \u9636\u6BB5 \u91CC\u7A0B\u7891 \u6392\u671F",build:Qs},{id:"kanban",cat:"plan",zh:"\u770B\u677F",en:"Kanban board",kw:"kanban board \u770B\u677F \u4EFB\u52A1 \u5F85\u529E \u8FDB\u884C\u4E2D",build:ea},{id:"gantt",cat:"plan",zh:"\u7518\u7279\u56FE",en:"Gantt chart",kw:"gantt \u7518\u7279 \u6392\u671F \u8FDB\u5EA6 \u5468 \u4EFB\u52A1",build:ta},{id:"marketing-calendar",cat:"plan",zh:"\u8425\u9500\u65E5\u5386",en:"Marketing calendar",kw:"calendar \u65E5\u5386 \u6708\u5386 \u8425\u9500 \u6392\u671F \u8282\u65E5",build:sa},{id:"uml-class",cat:"uml",zh:"UML \u7C7B\u56FE",en:"UML class diagram",kw:"uml class \u7C7B\u56FE \u7EE7\u627F \u5C5E\u6027 \u65B9\u6CD5",build:na},{id:"erd",cat:"uml",zh:"\u6570\u636E\u8868\u5173\u7CFB",en:"ER diagram",kw:"er database \u6570\u636E\u8868 \u5173\u7CFB \u8868\u7ED3\u6784 \u5916\u952E",build:ia}];function la(r){return Tn.find(e=>e.id===r)}function ca(r){let e=r.trim().toLowerCase();if(!e)return Tn;let t=e.split(/\s+/);return Tn.filter(i=>{let n=`${i.zh} ${i.en} ${i.kw}`.toLowerCase();return t.every(o=>n.includes(o))})}export{Et as ArrowTool,kn as BoardExtentKeeper,Re as Camera,bn as DEFAULT_HIGHLIGHTER_COLOR,Ot as DEFAULT_IMAGE_MAX_SIZE_BYTES,nr as DEFAULT_PAGE_THEME,Bi as Editor,Le as FreehandTool,Ht as HandTool,Qe as ICONS,gr as ICON_CATEGORIES,mo as ICON_CATEGORY_INK,yt as ICON_DEFAULT_INK,ri as ICON_DEFAULT_SIZE,K as ICON_GRID,ir as LANGUAGES,Rt as LineTool,Zn as MINDMAP_COLORS,Ze as MINDMAP_DIRECTIONS,Ce as MINDMAP_FONT_SIZE,hr as MINDMAP_HANDLE_HIT_RADIUS,pt as MINDMAP_HANDLE_RADIUS,cr as MINDMAP_MAX_WIDTH,lr as MINDMAP_MIN_WIDTH,ar as MINDMAP_NODE_HEIGHT,Zo as MIN_HANDLE_SEGMENT,jo as MIN_JOG,be as Mat2d,tr as PAGE_THEMES,Ue as Renderer,re as STICKY_FOLD_RATIO,ao as STICKY_NOTE_COLORS,Jt as STICKY_NOTE_DEFAULT_COLOR,Je as STICKY_TEXT_SCALE,Dt as SelectTool,A as ShapeTool,we as TABLE_CELL_PADDING_X,wt as TABLE_CELL_PADDING_Y,Oe as TABLE_DEFAULT_COL_WIDTH,ze as TABLE_DEFAULT_ROW_HEIGHT,xt as TABLE_FONT_SIZE,ci as TABLE_HEADER_FILL,et as TABLE_LINE_HEIGHT_RATIO,Mr as TABLE_MAX_AUTO_LINES,ai as TABLE_MIN_COL_WIDTH,li as TABLE_MIN_ROW_HEIGHT,Tr as TABLE_MOVE_HANDLE_GAP,Ir as TABLE_MOVE_HANDLE_HEIGHT,Cr as TABLE_MOVE_HANDLE_WIDTH,Tn as TEMPLATES,Vs as TEMPLATE_CATEGORIES,H as THEME,ee as UML_FONT_SIZE,ge as UML_HEADER_HEIGHT,V as UML_LINE_HEIGHT,bi as UML_MIN_WIDTH,ne as UML_PADDING_X,_ as UML_PADDING_Y,We as Vec,Hn as addImageReadyListener,hn as calcUmlClassSize,Fo as clearImageCache,Xt as cloneMindMapNode,Ar as cloneTable,he as cloneTableCells,Ye as collapseRoute,_n as collectTemporaryImageSrcs,Gt as connectorSegmentHandles,eo as countMindMapNodes,Ct as createTableCells,In as downloadBlob,Z as effectiveDirection,ft as ensureIcons,En as ensureImagesLoaded,Cn as exportToBlob,W as findMindMapNode,at as getContentBounds,$e as getIcon,rr as getLanguage,jt as getMindMapNodeDepth,_e as getMindMapNodeSiblings,qe as getMindMapParent,er as getTheme,oi as hasIcon,z as hexToRgba,kr as hitTableBody,tt as hitTableMoveHandle,si as iconInk,wr as iconsByCategory,Nn as imageDataUrl,He as isEmptyRect,Vn as isFlippableShapeType,ce as isHorizontalDirection,xr as isIconCatalogLoaded,Rn as isImageFailed,Uo as isImageLoading,$n as isStubCorner,Ui as isUploaderFunction,N as layoutMindMap,po as loadIconCatalog,Ke as loadImage,Ee as mergeShallowSteps,Qn as mindMapHandleAtLocalPoint,Be as mindMapNodeColor,Jn as mindMapNodeHandles,Qi as mindMapNodeSize,ni as moveMindMapNodeInTree,zn as offsetConnectorSegment,Fi as parseUploadResponse,$t as peekImage,On as pickSegmentHandle,zt as pointToSegmentDistance,ti as promoteMindMapNodeInTree,Wn as pruneStubBends,Ln as rectsIntersect,_o as renderSVGString,Eo as renderToCanvas,ei as reorderMindMapNodeInTree,Gn as routeToUserPoints,Un as sameRoute,Sr as searchIcons,ca as searchTemplates,zo as setImageCrossOrigin,Yt as setLanguage,Ft as setTheme,Kn as shadeColor,sr as subscribeLanguage,Qo as subscribeTheme,Oi as subtractUnion,le as t,pi as tableAnchorAt,St as tableCellAtLocalClamped,bo as tableCellLineCount,ie as tableCellLocalRect,Mt as tableCellTextStartOffset,Ge as tableCoveredMap,an as tableDeleteColumn,sn as tableDeleteRow,It as tableExpandRangeToMerges,di as tableGrowRowHeights,rn as tableInsertColumn,on as tableInsertRow,Ie as tableLocalPoint,ui as tableMerge,tn as tableMoveHandleLocalRect,vr as tablePagePoint,Dr as tableRangeHasMerge,hi as tableRangeLocalRect,mi as tableRowAtPoint,nn as tableSplit,gi as tableSplitRange,it as tableTotalHeight,nt as tableTotalWidth,la as templateById,Ne as umlAttrRowText,xe as umlMethodRowText,ht as unionRect,Ki as uploadImageViaConfig};
|