@zsviczian/excalidraw 0.18.0-56 → 0.18.0-58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8363,7 +8363,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
8363
8363
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
8364
8364
|
|
|
8365
8365
|
"use strict";
|
|
8366
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n\n\nlet FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;\nif (typeof process !== 'undefined') {\n\t({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = ({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-
|
|
8366
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n\n\nlet FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;\nif (typeof process !== 'undefined') {\n\t({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = ({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-58\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true}) || 0);\n\tisTTY = process.stdout && process.stdout.isTTY;\n}\n\nconst $ = {\n\tenabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (\n\t\tFORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY\n\t),\n\n\t// modifiers\n\treset: init(0, 0),\n\tbold: init(1, 22),\n\tdim: init(2, 22),\n\titalic: init(3, 23),\n\tunderline: init(4, 24),\n\tinverse: init(7, 27),\n\thidden: init(8, 28),\n\tstrikethrough: init(9, 29),\n\n\t// colors\n\tblack: init(30, 39),\n\tred: init(31, 39),\n\tgreen: init(32, 39),\n\tyellow: init(33, 39),\n\tblue: init(34, 39),\n\tmagenta: init(35, 39),\n\tcyan: init(36, 39),\n\twhite: init(37, 39),\n\tgray: init(90, 39),\n\tgrey: init(90, 39),\n\n\t// background colors\n\tbgBlack: init(40, 49),\n\tbgRed: init(41, 49),\n\tbgGreen: init(42, 49),\n\tbgYellow: init(43, 49),\n\tbgBlue: init(44, 49),\n\tbgMagenta: init(45, 49),\n\tbgCyan: init(46, 49),\n\tbgWhite: init(47, 49)\n};\n\nfunction run(arr, str) {\n\tlet i=0, tmp, beg='', end='';\n\tfor (; i < arr.length; i++) {\n\t\ttmp = arr[i];\n\t\tbeg += tmp.open;\n\t\tend += tmp.close;\n\t\tif (!!~str.indexOf(tmp.close)) {\n\t\t\tstr = str.replace(tmp.rgx, tmp.close + tmp.open);\n\t\t}\n\t}\n\treturn beg + str + end;\n}\n\nfunction chain(has, keys) {\n\tlet ctx = { has, keys };\n\n\tctx.reset = $.reset.bind(ctx);\n\tctx.bold = $.bold.bind(ctx);\n\tctx.dim = $.dim.bind(ctx);\n\tctx.italic = $.italic.bind(ctx);\n\tctx.underline = $.underline.bind(ctx);\n\tctx.inverse = $.inverse.bind(ctx);\n\tctx.hidden = $.hidden.bind(ctx);\n\tctx.strikethrough = $.strikethrough.bind(ctx);\n\n\tctx.black = $.black.bind(ctx);\n\tctx.red = $.red.bind(ctx);\n\tctx.green = $.green.bind(ctx);\n\tctx.yellow = $.yellow.bind(ctx);\n\tctx.blue = $.blue.bind(ctx);\n\tctx.magenta = $.magenta.bind(ctx);\n\tctx.cyan = $.cyan.bind(ctx);\n\tctx.white = $.white.bind(ctx);\n\tctx.gray = $.gray.bind(ctx);\n\tctx.grey = $.grey.bind(ctx);\n\n\tctx.bgBlack = $.bgBlack.bind(ctx);\n\tctx.bgRed = $.bgRed.bind(ctx);\n\tctx.bgGreen = $.bgGreen.bind(ctx);\n\tctx.bgYellow = $.bgYellow.bind(ctx);\n\tctx.bgBlue = $.bgBlue.bind(ctx);\n\tctx.bgMagenta = $.bgMagenta.bind(ctx);\n\tctx.bgCyan = $.bgCyan.bind(ctx);\n\tctx.bgWhite = $.bgWhite.bind(ctx);\n\n\treturn ctx;\n}\n\nfunction init(open, close) {\n\tlet blk = {\n\t\topen: `\\x1b[${open}m`,\n\t\tclose: `\\x1b[${close}m`,\n\t\trgx: new RegExp(`\\\\x1b\\\\[${close}m`, 'g')\n\t};\n\treturn function (txt) {\n\t\tif (this !== void 0 && this.has !== void 0) {\n\t\t\t!!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk));\n\t\t\treturn txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+'';\n\t\t}\n\t\treturn txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';\n\t};\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ($);\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/kleur/index.mjs?");
|
|
8367
8367
|
|
|
8368
8368
|
/***/ }),
|
|
8369
8369
|
|
|
@@ -11978,7 +11978,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
11978
11978
|
\**********************************************************************/
|
|
11979
11979
|
/***/ ((module, exports, __webpack_require__) => {
|
|
11980
11980
|
|
|
11981
|
-
eval("/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = ({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-
|
|
11981
|
+
eval("/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = ({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-58\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true}).DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = __webpack_require__(/*! ./common */ \"../../node_modules/micromark/node_modules/debug/src/common.js\")(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/micromark/node_modules/debug/src/browser.js?");
|
|
11982
11982
|
|
|
11983
11983
|
/***/ }),
|
|
11984
11984
|
|
|
@@ -12959,7 +12959,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
12959
12959
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
12960
12960
|
|
|
12961
12961
|
"use strict";
|
|
12962
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ destroyObsidianUtils: () => (/* binding */ destroyObsidianUtils),\n/* harmony export */ getAreaLimit: () => (/* binding */ getAreaLimit),\n/* harmony export */ getDesktopUIMode: () => (/* binding */ getDesktopUIMode),\n/* harmony export */ getHostPlugin: () => (/* binding */ getHostPlugin),\n/* harmony export */ getObsidianDeviceInfo: () => (/* binding */ getObsidianDeviceInfo),\n/* harmony export */ getWidthHeightLimit: () => (/* binding */ getWidthHeightLimit),\n/* harmony export */ hostPlugin: () => (/* binding */ hostPlugin),\n/* harmony export */ initializeObsidianUtils: () => (/* binding */ initializeObsidianUtils)\n/* harmony export */ });\nlet ObsidianDevice = null; //zsviczian, my dirty little secrets. These are hacks I am not proud of...\n\nlet hostPlugin = null;\nfunction destroyObsidianUtils() {\n hostPlugin = null;\n}\nfunction initializeObsidianUtils() {\n //@ts-ignore\n hostPlugin = app.plugins.plugins[\"obsidian-excalidraw-plugin\"];\n}\nfunction getHostPlugin() {\n if (!hostPlugin) {\n initializeObsidianUtils();\n }\n\n return hostPlugin;\n}\nconst getObsidianDeviceInfo = () => {\n if (ObsidianDevice) {\n return ObsidianDevice;\n } //@ts-ignore\n\n\n const obsidianPlugin = app.plugins.plugins[\"obsidian-excalidraw-plugin\"];\n\n if (!obsidianPlugin) {\n return null;\n }\n\n return ObsidianDevice = Object.assign({}, obsidianPlugin.getObsidianDevice());\n};\nconst getDesktopUIMode = () => {\n //@ts-ignore\n const obsidianPlugin = app.plugins.plugins[\"obsidian-excalidraw-plugin\"];\n\n if (!obsidianPlugin) {\n return \"tray\";\n }\n\n const desktopUIMode = obsidianPlugin.settings.desktopUIMode;\n return [\"tray\", \"full\", \"compact\"].includes(desktopUIMode) ? desktopUIMode : \"tray\";\n};\nfunction getAreaLimit() {\n var _a;\n\n return (_a = getHostPlugin().excalidrawConfig.areaLimit) !== null && _a !== void 0 ? _a : 16777216;\n}\nfunction getWidthHeightLimit() {\n var _a;\n\n return (_a = getHostPlugin().excalidrawConfig.widthHeightLimit) !== null && _a !== void 0 ? _a : 32767;\n}\n\n//# sourceURL=webpack://ExcalidrawLib/../common/src/commonObsidianUtils.ts?");
|
|
12962
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ destroyObsidianUtils: () => (/* binding */ destroyObsidianUtils),\n/* harmony export */ getAreaLimit: () => (/* binding */ getAreaLimit),\n/* harmony export */ getDesktopUIMode: () => (/* binding */ getDesktopUIMode),\n/* harmony export */ getHighlightColor: () => (/* binding */ getHighlightColor),\n/* harmony export */ getHostPlugin: () => (/* binding */ getHostPlugin),\n/* harmony export */ getObsidianDeviceInfo: () => (/* binding */ getObsidianDeviceInfo),\n/* harmony export */ getWidthHeightLimit: () => (/* binding */ getWidthHeightLimit),\n/* harmony export */ hostPlugin: () => (/* binding */ hostPlugin),\n/* harmony export */ initializeObsidianUtils: () => (/* binding */ initializeObsidianUtils)\n/* harmony export */ });\nlet ObsidianDevice = null; //zsviczian, my dirty little secrets. These are hacks I am not proud of...\n\nlet hostPlugin = null;\nfunction destroyObsidianUtils() {\n hostPlugin = null;\n}\nfunction initializeObsidianUtils() {\n //@ts-ignore\n hostPlugin = app.plugins.plugins[\"obsidian-excalidraw-plugin\"];\n}\nfunction getHostPlugin() {\n if (!hostPlugin) {\n initializeObsidianUtils();\n }\n\n return hostPlugin;\n}\nconst getObsidianDeviceInfo = () => {\n if (ObsidianDevice) {\n return ObsidianDevice;\n } //@ts-ignore\n\n\n const obsidianPlugin = app.plugins.plugins[\"obsidian-excalidraw-plugin\"];\n\n if (!obsidianPlugin) {\n return null;\n }\n\n return ObsidianDevice = Object.assign({}, obsidianPlugin.getObsidianDevice());\n};\nconst getDesktopUIMode = () => {\n //@ts-ignore\n const obsidianPlugin = app.plugins.plugins[\"obsidian-excalidraw-plugin\"];\n\n if (!obsidianPlugin) {\n return \"tray\";\n }\n\n const desktopUIMode = obsidianPlugin.settings.desktopUIMode;\n return [\"tray\", \"full\", \"compact\"].includes(desktopUIMode) ? desktopUIMode : \"tray\";\n};\nfunction getAreaLimit() {\n var _a;\n\n return (_a = getHostPlugin().excalidrawConfig.areaLimit) !== null && _a !== void 0 ? _a : 16777216;\n}\nfunction getWidthHeightLimit() {\n var _a;\n\n return (_a = getHostPlugin().excalidrawConfig.widthHeightLimit) !== null && _a !== void 0 ? _a : 32767;\n}\nfunction getHighlightColor(color, sceneBgColor, opacity = 1) {\n var _a;\n\n return (_a = getHostPlugin().getHighlightColor(color, sceneBgColor, opacity)) !== null && _a !== void 0 ? _a : `rgba(0,118,255,${opacity})`;\n}\n\n//# sourceURL=webpack://ExcalidrawLib/../common/src/commonObsidianUtils.ts?");
|
|
12963
12963
|
|
|
12964
12964
|
/***/ }),
|
|
12965
12965
|
|
|
@@ -13014,7 +13014,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
13014
13014
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13015
13015
|
|
|
13016
13016
|
"use strict";
|
|
13017
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ACTIVE_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ACTIVE_THRESHOLD),\n/* harmony export */ ALLOWED_PASTE_MIME_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ALLOWED_PASTE_MIME_TYPES),\n/* harmony export */ APP_NAME: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.APP_NAME),\n/* harmony export */ ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO),\n/* harmony export */ ARROW_LABEL_WIDTH_FRACTION: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ARROW_LABEL_WIDTH_FRACTION),\n/* harmony export */ ARROW_TYPE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ARROW_TYPE),\n/* harmony export */ BIND_MODE_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT),\n/* harmony export */ BOUND_TEXT_PADDING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.BOUND_TEXT_PADDING),\n/* harmony export */ BinaryHeap: () => (/* reexport safe */ _binary_heap__WEBPACK_IMPORTED_MODULE_0__.BinaryHeap),\n/* harmony export */ CANVAS_ONLY_ACTIONS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CANVAS_ONLY_ACTIONS),\n/* harmony export */ CANVAS_PALETTE_SHADE_INDEXES: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.CANVAS_PALETTE_SHADE_INDEXES),\n/* harmony export */ CANVAS_SEARCH_TAB: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CANVAS_SEARCH_TAB),\n/* harmony export */ CJK_HAND_DRAWN_FALLBACK_FONT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CJK_HAND_DRAWN_FALLBACK_FONT),\n/* harmony export */ CLASSES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CLASSES),\n/* harmony export */ CODES: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.CODES),\n/* harmony export */ COLORS_PER_ROW: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.COLORS_PER_ROW),\n/* harmony export */ COLOR_CHARCOAL_BLACK: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.COLOR_CHARCOAL_BLACK),\n/* harmony export */ COLOR_NAMES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.COLOR_NAMES),\n/* harmony export */ COLOR_OUTLINE_CONTRAST_THRESHOLD: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.COLOR_OUTLINE_CONTRAST_THRESHOLD),\n/* harmony export */ COLOR_PALETTE: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.COLOR_PALETTE),\n/* harmony export */ COLOR_VOICE_CALL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.COLOR_VOICE_CALL),\n/* harmony export */ COLOR_WHITE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.COLOR_WHITE),\n/* harmony export */ CURSOR_TYPE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CURSOR_TYPE),\n/* harmony export */ DEFAULT_ADAPTIVE_RADIUS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_ADAPTIVE_RADIUS),\n/* harmony export */ DEFAULT_CANVAS_BACKGROUND_PICKS: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_CANVAS_BACKGROUND_PICKS),\n/* harmony export */ DEFAULT_CHART_COLOR_INDEX: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_CHART_COLOR_INDEX),\n/* harmony export */ DEFAULT_COLLISION_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_COLLISION_THRESHOLD),\n/* harmony export */ DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX),\n/* harmony export */ DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE),\n/* harmony export */ DEFAULT_ELEMENT_BACKGROUND_PICKS: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_BACKGROUND_PICKS),\n/* harmony export */ DEFAULT_ELEMENT_PROPS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_ELEMENT_PROPS),\n/* harmony export */ DEFAULT_ELEMENT_STROKE_COLOR_INDEX: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_STROKE_COLOR_INDEX),\n/* harmony export */ DEFAULT_ELEMENT_STROKE_COLOR_PALETTE: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_STROKE_COLOR_PALETTE),\n/* harmony export */ DEFAULT_ELEMENT_STROKE_PICKS: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_STROKE_PICKS),\n/* harmony export */ DEFAULT_EXPORT_PADDING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_EXPORT_PADDING),\n/* harmony export */ DEFAULT_FILENAME: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_FILENAME),\n/* harmony export */ DEFAULT_FONT_FAMILY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_FONT_FAMILY),\n/* harmony export */ DEFAULT_FONT_SIZE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_FONT_SIZE),\n/* harmony export */ DEFAULT_GRID_SIZE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_GRID_SIZE),\n/* harmony export */ DEFAULT_GRID_STEP: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_GRID_STEP),\n/* harmony export */ DEFAULT_LASER_COLOR: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_LASER_COLOR),\n/* harmony export */ DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT),\n/* harmony export */ DEFAULT_PROPORTIONAL_RADIUS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_PROPORTIONAL_RADIUS),\n/* harmony export */ DEFAULT_REDUCED_GLOBAL_ALPHA: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_REDUCED_GLOBAL_ALPHA),\n/* harmony export */ DEFAULT_SIDEBAR: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_SIDEBAR),\n/* harmony export */ DEFAULT_TEXT_ALIGN: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TEXT_ALIGN),\n/* harmony export */ DEFAULT_TRANSFORM_HANDLE_SPACING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TRANSFORM_HANDLE_SPACING),\n/* harmony export */ DEFAULT_UI_OPTIONS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_UI_OPTIONS),\n/* harmony export */ DEFAULT_VERSION: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_VERSION),\n/* harmony export */ DEFAULT_VERTICAL_ALIGN: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_VERTICAL_ALIGN),\n/* harmony export */ DOUBLE_TAP_POSITION_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DOUBLE_TAP_POSITION_THRESHOLD),\n/* harmony export */ DRAGGING_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DRAGGING_THRESHOLD),\n/* harmony export */ EDITOR_LS_KEYS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EDITOR_LS_KEYS),\n/* harmony export */ ELEMENTS_PALETTE_SHADE_INDEXES: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.ELEMENTS_PALETTE_SHADE_INDEXES),\n/* harmony export */ ELEMENT_LINK_KEY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ELEMENT_LINK_KEY),\n/* harmony export */ ELEMENT_READY_TO_ERASE_OPACITY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ELEMENT_READY_TO_ERASE_OPACITY),\n/* harmony export */ ELEMENT_SHIFT_TRANSLATE_AMOUNT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ELEMENT_SHIFT_TRANSLATE_AMOUNT),\n/* harmony export */ ELEMENT_TRANSLATE_AMOUNT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ELEMENT_TRANSLATE_AMOUNT),\n/* harmony export */ ENCRYPTION_KEY_BITS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ENCRYPTION_KEY_BITS),\n/* harmony export */ ENV: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ENV),\n/* harmony export */ EPSILON: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EPSILON),\n/* harmony export */ EVENT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EVENT),\n/* harmony export */ EXPORT_DATA_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EXPORT_DATA_TYPES),\n/* harmony export */ EXPORT_IMAGE_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EXPORT_IMAGE_TYPES),\n/* harmony export */ EXPORT_SCALES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EXPORT_SCALES),\n/* harmony export */ Emitter: () => (/* reexport safe */ _emitter__WEBPACK_IMPORTED_MODULE_11__.Emitter),\n/* harmony export */ FONT_FAMILY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.FONT_FAMILY),\n/* harmony export */ FONT_FAMILY_FALLBACKS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.FONT_FAMILY_FALLBACKS),\n/* harmony export */ FONT_FAMILY_GENERIC_FALLBACKS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.FONT_FAMILY_GENERIC_FALLBACKS),\n/* harmony export */ FONT_METADATA: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.FONT_METADATA),\n/* harmony export */ FRAME_STYLE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE),\n/* harmony export */ GOOGLE_FONTS_RANGES: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.GOOGLE_FONTS_RANGES),\n/* harmony export */ HYPERLINK_TOOLTIP_DELAY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.HYPERLINK_TOOLTIP_DELAY),\n/* harmony export */ IDLE_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.IDLE_THRESHOLD),\n/* harmony export */ IMAGE_MIME_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.IMAGE_MIME_TYPES),\n/* harmony export */ IMAGE_RENDER_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.IMAGE_RENDER_TIMEOUT),\n/* harmony export */ KEYS: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.KEYS),\n/* harmony export */ KeyCodeMap: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.KeyCodeMap),\n/* harmony export */ LIBRARY_DISABLED_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.LIBRARY_DISABLED_TYPES),\n/* harmony export */ LIBRARY_SIDEBAR_TAB: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.LIBRARY_SIDEBAR_TAB),\n/* harmony export */ LINE_CONFIRM_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.LINE_CONFIRM_THRESHOLD),\n/* harmony export */ LINE_POLYGON_POINT_MERGE_DISTANCE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.LINE_POLYGON_POINT_MERGE_DISTANCE),\n/* harmony export */ LOCAL_FONT_PROTOCOL: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.LOCAL_FONT_PROTOCOL),\n/* harmony export */ MAX_ALLOWED_FILE_BYTES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MAX_ALLOWED_FILE_BYTES),\n/* harmony export */ MAX_CUSTOM_COLORS_USED_IN_CANVAS: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.MAX_CUSTOM_COLORS_USED_IN_CANVAS),\n/* harmony export */ MAX_DECIMALS_FOR_SVG_EXPORT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MAX_DECIMALS_FOR_SVG_EXPORT),\n/* harmony export */ MAX_ZOOM: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MAX_ZOOM),\n/* harmony export */ MIME_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MIME_TYPES),\n/* harmony export */ MINIMUM_ARROW_SIZE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MINIMUM_ARROW_SIZE),\n/* harmony export */ MIN_FONT_SIZE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MIN_FONT_SIZE),\n/* harmony export */ MIN_WIDTH_OR_HEIGHT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MIN_WIDTH_OR_HEIGHT),\n/* harmony export */ MIN_ZOOM: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MIN_ZOOM),\n/* harmony export */ MOBILE_ACTION_BUTTON_BG: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MOBILE_ACTION_BUTTON_BG),\n/* harmony export */ MONOSPACE_GENERIC_FONT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MONOSPACE_GENERIC_FONT),\n/* harmony export */ MQ_MAX_HEIGHT_LANDSCAPE: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MAX_HEIGHT_LANDSCAPE),\n/* harmony export */ MQ_MAX_MOBILE: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MAX_MOBILE),\n/* harmony export */ MQ_MAX_TABLET: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MAX_TABLET),\n/* harmony export */ MQ_MAX_WIDTH_LANDSCAPE: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MAX_WIDTH_LANDSCAPE),\n/* harmony export */ MQ_MIN_TABLET: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MIN_TABLET),\n/* harmony export */ MQ_MIN_WIDTH_DESKTOP: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MIN_WIDTH_DESKTOP),\n/* harmony export */ MQ_RIGHT_SIDEBAR_MIN_WIDTH: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_RIGHT_SIDEBAR_MIN_WIDTH),\n/* harmony export */ ORIG_ID: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ORIG_ID),\n/* harmony export */ POINTER_BUTTON: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.POINTER_BUTTON),\n/* harmony export */ POINTER_EVENTS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.POINTER_EVENTS),\n/* harmony export */ PRECEDING_ELEMENT_KEY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.PRECEDING_ELEMENT_KEY),\n/* harmony export */ PromisePool: () => (/* reexport safe */ _promise_pool__WEBPACK_IMPORTED_MODULE_7__.PromisePool),\n/* harmony export */ Queue: () => (/* reexport safe */ _queue__WEBPACK_IMPORTED_MODULE_4__.Queue),\n/* harmony export */ ROUGHNESS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ROUGHNESS),\n/* harmony export */ ROUNDNESS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ROUNDNESS),\n/* harmony export */ SANS_SERIF_GENERIC_FONT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SANS_SERIF_GENERIC_FONT),\n/* harmony export */ SCROLL_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SCROLL_TIMEOUT),\n/* harmony export */ SHIFT_LOCKING_ANGLE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SHIFT_LOCKING_ANGLE),\n/* harmony export */ SIDE_RESIZING_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SIDE_RESIZING_THRESHOLD),\n/* harmony export */ STATS_PANELS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.STATS_PANELS),\n/* harmony export */ STRING_MIME_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.STRING_MIME_TYPES),\n/* harmony export */ STROKE_WIDTH: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.STROKE_WIDTH),\n/* harmony export */ SVG_DOCUMENT_PREAMBLE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SVG_DOCUMENT_PREAMBLE),\n/* harmony export */ SVG_NS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SVG_NS),\n/* harmony export */ TAP_TWICE_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TAP_TWICE_TIMEOUT),\n/* harmony export */ TEXT_ALIGN: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TEXT_ALIGN),\n/* harmony export */ TEXT_AUTOWRAP_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TEXT_AUTOWRAP_THRESHOLD),\n/* harmony export */ TEXT_TO_CENTER_SNAP_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TEXT_TO_CENTER_SNAP_THRESHOLD),\n/* harmony export */ THEME: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.THEME),\n/* harmony export */ THEME_FILTER: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.THEME_FILTER),\n/* harmony export */ TITLE_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TITLE_TIMEOUT),\n/* harmony export */ TOOL_TYPE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TOOL_TYPE),\n/* harmony export */ TOUCH_CTX_MENU_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TOUCH_CTX_MENU_TIMEOUT),\n/* harmony export */ URL_HASH_KEYS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.URL_HASH_KEYS),\n/* harmony export */ URL_QUERY_KEYS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.URL_QUERY_KEYS),\n/* harmony export */ UserIdleState: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.UserIdleState),\n/* harmony export */ VERSIONS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.VERSIONS),\n/* harmony export */ VERSION_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.VERSION_TIMEOUT),\n/* harmony export */ VERTICAL_ALIGN: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.VERTICAL_ALIGN),\n/* harmony export */ WINDOWS_EMOJI_FALLBACK_FONT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.WINDOWS_EMOJI_FALLBACK_FONT),\n/* harmony export */ YOUTUBE_STATES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.YOUTUBE_STATES),\n/* harmony export */ ZOOM_STEP: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ZOOM_STEP),\n/* harmony export */ addEventListener: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.addEventListener),\n/* harmony export */ allowFullScreen: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.allowFullScreen),\n/* harmony export */ arrayToList: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.arrayToList),\n/* harmony export */ arrayToMap: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.arrayToMap),\n/* harmony export */ arrayToMapWithIndex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.arrayToMapWithIndex),\n/* harmony export */ arrayToObject: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.arrayToObject),\n/* harmony export */ assertNever: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.assertNever),\n/* harmony export */ bytesToHexString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.bytesToHexString),\n/* harmony export */ capitalizeString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.capitalizeString),\n/* harmony export */ castArray: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.castArray),\n/* harmony export */ chunk: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.chunk),\n/* harmony export */ cloneJSON: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.cloneJSON),\n/* harmony export */ composeEventHandlers: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.composeEventHandlers),\n/* harmony export */ createUserAgentDescriptor: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.createUserAgentDescriptor),\n/* harmony export */ debounce: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.debounce),\n/* harmony export */ debugClear: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugClear),\n/* harmony export */ debugCloseFrame: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugCloseFrame),\n/* harmony export */ debugDrawBounds: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawBounds),\n/* harmony export */ debugDrawCubicBezier: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawCubicBezier),\n/* harmony export */ debugDrawLine: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawLine),\n/* harmony export */ debugDrawPoint: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawPoint),\n/* harmony export */ debugDrawPoints: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawPoints),\n/* harmony export */ deriveStylesPanelMode: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.deriveStylesPanelMode),\n/* harmony export */ destroyObsidianUtils: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.destroyObsidianUtils),\n/* harmony export */ distance: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.distance),\n/* harmony export */ easeOut: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.easeOut),\n/* harmony export */ easeToValuesRAF: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.easeToValuesRAF),\n/* harmony export */ escapeDoubleQuotes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.escapeDoubleQuotes),\n/* harmony export */ exitFullScreen: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.exitFullScreen),\n/* harmony export */ findIndex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.findIndex),\n/* harmony export */ findLastIndex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.findLastIndex),\n/* harmony export */ focusNearestParent: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.focusNearestParent),\n/* harmony export */ getAllColorsSpecificShade: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.getAllColorsSpecificShade),\n/* harmony export */ getAreaLimit: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getAreaLimit),\n/* harmony export */ getDateTime: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getDateTime),\n/* harmony export */ getDesktopUIMode: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getDesktopUIMode),\n/* harmony export */ getExportSource: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.getExportSource),\n/* harmony export */ getFeatureFlag: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getFeatureFlag),\n/* harmony export */ getFontFamilyFallbacks: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.getFontFamilyFallbacks),\n/* harmony export */ getFontFamilyString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getFontFamilyString),\n/* harmony export */ getFontString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getFontString),\n/* harmony export */ getFormFactor: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.getFormFactor),\n/* harmony export */ getFrame: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getFrame),\n/* harmony export */ getGenericFontFamilyFallback: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.getGenericFontFamilyFallback),\n/* harmony export */ getGlobalCSSVariable: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getGlobalCSSVariable),\n/* harmony export */ getGridPoint: () => (/* reexport safe */ _points__WEBPACK_IMPORTED_MODULE_6__.getGridPoint),\n/* harmony export */ getHostPlugin: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getHostPlugin),\n/* harmony export */ getLineHeight: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.getLineHeight),\n/* harmony export */ getNearestScrollableContainer: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getNearestScrollableContainer),\n/* harmony export */ getObsidianDeviceInfo: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getObsidianDeviceInfo),\n/* harmony export */ getSizeFromPoints: () => (/* reexport safe */ _points__WEBPACK_IMPORTED_MODULE_6__.getSizeFromPoints),\n/* harmony export */ getSpecificColorShades: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.getSpecificColorShades),\n/* harmony export */ getSvgPathFromStroke: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getSvgPathFromStroke),\n/* harmony export */ getUpdatedTimestamp: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getUpdatedTimestamp),\n/* harmony export */ getVersion: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getVersion),\n/* harmony export */ getVerticalOffset: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.getVerticalOffset),\n/* harmony export */ getWidthHeightLimit: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getWidthHeightLimit),\n/* harmony export */ hostPlugin: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.hostPlugin),\n/* harmony export */ initializeObsidianUtils: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.initializeObsidianUtils),\n/* harmony export */ invariant: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.invariant),\n/* harmony export */ isAndroid: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isAndroid),\n/* harmony export */ isAnyTrue: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isAnyTrue),\n/* harmony export */ isArrowKey: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.isArrowKey),\n/* harmony export */ isBrave: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isBrave),\n/* harmony export */ isChrome: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isChrome),\n/* harmony export */ isDarwin: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isDarwin),\n/* harmony export */ isDevEnv: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isDevEnv),\n/* harmony export */ isFirefox: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isFirefox),\n/* harmony export */ isFullScreen: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isFullScreen),\n/* harmony export */ isIOS: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isIOS),\n/* harmony export */ isInputLike: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isInputLike),\n/* harmony export */ isInteractive: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isInteractive),\n/* harmony export */ isLatinChar: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.isLatinChar),\n/* harmony export */ isLocalLink: () => (/* reexport safe */ _url__WEBPACK_IMPORTED_MODULE_9__.isLocalLink),\n/* harmony export */ isMemberOf: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isMemberOf),\n/* harmony export */ isMobileBreakpoint: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isMobileBreakpoint),\n/* harmony export */ isPrimitive: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isPrimitive),\n/* harmony export */ isProdEnv: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isProdEnv),\n/* harmony export */ isPromiseLike: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isPromiseLike),\n/* harmony export */ isRTL: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isRTL),\n/* harmony export */ isReadonlyArray: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isReadonlyArray),\n/* harmony export */ isRunningInIframe: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isRunningInIframe),\n/* harmony export */ isSafari: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isSafari),\n/* harmony export */ isSelectionLikeTool: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isSelectionLikeTool),\n/* harmony export */ isServerEnv: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isServerEnv),\n/* harmony export */ isShallowEqual: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isShallowEqual),\n/* harmony export */ isTabletBreakpoint: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isTabletBreakpoint),\n/* harmony export */ isTestEnv: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isTestEnv),\n/* harmony export */ isToolIcon: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isToolIcon),\n/* harmony export */ isTransparent: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isTransparent),\n/* harmony export */ isWindows: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isWindows),\n/* harmony export */ isWritableElement: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isWritableElement),\n/* harmony export */ loadDesktopUIModePreference: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.loadDesktopUIModePreference),\n/* harmony export */ mapFind: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.mapFind),\n/* harmony export */ matchKey: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.matchKey),\n/* harmony export */ memoize: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.memoize),\n/* harmony export */ muteFSAbortError: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.muteFSAbortError),\n/* harmony export */ nFormatter: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.nFormatter),\n/* harmony export */ nextAnimationFrame: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.nextAnimationFrame),\n/* harmony export */ normalizeEOL: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.normalizeEOL),\n/* harmony export */ normalizeLink: () => (/* reexport safe */ _url__WEBPACK_IMPORTED_MODULE_9__.normalizeLink),\n/* harmony export */ obsidianId: () => (/* reexport safe */ _random__WEBPACK_IMPORTED_MODULE_8__.obsidianId),\n/* harmony export */ preventUnload: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.preventUnload),\n/* harmony export */ promiseTry: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.promiseTry),\n/* harmony export */ queryFocusableElements: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.queryFocusableElements),\n/* harmony export */ randomId: () => (/* reexport safe */ _random__WEBPACK_IMPORTED_MODULE_8__.randomId),\n/* harmony export */ randomInteger: () => (/* reexport safe */ _random__WEBPACK_IMPORTED_MODULE_8__.randomInteger),\n/* harmony export */ reduceToCommonValue: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.reduceToCommonValue),\n/* harmony export */ removeSelection: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.removeSelection),\n/* harmony export */ rescalePoints: () => (/* reexport safe */ _points__WEBPACK_IMPORTED_MODULE_6__.rescalePoints),\n/* harmony export */ reseed: () => (/* reexport safe */ _random__WEBPACK_IMPORTED_MODULE_8__.reseed),\n/* harmony export */ resolvablePromise: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.resolvablePromise),\n/* harmony export */ rgbToHex: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.rgbToHex),\n/* harmony export */ safelyParseJSON: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.safelyParseJSON),\n/* harmony export */ sceneCoordsToViewportCoords: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.sceneCoordsToViewportCoords),\n/* harmony export */ selectNode: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.selectNode),\n/* harmony export */ setDateTimeForTests: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.setDateTimeForTests),\n/* harmony export */ setDesktopUIMode: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.setDesktopUIMode),\n/* harmony export */ setFeatureFlag: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.setFeatureFlag),\n/* harmony export */ shouldMaintainAspectRatio: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.shouldMaintainAspectRatio),\n/* harmony export */ shouldResizeFromCenter: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.shouldResizeFromCenter),\n/* harmony export */ shouldRotateWithDiscreteAngle: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.shouldRotateWithDiscreteAngle),\n/* harmony export */ sizeOf: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.sizeOf),\n/* harmony export */ supportsEmoji: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.supportsEmoji),\n/* harmony export */ supportsResizeObserver: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.supportsResizeObserver),\n/* harmony export */ throttleRAF: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.throttleRAF),\n/* harmony export */ toArray: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.toArray),\n/* harmony export */ toBrandedType: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.toBrandedType),\n/* harmony export */ toIterable: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.toIterable),\n/* harmony export */ toValidURL: () => (/* reexport safe */ _url__WEBPACK_IMPORTED_MODULE_9__.toValidURL),\n/* harmony export */ tupleToCoors: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.tupleToCoors),\n/* harmony export */ updateActiveTool: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.updateActiveTool),\n/* harmony export */ updateObject: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.updateObject),\n/* harmony export */ updateStable: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.updateStable),\n/* harmony export */ viewportCoordsToSceneCoords: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.viewportCoordsToSceneCoords),\n/* harmony export */ wrapEvent: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.wrapEvent)\n/* harmony export */ });\n/* harmony import */ var _binary_heap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./binary-heap */ \"../common/src/binary-heap.ts\");\n/* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colors */ \"../common/src/colors.ts\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ \"../common/src/constants.ts\");\n/* harmony import */ var _font_metadata__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./font-metadata */ \"../common/src/font-metadata.ts\");\n/* harmony import */ var _queue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./queue */ \"../common/src/queue.ts\");\n/* harmony import */ var _keys__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./keys */ \"../common/src/keys.ts\");\n/* harmony import */ var _points__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./points */ \"../common/src/points.ts\");\n/* harmony import */ var _promise_pool__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./promise-pool */ \"../common/src/promise-pool.ts\");\n/* harmony import */ var _random__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./random */ \"../common/src/random.ts\");\n/* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./url */ \"../common/src/url.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils */ \"../common/src/utils.ts\");\n/* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./emitter */ \"../common/src/emitter.ts\");\n/* harmony import */ var _visualdebug__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./visualdebug */ \"../common/src/visualdebug.ts\");\n/* harmony import */ var _editorInterface__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./editorInterface */ \"../common/src/editorInterface.ts\");\n/* harmony import */ var _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commonObsidianUtils */ \"../common/src/commonObsidianUtils.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://ExcalidrawLib/../common/src/index.ts?");
|
|
13017
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ACTIVE_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ACTIVE_THRESHOLD),\n/* harmony export */ ALLOWED_PASTE_MIME_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ALLOWED_PASTE_MIME_TYPES),\n/* harmony export */ APP_NAME: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.APP_NAME),\n/* harmony export */ ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO),\n/* harmony export */ ARROW_LABEL_WIDTH_FRACTION: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ARROW_LABEL_WIDTH_FRACTION),\n/* harmony export */ ARROW_TYPE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ARROW_TYPE),\n/* harmony export */ BIND_MODE_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT),\n/* harmony export */ BOUND_TEXT_PADDING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.BOUND_TEXT_PADDING),\n/* harmony export */ BinaryHeap: () => (/* reexport safe */ _binary_heap__WEBPACK_IMPORTED_MODULE_0__.BinaryHeap),\n/* harmony export */ CANVAS_ONLY_ACTIONS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CANVAS_ONLY_ACTIONS),\n/* harmony export */ CANVAS_PALETTE_SHADE_INDEXES: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.CANVAS_PALETTE_SHADE_INDEXES),\n/* harmony export */ CANVAS_SEARCH_TAB: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CANVAS_SEARCH_TAB),\n/* harmony export */ CJK_HAND_DRAWN_FALLBACK_FONT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CJK_HAND_DRAWN_FALLBACK_FONT),\n/* harmony export */ CLASSES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CLASSES),\n/* harmony export */ CODES: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.CODES),\n/* harmony export */ COLORS_PER_ROW: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.COLORS_PER_ROW),\n/* harmony export */ COLOR_CHARCOAL_BLACK: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.COLOR_CHARCOAL_BLACK),\n/* harmony export */ COLOR_NAMES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.COLOR_NAMES),\n/* harmony export */ COLOR_OUTLINE_CONTRAST_THRESHOLD: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.COLOR_OUTLINE_CONTRAST_THRESHOLD),\n/* harmony export */ COLOR_PALETTE: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.COLOR_PALETTE),\n/* harmony export */ COLOR_VOICE_CALL: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.COLOR_VOICE_CALL),\n/* harmony export */ COLOR_WHITE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.COLOR_WHITE),\n/* harmony export */ CURSOR_TYPE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.CURSOR_TYPE),\n/* harmony export */ DEFAULT_ADAPTIVE_RADIUS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_ADAPTIVE_RADIUS),\n/* harmony export */ DEFAULT_CANVAS_BACKGROUND_PICKS: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_CANVAS_BACKGROUND_PICKS),\n/* harmony export */ DEFAULT_CHART_COLOR_INDEX: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_CHART_COLOR_INDEX),\n/* harmony export */ DEFAULT_COLLISION_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_COLLISION_THRESHOLD),\n/* harmony export */ DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX),\n/* harmony export */ DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE),\n/* harmony export */ DEFAULT_ELEMENT_BACKGROUND_PICKS: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_BACKGROUND_PICKS),\n/* harmony export */ DEFAULT_ELEMENT_PROPS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_ELEMENT_PROPS),\n/* harmony export */ DEFAULT_ELEMENT_STROKE_COLOR_INDEX: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_STROKE_COLOR_INDEX),\n/* harmony export */ DEFAULT_ELEMENT_STROKE_COLOR_PALETTE: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_STROKE_COLOR_PALETTE),\n/* harmony export */ DEFAULT_ELEMENT_STROKE_PICKS: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_STROKE_PICKS),\n/* harmony export */ DEFAULT_EXPORT_PADDING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_EXPORT_PADDING),\n/* harmony export */ DEFAULT_FILENAME: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_FILENAME),\n/* harmony export */ DEFAULT_FONT_FAMILY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_FONT_FAMILY),\n/* harmony export */ DEFAULT_FONT_SIZE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_FONT_SIZE),\n/* harmony export */ DEFAULT_GRID_SIZE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_GRID_SIZE),\n/* harmony export */ DEFAULT_GRID_STEP: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_GRID_STEP),\n/* harmony export */ DEFAULT_LASER_COLOR: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_LASER_COLOR),\n/* harmony export */ DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT),\n/* harmony export */ DEFAULT_PROPORTIONAL_RADIUS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_PROPORTIONAL_RADIUS),\n/* harmony export */ DEFAULT_REDUCED_GLOBAL_ALPHA: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_REDUCED_GLOBAL_ALPHA),\n/* harmony export */ DEFAULT_SIDEBAR: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_SIDEBAR),\n/* harmony export */ DEFAULT_TEXT_ALIGN: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TEXT_ALIGN),\n/* harmony export */ DEFAULT_TRANSFORM_HANDLE_SPACING: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TRANSFORM_HANDLE_SPACING),\n/* harmony export */ DEFAULT_UI_OPTIONS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_UI_OPTIONS),\n/* harmony export */ DEFAULT_VERSION: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_VERSION),\n/* harmony export */ DEFAULT_VERTICAL_ALIGN: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_VERTICAL_ALIGN),\n/* harmony export */ DOUBLE_TAP_POSITION_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DOUBLE_TAP_POSITION_THRESHOLD),\n/* harmony export */ DRAGGING_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.DRAGGING_THRESHOLD),\n/* harmony export */ EDITOR_LS_KEYS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EDITOR_LS_KEYS),\n/* harmony export */ ELEMENTS_PALETTE_SHADE_INDEXES: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.ELEMENTS_PALETTE_SHADE_INDEXES),\n/* harmony export */ ELEMENT_LINK_KEY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ELEMENT_LINK_KEY),\n/* harmony export */ ELEMENT_READY_TO_ERASE_OPACITY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ELEMENT_READY_TO_ERASE_OPACITY),\n/* harmony export */ ELEMENT_SHIFT_TRANSLATE_AMOUNT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ELEMENT_SHIFT_TRANSLATE_AMOUNT),\n/* harmony export */ ELEMENT_TRANSLATE_AMOUNT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ELEMENT_TRANSLATE_AMOUNT),\n/* harmony export */ ENCRYPTION_KEY_BITS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ENCRYPTION_KEY_BITS),\n/* harmony export */ ENV: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ENV),\n/* harmony export */ EPSILON: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EPSILON),\n/* harmony export */ EVENT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EVENT),\n/* harmony export */ EXPORT_DATA_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EXPORT_DATA_TYPES),\n/* harmony export */ EXPORT_IMAGE_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EXPORT_IMAGE_TYPES),\n/* harmony export */ EXPORT_SCALES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.EXPORT_SCALES),\n/* harmony export */ Emitter: () => (/* reexport safe */ _emitter__WEBPACK_IMPORTED_MODULE_11__.Emitter),\n/* harmony export */ FONT_FAMILY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.FONT_FAMILY),\n/* harmony export */ FONT_FAMILY_FALLBACKS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.FONT_FAMILY_FALLBACKS),\n/* harmony export */ FONT_FAMILY_GENERIC_FALLBACKS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.FONT_FAMILY_GENERIC_FALLBACKS),\n/* harmony export */ FONT_METADATA: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.FONT_METADATA),\n/* harmony export */ FRAME_STYLE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE),\n/* harmony export */ GOOGLE_FONTS_RANGES: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.GOOGLE_FONTS_RANGES),\n/* harmony export */ HYPERLINK_TOOLTIP_DELAY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.HYPERLINK_TOOLTIP_DELAY),\n/* harmony export */ IDLE_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.IDLE_THRESHOLD),\n/* harmony export */ IMAGE_MIME_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.IMAGE_MIME_TYPES),\n/* harmony export */ IMAGE_RENDER_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.IMAGE_RENDER_TIMEOUT),\n/* harmony export */ KEYS: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.KEYS),\n/* harmony export */ KeyCodeMap: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.KeyCodeMap),\n/* harmony export */ LIBRARY_DISABLED_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.LIBRARY_DISABLED_TYPES),\n/* harmony export */ LIBRARY_SIDEBAR_TAB: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.LIBRARY_SIDEBAR_TAB),\n/* harmony export */ LINE_CONFIRM_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.LINE_CONFIRM_THRESHOLD),\n/* harmony export */ LINE_POLYGON_POINT_MERGE_DISTANCE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.LINE_POLYGON_POINT_MERGE_DISTANCE),\n/* harmony export */ LOCAL_FONT_PROTOCOL: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.LOCAL_FONT_PROTOCOL),\n/* harmony export */ MAX_ALLOWED_FILE_BYTES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MAX_ALLOWED_FILE_BYTES),\n/* harmony export */ MAX_CUSTOM_COLORS_USED_IN_CANVAS: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.MAX_CUSTOM_COLORS_USED_IN_CANVAS),\n/* harmony export */ MAX_DECIMALS_FOR_SVG_EXPORT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MAX_DECIMALS_FOR_SVG_EXPORT),\n/* harmony export */ MAX_ZOOM: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MAX_ZOOM),\n/* harmony export */ MIME_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MIME_TYPES),\n/* harmony export */ MINIMUM_ARROW_SIZE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MINIMUM_ARROW_SIZE),\n/* harmony export */ MIN_FONT_SIZE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MIN_FONT_SIZE),\n/* harmony export */ MIN_WIDTH_OR_HEIGHT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MIN_WIDTH_OR_HEIGHT),\n/* harmony export */ MIN_ZOOM: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MIN_ZOOM),\n/* harmony export */ MOBILE_ACTION_BUTTON_BG: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MOBILE_ACTION_BUTTON_BG),\n/* harmony export */ MONOSPACE_GENERIC_FONT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.MONOSPACE_GENERIC_FONT),\n/* harmony export */ MQ_MAX_HEIGHT_LANDSCAPE: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MAX_HEIGHT_LANDSCAPE),\n/* harmony export */ MQ_MAX_MOBILE: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MAX_MOBILE),\n/* harmony export */ MQ_MAX_TABLET: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MAX_TABLET),\n/* harmony export */ MQ_MAX_WIDTH_LANDSCAPE: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MAX_WIDTH_LANDSCAPE),\n/* harmony export */ MQ_MIN_TABLET: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MIN_TABLET),\n/* harmony export */ MQ_MIN_WIDTH_DESKTOP: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_MIN_WIDTH_DESKTOP),\n/* harmony export */ MQ_RIGHT_SIDEBAR_MIN_WIDTH: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.MQ_RIGHT_SIDEBAR_MIN_WIDTH),\n/* harmony export */ ORIG_ID: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ORIG_ID),\n/* harmony export */ POINTER_BUTTON: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.POINTER_BUTTON),\n/* harmony export */ POINTER_EVENTS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.POINTER_EVENTS),\n/* harmony export */ PRECEDING_ELEMENT_KEY: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.PRECEDING_ELEMENT_KEY),\n/* harmony export */ PromisePool: () => (/* reexport safe */ _promise_pool__WEBPACK_IMPORTED_MODULE_7__.PromisePool),\n/* harmony export */ Queue: () => (/* reexport safe */ _queue__WEBPACK_IMPORTED_MODULE_4__.Queue),\n/* harmony export */ ROUGHNESS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ROUGHNESS),\n/* harmony export */ ROUNDNESS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ROUNDNESS),\n/* harmony export */ SANS_SERIF_GENERIC_FONT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SANS_SERIF_GENERIC_FONT),\n/* harmony export */ SCROLL_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SCROLL_TIMEOUT),\n/* harmony export */ SHIFT_LOCKING_ANGLE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SHIFT_LOCKING_ANGLE),\n/* harmony export */ SIDE_RESIZING_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SIDE_RESIZING_THRESHOLD),\n/* harmony export */ STATS_PANELS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.STATS_PANELS),\n/* harmony export */ STRING_MIME_TYPES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.STRING_MIME_TYPES),\n/* harmony export */ STROKE_WIDTH: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.STROKE_WIDTH),\n/* harmony export */ SVG_DOCUMENT_PREAMBLE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SVG_DOCUMENT_PREAMBLE),\n/* harmony export */ SVG_NS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.SVG_NS),\n/* harmony export */ TAP_TWICE_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TAP_TWICE_TIMEOUT),\n/* harmony export */ TEXT_ALIGN: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TEXT_ALIGN),\n/* harmony export */ TEXT_AUTOWRAP_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TEXT_AUTOWRAP_THRESHOLD),\n/* harmony export */ TEXT_TO_CENTER_SNAP_THRESHOLD: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TEXT_TO_CENTER_SNAP_THRESHOLD),\n/* harmony export */ THEME: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.THEME),\n/* harmony export */ THEME_FILTER: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.THEME_FILTER),\n/* harmony export */ TITLE_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TITLE_TIMEOUT),\n/* harmony export */ TOOL_TYPE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TOOL_TYPE),\n/* harmony export */ TOUCH_CTX_MENU_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.TOUCH_CTX_MENU_TIMEOUT),\n/* harmony export */ URL_HASH_KEYS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.URL_HASH_KEYS),\n/* harmony export */ URL_QUERY_KEYS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.URL_QUERY_KEYS),\n/* harmony export */ UserIdleState: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.UserIdleState),\n/* harmony export */ VERSIONS: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.VERSIONS),\n/* harmony export */ VERSION_TIMEOUT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.VERSION_TIMEOUT),\n/* harmony export */ VERTICAL_ALIGN: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.VERTICAL_ALIGN),\n/* harmony export */ WINDOWS_EMOJI_FALLBACK_FONT: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.WINDOWS_EMOJI_FALLBACK_FONT),\n/* harmony export */ YOUTUBE_STATES: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.YOUTUBE_STATES),\n/* harmony export */ ZOOM_STEP: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.ZOOM_STEP),\n/* harmony export */ addEventListener: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.addEventListener),\n/* harmony export */ allowFullScreen: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.allowFullScreen),\n/* harmony export */ arrayToList: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.arrayToList),\n/* harmony export */ arrayToMap: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.arrayToMap),\n/* harmony export */ arrayToMapWithIndex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.arrayToMapWithIndex),\n/* harmony export */ arrayToObject: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.arrayToObject),\n/* harmony export */ assertNever: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.assertNever),\n/* harmony export */ bytesToHexString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.bytesToHexString),\n/* harmony export */ capitalizeString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.capitalizeString),\n/* harmony export */ castArray: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.castArray),\n/* harmony export */ chunk: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.chunk),\n/* harmony export */ cloneJSON: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.cloneJSON),\n/* harmony export */ composeEventHandlers: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.composeEventHandlers),\n/* harmony export */ createUserAgentDescriptor: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.createUserAgentDescriptor),\n/* harmony export */ debounce: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.debounce),\n/* harmony export */ debugClear: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugClear),\n/* harmony export */ debugCloseFrame: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugCloseFrame),\n/* harmony export */ debugDrawBounds: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawBounds),\n/* harmony export */ debugDrawCubicBezier: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawCubicBezier),\n/* harmony export */ debugDrawLine: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawLine),\n/* harmony export */ debugDrawPoint: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawPoint),\n/* harmony export */ debugDrawPoints: () => (/* reexport safe */ _visualdebug__WEBPACK_IMPORTED_MODULE_12__.debugDrawPoints),\n/* harmony export */ deriveStylesPanelMode: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.deriveStylesPanelMode),\n/* harmony export */ destroyObsidianUtils: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.destroyObsidianUtils),\n/* harmony export */ distance: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.distance),\n/* harmony export */ easeOut: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.easeOut),\n/* harmony export */ easeToValuesRAF: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.easeToValuesRAF),\n/* harmony export */ escapeDoubleQuotes: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.escapeDoubleQuotes),\n/* harmony export */ exitFullScreen: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.exitFullScreen),\n/* harmony export */ findIndex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.findIndex),\n/* harmony export */ findLastIndex: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.findLastIndex),\n/* harmony export */ focusNearestParent: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.focusNearestParent),\n/* harmony export */ getAllColorsSpecificShade: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.getAllColorsSpecificShade),\n/* harmony export */ getAreaLimit: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getAreaLimit),\n/* harmony export */ getDateTime: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getDateTime),\n/* harmony export */ getDesktopUIMode: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getDesktopUIMode),\n/* harmony export */ getExportSource: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.getExportSource),\n/* harmony export */ getFeatureFlag: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getFeatureFlag),\n/* harmony export */ getFontFamilyFallbacks: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.getFontFamilyFallbacks),\n/* harmony export */ getFontFamilyString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getFontFamilyString),\n/* harmony export */ getFontString: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getFontString),\n/* harmony export */ getFormFactor: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.getFormFactor),\n/* harmony export */ getFrame: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getFrame),\n/* harmony export */ getGenericFontFamilyFallback: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.getGenericFontFamilyFallback),\n/* harmony export */ getGlobalCSSVariable: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getGlobalCSSVariable),\n/* harmony export */ getGridPoint: () => (/* reexport safe */ _points__WEBPACK_IMPORTED_MODULE_6__.getGridPoint),\n/* harmony export */ getHighlightColor: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getHighlightColor),\n/* harmony export */ getHostPlugin: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getHostPlugin),\n/* harmony export */ getLineHeight: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.getLineHeight),\n/* harmony export */ getNearestScrollableContainer: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getNearestScrollableContainer),\n/* harmony export */ getObsidianDeviceInfo: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getObsidianDeviceInfo),\n/* harmony export */ getSizeFromPoints: () => (/* reexport safe */ _points__WEBPACK_IMPORTED_MODULE_6__.getSizeFromPoints),\n/* harmony export */ getSpecificColorShades: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.getSpecificColorShades),\n/* harmony export */ getSvgPathFromStroke: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getSvgPathFromStroke),\n/* harmony export */ getUpdatedTimestamp: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getUpdatedTimestamp),\n/* harmony export */ getVersion: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.getVersion),\n/* harmony export */ getVerticalOffset: () => (/* reexport safe */ _font_metadata__WEBPACK_IMPORTED_MODULE_3__.getVerticalOffset),\n/* harmony export */ getWidthHeightLimit: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.getWidthHeightLimit),\n/* harmony export */ hostPlugin: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.hostPlugin),\n/* harmony export */ initializeObsidianUtils: () => (/* reexport safe */ _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__.initializeObsidianUtils),\n/* harmony export */ invariant: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.invariant),\n/* harmony export */ isAndroid: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isAndroid),\n/* harmony export */ isAnyTrue: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isAnyTrue),\n/* harmony export */ isArrowKey: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.isArrowKey),\n/* harmony export */ isBrave: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isBrave),\n/* harmony export */ isChrome: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isChrome),\n/* harmony export */ isDarwin: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isDarwin),\n/* harmony export */ isDevEnv: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isDevEnv),\n/* harmony export */ isFirefox: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isFirefox),\n/* harmony export */ isFullScreen: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isFullScreen),\n/* harmony export */ isIOS: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isIOS),\n/* harmony export */ isInputLike: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isInputLike),\n/* harmony export */ isInteractive: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isInteractive),\n/* harmony export */ isLatinChar: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.isLatinChar),\n/* harmony export */ isLocalLink: () => (/* reexport safe */ _url__WEBPACK_IMPORTED_MODULE_9__.isLocalLink),\n/* harmony export */ isMemberOf: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isMemberOf),\n/* harmony export */ isMobileBreakpoint: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isMobileBreakpoint),\n/* harmony export */ isPrimitive: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isPrimitive),\n/* harmony export */ isProdEnv: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isProdEnv),\n/* harmony export */ isPromiseLike: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isPromiseLike),\n/* harmony export */ isRTL: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isRTL),\n/* harmony export */ isReadonlyArray: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isReadonlyArray),\n/* harmony export */ isRunningInIframe: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isRunningInIframe),\n/* harmony export */ isSafari: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isSafari),\n/* harmony export */ isSelectionLikeTool: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isSelectionLikeTool),\n/* harmony export */ isServerEnv: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isServerEnv),\n/* harmony export */ isShallowEqual: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isShallowEqual),\n/* harmony export */ isTabletBreakpoint: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isTabletBreakpoint),\n/* harmony export */ isTestEnv: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isTestEnv),\n/* harmony export */ isToolIcon: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isToolIcon),\n/* harmony export */ isTransparent: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isTransparent),\n/* harmony export */ isWindows: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.isWindows),\n/* harmony export */ isWritableElement: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.isWritableElement),\n/* harmony export */ loadDesktopUIModePreference: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.loadDesktopUIModePreference),\n/* harmony export */ mapFind: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.mapFind),\n/* harmony export */ matchKey: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.matchKey),\n/* harmony export */ memoize: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.memoize),\n/* harmony export */ muteFSAbortError: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.muteFSAbortError),\n/* harmony export */ nFormatter: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.nFormatter),\n/* harmony export */ nextAnimationFrame: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.nextAnimationFrame),\n/* harmony export */ normalizeEOL: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.normalizeEOL),\n/* harmony export */ normalizeLink: () => (/* reexport safe */ _url__WEBPACK_IMPORTED_MODULE_9__.normalizeLink),\n/* harmony export */ obsidianId: () => (/* reexport safe */ _random__WEBPACK_IMPORTED_MODULE_8__.obsidianId),\n/* harmony export */ preventUnload: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.preventUnload),\n/* harmony export */ promiseTry: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.promiseTry),\n/* harmony export */ queryFocusableElements: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.queryFocusableElements),\n/* harmony export */ randomId: () => (/* reexport safe */ _random__WEBPACK_IMPORTED_MODULE_8__.randomId),\n/* harmony export */ randomInteger: () => (/* reexport safe */ _random__WEBPACK_IMPORTED_MODULE_8__.randomInteger),\n/* harmony export */ reduceToCommonValue: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.reduceToCommonValue),\n/* harmony export */ removeSelection: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.removeSelection),\n/* harmony export */ rescalePoints: () => (/* reexport safe */ _points__WEBPACK_IMPORTED_MODULE_6__.rescalePoints),\n/* harmony export */ reseed: () => (/* reexport safe */ _random__WEBPACK_IMPORTED_MODULE_8__.reseed),\n/* harmony export */ resolvablePromise: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.resolvablePromise),\n/* harmony export */ rgbToHex: () => (/* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.rgbToHex),\n/* harmony export */ safelyParseJSON: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.safelyParseJSON),\n/* harmony export */ sceneCoordsToViewportCoords: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.sceneCoordsToViewportCoords),\n/* harmony export */ selectNode: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.selectNode),\n/* harmony export */ setDateTimeForTests: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.setDateTimeForTests),\n/* harmony export */ setDesktopUIMode: () => (/* reexport safe */ _editorInterface__WEBPACK_IMPORTED_MODULE_13__.setDesktopUIMode),\n/* harmony export */ setFeatureFlag: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.setFeatureFlag),\n/* harmony export */ shouldMaintainAspectRatio: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.shouldMaintainAspectRatio),\n/* harmony export */ shouldResizeFromCenter: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.shouldResizeFromCenter),\n/* harmony export */ shouldRotateWithDiscreteAngle: () => (/* reexport safe */ _keys__WEBPACK_IMPORTED_MODULE_5__.shouldRotateWithDiscreteAngle),\n/* harmony export */ sizeOf: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.sizeOf),\n/* harmony export */ supportsEmoji: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.supportsEmoji),\n/* harmony export */ supportsResizeObserver: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_2__.supportsResizeObserver),\n/* harmony export */ throttleRAF: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.throttleRAF),\n/* harmony export */ toArray: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.toArray),\n/* harmony export */ toBrandedType: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.toBrandedType),\n/* harmony export */ toIterable: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.toIterable),\n/* harmony export */ toValidURL: () => (/* reexport safe */ _url__WEBPACK_IMPORTED_MODULE_9__.toValidURL),\n/* harmony export */ tupleToCoors: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.tupleToCoors),\n/* harmony export */ updateActiveTool: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.updateActiveTool),\n/* harmony export */ updateObject: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.updateObject),\n/* harmony export */ updateStable: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.updateStable),\n/* harmony export */ viewportCoordsToSceneCoords: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.viewportCoordsToSceneCoords),\n/* harmony export */ wrapEvent: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.wrapEvent)\n/* harmony export */ });\n/* harmony import */ var _binary_heap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./binary-heap */ \"../common/src/binary-heap.ts\");\n/* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colors */ \"../common/src/colors.ts\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ \"../common/src/constants.ts\");\n/* harmony import */ var _font_metadata__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./font-metadata */ \"../common/src/font-metadata.ts\");\n/* harmony import */ var _queue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./queue */ \"../common/src/queue.ts\");\n/* harmony import */ var _keys__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./keys */ \"../common/src/keys.ts\");\n/* harmony import */ var _points__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./points */ \"../common/src/points.ts\");\n/* harmony import */ var _promise_pool__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./promise-pool */ \"../common/src/promise-pool.ts\");\n/* harmony import */ var _random__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./random */ \"../common/src/random.ts\");\n/* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./url */ \"../common/src/url.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils */ \"../common/src/utils.ts\");\n/* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./emitter */ \"../common/src/emitter.ts\");\n/* harmony import */ var _visualdebug__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./visualdebug */ \"../common/src/visualdebug.ts\");\n/* harmony import */ var _editorInterface__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./editorInterface */ \"../common/src/editorInterface.ts\");\n/* harmony import */ var _commonObsidianUtils__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commonObsidianUtils */ \"../common/src/commonObsidianUtils.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://ExcalidrawLib/../common/src/index.ts?");
|
|
13018
13018
|
|
|
13019
13019
|
/***/ }),
|
|
13020
13020
|
|
|
@@ -13091,7 +13091,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
13091
13091
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13092
13092
|
|
|
13093
13093
|
"use strict";
|
|
13094
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */ allowFullScreen: () => (/* binding */ allowFullScreen),\n/* harmony export */ arrayToList: () => (/* binding */ arrayToList),\n/* harmony export */ arrayToMap: () => (/* binding */ arrayToMap),\n/* harmony export */ arrayToMapWithIndex: () => (/* binding */ arrayToMapWithIndex),\n/* harmony export */ arrayToObject: () => (/* binding */ arrayToObject),\n/* harmony export */ assertNever: () => (/* binding */ assertNever),\n/* harmony export */ bytesToHexString: () => (/* binding */ bytesToHexString),\n/* harmony export */ capitalizeString: () => (/* binding */ capitalizeString),\n/* harmony export */ castArray: () => (/* binding */ castArray),\n/* harmony export */ chunk: () => (/* binding */ chunk),\n/* harmony export */ cloneJSON: () => (/* binding */ cloneJSON),\n/* harmony export */ composeEventHandlers: () => (/* binding */ composeEventHandlers),\n/* harmony export */ debounce: () => (/* binding */ debounce),\n/* harmony export */ distance: () => (/* binding */ distance),\n/* harmony export */ easeOut: () => (/* binding */ easeOut),\n/* harmony export */ easeToValuesRAF: () => (/* binding */ easeToValuesRAF),\n/* harmony export */ escapeDoubleQuotes: () => (/* binding */ escapeDoubleQuotes),\n/* harmony export */ exitFullScreen: () => (/* binding */ exitFullScreen),\n/* harmony export */ findIndex: () => (/* binding */ findIndex),\n/* harmony export */ findLastIndex: () => (/* binding */ findLastIndex),\n/* harmony export */ focusNearestParent: () => (/* binding */ focusNearestParent),\n/* harmony export */ getDateTime: () => (/* binding */ getDateTime),\n/* harmony export */ getFeatureFlag: () => (/* binding */ getFeatureFlag),\n/* harmony export */ getFontFamilyString: () => (/* binding */ getFontFamilyString),\n/* harmony export */ getFontString: () => (/* binding */ getFontString),\n/* harmony export */ getFrame: () => (/* binding */ getFrame),\n/* harmony export */ getGlobalCSSVariable: () => (/* binding */ getGlobalCSSVariable),\n/* harmony export */ getNearestScrollableContainer: () => (/* binding */ getNearestScrollableContainer),\n/* harmony export */ getSvgPathFromStroke: () => (/* binding */ getSvgPathFromStroke),\n/* harmony export */ getUpdatedTimestamp: () => (/* binding */ getUpdatedTimestamp),\n/* harmony export */ getVersion: () => (/* binding */ getVersion),\n/* harmony export */ invariant: () => (/* binding */ invariant),\n/* harmony export */ isAnyTrue: () => (/* binding */ isAnyTrue),\n/* harmony export */ isDevEnv: () => (/* binding */ isDevEnv),\n/* harmony export */ isFullScreen: () => (/* binding */ isFullScreen),\n/* harmony export */ isInputLike: () => (/* binding */ isInputLike),\n/* harmony export */ isInteractive: () => (/* binding */ isInteractive),\n/* harmony export */ isMemberOf: () => (/* binding */ isMemberOf),\n/* harmony export */ isPrimitive: () => (/* binding */ isPrimitive),\n/* harmony export */ isProdEnv: () => (/* binding */ isProdEnv),\n/* harmony export */ isPromiseLike: () => (/* binding */ isPromiseLike),\n/* harmony export */ isRTL: () => (/* binding */ isRTL),\n/* harmony export */ isReadonlyArray: () => (/* binding */ isReadonlyArray),\n/* harmony export */ isRunningInIframe: () => (/* binding */ isRunningInIframe),\n/* harmony export */ isSelectionLikeTool: () => (/* binding */ isSelectionLikeTool),\n/* harmony export */ isServerEnv: () => (/* binding */ isServerEnv),\n/* harmony export */ isShallowEqual: () => (/* binding */ isShallowEqual),\n/* harmony export */ isTestEnv: () => (/* binding */ isTestEnv),\n/* harmony export */ isToolIcon: () => (/* binding */ isToolIcon),\n/* harmony export */ isTransparent: () => (/* binding */ isTransparent),\n/* harmony export */ isWritableElement: () => (/* binding */ isWritableElement),\n/* harmony export */ mapFind: () => (/* binding */ mapFind),\n/* harmony export */ memoize: () => (/* binding */ memoize),\n/* harmony export */ muteFSAbortError: () => (/* binding */ muteFSAbortError),\n/* harmony export */ nFormatter: () => (/* binding */ nFormatter),\n/* harmony export */ nextAnimationFrame: () => (/* binding */ nextAnimationFrame),\n/* harmony export */ normalizeEOL: () => (/* binding */ normalizeEOL),\n/* harmony export */ preventUnload: () => (/* binding */ preventUnload),\n/* harmony export */ promiseTry: () => (/* binding */ promiseTry),\n/* harmony export */ queryFocusableElements: () => (/* binding */ queryFocusableElements),\n/* harmony export */ reduceToCommonValue: () => (/* binding */ reduceToCommonValue),\n/* harmony export */ removeSelection: () => (/* binding */ removeSelection),\n/* harmony export */ resolvablePromise: () => (/* binding */ resolvablePromise),\n/* harmony export */ safelyParseJSON: () => (/* binding */ safelyParseJSON),\n/* harmony export */ sceneCoordsToViewportCoords: () => (/* binding */ sceneCoordsToViewportCoords),\n/* harmony export */ selectNode: () => (/* binding */ selectNode),\n/* harmony export */ setDateTimeForTests: () => (/* binding */ setDateTimeForTests),\n/* harmony export */ setFeatureFlag: () => (/* binding */ setFeatureFlag),\n/* harmony export */ sizeOf: () => (/* binding */ sizeOf),\n/* harmony export */ supportsEmoji: () => (/* binding */ supportsEmoji),\n/* harmony export */ throttleRAF: () => (/* binding */ throttleRAF),\n/* harmony export */ toArray: () => (/* binding */ toArray),\n/* harmony export */ toBrandedType: () => (/* binding */ toBrandedType),\n/* harmony export */ toIterable: () => (/* binding */ toIterable),\n/* harmony export */ tupleToCoors: () => (/* binding */ tupleToCoors),\n/* harmony export */ updateActiveTool: () => (/* binding */ updateActiveTool),\n/* harmony export */ updateObject: () => (/* binding */ updateObject),\n/* harmony export */ updateStable: () => (/* binding */ updateStable),\n/* harmony export */ viewportCoordsToSceneCoords: () => (/* binding */ viewportCoordsToSceneCoords),\n/* harmony export */ wrapEvent: () => (/* binding */ wrapEvent)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colors */ \"../common/src/colors.ts\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ \"../common/src/constants.ts\");\n\n\n\nlet mockDateTime = null;\nconst setDateTimeForTests = dateTime => {\n mockDateTime = dateTime;\n};\nconst getDateTime = () => {\n if (mockDateTime) {\n return mockDateTime;\n }\n\n const date = new Date();\n const year = date.getFullYear();\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n const hr = `${date.getHours()}`.padStart(2, \"0\");\n const min = `${date.getMinutes()}`.padStart(2, \"0\");\n return `${year}-${month}-${day}-${hr}${min}`;\n};\nconst capitalizeString = str => str.charAt(0).toUpperCase() + str.slice(1);\nconst isToolIcon = target => target instanceof HTMLElement && target.className.includes(\"ToolIcon\");\nconst isInputLike = target => target instanceof HTMLElement && target.dataset.type === \"wysiwyg\" || target instanceof HTMLBRElement || // newline in wysiwyg\ntarget instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement;\nconst isInteractive = target => {\n return isInputLike(target) || target instanceof Element && !!target.closest(\"label, button\");\n};\nconst isWritableElement = target => target instanceof HTMLElement && target.dataset.type === \"wysiwyg\" || target instanceof HTMLBRElement || // newline in wysiwyg\ntarget instanceof HTMLTextAreaElement || target instanceof HTMLInputElement && (target.type === \"text\" || target.type === \"number\" || target.type === \"password\" || target.type === \"search\");\nconst getFontFamilyString = ({\n fontFamily\n}) => {\n for (const [fontFamilyString, id] of Object.entries(_constants__WEBPACK_IMPORTED_MODULE_2__.FONT_FAMILY)) {\n if (id === fontFamily) {\n return `${fontFamilyString}${(0,_constants__WEBPACK_IMPORTED_MODULE_2__.getFontFamilyFallbacks)(id).map(x => `, ${x}`).join(\"\")}`;\n }\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_2__.WINDOWS_EMOJI_FALLBACK_FONT;\n};\n/** returns fontSize+fontFamily string for assignment to DOM elements */\n\nconst getFontString = ({\n fontSize,\n fontFamily\n}) => {\n return `${fontSize}px ${getFontFamilyString({\n fontFamily\n })}`;\n};\n/** executes callback in the frame that's after the current one */\n\nconst nextAnimationFrame = async cb => {\n requestAnimationFrame(() => requestAnimationFrame(cb));\n};\nconst debounce = (fn, timeout) => {\n let handle = 0;\n let lastArgs = null;\n\n const ret = (...args) => {\n lastArgs = args;\n clearTimeout(handle);\n handle = window.setTimeout(() => {\n lastArgs = null;\n fn(...args);\n }, timeout);\n };\n\n ret.flush = () => {\n clearTimeout(handle);\n\n if (lastArgs) {\n const _lastArgs = lastArgs;\n lastArgs = null;\n fn(..._lastArgs);\n }\n };\n\n ret.cancel = () => {\n lastArgs = null;\n clearTimeout(handle);\n };\n\n return ret;\n}; // throttle callback to execute once per animation frame\n\nconst throttleRAF = (fn, opts) => {\n let timerId = null;\n let lastArgs = null;\n let lastArgsTrailing = null;\n\n const scheduleFunc = args => {\n timerId = window.requestAnimationFrame(() => {\n timerId = null;\n fn(...args);\n lastArgs = null;\n\n if (lastArgsTrailing) {\n lastArgs = lastArgsTrailing;\n lastArgsTrailing = null;\n scheduleFunc(lastArgs);\n }\n });\n };\n\n const ret = (...args) => {\n if (isTestEnv()) {\n fn(...args);\n return;\n }\n\n lastArgs = args;\n\n if (timerId === null) {\n scheduleFunc(lastArgs);\n } else if (opts === null || opts === void 0 ? void 0 : opts.trailing) {\n lastArgsTrailing = args;\n }\n };\n\n ret.flush = () => {\n if (timerId !== null) {\n cancelAnimationFrame(timerId);\n timerId = null;\n }\n\n if (lastArgs) {\n fn(...(lastArgsTrailing || lastArgs));\n lastArgs = lastArgsTrailing = null;\n }\n };\n\n ret.cancel = () => {\n lastArgs = lastArgsTrailing = null;\n\n if (timerId !== null) {\n cancelAnimationFrame(timerId);\n timerId = null;\n }\n };\n\n return ret;\n};\n/**\r\n * Exponential ease-out method\r\n *\r\n * @param {number} k - The value to be tweened.\r\n * @returns {number} The tweened value.\r\n */\n\nconst easeOut = k => {\n return 1 - Math.pow(1 - k, 4);\n};\n\nconst easeOutInterpolate = (from, to, progress) => {\n return (to - from) * easeOut(progress) + from;\n};\n/**\r\n * Animates values from `fromValues` to `toValues` using the requestAnimationFrame API.\r\n * Executes the `onStep` callback on each step with the interpolated values.\r\n * Returns a function that can be called to cancel the animation.\r\n *\r\n * @example\r\n * // Example usage:\r\n * const fromValues = { x: 0, y: 0 };\r\n * const toValues = { x: 100, y: 200 };\r\n * const onStep = ({x, y}) => {\r\n * setState(x, y)\r\n * };\r\n * const onCancel = () => {\r\n * console.log(\"Animation canceled\");\r\n * };\r\n *\r\n * const cancelAnimation = easeToValuesRAF({\r\n * fromValues,\r\n * toValues,\r\n * onStep,\r\n * onCancel,\r\n * });\r\n *\r\n * // To cancel the animation:\r\n * cancelAnimation();\r\n */\n\n\nconst easeToValuesRAF = ({\n fromValues,\n toValues,\n onStep,\n duration = 250,\n interpolateValue,\n onStart,\n onEnd,\n onCancel\n}) => {\n let canceled = false;\n let frameId = 0;\n let startTime;\n\n function step(timestamp) {\n if (canceled) {\n return;\n }\n\n if (startTime === undefined) {\n startTime = timestamp;\n onStart === null || onStart === void 0 ? void 0 : onStart();\n }\n\n const elapsed = Math.min(timestamp - startTime, duration);\n const factor = easeOut(elapsed / duration);\n const newValues = {};\n Object.keys(fromValues).forEach(key => {\n const _key = key;\n const result = (toValues[_key] - fromValues[_key]) * factor + fromValues[_key];\n newValues[_key] = result;\n });\n onStep(newValues);\n\n if (elapsed < duration) {\n const progress = elapsed / duration;\n const newValues = {};\n Object.keys(fromValues).forEach(key => {\n const _key = key;\n const startValue = fromValues[_key];\n const endValue = toValues[_key];\n let result;\n result = interpolateValue ? interpolateValue(startValue, endValue, progress, _key) : easeOutInterpolate(startValue, endValue, progress);\n\n if (result == null) {\n result = easeOutInterpolate(startValue, endValue, progress);\n }\n\n newValues[_key] = result;\n });\n onStep(newValues);\n frameId = window.requestAnimationFrame(step);\n } else {\n onStep(toValues);\n onEnd === null || onEnd === void 0 ? void 0 : onEnd();\n }\n }\n\n frameId = window.requestAnimationFrame(step);\n return () => {\n onCancel === null || onCancel === void 0 ? void 0 : onCancel();\n canceled = true;\n window.cancelAnimationFrame(frameId);\n };\n}; // https://github.com/lodash/lodash/blob/es/chunk.js\n\nconst chunk = (array, size) => {\n if (!array.length || size < 1) {\n return [];\n }\n\n let index = 0;\n let resIndex = 0;\n const result = Array(Math.ceil(array.length / size));\n\n while (index < array.length) {\n result[resIndex++] = array.slice(index, index += size);\n }\n\n return result;\n};\nconst selectNode = node => {\n const selection = window.getSelection();\n\n if (selection) {\n const range = document.createRange();\n range.selectNodeContents(node);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n};\nconst removeSelection = () => {\n const selection = window.getSelection();\n\n if (selection) {\n selection.removeAllRanges();\n }\n};\nconst distance = (x, y) => Math.abs(x - y);\nconst isSelectionLikeTool = type => {\n return type === \"selection\" || type === \"lasso\";\n};\nconst updateActiveTool = (appState, data) => {\n var _a, _b, _c;\n\n if (data.type === \"custom\") {\n return Object.assign(Object.assign({}, appState.activeTool), {\n type: \"custom\",\n customType: data.customType,\n locked: (_a = data.locked) !== null && _a !== void 0 ? _a : appState.activeTool.locked\n });\n }\n\n return Object.assign(Object.assign({}, appState.activeTool), {\n lastActiveTool: data.lastActiveToolBeforeEraser === undefined ? appState.activeTool.lastActiveTool : data.lastActiveToolBeforeEraser,\n type: data.type,\n customType: null,\n locked: (_b = data.locked) !== null && _b !== void 0 ? _b : appState.activeTool.locked,\n fromSelection: (_c = data.fromSelection) !== null && _c !== void 0 ? _c : false\n });\n};\nconst isFullScreen = () => {\n var _a;\n\n return ((_a = document.fullscreenElement) === null || _a === void 0 ? void 0 : _a.nodeName) === \"HTML\";\n};\nconst allowFullScreen = () => document.documentElement.requestFullscreen();\nconst exitFullScreen = () => document.exitFullscreen();\nconst viewportCoordsToSceneCoords = ({\n clientX,\n clientY\n}, {\n zoom,\n offsetLeft,\n offsetTop,\n scrollX,\n scrollY\n}) => {\n const x = (clientX - offsetLeft) / zoom.value - scrollX;\n const y = (clientY - offsetTop) / zoom.value - scrollY;\n return {\n x,\n y\n };\n};\nconst sceneCoordsToViewportCoords = ({\n sceneX,\n sceneY\n}, {\n zoom,\n offsetLeft,\n offsetTop,\n scrollX,\n scrollY\n}) => {\n const x = (sceneX + scrollX) * zoom.value + offsetLeft;\n const y = (sceneY + scrollY) * zoom.value + offsetTop;\n return {\n x,\n y\n };\n};\nconst getGlobalCSSVariable = name => getComputedStyle(document.documentElement).getPropertyValue(`--${name}`);\nconst RS_LTR_CHARS = \"A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02B8\\u0300-\\u0590\\u0800-\\u1FFF\" + \"\\u2C00-\\uFB1C\\uFDFE-\\uFE6F\\uFEFD-\\uFFFF\";\nconst RS_RTL_CHARS = \"\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC\";\nconst RE_RTL_CHECK = new RegExp(`^[^${RS_LTR_CHARS}]*[${RS_RTL_CHARS}]`);\n/**\r\n * Checks whether first directional character is RTL. Meaning whether it starts\r\n * with RTL characters, or indeterminate (numbers etc.) characters followed by\r\n * RTL.\r\n * See https://github.com/excalidraw/excalidraw/pull/1722#discussion_r436340171\r\n */\n\nconst isRTL = text => RE_RTL_CHECK.test(text);\nconst tupleToCoors = xyTuple => {\n const [x, y] = xyTuple;\n return {\n x,\n y\n };\n};\n/** use as a rejectionHandler to mute filesystem Abort errors */\n\nconst muteFSAbortError = error => {\n if ((error === null || error === void 0 ? void 0 : error.name) === \"AbortError\") {\n console.warn(error);\n return;\n }\n\n throw error;\n};\nconst findIndex = (array, cb, fromIndex = 0) => {\n if (fromIndex < 0) {\n fromIndex = array.length + fromIndex;\n }\n\n fromIndex = Math.min(array.length, Math.max(fromIndex, 0));\n let index = fromIndex - 1;\n\n while (++index < array.length) {\n if (cb(array[index], index, array)) {\n return index;\n }\n }\n\n return -1;\n};\nconst findLastIndex = (array, cb, fromIndex = array.length - 1) => {\n if (fromIndex < 0) {\n fromIndex = array.length + fromIndex;\n }\n\n fromIndex = Math.min(array.length - 1, Math.max(fromIndex, 0));\n let index = fromIndex + 1;\n\n while (--index > -1) {\n if (cb(array[index], index, array)) {\n return index;\n }\n }\n\n return -1;\n};\n/** returns the first non-null mapped value */\n\nconst mapFind = (collection, iteratee) => {\n for (let idx = 0; idx < collection.length; idx++) {\n const result = iteratee(collection[idx], idx);\n\n if (result != null) {\n return result;\n }\n }\n\n return undefined;\n};\nconst isTransparent = color => {\n const isRGBTransparent = color.length === 5 && color.substr(4, 1) === \"0\";\n const isRRGGBBTransparent = color.length === 9 && color.substr(7, 2) === \"00\";\n return isRGBTransparent || isRRGGBBTransparent || color === _colors__WEBPACK_IMPORTED_MODULE_1__.COLOR_PALETTE.transparent;\n};\nconst resolvablePromise = () => {\n let resolve;\n let reject;\n const promise = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n promise.resolve = resolve;\n promise.reject = reject;\n return promise;\n}; //https://stackoverflow.com/a/9462382/8418\n\nconst nFormatter = (num, digits) => {\n const si = [{\n value: 1,\n symbol: \"b\"\n }, {\n value: 1e3,\n symbol: \"k\"\n }, {\n value: 1e6,\n symbol: \"M\"\n }, {\n value: 1e9,\n symbol: \"G\"\n }];\n const rx = /\\.0+$|(\\.[0-9]*[1-9])0+$/;\n let index;\n\n for (index = si.length - 1; index > 0; index--) {\n if (num >= si[index].value) {\n break;\n }\n }\n\n return (num / si[index].value).toFixed(digits).replace(rx, \"$1\") + si[index].symbol;\n};\nconst getVersion = () => {\n var _a;\n\n return ((_a = document.querySelector('meta[name=\"version\"]')) === null || _a === void 0 ? void 0 : _a.content) || _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_VERSION;\n}; // Adapted from https://github.com/Modernizr/Modernizr/blob/master/feature-detects/emoji.js\n\nconst supportsEmoji = () => {\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\");\n\n if (!ctx) {\n return false;\n }\n\n const offset = 12;\n ctx.fillStyle = \"#f00\";\n ctx.textBaseline = \"top\";\n ctx.font = \"32px Arial\"; // Modernizr used 🐨, but it is sort of supported on Windows 7.\n // Luckily 😀 isn't supported.\n\n ctx.fillText(\"😀\", 0, 0);\n return ctx.getImageData(offset, offset, 1, 1).data[0] !== 0;\n};\nconst getNearestScrollableContainer = element => {\n let parent = element.parentElement;\n\n while (parent) {\n if (parent === document.body) {\n return document;\n }\n\n const {\n overflowY\n } = window.getComputedStyle(parent);\n const hasScrollableContent = parent.scrollHeight > parent.clientHeight;\n\n if (hasScrollableContent && (overflowY === \"auto\" || overflowY === \"scroll\" || overflowY === \"overlay\")) {\n return parent;\n }\n\n parent = parent.parentElement;\n }\n\n return document;\n};\nconst focusNearestParent = element => {\n let parent = element.parentElement;\n\n while (parent) {\n if (parent.tabIndex > -1) {\n parent.focus();\n return;\n }\n\n parent = parent.parentElement;\n }\n};\nconst preventUnload = event => {\n event.preventDefault(); // NOTE: modern browsers no longer allow showing a custom message here\n\n event.returnValue = \"\";\n};\nconst bytesToHexString = bytes => {\n return Array.from(bytes).map(byte => `0${byte.toString(16)}`.slice(-2)).join(\"\");\n};\nconst getUpdatedTimestamp = () => isTestEnv() ? 1 : Date.now();\n/**\r\n * Transforms array of objects containing `id` attribute,\r\n * or array of ids (strings), into a Map, keyd by `id`.\r\n */\n\nconst arrayToMap = items => {\n if (items instanceof Map) {\n return items;\n }\n\n return items.reduce((acc, element) => {\n acc.set(typeof element === \"string\" ? element : element.id, element);\n return acc;\n }, new Map());\n};\nconst arrayToMapWithIndex = elements => elements.reduce((acc, element, idx) => {\n acc.set(element.id, [element, idx]);\n return acc;\n}, new Map());\n/**\r\n * Transform array into an object, use only when array order is irrelevant.\r\n */\n\nconst arrayToObject = (array, groupBy) => array.reduce((acc, value, idx) => {\n acc[groupBy ? groupBy(value) : idx] = value;\n return acc;\n}, {});\n/**\r\n * Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.\r\n */\n\nconst arrayToList = array => array.reduce((acc, curr, index) => {\n const node = Object.assign(Object.assign({}, curr), {\n prev: null,\n next: null\n }); // no-op for first item, we don't want circular references on a single item\n\n if (index !== 0) {\n const prevNode = acc[index - 1];\n node.prev = prevNode;\n prevNode.next = node;\n\n if (index === array.length - 1) {\n // make the references circular and connect head & tail\n const firstNode = acc[0];\n node.next = firstNode;\n firstNode.prev = node;\n }\n }\n\n acc.push(node);\n return acc;\n}, []);\n/**\r\n * Converts a readonly array or map into an iterable.\r\n * Useful for avoiding entry allocations when iterating object / map on each iteration.\r\n */\n\nconst toIterable = values => {\n return Array.isArray(values) ? values : values.values();\n};\n/**\r\n * Converts a readonly array or map into an array.\r\n */\n\nconst toArray = values => {\n return Array.isArray(values) ? values : Array.from(toIterable(values));\n};\nconst isTestEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_2__.ENV.TEST;\nconst isDevEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_2__.ENV.DEVELOPMENT;\nconst isProdEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_2__.ENV.PRODUCTION;\nconst isServerEnv = () => {\n var _a;\n\n return typeof process !== \"undefined\" && !!((_a = process === null || process === void 0 ? void 0 : ({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-56\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true})) === null || _a === void 0 ? void 0 : _a.NODE_ENV);\n};\nconst wrapEvent = (name, nativeEvent) => {\n return new CustomEvent(name, {\n detail: {\n nativeEvent\n },\n cancelable: true\n });\n};\nconst updateObject = (obj, updates) => {\n let didChange = false;\n\n for (const key in updates) {\n const value = updates[key];\n\n if (typeof value !== \"undefined\") {\n if (obj[key] === value && ( // if object, always update because its attrs could have changed\n typeof value !== \"object\" || value === null)) {\n continue;\n }\n\n didChange = true;\n }\n }\n\n if (!didChange) {\n return obj;\n }\n\n return Object.assign(Object.assign({}, obj), updates);\n};\nconst isPrimitive = val => {\n const type = typeof val;\n return val == null || type !== \"object\" && type !== \"function\";\n};\nconst getFrame = () => {\n try {\n return window.self === window.top ? \"top\" : \"iframe\";\n } catch (error) {\n return \"iframe\";\n }\n};\nconst isRunningInIframe = () => getFrame() === \"iframe\";\nconst isPromiseLike = value => {\n return !!value && typeof value === \"object\" && \"then\" in value && \"catch\" in value && \"finally\" in value;\n};\nconst queryFocusableElements = container => {\n const focusableElements = container === null || container === void 0 ? void 0 : container.querySelectorAll(\"button, a, input, select, textarea, div[tabindex], label[tabindex]\");\n return focusableElements ? Array.from(focusableElements).filter(element => element.tabIndex > -1 && !element.disabled) : [];\n};\n/** use as a fallback after identity check (for perf reasons) */\n\nconst _defaultIsShallowComparatorFallback = (a, b) => {\n // consider two empty arrays equal\n if (Array.isArray(a) && Array.isArray(b) && a.length === 0 && b.length === 0) {\n return true;\n }\n\n return a === b;\n};\n/**\r\n * Returns whether object/array is shallow equal.\r\n * Considers empty object/arrays as equal (whether top-level or second-level).\r\n */\n\n\nconst isShallowEqual = (objA, objB, comparators, debug = false) => {\n const aKeys = Object.keys(objA);\n const bKeys = Object.keys(objB);\n\n if (aKeys.length !== bKeys.length) {\n if (debug) {\n console.warn(`%cisShallowEqual: objects don't have same properties ->`, \"color: #8B4000\", objA, objB);\n }\n\n return false;\n }\n\n if (comparators && Array.isArray(comparators)) {\n for (const key of comparators) {\n const ret = objA[key] === objB[key] || _defaultIsShallowComparatorFallback(objA[key], objB[key]);\n\n if (!ret) {\n if (debug) {\n console.warn(`%cisShallowEqual: ${key} not equal ->`, \"color: #8B4000\", objA[key], objB[key]);\n }\n\n return false;\n }\n }\n\n return true;\n }\n\n return aKeys.every(key => {\n const comparator = comparators === null || comparators === void 0 ? void 0 : comparators[key];\n const ret = comparator ? comparator(objA[key], objB[key]) : objA[key] === objB[key] || _defaultIsShallowComparatorFallback(objA[key], objB[key]);\n\n if (!ret && debug) {\n console.warn(`%cisShallowEqual: ${key} not equal ->`, \"color: #8B4000\", objA[key], objB[key]);\n }\n\n return ret;\n });\n}; // taken from Radix UI\n// https://github.com/radix-ui/primitives/blob/main/packages/core/primitive/src/primitive.tsx\n\nconst composeEventHandlers = (originalEventHandler, ourEventHandler, {\n checkForDefaultPrevented = true\n} = {}) => {\n return function handleEvent(event) {\n originalEventHandler === null || originalEventHandler === void 0 ? void 0 : originalEventHandler(event);\n\n if (!checkForDefaultPrevented || !(event === null || event === void 0 ? void 0 : event.defaultPrevented)) {\n return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);\n }\n };\n};\n/**\r\n * supply `null` as message if non-never value is valid, you just need to\r\n * typecheck against it\r\n */\n\nconst assertNever = (value, message, softAssert) => {\n if (!message) {\n return value;\n }\n\n if (softAssert) {\n console.error(message);\n return value;\n }\n\n throw new Error(message);\n};\nfunction invariant(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}\n/**\r\n * Memoizes on values of `opts` object (strict equality).\r\n */\n\nconst memoize = func => {\n let lastArgs;\n let lastResult;\n\n const ret = function (opts) {\n const currentArgs = Object.entries(opts);\n\n if (lastArgs) {\n let argsAreEqual = true;\n\n for (const [key, value] of currentArgs) {\n if (lastArgs.get(key) !== value) {\n argsAreEqual = false;\n break;\n }\n }\n\n if (argsAreEqual) {\n return lastResult;\n }\n }\n\n const result = func(opts);\n lastArgs = new Map(currentArgs);\n lastResult = result;\n return result;\n };\n\n ret.clear = () => {\n lastArgs = undefined;\n lastResult = undefined;\n };\n\n return ret;\n};\n/** Checks if value is inside given collection. Useful for type-safety. */\n\nconst isMemberOf = (\n/** Set/Map/Array/Object */\ncollection,\n/** value to look for */\nvalue) => {\n return collection instanceof Set || collection instanceof Map ? collection.has(value) : \"includes\" in collection ? collection.includes(value) : collection.hasOwnProperty(value);\n};\nconst cloneJSON = obj => JSON.parse(JSON.stringify(obj));\nconst updateStable = (prevValue, nextValue) => {\n if (isShallowEqual(prevValue, nextValue)) {\n return prevValue;\n }\n\n return nextValue;\n}; // implem\n\nfunction addEventListener(\n/**\r\n * allows for falsy values so you don't have to type check when adding\r\n * event listeners to optional elements\r\n */\ntarget, type, listener, options) {\n var _a;\n\n if (!target) {\n return () => {};\n }\n\n (_a = target === null || target === void 0 ? void 0 : target.addEventListener) === null || _a === void 0 ? void 0 : _a.call(target, type, listener, options);\n return () => {\n var _a;\n\n (_a = target === null || target === void 0 ? void 0 : target.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(target, type, listener, options);\n };\n}\nfunction getSvgPathFromStroke(points, closed = true) {\n const len = points.length;\n\n if (len < 4) {\n return ``;\n }\n\n let a = points[0];\n let b = points[1];\n const c = points[2];\n let result = `M${a[0].toFixed(2)},${a[1].toFixed(2)} Q${b[0].toFixed(2)},${b[1].toFixed(2)} ${(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.average)(b[0], c[0]).toFixed(2)},${(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.average)(b[1], c[1]).toFixed(2)} T`;\n\n for (let i = 2, max = len - 1; i < max; i++) {\n a = points[i];\n b = points[i + 1];\n result += `${(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.average)(a[0], b[0]).toFixed(2)},${(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.average)(a[1], b[1]).toFixed(2)} `;\n }\n\n if (closed) {\n result += \"Z\";\n }\n\n return result;\n}\nconst normalizeEOL = str => {\n return str.replace(/\\r?\\n|\\r/g, \"\\n\");\n};\n/**\r\n * Makes type into a branded type, ensuring that value is assignable to\r\n * the base ubranded type. Optionally you can explicitly supply current value\r\n * type to combine both (useful for composite branded types. Make sure you\r\n * compose branded types which are not composite themselves.)\r\n */\n\nconst toBrandedType = value => {\n return value;\n}; // -----------------------------------------------------------------------------\n// Promise.try, adapted from https://github.com/sindresorhus/p-try\n\nconst promiseTry = async (fn, ...args) => {\n return new Promise(resolve => {\n resolve(fn(...args));\n });\n};\nconst isAnyTrue = (...args) => Math.max(...args.map(arg => arg ? 1 : 0)) > 0;\nconst safelyParseJSON = json => {\n try {\n return JSON.parse(json);\n } catch (_a) {\n return null;\n }\n};\n/**\r\n * use when you need to render unsafe string as HTML attribute, but MAKE SURE\r\n * the attribute is double-quoted when constructing the HTML string\r\n */\n\nconst escapeDoubleQuotes = str => {\n return str.replace(/\"/g, \""\");\n};\nconst castArray = value => Array.isArray(value) ? value : [value];\n/** hack for Array.isArray type guard not working with readonly value[] */\n\nconst isReadonlyArray = value => {\n return Array.isArray(value);\n};\nconst sizeOf = value => {\n return isReadonlyArray(value) ? value.length : value instanceof Map || value instanceof Set ? value.size : Object.keys(value).length;\n};\nconst reduceToCommonValue = (collection, getValue) => {\n if (sizeOf(collection) === 0) {\n return null;\n }\n\n const valueExtractor = getValue || (item => item);\n\n let commonValue = null;\n\n for (const item of collection) {\n const value = valueExtractor(item);\n\n if ((commonValue === null || commonValue === value) && value != null) {\n commonValue = value;\n } else {\n return null;\n }\n }\n\n return commonValue;\n};\nconst FEATURE_FLAGS_STORAGE_KEY = \"excalidraw-feature-flags\";\nconst DEFAULT_FEATURE_FLAGS = {\n COMPLEX_BINDINGS: false\n};\nlet featureFlags = null;\nconst getFeatureFlag = flag => {\n if (!featureFlags) {\n try {\n const serializedFlags = localStorage.getItem(FEATURE_FLAGS_STORAGE_KEY);\n\n if (serializedFlags) {\n const flags = JSON.parse(serializedFlags);\n featureFlags = flags !== null && flags !== void 0 ? flags : DEFAULT_FEATURE_FLAGS;\n }\n } catch (_a) {}\n }\n\n return (featureFlags || DEFAULT_FEATURE_FLAGS)[flag];\n};\nconst setFeatureFlag = (flag, value) => {\n try {\n featureFlags = Object.assign(Object.assign({}, featureFlags || DEFAULT_FEATURE_FLAGS), {\n [flag]: value\n });\n localStorage.setItem(FEATURE_FLAGS_STORAGE_KEY, JSON.stringify(featureFlags));\n } catch (e) {\n console.error(\"unable to set feature flag\", e);\n }\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../common/src/utils.ts?");
|
|
13094
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addEventListener: () => (/* binding */ addEventListener),\n/* harmony export */ allowFullScreen: () => (/* binding */ allowFullScreen),\n/* harmony export */ arrayToList: () => (/* binding */ arrayToList),\n/* harmony export */ arrayToMap: () => (/* binding */ arrayToMap),\n/* harmony export */ arrayToMapWithIndex: () => (/* binding */ arrayToMapWithIndex),\n/* harmony export */ arrayToObject: () => (/* binding */ arrayToObject),\n/* harmony export */ assertNever: () => (/* binding */ assertNever),\n/* harmony export */ bytesToHexString: () => (/* binding */ bytesToHexString),\n/* harmony export */ capitalizeString: () => (/* binding */ capitalizeString),\n/* harmony export */ castArray: () => (/* binding */ castArray),\n/* harmony export */ chunk: () => (/* binding */ chunk),\n/* harmony export */ cloneJSON: () => (/* binding */ cloneJSON),\n/* harmony export */ composeEventHandlers: () => (/* binding */ composeEventHandlers),\n/* harmony export */ debounce: () => (/* binding */ debounce),\n/* harmony export */ distance: () => (/* binding */ distance),\n/* harmony export */ easeOut: () => (/* binding */ easeOut),\n/* harmony export */ easeToValuesRAF: () => (/* binding */ easeToValuesRAF),\n/* harmony export */ escapeDoubleQuotes: () => (/* binding */ escapeDoubleQuotes),\n/* harmony export */ exitFullScreen: () => (/* binding */ exitFullScreen),\n/* harmony export */ findIndex: () => (/* binding */ findIndex),\n/* harmony export */ findLastIndex: () => (/* binding */ findLastIndex),\n/* harmony export */ focusNearestParent: () => (/* binding */ focusNearestParent),\n/* harmony export */ getDateTime: () => (/* binding */ getDateTime),\n/* harmony export */ getFeatureFlag: () => (/* binding */ getFeatureFlag),\n/* harmony export */ getFontFamilyString: () => (/* binding */ getFontFamilyString),\n/* harmony export */ getFontString: () => (/* binding */ getFontString),\n/* harmony export */ getFrame: () => (/* binding */ getFrame),\n/* harmony export */ getGlobalCSSVariable: () => (/* binding */ getGlobalCSSVariable),\n/* harmony export */ getNearestScrollableContainer: () => (/* binding */ getNearestScrollableContainer),\n/* harmony export */ getSvgPathFromStroke: () => (/* binding */ getSvgPathFromStroke),\n/* harmony export */ getUpdatedTimestamp: () => (/* binding */ getUpdatedTimestamp),\n/* harmony export */ getVersion: () => (/* binding */ getVersion),\n/* harmony export */ invariant: () => (/* binding */ invariant),\n/* harmony export */ isAnyTrue: () => (/* binding */ isAnyTrue),\n/* harmony export */ isDevEnv: () => (/* binding */ isDevEnv),\n/* harmony export */ isFullScreen: () => (/* binding */ isFullScreen),\n/* harmony export */ isInputLike: () => (/* binding */ isInputLike),\n/* harmony export */ isInteractive: () => (/* binding */ isInteractive),\n/* harmony export */ isMemberOf: () => (/* binding */ isMemberOf),\n/* harmony export */ isPrimitive: () => (/* binding */ isPrimitive),\n/* harmony export */ isProdEnv: () => (/* binding */ isProdEnv),\n/* harmony export */ isPromiseLike: () => (/* binding */ isPromiseLike),\n/* harmony export */ isRTL: () => (/* binding */ isRTL),\n/* harmony export */ isReadonlyArray: () => (/* binding */ isReadonlyArray),\n/* harmony export */ isRunningInIframe: () => (/* binding */ isRunningInIframe),\n/* harmony export */ isSelectionLikeTool: () => (/* binding */ isSelectionLikeTool),\n/* harmony export */ isServerEnv: () => (/* binding */ isServerEnv),\n/* harmony export */ isShallowEqual: () => (/* binding */ isShallowEqual),\n/* harmony export */ isTestEnv: () => (/* binding */ isTestEnv),\n/* harmony export */ isToolIcon: () => (/* binding */ isToolIcon),\n/* harmony export */ isTransparent: () => (/* binding */ isTransparent),\n/* harmony export */ isWritableElement: () => (/* binding */ isWritableElement),\n/* harmony export */ mapFind: () => (/* binding */ mapFind),\n/* harmony export */ memoize: () => (/* binding */ memoize),\n/* harmony export */ muteFSAbortError: () => (/* binding */ muteFSAbortError),\n/* harmony export */ nFormatter: () => (/* binding */ nFormatter),\n/* harmony export */ nextAnimationFrame: () => (/* binding */ nextAnimationFrame),\n/* harmony export */ normalizeEOL: () => (/* binding */ normalizeEOL),\n/* harmony export */ preventUnload: () => (/* binding */ preventUnload),\n/* harmony export */ promiseTry: () => (/* binding */ promiseTry),\n/* harmony export */ queryFocusableElements: () => (/* binding */ queryFocusableElements),\n/* harmony export */ reduceToCommonValue: () => (/* binding */ reduceToCommonValue),\n/* harmony export */ removeSelection: () => (/* binding */ removeSelection),\n/* harmony export */ resolvablePromise: () => (/* binding */ resolvablePromise),\n/* harmony export */ safelyParseJSON: () => (/* binding */ safelyParseJSON),\n/* harmony export */ sceneCoordsToViewportCoords: () => (/* binding */ sceneCoordsToViewportCoords),\n/* harmony export */ selectNode: () => (/* binding */ selectNode),\n/* harmony export */ setDateTimeForTests: () => (/* binding */ setDateTimeForTests),\n/* harmony export */ setFeatureFlag: () => (/* binding */ setFeatureFlag),\n/* harmony export */ sizeOf: () => (/* binding */ sizeOf),\n/* harmony export */ supportsEmoji: () => (/* binding */ supportsEmoji),\n/* harmony export */ throttleRAF: () => (/* binding */ throttleRAF),\n/* harmony export */ toArray: () => (/* binding */ toArray),\n/* harmony export */ toBrandedType: () => (/* binding */ toBrandedType),\n/* harmony export */ toIterable: () => (/* binding */ toIterable),\n/* harmony export */ tupleToCoors: () => (/* binding */ tupleToCoors),\n/* harmony export */ updateActiveTool: () => (/* binding */ updateActiveTool),\n/* harmony export */ updateObject: () => (/* binding */ updateObject),\n/* harmony export */ updateStable: () => (/* binding */ updateStable),\n/* harmony export */ viewportCoordsToSceneCoords: () => (/* binding */ viewportCoordsToSceneCoords),\n/* harmony export */ wrapEvent: () => (/* binding */ wrapEvent)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./colors */ \"../common/src/colors.ts\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ \"../common/src/constants.ts\");\n\n\n\nlet mockDateTime = null;\nconst setDateTimeForTests = dateTime => {\n mockDateTime = dateTime;\n};\nconst getDateTime = () => {\n if (mockDateTime) {\n return mockDateTime;\n }\n\n const date = new Date();\n const year = date.getFullYear();\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n const hr = `${date.getHours()}`.padStart(2, \"0\");\n const min = `${date.getMinutes()}`.padStart(2, \"0\");\n return `${year}-${month}-${day}-${hr}${min}`;\n};\nconst capitalizeString = str => str.charAt(0).toUpperCase() + str.slice(1);\nconst isToolIcon = target => target instanceof HTMLElement && target.className.includes(\"ToolIcon\");\nconst isInputLike = target => target instanceof HTMLElement && target.dataset.type === \"wysiwyg\" || target instanceof HTMLBRElement || // newline in wysiwyg\ntarget instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement;\nconst isInteractive = target => {\n return isInputLike(target) || target instanceof Element && !!target.closest(\"label, button\");\n};\nconst isWritableElement = target => target instanceof HTMLElement && target.dataset.type === \"wysiwyg\" || target instanceof HTMLBRElement || // newline in wysiwyg\ntarget instanceof HTMLTextAreaElement || target instanceof HTMLInputElement && (target.type === \"text\" || target.type === \"number\" || target.type === \"password\" || target.type === \"search\");\nconst getFontFamilyString = ({\n fontFamily\n}) => {\n for (const [fontFamilyString, id] of Object.entries(_constants__WEBPACK_IMPORTED_MODULE_2__.FONT_FAMILY)) {\n if (id === fontFamily) {\n return `${fontFamilyString}${(0,_constants__WEBPACK_IMPORTED_MODULE_2__.getFontFamilyFallbacks)(id).map(x => `, ${x}`).join(\"\")}`;\n }\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_2__.WINDOWS_EMOJI_FALLBACK_FONT;\n};\n/** returns fontSize+fontFamily string for assignment to DOM elements */\n\nconst getFontString = ({\n fontSize,\n fontFamily\n}) => {\n return `${fontSize}px ${getFontFamilyString({\n fontFamily\n })}`;\n};\n/** executes callback in the frame that's after the current one */\n\nconst nextAnimationFrame = async cb => {\n requestAnimationFrame(() => requestAnimationFrame(cb));\n};\nconst debounce = (fn, timeout) => {\n let handle = 0;\n let lastArgs = null;\n\n const ret = (...args) => {\n lastArgs = args;\n clearTimeout(handle);\n handle = window.setTimeout(() => {\n lastArgs = null;\n fn(...args);\n }, timeout);\n };\n\n ret.flush = () => {\n clearTimeout(handle);\n\n if (lastArgs) {\n const _lastArgs = lastArgs;\n lastArgs = null;\n fn(..._lastArgs);\n }\n };\n\n ret.cancel = () => {\n lastArgs = null;\n clearTimeout(handle);\n };\n\n return ret;\n}; // throttle callback to execute once per animation frame\n\nconst throttleRAF = (fn, opts) => {\n let timerId = null;\n let lastArgs = null;\n let lastArgsTrailing = null;\n\n const scheduleFunc = args => {\n timerId = window.requestAnimationFrame(() => {\n timerId = null;\n fn(...args);\n lastArgs = null;\n\n if (lastArgsTrailing) {\n lastArgs = lastArgsTrailing;\n lastArgsTrailing = null;\n scheduleFunc(lastArgs);\n }\n });\n };\n\n const ret = (...args) => {\n if (isTestEnv()) {\n fn(...args);\n return;\n }\n\n lastArgs = args;\n\n if (timerId === null) {\n scheduleFunc(lastArgs);\n } else if (opts === null || opts === void 0 ? void 0 : opts.trailing) {\n lastArgsTrailing = args;\n }\n };\n\n ret.flush = () => {\n if (timerId !== null) {\n cancelAnimationFrame(timerId);\n timerId = null;\n }\n\n if (lastArgs) {\n fn(...(lastArgsTrailing || lastArgs));\n lastArgs = lastArgsTrailing = null;\n }\n };\n\n ret.cancel = () => {\n lastArgs = lastArgsTrailing = null;\n\n if (timerId !== null) {\n cancelAnimationFrame(timerId);\n timerId = null;\n }\n };\n\n return ret;\n};\n/**\r\n * Exponential ease-out method\r\n *\r\n * @param {number} k - The value to be tweened.\r\n * @returns {number} The tweened value.\r\n */\n\nconst easeOut = k => {\n return 1 - Math.pow(1 - k, 4);\n};\n\nconst easeOutInterpolate = (from, to, progress) => {\n return (to - from) * easeOut(progress) + from;\n};\n/**\r\n * Animates values from `fromValues` to `toValues` using the requestAnimationFrame API.\r\n * Executes the `onStep` callback on each step with the interpolated values.\r\n * Returns a function that can be called to cancel the animation.\r\n *\r\n * @example\r\n * // Example usage:\r\n * const fromValues = { x: 0, y: 0 };\r\n * const toValues = { x: 100, y: 200 };\r\n * const onStep = ({x, y}) => {\r\n * setState(x, y)\r\n * };\r\n * const onCancel = () => {\r\n * console.log(\"Animation canceled\");\r\n * };\r\n *\r\n * const cancelAnimation = easeToValuesRAF({\r\n * fromValues,\r\n * toValues,\r\n * onStep,\r\n * onCancel,\r\n * });\r\n *\r\n * // To cancel the animation:\r\n * cancelAnimation();\r\n */\n\n\nconst easeToValuesRAF = ({\n fromValues,\n toValues,\n onStep,\n duration = 250,\n interpolateValue,\n onStart,\n onEnd,\n onCancel\n}) => {\n let canceled = false;\n let frameId = 0;\n let startTime;\n\n function step(timestamp) {\n if (canceled) {\n return;\n }\n\n if (startTime === undefined) {\n startTime = timestamp;\n onStart === null || onStart === void 0 ? void 0 : onStart();\n }\n\n const elapsed = Math.min(timestamp - startTime, duration);\n const factor = easeOut(elapsed / duration);\n const newValues = {};\n Object.keys(fromValues).forEach(key => {\n const _key = key;\n const result = (toValues[_key] - fromValues[_key]) * factor + fromValues[_key];\n newValues[_key] = result;\n });\n onStep(newValues);\n\n if (elapsed < duration) {\n const progress = elapsed / duration;\n const newValues = {};\n Object.keys(fromValues).forEach(key => {\n const _key = key;\n const startValue = fromValues[_key];\n const endValue = toValues[_key];\n let result;\n result = interpolateValue ? interpolateValue(startValue, endValue, progress, _key) : easeOutInterpolate(startValue, endValue, progress);\n\n if (result == null) {\n result = easeOutInterpolate(startValue, endValue, progress);\n }\n\n newValues[_key] = result;\n });\n onStep(newValues);\n frameId = window.requestAnimationFrame(step);\n } else {\n onStep(toValues);\n onEnd === null || onEnd === void 0 ? void 0 : onEnd();\n }\n }\n\n frameId = window.requestAnimationFrame(step);\n return () => {\n onCancel === null || onCancel === void 0 ? void 0 : onCancel();\n canceled = true;\n window.cancelAnimationFrame(frameId);\n };\n}; // https://github.com/lodash/lodash/blob/es/chunk.js\n\nconst chunk = (array, size) => {\n if (!array.length || size < 1) {\n return [];\n }\n\n let index = 0;\n let resIndex = 0;\n const result = Array(Math.ceil(array.length / size));\n\n while (index < array.length) {\n result[resIndex++] = array.slice(index, index += size);\n }\n\n return result;\n};\nconst selectNode = node => {\n const selection = window.getSelection();\n\n if (selection) {\n const range = document.createRange();\n range.selectNodeContents(node);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n};\nconst removeSelection = () => {\n const selection = window.getSelection();\n\n if (selection) {\n selection.removeAllRanges();\n }\n};\nconst distance = (x, y) => Math.abs(x - y);\nconst isSelectionLikeTool = type => {\n return type === \"selection\" || type === \"lasso\";\n};\nconst updateActiveTool = (appState, data) => {\n var _a, _b, _c;\n\n if (data.type === \"custom\") {\n return Object.assign(Object.assign({}, appState.activeTool), {\n type: \"custom\",\n customType: data.customType,\n locked: (_a = data.locked) !== null && _a !== void 0 ? _a : appState.activeTool.locked\n });\n }\n\n return Object.assign(Object.assign({}, appState.activeTool), {\n lastActiveTool: data.lastActiveToolBeforeEraser === undefined ? appState.activeTool.lastActiveTool : data.lastActiveToolBeforeEraser,\n type: data.type,\n customType: null,\n locked: (_b = data.locked) !== null && _b !== void 0 ? _b : appState.activeTool.locked,\n fromSelection: (_c = data.fromSelection) !== null && _c !== void 0 ? _c : false\n });\n};\nconst isFullScreen = () => {\n var _a;\n\n return ((_a = document.fullscreenElement) === null || _a === void 0 ? void 0 : _a.nodeName) === \"HTML\";\n};\nconst allowFullScreen = () => document.documentElement.requestFullscreen();\nconst exitFullScreen = () => document.exitFullscreen();\nconst viewportCoordsToSceneCoords = ({\n clientX,\n clientY\n}, {\n zoom,\n offsetLeft,\n offsetTop,\n scrollX,\n scrollY\n}) => {\n const x = (clientX - offsetLeft) / zoom.value - scrollX;\n const y = (clientY - offsetTop) / zoom.value - scrollY;\n return {\n x,\n y\n };\n};\nconst sceneCoordsToViewportCoords = ({\n sceneX,\n sceneY\n}, {\n zoom,\n offsetLeft,\n offsetTop,\n scrollX,\n scrollY\n}) => {\n const x = (sceneX + scrollX) * zoom.value + offsetLeft;\n const y = (sceneY + scrollY) * zoom.value + offsetTop;\n return {\n x,\n y\n };\n};\nconst getGlobalCSSVariable = name => getComputedStyle(document.documentElement).getPropertyValue(`--${name}`);\nconst RS_LTR_CHARS = \"A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02B8\\u0300-\\u0590\\u0800-\\u1FFF\" + \"\\u2C00-\\uFB1C\\uFDFE-\\uFE6F\\uFEFD-\\uFFFF\";\nconst RS_RTL_CHARS = \"\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC\";\nconst RE_RTL_CHECK = new RegExp(`^[^${RS_LTR_CHARS}]*[${RS_RTL_CHARS}]`);\n/**\r\n * Checks whether first directional character is RTL. Meaning whether it starts\r\n * with RTL characters, or indeterminate (numbers etc.) characters followed by\r\n * RTL.\r\n * See https://github.com/excalidraw/excalidraw/pull/1722#discussion_r436340171\r\n */\n\nconst isRTL = text => RE_RTL_CHECK.test(text);\nconst tupleToCoors = xyTuple => {\n const [x, y] = xyTuple;\n return {\n x,\n y\n };\n};\n/** use as a rejectionHandler to mute filesystem Abort errors */\n\nconst muteFSAbortError = error => {\n if ((error === null || error === void 0 ? void 0 : error.name) === \"AbortError\") {\n console.warn(error);\n return;\n }\n\n throw error;\n};\nconst findIndex = (array, cb, fromIndex = 0) => {\n if (fromIndex < 0) {\n fromIndex = array.length + fromIndex;\n }\n\n fromIndex = Math.min(array.length, Math.max(fromIndex, 0));\n let index = fromIndex - 1;\n\n while (++index < array.length) {\n if (cb(array[index], index, array)) {\n return index;\n }\n }\n\n return -1;\n};\nconst findLastIndex = (array, cb, fromIndex = array.length - 1) => {\n if (fromIndex < 0) {\n fromIndex = array.length + fromIndex;\n }\n\n fromIndex = Math.min(array.length - 1, Math.max(fromIndex, 0));\n let index = fromIndex + 1;\n\n while (--index > -1) {\n if (cb(array[index], index, array)) {\n return index;\n }\n }\n\n return -1;\n};\n/** returns the first non-null mapped value */\n\nconst mapFind = (collection, iteratee) => {\n for (let idx = 0; idx < collection.length; idx++) {\n const result = iteratee(collection[idx], idx);\n\n if (result != null) {\n return result;\n }\n }\n\n return undefined;\n};\nconst isTransparent = color => {\n const isRGBTransparent = color.length === 5 && color.substr(4, 1) === \"0\";\n const isRRGGBBTransparent = color.length === 9 && color.substr(7, 2) === \"00\";\n return isRGBTransparent || isRRGGBBTransparent || color === _colors__WEBPACK_IMPORTED_MODULE_1__.COLOR_PALETTE.transparent;\n};\nconst resolvablePromise = () => {\n let resolve;\n let reject;\n const promise = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n promise.resolve = resolve;\n promise.reject = reject;\n return promise;\n}; //https://stackoverflow.com/a/9462382/8418\n\nconst nFormatter = (num, digits) => {\n const si = [{\n value: 1,\n symbol: \"b\"\n }, {\n value: 1e3,\n symbol: \"k\"\n }, {\n value: 1e6,\n symbol: \"M\"\n }, {\n value: 1e9,\n symbol: \"G\"\n }];\n const rx = /\\.0+$|(\\.[0-9]*[1-9])0+$/;\n let index;\n\n for (index = si.length - 1; index > 0; index--) {\n if (num >= si[index].value) {\n break;\n }\n }\n\n return (num / si[index].value).toFixed(digits).replace(rx, \"$1\") + si[index].symbol;\n};\nconst getVersion = () => {\n var _a;\n\n return ((_a = document.querySelector('meta[name=\"version\"]')) === null || _a === void 0 ? void 0 : _a.content) || _constants__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_VERSION;\n}; // Adapted from https://github.com/Modernizr/Modernizr/blob/master/feature-detects/emoji.js\n\nconst supportsEmoji = () => {\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\");\n\n if (!ctx) {\n return false;\n }\n\n const offset = 12;\n ctx.fillStyle = \"#f00\";\n ctx.textBaseline = \"top\";\n ctx.font = \"32px Arial\"; // Modernizr used 🐨, but it is sort of supported on Windows 7.\n // Luckily 😀 isn't supported.\n\n ctx.fillText(\"😀\", 0, 0);\n return ctx.getImageData(offset, offset, 1, 1).data[0] !== 0;\n};\nconst getNearestScrollableContainer = element => {\n let parent = element.parentElement;\n\n while (parent) {\n if (parent === document.body) {\n return document;\n }\n\n const {\n overflowY\n } = window.getComputedStyle(parent);\n const hasScrollableContent = parent.scrollHeight > parent.clientHeight;\n\n if (hasScrollableContent && (overflowY === \"auto\" || overflowY === \"scroll\" || overflowY === \"overlay\")) {\n return parent;\n }\n\n parent = parent.parentElement;\n }\n\n return document;\n};\nconst focusNearestParent = element => {\n let parent = element.parentElement;\n\n while (parent) {\n if (parent.tabIndex > -1) {\n parent.focus();\n return;\n }\n\n parent = parent.parentElement;\n }\n};\nconst preventUnload = event => {\n event.preventDefault(); // NOTE: modern browsers no longer allow showing a custom message here\n\n event.returnValue = \"\";\n};\nconst bytesToHexString = bytes => {\n return Array.from(bytes).map(byte => `0${byte.toString(16)}`.slice(-2)).join(\"\");\n};\nconst getUpdatedTimestamp = () => isTestEnv() ? 1 : Date.now();\n/**\r\n * Transforms array of objects containing `id` attribute,\r\n * or array of ids (strings), into a Map, keyd by `id`.\r\n */\n\nconst arrayToMap = items => {\n if (items instanceof Map) {\n return items;\n }\n\n return items.reduce((acc, element) => {\n acc.set(typeof element === \"string\" ? element : element.id, element);\n return acc;\n }, new Map());\n};\nconst arrayToMapWithIndex = elements => elements.reduce((acc, element, idx) => {\n acc.set(element.id, [element, idx]);\n return acc;\n}, new Map());\n/**\r\n * Transform array into an object, use only when array order is irrelevant.\r\n */\n\nconst arrayToObject = (array, groupBy) => array.reduce((acc, value, idx) => {\n acc[groupBy ? groupBy(value) : idx] = value;\n return acc;\n}, {});\n/**\r\n * Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.\r\n */\n\nconst arrayToList = array => array.reduce((acc, curr, index) => {\n const node = Object.assign(Object.assign({}, curr), {\n prev: null,\n next: null\n }); // no-op for first item, we don't want circular references on a single item\n\n if (index !== 0) {\n const prevNode = acc[index - 1];\n node.prev = prevNode;\n prevNode.next = node;\n\n if (index === array.length - 1) {\n // make the references circular and connect head & tail\n const firstNode = acc[0];\n node.next = firstNode;\n firstNode.prev = node;\n }\n }\n\n acc.push(node);\n return acc;\n}, []);\n/**\r\n * Converts a readonly array or map into an iterable.\r\n * Useful for avoiding entry allocations when iterating object / map on each iteration.\r\n */\n\nconst toIterable = values => {\n return Array.isArray(values) ? values : values.values();\n};\n/**\r\n * Converts a readonly array or map into an array.\r\n */\n\nconst toArray = values => {\n return Array.isArray(values) ? values : Array.from(toIterable(values));\n};\nconst isTestEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_2__.ENV.TEST;\nconst isDevEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_2__.ENV.DEVELOPMENT;\nconst isProdEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_2__.ENV.PRODUCTION;\nconst isServerEnv = () => {\n var _a;\n\n return typeof process !== \"undefined\" && !!((_a = process === null || process === void 0 ? void 0 : ({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-58\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true})) === null || _a === void 0 ? void 0 : _a.NODE_ENV);\n};\nconst wrapEvent = (name, nativeEvent) => {\n return new CustomEvent(name, {\n detail: {\n nativeEvent\n },\n cancelable: true\n });\n};\nconst updateObject = (obj, updates) => {\n let didChange = false;\n\n for (const key in updates) {\n const value = updates[key];\n\n if (typeof value !== \"undefined\") {\n if (obj[key] === value && ( // if object, always update because its attrs could have changed\n typeof value !== \"object\" || value === null)) {\n continue;\n }\n\n didChange = true;\n }\n }\n\n if (!didChange) {\n return obj;\n }\n\n return Object.assign(Object.assign({}, obj), updates);\n};\nconst isPrimitive = val => {\n const type = typeof val;\n return val == null || type !== \"object\" && type !== \"function\";\n};\nconst getFrame = () => {\n try {\n return window.self === window.top ? \"top\" : \"iframe\";\n } catch (error) {\n return \"iframe\";\n }\n};\nconst isRunningInIframe = () => getFrame() === \"iframe\";\nconst isPromiseLike = value => {\n return !!value && typeof value === \"object\" && \"then\" in value && \"catch\" in value && \"finally\" in value;\n};\nconst queryFocusableElements = container => {\n const focusableElements = container === null || container === void 0 ? void 0 : container.querySelectorAll(\"button, a, input, select, textarea, div[tabindex], label[tabindex]\");\n return focusableElements ? Array.from(focusableElements).filter(element => element.tabIndex > -1 && !element.disabled) : [];\n};\n/** use as a fallback after identity check (for perf reasons) */\n\nconst _defaultIsShallowComparatorFallback = (a, b) => {\n // consider two empty arrays equal\n if (Array.isArray(a) && Array.isArray(b) && a.length === 0 && b.length === 0) {\n return true;\n }\n\n return a === b;\n};\n/**\r\n * Returns whether object/array is shallow equal.\r\n * Considers empty object/arrays as equal (whether top-level or second-level).\r\n */\n\n\nconst isShallowEqual = (objA, objB, comparators, debug = false) => {\n const aKeys = Object.keys(objA);\n const bKeys = Object.keys(objB);\n\n if (aKeys.length !== bKeys.length) {\n if (debug) {\n console.warn(`%cisShallowEqual: objects don't have same properties ->`, \"color: #8B4000\", objA, objB);\n }\n\n return false;\n }\n\n if (comparators && Array.isArray(comparators)) {\n for (const key of comparators) {\n const ret = objA[key] === objB[key] || _defaultIsShallowComparatorFallback(objA[key], objB[key]);\n\n if (!ret) {\n if (debug) {\n console.warn(`%cisShallowEqual: ${key} not equal ->`, \"color: #8B4000\", objA[key], objB[key]);\n }\n\n return false;\n }\n }\n\n return true;\n }\n\n return aKeys.every(key => {\n const comparator = comparators === null || comparators === void 0 ? void 0 : comparators[key];\n const ret = comparator ? comparator(objA[key], objB[key]) : objA[key] === objB[key] || _defaultIsShallowComparatorFallback(objA[key], objB[key]);\n\n if (!ret && debug) {\n console.warn(`%cisShallowEqual: ${key} not equal ->`, \"color: #8B4000\", objA[key], objB[key]);\n }\n\n return ret;\n });\n}; // taken from Radix UI\n// https://github.com/radix-ui/primitives/blob/main/packages/core/primitive/src/primitive.tsx\n\nconst composeEventHandlers = (originalEventHandler, ourEventHandler, {\n checkForDefaultPrevented = true\n} = {}) => {\n return function handleEvent(event) {\n originalEventHandler === null || originalEventHandler === void 0 ? void 0 : originalEventHandler(event);\n\n if (!checkForDefaultPrevented || !(event === null || event === void 0 ? void 0 : event.defaultPrevented)) {\n return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);\n }\n };\n};\n/**\r\n * supply `null` as message if non-never value is valid, you just need to\r\n * typecheck against it\r\n */\n\nconst assertNever = (value, message, softAssert) => {\n if (!message) {\n return value;\n }\n\n if (softAssert) {\n console.error(message);\n return value;\n }\n\n throw new Error(message);\n};\nfunction invariant(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}\n/**\r\n * Memoizes on values of `opts` object (strict equality).\r\n */\n\nconst memoize = func => {\n let lastArgs;\n let lastResult;\n\n const ret = function (opts) {\n const currentArgs = Object.entries(opts);\n\n if (lastArgs) {\n let argsAreEqual = true;\n\n for (const [key, value] of currentArgs) {\n if (lastArgs.get(key) !== value) {\n argsAreEqual = false;\n break;\n }\n }\n\n if (argsAreEqual) {\n return lastResult;\n }\n }\n\n const result = func(opts);\n lastArgs = new Map(currentArgs);\n lastResult = result;\n return result;\n };\n\n ret.clear = () => {\n lastArgs = undefined;\n lastResult = undefined;\n };\n\n return ret;\n};\n/** Checks if value is inside given collection. Useful for type-safety. */\n\nconst isMemberOf = (\n/** Set/Map/Array/Object */\ncollection,\n/** value to look for */\nvalue) => {\n return collection instanceof Set || collection instanceof Map ? collection.has(value) : \"includes\" in collection ? collection.includes(value) : collection.hasOwnProperty(value);\n};\nconst cloneJSON = obj => JSON.parse(JSON.stringify(obj));\nconst updateStable = (prevValue, nextValue) => {\n if (isShallowEqual(prevValue, nextValue)) {\n return prevValue;\n }\n\n return nextValue;\n}; // implem\n\nfunction addEventListener(\n/**\r\n * allows for falsy values so you don't have to type check when adding\r\n * event listeners to optional elements\r\n */\ntarget, type, listener, options) {\n var _a;\n\n if (!target) {\n return () => {};\n }\n\n (_a = target === null || target === void 0 ? void 0 : target.addEventListener) === null || _a === void 0 ? void 0 : _a.call(target, type, listener, options);\n return () => {\n var _a;\n\n (_a = target === null || target === void 0 ? void 0 : target.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(target, type, listener, options);\n };\n}\nfunction getSvgPathFromStroke(points, closed = true) {\n const len = points.length;\n\n if (len < 4) {\n return ``;\n }\n\n let a = points[0];\n let b = points[1];\n const c = points[2];\n let result = `M${a[0].toFixed(2)},${a[1].toFixed(2)} Q${b[0].toFixed(2)},${b[1].toFixed(2)} ${(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.average)(b[0], c[0]).toFixed(2)},${(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.average)(b[1], c[1]).toFixed(2)} T`;\n\n for (let i = 2, max = len - 1; i < max; i++) {\n a = points[i];\n b = points[i + 1];\n result += `${(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.average)(a[0], b[0]).toFixed(2)},${(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.average)(a[1], b[1]).toFixed(2)} `;\n }\n\n if (closed) {\n result += \"Z\";\n }\n\n return result;\n}\nconst normalizeEOL = str => {\n return str.replace(/\\r?\\n|\\r/g, \"\\n\");\n};\n/**\r\n * Makes type into a branded type, ensuring that value is assignable to\r\n * the base ubranded type. Optionally you can explicitly supply current value\r\n * type to combine both (useful for composite branded types. Make sure you\r\n * compose branded types which are not composite themselves.)\r\n */\n\nconst toBrandedType = value => {\n return value;\n}; // -----------------------------------------------------------------------------\n// Promise.try, adapted from https://github.com/sindresorhus/p-try\n\nconst promiseTry = async (fn, ...args) => {\n return new Promise(resolve => {\n resolve(fn(...args));\n });\n};\nconst isAnyTrue = (...args) => Math.max(...args.map(arg => arg ? 1 : 0)) > 0;\nconst safelyParseJSON = json => {\n try {\n return JSON.parse(json);\n } catch (_a) {\n return null;\n }\n};\n/**\r\n * use when you need to render unsafe string as HTML attribute, but MAKE SURE\r\n * the attribute is double-quoted when constructing the HTML string\r\n */\n\nconst escapeDoubleQuotes = str => {\n return str.replace(/\"/g, \""\");\n};\nconst castArray = value => Array.isArray(value) ? value : [value];\n/** hack for Array.isArray type guard not working with readonly value[] */\n\nconst isReadonlyArray = value => {\n return Array.isArray(value);\n};\nconst sizeOf = value => {\n return isReadonlyArray(value) ? value.length : value instanceof Map || value instanceof Set ? value.size : Object.keys(value).length;\n};\nconst reduceToCommonValue = (collection, getValue) => {\n if (sizeOf(collection) === 0) {\n return null;\n }\n\n const valueExtractor = getValue || (item => item);\n\n let commonValue = null;\n\n for (const item of collection) {\n const value = valueExtractor(item);\n\n if ((commonValue === null || commonValue === value) && value != null) {\n commonValue = value;\n } else {\n return null;\n }\n }\n\n return commonValue;\n};\nconst FEATURE_FLAGS_STORAGE_KEY = \"excalidraw-feature-flags\";\nconst DEFAULT_FEATURE_FLAGS = {\n COMPLEX_BINDINGS: false\n};\nlet featureFlags = null;\nconst getFeatureFlag = flag => {\n if (!featureFlags) {\n try {\n const serializedFlags = localStorage.getItem(FEATURE_FLAGS_STORAGE_KEY);\n\n if (serializedFlags) {\n const flags = JSON.parse(serializedFlags);\n featureFlags = flags !== null && flags !== void 0 ? flags : DEFAULT_FEATURE_FLAGS;\n }\n } catch (_a) {}\n }\n\n return (featureFlags || DEFAULT_FEATURE_FLAGS)[flag];\n};\nconst setFeatureFlag = (flag, value) => {\n try {\n featureFlags = Object.assign(Object.assign({}, featureFlags || DEFAULT_FEATURE_FLAGS), {\n [flag]: value\n });\n localStorage.setItem(FEATURE_FLAGS_STORAGE_KEY, JSON.stringify(featureFlags));\n } catch (e) {\n console.error(\"unable to set feature flag\", e);\n }\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../common/src/utils.ts?");
|
|
13095
13095
|
|
|
13096
13096
|
/***/ }),
|
|
13097
13097
|
|
|
@@ -13322,7 +13322,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
13322
13322
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13323
13323
|
|
|
13324
13324
|
"use strict";
|
|
13325
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addElementsToFrame: () => (/* binding */ addElementsToFrame),\n/* harmony export */ bindElementsToFramesAfterDuplication: () => (/* binding */ bindElementsToFramesAfterDuplication),\n/* harmony export */ elementOverlapsWithFrame: () => (/* binding */ elementOverlapsWithFrame),\n/* harmony export */ elementsAreInFrameBounds: () => (/* binding */ elementsAreInFrameBounds),\n/* harmony export */ filterElementsEligibleAsFrameChildren: () => (/* binding */ filterElementsEligibleAsFrameChildren),\n/* harmony export */ frameAndChildrenSelectedTogether: () => (/* binding */ frameAndChildrenSelectedTogether),\n/* harmony export */ getContainingFrame: () => (/* binding */ getContainingFrame),\n/* harmony export */ getDefaultFrameName: () => (/* binding */ getDefaultFrameName),\n/* harmony export */ getElementsCompletelyInFrame: () => (/* binding */ getElementsCompletelyInFrame),\n/* harmony export */ getElementsInNewFrame: () => (/* binding */ getElementsInNewFrame),\n/* harmony export */ getElementsInResizingFrame: () => (/* binding */ getElementsInResizingFrame),\n/* harmony export */ getElementsIntersectingFrame: () => (/* binding */ getElementsIntersectingFrame),\n/* harmony export */ getElementsOverlappingFrame: () => (/* binding */ getElementsOverlappingFrame),\n/* harmony export */ getFrameChildren: () => (/* binding */ getFrameChildren),\n/* harmony export */ getFrameLikeElements: () => (/* binding */ getFrameLikeElements),\n/* harmony export */ getFrameLikeTitle: () => (/* binding */ getFrameLikeTitle),\n/* harmony export */ getRootElements: () => (/* binding */ getRootElements),\n/* harmony export */ getTargetFrame: () => (/* binding */ getTargetFrame),\n/* harmony export */ groupByFrameLikes: () => (/* binding */ groupByFrameLikes),\n/* harmony export */ groupsAreAtLeastIntersectingTheFrame: () => (/* binding */ groupsAreAtLeastIntersectingTheFrame),\n/* harmony export */ groupsAreCompletelyOutOfFrame: () => (/* binding */ groupsAreCompletelyOutOfFrame),\n/* harmony export */ isCursorInFrame: () => (/* binding */ isCursorInFrame),\n/* harmony export */ isElementContainingFrame: () => (/* binding */ isElementContainingFrame),\n/* harmony export */ isElementInFrame: () => (/* binding */ isElementInFrame),\n/* harmony export */ isElementIntersectingFrame: () => (/* binding */ isElementIntersectingFrame),\n/* harmony export */ omitGroupsContainingFrameLikes: () => (/* binding */ omitGroupsContainingFrameLikes),\n/* harmony export */ omitPartialGroups: () => (/* binding */ omitPartialGroups),\n/* harmony export */ removeAllElementsFromFrame: () => (/* binding */ removeAllElementsFromFrame),\n/* harmony export */ removeElementsFromFrame: () => (/* binding */ removeElementsFromFrame),\n/* harmony export */ replaceAllElementsInFrame: () => (/* binding */ replaceAllElementsInFrame),\n/* harmony export */ shouldApplyFrameClip: () => (/* binding */ shouldApplyFrameClip),\n/* harmony export */ updateFrameMembershipOfSelectedElements: () => (/* binding */ updateFrameMembershipOfSelectedElements)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var _excalidraw_utils_bbox__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/utils/bbox */ \"../utils/src/bbox.ts\");\n/* harmony import */ var _excalidraw_utils_withinBounds__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/utils/withinBounds */ \"../utils/src/withinBounds.ts\");\n/* harmony import */ var _selection__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./selection */ \"../element/src/selection.ts\");\n/* harmony import */ var _groups__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./groups */ \"../element/src/groups.ts\");\n/* harmony import */ var _bounds__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _mutateElement__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./mutateElement */ \"../element/src/mutateElement.ts\");\n/* harmony import */ var _textElement__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _typeChecks__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./typeChecks */ \"../element/src/typeChecks.ts\");\n\n\n\n\n\n\n\n\n\n // --------------------------- Frame State ------------------------------------\n\nconst bindElementsToFramesAfterDuplication = (nextElements, origElements, origIdToDuplicateId) => {\n const nextElementMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(nextElements);\n\n for (const element of origElements) {\n if (element.frameId) {\n // use its frameId to get the new frameId\n const nextElementId = origIdToDuplicateId.get(element.id);\n const nextFrameId = origIdToDuplicateId.get(element.frameId);\n const nextElement = nextElementId && nextElementMap.get(nextElementId);\n\n if (nextElement) {\n (0,_mutateElement__WEBPACK_IMPORTED_MODULE_7__.mutateElement)(nextElement, nextElementMap, {\n frameId: nextFrameId !== null && nextFrameId !== void 0 ? nextFrameId : null\n });\n }\n }\n }\n};\nfunction isElementIntersectingFrame(element, frame, elementsMap) {\n const frameLineSegments = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getElementLineSegments)(frame, elementsMap);\n const elementLineSegments = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getElementLineSegments)(element, elementsMap);\n const intersecting = frameLineSegments.some(frameLineSegment => elementLineSegments.some(elementLineSegment => (0,_excalidraw_utils_bbox__WEBPACK_IMPORTED_MODULE_2__.doLineSegmentsIntersect)(frameLineSegment, elementLineSegment)));\n return intersecting;\n}\nconst getElementsCompletelyInFrame = (elements, frame, elementsMap) => omitGroupsContainingFrameLikes((0,_selection__WEBPACK_IMPORTED_MODULE_4__.getElementsWithinSelection)(elements, frame, elementsMap, false)).filter(element => !(0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) && !element.frameId || element.frameId === frame.id);\nconst isElementContainingFrame = (element, frame, elementsMap) => {\n return (0,_selection__WEBPACK_IMPORTED_MODULE_4__.getElementsWithinSelection)([frame], element, elementsMap).some(e => e.id === frame.id);\n};\nconst getElementsIntersectingFrame = (elements, frame) => {\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(elements);\n return elements.filter(element => isElementIntersectingFrame(element, frame, elementsMap));\n};\nconst elementsAreInFrameBounds = (elements, frame, elementsMap) => {\n const [frameX1, frameY1, frameX2, frameY2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getElementAbsoluteCoords)(frame, elementsMap);\n const [elementX1, elementY1, elementX2, elementY2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getCommonBounds)(elements);\n return frameX1 <= elementX1 && frameY1 <= elementY1 && frameX2 >= elementX2 && frameY2 >= elementY2;\n};\nconst elementOverlapsWithFrame = (element, frame, elementsMap) => {\n return elementsAreInFrameBounds([element], frame, elementsMap) || isElementIntersectingFrame(element, frame, elementsMap) || isElementContainingFrame(element, frame, elementsMap);\n};\nconst isCursorInFrame = (cursorCoords, frame, elementsMap) => {\n const [fx1, fy1, fx2, fy2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getElementAbsoluteCoords)(frame, elementsMap);\n return (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.isPointWithinBounds)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(fx1, fy1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(cursorCoords.x, cursorCoords.y), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(fx2, fy2));\n};\nconst groupsAreAtLeastIntersectingTheFrame = (elements, groupIds, frame) => {\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(elements);\n const elementsInGroup = groupIds.flatMap(groupId => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(elements, groupId));\n\n if (elementsInGroup.length === 0) {\n return true;\n }\n\n return !!elementsInGroup.find(element => elementsAreInFrameBounds([element], frame, elementsMap) || isElementIntersectingFrame(element, frame, elementsMap));\n};\nconst groupsAreCompletelyOutOfFrame = (elements, groupIds, frame) => {\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(elements);\n const elementsInGroup = groupIds.flatMap(groupId => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(elements, groupId));\n\n if (elementsInGroup.length === 0) {\n return true;\n }\n\n return elementsInGroup.find(element => elementsAreInFrameBounds([element], frame, elementsMap) || isElementIntersectingFrame(element, frame, elementsMap)) === undefined;\n}; // --------------------------- Frame Utils ------------------------------------\n\n/**\r\n * Returns a map of frameId to frame elements. Includes empty frames.\r\n */\n\nconst groupByFrameLikes = elements => {\n const frameElementsMap = new Map();\n\n for (const element of elements) {\n const frameId = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) ? element.id : element.frameId;\n\n if (frameId && !frameElementsMap.has(frameId)) {\n frameElementsMap.set(frameId, getFrameChildren(elements, frameId));\n }\n }\n\n return frameElementsMap;\n};\nconst getFrameChildren = (allElements, frameId) => {\n const frameChildren = [];\n\n for (const element of allElements.values()) {\n if (element.frameId === frameId) {\n frameChildren.push(element);\n }\n }\n\n return frameChildren;\n};\nconst getFrameLikeElements = allElements => {\n return allElements.filter(element => (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element));\n};\n/**\r\n * Returns ExcalidrawFrameElements and non-frame-children elements.\r\n *\r\n * Considers children as root elements if they point to a frame parent\r\n * non-existing in the elements set.\r\n *\r\n * Considers non-frame bound elements (container or arrow labels) as root.\r\n */\n\nconst getRootElements = allElements => {\n const frameElements = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(getFrameLikeElements(allElements));\n return allElements.filter(element => frameElements.has(element.id) || !element.frameId || !frameElements.has(element.frameId));\n};\nconst getElementsInResizingFrame = (allElements, frame, appState, elementsMap) => {\n const prevElementsInFrame = getFrameChildren(allElements, frame.id); //zsviczian: do not suggest adding new elements to marker frames while resizing\n\n if (frame.frameRole === \"marker\") {\n return prevElementsInFrame.filter(element => !((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element) && element.containerId));\n }\n\n const nextElementsInFrame = new Set(prevElementsInFrame);\n const elementsCompletelyInFrame = new Set([...getElementsCompletelyInFrame(allElements, frame, elementsMap), ...prevElementsInFrame.filter(element => isElementContainingFrame(element, frame, elementsMap))]);\n const elementsNotCompletelyInFrame = prevElementsInFrame.filter(element => !elementsCompletelyInFrame.has(element)); // for elements that are completely in the frame\n // if they are part of some groups, then those groups are still\n // considered to belong to the frame\n\n const groupsToKeep = new Set(Array.from(elementsCompletelyInFrame).flatMap(element => element.groupIds));\n\n for (const element of elementsNotCompletelyInFrame) {\n if (!isElementIntersectingFrame(element, frame, elementsMap)) {\n if (element.groupIds.length === 0) {\n nextElementsInFrame.delete(element);\n }\n } else if (element.groupIds.length > 0) {\n // group element intersects with the frame, we should keep the groups\n // that this element is part of\n for (const id of element.groupIds) {\n groupsToKeep.add(id);\n }\n }\n }\n\n for (const element of elementsNotCompletelyInFrame) {\n if (element.groupIds.length > 0) {\n let shouldRemoveElement = true;\n\n for (const id of element.groupIds) {\n if (groupsToKeep.has(id)) {\n shouldRemoveElement = false;\n }\n }\n\n if (shouldRemoveElement) {\n nextElementsInFrame.delete(element);\n }\n }\n }\n\n const individualElementsCompletelyInFrame = Array.from(elementsCompletelyInFrame).filter(element => element.groupIds.length === 0);\n\n for (const element of individualElementsCompletelyInFrame) {\n nextElementsInFrame.add(element);\n }\n\n const newGroupElementsCompletelyInFrame = Array.from(elementsCompletelyInFrame).filter(element => element.groupIds.length > 0);\n const groupIds = (0,_groups__WEBPACK_IMPORTED_MODULE_5__.selectGroupsFromGivenElements)(newGroupElementsCompletelyInFrame, appState); // new group elements\n\n for (const [id, isSelected] of Object.entries(groupIds)) {\n if (isSelected) {\n const elementsInGroup = (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElements, id);\n\n if (elementsAreInFrameBounds(elementsInGroup, frame, elementsMap)) {\n for (const element of elementsInGroup) {\n nextElementsInFrame.add(element);\n }\n }\n }\n }\n\n return [...nextElementsInFrame].filter(element => {\n return !((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element) && element.containerId);\n });\n};\nconst getElementsInNewFrame = (elements, frame, elementsMap) => {\n return omitPartialGroups(omitGroupsContainingFrameLikes(elements, getElementsCompletelyInFrame(elements, frame, elementsMap)), frame, elementsMap);\n};\nconst omitPartialGroups = (elements, frame, allElementsMap) => {\n const elementsToReturn = [];\n const checkedGroups = new Map();\n\n for (const element of elements) {\n let shouldOmit = false;\n\n if (element.groupIds.length > 0) {\n // if some partial group should be omitted, then all elements in that group should be omitted\n if (element.groupIds.some(gid => checkedGroups.get(gid))) {\n shouldOmit = true;\n } else {\n const allElementsInGroup = new Set(element.groupIds.flatMap(gid => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElementsMap, gid)));\n shouldOmit = !elementsAreInFrameBounds(Array.from(allElementsInGroup), frame, allElementsMap);\n }\n\n element.groupIds.forEach(gid => {\n checkedGroups.set(gid, shouldOmit);\n });\n }\n\n if (!shouldOmit) {\n elementsToReturn.push(element);\n }\n }\n\n return elementsToReturn;\n};\nconst getContainingFrame = (element, elementsMap) => {\n if (!element.frameId) {\n return null;\n }\n\n return elementsMap.get(element.frameId) || null;\n}; // --------------------------- Frame Operations -------------------------------\n\n/** */\n\nconst filterElementsEligibleAsFrameChildren = (elements, frame) => {\n //zsviczian: nothing is eligible for marker frames\n if (frame.frameRole === \"marker\") {\n return [];\n }\n\n const otherFrames = new Set();\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(elements);\n elements = omitGroupsContainingFrameLikes(elements);\n\n for (const element of elements) {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) && element.id !== frame.id) {\n otherFrames.add(element.id);\n }\n }\n\n const processedGroups = new Set();\n const eligibleElements = [];\n\n for (const element of elements) {\n // don't add frames or their children\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) || element.frameId && otherFrames.has(element.frameId)) {\n continue;\n }\n\n if (element.groupIds.length) {\n const shallowestGroupId = element.groupIds.at(-1);\n\n if (!processedGroups.has(shallowestGroupId)) {\n processedGroups.add(shallowestGroupId);\n const groupElements = (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(elements, shallowestGroupId);\n\n if (groupElements.some(el => elementOverlapsWithFrame(el, frame, elementsMap))) {\n for (const child of groupElements) {\n eligibleElements.push(child);\n }\n }\n }\n } else {\n const overlaps = elementOverlapsWithFrame(element, frame, elementsMap);\n\n if (overlaps) {\n eligibleElements.push(element);\n }\n }\n }\n\n return eligibleElements;\n};\n/**\r\n * Retains (or repairs for target frame) the ordering invriant where children\r\n * elements come right before the parent frame:\r\n * [el, el, child, child, frame, el]\r\n *\r\n * @returns mutated allElements (same data structure)\r\n */\n\nconst addElementsToFrame = (allElements, elementsToAdd, frame, appState) => {\n if (frame.frameRole === \"marker\") return allElements; //zsviczian\n\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(allElements);\n const currTargetFrameChildrenMap = new Map();\n\n for (const element of allElements.values()) {\n if (element.frameId === frame.id) {\n currTargetFrameChildrenMap.set(element.id, true);\n }\n }\n\n const suppliedElementsToAddSet = new Set(elementsToAdd.map(el => el.id));\n const finalElementsToAdd = [];\n const otherFrames = new Set();\n\n for (const element of elementsToAdd) {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) && element.id !== frame.id) {\n otherFrames.add(element.id);\n }\n } // - add bound text elements if not already in the array\n // - filter out elements that are already in the frame\n\n\n for (const element of omitGroupsContainingFrameLikes(allElements, elementsToAdd)) {\n // don't add frames or their children\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) || element.frameId && otherFrames.has(element.frameId)) {\n continue;\n } // if the element is already in another frame (which is also in elementsToAdd),\n // it means that frame and children are selected at the same time\n // => keep original frame membership, do not add to the target frame\n\n\n if (element.frameId && appState.selectedElementIds[element.id] && appState.selectedElementIds[element.frameId]) {\n continue;\n }\n\n if (!currTargetFrameChildrenMap.has(element.id)) {\n finalElementsToAdd.push(element);\n }\n\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_8__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement && !suppliedElementsToAddSet.has(boundTextElement.id) && !currTargetFrameChildrenMap.has(boundTextElement.id)) {\n finalElementsToAdd.push(boundTextElement);\n }\n }\n\n for (const element of finalElementsToAdd) {\n (0,_mutateElement__WEBPACK_IMPORTED_MODULE_7__.mutateElement)(element, elementsMap, {\n frameId: frame.id\n });\n }\n\n return allElements;\n};\nconst removeElementsFromFrame = (elementsToRemove, elementsMap) => {\n const _elementsToRemove = new Map();\n\n const toRemoveElementsByFrame = new Map();\n\n for (const element of elementsToRemove) {\n if (element.frameId) {\n _elementsToRemove.set(element.id, element);\n\n const arr = toRemoveElementsByFrame.get(element.frameId) || [];\n arr.push(element);\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_8__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement) {\n _elementsToRemove.set(boundTextElement.id, boundTextElement);\n\n arr.push(boundTextElement);\n }\n\n toRemoveElementsByFrame.set(element.frameId, arr);\n }\n }\n\n for (const [, element] of _elementsToRemove) {\n (0,_mutateElement__WEBPACK_IMPORTED_MODULE_7__.mutateElement)(element, elementsMap, {\n frameId: null\n });\n }\n};\nconst removeAllElementsFromFrame = (allElements, frame) => {\n const elementsInFrame = getFrameChildren(allElements, frame.id);\n removeElementsFromFrame(elementsInFrame, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(allElements));\n return allElements;\n};\nconst replaceAllElementsInFrame = (allElements, nextElementsInFrame, frame, app) => {\n return addElementsToFrame(removeAllElementsFromFrame(allElements, frame), nextElementsInFrame, frame, app.state).slice();\n};\n/** does not mutate elements, but returns new ones */\n\nconst updateFrameMembershipOfSelectedElements = (allElements, appState, app) => {\n const selectedElements = app.scene.getSelectedElements({\n selectedElementIds: appState.selectedElementIds,\n // supplying elements explicitly in case we're passed non-state elements\n elements: allElements\n });\n const elementsToFilter = new Set(selectedElements);\n\n if (appState.editingGroupId) {\n for (const element of selectedElements) {\n if (element.groupIds.length === 0) {\n elementsToFilter.add(element);\n } else {\n element.groupIds.flatMap(gid => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElements, gid)).forEach(element => elementsToFilter.add(element));\n }\n }\n }\n\n const elementsToRemove = new Set();\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(allElements);\n elementsToFilter.forEach(element => {\n if (element.frameId && !(0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) && !isElementInFrame(element, elementsMap, appState)) {\n elementsToRemove.add(element);\n }\n });\n\n if (elementsToRemove.size > 0) {\n removeElementsFromFrame(elementsToRemove, elementsMap);\n }\n\n return allElements;\n};\n/**\r\n * filters out elements that are inside groups that contain a frame element\r\n * anywhere in the group tree\r\n */\n\nconst omitGroupsContainingFrameLikes = (allElements,\n/** subset of elements you want to filter. Optional perf optimization so we\r\n * don't have to filter all elements unnecessarily\r\n */\nselectedElements) => {\n const uniqueGroupIds = new Set();\n const elements = selectedElements || allElements;\n\n for (const el of elements.values()) {\n const topMostGroupId = el.groupIds[el.groupIds.length - 1];\n\n if (topMostGroupId) {\n uniqueGroupIds.add(topMostGroupId);\n }\n }\n\n const rejectedGroupIds = new Set();\n\n for (const groupId of uniqueGroupIds) {\n if ((0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElements, groupId).some(el => (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(el))) {\n rejectedGroupIds.add(groupId);\n }\n }\n\n const ret = [];\n\n for (const element of elements.values()) {\n if (!rejectedGroupIds.has(element.groupIds[element.groupIds.length - 1])) {\n ret.push(element);\n }\n }\n\n return ret;\n};\n/**\r\n * depending on the appState, return target frame, which is the frame the given element\r\n * is going to be added to or remove from\r\n */\n\nconst getTargetFrame = (element, elementsMap, appState) => {\n const _element = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element) ? (0,_textElement__WEBPACK_IMPORTED_MODULE_8__.getContainerElement)(element, elementsMap) || element : element; // if the element and its containing frame are both selected, then\n // the containing frame is the target frame\n\n\n if (_element.frameId && appState.selectedElementIds[_element.id] && appState.selectedElementIds[_element.frameId]) {\n return getContainingFrame(_element, elementsMap);\n }\n\n return appState.selectedElementIds[_element.id] && appState.selectedElementsAreBeingDragged ? appState.frameToHighlight : getContainingFrame(_element, elementsMap);\n}; // TODO: this a huge bottleneck for large scenes, optimise\n// given an element, return if the element is in some frame\n\nconst isElementInFrame = (element, allElementsMap, appState, opts) => {\n var _a, _b;\n\n const frame = (_a = opts === null || opts === void 0 ? void 0 : opts.targetFrame) !== null && _a !== void 0 ? _a : getTargetFrame(element, allElementsMap, appState);\n\n if (!frame) {\n return false;\n }\n\n const _element = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element) ? (0,_textElement__WEBPACK_IMPORTED_MODULE_8__.getContainerElement)(element, allElementsMap) || element : element;\n\n const setGroupsInFrame = isInFrame => {\n if (opts === null || opts === void 0 ? void 0 : opts.checkedGroups) {\n _element.groupIds.forEach(groupId => {\n var _a;\n\n (_a = opts.checkedGroups) === null || _a === void 0 ? void 0 : _a.set(groupId, isInFrame);\n });\n }\n };\n\n if ( // if the element is not selected, or it is selected but not being dragged,\n // frame membership won't update, so return true\n !appState.selectedElementIds[_element.id] || !appState.selectedElementsAreBeingDragged || // if both frame and element are selected, won't update membership, so return true\n appState.selectedElementIds[_element.id] && appState.selectedElementIds[frame.id]) {\n return true;\n }\n\n if (_element.groupIds.length === 0) {\n return elementOverlapsWithFrame(_element, frame, allElementsMap);\n }\n\n for (const gid of _element.groupIds) {\n if ((_b = opts === null || opts === void 0 ? void 0 : opts.checkedGroups) === null || _b === void 0 ? void 0 : _b.has(gid)) {\n return opts.checkedGroups.get(gid);\n }\n }\n\n const allElementsInGroup = new Set(_element.groupIds.filter(gid => {\n if (opts === null || opts === void 0 ? void 0 : opts.checkedGroups) {\n return !opts.checkedGroups.has(gid);\n }\n\n return true;\n }).flatMap(gid => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElementsMap, gid)));\n\n if (appState.editingGroupId && appState.selectedElementsAreBeingDragged) {\n const selectedElements = new Set((0,_selection__WEBPACK_IMPORTED_MODULE_4__.getSelectedElements)(allElementsMap, appState));\n const editingGroupOverlapsFrame = appState.frameToHighlight !== null;\n\n if (editingGroupOverlapsFrame) {\n return true;\n }\n\n selectedElements.forEach(selectedElement => {\n allElementsInGroup.delete(selectedElement);\n });\n }\n\n for (const elementInGroup of allElementsInGroup) {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(elementInGroup)) {\n setGroupsInFrame(false);\n return false;\n }\n }\n\n for (const elementInGroup of allElementsInGroup) {\n if (elementOverlapsWithFrame(elementInGroup, frame, allElementsMap)) {\n setGroupsInFrame(true);\n return true;\n }\n }\n\n return false;\n};\nconst shouldApplyFrameClip = (element, frame, appState, elementsMap, checkedGroups) => {\n if (!appState.frameRendering || !appState.frameRendering.clip) {\n return false;\n } // for individual elements, only clip when the element is\n // a. overlapping with the frame, or\n // b. containing the frame, for example when an element is used as a background\n // and is therefore bigger than the frame and completely contains the frame\n\n\n const shouldClipElementItself = isElementIntersectingFrame(element, frame, elementsMap) || isElementContainingFrame(element, frame, elementsMap);\n\n if (shouldClipElementItself) {\n for (const groupId of element.groupIds) {\n checkedGroups === null || checkedGroups === void 0 ? void 0 : checkedGroups.set(groupId, true);\n }\n\n return true;\n } // if an element is outside the frame, but is part of a group that has some elements\n // \"in\" the frame, we should clip the element\n\n\n if (!shouldClipElementItself && element.groupIds.length > 0 && !elementsAreInFrameBounds([element], frame, elementsMap)) {\n let shouldClip = false; // if no elements are being dragged, we can skip the geometry check\n // because we know if the element is in the given frame or not\n\n if (!appState.selectedElementsAreBeingDragged) {\n shouldClip = element.frameId === frame.id;\n\n for (const groupId of element.groupIds) {\n checkedGroups === null || checkedGroups === void 0 ? void 0 : checkedGroups.set(groupId, shouldClip);\n }\n } else {\n shouldClip = isElementInFrame(element, elementsMap, appState, {\n targetFrame: frame,\n checkedGroups\n });\n }\n\n for (const groupId of element.groupIds) {\n checkedGroups === null || checkedGroups === void 0 ? void 0 : checkedGroups.set(groupId, shouldClip);\n }\n\n return shouldClip;\n }\n\n return false;\n};\nconst DEFAULT_FRAME_NAME = \"Frame\";\nconst DEFAULT_AI_FRAME_NAME = \"AI Frame\";\nconst getDefaultFrameName = element => {\n // TODO name frames \"AI\" only if specific to AI frames\n return (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameElement)(element) ? DEFAULT_FRAME_NAME : DEFAULT_AI_FRAME_NAME;\n};\nconst getFrameLikeTitle = element => {\n return element.name === null ? getDefaultFrameName(element) : element.name;\n};\nconst getElementsOverlappingFrame = (elements, frame) => {\n return (0,_excalidraw_utils_withinBounds__WEBPACK_IMPORTED_MODULE_3__.elementsOverlappingBBox)({\n elements,\n bounds: frame,\n type: \"overlap\"\n }) // removes elements who are overlapping, but are in a different frame,\n // and thus invisible in target frame\n .filter(el => !el.frameId || el.frameId === frame.id);\n};\nconst frameAndChildrenSelectedTogether = selectedElements => {\n const selectedElementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(selectedElements);\n return selectedElements.length > 1 && selectedElements.some(element => element.frameId && selectedElementsMap.has(element.frameId));\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/frame.ts?");
|
|
13325
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addElementsToFrame: () => (/* binding */ addElementsToFrame),\n/* harmony export */ bindElementsToFramesAfterDuplication: () => (/* binding */ bindElementsToFramesAfterDuplication),\n/* harmony export */ elementOverlapsWithFrame: () => (/* binding */ elementOverlapsWithFrame),\n/* harmony export */ elementsAreInFrameBounds: () => (/* binding */ elementsAreInFrameBounds),\n/* harmony export */ filterElementsEligibleAsFrameChildren: () => (/* binding */ filterElementsEligibleAsFrameChildren),\n/* harmony export */ frameAndChildrenSelectedTogether: () => (/* binding */ frameAndChildrenSelectedTogether),\n/* harmony export */ getContainingFrame: () => (/* binding */ getContainingFrame),\n/* harmony export */ getDefaultFrameName: () => (/* binding */ getDefaultFrameName),\n/* harmony export */ getElementsCompletelyInFrame: () => (/* binding */ getElementsCompletelyInFrame),\n/* harmony export */ getElementsInNewFrame: () => (/* binding */ getElementsInNewFrame),\n/* harmony export */ getElementsInResizingFrame: () => (/* binding */ getElementsInResizingFrame),\n/* harmony export */ getElementsIntersectingFrame: () => (/* binding */ getElementsIntersectingFrame),\n/* harmony export */ getElementsOverlappingFrame: () => (/* binding */ getElementsOverlappingFrame),\n/* harmony export */ getFrameChildren: () => (/* binding */ getFrameChildren),\n/* harmony export */ getFrameLikeElements: () => (/* binding */ getFrameLikeElements),\n/* harmony export */ getFrameLikeTitle: () => (/* binding */ getFrameLikeTitle),\n/* harmony export */ getRootElements: () => (/* binding */ getRootElements),\n/* harmony export */ getTargetFrame: () => (/* binding */ getTargetFrame),\n/* harmony export */ groupByFrameLikes: () => (/* binding */ groupByFrameLikes),\n/* harmony export */ groupsAreAtLeastIntersectingTheFrame: () => (/* binding */ groupsAreAtLeastIntersectingTheFrame),\n/* harmony export */ groupsAreCompletelyOutOfFrame: () => (/* binding */ groupsAreCompletelyOutOfFrame),\n/* harmony export */ isCursorInFrame: () => (/* binding */ isCursorInFrame),\n/* harmony export */ isElementContainingFrame: () => (/* binding */ isElementContainingFrame),\n/* harmony export */ isElementInFrame: () => (/* binding */ isElementInFrame),\n/* harmony export */ isElementIntersectingFrame: () => (/* binding */ isElementIntersectingFrame),\n/* harmony export */ omitGroupsContainingFrameLikes: () => (/* binding */ omitGroupsContainingFrameLikes),\n/* harmony export */ omitPartialGroups: () => (/* binding */ omitPartialGroups),\n/* harmony export */ removeAllElementsFromFrame: () => (/* binding */ removeAllElementsFromFrame),\n/* harmony export */ removeElementsFromFrame: () => (/* binding */ removeElementsFromFrame),\n/* harmony export */ replaceAllElementsInFrame: () => (/* binding */ replaceAllElementsInFrame),\n/* harmony export */ shouldApplyFrameClip: () => (/* binding */ shouldApplyFrameClip),\n/* harmony export */ updateFrameMembershipOfSelectedElements: () => (/* binding */ updateFrameMembershipOfSelectedElements)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var _excalidraw_utils_bbox__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/utils/bbox */ \"../utils/src/bbox.ts\");\n/* harmony import */ var _excalidraw_utils_withinBounds__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/utils/withinBounds */ \"../utils/src/withinBounds.ts\");\n/* harmony import */ var _selection__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./selection */ \"../element/src/selection.ts\");\n/* harmony import */ var _groups__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./groups */ \"../element/src/groups.ts\");\n/* harmony import */ var _bounds__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _mutateElement__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./mutateElement */ \"../element/src/mutateElement.ts\");\n/* harmony import */ var _textElement__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _typeChecks__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./typeChecks */ \"../element/src/typeChecks.ts\");\n\n\n\n\n\n\n\n\n\n // --------------------------- Frame State ------------------------------------\n\nconst bindElementsToFramesAfterDuplication = (nextElements, origElements, origIdToDuplicateId) => {\n const nextElementMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(nextElements);\n\n for (const element of origElements) {\n if (element.frameId) {\n // use its frameId to get the new frameId\n const nextElementId = origIdToDuplicateId.get(element.id);\n const nextFrameId = origIdToDuplicateId.get(element.frameId);\n const nextElement = nextElementId && nextElementMap.get(nextElementId);\n\n if (nextElement) {\n (0,_mutateElement__WEBPACK_IMPORTED_MODULE_7__.mutateElement)(nextElement, nextElementMap, {\n frameId: nextFrameId !== null && nextFrameId !== void 0 ? nextFrameId : null\n });\n }\n }\n }\n};\nfunction isElementIntersectingFrame(element, frame, elementsMap) {\n const frameLineSegments = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getElementLineSegments)(frame, elementsMap);\n const elementLineSegments = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getElementLineSegments)(element, elementsMap);\n const intersecting = frameLineSegments.some(frameLineSegment => elementLineSegments.some(elementLineSegment => (0,_excalidraw_utils_bbox__WEBPACK_IMPORTED_MODULE_2__.doLineSegmentsIntersect)(frameLineSegment, elementLineSegment)));\n return intersecting;\n}\nconst getElementsCompletelyInFrame = (elements, frame, elementsMap) => omitGroupsContainingFrameLikes((0,_selection__WEBPACK_IMPORTED_MODULE_4__.getElementsWithinSelection)(elements, frame, elementsMap, false)).filter(element => !(0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) && !element.frameId || element.frameId === frame.id);\nconst isElementContainingFrame = (element, frame, elementsMap) => {\n return (0,_selection__WEBPACK_IMPORTED_MODULE_4__.getElementsWithinSelection)([frame], element, elementsMap).some(e => e.id === frame.id);\n};\nconst getElementsIntersectingFrame = (elements, frame) => {\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(elements);\n return elements.filter(element => isElementIntersectingFrame(element, frame, elementsMap));\n};\nconst elementsAreInFrameBounds = (elements, frame, elementsMap) => {\n const [frameX1, frameY1, frameX2, frameY2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getElementAbsoluteCoords)(frame, elementsMap);\n const [elementX1, elementY1, elementX2, elementY2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getCommonBounds)(elements);\n return frameX1 <= elementX1 && frameY1 <= elementY1 && frameX2 >= elementX2 && frameY2 >= elementY2;\n};\nconst elementOverlapsWithFrame = (element, frame, elementsMap) => {\n return elementsAreInFrameBounds([element], frame, elementsMap) || isElementIntersectingFrame(element, frame, elementsMap) || isElementContainingFrame(element, frame, elementsMap);\n};\nconst isCursorInFrame = (cursorCoords, frame, elementsMap) => {\n const [fx1, fy1, fx2, fy2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_6__.getElementAbsoluteCoords)(frame, elementsMap);\n return (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.isPointWithinBounds)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(fx1, fy1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(cursorCoords.x, cursorCoords.y), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(fx2, fy2));\n};\nconst groupsAreAtLeastIntersectingTheFrame = (elements, groupIds, frame) => {\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(elements);\n const elementsInGroup = groupIds.flatMap(groupId => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(elements, groupId));\n\n if (elementsInGroup.length === 0) {\n return true;\n }\n\n return !!elementsInGroup.find(element => elementsAreInFrameBounds([element], frame, elementsMap) || isElementIntersectingFrame(element, frame, elementsMap));\n};\nconst groupsAreCompletelyOutOfFrame = (elements, groupIds, frame) => {\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(elements);\n const elementsInGroup = groupIds.flatMap(groupId => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(elements, groupId));\n\n if (elementsInGroup.length === 0) {\n return true;\n }\n\n return elementsInGroup.find(element => elementsAreInFrameBounds([element], frame, elementsMap) || isElementIntersectingFrame(element, frame, elementsMap)) === undefined;\n}; // --------------------------- Frame Utils ------------------------------------\n\n/**\r\n * Returns a map of frameId to frame elements. Includes empty frames.\r\n */\n\nconst groupByFrameLikes = elements => {\n const frameElementsMap = new Map();\n\n for (const element of elements) {\n const frameId = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) ? element.id : element.frameId;\n\n if (frameId && !frameElementsMap.has(frameId)) {\n frameElementsMap.set(frameId, getFrameChildren(elements, frameId));\n }\n }\n\n return frameElementsMap;\n};\nconst getFrameChildren = (allElements, frameId) => {\n const frameChildren = [];\n\n for (const element of allElements.values()) {\n if (element.frameId === frameId) {\n frameChildren.push(element);\n }\n }\n\n return frameChildren;\n};\nconst getFrameLikeElements = allElements => {\n return allElements.filter(element => (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element));\n};\n/**\r\n * Returns ExcalidrawFrameElements and non-frame-children elements.\r\n *\r\n * Considers children as root elements if they point to a frame parent\r\n * non-existing in the elements set.\r\n *\r\n * Considers non-frame bound elements (container or arrow labels) as root.\r\n */\n\nconst getRootElements = allElements => {\n const frameElements = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(getFrameLikeElements(allElements));\n return allElements.filter(element => frameElements.has(element.id) || !element.frameId || !frameElements.has(element.frameId));\n};\nconst getElementsInResizingFrame = (allElements, frame, appState, elementsMap) => {\n const prevElementsInFrame = getFrameChildren(allElements, frame.id); //zsviczian: do not suggest adding new elements to marker frames while resizing\n\n if (frame.frameRole === \"marker\") {\n return prevElementsInFrame.filter(element => !((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element) && element.containerId));\n }\n\n const nextElementsInFrame = new Set(prevElementsInFrame);\n const elementsCompletelyInFrame = new Set([...getElementsCompletelyInFrame(allElements, frame, elementsMap), ...prevElementsInFrame.filter(element => isElementContainingFrame(element, frame, elementsMap))]);\n const elementsNotCompletelyInFrame = prevElementsInFrame.filter(element => !elementsCompletelyInFrame.has(element)); // for elements that are completely in the frame\n // if they are part of some groups, then those groups are still\n // considered to belong to the frame\n\n const groupsToKeep = new Set(Array.from(elementsCompletelyInFrame).flatMap(element => element.groupIds));\n\n for (const element of elementsNotCompletelyInFrame) {\n if (!isElementIntersectingFrame(element, frame, elementsMap)) {\n if (element.groupIds.length === 0) {\n nextElementsInFrame.delete(element);\n }\n } else if (element.groupIds.length > 0) {\n // group element intersects with the frame, we should keep the groups\n // that this element is part of\n for (const id of element.groupIds) {\n groupsToKeep.add(id);\n }\n }\n }\n\n for (const element of elementsNotCompletelyInFrame) {\n if (element.groupIds.length > 0) {\n let shouldRemoveElement = true;\n\n for (const id of element.groupIds) {\n if (groupsToKeep.has(id)) {\n shouldRemoveElement = false;\n }\n }\n\n if (shouldRemoveElement) {\n nextElementsInFrame.delete(element);\n }\n }\n }\n\n const individualElementsCompletelyInFrame = Array.from(elementsCompletelyInFrame).filter(element => element.groupIds.length === 0);\n\n for (const element of individualElementsCompletelyInFrame) {\n nextElementsInFrame.add(element);\n }\n\n const newGroupElementsCompletelyInFrame = Array.from(elementsCompletelyInFrame).filter(element => element.groupIds.length > 0);\n const groupIds = (0,_groups__WEBPACK_IMPORTED_MODULE_5__.selectGroupsFromGivenElements)(newGroupElementsCompletelyInFrame, appState); // new group elements\n\n for (const [id, isSelected] of Object.entries(groupIds)) {\n if (isSelected) {\n const elementsInGroup = (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElements, id);\n\n if (elementsAreInFrameBounds(elementsInGroup, frame, elementsMap)) {\n for (const element of elementsInGroup) {\n nextElementsInFrame.add(element);\n }\n }\n }\n }\n\n return [...nextElementsInFrame].filter(element => {\n return !((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element) && element.containerId);\n });\n};\nconst getElementsInNewFrame = (elements, frame, elementsMap) => {\n return omitPartialGroups(omitGroupsContainingFrameLikes(elements, getElementsCompletelyInFrame(elements, frame, elementsMap)), frame, elementsMap);\n};\nconst omitPartialGroups = (elements, frame, allElementsMap) => {\n const elementsToReturn = [];\n const checkedGroups = new Map();\n\n for (const element of elements) {\n let shouldOmit = false;\n\n if (element.groupIds.length > 0) {\n // if some partial group should be omitted, then all elements in that group should be omitted\n if (element.groupIds.some(gid => checkedGroups.get(gid))) {\n shouldOmit = true;\n } else {\n const allElementsInGroup = new Set(element.groupIds.flatMap(gid => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElementsMap, gid)));\n shouldOmit = !elementsAreInFrameBounds(Array.from(allElementsInGroup), frame, allElementsMap);\n }\n\n element.groupIds.forEach(gid => {\n checkedGroups.set(gid, shouldOmit);\n });\n }\n\n if (!shouldOmit) {\n elementsToReturn.push(element);\n }\n }\n\n return elementsToReturn;\n};\nconst getContainingFrame = (element, elementsMap) => {\n if (!element.frameId) {\n return null;\n }\n\n return elementsMap.get(element.frameId) || null;\n}; // --------------------------- Frame Operations -------------------------------\n\n/** */\n\nconst filterElementsEligibleAsFrameChildren = (elements, frame) => {\n //zsviczian: nothing is eligible for marker frames\n if (frame.frameRole === \"marker\") {\n return [];\n }\n\n const otherFrames = new Set();\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(elements);\n elements = omitGroupsContainingFrameLikes(elements);\n\n for (const element of elements) {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) && element.id !== frame.id) {\n otherFrames.add(element.id);\n }\n }\n\n const processedGroups = new Set();\n const eligibleElements = [];\n\n for (const element of elements) {\n // don't add frames or their children\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) || element.frameId && otherFrames.has(element.frameId)) {\n continue;\n }\n\n if (element.groupIds.length) {\n const shallowestGroupId = element.groupIds.at(-1);\n\n if (!processedGroups.has(shallowestGroupId)) {\n processedGroups.add(shallowestGroupId);\n const groupElements = (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(elements, shallowestGroupId);\n\n if (groupElements.some(el => elementOverlapsWithFrame(el, frame, elementsMap))) {\n for (const child of groupElements) {\n eligibleElements.push(child);\n }\n }\n }\n } else {\n const overlaps = elementOverlapsWithFrame(element, frame, elementsMap);\n\n if (overlaps) {\n eligibleElements.push(element);\n }\n }\n }\n\n return eligibleElements;\n};\n/**\r\n * Retains (or repairs for target frame) the ordering invriant where children\r\n * elements come right before the parent frame:\r\n * [el, el, child, child, frame, el]\r\n *\r\n * @returns mutated allElements (same data structure)\r\n */\n\nconst addElementsToFrame = (allElements, elementsToAdd, frame, appState) => {\n if (frame.frameRole === \"marker\") {\n return allElements;\n } //zsviczian\n\n\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(allElements);\n const currTargetFrameChildrenMap = new Map();\n\n for (const element of allElements.values()) {\n if (element.frameId === frame.id) {\n currTargetFrameChildrenMap.set(element.id, true);\n }\n }\n\n const suppliedElementsToAddSet = new Set(elementsToAdd.map(el => el.id));\n const finalElementsToAdd = [];\n const otherFrames = new Set();\n\n for (const element of elementsToAdd) {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) && element.id !== frame.id) {\n otherFrames.add(element.id);\n }\n } // - add bound text elements if not already in the array\n // - filter out elements that are already in the frame\n\n\n for (const element of omitGroupsContainingFrameLikes(allElements, elementsToAdd)) {\n // don't add frames or their children\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) || element.frameId && otherFrames.has(element.frameId)) {\n continue;\n } // if the element is already in another frame (which is also in elementsToAdd),\n // it means that frame and children are selected at the same time\n // => keep original frame membership, do not add to the target frame\n\n\n if (element.frameId && appState.selectedElementIds[element.id] && appState.selectedElementIds[element.frameId]) {\n continue;\n }\n\n if (!currTargetFrameChildrenMap.has(element.id)) {\n finalElementsToAdd.push(element);\n }\n\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_8__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement && !suppliedElementsToAddSet.has(boundTextElement.id) && !currTargetFrameChildrenMap.has(boundTextElement.id)) {\n finalElementsToAdd.push(boundTextElement);\n }\n }\n\n for (const element of finalElementsToAdd) {\n (0,_mutateElement__WEBPACK_IMPORTED_MODULE_7__.mutateElement)(element, elementsMap, {\n frameId: frame.id\n });\n }\n\n return allElements;\n};\nconst removeElementsFromFrame = (elementsToRemove, elementsMap) => {\n const _elementsToRemove = new Map();\n\n const toRemoveElementsByFrame = new Map();\n\n for (const element of elementsToRemove) {\n if (element.frameId) {\n _elementsToRemove.set(element.id, element);\n\n const arr = toRemoveElementsByFrame.get(element.frameId) || [];\n arr.push(element);\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_8__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement) {\n _elementsToRemove.set(boundTextElement.id, boundTextElement);\n\n arr.push(boundTextElement);\n }\n\n toRemoveElementsByFrame.set(element.frameId, arr);\n }\n }\n\n for (const [, element] of _elementsToRemove) {\n (0,_mutateElement__WEBPACK_IMPORTED_MODULE_7__.mutateElement)(element, elementsMap, {\n frameId: null\n });\n }\n};\nconst removeAllElementsFromFrame = (allElements, frame) => {\n const elementsInFrame = getFrameChildren(allElements, frame.id);\n removeElementsFromFrame(elementsInFrame, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(allElements));\n return allElements;\n};\nconst replaceAllElementsInFrame = (allElements, nextElementsInFrame, frame, app) => {\n return addElementsToFrame(removeAllElementsFromFrame(allElements, frame), nextElementsInFrame, frame, app.state).slice();\n};\n/** does not mutate elements, but returns new ones */\n\nconst updateFrameMembershipOfSelectedElements = (allElements, appState, app) => {\n const selectedElements = app.scene.getSelectedElements({\n selectedElementIds: appState.selectedElementIds,\n // supplying elements explicitly in case we're passed non-state elements\n elements: allElements\n });\n const elementsToFilter = new Set(selectedElements);\n\n if (appState.editingGroupId) {\n for (const element of selectedElements) {\n if (element.groupIds.length === 0) {\n elementsToFilter.add(element);\n } else {\n element.groupIds.flatMap(gid => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElements, gid)).forEach(element => elementsToFilter.add(element));\n }\n }\n }\n\n const elementsToRemove = new Set();\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(allElements);\n elementsToFilter.forEach(element => {\n if (element.frameId && !(0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) && !isElementInFrame(element, elementsMap, appState)) {\n elementsToRemove.add(element);\n }\n });\n\n if (elementsToRemove.size > 0) {\n removeElementsFromFrame(elementsToRemove, elementsMap);\n }\n\n return allElements;\n};\n/**\r\n * filters out elements that are inside groups that contain a frame element\r\n * anywhere in the group tree\r\n */\n\nconst omitGroupsContainingFrameLikes = (allElements,\n/** subset of elements you want to filter. Optional perf optimization so we\r\n * don't have to filter all elements unnecessarily\r\n */\nselectedElements) => {\n const uniqueGroupIds = new Set();\n const elements = selectedElements || allElements;\n\n for (const el of elements.values()) {\n const topMostGroupId = el.groupIds[el.groupIds.length - 1];\n\n if (topMostGroupId) {\n uniqueGroupIds.add(topMostGroupId);\n }\n }\n\n const rejectedGroupIds = new Set();\n\n for (const groupId of uniqueGroupIds) {\n if ((0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElements, groupId).some(el => (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(el))) {\n rejectedGroupIds.add(groupId);\n }\n }\n\n const ret = [];\n\n for (const element of elements.values()) {\n if (!rejectedGroupIds.has(element.groupIds[element.groupIds.length - 1])) {\n ret.push(element);\n }\n }\n\n return ret;\n};\n/**\r\n * depending on the appState, return target frame, which is the frame the given element\r\n * is going to be added to or remove from\r\n */\n\nconst getTargetFrame = (element, elementsMap, appState) => {\n const _element = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element) ? (0,_textElement__WEBPACK_IMPORTED_MODULE_8__.getContainerElement)(element, elementsMap) || element : element; // if the element and its containing frame are both selected, then\n // the containing frame is the target frame\n\n\n if (_element.frameId && appState.selectedElementIds[_element.id] && appState.selectedElementIds[_element.frameId]) {\n return getContainingFrame(_element, elementsMap);\n }\n\n return appState.selectedElementIds[_element.id] && appState.selectedElementsAreBeingDragged ? appState.frameToHighlight : getContainingFrame(_element, elementsMap);\n}; // TODO: this a huge bottleneck for large scenes, optimise\n// given an element, return if the element is in some frame\n\nconst isElementInFrame = (element, allElementsMap, appState, opts) => {\n var _a, _b;\n\n const frame = (_a = opts === null || opts === void 0 ? void 0 : opts.targetFrame) !== null && _a !== void 0 ? _a : getTargetFrame(element, allElementsMap, appState);\n\n if (!frame) {\n return false;\n }\n\n const _element = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element) ? (0,_textElement__WEBPACK_IMPORTED_MODULE_8__.getContainerElement)(element, allElementsMap) || element : element;\n\n const setGroupsInFrame = isInFrame => {\n if (opts === null || opts === void 0 ? void 0 : opts.checkedGroups) {\n _element.groupIds.forEach(groupId => {\n var _a;\n\n (_a = opts.checkedGroups) === null || _a === void 0 ? void 0 : _a.set(groupId, isInFrame);\n });\n }\n };\n\n if ( // if the element is not selected, or it is selected but not being dragged,\n // frame membership won't update, so return true\n !appState.selectedElementIds[_element.id] || !appState.selectedElementsAreBeingDragged || // if both frame and element are selected, won't update membership, so return true\n appState.selectedElementIds[_element.id] && appState.selectedElementIds[frame.id]) {\n return true;\n }\n\n if (_element.groupIds.length === 0) {\n return elementOverlapsWithFrame(_element, frame, allElementsMap);\n }\n\n for (const gid of _element.groupIds) {\n if ((_b = opts === null || opts === void 0 ? void 0 : opts.checkedGroups) === null || _b === void 0 ? void 0 : _b.has(gid)) {\n return opts.checkedGroups.get(gid);\n }\n }\n\n const allElementsInGroup = new Set(_element.groupIds.filter(gid => {\n if (opts === null || opts === void 0 ? void 0 : opts.checkedGroups) {\n return !opts.checkedGroups.has(gid);\n }\n\n return true;\n }).flatMap(gid => (0,_groups__WEBPACK_IMPORTED_MODULE_5__.getElementsInGroup)(allElementsMap, gid)));\n\n if (appState.editingGroupId && appState.selectedElementsAreBeingDragged) {\n const selectedElements = new Set((0,_selection__WEBPACK_IMPORTED_MODULE_4__.getSelectedElements)(allElementsMap, appState));\n const editingGroupOverlapsFrame = appState.frameToHighlight !== null;\n\n if (editingGroupOverlapsFrame) {\n return true;\n }\n\n selectedElements.forEach(selectedElement => {\n allElementsInGroup.delete(selectedElement);\n });\n }\n\n for (const elementInGroup of allElementsInGroup) {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(elementInGroup)) {\n setGroupsInFrame(false);\n return false;\n }\n }\n\n for (const elementInGroup of allElementsInGroup) {\n if (elementOverlapsWithFrame(elementInGroup, frame, allElementsMap)) {\n setGroupsInFrame(true);\n return true;\n }\n }\n\n return false;\n};\nconst shouldApplyFrameClip = (element, frame, appState, elementsMap, checkedGroups) => {\n if (!appState.frameRendering || !appState.frameRendering.clip) {\n return false;\n } // for individual elements, only clip when the element is\n // a. overlapping with the frame, or\n // b. containing the frame, for example when an element is used as a background\n // and is therefore bigger than the frame and completely contains the frame\n\n\n const shouldClipElementItself = isElementIntersectingFrame(element, frame, elementsMap) || isElementContainingFrame(element, frame, elementsMap);\n\n if (shouldClipElementItself) {\n for (const groupId of element.groupIds) {\n checkedGroups === null || checkedGroups === void 0 ? void 0 : checkedGroups.set(groupId, true);\n }\n\n return true;\n } // if an element is outside the frame, but is part of a group that has some elements\n // \"in\" the frame, we should clip the element\n\n\n if (!shouldClipElementItself && element.groupIds.length > 0 && !elementsAreInFrameBounds([element], frame, elementsMap)) {\n let shouldClip = false; // if no elements are being dragged, we can skip the geometry check\n // because we know if the element is in the given frame or not\n\n if (!appState.selectedElementsAreBeingDragged) {\n shouldClip = element.frameId === frame.id;\n\n for (const groupId of element.groupIds) {\n checkedGroups === null || checkedGroups === void 0 ? void 0 : checkedGroups.set(groupId, shouldClip);\n }\n } else {\n shouldClip = isElementInFrame(element, elementsMap, appState, {\n targetFrame: frame,\n checkedGroups\n });\n }\n\n for (const groupId of element.groupIds) {\n checkedGroups === null || checkedGroups === void 0 ? void 0 : checkedGroups.set(groupId, shouldClip);\n }\n\n return shouldClip;\n }\n\n return false;\n};\nconst DEFAULT_FRAME_NAME = \"Frame\";\nconst DEFAULT_AI_FRAME_NAME = \"AI Frame\";\nconst getDefaultFrameName = element => {\n // TODO name frames \"AI\" only if specific to AI frames\n return (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameElement)(element) ? DEFAULT_FRAME_NAME : DEFAULT_AI_FRAME_NAME;\n};\nconst getFrameLikeTitle = element => {\n return element.name === null ? getDefaultFrameName(element) : element.name;\n};\nconst getElementsOverlappingFrame = (elements, frame) => {\n return (0,_excalidraw_utils_withinBounds__WEBPACK_IMPORTED_MODULE_3__.elementsOverlappingBBox)({\n elements,\n bounds: frame,\n type: \"overlap\"\n }) // removes elements who are overlapping, but are in a different frame,\n // and thus invisible in target frame\n .filter(el => !el.frameId || el.frameId === frame.id);\n};\nconst frameAndChildrenSelectedTogether = selectedElements => {\n const selectedElementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(selectedElements);\n return selectedElements.length > 1 && selectedElements.some(element => element.frameId && selectedElementsMap.has(element.frameId));\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/frame.ts?");
|
|
13326
13326
|
|
|
13327
13327
|
/***/ }),
|
|
13328
13328
|
|
|
@@ -13421,7 +13421,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
13421
13421
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13422
13422
|
|
|
13423
13423
|
"use strict";
|
|
13424
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_LINK_SIZE: () => (/* binding */ DEFAULT_LINK_SIZE),\n/* harmony export */ IMAGE_INVERT_FILTER: () => (/* binding */ IMAGE_INVERT_FILTER),\n/* harmony export */ elementWithCanvasCache: () => (/* binding */ elementWithCanvasCache),\n/* harmony export */ generateFreeDrawShape: () => (/* binding */ generateFreeDrawShape),\n/* harmony export */ getFreeDrawPath2D: () => (/* binding */ getFreeDrawPath2D),\n/* harmony export */ getFreeDrawSvgPath: () => (/* binding */ getFreeDrawSvgPath),\n/* harmony export */ getFreedrawOutlineAsSegments: () => (/* binding */ getFreedrawOutlineAsSegments),\n/* harmony export */ getFreedrawOutlinePoints: () => (/* binding */ getFreedrawOutlinePoints),\n/* harmony export */ getRenderOpacity: () => (/* binding */ getRenderOpacity),\n/* harmony export */ pathsCache: () => (/* binding */ pathsCache),\n/* harmony export */ renderElement: () => (/* binding */ renderElement),\n/* harmony export */ renderSelectionElement: () => (/* binding */ renderSelectionElement)\n/* harmony export */ });\n/* harmony import */ var roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! roughjs/bin/rough */ \"../../node_modules/roughjs/bin/rough.js\");\n/* harmony import */ var perfect_freehand__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! perfect-freehand */ \"../../node_modules/perfect-freehand/dist/esm/index.js\");\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _bounds__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _cropElement__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./cropElement */ \"../element/src/cropElement.ts\");\n/* harmony import */ var _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./linearElementEditor */ \"../element/src/linearElementEditor.ts\");\n/* harmony import */ var _textElement__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _textMeasurements__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./textMeasurements */ \"../element/src/textMeasurements.ts\");\n/* harmony import */ var _typeChecks__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @excalidraw/element/typeChecks */ \"../element/src/typeChecks.ts\");\n/* harmony import */ var _frame__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./frame */ \"../element/src/frame.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils */ \"../element/src/utils.ts\");\n/* harmony import */ var _shape__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./shape */ \"../element/src/shape.ts\");\n/* harmony import */ var _easingFunctions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./easingFunctions */ \"../element/src/easingFunctions.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n // using a stronger invert (100% vs our regular 93%) and saturate\n// as a temp hack to make images in dark theme look closer to original\n// color scheme (it's still not quite there and the colors look slightly\n// desatured, alas...)\n\nconst IMAGE_INVERT_FILTER = \"invert(100%) hue-rotate(180deg) saturate(1.25)\";\n\nconst isPendingImageElement = (element, renderConfig) => (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isInitializedImageElement)(element) && !renderConfig.imageCache.has(element.fileId);\n\nconst shouldResetImageFilter = (element, renderConfig, appState) => {\n var _a;\n\n return appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.THEME.DARK && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isInitializedImageElement)(element) && !isPendingImageElement(element, renderConfig) && ((_a = renderConfig.imageCache.get(element.fileId)) === null || _a === void 0 ? void 0 : _a.mimeType) !== _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.MIME_TYPES.svg;\n};\n\nconst getCanvasPadding = element => {\n switch (element.type) {\n case \"freedraw\":\n return element.strokeWidth * 12;\n\n case \"text\":\n return element.fontSize / 2;\n\n case \"arrow\":\n if (element.endArrowhead || element.endArrowhead) {\n return 40;\n }\n\n return 20;\n\n default:\n return 20;\n }\n};\n\nconst getRenderOpacity = (element, containingFrame, elementsPendingErasure, pendingNodes, globalAlpha = 1) => {\n var _a; // multiplying frame opacity with element opacity to combine them\n // (e.g. frame 50% and element 50% opacity should result in 25% opacity)\n\n\n let opacity = ((_a = containingFrame === null || containingFrame === void 0 ? void 0 : containingFrame.opacity) !== null && _a !== void 0 ? _a : 100) * element.opacity / 10000 * globalAlpha; // if pending erasure, multiply again to combine further\n // (so that erasing always results in lower opacity than original)\n\n if (elementsPendingErasure.has(element.id) || pendingNodes && pendingNodes.some(node => node.id === element.id) || containingFrame && elementsPendingErasure.has(containingFrame.id)) {\n opacity *= _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.ELEMENT_READY_TO_ERASE_OPACITY / 100;\n }\n\n return opacity;\n};\n\nconst cappedElementCanvasSize = (element, elementsMap, zoom) => {\n // these limits are ballpark, they depend on specific browsers and device.\n // We've chosen lower limits to be safe. We might want to change these limits\n // based on browser/device type, if we get reports of low quality rendering\n // on zoom.\n //\n // ~ safari mobile canvas area limit\n const AREA_LIMIT = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.getAreaLimit)(); //zsviczian\n // ~ safari width/height limit based on developer.mozilla.org.\n\n const WIDTH_HEIGHT_LIMIT = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.getWidthHeightLimit)(); //zsviczian\n\n const padding = getCanvasPadding(element);\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const elementWidth = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFreeDrawElement)(element) ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(x1, x2) : element.width;\n const elementHeight = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFreeDrawElement)(element) ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(y1, y2) : element.height;\n let width = elementWidth * window.devicePixelRatio + padding * 2;\n let height = elementHeight * window.devicePixelRatio + padding * 2;\n let scale = zoom.value; // rescale to ensure width and height is within limits\n\n if (width * scale > WIDTH_HEIGHT_LIMIT || height * scale > WIDTH_HEIGHT_LIMIT) {\n scale = Math.min(WIDTH_HEIGHT_LIMIT / width, WIDTH_HEIGHT_LIMIT / height);\n } // rescale to ensure canvas area is within limits\n\n\n if (width * height * scale * scale > AREA_LIMIT) {\n scale = Math.sqrt(AREA_LIMIT / (width * height));\n }\n\n width = Math.floor(width * scale);\n height = Math.floor(height * scale);\n return {\n width,\n height,\n scale\n };\n};\n\nconst generateElementCanvas = (element, elementsMap, zoom, renderConfig, appState) => {\n var _a, _b;\n\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n const padding = getCanvasPadding(element);\n const {\n width,\n height,\n scale\n } = cappedElementCanvasSize(element, elementsMap, zoom);\n\n if (!width || !height) {\n return null;\n }\n\n canvas.width = width;\n canvas.height = height;\n let canvasOffsetX = -100;\n let canvasOffsetY = 0;\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFreeDrawElement)(element)) {\n const [x1, y1] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n canvasOffsetX = element.x > x1 ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(element.x, x1) * window.devicePixelRatio * scale : 0;\n canvasOffsetY = element.y > y1 ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(element.y, y1) * window.devicePixelRatio * scale : 0;\n context.translate(canvasOffsetX, canvasOffsetY);\n }\n\n context.save();\n context.translate(padding * scale, padding * scale);\n context.scale(window.devicePixelRatio * scale, window.devicePixelRatio * scale);\n const rc = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].canvas(canvas); // in dark theme, revert the image color filter\n\n if (shouldResetImageFilter(element, renderConfig, appState)) {\n context.filter = IMAGE_INVERT_FILTER;\n }\n\n drawElementOnCanvas(element, rc, context, renderConfig);\n context.restore();\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n const boundTextCanvas = document.createElement(\"canvas\");\n const boundTextCanvasContext = boundTextCanvas.getContext(\"2d\");\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(element) && boundTextElement) {\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap); // Take max dimensions of arrow canvas so that when canvas is rotated\n // the arrow doesn't get clipped\n\n const maxDim = Math.max((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(x1, x2), (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(y1, y2));\n boundTextCanvas.width = maxDim * window.devicePixelRatio * scale + padding * scale * 10;\n boundTextCanvas.height = maxDim * window.devicePixelRatio * scale + padding * scale * 10;\n boundTextCanvasContext.translate(boundTextCanvas.width / 2, boundTextCanvas.height / 2);\n boundTextCanvasContext.rotate(element.angle);\n boundTextCanvasContext.drawImage(canvas, -canvas.width / 2, -canvas.height / 2, canvas.width, canvas.height);\n const [,,,, boundTextCx, boundTextCy] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(boundTextElement, elementsMap);\n boundTextCanvasContext.rotate(-element.angle);\n const offsetX = (boundTextCanvas.width - canvas.width) / 2;\n const offsetY = (boundTextCanvas.height - canvas.height) / 2;\n const shiftX = boundTextCanvas.width / 2 - (boundTextCx - x1) * window.devicePixelRatio * scale - offsetX - padding * scale;\n const shiftY = boundTextCanvas.height / 2 - (boundTextCy - y1) * window.devicePixelRatio * scale - offsetY - padding * scale;\n boundTextCanvasContext.translate(-shiftX, -shiftY); // Clear the bound text area\n\n boundTextCanvasContext.clearRect(-(boundTextElement.width / 2 + _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.BOUND_TEXT_PADDING) * window.devicePixelRatio * scale, -(boundTextElement.height / 2 + _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.BOUND_TEXT_PADDING) * window.devicePixelRatio * scale, (boundTextElement.width + _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.BOUND_TEXT_PADDING * 2) * window.devicePixelRatio * scale, (boundTextElement.height + _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.BOUND_TEXT_PADDING * 2) * window.devicePixelRatio * scale);\n }\n\n return {\n element,\n canvas,\n theme: appState.theme,\n scale,\n zoomValue: zoom.value,\n canvasOffsetX,\n canvasOffsetY,\n boundTextElementVersion: ((_a = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap)) === null || _a === void 0 ? void 0 : _a.version) || null,\n containingFrameOpacity: ((_b = (0,_frame__WEBPACK_IMPORTED_MODULE_10__.getContainingFrame)(element, elementsMap)) === null || _b === void 0 ? void 0 : _b.opacity) || 100,\n boundTextCanvas,\n angle: element.angle,\n imageCrop: (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isImageElement)(element) ? element.crop : null\n };\n};\n\nconst DEFAULT_LINK_SIZE = 14;\nconst IMAGE_PLACEHOLDER_IMG = typeof document !== \"undefined\" ? document.createElement(\"img\") : {\n src: \"\"\n}; // mock image element outside of browser\n\nIMAGE_PLACEHOLDER_IMG.src = `data:${_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.MIME_TYPES.svg},${encodeURIComponent(`<svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fas\" data-icon=\"image\" class=\"svg-inline--fa fa-image fa-w-16\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"#888\" d=\"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z\"></path></svg>`)}`;\nconst IMAGE_ERROR_PLACEHOLDER_IMG = typeof document !== \"undefined\" ? document.createElement(\"img\") : {\n src: \"\"\n}; // mock image element outside of browser\n\nIMAGE_ERROR_PLACEHOLDER_IMG.src = `data:${_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.MIME_TYPES.svg},${encodeURIComponent(`<svg viewBox=\"0 0 668 668\" xmlns=\"http://www.w3.org/2000/svg\" xml:space=\"preserve\" style=\"fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2\"><path d=\"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z\" style=\"fill:#888;fill-rule:nonzero\" transform=\"matrix(.81709 0 0 .81709 124.825 145.825)\"/><path d=\"M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z\" style=\"fill:#888;fill-rule:nonzero\" transform=\"matrix(.30366 0 0 .30366 506.822 60.065)\"/></svg>`)}`;\n\nconst drawImagePlaceholder = (element, context) => {\n context.fillStyle = \"#E7E7E7\";\n context.fillRect(0, 0, element.width, element.height);\n const imageMinWidthOrHeight = Math.min(element.width, element.height);\n const size = Math.min(imageMinWidthOrHeight, Math.min(imageMinWidthOrHeight * 0.4, 100));\n context.drawImage(element.status === \"error\" ? IMAGE_ERROR_PLACEHOLDER_IMG : IMAGE_PLACEHOLDER_IMG, element.width / 2 - size / 2, element.height / 2 - size / 2, size, size);\n};\n\nconst drawElementOnCanvas = (element, rc, context, renderConfig) => {\n var _a, _b, _c, _d;\n\n switch (element.type) {\n case \"rectangle\":\n case \"iframe\":\n case \"embeddable\":\n case \"diamond\":\n case \"ellipse\":\n {\n context.lineJoin = \"round\";\n context.lineCap = \"round\";\n rc.draw(_shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.get(element));\n break;\n }\n\n case \"arrow\":\n case \"line\":\n {\n context.lineJoin = \"round\";\n context.lineCap = \"round\";\n _shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.get(element).forEach(shape => {\n rc.draw(shape);\n });\n break;\n }\n\n case \"freedraw\":\n {\n // Draw directly to canvas\n context.save();\n context.fillStyle = element.strokeColor;\n const path = getFreeDrawPath2D(element);\n const fillShape = _shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.get(element);\n\n if (fillShape) {\n rc.draw(fillShape);\n } //zsviczian\n\n\n if ((_b = (_a = element.customData) === null || _a === void 0 ? void 0 : _a.strokeOptions) === null || _b === void 0 ? void 0 : _b.hasOutline) {\n context.lineWidth = element.strokeWidth * ((_c = element.customData.strokeOptions.outlineWidth) !== null && _c !== void 0 ? _c : 1);\n context.strokeStyle = element.strokeColor;\n context.stroke(path);\n context.fillStyle = element.backgroundColor;\n } else {\n context.fillStyle = element.strokeColor;\n }\n\n context.fill(path);\n context.restore();\n break;\n }\n\n case \"image\":\n {\n const img = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isInitializedImageElement)(element) ? (_d = renderConfig.imageCache.get(element.fileId)) === null || _d === void 0 ? void 0 : _d.image : undefined;\n\n if (img != null && !(img instanceof Promise)) {\n if (element.roundness && context.roundRect) {\n context.beginPath();\n context.roundRect(0, 0, element.width, element.height, (0,_utils__WEBPACK_IMPORTED_MODULE_11__.getCornerRadius)(Math.min(element.width, element.height), element));\n context.clip();\n }\n\n const {\n x,\n y,\n width,\n height\n } = element.crop ? element.crop : {\n x: 0,\n y: 0,\n width: img.naturalWidth,\n height: img.naturalHeight\n };\n context.drawImage(img, x, y, width, height, 0\n /* hardcoded for the selection box*/\n , 0, element.width, element.height);\n } else {\n drawImagePlaceholder(element, context);\n }\n\n break;\n }\n\n default:\n {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element)) {\n const rtl = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.isRTL)(element.text);\n const shouldTemporarilyAttach = rtl && !context.canvas.isConnected;\n\n if (shouldTemporarilyAttach) {\n // to correctly render RTL text mixed with LTR, we have to append it\n // to the DOM\n document.body.appendChild(context.canvas);\n }\n\n context.canvas.setAttribute(\"dir\", rtl ? \"rtl\" : \"ltr\");\n context.save();\n context.font = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.getFontString)(element);\n context.fillStyle = element.strokeColor;\n context.textAlign = element.textAlign; // Canvas does not support multiline text by default\n\n const lines = element.text.replace(/\\r\\n?/g, \"\\n\").split(\"\\n\");\n const horizontalOffset = element.textAlign === \"center\" ? element.width / 2 : element.textAlign === \"right\" ? element.width : 0;\n const lineHeightPx = (0,_textMeasurements__WEBPACK_IMPORTED_MODULE_8__.getLineHeightInPx)(element.fontSize, element.lineHeight);\n const verticalOffset = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.getVerticalOffset)(element.fontFamily, element.fontSize, lineHeightPx);\n\n for (let index = 0; index < lines.length; index++) {\n context.fillText(lines[index], horizontalOffset, index * lineHeightPx + verticalOffset);\n }\n\n context.restore();\n\n if (shouldTemporarilyAttach) {\n context.canvas.remove();\n }\n } else {\n throw new Error(`Unimplemented type ${element.type}`);\n }\n }\n }\n};\n\nconst elementWithCanvasCache = new WeakMap();\n\nconst generateElementWithCanvas = (element, elementsMap, renderConfig, appState) => {\n var _a;\n\n const zoom = renderConfig ? appState.zoom : {\n value: 1\n };\n const prevElementWithCanvas = elementWithCanvasCache.get(element);\n const shouldRegenerateBecauseZoom = prevElementWithCanvas && prevElementWithCanvas.zoomValue !== zoom.value && !(appState === null || appState === void 0 ? void 0 : appState.shouldCacheIgnoreZoom);\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n const boundTextElementVersion = (boundTextElement === null || boundTextElement === void 0 ? void 0 : boundTextElement.version) || null;\n const imageCrop = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isImageElement)(element) ? element.crop : null;\n const containingFrameOpacity = ((_a = (0,_frame__WEBPACK_IMPORTED_MODULE_10__.getContainingFrame)(element, elementsMap)) === null || _a === void 0 ? void 0 : _a.opacity) || 100;\n\n if (!prevElementWithCanvas || shouldRegenerateBecauseZoom || prevElementWithCanvas.theme !== appState.theme || prevElementWithCanvas.boundTextElementVersion !== boundTextElementVersion || prevElementWithCanvas.imageCrop !== imageCrop || prevElementWithCanvas.containingFrameOpacity !== containingFrameOpacity || // since we rotate the canvas when copying from cached canvas, we don't\n // regenerate the cached canvas. But we need to in case of labels which are\n // cached alongside the arrow, and we want the labels to remain unrotated\n // with respect to the arrow.\n (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(element) && boundTextElement && element.angle !== prevElementWithCanvas.angle) {\n const elementWithCanvas = generateElementCanvas(element, elementsMap, zoom, renderConfig, appState);\n\n if (!elementWithCanvas) {\n return null;\n }\n\n elementWithCanvasCache.set(element, elementWithCanvas);\n return elementWithCanvas;\n }\n\n return prevElementWithCanvas;\n};\n\nconst drawElementFromCanvas = (elementWithCanvas, context, renderConfig, appState, allElementsMap) => {\n const element = elementWithCanvas.element;\n const padding = getCanvasPadding(element);\n const zoom = elementWithCanvas.scale;\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, allElementsMap);\n const cx = ((x1 + x2) / 2 + appState.scrollX) * window.devicePixelRatio;\n const cy = ((y1 + y2) / 2 + appState.scrollY) * window.devicePixelRatio;\n context.save();\n context.scale(1 / window.devicePixelRatio, 1 / window.devicePixelRatio);\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, allElementsMap);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(element) && boundTextElement) {\n const offsetX = (elementWithCanvas.boundTextCanvas.width - elementWithCanvas.canvas.width) / 2;\n const offsetY = (elementWithCanvas.boundTextCanvas.height - elementWithCanvas.canvas.height) / 2;\n context.translate(cx, cy);\n context.drawImage(elementWithCanvas.boundTextCanvas, -(x2 - x1) / 2 * window.devicePixelRatio - offsetX / zoom - padding, -(y2 - y1) / 2 * window.devicePixelRatio - offsetY / zoom - padding, elementWithCanvas.boundTextCanvas.width / zoom, elementWithCanvas.boundTextCanvas.height / zoom);\n } else {\n // we translate context to element center so that rotation and scale\n // originates from the element center\n context.translate(cx, cy);\n context.rotate(element.angle);\n\n if (\"scale\" in elementWithCanvas.element && !isPendingImageElement(element, renderConfig) && !(0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isIframeLikeElement)(element) //zsviczian\n ) {\n context.scale(elementWithCanvas.element.scale[0], elementWithCanvas.element.scale[1]);\n } // revert afterwards we don't have account for it during drawing\n\n\n context.translate(-cx, -cy);\n context.drawImage(elementWithCanvas.canvas, (x1 + appState.scrollX) * window.devicePixelRatio - padding * elementWithCanvas.scale / elementWithCanvas.scale, (y1 + appState.scrollY) * window.devicePixelRatio - padding * elementWithCanvas.scale / elementWithCanvas.scale, elementWithCanvas.canvas.width / elementWithCanvas.scale, elementWithCanvas.canvas.height / elementWithCanvas.scale);\n\n if (false) {}\n }\n\n context.restore(); // Clear the nested element we appended to the DOM\n};\n\nconst renderSelectionElement = (element, context, appState, selectionColor) => {\n var _a;\n\n context.save();\n context.translate(element.x + appState.scrollX, element.y + appState.scrollY);\n context.fillStyle = (_a = appState.gridColor.Bold) !== null && _a !== void 0 ? _a : \"rgba(0, 0, 200, 0.04)\"; //zsviczian\n // render from 0.5px offset to get 1px wide line\n // https://stackoverflow.com/questions/7530593/html5-canvas-and-line-width/7531540#7531540\n // TODO can be be improved by offseting to the negative when user selects\n // from right to left\n\n const offset = 0.5 / appState.zoom.value;\n context.fillRect(offset, offset, element.width, element.height);\n context.lineWidth = 1 / appState.zoom.value;\n context.strokeStyle = selectionColor;\n context.strokeRect(offset, offset, element.width, element.height);\n context.restore();\n};\nconst renderElement = (element, elementsMap, allElementsMap, rc, context, renderConfig, appState) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n\n const reduceAlphaForSelection = ((_a = appState.openDialog) === null || _a === void 0 ? void 0 : _a.name) === \"elementLinkSelector\" && !appState.selectedElementIds[element.id] && !appState.hoveredElementIds[element.id];\n context.globalAlpha = getRenderOpacity(element, (0,_frame__WEBPACK_IMPORTED_MODULE_10__.getContainingFrame)(element, elementsMap), renderConfig.elementsPendingErasure, renderConfig.pendingFlowchartNodes, reduceAlphaForSelection ? _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_REDUCED_GLOBAL_ALPHA : 1);\n\n switch (element.type) {\n case \"magicframe\":\n case \"frame\":\n {\n if ( //zsviczian\n appState.frameRendering.enabled && appState.frameRendering.outline && !(!appState.frameRendering.markerEnabled && element.frameRole === \"marker\")) {\n context.save();\n context.translate(element.x + appState.scrollX, element.y + appState.scrollY);\n context.fillStyle = (_f = (_d = (_c = (_b = element.customData) === null || _b === void 0 ? void 0 : _b.frameColor) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : (_e = appState === null || appState === void 0 ? void 0 : appState.frameColor) === null || _e === void 0 ? void 0 : _e.fill) !== null && _f !== void 0 ? _f : \"rgba(0, 0, 200, 0.04)\"; //zsviczian\n\n context.lineWidth = _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.FRAME_STYLE.strokeWidth / appState.zoom.value;\n context.strokeStyle = (_l = (_j = (_h = (_g = element.customData) === null || _g === void 0 ? void 0 : _g.frameColor) === null || _h === void 0 ? void 0 : _h.stroke) !== null && _j !== void 0 ? _j : (_k = appState === null || appState === void 0 ? void 0 : appState.frameColor) === null || _k === void 0 ? void 0 : _k.stroke) !== null && _l !== void 0 ? _l : _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.FRAME_STYLE.strokeColor; //zsviczian\n // TODO change later to only affect AI frames\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isMagicFrameElement)(element)) {\n context.strokeStyle = appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.THEME.LIGHT ? \"#7affd7\" : \"#1d8264\";\n } //zsviczian\n\n\n if (element.frameRole === \"marker\") {\n const dash = 8 / appState.zoom.value;\n const gap = 6 / appState.zoom.value;\n context.setLineDash([dash, gap]);\n }\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.FRAME_STYLE.radius && context.roundRect && element.frameRole !== \"marker\") {\n //zsviczian\n context.beginPath();\n context.roundRect(0, 0, element.width, element.height, _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.FRAME_STYLE.radius / appState.zoom.value);\n context.stroke();\n context.closePath();\n } else {\n context.strokeRect(0, 0, element.width, element.height);\n }\n\n context.restore();\n }\n\n break;\n }\n\n case \"freedraw\":\n {\n // TODO investigate if we can do this in situ. Right now we need to call\n // beforehand because math helpers (such as getElementAbsoluteCoords)\n // rely on existing shapes\n _shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.generateElementShape(element, null);\n\n if (renderConfig.isExporting) {\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const cx = (x1 + x2) / 2 + appState.scrollX;\n const cy = (y1 + y2) / 2 + appState.scrollY;\n const shiftX = (x2 - x1) / 2 - (element.x - x1);\n const shiftY = (y2 - y1) / 2 - (element.y - y1);\n context.save();\n context.translate(cx, cy);\n context.rotate(element.angle);\n context.translate(-shiftX, -shiftY);\n drawElementOnCanvas(element, rc, context, renderConfig);\n context.restore();\n } else {\n const elementWithCanvas = generateElementWithCanvas(element, allElementsMap, renderConfig, appState);\n\n if (!elementWithCanvas) {\n return;\n }\n\n drawElementFromCanvas(elementWithCanvas, context, renderConfig, appState, allElementsMap);\n }\n\n break;\n }\n\n case \"rectangle\":\n case \"diamond\":\n case \"ellipse\":\n case \"line\":\n case \"arrow\":\n case \"image\":\n case \"text\":\n case \"iframe\":\n case \"embeddable\":\n {\n // TODO investigate if we can do this in situ. Right now we need to call\n // beforehand because math helpers (such as getElementAbsoluteCoords)\n // rely on existing shapes\n _shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.generateElementShape(element, renderConfig);\n\n if (renderConfig.isExporting) {\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const cx = (x1 + x2) / 2 + appState.scrollX;\n const cy = (y1 + y2) / 2 + appState.scrollY;\n let shiftX = (x2 - x1) / 2 - (element.x - x1);\n let shiftY = (y2 - y1) / 2 - (element.y - y1);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element)) {\n const container = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getContainerElement)(element, elementsMap);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(container)) {\n const boundTextCoords = _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getBoundTextElementPosition(container, element, elementsMap);\n shiftX = (x2 - x1) / 2 - (boundTextCoords.x - x1);\n shiftY = (y2 - y1) / 2 - (boundTextCoords.y - y1);\n }\n }\n\n context.save();\n context.translate(cx, cy);\n\n if (shouldResetImageFilter(element, renderConfig, appState)) {\n context.filter = \"none\";\n }\n\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(element) && boundTextElement) {\n const tempCanvas = document.createElement(\"canvas\");\n const tempCanvasContext = tempCanvas.getContext(\"2d\"); // Take max dimensions of arrow canvas so that when canvas is rotated\n // the arrow doesn't get clipped\n\n const maxDim = Math.max((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(x1, x2), (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(y1, y2));\n const padding = getCanvasPadding(element);\n tempCanvas.width = maxDim * appState.exportScale + padding * 10 * appState.exportScale;\n tempCanvas.height = maxDim * appState.exportScale + padding * 10 * appState.exportScale;\n tempCanvasContext.translate(tempCanvas.width / 2, tempCanvas.height / 2);\n tempCanvasContext.scale(appState.exportScale, appState.exportScale); // Shift the canvas to left most point of the arrow\n\n shiftX = element.width / 2 - (element.x - x1);\n shiftY = element.height / 2 - (element.y - y1);\n tempCanvasContext.rotate(element.angle);\n const tempRc = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].canvas(tempCanvas);\n tempCanvasContext.translate(-shiftX, -shiftY);\n drawElementOnCanvas(element, tempRc, tempCanvasContext, renderConfig);\n tempCanvasContext.translate(shiftX, shiftY);\n tempCanvasContext.rotate(-element.angle); // Shift the canvas to center of bound text\n\n const [,,,, boundTextCx, boundTextCy] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(boundTextElement, elementsMap);\n const boundTextShiftX = (x1 + x2) / 2 - boundTextCx;\n const boundTextShiftY = (y1 + y2) / 2 - boundTextCy;\n tempCanvasContext.translate(-boundTextShiftX, -boundTextShiftY); // Clear the bound text area\n\n tempCanvasContext.clearRect(-boundTextElement.width / 2, -boundTextElement.height / 2, boundTextElement.width, boundTextElement.height);\n context.scale(1 / appState.exportScale, 1 / appState.exportScale);\n context.drawImage(tempCanvas, -tempCanvas.width / 2, -tempCanvas.height / 2, tempCanvas.width, tempCanvas.height);\n } else {\n context.rotate(element.angle);\n\n if (element.type === \"image\") {\n // note: scale must be applied *after* rotating\n context.scale(element.scale[0], element.scale[1]);\n }\n\n context.translate(-shiftX, -shiftY);\n drawElementOnCanvas(element, rc, context, renderConfig);\n }\n\n context.restore(); // not exporting → optimized rendering (cache & render from element\n // canvases)\n } else {\n const elementWithCanvas = generateElementWithCanvas(element, allElementsMap, renderConfig, appState);\n\n if (!elementWithCanvas) {\n return;\n }\n\n const currentImageSmoothingStatus = context.imageSmoothingEnabled;\n\n if ( // do not disable smoothing during zoom as blurry shapes look better\n // on low resolution (while still zooming in) than sharp ones\n !(appState === null || appState === void 0 ? void 0 : appState.shouldCacheIgnoreZoom) && ( // angle is 0 -> always disable smoothing\n !element.angle || // or check if angle is a right angle in which case we can still\n // disable smoothing without adversely affecting the result\n // We need less-than comparison because of FP artihmetic\n (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.isRightAngleRads)(element.angle))) {\n // Disabling smoothing makes output much sharper, especially for\n // text. Unless for non-right angles, where the aliasing is really\n // terrible on Chromium.\n //\n // Note that `context.imageSmoothingQuality=\"high\"` has almost\n // zero effect.\n //\n context.imageSmoothingEnabled = false;\n }\n\n if (element.id === appState.croppingElementId && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isImageElement)(elementWithCanvas.element) && elementWithCanvas.element.crop !== null) {\n context.save();\n context.globalAlpha = 0.1;\n const uncroppedElementCanvas = generateElementCanvas((0,_cropElement__WEBPACK_IMPORTED_MODULE_5__.getUncroppedImageElement)(elementWithCanvas.element, elementsMap), allElementsMap, appState.zoom, renderConfig, appState);\n\n if (uncroppedElementCanvas) {\n drawElementFromCanvas(uncroppedElementCanvas, context, renderConfig, appState, allElementsMap);\n }\n\n context.restore();\n }\n\n drawElementFromCanvas(elementWithCanvas, context, renderConfig, appState, allElementsMap); // reset\n\n context.imageSmoothingEnabled = currentImageSmoothingStatus;\n }\n\n break;\n }\n\n default:\n {\n // @ts-ignore\n throw new Error(`Unimplemented type ${element.type}`);\n }\n }\n\n context.globalAlpha = 1;\n};\nconst pathsCache = new WeakMap([]);\nfunction generateFreeDrawShape(element) {\n const svgPathData = getFreeDrawSvgPath(element);\n const path = new Path2D(svgPathData);\n pathsCache.set(element, path);\n return path;\n}\nfunction getFreeDrawPath2D(element) {\n return pathsCache.get(element);\n}\nfunction getFreeDrawSvgPath(element) {\n return getSvgPathFromStroke(getFreedrawOutlinePoints(element));\n}\nfunction getFreedrawOutlineAsSegments(element, points, elementsMap) {\n const bounds = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementBounds)(Object.assign(Object.assign({}, element), {\n angle: 0\n }), elementsMap);\n const center = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)((bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2);\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.invariant)(points.length >= 2, \"Freepath outline must have at least 2 points\");\n return points.slice(2).reduce((acc, curr) => {\n acc.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(acc[acc.length - 1][1], (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(curr[0] + element.x, curr[1] + element.y), center, element.angle)));\n return acc;\n }, [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[0][0] + element.x, points[0][1] + element.y), center, element.angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[1][0] + element.x, points[1][1] + element.y), center, element.angle))]);\n}\nfunction getFreedrawOutlinePoints(element) {\n var _a, _b, _c, _d, _e, _f, _g, _h; // If input points are empty (should they ever be?) return a dot\n\n\n const inputPoints = element.simulatePressure ? element.points : element.points.length ? element.points.map(([x, y], i) => [x, y, element.pressures[i]]) : [[0, 0, 0.5]]; // Consider changing the options for simulated pressure vs real pressure\n\n const customOptions = (_b = (_a = element.customData) === null || _a === void 0 ? void 0 : _a.strokeOptions) === null || _b === void 0 ? void 0 : _b.options; //zsviczian\n\n const options = customOptions //zsviczian\n ? Object.assign(Object.assign(Object.assign(Object.assign({}, customOptions), {\n simulatePressure: (_c = customOptions.simulatePressure) !== null && _c !== void 0 ? _c : element.simulatePressure,\n size: element.strokeWidth * 4.25,\n last: true,\n easing: (_d = _easingFunctions__WEBPACK_IMPORTED_MODULE_13__[\"default\"][customOptions.easing]) !== null && _d !== void 0 ? _d : t => t\n }), ((_e = customOptions.start) === null || _e === void 0 ? void 0 : _e.easing) ? {\n start: Object.assign(Object.assign({}, customOptions.start), {\n easing: (_f = _easingFunctions__WEBPACK_IMPORTED_MODULE_13__[\"default\"][customOptions.start.easing]) !== null && _f !== void 0 ? _f : t => t\n })\n } : {\n start: customOptions.start\n }), ((_g = customOptions.end) === null || _g === void 0 ? void 0 : _g.easing) ? {\n end: Object.assign(Object.assign({}, customOptions.end), {\n easing: (_h = _easingFunctions__WEBPACK_IMPORTED_MODULE_13__[\"default\"][customOptions.end.easing]) !== null && _h !== void 0 ? _h : t => t\n })\n } : {\n end: customOptions.end\n }) : {\n simulatePressure: element.simulatePressure,\n size: element.strokeWidth * 4.25,\n thinning: 0.6,\n smoothing: 0.5,\n streamline: 0.5,\n easing: _easingFunctions__WEBPACK_IMPORTED_MODULE_13__[\"default\"].easeOutSine,\n last: true\n };\n return (0,perfect_freehand__WEBPACK_IMPORTED_MODULE_1__.getStroke)(inputPoints, options);\n}\n\nfunction med(A, B) {\n return [(A[0] + B[0]) / 2, (A[1] + B[1]) / 2];\n} // Trim SVG path data so number are each two decimal points. This\n// improves SVG exports, and prevents rendering errors on points\n// with long decimals.\n\n\nconst TO_FIXED_PRECISION = /(\\s?[A-Z]?,?-?[0-9]*\\.[0-9]{0,2})(([0-9]|e|-)*)/g;\n\nfunction getSvgPathFromStroke(points) {\n if (!points.length) {\n return \"\";\n }\n\n const max = points.length - 1;\n return points.reduce((acc, point, i, arr) => {\n if (i === max) {\n acc.push(point, med(point, arr[0]), \"L\", arr[0], \"Z\");\n } else {\n acc.push(point, med(point, arr[i + 1]));\n }\n\n return acc;\n }, [\"M\", points[0], \"Q\"]).join(\" \").replace(TO_FIXED_PRECISION, \"$1\");\n}\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/renderElement.ts?");
|
|
13424
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_LINK_SIZE: () => (/* binding */ DEFAULT_LINK_SIZE),\n/* harmony export */ IMAGE_INVERT_FILTER: () => (/* binding */ IMAGE_INVERT_FILTER),\n/* harmony export */ elementWithCanvasCache: () => (/* binding */ elementWithCanvasCache),\n/* harmony export */ generateFreeDrawShape: () => (/* binding */ generateFreeDrawShape),\n/* harmony export */ getFreeDrawPath2D: () => (/* binding */ getFreeDrawPath2D),\n/* harmony export */ getFreeDrawSvgPath: () => (/* binding */ getFreeDrawSvgPath),\n/* harmony export */ getFreedrawOutlineAsSegments: () => (/* binding */ getFreedrawOutlineAsSegments),\n/* harmony export */ getFreedrawOutlinePoints: () => (/* binding */ getFreedrawOutlinePoints),\n/* harmony export */ getRenderOpacity: () => (/* binding */ getRenderOpacity),\n/* harmony export */ pathsCache: () => (/* binding */ pathsCache),\n/* harmony export */ renderElement: () => (/* binding */ renderElement),\n/* harmony export */ renderSelectionElement: () => (/* binding */ renderSelectionElement)\n/* harmony export */ });\n/* harmony import */ var roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! roughjs/bin/rough */ \"../../node_modules/roughjs/bin/rough.js\");\n/* harmony import */ var perfect_freehand__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! perfect-freehand */ \"../../node_modules/perfect-freehand/dist/esm/index.js\");\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _bounds__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _cropElement__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./cropElement */ \"../element/src/cropElement.ts\");\n/* harmony import */ var _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./linearElementEditor */ \"../element/src/linearElementEditor.ts\");\n/* harmony import */ var _textElement__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _textMeasurements__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./textMeasurements */ \"../element/src/textMeasurements.ts\");\n/* harmony import */ var _typeChecks__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @excalidraw/element/typeChecks */ \"../element/src/typeChecks.ts\");\n/* harmony import */ var _frame__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./frame */ \"../element/src/frame.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils */ \"../element/src/utils.ts\");\n/* harmony import */ var _shape__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./shape */ \"../element/src/shape.ts\");\n/* harmony import */ var _easingFunctions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./easingFunctions */ \"../element/src/easingFunctions.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n // using a stronger invert (100% vs our regular 93%) and saturate\n// as a temp hack to make images in dark theme look closer to original\n// color scheme (it's still not quite there and the colors look slightly\n// desatured, alas...)\n\nconst IMAGE_INVERT_FILTER = \"invert(100%) hue-rotate(180deg) saturate(1.25)\";\n\nconst isPendingImageElement = (element, renderConfig) => (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isInitializedImageElement)(element) && !renderConfig.imageCache.has(element.fileId);\n\nconst shouldResetImageFilter = (element, renderConfig, appState) => {\n var _a;\n\n return appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.THEME.DARK && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isInitializedImageElement)(element) && !isPendingImageElement(element, renderConfig) && ((_a = renderConfig.imageCache.get(element.fileId)) === null || _a === void 0 ? void 0 : _a.mimeType) !== _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.MIME_TYPES.svg;\n};\n\nconst getCanvasPadding = element => {\n switch (element.type) {\n case \"freedraw\":\n return element.strokeWidth * 12;\n\n case \"text\":\n return element.fontSize / 2;\n\n case \"arrow\":\n if (element.endArrowhead || element.endArrowhead) {\n return 40;\n }\n\n return 20;\n\n default:\n return 20;\n }\n};\n\nconst getRenderOpacity = (element, containingFrame, elementsPendingErasure, pendingNodes, globalAlpha = 1) => {\n var _a; // multiplying frame opacity with element opacity to combine them\n // (e.g. frame 50% and element 50% opacity should result in 25% opacity)\n\n\n let opacity = ((_a = containingFrame === null || containingFrame === void 0 ? void 0 : containingFrame.opacity) !== null && _a !== void 0 ? _a : 100) * element.opacity / 10000 * globalAlpha; // if pending erasure, multiply again to combine further\n // (so that erasing always results in lower opacity than original)\n\n if (elementsPendingErasure.has(element.id) || pendingNodes && pendingNodes.some(node => node.id === element.id) || containingFrame && elementsPendingErasure.has(containingFrame.id)) {\n opacity *= _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.ELEMENT_READY_TO_ERASE_OPACITY / 100;\n }\n\n return opacity;\n};\n\nconst cappedElementCanvasSize = (element, elementsMap, zoom) => {\n // these limits are ballpark, they depend on specific browsers and device.\n // We've chosen lower limits to be safe. We might want to change these limits\n // based on browser/device type, if we get reports of low quality rendering\n // on zoom.\n //\n // ~ safari mobile canvas area limit\n const AREA_LIMIT = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.getAreaLimit)(); //zsviczian\n // ~ safari width/height limit based on developer.mozilla.org.\n\n const WIDTH_HEIGHT_LIMIT = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.getWidthHeightLimit)(); //zsviczian\n\n const padding = getCanvasPadding(element);\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const elementWidth = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFreeDrawElement)(element) ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(x1, x2) : element.width;\n const elementHeight = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFreeDrawElement)(element) ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(y1, y2) : element.height;\n let width = elementWidth * window.devicePixelRatio + padding * 2;\n let height = elementHeight * window.devicePixelRatio + padding * 2;\n let scale = zoom.value; // rescale to ensure width and height is within limits\n\n if (width * scale > WIDTH_HEIGHT_LIMIT || height * scale > WIDTH_HEIGHT_LIMIT) {\n scale = Math.min(WIDTH_HEIGHT_LIMIT / width, WIDTH_HEIGHT_LIMIT / height);\n } // rescale to ensure canvas area is within limits\n\n\n if (width * height * scale * scale > AREA_LIMIT) {\n scale = Math.sqrt(AREA_LIMIT / (width * height));\n }\n\n width = Math.floor(width * scale);\n height = Math.floor(height * scale);\n return {\n width,\n height,\n scale\n };\n};\n\nconst generateElementCanvas = (element, elementsMap, zoom, renderConfig, appState) => {\n var _a, _b;\n\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n const padding = getCanvasPadding(element);\n const {\n width,\n height,\n scale\n } = cappedElementCanvasSize(element, elementsMap, zoom);\n\n if (!width || !height) {\n return null;\n }\n\n canvas.width = width;\n canvas.height = height;\n let canvasOffsetX = -100;\n let canvasOffsetY = 0;\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFreeDrawElement)(element)) {\n const [x1, y1] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n canvasOffsetX = element.x > x1 ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(element.x, x1) * window.devicePixelRatio * scale : 0;\n canvasOffsetY = element.y > y1 ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(element.y, y1) * window.devicePixelRatio * scale : 0;\n context.translate(canvasOffsetX, canvasOffsetY);\n }\n\n context.save();\n context.translate(padding * scale, padding * scale);\n context.scale(window.devicePixelRatio * scale, window.devicePixelRatio * scale);\n const rc = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].canvas(canvas); // in dark theme, revert the image color filter\n\n if (shouldResetImageFilter(element, renderConfig, appState)) {\n context.filter = IMAGE_INVERT_FILTER;\n }\n\n drawElementOnCanvas(element, rc, context, renderConfig);\n context.restore();\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n const boundTextCanvas = document.createElement(\"canvas\");\n const boundTextCanvasContext = boundTextCanvas.getContext(\"2d\");\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(element) && boundTextElement) {\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap); // Take max dimensions of arrow canvas so that when canvas is rotated\n // the arrow doesn't get clipped\n\n const maxDim = Math.max((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(x1, x2), (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(y1, y2));\n boundTextCanvas.width = maxDim * window.devicePixelRatio * scale + padding * scale * 10;\n boundTextCanvas.height = maxDim * window.devicePixelRatio * scale + padding * scale * 10;\n boundTextCanvasContext.translate(boundTextCanvas.width / 2, boundTextCanvas.height / 2);\n boundTextCanvasContext.rotate(element.angle);\n boundTextCanvasContext.drawImage(canvas, -canvas.width / 2, -canvas.height / 2, canvas.width, canvas.height);\n const [,,,, boundTextCx, boundTextCy] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(boundTextElement, elementsMap);\n boundTextCanvasContext.rotate(-element.angle);\n const offsetX = (boundTextCanvas.width - canvas.width) / 2;\n const offsetY = (boundTextCanvas.height - canvas.height) / 2;\n const shiftX = boundTextCanvas.width / 2 - (boundTextCx - x1) * window.devicePixelRatio * scale - offsetX - padding * scale;\n const shiftY = boundTextCanvas.height / 2 - (boundTextCy - y1) * window.devicePixelRatio * scale - offsetY - padding * scale;\n boundTextCanvasContext.translate(-shiftX, -shiftY); // Clear the bound text area\n\n boundTextCanvasContext.clearRect(-(boundTextElement.width / 2 + _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.BOUND_TEXT_PADDING) * window.devicePixelRatio * scale, -(boundTextElement.height / 2 + _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.BOUND_TEXT_PADDING) * window.devicePixelRatio * scale, (boundTextElement.width + _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.BOUND_TEXT_PADDING * 2) * window.devicePixelRatio * scale, (boundTextElement.height + _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.BOUND_TEXT_PADDING * 2) * window.devicePixelRatio * scale);\n }\n\n return {\n element,\n canvas,\n theme: appState.theme,\n scale,\n zoomValue: zoom.value,\n canvasOffsetX,\n canvasOffsetY,\n boundTextElementVersion: ((_a = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap)) === null || _a === void 0 ? void 0 : _a.version) || null,\n containingFrameOpacity: ((_b = (0,_frame__WEBPACK_IMPORTED_MODULE_10__.getContainingFrame)(element, elementsMap)) === null || _b === void 0 ? void 0 : _b.opacity) || 100,\n boundTextCanvas,\n angle: element.angle,\n imageCrop: (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isImageElement)(element) ? element.crop : null\n };\n};\n\nconst DEFAULT_LINK_SIZE = 14;\nconst IMAGE_PLACEHOLDER_IMG = typeof document !== \"undefined\" ? document.createElement(\"img\") : {\n src: \"\"\n}; // mock image element outside of browser\n\nIMAGE_PLACEHOLDER_IMG.src = `data:${_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.MIME_TYPES.svg},${encodeURIComponent(`<svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fas\" data-icon=\"image\" class=\"svg-inline--fa fa-image fa-w-16\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"#888\" d=\"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z\"></path></svg>`)}`;\nconst IMAGE_ERROR_PLACEHOLDER_IMG = typeof document !== \"undefined\" ? document.createElement(\"img\") : {\n src: \"\"\n}; // mock image element outside of browser\n\nIMAGE_ERROR_PLACEHOLDER_IMG.src = `data:${_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.MIME_TYPES.svg},${encodeURIComponent(`<svg viewBox=\"0 0 668 668\" xmlns=\"http://www.w3.org/2000/svg\" xml:space=\"preserve\" style=\"fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2\"><path d=\"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z\" style=\"fill:#888;fill-rule:nonzero\" transform=\"matrix(.81709 0 0 .81709 124.825 145.825)\"/><path d=\"M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z\" style=\"fill:#888;fill-rule:nonzero\" transform=\"matrix(.30366 0 0 .30366 506.822 60.065)\"/></svg>`)}`;\n\nconst drawImagePlaceholder = (element, context) => {\n context.fillStyle = \"#E7E7E7\";\n context.fillRect(0, 0, element.width, element.height);\n const imageMinWidthOrHeight = Math.min(element.width, element.height);\n const size = Math.min(imageMinWidthOrHeight, Math.min(imageMinWidthOrHeight * 0.4, 100));\n context.drawImage(element.status === \"error\" ? IMAGE_ERROR_PLACEHOLDER_IMG : IMAGE_PLACEHOLDER_IMG, element.width / 2 - size / 2, element.height / 2 - size / 2, size, size);\n};\n\nconst drawElementOnCanvas = (element, rc, context, renderConfig) => {\n var _a, _b, _c, _d;\n\n switch (element.type) {\n case \"rectangle\":\n case \"iframe\":\n case \"embeddable\":\n case \"diamond\":\n case \"ellipse\":\n {\n context.lineJoin = \"round\";\n context.lineCap = \"round\";\n rc.draw(_shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.get(element));\n break;\n }\n\n case \"arrow\":\n case \"line\":\n {\n context.lineJoin = \"round\";\n context.lineCap = \"round\";\n _shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.get(element).forEach(shape => {\n rc.draw(shape);\n });\n break;\n }\n\n case \"freedraw\":\n {\n // Draw directly to canvas\n context.save();\n context.fillStyle = element.strokeColor;\n const path = getFreeDrawPath2D(element);\n const fillShape = _shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.get(element);\n\n if (fillShape) {\n rc.draw(fillShape);\n } //zsviczian\n\n\n if ((_b = (_a = element.customData) === null || _a === void 0 ? void 0 : _a.strokeOptions) === null || _b === void 0 ? void 0 : _b.hasOutline) {\n context.lineWidth = element.strokeWidth * ((_c = element.customData.strokeOptions.outlineWidth) !== null && _c !== void 0 ? _c : 1);\n context.strokeStyle = element.strokeColor;\n context.stroke(path);\n context.fillStyle = element.backgroundColor;\n } else {\n context.fillStyle = element.strokeColor;\n }\n\n context.fill(path);\n context.restore();\n break;\n }\n\n case \"image\":\n {\n const img = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isInitializedImageElement)(element) ? (_d = renderConfig.imageCache.get(element.fileId)) === null || _d === void 0 ? void 0 : _d.image : undefined;\n\n if (img != null && !(img instanceof Promise)) {\n if (element.roundness && context.roundRect) {\n context.beginPath();\n context.roundRect(0, 0, element.width, element.height, (0,_utils__WEBPACK_IMPORTED_MODULE_11__.getCornerRadius)(Math.min(element.width, element.height), element));\n context.clip();\n }\n\n const {\n x,\n y,\n width,\n height\n } = element.crop ? element.crop : {\n x: 0,\n y: 0,\n width: img.naturalWidth,\n height: img.naturalHeight\n };\n context.drawImage(img, x, y, width, height, 0\n /* hardcoded for the selection box*/\n , 0, element.width, element.height);\n } else {\n drawImagePlaceholder(element, context);\n }\n\n break;\n }\n\n default:\n {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element)) {\n const rtl = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.isRTL)(element.text);\n const shouldTemporarilyAttach = rtl && !context.canvas.isConnected;\n\n if (shouldTemporarilyAttach) {\n // to correctly render RTL text mixed with LTR, we have to append it\n // to the DOM\n document.body.appendChild(context.canvas);\n }\n\n context.canvas.setAttribute(\"dir\", rtl ? \"rtl\" : \"ltr\");\n context.save();\n context.font = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.getFontString)(element);\n context.fillStyle = element.strokeColor;\n context.textAlign = element.textAlign; // Canvas does not support multiline text by default\n\n const lines = element.text.replace(/\\r\\n?/g, \"\\n\").split(\"\\n\");\n const horizontalOffset = element.textAlign === \"center\" ? element.width / 2 : element.textAlign === \"right\" ? element.width : 0;\n const lineHeightPx = (0,_textMeasurements__WEBPACK_IMPORTED_MODULE_8__.getLineHeightInPx)(element.fontSize, element.lineHeight);\n const verticalOffset = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.getVerticalOffset)(element.fontFamily, element.fontSize, lineHeightPx);\n\n for (let index = 0; index < lines.length; index++) {\n context.fillText(lines[index], horizontalOffset, index * lineHeightPx + verticalOffset);\n }\n\n context.restore();\n\n if (shouldTemporarilyAttach) {\n context.canvas.remove();\n }\n } else {\n throw new Error(`Unimplemented type ${element.type}`);\n }\n }\n }\n};\n\nconst elementWithCanvasCache = new WeakMap();\n\nconst generateElementWithCanvas = (element, elementsMap, renderConfig, appState) => {\n var _a;\n\n const zoom = renderConfig ? appState.zoom : {\n value: 1\n };\n const prevElementWithCanvas = elementWithCanvasCache.get(element);\n const shouldRegenerateBecauseZoom = prevElementWithCanvas && prevElementWithCanvas.zoomValue !== zoom.value && !(appState === null || appState === void 0 ? void 0 : appState.shouldCacheIgnoreZoom);\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n const boundTextElementVersion = (boundTextElement === null || boundTextElement === void 0 ? void 0 : boundTextElement.version) || null;\n const imageCrop = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isImageElement)(element) ? element.crop : null;\n const containingFrameOpacity = ((_a = (0,_frame__WEBPACK_IMPORTED_MODULE_10__.getContainingFrame)(element, elementsMap)) === null || _a === void 0 ? void 0 : _a.opacity) || 100;\n\n if (!prevElementWithCanvas || shouldRegenerateBecauseZoom || prevElementWithCanvas.theme !== appState.theme || prevElementWithCanvas.boundTextElementVersion !== boundTextElementVersion || prevElementWithCanvas.imageCrop !== imageCrop || prevElementWithCanvas.containingFrameOpacity !== containingFrameOpacity || // since we rotate the canvas when copying from cached canvas, we don't\n // regenerate the cached canvas. But we need to in case of labels which are\n // cached alongside the arrow, and we want the labels to remain unrotated\n // with respect to the arrow.\n (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(element) && boundTextElement && element.angle !== prevElementWithCanvas.angle) {\n const elementWithCanvas = generateElementCanvas(element, elementsMap, zoom, renderConfig, appState);\n\n if (!elementWithCanvas) {\n return null;\n }\n\n elementWithCanvasCache.set(element, elementWithCanvas);\n return elementWithCanvas;\n }\n\n return prevElementWithCanvas;\n};\n\nconst drawElementFromCanvas = (elementWithCanvas, context, renderConfig, appState, allElementsMap) => {\n const element = elementWithCanvas.element;\n const padding = getCanvasPadding(element);\n const zoom = elementWithCanvas.scale;\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, allElementsMap);\n const cx = ((x1 + x2) / 2 + appState.scrollX) * window.devicePixelRatio;\n const cy = ((y1 + y2) / 2 + appState.scrollY) * window.devicePixelRatio;\n context.save();\n context.scale(1 / window.devicePixelRatio, 1 / window.devicePixelRatio);\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, allElementsMap);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(element) && boundTextElement) {\n const offsetX = (elementWithCanvas.boundTextCanvas.width - elementWithCanvas.canvas.width) / 2;\n const offsetY = (elementWithCanvas.boundTextCanvas.height - elementWithCanvas.canvas.height) / 2;\n context.translate(cx, cy);\n context.drawImage(elementWithCanvas.boundTextCanvas, -(x2 - x1) / 2 * window.devicePixelRatio - offsetX / zoom - padding, -(y2 - y1) / 2 * window.devicePixelRatio - offsetY / zoom - padding, elementWithCanvas.boundTextCanvas.width / zoom, elementWithCanvas.boundTextCanvas.height / zoom);\n } else {\n // we translate context to element center so that rotation and scale\n // originates from the element center\n context.translate(cx, cy);\n context.rotate(element.angle);\n\n if (\"scale\" in elementWithCanvas.element && !isPendingImageElement(element, renderConfig) && !(0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isIframeLikeElement)(element) //zsviczian\n ) {\n context.scale(elementWithCanvas.element.scale[0], elementWithCanvas.element.scale[1]);\n } // revert afterwards we don't have account for it during drawing\n\n\n context.translate(-cx, -cy);\n context.drawImage(elementWithCanvas.canvas, (x1 + appState.scrollX) * window.devicePixelRatio - padding * elementWithCanvas.scale / elementWithCanvas.scale, (y1 + appState.scrollY) * window.devicePixelRatio - padding * elementWithCanvas.scale / elementWithCanvas.scale, elementWithCanvas.canvas.width / elementWithCanvas.scale, elementWithCanvas.canvas.height / elementWithCanvas.scale);\n\n if (false) {}\n }\n\n context.restore(); // Clear the nested element we appended to the DOM\n};\n\nconst renderSelectionElement = (element, context, appState, selectionColor) => {\n context.save();\n context.translate(element.x + appState.scrollX, element.y + appState.scrollY);\n context.fillStyle = \"rgba(0, 0, 200, 0.04)\"; // render from 0.5px offset to get 1px wide line\n // https://stackoverflow.com/questions/7530593/html5-canvas-and-line-width/7531540#7531540\n // TODO can be be improved by offseting to the negative when user selects\n // from right to left\n\n const offset = 0.5 / appState.zoom.value;\n context.fillRect(offset, offset, element.width, element.height);\n context.lineWidth = 1.5 / appState.zoom.value; //zsviczian changed from 1 to 1.5\n\n context.strokeStyle = selectionColor;\n context.strokeRect(offset, offset, element.width, element.height);\n context.restore();\n};\nconst renderElement = (element, elementsMap, allElementsMap, rc, context, renderConfig, appState) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n\n const reduceAlphaForSelection = ((_a = appState.openDialog) === null || _a === void 0 ? void 0 : _a.name) === \"elementLinkSelector\" && !appState.selectedElementIds[element.id] && !appState.hoveredElementIds[element.id];\n context.globalAlpha = getRenderOpacity(element, (0,_frame__WEBPACK_IMPORTED_MODULE_10__.getContainingFrame)(element, elementsMap), renderConfig.elementsPendingErasure, renderConfig.pendingFlowchartNodes, reduceAlphaForSelection ? _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_REDUCED_GLOBAL_ALPHA : 1);\n\n switch (element.type) {\n case \"magicframe\":\n case \"frame\":\n {\n if ( //zsviczian\n appState.frameRendering.enabled && appState.frameRendering.outline && !(!appState.frameRendering.markerEnabled && element.frameRole === \"marker\")) {\n context.save();\n context.translate(element.x + appState.scrollX, element.y + appState.scrollY);\n context.fillStyle = (_f = (_d = (_c = (_b = element.customData) === null || _b === void 0 ? void 0 : _b.frameColor) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : (_e = appState === null || appState === void 0 ? void 0 : appState.frameColor) === null || _e === void 0 ? void 0 : _e.fill) !== null && _f !== void 0 ? _f : \"rgba(0, 0, 200, 0.04)\"; //zsviczian\n\n context.lineWidth = _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.FRAME_STYLE.strokeWidth / appState.zoom.value;\n context.strokeStyle = (_l = (_j = (_h = (_g = element.customData) === null || _g === void 0 ? void 0 : _g.frameColor) === null || _h === void 0 ? void 0 : _h.stroke) !== null && _j !== void 0 ? _j : (_k = appState === null || appState === void 0 ? void 0 : appState.frameColor) === null || _k === void 0 ? void 0 : _k.stroke) !== null && _l !== void 0 ? _l : _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.FRAME_STYLE.strokeColor; //zsviczian\n // TODO change later to only affect AI frames\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isMagicFrameElement)(element)) {\n context.strokeStyle = appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.THEME.LIGHT ? \"#7affd7\" : \"#1d8264\";\n } //zsviczian\n\n\n if (element.frameRole === \"marker\") {\n const dash = 8 / appState.zoom.value;\n const gap = 6 / appState.zoom.value;\n context.setLineDash([dash, gap]);\n }\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.FRAME_STYLE.radius && context.roundRect && element.frameRole !== \"marker\") {\n //zsviczian\n context.beginPath();\n context.roundRect(0, 0, element.width, element.height, _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.FRAME_STYLE.radius / appState.zoom.value);\n context.stroke();\n context.closePath();\n } else {\n context.strokeRect(0, 0, element.width, element.height);\n }\n\n context.restore();\n }\n\n break;\n }\n\n case \"freedraw\":\n {\n // TODO investigate if we can do this in situ. Right now we need to call\n // beforehand because math helpers (such as getElementAbsoluteCoords)\n // rely on existing shapes\n _shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.generateElementShape(element, null);\n\n if (renderConfig.isExporting) {\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const cx = (x1 + x2) / 2 + appState.scrollX;\n const cy = (y1 + y2) / 2 + appState.scrollY;\n const shiftX = (x2 - x1) / 2 - (element.x - x1);\n const shiftY = (y2 - y1) / 2 - (element.y - y1);\n context.save();\n context.translate(cx, cy);\n context.rotate(element.angle);\n context.translate(-shiftX, -shiftY);\n drawElementOnCanvas(element, rc, context, renderConfig);\n context.restore();\n } else {\n const elementWithCanvas = generateElementWithCanvas(element, allElementsMap, renderConfig, appState);\n\n if (!elementWithCanvas) {\n return;\n }\n\n drawElementFromCanvas(elementWithCanvas, context, renderConfig, appState, allElementsMap);\n }\n\n break;\n }\n\n case \"rectangle\":\n case \"diamond\":\n case \"ellipse\":\n case \"line\":\n case \"arrow\":\n case \"image\":\n case \"text\":\n case \"iframe\":\n case \"embeddable\":\n {\n // TODO investigate if we can do this in situ. Right now we need to call\n // beforehand because math helpers (such as getElementAbsoluteCoords)\n // rely on existing shapes\n _shape__WEBPACK_IMPORTED_MODULE_12__.ShapeCache.generateElementShape(element, renderConfig);\n\n if (renderConfig.isExporting) {\n const [x1, y1, x2, y2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const cx = (x1 + x2) / 2 + appState.scrollX;\n const cy = (y1 + y2) / 2 + appState.scrollY;\n let shiftX = (x2 - x1) / 2 - (element.x - x1);\n let shiftY = (y2 - y1) / 2 - (element.y - y1);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element)) {\n const container = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getContainerElement)(element, elementsMap);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(container)) {\n const boundTextCoords = _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getBoundTextElementPosition(container, element, elementsMap);\n shiftX = (x2 - x1) / 2 - (boundTextCoords.x - x1);\n shiftY = (y2 - y1) / 2 - (boundTextCoords.y - y1);\n }\n }\n\n context.save();\n context.translate(cx, cy);\n\n if (shouldResetImageFilter(element, renderConfig, appState)) {\n context.filter = \"none\";\n }\n\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isArrowElement)(element) && boundTextElement) {\n const tempCanvas = document.createElement(\"canvas\");\n const tempCanvasContext = tempCanvas.getContext(\"2d\"); // Take max dimensions of arrow canvas so that when canvas is rotated\n // the arrow doesn't get clipped\n\n const maxDim = Math.max((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(x1, x2), (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.distance)(y1, y2));\n const padding = getCanvasPadding(element);\n tempCanvas.width = maxDim * appState.exportScale + padding * 10 * appState.exportScale;\n tempCanvas.height = maxDim * appState.exportScale + padding * 10 * appState.exportScale;\n tempCanvasContext.translate(tempCanvas.width / 2, tempCanvas.height / 2);\n tempCanvasContext.scale(appState.exportScale, appState.exportScale); // Shift the canvas to left most point of the arrow\n\n shiftX = element.width / 2 - (element.x - x1);\n shiftY = element.height / 2 - (element.y - y1);\n tempCanvasContext.rotate(element.angle);\n const tempRc = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].canvas(tempCanvas);\n tempCanvasContext.translate(-shiftX, -shiftY);\n drawElementOnCanvas(element, tempRc, tempCanvasContext, renderConfig);\n tempCanvasContext.translate(shiftX, shiftY);\n tempCanvasContext.rotate(-element.angle); // Shift the canvas to center of bound text\n\n const [,,,, boundTextCx, boundTextCy] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(boundTextElement, elementsMap);\n const boundTextShiftX = (x1 + x2) / 2 - boundTextCx;\n const boundTextShiftY = (y1 + y2) / 2 - boundTextCy;\n tempCanvasContext.translate(-boundTextShiftX, -boundTextShiftY); // Clear the bound text area\n\n tempCanvasContext.clearRect(-boundTextElement.width / 2, -boundTextElement.height / 2, boundTextElement.width, boundTextElement.height);\n context.scale(1 / appState.exportScale, 1 / appState.exportScale);\n context.drawImage(tempCanvas, -tempCanvas.width / 2, -tempCanvas.height / 2, tempCanvas.width, tempCanvas.height);\n } else {\n context.rotate(element.angle);\n\n if (element.type === \"image\") {\n // note: scale must be applied *after* rotating\n context.scale(element.scale[0], element.scale[1]);\n }\n\n context.translate(-shiftX, -shiftY);\n drawElementOnCanvas(element, rc, context, renderConfig);\n }\n\n context.restore(); // not exporting → optimized rendering (cache & render from element\n // canvases)\n } else {\n const elementWithCanvas = generateElementWithCanvas(element, allElementsMap, renderConfig, appState);\n\n if (!elementWithCanvas) {\n return;\n }\n\n const currentImageSmoothingStatus = context.imageSmoothingEnabled;\n\n if ( // do not disable smoothing during zoom as blurry shapes look better\n // on low resolution (while still zooming in) than sharp ones\n !(appState === null || appState === void 0 ? void 0 : appState.shouldCacheIgnoreZoom) && ( // angle is 0 -> always disable smoothing\n !element.angle || // or check if angle is a right angle in which case we can still\n // disable smoothing without adversely affecting the result\n // We need less-than comparison because of FP artihmetic\n (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.isRightAngleRads)(element.angle))) {\n // Disabling smoothing makes output much sharper, especially for\n // text. Unless for non-right angles, where the aliasing is really\n // terrible on Chromium.\n //\n // Note that `context.imageSmoothingQuality=\"high\"` has almost\n // zero effect.\n //\n context.imageSmoothingEnabled = false;\n }\n\n if (element.id === appState.croppingElementId && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isImageElement)(elementWithCanvas.element) && elementWithCanvas.element.crop !== null) {\n context.save();\n context.globalAlpha = 0.1;\n const uncroppedElementCanvas = generateElementCanvas((0,_cropElement__WEBPACK_IMPORTED_MODULE_5__.getUncroppedImageElement)(elementWithCanvas.element, elementsMap), allElementsMap, appState.zoom, renderConfig, appState);\n\n if (uncroppedElementCanvas) {\n drawElementFromCanvas(uncroppedElementCanvas, context, renderConfig, appState, allElementsMap);\n }\n\n context.restore();\n }\n\n drawElementFromCanvas(elementWithCanvas, context, renderConfig, appState, allElementsMap); // reset\n\n context.imageSmoothingEnabled = currentImageSmoothingStatus;\n }\n\n break;\n }\n\n default:\n {\n // @ts-ignore\n throw new Error(`Unimplemented type ${element.type}`);\n }\n }\n\n context.globalAlpha = 1;\n};\nconst pathsCache = new WeakMap([]);\nfunction generateFreeDrawShape(element) {\n const svgPathData = getFreeDrawSvgPath(element);\n const path = new Path2D(svgPathData);\n pathsCache.set(element, path);\n return path;\n}\nfunction getFreeDrawPath2D(element) {\n return pathsCache.get(element);\n}\nfunction getFreeDrawSvgPath(element) {\n return getSvgPathFromStroke(getFreedrawOutlinePoints(element));\n}\nfunction getFreedrawOutlineAsSegments(element, points, elementsMap) {\n const bounds = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementBounds)(Object.assign(Object.assign({}, element), {\n angle: 0\n }), elementsMap);\n const center = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)((bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2);\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.invariant)(points.length >= 2, \"Freepath outline must have at least 2 points\");\n return points.slice(2).reduce((acc, curr) => {\n acc.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(acc[acc.length - 1][1], (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(curr[0] + element.x, curr[1] + element.y), center, element.angle)));\n return acc;\n }, [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[0][0] + element.x, points[0][1] + element.y), center, element.angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[1][0] + element.x, points[1][1] + element.y), center, element.angle))]);\n}\nfunction getFreedrawOutlinePoints(element) {\n var _a, _b, _c, _d, _e, _f, _g, _h; // If input points are empty (should they ever be?) return a dot\n\n\n const inputPoints = element.simulatePressure ? element.points : element.points.length ? element.points.map(([x, y], i) => [x, y, element.pressures[i]]) : [[0, 0, 0.5]]; // Consider changing the options for simulated pressure vs real pressure\n\n const customOptions = (_b = (_a = element.customData) === null || _a === void 0 ? void 0 : _a.strokeOptions) === null || _b === void 0 ? void 0 : _b.options; //zsviczian\n\n const options = customOptions //zsviczian\n ? Object.assign(Object.assign(Object.assign(Object.assign({}, customOptions), {\n simulatePressure: (_c = customOptions.simulatePressure) !== null && _c !== void 0 ? _c : element.simulatePressure,\n size: element.strokeWidth * 4.25,\n last: true,\n easing: (_d = _easingFunctions__WEBPACK_IMPORTED_MODULE_13__[\"default\"][customOptions.easing]) !== null && _d !== void 0 ? _d : t => t\n }), ((_e = customOptions.start) === null || _e === void 0 ? void 0 : _e.easing) ? {\n start: Object.assign(Object.assign({}, customOptions.start), {\n easing: (_f = _easingFunctions__WEBPACK_IMPORTED_MODULE_13__[\"default\"][customOptions.start.easing]) !== null && _f !== void 0 ? _f : t => t\n })\n } : {\n start: customOptions.start\n }), ((_g = customOptions.end) === null || _g === void 0 ? void 0 : _g.easing) ? {\n end: Object.assign(Object.assign({}, customOptions.end), {\n easing: (_h = _easingFunctions__WEBPACK_IMPORTED_MODULE_13__[\"default\"][customOptions.end.easing]) !== null && _h !== void 0 ? _h : t => t\n })\n } : {\n end: customOptions.end\n }) : {\n simulatePressure: element.simulatePressure,\n size: element.strokeWidth * 4.25,\n thinning: 0.6,\n smoothing: 0.5,\n streamline: 0.5,\n easing: _easingFunctions__WEBPACK_IMPORTED_MODULE_13__[\"default\"].easeOutSine,\n last: true\n };\n return (0,perfect_freehand__WEBPACK_IMPORTED_MODULE_1__.getStroke)(inputPoints, options);\n}\n\nfunction med(A, B) {\n return [(A[0] + B[0]) / 2, (A[1] + B[1]) / 2];\n} // Trim SVG path data so number are each two decimal points. This\n// improves SVG exports, and prevents rendering errors on points\n// with long decimals.\n\n\nconst TO_FIXED_PRECISION = /(\\s?[A-Z]?,?-?[0-9]*\\.[0-9]{0,2})(([0-9]|e|-)*)/g;\n\nfunction getSvgPathFromStroke(points) {\n if (!points.length) {\n return \"\";\n }\n\n const max = points.length - 1;\n return points.reduce((acc, point, i, arr) => {\n if (i === max) {\n acc.push(point, med(point, arr[0]), \"L\", arr[0], \"Z\");\n } else {\n acc.push(point, med(point, arr[i + 1]));\n }\n\n return acc;\n }, [\"M\", points[0], \"Q\"]).join(\" \").replace(TO_FIXED_PRECISION, \"$1\");\n}\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/renderElement.ts?");
|
|
13425
13425
|
|
|
13426
13426
|
/***/ }),
|
|
13427
13427
|
|
|
@@ -14246,7 +14246,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
14246
14246
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
14247
14247
|
|
|
14248
14248
|
"use strict";
|
|
14249
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ trackEvent: () => (/* binding */ trackEvent)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n// place here categories that you want to track. We want to track just a\n // small subset of categories at a given time.\n\nconst ALLOWED_CATEGORIES_TO_TRACK = new Set([\"command_palette\", \"export\"]);\nconst trackEvent = (category, action, label, value) => {\n try {\n if (typeof window === \"undefined\" || ({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-
|
|
14249
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ trackEvent: () => (/* binding */ trackEvent)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n// place here categories that you want to track. We want to track just a\n // small subset of categories at a given time.\n\nconst ALLOWED_CATEGORIES_TO_TRACK = new Set([\"command_palette\", \"export\"]);\nconst trackEvent = (category, action, label, value) => {\n try {\n if (typeof window === \"undefined\" || ({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-58\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true}).VITE_WORKER_ID || \"true\" !== \"true\") {\n return;\n }\n\n if (!ALLOWED_CATEGORIES_TO_TRACK.has(category)) {\n return;\n }\n\n if ((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.isDevEnv)()) {\n // comment out to debug in dev\n return;\n }\n\n if (true) {\n console.info(\"trackEvent\", {\n category,\n action,\n label,\n value\n });\n }\n\n if (window.sa_event) {\n window.sa_event(action, {\n category,\n label,\n value\n });\n }\n } catch (error) {\n console.error(\"error during analytics\", error);\n }\n};\n\n//# sourceURL=webpack://ExcalidrawLib/./analytics.ts?");
|
|
14250
14250
|
|
|
14251
14251
|
/***/ }),
|
|
14252
14252
|
|
|
@@ -16479,7 +16479,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
16479
16479
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
16480
16480
|
|
|
16481
16481
|
"use strict";
|
|
16482
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ INTERACTIVE_SCENE_ANIMATION_KEY: () => (/* binding */ INTERACTIVE_SCENE_ANIMATION_KEY),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_excalidraw_renderer_animation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/excalidraw/renderer/animation */ \"./renderer/animation.ts\");\n/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../i18n */ \"./i18n.ts\");\n/* harmony import */ var _renderer_interactiveScene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../renderer/interactiveScene */ \"./renderer/interactiveScene.ts\");\n\n\n\n\n\nconst INTERACTIVE_SCENE_ANIMATION_KEY = \"animateInteractiveScene\";\n\nconst InteractiveCanvas = props => {\n const isComponentMounted = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);\n const rendererParams = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);\n (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n var _a;\n\n if (!isComponentMounted.current) {\n isComponentMounted.current = true;\n return;\n }\n\n const remotePointerButton = new Map();\n const remotePointerViewportCoords = new Map();\n const remoteSelectedElementIds = new Map();\n const remotePointerUsernames = new Map();\n const remotePointerUserStates = new Map();\n props.appState.collaborators.forEach((user, socketId) => {\n if (user.selectedElementIds) {\n for (const id of Object.keys(user.selectedElementIds)) {\n if (!remoteSelectedElementIds.has(id)) {\n remoteSelectedElementIds.set(id, []);\n }\n\n remoteSelectedElementIds.get(id).push(socketId);\n }\n }\n\n if (!user.pointer || user.pointer.renderCursor === false) {\n return;\n }\n\n if (user.username) {\n remotePointerUsernames.set(socketId, user.username);\n }\n\n if (user.userState) {\n remotePointerUserStates.set(socketId, user.userState);\n }\n\n remotePointerViewportCoords.set(socketId, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.sceneCoordsToViewportCoords)({\n sceneX: user.pointer.x,\n sceneY: user.pointer.y\n }, props.appState));\n remotePointerButton.set(socketId, user.button);\n });\n const selectionColor = ((_a = props.containerRef) === null || _a === void 0 ? void 0 : _a.current) && getComputedStyle(props.containerRef.current).getPropertyValue(\"--color-selection\") || \"#6965db\";\n rendererParams.current = {\n app: props.app,\n canvas: props.canvas,\n elementsMap: props.elementsMap,\n visibleElements: props.visibleElements,\n selectedElements: props.selectedElements,\n allElementsMap: props.allElementsMap,\n scale: window.devicePixelRatio,\n appState: props.appState,\n renderConfig: {\n remotePointerViewportCoords,\n remotePointerButton,\n remoteSelectedElementIds,\n remotePointerUsernames,\n remotePointerUserStates,\n selectionColor,\n renderScrollbars: props.renderScrollbars,\n // NOTE not memoized on so we don't rerender on cursor move\n lastViewportPosition: props.app.lastViewportPosition\n },\n editorInterface: props.editorInterface,\n callback: props.renderInteractiveSceneCallback,\n animationState: {\n bindingHighlight: undefined\n },\n deltaTime: 0\n };\n\n if (!_excalidraw_excalidraw_renderer_animation__WEBPACK_IMPORTED_MODULE_2__.AnimationController.running(INTERACTIVE_SCENE_ANIMATION_KEY)) {\n _excalidraw_excalidraw_renderer_animation__WEBPACK_IMPORTED_MODULE_2__.AnimationController.start(INTERACTIVE_SCENE_ANIMATION_KEY, ({\n deltaTime,\n state\n }) => {\n const nextAnimationState = (0,_renderer_interactiveScene__WEBPACK_IMPORTED_MODULE_4__.renderInteractiveScene)(Object.assign(Object.assign({}, rendererParams.current), {\n deltaTime,\n animationState: state\n })).animationState;\n\n if (nextAnimationState) {\n for (const key in nextAnimationState) {\n if (nextAnimationState[key] !== undefined) {\n return nextAnimationState;\n }\n }\n }\n\n return undefined;\n });\n }\n });\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"canvas\", {\n className: \"excalidraw__canvas interactive\",\n style: {\n width: props.appState.width,\n height: props.appState.height,\n cursor: props.appState.viewModeEnabled ? _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.CURSOR_TYPE.GRAB : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.CURSOR_TYPE.AUTO\n },\n width: props.appState.width * props.scale,\n height: props.appState.height * props.scale,\n ref: props.handleCanvasRef,\n onContextMenu: props.onContextMenu,\n onPointerMove: props.onPointerMove,\n onPointerUp: props.onPointerUp,\n onPointerCancel: props.onPointerCancel,\n onTouchMove: props.onTouchMove,\n onPointerDown: props.onPointerDown,\n onDoubleClick: props.onDoubleClick\n }, (0,_i18n__WEBPACK_IMPORTED_MODULE_3__.t)(\"labels.drawingCanvas\"));\n};\n\nconst getRelevantAppStateProps = appState => ({\n zoom: appState.zoom,\n scrollX: appState.scrollX,\n scrollY: appState.scrollY,\n width: appState.width,\n height: appState.height,\n viewModeEnabled: appState.viewModeEnabled,\n openDialog: appState.openDialog,\n editingGroupId: appState.editingGroupId,\n selectedElementIds: appState.selectedElementIds,\n frameToHighlight: appState.frameToHighlight,\n offsetLeft: appState.offsetLeft,\n offsetTop: appState.offsetTop,\n theme: appState.theme,\n selectionElement: appState.selectionElement,\n selectedGroupIds: appState.selectedGroupIds,\n selectedLinearElement: appState.selectedLinearElement,\n multiElement: appState.multiElement,\n newElement: appState.newElement,\n isBindingEnabled: appState.isBindingEnabled,\n suggestedBinding: appState.suggestedBinding,\n isRotating: appState.isRotating,\n elementsToHighlight: appState.elementsToHighlight,\n collaborators: appState.collaborators,\n activeEmbeddable: appState.activeEmbeddable,\n snapLines: appState.snapLines,\n zenModeEnabled: appState.zenModeEnabled,\n editingTextElement: appState.editingTextElement,\n gridColor: appState.gridColor,\n gridDirection: appState.gridDirection,\n highlightSearchResult: appState.highlightSearchResult,\n isCropping: appState.isCropping,\n croppingElementId: appState.croppingElementId,\n searchMatches: appState.searchMatches,\n activeLockedId: appState.activeLockedId,\n hoveredElementIds: appState.hoveredElementIds,\n frameRendering: appState.frameRendering,\n frameColor: appState.frameColor,\n shouldCacheIgnoreZoom: appState.shouldCacheIgnoreZoom,\n exportScale: appState.exportScale\n});\n\nconst areEqual = (prevProps, nextProps) => {\n // This could be further optimised if needed, as we don't have to render interactive canvas on each scene mutation\n if (prevProps.selectionNonce !== nextProps.selectionNonce || prevProps.sceneNonce !== nextProps.sceneNonce || prevProps.scale !== nextProps.scale || // we need to memoize on elementsMap because they may have renewed\n // even if sceneNonce didn't change (e.g. we filter elements out based\n // on appState)\n prevProps.elementsMap !== nextProps.elementsMap || prevProps.visibleElements !== nextProps.visibleElements || prevProps.selectedElements !== nextProps.selectedElements || prevProps.renderScrollbars !== nextProps.renderScrollbars) {\n return false;\n } // Comparing the interactive appState for changes in case of some edge cases\n\n\n return (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.isShallowEqual)( // asserting AppState because we're being passed the whole AppState\n // but resolve to only the InteractiveCanvas-relevant props\n getRelevantAppStateProps(prevProps.appState), getRelevantAppStateProps(nextProps.appState));\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().memo(InteractiveCanvas, areEqual));\n\n//# sourceURL=webpack://ExcalidrawLib/./components/canvases/InteractiveCanvas.tsx?");
|
|
16482
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ INTERACTIVE_SCENE_ANIMATION_KEY: () => (/* binding */ INTERACTIVE_SCENE_ANIMATION_KEY),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_excalidraw_renderer_animation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/excalidraw/renderer/animation */ \"./renderer/animation.ts\");\n/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../i18n */ \"./i18n.ts\");\n/* harmony import */ var _renderer_interactiveScene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../renderer/interactiveScene */ \"./renderer/interactiveScene.ts\");\n\n\n\n\n\nconst INTERACTIVE_SCENE_ANIMATION_KEY = \"animateInteractiveScene\";\n\nconst InteractiveCanvas = props => {\n const isComponentMounted = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);\n const rendererParams = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);\n (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n var _a;\n\n if (!isComponentMounted.current) {\n isComponentMounted.current = true;\n return;\n }\n\n const remotePointerButton = new Map();\n const remotePointerViewportCoords = new Map();\n const remoteSelectedElementIds = new Map();\n const remotePointerUsernames = new Map();\n const remotePointerUserStates = new Map();\n props.appState.collaborators.forEach((user, socketId) => {\n if (user.selectedElementIds) {\n for (const id of Object.keys(user.selectedElementIds)) {\n if (!remoteSelectedElementIds.has(id)) {\n remoteSelectedElementIds.set(id, []);\n }\n\n remoteSelectedElementIds.get(id).push(socketId);\n }\n }\n\n if (!user.pointer || user.pointer.renderCursor === false) {\n return;\n }\n\n if (user.username) {\n remotePointerUsernames.set(socketId, user.username);\n }\n\n if (user.userState) {\n remotePointerUserStates.set(socketId, user.userState);\n }\n\n remotePointerViewportCoords.set(socketId, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.sceneCoordsToViewportCoords)({\n sceneX: user.pointer.x,\n sceneY: user.pointer.y\n }, props.appState));\n remotePointerButton.set(socketId, user.button);\n });\n const selectionColor = ((_a = props.containerRef) === null || _a === void 0 ? void 0 : _a.current) && getComputedStyle(props.containerRef.current).getPropertyValue(\"--color-selection\") || \"#6965db\";\n rendererParams.current = {\n app: props.app,\n canvas: props.canvas,\n elementsMap: props.elementsMap,\n visibleElements: props.visibleElements,\n selectedElements: props.selectedElements,\n allElementsMap: props.allElementsMap,\n scale: window.devicePixelRatio,\n appState: props.appState,\n renderConfig: {\n remotePointerViewportCoords,\n remotePointerButton,\n remoteSelectedElementIds,\n remotePointerUsernames,\n remotePointerUserStates,\n selectionColor,\n renderScrollbars: props.renderScrollbars,\n // NOTE not memoized on so we don't rerender on cursor move\n lastViewportPosition: props.app.lastViewportPosition\n },\n editorInterface: props.editorInterface,\n callback: props.renderInteractiveSceneCallback,\n animationState: {\n bindingHighlight: undefined\n },\n deltaTime: 0\n };\n\n if (!_excalidraw_excalidraw_renderer_animation__WEBPACK_IMPORTED_MODULE_2__.AnimationController.running(INTERACTIVE_SCENE_ANIMATION_KEY)) {\n _excalidraw_excalidraw_renderer_animation__WEBPACK_IMPORTED_MODULE_2__.AnimationController.start(INTERACTIVE_SCENE_ANIMATION_KEY, ({\n deltaTime,\n state\n }) => {\n const nextAnimationState = (0,_renderer_interactiveScene__WEBPACK_IMPORTED_MODULE_4__.renderInteractiveScene)(Object.assign(Object.assign({}, rendererParams.current), {\n deltaTime,\n animationState: state\n })).animationState;\n\n if (nextAnimationState) {\n for (const key in nextAnimationState) {\n if (nextAnimationState[key] !== undefined) {\n return nextAnimationState;\n }\n }\n }\n\n return undefined;\n });\n }\n });\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"canvas\", {\n className: \"excalidraw__canvas interactive\",\n style: {\n width: props.appState.width,\n height: props.appState.height,\n cursor: props.appState.viewModeEnabled ? _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.CURSOR_TYPE.GRAB : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.CURSOR_TYPE.AUTO\n },\n width: props.appState.width * props.scale,\n height: props.appState.height * props.scale,\n ref: props.handleCanvasRef,\n onContextMenu: props.onContextMenu,\n onPointerMove: props.onPointerMove,\n onPointerUp: props.onPointerUp,\n onPointerCancel: props.onPointerCancel,\n onTouchMove: props.onTouchMove,\n onPointerDown: props.onPointerDown,\n onDoubleClick: props.onDoubleClick\n }, (0,_i18n__WEBPACK_IMPORTED_MODULE_3__.t)(\"labels.drawingCanvas\"));\n};\n\nconst getRelevantAppStateProps = appState => ({\n zoom: appState.zoom,\n scrollX: appState.scrollX,\n scrollY: appState.scrollY,\n width: appState.width,\n height: appState.height,\n viewModeEnabled: appState.viewModeEnabled,\n openDialog: appState.openDialog,\n editingGroupId: appState.editingGroupId,\n selectedElementIds: appState.selectedElementIds,\n frameToHighlight: appState.frameToHighlight,\n offsetLeft: appState.offsetLeft,\n offsetTop: appState.offsetTop,\n theme: appState.theme,\n selectionElement: appState.selectionElement,\n selectedGroupIds: appState.selectedGroupIds,\n selectedLinearElement: appState.selectedLinearElement,\n multiElement: appState.multiElement,\n newElement: appState.newElement,\n isBindingEnabled: appState.isBindingEnabled,\n suggestedBinding: appState.suggestedBinding,\n isRotating: appState.isRotating,\n elementsToHighlight: appState.elementsToHighlight,\n collaborators: appState.collaborators,\n activeEmbeddable: appState.activeEmbeddable,\n snapLines: appState.snapLines,\n zenModeEnabled: appState.zenModeEnabled,\n editingTextElement: appState.editingTextElement,\n viewBackgroundColor: appState.viewBackgroundColor,\n gridColor: appState.gridColor,\n gridDirection: appState.gridDirection,\n highlightSearchResult: appState.highlightSearchResult,\n isCropping: appState.isCropping,\n croppingElementId: appState.croppingElementId,\n searchMatches: appState.searchMatches,\n activeLockedId: appState.activeLockedId,\n hoveredElementIds: appState.hoveredElementIds,\n frameRendering: appState.frameRendering,\n frameColor: appState.frameColor,\n shouldCacheIgnoreZoom: appState.shouldCacheIgnoreZoom,\n exportScale: appState.exportScale\n});\n\nconst areEqual = (prevProps, nextProps) => {\n // This could be further optimised if needed, as we don't have to render interactive canvas on each scene mutation\n if (prevProps.selectionNonce !== nextProps.selectionNonce || prevProps.sceneNonce !== nextProps.sceneNonce || prevProps.scale !== nextProps.scale || // we need to memoize on elementsMap because they may have renewed\n // even if sceneNonce didn't change (e.g. we filter elements out based\n // on appState)\n prevProps.elementsMap !== nextProps.elementsMap || prevProps.visibleElements !== nextProps.visibleElements || prevProps.selectedElements !== nextProps.selectedElements || prevProps.renderScrollbars !== nextProps.renderScrollbars) {\n return false;\n } // Comparing the interactive appState for changes in case of some edge cases\n\n\n return (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.isShallowEqual)( // asserting AppState because we're being passed the whole AppState\n // but resolve to only the InteractiveCanvas-relevant props\n getRelevantAppStateProps(prevProps.appState), getRelevantAppStateProps(nextProps.appState));\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().memo(InteractiveCanvas, areEqual));\n\n//# sourceURL=webpack://ExcalidrawLib/./components/canvases/InteractiveCanvas.tsx?");
|
|
16483
16483
|
|
|
16484
16484
|
/***/ }),
|
|
16485
16485
|
|
|
@@ -17205,7 +17205,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
17205
17205
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
17206
17206
|
|
|
17207
17207
|
"use strict";
|
|
17208
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExcalidrawFontFace: () => (/* binding */ ExcalidrawFontFace)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _subset_subset_main__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../subset/subset-main */ \"./subset/subset-main.ts\");\n/* harmony import */ var _data_encode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../data/encode */ \"./data/encode.ts\");\n/* harmony import */ var _obsidianUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../obsidianUtils */ \"./obsidianUtils.ts\");\n\n\n\n\nclass ExcalidrawFontFace {\n constructor(family, uri, descriptors) {\n this.urls = ExcalidrawFontFace.createUrls(uri);\n const sources = this.urls.map(url => `url(${url}) ${ExcalidrawFontFace.getFormat(url)}`).join(\", \");\n this.fontFace = new FontFace(family, sources, Object.assign({\n display: \"swap\",\n style: \"normal\",\n weight: \"400\"\n }, descriptors));\n }\n /**\r\n * Generates CSS `@font-face` definition with the (subsetted) font source as a data url for the characters within the unicode range.\r\n *\r\n * Retrieves `undefined` otherwise.\r\n */\n\n\n toCSS(characters) {\n // quick exit in case the characters are not within this font face's unicode range\n if (!this.getUnicodeRangeRegex().test(characters)) {\n return;\n } //zsviczian - only woffs are chopped into glyphs other fonts are returned as is\n\n\n if (typeof this.urls[0] === \"string\" && !this.urls[0].startsWith(\"data:font/woff2\")) {\n return Promise.resolve(`@font-face { font-family: ${this.fontFace.family}; src: url(${this.urls[0]}); }`);\n }\n\n const codepoints = Array.from(characters).map(char => char.codePointAt(0));\n return this.getContent(codepoints).then(content => `@font-face { font-family: ${this.fontFace.family}; src: url(${content}); }`);\n }\n /**\r\n * Tries to fetch woff2 content, based on the registered urls (from first to last, treated as fallbacks).\r\n *\r\n * @returns base64 with subsetted glyphs based on the passed codepoint, last defined url otherwise\r\n */\n\n\n async getContent(codePoints) {\n let i = 0;\n const errorMessages = [];\n\n while (i < this.urls.length) {\n const url = this.urls[i];\n\n try {\n const arrayBuffer = await this.fetchFont(url);\n const base64 = await (0,_subset_subset_main__WEBPACK_IMPORTED_MODULE_1__.subsetWoff2GlyphsByCodepoints)(arrayBuffer, codePoints);\n return base64;\n } catch (e) {\n errorMessages.push(`\"${url.toString()}\" returned error \"${e}\"`);\n }\n\n i++;\n }\n\n console.error(`Failed to fetch font family \"${this.fontFace.family}\"`, JSON.stringify(errorMessages, undefined, 2)); // in case of issues, at least return the last url as a content\n // defaults to unpkg for bundled fonts (so that we don't have to host them forever) and http url for others\n\n return this.urls.length ? this.urls[this.urls.length - 1].toString() : \"\";\n }\n\n fetchFont(url) {\n return (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.promiseTry)(async () => {\n const result = await (0,_obsidianUtils__WEBPACK_IMPORTED_MODULE_3__.fetchFontFromVault)(url); //zsviczian\n\n if (result) {\n return result;\n }\n\n const response = await fetch(url, {\n // always prefer cache (even stale), otherwise it always triggers an unnecessary validation request\n // which we don't need as we are controlling freshness of the fonts with the stable hash suffix in the url\n // https://developer.mozilla.org/en-US/docs/Web/API/Request/cache\n cache: \"force-cache\",\n headers: {\n Accept: \"font/woff2\"\n }\n });\n\n if (!response.ok) {\n const urlString = url instanceof URL ? url.toString() : \"dataurl\";\n throw new Error(`Failed to fetch \"${urlString}\": ${response.statusText}`);\n }\n\n const arrayBuffer = await response.arrayBuffer();\n return arrayBuffer;\n });\n }\n\n getUnicodeRangeRegex() {\n // using \\u{h} or \\u{hhhhh} to match any number of hex digits,\n // otherwise we would get an \"Invalid Unicode escape\" error\n // e.g. U+0-1007F -> \\u{0}-\\u{1007F}\n const unicodeRangeRegex = this.fontFace.unicodeRange.split(/,\\s*/).map(range => {\n const [start, end] = range.replace(\"U+\", \"\").split(\"-\");\n\n if (end) {\n return `\\\\u{${start}}-\\\\u{${end}}`;\n }\n\n return `\\\\u{${start}}`;\n }).join(\"\");\n return new RegExp(`[${unicodeRangeRegex}]`, \"u\");\n }\n\n static createUrls(uri) {\n if (uri.startsWith(\"data\")) {\n // don't create the URL instance, as parsing the huge dataurl string is expensive\n return [uri];\n }\n\n if (uri.startsWith(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.LOCAL_FONT_PROTOCOL)) {\n // no url for local fonts\n return [];\n }\n\n if (uri.startsWith(\"http\")) {\n // one url for http imports or data url\n return [new URL(uri)];\n } // absolute assets paths, which are found in tests and excalidraw-app build, won't work with base url, so we are stripping initial slash away\n\n\n const assetUrl = uri.replace(/^\\/+/, \"\");\n const urls = [];\n\n if (typeof window.EXCALIDRAW_ASSET_PATH === \"string\") {\n const normalizedBaseUrl = this.normalizeBaseUrl(window.EXCALIDRAW_ASSET_PATH);\n urls.push(new URL(assetUrl, normalizedBaseUrl));\n } else if (Array.isArray(window.EXCALIDRAW_ASSET_PATH)) {\n window.EXCALIDRAW_ASSET_PATH.forEach(path => {\n const normalizedBaseUrl = this.normalizeBaseUrl(path);\n urls.push(new URL(assetUrl, normalizedBaseUrl));\n });\n } // fallback url for bundled fonts\n\n\n urls.push(new URL(assetUrl, ExcalidrawFontFace.ASSETS_FALLBACK_URL));\n return urls;\n }\n\n static getFormat(url) {\n if (!(url instanceof URL)) {\n // format is irrelevant for data url\n return \"\";\n }\n\n try {\n const parts = new URL(url).pathname.split(\".\");\n\n if (parts.length === 1) {\n return \"\";\n }\n\n return `format('${parts.pop()}')`;\n } catch (error) {\n return \"\";\n }\n }\n\n static normalizeBaseUrl(baseUrl) {\n var _a;\n\n let result = baseUrl; // in case user passed a root-relative url (~absolute path),\n // like \"/\" or \"/some/path\", or relative (starts with \"./\"),\n // prepend it with `location.origin`\n\n if (/^\\.?\\//.test(result)) {\n result = new URL(result.replace(/^\\.?\\/+/, \"\"), (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.origin).toString();\n } // ensure there is a trailing slash, otherwise url won't be correctly concatenated\n\n\n result = `${result.replace(/\\/+$/, \"\")}/`;\n return result;\n }\n /**\r\n * zsviczian https://github.com/zsviczian/excalidraw/commit/b4cfaaa4b4f46ca01f94e27fb7bf651a9da99daa\r\n */\n\n\n async getContentLegacy() {\n let i = 0;\n const errorMessages = [];\n\n while (i < this.urls.length) {\n const url = this.urls[i];\n\n if (typeof url === \"string\" && url.startsWith(\"data:\")) {\n // it's dataurl, the font is inlined as base64, no need to fetch\n return url;\n }\n\n try {\n const result = await (0,_obsidianUtils__WEBPACK_IMPORTED_MODULE_3__.fetchFontFromVault)(url); //zsviczian\n\n if (result) {\n return `data:font/woff2;base64,${(0,_data_encode__WEBPACK_IMPORTED_MODULE_2__.stringToBase64)((0,_data_encode__WEBPACK_IMPORTED_MODULE_2__.toByteString)(result), true)}`;\n }\n\n const response = await fetch(url, {\n headers: {\n Accept: \"font/woff2\"\n }\n });\n\n if (response.ok) {\n const mimeType = response.headers.get(\"Content-Type\");\n const buffer = await response.arrayBuffer();\n return `data:${mimeType};base64,${(0,_data_encode__WEBPACK_IMPORTED_MODULE_2__.stringToBase64)((0,_data_encode__WEBPACK_IMPORTED_MODULE_2__.toByteString)(buffer), true)}`;\n } // response not ok, try to continue\n\n\n errorMessages.push(`\"${url.toString()}\" returned status \"${response.status}\"`);\n } catch (e) {\n errorMessages.push(`\"${url.toString()}\" returned error \"${e}\"`);\n }\n\n i++;\n }\n\n console.error(`Failed to fetch font \"${this.fontFace.family}\" from urls \"${this.urls.toString()}`, JSON.stringify(errorMessages, undefined, 2)); // in case of issues, at least return the last url as a content\n // defaults to unpkg for bundled fonts (so that we don't have to host them forever) and http url for others\n\n return this.urls.length ? this.urls[this.urls.length - 1].toString() : \"\";\n }\n\n}\nExcalidrawFontFace.ASSETS_FALLBACK_URL = `https://esm.sh/${({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-56\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true}).PKG_NAME ? `${({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-56\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true}).PKG_NAME}@${({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-56\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true}).PKG_VERSION}` // is provided during package build\n: \"@excalidraw/excalidraw\" // fallback to the latest package version (i.e. for app)\n}/dist/prod/`;\n\n//# sourceURL=webpack://ExcalidrawLib/./fonts/ExcalidrawFontFace.ts?");
|
|
17208
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExcalidrawFontFace: () => (/* binding */ ExcalidrawFontFace)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _subset_subset_main__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../subset/subset-main */ \"./subset/subset-main.ts\");\n/* harmony import */ var _data_encode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../data/encode */ \"./data/encode.ts\");\n/* harmony import */ var _obsidianUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../obsidianUtils */ \"./obsidianUtils.ts\");\n\n\n\n\nclass ExcalidrawFontFace {\n constructor(family, uri, descriptors) {\n this.urls = ExcalidrawFontFace.createUrls(uri);\n const sources = this.urls.map(url => `url(${url}) ${ExcalidrawFontFace.getFormat(url)}`).join(\", \");\n this.fontFace = new FontFace(family, sources, Object.assign({\n display: \"swap\",\n style: \"normal\",\n weight: \"400\"\n }, descriptors));\n }\n /**\r\n * Generates CSS `@font-face` definition with the (subsetted) font source as a data url for the characters within the unicode range.\r\n *\r\n * Retrieves `undefined` otherwise.\r\n */\n\n\n toCSS(characters) {\n // quick exit in case the characters are not within this font face's unicode range\n if (!this.getUnicodeRangeRegex().test(characters)) {\n return;\n } //zsviczian - only woffs are chopped into glyphs other fonts are returned as is\n\n\n if (typeof this.urls[0] === \"string\" && !this.urls[0].startsWith(\"data:font/woff2\")) {\n return Promise.resolve(`@font-face { font-family: ${this.fontFace.family}; src: url(${this.urls[0]}); }`);\n }\n\n const codepoints = Array.from(characters).map(char => char.codePointAt(0));\n return this.getContent(codepoints).then(content => `@font-face { font-family: ${this.fontFace.family}; src: url(${content}); }`);\n }\n /**\r\n * Tries to fetch woff2 content, based on the registered urls (from first to last, treated as fallbacks).\r\n *\r\n * @returns base64 with subsetted glyphs based on the passed codepoint, last defined url otherwise\r\n */\n\n\n async getContent(codePoints) {\n let i = 0;\n const errorMessages = [];\n\n while (i < this.urls.length) {\n const url = this.urls[i];\n\n try {\n const arrayBuffer = await this.fetchFont(url);\n const base64 = await (0,_subset_subset_main__WEBPACK_IMPORTED_MODULE_1__.subsetWoff2GlyphsByCodepoints)(arrayBuffer, codePoints);\n return base64;\n } catch (e) {\n errorMessages.push(`\"${url.toString()}\" returned error \"${e}\"`);\n }\n\n i++;\n }\n\n console.error(`Failed to fetch font family \"${this.fontFace.family}\"`, JSON.stringify(errorMessages, undefined, 2)); // in case of issues, at least return the last url as a content\n // defaults to unpkg for bundled fonts (so that we don't have to host them forever) and http url for others\n\n return this.urls.length ? this.urls[this.urls.length - 1].toString() : \"\";\n }\n\n fetchFont(url) {\n return (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.promiseTry)(async () => {\n const result = await (0,_obsidianUtils__WEBPACK_IMPORTED_MODULE_3__.fetchFontFromVault)(url); //zsviczian\n\n if (result) {\n return result;\n }\n\n const response = await fetch(url, {\n // always prefer cache (even stale), otherwise it always triggers an unnecessary validation request\n // which we don't need as we are controlling freshness of the fonts with the stable hash suffix in the url\n // https://developer.mozilla.org/en-US/docs/Web/API/Request/cache\n cache: \"force-cache\",\n headers: {\n Accept: \"font/woff2\"\n }\n });\n\n if (!response.ok) {\n const urlString = url instanceof URL ? url.toString() : \"dataurl\";\n throw new Error(`Failed to fetch \"${urlString}\": ${response.statusText}`);\n }\n\n const arrayBuffer = await response.arrayBuffer();\n return arrayBuffer;\n });\n }\n\n getUnicodeRangeRegex() {\n // using \\u{h} or \\u{hhhhh} to match any number of hex digits,\n // otherwise we would get an \"Invalid Unicode escape\" error\n // e.g. U+0-1007F -> \\u{0}-\\u{1007F}\n const unicodeRangeRegex = this.fontFace.unicodeRange.split(/,\\s*/).map(range => {\n const [start, end] = range.replace(\"U+\", \"\").split(\"-\");\n\n if (end) {\n return `\\\\u{${start}}-\\\\u{${end}}`;\n }\n\n return `\\\\u{${start}}`;\n }).join(\"\");\n return new RegExp(`[${unicodeRangeRegex}]`, \"u\");\n }\n\n static createUrls(uri) {\n if (uri.startsWith(\"data\")) {\n // don't create the URL instance, as parsing the huge dataurl string is expensive\n return [uri];\n }\n\n if (uri.startsWith(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.LOCAL_FONT_PROTOCOL)) {\n // no url for local fonts\n return [];\n }\n\n if (uri.startsWith(\"http\")) {\n // one url for http imports or data url\n return [new URL(uri)];\n } // absolute assets paths, which are found in tests and excalidraw-app build, won't work with base url, so we are stripping initial slash away\n\n\n const assetUrl = uri.replace(/^\\/+/, \"\");\n const urls = [];\n\n if (typeof window.EXCALIDRAW_ASSET_PATH === \"string\") {\n const normalizedBaseUrl = this.normalizeBaseUrl(window.EXCALIDRAW_ASSET_PATH);\n urls.push(new URL(assetUrl, normalizedBaseUrl));\n } else if (Array.isArray(window.EXCALIDRAW_ASSET_PATH)) {\n window.EXCALIDRAW_ASSET_PATH.forEach(path => {\n const normalizedBaseUrl = this.normalizeBaseUrl(path);\n urls.push(new URL(assetUrl, normalizedBaseUrl));\n });\n } // fallback url for bundled fonts\n\n\n urls.push(new URL(assetUrl, ExcalidrawFontFace.ASSETS_FALLBACK_URL));\n return urls;\n }\n\n static getFormat(url) {\n if (!(url instanceof URL)) {\n // format is irrelevant for data url\n return \"\";\n }\n\n try {\n const parts = new URL(url).pathname.split(\".\");\n\n if (parts.length === 1) {\n return \"\";\n }\n\n return `format('${parts.pop()}')`;\n } catch (error) {\n return \"\";\n }\n }\n\n static normalizeBaseUrl(baseUrl) {\n var _a;\n\n let result = baseUrl; // in case user passed a root-relative url (~absolute path),\n // like \"/\" or \"/some/path\", or relative (starts with \"./\"),\n // prepend it with `location.origin`\n\n if (/^\\.?\\//.test(result)) {\n result = new URL(result.replace(/^\\.?\\/+/, \"\"), (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.origin).toString();\n } // ensure there is a trailing slash, otherwise url won't be correctly concatenated\n\n\n result = `${result.replace(/\\/+$/, \"\")}/`;\n return result;\n }\n /**\r\n * zsviczian https://github.com/zsviczian/excalidraw/commit/b4cfaaa4b4f46ca01f94e27fb7bf651a9da99daa\r\n */\n\n\n async getContentLegacy() {\n let i = 0;\n const errorMessages = [];\n\n while (i < this.urls.length) {\n const url = this.urls[i];\n\n if (typeof url === \"string\" && url.startsWith(\"data:\")) {\n // it's dataurl, the font is inlined as base64, no need to fetch\n return url;\n }\n\n try {\n const result = await (0,_obsidianUtils__WEBPACK_IMPORTED_MODULE_3__.fetchFontFromVault)(url); //zsviczian\n\n if (result) {\n return `data:font/woff2;base64,${(0,_data_encode__WEBPACK_IMPORTED_MODULE_2__.stringToBase64)((0,_data_encode__WEBPACK_IMPORTED_MODULE_2__.toByteString)(result), true)}`;\n }\n\n const response = await fetch(url, {\n headers: {\n Accept: \"font/woff2\"\n }\n });\n\n if (response.ok) {\n const mimeType = response.headers.get(\"Content-Type\");\n const buffer = await response.arrayBuffer();\n return `data:${mimeType};base64,${(0,_data_encode__WEBPACK_IMPORTED_MODULE_2__.stringToBase64)((0,_data_encode__WEBPACK_IMPORTED_MODULE_2__.toByteString)(buffer), true)}`;\n } // response not ok, try to continue\n\n\n errorMessages.push(`\"${url.toString()}\" returned status \"${response.status}\"`);\n } catch (e) {\n errorMessages.push(`\"${url.toString()}\" returned error \"${e}\"`);\n }\n\n i++;\n }\n\n console.error(`Failed to fetch font \"${this.fontFace.family}\" from urls \"${this.urls.toString()}`, JSON.stringify(errorMessages, undefined, 2)); // in case of issues, at least return the last url as a content\n // defaults to unpkg for bundled fonts (so that we don't have to host them forever) and http url for others\n\n return this.urls.length ? this.urls[this.urls.length - 1].toString() : \"\";\n }\n\n}\nExcalidrawFontFace.ASSETS_FALLBACK_URL = `https://esm.sh/${({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-58\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true}).PKG_NAME ? `${({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-58\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true}).PKG_NAME}@${({\"MODE\":\"development\",\"VITE_APP_BACKEND_V2_GET_URL\":\"https://json-dev.excalidraw.com/api/v2/\",\"VITE_APP_BACKEND_V2_POST_URL\":\"https://json-dev.excalidraw.com/api/v2/post/\",\"VITE_APP_LIBRARY_URL\":\"https://libraries.excalidraw.com\",\"VITE_APP_LIBRARY_BACKEND\":\"https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries\",\"VITE_APP_WS_SERVER_URL\":\"http://localhost:3002\",\"VITE_APP_PLUS_LP\":\"https://plus.excalidraw.com\",\"VITE_APP_PLUS_APP\":\"http://localhost:3000\",\"VITE_APP_AI_BACKEND\":\"http://localhost:3015\",\"VITE_APP_FIREBASE_CONFIG\":\"{\\\"apiKey\\\":\\\"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8\\\",\\\"authDomain\\\":\\\"excalidraw-oss-dev.firebaseapp.com\\\",\\\"projectId\\\":\\\"excalidraw-oss-dev\\\",\\\"storageBucket\\\":\\\"excalidraw-oss-dev.appspot.com\\\",\\\"messagingSenderId\\\":\\\"664559512677\\\",\\\"appId\\\":\\\"1:664559512677:web:a385181f2928d328a7aa8c\\\"}\",\"VITE_APP_DEV_DISABLE_LIVE_RELOAD\":\"\",\"VITE_APP_ENABLE_TRACKING\":\"true\",\"FAST_REFRESH\":\"false\",\"VITE_APP_PORT\":\"3000\",\"VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX\":\"\",\"VITE_APP_COLLAPSE_OVERLAY\":\"true\",\"VITE_APP_ENABLE_ESLINT\":\"true\",\"VITE_APP_ENABLE_PWA\":\"false\",\"VITE_APP_PLUS_EXPORT_PUBLIC_KEY\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\\nHQIDAQAB\",\"VITE_APP_DISABLE_PREVENT_UNLOAD\":\"\",\"VITE_PKG_NAME\":\"@zsviczian/excalidraw\",\"VITE_PKG_VERSION\":\"0.18.0-58\",\"VITE_IS_EXCALIDRAW_NPM_PACKAGE\":true}).PKG_VERSION}` // is provided during package build\n: \"@excalidraw/excalidraw\" // fallback to the latest package version (i.e. for app)\n}/dist/prod/`;\n\n//# sourceURL=webpack://ExcalidrawLib/./fonts/ExcalidrawFontFace.ts?");
|
|
17209
17209
|
|
|
17210
17210
|
/***/ }),
|
|
17211
17211
|
|
|
@@ -20713,7 +20713,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
20713
20713
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20714
20714
|
|
|
20715
20715
|
"use strict";
|
|
20716
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _excalidraw_common_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common/constants */ \"../common/src/constants.ts\");\n\n\nif (\"development\" !== _excalidraw_common_constants__WEBPACK_IMPORTED_MODULE_0__.ENV.TEST) {\n /* eslint-disable */\n\n /* global __webpack_public_path__:writable */\n __webpack_require__.p = window.EXCALIDRAW_ASSET_PATH || `https://unpkg.com/${\"@zsviczian/excalidraw\"}@${\"0.18.0-
|
|
20716
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _excalidraw_common_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common/constants */ \"../common/src/constants.ts\");\n\n\nif (\"development\" !== _excalidraw_common_constants__WEBPACK_IMPORTED_MODULE_0__.ENV.TEST) {\n /* eslint-disable */\n\n /* global __webpack_public_path__:writable */\n __webpack_require__.p = window.EXCALIDRAW_ASSET_PATH || `https://unpkg.com/${\"@zsviczian/excalidraw\"}@${\"0.18.0-58\"}/dist/`;\n}\n\n//# sourceURL=webpack://ExcalidrawLib/./publicPath.js?");
|
|
20717
20717
|
|
|
20718
20718
|
/***/ }),
|
|
20719
20719
|
|
|
@@ -20757,7 +20757,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
20757
20757
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20758
20758
|
|
|
20759
20759
|
"use strict";
|
|
20760
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ renderInteractiveScene: () => (/* binding */ renderInteractiveScene)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var open_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! open-color */ \"../../node_modules/open-color/open-color.json\");\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _renderer_renderSnaps__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../renderer/renderSnaps */ \"./renderer/renderSnaps.ts\");\n/* harmony import */ var _renderer_roundRect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../renderer/roundRect */ \"./renderer/roundRect.ts\");\n/* harmony import */ var _scene_scrollbars__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../scene/scrollbars */ \"./scene/scrollbars.ts\");\n/* harmony import */ var _clients__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../clients */ \"./clients.ts\");\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./helpers */ \"./renderer/helpers.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst renderElbowArrowMidPointHighlight = (context, appState) => {\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.invariant)(appState.selectedLinearElement, \"selectedLinearElement is null\");\n const {\n segmentMidPointHoveredCoords\n } = appState.selectedLinearElement;\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.invariant)(segmentMidPointHoveredCoords, \"midPointCoords is null\");\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n highlightPoint(segmentMidPointHoveredCoords, context, appState);\n context.restore();\n};\n\nconst renderLinearElementPointHighlight = (context, appState, elementsMap) => {\n var _a, _b, _c;\n\n const {\n elementId,\n hoverPointIndex\n } = appState.selectedLinearElement;\n\n if (((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) && ((_c = (_b = appState.selectedLinearElement) === null || _b === void 0 ? void 0 : _b.selectedPointsIndices) === null || _c === void 0 ? void 0 : _c.includes(hoverPointIndex))) {\n return;\n }\n\n const element = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.getElement(elementId, elementsMap);\n\n if (!element) {\n return;\n }\n\n const point = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.getPointAtIndexGlobalCoordinates(element, hoverPointIndex, elementsMap);\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n highlightPoint(point, context, appState);\n context.restore();\n};\n\nconst highlightPoint = (point, context, appState) => {\n context.fillStyle = \"rgba(105, 101, 219, 0.4)\";\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.fillCircle)(context, point[0], point[1], _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.POINT_HANDLE_SIZE / appState.zoom.value, false);\n};\n\nconst renderSingleLinearPoint = (context, appState, point, radius, isSelected, isPhantomPoint, isOverlappingPoint) => {\n var _a;\n\n context.strokeStyle = \"#5e5ad8\";\n context.setLineDash([]);\n context.fillStyle = \"rgba(255, 255, 255, 0.9)\";\n\n if (isSelected) {\n context.fillStyle = \"rgba(134, 131, 226, 0.9)\";\n } else if (isPhantomPoint) {\n context.fillStyle = \"rgba(177, 151, 252, 0.7)\";\n }\n\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.fillCircle)(context, point[0], point[1], (isOverlappingPoint ? radius * (((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) ? 1.5 : 2) : radius) / appState.zoom.value, !isPhantomPoint, !isOverlappingPoint || isSelected);\n};\n\nconst renderBindingHighlightForBindableElement_simple = (context, element, elementsMap, appState, highlightedColor) => {\n const enclosingFrame = element.frameId && elementsMap.get(element.frameId);\n\n if (enclosingFrame && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(enclosingFrame)) {\n context.translate(enclosingFrame.x + appState.scrollX, enclosingFrame.y + appState.scrollY);\n context.fillStyle = highlightedColor !== null && highlightedColor !== void 0 ? highlightedColor : \"rgba(0,0,0,.05)\"; //zsviczian\n\n context.beginPath();\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius && context.roundRect) {\n context.roundRect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n } else {\n context.rect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1);\n }\n\n context.clip();\n context.translate(-(enclosingFrame.x + appState.scrollX), -(enclosingFrame.y + appState.scrollY));\n }\n\n switch (element.type) {\n case \"magicframe\":\n case \"frame\":\n context.save();\n context.strokeStyle = highlightedColor !== null && highlightedColor !== void 0 ? highlightedColor : \"rgba(0,0,0,.05)\"; //zsviczian\n\n context.translate(element.x + appState.scrollX, element.y + appState.scrollY);\n context.lineWidth = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.strokeWidth / appState.zoom.value;\n context.strokeStyle = appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.DARK ? `rgba(3, 93, 161, 1)` : `rgba(106, 189, 252, 1)`;\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius && context.roundRect) {\n context.beginPath();\n context.roundRect(0, 0, element.width, element.height, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n context.stroke();\n context.closePath();\n } else {\n context.strokeRect(0, 0, element.width, element.height);\n }\n\n context.restore();\n break;\n\n default:\n context.save();\n const center = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.elementCenterPoint)(element, elementsMap);\n context.translate(center[0], center[1]);\n context.rotate(element.angle);\n context.translate(-center[0], -center[1]);\n context.translate(element.x, element.y);\n context.lineWidth = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.clamp)(1.75, element.strokeWidth, 4) / Math.max(0.25, appState.zoom.value);\n context.strokeStyle = appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.DARK ? `rgba(3, 93, 161, 1)` : `rgba(106, 189, 252, 1)`;\n\n switch (element.type) {\n case \"ellipse\":\n context.beginPath();\n context.ellipse(element.width / 2, element.height / 2, element.width / 2, element.height / 2, 0, 0, 2 * Math.PI);\n context.closePath();\n context.stroke();\n break;\n\n case \"diamond\":\n {\n const [segments, curves] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.deconstructDiamondElement)(element); // Draw each line segment individually\n\n segments.forEach(segment => {\n context.beginPath();\n context.moveTo(segment[0][0] - element.x, segment[0][1] - element.y);\n context.lineTo(segment[1][0] - element.x, segment[1][1] - element.y);\n context.stroke();\n }); // Draw each curve individually (for rounded corners)\n\n curves.forEach(curve => {\n const [start, control1, control2, end] = curve;\n context.beginPath();\n context.moveTo(start[0] - element.x, start[1] - element.y);\n context.bezierCurveTo(control1[0] - element.x, control1[1] - element.y, control2[0] - element.x, control2[1] - element.y, end[0] - element.x, end[1] - element.y);\n context.stroke();\n });\n }\n break;\n\n default:\n {\n const [segments, curves] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.deconstructRectanguloidElement)(element); // Draw each line segment individually\n\n segments.forEach(segment => {\n context.beginPath();\n context.moveTo(segment[0][0] - element.x, segment[0][1] - element.y);\n context.lineTo(segment[1][0] - element.x, segment[1][1] - element.y);\n context.stroke();\n }); // Draw each curve individually (for rounded corners)\n\n curves.forEach(curve => {\n const [start, control1, control2, end] = curve;\n context.beginPath();\n context.moveTo(start[0] - element.x, start[1] - element.y);\n context.bezierCurveTo(control1[0] - element.x, control1[1] - element.y, control2[0] - element.x, control2[1] - element.y, end[0] - element.x, end[1] - element.y);\n context.stroke();\n });\n }\n break;\n }\n\n context.restore();\n break;\n }\n};\n\nconst renderBindingHighlightForBindableElement_complex = (app, context, element, allElementsMap, appState, deltaTime, highlightedColor, //zsviczian\nstate) => {\n var _a, _b, _c;\n\n const countdownInProgress = app.state.bindMode === \"orbit\" && app.bindModeHandler !== null;\n const remainingTime = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT - ((_a = state === null || state === void 0 ? void 0 : state.runtime) !== null && _a !== void 0 ? _a : countdownInProgress ? 0 : _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT);\n const opacity = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.clamp)(1 / _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT * remainingTime, 0.0001, 1);\n const offset = element.strokeWidth / 2;\n const enclosingFrame = element.frameId && allElementsMap.get(element.frameId);\n\n if (enclosingFrame && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(enclosingFrame)) {\n context.translate(enclosingFrame.x + appState.scrollX, enclosingFrame.y + appState.scrollY);\n context.beginPath();\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius && context.roundRect) {\n context.roundRect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n } else {\n context.rect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1);\n }\n\n context.clip();\n context.translate(-(enclosingFrame.x + appState.scrollX), -(enclosingFrame.y + appState.scrollY));\n }\n\n switch (element.type) {\n case \"magicframe\":\n case \"frame\":\n context.save();\n context.translate(element.x + appState.scrollX, element.y + appState.scrollY);\n context.lineWidth = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.strokeWidth / appState.zoom.value;\n context.strokeStyle = appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.DARK ? `rgba(3, 93, 161, ${opacity})` : `rgba(106, 189, 252, ${opacity})`;\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius && context.roundRect) {\n context.beginPath();\n context.roundRect(0, 0, element.width, element.height, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n context.stroke();\n context.closePath();\n } else {\n context.strokeRect(0, 0, element.width, element.height);\n }\n\n context.restore();\n break;\n\n default:\n context.save();\n const center = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.elementCenterPoint)(element, allElementsMap);\n const cx = center[0] + appState.scrollX;\n const cy = center[1] + appState.scrollY;\n context.translate(cx, cy);\n context.rotate(element.angle);\n context.translate(-cx, -cy);\n context.translate(element.x + appState.scrollX - offset, element.y + appState.scrollY - offset);\n context.lineWidth = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.clamp)(2.5, element.strokeWidth * 1.75, 4) / Math.max(0.25, appState.zoom.value);\n context.strokeStyle = appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.DARK ? `rgba(3, 93, 161, ${opacity / 2})` : `rgba(106, 189, 252, ${opacity / 2})`;\n\n switch (element.type) {\n case \"ellipse\":\n context.beginPath();\n context.ellipse((element.width + offset * 2) / 2, (element.height + offset * 2) / 2, (element.width + offset * 2) / 2, (element.height + offset * 2) / 2, 0, 0, 2 * Math.PI);\n context.closePath();\n context.stroke();\n break;\n\n case \"diamond\":\n {\n const [segments, curves] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.deconstructDiamondElement)(element, offset); // Draw each line segment individually\n\n segments.forEach(segment => {\n context.beginPath();\n context.moveTo(segment[0][0] - element.x + offset, segment[0][1] - element.y + offset);\n context.lineTo(segment[1][0] - element.x + offset, segment[1][1] - element.y + offset);\n context.stroke();\n }); // Draw each curve individually (for rounded corners)\n\n curves.forEach(curve => {\n const [start, control1, control2, end] = curve;\n context.beginPath();\n context.moveTo(start[0] - element.x + offset, start[1] - element.y + offset);\n context.bezierCurveTo(control1[0] - element.x + offset, control1[1] - element.y + offset, control2[0] - element.x + offset, control2[1] - element.y + offset, end[0] - element.x + offset, end[1] - element.y + offset);\n context.stroke();\n });\n }\n break;\n\n default:\n {\n const [segments, curves] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.deconstructRectanguloidElement)(element, offset); // Draw each line segment individually\n\n segments.forEach(segment => {\n context.beginPath();\n context.moveTo(segment[0][0] - element.x + offset, segment[0][1] - element.y + offset);\n context.lineTo(segment[1][0] - element.x + offset, segment[1][1] - element.y + offset);\n context.stroke();\n }); // Draw each curve individually (for rounded corners)\n\n curves.forEach(curve => {\n const [start, control1, control2, end] = curve;\n context.beginPath();\n context.moveTo(start[0] - element.x + offset, start[1] - element.y + offset);\n context.bezierCurveTo(control1[0] - element.x + offset, control1[1] - element.y + offset, control2[0] - element.x + offset, control2[1] - element.y + offset, end[0] - element.x + offset, end[1] - element.y + offset);\n context.stroke();\n });\n }\n break;\n }\n\n context.restore();\n break;\n } // Middle indicator is not rendered after it expired\n\n\n if (!countdownInProgress || ((_b = state === null || state === void 0 ? void 0 : state.runtime) !== null && _b !== void 0 ? _b : 0) > _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT) {\n return;\n }\n\n const radius = 0.5 * (Math.min(element.width, element.height) / 2); // Draw center snap area\n\n if (!(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(element)) {\n context.save();\n context.translate(element.x + appState.scrollX, element.y + appState.scrollY);\n const PROGRESS_RATIO = 1 / _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT * remainingTime;\n context.strokeStyle = \"rgba(0, 0, 0, 0.2)\";\n context.lineWidth = 1 / appState.zoom.value;\n context.setLineDash([4 / appState.zoom.value, 4 / appState.zoom.value]);\n context.lineDashOffset = -PROGRESS_RATIO * 10 / appState.zoom.value;\n context.beginPath();\n context.ellipse(element.width / 2, element.height / 2, radius, radius, 0, 0, 2 * Math.PI);\n context.stroke(); // context.strokeStyle = \"transparent\";\n\n context.fillStyle = highlightedColor !== null && highlightedColor !== void 0 ? highlightedColor : \"rgba(128,128,128,.1)\"; //zsviczian \"rgba(0, 0, 0, 0.04)\";\n\n context.beginPath();\n context.ellipse(element.width / 2, element.height / 2, radius * (1 - opacity), radius * (1 - opacity), 0, 0, 2 * Math.PI);\n context.fill();\n context.restore();\n }\n\n return {\n runtime: ((_c = state === null || state === void 0 ? void 0 : state.runtime) !== null && _c !== void 0 ? _c : 0) + deltaTime\n };\n};\n\nconst renderBindingHighlightForBindableElement = (app, context, element, allElementsMap, appState, deltaTime, highlightedColor, //zsviczian\nstate) => {\n if ((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getFeatureFlag)(\"COMPLEX_BINDINGS\")) {\n return renderBindingHighlightForBindableElement_complex(app, context, element, allElementsMap, appState, deltaTime, highlightedColor, //zsviczian\n state);\n }\n\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n renderBindingHighlightForBindableElement_simple(context, element, allElementsMap, appState, highlightedColor);\n context.restore();\n};\n\nconst renderSelectionBorder = (context, appState, elementProperties) => {\n var _a;\n\n const {\n angle,\n x1,\n y1,\n x2,\n y2,\n selectionColors,\n cx,\n cy,\n dashed,\n activeEmbeddable\n } = elementProperties;\n const elementWidth = x2 - x1;\n const elementHeight = y2 - y1;\n const padding = (_a = elementProperties.padding) !== null && _a !== void 0 ? _a : _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TRANSFORM_HANDLE_SPACING * 2;\n const linePadding = padding / appState.zoom.value;\n const lineWidth = 8 / appState.zoom.value;\n const spaceWidth = 4 / appState.zoom.value;\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n const thick = activeEmbeddable || appState.highlightSearchResult; //zsviczian\n\n context.lineWidth = (thick ? 4 : 1) / appState.zoom.value; //zsviczian\n\n const count = selectionColors.length;\n\n for (let index = 0; index < count; ++index) {\n context.strokeStyle = selectionColors[index];\n\n if (dashed) {\n context.setLineDash([lineWidth, spaceWidth + (lineWidth + spaceWidth) * (count - 1)]);\n }\n\n context.lineDashOffset = (lineWidth + spaceWidth) * index;\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.strokeRectWithRotation_simple)(context, x1 - linePadding, y1 - linePadding, elementWidth + linePadding * 2, elementHeight + linePadding * 2, cx, cy, angle);\n }\n\n context.restore();\n};\n\nconst renderFrameHighlight = (context, appState, frame, elementsMap) => {\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementAbsoluteCoords)(frame, elementsMap);\n const width = x2 - x1;\n const height = y2 - y1;\n context.strokeStyle = \"rgb(0,118,255)\";\n context.lineWidth = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.strokeWidth / appState.zoom.value;\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.strokeRectWithRotation_simple)(context, x1, y1, width, height, x1 + width / 2, y1 + height / 2, frame.angle, false, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n context.restore();\n};\n\nconst renderElementsBoxHighlight = (context, appState, elements, config) => {\n var _a;\n\n const {\n colors = [(_a = appState.gridColor.Bold) !== null && _a !== void 0 ? _a : \"rgb(0,118,255)\"],\n dashed = false\n } = config || {}; //zsviczian\n\n const individualElements = elements.filter(element => element.groupIds.length === 0);\n const elementsInGroups = elements.filter(element => element.groupIds.length > 0);\n\n const getSelectionFromElements = elements => {\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getCommonBounds)(elements);\n return {\n angle: 0,\n x1,\n x2,\n y1,\n y2,\n selectionColors: colors,\n dashed,\n cx: x1 + (x2 - x1) / 2,\n cy: y1 + (y2 - y1) / 2,\n activeEmbeddable: false\n };\n };\n\n const getSelectionForGroupId = groupId => {\n const groupElements = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementsInGroup)(elements, groupId);\n return getSelectionFromElements(groupElements);\n };\n\n Object.entries((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.selectGroupsFromGivenElements)(elementsInGroups, appState)).filter(([id, isSelected]) => isSelected).map(([id, isSelected]) => id).map(groupId => getSelectionForGroupId(groupId)).concat(individualElements.map(element => getSelectionFromElements([element]))).forEach(selection => renderSelectionBorder(context, appState, selection));\n};\n\nconst renderLinearPointHandles = (context, appState, element, elementsMap) => {\n var _a, _b;\n\n if (!appState.selectedLinearElement) {\n return;\n }\n\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n context.lineWidth = 1 / appState.zoom.value;\n const points = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.getPointsGlobalCoordinates(element, elementsMap);\n const {\n POINT_HANDLE_SIZE\n } = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor;\n const radius = ((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) ? POINT_HANDLE_SIZE : POINT_HANDLE_SIZE / 2;\n\n const _isElbowArrow = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(element);\n\n const _isLineElement = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isLineElement)(element);\n\n points.forEach((point, idx) => {\n var _a, _b, _c, _d, _e, _f;\n\n if (_isElbowArrow && idx !== 0 && idx !== points.length - 1) {\n return;\n }\n\n const isOverlappingPoint = idx > 0 && (idx !== points.length - 1 || !_isLineElement || !element.polygon) && (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointsEqual)(point, idx === points.length - 1 ? points[0] : points[idx - 1], 2 / appState.zoom.value);\n let isSelected = !!((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) && !!((_c = (_b = appState.selectedLinearElement) === null || _b === void 0 ? void 0 : _b.selectedPointsIndices) === null || _c === void 0 ? void 0 : _c.includes(idx)); // when element is a polygon, highlight the last point as well if first\n // point is selected since they overlap and the last point tends to be\n // rendered on top\n\n if (_isLineElement && element.polygon && !isSelected && idx === element.points.length - 1 && !!((_d = appState.selectedLinearElement) === null || _d === void 0 ? void 0 : _d.isEditing) && !!((_f = (_e = appState.selectedLinearElement) === null || _e === void 0 ? void 0 : _e.selectedPointsIndices) === null || _f === void 0 ? void 0 : _f.includes(0))) {\n isSelected = true;\n }\n\n renderSingleLinearPoint(context, appState, point, radius, isSelected, false, isOverlappingPoint);\n }); // Rendering segment mid points\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(element)) {\n const fixedSegments = ((_b = element.fixedSegments) === null || _b === void 0 ? void 0 : _b.map(segment => segment.index)) || [];\n points.slice(0, -1).forEach((p, idx) => {\n if (!_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.isSegmentTooShort(element, points[idx + 1], points[idx], idx, appState.zoom)) {\n renderSingleLinearPoint(context, appState, (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)((p[0] + points[idx + 1][0]) / 2, (p[1] + points[idx + 1][1]) / 2), POINT_HANDLE_SIZE / 2, false, !fixedSegments.includes(idx + 1), false);\n }\n });\n } else {\n const midPoints = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.getEditorMidPoints(element, elementsMap, appState).filter((midPoint, idx, midPoints) => midPoint !== null && !((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(element) && (idx === 0 || idx === midPoints.length - 1)));\n midPoints.forEach(segmentMidPoint => {\n var _a;\n\n if (((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) || points.length === 2) {\n renderSingleLinearPoint(context, appState, segmentMidPoint, POINT_HANDLE_SIZE / 2, false, true, false);\n }\n });\n }\n\n context.restore();\n};\n\nconst renderTransformHandles = (context, renderConfig, appState, transformHandles, angle) => {\n Object.keys(transformHandles).forEach(key => {\n const transformHandle = transformHandles[key];\n\n if (transformHandle !== undefined) {\n const [x, y, width, height] = transformHandle;\n context.save();\n context.lineWidth = 1 / appState.zoom.value;\n\n if (renderConfig.selectionColor) {\n context.strokeStyle = renderConfig.selectionColor;\n }\n\n if (key === \"rotation\") {\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.fillCircle)(context, x + width / 2, y + height / 2, width / 2, true); // prefer round corners if roundRect API is available\n } else if (context.roundRect) {\n context.beginPath();\n context.roundRect(x, y, width, height, 2 / appState.zoom.value);\n context.fill();\n context.stroke();\n } else {\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.strokeRectWithRotation_simple)(context, x, y, width, height, x + width / 2, y + height / 2, angle, true);\n }\n\n context.restore();\n }\n });\n};\n\nconst renderCropHandles = (context, renderConfig, appState, croppingElement, elementsMap) => {\n const [x1, y1,,, cx, cy] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementAbsoluteCoords)(croppingElement, elementsMap);\n const LINE_WIDTH = 3;\n const LINE_LENGTH = 20;\n const ZOOMED_LINE_WIDTH = LINE_WIDTH / appState.zoom.value;\n const ZOOMED_HALF_LINE_WIDTH = ZOOMED_LINE_WIDTH / 2;\n const HALF_WIDTH = cx - x1 + ZOOMED_LINE_WIDTH;\n const HALF_HEIGHT = cy - y1 + ZOOMED_LINE_WIDTH;\n const HORIZONTAL_LINE_LENGTH = Math.min(LINE_LENGTH / appState.zoom.value, HALF_WIDTH);\n const VERTICAL_LINE_LENGTH = Math.min(LINE_LENGTH / appState.zoom.value, HALF_HEIGHT);\n context.save();\n context.fillStyle = renderConfig.selectionColor;\n context.strokeStyle = renderConfig.selectionColor;\n context.lineWidth = ZOOMED_LINE_WIDTH;\n const handles = [[// x, y\n [-HALF_WIDTH, -HALF_HEIGHT], // horizontal line: first start and to\n [0, ZOOMED_HALF_LINE_WIDTH], [HORIZONTAL_LINE_LENGTH, ZOOMED_HALF_LINE_WIDTH], // vertical line: second start and to\n [ZOOMED_HALF_LINE_WIDTH, 0], [ZOOMED_HALF_LINE_WIDTH, VERTICAL_LINE_LENGTH]], [[HALF_WIDTH - ZOOMED_HALF_LINE_WIDTH, -HALF_HEIGHT], [ZOOMED_HALF_LINE_WIDTH, ZOOMED_HALF_LINE_WIDTH], [-HORIZONTAL_LINE_LENGTH + ZOOMED_HALF_LINE_WIDTH, ZOOMED_HALF_LINE_WIDTH], [0, 0], [0, VERTICAL_LINE_LENGTH]], [[-HALF_WIDTH, HALF_HEIGHT], [0, -ZOOMED_HALF_LINE_WIDTH], [HORIZONTAL_LINE_LENGTH, -ZOOMED_HALF_LINE_WIDTH], [ZOOMED_HALF_LINE_WIDTH, 0], [ZOOMED_HALF_LINE_WIDTH, -VERTICAL_LINE_LENGTH]], [[HALF_WIDTH - ZOOMED_HALF_LINE_WIDTH, HALF_HEIGHT], [ZOOMED_HALF_LINE_WIDTH, -ZOOMED_HALF_LINE_WIDTH], [-HORIZONTAL_LINE_LENGTH + ZOOMED_HALF_LINE_WIDTH, -ZOOMED_HALF_LINE_WIDTH], [0, 0], [0, -VERTICAL_LINE_LENGTH]]];\n handles.forEach(handle => {\n const [[x, y], [x1s, y1s], [x1t, y1t], [x2s, y2s], [x2t, y2t]] = handle;\n context.save();\n context.translate(cx, cy);\n context.rotate(croppingElement.angle);\n context.beginPath();\n context.moveTo(x + x1s, y + y1s);\n context.lineTo(x + x1t, y + y1t);\n context.stroke();\n context.beginPath();\n context.moveTo(x + x2s, y + y2s);\n context.lineTo(x + x2t, y + y2t);\n context.stroke();\n context.restore();\n });\n context.restore();\n};\n\nconst renderTextBox = (text, context, appState, selectionColor) => {\n context.save();\n const padding = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TRANSFORM_HANDLE_SPACING * 2 / appState.zoom.value;\n const width = text.width + padding * 2;\n const height = text.height + padding * 2;\n const cx = text.x + width / 2;\n const cy = text.y + height / 2;\n const shiftX = -(width / 2 + padding);\n const shiftY = -(height / 2 + padding);\n context.translate(cx + appState.scrollX, cy + appState.scrollY);\n context.rotate(text.angle);\n context.lineWidth = 1 / appState.zoom.value;\n context.strokeStyle = selectionColor;\n context.strokeRect(shiftX, shiftY, width, height);\n context.restore();\n};\n\nconst _renderInteractiveScene = ({\n app,\n canvas,\n elementsMap,\n visibleElements,\n selectedElements,\n allElementsMap,\n scale,\n appState,\n renderConfig,\n editorInterface,\n animationState,\n deltaTime\n}) => {\n var _a, _b, _c, _d, _e;\n\n if (canvas === null) {\n return {\n atLeastOneVisibleElement: false,\n elementsMap\n };\n }\n\n const [normalizedWidth, normalizedHeight] = (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.getNormalizedCanvasDimensions)(canvas, scale);\n let nextAnimationState = animationState;\n const context = (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.bootstrapCanvas)({\n canvas,\n scale,\n normalizedWidth,\n normalizedHeight\n }); // Apply zoom\n\n context.save();\n context.scale(appState.zoom.value, appState.zoom.value);\n let editingLinearElement = undefined;\n visibleElements.forEach(element => {\n var _a; // Getting the element using LinearElementEditor during collab mismatches version - being one head of visible elements due to\n // ShapeCache returns empty hence making sure that we get the\n // correct element from visible elements\n\n\n if (((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) && appState.selectedLinearElement.elementId === element.id) {\n if (element) {\n editingLinearElement = element;\n }\n }\n });\n\n if (editingLinearElement) {\n renderLinearPointHandles(context, appState, editingLinearElement, elementsMap);\n } // Paint selection element\n\n\n if (appState.selectionElement && !appState.isCropping) {\n try {\n (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.renderSelectionElement)(appState.selectionElement, context, appState, renderConfig.selectionColor);\n } catch (error) {\n console.error(error);\n }\n }\n\n if (appState.editingTextElement && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isTextElement)(appState.editingTextElement)) {\n const textElement = allElementsMap.get(appState.editingTextElement.id);\n\n if (textElement && !textElement.autoResize) {\n renderTextBox(textElement, context, appState, renderConfig.selectionColor);\n }\n }\n\n if (appState.isBindingEnabled && appState.suggestedBinding) {\n nextAnimationState = Object.assign(Object.assign({}, animationState), {\n bindingHighlight: renderBindingHighlightForBindableElement(app, context, appState.suggestedBinding, allElementsMap, appState, deltaTime, appState.gridColor.Bold, //zsviczian\n animationState === null || animationState === void 0 ? void 0 : animationState.bindingHighlight)\n });\n } else {\n nextAnimationState = Object.assign(Object.assign({}, animationState), {\n bindingHighlight: undefined\n });\n }\n\n if (appState.frameToHighlight) {\n renderFrameHighlight(context, appState, appState.frameToHighlight, elementsMap);\n }\n\n if (appState.elementsToHighlight) {\n renderElementsBoxHighlight(context, appState, appState.elementsToHighlight);\n }\n\n if (appState.activeLockedId) {\n const element = allElementsMap.get(appState.activeLockedId);\n const elements = element ? [element] : (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementsInGroup)(allElementsMap, appState.activeLockedId);\n renderElementsBoxHighlight(context, appState, elements, {\n colors: [\"#ced4da\"],\n dashed: true\n });\n }\n\n const isFrameSelected = selectedElements.some(element => (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(element)); // Getting the element using LinearElementEditor during collab mismatches version - being one head of visible elements due to\n // ShapeCache returns empty hence making sure that we get the\n // correct element from visible elements\n\n if (selectedElements.length === 1 && ((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) && appState.selectedLinearElement.elementId === selectedElements[0].id) {\n renderLinearPointHandles(context, appState, selectedElements[0], elementsMap);\n } // Arrows have a different highlight behavior when\n // they are the only selected element\n\n\n if (appState.selectedLinearElement) {\n const editor = appState.selectedLinearElement;\n const firstSelectedLinear = selectedElements.find(el => el.id === editor.elementId);\n\n if (!appState.selectedLinearElement.isDragging) {\n if (editor.segmentMidPointHoveredCoords) {\n renderElbowArrowMidPointHighlight(context, appState);\n } else if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(firstSelectedLinear) ? editor.hoverPointIndex === 0 || editor.hoverPointIndex === firstSelectedLinear.points.length - 1 : editor.hoverPointIndex >= 0) {\n renderLinearElementPointHighlight(context, appState, elementsMap);\n }\n }\n } // Paint selected elements\n\n\n if (!appState.multiElement && !appState.newElement && !((_b = appState.selectedLinearElement) === null || _b === void 0 ? void 0 : _b.isEditing)) {\n const showBoundingBox = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.hasBoundingBox)(selectedElements, appState, editorInterface);\n const isSingleLinearElementSelected = selectedElements.length === 1 && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isLinearElement)(selectedElements[0]); // render selected linear element points\n\n if (isSingleLinearElementSelected && ((_c = appState.selectedLinearElement) === null || _c === void 0 ? void 0 : _c.elementId) === selectedElements[0].id && !selectedElements[0].locked) {\n renderLinearPointHandles(context, appState, selectedElements[0], elementsMap);\n }\n\n const selectionColor = renderConfig.selectionColor || open_color__WEBPACK_IMPORTED_MODULE_1__.black;\n\n if (showBoundingBox) {\n // Optimisation for finding quickly relevant element ids\n const locallySelectedIds = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.arrayToMap)(selectedElements);\n const selections = [];\n\n for (const element of elementsMap.values()) {\n const selectionColors = [];\n const remoteClients = renderConfig.remoteSelectedElementIds.get(element.id);\n\n if (!( // Elbow arrow elements cannot be selected when bound on either end\n isSingleLinearElementSelected && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(element) && (element.startBinding || element.endBinding))) {\n // local user\n if (locallySelectedIds.has(element.id) && !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isSelectedViaGroup)(appState, element)) {\n selectionColors.push(selectionColor);\n } // remote users\n\n\n if (remoteClients) {\n selectionColors.push(...remoteClients.map(socketId => {\n const background = (0,_clients__WEBPACK_IMPORTED_MODULE_7__.getClientColor)(socketId, appState.collaborators.get(socketId));\n return background;\n }));\n }\n }\n\n if (selectionColors.length) {\n const [x1, y1, x2, y2, cx, cy] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementAbsoluteCoords)(element, elementsMap, true);\n selections.push({\n angle: element.angle,\n x1,\n y1,\n x2,\n y2,\n selectionColors: element.locked ? [\"#ced4da\"] : selectionColors,\n dashed: !!remoteClients || element.locked,\n cx,\n cy,\n activeEmbeddable: ((_d = appState.activeEmbeddable) === null || _d === void 0 ? void 0 : _d.element) === element && appState.activeEmbeddable.state === \"active\",\n padding: element.id === appState.croppingElementId || (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isImageElement)(element) ? 0 : undefined\n });\n }\n }\n\n const addSelectionForGroupId = groupId => {\n const groupElements = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementsInGroup)(elementsMap, groupId);\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getCommonBounds)(groupElements);\n selections.push({\n angle: 0,\n x1,\n x2,\n y1,\n y2,\n selectionColors: groupElements.some(el => el.locked) ? [\"#ced4da\"] : [open_color__WEBPACK_IMPORTED_MODULE_1__.black],\n dashed: true,\n cx: x1 + (x2 - x1) / 2,\n cy: y1 + (y2 - y1) / 2,\n activeEmbeddable: false\n });\n };\n\n for (const groupId of (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getSelectedGroupIds)(appState)) {\n // TODO: support multiplayer selected group IDs\n addSelectionForGroupId(groupId);\n }\n\n if (appState.editingGroupId) {\n addSelectionForGroupId(appState.editingGroupId);\n }\n\n selections.forEach(selection => renderSelectionBorder(context, appState, selection));\n } // Paint resize transformHandles\n\n\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n\n if (selectedElements.length === 1) {\n context.fillStyle = open_color__WEBPACK_IMPORTED_MODULE_1__.white;\n const transformHandles = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getTransformHandles)(selectedElements[0], appState.zoom, elementsMap, \"mouse\", // when we render we don't know which pointer type so use mouse,\n (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getOmitSidesForEditorInterface)(editorInterface));\n\n if (!appState.viewModeEnabled && showBoundingBox && // do not show transform handles when text is being edited\n !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isTextElement)(appState.editingTextElement) && // do not show transform handles when image is being cropped\n !appState.croppingElementId) {\n renderTransformHandles(context, renderConfig, appState, transformHandles, selectedElements[0].angle);\n }\n\n if (appState.croppingElementId && !appState.isCropping) {\n const croppingElement = elementsMap.get(appState.croppingElementId);\n\n if (croppingElement && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isImageElement)(croppingElement)) {\n renderCropHandles(context, renderConfig, appState, croppingElement, elementsMap);\n }\n }\n } else if (selectedElements.length > 1 && !appState.isRotating && !selectedElements.some(el => el.locked)) {\n const dashedLinePadding = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TRANSFORM_HANDLE_SPACING * 2 / appState.zoom.value;\n context.fillStyle = open_color__WEBPACK_IMPORTED_MODULE_1__.white;\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getCommonBounds)(selectedElements, elementsMap);\n const initialLineDash = context.getLineDash();\n context.setLineDash([2 / appState.zoom.value]);\n const lineWidth = context.lineWidth;\n context.lineWidth = 1 / appState.zoom.value;\n context.strokeStyle = selectionColor;\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.strokeRectWithRotation_simple)(context, x1 - dashedLinePadding, y1 - dashedLinePadding, x2 - x1 + dashedLinePadding * 2, y2 - y1 + dashedLinePadding * 2, (x1 + x2) / 2, (y1 + y2) / 2, 0);\n context.lineWidth = lineWidth;\n context.setLineDash(initialLineDash);\n const transformHandles = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getTransformHandlesFromCoords)([x1, y1, x2, y2, (x1 + x2) / 2, (y1 + y2) / 2], 0, appState.zoom, \"mouse\", isFrameSelected ? Object.assign(Object.assign({}, (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getOmitSidesForEditorInterface)(editorInterface)), {\n rotation: true\n }) : (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getOmitSidesForEditorInterface)(editorInterface));\n\n if (selectedElements.some(element => !element.locked)) {\n renderTransformHandles(context, renderConfig, appState, transformHandles, 0);\n }\n }\n\n context.restore();\n }\n\n (_e = appState.searchMatches) === null || _e === void 0 ? void 0 : _e.matches.forEach(({\n id,\n focus,\n matchedLines\n }) => {\n const element = elementsMap.get(id);\n\n if (element) {\n const [elementX1, elementY1,,, cx, cy] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementAbsoluteCoords)(element, elementsMap, true);\n context.save();\n\n if (appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.LIGHT) {\n if (focus) {\n context.fillStyle = \"rgba(255, 124, 0, 0.4)\";\n } else {\n context.fillStyle = \"rgba(255, 226, 0, 0.4)\";\n }\n } else if (focus) {\n context.fillStyle = \"rgba(229, 82, 0, 0.4)\";\n } else {\n context.fillStyle = \"rgba(99, 52, 0, 0.4)\";\n }\n\n const zoomFactor = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(element) ? appState.zoom.value : 1;\n context.translate(appState.scrollX, appState.scrollY);\n context.translate(cx, cy);\n context.rotate(element.angle);\n matchedLines.forEach(matchedLine => {\n (matchedLine.showOnCanvas || focus) && context.fillRect(elementX1 + matchedLine.offsetX / zoomFactor - cx, elementY1 + matchedLine.offsetY / zoomFactor - cy, matchedLine.width / zoomFactor, matchedLine.height / zoomFactor);\n });\n context.restore();\n }\n });\n (0,_renderer_renderSnaps__WEBPACK_IMPORTED_MODULE_4__.renderSnaps)(context, appState);\n context.restore();\n (0,_clients__WEBPACK_IMPORTED_MODULE_7__.renderRemoteCursors)({\n context,\n renderConfig,\n appState,\n normalizedWidth,\n normalizedHeight\n }); // Paint scrollbars\n\n let scrollBars;\n\n if (renderConfig.renderScrollbars) {\n scrollBars = (0,_scene_scrollbars__WEBPACK_IMPORTED_MODULE_6__.getScrollBars)(elementsMap, normalizedWidth, normalizedHeight, appState);\n context.save();\n context.fillStyle = _scene_scrollbars__WEBPACK_IMPORTED_MODULE_6__.SCROLLBAR_COLOR;\n context.strokeStyle = \"rgba(255,255,255,0.8)\";\n [scrollBars.horizontal, scrollBars.vertical].forEach(scrollBar => {\n if (scrollBar) {\n (0,_renderer_roundRect__WEBPACK_IMPORTED_MODULE_5__.roundRect)(context, scrollBar.x, scrollBar.y, scrollBar.width, scrollBar.height, _scene_scrollbars__WEBPACK_IMPORTED_MODULE_6__.SCROLLBAR_WIDTH / 2);\n }\n });\n context.restore();\n }\n\n return {\n scrollBars,\n atLeastOneVisibleElement: visibleElements.length > 0,\n elementsMap,\n animationState: nextAnimationState\n };\n};\n/**\r\n * Interactive scene is the ui-canvas where we render bounding boxes, selections\r\n * and other ui stuff.\r\n */\n\n\nconst renderInteractiveScene = renderConfig => {\n const ret = _renderInteractiveScene(renderConfig);\n\n renderConfig.callback(ret);\n return ret;\n};\n\n//# sourceURL=webpack://ExcalidrawLib/./renderer/interactiveScene.ts?");
|
|
20760
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ renderInteractiveScene: () => (/* binding */ renderInteractiveScene)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var open_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! open-color */ \"../../node_modules/open-color/open-color.json\");\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _renderer_renderSnaps__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../renderer/renderSnaps */ \"./renderer/renderSnaps.ts\");\n/* harmony import */ var _renderer_roundRect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../renderer/roundRect */ \"./renderer/roundRect.ts\");\n/* harmony import */ var _scene_scrollbars__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../scene/scrollbars */ \"./scene/scrollbars.ts\");\n/* harmony import */ var _clients__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../clients */ \"./clients.ts\");\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./helpers */ \"./renderer/helpers.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst renderElbowArrowMidPointHighlight = (context, appState) => {\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.invariant)(appState.selectedLinearElement, \"selectedLinearElement is null\");\n const {\n segmentMidPointHoveredCoords\n } = appState.selectedLinearElement;\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.invariant)(segmentMidPointHoveredCoords, \"midPointCoords is null\");\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n highlightPoint(segmentMidPointHoveredCoords, context, appState);\n context.restore();\n};\n\nconst renderLinearElementPointHighlight = (context, appState, elementsMap) => {\n var _a, _b, _c;\n\n const {\n elementId,\n hoverPointIndex\n } = appState.selectedLinearElement;\n\n if (((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) && ((_c = (_b = appState.selectedLinearElement) === null || _b === void 0 ? void 0 : _b.selectedPointsIndices) === null || _c === void 0 ? void 0 : _c.includes(hoverPointIndex))) {\n return;\n }\n\n const element = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.getElement(elementId, elementsMap);\n\n if (!element) {\n return;\n }\n\n const point = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.getPointAtIndexGlobalCoordinates(element, hoverPointIndex, elementsMap);\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n highlightPoint(point, context, appState);\n context.restore();\n};\n\nconst highlightPoint = (point, context, appState) => {\n context.fillStyle = \"rgba(105, 101, 219, 0.4)\";\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.fillCircle)(context, point[0], point[1], _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.POINT_HANDLE_SIZE / appState.zoom.value, false);\n};\n\nconst renderSingleLinearPoint = (context, appState, point, radius, isSelected, isPhantomPoint, isOverlappingPoint) => {\n var _a;\n\n context.strokeStyle = \"#5e5ad8\";\n context.setLineDash([]);\n context.fillStyle = \"rgba(255, 255, 255, 0.9)\";\n\n if (isSelected) {\n context.fillStyle = \"rgba(134, 131, 226, 0.9)\";\n } else if (isPhantomPoint) {\n context.fillStyle = \"rgba(177, 151, 252, 0.7)\";\n }\n\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.fillCircle)(context, point[0], point[1], (isOverlappingPoint ? radius * (((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) ? 1.5 : 2) : radius) / appState.zoom.value, !isPhantomPoint, !isOverlappingPoint || isSelected);\n};\n\nconst renderBindingHighlightForBindableElement_simple = (context, element, elementsMap, appState) => {\n var _a, _b, _c;\n\n const enclosingFrame = element.frameId && elementsMap.get(element.frameId);\n\n if (enclosingFrame && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(enclosingFrame)) {\n context.translate(enclosingFrame.x, enclosingFrame.y);\n const highlightColor = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getHighlightColor)((_c = (_b = (_a = enclosingFrame.customData) === null || _a === void 0 ? void 0 : _a.frameColor) === null || _b === void 0 ? void 0 : _b.stroke) !== null && _c !== void 0 ? _c : appState.frameColor.stroke, appState.viewBackgroundColor); //zsviczian\n\n context.fillStyle = highlightColor !== null && highlightColor !== void 0 ? highlightColor : \"rgba(0,0,0,.05)\"; //zsviczian\n\n context.beginPath();\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius && context.roundRect) {\n context.roundRect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n } else {\n context.rect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1);\n }\n\n context.clip();\n context.translate(-enclosingFrame.x, -enclosingFrame.y);\n }\n\n switch (element.type) {\n case \"magicframe\":\n case \"frame\":\n context.save();\n const highlightColor = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getHighlightColor)(appState.frameColor.stroke, appState.viewBackgroundColor); //zsviczian\n\n context.translate(element.x, element.y);\n context.lineWidth = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.strokeWidth / appState.zoom.value;\n context.strokeStyle = highlightColor !== null && highlightColor !== void 0 ? highlightColor : appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.DARK ? `rgba(3, 93, 161, 1)` : `rgba(106, 189, 252, 1)`;\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius && context.roundRect) {\n context.beginPath();\n context.roundRect(0, 0, element.width, element.height, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n context.stroke();\n context.closePath();\n } else {\n context.strokeRect(0, 0, element.width, element.height);\n }\n\n context.restore();\n break;\n\n default:\n context.save();\n const highlightColor2 = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getHighlightColor)((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isTextElement)(element) ? appState.viewBackgroundColor : element.strokeColor, appState.viewBackgroundColor); //zsviczian\n\n const center = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.elementCenterPoint)(element, elementsMap);\n context.translate(center[0], center[1]);\n context.rotate(element.angle);\n context.translate(-center[0], -center[1]);\n context.translate(element.x, element.y);\n context.lineWidth = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.clamp)(1.75, element.strokeWidth, 10) / //zsviczian was max was 4\n Math.max(0.25, appState.zoom.value);\n context.strokeStyle = highlightColor2 !== null && highlightColor2 !== void 0 ? highlightColor2 : appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.DARK ? `rgba(3, 93, 161, 1)` : `rgba(106, 189, 252, 1)`;\n\n switch (element.type) {\n case \"ellipse\":\n context.beginPath();\n context.ellipse(element.width / 2, element.height / 2, element.width / 2, element.height / 2, 0, 0, 2 * Math.PI);\n context.closePath();\n context.stroke();\n break;\n\n case \"diamond\":\n {\n const [segments, curves] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.deconstructDiamondElement)(element); // Draw each line segment individually\n\n segments.forEach(segment => {\n context.beginPath();\n context.moveTo(segment[0][0] - element.x, segment[0][1] - element.y);\n context.lineTo(segment[1][0] - element.x, segment[1][1] - element.y);\n context.stroke();\n }); // Draw each curve individually (for rounded corners)\n\n curves.forEach(curve => {\n const [start, control1, control2, end] = curve;\n context.beginPath();\n context.moveTo(start[0] - element.x, start[1] - element.y);\n context.bezierCurveTo(control1[0] - element.x, control1[1] - element.y, control2[0] - element.x, control2[1] - element.y, end[0] - element.x, end[1] - element.y);\n context.stroke();\n });\n }\n break;\n\n default:\n {\n const [segments, curves] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.deconstructRectanguloidElement)(element); // Draw each line segment individually\n\n segments.forEach(segment => {\n context.beginPath();\n context.moveTo(segment[0][0] - element.x, segment[0][1] - element.y);\n context.lineTo(segment[1][0] - element.x, segment[1][1] - element.y);\n context.stroke();\n }); // Draw each curve individually (for rounded corners)\n\n curves.forEach(curve => {\n const [start, control1, control2, end] = curve;\n context.beginPath();\n context.moveTo(start[0] - element.x, start[1] - element.y);\n context.bezierCurveTo(control1[0] - element.x, control1[1] - element.y, control2[0] - element.x, control2[1] - element.y, end[0] - element.x, end[1] - element.y);\n context.stroke();\n });\n }\n break;\n }\n\n context.restore();\n break;\n }\n};\n\nconst renderBindingHighlightForBindableElement_complex = (app, context, element, allElementsMap, appState, deltaTime, state) => {\n var _a, _b, _c, _d, _e, _f;\n\n const countdownInProgress = app.state.bindMode === \"orbit\" && app.bindModeHandler !== null;\n const remainingTime = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT - ((_a = state === null || state === void 0 ? void 0 : state.runtime) !== null && _a !== void 0 ? _a : countdownInProgress ? 0 : _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT);\n const opacity = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.clamp)(1 / _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT * remainingTime, 0.0001, 1);\n const offset = element.strokeWidth / 2;\n const enclosingFrame = element.frameId && allElementsMap.get(element.frameId);\n\n if (enclosingFrame && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(enclosingFrame)) {\n context.translate(enclosingFrame.x, enclosingFrame.y);\n context.beginPath();\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius && context.roundRect) {\n context.roundRect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n } else {\n context.rect(-1, -1, enclosingFrame.width + 1, enclosingFrame.height + 1);\n }\n\n context.clip();\n context.translate(-enclosingFrame.x, -enclosingFrame.y);\n }\n\n switch (element.type) {\n case \"magicframe\":\n case \"frame\":\n context.save();\n context.translate(element.x, element.y);\n const highlightColor = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getHighlightColor)((_d = (_c = (_b = element.customData) === null || _b === void 0 ? void 0 : _b.frameColor) === null || _c === void 0 ? void 0 : _c.stroke) !== null && _d !== void 0 ? _d : appState.frameColor.stroke, appState.viewBackgroundColor, opacity); //zsviczian\n\n context.lineWidth = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.strokeWidth / appState.zoom.value;\n context.strokeStyle = highlightColor !== null && highlightColor !== void 0 ? highlightColor : appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.DARK ? `rgba(3, 93, 161, ${opacity})` : `rgba(106, 189, 252, ${opacity})`;\n\n if (_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius && context.roundRect) {\n context.beginPath();\n context.roundRect(0, 0, element.width, element.height, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n context.stroke();\n context.closePath();\n } else {\n context.strokeRect(0, 0, element.width, element.height);\n }\n\n context.restore();\n break;\n\n default:\n context.save();\n const center = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.elementCenterPoint)(element, allElementsMap);\n const cx = center[0] + appState.scrollX;\n const cy = center[1] + appState.scrollY;\n context.translate(cx, cy);\n context.rotate(element.angle);\n context.translate(-cx, -cy);\n context.translate(element.x + appState.scrollX - offset, element.y + appState.scrollY - offset);\n const highlightColor2 = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getHighlightColor)((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isTextElement)(element) ? appState.viewBackgroundColor : element.strokeColor, appState.viewBackgroundColor, opacity / 2); //zsviczian\n\n context.lineWidth = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.clamp)(2.5, element.strokeWidth * 1.75, 10) / //zsviczian max was 4\n Math.max(0.25, appState.zoom.value);\n context.strokeStyle = highlightColor2 !== null && highlightColor2 !== void 0 ? highlightColor2 : appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.DARK ? `rgba(3, 93, 161, ${opacity / 2})` : `rgba(106, 189, 252, ${opacity / 2})`;\n\n switch (element.type) {\n case \"ellipse\":\n context.beginPath();\n context.ellipse((element.width + offset * 2) / 2, (element.height + offset * 2) / 2, (element.width + offset * 2) / 2, (element.height + offset * 2) / 2, 0, 0, 2 * Math.PI);\n context.closePath();\n context.stroke();\n break;\n\n case \"diamond\":\n {\n const [segments, curves] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.deconstructDiamondElement)(element, offset); // Draw each line segment individually\n\n segments.forEach(segment => {\n context.beginPath();\n context.moveTo(segment[0][0] - element.x + offset, segment[0][1] - element.y + offset);\n context.lineTo(segment[1][0] - element.x + offset, segment[1][1] - element.y + offset);\n context.stroke();\n }); // Draw each curve individually (for rounded corners)\n\n curves.forEach(curve => {\n const [start, control1, control2, end] = curve;\n context.beginPath();\n context.moveTo(start[0] - element.x + offset, start[1] - element.y + offset);\n context.bezierCurveTo(control1[0] - element.x + offset, control1[1] - element.y + offset, control2[0] - element.x + offset, control2[1] - element.y + offset, end[0] - element.x + offset, end[1] - element.y + offset);\n context.stroke();\n });\n }\n break;\n\n default:\n {\n const [segments, curves] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.deconstructRectanguloidElement)(element, offset); // Draw each line segment individually\n\n segments.forEach(segment => {\n context.beginPath();\n context.moveTo(segment[0][0] - element.x + offset, segment[0][1] - element.y + offset);\n context.lineTo(segment[1][0] - element.x + offset, segment[1][1] - element.y + offset);\n context.stroke();\n }); // Draw each curve individually (for rounded corners)\n\n curves.forEach(curve => {\n const [start, control1, control2, end] = curve;\n context.beginPath();\n context.moveTo(start[0] - element.x + offset, start[1] - element.y + offset);\n context.bezierCurveTo(control1[0] - element.x + offset, control1[1] - element.y + offset, control2[0] - element.x + offset, control2[1] - element.y + offset, end[0] - element.x + offset, end[1] - element.y + offset);\n context.stroke();\n });\n }\n break;\n }\n\n context.restore();\n break;\n } // Middle indicator is not rendered after it expired\n\n\n if (!countdownInProgress || ((_e = state === null || state === void 0 ? void 0 : state.runtime) !== null && _e !== void 0 ? _e : 0) > _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT) {\n return;\n }\n\n const radius = 0.5 * (Math.min(element.width, element.height) / 2); // Draw center snap area\n\n if (!(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(element)) {\n context.save();\n context.translate(element.x + appState.scrollX, element.y + appState.scrollY);\n const PROGRESS_RATIO = 1 / _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.BIND_MODE_TIMEOUT * remainingTime;\n context.strokeStyle = \"rgba(0, 0, 0, 0.2)\";\n context.lineWidth = 1 / appState.zoom.value;\n context.setLineDash([4 / appState.zoom.value, 4 / appState.zoom.value]);\n context.lineDashOffset = -PROGRESS_RATIO * 10 / appState.zoom.value;\n context.beginPath();\n context.ellipse(element.width / 2, element.height / 2, radius, radius, 0, 0, 2 * Math.PI);\n context.stroke();\n const highlightColor = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getHighlightColor)((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isTextElement)(element) ? appState.viewBackgroundColor : element.strokeColor, appState.viewBackgroundColor); //zsviczian\n // context.strokeStyle = \"transparent\";\n\n context.fillStyle = highlightColor !== null && highlightColor !== void 0 ? highlightColor : \"rgba(128,128,128,.1)\"; //zsviczian \"rgba(0, 0, 0, 0.04)\";\n\n context.beginPath();\n context.ellipse(element.width / 2, element.height / 2, radius * (1 - opacity), radius * (1 - opacity), 0, 0, 2 * Math.PI);\n context.fill();\n context.restore();\n }\n\n return {\n runtime: ((_f = state === null || state === void 0 ? void 0 : state.runtime) !== null && _f !== void 0 ? _f : 0) + deltaTime\n };\n};\n\nconst renderBindingHighlightForBindableElement = (app, context, element, allElementsMap, appState, deltaTime, state) => {\n if ((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getFeatureFlag)(\"COMPLEX_BINDINGS\")) {\n return renderBindingHighlightForBindableElement_complex(app, context, element, allElementsMap, appState, deltaTime, state);\n }\n\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n renderBindingHighlightForBindableElement_simple(context, element, allElementsMap, appState);\n context.restore();\n};\n\nconst renderSelectionBorder = (context, appState, elementProperties) => {\n var _a;\n\n const {\n angle,\n x1,\n y1,\n x2,\n y2,\n selectionColors,\n cx,\n cy,\n dashed,\n activeEmbeddable\n } = elementProperties;\n const elementWidth = x2 - x1;\n const elementHeight = y2 - y1;\n const padding = (_a = elementProperties.padding) !== null && _a !== void 0 ? _a : _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TRANSFORM_HANDLE_SPACING * 2;\n const linePadding = padding / appState.zoom.value;\n const lineWidth = 8 / appState.zoom.value;\n const spaceWidth = 4 / appState.zoom.value;\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n const thick = activeEmbeddable || appState.highlightSearchResult; //zsviczian\n\n context.lineWidth = (thick ? 4 : 1.5) / appState.zoom.value; //zsviczian was 1 / appState.zoom.value;\n\n const count = selectionColors.length;\n\n for (let index = 0; index < count; ++index) {\n context.strokeStyle = selectionColors[index];\n\n if (dashed) {\n context.setLineDash([lineWidth, spaceWidth + (lineWidth + spaceWidth) * (count - 1)]);\n }\n\n context.lineDashOffset = (lineWidth + spaceWidth) * index;\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.strokeRectWithRotation_simple)(context, x1 - linePadding, y1 - linePadding, elementWidth + linePadding * 2, elementHeight + linePadding * 2, cx, cy, angle);\n }\n\n context.restore();\n};\n\nconst renderFrameHighlight = (context, appState, frame, elementsMap) => {\n var _a, _b, _c;\n\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementAbsoluteCoords)(frame, elementsMap);\n const width = x2 - x1;\n const height = y2 - y1;\n const highlightColor = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getHighlightColor)((_c = (_b = (_a = frame.customData) === null || _a === void 0 ? void 0 : _a.frameColor) === null || _b === void 0 ? void 0 : _b.stroke) !== null && _c !== void 0 ? _c : appState.frameColor.stroke, appState.viewBackgroundColor); //zsviczian\n\n context.strokeStyle = highlightColor !== null && highlightColor !== void 0 ? highlightColor : \"rgb(0,118,255)\"; //zsviczian\n\n context.lineWidth = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.strokeWidth / appState.zoom.value;\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.strokeRectWithRotation_simple)(context, x1, y1, width, height, x1 + width / 2, y1 + height / 2, frame.angle, false, _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.FRAME_STYLE.radius / appState.zoom.value);\n context.restore();\n};\n\nconst renderElementsBoxHighlight = (context, appState, elements, config) => {\n const highlightColor = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getHighlightColor)(appState.viewBackgroundColor, appState.viewBackgroundColor); //zsviczian\n\n const {\n colors = [highlightColor],\n dashed = false\n } = config || {}; //zsviczian\n\n const individualElements = elements.filter(element => element.groupIds.length === 0);\n const elementsInGroups = elements.filter(element => element.groupIds.length > 0);\n\n const getSelectionFromElements = elements => {\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getCommonBounds)(elements);\n return {\n angle: 0,\n x1,\n x2,\n y1,\n y2,\n selectionColors: colors,\n dashed,\n cx: x1 + (x2 - x1) / 2,\n cy: y1 + (y2 - y1) / 2,\n activeEmbeddable: false\n };\n };\n\n const getSelectionForGroupId = groupId => {\n const groupElements = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementsInGroup)(elements, groupId);\n return getSelectionFromElements(groupElements);\n };\n\n Object.entries((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.selectGroupsFromGivenElements)(elementsInGroups, appState)).filter(([id, isSelected]) => isSelected).map(([id, isSelected]) => id).map(groupId => getSelectionForGroupId(groupId)).concat(individualElements.map(element => getSelectionFromElements([element]))).forEach(selection => renderSelectionBorder(context, appState, selection));\n};\n\nconst renderLinearPointHandles = (context, appState, element, elementsMap) => {\n var _a, _b;\n\n if (!appState.selectedLinearElement) {\n return;\n }\n\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n context.lineWidth = 1 / appState.zoom.value;\n const points = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.getPointsGlobalCoordinates(element, elementsMap);\n const {\n POINT_HANDLE_SIZE\n } = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor;\n const radius = ((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) ? POINT_HANDLE_SIZE : POINT_HANDLE_SIZE / 2;\n\n const _isElbowArrow = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(element);\n\n const _isLineElement = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isLineElement)(element);\n\n points.forEach((point, idx) => {\n var _a, _b, _c, _d, _e, _f;\n\n if (_isElbowArrow && idx !== 0 && idx !== points.length - 1) {\n return;\n }\n\n const isOverlappingPoint = idx > 0 && (idx !== points.length - 1 || !_isLineElement || !element.polygon) && (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointsEqual)(point, idx === points.length - 1 ? points[0] : points[idx - 1], 2 / appState.zoom.value);\n let isSelected = !!((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) && !!((_c = (_b = appState.selectedLinearElement) === null || _b === void 0 ? void 0 : _b.selectedPointsIndices) === null || _c === void 0 ? void 0 : _c.includes(idx)); // when element is a polygon, highlight the last point as well if first\n // point is selected since they overlap and the last point tends to be\n // rendered on top\n\n if (_isLineElement && element.polygon && !isSelected && idx === element.points.length - 1 && !!((_d = appState.selectedLinearElement) === null || _d === void 0 ? void 0 : _d.isEditing) && !!((_f = (_e = appState.selectedLinearElement) === null || _e === void 0 ? void 0 : _e.selectedPointsIndices) === null || _f === void 0 ? void 0 : _f.includes(0))) {\n isSelected = true;\n }\n\n renderSingleLinearPoint(context, appState, point, radius, isSelected, false, isOverlappingPoint);\n }); // Rendering segment mid points\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(element)) {\n const fixedSegments = ((_b = element.fixedSegments) === null || _b === void 0 ? void 0 : _b.map(segment => segment.index)) || [];\n points.slice(0, -1).forEach((p, idx) => {\n if (!_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.isSegmentTooShort(element, points[idx + 1], points[idx], idx, appState.zoom)) {\n renderSingleLinearPoint(context, appState, (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)((p[0] + points[idx + 1][0]) / 2, (p[1] + points[idx + 1][1]) / 2), POINT_HANDLE_SIZE / 2, false, !fixedSegments.includes(idx + 1), false);\n }\n });\n } else {\n const midPoints = _excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.LinearElementEditor.getEditorMidPoints(element, elementsMap, appState).filter((midPoint, idx, midPoints) => midPoint !== null && !((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(element) && (idx === 0 || idx === midPoints.length - 1)));\n midPoints.forEach(segmentMidPoint => {\n var _a;\n\n if (((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) || points.length === 2) {\n renderSingleLinearPoint(context, appState, segmentMidPoint, POINT_HANDLE_SIZE / 2, false, true, false);\n }\n });\n }\n\n context.restore();\n};\n\nconst renderTransformHandles = (context, renderConfig, appState, transformHandles, angle) => {\n Object.keys(transformHandles).forEach(key => {\n const transformHandle = transformHandles[key];\n\n if (transformHandle !== undefined) {\n const [x, y, width, height] = transformHandle;\n context.save();\n context.lineWidth = 1.5 / appState.zoom.value; //zsviczian changed from 1 to 1.5\n\n if (renderConfig.selectionColor) {\n context.strokeStyle = renderConfig.selectionColor;\n }\n\n if (key === \"rotation\") {\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.fillCircle)(context, x + width / 2, y + height / 2, width / 2, true); // prefer round corners if roundRect API is available\n } else if (context.roundRect) {\n context.beginPath();\n context.roundRect(x, y, width, height, 2 / appState.zoom.value);\n context.fill();\n context.stroke();\n } else {\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.strokeRectWithRotation_simple)(context, x, y, width, height, x + width / 2, y + height / 2, angle, true);\n }\n\n context.restore();\n }\n });\n};\n\nconst renderCropHandles = (context, renderConfig, appState, croppingElement, elementsMap) => {\n const [x1, y1,,, cx, cy] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementAbsoluteCoords)(croppingElement, elementsMap);\n const LINE_WIDTH = 3;\n const LINE_LENGTH = 20;\n const ZOOMED_LINE_WIDTH = LINE_WIDTH / appState.zoom.value;\n const ZOOMED_HALF_LINE_WIDTH = ZOOMED_LINE_WIDTH / 2;\n const HALF_WIDTH = cx - x1 + ZOOMED_LINE_WIDTH;\n const HALF_HEIGHT = cy - y1 + ZOOMED_LINE_WIDTH;\n const HORIZONTAL_LINE_LENGTH = Math.min(LINE_LENGTH / appState.zoom.value, HALF_WIDTH);\n const VERTICAL_LINE_LENGTH = Math.min(LINE_LENGTH / appState.zoom.value, HALF_HEIGHT);\n context.save();\n context.fillStyle = renderConfig.selectionColor;\n context.strokeStyle = renderConfig.selectionColor;\n context.lineWidth = ZOOMED_LINE_WIDTH;\n const handles = [[// x, y\n [-HALF_WIDTH, -HALF_HEIGHT], // horizontal line: first start and to\n [0, ZOOMED_HALF_LINE_WIDTH], [HORIZONTAL_LINE_LENGTH, ZOOMED_HALF_LINE_WIDTH], // vertical line: second start and to\n [ZOOMED_HALF_LINE_WIDTH, 0], [ZOOMED_HALF_LINE_WIDTH, VERTICAL_LINE_LENGTH]], [[HALF_WIDTH - ZOOMED_HALF_LINE_WIDTH, -HALF_HEIGHT], [ZOOMED_HALF_LINE_WIDTH, ZOOMED_HALF_LINE_WIDTH], [-HORIZONTAL_LINE_LENGTH + ZOOMED_HALF_LINE_WIDTH, ZOOMED_HALF_LINE_WIDTH], [0, 0], [0, VERTICAL_LINE_LENGTH]], [[-HALF_WIDTH, HALF_HEIGHT], [0, -ZOOMED_HALF_LINE_WIDTH], [HORIZONTAL_LINE_LENGTH, -ZOOMED_HALF_LINE_WIDTH], [ZOOMED_HALF_LINE_WIDTH, 0], [ZOOMED_HALF_LINE_WIDTH, -VERTICAL_LINE_LENGTH]], [[HALF_WIDTH - ZOOMED_HALF_LINE_WIDTH, HALF_HEIGHT], [ZOOMED_HALF_LINE_WIDTH, -ZOOMED_HALF_LINE_WIDTH], [-HORIZONTAL_LINE_LENGTH + ZOOMED_HALF_LINE_WIDTH, -ZOOMED_HALF_LINE_WIDTH], [0, 0], [0, -VERTICAL_LINE_LENGTH]]];\n handles.forEach(handle => {\n const [[x, y], [x1s, y1s], [x1t, y1t], [x2s, y2s], [x2t, y2t]] = handle;\n context.save();\n context.translate(cx, cy);\n context.rotate(croppingElement.angle);\n context.beginPath();\n context.moveTo(x + x1s, y + y1s);\n context.lineTo(x + x1t, y + y1t);\n context.stroke();\n context.beginPath();\n context.moveTo(x + x2s, y + y2s);\n context.lineTo(x + x2t, y + y2t);\n context.stroke();\n context.restore();\n });\n context.restore();\n};\n\nconst renderTextBox = (text, context, appState, selectionColor) => {\n context.save();\n const padding = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TRANSFORM_HANDLE_SPACING * 2 / appState.zoom.value;\n const width = text.width + padding * 2;\n const height = text.height + padding * 2;\n const cx = text.x + width / 2;\n const cy = text.y + height / 2;\n const shiftX = -(width / 2 + padding);\n const shiftY = -(height / 2 + padding);\n context.translate(cx + appState.scrollX, cy + appState.scrollY);\n context.rotate(text.angle);\n context.lineWidth = 1.5 / appState.zoom.value; //zsviczian changed from 1 to 1.5\n\n context.strokeStyle = selectionColor;\n context.strokeRect(shiftX, shiftY, width, height);\n context.restore();\n};\n\nconst _renderInteractiveScene = ({\n app,\n canvas,\n elementsMap,\n visibleElements,\n selectedElements,\n allElementsMap,\n scale,\n appState,\n renderConfig,\n editorInterface,\n animationState,\n deltaTime\n}) => {\n var _a, _b, _c, _d, _e;\n\n if (canvas === null) {\n return {\n atLeastOneVisibleElement: false,\n elementsMap\n };\n }\n\n const [normalizedWidth, normalizedHeight] = (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.getNormalizedCanvasDimensions)(canvas, scale);\n let nextAnimationState = animationState;\n const context = (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.bootstrapCanvas)({\n canvas,\n scale,\n normalizedWidth,\n normalizedHeight\n }); // Apply zoom\n\n context.save();\n context.scale(appState.zoom.value, appState.zoom.value);\n let editingLinearElement = undefined;\n visibleElements.forEach(element => {\n var _a; // Getting the element using LinearElementEditor during collab mismatches version - being one head of visible elements due to\n // ShapeCache returns empty hence making sure that we get the\n // correct element from visible elements\n\n\n if (((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) && appState.selectedLinearElement.elementId === element.id) {\n if (element) {\n editingLinearElement = element;\n }\n }\n });\n\n if (editingLinearElement) {\n renderLinearPointHandles(context, appState, editingLinearElement, elementsMap);\n } // Paint selection element\n\n\n if (appState.selectionElement && !appState.isCropping) {\n try {\n (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.renderSelectionElement)(appState.selectionElement, context, appState, renderConfig.selectionColor);\n } catch (error) {\n console.error(error);\n }\n }\n\n if (appState.editingTextElement && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isTextElement)(appState.editingTextElement)) {\n const textElement = allElementsMap.get(appState.editingTextElement.id);\n\n if (textElement && !textElement.autoResize) {\n renderTextBox(textElement, context, appState, renderConfig.selectionColor);\n }\n }\n\n if (appState.isBindingEnabled && appState.suggestedBinding) {\n nextAnimationState = Object.assign(Object.assign({}, animationState), {\n bindingHighlight: renderBindingHighlightForBindableElement(app, context, appState.suggestedBinding, allElementsMap, appState, deltaTime, animationState === null || animationState === void 0 ? void 0 : animationState.bindingHighlight)\n });\n } else {\n nextAnimationState = Object.assign(Object.assign({}, animationState), {\n bindingHighlight: undefined\n });\n }\n\n if (appState.frameToHighlight) {\n renderFrameHighlight(context, appState, appState.frameToHighlight, elementsMap);\n }\n\n if (appState.elementsToHighlight) {\n renderElementsBoxHighlight(context, appState, appState.elementsToHighlight);\n }\n\n if (appState.activeLockedId) {\n const element = allElementsMap.get(appState.activeLockedId);\n const elements = element ? [element] : (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementsInGroup)(allElementsMap, appState.activeLockedId);\n renderElementsBoxHighlight(context, appState, elements, {\n colors: [\"#ced4da\"],\n dashed: true\n });\n }\n\n const isFrameSelected = selectedElements.some(element => (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(element)); // Getting the element using LinearElementEditor during collab mismatches version - being one head of visible elements due to\n // ShapeCache returns empty hence making sure that we get the\n // correct element from visible elements\n\n if (selectedElements.length === 1 && ((_a = appState.selectedLinearElement) === null || _a === void 0 ? void 0 : _a.isEditing) && appState.selectedLinearElement.elementId === selectedElements[0].id) {\n renderLinearPointHandles(context, appState, selectedElements[0], elementsMap);\n } // Arrows have a different highlight behavior when\n // they are the only selected element\n\n\n if (appState.selectedLinearElement) {\n const editor = appState.selectedLinearElement;\n const firstSelectedLinear = selectedElements.find(el => el.id === editor.elementId);\n\n if (!appState.selectedLinearElement.isDragging) {\n if (editor.segmentMidPointHoveredCoords) {\n renderElbowArrowMidPointHighlight(context, appState);\n } else if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(firstSelectedLinear) ? editor.hoverPointIndex === 0 || editor.hoverPointIndex === firstSelectedLinear.points.length - 1 : editor.hoverPointIndex >= 0) {\n renderLinearElementPointHighlight(context, appState, elementsMap);\n }\n }\n } // Paint selected elements\n\n\n if (!appState.multiElement && !appState.newElement && !((_b = appState.selectedLinearElement) === null || _b === void 0 ? void 0 : _b.isEditing)) {\n const showBoundingBox = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.hasBoundingBox)(selectedElements, appState, editorInterface);\n const isSingleLinearElementSelected = selectedElements.length === 1 && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isLinearElement)(selectedElements[0]); // render selected linear element points\n\n if (isSingleLinearElementSelected && ((_c = appState.selectedLinearElement) === null || _c === void 0 ? void 0 : _c.elementId) === selectedElements[0].id && !selectedElements[0].locked) {\n renderLinearPointHandles(context, appState, selectedElements[0], elementsMap);\n }\n\n const selectionColor = renderConfig.selectionColor || open_color__WEBPACK_IMPORTED_MODULE_1__.black;\n\n if (showBoundingBox) {\n // Optimisation for finding quickly relevant element ids\n const locallySelectedIds = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.arrayToMap)(selectedElements);\n const selections = [];\n\n for (const element of elementsMap.values()) {\n const selectionColors = [];\n const remoteClients = renderConfig.remoteSelectedElementIds.get(element.id);\n\n if (!( // Elbow arrow elements cannot be selected when bound on either end\n isSingleLinearElementSelected && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isElbowArrow)(element) && (element.startBinding || element.endBinding))) {\n // local user\n if (locallySelectedIds.has(element.id) && !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isSelectedViaGroup)(appState, element)) {\n selectionColors.push(selectionColor);\n } // remote users\n\n\n if (remoteClients) {\n selectionColors.push(...remoteClients.map(socketId => {\n const background = (0,_clients__WEBPACK_IMPORTED_MODULE_7__.getClientColor)(socketId, appState.collaborators.get(socketId));\n return background;\n }));\n }\n }\n\n if (selectionColors.length) {\n const [x1, y1, x2, y2, cx, cy] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementAbsoluteCoords)(element, elementsMap, true);\n selections.push({\n angle: element.angle,\n x1,\n y1,\n x2,\n y2,\n selectionColors: element.locked ? [\"#ced4da\"] : selectionColors,\n dashed: !!remoteClients || element.locked,\n cx,\n cy,\n activeEmbeddable: ((_d = appState.activeEmbeddable) === null || _d === void 0 ? void 0 : _d.element) === element && appState.activeEmbeddable.state === \"active\",\n padding: element.id === appState.croppingElementId || (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isImageElement)(element) ? 0 : undefined\n });\n }\n }\n\n const addSelectionForGroupId = groupId => {\n const groupElements = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementsInGroup)(elementsMap, groupId);\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getCommonBounds)(groupElements);\n selections.push({\n angle: 0,\n x1,\n x2,\n y1,\n y2,\n selectionColors: groupElements.some(el => el.locked) ? [\"#ced4da\"] : [open_color__WEBPACK_IMPORTED_MODULE_1__.black],\n dashed: true,\n cx: x1 + (x2 - x1) / 2,\n cy: y1 + (y2 - y1) / 2,\n activeEmbeddable: false\n });\n };\n\n for (const groupId of (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getSelectedGroupIds)(appState)) {\n // TODO: support multiplayer selected group IDs\n addSelectionForGroupId(groupId);\n }\n\n if (appState.editingGroupId) {\n addSelectionForGroupId(appState.editingGroupId);\n }\n\n selections.forEach(selection => renderSelectionBorder(context, appState, selection));\n } // Paint resize transformHandles\n\n\n context.save();\n context.translate(appState.scrollX, appState.scrollY);\n\n if (selectedElements.length === 1) {\n context.fillStyle = open_color__WEBPACK_IMPORTED_MODULE_1__.white;\n const transformHandles = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getTransformHandles)(selectedElements[0], appState.zoom, elementsMap, \"mouse\", // when we render we don't know which pointer type so use mouse,\n (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getOmitSidesForEditorInterface)(editorInterface));\n\n if (!appState.viewModeEnabled && showBoundingBox && // do not show transform handles when text is being edited\n !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isTextElement)(appState.editingTextElement) && // do not show transform handles when image is being cropped\n !appState.croppingElementId) {\n renderTransformHandles(context, renderConfig, appState, transformHandles, selectedElements[0].angle);\n }\n\n if (appState.croppingElementId && !appState.isCropping) {\n const croppingElement = elementsMap.get(appState.croppingElementId);\n\n if (croppingElement && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isImageElement)(croppingElement)) {\n renderCropHandles(context, renderConfig, appState, croppingElement, elementsMap);\n }\n }\n } else if (selectedElements.length > 1 && !appState.isRotating && !selectedElements.some(el => el.locked)) {\n const dashedLinePadding = _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_TRANSFORM_HANDLE_SPACING * 2 / appState.zoom.value;\n context.fillStyle = open_color__WEBPACK_IMPORTED_MODULE_1__.white;\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getCommonBounds)(selectedElements, elementsMap);\n const initialLineDash = context.getLineDash();\n context.setLineDash([2 / appState.zoom.value]);\n const lineWidth = context.lineWidth;\n context.lineWidth = 1 / appState.zoom.value;\n context.strokeStyle = selectionColor;\n (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.strokeRectWithRotation_simple)(context, x1 - dashedLinePadding, y1 - dashedLinePadding, x2 - x1 + dashedLinePadding * 2, y2 - y1 + dashedLinePadding * 2, (x1 + x2) / 2, (y1 + y2) / 2, 0);\n context.lineWidth = lineWidth;\n context.setLineDash(initialLineDash);\n const transformHandles = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getTransformHandlesFromCoords)([x1, y1, x2, y2, (x1 + x2) / 2, (y1 + y2) / 2], 0, appState.zoom, \"mouse\", isFrameSelected ? Object.assign(Object.assign({}, (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getOmitSidesForEditorInterface)(editorInterface)), {\n rotation: true\n }) : (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getOmitSidesForEditorInterface)(editorInterface));\n\n if (selectedElements.some(element => !element.locked)) {\n renderTransformHandles(context, renderConfig, appState, transformHandles, 0);\n }\n }\n\n context.restore();\n }\n\n (_e = appState.searchMatches) === null || _e === void 0 ? void 0 : _e.matches.forEach(({\n id,\n focus,\n matchedLines\n }) => {\n const element = elementsMap.get(id);\n\n if (element) {\n const [elementX1, elementY1,,, cx, cy] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.getElementAbsoluteCoords)(element, elementsMap, true);\n context.save();\n\n if (appState.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.THEME.LIGHT) {\n if (focus) {\n context.fillStyle = \"rgba(255, 124, 0, 0.4)\";\n } else {\n context.fillStyle = \"rgba(255, 226, 0, 0.4)\";\n }\n } else if (focus) {\n context.fillStyle = \"rgba(229, 82, 0, 0.4)\";\n } else {\n context.fillStyle = \"rgba(99, 52, 0, 0.4)\";\n }\n\n const zoomFactor = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(element) ? appState.zoom.value : 1;\n context.translate(appState.scrollX, appState.scrollY);\n context.translate(cx, cy);\n context.rotate(element.angle);\n matchedLines.forEach(matchedLine => {\n (matchedLine.showOnCanvas || focus) && context.fillRect(elementX1 + matchedLine.offsetX / zoomFactor - cx, elementY1 + matchedLine.offsetY / zoomFactor - cy, matchedLine.width / zoomFactor, matchedLine.height / zoomFactor);\n });\n context.restore();\n }\n });\n (0,_renderer_renderSnaps__WEBPACK_IMPORTED_MODULE_4__.renderSnaps)(context, appState);\n context.restore();\n (0,_clients__WEBPACK_IMPORTED_MODULE_7__.renderRemoteCursors)({\n context,\n renderConfig,\n appState,\n normalizedWidth,\n normalizedHeight\n }); // Paint scrollbars\n\n let scrollBars;\n\n if (renderConfig.renderScrollbars) {\n scrollBars = (0,_scene_scrollbars__WEBPACK_IMPORTED_MODULE_6__.getScrollBars)(elementsMap, normalizedWidth, normalizedHeight, appState);\n context.save();\n context.fillStyle = _scene_scrollbars__WEBPACK_IMPORTED_MODULE_6__.SCROLLBAR_COLOR;\n context.strokeStyle = \"rgba(255,255,255,0.8)\";\n [scrollBars.horizontal, scrollBars.vertical].forEach(scrollBar => {\n if (scrollBar) {\n (0,_renderer_roundRect__WEBPACK_IMPORTED_MODULE_5__.roundRect)(context, scrollBar.x, scrollBar.y, scrollBar.width, scrollBar.height, _scene_scrollbars__WEBPACK_IMPORTED_MODULE_6__.SCROLLBAR_WIDTH / 2);\n }\n });\n context.restore();\n }\n\n return {\n scrollBars,\n atLeastOneVisibleElement: visibleElements.length > 0,\n elementsMap,\n animationState: nextAnimationState\n };\n};\n/**\r\n * Interactive scene is the ui-canvas where we render bounding boxes, selections\r\n * and other ui stuff.\r\n */\n\n\nconst renderInteractiveScene = renderConfig => {\n renderConfig.renderConfig.selectionColor = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_2__.getHighlightColor)(renderConfig.appState.viewBackgroundColor, renderConfig.appState.viewBackgroundColor); //zsviczian\n\n const ret = _renderInteractiveScene(renderConfig);\n\n renderConfig.callback(ret);\n return ret;\n};\n\n//# sourceURL=webpack://ExcalidrawLib/./renderer/interactiveScene.ts?");
|
|
20761
20761
|
|
|
20762
20762
|
/***/ }),
|
|
20763
20763
|
|