2024-06-13 21:01:37 +03:00
"use strict" ; var obsidian _module = require ( "obsidian" ) , state = require ( "@codemirror/state" ) , view = require ( "@codemirror/view" ) ; var LZString = function ( ) { var r = String . fromCharCode , o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" , n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$" , e = { } ; function t ( r , o ) { if ( ! e [ r ] ) { e [ r ] = { } ; for ( var n = 0 ; n < r . length ; n ++ ) e [ r ] [ r . charAt ( n ) ] = n } return e [ r ] [ o ] } var i = { compressToBase64 : function ( r ) { if ( null == r ) return "" ; var n = i . _compress ( r , 6 , function ( r ) { return o . charAt ( r ) } ) ; switch ( n . length % 4 ) { default : case 0 : return n ; case 1 : return n + "===" ; case 2 : return n + "==" ; case 3 : return n + "=" } } , decompressFromBase64 : function ( r ) { return null == r ? "" : "" == r ? null : i . _decompress ( r . length , 32 , function ( n ) { return t ( o , r . charAt ( n ) ) } ) } , compressToUTF16 : function ( o ) { return null == o ? "" : i . _compress ( o , 15 , function ( o ) { return r ( o + 32 ) } ) + " " } , decompressFromUTF16 : function ( r ) { return null == r ? "" : "" == r ? null : i . _decompress ( r . length , 16384 , function ( o ) { return r . charCodeAt ( o ) - 32 } ) } , compressToUint8Array : function ( r ) { for ( var o = i . compress ( r ) , n = new Uint8Array ( 2 * o . length ) , e = 0 , t = o . length ; e < t ; e ++ ) { var s = o . charCodeAt ( e ) ; n [ 2 * e ] = s >>> 8 , n [ 2 * e + 1 ] = s % 256 } return n } , decompressFromUint8Array : function ( o ) { if ( null == o ) return i . decompress ( o ) ; for ( var n = new Array ( o . length / 2 ) , e = 0 , t = n . length ; e < t ; e ++ ) n [ e ] = 256 * o [ 2 * e ] + o [ 2 * e + 1 ] ; var s = [ ] ; return n . forEach ( function ( o ) { s . push ( r ( o ) ) } ) , i . decompress ( s . join ( "" ) ) } , compressToEncodedURIComponent : function ( r ) { return null == r ? "" : i . _compress ( r , 6 , function ( r ) { return n . charAt ( r ) } ) } , decompressFromEncodedURIComponent : function ( r ) { return null == r ? "" : "" == r ? null : ( r = r . replace ( / /g , "+" ) , i . _decompress ( r . length , 32 , function ( o ) { return t ( n , r . charAt ( o ) ) } ) ) } , compress : function ( o ) { return i . _compress ( o , 16 , function ( o ) { return r ( o ) } ) } , _compress : function ( r , o , n ) { if ( null == r ) return "" ; var e , t , i , s = { } , u = { } , a = "" , p = "" , c = "" , l = 2 , f = 3 , h = 2 , d = [ ] , m = 0 , v = 0 ; for ( i = 0 ; i < r . length ; i += 1 ) if ( a = r . charAt ( i ) , Object . prototype . hasOwnProperty . call ( s , a ) || ( s [ a ] = f ++ , u [ a ] = ! 0 ) , p = c + a , Object . prototype . hasOwnProperty . call ( s , p ) ) c = p ; else { if ( Object . prototype . hasOwnProperty . call ( u , c ) ) { if ( c . charCodeAt ( 0 ) < 256 ) { for ( e = 0 ; e < h ; e ++ ) m <<= 1 , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ ; for ( t = c . charCodeAt ( 0 ) , e = 0 ; e < 8 ; e ++ ) m = m << 1 | 1 & t , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ , t >>= 1 } else { for ( t = 1 , e = 0 ; e < h ; e ++ ) m = m << 1 | t , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ , t = 0 ; for ( t = c . charCodeAt ( 0 ) , e = 0 ; e < 16 ; e ++ ) m = m << 1 | 1 & t , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ , t >>= 1 } 0 == -- l && ( l = Math . pow ( 2 , h ) , h ++ ) , delete u [ c ] } else for ( t = s [ c ] , e = 0 ; e < h ; e ++ ) m = m << 1 | 1 & t , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ , t >>= 1 ; 0 == -- l && ( l = Math . pow ( 2 , h ) , h ++ ) , s [ p ] = f ++ , c = String ( a ) } if ( "" !== c ) { if ( Object . prototype . hasOwnProperty . call ( u , c ) ) { if ( c . charCodeAt ( 0 ) < 256 ) { for ( e = 0 ; e < h ; e ++ ) m <<= 1 , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ ; for ( t = c . charCodeAt ( 0 ) , e = 0 ; e < 8 ; e ++ ) m = m << 1 | 1 & t , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ , t >>= 1 } else { for ( t = 1 , e = 0 ; e < h ; e ++ ) m = m << 1 | t , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ , t = 0 ; for ( t = c . charCodeAt ( 0 ) , e = 0 ; e < 16 ; e ++ ) m = m << 1 | 1 & t , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ , t >>= 1 } 0 == -- l && ( l = Math . pow ( 2 , h ) , h ++ ) , delete u [ c ] } else for ( t = s [ c ] , e = 0 ; e < h ; e ++ ) m = m << 1 | 1 & t , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ , t >>= 1 ; 0 == -- l && ( l = Math . pow ( 2 , h ) , h ++ ) } for ( t = 2 , e = 0 ; e < h ; e ++ ) m = m << 1 | 1 & t , v == o - 1 ? ( v = 0 , d . push ( n ( m ) ) , m = 0 ) : v ++ , t >>= 1 ; for ( ; ; ) { if ( m <<= 1 , v == o - 1 ) { d . push ( n ( m ) ) ; break } v ++ } return d . join ( "" ) } , decompress : function ( r ) { return null == r ? "" : "" == r ? null : i . _decompress ( r . length , 32768 , function ( o ) { return r . charCodeAt ( o ) } ) } , _decompress : function ( o , n , e ) { var t , i , s , u , a , p , c , l = [ ] , f = 4 , h = 4 , d = 3 , m = "" , v = [ ] , g = { val : e ( 0 ) , position : n , index : 1 } ; for ( t = 0 ; t < 3 ; t += 1 ) l [ t ] = t ; for ( s = 0 , a = Math . pow ( 2 , 2 ) , p = 1 ; p != a ; ) u = g . val & g . position , g . position >>= 1 , 0 == g . position && ( g . position = n , g . val = e ( g . index ++ ) ) , s |= ( u > 0 ? 1 : 0 ) * p , p <<= 1 ; switch ( s ) { case 0 : for ( s = 0 , a = Math . pow ( 2 , 8 ) , p = 1 ; p != a ; ) u = g . val & g . position , g . position >>= 1 , 0 == g . position && ( g . position = n , g . val = e ( g . index ++ ) ) , s |= ( u > 0 ? 1 : 0 ) * p , p <<= 1 ; c = r ( s ) ; break ; case 1 : for ( s = 0 , a = Math . pow ( 2 , 16 ) , p = 1 ; p != a ; ) u = g . val & g . position , g . position >>= 1 , 0 == g . position && ( g . position = n , g . val = e ( g . index ++ ) ) , s |= ( u > 0 ? 1 : 0 ) * p , p <<= 1 ; c = r ( s ) ; break ; case 2 : return "" } for ( l [ 3 ] = c , i = c , v . push ( c ) ; ; ) { if ( g . index > o ) return "" ; for ( s = 0 , a = Math . pow ( 2 , d ) , p = 1 ; p != a ; ) u = g . val & g . position , g . position >>= 1 , 0 == g . position && ( g . position = n , g . val = e ( g . i
2024-08-09 08:39:12 +03:00
let EXCALIDRAW _PACKAGES = LZString . decompressFromBase64 ( " PQKhCgAIUgBAbAlgYwKYDsDOrICVUCGyALlDAE6EkB0ADuQPYAmAriYg + tQLaJcBWmMmUgBhBrQCe5RAHMAFsUgAKZAEpIAMSKoARgwYBrADSQAkumTVIBdE0iJimGwDMXiJAWKpM1YdEgAFXlEZ0wGFnI0SGRmHFDIJDQsVHsWO1RySGJ5HABZM0DElAxsSBcIuwd0bNyRABkzUQBRADkAZWbyj3ianJxGBiUmREoSBnJJSAYXWoTwyOjiSlQ / aGBwZRd09k5lNQBvAHIWMsxllGIjgG4tneIOdFVjAA9DgCIGXX5UEneAXkBxEktFQM0gqBetAmTgAZLD3ukmKh3OhUu8AIRAkFg2bcZgseCoAD8L2UkOh5CcagAXO9tpYHpwAdjQeDkajUPCOXxVgRuExiTy0coANrvCkwzDvAC6r1pqn + yAAPsrsPAXK9VNR8ERiP8DgBfNRqY3KHKhYwM3ZPdQHa1MmpkgiHRAuZToQnwQH / Aiqz7fX7ETGs3E2NSUYiRGqe + Dwa4Ef4ANXhBFFSZlqrT71gsEcmS8E1l10j0fp90eLP + wLZswIxIINNj8ENDsekAA7soCMZdMZUIcLb56BJML7rkPqLF0N4XvrdBOQr5KC4xwB1RehagsWhMLyZf6oVUADVbFc4kAAmvsjW2LwBpbu9 / uDpd0Ri0McETe + aez + c / tQK7roBO57t45CHieZ6Mu2ABaT59uAA4HAAbgQWTcMYTAGoaxjIP8zbGPIhFetcboel6WK6GoFTkMo3DVJAqEMIg9gAAxYv8uhASi8LKCRPErmoxgsWxkCcYCPGGKgkj8QR7zvAA1NJskiTRBAEFOBBxsofbcGo8IYroWnyAQmAAPIdugAAKH6ZMCDGGbCyhMKK3Aytx7kymo1zoVk3oYbILDcBgTjUES6CyDkAC0ABM5HugAjD68BqEwU4hPATCUOgh7XKg8BlBRSUADxpfaEzKP55T / AAguQ5AEJIyhpcYhj / Ox1yGOV3VKUptGioYnlBSFYWYENSlxTK1wZcgWU5Rg / wuIaFEEKm1AcgQhLEHZo60VVjF8IkvqbSi23wLtH6YMYaViRxPpuR5 / FPZ58Deb5pbkOgBwACS / TWuI0pIxiAzSPYyZINLIMYK40vIxgjp + NJMMYAD6DDWZkNL1FOkS5cQhowTakDoAQiGHF9P3 / YDMzA6DOLg9QgPtbJNJ9nDWkroj11M0jN0Y1j5BM4LaLkET4B3jUeTdpTqBRt9AY / H8Pq03W8LNlx62wlpNM4jMPqSMTjrTOTLpoRhkC6AaALvHSnXvMYdvO / 8 cXvIaJby2Wv3KVzqC0PAOjKMAor / DSMrALIVrnk85tU1booEDKxrG + 2 rQUwcVNK0GVZqzYGtUYC2ua6dkPEgw5OKUpWmQ7SPHEAw7QXFFygAMwAGymlLkAAEKIf2xhYUwhw1QReffhRiIZJyTBViqyrvPoDBErYc9qImzZ + ZbJEYkliWUXGPoujvXWFWcHaOPNqiHMg5k4O85wyFFdu32U7yetwuiZHbJ / XLolAEEMNcV + 98 vjK2DDSTAF9iBX11gDfWLgb530gFDEBkBaCNhPkTCi8gIxe2 + pAEiPYcJMAEiJRMikfTcGJO8agylwDpwRuxWkWFb6uTUMSck / xFLGBLtrLhfsA5Bz3E7X6sJgDvDUEpd4EiRJ91Rn2VATtHZS1lpnfBNQCDGlpCXJg / EZbDxeoRcmqNUBKWUBiDKkNVTyHhPIagkNHoONkjQu2ygq5WLUrxIRaBXI9neGI2R0igkunUnQU48h2EiT3iRLq3BuFVmobQu23BpF0n3mw0JdFqqW29F1eApUtKRWivIa48B + o319KKeAM0aouH + Kk9OMM0rXHkEpf4fcYaKKtNhU0Z94junqc6ES5ZYLMlVgg8oB16KJhcNpXSLpbqdWuBiRUWk0Rzn2GoTanBUDXDUARKw6F4AsCUfUxpzxykDWIu0zpz4zm9IKkVAZ7iwE5x9OoHIjAOxW3 + E3J + shZbGGaI1Kq7wLKBhIM4DCOB0BDGYjpcS5kbB4CoEoeaHh7BbEqEwGkkB6HuNFG8kgkAIXgJlFWXQNDiVKGgfISAkNnAHGUmSoMzjJCYFltQfgrEniO3xVI92dsaLSO2eYWYkgIiQFCrYJQDdIC5WRFkAgMRl5EhJuCDF2VcqmFODgWwNhGrNWqOcQgGVJGewVjUeQqcLyiH7ihCizYi54KtTYLeWQCKijlDhLqfcewwx4Tw1RccNFW3mfAckxhiEVONJa6MMRbU1AAI5m1dO6GKKUi7UDRucLwpwR6W2tlpNGlBMA7T / txfYf9ma5CeKomiBwKLsSPjmvNUZMCqkza23NxB82YHXm2vtHb / hJWjTmstO1uJ4Qbem5QLbs29v7V2rNp0l0dsHeu04rtx2lp8FO3Qcbu2LvbacfiJbT1jnAOxXdk7LrcVNCVHtl7XUJpLXe4gZ0XAXWIIub5NgJ37sutcJNpKM41VQKdYpOQEzhMwJEmiCYaTZOuOxUqezC2esPJmgAfHhsdOE0zIBms20qAARVyvYTREc8n2NMqBPKmKVE8so / 9 CCGBsETbutA1HxwXVBjAJTiTNnBqKdiydu7NDUc21t0HcHx03jVYtYm5SQa0tCHjvkKKoC4o2tM4n8qNmyaPTq2EBNRRyO1f4TA8M4b3sgUqQDMOENdiAVQSkkpqEzUstM8g5T1LaWO2QVSXAkfdOxHDFH4AvloqVPRsIIsUajmlThNH / hRzTKFw8 + FloKjS9F3znklEEVwSxl5Lg4vwkS8oKOA516imI + l6NoosvFeWmVq2ACONaMNPHQ9ksY6QAoz2RtJmtLhCpBYZELwYo8Qm8QKbkJ40EMkkqYkyAmZsVm9QNioGbJqOM0W / 4 PHyC + RLtxfZTb3TOqkhGkyyBDBqCk6djrFE5t9qpIERAoVSq + ie8oU7vZqDzcWy8bi1AKSjC8I8L7oVjAWWUMmqjHW2OAMrSd00oGACKaiABe / xd7XH2y6feGIWBqCdYXY7iOTQsAJze3Ayh2i + X6RbLI1sMfXHO7oeEgRlBY6B3mz733UAxRdFxwb7QM508J7j / i + Pd79nJnVESdV / iZt8poenHqYj / CAcsSQBx9uIeyXlHjyaztU / QPxVZXBIdNUdLD1AOGaJZiMt + rZl2arxK4LfOM92gGTylrnSZBkDi + 50 vAAPpE4zXHAB1Lg9AOAyGBPUVAqFCo65wtwD0EOoRQ8dyL37iHraoWraMm0IfayQEFBH / 3 RAOq4ryoCc3zkpMW6J3pPpzzIDt7O9Ti3q1rtW7UDVYLGJT7PLZy5zn53bGwj5wL + xQviBO9m75cfSVethtkK2PgkfDd5SIh1GGWvd4S7GTUD3cs3Vl682ZUqiB6y7xpBP0DjPzYAHFxwAAlVTKB / 3 p2MDMC2VAz5xG0ODV34HJlUUOHJjv1NCo0NBqkkD + UkE / mXmoGyXeAARoEKlQFChnEkURkTHaHQP0HgCwLBVwM / UpD7XgGIKajQIwMoOwJoKwKalkEIODBEkwFIPIMwLYLRWBwuBIDRnxGRGIL7WYIoKoPohwOEJHHcCJHIGIPABYH4JYLkPcXYJHFQjYm / hEnQhkMEOoOEL / EhB4OMA7E0NkKEL1DkJsPICYD3RcGIJeFsNMPkPYPLUwFBBSGIMkE8NYLMIcNCnxGINx2CO0IUIcMDlx0kGIKTBMMoPzAdwmGMGPANFCDyEqG8FxRDRv2jHP37HQGTVOVOU0AmDQAAFVdx9xkMY5 + 47 Q8IMByjUBTl8AfFUAm4GiQ1nwYYw9WiyiKiej5ZejvBGjL9mjB5DgiZ2pExWUaBzJMA5B0BjA1xcJrgOx3whghgcQdtMBdQSBxBuBoQ0QZwtidiRwG5AZgdxjh1IN + jG1J4aUQxqxJltYK9HR3jx4C44wsQXQvlMZe9QV5DsBiAJjUBlBqBYTaRshAEfAbAagaVphZh20cB / In9dAiRnB5UwJ9xphlVyhBsOwQh5oFUNFoUUTIUlBwQMSEUZACAcSfA6FfJwB
2024-07-13 19:25:17 +03:00
let { react , reactDOM , excalidrawLib } = window . eval . call ( window , ` (function() { ${ EXCALIDRAW _PACKAGES } ;return {react: React, reactDOM: ReactDOM, excalidrawLib: ExcalidrawLib};})(); ` ) ;
2024-08-09 08:39:12 +03:00
let PLUGIN _VERSION = "2.3.0" ; ; function _interopNamespace ( e ) { if ( e && e . _ _esModule ) return e ; var t = Object . create ( null ) ; return e && Object . keys ( e ) . forEach ( ( function ( n ) { if ( "default" !== n ) { var r = Object . getOwnPropertyDescriptor ( e , n ) ; Object . defineProperty ( t , n , r . get ? r : { enumerable : ! 0 , get : function ( ) { return e [ n ] } } ) } } ) ) , t . default = e , Object . freeze ( t ) } var obsidian _module _ _namespace = _interopNamespace ( obsidian _module ) , React _ _namespace = _interopNamespace ( React ) ; let random$1 = e => crypto . getRandomValues ( new Uint8Array ( e ) ) , customRandom = ( e , t , n ) => { let r = ( 2 << Math . log ( e . length - 1 ) / Math . LN2 ) - 1 , i = - ~ ( 1.6 * r * t / e . length ) ; return ( a = t ) => { let o = "" ; for ( ; ; ) { let t = n ( i ) , s = i ; for ( ; s -- ; ) if ( o += e [ t [ s ] & r ] || "" , o . length === a ) return o } } } , customAlphabet = ( e , t = 21 ) => customRandom ( e , t , random$1 ) , nanoid$1 = ( e = 21 ) => crypto . getRandomValues ( new Uint8Array ( e ) ) . reduce ( ( ( e , t ) => e + ( ( t &= 63 ) < 36 ? t . toString ( 36 ) : t < 62 ? ( t - 26 ) . toString ( 36 ) . toUpperCase ( ) : t > 62 ? "-" : "_" ) ) , "" ) , EXCALIDRAW _PLUGIN = null ; const setExcalidrawPlugin = e => { EXCALIDRAW _PLUGIN = e } , MD _EXCALIDRAW = "# Excalidraw Data" , MD _TEXTELEMENTS = "## Text Elements" , MD _ELEMENTLINKS = "## Element Links" , MD _EMBEDFILES = "## Embedded Files" , MD _DRAWING = "## Drawing" , MD _EX _SECTIONS = [ MD _EXCALIDRAW , MD _TEXTELEMENTS , MD _ELEMENTLINKS , MD _EMBEDFILES , MD _DRAWING ] , ERROR _IFRAME _CONVERSION _CANCELED = "iframe conversion canceled" , LOCALE = obsidian _module . moment . locale ( ) , obsidianToExcalidrawMap = { en : "en-US" , af : "af-ZA" , am : "am-ET" , ar : "ar-SA" , eu : "eu-ES" , be : "be-BY" , bg : "bg-BG" , bn : "bn-BD" , ca : "ca-ES" , cs : "cs-CZ" , da : "da-DK" , de : "de-DE" , el : "el-GR" , eo : "eo-EO" , es : "es-ES" , fa : "fa-IR" , "fi-fi" : "fi-FI" , fr : "fr-FR" , gl : "gl-ES" , he : "he-IL" , hi : "hi-IN" , hu : "hu-HU" , id : "id-ID" , it : "it-IT" , ja : "ja-JP" , ko : "ko-KR" , lv : "lv-LV" , ml : "ml-IN" , ms : "ms-MY" , nl : "nl-NL" , no : "nb-NO" , oc : "oc-FR" , pl : "pl-PL" , pt : "pt-PT" , "pt-BR" : "pt-BR" , ro : "ro-RO" , ru : "ru-RU" , sr : "sr-RS" , se : "sv-SE" , sk : "sk-SK" , sq : "sq-AL" , ta : "ta-IN" , te : "te-IN" , th : "th-TH" , tr : "tr-TR" , uk : "uk-UA" , ur : "ur-PK" , vi : "vi-VN" , zh : "zh-CN" , "zh-TW" : "zh-TW" } , { sceneCoordsToViewportCoords : sceneCoordsToViewportCoords , viewportCoordsToSceneCoords : viewportCoordsToSceneCoords , determineFocusDistance : determineFocusDistance , intersectElementWithLine : intersectElementWithLine , getCommonBoundingBox : getCommonBoundingBox , getMaximumGroups : getMaximumGroups , measureText : measureText , getLineHeight : getLineHeight , wrapText : wrapText , getFontString : getFontString , getBoundTextMaxWidth : getBoundTextMaxWidth , exportToSvg : exportToSvg , exportToBlob : exportToBlob , mutateElement : mutateElement , restore : restore , mermaidToExcalidraw : mermaidToExcalidraw , getFontFamilyString : getFontFamilyString , getContainerElement : getContainerElement , refreshTextDimensions : refreshTextDimensions , getFontDefinition : getFontDefinition } = excalidrawLib , FONTS _STYLE _ID = "excalidraw-custom-fonts" ; function JSON _parse ( e ) { return JSON . parse ( e . replaceAll ( "[" , "[" ) ) } / Mac | iPod | iPhone | iPad / . test ( window . navigator . platform ) ; const DEVICE = { isDesktop : ! document . body . hasClass ( "is-tablet" ) && ! document . body . hasClass ( "is-mobile" ) , isPhone : document . body . hasClass ( "is-phone" ) , isTablet : document . body . hasClass ( "is-tablet" ) , isMobile : document . body . hasClass ( "is-mobile" ) , isLinux : document . body . hasClass ( "mod-linux" ) && ! document . body . hasClass ( "is-android" ) , isMacOS : document . body . hasClass ( "mod-macos" ) && ! document . body . hasClass ( "is-ios" ) , isWindows : document . body . hasClass ( "mod-windows" ) , isIOS : document . body . hasClass ( "is-ios" ) , isAndroid : document . body . hasClass ( "is-android" ) } , ROOTELEMENTSIZE = ( ( ) => { const e = document . createElement ( "div" ) ; e . style . fontSize = "1rem" , e . style . display = "none" , document . body . appendChild ( e ) ; const t = getComputedStyle ( e ) , n = parseFloat ( t . fontSize ) ; return document . body . removeChild ( e ) , n } ) ( ) , nanoid = customAlphabet ( "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" , 8 ) , KEYCODE = { ESC : 27 } , ROUNDNESS = { LEGACY : 1 , PROPORTIONAL _RADIUS : 2 , ADAPTIVE _RADIUS : 3 } , THEME _FILTER = "invert(100%) hue-rotate(180deg) saturate(1.25)" , GITHUB _RELEASES = "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/" , URLFETCHTIMEOUT = 3e3 , PLUGIN _ID = "obsidian-excalidraw-plugin" , SCRIPT _INSTALL _CODEBLOCK = "excalidraw-script-install" , SCRIPT _INSTALL _FOLDER = "Downloaded" , fileid = customAlphabet ( "1234567890abcdef" , 40 ) , REG _LINKIND
2024-06-13 21:01:37 +03:00
/ * !
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* mhchemParser . ts
* 4.2 . 1
*
* Parser for the \ ce command and \ pu command for MathJax and Co .
*
* mhchem ' s \ ce is a tool for writing beautiful chemical equations easily .
* mhchem ' s \ pu is a tool for writing physical units easily .
*
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
*
* Copyright ( c ) 2015 - 2023 Martin Hensel
*
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
*
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
*
* https : //github.com/mhchem/mhchemParser
*
* /
2024-07-29 07:51:09 +03:00
Object . defineProperty ( mhchemParser$1 , "__esModule" , { value : ! 0 } ) , mhchemParser$1 . mhchemParser = void 0 ; var mhchemParser = function ( ) { function e ( ) { } return e . toTex = function ( e , t ) { return _mhchemTexify . go ( _mhchemParser . go ( e , t ) , "tex" !== t ) } , e } ( ) ; function _mhchemCreateTransitions ( e ) { var t , n , r = { } ; for ( t in e ) for ( n in e [ t ] ) { var i = n . split ( "|" ) ; e [ t ] [ n ] . stateArray = i ; for ( var a = 0 ; a < i . length ; a ++ ) r [ i [ a ] ] = [ ] } for ( t in e ) for ( n in e [ t ] ) for ( i = e [ t ] [ n ] . stateArray || [ ] , a = 0 ; a < i . length ; a ++ ) { var o = e [ t ] [ n ] ; o . action _ = [ ] . concat ( o . action _ ) ; for ( var s = 0 ; s < o . action _ . length ; s ++ ) "string" == typeof o . action _ [ s ] && ( o . action _ [ s ] = { type _ : o . action _ [ s ] } ) ; for ( var l = t . split ( "|" ) , c = 0 ; c < l . length ; c ++ ) if ( "*" === i [ a ] ) { var d = void 0 ; for ( d in r ) r [ d ] . push ( { pattern : l [ c ] , task : o } ) } else r [ i [ a ] ] . push ( { pattern : l [ c ] , task : o } ) } return r } mhchemParser$1 . mhchemParser = mhchemParser ; var _mhchemParser = { go : function ( e , t ) { if ( ! e ) return [ ] ; void 0 === t && ( t = "ce" ) ; var n , r = "0" , i = { parenthesisLevel : 0 } ; e = ( e = ( e = e . replace ( /\n/g , " " ) ) . replace ( /[\u2212\u2013\u2014\u2010]/g , "-" ) ) . replace ( /[\u2026]/g , "..." ) ; for ( var a = 10 , o = [ ] ; ; ) { n !== e ? ( a = 10 , n = e ) : a -- ; var s = _mhchemParser . stateMachines [ t ] , l = s . transitions [ r ] || s . transitions [ "*" ] ; e : for ( var c = 0 ; c < l . length ; c ++ ) { var d = _mhchemParser . patterns . match _ ( l [ c ] . pattern , e ) ; if ( d ) { for ( var T = l [ c ] . task , u = 0 ; u < T . action _ . length ; u ++ ) { var Q = void 0 ; if ( s . actions [ T . action _ [ u ] . type _ ] ) Q = s . actions [ T . action _ [ u ] . type _ ] ( i , d . match _ , T . action _ [ u ] . option ) ; else { if ( ! _mhchemParser . actions [ T . action _ [ u ] . type _ ] ) throw [ "MhchemBugA" , "mhchem bug A. Please report. (" + T . action _ [ u ] . type _ + ")" ] ; Q = _mhchemParser . actions [ T . action _ [ u ] . type _ ] ( i , d . match _ , T . action _ [ u ] . option ) } _mhchemParser . concatArray ( o , Q ) } if ( r = T . nextState || r , ! ( e . length > 0 ) ) return o ; if ( T . revisit || ( e = d . remainder ) , ! T . toContinue ) break e } } if ( a <= 0 ) throw [ "MhchemBugU" , "mhchem bug U. Please report." ] } } , concatArray : function ( e , t ) { if ( t ) if ( Array . isArray ( t ) ) for ( var n = 0 ; n < t . length ; n ++ ) e . push ( t [ n ] ) ; else e . push ( t ) } , patterns : { patterns : { empty : /^$/ , else : /^./ , else2 : /^./ , space : /^\s/ , "space A" : /^\s(?=[A-Z\\$])/ , space$ : /^\s$/ , "a-z" : /^[a-z]/ , x : /^x/ , x$ : /^x$/ , i$ : /^i$/ , letters : /^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/ , "\\greek" : /^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/ , "one lowercase latin letter $" : /^(?:([a-z])(?:$|[^a-zA-Z]))$/ , "$one lowercase latin letter$ $" : /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/ , "one lowercase greek letter $" : /^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/ , digits : /^[0-9]+/ , "-9.,9" : /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/ , "-9.,9 no missing 0" : /^[+\-]?[0-9]+(?:[.,][0-9]+)?/ , "(-)(9.,9)(e)(99)" : function ( e ) { var t = e . match ( /^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/ ) ; return t && t [ 0 ] ? { match _ : t . slice ( 1 ) , remainder : e . substr ( t [ 0 ] . length ) } : null } , "(-)(9)^(-9)" : /^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/ , "state of aggregation $" : function ( e ) { var t = _mhchemParser . patterns . findObserveGroups ( e , "" , /^\([a-z]{1,3}(?=[\),])/ , ")" , "" ) ; if ( t && t . remainder . match ( /^($|[\s,;\)\]\}])/ ) ) return t ; var n = e . match ( /^(?:\((?:\\ca\s?)?\$[amothc]\$\))/ ) ; return n ? { match _ : n [ 0 ] , remainder : e . substr ( n [ 0 ] . length ) } : null } , "_{(state of aggregation)}$" : /^_\{(\([a-z]{1,3}\))\}/ , "{[(" : /^(?:\\\{|\[|\()/ , ")]}" : /^(?:\)|\]|\\\})/ , ", " : /^[,;]\s*/ , "," : /^[,;]/ , "." : /^[.]/ , ". __* " : /^([.\u22C5\u00B7\u2022]|[*])\s*/ , "..." : /^\.\.\.(?=$|[^.])/ , "^{(...)}" : function ( e ) { return _mhchemParser . patterns . findObserveGroups ( e , "^{" , "" , "" , "}" ) } , "^($...$)" : function ( e ) { return _mhchemParser . pattern
2024-06-13 21:01:37 +03:00
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
2024-08-09 08:39:12 +03:00
function isNothing ( e ) { return null == e } function isObject ( e ) { return "object" == typeof e && null !== e } function toArray ( e ) { return Array . isArray ( e ) ? e : isNothing ( e ) ? [ ] : [ e ] } function extend ( e , t ) { var n , r , i , a ; if ( t ) for ( n = 0 , r = ( a = Object . keys ( t ) ) . length ; n < r ; n += 1 ) e [ i = a [ n ] ] = t [ i ] ; return e } function repeat ( e , t ) { var n , r = "" ; for ( n = 0 ; n < t ; n += 1 ) r += e ; return r } function isNegativeZero ( e ) { return 0 === e && Number . NEGATIVE _INFINITY === 1 / e } var isNothing _1 = isNothing , isObject _1 = isObject , toArray _1 = toArray , repeat _1 = repeat , isNegativeZero _1 = isNegativeZero , extend _1 = extend , common = { isNothing : isNothing _1 , isObject : isObject _1 , toArray : toArray _1 , repeat : repeat _1 , isNegativeZero : isNegativeZero _1 , extend : extend _1 } ; function formatError ( e , t ) { var n = "" , r = e . reason || "(unknown reason)" ; return e . mark ? ( e . mark . name && ( n += 'in "' + e . mark . name + '" ' ) , n += "(" + ( e . mark . line + 1 ) + ":" + ( e . mark . column + 1 ) + ")" , ! t && e . mark . snippet && ( n += "\n\n" + e . mark . snippet ) , r + " " + n ) : r } function YAMLException$1 ( e , t ) { Error . call ( this ) , this . name = "YAMLException" , this . reason = e , this . mark = t , this . message = formatError ( this , ! 1 ) , Error . captureStackTrace ? Error . captureStackTrace ( this , this . constructor ) : this . stack = ( new Error ) . stack || "" } YAMLException$1 . prototype = Object . create ( Error . prototype ) , YAMLException$1 . prototype . constructor = YAMLException$1 , YAMLException$1 . prototype . toString = function ( e ) { return this . name + ": " + formatError ( this , e ) } ; var exception = YAMLException$1 ; function getLine ( e , t , n , r , i ) { var a = "" , o = "" , s = Math . floor ( i / 2 ) - 1 ; return r - t > s && ( t = r - s + ( a = " ... " ) . length ) , n - r > s && ( n = r + s - ( o = " ..." ) . length ) , { str : a + e . slice ( t , n ) . replace ( /\t/g , "→" ) + o , pos : r - t + a . length } } function padStart ( e , t ) { return common . repeat ( " " , t - e . length ) + e } function makeSnippet ( e , t ) { if ( t = Object . create ( t || null ) , ! e . buffer ) return null ; t . maxLength || ( t . maxLength = 79 ) , "number" != typeof t . indent && ( t . indent = 1 ) , "number" != typeof t . linesBefore && ( t . linesBefore = 3 ) , "number" != typeof t . linesAfter && ( t . linesAfter = 2 ) ; for ( var n , r = /\r?\n|\r|\0/g , i = [ 0 ] , a = [ ] , o = - 1 ; n = r . exec ( e . buffer ) ; ) a . push ( n . index ) , i . push ( n . index + n [ 0 ] . length ) , e . position <= n . index && o < 0 && ( o = i . length - 2 ) ; o < 0 && ( o = i . length - 1 ) ; var s , l , c = "" , d = Math . min ( e . line + t . linesAfter , a . length ) . toString ( ) . length , T = t . maxLength - ( t . indent + d + 3 ) ; for ( s = 1 ; s <= t . linesBefore && ! ( o - s < 0 ) ; s ++ ) l = getLine ( e . buffer , i [ o - s ] , a [ o - s ] , e . position - ( i [ o ] - i [ o - s ] ) , T ) , c = common . repeat ( " " , t . indent ) + padStart ( ( e . line - s + 1 ) . toString ( ) , d ) + " | " + l . str + "\n" + c ; for ( l = getLine ( e . buffer , i [ o ] , a [ o ] , e . position , T ) , c += common . repeat ( " " , t . indent ) + padStart ( ( e . line + 1 ) . toString ( ) , d ) + " | " + l . str + "\n" , c += common . repeat ( "-" , t . indent + d + 3 + l . pos ) + "^\n" , s = 1 ; s <= t . linesAfter && ! ( o + s >= a . length ) ; s ++ ) l = getLine ( e . buffer , i [ o + s ] , a [ o + s ] , e . position - ( i [ o ] - i [ o + s ] ) , T ) , c += common . repeat ( " " , t . indent ) + padStart ( ( e . line + s + 1 ) . toString ( ) , d ) + " | " + l . str + "\n" ; return c . replace ( /\n$/ , "" ) } var snippet = makeSnippet , TYPE _CONSTRUCTOR _OPTIONS = [ "kind" , "multi" , "resolve" , "construct" , "instanceOf" , "predicate" , "represent" , "representName" , "defaultStyle" , "styleAliases" ] , YAML _NODE _KINDS = [ "scalar" , "sequence" , "mapping" ] ; function compileStyleAliases ( e ) { var t = { } ; return null !== e && Object . keys ( e ) . forEach ( ( function ( n ) { e [ n ] . forEach ( ( function ( e ) { t [ String ( e ) ] = n } ) ) } ) ) , t } function Type$1 ( e , t ) { if ( t = t || { } , Object . keys ( t ) . forEach ( ( function ( t ) { if ( - 1 === TYPE _CONSTRUCTOR _OPTIONS . indexOf ( t ) ) throw new exception ( 'Unknown option "' + t + '" is met in definition of "' + e + '" YAML type.' ) } ) ) , this . options = t , this . tag = e , this . kind = t . kind || null , this . resolve = t . resolve || function ( ) { return ! 0 } , this . construct = t . construct || function ( e ) { return e } , this . instanceOf = t . instanceOf || null , this . predicate = t . predicate || null , this . represent = t . represent || null , this . representName = t . representName || null , this . defaultStyle = t . defaultStyle || null , this . multi = t . multi || ! 1 , this . styleAliases = compileStyleAliases ( t . styleAliases || null ) , - 1 === YAML _NODE _KINDS . indexOf ( this . kind ) ) throw new exception ( 'Unknown kind "' + this . kind + '" is specified for "' + e + '" YAML type.' ) } var type = Type$1 ; function compileList ( e , t ) { var n = [ ] ; return e [ t ] . forEach ( ( function ( e ) { var t = n . length ; n . forEach ( ( function ( n , r ) { n . tag === e . tag && n . kind === e . kind && n . multi === e . multi && ( t = r ) } ) ) , n [ t ] = e } ) ) , n } function compileMap ( ) { var e , t , n = { scalar : { } , sequence : { } , mapping : { } , fallback : { } , multi : { scala
/*! https://mths.be/codepointat v0.2.0 by @mathias */ String . prototype . codePointAt || function ( ) { var e = function ( ) { try { var e = { } , t = Object . defineProperty , n = t ( e , e , e ) && t } catch ( e ) { } return n } ( ) , t = function ( e ) { if ( null == this ) throw TypeError ( ) ; var t = String ( this ) , n = t . length , r = e ? Number ( e ) : 0 ; if ( r != r && ( r = 0 ) , ! ( r < 0 || r >= n ) ) { var i , a = t . charCodeAt ( r ) ; return a >= 55296 && a <= 56319 && n > r + 1 && ( i = t . charCodeAt ( r + 1 ) ) >= 56320 && i <= 57343 ? 1024 * ( a - 55296 ) + i - 56320 + 65536 : a } } ; e ? e ( String . prototype , "codePointAt" , { value : t , configurable : ! 0 , writable : ! 0 } ) : String . prototype . codePointAt = t } ( ) ; var TINF _OK = 0 , TINF _DATA _ERROR = - 3 ; function Tree ( ) { this . table = new Uint16Array ( 16 ) , this . trans = new Uint16Array ( 288 ) } function Data ( e , t ) { this . source = e , this . sourceIndex = 0 , this . tag = 0 , this . bitcount = 0 , this . dest = t , this . destLen = 0 , this . ltree = new Tree , this . dtree = new Tree } var sltree = new Tree , sdtree = new Tree , length _bits = new Uint8Array ( 30 ) , length _base = new Uint16Array ( 30 ) , dist _bits = new Uint8Array ( 30 ) , dist _base = new Uint16Array ( 30 ) , clcidx = new Uint8Array ( [ 16 , 17 , 18 , 0 , 8 , 7 , 9 , 6 , 10 , 5 , 11 , 4 , 12 , 3 , 13 , 2 , 14 , 1 , 15 ] ) , code _tree = new Tree , lengths = new Uint8Array ( 320 ) ; function tinf _build _bits _base ( e , t , n , r ) { var i , a ; for ( i = 0 ; i < n ; ++ i ) e [ i ] = 0 ; for ( i = 0 ; i < 30 - n ; ++ i ) e [ i + n ] = i / n | 0 ; for ( a = r , i = 0 ; i < 30 ; ++ i ) t [ i ] = a , a += 1 << e [ i ] } function tinf _build _fixed _trees ( e , t ) { var n ; for ( n = 0 ; n < 7 ; ++ n ) e . table [ n ] = 0 ; for ( e . table [ 7 ] = 24 , e . table [ 8 ] = 152 , e . table [ 9 ] = 112 , n = 0 ; n < 24 ; ++ n ) e . trans [ n ] = 256 + n ; for ( n = 0 ; n < 144 ; ++ n ) e . trans [ 24 + n ] = n ; for ( n = 0 ; n < 8 ; ++ n ) e . trans [ 168 + n ] = 280 + n ; for ( n = 0 ; n < 112 ; ++ n ) e . trans [ 176 + n ] = 144 + n ; for ( n = 0 ; n < 5 ; ++ n ) t . table [ n ] = 0 ; for ( t . table [ 5 ] = 32 , n = 0 ; n < 32 ; ++ n ) t . trans [ n ] = n } var offs = new Uint16Array ( 16 ) ; function tinf _build _tree ( e , t , n , r ) { var i , a ; for ( i = 0 ; i < 16 ; ++ i ) e . table [ i ] = 0 ; for ( i = 0 ; i < r ; ++ i ) e . table [ t [ n + i ] ] ++ ; for ( e . table [ 0 ] = 0 , a = 0 , i = 0 ; i < 16 ; ++ i ) offs [ i ] = a , a += e . table [ i ] ; for ( i = 0 ; i < r ; ++ i ) t [ n + i ] && ( e . trans [ offs [ t [ n + i ] ] ++ ] = i ) } function tinf _getbit ( e ) { e . bitcount -- || ( e . tag = e . source [ e . sourceIndex ++ ] , e . bitcount = 7 ) ; var t = 1 & e . tag ; return e . tag >>>= 1 , t } function tinf _read _bits ( e , t , n ) { if ( ! t ) return n ; for ( ; e . bitcount < 24 ; ) e . tag |= e . source [ e . sourceIndex ++ ] << e . bitcount , e . bitcount += 8 ; var r = e . tag & 65535 >>> 16 - t ; return e . tag >>>= t , e . bitcount -= t , r + n } function tinf _decode _symbol ( e , t ) { for ( ; e . bitcount < 24 ; ) e . tag |= e . source [ e . sourceIndex ++ ] << e . bitcount , e . bitcount += 8 ; var n = 0 , r = 0 , i = 0 , a = e . tag ; do { r = 2 * r + ( 1 & a ) , a >>>= 1 , ++ i , n += t . table [ i ] , r -= t . table [ i ] } while ( r >= 0 ) ; return e . tag = a , e . bitcount -= i , t . trans [ n + r ] } function tinf _decode _trees ( e , t , n ) { var r , i , a , o , s , l ; for ( r = tinf _read _bits ( e , 5 , 257 ) , i = tinf _read _bits ( e , 5 , 1 ) , a = tinf _read _bits ( e , 4 , 4 ) , o = 0 ; o < 19 ; ++ o ) lengths [ o ] = 0 ; for ( o = 0 ; o < a ; ++ o ) { var c = tinf _read _bits ( e , 3 , 0 ) ; lengths [ clcidx [ o ] ] = c } for ( tinf _build _tree ( code _tree , lengths , 0 , 19 ) , s = 0 ; s < r + i ; ) { var d = tinf _decode _symbol ( e , code _tree ) ; switch ( d ) { case 16 : var T = lengths [ s - 1 ] ; for ( l = tinf _read _bits ( e , 2 , 3 ) ; l ; -- l ) lengths [ s ++ ] = T ; break ; case 17 : for ( l = tinf _read _bits ( e , 3 , 3 ) ; l ; -- l ) lengths [ s ++ ] = 0 ; break ; case 18 : for ( l = tinf _read _bits ( e , 7 , 11 ) ; l ; -- l ) lengths [ s ++ ] = 0 ; break ; default : lengths [ s ++ ] = d } } tinf _build _tree ( t , lengths , 0 , r ) , tinf _build _tree ( n , lengths , r , i ) } function tinf _inflate _block _data ( e , t , n ) { for ( ; ; ) { var r , i , a , o , s = tinf _decode _symbol ( e , t ) ; if ( 256 === s ) return TINF _OK ; if ( s < 256 ) e . dest [ e . destLen ++ ] = s ; else for ( r = tinf _read _bits ( e , length _bits [ s -= 257 ] , length _base [ s ] ) , i = tinf _decode _symbol ( e , n ) , o = a = e . destLen - tinf _read _bits ( e , dist _bits [ i ] , dist _base [ i ] ) ; o < a + r ; ++ o ) e . dest [ e . destLen ++ ] = e . dest [ o ] } } function tinf _inflate _uncompressed _block ( e ) { for ( var t , n ; e . bitcount > 8 ; ) e . sourceIndex -- , e . bitcount -= 8 ; if ( ( t = 256 * ( t = e . source [ e . sourceIndex + 1 ] ) + e . source [ e . sourceIndex ] ) !== ( 65535 & ~ ( 256 * e . source [ e . sourceIndex + 3 ] + e . source [ e . sourceIndex + 2 ] ) ) ) return TINF _DATA _ERROR ; for ( e . sourceIndex += 4 , n = t ; n ; -- n ) e . dest [ e . destLen ++ ] = e . source [ e . sourceIndex ++ ] ; return e . bitcount = 0 , TINF _OK } function tinf _uncompress ( e , t ) { var n , r , i = new Data ( e , t ) ; do { switch ( n = tinf _getbit ( i ) , tinf _read _bits ( i , 2 , 0 ) ) { case 0 : r = tinf _inflate _uncompressed _block ( i ) ; break ; case 1 : r = tinf _inflate _block _data ( i , sltree , sdtree ) ; break ; case 2 : tinf _decode _trees ( i , i . ltree , i . dtree ) , r = tinf _inflate _block _data ( i , i . ltree , i . dtree ) ; break ; default : r = TINF _DATA _ERROR } if ( r !== TINF _OK ) throw new Error ( "Data error" ) } while ( ! n ) ; return i . destLen < i . dest . length ? "function" == typeof
2024-06-13 21:01:37 +03:00
//![[link|alias]] [alias](link){num}
2024-07-29 07:51:09 +03:00
EXPR : /(!)?(\[\[([^|\]]+)\|?([^\]]+)?]]|\[([^\]]*)]\(([^)]*)\))(\{(\d+)\})?/g , getResList : e => { const t = e . matchAll ( REGEX _LINK . EXPR ) ; let n ; const r = [ ] ; for ( ; ! ( n = t . next ( ) ) . done ; ) r . push ( n ) ; return r } , getRes : e => e . matchAll ( REGEX _LINK . EXPR ) , isTransclusion : e => ! ! e . value [ 1 ] , getLink : e => e . value [ 3 ] ? e . value [ 3 ] : e . value [ 6 ] , isWikiLink : e => ! ! e . value [ 3 ] , getAliasOrLink : e => REGEX _LINK . isWikiLink ( e ) ? e . value [ 4 ] ? e . value [ 4 ] : e . value [ 3 ] : e . value [ 5 ] ? e . value [ 5 ] : e . value [ 6 ] , getWrapLength : ( e , t ) => { const n = parseInt ( e . value [ 8 ] ) ; return isNaN ( n ) ? t > 0 ? t : null : n } } , DRAWING _REG = /\n##? Drawing\n[^`]*(```json\n)([\s\S]*?)```\n/gm , DRAWING _REG _FALLBACK = /\n##? Drawing\n(```json\n)?(.*)(```)?(%%)?/gm , DRAWING _COMPRESSED _REG = /(\n##? Drawing\n[^`]*(?:```compressed\-json\n))([\s\S]*?)(```\n)/gm , DRAWING _COMPRESSED _REG _FALLBACK = /(\n##? Drawing\n(?:```compressed\-json\n)?)(.*)((```)?(%%)?)/gm , REG _LINKINDEX _HYPERLINK = /^\w+:\/\// , isCompressedMD = e => null !== e . match ( /```compressed\-json\n/gm ) , getDecompressedScene = e => { let t , n = e . matchAll ( DRAWING _COMPRESSED _REG ) ; return t = n . next ( ) , t . done && ( n = e . matchAll ( DRAWING _COMPRESSED _REG _FALLBACK ) , t = n . next ( ) ) , t . value && t . value . length > 1 ? [ decompress ( t . value [ 2 ] ) , t ] : [ null , t ] } , changeThemeOfExcalidrawMD = e => { const t = isCompressedMD ( e ) ; let n = t ? getDecompressedScene ( e ) [ 0 ] : e ; return n ? ( isObsidianThemeDark ? 1 === ( n . match ( /"theme"\s*:\s*"light"\s*,/g ) || [ ] ) . length && ( n = n . replace ( /"theme"\s*:\s*"light"\s*,/ , '"theme": "dark",' ) ) : 1 === ( n . match ( /"theme"\s*:\s*"dark"\s*,/g ) || [ ] ) . length && ( n = n . replace ( /"theme"\s*:\s*"dark"\s*,/ , '"theme": "light",' ) ) , t ? e . replace ( DRAWING _COMPRESSED _REG , ` $ 1 ${ compress ( n ) } $ 3 ` ) : n ) : e } ; function getJSON ( e ) { let t , n ; if ( isCompressedMD ( e ) ) { const [ t , n ] = getDecompressedScene ( e ) ; return t ? { scene : t . substring ( 0 , t . lastIndexOf ( "}" ) + 1 ) , pos : n . value . index } : { scene : e , pos : n . value ? n . value . index : 0 } } if ( t = e . matchAll ( DRAWING _REG ) , n = t . next ( ) , n . done && ( t = e . matchAll ( DRAWING _REG _FALLBACK ) , n = t . next ( ) ) , n . value && n . value . length > 1 ) { const e = n . value [ 2 ] ; return { scene : e . substr ( 0 , e . lastIndexOf ( "}" ) + 1 ) , pos : n . value . index } } return { scene : e , pos : n . value ? n . value . index : 0 } } function getMarkdownDrawingSection ( e , t ) { return t ? ` ## Drawing \n \` \` \` compressed-json \n ${ compress ( e ) } \n \` \` \` \n %% ` : ` ## Drawing \n \` \` \` json \n ${ e } \n \` \` \` \n %% ` } const RE _EXCALIDRAWDATA _WITHSECTION _OK = /^(#\n+)%%\n+# Excalidraw Data(?:\n|$)/m , RE _EXCALIDRAWDATA _WITHSECTION _NOTOK = /#\n+%%\n+# Excalidraw Data(?:\n|$)/m , RE _EXCALIDRAWDATA _NOSECTION _OK = /^(%%\n+)?# Excalidraw Data(?:\n|$)/m , RE _TEXTELEMENTS _WITHSECTION _OK = /^#\n+%%\n+##? Text Elements(?:\n|$)/m , RE _TEXTELEMENTS _WITHSECTION _NOTOK = /#\n+%%\n+##? Text Elements(?:\n|$)/m , RE _TEXTELEMENTS _NOSECTION _OK = /^(%%\n+)?##? Text Elements(?:\n|$)/m , RE _EXCALIDRAWDATA _FALLBACK _1 = /(.*)%%\n+# Excalidraw Data(?:\n|$)/m , RE _EXCALIDRAWDATA _FALLBACK _2 = /(.*)# Excalidraw Data(?:\n|$)/m , RE _TEXTELEMENTS _FALLBACK _1 = /(.*)%%\n+##? Text Elements(?:\n|$)/m , RE _TEXTELEMENTS _FALLBACK _2 = /(.*)##? Text Elements(?:\n|$)/m , RE _DRAWING = /^(%%\n+)?##? Drawing\n/m , getExcalidrawMarkdownHeaderSection = ( e , t ) => { var n ; const r = e . search ( RE _DRAWING ) ; r > 0 && ( e = e . substring ( 0 , r ) ) ; const i = e . match ( RE _EXCALIDRAWDATA _WITHSECTION _OK ) ; let a = null !== ( n = null == i ? void 0 : i . index ) && void 0 !== n ? n : - 1 , o = ! 1 ; if ( a > 0 && ( a += i [ 1 ] . length ) , - 1 === a && ( a = e . search ( RE _EXCALIDRAWDATA _WITHSECTION _NOTOK ) , a > 0 && ( o = ! 0 ) ) , - 1 === a && ( a = e . search ( RE _EXCALIDRAWDATA _NOSECTION _OK ) ) , - 1 === a ) { const t = e . match ( RE _EXCALIDRAWDATA _FALLBACK _1 ) ; t && Boolean ( t [ 1 ] ) && ( a = t . index + t [ 1 ] . length ) } if ( - 1 === a ) { const t = e . match ( RE _EXCALIDRAWDATA _FALLBACK _2 ) ; t && Boolean ( t [ 1 ] ) && ( a = t . index + t [ 1 ] . length ) } if ( - 1 === a && ( a = e . search ( RE _TEXTELEMENTS _WITHSECTION _OK ) , a > 0 && ( a += 2 ) ) , - 1 === a && ( a = e . search ( RE _TEXTELEMENTS _WITHSECTION _NOTOK ) , a > 0 && ( o = ! 0 ) ) , - 1 === a && ( a = e . search ( RE _TEXTELEMENTS _NOSECTION _OK ) ) , - 1 === a ) { const t = e . match ( RE _TEXTELEMENTS _FALLBACK _1 ) ; t && Boolean ( t [ 1 ] ) && ( a = t . index + t [ 1 ] . length ) } if ( - 1 === a ) { const t = e . match ( RE _TEXTELEMENTS _FALLBACK _2 ) ; t && Boolean ( t [ 1 ] ) && ( a = t . index + t [ 1 ] . length ) } if ( - 1 === a && r > 0 && ( a = r ) , - 1 === a ) return e . endsWith ( "\n" ) ? e : e + "\n" ; let s = updateFrontmatterInString ( e . substring ( 0 , a ) , t ) ; return o ? s + "\n#\n" : s . endsWith ( "\n" ) ? s : s + "\n" } ; class ExcalidrawData { constructor ( e ) { this . plugin = e , this . textElements = null , this . scene = null , this . delete
2024-06-13 21:01:37 +03:00
/ * *
* chroma . js - JavaScript library for color conversions
*
* Copyright ( c ) 2011 - 2019 , Gregor Aisch
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions are met :
*
* 1. Redistributions of source code must retain the above copyright notice , this
* list of conditions and the following disclaimer .
*
* 2. Redistributions in binary form must reproduce the above copyright notice ,
* this list of conditions and the following disclaimer in the documentation
* and / or other materials provided with the distribution .
*
* 3. The name Gregor Aisch may not be used to endorse or promote products
* derived from this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED . IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT ,
* INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING ,
* BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
* DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT ( INCLUDING
* NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE ,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
*
* chroma . js includes colors from colorbrewer2 . org , which are released under
* the following license :
*
* Copyright ( c ) 2002 Cynthia Brewer , Mark Harrower ,
* and The Pennsylvania State University .
*
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing ,
* software distributed under the License is distributed on an
* "AS IS" BASIS , WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND ,
* either express or implied . See the License for the specific
* language governing permissions and limitations under the License .
*
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
*
* Named colors are taken from X11 Color Names .
* http : //www.w3.org/TR/css3-color/#svg-color
*
* @ preserve
2024-08-09 08:39:12 +03:00
* / c h r o m a $ 1 . e x p o r t s , f u n c t i o n ( e , t ) { e . e x p o r t s = f u n c t i o n ( ) { f o r ( v a r e = f u n c t i o n ( e , t , n ) { r e t u r n v o i d 0 = = = t & & ( t = 0 ) , v o i d 0 = = = n & & ( n = 1 ) , e < t ? t : e > n ? n : e } , t = e , n = { } , r = 0 , i = [ " B o o l e a n " , " N u m b e r " , " S t r i n g " , " F u n c t i o n " , " A r r a y " , " D a t e " , " R e g E x p " , " U n d e f i n e d " , " N u l l " ] ; r < i . l e n g t h ; r + = 1 ) { v a r a = i [ r ] ; n [ " [ o b j e c t " + a + " ] " ] = a . t o L o w e r C a s e ( ) } v a r o = f u n c t i o n ( e ) { r e t u r n n [ O b j e c t . p r o t o t y p e . t o S t r i n g . c a l l ( e ) ] | | " o b j e c t " } , s = o , l = o , c = M a t h . P I , d = { c l i p _ r g b : f u n c t i o n ( e ) { e . _ c l i p p e d = ! 1 , e . _ u n c l i p p e d = e . s l i c e ( 0 ) ; f o r ( v a r n = 0 ; n < = 3 ; n + + ) n < 3 ? ( ( e [ n ] < 0 | | e [ n ] > 2 5 5 ) & & ( e . _ c l i p p e d = ! 0 ) , e [ n ] = t ( e [ n ] , 0 , 2 5 5 ) ) : 3 = = = n & & ( e [ n ] = t ( e [ n ] , 0 , 1 ) ) ; r e t u r n e } , l i m i t : e , t y p e : o , u n p a c k : f u n c t i o n ( e , t ) { r e t u r n v o i d 0 = = = t & & ( t = n u l l ) , e . l e n g t h > = 3 ? A r r a y . p r o t o t y p e . s l i c e . c a l l ( e ) : " o b j e c t " = = s ( e [ 0 ] ) & & t ? t . s p l i t ( " " ) . f i l t e r ( ( f u n c t i o n ( t ) { r e t u r n v o i d 0 ! = = e [ 0 ] [ t ] } ) ) . m a p ( ( f u n c t i o n ( t ) { r e t u r n e [ 0 ] [ t ] } ) ) : e [ 0 ] } , l a s t : f u n c t i o n ( e ) { i f ( e . l e n g t h < 2 ) r e t u r n n u l l ; v a r t = e . l e n g t h - 1 ; r e t u r n " s t r i n g " = = l ( e [ t ] ) ? e [ t ] . t o L o w e r C a s e ( ) : n u l l } , P I : c , T W O P I : 2 * c , P I T H I R D : c / 3 , D E G 2 R A D : c / 1 8 0 , R A D 2 D E G : 1 8 0 / c } , T = { f o r m a t : { } , a u t o d e t e c t : [ ] } , u = d . l a s t , Q = d . c l i p _ r g b , p = d . t y p e , h = T , m = f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = a r g u m e n t s . l e n g t h ; t - - ; ) e [ t ] = a r g u m e n t s [ t ] ; v a r n = t h i s ; i f ( " o b j e c t " = = = p ( e [ 0 ] ) & & e [ 0 ] . c o n s t r u c t o r & & e [ 0 ] . c o n s t r u c t o r = = = t h i s . c o n s t r u c t o r ) r e t u r n e [ 0 ] ; v a r r = u ( e ) , i = ! 1 ; i f ( ! r ) { i = ! 0 , h . s o r t e d | | ( h . a u t o d e t e c t = h . a u t o d e t e c t . s o r t ( ( f u n c t i o n ( e , t ) { r e t u r n t . p - e . p } ) ) , h . s o r t e d = ! 0 ) ; f o r ( v a r a = 0 , o = h . a u t o d e t e c t ; a < o . l e n g t h ; a + = 1 ) { v a r s = o [ a ] ; i f ( r = s . t e s t . a p p l y ( s , e ) ) b r e a k } } i f ( ! h . f o r m a t [ r ] ) t h r o w n e w E r r o r ( " u n k n o w n f o r m a t : " + e ) ; v a r l = h . f o r m a t [ r ] . a p p l y ( n u l l , i ? e : e . s l i c e ( 0 , - 1 ) ) ; n . _ r g b = Q ( l ) , 3 = = = n . _ r g b . l e n g t h & & n . _ r g b . p u s h ( 1 ) } ; m . p r o t o t y p e . t o S t r i n g = f u n c t i o n ( ) { r e t u r n " f u n c t i o n " = = p ( t h i s . h e x ) ? t h i s . h e x ( ) : " [ " + t h i s . _ r g b . j o i n ( " , " ) + " ] " } ; v a r f = m , g = f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = a r g u m e n t s . l e n g t h ; t - - ; ) e [ t ] = a r g u m e n t s [ t ] ; r e t u r n n e w ( F u n c t i o n . p r o t o t y p e . b i n d . a p p l y ( g . C o l o r , [ n u l l ] . c o n c a t ( e ) ) ) } ; g . C o l o r = f , g . v e r s i o n = " 2 . 4 . 2 " ; v a r b = g , y = d . u n p a c k , v = M a t h . m a x , _ = f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = a r g u m e n t s . l e n g t h ; t - - ; ) e [ t ] = a r g u m e n t s [ t ] ; v a r n = y ( e , " r g b " ) , r = n [ 0 ] , i = n [ 1 ] , a = n [ 2 ] , o = 1 - v ( r / = 2 5 5 , v ( i / = 2 5 5 , a / = 2 5 5 ) ) , s = o < 1 ? 1 / ( 1 - o ) : 0 ; r e t u r n [ ( 1 - r - o ) * s , ( 1 - i - o ) * s , ( 1 - a - o ) * s , o ] } , L = d . u n p a c k , w = f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = a r g u m e n t s . l e n g t h ; t - - ; ) e [ t ] = a r g u m e n t s [ t ] ; v a r n = ( e = L ( e , " c m y k " ) ) [ 0 ] , r = e [ 1 ] , i = e [ 2 ] , a = e [ 3 ] , o = e . l e n g t h > 4 ? e [ 4 ] : 1 ; r e t u r n 1 = = = a ? [ 0 , 0 , 0 , o ] : [ n > = 1 ? 0 : 2 5 5 * ( 1 - n ) * ( 1 - a ) , r > = 1 ? 0 : 2 5 5 * ( 1 - r ) * ( 1 - a ) , i > = 1 ? 0 : 2 5 5 * ( 1 - i ) * ( 1 - a ) , o ] } , E = b , x = f , M = T , S = d . u n p a c k , H = d . t y p e , C = _ ; x . p r o t o t y p e . c m y k = f u n c t i o n ( ) { r e t u r n C ( t h i s . _ r g b ) } , E . c m y k = f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = a r g u m e n t s . l e n g t h ; t - - ; ) e [ t ] = a r g u m e n t s [ t ] ; r e t u r n n e w ( F u n c t i o n . p r o t o t y p e . b i n d . a p p l y ( x , [ n u l l ] . c o n c a t ( e , [ " c m y k " ] ) ) ) } , M . f o r m a t . c m y k = w , M . a u t o d e t e c t . p u s h ( { p : 2 , t e s t : f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = a r g u m e n t s . l e n g t h ; t - - ; ) e [ t ] = a r g u m e n t s [ t ] ; i f ( e = S ( e , " c m y k " ) , " a r r a y " = = = H ( e ) & & 4 = = = e . l e n g t h ) r e t u r n " c m y k " } } ) ; v a r O = d . u n p a c k , A = d . l a s t , k = f u n c t i o n ( e ) { r e t u r n M a t h . r o u n d ( 1 0 0 * e ) / 1 0 0 } , I = f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = a r g u m e n t s . l e n g t h ; t - - ; ) e [ t ] = a r g u m e n t s [ t ] ; v a r n = O ( e , " h s l a " ) , r = A ( e ) | | " l s a " ; r e t u r n n [ 0 ] = k ( n [ 0 ] | | 0 ) , n [ 1 ] = k ( 1 0 0 * n [ 1 ] ) + " % " , n [ 2 ] = k ( 1 0 0 * n [ 2 ] ) + " % " , " h s l a " = = = r | | n . l e n g t h > 3 & & n [ 3 ] < 1 ? ( n [ 3 ] = n . l e n g t h > 3 ? n [ 3 ] : 1 , r = " h s l a " ) : n . l e n g t h = 3 , r + " ( " + n . j o i n ( " , " ) + " ) " } , V = d . u n p a c k , N = f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = a r g u m e n t s . l e n g t h ; t - - ; ) e [ t ] = a r g u m e n t s [ t ] ; v a r n = ( e = V ( e , " r g b a " ) ) [ 0 ] , r = e [ 1 ] , i = e [ 2 ] ; n / = 2 5 5 , r / = 2 5 5 , i / = 2 5 5 ; v a r a , o , s = M a t h . m i n ( n , r , i ) , l = M a t h . m a x ( n , r , i ) , c = ( l + s ) / 2 ; r e t u r n l = = = s ? ( a = 0 , o = N u m b e r . N a N ) : a = c < . 5 ? ( l - s ) / ( l + s ) : ( l - s ) / ( 2 - l - s ) , n = = l ? o = ( r - i ) / ( l - s ) : r = = l ? o = 2 + ( i - n ) / ( l - s ) : i = = l & & ( o = 4 + ( n - r ) / ( l - s ) ) , ( o * = 6 0 ) < 0 & & ( o + = 3 6 0 ) , e . l e n g t h > 3 & & v o i d 0 ! = = e [ 3 ] ? [ o , a , c , e [ 3 ] ] : [ o , a , c ] } , P = d . u n p a c k , R = d . l a s t , D = I , $ = N , j = M a t h . r o u n d , F = f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = a r g u m e n t s . l e n g t h ; t - - ; ) e [ t ] = a r g u m e n t s [ t ] ; v a r n = P ( e , " r g b a " ) , r = R ( e ) | | " r g b " ; r e t u r n " h s l " = = r . s u b s t r ( 0 , 3 ) ? D ( $ ( n ) , r ) : ( n [ 0 ] = j ( n [ 0 ] ) , n [ 1 ] = j ( n [ 1 ] ) , n [ 2 ] = j ( n [ 2 ] ) , ( " r g b a " = = = r | | n . l e n g t h > 3 & & n [ 3 ] < 1 ) & & ( n [ 3 ] = n . l e n g t h > 3 ? n [ 3 ] : 1 , r = " r g b a " ) , r + " ( " + n . s l i c e ( 0 , " r g b " = = = r ? 3 : 4 ) . j o i n ( " , " ) + " ) " ) } , B = d . u n p a c k , G = M a t h . r o u n d , U = f u n c t i o n ( ) { f o r ( v a r e , t = [ ] , n = a r g u m e n t s . l e n g t h ; n - - ; ) t [ n ] = a r g u m e n t s [ n ] ; v a r r , i , a , o = ( t = B ( t , " h s l " ) ) [ 0 ] , s = t [ 1 ] , l = t [ 2 ] ; i f ( 0 = = = s ) r = i = a = 2 5 5 * l ; e l s e { v a r c = [ 0 , 0 , 0 ] , d = [ 0 , 0 , 0 ] , T = l < . 5 ? l * ( 1 + s ) : l + s - l * s , u = 2 * l - T , Q = o / 3 6 0 ; c [ 0 ] = Q + 1 / 3 , c [ 1 ] = Q , c [ 2 ] = Q - 1 / 3 ; f o r ( v a r p = 0 ; p < 3 ; p + + ) c [ p ] < 0 & & ( c [ p ] + = 1 ) , c [ p ] > 1 & & ( c [ p ] - = 1 ) , 6 * c [ p ] < 1 ? d [ p ] = u + 6 * ( T - u ) * c [ p ] : 2 * c [ p ] < 1 ? d
2024-06-13 21:01:37 +03:00
//!Temporary hack
2024-08-09 08:39:12 +03:00
if ( this . activeExcalidrawView = i , i ? ( this . addModalContainerObserver ( ) , this . lastActiveExcalidrawFilePath = null === ( t = i . file ) || void 0 === t ? void 0 : t . path ) : this . removeModalContainerObserver ( ) , DEVICE . isMobile && i && ! r ) { const e = document . querySelector ( "body>.app-container>.mobile-navbar" ) ; e && e instanceof HTMLDivElement && ( e . style . position = "relative" ) } if ( DEVICE . isMobile && ! i && r ) { const e = document . querySelector ( "body>.app-container>.mobile-navbar" ) ; e && e instanceof HTMLDivElement && ( e . style . position = "" ) } if ( r && r !== i && ( r . leaf !== e && ( null == r ? void 0 : r . isDirty ( ) ) && ! ( null === ( n = r . semaphores ) || void 0 === n ? void 0 : n . viewunload ) && await r . save ( ! 0 ) , r . file && this . triggerEmbedUpdates ( r . file . path ) ) , i && ( ! r || r . leaf !== e ) ) { const e = i . file ; i . file && setTimeout ( ( ( ) => { var t ; i && i . _loaded && ( null === ( t = i . file ) || void 0 === t ? void 0 : t . path ) === ( null == e ? void 0 : e . path ) && ( i . activeLoader || i . loadSceneFiles ( ) ) } ) , 2e3 ) } if ( i && i . _loaded && i . isLoaded && i . excalidrawAPI && this . ea . onCanvasColorChangeHook && this . ea . onCanvasColorChangeHook ( this . ea , i , i . excalidrawAPI . getAppState ( ) . viewBackgroundColor ) , this . popScope && ( this . popScope ( ) , this . popScope = null ) , i ) { const e = this . app . keymap . getRootScope ( ) , t = e . register ( [ "Mod" ] , "Enter" , ( ( ) => ! 0 ) ) ; e . keys . unshift ( e . keys . pop ( ) ) ; const n = e . register ( [ "Mod" ] , "k" , ( ( ) => ! 0 ) ) ; e . keys . unshift ( e . keys . pop ( ) ) ; const r = e . register ( [ "Mod" ] , "f" , ( ( ) => { const e = this . app . workspace . getActiveViewOfType ( ExcalidrawView ) ; return ! ! e && ( search ( e ) , ! 0 ) } ) ) ; e . keys . unshift ( e . keys . pop ( ) ) ; const i = this . forceSaveCommand && "s" === this . forceSaveCommand . hotkeys [ 0 ] . key && this . forceSaveCommand . hotkeys [ 0 ] . modifiers . includes ( "Ctrl" ) ? e . register ( [ "Ctrl" ] , "s" , ( ( ) => this . forceSaveActiveView ( ! 1 ) ) ) : void 0 ; i && e . keys . unshift ( e . keys . pop ( ) ) , this . popScope = ( ) => { e . unregister ( t ) , e . unregister ( n ) , e . unregister ( r ) , Boolean ( i ) && e . unregister ( i ) } } } registerEventListeners ( ) { this . app . workspace . onLayoutReady ( ( async ( ) => { const e = ( e , t , n ) => { var r ; if ( e . defaultPrevented ) return ; const i = e . clipboardData . getData ( "text/plain" ) ; if ( i && i . startsWith ( '{"type":"excalidraw/clipboard"' ) ) { e . preventDefault ( ) ; try { const e = JSON . parse ( i ) , a = 1 === e . elements . filter ( ( e => "text" === e . type ) ) . length ; if ( ! a && 1 !== ( null === ( r = e . elements ) || void 0 === r ? void 0 : r . length ) ) return ; const o = a ? e . elements . filter ( ( e => "text" === e . type ) ) [ 0 ] : e . elements [ 0 ] ; if ( "image" === o . type ) { const e = this . filesMaster . get ( o . fileId ) ; if ( e && e . path ) { let r = e . path ; const i = n . file , a = this . app . vault . getAbstractFileByPath ( r ) ; i && a && a instanceof obsidian _module . TFile && ( r = this . app . metadataCache . fileToLinktext ( a , i . path ) ) , editorInsertText ( t , getLink ( this , { path : r } ) ) } return } if ( "text" === o . type ) return void editorInsertText ( t , o . rawText ) ; if ( o . link ) return void editorInsertText ( t , ` ${ o . link } ` ) } catch ( e ) { } } } ; this . registerEvent ( this . app . workspace . on ( "editor-paste" , ( ( t , n , r ) => e ( t , n , r ) ) ) ) ; const t = async ( e , t ) => { e instanceof obsidian _module . TFile && this . isExcalidrawFile ( e ) && this . settings . keepInSync && [ EXPORT _TYPES , "excalidraw" ] . flat ( ) . forEach ( ( async n => { const r = getIMGFilename ( t , n ) , i = app . vault . getAbstractFileByPath ( obsidian _module . normalizePath ( r ) ) ; if ( i && i instanceof obsidian _module . TFile ) { const t = getIMGFilename ( e . path , n ) ; await this . app . fileManager . renameFile ( i , t ) } } ) ) } ; this . registerEvent ( this . app . vault . on ( "rename" , ( ( e , n ) => t ( e , n ) ) ) ) ; const n = async e => { this . app . workspace . getLeavesOfType ( "excalidraw" ) . forEach ( ( async t => { var n , r , i ; const a = t . view ; if ( ! ( null === ( n = a . semaphores ) || void 0 === n ? void 0 : n . viewunload ) && a . file && ( a . file . path === e . path || "excalidraw" === e . extension && ` ${ e . path . substring ( 0 , e . path . lastIndexOf ( ".excalidraw" ) ) } .md ` === a . file . path ) ) { if ( null === ( r = a . semaphores ) || void 0 === r ? void 0 : r . preventReload ) return void ( a . semaphores . preventReload = ! 1 ) ; if ( a . lastSaveTimestamp + 3e5 < Date . now ( ) ) return void a . reload ( ! 0 , a . file ) ; if ( "md" === e . extension ) { if ( null === ( i = a . semaphores ) || void 0 === i ? void 0 : i . embeddableIsEditingSelf ) return ; const t = new ExcalidrawData ( this ) , n = await this . app . vault . read ( e ) ; await t . loadData ( n , e , getTextMode ( n ) ) , a . synchronizeWithData ( t ) , t . destroy ( ) , ( null == a ? void 0 : a . isDirty ( ) ) && ( a . autosaveTimer && a . autosaveFunction && clearTimeout ( a . autosaveTimer ) , a . autosaveFunction && a . autosaveFunction ( ) ) } else a . reload ( ! 0 , a . file ) } } ) ) } ; this . registerEvent ( this . app . vault . on ( " modify