@zsviczian/excalidraw 0.18.97 → 0.18.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/excalidraw.development.js +15 -37
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/element/src/bounds.d.ts +18 -1
- package/types/excalidraw/index.d.ts +1 -1
- package/types/utils/src/index.d.ts +1 -2
- package/types/utils/src/bbox.d.ts +0 -9
- package/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -639,7 +639,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
639
639
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
640
640
|
|
|
641
641
|
"use strict";
|
|
642
|
-
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 */ 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 */ oneOf: () => (/* binding */ oneOf),\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 _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"../common/src/constants.ts\");\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\") || target instanceof HTMLElement && target.closest(\".cm-editor\") !== null;\nconst getFontFamilyString = ({\n fontFamily\n}) => {\n for (const [fontFamilyString, id] of Object.entries(_constants__WEBPACK_IMPORTED_MODULE_1__.FONT_FAMILY)) {\n if (id === fontFamily) {\n return `${fontFamilyString}${(0,_constants__WEBPACK_IMPORTED_MODULE_1__.getFontFamilyFallbacks)(id).map(x => `, ${x}`).join(\"\")}`;\n }\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_1__.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 using the latest args\n\nconst throttleRAF = fn => {\n let timerId = null;\n let lastArgs = null;\n\n const scheduleFunc = () => {\n timerId = window.requestAnimationFrame(() => {\n timerId = null;\n const args = lastArgs;\n lastArgs = null;\n\n if (args) {\n fn(...args);\n }\n });\n };\n\n const ret = (...args) => {\n lastArgs = args;\n\n if (timerId === null) {\n scheduleFunc();\n }\n };\n\n ret.flush = () => {\n if (timerId !== null) {\n cancelAnimationFrame(timerId);\n timerId = null;\n }\n\n if (lastArgs) {\n fn(...lastArgs);\n lastArgs = null;\n }\n };\n\n ret.cancel = () => {\n lastArgs = null;\n\n if (timerId !== null) {\n cancelAnimationFrame(timerId);\n timerId = null;\n }\n };\n\n return ret;\n};\n/**\n * Exponential ease-out method\n *\n * @param {number} k - The value to be tweened.\n * @returns {number} The tweened value.\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/**\n * Animates values from `fromValues` to `toValues` using the requestAnimationFrame API.\n * Executes the `onStep` callback on each step with the interpolated values.\n * Returns a function that can be called to cancel the animation.\n *\n * @example\n * // Example usage:\n * const fromValues = { x: 0, y: 0 };\n * const toValues = { x: 100, y: 200 };\n * const onStep = ({x, y}) => {\n * setState(x, y)\n * };\n * const onCancel = () => {\n * console.log(\"Animation canceled\");\n * };\n *\n * const cancelAnimation = easeToValuesRAF({\n * fromValues,\n * toValues,\n * onStep,\n * onCancel,\n * });\n *\n * // To cancel the animation:\n * cancelAnimation();\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/**\n * Checks whether first directional character is RTL. Meaning whether it starts\n * with RTL characters, or indeterminate (numbers etc.) characters followed by\n * RTL.\n * See https://github.com/excalidraw/excalidraw/pull/1722#discussion_r436340171\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 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_1__.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/**\n * Transforms array of objects containing `id` attribute,\n * or array of ids (strings), into a Map, keyd by `id`.\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/**\n * Transform array into an object, use only when array order is irrelevant.\n */\n\nconst arrayToObject = (array, groupBy) => array.reduce((acc, value, idx) => {\n acc[groupBy ? groupBy(value) : idx] = value;\n return acc;\n}, {});\n/**\n * Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.\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/**\n * Converts a readonly array or map into an iterable.\n * Useful for avoiding entry allocations when iterating object / map on each iteration.\n */\n\nconst toIterable = values => {\n return Array.isArray(values) ? values : values.values();\n};\n/**\n * Converts a readonly array or map into an array.\n */\n\nconst toArray = values => {\n return Array.isArray(values) ? values : Array.from(toIterable(values));\n};\nconst isTestEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_1__.ENV.TEST;\nconst isDevEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_1__.ENV.DEVELOPMENT;\nconst isProdEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_1__.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:3016\",\"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\":\"3001\",\"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.97\",\"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/**\n * Returns whether object/array is shallow equal.\n * Considers empty object/arrays as equal (whether top-level or second-level).\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/**\n * supply `null` as message if non-never value is valid, you just need to\n * typecheck against it\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/**\n * Memoizes on values of `opts` object (strict equality).\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/**\n * allows for falsy values so you don't have to type check when adding\n * event listeners to optional elements\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};\nfunction 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/**\n * use when you need to render unsafe string as HTML attribute, but MAKE SURE\n * the attribute is double-quoted when constructing the HTML string\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};\nconst oneOf = (needle, haystack) => {\n return haystack.includes(needle);\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../common/src/utils.ts?\n}");
|
|
642
|
+
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 */ 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 */ oneOf: () => (/* binding */ oneOf),\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 _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"../common/src/constants.ts\");\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\") || target instanceof HTMLElement && target.closest(\".cm-editor\") !== null;\nconst getFontFamilyString = ({\n fontFamily\n}) => {\n for (const [fontFamilyString, id] of Object.entries(_constants__WEBPACK_IMPORTED_MODULE_1__.FONT_FAMILY)) {\n if (id === fontFamily) {\n return `${fontFamilyString}${(0,_constants__WEBPACK_IMPORTED_MODULE_1__.getFontFamilyFallbacks)(id).map(x => `, ${x}`).join(\"\")}`;\n }\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_1__.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 using the latest args\n\nconst throttleRAF = fn => {\n let timerId = null;\n let lastArgs = null;\n\n const scheduleFunc = () => {\n timerId = window.requestAnimationFrame(() => {\n timerId = null;\n const args = lastArgs;\n lastArgs = null;\n\n if (args) {\n fn(...args);\n }\n });\n };\n\n const ret = (...args) => {\n lastArgs = args;\n\n if (timerId === null) {\n scheduleFunc();\n }\n };\n\n ret.flush = () => {\n if (timerId !== null) {\n cancelAnimationFrame(timerId);\n timerId = null;\n }\n\n if (lastArgs) {\n fn(...lastArgs);\n lastArgs = null;\n }\n };\n\n ret.cancel = () => {\n lastArgs = null;\n\n if (timerId !== null) {\n cancelAnimationFrame(timerId);\n timerId = null;\n }\n };\n\n return ret;\n};\n/**\n * Exponential ease-out method\n *\n * @param {number} k - The value to be tweened.\n * @returns {number} The tweened value.\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/**\n * Animates values from `fromValues` to `toValues` using the requestAnimationFrame API.\n * Executes the `onStep` callback on each step with the interpolated values.\n * Returns a function that can be called to cancel the animation.\n *\n * @example\n * // Example usage:\n * const fromValues = { x: 0, y: 0 };\n * const toValues = { x: 100, y: 200 };\n * const onStep = ({x, y}) => {\n * setState(x, y)\n * };\n * const onCancel = () => {\n * console.log(\"Animation canceled\");\n * };\n *\n * const cancelAnimation = easeToValuesRAF({\n * fromValues,\n * toValues,\n * onStep,\n * onCancel,\n * });\n *\n * // To cancel the animation:\n * cancelAnimation();\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/**\n * Checks whether first directional character is RTL. Meaning whether it starts\n * with RTL characters, or indeterminate (numbers etc.) characters followed by\n * RTL.\n * See https://github.com/excalidraw/excalidraw/pull/1722#discussion_r436340171\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 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_1__.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/**\n * Transforms array of objects containing `id` attribute,\n * or array of ids (strings), into a Map, keyd by `id`.\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/**\n * Transform array into an object, use only when array order is irrelevant.\n */\n\nconst arrayToObject = (array, groupBy) => array.reduce((acc, value, idx) => {\n acc[groupBy ? groupBy(value) : idx] = value;\n return acc;\n}, {});\n/**\n * Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.\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/**\n * Converts a readonly array or map into an iterable.\n * Useful for avoiding entry allocations when iterating object / map on each iteration.\n */\n\nconst toIterable = values => {\n return Array.isArray(values) ? values : values.values();\n};\n/**\n * Converts a readonly array or map into an array.\n */\n\nconst toArray = values => {\n return Array.isArray(values) ? values : Array.from(toIterable(values));\n};\nconst isTestEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_1__.ENV.TEST;\nconst isDevEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_1__.ENV.DEVELOPMENT;\nconst isProdEnv = () => \"development\" === _constants__WEBPACK_IMPORTED_MODULE_1__.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:3016\",\"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\":\"3001\",\"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.98\",\"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/**\n * Returns whether object/array is shallow equal.\n * Considers empty object/arrays as equal (whether top-level or second-level).\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/**\n * supply `null` as message if non-never value is valid, you just need to\n * typecheck against it\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/**\n * Memoizes on values of `opts` object (strict equality).\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/**\n * allows for falsy values so you don't have to type check when adding\n * event listeners to optional elements\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};\nfunction 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/**\n * use when you need to render unsafe string as HTML attribute, but MAKE SURE\n * the attribute is double-quoted when constructing the HTML string\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};\nconst oneOf = (needle, haystack) => {\n return haystack.includes(needle);\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../common/src/utils.ts?\n}");
|
|
643
643
|
|
|
644
644
|
/***/ },
|
|
645
645
|
|
|
@@ -727,7 +727,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
727
727
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
728
728
|
|
|
729
729
|
"use strict";
|
|
730
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ElementBounds: () => (/* binding */ ElementBounds),\n/* harmony export */ aabbForElement: () => (/* binding */ aabbForElement),\n/* harmony export */ boundsContainBounds: () => (/* binding */ boundsContainBounds),\n/* harmony export */ doBoundsIntersect: () => (/* binding */ doBoundsIntersect),\n/* harmony export */ elementCenterPoint: () => (/* binding */ elementCenterPoint),\n/* harmony export */ getArrowheadAngle: () => (/* binding */ getArrowheadAngle),\n/* harmony export */ getArrowheadPoints: () => (/* binding */ getArrowheadPoints),\n/* harmony export */ getArrowheadSize: () => (/* binding */ getArrowheadSize),\n/* harmony export */ getBoundsFromPoints: () => (/* binding */ getBoundsFromPoints),\n/* harmony export */ getCenterForBounds: () => (/* binding */ getCenterForBounds),\n/* harmony export */ getClosestElementBounds: () => (/* binding */ getClosestElementBounds),\n/* harmony export */ getCommonBoundingBox: () => (/* binding */ getCommonBoundingBox),\n/* harmony export */ getCommonBounds: () => (/* binding */ getCommonBounds),\n/* harmony export */ getCubicBezierCurveBound: () => (/* binding */ getCubicBezierCurveBound),\n/* harmony export */ getDiamondPoints: () => (/* binding */ getDiamondPoints),\n/* harmony export */ getDraggedElementsBounds: () => (/* binding */ getDraggedElementsBounds),\n/* harmony export */ getElementAbsoluteCoords: () => (/* binding */ getElementAbsoluteCoords),\n/* harmony export */ getElementBounds: () => (/* binding */ getElementBounds),\n/* harmony export */ getElementLineSegments: () => (/* binding */ getElementLineSegments),\n/* harmony export */ getElementPointsCoords: () => (/* binding */ getElementPointsCoords),\n/* harmony export */ getMinMaxXYFromCurvePathOps: () => (/* binding */ getMinMaxXYFromCurvePathOps),\n/* harmony export */ getRectangleBoxAbsoluteCoords: () => (/* binding */ getRectangleBoxAbsoluteCoords),\n/* harmony export */ getResizedElementAbsoluteCoords: () => (/* binding */ getResizedElementAbsoluteCoords),\n/* harmony export */ getVisibleSceneBounds: () => (/* binding */ getVisibleSceneBounds),\n/* harmony export */ pointInsideBounds: () => (/* binding */ pointInsideBounds),\n/* harmony export */ pointInsideBoundsInclusive: () => (/* binding */ pointInsideBoundsInclusive)\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 _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var _excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/utils/shape */ \"../utils/src/shape.ts\");\n/* harmony import */ var points_on_curve__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! points-on-curve */ \"../../node_modules/points-on-curve/lib/index.js\");\n/* harmony import */ var _shape__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./shape */ \"../element/src/shape.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 _typeChecks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./typeChecks */ \"../element/src/typeChecks.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils */ \"../element/src/utils.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\nclass ElementBounds {\n static getBounds(element, elementsMap, nonRotated = false) {\n const cachedBounds = nonRotated && element.angle !== 0 ? ElementBounds.nonRotatedBoundsCache.get(element) : ElementBounds.boundsCache.get(element);\n\n if ((cachedBounds === null || cachedBounds === void 0 ? void 0 : cachedBounds.version) && cachedBounds.version === element.version && // we don't invalidate cache when we update containers and not labels,\n // which is causing problems down the line. Fix TBA.\n !(0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isBoundToContainer)(element)) {\n return cachedBounds.bounds;\n }\n\n if (nonRotated && element.angle !== 0) {\n const nonRotatedBounds = ElementBounds.calculateBounds(Object.assign(Object.assign({}, element), {\n angle: 0\n }), elementsMap);\n ElementBounds.nonRotatedBoundsCache.set(element, {\n version: element.version,\n bounds: nonRotatedBounds\n });\n return nonRotatedBounds;\n }\n\n const bounds = ElementBounds.calculateBounds(element, elementsMap);\n ElementBounds.boundsCache.set(element, {\n version: element.version,\n bounds\n });\n return bounds;\n }\n\n static calculateBounds(element, elementsMap) {\n let bounds;\n const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords(element, elementsMap);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element)) {\n const [minX, minY, maxX, maxY] = getBoundsFromPoints(element.points.map(([x, y]) => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x, y), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx - element.x, cy - element.y), element.angle)));\n return [minX + element.x, minY + element.y, maxX + element.x, maxY + element.y];\n } else if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(element)) {\n bounds = getLinearElementRotatedBounds(element, cx, cy, elementsMap);\n } else if (element.type === \"diamond\") {\n const [x11, y11] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x12, y12] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x22, y22] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, cy), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x21, y21] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, cy), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const minX = Math.min(x11, x12, x22, x21);\n const minY = Math.min(y11, y12, y22, y21);\n const maxX = Math.max(x11, x12, x22, x21);\n const maxY = Math.max(y11, y12, y22, y21);\n bounds = [minX, minY, maxX, maxY];\n } else if (element.type === \"ellipse\") {\n const w = (x2 - x1) / 2;\n const h = (y2 - y1) / 2;\n const cos = Math.cos(element.angle);\n const sin = Math.sin(element.angle);\n const ww = Math.hypot(w * cos, h * sin);\n const hh = Math.hypot(h * cos, w * sin);\n bounds = [cx - ww, cy - hh, cx + ww, cy + hh];\n } else {\n const [x11, y11] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x12, y12] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x22, y22] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x21, y21] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const minX = Math.min(x11, x12, x22, x21);\n const minY = Math.min(y11, y12, y22, y21);\n const maxX = Math.max(x11, x12, x22, x21);\n const maxY = Math.max(y11, y12, y22, y21);\n bounds = [minX, minY, maxX, maxY];\n }\n\n return bounds;\n }\n\n}\nElementBounds.boundsCache = new WeakMap();\nElementBounds.nonRotatedBoundsCache = new WeakMap(); // Scene -> Scene coords, but in x1,x2,y1,y2 format.\n//\n// If the element is created from right to left, the width is going to be negative\n// This set of functions retrieves the absolute position of the 4 points.\n\nconst getElementAbsoluteCoords = (element, elementsMap, includeBoundText = false) => {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element)) {\n return getFreeDrawElementAbsoluteCoords(element);\n } else if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(element)) {\n return _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getElementAbsoluteCoords(element, elementsMap, includeBoundText);\n } else if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isTextElement)(element)) {\n const container = elementsMap ? (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getContainerElement)(element, elementsMap) : null;\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isArrowElement)(container)) {\n const {\n x,\n y\n } = _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getBoundTextElementPosition(container, element, elementsMap);\n return [x, y, x + element.width, y + element.height, x + element.width / 2, y + element.height / 2];\n }\n }\n\n return [element.x, element.y, element.x + element.width, element.y + element.height, element.x + element.width / 2, element.y + element.height / 2];\n};\n/*\n * for a given element, `getElementLineSegments` returns line segments\n * that can be used for visual collision detection (useful for frames)\n * as opposed to bounding box collision detection\n */\n\n/**\n * Given an element, return the line segments that make up the element.\n *\n * Uses helpers from /math\n */\n\nconst getElementLineSegments = (element, elementsMap) => {\n const shape = (0,_shape__WEBPACK_IMPORTED_MODULE_5__.getElementShape)(element, elementsMap);\n const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords(element, elementsMap);\n const center = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy);\n\n if (shape.type === \"polycurve\") {\n const curves = shape.data;\n const pointsOnCurves = curves.map(curve => (0,points_on_curve__WEBPACK_IMPORTED_MODULE_4__.pointsOnBezierCurves)(curve, 10));\n const segments = [];\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLineElement)(element) && !element.polygon || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isArrowElement)(element)) {\n for (const points of pointsOnCurves) {\n let i = 0;\n\n while (i < points.length - 1) {\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i][0], points[i][1]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i + 1][0], points[i + 1][1])));\n i++;\n }\n }\n } else {\n const points = pointsOnCurves.flat();\n let i = 0;\n\n while (i < points.length - 1) {\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i][0], points[i][1]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i + 1][0], points[i + 1][1])));\n i++;\n }\n }\n\n return segments;\n } else if (shape.type === \"polyline\") {\n return shape.data;\n } else if (_isRectanguloidElement(element)) {\n const [sides, corners] = (0,_utils__WEBPACK_IMPORTED_MODULE_9__.deconstructRectanguloidElement)(element);\n const cornerSegments = corners.map(corner => getSegmentsOnCurve(corner, center, element.angle)).flat();\n const rotatedSides = getRotatedSides(sides, center, element.angle);\n return [...rotatedSides, ...cornerSegments];\n } else if (element.type === \"diamond\") {\n const [sides, corners] = (0,_utils__WEBPACK_IMPORTED_MODULE_9__.deconstructDiamondElement)(element);\n const cornerSegments = corners.map(corner => getSegmentsOnCurve(corner, center, element.angle)).flat();\n const rotatedSides = getRotatedSides(sides, center, element.angle);\n return [...rotatedSides, ...cornerSegments];\n } else if (shape.type === \"polygon\") {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isTextElement)(element)) {\n const container = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getContainerElement)(element, elementsMap);\n\n if (container && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(container)) {\n const segments = [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y1)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y2)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y2)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y1))];\n return segments;\n }\n }\n\n const points = shape.data;\n const segments = [];\n\n for (let i = 0; i < points.length - 1; i++) {\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(points[i], points[i + 1]));\n }\n\n return segments;\n } else if (shape.type === \"ellipse\") {\n return getSegmentsOnEllipse(element);\n }\n\n const [nw, ne, sw, se,,, w, e] = [[x1, y1], [x2, y1], [x1, y2], [x2, y2], [cx, y1], [cx, y2], [x1, cy], [x2, cy]].map(point => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)(point, center, element.angle));\n return [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(nw, ne), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(sw, se), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(nw, sw), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(ne, se), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(nw, e), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(sw, e), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(ne, w), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(se, w)];\n};\n\nconst _isRectanguloidElement = element => {\n return element != null && (element.type === \"rectangle\" || element.type === \"image\" || element.type === \"iframe\" || element.type === \"embeddable\" || element.type === \"frame\" || element.type === \"magicframe\" || element.type === \"text\" && !element.containerId);\n};\n\nconst getRotatedSides = (sides, center, angle) => {\n return sides.map(side => {\n return (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)(side[0], center, angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)(side[1], center, angle));\n });\n};\n\nconst getSegmentsOnCurve = (curve, center, angle) => {\n const points = (0,points_on_curve__WEBPACK_IMPORTED_MODULE_4__.pointsOnBezierCurves)(curve, 10);\n let i = 0;\n const segments = [];\n\n while (i < points.length - 1) {\n segments.push((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[i][0], points[i][1]), center, angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i + 1][0], points[i + 1][1]), center, angle)));\n i++;\n }\n\n return segments;\n};\n\nconst getSegmentsOnEllipse = ellipse => {\n const center = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(ellipse.x + ellipse.width / 2, ellipse.y + ellipse.height / 2);\n const a = ellipse.width / 2;\n const b = ellipse.height / 2;\n const segments = [];\n const points = [];\n const n = 90;\n const deltaT = Math.PI * 2 / n;\n\n for (let i = 0; i < n; i++) {\n const t = i * deltaT;\n const x = center[0] + a * Math.cos(t);\n const y = center[1] + b * Math.sin(t);\n points.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x, y), center, ellipse.angle));\n }\n\n for (let i = 0; i < points.length - 1; i++) {\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(points[i], points[i + 1]));\n }\n\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(points[points.length - 1], points[0]));\n return segments;\n};\n/**\n * Scene -> Scene coords, but in x1,x2,y1,y2 format.\n *\n * Rectangle here means any rectangular frame, not an excalidraw element.\n */\n\n\nconst getRectangleBoxAbsoluteCoords = boxSceneCoords => {\n return [boxSceneCoords.x, boxSceneCoords.y, boxSceneCoords.x + boxSceneCoords.width, boxSceneCoords.y + boxSceneCoords.height, boxSceneCoords.x + boxSceneCoords.width / 2, boxSceneCoords.y + boxSceneCoords.height / 2];\n};\nconst getDiamondPoints = element => {\n // Here we add +1 to avoid these numbers to be 0\n // otherwise rough.js will throw an error complaining about it\n const topX = Math.floor(element.width / 2) + 1;\n const topY = 0;\n const rightX = element.width;\n const rightY = Math.floor(element.height / 2) + 1;\n const bottomX = topX;\n const bottomY = element.height;\n const leftX = 0;\n const leftY = rightY;\n return [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY];\n}; // reference: https://eliot-jones.com/2019/12/cubic-bezier-curve-bounding-boxes\n\nconst getBezierValueForT = (t, p0, p1, p2, p3) => {\n const oneMinusT = 1 - t;\n return Math.pow(oneMinusT, 3) * p0 + 3 * Math.pow(oneMinusT, 2) * t * p1 + 3 * oneMinusT * Math.pow(t, 2) * p2 + Math.pow(t, 3) * p3;\n};\n\nconst solveQuadratic = (p0, p1, p2, p3) => {\n const i = p1 - p0;\n const j = p2 - p1;\n const k = p3 - p2;\n const a = 3 * i - 6 * j + 3 * k;\n const b = 6 * j - 6 * i;\n const c = 3 * i;\n const sqrtPart = b * b - 4 * a * c;\n const hasSolution = sqrtPart >= 0;\n\n if (!hasSolution) {\n return false;\n }\n\n let s1 = null;\n let s2 = null;\n let t1 = Infinity;\n let t2 = Infinity;\n\n if (a === 0) {\n t1 = t2 = -c / b;\n } else {\n t1 = (-b + Math.sqrt(sqrtPart)) / (2 * a);\n t2 = (-b - Math.sqrt(sqrtPart)) / (2 * a);\n }\n\n if (t1 >= 0 && t1 <= 1) {\n s1 = getBezierValueForT(t1, p0, p1, p2, p3);\n }\n\n if (t2 >= 0 && t2 <= 1) {\n s2 = getBezierValueForT(t2, p0, p1, p2, p3);\n }\n\n return [s1, s2];\n};\n\nconst getCubicBezierCurveBound = (p0, p1, p2, p3) => {\n const solX = solveQuadratic(p0[0], p1[0], p2[0], p3[0]);\n const solY = solveQuadratic(p0[1], p1[1], p2[1], p3[1]);\n let minX = Math.min(p0[0], p3[0]);\n let maxX = Math.max(p0[0], p3[0]);\n\n if (solX) {\n const xs = solX.filter(x => x !== null);\n minX = Math.min(minX, ...xs);\n maxX = Math.max(maxX, ...xs);\n }\n\n let minY = Math.min(p0[1], p3[1]);\n let maxY = Math.max(p0[1], p3[1]);\n\n if (solY) {\n const ys = solY.filter(y => y !== null);\n minY = Math.min(minY, ...ys);\n maxY = Math.max(maxY, ...ys);\n }\n\n return [minX, minY, maxX, maxY];\n};\nconst getMinMaxXYFromCurvePathOps = (ops, transformXY) => {\n let currentP = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(0, 0);\n const {\n minX,\n minY,\n maxX,\n maxY\n } = ops.reduce((limits, {\n op,\n data\n }) => {\n // There are only four operation types:\n // move, bcurveTo, lineTo, and curveTo\n if (op === \"move\") {\n // change starting point\n const p = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFromArray)(data);\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.invariant)(p != null, \"Op data is not a point\");\n currentP = p; // move operation does not draw anything; so, it always\n // returns false\n } else if (op === \"bcurveTo\") {\n const _p1 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[0], data[1]);\n\n const _p2 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[2], data[3]);\n\n const _p3 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[4], data[5]);\n\n const p1 = transformXY ? transformXY(_p1) : _p1;\n const p2 = transformXY ? transformXY(_p2) : _p2;\n const p3 = transformXY ? transformXY(_p3) : _p3;\n const p0 = transformXY ? transformXY(currentP) : currentP;\n currentP = _p3;\n const [minX, minY, maxX, maxY] = getCubicBezierCurveBound(p0, p1, p2, p3);\n limits.minX = Math.min(limits.minX, minX);\n limits.minY = Math.min(limits.minY, minY);\n limits.maxX = Math.max(limits.maxX, maxX);\n limits.maxY = Math.max(limits.maxY, maxY);\n } else if (op === \"lineTo\") {// TODO: Implement this\n } else if (op === \"qcurveTo\") {// TODO: Implement this\n }\n\n return limits;\n }, {\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n });\n return [minX, minY, maxX, maxY];\n};\nconst getBoundsFromPoints = (points, padding = 0) => {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n for (const [x, y] of points) {\n minX = Math.min(minX, x);\n minY = Math.min(minY, y);\n maxX = Math.max(maxX, x);\n maxY = Math.max(maxY, y);\n }\n\n return [minX - padding, minY - padding, maxX + padding, maxY + padding];\n};\n\nconst getFreeDrawElementAbsoluteCoords = element => {\n const [minX, minY, maxX, maxY] = getBoundsFromPoints(element.points);\n const x1 = minX + element.x;\n const y1 = minY + element.y;\n const x2 = maxX + element.x;\n const y2 = maxY + element.y;\n return [x1, y1, x2, y2, (x1 + x2) / 2, (y1 + y2) / 2];\n};\n\nconst CARDINALITY_MARKER_SIZE = 20;\nconst CROWFOOT_ARROWHEAD_SIZE = 15;\n/** @returns number in pixels */\n\nconst getArrowheadSize = arrowhead => {\n switch (arrowhead) {\n case \"arrow\":\n return 25;\n\n case \"diamond\":\n case \"diamond_outline\":\n return 12;\n\n case \"cardinality_many\":\n case \"cardinality_one_or_many\":\n case \"cardinality_zero_or_many\":\n return CROWFOOT_ARROWHEAD_SIZE;\n\n case \"cardinality_one\":\n case \"cardinality_exactly_one\":\n case \"cardinality_zero_or_one\":\n return CARDINALITY_MARKER_SIZE;\n\n default:\n return 15;\n }\n};\n/** @returns number in degrees */\n\nconst getArrowheadAngle = arrowhead => {\n switch (arrowhead) {\n case \"bar\":\n return 90;\n\n case \"arrow\":\n return 20;\n\n default:\n return 25;\n }\n};\nconst getArrowheadPoints = (element, shape, position, arrowhead, offsetMultiplier = 0) => {\n if (arrowhead === null) {\n return null;\n }\n\n if (shape.length < 1) {\n return null;\n }\n\n const ops = (0,_excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__.getCurvePathOps)(shape[0]);\n\n if (ops.length < 1) {\n return null;\n } // The index of the bCurve operation to examine.\n\n\n const index = position === \"start\" ? 1 : ops.length - 1;\n const data = ops[index].data;\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.invariant)(data.length === 6, \"Op data length is not 6\");\n const p3 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[4], data[5]);\n const p2 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[2], data[3]);\n const p1 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[0], data[1]); // We need to find p0 of the bezier curve.\n // It is typically the last point of the previous\n // curve; it can also be the position of moveTo operation.\n\n const prevOp = ops[index - 1];\n let p0 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(0, 0);\n\n if (prevOp.op === \"move\") {\n const p = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFromArray)(prevOp.data);\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.invariant)(p != null, \"Op data is not a point\");\n p0 = p;\n } else if (prevOp.op === \"bcurveTo\") {\n p0 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(prevOp.data[4], prevOp.data[5]);\n } // B(t) = p0 * (1-t)^3 + 3p1 * t * (1-t)^2 + 3p2 * t^2 * (1-t) + p3 * t^3\n\n\n const equation = (t, idx) => Math.pow(1 - t, 3) * p3[idx] + 3 * t * Math.pow(1 - t, 2) * p2[idx] + 3 * Math.pow(t, 2) * (1 - t) * p1[idx] + p0[idx] * Math.pow(t, 3); // Ee know the last point of the arrow (or the first, if start arrowhead).\n\n\n const [x2, y2] = position === \"start\" ? p0 : p3; // By using cubic bezier equation (B(t)) and the given parameters,\n // we calculate a point that is closer to the last point.\n // The value 0.3 is chosen arbitrarily and it works best for all\n // the tested cases.\n\n const [x1, y1] = [equation(0.3, 0), equation(0.3, 1)]; // Find the normalized direction vector based on the\n // previously calculated points.\n\n const distance = Math.hypot(x2 - x1, y2 - y1);\n const nx = (x2 - x1) / distance;\n const ny = (y2 - y1) / distance;\n const size = getArrowheadSize(arrowhead);\n let length = 0;\n {\n // Length for -> arrows is based on the length of the last section\n const [cx, cy] = position === \"end\" ? element.points[element.points.length - 1] : element.points[0];\n const [px, py] = element.points.length > 1 ? position === \"end\" ? element.points[element.points.length - 2] : element.points[1] : [0, 0];\n length = Math.hypot(cx - px, cy - py);\n } // Scale down the arrowhead until we hit a certain size so that it doesn't look weird.\n // This value is selected by minimizing a minimum size with the last segment of the arrowhead\n\n const lengthMultiplier = arrowhead === \"diamond\" || arrowhead === \"diamond_outline\" ? 0.25 : 0.5;\n const minSize = Math.min(size, length * lengthMultiplier);\n const tx = x2 - nx * minSize * offsetMultiplier;\n const ty = y2 - ny * minSize * offsetMultiplier;\n const xs = tx - nx * minSize;\n const ys = ty - ny * minSize;\n\n if (arrowhead === \"circle\" || arrowhead === \"circle_outline\") {\n const diameter = Math.hypot(ys - ty, xs - tx) + element.strokeWidth - 2;\n return [tx, ty, diameter]; //zsviczian\n }\n\n const angle = getArrowheadAngle(arrowhead);\n\n if (arrowhead === \"cardinality_many\" || arrowhead === \"cardinality_one_or_many\") {\n // swap (xs, ys) with (x2, y2)\n const [x3, y3] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(xs, ys), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.degreesToRadians)(-angle));\n const [x4, y4] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(xs, ys), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.degreesToRadians)(angle));\n return [xs, ys, x3, y3, x4, y4];\n } // Return points\n\n\n const [x3, y3] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(xs, ys), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), -angle * Math.PI / 180);\n const [x4, y4] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(xs, ys), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.degreesToRadians)(angle));\n\n if (arrowhead === \"diamond\" || arrowhead === \"diamond_outline\") {\n // point opposite to the arrowhead point\n let ox;\n let oy;\n\n if (position === \"start\") {\n const [px, py] = element.points.length > 1 ? element.points[1] : [0, 0];\n [ox, oy] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx + minSize * 2, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), Math.atan2(py - ty, px - tx));\n } else {\n const [px, py] = element.points.length > 1 ? element.points[element.points.length - 2] : [0, 0];\n [ox, oy] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx - minSize * 2, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), Math.atan2(ty - py, tx - px));\n }\n\n return [tx, ty, x3, y3, ox, oy, x4, y4];\n }\n\n return [tx, ty, x3, y3, x4, y4];\n}; // TODO reuse shape.ts\n\nconst generateLinearElementShape = element => {\n const generator = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generator();\n const options = (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element);\n\n const method = (() => {\n if (element.roundness) {\n return \"curve\";\n }\n\n if (options.fill) {\n return \"polygon\";\n }\n\n return \"linearPath\";\n })();\n\n return generator[method](element.points, options);\n};\n\nconst getLinearElementRotatedBounds = (element, cx, cy, elementsMap) => {\n var _a;\n\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n\n if (element.points.length < 2) {\n const [pointX, pointY] = element.points[0];\n const [x, y] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(element.x + pointX, element.y + pointY), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n let coords = [x, y, x, y];\n\n if (boundTextElement) {\n const coordsWithBoundText = _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getMinMaxXYWithBoundText(element, elementsMap, [x, y, x, y], boundTextElement);\n coords = [coordsWithBoundText[0], coordsWithBoundText[1], coordsWithBoundText[2], coordsWithBoundText[3]];\n }\n\n return coords;\n } // first element is always the curve\n\n\n const cachedShape = (_a = _shape__WEBPACK_IMPORTED_MODULE_5__.ShapeCache.get(element, null)) === null || _a === void 0 ? void 0 : _a[0];\n const shape = cachedShape !== null && cachedShape !== void 0 ? cachedShape : generateLinearElementShape(element);\n const ops = (0,_excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__.getCurvePathOps)(shape);\n\n const transformXY = ([x, y]) => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(element.x + x, element.y + y), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n\n const res = getMinMaxXYFromCurvePathOps(ops, transformXY);\n let coords = [res[0], res[1], res[2], res[3]];\n\n if (boundTextElement) {\n const coordsWithBoundText = _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getMinMaxXYWithBoundText(element, elementsMap, coords, boundTextElement);\n coords = [coordsWithBoundText[0], coordsWithBoundText[1], coordsWithBoundText[2], coordsWithBoundText[3]];\n }\n\n return coords;\n};\n\nconst getElementBounds = (element, elementsMap, nonRotated = false) => {\n return ElementBounds.getBounds(element, elementsMap, nonRotated);\n};\nconst getCommonBounds = (elements, elementsMap) => {\n if (!(0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.sizeOf)(elements)) {\n return [0, 0, 0, 0];\n }\n\n let minX = Infinity;\n let maxX = -Infinity;\n let minY = Infinity;\n let maxY = -Infinity;\n\n const _elementsMap = elementsMap || (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(elements);\n\n elements.forEach(element => {\n const [x1, y1, x2, y2] = getElementBounds(element, _elementsMap);\n minX = Math.min(minX, x1);\n minY = Math.min(minY, y1);\n maxX = Math.max(maxX, x2);\n maxY = Math.max(maxY, y2);\n });\n return [minX, minY, maxX, maxY];\n};\nconst getDraggedElementsBounds = (elements, dragOffset) => {\n const [minX, minY, maxX, maxY] = getCommonBounds(elements);\n return [minX + dragOffset.x, minY + dragOffset.y, maxX + dragOffset.x, maxY + dragOffset.y];\n};\nconst getResizedElementAbsoluteCoords = (element, nextWidth, nextHeight, normalizePoints) => {\n if (!((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element))) {\n return [element.x, element.y, element.x + nextWidth, element.y + nextHeight];\n }\n\n const points = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.rescalePoints)(0, nextWidth, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.rescalePoints)(1, nextHeight, element.points, normalizePoints), normalizePoints);\n let bounds;\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element)) {\n // Free Draw\n bounds = getBoundsFromPoints(points);\n } else {\n // Line\n const gen = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generator();\n const curve = !element.roundness ? gen.linearPath(points, (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element)) : gen.curve(points, (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element));\n const ops = (0,_excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__.getCurvePathOps)(curve);\n bounds = getMinMaxXYFromCurvePathOps(ops);\n }\n\n const [minX, minY, maxX, maxY] = bounds;\n return [minX + element.x, minY + element.y, maxX + element.x, maxY + element.y];\n};\nconst getElementPointsCoords = (element, points) => {\n // This might be computationally heavey\n const gen = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generator();\n const curve = element.roundness == null ? gen.linearPath(points, (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element)) : gen.curve(points, (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element));\n const ops = (0,_excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__.getCurvePathOps)(curve);\n const [minX, minY, maxX, maxY] = getMinMaxXYFromCurvePathOps(ops);\n return [minX + element.x, minY + element.y, maxX + element.x, maxY + element.y];\n};\nconst getClosestElementBounds = (elements, from) => {\n if (!elements.length) {\n return [0, 0, 0, 0];\n }\n\n let minDistance = Infinity;\n let closestElement = elements[0];\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(elements);\n elements.forEach(element => {\n const [x1, y1, x2, y2] = getElementBounds(element, elementsMap);\n const distance = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointDistance)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)((x1 + x2) / 2, (y1 + y2) / 2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(from.x, from.y));\n\n if (distance < minDistance) {\n minDistance = distance;\n closestElement = element;\n }\n });\n return getElementBounds(closestElement, elementsMap);\n};\nconst getCommonBoundingBox = elements => {\n const [minX, minY, maxX, maxY] = getCommonBounds(elements);\n return {\n minX,\n minY,\n maxX,\n maxY,\n width: maxX - minX,\n height: maxY - minY,\n midX: (minX + maxX) / 2,\n midY: (minY + maxY) / 2\n };\n};\n/**\n * returns scene coords of user's editor viewport (visible canvas area) bounds\n */\n\nconst getVisibleSceneBounds = ({\n scrollX,\n scrollY,\n width,\n height,\n zoom\n}) => {\n return [-scrollX, -scrollY, -scrollX + width / zoom.value, -scrollY + height / zoom.value];\n};\nconst getCenterForBounds = bounds => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bounds[0] + (bounds[2] - bounds[0]) / 2, bounds[1] + (bounds[3] - bounds[1]) / 2);\n/**\n * Get the axis-aligned bounding box for a given element\n */\n\nconst aabbForElement = (element, elementsMap, offset) => {\n const bbox = {\n minX: element.x,\n minY: element.y,\n maxX: element.x + element.width,\n maxY: element.y + element.height,\n midX: element.x + element.width / 2,\n midY: element.y + element.height / 2\n };\n const center = elementCenterPoint(element, elementsMap);\n const [topLeftX, topLeftY] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bbox.minX, bbox.minY), center, element.angle);\n const [topRightX, topRightY] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bbox.maxX, bbox.minY), center, element.angle);\n const [bottomRightX, bottomRightY] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bbox.maxX, bbox.maxY), center, element.angle);\n const [bottomLeftX, bottomLeftY] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bbox.minX, bbox.maxY), center, element.angle);\n const bounds = [Math.min(topLeftX, topRightX, bottomRightX, bottomLeftX), Math.min(topLeftY, topRightY, bottomRightY, bottomLeftY), Math.max(topLeftX, topRightX, bottomRightX, bottomLeftX), Math.max(topLeftY, topRightY, bottomRightY, bottomLeftY)];\n\n if (offset) {\n const [topOffset, rightOffset, downOffset, leftOffset] = offset;\n return [bounds[0] - leftOffset, bounds[1] - topOffset, bounds[2] + rightOffset, bounds[3] + downOffset];\n }\n\n return bounds;\n};\nconst pointInsideBounds = (p, bounds) => p[0] > bounds[0] && p[0] < bounds[2] && p[1] > bounds[1] && p[1] < bounds[3]; // TODO make pointInsideBounds inclusive and remove this function once we\n// test nothing is breaking\n\nconst pointInsideBoundsInclusive = (p, bounds) => p[0] >= bounds[0] && p[0] <= bounds[2] && p[1] >= bounds[1] && p[1] <= bounds[3];\nconst doBoundsIntersect = (bounds1, bounds2) => {\n if (bounds1 == null || bounds2 == null) {\n return false;\n }\n\n const [minX1, minY1, maxX1, maxY1] = bounds1;\n const [minX2, minY2, maxX2, maxY2] = bounds2;\n return minX1 < maxX2 && maxX1 > minX2 && minY1 < maxY2 && maxY1 > minY2;\n};\nconst boundsContainBounds = (outerBounds, innerBounds) => [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(innerBounds[0], innerBounds[1]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(innerBounds[0], innerBounds[3]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(innerBounds[2], innerBounds[1]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(innerBounds[2], innerBounds[3])].every(point => pointInsideBoundsInclusive(point, outerBounds));\nconst elementCenterPoint = (element, elementsMap, xOffset = 0, yOffset = 0) => {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element)) {\n const [x1, y1, x2, y2] = getElementAbsoluteCoords(element, elementsMap);\n const [x, y] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)((x1 + x2) / 2, (y1 + y2) / 2);\n return (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x + xOffset, y + yOffset);\n }\n\n const [x, y] = getCenterForBounds(getElementBounds(element, elementsMap));\n return (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x + xOffset, y + yOffset);\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/bounds.ts?\n}");
|
|
730
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ElementBounds: () => (/* binding */ ElementBounds),\n/* harmony export */ aabbForElement: () => (/* binding */ aabbForElement),\n/* harmony export */ boundsContainBounds: () => (/* binding */ boundsContainBounds),\n/* harmony export */ doBoundsIntersect: () => (/* binding */ doBoundsIntersect),\n/* harmony export */ elementCenterPoint: () => (/* binding */ elementCenterPoint),\n/* harmony export */ elementsOverlappingBBox: () => (/* binding */ elementsOverlappingBBox),\n/* harmony export */ getArrowheadAngle: () => (/* binding */ getArrowheadAngle),\n/* harmony export */ getArrowheadPoints: () => (/* binding */ getArrowheadPoints),\n/* harmony export */ getArrowheadSize: () => (/* binding */ getArrowheadSize),\n/* harmony export */ getBoundsFromPoints: () => (/* binding */ getBoundsFromPoints),\n/* harmony export */ getCenterForBounds: () => (/* binding */ getCenterForBounds),\n/* harmony export */ getClosestElementBounds: () => (/* binding */ getClosestElementBounds),\n/* harmony export */ getCommonBoundingBox: () => (/* binding */ getCommonBoundingBox),\n/* harmony export */ getCommonBounds: () => (/* binding */ getCommonBounds),\n/* harmony export */ getCubicBezierCurveBound: () => (/* binding */ getCubicBezierCurveBound),\n/* harmony export */ getDiamondPoints: () => (/* binding */ getDiamondPoints),\n/* harmony export */ getDraggedElementsBounds: () => (/* binding */ getDraggedElementsBounds),\n/* harmony export */ getElementAbsoluteCoords: () => (/* binding */ getElementAbsoluteCoords),\n/* harmony export */ getElementBounds: () => (/* binding */ getElementBounds),\n/* harmony export */ getElementLineSegments: () => (/* binding */ getElementLineSegments),\n/* harmony export */ getElementPointsCoords: () => (/* binding */ getElementPointsCoords),\n/* harmony export */ getMinMaxXYFromCurvePathOps: () => (/* binding */ getMinMaxXYFromCurvePathOps),\n/* harmony export */ getRectangleBoxAbsoluteCoords: () => (/* binding */ getRectangleBoxAbsoluteCoords),\n/* harmony export */ getResizedElementAbsoluteCoords: () => (/* binding */ getResizedElementAbsoluteCoords),\n/* harmony export */ getVisibleSceneBounds: () => (/* binding */ getVisibleSceneBounds),\n/* harmony export */ pointInsideBounds: () => (/* binding */ pointInsideBounds),\n/* harmony export */ pointInsideBoundsInclusive: () => (/* binding */ pointInsideBoundsInclusive)\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 _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var _excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/utils/shape */ \"../utils/src/shape.ts\");\n/* harmony import */ var points_on_curve__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! points-on-curve */ \"../../node_modules/points-on-curve/lib/index.js\");\n/* harmony import */ var _shape__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./shape */ \"../element/src/shape.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 _typeChecks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./typeChecks */ \"../element/src/typeChecks.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils */ \"../element/src/utils.ts\");\n/* harmony import */ var _collision__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./collision */ \"../element/src/collision.ts\");\n/* harmony import */ var _frame__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./frame */ \"../element/src/frame.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nclass ElementBounds {\n static getBounds(element, elementsMap, nonRotated = false) {\n const cachedBounds = nonRotated && element.angle !== 0 ? ElementBounds.nonRotatedBoundsCache.get(element) : ElementBounds.boundsCache.get(element);\n\n if ((cachedBounds === null || cachedBounds === void 0 ? void 0 : cachedBounds.version) && cachedBounds.version === element.version && // we don't invalidate cache when we update containers and not labels,\n // which is causing problems down the line. Fix TBA.\n !(0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isBoundToContainer)(element)) {\n return cachedBounds.bounds;\n }\n\n if (nonRotated && element.angle !== 0) {\n const nonRotatedBounds = ElementBounds.calculateBounds(Object.assign(Object.assign({}, element), {\n angle: 0\n }), elementsMap);\n ElementBounds.nonRotatedBoundsCache.set(element, {\n version: element.version,\n bounds: nonRotatedBounds\n });\n return nonRotatedBounds;\n }\n\n const bounds = ElementBounds.calculateBounds(element, elementsMap);\n ElementBounds.boundsCache.set(element, {\n version: element.version,\n bounds\n });\n return bounds;\n }\n\n static calculateBounds(element, elementsMap) {\n let bounds;\n const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords(element, elementsMap);\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element)) {\n const [minX, minY, maxX, maxY] = getBoundsFromPoints(element.points.map(([x, y]) => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x, y), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx - element.x, cy - element.y), element.angle)));\n return [minX + element.x, minY + element.y, maxX + element.x, maxY + element.y];\n } else if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(element)) {\n bounds = getLinearElementRotatedBounds(element, cx, cy, elementsMap);\n } else if (element.type === \"diamond\") {\n const [x11, y11] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x12, y12] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x22, y22] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, cy), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x21, y21] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, cy), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const minX = Math.min(x11, x12, x22, x21);\n const minY = Math.min(y11, y12, y22, y21);\n const maxX = Math.max(x11, x12, x22, x21);\n const maxY = Math.max(y11, y12, y22, y21);\n bounds = [minX, minY, maxX, maxY];\n } else if (element.type === \"ellipse\") {\n const w = (x2 - x1) / 2;\n const h = (y2 - y1) / 2;\n const cos = Math.cos(element.angle);\n const sin = Math.sin(element.angle);\n const ww = Math.hypot(w * cos, h * sin);\n const hh = Math.hypot(h * cos, w * sin);\n bounds = [cx - ww, cy - hh, cx + ww, cy + hh];\n } else {\n const [x11, y11] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x12, y12] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x22, y22] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const [x21, y21] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n const minX = Math.min(x11, x12, x22, x21);\n const minY = Math.min(y11, y12, y22, y21);\n const maxX = Math.max(x11, x12, x22, x21);\n const maxY = Math.max(y11, y12, y22, y21);\n bounds = [minX, minY, maxX, maxY];\n }\n\n return bounds;\n }\n\n}\nElementBounds.boundsCache = new WeakMap();\nElementBounds.nonRotatedBoundsCache = new WeakMap(); // Scene -> Scene coords, but in x1,x2,y1,y2 format.\n//\n// If the element is created from right to left, the width is going to be negative\n// This set of functions retrieves the absolute position of the 4 points.\n\nconst getElementAbsoluteCoords = (element, elementsMap, includeBoundText = false) => {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element)) {\n return getFreeDrawElementAbsoluteCoords(element);\n } else if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(element)) {\n return _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getElementAbsoluteCoords(element, elementsMap, includeBoundText);\n } else if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isTextElement)(element)) {\n const container = elementsMap ? (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getContainerElement)(element, elementsMap) : null;\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isArrowElement)(container)) {\n const {\n x,\n y\n } = _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getBoundTextElementPosition(container, element, elementsMap);\n return [x, y, x + element.width, y + element.height, x + element.width / 2, y + element.height / 2];\n }\n }\n\n return [element.x, element.y, element.x + element.width, element.y + element.height, element.x + element.width / 2, element.y + element.height / 2];\n};\n/*\n * for a given element, `getElementLineSegments` returns line segments\n * that can be used for visual collision detection (useful for frames)\n * as opposed to bounding box collision detection\n */\n\n/**\n * Given an element, return the line segments that make up the element.\n *\n * Uses helpers from /math\n */\n\nconst getElementLineSegments = (element, elementsMap) => {\n const shape = (0,_shape__WEBPACK_IMPORTED_MODULE_5__.getElementShape)(element, elementsMap);\n const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords(element, elementsMap);\n const center = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy);\n\n if (shape.type === \"polycurve\") {\n const curves = shape.data;\n const pointsOnCurves = curves.map(curve => (0,points_on_curve__WEBPACK_IMPORTED_MODULE_4__.pointsOnBezierCurves)(curve, 10));\n const segments = [];\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLineElement)(element) && !element.polygon || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isArrowElement)(element)) {\n for (const points of pointsOnCurves) {\n let i = 0;\n\n while (i < points.length - 1) {\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i][0], points[i][1]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i + 1][0], points[i + 1][1])));\n i++;\n }\n }\n } else {\n const points = pointsOnCurves.flat();\n let i = 0;\n\n while (i < points.length - 1) {\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i][0], points[i][1]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i + 1][0], points[i + 1][1])));\n i++;\n }\n }\n\n return segments;\n } else if (shape.type === \"polyline\") {\n return shape.data;\n } else if (_isRectanguloidElement(element)) {\n const [sides, corners] = (0,_utils__WEBPACK_IMPORTED_MODULE_9__.deconstructRectanguloidElement)(element);\n const cornerSegments = corners.map(corner => getSegmentsOnCurve(corner, center, element.angle)).flat();\n const rotatedSides = getRotatedSides(sides, center, element.angle);\n return [...rotatedSides, ...cornerSegments];\n } else if (element.type === \"diamond\") {\n const [sides, corners] = (0,_utils__WEBPACK_IMPORTED_MODULE_9__.deconstructDiamondElement)(element);\n const cornerSegments = corners.map(corner => getSegmentsOnCurve(corner, center, element.angle)).flat();\n const rotatedSides = getRotatedSides(sides, center, element.angle);\n return [...rotatedSides, ...cornerSegments];\n } else if (shape.type === \"polygon\") {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isTextElement)(element)) {\n const container = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getContainerElement)(element, elementsMap);\n\n if (container && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(container)) {\n const segments = [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y1)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y2)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x2, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y2)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x1, y1))];\n return segments;\n }\n }\n\n const points = shape.data;\n const segments = [];\n\n for (let i = 0; i < points.length - 1; i++) {\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(points[i], points[i + 1]));\n }\n\n return segments;\n } else if (shape.type === \"ellipse\") {\n return getSegmentsOnEllipse(element);\n }\n\n const [nw, ne, sw, se,,, w, e] = [[x1, y1], [x2, y1], [x1, y2], [x2, y2], [cx, y1], [cx, y2], [x1, cy], [x2, cy]].map(point => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)(point, center, element.angle));\n return [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(nw, ne), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(sw, se), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(nw, sw), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(ne, se), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(nw, e), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(sw, e), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(ne, w), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(se, w)];\n};\n\nconst _isRectanguloidElement = element => {\n return element != null && (element.type === \"rectangle\" || element.type === \"image\" || element.type === \"iframe\" || element.type === \"embeddable\" || element.type === \"frame\" || element.type === \"magicframe\" || element.type === \"text\" && !element.containerId);\n};\n\nconst getRotatedSides = (sides, center, angle) => {\n return sides.map(side => {\n return (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)(side[0], center, angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)(side[1], center, angle));\n });\n};\n\nconst getSegmentsOnCurve = (curve, center, angle) => {\n const points = (0,points_on_curve__WEBPACK_IMPORTED_MODULE_4__.pointsOnBezierCurves)(curve, 10);\n let i = 0;\n const segments = [];\n\n while (i < points.length - 1) {\n segments.push((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[i][0], points[i][1]), center, angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(points[i + 1][0], points[i + 1][1]), center, angle)));\n i++;\n }\n\n return segments;\n};\n\nconst getSegmentsOnEllipse = ellipse => {\n const center = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(ellipse.x + ellipse.width / 2, ellipse.y + ellipse.height / 2);\n const a = ellipse.width / 2;\n const b = ellipse.height / 2;\n const segments = [];\n const points = [];\n const n = 90;\n const deltaT = Math.PI * 2 / n;\n\n for (let i = 0; i < n; i++) {\n const t = i * deltaT;\n const x = center[0] + a * Math.cos(t);\n const y = center[1] + b * Math.sin(t);\n points.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x, y), center, ellipse.angle));\n }\n\n for (let i = 0; i < points.length - 1; i++) {\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(points[i], points[i + 1]));\n }\n\n segments.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)(points[points.length - 1], points[0]));\n return segments;\n};\n/**\n * Scene -> Scene coords, but in x1,x2,y1,y2 format.\n *\n * Rectangle here means any rectangular frame, not an excalidraw element.\n */\n\n\nconst getRectangleBoxAbsoluteCoords = boxSceneCoords => {\n return [boxSceneCoords.x, boxSceneCoords.y, boxSceneCoords.x + boxSceneCoords.width, boxSceneCoords.y + boxSceneCoords.height, boxSceneCoords.x + boxSceneCoords.width / 2, boxSceneCoords.y + boxSceneCoords.height / 2];\n};\nconst getDiamondPoints = element => {\n // Here we add +1 to avoid these numbers to be 0\n // otherwise rough.js will throw an error complaining about it\n const topX = Math.floor(element.width / 2) + 1;\n const topY = 0;\n const rightX = element.width;\n const rightY = Math.floor(element.height / 2) + 1;\n const bottomX = topX;\n const bottomY = element.height;\n const leftX = 0;\n const leftY = rightY;\n return [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY];\n}; // reference: https://eliot-jones.com/2019/12/cubic-bezier-curve-bounding-boxes\n\nconst getBezierValueForT = (t, p0, p1, p2, p3) => {\n const oneMinusT = 1 - t;\n return Math.pow(oneMinusT, 3) * p0 + 3 * Math.pow(oneMinusT, 2) * t * p1 + 3 * oneMinusT * Math.pow(t, 2) * p2 + Math.pow(t, 3) * p3;\n};\n\nconst solveQuadratic = (p0, p1, p2, p3) => {\n const i = p1 - p0;\n const j = p2 - p1;\n const k = p3 - p2;\n const a = 3 * i - 6 * j + 3 * k;\n const b = 6 * j - 6 * i;\n const c = 3 * i;\n const sqrtPart = b * b - 4 * a * c;\n const hasSolution = sqrtPart >= 0;\n\n if (!hasSolution) {\n return false;\n }\n\n let s1 = null;\n let s2 = null;\n let t1 = Infinity;\n let t2 = Infinity;\n\n if (a === 0) {\n t1 = t2 = -c / b;\n } else {\n t1 = (-b + Math.sqrt(sqrtPart)) / (2 * a);\n t2 = (-b - Math.sqrt(sqrtPart)) / (2 * a);\n }\n\n if (t1 >= 0 && t1 <= 1) {\n s1 = getBezierValueForT(t1, p0, p1, p2, p3);\n }\n\n if (t2 >= 0 && t2 <= 1) {\n s2 = getBezierValueForT(t2, p0, p1, p2, p3);\n }\n\n return [s1, s2];\n};\n\nconst getCubicBezierCurveBound = (p0, p1, p2, p3) => {\n const solX = solveQuadratic(p0[0], p1[0], p2[0], p3[0]);\n const solY = solveQuadratic(p0[1], p1[1], p2[1], p3[1]);\n let minX = Math.min(p0[0], p3[0]);\n let maxX = Math.max(p0[0], p3[0]);\n\n if (solX) {\n const xs = solX.filter(x => x !== null);\n minX = Math.min(minX, ...xs);\n maxX = Math.max(maxX, ...xs);\n }\n\n let minY = Math.min(p0[1], p3[1]);\n let maxY = Math.max(p0[1], p3[1]);\n\n if (solY) {\n const ys = solY.filter(y => y !== null);\n minY = Math.min(minY, ...ys);\n maxY = Math.max(maxY, ...ys);\n }\n\n return [minX, minY, maxX, maxY];\n};\nconst getMinMaxXYFromCurvePathOps = (ops, transformXY) => {\n let currentP = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(0, 0);\n const {\n minX,\n minY,\n maxX,\n maxY\n } = ops.reduce((limits, {\n op,\n data\n }) => {\n // There are only four operation types:\n // move, bcurveTo, lineTo, and curveTo\n if (op === \"move\") {\n // change starting point\n const p = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFromArray)(data);\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.invariant)(p != null, \"Op data is not a point\");\n currentP = p; // move operation does not draw anything; so, it always\n // returns false\n } else if (op === \"bcurveTo\") {\n const _p1 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[0], data[1]);\n\n const _p2 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[2], data[3]);\n\n const _p3 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[4], data[5]);\n\n const p1 = transformXY ? transformXY(_p1) : _p1;\n const p2 = transformXY ? transformXY(_p2) : _p2;\n const p3 = transformXY ? transformXY(_p3) : _p3;\n const p0 = transformXY ? transformXY(currentP) : currentP;\n currentP = _p3;\n const [minX, minY, maxX, maxY] = getCubicBezierCurveBound(p0, p1, p2, p3);\n limits.minX = Math.min(limits.minX, minX);\n limits.minY = Math.min(limits.minY, minY);\n limits.maxX = Math.max(limits.maxX, maxX);\n limits.maxY = Math.max(limits.maxY, maxY);\n } else if (op === \"lineTo\") {// TODO: Implement this\n } else if (op === \"qcurveTo\") {// TODO: Implement this\n }\n\n return limits;\n }, {\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n });\n return [minX, minY, maxX, maxY];\n};\nconst getBoundsFromPoints = (points, padding = 0) => {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n for (const [x, y] of points) {\n minX = Math.min(minX, x);\n minY = Math.min(minY, y);\n maxX = Math.max(maxX, x);\n maxY = Math.max(maxY, y);\n }\n\n return [minX - padding, minY - padding, maxX + padding, maxY + padding];\n};\n\nconst getFreeDrawElementAbsoluteCoords = element => {\n const [minX, minY, maxX, maxY] = getBoundsFromPoints(element.points);\n const x1 = minX + element.x;\n const y1 = minY + element.y;\n const x2 = maxX + element.x;\n const y2 = maxY + element.y;\n return [x1, y1, x2, y2, (x1 + x2) / 2, (y1 + y2) / 2];\n};\n\nconst CARDINALITY_MARKER_SIZE = 20;\nconst CROWFOOT_ARROWHEAD_SIZE = 15;\n/** @returns number in pixels */\n\nconst getArrowheadSize = arrowhead => {\n switch (arrowhead) {\n case \"arrow\":\n return 25;\n\n case \"diamond\":\n case \"diamond_outline\":\n return 12;\n\n case \"cardinality_many\":\n case \"cardinality_one_or_many\":\n case \"cardinality_zero_or_many\":\n return CROWFOOT_ARROWHEAD_SIZE;\n\n case \"cardinality_one\":\n case \"cardinality_exactly_one\":\n case \"cardinality_zero_or_one\":\n return CARDINALITY_MARKER_SIZE;\n\n default:\n return 15;\n }\n};\n/** @returns number in degrees */\n\nconst getArrowheadAngle = arrowhead => {\n switch (arrowhead) {\n case \"bar\":\n return 90;\n\n case \"arrow\":\n return 20;\n\n default:\n return 25;\n }\n};\nconst getArrowheadPoints = (element, shape, position, arrowhead, offsetMultiplier = 0) => {\n if (arrowhead === null) {\n return null;\n }\n\n if (shape.length < 1) {\n return null;\n }\n\n const ops = (0,_excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__.getCurvePathOps)(shape[0]);\n\n if (ops.length < 1) {\n return null;\n } // The index of the bCurve operation to examine.\n\n\n const index = position === \"start\" ? 1 : ops.length - 1;\n const data = ops[index].data;\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.invariant)(data.length === 6, \"Op data length is not 6\");\n const p3 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[4], data[5]);\n const p2 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[2], data[3]);\n const p1 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(data[0], data[1]); // We need to find p0 of the bezier curve.\n // It is typically the last point of the previous\n // curve; it can also be the position of moveTo operation.\n\n const prevOp = ops[index - 1];\n let p0 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(0, 0);\n\n if (prevOp.op === \"move\") {\n const p = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFromArray)(prevOp.data);\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.invariant)(p != null, \"Op data is not a point\");\n p0 = p;\n } else if (prevOp.op === \"bcurveTo\") {\n p0 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(prevOp.data[4], prevOp.data[5]);\n } // B(t) = p0 * (1-t)^3 + 3p1 * t * (1-t)^2 + 3p2 * t^2 * (1-t) + p3 * t^3\n\n\n const equation = (t, idx) => Math.pow(1 - t, 3) * p3[idx] + 3 * t * Math.pow(1 - t, 2) * p2[idx] + 3 * Math.pow(t, 2) * (1 - t) * p1[idx] + p0[idx] * Math.pow(t, 3); // Ee know the last point of the arrow (or the first, if start arrowhead).\n\n\n const [x2, y2] = position === \"start\" ? p0 : p3; // By using cubic bezier equation (B(t)) and the given parameters,\n // we calculate a point that is closer to the last point.\n // The value 0.3 is chosen arbitrarily and it works best for all\n // the tested cases.\n\n const [x1, y1] = [equation(0.3, 0), equation(0.3, 1)]; // Find the normalized direction vector based on the\n // previously calculated points.\n\n const distance = Math.hypot(x2 - x1, y2 - y1);\n const nx = (x2 - x1) / distance;\n const ny = (y2 - y1) / distance;\n const size = getArrowheadSize(arrowhead);\n let length = 0;\n {\n // Length for -> arrows is based on the length of the last section\n const [cx, cy] = position === \"end\" ? element.points[element.points.length - 1] : element.points[0];\n const [px, py] = element.points.length > 1 ? position === \"end\" ? element.points[element.points.length - 2] : element.points[1] : [0, 0];\n length = Math.hypot(cx - px, cy - py);\n } // Scale down the arrowhead until we hit a certain size so that it doesn't look weird.\n // This value is selected by minimizing a minimum size with the last segment of the arrowhead\n\n const lengthMultiplier = arrowhead === \"diamond\" || arrowhead === \"diamond_outline\" ? 0.25 : 0.5;\n const minSize = Math.min(size, length * lengthMultiplier);\n const tx = x2 - nx * minSize * offsetMultiplier;\n const ty = y2 - ny * minSize * offsetMultiplier;\n const xs = tx - nx * minSize;\n const ys = ty - ny * minSize;\n\n if (arrowhead === \"circle\" || arrowhead === \"circle_outline\") {\n const diameter = Math.hypot(ys - ty, xs - tx) + element.strokeWidth - 2;\n return [tx, ty, diameter]; //zsviczian\n }\n\n const angle = getArrowheadAngle(arrowhead);\n\n if (arrowhead === \"cardinality_many\" || arrowhead === \"cardinality_one_or_many\") {\n // swap (xs, ys) with (x2, y2)\n const [x3, y3] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(xs, ys), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.degreesToRadians)(-angle));\n const [x4, y4] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(xs, ys), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.degreesToRadians)(angle));\n return [xs, ys, x3, y3, x4, y4];\n } // Return points\n\n\n const [x3, y3] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(xs, ys), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), -angle * Math.PI / 180);\n const [x4, y4] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(xs, ys), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.degreesToRadians)(angle));\n\n if (arrowhead === \"diamond\" || arrowhead === \"diamond_outline\") {\n // point opposite to the arrowhead point\n let ox;\n let oy;\n\n if (position === \"start\") {\n const [px, py] = element.points.length > 1 ? element.points[1] : [0, 0];\n [ox, oy] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx + minSize * 2, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), Math.atan2(py - ty, px - tx));\n } else {\n const [px, py] = element.points.length > 1 ? element.points[element.points.length - 2] : [0, 0];\n [ox, oy] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx - minSize * 2, ty), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(tx, ty), Math.atan2(ty - py, tx - px));\n }\n\n return [tx, ty, x3, y3, ox, oy, x4, y4];\n }\n\n return [tx, ty, x3, y3, x4, y4];\n}; // TODO reuse shape.ts\n\nconst generateLinearElementShape = element => {\n const generator = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generator();\n const options = (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element);\n\n const method = (() => {\n if (element.roundness) {\n return \"curve\";\n }\n\n if (options.fill) {\n return \"polygon\";\n }\n\n return \"linearPath\";\n })();\n\n return generator[method](element.points, options);\n};\n\nconst getLinearElementRotatedBounds = (element, cx, cy, elementsMap) => {\n var _a;\n\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n\n if (element.points.length < 2) {\n const [pointX, pointY] = element.points[0];\n const [x, y] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(element.x + pointX, element.y + pointY), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n let coords = [x, y, x, y];\n\n if (boundTextElement) {\n const coordsWithBoundText = _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getMinMaxXYWithBoundText(element, elementsMap, [x, y, x, y], boundTextElement);\n coords = [coordsWithBoundText[0], coordsWithBoundText[1], coordsWithBoundText[2], coordsWithBoundText[3]];\n }\n\n return coords;\n } // first element is always the curve\n\n\n const cachedShape = (_a = _shape__WEBPACK_IMPORTED_MODULE_5__.ShapeCache.get(element, null)) === null || _a === void 0 ? void 0 : _a[0];\n const shape = cachedShape !== null && cachedShape !== void 0 ? cachedShape : generateLinearElementShape(element);\n const ops = (0,_excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__.getCurvePathOps)(shape);\n\n const transformXY = ([x, y]) => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(element.x + x, element.y + y), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy), element.angle);\n\n const res = getMinMaxXYFromCurvePathOps(ops, transformXY);\n let coords = [res[0], res[1], res[2], res[3]];\n\n if (boundTextElement) {\n const coordsWithBoundText = _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getMinMaxXYWithBoundText(element, elementsMap, coords, boundTextElement);\n coords = [coordsWithBoundText[0], coordsWithBoundText[1], coordsWithBoundText[2], coordsWithBoundText[3]];\n }\n\n return coords;\n};\n\nconst getElementBounds = (element, elementsMap, nonRotated = false) => {\n return ElementBounds.getBounds(element, elementsMap, nonRotated);\n};\nconst getCommonBounds = (elements, elementsMap) => {\n if (!(0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.sizeOf)(elements)) {\n return [0, 0, 0, 0];\n }\n\n let minX = Infinity;\n let maxX = -Infinity;\n let minY = Infinity;\n let maxY = -Infinity;\n\n const _elementsMap = elementsMap || (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(elements);\n\n elements.forEach(element => {\n const [x1, y1, x2, y2] = getElementBounds(element, _elementsMap);\n minX = Math.min(minX, x1);\n minY = Math.min(minY, y1);\n maxX = Math.max(maxX, x2);\n maxY = Math.max(maxY, y2);\n });\n return [minX, minY, maxX, maxY];\n};\nconst getDraggedElementsBounds = (elements, dragOffset) => {\n const [minX, minY, maxX, maxY] = getCommonBounds(elements);\n return [minX + dragOffset.x, minY + dragOffset.y, maxX + dragOffset.x, maxY + dragOffset.y];\n};\nconst getResizedElementAbsoluteCoords = (element, nextWidth, nextHeight, normalizePoints) => {\n if (!((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element))) {\n return [element.x, element.y, element.x + nextWidth, element.y + nextHeight];\n }\n\n const points = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.rescalePoints)(0, nextWidth, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.rescalePoints)(1, nextHeight, element.points, normalizePoints), normalizePoints);\n let bounds;\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element)) {\n // Free Draw\n bounds = getBoundsFromPoints(points);\n } else {\n // Line\n const gen = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generator();\n const curve = !element.roundness ? gen.linearPath(points, (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element)) : gen.curve(points, (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element));\n const ops = (0,_excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__.getCurvePathOps)(curve);\n bounds = getMinMaxXYFromCurvePathOps(ops);\n }\n\n const [minX, minY, maxX, maxY] = bounds;\n return [minX + element.x, minY + element.y, maxX + element.x, maxY + element.y];\n};\nconst getElementPointsCoords = (element, points) => {\n // This might be computationally heavey\n const gen = roughjs_bin_rough__WEBPACK_IMPORTED_MODULE_0__[\"default\"].generator();\n const curve = element.roundness == null ? gen.linearPath(points, (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element)) : gen.curve(points, (0,_shape__WEBPACK_IMPORTED_MODULE_5__.generateRoughOptions)(element));\n const ops = (0,_excalidraw_utils_shape__WEBPACK_IMPORTED_MODULE_3__.getCurvePathOps)(curve);\n const [minX, minY, maxX, maxY] = getMinMaxXYFromCurvePathOps(ops);\n return [minX + element.x, minY + element.y, maxX + element.x, maxY + element.y];\n};\nconst getClosestElementBounds = (elements, from) => {\n if (!elements.length) {\n return [0, 0, 0, 0];\n }\n\n let minDistance = Infinity;\n let closestElement = elements[0];\n const elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(elements);\n elements.forEach(element => {\n const [x1, y1, x2, y2] = getElementBounds(element, elementsMap);\n const distance = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointDistance)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)((x1 + x2) / 2, (y1 + y2) / 2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(from.x, from.y));\n\n if (distance < minDistance) {\n minDistance = distance;\n closestElement = element;\n }\n });\n return getElementBounds(closestElement, elementsMap);\n};\nconst getCommonBoundingBox = elements => {\n const [minX, minY, maxX, maxY] = getCommonBounds(elements);\n return {\n minX,\n minY,\n maxX,\n maxY,\n width: maxX - minX,\n height: maxY - minY,\n midX: (minX + maxX) / 2,\n midY: (minY + maxY) / 2\n };\n};\n/**\n * returns scene coords of user's editor viewport (visible canvas area) bounds\n */\n\nconst getVisibleSceneBounds = ({\n scrollX,\n scrollY,\n width,\n height,\n zoom\n}) => {\n return [-scrollX, -scrollY, -scrollX + width / zoom.value, -scrollY + height / zoom.value];\n};\nconst getCenterForBounds = bounds => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bounds[0] + (bounds[2] - bounds[0]) / 2, bounds[1] + (bounds[3] - bounds[1]) / 2);\n/**\n * Get the axis-aligned bounding box for a given element\n */\n\nconst aabbForElement = (element, elementsMap, offset) => {\n const bbox = {\n minX: element.x,\n minY: element.y,\n maxX: element.x + element.width,\n maxY: element.y + element.height,\n midX: element.x + element.width / 2,\n midY: element.y + element.height / 2\n };\n const center = elementCenterPoint(element, elementsMap);\n const [topLeftX, topLeftY] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bbox.minX, bbox.minY), center, element.angle);\n const [topRightX, topRightY] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bbox.maxX, bbox.minY), center, element.angle);\n const [bottomRightX, bottomRightY] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bbox.maxX, bbox.maxY), center, element.angle);\n const [bottomLeftX, bottomLeftY] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(bbox.minX, bbox.maxY), center, element.angle);\n const bounds = [Math.min(topLeftX, topRightX, bottomRightX, bottomLeftX), Math.min(topLeftY, topRightY, bottomRightY, bottomLeftY), Math.max(topLeftX, topRightX, bottomRightX, bottomLeftX), Math.max(topLeftY, topRightY, bottomRightY, bottomLeftY)];\n\n if (offset) {\n const [topOffset, rightOffset, downOffset, leftOffset] = offset;\n return [bounds[0] - leftOffset, bounds[1] - topOffset, bounds[2] + rightOffset, bounds[3] + downOffset];\n }\n\n return bounds;\n};\nconst pointInsideBounds = (p, bounds) => p[0] > bounds[0] && p[0] < bounds[2] && p[1] > bounds[1] && p[1] < bounds[3]; // TODO make pointInsideBounds inclusive and remove this function once we\n// test nothing is breaking\n\nconst pointInsideBoundsInclusive = (p, bounds) => p[0] >= bounds[0] && p[0] <= bounds[2] && p[1] >= bounds[1] && p[1] <= bounds[3];\nconst doBoundsIntersect = (bounds1, bounds2) => {\n if (bounds1 == null || bounds2 == null) {\n return false;\n }\n\n const [minX1, minY1, maxX1, maxY1] = bounds1;\n const [minX2, minY2, maxX2, maxY2] = bounds2;\n return minX1 < maxX2 && maxX1 > minX2 && minY1 < maxY2 && maxY1 > minY2;\n};\nconst boundsContainBounds = (outerBounds, innerBounds) => [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(innerBounds[0], innerBounds[1]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(innerBounds[0], innerBounds[3]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(innerBounds[2], innerBounds[1]), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(innerBounds[2], innerBounds[3])].every(point => pointInsideBoundsInclusive(point, outerBounds));\n/**\n * High level helper to get elements overlapping a bounding box.\n * It can be used to get elements overlapping a selection box, for example.\n *\n */\n\nconst elementsOverlappingBBox = ({\n elements,\n elementsMap,\n bounds,\n type,\n excludeElementsInFrames,\n shouldIgnoreElementFromSelection\n}) => {\n if (!elementsMap) {\n elementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(elements);\n }\n\n const selectionBounds = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isExcalidrawElement)(bounds) ? getElementBounds(bounds, elementsMap) : bounds;\n const [selectionX1, selectionY1, selectionX2, selectionY2] = selectionBounds;\n const selectionEdges = [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(selectionX1, selectionY1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(selectionX2, selectionY1)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(selectionX2, selectionY1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(selectionX2, selectionY2)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(selectionX2, selectionY2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(selectionX1, selectionY2)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(selectionX1, selectionY2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(selectionX1, selectionY1))];\n const framesInSelection = excludeElementsInFrames ? new Set() : null;\n const groups = {};\n const elementsInSelection = new Set();\n\n for (const element of elements) {\n if (shouldIgnoreElementFromSelection === null || shouldIgnoreElementFromSelection === void 0 ? void 0 : shouldIgnoreElementFromSelection(element)) {\n continue;\n } // Track only selectable top-level group members, so ignored elements such\n // as bound text and locked elements don't affect group selection.\n\n\n const groupId = element.groupIds.at(-1);\n\n if (groupId) {\n if (!groups[groupId]) {\n groups[groupId] = [];\n }\n\n groups[groupId].push(element);\n }\n\n const strokeWidth = element.strokeWidth;\n let labelAABB = null;\n let elementAABB = getElementBounds(element, elementsMap);\n elementAABB = [elementAABB[0] - strokeWidth / 2, elementAABB[1] - strokeWidth / 2, elementAABB[2] + strokeWidth / 2, elementAABB[3] + strokeWidth / 2]; // Whether the element bounds should include the bound text element bounds\n\n const boundTextElement = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isArrowElement)(element) && (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement) {\n const {\n x,\n y\n } = _linearElementEditor__WEBPACK_IMPORTED_MODULE_6__.LinearElementEditor.getBoundTextElementPosition(element, boundTextElement, elementsMap);\n labelAABB = [x, y, x + boundTextElement.width, y + boundTextElement.height];\n } // Clip element bounds by its containing frame (if any), since only the\n // visible (frame-clipped) portion of the element is relevant for selection.\n\n\n const associatedFrame = (0,_frame__WEBPACK_IMPORTED_MODULE_11__.getContainingFrame)(element, elementsMap);\n\n if (associatedFrame && (0,_frame__WEBPACK_IMPORTED_MODULE_11__.elementOverlapsWithFrame)(element, associatedFrame, elementsMap)) {\n const frameAABB = getElementBounds(associatedFrame, elementsMap);\n elementAABB = [Math.max(elementAABB[0], frameAABB[0]), Math.max(elementAABB[1], frameAABB[1]), Math.min(elementAABB[2], frameAABB[2]), Math.min(elementAABB[3], frameAABB[3])];\n labelAABB = labelAABB ? [Math.max(labelAABB[0], frameAABB[0]), Math.max(labelAABB[1], frameAABB[1]), Math.min(labelAABB[2], frameAABB[2]), Math.min(labelAABB[3], frameAABB[3])] : null;\n }\n\n const commonAABB = labelAABB ? [Math.min(labelAABB[0], elementAABB[0]), Math.min(labelAABB[1], elementAABB[1]), Math.max(labelAABB[2], elementAABB[2]), Math.max(labelAABB[3], elementAABB[3])] : elementAABB; // ============== Evaluation ==============\n // 1. If the selection box WRAPs the element's AABB, then add it to the\n // selection and move on, regardless of the selection mode.\n //\n // PERF: This trick only works with axis-aligned box selection and the\n // current convex element shapes!\n\n if (boundsContainBounds(selectionBounds, commonAABB)) {\n if (framesInSelection && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFrameLikeElement)(element)) {\n framesInSelection.add(element.id);\n }\n\n elementsInSelection.add(element);\n continue;\n } // 2. Handle the case where the label is overlapped by the selection box\n\n\n if (type === \"overlap\" && labelAABB && doBoundsIntersect(selectionBounds, labelAABB)) {\n elementsInSelection.add(element);\n continue;\n } // 3. Handle the case where the selection is not wrapping the element, but\n // it does intersect the element's outline (non-AABB).\n\n\n if (type === \"overlap\" && doBoundsIntersect(selectionBounds, elementAABB)) {\n let hasIntersection = false; // Preliminary check potential intersection imprecision\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element)) {\n const center = elementCenterPoint(element, elementsMap);\n hasIntersection = element.points.some(point => {\n const rotatedPoint = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(element.x + point[0], element.y + point[1]), center, element.angle);\n return pointInsideBounds(rotatedPoint, selectionBounds);\n });\n } else {\n const nonRotatedElementBounds = getElementBounds(element, elementsMap, true);\n const center = elementCenterPoint(element, elementsMap);\n hasIntersection = [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)((nonRotatedElementBounds[0] + nonRotatedElementBounds[2]) / 2, nonRotatedElementBounds[1]), center, element.angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(nonRotatedElementBounds[2], (nonRotatedElementBounds[1] + nonRotatedElementBounds[3]) / 2), center, element.angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)((nonRotatedElementBounds[0] + nonRotatedElementBounds[2]) / 2, nonRotatedElementBounds[3]), center, element.angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(nonRotatedElementBounds[0], (nonRotatedElementBounds[1] + nonRotatedElementBounds[3]) / 2), center, element.angle)].some(point => {\n return pointInsideBounds((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)(point, center, element.angle), selectionBounds);\n });\n }\n\n if (!hasIntersection) {\n hasIntersection = selectionEdges.some(selectionEdge => (0,_collision__WEBPACK_IMPORTED_MODULE_10__.intersectElementWithLineSegment)(element, elementsMap, selectionEdge, strokeWidth / 2, true).length > 0);\n }\n\n if (hasIntersection) {\n if (framesInSelection && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFrameLikeElement)(element)) {\n framesInSelection.add(element.id);\n }\n\n elementsInSelection.add(element);\n continue;\n }\n } // 4. We don't need to handle when the selection is inside the element\n // as it is separately handled in App.\n\n }\n\n if (framesInSelection) {\n elementsInSelection.forEach(element => {\n if (element.frameId && framesInSelection.has(element.frameId)) {\n elementsInSelection.delete(element);\n }\n });\n }\n\n if (type === \"overlap\") {\n Array.from(elementsInSelection).forEach(element => {\n const groupId = element.groupIds.at(-1);\n const group = groupId ? groups[groupId] : null;\n group === null || group === void 0 ? void 0 : group.forEach(groupElement => elementsInSelection.add(groupElement));\n });\n } else if (type === \"contain\") {\n elementsInSelection.forEach(element => {\n // note: currently we only support top-level group handling since\n // we don't support box selecting while editing the group/subgroup\n // see https://github.com/excalidraw/excalidraw/pull/11234#issuecomment-4387654451\n const groupId = element.groupIds.at(-1);\n const group = groupId ? groups[groupId] : null;\n\n if (group && !group.every(groupElement => elementsInSelection.has(groupElement))) {\n elementsInSelection.delete(element);\n }\n });\n } // to maintain original order elements (namely for group selection)\n\n\n return elements.filter(element => elementsInSelection.has(element));\n};\nconst elementCenterPoint = (element, elementsMap, xOffset = 0, yOffset = 0) => {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFreeDrawElement)(element)) {\n const [x1, y1, x2, y2] = getElementAbsoluteCoords(element, elementsMap);\n const [x, y] = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)((x1 + x2) / 2, (y1 + y2) / 2);\n return (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x + xOffset, y + yOffset);\n }\n\n const [x, y] = getCenterForBounds(getElementBounds(element, elementsMap));\n return (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(x + xOffset, y + yOffset);\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/bounds.ts?\n}");
|
|
731
731
|
|
|
732
732
|
/***/ },
|
|
733
733
|
|
|
@@ -903,7 +903,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
903
903
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
904
904
|
|
|
905
905
|
"use strict";
|
|
906
|
-
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 */ getCommonFrameId: () => (/* binding */ getCommonFrameId),\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 */ getFrameChildrenInsertionIndex: () => (/* binding */ getFrameChildrenInsertionIndex),\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 _selection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selection */ \"../element/src/selection.ts\");\n/* harmony import */ var _groups__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./groups */ \"../element/src/groups.ts\");\n/* harmony import */ var _bounds__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _mutateElement__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./mutateElement */ \"../element/src/mutateElement.ts\");\n/* harmony import */ var _textElement__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _fractionalIndex__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fractionalIndex */ \"../element/src/fractionalIndex.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_6__.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_5__.getElementLineSegments)(frame, elementsMap);\n const elementLineSegments = (0,_bounds__WEBPACK_IMPORTED_MODULE_5__.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_3__.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,_bounds__WEBPACK_IMPORTED_MODULE_5__.boundsContainBounds)((0,_bounds__WEBPACK_IMPORTED_MODULE_5__.getElementBounds)(element, elementsMap), (0,_bounds__WEBPACK_IMPORTED_MODULE_5__.getElementBounds)(frame, elementsMap));\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_5__.getElementAbsoluteCoords)(frame, elementsMap);\n const [elementX1, elementY1, elementX2, elementY2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_5__.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_5__.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_4__.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_4__.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/**\n * Returns a map of frameId to frame elements. Includes empty frames.\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/**\n * Returns ExcalidrawFrameElements and non-frame-children elements.\n *\n * Considers children as root elements if they point to a frame parent\n * non-existing in the elements set.\n *\n * Considers non-frame bound elements (container or arrow labels) as root.\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_4__.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_4__.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_4__.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_4__.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};\nconst getCommonFrameId = elements => {\n let commonFrameId;\n\n for (const element of elements) {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isFrameLikeElement)(element) || !element.frameId) {\n return null;\n }\n\n if (commonFrameId === undefined) {\n commonFrameId = element.frameId;\n } else if (commonFrameId !== element.frameId) {\n return null;\n }\n }\n\n return commonFrameId !== null && commonFrameId !== void 0 ? commonFrameId : null;\n};\nconst getFrameChildrenInsertionIndex = (elements, frameId) => {\n for (let index = elements.length - 1; index >= 0; index--) {\n const element = elements[index];\n\n if (element.id === frameId) {\n return index;\n } else if (element.frameId === frameId) {\n return index + 1;\n }\n }\n\n return null;\n};\n/**\n * Adds elements and their bound elements to frame. Reorders added elements to\n * be just below frame, or just above its highest child (whichever is higher).\n *\n * @returns mutated allElements (same data structure)\n */\n\nconst addElementsToFrame = (allElements, elementsToAdd, frame) => {\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 commonFrameId = getCommonFrameId(elementsToAdd);\n const finalElementsToAdd = new Set();\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 // - keep elements already in the frame so mixed selections can be reordered\n // together\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 }\n\n if (element.frameId && element.frameId !== frame.id) {\n continue;\n }\n\n finalElementsToAdd.add(element);\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement && !finalElementsToAdd.has(boundTextElement)) {\n finalElementsToAdd.add(boundTextElement);\n }\n }\n\n for (const element of finalElementsToAdd) {\n // we don't always need to update the element if it's already in the frame,\n // but we still need to accumulate in finalElementsToAdd so we potentially\n // reorder them if added together\n if (element.frameId !== frame.id) {\n (0,_mutateElement__WEBPACK_IMPORTED_MODULE_6__.mutateElement)(element, elementsMap, {\n frameId: frame.id\n });\n }\n } // (re)order elements to be just below the frame,\n // or just above the highest child if that is higher\n // (latter case is denormalized order until we migrate)\n // ---------------------------------------------------------------------------\n\n\n if (!finalElementsToAdd.size || // if all elements to add already belong to the frame, then we don't want to\n // reorder (case: we're dragging element children within the frame)\n commonFrameId === frame.id) {\n return allElements;\n }\n\n const otherElements = Array.from(allElements.values()).filter(element => !finalElementsToAdd.has(element));\n const insertionIndex = getFrameChildrenInsertionIndex(otherElements, frame.id);\n\n if (insertionIndex === null) {\n return allElements;\n }\n\n const reorderedElements = [...otherElements.slice(0, insertionIndex), ...finalElementsToAdd, ...otherElements.slice(insertionIndex)];\n (0,_fractionalIndex__WEBPACK_IMPORTED_MODULE_8__.syncMovedIndices)(reorderedElements, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)([...finalElementsToAdd]));\n return Array.isArray(allElements) ? reorderedElements : new Map(reorderedElements.map(element => [element.id, element]));\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_7__.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_6__.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) => {\n return addElementsToFrame(removeAllElementsFromFrame(allElements, frame), nextElementsInFrame, frame).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_4__.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/**\n * filters out elements that are inside groups that contain a frame element\n * anywhere in the group tree\n */\n\nconst omitGroupsContainingFrameLikes = (allElements,\n/** subset of elements you want to filter. Optional perf optimization so we\n * don't have to filter all elements unnecessarily\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_4__.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/**\n * depending on the appState, return target frame, which is the frame the given element\n * is going to be added to or remove from\n */\n\nconst getTargetFrame = (element, elementsMap, appState) => {\n const _element = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_9__.isTextElement)(element) ? (0,_textElement__WEBPACK_IMPORTED_MODULE_7__.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_7__.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_4__.getElementsInGroup)(allElementsMap, gid)));\n\n if (appState.editingGroupId && appState.selectedElementsAreBeingDragged) {\n const selectedElements = new Set((0,_selection__WEBPACK_IMPORTED_MODULE_3__.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, elementsMap) => {\n return elements.filter(el => // exclude elements which are overlapping, but are in a different frame,\n // and thus invisible in target frame\n (!el.frameId || el.frameId === frame.id) && (0,_bounds__WEBPACK_IMPORTED_MODULE_5__.doBoundsIntersect)((0,_bounds__WEBPACK_IMPORTED_MODULE_5__.getElementBounds)(el, elementsMap), (0,_bounds__WEBPACK_IMPORTED_MODULE_5__.getElementBounds)(frame, elementsMap)));\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?\n}");
|
|
906
|
+
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 */ getCommonFrameId: () => (/* binding */ getCommonFrameId),\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 */ getFrameChildrenInsertionIndex: () => (/* binding */ getFrameChildrenInsertionIndex),\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 _selection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selection */ \"../element/src/selection.ts\");\n/* harmony import */ var _groups__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./groups */ \"../element/src/groups.ts\");\n/* harmony import */ var _bounds__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _mutateElement__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./mutateElement */ \"../element/src/mutateElement.ts\");\n/* harmony import */ var _textElement__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _fractionalIndex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fractionalIndex */ \"../element/src/fractionalIndex.ts\");\n/* harmony import */ var _typeChecks__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./typeChecks */ \"../element/src/typeChecks.ts\");\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_5__.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_4__.getElementLineSegments)(frame, elementsMap);\n const elementLineSegments = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementLineSegments)(element, elementsMap);\n const intersecting = frameLineSegments.some(frameLineSegment => elementLineSegments.some(elementLineSegment => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.segmentsIntersectAt)(frameLineSegment, elementLineSegment)));\n return intersecting;\n}\nconst getElementsCompletelyInFrame = (elements, frame, elementsMap) => omitGroupsContainingFrameLikes((0,_selection__WEBPACK_IMPORTED_MODULE_2__.getElementsWithinSelection)(elements, frame, elementsMap, false)).filter(element => !(0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFrameLikeElement)(element) && !element.frameId || element.frameId === frame.id);\nconst isElementContainingFrame = (element, frame, elementsMap) => {\n return (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.boundsContainBounds)((0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementBounds)(element, elementsMap), (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementBounds)(frame, elementsMap));\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_4__.getElementAbsoluteCoords)(frame, elementsMap);\n const [elementX1, elementY1, elementX2, elementY2] = (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.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_4__.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_3__.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_3__.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/**\n * Returns a map of frameId to frame elements. Includes empty frames.\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_8__.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_8__.isFrameLikeElement)(element));\n};\n/**\n * Returns ExcalidrawFrameElements and non-frame-children elements.\n *\n * Considers children as root elements if they point to a frame parent\n * non-existing in the elements set.\n *\n * Considers non-frame bound elements (container or arrow labels) as root.\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_8__.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_3__.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_3__.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_8__.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_3__.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_8__.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_8__.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_3__.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};\nconst getCommonFrameId = elements => {\n let commonFrameId;\n\n for (const element of elements) {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFrameLikeElement)(element) || !element.frameId) {\n return null;\n }\n\n if (commonFrameId === undefined) {\n commonFrameId = element.frameId;\n } else if (commonFrameId !== element.frameId) {\n return null;\n }\n }\n\n return commonFrameId !== null && commonFrameId !== void 0 ? commonFrameId : null;\n};\nconst getFrameChildrenInsertionIndex = (elements, frameId) => {\n for (let index = elements.length - 1; index >= 0; index--) {\n const element = elements[index];\n\n if (element.id === frameId) {\n return index;\n } else if (element.frameId === frameId) {\n return index + 1;\n }\n }\n\n return null;\n};\n/**\n * Adds elements and their bound elements to frame. Reorders added elements to\n * be just below frame, or just above its highest child (whichever is higher).\n *\n * @returns mutated allElements (same data structure)\n */\n\nconst addElementsToFrame = (allElements, elementsToAdd, frame) => {\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 commonFrameId = getCommonFrameId(elementsToAdd);\n const finalElementsToAdd = new Set();\n const otherFrames = new Set();\n\n for (const element of elementsToAdd) {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isFrameLikeElement)(element) && element.id !== frame.id) {\n otherFrames.add(element.id);\n }\n } // - add bound text elements if not already in the array\n // - keep elements already in the frame so mixed selections can be reordered\n // together\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_8__.isFrameLikeElement)(element) || element.frameId && otherFrames.has(element.frameId)) {\n continue;\n }\n\n if (element.frameId && element.frameId !== frame.id) {\n continue;\n }\n\n finalElementsToAdd.add(element);\n const boundTextElement = (0,_textElement__WEBPACK_IMPORTED_MODULE_6__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement && !finalElementsToAdd.has(boundTextElement)) {\n finalElementsToAdd.add(boundTextElement);\n }\n }\n\n for (const element of finalElementsToAdd) {\n // we don't always need to update the element if it's already in the frame,\n // but we still need to accumulate in finalElementsToAdd so we potentially\n // reorder them if added together\n if (element.frameId !== frame.id) {\n (0,_mutateElement__WEBPACK_IMPORTED_MODULE_5__.mutateElement)(element, elementsMap, {\n frameId: frame.id\n });\n }\n } // (re)order elements to be just below the frame,\n // or just above the highest child if that is higher\n // (latter case is denormalized order until we migrate)\n // ---------------------------------------------------------------------------\n\n\n if (!finalElementsToAdd.size || // if all elements to add already belong to the frame, then we don't want to\n // reorder (case: we're dragging element children within the frame)\n commonFrameId === frame.id) {\n return allElements;\n }\n\n const otherElements = Array.from(allElements.values()).filter(element => !finalElementsToAdd.has(element));\n const insertionIndex = getFrameChildrenInsertionIndex(otherElements, frame.id);\n\n if (insertionIndex === null) {\n return allElements;\n }\n\n const reorderedElements = [...otherElements.slice(0, insertionIndex), ...finalElementsToAdd, ...otherElements.slice(insertionIndex)];\n (0,_fractionalIndex__WEBPACK_IMPORTED_MODULE_7__.syncMovedIndices)(reorderedElements, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)([...finalElementsToAdd]));\n return Array.isArray(allElements) ? reorderedElements : new Map(reorderedElements.map(element => [element.id, element]));\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_6__.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_5__.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) => {\n return addElementsToFrame(removeAllElementsFromFrame(allElements, frame), nextElementsInFrame, frame).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_3__.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_8__.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/**\n * filters out elements that are inside groups that contain a frame element\n * anywhere in the group tree\n */\n\nconst omitGroupsContainingFrameLikes = (allElements,\n/** subset of elements you want to filter. Optional perf optimization so we\n * don't have to filter all elements unnecessarily\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_3__.getElementsInGroup)(allElements, groupId).some(el => (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.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/**\n * depending on the appState, return target frame, which is the frame the given element\n * is going to be added to or remove from\n */\n\nconst getTargetFrame = (element, elementsMap, appState) => {\n const _element = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_8__.isTextElement)(element) ? (0,_textElement__WEBPACK_IMPORTED_MODULE_6__.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_8__.isTextElement)(element) ? (0,_textElement__WEBPACK_IMPORTED_MODULE_6__.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_3__.getElementsInGroup)(allElementsMap, gid)));\n\n if (appState.editingGroupId && appState.selectedElementsAreBeingDragged) {\n const selectedElements = new Set((0,_selection__WEBPACK_IMPORTED_MODULE_2__.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_8__.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_8__.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, elementsMap) => {\n return elements.filter(el => // exclude elements which are overlapping, but are in a different frame,\n // and thus invisible in target frame\n (!el.frameId || el.frameId === frame.id) && (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.doBoundsIntersect)((0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementBounds)(el, elementsMap), (0,_bounds__WEBPACK_IMPORTED_MODULE_4__.getElementBounds)(frame, elementsMap)));\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?\n}");
|
|
907
907
|
|
|
908
908
|
/***/ },
|
|
909
909
|
|
|
@@ -958,7 +958,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
958
958
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
959
959
|
|
|
960
960
|
"use strict";
|
|
961
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AppStateDelta: () => (/* reexport safe */ _delta__WEBPACK_IMPORTED_MODULE_9__.AppStateDelta),\n/* harmony export */ BASE_ARROW_MIN_LENGTH: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BASE_ARROW_MIN_LENGTH),\n/* harmony export */ BASE_BINDING_GAP: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BASE_BINDING_GAP),\n/* harmony export */ BASE_BINDING_GAP_ELBOW: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BASE_BINDING_GAP_ELBOW),\n/* harmony export */ BASE_PADDING: () => (/* reexport safe */ _elbowArrow__WEBPACK_IMPORTED_MODULE_14__.BASE_PADDING),\n/* harmony export */ BindableElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BindableElement),\n/* harmony export */ BoundElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BoundElement),\n/* harmony export */ CaptureUpdateAction: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.CaptureUpdateAction),\n/* harmony export */ DEFAULT_LINK_SIZE: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.DEFAULT_LINK_SIZE),\n/* harmony export */ DEFAULT_OMIT_SIDES: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.DEFAULT_OMIT_SIDES),\n/* harmony export */ Delta: () => (/* reexport safe */ _delta__WEBPACK_IMPORTED_MODULE_9__.Delta),\n/* harmony export */ DurableIncrement: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.DurableIncrement),\n/* harmony export */ ElementBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.ElementBounds),\n/* harmony export */ ElementsDelta: () => (/* reexport safe */ _delta__WEBPACK_IMPORTED_MODULE_9__.ElementsDelta),\n/* harmony export */ EphemeralIncrement: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.EphemeralIncrement),\n/* harmony export */ FOCUS_POINT_SIZE: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.FOCUS_POINT_SIZE),\n/* harmony export */ FlowChartCreator: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.FlowChartCreator),\n/* harmony export */ FlowChartNavigator: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.FlowChartNavigator),\n/* harmony export */ HEADING_DOWN: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.HEADING_DOWN),\n/* harmony export */ HEADING_LEFT: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.HEADING_LEFT),\n/* harmony export */ HEADING_RIGHT: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.HEADING_RIGHT),\n/* harmony export */ HEADING_UP: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.HEADING_UP),\n/* harmony export */ INVISIBLY_SMALL_ELEMENT_SIZE: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.INVISIBLY_SMALL_ELEMENT_SIZE),\n/* harmony export */ InvalidFractionalIndexError: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.InvalidFractionalIndexError),\n/* harmony export */ LinearElementEditor: () => (/* reexport safe */ _linearElementEditor__WEBPACK_IMPORTED_MODULE_24__.LinearElementEditor),\n/* harmony export */ MINIMAL_CROP_SIZE: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.MINIMAL_CROP_SIZE),\n/* harmony export */ OMIT_SIDES_FOR_FRAME: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.OMIT_SIDES_FOR_FRAME),\n/* harmony export */ OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.OMIT_SIDES_FOR_MULTIPLE_ELEMENTS),\n/* harmony export */ Scene: () => (/* reexport safe */ _Scene__WEBPACK_IMPORTED_MODULE_31__.Scene),\n/* harmony export */ ShapeCache: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.ShapeCache),\n/* harmony export */ Store: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.Store),\n/* harmony export */ StoreChange: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.StoreChange),\n/* harmony export */ StoreDelta: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.StoreDelta),\n/* harmony export */ StoreIncrement: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.StoreIncrement),\n/* harmony export */ StoreSnapshot: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.StoreSnapshot),\n/* harmony export */ aabbForElement: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.aabbForElement),\n/* harmony export */ addElementsToFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.addElementsToFrame),\n/* harmony export */ addNewNodes: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.addNewNodes),\n/* harmony export */ addToGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.addToGroup),\n/* harmony export */ alignElements: () => (/* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_2__.alignElements),\n/* harmony export */ avoidRectangularCorner: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.avoidRectangularCorner),\n/* harmony export */ bindBindingElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindBindingElement),\n/* harmony export */ bindElementsToFramesAfterDuplication: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.bindElementsToFramesAfterDuplication),\n/* harmony export */ bindOrUnbindBindingElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindOrUnbindBindingElement),\n/* harmony export */ bindOrUnbindBindingElements: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindOrUnbindBindingElements),\n/* harmony export */ bindPointToSnapToElementOutline: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindPointToSnapToElementOutline),\n/* harmony export */ bindingProperties: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindingProperties),\n/* harmony export */ boundsContainBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.boundsContainBounds),\n/* harmony export */ bumpVersion: () => (/* reexport safe */ _mutateElement__WEBPACK_IMPORTED_MODULE_25__.bumpVersion),\n/* harmony export */ calculateFixedPointForElbowArrowBinding: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.calculateFixedPointForElbowArrowBinding),\n/* harmony export */ calculateFixedPointForNonElbowArrowBinding: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.calculateFixedPointForNonElbowArrowBinding),\n/* harmony export */ canApplyRoundnessTypeToElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.canApplyRoundnessTypeToElement),\n/* harmony export */ canBecomePolygon: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.canBecomePolygon),\n/* harmony export */ canChangeRoundness: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.canChangeRoundness),\n/* harmony export */ canCreateLinkFromElements: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.canCreateLinkFromElements),\n/* harmony export */ canHaveArrowheads: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.canHaveArrowheads),\n/* harmony export */ canResizeFromSides: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.canResizeFromSides),\n/* harmony export */ charWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.charWidth),\n/* harmony export */ compareHeading: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.compareHeading),\n/* harmony export */ computeBoundTextPosition: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.computeBoundTextPosition),\n/* harmony export */ computeContainerDimensionForBoundText: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.computeContainerDimensionForBoundText),\n/* harmony export */ containsCJK: () => (/* reexport safe */ _textWrapping__WEBPACK_IMPORTED_MODULE_39__.containsCJK),\n/* harmony export */ convertToExcalidrawElements: () => (/* reexport safe */ _transform__WEBPACK_IMPORTED_MODULE_40__.convertToExcalidrawElements),\n/* harmony export */ createPlaceholderEmbeddableLabel: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.createPlaceholderEmbeddableLabel),\n/* harmony export */ createSrcDoc: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.createSrcDoc),\n/* harmony export */ cropElement: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.cropElement),\n/* harmony export */ deconstructDiamondElement: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.deconstructDiamondElement),\n/* harmony export */ deconstructLinearOrFreeDrawElement: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.deconstructLinearOrFreeDrawElement),\n/* harmony export */ deconstructRectanguloidElement: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.deconstructRectanguloidElement),\n/* harmony export */ deepCopyElement: () => (/* reexport safe */ _duplicate__WEBPACK_IMPORTED_MODULE_13__.deepCopyElement),\n/* harmony export */ defaultGetElementLinkFromSelection: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.defaultGetElementLinkFromSelection),\n/* harmony export */ detectLineHeight: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.detectLineHeight),\n/* harmony export */ distanceToElement: () => (/* reexport safe */ _distance__WEBPACK_IMPORTED_MODULE_10__.distanceToElement),\n/* harmony export */ distributeElements: () => (/* reexport safe */ _distribute__WEBPACK_IMPORTED_MODULE_11__.distributeElements),\n/* harmony export */ doBoundsIntersect: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.doBoundsIntersect),\n/* harmony export */ dragNewElement: () => (/* reexport safe */ _dragElements__WEBPACK_IMPORTED_MODULE_12__.dragNewElement),\n/* harmony export */ dragSelectedElements: () => (/* reexport safe */ _dragElements__WEBPACK_IMPORTED_MODULE_12__.dragSelectedElements),\n/* harmony export */ duplicateElement: () => (/* reexport safe */ _duplicate__WEBPACK_IMPORTED_MODULE_13__.duplicateElement),\n/* harmony export */ duplicateElements: () => (/* reexport safe */ _duplicate__WEBPACK_IMPORTED_MODULE_13__.duplicateElements),\n/* harmony export */ editGroupForSelectedElement: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.editGroupForSelectedElement),\n/* harmony export */ elementCenterPoint: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.elementCenterPoint),\n/* harmony export */ elementOverlapsWithFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.elementOverlapsWithFrame),\n/* harmony export */ elementWithCanvasCache: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.elementWithCanvasCache),\n/* harmony export */ elementsAreInFrameBounds: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.elementsAreInFrameBounds),\n/* harmony export */ elementsAreInSameGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.elementsAreInSameGroup),\n/* harmony export */ embeddableURLValidator: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.embeddableURLValidator),\n/* harmony export */ excludeElementsInFramesFromSelection: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.excludeElementsInFramesFromSelection),\n/* harmony export */ filterElementsEligibleAsFrameChildren: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.filterElementsEligibleAsFrameChildren),\n/* harmony export */ fixBindingsAfterDeletion: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.fixBindingsAfterDeletion),\n/* harmony export */ fixDuplicatedBindingsAfterDuplication: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.fixDuplicatedBindingsAfterDuplication),\n/* harmony export */ flipHeading: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.flipHeading),\n/* harmony export */ frameAndChildrenSelectedTogether: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.frameAndChildrenSelectedTogether),\n/* harmony export */ generateLinearCollisionShape: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.generateLinearCollisionShape),\n/* harmony export */ generateRoughOptions: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.generateRoughOptions),\n/* harmony export */ getActiveTextElement: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getActiveTextElement),\n/* harmony export */ getAllHoveredElementAtPoint: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.getAllHoveredElementAtPoint),\n/* harmony export */ getApproxMinLineHeight: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getApproxMinLineHeight),\n/* harmony export */ getApproxMinLineWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getApproxMinLineWidth),\n/* harmony export */ getArrowLocalFixedPoints: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getArrowLocalFixedPoints),\n/* harmony export */ getArrowheadAngle: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getArrowheadAngle),\n/* harmony export */ getArrowheadForPicker: () => (/* reexport safe */ _arrowheads__WEBPACK_IMPORTED_MODULE_46__.getArrowheadForPicker),\n/* harmony export */ getArrowheadPoints: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getArrowheadPoints),\n/* harmony export */ getArrowheadSize: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getArrowheadSize),\n/* harmony export */ getBindingGap: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getBindingGap),\n/* harmony export */ getBindingSideMidPoint: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getBindingSideMidPoint),\n/* harmony export */ getBindingStrategyForDraggingBindingElementEndpoints: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getBindingStrategyForDraggingBindingElementEndpoints),\n/* harmony export */ getBoundTextElement: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextElement),\n/* harmony export */ getBoundTextElementId: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextElementId),\n/* harmony export */ getBoundTextElementPosition: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextElementPosition),\n/* harmony export */ getBoundTextMaxHeight: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextMaxHeight),\n/* harmony export */ getBoundTextMaxWidth: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextMaxWidth),\n/* harmony export */ getBoundsFromPoints: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getBoundsFromPoints),\n/* harmony export */ getCenterForBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getCenterForBounds),\n/* harmony export */ getClosestElementBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getClosestElementBounds),\n/* harmony export */ getCommonBoundingBox: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getCommonBoundingBox),\n/* harmony export */ getCommonBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getCommonBounds),\n/* harmony export */ getCommonFrameId: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getCommonFrameId),\n/* harmony export */ getContainerCenter: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getContainerCenter),\n/* harmony export */ getContainerCoords: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getContainerCoords),\n/* harmony export */ getContainerElement: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getContainerElement),\n/* harmony export */ getContainingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getContainingFrame),\n/* harmony export */ getCornerRadius: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.getCornerRadius),\n/* harmony export */ getCubicBezierCurveBound: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getCubicBezierCurveBound),\n/* harmony export */ getCursorForResizingElement: () => (/* reexport safe */ _resizeTest__WEBPACK_IMPORTED_MODULE_30__.getCursorForResizingElement),\n/* harmony export */ getDefaultFrameName: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getDefaultFrameName),\n/* harmony export */ getDefaultRoundnessTypeForElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.getDefaultRoundnessTypeForElement),\n/* harmony export */ getDiamondBaseCorners: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.getDiamondBaseCorners),\n/* harmony export */ getDiamondPoints: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getDiamondPoints),\n/* harmony export */ getDragOffsetXY: () => (/* reexport safe */ _dragElements__WEBPACK_IMPORTED_MODULE_12__.getDragOffsetXY),\n/* harmony export */ getDraggedElementsBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getDraggedElementsBounds),\n/* harmony export */ getElementAbsoluteCoords: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords),\n/* harmony export */ getElementBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getElementBounds),\n/* harmony export */ getElementLineSegments: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getElementLineSegments),\n/* harmony export */ getElementPointsCoords: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getElementPointsCoords),\n/* harmony export */ getElementShape: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.getElementShape),\n/* harmony export */ getElementWithTransformHandleType: () => (/* reexport safe */ _resizeTest__WEBPACK_IMPORTED_MODULE_30__.getElementWithTransformHandleType),\n/* harmony export */ getElementsCompletelyInFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsCompletelyInFrame),\n/* harmony export */ getElementsInGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getElementsInGroup),\n/* harmony export */ getElementsInNewFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsInNewFrame),\n/* harmony export */ getElementsInResizingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsInResizingFrame),\n/* harmony export */ getElementsIntersectingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsIntersectingFrame),\n/* harmony export */ getElementsOverlappingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsOverlappingFrame),\n/* harmony export */ getElementsWithinSelection: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getElementsWithinSelection),\n/* harmony export */ getEmbedLink: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.getEmbedLink),\n/* harmony export */ getFlipAdjustedCropPosition: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.getFlipAdjustedCropPosition),\n/* harmony export */ getFrameChildren: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getFrameChildren),\n/* harmony export */ getFrameChildrenInsertionIndex: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getFrameChildrenInsertionIndex),\n/* harmony export */ getFrameLikeElements: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getFrameLikeElements),\n/* harmony export */ getFrameLikeTitle: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getFrameLikeTitle),\n/* harmony export */ getFreedrawOutlineAsSegments: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.getFreedrawOutlineAsSegments),\n/* harmony export */ getFreedrawOutlinePoints: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.getFreedrawOutlinePoints),\n/* harmony export */ getGlobalFixedPointForBindableElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getGlobalFixedPointForBindableElement),\n/* harmony export */ getGlobalFixedPoints: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getGlobalFixedPoints),\n/* harmony export */ getHeadingForElbowArrowSnap: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getHeadingForElbowArrowSnap),\n/* harmony export */ getHoveredElementForBinding: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.getHoveredElementForBinding),\n/* harmony export */ getHoveredElementForFocusPoint: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.getHoveredElementForFocusPoint),\n/* harmony export */ getInitializedImageElements: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.getInitializedImageElements),\n/* harmony export */ getLineHeightInPx: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getLineHeightInPx),\n/* harmony export */ getLineWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getLineWidth),\n/* harmony export */ getLinearElementSubType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.getLinearElementSubType),\n/* harmony export */ getLinkDirectionFromKey: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.getLinkDirectionFromKey),\n/* harmony export */ getLinkIdAndTypeFromSelection: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.getLinkIdAndTypeFromSelection),\n/* harmony export */ getLockedLinearCursorAlignSize: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.getLockedLinearCursorAlignSize),\n/* harmony export */ getMaxCharWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getMaxCharWidth),\n/* harmony export */ getMaximumGroups: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getMaximumGroups),\n/* harmony export */ getMinCharWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getMinCharWidth),\n/* harmony export */ getMinMaxXYFromCurvePathOps: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getMinMaxXYFromCurvePathOps),\n/* harmony export */ getMinTextElementWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getMinTextElementWidth),\n/* harmony export */ getNewGroupIdsForDuplication: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getNewGroupIdsForDuplication),\n/* harmony export */ getNextSingleWidthAndHeightFromPointer: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.getNextSingleWidthAndHeightFromPointer),\n/* harmony export */ getNonDeletedElements: () => (/* binding */ getNonDeletedElements),\n/* harmony export */ getNonDeletedGroupIds: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getNonDeletedGroupIds),\n/* harmony export */ getNormalizedDimensions: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.getNormalizedDimensions),\n/* harmony export */ getObservedAppState: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.getObservedAppState),\n/* harmony export */ getOmitSidesForEditorInterface: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.getOmitSidesForEditorInterface),\n/* harmony export */ getOriginalContainerHeightFromCache: () => (/* reexport safe */ _containerCache__WEBPACK_IMPORTED_MODULE_7__.getOriginalContainerHeightFromCache),\n/* harmony export */ getPerfectElementSize: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.getPerfectElementSize),\n/* harmony export */ getPredecessors: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.getPredecessors),\n/* harmony export */ getRectangleBoxAbsoluteCoords: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getRectangleBoxAbsoluteCoords),\n/* harmony export */ getRenderOpacity: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.getRenderOpacity),\n/* harmony export */ getResizeArrowDirection: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.getResizeArrowDirection),\n/* harmony export */ getResizeOffsetXY: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.getResizeOffsetXY),\n/* harmony export */ getResizedElementAbsoluteCoords: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getResizedElementAbsoluteCoords),\n/* harmony export */ getRootElements: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getRootElements),\n/* harmony export */ getSceneVersion: () => (/* binding */ getSceneVersion),\n/* harmony export */ getSelectedElements: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getSelectedElements),\n/* harmony export */ getSelectedElementsByGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getSelectedElementsByGroup),\n/* harmony export */ getSelectedGroupForElement: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getSelectedGroupForElement),\n/* harmony export */ getSelectedGroupIdForElement: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getSelectedGroupIdForElement),\n/* harmony export */ getSelectedGroupIds: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getSelectedGroupIds),\n/* harmony export */ getSelectionStateForElements: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getSelectionStateForElements),\n/* harmony export */ getSnapOutlineMidPoint: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.getSnapOutlineMidPoint),\n/* harmony export */ getTargetElements: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getTargetElements),\n/* harmony export */ getTargetFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getTargetFrame),\n/* harmony export */ getTextElementAngle: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getTextElementAngle),\n/* harmony export */ getTextFromElements: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getTextFromElements),\n/* harmony export */ getTextHeight: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getTextHeight),\n/* harmony export */ getTextWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getTextWidth),\n/* harmony export */ getTransformHandleTypeFromCoords: () => (/* reexport safe */ _resizeTest__WEBPACK_IMPORTED_MODULE_30__.getTransformHandleTypeFromCoords),\n/* harmony export */ getTransformHandles: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.getTransformHandles),\n/* harmony export */ getTransformHandlesFromCoords: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.getTransformHandlesFromCoords),\n/* harmony export */ getUncroppedImageElement: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.getUncroppedImageElement),\n/* harmony export */ getUncroppedWidthAndHeight: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.getUncroppedWidthAndHeight),\n/* harmony export */ getVisibleAndNonSelectedElements: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getVisibleAndNonSelectedElements),\n/* harmony export */ getVisibleElements: () => (/* binding */ getVisibleElements),\n/* harmony export */ getVisibleSceneBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getVisibleSceneBounds),\n/* harmony export */ getWrappedTextLines: () => (/* reexport safe */ _textWrapping__WEBPACK_IMPORTED_MODULE_39__.getWrappedTextLines),\n/* harmony export */ groupByFrameLikes: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.groupByFrameLikes),\n/* harmony export */ groupsAreAtLeastIntersectingTheFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.groupsAreAtLeastIntersectingTheFrame),\n/* harmony export */ groupsAreCompletelyOutOfFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.groupsAreCompletelyOutOfFrame),\n/* harmony export */ handleBindTextResize: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.handleBindTextResize),\n/* harmony export */ handleFocusPointDrag: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.handleFocusPointDrag),\n/* harmony export */ handleFocusPointHover: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.handleFocusPointHover),\n/* harmony export */ handleFocusPointPointerDown: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.handleFocusPointPointerDown),\n/* harmony export */ handleFocusPointPointerUp: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.handleFocusPointPointerUp),\n/* harmony export */ hasBackground: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.hasBackground),\n/* harmony export */ hasBoundTextElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.hasBoundTextElement),\n/* harmony export */ hasBoundingBox: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.hasBoundingBox),\n/* harmony export */ hasStrokeColor: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.hasStrokeColor),\n/* harmony export */ hasStrokeStyle: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.hasStrokeStyle),\n/* harmony export */ hasStrokeWidth: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.hasStrokeWidth),\n/* harmony export */ hashElementsVersion: () => (/* binding */ hashElementsVersion),\n/* harmony export */ hashString: () => (/* binding */ hashString),\n/* harmony export */ headingForPoint: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingForPoint),\n/* harmony export */ headingForPointFromElement: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingForPointFromElement),\n/* harmony export */ headingForPointIsHorizontal: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingForPointIsHorizontal),\n/* harmony export */ headingIsHorizontal: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingIsHorizontal),\n/* harmony export */ headingIsVertical: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingIsVertical),\n/* harmony export */ hitElementBoundText: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.hitElementBoundText),\n/* harmony export */ hitElementBoundingBox: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.hitElementBoundingBox),\n/* harmony export */ hitElementBoundingBoxOnly: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.hitElementBoundingBoxOnly),\n/* harmony export */ hitElementItself: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.hitElementItself),\n/* harmony export */ intersectElementWithLineSegment: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.intersectElementWithLineSegment),\n/* harmony export */ isArrowBoundToElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isArrowBoundToElement),\n/* harmony export */ isArrowElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isArrowElement),\n/* harmony export */ isBindableElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isBindableElement),\n/* harmony export */ isBindableElementInsideOtherBindable: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.isBindableElementInsideOtherBindable),\n/* harmony export */ isBindingElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isBindingElement),\n/* harmony export */ isBindingElementType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isBindingElementType),\n/* harmony export */ isBindingEnabled: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.isBindingEnabled),\n/* harmony export */ isBoundToContainer: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isBoundToContainer),\n/* harmony export */ isCursorInFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.isCursorInFrame),\n/* harmony export */ isCurvedArrow: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isCurvedArrow),\n/* harmony export */ isElbowArrow: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isElbowArrow),\n/* harmony export */ isElementCompletelyInViewport: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.isElementCompletelyInViewport),\n/* harmony export */ isElementContainingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.isElementContainingFrame),\n/* harmony export */ isElementInFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.isElementInFrame),\n/* harmony export */ isElementInGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.isElementInGroup),\n/* harmony export */ isElementInViewport: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.isElementInViewport),\n/* harmony export */ isElementIntersectingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.isElementIntersectingFrame),\n/* harmony export */ isElementLink: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.isElementLink),\n/* harmony export */ isEligibleFrameChildType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isEligibleFrameChildType),\n/* harmony export */ isEmbeddableElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isEmbeddableElement),\n/* harmony export */ isExcalidrawElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isExcalidrawElement),\n/* harmony export */ isFixedPoint: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.isFixedPoint),\n/* harmony export */ isFlowchartNodeElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFlowchartNodeElement),\n/* harmony export */ isFocusPointVisible: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.isFocusPointVisible),\n/* harmony export */ isFrameElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFrameElement),\n/* harmony export */ isFrameLikeElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFrameLikeElement),\n/* harmony export */ isFreeDrawElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFreeDrawElement),\n/* harmony export */ isFreeDrawElementType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFreeDrawElementType),\n/* harmony export */ isHTMLSVGElement: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.isHTMLSVGElement),\n/* harmony export */ isIframeElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isIframeElement),\n/* harmony export */ isIframeLikeElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isIframeLikeElement),\n/* harmony export */ isImageElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isImageElement),\n/* harmony export */ isInGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.isInGroup),\n/* harmony export */ isInitializedImageElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isInitializedImageElement),\n/* harmony export */ isInvisiblySmallElement: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.isInvisiblySmallElement),\n/* harmony export */ isLineElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isLineElement),\n/* harmony export */ isLinearElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isLinearElement),\n/* harmony export */ isLinearElementType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isLinearElementType),\n/* harmony export */ isMagicFrameElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isMagicFrameElement),\n/* harmony export */ isMeasureTextSupported: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.isMeasureTextSupported),\n/* harmony export */ isNodeInFlowchart: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.isNodeInFlowchart),\n/* harmony export */ isNonDeletedElement: () => (/* binding */ isNonDeletedElement),\n/* harmony export */ isPathALoop: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.isPathALoop),\n/* harmony export */ isPointInElement: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.isPointInElement),\n/* harmony export */ isRectangularElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isRectangularElement),\n/* harmony export */ isRectanguloidElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isRectanguloidElement),\n/* harmony export */ isSelectedViaGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.isSelectedViaGroup),\n/* harmony export */ isSharpArrow: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isSharpArrow),\n/* harmony export */ isSimpleArrow: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isSimpleArrow),\n/* harmony export */ isSomeElementSelected: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.isSomeElementSelected),\n/* harmony export */ isTextBindableContainer: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isTextBindableContainer),\n/* harmony export */ isTextElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isTextElement),\n/* harmony export */ isUsingAdaptiveRadius: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isUsingAdaptiveRadius),\n/* harmony export */ isUsingProportionalRadius: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isUsingProportionalRadius),\n/* harmony export */ isValidPolygon: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isValidPolygon),\n/* harmony export */ isValidTextContainer: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.isValidTextContainer),\n/* harmony export */ loadHTMLImageElement: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.loadHTMLImageElement),\n/* harmony export */ makeNextSelectedElementIds: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.makeNextSelectedElementIds),\n/* harmony export */ maxBindingDistance_simple: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.maxBindingDistance_simple),\n/* harmony export */ maybeHandleArrowPointlikeDrag: () => (/* reexport safe */ _arrows_helpers__WEBPACK_IMPORTED_MODULE_45__.maybeHandleArrowPointlikeDrag),\n/* harmony export */ maybeParseEmbedSrc: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.maybeParseEmbedSrc),\n/* harmony export */ measureFontSizeFromWidth: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.measureFontSizeFromWidth),\n/* harmony export */ measureText: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.measureText),\n/* harmony export */ moveAllLeft: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveAllLeft),\n/* harmony export */ moveAllRight: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveAllRight),\n/* harmony export */ moveArrowAboveBindable: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveArrowAboveBindable),\n/* harmony export */ moveOneLeft: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveOneLeft),\n/* harmony export */ moveOneRight: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveOneRight),\n/* harmony export */ mutateElement: () => (/* reexport safe */ _mutateElement__WEBPACK_IMPORTED_MODULE_25__.mutateElement),\n/* harmony export */ newArrowElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newArrowElement),\n/* harmony export */ newElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newElement),\n/* harmony export */ newElementWith: () => (/* reexport safe */ _mutateElement__WEBPACK_IMPORTED_MODULE_25__.newElementWith),\n/* harmony export */ newEmbeddableElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newEmbeddableElement),\n/* harmony export */ newFrameElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newFrameElement),\n/* harmony export */ newFreeDrawElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newFreeDrawElement),\n/* harmony export */ newIframeElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newIframeElement),\n/* harmony export */ newImageElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newImageElement),\n/* harmony export */ newLinearElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newLinearElement),\n/* harmony export */ newMagicFrameElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newMagicFrameElement),\n/* harmony export */ newTextElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newTextElement),\n/* harmony export */ normalizeArrowhead: () => (/* reexport safe */ _arrowheads__WEBPACK_IMPORTED_MODULE_46__.normalizeArrowhead),\n/* harmony export */ normalizeElementOrder: () => (/* reexport safe */ _sortElements__WEBPACK_IMPORTED_MODULE_35__.normalizeElementOrder),\n/* harmony export */ normalizeFixedPoint: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.normalizeFixedPoint),\n/* harmony export */ normalizeSVG: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.normalizeSVG),\n/* harmony export */ normalizeText: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.normalizeText),\n/* harmony export */ omitGroupsContainingFrameLikes: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.omitGroupsContainingFrameLikes),\n/* harmony export */ omitPartialGroups: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.omitPartialGroups),\n/* harmony export */ orderByFractionalIndex: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.orderByFractionalIndex),\n/* harmony export */ originalContainerCache: () => (/* reexport safe */ _containerCache__WEBPACK_IMPORTED_MODULE_7__.originalContainerCache),\n/* harmony export */ parseElementLinkFromURL: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.parseElementLinkFromURL),\n/* harmony export */ parseTokens: () => (/* reexport safe */ _textWrapping__WEBPACK_IMPORTED_MODULE_39__.parseTokens),\n/* harmony export */ pointInsideBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.pointInsideBounds),\n/* harmony export */ pointInsideBoundsInclusive: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.pointInsideBoundsInclusive),\n/* harmony export */ positionElementsOnGrid: () => (/* reexport safe */ _positionElementsOnGrid__WEBPACK_IMPORTED_MODULE_27__.positionElementsOnGrid),\n/* harmony export */ projectFixedPointOntoDiagonal: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.projectFixedPointOntoDiagonal),\n/* harmony export */ redrawTextBoundingBox: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.redrawTextBoundingBox),\n/* harmony export */ refreshTextDimensions: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.refreshTextDimensions),\n/* harmony export */ removeAllElementsFromFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.removeAllElementsFromFrame),\n/* harmony export */ removeElementsFromFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.removeElementsFromFrame),\n/* harmony export */ removeFromSelectedGroups: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.removeFromSelectedGroups),\n/* harmony export */ renderElement: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.renderElement),\n/* harmony export */ renderSelectionElement: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.renderSelectionElement),\n/* harmony export */ replaceAllElementsInFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.replaceAllElementsInFrame),\n/* harmony export */ rescalePointsInElement: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.rescalePointsInElement),\n/* harmony export */ resetOriginalContainerCache: () => (/* reexport safe */ _containerCache__WEBPACK_IMPORTED_MODULE_7__.resetOriginalContainerCache),\n/* harmony export */ resizeMultipleElements: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.resizeMultipleElements),\n/* harmony export */ resizeSingleElement: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.resizeSingleElement),\n/* harmony export */ resizeSingleTextElement: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.resizeSingleTextElement),\n/* harmony export */ resizeTest: () => (/* reexport safe */ _resizeTest__WEBPACK_IMPORTED_MODULE_30__.resizeTest),\n/* harmony export */ selectGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.selectGroup),\n/* harmony export */ selectGroupsForSelectedElements: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.selectGroupsForSelectedElements),\n/* harmony export */ selectGroupsFromGivenElements: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.selectGroupsFromGivenElements),\n/* harmony export */ setCustomTextMetricsProvider: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.setCustomTextMetricsProvider),\n/* harmony export */ shouldAllowVerticalAlign: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.shouldAllowVerticalAlign),\n/* harmony export */ shouldApplyFrameClip: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.shouldApplyFrameClip),\n/* harmony export */ shouldTestInside: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.shouldTestInside),\n/* harmony export */ showSelectedShapeActions: () => (/* reexport safe */ _showSelectedShapeActions__WEBPACK_IMPORTED_MODULE_34__.showSelectedShapeActions),\n/* harmony export */ snapToMid: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.snapToMid),\n/* harmony export */ suppportsHorizontalAlign: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.suppportsHorizontalAlign),\n/* harmony export */ syncInvalidIndices: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.syncInvalidIndices),\n/* harmony export */ syncInvalidIndicesImmutable: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.syncInvalidIndicesImmutable),\n/* harmony export */ syncMovedIndices: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.syncMovedIndices),\n/* harmony export */ toggleLinePolygonState: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.toggleLinePolygonState),\n/* harmony export */ toolIsArrow: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.toolIsArrow),\n/* harmony export */ transformElements: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.transformElements),\n/* harmony export */ unbindBindingElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.unbindBindingElement),\n/* harmony export */ updateBindings: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.updateBindings),\n/* harmony export */ updateBoundElements: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.updateBoundElements),\n/* harmony export */ updateBoundPoint: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.updateBoundPoint),\n/* harmony export */ updateElbowArrowPoints: () => (/* reexport safe */ _elbowArrow__WEBPACK_IMPORTED_MODULE_14__.updateElbowArrowPoints),\n/* harmony export */ updateFrameMembershipOfSelectedElements: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.updateFrameMembershipOfSelectedElements),\n/* harmony export */ updateImageCache: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.updateImageCache),\n/* harmony export */ updateOriginalContainerCache: () => (/* reexport safe */ _containerCache__WEBPACK_IMPORTED_MODULE_7__.updateOriginalContainerCache),\n/* harmony export */ validateElbowPoints: () => (/* reexport safe */ _elbowArrow__WEBPACK_IMPORTED_MODULE_14__.validateElbowPoints),\n/* harmony export */ validateFractionalIndices: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.validateFractionalIndices),\n/* harmony export */ vectorToHeading: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.vectorToHeading),\n/* harmony export */ wrapText: () => (/* reexport safe */ _textWrapping__WEBPACK_IMPORTED_MODULE_39__.wrapText)\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 _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sizeHelpers */ \"../element/src/sizeHelpers.ts\");\n/* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./align */ \"../element/src/align.ts\");\n/* harmony import */ var _binding__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./binding */ \"../element/src/binding.ts\");\n/* harmony import */ var _bounds__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _collision__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./collision */ \"../element/src/collision.ts\");\n/* harmony import */ var _comparisons__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./comparisons */ \"../element/src/comparisons.ts\");\n/* harmony import */ var _containerCache__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./containerCache */ \"../element/src/containerCache.ts\");\n/* harmony import */ var _cropElement__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./cropElement */ \"../element/src/cropElement.ts\");\n/* harmony import */ var _delta__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./delta */ \"../element/src/delta.ts\");\n/* harmony import */ var _distance__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./distance */ \"../element/src/distance.ts\");\n/* harmony import */ var _distribute__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./distribute */ \"../element/src/distribute.ts\");\n/* harmony import */ var _dragElements__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./dragElements */ \"../element/src/dragElements.ts\");\n/* harmony import */ var _duplicate__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./duplicate */ \"../element/src/duplicate.ts\");\n/* harmony import */ var _elbowArrow__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./elbowArrow */ \"../element/src/elbowArrow.ts\");\n/* harmony import */ var _elementLink__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./elementLink */ \"../element/src/elementLink.ts\");\n/* harmony import */ var _embeddable__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./embeddable */ \"../element/src/embeddable.ts\");\n/* harmony import */ var _flowchart__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./flowchart */ \"../element/src/flowchart.ts\");\n/* harmony import */ var _arrows_focus__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./arrows/focus */ \"../element/src/arrows/focus.ts\");\n/* harmony import */ var _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./fractionalIndex */ \"../element/src/fractionalIndex.ts\");\n/* harmony import */ var _frame__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./frame */ \"../element/src/frame.ts\");\n/* harmony import */ var _groups__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./groups */ \"../element/src/groups.ts\");\n/* harmony import */ var _heading__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./heading */ \"../element/src/heading.ts\");\n/* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./image */ \"../element/src/image.ts\");\n/* harmony import */ var _linearElementEditor__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./linearElementEditor */ \"../element/src/linearElementEditor.ts\");\n/* harmony import */ var _mutateElement__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./mutateElement */ \"../element/src/mutateElement.ts\");\n/* harmony import */ var _newElement__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./newElement */ \"../element/src/newElement.ts\");\n/* harmony import */ var _positionElementsOnGrid__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./positionElementsOnGrid */ \"../element/src/positionElementsOnGrid.ts\");\n/* harmony import */ var _renderElement__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./renderElement */ \"../element/src/renderElement.ts\");\n/* harmony import */ var _resizeElements__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./resizeElements */ \"../element/src/resizeElements.ts\");\n/* harmony import */ var _resizeTest__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./resizeTest */ \"../element/src/resizeTest.ts\");\n/* harmony import */ var _Scene__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Scene */ \"../element/src/Scene.ts\");\n/* harmony import */ var _selection__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./selection */ \"../element/src/selection.ts\");\n/* harmony import */ var _shape__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./shape */ \"../element/src/shape.ts\");\n/* harmony import */ var _showSelectedShapeActions__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./showSelectedShapeActions */ \"../element/src/showSelectedShapeActions.ts\");\n/* harmony import */ var _sortElements__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./sortElements */ \"../element/src/sortElements.ts\");\n/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./store */ \"../element/src/store.ts\");\n/* harmony import */ var _textElement__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _textMeasurements__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./textMeasurements */ \"../element/src/textMeasurements.ts\");\n/* harmony import */ var _textWrapping__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./textWrapping */ \"../element/src/textWrapping.ts\");\n/* harmony import */ var _transform__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./transform */ \"../element/src/transform.ts\");\n/* harmony import */ var _transformHandles__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./transformHandles */ \"../element/src/transformHandles.ts\");\n/* harmony import */ var _typeChecks__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./typeChecks */ \"../element/src/typeChecks.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./utils */ \"../element/src/utils.ts\");\n/* harmony import */ var _zindex__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./zindex */ \"../element/src/zindex.ts\");\n/* harmony import */ var _arrows_helpers__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./arrows/helpers */ \"../element/src/arrows/helpers.ts\");\n/* harmony import */ var _arrowheads__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./arrowheads */ \"../element/src/arrowheads.ts\");\n\n\n/**\n * @deprecated unsafe, use hashElementsVersion instead\n */\n\nconst getSceneVersion = elements => elements.reduce((acc, el) => acc + el.version, 0);\n/**\n * Hashes elements' versionNonce (using djb2 algo). Order of elements matters.\n */\n\nconst hashElementsVersion = elements => {\n let hash = 5381;\n\n for (const element of (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.toIterable)(elements)) {\n hash = (hash << 5) + hash + element.versionNonce;\n }\n\n return hash >>> 0; // Ensure unsigned 32-bit integer\n}; // string hash function (using djb2). Not cryptographically secure, use only\n// for versioning and such.\n// note: hashes individual code units (not code points),\n// but for hashing purposes this is fine as it iterates through every code unit\n// (as such, no need to encode to byte string first)\n\nconst hashString = s => {\n let hash = 5381;\n\n for (let i = 0; i < s.length; i++) {\n const char = s.charCodeAt(i);\n hash = (hash << 5) + hash + char;\n }\n\n return hash >>> 0; // Ensure unsigned 32-bit integer\n};\nconst getVisibleElements = elements => elements.filter(el => !el.isDeleted && !(0,_sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.isInvisiblySmallElement)(el));\nconst getNonDeletedElements = elements => elements.filter(element => !element.isDeleted);\nconst isNonDeletedElement = element => !element.isDeleted;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/index.ts?\n}");
|
|
961
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AppStateDelta: () => (/* reexport safe */ _delta__WEBPACK_IMPORTED_MODULE_9__.AppStateDelta),\n/* harmony export */ BASE_ARROW_MIN_LENGTH: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BASE_ARROW_MIN_LENGTH),\n/* harmony export */ BASE_BINDING_GAP: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BASE_BINDING_GAP),\n/* harmony export */ BASE_BINDING_GAP_ELBOW: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BASE_BINDING_GAP_ELBOW),\n/* harmony export */ BASE_PADDING: () => (/* reexport safe */ _elbowArrow__WEBPACK_IMPORTED_MODULE_14__.BASE_PADDING),\n/* harmony export */ BindableElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BindableElement),\n/* harmony export */ BoundElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.BoundElement),\n/* harmony export */ CaptureUpdateAction: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.CaptureUpdateAction),\n/* harmony export */ DEFAULT_LINK_SIZE: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.DEFAULT_LINK_SIZE),\n/* harmony export */ DEFAULT_OMIT_SIDES: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.DEFAULT_OMIT_SIDES),\n/* harmony export */ Delta: () => (/* reexport safe */ _delta__WEBPACK_IMPORTED_MODULE_9__.Delta),\n/* harmony export */ DurableIncrement: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.DurableIncrement),\n/* harmony export */ ElementBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.ElementBounds),\n/* harmony export */ ElementsDelta: () => (/* reexport safe */ _delta__WEBPACK_IMPORTED_MODULE_9__.ElementsDelta),\n/* harmony export */ EphemeralIncrement: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.EphemeralIncrement),\n/* harmony export */ FOCUS_POINT_SIZE: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.FOCUS_POINT_SIZE),\n/* harmony export */ FlowChartCreator: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.FlowChartCreator),\n/* harmony export */ FlowChartNavigator: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.FlowChartNavigator),\n/* harmony export */ HEADING_DOWN: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.HEADING_DOWN),\n/* harmony export */ HEADING_LEFT: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.HEADING_LEFT),\n/* harmony export */ HEADING_RIGHT: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.HEADING_RIGHT),\n/* harmony export */ HEADING_UP: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.HEADING_UP),\n/* harmony export */ INVISIBLY_SMALL_ELEMENT_SIZE: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.INVISIBLY_SMALL_ELEMENT_SIZE),\n/* harmony export */ InvalidFractionalIndexError: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.InvalidFractionalIndexError),\n/* harmony export */ LinearElementEditor: () => (/* reexport safe */ _linearElementEditor__WEBPACK_IMPORTED_MODULE_24__.LinearElementEditor),\n/* harmony export */ MINIMAL_CROP_SIZE: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.MINIMAL_CROP_SIZE),\n/* harmony export */ OMIT_SIDES_FOR_FRAME: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.OMIT_SIDES_FOR_FRAME),\n/* harmony export */ OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.OMIT_SIDES_FOR_MULTIPLE_ELEMENTS),\n/* harmony export */ Scene: () => (/* reexport safe */ _Scene__WEBPACK_IMPORTED_MODULE_31__.Scene),\n/* harmony export */ ShapeCache: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.ShapeCache),\n/* harmony export */ Store: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.Store),\n/* harmony export */ StoreChange: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.StoreChange),\n/* harmony export */ StoreDelta: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.StoreDelta),\n/* harmony export */ StoreIncrement: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.StoreIncrement),\n/* harmony export */ StoreSnapshot: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.StoreSnapshot),\n/* harmony export */ aabbForElement: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.aabbForElement),\n/* harmony export */ addElementsToFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.addElementsToFrame),\n/* harmony export */ addNewNodes: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.addNewNodes),\n/* harmony export */ addToGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.addToGroup),\n/* harmony export */ alignElements: () => (/* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_2__.alignElements),\n/* harmony export */ avoidRectangularCorner: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.avoidRectangularCorner),\n/* harmony export */ bindBindingElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindBindingElement),\n/* harmony export */ bindElementsToFramesAfterDuplication: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.bindElementsToFramesAfterDuplication),\n/* harmony export */ bindOrUnbindBindingElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindOrUnbindBindingElement),\n/* harmony export */ bindOrUnbindBindingElements: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindOrUnbindBindingElements),\n/* harmony export */ bindPointToSnapToElementOutline: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindPointToSnapToElementOutline),\n/* harmony export */ bindingProperties: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.bindingProperties),\n/* harmony export */ boundsContainBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.boundsContainBounds),\n/* harmony export */ bumpVersion: () => (/* reexport safe */ _mutateElement__WEBPACK_IMPORTED_MODULE_25__.bumpVersion),\n/* harmony export */ calculateFixedPointForElbowArrowBinding: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.calculateFixedPointForElbowArrowBinding),\n/* harmony export */ calculateFixedPointForNonElbowArrowBinding: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.calculateFixedPointForNonElbowArrowBinding),\n/* harmony export */ canApplyRoundnessTypeToElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.canApplyRoundnessTypeToElement),\n/* harmony export */ canBecomePolygon: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.canBecomePolygon),\n/* harmony export */ canChangeRoundness: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.canChangeRoundness),\n/* harmony export */ canCreateLinkFromElements: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.canCreateLinkFromElements),\n/* harmony export */ canHaveArrowheads: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.canHaveArrowheads),\n/* harmony export */ canResizeFromSides: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.canResizeFromSides),\n/* harmony export */ charWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.charWidth),\n/* harmony export */ compareHeading: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.compareHeading),\n/* harmony export */ computeBoundTextPosition: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.computeBoundTextPosition),\n/* harmony export */ computeContainerDimensionForBoundText: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.computeContainerDimensionForBoundText),\n/* harmony export */ containsCJK: () => (/* reexport safe */ _textWrapping__WEBPACK_IMPORTED_MODULE_39__.containsCJK),\n/* harmony export */ convertToExcalidrawElements: () => (/* reexport safe */ _transform__WEBPACK_IMPORTED_MODULE_40__.convertToExcalidrawElements),\n/* harmony export */ createPlaceholderEmbeddableLabel: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.createPlaceholderEmbeddableLabel),\n/* harmony export */ createSrcDoc: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.createSrcDoc),\n/* harmony export */ cropElement: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.cropElement),\n/* harmony export */ deconstructDiamondElement: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.deconstructDiamondElement),\n/* harmony export */ deconstructLinearOrFreeDrawElement: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.deconstructLinearOrFreeDrawElement),\n/* harmony export */ deconstructRectanguloidElement: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.deconstructRectanguloidElement),\n/* harmony export */ deepCopyElement: () => (/* reexport safe */ _duplicate__WEBPACK_IMPORTED_MODULE_13__.deepCopyElement),\n/* harmony export */ defaultGetElementLinkFromSelection: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.defaultGetElementLinkFromSelection),\n/* harmony export */ detectLineHeight: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.detectLineHeight),\n/* harmony export */ distanceToElement: () => (/* reexport safe */ _distance__WEBPACK_IMPORTED_MODULE_10__.distanceToElement),\n/* harmony export */ distributeElements: () => (/* reexport safe */ _distribute__WEBPACK_IMPORTED_MODULE_11__.distributeElements),\n/* harmony export */ doBoundsIntersect: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.doBoundsIntersect),\n/* harmony export */ dragNewElement: () => (/* reexport safe */ _dragElements__WEBPACK_IMPORTED_MODULE_12__.dragNewElement),\n/* harmony export */ dragSelectedElements: () => (/* reexport safe */ _dragElements__WEBPACK_IMPORTED_MODULE_12__.dragSelectedElements),\n/* harmony export */ duplicateElement: () => (/* reexport safe */ _duplicate__WEBPACK_IMPORTED_MODULE_13__.duplicateElement),\n/* harmony export */ duplicateElements: () => (/* reexport safe */ _duplicate__WEBPACK_IMPORTED_MODULE_13__.duplicateElements),\n/* harmony export */ editGroupForSelectedElement: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.editGroupForSelectedElement),\n/* harmony export */ elementCenterPoint: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.elementCenterPoint),\n/* harmony export */ elementOverlapsWithFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.elementOverlapsWithFrame),\n/* harmony export */ elementWithCanvasCache: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.elementWithCanvasCache),\n/* harmony export */ elementsAreInFrameBounds: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.elementsAreInFrameBounds),\n/* harmony export */ elementsAreInSameGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.elementsAreInSameGroup),\n/* harmony export */ elementsOverlappingBBox: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.elementsOverlappingBBox),\n/* harmony export */ embeddableURLValidator: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.embeddableURLValidator),\n/* harmony export */ excludeElementsInFramesFromSelection: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.excludeElementsInFramesFromSelection),\n/* harmony export */ filterElementsEligibleAsFrameChildren: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.filterElementsEligibleAsFrameChildren),\n/* harmony export */ fixBindingsAfterDeletion: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.fixBindingsAfterDeletion),\n/* harmony export */ fixDuplicatedBindingsAfterDuplication: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.fixDuplicatedBindingsAfterDuplication),\n/* harmony export */ flipHeading: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.flipHeading),\n/* harmony export */ frameAndChildrenSelectedTogether: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.frameAndChildrenSelectedTogether),\n/* harmony export */ generateLinearCollisionShape: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.generateLinearCollisionShape),\n/* harmony export */ generateRoughOptions: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.generateRoughOptions),\n/* harmony export */ getActiveTextElement: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getActiveTextElement),\n/* harmony export */ getAllHoveredElementAtPoint: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.getAllHoveredElementAtPoint),\n/* harmony export */ getApproxMinLineHeight: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getApproxMinLineHeight),\n/* harmony export */ getApproxMinLineWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getApproxMinLineWidth),\n/* harmony export */ getArrowLocalFixedPoints: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getArrowLocalFixedPoints),\n/* harmony export */ getArrowheadAngle: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getArrowheadAngle),\n/* harmony export */ getArrowheadForPicker: () => (/* reexport safe */ _arrowheads__WEBPACK_IMPORTED_MODULE_46__.getArrowheadForPicker),\n/* harmony export */ getArrowheadPoints: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getArrowheadPoints),\n/* harmony export */ getArrowheadSize: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getArrowheadSize),\n/* harmony export */ getBindingGap: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getBindingGap),\n/* harmony export */ getBindingSideMidPoint: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getBindingSideMidPoint),\n/* harmony export */ getBindingStrategyForDraggingBindingElementEndpoints: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getBindingStrategyForDraggingBindingElementEndpoints),\n/* harmony export */ getBoundTextElement: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextElement),\n/* harmony export */ getBoundTextElementId: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextElementId),\n/* harmony export */ getBoundTextElementPosition: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextElementPosition),\n/* harmony export */ getBoundTextMaxHeight: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextMaxHeight),\n/* harmony export */ getBoundTextMaxWidth: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getBoundTextMaxWidth),\n/* harmony export */ getBoundsFromPoints: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getBoundsFromPoints),\n/* harmony export */ getCenterForBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getCenterForBounds),\n/* harmony export */ getClosestElementBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getClosestElementBounds),\n/* harmony export */ getCommonBoundingBox: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getCommonBoundingBox),\n/* harmony export */ getCommonBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getCommonBounds),\n/* harmony export */ getCommonFrameId: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getCommonFrameId),\n/* harmony export */ getContainerCenter: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getContainerCenter),\n/* harmony export */ getContainerCoords: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getContainerCoords),\n/* harmony export */ getContainerElement: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getContainerElement),\n/* harmony export */ getContainingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getContainingFrame),\n/* harmony export */ getCornerRadius: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.getCornerRadius),\n/* harmony export */ getCubicBezierCurveBound: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getCubicBezierCurveBound),\n/* harmony export */ getCursorForResizingElement: () => (/* reexport safe */ _resizeTest__WEBPACK_IMPORTED_MODULE_30__.getCursorForResizingElement),\n/* harmony export */ getDefaultFrameName: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getDefaultFrameName),\n/* harmony export */ getDefaultRoundnessTypeForElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.getDefaultRoundnessTypeForElement),\n/* harmony export */ getDiamondBaseCorners: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.getDiamondBaseCorners),\n/* harmony export */ getDiamondPoints: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getDiamondPoints),\n/* harmony export */ getDragOffsetXY: () => (/* reexport safe */ _dragElements__WEBPACK_IMPORTED_MODULE_12__.getDragOffsetXY),\n/* harmony export */ getDraggedElementsBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getDraggedElementsBounds),\n/* harmony export */ getElementAbsoluteCoords: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords),\n/* harmony export */ getElementBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getElementBounds),\n/* harmony export */ getElementLineSegments: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getElementLineSegments),\n/* harmony export */ getElementPointsCoords: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getElementPointsCoords),\n/* harmony export */ getElementShape: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.getElementShape),\n/* harmony export */ getElementWithTransformHandleType: () => (/* reexport safe */ _resizeTest__WEBPACK_IMPORTED_MODULE_30__.getElementWithTransformHandleType),\n/* harmony export */ getElementsCompletelyInFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsCompletelyInFrame),\n/* harmony export */ getElementsInGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getElementsInGroup),\n/* harmony export */ getElementsInNewFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsInNewFrame),\n/* harmony export */ getElementsInResizingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsInResizingFrame),\n/* harmony export */ getElementsIntersectingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsIntersectingFrame),\n/* harmony export */ getElementsOverlappingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getElementsOverlappingFrame),\n/* harmony export */ getElementsWithinSelection: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getElementsWithinSelection),\n/* harmony export */ getEmbedLink: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.getEmbedLink),\n/* harmony export */ getFlipAdjustedCropPosition: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.getFlipAdjustedCropPosition),\n/* harmony export */ getFrameChildren: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getFrameChildren),\n/* harmony export */ getFrameChildrenInsertionIndex: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getFrameChildrenInsertionIndex),\n/* harmony export */ getFrameLikeElements: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getFrameLikeElements),\n/* harmony export */ getFrameLikeTitle: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getFrameLikeTitle),\n/* harmony export */ getFreedrawOutlineAsSegments: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.getFreedrawOutlineAsSegments),\n/* harmony export */ getFreedrawOutlinePoints: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.getFreedrawOutlinePoints),\n/* harmony export */ getGlobalFixedPointForBindableElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getGlobalFixedPointForBindableElement),\n/* harmony export */ getGlobalFixedPoints: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getGlobalFixedPoints),\n/* harmony export */ getHeadingForElbowArrowSnap: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.getHeadingForElbowArrowSnap),\n/* harmony export */ getHoveredElementForBinding: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.getHoveredElementForBinding),\n/* harmony export */ getHoveredElementForFocusPoint: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.getHoveredElementForFocusPoint),\n/* harmony export */ getInitializedImageElements: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.getInitializedImageElements),\n/* harmony export */ getLineHeightInPx: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getLineHeightInPx),\n/* harmony export */ getLineWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getLineWidth),\n/* harmony export */ getLinearElementSubType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.getLinearElementSubType),\n/* harmony export */ getLinkDirectionFromKey: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.getLinkDirectionFromKey),\n/* harmony export */ getLinkIdAndTypeFromSelection: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.getLinkIdAndTypeFromSelection),\n/* harmony export */ getLockedLinearCursorAlignSize: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.getLockedLinearCursorAlignSize),\n/* harmony export */ getMaxCharWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getMaxCharWidth),\n/* harmony export */ getMaximumGroups: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getMaximumGroups),\n/* harmony export */ getMinCharWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getMinCharWidth),\n/* harmony export */ getMinMaxXYFromCurvePathOps: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getMinMaxXYFromCurvePathOps),\n/* harmony export */ getMinTextElementWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getMinTextElementWidth),\n/* harmony export */ getNewGroupIdsForDuplication: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getNewGroupIdsForDuplication),\n/* harmony export */ getNextSingleWidthAndHeightFromPointer: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.getNextSingleWidthAndHeightFromPointer),\n/* harmony export */ getNonDeletedElements: () => (/* binding */ getNonDeletedElements),\n/* harmony export */ getNonDeletedGroupIds: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getNonDeletedGroupIds),\n/* harmony export */ getNormalizedDimensions: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.getNormalizedDimensions),\n/* harmony export */ getObservedAppState: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_36__.getObservedAppState),\n/* harmony export */ getOmitSidesForEditorInterface: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.getOmitSidesForEditorInterface),\n/* harmony export */ getOriginalContainerHeightFromCache: () => (/* reexport safe */ _containerCache__WEBPACK_IMPORTED_MODULE_7__.getOriginalContainerHeightFromCache),\n/* harmony export */ getPerfectElementSize: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.getPerfectElementSize),\n/* harmony export */ getPredecessors: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.getPredecessors),\n/* harmony export */ getRectangleBoxAbsoluteCoords: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getRectangleBoxAbsoluteCoords),\n/* harmony export */ getRenderOpacity: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.getRenderOpacity),\n/* harmony export */ getResizeArrowDirection: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.getResizeArrowDirection),\n/* harmony export */ getResizeOffsetXY: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.getResizeOffsetXY),\n/* harmony export */ getResizedElementAbsoluteCoords: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getResizedElementAbsoluteCoords),\n/* harmony export */ getRootElements: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getRootElements),\n/* harmony export */ getSceneVersion: () => (/* binding */ getSceneVersion),\n/* harmony export */ getSelectedElements: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getSelectedElements),\n/* harmony export */ getSelectedElementsByGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getSelectedElementsByGroup),\n/* harmony export */ getSelectedGroupForElement: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getSelectedGroupForElement),\n/* harmony export */ getSelectedGroupIdForElement: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getSelectedGroupIdForElement),\n/* harmony export */ getSelectedGroupIds: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.getSelectedGroupIds),\n/* harmony export */ getSelectionStateForElements: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getSelectionStateForElements),\n/* harmony export */ getSnapOutlineMidPoint: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.getSnapOutlineMidPoint),\n/* harmony export */ getTargetElements: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getTargetElements),\n/* harmony export */ getTargetFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.getTargetFrame),\n/* harmony export */ getTextElementAngle: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getTextElementAngle),\n/* harmony export */ getTextFromElements: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.getTextFromElements),\n/* harmony export */ getTextHeight: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getTextHeight),\n/* harmony export */ getTextWidth: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.getTextWidth),\n/* harmony export */ getTransformHandleTypeFromCoords: () => (/* reexport safe */ _resizeTest__WEBPACK_IMPORTED_MODULE_30__.getTransformHandleTypeFromCoords),\n/* harmony export */ getTransformHandles: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.getTransformHandles),\n/* harmony export */ getTransformHandlesFromCoords: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.getTransformHandlesFromCoords),\n/* harmony export */ getUncroppedImageElement: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.getUncroppedImageElement),\n/* harmony export */ getUncroppedWidthAndHeight: () => (/* reexport safe */ _cropElement__WEBPACK_IMPORTED_MODULE_8__.getUncroppedWidthAndHeight),\n/* harmony export */ getVisibleAndNonSelectedElements: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.getVisibleAndNonSelectedElements),\n/* harmony export */ getVisibleElements: () => (/* binding */ getVisibleElements),\n/* harmony export */ getVisibleSceneBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.getVisibleSceneBounds),\n/* harmony export */ getWrappedTextLines: () => (/* reexport safe */ _textWrapping__WEBPACK_IMPORTED_MODULE_39__.getWrappedTextLines),\n/* harmony export */ groupByFrameLikes: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.groupByFrameLikes),\n/* harmony export */ groupsAreAtLeastIntersectingTheFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.groupsAreAtLeastIntersectingTheFrame),\n/* harmony export */ groupsAreCompletelyOutOfFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.groupsAreCompletelyOutOfFrame),\n/* harmony export */ handleBindTextResize: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.handleBindTextResize),\n/* harmony export */ handleFocusPointDrag: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.handleFocusPointDrag),\n/* harmony export */ handleFocusPointHover: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.handleFocusPointHover),\n/* harmony export */ handleFocusPointPointerDown: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.handleFocusPointPointerDown),\n/* harmony export */ handleFocusPointPointerUp: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.handleFocusPointPointerUp),\n/* harmony export */ hasBackground: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.hasBackground),\n/* harmony export */ hasBoundTextElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.hasBoundTextElement),\n/* harmony export */ hasBoundingBox: () => (/* reexport safe */ _transformHandles__WEBPACK_IMPORTED_MODULE_41__.hasBoundingBox),\n/* harmony export */ hasStrokeColor: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.hasStrokeColor),\n/* harmony export */ hasStrokeStyle: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.hasStrokeStyle),\n/* harmony export */ hasStrokeWidth: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.hasStrokeWidth),\n/* harmony export */ hashElementsVersion: () => (/* binding */ hashElementsVersion),\n/* harmony export */ hashString: () => (/* binding */ hashString),\n/* harmony export */ headingForPoint: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingForPoint),\n/* harmony export */ headingForPointFromElement: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingForPointFromElement),\n/* harmony export */ headingForPointIsHorizontal: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingForPointIsHorizontal),\n/* harmony export */ headingIsHorizontal: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingIsHorizontal),\n/* harmony export */ headingIsVertical: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.headingIsVertical),\n/* harmony export */ hitElementBoundText: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.hitElementBoundText),\n/* harmony export */ hitElementBoundingBox: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.hitElementBoundingBox),\n/* harmony export */ hitElementBoundingBoxOnly: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.hitElementBoundingBoxOnly),\n/* harmony export */ hitElementItself: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.hitElementItself),\n/* harmony export */ intersectElementWithLineSegment: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.intersectElementWithLineSegment),\n/* harmony export */ isArrowBoundToElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isArrowBoundToElement),\n/* harmony export */ isArrowElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isArrowElement),\n/* harmony export */ isBindableElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isBindableElement),\n/* harmony export */ isBindableElementInsideOtherBindable: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.isBindableElementInsideOtherBindable),\n/* harmony export */ isBindingElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isBindingElement),\n/* harmony export */ isBindingElementType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isBindingElementType),\n/* harmony export */ isBindingEnabled: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.isBindingEnabled),\n/* harmony export */ isBoundToContainer: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isBoundToContainer),\n/* harmony export */ isCursorInFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.isCursorInFrame),\n/* harmony export */ isCurvedArrow: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isCurvedArrow),\n/* harmony export */ isElbowArrow: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isElbowArrow),\n/* harmony export */ isElementCompletelyInViewport: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.isElementCompletelyInViewport),\n/* harmony export */ isElementContainingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.isElementContainingFrame),\n/* harmony export */ isElementInFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.isElementInFrame),\n/* harmony export */ isElementInGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.isElementInGroup),\n/* harmony export */ isElementInViewport: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.isElementInViewport),\n/* harmony export */ isElementIntersectingFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.isElementIntersectingFrame),\n/* harmony export */ isElementLink: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.isElementLink),\n/* harmony export */ isEligibleFrameChildType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isEligibleFrameChildType),\n/* harmony export */ isEmbeddableElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isEmbeddableElement),\n/* harmony export */ isExcalidrawElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isExcalidrawElement),\n/* harmony export */ isFixedPoint: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.isFixedPoint),\n/* harmony export */ isFlowchartNodeElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFlowchartNodeElement),\n/* harmony export */ isFocusPointVisible: () => (/* reexport safe */ _arrows_focus__WEBPACK_IMPORTED_MODULE_18__.isFocusPointVisible),\n/* harmony export */ isFrameElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFrameElement),\n/* harmony export */ isFrameLikeElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFrameLikeElement),\n/* harmony export */ isFreeDrawElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFreeDrawElement),\n/* harmony export */ isFreeDrawElementType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isFreeDrawElementType),\n/* harmony export */ isHTMLSVGElement: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.isHTMLSVGElement),\n/* harmony export */ isIframeElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isIframeElement),\n/* harmony export */ isIframeLikeElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isIframeLikeElement),\n/* harmony export */ isImageElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isImageElement),\n/* harmony export */ isInGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.isInGroup),\n/* harmony export */ isInitializedImageElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isInitializedImageElement),\n/* harmony export */ isInvisiblySmallElement: () => (/* reexport safe */ _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.isInvisiblySmallElement),\n/* harmony export */ isLineElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isLineElement),\n/* harmony export */ isLinearElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isLinearElement),\n/* harmony export */ isLinearElementType: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isLinearElementType),\n/* harmony export */ isMagicFrameElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isMagicFrameElement),\n/* harmony export */ isMeasureTextSupported: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.isMeasureTextSupported),\n/* harmony export */ isNodeInFlowchart: () => (/* reexport safe */ _flowchart__WEBPACK_IMPORTED_MODULE_17__.isNodeInFlowchart),\n/* harmony export */ isNonDeletedElement: () => (/* binding */ isNonDeletedElement),\n/* harmony export */ isPathALoop: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.isPathALoop),\n/* harmony export */ isPointInElement: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.isPointInElement),\n/* harmony export */ isRectangularElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isRectangularElement),\n/* harmony export */ isRectanguloidElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isRectanguloidElement),\n/* harmony export */ isSelectedViaGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.isSelectedViaGroup),\n/* harmony export */ isSharpArrow: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isSharpArrow),\n/* harmony export */ isSimpleArrow: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isSimpleArrow),\n/* harmony export */ isSomeElementSelected: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.isSomeElementSelected),\n/* harmony export */ isTextBindableContainer: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isTextBindableContainer),\n/* harmony export */ isTextElement: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isTextElement),\n/* harmony export */ isUsingAdaptiveRadius: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isUsingAdaptiveRadius),\n/* harmony export */ isUsingProportionalRadius: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isUsingProportionalRadius),\n/* harmony export */ isValidPolygon: () => (/* reexport safe */ _typeChecks__WEBPACK_IMPORTED_MODULE_42__.isValidPolygon),\n/* harmony export */ isValidTextContainer: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.isValidTextContainer),\n/* harmony export */ loadHTMLImageElement: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.loadHTMLImageElement),\n/* harmony export */ makeNextSelectedElementIds: () => (/* reexport safe */ _selection__WEBPACK_IMPORTED_MODULE_32__.makeNextSelectedElementIds),\n/* harmony export */ maxBindingDistance_simple: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.maxBindingDistance_simple),\n/* harmony export */ maybeHandleArrowPointlikeDrag: () => (/* reexport safe */ _arrows_helpers__WEBPACK_IMPORTED_MODULE_45__.maybeHandleArrowPointlikeDrag),\n/* harmony export */ maybeParseEmbedSrc: () => (/* reexport safe */ _embeddable__WEBPACK_IMPORTED_MODULE_16__.maybeParseEmbedSrc),\n/* harmony export */ measureFontSizeFromWidth: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.measureFontSizeFromWidth),\n/* harmony export */ measureText: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.measureText),\n/* harmony export */ moveAllLeft: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveAllLeft),\n/* harmony export */ moveAllRight: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveAllRight),\n/* harmony export */ moveArrowAboveBindable: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveArrowAboveBindable),\n/* harmony export */ moveOneLeft: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveOneLeft),\n/* harmony export */ moveOneRight: () => (/* reexport safe */ _zindex__WEBPACK_IMPORTED_MODULE_44__.moveOneRight),\n/* harmony export */ mutateElement: () => (/* reexport safe */ _mutateElement__WEBPACK_IMPORTED_MODULE_25__.mutateElement),\n/* harmony export */ newArrowElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newArrowElement),\n/* harmony export */ newElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newElement),\n/* harmony export */ newElementWith: () => (/* reexport safe */ _mutateElement__WEBPACK_IMPORTED_MODULE_25__.newElementWith),\n/* harmony export */ newEmbeddableElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newEmbeddableElement),\n/* harmony export */ newFrameElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newFrameElement),\n/* harmony export */ newFreeDrawElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newFreeDrawElement),\n/* harmony export */ newIframeElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newIframeElement),\n/* harmony export */ newImageElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newImageElement),\n/* harmony export */ newLinearElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newLinearElement),\n/* harmony export */ newMagicFrameElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newMagicFrameElement),\n/* harmony export */ newTextElement: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.newTextElement),\n/* harmony export */ normalizeArrowhead: () => (/* reexport safe */ _arrowheads__WEBPACK_IMPORTED_MODULE_46__.normalizeArrowhead),\n/* harmony export */ normalizeElementOrder: () => (/* reexport safe */ _sortElements__WEBPACK_IMPORTED_MODULE_35__.normalizeElementOrder),\n/* harmony export */ normalizeFixedPoint: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.normalizeFixedPoint),\n/* harmony export */ normalizeSVG: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.normalizeSVG),\n/* harmony export */ normalizeText: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.normalizeText),\n/* harmony export */ omitGroupsContainingFrameLikes: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.omitGroupsContainingFrameLikes),\n/* harmony export */ omitPartialGroups: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.omitPartialGroups),\n/* harmony export */ orderByFractionalIndex: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.orderByFractionalIndex),\n/* harmony export */ originalContainerCache: () => (/* reexport safe */ _containerCache__WEBPACK_IMPORTED_MODULE_7__.originalContainerCache),\n/* harmony export */ parseElementLinkFromURL: () => (/* reexport safe */ _elementLink__WEBPACK_IMPORTED_MODULE_15__.parseElementLinkFromURL),\n/* harmony export */ parseTokens: () => (/* reexport safe */ _textWrapping__WEBPACK_IMPORTED_MODULE_39__.parseTokens),\n/* harmony export */ pointInsideBounds: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.pointInsideBounds),\n/* harmony export */ pointInsideBoundsInclusive: () => (/* reexport safe */ _bounds__WEBPACK_IMPORTED_MODULE_4__.pointInsideBoundsInclusive),\n/* harmony export */ positionElementsOnGrid: () => (/* reexport safe */ _positionElementsOnGrid__WEBPACK_IMPORTED_MODULE_27__.positionElementsOnGrid),\n/* harmony export */ projectFixedPointOntoDiagonal: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_43__.projectFixedPointOntoDiagonal),\n/* harmony export */ redrawTextBoundingBox: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.redrawTextBoundingBox),\n/* harmony export */ refreshTextDimensions: () => (/* reexport safe */ _newElement__WEBPACK_IMPORTED_MODULE_26__.refreshTextDimensions),\n/* harmony export */ removeAllElementsFromFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.removeAllElementsFromFrame),\n/* harmony export */ removeElementsFromFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.removeElementsFromFrame),\n/* harmony export */ removeFromSelectedGroups: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.removeFromSelectedGroups),\n/* harmony export */ renderElement: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.renderElement),\n/* harmony export */ renderSelectionElement: () => (/* reexport safe */ _renderElement__WEBPACK_IMPORTED_MODULE_28__.renderSelectionElement),\n/* harmony export */ replaceAllElementsInFrame: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.replaceAllElementsInFrame),\n/* harmony export */ rescalePointsInElement: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.rescalePointsInElement),\n/* harmony export */ resetOriginalContainerCache: () => (/* reexport safe */ _containerCache__WEBPACK_IMPORTED_MODULE_7__.resetOriginalContainerCache),\n/* harmony export */ resizeMultipleElements: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.resizeMultipleElements),\n/* harmony export */ resizeSingleElement: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.resizeSingleElement),\n/* harmony export */ resizeSingleTextElement: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.resizeSingleTextElement),\n/* harmony export */ resizeTest: () => (/* reexport safe */ _resizeTest__WEBPACK_IMPORTED_MODULE_30__.resizeTest),\n/* harmony export */ selectGroup: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.selectGroup),\n/* harmony export */ selectGroupsForSelectedElements: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.selectGroupsForSelectedElements),\n/* harmony export */ selectGroupsFromGivenElements: () => (/* reexport safe */ _groups__WEBPACK_IMPORTED_MODULE_21__.selectGroupsFromGivenElements),\n/* harmony export */ setCustomTextMetricsProvider: () => (/* reexport safe */ _textMeasurements__WEBPACK_IMPORTED_MODULE_38__.setCustomTextMetricsProvider),\n/* harmony export */ shouldAllowVerticalAlign: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.shouldAllowVerticalAlign),\n/* harmony export */ shouldApplyFrameClip: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.shouldApplyFrameClip),\n/* harmony export */ shouldTestInside: () => (/* reexport safe */ _collision__WEBPACK_IMPORTED_MODULE_5__.shouldTestInside),\n/* harmony export */ showSelectedShapeActions: () => (/* reexport safe */ _showSelectedShapeActions__WEBPACK_IMPORTED_MODULE_34__.showSelectedShapeActions),\n/* harmony export */ snapToMid: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.snapToMid),\n/* harmony export */ suppportsHorizontalAlign: () => (/* reexport safe */ _textElement__WEBPACK_IMPORTED_MODULE_37__.suppportsHorizontalAlign),\n/* harmony export */ syncInvalidIndices: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.syncInvalidIndices),\n/* harmony export */ syncInvalidIndicesImmutable: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.syncInvalidIndicesImmutable),\n/* harmony export */ syncMovedIndices: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.syncMovedIndices),\n/* harmony export */ toggleLinePolygonState: () => (/* reexport safe */ _shape__WEBPACK_IMPORTED_MODULE_33__.toggleLinePolygonState),\n/* harmony export */ toolIsArrow: () => (/* reexport safe */ _comparisons__WEBPACK_IMPORTED_MODULE_6__.toolIsArrow),\n/* harmony export */ transformElements: () => (/* reexport safe */ _resizeElements__WEBPACK_IMPORTED_MODULE_29__.transformElements),\n/* harmony export */ unbindBindingElement: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.unbindBindingElement),\n/* harmony export */ updateBindings: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.updateBindings),\n/* harmony export */ updateBoundElements: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.updateBoundElements),\n/* harmony export */ updateBoundPoint: () => (/* reexport safe */ _binding__WEBPACK_IMPORTED_MODULE_3__.updateBoundPoint),\n/* harmony export */ updateElbowArrowPoints: () => (/* reexport safe */ _elbowArrow__WEBPACK_IMPORTED_MODULE_14__.updateElbowArrowPoints),\n/* harmony export */ updateFrameMembershipOfSelectedElements: () => (/* reexport safe */ _frame__WEBPACK_IMPORTED_MODULE_20__.updateFrameMembershipOfSelectedElements),\n/* harmony export */ updateImageCache: () => (/* reexport safe */ _image__WEBPACK_IMPORTED_MODULE_23__.updateImageCache),\n/* harmony export */ updateOriginalContainerCache: () => (/* reexport safe */ _containerCache__WEBPACK_IMPORTED_MODULE_7__.updateOriginalContainerCache),\n/* harmony export */ validateElbowPoints: () => (/* reexport safe */ _elbowArrow__WEBPACK_IMPORTED_MODULE_14__.validateElbowPoints),\n/* harmony export */ validateFractionalIndices: () => (/* reexport safe */ _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__.validateFractionalIndices),\n/* harmony export */ vectorToHeading: () => (/* reexport safe */ _heading__WEBPACK_IMPORTED_MODULE_22__.vectorToHeading),\n/* harmony export */ wrapText: () => (/* reexport safe */ _textWrapping__WEBPACK_IMPORTED_MODULE_39__.wrapText)\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 _sizeHelpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sizeHelpers */ \"../element/src/sizeHelpers.ts\");\n/* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./align */ \"../element/src/align.ts\");\n/* harmony import */ var _binding__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./binding */ \"../element/src/binding.ts\");\n/* harmony import */ var _bounds__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _collision__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./collision */ \"../element/src/collision.ts\");\n/* harmony import */ var _comparisons__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./comparisons */ \"../element/src/comparisons.ts\");\n/* harmony import */ var _containerCache__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./containerCache */ \"../element/src/containerCache.ts\");\n/* harmony import */ var _cropElement__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./cropElement */ \"../element/src/cropElement.ts\");\n/* harmony import */ var _delta__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./delta */ \"../element/src/delta.ts\");\n/* harmony import */ var _distance__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./distance */ \"../element/src/distance.ts\");\n/* harmony import */ var _distribute__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./distribute */ \"../element/src/distribute.ts\");\n/* harmony import */ var _dragElements__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./dragElements */ \"../element/src/dragElements.ts\");\n/* harmony import */ var _duplicate__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./duplicate */ \"../element/src/duplicate.ts\");\n/* harmony import */ var _elbowArrow__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./elbowArrow */ \"../element/src/elbowArrow.ts\");\n/* harmony import */ var _elementLink__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./elementLink */ \"../element/src/elementLink.ts\");\n/* harmony import */ var _embeddable__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./embeddable */ \"../element/src/embeddable.ts\");\n/* harmony import */ var _flowchart__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./flowchart */ \"../element/src/flowchart.ts\");\n/* harmony import */ var _arrows_focus__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./arrows/focus */ \"../element/src/arrows/focus.ts\");\n/* harmony import */ var _fractionalIndex__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./fractionalIndex */ \"../element/src/fractionalIndex.ts\");\n/* harmony import */ var _frame__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./frame */ \"../element/src/frame.ts\");\n/* harmony import */ var _groups__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./groups */ \"../element/src/groups.ts\");\n/* harmony import */ var _heading__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./heading */ \"../element/src/heading.ts\");\n/* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./image */ \"../element/src/image.ts\");\n/* harmony import */ var _linearElementEditor__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./linearElementEditor */ \"../element/src/linearElementEditor.ts\");\n/* harmony import */ var _mutateElement__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./mutateElement */ \"../element/src/mutateElement.ts\");\n/* harmony import */ var _newElement__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./newElement */ \"../element/src/newElement.ts\");\n/* harmony import */ var _positionElementsOnGrid__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./positionElementsOnGrid */ \"../element/src/positionElementsOnGrid.ts\");\n/* harmony import */ var _renderElement__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./renderElement */ \"../element/src/renderElement.ts\");\n/* harmony import */ var _resizeElements__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./resizeElements */ \"../element/src/resizeElements.ts\");\n/* harmony import */ var _resizeTest__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./resizeTest */ \"../element/src/resizeTest.ts\");\n/* harmony import */ var _Scene__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Scene */ \"../element/src/Scene.ts\");\n/* harmony import */ var _selection__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./selection */ \"../element/src/selection.ts\");\n/* harmony import */ var _shape__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./shape */ \"../element/src/shape.ts\");\n/* harmony import */ var _showSelectedShapeActions__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./showSelectedShapeActions */ \"../element/src/showSelectedShapeActions.ts\");\n/* harmony import */ var _sortElements__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./sortElements */ \"../element/src/sortElements.ts\");\n/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./store */ \"../element/src/store.ts\");\n/* harmony import */ var _textElement__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _textMeasurements__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./textMeasurements */ \"../element/src/textMeasurements.ts\");\n/* harmony import */ var _textWrapping__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./textWrapping */ \"../element/src/textWrapping.ts\");\n/* harmony import */ var _transform__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./transform */ \"../element/src/transform.ts\");\n/* harmony import */ var _transformHandles__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./transformHandles */ \"../element/src/transformHandles.ts\");\n/* harmony import */ var _typeChecks__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./typeChecks */ \"../element/src/typeChecks.ts\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./utils */ \"../element/src/utils.ts\");\n/* harmony import */ var _zindex__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./zindex */ \"../element/src/zindex.ts\");\n/* harmony import */ var _arrows_helpers__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./arrows/helpers */ \"../element/src/arrows/helpers.ts\");\n/* harmony import */ var _arrowheads__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./arrowheads */ \"../element/src/arrowheads.ts\");\n\n\n/**\n * @deprecated unsafe, use hashElementsVersion instead\n */\n\nconst getSceneVersion = elements => elements.reduce((acc, el) => acc + el.version, 0);\n/**\n * Hashes elements' versionNonce (using djb2 algo). Order of elements matters.\n */\n\nconst hashElementsVersion = elements => {\n let hash = 5381;\n\n for (const element of (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.toIterable)(elements)) {\n hash = (hash << 5) + hash + element.versionNonce;\n }\n\n return hash >>> 0; // Ensure unsigned 32-bit integer\n}; // string hash function (using djb2). Not cryptographically secure, use only\n// for versioning and such.\n// note: hashes individual code units (not code points),\n// but for hashing purposes this is fine as it iterates through every code unit\n// (as such, no need to encode to byte string first)\n\nconst hashString = s => {\n let hash = 5381;\n\n for (let i = 0; i < s.length; i++) {\n const char = s.charCodeAt(i);\n hash = (hash << 5) + hash + char;\n }\n\n return hash >>> 0; // Ensure unsigned 32-bit integer\n};\nconst getVisibleElements = elements => elements.filter(el => !el.isDeleted && !(0,_sizeHelpers__WEBPACK_IMPORTED_MODULE_1__.isInvisiblySmallElement)(el));\nconst getNonDeletedElements = elements => elements.filter(element => !element.isDeleted);\nconst isNonDeletedElement = element => !element.isDeleted;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/index.ts?\n}");
|
|
962
962
|
|
|
963
963
|
/***/ },
|
|
964
964
|
|
|
@@ -1046,7 +1046,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1046
1046
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1047
1047
|
|
|
1048
1048
|
"use strict";
|
|
1049
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ excludeElementsInFramesFromSelection: () => (/* binding */ excludeElementsInFramesFromSelection),\n/* harmony export */ getActiveTextElement: () => (/* binding */ getActiveTextElement),\n/* harmony export */ getElementsWithinSelection: () => (/* binding */ getElementsWithinSelection),\n/* harmony export */ getSelectedElements: () => (/* binding */ getSelectedElements),\n/* harmony export */ getSelectionStateForElements: () => (/* binding */ getSelectionStateForElements),\n/* harmony export */ getTargetElements: () => (/* binding */ getTargetElements),\n/* harmony export */ getVisibleAndNonSelectedElements: () => (/* binding */ getVisibleAndNonSelectedElements),\n/* harmony export */ isSomeElementSelected: () => (/* binding */ isSomeElementSelected),\n/* harmony export */ makeNextSelectedElementIds: () => (/* binding */ makeNextSelectedElementIds)\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 _bounds__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _collision__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./collision */ \"../element/src/collision.ts\");\n/* harmony import */ var _sizeHelpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sizeHelpers */ \"../element/src/sizeHelpers.ts\");\n/* harmony import */ var _typeChecks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./typeChecks */ \"../element/src/typeChecks.ts\");\n/* harmony import */ var _frame__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./frame */ \"../element/src/frame.ts\");\n/* harmony import */ var _linearElementEditor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./linearElementEditor */ \"../element/src/linearElementEditor.ts\");\n/* harmony import */ var _groups__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./groups */ \"../element/src/groups.ts\");\n/* harmony import */ var _textElement__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./textElement */ \"../element/src/textElement.ts\");\n\n\n\n\n\n\n\n\n\n\n\nconst shouldIgnoreElementFromSelection = element => element.locked || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isBoundToContainer)(element);\n\nconst excludeElementsFromFrames = (selectedElements, framesInSelection) => {\n return selectedElements.filter(element => {\n if (element.frameId && framesInSelection.has(element.frameId)) {\n return false;\n }\n\n return true;\n });\n};\n/**\n * Frames and their containing elements are not to be selected at the same time.\n * Given an array of selected elements, if there are frames and their containing elements\n * we only keep the frames.\n * @param selectedElements\n */\n\n\nconst excludeElementsInFramesFromSelection = selectedElements => {\n const framesInSelection = new Set();\n selectedElements.forEach(element => {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isFrameLikeElement)(element)) {\n framesInSelection.add(element.id);\n }\n });\n return excludeElementsFromFrames(selectedElements, framesInSelection);\n};\nconst getElementsWithinSelection = (elements, selection, elementsMap, // TODO remove (this flag is effectively unused AFAIK)\nexcludeElementsInFrames = true, boxSelectionMode = \"contain\") => {\n const [selectionStartX, selectionStartY, selectionEndX, selectionEndY] = (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.getElementAbsoluteCoords)(selection, elementsMap);\n const selectionX1 = Math.min(selectionStartX, selectionEndX);\n const selectionY1 = Math.min(selectionStartY, selectionEndY);\n const selectionX2 = Math.max(selectionStartX, selectionEndX);\n const selectionY2 = Math.max(selectionStartY, selectionEndY);\n const selectionBounds = [selectionX1, selectionY1, selectionX2, selectionY2];\n const selectionEdges = [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(selectionX1, selectionY1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(selectionX2, selectionY1)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(selectionX2, selectionY1), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(selectionX2, selectionY2)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(selectionX2, selectionY2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(selectionX1, selectionY2)), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.lineSegment)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(selectionX1, selectionY2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(selectionX1, selectionY1))];\n const framesInSelection = excludeElementsInFrames ? new Set() : null;\n const groups = {};\n const elementsInSelection = new Set();\n\n for (const element of elements) {\n if (shouldIgnoreElementFromSelection(element)) {\n continue;\n } // Track only selectable top-level group members, so ignored elements such\n // as bound text and locked elements don't affect group selection.\n\n\n const groupId = element.groupIds.at(-1);\n\n if (groupId) {\n if (!groups[groupId]) {\n groups[groupId] = [];\n }\n\n groups[groupId].push(element);\n }\n\n const strokeWidth = element.strokeWidth;\n let labelAABB = null;\n let elementAABB = (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.getElementBounds)(element, elementsMap);\n elementAABB = [elementAABB[0] - strokeWidth / 2, elementAABB[1] - strokeWidth / 2, elementAABB[2] + strokeWidth / 2, elementAABB[3] + strokeWidth / 2]; // Whether the element bounds should include the bound text element bounds\n\n const boundTextElement = (0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isArrowElement)(element) && (0,_textElement__WEBPACK_IMPORTED_MODULE_9__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement) {\n const {\n x,\n y\n } = _linearElementEditor__WEBPACK_IMPORTED_MODULE_7__.LinearElementEditor.getBoundTextElementPosition(element, boundTextElement, elementsMap);\n labelAABB = [x, y, x + boundTextElement.width, y + boundTextElement.height];\n } // Clip element bounds by its containing frame (if any), since only the\n // visible (frame-clipped) portion of the element is relevant for selection.\n\n\n const associatedFrame = (0,_frame__WEBPACK_IMPORTED_MODULE_6__.getContainingFrame)(element, elementsMap);\n\n if (associatedFrame && (0,_frame__WEBPACK_IMPORTED_MODULE_6__.elementOverlapsWithFrame)(element, associatedFrame, elementsMap)) {\n const frameAABB = (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.getElementBounds)(associatedFrame, elementsMap);\n elementAABB = [Math.max(elementAABB[0], frameAABB[0]), Math.max(elementAABB[1], frameAABB[1]), Math.min(elementAABB[2], frameAABB[2]), Math.min(elementAABB[3], frameAABB[3])];\n labelAABB = labelAABB ? [Math.max(labelAABB[0], frameAABB[0]), Math.max(labelAABB[1], frameAABB[1]), Math.min(labelAABB[2], frameAABB[2]), Math.min(labelAABB[3], frameAABB[3])] : null;\n }\n\n const commonAABB = labelAABB ? [Math.min(labelAABB[0], elementAABB[0]), Math.min(labelAABB[1], elementAABB[1]), Math.max(labelAABB[2], elementAABB[2]), Math.max(labelAABB[3], elementAABB[3])] : elementAABB; // ============== Evaluation ==============\n // 1. If the selection box WRAPs the element's AABB, then add it to the\n // selection and move on, regardless of the selection mode.\n //\n // PERF: This trick only works with axis-aligned box selection and the\n // current convex element shapes!\n\n if ((0,_bounds__WEBPACK_IMPORTED_MODULE_2__.boundsContainBounds)(selectionBounds, commonAABB)) {\n if (framesInSelection && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isFrameLikeElement)(element)) {\n framesInSelection.add(element.id);\n }\n\n elementsInSelection.add(element);\n continue;\n } // 2. Handle the case where the label is overlapped by the selection box\n\n\n if (boxSelectionMode === \"overlap\" && labelAABB && (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.doBoundsIntersect)(selectionBounds, labelAABB)) {\n elementsInSelection.add(element);\n continue;\n } // 3. Handle the case where the selection is not wrapping the element, but\n // it does intersect the element's outline (non-AABB).\n\n\n if (boxSelectionMode === \"overlap\" && (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.doBoundsIntersect)(selectionBounds, elementAABB)) {\n let hasIntersection = false; // Preliminary check potential intersection imprecision\n\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isLinearElement)(element) || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isFreeDrawElement)(element)) {\n const center = (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.elementCenterPoint)(element, elementsMap);\n hasIntersection = element.points.some(point => {\n const rotatedPoint = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(element.x + point[0], element.y + point[1]), center, element.angle);\n return (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.pointInsideBounds)(rotatedPoint, selectionBounds);\n });\n } else {\n const nonRotatedElementBounds = (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.getElementBounds)(element, elementsMap, true);\n const center = (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.elementCenterPoint)(element, elementsMap);\n hasIntersection = [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)((nonRotatedElementBounds[0] + nonRotatedElementBounds[2]) / 2, nonRotatedElementBounds[1]), center, element.angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(nonRotatedElementBounds[2], (nonRotatedElementBounds[1] + nonRotatedElementBounds[3]) / 2), center, element.angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)((nonRotatedElementBounds[0] + nonRotatedElementBounds[2]) / 2, nonRotatedElementBounds[3]), center, element.angle), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointRotateRads)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointFrom)(nonRotatedElementBounds[0], (nonRotatedElementBounds[1] + nonRotatedElementBounds[3]) / 2), center, element.angle)].some(point => {\n return (0,_bounds__WEBPACK_IMPORTED_MODULE_2__.pointInsideBounds)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_1__.pointRotateRads)(point, center, element.angle), selectionBounds);\n });\n }\n\n if (!hasIntersection) {\n hasIntersection = selectionEdges.some(selectionEdge => (0,_collision__WEBPACK_IMPORTED_MODULE_3__.intersectElementWithLineSegment)(element, elementsMap, selectionEdge, strokeWidth / 2, true).length > 0);\n }\n\n if (hasIntersection) {\n if (framesInSelection && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isFrameLikeElement)(element)) {\n framesInSelection.add(element.id);\n }\n\n elementsInSelection.add(element);\n continue;\n }\n } // 4. We don't need to handle when the selection is inside the element\n // as it is separately handled in App.\n\n }\n\n if (framesInSelection) {\n elementsInSelection.forEach(element => {\n if (element.frameId && framesInSelection.has(element.frameId)) {\n elementsInSelection.delete(element);\n }\n });\n }\n\n if (boxSelectionMode === \"overlap\") {\n Array.from(elementsInSelection).forEach(element => {\n const groupId = element.groupIds.at(-1);\n const group = groupId ? groups[groupId] : null;\n group === null || group === void 0 ? void 0 : group.forEach(groupElement => elementsInSelection.add(groupElement));\n });\n } else if (boxSelectionMode === \"contain\") {\n elementsInSelection.forEach(element => {\n // note: currently we only support top-level group handling since\n // we don't support box selecting while editing the group/subgroup\n // see https://github.com/excalidraw/excalidraw/pull/11234#issuecomment-4387654451\n const groupId = element.groupIds.at(-1);\n const group = groupId ? groups[groupId] : null;\n\n if (group && !group.every(groupElement => elementsInSelection.has(groupElement))) {\n elementsInSelection.delete(element);\n }\n });\n } // to maintain original order elements (namely for group selection)\n\n\n return elements.filter(element => elementsInSelection.has(element));\n};\nconst getVisibleAndNonSelectedElements = (elements, selectedElements, appState, elementsMap) => {\n const selectedElementsSet = new Set(selectedElements.map(element => element.id));\n return elements.filter(element => {\n const isVisible = (0,_sizeHelpers__WEBPACK_IMPORTED_MODULE_4__.isElementInViewport)(element, appState.width, appState.height, appState, elementsMap);\n return !selectedElementsSet.has(element.id) && isVisible;\n });\n}; // FIXME move this into the editor instance to keep utility methods stateless\n\nconst isSomeElementSelected = function () {\n let lastElements = null;\n let lastSelectedElementIds = null;\n let isSelected = null;\n\n const ret = (elements, appState) => {\n if (isSelected != null && elements === lastElements && appState.selectedElementIds === lastSelectedElementIds) {\n return isSelected;\n }\n\n isSelected = elements.some(element => appState.selectedElementIds[element.id]);\n lastElements = elements;\n lastSelectedElementIds = appState.selectedElementIds;\n return isSelected;\n };\n\n ret.clearCache = () => {\n lastElements = null;\n lastSelectedElementIds = null;\n isSelected = null;\n };\n\n return ret;\n}();\nconst getSelectedElements = (elements, appState, opts) => {\n const addedElements = new Set();\n const selectedElements = [];\n\n for (const element of elements.values()) {\n if (appState.selectedElementIds[element.id]) {\n selectedElements.push(element);\n addedElements.add(element.id);\n continue;\n }\n\n if ((opts === null || opts === void 0 ? void 0 : opts.includeBoundTextElement) && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isBoundToContainer)(element) && appState.selectedElementIds[element === null || element === void 0 ? void 0 : element.containerId]) {\n selectedElements.push(element);\n addedElements.add(element.id);\n continue;\n }\n }\n\n if (opts === null || opts === void 0 ? void 0 : opts.includeElementsInFrames) {\n const elementsToInclude = [];\n selectedElements.forEach(element => {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isFrameLikeElement)(element)) {\n (0,_frame__WEBPACK_IMPORTED_MODULE_6__.getFrameChildren)(elements, element.id).forEach(e => !addedElements.has(e.id) && elementsToInclude.push(e));\n }\n\n elementsToInclude.push(element);\n });\n return elementsToInclude;\n }\n\n return selectedElements;\n};\nconst getTargetElements = (elements, appState) => appState.editingTextElement ? [appState.editingTextElement] : appState.newElement ? [appState.newElement] : getSelectedElements(elements, appState, {\n includeBoundTextElement: true\n});\n/**\n * returns prevState's selectedElementids if no change from previous, so as to\n * retain reference identity for memoization\n */\n\nconst makeNextSelectedElementIds = (nextSelectedElementIds, prevState) => {\n if ((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.isShallowEqual)(prevState.selectedElementIds, nextSelectedElementIds)) {\n return prevState.selectedElementIds;\n }\n\n return nextSelectedElementIds;\n};\n\nconst _getLinearElementEditor = (targetElements, allElements) => {\n var _a, _b;\n\n const linears = targetElements.filter(_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isLinearElement);\n\n if (linears.length === 1) {\n const linear = linears[0];\n const boundElements = (_b = (_a = linear.boundElements) === null || _a === void 0 ? void 0 : _a.map(def => def.id)) !== null && _b !== void 0 ? _b : [];\n const onlySingleLinearSelected = targetElements.every(el => el.id === linear.id || boundElements.includes(el.id));\n\n if (onlySingleLinearSelected) {\n return new _linearElementEditor__WEBPACK_IMPORTED_MODULE_7__.LinearElementEditor(linear, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(allElements));\n }\n }\n\n return null;\n};\n\nconst getSelectionStateForElements = (targetElements, allElements, appState) => {\n return Object.assign({\n selectedLinearElement: _getLinearElementEditor(targetElements, allElements)\n }, (0,_groups__WEBPACK_IMPORTED_MODULE_8__.selectGroupsForSelectedElements)({\n editingGroupId: appState.editingGroupId,\n selectedElementIds: excludeElementsInFramesFromSelection(targetElements).reduce((acc, element) => {\n if (!(0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isBoundToContainer)(element)) {\n acc[element.id] = true;\n }\n\n return acc;\n }, {})\n }, allElements, appState, null));\n};\n/**\n * Returns editing or single-selected text element, if any.\n */\n\nconst getActiveTextElement = (selectedElements, appState) => {\n const activeTextElement = appState.editingTextElement || selectedElements.length === 1 && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_5__.isTextElement)(selectedElements[0]) && selectedElements[0];\n return activeTextElement || null;\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/selection.ts?\n}");
|
|
1049
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ excludeElementsInFramesFromSelection: () => (/* binding */ excludeElementsInFramesFromSelection),\n/* harmony export */ getActiveTextElement: () => (/* binding */ getActiveTextElement),\n/* harmony export */ getElementsWithinSelection: () => (/* binding */ getElementsWithinSelection),\n/* harmony export */ getSelectedElements: () => (/* binding */ getSelectedElements),\n/* harmony export */ getSelectionStateForElements: () => (/* binding */ getSelectionStateForElements),\n/* harmony export */ getTargetElements: () => (/* binding */ getTargetElements),\n/* harmony export */ getVisibleAndNonSelectedElements: () => (/* binding */ getVisibleAndNonSelectedElements),\n/* harmony export */ isSomeElementSelected: () => (/* binding */ isSomeElementSelected),\n/* harmony export */ makeNextSelectedElementIds: () => (/* binding */ makeNextSelectedElementIds)\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 _bounds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _sizeHelpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sizeHelpers */ \"../element/src/sizeHelpers.ts\");\n/* harmony import */ var _typeChecks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./typeChecks */ \"../element/src/typeChecks.ts\");\n/* harmony import */ var _frame__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./frame */ \"../element/src/frame.ts\");\n/* harmony import */ var _linearElementEditor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./linearElementEditor */ \"../element/src/linearElementEditor.ts\");\n/* harmony import */ var _groups__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./groups */ \"../element/src/groups.ts\");\n\n\n\n\n\n\n\n\nconst shouldIgnoreElementFromSelection = element => element.locked || (0,_typeChecks__WEBPACK_IMPORTED_MODULE_3__.isBoundToContainer)(element);\n\nconst excludeElementsFromFrames = (selectedElements, framesInSelection) => {\n return selectedElements.filter(element => {\n if (element.frameId && framesInSelection.has(element.frameId)) {\n return false;\n }\n\n return true;\n });\n};\n/**\n * Frames and their containing elements are not to be selected at the same time.\n * Given an array of selected elements, if there are frames and their containing elements\n * we only keep the frames.\n * @param selectedElements\n */\n\n\nconst excludeElementsInFramesFromSelection = selectedElements => {\n const framesInSelection = new Set();\n selectedElements.forEach(element => {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(element)) {\n framesInSelection.add(element.id);\n }\n });\n return excludeElementsFromFrames(selectedElements, framesInSelection);\n};\nconst getElementsWithinSelection = (elements, selection, elementsMap, // TODO remove (this flag is effectively unused AFAIK)\nexcludeElementsInFrames = true, boxSelectionMode = \"contain\") => {\n const [selectionStartX, selectionStartY, selectionEndX, selectionEndY] = (0,_bounds__WEBPACK_IMPORTED_MODULE_1__.getElementAbsoluteCoords)(selection, elementsMap);\n const selectionX1 = Math.min(selectionStartX, selectionEndX);\n const selectionY1 = Math.min(selectionStartY, selectionEndY);\n const selectionX2 = Math.max(selectionStartX, selectionEndX);\n const selectionY2 = Math.max(selectionStartY, selectionEndY);\n const selectionBounds = [selectionX1, selectionY1, selectionX2, selectionY2];\n return (0,_bounds__WEBPACK_IMPORTED_MODULE_1__.elementsOverlappingBBox)({\n elements,\n bounds: selectionBounds,\n elementsMap,\n type: boxSelectionMode,\n shouldIgnoreElementFromSelection,\n excludeElementsInFrames\n });\n};\nconst getVisibleAndNonSelectedElements = (elements, selectedElements, appState, elementsMap) => {\n const selectedElementsSet = new Set(selectedElements.map(element => element.id));\n return elements.filter(element => {\n const isVisible = (0,_sizeHelpers__WEBPACK_IMPORTED_MODULE_2__.isElementInViewport)(element, appState.width, appState.height, appState, elementsMap);\n return !selectedElementsSet.has(element.id) && isVisible;\n });\n}; // FIXME move this into the editor instance to keep utility methods stateless\n\nconst isSomeElementSelected = function () {\n let lastElements = null;\n let lastSelectedElementIds = null;\n let isSelected = null;\n\n const ret = (elements, appState) => {\n if (isSelected != null && elements === lastElements && appState.selectedElementIds === lastSelectedElementIds) {\n return isSelected;\n }\n\n isSelected = elements.some(element => appState.selectedElementIds[element.id]);\n lastElements = elements;\n lastSelectedElementIds = appState.selectedElementIds;\n return isSelected;\n };\n\n ret.clearCache = () => {\n lastElements = null;\n lastSelectedElementIds = null;\n isSelected = null;\n };\n\n return ret;\n}();\nconst getSelectedElements = (elements, appState, opts) => {\n const addedElements = new Set();\n const selectedElements = [];\n\n for (const element of elements.values()) {\n if (appState.selectedElementIds[element.id]) {\n selectedElements.push(element);\n addedElements.add(element.id);\n continue;\n }\n\n if ((opts === null || opts === void 0 ? void 0 : opts.includeBoundTextElement) && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_3__.isBoundToContainer)(element) && appState.selectedElementIds[element === null || element === void 0 ? void 0 : element.containerId]) {\n selectedElements.push(element);\n addedElements.add(element.id);\n continue;\n }\n }\n\n if (opts === null || opts === void 0 ? void 0 : opts.includeElementsInFrames) {\n const elementsToInclude = [];\n selectedElements.forEach(element => {\n if ((0,_typeChecks__WEBPACK_IMPORTED_MODULE_3__.isFrameLikeElement)(element)) {\n (0,_frame__WEBPACK_IMPORTED_MODULE_4__.getFrameChildren)(elements, element.id).forEach(e => !addedElements.has(e.id) && elementsToInclude.push(e));\n }\n\n elementsToInclude.push(element);\n });\n return elementsToInclude;\n }\n\n return selectedElements;\n};\nconst getTargetElements = (elements, appState) => appState.editingTextElement ? [appState.editingTextElement] : appState.newElement ? [appState.newElement] : getSelectedElements(elements, appState, {\n includeBoundTextElement: true\n});\n/**\n * returns prevState's selectedElementids if no change from previous, so as to\n * retain reference identity for memoization\n */\n\nconst makeNextSelectedElementIds = (nextSelectedElementIds, prevState) => {\n if ((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.isShallowEqual)(prevState.selectedElementIds, nextSelectedElementIds)) {\n return prevState.selectedElementIds;\n }\n\n return nextSelectedElementIds;\n};\n\nconst _getLinearElementEditor = (targetElements, allElements) => {\n var _a, _b;\n\n const linears = targetElements.filter(_typeChecks__WEBPACK_IMPORTED_MODULE_3__.isLinearElement);\n\n if (linears.length === 1) {\n const linear = linears[0];\n const boundElements = (_b = (_a = linear.boundElements) === null || _a === void 0 ? void 0 : _a.map(def => def.id)) !== null && _b !== void 0 ? _b : [];\n const onlySingleLinearSelected = targetElements.every(el => el.id === linear.id || boundElements.includes(el.id));\n\n if (onlySingleLinearSelected) {\n return new _linearElementEditor__WEBPACK_IMPORTED_MODULE_5__.LinearElementEditor(linear, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(allElements));\n }\n }\n\n return null;\n};\n\nconst getSelectionStateForElements = (targetElements, allElements, appState) => {\n return Object.assign({\n selectedLinearElement: _getLinearElementEditor(targetElements, allElements)\n }, (0,_groups__WEBPACK_IMPORTED_MODULE_6__.selectGroupsForSelectedElements)({\n editingGroupId: appState.editingGroupId,\n selectedElementIds: excludeElementsInFramesFromSelection(targetElements).reduce((acc, element) => {\n if (!(0,_typeChecks__WEBPACK_IMPORTED_MODULE_3__.isBoundToContainer)(element)) {\n acc[element.id] = true;\n }\n\n return acc;\n }, {})\n }, allElements, appState, null));\n};\n/**\n * Returns editing or single-selected text element, if any.\n */\n\nconst getActiveTextElement = (selectedElements, appState) => {\n const activeTextElement = appState.editingTextElement || selectedElements.length === 1 && (0,_typeChecks__WEBPACK_IMPORTED_MODULE_3__.isTextElement)(selectedElements[0]) && selectedElements[0];\n return activeTextElement || null;\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../element/src/selection.ts?\n}");
|
|
1050
1050
|
|
|
1051
1051
|
/***/ },
|
|
1052
1052
|
|
|
@@ -1369,17 +1369,6 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1369
1369
|
|
|
1370
1370
|
/***/ },
|
|
1371
1371
|
|
|
1372
|
-
/***/ "../utils/src/bbox.ts"
|
|
1373
|
-
/*!****************************!*\
|
|
1374
|
-
!*** ../utils/src/bbox.ts ***!
|
|
1375
|
-
\****************************/
|
|
1376
|
-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1377
|
-
|
|
1378
|
-
"use strict";
|
|
1379
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ doBBoxesIntersect: () => (/* binding */ doBBoxesIntersect),\n/* harmony export */ doLineSegmentsIntersect: () => (/* binding */ doLineSegmentsIntersect),\n/* harmony export */ getBBox: () => (/* binding */ getBBox),\n/* harmony export */ isLineSegmentTouchingOrCrossingLine: () => (/* binding */ isLineSegmentTouchingOrCrossingLine),\n/* harmony export */ isPointOnLine: () => (/* binding */ isPointOnLine),\n/* harmony export */ isPointRightOfLine: () => (/* binding */ isPointRightOfLine)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n\nfunction getBBox(line) {\n return [Math.min(line[0][0], line[1][0]), Math.min(line[0][1], line[1][1]), Math.max(line[0][0], line[1][0]), Math.max(line[0][1], line[1][1])];\n}\nfunction doBBoxesIntersect(a, b) {\n return a[0] <= b[2] && a[2] >= b[0] && a[1] <= b[3] && a[3] >= b[1];\n}\nconst EPSILON = 0.000001;\nfunction isPointOnLine(l, p) {\n const p1 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.vectorFromPoint)(l[1], l[0]);\n const p2 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.vectorFromPoint)(p, l[0]);\n const r = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.vectorCross)(p1, p2);\n return Math.abs(r) < EPSILON;\n}\nfunction isPointRightOfLine(l, p) {\n const p1 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.vectorFromPoint)(l[1], l[0]);\n const p2 = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.vectorFromPoint)(p, l[0]);\n return (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.vectorCross)(p1, p2) < 0;\n}\nfunction isLineSegmentTouchingOrCrossingLine(a, b) {\n return isPointOnLine(a, b[0]) || isPointOnLine(a, b[1]) || (isPointRightOfLine(a, b[0]) ? !isPointRightOfLine(a, b[1]) : isPointRightOfLine(a, b[1]));\n} // https://martin-thoma.com/how-to-check-if-two-line-segments-intersect/\n\nfunction doLineSegmentsIntersect(a, b) {\n return doBBoxesIntersect(getBBox(a), getBBox(b)) && isLineSegmentTouchingOrCrossingLine(a, b) && isLineSegmentTouchingOrCrossingLine(b, a);\n}\n\n//# sourceURL=webpack://ExcalidrawLib/../utils/src/bbox.ts?\n}");
|
|
1380
|
-
|
|
1381
|
-
/***/ },
|
|
1382
|
-
|
|
1383
1372
|
/***/ "../utils/src/export.ts"
|
|
1384
1373
|
/*!******************************!*\
|
|
1385
1374
|
!*** ../utils/src/export.ts ***!
|
|
@@ -1398,7 +1387,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1398
1387
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1399
1388
|
|
|
1400
1389
|
"use strict";
|
|
1401
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MIME_TYPES: () => (/* reexport safe */ _export__WEBPACK_IMPORTED_MODULE_0__.MIME_TYPES),\n/* harmony export */
|
|
1390
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MIME_TYPES: () => (/* reexport safe */ _export__WEBPACK_IMPORTED_MODULE_0__.MIME_TYPES),\n/* harmony export */ elementsOverlappingBBox: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.elementsOverlappingBBox),\n/* harmony export */ exportToBlob: () => (/* reexport safe */ _export__WEBPACK_IMPORTED_MODULE_0__.exportToBlob),\n/* harmony export */ exportToCanvas: () => (/* reexport safe */ _export__WEBPACK_IMPORTED_MODULE_0__.exportToCanvas),\n/* harmony export */ exportToClipboard: () => (/* reexport safe */ _export__WEBPACK_IMPORTED_MODULE_0__.exportToClipboard),\n/* harmony export */ exportToSvg: () => (/* reexport safe */ _export__WEBPACK_IMPORTED_MODULE_0__.exportToSvg),\n/* harmony export */ getCommonBounds: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getCommonBounds)\n/* harmony export */ });\n/* harmony import */ var _export__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./export */ \"../utils/src/export.ts\");\n/* harmony import */ var _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n\n\n\n\n//# sourceURL=webpack://ExcalidrawLib/../utils/src/index.ts?\n}");
|
|
1402
1391
|
|
|
1403
1392
|
/***/ },
|
|
1404
1393
|
|
|
@@ -1413,17 +1402,6 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1413
1402
|
|
|
1414
1403
|
/***/ },
|
|
1415
1404
|
|
|
1416
|
-
/***/ "../utils/src/withinBounds.ts"
|
|
1417
|
-
/*!************************************!*\
|
|
1418
|
-
!*** ../utils/src/withinBounds.ts ***!
|
|
1419
|
-
\************************************/
|
|
1420
|
-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1421
|
-
|
|
1422
|
-
"use strict";
|
|
1423
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ elementPartiallyOverlapsWithOrContainsBBox: () => (/* binding */ elementPartiallyOverlapsWithOrContainsBBox),\n/* harmony export */ elementsOverlappingBBox: () => (/* binding */ elementsOverlappingBBox),\n/* harmony export */ isElementInsideBBox: () => (/* binding */ isElementInsideBBox)\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_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n\n\n\n\n/** @returns vertices relative to element's top-left [0,0] position */\n\nconst getNonLinearElementRelativePoints = element => {\n if (element.type === \"diamond\") {\n return [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(element.width / 2, 0), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(element.width, element.height / 2), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(element.width / 2, element.height), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(0, element.height / 2)];\n }\n\n return [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(0, 0), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(0 + element.width, 0), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(0 + element.width, element.height), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(0, element.height)];\n};\n/** @returns vertices relative to element's top-left [0,0] position */\n\n\nconst getElementRelativePoints = element => {\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isLinearElement)(element) || (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isFreeDrawElement)(element)) {\n return element.points;\n }\n\n return getNonLinearElementRelativePoints(element);\n};\n\nconst getMinMaxPoints = points => {\n const ret = points.reduce((limits, [x, y]) => {\n limits.minY = Math.min(limits.minY, y);\n limits.minX = Math.min(limits.minX, x);\n limits.maxX = Math.max(limits.maxX, x);\n limits.maxY = Math.max(limits.maxY, y);\n return limits;\n }, {\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity,\n cx: 0,\n cy: 0\n });\n ret.cx = (ret.maxX + ret.minX) / 2;\n ret.cy = (ret.maxY + ret.minY) / 2;\n return ret;\n};\n\nconst getRotatedBBox = element => {\n const points = getElementRelativePoints(element);\n const {\n cx,\n cy\n } = getMinMaxPoints(points);\n const centerPoint = (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointFrom)(cx, cy);\n const rotatedPoints = points.map(p => (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.pointRotateRads)(p, centerPoint, element.angle));\n const {\n minX,\n minY,\n maxX,\n maxY\n } = getMinMaxPoints(rotatedPoints);\n return [minX + element.x, minY + element.y, maxX + element.x, maxY + element.y];\n};\n\nconst isElementInsideBBox = (element, bbox, eitherDirection = false) => {\n const elementBBox = getRotatedBBox(element);\n const elementInsideBbox = bbox[0] <= elementBBox[0] && bbox[2] >= elementBBox[2] && bbox[1] <= elementBBox[1] && bbox[3] >= elementBBox[3];\n\n if (!eitherDirection) {\n return elementInsideBbox;\n }\n\n if (elementInsideBbox) {\n return true;\n }\n\n return elementBBox[0] <= bbox[0] && elementBBox[2] >= bbox[2] && elementBBox[1] <= bbox[1] && elementBBox[3] >= bbox[3];\n};\nconst elementPartiallyOverlapsWithOrContainsBBox = (element, bbox) => {\n const elementBBox = getRotatedBBox(element);\n return ((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.rangeIncludesValue)(elementBBox[0], (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.rangeInclusive)(bbox[0], bbox[2])) || (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.rangeIncludesValue)(bbox[0], (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.rangeInclusive)(elementBBox[0], elementBBox[2]))) && ((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.rangeIncludesValue)(elementBBox[1], (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.rangeInclusive)(bbox[1], bbox[3])) || (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.rangeIncludesValue)(bbox[1], (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_2__.rangeInclusive)(elementBBox[1], elementBBox[3])));\n};\nconst elementsOverlappingBBox = ({\n elements,\n bounds,\n type,\n errorMargin = 0\n}) => {\n var _a;\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isExcalidrawElement)(bounds)) {\n bounds = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getElementBounds)(bounds, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.arrayToMap)(elements));\n }\n\n const adjustedBBox = [bounds[0] - errorMargin, bounds[1] - errorMargin, bounds[2] + errorMargin, bounds[3] + errorMargin];\n const includedElementSet = new Set();\n\n for (const element of elements) {\n if (includedElementSet.has(element.id)) {\n continue;\n }\n\n const isOverlaping = type === \"overlap\" ? elementPartiallyOverlapsWithOrContainsBBox(element, adjustedBBox) : type === \"inside\" ? isElementInsideBBox(element, adjustedBBox) : isElementInsideBBox(element, adjustedBBox, true);\n\n if (isOverlaping) {\n includedElementSet.add(element.id);\n\n if (element.boundElements) {\n for (const boundElement of element.boundElements) {\n includedElementSet.add(boundElement.id);\n }\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isTextElement)(element) && element.containerId) {\n includedElementSet.add(element.containerId);\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isArrowElement)(element)) {\n if (element.startBinding) {\n includedElementSet.add(element.startBinding.elementId);\n }\n\n if (element.endBinding) {\n includedElementSet.add((_a = element.endBinding) === null || _a === void 0 ? void 0 : _a.elementId);\n }\n }\n }\n }\n\n return elements.filter(element => includedElementSet.has(element.id));\n};\n\n//# sourceURL=webpack://ExcalidrawLib/../utils/src/withinBounds.ts?\n}");
|
|
1424
|
-
|
|
1425
|
-
/***/ },
|
|
1426
|
-
|
|
1427
1405
|
/***/ "./actions/actionAddToLibrary.ts"
|
|
1428
1406
|
/*!***************************************!*\
|
|
1429
1407
|
!*** ./actions/actionAddToLibrary.ts ***!
|
|
@@ -1893,7 +1871,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1893
1871
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1894
1872
|
|
|
1895
1873
|
"use strict";
|
|
1896
|
-
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:3016\",\"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\":\"3001\",\"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.
|
|
1874
|
+
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:3016\",\"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\":\"3001\",\"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.98\",\"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?\n}");
|
|
1897
1875
|
|
|
1898
1876
|
/***/ },
|
|
1899
1877
|
|
|
@@ -4258,7 +4236,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
4258
4236
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4259
4237
|
|
|
4260
4238
|
"use strict";
|
|
4261
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AllowedExcalidrawActiveTools: () => (/* binding */ AllowedExcalidrawActiveTools),\n/* harmony export */ bumpElementVersions: () => (/* binding */ bumpElementVersions),\n/* harmony export */ restoreAppState: () => (/* binding */ restoreAppState),\n/* harmony export */ restoreElement: () => (/* binding */ restoreElement),\n/* harmony export */ restoreElements: () => (/* binding */ restoreElements),\n/* harmony export */ restoreLibraryItems: () => (/* binding */ restoreLibraryItems)\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 _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _appState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../appState */ \"./appState.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../scene */ \"./scene/index.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst MAX_ARROW_PX = 75000;\n\nconst restoreLinearElementPoints = (points, width, height) => {\n const restoredPoints = Array.isArray(points) ? points.reduce((acc, point) => {\n if ((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isValidPoint)(point)) {\n acc.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(point[0], point[1]));\n }\n\n return acc;\n }, []) : [];\n return restoredPoints.length < 2 ? [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, 0), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(width) ? width : 0, (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(height) ? height : 0)] : restoredPoints;\n};\n\nconst restoreFreedrawPoints = (points, pressures) => {\n if (!Array.isArray(points)) {\n return {\n points: [],\n pressures: []\n };\n }\n\n const pressureValues = Array.isArray(pressures) ? pressures : [];\n const restoredPoints = [];\n const restoredPressures = [];\n points.forEach((point, index) => {\n if ((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isValidPoint)(point)) {\n restoredPoints.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(point[0], point[1]));\n\n if (index in pressureValues) {\n const pressure = pressureValues[index];\n restoredPressures.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(pressure) ? pressure : 0.5);\n }\n }\n });\n return {\n points: restoredPoints,\n pressures: restoredPressures\n };\n};\n\nconst AllowedExcalidrawActiveTools = {\n selection: true,\n lasso: true,\n text: true,\n rectangle: true,\n diamond: true,\n ellipse: true,\n line: true,\n image: true,\n arrow: true,\n freedraw: true,\n eraser: false,\n custom: true,\n frame: true,\n embeddable: true,\n hand: true,\n mermaid: true,\n laser: false,\n magicframe: false\n};\n\nconst getFontFamilyByName = fontFamilyName => {\n if (Object.keys(_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.FONT_FAMILY).includes(fontFamilyName)) {\n return _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.FONT_FAMILY[fontFamilyName];\n }\n\n return _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_FONT_FAMILY;\n};\n\nconst repairBinding = (element, binding, targetElementsMap,\n/** used for context (arrow bindings) */\nexistingElementsMap, startOrEnd) => {\n var _a, _b;\n\n try {\n if (!binding) {\n return null;\n } // ---------------------------------------------------------------------------\n // elbow arrows\n // ---------------------------------------------------------------------------\n\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(element)) {\n const fixedPointBinding = Object.assign(Object.assign({}, binding), {\n fixedPoint: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeFixedPoint)(binding.fixedPoint),\n mode: binding.mode || \"orbit\"\n });\n return fixedPointBinding;\n } // ---------------------------------------------------------------------------\n // simple arrows\n // ---------------------------------------------------------------------------\n // binding schema v2\n // ---------------------------------------------------------------------------\n\n\n if (binding.mode) {\n // if latest binding schema, don't check if binding.elementId exists\n // (it's done in a separate pass)\n if (binding.elementId) {\n return {\n elementId: binding.elementId,\n mode: binding.mode,\n fixedPoint: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeFixedPoint)(binding.fixedPoint)\n };\n }\n\n return null;\n } // binding schema v1 (legacy) -> attempt to migrate to v2\n // ---------------------------------------------------------------------------\n\n\n const targetBoundElement = targetElementsMap.get(binding.elementId);\n const boundElement = targetBoundElement || (existingElementsMap === null || existingElementsMap === void 0 ? void 0 : existingElementsMap.get(binding.elementId));\n const elementsMap = targetBoundElement ? targetElementsMap : existingElementsMap; // migrating legacy focus point bindings\n\n if (boundElement && elementsMap) {\n const p = _excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.LinearElementEditor.getPointAtIndexGlobalCoordinates(element, startOrEnd === \"start\" ? 0 : element.points.length - 1, elementsMap);\n const mode = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isPointInElement)(p, boundElement, elementsMap) ? \"inside\" : \"orbit\";\n const safeElement = Object.assign(Object.assign({}, element), {\n startBinding: ((_a = element.startBinding) === null || _a === void 0 ? void 0 : _a.elementId) ? Object.assign(Object.assign({}, element.startBinding), {\n mode,\n fixedPoint: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeFixedPoint)(element.startBinding.fixedPoint)\n }) : null,\n endBinding: ((_b = element.endBinding) === null || _b === void 0 ? void 0 : _b.elementId) ? Object.assign(Object.assign({}, element.endBinding), {\n mode,\n fixedPoint: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeFixedPoint)(element.endBinding.fixedPoint)\n }) : null\n });\n const focusPoint = mode === \"inside\" ? p : (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.projectFixedPointOntoDiagonal)(safeElement, p, boundElement, startOrEnd, elementsMap, {\n value: 1\n }) || p;\n const {\n fixedPoint\n } = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.calculateFixedPointForNonElbowArrowBinding)(safeElement, boundElement, startOrEnd, elementsMap, focusPoint);\n return {\n mode,\n elementId: binding.elementId,\n fixedPoint\n };\n }\n\n console.error(`Could not repair binding for element \"${boundElement === null || boundElement === void 0 ? void 0 : boundElement.id}\" out of (${elementsMap === null || elementsMap === void 0 ? void 0 : elementsMap.size}) elements`);\n } catch (error) {\n console.error(\"Error repairing binding:\", error);\n }\n\n return null;\n};\n\nconst restoreElementWithProperties = (element, extra) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;\n\n const base = {\n type: extra.type || element.type,\n // all elements must have version > 0 so getSceneVersion() will pick up\n // newly added elements\n version: element.version || 1,\n versionNonce: (_a = element.versionNonce) !== null && _a !== void 0 ? _a : 0,\n index: (_b = element.index) !== null && _b !== void 0 ? _b : null,\n isDeleted: (_c = element.isDeleted) !== null && _c !== void 0 ? _c : false,\n id: element.id || (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.randomId)(),\n fillStyle: element.fillStyle || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.fillStyle,\n strokeWidth: element.strokeWidth || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.strokeWidth,\n strokeStyle: (_d = element.strokeStyle) !== null && _d !== void 0 ? _d : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.strokeStyle,\n roughness: (_e = element.roughness) !== null && _e !== void 0 ? _e : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.roughness,\n opacity: element.opacity == null ? _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.opacity : element.opacity,\n angle: element.angle || 0,\n x: (_g = (_f = extra.x) !== null && _f !== void 0 ? _f : element.x) !== null && _g !== void 0 ? _g : 0,\n y: (_j = (_h = extra.y) !== null && _h !== void 0 ? _h : element.y) !== null && _j !== void 0 ? _j : 0,\n strokeColor: element.strokeColor || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.strokeColor,\n backgroundColor: element.backgroundColor || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.backgroundColor,\n width: element.width || 0,\n height: element.height || 0,\n seed: (_k = element.seed) !== null && _k !== void 0 ? _k : 1,\n groupIds: (_l = element.groupIds) !== null && _l !== void 0 ? _l : [],\n frameId: (_m = element.frameId) !== null && _m !== void 0 ? _m : null,\n roundness: element.roundness ? element.roundness : element.strokeSharpness === \"round\" && element.type !== \"image\" ? {\n // for old elements that would now use adaptive radius algo,\n // use legacy algo instead\n type: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isUsingAdaptiveRadius)(element.type) ? _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.ROUNDNESS.LEGACY : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.ROUNDNESS.PROPORTIONAL_RADIUS\n } : null,\n boundElements: element.boundElementIds ? element.boundElementIds.map(id => ({\n type: \"arrow\",\n id\n })) : (_o = element.boundElements) !== null && _o !== void 0 ? _o : [],\n updated: (_p = element.updated) !== null && _p !== void 0 ? _p : (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getUpdatedTimestamp)(),\n link: element.link ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.normalizeLink)(element.link) : null,\n hasTextLink: (_q = element.hasTextLink) !== null && _q !== void 0 ? _q : false,\n //zsviczian\n locked: (_r = element.locked) !== null && _r !== void 0 ? _r : false\n };\n\n if (\"customData\" in element || \"customData\" in extra) {\n base.customData = \"customData\" in extra ? extra.customData : element.customData;\n }\n\n const ret = Object.assign(Object.assign(Object.assign(Object.assign({}, element), base), (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.getNormalizedDimensions)(base)), extra); // strip legacy props (migrated in previous steps)\n\n delete ret.strokeSharpness;\n delete ret.boundElementIds;\n return ret;\n};\n\nconst restoreElement = (\n/** element to be restored */\nelement,\n/** all elements to be restored */\ntargetElementsMap,\n/** used for additional context */\nexistingElementsMap, opts) => {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n\n element = Object.assign({}, element);\n\n switch (element.type) {\n case \"text\":\n // temp fix: cleanup legacy obsidian-excalidraw attribute else it'll\n // conflict when porting between the apps\n //delete (element as any).rawText; //zsviczian\n let fontSize = element.fontSize;\n let fontFamily = element.fontFamily;\n\n if (\"font\" in element) {\n const [fontPx, _fontFamily] = element.font.split(\" \");\n fontSize = parseFloat(fontPx);\n fontFamily = getFontFamilyByName(_fontFamily);\n }\n\n const text = typeof element.text === \"string\" && element.text || \"\"; // line-height might not be specified either when creating elements\n // programmatically, or when importing old diagrams.\n // For the latter we want to detect the original line height which\n // will likely differ from our per-font fixed line height we now use,\n // to maintain backward compatibility.\n\n const lineHeight = element.lineHeight || (element.height ? // detect line-height from current element height and font-size\n (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.detectLineHeight)(element) : // no element height likely means programmatic use, so default\n // to a fixed line height\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getLineHeight)(element.fontFamily));\n element = restoreElementWithProperties(element, {\n fontSize,\n fontFamily,\n text,\n rawText: (_a = element.rawText) !== null && _a !== void 0 ? _a : \"\",\n //zsviczian\n textAlign: element.textAlign || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_TEXT_ALIGN,\n verticalAlign: element.verticalAlign || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_VERTICAL_ALIGN,\n containerId: (_b = element.containerId) !== null && _b !== void 0 ? _b : null,\n originalText: element.originalText || text,\n autoResize: (_c = element.autoResize) !== null && _c !== void 0 ? _c : true,\n lineHeight\n }); // if empty text, mark as deleted. We keep in array\n // for data integrity purposes (collab etc.)\n\n if ((opts === null || opts === void 0 ? void 0 : opts.deleteInvisibleElements) && !text && !element.isDeleted) {\n // TODO: we should not do this since it breaks sync / versioning when we exchange / apply just deltas and restore the elements (deletion isn't recorded)\n element = Object.assign(Object.assign({}, element), {\n originalText: text,\n isDeleted: true\n });\n element = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.bumpVersion)(element);\n }\n\n return element;\n\n case \"freedraw\":\n {\n const {\n points,\n pressures\n } = restoreFreedrawPoints(element.points, element.pressures);\n return restoreElementWithProperties(element, {\n points,\n simulatePressure: element.simulatePressure,\n pressures\n });\n }\n\n case \"image\":\n return restoreElementWithProperties(element, {\n status: element.status || \"pending\",\n fileId: element.fileId,\n scale: element.scale || [1, 1],\n crop: (_d = element.crop) !== null && _d !== void 0 ? _d : null\n });\n\n case \"line\": // @ts-ignore LEGACY type\n // eslint-disable-next-line no-fallthrough\n\n case \"draw\":\n const startArrowhead = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeArrowhead)(element.startArrowhead);\n const endArrowhead = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeArrowhead)(element.endArrowhead);\n let x = element.x;\n let y = element.y;\n let points = restoreLinearElementPoints(element.points, element.width, element.height);\n\n if (points[0][0] !== 0 || points[0][1] !== 0) {\n ({\n points,\n x,\n y\n } = _excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.LinearElementEditor.getNormalizeElementPointsAndCoords(Object.assign(Object.assign({}, element), {\n points,\n x: x !== null && x !== void 0 ? x : 0,\n y: y !== null && y !== void 0 ? y : 0\n })));\n }\n\n return restoreElementWithProperties(element, Object.assign(Object.assign({\n type: \"line\",\n startBinding: null,\n endBinding: null,\n startArrowhead,\n endArrowhead,\n points,\n x,\n y\n }, (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isLineElement)(element) ? {\n polygon: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isValidPolygon)(points) ? (_e = element.polygon) !== null && _e !== void 0 ? _e : false : false\n } : {}), (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getSizeFromPoints)(points)));\n\n case \"arrow\":\n {\n const startArrowhead = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeArrowhead)(element.startArrowhead);\n const endArrowhead = element.endArrowhead === undefined ? \"arrow\" : (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeArrowhead)(element.endArrowhead);\n const x = element.x;\n const y = element.y;\n const points = restoreLinearElementPoints(element.points, element.width, element.height);\n const elementWithRestoredPoints = Object.assign(Object.assign({}, element), {\n points,\n x: x !== null && x !== void 0 ? x : 0,\n y: y !== null && y !== void 0 ? y : 0\n });\n const base = Object.assign({\n type: element.type,\n startBinding: repairBinding(elementWithRestoredPoints, element.startBinding, targetElementsMap, existingElementsMap, \"start\"),\n endBinding: repairBinding(elementWithRestoredPoints, element.endBinding, targetElementsMap, existingElementsMap, \"end\"),\n startArrowhead,\n endArrowhead,\n points,\n x: x !== null && x !== void 0 ? x : 0,\n y: y !== null && y !== void 0 ? y : 0,\n elbowed: element.elbowed\n }, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getSizeFromPoints)(points)); // TODO: Separate arrow from linear element\n\n const restoredElement = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(element) ? restoreElementWithProperties(element, Object.assign(Object.assign({}, base), {\n elbowed: true,\n fixedSegments: ((_f = element.fixedSegments) === null || _f === void 0 ? void 0 : _f.length) && base.points.length >= 4 ? element.fixedSegments : null,\n startIsSpecial: element.startIsSpecial,\n endIsSpecial: element.endIsSpecial\n })) : restoreElementWithProperties(element, base);\n const normalizedRestoredElement = Object.assign(Object.assign({}, restoredElement), _excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.LinearElementEditor.getNormalizeElementPointsAndCoords(restoredElement)); // Last resort fix for extremely large arrows\n\n if (normalizedRestoredElement.width > MAX_ARROW_PX || normalizedRestoredElement.height > MAX_ARROW_PX) {\n console.error(`Removing extremely large arrow ${normalizedRestoredElement.id} (type: ${(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(normalizedRestoredElement) ? \"elbow\" : \"simple\"}, width: ${normalizedRestoredElement.width}, height: ${normalizedRestoredElement.height}, x: ${normalizedRestoredElement.x}, y: ${normalizedRestoredElement.y})`);\n return Object.assign(Object.assign({}, normalizedRestoredElement), {\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n points: [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, 0), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(100, 100)],\n isDeleted: true\n });\n }\n\n return normalizedRestoredElement;\n }\n // generic elements\n\n case \"ellipse\":\n case \"rectangle\":\n case \"diamond\":\n return restoreElementWithProperties(element, {});\n\n case \"iframe\": //zsviczian\n\n case \"embeddable\":\n return restoreElementWithProperties(element, {\n scale: (_g = element.scale) !== null && _g !== void 0 ? _g : [1, 1] //zsviczian\n\n });\n\n case \"magicframe\":\n case \"frame\":\n return restoreElementWithProperties(element, {\n name: (_h = element.name) !== null && _h !== void 0 ? _h : null\n });\n // Don't use default case so as to catch a missing an element type case.\n // We also don't want to throw, but instead return void so we filter\n // out these unsupported elements from the restored array.\n }\n\n return null;\n};\n/**\n * Repairs container element's boundElements array by removing duplicates and\n * fixing containerId of bound elements if not present. Also removes any\n * bound elements that do not exist in the elements array.\n *\n * NOTE mutates elements.\n */\n\nconst repairContainerElement = (container, elementsMap) => {\n if (container.boundElements) {\n // copy because we're not cloning on restore, and we don't want to mutate upstream\n const boundElements = container.boundElements.slice(); // dedupe bindings & fix boundElement.containerId if not set already\n\n const boundIds = new Set();\n container.boundElements = boundElements.reduce((acc, binding) => {\n const boundElement = elementsMap.get(binding.id);\n\n if (boundElement && !boundIds.has(binding.id)) {\n boundIds.add(binding.id);\n\n if (boundElement.isDeleted) {\n return acc;\n }\n\n acc.push(binding);\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isTextElement)(boundElement) && // being slightly conservative here, preserving existing containerId\n // if defined, lest boundElements is stale\n !boundElement.containerId) {\n boundElement.containerId = container.id;\n }\n }\n\n return acc;\n }, []);\n }\n};\n/**\n * Repairs target bound element's container's boundElements array,\n * or removes contaienrId if container does not exist.\n *\n * NOTE mutates elements.\n */\n\n\nconst repairBoundElement = (boundElement, elementsMap) => {\n var _a;\n\n const container = boundElement.containerId ? elementsMap.get(boundElement.containerId) : null;\n boundElement.angle = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isArrowElement)(container) ? 0 : (_a = container === null || container === void 0 ? void 0 : container.angle) !== null && _a !== void 0 ? _a : 0;\n\n if (!container) {\n boundElement.containerId = null;\n return;\n }\n\n if (boundElement.isDeleted) {\n return;\n }\n\n if (container.boundElements && !container.boundElements.find(binding => binding.id === boundElement.id)) {\n // copy because we're not cloning on restore, and we don't want to mutate upstream\n const boundElements = (container.boundElements || (container.boundElements = [])).slice();\n boundElements.push({\n type: \"text\",\n id: boundElement.id\n });\n container.boundElements = boundElements;\n }\n};\n/**\n * Remove an element's frameId if its containing frame is non-existent\n *\n * NOTE mutates elements.\n */\n\n\nconst repairFrameMembership = (element, elementsMap) => {\n if (element.frameId) {\n const containingFrame = elementsMap.get(element.frameId);\n\n if (!containingFrame) {\n element.frameId = null;\n }\n }\n}; // Removes groupIds that only occur on a single non-deleted element.\n// zsviczian\n\n\nconst pruneOrphanGroupIds = elements => {\n var _a, _b;\n\n const counts = new Map();\n\n for (const element of elements) {\n if (element.isDeleted) {\n continue;\n }\n\n for (const groupId of (_a = element.groupIds) !== null && _a !== void 0 ? _a : []) {\n counts.set(groupId, ((_b = counts.get(groupId)) !== null && _b !== void 0 ? _b : 0) + 1);\n }\n }\n\n if (!counts.size) {\n return elements;\n }\n\n return elements.map(element => {\n var _a;\n\n if (!((_a = element.groupIds) === null || _a === void 0 ? void 0 : _a.length)) {\n return element;\n }\n\n const filteredGroupIds = element.groupIds.filter(groupId => {\n var _a;\n\n return ((_a = counts.get(groupId)) !== null && _a !== void 0 ? _a : 0) > 1;\n });\n\n if (filteredGroupIds.length === element.groupIds.length) {\n return element;\n }\n\n return Object.assign(Object.assign({}, element), {\n groupIds: filteredGroupIds\n });\n });\n};\n\nconst restoreElements = (targetElements,\n/** used for additional context (e.g. repairing arrow bindings) */\nexistingElements, opts) => {\n // used to detect duplicate top-level element ids\n const existingIds = new Set();\n const targetElementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(targetElements || []);\n const existingElementsMap = existingElements ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(existingElements) : null;\n let restoredElements = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.syncInvalidIndices)( //zsviczian let not const\n (targetElements || []).reduce((elements, element) => {\n // filtering out selection, which is legacy, no longer kept in elements,\n // and causing issues if retained\n if (element.type === \"selection\") {\n return elements;\n }\n\n let migratedElement;\n\n try {\n migratedElement = restoreElement(element, targetElementsMap, existingElementsMap, {\n deleteInvisibleElements: opts === null || opts === void 0 ? void 0 : opts.deleteInvisibleElements\n });\n } catch (error) {\n console.error(\"Error restoring element:\", error);\n migratedElement = null;\n }\n\n if (migratedElement) {\n const localElement = existingElementsMap === null || existingElementsMap === void 0 ? void 0 : existingElementsMap.get(element.id);\n const shouldMarkAsDeleted = (opts === null || opts === void 0 ? void 0 : opts.deleteInvisibleElements) && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isInvisiblySmallElement)(element);\n\n if (shouldMarkAsDeleted) {\n migratedElement = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.bumpVersion)(migratedElement, localElement === null || localElement === void 0 ? void 0 : localElement.version);\n }\n\n if (shouldMarkAsDeleted) {\n migratedElement = Object.assign(Object.assign({}, migratedElement), {\n isDeleted: true\n });\n }\n\n if (existingIds.has(migratedElement.id)) {\n migratedElement = Object.assign(Object.assign({}, migratedElement), {\n id: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.randomId)()\n });\n }\n\n existingIds.add(migratedElement.id);\n elements.push(migratedElement);\n }\n\n return elements;\n }, []));\n restoredElements = pruneOrphanGroupIds(restoredElements); //zsviczian\n\n if (!(opts === null || opts === void 0 ? void 0 : opts.repairBindings)) {\n return restoredElements;\n } // repair binding. Mutates elements.\n\n\n const restoredElementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(restoredElements);\n\n for (const element of restoredElements) {\n if (element.frameId) {\n repairFrameMembership(element, restoredElementsMap);\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isTextElement)(element) && element.containerId) {\n repairBoundElement(element, restoredElementsMap);\n } else if (element.boundElements) {\n repairContainerElement(element, restoredElementsMap);\n }\n\n if (opts.refreshDimensions && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isTextElement)(element)) {\n Object.assign(element, (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.refreshTextDimensions)(element, (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.getContainerElement)(element, restoredElementsMap), restoredElementsMap));\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isLinearElement)(element)) {\n if (element.startBinding && (!restoredElementsMap.has(element.startBinding.elementId) || !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isArrowElement)(element))) {\n element.startBinding = null;\n }\n\n if (element.endBinding && (!restoredElementsMap.has(element.endBinding.elementId) || !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isArrowElement)(element))) {\n element.endBinding = null;\n }\n }\n } // NOTE (mtolmacs): Temporary fix for invalid/self-bound elbow arrows\n // Need to iterate again so we have attached text nodes in elementsMap\n\n\n return restoredElements.map(element => {\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(element) && !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isArrowBoundToElement)(element) && !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.validateElbowPoints)(element.points)) {\n return Object.assign(Object.assign(Object.assign({}, element), (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.updateElbowArrowPoints)(element, restoredElementsMap, {\n points: [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, 0), element.points[element.points.length - 1]]\n })), {\n index: element.index\n });\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(element) && element.startBinding && element.endBinding && element.startBinding.elementId === element.endBinding.elementId && element.points.length > 1 && element.points.some(([rx, ry]) => Math.abs(rx) > 1e6 || Math.abs(ry) > 1e6)) {\n console.error(\"Fixing self-bound elbow arrow\", element.id);\n const boundElement = restoredElementsMap.get(element.startBinding.elementId);\n\n if (!boundElement) {\n console.error(\"Bound element not found\", element.startBinding.elementId);\n return element;\n }\n\n return Object.assign(Object.assign({}, element), {\n x: boundElement.x + boundElement.width / 2,\n y: boundElement.y - 5,\n width: boundElement.width,\n height: boundElement.height,\n points: [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, 0), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, -10), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(boundElement.width / 2 + 5, -10), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(boundElement.width / 2 + 5, boundElement.height / 2 + 5)]\n });\n }\n\n return element;\n });\n};\n/**\n * When replacing elements that may exist locally, this bumps their versions\n * to the local version + 1. Mainly for later reconciliation to work properly.\n *\n * See https://github.com/excalidraw/excalidraw/issues/3795\n *\n * Generally use this on editor boundaries (importing from file etc.), though\n * it does not apply universally (e.g. we don't want to do this for collab\n * updates).\n */\n\nconst bumpElementVersions = (targetElements, localElements) => {\n const localElementsMap = localElements ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(localElements) : null;\n return targetElements.map(element => {\n const localElement = localElementsMap === null || localElementsMap === void 0 ? void 0 : localElementsMap.get(element.id);\n\n if (localElement && (localElement.version > element.version || // same versions but different versionNonce means different edits\n // (this often means the element was bumped during restore e.g. due\n // to re-indexing, and the original element was modified elsewhere\n // and supplied as localElements)\n localElement.version === element.version && localElement.versionNonce !== element.versionNonce)) {\n return (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.bumpVersion)(element, localElement.version);\n }\n\n return element;\n });\n};\n\nconst coalesceAppStateValue = (key, appState, defaultAppState) => {\n const value = appState[key]; // NOTE the value! assertion is needed in TS 4.5.5 (fixed in newer versions)\n\n return value !== undefined ? value : defaultAppState[key];\n};\n\nconst LegacyAppStateMigrations = {\n isSidebarDocked: (appState, defaultAppState) => {\n var _a;\n\n return [\"defaultSidebarDockedPreference\", (_a = appState.isSidebarDocked) !== null && _a !== void 0 ? _a : coalesceAppStateValue(\"defaultSidebarDockedPreference\", appState, defaultAppState)];\n }\n};\nconst restoreAppState = (appState, localAppState) => {\n var _a, _b, _c, _d, _e, _f;\n\n appState = appState || {};\n const defaultAppState = (0,_appState__WEBPACK_IMPORTED_MODULE_3__.getDefaultAppState)();\n const nextAppState = {}; // first, migrate all legacy AppState properties to new ones. We do it\n // in one go before migrate the rest of the properties in case the new ones\n // depend on checking any other key (i.e. they are coupled)\n\n for (const legacyKey of Object.keys(LegacyAppStateMigrations)) {\n if (legacyKey in appState) {\n const [nextKey, nextValue] = LegacyAppStateMigrations[legacyKey](appState, defaultAppState);\n nextAppState[nextKey] = nextValue;\n }\n }\n\n for (const [key, defaultValue] of Object.entries(defaultAppState)) {\n // if AppState contains a legacy key, prefer that one and migrate its\n // value to the new one\n const suppliedValue = appState[key];\n const localValue = localAppState ? localAppState[key] : undefined;\n nextAppState[key] = suppliedValue !== undefined ? suppliedValue : localValue !== undefined ? localValue : defaultValue;\n }\n\n const boxSelectionMode = (_a = appState.boxSelectionMode) !== null && _a !== void 0 ? _a : localAppState === null || localAppState === void 0 ? void 0 : localAppState.boxSelectionMode;\n\n if (boxSelectionMode !== undefined) {\n nextAppState.boxSelectionMode = boxSelectionMode;\n }\n\n return Object.assign(Object.assign({}, nextAppState), {\n cursorButton: (localAppState === null || localAppState === void 0 ? void 0 : localAppState.cursorButton) || \"up\",\n // reset on fresh restore so as to hide the UI button if penMode not active\n penDetected: (_b = localAppState === null || localAppState === void 0 ? void 0 : localAppState.penDetected) !== null && _b !== void 0 ? _b : appState.penMode ? (_c = appState.penDetected) !== null && _c !== void 0 ? _c : false : false,\n activeTool: Object.assign(Object.assign({}, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.updateActiveTool)(defaultAppState, nextAppState.activeTool.type && AllowedExcalidrawActiveTools[nextAppState.activeTool.type] ? nextAppState.activeTool : {\n type: \"selection\"\n })), {\n lastActiveTool: null,\n locked: (_d = nextAppState.activeTool.locked) !== null && _d !== void 0 ? _d : false\n }),\n // Migrates from previous version where appState.zoom was a number\n zoom: {\n value: (0,_scene__WEBPACK_IMPORTED_MODULE_4__.getNormalizedZoom)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(appState.zoom) ? appState.zoom : (_f = (_e = appState.zoom) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : defaultAppState.zoom.value)\n },\n openSidebar: // string (legacy)\n typeof appState.openSidebar === \"string\" ? {\n name: _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SIDEBAR.name\n } : nextAppState.openSidebar,\n gridSize: (0,_scene__WEBPACK_IMPORTED_MODULE_4__.getNormalizedGridSize)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(appState.gridSize) ? appState.gridSize : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_GRID_SIZE),\n gridStep: (0,_scene__WEBPACK_IMPORTED_MODULE_4__.getNormalizedGridStep)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(appState.gridStep) ? appState.gridStep : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_GRID_STEP),\n editingFrame: null\n });\n};\n\nconst restoreLibraryItem = libraryItem => {\n const elements = restoreElements((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.getNonDeletedElements)(libraryItem.elements), null);\n return elements.length ? Object.assign(Object.assign({}, libraryItem), {\n elements\n }) : null;\n};\n\nconst restoreLibraryItems = (libraryItems = [], defaultStatus) => {\n const restoredItems = [];\n\n for (const item of libraryItems) {\n // migrate older libraries\n if (Array.isArray(item)) {\n const restoredItem = restoreLibraryItem({\n status: defaultStatus,\n elements: item,\n id: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.randomId)(),\n created: Date.now()\n });\n\n if (restoredItem) {\n restoredItems.push(restoredItem);\n }\n } else {\n const _item = item;\n const restoredItem = restoreLibraryItem(Object.assign(Object.assign({}, _item), {\n id: _item.id || (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.randomId)(),\n status: _item.status || defaultStatus,\n created: _item.created || Date.now()\n }));\n\n if (restoredItem) {\n restoredItems.push(restoredItem);\n }\n }\n }\n\n return restoredItems;\n};\n\n//# sourceURL=webpack://ExcalidrawLib/./data/restore.ts?\n}");
|
|
4239
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AllowedExcalidrawActiveTools: () => (/* binding */ AllowedExcalidrawActiveTools),\n/* harmony export */ bumpElementVersions: () => (/* binding */ bumpElementVersions),\n/* harmony export */ restoreAppState: () => (/* binding */ restoreAppState),\n/* harmony export */ restoreElement: () => (/* binding */ restoreElement),\n/* harmony export */ restoreElements: () => (/* binding */ restoreElements),\n/* harmony export */ restoreLibraryItems: () => (/* binding */ restoreLibraryItems)\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 _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _appState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../appState */ \"./appState.ts\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../scene */ \"./scene/index.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst MAX_ARROW_PX = 75000;\n\nconst restoreLinearElementPoints = (points, width, height) => {\n const restoredPoints = Array.isArray(points) ? points.reduce((acc, point) => {\n if ((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isValidPoint)(point)) {\n acc.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(point[0], point[1]));\n }\n\n return acc;\n }, []) : [];\n return restoredPoints.length < 2 ? [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, 0), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(width) ? width : 0, (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(height) ? height : 0)] : restoredPoints;\n};\n\nconst restoreFreedrawPoints = (points, pressures) => {\n if (!Array.isArray(points)) {\n return {\n points: [],\n pressures: []\n };\n }\n\n const pressureValues = Array.isArray(pressures) ? pressures : [];\n const restoredPoints = [];\n const restoredPressures = [];\n points.forEach((point, index) => {\n if ((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isValidPoint)(point)) {\n restoredPoints.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(point[0], point[1]));\n\n if (index in pressureValues) {\n const pressure = pressureValues[index];\n restoredPressures.push((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(pressure) ? pressure : 0.5);\n }\n }\n });\n return {\n points: restoredPoints,\n pressures: restoredPressures\n };\n};\n\nconst AllowedExcalidrawActiveTools = {\n selection: true,\n lasso: true,\n text: true,\n rectangle: true,\n diamond: true,\n ellipse: true,\n line: true,\n image: true,\n arrow: true,\n freedraw: true,\n eraser: false,\n custom: true,\n frame: true,\n embeddable: true,\n hand: true,\n mermaid: true,\n laser: false,\n magicframe: false\n};\n\nconst getFontFamilyByName = fontFamilyName => {\n if (Object.keys(_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.FONT_FAMILY).includes(fontFamilyName)) {\n return _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.FONT_FAMILY[fontFamilyName];\n }\n\n return _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_FONT_FAMILY;\n};\n\nconst repairBinding = (element, binding, targetElementsMap,\n/** used for context (arrow bindings) */\nexistingElementsMap, startOrEnd) => {\n var _a, _b;\n\n try {\n if (!binding) {\n return null;\n } // ---------------------------------------------------------------------------\n // elbow arrows\n // ---------------------------------------------------------------------------\n\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(element)) {\n const fixedPointBinding = Object.assign(Object.assign({}, binding), {\n fixedPoint: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeFixedPoint)(binding.fixedPoint),\n mode: binding.mode || \"orbit\"\n });\n return fixedPointBinding;\n } // ---------------------------------------------------------------------------\n // simple arrows\n // ---------------------------------------------------------------------------\n // binding schema v2\n // ---------------------------------------------------------------------------\n\n\n if (binding.mode) {\n // if latest binding schema, don't check if binding.elementId exists\n // (it's done in a separate pass)\n if (binding.elementId) {\n return {\n elementId: binding.elementId,\n mode: binding.mode,\n fixedPoint: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeFixedPoint)(binding.fixedPoint)\n };\n }\n\n return null;\n } // binding schema v1 (legacy) -> attempt to migrate to v2\n // ---------------------------------------------------------------------------\n\n\n const targetBoundElement = targetElementsMap.get(binding.elementId);\n const boundElement = targetBoundElement || (existingElementsMap === null || existingElementsMap === void 0 ? void 0 : existingElementsMap.get(binding.elementId));\n const elementsMap = targetBoundElement ? targetElementsMap : existingElementsMap; // migrating legacy focus point bindings\n\n if (boundElement && elementsMap) {\n const p = _excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.LinearElementEditor.getPointAtIndexGlobalCoordinates(element, startOrEnd === \"start\" ? 0 : element.points.length - 1, elementsMap);\n const mode = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isPointInElement)(p, boundElement, elementsMap) ? \"inside\" : \"orbit\";\n const safeElement = Object.assign(Object.assign({}, element), {\n startBinding: ((_a = element.startBinding) === null || _a === void 0 ? void 0 : _a.elementId) ? Object.assign(Object.assign({}, element.startBinding), {\n mode,\n fixedPoint: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeFixedPoint)(element.startBinding.fixedPoint)\n }) : null,\n endBinding: ((_b = element.endBinding) === null || _b === void 0 ? void 0 : _b.elementId) ? Object.assign(Object.assign({}, element.endBinding), {\n mode,\n fixedPoint: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeFixedPoint)(element.endBinding.fixedPoint)\n }) : null\n });\n const focusPoint = mode === \"inside\" ? p : (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.projectFixedPointOntoDiagonal)(safeElement, p, boundElement, startOrEnd, elementsMap, {\n value: 1\n }) || p;\n const {\n fixedPoint\n } = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.calculateFixedPointForNonElbowArrowBinding)(safeElement, boundElement, startOrEnd, elementsMap, focusPoint);\n return {\n mode,\n elementId: binding.elementId,\n fixedPoint\n };\n } //zsviczian\n\n\n console.warn(`Could not repair binding for element \"${boundElement === null || boundElement === void 0 ? void 0 : boundElement.id}\" out of (${elementsMap === null || elementsMap === void 0 ? void 0 : elementsMap.size}) elements`, {\n element,\n binding,\n targetElementsMap,\n existingElementsMap,\n startOrEnd\n });\n } catch (error) {\n console.error(\"Error repairing binding:\", error);\n }\n\n return null;\n};\n\nconst restoreElementWithProperties = (element, extra) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;\n\n const base = {\n type: extra.type || element.type,\n // all elements must have version > 0 so getSceneVersion() will pick up\n // newly added elements\n version: element.version || 1,\n versionNonce: (_a = element.versionNonce) !== null && _a !== void 0 ? _a : 0,\n index: (_b = element.index) !== null && _b !== void 0 ? _b : null,\n isDeleted: (_c = element.isDeleted) !== null && _c !== void 0 ? _c : false,\n id: element.id || (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.randomId)(),\n fillStyle: element.fillStyle || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.fillStyle,\n strokeWidth: element.strokeWidth || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.strokeWidth,\n strokeStyle: (_d = element.strokeStyle) !== null && _d !== void 0 ? _d : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.strokeStyle,\n roughness: (_e = element.roughness) !== null && _e !== void 0 ? _e : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.roughness,\n opacity: element.opacity == null ? _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.opacity : element.opacity,\n angle: element.angle || 0,\n x: (_g = (_f = extra.x) !== null && _f !== void 0 ? _f : element.x) !== null && _g !== void 0 ? _g : 0,\n y: (_j = (_h = extra.y) !== null && _h !== void 0 ? _h : element.y) !== null && _j !== void 0 ? _j : 0,\n strokeColor: element.strokeColor || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.strokeColor,\n backgroundColor: element.backgroundColor || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_ELEMENT_PROPS.backgroundColor,\n width: element.width || 0,\n height: element.height || 0,\n seed: (_k = element.seed) !== null && _k !== void 0 ? _k : 1,\n groupIds: (_l = element.groupIds) !== null && _l !== void 0 ? _l : [],\n frameId: (_m = element.frameId) !== null && _m !== void 0 ? _m : null,\n roundness: element.roundness ? element.roundness : element.strokeSharpness === \"round\" && element.type !== \"image\" ? {\n // for old elements that would now use adaptive radius algo,\n // use legacy algo instead\n type: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isUsingAdaptiveRadius)(element.type) ? _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.ROUNDNESS.LEGACY : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.ROUNDNESS.PROPORTIONAL_RADIUS\n } : null,\n boundElements: element.boundElementIds ? element.boundElementIds.map(id => ({\n type: \"arrow\",\n id\n })) : (_o = element.boundElements) !== null && _o !== void 0 ? _o : [],\n updated: (_p = element.updated) !== null && _p !== void 0 ? _p : (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getUpdatedTimestamp)(),\n link: element.link ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.normalizeLink)(element.link) : null,\n hasTextLink: (_q = element.hasTextLink) !== null && _q !== void 0 ? _q : false,\n //zsviczian\n locked: (_r = element.locked) !== null && _r !== void 0 ? _r : false\n };\n\n if (\"customData\" in element || \"customData\" in extra) {\n base.customData = \"customData\" in extra ? extra.customData : element.customData;\n }\n\n const ret = Object.assign(Object.assign(Object.assign(Object.assign({}, element), base), (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.getNormalizedDimensions)(base)), extra); // strip legacy props (migrated in previous steps)\n\n delete ret.strokeSharpness;\n delete ret.boundElementIds;\n return ret;\n};\n\nconst restoreElement = (\n/** element to be restored */\nelement,\n/** all elements to be restored */\ntargetElementsMap,\n/** used for additional context */\nexistingElementsMap, opts) => {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n\n element = Object.assign({}, element);\n\n switch (element.type) {\n case \"text\":\n // temp fix: cleanup legacy obsidian-excalidraw attribute else it'll\n // conflict when porting between the apps\n //delete (element as any).rawText; //zsviczian\n let fontSize = element.fontSize;\n let fontFamily = element.fontFamily;\n\n if (\"font\" in element) {\n const [fontPx, _fontFamily] = element.font.split(\" \");\n fontSize = parseFloat(fontPx);\n fontFamily = getFontFamilyByName(_fontFamily);\n }\n\n const text = typeof element.text === \"string\" && element.text || \"\"; // line-height might not be specified either when creating elements\n // programmatically, or when importing old diagrams.\n // For the latter we want to detect the original line height which\n // will likely differ from our per-font fixed line height we now use,\n // to maintain backward compatibility.\n\n const lineHeight = element.lineHeight || (element.height ? // detect line-height from current element height and font-size\n (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.detectLineHeight)(element) : // no element height likely means programmatic use, so default\n // to a fixed line height\n (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getLineHeight)(element.fontFamily));\n element = restoreElementWithProperties(element, {\n fontSize,\n fontFamily,\n text,\n rawText: (_a = element.rawText) !== null && _a !== void 0 ? _a : \"\",\n //zsviczian\n textAlign: element.textAlign || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_TEXT_ALIGN,\n verticalAlign: element.verticalAlign || _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_VERTICAL_ALIGN,\n containerId: (_b = element.containerId) !== null && _b !== void 0 ? _b : null,\n originalText: element.originalText || text,\n autoResize: (_c = element.autoResize) !== null && _c !== void 0 ? _c : true,\n lineHeight\n }); // if empty text, mark as deleted. We keep in array\n // for data integrity purposes (collab etc.)\n\n if ((opts === null || opts === void 0 ? void 0 : opts.deleteInvisibleElements) && !text && !element.isDeleted) {\n // TODO: we should not do this since it breaks sync / versioning when we exchange / apply just deltas and restore the elements (deletion isn't recorded)\n element = Object.assign(Object.assign({}, element), {\n originalText: text,\n isDeleted: true\n });\n element = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.bumpVersion)(element);\n }\n\n return element;\n\n case \"freedraw\":\n {\n const {\n points,\n pressures\n } = restoreFreedrawPoints(element.points, element.pressures);\n return restoreElementWithProperties(element, {\n points,\n simulatePressure: element.simulatePressure,\n pressures\n });\n }\n\n case \"image\":\n return restoreElementWithProperties(element, {\n status: element.status || \"pending\",\n fileId: element.fileId,\n scale: element.scale || [1, 1],\n crop: (_d = element.crop) !== null && _d !== void 0 ? _d : null\n });\n\n case \"line\": // @ts-ignore LEGACY type\n // eslint-disable-next-line no-fallthrough\n\n case \"draw\":\n const startArrowhead = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeArrowhead)(element.startArrowhead);\n const endArrowhead = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeArrowhead)(element.endArrowhead);\n let x = element.x;\n let y = element.y;\n let points = restoreLinearElementPoints(element.points, element.width, element.height);\n\n if (points[0][0] !== 0 || points[0][1] !== 0) {\n ({\n points,\n x,\n y\n } = _excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.LinearElementEditor.getNormalizeElementPointsAndCoords(Object.assign(Object.assign({}, element), {\n points,\n x: x !== null && x !== void 0 ? x : 0,\n y: y !== null && y !== void 0 ? y : 0\n })));\n }\n\n return restoreElementWithProperties(element, Object.assign(Object.assign({\n type: \"line\",\n startBinding: null,\n endBinding: null,\n startArrowhead,\n endArrowhead,\n points,\n x,\n y\n }, (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isLineElement)(element) ? {\n polygon: (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isValidPolygon)(points) ? (_e = element.polygon) !== null && _e !== void 0 ? _e : false : false\n } : {}), (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getSizeFromPoints)(points)));\n\n case \"arrow\":\n {\n const startArrowhead = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeArrowhead)(element.startArrowhead);\n const endArrowhead = element.endArrowhead === undefined ? \"arrow\" : (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.normalizeArrowhead)(element.endArrowhead);\n const x = element.x;\n const y = element.y;\n const points = restoreLinearElementPoints(element.points, element.width, element.height);\n const elementWithRestoredPoints = Object.assign(Object.assign({}, element), {\n points,\n x: x !== null && x !== void 0 ? x : 0,\n y: y !== null && y !== void 0 ? y : 0\n });\n const base = Object.assign({\n type: element.type,\n startBinding: repairBinding(elementWithRestoredPoints, element.startBinding, targetElementsMap, existingElementsMap, \"start\"),\n endBinding: repairBinding(elementWithRestoredPoints, element.endBinding, targetElementsMap, existingElementsMap, \"end\"),\n startArrowhead,\n endArrowhead,\n points,\n x: x !== null && x !== void 0 ? x : 0,\n y: y !== null && y !== void 0 ? y : 0,\n elbowed: element.elbowed\n }, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getSizeFromPoints)(points)); // TODO: Separate arrow from linear element\n\n const restoredElement = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(element) ? restoreElementWithProperties(element, Object.assign(Object.assign({}, base), {\n elbowed: true,\n fixedSegments: ((_f = element.fixedSegments) === null || _f === void 0 ? void 0 : _f.length) && base.points.length >= 4 ? element.fixedSegments : null,\n startIsSpecial: element.startIsSpecial,\n endIsSpecial: element.endIsSpecial\n })) : restoreElementWithProperties(element, base);\n const normalizedRestoredElement = Object.assign(Object.assign({}, restoredElement), _excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.LinearElementEditor.getNormalizeElementPointsAndCoords(restoredElement)); // Last resort fix for extremely large arrows\n\n if (normalizedRestoredElement.width > MAX_ARROW_PX || normalizedRestoredElement.height > MAX_ARROW_PX) {\n console.error(`Removing extremely large arrow ${normalizedRestoredElement.id} (type: ${(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(normalizedRestoredElement) ? \"elbow\" : \"simple\"}, width: ${normalizedRestoredElement.width}, height: ${normalizedRestoredElement.height}, x: ${normalizedRestoredElement.x}, y: ${normalizedRestoredElement.y})`);\n return Object.assign(Object.assign({}, normalizedRestoredElement), {\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n points: [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, 0), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(100, 100)],\n isDeleted: true\n });\n }\n\n return normalizedRestoredElement;\n }\n // generic elements\n\n case \"ellipse\":\n case \"rectangle\":\n case \"diamond\":\n return restoreElementWithProperties(element, {});\n\n case \"iframe\": //zsviczian\n\n case \"embeddable\":\n return restoreElementWithProperties(element, {\n scale: (_g = element.scale) !== null && _g !== void 0 ? _g : [1, 1] //zsviczian\n\n });\n\n case \"magicframe\":\n case \"frame\":\n return restoreElementWithProperties(element, {\n name: (_h = element.name) !== null && _h !== void 0 ? _h : null\n });\n // Don't use default case so as to catch a missing an element type case.\n // We also don't want to throw, but instead return void so we filter\n // out these unsupported elements from the restored array.\n }\n\n return null;\n};\n/**\n * Repairs container element's boundElements array by removing duplicates and\n * fixing containerId of bound elements if not present. Also removes any\n * bound elements that do not exist in the elements array.\n *\n * NOTE mutates elements.\n */\n\nconst repairContainerElement = (container, elementsMap) => {\n if (container.boundElements) {\n // copy because we're not cloning on restore, and we don't want to mutate upstream\n const boundElements = container.boundElements.slice(); // dedupe bindings & fix boundElement.containerId if not set already\n\n const boundIds = new Set();\n container.boundElements = boundElements.reduce((acc, binding) => {\n const boundElement = elementsMap.get(binding.id);\n\n if (boundElement && !boundIds.has(binding.id)) {\n boundIds.add(binding.id);\n\n if (boundElement.isDeleted) {\n return acc;\n }\n\n acc.push(binding);\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isTextElement)(boundElement) && // being slightly conservative here, preserving existing containerId\n // if defined, lest boundElements is stale\n !boundElement.containerId) {\n boundElement.containerId = container.id;\n }\n }\n\n return acc;\n }, []);\n }\n};\n/**\n * Repairs target bound element's container's boundElements array,\n * or removes contaienrId if container does not exist.\n *\n * NOTE mutates elements.\n */\n\n\nconst repairBoundElement = (boundElement, elementsMap) => {\n var _a;\n\n const container = boundElement.containerId ? elementsMap.get(boundElement.containerId) : null;\n boundElement.angle = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isArrowElement)(container) ? 0 : (_a = container === null || container === void 0 ? void 0 : container.angle) !== null && _a !== void 0 ? _a : 0;\n\n if (!container) {\n boundElement.containerId = null;\n return;\n }\n\n if (boundElement.isDeleted) {\n return;\n }\n\n if (container.boundElements && !container.boundElements.find(binding => binding.id === boundElement.id)) {\n // copy because we're not cloning on restore, and we don't want to mutate upstream\n const boundElements = (container.boundElements || (container.boundElements = [])).slice();\n boundElements.push({\n type: \"text\",\n id: boundElement.id\n });\n container.boundElements = boundElements;\n }\n};\n/**\n * Remove an element's frameId if its containing frame is non-existent\n *\n * NOTE mutates elements.\n */\n\n\nconst repairFrameMembership = (element, elementsMap) => {\n if (element.frameId) {\n const containingFrame = elementsMap.get(element.frameId);\n\n if (!containingFrame) {\n element.frameId = null;\n }\n }\n}; // Removes groupIds that only occur on a single non-deleted element.\n// zsviczian\n\n\nconst pruneOrphanGroupIds = elements => {\n var _a, _b;\n\n const counts = new Map();\n\n for (const element of elements) {\n if (element.isDeleted) {\n continue;\n }\n\n for (const groupId of (_a = element.groupIds) !== null && _a !== void 0 ? _a : []) {\n counts.set(groupId, ((_b = counts.get(groupId)) !== null && _b !== void 0 ? _b : 0) + 1);\n }\n }\n\n if (!counts.size) {\n return elements;\n }\n\n return elements.map(element => {\n var _a;\n\n if (!((_a = element.groupIds) === null || _a === void 0 ? void 0 : _a.length)) {\n return element;\n }\n\n const filteredGroupIds = element.groupIds.filter(groupId => {\n var _a;\n\n return ((_a = counts.get(groupId)) !== null && _a !== void 0 ? _a : 0) > 1;\n });\n\n if (filteredGroupIds.length === element.groupIds.length) {\n return element;\n }\n\n return Object.assign(Object.assign({}, element), {\n groupIds: filteredGroupIds\n });\n });\n};\n\nconst restoreElements = (targetElements,\n/** used for additional context (e.g. repairing arrow bindings) */\nexistingElements, opts) => {\n // used to detect duplicate top-level element ids\n const existingIds = new Set();\n const targetElementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(targetElements || []);\n const existingElementsMap = existingElements ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(existingElements) : null;\n let restoredElements = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.syncInvalidIndices)( //zsviczian let not const\n (targetElements || []).reduce((elements, element) => {\n // filtering out selection, which is legacy, no longer kept in elements,\n // and causing issues if retained\n if (element.type === \"selection\") {\n return elements;\n }\n\n let migratedElement;\n\n try {\n migratedElement = restoreElement(element, targetElementsMap, existingElementsMap, {\n deleteInvisibleElements: opts === null || opts === void 0 ? void 0 : opts.deleteInvisibleElements\n });\n } catch (error) {\n console.error(\"Error restoring element:\", error);\n migratedElement = null;\n }\n\n if (migratedElement) {\n const localElement = existingElementsMap === null || existingElementsMap === void 0 ? void 0 : existingElementsMap.get(element.id);\n const shouldMarkAsDeleted = (opts === null || opts === void 0 ? void 0 : opts.deleteInvisibleElements) && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isInvisiblySmallElement)(element);\n\n if (shouldMarkAsDeleted) {\n migratedElement = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.bumpVersion)(migratedElement, localElement === null || localElement === void 0 ? void 0 : localElement.version);\n }\n\n if (shouldMarkAsDeleted) {\n migratedElement = Object.assign(Object.assign({}, migratedElement), {\n isDeleted: true\n });\n }\n\n if (existingIds.has(migratedElement.id)) {\n migratedElement = Object.assign(Object.assign({}, migratedElement), {\n id: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.randomId)()\n });\n }\n\n existingIds.add(migratedElement.id);\n elements.push(migratedElement);\n }\n\n return elements;\n }, []));\n restoredElements = pruneOrphanGroupIds(restoredElements); //zsviczian\n\n if (!(opts === null || opts === void 0 ? void 0 : opts.repairBindings)) {\n return restoredElements;\n } // repair binding. Mutates elements.\n\n\n const restoredElementsMap = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(restoredElements);\n\n for (const element of restoredElements) {\n if (element.frameId) {\n repairFrameMembership(element, restoredElementsMap);\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isTextElement)(element) && element.containerId) {\n repairBoundElement(element, restoredElementsMap);\n } else if (element.boundElements) {\n repairContainerElement(element, restoredElementsMap);\n }\n\n if (opts.refreshDimensions && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isTextElement)(element)) {\n Object.assign(element, (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.refreshTextDimensions)(element, (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.getContainerElement)(element, restoredElementsMap), restoredElementsMap));\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isLinearElement)(element)) {\n if (element.startBinding && (!restoredElementsMap.has(element.startBinding.elementId) || !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isArrowElement)(element))) {\n element.startBinding = null;\n }\n\n if (element.endBinding && (!restoredElementsMap.has(element.endBinding.elementId) || !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isArrowElement)(element))) {\n element.endBinding = null;\n }\n }\n } // NOTE (mtolmacs): Temporary fix for invalid/self-bound elbow arrows\n // Need to iterate again so we have attached text nodes in elementsMap\n\n\n return restoredElements.map(element => {\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(element) && !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isArrowBoundToElement)(element) && !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.validateElbowPoints)(element.points)) {\n return Object.assign(Object.assign(Object.assign({}, element), (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.updateElbowArrowPoints)(element, restoredElementsMap, {\n points: [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, 0), element.points[element.points.length - 1]]\n })), {\n index: element.index\n });\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.isElbowArrow)(element) && element.startBinding && element.endBinding && element.startBinding.elementId === element.endBinding.elementId && element.points.length > 1 && element.points.some(([rx, ry]) => Math.abs(rx) > 1e6 || Math.abs(ry) > 1e6)) {\n console.error(\"Fixing self-bound elbow arrow\", element.id);\n const boundElement = restoredElementsMap.get(element.startBinding.elementId);\n\n if (!boundElement) {\n console.error(\"Bound element not found\", element.startBinding.elementId);\n return element;\n }\n\n return Object.assign(Object.assign({}, element), {\n x: boundElement.x + boundElement.width / 2,\n y: boundElement.y - 5,\n width: boundElement.width,\n height: boundElement.height,\n points: [(0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, 0), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(0, -10), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(boundElement.width / 2 + 5, -10), (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(boundElement.width / 2 + 5, boundElement.height / 2 + 5)]\n });\n }\n\n return element;\n });\n};\n/**\n * When replacing elements that may exist locally, this bumps their versions\n * to the local version + 1. Mainly for later reconciliation to work properly.\n *\n * See https://github.com/excalidraw/excalidraw/issues/3795\n *\n * Generally use this on editor boundaries (importing from file etc.), though\n * it does not apply universally (e.g. we don't want to do this for collab\n * updates).\n */\n\nconst bumpElementVersions = (targetElements, localElements) => {\n const localElementsMap = localElements ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.arrayToMap)(localElements) : null;\n return targetElements.map(element => {\n const localElement = localElementsMap === null || localElementsMap === void 0 ? void 0 : localElementsMap.get(element.id);\n\n if (localElement && (localElement.version > element.version || // same versions but different versionNonce means different edits\n // (this often means the element was bumped during restore e.g. due\n // to re-indexing, and the original element was modified elsewhere\n // and supplied as localElements)\n localElement.version === element.version && localElement.versionNonce !== element.versionNonce)) {\n return (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.bumpVersion)(element, localElement.version);\n }\n\n return element;\n });\n};\n\nconst coalesceAppStateValue = (key, appState, defaultAppState) => {\n const value = appState[key]; // NOTE the value! assertion is needed in TS 4.5.5 (fixed in newer versions)\n\n return value !== undefined ? value : defaultAppState[key];\n};\n\nconst LegacyAppStateMigrations = {\n isSidebarDocked: (appState, defaultAppState) => {\n var _a;\n\n return [\"defaultSidebarDockedPreference\", (_a = appState.isSidebarDocked) !== null && _a !== void 0 ? _a : coalesceAppStateValue(\"defaultSidebarDockedPreference\", appState, defaultAppState)];\n }\n};\nconst restoreAppState = (appState, localAppState) => {\n var _a, _b, _c, _d, _e, _f;\n\n appState = appState || {};\n const defaultAppState = (0,_appState__WEBPACK_IMPORTED_MODULE_3__.getDefaultAppState)();\n const nextAppState = {}; // first, migrate all legacy AppState properties to new ones. We do it\n // in one go before migrate the rest of the properties in case the new ones\n // depend on checking any other key (i.e. they are coupled)\n\n for (const legacyKey of Object.keys(LegacyAppStateMigrations)) {\n if (legacyKey in appState) {\n const [nextKey, nextValue] = LegacyAppStateMigrations[legacyKey](appState, defaultAppState);\n nextAppState[nextKey] = nextValue;\n }\n }\n\n for (const [key, defaultValue] of Object.entries(defaultAppState)) {\n // if AppState contains a legacy key, prefer that one and migrate its\n // value to the new one\n const suppliedValue = appState[key];\n const localValue = localAppState ? localAppState[key] : undefined;\n nextAppState[key] = suppliedValue !== undefined ? suppliedValue : localValue !== undefined ? localValue : defaultValue;\n }\n\n const boxSelectionMode = (_a = appState.boxSelectionMode) !== null && _a !== void 0 ? _a : localAppState === null || localAppState === void 0 ? void 0 : localAppState.boxSelectionMode;\n\n if (boxSelectionMode !== undefined) {\n nextAppState.boxSelectionMode = boxSelectionMode;\n }\n\n return Object.assign(Object.assign({}, nextAppState), {\n cursorButton: (localAppState === null || localAppState === void 0 ? void 0 : localAppState.cursorButton) || \"up\",\n // reset on fresh restore so as to hide the UI button if penMode not active\n penDetected: (_b = localAppState === null || localAppState === void 0 ? void 0 : localAppState.penDetected) !== null && _b !== void 0 ? _b : appState.penMode ? (_c = appState.penDetected) !== null && _c !== void 0 ? _c : false : false,\n activeTool: Object.assign(Object.assign({}, (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.updateActiveTool)(defaultAppState, nextAppState.activeTool.type && AllowedExcalidrawActiveTools[nextAppState.activeTool.type] ? nextAppState.activeTool : {\n type: \"selection\"\n })), {\n lastActiveTool: null,\n locked: (_d = nextAppState.activeTool.locked) !== null && _d !== void 0 ? _d : false\n }),\n // Migrates from previous version where appState.zoom was a number\n zoom: {\n value: (0,_scene__WEBPACK_IMPORTED_MODULE_4__.getNormalizedZoom)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(appState.zoom) ? appState.zoom : (_f = (_e = appState.zoom) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : defaultAppState.zoom.value)\n },\n openSidebar: // string (legacy)\n typeof appState.openSidebar === \"string\" ? {\n name: _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SIDEBAR.name\n } : nextAppState.openSidebar,\n gridSize: (0,_scene__WEBPACK_IMPORTED_MODULE_4__.getNormalizedGridSize)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(appState.gridSize) ? appState.gridSize : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_GRID_SIZE),\n gridStep: (0,_scene__WEBPACK_IMPORTED_MODULE_4__.getNormalizedGridStep)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.isFiniteNumber)(appState.gridStep) ? appState.gridStep : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_GRID_STEP),\n editingFrame: null\n });\n};\n\nconst restoreLibraryItem = libraryItem => {\n const elements = restoreElements((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_2__.getNonDeletedElements)(libraryItem.elements), null);\n return elements.length ? Object.assign(Object.assign({}, libraryItem), {\n elements\n }) : null;\n};\n\nconst restoreLibraryItems = (libraryItems = [], defaultStatus) => {\n const restoredItems = [];\n\n for (const item of libraryItems) {\n // migrate older libraries\n if (Array.isArray(item)) {\n const restoredItem = restoreLibraryItem({\n status: defaultStatus,\n elements: item,\n id: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.randomId)(),\n created: Date.now()\n });\n\n if (restoredItem) {\n restoredItems.push(restoredItem);\n }\n } else {\n const _item = item;\n const restoredItem = restoreLibraryItem(Object.assign(Object.assign({}, _item), {\n id: _item.id || (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.randomId)(),\n status: _item.status || defaultStatus,\n created: _item.created || Date.now()\n }));\n\n if (restoredItem) {\n restoredItems.push(restoredItem);\n }\n }\n }\n\n return restoredItems;\n};\n\n//# sourceURL=webpack://ExcalidrawLib/./data/restore.ts?\n}");
|
|
4262
4240
|
|
|
4263
4241
|
/***/ },
|
|
4264
4242
|
|
|
@@ -4291,7 +4269,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
4291
4269
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4292
4270
|
|
|
4293
4271
|
"use strict";
|
|
4294
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Button: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Button),\n/* harmony export */ CaptureUpdateAction: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.CaptureUpdateAction),\n/* harmony export */ CommandPalette: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.CommandPalette),\n/* harmony export */ DEFAULT_LASER_COLOR: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_LASER_COLOR),\n/* harmony export */ DefaultSidebar: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.DefaultSidebar),\n/* harmony export */ DiagramToCodePlugin: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.DiagramToCodePlugin),\n/* harmony export */ Ellipsify: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Ellipsify),\n/* harmony export */ Excalidraw: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Excalidraw),\n/* harmony export */ ExcalidrawAPIContext: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.ExcalidrawAPIContext),\n/* harmony export */ ExcalidrawAPIProvider: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.ExcalidrawAPIProvider),\n/* harmony export */ FONT_FAMILY: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.FONT_FAMILY),\n/* harmony export */ Fonts: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Fonts),\n/* harmony export */ Footer: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Footer),\n/* harmony export */ LiveCollaborationTrigger: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.LiveCollaborationTrigger),\n/* harmony export */ MIME_TYPES: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.MIME_TYPES),\n/* harmony export */ MainMenu: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.MainMenu),\n/* harmony export */ ROUNDNESS: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.ROUNDNESS),\n/* harmony export */ Sidebar: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Sidebar),\n/* harmony export */ Stats: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Stats),\n/* harmony export */ THEME: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.THEME),\n/* harmony export */ TTDDialog: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.TTDDialog),\n/* harmony export */ TTDDialogTrigger: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.TTDDialogTrigger),\n/* harmony export */ TTDStreamFetch: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.TTDStreamFetch),\n/* harmony export */ UserIdleState: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.UserIdleState),\n/* harmony export */ WelcomeScreen: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.WelcomeScreen),\n/* harmony export */ applyDarkModeFilter: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.applyDarkModeFilter),\n/* harmony export */ bumpVersion: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.bumpVersion),\n/* harmony export */ convertToExcalidrawElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.convertToExcalidrawElements),\n/* harmony export */ defaultLang: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.defaultLang),\n/* harmony export */ destroyObsidianUtils: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.destroyObsidianUtils),\n/* harmony export */ elementPartiallyOverlapsWithOrContainsBBox: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.elementPartiallyOverlapsWithOrContainsBBox),\n/* harmony export */ elementsOverlappingBBox: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.elementsOverlappingBBox),\n/* harmony export */ exportToBlob: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.exportToBlob),\n/* harmony export */ exportToCanvas: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.exportToCanvas),\n/* harmony export */ exportToClipboard: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.exportToClipboard),\n/* harmony export */ exportToSvg: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.exportToSvg),\n/* harmony export */ getBoundTextMaxWidth: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getBoundTextMaxWidth),\n/* harmony export */ getCSSFontDefinition: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getCSSFontDefinition),\n/* harmony export */ getCommonBoundingBox: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getCommonBoundingBox),\n/* harmony export */ getCommonBounds: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getCommonBounds),\n/* harmony export */ getContainerElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getContainerElement),\n/* harmony export */ getDataURL: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getDataURL),\n/* harmony export */ getDefaultColorPalette: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getDefaultColorPalette),\n/* harmony export */ getEmbedLink: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getEmbedLink),\n/* harmony export */ getFontFamilies: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFontFamilies),\n/* harmony export */ getFontFamilyString: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFontFamilyString),\n/* harmony export */ getFontMetrics: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFontMetrics),\n/* harmony export */ getFontString: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFontString),\n/* harmony export */ getFormFactor: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFormFactor),\n/* harmony export */ getLibraryItemsHash: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getLibraryItemsHash),\n/* harmony export */ getLineHeight: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getLineHeight),\n/* harmony export */ getMaximumGroups: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getMaximumGroups),\n/* harmony export */ getNonDeletedElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getNonDeletedElements),\n/* harmony export */ getSceneVersion: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getSceneVersion),\n/* harmony export */ getSharedMermaidInstance: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getSharedMermaidInstance),\n/* harmony export */ getTextFromElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getTextFromElements),\n/* harmony export */ getVisibleSceneBounds: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getVisibleSceneBounds),\n/* harmony export */ hashElementsVersion: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.hashElementsVersion),\n/* harmony export */ hashString: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.hashString),\n/* harmony export */ intersectElementWithLine: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.intersectElementWithLine),\n/* harmony export */ isElementInsideBBox: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.isElementInsideBBox),\n/* harmony export */ isElementLink: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.isElementLink),\n/* harmony export */ isInvisiblySmallElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.isInvisiblySmallElement),\n/* harmony export */ isLinearElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.isLinearElement),\n/* harmony export */ isSpreadsheetValidForChartType: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.isSpreadsheetValidForChartType),\n/* harmony export */ languages: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.languages),\n/* harmony export */ loadFromBlob: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadFromBlob),\n/* harmony export */ loadLibraryFromBlob: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadLibraryFromBlob),\n/* harmony export */ loadMermaid: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadMermaid),\n/* harmony export */ loadSceneFonts: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadSceneFonts),\n/* harmony export */ loadSceneOrLibraryFromBlob: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadSceneOrLibraryFromBlob),\n/* harmony export */ measureText: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.measureText),\n/* harmony export */ mergeLibraryItems: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.mergeLibraryItems),\n/* harmony export */ mermaidToExcalidraw: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.mermaidToExcalidraw),\n/* harmony export */ mutateElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.mutateElement),\n/* harmony export */ newElementWith: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.newElementWith),\n/* harmony export */ normalizeLink: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.normalizeLink),\n/* harmony export */ parseLibraryTokensFromUrl: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.parseLibraryTokensFromUrl),\n/* harmony export */ reconcileElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.reconcileElements),\n/* harmony export */ refreshTextDimensions: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.refreshTextDimensions),\n/* harmony export */ registerFontsInCSS: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.registerFontsInCSS),\n/* harmony export */ registerLocalFont: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.registerLocalFont),\n/* harmony export */ renderSpreadsheet: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.renderSpreadsheet),\n/* harmony export */ restoreAppState: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.restoreAppState),\n/* harmony export */ restoreElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.restoreElement),\n/* harmony export */ restoreElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.restoreElements),\n/* harmony export */ restoreLibraryItems: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.restoreLibraryItems),\n/* harmony export */ safelyParseJSON: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.safelyParseJSON),\n/* harmony export */ sceneCoordsToViewportCoords: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.sceneCoordsToViewportCoords),\n/* harmony export */ serializeAsJSON: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.serializeAsJSON),\n/* harmony export */ serializeLibraryAsJSON: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.serializeLibraryAsJSON),\n/* harmony export */ setCustomTextMetricsProvider: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.setCustomTextMetricsProvider),\n/* harmony export */ syncInvalidIndices: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.syncInvalidIndices),\n/* harmony export */ syncMovedIndices: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.syncMovedIndices),\n/* harmony export */ throttleRAF: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.throttleRAF),\n/* harmony export */ tryParseSpreadsheet: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.tryParseSpreadsheet),\n/* harmony export */ useEditorInterface: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useEditorInterface),\n/* harmony export */ useExcalidrawAPI: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useExcalidrawAPI),\n/* harmony export */ useExcalidrawStateValue: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useExcalidrawStateValue),\n/* harmony export */ useHandleLibrary: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useHandleLibrary),\n/* harmony export */ useI18n: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useI18n),\n/* harmony export */ useOnExcalidrawStateChange: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useOnExcalidrawStateChange),\n/* harmony export */ useStylesPanelMode: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useStylesPanelMode),\n/* harmony export */ viewportCoordsToSceneCoords: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.viewportCoordsToSceneCoords),\n/* harmony export */ wrapText: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.wrapText),\n/* harmony export */ zoomToFitBounds: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.zoomToFitBounds)\n/* harmony export */ });\n/* harmony import */ var _publicPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./publicPath */ \"./publicPath.js\");\n/* harmony import */ var _polyfill__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./polyfill */ \"./polyfill.ts\");\n/* harmony import */ var _fonts_fonts_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fonts/fonts.css */ \"./fonts/fonts.css\");\n/* harmony import */ var _css_obsidianStylingOverrides_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./css/obsidianStylingOverrides.css */ \"./css/obsidianStylingOverrides.css\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./index */ \"./index.tsx\");\n\n\n\n\n(0,_polyfill__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n\n\n//# sourceURL=webpack://ExcalidrawLib/./entry.js?\n}");
|
|
4272
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Button: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Button),\n/* harmony export */ CaptureUpdateAction: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.CaptureUpdateAction),\n/* harmony export */ CommandPalette: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.CommandPalette),\n/* harmony export */ DEFAULT_LASER_COLOR: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_LASER_COLOR),\n/* harmony export */ DefaultSidebar: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.DefaultSidebar),\n/* harmony export */ DiagramToCodePlugin: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.DiagramToCodePlugin),\n/* harmony export */ Ellipsify: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Ellipsify),\n/* harmony export */ Excalidraw: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Excalidraw),\n/* harmony export */ ExcalidrawAPIContext: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.ExcalidrawAPIContext),\n/* harmony export */ ExcalidrawAPIProvider: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.ExcalidrawAPIProvider),\n/* harmony export */ FONT_FAMILY: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.FONT_FAMILY),\n/* harmony export */ Fonts: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Fonts),\n/* harmony export */ Footer: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Footer),\n/* harmony export */ LiveCollaborationTrigger: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.LiveCollaborationTrigger),\n/* harmony export */ MIME_TYPES: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.MIME_TYPES),\n/* harmony export */ MainMenu: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.MainMenu),\n/* harmony export */ ROUNDNESS: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.ROUNDNESS),\n/* harmony export */ Sidebar: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Sidebar),\n/* harmony export */ Stats: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.Stats),\n/* harmony export */ THEME: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.THEME),\n/* harmony export */ TTDDialog: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.TTDDialog),\n/* harmony export */ TTDDialogTrigger: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.TTDDialogTrigger),\n/* harmony export */ TTDStreamFetch: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.TTDStreamFetch),\n/* harmony export */ UserIdleState: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.UserIdleState),\n/* harmony export */ WelcomeScreen: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.WelcomeScreen),\n/* harmony export */ applyDarkModeFilter: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.applyDarkModeFilter),\n/* harmony export */ bumpVersion: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.bumpVersion),\n/* harmony export */ convertToExcalidrawElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.convertToExcalidrawElements),\n/* harmony export */ defaultLang: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.defaultLang),\n/* harmony export */ destroyObsidianUtils: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.destroyObsidianUtils),\n/* harmony export */ elementsOverlappingBBox: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.elementsOverlappingBBox),\n/* harmony export */ exportToBlob: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.exportToBlob),\n/* harmony export */ exportToCanvas: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.exportToCanvas),\n/* harmony export */ exportToClipboard: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.exportToClipboard),\n/* harmony export */ exportToSvg: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.exportToSvg),\n/* harmony export */ getBoundTextMaxWidth: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getBoundTextMaxWidth),\n/* harmony export */ getCSSFontDefinition: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getCSSFontDefinition),\n/* harmony export */ getCommonBoundingBox: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getCommonBoundingBox),\n/* harmony export */ getCommonBounds: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getCommonBounds),\n/* harmony export */ getContainerElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getContainerElement),\n/* harmony export */ getDataURL: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getDataURL),\n/* harmony export */ getDefaultColorPalette: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getDefaultColorPalette),\n/* harmony export */ getEmbedLink: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getEmbedLink),\n/* harmony export */ getFontFamilies: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFontFamilies),\n/* harmony export */ getFontFamilyString: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFontFamilyString),\n/* harmony export */ getFontMetrics: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFontMetrics),\n/* harmony export */ getFontString: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFontString),\n/* harmony export */ getFormFactor: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getFormFactor),\n/* harmony export */ getLibraryItemsHash: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getLibraryItemsHash),\n/* harmony export */ getLineHeight: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getLineHeight),\n/* harmony export */ getMaximumGroups: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getMaximumGroups),\n/* harmony export */ getNonDeletedElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getNonDeletedElements),\n/* harmony export */ getSceneVersion: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getSceneVersion),\n/* harmony export */ getSharedMermaidInstance: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getSharedMermaidInstance),\n/* harmony export */ getTextFromElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getTextFromElements),\n/* harmony export */ getVisibleSceneBounds: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.getVisibleSceneBounds),\n/* harmony export */ hashElementsVersion: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.hashElementsVersion),\n/* harmony export */ hashString: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.hashString),\n/* harmony export */ intersectElementWithLine: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.intersectElementWithLine),\n/* harmony export */ isElementLink: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.isElementLink),\n/* harmony export */ isInvisiblySmallElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.isInvisiblySmallElement),\n/* harmony export */ isLinearElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.isLinearElement),\n/* harmony export */ isSpreadsheetValidForChartType: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.isSpreadsheetValidForChartType),\n/* harmony export */ languages: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.languages),\n/* harmony export */ loadFromBlob: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadFromBlob),\n/* harmony export */ loadLibraryFromBlob: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadLibraryFromBlob),\n/* harmony export */ loadMermaid: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadMermaid),\n/* harmony export */ loadSceneFonts: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadSceneFonts),\n/* harmony export */ loadSceneOrLibraryFromBlob: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.loadSceneOrLibraryFromBlob),\n/* harmony export */ measureText: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.measureText),\n/* harmony export */ mergeLibraryItems: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.mergeLibraryItems),\n/* harmony export */ mermaidToExcalidraw: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.mermaidToExcalidraw),\n/* harmony export */ mutateElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.mutateElement),\n/* harmony export */ newElementWith: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.newElementWith),\n/* harmony export */ normalizeLink: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.normalizeLink),\n/* harmony export */ parseLibraryTokensFromUrl: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.parseLibraryTokensFromUrl),\n/* harmony export */ reconcileElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.reconcileElements),\n/* harmony export */ refreshTextDimensions: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.refreshTextDimensions),\n/* harmony export */ registerFontsInCSS: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.registerFontsInCSS),\n/* harmony export */ registerLocalFont: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.registerLocalFont),\n/* harmony export */ renderSpreadsheet: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.renderSpreadsheet),\n/* harmony export */ restoreAppState: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.restoreAppState),\n/* harmony export */ restoreElement: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.restoreElement),\n/* harmony export */ restoreElements: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.restoreElements),\n/* harmony export */ restoreLibraryItems: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.restoreLibraryItems),\n/* harmony export */ safelyParseJSON: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.safelyParseJSON),\n/* harmony export */ sceneCoordsToViewportCoords: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.sceneCoordsToViewportCoords),\n/* harmony export */ serializeAsJSON: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.serializeAsJSON),\n/* harmony export */ serializeLibraryAsJSON: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.serializeLibraryAsJSON),\n/* harmony export */ setCustomTextMetricsProvider: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.setCustomTextMetricsProvider),\n/* harmony export */ syncInvalidIndices: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.syncInvalidIndices),\n/* harmony export */ syncMovedIndices: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.syncMovedIndices),\n/* harmony export */ throttleRAF: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.throttleRAF),\n/* harmony export */ tryParseSpreadsheet: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.tryParseSpreadsheet),\n/* harmony export */ useEditorInterface: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useEditorInterface),\n/* harmony export */ useExcalidrawAPI: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useExcalidrawAPI),\n/* harmony export */ useExcalidrawStateValue: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useExcalidrawStateValue),\n/* harmony export */ useHandleLibrary: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useHandleLibrary),\n/* harmony export */ useI18n: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useI18n),\n/* harmony export */ useOnExcalidrawStateChange: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useOnExcalidrawStateChange),\n/* harmony export */ useStylesPanelMode: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.useStylesPanelMode),\n/* harmony export */ viewportCoordsToSceneCoords: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.viewportCoordsToSceneCoords),\n/* harmony export */ wrapText: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.wrapText),\n/* harmony export */ zoomToFitBounds: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_4__.zoomToFitBounds)\n/* harmony export */ });\n/* harmony import */ var _publicPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./publicPath */ \"./publicPath.js\");\n/* harmony import */ var _polyfill__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./polyfill */ \"./polyfill.ts\");\n/* harmony import */ var _fonts_fonts_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fonts/fonts.css */ \"./fonts/fonts.css\");\n/* harmony import */ var _css_obsidianStylingOverrides_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./css/obsidianStylingOverrides.css */ \"./css/obsidianStylingOverrides.css\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./index */ \"./index.tsx\");\n\n\n\n\n(0,_polyfill__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n\n\n//# sourceURL=webpack://ExcalidrawLib/./entry.js?\n}");
|
|
4295
4273
|
|
|
4296
4274
|
/***/ },
|
|
4297
4275
|
|
|
@@ -4357,7 +4335,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
4357
4335
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4358
4336
|
|
|
4359
4337
|
"use strict";
|
|
4360
|
-
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 /**\n * Generates CSS `@font-face` definition with the (subsetted) font source as a data url for the characters within the unicode range.\n *\n * Retrieves `undefined` otherwise.\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 /**\n * Tries to fetch woff2 content, based on the registered urls (from first to last, treated as fallbacks).\n *\n * @returns base64 with subsetted glyphs based on the passed codepoint, last defined url otherwise\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 /**\n * zsviczian https://github.com/zsviczian/excalidraw/commit/b4cfaaa4b4f46ca01f94e27fb7bf651a9da99daa\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:3016\",\"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\":\"3001\",\"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.97\",\"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:3016\",\"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\":\"3001\",\"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.97\",\"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:3016\",\"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\":\"3001\",\"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.97\",\"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?\n}");
|
|
4338
|
+
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 /**\n * Generates CSS `@font-face` definition with the (subsetted) font source as a data url for the characters within the unicode range.\n *\n * Retrieves `undefined` otherwise.\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 /**\n * Tries to fetch woff2 content, based on the registered urls (from first to last, treated as fallbacks).\n *\n * @returns base64 with subsetted glyphs based on the passed codepoint, last defined url otherwise\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 /**\n * zsviczian https://github.com/zsviczian/excalidraw/commit/b4cfaaa4b4f46ca01f94e27fb7bf651a9da99daa\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:3016\",\"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\":\"3001\",\"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.98\",\"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:3016\",\"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\":\"3001\",\"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.98\",\"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:3016\",\"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\":\"3001\",\"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.98\",\"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?\n}");
|
|
4361
4339
|
|
|
4362
4340
|
/***/ },
|
|
4363
4341
|
|
|
@@ -4632,7 +4610,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
4632
4610
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4633
4611
|
|
|
4634
4612
|
"use strict";
|
|
4635
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Button: () => (/* reexport safe */ _components_Button__WEBPACK_IMPORTED_MODULE_32__.Button),\n/* harmony export */ CaptureUpdateAction: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.CaptureUpdateAction),\n/* harmony export */ CommandPalette: () => (/* reexport safe */ _components_CommandPalette_CommandPalette__WEBPACK_IMPORTED_MODULE_43__.CommandPalette),\n/* harmony export */ DEFAULT_LASER_COLOR: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_LASER_COLOR),\n/* harmony export */ DefaultSidebar: () => (/* reexport safe */ _components_DefaultSidebar__WEBPACK_IMPORTED_MODULE_35__.DefaultSidebar),\n/* harmony export */ DiagramToCodePlugin: () => (/* reexport safe */ _components_DiagramToCodePlugin_DiagramToCodePlugin__WEBPACK_IMPORTED_MODULE_41__.DiagramToCodePlugin),\n/* harmony export */ Ellipsify: () => (/* reexport safe */ _components_Ellipsify__WEBPACK_IMPORTED_MODULE_33__.Ellipsify),\n/* harmony export */ Excalidraw: () => (/* binding */ Excalidraw),\n/* harmony export */ ExcalidrawAPIContext: () => (/* reexport safe */ _components_App__WEBPACK_IMPORTED_MODULE_2__.ExcalidrawAPIContext),\n/* harmony export */ ExcalidrawAPIProvider: () => (/* binding */ ExcalidrawAPIProvider),\n/* harmony export */ FONT_FAMILY: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.FONT_FAMILY),\n/* harmony export */ Fonts: () => (/* reexport safe */ _fonts_Fonts__WEBPACK_IMPORTED_MODULE_42__.Fonts),\n/* harmony export */ Footer: () => (/* reexport safe */ _components_footer_FooterCenter__WEBPACK_IMPORTED_MODULE_4__[\"default\"]),\n/* harmony export */ LiveCollaborationTrigger: () => (/* reexport safe */ _components_live_collaboration_LiveCollaborationTrigger__WEBPACK_IMPORTED_MODULE_5__[\"default\"]),\n/* harmony export */ MIME_TYPES: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.MIME_TYPES),\n/* harmony export */ MainMenu: () => (/* reexport safe */ _components_main_menu_MainMenu__WEBPACK_IMPORTED_MODULE_6__[\"default\"]),\n/* harmony export */ ROUNDNESS: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.ROUNDNESS),\n/* harmony export */ Sidebar: () => (/* reexport safe */ _components_Sidebar_Sidebar__WEBPACK_IMPORTED_MODULE_31__.Sidebar),\n/* harmony export */ Stats: () => (/* reexport safe */ _components_Stats__WEBPACK_IMPORTED_MODULE_34__.Stats),\n/* harmony export */ THEME: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.THEME),\n/* harmony export */ TTDDialog: () => (/* reexport safe */ _components_TTDDialog_TTDDialog__WEBPACK_IMPORTED_MODULE_36__.TTDDialog),\n/* harmony export */ TTDDialogTrigger: () => (/* reexport safe */ _components_TTDDialog_TTDDialogTrigger__WEBPACK_IMPORTED_MODULE_37__.TTDDialogTrigger),\n/* harmony export */ TTDStreamFetch: () => (/* reexport safe */ _components_TTDDialog_utils_TTDStreamFetch__WEBPACK_IMPORTED_MODULE_38__.TTDStreamFetch),\n/* harmony export */ UserIdleState: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.UserIdleState),\n/* harmony export */ WelcomeScreen: () => (/* reexport safe */ _components_welcome_screen_WelcomeScreen__WEBPACK_IMPORTED_MODULE_7__[\"default\"]),\n/* harmony export */ applyDarkModeFilter: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.applyDarkModeFilter),\n/* harmony export */ bumpVersion: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.bumpVersion),\n/* harmony export */ convertToExcalidrawElements: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.convertToExcalidrawElements),\n/* harmony export */ defaultLang: () => (/* reexport safe */ _i18n__WEBPACK_IMPORTED_MODULE_8__.defaultLang),\n/* harmony export */ destroyObsidianUtils: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.destroyObsidianUtils),\n/* harmony export */ elementPartiallyOverlapsWithOrContainsBBox: () => (/* reexport safe */ _excalidraw_utils_withinBounds__WEBPACK_IMPORTED_MODULE_40__.elementPartiallyOverlapsWithOrContainsBBox),\n/* harmony export */ elementsOverlappingBBox: () => (/* reexport safe */ _excalidraw_utils_withinBounds__WEBPACK_IMPORTED_MODULE_40__.elementsOverlappingBBox),\n/* harmony export */ exportToBlob: () => (/* reexport safe */ _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__.exportToBlob),\n/* harmony export */ exportToCanvas: () => (/* reexport safe */ _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__.exportToCanvas),\n/* harmony export */ exportToClipboard: () => (/* reexport safe */ _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__.exportToClipboard),\n/* harmony export */ exportToSvg: () => (/* reexport safe */ _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__.exportToSvg),\n/* harmony export */ getBoundTextMaxWidth: () => (/* reexport safe */ _excalidraw_element_textElement__WEBPACK_IMPORTED_MODULE_23__.getBoundTextMaxWidth),\n/* harmony export */ getCSSFontDefinition: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getCSSFontDefinition),\n/* harmony export */ getCommonBoundingBox: () => (/* reexport safe */ _excalidraw_element_bounds__WEBPACK_IMPORTED_MODULE_19__.getCommonBoundingBox),\n/* harmony export */ getCommonBounds: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getCommonBounds),\n/* harmony export */ getContainerElement: () => (/* reexport safe */ _excalidraw_element_textElement__WEBPACK_IMPORTED_MODULE_23__.getContainerElement),\n/* harmony export */ getDataURL: () => (/* reexport safe */ _data_blob__WEBPACK_IMPORTED_MODULE_28__.getDataURL),\n/* harmony export */ getDefaultColorPalette: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getDefaultColorPalette),\n/* harmony export */ getEmbedLink: () => (/* reexport safe */ _excalidraw_element_embeddable__WEBPACK_IMPORTED_MODULE_30__.getEmbedLink),\n/* harmony export */ getFontFamilies: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getFontFamilies),\n/* harmony export */ getFontFamilyString: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getFontFamilyString),\n/* harmony export */ getFontMetrics: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getFontMetrics),\n/* harmony export */ getFontString: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getFontString),\n/* harmony export */ getFormFactor: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getFormFactor),\n/* harmony export */ getLibraryItemsHash: () => (/* reexport safe */ _data_library__WEBPACK_IMPORTED_MODULE_29__.getLibraryItemsHash),\n/* harmony export */ getLineHeight: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getLineHeight),\n/* harmony export */ getMaximumGroups: () => (/* reexport safe */ _excalidraw_element_groups__WEBPACK_IMPORTED_MODULE_20__.getMaximumGroups),\n/* harmony export */ getNonDeletedElements: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getNonDeletedElements),\n/* harmony export */ getSceneVersion: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getSceneVersion),\n/* harmony export */ getSharedMermaidInstance: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getSharedMermaidInstance),\n/* harmony export */ getTextFromElements: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getTextFromElements),\n/* harmony export */ getVisibleSceneBounds: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getVisibleSceneBounds),\n/* harmony export */ hashElementsVersion: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.hashElementsVersion),\n/* harmony export */ hashString: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.hashString),\n/* harmony export */ intersectElementWithLine: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.intersectElementWithLine),\n/* harmony export */ isElementInsideBBox: () => (/* reexport safe */ _excalidraw_utils_withinBounds__WEBPACK_IMPORTED_MODULE_40__.isElementInsideBBox),\n/* harmony export */ isElementLink: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.isElementLink),\n/* harmony export */ isInvisiblySmallElement: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.isInvisiblySmallElement),\n/* harmony export */ isLinearElement: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.isLinearElement),\n/* harmony export */ isSpreadsheetValidForChartType: () => (/* reexport safe */ _charts__WEBPACK_IMPORTED_MODULE_44__.isSpreadsheetValidForChartType),\n/* harmony export */ languages: () => (/* reexport safe */ _i18n__WEBPACK_IMPORTED_MODULE_8__.languages),\n/* harmony export */ loadFromBlob: () => (/* reexport safe */ _data_blob__WEBPACK_IMPORTED_MODULE_28__.loadFromBlob),\n/* harmony export */ loadLibraryFromBlob: () => (/* reexport safe */ _data_blob__WEBPACK_IMPORTED_MODULE_28__.loadLibraryFromBlob),\n/* harmony export */ loadMermaid: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.loadMermaid),\n/* harmony export */ loadSceneFonts: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.loadSceneFonts),\n/* harmony export */ loadSceneOrLibraryFromBlob: () => (/* reexport safe */ _data_blob__WEBPACK_IMPORTED_MODULE_28__.loadSceneOrLibraryFromBlob),\n/* harmony export */ measureText: () => (/* reexport safe */ _excalidraw_element_textMeasurements__WEBPACK_IMPORTED_MODULE_21__.measureText),\n/* harmony export */ mergeLibraryItems: () => (/* reexport safe */ _data_library__WEBPACK_IMPORTED_MODULE_29__.mergeLibraryItems),\n/* harmony export */ mermaidToExcalidraw: () => (/* reexport safe */ _components_TTDDialog_MermaidToExcalidrawLib__WEBPACK_IMPORTED_MODULE_24__.mermaidToExcalidraw),\n/* harmony export */ mutateElement: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.mutateElement),\n/* harmony export */ newElementWith: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.newElementWith),\n/* harmony export */ normalizeLink: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.normalizeLink),\n/* harmony export */ parseLibraryTokensFromUrl: () => (/* reexport safe */ _data_library__WEBPACK_IMPORTED_MODULE_29__.parseLibraryTokensFromUrl),\n/* harmony export */ reconcileElements: () => (/* reexport safe */ _data_reconcile__WEBPACK_IMPORTED_MODULE_17__.reconcileElements),\n/* harmony export */ refreshTextDimensions: () => (/* reexport safe */ _excalidraw_element_newElement__WEBPACK_IMPORTED_MODULE_26__.refreshTextDimensions),\n/* harmony export */ registerFontsInCSS: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.registerFontsInCSS),\n/* harmony export */ registerLocalFont: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.registerLocalFont),\n/* harmony export */ renderSpreadsheet: () => (/* reexport safe */ _charts__WEBPACK_IMPORTED_MODULE_44__.renderSpreadsheet),\n/* harmony export */ restoreAppState: () => (/* reexport safe */ _data_restore__WEBPACK_IMPORTED_MODULE_16__.restoreAppState),\n/* harmony export */ restoreElement: () => (/* reexport safe */ _data_restore__WEBPACK_IMPORTED_MODULE_16__.restoreElement),\n/* harmony export */ restoreElements: () => (/* reexport safe */ _data_restore__WEBPACK_IMPORTED_MODULE_16__.restoreElements),\n/* harmony export */ restoreLibraryItems: () => (/* reexport safe */ _data_restore__WEBPACK_IMPORTED_MODULE_16__.restoreLibraryItems),\n/* harmony export */ safelyParseJSON: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.safelyParseJSON),\n/* harmony export */ sceneCoordsToViewportCoords: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.sceneCoordsToViewportCoords),\n/* harmony export */ serializeAsJSON: () => (/* reexport safe */ _data_json__WEBPACK_IMPORTED_MODULE_27__.serializeAsJSON),\n/* harmony export */ serializeLibraryAsJSON: () => (/* reexport safe */ _data_json__WEBPACK_IMPORTED_MODULE_27__.serializeLibraryAsJSON),\n/* harmony export */ setCustomTextMetricsProvider: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.setCustomTextMetricsProvider),\n/* harmony export */ syncInvalidIndices: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.syncInvalidIndices),\n/* harmony export */ syncMovedIndices: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.syncMovedIndices),\n/* harmony export */ throttleRAF: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.throttleRAF),\n/* harmony export */ tryParseSpreadsheet: () => (/* reexport safe */ _charts__WEBPACK_IMPORTED_MODULE_44__.tryParseSpreadsheet),\n/* harmony export */ useEditorInterface: () => (/* reexport safe */ _components_App__WEBPACK_IMPORTED_MODULE_2__.useEditorInterface),\n/* harmony export */ useExcalidrawAPI: () => (/* reexport safe */ _components_App__WEBPACK_IMPORTED_MODULE_2__.useExcalidrawAPI),\n/* harmony export */ useExcalidrawStateValue: () => (/* binding */ useExcalidrawStateValue),\n/* harmony export */ useHandleLibrary: () => (/* reexport safe */ _data_library__WEBPACK_IMPORTED_MODULE_29__.useHandleLibrary),\n/* harmony export */ useI18n: () => (/* reexport safe */ _i18n__WEBPACK_IMPORTED_MODULE_8__.useI18n),\n/* harmony export */ useOnExcalidrawStateChange: () => (/* reexport safe */ _hooks_useAppStateValue__WEBPACK_IMPORTED_MODULE_9__.useOnAppStateChange),\n/* harmony export */ useStylesPanelMode: () => (/* reexport safe */ _components_App__WEBPACK_IMPORTED_MODULE_2__.useStylesPanelMode),\n/* harmony export */ viewportCoordsToSceneCoords: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.viewportCoordsToSceneCoords),\n/* harmony export */ wrapText: () => (/* reexport safe */ _excalidraw_element_textWrapping__WEBPACK_IMPORTED_MODULE_22__.wrapText),\n/* harmony export */ zoomToFitBounds: () => (/* reexport safe */ _actions_actionCanvas__WEBPACK_IMPORTED_MODULE_39__.zoomToFitBounds)\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 _components_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/App */ \"./components/App.tsx\");\n/* harmony import */ var _components_InitializeApp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/InitializeApp */ \"./components/InitializeApp.tsx\");\n/* harmony import */ var _components_footer_FooterCenter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/footer/FooterCenter */ \"./components/footer/FooterCenter.tsx\");\n/* harmony import */ var _components_live_collaboration_LiveCollaborationTrigger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/live-collaboration/LiveCollaborationTrigger */ \"./components/live-collaboration/LiveCollaborationTrigger.tsx\");\n/* harmony import */ var _components_main_menu_MainMenu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/main-menu/MainMenu */ \"./components/main-menu/MainMenu.tsx\");\n/* harmony import */ var _components_welcome_screen_WelcomeScreen__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/welcome-screen/WelcomeScreen */ \"./components/welcome-screen/WelcomeScreen.tsx\");\n/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./i18n */ \"./i18n.ts\");\n/* harmony import */ var _hooks_useAppStateValue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./hooks/useAppStateValue */ \"./hooks/useAppStateValue.ts\");\n/* harmony import */ var _editor_jotai__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./editor-jotai */ \"./editor-jotai.ts\");\n/* harmony import */ var _polyfill__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./polyfill */ \"./polyfill.ts\");\n/* harmony import */ var _css_app_scss__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./css/app.scss */ \"./css/app.scss\");\n/* harmony import */ var _css_styles_scss__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./css/styles.scss */ \"./css/styles.scss\");\n/* harmony import */ var _fonts_fonts_css__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./fonts/fonts.css */ \"./fonts/fonts.css\");\n/* harmony import */ var _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _data_restore__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./data/restore */ \"./data/restore.ts\");\n/* harmony import */ var _data_reconcile__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./data/reconcile */ \"./data/reconcile.ts\");\n/* harmony import */ var _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @excalidraw/utils/export */ \"../utils/src/export.ts\");\n/* harmony import */ var _excalidraw_element_bounds__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @excalidraw/element/bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _excalidraw_element_groups__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @excalidraw/element/groups */ \"../element/src/groups.ts\");\n/* harmony import */ var _excalidraw_element_textMeasurements__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @excalidraw/element/textMeasurements */ \"../element/src/textMeasurements.ts\");\n/* harmony import */ var _excalidraw_element_textWrapping__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! @excalidraw/element/textWrapping */ \"../element/src/textWrapping.ts\");\n/* harmony import */ var _excalidraw_element_textElement__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! @excalidraw/element/textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _components_TTDDialog_MermaidToExcalidrawLib__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./components/TTDDialog/MermaidToExcalidrawLib */ \"./components/TTDDialog/MermaidToExcalidrawLib.ts\");\n/* harmony import */ var _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../excalidraw/obsidianUtils */ \"./obsidianUtils.ts\");\n/* harmony import */ var _excalidraw_element_newElement__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @excalidraw/element/newElement */ \"../element/src/newElement.ts\");\n/* harmony import */ var _data_json__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./data/json */ \"./data/json.ts\");\n/* harmony import */ var _data_blob__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./data/blob */ \"./data/blob.ts\");\n/* harmony import */ var _data_library__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./data/library */ \"./data/library.ts\");\n/* harmony import */ var _excalidraw_element_embeddable__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! @excalidraw/element/embeddable */ \"../element/src/embeddable.ts\");\n/* harmony import */ var _components_Sidebar_Sidebar__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./components/Sidebar/Sidebar */ \"./components/Sidebar/Sidebar.tsx\");\n/* harmony import */ var _components_Button__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./components/Button */ \"./components/Button.tsx\");\n/* harmony import */ var _components_Ellipsify__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./components/Ellipsify */ \"./components/Ellipsify.tsx\");\n/* harmony import */ var _components_Stats__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./components/Stats */ \"./components/Stats/index.tsx\");\n/* harmony import */ var _components_DefaultSidebar__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./components/DefaultSidebar */ \"./components/DefaultSidebar.tsx\");\n/* harmony import */ var _components_TTDDialog_TTDDialog__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./components/TTDDialog/TTDDialog */ \"./components/TTDDialog/TTDDialog.tsx\");\n/* harmony import */ var _components_TTDDialog_TTDDialogTrigger__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./components/TTDDialog/TTDDialogTrigger */ \"./components/TTDDialog/TTDDialogTrigger.tsx\");\n/* harmony import */ var _components_TTDDialog_utils_TTDStreamFetch__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./components/TTDDialog/utils/TTDStreamFetch */ \"./components/TTDDialog/utils/TTDStreamFetch.ts\");\n/* harmony import */ var _actions_actionCanvas__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./actions/actionCanvas */ \"./actions/actionCanvas.tsx\");\n/* harmony import */ var _excalidraw_utils_withinBounds__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! @excalidraw/utils/withinBounds */ \"../utils/src/withinBounds.ts\");\n/* harmony import */ var _components_DiagramToCodePlugin_DiagramToCodePlugin__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./components/DiagramToCodePlugin/DiagramToCodePlugin */ \"./components/DiagramToCodePlugin/DiagramToCodePlugin.tsx\");\n/* harmony import */ var _fonts_Fonts__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./fonts/Fonts */ \"./fonts/Fonts.ts\");\n/* harmony import */ var _components_CommandPalette_CommandPalette__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./components/CommandPalette/CommandPalette */ \"./components/CommandPalette/CommandPalette.tsx\");\n/* harmony import */ var _charts__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./charts */ \"./charts/index.ts\");\nvar __rest = undefined && undefined.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n(0,_polyfill__WEBPACK_IMPORTED_MODULE_11__[\"default\"])();\n/**\n * Stateless provider that allows `useExcalidrawAPI()` (and hooks built\n * on it, such as `useAppStateValue()` and `useOnAppStateChange()`) to work\n * outside the <Excalidraw> component tree.\n */\n\nconst ExcalidrawAPIProvider = ({\n children\n}) => {\n const [api, setApi] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_App__WEBPACK_IMPORTED_MODULE_2__.ExcalidrawAPIContext.Provider, {\n value: api\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_App__WEBPACK_IMPORTED_MODULE_2__.ExcalidrawAPISetContext.Provider, {\n value: setApi\n }, children));\n};\n\nconst ExcalidrawBase = props => {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n\n const {\n onExport,\n onChange,\n onIncrement,\n initialData,\n onExcalidrawAPI,\n onMount,\n onUnmount,\n onInitialize,\n isCollaborating = false,\n onPointerUpdate,\n renderTopLeftUI,\n renderTopRightUI,\n langCode = _i18n__WEBPACK_IMPORTED_MODULE_8__.defaultLang.code,\n viewModeEnabled,\n zenModeEnabled,\n gridModeEnabled,\n initState,\n //zsviczian\n libraryReturnUrl,\n theme,\n name,\n renderCustomStats,\n onPaste,\n onDrop,\n //zsviczian\n detectScroll = true,\n handleKeyboardGlobally = false,\n onLibraryChange,\n autoFocus = false,\n onBeforeTextEdit,\n //zsviczian\n onBeforeTextSubmit,\n //zsviczian\n generateIdForFile,\n onThemeChange,\n //zsviczian\n onLinkOpen,\n onLinkHover,\n //zsviczian\n onViewModeChange,\n //zsviczian\n generateLinkForSelection,\n onPointerDown,\n onPointerUp,\n onScrollChange,\n onDuplicate,\n children,\n validateEmbeddable,\n renderEmbeddable,\n renderWebview,\n //zsviczian\n renderEmbeddableMenu,\n //zsviczian\n renderMermaid,\n //zsviczian\n onContextMenu,\n //zsviczian\n aiEnabled,\n showDeprecatedFonts,\n insertLinkAction,\n //zsviczian\n renderScrollbars,\n imageOptions\n } = props;\n const canvasActions = (_a = props.UIOptions) === null || _a === void 0 ? void 0 : _a.canvasActions; // FIXME normalize/set defaults in parent component so that the memo resolver\n // compares the same values\n\n const UIOptions = Object.assign(Object.assign({}, props.UIOptions), {\n canvasActions: Object.assign(Object.assign({}, _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_UI_OPTIONS.canvasActions), canvasActions),\n tools: {\n image: (_d = (_c = (_b = props.UIOptions) === null || _b === void 0 ? void 0 : _b.tools) === null || _c === void 0 ? void 0 : _c.image) !== null && _d !== void 0 ? _d : true\n }\n });\n\n if (canvasActions === null || canvasActions === void 0 ? void 0 : canvasActions.export) {\n UIOptions.canvasActions.export.saveFileToDisk = (_f = (_e = canvasActions.export) === null || _e === void 0 ? void 0 : _e.saveFileToDisk) !== null && _f !== void 0 ? _f : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_UI_OPTIONS.canvasActions.export.saveFileToDisk;\n }\n\n if (UIOptions.canvasActions.toggleTheme === null && typeof theme === \"undefined\") {\n UIOptions.canvasActions.toggleTheme = true;\n }\n\n const normalizedImageOptions = {\n maxFileSizeBytes: (_g = imageOptions === null || imageOptions === void 0 ? void 0 : imageOptions.maxFileSizeBytes) !== null && _g !== void 0 ? _g : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxFileSizeBytes,\n maxWidthOrHeight: (_h = imageOptions === null || imageOptions === void 0 ? void 0 : imageOptions.maxWidthOrHeight) !== null && _h !== void 0 ? _h : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxWidthOrHeight\n };\n const setExcalidrawAPI = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_components_App__WEBPACK_IMPORTED_MODULE_2__.ExcalidrawAPISetContext);\n const onExcalidrawAPIRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onExcalidrawAPI);\n onExcalidrawAPIRef.current = onExcalidrawAPI;\n const handleExcalidrawAPI = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(api => {\n var _a;\n\n setExcalidrawAPI === null || setExcalidrawAPI === void 0 ? void 0 : setExcalidrawAPI(api);\n (_a = onExcalidrawAPIRef.current) === null || _a === void 0 ? void 0 : _a.call(onExcalidrawAPIRef, api);\n }, [setExcalidrawAPI]);\n (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n const importPolyfill = async () => {\n //@ts-ignore\n await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! canvas-roundrect-polyfill */ \"../../node_modules/canvas-roundrect-polyfill/roundRect.js\", 23));\n };\n\n importPolyfill(); // Block pinch-zooming on iOS outside of the content area\n\n const handleTouchMove = event => {\n // @ts-ignore\n if (typeof event.scale === \"number\" && event.scale !== 1) {\n event.preventDefault();\n }\n };\n\n document.addEventListener(\"touchmove\", handleTouchMove, {\n passive: false\n });\n return () => {\n document.removeEventListener(\"touchmove\", handleTouchMove);\n };\n }, []);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_editor_jotai__WEBPACK_IMPORTED_MODULE_10__.EditorJotaiProvider, {\n store: _editor_jotai__WEBPACK_IMPORTED_MODULE_10__.editorJotaiStore\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_InitializeApp__WEBPACK_IMPORTED_MODULE_3__.InitializeApp, {\n langCode: langCode,\n theme: theme\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_App__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n onExport: onExport,\n onChange: onChange,\n onIncrement: onIncrement,\n initialData: initialData,\n onExcalidrawAPI: handleExcalidrawAPI,\n onMount: onMount,\n onUnmount: onUnmount,\n onInitialize: onInitialize,\n isCollaborating: isCollaborating,\n onPointerUpdate: onPointerUpdate,\n renderTopLeftUI: renderTopLeftUI,\n renderTopRightUI: renderTopRightUI,\n langCode: langCode,\n viewModeEnabled: viewModeEnabled,\n zenModeEnabled: zenModeEnabled,\n gridModeEnabled: gridModeEnabled,\n initState: initState,\n libraryReturnUrl: libraryReturnUrl,\n theme: theme,\n name: name,\n renderCustomStats: renderCustomStats,\n UIOptions: UIOptions,\n onPaste: onPaste,\n onDrop: onDrop,\n detectScroll: detectScroll,\n handleKeyboardGlobally: handleKeyboardGlobally,\n onLibraryChange: onLibraryChange,\n autoFocus: autoFocus,\n onBeforeTextEdit: onBeforeTextEdit,\n onBeforeTextSubmit: onBeforeTextSubmit,\n generateIdForFile: generateIdForFile,\n onThemeChange: onThemeChange,\n onLinkOpen: onLinkOpen,\n onLinkHover: onLinkHover,\n onViewModeChange: onViewModeChange,\n generateLinkForSelection: generateLinkForSelection,\n onPointerDown: onPointerDown,\n onPointerUp: onPointerUp,\n onScrollChange: onScrollChange,\n onDuplicate: onDuplicate,\n validateEmbeddable: validateEmbeddable,\n renderEmbeddable: renderEmbeddable,\n renderWebview: renderWebview,\n renderEmbeddableMenu: renderEmbeddableMenu,\n renderMermaid: renderMermaid,\n onContextMenu: onContextMenu,\n aiEnabled: aiEnabled !== false,\n showDeprecatedFonts: showDeprecatedFonts,\n insertLinkAction: insertLinkAction,\n renderScrollbars: renderScrollbars,\n imageOptions: normalizedImageOptions\n }, children)));\n};\n\nconst areEqual = (prevProps, nextProps) => {\n var _a, _b, _c, _d; // short-circuit early\n\n\n if (prevProps.children !== nextProps.children) {\n return false;\n }\n\n const {\n initialData: prevInitialData,\n UIOptions: prevUIOptions = {},\n imageOptions: prevImageOptions\n } = prevProps,\n prev = __rest(prevProps, [\"initialData\", \"UIOptions\", \"imageOptions\"]);\n\n const {\n initialData: nextInitialData,\n UIOptions: nextUIOptions = {},\n imageOptions: nextImageOptions\n } = nextProps,\n next = __rest(nextProps, [\"initialData\", \"UIOptions\", \"imageOptions\"]); // comparing UIOptions\n\n\n const prevUIOptionsKeys = Object.keys(prevUIOptions);\n const nextUIOptionsKeys = Object.keys(nextUIOptions);\n\n if (prevUIOptionsKeys.length !== nextUIOptionsKeys.length) {\n return false;\n }\n\n const isUIOptionsSame = prevUIOptionsKeys.every(key => {\n if (key === \"getFormFactor\") {\n return true;\n }\n\n if (key === \"canvasActions\") {\n const canvasOptionKeys = Object.keys(prevUIOptions.canvasActions);\n return canvasOptionKeys.every(key => {\n var _a, _b, _c, _d;\n\n if (key === \"export\" && ((_a = prevUIOptions === null || prevUIOptions === void 0 ? void 0 : prevUIOptions.canvasActions) === null || _a === void 0 ? void 0 : _a.export) && ((_b = nextUIOptions === null || nextUIOptions === void 0 ? void 0 : nextUIOptions.canvasActions) === null || _b === void 0 ? void 0 : _b.export)) {\n return prevUIOptions.canvasActions.export.saveFileToDisk === nextUIOptions.canvasActions.export.saveFileToDisk;\n }\n\n return ((_c = prevUIOptions === null || prevUIOptions === void 0 ? void 0 : prevUIOptions.canvasActions) === null || _c === void 0 ? void 0 : _c[key]) === ((_d = nextUIOptions === null || nextUIOptions === void 0 ? void 0 : nextUIOptions.canvasActions) === null || _d === void 0 ? void 0 : _d[key]);\n });\n }\n\n return prevUIOptions[key] === nextUIOptions[key];\n });\n const isImageOptionsSame = ((_a = prevImageOptions === null || prevImageOptions === void 0 ? void 0 : prevImageOptions.maxWidthOrHeight) !== null && _a !== void 0 ? _a : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxWidthOrHeight) === ((_b = nextImageOptions === null || nextImageOptions === void 0 ? void 0 : nextImageOptions.maxWidthOrHeight) !== null && _b !== void 0 ? _b : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxWidthOrHeight) && ((_c = prevImageOptions === null || prevImageOptions === void 0 ? void 0 : prevImageOptions.maxFileSizeBytes) !== null && _c !== void 0 ? _c : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxFileSizeBytes) === ((_d = nextImageOptions === null || nextImageOptions === void 0 ? void 0 : nextImageOptions.maxFileSizeBytes) !== null && _d !== void 0 ? _d : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxFileSizeBytes);\n return isUIOptionsSame && isImageOptionsSame && (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.isShallowEqual)(prev, next);\n};\n\nconst Excalidraw = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().memo(ExcalidrawBase, areEqual);\nExcalidraw.displayName = \"Excalidraw\";\n\n\n\n\n\n\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n\n\n\n\n\n\n\n\n //zsviczian - not sure if I use it any more\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction useExcalidrawStateValue(selector) {\n return (0,_hooks_useAppStateValue__WEBPACK_IMPORTED_MODULE_9__.useAppStateValue)(selector, false);\n} // -----------------------------------------------------------------------------\n\n\n\n\n//# sourceURL=webpack://ExcalidrawLib/./index.tsx?\n}");
|
|
4613
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Button: () => (/* reexport safe */ _components_Button__WEBPACK_IMPORTED_MODULE_32__.Button),\n/* harmony export */ CaptureUpdateAction: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.CaptureUpdateAction),\n/* harmony export */ CommandPalette: () => (/* reexport safe */ _components_CommandPalette_CommandPalette__WEBPACK_IMPORTED_MODULE_42__.CommandPalette),\n/* harmony export */ DEFAULT_LASER_COLOR: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_LASER_COLOR),\n/* harmony export */ DefaultSidebar: () => (/* reexport safe */ _components_DefaultSidebar__WEBPACK_IMPORTED_MODULE_35__.DefaultSidebar),\n/* harmony export */ DiagramToCodePlugin: () => (/* reexport safe */ _components_DiagramToCodePlugin_DiagramToCodePlugin__WEBPACK_IMPORTED_MODULE_40__.DiagramToCodePlugin),\n/* harmony export */ Ellipsify: () => (/* reexport safe */ _components_Ellipsify__WEBPACK_IMPORTED_MODULE_33__.Ellipsify),\n/* harmony export */ Excalidraw: () => (/* binding */ Excalidraw),\n/* harmony export */ ExcalidrawAPIContext: () => (/* reexport safe */ _components_App__WEBPACK_IMPORTED_MODULE_2__.ExcalidrawAPIContext),\n/* harmony export */ ExcalidrawAPIProvider: () => (/* binding */ ExcalidrawAPIProvider),\n/* harmony export */ FONT_FAMILY: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.FONT_FAMILY),\n/* harmony export */ Fonts: () => (/* reexport safe */ _fonts_Fonts__WEBPACK_IMPORTED_MODULE_41__.Fonts),\n/* harmony export */ Footer: () => (/* reexport safe */ _components_footer_FooterCenter__WEBPACK_IMPORTED_MODULE_4__[\"default\"]),\n/* harmony export */ LiveCollaborationTrigger: () => (/* reexport safe */ _components_live_collaboration_LiveCollaborationTrigger__WEBPACK_IMPORTED_MODULE_5__[\"default\"]),\n/* harmony export */ MIME_TYPES: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.MIME_TYPES),\n/* harmony export */ MainMenu: () => (/* reexport safe */ _components_main_menu_MainMenu__WEBPACK_IMPORTED_MODULE_6__[\"default\"]),\n/* harmony export */ ROUNDNESS: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.ROUNDNESS),\n/* harmony export */ Sidebar: () => (/* reexport safe */ _components_Sidebar_Sidebar__WEBPACK_IMPORTED_MODULE_31__.Sidebar),\n/* harmony export */ Stats: () => (/* reexport safe */ _components_Stats__WEBPACK_IMPORTED_MODULE_34__.Stats),\n/* harmony export */ THEME: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.THEME),\n/* harmony export */ TTDDialog: () => (/* reexport safe */ _components_TTDDialog_TTDDialog__WEBPACK_IMPORTED_MODULE_36__.TTDDialog),\n/* harmony export */ TTDDialogTrigger: () => (/* reexport safe */ _components_TTDDialog_TTDDialogTrigger__WEBPACK_IMPORTED_MODULE_37__.TTDDialogTrigger),\n/* harmony export */ TTDStreamFetch: () => (/* reexport safe */ _components_TTDDialog_utils_TTDStreamFetch__WEBPACK_IMPORTED_MODULE_38__.TTDStreamFetch),\n/* harmony export */ UserIdleState: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.UserIdleState),\n/* harmony export */ WelcomeScreen: () => (/* reexport safe */ _components_welcome_screen_WelcomeScreen__WEBPACK_IMPORTED_MODULE_7__[\"default\"]),\n/* harmony export */ applyDarkModeFilter: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.applyDarkModeFilter),\n/* harmony export */ bumpVersion: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.bumpVersion),\n/* harmony export */ convertToExcalidrawElements: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.convertToExcalidrawElements),\n/* harmony export */ defaultLang: () => (/* reexport safe */ _i18n__WEBPACK_IMPORTED_MODULE_8__.defaultLang),\n/* harmony export */ destroyObsidianUtils: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.destroyObsidianUtils),\n/* harmony export */ elementsOverlappingBBox: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.elementsOverlappingBBox),\n/* harmony export */ exportToBlob: () => (/* reexport safe */ _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__.exportToBlob),\n/* harmony export */ exportToCanvas: () => (/* reexport safe */ _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__.exportToCanvas),\n/* harmony export */ exportToClipboard: () => (/* reexport safe */ _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__.exportToClipboard),\n/* harmony export */ exportToSvg: () => (/* reexport safe */ _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__.exportToSvg),\n/* harmony export */ getBoundTextMaxWidth: () => (/* reexport safe */ _excalidraw_element_textElement__WEBPACK_IMPORTED_MODULE_23__.getBoundTextMaxWidth),\n/* harmony export */ getCSSFontDefinition: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getCSSFontDefinition),\n/* harmony export */ getCommonBoundingBox: () => (/* reexport safe */ _excalidraw_element_bounds__WEBPACK_IMPORTED_MODULE_19__.getCommonBoundingBox),\n/* harmony export */ getCommonBounds: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getCommonBounds),\n/* harmony export */ getContainerElement: () => (/* reexport safe */ _excalidraw_element_textElement__WEBPACK_IMPORTED_MODULE_23__.getContainerElement),\n/* harmony export */ getDataURL: () => (/* reexport safe */ _data_blob__WEBPACK_IMPORTED_MODULE_28__.getDataURL),\n/* harmony export */ getDefaultColorPalette: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getDefaultColorPalette),\n/* harmony export */ getEmbedLink: () => (/* reexport safe */ _excalidraw_element_embeddable__WEBPACK_IMPORTED_MODULE_30__.getEmbedLink),\n/* harmony export */ getFontFamilies: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getFontFamilies),\n/* harmony export */ getFontFamilyString: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getFontFamilyString),\n/* harmony export */ getFontMetrics: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getFontMetrics),\n/* harmony export */ getFontString: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getFontString),\n/* harmony export */ getFormFactor: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getFormFactor),\n/* harmony export */ getLibraryItemsHash: () => (/* reexport safe */ _data_library__WEBPACK_IMPORTED_MODULE_29__.getLibraryItemsHash),\n/* harmony export */ getLineHeight: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.getLineHeight),\n/* harmony export */ getMaximumGroups: () => (/* reexport safe */ _excalidraw_element_groups__WEBPACK_IMPORTED_MODULE_20__.getMaximumGroups),\n/* harmony export */ getNonDeletedElements: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getNonDeletedElements),\n/* harmony export */ getSceneVersion: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getSceneVersion),\n/* harmony export */ getSharedMermaidInstance: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.getSharedMermaidInstance),\n/* harmony export */ getTextFromElements: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getTextFromElements),\n/* harmony export */ getVisibleSceneBounds: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.getVisibleSceneBounds),\n/* harmony export */ hashElementsVersion: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.hashElementsVersion),\n/* harmony export */ hashString: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.hashString),\n/* harmony export */ intersectElementWithLine: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.intersectElementWithLine),\n/* harmony export */ isElementLink: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.isElementLink),\n/* harmony export */ isInvisiblySmallElement: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.isInvisiblySmallElement),\n/* harmony export */ isLinearElement: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.isLinearElement),\n/* harmony export */ isSpreadsheetValidForChartType: () => (/* reexport safe */ _charts__WEBPACK_IMPORTED_MODULE_43__.isSpreadsheetValidForChartType),\n/* harmony export */ languages: () => (/* reexport safe */ _i18n__WEBPACK_IMPORTED_MODULE_8__.languages),\n/* harmony export */ loadFromBlob: () => (/* reexport safe */ _data_blob__WEBPACK_IMPORTED_MODULE_28__.loadFromBlob),\n/* harmony export */ loadLibraryFromBlob: () => (/* reexport safe */ _data_blob__WEBPACK_IMPORTED_MODULE_28__.loadLibraryFromBlob),\n/* harmony export */ loadMermaid: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.loadMermaid),\n/* harmony export */ loadSceneFonts: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.loadSceneFonts),\n/* harmony export */ loadSceneOrLibraryFromBlob: () => (/* reexport safe */ _data_blob__WEBPACK_IMPORTED_MODULE_28__.loadSceneOrLibraryFromBlob),\n/* harmony export */ measureText: () => (/* reexport safe */ _excalidraw_element_textMeasurements__WEBPACK_IMPORTED_MODULE_21__.measureText),\n/* harmony export */ mergeLibraryItems: () => (/* reexport safe */ _data_library__WEBPACK_IMPORTED_MODULE_29__.mergeLibraryItems),\n/* harmony export */ mermaidToExcalidraw: () => (/* reexport safe */ _components_TTDDialog_MermaidToExcalidrawLib__WEBPACK_IMPORTED_MODULE_24__.mermaidToExcalidraw),\n/* harmony export */ mutateElement: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.mutateElement),\n/* harmony export */ newElementWith: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.newElementWith),\n/* harmony export */ normalizeLink: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.normalizeLink),\n/* harmony export */ parseLibraryTokensFromUrl: () => (/* reexport safe */ _data_library__WEBPACK_IMPORTED_MODULE_29__.parseLibraryTokensFromUrl),\n/* harmony export */ reconcileElements: () => (/* reexport safe */ _data_reconcile__WEBPACK_IMPORTED_MODULE_17__.reconcileElements),\n/* harmony export */ refreshTextDimensions: () => (/* reexport safe */ _excalidraw_element_newElement__WEBPACK_IMPORTED_MODULE_26__.refreshTextDimensions),\n/* harmony export */ registerFontsInCSS: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.registerFontsInCSS),\n/* harmony export */ registerLocalFont: () => (/* reexport safe */ _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__.registerLocalFont),\n/* harmony export */ renderSpreadsheet: () => (/* reexport safe */ _charts__WEBPACK_IMPORTED_MODULE_43__.renderSpreadsheet),\n/* harmony export */ restoreAppState: () => (/* reexport safe */ _data_restore__WEBPACK_IMPORTED_MODULE_16__.restoreAppState),\n/* harmony export */ restoreElement: () => (/* reexport safe */ _data_restore__WEBPACK_IMPORTED_MODULE_16__.restoreElement),\n/* harmony export */ restoreElements: () => (/* reexport safe */ _data_restore__WEBPACK_IMPORTED_MODULE_16__.restoreElements),\n/* harmony export */ restoreLibraryItems: () => (/* reexport safe */ _data_restore__WEBPACK_IMPORTED_MODULE_16__.restoreLibraryItems),\n/* harmony export */ safelyParseJSON: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.safelyParseJSON),\n/* harmony export */ sceneCoordsToViewportCoords: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.sceneCoordsToViewportCoords),\n/* harmony export */ serializeAsJSON: () => (/* reexport safe */ _data_json__WEBPACK_IMPORTED_MODULE_27__.serializeAsJSON),\n/* harmony export */ serializeLibraryAsJSON: () => (/* reexport safe */ _data_json__WEBPACK_IMPORTED_MODULE_27__.serializeLibraryAsJSON),\n/* harmony export */ setCustomTextMetricsProvider: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.setCustomTextMetricsProvider),\n/* harmony export */ syncInvalidIndices: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.syncInvalidIndices),\n/* harmony export */ syncMovedIndices: () => (/* reexport safe */ _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__.syncMovedIndices),\n/* harmony export */ throttleRAF: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.throttleRAF),\n/* harmony export */ tryParseSpreadsheet: () => (/* reexport safe */ _charts__WEBPACK_IMPORTED_MODULE_43__.tryParseSpreadsheet),\n/* harmony export */ useEditorInterface: () => (/* reexport safe */ _components_App__WEBPACK_IMPORTED_MODULE_2__.useEditorInterface),\n/* harmony export */ useExcalidrawAPI: () => (/* reexport safe */ _components_App__WEBPACK_IMPORTED_MODULE_2__.useExcalidrawAPI),\n/* harmony export */ useExcalidrawStateValue: () => (/* binding */ useExcalidrawStateValue),\n/* harmony export */ useHandleLibrary: () => (/* reexport safe */ _data_library__WEBPACK_IMPORTED_MODULE_29__.useHandleLibrary),\n/* harmony export */ useI18n: () => (/* reexport safe */ _i18n__WEBPACK_IMPORTED_MODULE_8__.useI18n),\n/* harmony export */ useOnExcalidrawStateChange: () => (/* reexport safe */ _hooks_useAppStateValue__WEBPACK_IMPORTED_MODULE_9__.useOnAppStateChange),\n/* harmony export */ useStylesPanelMode: () => (/* reexport safe */ _components_App__WEBPACK_IMPORTED_MODULE_2__.useStylesPanelMode),\n/* harmony export */ viewportCoordsToSceneCoords: () => (/* reexport safe */ _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.viewportCoordsToSceneCoords),\n/* harmony export */ wrapText: () => (/* reexport safe */ _excalidraw_element_textWrapping__WEBPACK_IMPORTED_MODULE_22__.wrapText),\n/* harmony export */ zoomToFitBounds: () => (/* reexport safe */ _actions_actionCanvas__WEBPACK_IMPORTED_MODULE_39__.zoomToFitBounds)\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 _components_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/App */ \"./components/App.tsx\");\n/* harmony import */ var _components_InitializeApp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/InitializeApp */ \"./components/InitializeApp.tsx\");\n/* harmony import */ var _components_footer_FooterCenter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/footer/FooterCenter */ \"./components/footer/FooterCenter.tsx\");\n/* harmony import */ var _components_live_collaboration_LiveCollaborationTrigger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/live-collaboration/LiveCollaborationTrigger */ \"./components/live-collaboration/LiveCollaborationTrigger.tsx\");\n/* harmony import */ var _components_main_menu_MainMenu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/main-menu/MainMenu */ \"./components/main-menu/MainMenu.tsx\");\n/* harmony import */ var _components_welcome_screen_WelcomeScreen__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/welcome-screen/WelcomeScreen */ \"./components/welcome-screen/WelcomeScreen.tsx\");\n/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./i18n */ \"./i18n.ts\");\n/* harmony import */ var _hooks_useAppStateValue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./hooks/useAppStateValue */ \"./hooks/useAppStateValue.ts\");\n/* harmony import */ var _editor_jotai__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./editor-jotai */ \"./editor-jotai.ts\");\n/* harmony import */ var _polyfill__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./polyfill */ \"./polyfill.ts\");\n/* harmony import */ var _css_app_scss__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./css/app.scss */ \"./css/app.scss\");\n/* harmony import */ var _css_styles_scss__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./css/styles.scss */ \"./css/styles.scss\");\n/* harmony import */ var _fonts_fonts_css__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./fonts/fonts.css */ \"./fonts/fonts.css\");\n/* harmony import */ var _excalidraw_element__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _data_restore__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./data/restore */ \"./data/restore.ts\");\n/* harmony import */ var _data_reconcile__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./data/reconcile */ \"./data/reconcile.ts\");\n/* harmony import */ var _excalidraw_utils_export__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @excalidraw/utils/export */ \"../utils/src/export.ts\");\n/* harmony import */ var _excalidraw_element_bounds__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @excalidraw/element/bounds */ \"../element/src/bounds.ts\");\n/* harmony import */ var _excalidraw_element_groups__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @excalidraw/element/groups */ \"../element/src/groups.ts\");\n/* harmony import */ var _excalidraw_element_textMeasurements__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @excalidraw/element/textMeasurements */ \"../element/src/textMeasurements.ts\");\n/* harmony import */ var _excalidraw_element_textWrapping__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! @excalidraw/element/textWrapping */ \"../element/src/textWrapping.ts\");\n/* harmony import */ var _excalidraw_element_textElement__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! @excalidraw/element/textElement */ \"../element/src/textElement.ts\");\n/* harmony import */ var _components_TTDDialog_MermaidToExcalidrawLib__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./components/TTDDialog/MermaidToExcalidrawLib */ \"./components/TTDDialog/MermaidToExcalidrawLib.ts\");\n/* harmony import */ var _excalidraw_obsidianUtils__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../excalidraw/obsidianUtils */ \"./obsidianUtils.ts\");\n/* harmony import */ var _excalidraw_element_newElement__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @excalidraw/element/newElement */ \"../element/src/newElement.ts\");\n/* harmony import */ var _data_json__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./data/json */ \"./data/json.ts\");\n/* harmony import */ var _data_blob__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./data/blob */ \"./data/blob.ts\");\n/* harmony import */ var _data_library__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./data/library */ \"./data/library.ts\");\n/* harmony import */ var _excalidraw_element_embeddable__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! @excalidraw/element/embeddable */ \"../element/src/embeddable.ts\");\n/* harmony import */ var _components_Sidebar_Sidebar__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./components/Sidebar/Sidebar */ \"./components/Sidebar/Sidebar.tsx\");\n/* harmony import */ var _components_Button__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./components/Button */ \"./components/Button.tsx\");\n/* harmony import */ var _components_Ellipsify__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./components/Ellipsify */ \"./components/Ellipsify.tsx\");\n/* harmony import */ var _components_Stats__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./components/Stats */ \"./components/Stats/index.tsx\");\n/* harmony import */ var _components_DefaultSidebar__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./components/DefaultSidebar */ \"./components/DefaultSidebar.tsx\");\n/* harmony import */ var _components_TTDDialog_TTDDialog__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./components/TTDDialog/TTDDialog */ \"./components/TTDDialog/TTDDialog.tsx\");\n/* harmony import */ var _components_TTDDialog_TTDDialogTrigger__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./components/TTDDialog/TTDDialogTrigger */ \"./components/TTDDialog/TTDDialogTrigger.tsx\");\n/* harmony import */ var _components_TTDDialog_utils_TTDStreamFetch__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./components/TTDDialog/utils/TTDStreamFetch */ \"./components/TTDDialog/utils/TTDStreamFetch.ts\");\n/* harmony import */ var _actions_actionCanvas__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./actions/actionCanvas */ \"./actions/actionCanvas.tsx\");\n/* harmony import */ var _components_DiagramToCodePlugin_DiagramToCodePlugin__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./components/DiagramToCodePlugin/DiagramToCodePlugin */ \"./components/DiagramToCodePlugin/DiagramToCodePlugin.tsx\");\n/* harmony import */ var _fonts_Fonts__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./fonts/Fonts */ \"./fonts/Fonts.ts\");\n/* harmony import */ var _components_CommandPalette_CommandPalette__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./components/CommandPalette/CommandPalette */ \"./components/CommandPalette/CommandPalette.tsx\");\n/* harmony import */ var _charts__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./charts */ \"./charts/index.ts\");\nvar __rest = undefined && undefined.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n(0,_polyfill__WEBPACK_IMPORTED_MODULE_11__[\"default\"])();\n/**\n * Stateless provider that allows `useExcalidrawAPI()` (and hooks built\n * on it, such as `useAppStateValue()` and `useOnAppStateChange()`) to work\n * outside the <Excalidraw> component tree.\n */\n\nconst ExcalidrawAPIProvider = ({\n children\n}) => {\n const [api, setApi] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_App__WEBPACK_IMPORTED_MODULE_2__.ExcalidrawAPIContext.Provider, {\n value: api\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_App__WEBPACK_IMPORTED_MODULE_2__.ExcalidrawAPISetContext.Provider, {\n value: setApi\n }, children));\n};\n\nconst ExcalidrawBase = props => {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n\n const {\n onExport,\n onChange,\n onIncrement,\n initialData,\n onExcalidrawAPI,\n onMount,\n onUnmount,\n onInitialize,\n isCollaborating = false,\n onPointerUpdate,\n renderTopLeftUI,\n renderTopRightUI,\n langCode = _i18n__WEBPACK_IMPORTED_MODULE_8__.defaultLang.code,\n viewModeEnabled,\n zenModeEnabled,\n gridModeEnabled,\n initState,\n //zsviczian\n libraryReturnUrl,\n theme,\n name,\n renderCustomStats,\n onPaste,\n onDrop,\n //zsviczian\n detectScroll = true,\n handleKeyboardGlobally = false,\n onLibraryChange,\n autoFocus = false,\n onBeforeTextEdit,\n //zsviczian\n onBeforeTextSubmit,\n //zsviczian\n generateIdForFile,\n onThemeChange,\n //zsviczian\n onLinkOpen,\n onLinkHover,\n //zsviczian\n onViewModeChange,\n //zsviczian\n generateLinkForSelection,\n onPointerDown,\n onPointerUp,\n onScrollChange,\n onDuplicate,\n children,\n validateEmbeddable,\n renderEmbeddable,\n renderWebview,\n //zsviczian\n renderEmbeddableMenu,\n //zsviczian\n renderMermaid,\n //zsviczian\n onContextMenu,\n //zsviczian\n aiEnabled,\n showDeprecatedFonts,\n insertLinkAction,\n //zsviczian\n renderScrollbars,\n imageOptions\n } = props;\n const canvasActions = (_a = props.UIOptions) === null || _a === void 0 ? void 0 : _a.canvasActions; // FIXME normalize/set defaults in parent component so that the memo resolver\n // compares the same values\n\n const UIOptions = Object.assign(Object.assign({}, props.UIOptions), {\n canvasActions: Object.assign(Object.assign({}, _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_UI_OPTIONS.canvasActions), canvasActions),\n tools: {\n image: (_d = (_c = (_b = props.UIOptions) === null || _b === void 0 ? void 0 : _b.tools) === null || _c === void 0 ? void 0 : _c.image) !== null && _d !== void 0 ? _d : true\n }\n });\n\n if (canvasActions === null || canvasActions === void 0 ? void 0 : canvasActions.export) {\n UIOptions.canvasActions.export.saveFileToDisk = (_f = (_e = canvasActions.export) === null || _e === void 0 ? void 0 : _e.saveFileToDisk) !== null && _f !== void 0 ? _f : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_UI_OPTIONS.canvasActions.export.saveFileToDisk;\n }\n\n if (UIOptions.canvasActions.toggleTheme === null && typeof theme === \"undefined\") {\n UIOptions.canvasActions.toggleTheme = true;\n }\n\n const normalizedImageOptions = {\n maxFileSizeBytes: (_g = imageOptions === null || imageOptions === void 0 ? void 0 : imageOptions.maxFileSizeBytes) !== null && _g !== void 0 ? _g : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxFileSizeBytes,\n maxWidthOrHeight: (_h = imageOptions === null || imageOptions === void 0 ? void 0 : imageOptions.maxWidthOrHeight) !== null && _h !== void 0 ? _h : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxWidthOrHeight\n };\n const setExcalidrawAPI = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_components_App__WEBPACK_IMPORTED_MODULE_2__.ExcalidrawAPISetContext);\n const onExcalidrawAPIRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onExcalidrawAPI);\n onExcalidrawAPIRef.current = onExcalidrawAPI;\n const handleExcalidrawAPI = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(api => {\n var _a;\n\n setExcalidrawAPI === null || setExcalidrawAPI === void 0 ? void 0 : setExcalidrawAPI(api);\n (_a = onExcalidrawAPIRef.current) === null || _a === void 0 ? void 0 : _a.call(onExcalidrawAPIRef, api);\n }, [setExcalidrawAPI]);\n (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n const importPolyfill = async () => {\n //@ts-ignore\n await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! canvas-roundrect-polyfill */ \"../../node_modules/canvas-roundrect-polyfill/roundRect.js\", 23));\n };\n\n importPolyfill(); // Block pinch-zooming on iOS outside of the content area\n\n const handleTouchMove = event => {\n // @ts-ignore\n if (typeof event.scale === \"number\" && event.scale !== 1) {\n event.preventDefault();\n }\n };\n\n document.addEventListener(\"touchmove\", handleTouchMove, {\n passive: false\n });\n return () => {\n document.removeEventListener(\"touchmove\", handleTouchMove);\n };\n }, []);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_editor_jotai__WEBPACK_IMPORTED_MODULE_10__.EditorJotaiProvider, {\n store: _editor_jotai__WEBPACK_IMPORTED_MODULE_10__.editorJotaiStore\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_InitializeApp__WEBPACK_IMPORTED_MODULE_3__.InitializeApp, {\n langCode: langCode,\n theme: theme\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_App__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n onExport: onExport,\n onChange: onChange,\n onIncrement: onIncrement,\n initialData: initialData,\n onExcalidrawAPI: handleExcalidrawAPI,\n onMount: onMount,\n onUnmount: onUnmount,\n onInitialize: onInitialize,\n isCollaborating: isCollaborating,\n onPointerUpdate: onPointerUpdate,\n renderTopLeftUI: renderTopLeftUI,\n renderTopRightUI: renderTopRightUI,\n langCode: langCode,\n viewModeEnabled: viewModeEnabled,\n zenModeEnabled: zenModeEnabled,\n gridModeEnabled: gridModeEnabled,\n initState: initState,\n libraryReturnUrl: libraryReturnUrl,\n theme: theme,\n name: name,\n renderCustomStats: renderCustomStats,\n UIOptions: UIOptions,\n onPaste: onPaste,\n onDrop: onDrop,\n detectScroll: detectScroll,\n handleKeyboardGlobally: handleKeyboardGlobally,\n onLibraryChange: onLibraryChange,\n autoFocus: autoFocus,\n onBeforeTextEdit: onBeforeTextEdit,\n onBeforeTextSubmit: onBeforeTextSubmit,\n generateIdForFile: generateIdForFile,\n onThemeChange: onThemeChange,\n onLinkOpen: onLinkOpen,\n onLinkHover: onLinkHover,\n onViewModeChange: onViewModeChange,\n generateLinkForSelection: generateLinkForSelection,\n onPointerDown: onPointerDown,\n onPointerUp: onPointerUp,\n onScrollChange: onScrollChange,\n onDuplicate: onDuplicate,\n validateEmbeddable: validateEmbeddable,\n renderEmbeddable: renderEmbeddable,\n renderWebview: renderWebview,\n renderEmbeddableMenu: renderEmbeddableMenu,\n renderMermaid: renderMermaid,\n onContextMenu: onContextMenu,\n aiEnabled: aiEnabled !== false,\n showDeprecatedFonts: showDeprecatedFonts,\n insertLinkAction: insertLinkAction,\n renderScrollbars: renderScrollbars,\n imageOptions: normalizedImageOptions\n }, children)));\n};\n\nconst areEqual = (prevProps, nextProps) => {\n var _a, _b, _c, _d; // short-circuit early\n\n\n if (prevProps.children !== nextProps.children) {\n return false;\n }\n\n const {\n initialData: prevInitialData,\n UIOptions: prevUIOptions = {},\n imageOptions: prevImageOptions\n } = prevProps,\n prev = __rest(prevProps, [\"initialData\", \"UIOptions\", \"imageOptions\"]);\n\n const {\n initialData: nextInitialData,\n UIOptions: nextUIOptions = {},\n imageOptions: nextImageOptions\n } = nextProps,\n next = __rest(nextProps, [\"initialData\", \"UIOptions\", \"imageOptions\"]); // comparing UIOptions\n\n\n const prevUIOptionsKeys = Object.keys(prevUIOptions);\n const nextUIOptionsKeys = Object.keys(nextUIOptions);\n\n if (prevUIOptionsKeys.length !== nextUIOptionsKeys.length) {\n return false;\n }\n\n const isUIOptionsSame = prevUIOptionsKeys.every(key => {\n if (key === \"getFormFactor\") {\n return true;\n }\n\n if (key === \"canvasActions\") {\n const canvasOptionKeys = Object.keys(prevUIOptions.canvasActions);\n return canvasOptionKeys.every(key => {\n var _a, _b, _c, _d;\n\n if (key === \"export\" && ((_a = prevUIOptions === null || prevUIOptions === void 0 ? void 0 : prevUIOptions.canvasActions) === null || _a === void 0 ? void 0 : _a.export) && ((_b = nextUIOptions === null || nextUIOptions === void 0 ? void 0 : nextUIOptions.canvasActions) === null || _b === void 0 ? void 0 : _b.export)) {\n return prevUIOptions.canvasActions.export.saveFileToDisk === nextUIOptions.canvasActions.export.saveFileToDisk;\n }\n\n return ((_c = prevUIOptions === null || prevUIOptions === void 0 ? void 0 : prevUIOptions.canvasActions) === null || _c === void 0 ? void 0 : _c[key]) === ((_d = nextUIOptions === null || nextUIOptions === void 0 ? void 0 : nextUIOptions.canvasActions) === null || _d === void 0 ? void 0 : _d[key]);\n });\n }\n\n return prevUIOptions[key] === nextUIOptions[key];\n });\n const isImageOptionsSame = ((_a = prevImageOptions === null || prevImageOptions === void 0 ? void 0 : prevImageOptions.maxWidthOrHeight) !== null && _a !== void 0 ? _a : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxWidthOrHeight) === ((_b = nextImageOptions === null || nextImageOptions === void 0 ? void 0 : nextImageOptions.maxWidthOrHeight) !== null && _b !== void 0 ? _b : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxWidthOrHeight) && ((_c = prevImageOptions === null || prevImageOptions === void 0 ? void 0 : prevImageOptions.maxFileSizeBytes) !== null && _c !== void 0 ? _c : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxFileSizeBytes) === ((_d = nextImageOptions === null || nextImageOptions === void 0 ? void 0 : nextImageOptions.maxFileSizeBytes) !== null && _d !== void 0 ? _d : _excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_IMAGE_OPTIONS.maxFileSizeBytes);\n return isUIOptionsSame && isImageOptionsSame && (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_1__.isShallowEqual)(prev, next);\n};\n\nconst Excalidraw = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().memo(ExcalidrawBase, areEqual);\nExcalidraw.displayName = \"Excalidraw\";\n\n\n\n\n\n\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n //zsviczian\n\n\n\n\n\n\n\n\n\n //zsviczian - not sure if I use it any more\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction useExcalidrawStateValue(selector) {\n return (0,_hooks_useAppStateValue__WEBPACK_IMPORTED_MODULE_9__.useAppStateValue)(selector, false);\n} // -----------------------------------------------------------------------------\n\n\n\n\n//# sourceURL=webpack://ExcalidrawLib/./index.tsx?\n}");
|
|
4636
4614
|
|
|
4637
4615
|
/***/ },
|
|
4638
4616
|
|
|
@@ -4709,7 +4687,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
4709
4687
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4710
4688
|
|
|
4711
4689
|
"use strict";
|
|
4712
|
-
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.
|
|
4690
|
+
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.98\"}/dist/`;\n}\n\n//# sourceURL=webpack://ExcalidrawLib/./publicPath.js?\n}");
|
|
4713
4691
|
|
|
4714
4692
|
/***/ },
|
|
4715
4693
|
|
|
@@ -4808,7 +4786,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
4808
4786
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4809
4787
|
|
|
4810
4788
|
"use strict";
|
|
4811
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ renderSceneToSvg: () => (/* binding */ renderSceneToSvg)\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_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _element_src_freedrawPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../element/src/freedrawPath */ \"../element/src/freedrawPath.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst roughSVGDrawWithPrecision = (rsvg, drawable, precision) => {\n if (typeof precision === \"undefined\") {\n return rsvg.draw(drawable);\n }\n\n const pshape = {\n sets: drawable.sets,\n shape: drawable.shape,\n options: Object.assign(Object.assign({}, drawable.options), {\n fixedDecimalPlaceDigits: precision\n })\n };\n return rsvg.draw(pshape);\n};\n\nconst maybeWrapNodesInFrameClipPath = (element, root, nodes, frameRendering, elementsMap) => {\n if (!frameRendering.enabled || !frameRendering.clip) {\n return null;\n }\n\n const frame = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getContainingFrame)(element, elementsMap);\n\n if (frame) {\n const g = root.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n g.setAttributeNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"clip-path\", `url(#${frame.id})`);\n nodes.forEach(node => g.appendChild(node));\n return g;\n }\n\n return null;\n};\n\nconst renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, offsetY, renderConfig) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;\n\n const offset = {\n x: offsetX,\n y: offsetY\n };\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getElementAbsoluteCoords)(element, elementsMap);\n let cx = (x2 - x1) / 2 - (element.x - x1);\n let cy = (y2 - y1) / 2 - (element.y - y1);\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isTextElement)(element)) {\n const container = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getContainerElement)(element, elementsMap);\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isArrowElement)(container)) {\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getElementAbsoluteCoords)(container, elementsMap);\n const boundTextCoords = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.LinearElementEditor.getBoundTextElementPosition(container, element, elementsMap);\n cx = (x2 - x1) / 2 - (boundTextCoords.x - x1);\n cy = (y2 - y1) / 2 - (boundTextCoords.y - y1);\n offsetX = offsetX + boundTextCoords.x - element.x;\n offsetY = offsetY + boundTextCoords.y - element.y;\n }\n }\n\n const degree = 180 * element.angle / Math.PI; // element to append node to, most of the time svgRoot\n\n let root = svgRoot; // if the element has a link, create an anchor tag and make that the new root\n\n if (element.link) {\n const anchorTag = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"a\");\n anchorTag.setAttribute(\"href\", (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.normalizeLink)(element.link));\n root.appendChild(anchorTag);\n root = anchorTag;\n }\n\n const addToRoot = (node, element) => {\n if ((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.isTestEnv)()) {\n node.setAttribute(\"data-id\", element.id);\n }\n\n root.appendChild(node);\n };\n\n const opacity = ((_b = (_a = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getContainingFrame)(element, elementsMap)) === null || _a === void 0 ? void 0 : _a.opacity) !== null && _b !== void 0 ? _b : 100) * element.opacity / 10000;\n\n switch (element.type) {\n case \"selection\":\n {\n // Since this is used only during editing experience, which is canvas based,\n // this should not happen\n throw new Error(\"Selection rendering is not supported for SVG\");\n }\n\n case \"rectangle\":\n case \"diamond\":\n case \"ellipse\":\n {\n const shape = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.ShapeCache.generateElementShape(element, renderConfig);\n const node = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT);\n\n if (opacity !== 1) {\n node.setAttribute(\"stroke-opacity\", `${opacity}`);\n node.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n node.setAttribute(\"stroke-linecap\", \"round\");\n node.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n const g = maybeWrapNodesInFrameClipPath(element, root, [node], renderConfig.frameRendering, elementsMap);\n addToRoot(g || node, element);\n break;\n }\n\n case \"iframe\":\n case \"embeddable\":\n {\n // render placeholder rectangle\n const shape = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.ShapeCache.generateElementShape(element, renderConfig);\n const node = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT);\n const opacity = element.opacity / 100;\n\n if (opacity !== 1) {\n node.setAttribute(\"stroke-opacity\", `${opacity}`);\n node.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n node.setAttribute(\"stroke-linecap\", \"round\");\n node.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n addToRoot(node, element);\n const label = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.createPlaceholderEmbeddableLabel)(element);\n renderElementToSvg(label, elementsMap, rsvg, root, files, label.x + offset.x - element.x, label.y + offset.y - element.y, renderConfig);\n const scaleX = ((_c = element.scale) === null || _c === void 0 ? void 0 : _c[0]) || 1; //zsviczian\n\n const scaleY = ((_d = element.scale) === null || _d === void 0 ? void 0 : _d[1]) || 1; //zsviczian\n // render embeddable element + iframe\n\n const embeddableNode = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT);\n embeddableNode.setAttribute(\"stroke-linecap\", \"round\");\n embeddableNode.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy}) scale(${scaleX}, ${scaleY})`);\n\n while (embeddableNode.firstChild) {\n embeddableNode.removeChild(embeddableNode.firstChild);\n }\n\n const radius = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getCornerRadius)(Math.min(element.width, element.height), element);\n const embedLink = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getEmbedLink)((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.toValidURL)(element.link || \"\")); // if rendering embeddables explicitly disabled or\n // embedding documents via srcdoc (which doesn't seem to work for SVGs)\n // replace with a link instead\n\n if (renderConfig.renderEmbeddables === false || (embedLink === null || embedLink === void 0 ? void 0 : embedLink.type) === \"document\") {\n const anchorTag = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"a\");\n anchorTag.setAttribute(\"href\", (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.normalizeLink)(element.link || \"\"));\n anchorTag.setAttribute(\"target\", \"_blank\");\n anchorTag.setAttribute(\"rel\", \"noopener noreferrer\");\n anchorTag.style.borderRadius = `${radius}px`;\n embeddableNode.appendChild(anchorTag);\n } else {\n const foreignObject = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"foreignObject\");\n foreignObject.style.width = `${element.width / scaleX}px`; //zsviczian\n\n foreignObject.style.height = `${element.height / scaleY}px`; //zsviczian\n\n foreignObject.style.border = \"none\";\n const div = foreignObject.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"div\");\n div.setAttribute(\"xmlns\", \"http://www.w3.org/1999/xhtml\");\n div.style.width = \"100%\";\n div.style.height = \"100%\";\n const iframe = div.ownerDocument.createElement(\"iframe\");\n iframe.src = (_e = embedLink === null || embedLink === void 0 ? void 0 : embedLink.link) !== null && _e !== void 0 ? _e : \"\";\n iframe.style.width = \"100%\";\n iframe.style.height = \"100%\";\n iframe.style.border = \"none\";\n iframe.style.borderRadius = `${radius}px`;\n iframe.style.top = \"0\";\n iframe.style.left = \"0\";\n iframe.allowFullscreen = true;\n div.appendChild(iframe);\n foreignObject.appendChild(div);\n embeddableNode.appendChild(foreignObject);\n }\n\n addToRoot(embeddableNode, element);\n break;\n }\n\n case \"line\":\n case \"arrow\":\n {\n const boundText = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getBoundTextElement)(element, elementsMap);\n const maskPath = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"mask\");\n\n if (boundText) {\n maskPath.setAttribute(\"id\", `mask-${element.id}`);\n const maskRectVisible = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n offsetX = offsetX || 0;\n offsetY = offsetY || 0;\n maskRectVisible.setAttribute(\"x\", \"0\");\n maskRectVisible.setAttribute(\"y\", \"0\");\n maskRectVisible.setAttribute(\"fill\", \"#fff\");\n maskRectVisible.setAttribute(\"width\", `${element.width + 100 + offsetX}`);\n maskRectVisible.setAttribute(\"height\", `${element.height + 100 + offsetY}`);\n maskPath.appendChild(maskRectVisible);\n const maskRectInvisible = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n const boundTextCoords = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.LinearElementEditor.getBoundTextElementPosition(element, boundText, elementsMap);\n const maskX = offsetX + boundTextCoords.x - element.x;\n const maskY = offsetY + boundTextCoords.y - element.y;\n maskRectInvisible.setAttribute(\"x\", maskX.toString());\n maskRectInvisible.setAttribute(\"y\", maskY.toString());\n maskRectInvisible.setAttribute(\"fill\", \"#000\");\n maskRectInvisible.setAttribute(\"width\", `${boundText.width}`);\n maskRectInvisible.setAttribute(\"height\", `${boundText.height}`);\n maskRectInvisible.setAttribute(\"opacity\", \"1\");\n maskPath.appendChild(maskRectInvisible);\n }\n\n const group = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n\n if (boundText) {\n group.setAttribute(\"mask\", `url(#mask-${element.id})`);\n }\n\n group.setAttribute(\"stroke-linecap\", \"round\");\n const shapes = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.ShapeCache.generateElementShape(element, renderConfig);\n shapes.forEach(shape => {\n const node = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT);\n\n if (opacity !== 1) {\n node.setAttribute(\"stroke-opacity\", `${opacity}`);\n node.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n node.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n\n if (element.type === \"line\" && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isPathALoop)(element.points) && element.backgroundColor !== \"transparent\") {\n node.setAttribute(\"fill-rule\", \"evenodd\");\n }\n\n group.appendChild(node);\n });\n const g = maybeWrapNodesInFrameClipPath(element, root, [group, maskPath], renderConfig.frameRendering, elementsMap);\n\n if (g) {\n addToRoot(g, element);\n root.appendChild(g);\n } else {\n addToRoot(group, element);\n root.append(maskPath);\n }\n\n break;\n }\n\n case \"freedraw\":\n {\n const wrapper = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n const shapes = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.ShapeCache.generateElementShape(element, renderConfig); // always ordered as [background, stroke]\n\n for (const shape of shapes) {\n if (typeof shape === \"string\") {\n // stroke (SVGPathString)\n //zsviczian - custom stroke options start\n const {\n pathD,\n fillColorThemed\n } = (() => {\n var _a, _b, _c, _d, _e;\n\n const pathD = (0,_element_src_freedrawPath__WEBPACK_IMPORTED_MODULE_2__.getFreeDrawSvgPath)(element);\n const hasOutline = (_b = (_a = element.customData) === null || _a === void 0 ? void 0 : _a.strokeOptions) === null || _b === void 0 ? void 0 : _b.hasOutline;\n const outlineWidth = (_e = (_d = (_c = element.customData) === null || _c === void 0 ? void 0 : _c.strokeOptions) === null || _d === void 0 ? void 0 : _d.outlineWidth) !== null && _e !== void 0 ? _e : 1;\n const fillColor = hasOutline ? element.backgroundColor : element.strokeColor;\n const fillColorThemed = renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.applyDarkModeFilter)(fillColor) : fillColor;\n\n if (hasOutline) {\n const outline = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"path\");\n outline.setAttribute(\"fill\", \"none\");\n outline.setAttribute(\"stroke\", renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.applyDarkModeFilter)(element.strokeColor) : element.strokeColor);\n outline.setAttribute(\"stroke-width\", `${element.strokeWidth * outlineWidth}`);\n outline.setAttribute(\"d\", pathD);\n wrapper.appendChild(outline);\n }\n\n return {\n pathD,\n fillColorThemed\n };\n })(); //zsviczian - custom stroke options end\n\n\n const path = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"path\");\n /*\n path.setAttribute(\n \"fill\",\n applyDarkModeFilter(\n element.strokeColor,\n renderConfig.theme === THEME.DARK,\n ),\n );\n path.setAttribute(\"d\", shape);\n */\n //zsviczian\n\n path.setAttribute(\"fill\", fillColorThemed); //zsviczian\n\n path.setAttribute(\"d\", pathD); //zsviczian\n\n wrapper.appendChild(path);\n } else {\n // background (Drawable)\n const bgNode = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT); // if children wrapped in <g>, unwrap it\n\n if (bgNode.nodeName === \"g\") {\n while (bgNode.firstChild) {\n wrapper.appendChild(bgNode.firstChild);\n }\n } else {\n wrapper.appendChild(bgNode);\n }\n }\n }\n\n if (opacity !== 1) {\n wrapper.setAttribute(\"stroke-opacity\", `${opacity}`);\n wrapper.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n wrapper.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n wrapper.setAttribute(\"stroke\", \"none\");\n const g = maybeWrapNodesInFrameClipPath(element, root, [wrapper], renderConfig.frameRendering, elementsMap);\n addToRoot(g || wrapper, element);\n break;\n }\n\n case \"image\":\n {\n const width = Math.round(element.width);\n const height = Math.round(element.height);\n const fileData = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isInitializedImageElement)(element) && files[element.fileId];\n\n if (fileData) {\n const {\n reuseImages = true\n } = renderConfig;\n let suffix = fileData.mimeType === \"image/svg+xml\" && ((_f = element.customData) === null || _f === void 0 ? void 0 : _f.doNotInvertSVGInDarkMode) ? \"-no-invert-svg\" : ((_g = element.customData) === null || _g === void 0 ? void 0 : _g.invertBitmapInDarkmode) ? \"-invert-bitmap\" : \"\"; //zsviczian\n\n let symbolId = `image-${fileData.id}${suffix}`; //zsviczian\n\n let uncroppedWidth = element.width;\n let uncroppedHeight = element.height;\n\n if (element.crop) {\n ({\n width: uncroppedWidth,\n height: uncroppedHeight\n } = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getUncroppedWidthAndHeight)(element));\n symbolId = `image-crop-${fileData.id}-${(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.hashString)(`${uncroppedWidth}x${uncroppedHeight}${suffix}`)}`;\n }\n\n if (!reuseImages) {\n symbolId = `image-${element.id}${suffix}`; //zsviczian\n }\n\n let symbol = svgRoot.querySelector(`#${symbolId}`);\n\n if (!symbol) {\n symbol = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"symbol\");\n symbol.id = symbolId;\n const image = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"image\");\n image.setAttribute(\"href\", fileData.dataURL);\n image.setAttribute(\"preserveAspectRatio\", \"none\");\n\n if (element.crop || !reuseImages) {\n image.setAttribute(\"width\", `${uncroppedWidth}`);\n image.setAttribute(\"height\", `${uncroppedHeight}`);\n } else {\n image.setAttribute(\"width\", \"100%\");\n image.setAttribute(\"height\", \"100%\");\n }\n\n symbol.appendChild(image);\n (root.querySelector(\"defs\") || root).prepend(symbol);\n }\n\n const use = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"use\");\n use.setAttribute(\"href\", `#${symbolId}`);\n let normalizedCropX = 0;\n let normalizedCropY = 0;\n\n if (element.crop) {\n const {\n width: uncroppedWidth,\n height: uncroppedHeight\n } = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getUncroppedWidthAndHeight)(element);\n normalizedCropX = element.crop.x / (element.crop.naturalWidth / uncroppedWidth);\n normalizedCropY = element.crop.y / (element.crop.naturalHeight / uncroppedHeight);\n }\n\n const adjustedCenterX = cx + normalizedCropX;\n const adjustedCenterY = cy + normalizedCropY;\n use.setAttribute(\"width\", `${width + normalizedCropX}`);\n use.setAttribute(\"height\", `${height + normalizedCropY}`);\n use.setAttribute(\"opacity\", `${opacity}`); // We first apply `scale` transforms (horizontal/vertical mirroring)\n // on the <use> element, then apply translation and rotation\n // on the <g> element which wraps the <use>.\n // Doing this separately is a quick hack to to work around compositing\n // the transformations correctly (the transform-origin was not being\n // applied correctly).\n\n if (element.scale[0] !== 1 || element.scale[1] !== 1) {\n use.setAttribute(\"transform\", `translate(${adjustedCenterX} ${adjustedCenterY}) scale(${element.scale[0]} ${element.scale[1]}) translate(${-adjustedCenterX} ${-adjustedCenterY})`);\n }\n\n const g = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n\n if (renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK && (fileData.mimeType === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MIME_TYPES.svg && !((_h = element.customData) === null || _h === void 0 ? void 0 : _h.doNotInvertSVGInDarkMode) || !!((_j = element.customData) === null || _j === void 0 ? void 0 : _j.pdfPageViewProps) && ((_l = (_k = element.customData) === null || _k === void 0 ? void 0 : _k.invertBitmapInDarkmode) !== null && _l !== void 0 ? _l : true) || !!((_m = element.customData) === null || _m === void 0 ? void 0 : _m.invertBitmapInDarkmode)) //zsviczian\n ) {\n g.setAttribute(\"filter\", _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.DARK_THEME_FILTER);\n }\n\n if (element.crop) {\n const mask = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"mask\");\n mask.setAttribute(\"id\", `mask-image-crop-${element.id}`);\n mask.setAttribute(\"fill\", \"#fff\");\n const maskRect = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n maskRect.setAttribute(\"x\", `${normalizedCropX}`);\n maskRect.setAttribute(\"y\", `${normalizedCropY}`);\n maskRect.setAttribute(\"width\", `${width}`);\n maskRect.setAttribute(\"height\", `${height}`);\n mask.appendChild(maskRect);\n root.appendChild(mask);\n g.setAttribute(\"mask\", `url(#${mask.id})`);\n }\n\n g.appendChild(use);\n g.setAttribute(\"transform\", `translate(${offsetX - normalizedCropX} ${offsetY - normalizedCropY}) rotate(${degree} ${adjustedCenterX} ${adjustedCenterY})`);\n\n if (element.roundness) {\n const clipPath = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"clipPath\");\n clipPath.id = `image-clipPath-${element.id}`;\n clipPath.setAttribute(\"clipPathUnits\", \"userSpaceOnUse\");\n const clipRect = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n const radius = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getCornerRadius)(Math.min(element.width, element.height), element);\n const clipOffsetX = element.crop ? normalizedCropX : 0;\n const clipOffsetY = element.crop ? normalizedCropY : 0;\n clipRect.setAttribute(\"x\", `${clipOffsetX}`);\n clipRect.setAttribute(\"y\", `${clipOffsetY}`);\n clipRect.setAttribute(\"width\", `${element.width}`);\n clipRect.setAttribute(\"height\", `${element.height}`);\n clipRect.setAttribute(\"rx\", `${radius}`);\n clipRect.setAttribute(\"ry\", `${radius}`);\n clipPath.appendChild(clipRect);\n addToRoot(clipPath, element);\n g.setAttributeNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"clip-path\", `url(#${clipPath.id})`);\n }\n\n const clipG = maybeWrapNodesInFrameClipPath(element, root, [g], renderConfig.frameRendering, elementsMap);\n addToRoot(clipG || g, element);\n }\n\n break;\n }\n // frames are not rendered and only acts as a container\n\n case \"frame\":\n case \"magicframe\":\n {\n if (renderConfig.frameRendering.enabled && renderConfig.frameRendering.outline && !(!renderConfig.frameRendering.markerEnabled && element.frameRole === \"marker\") //zsviczian\n ) {\n const rect = document.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n rect.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n rect.setAttribute(\"width\", `${element.width}px`);\n rect.setAttribute(\"height\", `${element.height}px`); // Rounded corners\n\n rect.setAttribute(\"rx\", _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.FRAME_STYLE.radius.toString());\n rect.setAttribute(\"ry\", _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.FRAME_STYLE.radius.toString());\n rect.setAttribute(\"fill\", \"none\");\n rect.setAttribute(\"stroke\", (() => {\n var _a, _b, _c, _d, _e;\n\n const color = (_e = (_c = (_b = (_a = element.customData) === null || _a === void 0 ? void 0 : _a.frameColor) === null || _b === void 0 ? void 0 : _b.stroke) !== null && _c !== void 0 ? _c : (_d = renderConfig.frameColor) === null || _d === void 0 ? void 0 : _d.stroke) !== null && _e !== void 0 ? _e : _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.FRAME_STYLE.strokeColor; //zsviczian\n\n return (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.applyDarkModeFilter)(color, //zsviczian\n renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK);\n })());\n rect.setAttribute(\"stroke-width\", (_s = (_q = (_p = (_o = element.customData) === null || _o === void 0 ? void 0 : _o.frameColor) === null || _p === void 0 ? void 0 : _p.fill) !== null && _q !== void 0 ? _q : (_r = renderConfig.frameColor) === null || _r === void 0 ? void 0 : _r.fill) !== null && _s !== void 0 ? _s : _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.FRAME_STYLE.strokeWidth.toString());\n addToRoot(rect, element);\n }\n\n break;\n }\n\n default:\n {\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isTextElement)(element)) {\n const node = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n\n if (opacity !== 1) {\n node.setAttribute(\"stroke-opacity\", `${opacity}`);\n node.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n node.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n const lines = element.text.replace(/\\r\\n?/g, \"\\n\").split(\"\\n\");\n const lineHeightPx = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getLineHeightInPx)(element.fontSize, element.lineHeight);\n const horizontalOffset = element.textAlign === \"center\" ? element.width / 2 : element.textAlign === \"right\" ? element.width : 0;\n const verticalOffset = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.getVerticalOffset)(element.fontFamily, element.fontSize, lineHeightPx);\n const direction = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.isRTL)(element.text) ? \"rtl\" : \"ltr\";\n const textAnchor = element.textAlign === \"center\" ? \"middle\" : element.textAlign === \"right\" || direction === \"rtl\" ? \"end\" : \"start\";\n\n for (let i = 0; i < lines.length; i++) {\n const text = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"text\");\n text.textContent = lines[i];\n text.setAttribute(\"x\", `${horizontalOffset}`);\n text.setAttribute(\"y\", `${i * lineHeightPx + verticalOffset}`);\n text.setAttribute(\"font-family\", (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.getFontFamilyString)(element));\n text.setAttribute(\"font-size\", `${element.fontSize}px`);\n text.setAttribute(\"fill\", (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.applyDarkModeFilter)(element.strokeColor, renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK));\n text.setAttribute(\"text-anchor\", textAnchor);\n text.setAttribute(\"style\", \"white-space: pre;\");\n text.setAttribute(\"direction\", direction);\n text.setAttribute(\"dominant-baseline\", \"alphabetic\");\n node.appendChild(text);\n }\n\n const g = maybeWrapNodesInFrameClipPath(element, root, [node], renderConfig.frameRendering, elementsMap);\n addToRoot(g || node, element);\n } else {\n // @ts-ignore\n throw new Error(`Unimplemented type ${element.type}`);\n }\n }\n }\n};\n\nconst renderSceneToSvg = (elements, elementsMap, rsvg, svgRoot, files, renderConfig) => {\n if (!svgRoot) {\n return;\n } // render elements\n\n\n elements.filter(el => !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isIframeLikeElement)(el)).forEach(element => {\n if (!element.isDeleted) {\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isTextElement)(element) && element.containerId && elementsMap.has(element.containerId)) {\n // will be rendered with the container\n return;\n }\n\n try {\n renderElementToSvg(element, elementsMap, rsvg, svgRoot, files, element.x + renderConfig.offsetX, element.y + renderConfig.offsetY, renderConfig);\n const boundTextElement = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement) {\n renderElementToSvg(boundTextElement, elementsMap, rsvg, svgRoot, files, boundTextElement.x + renderConfig.offsetX, boundTextElement.y + renderConfig.offsetY, renderConfig);\n }\n } catch (error) {\n console.error(error);\n }\n }\n }); // render embeddables on top\n\n elements.filter(el => (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isIframeLikeElement)(el)).forEach(element => {\n if (!element.isDeleted) {\n try {\n renderElementToSvg(element, elementsMap, rsvg, svgRoot, files, element.x + renderConfig.offsetX, element.y + renderConfig.offsetY, renderConfig);\n } catch (error) {\n console.error(error);\n }\n }\n });\n};\n\n//# sourceURL=webpack://ExcalidrawLib/./renderer/staticSvgScene.ts?\n}");
|
|
4789
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ renderSceneToSvg: () => (/* binding */ renderSceneToSvg)\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_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _element_src_freedrawPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../element/src/freedrawPath */ \"../element/src/freedrawPath.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst roughSVGDrawWithPrecision = (rsvg, drawable, precision) => {\n if (typeof precision === \"undefined\") {\n return rsvg.draw(drawable);\n }\n\n const pshape = {\n sets: drawable.sets,\n shape: drawable.shape,\n options: Object.assign(Object.assign({}, drawable.options), {\n fixedDecimalPlaceDigits: precision\n })\n };\n return rsvg.draw(pshape);\n};\n\nconst maybeWrapNodesInFrameClipPath = (element, root, nodes, frameRendering, elementsMap) => {\n if (!frameRendering.enabled || !frameRendering.clip) {\n return null;\n }\n\n const frame = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getContainingFrame)(element, elementsMap);\n\n if (frame) {\n const g = root.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n g.setAttributeNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"clip-path\", `url(#${frame.id})`);\n nodes.forEach(node => g.appendChild(node));\n return g;\n }\n\n return null;\n};\n\nconst renderElementToSvg = (element, elementsMap, rsvg, svgRoot, files, offsetX, offsetY, renderConfig) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;\n\n const offset = {\n x: offsetX,\n y: offsetY\n };\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getElementAbsoluteCoords)(element, elementsMap);\n let cx = (x2 - x1) / 2 - (element.x - x1);\n let cy = (y2 - y1) / 2 - (element.y - y1);\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isTextElement)(element)) {\n const container = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getContainerElement)(element, elementsMap);\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isArrowElement)(container)) {\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getElementAbsoluteCoords)(container, elementsMap);\n const boundTextCoords = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.LinearElementEditor.getBoundTextElementPosition(container, element, elementsMap);\n cx = (x2 - x1) / 2 - (boundTextCoords.x - x1);\n cy = (y2 - y1) / 2 - (boundTextCoords.y - y1);\n offsetX = offsetX + boundTextCoords.x - element.x;\n offsetY = offsetY + boundTextCoords.y - element.y;\n }\n }\n\n const degree = 180 * element.angle / Math.PI; // element to append node to, most of the time svgRoot\n\n let root = svgRoot; // if the element has a link, create an anchor tag and make that the new root\n\n if (element.link) {\n const anchorTag = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"a\");\n anchorTag.setAttribute(\"href\", (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.normalizeLink)(element.link));\n root.appendChild(anchorTag);\n root = anchorTag;\n }\n\n const addToRoot = (node, element) => {\n if ((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.isTestEnv)()) {\n node.setAttribute(\"data-id\", element.id);\n }\n\n root.appendChild(node);\n };\n\n const opacity = ((_b = (_a = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getContainingFrame)(element, elementsMap)) === null || _a === void 0 ? void 0 : _a.opacity) !== null && _b !== void 0 ? _b : 100) * element.opacity / 10000;\n\n switch (element.type) {\n case \"selection\":\n {\n // Since this is used only during editing experience, which is canvas based,\n // this should not happen\n throw new Error(\"Selection rendering is not supported for SVG\");\n }\n\n case \"rectangle\":\n case \"diamond\":\n case \"ellipse\":\n {\n const shape = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.ShapeCache.generateElementShape(element, renderConfig);\n const node = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT);\n\n if (opacity !== 1) {\n node.setAttribute(\"stroke-opacity\", `${opacity}`);\n node.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n node.setAttribute(\"stroke-linecap\", \"round\");\n node.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n const g = maybeWrapNodesInFrameClipPath(element, root, [node], renderConfig.frameRendering, elementsMap);\n addToRoot(g || node, element);\n break;\n }\n\n case \"iframe\":\n case \"embeddable\":\n {\n // render placeholder rectangle\n const shape = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.ShapeCache.generateElementShape(element, renderConfig);\n const node = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT);\n const opacity = element.opacity / 100;\n\n if (opacity !== 1) {\n node.setAttribute(\"stroke-opacity\", `${opacity}`);\n node.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n node.setAttribute(\"stroke-linecap\", \"round\");\n node.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n addToRoot(node, element);\n const label = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.createPlaceholderEmbeddableLabel)(element);\n renderElementToSvg(label, elementsMap, rsvg, root, files, label.x + offset.x - element.x, label.y + offset.y - element.y, renderConfig);\n const scaleX = ((_c = element.scale) === null || _c === void 0 ? void 0 : _c[0]) || 1; //zsviczian\n\n const scaleY = ((_d = element.scale) === null || _d === void 0 ? void 0 : _d[1]) || 1; //zsviczian\n // render embeddable element + iframe\n\n const embeddableNode = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT);\n embeddableNode.setAttribute(\"stroke-linecap\", \"round\");\n embeddableNode.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy}) scale(${scaleX}, ${scaleY})`);\n\n while (embeddableNode.firstChild) {\n embeddableNode.removeChild(embeddableNode.firstChild);\n }\n\n const radius = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getCornerRadius)(Math.min(element.width, element.height), element);\n const embedLink = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getEmbedLink)((0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.toValidURL)(element.link || \"\")); // if rendering embeddables explicitly disabled or\n // embedding documents via srcdoc (which doesn't seem to work for SVGs)\n // replace with a link instead\n\n if (renderConfig.renderEmbeddables === false || (embedLink === null || embedLink === void 0 ? void 0 : embedLink.type) === \"document\") {\n const anchorTag = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"a\");\n anchorTag.setAttribute(\"href\", (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.normalizeLink)(element.link || \"\"));\n anchorTag.setAttribute(\"target\", \"_blank\");\n anchorTag.setAttribute(\"rel\", \"noopener noreferrer\");\n anchorTag.style.borderRadius = `${radius}px`;\n embeddableNode.appendChild(anchorTag);\n } else {\n const foreignObject = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"foreignObject\");\n foreignObject.style.width = `${element.width / scaleX}px`; //zsviczian\n\n foreignObject.style.height = `${element.height / scaleY}px`; //zsviczian\n\n foreignObject.style.border = \"none\";\n const div = foreignObject.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"div\");\n div.setAttribute(\"xmlns\", \"http://www.w3.org/1999/xhtml\");\n div.style.width = \"100%\";\n div.style.height = \"100%\";\n const iframe = div.ownerDocument.createElement(\"iframe\");\n iframe.src = (_e = embedLink === null || embedLink === void 0 ? void 0 : embedLink.link) !== null && _e !== void 0 ? _e : \"\";\n iframe.style.width = \"100%\";\n iframe.style.height = \"100%\";\n iframe.style.border = \"none\";\n iframe.style.borderRadius = `${radius}px`;\n iframe.style.top = \"0\";\n iframe.style.left = \"0\";\n iframe.allowFullscreen = true;\n div.appendChild(iframe);\n foreignObject.appendChild(div);\n embeddableNode.appendChild(foreignObject);\n }\n\n addToRoot(embeddableNode, element);\n break;\n }\n\n case \"line\":\n case \"arrow\":\n {\n const boundText = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getBoundTextElement)(element, elementsMap);\n const maskPath = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"mask\");\n\n if (boundText) {\n maskPath.setAttribute(\"id\", `mask-${element.id}`);\n const maskRectVisible = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n offsetX = offsetX || 0;\n offsetY = offsetY || 0; //zsviczian BEGIN\n //https://github.com/excalidraw/excalidraw/pull/11441 by krishhna24\n\n maskPath.setAttribute(\"maskUnits\", \"userSpaceOnUse\");\n maskPath.setAttribute(\"x\", \"0\");\n maskPath.setAttribute(\"y\", \"0\");\n maskPath.setAttribute(\"width\", `${element.width + 100 + offsetX}`);\n maskPath.setAttribute(\"height\", `${element.height + 100 + offsetY}`); //zsviczian END\n\n maskRectVisible.setAttribute(\"x\", \"0\");\n maskRectVisible.setAttribute(\"y\", \"0\");\n maskRectVisible.setAttribute(\"fill\", \"#fff\");\n maskRectVisible.setAttribute(\"width\", `${element.width + 100 + offsetX}`);\n maskRectVisible.setAttribute(\"height\", `${element.height + 100 + offsetY}`);\n maskPath.appendChild(maskRectVisible);\n const maskRectInvisible = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n const boundTextCoords = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.LinearElementEditor.getBoundTextElementPosition(element, boundText, elementsMap);\n const maskX = offsetX + boundTextCoords.x - element.x;\n const maskY = offsetY + boundTextCoords.y - element.y;\n maskRectInvisible.setAttribute(\"x\", maskX.toString());\n maskRectInvisible.setAttribute(\"y\", maskY.toString());\n maskRectInvisible.setAttribute(\"fill\", \"#000\");\n maskRectInvisible.setAttribute(\"width\", `${boundText.width}`);\n maskRectInvisible.setAttribute(\"height\", `${boundText.height}`);\n maskRectInvisible.setAttribute(\"opacity\", \"1\");\n maskPath.appendChild(maskRectInvisible);\n }\n\n const group = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n\n if (boundText) {\n group.setAttribute(\"mask\", `url(#mask-${element.id})`);\n }\n\n group.setAttribute(\"stroke-linecap\", \"round\");\n const shapes = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.ShapeCache.generateElementShape(element, renderConfig);\n shapes.forEach(shape => {\n const node = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT);\n\n if (opacity !== 1) {\n node.setAttribute(\"stroke-opacity\", `${opacity}`);\n node.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n node.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n\n if (element.type === \"line\" && (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isPathALoop)(element.points) && element.backgroundColor !== \"transparent\") {\n node.setAttribute(\"fill-rule\", \"evenodd\");\n }\n\n group.appendChild(node);\n });\n const g = maybeWrapNodesInFrameClipPath(element, root, [group, maskPath], renderConfig.frameRendering, elementsMap);\n\n if (g) {\n addToRoot(g, element);\n root.appendChild(g);\n } else {\n addToRoot(group, element);\n root.append(maskPath);\n }\n\n break;\n }\n\n case \"freedraw\":\n {\n const wrapper = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n const shapes = _excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.ShapeCache.generateElementShape(element, renderConfig); // always ordered as [background, stroke]\n\n for (const shape of shapes) {\n if (typeof shape === \"string\") {\n // stroke (SVGPathString)\n //zsviczian - custom stroke options start\n const {\n pathD,\n fillColorThemed\n } = (() => {\n var _a, _b, _c, _d, _e;\n\n const pathD = (0,_element_src_freedrawPath__WEBPACK_IMPORTED_MODULE_2__.getFreeDrawSvgPath)(element);\n const hasOutline = (_b = (_a = element.customData) === null || _a === void 0 ? void 0 : _a.strokeOptions) === null || _b === void 0 ? void 0 : _b.hasOutline;\n const outlineWidth = (_e = (_d = (_c = element.customData) === null || _c === void 0 ? void 0 : _c.strokeOptions) === null || _d === void 0 ? void 0 : _d.outlineWidth) !== null && _e !== void 0 ? _e : 1;\n const fillColor = hasOutline ? element.backgroundColor : element.strokeColor;\n const fillColorThemed = renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.applyDarkModeFilter)(fillColor) : fillColor;\n\n if (hasOutline) {\n const outline = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"path\");\n outline.setAttribute(\"fill\", \"none\");\n outline.setAttribute(\"stroke\", renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK ? (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.applyDarkModeFilter)(element.strokeColor) : element.strokeColor);\n outline.setAttribute(\"stroke-width\", `${element.strokeWidth * outlineWidth}`);\n outline.setAttribute(\"d\", pathD);\n wrapper.appendChild(outline);\n }\n\n return {\n pathD,\n fillColorThemed\n };\n })(); //zsviczian - custom stroke options end\n\n\n const path = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"path\");\n /*\n path.setAttribute(\n \"fill\",\n applyDarkModeFilter(\n element.strokeColor,\n renderConfig.theme === THEME.DARK,\n ),\n );\n path.setAttribute(\"d\", shape);\n */\n //zsviczian\n\n path.setAttribute(\"fill\", fillColorThemed); //zsviczian\n\n path.setAttribute(\"d\", pathD); //zsviczian\n\n wrapper.appendChild(path);\n } else {\n // background (Drawable)\n const bgNode = roughSVGDrawWithPrecision(rsvg, shape, _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MAX_DECIMALS_FOR_SVG_EXPORT); // if children wrapped in <g>, unwrap it\n\n if (bgNode.nodeName === \"g\") {\n while (bgNode.firstChild) {\n wrapper.appendChild(bgNode.firstChild);\n }\n } else {\n wrapper.appendChild(bgNode);\n }\n }\n }\n\n if (opacity !== 1) {\n wrapper.setAttribute(\"stroke-opacity\", `${opacity}`);\n wrapper.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n wrapper.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n wrapper.setAttribute(\"stroke\", \"none\");\n const g = maybeWrapNodesInFrameClipPath(element, root, [wrapper], renderConfig.frameRendering, elementsMap);\n addToRoot(g || wrapper, element);\n break;\n }\n\n case \"image\":\n {\n const width = Math.round(element.width);\n const height = Math.round(element.height);\n const fileData = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isInitializedImageElement)(element) && files[element.fileId];\n\n if (fileData) {\n const {\n reuseImages = true\n } = renderConfig;\n let suffix = fileData.mimeType === \"image/svg+xml\" && ((_f = element.customData) === null || _f === void 0 ? void 0 : _f.doNotInvertSVGInDarkMode) ? \"-no-invert-svg\" : ((_g = element.customData) === null || _g === void 0 ? void 0 : _g.invertBitmapInDarkmode) ? \"-invert-bitmap\" : \"\"; //zsviczian\n\n let symbolId = `image-${fileData.id}${suffix}`; //zsviczian\n\n let uncroppedWidth = element.width;\n let uncroppedHeight = element.height;\n\n if (element.crop) {\n ({\n width: uncroppedWidth,\n height: uncroppedHeight\n } = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getUncroppedWidthAndHeight)(element));\n symbolId = `image-crop-${fileData.id}-${(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.hashString)(`${uncroppedWidth}x${uncroppedHeight}${suffix}`)}`;\n }\n\n if (!reuseImages) {\n symbolId = `image-${element.id}${suffix}`; //zsviczian\n }\n\n let symbol = svgRoot.querySelector(`#${symbolId}`);\n\n if (!symbol) {\n symbol = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"symbol\");\n symbol.id = symbolId;\n const image = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"image\");\n image.setAttribute(\"href\", fileData.dataURL);\n image.setAttribute(\"preserveAspectRatio\", \"none\");\n\n if (element.crop || !reuseImages) {\n image.setAttribute(\"width\", `${uncroppedWidth}`);\n image.setAttribute(\"height\", `${uncroppedHeight}`);\n } else {\n image.setAttribute(\"width\", \"100%\");\n image.setAttribute(\"height\", \"100%\");\n }\n\n symbol.appendChild(image);\n (root.querySelector(\"defs\") || root).prepend(symbol);\n }\n\n const use = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"use\");\n use.setAttribute(\"href\", `#${symbolId}`);\n let normalizedCropX = 0;\n let normalizedCropY = 0;\n\n if (element.crop) {\n const {\n width: uncroppedWidth,\n height: uncroppedHeight\n } = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getUncroppedWidthAndHeight)(element);\n normalizedCropX = element.crop.x / (element.crop.naturalWidth / uncroppedWidth);\n normalizedCropY = element.crop.y / (element.crop.naturalHeight / uncroppedHeight);\n }\n\n const adjustedCenterX = cx + normalizedCropX;\n const adjustedCenterY = cy + normalizedCropY;\n use.setAttribute(\"width\", `${width + normalizedCropX}`);\n use.setAttribute(\"height\", `${height + normalizedCropY}`);\n use.setAttribute(\"opacity\", `${opacity}`); // We first apply `scale` transforms (horizontal/vertical mirroring)\n // on the <use> element, then apply translation and rotation\n // on the <g> element which wraps the <use>.\n // Doing this separately is a quick hack to to work around compositing\n // the transformations correctly (the transform-origin was not being\n // applied correctly).\n\n if (element.scale[0] !== 1 || element.scale[1] !== 1) {\n use.setAttribute(\"transform\", `translate(${adjustedCenterX} ${adjustedCenterY}) scale(${element.scale[0]} ${element.scale[1]}) translate(${-adjustedCenterX} ${-adjustedCenterY})`);\n }\n\n const g = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n\n if (renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK && (fileData.mimeType === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.MIME_TYPES.svg && !((_h = element.customData) === null || _h === void 0 ? void 0 : _h.doNotInvertSVGInDarkMode) || !!((_j = element.customData) === null || _j === void 0 ? void 0 : _j.pdfPageViewProps) && ((_l = (_k = element.customData) === null || _k === void 0 ? void 0 : _k.invertBitmapInDarkmode) !== null && _l !== void 0 ? _l : true) || !!((_m = element.customData) === null || _m === void 0 ? void 0 : _m.invertBitmapInDarkmode)) //zsviczian\n ) {\n g.setAttribute(\"filter\", _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.DARK_THEME_FILTER);\n }\n\n if (element.crop) {\n const mask = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"mask\");\n mask.setAttribute(\"id\", `mask-image-crop-${element.id}`);\n mask.setAttribute(\"fill\", \"#fff\");\n const maskRect = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n maskRect.setAttribute(\"x\", `${normalizedCropX}`);\n maskRect.setAttribute(\"y\", `${normalizedCropY}`);\n maskRect.setAttribute(\"width\", `${width}`);\n maskRect.setAttribute(\"height\", `${height}`);\n mask.appendChild(maskRect);\n root.appendChild(mask);\n g.setAttribute(\"mask\", `url(#${mask.id})`);\n }\n\n g.appendChild(use);\n g.setAttribute(\"transform\", `translate(${offsetX - normalizedCropX} ${offsetY - normalizedCropY}) rotate(${degree} ${adjustedCenterX} ${adjustedCenterY})`);\n\n if (element.roundness) {\n const clipPath = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"clipPath\");\n clipPath.id = `image-clipPath-${element.id}`;\n clipPath.setAttribute(\"clipPathUnits\", \"userSpaceOnUse\");\n const clipRect = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n const radius = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getCornerRadius)(Math.min(element.width, element.height), element);\n const clipOffsetX = element.crop ? normalizedCropX : 0;\n const clipOffsetY = element.crop ? normalizedCropY : 0;\n clipRect.setAttribute(\"x\", `${clipOffsetX}`);\n clipRect.setAttribute(\"y\", `${clipOffsetY}`);\n clipRect.setAttribute(\"width\", `${element.width}`);\n clipRect.setAttribute(\"height\", `${element.height}`);\n clipRect.setAttribute(\"rx\", `${radius}`);\n clipRect.setAttribute(\"ry\", `${radius}`);\n clipPath.appendChild(clipRect);\n addToRoot(clipPath, element);\n g.setAttributeNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"clip-path\", `url(#${clipPath.id})`);\n }\n\n const clipG = maybeWrapNodesInFrameClipPath(element, root, [g], renderConfig.frameRendering, elementsMap);\n addToRoot(clipG || g, element);\n }\n\n break;\n }\n // frames are not rendered and only acts as a container\n\n case \"frame\":\n case \"magicframe\":\n {\n if (renderConfig.frameRendering.enabled && renderConfig.frameRendering.outline && !(!renderConfig.frameRendering.markerEnabled && element.frameRole === \"marker\") //zsviczian\n ) {\n const rect = document.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"rect\");\n rect.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n rect.setAttribute(\"width\", `${element.width}px`);\n rect.setAttribute(\"height\", `${element.height}px`); // Rounded corners\n\n rect.setAttribute(\"rx\", _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.FRAME_STYLE.radius.toString());\n rect.setAttribute(\"ry\", _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.FRAME_STYLE.radius.toString());\n rect.setAttribute(\"fill\", \"none\");\n rect.setAttribute(\"stroke\", (() => {\n var _a, _b, _c, _d, _e;\n\n const color = (_e = (_c = (_b = (_a = element.customData) === null || _a === void 0 ? void 0 : _a.frameColor) === null || _b === void 0 ? void 0 : _b.stroke) !== null && _c !== void 0 ? _c : (_d = renderConfig.frameColor) === null || _d === void 0 ? void 0 : _d.stroke) !== null && _e !== void 0 ? _e : _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.FRAME_STYLE.strokeColor; //zsviczian\n\n return (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.applyDarkModeFilter)(color, //zsviczian\n renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK);\n })());\n rect.setAttribute(\"stroke-width\", (_s = (_q = (_p = (_o = element.customData) === null || _o === void 0 ? void 0 : _o.frameColor) === null || _p === void 0 ? void 0 : _p.fill) !== null && _q !== void 0 ? _q : (_r = renderConfig.frameColor) === null || _r === void 0 ? void 0 : _r.fill) !== null && _s !== void 0 ? _s : _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.FRAME_STYLE.strokeWidth.toString());\n addToRoot(rect, element);\n }\n\n break;\n }\n\n default:\n {\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isTextElement)(element)) {\n const node = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"g\");\n\n if (opacity !== 1) {\n node.setAttribute(\"stroke-opacity\", `${opacity}`);\n node.setAttribute(\"fill-opacity\", `${opacity}`);\n }\n\n node.setAttribute(\"transform\", `translate(${offsetX || 0} ${offsetY || 0}) rotate(${degree} ${cx} ${cy})`);\n const lines = element.text.replace(/\\r\\n?/g, \"\\n\").split(\"\\n\");\n const lineHeightPx = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getLineHeightInPx)(element.fontSize, element.lineHeight);\n const horizontalOffset = element.textAlign === \"center\" ? element.width / 2 : element.textAlign === \"right\" ? element.width : 0;\n const verticalOffset = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.getVerticalOffset)(element.fontFamily, element.fontSize, lineHeightPx);\n const direction = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.isRTL)(element.text) ? \"rtl\" : \"ltr\";\n const textAnchor = element.textAlign === \"center\" ? \"middle\" : element.textAlign === \"right\" || direction === \"rtl\" ? \"end\" : \"start\";\n\n for (let i = 0; i < lines.length; i++) {\n const text = svgRoot.ownerDocument.createElementNS(_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.SVG_NS, \"text\");\n text.textContent = lines[i];\n text.setAttribute(\"x\", `${horizontalOffset}`);\n text.setAttribute(\"y\", `${i * lineHeightPx + verticalOffset}`);\n text.setAttribute(\"font-family\", (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.getFontFamilyString)(element));\n text.setAttribute(\"font-size\", `${element.fontSize}px`);\n text.setAttribute(\"fill\", (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.applyDarkModeFilter)(element.strokeColor, renderConfig.theme === _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.THEME.DARK));\n text.setAttribute(\"text-anchor\", textAnchor);\n text.setAttribute(\"style\", \"white-space: pre;\");\n text.setAttribute(\"direction\", direction);\n text.setAttribute(\"dominant-baseline\", \"alphabetic\");\n node.appendChild(text);\n }\n\n const g = maybeWrapNodesInFrameClipPath(element, root, [node], renderConfig.frameRendering, elementsMap);\n addToRoot(g || node, element);\n } else {\n // @ts-ignore\n throw new Error(`Unimplemented type ${element.type}`);\n }\n }\n }\n};\n\nconst renderSceneToSvg = (elements, elementsMap, rsvg, svgRoot, files, renderConfig) => {\n if (!svgRoot) {\n return;\n } // render elements\n\n\n elements.filter(el => !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isIframeLikeElement)(el)).forEach(element => {\n if (!element.isDeleted) {\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isTextElement)(element) && element.containerId && elementsMap.has(element.containerId)) {\n // will be rendered with the container\n return;\n }\n\n try {\n renderElementToSvg(element, elementsMap, rsvg, svgRoot, files, element.x + renderConfig.offsetX, element.y + renderConfig.offsetY, renderConfig);\n const boundTextElement = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.getBoundTextElement)(element, elementsMap);\n\n if (boundTextElement) {\n renderElementToSvg(boundTextElement, elementsMap, rsvg, svgRoot, files, boundTextElement.x + renderConfig.offsetX, boundTextElement.y + renderConfig.offsetY, renderConfig);\n }\n } catch (error) {\n console.error(error);\n }\n }\n }); // render embeddables on top\n\n elements.filter(el => (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_1__.isIframeLikeElement)(el)).forEach(element => {\n if (!element.isDeleted) {\n try {\n renderElementToSvg(element, elementsMap, rsvg, svgRoot, files, element.x + renderConfig.offsetX, element.y + renderConfig.offsetY, renderConfig);\n } catch (error) {\n console.error(error);\n }\n }\n });\n};\n\n//# sourceURL=webpack://ExcalidrawLib/./renderer/staticSvgScene.ts?\n}");
|
|
4812
4790
|
|
|
4813
4791
|
/***/ },
|
|
4814
4792
|
|
|
@@ -4973,7 +4951,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
4973
4951
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4974
4952
|
|
|
4975
4953
|
"use strict";
|
|
4976
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WorkerUrl: () => (/* binding */ WorkerUrl)\n/* harmony export */ });\n/* harmony import */ var _subset_shared_chunk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subset-shared.chunk */ \"./subset/subset-shared.chunk.ts\");\n/**\n * DON'T depend on anything from the outside like `promiseTry`, as this module is part of a separate lazy-loaded chunk.\n *\n * Including anything from the main chunk would include the whole chunk by default.\n * Even it it would be tree-shaken during build, it won't be tree-shaken in dev.\n *\n * In the future consider separating common utils into a separate shared chunk.\n */\n\n/**\n * Due to this export (and related dynamic import), this worker code will be included in the bundle automatically (as a separate chunk),\n * without the need for esbuild / vite /rollup plugins and special browser / server treatment.\n *\n * `import.meta.url` is undefined in nodejs\n */\n\nconst WorkerUrl = true ? new URL(\"file:///
|
|
4954
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WorkerUrl: () => (/* binding */ WorkerUrl)\n/* harmony export */ });\n/* harmony import */ var _subset_shared_chunk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subset-shared.chunk */ \"./subset/subset-shared.chunk.ts\");\n/**\n * DON'T depend on anything from the outside like `promiseTry`, as this module is part of a separate lazy-loaded chunk.\n *\n * Including anything from the main chunk would include the whole chunk by default.\n * Even it it would be tree-shaken during build, it won't be tree-shaken in dev.\n *\n * In the future consider separating common utils into a separate shared chunk.\n */\n\n/**\n * Due to this export (and related dynamic import), this worker code will be included in the bundle automatically (as a separate chunk),\n * without the need for esbuild / vite /rollup plugins and special browser / server treatment.\n *\n * `import.meta.url` is undefined in nodejs\n */\n\nconst WorkerUrl = true ? new URL(\"file:///C:/Users/viczi/GitHub/excalidraw/packages/excalidraw/subset/subset-worker.chunk.ts\") : 0; // run only in the worker context\n\nif (typeof window === \"undefined\" && typeof self !== \"undefined\") {\n self.onmessage = async e => {\n switch (e.data.command) {\n case _subset_shared_chunk__WEBPACK_IMPORTED_MODULE_0__.Commands.Subset:\n const buffer = await (0,_subset_shared_chunk__WEBPACK_IMPORTED_MODULE_0__.subsetToBinary)(e.data.arrayBuffer, e.data.codePoints);\n self.postMessage(buffer, {\n transfer: [buffer]\n });\n break;\n }\n };\n}\n\n//# sourceURL=webpack://ExcalidrawLib/./subset/subset-worker.chunk.ts?\n}");
|
|
4977
4955
|
|
|
4978
4956
|
/***/ },
|
|
4979
4957
|
|
|
@@ -5028,7 +5006,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
5028
5006
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5029
5007
|
|
|
5030
5008
|
"use strict";
|
|
5031
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WorkerPool: () => (/* binding */ WorkerPool)\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 _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ \"./errors.ts\");\n\n\n\nclass IdleWorker {\n constructor(workerUrl) {\n this.instance = new Worker(workerUrl, {\n type: \"module\"\n });\n }\n\n}\n/**\n * Pool of idle short-lived workers.\n *\n * IMPORTANT: for simplicity it does not limit the number of newly created workers, leaving it up to the caller to manage the pool size.\n */\n\n\nclass WorkerPool {\n constructor(workerUrl, options) {\n this.idleWorkers = new Set();\n this.workerUrl = workerUrl; // by default, active & idle workers will be terminated after 1s of inactivity\n\n this.workerTTL = options.ttl || 1000;\n }\n /**\n * Create a new worker pool.\n *\n * @param workerUrl - The URL of the worker file.\n * @param options - The options for the worker pool.\n * @throws If the worker is bundled into the main chunk.\n * @returns A new worker pool instance.\n */\n\n\n static create(workerUrl, options = {}) {\n if (!workerUrl) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_1__.WorkerUrlNotDefinedError();\n }\n\n if ( false || workerUrl.toString() === \"file:///
|
|
5009
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WorkerPool: () => (/* binding */ WorkerPool)\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 _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ \"./errors.ts\");\n\n\n\nclass IdleWorker {\n constructor(workerUrl) {\n this.instance = new Worker(workerUrl, {\n type: \"module\"\n });\n }\n\n}\n/**\n * Pool of idle short-lived workers.\n *\n * IMPORTANT: for simplicity it does not limit the number of newly created workers, leaving it up to the caller to manage the pool size.\n */\n\n\nclass WorkerPool {\n constructor(workerUrl, options) {\n this.idleWorkers = new Set();\n this.workerUrl = workerUrl; // by default, active & idle workers will be terminated after 1s of inactivity\n\n this.workerTTL = options.ttl || 1000;\n }\n /**\n * Create a new worker pool.\n *\n * @param workerUrl - The URL of the worker file.\n * @param options - The options for the worker pool.\n * @throws If the worker is bundled into the main chunk.\n * @returns A new worker pool instance.\n */\n\n\n static create(workerUrl, options = {}) {\n if (!workerUrl) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_1__.WorkerUrlNotDefinedError();\n }\n\n if ( false || workerUrl.toString() === \"file:///C:/Users/viczi/GitHub/excalidraw/packages/excalidraw/workers.ts\") {\n // in case the worker code is bundled into the main chunk\n throw new _errors__WEBPACK_IMPORTED_MODULE_1__.WorkerInTheMainChunkError();\n }\n\n return new WorkerPool(workerUrl, options);\n }\n /**\n * Take idle worker from the pool or create a new one and post a message to it.\n */\n\n\n async postMessage(data, options) {\n let worker;\n const idleWorker = Array.from(this.idleWorkers).shift();\n\n if (idleWorker) {\n this.idleWorkers.delete(idleWorker);\n worker = idleWorker;\n } else {\n worker = await this.createWorker();\n }\n\n return new Promise((resolve, reject) => {\n worker.instance.onmessage = this.onMessageHandler(worker, resolve);\n worker.instance.onerror = this.onErrorHandler(worker, reject);\n worker.instance.postMessage(data, options);\n worker.debounceTerminate(() => reject(new Error(`Active worker did not respond for ${this.workerTTL}ms!`)));\n });\n }\n /**\n * Terminate the idle workers in the pool.\n */\n\n\n async clear() {\n for (const worker of this.idleWorkers) {\n worker.debounceTerminate.cancel();\n worker.instance.terminate();\n }\n\n this.idleWorkers.clear();\n }\n /**\n * Used to get a worker from the pool or create a new one if there is no idle available.\n */\n\n\n async createWorker() {\n const worker = new IdleWorker(this.workerUrl);\n worker.debounceTerminate = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.debounce)(reject => {\n worker.instance.terminate();\n\n if (this.idleWorkers.has(worker)) {\n this.idleWorkers.delete(worker); // eslint-disable-next-line no-console\n\n console.debug(\"Job finished! Idle worker has been released from the pool.\");\n } else if (reject) {\n reject();\n } else {\n console.error(\"Worker has been terminated!\");\n }\n }, this.workerTTL);\n return worker;\n }\n\n onMessageHandler(worker, resolve) {\n return e => {\n worker.debounceTerminate();\n this.idleWorkers.add(worker);\n resolve(e.data);\n };\n }\n\n onErrorHandler(worker, reject) {\n return e => {\n // terminate the worker immediately before rejection\n worker.debounceTerminate(() => reject(e));\n worker.debounceTerminate.flush(); // clear the worker pool in case there are some idle workers left\n\n this.clear();\n };\n }\n\n}\n\n//# sourceURL=webpack://ExcalidrawLib/./workers.ts?\n}");
|
|
5032
5010
|
|
|
5033
5011
|
/***/ },
|
|
5034
5012
|
|