@baishuyun/ui-mobile 0.8.0 → 0.9.1

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.
Files changed (54) hide show
  1. package/dist/AMap/{AMap-BwIa29WQ.js → AMap-B1GiEoPE.js} +2 -2
  2. package/dist/AMap/index.js +4 -4
  3. package/dist/ActionSheet/{ActionSheet-8cPpwho3.js → ActionSheet-DVck9uyS.js} +3 -3
  4. package/dist/ActionSheet/index.js +6 -6
  5. package/dist/Calendar/{Calendar-B9IuDHRd.js → Calendar-B1TwDL1q.js} +2 -2
  6. package/dist/Calendar/index.js +4 -4
  7. package/dist/ConfigProvider/{ConfigProvider-CCXPxdJt.js → ConfigProvider-xyGx046s.js} +114 -2
  8. package/dist/ConfigProvider/index.js +4 -4
  9. package/dist/ConfigProvider/{useLocale-D12uIZ9q.js → useLocale-Bf81I-9U.js} +56 -0
  10. package/dist/Editor/Editor-COxP3RpF.js +2059 -0
  11. package/dist/Editor/index.js +8 -0
  12. package/dist/Gantt/{Gantt-fRNTYViS.js → Gantt-CbHw9RMw.js} +3 -3
  13. package/dist/Gantt/index.js +8 -8
  14. package/dist/Icon/{Icon-OUPXAIEn.js → Icon-D3xi1oyo.js} +1 -1
  15. package/dist/Icon/index.js +2 -2
  16. package/dist/Overlay/index.js +2 -2
  17. package/dist/Popup/{Popup-C1uwPnxj.js → Popup-BIIDAUmB.js} +2 -2
  18. package/dist/Popup/index.js +4 -4
  19. package/dist/components/Editor/Editor.d.ts +6 -0
  20. package/dist/components/Editor/EditorCore.d.ts +3 -0
  21. package/dist/components/Editor/EditorHtml.d.ts +3 -0
  22. package/dist/components/Editor/Thinking.d.ts +22 -0
  23. package/dist/components/Editor/constants.d.ts +57 -0
  24. package/dist/components/Editor/index.d.ts +3 -0
  25. package/dist/components/Editor/interface.d.ts +59 -0
  26. package/dist/components/Editor/nodes/ExtendedTextNode.d.ts +9 -0
  27. package/dist/components/Editor/nodes/ImageNode.d.ts +48 -0
  28. package/dist/components/Editor/plugins/HeadingPlugin.d.ts +2 -0
  29. package/dist/components/Editor/plugins/LinkColorPlugin.d.ts +2 -0
  30. package/dist/components/Editor/plugins/PasteStripImagePlugin.d.ts +2 -0
  31. package/dist/components/Editor/sheets.d.ts +43 -0
  32. package/dist/components/Editor/toolbar/Toolbar.d.ts +10 -0
  33. package/dist/components/Editor/toolbar/ToolbarColorGlyph.d.ts +8 -0
  34. package/dist/components/Editor/toolbar/useTextFormats.d.ts +16 -0
  35. package/dist/components/Editor/utils/applyAiPolish.d.ts +5 -0
  36. package/dist/components/Editor/utils/fillRootFromHtml.d.ts +2 -0
  37. package/dist/components/Editor/utils/isAcceptedImageType.d.ts +5 -0
  38. package/dist/components/Editor/utils/isEmptyEditorHtml.d.ts +1 -0
  39. package/dist/components/Editor/utils/readEditorAiSnapshot.d.ts +8 -0
  40. package/dist/components/Editor/utils/sanitizeEditorHtml.d.ts +1 -0
  41. package/dist/components/Editor/utils/stripInlineStyleProperty.d.ts +1 -0
  42. package/dist/components/Editor/utils/toPortableEditorHtml.d.ts +1 -0
  43. package/dist/components/Editor/utils/unwrapTypesetFence.d.ts +6 -0
  44. package/dist/components/index.d.ts +2 -0
  45. package/dist/index.js +13 -12
  46. package/dist/locale/lang/en-US.json.d.ts +56 -0
  47. package/dist/locale/lang/zh-CN.json.d.ts +56 -0
  48. package/dist/locale/lang/zh-TW.json.d.ts +56 -0
  49. package/dist/style.css +1 -1
  50. package/dist/vendors/{version-DdP63VFD.js → version-CegBK2kS.js} +1 -1
  51. package/dist/vite-env.d.ts +5 -0
  52. package/package.json +12 -3
  53. /package/dist/Calendar/{cssVars-E8Cq0tta.js → cssVars-DNOooryc.js} +0 -0
  54. /package/dist/Overlay/{Overlay-YzAfhILA.js → Overlay-CqQWOqO4.js} +0 -0
