@qwanyx/stack 0.2.44 → 0.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +19 -19
- package/dist/index.esm.js +408 -404
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ var Oa = Object.defineProperty;
|
|
|
2
2
|
var Ma = (r, e, t) => e in r ? Oa(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var Ir = (r, e, t) => Ma(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as As from "react";
|
|
5
|
-
import Je, { useState as H, useCallback as re, useEffect as De, useMemo as bt, useRef as
|
|
5
|
+
import Je, { useState as H, useCallback as re, useEffect as De, useMemo as bt, useRef as be, createContext as Ia, useContext as $a, useLayoutEffect as jr, Suspense as za, forwardRef as al } from "react";
|
|
6
6
|
import { flushSync as qa, createPortal as Ua } from "react-dom";
|
|
7
7
|
class xf {
|
|
8
8
|
constructor(e) {
|
|
@@ -4157,17 +4157,17 @@ function pu() {
|
|
|
4157
4157
|
return null;
|
|
4158
4158
|
}
|
|
4159
4159
|
var j = Object.assign, O = 0, X, de, ie, oe, ve, pe, we;
|
|
4160
|
-
function
|
|
4160
|
+
function ke() {
|
|
4161
4161
|
}
|
|
4162
|
-
|
|
4163
|
-
function
|
|
4162
|
+
ke.__reactDisabledLog = !0;
|
|
4163
|
+
function Me() {
|
|
4164
4164
|
{
|
|
4165
4165
|
if (O === 0) {
|
|
4166
4166
|
X = console.log, de = console.info, ie = console.warn, oe = console.error, ve = console.group, pe = console.groupCollapsed, we = console.groupEnd;
|
|
4167
4167
|
var _ = {
|
|
4168
4168
|
configurable: !0,
|
|
4169
4169
|
enumerable: !0,
|
|
4170
|
-
value:
|
|
4170
|
+
value: ke,
|
|
4171
4171
|
writable: !0
|
|
4172
4172
|
};
|
|
4173
4173
|
Object.defineProperties(console, {
|
|
@@ -4183,7 +4183,7 @@ function pu() {
|
|
|
4183
4183
|
O++;
|
|
4184
4184
|
}
|
|
4185
4185
|
}
|
|
4186
|
-
function
|
|
4186
|
+
function Te() {
|
|
4187
4187
|
{
|
|
4188
4188
|
if (O--, O === 0) {
|
|
4189
4189
|
var _ = {
|
|
@@ -4219,7 +4219,7 @@ function pu() {
|
|
|
4219
4219
|
}
|
|
4220
4220
|
}
|
|
4221
4221
|
var Ce = C.ReactCurrentDispatcher, Ve;
|
|
4222
|
-
function
|
|
4222
|
+
function qe(_, P, G) {
|
|
4223
4223
|
{
|
|
4224
4224
|
if (Ve === void 0)
|
|
4225
4225
|
try {
|
|
@@ -4232,16 +4232,16 @@ function pu() {
|
|
|
4232
4232
|
` + Ve + _;
|
|
4233
4233
|
}
|
|
4234
4234
|
}
|
|
4235
|
-
var ge = !1,
|
|
4235
|
+
var ge = !1, Ie;
|
|
4236
4236
|
{
|
|
4237
4237
|
var ct = typeof WeakMap == "function" ? WeakMap : Map;
|
|
4238
|
-
|
|
4238
|
+
Ie = new ct();
|
|
4239
4239
|
}
|
|
4240
4240
|
function Ct(_, P) {
|
|
4241
4241
|
if (!_ || ge)
|
|
4242
4242
|
return "";
|
|
4243
4243
|
{
|
|
4244
|
-
var G =
|
|
4244
|
+
var G = Ie.get(_);
|
|
4245
4245
|
if (G !== void 0)
|
|
4246
4246
|
return G;
|
|
4247
4247
|
}
|
|
@@ -4250,7 +4250,7 @@ function pu() {
|
|
|
4250
4250
|
var he = Error.prepareStackTrace;
|
|
4251
4251
|
Error.prepareStackTrace = void 0;
|
|
4252
4252
|
var _e;
|
|
4253
|
-
_e = Ce.current, Ce.current = null,
|
|
4253
|
+
_e = Ce.current, Ce.current = null, Me();
|
|
4254
4254
|
try {
|
|
4255
4255
|
if (P) {
|
|
4256
4256
|
var le = function() {
|
|
@@ -4287,26 +4287,26 @@ function pu() {
|
|
|
4287
4287
|
if (Ze && Z && typeof Ze.stack == "string") {
|
|
4288
4288
|
for (var se = Ze.stack.split(`
|
|
4289
4289
|
`), He = Z.stack.split(`
|
|
4290
|
-
`),
|
|
4291
|
-
|
|
4292
|
-
for (;
|
|
4293
|
-
if (se[
|
|
4294
|
-
if (
|
|
4290
|
+
`), Fe = se.length - 1, Le = He.length - 1; Fe >= 1 && Le >= 0 && se[Fe] !== He[Le]; )
|
|
4291
|
+
Le--;
|
|
4292
|
+
for (; Fe >= 1 && Le >= 0; Fe--, Le--)
|
|
4293
|
+
if (se[Fe] !== He[Le]) {
|
|
4294
|
+
if (Fe !== 1 || Le !== 1)
|
|
4295
4295
|
do
|
|
4296
|
-
if (
|
|
4296
|
+
if (Fe--, Le--, Le < 0 || se[Fe] !== He[Le]) {
|
|
4297
4297
|
var at = `
|
|
4298
|
-
` + se[
|
|
4299
|
-
return _.displayName && at.includes("<anonymous>") && (at = at.replace("<anonymous>", _.displayName)), typeof _ == "function" &&
|
|
4298
|
+
` + se[Fe].replace(" at new ", " at ");
|
|
4299
|
+
return _.displayName && at.includes("<anonymous>") && (at = at.replace("<anonymous>", _.displayName)), typeof _ == "function" && Ie.set(_, at), at;
|
|
4300
4300
|
}
|
|
4301
|
-
while (
|
|
4301
|
+
while (Fe >= 1 && Le >= 0);
|
|
4302
4302
|
break;
|
|
4303
4303
|
}
|
|
4304
4304
|
}
|
|
4305
4305
|
} finally {
|
|
4306
|
-
ge = !1, Ce.current = _e,
|
|
4306
|
+
ge = !1, Ce.current = _e, Te(), Error.prepareStackTrace = he;
|
|
4307
4307
|
}
|
|
4308
|
-
var br = _ ? _.displayName || _.name : "", rr = br ?
|
|
4309
|
-
return typeof _ == "function" &&
|
|
4308
|
+
var br = _ ? _.displayName || _.name : "", rr = br ? qe(br) : "";
|
|
4309
|
+
return typeof _ == "function" && Ie.set(_, rr), rr;
|
|
4310
4310
|
}
|
|
4311
4311
|
function qt(_, P, G) {
|
|
4312
4312
|
return Ct(_, !1);
|
|
@@ -4321,12 +4321,12 @@ function pu() {
|
|
|
4321
4321
|
if (typeof _ == "function")
|
|
4322
4322
|
return Ct(_, it(_));
|
|
4323
4323
|
if (typeof _ == "string")
|
|
4324
|
-
return
|
|
4324
|
+
return qe(_);
|
|
4325
4325
|
switch (_) {
|
|
4326
4326
|
case u:
|
|
4327
|
-
return
|
|
4327
|
+
return qe("Suspense");
|
|
4328
4328
|
case c:
|
|
4329
|
-
return
|
|
4329
|
+
return qe("SuspenseList");
|
|
4330
4330
|
}
|
|
4331
4331
|
if (typeof _ == "object")
|
|
4332
4332
|
switch (_.$$typeof) {
|
|
@@ -4364,8 +4364,8 @@ function pu() {
|
|
|
4364
4364
|
throw He.name = "Invariant Violation", He;
|
|
4365
4365
|
}
|
|
4366
4366
|
se = _[le](P, le, Z, G, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
4367
|
-
} catch (
|
|
4368
|
-
se =
|
|
4367
|
+
} catch (Fe) {
|
|
4368
|
+
se = Fe;
|
|
4369
4369
|
}
|
|
4370
4370
|
se && !(se instanceof Error) && (Dt(he), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Z || "React class", G, le, typeof se), Dt(null)), se instanceof Error && !(se.message in Ut) && (Ut[se.message] = !0, Dt(he), x("Failed %s type: %s", G, se.message), Dt(null));
|
|
4371
4371
|
}
|
|
@@ -4375,25 +4375,25 @@ function pu() {
|
|
|
4375
4375
|
function At(_) {
|
|
4376
4376
|
return ht(_);
|
|
4377
4377
|
}
|
|
4378
|
-
function
|
|
4378
|
+
function U(_) {
|
|
4379
4379
|
{
|
|
4380
4380
|
var P = typeof Symbol == "function" && Symbol.toStringTag, G = P && _[Symbol.toStringTag] || _.constructor.name || "Object";
|
|
4381
4381
|
return G;
|
|
4382
4382
|
}
|
|
4383
4383
|
}
|
|
4384
|
-
function
|
|
4384
|
+
function ye(_) {
|
|
4385
4385
|
try {
|
|
4386
|
-
return
|
|
4386
|
+
return Ae(_), !1;
|
|
4387
4387
|
} catch {
|
|
4388
4388
|
return !0;
|
|
4389
4389
|
}
|
|
4390
4390
|
}
|
|
4391
|
-
function
|
|
4391
|
+
function Ae(_) {
|
|
4392
4392
|
return "" + _;
|
|
4393
4393
|
}
|
|
4394
4394
|
function R(_) {
|
|
4395
|
-
if (
|
|
4396
|
-
return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
4395
|
+
if (ye(_))
|
|
4396
|
+
return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", U(_)), Ae(_);
|
|
4397
4397
|
}
|
|
4398
4398
|
var T = C.ReactCurrentOwner, Q = {
|
|
4399
4399
|
key: !0,
|
|
@@ -4478,24 +4478,24 @@ function pu() {
|
|
|
4478
4478
|
for (_e in P)
|
|
4479
4479
|
dt.call(P, _e) && !Q.hasOwnProperty(_e) && (le[_e] = P[_e]);
|
|
4480
4480
|
if (_ && _.defaultProps) {
|
|
4481
|
-
var
|
|
4482
|
-
for (_e in
|
|
4483
|
-
le[_e] === void 0 && (le[_e] =
|
|
4481
|
+
var Fe = _.defaultProps;
|
|
4482
|
+
for (_e in Fe)
|
|
4483
|
+
le[_e] === void 0 && (le[_e] = Fe[_e]);
|
|
4484
4484
|
}
|
|
4485
4485
|
if (se || He) {
|
|
4486
|
-
var
|
|
4487
|
-
se && ee(le,
|
|
4486
|
+
var Le = typeof _ == "function" ? _.displayName || _.name || "Unknown" : _;
|
|
4487
|
+
se && ee(le, Le), He && ae(le, Le);
|
|
4488
4488
|
}
|
|
4489
4489
|
return ne(_, se, He, he, Z, T.current, le);
|
|
4490
4490
|
}
|
|
4491
4491
|
}
|
|
4492
|
-
var
|
|
4493
|
-
function
|
|
4492
|
+
var Ee = C.ReactCurrentOwner, je = C.ReactDebugCurrentFrame;
|
|
4493
|
+
function xe(_) {
|
|
4494
4494
|
if (_) {
|
|
4495
4495
|
var P = _._owner, G = ot(_.type, _._source, P ? P.type : null);
|
|
4496
|
-
|
|
4496
|
+
je.setExtraStackFrame(G);
|
|
4497
4497
|
} else
|
|
4498
|
-
|
|
4498
|
+
je.setExtraStackFrame(null);
|
|
4499
4499
|
}
|
|
4500
4500
|
var fe;
|
|
4501
4501
|
fe = !1;
|
|
@@ -4504,8 +4504,8 @@ function pu() {
|
|
|
4504
4504
|
}
|
|
4505
4505
|
function We() {
|
|
4506
4506
|
{
|
|
4507
|
-
if (
|
|
4508
|
-
var _ = L(
|
|
4507
|
+
if (Ee.current) {
|
|
4508
|
+
var _ = L(Ee.current.type);
|
|
4509
4509
|
if (_)
|
|
4510
4510
|
return `
|
|
4511
4511
|
|
|
@@ -4540,7 +4540,7 @@ Check the top-level render call using <` + G + ">.");
|
|
|
4540
4540
|
return;
|
|
4541
4541
|
Et[G] = !0;
|
|
4542
4542
|
var Z = "";
|
|
4543
|
-
_ && _._owner && _._owner !==
|
|
4543
|
+
_ && _._owner && _._owner !== Ee.current && (Z = " It was passed a child from " + L(_._owner.type) + "."), xe(_), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', G, Z), xe(null);
|
|
4544
4544
|
}
|
|
4545
4545
|
}
|
|
4546
4546
|
function yr(_, P) {
|
|
@@ -4592,11 +4592,11 @@ Check the top-level render call using <` + G + ">.");
|
|
|
4592
4592
|
for (var P = Object.keys(_.props), G = 0; G < P.length; G++) {
|
|
4593
4593
|
var Z = P[G];
|
|
4594
4594
|
if (Z !== "children" && Z !== "key") {
|
|
4595
|
-
|
|
4595
|
+
xe(_), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Z), xe(null);
|
|
4596
4596
|
break;
|
|
4597
4597
|
}
|
|
4598
4598
|
}
|
|
4599
|
-
_.ref !== null && (
|
|
4599
|
+
_.ref !== null && (xe(_), x("Invalid attribute `ref` supplied to `React.Fragment`."), xe(null));
|
|
4600
4600
|
}
|
|
4601
4601
|
}
|
|
4602
4602
|
var xr = {};
|
|
@@ -4608,12 +4608,12 @@ Check the top-level render call using <` + G + ">.");
|
|
|
4608
4608
|
(_ === void 0 || typeof _ == "object" && _ !== null && Object.keys(_).length === 0) && (se += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
4609
4609
|
var He = lt();
|
|
4610
4610
|
He ? se += He : se += We();
|
|
4611
|
-
var
|
|
4612
|
-
_ === null ?
|
|
4611
|
+
var Fe;
|
|
4612
|
+
_ === null ? Fe = "null" : At(_) ? Fe = "array" : _ !== void 0 && _.$$typeof === e ? (Fe = "<" + (L(_.type) || "Unknown") + " />", se = " Did you accidentally export a JSX literal instead of a component?") : Fe = typeof _, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Fe, se);
|
|
4613
4613
|
}
|
|
4614
|
-
var
|
|
4615
|
-
if (
|
|
4616
|
-
return
|
|
4614
|
+
var Le = te(_, P, G, he, _e);
|
|
4615
|
+
if (Le == null)
|
|
4616
|
+
return Le;
|
|
4617
4617
|
if (le) {
|
|
4618
4618
|
var at = P.children;
|
|
4619
4619
|
if (at !== void 0)
|
|
@@ -4641,7 +4641,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
4641
4641
|
<%s key={someKey} {...props} />`, Ds, rr, Pa, rr), xr[rr + Ds] = !0;
|
|
4642
4642
|
}
|
|
4643
4643
|
}
|
|
4644
|
-
return _ === n ? ws(
|
|
4644
|
+
return _ === n ? ws(Le) : tr(Le), Le;
|
|
4645
4645
|
}
|
|
4646
4646
|
}
|
|
4647
4647
|
function Cs(_, P, G) {
|
|
@@ -5049,7 +5049,7 @@ function Df({
|
|
|
5049
5049
|
cardSize: o = "medium",
|
|
5050
5050
|
className: i = ""
|
|
5051
5051
|
}) {
|
|
5052
|
-
const l = Math.min(Math.max(e, 1), 5), [a, u] = H([]), [c, d] = H([]), [f, h] = H(Array(l).fill(!1)), [g, m] = H(Array(l).fill(!1)), y =
|
|
5052
|
+
const l = Math.min(Math.max(e, 1), 5), [a, u] = H([]), [c, d] = H([]), [f, h] = H(Array(l).fill(!1)), [g, m] = H(Array(l).fill(!1)), y = be([]), C = re((v) => {
|
|
5053
5053
|
const b = r.filter((k) => !v.includes(k._id));
|
|
5054
5054
|
if (b.length === 0) return null;
|
|
5055
5055
|
const D = Math.floor(Math.random() * b.length);
|
|
@@ -5102,7 +5102,7 @@ function Df({
|
|
|
5102
5102
|
}, 150);
|
|
5103
5103
|
}, b);
|
|
5104
5104
|
y.current[v] = D;
|
|
5105
|
-
}, [x, C, a, c, g]), w =
|
|
5105
|
+
}, [x, C, a, c, g]), w = be(!1);
|
|
5106
5106
|
De(() => {
|
|
5107
5107
|
if (!(a.length === 0 || r.length <= 1) && !w.current) {
|
|
5108
5108
|
w.current = !0;
|
|
@@ -5259,15 +5259,15 @@ function Af({
|
|
|
5259
5259
|
renderLoading: E,
|
|
5260
5260
|
theme: v = {}
|
|
5261
5261
|
}) {
|
|
5262
|
-
const b = { ...mu, ...v }, [D, k] = H([]), [I, B] = H(!1), [F, L] = H(null), [j, O] = H(/* @__PURE__ */ new Set()), [X, de] = H(null), [ie, oe] = H(null), [ve, pe] = H(null), [we,
|
|
5263
|
-
u ? u(S) :
|
|
5264
|
-
},
|
|
5262
|
+
const b = { ...mu, ...v }, [D, k] = H([]), [I, B] = H(!1), [F, L] = H(null), [j, O] = H(/* @__PURE__ */ new Set()), [X, de] = H(null), [ie, oe] = H(null), [ve, pe] = H(null), [we, ke] = H(!1), [Me, Te] = H(""), Ce = a !== void 0 ? a : Me, Ve = (S) => {
|
|
5263
|
+
u ? u(S) : Te(S);
|
|
5264
|
+
}, qe = bt(() => {
|
|
5265
5265
|
if (!Ce.trim()) return D;
|
|
5266
5266
|
const S = Ce.toLowerCase();
|
|
5267
5267
|
return D.filter(
|
|
5268
5268
|
($) => _r($.from).toLowerCase().includes(S) || _r($.subject).toLowerCase().includes(S)
|
|
5269
5269
|
);
|
|
5270
|
-
}, [D, Ce]), ge = bt(() => e ? new uu({ baseUrl: r, system_id: e }) : null, [r, e]),
|
|
5270
|
+
}, [D, Ce]), ge = bt(() => e ? new uu({ baseUrl: r, system_id: e }) : null, [r, e]), Ie = re(async () => {
|
|
5271
5271
|
if (ge) {
|
|
5272
5272
|
B(!0), L(null);
|
|
5273
5273
|
try {
|
|
@@ -5281,18 +5281,18 @@ function Af({
|
|
|
5281
5281
|
}
|
|
5282
5282
|
}, [ge, t, n, s, m, y]);
|
|
5283
5283
|
De(() => {
|
|
5284
|
-
k([]), O(/* @__PURE__ */ new Set()), oe(null), L(null), a === void 0 &&
|
|
5284
|
+
k([]), O(/* @__PURE__ */ new Set()), oe(null), L(null), a === void 0 && Te(""), d && Ie();
|
|
5285
5285
|
}, [s, d]);
|
|
5286
5286
|
const ct = re(async (S) => {
|
|
5287
5287
|
if (ge) {
|
|
5288
|
-
oe(S), pe(null),
|
|
5288
|
+
oe(S), pe(null), ke(!0);
|
|
5289
5289
|
try {
|
|
5290
5290
|
const $ = await ge.getEmailParsed(t, S.uid, s || "INBOX");
|
|
5291
5291
|
$ != null && $.body && pe($.body);
|
|
5292
5292
|
} catch ($) {
|
|
5293
5293
|
console.error("Failed to fetch email body:", $);
|
|
5294
5294
|
}
|
|
5295
|
-
|
|
5295
|
+
ke(!1);
|
|
5296
5296
|
}
|
|
5297
5297
|
}, [ge, t, s]), Ct = re((S) => {
|
|
5298
5298
|
f == null || f(S), i && ct(S);
|
|
@@ -5303,7 +5303,7 @@ function Af({
|
|
|
5303
5303
|
}
|
|
5304
5304
|
const Y = S.uid;
|
|
5305
5305
|
if (K.shiftKey && X !== null) {
|
|
5306
|
-
const ee = Math.min(X, $), ae = Math.max(X, $), ne = D.slice(ee, ae + 1).map((
|
|
5306
|
+
const ee = Math.min(X, $), ae = Math.max(X, $), ne = D.slice(ee, ae + 1).map((Ee) => Ee.uid), te = new Set(ne);
|
|
5307
5307
|
O(te), h == null || h(Array.from(te));
|
|
5308
5308
|
} else if (K.ctrlKey || K.metaKey)
|
|
5309
5309
|
O((ee) => {
|
|
@@ -5356,7 +5356,7 @@ function Af({
|
|
|
5356
5356
|
}, [h]), Wt = {
|
|
5357
5357
|
delete: it,
|
|
5358
5358
|
archive: ot,
|
|
5359
|
-
refresh:
|
|
5359
|
+
refresh: Ie,
|
|
5360
5360
|
selectAll: dt,
|
|
5361
5361
|
clearSelection: Ut
|
|
5362
5362
|
}, Dt = (S) => {
|
|
@@ -5500,15 +5500,15 @@ function Af({
|
|
|
5500
5500
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "18px" }, children: "refresh" })
|
|
5501
5501
|
}
|
|
5502
5502
|
)
|
|
5503
|
-
] }),
|
|
5503
|
+
] }), U = () => /* @__PURE__ */ p.jsx("div", { style: {
|
|
5504
5504
|
padding: "48px",
|
|
5505
5505
|
textAlign: "center",
|
|
5506
5506
|
color: b.textSecondary
|
|
5507
|
-
}, children: c }),
|
|
5507
|
+
}, children: c }), ye = () => /* @__PURE__ */ p.jsx("div", { style: {
|
|
5508
5508
|
padding: "48px",
|
|
5509
5509
|
textAlign: "center",
|
|
5510
5510
|
color: b.textSecondary
|
|
5511
|
-
}, children: "Loading..." }),
|
|
5511
|
+
}, children: "Loading..." }), Ae = C || ft, R = x || ht, T = A || At, Q = w || U, J = E || ye;
|
|
5512
5512
|
return I && D.length === 0 ? /* @__PURE__ */ p.jsx("div", { style: { background: b.background, width: "100%", height: "100%" }, children: J() }) : /* @__PURE__ */ p.jsxs("div", { style: { display: "flex", background: b.background, width: "100%", height: "100%" }, children: [
|
|
5513
5513
|
/* @__PURE__ */ p.jsxs("div", { style: {
|
|
5514
5514
|
flex: i && ie ? "0 0 50%" : "1",
|
|
@@ -5575,12 +5575,12 @@ function Af({
|
|
|
5575
5575
|
fontSize: "14px",
|
|
5576
5576
|
borderBottom: `1px solid ${b.border}`
|
|
5577
5577
|
}, children: F }),
|
|
5578
|
-
/* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children:
|
|
5578
|
+
/* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: qe.length === 0 ? Q() : qe.map((S, $) => /* @__PURE__ */ p.jsx(
|
|
5579
5579
|
"div",
|
|
5580
5580
|
{
|
|
5581
5581
|
onClick: (K) => qt(S, $, K),
|
|
5582
5582
|
onDoubleClick: () => Ct(S),
|
|
5583
|
-
children:
|
|
5583
|
+
children: Ae(S, j.has(S.uid))
|
|
5584
5584
|
},
|
|
5585
5585
|
S.uid
|
|
5586
5586
|
)) })
|
|
@@ -5850,7 +5850,7 @@ function Xi(r, e) {
|
|
|
5850
5850
|
return !(t !== null && t !== o || n !== null && n !== i || s !== null && s !== l);
|
|
5851
5851
|
}
|
|
5852
5852
|
function Zi(r, e) {
|
|
5853
|
-
const t = r.mergeWithSibling(e), n =
|
|
5853
|
+
const t = r.mergeWithSibling(e), n = Ne()._normalizedNodes;
|
|
5854
5854
|
return n.add(r.__key), n.add(e.__key), t;
|
|
5855
5855
|
}
|
|
5856
5856
|
function eo(r) {
|
|
@@ -5952,7 +5952,7 @@ function jl(r) {
|
|
|
5952
5952
|
function sc(r, e) {
|
|
5953
5953
|
if (e != null) return void (r.__key = e);
|
|
5954
5954
|
et(), la();
|
|
5955
|
-
const t =
|
|
5955
|
+
const t = Ne(), n = $t(), s = "" + tc++;
|
|
5956
5956
|
n._nodeMap.set(s, r), N(r) ? t._dirtyElements.set(s, !0) : t._dirtyLeaves.add(s), t._cloneNotNeeded.add(s), t._dirtyType = Al, r.__key = s;
|
|
5957
5957
|
}
|
|
5958
5958
|
function lr(r) {
|
|
@@ -5988,7 +5988,7 @@ function lr(r) {
|
|
|
5988
5988
|
}
|
|
5989
5989
|
function Kn(r) {
|
|
5990
5990
|
la();
|
|
5991
|
-
const e = r.getLatest(), t = e.__parent, n = $t(), s =
|
|
5991
|
+
const e = r.getLatest(), t = e.__parent, n = $t(), s = Ne(), o = n._nodeMap, i = s._dirtyElements;
|
|
5992
5992
|
t !== null && function(a, u, c) {
|
|
5993
5993
|
let d = a;
|
|
5994
5994
|
for (; d !== null; ) {
|
|
@@ -6003,7 +6003,7 @@ function Kn(r) {
|
|
|
6003
6003
|
}
|
|
6004
6004
|
function Ge(r) {
|
|
6005
6005
|
et();
|
|
6006
|
-
const e =
|
|
6006
|
+
const e = Ne(), t = e._compositionKey;
|
|
6007
6007
|
if (r !== t) {
|
|
6008
6008
|
if (e._compositionKey = r, t !== null) {
|
|
6009
6009
|
const n = Ke(t);
|
|
@@ -6016,14 +6016,14 @@ function Ge(r) {
|
|
|
6016
6016
|
}
|
|
6017
6017
|
}
|
|
6018
6018
|
function Ht() {
|
|
6019
|
-
return Cn() ? null :
|
|
6019
|
+
return Cn() ? null : Ne()._compositionKey;
|
|
6020
6020
|
}
|
|
6021
6021
|
function Ke(r, e) {
|
|
6022
6022
|
const t = (e || $t())._nodeMap.get(r);
|
|
6023
6023
|
return t === void 0 ? null : t;
|
|
6024
6024
|
}
|
|
6025
6025
|
function Ll(r, e) {
|
|
6026
|
-
const t = ds(r,
|
|
6026
|
+
const t = ds(r, Ne());
|
|
6027
6027
|
return t !== void 0 ? Ke(t, e) : null;
|
|
6028
6028
|
}
|
|
6029
6029
|
function ds(r, e) {
|
|
@@ -6043,9 +6043,9 @@ function Pl(r) {
|
|
|
6043
6043
|
return r._pendingDecorators = t, t;
|
|
6044
6044
|
}
|
|
6045
6045
|
function ro(r) {
|
|
6046
|
-
return r.read(() =>
|
|
6046
|
+
return r.read(() => Se().getTextContent());
|
|
6047
6047
|
}
|
|
6048
|
-
function
|
|
6048
|
+
function Se() {
|
|
6049
6049
|
return Rl($t());
|
|
6050
6050
|
}
|
|
6051
6051
|
function Rl(r) {
|
|
@@ -6057,7 +6057,7 @@ function Nt(r) {
|
|
|
6057
6057
|
r !== null && (r.dirty = !0, r.setCachedNodes(null)), e._selection = r;
|
|
6058
6058
|
}
|
|
6059
6059
|
function Dr(r) {
|
|
6060
|
-
const e =
|
|
6060
|
+
const e = Ne(), t = function(n, s) {
|
|
6061
6061
|
let o = n;
|
|
6062
6062
|
for (; o != null; ) {
|
|
6063
6063
|
const i = ds(o, s);
|
|
@@ -6114,7 +6114,7 @@ function Ti(r, e, t, n, s) {
|
|
|
6114
6114
|
if (l === "") {
|
|
6115
6115
|
if (Ge(null), as || gn || mi) o.remove();
|
|
6116
6116
|
else {
|
|
6117
|
-
const m =
|
|
6117
|
+
const m = Ne();
|
|
6118
6118
|
setTimeout(() => {
|
|
6119
6119
|
m.update(() => {
|
|
6120
6120
|
o.isAttached() && o.remove();
|
|
@@ -6128,7 +6128,7 @@ function Ti(r, e, t, n, s) {
|
|
|
6128
6128
|
const g = V();
|
|
6129
6129
|
if (!M(g) || t === null || n === null) return void o.setTextContent(l);
|
|
6130
6130
|
if (g.setTextNodeRange(o, t, o, n), o.isSegmented()) {
|
|
6131
|
-
const m =
|
|
6131
|
+
const m = Re(o.getTextContent());
|
|
6132
6132
|
o.replace(m), o = m;
|
|
6133
6133
|
}
|
|
6134
6134
|
o.setTextContent(l);
|
|
@@ -6166,7 +6166,7 @@ function lo(r, e, t) {
|
|
|
6166
6166
|
return r.toLowerCase() === "a" && Hr(e, t);
|
|
6167
6167
|
}
|
|
6168
6168
|
function oc() {
|
|
6169
|
-
const r =
|
|
6169
|
+
const r = Se();
|
|
6170
6170
|
Nt(Nl(r.select(0, r.getChildrenSize())));
|
|
6171
6171
|
}
|
|
6172
6172
|
function en(r, e) {
|
|
@@ -6212,7 +6212,7 @@ function $l(r) {
|
|
|
6212
6212
|
const e = hs(r).event, t = e && e.inputType;
|
|
6213
6213
|
return t === "insertFromPaste" || t === "insertFromPasteAsQuotation";
|
|
6214
6214
|
}
|
|
6215
|
-
function
|
|
6215
|
+
function W(r, e, t) {
|
|
6216
6216
|
return ca(r, e, t);
|
|
6217
6217
|
}
|
|
6218
6218
|
function fs(r) {
|
|
@@ -6250,7 +6250,7 @@ function Ft(r) {
|
|
|
6250
6250
|
return Ye(r) || N(r) && r.isShadowRoot();
|
|
6251
6251
|
}
|
|
6252
6252
|
function Lt(r) {
|
|
6253
|
-
const e =
|
|
6253
|
+
const e = Ne(), t = r.constructor.getType(), n = e._nodes.get(t);
|
|
6254
6254
|
n === void 0 && z(200, r.constructor.name, t);
|
|
6255
6255
|
const { replace: s, replaceWithKlass: o } = n;
|
|
6256
6256
|
if (s !== null) {
|
|
@@ -6335,7 +6335,7 @@ function Wr(r, e) {
|
|
|
6335
6335
|
return e(t) ? t : null;
|
|
6336
6336
|
}
|
|
6337
6337
|
function cc() {
|
|
6338
|
-
return
|
|
6338
|
+
return Ne();
|
|
6339
6339
|
}
|
|
6340
6340
|
const co = /* @__PURE__ */ new WeakMap(), dc = /* @__PURE__ */ new Map();
|
|
6341
6341
|
function fc(r) {
|
|
@@ -6370,7 +6370,7 @@ function zl(r, e, t, n, s, o) {
|
|
|
6370
6370
|
i.__parent === e && (N(i) && zl(i, l, t, n, s, o), t.has(l) || o.delete(l), s.push(l)), i = i.getNextSibling();
|
|
6371
6371
|
}
|
|
6372
6372
|
}
|
|
6373
|
-
let Xt, Xe, dn, ps, Hs, Js, dr, _t, Qs, fn,
|
|
6373
|
+
let Xt, Xe, dn, ps, Hs, Js, dr, _t, Qs, fn, Oe = "", Qe = "", St = null, mt = "", Ot = "", ql = !1, hn = !1, Rn = null;
|
|
6374
6374
|
function Qn(r, e) {
|
|
6375
6375
|
const t = dr.get(r);
|
|
6376
6376
|
if (e !== null) {
|
|
@@ -6426,27 +6426,27 @@ function Yn(r, e) {
|
|
|
6426
6426
|
})(Xn(t, _t), l, t, n);
|
|
6427
6427
|
}
|
|
6428
6428
|
const i = t.__format;
|
|
6429
|
-
i !== 0 && Wl(n, i), t.isInline() || Gl(null, t, n), fs(t) && (
|
|
6429
|
+
i !== 0 && Wl(n, i), t.isInline() || Gl(null, t, n), fs(t) && (Oe += Mt, Ot += Mt);
|
|
6430
6430
|
} else {
|
|
6431
6431
|
const s = t.getTextContent();
|
|
6432
6432
|
if (me(t)) {
|
|
6433
6433
|
const o = t.decorate(Xe, Xt);
|
|
6434
6434
|
o !== null && Kl(r, o), n.contentEditable = "false";
|
|
6435
6435
|
} else q(t) && (t.isDirectionless() || (Qe += s));
|
|
6436
|
-
|
|
6436
|
+
Oe += s, Ot += s;
|
|
6437
6437
|
}
|
|
6438
6438
|
return e !== null && e.insertChild(n), Bi(fn, dn, ps, t, "created"), n;
|
|
6439
6439
|
}
|
|
6440
6440
|
function Xs(r, e, t, n, s) {
|
|
6441
|
-
const o =
|
|
6442
|
-
|
|
6441
|
+
const o = Oe;
|
|
6442
|
+
Oe = "";
|
|
6443
6443
|
let i = t;
|
|
6444
6444
|
for (; i <= n; ++i) {
|
|
6445
6445
|
Yn(r[i], s);
|
|
6446
6446
|
const l = _t.get(r[i]);
|
|
6447
6447
|
l !== null && q(l) && (St === null && (St = l.getFormat()), mt === "" && (mt = l.getStyle()));
|
|
6448
6448
|
}
|
|
6449
|
-
fs(e) && (
|
|
6449
|
+
fs(e) && (Oe += Mt), s.element.__lexicalTextContent = Oe, Oe = o + Oe;
|
|
6450
6450
|
}
|
|
6451
6451
|
function fo(r, e) {
|
|
6452
6452
|
if (r) {
|
|
@@ -6498,8 +6498,8 @@ function gc(r, e, t) {
|
|
|
6498
6498
|
const n = Qe;
|
|
6499
6499
|
var s;
|
|
6500
6500
|
Qe = "", St = null, mt = "", function(o, i, l) {
|
|
6501
|
-
const a =
|
|
6502
|
-
|
|
6501
|
+
const a = Oe, u = o.__size, c = i.__size;
|
|
6502
|
+
Oe = "";
|
|
6503
6503
|
const d = l.element;
|
|
6504
6504
|
if (u === 1 && c === 1) {
|
|
6505
6505
|
const f = o.__first, h = i.__first;
|
|
@@ -6552,7 +6552,7 @@ function gc(r, e, t) {
|
|
|
6552
6552
|
} else F && !B && Ys(m, k, w, A.element);
|
|
6553
6553
|
})(i, f, h, u, c, l);
|
|
6554
6554
|
}
|
|
6555
|
-
fs(i) && (
|
|
6555
|
+
fs(i) && (Oe += Mt), d.__lexicalTextContent = Oe, Oe = a + Oe;
|
|
6556
6556
|
}(r, e, e.getDOMSlot(t)), Vl(e, t), Fr(s = e) && St != null && St !== s.__textFormat && !hn && (s.setTextFormat(St), s.setTextStyle(mt)), function(o) {
|
|
6557
6557
|
Fr(o) && mt !== "" && mt !== o.__textStyle && !hn && o.setTextStyle(mt);
|
|
6558
6558
|
}(e), Qe = n;
|
|
@@ -6574,12 +6574,12 @@ function Jr(r, e) {
|
|
|
6574
6574
|
if (t === n && !s) {
|
|
6575
6575
|
if (N(t)) {
|
|
6576
6576
|
const i = o.__lexicalTextContent;
|
|
6577
|
-
i !== void 0 && (
|
|
6577
|
+
i !== void 0 && (Oe += i, Ot += i);
|
|
6578
6578
|
const l = o.__lexicalDirTextContent;
|
|
6579
6579
|
l !== void 0 && (Qe += l);
|
|
6580
6580
|
} else {
|
|
6581
6581
|
const i = t.getTextContent();
|
|
6582
|
-
q(t) && !t.isDirectionless() && (Qe += i), Ot += i,
|
|
6582
|
+
q(t) && !t.isDirectionless() && (Qe += i), Ot += i, Oe += i;
|
|
6583
6583
|
}
|
|
6584
6584
|
return o;
|
|
6585
6585
|
}
|
|
@@ -6591,14 +6591,14 @@ function Jr(r, e) {
|
|
|
6591
6591
|
const i = n.__indent;
|
|
6592
6592
|
i !== t.__indent && Ul(o, i);
|
|
6593
6593
|
const l = n.__format;
|
|
6594
|
-
l !== t.__format && Wl(o, l), s && (gc(t, n, o), Ye(n) || n.isInline() || Gl(t, n, o)), fs(n) && (
|
|
6594
|
+
l !== t.__format && Wl(o, l), s && (gc(t, n, o), Ye(n) || n.isInline() || Gl(t, n, o)), fs(n) && (Oe += Mt, Ot += Mt);
|
|
6595
6595
|
} else {
|
|
6596
6596
|
const i = n.getTextContent();
|
|
6597
6597
|
if (me(n)) {
|
|
6598
6598
|
const l = n.decorate(Xe, Xt);
|
|
6599
6599
|
l !== null && Kl(r, l);
|
|
6600
6600
|
} else q(n) && !n.isDirectionless() && (Qe += i);
|
|
6601
|
-
|
|
6601
|
+
Oe += i, Ot += i;
|
|
6602
6602
|
}
|
|
6603
6603
|
if (!hn && Ye(n) && n.__cachedText !== Ot) {
|
|
6604
6604
|
const i = n.getWritable();
|
|
@@ -6620,7 +6620,7 @@ function Ls(r) {
|
|
|
6620
6620
|
return e !== null && e === Xe._blockCursorElement && (e = e.nextSibling), e;
|
|
6621
6621
|
}
|
|
6622
6622
|
function mc(r, e, t, n, s, o) {
|
|
6623
|
-
|
|
6623
|
+
Oe = "", Ot = "", Qe = "", ql = n === Br, Rn = null, Xe = t, Xt = t._config, dn = t._nodes, ps = Xe._listeners.mutation, Hs = s, Js = o, dr = r._nodeMap, _t = e._nodeMap, hn = e._readOnly, Qs = new Map(t._keyToDOMMap);
|
|
6624
6624
|
const i = /* @__PURE__ */ new Map();
|
|
6625
6625
|
return fn = i, Jr("root", null), Xe = void 0, dn = void 0, Hs = void 0, Js = void 0, dr = void 0, _t = void 0, Xt = void 0, Qs = void 0, fn = void 0, i;
|
|
6626
6626
|
}
|
|
@@ -6631,91 +6631,91 @@ function Zs(r) {
|
|
|
6631
6631
|
const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
|
|
6632
6632
|
if (rn = r.timeStamp, Hl = r.key, e.isComposing()) return;
|
|
6633
6633
|
const { key: t, shiftKey: n, ctrlKey: s, metaKey: o, altKey: i } = r;
|
|
6634
|
-
if (!
|
|
6634
|
+
if (!W(e, vu, r) && t != null) {
|
|
6635
6635
|
if (function(l, a, u, c) {
|
|
6636
6636
|
return io(l) && !a && !c && !u;
|
|
6637
|
-
}(t, s, i, o))
|
|
6637
|
+
}(t, s, i, o)) W(e, pl, r);
|
|
6638
6638
|
else if (function(l, a, u, c, d) {
|
|
6639
6639
|
return io(l) && !c && !u && (a || d);
|
|
6640
|
-
}(t, s, n, i, o))
|
|
6640
|
+
}(t, s, n, i, o)) W(e, wu, r);
|
|
6641
6641
|
else if (function(l, a, u, c) {
|
|
6642
6642
|
return so(l) && !a && !c && !u;
|
|
6643
|
-
}(t, s, i, o))
|
|
6643
|
+
}(t, s, i, o)) W(e, gl, r);
|
|
6644
6644
|
else if (function(l, a, u, c, d) {
|
|
6645
6645
|
return so(l) && !c && !u && (a || d);
|
|
6646
|
-
}(t, s, n, i, o))
|
|
6646
|
+
}(t, s, n, i, o)) W(e, Cu, r);
|
|
6647
6647
|
else if (/* @__PURE__ */ function(l, a, u) {
|
|
6648
6648
|
return /* @__PURE__ */ function(c) {
|
|
6649
6649
|
return c === "ArrowUp";
|
|
6650
6650
|
}(l) && !a && !u;
|
|
6651
|
-
}(t, s, o))
|
|
6651
|
+
}(t, s, o)) W(e, ml, r);
|
|
6652
6652
|
else if (/* @__PURE__ */ function(l, a, u) {
|
|
6653
6653
|
return /* @__PURE__ */ function(c) {
|
|
6654
6654
|
return c === "ArrowDown";
|
|
6655
6655
|
}(l) && !a && !u;
|
|
6656
|
-
}(t, s, o))
|
|
6656
|
+
}(t, s, o)) W(e, yl, r);
|
|
6657
6657
|
else if (function(l, a) {
|
|
6658
6658
|
return oo(l) && a;
|
|
6659
|
-
}(t, n)) nn = !0,
|
|
6659
|
+
}(t, n)) nn = !0, W(e, $n, r);
|
|
6660
6660
|
else if (/* @__PURE__ */ function(l) {
|
|
6661
6661
|
return l === " ";
|
|
6662
|
-
}(t))
|
|
6662
|
+
}(t)) W(e, Du, r);
|
|
6663
6663
|
else if (function(l, a) {
|
|
6664
6664
|
return gt && a && l.toLowerCase() === "o";
|
|
6665
|
-
}(t, s)) r.preventDefault(), nn = !0,
|
|
6665
|
+
}(t, s)) r.preventDefault(), nn = !0, W(e, Er, !0);
|
|
6666
6666
|
else if (function(l, a) {
|
|
6667
6667
|
return oo(l) && !a;
|
|
6668
|
-
}(t, n)) nn = !1,
|
|
6668
|
+
}(t, n)) nn = !1, W(e, $n, r);
|
|
6669
6669
|
else if (function(l, a, u, c) {
|
|
6670
6670
|
return gt ? !a && !u && (qr(l) || l.toLowerCase() === "h" && c) : !(c || a || u) && qr(l);
|
|
6671
|
-
}(t, i, o, s)) qr(t) ?
|
|
6671
|
+
}(t, i, o, s)) qr(t) ? W(e, xl, r) : (r.preventDefault(), W(e, or, !0));
|
|
6672
6672
|
else if (/* @__PURE__ */ function(l) {
|
|
6673
6673
|
return l === "Escape";
|
|
6674
|
-
}(t))
|
|
6674
|
+
}(t)) W(e, bl, r);
|
|
6675
6675
|
else if (function(l, a, u, c, d) {
|
|
6676
6676
|
return gt ? !(u || c || d) && (Ur(l) || l.toLowerCase() === "d" && a) : !(a || c || d) && Ur(l);
|
|
6677
|
-
}(t, s, n, i, o)) Ur(t) ?
|
|
6677
|
+
}(t, s, n, i, o)) Ur(t) ? W(e, _l, r) : (r.preventDefault(), W(e, or, !1));
|
|
6678
6678
|
else if (function(l, a, u) {
|
|
6679
6679
|
return qr(l) && (gt ? a : u);
|
|
6680
|
-
}(t, i, s)) r.preventDefault(),
|
|
6680
|
+
}(t, i, s)) r.preventDefault(), W(e, an, !0);
|
|
6681
6681
|
else if (function(l, a, u) {
|
|
6682
6682
|
return Ur(l) && (gt ? a : u);
|
|
6683
|
-
}(t, i, s)) r.preventDefault(),
|
|
6683
|
+
}(t, i, s)) r.preventDefault(), W(e, an, !1);
|
|
6684
6684
|
else if (function(l, a) {
|
|
6685
6685
|
return gt && a && qr(l);
|
|
6686
|
-
}(t, o)) r.preventDefault(),
|
|
6686
|
+
}(t, o)) r.preventDefault(), W(e, un, !0);
|
|
6687
6687
|
else if (function(l, a) {
|
|
6688
6688
|
return gt && a && Ur(l);
|
|
6689
|
-
}(t, o)) r.preventDefault(),
|
|
6689
|
+
}(t, o)) r.preventDefault(), W(e, un, !1);
|
|
6690
6690
|
else if (function(l, a, u, c) {
|
|
6691
6691
|
return l.toLowerCase() === "b" && !a && Hr(u, c);
|
|
6692
|
-
}(t, i, o, s)) r.preventDefault(),
|
|
6692
|
+
}(t, i, o, s)) r.preventDefault(), W(e, xt, "bold");
|
|
6693
6693
|
else if (function(l, a, u, c) {
|
|
6694
6694
|
return l.toLowerCase() === "u" && !a && Hr(u, c);
|
|
6695
|
-
}(t, i, o, s)) r.preventDefault(),
|
|
6695
|
+
}(t, i, o, s)) r.preventDefault(), W(e, xt, "underline");
|
|
6696
6696
|
else if (function(l, a, u, c) {
|
|
6697
6697
|
return l.toLowerCase() === "i" && !a && Hr(u, c);
|
|
6698
|
-
}(t, i, o, s)) r.preventDefault(),
|
|
6698
|
+
}(t, i, o, s)) r.preventDefault(), W(e, xt, "italic");
|
|
6699
6699
|
else if (/* @__PURE__ */ function(l, a, u, c) {
|
|
6700
6700
|
return l === "Tab" && !a && !u && !c;
|
|
6701
|
-
}(t, i, s, o))
|
|
6701
|
+
}(t, i, s, o)) W(e, Au, r);
|
|
6702
6702
|
else if (function(l, a, u, c) {
|
|
6703
6703
|
return l.toLowerCase() === "z" && !a && Hr(u, c);
|
|
6704
|
-
}(t, n, o, s)) r.preventDefault(),
|
|
6704
|
+
}(t, n, o, s)) r.preventDefault(), W(e, hi, void 0);
|
|
6705
6705
|
else if (function(l, a, u, c) {
|
|
6706
6706
|
return gt ? l.toLowerCase() === "z" && u && a : l.toLowerCase() === "y" && c || l.toLowerCase() === "z" && c && a;
|
|
6707
|
-
}(t, n, o, s)) r.preventDefault(),
|
|
6707
|
+
}(t, n, o, s)) r.preventDefault(), W(e, pi, void 0);
|
|
6708
6708
|
else {
|
|
6709
6709
|
const l = e._editorState._selection;
|
|
6710
|
-
l === null || M(l) ? !Yt && lo(t, o, s) && (r.preventDefault(),
|
|
6710
|
+
l === null || M(l) ? !Yt && lo(t, o, s) && (r.preventDefault(), W(e, Gs, r)) : function(a, u, c, d) {
|
|
6711
6711
|
return !u && a.toLowerCase() === "c" && (gt ? c : d);
|
|
6712
|
-
}(t, n, o, s) ? (r.preventDefault(),
|
|
6712
|
+
}(t, n, o, s) ? (r.preventDefault(), W(e, ls, r)) : function(a, u, c, d) {
|
|
6713
6713
|
return !u && a.toLowerCase() === "x" && (gt ? c : d);
|
|
6714
|
-
}(t, n, o, s) ? (r.preventDefault(),
|
|
6714
|
+
}(t, n, o, s) ? (r.preventDefault(), W(e, gi, r)) : lo(t, o, s) && (r.preventDefault(), W(e, Gs, r));
|
|
6715
6715
|
}
|
|
6716
6716
|
/* @__PURE__ */ (function(l, a, u, c) {
|
|
6717
6717
|
return l || a || u || c;
|
|
6718
|
-
})(s, n, i, o) &&
|
|
6718
|
+
})(s, n, i, o) && W(e, Lu, r);
|
|
6719
6719
|
}
|
|
6720
6720
|
}], ["pointerdown", function(r, e) {
|
|
6721
6721
|
const t = r.target, n = r.pointerType;
|
|
@@ -6727,7 +6727,7 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
|
|
|
6727
6727
|
const t = V();
|
|
6728
6728
|
if (M(t) && !e.isComposing()) {
|
|
6729
6729
|
const n = t.anchor, s = t.anchor.getNode();
|
|
6730
|
-
Ge(n.key), (r.timeStamp < rn + ei || n.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format || q(s) && s.getStyle() !== t.style) &&
|
|
6730
|
+
Ge(n.key), (r.timeStamp < rn + ei || n.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format || q(s) && s.getStyle() !== t.style) && W(e, Sr, qu);
|
|
6731
6731
|
}
|
|
6732
6732
|
});
|
|
6733
6733
|
}], ["compositionend", function(r, e) {
|
|
@@ -6742,12 +6742,12 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
|
|
|
6742
6742
|
const o = t.anchor.getNode(), i = ut(e._window);
|
|
6743
6743
|
if (i === null) return;
|
|
6744
6744
|
const l = t.isBackward(), a = l ? t.anchor.offset : t.focus.offset, u = l ? t.focus.offset : t.anchor.offset;
|
|
6745
|
-
zn && !t.isCollapsed() && q(o) && i.anchorNode !== null && o.getTextContent().slice(0, a) + n + o.getTextContent().slice(a + u) === Il(i.anchorNode) ||
|
|
6745
|
+
zn && !t.isCollapsed() && q(o) && i.anchorNode !== null && o.getTextContent().slice(0, a) + n + o.getTextContent().slice(a + u) === Il(i.anchorNode) || W(e, Sr, n);
|
|
6746
6746
|
const c = n.length;
|
|
6747
6747
|
Yt && c > 1 && r.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= c), as || gn || mi || !e.isComposing() || (rn = 0, Ge(null));
|
|
6748
6748
|
} else
|
|
6749
6749
|
ki(!1, e, n !== null ? n : void 0), Gr && (Ps(e, n || void 0), Gr = !1);
|
|
6750
|
-
et(), Tl(
|
|
6750
|
+
et(), Tl(Ne());
|
|
6751
6751
|
}), Cr = null;
|
|
6752
6752
|
}], ["click", function(r, e) {
|
|
6753
6753
|
nt(e, () => {
|
|
@@ -6755,7 +6755,7 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
|
|
|
6755
6755
|
if (n) {
|
|
6756
6756
|
if (M(t)) {
|
|
6757
6757
|
const o = t.anchor, i = o.getNode();
|
|
6758
|
-
o.type === "element" && o.offset === 0 && t.isCollapsed() && !Ye(i) &&
|
|
6758
|
+
o.type === "element" && o.offset === 0 && t.isCollapsed() && !Ye(i) && Se().getChildrenSize() === 1 && i.getTopLevelElementOrThrow().isEmpty() && s !== null && t.is(s) ? (n.removeAllRanges(), t.dirty = !0) : r.detail === 3 && !t.isCollapsed() && i !== t.focus.getNode() && (N(i) ? i.select(0) : i.getParentOrThrow().select(0));
|
|
6759
6759
|
} else if (r.pointerType === "touch") {
|
|
6760
6760
|
const o = n.anchorNode;
|
|
6761
6761
|
if (o !== null) {
|
|
@@ -6764,7 +6764,7 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
|
|
|
6764
6764
|
}
|
|
6765
6765
|
}
|
|
6766
6766
|
}
|
|
6767
|
-
|
|
6767
|
+
W(e, hl, r);
|
|
6768
6768
|
});
|
|
6769
6769
|
}], ["cut", Rt], ["copy", Rt], ["dragstart", Rt], ["dragover", Rt], ["dragend", Rt], ["paste", Rt], ["focus", Rt], ["blur", Rt], ["drop", Rt]];
|
|
6770
6770
|
zn && ti.push(["beforeinput", (r, e) => function(t, n) {
|
|
@@ -6791,7 +6791,7 @@ zn && ti.push(["beforeinput", (r, e) => function(t, n) {
|
|
|
6791
6791
|
} else {
|
|
6792
6792
|
Ge(null), t.preventDefault();
|
|
6793
6793
|
const g = i.anchor.getNode(), m = g.getTextContent(), y = g.canInsertTextAfter(), C = i.anchor.offset === 0 && i.focus.offset === m.length;
|
|
6794
|
-
Ou && h && !C && y ||
|
|
6794
|
+
Ou && h && !C && y || W(n, or, !0);
|
|
6795
6795
|
}
|
|
6796
6796
|
return;
|
|
6797
6797
|
}
|
|
@@ -6805,74 +6805,74 @@ zn && ti.push(["beforeinput", (r, e) => function(t, n) {
|
|
|
6805
6805
|
case "insertFromYank":
|
|
6806
6806
|
case "insertFromDrop":
|
|
6807
6807
|
case "insertReplacementText":
|
|
6808
|
-
|
|
6808
|
+
W(n, Sr, t);
|
|
6809
6809
|
break;
|
|
6810
6810
|
case "insertFromComposition":
|
|
6811
|
-
Ge(null),
|
|
6811
|
+
Ge(null), W(n, Sr, t);
|
|
6812
6812
|
break;
|
|
6813
6813
|
case "insertLineBreak":
|
|
6814
|
-
Ge(null),
|
|
6814
|
+
Ge(null), W(n, Er, !1);
|
|
6815
6815
|
break;
|
|
6816
6816
|
case "insertParagraph":
|
|
6817
|
-
Ge(null), nn && !gn ? (nn = !1,
|
|
6817
|
+
Ge(null), nn && !gn ? (nn = !1, W(n, Er, !1)) : W(n, ln, void 0);
|
|
6818
6818
|
break;
|
|
6819
6819
|
case "insertFromPaste":
|
|
6820
6820
|
case "insertFromPasteAsQuotation":
|
|
6821
|
-
|
|
6821
|
+
W(n, os, t);
|
|
6822
6822
|
break;
|
|
6823
6823
|
case "deleteByComposition":
|
|
6824
6824
|
(function(h, g) {
|
|
6825
6825
|
return h !== g || N(h) || N(g) || !h.isToken() || !g.isToken();
|
|
6826
|
-
})(d, f) &&
|
|
6826
|
+
})(d, f) && W(n, Ws, t);
|
|
6827
6827
|
break;
|
|
6828
6828
|
case "deleteByDrag":
|
|
6829
6829
|
case "deleteByCut":
|
|
6830
|
-
|
|
6830
|
+
W(n, Ws, t);
|
|
6831
6831
|
break;
|
|
6832
6832
|
case "deleteContent":
|
|
6833
|
-
|
|
6833
|
+
W(n, or, !1);
|
|
6834
6834
|
break;
|
|
6835
6835
|
case "deleteWordBackward":
|
|
6836
|
-
|
|
6836
|
+
W(n, an, !0);
|
|
6837
6837
|
break;
|
|
6838
6838
|
case "deleteWordForward":
|
|
6839
|
-
|
|
6839
|
+
W(n, an, !1);
|
|
6840
6840
|
break;
|
|
6841
6841
|
case "deleteHardLineBackward":
|
|
6842
6842
|
case "deleteSoftLineBackward":
|
|
6843
|
-
|
|
6843
|
+
W(n, un, !0);
|
|
6844
6844
|
break;
|
|
6845
6845
|
case "deleteContentForward":
|
|
6846
6846
|
case "deleteHardLineForward":
|
|
6847
6847
|
case "deleteSoftLineForward":
|
|
6848
|
-
|
|
6848
|
+
W(n, un, !1);
|
|
6849
6849
|
break;
|
|
6850
6850
|
case "formatStrikeThrough":
|
|
6851
|
-
|
|
6851
|
+
W(n, xt, "strikethrough");
|
|
6852
6852
|
break;
|
|
6853
6853
|
case "formatBold":
|
|
6854
|
-
|
|
6854
|
+
W(n, xt, "bold");
|
|
6855
6855
|
break;
|
|
6856
6856
|
case "formatItalic":
|
|
6857
|
-
|
|
6857
|
+
W(n, xt, "italic");
|
|
6858
6858
|
break;
|
|
6859
6859
|
case "formatUnderline":
|
|
6860
|
-
|
|
6860
|
+
W(n, xt, "underline");
|
|
6861
6861
|
break;
|
|
6862
6862
|
case "historyUndo":
|
|
6863
|
-
|
|
6863
|
+
W(n, hi, void 0);
|
|
6864
6864
|
break;
|
|
6865
6865
|
case "historyRedo":
|
|
6866
|
-
|
|
6866
|
+
W(n, pi, void 0);
|
|
6867
6867
|
}
|
|
6868
6868
|
else {
|
|
6869
6869
|
if (a === `
|
|
6870
|
-
`) t.preventDefault(),
|
|
6871
|
-
else if (a === Mt) t.preventDefault(),
|
|
6870
|
+
`) t.preventDefault(), W(n, Er, !1);
|
|
6871
|
+
else if (a === Mt) t.preventDefault(), W(n, ln, void 0);
|
|
6872
6872
|
else if (a == null && t.dataTransfer) {
|
|
6873
6873
|
const h = t.dataTransfer.getData("text/plain");
|
|
6874
6874
|
t.preventDefault(), i.insertRawText(h);
|
|
6875
|
-
} else a != null && Yl(i, o, a, t.timeStamp, !0) ? (t.preventDefault(),
|
|
6875
|
+
} else a != null && Yl(i, o, a, t.timeStamp, !0) ? (t.preventDefault(), W(n, Sr, a)) : Cr = a;
|
|
6876
6876
|
Jl = t.timeStamp;
|
|
6877
6877
|
}
|
|
6878
6878
|
});
|
|
@@ -6881,7 +6881,7 @@ let rn = 0, Hl = null, Jl = 0, Cr = null;
|
|
|
6881
6881
|
const Zn = /* @__PURE__ */ new WeakMap();
|
|
6882
6882
|
let ri = !1, ni = !1, nn = !1, Gr = !1, Ql = [0, "", 0, "root", 0];
|
|
6883
6883
|
function Yl(r, e, t, n, s) {
|
|
6884
|
-
const o = r.anchor, i = r.focus, l = o.getNode(), a =
|
|
6884
|
+
const o = r.anchor, i = r.focus, l = o.getNode(), a = Ne(), u = ut(a._window), c = u !== null ? u.anchorNode : null, d = o.key, f = a.getElementByKey(d), h = t.length;
|
|
6885
6885
|
return d !== i.key || !q(l) || (!s && (!zn || Jl < n + 50) || l.isDirty() && h < 2 || Ol(t)) && o.offset !== i.offset && !l.isComposing() || sr(l) || l.isDirty() && h > 1 || (s || !zn) && f !== null && !l.isComposing() && c !== Gn(f) || u !== null && e !== null && (!e.collapsed || e.startContainer !== u.anchorNode || e.startOffset !== u.anchorOffset) || l.getFormat() !== r.format || l.getStyle() !== r.style || ic(r, l);
|
|
6886
6886
|
}
|
|
6887
6887
|
function ho(r, e) {
|
|
@@ -6897,7 +6897,7 @@ function po(r, e, t) {
|
|
|
6897
6897
|
const a = l.anchor, u = a.getNode();
|
|
6898
6898
|
if (l.isCollapsed()) {
|
|
6899
6899
|
r.type === "Range" && r.anchorNode === r.focusNode && (l.dirty = !0);
|
|
6900
|
-
const c = hs(e).event, d = c ? c.timeStamp : performance.now(), [f, h, g, m, y] = Ql, C =
|
|
6900
|
+
const c = hs(e).event, d = c ? c.timeStamp : performance.now(), [f, h, g, m, y] = Ql, C = Se(), x = e.isComposing() === !1 && C.getTextContent() === "";
|
|
6901
6901
|
if (d < y + 200 && a.offset === g && a.key === m) l.format = f, l.style = h;
|
|
6902
6902
|
else if (a.type === "text") q(u) || z(141), l.format = u.getFormat(), l.style = u.getStyle();
|
|
6903
6903
|
else if (a.type === "element" && !x) {
|
|
@@ -6914,7 +6914,7 @@ function po(r, e, t) {
|
|
|
6914
6914
|
l.format = w ? A : 0;
|
|
6915
6915
|
}
|
|
6916
6916
|
}
|
|
6917
|
-
|
|
6917
|
+
W(e, fi, void 0);
|
|
6918
6918
|
});
|
|
6919
6919
|
}
|
|
6920
6920
|
function Xl(r) {
|
|
@@ -6934,7 +6934,7 @@ function Ps(r, e) {
|
|
|
6934
6934
|
const n = V();
|
|
6935
6935
|
if (M(n)) {
|
|
6936
6936
|
const s = n.focus;
|
|
6937
|
-
return n.anchor.set(s.key, s.offset, s.type), void
|
|
6937
|
+
return n.anchor.set(s.key, s.offset, s.type), void W(r, $n, null);
|
|
6938
6938
|
}
|
|
6939
6939
|
}
|
|
6940
6940
|
}
|
|
@@ -7190,7 +7190,7 @@ class gs {
|
|
|
7190
7190
|
return t || n.reverse(), n;
|
|
7191
7191
|
}
|
|
7192
7192
|
isDirty() {
|
|
7193
|
-
const e =
|
|
7193
|
+
const e = Ne()._dirtyLeaves;
|
|
7194
7194
|
return e !== null && e.has(this.__key);
|
|
7195
7195
|
}
|
|
7196
7196
|
getLatest() {
|
|
@@ -7199,7 +7199,7 @@ class gs {
|
|
|
7199
7199
|
}
|
|
7200
7200
|
getWritable() {
|
|
7201
7201
|
et();
|
|
7202
|
-
const e = $t(), t =
|
|
7202
|
+
const e = $t(), t = Ne(), n = e._nodeMap, s = this.__key, o = this.getLatest(), i = t._cloneNotNeeded, l = V();
|
|
7203
7203
|
if (l !== null && l.setCachedNodes(null), i.has(s)) return Kn(o), o;
|
|
7204
7204
|
const a = Fi(o);
|
|
7205
7205
|
return i.add(s), Kn(a), n.set(s, a), a;
|
|
@@ -7280,7 +7280,7 @@ class gs {
|
|
|
7280
7280
|
return !1;
|
|
7281
7281
|
}
|
|
7282
7282
|
createParentElementNode() {
|
|
7283
|
-
return
|
|
7283
|
+
return Pe();
|
|
7284
7284
|
}
|
|
7285
7285
|
selectStart() {
|
|
7286
7286
|
return this.selectPrevious();
|
|
@@ -7512,7 +7512,7 @@ class Lr extends gs {
|
|
|
7512
7512
|
return { "#text": () => ({ conversion: wc, priority: 0 }), b: () => ({ conversion: _c, priority: 0 }), code: () => ({ conversion: Gt, priority: 0 }), em: () => ({ conversion: Gt, priority: 0 }), i: () => ({ conversion: Gt, priority: 0 }), s: () => ({ conversion: Gt, priority: 0 }), span: () => ({ conversion: bc, priority: 0 }), strong: () => ({ conversion: Gt, priority: 0 }), sub: () => ({ conversion: Gt, priority: 0 }), sup: () => ({ conversion: Gt, priority: 0 }), u: () => ({ conversion: Gt, priority: 0 }) };
|
|
7513
7513
|
}
|
|
7514
7514
|
static importJSON(e) {
|
|
7515
|
-
const t =
|
|
7515
|
+
const t = Re(e.text);
|
|
7516
7516
|
return t.setFormat(e.format), t.setDetail(e.detail), t.setMode(e.mode), t.setStyle(e.style), t;
|
|
7517
7517
|
}
|
|
7518
7518
|
exportDOM(e) {
|
|
@@ -7612,11 +7612,11 @@ class Lr extends gs {
|
|
|
7612
7612
|
let h;
|
|
7613
7613
|
const g = t.getFormat(), m = t.getStyle(), y = t.__detail;
|
|
7614
7614
|
let C = !1;
|
|
7615
|
-
t.isSegmented() ? (h =
|
|
7615
|
+
t.isSegmented() ? (h = Re(d), h.__format = g, h.__style = m, h.__detail = y, C = !0) : (h = t.getWritable(), h.__text = d);
|
|
7616
7616
|
const x = V(), A = [h];
|
|
7617
7617
|
let w = d.length;
|
|
7618
7618
|
for (let E = 1; E < c; E++) {
|
|
7619
|
-
const v = l[E], b = v.length, D =
|
|
7619
|
+
const v = l[E], b = v.length, D = Re(v).getWritable();
|
|
7620
7620
|
D.__format = g, D.__style = m, D.__detail = y;
|
|
7621
7621
|
const k = D.__key, I = w + b;
|
|
7622
7622
|
if (M(x)) {
|
|
@@ -7682,7 +7682,7 @@ function wc(r) {
|
|
|
7682
7682
|
const l = n[i];
|
|
7683
7683
|
l === `
|
|
7684
7684
|
` || l === `\r
|
|
7685
|
-
` ? s.push(fr()) : l === " " ? s.push(vn()) : l !== "" && s.push(
|
|
7685
|
+
` ? s.push(fr()) : l === " " ? s.push(vn()) : l !== "" && s.push(Re(l));
|
|
7686
7686
|
}
|
|
7687
7687
|
return { node: s };
|
|
7688
7688
|
}
|
|
@@ -7707,7 +7707,7 @@ function wc(r) {
|
|
|
7707
7707
|
}
|
|
7708
7708
|
s && (t = t.slice(0, t.length - 1));
|
|
7709
7709
|
}
|
|
7710
|
-
return t === "" ? { node: null } : { node:
|
|
7710
|
+
return t === "" ? { node: null } : { node: Re(t) };
|
|
7711
7711
|
}
|
|
7712
7712
|
function bo(r, e) {
|
|
7713
7713
|
let t = r;
|
|
@@ -7733,7 +7733,7 @@ function Gt(r) {
|
|
|
7733
7733
|
const e = Cc[r.nodeName.toLowerCase()];
|
|
7734
7734
|
return e === void 0 ? { node: null } : { forChild: Li(r.style, e), node: null };
|
|
7735
7735
|
}
|
|
7736
|
-
function
|
|
7736
|
+
function Re(r = "") {
|
|
7737
7737
|
return Lt(new Lr(r));
|
|
7738
7738
|
}
|
|
7739
7739
|
function q(r) {
|
|
@@ -7975,7 +7975,7 @@ class er {
|
|
|
7975
7975
|
return u;
|
|
7976
7976
|
}
|
|
7977
7977
|
applyDOMRange(e) {
|
|
7978
|
-
const t =
|
|
7978
|
+
const t = Ne(), n = t.getEditorState()._selection, s = sa(e.startContainer, e.startOffset, e.endContainer, e.endOffset, t, n);
|
|
7979
7979
|
if (s === null) return;
|
|
7980
7980
|
const [o, i] = s;
|
|
7981
7981
|
Kt(this.anchor, o.key, o.offset, o.type), Kt(this.focus, i.key, i.offset, i.type), this._cachedNodes = null;
|
|
@@ -8000,7 +8000,7 @@ class er {
|
|
|
8000
8000
|
const i = t[o];
|
|
8001
8001
|
i === `
|
|
8002
8002
|
` || i === `\r
|
|
8003
|
-
` ? n.push(fr()) : i === " " ? n.push(vn()) : n.push(
|
|
8003
|
+
` ? n.push(fr()) : i === " " ? n.push(vn()) : n.push(Re(i));
|
|
8004
8004
|
}
|
|
8005
8005
|
this.insertNodes(n);
|
|
8006
8006
|
}
|
|
@@ -8008,7 +8008,7 @@ class er {
|
|
|
8008
8008
|
const t = this.anchor, n = this.focus, s = this.format, o = this.style;
|
|
8009
8009
|
let i = t, l = n;
|
|
8010
8010
|
!this.isCollapsed() && n.isBefore(t) && (i = n, l = t), i.type === "element" && function(y, C, x, A) {
|
|
8011
|
-
const w = y.getNode(), E = w.getChildAtIndex(y.offset), v =
|
|
8011
|
+
const w = y.getNode(), E = w.getChildAtIndex(y.offset), v = Re(), b = Ye(w) ? Pe().append(v) : v;
|
|
8012
8012
|
v.setFormat(x), v.setStyle(A), E === null ? w.append(b) : E.insertBefore(b), y.is(C) && C.set(v.__key, 0, "text"), y.set(v.__key, 0, "text");
|
|
8013
8013
|
}(i, l, s, o);
|
|
8014
8014
|
const a = i.offset;
|
|
@@ -8020,12 +8020,12 @@ class er {
|
|
|
8020
8020
|
let m = c[d - 1];
|
|
8021
8021
|
if (d === 1 && l.type === "element" && (u = h, l.set(i.key, u, "text")), this.isCollapsed() && a === h && (f.isSegmented() || f.isToken() || !f.canInsertTextAfter() || !g.canInsertTextAfter() && f.getNextSibling() === null)) {
|
|
8022
8022
|
let y = f.getNextSibling();
|
|
8023
|
-
if (q(y) && y.canInsertTextBefore() && !sr(y) || (y =
|
|
8023
|
+
if (q(y) && y.canInsertTextBefore() && !sr(y) || (y = Re(), y.setFormat(s), y.setStyle(o), g.canInsertTextAfter() ? f.insertAfter(y) : g.insertAfter(y)), y.select(0, 0), f = y, e !== "") return void this.insertText(e);
|
|
8024
8024
|
} else if (this.isCollapsed() && a === 0 && (f.isSegmented() || f.isToken() || !f.canInsertTextBefore() || !g.canInsertTextBefore() && f.getPreviousSibling() === null)) {
|
|
8025
8025
|
let y = f.getPreviousSibling();
|
|
8026
|
-
if (q(y) && !sr(y) || (y =
|
|
8026
|
+
if (q(y) && !sr(y) || (y = Re(), y.setFormat(s), g.canInsertTextBefore() ? f.insertBefore(y) : g.insertBefore(y)), y.select(), f = y, e !== "") return void this.insertText(e);
|
|
8027
8027
|
} else if (f.isSegmented() && a !== h) {
|
|
8028
|
-
const y =
|
|
8028
|
+
const y = Re(f.getTextContent());
|
|
8029
8029
|
y.setFormat(s), f.replace(y), f = y;
|
|
8030
8030
|
} else if (!this.isCollapsed() && e !== "") {
|
|
8031
8031
|
const y = m.getParent();
|
|
@@ -8033,18 +8033,18 @@ class er {
|
|
|
8033
8033
|
}
|
|
8034
8034
|
if (d === 1) {
|
|
8035
8035
|
if (f.isToken()) {
|
|
8036
|
-
const A =
|
|
8036
|
+
const A = Re(e);
|
|
8037
8037
|
return A.select(), void f.replace(A);
|
|
8038
8038
|
}
|
|
8039
8039
|
const y = f.getFormat(), C = f.getStyle();
|
|
8040
8040
|
if (a !== u || y === s && C === o) {
|
|
8041
8041
|
if (Dc(f)) {
|
|
8042
|
-
const A =
|
|
8042
|
+
const A = Re(e);
|
|
8043
8043
|
return A.setFormat(s), A.setStyle(o), A.select(), void f.replace(A);
|
|
8044
8044
|
}
|
|
8045
8045
|
} else {
|
|
8046
8046
|
if (f.getTextContent() !== "") {
|
|
8047
|
-
const A =
|
|
8047
|
+
const A = Re(e);
|
|
8048
8048
|
if (A.setFormat(s), A.setStyle(o), A.select(), a === 0) f.insertBefore(A, !1);
|
|
8049
8049
|
else {
|
|
8050
8050
|
const [w] = f.splitText(a);
|
|
@@ -8064,7 +8064,7 @@ class er {
|
|
|
8064
8064
|
while (x.isInline());
|
|
8065
8065
|
if (l.type === "text" && (u !== 0 || m.getTextContent() === "") || l.type === "element" && m.getIndexWithinParent() < u) if (q(m) && !m.isToken() && u !== m.getTextContentSize()) {
|
|
8066
8066
|
if (m.isSegmented()) {
|
|
8067
|
-
const D =
|
|
8067
|
+
const D = Re(m.getTextContent());
|
|
8068
8068
|
m.replace(D), m = D;
|
|
8069
8069
|
}
|
|
8070
8070
|
Ye(l.getNode()) || l.type !== "text" || (m = m.spliceText(0, u, "")), y.add(m.__key);
|
|
@@ -8088,7 +8088,7 @@ class er {
|
|
|
8088
8088
|
}
|
|
8089
8089
|
if (f.isToken()) if (a === h) f.select();
|
|
8090
8090
|
else {
|
|
8091
|
-
const D =
|
|
8091
|
+
const D = Re(e);
|
|
8092
8092
|
D.select(), f.replace(D);
|
|
8093
8093
|
}
|
|
8094
8094
|
else f = f.spliceText(a, h - a, e, !0), f.getTextContent() === "" ? f.remove() : f.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length);
|
|
@@ -8109,7 +8109,7 @@ class er {
|
|
|
8109
8109
|
const c = (d, f) => {
|
|
8110
8110
|
if (d.getTextContent() === "") d.remove();
|
|
8111
8111
|
else if (f !== 0 && sr(d)) {
|
|
8112
|
-
const h =
|
|
8112
|
+
const h = Re(d.getTextContent());
|
|
8113
8113
|
return h.setFormat(d.getFormat()), h.setStyle(d.getStyle()), d.replace(h);
|
|
8114
8114
|
}
|
|
8115
8115
|
};
|
|
@@ -8184,7 +8184,7 @@ class er {
|
|
|
8184
8184
|
return n.splice(g, 0, e), void s.selectEnd();
|
|
8185
8185
|
}
|
|
8186
8186
|
const o = function(g) {
|
|
8187
|
-
const m =
|
|
8187
|
+
const m = Pe();
|
|
8188
8188
|
let y = null;
|
|
8189
8189
|
for (let C = 0; C < g.length; C++) {
|
|
8190
8190
|
const x = g[C], A = ar(x);
|
|
@@ -8212,8 +8212,8 @@ class er {
|
|
|
8212
8212
|
}
|
|
8213
8213
|
insertParagraph() {
|
|
8214
8214
|
if (this.anchor.key === "root") {
|
|
8215
|
-
const i =
|
|
8216
|
-
return
|
|
8215
|
+
const i = Pe();
|
|
8216
|
+
return Se().splice(this.anchor.offset, 0, [i]), i.select(), i;
|
|
8217
8217
|
}
|
|
8218
8218
|
const e = Is(this), t = Wr(this.anchor.getNode(), Vt);
|
|
8219
8219
|
N(t) || z(213);
|
|
@@ -8268,7 +8268,7 @@ class er {
|
|
|
8268
8268
|
return N(f) ? (m = f.__key, g = t ? f.getChildrenSize() : 0) : (g = l.getIndexWithinParent(), m = h.__key, t || g++), s.set(m, g, "element"), void (i && o.set(m, g, "element"));
|
|
8269
8269
|
}
|
|
8270
8270
|
}
|
|
8271
|
-
const a =
|
|
8271
|
+
const a = Ne(), u = ut(a._window);
|
|
8272
8272
|
if (!u) return;
|
|
8273
8273
|
const c = a._blockCursorElement, d = a._rootElement;
|
|
8274
8274
|
if (d === null || c === null || !N(l) || l.isInline() || l.canBeEmpty() || Ni(c, a, d), function(f, h, g, m) {
|
|
@@ -8316,7 +8316,7 @@ class er {
|
|
|
8316
8316
|
const l = Ao();
|
|
8317
8317
|
l.add(i.__key), Nt(l);
|
|
8318
8318
|
} else
|
|
8319
|
-
i.remove(),
|
|
8319
|
+
i.remove(), Ne().dispatchCommand(fi, void 0);
|
|
8320
8320
|
return;
|
|
8321
8321
|
}
|
|
8322
8322
|
if (!e && N(i) && N(s) && s.isEmpty()) return s.remove(), void i.selectStart();
|
|
@@ -8459,7 +8459,7 @@ function na(r, e, t) {
|
|
|
8459
8459
|
if (r.type === "text" && e.type === "text") {
|
|
8460
8460
|
const n = r.isBefore(e), s = r.is(e);
|
|
8461
8461
|
Do(r, n, s), Do(e, !n, s), s && (e.key = r.key, e.offset = r.offset, e.type = r.type);
|
|
8462
|
-
const o =
|
|
8462
|
+
const o = Ne();
|
|
8463
8463
|
if (o.isComposing() && o._compositionKey !== r.key && M(t)) {
|
|
8464
8464
|
const i = t.anchor, l = t.focus;
|
|
8465
8465
|
Kt(r, i.key, i.offset, i.type), Kt(e, l.key, l.offset, l.type);
|
|
@@ -8509,7 +8509,7 @@ function V() {
|
|
|
8509
8509
|
return $t()._selection;
|
|
8510
8510
|
}
|
|
8511
8511
|
function wn() {
|
|
8512
|
-
return
|
|
8512
|
+
return Ne()._editorState._selection;
|
|
8513
8513
|
}
|
|
8514
8514
|
function es(r, e, t, n = 1) {
|
|
8515
8515
|
const s = r.anchor, o = r.focus, i = s.getNode(), l = o.getNode();
|
|
@@ -8595,21 +8595,21 @@ function Sc(r, e, t, n, s, o, i) {
|
|
|
8595
8595
|
(function(de, ie, oe) {
|
|
8596
8596
|
const ve = oe.ownerDocument, pe = ve.defaultView;
|
|
8597
8597
|
if (pe === null) return;
|
|
8598
|
-
let { top: we, bottom:
|
|
8598
|
+
let { top: we, bottom: ke } = ie, Me = 0, Te = 0, Ce = oe;
|
|
8599
8599
|
for (; Ce !== null; ) {
|
|
8600
8600
|
const Ve = Ce === ve.body;
|
|
8601
|
-
if (Ve)
|
|
8601
|
+
if (Ve) Me = 0, Te = hs(de).innerHeight;
|
|
8602
8602
|
else {
|
|
8603
8603
|
const ge = Ce.getBoundingClientRect();
|
|
8604
|
-
|
|
8604
|
+
Me = ge.top, Te = ge.bottom;
|
|
8605
8605
|
}
|
|
8606
|
-
let
|
|
8607
|
-
if (we <
|
|
8606
|
+
let qe = 0;
|
|
8607
|
+
if (we < Me ? qe = -(Me - we) : ke > Te && (qe = ke - Te), qe !== 0) if (Ve) pe.scrollBy(0, qe);
|
|
8608
8608
|
else {
|
|
8609
8609
|
const ge = Ce.scrollTop;
|
|
8610
|
-
Ce.scrollTop +=
|
|
8611
|
-
const
|
|
8612
|
-
we -=
|
|
8610
|
+
Ce.scrollTop += qe;
|
|
8611
|
+
const Ie = Ce.scrollTop - ge;
|
|
8612
|
+
we -= Ie, ke -= Ie;
|
|
8613
8613
|
}
|
|
8614
8614
|
if (Ve) break;
|
|
8615
8615
|
Ce = xn(Ce);
|
|
@@ -8622,7 +8622,7 @@ function Sc(r, e, t, n, s, o, i) {
|
|
|
8622
8622
|
}
|
|
8623
8623
|
function oa(r) {
|
|
8624
8624
|
let e = V() || wn();
|
|
8625
|
-
e === null && (e =
|
|
8625
|
+
e === null && (e = Se().selectEnd()), e.insertNodes(r);
|
|
8626
8626
|
}
|
|
8627
8627
|
function Is(r) {
|
|
8628
8628
|
let e = r;
|
|
@@ -8637,8 +8637,8 @@ function Is(r) {
|
|
|
8637
8637
|
function kc(r, e) {
|
|
8638
8638
|
const t = r.getParent();
|
|
8639
8639
|
if (!t) {
|
|
8640
|
-
const s =
|
|
8641
|
-
return
|
|
8640
|
+
const s = Pe();
|
|
8641
|
+
return Se().append(s), s.select(), [Se(), 0];
|
|
8642
8642
|
}
|
|
8643
8643
|
if (q(r)) {
|
|
8644
8644
|
const s = r.splitText(e);
|
|
@@ -8654,10 +8654,10 @@ function kc(r, e) {
|
|
|
8654
8654
|
}
|
|
8655
8655
|
return [t, r.getIndexWithinParent() + 1];
|
|
8656
8656
|
}
|
|
8657
|
-
let
|
|
8657
|
+
let $e = null, ze = null, tt = !1, $s = !1, On = 0;
|
|
8658
8658
|
const ko = { characterData: !0, childList: !0, subtree: !0 };
|
|
8659
8659
|
function Cn() {
|
|
8660
|
-
return tt ||
|
|
8660
|
+
return tt || $e !== null && $e._readOnly;
|
|
8661
8661
|
}
|
|
8662
8662
|
function et() {
|
|
8663
8663
|
tt && z(13);
|
|
@@ -8666,10 +8666,10 @@ function la() {
|
|
|
8666
8666
|
On > 99 && z(14);
|
|
8667
8667
|
}
|
|
8668
8668
|
function $t() {
|
|
8669
|
-
return
|
|
8669
|
+
return $e === null && z(195, aa()), $e;
|
|
8670
8670
|
}
|
|
8671
|
-
function
|
|
8672
|
-
return
|
|
8671
|
+
function Ne() {
|
|
8672
|
+
return ze === null && z(196, aa()), ze;
|
|
8673
8673
|
}
|
|
8674
8674
|
function aa() {
|
|
8675
8675
|
let r = 0;
|
|
@@ -8686,7 +8686,7 @@ function aa() {
|
|
|
8686
8686
|
return e.size && (n += ` and incompatible editors with versions ${Array.from(e).join(", ")}`), n;
|
|
8687
8687
|
}
|
|
8688
8688
|
function Tc() {
|
|
8689
|
-
return
|
|
8689
|
+
return ze;
|
|
8690
8690
|
}
|
|
8691
8691
|
function To(r, e, t) {
|
|
8692
8692
|
const n = e.__type, s = function(l, a) {
|
|
@@ -8709,7 +8709,7 @@ function ua(r, e) {
|
|
|
8709
8709
|
for (const s of n) t.add(s);
|
|
8710
8710
|
}
|
|
8711
8711
|
function Bc(r) {
|
|
8712
|
-
return Ri(r,
|
|
8712
|
+
return Ri(r, Ne()._nodes);
|
|
8713
8713
|
}
|
|
8714
8714
|
function Ri(r, e) {
|
|
8715
8715
|
const t = r.type, n = e.get(t);
|
|
@@ -8724,21 +8724,21 @@ function Ri(r, e) {
|
|
|
8724
8724
|
return o;
|
|
8725
8725
|
}
|
|
8726
8726
|
function No(r, e, t) {
|
|
8727
|
-
const n =
|
|
8728
|
-
|
|
8727
|
+
const n = $e, s = tt, o = ze;
|
|
8728
|
+
$e = e, tt = !0, ze = r;
|
|
8729
8729
|
try {
|
|
8730
8730
|
return t();
|
|
8731
8731
|
} finally {
|
|
8732
|
-
|
|
8732
|
+
$e = n, tt = s, ze = o;
|
|
8733
8733
|
}
|
|
8734
8734
|
}
|
|
8735
8735
|
function Jt(r, e) {
|
|
8736
8736
|
const t = r._pendingEditorState, n = r._rootElement, s = r._headless || n === null;
|
|
8737
8737
|
if (t === null) return;
|
|
8738
|
-
const o = r._editorState, i = o._selection, l = t._selection, a = r._dirtyType !== ur, u =
|
|
8738
|
+
const o = r._editorState, i = o._selection, l = t._selection, a = r._dirtyType !== ur, u = $e, c = tt, d = ze, f = r._updating, h = r._observer;
|
|
8739
8739
|
let g = null;
|
|
8740
8740
|
if (r._pendingEditorState = null, r._editorState = t, !s && a && h !== null) {
|
|
8741
|
-
|
|
8741
|
+
ze = r, $e = t, tt = !1, r._updating = !0;
|
|
8742
8742
|
try {
|
|
8743
8743
|
const v = r._dirtyType, b = r._dirtyElements, D = r._dirtyLeaves;
|
|
8744
8744
|
h.disconnect(), g = mc(o, t, r, v, b, D);
|
|
@@ -8746,7 +8746,7 @@ function Jt(r, e) {
|
|
|
8746
8746
|
if (v instanceof Error && r._onError(v), $s) throw v;
|
|
8747
8747
|
return pa(r, null, n, t), Bl(r), r._dirtyType = Br, $s = !0, Jt(r, o), void ($s = !1);
|
|
8748
8748
|
} finally {
|
|
8749
|
-
h.observe(n, ko), r._updating = f,
|
|
8749
|
+
h.observe(n, ko), r._updating = f, $e = u, tt = c, ze = d;
|
|
8750
8750
|
}
|
|
8751
8751
|
}
|
|
8752
8752
|
t._readOnly || (t._readOnly = !0);
|
|
@@ -8760,7 +8760,7 @@ function Jt(r, e) {
|
|
|
8760
8760
|
}(r, t);
|
|
8761
8761
|
const w = s ? null : ut(r._window);
|
|
8762
8762
|
if (r._editable && w !== null && (a || l === null || l.dirty)) {
|
|
8763
|
-
|
|
8763
|
+
ze = r, $e = t;
|
|
8764
8764
|
try {
|
|
8765
8765
|
if (h !== null && h.disconnect(), a || l === null || l.dirty) {
|
|
8766
8766
|
const v = r._blockCursorElement;
|
|
@@ -8768,7 +8768,7 @@ function Jt(r, e) {
|
|
|
8768
8768
|
}
|
|
8769
8769
|
ac(r, n, l), h !== null && h.observe(n, ko);
|
|
8770
8770
|
} finally {
|
|
8771
|
-
|
|
8771
|
+
ze = d, $e = u;
|
|
8772
8772
|
}
|
|
8773
8773
|
}
|
|
8774
8774
|
g !== null && function(v, b, D, k, I) {
|
|
@@ -8814,7 +8814,7 @@ function sn(r, e, t, ...n) {
|
|
|
8814
8814
|
}
|
|
8815
8815
|
}
|
|
8816
8816
|
function ca(r, e, t) {
|
|
8817
|
-
if (r._updating === !1 ||
|
|
8817
|
+
if (r._updating === !1 || ze !== r) {
|
|
8818
8818
|
let s = !1;
|
|
8819
8819
|
return r.update(() => {
|
|
8820
8820
|
s = ca(r, e, t);
|
|
@@ -8860,8 +8860,8 @@ function da(r, e, t) {
|
|
|
8860
8860
|
const l = r._editorState;
|
|
8861
8861
|
let a = r._pendingEditorState, u = !1;
|
|
8862
8862
|
(a === null || a._readOnly) && (a = r._pendingEditorState = fa(a || l), u = !0), a._flushSync = i;
|
|
8863
|
-
const c =
|
|
8864
|
-
|
|
8863
|
+
const c = $e, d = tt, f = ze, h = r._updating;
|
|
8864
|
+
$e = a, tt = !1, r._updating = !0, ze = r;
|
|
8865
8865
|
try {
|
|
8866
8866
|
u && (r._headless ? l._selection !== null && (a._selection = l._selection.clone()) : a._selection = function(C) {
|
|
8867
8867
|
const x = C.getEditorState()._selection, A = ut(C._window);
|
|
@@ -8929,7 +8929,7 @@ function da(r, e, t) {
|
|
|
8929
8929
|
} catch (m) {
|
|
8930
8930
|
return m instanceof Error && r._onError(m), r._pendingEditorState = l, r._dirtyType = Br, r._cloneNotNeeded.clear(), r._dirtyLeaves = /* @__PURE__ */ new Set(), r._dirtyElements.clear(), void Jt(r);
|
|
8931
8931
|
} finally {
|
|
8932
|
-
|
|
8932
|
+
$e = c, tt = d, ze = f, r._updating = h, On = 0;
|
|
8933
8933
|
}
|
|
8934
8934
|
r._dirtyType !== ur || function(m, y) {
|
|
8935
8935
|
const C = y.getEditorState()._selection, x = m._selection;
|
|
@@ -9074,7 +9074,7 @@ class zt extends gs {
|
|
|
9074
9074
|
return this.getChildrenSize() === 0;
|
|
9075
9075
|
}
|
|
9076
9076
|
isDirty() {
|
|
9077
|
-
const e =
|
|
9077
|
+
const e = Ne()._dirtyElements;
|
|
9078
9078
|
return e !== null && e.has(this.__key);
|
|
9079
9079
|
}
|
|
9080
9080
|
isLastChild() {
|
|
@@ -9388,7 +9388,7 @@ class Dn extends zt {
|
|
|
9388
9388
|
}
|
|
9389
9389
|
getTextContent() {
|
|
9390
9390
|
const e = this.__cachedText;
|
|
9391
|
-
return !Cn() &&
|
|
9391
|
+
return !Cn() && Ne()._dirtyType !== ur || e === null ? super.getTextContent() : e;
|
|
9392
9392
|
}
|
|
9393
9393
|
remove() {
|
|
9394
9394
|
z(52);
|
|
@@ -9413,7 +9413,7 @@ class Dn extends zt {
|
|
|
9413
9413
|
return super.append(...e);
|
|
9414
9414
|
}
|
|
9415
9415
|
static importJSON(e) {
|
|
9416
|
-
const t =
|
|
9416
|
+
const t = Se();
|
|
9417
9417
|
return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
|
|
9418
9418
|
}
|
|
9419
9419
|
exportJSON() {
|
|
@@ -9460,7 +9460,7 @@ class ys {
|
|
|
9460
9460
|
return t._readOnly = !0, t;
|
|
9461
9461
|
}
|
|
9462
9462
|
toJSON() {
|
|
9463
|
-
return No(null, this, () => ({ root: ha(
|
|
9463
|
+
return No(null, this, () => ({ root: ha(Se()) }));
|
|
9464
9464
|
}
|
|
9465
9465
|
}
|
|
9466
9466
|
class Mi extends zt {
|
|
@@ -9527,14 +9527,14 @@ class Pr extends zt {
|
|
|
9527
9527
|
return { element: t };
|
|
9528
9528
|
}
|
|
9529
9529
|
static importJSON(e) {
|
|
9530
|
-
const t =
|
|
9530
|
+
const t = Pe();
|
|
9531
9531
|
return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t.setTextFormat(e.textFormat), t;
|
|
9532
9532
|
}
|
|
9533
9533
|
exportJSON() {
|
|
9534
9534
|
return { ...super.exportJSON(), textFormat: this.getTextFormat(), textStyle: this.getTextStyle(), type: "paragraph", version: 1 };
|
|
9535
9535
|
}
|
|
9536
9536
|
insertNewAfter(e, t) {
|
|
9537
|
-
const n =
|
|
9537
|
+
const n = Pe();
|
|
9538
9538
|
n.setTextFormat(e.format), n.setTextStyle(e.style);
|
|
9539
9539
|
const s = this.getDirection();
|
|
9540
9540
|
return n.setDirection(s), n.setFormat(this.getFormatType()), n.setStyle(this.getTextStyle()), this.insertAfter(n, t), n;
|
|
@@ -9549,10 +9549,10 @@ class Pr extends zt {
|
|
|
9549
9549
|
}
|
|
9550
9550
|
}
|
|
9551
9551
|
function Fc(r) {
|
|
9552
|
-
const e =
|
|
9552
|
+
const e = Pe();
|
|
9553
9553
|
return r.style && (e.setFormat(r.style.textAlign), ji(r, e)), { node: e };
|
|
9554
9554
|
}
|
|
9555
|
-
function
|
|
9555
|
+
function Pe() {
|
|
9556
9556
|
return Lt(new Pr());
|
|
9557
9557
|
}
|
|
9558
9558
|
function Fr(r) {
|
|
@@ -9683,7 +9683,7 @@ class xs {
|
|
|
9683
9683
|
return i = this, l = e.getType(), nt(i, () => {
|
|
9684
9684
|
const a = $t();
|
|
9685
9685
|
if (a.isEmpty()) return;
|
|
9686
|
-
if (l === "root") return void
|
|
9686
|
+
if (l === "root") return void Se().markDirty();
|
|
9687
9687
|
const u = a._nodeMap;
|
|
9688
9688
|
for (const [, c] of u) c.markDirty();
|
|
9689
9689
|
}, i._pendingEditorState === null ? { tag: "history-merge" } : void 0), () => {
|
|
@@ -9697,7 +9697,7 @@ class xs {
|
|
|
9697
9697
|
return e.every(this.hasNode.bind(this));
|
|
9698
9698
|
}
|
|
9699
9699
|
dispatchCommand(e, t) {
|
|
9700
|
-
return
|
|
9700
|
+
return W(this, e, t);
|
|
9701
9701
|
}
|
|
9702
9702
|
getDecorators() {
|
|
9703
9703
|
return this._decorators;
|
|
@@ -9730,23 +9730,23 @@ class xs {
|
|
|
9730
9730
|
const C = a.isEditable();
|
|
9731
9731
|
switch (h) {
|
|
9732
9732
|
case "cut":
|
|
9733
|
-
return C &&
|
|
9733
|
+
return C && W(a, gi, y);
|
|
9734
9734
|
case "copy":
|
|
9735
|
-
return
|
|
9735
|
+
return W(a, ls, y);
|
|
9736
9736
|
case "paste":
|
|
9737
|
-
return C &&
|
|
9737
|
+
return C && W(a, os, y);
|
|
9738
9738
|
case "dragstart":
|
|
9739
|
-
return C &&
|
|
9739
|
+
return C && W(a, wl, y);
|
|
9740
9740
|
case "dragover":
|
|
9741
|
-
return C &&
|
|
9741
|
+
return C && W(a, Cl, y);
|
|
9742
9742
|
case "dragend":
|
|
9743
|
-
return C &&
|
|
9743
|
+
return C && W(a, Tu, y);
|
|
9744
9744
|
case "focus":
|
|
9745
|
-
return C &&
|
|
9745
|
+
return C && W(a, Fu, y);
|
|
9746
9746
|
case "blur":
|
|
9747
|
-
return C &&
|
|
9747
|
+
return C && W(a, ju, y);
|
|
9748
9748
|
case "drop":
|
|
9749
|
-
return C &&
|
|
9749
|
+
return C && W(a, vl, y);
|
|
9750
9750
|
}
|
|
9751
9751
|
};
|
|
9752
9752
|
l.addEventListener(h, m), d.push(() => {
|
|
@@ -9773,15 +9773,15 @@ class xs {
|
|
|
9773
9773
|
}
|
|
9774
9774
|
parseEditorState(e, t) {
|
|
9775
9775
|
return function(n, s, o) {
|
|
9776
|
-
const i = Oi(), l =
|
|
9777
|
-
s._dirtyElements = /* @__PURE__ */ new Map(), s._dirtyLeaves = /* @__PURE__ */ new Set(), s._cloneNotNeeded = /* @__PURE__ */ new Set(), s._dirtyType = 0,
|
|
9776
|
+
const i = Oi(), l = $e, a = tt, u = ze, c = s._dirtyElements, d = s._dirtyLeaves, f = s._cloneNotNeeded, h = s._dirtyType;
|
|
9777
|
+
s._dirtyElements = /* @__PURE__ */ new Map(), s._dirtyLeaves = /* @__PURE__ */ new Set(), s._cloneNotNeeded = /* @__PURE__ */ new Set(), s._dirtyType = 0, $e = i, tt = !1, ze = s;
|
|
9778
9778
|
try {
|
|
9779
9779
|
const g = s._nodes;
|
|
9780
9780
|
Ri(n.root, g), o && o(), i._readOnly = !0;
|
|
9781
9781
|
} catch (g) {
|
|
9782
9782
|
g instanceof Error && s._onError(g);
|
|
9783
9783
|
} finally {
|
|
9784
|
-
s._dirtyElements = c, s._dirtyLeaves = d, s._cloneNotNeeded = f, s._dirtyType = h,
|
|
9784
|
+
s._dirtyElements = c, s._dirtyLeaves = d, s._cloneNotNeeded = f, s._dirtyType = h, $e = l, tt = a, ze = u;
|
|
9785
9785
|
}
|
|
9786
9786
|
return i;
|
|
9787
9787
|
}(typeof e == "string" ? JSON.parse(e) : e, this, t);
|
|
@@ -9795,7 +9795,7 @@ class xs {
|
|
|
9795
9795
|
focus(e, t = {}) {
|
|
9796
9796
|
const n = this._rootElement;
|
|
9797
9797
|
n !== null && (n.setAttribute("autocapitalize", "off"), nt(this, () => {
|
|
9798
|
-
const s = V(), o =
|
|
9798
|
+
const s = V(), o = Se();
|
|
9799
9799
|
s !== null ? s.dirty = !0 : o.getChildrenSize() !== 0 && (t.defaultSelection === "rootStart" ? o.selectStart() : o.selectEnd());
|
|
9800
9800
|
}, { onUpdate: () => {
|
|
9801
9801
|
n.removeAttribute("autocapitalize"), e && e();
|
|
@@ -9825,9 +9825,9 @@ function Rc({ initialConfig: r, children: e }) {
|
|
|
9825
9825
|
return function(d, f) {
|
|
9826
9826
|
if (f !== null) {
|
|
9827
9827
|
if (f === void 0) d.update(() => {
|
|
9828
|
-
const h =
|
|
9828
|
+
const h = Se();
|
|
9829
9829
|
if (h.isEmpty()) {
|
|
9830
|
-
const g =
|
|
9830
|
+
const g = Pe();
|
|
9831
9831
|
h.append(g);
|
|
9832
9832
|
const m = ga ? document.activeElement : null;
|
|
9833
9833
|
(V() !== null || m !== null && m === d.getRootElement()) && g.select();
|
|
@@ -9844,7 +9844,7 @@ function Rc({ initialConfig: r, children: e }) {
|
|
|
9844
9844
|
break;
|
|
9845
9845
|
case "function":
|
|
9846
9846
|
d.update(() => {
|
|
9847
|
-
|
|
9847
|
+
Se().isEmpty() && f(d);
|
|
9848
9848
|
}, Fn);
|
|
9849
9849
|
}
|
|
9850
9850
|
}
|
|
@@ -9861,7 +9861,7 @@ function Mc(r) {
|
|
|
9861
9861
|
}
|
|
9862
9862
|
function Ic() {
|
|
9863
9863
|
return function(r) {
|
|
9864
|
-
const [e] = vt(), t = bt(() => r(e), [e, r]), [n, s] = H(() => t.initialValueFn()), o =
|
|
9864
|
+
const [e] = vt(), t = bt(() => r(e), [e, r]), [n, s] = H(() => t.initialValueFn()), o = be(n);
|
|
9865
9865
|
return Oc(() => {
|
|
9866
9866
|
const { initialValueFn: i, subscribe: l } = t, a = i();
|
|
9867
9867
|
return o.current !== a && (o.current = a, s(a)), l((u) => {
|
|
@@ -9871,7 +9871,7 @@ function Ic() {
|
|
|
9871
9871
|
}(Mc);
|
|
9872
9872
|
}
|
|
9873
9873
|
function $c() {
|
|
9874
|
-
return
|
|
9874
|
+
return Se().getTextContent();
|
|
9875
9875
|
}
|
|
9876
9876
|
function zc(r, e = !0) {
|
|
9877
9877
|
if (r) return !1;
|
|
@@ -9880,7 +9880,7 @@ function zc(r, e = !0) {
|
|
|
9880
9880
|
}
|
|
9881
9881
|
function qc(r) {
|
|
9882
9882
|
if (!zc(r, !1)) return !1;
|
|
9883
|
-
const e =
|
|
9883
|
+
const e = Se().getChildren(), t = e.length;
|
|
9884
9884
|
if (t > 1) return !1;
|
|
9885
9885
|
for (let n = 0; n < t; n++) {
|
|
9886
9886
|
const s = e[n];
|
|
@@ -9948,7 +9948,7 @@ function Jc(r, e) {
|
|
|
9948
9948
|
if (r === null) return;
|
|
9949
9949
|
const t = r.getStartEndPoints(), n = t ? t[0] : null;
|
|
9950
9950
|
if (n !== null && n.key === "root") {
|
|
9951
|
-
const i = e(), l =
|
|
9951
|
+
const i = e(), l = Se(), a = l.getFirstChild();
|
|
9952
9952
|
return void (a ? a.replace(i, !0) : l.append(i));
|
|
9953
9953
|
}
|
|
9954
9954
|
const s = r.getNodes(), o = n !== null && function(i, l) {
|
|
@@ -10029,7 +10029,7 @@ function rd(r) {
|
|
|
10029
10029
|
}
|
|
10030
10030
|
const bs = (r, e) => {
|
|
10031
10031
|
let t = r;
|
|
10032
|
-
for (; t !==
|
|
10032
|
+
for (; t !== Se() && t != null; ) {
|
|
10033
10033
|
if (e(t)) return t;
|
|
10034
10034
|
t = t.getParent();
|
|
10035
10035
|
}
|
|
@@ -10101,7 +10101,7 @@ function va(r, e) {
|
|
|
10101
10101
|
}
|
|
10102
10102
|
function wa(r, e) {
|
|
10103
10103
|
if (typeof document > "u" || typeof window > "u" && global.window === void 0) throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
|
|
10104
|
-
const t = document.createElement("div"), n =
|
|
10104
|
+
const t = document.createElement("div"), n = Se().getChildren();
|
|
10105
10105
|
for (let s = 0; s < n.length; s++)
|
|
10106
10106
|
Ca(r, n[s], t, e);
|
|
10107
10107
|
return t.innerHTML;
|
|
@@ -10163,7 +10163,7 @@ function Aa(r, e, t, n, s = /* @__PURE__ */ new Map(), o) {
|
|
|
10163
10163
|
return c != null && (f = c(f)), Jn(r) && (f = sd(r, f, h ? () => {
|
|
10164
10164
|
const g = new Mi();
|
|
10165
10165
|
return t.push(g), g;
|
|
10166
|
-
} :
|
|
10166
|
+
} : Pe)), l == null ? f.length > 0 ? i = i.concat(f) : Jn(r) && function(g) {
|
|
10167
10167
|
return g.nextSibling == null || g.previousSibling == null ? !1 : Ks(g.nextSibling) && Ks(g.previousSibling);
|
|
10168
10168
|
}(r) && (i = i.concat(fr())) : N(l) && l.append(...f), i;
|
|
10169
10169
|
}
|
|
@@ -10261,7 +10261,7 @@ function Ea(r, e, t, n = []) {
|
|
|
10261
10261
|
return s;
|
|
10262
10262
|
}
|
|
10263
10263
|
function ad(r, e) {
|
|
10264
|
-
const t = [], n =
|
|
10264
|
+
const t = [], n = Se().getChildren();
|
|
10265
10265
|
for (let s = 0; s < n.length; s++)
|
|
10266
10266
|
Ea(r, e, n[s], t);
|
|
10267
10267
|
return { namespace: r._config.namespace, nodes: t };
|
|
@@ -10377,11 +10377,11 @@ class _s extends zt {
|
|
|
10377
10377
|
return { ...super.exportJSON(), type: "quote" };
|
|
10378
10378
|
}
|
|
10379
10379
|
insertNewAfter(e, t) {
|
|
10380
|
-
const n =
|
|
10380
|
+
const n = Pe(), s = this.getDirection();
|
|
10381
10381
|
return n.setDirection(s), this.insertAfter(n, t), n;
|
|
10382
10382
|
}
|
|
10383
10383
|
collapseAtStart() {
|
|
10384
|
-
const e =
|
|
10384
|
+
const e = Pe();
|
|
10385
10385
|
return this.getChildren().forEach((t) => e.append(t)), this.replace(e), !0;
|
|
10386
10386
|
}
|
|
10387
10387
|
canMergeWhenEmpty() {
|
|
@@ -10440,15 +10440,15 @@ class vs extends zt {
|
|
|
10440
10440
|
return { ...super.exportJSON(), tag: this.getTag(), type: "heading", version: 1 };
|
|
10441
10441
|
}
|
|
10442
10442
|
insertNewAfter(e, t = !0) {
|
|
10443
|
-
const n = e ? e.anchor.offset : 0, s = this.getLastDescendant(), o = !s || e && e.anchor.key === s.getKey() && n === s.getTextContentSize() || !e ?
|
|
10443
|
+
const n = e ? e.anchor.offset : 0, s = this.getLastDescendant(), o = !s || e && e.anchor.key === s.getKey() && n === s.getTextContentSize() || !e ? Pe() : Qr(this.getTag()), i = this.getDirection();
|
|
10444
10444
|
if (o.setDirection(i), this.insertAfter(o, t), n === 0 && !this.isEmpty() && e) {
|
|
10445
|
-
const l =
|
|
10445
|
+
const l = Pe();
|
|
10446
10446
|
l.select(), this.replace(l, !0);
|
|
10447
10447
|
}
|
|
10448
10448
|
return o;
|
|
10449
10449
|
}
|
|
10450
10450
|
collapseAtStart() {
|
|
10451
|
-
const e = this.isEmpty() ?
|
|
10451
|
+
const e = this.isEmpty() ? Pe() : Qr(this.getTag());
|
|
10452
10452
|
return this.getChildren().forEach((t) => e.append(t)), this.replace(e), !0;
|
|
10453
10453
|
}
|
|
10454
10454
|
extractWithChild() {
|
|
@@ -10565,7 +10565,7 @@ function bd(r) {
|
|
|
10565
10565
|
} else if (M(t)) {
|
|
10566
10566
|
if (function(s) {
|
|
10567
10567
|
const o = s.focus;
|
|
10568
|
-
return o.key === "root" && o.offset ===
|
|
10568
|
+
return o.key === "root" && o.offset === Se().getChildrenSize();
|
|
10569
10569
|
}(t)) return e.preventDefault(), !0;
|
|
10570
10570
|
const n = cn(t.focus, !1);
|
|
10571
10571
|
if (!e.shiftKey && me(n) && !n.isIsolated() && !n.isInline()) return n.selectNext(), e.preventDefault(), !0;
|
|
@@ -10903,7 +10903,7 @@ var Tt = Id(function(r) {
|
|
|
10903
10903
|
function $d(r) {
|
|
10904
10904
|
let e = 1, t = r.getParent();
|
|
10905
10905
|
for (; t != null; ) {
|
|
10906
|
-
if (
|
|
10906
|
+
if (Be(t)) {
|
|
10907
10907
|
const n = t.getParent();
|
|
10908
10908
|
if (ue(n)) {
|
|
10909
10909
|
e++, t = n.getParent();
|
|
@@ -10924,7 +10924,7 @@ function di(r) {
|
|
|
10924
10924
|
}
|
|
10925
10925
|
function ka(r) {
|
|
10926
10926
|
let e = [];
|
|
10927
|
-
const t = r.getChildren().filter(
|
|
10927
|
+
const t = r.getChildren().filter(Be);
|
|
10928
10928
|
for (let n = 0; n < t.length; n++) {
|
|
10929
10929
|
const s = t[n], o = s.getFirstChild();
|
|
10930
10930
|
ue(o) ? e = e.concat(ka(o)) : e.push(s);
|
|
@@ -10932,13 +10932,13 @@ function ka(r) {
|
|
|
10932
10932
|
return e;
|
|
10933
10933
|
}
|
|
10934
10934
|
function Bt(r) {
|
|
10935
|
-
return
|
|
10935
|
+
return Be(r) && ue(r.getFirstChild());
|
|
10936
10936
|
}
|
|
10937
10937
|
function Xo(r) {
|
|
10938
10938
|
return st().append(r);
|
|
10939
10939
|
}
|
|
10940
10940
|
function Ta(r, e) {
|
|
10941
|
-
return
|
|
10941
|
+
return Be(r) && (e.length === 0 || e.length === 1 && r.is(e[0]) && r.getChildrenSize() === 0);
|
|
10942
10942
|
}
|
|
10943
10943
|
function Zo(r, e) {
|
|
10944
10944
|
r.update(() => {
|
|
@@ -10955,7 +10955,7 @@ function Zo(r, e) {
|
|
|
10955
10955
|
l.replace(u);
|
|
10956
10956
|
const c = st();
|
|
10957
10957
|
N(l) && (c.setFormat(l.getFormatType()), c.setIndent(l.getIndent())), u.append(c);
|
|
10958
|
-
} else if (
|
|
10958
|
+
} else if (Be(l)) {
|
|
10959
10959
|
const c = l.getParentOrThrow();
|
|
10960
10960
|
hr(u, c.getChildren()), c.replace(u);
|
|
10961
10961
|
}
|
|
@@ -10965,7 +10965,7 @@ function Zo(r, e) {
|
|
|
10965
10965
|
const s = /* @__PURE__ */ new Set();
|
|
10966
10966
|
for (let o = 0; o < n.length; o++) {
|
|
10967
10967
|
const i = n[o];
|
|
10968
|
-
if (!N(i) || !i.isEmpty() ||
|
|
10968
|
+
if (!N(i) || !i.isEmpty() || Be(i) || s.has(i.getKey())) {
|
|
10969
10969
|
if (jl(i)) {
|
|
10970
10970
|
let l = i.getParent();
|
|
10971
10971
|
for (; l != null; ) {
|
|
@@ -11030,7 +11030,7 @@ function zd(r) {
|
|
|
11030
11030
|
let i = o;
|
|
11031
11031
|
const l = ka(o);
|
|
11032
11032
|
for (const a of l) {
|
|
11033
|
-
const u =
|
|
11033
|
+
const u = Pe();
|
|
11034
11034
|
hr(u, a.getChildren()), i.insertAfter(u), i = u, a.__key === e.anchor.key && e.anchor.set(u.getKey(), 0, "element"), a.__key === e.focus.key && e.focus.set(u.getKey(), 0, "element"), a.remove();
|
|
11035
11035
|
}
|
|
11036
11036
|
o.remove();
|
|
@@ -11066,7 +11066,7 @@ function qd(r) {
|
|
|
11066
11066
|
function Ud(r) {
|
|
11067
11067
|
if (Bt(r)) return;
|
|
11068
11068
|
const e = r.getParent(), t = e ? e.getParent() : void 0;
|
|
11069
|
-
if (ue(t ? t.getParent() : void 0) &&
|
|
11069
|
+
if (ue(t ? t.getParent() : void 0) && Be(t) && ue(e)) {
|
|
11070
11070
|
const n = e ? e.getFirstChild() : void 0, s = e ? e.getLastChild() : void 0;
|
|
11071
11071
|
if (r.is(n)) t.insertBefore(r), e.isEmpty() && t.remove();
|
|
11072
11072
|
else if (r.is(s)) t.insertAfter(r), e.isEmpty() && t.remove();
|
|
@@ -11082,14 +11082,14 @@ function Wd() {
|
|
|
11082
11082
|
const r = V();
|
|
11083
11083
|
if (!M(r) || !r.isCollapsed()) return !1;
|
|
11084
11084
|
const e = r.anchor.getNode();
|
|
11085
|
-
if (!
|
|
11085
|
+
if (!Be(e) || e.getChildrenSize() !== 0) return !1;
|
|
11086
11086
|
const t = di(e), n = e.getParent();
|
|
11087
11087
|
ue(n) || Tt(40);
|
|
11088
11088
|
const s = n.getParent();
|
|
11089
11089
|
let o;
|
|
11090
|
-
if (Ft(s)) o =
|
|
11090
|
+
if (Ft(s)) o = Pe(), t.insertAfter(o);
|
|
11091
11091
|
else {
|
|
11092
|
-
if (!
|
|
11092
|
+
if (!Be(s)) return !1;
|
|
11093
11093
|
o = st(), s.insertAfter(o);
|
|
11094
11094
|
}
|
|
11095
11095
|
o.select();
|
|
@@ -11109,7 +11109,7 @@ function Wd() {
|
|
|
11109
11109
|
let a = l;
|
|
11110
11110
|
for (; a.getNextSibling() == null && a.getPreviousSibling() == null; ) {
|
|
11111
11111
|
const u = a.getParent();
|
|
11112
|
-
if (u == null || !
|
|
11112
|
+
if (u == null || !Be(a) && !ue(a)) break;
|
|
11113
11113
|
a = u;
|
|
11114
11114
|
}
|
|
11115
11115
|
a.remove();
|
|
@@ -11140,7 +11140,7 @@ class gr extends zt {
|
|
|
11140
11140
|
}
|
|
11141
11141
|
static transform() {
|
|
11142
11142
|
return (e) => {
|
|
11143
|
-
if (
|
|
11143
|
+
if (Be(e) || Tt(144), e.__checked == null) return;
|
|
11144
11144
|
const t = e.getParent();
|
|
11145
11145
|
ue(t) && t.getListType() !== "check" && e.getChecked() != null && e.setChecked(void 0);
|
|
11146
11146
|
};
|
|
@@ -11170,7 +11170,7 @@ class gr extends zt {
|
|
|
11170
11170
|
return this;
|
|
11171
11171
|
}
|
|
11172
11172
|
replace(e, t) {
|
|
11173
|
-
if (
|
|
11173
|
+
if (Be(e)) return super.replace(e);
|
|
11174
11174
|
this.setIndent(0);
|
|
11175
11175
|
const n = this.getParentOrThrow();
|
|
11176
11176
|
if (!ue(n)) return e;
|
|
@@ -11191,7 +11191,7 @@ class gr extends zt {
|
|
|
11191
11191
|
}
|
|
11192
11192
|
insertAfter(e, t = !0) {
|
|
11193
11193
|
const n = this.getParentOrThrow();
|
|
11194
|
-
if (ue(n) || Tt(39),
|
|
11194
|
+
if (ue(n) || Tt(39), Be(e)) return super.insertAfter(e, t);
|
|
11195
11195
|
const s = this.getNextSiblings();
|
|
11196
11196
|
if (n.insertAfter(e, t), s.length !== 0) {
|
|
11197
11197
|
const o = rt(n.getListType());
|
|
@@ -11208,9 +11208,9 @@ class gr extends zt {
|
|
|
11208
11208
|
return this.insertAfter(n, t), n;
|
|
11209
11209
|
}
|
|
11210
11210
|
collapseAtStart(e) {
|
|
11211
|
-
const t =
|
|
11211
|
+
const t = Pe();
|
|
11212
11212
|
this.getChildren().forEach((i) => t.append(i));
|
|
11213
|
-
const n = this.getParentOrThrow(), s = n.getParentOrThrow(), o =
|
|
11213
|
+
const n = this.getParentOrThrow(), s = n.getParentOrThrow(), o = Be(s);
|
|
11214
11214
|
if (n.getChildrenSize() === 1) if (o) n.remove(), s.select();
|
|
11215
11215
|
else {
|
|
11216
11216
|
n.insertBefore(t), n.remove();
|
|
@@ -11242,7 +11242,7 @@ class gr extends zt {
|
|
|
11242
11242
|
const e = this.getParent();
|
|
11243
11243
|
if (e === null) return this.getLatest().__indent;
|
|
11244
11244
|
let t = e.getParentOrThrow(), n = 0;
|
|
11245
|
-
for (;
|
|
11245
|
+
for (; Be(t); ) t = t.getParentOrThrow().getParentOrThrow(), n++;
|
|
11246
11246
|
return n;
|
|
11247
11247
|
}
|
|
11248
11248
|
setIndent(e) {
|
|
@@ -11252,13 +11252,13 @@ class gr extends zt {
|
|
|
11252
11252
|
return this;
|
|
11253
11253
|
}
|
|
11254
11254
|
canInsertAfter(e) {
|
|
11255
|
-
return
|
|
11255
|
+
return Be(e);
|
|
11256
11256
|
}
|
|
11257
11257
|
canReplaceWith(e) {
|
|
11258
|
-
return
|
|
11258
|
+
return Be(e);
|
|
11259
11259
|
}
|
|
11260
11260
|
canMergeWith(e) {
|
|
11261
|
-
return Fr(e) ||
|
|
11261
|
+
return Fr(e) || Be(e);
|
|
11262
11262
|
}
|
|
11263
11263
|
extractWithChild(e, t) {
|
|
11264
11264
|
if (!M(t)) return !1;
|
|
@@ -11304,7 +11304,7 @@ function Vd(r) {
|
|
|
11304
11304
|
function st(r) {
|
|
11305
11305
|
return Lt(new gr(void 0, r));
|
|
11306
11306
|
}
|
|
11307
|
-
function
|
|
11307
|
+
function Be(r) {
|
|
11308
11308
|
return r instanceof gr;
|
|
11309
11309
|
}
|
|
11310
11310
|
class Or extends zt {
|
|
@@ -11348,7 +11348,7 @@ class Or extends zt {
|
|
|
11348
11348
|
}(e), function(t) {
|
|
11349
11349
|
const n = t.getListType() !== "check";
|
|
11350
11350
|
let s = t.getStart();
|
|
11351
|
-
for (const o of t.getChildren())
|
|
11351
|
+
for (const o of t.getChildren()) Be(o) && (o.getValue() !== s && o.setValue(s), n && o.getLatest().__checked != null && o.setChecked(void 0), ue(o.getFirstChild()) || s++);
|
|
11352
11352
|
}(e);
|
|
11353
11353
|
};
|
|
11354
11354
|
}
|
|
@@ -11375,13 +11375,13 @@ class Or extends zt {
|
|
|
11375
11375
|
append(...e) {
|
|
11376
11376
|
for (let t = 0; t < e.length; t++) {
|
|
11377
11377
|
const n = e[t];
|
|
11378
|
-
if (
|
|
11378
|
+
if (Be(n)) super.append(n);
|
|
11379
11379
|
else {
|
|
11380
11380
|
const s = st();
|
|
11381
11381
|
if (ue(n)) s.append(n);
|
|
11382
11382
|
else if (N(n)) if (n.isInline()) s.append(n);
|
|
11383
11383
|
else {
|
|
11384
|
-
const o =
|
|
11384
|
+
const o = Re(n.getTextContent());
|
|
11385
11385
|
s.append(o);
|
|
11386
11386
|
}
|
|
11387
11387
|
else s.append(n);
|
|
@@ -11391,7 +11391,7 @@ class Or extends zt {
|
|
|
11391
11391
|
return this;
|
|
11392
11392
|
}
|
|
11393
11393
|
extractWithChild(e) {
|
|
11394
|
-
return
|
|
11394
|
+
return Be(e);
|
|
11395
11395
|
}
|
|
11396
11396
|
}
|
|
11397
11397
|
function nl(r, e, t) {
|
|
@@ -11415,7 +11415,7 @@ function Kd(r) {
|
|
|
11415
11415
|
const e = [];
|
|
11416
11416
|
for (let t = 0; t < r.length; t++) {
|
|
11417
11417
|
const n = r[t];
|
|
11418
|
-
if (
|
|
11418
|
+
if (Be(n)) {
|
|
11419
11419
|
e.push(n);
|
|
11420
11420
|
const s = n.getChildren();
|
|
11421
11421
|
s.length > 1 && s.forEach((o) => {
|
|
@@ -12016,9 +12016,9 @@ function sf({ html: r, isExternalUpdate: e, onImportComplete: t }) {
|
|
|
12016
12016
|
return De(() => {
|
|
12017
12017
|
r && (s.current && !e || (s.current = !0, n.update(
|
|
12018
12018
|
() => {
|
|
12019
|
-
const o =
|
|
12019
|
+
const o = Se();
|
|
12020
12020
|
o.clear();
|
|
12021
|
-
const i =
|
|
12021
|
+
const i = Pe();
|
|
12022
12022
|
o.append(i), i.select();
|
|
12023
12023
|
const a = new DOMParser().parseFromString(r, "text/html"), c = va(n, a).filter((d) => d.getParent() === null);
|
|
12024
12024
|
c.length > 0 && oa(c), i.getTextContent() === "" && o.getChildrenSize() > 1 && i.remove(), o.selectEnd();
|
|
@@ -12040,13 +12040,13 @@ function of({ text: r, trigger: e }) {
|
|
|
12040
12040
|
if (M(o))
|
|
12041
12041
|
o.insertText(s);
|
|
12042
12042
|
else {
|
|
12043
|
-
const i =
|
|
12043
|
+
const i = Se(), l = i.getLastChild();
|
|
12044
12044
|
if (l) {
|
|
12045
12045
|
l.selectEnd();
|
|
12046
12046
|
const a = V();
|
|
12047
12047
|
M(a) && a.insertText(s);
|
|
12048
12048
|
} else {
|
|
12049
|
-
const a =
|
|
12049
|
+
const a = Pe(), u = Re(s);
|
|
12050
12050
|
a.append(u), i.append(a);
|
|
12051
12051
|
}
|
|
12052
12052
|
}
|
|
@@ -12138,14 +12138,14 @@ function af({
|
|
|
12138
12138
|
`).map((we) => `<p>${we || "<br>"}</p>`).join(""), X = async (pe) => {
|
|
12139
12139
|
const we = j(E);
|
|
12140
12140
|
if (!we) return;
|
|
12141
|
-
const
|
|
12142
|
-
if (
|
|
12141
|
+
const ke = pe === "restructure" ? d : pe === "proofread" ? f : h;
|
|
12142
|
+
if (ke) {
|
|
12143
12143
|
D(!0), I(pe);
|
|
12144
12144
|
try {
|
|
12145
|
-
const
|
|
12146
|
-
v(
|
|
12147
|
-
} catch (
|
|
12148
|
-
console.error(`AI ${pe} failed:`,
|
|
12145
|
+
const Me = await ke(we), Te = O(Me);
|
|
12146
|
+
v(Te), e == null || e(Te), w.current = Date.now(), A(!0);
|
|
12147
|
+
} catch (Me) {
|
|
12148
|
+
console.error(`AI ${pe} failed:`, Me);
|
|
12149
12149
|
} finally {
|
|
12150
12150
|
D(!1), I(null);
|
|
12151
12151
|
}
|
|
@@ -12161,8 +12161,8 @@ function af({
|
|
|
12161
12161
|
}, oe = re(
|
|
12162
12162
|
(pe, we) => {
|
|
12163
12163
|
pe.read(() => {
|
|
12164
|
-
const
|
|
12165
|
-
v(
|
|
12164
|
+
const ke = wa(we, null);
|
|
12165
|
+
v(ke), e == null || e(ke);
|
|
12166
12166
|
});
|
|
12167
12167
|
},
|
|
12168
12168
|
[e]
|
|
@@ -12359,28 +12359,32 @@ function Sf({
|
|
|
12359
12359
|
onAiRewrite: w,
|
|
12360
12360
|
renderAboveToolbar: E
|
|
12361
12361
|
}) {
|
|
12362
|
-
const v = { ...uf, ...c }, [b, D] = H(r), [k, I] = H(""), [B, F] = H(""), [L, j] = H(e), [O, X] = H(t), [de, ie] = H([]), [oe, ve] = H(!1), [pe, we] = H(""), [
|
|
12362
|
+
const v = { ...uf, ...c }, [b, D] = H(r), [k, I] = H(""), [B, F] = H(""), [L, j] = H(e), [O, X] = H(t), [de, ie] = H([]), [oe, ve] = H(!1), [pe, we] = H(""), [ke, Me] = H(f), [Te, Ce] = H(!1), Ve = Je.useRef(void 0);
|
|
12363
12363
|
Je.useEffect(() => {
|
|
12364
12364
|
l !== void 0 && l !== Ve.current && (Ve.current = l, X(t), Ce(!0));
|
|
12365
12365
|
}, [l, t]);
|
|
12366
|
-
const
|
|
12367
|
-
X(
|
|
12368
|
-
}, ge =
|
|
12369
|
-
const
|
|
12370
|
-
if (
|
|
12371
|
-
const
|
|
12372
|
-
console.log("[MailComposer] Files selected:",
|
|
12366
|
+
const qe = (U) => {
|
|
12367
|
+
X(U), Ce(!1), i == null || i(U);
|
|
12368
|
+
}, ge = be(null), [Ie, ct] = H(!1), Ct = (U) => {
|
|
12369
|
+
const ye = U.target.files;
|
|
12370
|
+
if (ye) {
|
|
12371
|
+
const Ae = Array.from(ye);
|
|
12372
|
+
console.log("[MailComposer] Files selected:", Ae.map((R) => ({ name: R.name, size: R.size, type: R.type }))), ie((R) => [...R, ...Ae]);
|
|
12373
12373
|
}
|
|
12374
12374
|
ge.current && (ge.current.value = "");
|
|
12375
|
-
}, qt = (
|
|
12376
|
-
|
|
12377
|
-
}, it = (
|
|
12378
|
-
|
|
12379
|
-
}, ot = (
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12375
|
+
}, qt = (U) => {
|
|
12376
|
+
U.preventDefault(), U.stopPropagation(), ct(!0);
|
|
12377
|
+
}, it = (U) => {
|
|
12378
|
+
U.preventDefault(), U.stopPropagation(), ct(!1);
|
|
12379
|
+
}, ot = (U) => {
|
|
12380
|
+
if (U.preventDefault(), U.stopPropagation(), ct(!1), U.dataTransfer.files && U.dataTransfer.files.length > 0) {
|
|
12381
|
+
const ye = Array.from(U.dataTransfer.files);
|
|
12382
|
+
console.log("[MailComposer] Files dropped:", ye.map((Ae) => ({ name: Ae.name, size: Ae.size, type: Ae.type }))), ie((Ae) => [...Ae, ...ye]);
|
|
12383
|
+
} else
|
|
12384
|
+
console.log("[MailComposer] Drop event but no files:", U.dataTransfer.types);
|
|
12385
|
+
}, dt = (U) => U.type.startsWith("image/") ? "image" : U.type === "application/pdf" ? "picture_as_pdf" : U.type.includes("spreadsheet") || U.type.includes("excel") ? "table_chart" : U.type.includes("document") || U.type.includes("word") ? "description" : "attach_file", Ut = (U) => {
|
|
12386
|
+
ie((ye) => ye.filter((Ae, R) => R !== U));
|
|
12387
|
+
}, Wt = (U) => U < 1024 ? `${U} B` : U < 1024 * 1024 ? `${(U / 1024).toFixed(1)} KB` : `${(U / (1024 * 1024)).toFixed(1)} MB`, Dt = async () => {
|
|
12384
12388
|
if (!b.trim()) {
|
|
12385
12389
|
we("Recipient email is required");
|
|
12386
12390
|
return;
|
|
@@ -12391,7 +12395,7 @@ function Sf({
|
|
|
12391
12395
|
}
|
|
12392
12396
|
ve(!0), we("");
|
|
12393
12397
|
try {
|
|
12394
|
-
const
|
|
12398
|
+
const U = await Promise.all(
|
|
12395
12399
|
de.map(async (R) => {
|
|
12396
12400
|
const T = await R.arrayBuffer(), Q = btoa(
|
|
12397
12401
|
new Uint8Array(T).reduce((J, S) => J + String.fromCharCode(S), "")
|
|
@@ -12403,21 +12407,21 @@ function Sf({
|
|
|
12403
12407
|
size: R.size
|
|
12404
12408
|
};
|
|
12405
12409
|
})
|
|
12406
|
-
),
|
|
12410
|
+
), ye = O.replace(/>\n+</g, "><").replace(/<p class="[^"]*"><\/p>/g, "<br>").trim(), Ae = {
|
|
12407
12411
|
to: b.trim(),
|
|
12408
12412
|
cc: k.trim() || void 0,
|
|
12409
12413
|
bcc: B.trim() || void 0,
|
|
12410
12414
|
subject: L.trim(),
|
|
12411
|
-
html:
|
|
12412
|
-
attachments:
|
|
12415
|
+
html: ye,
|
|
12416
|
+
attachments: U,
|
|
12413
12417
|
inReplyTo: n == null ? void 0 : n.messageId
|
|
12414
12418
|
};
|
|
12415
|
-
console.log("[MailComposer] Sending email - to:",
|
|
12419
|
+
console.log("[MailComposer] Sending email - to:", Ae.to, "subject:", Ae.subject, "attachmentsCount:", Ae.attachments.length), Ae.attachments.length > 0 && Ae.attachments.forEach((R, T) => {
|
|
12416
12420
|
var Q;
|
|
12417
12421
|
console.log(`[MailComposer] Attachment ${T + 1}:`, R.filename, "size:", R.size, "type:", R.content_type, "data length:", ((Q = R.data) == null ? void 0 : Q.length) || 0);
|
|
12418
|
-
}), await s(
|
|
12419
|
-
} catch (
|
|
12420
|
-
we(
|
|
12422
|
+
}), await s(Ae), D(""), I(""), F(""), j(""), X(""), ie([]);
|
|
12423
|
+
} catch (U) {
|
|
12424
|
+
we(U instanceof Error ? U.message : "Failed to send email");
|
|
12421
12425
|
} finally {
|
|
12422
12426
|
ve(!1);
|
|
12423
12427
|
}
|
|
@@ -12437,16 +12441,16 @@ function Sf({
|
|
|
12437
12441
|
color: v.textSecondary,
|
|
12438
12442
|
marginBottom: "4px",
|
|
12439
12443
|
textTransform: "uppercase"
|
|
12440
|
-
}, At = (
|
|
12444
|
+
}, At = (U, ye = !1) => ({
|
|
12441
12445
|
padding: "10px 20px",
|
|
12442
12446
|
fontSize: "14px",
|
|
12443
12447
|
fontWeight: 500,
|
|
12444
12448
|
border: "none",
|
|
12445
12449
|
borderRadius: "6px",
|
|
12446
|
-
cursor:
|
|
12447
|
-
opacity:
|
|
12448
|
-
background:
|
|
12449
|
-
color:
|
|
12450
|
+
cursor: ye ? "not-allowed" : "pointer",
|
|
12451
|
+
opacity: ye ? 0.6 : 1,
|
|
12452
|
+
background: U ? v.buttonPrimary : v.buttonSecondary,
|
|
12453
|
+
color: U ? "#ffffff" : v.text,
|
|
12450
12454
|
display: "flex",
|
|
12451
12455
|
alignItems: "center",
|
|
12452
12456
|
gap: "8px"
|
|
@@ -12484,18 +12488,18 @@ function Sf({
|
|
|
12484
12488
|
{
|
|
12485
12489
|
type: "email",
|
|
12486
12490
|
value: b,
|
|
12487
|
-
onChange: (
|
|
12491
|
+
onChange: (U) => D(U.target.value),
|
|
12488
12492
|
placeholder: "recipient@example.com",
|
|
12489
12493
|
disabled: d || oe,
|
|
12490
12494
|
style: ft
|
|
12491
12495
|
}
|
|
12492
12496
|
)
|
|
12493
12497
|
] }),
|
|
12494
|
-
!
|
|
12498
|
+
!ke && /* @__PURE__ */ p.jsx(
|
|
12495
12499
|
"button",
|
|
12496
12500
|
{
|
|
12497
12501
|
type: "button",
|
|
12498
|
-
onClick: () =>
|
|
12502
|
+
onClick: () => Me(!0),
|
|
12499
12503
|
disabled: d || oe,
|
|
12500
12504
|
style: {
|
|
12501
12505
|
background: "none",
|
|
@@ -12509,7 +12513,7 @@ function Sf({
|
|
|
12509
12513
|
children: "+ Add CC/BCC"
|
|
12510
12514
|
}
|
|
12511
12515
|
),
|
|
12512
|
-
|
|
12516
|
+
ke && /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
12513
12517
|
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
12514
12518
|
/* @__PURE__ */ p.jsx("label", { style: ht, children: "CC" }),
|
|
12515
12519
|
/* @__PURE__ */ p.jsx(
|
|
@@ -12517,7 +12521,7 @@ function Sf({
|
|
|
12517
12521
|
{
|
|
12518
12522
|
type: "email",
|
|
12519
12523
|
value: k,
|
|
12520
|
-
onChange: (
|
|
12524
|
+
onChange: (U) => I(U.target.value),
|
|
12521
12525
|
placeholder: "cc@example.com",
|
|
12522
12526
|
disabled: d || oe,
|
|
12523
12527
|
style: ft
|
|
@@ -12531,7 +12535,7 @@ function Sf({
|
|
|
12531
12535
|
{
|
|
12532
12536
|
type: "email",
|
|
12533
12537
|
value: B,
|
|
12534
|
-
onChange: (
|
|
12538
|
+
onChange: (U) => F(U.target.value),
|
|
12535
12539
|
placeholder: "bcc@example.com",
|
|
12536
12540
|
disabled: d || oe,
|
|
12537
12541
|
style: ft
|
|
@@ -12546,7 +12550,7 @@ function Sf({
|
|
|
12546
12550
|
{
|
|
12547
12551
|
type: "text",
|
|
12548
12552
|
value: L,
|
|
12549
|
-
onChange: (
|
|
12553
|
+
onChange: (U) => j(U.target.value),
|
|
12550
12554
|
placeholder: "Email subject",
|
|
12551
12555
|
disabled: d || oe,
|
|
12552
12556
|
style: ft
|
|
@@ -12557,13 +12561,13 @@ function Sf({
|
|
|
12557
12561
|
af,
|
|
12558
12562
|
{
|
|
12559
12563
|
value: O,
|
|
12560
|
-
onChange:
|
|
12564
|
+
onChange: qe,
|
|
12561
12565
|
placeholder: h,
|
|
12562
12566
|
replyTo: n,
|
|
12563
12567
|
theme: v,
|
|
12564
12568
|
disabled: d || oe,
|
|
12565
12569
|
minHeight: m,
|
|
12566
|
-
externalUpdate:
|
|
12570
|
+
externalUpdate: Te ? l : void 0,
|
|
12567
12571
|
insertText: a,
|
|
12568
12572
|
insertTextTrigger: u,
|
|
12569
12573
|
onAiRestructure: x,
|
|
@@ -12588,8 +12592,8 @@ function Sf({
|
|
|
12588
12592
|
"div",
|
|
12589
12593
|
{
|
|
12590
12594
|
onClick: () => {
|
|
12591
|
-
var
|
|
12592
|
-
return (
|
|
12595
|
+
var U;
|
|
12596
|
+
return (U = ge.current) == null ? void 0 : U.click();
|
|
12593
12597
|
},
|
|
12594
12598
|
onDragOver: qt,
|
|
12595
12599
|
onDragLeave: it,
|
|
@@ -12597,10 +12601,10 @@ function Sf({
|
|
|
12597
12601
|
style: {
|
|
12598
12602
|
width: "100%",
|
|
12599
12603
|
padding: "24px 16px",
|
|
12600
|
-
border: `2px dashed ${
|
|
12604
|
+
border: `2px dashed ${Ie ? v.primary : v.border}`,
|
|
12601
12605
|
borderRadius: "8px",
|
|
12602
|
-
background:
|
|
12603
|
-
color:
|
|
12606
|
+
background: Ie ? `${v.primary}10` : "transparent",
|
|
12607
|
+
color: Ie ? v.primary : v.textSecondary,
|
|
12604
12608
|
cursor: d || oe ? "not-allowed" : "pointer",
|
|
12605
12609
|
display: "flex",
|
|
12606
12610
|
flexDirection: "column",
|
|
@@ -12611,12 +12615,12 @@ function Sf({
|
|
|
12611
12615
|
marginBottom: de.length > 0 ? "12px" : 0
|
|
12612
12616
|
},
|
|
12613
12617
|
children: [
|
|
12614
|
-
/* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "24px" }, children:
|
|
12615
|
-
/* @__PURE__ */ p.jsx("span", { style: { fontSize: "14px" }, children:
|
|
12618
|
+
/* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "24px" }, children: Ie ? "file_download" : "attach_file" }),
|
|
12619
|
+
/* @__PURE__ */ p.jsx("span", { style: { fontSize: "14px" }, children: Ie ? "Drop files here" : "Drop files or click to add" })
|
|
12616
12620
|
]
|
|
12617
12621
|
}
|
|
12618
12622
|
),
|
|
12619
|
-
de.length > 0 && /* @__PURE__ */ p.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: de.map((
|
|
12623
|
+
de.length > 0 && /* @__PURE__ */ p.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: de.map((U, ye) => /* @__PURE__ */ p.jsxs(
|
|
12620
12624
|
"div",
|
|
12621
12625
|
{
|
|
12622
12626
|
style: {
|
|
@@ -12628,16 +12632,16 @@ function Sf({
|
|
|
12628
12632
|
borderRadius: "8px"
|
|
12629
12633
|
},
|
|
12630
12634
|
children: [
|
|
12631
|
-
/* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: v.textSecondary }, children: dt(
|
|
12635
|
+
/* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: v.textSecondary }, children: dt(U) }),
|
|
12632
12636
|
/* @__PURE__ */ p.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
12633
|
-
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color: v.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children:
|
|
12634
|
-
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "12px", color: v.textSecondary }, children: Wt(
|
|
12637
|
+
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color: v.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: U.name }),
|
|
12638
|
+
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "12px", color: v.textSecondary }, children: Wt(U.size) })
|
|
12635
12639
|
] }),
|
|
12636
12640
|
/* @__PURE__ */ p.jsx(
|
|
12637
12641
|
"button",
|
|
12638
12642
|
{
|
|
12639
12643
|
type: "button",
|
|
12640
|
-
onClick: () => Ut(
|
|
12644
|
+
onClick: () => Ut(ye),
|
|
12641
12645
|
disabled: d || oe,
|
|
12642
12646
|
style: {
|
|
12643
12647
|
background: "none",
|
|
@@ -12653,7 +12657,7 @@ function Sf({
|
|
|
12653
12657
|
)
|
|
12654
12658
|
]
|
|
12655
12659
|
},
|
|
12656
|
-
`${
|
|
12660
|
+
`${U.name}-${ye}`
|
|
12657
12661
|
)) })
|
|
12658
12662
|
] }),
|
|
12659
12663
|
/* @__PURE__ */ p.jsxs("div", { style: { display: "flex", justifyContent: "flex-end", gap: "12px" }, children: [
|
|
@@ -12726,7 +12730,7 @@ function kf({
|
|
|
12726
12730
|
theme: d = {},
|
|
12727
12731
|
className: f = ""
|
|
12728
12732
|
}) {
|
|
12729
|
-
const h = { ...cf, ...d }, [g, m] = H(!1), [y, C] = H(""), x =
|
|
12733
|
+
const h = { ...cf, ...d }, [g, m] = H(!1), [y, C] = H(""), x = be(null), A = be(null);
|
|
12730
12734
|
De(() => {
|
|
12731
12735
|
function B(F) {
|
|
12732
12736
|
x.current && !x.current.contains(F.target) && (m(!1), C(""));
|
|
@@ -12973,7 +12977,7 @@ function Tf({
|
|
|
12973
12977
|
columnClassName: f = "",
|
|
12974
12978
|
itemClassName: h = ""
|
|
12975
12979
|
}) {
|
|
12976
|
-
const [g, m] = H(null), [y, C] = H(null), [x, A] = H(null), w =
|
|
12980
|
+
const [g, m] = H(null), [y, C] = H(null), [x, A] = H(null), w = be(null), E = e.reduce((F, L) => {
|
|
12977
12981
|
let j = r.filter((O) => n(O) === L.id);
|
|
12978
12982
|
return s && (j = j.sort((O, X) => s(O) - s(X))), F[L.id] = j, F;
|
|
12979
12983
|
}, {}), v = re((F, L) => {
|
|
@@ -13304,40 +13308,40 @@ function Bf({
|
|
|
13304
13308
|
] });
|
|
13305
13309
|
}
|
|
13306
13310
|
function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, variant: s = "widget", hideSaveButton: o = !1 }) {
|
|
13307
|
-
const i = s === "widget", [l, a] = H("idle"), [u, c] = H(0), [d, f] = H(0), [h, g] = H(!1), [m, y] = H(0), [C, x] = H(null), [A, w] = H(!1), [E, v] = H(null), b =
|
|
13311
|
+
const i = s === "widget", [l, a] = H("idle"), [u, c] = H(0), [d, f] = H(0), [h, g] = H(!1), [m, y] = H(0), [C, x] = H(null), [A, w] = H(!1), [E, v] = H(null), b = be(null), D = be(null), k = be(null), I = be(null), B = be(null), F = be([]), L = be(null), j = be(null), O = be(null), X = be(null), de = be(!1), ie = be([]), oe = be(null), ve = be(null), pe = be([]), we = be([]), ke = be("insert"), Me = be(!1), Te = be(0), Ce = be(0), Ve = be(0), qe = (R) => {
|
|
13308
13312
|
const T = Math.floor(R / 60), Q = Math.floor(R % 60);
|
|
13309
13313
|
return `${T.toString().padStart(2, "0")}:${Q.toString().padStart(2, "0")}`;
|
|
13310
13314
|
}, ge = async (R) => {
|
|
13311
13315
|
const T = await R.arrayBuffer(), Q = new AudioContext(), J = await Q.decodeAudioData(T);
|
|
13312
13316
|
return await Q.close(), J;
|
|
13313
|
-
},
|
|
13314
|
-
const T = R.numberOfChannels, Q = R.sampleRate, J = 1, S = 16, $ = S / 8, K = T * $, Y = Q * K, ee = R.length * K, ae = new ArrayBuffer(44 + ee), ne = new DataView(ae), te = (
|
|
13317
|
+
}, Ie = (R) => {
|
|
13318
|
+
const T = R.numberOfChannels, Q = R.sampleRate, J = 1, S = 16, $ = S / 8, K = T * $, Y = Q * K, ee = R.length * K, ae = new ArrayBuffer(44 + ee), ne = new DataView(ae), te = (xe, fe) => {
|
|
13315
13319
|
for (let Ue = 0; Ue < fe.length; Ue++)
|
|
13316
|
-
ne.setUint8(
|
|
13320
|
+
ne.setUint8(xe + Ue, fe.charCodeAt(Ue));
|
|
13317
13321
|
};
|
|
13318
13322
|
te(0, "RIFF"), ne.setUint32(4, 36 + ee, !0), te(8, "WAVE"), te(12, "fmt "), ne.setUint32(16, 16, !0), ne.setUint16(20, J, !0), ne.setUint16(22, T, !0), ne.setUint32(24, Q, !0), ne.setUint32(28, Y, !0), ne.setUint16(32, K, !0), ne.setUint16(34, S, !0), te(36, "data"), ne.setUint32(40, ee, !0);
|
|
13319
|
-
const
|
|
13320
|
-
for (let
|
|
13321
|
-
|
|
13322
|
-
let
|
|
13323
|
-
for (let
|
|
13323
|
+
const Ee = [];
|
|
13324
|
+
for (let xe = 0; xe < T; xe++)
|
|
13325
|
+
Ee.push(R.getChannelData(xe));
|
|
13326
|
+
let je = 44;
|
|
13327
|
+
for (let xe = 0; xe < R.length; xe++)
|
|
13324
13328
|
for (let fe = 0; fe < T; fe++) {
|
|
13325
|
-
const Ue = Math.max(-1, Math.min(1,
|
|
13326
|
-
ne.setInt16(
|
|
13329
|
+
const Ue = Math.max(-1, Math.min(1, Ee[fe][xe])), We = Ue < 0 ? Ue * 32768 : Ue * 32767;
|
|
13330
|
+
ne.setInt16(je, We, !0), je += 2;
|
|
13327
13331
|
}
|
|
13328
13332
|
return new Blob([ae], { type: "audio/wav" });
|
|
13329
13333
|
}, ct = async (R, T, Q, J) => {
|
|
13330
13334
|
const S = new AudioContext(), $ = R.sampleRate, K = Math.max(R.numberOfChannels, T.numberOfChannels), Y = Math.min(Q, R.length), ee = Math.max(0, R.length - Q), ae = J === "insert" ? Y + T.length + ee : Y + T.length, ne = S.createBuffer(K, ae, $);
|
|
13331
13335
|
for (let te = 0; te < K; te++) {
|
|
13332
|
-
const
|
|
13336
|
+
const Ee = ne.getChannelData(te), je = te < R.numberOfChannels ? R.getChannelData(te) : R.getChannelData(0);
|
|
13333
13337
|
for (let fe = 0; fe < Y; fe++)
|
|
13334
|
-
|
|
13335
|
-
const
|
|
13338
|
+
Ee[fe] = je[fe];
|
|
13339
|
+
const xe = te < T.numberOfChannels ? T.getChannelData(te) : T.getChannelData(0);
|
|
13336
13340
|
for (let fe = 0; fe < T.length; fe++)
|
|
13337
|
-
|
|
13341
|
+
Ee[Y + fe] = xe[fe];
|
|
13338
13342
|
if (J === "insert")
|
|
13339
13343
|
for (let fe = 0; fe < ee; fe++)
|
|
13340
|
-
|
|
13344
|
+
Ee[Y + T.length + fe] = je[Q + fe];
|
|
13341
13345
|
}
|
|
13342
13346
|
return await S.close(), ne;
|
|
13343
13347
|
}, Ct = re(() => {
|
|
@@ -13351,15 +13355,15 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13351
13355
|
ne.addColorStop(0, ae), ne.addColorStop(1, "transparent"), T.fillStyle = ne, T.fillRect(0, 0, J, ee);
|
|
13352
13356
|
const te = T.createLinearGradient(0, S - ee, 0, S);
|
|
13353
13357
|
te.addColorStop(0, "transparent"), te.addColorStop(1, ae), T.fillStyle = te, T.fillRect(0, S - ee, J, ee);
|
|
13354
|
-
const
|
|
13355
|
-
|
|
13356
|
-
const
|
|
13357
|
-
|
|
13358
|
-
const
|
|
13358
|
+
const Ee = T.createLinearGradient(0, 0, ee, 0);
|
|
13359
|
+
Ee.addColorStop(0, ae), Ee.addColorStop(1, "transparent"), T.fillStyle = Ee, T.fillRect(0, 0, ee, S);
|
|
13360
|
+
const je = T.createLinearGradient(J - ee, 0, J, 0);
|
|
13361
|
+
je.addColorStop(0, "transparent"), je.addColorStop(1, ae), T.fillStyle = je, T.fillRect(J - ee, 0, ee, S), T.strokeStyle = "#5a6b62", T.lineWidth = 1, T.beginPath(), T.moveTo(0, S / 2), T.lineTo(J, S / 2), T.stroke();
|
|
13362
|
+
const xe = J / 2;
|
|
13359
13363
|
if ($.length > 0)
|
|
13360
13364
|
if (l === "recording")
|
|
13361
13365
|
for (let We = 0; We < $.length; We++) {
|
|
13362
|
-
const lt = $.length - 1 - We, Et =
|
|
13366
|
+
const lt = $.length - 1 - We, Et = xe - lt * 4;
|
|
13363
13367
|
if (Et < -3 || Et > J) continue;
|
|
13364
13368
|
const pt = $[We] * (S / 2 - 12), Pt = S / 2 - pt;
|
|
13365
13369
|
T.fillStyle = "#10b981", T.fillRect(Et, Pt, 3, pt * 2);
|
|
@@ -13367,13 +13371,13 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13367
13371
|
else {
|
|
13368
13372
|
const We = K > 0 ? Y / K * $.length : 0;
|
|
13369
13373
|
for (let lt = 0; lt < $.length; lt++) {
|
|
13370
|
-
const Et = We - lt, pt =
|
|
13374
|
+
const Et = We - lt, pt = xe - Et * 4;
|
|
13371
13375
|
if (pt < -3 || pt > J) continue;
|
|
13372
13376
|
const Pt = $[lt] * (S / 2 - 12), yr = S / 2 - Pt;
|
|
13373
13377
|
T.fillStyle = lt <= We ? "#10b981" : "#4b5563", T.fillRect(pt, yr, 3, Pt * 2);
|
|
13374
13378
|
}
|
|
13375
13379
|
}
|
|
13376
|
-
T.strokeStyle = "#ef4444", T.lineWidth = 1, T.beginPath(), T.moveTo(
|
|
13380
|
+
T.strokeStyle = "#ef4444", T.lineWidth = 1, T.beginPath(), T.moveTo(xe, 0), T.lineTo(xe, S), T.stroke(), T.fillStyle = "#fff", T.font = "bold 18px monospace", T.textAlign = "center", T.fillText(qe(Y), xe, S - 6), l === "recording" && (T.fillStyle = "#ef4444", T.beginPath(), T.arc(20, 20, 8, 0, Math.PI * 2), T.fill(), T.fillStyle = "#fff", T.font = "10px sans-serif", T.textAlign = "left", T.fillText("REC", 34, 24)), T.textAlign = "left";
|
|
13377
13381
|
}, [l, m, u, d]), qt = () => {
|
|
13378
13382
|
const R = B.current;
|
|
13379
13383
|
if (!R || !de.current) return;
|
|
@@ -13408,21 +13412,21 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13408
13412
|
let K, Y;
|
|
13409
13413
|
if (oe.current !== null && ve.current)
|
|
13410
13414
|
try {
|
|
13411
|
-
const ne = await ge($), te = ve.current.sampleRate,
|
|
13415
|
+
const ne = await ge($), te = ve.current.sampleRate, Ee = Math.floor(oe.current * te), je = await ct(
|
|
13412
13416
|
ve.current,
|
|
13413
13417
|
ne,
|
|
13414
|
-
|
|
13415
|
-
|
|
13418
|
+
Ee,
|
|
13419
|
+
ke.current
|
|
13416
13420
|
);
|
|
13417
|
-
K =
|
|
13421
|
+
K = Ie(je), Y = je.length / je.sampleRate, ke.current === "insert" && (ie.current = [
|
|
13418
13422
|
...ie.current,
|
|
13419
13423
|
...we.current
|
|
13420
13424
|
]), oe.current = null, ve.current = null, pe.current = [], we.current = [];
|
|
13421
13425
|
} catch {
|
|
13422
|
-
K = $, Y =
|
|
13426
|
+
K = $, Y = Te.current > 0 ? Te.current : 1;
|
|
13423
13427
|
}
|
|
13424
13428
|
else
|
|
13425
|
-
K = $, Y =
|
|
13429
|
+
K = $, Y = Te.current > 0 ? Te.current : 1;
|
|
13426
13430
|
X.current = K;
|
|
13427
13431
|
const ee = URL.createObjectURL(K), ae = new Audio(ee);
|
|
13428
13432
|
ae.ontimeupdate = () => {
|
|
@@ -13433,8 +13437,8 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13433
13437
|
} catch {
|
|
13434
13438
|
x("Failed to process recording"), a("idle");
|
|
13435
13439
|
}
|
|
13436
|
-
}, S.start(100), de.current = !0, a("recording"), c(0),
|
|
13437
|
-
|
|
13440
|
+
}, S.start(100), de.current = !0, a("recording"), c(0), Te.current = 0, L.current = setInterval(() => {
|
|
13441
|
+
Te.current += 1, c(Te.current);
|
|
13438
13442
|
}, 1e3);
|
|
13439
13443
|
} catch {
|
|
13440
13444
|
x("Could not access microphone. Please allow microphone access.");
|
|
@@ -13465,7 +13469,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13465
13469
|
return;
|
|
13466
13470
|
}
|
|
13467
13471
|
try {
|
|
13468
|
-
O.current && (O.current.pause(), g(!1)),
|
|
13472
|
+
O.current && (O.current.pause(), g(!1)), ke.current = R, ve.current = await ge(X.current);
|
|
13469
13473
|
const T = d || u;
|
|
13470
13474
|
oe.current = m;
|
|
13471
13475
|
const Q = T > 0 ? m / T : 0, J = Math.floor(Q * ie.current.length);
|
|
@@ -13523,14 +13527,14 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13523
13527
|
if (S) {
|
|
13524
13528
|
const $ = J.getBoundingClientRect(), K = $.width, Y = $.height, ee = ie.current, ae = d || u || 1, ne = Q.currentTime;
|
|
13525
13529
|
S.fillStyle = "#2d3b35", S.fillRect(0, 0, K, Y);
|
|
13526
|
-
const te = 8,
|
|
13527
|
-
|
|
13528
|
-
const
|
|
13529
|
-
|
|
13530
|
+
const te = 8, Ee = "rgba(0, 0, 0, 0.4)", je = S.createLinearGradient(0, 0, 0, te);
|
|
13531
|
+
je.addColorStop(0, Ee), je.addColorStop(1, "transparent"), S.fillStyle = je, S.fillRect(0, 0, K, te);
|
|
13532
|
+
const xe = S.createLinearGradient(0, Y - te, 0, Y);
|
|
13533
|
+
xe.addColorStop(0, "transparent"), xe.addColorStop(1, Ee), S.fillStyle = xe, S.fillRect(0, Y - te, K, te);
|
|
13530
13534
|
const fe = S.createLinearGradient(0, 0, te, 0);
|
|
13531
|
-
fe.addColorStop(0,
|
|
13535
|
+
fe.addColorStop(0, Ee), fe.addColorStop(1, "transparent"), S.fillStyle = fe, S.fillRect(0, 0, te, Y);
|
|
13532
13536
|
const Ue = S.createLinearGradient(K - te, 0, K, 0);
|
|
13533
|
-
Ue.addColorStop(0, "transparent"), Ue.addColorStop(1,
|
|
13537
|
+
Ue.addColorStop(0, "transparent"), Ue.addColorStop(1, Ee), S.fillStyle = Ue, S.fillRect(K - te, 0, te, Y), S.strokeStyle = "#5a6b62", S.lineWidth = 1, S.beginPath(), S.moveTo(0, Y / 2), S.lineTo(K, Y / 2), S.stroke();
|
|
13534
13538
|
const We = K / 2, lt = 3, Et = 4, pt = ae > 0 ? ne / ae * ee.length : 0;
|
|
13535
13539
|
for (let tr = 0; tr < ee.length; tr++) {
|
|
13536
13540
|
const ws = pt - tr, xr = We - ws * Et;
|
|
@@ -13564,7 +13568,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13564
13568
|
}
|
|
13565
13569
|
)
|
|
13566
13570
|
] });
|
|
13567
|
-
const
|
|
13571
|
+
const U = {
|
|
13568
13572
|
padding: "8px",
|
|
13569
13573
|
borderRadius: "8px",
|
|
13570
13574
|
border: "none",
|
|
@@ -13574,12 +13578,12 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13574
13578
|
alignItems: "center",
|
|
13575
13579
|
justifyContent: "center",
|
|
13576
13580
|
transition: "background 0.15s"
|
|
13577
|
-
},
|
|
13578
|
-
...
|
|
13581
|
+
}, ye = {
|
|
13582
|
+
...U,
|
|
13579
13583
|
opacity: 0.3,
|
|
13580
13584
|
cursor: "not-allowed"
|
|
13581
|
-
},
|
|
13582
|
-
return /* @__PURE__ */ p.jsxs("div", { style:
|
|
13585
|
+
}, Ae = i ? { border: "1px solid #e5e5e5", borderRadius: "12px", overflow: "hidden", background: "white" } : { overflow: "hidden", background: "white", flexShrink: 0 };
|
|
13586
|
+
return /* @__PURE__ */ p.jsxs("div", { style: Ae, children: [
|
|
13583
13587
|
/* @__PURE__ */ p.jsx(
|
|
13584
13588
|
"canvas",
|
|
13585
13589
|
{
|
|
@@ -13587,11 +13591,11 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13587
13591
|
style: { width: "100%", height: "32px", cursor: "pointer", flexShrink: 0 },
|
|
13588
13592
|
onMouseDown: (R) => {
|
|
13589
13593
|
if (l === "editing") {
|
|
13590
|
-
|
|
13594
|
+
Me.current = !0, Ce.current = R.clientX, Ve.current = m;
|
|
13591
13595
|
const T = (J) => {
|
|
13592
|
-
|
|
13596
|
+
Me.current && dt(J.clientX);
|
|
13593
13597
|
}, Q = () => {
|
|
13594
|
-
|
|
13598
|
+
Me.current = !1, window.removeEventListener("mousemove", T), window.removeEventListener("mouseup", Q);
|
|
13595
13599
|
};
|
|
13596
13600
|
window.addEventListener("mousemove", T), window.addEventListener("mouseup", Q);
|
|
13597
13601
|
}
|
|
@@ -13618,7 +13622,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13618
13622
|
{
|
|
13619
13623
|
onClick: Ut,
|
|
13620
13624
|
disabled: l === "idle" || l === "recording",
|
|
13621
|
-
style: l === "idle" || l === "recording" ?
|
|
13625
|
+
style: l === "idle" || l === "recording" ? ye : U,
|
|
13622
13626
|
title: "Go to start",
|
|
13623
13627
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: "first_page" })
|
|
13624
13628
|
}
|
|
@@ -13634,7 +13638,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13634
13638
|
Dt();
|
|
13635
13639
|
},
|
|
13636
13640
|
disabled: l === "idle",
|
|
13637
|
-
style: l === "idle" ?
|
|
13641
|
+
style: l === "idle" ? ye : U,
|
|
13638
13642
|
title: h || l === "recording" && !A ? "Pause" : "Play",
|
|
13639
13643
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: h || l === "recording" && !A ? "pause" : "play_arrow" })
|
|
13640
13644
|
}
|
|
@@ -13644,7 +13648,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13644
13648
|
{
|
|
13645
13649
|
onClick: Wt,
|
|
13646
13650
|
disabled: l === "idle" || l === "recording",
|
|
13647
|
-
style: l === "idle" || l === "recording" ?
|
|
13651
|
+
style: l === "idle" || l === "recording" ? ye : U,
|
|
13648
13652
|
title: "Go to end",
|
|
13649
13653
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: "last_page" })
|
|
13650
13654
|
}
|
|
@@ -13657,7 +13661,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13657
13661
|
E === "insert" ? ot() : l === "idle" ? (v("insert"), it()) : l === "editing" && (v("insert"), ft("insert"));
|
|
13658
13662
|
},
|
|
13659
13663
|
disabled: l === "recording" && E !== "insert" || h,
|
|
13660
|
-
style: l === "recording" && E !== "insert" || h ?
|
|
13664
|
+
style: l === "recording" && E !== "insert" || h ? ye : U,
|
|
13661
13665
|
title: E === "insert" ? "Stop recording" : "Insert recording",
|
|
13662
13666
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: E === "insert" ? "#ef4444" : "#171717" }, children: "add" })
|
|
13663
13667
|
}
|
|
@@ -13669,7 +13673,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13669
13673
|
E === "mic" ? ot() : l === "idle" ? (v("mic"), it()) : l === "editing" && (v("mic"), ft("replace"));
|
|
13670
13674
|
},
|
|
13671
13675
|
disabled: l === "recording" && E !== "mic" || h,
|
|
13672
|
-
style: l === "recording" && E !== "mic" || h ?
|
|
13676
|
+
style: l === "recording" && E !== "mic" || h ? ye : U,
|
|
13673
13677
|
title: E === "mic" ? "Stop recording" : "Record",
|
|
13674
13678
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: E === "mic" ? "#ef4444" : "#171717" }, children: "mic" })
|
|
13675
13679
|
}
|
|
@@ -13681,7 +13685,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13681
13685
|
E === "startover" ? ot() : l === "editing" && (v("startover"), ht());
|
|
13682
13686
|
},
|
|
13683
13687
|
disabled: l === "idle" || l === "recording" && E !== "startover" || h,
|
|
13684
|
-
style: l === "idle" || l === "recording" && E !== "startover" || h ?
|
|
13688
|
+
style: l === "idle" || l === "recording" && E !== "startover" || h ? ye : U,
|
|
13685
13689
|
title: E === "startover" ? "Stop recording" : "Start over",
|
|
13686
13690
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: E === "startover" ? "#ef4444" : "#171717" }, children: "refresh" })
|
|
13687
13691
|
}
|
|
@@ -13693,7 +13697,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13693
13697
|
{
|
|
13694
13698
|
onClick: () => X.current && t(X.current),
|
|
13695
13699
|
disabled: l !== "editing" || n,
|
|
13696
|
-
style: l !== "editing" || n ?
|
|
13700
|
+
style: l !== "editing" || n ? ye : U,
|
|
13697
13701
|
title: n ? "Transcribing..." : "Transcribe audio",
|
|
13698
13702
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: n ? "hourglass_empty" : "subtitles" })
|
|
13699
13703
|
}
|
|
@@ -13703,7 +13707,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13703
13707
|
{
|
|
13704
13708
|
onClick: At,
|
|
13705
13709
|
disabled: l !== "editing",
|
|
13706
|
-
style: l !== "editing" ?
|
|
13710
|
+
style: l !== "editing" ? ye : U,
|
|
13707
13711
|
title: "Save recording",
|
|
13708
13712
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: "save" })
|
|
13709
13713
|
}
|