denwa-react-shared
Version:
1,346 lines (1,345 loc) • 46 kB
JavaScript
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as ee, a as D, b as te, c as O, d as ne, et as re, f as ie, g as k, h as ae, i as oe, j as se, k as ce, l as le, m as ue, n as de, o as fe, p as A, q as pe, r as j, s as me, t as M, u as he, v as ge, w as N, x as _e, y as ve, z as ye } from "./styles.module-DO7uqbNP.js";
import { create as be } from "zustand";
import { HttpStatusCode as xe } from "axios";
import P from "dayjs";
import { Fragment as Se, jsx as F, jsxs as I } from "react/jsx-runtime";
import { useDebounce as L } from "react-use";
import { Suspense as Ce, createElement as we, forwardRef as Te, lazy as Ee, useCallback as De, useEffect as R, useImperativeHandle as Oe, useMemo as z, useState as B } from "react";
import { Button as V, Card as ke, ConfigProvider as Ae, DatePicker as je, Drawer as Me, Flex as H, Form as Ne, Image as Pe, Input as Fe, List as Ie, Modal as Le, Popover as Re, Select as ze, Skeleton as U, Spin as Be, Tooltip as W, Typography as G, Upload as Ve, theme as K } from "antd";
import q from "classnames";
import { DndContext as He, PointerSensor as Ue, useSensor as We } from "@dnd-kit/core";
import { SortableContext as Ge, arrayMove as Ke, useSortable as qe, verticalListSortingStrategy as Je } from "@dnd-kit/sortable";
import { AlignCenterOutlined as Ye, AlignLeftOutlined as Xe, AlignRightOutlined as Ze, BoldOutlined as Qe, DeleteOutlined as $e, DisconnectOutlined as et, ItalicOutlined as tt, LinkOutlined as nt, LoadingOutlined as rt, MenuOutlined as it, OrderedListOutlined as at, PictureOutlined as ot, PlusOutlined as st, UnderlineOutlined as ct, UnorderedListOutlined as lt, UploadOutlined as ut } from "@ant-design/icons";
import { CSS as dt } from "@dnd-kit/utilities";
import { FullscreenControl as ft, Map as pt, Placemark as mt, SearchControl as ht, YMaps as gt, ZoomControl as _t } from "@iminside/react-yandex-maps";
import { Editor as J, Element as vt, Range as yt, Text as bt, Transforms as Y, createEditor as xt } from "slate";
import { Editable as St, Slate as Ct, useSelected as wt, useSlate as Tt, withReact as Et } from "slate-react";
import Dt from "is-hotkey";
import { withHistory as Ot } from "slate-history";
import kt from "validator";
//#region src/entities/session/model/session.store.ts
var At = be((e, t) => ({
isLoading: !1,
isFirstLoadCompleted: !1,
currentSession: void 0,
loadSession: async ({ domain: n, ROLE_PRIORITY: r, isNotSecure: i = !1, navigate: a, refresh: o }) => {
if (t().currentSession) return;
D(E.SESSION_TEMP, n), e({ isLoading: !0 });
let s = await o();
if (s.status !== xe.Ok) {
e({
currentSession: void 0,
isLoading: !1,
isFirstLoadCompleted: !0
}), a({ to: "/login" }), D(E.SESSION, n);
return;
}
let c = s.data.data;
if (!c) {
e({
currentSession: void 0,
isLoading: !1,
isFirstLoadCompleted: !0
}), a({ to: "/login" }), D(E.SESSION, n);
return;
}
let { maxUserRolePriority: l } = le({
userRoles: c.roles,
comparedUserRoles: c.roles,
rolePriority: r
}), u = {
id: c.id,
profileId: c.profileId,
phone: c.phone,
email: c.email,
roles: c.roles,
isAllDomains: c.isAllDomains || c.isAllCities,
domains: c.domains || c.cities,
maxRolePriority: l,
tokens: {
accessToken: {
token: c.tokens?.accessToken?.token ?? "",
exp: c.tokens?.accessToken?.exp ?? 0
},
refreshToken: {
token: c.tokens?.refreshToken?.token ?? "",
exp: c.tokens?.refreshToken?.exp ?? 0
}
}
}, d = P(), f = P(c.tokens?.refreshToken?.exp ?? 0).diff(d, "seconds");
return O(E.SESSION, JSON.stringify(u), {
domain: n,
secure: !i,
"max-age": f
}), e({
currentSession: u,
isLoading: !1,
isFirstLoadCompleted: !0
}), u;
},
setCurrentSession: ({ domain: t, session: n, isRemember: r, isNotSecure: i }) => {
e({ currentSession: n });
let a = P(), o = P(n.tokens?.refreshToken?.exp ?? 0).diff(a, "seconds");
O(r ? E.SESSION : E.SESSION_TEMP, JSON.stringify(n), {
domain: t,
secure: !i,
"max-age": o
});
},
removeSession: ({ domain: t, navigate: n }) => {
e({ currentSession: void 0 }), D(E.SESSION, t), D(E.SESSION_TEMP, t), n({ to: "/login" });
}
})), jt = /* @__PURE__ */ function(e) {
return e.russian = "ru", e.english = "en", e.arabic = "ar", e;
}({}), Mt = /* @__PURE__ */ function(e) {
return e[e.January = 1] = "January", e[e.February = 2] = "February", e[e.March = 3] = "March", e[e.April = 4] = "April", e[e.May = 5] = "May", e[e.June = 6] = "June", e[e.July = 7] = "July", e[e.August = 8] = "August", e[e.September = 9] = "September", e[e.October = 10] = "October", e[e.November = 11] = "November", e[e.December = 12] = "December", e;
}({}), Nt = { container: "_container_j6rsl_1" }, Pt = ({ children: e }) => /* @__PURE__ */ F("div", {
className: Nt.container,
children: e
}), Ft = {
readOnly: "_readOnly_1qyk0_1",
noData: "_noData_1qyk0_6"
}, It = ({ configLocale: e, noDateText: t, currentValue: n, readOnly: r = !1, isTime: i = !1, ...a }) => {
if (r && !n) return /* @__PURE__ */ F(G.Text, { children: t });
let o = P(n);
return r ? /* @__PURE__ */ F(G.Text, {
className: q(Ft.readOnly, Ft.noData),
children: i ? o.format("YYYY-MM-DD, HH:mm:ss") : o.format("YYYY-MM-DD")
}) : /* @__PURE__ */ F(Ae, {
locale: e,
children: /* @__PURE__ */ F(je, {
...a,
format: i ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD",
value: n ? o : null,
readOnly: r,
showTime: i ? { defaultValue: P("00:00:00", "HH:mm:ss") } : !1
})
});
}, Lt = {
form: "_form_6uo9h_1",
buttons: "_buttons_6uo9h_5"
}, Rt = Te(({ children: e, language: t, saveText: n, translateAllText: r, translateAllTooltipText: i, submitButtonText: a, languagesData: o, submitHtmlType: s = "submit", isSubmitting: c = !1, isVisibleSubmit: l = !0, isVisibleLanguage: d = !1, isVisibleLanguageButton: f = !1, onSubmitClick: p, onChangeLang: m, onTranslateAllClick: h, ...g }, _) => {
let [v, y] = B(!1);
Oe(_, () => ({ translateComplete: () => {
setTimeout(() => y(!1), u.milliseconds.seconds1);
} }));
let b = async () => {
h && (y(!0), h());
}, x = (e) => {
p && (e.preventDefault(), p());
};
return /* @__PURE__ */ I(Ne, {
...g,
className: Lt.form,
layout: "vertical",
children: [e, /* @__PURE__ */ I("div", {
className: Lt.buttons,
children: [d && !!o?.length && /* @__PURE__ */ I(H, {
gap: "small",
vertical: !0,
children: [f && /* @__PURE__ */ F(W, {
title: i,
children: /* @__PURE__ */ F(V, {
loading: v,
onClick: b,
children: r
})
}), /* @__PURE__ */ F(ze, {
defaultValue: t,
disabled: v,
options: o,
onChange: (e) => m?.(e)
})]
}), l && /* @__PURE__ */ F(V, {
type: "primary",
htmlType: s,
disabled: v,
loading: c,
onClick: x,
children: a ?? n
})]
})]
});
}), zt = ({ fallback: e = "data:image/png;base64,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", ...t }) => /* @__PURE__ */ F(Pe, {
...t,
fallback: e
}), Bt = ({ downloadText: e }) => /* @__PURE__ */ I("button", {
style: {
border: 0,
background: "none"
},
type: "button",
children: [/* @__PURE__ */ F(st, {}), /* @__PURE__ */ F("div", {
style: { marginTop: 8 },
children: e
})]
}), X = {
uploadContainer: "_uploadContainer_lavhx_1",
card: "_card_lavhx_6",
error: "_error_lavhx_14",
disabled: "_disabled_lavhx_23",
image: "_image_lavhx_32"
}, Vt = [
{
lang: "RU",
alt: "altRU"
},
{
lang: "EN",
alt: "altEN"
},
{
lang: "AR",
alt: "altAR"
}
], Z = {
readOnly: "_readOnly_s33xc_1",
noData: "_noData_s33xc_18"
}, Ht = ({ emptyText: e, className: t, readOnly: n, value: r, ...i }) => n && !r ? /* @__PURE__ */ F(G.Text, {
className: q(Z.readOnly, Z.noData),
children: e
}) : /* @__PURE__ */ F(Fe, {
...i,
readOnly: n,
value: r,
className: q(t, { [Z.readOnly]: n })
}), Ut = ({ emptyText: e, className: t, readOnly: n, value: r, ...i }) => n && !r ? /* @__PURE__ */ F(G.Text, {
className: q(Z.readOnly, Z.noData),
children: e
}) : /* @__PURE__ */ F(Fe.Password, {
...i,
value: r,
readOnly: n,
className: q(t, { [Z.readOnly]: n })
}), Wt = ({ emptyText: e, className: t, readOnly: n, value: r, ...i }) => n && !r ? /* @__PURE__ */ F(G.Text, {
className: q(Z.readOnly, Z.noData),
children: e
}) : /* @__PURE__ */ F(Fe.TextArea, {
...i,
value: r,
readOnly: n,
className: q(t, { [Z.readOnly]: n })
}), { useToken: Gt } = K, Kt = ({ emptyText: e, labelText: t, loadingErrorText: n, file: r, language: i, errorsUid: a, actions: o, disabled: s, maxCount: c, updatedImages: l, isLoading: d, onUpdateData: f, onDeleteImage: p, onDeleteError: m }) => {
let [h, g] = B({
ru: "",
en: "",
ar: ""
}), [_, v] = B(null), [y, b] = B(!1), { remove: x } = o, { token: S } = Gt(), { attributes: C, listeners: w, setNodeRef: T, transform: E, transition: ee, isDragging: D } = qe({ id: r.uid });
L(() => {
f({
uid: r.uid,
name: r.name.split(".")[0],
altRU: h.ru,
altEN: h.en,
altAR: h.ar
});
}, u.milliseconds.milliseconds500, [h]);
let te = q(X.card, {
"is-dragging": D,
[X.error]: y,
[X.disabled]: s || c === 1
}), O = {
transform: dt.Translate.toString(E),
transition: ee,
borderColor: y ? S.colorError : void 0
};
R(() => {
f({
uid: r.uid,
name: r.name.split(".")[0]
});
}, []), R(() => {
a.includes(r.uid) ? (b(!0), f({
uid: r.uid,
name: r.name.split(".")[0],
isError: !0
})) : b(!1);
}, [r, a]), R(() => {
if (!l) return;
let e = l.find((e) => e.uid === r.uid);
e && g({
ru: e.altRU ?? "",
en: e.altEN ?? "",
ar: e.altAR ?? ""
});
}, [l]), R(() => {
(async () => {
r?.originFileObj ? v(await A(r.originFileObj)) : r.url && (g({
ru: r.altRU ?? "",
en: r.altEN ?? "",
ar: r.altAR ?? ""
}), v(r.url));
})();
}, [r.url]);
let ne = () => {
s || (x(), p(r.uid), m(r.uid));
}, re = (e, t) => {
g((n) => ({
...n,
[e.toLocaleLowerCase()]: t
}));
};
return /* @__PURE__ */ F(ke, {
ref: !y && !s && c !== 1 ? T : void 0,
className: te,
hoverable: !s,
size: "small",
loading: !_ || d,
style: O,
cover: _ ? /* @__PURE__ */ F(Pe, {
className: X.image,
height: 160,
src: _
}) : void 0,
actions: [/* @__PURE__ */ F($e, { onClick: ne }, "delete")],
...C,
...w,
children: Vt.map((r) => /* @__PURE__ */ F(Ne.Item, {
label: `${t} ${r.lang.toUpperCase()}`,
style: { display: i === r.lang.toLowerCase() ? "block" : "none" },
children: /* @__PURE__ */ F(Ht, {
emptyText: e,
disabled: y || s,
value: h[r.lang.toLowerCase()],
autoComplete: "new-password",
placeholder: y ? n : t,
onChange: (e) => re(r.lang, e.target.value)
})
}, r.alt))
});
}, qt = ({ labelText: e, loadingErrorText: t, emptyText: n, downloadText: r, serverImages: i, updatedImages: a, disabled: o = !1, maxCount: s, language: c, customRequest: l, onChange: u, onUpdateData: d, onDeleteImage: f, onImagesOrder: p, onSuccessUpload: m, onUpdateTempImage: h, ...g }) => {
let [_, v] = B([]), [y, b] = B([]);
R(() => {
if (!i?.length) return;
let e = i.map((e) => {
let t = e.url?.split("/") ?? [], n = t[t.length - 1];
return {
uid: e.uid ?? "",
name: n ?? `${Math.random()}.jpg`,
status: "done",
url: e.url ?? "",
altRU: e.altRU || "",
altEN: e.altEN || "",
altAR: e.altAR || ""
};
}).filter((e) => !!e.uid), t = e.map((e) => e.uid);
v(e), p?.(t);
}, [i]), R(() => {
if (!_?.length) return;
let e = _.map((e) => e.uid);
p?.(e);
}, [_]);
let x = We(Ue, { activationConstraint: { distance: 10 } }), S = (e) => {
let { fileList: t } = e;
v(t), u?.(e);
}, C = (e) => {
b((t) => t.filter((t) => t !== e));
}, w = ({ active: e, over: t }) => {
e.id === t?.id || o || v((n) => Ke(n, n.findIndex((t) => t.uid === e.id), n.findIndex((e) => e.uid === t?.id)));
}, T = async (e, t) => {
let { file: n, onSuccess: r, onError: i } = e, a = n, o = new FormData();
o.append("files", n);
let s = await h(o);
s.status === 201 ? (m({
tempName: s.data.data.tempFiles[0],
uid: a.uid ?? ""
}), r?.("Ok")) : (b((e) => [...e, a.uid ?? ""]), i?.(s.error)), l?.(e, t);
};
return /* @__PURE__ */ F("div", {
className: X.uploadContainer,
children: /* @__PURE__ */ F(He, {
sensors: [x],
onDragEnd: w,
children: /* @__PURE__ */ F(Ge, {
items: _.map((e) => e.uid),
children: /* @__PURE__ */ F(Ve, {
...g,
disabled: o,
maxCount: s,
customRequest: T,
accept: "image/png, image/jpeg",
listType: "picture-card",
fileList: _,
itemRender: (r, i, l, u) => /* @__PURE__ */ F(Kt, {
emptyText: n,
labelText: e,
loadingErrorText: t,
file: i,
language: c,
errorsUid: y,
actions: u,
disabled: o,
maxCount: s,
updatedImages: a,
isLoading: i.status === "uploading",
onUpdateData: d,
onDeleteImage: f,
onDeleteError: C
}),
onChange: S,
children: (!s || _?.length < s) && /* @__PURE__ */ F(Bt, { downloadText: r })
})
})
})
});
}, Jt = ({ children: e }) => {
let { token: { colorBgContainer: t, boxShadow: n, borderRadius: r } } = K.useToken();
return /* @__PURE__ */ F("div", {
style: {
padding: w.OFFSET[1],
boxShadow: n,
borderRadius: r,
background: t
},
children: e
});
}, Yt = ({ latitude: e, longitude: t, defaultLatitude: n = 55.757056, defaultLongitude: r = 37.558708, defaultZoom: i = 3, zoom: a = 10, mapHeight: o = 300, apikey: s, suggestApikey: c, disabled: l, isSearchControl: u, onPlacemarkMove: d }) => {
let [f, p] = B(void 0), [m, h] = B(e), [g, _] = B(t), { token: { colorPrimary: v } } = K.useToken();
R(() => {
h(e);
}, [e]), R(() => {
_(t);
}, [t]);
let y = (e, t) => {
e?.length < 2 || l || (h(e[0]), _(e[1]), d?.(e, t));
};
return /* @__PURE__ */ F(gt, {
query: {
apikey: s,
suggest_apikey: c
},
children: /* @__PURE__ */ I(pt, {
instanceRef: (e) => p(e),
defaultState: {
center: [n, r],
zoom: i,
controls: []
},
state: {
center: m && g ? [m, g] : [n, r],
zoom: m && g ? a : i
},
width: "100%",
height: o,
onClick: (e) => {
let t = e.get("coords"), n = f?.getZoom();
y(t, n);
},
children: [
m && g && /* @__PURE__ */ F(mt, {
geometry: [m, g],
options: {
iconColor: v,
draggable: !l
},
onDragEnd: (e) => {
let t = e.get("target").geometry.getCoordinates(), n = f?.getZoom();
y(t, n);
}
}),
/* @__PURE__ */ F(ft, {}),
/* @__PURE__ */ F(_t, {}),
u && /* @__PURE__ */ F(ht, {})
]
})
});
}, Xt = {
readOnly: "_readOnly_e6ors_1",
noData: "_noData_e6ors_19"
}, Zt = ({ value: e, emptyText: t }) => /* @__PURE__ */ F(G.Text, {
className: q(Xt.readOnly, Xt.noData),
children: e || t
}), Qt = { flex: "_flex_jguhl_2" }, $t = ({ notFoundText: e, dataName: t, value: n, placeholder: r, searchTypeDefaultValue: i, searchTypeOptions: a, style: o, searchTypeStyle: s, loading: c, disabled: l, mode: d, onSearch: f, onChange: p }) => {
let [m, h] = B([]), [g, _] = B(""), [v, y] = B(i), [b, x] = B(t);
return L(() => {
f(g, v, h);
}, u.milliseconds.milliseconds500, [g, v]), R(() => {
x(t);
}, [t]), R(() => {
if (!(!b || !n)) if (Array.isArray(n) && Array.isArray(b)) {
let e = n.map((e, t) => {
let n = b[t];
return n ? {
label: n,
value: e
} : null;
}).filter(Boolean);
h((t) => {
let n = t || [], r = e.filter((e) => !n.find((t) => t.value === e.value));
return r.length === 0 ? n : [...n, ...r];
});
} else typeof n == "string" && typeof b == "string" && h((e) => {
let t = e || [], r = t.find((e) => e.value === n);
return r && r.label === b ? t : r ? t.map((e) => e.value === n ? {
...e,
label: b
} : e) : [...t, {
label: b,
value: n
}];
});
}, [b, n]), /* @__PURE__ */ I(H, {
className: Qt.flex,
gap: "small",
children: [/* @__PURE__ */ F(ze, {
defaultValue: i,
value: v,
options: a,
style: s,
disabled: l,
onChange: (e) => {
y(e);
}
}), /* @__PURE__ */ F(ze, {
mode: d,
value: n,
placeholder: r,
defaultActiveFirstOption: !1,
suffixIcon: null,
filterOption: !1,
onSearch: (e) => _(e),
onChange: (e, t) => {
t && x(Array.isArray(t) ? t.map((e) => e.label) : t.label), p(e);
},
options: m || [],
style: o,
notFoundContent: c ? /* @__PURE__ */ F(U.Input, {
size: "small",
block: !0,
active: !0
}) : e,
showSearch: !0,
allowClear: !0,
disabled: l
})]
});
}, en = ({ children: e, spinFontSize: t = 36, ...n }) => /* @__PURE__ */ F(Be, {
...n,
indicator: /* @__PURE__ */ F(rt, { style: { fontSize: t } }),
children: e
}), tn = {
"mod+b": "bold",
"mod+i": "italic",
"mod+u": "underline",
"mod+`": "code"
}, nn = ["numbered-list", "bulleted-list"], rn = [
"left",
"center",
"right",
"justify"
], an = [
"http:",
"https:",
"mailto:",
"tel:"
], on = [
{
id: "1",
format: "title",
text: "Заголовок"
},
{
id: "2",
format: "subtitle",
text: "Подзаголовок"
},
{
id: "3",
format: "note",
text: "Примечание"
},
{
id: "4",
format: "info",
text: "Информационный блок"
}
], sn = ({ boldText: e, italicText: t, underlineText: n, numberedListText: r, bulletedListText: i, leftText: a, centerText: o, rightText: s, justifyText: c }) => [
{
id: "1",
title: e,
format: "bold",
icon: /* @__PURE__ */ F(Qe, {}),
type: "mark"
},
{
id: "2",
title: t,
format: "italic",
icon: /* @__PURE__ */ F(tt, {}),
type: "mark"
},
{
id: "3",
title: n,
format: "underline",
icon: /* @__PURE__ */ F(ct, {}),
type: "mark"
},
{
id: "4",
title: r,
format: "numbered-list",
icon: /* @__PURE__ */ F(at, {}),
type: "list"
},
{
id: "5",
title: i,
format: "bulleted-list",
icon: /* @__PURE__ */ F(lt, {}),
type: "list"
},
{
id: "6",
title: a,
format: "left",
icon: /* @__PURE__ */ F(Xe, {}),
type: "align"
},
{
id: "7",
title: o,
format: "center",
icon: /* @__PURE__ */ F(Ye, {}),
type: "align"
},
{
id: "8",
title: s,
format: "right",
icon: /* @__PURE__ */ F(Ze, {}),
type: "align"
},
{
id: "9",
title: c,
format: "justify",
icon: /* @__PURE__ */ F(it, {}),
type: "align"
}
], cn = (e, t, n = "type") => {
let { selection: r } = e;
if (!r) return "default";
let [i] = Array.from(J.nodes(e, {
at: J.unhangRange(e, r),
match: (e) => !J.isEditor(e) && vt.isElement(e) && e[n] === t
}));
return i ? "primary" : "default";
}, ln = (e, t) => {
let n = J.marks(e);
return n && n[t] === !0 ? "primary" : "default";
}, un = (e, t) => {
ln(e, t) === "primary" ? J.removeMark(e, t) : J.addMark(e, t, !0);
}, dn = (e, t) => {
let n = cn(e, t, rn.includes(t) ? "align" : "type") === "primary", r = nn.includes(t);
Y.unwrapNodes(e, {
match: (e) => !J.isEditor(e) && vt.isElement(e) && nn.includes(e.type) && !rn.includes(t),
split: !0
});
let i;
if (i = rn.includes(t) ? { align: n ? void 0 : t } : { type: n ? "paragraph" : r ? "list-item" : t }, Y.setNodes(e, i), !n && r) {
let n = {
type: t,
children: []
};
Y.wrapNodes(e, n);
}
}, fn = (e) => {
let [t] = J.nodes(e, { match: (e) => !J.isEditor(e) && vt.isElement(e) && e.type === "link" });
return !!t;
}, pn = (e) => {
Y.unwrapNodes(e, { match: (e) => !J.isEditor(e) && vt.isElement(e) && e.type === "link" });
}, mn = (e, t) => {
e.selection && hn(e, t);
}, hn = (e, t) => {
fn(e) && pn(e);
let { selection: n } = e, r = n && yt.isCollapsed(n), i = {
type: "link",
href: t,
children: r ? [{ text: t }] : []
};
r ? Y.insertNodes(e, i) : (Y.wrapNodes(e, i, { split: !0 }), Y.collapse(e, { edge: "end" }));
}, gn = (e, t, n) => {
let r = {
type: "image",
url: t,
pictureData: n,
children: [{ text: "" }]
};
Y.insertNodes(e, r), Y.insertNodes(e, {
type: "paragraph",
children: [{ text: "" }]
});
}, _n = (e) => {
if (!e || typeof e != "string") return !1;
try {
let t = new URL(e).pathname.split(".").pop()?.toLowerCase();
return !!t && [
"jpg",
"jpeg",
"png",
"gif",
"webp",
"avif",
"svg"
].includes(t);
} catch {
return !1;
}
}, vn = (e) => {
let { insertData: t, isVoid: n } = e;
return e.isVoid = (e) => e.type === "image" ? !0 : n(e), e.insertData = (n) => {
let r = n.getData("text/plain"), { files: i } = n;
if (i && i.length > 0) for (let t of i) {
let n = new FileReader(), [r] = t.type.split("/");
r === "image" && (n.addEventListener("load", () => {
let t = n.result;
gn(e, t);
}), n.readAsDataURL(t));
}
else _n(r) ? gn(e, r) : t(n);
}, e;
}, yn = (e) => {
let { insertData: t, insertText: n, isInline: r } = e;
return e.isInline = (e) => ["link"].includes(e.type) || r(e), e.insertText = (t) => {
t && k(t) ? hn(e, t) : n(t);
}, e.insertData = (n) => {
let r = n.getData("text/plain");
r && k(r) ? hn(e, r) : t(n);
}, e;
}, Q = (e) => {
let t = /["'&<>]/, n = "" + e, r = t.exec(n);
if (!r) return n;
let i, a = "", o, s = 0;
for (o = r.index; o < n.length; o++) {
switch (n.charCodeAt(o)) {
case 34:
i = """;
break;
case 38:
i = "&";
break;
case 39:
i = "'";
break;
case 60:
i = "<";
break;
case 62:
i = ">";
break;
default: continue;
}
s !== o && (a += n.substring(s, o)), s = o + 1, a += i;
}
return s === o ? a : a + n.substring(s, o);
}, bn = (e) => {
if (bt.isText(e)) {
let t = Q(e.text);
return e.bold && (t = `<strong class="content-strong">${t}</strong>`), e.italic && (t = `<em class="content-italic">${t}</em>`), e.underline && (t = `<u class="content-underline">${t}</u>`), t;
}
let t = e.children.map((e) => bn(e)).join(""), n = e.align ? `text-align: ${e.align}` : "";
switch (e.type) {
case "title": return `<h2 class="content-title"${n ? ` style="${n}"` : ""}>${t}</h2>`;
case "subtitle": return `<h3 class="content-subtitle"${n ? ` style="${n}"` : ""}>${t}</h3>`;
case "note": return `<p class="content-note"${n ? ` style="${n}"` : ""}>${t}</p>`;
case "info": return `<p class="content-info"${n ? ` style="${n}"` : ""}>${t}</p>`;
case "paragraph": return `<p class="content-paragraph" ${n ? ` style="${n}"` : ""}>${t}</p>`;
case "bulleted-list": return `<ul class="content-bulleted-list"${n ? ` style="${n}"` : ""}>${t}</ul>`;
case "numbered-list": return `<ol class="content-numbered-list"${n ? ` style="${n}"` : ""}>${t}</ol>`;
case "list-item": return `<li class="content-list-item" ${n ? ` style="${n}"` : ""}>${t}</li>`;
case "link": return `<a class="content-link" href="${Q(e.href ?? "")}">${t}</a>`;
case "image": {
if (e.pictureData) {
let t = e.pictureData, n = Q(e.alt ?? ""), r = [];
return t.mobileImage1xAvif && r.push(`<source srcset="${Q(t.mobileImage1xAvif)} 1x${t.mobileImage2xAvif ? `, ${Q(t.mobileImage2xAvif)} 2x` : ""}" media="(max-width: 450px)" type="image/avif" />`), t.mobileImage1xWebp && r.push(`<source srcset="${Q(t.mobileImage1xWebp)} 1x${t.mobileImage2xWebp ? `, ${Q(t.mobileImage2xWebp)} 2x` : ""}" media="(max-width: 450px)" type="image/webp" />`), t.mobileImage1x && r.push(`<source srcset="${Q(t.mobileImage1x)} 1x${t.mobileImage2x ? `, ${Q(t.mobileImage2x)} 2x` : ""}" media="(max-width: 450px)" />`), t.image1xAvif && r.push(`<source srcset="${Q(t.image1xAvif)} 1x${t.image2xAvif ? `, ${Q(t.image2xAvif)} 2x` : ""}" type="image/avif" />`), t.image1xWebp && r.push(`<source srcset="${Q(t.image1xWebp)} 1x${t.image2xWebp ? `, ${Q(t.image2xWebp)} 2x` : ""}" type="image/webp" />`), t.image1x && r.push(`<source srcset="${Q(t.image1x)} 1x${t.image2x ? `, ${Q(t.image2x)} 2x` : ""}" />`), `<picture class="content-image">${r.join("")}<img class="content-image" src="${Q(t.image1x ?? "")}" alt="${n}" loading="lazy" /></picture>`;
}
let t = Q(e.alt ?? "");
return `<img class="content-image" src="${Q(e.url ?? "")}" alt="${t}" />`;
}
default: return t;
}
}, xn = (e) => {
let t = [{
type: "paragraph",
children: [{ text: "" }]
}];
if (!e) return t;
if (typeof e == "string") try {
return xn(JSON.parse(e));
} catch {
return t;
}
if (Array.isArray(e)) return e.every((e) => e && typeof e == "object" && ("type" in e && "children" in e || "text" in e)) ? e : t;
if (typeof e == "object" && e) {
if ("children" in e && Array.isArray(e.children)) {
let t = e.children;
if (t.every((e) => e && typeof e == "object" && ("type" in e && "children" in e || "text" in e))) return t;
}
if ("type" in e && "children" in e && Array.isArray(e.children)) return [e];
}
return t;
}, Sn = () => /* @__PURE__ */ F("span", {
contentEditable: !1,
style: { fontSize: 0 },
children: String.fromCodePoint(160)
}), Cn = ({ attributes: e, children: t, element: n }) => {
let r = wt(), { token: { colorLink: i, colorLinkHover: a } } = K.useToken(), o = z(() => {
let e = null;
try {
e = new URL(n.href);
} catch (e) {
console.log(e);
}
return e && an.includes(e.protocol) ? e.href : "about:blank";
}, [n.href]);
return /* @__PURE__ */ F(Re, {
title: "URL",
content: o,
children: /* @__PURE__ */ I("a", {
...e,
href: o,
style: { color: r ? a : i },
children: [
/* @__PURE__ */ F(Sn, {}),
t,
/* @__PURE__ */ F(Sn, {})
]
})
});
}, wn = ({ attributes: e, children: t, element: n }) => {
let r = { textAlign: n.align };
switch (n.type) {
case "bulleted-list": return /* @__PURE__ */ F("ul", {
className: "content-bulleted-list",
style: r,
...e,
children: t
});
case "title": return /* @__PURE__ */ F("h2", {
className: "content-title",
style: r,
...e,
children: t
});
case "subtitle": return /* @__PURE__ */ F("h3", {
className: "content-subtitle",
style: r,
...e,
children: t
});
case "list-item": return /* @__PURE__ */ F("li", {
style: r,
...e,
children: t
});
case "numbered-list": return /* @__PURE__ */ F("ol", {
className: "content-numbered-list",
style: r,
...e,
children: t
});
case "note": return /* @__PURE__ */ F("p", {
className: "content-note",
style: r,
...e,
children: t
});
case "info": return /* @__PURE__ */ F("p", {
className: "content-info",
style: r,
...e,
children: t
});
case "link": return /* @__PURE__ */ F(Cn, {
attributes: e,
children: t,
element: n
});
case "image":
if (n.pictureData) {
let r = n.pictureData;
return /* @__PURE__ */ I("div", {
...e,
contentEditable: !1,
children: [/* @__PURE__ */ I("picture", {
className: "content-image",
children: [
r.mobileImage1xAvif && /* @__PURE__ */ F("source", {
srcSet: `${r.mobileImage1xAvif} 1x${r.mobileImage2xAvif ? `, ${r.mobileImage2xAvif} 2x` : ""}`,
media: "(max-width: 450px)",
type: "image/avif"
}),
r.mobileImage1xWebp && /* @__PURE__ */ F("source", {
srcSet: `${r.mobileImage1xWebp} 1x${r.mobileImage2xWebp ? `, ${r.mobileImage2xWebp} 2x` : ""}`,
media: "(max-width: 450px)",
type: "image/webp"
}),
r.mobileImage1x && /* @__PURE__ */ F("source", {
srcSet: `${r.mobileImage1x} 1x${r.mobileImage2x ? `, ${r.mobileImage2x} 2x` : ""}`,
media: "(max-width: 450px)"
}),
r.image1xAvif && /* @__PURE__ */ F("source", {
srcSet: `${r.image1xAvif} 1x${r.image2xAvif ? `, ${r.image2xAvif} 2x` : ""}`,
type: "image/avif"
}),
r.image1xWebp && /* @__PURE__ */ F("source", {
srcSet: `${r.image1xWebp} 1x${r.image2xWebp ? `, ${r.image2xWebp} 2x` : ""}`,
type: "image/webp"
}),
r.image1x && /* @__PURE__ */ F("source", { srcSet: `${r.image1x} 1x${r.image2x ? `, ${r.image2x} 2x` : ""}` }),
/* @__PURE__ */ F("img", {
className: "content-image",
src: r.image1x,
alt: n.alt ?? "",
loading: "lazy",
style: { maxWidth: "100%" }
})
]
}), t]
});
}
return /* @__PURE__ */ I("div", {
...e,
contentEditable: !1,
children: [/* @__PURE__ */ F("img", {
className: "content-image",
src: n.url,
alt: n.alt ?? "",
style: { maxWidth: "100%" }
}), t]
});
default: return /* @__PURE__ */ F("p", {
style: r,
...e,
children: t
});
}
}, Tn = ({ attributes: e, children: t, leaf: n }) => (n.bold && (t = /* @__PURE__ */ F("strong", { children: t })), n.italic && (t = /* @__PURE__ */ F("em", { children: t })), n.underline && (t = /* @__PURE__ */ F("u", { children: t })), /* @__PURE__ */ F("span", {
...e,
children: t
})), En = ({ tooltipText: e, linkErrorText: t, onErrorMessage: n }) => {
let [r, i] = B(!1), [a, o] = B(""), s = Tt(), c = () => {
i((e) => !e);
};
return /* @__PURE__ */ I(Se, { children: [/* @__PURE__ */ F(W, {
title: e,
children: /* @__PURE__ */ F(V, {
icon: /* @__PURE__ */ F(nt, {}),
onClick: c
})
}), /* @__PURE__ */ F(Le, {
title: e,
open: r,
destroyOnHidden: !0,
onOk: () => {
let e = "";
if (kt.isEmail(a)) e += `mailto:${a}`;
else if (kt.isMobilePhone(a)) e += `tel:${a}`;
else if (kt.isURL(a, {
protocols: ["http", "https"],
require_protocol: !0
})) e += a;
else {
n(t);
return;
}
mn(s, e), o(""), c();
},
onCancel: () => {
c(), o("");
},
children: /* @__PURE__ */ F(Fe, {
placeholder: "https://site.ru | test@mail.ru | +79881234567",
value: a,
onChange: (e) => {
o(e.target.value);
}
})
})] });
}, Dn = ({ tooltipText: e }) => {
let t = Tt();
return /* @__PURE__ */ F(W, {
title: e,
children: /* @__PURE__ */ F(V, {
icon: /* @__PURE__ */ F(et, {}),
onClick: () => {
fn(t) && pn(t);
}
})
});
}, On = ({ boldText: e, italicText: t, underlineText: n, numberedListText: r, bulletedListText: i, leftText: a, centerText: o, rightText: s, justifyText: c, linkErrorText: l, linkButtonTooltipText: u, removeLinkTooltipText: d, imageButtonTooltipText: f, onErrorMessage: p, onUploadImage: m }) => {
let h = Tt(), g = sn({
boldText: e,
italicText: t,
underlineText: n,
numberedListText: r,
bulletedListText: i,
leftText: a,
centerText: o,
rightText: s,
justifyText: c
}), _ = async (e) => {
if (!(!m || !e)) try {
let t = await m(e);
t && gn(h, t.url, t.pictureData);
} catch (e) {
p(e instanceof Error ? e.message : "Image upload failed");
}
};
return /* @__PURE__ */ I(H, {
gap: "small",
wrap: !0,
children: [/* @__PURE__ */ F(H, {
gap: "small",
wrap: !0,
children: on.map((e) => /* @__PURE__ */ F(V, {
type: cn(h, e.format, "type"),
onClick: () => dn(h, e.format),
children: e.text
}, e.id))
}), /* @__PURE__ */ I(H, {
gap: "small",
wrap: !0,
children: [
g.map((e) => {
let t, n;
return e.type === "mark" ? (t = ln(h, e.format), n = () => un(h, e.format)) : (t = cn(h, e.format, e.type === "list" ? "type" : "align"), n = () => dn(h, e.format)), /* @__PURE__ */ F(W, {
title: e.title,
children: /* @__PURE__ */ F(V, {
type: t,
icon: e.icon,
onClick: n
})
}, e.id);
}),
m && /* @__PURE__ */ F(W, {
title: f ?? "Image",
children: /* @__PURE__ */ F(V, {
icon: /* @__PURE__ */ F(ot, {}),
onClick: () => {
let e = document.createElement("input");
e.type = "file", e.accept = "image/png, image/jpeg, image/webp, image/avif", e.style.display = "none", e.addEventListener("change", () => {
let t = e.files?.[0];
t && _(t);
}), document.body.appendChild(e), e.click(), document.body.removeChild(e);
}
})
}),
/* @__PURE__ */ F(En, {
tooltipText: u,
linkErrorText: l,
onErrorMessage: p
}),
/* @__PURE__ */ F(Dn, { tooltipText: d })
]
})]
});
}, kn = { editable: "_editable_136f6_1" }, $ = [{
type: "paragraph",
children: [{ text: "" }]
}], { useToken: An } = K, jn = Te(({ boldText: e, italicText: t, underlineText: n, numberedListText: r, bulletedListText: i, leftText: a, centerText: o, rightText: s, justifyText: c, linkErrorText: l, linkButtonTooltipText: d, removeLinkTooltipText: f, imageButtonTooltipText: p, language: m, readOnly: h = !1, onSetContent: g, onSetHtml: _, onErrorMessage: v, onUploadImage: y }, b) => {
let [x, S] = B($), C = z(() => vn(yn(Ot(Et(xt())))), []), { token: w } = An(), [,] = L(() => {
let e = JSON.stringify(x), t = x.map((e) => bn(e)).join("");
g(e, m), _(t, m);
}, u.seconds.seconds1, [x]);
Oe(b, () => ({
resetData: () => {
S($), C.children = $, Y.deselect(C);
},
setValue: (e) => {
try {
let t = xn(JSON.parse(e));
S(t), C.children = t, Y.deselect(C), C.selection = null, C.operations = [], setTimeout(() => {
Y.select(C, {
anchor: J.start(C, [0]),
focus: J.start(C, [0])
});
}, 0);
} catch (e) {
console.error("Error parsing slate value:", e), S($), C.children = $, Y.deselect(C);
}
}
}));
let T = De((e) => /* @__PURE__ */ F(wn, { ...e }), []), E = De((e) => /* @__PURE__ */ F(Tn, { ...e }), []);
return /* @__PURE__ */ F(Ct, {
editor: C,
initialValue: x,
onChange: (e) => {
S(e);
},
children: /* @__PURE__ */ I(H, {
gap: "small",
vertical: !0,
children: [!h && /* @__PURE__ */ F(On, {
boldText: e,
italicText: t,
underlineText: n,
numberedListText: r,
bulletedListText: i,
leftText: a,
centerText: o,
rightText: s,
justifyText: c,
linkErrorText: l,
linkButtonTooltipText: d,
removeLinkTooltipText: f,
imageButtonTooltipText: p,
onErrorMessage: v,
onUploadImage: y
}), /* @__PURE__ */ F(St, {
className: kn.editable,
style: {
padding: w.padding,
border: `1px solid ${w.colorBorder}`,
borderRadius: `${w.borderRadius}px`
},
spellCheck: !0,
readOnly: h,
renderElement: T,
renderLeaf: E,
onKeyDown: (e) => {
for (let t in tn) if (Dt(t, e)) {
e.preventDefault();
let n = tn[t];
un(C, n);
}
}
})]
})
});
}), Mn = () => /* @__PURE__ */ I("div", {
className: M.tableHeadSkeleton,
style: { marginBottom: w.OFFSET[1] },
children: [/* @__PURE__ */ I(H, {
align: "center",
gap: "middle",
wrap: "wrap",
children: [/* @__PURE__ */ F("div", {
className: M.skeletonHead1,
children: /* @__PURE__ */ F(U.Button, {
active: !0,
block: !0
})
}), /* @__PURE__ */ F("div", {
className: M.skeletonHead2,
children: /* @__PURE__ */ F(U.Button, {
active: !0,
block: !0
})
})]
}), /* @__PURE__ */ I(H, {
className: q(M.buttonsContainer, M.skeletonButtonsContainer),
gap: "small",
children: [/* @__PURE__ */ F("div", {
className: M.skeletonHead3,
children: /* @__PURE__ */ F(U.Button, {
active: !0,
block: !0
})
}), /* @__PURE__ */ F("div", {
className: M.skeletonHead4,
children: /* @__PURE__ */ F(U.Button, {
active: !0,
block: !0
})
})]
})]
}), Nn = Ee(() => import("./table-head-CJK4H4s8.js").then(({ TableHead: e }) => ({ default: e }))), Pn = Ee(() => import("./base-table-C__iDbuG.js").then(({ BaseTable: e }) => ({ default: e }))), Fn = ({ drawerContent: e, sortTooltipText: t, updateDataText: n, refreshText: r, createText: i, createNewElementText: a, viewText: o, actionsText: s, editText: c, tableData: l, columns: u, order: d, orderOptions: f, searchProps: p, serverPagination: m, fetchedDataLoading: h, createButtonTooltip: g, readAction: _, createAction: v, updateAction: y, deleteText: b, deletedText: x, cancelText: S, deleteErrorText: C, drawerTitle: w, closeModalTitleText: T, closeModalContentText: E, closeModalOkText: ee, closeModalCancelText: D, drawerSize: te = "default", modalTitle: O, scrollWidth: ne, isCanRead: re, isCanCreate: ie, isCanUpdate: k, isCanDelete: ae, isExpandable: oe, isHiddenCreate: se, isHiddenUpdate: ce, isFixedActions: le, configProviderProps: ue, onGetError: de, onChangeOrder: fe, onRefetch: A, onSetPaginate: pe, onDelete: j, onShowSizeChange: me, onSuccessMessage: M, onErrorMessage: he }) => {
let [ge, N] = B(!1), [_e, ve] = B(!1), [ye, be] = B(!1), [xe, P] = B(_), [Se, L] = B(""), Te = (e) => {
L(e), N(!0), P(_);
}, Ee = (e) => {
L(e);
}, De = () => {
N(!0), P(v), L("");
}, R = () => {
N(!0), P(y);
}, Oe = () => {
ve((e) => !e);
}, z = () => {
N(!1);
}, V = () => {
if (xe === _) {
z();
return;
}
be((e) => !e);
}, ke = async () => {
try {
await j?.(Se), M(x);
} catch (e) {
de({ error: e }), he(C);
}
ve(!1);
}, je = (e) => {
e.current && (pe(e.current, e.pageSize ?? 10), A());
}, H = (e) => {
P(e);
};
return /* @__PURE__ */ I(Ae, {
...ue,
children: [
/* @__PURE__ */ F(Ce, {
fallback: /* @__PURE__ */ F(Mn, {}),
children: /* @__PURE__ */ F(Nn, {
sortTooltipText: t,
updateDataText: n,
refreshText: r,
createText: i,
createNewElementText: a,
order: d,
orderOptions: f,
searchProps: p,
createButtonTooltip: g,
isCanCreate: ie,
isHiddenCreate: se,
onCreate: De,
onChangeOrder: fe,
onRefetch: A
})
}),
/* @__PURE__ */ F(Jt, { children: /* @__PURE__ */ F(Ce, {
fallback: /* @__PURE__ */ F("div", {
style: { height: "70vh" },
children: /* @__PURE__ */ F(U, { active: !0 })
}),
children: /* @__PURE__ */ F(Pn, {
viewText: o,
actionsText: s,
editText: c,
deleteText: b,
dataSource: l,
columns: u,
serverPagination: m,
loading: h,
isHiddenUpdate: ce,
isCanRead: re,
isCanUpdate: k,
isCanDelete: ae,
isFixedActions: le,
scroll: { x: ne },
expandable: oe ? { expandedRowRender: (e) => {
if (Array.isArray(e.list)) return /* @__PURE__ */ F(Ie, {
bordered: !0,
dataSource: e.list,
renderItem: (e) => /* @__PURE__ */ F(Ie.Item, { children: /* @__PURE__ */ F(G.Text, { children: e.text }) })
});
} } : void 0,
onView: Te,
onDropdownClick: Ee,
onEdit: R,
onDelete: j ? Oe : void 0,
onChange: je,
onShowSizeChange: me
})
}) }),
/* @__PURE__ */ F(Me, {
title: w,
open: ge,
size: te,
destroyOnHidden: !0,
onClose: V,
children: we(e, {
id: Se,
action: xe,
onClose: z,
onRefetch: A,
onChangeActionValue: H
})
}),
/* @__PURE__ */ F(Le, {
title: T,
open: ye,
okText: ee,
cancelText: D,
destroyOnHidden: !0,
onOk: () => {
z(), V();
},
onCancel: V,
children: E
}),
j && /* @__PURE__ */ F(Le, {
title: O,
open: _e,
okText: b,
cancelText: S,
okButtonProps: { danger: !0 },
onOk: ke,
onCancel: Oe
})
]
});
}, In = ({ originNode: e, file: t }) => {
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging: s } = qe({ id: t.uid });
return /* @__PURE__ */ F("div", {
ref: i,
style: {
transform: dt.Translate.toString(a),
transition: o,
cursor: "move"
},
className: s ? "is-dragging" : "",
...n,
...r,
children: t.status === "error" && s ? e.props.children : e
});
}, Ln = ({ text: e, serverFiles: t, onOrder: n, onChange: r, onUpdateTemp: i, customRequest: a, onSuccessUpload: o, ...s }) => {
let [c, l] = B([]), u = We(Ue, { activationConstraint: { distance: 10 } });
R(() => {
c?.length && n(c.map((e) => e.uid));
}, [c]), R(() => {
if (!t?.length) {
l([]), n([]);
return;
}
let e = t.map((e) => {
let t = e.url?.split("/") ?? [], n = t[t.length - 1];
return {
uid: e.uid ?? "",
name: n ?? `${Math.random()}.jpg`,
status: "done",
url: e.url ?? ""
};
}).filter((e) => !!e.uid), r = e.map((e) => e.uid);
l(e), n(r);
}, [t]);
let d = ({ active: e, over: t }) => {
e.id !== t?.id && l((n) => Ke(n, n.findIndex((t) => t.uid === e.id), n.findIndex((e) => e.uid === t?.id)));
}, f = (e) => {
let { fileList: t } = e;
l(t), r?.(e);
}, p = async (e, t) => {
let { file: n, onSuccess: r, onError: s } = e, c = n, l = new FormData();
l.append("files", n);
let u = await i(l);
u.status === 201 ? (o({
tempName: u.data.data.tempFiles[0],
uid: c.uid ?? ""
}), r?.("Ok")) : s?.(u.error), a?.(e, t);
};
return /* @__PURE__ */ F(He, {
sensors: [u],
onDragEnd: d,
children: /* @__PURE__ */ F(Ge, {
items: c.map((e) => e.uid),
strategy: Je,
children: /* @__PURE__ */ F(Ve, {
...s,
fileList: c,
itemRender: (e, t) => /* @__PURE__ */ F(In, {
originNode: e,
file: t
}),
customRequest: p,
onChange: f,
children: /* @__PURE__ */ F(V, {
icon: /* @__PURE__ */ F(ut, {}),
children: e
})
})
})
});
};
//#endregion
export { Fn as AdminTable, It as BaseDatePicker, Rt as BaseDrawerForm, Ln as BaseFileUpload, zt as BaseImage, qt as BaseImageUpload, Ht as BaseInput, de as BaseInputNumber, Yt as BaseMaterialMap, Ut as BasePasswordInput, Zt as BaseReadonlyInput, $t as BaseSearchInput, en as BaseSpin, Wt as BaseTextAreaInput, jn as BaseTextEditor, E as COOKIE, Pt as Container, _ as LOCAL_STORAGE, jt as Languages, Jt as LayoutCard, Mt as MonthsNumber, j as OpenApiAxios, e as ProviderComposer, w as THEME, u as TIME, T as VALIDATION_VALUE, b as checkCorrectFileObject, a as checkCorrectImageObject, le as compareRolesPriority, he as convertPhoneMask, ne as createProfileLabel, ie as createUploadImagesStore, D as deleteCookie, Q as escapeHtml, A as fileToBase64, ue as formatPhoneToInternational, ae as formatPhoneToNumber, fe as getCookie, i as getImagePrefix, me as getTokenInCookie, h as getUploadFileUrl, ce as getUploadImageUrl, gn as insertImage, mn as insertLink, cn as isBlockActive, _n as isImageUrl, fn as isLinkActive, ln as isMarkActive, k as isUrl, oe as mergeObjectArrays, xn as normalizeSlateData, ee as objectArrayToOptions, ge as onFilterSelectOptionsByLabel, ve as prepareFilesToSubmit, te as prepareImagesToSubmit, t as prepareServerFiles, se as prepareServerImages, re as provider, m as responseSchema, S as searchRadioDefaultValue, bn as serializeToHtml, g as serverFileSchema, o as serverImageSchema, l as sessionCookieSchema, O as setCookie, p as sortFilesArrayByReference, dn as toggleBlock, un as toggleMark, _e as translateContent, y as translateContentToLanguages, r as translateField, N as translateImagesAlt, pn as unwrapLink, f as uploadFilesSchema, v as uploadImageSchema, ye as uploadTempSchema, c as useExtraMediumViewPort, n as useFetchTableData, x as useLaptopBigViewPort, C as useLaptopViewPort, s as useMobileViewPort, At as useSession, d as useSmallViewPort, pe as useTabletViewPort, vn as withImages, yn as withInlines, hn as wrapLink };