@@ -0,0 +1,2059 @@
1
+ import { t as e } from "../Popup/Popup-BIIDAUmB.js";
2
+ import { t } from "../ActionSheet/ActionSheet-DVck9uyS.js";
3
+ import { t as n } from "../Icon/Icon-D3xi1oyo.js";
4
+ import { t as r } from "../ConfigProvider/useLocale-Bf81I-9U.js";
5
+ import { createContext as i, useCallback as a, useContext as o, useEffect as s, useId as c, useLayoutEffect as l, useRef as u, useState as d } from "react";
6
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
7
+ import { useEventListener as h } from "ahooks";
8
+ import { LexicalComposer as g } from "@lexical/react/LexicalComposer";
9
+ import { $createLinkNode as _, $isLinkNode as v, $toggleLink as y, AutoLinkNode as b, LinkNode as x } from "@lexical/link";
10
+ import { $isListItemNode as S, $isListNode as ee, INSERT_ORDERED_LIST_COMMAND as C, INSERT_UNORDERED_LIST_COMMAND as w, ListItemNode as T, ListNode as te, REMOVE_LIST_COMMAND as E } from "@lexical/list";
11
+ import { $createHeadingNode as ne, $isHeadingNode as D, HeadingNode as O } from "@lexical/rich-text";
12
+ import { $applyNodeReplacement as re, $createParagraphNode as k, $createTextNode as ie, $getNodeByKey as ae, $getRoot as A, $getSelection as j, $insertNodes as oe, $isElementNode as se, $isRangeSelection as M, $isRootOrShadowRoot as N, $isTextNode as ce, $nodesOfType as le, $setSelection as ue, COMMAND_PRIORITY_HIGH as de, DROP_COMMAND as fe, DecoratorNode as pe, FORMAT_ELEMENT_COMMAND as P, FORMAT_TEXT_COMMAND as F, INDENT_CONTENT_COMMAND as I, OUTDENT_CONTENT_COMMAND as me, PASTE_COMMAND as he, PASTE_TAG as ge, TextNode as L } from "lexical";
13
+ import { $generateHtmlFromNodes as _e, $generateNodesFromDOM as R } from "@lexical/html";
14
+ import { ContentEditable as ve } from "@lexical/react/LexicalContentEditable";
15
+ import { HistoryPlugin as ye } from "@lexical/react/LexicalHistoryPlugin";
16
+ import { LinkPlugin as be } from "@lexical/react/LexicalLinkPlugin";
17
+ import { ListPlugin as xe } from "@lexical/react/LexicalListPlugin";
18
+ import { OnChangePlugin as Se } from "@lexical/react/LexicalOnChangePlugin";
19
+ import { RichTextPlugin as Ce } from "@lexical/react/LexicalRichTextPlugin";
20
+ import { LexicalErrorBoundary as we } from "@lexical/react/LexicalErrorBoundary";
21
+ import { useLexicalComposerContext as z } from "@lexical/react/LexicalComposerContext";
22
+ import { $findMatchingParent as B, mergeRegister as Te } from "@lexical/utils";
23
+ import { $getSelectionStyleValueForProperty as Ee, $patchStyleText as V, $setBlocksType as De } from "@lexical/selection";
24
+ import Oe from "dompurify";
25
+ //#region src/components/Editor/editor.module.scss
26
+ var H = {
27
+ "bsy-mobile-editor": "_bsy-mobile-editor_1g2i4_1",
28
+ "bsy-mobile-editor__label": "_bsy-mobile-editor__label_1g2i4_14",
29
+ "bsy-mobile-editor__label-text": "_bsy-mobile-editor__label-text_1g2i4_19",
30
+ "bsy-mobile-editor__header": "_bsy-mobile-editor__header_1g2i4_28",
31
+ "bsy-mobile-editor__title": "_bsy-mobile-editor__title_1g2i4_38",
32
+ "bsy-mobile-editor__close": "_bsy-mobile-editor__close_1g2i4_48",
33
+ "bsy-mobile-editor__content": "_bsy-mobile-editor__content_1g2i4_62",
34
+ "bsy-mobile-editor__editable": "_bsy-mobile-editor__editable_1g2i4_72",
35
+ "bsy-mobile-editor__image-shell": "_bsy-mobile-editor__image-shell_1g2i4_163",
36
+ "bsy-mobile-editor__image": "_bsy-mobile-editor__image_1g2i4_163",
37
+ "bsy-mobile-editor__image-mask": "_bsy-mobile-editor__image-mask_1g2i4_185",
38
+ "bsy-mobile-editor__image-progress": "_bsy-mobile-editor__image-progress_1g2i4_194",
39
+ "bsy-mobile-editor__image-progress--spin": "_bsy-mobile-editor__image-progress--spin_1g2i4_197",
40
+ "bsy-mobile-editor-progress-spin": "_bsy-mobile-editor-progress-spin_1g2i4_1",
41
+ "bsy-mobile-editor__toolbar": "_bsy-mobile-editor__toolbar_1g2i4_200",
42
+ "bsy-mobile-editor__toolbar-scroller": "_bsy-mobile-editor__toolbar-scroller_1g2i4_215",
43
+ "bsy-mobile-editor__toolbar-track": "_bsy-mobile-editor__toolbar-track_1g2i4_232",
44
+ "bsy-mobile-editor__toolbar-thumb": "_bsy-mobile-editor__toolbar-thumb_1g2i4_244",
45
+ "bsy-mobile-editor__toolbar-group": "_bsy-mobile-editor__toolbar-group_1g2i4_249",
46
+ "bsy-mobile-editor__toolbar-divider": "_bsy-mobile-editor__toolbar-divider_1g2i4_255",
47
+ "bsy-mobile-editor__tool": "_bsy-mobile-editor__tool_1g2i4_200",
48
+ "bsy-mobile-editor__tool--active": "_bsy-mobile-editor__tool--active_1g2i4_276",
49
+ "bsy-mobile-editor__tool--select": "_bsy-mobile-editor__tool--select_1g2i4_283",
50
+ "bsy-mobile-editor__tool--select-align": "_bsy-mobile-editor__tool--select-align_1g2i4_288",
51
+ "bsy-mobile-editor__tool-caret": "_bsy-mobile-editor__tool-caret_1g2i4_291",
52
+ "bsy-mobile-editor__tool-caret--open": "_bsy-mobile-editor__tool-caret--open_1g2i4_294",
53
+ "bsy-mobile-editor__ai-icon": "_bsy-mobile-editor__ai-icon_1g2i4_297",
54
+ "bsy-mobile-editor__tool-text": "_bsy-mobile-editor__tool-text_1g2i4_302",
55
+ "bsy-mobile-editor__swatches": "_bsy-mobile-editor__swatches_1g2i4_307",
56
+ "bsy-mobile-editor__swatch": "_bsy-mobile-editor__swatch_1g2i4_307",
57
+ "bsy-mobile-editor__sheet": "_bsy-mobile-editor__sheet_1g2i4_323",
58
+ "bsy-mobile-editor__sheet-body": "_bsy-mobile-editor__sheet-body_1g2i4_329",
59
+ "bsy-mobile-editor__sheet-body--stack": "_bsy-mobile-editor__sheet-body--stack_1g2i4_334",
60
+ "bsy-mobile-editor__sheet-field": "_bsy-mobile-editor__sheet-field_1g2i4_339",
61
+ "bsy-mobile-editor__sheet-label": "_bsy-mobile-editor__sheet-label_1g2i4_344",
62
+ "bsy-mobile-editor__sheet-note": "_bsy-mobile-editor__sheet-note_1g2i4_350",
63
+ "bsy-mobile-editor__sheet-note--hint": "_bsy-mobile-editor__sheet-note--hint_1g2i4_356",
64
+ "bsy-mobile-editor__sheet-error": "_bsy-mobile-editor__sheet-error_1g2i4_359",
65
+ "bsy-mobile-editor__sheet-bar": "_bsy-mobile-editor__sheet-bar_1g2i4_379",
66
+ "bsy-mobile-editor__sheet-ok": "_bsy-mobile-editor__sheet-ok_1g2i4_400",
67
+ "bsy-mobile-editor__check": "_bsy-mobile-editor__check_1g2i4_405",
68
+ "bsy-mobile-editor__check-input": "_bsy-mobile-editor__check-input_1g2i4_417",
69
+ "bsy-mobile-editor__check-box": "_bsy-mobile-editor__check-box_1g2i4_424",
70
+ "bsy-mobile-editor__ai": "_bsy-mobile-editor__ai_1g2i4_297",
71
+ "bsy-mobile-editor__ai-body": "_bsy-mobile-editor__ai-body_1g2i4_446",
72
+ "bsy-mobile-editor__ai-section": "_bsy-mobile-editor__ai-section_1g2i4_454",
73
+ "bsy-mobile-editor__ai-section-head": "_bsy-mobile-editor__ai-section-head_1g2i4_462",
74
+ "bsy-mobile-editor__ai-section-scroll": "_bsy-mobile-editor__ai-section-scroll_1g2i4_470",
75
+ "bsy-mobile-editor__ai-label": "_bsy-mobile-editor__ai-label_1g2i4_477",
76
+ "bsy-mobile-editor__ai-label--after": "_bsy-mobile-editor__ai-label--after_1g2i4_489",
77
+ "bsy-mobile-editor__ai-label--before": "_bsy-mobile-editor__ai-label--before_1g2i4_493",
78
+ "bsy-mobile-editor__ai-dot": "_bsy-mobile-editor__ai-dot_1g2i4_497",
79
+ "bsy-mobile-editor__ai-split": "_bsy-mobile-editor__ai-split_1g2i4_504",
80
+ "bsy-mobile-editor__ai-preset": "_bsy-mobile-editor__ai-preset_1g2i4_510",
81
+ "bsy-mobile-editor__ai-think-pin": "_bsy-mobile-editor__ai-think-pin_1g2i4_530",
82
+ "bsy-mobile-editor__ai-think-head": "_bsy-mobile-editor__ai-think-head_1g2i4_534",
83
+ "bsy-mobile-editor__ai-think-label": "_bsy-mobile-editor__ai-think-label_1g2i4_551",
84
+ "bsy-mobile-editor__ai-think-label--shimmer": "_bsy-mobile-editor__ai-think-label--shimmer_1g2i4_555",
85
+ "bsy-mobile-ai-think-shimmer": "_bsy-mobile-ai-think-shimmer_1g2i4_1",
86
+ "bsy-mobile-editor__ai-think-arrow": "_bsy-mobile-editor__ai-think-arrow_1g2i4_566",
87
+ "bsy-mobile-editor__ai-think-arrow--open": "_bsy-mobile-editor__ai-think-arrow--open_1g2i4_573",
88
+ "bsy-mobile-editor__ai-think-icon": "_bsy-mobile-editor__ai-think-icon_1g2i4_576",
89
+ "bsy-mobile-ai-think": "_bsy-mobile-ai-think_1g2i4_1",
90
+ "bsy-mobile-editor__ai-think-body": "_bsy-mobile-editor__ai-think-body_1g2i4_588",
91
+ "bsy-mobile-editor__ai-error": "_bsy-mobile-editor__ai-error_1g2i4_597",
92
+ "bsy-mobile-editor__ai-footer": "_bsy-mobile-editor__ai-footer_1g2i4_602",
93
+ "bsy-mobile-editor__ai-footer-ok": "_bsy-mobile-editor__ai-footer-ok_1g2i4_624"
94
+ }, ke = [
95
+ {
96
+ label: "12",
97
+ value: "12px"
98
+ },
99
+ {
100
+ label: "14",
101
+ value: "14px"
102
+ },
103
+ {
104
+ label: "16",
105
+ value: "16px"
106
+ },
107
+ {
108
+ label: "18",
109
+ value: "18px"
110
+ },
111
+ {
112
+ label: "20",
113
+ value: "20px"
114
+ },
115
+ {
116
+ label: "22",
117
+ value: "22px"
118
+ },
119
+ {
120
+ label: "24",
121
+ value: "24px"
122
+ },
123
+ {
124
+ label: "28",
125
+ value: "28px"
126
+ },
127
+ {
128
+ label: "32",
129
+ value: "32px"
130
+ },
131
+ {
132
+ label: "36",
133
+ value: "36px"
134
+ },
135
+ {
136
+ label: "64",
137
+ value: "64px"
138
+ },
139
+ {
140
+ label: "128",
141
+ value: "128px"
142
+ }
143
+ ], U = "#000", Ae = "transparent", je = /* @__PURE__ */ "#005eef.#3642e9.#7f43c8.#114bb8.#1379d9.#10a9c4.#119d85.#ffc502.#ff9921.#f06648.#f168b6.#d9e8ff.#dee0ff.#efe2ff.#d5e4ff.#daedff.#ddfaff.#d7fff8.#fff4d0.#ffecd7.#ffe3dd.#ffdef1.#262626.#3c3c3d.#454545.#515152.#5d5c5e.#6c6c6e.#878789.#b0afb1.#d0d0d1.#e6e6e7.#f5f5f6".split("."), W = [
144
+ "quick",
145
+ "formal",
146
+ "colloquial",
147
+ "lively",
148
+ "literary",
149
+ "retro"
150
+ ], G = {
151
+ quick: "editor.aiPresetQuick",
152
+ formal: "editor.aiPresetFormal",
153
+ colloquial: "editor.aiPresetColloquial",
154
+ lively: "editor.aiPresetLively",
155
+ literary: "editor.aiPresetLiterary",
156
+ retro: "editor.aiPresetRetro"
157
+ }, Me = [
158
+ {
159
+ key: "ai",
160
+ buttons: ["ai"]
161
+ },
162
+ {
163
+ key: "format",
164
+ buttons: [
165
+ "bold",
166
+ "italic",
167
+ "underline",
168
+ "strikethrough",
169
+ "align"
170
+ ]
171
+ },
172
+ {
173
+ key: "style",
174
+ buttons: [
175
+ "heading",
176
+ "fontSize",
177
+ "fontColor",
178
+ "fill"
179
+ ]
180
+ },
181
+ {
182
+ key: "indent",
183
+ buttons: ["outdent", "indent"]
184
+ },
185
+ {
186
+ key: "list",
187
+ buttons: ["number", "bullet"]
188
+ },
189
+ {
190
+ key: "insert",
191
+ buttons: ["picture", "link"]
192
+ }
193
+ ], Ne = [
194
+ "jpg",
195
+ "jpeg",
196
+ "png",
197
+ "gif",
198
+ "bmp",
199
+ "tif"
200
+ ], Pe = Ne.map((e) => `.${e}`).join(","), Fe = "calc(100dvh - 104px)", Ie = i({}), K = 36, Le = 14, Re = 2 * Math.PI * Le, ze = ({ nodeKey: e, src: t, altText: n, dataId: r }) => {
201
+ let i = o(Ie), a = e in i, s = i[e];
202
+ return /* @__PURE__ */ m("span", {
203
+ className: H["bsy-mobile-editor__image"],
204
+ children: [/* @__PURE__ */ p("img", {
205
+ src: t,
206
+ alt: n,
207
+ "data-id": r
208
+ }), a ? /* @__PURE__ */ p("span", {
209
+ className: H["bsy-mobile-editor__image-mask"],
210
+ role: "progressbar",
211
+ "aria-label": n,
212
+ "aria-valuemin": 0,
213
+ "aria-valuemax": 100,
214
+ "aria-valuenow": s === void 0 ? void 0 : Math.round(s),
215
+ children: /* @__PURE__ */ m("svg", {
216
+ className: s === void 0 ? `${H["bsy-mobile-editor__image-progress"]} ${H["bsy-mobile-editor__image-progress--spin"]}` : H["bsy-mobile-editor__image-progress"],
217
+ width: K,
218
+ height: K,
219
+ viewBox: `0 0 ${K} ${K}`,
220
+ "aria-hidden": "true",
221
+ children: [/* @__PURE__ */ p("circle", {
222
+ cx: K / 2,
223
+ cy: K / 2,
224
+ r: Le,
225
+ fill: "none",
226
+ stroke: "rgba(255,255,255,0.35)",
227
+ strokeWidth: "3"
228
+ }), /* @__PURE__ */ p("circle", {
229
+ cx: K / 2,
230
+ cy: K / 2,
231
+ r: Le,
232
+ fill: "none",
233
+ stroke: "#fff",
234
+ strokeWidth: "3",
235
+ strokeLinecap: "round",
236
+ strokeDasharray: s === void 0 ? `${Re * .25} ${Re}` : Re,
237
+ strokeDashoffset: s === void 0 ? 0 : Re * (1 - s / 100),
238
+ transform: `rotate(-90 ${K / 2} ${K / 2})`
239
+ })]
240
+ })
241
+ }) : null]
242
+ });
243
+ }, Be = class e extends pe {
244
+ __src;
245
+ __altText;
246
+ __width;
247
+ __height;
248
+ __dataId;
249
+ static getType() {
250
+ return "image";
251
+ }
252
+ static clone(t) {
253
+ return new e(t.__src, t.__altText, t.__width, t.__height, t.__key, t.__dataId);
254
+ }
255
+ constructor(e, t, n, r, i, a) {
256
+ super(i), this.__src = e, this.__altText = t || "", this.__width = n, this.__height = r, this.__dataId = a;
257
+ }
258
+ createDOM() {
259
+ let e = document.createElement("span");
260
+ return e.className = H["bsy-mobile-editor__image-shell"], e;
261
+ }
262
+ updateDOM() {
263
+ return !1;
264
+ }
265
+ exportDOM() {
266
+ let e = document.createElement("img");
267
+ return e.setAttribute("src", this.__src), e.setAttribute("alt", this.__altText), e.style.maxWidth = "100%", e.style.display = "inline", e.style.verticalAlign = "baseline", this.__width && e.setAttribute("width", this.__width.toString()), this.__height && e.setAttribute("height", this.__height.toString()), this.__dataId && e.setAttribute("data-id", this.__dataId), { element: e };
268
+ }
269
+ getSrc() {
270
+ return this.__src;
271
+ }
272
+ setSrc(e) {
273
+ let t = this.getWritable();
274
+ t.__src = e;
275
+ }
276
+ setDataId(e) {
277
+ let t = this.getWritable();
278
+ t.__dataId = e;
279
+ }
280
+ static importDOM() {
281
+ return { img: () => ({
282
+ conversion: Ue,
283
+ priority: 0
284
+ }) };
285
+ }
286
+ static importJSON(e) {
287
+ let { src: t, altText: n, width: r, height: i, dataId: a } = e;
288
+ return He({
289
+ src: t,
290
+ altText: n,
291
+ width: r,
292
+ height: i,
293
+ dataId: a
294
+ });
295
+ }
296
+ exportJSON() {
297
+ return {
298
+ src: this.getSrc(),
299
+ altText: this.__altText,
300
+ width: this.__width,
301
+ height: this.__height,
302
+ dataId: this.__dataId,
303
+ type: "image",
304
+ version: 1
305
+ };
306
+ }
307
+ isInline() {
308
+ return !0;
309
+ }
310
+ decorate() {
311
+ return /* @__PURE__ */ p(ze, {
312
+ nodeKey: this.getKey(),
313
+ src: this.__src,
314
+ altText: this.__altText,
315
+ dataId: this.__dataId
316
+ });
317
+ }
318
+ }, Ve = (e) => e instanceof Be, He = ({ src: e, altText: t, width: n, height: r, dataId: i, key: a }) => new Be(e, t, n, r, a, i), Ue = (e) => {
319
+ if (!(e instanceof HTMLImageElement)) return null;
320
+ let { src: t, alt: n, style: r } = e, i, a;
321
+ if (r.width) {
322
+ let e = parseInt(r.width, 10);
323
+ Number.isNaN(e) || (i = e);
324
+ }
325
+ if (r.height) {
326
+ let e = parseInt(r.height, 10);
327
+ Number.isNaN(e) || (a = e);
328
+ }
329
+ return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: He({
330
+ src: t,
331
+ altText: n,
332
+ width: i,
333
+ height: a,
334
+ dataId: e.getAttribute("data-id") || void 0
335
+ }) };
336
+ }, We = (e, t) => e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; "), Ge = () => {
337
+ let [e] = z();
338
+ return s(() => e.registerNodeTransform(O, (e) => {
339
+ let t = e.getTag();
340
+ if (t === "h4" || t === "h5" || t === "h6") {
341
+ e.replace(k(), !0);
342
+ return;
343
+ }
344
+ for (let t of e.getAllTextNodes()) {
345
+ let e = t.getStyle();
346
+ if (!e) continue;
347
+ let n = We(e, "font-size");
348
+ n !== e && t.setStyle(n);
349
+ }
350
+ }), [e]), null;
351
+ }, q = class e extends L {
352
+ static getType() {
353
+ return "extended-text";
354
+ }
355
+ static clone(t) {
356
+ return new e(t.__text, t.__key);
357
+ }
358
+ static importDOM() {
359
+ let e = L.importDOM();
360
+ return {
361
+ ...e,
362
+ code: () => ({
363
+ conversion: J(e?.code),
364
+ priority: 1
365
+ }),
366
+ em: () => ({
367
+ conversion: J(e?.em),
368
+ priority: 1
369
+ }),
370
+ span: () => ({
371
+ conversion: J(e?.span),
372
+ priority: 1
373
+ }),
374
+ strong: () => ({
375
+ conversion: J(e?.strong),
376
+ priority: 1
377
+ }),
378
+ sub: () => ({
379
+ conversion: J(e?.sub),
380
+ priority: 1
381
+ }),
382
+ sup: () => ({
383
+ conversion: J(e?.sup),
384
+ priority: 1
385
+ })
386
+ };
387
+ }
388
+ static importJSON(e) {
389
+ return Ke().updateFromJSON(e);
390
+ }
391
+ isSimpleText() {
392
+ return this.__type === "extended-text" && this.__mode === 0;
393
+ }
394
+ }, Ke = (e = "") => re(new q(e)), J = (e) => (t) => {
395
+ let n = e?.(t);
396
+ if (!n) return null;
397
+ let r = n.conversion(t);
398
+ if (!r) return r;
399
+ let i = t.style.backgroundColor, a = t.style.color, o = t.style.fontFamily, s = t.style.fontWeight, c = t.style.fontSize, l = t.style.textDecoration;
400
+ return {
401
+ ...r,
402
+ forChild: (e, t) => {
403
+ let n = (r?.forChild ?? ((e) => e))(e, t);
404
+ if (ce(n)) {
405
+ let e = [
406
+ i ? `background-color: ${i}` : null,
407
+ a ? `color: ${a}` : null,
408
+ o ? `font-family: ${o}` : null,
409
+ s ? `font-weight: ${s}` : null,
410
+ c ? `font-size: ${c}` : null,
411
+ l ? `text-decoration: ${l}` : null
412
+ ].filter((e) => e !== null).join("; ");
413
+ if (e.length) return n.setStyle(e);
414
+ }
415
+ return n;
416
+ }
417
+ };
418
+ }, qe = () => {
419
+ let [e] = z();
420
+ return s(() => e.registerNodeTransform(q, (e) => {
421
+ if (!B(e, v)) return;
422
+ let t = e.getStyle();
423
+ if (!t) return;
424
+ let n = We(t, "color");
425
+ n !== t && e.setStyle(n);
426
+ }), [e]), null;
427
+ }, Je = /<img\b|<picture\b/i, Ye = () => {
428
+ let [e] = z();
429
+ return s(() => {
430
+ let t = (t) => {
431
+ let n = "clipboardData" in t ? t.clipboardData : "dataTransfer" in t ? t.dataTransfer : null;
432
+ if (!n || n.getData("application/x-lexical-editor") || n.getData("application/x-lexical-drag")) return !1;
433
+ let r = n.getData("text/html");
434
+ if (!(Array.from(n.files).some((e) => e.type.startsWith("image/")) || Array.from(n.items).some((e) => e.type.startsWith("image/")) || Je.test(r))) return !1;
435
+ t.preventDefault();
436
+ let i = n.getData("text/plain");
437
+ return !Je.test(r) && !i || e.update(() => {
438
+ let t = j();
439
+ if (t === null) return;
440
+ let n = r ? new DOMParser().parseFromString(r, "text/html") : null;
441
+ if (n?.querySelectorAll("img, picture").forEach((e) => e.remove()), (n?.body.innerHTML ?? "") && n?.body.textContent?.trim()) {
442
+ let t = R(e, n);
443
+ if (t.length) {
444
+ oe(t);
445
+ return;
446
+ }
447
+ }
448
+ i && t.insertRawText(i);
449
+ }, { tag: ge }), !0;
450
+ };
451
+ return Te(e.registerCommand(he, t, de), e.registerCommand(fe, t, de));
452
+ }, [e]), null;
453
+ }, Xe = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR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KkOJ/rH0XvFcTqxnuXzF1WTBP/g//ryWzQSZJh+J7y/vNAaHwMncIDaOHwedyAHyd5x/3JbvO4bK9/+x81+uH6gGaCzd5oQqhTfJbpa0L6jN9IuR3Z7nmkS+L4MKfykqOH9ToJ1LrZ81YfHJ+KzxUBAg8edtf2std5fDavtbvZPGDBdga508P7dGeVYeaQ5yxcndavPp1cEhjJVHWou5h4YAjbeIinyoPSP2nue/yFlpf9b/euXJ69DujDD/iy+1JkqHjoBeIfOMPtYElswTzq6av2s+//OHWwk4UCe4H5DJUqofpVwONXaEgo8YzOHqsYH4EtlnTgM0+COFl26gyD5hiLPIizPicP2fKkc4whGOcCjwKViIGaRSStOhAAAAAElFTkSuQmCC", Qe = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre.code.table.thead.tbody.tr.td.th.h1.h2.h3.h4.h5.h6".split("."), $e = [
454
+ "href",
455
+ "src",
456
+ "alt",
457
+ "target",
458
+ "rel",
459
+ "colspan",
460
+ "rowspan",
461
+ "data-language",
462
+ "data-id",
463
+ "class",
464
+ "style",
465
+ "width",
466
+ "height"
467
+ ], et = new Set(/* @__PURE__ */ "color.background-color.font-size.font-family.font-weight.font-style.text-decoration.text-align.max-width.display.vertical-align.width.height.border.margin.padding.padding-inline-start.line-height.list-style-type.list-style-position.list-style.border-collapse.table-layout.overflow-x.white-space.tab-size.border-radius.box-sizing.min-width.min-height.cursor".split(".")), tt = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, nt = new Set([
468
+ "pre",
469
+ "code",
470
+ "td",
471
+ "th"
472
+ ]), rt = new Set(["pre", "code"]), it = (e, t) => et.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? nt.has(t) : e === "border-radius" ? rt.has(t) : !0 : !1, at = (e, t) => e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => {
473
+ let n = e.indexOf(":");
474
+ if (n === -1) return null;
475
+ let r = e.slice(0, n).trim().toLowerCase(), i = e.slice(n + 1).trim();
476
+ if (r === "background") {
477
+ if (/url\s*\(/i.test(i)) return null;
478
+ r = "background-color";
479
+ }
480
+ return !it(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
481
+ }).filter((e) => e !== null).join("; "), ot = !1, st = () => {
482
+ ot ||= (Oe.addHook("uponSanitizeAttribute", (e, t) => {
483
+ if (t.attrName === "href" && /^data:/i.test(t.attrValue)) {
484
+ t.keepAttr = !1;
485
+ return;
486
+ }
487
+ t.attrName === "style" && (t.attrValue = at(t.attrValue, e.nodeName.toLowerCase()), t.attrValue || (t.keepAttr = !1));
488
+ }), !0);
489
+ }, Y = (e) => e ? (st(), Oe.sanitize(e, {
490
+ ALLOWED_TAGS: Qe,
491
+ ALLOWED_ATTR: $e,
492
+ ALLOW_DATA_ATTR: !1,
493
+ ADD_ATTR: ["data-language", "data-id"],
494
+ ALLOWED_URI_REGEXP: tt
495
+ })) : "", ct = "\n:host {\n all: initial;\n display: block;\n width: 100%;\n}\n.root {\n color: #030303;\n font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;\n font-size: 15px;\n line-height: 1.6;\n word-break: break-word;\n}\n.root p {\n margin: 0;\n}\n.root .editor-text-bold {\n font-weight: 700;\n}\n.root .editor-text-italic {\n font-style: italic;\n}\n.root .editor-text-underline {\n text-decoration: underline;\n}\n.root .editor-text-strikethrough {\n text-decoration: line-through;\n}\n.root .editor-text-underline-strikethrough {\n text-decoration: underline line-through;\n}\n.root .editor-heading-h1,\n.root .editor-heading-h2,\n.root .editor-heading-h3 {\n margin: 0.6em 0 0.4em;\n font-weight: 600;\n line-height: 1.35;\n}\n.root .editor-heading-h1 {\n font-size: 2em;\n}\n.root .editor-heading-h2 {\n font-size: 1.5em;\n}\n.root .editor-heading-h3 {\n font-size: 1.25em;\n}\n.root .editor-list-ul,\n.root .editor-list-ol {\n margin: 0;\n padding-inline-start: 24px;\n list-style-position: outside;\n}\n.root .editor-list-ul {\n list-style-type: disc;\n}\n.root .editor-list-ol {\n list-style-type: decimal;\n}\n.root .editor-listitem {\n margin: 0;\n list-style: inherit;\n}\n.root .editor-nested-listitem {\n list-style-type: none;\n}\n.root .editor-list-ul .editor-list-ul {\n list-style-type: circle;\n}\n.root .editor-list-ul .editor-list-ul .editor-list-ul {\n list-style-type: square;\n}\n.root .editor-link,\n.root .editor-link:link,\n.root .editor-link:visited,\n.root .editor-link:hover,\n.root .editor-link:active,\n.root .editor-link:focus {\n color: #0269ff;\n cursor: pointer;\n}\n.root .editor-link * {\n color: #0269ff !important;\n}\n.root img {\n max-width: 100%;\n height: auto;\n vertical-align: baseline;\n}\n", lt = ({ html: e }) => {
496
+ let t = u(null);
497
+ return l(() => {
498
+ let n = t.current;
499
+ if (!n) return;
500
+ let r = n.shadowRoot ?? n.attachShadow({ mode: "open" });
501
+ r.innerHTML = `<style>${ct}</style><div class="root">${Y(e)}</div>`;
502
+ }, [e]), /* @__PURE__ */ p("div", { ref: t });
503
+ }, ut = () => {
504
+ let e = `${c().replace(/:/g, "")}g`;
505
+ return /* @__PURE__ */ p("span", {
506
+ className: H["bsy-mobile-editor__ai-think-icon"],
507
+ "aria-hidden": "true",
508
+ children: /* @__PURE__ */ m("svg", {
509
+ xmlns: "http://www.w3.org/2000/svg",
510
+ width: "16",
511
+ height: "16",
512
+ viewBox: "0 0 16 16",
513
+ fill: "none",
514
+ children: [/* @__PURE__ */ p("path", {
515
+ d: "M6.33965 13.3C6.27366 13.4143 6.23082 13.5404 6.21357 13.6712C6.19633 13.802 6.20502 13.9349 6.23914 14.0624C6.30806 14.3198 6.47641 14.5392 6.70715 14.6725C6.93788 14.8058 7.21211 14.8419 7.46951 14.773C7.59696 14.7389 7.71644 14.68 7.82112 14.5997C7.92581 14.5194 8.01366 14.4193 8.07965 14.305C8.21292 14.0743 8.24907 13.8 8.18015 13.5426C8.11123 13.2852 7.94288 13.0658 7.71215 12.9325C7.48141 12.7992 7.20718 12.7631 6.94978 12.832C6.69239 12.9009 6.47292 13.0693 6.33965 13.3ZM8.97265 1C7.44126 0.999778 5.95165 1.4994 4.73011 2.42295C3.69009 3.20927 2.89277 4.26631 2.4213 5.47246C2.33326 5.69768 2.00678 5.72579 1.89765 5.51L1.80165 5.356C1.64959 5.15708 1.42869 5.02215 1.18228 4.97769C0.935881 4.93323 0.681756 4.98244 0.469763 5.11567C0.25777 5.24891 0.103209 5.45654 0.0364008 5.69785C-0.0304072 5.93915 -0.00464041 6.19671 0.108646 6.42L1.34765 8.852L1.45565 9.032C1.86065 9.598 2.61765 9.782 3.23665 9.467L5.62665 8.25L5.78165 8.153C5.98057 8.00094 6.11549 7.78004 6.15995 7.53364C6.20442 7.28723 6.1552 7.03311 6.02197 6.82112C5.88874 6.60912 5.68111 6.45456 5.4398 6.38775C5.19849 6.32095 4.94093 6.34671 4.71765 6.46C4.48237 6.579 4.22662 6.36717 4.32655 6.12317C4.56067 5.55153 4.899 5.02613 5.32623 4.57461C5.90933 3.95836 6.63902 3.49984 7.44723 3.24183C8.25544 2.98382 9.11583 2.93472 9.94815 3.09912C10.7805 3.26352 11.5576 3.63606 12.207 4.18198C12.8564 4.7279 13.357 5.42942 13.662 6.22109C13.967 7.01276 14.0665 7.86879 13.9512 8.70932C13.836 9.54985 13.5097 10.3475 13.0028 11.0278C12.496 11.7082 11.8251 12.249 11.0526 12.6C10.9326 12.654 10.7796 12.71 10.5976 12.766C10.3241 12.8507 10.0934 13.0371 9.95295 13.2867C9.81252 13.5363 9.77305 13.8302 9.84265 14.108C9.90673 14.3421 10.0611 14.5412 10.2718 14.6615C10.4826 14.7819 10.7325 14.8137 10.9666 14.75C11.2736 14.666 11.5226 14.584 11.7136 14.503C13.2066 13.8705 14.435 12.7413 15.1908 11.3067C15.9466 9.87221 16.1832 8.22052 15.8607 6.63149C15.5381 5.04246 14.6762 3.61377 13.4209 2.58747C12.1656 1.56117 10.5941 1.00034 8.97265 1ZM4.16665 10.876C3.90024 10.876 3.64474 10.9818 3.45636 11.1702C3.26798 11.3586 3.16215 11.6141 3.16215 11.8805C3.16215 12.1469 3.26798 12.4024 3.45636 12.5908C3.64474 12.7792 3.90024 12.885 4.16665 12.885C4.43306 12.885 4.68855 12.7792 4.87694 12.5908C5.06532 12.4024 5.17115 12.1469 5.17115 11.8805C5.17115 11.6141 5.06532 11.3586 4.87694 11.1702C4.68855 10.9818 4.43306 10.876 4.16665 10.876Z",
516
+ fill: `url(#${e})`
517
+ }), /* @__PURE__ */ p("defs", { children: /* @__PURE__ */ m("linearGradient", {
518
+ id: e,
519
+ x1: "8.00059",
520
+ y1: "1",
521
+ x2: "8.00059",
522
+ y2: "14.8072",
523
+ gradientUnits: "userSpaceOnUse",
524
+ children: [
525
+ /* @__PURE__ */ p("stop", { stopColor: "#0265FF" }),
526
+ /* @__PURE__ */ p("stop", {
527
+ offset: "1",
528
+ stopColor: "#A6FFFF"
529
+ }),
530
+ /* @__PURE__ */ p("animateTransform", {
531
+ attributeName: "gradientTransform",
532
+ type: "rotate",
533
+ from: "0 8 8",
534
+ to: "360 8 8",
535
+ dur: "1.8s",
536
+ repeatCount: "indefinite"
537
+ })
538
+ ]
539
+ }) })]
540
+ })
541
+ });
542
+ }, dt = (e, t, n) => {
543
+ let { t: i } = r(), o = e.status === "loading" && !t, [c, l] = d(!0), [f, p] = d(0), m = u(Date.now()), g = u(null), _ = u(!1), v = u(!1), y = e.reasoning ?? "", b = a(() => n.current ?? void 0, [n]);
544
+ return s(() => {
545
+ if (!o) {
546
+ g.current === null && (g.current = Math.max(1, Math.round((Date.now() - m.current) / 1e3)), p(g.current)), l(!1);
547
+ return;
548
+ }
549
+ m.current = Date.now(), g.current = null, l(!0), _.current = !1, v.current = !1;
550
+ let e = window.setInterval(() => {
551
+ p(Math.max(1, Math.round((Date.now() - m.current) / 1e3)));
552
+ }, 500);
553
+ return () => window.clearInterval(e);
554
+ }, [o]), h("pointerdown", () => {
555
+ v.current = !0;
556
+ }, {
557
+ target: b,
558
+ passive: !0,
559
+ enable: o
560
+ }), h("scroll", () => {
561
+ let e = n.current;
562
+ !e || !v.current || (v.current = !1, e.scrollHeight - e.scrollTop - e.clientHeight > 8 && (_.current = !0));
563
+ }, {
564
+ target: b,
565
+ passive: !0,
566
+ enable: o
567
+ }), s(() => {
568
+ if (!o || _.current || !n.current) return;
569
+ let e = window.requestAnimationFrame(() => {
570
+ if (_.current) return;
571
+ let e = n.current;
572
+ e && e.scrollHeight - e.scrollTop - e.clientHeight > 1 && (e.scrollTop = e.scrollHeight);
573
+ });
574
+ return () => window.cancelAnimationFrame(e);
575
+ }, [
576
+ y,
577
+ n,
578
+ o
579
+ ]), {
580
+ visible: (o || !!y) && !(e.status === "error" && !y),
581
+ thinking: o,
582
+ open: o || c,
583
+ label: o ? i("editor.aiThinking") : i("editor.aiThoughtSeconds", { seconds: f }),
584
+ reasoning: y,
585
+ toggle: () => l((e) => !e)
586
+ };
587
+ }, ft = ({ model: e }) => /* @__PURE__ */ m("button", {
588
+ type: "button",
589
+ className: H["bsy-mobile-editor__ai-think-head"],
590
+ disabled: e.thinking,
591
+ onClick: e.toggle,
592
+ children: [e.thinking ? /* @__PURE__ */ p(ut, {}) : /* @__PURE__ */ p(n, {
593
+ name: "arrow-down",
594
+ size: 12,
595
+ className: [H["bsy-mobile-editor__ai-think-arrow"], e.open ? H["bsy-mobile-editor__ai-think-arrow--open"] : ""].filter(Boolean).join(" ")
596
+ }), /* @__PURE__ */ p("span", {
597
+ className: e.thinking ? `${H["bsy-mobile-editor__ai-think-label"]} ${H["bsy-mobile-editor__ai-think-label--shimmer"]}` : H["bsy-mobile-editor__ai-think-label"],
598
+ children: e.label
599
+ })]
600
+ }), pt = ({ model: e }) => !e.visible || !e.open || !e.reasoning ? null : /* @__PURE__ */ p("div", {
601
+ className: H["bsy-mobile-editor__ai-think-body"],
602
+ children: e.reasoning
603
+ }), mt = [
604
+ "color",
605
+ "background-color",
606
+ "font-size",
607
+ "font-family",
608
+ "font-weight",
609
+ "text-decoration"
610
+ ], ht = (e) => {
611
+ let t = e.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th");
612
+ for (let n of Array.from(t)) {
613
+ let t = n, r = [];
614
+ for (let e of mt) {
615
+ let n = t.style.getPropertyValue(e);
616
+ n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
617
+ }
618
+ if (!r.length) continue;
619
+ let i = r.join("; ");
620
+ for (let n of Array.from(t.childNodes)) {
621
+ if (n.nodeType === Node.TEXT_NODE && n.textContent) {
622
+ let r = e.createElement("span");
623
+ r.setAttribute("style", i), t.insertBefore(r, n), r.appendChild(n);
624
+ continue;
625
+ }
626
+ if (n.nodeType === Node.ELEMENT_NODE) {
627
+ let e = n, t = e.getAttribute("style");
628
+ e.setAttribute("style", t ? `${t}; ${i}` : i);
629
+ }
630
+ }
631
+ }
632
+ }, gt = (e, t) => {
633
+ let n = A();
634
+ if (n.clear(), t.trim()) {
635
+ let r = new DOMParser().parseFromString(t, "text/html");
636
+ ht(r);
637
+ let i = R(e, r);
638
+ if (i.length) {
639
+ n.select(), oe(i);
640
+ return;
641
+ }
642
+ }
643
+ let r = k();
644
+ n.append(r), r.select();
645
+ }, _t = (e, t) => !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e)), X = {
646
+ margin: "0.6em 0 0.4em",
647
+ "font-weight": "600",
648
+ "line-height": "1.35"
649
+ }, vt = {
650
+ h1: {
651
+ ...X,
652
+ "font-size": "2em"
653
+ },
654
+ h2: {
655
+ ...X,
656
+ "font-size": "1.5em"
657
+ },
658
+ h3: {
659
+ ...X,
660
+ "font-size": "1.25em"
661
+ },
662
+ h4: {
663
+ ...X,
664
+ "font-size": "1.125em"
665
+ },
666
+ h5: {
667
+ ...X,
668
+ "font-size": "1em"
669
+ },
670
+ h6: {
671
+ ...X,
672
+ "font-size": "0.875em"
673
+ }
674
+ }, yt = {
675
+ color: "#0269ff",
676
+ cursor: "pointer"
677
+ }, bt = {
678
+ margin: "0",
679
+ "padding-inline-start": "24px",
680
+ "list-style-position": "outside"
681
+ }, xt = [
682
+ "disc",
683
+ "circle",
684
+ "square"
685
+ ], St = {
686
+ margin: "0",
687
+ "list-style": "inherit"
688
+ }, Ct = {
689
+ margin: "0",
690
+ "list-style-type": "none"
691
+ }, wt = {
692
+ display: "block",
693
+ "box-sizing": "border-box",
694
+ "max-width": "100%",
695
+ margin: "8px 0",
696
+ padding: "8px 12px",
697
+ "overflow-x": "auto",
698
+ "font-family": "Menlo, Consolas, Monaco, monospace",
699
+ "font-size": "13px",
700
+ "line-height": "1.53",
701
+ "white-space": "pre",
702
+ "tab-size": "2",
703
+ "border-radius": "4px",
704
+ "background-color": "rgb(240, 242, 245)",
705
+ color: "#1f2328"
706
+ }, Tt = {
707
+ "border-collapse": "collapse",
708
+ "table-layout": "fixed",
709
+ width: "100%",
710
+ "overflow-x": "auto",
711
+ margin: "8px 0"
712
+ }, Et = {
713
+ "box-sizing": "border-box",
714
+ "min-width": "75px",
715
+ "min-height": "32px",
716
+ padding: "4px 8px",
717
+ border: "1px solid #d9d9d9",
718
+ "vertical-align": "top"
719
+ }, Dt = {
720
+ "font-weight": "600",
721
+ "background-color": "#f2f3f5"
722
+ }, Z = (e, t) => {
723
+ for (let [n, r] of Object.entries(t)) e.style.getPropertyValue(n) || e.style.setProperty(n, r);
724
+ }, Ot = (e) => {
725
+ let t = 0, n = e;
726
+ for (; n;) n.tagName === "UL" && (t += 1), n = n.parentElement;
727
+ return t;
728
+ }, kt = (e) => {
729
+ for (let t of Array.from(e.querySelectorAll("*"))) {
730
+ if (!(t instanceof HTMLElement)) continue;
731
+ let e = t.tagName.toLowerCase(), n = vt[e];
732
+ if (n && Z(t, n), e === "a" && Z(t, yt), e === "ul") {
733
+ let e = Math.min(Math.max(Ot(t), 1), xt.length);
734
+ Z(t, {
735
+ ...bt,
736
+ "list-style-type": xt[e - 1]
737
+ });
738
+ }
739
+ e === "ol" && Z(t, {
740
+ ...bt,
741
+ "list-style-type": "decimal"
742
+ }), e === "li" && Z(t, t.classList.contains("editor-nested-listitem") ? Ct : St), e === "pre" && Z(t, wt), e === "table" && Z(t, Tt), (e === "td" || e === "th") && (Z(t, Et), (e === "th" || t.classList.contains("editor-table-cell-header")) && Z(t, Dt)), t.classList.contains("editor-text-underline-strikethrough") ? Z(t, { "text-decoration": "underline line-through" }) : t.classList.contains("editor-text-underline") ? Z(t, { "text-decoration": "underline" }) : t.classList.contains("editor-text-strikethrough") && Z(t, { "text-decoration": "line-through" });
743
+ for (let e of Array.from(t.classList)) e.startsWith("editor-") && t.classList.remove(e);
744
+ t.classList.length === 0 && t.removeAttribute("class");
745
+ }
746
+ }, At = (e) => {
747
+ let t = e.parentNode;
748
+ if (t) {
749
+ for (; e.firstChild;) t.insertBefore(e.firstChild, e);
750
+ t.removeChild(e);
751
+ }
752
+ }, jt = (e) => {
753
+ let t = !0;
754
+ for (; t;) {
755
+ t = !1;
756
+ for (let n of Array.from(e.querySelectorAll("span, b, i"))) {
757
+ if (n.attributes.length > 0) continue;
758
+ let e = n.tagName.toLowerCase();
759
+ if (e === "span") {
760
+ At(n), t = !0;
761
+ continue;
762
+ }
763
+ if (n.childElementCount !== 1 || n.childNodes.length !== 1) continue;
764
+ let r = n.firstElementChild;
765
+ (e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (At(n), t = !0);
766
+ }
767
+ }
768
+ }, Mt = (e) => {
769
+ if (!e.trim()) return e;
770
+ let t = new DOMParser().parseFromString(e, "text/html");
771
+ kt(t.body), jt(t.body);
772
+ for (let e of Array.from(t.body.querySelectorAll("pre"))) e.textContent?.trim() || e.remove();
773
+ return t.body.innerHTML;
774
+ }, Nt = "<!--bsy-block-->", Pt = "bsy-html-root", Ft = (e) => new DOMParser().parseFromString(`<${Pt}>${e}</${Pt}>`, "text/html").body.querySelector(Pt), It = (e) => e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "", Lt = (e) => e.includes("<!--bsy-block-->") ? e.split(Nt).map((e) => e.trim()) : [e], Rt = (e) => e.split(Nt).join("").trim().length > 0, zt = (e, t) => {
775
+ let n = e.map(() => "");
776
+ if (e.length === 0) return n;
777
+ let r = [], i = [];
778
+ if (e.forEach((e, t) => {
779
+ for (let n of Array.from(e)) i.push(n), r.push(t);
780
+ }), i.length === 0) return n[0] = t, n;
781
+ let a = i, o = Array.from(t), s = a.length, c = o.length, l = Array.from({ length: s + 1 }, () => Array(c + 1).fill(0));
782
+ for (let e = s - 1; e >= 0; e--) for (let t = c - 1; t >= 0; t--) l[e][t] = a[e] === o[t] ? l[e + 1][t + 1] + 1 : Math.max(l[e + 1][t], l[e][t + 1]);
783
+ let u = 0, d = 0, f = r[0];
784
+ for (; u < s && d < c;) a[u] === o[d] ? (f = r[u], n[f] += o[d], u += 1, d += 1) : l[u + 1][d] >= l[u][d + 1] ? (f = r[u], u += 1) : (n[f] += o[d], d += 1);
785
+ for (; d < c;) n[n.length - 1] += o[d], d += 1;
786
+ return n;
787
+ }, Bt = new Set([
788
+ "TABLE",
789
+ "THEAD",
790
+ "TBODY",
791
+ "TR",
792
+ "TD",
793
+ "TH",
794
+ "IMG",
795
+ "BR"
796
+ ]), Vt = (e) => {
797
+ let t = [], n = (e) => {
798
+ if (e.nodeType === Node.ELEMENT_NODE) {
799
+ if (e.tagName === "PRE") return;
800
+ for (let t of Array.from(e.childNodes)) n(t);
801
+ return;
802
+ }
803
+ e.nodeType === Node.TEXT_NODE && t.push(e);
804
+ };
805
+ return n(e), t;
806
+ }, Ht = (e, t) => {
807
+ let n = e;
808
+ for (; n && n !== t && !Bt.has(n.tagName) && !(n.textContent ?? "").trim() && !n.querySelector("img, table, br");) {
809
+ let e = n.parentElement;
810
+ n.remove(), n = e;
811
+ }
812
+ }, Ut = (e) => {
813
+ let t = e.tagName;
814
+ return t === "IMG" || t === "TABLE" || t === "PRE";
815
+ }, Wt = (e) => {
816
+ let t = Ft(e);
817
+ return t ? Array.from(t.children).filter((e) => !Ut(e)).map((e) => e.textContent ?? "") : [];
818
+ }, Gt = (e) => e.includes("<!--bsy-block-->") ? e : It(e) || e, Kt = (e, t) => {
819
+ let n = Vt(e);
820
+ if (n.length === 0) {
821
+ t && (e.querySelector("br")?.remove(), e.append(e.ownerDocument.createTextNode(t)));
822
+ return;
823
+ }
824
+ let r = zt(n.map((e) => e.textContent ?? ""), t);
825
+ for (let t = 0; t < n.length; t++) {
826
+ let i = r[t], a = n[t];
827
+ if (i) {
828
+ a.textContent = i;
829
+ continue;
830
+ }
831
+ let o = a.parentElement;
832
+ a.remove(), Ht(o, e);
833
+ }
834
+ }, qt = (e, t) => {
835
+ let n = Gt(t);
836
+ if (!Rt(n) || !e.trim()) return "";
837
+ let r = Ft(e);
838
+ if (!r) return "";
839
+ let i = Array.from(r.children).filter((e) => !Ut(e));
840
+ if (i.length === 0) return "";
841
+ let a = Lt(n), o = a.length === i.length ? a : zt(i.map((e) => e.textContent ?? ""), a.join(""));
842
+ for (let e = 0; e < i.length; e++) Kt(i[e], o[e] ?? "");
843
+ return r.innerHTML;
844
+ }, Jt = (e, t) => {
845
+ let n = "";
846
+ e.getEditorState().read(() => {
847
+ n = Mt(Y(_e(e, null)));
848
+ }, { editor: e });
849
+ let r = Y(qt(n, t));
850
+ return !r.trim() || _t(r, It(r)) ? !1 : (e.update(() => {
851
+ gt(e, r);
852
+ }, { discrete: !0 }), !0);
853
+ }, Yt = /^\uFEFF/, Xt = /^ {0,3}`{1,3}[A-Za-z]*$/, Zt = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, Qt = /^ {0,3}```[ \t]*$/, $t = /<\/?[a-zA-Z]/, en = /<[a-zA-Z!]/, tn = (e) => en.test(e), nn = (e) => $t.test(e), rn = (e) => e.replace(Yt, "").replace(/\r\n/g, "\n"), an = (e) => {
854
+ let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
855
+ return Xt.test(r) ? {
856
+ text: n === -1 ? "" : t.slice(0, n),
857
+ withheld: !0
858
+ } : {
859
+ text: e,
860
+ withheld: !1
861
+ };
862
+ }, on = (e) => {
863
+ let t = Zt.exec(e);
864
+ return t ? { sameLineBody: t[4] ?? "" } : null;
865
+ }, sn = (e) => {
866
+ let t = e.replace(/[ \t]*```[ \t]*$/, "");
867
+ return t === e ? e : t;
868
+ }, cn = (e) => tn(e) ? e.replace(/^\n/, "") : "", ln = (e) => {
869
+ let t = e.split("\n"), n = [], r = 0;
870
+ for (; r < t.length;) {
871
+ let e = t[r], i = on(e);
872
+ if (i) {
873
+ let e = i.sameLineBody;
874
+ if (e !== sn(e)) {
875
+ e = sn(e);
876
+ let i = cn(t.slice(r + 1).join("\n"));
877
+ return [
878
+ ...n,
879
+ e,
880
+ i
881
+ ].filter(Boolean).join("\n");
882
+ }
883
+ let a = [];
884
+ for (e && a.push(e), r += 1; r < t.length && !Qt.test(t[r]);) a.push(t[r]), r += 1;
885
+ let o = r < t.length ? cn(t.slice(r + 1).join("\n")) : "";
886
+ return [
887
+ ...n,
888
+ a.join("\n"),
889
+ o
890
+ ].filter(Boolean).join("\n");
891
+ }
892
+ if (nn(e)) return un([...n, ...t.slice(r)].join("\n"));
893
+ tn(e) && n.push(e), r += 1;
894
+ }
895
+ return n.length ? n.join("\n") : null;
896
+ }, un = (e) => {
897
+ let t = e.split("\n");
898
+ if (!t.length) return e;
899
+ let n = on(t[0]);
900
+ return n && !nn(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(sn(n.sameLineBody))), t.length && Qt.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
901
+ }, dn = (e) => {
902
+ if (!e) return {
903
+ html: "",
904
+ pending: !1
905
+ };
906
+ let { text: t, withheld: n } = an(rn(e));
907
+ if (!t.trim()) return {
908
+ html: "",
909
+ pending: n || Xt.test(rn(e).trim())
910
+ };
911
+ let r = ln(t) ?? t, i = ln(r);
912
+ i !== null && i !== r && (r = i);
913
+ let a = r.trim();
914
+ return tn(a) ? {
915
+ html: a,
916
+ pending: !1
917
+ } : {
918
+ html: "",
919
+ pending: !0
920
+ };
921
+ }, fn = (e, t) => {
922
+ e.update(() => {
923
+ De(j(), () => t === "paragraph" ? k() : ne(t));
924
+ });
925
+ }, pn = (e, t) => {
926
+ e.update(() => {
927
+ let e = j();
928
+ e && V(e, t);
929
+ });
930
+ }, mn = ({ sheet: e, onClose: i, onTypeset: a, onPolishMenu: o, onPickPreset: s, onPicture: c, canTypeset: l, canPolish: u }) => {
931
+ let [d] = z(), { t: h } = r();
932
+ return /* @__PURE__ */ m(f, { children: [
933
+ /* @__PURE__ */ p(t, {
934
+ mode: "menu",
935
+ open: e === "align",
936
+ title: h("editor.alignment"),
937
+ onClose: i,
938
+ actions: [
939
+ {
940
+ key: "left",
941
+ text: h("editor.leftAlign"),
942
+ icon: /* @__PURE__ */ p(n, {
943
+ name: "paragraph",
944
+ size: 16
945
+ })
946
+ },
947
+ {
948
+ key: "center",
949
+ text: h("editor.centerAlign"),
950
+ icon: /* @__PURE__ */ p(n, {
951
+ name: "paragraphmiddle",
952
+ size: 16
953
+ })
954
+ },
955
+ {
956
+ key: "right",
957
+ text: h("editor.rightAlign"),
958
+ icon: /* @__PURE__ */ p(n, {
959
+ name: "paragraphright",
960
+ size: 16
961
+ })
962
+ }
963
+ ],
964
+ onAction: (e) => d.dispatchCommand(P, e.key)
965
+ }),
966
+ /* @__PURE__ */ p(t, {
967
+ mode: "menu",
968
+ open: e === "heading",
969
+ title: h("editor.heading"),
970
+ onClose: i,
971
+ actions: [
972
+ {
973
+ key: "paragraph",
974
+ text: h("editor.paragraph")
975
+ },
976
+ {
977
+ key: "h1",
978
+ text: h("editor.heading1")
979
+ },
980
+ {
981
+ key: "h2",
982
+ text: h("editor.heading2")
983
+ },
984
+ {
985
+ key: "h3",
986
+ text: h("editor.heading3")
987
+ }
988
+ ],
989
+ onAction: (e) => fn(d, e.key)
990
+ }),
991
+ /* @__PURE__ */ p(t, {
992
+ mode: "menu",
993
+ open: e === "fontSize",
994
+ title: h("editor.fontSize"),
995
+ onClose: i,
996
+ actions: ke.map((e) => ({
997
+ key: e.value,
998
+ text: e.label
999
+ })),
1000
+ onAction: (e) => pn(d, { "font-size": e.key })
1001
+ }),
1002
+ /* @__PURE__ */ p(t, {
1003
+ open: e === "fontColor" || e === "fill",
1004
+ title: h(e === "fill" ? "editor.fill" : "editor.fontColor"),
1005
+ onClose: i,
1006
+ children: /* @__PURE__ */ m("div", {
1007
+ className: H["bsy-mobile-editor__swatches"],
1008
+ children: [e === "fill" ? /* @__PURE__ */ p("button", {
1009
+ type: "button",
1010
+ className: H["bsy-mobile-editor__swatch"],
1011
+ "aria-label": h("editor.fillNone"),
1012
+ onClick: () => {
1013
+ pn(d, { "background-color": "transparent" }), i();
1014
+ }
1015
+ }) : null, je.map((t) => /* @__PURE__ */ p("button", {
1016
+ type: "button",
1017
+ className: H["bsy-mobile-editor__swatch"],
1018
+ style: { background: t },
1019
+ "aria-label": t,
1020
+ onClick: () => {
1021
+ pn(d, { [e === "fill" ? "background-color" : "color"]: t }), i();
1022
+ }
1023
+ }, t))]
1024
+ })
1025
+ }),
1026
+ /* @__PURE__ */ p(t, {
1027
+ mode: "menu",
1028
+ open: e === "ai",
1029
+ onClose: i,
1030
+ actions: [{
1031
+ key: "typeset",
1032
+ text: h("editor.aiTypeset"),
1033
+ disabled: !l,
1034
+ icon: /* @__PURE__ */ p("img", {
1035
+ src: Xe,
1036
+ alt: "",
1037
+ width: 16,
1038
+ height: 16,
1039
+ className: H["bsy-mobile-editor__ai-icon"],
1040
+ draggable: !1
1041
+ })
1042
+ }, {
1043
+ key: "polish",
1044
+ text: h("editor.aiPolish"),
1045
+ disabled: !u,
1046
+ icon: /* @__PURE__ */ p("img", {
1047
+ src: Ze,
1048
+ alt: "",
1049
+ width: 16,
1050
+ height: 16,
1051
+ className: H["bsy-mobile-editor__ai-icon"],
1052
+ draggable: !1
1053
+ })
1054
+ }],
1055
+ onAction: (e) => {
1056
+ if (e.key === "typeset") {
1057
+ a();
1058
+ return;
1059
+ }
1060
+ o();
1061
+ }
1062
+ }),
1063
+ /* @__PURE__ */ p(t, {
1064
+ mode: "menu",
1065
+ open: e === "aiPreset",
1066
+ title: h("editor.aiPolish"),
1067
+ onClose: i,
1068
+ actions: W.map((e) => ({
1069
+ key: e,
1070
+ text: h(G[e])
1071
+ })),
1072
+ onAction: (e) => s(e.key)
1073
+ }),
1074
+ /* @__PURE__ */ p(t, {
1075
+ mode: "menu",
1076
+ open: e === "picture",
1077
+ title: h("editor.picture"),
1078
+ onClose: i,
1079
+ actions: [{
1080
+ key: "upload",
1081
+ text: h("editor.uploadImage"),
1082
+ icon: /* @__PURE__ */ p(n, {
1083
+ name: "picture",
1084
+ size: 16
1085
+ })
1086
+ }, {
1087
+ key: "url",
1088
+ text: h("editor.imageUrl"),
1089
+ icon: /* @__PURE__ */ p(n, {
1090
+ name: "Insertlink",
1091
+ size: 16
1092
+ })
1093
+ }],
1094
+ onAction: (e) => c(e.key)
1095
+ })
1096
+ ] });
1097
+ }, hn = ({ open: t, title: i, bodyClassName: a, onClose: o, onConfirm: s, children: c }) => {
1098
+ let { t: l } = r();
1099
+ return /* @__PURE__ */ p(e, {
1100
+ open: t,
1101
+ onClose: o,
1102
+ position: "bottom",
1103
+ children: /* @__PURE__ */ m("div", {
1104
+ className: H["bsy-mobile-editor__sheet"],
1105
+ children: [
1106
+ /* @__PURE__ */ m("div", {
1107
+ className: H["bsy-mobile-editor__header"],
1108
+ children: [/* @__PURE__ */ p("div", {
1109
+ className: H["bsy-mobile-editor__title"],
1110
+ children: i
1111
+ }), /* @__PURE__ */ p("button", {
1112
+ type: "button",
1113
+ className: H["bsy-mobile-editor__close"],
1114
+ "aria-label": l("popup.close"),
1115
+ onClick: o,
1116
+ children: /* @__PURE__ */ p(n, {
1117
+ name: "close",
1118
+ size: 18
1119
+ })
1120
+ })]
1121
+ }),
1122
+ /* @__PURE__ */ p("div", {
1123
+ className: [H["bsy-mobile-editor__sheet-body"], a].filter(Boolean).join(" "),
1124
+ children: c
1125
+ }),
1126
+ /* @__PURE__ */ m("div", {
1127
+ className: H["bsy-mobile-editor__sheet-bar"],
1128
+ children: [/* @__PURE__ */ p("button", {
1129
+ type: "button",
1130
+ onClick: o,
1131
+ children: l("editor.cancel")
1132
+ }), /* @__PURE__ */ p("button", {
1133
+ type: "button",
1134
+ className: H["bsy-mobile-editor__sheet-ok"],
1135
+ onClick: s,
1136
+ children: l("editor.ok")
1137
+ })]
1138
+ })
1139
+ ]
1140
+ })
1141
+ });
1142
+ }, gn = ({ open: e, seed: t, onClose: i, onConfirm: a }) => {
1143
+ let { t: o } = r(), [c, l] = d(""), [u, f] = d(""), [h, g] = d(!0);
1144
+ return s(() => {
1145
+ !e || !t || (l(t.url), f(t.text), g(t.newBlank));
1146
+ }, [e, t]), /* @__PURE__ */ m(hn, {
1147
+ open: e,
1148
+ title: o("editor.link"),
1149
+ bodyClassName: H["bsy-mobile-editor__sheet-body--stack"],
1150
+ onClose: i,
1151
+ onConfirm: () => a({
1152
+ url: c,
1153
+ text: u,
1154
+ newBlank: h
1155
+ }),
1156
+ children: [
1157
+ /* @__PURE__ */ m("label", {
1158
+ className: H["bsy-mobile-editor__sheet-field"],
1159
+ children: [
1160
+ /* @__PURE__ */ p("span", {
1161
+ className: H["bsy-mobile-editor__sheet-label"],
1162
+ children: o("editor.linkUrl")
1163
+ }),
1164
+ /* @__PURE__ */ p("span", {
1165
+ className: `${H["bsy-mobile-editor__sheet-note"]} ${H["bsy-mobile-editor__sheet-note--hint"]}`,
1166
+ children: o("editor.linkAliasTip")
1167
+ }),
1168
+ /* @__PURE__ */ p("input", {
1169
+ value: c,
1170
+ placeholder: o("editor.linkTip"),
1171
+ onChange: (e) => l(e.target.value)
1172
+ })
1173
+ ]
1174
+ }),
1175
+ /* @__PURE__ */ m("label", {
1176
+ className: H["bsy-mobile-editor__sheet-field"],
1177
+ children: [/* @__PURE__ */ p("span", {
1178
+ className: H["bsy-mobile-editor__sheet-label"],
1179
+ children: o("editor.linkText")
1180
+ }), /* @__PURE__ */ p("input", {
1181
+ value: u,
1182
+ onChange: (e) => f(e.target.value)
1183
+ })]
1184
+ }),
1185
+ /* @__PURE__ */ m("label", {
1186
+ className: H["bsy-mobile-editor__check"],
1187
+ children: [
1188
+ /* @__PURE__ */ p("input", {
1189
+ className: H["bsy-mobile-editor__check-input"],
1190
+ type: "checkbox",
1191
+ checked: h,
1192
+ onChange: (e) => g(e.target.checked)
1193
+ }),
1194
+ /* @__PURE__ */ p("span", {
1195
+ className: H["bsy-mobile-editor__check-box"],
1196
+ "aria-hidden": !0,
1197
+ children: h ? /* @__PURE__ */ p(n, {
1198
+ name: "checkthebox",
1199
+ size: 12,
1200
+ color: "#fff"
1201
+ }) : null
1202
+ }),
1203
+ o("editor.linkNewBlank")
1204
+ ]
1205
+ })
1206
+ ]
1207
+ });
1208
+ }, _n = /^https?:\/\/.+/i, vn = ({ open: e, onClose: t, onConfirm: n }) => {
1209
+ let { t: i } = r(), [a, o] = d(""), [c, l] = d(null);
1210
+ return s(() => {
1211
+ e && (o(""), l(null));
1212
+ }, [e]), /* @__PURE__ */ p(hn, {
1213
+ open: e,
1214
+ title: i("editor.imageUrl"),
1215
+ onClose: t,
1216
+ onConfirm: () => {
1217
+ let e = a.trim();
1218
+ if (!e) {
1219
+ l(i("editor.imageUrlRequired"));
1220
+ return;
1221
+ }
1222
+ if (!_n.test(e)) {
1223
+ l(i("editor.imageUrlInvalid"));
1224
+ return;
1225
+ }
1226
+ n(e);
1227
+ },
1228
+ children: /* @__PURE__ */ m("label", {
1229
+ className: H["bsy-mobile-editor__sheet-field"],
1230
+ children: [
1231
+ /* @__PURE__ */ p("span", {
1232
+ className: H["bsy-mobile-editor__sheet-label"],
1233
+ children: i("editor.enterImageUrl")
1234
+ }),
1235
+ /* @__PURE__ */ p("span", {
1236
+ className: H["bsy-mobile-editor__sheet-note"],
1237
+ children: i("editor.imageUrlNote")
1238
+ }),
1239
+ /* @__PURE__ */ p("input", {
1240
+ value: a,
1241
+ placeholder: i("editor.imageUrlPlaceholder"),
1242
+ "aria-invalid": !!c,
1243
+ onChange: (e) => {
1244
+ o(e.target.value), c && l(null);
1245
+ }
1246
+ }),
1247
+ c ? /* @__PURE__ */ p("span", {
1248
+ className: H["bsy-mobile-editor__sheet-error"],
1249
+ children: c
1250
+ }) : null
1251
+ ]
1252
+ })
1253
+ });
1254
+ }, yn = ({ open: i, mode: a, originalHtml: o, ai: s, polishPreset: c, onClose: l, onApply: h, onPickPreset: g }) => {
1255
+ let { t: _ } = r(), v = u(null), [y, b] = d(!1), x = s?.status ?? "idle", S = s?.text ?? "", ee = a === "polish" ? Y(qt(o, S)) : dn(S).html, C = !!ee.trim(), w = dt({
1256
+ status: x,
1257
+ reasoning: s?.reasoning
1258
+ }, C, v), T = x === "ready" && C;
1259
+ return /* @__PURE__ */ m(e, {
1260
+ open: i,
1261
+ onClose: l,
1262
+ position: "bottom",
1263
+ closeOnClickOverlay: !1,
1264
+ children: [/* @__PURE__ */ m("div", {
1265
+ className: H["bsy-mobile-editor__ai"],
1266
+ style: { height: Fe },
1267
+ children: [
1268
+ /* @__PURE__ */ m("div", {
1269
+ className: H["bsy-mobile-editor__header"],
1270
+ children: [/* @__PURE__ */ p("div", {
1271
+ className: H["bsy-mobile-editor__title"],
1272
+ children: _(a === "polish" ? "editor.aiPolish" : "editor.aiTypeset")
1273
+ }), /* @__PURE__ */ p("button", {
1274
+ type: "button",
1275
+ className: H["bsy-mobile-editor__close"],
1276
+ "aria-label": _("popup.close"),
1277
+ onClick: l,
1278
+ children: /* @__PURE__ */ p(n, {
1279
+ name: "close",
1280
+ size: 18
1281
+ })
1282
+ })]
1283
+ }),
1284
+ /* @__PURE__ */ m("div", {
1285
+ className: H["bsy-mobile-editor__ai-body"],
1286
+ children: [
1287
+ /* @__PURE__ */ m("section", {
1288
+ className: H["bsy-mobile-editor__ai-section"],
1289
+ children: [
1290
+ /* @__PURE__ */ m("div", {
1291
+ className: H["bsy-mobile-editor__ai-section-head"],
1292
+ children: [/* @__PURE__ */ m("div", {
1293
+ className: `${H["bsy-mobile-editor__ai-label"]} ${H["bsy-mobile-editor__ai-label--after"]}`,
1294
+ children: [/* @__PURE__ */ p("span", { className: H["bsy-mobile-editor__ai-dot"] }), _("editor.aiOptimized")]
1295
+ }), a === "polish" ? /* @__PURE__ */ m("button", {
1296
+ type: "button",
1297
+ className: H["bsy-mobile-editor__ai-preset"],
1298
+ onClick: () => b(!0),
1299
+ children: [_(G[c]), /* @__PURE__ */ p(n, {
1300
+ name: "arrow-down",
1301
+ size: 16
1302
+ })]
1303
+ }) : null]
1304
+ }),
1305
+ w.visible ? /* @__PURE__ */ p("div", {
1306
+ className: H["bsy-mobile-editor__ai-think-pin"],
1307
+ children: /* @__PURE__ */ p(ft, { model: w })
1308
+ }) : null,
1309
+ /* @__PURE__ */ p("div", {
1310
+ ref: v,
1311
+ className: H["bsy-mobile-editor__ai-section-scroll"],
1312
+ children: x === "error" ? /* @__PURE__ */ p("p", {
1313
+ className: H["bsy-mobile-editor__ai-error"],
1314
+ children: s?.errorMessage || _("editor.aiError")
1315
+ }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(pt, { model: w }), C ? /* @__PURE__ */ p(lt, { html: ee }) : null] })
1316
+ })
1317
+ ]
1318
+ }),
1319
+ /* @__PURE__ */ p("div", { className: H["bsy-mobile-editor__ai-split"] }),
1320
+ /* @__PURE__ */ m("section", {
1321
+ className: H["bsy-mobile-editor__ai-section"],
1322
+ children: [/* @__PURE__ */ p("div", {
1323
+ className: H["bsy-mobile-editor__ai-section-head"],
1324
+ children: /* @__PURE__ */ m("div", {
1325
+ className: `${H["bsy-mobile-editor__ai-label"]} ${H["bsy-mobile-editor__ai-label--before"]}`,
1326
+ children: [/* @__PURE__ */ p("span", { className: H["bsy-mobile-editor__ai-dot"] }), _("editor.aiOriginal")]
1327
+ })
1328
+ }), /* @__PURE__ */ p("div", {
1329
+ className: H["bsy-mobile-editor__ai-section-scroll"],
1330
+ children: /* @__PURE__ */ p(lt, { html: o })
1331
+ })]
1332
+ })
1333
+ ]
1334
+ }),
1335
+ /* @__PURE__ */ m("div", {
1336
+ className: H["bsy-mobile-editor__ai-footer"],
1337
+ children: [/* @__PURE__ */ p("button", {
1338
+ type: "button",
1339
+ onClick: l,
1340
+ children: _("editor.aiAbandon")
1341
+ }), /* @__PURE__ */ p("button", {
1342
+ type: "button",
1343
+ className: H["bsy-mobile-editor__ai-footer-ok"],
1344
+ disabled: !T,
1345
+ onClick: h,
1346
+ children: _("editor.aiApply")
1347
+ })]
1348
+ })
1349
+ ]
1350
+ }), a === "polish" ? /* @__PURE__ */ p(t, {
1351
+ mode: "menu",
1352
+ open: y,
1353
+ title: _("editor.aiPolish"),
1354
+ onClose: () => b(!1),
1355
+ actions: W.map((e) => ({
1356
+ key: e,
1357
+ text: _(G[e])
1358
+ })),
1359
+ onAction: (e) => g(e.key)
1360
+ }) : null]
1361
+ });
1362
+ }, bn = "M896 860.48V960H128v-99.52h768zM578.944 128l251.648 655.936h-115.2l-59.904-164.48H379.904L320 784H204.8L456.384 128h122.56z m-58.944 115.776h-3.712L412.16 531.2h211.072L520 243.84z", xn = "M766.4 744.32c43.712 0 79.36-36.224 79.36-80.512 0-53.504-79.36-140.8-79.36-140.8s-79.36 87.296-79.36 140.8c0 44.288 35.648 80.512 79.36 80.512z m-377.088-44.16c7.04 7.168 18.56 7.168 25.6 0l256.064-256c7.104-7.04 7.104-18.56 0-25.6l-256-256a16.32 16.32 0 0 0-1.92-1.664L334.72 82.688a9.088 9.088 0 0 0-12.8 0l-48 48a9.088 9.088 0 0 0 0 12.8l67.2 67.2-207.808 207.936c-7.04 7.04-7.04 18.56 0 25.6l255.936 256z m12.864-448.576L581.12 430.528H223.36L402.24 251.52z m501.824 564.416H120a8 8 0 0 0-8 8v80c0 4.416 3.584 8 8 8h784a8 8 0 0 0 8-8v-80a8 8 0 0 0-8-8z", Sn = 860.48, Cn = 99.52, wn = /rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0(?:\.0+)?\s*\)/, Tn = {
1363
+ fontColor: {
1364
+ path: bn,
1365
+ clipHeight: Sn,
1366
+ x: 128,
1367
+ width: 768,
1368
+ rx: 0
1369
+ },
1370
+ fill: {
1371
+ path: xn,
1372
+ clipHeight: 816,
1373
+ x: 112,
1374
+ width: 800,
1375
+ rx: 8
1376
+ }
1377
+ }, En = (e, t) => {
1378
+ let n = t.trim().toLowerCase();
1379
+ if (e === "fill") return !n || n === "transparent" || wn.test(n);
1380
+ let r = n.replace(/\s+/g, "");
1381
+ return r === "#000" || r === "#000000" || r === "black" || r === "rgb(0,0,0)" || r === "rgba(0,0,0,1)" || r === "rgba(0,0,0,1.0)";
1382
+ }, Dn = ({ variant: e, barColor: t, size: n }) => {
1383
+ let r = `${c().replace(/:/g, "")}clip`, i = Tn[e];
1384
+ return /* @__PURE__ */ m("svg", {
1385
+ width: n,
1386
+ height: n,
1387
+ viewBox: "0 0 1024 1024",
1388
+ "aria-hidden": "true",
1389
+ children: [
1390
+ /* @__PURE__ */ p("defs", { children: /* @__PURE__ */ p("clipPath", {
1391
+ id: r,
1392
+ children: /* @__PURE__ */ p("rect", {
1393
+ x: 0,
1394
+ y: 0,
1395
+ width: 1024,
1396
+ height: i.clipHeight
1397
+ })
1398
+ }) }),
1399
+ /* @__PURE__ */ p("path", {
1400
+ d: i.path,
1401
+ fill: "currentColor",
1402
+ clipPath: `url(#${r})`
1403
+ }),
1404
+ /* @__PURE__ */ p("rect", {
1405
+ x: i.x,
1406
+ y: Sn,
1407
+ width: i.width,
1408
+ height: Cn,
1409
+ rx: i.rx,
1410
+ fill: En(e, t) ? "currentColor" : t
1411
+ })
1412
+ ]
1413
+ });
1414
+ }, On = {
1415
+ bold: !1,
1416
+ italic: !1,
1417
+ underline: !1,
1418
+ strikethrough: !1,
1419
+ fontColor: U,
1420
+ backgroundColor: Ae,
1421
+ align: "left",
1422
+ listType: !1,
1423
+ canOutdent: !1,
1424
+ headingTag: !1,
1425
+ hasEditorText: !1
1426
+ }, kn = (e) => e === "center" || e === "right" || e === "left" ? e : e === "end" ? "right" : "left", An = () => {
1427
+ let [e] = z(), [t, n] = d(On);
1428
+ return s(() => e.registerUpdateListener(({ editorState: e }) => {
1429
+ e.read(() => {
1430
+ let e = j(), t = !!A().getTextContent().trim();
1431
+ if (!M(e)) {
1432
+ n((e) => ({
1433
+ ...e,
1434
+ hasEditorText: t
1435
+ }));
1436
+ return;
1437
+ }
1438
+ let r = Ee(e, "color", U), i = Ee(e, "background-color", Ae), a = e.anchor.getNode(), o = a.getKey() === "root" ? a : B(a, (e) => {
1439
+ let t = e.getParent();
1440
+ return t !== null && N(t);
1441
+ });
1442
+ o === null && (o = a.getTopLevelElementOrThrow());
1443
+ let s = B(a, S), c = !1, l = se(o) ? o.getIndent() : 0;
1444
+ if (S(s)) {
1445
+ l = s.getIndent();
1446
+ let e = s.getParent();
1447
+ if (ee(e)) {
1448
+ let t = e.getListType();
1449
+ c = t === "number" || t === "bullet" ? t : !1;
1450
+ }
1451
+ }
1452
+ let u = B(a, D), d = D(u) ? u.getTag() : void 0;
1453
+ n({
1454
+ bold: e.hasFormat("bold"),
1455
+ italic: e.hasFormat("italic"),
1456
+ underline: e.hasFormat("underline"),
1457
+ strikethrough: e.hasFormat("strikethrough"),
1458
+ fontColor: r,
1459
+ backgroundColor: i,
1460
+ align: kn(se(o) ? o.getFormatType() : ""),
1461
+ listType: c,
1462
+ canOutdent: l > 0 || c !== !1,
1463
+ headingTag: d === "h1" || d === "h2" || d === "h3" ? d : !1,
1464
+ hasEditorText: t
1465
+ });
1466
+ });
1467
+ }), [e]), t;
1468
+ }, jn = (...e) => e.filter(Boolean).join(" "), Mn = (e) => e.buttons.map((e) => ({
1469
+ name: typeof e == "string" ? e : e.name,
1470
+ disabled: typeof e != "string" && !!e.props?.disabled
1471
+ })), Q = 24, Nn = 20, $ = ({ active: e, disabled: t, expanded: n, label: r, select: i, selectAlign: a, onClick: o, children: s }) => /* @__PURE__ */ p("button", {
1472
+ type: "button",
1473
+ className: jn(H["bsy-mobile-editor__tool"], i && H["bsy-mobile-editor__tool--select"], a && H["bsy-mobile-editor__tool--select-align"], e && H["bsy-mobile-editor__tool--active"]),
1474
+ "aria-label": r,
1475
+ "aria-pressed": e,
1476
+ "aria-expanded": i ? !!n : void 0,
1477
+ disabled: t,
1478
+ onClick: o,
1479
+ children: s
1480
+ }), Pn = ({ open: e }) => /* @__PURE__ */ p(n, {
1481
+ name: "arrow-down",
1482
+ size: Nn,
1483
+ className: jn(H["bsy-mobile-editor__tool-caret"], e && H["bsy-mobile-editor__tool-caret--open"])
1484
+ }), Fn = ({ config: e, openSheet: t, onOpenSheet: i, onOpenLink: a }) => {
1485
+ let [o] = z(), c = An(), { t: l } = r(), d = u(null), f = u(null), h = u(null), g = () => {
1486
+ let e = d.current, t = f.current, n = h.current;
1487
+ if (!e || !t || !n) return;
1488
+ let { scrollLeft: r, scrollWidth: i, clientWidth: a } = e, o = i > a + 1, s = o ? Math.max(16, a / i * 80) : 46, c = i - a, l = o && c > 0 ? (80 - s) * (r / c) : 0;
1489
+ t.hidden = !o, o && (n.style.width = `${s}px`, n.style.transform = `translateX(${l}px)`);
1490
+ };
1491
+ s(() => {
1492
+ let e = d.current;
1493
+ if (!e) return;
1494
+ g();
1495
+ let t = new ResizeObserver(g);
1496
+ return t.observe(e), () => t.disconnect();
1497
+ }, [e]);
1498
+ let _ = ({ name: e, disabled: r }) => {
1499
+ switch (e) {
1500
+ case "bold": return /* @__PURE__ */ p($, {
1501
+ active: c.bold,
1502
+ disabled: r,
1503
+ label: l("editor.bold"),
1504
+ onClick: () => o.dispatchCommand(F, "bold"),
1505
+ children: /* @__PURE__ */ p(n, {
1506
+ name: "bold",
1507
+ size: Q
1508
+ })
1509
+ }, e);
1510
+ case "italic": return /* @__PURE__ */ p($, {
1511
+ active: c.italic,
1512
+ disabled: r,
1513
+ label: l("editor.italic"),
1514
+ onClick: () => o.dispatchCommand(F, "italic"),
1515
+ children: /* @__PURE__ */ p(n, {
1516
+ name: "italic",
1517
+ size: Q
1518
+ })
1519
+ }, e);
1520
+ case "underline": return /* @__PURE__ */ p($, {
1521
+ active: c.underline,
1522
+ disabled: r,
1523
+ label: l("editor.underline"),
1524
+ onClick: () => o.dispatchCommand(F, "underline"),
1525
+ children: /* @__PURE__ */ p(n, {
1526
+ name: "underline",
1527
+ size: Q
1528
+ })
1529
+ }, e);
1530
+ case "strikethrough": return /* @__PURE__ */ p($, {
1531
+ active: c.strikethrough,
1532
+ disabled: r,
1533
+ label: l("editor.strikethrough"),
1534
+ onClick: () => o.dispatchCommand(F, "strikethrough"),
1535
+ children: /* @__PURE__ */ p(n, {
1536
+ name: "shanchuxian",
1537
+ size: Q
1538
+ })
1539
+ }, e);
1540
+ case "outdent": return /* @__PURE__ */ p($, {
1541
+ disabled: r || !c.canOutdent,
1542
+ label: l("editor.outdent"),
1543
+ onClick: () => o.dispatchCommand(me, void 0),
1544
+ children: /* @__PURE__ */ p(n, {
1545
+ name: "jianshaosuojin",
1546
+ size: Q
1547
+ })
1548
+ }, e);
1549
+ case "indent": return /* @__PURE__ */ p($, {
1550
+ disabled: r,
1551
+ label: l("editor.indent"),
1552
+ onClick: () => o.dispatchCommand(I, void 0),
1553
+ children: /* @__PURE__ */ p(n, {
1554
+ name: "zengjiasuojin",
1555
+ size: Q
1556
+ })
1557
+ }, e);
1558
+ case "bullet": return /* @__PURE__ */ p($, {
1559
+ active: c.listType === "bullet",
1560
+ disabled: r,
1561
+ label: l("editor.bulletList"),
1562
+ onClick: () => o.dispatchCommand(c.listType === "bullet" ? E : w, void 0),
1563
+ children: /* @__PURE__ */ p(n, {
1564
+ name: "xuhaoliebiao",
1565
+ size: Q
1566
+ })
1567
+ }, e);
1568
+ case "number": return /* @__PURE__ */ p($, {
1569
+ active: c.listType === "number",
1570
+ disabled: r,
1571
+ label: l("editor.numberList"),
1572
+ onClick: () => o.dispatchCommand(c.listType === "number" ? E : C, void 0),
1573
+ children: /* @__PURE__ */ p(n, {
1574
+ name: "bianhaoliebiao",
1575
+ size: Q
1576
+ })
1577
+ }, e);
1578
+ case "align": return /* @__PURE__ */ m($, {
1579
+ select: !0,
1580
+ selectAlign: !0,
1581
+ expanded: t === "align",
1582
+ active: t === "align",
1583
+ disabled: r,
1584
+ label: l("editor.alignment"),
1585
+ onClick: () => i("align"),
1586
+ children: [/* @__PURE__ */ p(n, {
1587
+ name: c.align === "center" ? "paragraphmiddle" : c.align === "right" ? "paragraphright" : "paragraph",
1588
+ size: Q
1589
+ }), /* @__PURE__ */ p(Pn, { open: t === "align" })]
1590
+ }, e);
1591
+ case "heading": return /* @__PURE__ */ m($, {
1592
+ select: !0,
1593
+ selectAlign: !0,
1594
+ expanded: t === "heading",
1595
+ active: t === "heading",
1596
+ disabled: r,
1597
+ label: l("editor.heading"),
1598
+ onClick: () => i("heading"),
1599
+ children: [/* @__PURE__ */ p("span", {
1600
+ className: H["bsy-mobile-editor__tool-text"],
1601
+ children: c.headingTag ? c.headingTag.toUpperCase() : l("editor.paragraph")
1602
+ }), /* @__PURE__ */ p(Pn, { open: t === "heading" })]
1603
+ }, e);
1604
+ case "fontSize": return /* @__PURE__ */ p($, {
1605
+ active: t === "fontSize",
1606
+ disabled: r || !!c.headingTag,
1607
+ label: l("editor.fontSize"),
1608
+ onClick: () => i("fontSize"),
1609
+ children: /* @__PURE__ */ p(n, {
1610
+ name: "fontsize",
1611
+ size: Q
1612
+ })
1613
+ }, e);
1614
+ case "fontColor": return /* @__PURE__ */ p($, {
1615
+ active: t === "fontColor",
1616
+ disabled: r,
1617
+ label: l("editor.fontColor"),
1618
+ onClick: () => i("fontColor"),
1619
+ children: /* @__PURE__ */ p(Dn, {
1620
+ variant: "fontColor",
1621
+ barColor: c.fontColor,
1622
+ size: Q
1623
+ })
1624
+ }, e);
1625
+ case "fill": return /* @__PURE__ */ p($, {
1626
+ active: t === "fill",
1627
+ disabled: r,
1628
+ label: l("editor.fill"),
1629
+ onClick: () => i("fill"),
1630
+ children: /* @__PURE__ */ p(Dn, {
1631
+ variant: "fill",
1632
+ barColor: c.backgroundColor,
1633
+ size: Q
1634
+ })
1635
+ }, e);
1636
+ case "picture": return /* @__PURE__ */ m($, {
1637
+ select: !0,
1638
+ expanded: t === "picture",
1639
+ active: t === "picture",
1640
+ disabled: r,
1641
+ label: l("editor.picture"),
1642
+ onClick: () => i("picture"),
1643
+ children: [/* @__PURE__ */ p(n, {
1644
+ name: "picture",
1645
+ size: Q
1646
+ }), /* @__PURE__ */ p(Pn, { open: t === "picture" })]
1647
+ }, e);
1648
+ case "link": return /* @__PURE__ */ p($, {
1649
+ disabled: r,
1650
+ label: l("editor.link"),
1651
+ onClick: a,
1652
+ children: /* @__PURE__ */ p(n, {
1653
+ name: "Insertlink",
1654
+ size: Q
1655
+ })
1656
+ }, e);
1657
+ case "ai": {
1658
+ let n = t === "ai" || t === "aiPreset";
1659
+ return /* @__PURE__ */ m($, {
1660
+ select: !0,
1661
+ expanded: n,
1662
+ active: n,
1663
+ disabled: r || !c.hasEditorText,
1664
+ label: l("editor.ai"),
1665
+ onClick: () => i("ai"),
1666
+ children: [/* @__PURE__ */ p("img", {
1667
+ src: Xe,
1668
+ alt: "",
1669
+ width: Q,
1670
+ height: Q,
1671
+ className: H["bsy-mobile-editor__ai-icon"],
1672
+ draggable: !1
1673
+ }), /* @__PURE__ */ p(Pn, { open: n })]
1674
+ }, e);
1675
+ }
1676
+ default: return null;
1677
+ }
1678
+ };
1679
+ return /* @__PURE__ */ m("div", {
1680
+ className: H["bsy-mobile-editor__toolbar"],
1681
+ children: [/* @__PURE__ */ p("div", {
1682
+ ref: d,
1683
+ className: H["bsy-mobile-editor__toolbar-scroller"],
1684
+ onScroll: g,
1685
+ children: e.map((e, t) => {
1686
+ let n = Mn(e);
1687
+ return n.length ? /* @__PURE__ */ m("div", {
1688
+ className: H["bsy-mobile-editor__toolbar-group"],
1689
+ children: [t > 0 ? /* @__PURE__ */ p("span", { className: H["bsy-mobile-editor__toolbar-divider"] }) : null, n.map(_)]
1690
+ }, e.key) : null;
1691
+ })
1692
+ }), /* @__PURE__ */ p("div", {
1693
+ ref: f,
1694
+ className: H["bsy-mobile-editor__toolbar-track"],
1695
+ hidden: !0,
1696
+ "aria-hidden": !0,
1697
+ children: /* @__PURE__ */ p("div", {
1698
+ ref: h,
1699
+ className: H["bsy-mobile-editor__toolbar-thumb"]
1700
+ })
1701
+ })]
1702
+ });
1703
+ }, In = (e) => Ne.includes(e.name.split(".").pop()?.toLowerCase() ?? ""), Ln = (e) => In(e) ? e.size > 5242880 ? "size" : null : "type", Rn = (e) => {
1704
+ let t = "", n = "", r = "";
1705
+ return e.getEditorState().read(() => {
1706
+ n = A().getTextContent(), t = Mt(Y(_e(e, null))), r = Wt(t).join(`\n\n${Nt}\n\n`);
1707
+ }, { editor: e }), {
1708
+ html: t,
1709
+ text: n,
1710
+ polishText: r
1711
+ };
1712
+ }, zn = (e) => e.startsWith("@") ? "javascript:void(0);" : e.match(/^https?:\/\//) ? e : `http://${e}`, Bn = (e) => new Promise((t, n) => {
1713
+ let r = new FileReader();
1714
+ r.onload = () => t(String(r.result)), r.onerror = () => n(r.error), r.readAsDataURL(e);
1715
+ }), Vn = ({ value: t, onChange: n, open: i, onOpenChange: o, toolbar: c, upload: l, ai: f }) => {
1716
+ let [h] = z(), { t: g } = r(), [b, x] = d(!1), S = i ?? b, ee = (e) => {
1717
+ o?.(e), i === void 0 && x(e);
1718
+ }, [C, w] = d(null), T = u(!1), [te, E] = d(null), [ne, D] = d(!1), O = u(null), re = u(null), N = u(null), de = u(/* @__PURE__ */ new Map()), fe = u(null), pe = u(n);
1719
+ pe.current = n;
1720
+ let P = u(f);
1721
+ P.current = f;
1722
+ let [F, I] = d(null), [me, he] = d({
1723
+ html: "",
1724
+ text: "",
1725
+ polishText: ""
1726
+ }), [ge, L] = d("quick"), [R, Te] = d(0), [Ee, V] = d({}), De = c?.config ?? Me, Oe = () => {
1727
+ N.current?.abort(), N.current = null, P.current?.stop?.(), I(null), w(null), E(null), D(!1), ee(!1);
1728
+ };
1729
+ s(() => {
1730
+ if (!S) return;
1731
+ let e = window.visualViewport;
1732
+ if (!e) return;
1733
+ let t = () => {
1734
+ Te(Math.max(0, window.innerHeight - e.height - e.offsetTop));
1735
+ };
1736
+ return e.addEventListener("resize", t), e.addEventListener("scroll", t), t(), () => {
1737
+ e.removeEventListener("resize", t), e.removeEventListener("scroll", t);
1738
+ };
1739
+ }, [S]), s(() => {
1740
+ S || (N.current?.abort(), N.current = null);
1741
+ }, [S]), s(() => {
1742
+ if (!S) return;
1743
+ h.setEditable(!0);
1744
+ let e = window.requestAnimationFrame(() => h.focus());
1745
+ return () => window.cancelAnimationFrame(e);
1746
+ }, [S, h]), s(() => {
1747
+ t === void 0 || t === fe.current || (fe.current = t ?? null, h.update(() => {
1748
+ gt(h, t?.trim() ? Y(t) : "");
1749
+ }));
1750
+ }, [t, h]);
1751
+ let ke = a((e) => {
1752
+ e.read(() => {
1753
+ let t = A().getTextContent(), n = Mt(Y(_e(h, null))), r = _t(n, t) ? null : n;
1754
+ fe.current = r;
1755
+ let i = le(Be).map((e) => de.current.get(e.getSrc())).filter((e) => e !== void 0);
1756
+ pe.current({
1757
+ text: t,
1758
+ html: r,
1759
+ attachments: i
1760
+ }, e);
1761
+ }, { editor: h });
1762
+ }, [h]), U = () => {
1763
+ h.getEditorState().read(() => {
1764
+ O.current = j()?.clone() ?? null;
1765
+ });
1766
+ }, Ae = () => {
1767
+ U(), h.getEditorState().read(() => {
1768
+ let e = j(), t = M(e) ? e.anchor.getNode() : null, n = t ? B(t, v) : null;
1769
+ if (n) {
1770
+ E({
1771
+ url: n.getURL(),
1772
+ text: n.getTextContent(),
1773
+ newBlank: n.getTarget() === "_blank"
1774
+ });
1775
+ return;
1776
+ }
1777
+ E({
1778
+ url: "",
1779
+ text: M(e) ? e.getTextContent() : "",
1780
+ newBlank: !0
1781
+ });
1782
+ });
1783
+ }, je = (e) => {
1784
+ if (!e.url.trim()) return;
1785
+ let t = zn(e.url.trim());
1786
+ h.update(() => {
1787
+ let n = O.current;
1788
+ n !== null && ue(n);
1789
+ let r = j(), i = e.newBlank ? {
1790
+ target: "_blank",
1791
+ rel: "noopener noreferrer",
1792
+ title: e.url
1793
+ } : { title: e.url };
1794
+ if (M(r)) {
1795
+ let n = e.text.trim() || e.url;
1796
+ if (r.getTextContent()) y(t, i);
1797
+ else {
1798
+ let e = ie(n), a = _(t, i);
1799
+ a.append(e), r.insertNodes([a]);
1800
+ }
1801
+ } else {
1802
+ let n = ie(e.text.trim() || e.url), r = _(t, i);
1803
+ r.append(n);
1804
+ let a = A(), o = a.getLastChild();
1805
+ if (se(o)) o.append(r);
1806
+ else {
1807
+ let e = k();
1808
+ e.append(r), a.append(e);
1809
+ }
1810
+ }
1811
+ }), E(null);
1812
+ }, W = (e, t, n) => {
1813
+ let r = "";
1814
+ return h.update(() => {
1815
+ let i = O.current;
1816
+ i !== null && ue(i), j() === null && A().selectEnd();
1817
+ let a = He({
1818
+ src: e,
1819
+ altText: t,
1820
+ dataId: n
1821
+ });
1822
+ r = a.getKey(), oe([a]);
1823
+ for (let e of a.getParent()?.getChildren() ?? []) ce(e) && e.getTextContentSize() === 0 && e.remove();
1824
+ }), r;
1825
+ }, G = async (e) => {
1826
+ let t = e.target.files?.[0];
1827
+ if (e.target.value = "", !t || Ln(t)) return;
1828
+ N.current?.abort();
1829
+ let n = new AbortController();
1830
+ if (N.current = n, !l?.customRequest) {
1831
+ try {
1832
+ let e = await Bn(t);
1833
+ if (!e || n.signal.aborted) return;
1834
+ W(e, t.name);
1835
+ } catch {
1836
+ return;
1837
+ } finally {
1838
+ N.current === n && (N.current = null);
1839
+ }
1840
+ return;
1841
+ }
1842
+ let r = URL.createObjectURL(t), i = W(r, t.name);
1843
+ V((e) => ({
1844
+ ...e,
1845
+ [i]: void 0
1846
+ }));
1847
+ let a = !1, o = (e) => {
1848
+ a || (a = !0, URL.revokeObjectURL(r), e || h.update(() => {
1849
+ ae(i)?.remove();
1850
+ }), V((e) => {
1851
+ let t = { ...e };
1852
+ return delete t[i], t;
1853
+ }), N.current === n && (N.current = null));
1854
+ };
1855
+ n.signal.addEventListener("abort", () => o(!1));
1856
+ try {
1857
+ let e = await l.customRequest(t, {
1858
+ signal: n.signal,
1859
+ onProgress: (e) => {
1860
+ if (!Number.isFinite(e)) return;
1861
+ let t = Math.min(100, Math.max(0, e));
1862
+ V((e) => i in e ? {
1863
+ ...e,
1864
+ [i]: t
1865
+ } : e);
1866
+ }
1867
+ });
1868
+ if (n.signal.aborted) {
1869
+ o(!1);
1870
+ return;
1871
+ }
1872
+ let r = "", a;
1873
+ if (typeof e == "string" ? r = e : (r = e.url, e.attachment && (de.current.set(r, e.attachment), a = e.attachment._id)), !r) {
1874
+ o(!1);
1875
+ return;
1876
+ }
1877
+ h.update(() => {
1878
+ let e = ae(i);
1879
+ Ve(e) && (e.setSrc(r), a && e.setDataId(a));
1880
+ }), o(!0);
1881
+ } catch {
1882
+ o(!1);
1883
+ }
1884
+ }, Ne = () => {
1885
+ let e = Rn(h);
1886
+ he(e), w(null), I("typeset"), P.current?.typeset?.({
1887
+ html: e.html,
1888
+ text: e.text
1889
+ });
1890
+ }, Fe = (e) => {
1891
+ let t = Rn(h);
1892
+ he(t), L(e), w(null), I("polish"), P.current?.stop?.(), P.current?.polish?.({
1893
+ text: t.polishText,
1894
+ preset: e
1895
+ });
1896
+ }, K = () => {
1897
+ P.current?.stop?.(), I(null);
1898
+ };
1899
+ return /* @__PURE__ */ p(e, {
1900
+ open: S,
1901
+ onClose: Oe,
1902
+ position: "bottom",
1903
+ closeOnClickOverlay: !0,
1904
+ children: /* @__PURE__ */ p(Ie.Provider, {
1905
+ value: Ee,
1906
+ children: /* @__PURE__ */ m("div", {
1907
+ className: H["bsy-mobile-editor"],
1908
+ style: {
1909
+ height: 300,
1910
+ transform: R ? `translate3d(0, -${R}px, 0)` : void 0
1911
+ },
1912
+ children: [
1913
+ /* @__PURE__ */ p("div", {
1914
+ className: H["bsy-mobile-editor__label"],
1915
+ children: /* @__PURE__ */ p("div", {
1916
+ className: H["bsy-mobile-editor__label-text"],
1917
+ children: g("editor.title")
1918
+ })
1919
+ }),
1920
+ /* @__PURE__ */ p("div", {
1921
+ className: H["bsy-mobile-editor__content"],
1922
+ style: { height: 200 },
1923
+ children: /* @__PURE__ */ p(Ce, {
1924
+ contentEditable: /* @__PURE__ */ p(ve, { className: H["bsy-mobile-editor__editable"] }),
1925
+ ErrorBoundary: we
1926
+ })
1927
+ }),
1928
+ De.length > 0 ? /* @__PURE__ */ p(Fn, {
1929
+ config: De,
1930
+ openSheet: C,
1931
+ onOpenSheet: w,
1932
+ onOpenLink: Ae
1933
+ }) : null,
1934
+ /* @__PURE__ */ p(ye, {}),
1935
+ /* @__PURE__ */ p(xe, {}),
1936
+ /* @__PURE__ */ p(be, {}),
1937
+ /* @__PURE__ */ p(Ye, {}),
1938
+ /* @__PURE__ */ p(Ge, {}),
1939
+ /* @__PURE__ */ p(qe, {}),
1940
+ /* @__PURE__ */ p(Se, {
1941
+ onChange: ke,
1942
+ ignoreSelectionChange: !0
1943
+ }),
1944
+ /* @__PURE__ */ p("input", {
1945
+ ref: re,
1946
+ type: "file",
1947
+ accept: Pe,
1948
+ hidden: !0,
1949
+ onChange: G
1950
+ }),
1951
+ /* @__PURE__ */ p(mn, {
1952
+ sheet: C,
1953
+ onClose: () => {
1954
+ if (T.current) {
1955
+ T.current = !1;
1956
+ return;
1957
+ }
1958
+ w(null);
1959
+ },
1960
+ onTypeset: Ne,
1961
+ onPolishMenu: () => {
1962
+ T.current = !0, w("aiPreset");
1963
+ },
1964
+ onPickPreset: Fe,
1965
+ onPicture: (e) => {
1966
+ if (U(), e === "upload") {
1967
+ re.current?.click();
1968
+ return;
1969
+ }
1970
+ D(!0);
1971
+ },
1972
+ canTypeset: !!f?.typeset,
1973
+ canPolish: !!f?.polish
1974
+ }),
1975
+ /* @__PURE__ */ p(gn, {
1976
+ open: te !== null,
1977
+ seed: te,
1978
+ onClose: () => E(null),
1979
+ onConfirm: je
1980
+ }),
1981
+ /* @__PURE__ */ p(vn, {
1982
+ open: ne,
1983
+ onClose: () => D(!1),
1984
+ onConfirm: (e) => {
1985
+ W(e, e), D(!1);
1986
+ }
1987
+ }),
1988
+ /* @__PURE__ */ p(yn, {
1989
+ open: F !== null,
1990
+ mode: F,
1991
+ originalHtml: me.html,
1992
+ ai: f,
1993
+ polishPreset: ge,
1994
+ onClose: K,
1995
+ onApply: () => {
1996
+ let e = P.current?.text ?? "";
1997
+ if (F === "typeset") {
1998
+ let t = Y(dn(e).html);
1999
+ if (!t.trim()) return;
2000
+ h.update(() => {
2001
+ gt(h, t);
2002
+ });
2003
+ } else F === "polish" && Jt(h, e);
2004
+ K();
2005
+ },
2006
+ onPickPreset: Fe
2007
+ })
2008
+ ]
2009
+ })
2010
+ })
2011
+ });
2012
+ }, Hn = {
2013
+ namespace: "bsyLexicalEditor",
2014
+ onError: (e) => {
2015
+ console.error("Lexical error", e);
2016
+ },
2017
+ editable: !0,
2018
+ theme: {
2019
+ text: {
2020
+ bold: "editor-text-bold",
2021
+ italic: "editor-text-italic",
2022
+ underline: "editor-text-underline",
2023
+ strikethrough: "editor-text-strikethrough",
2024
+ underlineStrikethrough: "editor-text-underline-strikethrough"
2025
+ },
2026
+ list: {
2027
+ ul: "editor-list-ul",
2028
+ ol: "editor-list-ol",
2029
+ listitem: "editor-listitem",
2030
+ nested: { listitem: "editor-nested-listitem" }
2031
+ },
2032
+ heading: {
2033
+ h1: "editor-heading-h1",
2034
+ h2: "editor-heading-h2",
2035
+ h3: "editor-heading-h3"
2036
+ },
2037
+ link: "editor-link"
2038
+ },
2039
+ nodes: [
2040
+ x,
2041
+ b,
2042
+ te,
2043
+ T,
2044
+ O,
2045
+ Be,
2046
+ q,
2047
+ {
2048
+ replace: L,
2049
+ with: (e) => new q(e.__text),
2050
+ withKlass: q
2051
+ }
2052
+ ]
2053
+ }, Un = (e) => /* @__PURE__ */ p(g, {
2054
+ initialConfig: Hn,
2055
+ children: /* @__PURE__ */ p(Vn, { ...e })
2056
+ });
2057
+ Un.displayName = "BsyMobileEditor";
2058
+ //#endregion
2059
+ export { lt as n, Un as t };