|
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('whiteboard', '', 'js/subset-worker.chunk-F5a_77lK.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/subset-shared.chunk-fFvi6m6w.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/index-Bn0s6V7w.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/whiteboard-main.mjs'),window.OC.filePath('whiteboard', '', 'js/index-BazmyFQi.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/vendor-DsWkVfAM.chunk.mjs'),window.OC.filePath('whiteboard', '', 'css/main-Bp_q-jbT.chunk.css'),window.OC.filePath('whiteboard', '', 'js/pica-Bs5MOtrv.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/_commonjs-dynamic-modules-CSduYUN4.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/ar-SA-G6X2FPQ2-Clu9QPki.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/az-AZ-76LH7QW2-fAIoXwSj.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/bg-BG-XCXSNQG7-DbdeRd-A.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/bn-BD-2XOGV67Q-CIj7T0kJ.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/ca-ES-6MX7JW3Y-nDSTF7pi.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/cs-CZ-2BRQDIVT-BszrhMxZ.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/da-DK-5WZEPLOC-VXsMi9NC.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/de-DE-XR44H4JA-7ajHjo71.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/el-GR-BZB4AONW-C0QMKfIg.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/es-ES-U4NZUMDT-B9IVa0cH.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/eu-ES-A7QVB2H4-Du0NlnvU.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/fa-IR-HGAKTJCU-BDjIpTH8.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/fi-FI-Z5N7JZ37-DzIXvwrY.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/fr-FR-RHASNOE6-CXTJF2om.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/gl-ES-HMX3MZ6V-rS775A_D.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/he-IL-6SHJWFNN-2kxhdh1y.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/hi-IN-IWLTKZ5I-IMw8OZDi.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/hu-HU-A5ZG7DT2-DpbgawMi.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/id-ID-SAP4L64H-DqRiWhYW.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/it-IT-JPQ66NNP-rrIVaEln.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/ja-JP-DBVTYXUO-BUODdsxL.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/kaa-6HZHGXH3-C7aQoUcv.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/kab-KAB-ZGHBKWFO-KTKa6rNz.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/kk-KZ-P5N5QNE5-DqbPY8_B.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/km-KH-HSX4SM5Z-BTSQY_28.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/ko-KR-MTYHY66A-BUTscLRG.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/ku-TR-6OUDTVRD-5odUREOl.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/lt-LT-XHIRWOB4-BkssUxPq.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/lv-LV-5QDEKY6T-D2VOBC3B.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/mr-IN-CRQNXWMA-DTErV_g1.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/my-MM-5M5IBNSE-DphQYj8h.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/nb-NO-T6EIAALU-BtMUtLOF.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/nl-NL-IS3SIHDZ-Cl-oeDuw.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/nn-NO-6E72VCQL-DFIP0xco.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/oc-FR-POXYY2M6-CY-97xbx.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/pa-IN-N4M65BXN-Dmrc83YX.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/pl-PL-T2D74RX3-_Hk3ZRoe.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/pt-BR-5N22H2LF-XMv-pWOx.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/pt-PT-UZXXM6DQ-DJqcIPd3.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/ro-RO-JPDTUUEW-LS8jaImG.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/ru-RU-B4JR7IUQ-BQa3IBsZ.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/si-LK-N5RQ5JYF-DUMuD4Zg.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/sk-SK-C5VTKIMK-BuxGMR20.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/sl-SI-NN7IZMDC-CfG2xJJc.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/sv-SE-XGPEYMSR-BiP7mILp.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/ta-IN-2NMHFXQM-VAY5BFZn.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/th-TH-HPSO5L25-daQ6W7j0.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/tr-TR-DEFEU3FU-B6ZFs3Qy.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/uk-UA-QMV73CPH-AhbRpdq6.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/vi-VN-M7AON7JQ-F2uVJOk-.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/zh-CN-LNUGB5OW-CFynv4zA.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/zh-HK-E62DVLB3-BzQwedWv.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/zh-TW-RAJ6MFWO-CxO6GWiO.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/index-wvBhvr2O.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/isEmpty-DxmJ9h_e.chunk.mjs'),window.OC.filePath('whiteboard', '', 'js/index-vg7q3Iku.chunk.mjs')]Line truncated
|
|
|
|
|
|
|
|
/*! third party licenses: js/vendor.LICENSE.txt */
|
|
|
|
|
|
|
|
import{_ as ne,R as Z,r as k,a as Wt,$ as Sf,b as Lv}from"./whiteboard-main.mjs";import{g as lr,c as Fi,r as Mf}from"./vendor-DsWkVfAM.chunk.mjs";import{B as FU,p as Dv}from"./index-Bn0s6V7w.chunk.mjs";var be={VITE_APP_BACKEND_V2_GET_URL:"https://json.excalidraw.com/api/v2/",VITE_APP_BACKEND_V2_POST_URL:"https://json.excalidraw.com/api/v2/post/",VITE_APP_LIBRARY_URL:"https://libraries.excalidraw.com",VITE_APP_LIBRARY_BACKEND:"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries",VITE_APP_PLUS_LP:"https://plus.excalidraw.com",VITE_APP_PLUS_APP:"https://app.excalidraw.com",VITE_APP_AI_BACKEND:"https://oss-ai.excalidraw.com",VITE_APP_WS_SERVER_URL:"https://oss-collab.excalidraw.com",VITE_APP_FIREBASE_CONFIG:'{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}',VITE_APP_ENABLE_TRACKING:"false",VITE_APP_PLUS_EXPORT_PUBLIC_KEY:`MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApQ0jM9Qz8TdFLzcuAZZX
|
|
|
|
|
|
|
|
/WvuKSOJxiw6AR/ZcE3eFQWM/mbFdhQgyK8eHGkKQifKzH1xUZjCxyXcxW6ZO02t
|
|
|
|
|
|
|
|
kPOPxhz+nxUrIoWCD/V4NGmUA1lxwHuO21HN1gzKrN3xHg5EGjyouR9vibT9VDGF
|
|
|
|
|
|
|
|
gq6+4Ic/kJX+AD2MM7Yre2+FsOdysrmuW2Fu3ahuC1uQE7pOe1j0k7auNP0y1q53
|
|
|
|
|
|
|
|
PrB8Ts2LUpepWC1l7zIXFm4ViDULuyWXTEpUcHSsEH8vpd1tckjypxCwkipfZsXx
|
|
|
|
|
|
|
|
iPszy0o0Dx2iArPfWMXlFAI9mvyFCyFC3+nSvfyAUb2C4uZgCwAuyFh/ydPF4DEE
|
|
|
|
|
|
|
|
PQIDAQAB`,VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX:"false",VITE_APP_COLLAPSE_OVERLAY:"false",VITE_APP_ENABLE_ESLINT:"false",PKG_NAME:"@nextcloud/excalidraw",PKG_VERSION:"0.18.0-6135eb0",PROD:!0},Q5=Object.defineProperty,Rv=(e,t,n)=>t in e?Q5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fZ=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Pv=e=>t=>{var n=e[t];if(n)return n();throw new Error("Module not found in bundle: "+t)},J5=(e,t)=>{for(var n in t)Q5(e,n,{get:t[n],enumerable:!0})},_=(e,t,n)=>(Rv(e,typeof t!="symbol"?t+"":t,n),n),zU={},BU;function eb(){return BU||(BU=1,function(e){(function(t){t(typeof DO_NOT_EXPORT_CRC>"u"?e:{})})(function(t){t.version="0.3.0";function n(){for(var c=0,l=new Array(256),h=0;h!=256;++h)c=h,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,c=c&1?-306674912^c>>>1:c>>>1,l[h]=c;return typeof Int32Array<"u"?new Int32Array(l):l}var a=n(),i=typeof FU<"u";function r(c){if(c.length>32768&&i)return o(new FU(c));for(var l=-1,h=c.length-1,f=0;f<h;)l=a[(l^c.charCodeAt(f++))&255]^l>>>8,l=a[(l^c.charCodeAt(f++))&255]^l>>>8;return f===h&&(l=l>>>8^a[(l^c.charCodeAt(f))&255]),l^-1}function s(c){if(c.length>1e4)return o(c);for(var l=-1,h=0,f=c.length-3;h<f;)l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255];for(;h<f+3;)l=l>>>8^a[(l^c[h++])&255];return l^-1}function o(c){for(var l=-1,h=0,f=c.length-7;h<f;)l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255],l=l>>>8^a[(l^c[h++])&255];for(;h<f+7;)l=l>>>8^a[(l^c[h++])&255];return l^-1}function d(c){for(var l=-1,h=0,f=c.length,p,U;h<f;)p=c.charCodeAt(h++),p<128?l=l>>>8^a[(l^p)&255]:p<2048?(l=l>>>8^a[(l^(192|p>>6&31))&255],l=l>>>8^a[(l^(128|p&63))&255]):p>=55296&&p<57344?(p=(p&1023)+64,U=c.charCodeAt(h++)&1023,l=l>>>8^a[(l^(240|p>>8&7))&255],l=l>>>8^a[(l^(128|p>>2&63))&255],l=l>>>8^a[(l^(128|U>>6&15|p&3))&255],l=l>>>8^a[(l^(128|U&63))&255]):(l=l>>>8^a[(l^(224|p>>12&15))&255],l=l>>>8^a[(l^(128|p>>6&63))&255],l=l>>>8^a[(l^(128|p&63))&255]);return l^-1}t.table=a,t.bstr=r,t.buf=s,t.str=d})}(zU)),zU}var Mu,HU;function Nv(){if(HU)return Mu;HU=1;var e=eb();Mu=i;var t=new Uint8Array(4),n=new Int32Array(t.buffer),a=new Uint32Array(t.buffer);function i(r){if(r[0]!==137)throw new Error("Invalid .png file header");if(r[1]!==80)throw new Error("Invalid .png file header");if(r[2]!==78)throw new Error("Invalid .png file header");if(r[3]!==71)throw new Error("Invalid .png file header");if(r[4]!==13)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(r[5]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");if(r[6]!==26)throw new Error("Invalid .png file header");if(r[7]!==10)throw new Error("Invalid .png file header: possibly caused by DOS-Unix line ending conversion?");for(var s=!1,o=[],d=8;d<r.length;){t[3]=r[d++],t[2]=r[d++],t[1]=r[d++],t[0]=r[d++];var c=a[0]+4,l=new Uint8Array(c);l[0]=r[d++],l[1]=r[d++],l[2]=r[d++],l[3]=r[d++];var h=String.fromCharCode(l[0])+String.fromCharCode(l[1])+String.fromCharCode(l[2])+String.fromCharCode(l[3]);if(!o.length&&h!=="IHDR")throw new Error("IHDR header missing");if(h==="IEND"){s=!0,o.push({name:h,data:new Uint8Array(0)});break}for(var f=4;f<c;f++)l[f]=r[d++];t[3]=r[d++],t[2]=r[d++],t[1]=r[d++],t[0]=r[d++];var p=n[0],U=e.buf(l);if(U!==p)throw new Error("CRC values for "+h+" header do not match, PNG file is likely corrupted");var m=new Uint8Array(l.buffer.slice(4));o.push({name:h,data:m})}if(!s)throw new Error(".png file ended prematurely: no IEND header was found");return o}return Mu}var Ov=Nv();const tb=lr(Ov);var Cu={},Iu,$U;function Fv(){if($U)return Iu;$U=1,Iu=e;function e(t,n){if(t=String(t),n=String(n),!/^[\x00-\xFF]+$/.test(t)||!/^[\x00-\xFF]+$/.test(n))throw new Error("Only Latin-1 characters are permitted in PNG tEXt chunks. You might want to consider base64 encoding and/or zEXt compression");if(t.length>=80)throw new Error('Keyword "'+t+'" is longer than the 79-character limit imposed by the PNG specification');for(var a=t.length+n.length+1,i=new Uint8Array(a),r=0,s,o=0;o<t.length;o++){if(!(s=t.charCodeAt(o)))throw new Error("0x00 character is not permitted in tEXt keywords");i[r++]=s}i[r++]=0;for(var d=0;d<n.length;d++){if(!(s=n.charCodeAt(d)))throw new Error("0x00 character is not permitted in tEXt content");i[r++]=s}return{name:"tEXt",data:i}}return Iu}var Tu,XU;function zv(){if(XU)return Tu;XU=1,Tu=e;function e(t){t.data&&t.name&&(t=t.data);for(var n=!0,a="",i="",r=0;r<t.
Line truncated
|
|
|
|
|
|
|
|
`),Bn=e=>e,Qi=async(e,...t)=>new Promise(n=>{n(e(...t))}),fC=(...e)=>Math.max(...e.map(t=>t?1:0))>0,h2=class{constructor(e,t){_(this,"pool"),_(this,"entries",{}),this.pool=new Vk(e,t)}all(){let e=t=>{if(t.data.result){let[n,a]=t.data.result;this.entries[n]=a}};return this.pool.addEventListener("fulfilled",e),this.pool.start().then(()=>(setTimeout(()=>{this.pool.removeEventListener("fulfilled",e)}),Object.values(this.entries)))}},sc=e=>e.replace(/"/g,"""),u2=e=>Array.isArray(e)?e:[e],Rn=e=>!!e&&e.type==="image"&&!!e.fileId,Re=e=>!!e&&e.type==="image",Un=e=>!!e&&e.type==="embeddable",Pi=e=>!!e&&e.type==="iframe",Pn=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),q=e=>e!=null&&e.type==="text",k8=e=>e!=null&&e.type==="frame",lc=e=>e!=null&&e.type==="magicframe",de=e=>e!=null&&(e.type==="frame"||e.type==="magicframe"),Hn=e=>e!=null&&pC(e.type),pC=e=>e==="freedraw",he=e=>e!=null&&Hf(e.type),xe=e=>e!=null&&e.type==="arrow",J=e=>xe(e)&&e.elbowed,Hf=e=>e==="arrow"||e==="line",La=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&S8(e.type),S8=e=>e==="arrow",pa=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),UC=e=>e!=null&&(e.type==="rectangle"||e.type==="diamond"||e.type==="image"||e.type==="iframe"||e.type==="embeddable"||e.type==="frame"||e.type==="magicframe"||e.type==="text"&&!e.containerId),Dr=(e,t=!0)=>e!=null&&(!e.locked||t===!0)&&(e.type==="rectangle"||e.type==="diamond"||e.type==="ellipse"||xe(e)),M8=e=>{let t=e?.type;if(!t)return!1;switch(t){case"text":case"diamond":case"rectangle":case"iframe":case"embeddable":case"ellipse":case"arrow":case"freedraw":case"line":case"frame":case"magicframe":case"image":case"selection":return!0;default:return Wr(t,null),!1}},zh=e=>e.type==="rectangle"||e.type==="ellipse"||e.type==="diamond",$n=e=>Dr(e)&&!!e.boundElements?.some(({type:t})=>t==="text"),at=e=>e!==null&&"containerId"in e&&e.containerId!==null&&q(e),hl=e=>e==="rectangle"||e==="embeddable"||e==="iframe"||e==="image",C8=e=>e==="line"||e==="arrow"||e==="diamond",mC=(e,t)=>!!((e===St.ADAPTIVE_RADIUS||e===St.LEGACY)&&hl(t.type)||e===St.PROPORTIONAL_RADIUS&&C8(t.type)),gC=e=>C8(e.type)?{type:St.PROPORTIONAL_RADIUS}:hl(e.type)?{type:St.ADAPTIVE_RADIUS}:null,Yc=e=>Object.hasOwn(e,"fixedPoint")&&e.fixedPoint!=null,an=(e,t,n)=>{let a=e.split(`
|
|
|
|
|
|
|
|
`).map(s=>s||" ").join(`
|
|
|
|
|
|
|
|
`),i=parseFloat(t),r=wC(a,i,n);return{width:Wf(a,t),height:r}},I8="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(),T8=(e,t)=>{let n=EC(e);return n===0?an(I8.split("").join(`
|
|
|
|
|
|
|
|
`),e,t).width+jt*2:n+jt*2},$f=(e,t)=>an("",e,t).width+jt*2,bC=()=>Wf(I8,Xe({fontSize:Ei,fontFamily:dr}))>0,Zs=e=>E8(e).replace(/\t/g," "),Xf=e=>Zs(e).split(`
|
|
|
|
|
|
|
|
`),yC=e=>{let t=Xf(e.text).length;return e.height/t/e.fontSize},ad=(e,t)=>e*t,j8=(e,t)=>ad(e,t)+jt*2,oc,xC=e=>{oc=e},vC=class{constructor(){_(this,"canvas"),this.canvas=document.createElement("canvas")}getLineWidth(e,t){let n=this.canvas.getContext("2d");n.font=t;let a=n.measureText(e).width;return fi()?a*10:a}},Vr=(e,t)=>(oc||(oc=new vC),oc.getLineWidth(e,t)),Wf=(e,t)=>{let n=Xf(e),a=0;return n.forEach(i=>{a=Math.max(a,Vr(i,t))}),a},wC=(e,t,n)=>{let a=Xf(e).length;return ad(t,n)*a},id=(()=>{let e={};return{calculate:(t,n)=>{let a=t.charCodeAt(0);if(e[n]||(e[n]=[]),!e[n][a]){let i=Vr(t,n);e[n][a]=i}return e[n][a]},getCache:t=>e[t],clearCache:t=>{e[t]=[]}}})(),EC=e=>{let t=id.getCache(e);if(!t)return 0;let n=t.filter(a=>a!==void 0);return Math.max(...n)},Qu,Ad,Ju,kC=e=>(Qu||(Qu=Fe.class(...Object.values(ei))),Qu.test(e)),SC=()=>{if(!Ad)try{Ad=CC()}catch{Ad=MC()}return Ad},Vf=()=>(Ju||(Ju=IC()),Ju),_n={WHITESPACE:/\s/u,HYPHEN:/-/u,OPENING:/<\(\[\{/u,CLOSING:/>\)\]\}.,:;!\?…\//u},ei={CHAR:new RegExp("\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}`'^〃〰〆#&*+-ー/\=|¦〒¬ ̄","u"),OPENING:/([{〈《⦅「「『【〖〔〘〚<〝/u,CLOSING:/)]}〉》⦆」」』】〗〕〙〛>。.,、〟‥?!:;・〜〞/u,CURRENCY:/¥₩£¢$/u},pr={FLAG:new RegExp("\\p{RI}\\p{RI}","u"),JOINER:new RegExp("(?:\\p{Emoji_Modifier}|\\uFE0F\\u20E3?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?","u"),ZWJ:/\u200D/u,ANY:/[\p{Emoji}]/u,MOST:/[\p{Extended_Pictographic}\p{Emoji_Presentation}]/u},MC=()=>Fe.or(Vf(),wt.On(_n.HYPHEN,_n.WHITESPACE,ei.CHAR)),CC=()=>Fe.or(Vf(),wt.Before(_n.WHITESPACE).Build(),wt.After(_n.WHITESPACE,_n.HYPHEN).Build(),wt.Before(ei.CHAR,ei.CURRENCY).NotPrecededBy(_n.OPENING,ei.OPENING).Build(),wt.After(ei.CHAR).NotFollowedBy(_n.HYPHEN,_n.CLOSING,ei.CLOSING).Build(),wt.BeforeMany(ei.OPENING).NotPrecededBy(_n.OPENING).Build(),wt.AfterMany(ei.CLOSING).NotFollowedBy(_n.CLOSING).Build(),wt.AfterMany(_n.CLOSING).FollowedBy(_n.OPENING).Build()),IC=()=>Fe.group(Fe.or(pr.FLAG,Fe.and(pr.MOST,pr.JOINER,Fe.build(`(?:${pr.ZWJ.source}(?:${pr.FLAG.source}|${pr.ANY.source}${pr.JOINER.source}))*`)))),Fe={build:e=>new RegExp(e,"u"),join:(...e)=>e.map(t=>t.source).join(""),and:(...e)=>Fe.build(Fe.join(...e)),or:(...e)=>Fe.build(e.map(t=>t.source).join("|")),group:(...e)=>Fe.build(`(${Fe.join(...e)})`),class:(...e)=>Fe.build(`[${Fe.join(...e)}]`)},wt={On:(...e)=>{let t=Fe.join(...e);return Fe.build(`([${t}])`)},Before:(...e)=>{let t=Fe.join(...e),n=()=>Fe.build(`(?=[${t}])`);return wt.Chain(n)},After:(...e)=>{let t=Fe.join(...e),n=()=>Fe.build(`(?<=[${t}])`);return wt.Chain(n)},BeforeMany:(...e)=>{let t=Fe.join(...e),n=()=>Fe.build(`(?<![${t}])(?=[${t}])`);return wt.Chain(n)},AfterMany:(...e)=>{let t=Fe.join(...e),n=()=>Fe.build(`(?<=[${t}])(?![${t}])`);return wt.Chain(n)},NotBefore:(...e)=>{let t=Fe.join(...e),n=()=>Fe.build(`(?![${t}])`);return wt.Chain(n)},NotAfter:(...e)=>{let t=Fe.join(...e),n=()=>Fe.build(`(?<![${t}])`);return wt.Chain(n)},Chain:e=>({Build:e,PreceededBy:(...t)=>{let n=e(),a=wt.After(...t).Build(),i=()=>Fe.and(a,n);return wt.Chain(i)},FollowedBy:(...t)=>{let n=e(),a=wt.Before(...t).Build(),i=()=>Fe.and(n,a);return wt.Chain(i)},NotPrecededBy:(...t)=>{let n=e(),a=wt.NotAfter(...t).Build(),i=()=>Fe.and(a,n);return wt.Chain(i)},NotFollowedBy:(...t)=>{let n=e(),a=wt.NotBefore(...t).Build(),i=()=>Fe.and(n,a);return wt.Chain(i)}})},TC=e=>{let t=SC();return e.normalize("NFC").split(t).filter(Boolean)},is=(e,t,n)=>{if(!Number.isFinite(n)||n<0)return e;let a=[],i=e.split(`
|
|
|
|
|
|
|
|
`);for(let r of i){if(Vr(r,t)<=n){a.push(r);continue}let s=jC(r,t,n);a.push(...s)}return a.join(`
|
|
|
|
|
|
|
|
`)},jC=(e,t,n)=>{let a=[],i=TC(e)[Symbol.iterator](),r="",s=0,o=i.next();for(;!o.done;){let d=o.value,c=r+d,l=LC(d)?s+id.calculate(d,t):Vr(c,t);if(/\s/.test(d)||l<=n){r=c,s=l,o=i.next();continue}if(r)a.push(r.trimEnd()),r="",s=0;else{let h=_C(d,t,n),f=h[h.length-1]??"",p=h.slice(0,-1);a.push(...p),r=f,s=Vr(f,t),o=i.next()}}if(r){let d=AC(r,t,n);a.push(d)}return a},_C=(e,t,n)=>{if(Vf().test(e))return[e];DC(e);let a=[],i=Array.from(e),r="",s=0;for(let o of i){let d=id.calculate(o,t),c=s+d;if(c<=n){r=r+o,s=c;continue}r&&a.push(r),r=o,s=d}return r&&a.push(r),a},AC=(e,t,n)=>{if(!(Vr(e,t)>n))return e;let[,a,i]=e.match(/^(.+?)(\s+)$/)??[e,e.trimEnd(),""],r=Vr(a,t);for(let s of Array.from(i)){let o=id.calculate(s,t),d=r+o;if(d>n)break;a=a+s,r=d}return a},LC=e=>e.codePointAt(0)!==void 0&&e.codePointAt(1)===void 0,DC=e=>{if((be.MODE===yn.TEST||be.DEV)&&/\s/.test(e))throw new Error("Word should not contain any whitespaces!")},rn=class{};_(rn,"rg",new Mo),_(rn,"cache",new WeakMap),_(rn,"get",e=>rn.cache.get(e)),_(rn,"set",(e,t)=>rn.cache.set(e,t)),_(rn,"delete",e=>rn.cache.delete(e)),_(rn,"destroy",()=>{rn.cache=new WeakMap}),_(rn,"generateElementShape",(e,t)=>{let n=t?.isExporting?void 0:rn.get(e);if(n!==void 0)return n;E0.delete(e);let a=$D(e,rn.rg,t||{isExporting:!1,canvasBackgroundColor:Ee.white,embedsValidationStatus:null});return rn.cache.set(e,a),a});var ut=rn,ta=e=>"var(--icon-fill-color)",_8=e=>e===Me.LIGHT?Bt.white:"#1e1e1e",O=(e,t=512)=>{let{width:n=512,height:a=n,mirror:i,style:r,...s}=typeof t=="number"?{width:t}:t;return u.jsx("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${n} ${a}`,className:te({"rtl-mirror":i}),style:r,...s,children:typeof e=="string"?u.jsx("path",{fill:"currentColor",d:e}):e})},K={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},Ue={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"};O(u.jsxs("g",{strokeWidth:"1.5",children:[u.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u.jsx("rect",{x:3,y:8,width:18,height:4,rx:1}),u.jsx("line",{x1:12,y1:8,x2:12,y2:21}),u.jsx("path",{d:"M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7"}),u.jsx("path",{d:"M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5"})]}),K);var Gf=O(u.jsxs("g",{strokeWidth:"1.25",children:[u.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u.jsx("path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),u.jsx("path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),u.jsx("line",{x1:"3",y1:"6",x2:"3",y2:"19"}),u.jsx("line",{x1:"12",y1:"6",x2:"12",y2:"19"}),u.jsx("line",{x1:"21",y1:"6",x2:"21",y2:"19"})]}),K),RC=O(u.jsxs("svg",{strokeWidth:"1.5",children:[u.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),u.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),K),PC=O(u.jsxs("g",{strokeWidth:"1.5",children:[u.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u.jsx("circle",{cx:"12",cy:"12",r:"1"}),u.jsx("circle",{cx:"12",cy:"19",r:"1"}),u.jsx("circle",{cx:"12",cy:"5",r:"1"})]}),K),NC=O(u.jsxs("svg",{strokeWidth:"1.5",children:[u.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u.jsx("path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6"}),u.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"21"}),u.jsx("line",{x1:"8",y1:"4",x2:"16",y2:"4"})]}),K),Bh=O(u.jsxs("g",{children:[u.jsx("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("mask",{id:"UnlockedIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:6,y:1,width:9,height:9,children:u.jsx("path",{stroke:"none",d:"M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481",fill:"#fff"})}),u.jsx("g",{mask:"url(#UnlockedIcon)",children:u.jsx("path",{stroke:"none",d:"M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z",fill:"currentColor"})})]}),Ue),Yf=O(u.jsxs("g",{strokeWidth:"1.25",children:[u.jsx("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z"}),u.jsx("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z"}),u.jsx("path",{d:"M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916"})]}),Ue),OC=O(u.jsxs(u.Fragment
Line truncated
|
|
|
|
|
|
|
|
`).split(`
|
|
|
|
|
|
|
|
`),d=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,c=ad(e.fontSize,e.lineHeight),l=J8(e.fontFamily,e.fontSize,c);for(let h=0;h<o.length;h++)n.fillText(o[h],d,h*c+l);n.restore(),s&&n.canvas.remove()}else throw new Error(`Unimplemented type ${e.type}`)}},E0=new WeakMap,R2=(e,t,n,a)=>{let i=n?a.zoom:AD.zoom,r=E0.get(e),s=r&&r.zoomValue!==i.value&&!a?.shouldCacheIgnoreZoom,o=me(e,t),d=o?.version||null,c=Re(e)?e.crop:null,l=wn(e,t)?.opacity||100;if(!r||s||r.theme!==a.theme||r.boundTextElementVersion!==d||r.imageCrop!==c||r.containingFrameOpacity!==l||xe(e)&&o&&e.angle!==r.angle){let h=g7(e,t,i,n,a);return h?(E0.set(e,h),h):null}return r},s1=(e,t,n,a,i)=>{let r=e.element,s=Wh(r),o=e.scale,[d,c,l,h]=fe(r,i),f=((d+l)/2+a.scrollX)*window.devicePixelRatio,p=((c+h)/2+a.scrollY)*window.devicePixelRatio;t.save(),t.scale(1/window.devicePixelRatio,1/window.devicePixelRatio);let U=me(r,i);if(xe(r)&&U){let m=(e.boundTextCanvas.width-e.canvas.width)/2,g=(e.boundTextCanvas.height-e.canvas.height)/2;t.translate(f,p),t.drawImage(e.boundTextCanvas,-(l-d)/2*window.devicePixelRatio-m/o-s,-(h-c)/2*window.devicePixelRatio-g/o-s,e.boundTextCanvas.width/o,e.boundTextCanvas.height/o)}else t.translate(f,p),t.rotate(r.angle),"scale"in e.element&&!p7(r,n)&&t.scale(e.element.scale[0],e.element.scale[1]),t.translate(-f,-p),t.drawImage(e.canvas,(d+a.scrollX)*window.devicePixelRatio-s*e.scale/e.scale,(c+a.scrollY)*window.devicePixelRatio-s*e.scale/e.scale,e.canvas.width/e.scale,e.canvas.height/e.scale),be.VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX;t.restore()},PD=(e,t,n,a)=>{t.save(),t.translate(e.x+n.scrollX,e.y+n.scrollY),t.fillStyle="rgba(0, 0, 200, 0.04)";let i=.5/n.zoom.value;t.fillRect(i,i,e.width,e.height),t.lineWidth=1/n.zoom.value,t.strokeStyle=a,t.strokeRect(i,i,e.width,e.height),t.restore()},vr=(e,t,n,a,i,r,s)=>{let o=s.openDialog?.name==="elementLinkSelector"&&!s.selectedElementIds[e.id]&&!s.hoveredElementIds[e.id];switch(i.globalAlpha=m7(e,wn(e,t),r.elementsPendingErasure,r.pendingFlowchartNodes,o?o8:1),e.type){case"magicframe":case"frame":{s.frameRendering.enabled&&s.frameRendering.outline&&(i.save(),i.translate(e.x+s.scrollX,e.y+s.scrollY),i.fillStyle="rgba(0, 0, 200, 0.04)",i.lineWidth=ct.strokeWidth/s.zoom.value,i.strokeStyle=ct.strokeColor,lc(e)&&(i.strokeStyle=s.theme===Me.LIGHT?"#7affd7":"#1d8264"),i.roundRect?(i.beginPath(),i.roundRect(0,0,e.width,e.height,ct.radius/s.zoom.value),i.stroke(),i.closePath()):i.strokeRect(0,0,e.width,e.height),i.restore());break}case"freedraw":{if(ut.generateElementShape(e,null),r.isExporting){let[d,c,l,h]=fe(e,t),f=(d+l)/2+s.scrollX,p=(c+h)/2+s.scrollY,U=(l-d)/2-(e.x-d),m=(h-c)/2-(e.y-c);i.save(),i.translate(f,p),i.rotate(e.angle),i.translate(-U,-m),hc(e,a,i,r),i.restore()}else{let d=R2(e,n,r,s);if(!d)return;s1(d,i,r,s,n)}break}case"rectangle":case"diamond":case"ellipse":case"line":case"arrow":case"image":case"text":case"iframe":case"embeddable":{if(ut.generateElementShape(e,r),r.isExporting){let[d,c,l,h]=fe(e,t),f=(d+l)/2+s.scrollX,p=(c+h)/2+s.scrollY,U=(l-d)/2-(e.x-d),m=(h-c)/2-(e.y-c);if(q(e)){let b=Ht(e,t);if(xe(b)){let x=Q.getBoundTextElementPosition(b,e,t);U=(l-d)/2-(x.x-d),m=(h-c)/2-(x.y-c)}}i.save(),i.translate(f,p),U7(e,r,s)&&(i.filter="none");let g=me(e,t);if(xe(e)&&g){let b=document.createElement("canvas"),x=b.getContext("2d"),y=Math.max(Jt(d,l),Jt(c,h)),v=Wh(e);b.width=y*s.exportScale+v*10*s.exportScale,b.height=y*s.exportScale+v*10*s.exportScale,x.translate(b.width/2,b.height/2),x.scale(s.exportScale,s.exportScale),U=e.width/2-(e.x-d),m=e.height/2-(e.y-c),x.rotate(e.angle);let w=or.canvas(b);x.translate(-U,-m),hc(e,w,x,r),x.translate(U,m),x.rotate(-e.angle);let[,,,,S,C]=fe(g,t),I=(d+l)/2-S,j=(c+h)/2-C;x.translate(-I,-j),x.clearRect(-g.width/2,-g.height/2,g.width,g.height),i.scale(1/s.exportScale,1/s.exportScale),i.drawImage(b,-b.width/2,-b.height/2,b.width,b.height)}else i.rotate(e.angle),e.type==="image"&&i.scale(e.scale[0],e.scale[1]),i.translate(-U,-m),hc(e,a,i,r);i.restore()}else{let d=R2(e,n,r,s);if(!d)return;let c=i.imageSmoothingEnabled;if(!s?.shouldCacheIgnoreZoom&&(!e.angle||FM(e.angle))&&(i.imageSmoothingEnabled=!1),e.id===s.croppingElementId&&Re(d.element)&&d.element.crop!==null){i.save(),i.globalAlpha=.1;let l=g7(TD(d.element,t),n,s.zoom,r,s);l&&s1(l,i,r,s,n),i.restore()}s1(d,i,r,s,n),i.imageSmoothingEnabled=c}break}default:throw new Error(`Unimplemented type ${e.type}`)}i.globalAlpha=1},x7=new WeakMap([]);function ND(e){let t=np(e),n=new Path2D(t);return x7.set(e,n),n}function OD(e){return x7.get(e)}function np(e){let t=e.simulatePressure?e.points:e.points.length?e.points.map(([a,i],r)=>[a,i,e.pressures[r]]):[[0,0,.5]],n={simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:a=>Math.sin(a*Math.PI/2),last:!!e.lastCommittedPoint};return zD(FS(t,n))}function P2(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}var FD=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g;function zD(e){if(!e.length)retur
Line truncated
|
|
|
|
|
|
|
|
C ${d} ${c}, ${d} ${c}, ${d-U} ${c+m}
|
|
|
|
|
|
|
|
L ${l+U} ${h-m}
|
|
|
|
|
|
|
|
C ${l} ${h}, ${l} ${h}, ${l-U} ${h-m}
|
|
|
|
|
|
|
|
L ${f+U} ${p+m}
|
|
|
|
|
|
|
|
C ${f} ${p}, ${f} ${p}, ${f+U} ${p-m}
|
|
|
|
|
|
|
|
L ${s-U} ${o+m}
|
|
|
|
|
|
|
|
C ${s} ${o}, ${s} ${o}, ${s+U} ${o+m}`,Mn(e,!0))}else r=t.polygon([[s,o],[d,c],[l,h],[f,p]],Mn(e));return r}case"ellipse":return t.ellipse(e.width/2,e.height/2,e.width,e.height,Mn(e));case"line":case"arrow":{let r,s=Mn(e),o=e.points.length?e.points:[E(0,0)];if(J(e)?o.every(d=>Math.abs(d[0])<=1e6&&Math.abs(d[1])<=1e6)?r=[t.path(XD(o,16),Mn(e,!0))]:(console.error("Elbow arrow with extreme point positions detected. Arrow not rendered.",e.id,JSON.stringify(o)),r=[]):e.roundness?r=[t.curve(o,s)]:s.fill?r=[t.polygon(o,s)]:r=[t.linearPath(o,s)],e.type==="arrow"){let{startArrowhead:d=null,endArrowhead:c="arrow"}=e;if(d!==null){let l=B2(e,r,"start",d,t,s,a);r.push(...l)}if(c!==null){let l=B2(e,r,"end",c,t,s,a);r.push(...l)}}return r}case"freedraw":{let r;if(ND(e),Ji(e.points)){let s=WS(e.points,.75);r=t.curve(s,{...Mn(e),stroke:"none"})}else r=null;return r}case"frame":case"magicframe":case"text":case"image":return null;default:return Wr(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}},XD=(e,t)=>{let n=[];for(let i=1;i<e.length-1;i+=1){let r=e[i-1],s=e[i+1],o=e[i],d=si(o,r),c=si(s,o),l=Math.min(t,Pe(e[i],s)/2,Pe(e[i],r)/2);d?r[0]<o[0]?n.push([e[i][0]-l,e[i][1]]):n.push([e[i][0]+l,e[i][1]]):r[1]<o[1]?n.push([e[i][0],e[i][1]-l]):n.push([e[i][0],e[i][1]+l]),n.push(e[i]),c?s[0]<o[0]?n.push([e[i][0]-l,e[i][1]]):n.push([e[i][0]+l,e[i][1]]):s[1]<o[1]?n.push([e[i][0],e[i][1]-l]):n.push([e[i][0],e[i][1]+l])}let a=[`M ${e[0][0]} ${e[0][1]}`];for(let i=0;i<n.length;i+=3)a.push(`L ${n[i][0]} ${n[i][1]}`),a.push(`Q ${n[i+1][0]} ${n[i+1][1]}, ${n[i+2][0]} ${n[i+2][1]}`);return a.push(`L ${e[e.length-1][0]} ${e[e.length-1][1]}`),a.join(" ")},Qs=e=>{let t=e.map(a=>a[0]),n=e.map(a=>a[1]);return{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}},eh=(e,t,n,a)=>{let i=n.map(f=>f[e]),r=Math.max(...i),s=Math.min(...i),o=r-s,d=o===0?1:t/o,c=1/0,l=n.map(f=>{let p=f[e]*d,U=[...f];return U[e]=p,p<c&&(c=p),U});if(!a||l.length===2)return l;let h=s-c;return l.map(f=>f.map((p,U)=>U===e?p+h:p))},k7=class uc{static getBounds(t,n){let a=uc.boundsCache.get(t);if(a?.version&&a.version===t.version&&!at(t))return a.bounds;let i=uc.calculateBounds(t,n);return uc.boundsCache.set(t,{version:t.version,bounds:i}),i}static calculateBounds(t,n){let a,[i,r,s,o,d,c]=fe(t,n);if(Hn(t)){let[l,h,f,p]=ap(t.points.map(([U,m])=>H(E(U,m),E(d-t.x,c-t.y),t.angle)));return[l+t.x,h+t.y,f+t.x,p+t.y]}else if(he(t))a=qD(t,d,c,n);else if(t.type==="diamond"){let[l,h]=H(E(d,r),E(d,c),t.angle),[f,p]=H(E(d,o),E(d,c),t.angle),[U,m]=H(E(i,c),E(d,c),t.angle),[g,b]=H(E(s,c),E(d,c),t.angle),x=Math.min(l,f,U,g),y=Math.min(h,p,m,b),v=Math.max(l,f,U,g),w=Math.max(h,p,m,b);a=[x,y,v,w]}else if(t.type==="ellipse"){let l=(s-i)/2,h=(o-r)/2,f=Math.cos(t.angle),p=Math.sin(t.angle),U=Math.hypot(l*f,h*p),m=Math.hypot(h*f,l*p);a=[d-U,c-m,d+U,c+m]}else{let[l,h]=H(E(i,r),E(d,c),t.angle),[f,p]=H(E(i,o),E(d,c),t.angle),[U,m]=H(E(s,o),E(d,c),t.angle),[g,b]=H(E(s,r),E(d,c),t.angle),x=Math.min(l,f,U,g),y=Math.min(h,p,m,b),v=Math.max(l,f,U,g),w=Math.max(h,p,m,b);a=[x,y,v,w]}return a}};_(k7,"boundsCache",new WeakMap);var WD=k7,fe=(e,t,n=!1)=>{if(Hn(e))return GD(e);if(he(e))return Q.getElementAbsoluteCoords(e,t,n);if(q(e)){let a=t?Ht(e,t):null;if(xe(a)){let{x:i,y:r}=Q.getBoundTextElementPosition(a,e,t);return[i,r,i+e.width,r+e.height,i+e.width/2,r+e.height/2]}}return[e.x,e.y,e.x+e.width,e.y+e.height,e.x+e.width/2,e.y+e.height/2]},H2=(e,t)=>{let[n,a,i,r,s,o]=fe(e,t),d=E(s,o);if(he(e)||Hn(e)){let b=[],x=0;for(;x<e.points.length-1;)b.push(re(H(E(e.points[x][0]+e.x,e.points[x][1]+e.y),d,e.angle),H(E(e.points[x+1][0]+e.x,e.points[x+1][1]+e.y),d,e.angle))),x++;return b}let[c,l,h,f,p,U,m,g]=[[n,a],[i,a],[n,r],[i,r],[s,a],[s,r],[n,o],[i,o]].map(b=>H(b,d,e.angle));return e.type==="diamond"?[re(p,m),re(p,g),re(U,m),re(U,g)]:e.type==="ellipse"?[re(p,m),re(p,g),re(U,m),re(U,g),re(p,m),re(p,g),re(U,m),re(U,g)]:[re(c,l),re(h,f),re(c,h),re(l,f),re(c,g),re(h,g),re(l,m),re(f,m)]},S7=e=>{let t=Math.floor(e.width/2)+1,n=0,a=e.width,i=Math.floor(e.height/2)+1,r=t,s=e.height;return[t,n,a,i,r,s,0,i]},$2=(e,t,n,a,i)=>{let r=1-e;return Math.pow(r,3)*t+3*Math.pow(r,2)*e*n+3*r*Math.pow(e,2)*a+Math.pow(e,3)*i},X2=(e,t,n,a)=>{let i=t-e,r=n-t,s=a-n,o=3*i-6*r+3*s,d=6*r-6*i,c=3*i,l=d*d-4*o*c;if(!(l>=0))return!1;let h=null,f=null,p=1/0,U=1/0;return o===0?p=U=-c/d:(p=(-d+Math.sqrt(l))/(2*o),U=(-d-Math.sqrt(l))/(2*o)),p>=0&&p<=1&&(h=$2(p,e,t,n,a)),U>=0&&U<=1&&(f=$2(U,e,t,n,a)),[h,f]},VD=(e,t,n,a)=>{let i=X2(e[0],t[0],n[0],a[0]),r=X2(e[1],t[1],n[1],a[1]),s=Math.min(e[0],a[0]),o=Math.max(e[0],a[0]);if(i){let l=i.filter(h=>h!==null);s=Math.min(s,...l),o=Math.max(o,...l)}let d=Math.min(e[1],a[1]),c=Math.max(e[1],a[1]);if(r){let l=r.filter(h=>h!==null);d=Math.min(d,...l),c=Math.max(c,...l)}return[s,d,o,c]},Vh=(e,t)=>{let n=E(0,0),{minX:a,minY:i,maxX:r,maxY:s}=e.reduce((o,{op:d,data:c})=>{if(d==="move"){let l=zf(c);nn(l!=null,"Op data is not a point"),n=l}else if(d==="bcurveTo"){let l=E(c[0],c[
Line truncated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`)=>e.reduce((n,a)=>(q(a)&&n.push(a.text),n),[]).join(t),vn=e=>(e=e.trim(),e&&YS.sanitizeUrl(sc(e))),W7=e=>!!(e?.includes(location.origin)||e?.startsWith("/")),dp=e=>{if(e=vn(e),e.startsWith("/"))return`${location.origin}${e}`;try{new URL(e)}catch{return"about:blank"}return e},I0=[],Y=e=>(I0=I0.concat(e),e),V7='<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">',QR='<path d="M6.164 11.755a5.314 5.314 0 0 1-4.932-5.298 5.314 5.314 0 0 1 5.311-5.311 5.314 5.314 0 0 1 5.307 5.113l8.773 8.773a3.322 3.322 0 0 1 0 4.696l-.895.895a3.322 3.322 0 0 1-4.696 0l-8.868-8.868Z" style="fill:#fff"/>',G7='<path stroke="#1b1b1f" fill="#fff" d="m7.868 11.113 7.773 7.774a2.359 2.359 0 0 0 1.667.691 2.368 2.368 0 0 0 2.357-2.358c0-.625-.248-1.225-.69-1.667L11.201 7.78 9.558 9.469l-1.69 1.643v.001Zm10.273 3.606-3.333 3.333m-3.25-6.583 2 2m-7-7 3 3M3.664 3.625l1 1M2.529 6.922l1.407-.144m5.735-2.932-1.118.866M4.285 9.823l.758-1.194m1.863-6.207-.13 1.408"/>',JR=`data:${ae.svg},${encodeURIComponent(`${V7}${G7}</svg>`)}`,eP=`data:${ae.svg},${encodeURIComponent(`${V7}${QR}${G7}</svg>`)}`,Kn=e=>{e&&(e.style.cursor="")},$e=(e,t)=>{e&&(e.style.cursor=t)},wa,eg,Y7=(e,t)=>{let n=()=>{let a=t===Me.DARK;wa=document.createElement("canvas"),wa.theme=t,wa.height=20,wa.width=20;let i=wa.getContext("2d");i.lineWidth=1,i.beginPath(),i.arc(wa.width/2,wa.height/2,5,0,2*Math.PI),i.fillStyle=a?Bt.black:Bt.white,i.fill(),i.strokeStyle=a?Bt.white:Bt.black,i.stroke(),eg=wa.toDataURL(ae.svg)};(!wa||wa.theme!==t)&&n(),$e(e,`url(${eg}) ${20/2} ${20/2}, auto`)},Ma=(e,t)=>{if(e)if(t.activeTool.type==="selection")Kn(e);else if(Vs(t))e.style.cursor=ze.GRAB;else if(Ca(t))Y7(e,t.theme);else if(t.activeTool.type==="laser"){let n=t.theme===Me.LIGHT?JR:eP;e.style.cursor=`url(${n}), auto`}else["image","custom"].includes(t.activeTool.type)?t.activeTool.type!=="image"&&(e.style.cursor=ze.AUTO):e.style.cursor=ze.CROSSHAIR},tP=new Nb(Date.now()),nP=0,Ha=()=>Math.floor(tP.next()*2**31),Xn=()=>fi()?`id${nP++}`:_f(),ma=(e,{x:t,y:n,strokeColor:a=pt.strokeColor,backgroundColor:i=pt.backgroundColor,fillStyle:r=pt.fillStyle,strokeWidth:s=pt.strokeWidth,strokeStyle:o=pt.strokeStyle,roughness:d=pt.roughness,opacity:c=pt.opacity,width:l=0,height:h=0,angle:f=0,groupIds:p=[],frameId:U=null,index:m=null,roundness:g=null,boundElements:b=null,link:x=null,locked:y=pt.locked,...v})=>((t<-1e6||t>1e6||n<-1e6||n>1e6||l<-1e6||l>1e6||h<-1e6||h>1e6)&&console.error("New element size or position is too large",{x:t,y:n,width:l,height:h,points:v.points}),{id:v.id||Xn(),type:e,x:t,y:n,width:l,height:h,angle:f,strokeColor:a,backgroundColor:i,fillStyle:r,strokeWidth:s,strokeStyle:o,roughness:d,opacity:c,groupIds:p,frameId:U,index:m,roundness:g,seed:v.seed??Ha(),version:v.version||1,versionNonce:v.versionNonce??0,isDeleted:!1,boundElements:b,updated:cl(),link:x,locked:y,customData:v.customData}),$a=e=>ma(e.type,e),tg=e=>ma("embeddable",e),aP=e=>({...ma("iframe",e)}),cp=e=>pe({...ma("frame",e),type:"frame",name:e?.name||null},{}),T0=e=>pe({...ma("magicframe",e),type:"magicframe",name:e?.name||null},{}),Z7=(e,t)=>({x:e.textAlign==="center"?t.width/2:e.textAlign==="right"?t.width:0,y:e.verticalAlign==="middle"?t.height/2:0}),jn=e=>{let t=e.fontFamily||dr,n=e.fontSize||Ei,a=e.lineHeight||Zr(t),i=Zs(e.text),r=an(i,Xe({fontFamily:t,fontSize:n}),a),s=e.textAlign||Jo,o=e.verticalAlign||Nc,d=Z7({textAlign:s,verticalAlign:o},r),c={...ma("text",e),text:i,fontSize:n,fontFamily:t,textAlign:s,verticalAlign:o,x:e.x-d.x,y:e.y-d.y,width:r.width,height:r.height,containerId:e.containerId||null,originalText:e.originalText??i,autoResize:e.autoResize??!0,lineHeight:a};return pe(c,{})},iP=(e,t,n)=>{let{width:a,height:i}=an(n,Xe(e),e.lineHeight);e.autoResize||(a=e.width);let{textAlign:r,verticalAlign:s}=e,o,d;if(r==="center"&&s===In.MIDDLE&&!e.containerId&&e.autoResize){let c=an(e.text,Xe(e),e.lineHeight),l=Z7(e,{width:a-c.width,height:i-c.height});o=e.x-l.x,d=e.y-l.y}else{let[c,l,h,f]=fe(e,t),[p,U,m,g]=Yi(e,a,i,!1),b=(c-p)/2,x=(l-U)/2,y=(h-m)/2,v=(f-g)/2;[o,d]=rP({s:!0,e:r==="center"||r==="left",w:r==="center"||r==="right"},e.x,e.y,e.angle,b,x,y,v)}return{width:a,height:i,x:Number.isFinite(o)?o:e.x,y:Number.isFinite(d)?d:e.y}},rP=(e,t,n,a,i,r,s,o)=>{let d=Math.cos(a),c=Math.sin(a);return e.e&&e.w?t+=i+s:e.e?(t+=i*(1+d),n+=i*c,t+=s*(1-d),n+=s*-c):e.w&&(t+=i*(1-d),n+=i*-c,t+=s*(1+d),n+=s*c),e.n&&e.s?n+=r+o:e.n?(t+=r*c,n+=r*(1-d),t+=o*-c,n+=o*(1+d)):(t+=r*-c,n+=r*(1+d),t+=o*c,n+=o*(1-d)),[t,n]},K7=(e,t,n,a=e.text)=>{if(e.isDeleted)return;(t||!e.autoResize)&&(a=is(a,Xe(e),t?mi(t,e):e.width));let i=iP(e,n,a);return{text:a,...i}},sP=e=>({...ma(e.type,e),points:e.points||[],pressures:e.pressures||[],simulatePressure:e.simulatePressure,lastCommittedPoint:null}),Pr=e=>({...ma(e.type,e),points:e.points||[],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:null,endArrowhead:null}),hp=e=>e.elbowed?{...ma(e.type,e),points:e.points||[],lastCommittedPoint:null,start
Line truncated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`),d.stack,e.map(l=>s(l)),...c),t)throw d}},t3=e=>e.sort((t,n)=>ng(t)&&ng(n)?t.index<n.index?-1:t.index>n.index?1:t.id<n.id?-1:1:1),Xa=(e,t)=>{try{let n=lP(e,t),a=n3(e,n),i=e.map(r=>a.has(r)?{...r,...a.get(r)}:r);up(i,{includeBoundTextValidation:!1,shouldThrow:!0,ignoreLogs:!0});for(let[r,s]of a)W(r,s,!1)}catch{Wa(e)}return e},Wa=e=>{let t=oP(e),n=n3(e,t);for(let[a,i]of n)W(a,i,!1);return e},lP=(e,t)=>{let n=[],a=0;for(;a<e.length;)if(t.has(e[a].id)){let i=[a-1,a];for(;++a<e.length&&t.has(e[a].id);)i.push(a);i.push(a),n.push(i)}else a++;return n},oP=e=>{let t=[],n,a,i=-1,r=0,s=c=>{let l=e[i]?e[i].index:void 0,h=e[c-1]?.index;return!l&&h||l&&h&&h>l?[h,c-1]:[l,i]},o=c=>{let l=e[r]?e[r].index:void 0;if(l&&c<r)return[l,r];let h=r;for(;++h<e.length;){let f=e[h]?.index;if(!l&&f||l&&f&&f>l)return[f,h]}return[void 0,h]},d=0;for(;d<e.length;){let c=e[d].index;if([n,i]=s(d),[a,r]=o(d),j0(c,n,a))d++;else{let l=[i,d];for(;++d<e.length;){let h=e[d].index,[f,p]=s(d),[U,m]=o(d);if(j0(h,f,U))break;[n,i]=[f,p],[a,r]=[U,m],l.push(d)}l.push(r),t.push(l)}}return t},j0=(e,t,n)=>e?t&&n?t<e&&e<n:!t&&n?e<n:t&&!n?t<e:!!e:!1,n3=(e,t)=>{let n=new Map;for(let a of t){let i=a.shift(),r=a.pop(),s=o0(e[i]?.index,e[r]?.index,a.length);for(let o=0;o<a.length;o++){let d=e[a[o]];n.set(d,{index:s[o]})}}return n},ng=e=>!!e.index,Et=class Sa{constructor(t,n){this.deleted=t,this.inserted=n}static create(t,n,a,i){let r=a&&i!=="inserted"?a(t):t,s=a&&i!=="deleted"?a(n):n;return new Sa(r,s)}static calculate(t,n,a,i){if(t===n)return Sa.empty();let r={},s={};for(let c of this.distinctKeysIterator("full",t,n))r[c]=t[c],s[c]=n[c];let[o,d]=i?i(r,s):[r,s];return Sa.create(o,d,a)}static empty(){return new Sa({},{})}static isEmpty(t){return!Object.keys(t.deleted).length&&!Object.keys(t.inserted).length}static mergeObjects(t,n,a){let i={...t};for(let r of Object.keys(a))delete i[r];return{...i,...n}}static mergeArrays(t,n,a,i){return Object.values(Sa.mergeObjects(qa(t??[],i),qa(n??[],i),qa(a??[],i)))}static diffObjects(t,n,a,i){if(!(!t[a]&&!n[a])&&(typeof t[a]=="object"||typeof n[a]=="object")){let r=t[a]??{},s=n[a]??{},o=Sa.getLeftDifferences(r,s).reduce((c,l)=>(c[l]=i(r[l]),c),{}),d=Sa.getRightDifferences(r,s).reduce((c,l)=>(c[l]=i(s[l]),c),{});Object.keys(o).length||Object.keys(d).length?(Reflect.set(t,a,o),Reflect.set(n,a,d)):(Reflect.deleteProperty(t,a),Reflect.deleteProperty(n,a))}}static diffArrays(t,n,a,i){if(!(!t[a]&&!n[a])&&(Array.isArray(t[a])||Array.isArray(n[a]))){let r=Array.isArray(t[a])?t[a]:[],s=Array.isArray(n[a])?n[a]:[],o=qa(Sa.getLeftDifferences(qa(r,i),qa(s,i))),d=qa(Sa.getRightDifferences(qa(r,i),qa(s,i)));if(Object.keys(o).length||Object.keys(d).length){let c=r.filter(h=>o[i?i(h):String(h)]),l=s.filter(h=>d[i?i(h):String(h)]);Reflect.set(t,a,c),Reflect.set(n,a,l)}else Reflect.deleteProperty(t,a),Reflect.deleteProperty(n,a)}}static isLeftDifferent(t,n,a=!1){return!!this.distinctKeysIterator("left",t,n,a).next().value}static isRightDifferent(t,n,a=!1){return!!this.distinctKeysIterator("right",t,n,a).next().value}static getLeftDifferences(t,n,a=!1){return Array.from(this.distinctKeysIterator("left",t,n,a))}static getRightDifferences(t,n,a=!1){return Array.from(this.distinctKeysIterator("right",t,n,a))}static*distinctKeysIterator(t,n,a,i=!1){if(n===a)return;let r=[];t==="left"?r=Object.keys(n):t==="right"?r=Object.keys(a):t==="full"?r=Array.from(new Set([...Object.keys(n),...Object.keys(a)])):Wr(t,`Unknown distinctKeysIterator's join param "${t}"`,!0);for(let s of r){let o=n[s],d=a[s];if(o!==d){if(!i&&typeof o=="object"&&typeof d=="object"&&o!==null&&d!==null&&Yt(o,d))continue;yield s}}}},ag=class pn{constructor(t){this.delta=t}static calculate(t,n){let a=Et.calculate(t,n,void 0,pn.postProcess);return new pn(a)}static empty(){return new pn(Et.create({},{}))}inverse(){let t=Et.create(this.delta.inserted,this.delta.deleted);return new pn(t)}applyTo(t,n){try{let{selectedElementIds:a={},selectedGroupIds:i={}}=this.delta.deleted,{selectedElementIds:r={},selectedGroupIds:s={},selectedLinearElementId:o,editingLinearElementId:d,...c}=this.delta.inserted,l=Et.mergeObjects(t.selectedElementIds,r,a),h=Et.mergeObjects(t.selectedGroupIds,s,i),f=o&&n.has(o)?new Q(n.get(o)):null,p=d&&n.has(d)?new Q(n.get(d)):null,U={...t,...c,selectedElementIds:l,selectedGroupIds:h,selectedLinearElement:typeof o<"u"?f:t.selectedLinearElement,editingLinearElement:typeof d<"u"?p:t.editingLinearElement},m=this.filterInvisibleChanges(t,U,n);return[U,m]}catch(a){if(console.error("Couldn't apply appstate change",a),be.DEV||be.MODE===yn.TEST)throw a;return[t,!1]}}isEmpty(){return Et.isEmpty(this.delta)}static postProcess(t,n){try{Et.diffObjects(t,n,"selectedElementIds",a=>!0),Et.diffObjects(t,n,"selectedGroupIds",a=>a??!1)}catch(a){if(console.error("Couldn't postprocess appstate change deltas."),be.DEV||be.MODE===yn.TEST)throw a}finally{return[t,n]}}filterInvisibleChanges(t,n,a){let i=sh(t),r=sh(n),s=Et.isRightDifferent(pn.stripElementsProps(i),pn.stripElementsProps(r)),o=Et.Line truncated
|
|
|
|
|
|
|
|
<script src="${l}.js"><\/script>
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
|
|
|
* { margin: 0px; }
|
|
|
|
|
|
|
|
table, .gist { height: 100%; }
|
|
|
|
|
|
|
|
.gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
`),intrinsicSize:{w:550,h:720},sandbox:{allowSameOrigin:n}};return Ea.set(e,h),h}return Ea.set(e,{link:e,intrinsicSize:i,type:a,sandbox:{allowSameOrigin:n}}),{link:e,intrinsicSize:i,type:a,sandbox:{allowSameOrigin:n}}},i3=e=>{let t;Pi(e)?t="IFrame element":t=!e.link||e?.link===""?"Empty Web-Embed":e.link;let n=Math.max(Math.min(e.width/2,e.width/t.length),e.width/30),a=rt.Helvetica,i=Xe({fontSize:n,fontFamily:a});return jn({x:e.x+e.width/2,y:e.y+e.height/2,strokeColor:e.strokeColor!=="transparent"?e.strokeColor:"black",backgroundColor:"transparent",fontFamily:a,fontSize:n,text:is(t,i,e.width-20),textAlign:"center",verticalAlign:In.MIDDLE,angle:e.angle??0})};Y({name:"setEmbeddableAsActiveTool",trackEvent:{category:"toolbar"},target:"Tool",label:"toolBar.embeddable",perform:(e,t,n,a)=>{let i=kt(t,{type:"embeddable"});return Ma(a.canvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:kt(t,{type:"embeddable"})},captureUpdate:$.EVENTUALLY}}});var L0=(e,t)=>{try{let{hostname:n}=new URL(e),a=n.replace(/^www\./,"");if(t instanceof Set){if(A0.has(a))return a;let r=a.replace(/^([^.]+)/,"*");return A0.has(r)?r:null}let i=t.replace(/^www\./,"");if(a===i)return i}catch{}return null},xP=e=>{let t=e.match(mP);if(t&&t.length===2)return t[1];let n=e.match(yP);if(n&&n.length===2)return n[1];let a=e.match(UP);if(a&&a.length===2)return a[1];if(og.test(e))return`https://giphy.com/embed/${og.exec(e)[1]}`;let i=e.match(bP);return i&&i.length===2?i[1]:e},pc=(e,t)=>{if(!e)return!1;if(t!=null)if(typeof t=="function"){let n=t(e);if(typeof n=="boolean")return n}else{if(typeof t=="boolean")return t;if(t instanceof RegExp)return t.test(e);if(Array.isArray(t)){for(let n of t)if(n instanceof RegExp){if(e.match(n))return!0}else if(L0(e,n))return!0;return!1}}return!!L0(e,A0)},jl=(e,t,n)=>{let a={sets:t.sets,shape:t.shape,options:{...t.options,fixedDecimalPlaceDigits:n}};return e.draw(a)},_l=(e,t,n,a,i)=>{if(!a.enabled||!a.clip)return null;let r=wn(e,i);if(r){let s=t.ownerDocument.createElementNS(je,"g");return s.setAttributeNS(je,"clip-path",`url(#${r.id})`),n.forEach(o=>s.appendChild(o)),s}return null},Uc=(e,t,n,a,i,r,s,o)=>{let d={x:r,y:s},[c,l,h,f]=fe(e,t),p=(h-c)/2-(e.x-c),U=(f-l)/2-(e.y-l);if(q(e)){let y=Ht(e,t);if(xe(y)){let[v,w,S,C]=fe(y,t),I=Q.getBoundTextElementPosition(y,e,t);p=(S-v)/2-(I.x-v),U=(C-w)/2-(I.y-w),r=r+I.x-e.x,s=s+I.y-e.y}}let m=180*e.angle/Math.PI,g=a;if(e.link){let y=a.ownerDocument.createElementNS(je,"a");y.setAttribute("href",vn(e.link)),g.appendChild(y),g=y}let b=(y,v)=>{fi()&&y.setAttribute("data-id",v.id),g.appendChild(y)},x=(wn(e,t)?.opacity??100)*e.opacity/1e4;switch(e.type){case"selection":throw new Error("Selection rendering is not supported for SVG");case"rectangle":case"diamond":case"ellipse":{let y=ut.generateElementShape(e,null),v=jl(n,y,Cl);x!==1&&(v.setAttribute("stroke-opacity",`${x}`),v.setAttribute("fill-opacity",`${x}`)),v.setAttribute("stroke-linecap","round"),v.setAttribute("transform",`translate(${r||0} ${s||0}) rotate(${m} ${p} ${U})`);let w=_l(e,g,[v],o.frameRendering,t);b(w||v,e);break}case"iframe":case"embeddable":{let y=ut.generateElementShape(e,o),v=jl(n,y,Cl),w=e.opacity/100;w!==1&&(v.setAttribute("stroke-opacity",`${w}`),v.setAttribute("fill-opacity",`${w}`)),v.setAttribute("stroke-linecap","round"),v.setAttribute("transform",`translate(${r||0} ${s||0}) rotate(${m} ${p} ${U})`),b(v,e);let S=i3(e);Uc(S,t,n,g,i,S.x+d.x-e.x,S.y+d.y-e.y,o);let C=jl(n,y,Cl);for(C.setAttribute("stroke-linecap","round"),C.setAttribute("transform",`translate(${r||0} ${s||0}) rotate(${m} ${p} ${U})`);C.firstChild;)C.removeChild(C.firstChild);let I=da(Math.min(e.width,e.height),e),j=_s(dp(e.link||""));if(o.renderEmbeddables===!1||j?.type==="document"){let T=a.ownerDocument.createElementNS(je,"a");T.setAttribute("href",vn(e.link||"")),T.setAttribute("target","_blank"),T.setAttribute("rel","noopener noreferrer"),T.style.borderRadius=`${I}px`,C.appendChild(T)}else{let T=a.ownerDocument.createElementNS(je,"foreignObject");T.style.width=`${e.width}px`,T.style.height=`${e.height}px`,T.style.border="none";let A=T.ownerDocument.createElementNS(je,"div");A.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),A.style.width="100%",A.style.height="100%";let D=A.ownerDocument.createElement("iframe");D.src=j?.link??"",D.style.width="100%",D.style.height="100%",D.style.border="none",D.style.borderRadius=`${I}px`,D.style.top="0",D.style.left="0",D.allowFullscreen=!0,A.appendChild(D),T.appendChild(A),C.appendChild(T)}b(C,e);break}case"line":case"arrow":{let y=me(e,t),v=a.ownerDocument.createElementNS(je,"mask");if(y){v.setAttribute("id",`mask-${e.id}`);let C=a.ownerDocument.createElementNS(je,"rect");r=r||0,s=s||0,C.setAttribute("x","0"),C.setAttribute("y","0"),C.setAttribute("fill","#fff"),C.setAttribute("width",`${e.width+100+r}`),C.setAttribute("height",`${e.height+100+s}`),v.appendChild(C);let I=a.ownerDocument.createElementNS(je,"rect"),j=Q.getBoundTextElementPosition(e,y,t),T=r+j.x-e.x,A=s+j.y-e.y;I.setA
Line truncated
|
|
|
|
|
|
|
|
`).split(`
|
|
|
|
|
|
|
|
`),w=ad(e.fontSize,e.lineHeight),S=e.textAlign==="center"?e.width/2:e.textAlign==="right"?e.width:0,C=J8(e.fontFamily,e.fontSize,w),I=m8(e.text)?"rtl":"ltr",j=e.textAlign==="center"?"middle":e.textAlign==="right"||I==="rtl"?"end":"start";for(let A=0;A<v.length;A++){let D=a.ownerDocument.createElementNS(je,"text");D.textContent=v[A],D.setAttribute("x",`${S}`),D.setAttribute("y",`${A*w+C}`),D.setAttribute("font-family",Gs(e)),D.setAttribute("font-size",`${e.fontSize}px`),D.setAttribute("fill",e.strokeColor),D.setAttribute("text-anchor",j),D.setAttribute("style","white-space: pre;"),D.setAttribute("direction",I),D.setAttribute("dominant-baseline","alphabetic"),y.appendChild(D)}let T=_l(e,g,[y],o.frameRendering,t);b(T||y,e)}else throw new Error(`Unimplemented type ${e.type}`)}},vP=(e,t,n,a,i,r)=>{a&&(e.filter(s=>!Pn(s)).forEach(s=>{if(!s.isDeleted){if(q(s)&&s.containerId&&t.has(s.containerId))return;try{Uc(s,t,n,a,i,s.x+r.offsetX,s.y+r.offsetY,r);let o=me(s,t);o&&Uc(o,t,n,a,i,o.x+r.offsetX,o.y+r.offsetY,r)}catch(o){console.error(o)}}}),e.filter(s=>Pn(s)).forEach(s=>{if(!s.isDeleted)try{Uc(s,t,n,a,i,s.x+r.offsetX,s.y+r.offsetY,r)}catch(o){console.error(o)}}))},hg=500,fp=e=>{let t=e.extensions?.reduce((a,i)=>(a.push(ae[i]),a),[]),n=e.extensions?.reduce((a,i)=>i==="jpg"?a.concat(".jpg",".jpeg"):a.concat(`.${i}`),[]);return qS({description:e.description,extensions:n,mimeTypes:t,multiple:e.multiple??!1,legacySetup:(a,i,r)=>{let s=Ys(i,hg),o=()=>{d(),document.addEventListener("keyup",s),document.addEventListener("pointerup",s),s()},d=()=>{if(r.files?.length){let l=e.multiple?[...r.files]:r.files[0];a(l)}};requestAnimationFrame(()=>{window.addEventListener("focus",o)});let c=window.setInterval(()=>{d()},hg);return l=>{clearInterval(c),s.cancel(),window.removeEventListener("focus",o),document.removeEventListener("keyup",s),document.removeEventListener("pointerup",s),l&&(console.warn("Opening the file was canceled (legacy-fs)."),l(new Xh))}}})},lh=(e,t)=>JS(e,{fileName:`${t.name}.${t.extension}`,description:t.description,extensions:[`.${t.extension}`],mimeTypes:t.mimeTypes},t.fileHandle),wP=(e,t)=>{let n={};for(let a of e)!a.isDeleted&&"fileId"in a&&a.fileId&&t[a.fileId]&&(n[a.fileId]=t[a.fileId]);return n},ld=(e,t,n,a)=>{let i={type:Fn.excalidraw,version:Nh.excalidraw,source:Rf,elements:a==="local"?K3(e):GN(e),appState:a==="local"?h8(t):NM(t),files:a==="local"?wP(e,n):void 0};return JSON.stringify(i,null,2)},r3=async(e,t,n,a=t.name||l8)=>{let i=ld(e,t,n,"local"),r=new Blob([i],{type:ae.excalidraw});return{fileHandle:await lh(r,{name:a,extension:"excalidraw",description:"Excalidraw file",fileHandle:Hp(t.fileHandle)?null:t.fileHandle})}},EP=async(e,t)=>{let n=await fp({description:"Excalidraw files"});return Xp(await Wp(n),e,t,n.handle)},kP=e=>e?.type===Fn.excalidraw&&(!e.elements||Array.isArray(e.elements)&&(!e.appState||typeof e.appState=="object")),s3=e=>typeof e=="object"&&e&&e.type===Fn.excalidrawLibrary&&(e.version===1||e.version===2),pp=e=>{let t={type:Fn.excalidrawLibrary,version:Nh.excalidrawLibrary,source:Rf,libraryItems:e};return JSON.stringify(t,null,2)},SP=async e=>{let t=pp(e);await lh(new Blob([t],{type:ae.excalidrawlib}),{name:"library",extension:"excalidrawlib",description:"Excalidraw library file"})},l3=e=>new Promise((t,n)=>{let a=new Image;a.onload=()=>{t(a)},a.onerror=i=>{n(i)},a.src=e}),o3=async({fileIds:e,files:t,imageCache:n})=>{let a=new Map,i=new Map;return await Promise.all(e.reduce((r,s)=>{let o=t[s];return o&&!a.has(s)?(a.set(s,!0),r.concat((async()=>{try{if(o.mimeType===ae.binary)throw new Error("Only images can be added to ImageCache");let d=l3(o.dataURL),c={image:d,mimeType:o.mimeType};n.set(s,c);let l=await d;n.set(s,{...c,image:l})}catch{i.set(s,!0)}})())):r},[])),{imageCache:n,updatedFiles:a,erroredFiles:i}},d3=e=>e.filter(t=>Rn(t)),MP=e=>e?.nodeName.toLowerCase()==="svg",ug=e=>{let t=new DOMParser().parseFromString(e,ae.svg),n=t.querySelector("svg");if(t.querySelector("parsererror")||!MP(n))throw new Error("Invalid SVG");{n.hasAttribute("xmlns")||n.setAttribute("xmlns",je);let a=n.getAttribute("width"),i=n.getAttribute("height");(a?.includes("%")||a==="auto")&&(a=null),(i?.includes("%")||i==="auto")&&(i=null);let r=n.getAttribute("viewBox");if(!a||!i){if(a=a||"50",i=i||"50",r){let s=r.match(/\d+ +\d+ +(\d+(?:\.\d+)?) +(\d+(?:\.\d+)?)/);s&&([,a,i]=s)}n.setAttribute("width",a),n.setAttribute("height",i)}return r||n.setAttribute("viewBox",`0 0 ${a} ${i}`),n.outerHTML}},c3=document.createElement("img");c3.src=`data:${ae.svg}, ${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#1971c2" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>')}`;var h3=document.createElement("img");h3.src=`data:${ae.svg},
Line truncated
|
|
|
|
|
|
|
|
`,I=x.ownerDocument.createElementNS(je,"style");if(I.classList.add("style-fonts"),I.appendChild(document.createTextNode(`${C}${S.join(C)}`)),y.appendChild(I),t.exportBackground&&o){let A=x.ownerDocument.createElementNS(je,"rect");A.setAttribute("x","0"),A.setAttribute("y","0"),A.setAttribute("width",`${U}`),A.setAttribute("height",`${m}`),A.setAttribute("fill",o),x.appendChild(A)}let j=or.svg(x),T=a?.renderEmbeddables??!1;return vP(h,Bn(oe(h)),j,x,n||{},{offsetX:g,offsetY:b,isExporting:!0,exportWithDarkMode:s,renderEmbeddables:T,frameRendering:i,canvasBackgroundColor:o,embedsValidationStatus:T?new Map(h.filter(A=>de(A)).map(A=>[A.id,!0])):new Map,reuseImages:a?.reuseImages??!0}),x},_P=({payload:e,metadataElement:t})=>{let n=i4(JSON.stringify(s4({text:e})),!0);t.appendChild(Vl(`payload-type:${ae.excalidraw}`)),t.appendChild(Vl("payload-version:2")),t.appendChild(Vl("payload-start")),t.appendChild(document.createTextNode(n)),t.appendChild(Vl("payload-end"))},AP=({svg:e})=>{if(e.includes(`payload-type:${ae.excalidraw}`)){let t=e.match(/<!-- payload-start -->\s*(.+?)\s*<!-- payload-end -->/);if(!t)throw new Error("INVALID");let n=(e.match(/<!-- payload-version:(\d+) -->/)?.[1]||"1")!=="1";try{let a=r4(t[1],n),i=JSON.parse(a);if(!("encoded"in i)){if("type"in i&&i.type===Fn.excalidraw)return a;throw new Error("FAILED")}return l4(i)}catch(a){throw console.error(a),new Error("FAILED")}}throw new Error("INVALID")},yp=(e,t)=>{let[n,a,i,r]=Ne(e),s=Jt(n,i)+t*2,o=Jt(a,r)+t*2;return[n,a,s,o]},LP=(e,t,n)=>{let[,,a,i]=yp(e,t).map(r=>Math.trunc(r*n));return[a,i]},DP=class{constructor(e){this.scoreFunction=e,_(this,"content",[])}sinkDown(e){let t=this.content[e];for(;e>0;){let n=(e+1>>1)-1,a=this.content[n];if(this.scoreFunction(t)<this.scoreFunction(a))this.content[n]=t,this.content[e]=a,e=n;else break}}bubbleUp(e){let t=this.content.length,n=this.content[e],a=this.scoreFunction(n);for(;;){let i=e+1<<1,r=i-1,s=null,o=0;if(r<t){let d=this.content[r];o=this.scoreFunction(d),o<a&&(s=r)}if(i<t){let d=this.content[i];this.scoreFunction(d)<(s===null?a:o)&&(s=i)}if(s!==null)this.content[e]=this.content[s],this.content[s]=n,e=s;else break}}push(e){this.content.push(e),this.sinkDown(this.content.length-1)}pop(){if(this.content.length===0)return null;let e=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),e}remove(e){if(this.content.length===0)return;let t=this.content.indexOf(e),n=this.content.pop();t<this.content.length&&(this.content[t]=n,this.scoreFunction(n)<this.scoreFunction(e)?this.sinkDown(t):this.bubbleUp(t))}size(){return this.content.length}rescoreElement(e){this.sinkDown(this.content.indexOf(e))}},xp=1,Be=40,RP=(e,t)=>{let n=e.fixedSegments?e.fixedSegments.slice():null;if(n){let a=[];e.points.map(s=>E(e.x+s[0],e.y+s[1])).forEach((s,o,d)=>{if(o<2)return a.push(s);let c=Lo(s,d[o-1]),l=Lo(d[o-1],d[o-2]);if(gt(c,l)){let h=n?.findIndex(p=>p.index===o-1)??-1,f=n?.findIndex(p=>p.index===o)??-1;f!==-1&&(n[f].start=E(d[o-2][0]-e.x,d[o-2][1]-e.y)),h!==-1&&n.splice(h,1),a.splice(-1,1),n.forEach(p=>{p.index>o-1&&(p.index-=1)})}return a.push(s)});let i=[];a.forEach((s,o,d)=>{if(o<3)return i.push(s);if(Pe(d[o-2],d[o-1])<xp){let c=n?.findIndex(f=>f.index===o-2)??-1,l=n?.findIndex(f=>f.index===o-1)??-1;l!==-1&&n.splice(l,1),c!==-1&&n.splice(c,1),i.splice(-2,2),n.forEach(f=>{f.index>o-2&&(f.index-=2)});let h=si(s,d[o-1]);return i.push(E(h?s[0]:d[o-2][0],h?d[o-2][1]:s[1]))}i.push(s)});let r=n.filter(s=>s.index!==1&&s.index!==i.length-1);return r.length===0?tr(kp(Sp(Ep(e,wp(e,t,i.map(s=>E(s[0]-e.x,s[1]-e.y)),e.startBinding&&nl(e.startBinding.elementId,t),e.endBinding&&nl(e.endBinding.elementId,t)))??[])),r,null,null):(be.DEV&&nn(Mp(i),"Invalid elbow points with fixed segments"),tr(i,r,e.startIsSpecial,e.endIsSpecial))}return{x:e.x,y:e.y,points:e.points,fixedSegments:e.fixedSegments,startIsSpecial:e.startIsSpecial,endIsSpecial:e.endIsSpecial}},PP=(e,t,n)=>{let a=t.map(I=>I.index),i=(e.fixedSegments?.map(I=>I.index)??[]).findIndex(I=>!a.includes(I));if(i===-1||!e.fixedSegments?.[i])return{points:e.points};let r=e.fixedSegments[i].index,s=e.fixedSegments[i-1],o=e.fixedSegments[i+1],d=e.x+(s?s.end[0]:0),c=e.y+(s?s.end[1]:0),l=s?null:e.startBinding,h=o?null:e.endBinding,{startHeading:f,endHeading:p,startGlobalPoint:U,endGlobalPoint:m,hoveredStartElement:g,hoveredEndElement:b,...x}=wp({x:d,y:c,startBinding:l,endBinding:h,startArrowhead:null,endArrowhead:null,points:e.points},n,[E(0,0),E(e.x+(o?.start[0]??e.points[e.points.length-1][0])-d,e.y+(o?.start[1]??e.points[e.points.length-1][1])-c)],l&&nl(l.elementId,n),h&&nl(h.elementId,n),{isDragging:!1}),{points:y}=tr(kp(Sp(Ep(e,{startHeading:f,endHeading:p,startGlobalPoint:U,endGlobalPoint:m,hoveredEndElement:b,...x})??[])),t,null,null),v=[];if(s)for(let I=0;I<s.index;I++)v.push(E(e.x+e.points[I][0],e.y+e.points[I][1]));if(y.forEach(I=>{v.push(E(e.x+(s?s.end[0]:0)+I[0],e.y+(s?s.end[1]:0)+I[1]))}),o)for(let I=o.index;I<e.points.length;I++)v.
Line truncated
|
|
|
|
|
|
|
|
`).map(i=>i.trim().split(" "));if(t.length&&t[0].length!==2&&(t=e.trim().split(`
|
|
|
|
|
|
|
|
`).map(i=>i.trim().split(","))),t.length===0)return{type:Sr,reason:"No values"};let n=t[0].length;if(!t.every(i=>i.length===n))return{type:Sr,reason:"All rows don't have same number of columns"};let a=Eg(t);if(a.type!==zo){let i=Eg(JP(t));if(i.type===zo)return i}return a},dh=rM(nM),zn={fillStyle:"hachure",fontFamily:dr,fontSize:Ei,opacity:100,roughness:1,strokeColor:Ee.black,roundness:null,strokeStyle:"solid",strokeWidth:1,verticalAlign:In.MIDDLE,locked:!1},k3=e=>{let t=(ea+Ze)*e.values.length+Ze,n=Zi+Ze*2;return{chartWidth:t,chartHeight:n}},tN=(e,t,n,a,i)=>e.labels?.map((r,s)=>jn({groupIds:[a],backgroundColor:i,...zn,text:r.length>8?`${r.slice(0,5)}...`:r,x:t+s*(ea+Ze)+Ze*2,y:n+Ze/2,width:ea,angle:5.87,fontSize:16,textAlign:"center",verticalAlign:"top"}))||[],nN=(e,t,n,a,i)=>{let r=jn({groupIds:[a],backgroundColor:i,...zn,x:t-Ze,y:n-Ze,text:"0",textAlign:"right"}),s=jn({groupIds:[a],backgroundColor:i,...zn,x:t-Ze,y:n-Zi-r.height/2,text:Math.max(...e.values).toLocaleString(),textAlign:"right"});return[r,s]},aN=(e,t,n,a,i)=>{let{chartWidth:r,chartHeight:s}=k3(e),o=Pr({backgroundColor:i,groupIds:[a],...zn,type:"line",x:t,y:n,width:r,points:[E(0,0),E(r,0)]}),d=Pr({backgroundColor:i,groupIds:[a],...zn,type:"line",x:t,y:n,height:s,points:[E(0,0),E(0,-s)]}),c=Pr({backgroundColor:i,groupIds:[a],...zn,type:"line",x:t,y:n-Zi-Ze,strokeStyle:"dotted",width:r,opacity:E3,points:[E(0,0),E(r,0)]});return[o,d,c]},S3=(e,t,n,a,i,r)=>{let{chartWidth:s,chartHeight:o}=k3(e),d=e.title?jn({backgroundColor:i,groupIds:[a],...zn,text:e.title,x:t+s/2,y:n-Zi-Ze*2-Ei,roundness:null,textAlign:"center"}):null,c=r?$a({backgroundColor:i,groupIds:[a],...zn,type:"rectangle",x:t,y:n-o,width:s,height:o,strokeColor:Ee.black,fillStyle:"solid",opacity:6}):null;return[...c?[c]:[],...d?[d]:[],...tN(e,t,n,a,i),...nN(e,t,n,a,i),...aN(e,t,n,a,i)]},iN=(e,t,n)=>{let a=Math.max(...e.values),i=Xn(),r=dh[Math.floor(Math.random()*dh.length)];return[...e.values.map((s,o)=>{let d=s/a*Zi;return $a({backgroundColor:r,groupIds:[i],...zn,type:"rectangle",x:t+o*(ea+Ze)+Ze,y:n-d-Ze,width:ea,height:d})}),...S3(e,t,n,i,r,be.DEV)]},rN=(e,t,n)=>{let a=Math.max(...e.values),i=Xn(),r=dh[Math.floor(Math.random()*dh.length)],s=0,o=[];for(let m of e.values){let g=s*(ea+Ze),b=-(m/a)*Zi;o.push([g,b]),s++}let d=Math.max(...o.map(m=>m[0])),c=Math.max(...o.map(m=>m[1])),l=Math.min(...o.map(m=>m[0])),h=Math.min(...o.map(m=>m[1])),f=Pr({backgroundColor:r,groupIds:[i],...zn,type:"line",x:t+Ze+ea/2,y:n-Ze,height:c-h,width:d-l,strokeWidth:2,points:o}),p=e.values.map((m,g)=>{let b=g*(ea+Ze)+Ze/2,x=-(m/a)*Zi+Ze/2;return $a({backgroundColor:r,groupIds:[i],...zn,fillStyle:"solid",strokeWidth:2,type:"ellipse",x:t+b+ea/2,y:n+x-Ze*2,width:Ze,height:Ze})}),U=e.values.map((m,g)=>{let b=g*(ea+Ze)+Ze/2,x=m/a*Zi+Ze/2+Ze;return Pr({backgroundColor:r,groupIds:[i],...zn,type:"line",x:t+b+ea/2+Ze/2,y:n-x,height:x,strokeStyle:"dotted",opacity:E3,points:[E(0,0),E(0,x)]})});return[...S3(e,t,n,i,r,be.DEV),f,...U,...p]},sN=(e,t,n,a)=>e==="line"?rN(t,n,a):iN(t,n,a),Cp="clipboard"in navigator&&"writeText"in navigator.clipboard,Ip="clipboard"in navigator&&"write"in navigator.clipboard&&"ClipboardItem"in window&&"toBlob"in HTMLCanvasElement.prototype,lN=e=>!!([Fn.excalidraw,Fn.excalidrawClipboard,Fn.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),oN=({types:e,files:t})=>{!e&&!t&&console.warn("createPasteEvent: no types or files provided");let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});if(e)for(let[a,i]of Object.entries(e)){if(typeof i!="string"){t=t||[],t.push(i);continue}try{if(n.clipboardData?.setData(a,i),n.clipboardData?.getData(a)!==i)throw new Error(`Failed to set "${a}" as clipboardData item`)}catch(r){throw new Error(r.message)}}if(t){let a=-1;for(let i of t){a++;try{if(n.clipboardData?.items.add(i),n.clipboardData?.files[a]!==i)throw new Error(`Failed to set file "${i.name}" as clipboardData item`)}catch(r){throw new Error(r.message)}}}return n},dN=({elements:e,files:t})=>{let n=oe(e),a=new Set(e.filter(o=>de(o))),i=!1,r=e.reduce((o,d)=>(Rn(d)&&(i=!0,t&&t[d.fileId]&&(o[d.fileId]=t[d.fileId])),o),{});i&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let s={type:Fn.excalidrawClipboard,elements:e.map(o=>{if(wn(o,n)&&!a.has(wn(o,n))){let d=rs(o);return W(d,{frameId:null}),d}return o}),files:t?r:void 0};return JSON.stringify(s)},M3=async(e,t,n)=>{await fl(dN({elements:e,files:t}),n)},cN=e=>{let t=eN(e);return t.type===zo?{spreadsheet:t.spreadsheet}:null};function C3(e){let t=[];for(let n of e.childNodes)if(n.nodeType===3){let a=n.textContent?.trim();a&&t.push({type:"text",value:a})}else if(n instanceof HTMLImageElement){let a=n.getAttribute("src");a&&a.startsWith("http")&&t.push({type:"imageUrl",value:a})}else t=t.concat(C3(n));return t}var hN=e=>{let t=e.clipboardData?.getData(ae.html);if(!t)return null;try{let n=new DOMParser().parseFromString(t,ae.html),a=C3(n.body);if(a.length)return{type:"
Line truncated
|
|
|
|
|
|
|
|
`).trim()}:n:{type:"text",value:(e.clipboardData?.getData(ae.text)||"").trim()}}catch{return{type:"text",value:""}}},I3=async(e,t=!1)=>{let n=await fN(e,t);if(n.type==="mixedContent")return{mixedContent:n.value};try{let a=!t&&cN(n.value);if(a)return a}catch(a){console.error(a)}try{let a=JSON.parse(n.value),i=a.type===Fn.excalidrawClipboardWithAPI;if(lN(a))return{elements:a.elements,files:a.files,text:t?JSON.stringify(a.elements,null,2):void 0,programmaticAPI:i}}catch{}return{text:n.value}},T3=async e=>{try{await navigator.clipboard.write([new window.ClipboardItem({[ae.png]:e})])}catch(t){if(nd(e))await navigator.clipboard.write([new window.ClipboardItem({[ae.png]:await e})]);else throw t}},fl=async(e,t)=>{if(Cp)try{await navigator.clipboard.writeText(e||"");return}catch(n){console.error(n)}try{if(t){if(t.clipboardData?.setData(ae.text,e||""),t.clipboardData?.getData(ae.text)!==e)throw new Error("Failed to setData on clipboardEvent");return}}catch(n){console.error(n)}if(!pN(e))throw new Error("Error copying to clipboard.")},pN=e=>{e||(e=" ");let t=document.documentElement.getAttribute("dir")==="rtl",n=document.createElement("textarea");n.style.border="0",n.style.padding="0",n.style.margin="0",n.style.position="absolute",n.style[t?"right":"left"]="-9999px";let a=window.pageYOffset||document.documentElement.scrollTop;n.style.top=`${a}px`,n.style.fontSize="12pt",n.setAttribute("readonly",""),n.value=e,document.body.appendChild(n);let i=!1;try{n.select(),n.setSelectionRange(0,n.value.length),i=document.execCommand("copy")}catch(r){console.error(r)}return n.remove(),i},cd=({elements:e,appState:t,files:n,maxWidthOrHeight:a,getDimensions:i,exportPadding:r,exportingFrame:s})=>{let{elements:o,appState:d}=od({elements:e,appState:t},null,null),{exportBackground:c,viewBackgroundColor:l}=d;return x3(o,{...d,offsetTop:0,offsetLeft:0,width:0,height:0},n||{},{exportBackground:c,exportPadding:r,viewBackgroundColor:l,exportingFrame:s},(h,f)=>{let p=document.createElement("canvas");if(a){typeof i=="function"&&console.warn("`getDimensions()` is ignored when `maxWidthOrHeight` is supplied.");let m=Math.max(h,f),g=a<m?a/m:t?.exportScale??1;return p.width=h*g,p.height=f*g,{canvas:p,scale:g}}let U=i?.(h,f)||{width:h,height:f};return p.width=U.width,p.height=U.height,{canvas:p,scale:U.scale??1}})},j3=async e=>{let{mimeType:t=ae.png,quality:n}=e;t===ae.png&&typeof n=="number"&&console.warn(`"quality" will be ignored for "${ae.png}" mimeType`),t==="image/jpg"&&(t=ae.jpg),t===ae.jpg&&!e.appState?.exportBackground&&(console.warn(`Defaulting "exportBackground" to "true" for "${ae.jpg}" mimeType`),e={...e,appState:{...e.appState,exportBackground:!0}});let a=await cd(e);return n=n||(/image\/jpe?g/.test(t)?.92:.8),new Promise((i,r)=>{a.toBlob(async s=>{if(!s)return r(new Error("couldn't export to blob"));s&&t===ae.png&&e.appState?.exportEmbedScene&&(s=await d4({blob:s,metadata:ld(e.elements,e.appState,e.files||{},"local")})),i(s)},t,n)})},iu=async({elements:e,appState:t=za(),files:n={},exportPadding:a,renderEmbeddables:i,exportingFrame:r,skipInliningFonts:s,reuseImages:o})=>{let{elements:d,appState:c}=od({elements:e,appState:t},null,null),l={...c,exportPadding:a};return bp(d,l,n,{exportingFrame:r,renderEmbeddables:i,skipInliningFonts:s,reuseImages:o})},UN=async e=>{if(e.type==="svg"){let t=await iu(e);await fl(t.outerHTML)}else if(e.type==="png")await T3(j3(e));else if(e.type==="json")await M3(e.elements,e.files);else throw new Error("Invalid export type")},mN=e=>e.type==="diamond"?[E(e.width/2,0),E(e.width,e.height/2),E(e.width/2,e.height),E(0,e.height/2)]:[E(0,0),E(0+e.width,0),E(0+e.width,e.height),E(0,e.height)],gN=e=>he(e)||Hn(e)?e.points:mN(e),kg=e=>{let t=e.reduce((n,[a,i])=>(n.minY=Math.min(n.minY,i),n.minX=Math.min(n.minX,a),n.maxX=Math.max(n.maxX,a),n.maxY=Math.max(n.maxY,i),n),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,cx:0,cy:0});return t.cx=(t.maxX+t.minX)/2,t.cy=(t.maxY+t.minY)/2,t},_3=e=>{let t=gN(e),{cx:n,cy:a}=kg(t),i=E(n,a),r=t.map(l=>H(l,i,e.angle)),{minX:s,minY:o,maxX:d,maxY:c}=kg(r);return[s+e.x,o+e.y,d+e.x,c+e.y]},D0=(e,t,n=!1)=>{let a=_3(e),i=t[0]<=a[0]&&t[2]>=a[2]&&t[1]<=a[1]&&t[3]>=a[3];return n?i?!0:a[0]<=t[0]&&a[2]>=t[2]&&a[1]<=t[1]&&a[3]>=t[3]:i},A3=(e,t)=>{let n=_3(e);return(jd(n[0],Qt(t[0],t[2]))||jd(t[0],Qt(n[0],n[2])))&&(jd(n[1],Qt(t[1],t[3]))||jd(t[1],Qt(n[1],n[3])))},L3=({elements:e,bounds:t,type:n,errorMargin:a=0})=>{M8(t)&&(t=Ua(t,oe(e)));let i=[t[0]-a,t[1]-a,t[2]+a,t[3]+a],r=new Set;for(let s of e)if(!r.has(s.id)&&(n==="overlap"?A3(s,i):n==="inside"?D0(s,i):D0(s,i,!0))){if(r.add(s.id),s.boundElements)for(let o of s.boundElements)r.add(o.id);q(s)&&s.containerId&&r.add(s.containerId),xe(s)&&(s.startBinding&&r.add(s.startBinding.elementId),s.endBinding&&r.add(s.endBinding?.elementId))}return e.filter(s=>r.has(s.id))};function Sg(e){return[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])]}function bN(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1
Line truncated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(If you want to keep your local drawing, simply close the browser tab instead.)`,errorAddingToLibrary:"Couldn't add item to the library",errorRemovingFromLibrary:"Couldn't remove item from the library",confirmAddLibrary:"This will add {{numShapes}} shape(s) to your library. Are you sure?",imageDoesNotContainScene:"This image does not seem to contain any scene data. Have you enabled scene embedding during export?",cannotRestoreFromImage:"Scene couldn't be restored from this image file",invalidSceneUrl:"Couldn't import scene from the supplied URL. It's either malformed, or doesn't contain valid Excalidraw JSON data.",resetLibrary:"This will clear your library. Are you sure?",removeItemsFromsLibrary:"Delete {{count}} item(s) from library?",invalidEncryptionKey:"Encryption key must be of 22 characters. Live collaboration is disabled.",collabOfflineWarning:`No internet connection available.
|
|
|
|
|
|
|
|
Your changes will not be saved!`},m4={unsupportedFileType:"Unsupported file type.",imageInsertError:"Couldn't insert image. Try again later...",fileTooBig:"File is too big. Maximum allowed size is {{maxSize}}.",svgImageInsertError:"Couldn't insert SVG image. The SVG markup looks invalid.",failedToFetchImage:"Failed to fetch image.",cannotResolveCollabServer:"Couldn't connect to the collab server. Please reload the page and try again.",importLibraryError:"Couldn't load library",saveLibraryError:"Couldn't save library to storage. Please save your library to a file locally to make sure you don't lose changes.",collabSaveFailed:"Couldn't save to the backend database. If problems persist, you should save your file locally to ensure you don't lose your work.",collabSaveFailed_sizeExceeded:"Couldn't save to the backend database, the canvas seems to be too big. You should save the file locally to ensure you don't lose your work.",imageToolNotSupported:"Images are disabled.",brave_measure_text_error:{line1:"Looks like you are using Brave browser with the <bold>Aggressively Block Fingerprinting</bold> setting enabled.",line2:"This could result in breaking the <bold>Text Elements</bold> in your drawings.",line3:"We strongly recommend disabling this setting. You can follow <link>these steps</link> on how to do so.",line4:"If disabling this setting doesn't fix the display of text elements, please open an <issueLink>issue</issueLink> on our GitHub, or write us on <discordLink>Discord</discordLink>"},libraryElementTypeError:{embeddable:"Embeddable elements cannot be added to the library.",iframe:"IFrame elements cannot be added to the library.",image:"Support for adding images to the library coming soon!"},asyncPasteFailedOnRead:"Couldn't paste (couldn't read from system clipboard).",asyncPasteFailedOnParse:"Couldn't paste.",copyToSystemClipboardFailed:"Couldn't copy to clipboard."},g4={selection:"Selection",image:"Insert image",rectangle:"Rectangle",diamond:"Diamond",ellipse:"Ellipse",arrow:"Arrow",line:"Line",freedraw:"Draw",text:"Text",library:"Library",lock:"Keep selected tool active after drawing",penMode:"Pen mode - prevent touch",link:"Add / Update link for a selected shape",eraser:"Eraser",frame:"Frame tool",magicframe:"Wireframe to code",embeddable:"Web Embed",laser:"Laser pointer",hand:"Hand (panning tool)",extraTools:"More tools",mermaidToExcalidraw:"Mermaid to Excalidraw"},b4={rectangle:"Rectangle",diamond:"Diamond",ellipse:"Ellipse",arrow:"Arrow",line:"Line",freedraw:"Freedraw",text:"Text",image:"Image",group:"Group",frame:"Frame",magicframe:"Wireframe to code",embeddable:"Web Embed",selection:"Selection",iframe:"IFrame"},y4={canvasActions:"Canvas actions",selectedShapeActions:"Selected shape actions",shapes:"Shapes"},x4={dismissSearch:"Escape to dismiss search",canvasPanning:"To move canvas, hold mouse wheel or spacebar while dragging, or use the hand tool",linearElement:"Click to start multiple points, drag for single line",arrowTool:"Click to start multiple points, drag for single line. Press {{arrowShortcut}} again to change arrow type.",freeDraw:"Click and drag, release when you're finished",text:"Tip: you can also add text by double-clicking anywhere with the selection tool",embeddable:"Click-drag to create a website embed",text_selected:"Double-click or press ENTER to edit text",text_editing:"Press Escape or CtrlOrCmd+ENTER to finish editing",linearElementMulti:"Click on last point or press Escape or Enter to finish",lockAngle:"You can constrain angle by holding SHIFT",resize:`You can constrain proportions by holding SHIFT while resizing,
|
|
|
|
|
|
|
|
hold ALT to resize from the center`,resizeImage:`You can resize freely by holding SHIFT,
|
|
|
|
|
|
|
|
hold ALT to resize from the center`,rotate:"You can constrain angles by holding SHIFT while rotating",lineEditor_info:"Hold CtrlOrCmd and Double-click or press CtrlOrCmd + Enter to edit points",lineEditor_pointSelected:`Press Delete to remove point(s),
|
|
|
|
|
|
|
|
CtrlOrCmd+D to duplicate, or drag to move`,lineEditor_nothingSelected:`Select a point to edit (hold SHIFT to select multiple),
|
|
|
|
|
|
|
|
or hold Alt and click to add new points`,placeImage:"Click to place the image, or click and drag to set its size manually",publishLibrary:"Publish your own library",bindTextToElement:"Press enter to add text",createFlowchart:"Hold CtrlOrCmd and Arrow key to create a flowchart",deepBoxSelect:"Hold CtrlOrCmd to deep select, and to prevent dragging",eraserRevert:"Hold Alt to revert the elements marked for deletion",firefox_clipboard_write:'This feature can likely be enabled by setting the "dom.events.asyncClipboard.clipboardItem" flag to "true". To change the browser flags in Firefox, visit the "about:config" page.',disableSnapping:"Hold CtrlOrCmd to disable snapping",enterCropEditor:"Double click the image or press ENTER to crop the image",leaveCropEditor:"Click outside the image or press ENTER or ESCAPE to finish cropping"},v4={cannotShowPreview:"Cannot show preview",canvasTooBig:"The canvas may be too big.",canvasTooBigTip:"Tip: try moving the farthest elements a bit closer together."},w4={headingMain:"Encountered an error. Try <button>reloading the page</button>.",clearCanvasMessage:"If reloading doesn't work, try <button>clearing the canvas</button>.",clearCanvasCaveat:" This will result in loss of work ",trackedToSentry:"The error with identifier {{eventId}} was tracked on our system.",openIssueMessage:"We were very cautious not to include your scene information on the error. If your scene is not private, please consider following up on our <button>bug tracker</button>. Please include information below by copying and pasting into the GitHub issue.",sceneContent:"Scene content:"},E4={or:"Or"},k4={desc_intro:"Invite people to collaborate on your drawing.",desc_privacy:"Don't worry, the session is end-to-end encrypted, and fully private. Not even our server can see what you draw.",button_startSession:"Start session",button_stopSession:"Stop session",desc_inProgressIntro:"Live-collaboration session is now in progress.",desc_shareLink:"Share this link with anyone you want to collaborate with:",desc_exitSession:"Stopping the session will disconnect you from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version.",shareTitle:"Join a live collaboration session on Excalidraw"},S4={title:"Error"},M4={disk_title:"Save to disk",disk_details:"Export the scene data to a file from which you can import later.",disk_button:"Save to file",link_title:"Shareable link",link_details:"Export as a read-only link.",link_button:"Export to Link",excalidrawplus_description:"Save the scene to your Excalidraw+ workspace.",excalidrawplus_button:"Export",excalidrawplus_exportError:"Couldn't export to Excalidraw+ at this moment..."},C4={blog:"Read our blog",click:"click",deepSelect:"Deep select",deepBoxSelect:"Deep select within box, and prevent dragging",createFlowchart:"Create a flowchart from a generic element",navigateFlowchart:"Navigate a flowchart",curvedArrow:"Curved arrow",curvedLine:"Curved line",documentation:"Documentation",doubleClick:"double-click",drag:"drag",editor:"Editor",editLineArrowPoints:"Edit line/arrow points",editText:"Edit text / add label",github:"Found an issue? Submit",howto:"Follow our guides",or:"or",preventBinding:"Prevent arrow binding",tools:"Tools",shortcuts:"Keyboard shortcuts",textFinish:"Finish editing (text editor)",textNewLine:"Add new line (text editor)",title:"Help",view:"View",zoomToFit:"Zoom to fit all elements",zoomToSelection:"Zoom to selection",toggleElementLock:"Lock/unlock selection",movePageUpDown:"Move page up/down",movePageLeftRight:"Move page left/right",cropStart:"Crop image",cropFinish:"Finish image cropping"},I4={title:"Clear canvas"},T4={title:"Publish library",itemName:"Item name",authorName:"Author name",githubUsername:"GitHub username",twitterUsername:"Twitter username",libraryName:"Library name",libraryDesc:"Library description",website:"Website",placeholder:{authorName:"Your name or username",libraryName:"Name of your library",libraryDesc:"Description of your library to help people understand its usage",githubHandle:"GitHub handle (optional), so you can edit the library once submitted for review",twitterHandle:"Twitter username (optional), so we know who to credit when promoting over Twitter",website:"Link to your personal website or elsewhere (optional)"},errors:{required:"Required",website:"Enter a valid URL"},noteDescription:"Submit your library to be included in the <link>public library repository</link> for other people to use in their drawings.",noteGuidelines:"The library needs to be manually approved first. Please read the <link>guidelines</link> before submitting. You will need a GitHub account to communicate and make changes if requested, but it is not strictly required.",noteLicense:"By submitting, you agree the library will be published under the <link>MIT License</link>, which in short means anyone can use them without restrictions.",noteItems:"E
Line truncated
|
|
|
|
|
|
|
|
Will increase exported file size.`},title:{exportToPng:"Export to PNG",exportToSvg:"Export to SVG",copyPngToClipboard:"Copy PNG to clipboard"},button:{exportToPng:"PNG",exportToSvg:"SVG",copyPngToClipboard:"Copy to clipboard"}},L4={tooltip:"Your drawings are end-to-end encrypted so Excalidraw's servers will never see them.",link:"Blog post on end-to-end encryption in Excalidraw"},D4={angle:"Angle",shapes:"Shapes",height:"Height",scene:"Scene",selected:"Selected",storage:"Storage",fullTitle:"Canvas & Shape properties",title:"Properties",generalStats:"General",elementProperties:"Shape properties",total:"Total",version:"Version",versionCopy:"Click to copy",versionNotAvailable:"Version not available",width:"Width"},R4={addedToLibrary:"Added to library",copyStyles:"Copied styles.",copyToClipboard:"Copied to clipboard.",copyToClipboardAsPng:`Copied {{exportSelection}} to clipboard as PNG
|
|
|
|
|
|
|
|
({{exportColorScheme}})`,copyToClipboardAsSvg:`Copied {{exportSelection}} to clipboard as SVG
|
|
|
|
|
|
|
|
({{exportColorScheme}})`,fileSaved:"File saved.",fileSavedToFilename:"Saved to {filename}",canvas:"canvas",selection:"selection",pasteAsSingleElement:`Use {{shortcut}} to paste as a single element,
|
|
|
|
|
|
|
|
or paste into an existing text editor`,unableToEmbed:"Embedding this url is currently not allowed. Raise an issue on GitHub to request the url whitelisted",unrecognizedLinkFormat:"The link you embedded does not match the expected format. Please try to paste the 'embed' string provided by the source site",elementLinkCopied:"Link copied to clipboard"},P4={transparent:"Transparent",black:"Black",white:"White",red:"Red",pink:"Pink",grape:"Grape",violet:"Violet",gray:"Gray",blue:"Blue",cyan:"Cyan",teal:"Teal",green:"Green",yellow:"Yellow",orange:"Orange",bronze:"Bronze"},N4={app:{center_heading:"All your data is saved locally in your browser.",center_heading_plus:"Did you want to go to the Excalidraw+ instead?",menuHint:"Export, preferences, languages, ..."},defaults:{menuHint:"Export, preferences, and more...",center_heading:"Diagrams. Made. Simple.",toolbarHint:"Pick a tool & Start drawing!",helpHint:"Shortcuts & help"}},O4={mostUsedCustomColors:"Most used custom colors",colors:"Colors",shades:"Shades",hexCode:"Hex code",noShades:"No shades available for this color"},F4={action:{exportToImage:{title:"Export as image",button:"Export as image",description:"Export the scene data as an image from which you can import later."},saveToDisk:{title:"Save to disk",button:"Save to disk",description:"Export the scene data to a file from which you can import later."},excalidrawPlus:{title:"Excalidraw+",button:"Export to Excalidraw+",description:"Save the scene to your Excalidraw+ workspace."}},modal:{loadFromFile:{title:"Load from file",button:"Load from file",description:"Loading from a file will <bold>replace your existing content</bold>.<br></br>You can back up your drawing first using one of the options below."},shareableLink:{title:"Load from link",button:"Replace my content",description:"Loading external drawing will <bold>replace your existing content</bold>.<br></br>You can back up your drawing first by using one of the options below."}}},z4={title:"Mermaid to Excalidraw",button:"Insert",description:"Currently only <flowchartLink>Flowchart</flowchartLink>,<sequenceLink> Sequence, </sequenceLink> and <classLink>Class </classLink>Diagrams are supported. The other types will be rendered as image in Excalidraw.",syntax:"Mermaid Syntax",preview:"Preview"},B4={placeholder:"Quick search"},H4={badge:{old:"old"},sceneFonts:"In this scene",availableFonts:"Available fonts",empty:"No fonts found"},$4={empty:"No users found",hint:{text:"Click on user to follow",followStatus:"You're currently following this user",inCall:"User is in a voice call",micMuted:"User's microphone is muted",isSpeaking:"User is speaking"}},X4={title:"Command palette",shortcuts:{select:"Select",confirm:"Confirm",close:"Close"},recents:"Recently used",search:{placeholder:"Search menus, commands, and discover hidden gems",noMatch:"No matching commands..."},itemNotAvailable:"Command is not available...",shortcutHint:"For Command palette, use {{shortcut}}"},Vp={labels:c4,elementLink:h4,library:u4,search:f4,buttons:p4,alerts:U4,errors:m4,toolBar:g4,element:b4,headings:y4,hints:x4,canvasError:v4,errorSplash:w4,shareDialog:E4,roomDialog:k4,errorDialog:S4,exportDialog:M4,helpDialog:C4,clearCanvasDialog:I4,publishDialog:T4,publishSuccessDialog:j4,confirmDialog:_4,imageExportDialog:A4,encrypted:L4,stats:D4,toast:R4,colors:P4,welcomeScreen:N4,colorPicker:O4,overwriteConfirm:F4,mermaid:z4,quickSearch:B4,fontList:H4,userList:$4,commandPalette:X4},W4=100,V4=36,G4={"ar-SA":94,"az-AZ":17,"bg-BG":71,"bn-BD":52,"ca-ES":83,"cs-CZ":86,"da-DK":61,"de-DE":100,"el-GR":80,en:W4,"es-ES":96,"eu-ES":97,"fa-IR":84,"fi-FI":76,"fr-FR":99,"gl-ES":86,"he-IL":77,"hi-IN":76,"hu-HU":76,"id-ID":91,"it-IT":98,"ja-JP":90,kaa:V4,"kab-KAB":76,"kk-KZ":18,"km-KH":83,"ko-KR":100,"ku-TR":87,"lt-LT":48,"lv-LV":77,"mr-IN":98,"my-MM":35,"nb-NO":93,"nl-NL":75,"nn-NO":67,"oc-FR":92,"pa-IN":78,"pl-PL":99,"pt-BR":91,"pt-PT":83,"ro-RO":99,"ru-RU":92,"si-LK":7,"sk-SK":100,"sl-SI":100,"sv-SE":100,"ta-IN":81,"th-TH":44,"tr-TR":87,"uk-UA":93,"vi-VN":49,"zh-CN":100,"zh-HK":22,"zh-TW":100};const bi={};let aO=0;function $t(e,t){const n=`atom${++aO}`,a={toString(){return(bi?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?a.read=e:(a.init=e,a.read=iO,a.write=rO),a}function iO(e){return e(this)}function rO(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}const Hg=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,H0=e=>"init"in e,U1=e=>!!e.write,fh=new WeakMap,$0=e=>{var t;return X0(e)&&!((t=fh.get(e))!=null&&t[1])},sO=(e,t)=>{const n=fh.get(e);if(n)n[1]=!0,n[0].forEach(a=>a(t));else if((bi?"production":void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},lO=e=>{if(fh.has(e))return;const t=[new Set,!1];fh.set(e,t);const n=()=>{t[1]=!0};e.then(n,n),e.onCancel=a=>{t[0].add(a)}},X0=e=>typeof e?.then=="function",$g=e=>"v"in e||"e"in e,Pd=e=>{if("e"in e)throw e.e;if((bi?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bu
Line truncated
|
|
|
|
|
|
|
|
.`.concat(wz,` {
|
|
|
|
|
|
|
|
overflow: hidden `).concat(a,`;
|
|
|
|
|
|
|
|
padding-right: `).concat(o,"px ").concat(a,`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
body[`).concat(Os,`] {
|
|
|
|
|
|
|
|
overflow: hidden `).concat(a,`;
|
|
|
|
|
|
|
|
overscroll-behavior: contain;
|
|
|
|
|
|
|
|
`).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
|
|
|
|
|
|
|
|
padding-left: `.concat(i,`px;
|
|
|
|
|
|
|
|
padding-top: `).concat(r,`px;
|
|
|
|
|
|
|
|
padding-right: `).concat(s,`px;
|
|
|
|
|
|
|
|
margin-left:0;
|
|
|
|
|
|
|
|
margin-top:0;
|
|
|
|
|
|
|
|
margin-right: `).concat(o,"px ").concat(a,`;
|
|
|
|
|
|
|
|
`),n==="padding"&&"padding-right: ".concat(o,"px ").concat(a,";")].filter(Boolean).join(""),`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.`).concat(xc,` {
|
|
|
|
|
|
|
|
right: `).concat(o,"px ").concat(a,`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.`).concat(vc,` {
|
|
|
|
|
|
|
|
margin-right: `).concat(o,"px ").concat(a,`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.`).concat(xc," .").concat(xc,` {
|
|
|
|
|
|
|
|
right: 0 `).concat(a,`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.`).concat(vc," .").concat(vc,` {
|
|
|
|
|
|
|
|
margin-right: 0 `).concat(a,`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
body[`).concat(Os,`] {
|
|
|
|
|
|
|
|
`).concat(Ez,": ").concat(o,`px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
`)},p6=function(){var e=parseInt(document.body.getAttribute(Os)||"0",10);return isFinite(e)?e:0},Hz=function(){k.useEffect(function(){return document.body.setAttribute(Os,(p6()+1).toString()),function(){var e=p6()-1;e<=0?document.body.removeAttribute(Os):document.body.setAttribute(Os,e.toString())}},[])},$z=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,i=a===void 0?"margin":a;Hz();var r=k.useMemo(function(){return Fz(i)},[i]);return k.createElement(zz,{styles:Bz(r,!t,i,n?"":"!important")})},q0=!1;if(typeof window<"u")try{var Bd=Object.defineProperty({},"passive",{get:function(){return q0=!0,!0}});window.addEventListener("test",Bd,Bd),window.removeEventListener("test",Bd,Bd)}catch{q0=!1}var Us=q0?{passive:!1}:!1,Xz=function(e){return e.tagName==="TEXTAREA"},N9=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Xz(e)&&n[t]==="visible")},Wz=function(e){return N9(e,"overflowY")},Vz=function(e){return N9(e,"overflowX")},U6=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var i=O9(e,a);if(i){var r=F9(e,a),s=r[1],o=r[2];if(s>o)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},Gz=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},Yz=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},O9=function(e,t){return e==="v"?Wz(t):Vz(t)},F9=function(e,t){return e==="v"?Gz(t):Yz(t)},Zz=function(e,t){return e==="h"&&t==="rtl"?-1:1},Kz=function(e,t,n,a,i){var r=Zz(e,window.getComputedStyle(t).direction),s=r*a,o=n.target,d=t.contains(o),c=!1,l=s>0,h=0,f=0;do{if(!o)break;var p=F9(e,o),U=p[0],m=p[1],g=p[2],b=m-g-r*U;(U||b)&&O9(e,o)&&(h+=b,f+=U);var x=o.parentNode;o=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!d&&o!==document.body||d&&(t.contains(o)||t===o));return(l&&Math.abs(h)<1||!l&&Math.abs(f)<1)&&(c=!0),c},Hd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},m6=function(e){return[e.deltaX,e.deltaY]},g6=function(e){return e&&"current"in e?e.current:e},qz=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Qz=function(e){return`
|
|
|
|
|
|
|
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
|
|
|
|
|
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
|
|
|
|
|
|
`)},Jz=0,ms=[];function eB(e){var t=k.useRef([]),n=k.useRef([0,0]),a=k.useRef(),i=k.useState(Jz++)[0],r=k.useState(P9)[0],s=k.useRef(e);k.useEffect(function(){s.current=e},[e]),k.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var m=vz([e.lockRef.current],(e.shards||[]).map(g6),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var o=k.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=Hd(m),x=n.current,y="deltaX"in m?m.deltaX:x[0]-b[0],v="deltaY"in m?m.deltaY:x[1]-b[1],w,S=m.target,C=Math.abs(y)>Math.abs(v)?"h":"v";if("touches"in m&&C==="h"&&S.type==="range")return!1;var I=U6(C,S);if(!I)return!0;if(I?w=C:(w=C==="v"?"h":"v",I=U6(C,S)),!I)return!1;if(!a.current&&"changedTouches"in m&&(y||v)&&(a.current=w),!w)return!0;var j=a.current||w;return Kz(j,g,m,j==="h"?y:v)},[]),d=k.useCallback(function(m){var g=m;if(!(!ms.length||ms[ms.length-1]!==r)){var b="deltaY"in g?m6(g):Hd(g),x=t.current.filter(function(w){return w.name===g.type&&(w.target===g.target||g.target===w.shadowParent)&&qz(w.delta,b)})[0];if(x&&x.should){g.cancelable&&g.preventDefault();return}if(!x){var y=(s.current.shards||[]).map(g6).filter(Boolean).filter(function(w){return w.contains(g.target)}),v=y.length>0?o(g,y[0]):!s.current.noIsolation;v&&g.cancelable&&g.preventDefault()}}},[]),c=k.useCallback(function(m,g,b,x){var y={name:m,delta:g,target:b,should:x,shadowParent:tB(b)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(v){return v!==y})},1)},[]),l=k.useCallback(function(m){n.current=Hd(m),a.current=void 0},[]),h=k.useCallback(function(m){c(m.type,m6(m),m.target,o(m,e.lockRef.current))},[]),f=k.useCallback(function(m){c(m.type,Hd(m),m.target,o(m,e.lockRef.current))},[]);k.useEffect(function(){return ms.push(r),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",d,Us),document.addEventListener("touchmove",d,Us),document.addEventListener("touchstart",l,Us),function(){ms=ms.filter(function(m){return m!==r}),document.removeEventListener("wheel",d,Us),document.removeEventListener("touchmove",d,Us),document.removeEventListener("touchstart",l,Us)}},[]);var p=e.removeScrollBar,U=e.inert;return k.createElement(k.Fragment,null,U?k.createElement(r,{styles:Qz(i)}):null,p?k.createElement($z,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function tB(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const nB=jz(R9,eB);var z9=k.forwardRef(function(e,t){return k.createElement(bh,Da({},e,{ref:t,sideCar:nB}))});z9.classNames=bh.classNames;var iU="Popover",[B9]=n9(iU,[v9]),pd=v9(),[aB,ur]=B9(iU),H9=e=>{const{__scopePopover:t,children:n,open:a,defaultOpen:i,onOpenChange:r,modal:s=!1}=e,o=pd(t),d=k.useRef(null),[c,l]=k.useState(!1),[h=!1,f]=Uz({prop:a,defaultProp:i,onChange:r});return u.jsx(oz,{...o,children:u.jsx(aB,{scope:t,contentId:HO(),triggerRef:d,open:h,onOpenChange:f,onOpenToggle:k.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:c,onCustomAnchorAdd:k.useCallback(()=>l(!0),[]),onCustomAnchorRemove:k.useCallback(()=>l(!1),[]),modal:s,children:n})})};H9.displayName=iU;var $9="PopoverAnchor",iB=k.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=ur($9,n),r=pd(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:o}=i;return k.useEffect(()=>(s(),()=>o()),[s,o]),u.jsx(j9,{...r,...a,ref:t})});iB.displayName=$9;var X9="PopoverTrigger",W9=k.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=ur(X9,n),r=pd(n),s=hr(t,i.triggerRef),o=u.jsx(ki.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":q9(i.open),...a,ref:s,onClick:Ki(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?o:u.jsx(j9,{asChild:!0,...r,children:o})});W9.displayName=X9;var rU="PopoverPortal",[rB,sB]=B9(rU,{forceMount:void 0}),V9=e=>{const{__scopePopover:t,forceMount:n,children:a,container:i}=e,r=ur(rU,t);return u.jsx(rB,{scope:t,forceMount:n,children:u.jsx(aU,{present:n||r.open,children:u.jsx(_9,{asChild:!0,container:i,children:a})})})};V9.displayName=rU;var rl="PopoverContent",G9=k.forwardRef((e,t)=>{const n=sB(rl,e.__scopePopover),{forceMount:a=n.forceMount,...i}=e,r=ur(rl,e.__scopePopover);return u.jsx(aU,{present:a||r.open,children:r.modal?u.jsx(lB,{...i,ref:t}):u.jsx(oB,{...i,ref:t})})});G9.displayName=rl;var lB=k.forwardRef((e,t)=>{const n=ur(rl,e.__scopePopover),a=k.useRef(null),i=hr(t,a),r=k.useRef(!1);return k.useEffect(()=>{const s=a.current;if(s)return xz(s)},[]),u.jsx(z9,{as:Yp,allowPinchZoom:!0,children:u.jsx(Y9,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ki(e.onCloseAutoFocus,s=>{s.preventDefaul
Line truncated
|
|
|
|
|
|
|
|
${t?"dropdown-menu-item--selected":""} ${n?"dropdown-menu-item--hovered":""}`.trim(),Hy=(e,t)=>{let n=k.useContext(zy);return Fh(e,a=>{let i=new CustomEvent("menu.itemSelect",{bubbles:!0,cancelable:!0});t?.(i),i.defaultPrevented||n.onSelect?.(i)})},R$=({textStyle:e,icon:t,shortcut:n,children:a})=>{let i=_t();return u.jsxs(u.Fragment,{children:[t&&u.jsx("div",{className:"dropdown-menu-item__icon",children:t}),u.jsx("div",{style:e,className:"dropdown-menu-item__text",children:a}),n&&!i.editor.isMobile&&u.jsx("div",{className:"dropdown-menu-item__shortcut",children:n})]})},$y=R$,uU=({icon:e,value:t,order:n,children:a,shortcut:i,className:r,hovered:s,selected:o,textStyle:d,onSelect:c,onClick:l,...h})=>{let f=Hy(l,c),p=k.useRef(null);return k.useEffect(()=>{s&&(n===0?p.current?.scrollIntoView({block:"end"}):p.current?.scrollIntoView({block:"nearest"}))},[s,n]),u.jsx("button",{...h,ref:p,value:t,onClick:f,className:By(r,o,s),title:h.title??h["aria-label"],children:u.jsx($y,{textStyle:d,icon:e,shortcut:i,children:a})})};uU.displayName="DropdownMenuItem";var ql={GREEN:"green",RED:"red",BLUE:"blue"},cf=({type:e=ql.BLUE,children:t})=>{let{theme:n}=gd(),a={display:"inline-flex",marginLeft:"auto",padding:"2px 4px",borderRadius:6,fontSize:9,fontFamily:"Cascadia, monospace",border:n===Me.LIGHT?"1.5px solid white":"none"};switch(e){case ql.GREEN:Object.assign(a,{backgroundColor:"var(--background-color-badge)",color:"var(--color-badge)"});break;case ql.RED:Object.assign(a,{backgroundColor:"pink",color:"darkred"});break;case ql.BLUE:default:Object.assign(a,{background:"var(--color-promo)",color:"var(--color-surface-lowest)"})}return u.jsx("div",{className:"DropDownMenuItemBadge",style:a,children:t})};cf.displayName="DropdownMenuItemBadge",uU.Badge=cf;var Wn=uU,P$=({event:e,inputRef:t,hoveredFont:n,filteredFonts:a,onClose:i,onSelect:r,onHover:s})=>{if(!e[L.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===L.F)return t.current?.focus(),!0;if(e.key===L.ESCAPE)return i(),!0;if(e.key===L.ENTER)return n?.value&&r(n.value),!0;if(e.key===L.ARROW_DOWN)return n?.next?s(n.next.value):a[0]?.value&&s(a[0].value),!0;if(e.key===L.ARROW_UP)return n?.prev?s(n.prev.value):a[a.length-1]?.value&&s(a[a.length-1].value),!0},N$=Z.memo(({selectedFontFamily:e,hoveredFontFamily:t,onSelect:n,onHover:a,onLeave:i,onOpen:r,onClose:s})=>{let{container:o}=Za(),{fonts:d}=xa(),{showDeprecatedFonts:c}=gl(),[l,h]=k.useState(""),f=k.useRef(null),p=k.useMemo(()=>Array.from(hi.registered.entries()).filter(([I,{metadata:j}])=>!j.serverSide&&!j.fallback).map(([I,{metadata:j,fontFaces:T}])=>{let A={value:I,icon:j.icon??Zc,text:T[0]?.fontFace?.family??"Unknown"};return j.deprecated&&Object.assign(A,{deprecated:j.deprecated,badge:{type:ql.RED,placeholder:M("fontList.badge.old")}}),A}).sort((I,j)=>I.text.toLowerCase()>j.text.toLowerCase()?1:-1),[]),U=k.useMemo(()=>new Set(d.getSceneFamilies()),[e]),m=k.useMemo(()=>p.filter(I=>U.has(I.value)),[p,U]),g=k.useMemo(()=>p.filter(I=>!U.has(I.value)&&(c||!I.deprecated)),[p,U,c]),b=k.useMemo(()=>oC([...m,...g].filter(I=>I.text?.toLowerCase().includes(l))),[m,g,l]),x=k.useMemo(()=>{let I;return t?I=b.find(j=>j.value===t):e&&(I=b.find(j=>j.value===e)),!I&&l&&(b[0]?.value?a(b[0].value):i()),I},[t,e,l,b,a,i]),y=k.useCallback(I=>{P$({event:I,inputRef:f,hoveredFont:x,filteredFonts:b,onSelect:n,onHover:a,onClose:s})&&(I.preventDefault(),I.stopPropagation())},[x,b,n,a,s]);k.useEffect(()=>(r(),()=>{s()}),[]);let v=k.useMemo(()=>b.filter(I=>U.has(I.value)),[b,U]),w=k.useMemo(()=>b.filter(I=>!U.has(I.value)),[b,U]),S=(I,j)=>u.jsxs(Wn,{icon:I.icon,value:I.value,order:j,textStyle:{fontFamily:Gs({fontFamily:I.value})},hovered:I.value===x?.value,selected:I.value===e,tabIndex:I.value===e?0:-1,onClick:T=>{n(Number(T.currentTarget.value))},onMouseMove:()=>{x?.value!==I.value&&a(I.value)},children:[I.text,I.badge&&u.jsx(cf,{type:I.badge.type,children:I.badge.placeholder})]},I.value),C=[];return v.length&&C.push(u.jsx(df,{title:M("fontList.sceneFonts"),children:v.map(S)},"group_1")),w.length&&C.push(u.jsx(df,{title:M("fontList.availableFonts"),children:w.map((I,j)=>S(I,j+v.length))},"group_2")),u.jsxs(Py,{className:"properties-content",container:o,style:{width:"15rem"},onClose:s,onPointerLeave:i,onKeyDown:y,children:[u.jsx(Ny,{ref:f,placeholder:M("quickSearch.placeholder"),onChange:Ys(h,20)}),u.jsx(Oy,{className:"dropdown-menu fonts manual-hover",placeholder:M("fontList.empty"),children:C.length?C:null})]})},(e,t)=>e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),O$=({selectedFontFamily:e})=>{let t=k.useMemo(()=>!!(e&&!z$(e)),[e]);return u.jsx(fu,{asChild:!0,children:u.jsx("div",{children:u.jsx(_y,{standalone:!0,icon:A8,title:M("labels.showFonts"),className:"properties-trigger",testId:"font-family-show-fonts",active:t,onClick:()=>{}})})})},Xy=[{value:rt.Excalifont,icon:Ao,text:M("labels.handDrawn"),testId:"font-family-hand-drawn"},{value:rt.Nunito,icon:Zc,text:M("labels.normal"),testId:"font-family-normal"}
Line truncated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
${M("hints.firefox_clipboard_write")}`):new Error(M("alerts.couldNotCopyToClipboard"))}else throw new Error("Unsupported export type")},Z$=async(e,t,n,a)=>{let{exportBackground:i,viewBackgroundColor:r,fileHandle:s}=t,o=Q3(s);if(!s||!YN(o))throw new Error("fileHandle should exist and should be of type svg or png when resaving");t={...t,exportEmbedScene:!0};let{exportedElements:d,exportingFrame:c}=vu(e,t,!1);return await wu(o,d,t,n,{exportBackground:i,viewBackgroundColor:r,name:a,fileHandle:s,exportingFrame:c}),{fileHandle:s}},pU=({children:e,checked:t,onChange:n,className:a})=>u.jsxs("div",{className:te("Checkbox",a,{"is-checked":t}),onClick:i=>{n(!t,i),i.currentTarget.querySelector(".Checkbox-box").focus()},children:[u.jsx("button",{type:"button",className:"Checkbox-box",role:"checkbox","aria-checked":t,children:tI}),u.jsx("div",{className:"Checkbox-label",children:e})]}),K$=Y({name:"changeProjectName",label:"labels.fileTitle",trackEvent:!1,perform:(e,t,n)=>({appState:{...t,name:n},captureUpdate:$.EVENTUALLY}),PanelComponent:({appState:e,updateData:t,appProps:n,data:a,app:i})=>u.jsx(G$,{label:M("labels.fileTitle"),value:i.getName(),onChange:r=>t(r),ignoreFocus:a?.ignoreFocus??!1})}),q$=Y({name:"changeExportScale",label:"imageExportDialog.scale",trackEvent:{category:"export",action:"scale"},perform:(e,t,n)=>({appState:{...t,exportScale:n},captureUpdate:$.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let a=Ve(e),i=Tt(a,t)?ye(a,t):a;return u.jsx(u.Fragment,{children:Ff.map(r=>{let[s,o]=LP(i,dl,r),d=`${M("imageExportDialog.label.scale")} ${r}x (${s}x${o})`;return u.jsx(Ce,{size:"small",type:"radio",icon:`${r}x`,name:"export-canvas-scale",title:d,"aria-label":d,id:"export-canvas-scale",checked:r===t.exportScale,onChange:()=>n(r)},r)})})}}),Q$=Y({name:"changeExportBackground",label:"imageExportDialog.label.withBackground",trackEvent:{category:"export",action:"toggleBackground"},perform:(e,t,n)=>({appState:{...t,exportBackground:n},captureUpdate:$.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>u.jsx(pU,{checked:e.exportBackground,onChange:n=>t(n),children:M("imageExportDialog.label.withBackground")})}),Yy=Y({name:"changeExportEmbedScene",label:"imageExportDialog.tooltip.embedScene",trackEvent:{category:"export",action:"embedScene"},perform:(e,t,n)=>({appState:{...t,exportEmbedScene:n},captureUpdate:$.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>u.jsxs(pU,{checked:e.exportEmbedScene,onChange:n=>t(n),children:[M("imageExportDialog.label.embedScene"),u.jsx(ts,{label:M("imageExportDialog.tooltip.embedScene"),long:!0,children:u.jsx("div",{className:"excalidraw-tooltip-icon",children:lI})})]})}),K6=Y({name:"saveToActiveFile",label:"buttons.save",icon:Hh,trackEvent:{category:"export"},predicate:(e,t,n,a)=>!!a.props.UIOptions.canvasActions.saveToActiveFile&&!!t.fileHandle&&!t.viewModeEnabled,perform:async(e,t,n,a)=>{let i=!!t.fileHandle;try{let{fileHandle:r}=Hp(t.fileHandle)?await Z$(e,t,a.files,a.getName()):await r3(e,t,a.files,a.getName());return{captureUpdate:$.EVENTUALLY,appState:{...t,fileHandle:r,toast:i?{message:r?.name?M("toast.fileSavedToFilename").replace("{filename}",`"${r.name}"`):M("toast.fileSaved")}:null}}}catch(r){return r?.name!=="AbortError"?console.error(r):console.warn(r),{captureUpdate:$.EVENTUALLY}}},keyTest:e=>e.key===L.S&&e[L.CTRL_OR_CMD]&&!e.shiftKey}),Zy=Y({name:"saveFileToDisk",label:"exportDialog.disk_title",icon:Hh,viewMode:!0,trackEvent:{category:"export"},perform:async(e,t,n,a)=>{try{let{fileHandle:i}=await r3(e,{...t,fileHandle:null},a.files,a.getName());return{captureUpdate:$.EVENTUALLY,appState:{...t,openDialog:null,fileHandle:i,toast:{message:M("toast.fileSaved")}}}}catch(i){return i?.name!=="AbortError"?console.error(i):console.warn(i),{captureUpdate:$.EVENTUALLY}}},keyTest:e=>e.key===L.S&&e.shiftKey&&e[L.CTRL_OR_CMD],PanelComponent:({updateData:e})=>u.jsx(Ce,{type:"button",icon:aI,title:M("buttons.saveAs"),"aria-label":M("buttons.saveAs"),showAriaLabel:_t().editor.isMobile,hidden:!as,onClick:()=>e(null),"data-testid":"save-as-button"})}),hf=Y({name:"loadScene",label:"buttons.load",trackEvent:{category:"export"},predicate:(e,t,n,a)=>!!a.props.UIOptions.canvasActions.loadScene&&!t.viewModeEnabled,perform:async(e,t,n,a)=>{try{let{elements:i,appState:r,files:s}=await EP(t,e);return{elements:i,appState:r,files:s,captureUpdate:$.IMMEDIATELY}}catch(i){return i?.name==="AbortError"?(console.warn(i),!1):{elements:e,appState:{...t,errorMessage:i.message},files:a.files,captureUpdate:$.EVENTUALLY}}},keyTest:e=>e[L.CTRL_OR_CMD]&&e.key===L.O}),J$=Y({name:"exportWithDarkMode",label:"imageExportDialog.label.darkMode",trackEvent:{category:"export",action:"toggleTheme"},perform:(e,t,n)=>({appState:{...t,exportWithDarkMode:n},captureUpdate:$.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>u.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"-45px",marginBottom:"10px"},children:u.jsx(Y$,{value:e.exportWithDarkMode?Me.DARK:Me.LIGHT,o
Line truncated
|
|
|
|
|
|
|
|
`),a=[],i=0;for(let r=0;r<n.length;r++){let s=n[r],o=n[r+1];if(o){let d=t.indexOf(o,i);if(d>s.length+i){let c=d-(s.length+i);for(;c>0;)s+=" ",c--}}a.push(s),i=i+s.length}return a.join(`
|
|
|
|
|
|
|
|
`)},VV=(e,t,n)=>{let a=WV(e.text,e.originalText).split(`
|
|
|
|
|
|
|
|
`),i=[],r=0,s=0;for(let l of a){let h=r,f=h+l.length-1;i.push({line:l,startIndex:h,endIndex:f,lineNumber:s}),r=f+1,s++}let o=n,d=e.originalText.slice(n,n+t.length),c=[];for(let l of i){if(d==="")break;if(o>=l.startIndex&&o<=l.endIndex){let h=l.endIndex+1-o,f=l.line.slice(0,o-l.startIndex),p=d.slice(0,h);d=d.slice(h);let U=an(f,Xe(e),e.lineHeight);if(f===""&&(U.width=0),e.textAlign!=="left"&&l.line.length>0){let y=an(l.line,Xe(e),e.lineHeight),v=e.textAlign==="center"?(e.width-y.width)/2:e.width-y.width;U.width+=v}let{width:m,height:g}=an(p,Xe(e),e.lineHeight),b=U.width,x=l.lineNumber*U.height;c.push({offsetX:b,offsetY:x,width:m,height:g}),o+=h}}return c},GV=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&"),C5=NH((e,t,n)=>{if(!e||e===""){n([],null);return}let a=t.scene.getNonDeletedElements().filter(d=>q(d));a.sort((d,c)=>d.y-c.y);let i=[],r=new RegExp(GV(e),"gi");for(let d of a){let c=null,l=d.originalText;for(;(c=r.exec(l))!==null;){let h=XV(l,c.index,e),f=VV(d,e,c.index);f.length>0&&i.push({textElement:d,searchQuery:e,preview:h,index:c.index,matchedLines:f})}}let s=new Set(t.visibleElements.map(d=>d.id)),o=i.findIndex(d=>s.has(d.textElement.id))??null;n(i,o)},OV),rv=Ud("DefaultSidebarTrigger",e=>{let{DefaultSidebarTriggerTunnel:t}=hn();return u.jsx(t.In,{children:u.jsx(Qn.Trigger,{...e,className:"default-sidebar-trigger",name:oa.name})})});rv.displayName="DefaultSidebarTrigger";var sv=({children:e})=>{let{DefaultSidebarTabTriggersTunnel:t}=hn();return u.jsx(t.In,{children:e})};sv.displayName="DefaultTabTriggers";var xf=Object.assign(Ud("DefaultSidebar",({children:e,className:t,onDock:n,docked:a,...i})=>{let r=Kt(),s=At(),{DefaultSidebarTabTriggersTunnel:o}=hn(),d=r.openSidebar?.tab===Rs;return k.createElement(Qn,{...i,name:"default",key:"default",className:te("default-sidebar",t),docked:d||(a??r.defaultSidebarDockedPreference),onDock:d||n===!1||!n&&a!=null?void 0:Fh(n,c=>{s({defaultSidebarDockedPreference:c})})},u.jsxs(Qn.Tabs,{children:[u.jsx(Qn.Header,{children:u.jsxs(Qn.TabTriggers,{children:[u.jsx(Qn.TabTrigger,{tab:Rs,children:Yr}),u.jsx(Qn.TabTrigger,{tab:zc,children:Gf}),u.jsx(o.Out,{})]})}),u.jsx(Qn.Tab,{tab:zc,children:u.jsx(vW,{})}),u.jsx(Qn.Tab,{tab:Rs,children:u.jsx(FV,{})}),e]}))}),{Trigger:rv,TabTriggers:sv}),YV="small",ZV=e=>u.jsxs("label",{className:te("ToolIcon ToolIcon__LaserPointer",`ToolIcon_size_${YV}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[u.jsx("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":"toolbar-LaserPointer"}),u.jsx("div",{className:"ToolIcon__icon",children:$8})]}),KV=({canvasRef:e,setError:t})=>{let n=e.current;if(!n)return;let a=n.parentElement;a&&(a.style.background="",t(null),n.replaceChildren())},lv=async({canvasRef:e,mermaidToExcalidrawLib:t,mermaidDefinition:n,setError:a,data:i})=>{let r=e.current,s=r?.parentElement;if(!(!r||!s)){if(!n){KV({canvasRef:e,setError:a});return}try{let o=await t.api,d;try{d=await o.parseMermaidToExcalidraw(n)}catch{d=await o.parseMermaidToExcalidraw(n.replace(/"/g,"'"))}let{elements:c,files:l}=d;a(null),i.current={elements:jh(c,{regenerateIds:!0}),files:l};let h=await cd({elements:i.current.elements,files:i.current.files,exportPadding:dl,maxWidthOrHeight:Math.max(s.offsetWidth,s.offsetHeight)*window.devicePixelRatio});try{await Ho(h)}catch(f){throw f.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(M("canvasError.canvasTooBig")):f}s.style.background="var(--default-bg-color)",r.replaceChildren(h)}catch(o){throw s.style.background="var(--default-bg-color)",n&&a(o),o}}},vU=e=>{Or.set(io.MERMAID_TO_EXCALIDRAW,e)},ov=({app:e,data:t,text:n,shouldSaveMermaidDataToStorage:a})=>{let{elements:i,files:r}=t.current;i.length&&(e.addElementsFromPasteOrLibrary({elements:i,files:r,position:"center",fitToContent:!0}),e.setOpenDialog(null),a&&n&&vU(n))},dv=({children:e})=>u.jsx("div",{className:"ttd-dialog-panels",children:e}),Mh=({label:e,children:t,panelAction:n,panelActionDisabled:a=!1,onTextSubmitInProgess:i,renderTopRight:r,renderSubmitShortcut:s,renderBottomRight:o})=>u.jsxs("div",{className:"ttd-dialog-panel",children:[u.jsxs("div",{className:"ttd-dialog-panel__header",children:[u.jsx("label",{children:e}),r?.()]}),t,u.jsxs("div",{className:te("ttd-dialog-panel-button-container",{invisible:!n}),style:{display:"flex",alignItems:"center"},children:[u.jsxs(sr,{className:"ttd-dialog-panel-button",onSelect:n?n.action:()=>{},disabled:a||i,children:[u.jsxs("div",{className:te({invisible:i}),children:[n?.label,n?.icon&&u.jsx("span",{children:n.icon})]}),i&&u.jsx(vi,{})]}),!a&&!i&&s?.(),o?.()]})]}),cv=({input:e,placeholder:t,onChange:n,onKeyboardSubmit:a})=>{let i=k.useRef(null),r=k.useRef(a);return r.current=a,k.useEffect(()=>{if(!r.current)return;let s=i.current;if(s){let o=d=>{d[L.CTRL_OR_CMD]&&d.key===L.ENTER&&(d.preventDefault(),r.current?.())};return s.addEventListener("keydown",o),()=>{s.removeEventListener("keydown",o)}}},[]),u.jsx("textarea",{className
Line truncated
|
|
|
|
|
|
|
|
A[Christmas] -->|Get money| B(Go shopping)
|
|
|
|
|
|
|
|
B --> C{Let me think}
|
|
|
|
|
|
|
|
C -->|One| D[Laptop]
|
|
|
|
|
|
|
|
C -->|Two| E[iPhone]
|
|
|
|
|
|
|
|
C -->|Three| F[Car]`,I5=Ys(vU,300),JV=({mermaidToExcalidrawLib:e})=>{let[t,n]=k.useState(()=>Or.get(io.MERMAID_TO_EXCALIDRAW)||QV),a=k.useDeferredValue(t.trim()),[i,r]=k.useState(null),s=k.useRef(null),o=k.useRef({elements:[],files:null}),d=xa();k.useEffect(()=>{lv({canvasRef:s,data:o,mermaidToExcalidrawLib:e,setError:r,mermaidDefinition:a}).catch(l=>{x8()&&console.error("Failed to parse mermaid definition",l)}),I5(a)},[a,e]),k.useEffect(()=>()=>{I5.flush()},[]);let c=()=>{ov({app:d,data:o,text:t,shouldSaveMermaidDataToStorage:!0})};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"ttd-dialog-desc",children:u.jsx(Na,{i18nKey:"mermaid.description",flowchartLink:l=>u.jsx("a",{href:"https://mermaid.js.org/syntax/flowchart.html",children:l}),sequenceLink:l=>u.jsx("a",{href:"https://mermaid.js.org/syntax/sequenceDiagram.html",children:l}),classLink:l=>u.jsx("a",{href:"https://mermaid.js.org/syntax/classDiagram.html",children:l})})}),u.jsxs(dv,{children:[u.jsx(Mh,{label:M("mermaid.syntax"),children:u.jsx(cv,{input:t,placeholder:"Write Mermaid diagram defintion here...",onChange:l=>n(l.target.value),onKeyboardSubmit:()=>{c()}})}),u.jsx(Mh,{label:M("mermaid.preview"),panelAction:{action:()=>{c()},label:M("mermaid.button"),icon:dc},renderSubmitShortcut:()=>u.jsx(uv,{}),children:u.jsx(hv,{canvasRef:s,loaded:e.loaded,error:i})})]})]})},eG=JV,fv=e=>{let t=At(),n=k.useRef(null),a=k.useRef(0);return u.jsx(my,{ref:n,className:"ttd-dialog-tabs-root",value:e.tab,onValueChange:i=>{if(!i)return;let r=n.current?.closest(".Modal__content");if(r){let s=r.offsetHeight||0;s>a.current&&(a.current=s,r.style.minHeight=`min(${a.current}px, 100%)`)}e.dialog==="ttd"&&w8(["text-to-diagram","mermaid"],i)&&t({openDialog:{name:e.dialog,tab:i}})},children:e.children})};fv.displayName="TTDDialogTabs";var tG=fv,pv=({children:e,...t})=>u.jsx(gy,{className:"ttd-dialog-triggers",...t,children:e});pv.displayName="TTDDialogTabTriggers";var vf=({children:e,tab:t,onSelect:n,...a})=>u.jsx(by,{value:t,asChild:!0,onSelect:n,children:u.jsx("button",{type:"button",className:"ttd-dialog-tab-trigger",...a,children:e})});vf.displayName="TTDDialogTabTrigger";var wf=({tab:e,children:t,...n})=>u.jsx(yy,{...n,value:e,children:t});wf.displayName="TTDDialogTab";var F1=3,ys=1e3,nG=$t(null),aG=$t(null),Uv=e=>{let t=Kt();return t.openDialog?.name!=="ttd"?null:u.jsx(iG,{...e,tab:t.openDialog.tab})},iG=Ud("TTDDialogBase",({tab:e,...t})=>{let n=xa(),a=At(),i=k.useRef(null),[r,s]=bt(aG),[o,d]=k.useState(r?.prompt??""),c=o.trim(),l=S=>{d(S.target.value),s(C=>({generatedResponse:C?.generatedResponse??null,prompt:S.target.value}))},[h,f]=k.useState(!1),[p,U]=bt(nG),m=async()=>{if(c.length>ys||c.length<F1||h||p?.rateLimitRemaining===0||"__fallback"in t){c.length<F1&&w(new Error(`Prompt is too short (min ${F1} characters)`)),c.length>ys&&w(new Error(`Prompt is too long (max ${ys} characters)`));return}try{f(!0),qe("ai","generate","ttd");let{generatedResponse:S,error:C,rateLimit:I,rateLimitRemaining:j}=await t.onTextSubmit(c);if(typeof S=="string"&&s(T=>({generatedResponse:S,prompt:T?.prompt??null})),ro(I)&&ro(j)&&U({rateLimit:I,rateLimitRemaining:j}),C){w(C);return}if(!S){w(new Error("Generation failed"));return}try{await lv({canvasRef:i,data:y,mermaidToExcalidrawLib:b,setError:w,mermaidDefinition:S}),qe("ai","mermaid parse success","ttd")}catch(T){console.info(`%cTTD mermaid render errror: ${T.message}`,"color: red"),console.info(`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
|
|
|
|
TTD mermaid definition render errror: ${T.message}`,"color: yellow"),qe("ai","mermaid parse failed","ttd"),w(new Error("Generated an invalid diagram :(. You may also try a different prompt."))}}catch(S){let C=S.message;(!C||C==="Failed to fetch")&&(C="Request failed"),w(new Error(C))}finally{f(!1)}},g=k.useRef(m);g.current=m;let[b,x]=k.useState({loaded:!1,api:ne(()=>import("./index-wvBhvr2O.chunk.mjs").then(S=>S.N),__vite__mapDeps([62,63,5,64,3,4,6]),import.meta.url)});k.useEffect(()=>{(async()=>(await b.api,x(S=>({...S,loaded:!0}))))()},[b.api]);let y=k.useRef({elements:[],files:null}),[v,w]=k.useState(null);return u.jsx(ya,{className:"ttd-dialog",onCloseRequest:()=>{n.setOpenDialog(null)},size:1200,title:!1,...t,autofocus:!1,children:u.jsxs(tG,{dialog:"ttd",tab:e,children:["__fallback"in t&&t.__fallback?u.jsx("p",{className:"dialog-mermaid-title",children:M("mermaid.title")}):u.jsxs(pv,{children:[u.jsx(vf,{tab:"text-to-diagram",children:u.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[M("labels.textToDiagram"),u.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"1px 6px",marginLeft:"10px",fontSize:10,borderRadius:"12px",background:"var(--color-promo)",color:"var(--color-surface-lowest)"},children:"AI Beta"})]})}),u.jsx(vf,{tab:"mermaid",children:"Mermaid"})]}),u.jsx(wf,{className:"ttd-dialog-content",tab:"mermaid",children:u.jsx(eG,{mermaidToExcalidrawLib:b})}),!("__fallback"in t)&&u.jsxs(wf,{className:"ttd-dialog-content",tab:"text-to-diagram",children:[u.jsx("div",{className:"ttd-dialog-desc",children:"Currently we use Mermaid as a middle step, so you'll get best results if you describe a diagram, workflow, flow chart, and similar."}),u.jsxs(dv,{children:[u.jsx(Mh,{label:M("labels.prompt"),panelAction:{action:m,label:"Generate",icon:dc},onTextSubmitInProgess:h,panelActionDisabled:c.length>ys||p?.rateLimitRemaining===0,renderTopRight:()=>p?u.jsxs("div",{className:"ttd-dialog-rate-limit",style:{fontSize:12,marginLeft:"auto",color:p.rateLimitRemaining===0?"var(--color-danger)":void 0},children:[p.rateLimitRemaining," requests left today"]}):null,renderSubmitShortcut:()=>u.jsx(uv,{}),renderBottomRight:()=>{if(typeof r?.generatedResponse=="string")return u.jsxs("div",{className:"excalidraw-link",style:{marginLeft:"auto",fontSize:14},onClick:()=>{typeof r?.generatedResponse=="string"&&(vU(r.generatedResponse),a({openDialog:{name:"ttd",tab:"mermaid"}}))},children:["View as Mermaid",u.jsx(xu,{icon:dc})]});let S=c.length/ys;return S>.8?u.jsxs("div",{style:{marginLeft:"auto",fontSize:12,fontFamily:"monospace",color:S>1?"var(--color-danger)":void 0},children:["Length: ",c.length,"/",ys]}):null},children:u.jsx(cv,{onChange:l,input:o,placeholder:"Describe what you want to see...",onKeyboardSubmit:()=>{g.current()}})}),u.jsx(Mh,{label:"Preview",panelAction:{action:()=>{console.info("Panel action clicked"),ov({app:n,data:y})},label:"Insert",icon:dc},children:u.jsx(hv,{canvasRef:i,error:v,loaded:b.loaded})})]})]})]})})}),rG=.01,wi=(e,t)=>!(t==="height"&&q(e)||t==="width"&&q(e)||t==="angle"&&de(e)),en=(e,t)=>{let n=e+t/2;return n-n%t},Ch=(e,t,n)=>Object.keys(e).map(a=>({original:(n??t).get(a),latest:t.get(a)})).filter(a=>a.original!==void 0&&a.latest!==void 0),Yo=(e,t,n,a,i,r,s,o=!0)=>{let d=a.get(n.id);if(!d)return;let[c,l]=[n.x+n.width/2,n.y+n.height/2],[h,f]=H(E(n.x,n.y),E(c,l),n.angle),p=e-h,U=t-f,[m,g]=H(E(e,t),E(c+p,l+U),-n.angle);W(d,{x:m,y:g},o),Ef(d,a,i,r);let b=me(n,s);if(b){let x=a.get(b.id);x&&W(x,{x:b.x+p,y:b.y+U},o)}},wU=(e,t)=>{let n=Rr(t).map(a=>nt(e,a).reduce((i,r)=>(i[r.id]=!0,i),{}));return e.filter(a=>!Js(a)).forEach(a=>{n.push({[a.id]:!0})}),n},Ef=(e,t,n,a,i)=>{he(e)?th([e],t,n,a,!0,[],i?.zoom):xn(e,t,i)},sG=({label:e,icon:t,dragInputCallback:n,value:a,elements:i,editable:r=!0,shouldKeepAspectRatio:s,property:o,scene:d,appState:c,sensitivity:l=1})=>{let h=xa(),f=k.useRef(null),p=k.useRef(null),[U,m]=k.useState(a.toString()),g=k.useRef(null);g.current||(g.current={originalAppState:ci(c),originalElements:i,lastUpdatedValue:U,updatePending:!1}),k.useEffect(()=>{let y=a.toString();m(y),g.current.lastUpdatedValue=y},[a]);let b=(y,v,w)=>{if(!g.current.updatePending)return!1;g.current.updatePending=!1;let S=Number(y);if(isNaN(S)){m(a.toString());return}let C=Number(S.toFixed(2)),I=Number(a);(isNaN(I)||Math.abs(C-I)>=rG)&&(g.current.lastUpdatedValue=y,n({accumulatedChange:0,instantChange:0,originalElements:v,originalElementsMap:h.scene.getNonDeletedElementsMap(),shouldKeepAspectRatio:s,shouldChangeByStepSize:!1,scene:d,nextValue:C,property:o,originalAppState:w,setInputValue:j=>m(String(j))}),h.syncActionResult({captureUpdate:$.IMMEDIATELY}))},x=k.useRef({});return x.current.handleInputValue=b,k.useEffect(()=>{let y=f.current,v=x.current;return()=>{let w=y?.value;w&&v.handleInputValue?.(w,g.current.originalElements,g.current.originalAppState),window.removeEventListener("pointermove",v.onPointerMove,!1),window.removeEventListener("pointerup",v.onPointerUp,
Line truncated
|
|
|
|
|
|
|
|
`).reduce((B,G,le,se)=>B.concat(le?B[le-1]+se[le-1].length+1:P),[]).reverse()},v=P=>{P.target instanceof HTMLCanvasElement&&(P.preventDefault(),P.stopPropagation())},w=!1,S=()=>{if(R)return;R=!0,C();let P=gi.getScene(i)?.getElement(i.id);if(!P)return;let z=Ht(P,o.scene.getNonDeletedElementsMap());if(z){if(h.value.trim()){let F=Ui(z);!F||F!==i.id?W(z,{boundElements:(z.boundElements||[]).concat({type:"text",id:i.id})}):xe(z)&&ud(z)}else W(z,{boundElements:z.boundElements?.filter(F=>!q(F))});cn(P,z,o.scene.getNonDeletedElementsMap())}n({viaKeyboard:w,nextOriginalText:h.value})},C=()=>{h.onblur=null,h.oninput=null,h.onkeydown=null,N&&N.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("wheel",v,!0),window.removeEventListener("pointerdown",T),window.removeEventListener("pointerup",I),window.removeEventListener("blur",S),window.removeEventListener("beforeunload",S),A(),D(),h.remove()},I=P=>{window.removeEventListener("pointerup",I);let z=P?.target,F=z instanceof HTMLElement&&z.classList.contains("properties-trigger");setTimeout(()=>{h.onblur=S,F||h.focus()})},j=()=>{h.onblur=null,window.addEventListener("pointerup",I),window.addEventListener("blur",S)},T=P=>{let z=P?.target;if(P.button===Ai.WHEEL){z instanceof HTMLTextAreaElement&&(P.preventDefault(),o.handleCanvasPanUsingWheelOrSpaceDrag(P)),j();return}let F=z instanceof HTMLElement&&z.classList.contains("properties-trigger");(P.target instanceof HTMLElement||P.target instanceof SVGElement)&&P.target.closest(`.${Xs.SHAPE_ACTIONS_MENU}, .${Xs.ZOOM_ACTIONS}`)&&!wr(P.target)||F?j():P.target instanceof HTMLCanvasElement&&!fi()&&requestAnimationFrame(()=>{S()})},A=o.scene.onUpdate(()=>{l(),document.activeElement?.closest(".properties-content")||h.focus()}),D=o.onScrollChangeEmitter.on(()=>{l()}),R=!1;d&&h.select(),I();let N=null;r&&"ResizeObserver"in window?(N=new window.ResizeObserver(()=>{l()}),N.observe(r)):window.addEventListener("resize",l),h.onpointerdown=P=>P.stopPropagation(),requestAnimationFrame(()=>{window.addEventListener("pointerdown",T,{capture:!0})}),window.addEventListener("beforeunload",S),s?.querySelector(".excalidraw-textEditorContainer").appendChild(h)},OY=Y({name:"autoResize",label:"labels.autoResize",icon:null,trackEvent:{category:"element"},predicate:(e,t,n,a)=>{let i=ye(e,t);return i.length===1&&q(i[0])&&!i[0].autoResize},perform:(e,t,n,a)=>{let i=ye(e,t);return{appState:t,elements:e.map(r=>{if(r.id===i[0].id&&q(r)){let s=an(r.originalText,Xe(r),r.lineHeight);return pe(r,{autoResize:!0,width:s.width,height:s.height,text:r.originalText})}return r}),captureUpdate:$.IMMEDIATELY}}}),FY=e=>{let t=["flowchart","graph","sequenceDiagram","classDiagram","stateDiagram","stateDiagram-v2","erDiagram","journey","gantt","pie","quadrantChart","requirementDiagram","gitGraph","C4Context","mindmap","timeline","zenuml","sankey","xychart","block"];return new RegExp(`^(?:%%{.*?}%%[\\s\\n]*)?\\b(?:${t.map(n=>`\\s*${n}(-beta)?`).join("|")})\\b`).test(e.trim())},wv=({canvas:e,rc:t,newElement:n,elementsMap:a,allElementsMap:i,scale:r,appState:s,renderConfig:o})=>{if(e){let[d,c]=mp(e,r),l=gp({canvas:e,scale:r,normalizedWidth:d,normalizedHeight:c});l.save(),l.scale(s.zoom.value,s.zoom.value),n&&n.type!=="selection"?vr(n,a,i,t,l,o,s):l.clearRect(0,0,d,c)}},zY=Oh(e=>{wv(e)},{trailing:!0}),BY=(e,t)=>{if(t){zY(e);return}wv(e)},HY=e=>{let t=k.useRef(null);return k.useEffect(()=>{t.current&&BY({canvas:t.current,scale:e.scale,newElement:e.appState.newElement,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,rc:e.rc,renderConfig:e.renderConfig,appState:e.appState},EU())}),u.jsx("canvas",{className:"excalidraw__canvas",style:{width:e.appState.width,height:e.appState.height},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:t})},$Y=HY,Ev=Z.createContext(null),kv=Z.createContext(null),Sv={viewport:{isMobile:!1,isLandscape:!1},editor:{isMobile:!1,canFitSidebar:!1},isTouchScreen:!1},kU=Z.createContext(Sv);kU.displayName="DeviceContext";var SU=Z.createContext({container:null,id:null});SU.displayName="ExcalidrawContainerContext";var MU=Z.createContext([]);MU.displayName="ExcalidrawElementsContext";var CU=Z.createContext({...za(),width:0,height:0,offsetLeft:0,offsetTop:0});CU.displayName="ExcalidrawAppStateContext";var IU=Z.createContext(()=>{console.warn("Uninitialized ExcalidrawSetAppStateContext context!")});IU.displayName="ExcalidrawSetAppStateContext";var TU=Z.createContext(null);TU.displayName="ExcalidrawActionManagerContext";var xa=()=>k.useContext(Ev),gl=()=>k.useContext(kv),_t=()=>k.useContext(kU),Za=()=>k.useContext(SU),Su=()=>k.useContext(MU),gd=()=>k.useContext(CU),At=()=>k.useContext(IU),En=()=>k.useContext(TU),Pl=!1,X1=0,mr=!1,Nl=!1,W1=!1,V1={horizontal:null,vertical:null},ji=0,Ol=!1,G1=new Map,Gd=!1,Z5=0,K5=!1,Fl=null,Le={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},XY=class Mv extends Z.Component{constructor(t){super(t),_(this,"canvas"),_(this,"interactiveCanvas",null),_(this,"rc"),_(this
Line truncated
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
html, body {
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
color: ${this.state.theme===Me.DARK?"white":"black"};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
body {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
gap: 1rem;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.Spinner {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
margin-left: auto;
|
|
|
|
|
|
|
|
margin-right: auto;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.Spinner svg {
|
|
|
|
|
|
|
|
animation: rotate 1.6s linear infinite;
|
|
|
|
|
|
|
|
transform-origin: center center;
|
|
|
|
|
|
|
|
width: 40px;
|
|
|
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.Spinner circle {
|
|
|
|
|
|
|
|
stroke: currentColor;
|
|
|
|
|
|
|
|
animation: dash 1.6s linear 0s infinite;
|
|
|
|
|
|
|
|
stroke-linecap: round;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes rotate {
|
|
|
|
|
|
|
|
100% {
|
|
|
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes dash {
|
|
|
|
|
|
|
|
0% {
|
|
|
|
|
|
|
|
stroke-dasharray: 1, 300;
|
|
|
|
|
|
|
|
stroke-dashoffset: 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
50% {
|
|
|
|
|
|
|
|
stroke-dasharray: 150, 300;
|
|
|
|
|
|
|
|
stroke-dashoffset: -200;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
100% {
|
|
|
|
|
|
|
|
stroke-dasharray: 1, 300;
|
|
|
|
|
|
|
|
stroke-dashoffset: -280;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<div class="Spinner">
|
|
|
|
|
|
|
|
<svg
|
|
|
|
|
|
|
|
viewBox="0 0 100 100"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<circle
|
|
|
|
|
|
|
|
cx="50"
|
|
|
|
|
|
|
|
cy="50"
|
|
|
|
|
|
|
|
r="46"
|
|
|
|
|
|
|
|
stroke-width="8"
|
|
|
|
|
|
|
|
fill="none"
|
|
|
|
|
|
|
|
stroke-miter-limit="10"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>Generating...</div>
|
|
|
|
|
|
|
|
`)};else{let U;p.code==="ERR_GENERATION_INTERRUPTED"?U="Generation was interrupted...":U=p.message||"Generation failed",l={intrinsicSize:{w:r.width,h:r.height},type:"document",srcdoc:()=>co(`
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
html, body {
|
|
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
body {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
color: ${Ee.red[3]};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
h1, h3 {
|
|
|
|
|
|
|
|
margin-top: 0;
|
|
|
|
|
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<h1>Error!</h1>
|
|
|
|
|
|
|
|
<h3>${U}</h3>
|
|
|
|
|
|
|
|
`)}}}else l=_s(dp(r.link||""));let h=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state==="active",f=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state==="hover";return u.jsx("div",{className:te("excalidraw__embeddable-container",{"is-hovered":f}),style:{transform:d?`translate(${s-this.state.offsetLeft}px, ${o-this.state.offsetTop}px) scale(${t})`:"none",display:d?"block":"none",opacity:m7(r,wn(r,this.scene.getNonDeletedElementsMap()),this.elementsPendingErasure,null,this.state.openDialog?.name==="elementLinkSelector"?o8:1),"--embeddable-radius":`${da(Math.min(r.width,r.height),r)}px`},children:u.jsxs("div",{className:"excalidraw__embeddable-container__inner",style:{width:d?`${r.width}px`:0,height:d?`${r.height}px`:0,transform:d?`rotate(${r.angle}rad)`:"none",pointerEvents:h?hs.enabled:hs.disabled},children:[f&&u.jsx("div",{className:"excalidraw__embeddable-hint",children:M("buttons.embeddableInteractionButton")}),u.jsx("div",{className:"excalidraw__embeddable__outer",style:{padding:`${r.strokeWidth}px`},children:(Un(r)?this.props.renderEmbeddable?.(r,this.state):null)??u.jsx("iframe",{ref:p=>this.cacheEmbeddableRef(r,p),className:"excalidraw__embeddable",srcDoc:l?.type==="document"?l.srcdoc(this.state.theme):void 0,src:l?.type!=="document"?l?.link??"":void 0,scrolling:"no",referrerPolicy:"no-referrer-when-downgrade",title:"Excalidraw Embedded Content",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sandbox:`${l?.sandbox?.allowSameOrigin?"allow-same-origin":""} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`})})]})},r.id)})})}toggleOverscrollBehavior(t){document.documentElement.style.overscrollBehaviorX=t.type==="pointerenter"?"none":"auto"}render(){let t=this.scene.getSelectedElements(this.state),{renderTopRightUI:n,renderCustomStats:a}=this.props,i=this.scene.getSceneNonce(),{elementsMap:r,visibleElements:s}=this.renderer.getRenderableElements({sceneNonce:i,zoom:this.state.zoom,offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,height:this.state.height,width:this.state.width,editingTextElement:this.state.editingTextElement,newElementId:this.state.newElement?.id,pendingImageElementId:this.state.pendingImageElementId});this.visibleElements=s;let o=this.scene.getNonDeletedElementsMap(),d="setPointerCapture"in HTMLElement.prototype?!1:this.state.selectionElement||this.state.newElement||this.state.selectedElementsAreBeingDragged||this.state.resizingElement||this.state.activeTool.type==="laser"&&this.state.cursorButton==="down",c=t[0];return u.jsx("div",{className:te("excalidraw excalidraw-container",{"excalidraw--view-mode":this.state.viewModeEnabled||this.state.openDialog?.name==="elementLinkSelector","excalidraw--mobile":this.device.editor.isMobile}),style:{"--ui-pointerEvents":d?hs.disabled:hs.enabled,"--right-sidebar-width":"302px"},ref:this.excalidrawContainerRef,onDrop:this.handleAppOnDrop,tabIndex:0,onKeyDown:this.props.handleKeyboardGlobally?void 0:this.onKeyDown,onPointerEnter:this.toggleOverscrollBehavior,onPointerLeave:this.toggleOverscrollBehavior,children:u.jsx(Ev.Provider,{value:this,children:u.jsx(kv.Provider,{value:this.props,children:u.jsx(SU.Provider,{value:this.excalidrawContainerValue,children:u.jsx(kU.Provider,{value:this.device,children:u.jsx(IU.Provider,{value:this.setAppState,children:u.jsx(CU.Provider,{value:this.state,children:u.jsxs(MU.Provider,{value:this.scene.getNonDeletedElements(),children:[u.jsxs(TU.Provider,{value:this.actionManager,children:[u.jsx(YG,{canvas:this.canvas,appState:this.state,files:this.files,setAppState:this.setAppState,actionManager:this.actionManager,elements:this.scene.getNonDeletedElements(),onLockToggle:this.toggleLock,onPenModeToggle:this.togglePenMode,onHandToolToggle:this.onHandToolToggle,langCode:Wo().code,renderTopRightUI:n,renderCustomStats:a,showExitZenModeBtn:typeof this.props?.zenModeEnabled>"u"&&this.state.zenModeEnabled,UIOptions:this.props.UIOptions,onExportImage:this.onExportImage,renderWelcomeScreen:!this.state.isLoading&&this.state.showWelcomeScreen&&this.state.activeTool.type==="selection"&&!this.state.zenModeEnabled&&!this.scene.getElementsIncludingDeleted().length,app:this,isCollaborating:this.props.isCollaborating,generateLinkForSelection:this.props.generateLinkForSelection,customCommandPaletteItems:this.props.customCommandPaletteItems,mountCommandPalette:this.props.mountCommandPalette,children:this.props.children}),u.jsx("div",{className:"excalidraw-textEditorContainer"}),u.jsx("div",{className:"excalidraw-contextMenuContainer"}),u.jsx("div",{className:"excalidraw-eye-dropper-container"}),u.jsx(IY,{trails:[this.laserTrails,this.eraserTrail]}),t.length===1&&this.state.openDialog?.name!=="elementLinkSelector"&&this.state.showHyperlinkPopup&&u.jsx(EX,{element:c,elementsMap:o,setAp
Line truncated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`),n)}}addTextFromPaste(t,n=!1){let{x:a,y:i}=Ge({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),r={x:a,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roundness:null,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:t,fontSize:this.state.currentItemFontSize,fontFamily:this.state.currentItemFontFamily,textAlign:Jo,verticalAlign:Nc,locked:!1},s=Xe({fontSize:r.fontSize,fontFamily:r.fontFamily}),o=Zr(r.fontFamily),[d,,c]=M7(this.state),l=Math.max(Math.min((c-d)*.5,800),200),h=10,f=i,p=n?[t]:t.split(`
|
|
|
|
|
|
|
|
`),U=p.reduce((m,g,b)=>{let x=Zs(g).trim();if(x.length){let y=this.getTopLayerFrameAtSceneCoords({x:a,y:f}),v=an(x,s,o),w=v.width>l,S=w?is(x,s,l):x;v=w?an(S,s,o):v;let C=a-v.width/2,I=f-v.height/2,j=jn({...r,x:C,y:I,text:S,originalText:x,lineHeight:o,autoResize:!w,frameId:y?y.id:null});m.push(j),f+=j.height+h}else p[b-1]?.trim()&&(f+=ad(r.fontSize,o)+h);return m},[]);U.length!==0&&(this.scene.insertElements(U),this.setState({selectedElementIds:De(Object.fromEntries(U.map(m=>[m.id,!0])),this.state)}),!n&&U.length>1&&K5===!1&&!this.device.editor.isMobile&&(this.setToast({message:M("toast.pasteAsSingleElement",{shortcut:V("CtrlOrCmd+Shift+V")}),duration:5e3}),K5=!0),this.store.shouldCaptureIncrement())}handleTextWysiwyg(t,{isExistingElement:n=!1}){let a=this.scene.getElementsMapIncludingDeleted(),i=(r,s)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(o=>o.id===t.id&&q(o)?pe(o,{originalText:r,isDeleted:s??o.isDeleted,...K7(o,Ht(o,a),a,r)}):o)])};NY({id:t.id,canvas:this.canvas,getViewportCoords:(r,s)=>{let{x:o,y:d}=Nn({sceneX:r,sceneY:s},this.state);return[o-this.state.offsetLeft,d-this.state.offsetTop]},onChange:ft(r=>{i(r,!1),F0(t)&&xn(t,this.scene.getNonDeletedElementsMap())}),onSubmit:ft(({viaKeyboard:r,nextOriginalText:s})=>{let o=!s.trim();if(i(s,o),!o&&r){let d=t.containerId?t.containerId:t.id;Wt.flushSync(()=>{this.setState(c=>({selectedElementIds:De({...c.selectedElementIds,[d]:!0},c)}))})}o&&L7(this.scene.getNonDeletedElements(),[t]),(!o||n)&&this.store.shouldCaptureIncrement(),Wt.flushSync(()=>{this.setState({newElement:null,editingTextElement:null})}),this.state.activeTool.locked&&Ma(this.interactiveCanvas,this.state),this.focusContainer()}),element:t,excalidrawContainer:this.excalidrawContainerRef.current,app:this,autoSelect:!this.device.isTouchScreen}),this.deselectElements(),i(t.originalText,!1)}deselectElements(){this.setState({selectedElementIds:De({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getTextElementAtPosition(t,n){let a=this.getElementAtPosition(t,n,{includeBoundTextElement:!0});return a&&q(a)&&!a.isDeleted?a:null}getElementAtPosition(t,n,a){let i=this.getElementsAtPosition(t,n,a?.includeBoundTextElement,a?.includeLockedElements);if(i.length>1){if(a?.preferSelected){for(let s=i.length-1;s>-1;s--)if(this.state.selectedElementIds[i[s].id])return i[s]}let r=i[i.length-1];return Es({x:t,y:n,element:r,shape:ri(r,this.scene.getNonDeletedElementsMap()),threshold:this.getElementHitThreshold()/2,frameNameBound:de(r)?this.frameNameBoundsCache.get(r):null})?r:i[i.length-2]}return i.length===1?i[0]:null}getElementsAtPosition(t,n,a=!1,i=!1){let r=[],s=this.scene.getNonDeletedElementsMap();return(a&&i?this.scene.getNonDeletedElements():this.scene.getNonDeletedElements().filter(o=>(i||!o.locked)&&(a||!(q(o)&&o.containerId)))).filter(o=>this.hitElement(t,n,o)).filter(o=>{let d=wn(o,s);return d&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?Ig({x:t,y:n},d,s):!0}).filter(o=>Pi(o)?(r.push(o),!1):!0).concat(r)}getElementHitThreshold(){return UM/this.state.zoom.value}hitElement(t,n,a,i=!0){if(i&&this.state.selectedElementIds[a.id]&&W3([a],this.state)){let r=aD(a,this.scene.getNonDeletedElementsMap(),Re(a)?0:this.getElementHitThreshold());if(qc(E(t,n),r))return!0}return l7(t,n,d7(a,this.scene.getNonDeletedElementsMap()))?!0:Es({x:t,y:n,element:a,shape:ri(a,this.scene.getNonDeletedElementsMap()),threshold:this.getElementHitThreshold(),frameNameBound:de(a)?this.frameNameBoundsCache.get(a):null})}getTextBindableContainerAtPosition(t,n){let a=this.scene.getNonDeletedElements(),i=this.scene.getSelectedElements(this.state);if(i.length===1)return Dr(i[0],!1)?i[0]:null;let r=null;for(let s=a.length-1;s>=0;--s){if(a[s].isDeleted)continue;let[o,d,c,l]=fe(a[s],this.scene.getNonDeletedElementsMap());if(xe(a[s])&&Es({x:t,y:n,element:a[s],shape:ri(a[s],this.scene.getNonDeletedElementsMap()),threshold:this.getElementHitThreshold()})){r=a[s];break}else if(o<t&&t<c&&d<n&&n<l){r=a[s];break}}return Dr(r,!1)?r:null}handleHoverSelectedLinearElement(t,n,a){let i=this.scene.getNonDeletedElementsMap(),r=Q.getElement(t.elementId,i);if(r)if(this.state.selectedLinearElement){let s=-1,o=null;Es({x:n,y:a,element:r,shape:ri(r,this.scene.getNonDeletedElementsMap())})?(s=Q.getPointIndexUnderCursor(r,i,this.state.zoom,n,a),o=Q.getSegmentMidpointHitCoords(t,{x:n,y:a},this.state,this.scene.getNonDeletedElementsMap()),(J(r)?s===0||s===r.points.length-1:s>=0)||o?$e(this.interactiveCanvas,ze.POINTER):this.hitElement(n,a,r)&&$e(this.interactiveCanvas,ze.MOVE)):this.hitElement(n,a,r)&&(!J(r)||!(r.startBinding||r.endBinding))&&$e(this.interactiveCanvas,ze.MOVE),this.state.selectedLinearElement.hoverPointIndex!==s&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:s}}),Q.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,o)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,
Line truncated
|
|
|
|
|
|
|
|
//# sourceMappingURL=percentages-BXMCSKIN-D6x-nnv3.chunk.mjs.map
|