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-07-24 08:46:38 +03:00
let EXCALIDRAW _PACKAGES = LZString . decompressFromBase64 ( " PQKhCgAIUgBAbAlgYwKYDsDOrICVUCGyALlDAE6EkB0ADuQPYAmAriYg + tQLaJcBWmMmUgBhBrQCe5RAHMAFsUgAKZAEpIAMSKoARgwYBrADSQAkumTVIBdE0iJimGwDMXiJAWKpM1YdEgAFXlEZ0wGFnI0SGRmHFDIJDQsVHsWO1RySGJ5HABZM0DElAxsSBcIuwd0bNyRABkzUQBRADkAZWbyj3ianJxGBiUmREoSBnJJSAYXWoTwyOjiSlQ / aGBwZRd09k5lNQBvAHIWMsxllGIjgG4tneIOdFVjAA9DgCIGXX5UEneAXkBxEktFQM0gqBetAmTgAZLD3ukmKh3OhUu8AIRAkFg2bcZgseCoAD8L2UkOh5CcagAXO9tpYHpwAdjQeDkajUPCOXxVgRuExiTy0coANrvCkwzDvAC6r1pqn + yAAP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RcGIJeFsNMPkPYPLUwFBBSGIMkE8NYLMIcNCnxGINx2CO0IUIcMDlx0kGIKTBMMoPzAdwmGMGPANFCDyEqG8FxRDRv2jHP37HQGTVOVOU0AmDQAAFVdx9xkMY5 + 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-07-24 08:46:38 +03:00
let PLUGIN _VERSION = "2.2.10" ; ; 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 i = Object . getOwnPropertyDescriptor ( e , n ) ; Object . defineProperty ( t , n , i . get ? i : { 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 i = ( 2 << Math . log ( e . length - 1 ) / Math . LN2 ) - 1 , r = - ~ ( 1.6 * i * t / e . length ) ; return ( o = t ) => { let a = "" ; for ( ; ; ) { let t = n ( r ) , s = r ; for ( ; s -- ; ) if ( a += e [ t [ s ] & i ] || "" , a . length === o ) return a } } } , 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 , getDefaultLineHeight : getDefaultLineHeight , wrapText : wrapText , getFontString : getFontString , getBoundTextMaxWidth : getBoundTextMaxWidth , exportToSvg : exportToSvg , exportToBlob : exportToBlob , mutateElement : mutateElement , restore : restore , mermaidToExcalidraw : mermaidToExcalidraw , getContainerElement : getContainerElement , refreshTextDimensions : refreshTextDimensions } = excalidrawLib ; 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 _LINKINDEX _INVALIDCHARS = /[<>:"\\|?*#]/g , REG _SECTION _REF _CLEAN = /([:#|^\\\r\n]|%%|\[\[|]])/g , REG _BLOCK _REF _CLEAN
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-24 08:46:38 +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 , i = { } ; for ( t in e ) for ( n in e [ t ] ) { var r = n . split ( "|" ) ; e [ t ] [ n ] . stateArray = r ; for ( var o = 0 ; o < r . length ; o ++ ) i [ r [ o ] ] = [ ] } for ( t in e ) for ( n in e [ t ] ) for ( r = e [ t ] [ n ] . stateArray || [ ] , o = 0 ; o < r . length ; o ++ ) { var a = e [ t ] [ n ] ; a . action _ = [ ] . concat ( a . action _ ) ; for ( var s = 0 ; s < a . action _ . length ; s ++ ) "string" == typeof a . action _ [ s ] && ( a . action _ [ s ] = { type _ : a . action _ [ s ] } ) ; for ( var l = t . split ( "|" ) , c = 0 ; c < l . length ; c ++ ) if ( "*" === r [ o ] ) { var T = void 0 ; for ( T in i ) i [ T ] . push ( { pattern : l [ c ] , task : a } ) } else i [ r [ o ] ] . push ( { pattern : l [ c ] , task : a } ) } return i } mhchemParser$1 . mhchemParser = mhchemParser ; var _mhchemParser = { go : function ( e , t ) { if ( ! e ) return [ ] ; void 0 === t && ( t = "ce" ) ; var n , i = "0" , r = { parenthesisLevel : 0 } ; e = ( e = ( e = e . replace ( /\n/g , " " ) ) . replace ( /[\u2212\u2013\u2014\u2010]/g , "-" ) ) . replace ( /[\u2026]/g , "..." ) ; for ( var o = 10 , a = [ ] ; ; ) { n !== e ? ( o = 10 , n = e ) : o -- ; var s = _mhchemParser . stateMachines [ t ] , l = s . transitions [ i ] || s . transitions [ "*" ] ; e : for ( var c = 0 ; c < l . length ; c ++ ) { var T = _mhchemParser . patterns . match _ ( l [ c ] . pattern , e ) ; if ( T ) { for ( var d = l [ c ] . task , Q = 0 ; Q < d . action _ . length ; Q ++ ) { var u = void 0 ; if ( s . actions [ d . action _ [ Q ] . type _ ] ) u = s . actions [ d . action _ [ Q ] . type _ ] ( r , T . match _ , d . action _ [ Q ] . option ) ; else { if ( ! _mhchemParser . actions [ d . action _ [ Q ] . type _ ] ) throw [ "MhchemBugA" , "mhchem bug A. Please report. (" + d . action _ [ Q ] . type _ + ")" ] ; u = _mhchemParser . actions [ d . action _ [ Q ] . type _ ] ( r , T . match _ , d . action _ [ Q ] . option ) } _mhchemParser . concatArray ( a , u ) } if ( i = d . nextState || i , ! ( e . length > 0 ) ) return a ; if ( d . revisit || ( e = T . remainder ) , ! d . toContinue ) break e } } if ( o <= 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-07-24 08:46:38 +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 , i , r , o ; if ( t ) for ( n = 0 , i = ( o = Object . keys ( t ) ) . length ; n < i ; n += 1 ) e [ r = o [ n ] ] = t [ r ] ; return e } function repeat ( e , t ) { var n , i = "" ; for ( n = 0 ; n < t ; n += 1 ) i += e ; return i } 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 = "" , i = 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 ) , i + " " + n ) : i } 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 , i , r ) { var o = "" , a = "" , s = Math . floor ( r / 2 ) - 1 ; return i - t > s && ( t = i - s + ( o = " ... " ) . length ) , n - i > s && ( n = i + s - ( a = " ..." ) . length ) , { str : o + e . slice ( t , n ) . replace ( /\t/g , "→" ) + a , pos : i - t + o . 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 , i = /\r?\n|\r|\0/g , r = [ 0 ] , o = [ ] , a = - 1 ; n = i . exec ( e . buffer ) ; ) o . push ( n . index ) , r . push ( n . index + n [ 0 ] . length ) , e . position <= n . index && a < 0 && ( a = r . length - 2 ) ; a < 0 && ( a = r . length - 1 ) ; var s , l , c = "" , T = Math . min ( e . line + t . linesAfter , o . length ) . toString ( ) . length , d = t . maxLength - ( t . indent + T + 3 ) ; for ( s = 1 ; s <= t . linesBefore && ! ( a - s < 0 ) ; s ++ ) l = getLine ( e . buffer , r [ a - s ] , o [ a - s ] , e . position - ( r [ a ] - r [ a - s ] ) , d ) , c = common . repeat ( " " , t . indent ) + padStart ( ( e . line - s + 1 ) . toString ( ) , T ) + " | " + l . str + "\n" + c ; for ( l = getLine ( e . buffer , r [ a ] , o [ a ] , e . position , d ) , c += common . repeat ( " " , t . indent ) + padStart ( ( e . line + 1 ) . toString ( ) , T ) + " | " + l . str + "\n" , c += common . repeat ( "-" , t . indent + T + 3 + l . pos ) + "^\n" , s = 1 ; s <= t . linesAfter && ! ( a + s >= o . length ) ; s ++ ) l = getLine ( e . buffer , r [ a + s ] , o [ a + s ] , e . position - ( r [ a ] - r [ a + s ] ) , d ) , c += common . repeat ( " " , t . indent ) + padStart ( ( e . line + s + 1 ) . toString ( ) , T ) + " | " + 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 , i ) { n . tag === e . tag && n . kind === e . kind && n . multi === e . multi && ( t = i ) } ) ) , n [ t ] = e } ) ) , n } function compileMap ( ) { var e , t , n = { scalar : { } , sequence : { } , mapping : { } , fallback : { } , multi : { scala
2024-06-13 21:01:37 +03:00
//![[link|alias]] [alias](link){num}
2024-07-24 08:46:38 +03:00
EXPR : /(!)?(\[\[([^|\]]+)\|?([^\]]+)?]]|\[([^\]]*)]\(([^)]*)\))(\{(\d+)\})?/g , getResList : e => { const t = e . matchAll ( REGEX _LINK . EXPR ) ; let n ; const i = [ ] ; for ( ; ! ( n = t . next ( ) ) . done ; ) i . push ( n ) ; return i } , 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 i = e . search ( RE _DRAWING ) ; i > 0 && ( e = e . substring ( 0 , i ) ) ; const r = e . match ( RE _EXCALIDRAWDATA _WITHSECTION _OK ) ; let o = null !== ( n = null == r ? void 0 : r . index ) && void 0 !== n ? n : - 1 , a = ! 1 ; if ( o > 0 && ( o += r [ 1 ] . length ) , - 1 === o && ( o = e . search ( RE _EXCALIDRAWDATA _WITHSECTION _NOTOK ) , o > 0 && ( a = ! 0 ) ) , - 1 === o && ( o = e . search ( RE _EXCALIDRAWDATA _NOSECTION _OK ) ) , - 1 === o ) { const t = e . match ( RE _EXCALIDRAWDATA _FALLBACK _1 ) ; t && Boolean ( t [ 1 ] ) && ( o = t . index + t [ 1 ] . length ) } if ( - 1 === o ) { const t = e . match ( RE _EXCALIDRAWDATA _FALLBACK _2 ) ; t && Boolean ( t [ 1 ] ) && ( o = t . index + t [ 1 ] . length ) } if ( - 1 === o && ( o = e . search ( RE _TEXTELEMENTS _WITHSECTION _OK ) , o > 0 && ( o += 2 ) ) , - 1 === o && ( o = e . search ( RE _TEXTELEMENTS _WITHSECTION _NOTOK ) , o > 0 && ( a = ! 0 ) ) , - 1 === o && ( o = e . search ( RE _TEXTELEMENTS _NOSECTION _OK ) ) , - 1 === o ) { const t = e . match ( RE _TEXTELEMENTS _FALLBACK _1 ) ; t && Boolean ( t [ 1 ] ) && ( o = t . index + t [ 1 ] . length ) } if ( - 1 === o ) { const t = e . match ( RE _TEXTELEMENTS _FALLBACK _2 ) ; t && Boolean ( t [ 1 ] ) && ( o = t . index + t [ 1 ] . length ) } if ( - 1 === o && i > 0 && ( o = i ) , - 1 === o ) return e . endsWith ( "\n" ) ? e : e + "\n" ; let s = updateFrontmatterInString ( e . substring ( 0 , o ) , t ) ; return a ? 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-07-24 08:46:38 +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 = { } , i = 0 , r = [ " 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 " ] ; i < r . l e n g t h ; i + = 1 ) { v a r o = r [ i ] ; n [ " [ o b j e c t " + o + " ] " ] = o . t o L o w e r C a s e ( ) } v a r a = 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 = a , l = a , c = M a t h . P I , T = { 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 : a , 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 } , d = { f o r m a t : { } , a u t o d e t e c t : [ ] } , Q = T . l a s t , u = T . c l i p _ r g b , h = T . t y p e , p = d , 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 " = = = h ( 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 i = Q ( e ) , r = ! 1 ; i f ( ! i ) { r = ! 0 , p . s o r t e d | | ( p . a u t o d e t e c t = p . 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 } ) ) , p . s o r t e d = ! 0 ) ; f o r ( v a r o = 0 , a = p . a u t o d e t e c t ; o < a . l e n g t h ; o + = 1 ) { v a r s = a [ o ] ; i f ( i = s . t e s t . a p p l y ( s , e ) ) b r e a k } } i f ( ! p . f o r m a t [ i ] ) 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 = p . f o r m a t [ i ] . a p p l y ( n u l l , r ? e : e . s l i c e ( 0 , - 1 ) ) ; n . _ r g b = u ( 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 " = = h ( 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 = T . u n p a c k , L = M a t h . m a x , v = 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 " ) , i = n [ 0 ] , r = n [ 1 ] , o = n [ 2 ] , a = 1 - L ( i / = 2 5 5 , L ( r / = 2 5 5 , o / = 2 5 5 ) ) , s = a < 1 ? 1 / ( 1 - a ) : 0 ; r e t u r n [ ( 1 - i - a ) * s , ( 1 - r - a ) * s , ( 1 - o - a ) * s , a ] } , w = T . u n p a c k , E = 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 = w ( e , " c m y k " ) ) [ 0 ] , i = e [ 1 ] , r = e [ 2 ] , o = e [ 3 ] , a = e . l e n g t h > 4 ? e [ 4 ] : 1 ; r e t u r n 1 = = = o ? [ 0 , 0 , 0 , a ] : [ n > = 1 ? 0 : 2 5 5 * ( 1 - n ) * ( 1 - o ) , i > = 1 ? 0 : 2 5 5 * ( 1 - i ) * ( 1 - o ) , r > = 1 ? 0 : 2 5 5 * ( 1 - r ) * ( 1 - o ) , a ] } , _ = b , M = f , x = d , H = T . u n p a c k , S = T . t y p e , C = v ; M . 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 ) } , _ . 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 ( M , [ n u l l ] . c o n c a t ( e , [ " c m y k " ] ) ) ) } , x . f o r m a t . c m y k = E , x . 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 = H ( e , " c m y k " ) , " a r r a y " = = = S ( e ) & & 4 = = = e . l e n g t h ) r e t u r n " c m y k " } } ) ; v a r O = T . u n p a c k , A = T . l a s t , I = 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 } , V = 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 " ) , i = A ( e ) | | " l s a " ; r e t u r n n [ 0 ] = I ( n [ 0 ] | | 0 ) , n [ 1 ] = I ( 1 0 0 * n [ 1 ] ) + " % " , n [ 2 ] = I ( 1 0 0 * n [ 2 ] ) + " % " , " h s l a " = = = i | | n . l e n g t h > 3 & & n [ 3 ] < 1 ? ( n [ 3 ] = n . l e n g t h > 3 ? n [ 3 ] : 1 , i = " h s l a " ) : n . l e n g t h = 3 , i + " ( " + n . j o i n ( " , " ) + " ) " } , k = T . 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 = k ( e , " r g b a " ) ) [ 0 ] , i = e [ 1 ] , r = e [ 2 ] ; n / = 2 5 5 , i / = 2 5 5 , r / = 2 5 5 ; v a r o , a , s = M a t h . m i n ( n , i , r ) , l = M a t h . m a x ( n , i , r ) , c = ( l + s ) / 2 ; r e t u r n l = = = s ? ( o = 0 , a = N u m b e r . N a N ) : o = c < . 5 ? ( l - s ) / ( l + s ) : ( l - s ) / ( 2 - l - s ) , n = = l ? a = ( i - r ) / ( l - s ) : i = = l ? a = 2 + ( r - n ) / ( l - s ) : r = = l & & ( a = 4 + ( n - i ) / ( l - s ) ) , ( a * = 6 0 ) < 0 & & ( a + = 3 6 0 ) , e . l e n g t h > 3 & & v o i d 0 ! = = e [ 3 ] ? [ a , o , c , e [ 3 ] ] : [ a , o , c ] } , P = T . u n p a c k , R = T . l a s t , D = V , j = N , F = M a t h . r o u n d , B = 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 " ) , i = R ( e ) | | " r g b " ; r e t u r n " h s l " = = i . s u b s t r ( 0 , 3 ) ? D ( j ( n ) , i ) : ( n [ 0 ] = F ( n [ 0 ] ) , n [ 1 ] = F ( n [ 1 ] ) , n [ 2 ] = F ( n [ 2 ] ) , ( " r g b a " = = = i | | n . l e n g t h > 3 & & n [ 3 ] < 1 ) & & ( n [ 3 ] = n . l e n g t h > 3 ? n [ 3 ] : 1 , i = " r g b a " ) , i + " ( " + n . s l i c e ( 0 , " r g b " = = = i ? 3 : 4 ) . j o i n ( " , " ) + " ) " ) } , G = T . u n p a c k , W = M a t h . r o u n d , $ = 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 i , r , o , a = ( t = G ( t , " h s l " ) ) [ 0 ] , s = t [ 1 ] , l = t [ 2 ] ; i f ( 0 = = = s ) i = r = o = 2 5 5 * l ; e l s e { v a r c = [ 0 , 0 , 0 ] , T = [ 0 , 0 , 0 ] , d = l < . 5 ? l * ( 1 + s ) : l + s - l * s , Q = 2 * l - d , u = a / 3 6 0 ; c [ 0 ] = u + 1 / 3 , c [ 1 ] = u , c [ 2 ] = u - 1 / 3 ; f o r ( v a r h = 0 ; h < 3 ; h + + ) c [ h ] < 0 & & ( c [ h ] + = 1 ) , c [ h ] > 1 & & ( c [ h ] - = 1 ) , 6 * c [ h ] < 1 ? T [ h ] = Q + 6 * ( d - Q ) * c [ h ] : 2 * c [ h ] < 1 ? T
2024-06-13 21:01:37 +03:00
//!Temporary hack
2024-07-13 19:25:17 +03:00
if ( this . activeExcalidrawView = r , r ? ( this . addModalContainerObserver ( ) , this . lastActiveExcalidrawFilePath = null === ( t = r . file ) || void 0 === t ? void 0 : t . path ) : this . removeModalContainerObserver ( ) , DEVICE . isMobile && r && ! i ) { const e = document . querySelector ( "body>.app-container>.mobile-navbar" ) ; e && e instanceof HTMLDivElement && ( e . style . position = "relative" ) } if ( DEVICE . isMobile && ! r && i ) { const e = document . querySelector ( "body>.app-container>.mobile-navbar" ) ; e && e instanceof HTMLDivElement && ( e . style . position = "" ) } if ( i && i !== r && ( i . leaf !== e && ( null == i ? void 0 : i . isDirty ( ) ) && ! ( null === ( n = i . semaphores ) || void 0 === n ? void 0 : n . viewunload ) && await i . save ( ! 0 ) , i . file && this . triggerEmbedUpdates ( i . file . path ) ) , r && ( ! i || i . leaf !== e ) ) { const e = r . file ; r . file && setTimeout ( ( ( ) => { var t ; r && r . _loaded && ( null === ( t = r . file ) || void 0 === t ? void 0 : t . path ) === ( null == e ? void 0 : e . path ) && ( r . activeLoader || r . loadSceneFiles ( ) ) } ) , 2e3 ) } if ( r && r . _loaded && r . isLoaded && r . excalidrawAPI && this . ea . onCanvasColorChangeHook && this . ea . onCanvasColorChangeHook ( this . ea , r , r . excalidrawAPI . getAppState ( ) . viewBackgroundColor ) , this . popScope && ( this . popScope ( ) , this . popScope = null ) , r ) { 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 i = e . register ( [ "Mod" ] , "f" , ( ( ) => { const e = this . app . workspace . getActiveViewOfType ( ExcalidrawView ) ; return ! ! e && ( search ( e ) , ! 0 ) } ) ) ; e . keys . unshift ( e . keys . pop ( ) ) ; const r = this . forceSaveCommand && "s" === this . forceSaveCommand . hotkeys [ 0 ] . key && this . forceSaveCommand . hotkeys [ 0 ] . modifiers . includes ( "Ctrl" ) ? e . register ( [ "Ctrl" ] , "s" , ( ( ) => this . forceSaveActiveView ( ! 1 ) ) ) : void 0 ; r && e . keys . unshift ( e . keys . pop ( ) ) , this . popScope = ( ) => { e . unregister ( t ) , e . unregister ( n ) , e . unregister ( i ) , Boolean ( r ) && e . unregister ( r ) } } } registerEventListeners ( ) { this . app . workspace . onLayoutReady ( ( async ( ) => { const e = ( e , t , n ) => { var i ; if ( e . defaultPrevented ) return ; const r = e . clipboardData . getData ( "text/plain" ) ; if ( r && r . startsWith ( '{"type":"excalidraw/clipboard"' ) ) { e . preventDefault ( ) ; try { const e = JSON . parse ( r ) , o = 1 === e . elements . filter ( ( e => "text" === e . type ) ) . length ; if ( ! o && 1 !== ( null === ( i = e . elements ) || void 0 === i ? void 0 : i . length ) ) return ; const a = o ? e . elements . filter ( ( e => "text" === e . type ) ) [ 0 ] : e . elements [ 0 ] ; if ( "image" === a . type ) { const e = this . filesMaster . get ( a . fileId ) ; if ( e && e . path ) { let i = e . path ; const r = n . file , o = this . app . vault . getAbstractFileByPath ( i ) ; r && o && o instanceof obsidian _module . TFile && ( i = this . app . metadataCache . fileToLinktext ( o , r . path ) ) , editorInsertText ( t , getLink ( this , { path : i } ) ) } return } if ( "text" === a . type ) return void editorInsertText ( t , a . rawText ) ; if ( a . link ) return void editorInsertText ( t , ` ${ a . link } ` ) } catch ( e ) { } } } ; this . registerEvent ( this . app . workspace . on ( "editor-paste" , ( ( t , n , i ) => e ( t , n , i ) ) ) ) ; const t = async ( e , t ) => { e instanceof obsidian _module . TFile && this . isExcalidrawFile ( e ) && this . settings . keepInSync && [ EXPORT _TYPES , "excalidraw" ] . flat ( ) . forEach ( ( async n => { const i = getIMGFilename ( t , n ) , r = app . vault . getAbstractFileByPath ( obsidian _module . normalizePath ( i ) ) ; if ( r && r instanceof obsidian _module . TFile ) { const t = getIMGFilename ( e . path , n ) ; await this . app . fileManager . renameFile ( r , 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 , i , r ; const o = t . view ; if ( ! ( null === ( n = o . semaphores ) || void 0 === n ? void 0 : n . viewunload ) && o . file && ( o . file . path === e . path || "excalidraw" === e . extension && ` ${ e . path . substring ( 0 , e . path . lastIndexOf ( ".excalidraw" ) ) } .md ` === o . file . path ) ) { if ( null === ( i = o . semaphores ) || void 0 === i ? void 0 : i . preventReload ) return void ( o . semaphores . preventReload = ! 1 ) ; if ( o . lastSaveTimestamp + 3e5 < Date . now ( ) ) return void o . reload ( ! 0 , o . file ) ; if ( "md" === e . extension ) { if ( null === ( r = o . semaphores ) || void 0 === r ? void 0 : r . embeddableIsEditingSelf ) return ; const t = new ExcalidrawData ( this ) , n = await this . app . vault . read ( e ) ; await t . loadData ( n , e , getTextMode ( n ) ) , o . synchronizeWithData ( t ) , t . destroy ( ) , ( null == o ? void 0 : o . isDirty ( ) ) && ( o . autosaveTimer && o . autosaveFunction && clearTimeout ( o . autosaveTimer ) , o . autosaveFunction && o . autosaveFunction ( ) ) } else o . reload ( ! 0 , o . file ) } } ) ) } ; this . registerEvent ( this . app . vault . on ( " modify