@layers-app/editor 0.5.6-optimization → 0.5.8-optimization
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/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/{layers.D6d62qQ_.js → layers.8yssqxrI.js} +6 -6
- package/dist/{layers.CZ_Lt7IL.js → layers.B8z-e4Vg.js} +1 -1
- package/dist/{layers.B90YwJga.js → layers.BQLznd92.js} +1 -1
- package/dist/{layers.CZPeYQ9g.js → layers.BVRvG1mv.js} +2 -2
- package/dist/{layers.Ci1-qkbn.js → layers.BjCQNcdJ.js} +3 -3
- package/dist/{layers.Dq3o7sh3.js → layers.BnVn2uMi.js} +5 -5
- package/dist/{layers.Duy8YzsH.js → layers.CLcioDq5.js} +6 -6
- package/dist/{layers.CJiIq6YQ.js → layers.CTSBFg3j.js} +1 -1
- package/dist/{layers.CXffIp2y.js → layers.CoCZDINv.js} +5 -5
- package/dist/{layers.Cnm-pECN.js → layers.D0ZtUpST.js} +1 -1
- package/dist/{layers.C03OvlLb.js → layers.D2zjLyjP.js} +2 -2
- package/dist/{layers.7jmq6tBR.js → layers.Dt_Jdn4Y.js} +8 -8
- package/dist/{layers.Dgok89qX.js → layers.DwX5sVtx.js} +1 -1
- package/dist/{layers.Dev6Yrwi.js → layers.pre7B8K-.js} +3 -3
- package/package.json +9 -8
|
@@ -3,8 +3,8 @@ import { useTranslation as l } from "react-i18next";
|
|
|
3
3
|
import { useLexicalComposerContext as h } from "@lexical/react/LexicalComposerContext";
|
|
4
4
|
import { createCommand as d, COMMAND_PRIORITY_LOW as p, $isRootNode as x, $isElementNode as A, $getRoot as E, ParagraphNode as O } from "lexical";
|
|
5
5
|
import { showMessageNotification as g, showErrorNotification as M, FilePicker as D } from "@layers-app/shared";
|
|
6
|
-
import { C as u } from "./layers.
|
|
7
|
-
import { h as T, i as w, V as P, j as y, I as L, k as U, l as z, L as V, m as $, n as R, F as W, o as G } from "./layers.
|
|
6
|
+
import { C as u } from "./layers.Dt_Jdn4Y.js";
|
|
7
|
+
import { h as T, i as w, V as P, j as y, I as L, k as U, l as z, L as V, m as $, n as R, F as W, o as G } from "./layers.BnVn2uMi.js";
|
|
8
8
|
import "@lexical/code";
|
|
9
9
|
import "@lexical/hashtag";
|
|
10
10
|
import "@lexical/link";
|
|
@@ -12,7 +12,7 @@ import "@lexical/mark";
|
|
|
12
12
|
import "@lexical/overflow";
|
|
13
13
|
import "@lexical/react/LexicalHorizontalRuleNode";
|
|
14
14
|
import "@lexical/rich-text";
|
|
15
|
-
import { i as Z } from "./layers.
|
|
15
|
+
import { i as Z } from "./layers.pre7B8K-.js";
|
|
16
16
|
import { jsx as j } from "react/jsx-runtime";
|
|
17
17
|
const v = d(
|
|
18
18
|
"INSERT_MUSIC_COMMAND"
|
|
@@ -5,9 +5,9 @@ import { $getSelection as G, $isRangeSelection as z, $isRootOrShadowRoot as Dt,
|
|
|
5
5
|
import { copyToClipboard as po, $getClipboardDataFromSelection as wo } from "@lexical/clipboard";
|
|
6
6
|
import { $getNearestNodeOfType as Co, removeClassNamesFromElement as Ft, addClassNamesToElement as te, isHTMLElement as on, mergeRegister as sn, $findMatchingParent as Y, objectKlassEquals as bo } from "@lexical/utils";
|
|
7
7
|
import { debounce as yo } from "lodash-es";
|
|
8
|
-
import { w as So, x as vo, y as No, z as Do, D as To, G as xo, H as Bo } from "./layers.
|
|
9
|
-
import { t as Ge, a as Eo, u as Mo, C as ct, m as Zt, b as Lo, c as Oo } from "./layers.
|
|
10
|
-
import { s as Te, t as ut, j as Oe, l as ko, m as Ro, O as Fo, n as Io } from "./layers.
|
|
8
|
+
import { w as So, x as vo, y as No, z as Do, D as To, G as xo, H as Bo } from "./layers.8yssqxrI.js";
|
|
9
|
+
import { t as Ge, a as Eo, u as Mo, C as ct, m as Zt, b as Lo, c as Oo } from "./layers.Dt_Jdn4Y.js";
|
|
10
|
+
import { s as Te, t as ut, j as Oe, l as ko, m as Ro, O as Fo, n as Io } from "./layers.pre7B8K-.js";
|
|
11
11
|
import { jsx as h, jsxs as X, Fragment as It } from "react/jsx-runtime";
|
|
12
12
|
import Ho, { useRef as ve, useCallback as pe, useState as R, useEffect as K, useContext as dt, forwardRef as Wo, useMemo as be, Suspense as Po, lazy as $n } from "react";
|
|
13
13
|
import { CodeNode as er, $isCodeHighlightNode as tr, CodeHighlightNode as an } from "@lexical/code";
|
|
@@ -21,14 +21,14 @@ import { createPortal as zo } from "react-dom";
|
|
|
21
21
|
import { useTranslation as se } from "react-i18next";
|
|
22
22
|
import { useLexicalComposerContext as Ht } from "@lexical/react/LexicalComposerContext";
|
|
23
23
|
import { ActionIcon as xe, Box as Tt, Text as xt, Anchor as sr, Flex as Je, Image as ir, Popover as Jt, Stack as Go, TextInput as Xo, Center as Zo, Button as Bt, Tooltip as ke, Menu as Ye, LoadingOverlay as ar, Modal as Jo, useMantineTheme as Vo, useMantineColorScheme as Qo } from "@mantine/core";
|
|
24
|
-
import { a as Ve, P as _o, R as Wt, I as Se, M as qo } from "./layers.
|
|
24
|
+
import { a as Ve, P as _o, R as Wt, I as Se, M as qo } from "./layers.CoCZDINv.js";
|
|
25
25
|
import { useDisclosure as $o } from "@mantine/hooks";
|
|
26
26
|
import { EmojiPicker as es, ProjectIcon as ts, FilePicker as cn, ShakaVideoPlayer as ns, showErrorNotification as lr, AttachmentsGalleryModal as rs, BottomDrawerWithoutHeader as os } from "@layers-app/shared";
|
|
27
27
|
import { DecoratorBlockNode as Me } from "@lexical/react/LexicalDecoratorBlockNode";
|
|
28
28
|
import { IconFile as cr, IconExternalLink as ss, IconX as is, IconEdit as as } from "@tabler/icons-react";
|
|
29
29
|
import { renderToString as ls } from "react-dom/server";
|
|
30
30
|
import { BlockWithAlignableContents as Re } from "@lexical/react/LexicalBlockWithAlignableContents";
|
|
31
|
-
import { U as cs, b as us, i as ds, g as hs, c as Et, p as ur, d as As, e as gs, I as fs } from "./layers.
|
|
31
|
+
import { U as cs, b as us, i as ds, g as hs, c as Et, p as ur, d as As, e as gs, I as fs } from "./layers.BjCQNcdJ.js";
|
|
32
32
|
import { useLexicalNodeSelection as dr } from "@lexical/react/useLexicalNodeSelection";
|
|
33
33
|
import { useLexicalEditable as ms } from "@lexical/react/useLexicalEditable";
|
|
34
34
|
import { exportToSvg as ps, Excalidraw as ws } from "@excalidraw/excalidraw";
|
|
@@ -8,23 +8,23 @@ import { mergeRegister as Fe, $findMatchingParent as it, $getNearestNodeOfType a
|
|
|
8
8
|
import { Tooltip as ie, ActionIcon as ze, Menu as $, rem as V, alpha as mn, Transition as gn, Box as We, Paper as hn, Group as bn, CopyButton as yn, Divider as Cn, Input as _n, Loader as Tn } from "@mantine/core";
|
|
9
9
|
import { IconPlus as Vt, IconMinus as Et, IconClipboard as xn, IconCut as kn, IconTrash as ft, IconCopy as Qt, IconArrowsRightLeft as vn, IconPaint as St, IconColumnInsertLeft as In, IconColumnInsertRight as lt, IconGripVertical as wn, IconArrowNarrowLeft as Tt, IconReplace as Sn, IconTextPlus as Mn, IconIndentIncrease as An, IconPlayerPlay as Pn, IconReload as Dn, IconWand as Ln, IconTextSpellcheck as Nn, IconSortAscending as On, IconSortDescending as $n, IconNotes as Rn, IconLanguage as Bn, IconScript as Fn, IconHelpOctagon as zn, IconCheck as Hn, IconSparkles as Mt, IconAi as Kn } from "@tabler/icons-react";
|
|
10
10
|
import { $getNearestNodeFromDOMNode as oe, $createParagraphNode as Pe, $isElementNode as Me, ElementNode as Un, $getSelection as ue, $isRangeSelection as de, COMMAND_PRIORITY_LOW as be, DRAGOVER_COMMAND as Gn, KEY_ARROW_DOWN_COMMAND as Wn, KEY_ARROW_UP_COMMAND as jn, $isTextNode as pt, $getRoot as At, $getNodeByKey as qn, $isParagraphNode as Yn, KEY_DOWN_COMMAND as Vn, $selectAll as En, SELECTION_CHANGE_COMMAND as Xt, FORMAT_TEXT_COMMAND as le, $createTextNode as xt, $isRootNode as Pt, $isRootOrShadowRoot as Qn, COMMAND_PRIORITY_CRITICAL as rt, CAN_UNDO_COMMAND as Xn, CAN_REDO_COMMAND as Jn, KEY_MODIFIER_COMMAND as Zn, COMMAND_PRIORITY_NORMAL as Dt, CLICK_COMMAND as eo } from "lexical";
|
|
11
|
-
import { C as De, g as to } from "./layers.
|
|
11
|
+
import { C as De, g as to } from "./layers.Dt_Jdn4Y.js";
|
|
12
12
|
import { $isCodeHighlightNode as no } from "@lexical/code";
|
|
13
13
|
import "@lexical/hashtag";
|
|
14
14
|
import { $isLinkNode as Re, TOGGLE_LINK_COMMAND as oo } from "@lexical/link";
|
|
15
15
|
import "@lexical/mark";
|
|
16
16
|
import "@lexical/overflow";
|
|
17
17
|
import "@lexical/react/LexicalHorizontalRuleNode";
|
|
18
|
-
import { L as Xe, P as Ee, S as ke, T as ve, U as je, W as Lt, R as so, q as Je, Q as Ze, n as Jt, l as Nt, w as Ot, r as Zt, a3 as Qe, a4 as io, f as mt, u as lo, v as ro } from "./layers.
|
|
19
|
-
import { I as ao, $ as kt, J as co, K as en, O as uo, P as fo, z as po, Q as at, R as tn, U as mo } from "./layers.
|
|
20
|
-
import { w as et, F as Be, n as go, D as $e, O as ct, R as ho, G as bo, H as gt, J as qe, L as $t, M as yo, i as nn, u as Co, A as vt, B as on, N as Rt, P as Oe, Q as _o, S as To, T as xo, z as ko } from "./layers.
|
|
18
|
+
import { L as Xe, P as Ee, S as ke, T as ve, U as je, W as Lt, R as so, q as Je, Q as Ze, n as Jt, l as Nt, w as Ot, r as Zt, a3 as Qe, a4 as io, f as mt, u as lo, v as ro } from "./layers.BnVn2uMi.js";
|
|
19
|
+
import { I as ao, $ as kt, J as co, K as en, O as uo, P as fo, z as po, Q as at, R as tn, U as mo } from "./layers.8yssqxrI.js";
|
|
20
|
+
import { w as et, F as Be, n as go, D as $e, O as ct, R as ho, G as bo, H as gt, J as qe, L as $t, M as yo, i as nn, u as Co, A as vt, B as on, N as Rt, P as Oe, Q as _o, S as To, T as xo, z as ko } from "./layers.pre7B8K-.js";
|
|
21
21
|
import { $getSelectionStyleValueForProperty as tt, $patchStyleText as Bt } from "@lexical/selection";
|
|
22
22
|
import { NewColorPicker as ht } from "@layers-app/shared";
|
|
23
|
-
import { C as ut, I as X, A as vo } from "./layers.
|
|
23
|
+
import { C as ut, I as X, A as vo } from "./layers.CoCZDINv.js";
|
|
24
24
|
import { l as Io } from "./layers.QjAkD17S.js";
|
|
25
25
|
import { $isDecoratorBlockNode as wo } from "@lexical/react/LexicalDecoratorBlockNode";
|
|
26
26
|
import { useResizeObserver as So, useClickOutside as Mo } from "@mantine/hooks";
|
|
27
|
-
import { I as Ao, f as Po } from "./layers.
|
|
27
|
+
import { I as Ao, f as Po } from "./layers.BjCQNcdJ.js";
|
|
28
28
|
const Do = 4, Lo = 2, No = "draggable-block-menu", Oo = 16, Ft = "application/x-lexical-drag-block", It = (e) => e ? e.match(/(\d*\.?\d+)%/g) : [], $o = (e) => e < 0 ? 0 : e > 100 ? 100 : e, sn = (e, t, n) => {
|
|
29
29
|
let i = 0, s = [];
|
|
30
30
|
e.update(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const u=require("react"),h=require("react-i18next"),M=require("@lexical/react/LexicalComposerContext"),s=require("lexical"),l=require("@layers-app/shared"),m=require("./layers.
|
|
1
|
+
"use strict";const u=require("react"),h=require("react-i18next"),M=require("@lexical/react/LexicalComposerContext"),s=require("lexical"),l=require("@layers-app/shared"),m=require("./layers.BVRvG1mv.js"),c=require("./layers.BQLznd92.js");require("@lexical/code");require("@lexical/hashtag");require("@lexical/link");require("@lexical/mark");require("@lexical/overflow");require("@lexical/react/LexicalHorizontalRuleNode");require("@lexical/rich-text");const S=require("./layers.DwX5sVtx.js"),b=require("react/jsx-runtime"),N=s.createCommand("INSERT_MUSIC_COMMAND"),O=s.createCommand("UPLOAD_MUSIC_COMMAND");function F(){const[e]=M.useLexicalComposerContext(),{t}=h.useTranslation(),{imperativeHandleRef:o,maxFileSize:n}=u.useContext(m.Context);return u.useEffect(()=>{if(!e.hasNodes([c.MusicNode]))throw new Error("MusicPlugin: MusicNode not registered on editor");const i=r=>{const a=r.filter(d=>d.type.includes("Music/"));if(r.length>1){l.showMessageNotification({message:t("editor.validation.doNotUploadMoreThanSingleFile")});return}if(a[0].size>n*1024*1024){l.showErrorNotification({message:t("editor.validation.shouldNotExceed",{maxSize:n})});return}e.dispatchCommand(N,"upload"),setTimeout(()=>{e.dispatchCommand(O,r)})};return o!=null&&o.current&&(o.current.insertMusics=i),e.registerCommand(N,r=>{const a=r==="upload"?"":r,d=c.$createMusicNode(a,r!=="upload");return C(d),!1},s.COMMAND_PRIORITY_LOW)},[e]),null}function P(e,t=!1){const o=e.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);if(o&&o[2].length===11)return{platform:"youtube",id:o[2]};const n=e.match(/vk\.com\/video(?:_ext\.php\?oid=-?(\d+)&id=(\d+)|-(\d+)_(\d+))/);if(n){const a=n[1]||n[3],d=n[2]||n[4];return{platform:"vk",id:`${a}-${d}`}}const i=e.match(/rutube\.ru\/(?:play\/embed|video)\/([a-zA-Z0-9]+)/);if(i)return{platform:"rutube",id:i[1]};if(e==="upload")return{platform:"upload",id:null};if(t)return{platform:"link",id:e};const r=e.split("/").pop();return r?{platform:"download",id:r}:{platform:"unknown",id:null}}function x(e,t){let o="";switch(e){case"youtube":o=`https://www.youtube-nocookie.com/embed/${t}`;break;case"download":o=`${t}`;break;case"vk":const n=t.split("-");o=`https://vk.com/video_ext.php?oid=-${n[0]}&id=${n[1]}`;break;case"link":o=t;break;case"rutube":o=`https://rutube.ru/play/embed/${t}`;break}return o}function T(e,t){const o=x(e,t);return o.startsWith("http://")||o.startsWith("https://")?{src:o}:{attachmentId:o}}function L(e){const t=e.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return!!(t&&t[2].length===11||e.match(/vk\.com\/video(?:_ext\.php\?oid=-?(\d+)&id=(\d+)|-(\d+)_(\d+))/)||e.match(/rutube\.ru\/(?:play\/embed|video)\/([a-zA-Z0-9]+)/)||e.match(/\.(mp4|webm|ogg|mov|avi|mkv)(\?.*)?$/i))}const p=s.createCommand("INSERT_VIDEO_COMMAND"),v=s.createCommand("UPLOAD_VIDEO_COMMAND");function w(){const[e]=M.useLexicalComposerContext(),{t}=h.useTranslation(),{imperativeHandleRef:o,maxFileSize:n}=u.useContext(m.Context);return u.useEffect(()=>{if(!e.hasNodes([c.VideoNode]))throw new Error("VideoPlugin: VideoNode not registered on editor");const i=r=>{const a=r.filter(d=>d.type.includes("video/"));if(r.length>1){l.showMessageNotification({message:t("editor.validation.doNotUploadMoreThanSingleFile")});return}if(a[0].size>n*1024*1024){l.showErrorNotification({message:t("editor.validation.shouldNotExceed",{maxSize:n})});return}e.dispatchCommand(p,"upload"),setTimeout(()=>{e.dispatchCommand(v,r)})};return o!=null&&o.current&&(o.current.insertVideos=i),e.registerCommand(p,r=>{const a=c.$createVideoNode(r,"100%","100%","left",r!=="upload");return C(a),!1},s.COMMAND_PRIORITY_LOW)},[e]),null}const f=s.createCommand("INSERT_IMAGE_COMMAND"),A=s.createCommand("UPLOAD_IMAGE_COMMAND");function U(){const[e]=M.useLexicalComposerContext(),{t}=h.useTranslation(),{imperativeHandleRef:o}=u.useContext(m.Context),{maxFileSize:n}=u.useContext(m.Context);return u.useEffect(()=>{if(!e.hasNodes([c.ImageNode]))throw new Error("ImageOlugin: FileNode not registered on editor");const i=r=>{if(r.length>1){l.showMessageNotification({message:t("editor.validation.doNotUploadMoreThanSingleFile")});return}if(r[0].size>n*1024*1024){l.showErrorNotification({message:t("editor.validation.shouldNotExceed",{maxSize:n})});return}e.dispatchCommand(f,{src:"upload",create:!1,altText:""}),setTimeout(()=>{e.dispatchCommand(A,r)},100)};return o!=null&&o.current&&(o.current.insertImages=i),e.registerCommand(f,r=>{const a=c.$createImageNode(r);return C(a),!1},s.COMMAND_PRIORITY_LOW)},[e]),null}const C=e=>{var a;const t=S.getCurrentElement();if(s.$isRootNode(t))return t.append(e),!0;let o=t==null?void 0:t.getParent();const n=o instanceof s.ParagraphNode||o instanceof c.ListItemNode||o instanceof c.ListNode,i=t instanceof c.ExtendedTextNode&&!!t.__text,r=s.$isElementNode(t)&&(t==null?void 0:t.getChildrenSize())>0;if(r&&(o=t),n&&i||n||r)return o.insertAfter(e),!0;if(t&&o)return t instanceof c.LayoutDividerNode?((a=t.getPreviousSibling())==null||a.replace(e),!0):(t==null||t.replace(e),!0);if(!t)return s.$getRoot().append(e),!0},_=s.createCommand("INSERT_FILE_COMMAND"),E=s.createCommand("UPLOAD_FILE_COMMAND");function y(){const[e]=M.useLexicalComposerContext(),{t}=h.useTranslation(),{imperativeHandleRef:o,maxFileSize:n}=u.useContext(m.Context);return u.useEffect(()=>{if(!e.hasNodes([c.FileNode]))throw new Error("FilePlugin: FileNode not registered on editor");const i=r=>{if(r.length>1){l.showMessageNotification({message:t("editor.validation.doNotUploadMoreThanSingleFile")});return}if(r[0].size>n*1024*1024){l.showErrorNotification({message:t("editor.validation.shouldNotExceed",{maxSize:n})});return}e.dispatchCommand(_,"upload"),setTimeout(()=>{e.dispatchCommand(E,r)})};return o!=null&&o.current&&(o.current.insertFiles=i),e.registerCommand(_,r=>{const a=c.$createFileNode(r,"100%","100%","left",r!=="upload");return C(a),!1},s.COMMAND_PRIORITY_LOW)},[e]),null}const R=({children:e,...t})=>{const{imagePickerSettings:o,maxFileSize:n}=u.useContext(m.Context),{t:i}=h.useTranslation("ui"),{giphyToken:r,unsplashClientId:a,link:d,download:I,maxUploadFiles:D}=o,k=u.useMemo(()=>[{key:"gallery",enabled:!0},{key:"giphy",enabled:r},{key:"unsplash",enabled:a},{key:"link",enabled:d===void 0?!0:d},{key:"upload",enabled:I===void 0?!0:I}].filter(g=>g.enabled).map(g=>g.key),[o]);return b.jsx(l.FilePicker,{showTabs:k,dropZoneProps:{maxFiles:D||1,maxSize:n*1024*1024},giphyToken:r,unsplashClientId:a,locales:{gallery:i("changeCover.gallery"),link:i("changeCover.link"),search:i("changeCover.searchImage"),upload:i("changeCover.upload"),uploadFile:i("changeCover.uploadFile"),change:i("changeCover.change"),remove:i("remove"),error:i("errorMessage"),dragOrClickToChoose:i("changeCover.dragOrClickToChoose"),maxFileSize:i("changeCover.maxFileSize",{maxSize:n}),pasteLink:i("changeCover.pasteLink"),submitLink:i("changeCover.submitLink"),worksWithAnyImage:i("changeCover.worksWithAnyImage"),noImages:i("changeCover.noResult"),errors:{typeIsNotAllowed:"This file type is not supported",shouldNotExceed:i("changeCover.maxFileSize",{maxSize:n}),doNotUploadMoreThanSingleFile:i("dropZone.errors.doNotUploadMoreThanSingleFile"),invalidLink:i("changeCover.invalidLink")}},...t,children:e})};exports.FilePlugin=y;exports.FilePlugin$1=U;exports.INSERT_FILE_COMMAND=_;exports.INSERT_IMAGE_COMMAND=f;exports.INSERT_MUSIC_COMMAND=N;exports.INSERT_VIDEO_COMMAND=p;exports.ImagePicker=R;exports.MusicPlugin=F;exports.UPLOAD_FILE_COMMAND=E;exports.UPLOAD_IMAGE_COMMAND=A;exports.UPLOAD_MUSIC_COMMAND=O;exports.UPLOAD_VIDEO_COMMAND=v;exports.VideoPlugin=w;exports.getShakaVideoPlayerProps=T;exports.getVideoIframeUrl=x;exports.isValidMediaUrl=L;exports.parseVideoURL=P;
|
|
@@ -4,16 +4,16 @@ import { useTranslation as U } from "react-i18next";
|
|
|
4
4
|
import { useLexicalComposerContext as je } from "@lexical/react/LexicalComposerContext";
|
|
5
5
|
import { Flex as Ue, UnstyledButton as qe, Loader as Ve, Text as ue, Progress as Ze, Tooltip as we, Modal as Je, Button as Ke, Menu as w, Portal as Qe } from "@mantine/core";
|
|
6
6
|
import { $getNodeByKey as et, CLICK_COMMAND as tt, COMMAND_PRIORITY_NORMAL as nt, $createParagraphNode as rt, $getNearestNodeFromDOMNode as it, DecoratorNode as ot, FORMAT_ELEMENT_COMMAND as st, BLUR_COMMAND as ct, COMMAND_PRIORITY_LOW as ze, FOCUS_COMMAND as at, $getRoot as lt } from "lexical";
|
|
7
|
-
import { C as de } from "./layers.
|
|
7
|
+
import { C as de } from "./layers.Dt_Jdn4Y.js";
|
|
8
8
|
import { IconPalette as xe, IconLayoutSidebarLeftExpand as ut, IconSend as dt, IconReload as mt, IconShieldCheckFilled as ht, IconMessages as pt, IconFilter as gt, IconArrowBackUp as Me, IconMessage as ft, IconMusic as It, IconApi as yt, IconX as Ct, IconPaperclip as Et, IconAt as zt, IconCodeCircle as Mt, IconBaseline as be, IconExclamationCircle as Tt, IconAlertTriangle as Pt, IconCheck as Te, IconFile as ae, IconMoodSmile as Rt, IconBrandYoutube as _t, IconCheckupList as wt, IconDropletOff as xt, IconLayersSubtract as bt, IconLayersUnion as St, IconTableOff as kt, IconContainerOff as Dt, IconRowInsertBottom as Nt, IconRowInsertTop as vt, IconColumnInsertRight as Ot, IconColumnInsertLeft as Lt, IconArrowBarToRight as At, IconArrowBarToLeft as Ht, IconArrowBarToDown as Bt, IconArrowBarToUp as Ft, IconCut as Wt, IconClipboard as $t, IconCopy as Gt, IconDotsVertical as Yt, IconColumns3 as Xt, IconCaretRight as jt, IconTable as Se, IconTrash as Ut, IconPencil as qt, IconCircleX as Vt, IconCircleCheck as Zt, IconGripVertical as Jt, IconChevronRight as Kt, IconChevronDown as Qt, IconPlus as en, IconMinus as tn, IconSuperscript as nn, IconSubscript as rn, IconStrikethrough as on, IconFlipHorizontal as sn, IconAlignJustified as cn, IconAlignCenter as an, IconAlignRight as ln, IconAlignLeft as oe, IconPhotoCheck as un, IconPhoto as dn, IconBucketDroplet as mn, IconColorPicker as hn, IconLink as pn, IconUnderline as gn, IconItalic as fn, IconBold as In, IconArrowForwardUp as yn, IconLetterT as Cn, IconQuote as En, IconIndentIncrease as zn, IconListNumbers as ke, IconH3 as Mn, IconH2 as Tn, IconH1 as De, IconCode as Ne, IconListCheck as Pn, IconList as Rn, IconColumns2 as _n, IconTemplate as wn, IconApps as xn } from "@tabler/icons-react";
|
|
9
9
|
import { ProjectIcon as bn } from "@layers-app/shared";
|
|
10
|
-
import { aE as Sn, a4 as ve, a0 as kn, Z as Dn, a1 as Nn } from "./layers.
|
|
11
|
-
import { l as Pe, O as vn, c as Re, U as On, I as Ln } from "./layers.
|
|
10
|
+
import { aE as Sn, a4 as ve, a0 as kn, Z as Dn, a1 as Nn } from "./layers.BnVn2uMi.js";
|
|
11
|
+
import { l as Pe, O as vn, c as Re, U as On, I as Ln } from "./layers.pre7B8K-.js";
|
|
12
12
|
import { createPortal as An } from "react-dom";
|
|
13
13
|
import { ContentEditable as Hn } from "@lexical/react/LexicalContentEditable";
|
|
14
14
|
import { $createHeadingNode as Bn } from "@lexical/rich-text";
|
|
15
15
|
import { mergeRegister as Fn } from "@lexical/utils";
|
|
16
|
-
import { V as Wn, W as $n, X as Gn, I as Yn, Y as Xn, Z as jn } from "./layers.
|
|
16
|
+
import { V as Wn, W as $n, X as Gn, I as Yn, Y as Xn, Z as jn } from "./layers.8yssqxrI.js";
|
|
17
17
|
const _e = {
|
|
18
18
|
bullet: Rn,
|
|
19
19
|
check: Pn,
|
|
@@ -757,7 +757,7 @@ const rr = "_listContainer_1d88b_1", ir = "_list_1d88b_1", or = "_text_1d88b_28"
|
|
|
757
757
|
title: r("editor.menu.media.excalidraw.hint.description"),
|
|
758
758
|
icon: /* @__PURE__ */ t(xe, { stroke: 2, size: 18 }),
|
|
759
759
|
onSelect: () => {
|
|
760
|
-
import("./layers.
|
|
760
|
+
import("./layers.8yssqxrI.js").then((a) => a.ac).then(
|
|
761
761
|
({ INSERT_EXCALIDRAW_COMMAND: a }) => {
|
|
762
762
|
g(e, () => {
|
|
763
763
|
e.dispatchCommand(a, void 0);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const Oe=require("@lexical/react/LexicalComposerContext"),n=require("react/jsx-runtime"),l=require("react"),Be=require("react-dom"),Ee=require("react-i18next"),xe=require("@lexical/rich-text"),de=require("@lexical/utils"),u=require("@mantine/core"),$=require("@tabler/icons-react"),c=require("lexical"),Ce=require("./layers.CZPeYQ9g.js"),rt=require("@lexical/code");require("@lexical/hashtag");const Me=require("@lexical/link");require("@lexical/mark");require("@lexical/overflow");require("@lexical/react/LexicalHorizontalRuleNode");const C=require("./layers.B90YwJga.js"),ee=require("./layers.CZ_Lt7IL.js"),T=require("./layers.Dgok89qX.js"),Ne=require("@lexical/selection"),Pe=require("@layers-app/shared"),V=require("./layers.C03OvlLb.js"),lt=require("./layers.DNCgFYS7.js"),at=require("@lexical/react/LexicalDecoratorBlockNode"),He=require("@mantine/hooks"),Ke=require("./layers.CJiIq6YQ.js"),ct=4,ut=2,dt="draggable-block-menu",ft=16,ze="application/x-lexical-drag-block",De=e=>e?e.match(/(\d*\.?\d+)%/g):[],Ze=e=>e<0?0:e>100?100:e,Je=(e,t,o)=>{let i=0,s=[];e.update(()=>{if(e&&t){const f=e.getElementByKey(t.getKey());if(f){const p=f.style;s=De(p.getPropertyValue("grid-template-columns")).map(m=>m.slice(0,-1)),i=s?s.length:0}}const a=100/(i+1),r=[...s];r.splice(o,0,`${a}%`);let d=a/i;for(let f=0;f<r.length;f++)if(o!==f){const p=Number(r[f])-d;r[f]=`minmax(100px,${Ze(p)}%)`}else r[f]=`minmax(100px,${r[f]})`;t.setTemplateColumns(r.join(" "))})},Re=(e,t,o,i)=>{e.update(()=>{const s=e.getElementByKey(t.getKey());if(!s)return;let a=i;o<i&&(a=i-1);const d=s.style.getPropertyValue("grid-template-columns").match(/minmax\([^)]*\)|\S+/g)||[],f=d.splice(o,1)[0];d.splice(a,0,f),t.setTemplateColumns(d.join(" "))})},Ie=(e,t)=>(e!=null&&e.children?Array.from(e.children):[]).indexOf(t);function mt(e,t,o,i){var f;let s=e.getAttribute("data-direction")==="left",a=e.getAttribute("data-direction")==="right",r=e.getAttribute("data-index"),d=e.getAttribute("data-index-start");if(s||a||r){let p=(f=o.getParent())==null?void 0:f.getParent();if(o instanceof C.LayoutContainerNode&&(p=o),o instanceof C.LayoutDividerNode||o instanceof C.LayoutContainerNode){const m=p==null?void 0:p.getChildren();let N=i instanceof C.LayoutDividerNode;if((m==null?void 0:m.length)>=4&&!N)return!0;t.update(()=>{var _;let g=0;s?g=0:a?g=((_=p==null?void 0:p.getChildren())==null?void 0:_.length)-1:g=Number(r),N?Re(t,p,Number(d),g):Je(t,p,g);let A=null;g!==void 0&&t.update(()=>{if(A=p.getChildren()[g],N)o instanceof C.LayoutContainerNode?A.insertAfter(i.getParent()):A.insertBefore(i.getParent());else if(a)A.insertAfter(C.$createLayoutItemNode().append(i).append(C.$createLayoutDividerNode()));else{const j=i.getParent(),L=j==null?void 0:j.getParent();C.$isLayoutItemNode(j)&&(j==null?void 0:j.getChildrenSize())===2&&C.$isLayoutItemNode(j)&&C.$isLayoutContainerNode(L)&&T.removeNodeKeepContent(t,j,L),A.insertBefore(C.$createLayoutItemNode().append(i).append(C.$createLayoutDividerNode()))}})})}else t.update(()=>{const m=C.$createLayoutContainerNode(ee.GRID_TWO_COL_WITH_GAP);let N;if(C.$isCalloutWrapperNode(o)||ee.$isCollapsibleContainerNode(o)){const g=i.getParent(),A=g==null?void 0:g.getParent();if(C.$isLayoutItemNode(g)&&(g==null?void 0:g.getChildrenSize())===2&&C.$isLayoutContainerNode(A)){const j=A.getParent(),L=j==null?void 0:j.getParent(),F=A.getChildren(),v=F.findIndex(B=>B===g)===0?1:0,P=F[v];if(C.$isLayoutItemNode(P)){const B=P.getChildren()[0];C.$isCalloutWrapperNode(L)&&(L.append(B),A.remove(),N=T.$copyNodeDeep(L))}}else N=T.$copyNodeDeep(o,i)}else N=T.$copyNodeDeep(o);N&&(s?(m.append(C.$createLayoutItemNode().append(i).append(C.$createLayoutDividerNode())),m.append(C.$createLayoutItemNode().append(N).append(C.$createLayoutDividerNode()))):(m.append(C.$createLayoutItemNode().append(N).append(C.$createLayoutDividerNode())),m.append(C.$createLayoutItemNode().append(i).append(C.$createLayoutDividerNode()))),o.insertAfter(m),o.remove(),N.selectStart())});return!0}return!1}function pt(e,t,o="right",i=!1){e.update(()=>{const s=c.$getNearestNodeFromDOMNode(t),a=s==null?void 0:s.getParent();if(a){if(De(a.__templateColumns).length===4)return;let d=Ie(t.parentElement,t);o==="right"&&(d=d+1),Je(e,a,d)}const r=C.$createLayoutItemNode().append(c.$createParagraphNode()).append(C.$createLayoutDividerNode());s&&(o==="right"?i?(s.insertBefore(T.$copyNodeDeep(s)),s.selectStart()):(s.insertAfter(r),r==null||r.selectStart()):(s.insertBefore(r),r.selectStart()))})}const et=(e,t)=>{const o=t==null?void 0:t.getParent();let i=De(o==null?void 0:o.getTemplateColumns());const s=o==null?void 0:o.getChildren();let a=0;if(s&&t){for(let m=0;m<s.length;m++)if(s[m].__key===t.__key){a=m;break}}i.splice(a,1);const r=i.map(m=>parseFloat(m)),d=r.reduce((m,N)=>m+N,0),p=r.map(m=>m/d*100).map(m=>`minmax(50px,${m.toFixed(2)}%)`);o==null||o.setTemplateColumns(p.join(" "))},gt=e=>e.className.includes("editor-image")||e.className.includes("video-container")?e:e.className.includes("editor-excalidraw")?e.firstChild:null,tt=(e,t)=>t!=null&&t.__key&&e!==t.__key?tt(e,t==null?void 0:t.getParent()):e===(t==null?void 0:t.__key),qe=(e,t,o)=>{e.update(()=>{var r,d,f;const i=(r=t==null?void 0:t.getParent())==null?void 0:r.getParent(),s=t==null?void 0:t.getParent(),a=o==="right"?(d=t==null?void 0:t.getParent())==null?void 0:d.getNextSibling():(f=t==null?void 0:t.getParent())==null?void 0:f.getPreviousSibling();if(s&&a&&i instanceof C.LayoutContainerNode){const p=e.getElementByKey(s.getKey()),m=e.getElementByKey(i.getKey()),N=Ie(m,p);s&&i&&a&&(o==="right"&&(Re(e,i,N+1,N),a.insertAfter(s)),o==="left"&&(Re(e,i,N,N+1),a.insertBefore(s)))}})};function ht(e){e&&(e.style.display="none")}function We({blockElement:e,editor:t,isTop:o,isClickedBlockRef:i,setDraggableBlockElem:s}){e&&(i.current=!0,t.update(()=>{const a=c.$getNearestNodeFromDOMNode(e);if(a){const r=c.$createParagraphNode();o?(a.insertBefore(r),setTimeout(()=>{s(t.getElementByKey(r.__key)),t.update(()=>{r.selectStart()})})):(a.insertAfter(r),setTimeout(()=>{s(t.getElementByKey(r.__key)),t.update(()=>{r.selectEnd()})}))}}))}function xt(e){const t=(f,p)=>f?parseFloat(window.getComputedStyle(f)[p]):0,{marginTop:o,marginBottom:i}=window.getComputedStyle(e),s=t(e.previousElementSibling,"marginBottom"),a=t(e.nextElementSibling,"marginTop"),r=Math.max(parseFloat(o),s);return{marginBottom:Math.max(parseFloat(i),a),marginTop:r}}function Ct(e){return!!e.closest(`.${dt}`)}function Ue(e,t,o,i){if(!e){t.style.opacity="0";return}t.style.display="block";let s=null;const a=gt(e);a&&a.style.justifyContent!=="left"&&a.firstChild instanceof HTMLElement?s=a.firstChild.getBoundingClientRect():s=e.getBoundingClientRect();let r=null,d=0,f=!0,p=0;if(s){let F=e.firstChild instanceof HTMLElement&&(e.firstChild.hasAttribute("data-lexical-text")||e.firstChild.tagName==="LI"||e.firstChild.tagName==="A")?e.firstChild:null;if(F&&!F.className.includes("editor-image")&&e.tagName!=="CODE"){const M=window.getComputedStyle(F),v=parseFloat(M.lineHeight),P=parseFloat(M.fontSize);p=Math.ceil(P+(v-P)/2),r=F.getBoundingClientRect()}else if(e.firstChild instanceof HTMLElement&&e.firstChild.tagName==="BR"&&e.tagName!=="CODE"){const M=window.getComputedStyle(e,"::before");p=parseFloat(M.height)||30}else e&&(e.tagName==="HR"||e.matches(":has(audio)")||e.classList.contains("file-container"))?p=e.clientHeight:e.firstChild instanceof HTMLElement&&e.firstChild.tagName==="SUMMARY"?p=e.firstChild.clientHeight:(r=s,f=!1)}const m=o.getBoundingClientRect(),N=(r==null?void 0:r.top)||s.top,g=p||d,A=t.clientHeight,_=g-A;let j=!f||!g?s.top+7-m.top:N+_/2-m.top,L=s.left-m.left-A*2-3;e.tagName==="LI"&&e.getAttribute("role")!=="checkbox"&&(L=L-26,j=j-1),a&&(j=N-m.top+7,(a.style.justifyContent==="center"||a.style.justifyContent==="right")&&(L=L+10)),e.matches(":has(.resizable-container__handle)")&&!e.matches(":has(.hide-padding)")&&(j=N-m.top+27),s.top<0&&(j=j+-s.top),e.className==="dsd__theme__layoutDivider"&&(t.style.display="none",s.top-t.clientHeight<0?e.style.setProperty("--height-column",`${e.clientHeight+s.top-t.clientHeight-7}px`):e.style.setProperty("--height-column",`${e.clientHeight}px`)),t.style.opacity="1",!i&&L>-40&&(t.style.transform=`translate(${L}px, ${j}px)`)}function Ye(e,t){const{transform:o}=t.style;t.style.transform="translateZ(0)",e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function yt(e,t){const o=document.createElement("div");o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",t.forEach(i=>{const s=i.cloneNode(!0);s.style.position="relative",o.appendChild(s)}),document.body.appendChild(o),e.setDragImage(o,0,0),setTimeout(()=>document.body.removeChild(o),0)}function bt(e,t,o,i,s,a,r){var x;const{top:d,height:f,width:p,left:m}=t.getBoundingClientRect(),{top:N,left:g,width:A}=s==null?void 0:s.getBoundingClientRect(),{marginTop:_,marginBottom:j}=xt(t);let L=d;o>=d?(r.current.isBottom=!0,L+=f+j/2):(r.current.isBottom=!1,L-=_/2);const F=L-N-ut,M=ft-ct,P=a.target.closest(".dsd__theme__layoutDivider");e.setAttribute("data-index",""),e.style.background="deepskyblue";const B=m-g-M;if(i<=m&&!P){if(t.closest(".dsd__theme__layoutItem"))return;e.style.transform=`translate(${B}px, ${d-N}px)`,e.style.width="4px",e.style.height=`${f}px`,e.style.opacity=".4",e.setAttribute("data-direction","left")}else if(i>=A-B&&!P&&!t.closest(".dsd__theme__layoutItem"))t.classList.contains("dsd__theme__layoutContainer")&&!e.getAttribute("data-index-start")&&t&&t.children.length>=4&&(e.style.background="red"),e.style.transform=`translate(${A-B}px, ${d-N}px)`,e.style.width="4px",e.style.height=`${f}px`,e.style.opacity=".4",e.setAttribute("data-direction","right");else if(P){a.preventDefault();const S=(x=P.parentNode)==null?void 0:x.parentNode;(S==null?void 0:S.children.length)===4&&(e.style.background="red");const k=P.parentNode,O=Ie(S,k),R=O?P.getBoundingClientRect().left-g:B+30;e.style.transform=`translate(${R}px, ${d-N}px)`,e.style.width="4px",e.style.height=`${f}px`,e.style.opacity=".4",e.setAttribute("data-index",`${O}`)}else e.style.transform=`translate(${B}px, ${F}px)`,e.style.width=`${p+M}px`,e.style.opacity=".4",e.style.height="4px",e.setAttribute("data-direction","")}function Ge(e){e&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)")}const Tt=({hoveredButton:e,insertNewParagraph:t,currentDraggableBlockRef:o,setHoveredButton:i,isClickedBlockRef:s,setDraggableBlockElem:a,editor:r,t:d})=>n.jsx("div",{className:`icon add-block-menu ${e?"active":""}`,onClick:()=>{t({blockElement:o.current.htmlElement,editor:r,isTop:!1,isClickedBlockRef:s,setDraggableBlockElem:a}),i("both")},onMouseEnter:()=>{i("bottom")},onMouseLeave:()=>{i("both")},children:n.jsx(u.Tooltip,{openDelay:300,label:d("editor.hoverOptions.addNewBlockAbove"),position:"bottom",disabled:s.current||!e,children:n.jsx(u.ActionIcon,{radius:"sm",color:"gray",size:"xs",variant:"subtle","aria-label":"Settings",children:e==="bottom"?n.jsx($.IconPlus,{}):n.jsx($.IconMinus,{})})})}),Mt=({hoveredButton:e,insertNewParagraph:t,currentDraggableBlockRef:o,setHoveredButton:i,isClickedBlockRef:s,setDraggableBlockElem:a,editor:r,t:d})=>n.jsx("div",{className:`icon add-block-menu add-block-menu_top ${e?"active":""}`,onClick:()=>{t({blockElement:o.current.htmlElement,editor:r,isTop:!0,isClickedBlockRef:s,setDraggableBlockElem:a}),i("both")},onMouseEnter:()=>{i("top")},onMouseLeave:()=>{i("both")},children:n.jsx(u.Tooltip,{disabled:s.current||!e,openDelay:300,label:d("editor.hoverOptions.addNewBlockBelow"),position:"top",children:n.jsx(u.ActionIcon,{radius:"sm",color:"gray",size:"xs",variant:"subtle","aria-label":"Settings",children:e==="top"?n.jsx($.IconPlus,{}):n.jsx($.IconMinus,{})})})});function nt(e,t){var a,r;const o=(a=t.exportDOM)==null?void 0:a.call(t,e),i=(o==null?void 0:o.element)??null;if(c.$isElementNode(t)){const d=i??document.createElement("div"),f=((r=t.getChildren)==null?void 0:r.call(t))??[];for(const p of f){const m=nt(e,p);if(m)d.appendChild(m);else{const N=typeof p.getTextContent=="function"?p.getTextContent():"";N&&d.appendChild(document.createTextNode(N))}}return typeof(o==null?void 0:o.after)=="function"&&o.after(d),d}if(i)return typeof(o==null?void 0:o.after)=="function"&&o.after(i),i;const s=typeof t.getTextContent=="function"?t.getTextContent():"";return s?document.createTextNode(s):null}async function Xe(e,t){const o=e.getRootElement(),i=Array.from(o.querySelectorAll(".selected-block"));if(!i.length)return;let s="",a="";e.getEditorState().read(()=>{e.update(()=>{let r=i.map(f=>c.$getNearestNodeFromDOMNode(f)).filter(f=>!!f);s=r.map(f=>typeof f.getTextContent=="function"?f.getTextContent():"").filter(Boolean).join(`
|
|
1
|
+
"use strict";const Oe=require("@lexical/react/LexicalComposerContext"),n=require("react/jsx-runtime"),l=require("react"),Be=require("react-dom"),Ee=require("react-i18next"),xe=require("@lexical/rich-text"),de=require("@lexical/utils"),u=require("@mantine/core"),$=require("@tabler/icons-react"),c=require("lexical"),Ce=require("./layers.BVRvG1mv.js"),rt=require("@lexical/code");require("@lexical/hashtag");const Me=require("@lexical/link");require("@lexical/mark");require("@lexical/overflow");require("@lexical/react/LexicalHorizontalRuleNode");const C=require("./layers.BQLznd92.js"),ee=require("./layers.B8z-e4Vg.js"),T=require("./layers.DwX5sVtx.js"),Ne=require("@lexical/selection"),Pe=require("@layers-app/shared"),V=require("./layers.D2zjLyjP.js"),lt=require("./layers.DNCgFYS7.js"),at=require("@lexical/react/LexicalDecoratorBlockNode"),He=require("@mantine/hooks"),Ke=require("./layers.CTSBFg3j.js"),ct=4,ut=2,dt="draggable-block-menu",ft=16,ze="application/x-lexical-drag-block",De=e=>e?e.match(/(\d*\.?\d+)%/g):[],Ze=e=>e<0?0:e>100?100:e,Je=(e,t,o)=>{let i=0,s=[];e.update(()=>{if(e&&t){const f=e.getElementByKey(t.getKey());if(f){const p=f.style;s=De(p.getPropertyValue("grid-template-columns")).map(m=>m.slice(0,-1)),i=s?s.length:0}}const a=100/(i+1),r=[...s];r.splice(o,0,`${a}%`);let d=a/i;for(let f=0;f<r.length;f++)if(o!==f){const p=Number(r[f])-d;r[f]=`minmax(100px,${Ze(p)}%)`}else r[f]=`minmax(100px,${r[f]})`;t.setTemplateColumns(r.join(" "))})},Re=(e,t,o,i)=>{e.update(()=>{const s=e.getElementByKey(t.getKey());if(!s)return;let a=i;o<i&&(a=i-1);const d=s.style.getPropertyValue("grid-template-columns").match(/minmax\([^)]*\)|\S+/g)||[],f=d.splice(o,1)[0];d.splice(a,0,f),t.setTemplateColumns(d.join(" "))})},Ie=(e,t)=>(e!=null&&e.children?Array.from(e.children):[]).indexOf(t);function mt(e,t,o,i){var f;let s=e.getAttribute("data-direction")==="left",a=e.getAttribute("data-direction")==="right",r=e.getAttribute("data-index"),d=e.getAttribute("data-index-start");if(s||a||r){let p=(f=o.getParent())==null?void 0:f.getParent();if(o instanceof C.LayoutContainerNode&&(p=o),o instanceof C.LayoutDividerNode||o instanceof C.LayoutContainerNode){const m=p==null?void 0:p.getChildren();let N=i instanceof C.LayoutDividerNode;if((m==null?void 0:m.length)>=4&&!N)return!0;t.update(()=>{var _;let g=0;s?g=0:a?g=((_=p==null?void 0:p.getChildren())==null?void 0:_.length)-1:g=Number(r),N?Re(t,p,Number(d),g):Je(t,p,g);let A=null;g!==void 0&&t.update(()=>{if(A=p.getChildren()[g],N)o instanceof C.LayoutContainerNode?A.insertAfter(i.getParent()):A.insertBefore(i.getParent());else if(a)A.insertAfter(C.$createLayoutItemNode().append(i).append(C.$createLayoutDividerNode()));else{const j=i.getParent(),L=j==null?void 0:j.getParent();C.$isLayoutItemNode(j)&&(j==null?void 0:j.getChildrenSize())===2&&C.$isLayoutItemNode(j)&&C.$isLayoutContainerNode(L)&&T.removeNodeKeepContent(t,j,L),A.insertBefore(C.$createLayoutItemNode().append(i).append(C.$createLayoutDividerNode()))}})})}else t.update(()=>{const m=C.$createLayoutContainerNode(ee.GRID_TWO_COL_WITH_GAP);let N;if(C.$isCalloutWrapperNode(o)||ee.$isCollapsibleContainerNode(o)){const g=i.getParent(),A=g==null?void 0:g.getParent();if(C.$isLayoutItemNode(g)&&(g==null?void 0:g.getChildrenSize())===2&&C.$isLayoutContainerNode(A)){const j=A.getParent(),L=j==null?void 0:j.getParent(),F=A.getChildren(),v=F.findIndex(B=>B===g)===0?1:0,P=F[v];if(C.$isLayoutItemNode(P)){const B=P.getChildren()[0];C.$isCalloutWrapperNode(L)&&(L.append(B),A.remove(),N=T.$copyNodeDeep(L))}}else N=T.$copyNodeDeep(o,i)}else N=T.$copyNodeDeep(o);N&&(s?(m.append(C.$createLayoutItemNode().append(i).append(C.$createLayoutDividerNode())),m.append(C.$createLayoutItemNode().append(N).append(C.$createLayoutDividerNode()))):(m.append(C.$createLayoutItemNode().append(N).append(C.$createLayoutDividerNode())),m.append(C.$createLayoutItemNode().append(i).append(C.$createLayoutDividerNode()))),o.insertAfter(m),o.remove(),N.selectStart())});return!0}return!1}function pt(e,t,o="right",i=!1){e.update(()=>{const s=c.$getNearestNodeFromDOMNode(t),a=s==null?void 0:s.getParent();if(a){if(De(a.__templateColumns).length===4)return;let d=Ie(t.parentElement,t);o==="right"&&(d=d+1),Je(e,a,d)}const r=C.$createLayoutItemNode().append(c.$createParagraphNode()).append(C.$createLayoutDividerNode());s&&(o==="right"?i?(s.insertBefore(T.$copyNodeDeep(s)),s.selectStart()):(s.insertAfter(r),r==null||r.selectStart()):(s.insertBefore(r),r.selectStart()))})}const et=(e,t)=>{const o=t==null?void 0:t.getParent();let i=De(o==null?void 0:o.getTemplateColumns());const s=o==null?void 0:o.getChildren();let a=0;if(s&&t){for(let m=0;m<s.length;m++)if(s[m].__key===t.__key){a=m;break}}i.splice(a,1);const r=i.map(m=>parseFloat(m)),d=r.reduce((m,N)=>m+N,0),p=r.map(m=>m/d*100).map(m=>`minmax(50px,${m.toFixed(2)}%)`);o==null||o.setTemplateColumns(p.join(" "))},gt=e=>e.className.includes("editor-image")||e.className.includes("video-container")?e:e.className.includes("editor-excalidraw")?e.firstChild:null,tt=(e,t)=>t!=null&&t.__key&&e!==t.__key?tt(e,t==null?void 0:t.getParent()):e===(t==null?void 0:t.__key),qe=(e,t,o)=>{e.update(()=>{var r,d,f;const i=(r=t==null?void 0:t.getParent())==null?void 0:r.getParent(),s=t==null?void 0:t.getParent(),a=o==="right"?(d=t==null?void 0:t.getParent())==null?void 0:d.getNextSibling():(f=t==null?void 0:t.getParent())==null?void 0:f.getPreviousSibling();if(s&&a&&i instanceof C.LayoutContainerNode){const p=e.getElementByKey(s.getKey()),m=e.getElementByKey(i.getKey()),N=Ie(m,p);s&&i&&a&&(o==="right"&&(Re(e,i,N+1,N),a.insertAfter(s)),o==="left"&&(Re(e,i,N,N+1),a.insertBefore(s)))}})};function ht(e){e&&(e.style.display="none")}function We({blockElement:e,editor:t,isTop:o,isClickedBlockRef:i,setDraggableBlockElem:s}){e&&(i.current=!0,t.update(()=>{const a=c.$getNearestNodeFromDOMNode(e);if(a){const r=c.$createParagraphNode();o?(a.insertBefore(r),setTimeout(()=>{s(t.getElementByKey(r.__key)),t.update(()=>{r.selectStart()})})):(a.insertAfter(r),setTimeout(()=>{s(t.getElementByKey(r.__key)),t.update(()=>{r.selectEnd()})}))}}))}function xt(e){const t=(f,p)=>f?parseFloat(window.getComputedStyle(f)[p]):0,{marginTop:o,marginBottom:i}=window.getComputedStyle(e),s=t(e.previousElementSibling,"marginBottom"),a=t(e.nextElementSibling,"marginTop"),r=Math.max(parseFloat(o),s);return{marginBottom:Math.max(parseFloat(i),a),marginTop:r}}function Ct(e){return!!e.closest(`.${dt}`)}function Ue(e,t,o,i){if(!e){t.style.opacity="0";return}t.style.display="block";let s=null;const a=gt(e);a&&a.style.justifyContent!=="left"&&a.firstChild instanceof HTMLElement?s=a.firstChild.getBoundingClientRect():s=e.getBoundingClientRect();let r=null,d=0,f=!0,p=0;if(s){let F=e.firstChild instanceof HTMLElement&&(e.firstChild.hasAttribute("data-lexical-text")||e.firstChild.tagName==="LI"||e.firstChild.tagName==="A")?e.firstChild:null;if(F&&!F.className.includes("editor-image")&&e.tagName!=="CODE"){const M=window.getComputedStyle(F),v=parseFloat(M.lineHeight),P=parseFloat(M.fontSize);p=Math.ceil(P+(v-P)/2),r=F.getBoundingClientRect()}else if(e.firstChild instanceof HTMLElement&&e.firstChild.tagName==="BR"&&e.tagName!=="CODE"){const M=window.getComputedStyle(e,"::before");p=parseFloat(M.height)||30}else e&&(e.tagName==="HR"||e.matches(":has(audio)")||e.classList.contains("file-container"))?p=e.clientHeight:e.firstChild instanceof HTMLElement&&e.firstChild.tagName==="SUMMARY"?p=e.firstChild.clientHeight:(r=s,f=!1)}const m=o.getBoundingClientRect(),N=(r==null?void 0:r.top)||s.top,g=p||d,A=t.clientHeight,_=g-A;let j=!f||!g?s.top+7-m.top:N+_/2-m.top,L=s.left-m.left-A*2-3;e.tagName==="LI"&&e.getAttribute("role")!=="checkbox"&&(L=L-26,j=j-1),a&&(j=N-m.top+7,(a.style.justifyContent==="center"||a.style.justifyContent==="right")&&(L=L+10)),e.matches(":has(.resizable-container__handle)")&&!e.matches(":has(.hide-padding)")&&(j=N-m.top+27),s.top<0&&(j=j+-s.top),e.className==="dsd__theme__layoutDivider"&&(t.style.display="none",s.top-t.clientHeight<0?e.style.setProperty("--height-column",`${e.clientHeight+s.top-t.clientHeight-7}px`):e.style.setProperty("--height-column",`${e.clientHeight}px`)),t.style.opacity="1",!i&&L>-40&&(t.style.transform=`translate(${L}px, ${j}px)`)}function Ye(e,t){const{transform:o}=t.style;t.style.transform="translateZ(0)",e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function yt(e,t){const o=document.createElement("div");o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",t.forEach(i=>{const s=i.cloneNode(!0);s.style.position="relative",o.appendChild(s)}),document.body.appendChild(o),e.setDragImage(o,0,0),setTimeout(()=>document.body.removeChild(o),0)}function bt(e,t,o,i,s,a,r){var x;const{top:d,height:f,width:p,left:m}=t.getBoundingClientRect(),{top:N,left:g,width:A}=s==null?void 0:s.getBoundingClientRect(),{marginTop:_,marginBottom:j}=xt(t);let L=d;o>=d?(r.current.isBottom=!0,L+=f+j/2):(r.current.isBottom=!1,L-=_/2);const F=L-N-ut,M=ft-ct,P=a.target.closest(".dsd__theme__layoutDivider");e.setAttribute("data-index",""),e.style.background="deepskyblue";const B=m-g-M;if(i<=m&&!P){if(t.closest(".dsd__theme__layoutItem"))return;e.style.transform=`translate(${B}px, ${d-N}px)`,e.style.width="4px",e.style.height=`${f}px`,e.style.opacity=".4",e.setAttribute("data-direction","left")}else if(i>=A-B&&!P&&!t.closest(".dsd__theme__layoutItem"))t.classList.contains("dsd__theme__layoutContainer")&&!e.getAttribute("data-index-start")&&t&&t.children.length>=4&&(e.style.background="red"),e.style.transform=`translate(${A-B}px, ${d-N}px)`,e.style.width="4px",e.style.height=`${f}px`,e.style.opacity=".4",e.setAttribute("data-direction","right");else if(P){a.preventDefault();const S=(x=P.parentNode)==null?void 0:x.parentNode;(S==null?void 0:S.children.length)===4&&(e.style.background="red");const k=P.parentNode,O=Ie(S,k),R=O?P.getBoundingClientRect().left-g:B+30;e.style.transform=`translate(${R}px, ${d-N}px)`,e.style.width="4px",e.style.height=`${f}px`,e.style.opacity=".4",e.setAttribute("data-index",`${O}`)}else e.style.transform=`translate(${B}px, ${F}px)`,e.style.width=`${p+M}px`,e.style.opacity=".4",e.style.height="4px",e.setAttribute("data-direction","")}function Ge(e){e&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)")}const Tt=({hoveredButton:e,insertNewParagraph:t,currentDraggableBlockRef:o,setHoveredButton:i,isClickedBlockRef:s,setDraggableBlockElem:a,editor:r,t:d})=>n.jsx("div",{className:`icon add-block-menu ${e?"active":""}`,onClick:()=>{t({blockElement:o.current.htmlElement,editor:r,isTop:!1,isClickedBlockRef:s,setDraggableBlockElem:a}),i("both")},onMouseEnter:()=>{i("bottom")},onMouseLeave:()=>{i("both")},children:n.jsx(u.Tooltip,{openDelay:300,label:d("editor.hoverOptions.addNewBlockAbove"),position:"bottom",disabled:s.current||!e,children:n.jsx(u.ActionIcon,{radius:"sm",color:"gray",size:"xs",variant:"subtle","aria-label":"Settings",children:e==="bottom"?n.jsx($.IconPlus,{}):n.jsx($.IconMinus,{})})})}),Mt=({hoveredButton:e,insertNewParagraph:t,currentDraggableBlockRef:o,setHoveredButton:i,isClickedBlockRef:s,setDraggableBlockElem:a,editor:r,t:d})=>n.jsx("div",{className:`icon add-block-menu add-block-menu_top ${e?"active":""}`,onClick:()=>{t({blockElement:o.current.htmlElement,editor:r,isTop:!0,isClickedBlockRef:s,setDraggableBlockElem:a}),i("both")},onMouseEnter:()=>{i("top")},onMouseLeave:()=>{i("both")},children:n.jsx(u.Tooltip,{disabled:s.current||!e,openDelay:300,label:d("editor.hoverOptions.addNewBlockBelow"),position:"top",children:n.jsx(u.ActionIcon,{radius:"sm",color:"gray",size:"xs",variant:"subtle","aria-label":"Settings",children:e==="top"?n.jsx($.IconPlus,{}):n.jsx($.IconMinus,{})})})});function nt(e,t){var a,r;const o=(a=t.exportDOM)==null?void 0:a.call(t,e),i=(o==null?void 0:o.element)??null;if(c.$isElementNode(t)){const d=i??document.createElement("div"),f=((r=t.getChildren)==null?void 0:r.call(t))??[];for(const p of f){const m=nt(e,p);if(m)d.appendChild(m);else{const N=typeof p.getTextContent=="function"?p.getTextContent():"";N&&d.appendChild(document.createTextNode(N))}}return typeof(o==null?void 0:o.after)=="function"&&o.after(d),d}if(i)return typeof(o==null?void 0:o.after)=="function"&&o.after(i),i;const s=typeof t.getTextContent=="function"?t.getTextContent():"";return s?document.createTextNode(s):null}async function Xe(e,t){const o=e.getRootElement(),i=Array.from(o.querySelectorAll(".selected-block"));if(!i.length)return;let s="",a="";e.getEditorState().read(()=>{e.update(()=>{let r=i.map(f=>c.$getNearestNodeFromDOMNode(f)).filter(f=>!!f);s=r.map(f=>typeof f.getTextContent=="function"?f.getTextContent():"").filter(Boolean).join(`
|
|
2
2
|
`);const d=document.createElement("div");r.forEach(f=>{const p=nt(e,f);t==="cut"&&f.remove(),p&&d.appendChild(p)}),a=d.innerHTML})}),(s||a)&&await Nt(s,a)}async function Nt(e,t){if(navigator.clipboard&&"write"in navigator.clipboard&&window.ClipboardItem){const o=new ClipboardItem({"text/plain":new Blob([e],{type:"text/plain"}),...t?{"text/html":new Blob([t],{type:"text/html"})}:{}});await navigator.clipboard.write([o])}}const Ve=(e,t,o,i)=>{if(o)if(i==="layout"){const s=o.getParent(),a=s.getParent();T.removeNodeKeepContent(e,s,a),t("delete")}else{const s=o==null?void 0:o.getParent();if(s instanceof C.LayoutItemNode&&s.getChildren().length===2){const a=s,r=s.getParent();if(o.__type==="image"){a.append(c.$createParagraphNode());return}T.removeNodeKeepContent(e,a,r)}T.deleteNode(e,o),t("delete")}},Qe=e=>{const t=e._rootElement;return Array.from(t.querySelectorAll(".selected-block"))},Fe=(e,t,o,i=!1)=>{t&&e.update(()=>{const s=e.getElementByKey(t.getParent().getKey());pt(e,s,o,i)})},_t=(e,t,o,i)=>{if(i==="layout")Fe(e,o,"right",!0);else{const s=e._rootElement,a=Array.from(s.querySelectorAll(".selected-block")).reverse();a.length&&(e.update(()=>{const r=c.$getNearestNodeFromDOMNode(a[0]);a.forEach(d=>{let f=c.$getNearestNodeFromDOMNode(d);f&&(r==null||r.insertAfter(T.$copyNodeDeep(f))),ee.$removeSelectedHTMLElement(d)})}),t())}},St=({editor:e,onChange:t,currentEditorNode:o,textBlock:i,t:s,isDisabledAddColumnButton:a,disabledMoveColumnButtons:r})=>{const{fetchUploadMedia:d,excludeNodes:f}=l.useContext(Ce.Context),[p,m]=l.useState("inherit"),[N,g]=l.useState("inherit"),[A,_]=l.useState("inherit"),[j,L]=l.useState("");l.useEffect(()=>{const x=o==null?void 0:o.__type;e.read(()=>{var S;((S=o==null?void 0:o.getParent())==null?void 0:S.__type)==="layout-item"?L("layout"):L(x==="callout-wrapper"?x:"block")})},[o==null?void 0:o.__key]);const F=x=>x.split(";").filter(Boolean).reduce((S,k)=>{const[O,R]=k.split(":").map(U=>U.trim());return O&&R&&(S[O]=R),S},{}),M=x=>Object.entries(x).map(([S,k])=>`${S}: ${k}`).join("; "),v=l.useCallback(x=>{e.update(()=>{const S=Qe(e).map(O=>c.$getNearestNodeFromDOMNode(O)).filter(Boolean),k=O=>{if(typeof O.getStyle=="function"&&typeof O.setStyle=="function"){const R=F(O.getStyle());R.color=x.color,R["background-color"]=x.bgColor,O.setStyle(M(R)),m(x.bgColor),_(x.color)}};S.forEach(O=>{if(O instanceof C.ListNode){O.getChildren().forEach(R=>{const U=R.getFirstChild();U instanceof C.ExtendedTextNode&&k(U)});return}if(O instanceof c.ElementNode){const R=O.getFirstChild();R instanceof C.ExtendedTextNode&&k(R)}})})},[m,_]),P=(x,S)=>{const k=S||j;k==="callout-wrapper"&&o instanceof C.CalloutWrapperNode?e.update(()=>{const O=ee.isCalloutValue(x);o.setType(O?x.meta.type:void 0),o.setBackgroundColor(x.value)}):k==="layout-color"?e.update(()=>{const O=o==null?void 0:o.getParent(),R=x.value===N?"inherit":x.value;O instanceof C.LayoutItemNode&&O.setLayoutBackground(R)}):v({color:A,bgColor:p,[x.mode==="background"?"bgColor":x.mode]:x.value})},B=x=>{const S=Qe(e);S.length?S.forEach(k=>{e.update(()=>{let O=c.$getNearestNodeFromDOMNode(k);O&&Ve(e,t,O,x)})}):e.update(()=>{let k=c.$getNearestNodeFromDOMNode(S[0]);Ve(e,t,k,x)})};return l.useEffect(()=>{setTimeout(()=>{e.read(()=>{if(j==="callout-wrapper"&&o instanceof C.CalloutWrapperNode){m(o.__backgroundColor);return}const x=o==null?void 0:o.getParent();x instanceof C.LayoutItemNode&&g(x.__backgroundColor);const S=c.$getSelection();c.$isRangeSelection(S)&&(_(Ne.$getSelectionStyleValueForProperty(S,"color","inherit")),m(Ne.$getSelectionStyleValueForProperty(S,"background-color","inherit")))})})},[]),n.jsxs(n.Fragment,{children:[n.jsx(u.Menu.Item,{onMouseDown:x=>{x.preventDefault(),Xe(e,"copy"),t("copy")},leftSection:n.jsx($.IconClipboard,{style:{width:u.rem(14),height:u.rem(14)}}),children:s("editor.link.copy")}),n.jsx(u.Menu.Item,{onMouseDown:x=>{x.preventDefault(),Xe(e,"cut"),t("cut")},leftSection:n.jsx($.IconCut,{style:{width:u.rem(14),height:u.rem(14)}}),children:s("editor.contextMenu.cut")}),n.jsx(u.Menu.Item,{onClick:()=>B(""),leftSection:n.jsx($.IconTrash,{style:{width:u.rem(14),height:u.rem(14)}}),children:s("editor.contextMenu.delete")}),n.jsx(u.Menu.Item,{disabled:j==="layout"&&a,onClick:()=>_t(e,t,o,j),leftSection:n.jsx($.IconCopy,{style:{width:u.rem(14),height:u.rem(14)}}),children:s("editor.contextMenu.duplicate")}),i==="text"&&j!=="callout-wrapper"&&n.jsxs(n.Fragment,{children:[n.jsx(u.Menu.Divider,{}),n.jsx(ee.BlockFormatMenu,{disabled:!1,blockType:"paragraph",rootType:"root",editor:e,mode:"editor",fetchUploadMedia:d,excludeNodes:f,onChange:t,menuProps:{trigger:"hover",position:"right-start",offset:{mainAxis:0,alignmentAxis:0}},children:n.jsx("div",{children:n.jsx(V.CustomMenuItem,{label:s("editor.toolbar.turnInto"),icon:n.jsx($.IconArrowsRightLeft,{style:{width:u.rem(14),height:u.rem(14)}})})})})]}),(i==="text"||j=="callout-wrapper")&&n.jsxs(n.Fragment,{children:[n.jsx(u.Menu.Divider,{}),n.jsx(Pe.NewColorPicker,{data:{callout:{label:s("editor.colors.theme"),filled:!0,palette:ee.calloutData.map(x=>({label:s(`editor.colors.callout.${x.name}`),value:u.alpha(x.color,.19),icon:x.icon,meta:{type:x.name,emoji:x.emoji}}))}},modes:j==="callout-wrapper"?["callout","background"]:["color","background"],value:{color:A,background:p,callout:p},onChange:x=>{P(x),t(),T.resetSelection(e)},hideInherit:!0,target:n.jsx("div",{children:n.jsx(V.CustomMenuItem,{label:s(j==="callout-wrapper"?"editor.contextMenu.appearance":"editor.toolbar.color"),icon:n.jsx($.IconPaint,{size:14})})}),menuProps:{trigger:"hover",position:"right-start",offset:{mainAxis:0,alignmentAxis:0}}})]}),j==="layout"&&n.jsxs(n.Fragment,{children:[n.jsx(u.Menu.Divider,{}),n.jsx(Pe.NewColorPicker,{modes:["background"],value:{background:N},onChange:x=>{P(x,"layout-color"),t(),T.resetSelection(e)},hideInherit:!0,target:n.jsx("div",{children:n.jsx(V.CustomMenuItem,{label:s("editor.column.changeColor"),icon:n.jsx($.IconPaint,{size:14})})}),menuProps:{trigger:"hover",position:"right-start",offset:{mainAxis:0,alignmentAxis:0}}}),n.jsx(u.Menu.Item,{disabled:a,onClick:()=>{Fe(e,o,"left")},leftSection:n.jsx($.IconColumnInsertLeft,{style:{width:u.rem(14),height:u.rem(14)}}),children:s("editor.column.addLeft")}),n.jsx(u.Menu.Item,{disabled:a,onClick:()=>{Fe(e,o,"right")},leftSection:n.jsx($.IconColumnInsertRight,{style:{width:u.rem(14),height:u.rem(14)}}),children:s("editor.column.addRight")}),n.jsx(u.Menu.Item,{disabled:r.left,onClick:()=>{qe(e,o,"left"),T.resetSelection(e)},leftSection:n.jsx($.IconColumnInsertRight,{style:{width:u.rem(14),height:u.rem(14)}}),children:s("editor.column.moveLeft")}),n.jsx(u.Menu.Item,{disabled:r.right,onClick:()=>{qe(e,o,"right"),T.resetSelection(e)},leftSection:n.jsx($.IconColumnInsertRight,{style:{width:u.rem(14),height:u.rem(14)}}),children:s("editor.column.moveRight")}),n.jsx(u.Menu.Item,{onClick:()=>B("layout"),leftSection:n.jsx($.IconTrash,{style:{width:u.rem(14),height:u.rem(14)}}),children:s("editor.column.deleteColumn")})]})]})};function It(e){if(!e)return window;let t=e;for(;t;){if(t===document.body||t===document.documentElement)return window;const i=getComputedStyle(t).overflowY;if((i==="auto"||i==="scroll"||i==="overlay")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return window}function jt(e,t){let o=150;const{clientY:i}=e;if(t===window){const s=window.innerHeight;i<o?window.scrollBy(0,Math.max(-15,(i-o)/15)):i>s-o&&window.scrollBy(0,Math.min(15,(i-(s-o))/15))}else{o=100;const s=t.getBoundingClientRect();i<s.top+o?t.scrollTop-=5:i>s.bottom-o&&(t.scrollTop+=5)}}const $t=lt.lodashExports.throttle((e,t)=>{e.preventDefault(),jt(e,t)},16);let ve=null;function kt(e){return e?e.classList.contains("dsd__theme__table-scrollable-wrapper")?e.firstElementChild:e:null}function vt(e,t,o){const i=l.useRef(null),s=l.useRef(null),a=l.useRef(!1),r=l.useRef(!1),d=l.useRef({htmlElement:null,lexicalNode:null,isBottom:!1}),f=l.useRef(null),[p,m]=l.useState(null),{disable:N}=l.useContext(Ce.Context),[g,A]=l.useState(!1),[_,j]=l.useState({opened:!1}),[L,F]=l.useState(""),[M,v]=l.useState(null),[P,B]=l.useState(!1),[x,S]=l.useState({left:!1,right:!1}),[k,O]=l.useState(null),{t:R}=Ee.useTranslation(),U=ee.useDebounce(y=>{const h=y.target;r.current||T.isHTMLElement(h)&&(Ct(h)||e.read(()=>{var X;const w=h.className.includes("content-editable-wrapper"),G=w?c.$getRoot():c.$getNearestNodeFromDOMNode(h),{htmlElement:W,lexicalNode:D}=T.$getBlockNode(G,e,{root:!0,"layout-container":!0,"layout-item":!0,callout:!0,"collapsible-content":!0},y);if((D==null?void 0:D.__type)==="callout"||(D==null?void 0:D.__type)==="callout-image"||((X=D==null?void 0:D.getParent())==null?void 0:X.__type)==="callout"&&(D==null?void 0:D.getPreviousSibling())===null){m(null);return}if(!(w&&D instanceof C.LayoutDividerNode||w&&!D)&&D!=null&&D.__key){if(D.__type==="layout-container"||D.__type==="layout-item"||D.__type==="collapsible-content"){m(null);return}W&&(d.current.htmlElement=W,d.current.lexicalNode=D),(D==null?void 0:D.__type)==="collapsible-title"&&(d.current.htmlElement=(W==null?void 0:W.parentElement)||W,d.current.lexicalNode=D.getParent()),v(null),m(d.current.htmlElement)}}))},20,50);l.useEffect(()=>()=>{ve=null},[]),l.useEffect(()=>{function y(){r.current||m(null)}function h(G){if(!a.current)return!1;const[W]=xe.eventFiles(G);if(W)return!1;const{target:D,dataTransfer:X}=G,te=(X==null?void 0:X.getData(ze))||"";e.update(()=>{var ge;let b=c.$getNodeByKey(te);if(!b||!(T.isHTMLElement(D)||D.closest(".resizable-container")))return!1;const{htmlElement:H,lexicalNode:ie,isBottom:K}=d.current;let z=ie,pe=null;if(z!=null&&z.__key&&(pe=H),!pe||!z)return!1;if(z===b)return!0;if(s.current&&mt(s.current,e,z,b))return!1;if(b.__type==="layout-divider"){if(b=b.getParent(),ie&&(b!=null&&b.isParentOf(ie)))return!1;et(e,b)}if(b.getParent()instanceof C.LayoutItemNode&&((ge=b.getParent())==null?void 0:ge.getChildren().length)===2){const he=b.getParent(),Te=he.getParent();T.removeNodeKeepContent(e,he,Te)}if(H!=null&&H.classList.contains("selected-block"))return;let be;const re=e._rootElement;K?be=Array.from(re.querySelectorAll(".selected-block")).reverse():be=Array.from(re.querySelectorAll(".selected-block")),be.length?be.forEach(he=>{let Te=c.$getNearestNodeFromDOMNode(he);K?z==null||z.insertAfter(Te):z==null||z.insertBefore(Te)}):K?z.insertAfter(b):z.insertBefore(b),m(null)})}function w(G){const{target:W}=G;T.isHTMLElement(W)&&W.className==="ContentEditable__root"&&Ge(s.current)}return t==null||t.addEventListener("mousemove",U),t==null||t.addEventListener("drop",h),t==null||t.addEventListener("mouseleave",y),t==null||t.addEventListener("dragleave",w),()=>{t==null||t.removeEventListener("mousemove",U),t==null||t.addEventListener("drop",h),t==null||t.removeEventListener("mouseleave",y),t==null||t.removeEventListener("dragleave",w)}},[t,e]),l.useEffect(()=>{if(i.current){if(r.current||_.opened)return;Ue(p,i.current,t,_.opened)}},[t,p,r.current,_.opened]),l.useEffect(()=>{function y(h){var K,z;const{clientY:w,target:G,pageX:W}=h;if(!a.current)return!1;const[D]=xe.eventFiles(h);if(D||!T.isHTMLElement(G))return!1;const X=c.$getNearestNodeFromDOMNode(G)||c.$getRoot(),{htmlElement:te,lexicalNode:b}=T.$getBlockNode(X,e,{root:!0,"layout-container":!0,"layout-item":!0,"callout-wrapper":!0,callout:!0,"collapsible-content":!0,"collapsible-container":!0},h);if(h.preventDefault(),(b==null?void 0:b.__type)==="callout"||(b==null?void 0:b.__type)==="collapsible-content"||tt(f.current,b==null?void 0:b.getParent())||(b==null?void 0:b.__type)==="layout-item"&&X.__type!=="root")return!1;te&&(d.current.htmlElement=te,d.current.lexicalNode=b);let H=null;H=d.current.htmlElement||te,H!=null&&H.closest(".dsd__theme__layoutContainer")&&X.__type==="root"&&b&&((b==null?void 0:b.__type)==="layout-item"&&X.__type==="root"?(H=H==null?void 0:H.parentElement,d.current.htmlElement=H,d.current.lexicalNode=b==null?void 0:b.getParent()):(H=(K=H.parentElement)==null?void 0:K.parentElement,d.current.htmlElement=H,d.current.lexicalNode=(z=b.getParent())==null?void 0:z.getParent()));const ie=s.current;return!H&&ie?(ie.style.background="transparent",!1):H===null||ie===null||H!=null&&H.classList.contains("selected-block")?!1:(bt(ie,H,w,W,t,h,d),!0)}return de.mergeRegister(e.registerCommand(T.ON_CHANGE_COMMAND,h=>h==="hide_menu"?(ht(i.current),setTimeout(()=>{r.current=!0},0),!1):h==="show_menu"?(r.current=!1,!1):(h===!0&&!r.current&&m(null),r.current=!1,!1),c.COMMAND_PRIORITY_LOW),e.registerCommand(T.RIGHT_CLICK_COMMAND,h=>((h==null?void 0:h.target)instanceof HTMLElement&&i.current instanceof HTMLElement&&(Z(h),Ue(h.target,i.current,t,_.opened)),!1),c.COMMAND_PRIORITY_LOW),e.registerCommand(c.DRAGOVER_COMMAND,h=>(ve||(ve=It(h.target)),$t(h,ve),y(h)),c.COMMAND_PRIORITY_LOW),e.registerCommand(c.KEY_ARROW_DOWN_COMMAND,()=>(e.dispatchCommand(T.ON_CHANGE_COMMAND,!0),!1),c.COMMAND_PRIORITY_LOW),e.registerCommand(c.KEY_ARROW_UP_COMMAND,()=>(e.dispatchCommand(T.ON_CHANGE_COMMAND,!0),!1),c.COMMAND_PRIORITY_LOW))},[t,e]);function ae(y){var D;const h=y.dataTransfer;(D=s.current)==null||D.setAttribute("data-index-start","");const w=p||d.current.htmlElement;if(!h||!w)return;const G=e._rootElement;if(w!=null&&w.classList.contains("selected-block")){const X=e._rootElement,te=Array.from(X.querySelectorAll(".selected-block"));yt(y.dataTransfer,te)}else ee.$removeSelectedHTMLElements(G),w.className.includes("_layoutDivider")&&w.parentElement?Ye(h,w.parentElement):Ye(h,w);let W="";e.read(()=>{var te,b;const X=c.$getNearestNodeFromDOMNode(w);if(X&&(W=X.getKey()),X instanceof C.LayoutDividerNode){const H=Ie((te=w.parentElement)==null?void 0:te.parentElement,w.parentElement);(b=s.current)==null||b.setAttribute("data-index-start",H.toString())}}),i.current&&(A(!0),i.current.style.opacity="0"),a.current=!0,f.current=W,h.setData(ze,W)}function Y(){a.current=!1,Ge(s.current),A(!1)}if(N)return n.jsx("div",{});function E(){var w;const y=d.current.htmlElement,h=(w=y==null?void 0:y.parentElement)==null?void 0:w.parentElement;if(h!=null&&h.classList.contains("dsd__theme__layoutContainer")&&(h.children.length===4?B(!0):B(!1),y!=null&&y.parentElement)){const G=Ie(h,y==null?void 0:y.parentElement);G?G===h.children.length-1?S({left:!1,right:!0}):S({left:!1,right:!1}):S({left:!0,right:!1})}}function Z(y){r.current=!0;const h=kt((y==null?void 0:y.target)??d.current.htmlElement);if(!h)return;const w=e._rootElement;E(),h.classList.contains("selected-block")||ee.$removeSelectedHTMLElements(w),e.update(()=>{const W=c.$getSelection(),X=((W==null?void 0:W.getNodes())??[]).filter(K=>!c.$isTextNode(K)&&!C.$isListNode(K)&&K.__parent==="root"),te=X.map(K=>{const z=e.getElementByKey(K.getKey());return K.getType()==="table"?z==null?void 0:z.firstElementChild:z}).filter(K=>K!==null),b=X.length&&te.includes(h)?te:[h];if(b.length===1){const K=c.$getNearestNodeFromDOMNode(h);if(!K)return;K.selectStart(),O(K)}else O(null);b.forEach(K=>{ee.$getSelectedHTMLElements(e,{block:K,isCreateEventListener:!1})});const H=Array.from(document.querySelectorAll(".selected-block")).reduce((K,z)=>{const pe=c.$getNearestNodeFromDOMNode(z);return pe&&K.push(pe),K},[]),ie=H.length>0&&H.every(K=>C.$isCalloutWrapperNode(K)||C.$isTableNode(K)||ee.$isCollapsibleContainerNode(K)?!1:c.$isElementNode(K)||c.$isTextNode(K));F(ie?"text":"block")}),T.blockScroll();const G=Number(y==null?void 0:y.y)+240>window.innerHeight?Number(y==null?void 0:y.y)-200:y==null?void 0:y.y;j({opened:!0,x:(y==null?void 0:y.x)??0,y:G??0}),e.dispatchCommand(T.ON_OPEN_KEBAB_MENU,!0)}const oe=()=>{e.update(()=>{const y=T.getCurrentElement();if(r.current=!1,j(h=>({opened:!1,x:h.x,y:h.y})),(y==null?void 0:y.__key)==="root"){const h=c.$createParagraphNode();y.append(h)}})},ce=o?"hide-add-button":"",me=_.x!==0?{position:"fixed",top:0,left:0,transform:`translate(${_.x}px, ${_.y}px)`}:{},_e=()=>{oe(),T.unblockScroll(),ee.onSelectEnd(e),ee.$removeSelectedHTMLElements(e._rootElement)},je=(y=!1)=>{y?e.update(()=>{const h=c.$getSelection();let w=null;c.$isRangeSelection(h)&&(w=h.anchor.getNode().getParent()),_e(),setTimeout(()=>{e.update(()=>{w==null||w.selectEnd()})},100)}):_e()},ye=l.useCallback(y=>{const h=document.querySelector(".draggable-menu");if(!_&&y.button!==2)return;const w=y.target;if(w.closest(".mantine-Menu-dropdown"))return;!((h==null?void 0:h.contains(w))&&w.closest("div.custom-menu-item"))&&y.button!==2&&_.opened&&(y.stopPropagation(),y.preventDefault())},[e,_]);return l.useEffect(()=>(_.opened?document.addEventListener("mousedown",ye):document.removeEventListener("mousedown",ye),()=>{document.removeEventListener("mousedown",ye)}),[_.opened,ye]),Be.createPortal(n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`draggable-block-container ${ce} ${p?"visible":""}`,ref:i,onMouseEnter:()=>{var y;_||v("both"),(y=i.current)!=null&&y.style&&(i.current.style.opacity="1")},onMouseLeave:()=>{v(null)},children:[n.jsx(Mt,{hoveredButton:M,insertNewParagraph:We,currentDraggableBlockRef:d,setHoveredButton:v,isClickedBlockRef:r,setDraggableBlockElem:m,editor:e,t:R}),n.jsxs(u.Menu,{onOpen:Z,opened:_.opened,styles:{dropdown:me},position:"left-start",width:320,shadow:"md",withinPortal:!0,onClose:()=>{je()},transitionProps:C.animationMenu,children:[n.jsx(u.Menu.Target,{children:n.jsx("div",{className:"icon draggable-block-menu",draggable:!0,onDragStart:ae,onDragEnd:Y,children:n.jsx(u.Tooltip,{openDelay:300,multiline:!0,disabled:g||r.current,label:n.jsxs(n.Fragment,{children:[n.jsxs("span",{children:[n.jsx("strong",{children:R("editor.hoverOptions.drag")}),","," ",R("editor.hoverOptions.dragAction")]}),n.jsx("br",{}),n.jsxs("span",{children:[n.jsx("strong",{children:R("editor.hoverOptions.click")}),","," ",R("editor.hoverOptions.clickAction")]})]}),position:"bottom-start",children:n.jsx(u.ActionIcon,{radius:"sm",color:"gray",size:"sm",variant:"subtle","aria-label":"Settings",children:n.jsx($.IconGripVertical,{size:20})})})})}),n.jsx(Tt,{hoveredButton:M,insertNewParagraph:We,currentDraggableBlockRef:d,setHoveredButton:v,isClickedBlockRef:r,setDraggableBlockElem:m,editor:e,t:R}),n.jsx(u.Menu.Dropdown,{className:"draggable-menu",children:n.jsx(St,{onChange:()=>{je(!0),T.resetSelection(e)},t:R,textBlock:L,currentEditorNode:k,editor:e,isDisabledAddColumnButton:P,disabledMoveColumnButtons:x})})]})]}),n.jsx("div",{className:"draggable-block-target-line",ref:s})]}),t)}function At({anchorElem:e=document.body,isShowAddButton:t=!1}){const[o]=Oe.useLexicalComposerContext();return vt(o,e,t)}function Ot({editor:e,anchorElem:t,isLink:o,isBold:i,isItalic:s,isUnderline:a,isCode:r,isStrikethrough:d,isSubscript:f,isSuperscript:p,component:m,isText:N}){const g=l.useRef(null),A=l.useRef(!1),_=l.useRef(null),j=l.useCallback(()=>{e.dispatchCommand(T.ON_SHOW_LINK_POPUP,"create")},[e,o]);function L(){var M,v;g.current&&(A.current=!0,T.setFloatingElemPosition(((M=_.current)==null?void 0:M.rect)||null,g==null?void 0:g.current,t,(v=_.current)==null?void 0:v.isLink))}l.useEffect(()=>{const M=T.getNativeSelectedText();if(!N&&!(M!=null&&M.length)){let v=function(S){return S instanceof HTMLElement};const P=g.current,B=window.getSelection();let x=!1;B!=null&&B.anchorNode&&v(B.anchorNode)&&B.anchorNode.className==="toolbar"&&(x=!0),P&&!x&&(_.current={rect:null,floatingElem:P,anchorElem:t,isLink:o},T.setFloatingElemPosition(null,P,t,o),A.current=!1)}},[N,e]),l.useEffect(()=>{if(g!=null&&g.current)return document.addEventListener("mouseup",L),()=>{document.removeEventListener("mouseup",L)}},[g]),l.useEffect(()=>{e.registerCommand(c.KEY_DOWN_COMMAND,M=>{var v;return(M.metaKey||M.ctrlKey)&&M.code==="KeyA"?(M.preventDefault(),T.selectCurrentNode(e),T.getCurrentElement(!0)&&(T.isWholeNodeSelected()&&(g!=null&&g.current)?(T.setFloatingElemPosition(null,g==null?void 0:g.current,t,(v=_.current)==null?void 0:v.isLink),c.$selectAll(),ee.$getSelectedHTMLElements(e)):setTimeout(()=>{L()})),!0):!1},c.COMMAND_PRIORITY_LOW),e.registerCommand(T.ON_OPEN_KEBAB_MENU,()=>(setTimeout(()=>{var M;g!=null&&g.current&&T.setFloatingElemPosition(null,g==null?void 0:g.current,t,(M=_.current)==null?void 0:M.isLink)},100),!1),c.COMMAND_PRIORITY_LOW)},[e]);const F=l.useCallback(()=>{const M=c.$getSelection(),v=g.current,P=window.getSelection();if(v===null)return;const B=e.getRootElement();let x=!1;const S=T.getNativeSelectedText();if(S&&S.length>0&&(x=!0),M!==null&&P!==null&&!P.isCollapsed&&B!==null&&B.contains(P.anchorNode)&&x){const k=T.getDOMRangeRect(P,B);if(_.current={rect:k,floatingElem:v,anchorElem:t,isLink:o},c.$isRangeSelection(M)){const R=T.getSelectedNode(M).getParent(),U=R==null?void 0:R.getFormatType();A.current&&U&&g&&e.registerCommand(T.ON_OPEN_KEBAB_MENU,ae=>(ae||setTimeout(()=>{var Y,E;T.setFloatingElemPosition(((Y=_.current)==null?void 0:Y.rect)||null,v,t,(E=_.current)==null?void 0:E.isLink)},100),!1),c.COMMAND_PRIORITY_LOW)}}else _.current={rect:null,floatingElem:v,anchorElem:t,isLink:o}},[e,t,o]);return l.useEffect(()=>{const M=t.parentElement,v=()=>{e.getEditorState().read(()=>{F()})};return window.addEventListener("resize",v),M&&M.addEventListener("scroll",v),()=>{window.removeEventListener("resize",v),M&&M.removeEventListener("scroll",v)}},[e,F,t]),l.useEffect(()=>(e.getEditorState().read(()=>{F()}),de.mergeRegister(e.registerUpdateListener(({editorState:M})=>{M.read(()=>{F()})}),e.registerCommand(c.SELECTION_CHANGE_COMMAND,()=>(F(),!1),c.COMMAND_PRIORITY_LOW))),[e,F]),n.jsx("div",{ref:g,className:`floating-text-format-popup doc-space-editor-wrapper ${N?"":"floating-text-format-popup-hidden"}`,children:n.jsx("div",{children:e.isEditable()&&(m||n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"bold")},className:"popup-item spaced "+(i?"active":""),children:n.jsx(V.Icon,{name:"bold",stroke:i?3:2})}),n.jsx("button",{type:"button",onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"italic")},className:"popup-item spaced "+(s?"active":""),children:n.jsx(V.Icon,{name:"italic",stroke:s?3:2})}),n.jsx("button",{type:"button",onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"underline")},className:"popup-item spaced "+(a?"active":""),children:n.jsx(V.Icon,{name:"underline",stroke:a?3:2})}),n.jsx("button",{type:"button",onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"strikethrough")},className:"popup-item spaced "+(d?"active":""),"data-test-id":"toolbar-strikethrough",children:n.jsx(V.Icon,{name:"strikethrough",stroke:d?3:2})}),n.jsx("button",{type:"button",onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"subscript")},className:"popup-item spaced "+(f?"active":""),children:n.jsx(V.Icon,{name:"subscript",stroke:f?3:2})}),n.jsx("button",{type:"button",onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"superscript")},className:"popup-item spaced "+(p?"active":""),children:n.jsx(V.Icon,{name:"superscript",stroke:p?3:2})}),n.jsx("button",{type:"button",onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"code")},className:"popup-item spaced "+(r?"active":""),children:n.jsx(V.Icon,{name:"code"})}),n.jsx("button",{type:"button",onClick:j,className:"popup-item spaced "+(o?"active":""),children:n.jsx(V.Icon,{name:"link"})})]}))})})}function Dt(e,t,o){const[i,s]=l.useState(!1),[a,r]=l.useState(!1),[d,f]=l.useState(!1),[p,m]=l.useState(!1),[N,g]=l.useState(!1),[A,_]=l.useState(!1),[j,L]=l.useState(!1),[F,M]=l.useState(!1),[v,P]=l.useState(!1),B=T.allEditorSelected(),{disable:x}=l.useContext(Ce.Context),S=l.useCallback(()=>{e.getEditorState().read(()=>{var oe,ce,me;if(e.isComposing())return;const k=c.$getSelection(),O=window.getSelection(),R=e.getRootElement();if(O!==null&&(!c.$isRangeSelection(k)||R===null||!R.contains(O.anchorNode))){s(!1);return}if(!c.$isRangeSelection(k))return;const U=T.getSelectedNode(k);f(k.hasFormat("bold")),m(k.hasFormat("italic")),g(k.hasFormat("underline")),_(k.hasFormat("strikethrough")),L(k.hasFormat("subscript")),M(k.hasFormat("superscript")),P(k.hasFormat("code"));const ae=U.getParent();Me.$isLinkNode(ae)||Me.$isLinkNode(U)?r(!0):r(!1);const Y=rt.$isCodeHighlightNode(k.anchor.getNode()),E=(me=(ce=(oe=e.getElementByKey(U.__key))==null?void 0:oe.parentElement)==null?void 0:ce.parentElement)==null?void 0:me.classList.contains("Collapsible__title");!Y&&k.getTextContent()!==""&&!E?s(C.$isExtendedTextNode(U)||c.$isParagraphNode(U)||xe.$isHeadingNode(U)||xe.$isQuoteNode(U)||C.$isListItemNode(U)):s(!1);const Z=k.getTextContent().replace(/\n/g,"");if(!k.isCollapsed()&&Z===""){s(!1);return}})},[e]);return l.useEffect(()=>(document.addEventListener("selectionchange",S),()=>{document.removeEventListener("selectionchange",S)}),[S]),l.useEffect(()=>de.mergeRegister(e.registerUpdateListener(()=>{S()}),e.registerRootListener(()=>{e.getRootElement()===null&&s(!1)})),[e,S]),x?null:Be.createPortal(n.jsx(Ot,{editor:e,anchorElem:t,isLink:a,isBold:d,isItalic:p,isStrikethrough:A,isSubscript:j,isSuperscript:F,isUnderline:N,isCode:v,component:o,isText:i&&!B}),document.body)}function wt({anchorElem:e=document.body,component:t}){const[o]=Oe.useLexicalComposerContext();return Dt(o,e,t)}const Lt=(e,t,o,i)=>{e.update(()=>{if(c.$isRangeSelection(o)){const s=c.$createTextNode(t);o.insertNodes([s]),i()}})},Pt=(e,t,o,i)=>{e.update(()=>{if(c.$isRangeSelection(o)){const s=c.$createTextNode(t);o.insertNodes([]);const a=s.getParent()??o.focus.getNode().getParent();if(a){const r=o.focus.getNode().getNextSibling();r?r.insertBefore(s):a.append(s),i()}}})},Rt=(e,t="",o,i)=>{e.update(()=>{if(!c.$isRangeSelection(o))return;const a=o.anchor.getNode().getTopLevelElementOrThrow(),r=c.$createParagraphNode();t&&r.append(c.$createTextNode(t)),a.insertAfter(r),i()})},Ft=(e,t)=>{e.update(()=>{const o=c.$getSelection();if(c.$isRangeSelection(o)){const i=o.getTextContent();t(i)}})},Bt=({editor:e,response:t,onSubmit:o,setTypeMenu:i,onClose:s,t:a,selection:r})=>n.jsxs(n.Fragment,{children:[n.jsx(u.Menu.Item,{leftSection:n.jsx($.IconArrowNarrowLeft,{size:14}),onClick:()=>i("main"),children:a("editor.ai.back")}),n.jsx(u.Menu.Item,{onClick:()=>{Lt(e,t,r,s)},leftSection:n.jsx($.IconReplace,{size:14}),children:a("editor.ai.menu.answer.replaceSelection")}),n.jsx(u.Menu.Item,{onClick:()=>{Pt(e,` ${t}`,r,s)},leftSection:n.jsx($.IconTextPlus,{size:14}),children:a("editor.ai.menu.answer.addTextInline")}),n.jsx(u.Menu.Item,{onClick:()=>{Rt(e,t,r,s),s()},leftSection:n.jsx($.IconIndentIncrease,{size:14}),children:a("editor.ai.menu.answer.addBelowParagraph")}),n.jsx(u.Menu.Divider,{}),n.jsx(u.Menu.Label,{children:a("editor.ai.menu.answer.modifyFurther")}),n.jsx(u.Menu.Item,{onClick:()=>{o(`Start with this text and continue. Output this text at the start: "${t}"`,!1)},leftSection:n.jsx($.IconPlayerPlay,{size:14}),children:a("editor.ai.menu.answer.continueWriting")}),n.jsx(u.Menu.Item,{onClick:()=>{o("Regenerate this text with another way: ")},leftSection:n.jsx($.IconReload,{size:14}),children:a("editor.ai.menu.answer.regenerate")}),n.jsx(u.Menu.Item,{onClick:s,leftSection:n.jsx($.IconTrash,{size:14}),children:a("editor.ai.menu.answer.discard")})]}),Et=["arabic","bengali","chinese","dutch","english","french","german","hindi","japanese","korean","nepali","portuguese","spanish"],Ht=["professional","straightforward","friendly","poetic","passiveAggressive","pirate"],Kt=[{title:"modifySelection",options:[{title:"improveWriting",prompt:"Improve the quality of the text",icon:n.jsx($.IconWand,{size:14})},{title:"fixMistakes",prompt:"Fix any typos or general errors in the text",icon:n.jsx($.IconTextSpellcheck,{size:14})},{title:"simplify",prompt:"Shorten the text, simplifying it",icon:n.jsx($.IconSortAscending,{size:14})},{title:"addMoreDetail",prompt:"Lengthen the text, going into more detail",icon:n.jsx($.IconSortDescending,{size:14})}]},{title:"generate",options:[{title:"summarise",prompt:"Summarise the text",icon:n.jsx($.IconNotes,{size:14})},{title:"translate",icon:n.jsx($.IconLanguage,{size:14}),type:"language"},{title:"changeStyle",icon:n.jsx($.IconScript,{size:14}),type:"style"},{title:"explain",prompt:"Explain what the text is about",icon:n.jsx($.IconHelpOctagon,{size:14})}]}],zt=({setTypeMenu:e,onSubmit:t,t:o})=>n.jsxs(n.Fragment,{children:[n.jsx(u.Menu.Item,{leftSection:n.jsx($.IconArrowNarrowLeft,{size:14}),onClick:()=>e("main"),children:o("editor.ai.back")}),Et.map(i=>n.jsx(u.Menu.Item,{onClick:()=>{t(`Translate text into the ${i} language`)},children:o(`editor.ai.menu.languages.${i}`)},i))]}),qt=({setTypeMenu:e,onSubmit:t,t:o})=>n.jsx(n.Fragment,{children:Kt.map(i=>n.jsxs("div",{children:[n.jsx(u.Menu.Label,{children:o(`editor.ai.menu.main.${i.title}`)}),i.options.map(s=>n.jsx(u.Menu.Item,{onClick:()=>{if(s.type){e(s.type);return}t(s.prompt||"")},leftSection:s.icon,children:o(`editor.ai.menu.main.${s.title}`)},s.title))]},i.title))}),Wt=({setTypeMenu:e,onSubmit:t,t:o})=>n.jsxs(n.Fragment,{children:[n.jsx(u.Menu.Item,{leftSection:n.jsx($.IconArrowNarrowLeft,{size:14}),onClick:()=>e("main"),children:o("editor.ai.back")}),Ht.map(i=>n.jsx(u.Menu.Item,{onClick:()=>{t(`Change text into ${i} style`)},children:o(`editor.ai.menu.style.${i}`)},i))]}),Ut=({keyType:e,setTypeMenu:t,editor:o,onSubmit:i,response:s,onClose:a,t:r,selection:d})=>{switch(e){case"main":return n.jsx(qt,{t:r,setTypeMenu:t,onSubmit:i});case"answer":return n.jsx(Bt,{t:r,onSubmit:i,editor:o,response:s,setTypeMenu:t,onClose:a,selection:d});case"language":return n.jsx(zt,{t:r,onSubmit:i,setTypeMenu:t});case"style":return n.jsx(Wt,{t:r,onSubmit:i,setTypeMenu:t});default:return null}};function Yt(e,t=40){const[o,i]=l.useState(""),s=l.useRef(0),a=l.useRef(null),r=l.useRef(null);return l.useEffect(()=>{if(a.current&&clearInterval(a.current),i(""),s.current=0,!!e)return a.current=setInterval(()=>{i(d=>{const f=e[s.current];return s.current+=1,s.current>=e.length&&clearInterval(a.current),d+(f||"")})},t),()=>{a.current&&clearInterval(a.current)}},[e,t]),l.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[o]),{displayedText:o,containerRef:r}}const Gt=()=>{var ae;const[e,t]=l.useState({top:"0px",bottom:"auto"}),[o,i]=l.useState(!1),[s,a]=l.useState(!1),[r]=Oe.useLexicalComposerContext(),[d,f]=l.useState("main"),[p,m]=l.useState(""),[N,g]=l.useState(""),[A,_]=l.useState(""),[j,L]=l.useState(null),[F,M]=l.useState(!1),{fetchPromptResult:v}=l.useContext(Ce.Context),{t:P}=Ee.useTranslation(),[B,x]=He.useResizeObserver(),S=()=>{i(!1),a(!1),_(""),f("main"),setTimeout(()=>{t({top:"0px",bottom:"auto"})},200)},k=He.useClickOutside(()=>{S()});l.useEffect(()=>{o?(Ft(r,g),document.documentElement.style.overflow="hidden",r.update(()=>{const Y=c.$getSelection();Y&&L(Y)})):(f("main"),document.documentElement.style.overflow="auto",_(""))},[o]);const{displayedText:O,containerRef:R}=Yt(A,10),U=(Y,E=!0)=>{const Z=Y+` "${E?N:""}"Only return the modified text. Do not include any explanations, introductions, or formatting.`;M(!0),v&&v(Z,oe=>{_(oe),M(!1),f("answer"),m("")},()=>{M(!1)})};return l.useEffect(()=>{var E,Z,oe;const{bottom:Y}=((E=B.current)==null?void 0:E.getBoundingClientRect())||{bottom:0};if(Y>window.innerHeight){const ce=(((oe=(Z=r._rootElement)==null?void 0:Z.getBoundingClientRect())==null?void 0:oe.bottom)||0)-window.innerHeight;t({...e,top:"auto",bottom:`${ce}px`})}},[x.height,o,B.current]),(ae=r._rootElement)!=null&&ae.parentElement?n.jsxs(n.Fragment,{children:[e.top?Be.createPortal(n.jsx(u.Transition,{mounted:!!o,transition:"scale-x",duration:300,timingFunction:"ease",children:Y=>n.jsx(u.Box,{ref:k,style:{position:"absolute",...e,...Y},className:"ai-editor-menu",children:n.jsxs(u.Menu,{opened:!!s,closeOnItemClick:!1,position:"bottom-start",zIndex:99,transitionProps:{transition:"fade",duration:300},styles:{dropdown:{overflow:"auto"}},offset:8,middlewares:{flip:!0,size:{apply({availableHeight:E,elements:Z}){requestAnimationFrame(()=>{Object.assign(Z.floating.style,{maxHeight:`${E>=425?425:E}px`})})}}},disabled:F,children:[n.jsx(u.Menu.Target,{children:n.jsxs(u.Paper,{withBorder:!0,ref:B,shadow:"lg",radius:"md",p:"0",px:"xs",children:[A&&n.jsxs(n.Fragment,{children:[n.jsxs(u.Group,{gap:3,align:"flex-start",style:{overflowY:"auto"},mah:120,ref:R,children:[n.jsx(u.Box,{style:{flex:1},w:"auto",py:"xs",children:O}),n.jsx(u.Box,{w:"auto",mt:"xs",children:n.jsx(u.CopyButton,{value:A,timeout:2e3,children:({copied:E,copy:Z})=>n.jsx(u.Tooltip,{label:E?"Copied":"Copy",withArrow:!0,position:"right",children:n.jsx(u.ActionIcon,{color:E?"teal":"gray",variant:"subtle",onClick:Z,children:E?n.jsx($.IconCheck,{size:16}):n.jsx($.IconCopy,{size:16})})})})})]}),n.jsx(u.Divider,{my:"0"})]}),n.jsx(u.Box,{children:n.jsx(u.Input,{size:"md",placeholder:P("editor.ai.placeholder"),rightSectionPointerEvents:"all",variant:"unstyled",value:p,onKeyDown:E=>{if(E.key==="Enter"){if(F)return;U(p)}},onChange:E=>{m(E.target.value)},rightSection:n.jsx(n.Fragment,{children:F?n.jsx(u.Loader,{color:"violet",size:"16",mr:"xs"}):n.jsx(u.ActionIcon,{color:"violet",disabled:!p,variant:"subtle",onClick:()=>{U(p)},children:n.jsx($.IconSparkles,{size:16})})})})})]})}),n.jsx(u.Menu.Dropdown,{className:"menu-dropdown-ai",onMouseDown:E=>{E.stopPropagation()},children:n.jsx(Ut,{keyType:d,setTypeMenu:f,editor:r,onSubmit:U,response:A,onClose:S,t:P,selection:j})})]})})}),r._rootElement.parentElement):null,n.jsxs("button",{disabled:!1,className:"toolbar-item spaced alignment","aria-label":"Formatting options for text alignment",type:"button",onClick:()=>{const Y=document.querySelector(".floating-text-format-popup");if(Y.style.opacity="0",Y.style.transform="translate(-10000px, -10000px)",Y!=null&&Y.style){const E=window.getSelection();if((E==null?void 0:E.rangeCount)===0)return null;if(E){const oe=E.getRangeAt(0).getBoundingClientRect(),ce=document.querySelector(".content-editable-wrapper"),me=ce.getBoundingClientRect(),_e=oe.top-me.top+ce.scrollTop+oe.height+"px";t({top:_e,bottom:"auto"}),setTimeout(()=>{i(!0)},0),setTimeout(()=>{a(!0)},100)}}},children:[n.jsx($.IconSparkles,{color:"#7950f2",size:18}),n.jsx($.IconAi,{size:21,color:"#7950f2"})]})]}):null},Xt=({editor:e,isEditable:t,t:o})=>{const{fetchUploadMedia:i,imperativeHandleRef:s}=l.useContext(Ce.Context),[a,r]=l.useState(!1);return i?n.jsx(Ke.ImagePicker,{popoverProps:{opened:a,position:"bottom",onChange:r},onUpload:d=>{var f,p;!i||!d.length||(r(!1),(f=s==null?void 0:s.current)!=null&&f.insertImages&&((p=s.current)==null||p.insertImages(d)))},onChange:d=>{e.dispatchCommand(Ke.INSERT_IMAGE_COMMAND,{altText:"",src:d}),r(!1)},children:n.jsx(u.Tooltip,{label:o("editor.image.add_photo"),children:n.jsx("button",{disabled:!t,type:"button",onClick:()=>r(d=>!d),className:"toolbar-item spaced",children:n.jsx(V.Icon,{name:"photo"})})})}):null},Vt={bullet:"Маркированный список",check:"Чек-лист",code:"Кодовый блок",h1:"Заголовок 1",h2:"Заголовок 2",h3:"Заголовок 3",h4:"Заголовок 4",h5:"Заголовок 5",h6:"Заголовок 6",number:"Нумерованный список",paragraph:"Параграф",quote:"Цитата"};function Ae(){return n.jsx("div",{className:"divider"})}function Qt({mode:e,isFloating:t}){const[o]=Oe.useLexicalComposerContext(),[i,s]=l.useState(o),[a,r]=l.useState("paragraph"),[d,f]=l.useState("root"),[p,m]=l.useState(null),[N,g]=l.useState("#000"),[A,_]=l.useState("#fff"),[j,L]=l.useState("left"),[F,M]=l.useState(!1),[v,P]=l.useState(!1),[B,x]=l.useState(!1),[S,k]=l.useState(!1),[O,R]=l.useState(!1),[U,ae]=l.useState(!1),[Y,E]=l.useState(!1),[Z,oe]=l.useState(!1),[ce,me]=l.useState(!1),[_e,je]=l.useState(!1),[ye]=C.useModal(),[y,h]=l.useState(!1),[w,G]=l.useState(!0),[W,D]=l.useState(!0),[X,te]=l.useState(0),[b,H]=l.useState(()=>o.isEditable()),ie=e||"default",{excludeNodes:K,fetchUploadMedia:z,fetchPromptResult:pe,commentOptions:be}=l.useContext(Ce.Context),{t:re}=Ee.useTranslation(),ge=l.useCallback(()=>{const I=c.$getSelection();if(c.$isRangeSelection(I)){const q=I.anchor.getNode(),se=I.focus.getNode(),ne=c.$isRootNode(q)?null:q.getTopLevelElementOrThrow(),fe=c.$isRootNode(se)?null:se.getTopLevelElementOrThrow();let Q=q.getKey()==="root"?q:de.$findMatchingParent(q,ue=>{const ke=ue.getParent();return ke!==null&&c.$isRootOrShadowRoot(ke)});I.getNodes().length===1?G(!0):G(!1),Q===null&&(Q=q.getTopLevelElementOrThrow());const J=Q.getKey(),$e=i.getElementByKey(J);o.update(()=>{P(I.hasFormat("bold")),x(I.hasFormat("italic")),k(I.hasFormat("underline")),R(I.hasFormat("strikethrough")),ae(I.hasFormat("subscript")),E(I.hasFormat("superscript")),oe(I.hasFormat("code"))});const le=T.getSelectedNode(I),Se=le.getParent();Me.$isLinkNode(Se)||Me.$isLinkNode(le)?M(!0):M(!1),g(Ne.$getSelectionStyleValueForProperty(I,"color","inherit")),_(Ne.$getSelectionStyleValueForProperty(I,"background-color","inherit"));let Le;Me.$isLinkNode(Se)&&(Le=de.$findMatchingParent(le,ue=>c.$isElementNode(ue)&&!ue.isInline())),L(c.$isElementNode(Le)?Le.getFormatType():c.$isElementNode(le)?le.getFormatType():(Se==null?void 0:Se.getFormatType())||"left");const it=de.$findMatchingParent(le,C.$isTableNode);if(C.$isTableNode(it)?f("table"):f("root"),$e!==null&&(ne==null?void 0:ne.getKey())===(fe==null?void 0:fe.getKey()))if(m(J),C.$isListNode(Q)){const ue=de.$getNearestNodeOfType(q,C.ListNode),ke=ue?ue.getListType():Q.getListType();r(ke)}else{const ue=xe.$isHeadingNode(Q)?Q.getTag():Q.getType();ue in Vt&&r(ue)}else r("")}},[i,G]);l.useEffect(()=>o.registerCommand(c.SELECTION_CHANGE_COMMAND,(I,q)=>(ge(),s(q),!1),c.COMMAND_PRIORITY_CRITICAL),[o,ge]),l.useEffect(()=>de.mergeRegister(o.registerEditableListener(I=>{H(I)}),i.registerUpdateListener(({editorState:I})=>{I.read(()=>{ge()})}),i.registerCommand(c.CAN_UNDO_COMMAND,I=>(me(I),!1),c.COMMAND_PRIORITY_CRITICAL),i.registerCommand(c.CAN_REDO_COMMAND,I=>(je(I),!1),c.COMMAND_PRIORITY_CRITICAL)),[ge,i,o]),l.useEffect(()=>de.mergeRegister(i.registerCommand(c.KEY_MODIFIER_COMMAND,I=>{const q=I,{code:se,metaKey:ne}=q;if(se==="KeyK"&&ne){q.preventDefault();let fe;return F?fe=null:fe=T.sanitizeUrl("https://"),i.dispatchCommand(Me.TOGGLE_LINK_COMMAND,fe)}return!1},c.COMMAND_PRIORITY_NORMAL),i.registerCommand(c.CLICK_COMMAND,()=>{const I=c.$getSelection();if(c.$isRangeSelection(I)){const q=I.getNodes(),se=q.length>0&&q.every(ne=>C.$isCalloutWrapperNode(ne)||C.$isTableNode(ne)||ee.$isCollapsibleContainerNode(ne)?!1:c.$isElementNode(ne)||c.$isTextNode(ne));D(!se)}return!1},c.COMMAND_PRIORITY_NORMAL)),[i,F]),l.useCallback((I,q)=>{i.update(()=>{const se=c.$getSelection();se!==null&&Ne.$patchStyleText(se,I)},q?{tag:"historic"}:{})},[i]);const he=l.useCallback(()=>{setTimeout(()=>{i.dispatchCommand(c.FORMAT_TEXT_COMMAND,"")}),i.update(()=>{const I=c.$getSelection();if(c.$isRangeSelection(I)){const q=I.anchor,se=I.focus,ne=I.getNodes(),fe=I.extract();if(q.key===se.key&&q.offset===se.offset)return;ne.forEach((Q,we)=>{if(C.$isExtendedTextNode(Q)){let J=Q;we===0&&q.offset!==0&&(J=J.splitText(q.offset)[1]||J),we===ne.length-1&&(J=J.splitText(se.offset)[0]||J);const $e=fe[0];ne.length===1&&C.$isExtendedTextNode($e)&&(J=$e),J.__style!==""&&J.setStyle(""),J.__format!==0&&J.setFormat(0);const le=de.$getNearestBlockElementAncestorOrThrow(J);le.__format!==0&&le.setFormat(""),le.__indent!==0&&le.setIndent(0),Q=J}else xe.$isHeadingNode(Q)||xe.$isQuoteNode(Q)?Q.replace(c.$createParagraphNode(),!0):at.$isDecoratorBlockNode(Q)&&Q.setFormat("")})}})},[i]),Te=I=>{g(I.color),_(I["background-color"]),i.update(()=>{const q=c.$getSelection();q!==null&&Ne.$patchStyleText(q,I)})},ot=l.useCallback(()=>{o.dispatchCommand(T.ON_SHOW_LINK_POPUP,"create"),setTimeout(()=>{H(!0)},1e3)},[o]),st=()=>{o.dispatchCommand(Ce.INSERT_INLINE_COMMAND,void 0),te(I=>I+1)};return n.jsx("div",{className:"toolbar-wrapper",tabIndex:-1,children:n.jsxs("div",{className:"toolbar",children:[n.jsxs(n.Fragment,{children:[n.jsx(ee.BlockFormatMenu,{disabled:W,blockType:a,rootType:d,editor:o,mode:ie,fetchUploadMedia:z,excludeNodes:K}),n.jsx(Ae,{})]}),e==="editor"&&!0&&pe&&n.jsxs(n.Fragment,{children:[n.jsx(l.Suspense,{fallback:null,children:n.jsx(Gt,{})}),n.jsx(Ae,{})]}),n.jsxs(n.Fragment,{children:[n.jsx(u.Tooltip,{label:re("editor.toolbar.bold"),children:n.jsx("button",{disabled:!b,onClick:()=>{i.dispatchCommand(c.FORMAT_TEXT_COMMAND,"bold")},className:"toolbar-item spaced "+(v?"active":""),type:"button","data-test-id":"toolbar-bold",children:n.jsx(V.Icon,{name:"bold"})})}),n.jsx(u.Tooltip,{label:re("editor.toolbar.italic"),children:n.jsx("button",{disabled:!b,onClick:()=>{i.dispatchCommand(c.FORMAT_TEXT_COMMAND,"italic")},className:"toolbar-item spaced "+(B?"active":""),type:"button","data-test-id":"toolbar-italic",children:n.jsx(V.Icon,{name:"italic"})})}),n.jsx(u.Tooltip,{label:re("editor.toolbar.underline"),children:n.jsx("button",{disabled:!b,"data-test-id":"toolbar-underline",onClick:()=>{i.dispatchCommand(c.FORMAT_TEXT_COMMAND,"underline")},className:"toolbar-item spaced "+(S?"active":""),type:"button",children:n.jsx(V.Icon,{name:"underline"})})}),n.jsx(u.Tooltip,{label:re("editor.toolbar.strike"),children:n.jsx("button",{disabled:!b,className:"toolbar-item spaced "+(O?"active":""),"data-test-id":"toolbar-strikethrough",onClick:()=>{i.dispatchCommand(c.FORMAT_TEXT_COMMAND,"strikethrough")},children:n.jsx(V.Icon,{name:"strikethrough"})})}),n.jsx(u.Tooltip,{label:re("editor.toolbar.code"),children:n.jsx("button",{disabled:!b,onClick:()=>{i.dispatchCommand(c.FORMAT_TEXT_COMMAND,"code")},className:"toolbar-item spaced "+(Z?"active":""),type:"button","data-test-id":"toolbar-code",children:n.jsx(V.Icon,{name:"code"})})}),n.jsx(u.Tooltip,{label:re("editor.toolbar.clear"),children:n.jsx("button",{disabled:!b,className:"toolbar-item",onClick:he,"data-test-id":"toolbar-clear-format",children:n.jsx(V.Icon,{name:"сlear-format"})})}),n.jsx(u.Tooltip,{disabled:!b,label:re("editor.toolbar.link"),children:n.jsx("button",{onClick:ot,className:"toolbar-item spaced "+(F?"active":""),onMouseDown:()=>{H(!1)},type:"button","data-test-id":"toolbar-link",children:n.jsx(V.Icon,{name:"link"})})}),be&&e==="editor"&&n.jsx(u.Tooltip,{label:re("editor.toolbar.comment"),children:n.jsx("button",{onClick:st,className:"toolbar-item spaced "+(F?"active":""),type:"button","data-test-id":"toolbar-comment",children:n.jsx(V.Icon,{name:"message"})})},X),n.jsx(Pe.NewColorPicker,{value:{color:N,background:A},menuProps:{closeOnItemClick:!0},onChange:I=>{Te({color:N,"background-color":A,[I.mode==="color"?"color":"background-color"]:I.value})},disabled:!b,modes:["color","background"]})]}),n.jsx(Ae,{}),n.jsx(V.AlignMenu,{disabled:!b,value:j,editor:o,isRTL:y,setElementFormat:L}),e==="default"&&n.jsxs(n.Fragment,{children:[n.jsx(Ae,{}),n.jsx(Xt,{editor:o,t:re,isEditable:b})]}),ye]})})}exports.DraggableBlockPlugin=At;exports.FloatingTextFormatToolbarPlugin=wt;exports.ToolbarPlugin=Qt;exports.getTemplateColumns=De;exports.maxWidthPercent=Ze;exports.setTemplateColumnsAfterDelete=et;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),I=require("react"),V=require("react-i18next"),je=require("@lexical/react/LexicalComposerContext"),f=require("@mantine/core"),b=require("lexical"),ae=require("./layers.CZPeYQ9g.js"),e=require("@tabler/icons-react"),we=require("@layers-app/shared"),H=require("./layers.B90YwJga.js"),k=require("./layers.Dgok89qX.js"),Se=require("react-dom"),ke=require("@lexical/react/LexicalContentEditable"),Ne=require("@lexical/rich-text"),De=require("@lexical/utils"),B=require("./layers.CZ_Lt7IL.js"),Ie={bullet:e.IconList,check:e.IconListCheck,"check-mark":e.IconCheck,code:e.IconCode,h1:e.IconH1,h2:e.IconH2,h3:e.IconH3,number:e.IconListNumbers,paragraph:e.IconIndentIncrease,quote:e.IconQuote,fontFamily:e.IconLetterT,undo:e.IconArrowBackUp,redo:e.IconArrowForwardUp,bold:e.IconBold,italic:e.IconItalic,underline:e.IconUnderline,link:e.IconLink,"color-picker":e.IconColorPicker,background:e.IconBucketDroplet,photo:e.IconPhoto,"photo-check":e.IconPhotoCheck,"align-left":e.IconAlignLeft,"align-end":e.IconAlignLeft,"align-start":e.IconAlignLeft,"align-right":e.IconAlignRight,"align-center":e.IconAlignCenter,"align-justify":e.IconAlignJustified,"horizontal-rule":e.IconFlipHorizontal,strikethrough:e.IconStrikethrough,subscript:e.IconSubscript,superscript:e.IconSuperscript,minus:e.IconMinus,plus:e.IconPlus,"chevron-down":e.IconChevronDown,"chevron-right":e.IconChevronRight,grip:e.IconGripVertical,"circle-check":e.IconCircleCheck,"circle-x":e.IconCircleX,pencil:e.IconPencil,trash:e.IconTrash,table:e.IconTable,"caret-right":e.IconCaretRight,grid:e.IconColumns3,"dots-vertical":e.IconDotsVertical,copy:e.IconCopy,clipboard:e.IconClipboard,cut:e.IconCut,"arrow-bar-to-up":e.IconArrowBarToUp,"arrow-bar-to-down":e.IconArrowBarToDown,"arrow-bar-to-left":e.IconArrowBarToLeft,"arrow-bar-to-right":e.IconArrowBarToRight,"column-insert-left":e.IconColumnInsertLeft,"column-insert-right":e.IconColumnInsertRight,"row-insert-top":e.IconRowInsertTop,"row-insert-bottom":e.IconRowInsertBottom,"container-off":e.IconContainerOff,"table-off":e.IconTableOff,"layers-union":e.IconLayersUnion,"layers-substract":e.IconLayersSubtract,"сlear-format":e.IconDropletOff,form:e.IconCheckupList,youtube:e.IconBrandYoutube,emoji:e.IconMoodSmile,file:e.IconFile,success:e.IconCheck,warning:e.IconAlertTriangle,alert:e.IconExclamationCircle,defaultOff:e.IconBaseline,embed:e.IconCodeCircle,at:e.IconAt,paperclip:e.IconPaperclip,close:e.IconX,api:e.IconApi,music:e.IconMusic,message:e.IconMessage,reply:e.IconArrowBackUp,filter:e.IconFilter,messages:e.IconMessages,"shield-check":e.IconShieldCheckFilled,reOpen:e.IconReload,send:e.IconSend,expandSidebar:e.IconLayoutSidebarLeftExpand,palette:e.IconPalette},P=({name:t,iconStyle:o,...a})=>{const i=Ie[t]||Ie.bullet;return n.jsx(f.Flex,{gap:0,justify:"center",align:"center",...a,children:n.jsx(i,{size:18,stroke:2,style:o,...a})})},Le=({icon:t,title:o,pointerEvents:a="auto",isLoading:i,progress:E,nodeKey:y,onAfterCancel:m,...x})=>{const[C]=je.useLexicalComposerContext(),{t:M}=V.useTranslation(),{fetchUploadMedia:l}=I.useContext(ae.Context),_=((l==null?void 0:l.length)??0)>=5,T=()=>{C.update(()=>{const z=b.$getNodeByKey(y);z&&z.remove()})},N=z=>{z.stopPropagation(),m==null||m()};return n.jsxs(f.UnstyledButton,{className:"image-node-picker-button",styles:{root:{width:"100%",display:"flex",alignItems:"center",gap:"var(--mantine-spacing-sm)",flexDirection:"column",padding:"var(--mantine-spacing-md)",background:"var(--mantine-primary-color-light)",color:"var(--mantine-color-text)",borderRadius:"var(--mantine-radius-default)",opacity:.75,pointerEvents:i?"none":a,boxSizing:"border-box"}},...x,children:[n.jsxs("div",{className:"empty-node-button__content",children:[i&&!_&&n.jsx(f.Loader,{size:"xs",mb:2,mr:4,color:"gray"}),!i&&n.jsx(P,{name:t}),o,i&&m&&n.jsx(f.Text,{component:"span",onClick:N,variant:"link",style:{marginLeft:"auto",cursor:"pointer",pointerEvents:"auto"},children:M("editor.cancel")}),y&&!i&&n.jsx(P,{style:{pointerEvents:"auto"},className:"delete-icon",name:"close",size:22,onClick:T})]}),i&&typeof E=="number"&&_&&n.jsx(f.Progress,{w:"100%",value:E,animated:!0,transitionDuration:200})]})},Oe="_title_81iwv_1",ve="_icon_81iwv_11",Ae="_link_81iwv_20",se={title:Oe,icon:ve,link:Ae},Be=({page:t})=>{const{t:o}=V.useTranslation();return n.jsxs("div",{className:se.link,onClick:t.onClick,children:[n.jsx("div",{className:se.icon,children:t.icon?n.jsx(we.ProjectIcon,{size:16,fz:16,icon:t.icon,fallback:n.jsx(e.IconFile,{size:"1em"})}):n.jsx(e.IconFile,{size:16})}),n.jsx(f.Tooltip,{label:t.title,disabled:!t.title,openDelay:400,children:n.jsx(f.Text,{truncate:!0,className:se.title,"data-empty":!t.title,children:t.title||o("editor.noTitle")})})]})},He=I.memo,Fe=He(Be),We={center:-8,right:2,left:-18},$e=(t,o,a,i)=>{const y=t.width/2,m=t.height/2,x=i==null?void 0:i.classList[1],C=We[x];switch(o){case"nw-resize":return{x:0,y:0};case"ne-resize":return{x:t.width-16,y:0};case"sw-resize":return{x:0,y:t.height-16};case"se-resize":return{x:t.width-16,y:t.height-16};case"n-resize":return{x:y+C,y:0};case"s-resize":return{x:y+C,y:t.height-16};case"w-resize":return{x:0,y:m-8};case"e-resize":return{x:t.width-16,y:m-(a?17:8)}}},qe=(t,o,a,i=["nw-resize","ne-resize","sw-resize","se-resize","n-resize","s-resize","w-resize","e-resize"])=>{const y=a<=32,m=a>=t.height-32,x=o<=32,C=o>=t.width-32;return y&&x?i.includes("nw-resize")?"nw-resize":"default":y&&C?i.includes("ne-resize")?"ne-resize":"default":m&&x?i.includes("sw-resize")?"sw-resize":"default":m&&C?i.includes("se-resize")?"se-resize":"default":y?i.includes("n-resize")?"n-resize":"default":m?i.includes("s-resize")?"s-resize":"default":x?i.includes("w-resize")?"w-resize":"default":C&&i.includes("e-resize")?"e-resize":"default"},X=32,U=(t,o)=>t&&typeof t=="number"?Math.min(t/o*100,95.5):95.5;function Ge(t){const a=100-4e3/t;return{minResizePercent:Math.max(5,9792/t),maxWidthPercent:a}}const Ye=({editor:t,width:o,height:a,initialHeight:i,initialWidth:E,children:y,onResizeStart:m,isIcon:x,onResizeEnd:C,alignment:M,isEmbed:l,type:_})=>{const[T,N]=I.useState({x:-1e3,y:-1e3}),[z,J]=I.useState(30),[q,K]=I.useState("default"),[G,le]=I.useState(!1),{imperativeHandleRef:Y}=I.useContext(ae.Context),[Q,Z]=I.useState(null),D=I.useMemo(()=>H.getAllowedControls(M)||["e-resize"],[M]),ye=D.length===1&&D[0]==="e-resize",u=I.useRef(null),ue=I.useRef(null),R=I.useRef({rootHeight:0,rootWidth:0,ratio:1,currentWidth:0,currentWidthPercent:0,currentHeight:0,currentHeightPercent:0,startWidth:0,startWidthPercent:0,startHeight:0,startHeightPercent:0,startX:0,startY:0,direction:"x",isResizing:!1,isTop:!1,isBottom:!1,isLeft:!1,isRight:!1}),L=(r,s=95.5)=>{var d;const p=(d=t._window)==null?void 0:d.innerWidth;if(p){let g=100;l&&(g=250);const h=g/p*100;return r<h?h:r>s?s:r}else return r<20?20:r>100?100:r},de=(r,s)=>{const p=Math.min(r,s);return 15+(Math.max(200,Math.min(800,p))-100)/500*15},he=(r,s,p)=>{if(K("default"),!G)return;let d=q;d=qe(r,s,p,D),R.current.isResizing&&(d=q),K(d),J(z),N(g=>$e(r,d,l||!1,u.current)||g)},Ce=r=>{var g;if(k.isMobile)return;r.preventDefault();const s=(g=u.current)==null?void 0:g.getBoundingClientRect();if(!s)return;const p=r.clientX-s.left,d=r.clientY-s.top;R.current.isResizing||he(s,p,d)},me=(r,s=12,p=95.5,d=R.current.rootWidth)=>{const g=u.current,h=R.current;if(!g||r.button===2||!(h!=null&&h.isResizing))return;const w=g.getBoundingClientRect(),O=r.clientX-w.left,ee=r.clientY-w.top;he(w,O,ee);const te=.17,F=M==="right",W=M==="center",v=h.isLeft,A=h.isTop,$=h.isBottom,ne=h.direction==="y",c=h.isRight,S=Math.floor(F?w.right-r.clientX-(w.right-h.startX):r.clientX-h.startX),re=Math.floor(r.clientY-h.startY);let j=0;v||c?j=S/d*100:(A||$||W)&&(j=re*te),(v||A)&&(!F||ne&&!v)&&(!$||W)&&(j=-j),(A&&c||$&&c)&&(j=S/d*100),j=Math.max(-100,Math.min(100,j));const ie=h.startWidthPercent+j,oe=h.startHeightPercent+j;h.currentWidthPercent=L(Math.max(s,ie),p),h.currentHeightPercent=L(Math.max(s,oe),p),g.style.width=`${h.currentWidthPercent}%`,g.style.height=`${h.currentHeightPercent}%`},Ee=r=>{var g,h;const s=R.current;if(s.isResizing=!1,(g=u.current)==null||g.classList.remove("is-resizing"),(h=u.current)==null||h.releasePointerCapture(r.pointerId),C(s.currentWidthPercent+"%",s.currentHeightPercent+"%"),document.removeEventListener("pointermove",me),!u.current)return;const p=u.current.getBoundingClientRect(),d=de(p.width,p.height);J(d)},Me=r=>{var pe,ge;if(r.button===2||!G){r.preventDefault(),r.stopPropagation();return}if(!u.current)return;u.current.classList.add("is-resizing");const s=t.getRootElement();if(!s)return;const p=s.getBoundingClientRect();if(!t.isEditable()||q==="default")return;const d=ue.current;if(d===null)return;const g=(pe=u.current)==null?void 0:pe.getBoundingClientRect();if(!d.getBoundingClientRect()||!g)return;const{width:w,height:O,top:ee,left:te}=g,F=r.clientX-te,W=r.clientY-ee,v=W<=X,A=W>=O-X,$=F<=X,ne=F>=w-X,c=R.current,S=window.getComputedStyle(s),re=parseFloat(S.paddingTop),j=parseFloat(S.paddingBottom),ie=parseFloat(S.paddingLeft),oe=parseFloat(S.paddingRight);c.rootHeight=p.height-re-j||0,c.rootWidth=p.width-ie-oe||0,c.ratio=w/O,c.currentWidth=c.currentWidth||w,c.currentWidthPercent=+u.current.style.width.replace("%",""),c.currentHeight=c.currentHeight||O,c.currentHeightPercent=+u.current.style.height.replace("%",""),c.startX=r.clientX,c.startY=r.clientY,c.startWidth=c.currentWidth||w,c.startWidthPercent=c.currentWidthPercent,c.startHeight=c.currentHeight||O,c.startHeightPercent=c.currentHeightPercent,c.isResizing=!0,c.isTop=v,c.isBottom=A,c.isLeft=$,c.isRight=ne,c.direction=A||v?"y":"x",m&&m(),u.current.setPointerCapture(r.pointerId);const Re=((ge=u.current.parentElement)==null?void 0:ge.offsetWidth)??c.rootWidth,{maxWidthPercent:Pe,minResizePercent:_e}=Ge(Re);document.addEventListener("pointermove",be=>{var fe,xe;return me(be,_==="video"?40:_e,Pe,(xe=(fe=u.current)==null?void 0:fe.parentElement)==null?void 0:xe.offsetWidth)}),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})};I.useEffect(()=>{var g;const r=u.current;if(!r)return;if(typeof o=="number"&&typeof a=="number"){r.style.width=`${L(o)}%`,r.style.height=`${L(a)}%`;return}const s=(g=r.parentElement)==null?void 0:g.getBoundingClientRect();if(!s)return;const p=U(i,s.height),d=U(E,s.width);r.style.width=`${d}%`,r.style.height=`${p}%`},[o,a,E,i]),I.useEffect(()=>{var d;if(!u.current)return;const r=u.current.getBoundingClientRect(),s=(d=u.current.parentElement)==null?void 0:d.getBoundingClientRect(),p=de(r.width,r.height);if(J(p),typeof o=="number"&&typeof a=="number")u.current.style.width=`${L(o)}%`,u.current.style.height=`${L(a)}%`,R.current.currentWidthPercent=o,R.current.currentHeightPercent=a;else if(s){const g=U(i,s.height),h=U(E,s.width);requestAnimationFrame(()=>{u.current&&(u.current.style.height=`${g}%`,u.current.style.width=`${h}%`)}),R.current.currentWidthPercent=h,R.current.currentHeightPercent=g}else u.current.style.height="100%",u.current.style.width="100%",R.current.currentWidthPercent=100,R.current.currentHeightPercent=100},[u.current,x,i,E]);const Te=r=>{const p=r.target.closest("[data-lexical-decorator]");return p?t.update(()=>{const d=b.$getNearestNodeFromDOMNode(p);d&&d instanceof b.DecoratorNode&&Z(d)}):Z(null),!1},ze=()=>(Q&&setTimeout(()=>{t.update(()=>(Q.insertAfter(b.$createParagraphNode()).selectStart(),Z(null),!0))}),!1);return Y!=null&&Y.current&&(Y.current.decoratorEnterAction=ze),I.useEffect(()=>{const r=t.registerCommand(b.CLICK_COMMAND,Te,b.COMMAND_PRIORITY_NORMAL);return()=>{r()}},[Q]),k.isMobile?y:n.jsxs("div",{ref:u,className:`resizable-container ${M||""} ${ye?"hide-padding":""}`,style:{cursor:q},onMouseMove:Ce,onMouseEnter:()=>le(!0),onMouseLeave:()=>{le(!1),K("default")},onMouseUp:()=>{t.dispatchCommand(k.ON_CHANGE_COMMAND,"show_menu")},onPointerDown:Me,children:[n.jsx("svg",{className:`resizable-container__handle ${G?"hovered":""}`,style:{"--clip-x1":`${T.x-z}px`,"--clip-y1":`${T.y-z}px`,"--clip-x2":`${T.x+z}px`,"--clip-y2":`${T.y-z}px`,"--clip-x3":`${T.x+z}px`,"--clip-y3":`${T.y+z}px`,"--clip-x4":`${T.x-z}px`,"--clip-y4":`${T.y+z}px`,clipPath:`polygon(
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),I=require("react"),V=require("react-i18next"),je=require("@lexical/react/LexicalComposerContext"),f=require("@mantine/core"),b=require("lexical"),ae=require("./layers.BVRvG1mv.js"),e=require("@tabler/icons-react"),we=require("@layers-app/shared"),H=require("./layers.BQLznd92.js"),k=require("./layers.DwX5sVtx.js"),Se=require("react-dom"),ke=require("@lexical/react/LexicalContentEditable"),Ne=require("@lexical/rich-text"),De=require("@lexical/utils"),B=require("./layers.B8z-e4Vg.js"),Ie={bullet:e.IconList,check:e.IconListCheck,"check-mark":e.IconCheck,code:e.IconCode,h1:e.IconH1,h2:e.IconH2,h3:e.IconH3,number:e.IconListNumbers,paragraph:e.IconIndentIncrease,quote:e.IconQuote,fontFamily:e.IconLetterT,undo:e.IconArrowBackUp,redo:e.IconArrowForwardUp,bold:e.IconBold,italic:e.IconItalic,underline:e.IconUnderline,link:e.IconLink,"color-picker":e.IconColorPicker,background:e.IconBucketDroplet,photo:e.IconPhoto,"photo-check":e.IconPhotoCheck,"align-left":e.IconAlignLeft,"align-end":e.IconAlignLeft,"align-start":e.IconAlignLeft,"align-right":e.IconAlignRight,"align-center":e.IconAlignCenter,"align-justify":e.IconAlignJustified,"horizontal-rule":e.IconFlipHorizontal,strikethrough:e.IconStrikethrough,subscript:e.IconSubscript,superscript:e.IconSuperscript,minus:e.IconMinus,plus:e.IconPlus,"chevron-down":e.IconChevronDown,"chevron-right":e.IconChevronRight,grip:e.IconGripVertical,"circle-check":e.IconCircleCheck,"circle-x":e.IconCircleX,pencil:e.IconPencil,trash:e.IconTrash,table:e.IconTable,"caret-right":e.IconCaretRight,grid:e.IconColumns3,"dots-vertical":e.IconDotsVertical,copy:e.IconCopy,clipboard:e.IconClipboard,cut:e.IconCut,"arrow-bar-to-up":e.IconArrowBarToUp,"arrow-bar-to-down":e.IconArrowBarToDown,"arrow-bar-to-left":e.IconArrowBarToLeft,"arrow-bar-to-right":e.IconArrowBarToRight,"column-insert-left":e.IconColumnInsertLeft,"column-insert-right":e.IconColumnInsertRight,"row-insert-top":e.IconRowInsertTop,"row-insert-bottom":e.IconRowInsertBottom,"container-off":e.IconContainerOff,"table-off":e.IconTableOff,"layers-union":e.IconLayersUnion,"layers-substract":e.IconLayersSubtract,"сlear-format":e.IconDropletOff,form:e.IconCheckupList,youtube:e.IconBrandYoutube,emoji:e.IconMoodSmile,file:e.IconFile,success:e.IconCheck,warning:e.IconAlertTriangle,alert:e.IconExclamationCircle,defaultOff:e.IconBaseline,embed:e.IconCodeCircle,at:e.IconAt,paperclip:e.IconPaperclip,close:e.IconX,api:e.IconApi,music:e.IconMusic,message:e.IconMessage,reply:e.IconArrowBackUp,filter:e.IconFilter,messages:e.IconMessages,"shield-check":e.IconShieldCheckFilled,reOpen:e.IconReload,send:e.IconSend,expandSidebar:e.IconLayoutSidebarLeftExpand,palette:e.IconPalette},P=({name:t,iconStyle:o,...a})=>{const i=Ie[t]||Ie.bullet;return n.jsx(f.Flex,{gap:0,justify:"center",align:"center",...a,children:n.jsx(i,{size:18,stroke:2,style:o,...a})})},Le=({icon:t,title:o,pointerEvents:a="auto",isLoading:i,progress:E,nodeKey:y,onAfterCancel:m,...x})=>{const[C]=je.useLexicalComposerContext(),{t:M}=V.useTranslation(),{fetchUploadMedia:l}=I.useContext(ae.Context),_=((l==null?void 0:l.length)??0)>=5,T=()=>{C.update(()=>{const z=b.$getNodeByKey(y);z&&z.remove()})},N=z=>{z.stopPropagation(),m==null||m()};return n.jsxs(f.UnstyledButton,{className:"image-node-picker-button",styles:{root:{width:"100%",display:"flex",alignItems:"center",gap:"var(--mantine-spacing-sm)",flexDirection:"column",padding:"var(--mantine-spacing-md)",background:"var(--mantine-primary-color-light)",color:"var(--mantine-color-text)",borderRadius:"var(--mantine-radius-default)",opacity:.75,pointerEvents:i?"none":a,boxSizing:"border-box"}},...x,children:[n.jsxs("div",{className:"empty-node-button__content",children:[i&&!_&&n.jsx(f.Loader,{size:"xs",mb:2,mr:4,color:"gray"}),!i&&n.jsx(P,{name:t}),o,i&&m&&n.jsx(f.Text,{component:"span",onClick:N,variant:"link",style:{marginLeft:"auto",cursor:"pointer",pointerEvents:"auto"},children:M("editor.cancel")}),y&&!i&&n.jsx(P,{style:{pointerEvents:"auto"},className:"delete-icon",name:"close",size:22,onClick:T})]}),i&&typeof E=="number"&&_&&n.jsx(f.Progress,{w:"100%",value:E,animated:!0,transitionDuration:200})]})},Oe="_title_81iwv_1",ve="_icon_81iwv_11",Ae="_link_81iwv_20",se={title:Oe,icon:ve,link:Ae},Be=({page:t})=>{const{t:o}=V.useTranslation();return n.jsxs("div",{className:se.link,onClick:t.onClick,children:[n.jsx("div",{className:se.icon,children:t.icon?n.jsx(we.ProjectIcon,{size:16,fz:16,icon:t.icon,fallback:n.jsx(e.IconFile,{size:"1em"})}):n.jsx(e.IconFile,{size:16})}),n.jsx(f.Tooltip,{label:t.title,disabled:!t.title,openDelay:400,children:n.jsx(f.Text,{truncate:!0,className:se.title,"data-empty":!t.title,children:t.title||o("editor.noTitle")})})]})},He=I.memo,Fe=He(Be),We={center:-8,right:2,left:-18},$e=(t,o,a,i)=>{const y=t.width/2,m=t.height/2,x=i==null?void 0:i.classList[1],C=We[x];switch(o){case"nw-resize":return{x:0,y:0};case"ne-resize":return{x:t.width-16,y:0};case"sw-resize":return{x:0,y:t.height-16};case"se-resize":return{x:t.width-16,y:t.height-16};case"n-resize":return{x:y+C,y:0};case"s-resize":return{x:y+C,y:t.height-16};case"w-resize":return{x:0,y:m-8};case"e-resize":return{x:t.width-16,y:m-(a?17:8)}}},qe=(t,o,a,i=["nw-resize","ne-resize","sw-resize","se-resize","n-resize","s-resize","w-resize","e-resize"])=>{const y=a<=32,m=a>=t.height-32,x=o<=32,C=o>=t.width-32;return y&&x?i.includes("nw-resize")?"nw-resize":"default":y&&C?i.includes("ne-resize")?"ne-resize":"default":m&&x?i.includes("sw-resize")?"sw-resize":"default":m&&C?i.includes("se-resize")?"se-resize":"default":y?i.includes("n-resize")?"n-resize":"default":m?i.includes("s-resize")?"s-resize":"default":x?i.includes("w-resize")?"w-resize":"default":C&&i.includes("e-resize")?"e-resize":"default"},X=32,U=(t,o)=>t&&typeof t=="number"?Math.min(t/o*100,95.5):95.5;function Ge(t){const a=100-4e3/t;return{minResizePercent:Math.max(5,9792/t),maxWidthPercent:a}}const Ye=({editor:t,width:o,height:a,initialHeight:i,initialWidth:E,children:y,onResizeStart:m,isIcon:x,onResizeEnd:C,alignment:M,isEmbed:l,type:_})=>{const[T,N]=I.useState({x:-1e3,y:-1e3}),[z,J]=I.useState(30),[q,K]=I.useState("default"),[G,le]=I.useState(!1),{imperativeHandleRef:Y}=I.useContext(ae.Context),[Q,Z]=I.useState(null),D=I.useMemo(()=>H.getAllowedControls(M)||["e-resize"],[M]),ye=D.length===1&&D[0]==="e-resize",u=I.useRef(null),ue=I.useRef(null),R=I.useRef({rootHeight:0,rootWidth:0,ratio:1,currentWidth:0,currentWidthPercent:0,currentHeight:0,currentHeightPercent:0,startWidth:0,startWidthPercent:0,startHeight:0,startHeightPercent:0,startX:0,startY:0,direction:"x",isResizing:!1,isTop:!1,isBottom:!1,isLeft:!1,isRight:!1}),L=(r,s=95.5)=>{var d;const p=(d=t._window)==null?void 0:d.innerWidth;if(p){let g=100;l&&(g=250);const h=g/p*100;return r<h?h:r>s?s:r}else return r<20?20:r>100?100:r},de=(r,s)=>{const p=Math.min(r,s);return 15+(Math.max(200,Math.min(800,p))-100)/500*15},he=(r,s,p)=>{if(K("default"),!G)return;let d=q;d=qe(r,s,p,D),R.current.isResizing&&(d=q),K(d),J(z),N(g=>$e(r,d,l||!1,u.current)||g)},Ce=r=>{var g;if(k.isMobile)return;r.preventDefault();const s=(g=u.current)==null?void 0:g.getBoundingClientRect();if(!s)return;const p=r.clientX-s.left,d=r.clientY-s.top;R.current.isResizing||he(s,p,d)},me=(r,s=12,p=95.5,d=R.current.rootWidth)=>{const g=u.current,h=R.current;if(!g||r.button===2||!(h!=null&&h.isResizing))return;const w=g.getBoundingClientRect(),O=r.clientX-w.left,ee=r.clientY-w.top;he(w,O,ee);const te=.17,F=M==="right",W=M==="center",v=h.isLeft,A=h.isTop,$=h.isBottom,ne=h.direction==="y",c=h.isRight,S=Math.floor(F?w.right-r.clientX-(w.right-h.startX):r.clientX-h.startX),re=Math.floor(r.clientY-h.startY);let j=0;v||c?j=S/d*100:(A||$||W)&&(j=re*te),(v||A)&&(!F||ne&&!v)&&(!$||W)&&(j=-j),(A&&c||$&&c)&&(j=S/d*100),j=Math.max(-100,Math.min(100,j));const ie=h.startWidthPercent+j,oe=h.startHeightPercent+j;h.currentWidthPercent=L(Math.max(s,ie),p),h.currentHeightPercent=L(Math.max(s,oe),p),g.style.width=`${h.currentWidthPercent}%`,g.style.height=`${h.currentHeightPercent}%`},Ee=r=>{var g,h;const s=R.current;if(s.isResizing=!1,(g=u.current)==null||g.classList.remove("is-resizing"),(h=u.current)==null||h.releasePointerCapture(r.pointerId),C(s.currentWidthPercent+"%",s.currentHeightPercent+"%"),document.removeEventListener("pointermove",me),!u.current)return;const p=u.current.getBoundingClientRect(),d=de(p.width,p.height);J(d)},Me=r=>{var pe,ge;if(r.button===2||!G){r.preventDefault(),r.stopPropagation();return}if(!u.current)return;u.current.classList.add("is-resizing");const s=t.getRootElement();if(!s)return;const p=s.getBoundingClientRect();if(!t.isEditable()||q==="default")return;const d=ue.current;if(d===null)return;const g=(pe=u.current)==null?void 0:pe.getBoundingClientRect();if(!d.getBoundingClientRect()||!g)return;const{width:w,height:O,top:ee,left:te}=g,F=r.clientX-te,W=r.clientY-ee,v=W<=X,A=W>=O-X,$=F<=X,ne=F>=w-X,c=R.current,S=window.getComputedStyle(s),re=parseFloat(S.paddingTop),j=parseFloat(S.paddingBottom),ie=parseFloat(S.paddingLeft),oe=parseFloat(S.paddingRight);c.rootHeight=p.height-re-j||0,c.rootWidth=p.width-ie-oe||0,c.ratio=w/O,c.currentWidth=c.currentWidth||w,c.currentWidthPercent=+u.current.style.width.replace("%",""),c.currentHeight=c.currentHeight||O,c.currentHeightPercent=+u.current.style.height.replace("%",""),c.startX=r.clientX,c.startY=r.clientY,c.startWidth=c.currentWidth||w,c.startWidthPercent=c.currentWidthPercent,c.startHeight=c.currentHeight||O,c.startHeightPercent=c.currentHeightPercent,c.isResizing=!0,c.isTop=v,c.isBottom=A,c.isLeft=$,c.isRight=ne,c.direction=A||v?"y":"x",m&&m(),u.current.setPointerCapture(r.pointerId);const Re=((ge=u.current.parentElement)==null?void 0:ge.offsetWidth)??c.rootWidth,{maxWidthPercent:Pe,minResizePercent:_e}=Ge(Re);document.addEventListener("pointermove",be=>{var fe,xe;return me(be,_==="video"?40:_e,Pe,(xe=(fe=u.current)==null?void 0:fe.parentElement)==null?void 0:xe.offsetWidth)}),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})};I.useEffect(()=>{var g;const r=u.current;if(!r)return;if(typeof o=="number"&&typeof a=="number"){r.style.width=`${L(o)}%`,r.style.height=`${L(a)}%`;return}const s=(g=r.parentElement)==null?void 0:g.getBoundingClientRect();if(!s)return;const p=U(i,s.height),d=U(E,s.width);r.style.width=`${d}%`,r.style.height=`${p}%`},[o,a,E,i]),I.useEffect(()=>{var d;if(!u.current)return;const r=u.current.getBoundingClientRect(),s=(d=u.current.parentElement)==null?void 0:d.getBoundingClientRect(),p=de(r.width,r.height);if(J(p),typeof o=="number"&&typeof a=="number")u.current.style.width=`${L(o)}%`,u.current.style.height=`${L(a)}%`,R.current.currentWidthPercent=o,R.current.currentHeightPercent=a;else if(s){const g=U(i,s.height),h=U(E,s.width);requestAnimationFrame(()=>{u.current&&(u.current.style.height=`${g}%`,u.current.style.width=`${h}%`)}),R.current.currentWidthPercent=h,R.current.currentHeightPercent=g}else u.current.style.height="100%",u.current.style.width="100%",R.current.currentWidthPercent=100,R.current.currentHeightPercent=100},[u.current,x,i,E]);const Te=r=>{const p=r.target.closest("[data-lexical-decorator]");return p?t.update(()=>{const d=b.$getNearestNodeFromDOMNode(p);d&&d instanceof b.DecoratorNode&&Z(d)}):Z(null),!1},ze=()=>(Q&&setTimeout(()=>{t.update(()=>(Q.insertAfter(b.$createParagraphNode()).selectStart(),Z(null),!0))}),!1);return Y!=null&&Y.current&&(Y.current.decoratorEnterAction=ze),I.useEffect(()=>{const r=t.registerCommand(b.CLICK_COMMAND,Te,b.COMMAND_PRIORITY_NORMAL);return()=>{r()}},[Q]),k.isMobile?y:n.jsxs("div",{ref:u,className:`resizable-container ${M||""} ${ye?"hide-padding":""}`,style:{cursor:q},onMouseMove:Ce,onMouseEnter:()=>le(!0),onMouseLeave:()=>{le(!1),K("default")},onMouseUp:()=>{t.dispatchCommand(k.ON_CHANGE_COMMAND,"show_menu")},onPointerDown:Me,children:[n.jsx("svg",{className:`resizable-container__handle ${G?"hovered":""}`,style:{"--clip-x1":`${T.x-z}px`,"--clip-y1":`${T.y-z}px`,"--clip-x2":`${T.x+z}px`,"--clip-y2":`${T.y-z}px`,"--clip-x3":`${T.x+z}px`,"--clip-y3":`${T.y+z}px`,"--clip-x4":`${T.x-z}px`,"--clip-y4":`${T.y+z}px`,clipPath:`polygon(
|
|
2
2
|
var(--clip-x1) var(--clip-y1),
|
|
3
3
|
var(--clip-x2) var(--clip-y2),
|
|
4
4
|
var(--clip-x3) var(--clip-y3),
|
|
5
5
|
var(--clip-x4) var(--clip-y4)
|
|
6
|
-
)`,opacity:G?1:0,transition:`${R.current.isResizing?"none":` opacity 0.3s ease-in-out, clip-path ${(D==null?void 0:D.length)<4?"0.2s":"0.3s"} cubic-bezier(0.825, 0.225, 0.280, 0.770)`}`},children:n.jsx("rect",{x:0,y:0,width:"100%",height:"100%",stroke:"#D9D9D9",strokeWidth:8,rx:15,ry:15,fill:"none"})}),n.jsx("div",{ref:ue,className:"resizable-container__inner",style:{height:"100%",width:"100%",pointerEvents:R.current.isResizing?"none":"auto"},children:y})]})};function Xe({children:t}){return Se.createPortal(n.jsx("div",{className:"FlashMessage__overlay",role:"dialog",children:n.jsx("p",{className:"FlashMessage__alert",role:"alert",children:t})}),document.body)}function Ue({onClose:t,children:o,title:a,size:i}){return n.jsx(f.Modal,{className:"doc-space-editor-wrapper",size:i,centered:!0,opened:!0,onClose:t,title:a,zIndex:999,children:o})}function Ve({"data-test-id":t,children:o,className:a,onClick:i,disabled:E,small:y,title:m}){return n.jsx(f.Button,{onClick:i,disabled:E,variant:"filled",children:o})}const Je=({label:t,icon:o})=>n.jsxs("div",{className:"custom-menu-item",children:[n.jsxs("div",{children:[o,n.jsx("span",{children:t})]}),n.jsx(P,{name:"chevron-right"})]}),Ke=t=>({center:{icon:"align-center",iconRTL:"center-align",name:t("editor.toolbar.center")},end:{icon:"align-end",iconRTL:"left-align",name:"End Align"},justify:{icon:"align-justify",iconRTL:"justify-align",name:t("editor.toolbar.justify")},left:{icon:"align-left",iconRTL:"left-align",name:t("editor.toolbar.left")},right:{icon:"align-right",iconRTL:"left-align",name:t("editor.toolbar.right")},start:{icon:"align-start",iconRTL:"right-align",name:"Start Align"}});function Qe({editor:t,value:o,disabled:a=!1,setElementFormat:i}){const{t:E,i18n:y}=V.useTranslation(),m=I.useMemo(()=>Ke(E),[y.language]),x=I.useMemo(()=>o==="start"||o==="end"?m.left:m[o||"left"],[o,y.language]),C=M=>{i(M),t.dispatchCommand(b.FORMAT_ELEMENT_COMMAND,M)};return n.jsxs(f.Menu,{transitionProps:H.animationMenu,shadow:"md",styles:{dropdown:{zIndex:1e3}},children:[n.jsx(f.Menu.Target,{children:n.jsx(f.Tooltip,{label:E("editor.toolbar.align"),children:n.jsxs("button",{disabled:a,className:"toolbar-item spaced alignment","aria-label":"Formatting options for text alignment",type:"button",children:[n.jsx(P,{size:18,name:x.icon}),n.jsxs(f.Text,{mx:5,size:"sm",children:[" ",x.name]}),n.jsx(P,{name:"chevron-down"})]})})}),n.jsxs(f.Menu.Dropdown,{onMouseDown:M=>{M.preventDefault()},children:[n.jsx(f.Menu.Item,{leftSection:n.jsx(P,{size:18,name:"align-left"}),rightSection:o==="left"&&n.jsx(P,{name:"check-mark"}),onClick:()=>C("left"),children:m.left.name}),n.jsx(f.Menu.Item,{leftSection:n.jsx(P,{size:18,name:"align-center"}),rightSection:o==="center"&&n.jsx(P,{name:"check-mark"}),onClick:()=>C("center"),children:m.center.name}),n.jsx(f.Menu.Item,{leftSection:n.jsx(P,{size:18,name:"align-right"}),rightSection:o==="right"&&n.jsx(P,{name:"check-mark"}),onClick:()=>C("right"),children:m.right.name}),n.jsx(f.Menu.Item,{leftSection:n.jsx(P,{size:18,name:"align-justify"}),rightSection:o==="justify"&&n.jsx(P,{name:"check-mark"}),onClick:()=>C("justify"),children:m.justify.name})]})]})}function Ze({className:t}){return n.jsx(ke.ContentEditable,{contentEditable:!1,className:t||"ContentEditable__root"})}const et="_listContainer_1d88b_1",tt="_list_1d88b_1",nt="_text_1d88b_28",ce={listContainer:et,list:tt,text:nt},rt=({editor:t})=>{var M;const[o,a]=I.useState(!1),{t:i,i18n:E}=V.useTranslation(),{excludeNodes:y}=I.useContext(ae.Context),m=l=>{const _=document.querySelector(".editor-container");if(l){_.classList.add("empty-editor");return}_.classList.remove("empty-editor")};I.useEffect(()=>{t.update(()=>{k.checkIsEmpty()&&(a(!0),m(!0))}),De.mergeRegister(t.registerCommand(b.BLUR_COMMAND,()=>{const l=!!k.checkIsEmpty();return a(l),m(l),!1},b.COMMAND_PRIORITY_LOW),t.registerCommand(b.FOCUS_COMMAND,()=>(a(!1),m(!1),!1),b.COMMAND_PRIORITY_LOW))},[]);const x=(l,_)=>{l==null||l.update(()=>{l.focus();const N=b.$getRoot().getFirstChild();N&&_&&(_(N),a(!1))})},C=I.useMemo(()=>[{title:i("editor.emptyPageOptions.heading"),icon:n.jsx(e.IconH1,{stroke:2,size:18}),onSelect:()=>x(t,l=>{l.replace(Ne.$createHeadingNode("h1"))})},{title:i("editor.emptyPageOptions.grid"),icon:n.jsx(e.IconColumns2,{stroke:2,size:18}),onSelect:()=>{x(t,()=>{t==null||t.dispatchCommand(B.INSERT_LAYOUT_COMMAND,B.GRID_TWO_COL_WITH_GAP)})}},{title:i("editor.emptyPageOptions.list"),icon:n.jsx(e.IconListNumbers,{stroke:2,size:18}),onSelect:()=>{x(t,()=>{t==null||t.dispatchCommand(H.INSERT_ORDERED_LIST_COMMAND,void 0)})}},{title:i("editor.emptyPageOptions.code"),icon:n.jsx(e.IconCode,{stroke:2,size:18}),onSelect:()=>{x(t,()=>{t==null||t.dispatchCommand(B.INSERT_CODE_COMMAND,void 0)})}},{title:i("editor.menu.media.excalidraw.hint.description"),icon:n.jsx(e.IconPalette,{stroke:2,size:18}),onSelect:()=>{Promise.resolve().then(()=>require("./layers.
|
|
6
|
+
)`,opacity:G?1:0,transition:`${R.current.isResizing?"none":` opacity 0.3s ease-in-out, clip-path ${(D==null?void 0:D.length)<4?"0.2s":"0.3s"} cubic-bezier(0.825, 0.225, 0.280, 0.770)`}`},children:n.jsx("rect",{x:0,y:0,width:"100%",height:"100%",stroke:"#D9D9D9",strokeWidth:8,rx:15,ry:15,fill:"none"})}),n.jsx("div",{ref:ue,className:"resizable-container__inner",style:{height:"100%",width:"100%",pointerEvents:R.current.isResizing?"none":"auto"},children:y})]})};function Xe({children:t}){return Se.createPortal(n.jsx("div",{className:"FlashMessage__overlay",role:"dialog",children:n.jsx("p",{className:"FlashMessage__alert",role:"alert",children:t})}),document.body)}function Ue({onClose:t,children:o,title:a,size:i}){return n.jsx(f.Modal,{className:"doc-space-editor-wrapper",size:i,centered:!0,opened:!0,onClose:t,title:a,zIndex:999,children:o})}function Ve({"data-test-id":t,children:o,className:a,onClick:i,disabled:E,small:y,title:m}){return n.jsx(f.Button,{onClick:i,disabled:E,variant:"filled",children:o})}const Je=({label:t,icon:o})=>n.jsxs("div",{className:"custom-menu-item",children:[n.jsxs("div",{children:[o,n.jsx("span",{children:t})]}),n.jsx(P,{name:"chevron-right"})]}),Ke=t=>({center:{icon:"align-center",iconRTL:"center-align",name:t("editor.toolbar.center")},end:{icon:"align-end",iconRTL:"left-align",name:"End Align"},justify:{icon:"align-justify",iconRTL:"justify-align",name:t("editor.toolbar.justify")},left:{icon:"align-left",iconRTL:"left-align",name:t("editor.toolbar.left")},right:{icon:"align-right",iconRTL:"left-align",name:t("editor.toolbar.right")},start:{icon:"align-start",iconRTL:"right-align",name:"Start Align"}});function Qe({editor:t,value:o,disabled:a=!1,setElementFormat:i}){const{t:E,i18n:y}=V.useTranslation(),m=I.useMemo(()=>Ke(E),[y.language]),x=I.useMemo(()=>o==="start"||o==="end"?m.left:m[o||"left"],[o,y.language]),C=M=>{i(M),t.dispatchCommand(b.FORMAT_ELEMENT_COMMAND,M)};return n.jsxs(f.Menu,{transitionProps:H.animationMenu,shadow:"md",styles:{dropdown:{zIndex:1e3}},children:[n.jsx(f.Menu.Target,{children:n.jsx(f.Tooltip,{label:E("editor.toolbar.align"),children:n.jsxs("button",{disabled:a,className:"toolbar-item spaced alignment","aria-label":"Formatting options for text alignment",type:"button",children:[n.jsx(P,{size:18,name:x.icon}),n.jsxs(f.Text,{mx:5,size:"sm",children:[" ",x.name]}),n.jsx(P,{name:"chevron-down"})]})})}),n.jsxs(f.Menu.Dropdown,{onMouseDown:M=>{M.preventDefault()},children:[n.jsx(f.Menu.Item,{leftSection:n.jsx(P,{size:18,name:"align-left"}),rightSection:o==="left"&&n.jsx(P,{name:"check-mark"}),onClick:()=>C("left"),children:m.left.name}),n.jsx(f.Menu.Item,{leftSection:n.jsx(P,{size:18,name:"align-center"}),rightSection:o==="center"&&n.jsx(P,{name:"check-mark"}),onClick:()=>C("center"),children:m.center.name}),n.jsx(f.Menu.Item,{leftSection:n.jsx(P,{size:18,name:"align-right"}),rightSection:o==="right"&&n.jsx(P,{name:"check-mark"}),onClick:()=>C("right"),children:m.right.name}),n.jsx(f.Menu.Item,{leftSection:n.jsx(P,{size:18,name:"align-justify"}),rightSection:o==="justify"&&n.jsx(P,{name:"check-mark"}),onClick:()=>C("justify"),children:m.justify.name})]})]})}function Ze({className:t}){return n.jsx(ke.ContentEditable,{contentEditable:!1,className:t||"ContentEditable__root"})}const et="_listContainer_1d88b_1",tt="_list_1d88b_1",nt="_text_1d88b_28",ce={listContainer:et,list:tt,text:nt},rt=({editor:t})=>{var M;const[o,a]=I.useState(!1),{t:i,i18n:E}=V.useTranslation(),{excludeNodes:y}=I.useContext(ae.Context),m=l=>{const _=document.querySelector(".editor-container");if(l){_.classList.add("empty-editor");return}_.classList.remove("empty-editor")};I.useEffect(()=>{t.update(()=>{k.checkIsEmpty()&&(a(!0),m(!0))}),De.mergeRegister(t.registerCommand(b.BLUR_COMMAND,()=>{const l=!!k.checkIsEmpty();return a(l),m(l),!1},b.COMMAND_PRIORITY_LOW),t.registerCommand(b.FOCUS_COMMAND,()=>(a(!1),m(!1),!1),b.COMMAND_PRIORITY_LOW))},[]);const x=(l,_)=>{l==null||l.update(()=>{l.focus();const N=b.$getRoot().getFirstChild();N&&_&&(_(N),a(!1))})},C=I.useMemo(()=>[{title:i("editor.emptyPageOptions.heading"),icon:n.jsx(e.IconH1,{stroke:2,size:18}),onSelect:()=>x(t,l=>{l.replace(Ne.$createHeadingNode("h1"))})},{title:i("editor.emptyPageOptions.grid"),icon:n.jsx(e.IconColumns2,{stroke:2,size:18}),onSelect:()=>{x(t,()=>{t==null||t.dispatchCommand(B.INSERT_LAYOUT_COMMAND,B.GRID_TWO_COL_WITH_GAP)})}},{title:i("editor.emptyPageOptions.list"),icon:n.jsx(e.IconListNumbers,{stroke:2,size:18}),onSelect:()=>{x(t,()=>{t==null||t.dispatchCommand(H.INSERT_ORDERED_LIST_COMMAND,void 0)})}},{title:i("editor.emptyPageOptions.code"),icon:n.jsx(e.IconCode,{stroke:2,size:18}),onSelect:()=>{x(t,()=>{t==null||t.dispatchCommand(B.INSERT_CODE_COMMAND,void 0)})}},{title:i("editor.menu.media.excalidraw.hint.description"),icon:n.jsx(e.IconPalette,{stroke:2,size:18}),onSelect:()=>{Promise.resolve().then(()=>require("./layers.B8z-e4Vg.js")).then(l=>l.index).then(({INSERT_EXCALIDRAW_COMMAND:l})=>{x(t,()=>{t.dispatchCommand(l,void 0)})})}},y.template?{title:i("editor.emptyPageOptions.template"),icon:n.jsx(e.IconTemplate,{stroke:2,size:18}),onSelect:()=>{x(t,()=>{t==null||t.dispatchCommand(k.CREATE_TEMPLATE,void 0)})}}:null,{title:i("editor.emptyPageOptions.callout"),icon:n.jsx(e.IconBaseline,{stroke:2,size:18}),onSelect:()=>{x(t,()=>{setTimeout(()=>{t==null||t.dispatchCommand(k.INSERT_CALLOUT_COMMAND,"success")})})}},{title:i("editor.emptyPageOptions.table"),icon:n.jsx(e.IconTable,{stroke:2,size:18}),onSelect:()=>{x(t,()=>{setTimeout(()=>{t==null||t.dispatchCommand(H.INSERT_TABLE_COMMAND,{columns:"4",includeHeaders:!1,rows:"3"})})})}},{title:i("editor.emptyPageOptions.integrations"),icon:n.jsx(e.IconApps,{stroke:2,size:18}),onSelect:()=>{}}],[E.language]);return o?n.jsx(f.Portal,{target:((M=t==null?void 0:t._rootElement)==null?void 0:M.parentElement)||document.body,children:n.jsx("ul",{className:`${ce.listContainer} empty-page-options`,children:C.map((l,_)=>l?n.jsxs(f.Menu,{disabled:_!==C.length-1,position:"bottom-start",shadow:"md",styles:{dropdown:{overflow:"auto",zIndex:1e3}},middlewares:B.middlewaresPopup,width:200,transitionProps:H.animationMenu,children:[n.jsx(f.Menu.Target,{children:n.jsxs("li",{className:ce.list,onClick:l.onSelect,children:[l.icon," ",n.jsx("span",{className:ce.text,children:l.title})]})}),n.jsx(f.Menu.Dropdown,{children:H.embedDescriptors.map(T=>n.jsx(f.Menu.Item,{className:"item "+B.dropDownActiveClass(T.key==="1"),leftSection:T.icon,style:{borderRadius:"var(--mantine-radius-sm)"},onClick:()=>{x(t,()=>{setTimeout(()=>{t==null||t.dispatchCommand(B.INSERT_EMBED_INTEGRATION_COMMAND,""),a(!1)})})},children:T.name},T.name))})]},l.title):null)})}):null};exports.AlignMenu=Qe;exports.Button=Ve;exports.CustomMenuItem=Je;exports.EmptyNodeButton=Le;exports.EmptyPage=rt;exports.FlashMessage=Xe;exports.Icon=P;exports.LexicalContentEditable=Ze;exports.ModalComponent=Ue;exports.PageLink=Fe;exports.ResizableContainer=Ye;
|
|
@@ -14,9 +14,9 @@ import { WebsocketProvider as kt } from "y-websocket";
|
|
|
14
14
|
import so from "i18next";
|
|
15
15
|
import { useLexicalComposerContext as vt } from "@lexical/react/LexicalComposerContext";
|
|
16
16
|
import { mergeRegister as De, registerNestedElementResolver as lo } from "@lexical/utils";
|
|
17
|
-
import { F as co, E as uo, L as Ye } from "./layers.
|
|
18
|
-
import { $ as Fe, a as Je, b as Oe, c as Ue, E as de, d as le, e as mo, f as ho, M as po, g as go } from "./layers.
|
|
19
|
-
import { C as fo, a as bo, b as yo, E as _o, M as wo, c as Co, d as ko, L as vo, e as So, f as Ao, g as xo, S as Eo, h as Io, N as Mo, F as Po, i as No, j as To, B as Lo, k as Ro, T as Do, A as Fo, l as Oo, m as Uo, n as zo, o as Bo, p as jo, q as qo, r as Wo, s as Ko, t as $o, u as Ge, v as Ho } from "./layers.
|
|
17
|
+
import { F as co, E as uo, L as Ye } from "./layers.CoCZDINv.js";
|
|
18
|
+
import { $ as Fe, a as Je, b as Oe, c as Ue, E as de, d as le, e as mo, f as ho, M as po, g as go } from "./layers.BnVn2uMi.js";
|
|
19
|
+
import { C as fo, a as bo, b as yo, E as _o, M as wo, c as Co, d as ko, L as vo, e as So, f as Ao, g as xo, S as Eo, h as Io, N as Mo, F as Po, i as No, j as To, B as Lo, k as Ro, T as Do, A as Fo, l as Oo, m as Uo, n as zo, o as Bo, p as jo, q as qo, r as Wo, s as Ko, t as $o, u as Ge, v as Ho } from "./layers.8yssqxrI.js";
|
|
20
20
|
import { Array as Ze, Map as Qe, YArrayEvent as Vo, Doc as Yo } from "yjs";
|
|
21
21
|
import { ClearEditorPlugin as Jo } from "@lexical/react/LexicalClearEditorPlugin";
|
|
22
22
|
import { ClickableLinkPlugin as Go } from "@lexical/react/LexicalClickableLinkPlugin";
|
|
@@ -31,11 +31,11 @@ import { createDOMRange as ia, createRectsFromDOMRange as ra } from "@lexical/se
|
|
|
31
31
|
import { debounce as sa } from "lodash-es";
|
|
32
32
|
import { CommentComposer as la, CommentsPanel as da } from "@layers-app/shared";
|
|
33
33
|
import { TOGGLE_CONNECT_COMMAND as ca } from "@lexical/yjs";
|
|
34
|
-
import { T as et, F as tt, D as ua } from "./layers.
|
|
35
|
-
import { V as ma, M as ha, F as pa, a as ga } from "./layers.
|
|
36
|
-
import { c as fa, O as ba, k as ya, d as _a, s as wa, a as Ca, b as ot, e as at, p as ka, f as va, K as Sa, g as Aa, h as xa, R as Ea } from "./layers.
|
|
34
|
+
import { T as et, F as tt, D as ua } from "./layers.CLcioDq5.js";
|
|
35
|
+
import { V as ma, M as ha, F as pa, a as ga } from "./layers.BjCQNcdJ.js";
|
|
36
|
+
import { c as fa, O as ba, k as ya, d as _a, s as wa, a as Ca, b as ot, e as at, p as ka, f as va, K as Sa, g as Aa, h as xa, R as Ea } from "./layers.pre7B8K-.js";
|
|
37
37
|
import { useDebouncedCallback as nt } from "@mantine/hooks";
|
|
38
|
-
const Ia = "0.5.
|
|
38
|
+
const Ia = "0.5.8-optimization", Ma = {
|
|
39
39
|
version: Ia
|
|
40
40
|
}, Pa = /* @__PURE__ */ JSON.parse(`{"placeholder":"Write something, or press '/' for commands...","heading":{"h1":"Heading 1","h2":"Heading 2","h3":"Heading 3","name":"Heading"},"close":"Close","upload":"Upload","unsavedChanges":{"title":"Unsaved changes","message":"Are you sure you want to close the page? All unsaved data will be lost.","cancel":"Cancel","closeWithoutSaving":"Close without saving"},"menu":{"heading":{"title":"Headings","hintShowCase":"Your Ideas, Documents, and Plans. United. Welcome to {{projectName}} — this is a connected workspace where work becomes better and faster.","h1":{"subtitle":"Large Heading","hintDescription":"H1 is used to create the main heading of a page or section, which sets the overall theme. It is also used to automatically generate the table of contents for a document.","keywords":{"header1":"header1","headerOne":"headerone","h1":"h1"}},"h2":{"subtitle":"Medium Heading","hintDescription":"H2 is used to create a secondary heading of a page or section, which sets a general theme. It is also used to automatically generate the table of contents for a document.","keywords":{"header2":"header2","headerTwo":"headertwo","h2":"h2"}},"h3":{"subtitle":"Small Heading","hintDescription":"H3 is used to create a subheading of a page or section, which sets a general theme. It is also used to automatically generate the table of contents for a document.","keywords":{"header3":"header3","headerThree":"headerthree","h3":"h3"}}},"lists":{"title":"Lists","numberList":{"name":"Numbered List","subtitle":"A simple numbered list","hint":{"firstItem":"First item","secondItem":"Second item","firstSubItem":"First sub-item","secondSubItem":"Second sub-item","firstSubSubItem":"First sub-sub-item","secondSubSubItem":"Second sub-sub-item","description":"This tool creates a list with items that are automatically numbered when new rows are added."}},"bulletList":{"name":"Bulleted List","subtitle":"Automatically marked list","hint":{"firstItem":"First item","secondItem":"Second item","firstSubItem":"First sub-item","secondSubItem":"Second sub-item","firstSubSubItem":"First sub-sub-item","secondSubSubItem":"Second sub-sub-item","description":"This tool creates a list with items that are automatically marked with bullets when new rows are added."}},"checkList":{"name":"Checklist","subtitle":"Easy task management","hint":{"indeterminate":"Indeterminate","unchecked":"Unchecked","checked":"Checked","description":"Creates a task list with the ability to mark completed items and sub-items."}}},"main":{"title":"Basics","paragraph":{"name":"Paragraph","subtitle":"Simply start typing regular text","hint":{"text":"Your Ideas, Documents, and Plans. United. Welcome to {{projectName}} — this is a connected workspace where work becomes better and faster.","description":"A few lines of text, left-aligned, imitating a text block."}},"quote":{"name":"Quote","subtitle":"Write down a quote","hint":{"text":"/quote Your Ideas, Documents, and Plans. United. Welcome to {{projectName}} — this is a connected workspace where work becomes better and faster. Stay focused, stay aligned, and achieve more with Layers.","description":"Used to insert quotes or highlight important text blocks. It is visually separated from the main text."}},"collapse":{"name":"Collapsible","subtitle":"Hide block content","hint":{"firstItemEmpty":"First item is empty","secondItem":"Second item","firstSubItemEmpty":"First sub-item is empty","secondSubItem":"Second sub-item","firstSubSubItemEmpty":"First sub-sub-item is empty","secondSubSubItem":"Second sub-sub-item","description":"Used to create blocks with content that can be hidden or shown when clicked. Almost any other block can be placed inside such a list."}},"horizontal-rule":{"name":"Divider","subtitle":"Visualizes block dividers","hint":{"topText":"Pressed the slash. Then entered something...","bottomText":"The next day, everything became clearer and more understandable. As if what was unknown yesterday became completely familiar and ordinary today. Take, for example...","description":"Used to visually separate sections or blocks of text on a page."}},"table":{"name":"Table","subtitle":"Add a simple table to your page","hint":{"firstRow":"First cell filled with text","secondRow":"And another cell with text","description":"A tool for creating tables with multiple rows and columns to organize data."}},"grid":{"name":"Grid","subtitle":"Up to 4 columns of blocks","hint":{"firstColumn":"The next day, everything became clearer and more understandable. As if what was unknown yesterday became completely familiar and ordinary today. Take, for example...","secondColumn":"Your Ideas, Documents, and Plans. United. Welcome to {{projectName}} — this is a connected workspace where work becomes better and faster.","description":"A tool for dividing a document into multiple columns, into which any blocks can be placed."}},"code":{"name":"Code","subtitle":"Write a code snippet","copy":"Copy code","exitCommandText":"Shift + Enter to exit code block","collapsible":{"hidden":"Collapse code","expand":"Expand code"},"hint":{"description":"A tool for inserting code snippets with syntax highlighting."}},"callout":{"name":"Callout","subtitle":"Make writing stand out","hint":{"description":"-."}}},"callout":{"title":"Callout","default":{"name":"Default","hint":{"description":"A few lines of text aligned to the left, simulating a text block.","body":"/callout Your Ideas, Documents, and Plans. Unified. Welcome to {{projectName}} — a connected workspace where work gets better and faster. Your Ideas and Plans. Unified. Welcome to {{projectName}} — a connected workspace where work gets better and faster. Your Ideas, Documents, and Plans. Unified. Welcome to {{projectName}} — a connected workspace where work gets better and faster."},"keywords":{"callout":"callout","type":"default"},"subtitle":"Default callout"},"success":{"name":"Success","subtitle":"Successful notification","keywords":{"callout":"callout","type":"success"}},"warning":{"name":"Warning","hint":{"description":"A few lines of text aligned to the left, simulating a text block."},"keywords":{"callout":"callout","type":"warning"},"subtitle":"Important notification"},"alert":{"name":"Alert","hint":{"description":"A few lines of text aligned to the left, simulating a text block."},"keywords":{"callout":"callout","type":"alert"},"subtitle":"Critical notification"}},"media":{"title":"Media","photo":{"name":"Image","hint":{"description":"A tool for adding an image to a page."},"subtitle":"Upload and place via link"},"form":{"name":"Form","subtitle":"Add a form"},"video":{"name":"Video","hint":{"description":"A tool for embedding video on a page."},"subtitle":"Add a video"},"file":{"name":"File","hint":{"description":"Upload any files up to 500 MB in size, and they will be available for download to anyone you share the link to this page with."},"subtitle":"Add a file"},"audio":{"name":"Audio","hint":{"description":"Upload any audio files up to 5 MB in size, and they will be available for download and listening to anyone you share the link to this page with."},"subtitle":"Add a audio"},"excalidraw":{"name":"Paint","hint":{"description":"Draw any scheme or kind landscape. Free creativity where everything is in your hands."},"keywords":{"video":"draw"},"subtitle":"Work with vector graphics"}},"other":{"title":"Other","documents":{"empty":"You have no nested documents","name":"Nested Documents","subtitle":"Displays a list of nested documents"},"emoji":{"name":"Emoji","subtitle":"Add emoji"}},"integrations":{"title":"Integrations"}},"toolbar":{"turnInto":"Turn into","bold":"Bold","italic":"Italic","underline":"Underline","strike":"Strikethrough","superscript":"Superscript","subscript":"Subscript","align":"Alignment","left":"Align Left","center":"Align Center","right":"Align Right","justify":"Justify","indent":"Indent","outdent":"Outdent","color":"Color","code":"Code","link":"Add Link","clear":"Clear Formatting","comment":"Comment"},"link":{"linkName":"Link name","link":"Link","save":"Save","remove":"Remove","edit":"Edit","copy":"Copy"},"contextMenu":{"copy":"Copy","cut":"Cut","paste":"Paste","delete":"Delete","add":"Add","selectAll":"Select All","duplicate":"Duplicate","appearance":"Appearance"},"colors":{"lastTimeUsed":"Last Used","color":"Color","background":"Background","theme":"Theme","colors":{"standard":"Standard","gray":"Gray","brown":"Brown","orange":"Orange","yellow":"Yellow","green":"Green","blue":"Blue","purple":"Purple","pink":"Pink","red":"Red"},"callout":{"success":"Success","alert":"Alert","warning":"Warning"}},"video":{"insert":"Embed","apply":"Apply","worksWith":"Works with","add_video":"Add Video"},"swagger":{"insert":"Swagger","worksWith":"Works with","add":"Add Swagger"},"image":{"add_photo":"Add Image","preview":"Preview"},"file":{"add_file":"Add File"},"audio":{"add_audio":"Add Audio"},"mention":{"mark":"Mark someone"},"validation":{"link":"Invalid Link","shouldNotExceed":"File size should not exceed {{maxSize}} MB.","doNotUploadMoreThanSingleFile":"Please upload no more than one file.","swaggerUnavailable":"Swagger documentation is unavailable. Please make sure the URL is correct and the server is responding."},"table":{"background_one":"Cell Background Color","background_other":"Cells background color","settings":"Settings","menu":{"addColAfter":"Add Column Right","addColBefore":"Add Column Left","addRowAbove":"Add Row Above","addRowBelow":"Add Row Below","deleteCol":"Delete Column","deleteRow":"Delete Row","mergeCells":"Merge Cells","disconnectCells":"Disconnect Cells","splitCell":"Split Cell","deleteTable":"Delete Table","insertRow_one":"Insert row","insertRow_other":"Insert {{count}} rows","deleteRow_one":"Delete row","deleteRow_other":"Delete {{count}} rows","insertCol_one":"Insert column","insertCol_other":"Insert {{count}} columns","deleteCol_one":"Delete column","deleteCol_other":"Delete {{count}} columns","headTable_col":"{{value}} row column","headTable_row":"{{value}} row header","below":"Below","above":"Above","left":"Left","right":"Right","row":"Row","rows":"Rows","column":"Column","columns":"Columns"}},"column":{"name":"Insert Grid","insert":"Insert","columns":"Columns","addRight":"Add a column to the right","addLeft":"Add a column to the left","moveLeft":"Move a column to the left","changeColor":"Change the column color","moveRight":"Move a column to the right","deleteColumn":"Delete a column"},"hoverOptions":{"addNewBlockBelow":"Add block below","addNewBlockAbove":"Add block above","drag":"Drag","click":"Click","clickAction":"To open the menu","dragAction":"To move"},"embed":{"placeholder":"Enter a valid embed URL","insert":"Embed","addEmbed":"Add Embed"},"content":"Content","emoji":{"emojis":"Emoji","icons":"Icons","search":"Search","searchResults":"Search result","searchNoResults":"Emoji not found","remove":"Remove","emojiCategory":{"frequent":"Frequently used","people":"Emotions and people","nature":"Animals and nature","foods":"Food and drinks","activity":"Activities","places":"Travel and Places","objects":"Items","symbols":"Symbols","flags":"Flags"}},"form":{"url":"Enter a valid URL."},"noTitle":"No title","gallery":{"download":"Download","close":"Close","errorFile":"Failed to download file"},"emptyPageOptions":{"heading":"A Heading that will automatically generate an interactive table of contents","grid":"The grid will help structure the page horizontally","template":"Create from Template","list":"Numbered list, for easy outlining of the meeting","code":"Code block with syntax support","callout":"Callout for highlighting","table":"Table, to find dependencies in the data","integrations":"Many integrations from third-party services"},"comments":{"title":"Comments","edited":"edited","filter":{"resolved":"Resolved","open":"Open","all":"All","selectUsers":"Filter by users","searchPlaceholder":"Search users","emptyPlaceholder":"No users found","byStatus":"Filter by status","byPerson":"Filter by person"},"generalComment":"Add general comment","addComment":"Add a comment","replyComment":"Enter your reply","inputEditor":{"uploadFiles":"Upload files","sendMessage":"Send message","editMessage":"Edit message","clear":"Clear","clearModal":{"title":"Clear input","description":{"both":"Are you sure you want to delete the text and files?","text":"Are you sure you want to delete the text?","files":"Are you sure you want to delete the files?","empty":"Clear the input field?"}},"discardModal":{"title":"Exit without saving","description":"If you exit now, all unsaved changes will be lost.","labels":{"confirm":"Yes, exit","cancel":"Close"}},"cancelCommentModal":{"description":"If you leave now, your draft comment will be discarded and it won’t be posted."}},"notifications":{"title":"Notify me about:","description":"You will always be notified about mentions","options":{"all":"All comments","replies":"Replies"},"uploadMessages":{"tooManyFiles":"You can upload no more than 10 files!","fileTooLarge":"File(s) larger than 5MB will not be uploaded!","fileLimit":"You have reached the limit of 10 files"}},"actionTooltips":{"resolve":"Resolve","reopen":"Re-open","addReaction":"Add reaction","reactionLimit":"You’ve reached the reaction limit","reply":"Reply"},"menuActions":{"edit":"Edit","delete":"Delete","download":"Download"},"deleteModal":{"title":{"thread":"Delete Thread","general":"Delete General Discussion","comment":"Delete Reply"},"description":{"thread":"Are you sure you want to delete this thread and all its replies?","general":"Are you sure you want to delete this general discussion and all its replies?","comment":"Are you sure you want to delete this reply?"},"actions":{"cancel":"Cancel","remove":"Remove","delete":"Delete"}},"repliesToggle":{"show_one":"Show {{count}} more comment","show_other":"Show {{count}} more comments","hide":"Hide replies"},"emptyState":{"not-resolved":"No open comments","resolved":"No resolved comments","all":"No comments","userFilter":"No comments found for the selected user"}},"ai":{"placeholder":"Custom prompt","copied":"copied","copy":"copy","back":"Back","menu":{"style":{"professional":"Professional","straightforward":"Straightforward","passiveAggressive":"Passive-aggressive","friendly":"Friendly","poetic":"Poetic","passive_aggressive":"Passive aggressive","pirate":"Pirate"},"main":{"modifySelection":"Modify selection","improveWriting":"Improve writing","fixMistakes":"Fix mistakes","simplify":"Simplify","addMoreDetail":"Add more detail","generate":"Generate","summarise":"Summarise","translate":"Translate into...","changeStyle":"Change style to...","explain":"Explain"},"answer":{"replaceSelection":"Replace selection","addTextInline":"Add text inline","addBelowParagraph":"Add below paragraph","modifyFurther":"Modify further","continueWriting":"Continue writing","regenerate":"Regenerate","otherOptions":"Other options","discard":"Discard"},"languages":{"arabic":"Arabic","bengali":"Bengali","chinese":"Chinese","dutch":"Dutch","english":"English","french":"French","german":"German","hindi":"Hindi","japanese":"Japanese","korean":"Korean","nepali":"Nepali","portuguese":"Portuguese","spanish":"Spanish"}}},"actions":{"delete":"Delete","align":"Alignment"},"cancel":"Cancel"}`), Na = {
|
|
41
41
|
editor: Pa
|
|
@@ -1705,7 +1705,7 @@ const qn = {
|
|
|
1705
1705
|
// FormPlugin
|
|
1706
1706
|
select: { comment: !1, default: !0, editor: !0 }
|
|
1707
1707
|
// SelectPlugin
|
|
1708
|
-
}, pt = Rt(() => import("./layers.
|
|
1708
|
+
}, pt = Rt(() => import("./layers.8yssqxrI.js").then((t) => t.ac));
|
|
1709
1709
|
function C(t, e) {
|
|
1710
1710
|
const o = qn[t];
|
|
1711
1711
|
return o ? o[e] : !0;
|