@qwanyx/stack 0.2.43 → 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 +20 -20
- package/dist/index.esm.js +763 -757
- 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) {
|
|
@@ -4094,7 +4094,7 @@ function pu() {
|
|
|
4094
4094
|
}
|
|
4095
4095
|
var w = !1, E = !1, v = !1, b = !1, D = !1, k;
|
|
4096
4096
|
k = Symbol.for("react.module.reference");
|
|
4097
|
-
function
|
|
4097
|
+
function I(_) {
|
|
4098
4098
|
return !!(typeof _ == "string" || typeof _ == "function" || _ === n || _ === o || D || _ === s || _ === u || _ === c || b || _ === h || w || E || v || typeof _ == "object" && _ !== null && (_.$$typeof === f || _.$$typeof === d || _.$$typeof === i || _.$$typeof === l || _.$$typeof === a || // This needs to include all possible module reference object
|
|
4099
4099
|
// types supported by any Flight configuration anywhere since
|
|
4100
4100
|
// we don't know which Flight build this will end up being used
|
|
@@ -4156,18 +4156,18 @@ function pu() {
|
|
|
4156
4156
|
}
|
|
4157
4157
|
return null;
|
|
4158
4158
|
}
|
|
4159
|
-
var j = Object.assign,
|
|
4160
|
-
function
|
|
4159
|
+
var j = Object.assign, O = 0, X, de, ie, oe, ve, pe, we;
|
|
4160
|
+
function ke() {
|
|
4161
4161
|
}
|
|
4162
|
-
|
|
4163
|
-
function
|
|
4162
|
+
ke.__reactDisabledLog = !0;
|
|
4163
|
+
function Me() {
|
|
4164
4164
|
{
|
|
4165
|
-
if (
|
|
4166
|
-
|
|
4165
|
+
if (O === 0) {
|
|
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, {
|
|
@@ -4180,12 +4180,12 @@ function pu() {
|
|
|
4180
4180
|
groupEnd: _
|
|
4181
4181
|
});
|
|
4182
4182
|
}
|
|
4183
|
-
|
|
4183
|
+
O++;
|
|
4184
4184
|
}
|
|
4185
4185
|
}
|
|
4186
|
-
function
|
|
4186
|
+
function Te() {
|
|
4187
4187
|
{
|
|
4188
|
-
if (
|
|
4188
|
+
if (O--, O === 0) {
|
|
4189
4189
|
var _ = {
|
|
4190
4190
|
configurable: !0,
|
|
4191
4191
|
enumerable: !0,
|
|
@@ -4193,7 +4193,7 @@ function pu() {
|
|
|
4193
4193
|
};
|
|
4194
4194
|
Object.defineProperties(console, {
|
|
4195
4195
|
log: j({}, _, {
|
|
4196
|
-
value:
|
|
4196
|
+
value: X
|
|
4197
4197
|
}),
|
|
4198
4198
|
info: j({}, _, {
|
|
4199
4199
|
value: de
|
|
@@ -4215,33 +4215,33 @@ function pu() {
|
|
|
4215
4215
|
})
|
|
4216
4216
|
});
|
|
4217
4217
|
}
|
|
4218
|
-
|
|
4218
|
+
O < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
4219
4219
|
}
|
|
4220
4220
|
}
|
|
4221
|
-
var Ce = C.ReactCurrentDispatcher,
|
|
4222
|
-
function
|
|
4221
|
+
var Ce = C.ReactCurrentDispatcher, Ve;
|
|
4222
|
+
function qe(_, P, G) {
|
|
4223
4223
|
{
|
|
4224
|
-
if (
|
|
4224
|
+
if (Ve === void 0)
|
|
4225
4225
|
try {
|
|
4226
4226
|
throw Error();
|
|
4227
4227
|
} catch (he) {
|
|
4228
4228
|
var Z = he.stack.trim().match(/\n( *(at )?)/);
|
|
4229
|
-
|
|
4229
|
+
Ve = Z && Z[1] || "";
|
|
4230
4230
|
}
|
|
4231
4231
|
return `
|
|
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,27 +4375,27 @@ 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
|
-
function
|
|
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.",
|
|
4394
|
+
function R(_) {
|
|
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
|
-
var T = C.ReactCurrentOwner,
|
|
4398
|
+
var T = C.ReactCurrentOwner, Q = {
|
|
4399
4399
|
key: !0,
|
|
4400
4400
|
ref: !0,
|
|
4401
4401
|
__self: !0,
|
|
@@ -4417,7 +4417,7 @@ function pu() {
|
|
|
4417
4417
|
}
|
|
4418
4418
|
return _.key !== void 0;
|
|
4419
4419
|
}
|
|
4420
|
-
function
|
|
4420
|
+
function Y(_, P) {
|
|
4421
4421
|
typeof _.ref == "string" && T.current;
|
|
4422
4422
|
}
|
|
4423
4423
|
function ee(_, P) {
|
|
@@ -4474,38 +4474,38 @@ function pu() {
|
|
|
4474
4474
|
function te(_, P, G, Z, he) {
|
|
4475
4475
|
{
|
|
4476
4476
|
var _e, le = {}, se = null, He = null;
|
|
4477
|
-
G !== void 0 && (
|
|
4477
|
+
G !== void 0 && (R(G), se = "" + G), K(P) && (R(P.key), se = "" + P.key), $(P) && (He = P.ref, Y(P, he));
|
|
4478
4478
|
for (_e in P)
|
|
4479
|
-
dt.call(P, _e) && !
|
|
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;
|
|
4502
|
-
function
|
|
4502
|
+
function Ue(_) {
|
|
4503
4503
|
return typeof _ == "object" && _ !== null && _.$$typeof === e;
|
|
4504
4504
|
}
|
|
4505
|
-
function
|
|
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
|
|
|
@@ -4520,7 +4520,7 @@ Check the render method of \`` + _ + "`.";
|
|
|
4520
4520
|
var Et = {};
|
|
4521
4521
|
function pt(_) {
|
|
4522
4522
|
{
|
|
4523
|
-
var P =
|
|
4523
|
+
var P = We();
|
|
4524
4524
|
if (!P) {
|
|
4525
4525
|
var G = typeof _ == "string" ? _ : _.displayName || _.name;
|
|
4526
4526
|
G && (P = `
|
|
@@ -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) {
|
|
@@ -4550,15 +4550,15 @@ Check the top-level render call using <` + G + ">.");
|
|
|
4550
4550
|
if (At(_))
|
|
4551
4551
|
for (var G = 0; G < _.length; G++) {
|
|
4552
4552
|
var Z = _[G];
|
|
4553
|
-
|
|
4553
|
+
Ue(Z) && Pt(Z, P);
|
|
4554
4554
|
}
|
|
4555
|
-
else if (
|
|
4555
|
+
else if (Ue(_))
|
|
4556
4556
|
_._store && (_._store.validated = !0);
|
|
4557
4557
|
else if (_) {
|
|
4558
4558
|
var he = y(_);
|
|
4559
4559
|
if (typeof he == "function" && he !== _.entries)
|
|
4560
4560
|
for (var _e = he.call(_), le; !(le = _e.next()).done; )
|
|
4561
|
-
|
|
4561
|
+
Ue(le.value) && Pt(le.value, P);
|
|
4562
4562
|
}
|
|
4563
4563
|
}
|
|
4564
4564
|
}
|
|
@@ -4592,28 +4592,28 @@ 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 = {};
|
|
4603
4603
|
function Mr(_, P, G, Z, he, _e) {
|
|
4604
4604
|
{
|
|
4605
|
-
var le =
|
|
4605
|
+
var le = I(_);
|
|
4606
4606
|
if (!le) {
|
|
4607
4607
|
var se = "";
|
|
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
|
-
He ? se += He : se +=
|
|
4611
|
-
var
|
|
4612
|
-
_ === null ?
|
|
4610
|
+
He ? se += He : se += We();
|
|
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) {
|
|
@@ -4766,7 +4766,7 @@ function vf({
|
|
|
4766
4766
|
De(() => {
|
|
4767
4767
|
D(1);
|
|
4768
4768
|
}, [A, E]);
|
|
4769
|
-
const
|
|
4769
|
+
const I = () => {
|
|
4770
4770
|
w(""), v({}), D(1), x(), h == null || h();
|
|
4771
4771
|
}, B = {
|
|
4772
4772
|
background: g.background || "#ffffff",
|
|
@@ -4798,7 +4798,7 @@ function vf({
|
|
|
4798
4798
|
/* @__PURE__ */ p.jsx(
|
|
4799
4799
|
"button",
|
|
4800
4800
|
{
|
|
4801
|
-
onClick:
|
|
4801
|
+
onClick: I,
|
|
4802
4802
|
style: {
|
|
4803
4803
|
marginTop: "16px",
|
|
4804
4804
|
padding: "8px 16px",
|
|
@@ -4835,7 +4835,7 @@ function vf({
|
|
|
4835
4835
|
/* @__PURE__ */ p.jsx(
|
|
4836
4836
|
"button",
|
|
4837
4837
|
{
|
|
4838
|
-
onClick:
|
|
4838
|
+
onClick: I,
|
|
4839
4839
|
style: {
|
|
4840
4840
|
padding: "6px 12px",
|
|
4841
4841
|
background: "transparent",
|
|
@@ -4877,7 +4877,7 @@ function vf({
|
|
|
4877
4877
|
padding: "48px",
|
|
4878
4878
|
textAlign: "center",
|
|
4879
4879
|
color: B.textSecondary
|
|
4880
|
-
}, children: s }) : k.data.map((j,
|
|
4880
|
+
}, children: s }) : k.data.map((j, O) => /* @__PURE__ */ p.jsx(
|
|
4881
4881
|
"div",
|
|
4882
4882
|
{
|
|
4883
4883
|
onClick: () => f == null ? void 0 : f(j),
|
|
@@ -4887,15 +4887,15 @@ function vf({
|
|
|
4887
4887
|
borderBottom: t === "list" ? `1px solid ${B.border}` : "none",
|
|
4888
4888
|
transition: "all 0.15s ease"
|
|
4889
4889
|
},
|
|
4890
|
-
onMouseEnter: (
|
|
4891
|
-
f && (
|
|
4890
|
+
onMouseEnter: (X) => {
|
|
4891
|
+
f && (X.currentTarget.style.background = B.border);
|
|
4892
4892
|
},
|
|
4893
|
-
onMouseLeave: (
|
|
4894
|
-
|
|
4893
|
+
onMouseLeave: (X) => {
|
|
4894
|
+
X.currentTarget.style.background = B.cardBackground;
|
|
4895
4895
|
},
|
|
4896
|
-
children: L(j,
|
|
4896
|
+
children: L(j, O)
|
|
4897
4897
|
},
|
|
4898
|
-
i(j,
|
|
4898
|
+
i(j, O)
|
|
4899
4899
|
)) }),
|
|
4900
4900
|
k.totalPages > 1 && /* @__PURE__ */ p.jsxs("div", { style: {
|
|
4901
4901
|
padding: "16px",
|
|
@@ -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);
|
|
@@ -5062,14 +5062,14 @@ function Df({
|
|
|
5062
5062
|
}
|
|
5063
5063
|
const v = [], b = [], D = [];
|
|
5064
5064
|
for (let k = 0; k < l && k < r.length; k++) {
|
|
5065
|
-
const
|
|
5066
|
-
|
|
5065
|
+
const I = C(D);
|
|
5066
|
+
I && (v.push(I), D.push(I._id));
|
|
5067
5067
|
}
|
|
5068
5068
|
for (let k = 0; k < v.length; k++) {
|
|
5069
|
-
const
|
|
5069
|
+
const I = [
|
|
5070
5070
|
v[k]._id,
|
|
5071
5071
|
...v.filter((F, L) => L !== k).map((F) => F._id)
|
|
5072
|
-
], B = C(
|
|
5072
|
+
], B = C(I);
|
|
5073
5073
|
B ? b.push(B) : b.push(v[k]);
|
|
5074
5074
|
}
|
|
5075
5075
|
u(v), d(b);
|
|
@@ -5077,22 +5077,22 @@ function Df({
|
|
|
5077
5077
|
const A = re((v) => {
|
|
5078
5078
|
const b = x(), D = setTimeout(() => {
|
|
5079
5079
|
h((k) => {
|
|
5080
|
-
const
|
|
5081
|
-
return
|
|
5080
|
+
const I = [...k];
|
|
5081
|
+
return I[v] = !I[v], I;
|
|
5082
5082
|
}), setTimeout(() => {
|
|
5083
5083
|
m((k) => {
|
|
5084
|
-
const
|
|
5085
|
-
return
|
|
5084
|
+
const I = [...k];
|
|
5085
|
+
return I[v] = !I[v], I;
|
|
5086
5086
|
}), setTimeout(() => {
|
|
5087
5087
|
const k = !g[v];
|
|
5088
|
-
k && u((
|
|
5089
|
-
const B = [...
|
|
5088
|
+
k && u((I) => {
|
|
5089
|
+
const B = [...I];
|
|
5090
5090
|
return B[v] = c[v], B;
|
|
5091
|
-
}), d((
|
|
5092
|
-
const B = [...
|
|
5091
|
+
}), d((I) => {
|
|
5092
|
+
const B = [...I], L = [
|
|
5093
5093
|
(k ? c[v] : a[v])._id,
|
|
5094
|
-
...a.filter((
|
|
5095
|
-
...
|
|
5094
|
+
...a.filter((O, X) => X !== v).map((O) => O._id),
|
|
5095
|
+
...I.filter((O, X) => X !== v).map((O) => O._id)
|
|
5096
5096
|
], j = C(L);
|
|
5097
5097
|
return j && (B[v] = j), B;
|
|
5098
5098
|
}), setTimeout(() => {
|
|
@@ -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([]), [
|
|
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([]),
|
|
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);
|
|
@@ -5301,28 +5301,28 @@ function Af({
|
|
|
5301
5301
|
f == null || f(S), i && ct(S);
|
|
5302
5302
|
return;
|
|
5303
5303
|
}
|
|
5304
|
-
const
|
|
5305
|
-
if (K.shiftKey &&
|
|
5306
|
-
const ee = Math.min(
|
|
5307
|
-
|
|
5304
|
+
const Y = S.uid;
|
|
5305
|
+
if (K.shiftKey && X !== null) {
|
|
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
|
+
O(te), h == null || h(Array.from(te));
|
|
5308
5308
|
} else if (K.ctrlKey || K.metaKey)
|
|
5309
|
-
|
|
5309
|
+
O((ee) => {
|
|
5310
5310
|
const ae = new Set(ee);
|
|
5311
|
-
return ae.has(
|
|
5311
|
+
return ae.has(Y) ? ae.delete(Y) : ae.add(Y), h == null || h(Array.from(ae)), ae;
|
|
5312
5312
|
}), de($);
|
|
5313
5313
|
else {
|
|
5314
|
-
const ee = /* @__PURE__ */ new Set([
|
|
5315
|
-
|
|
5314
|
+
const ee = /* @__PURE__ */ new Set([Y]);
|
|
5315
|
+
O(ee), de($), h == null || h(Array.from(ee));
|
|
5316
5316
|
}
|
|
5317
|
-
}, [o,
|
|
5317
|
+
}, [o, X, D, j, f, h, i]), it = re(async () => {
|
|
5318
5318
|
if (!ge || j.size === 0) return;
|
|
5319
5319
|
const S = s || "INBOX";
|
|
5320
5320
|
try {
|
|
5321
5321
|
const $ = await ge.trashEmails(t, Array.from(j), S);
|
|
5322
5322
|
if (console.log("Trash result:", $), $.success && $.moved > 0) {
|
|
5323
|
-
k((
|
|
5323
|
+
k((Y) => Y.filter((ee) => !j.has(ee.uid)));
|
|
5324
5324
|
const K = Array.from(j);
|
|
5325
|
-
|
|
5325
|
+
O(/* @__PURE__ */ new Set()), g == null || g(K);
|
|
5326
5326
|
} else
|
|
5327
5327
|
L("Failed to move emails to trash");
|
|
5328
5328
|
} catch ($) {
|
|
@@ -5335,9 +5335,9 @@ function Af({
|
|
|
5335
5335
|
try {
|
|
5336
5336
|
const $ = await ge.archiveEmails(t, Array.from(j), S);
|
|
5337
5337
|
if (console.log("Archive result:", $), $.success && $.archived > 0) {
|
|
5338
|
-
k((
|
|
5338
|
+
k((Y) => Y.filter((ee) => !j.has(ee.uid)));
|
|
5339
5339
|
const K = Array.from(j);
|
|
5340
|
-
|
|
5340
|
+
O(/* @__PURE__ */ new Set()), g == null || g(K);
|
|
5341
5341
|
} else
|
|
5342
5342
|
L("Failed to archive emails");
|
|
5343
5343
|
} catch ($) {
|
|
@@ -5346,17 +5346,17 @@ function Af({
|
|
|
5346
5346
|
}
|
|
5347
5347
|
}, [ge, t, j, s, g, m]), dt = re(() => {
|
|
5348
5348
|
if (j.size === D.length)
|
|
5349
|
-
|
|
5349
|
+
O(/* @__PURE__ */ new Set()), h == null || h([]);
|
|
5350
5350
|
else {
|
|
5351
5351
|
const S = new Set(D.map(($) => $.uid));
|
|
5352
|
-
|
|
5352
|
+
O(S), h == null || h(Array.from(S));
|
|
5353
5353
|
}
|
|
5354
5354
|
}, [D, j.size, h]), Ut = re(() => {
|
|
5355
|
-
|
|
5355
|
+
O(/* @__PURE__ */ new Set()), h == null || h([]);
|
|
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,16 +5500,16 @@ 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..." }),
|
|
5512
|
-
return
|
|
5511
|
+
}, children: "Loading..." }), Ae = C || ft, R = x || ht, T = A || At, Q = w || U, J = E || ye;
|
|
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",
|
|
5515
5515
|
display: "flex",
|
|
@@ -5540,7 +5540,7 @@ function Af({
|
|
|
5540
5540
|
type: "text",
|
|
5541
5541
|
placeholder: "Search by email or subject...",
|
|
5542
5542
|
value: Ce,
|
|
5543
|
-
onChange: (S) =>
|
|
5543
|
+
onChange: (S) => Ve(S.target.value),
|
|
5544
5544
|
style: {
|
|
5545
5545
|
flex: 1,
|
|
5546
5546
|
border: "none",
|
|
@@ -5554,7 +5554,7 @@ function Af({
|
|
|
5554
5554
|
Ce && /* @__PURE__ */ p.jsx(
|
|
5555
5555
|
"button",
|
|
5556
5556
|
{
|
|
5557
|
-
onClick: () =>
|
|
5557
|
+
onClick: () => Ve(""),
|
|
5558
5558
|
style: {
|
|
5559
5559
|
border: "none",
|
|
5560
5560
|
background: "transparent",
|
|
@@ -5575,17 +5575,17 @@ 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
|
)) })
|
|
5587
5587
|
] }),
|
|
5588
|
-
i && ie && /* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children:
|
|
5588
|
+
i && ie && /* @__PURE__ */ p.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: R(ie) })
|
|
5589
5589
|
] });
|
|
5590
5590
|
}
|
|
5591
5591
|
function Ef({
|
|
@@ -5760,7 +5760,7 @@ function Xu(r, e, t) {
|
|
|
5760
5760
|
i !== null && Ti(e, i, s, o, !1);
|
|
5761
5761
|
}
|
|
5762
5762
|
function Zu(r, e, t) {
|
|
5763
|
-
if (
|
|
5763
|
+
if (M(r)) {
|
|
5764
5764
|
const n = r.anchor.getNode();
|
|
5765
5765
|
if (n.is(t) && r.format !== n.getFormat()) return !1;
|
|
5766
5766
|
}
|
|
@@ -5770,7 +5770,7 @@ function ec(r, e, t, n) {
|
|
|
5770
5770
|
for (let s = r; s && !hc(s); s = xn(s)) {
|
|
5771
5771
|
const o = ds(s, e);
|
|
5772
5772
|
if (o !== void 0) {
|
|
5773
|
-
const i =
|
|
5773
|
+
const i = Ke(o, t);
|
|
5774
5774
|
if (i) return me(i) ? void 0 : [s, i];
|
|
5775
5775
|
} else if (s === n) return [n, Rl(t)];
|
|
5776
5776
|
}
|
|
@@ -5799,8 +5799,8 @@ function kl(r, e, t) {
|
|
|
5799
5799
|
const b = A[v], D = Ll(b), k = b.parentNode;
|
|
5800
5800
|
if (k != null && b !== a && D === null && !Ns(b, k, r)) {
|
|
5801
5801
|
if (Yt) {
|
|
5802
|
-
const
|
|
5803
|
-
|
|
5802
|
+
const I = b.innerText || b.nodeValue;
|
|
5803
|
+
I && (c += I);
|
|
5804
5804
|
}
|
|
5805
5805
|
k.removeChild(b);
|
|
5806
5806
|
}
|
|
@@ -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; ) {
|
|
@@ -6001,30 +6001,30 @@ function Kn(r) {
|
|
|
6001
6001
|
const l = e.__key;
|
|
6002
6002
|
s._dirtyType = Al, N(r) ? i.set(l, !0) : s._dirtyLeaves.add(l);
|
|
6003
6003
|
}
|
|
6004
|
-
function
|
|
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
|
-
const n =
|
|
6009
|
+
const n = Ke(t);
|
|
6010
6010
|
n !== null && n.getWritable();
|
|
6011
6011
|
}
|
|
6012
6012
|
if (r !== null) {
|
|
6013
|
-
const n =
|
|
6013
|
+
const n = Ke(r);
|
|
6014
6014
|
n !== null && n.getWritable();
|
|
6015
6015
|
}
|
|
6016
6016
|
}
|
|
6017
6017
|
}
|
|
6018
6018
|
function Ht() {
|
|
6019
|
-
return Cn() ? null :
|
|
6019
|
+
return Cn() ? null : Ne()._compositionKey;
|
|
6020
6020
|
}
|
|
6021
|
-
function
|
|
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,
|
|
6027
|
-
return t !== void 0 ?
|
|
6026
|
+
const t = ds(r, Ne());
|
|
6027
|
+
return t !== void 0 ? Ke(t, e) : null;
|
|
6028
6028
|
}
|
|
6029
6029
|
function ds(r, e) {
|
|
6030
6030
|
return r[`__lexicalKey_${e._key}`];
|
|
@@ -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);
|
|
@@ -6066,7 +6066,7 @@ function Dr(r) {
|
|
|
6066
6066
|
}
|
|
6067
6067
|
return null;
|
|
6068
6068
|
}(r, e);
|
|
6069
|
-
return t === null ? r === e.getRootElement() ?
|
|
6069
|
+
return t === null ? r === e.getRootElement() ? Ke("root") : null : Ke(t);
|
|
6070
6070
|
}
|
|
6071
6071
|
function no(r, e) {
|
|
6072
6072
|
return e ? r.getTextContentSize() : 0;
|
|
@@ -6112,9 +6112,9 @@ function Ti(r, e, t, n, s) {
|
|
|
6112
6112
|
const a = o.getTextContent();
|
|
6113
6113
|
if (s || l !== a) {
|
|
6114
6114
|
if (l === "") {
|
|
6115
|
-
if (
|
|
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();
|
|
@@ -6124,11 +6124,11 @@ function Ti(r, e, t, n, s) {
|
|
|
6124
6124
|
return;
|
|
6125
6125
|
}
|
|
6126
6126
|
const u = o.getParent(), c = wn(), d = o.getTextContentSize(), f = Ht(), h = o.getKey();
|
|
6127
|
-
if (o.isToken() || f !== null && h === f && !i ||
|
|
6127
|
+
if (o.isToken() || f !== null && h === f && !i || M(c) && (u !== null && !u.canInsertTextBefore() && c.anchor.offset === 0 || c.anchor.key === r.__key && c.anchor.offset === 0 && !o.canInsertTextBefore() && !i || c.focus.key === r.__key && c.focus.offset === d && !o.canInsertTextAfter() && !i)) return void o.markDirty();
|
|
6128
6128
|
const g = V();
|
|
6129
|
-
if (!
|
|
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) {
|
|
@@ -6272,7 +6272,7 @@ function Ni(r, e, t) {
|
|
|
6272
6272
|
}
|
|
6273
6273
|
function ac(r, e, t) {
|
|
6274
6274
|
let n = r._blockCursorElement;
|
|
6275
|
-
if (
|
|
6275
|
+
if (M(t) && t.isCollapsed() && t.anchor.type === "element" && e.contains(document.activeElement)) {
|
|
6276
6276
|
const s = t.anchor, o = s.getNode(), i = s.offset;
|
|
6277
6277
|
let l = !1, a = null;
|
|
6278
6278
|
if (i === o.getChildrenSize())
|
|
@@ -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;
|
|
@@ -6529,30 +6529,30 @@ function gc(r, e, t) {
|
|
|
6529
6529
|
}
|
|
6530
6530
|
} else (function(g, m, y, C, x, A) {
|
|
6531
6531
|
const w = C - 1, E = x - 1;
|
|
6532
|
-
let v, b, D = A.getFirstChild(), k = 0,
|
|
6533
|
-
for (; k <= w &&
|
|
6534
|
-
const L = m[k], j = y[
|
|
6535
|
-
if (L === j) D = Ls(Jr(j, A.element)), k++,
|
|
6532
|
+
let v, b, D = A.getFirstChild(), k = 0, I = 0;
|
|
6533
|
+
for (; k <= w && I <= E; ) {
|
|
6534
|
+
const L = m[k], j = y[I];
|
|
6535
|
+
if (L === j) D = Ls(Jr(j, A.element)), k++, I++;
|
|
6536
6536
|
else {
|
|
6537
6537
|
v === void 0 && (v = new Set(m)), b === void 0 && (b = new Set(y));
|
|
6538
|
-
const
|
|
6539
|
-
if (
|
|
6538
|
+
const X = b.has(L), de = v.has(j);
|
|
6539
|
+
if (X) if (de) {
|
|
6540
6540
|
const ie = Hn(Xe, j);
|
|
6541
|
-
ie === D ? D = Ls(Jr(j, A.element)) : (A.withBefore(D).insertChild(ie), Jr(j, A.element)), k++,
|
|
6542
|
-
} else Yn(j, A.withBefore(D)),
|
|
6541
|
+
ie === D ? D = Ls(Jr(j, A.element)) : (A.withBefore(D).insertChild(ie), Jr(j, A.element)), k++, I++;
|
|
6542
|
+
} else Yn(j, A.withBefore(D)), I++;
|
|
6543
6543
|
else D = Ls(Zs(L)), Qn(L, A.element), k++;
|
|
6544
6544
|
}
|
|
6545
|
-
const
|
|
6546
|
-
|
|
6545
|
+
const O = _t.get(j);
|
|
6546
|
+
O !== null && q(O) && (St === null && (St = O.getFormat()), mt === "" && (mt = O.getStyle()));
|
|
6547
6547
|
}
|
|
6548
|
-
const B = k > w, F =
|
|
6548
|
+
const B = k > w, F = I > E;
|
|
6549
6549
|
if (B && !F) {
|
|
6550
6550
|
const L = y[E + 1], j = L === void 0 ? null : Xe.getElementByKey(L);
|
|
6551
|
-
Xs(y, g,
|
|
6551
|
+
Xs(y, g, I, E, A.withBefore(j));
|
|
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 ||
|
|
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;
|
|
@@ -6725,9 +6725,9 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
|
|
|
6725
6725
|
}], ["compositionstart", function(r, e) {
|
|
6726
6726
|
nt(e, () => {
|
|
6727
6727
|
const t = V();
|
|
6728
|
-
if (
|
|
6728
|
+
if (M(t) && !e.isComposing()) {
|
|
6729
6729
|
const n = t.anchor, s = t.anchor.getNode();
|
|
6730
|
-
|
|
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) {
|
|
@@ -6737,25 +6737,25 @@ const Rt = Object.freeze({}), ei = 30, ti = [["keydown", function(r, e) {
|
|
|
6737
6737
|
}], ["input", function(r, e) {
|
|
6738
6738
|
r.stopPropagation(), nt(e, () => {
|
|
6739
6739
|
const t = V(), n = r.data, s = Xl(r);
|
|
6740
|
-
if (n != null &&
|
|
6740
|
+
if (n != null && M(t) && Yl(t, s, n, r.timeStamp, !1)) {
|
|
6741
6741
|
Gr && (Ps(e, n), Gr = !1);
|
|
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
|
-
Yt && c > 1 && r.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= c), as || gn || mi || !e.isComposing() || (rn = 0,
|
|
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, () => {
|
|
6754
6754
|
const t = V(), n = ut(e._window), s = wn();
|
|
6755
6755
|
if (n) {
|
|
6756
|
-
if (
|
|
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) {
|
|
@@ -6774,30 +6774,30 @@ zn && ti.push(["beforeinput", (r, e) => function(t, n) {
|
|
|
6774
6774
|
if (s === "deleteContentBackward") {
|
|
6775
6775
|
if (i === null) {
|
|
6776
6776
|
const h = wn();
|
|
6777
|
-
if (!
|
|
6777
|
+
if (!M(h)) return;
|
|
6778
6778
|
Nt(h.clone());
|
|
6779
6779
|
}
|
|
6780
|
-
if (
|
|
6780
|
+
if (M(i)) {
|
|
6781
6781
|
const h = i.anchor.key === i.focus.key;
|
|
6782
6782
|
if (l = t.timeStamp, Hl === "MediaLast" && l < rn + ei && n.isComposing() && h) {
|
|
6783
|
-
if (
|
|
6783
|
+
if (Ge(null), rn = 0, setTimeout(() => {
|
|
6784
6784
|
nt(n, () => {
|
|
6785
|
-
|
|
6785
|
+
Ge(null);
|
|
6786
6786
|
});
|
|
6787
|
-
}, ei),
|
|
6787
|
+
}, ei), M(i)) {
|
|
6788
6788
|
const g = i.anchor.getNode();
|
|
6789
6789
|
g.markDirty(), i.format = g.getFormat(), q(g) || z(142), i.style = g.getStyle();
|
|
6790
6790
|
}
|
|
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
|
}
|
|
6798
6798
|
}
|
|
6799
6799
|
var l;
|
|
6800
|
-
if (!
|
|
6800
|
+
if (!M(i)) return;
|
|
6801
6801
|
const a = t.data;
|
|
6802
6802
|
Cr !== null && ki(!1, n, Cr), i.dirty && Cr === null || !i.isCollapsed() || Ye(i.anchor.getNode()) || o === null || i.applyDOMRange(o), Cr = null;
|
|
6803
6803
|
const u = i.anchor, c = i.focus, d = u.getNode(), f = c.getNode();
|
|
@@ -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
|
-
|
|
6811
|
+
Ge(null), W(n, Sr, t);
|
|
6812
6812
|
break;
|
|
6813
6813
|
case "insertLineBreak":
|
|
6814
|
-
|
|
6814
|
+
Ge(null), W(n, Er, !1);
|
|
6815
6815
|
break;
|
|
6816
6816
|
case "insertParagraph":
|
|
6817
|
-
|
|
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) {
|
|
@@ -6893,11 +6893,11 @@ function po(r, e, t) {
|
|
|
6893
6893
|
if (!t) return void Nt(null);
|
|
6894
6894
|
if (!yn(e, n, o)) return;
|
|
6895
6895
|
const l = V();
|
|
6896
|
-
if (
|
|
6896
|
+
if (M(l)) {
|
|
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) {
|
|
@@ -6924,17 +6924,17 @@ function Xl(r) {
|
|
|
6924
6924
|
}
|
|
6925
6925
|
function Ps(r, e) {
|
|
6926
6926
|
const t = r._compositionKey;
|
|
6927
|
-
if (
|
|
6927
|
+
if (Ge(null), t !== null && e != null) {
|
|
6928
6928
|
if (e === "") {
|
|
6929
|
-
const n =
|
|
6929
|
+
const n = Ke(t), s = Gn(r.getElementByKey(t));
|
|
6930
6930
|
return void (s !== null && s.nodeValue !== null && q(n) && Ti(n, s.nodeValue, null, null, !0));
|
|
6931
6931
|
}
|
|
6932
6932
|
if (e[e.length - 1] === `
|
|
6933
6933
|
`) {
|
|
6934
6934
|
const n = V();
|
|
6935
|
-
if (
|
|
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
|
}
|
|
@@ -6987,16 +6987,16 @@ function si(r, e, t) {
|
|
|
6987
6987
|
if (s === null) return;
|
|
6988
6988
|
const o = function(l) {
|
|
6989
6989
|
const a = V();
|
|
6990
|
-
if (!
|
|
6990
|
+
if (!M(a) || !N(l)) return a;
|
|
6991
6991
|
const { anchor: u, focus: c } = a, d = u.getNode(), f = c.getNode();
|
|
6992
6992
|
return tn(d, l) && u.set(l.__key, 0, "element"), tn(f, l) && c.set(l.__key, 0, "element"), a;
|
|
6993
6993
|
}(r);
|
|
6994
6994
|
let i = !1;
|
|
6995
|
-
if (
|
|
6995
|
+
if (M(o) && e) {
|
|
6996
6996
|
const l = o.anchor, a = o.focus;
|
|
6997
6997
|
l.key === n && (ts(l, r, s, r.getPreviousSibling(), r.getNextSibling()), i = !0), a.key === n && (ts(a, r, s, r.getPreviousSibling(), r.getNextSibling()), i = !0);
|
|
6998
6998
|
} else kt(o) && e && r.isSelected() && r.selectPrevious();
|
|
6999
|
-
if (
|
|
6999
|
+
if (M(o) && e && !i) {
|
|
7000
7000
|
const l = r.getIndexWithinParent();
|
|
7001
7001
|
lr(r), es(o, s, l, -1);
|
|
7002
7002
|
} else lr(r);
|
|
@@ -7025,7 +7025,7 @@ class gs {
|
|
|
7025
7025
|
let e = this.__key;
|
|
7026
7026
|
for (; e !== null; ) {
|
|
7027
7027
|
if (e === "root") return !0;
|
|
7028
|
-
const t =
|
|
7028
|
+
const t = Ke(e);
|
|
7029
7029
|
if (t === null) break;
|
|
7030
7030
|
e = t.__parent;
|
|
7031
7031
|
}
|
|
@@ -7036,7 +7036,7 @@ class gs {
|
|
|
7036
7036
|
if (t == null) return !1;
|
|
7037
7037
|
const n = t.getNodes().some((s) => s.__key === this.__key);
|
|
7038
7038
|
if (q(this)) return n;
|
|
7039
|
-
if (
|
|
7039
|
+
if (M(t) && t.anchor.type === "element" && t.focus.type === "element") {
|
|
7040
7040
|
if (t.isCollapsed()) return !1;
|
|
7041
7041
|
const s = this.getParent();
|
|
7042
7042
|
if (me(this) && this.isInline() && s) {
|
|
@@ -7061,7 +7061,7 @@ class gs {
|
|
|
7061
7061
|
}
|
|
7062
7062
|
getParent() {
|
|
7063
7063
|
const e = this.getLatest().__parent;
|
|
7064
|
-
return e === null ? null :
|
|
7064
|
+
return e === null ? null : Ke(e);
|
|
7065
7065
|
}
|
|
7066
7066
|
getParentOrThrow() {
|
|
7067
7067
|
const e = this.getParent();
|
|
@@ -7094,7 +7094,7 @@ class gs {
|
|
|
7094
7094
|
}
|
|
7095
7095
|
getPreviousSibling() {
|
|
7096
7096
|
const e = this.getLatest().__prev;
|
|
7097
|
-
return e === null ? null :
|
|
7097
|
+
return e === null ? null : Ke(e);
|
|
7098
7098
|
}
|
|
7099
7099
|
getPreviousSiblings() {
|
|
7100
7100
|
const e = [], t = this.getParent();
|
|
@@ -7105,7 +7105,7 @@ class gs {
|
|
|
7105
7105
|
}
|
|
7106
7106
|
getNextSibling() {
|
|
7107
7107
|
const e = this.getLatest().__next;
|
|
7108
|
-
return e === null ? null :
|
|
7108
|
+
return e === null ? null : Ke(e);
|
|
7109
7109
|
}
|
|
7110
7110
|
getNextSiblings() {
|
|
7111
7111
|
const e = [];
|
|
@@ -7190,16 +7190,16 @@ 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() {
|
|
7197
|
-
const e =
|
|
7197
|
+
const e = Ke(this.__key);
|
|
7198
7198
|
return e === null && z(113), e;
|
|
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;
|
|
@@ -7240,12 +7240,12 @@ class gs {
|
|
|
7240
7240
|
const c = s.getPreviousSibling(), d = s.getNextSibling(), f = s.__prev, h = s.__next, g = s.__parent;
|
|
7241
7241
|
if (si(s, !1, !0), c === null ? a.__first = i : c.getWritable().__next = i, l.__prev = f, d === null ? a.__last = i : d.getWritable().__prev = i, l.__next = h, l.__parent = g, a.__size = u, t && (N(this) && N(l) || z(139), this.getChildren().forEach((m) => {
|
|
7242
7242
|
l.append(m);
|
|
7243
|
-
})),
|
|
7243
|
+
})), M(n)) {
|
|
7244
7244
|
Nt(n);
|
|
7245
7245
|
const m = n.anchor, y = n.focus;
|
|
7246
7246
|
m.key === o && _o(m, l), y.key === o && _o(y, l);
|
|
7247
7247
|
}
|
|
7248
|
-
return Ht() === o &&
|
|
7248
|
+
return Ht() === o && Ge(i), l;
|
|
7249
7249
|
}
|
|
7250
7250
|
insertAfter(e, t = !0) {
|
|
7251
7251
|
et(), Fs(this, e);
|
|
@@ -7253,13 +7253,13 @@ class gs {
|
|
|
7253
7253
|
let l = !1, a = !1;
|
|
7254
7254
|
if (o !== null) {
|
|
7255
7255
|
const h = e.getIndexWithinParent();
|
|
7256
|
-
if (lr(s),
|
|
7256
|
+
if (lr(s), M(i)) {
|
|
7257
7257
|
const g = o.__key, m = i.anchor, y = i.focus;
|
|
7258
7258
|
l = m.type === "element" && m.key === g && m.offset === h + 1, a = y.type === "element" && y.key === g && y.offset === h + 1;
|
|
7259
7259
|
}
|
|
7260
7260
|
}
|
|
7261
7261
|
const u = this.getNextSibling(), c = this.getParentOrThrow().getWritable(), d = s.__key, f = n.__next;
|
|
7262
|
-
if (u === null ? c.__last = d : u.getWritable().__prev = d, c.__size++, n.__next = d, s.__next = f, s.__prev = n.__key, s.__parent = n.__parent, t &&
|
|
7262
|
+
if (u === null ? c.__last = d : u.getWritable().__prev = d, c.__size++, n.__next = d, s.__next = f, s.__prev = n.__key, s.__parent = n.__parent, t && M(i)) {
|
|
7263
7263
|
const h = this.getIndexWithinParent();
|
|
7264
7264
|
es(i, c, h + 1);
|
|
7265
7265
|
const g = c.__key;
|
|
@@ -7274,13 +7274,13 @@ class gs {
|
|
|
7274
7274
|
const i = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(), a = n.__prev, u = this.getIndexWithinParent();
|
|
7275
7275
|
i === null ? l.__first = o : i.getWritable().__next = o, l.__size++, n.__prev = o, s.__prev = a, s.__next = n.__key, s.__parent = n.__parent;
|
|
7276
7276
|
const c = V();
|
|
7277
|
-
return t &&
|
|
7277
|
+
return t && M(c) && es(c, this.getParentOrThrow(), u), e;
|
|
7278
7278
|
}
|
|
7279
7279
|
isParentRequired() {
|
|
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) {
|
|
@@ -7567,10 +7567,10 @@ class Lr extends gs {
|
|
|
7567
7567
|
const a = i.length;
|
|
7568
7568
|
n === void 0 && (n = a), s === void 0 && (s = a);
|
|
7569
7569
|
} else n = 0, s = 0;
|
|
7570
|
-
if (!
|
|
7570
|
+
if (!M(o)) return ia(l, n, l, s, "text", "text");
|
|
7571
7571
|
{
|
|
7572
7572
|
const a = Ht();
|
|
7573
|
-
a !== o.anchor.key && a !== o.focus.key ||
|
|
7573
|
+
a !== o.anchor.key && a !== o.focus.key || Ge(l), o.setTextNodeRange(this, n, this, s);
|
|
7574
7574
|
}
|
|
7575
7575
|
return o;
|
|
7576
7576
|
}
|
|
@@ -7586,7 +7586,7 @@ class Lr extends gs {
|
|
|
7586
7586
|
let a = e;
|
|
7587
7587
|
a < 0 && (a = l + a, a < 0 && (a = 0));
|
|
7588
7588
|
const u = V();
|
|
7589
|
-
if (s &&
|
|
7589
|
+
if (s && M(u)) {
|
|
7590
7590
|
const d = e + l;
|
|
7591
7591
|
u.setTextNodeRange(o, d, o, d);
|
|
7592
7592
|
}
|
|
@@ -7612,18 +7612,18 @@ 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
|
-
const k = D.__key,
|
|
7622
|
-
if (
|
|
7621
|
+
const k = D.__key, I = w + b;
|
|
7622
|
+
if (M(x)) {
|
|
7623
7623
|
const B = x.anchor, F = x.focus;
|
|
7624
|
-
B.key === s && B.type === "text" && B.offset > w && B.offset <=
|
|
7624
|
+
B.key === s && B.type === "text" && B.offset > w && B.offset <= I && (B.key = k, B.offset -= w, x.dirty = !0), F.key === s && F.type === "text" && F.offset > w && F.offset <= I && (F.key = k, F.offset -= w, x.dirty = !0);
|
|
7625
7625
|
}
|
|
7626
|
-
o === s &&
|
|
7626
|
+
o === s && Ge(k), w = I, A.push(D);
|
|
7627
7627
|
}
|
|
7628
7628
|
if (f !== null) {
|
|
7629
7629
|
(function(b) {
|
|
@@ -7631,7 +7631,7 @@ class Lr extends gs {
|
|
|
7631
7631
|
D !== null && Kn(D), k !== null && Kn(k);
|
|
7632
7632
|
})(this);
|
|
7633
7633
|
const E = f.getWritable(), v = this.getIndexWithinParent();
|
|
7634
|
-
C ? (E.splice(v, 0, A), this.remove()) : E.splice(v, 1, A),
|
|
7634
|
+
C ? (E.splice(v, 0, A), this.remove()) : E.splice(v, 1, A), M(x) && es(x, f, v, c - 1);
|
|
7635
7635
|
}
|
|
7636
7636
|
return A;
|
|
7637
7637
|
}
|
|
@@ -7639,9 +7639,9 @@ class Lr extends gs {
|
|
|
7639
7639
|
const t = e === this.getPreviousSibling();
|
|
7640
7640
|
t || e === this.getNextSibling() || z(50);
|
|
7641
7641
|
const n = this.__key, s = e.__key, o = this.__text, i = o.length;
|
|
7642
|
-
Ht() === s &&
|
|
7642
|
+
Ht() === s && Ge(n);
|
|
7643
7643
|
const l = V();
|
|
7644
|
-
if (
|
|
7644
|
+
if (M(l)) {
|
|
7645
7645
|
const d = l.anchor, f = l.focus;
|
|
7646
7646
|
d !== null && d.key === s && (So(d, t, n, e, i), l.dirty = !0), f !== null && f.key === s && (So(f, t, n, e, i), l.dirty = !0);
|
|
7647
7647
|
}
|
|
@@ -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) {
|
|
@@ -7809,12 +7809,12 @@ class Ac {
|
|
|
7809
7809
|
return t === n ? s < o : t.isBefore(n);
|
|
7810
7810
|
}
|
|
7811
7811
|
getNode() {
|
|
7812
|
-
const e =
|
|
7812
|
+
const e = Ke(this.key);
|
|
7813
7813
|
return e === null && z(20), e;
|
|
7814
7814
|
}
|
|
7815
7815
|
set(e, t, n) {
|
|
7816
7816
|
const s = this._selection, o = this.key;
|
|
7817
|
-
this.key = e, this.offset = t, this.type = n, Cn() || (Ht() === o &&
|
|
7817
|
+
this.key = e, this.offset = t, this.type = n, Cn() || (Ht() === o && Ge(e), s !== null && (s.setCachedNodes(null), s.dirty = !0));
|
|
7818
7818
|
}
|
|
7819
7819
|
}
|
|
7820
7820
|
function jt(r, e, t) {
|
|
@@ -7907,7 +7907,7 @@ class ms {
|
|
|
7907
7907
|
if (e !== null) return e;
|
|
7908
7908
|
const t = this._nodes, n = [];
|
|
7909
7909
|
for (const s of t) {
|
|
7910
|
-
const o =
|
|
7910
|
+
const o = Ke(s);
|
|
7911
7911
|
o !== null && n.push(o);
|
|
7912
7912
|
}
|
|
7913
7913
|
return Cn() || (this._cachedNodes = n), n;
|
|
@@ -7919,7 +7919,7 @@ class ms {
|
|
|
7919
7919
|
return t;
|
|
7920
7920
|
}
|
|
7921
7921
|
}
|
|
7922
|
-
function
|
|
7922
|
+
function M(r) {
|
|
7923
7923
|
return r instanceof er;
|
|
7924
7924
|
}
|
|
7925
7925
|
class er {
|
|
@@ -7933,7 +7933,7 @@ class er {
|
|
|
7933
7933
|
this._cachedNodes = e;
|
|
7934
7934
|
}
|
|
7935
7935
|
is(e) {
|
|
7936
|
-
return !!
|
|
7936
|
+
return !!M(e) && this.anchor.is(e.anchor) && this.focus.is(e.focus) && this.format === e.format && this.style === e.style;
|
|
7937
7937
|
}
|
|
7938
7938
|
isCollapsed() {
|
|
7939
7939
|
return this.anchor.is(this.focus);
|
|
@@ -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);
|
|
@@ -8082,19 +8082,19 @@ class er {
|
|
|
8082
8082
|
if (!v) {
|
|
8083
8083
|
let D = x, k = null;
|
|
8084
8084
|
for (; D !== null; ) {
|
|
8085
|
-
const
|
|
8086
|
-
(B === 0 ||
|
|
8085
|
+
const I = D.getChildren(), B = I.length;
|
|
8086
|
+
(B === 0 || I[B - 1].is(k)) && (y.delete(D.__key), k = D), D = D.getParent();
|
|
8087
8087
|
}
|
|
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);
|
|
8095
8095
|
for (let D = 1; D < d; D++) {
|
|
8096
|
-
const k = c[D],
|
|
8097
|
-
y.has(
|
|
8096
|
+
const k = c[D], I = k.__key;
|
|
8097
|
+
y.has(I) || k.remove();
|
|
8098
8098
|
}
|
|
8099
8099
|
}
|
|
8100
8100
|
}
|
|
@@ -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
|
};
|
|
@@ -8124,7 +8124,7 @@ class er {
|
|
|
8124
8124
|
q(l) && (l.spliceText(0, o.offset, ""), l = c(l, o.offset) || l), i.isAttached() && q(i) ? i.selectEnd() : l.isAttached() && q(l) && l.selectStart(), N(a) && N(u) && a !== u && (a.append(...u.getChildren()), u.remove(), o.set(s.key, s.offset, s.type));
|
|
8125
8125
|
}
|
|
8126
8126
|
formatText(e, t = null) {
|
|
8127
|
-
if (this.isCollapsed()) return this.toggleFormat(e), void
|
|
8127
|
+
if (this.isCollapsed()) return this.toggleFormat(e), void Ge(null);
|
|
8128
8128
|
const n = this.getNodes(), s = [];
|
|
8129
8129
|
for (const w of n) q(w) && s.push(w);
|
|
8130
8130
|
const o = (w) => {
|
|
@@ -8135,7 +8135,7 @@ class er {
|
|
|
8135
8135
|
}
|
|
8136
8136
|
});
|
|
8137
8137
|
}, i = s.length;
|
|
8138
|
-
if (i === 0) return this.toggleFormat(e),
|
|
8138
|
+
if (i === 0) return this.toggleFormat(e), Ge(null), void o(t);
|
|
8139
8139
|
const l = this.anchor, a = this.focus, u = this.isBackward(), c = u ? a : l, d = u ? l : a;
|
|
8140
8140
|
let f = 0, h = s[0], g = c.type === "element" ? 0 : c.offset;
|
|
8141
8141
|
if (c.type === "text" && g === h.getTextContentSize() && (f = 1, h = s[1], g = 0), h == null) return;
|
|
@@ -8167,7 +8167,7 @@ class er {
|
|
|
8167
8167
|
if (this.anchor.key === "root") {
|
|
8168
8168
|
this.insertParagraph();
|
|
8169
8169
|
const g = V();
|
|
8170
|
-
return
|
|
8170
|
+
return M(g) || z(134), g.insertNodes(e);
|
|
8171
8171
|
}
|
|
8172
8172
|
const t = (this.isBackward() ? this.focus : this.anchor).getNode(), n = Wr(t, Vt), s = e[e.length - 1];
|
|
8173
8173
|
if (N(n) && "__language" in n) {
|
|
@@ -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,8 +8459,8 @@ 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 =
|
|
8463
|
-
if (o.isComposing() && o._compositionKey !== r.key &&
|
|
8462
|
+
const o = Ne();
|
|
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);
|
|
8466
8466
|
}
|
|
@@ -8468,9 +8468,9 @@ function na(r, e, t) {
|
|
|
8468
8468
|
}
|
|
8469
8469
|
function sa(r, e, t, n, s, o) {
|
|
8470
8470
|
if (r === null || t === null || !yn(s, r, t)) return null;
|
|
8471
|
-
const i = Co(r, e,
|
|
8471
|
+
const i = Co(r, e, M(o) ? o.anchor : null, s);
|
|
8472
8472
|
if (i === null) return null;
|
|
8473
|
-
const l = Co(t, n,
|
|
8473
|
+
const l = Co(t, n, M(o) ? o.focus : null, s);
|
|
8474
8474
|
if (l === null) return null;
|
|
8475
8475
|
if (i.type === "element" && l.type === "element") {
|
|
8476
8476
|
const a = Dr(r), u = Dr(t);
|
|
@@ -8497,19 +8497,19 @@ function Pi(r, e, t, n) {
|
|
|
8497
8497
|
if (s === null) return null;
|
|
8498
8498
|
const o = n || s.event, i = o ? o.type : void 0, l = i === "selectionchange", a = !Vs && (l || i === "beforeinput" || i === "compositionstart" || i === "compositionend" || i === "click" && o && o.detail === 3 || i === "drop" || i === void 0);
|
|
8499
8499
|
let u, c, d, f;
|
|
8500
|
-
if (
|
|
8500
|
+
if (M(r) && !a) return r.clone();
|
|
8501
8501
|
if (e === null) return null;
|
|
8502
|
-
if (u = e.anchorNode, c = e.focusNode, d = e.anchorOffset, f = e.focusOffset, l &&
|
|
8502
|
+
if (u = e.anchorNode, c = e.focusNode, d = e.anchorOffset, f = e.focusOffset, l && M(r) && !yn(t, u, c)) return r.clone();
|
|
8503
8503
|
const h = sa(u, d, c, f, t, r);
|
|
8504
8504
|
if (h === null) return null;
|
|
8505
8505
|
const [g, m] = h;
|
|
8506
|
-
return new er(g, m,
|
|
8506
|
+
return new er(g, m, M(r) ? r.format : 0, M(r) ? r.style : "");
|
|
8507
8507
|
}
|
|
8508
8508
|
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();
|
|
@@ -8570,51 +8570,51 @@ function So(r, e, t, n, s) {
|
|
|
8570
8570
|
function Sc(r, e, t, n, s, o, i) {
|
|
8571
8571
|
const l = n.anchorNode, a = n.focusNode, u = n.anchorOffset, c = n.focusOffset, d = document.activeElement;
|
|
8572
8572
|
if (s.has("collaboration") && d !== o || d !== null && Ai(d)) return;
|
|
8573
|
-
if (!
|
|
8573
|
+
if (!M(e)) return void (r !== null && yn(t, l, a) && n.removeAllRanges());
|
|
8574
8574
|
const f = e.anchor, h = e.focus, g = f.key, m = h.key, y = Hn(t, g), C = Hn(t, m), x = f.offset, A = h.offset, w = e.format, E = e.style, v = e.isCollapsed();
|
|
8575
8575
|
let b = y, D = C, k = !1;
|
|
8576
8576
|
if (f.type === "text") {
|
|
8577
8577
|
b = Gn(y);
|
|
8578
|
-
const
|
|
8579
|
-
k =
|
|
8580
|
-
} else
|
|
8581
|
-
var
|
|
8582
|
-
if (h.type === "text" && (D = Gn(C)), b !== null && D !== null && (v && (r === null || k ||
|
|
8578
|
+
const O = f.getNode();
|
|
8579
|
+
k = O.getFormat() !== w || O.getStyle() !== E;
|
|
8580
|
+
} else M(r) && r.anchor.type === "text" && (k = !0);
|
|
8581
|
+
var I, B, F, L, j;
|
|
8582
|
+
if (h.type === "text" && (D = Gn(C)), b !== null && D !== null && (v && (r === null || k || M(r) && (r.format !== w || r.style !== E)) && (I = w, B = E, F = x, L = g, j = performance.now(), Ql = [I, B, F, L, j]), u !== x || c !== A || l !== b || a !== D || n.type === "Range" && v || (d !== null && o.contains(d) || o.focus({ preventScroll: !0 }), f.type === "element"))) {
|
|
8583
8583
|
try {
|
|
8584
8584
|
n.setBaseAndExtent(b, x, D, A);
|
|
8585
8585
|
} catch {
|
|
8586
8586
|
}
|
|
8587
8587
|
if (!s.has("skip-scroll-into-view") && e.isCollapsed() && o !== null && o === document.activeElement) {
|
|
8588
|
-
const
|
|
8589
|
-
if (
|
|
8590
|
-
let
|
|
8591
|
-
if (
|
|
8588
|
+
const O = e instanceof er && e.anchor.type === "element" ? b.childNodes[x] || null : n.rangeCount > 0 ? n.getRangeAt(0) : null;
|
|
8589
|
+
if (O !== null) {
|
|
8590
|
+
let X;
|
|
8591
|
+
if (O instanceof Text) {
|
|
8592
8592
|
const de = document.createRange();
|
|
8593
|
-
de.selectNode(
|
|
8594
|
-
} else
|
|
8593
|
+
de.selectNode(O), X = de.getBoundingClientRect();
|
|
8594
|
+
} else X = O.getBoundingClientRect();
|
|
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
|
-
const
|
|
8601
|
-
if (
|
|
8600
|
+
const Ve = Ce === ve.body;
|
|
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
|
-
if (
|
|
8614
|
+
if (Ve) break;
|
|
8615
8615
|
Ce = xn(Ce);
|
|
8616
8616
|
}
|
|
8617
|
-
})(t,
|
|
8617
|
+
})(t, X, o);
|
|
8618
8618
|
}
|
|
8619
8619
|
}
|
|
8620
8620
|
ri = !0;
|
|
@@ -8622,13 +8622,13 @@ 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;
|
|
8629
8629
|
r.isCollapsed() || e.removeText();
|
|
8630
8630
|
const t = V();
|
|
8631
|
-
|
|
8631
|
+
M(t) && (e = t), M(e) || z(161);
|
|
8632
8632
|
const n = e.anchor;
|
|
8633
8633
|
let s = n.getNode(), o = n.offset;
|
|
8634
8634
|
for (; !Vt(s); ) [s, o] = kc(s, o);
|
|
@@ -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);
|
|
@@ -8754,13 +8754,13 @@ function Jt(r, e) {
|
|
|
8754
8754
|
a && (r._dirtyType = ur, r._cloneNotNeeded.clear(), r._dirtyLeaves = /* @__PURE__ */ new Set(), r._dirtyElements = /* @__PURE__ */ new Map(), r._normalizedNodes = /* @__PURE__ */ new Set(), r._updateTags = /* @__PURE__ */ new Set()), function(v, b) {
|
|
8755
8755
|
const D = v._decorators;
|
|
8756
8756
|
let k = v._pendingDecorators || D;
|
|
8757
|
-
const
|
|
8757
|
+
const I = b._nodeMap;
|
|
8758
8758
|
let B;
|
|
8759
|
-
for (B in k)
|
|
8759
|
+
for (B in k) I.has(B) || (k === D && (k = Pl(v)), delete k[B]);
|
|
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,20 +8768,20 @@ 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
|
-
g !== null && function(v, b, D, k,
|
|
8774
|
+
g !== null && function(v, b, D, k, I) {
|
|
8775
8775
|
const B = Array.from(v._listeners.mutation), F = B.length;
|
|
8776
8776
|
for (let L = 0; L < F; L++) {
|
|
8777
|
-
const [j,
|
|
8778
|
-
|
|
8777
|
+
const [j, O] = B[L], X = b.get(O);
|
|
8778
|
+
X !== void 0 && j(X, { dirtyLeaves: k, prevEditorState: I, updateTags: D });
|
|
8779
8779
|
}
|
|
8780
|
-
}(r, g, x, m, o),
|
|
8780
|
+
}(r, g, x, m, o), M(l) || l === null || i !== null && i.is(l) || r.dispatchCommand(fi, void 0);
|
|
8781
8781
|
const E = r._pendingDecorators;
|
|
8782
8782
|
E !== null && (r._decorators = E, r._pendingDecorators = null, sn("decorator", r, !0, E)), function(v, b, D) {
|
|
8783
|
-
const k = ro(b),
|
|
8784
|
-
k !==
|
|
8783
|
+
const k = ro(b), I = ro(D);
|
|
8784
|
+
k !== I && sn("textcontent", v, !0, I);
|
|
8785
8785
|
}(r, e || o, t), sn("update", r, !0, { dirtyElements: y, dirtyLeaves: m, editorState: t, normalizedNodes: C, prevEditorState: e || o, tags: x }), function(v, b) {
|
|
8786
8786
|
if (v._deferred = [], b.length !== 0) {
|
|
8787
8787
|
const D = v._updating;
|
|
@@ -8797,8 +8797,8 @@ function Jt(r, e) {
|
|
|
8797
8797
|
if (b.length !== 0) {
|
|
8798
8798
|
const D = b.shift();
|
|
8799
8799
|
if (D) {
|
|
8800
|
-
const [k,
|
|
8801
|
-
da(v, k,
|
|
8800
|
+
const [k, I] = D;
|
|
8801
|
+
da(v, k, I);
|
|
8802
8802
|
}
|
|
8803
8803
|
}
|
|
8804
8804
|
}(r);
|
|
@@ -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,17 +8860,17 @@ 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);
|
|
8868
|
-
return
|
|
8868
|
+
return M(x) || x == null ? Pi(x, A, C, null) : x.clone();
|
|
8869
8869
|
}(r));
|
|
8870
8870
|
const m = r._compositionKey;
|
|
8871
8871
|
e(), o = Fo(r, o), function(C, x) {
|
|
8872
8872
|
const A = x.getEditorState()._selection, w = C._selection;
|
|
8873
|
-
if (
|
|
8873
|
+
if (M(w)) {
|
|
8874
8874
|
const E = w.anchor, v = w.focus;
|
|
8875
8875
|
let b;
|
|
8876
8876
|
if (E.type === "text" && (b = E.getNode(), b.selectionTransform(A, w)), v.type === "text") {
|
|
@@ -8886,7 +8886,7 @@ function da(r, e, t) {
|
|
|
8886
8886
|
}
|
|
8887
8887
|
}(a, r) : function(C, x) {
|
|
8888
8888
|
const A = x._dirtyLeaves, w = x._dirtyElements, E = C._nodeMap, v = Ht(), b = /* @__PURE__ */ new Map();
|
|
8889
|
-
let D = A, k = D.size,
|
|
8889
|
+
let D = A, k = D.size, I = w, B = I.size;
|
|
8890
8890
|
for (; k > 0 || B > 0; ) {
|
|
8891
8891
|
if (k > 0) {
|
|
8892
8892
|
x._dirtyLeaves = /* @__PURE__ */ new Set();
|
|
@@ -8900,13 +8900,13 @@ function da(r, e, t) {
|
|
|
8900
8900
|
}
|
|
8901
8901
|
}
|
|
8902
8902
|
x._dirtyLeaves = /* @__PURE__ */ new Set(), x._dirtyElements = /* @__PURE__ */ new Map();
|
|
8903
|
-
for (const F of
|
|
8903
|
+
for (const F of I) {
|
|
8904
8904
|
const L = F[0], j = F[1];
|
|
8905
8905
|
if (L !== "root" && !j) continue;
|
|
8906
|
-
const
|
|
8907
|
-
|
|
8906
|
+
const O = E.get(L);
|
|
8907
|
+
O !== void 0 && Bo(O, v) && To(x, O, b), w.set(L, j);
|
|
8908
8908
|
}
|
|
8909
|
-
D = x._dirtyLeaves, k = D.size,
|
|
8909
|
+
D = x._dirtyLeaves, k = D.size, I = x._dirtyElements, B = I.size, On++;
|
|
8910
8910
|
}
|
|
8911
8911
|
x._dirtyLeaves = A, x._dirtyElements = w;
|
|
8912
8912
|
}(a, r), Fo(r), function(C, x, A, w) {
|
|
@@ -8922,14 +8922,14 @@ function da(r, e, t) {
|
|
|
8922
8922
|
}
|
|
8923
8923
|
}(l, a, r._dirtyLeaves, r._dirtyElements)), m !== r._compositionKey && (a._flushSync = !0);
|
|
8924
8924
|
const y = a._selection;
|
|
8925
|
-
if (
|
|
8925
|
+
if (M(y)) {
|
|
8926
8926
|
const C = a._nodeMap, x = y.anchor.key, A = y.focus.key;
|
|
8927
8927
|
C.get(x) !== void 0 && C.get(A) !== void 0 || z(19);
|
|
8928
8928
|
} else kt(y) && y._nodes.size === 0 && (a._selection = null);
|
|
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() {
|
|
@@ -9122,7 +9122,7 @@ class zt extends gs {
|
|
|
9122
9122
|
}
|
|
9123
9123
|
getFirstChild() {
|
|
9124
9124
|
const e = this.getLatest().__first;
|
|
9125
|
-
return e === null ? null :
|
|
9125
|
+
return e === null ? null : Ke(e);
|
|
9126
9126
|
}
|
|
9127
9127
|
getFirstChildOrThrow() {
|
|
9128
9128
|
const e = this.getFirstChild();
|
|
@@ -9130,7 +9130,7 @@ class zt extends gs {
|
|
|
9130
9130
|
}
|
|
9131
9131
|
getLastChild() {
|
|
9132
9132
|
const e = this.getLatest().__last;
|
|
9133
|
-
return e === null ? null :
|
|
9133
|
+
return e === null ? null : Ke(e);
|
|
9134
9134
|
}
|
|
9135
9135
|
getLastChildOrThrow() {
|
|
9136
9136
|
const e = this.getLastChild();
|
|
@@ -9196,7 +9196,7 @@ class zt extends gs {
|
|
|
9196
9196
|
}
|
|
9197
9197
|
s === void 0 && (s = i), o === void 0 && (o = i);
|
|
9198
9198
|
const l = this.__key;
|
|
9199
|
-
return
|
|
9199
|
+
return M(n) ? (n.anchor.set(l, s, "element"), n.focus.set(l, o, "element"), n.dirty = !0, n) : ia(l, s, l, o, "element", "element");
|
|
9200
9200
|
}
|
|
9201
9201
|
selectStart() {
|
|
9202
9202
|
const e = this.getFirstDescendant();
|
|
@@ -9269,7 +9269,7 @@ class zt extends gs {
|
|
|
9269
9269
|
}
|
|
9270
9270
|
if (i.__size = f, u.length) {
|
|
9271
9271
|
const g = V();
|
|
9272
|
-
if (
|
|
9272
|
+
if (M(g)) {
|
|
9273
9273
|
const m = new Set(u), y = new Set(a), { anchor: C, focus: x } = g;
|
|
9274
9274
|
Lo(C, m, y) && ts(C, C.getNode(), this, d, c), Lo(x, m, y) && ts(x, x.getNode(), this, d, c), f !== 0 || this.canBeEmpty() || Ft(this) || this.remove();
|
|
9275
9275
|
}
|
|
@@ -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
|
}
|
|
@@ -10059,7 +10059,7 @@ function nd(r) {
|
|
|
10059
10059
|
const [u, c, d, f, h, g] = a;
|
|
10060
10060
|
r.update(() => {
|
|
10061
10061
|
const m = V();
|
|
10062
|
-
if (
|
|
10062
|
+
if (M(m)) {
|
|
10063
10063
|
const y = m.anchor;
|
|
10064
10064
|
let C = y.getNode(), x = 0, A = 0;
|
|
10065
10065
|
if (q(C) && u >= 0 && c >= 0 && (x = u, A = u + c, m.setTextNodeRange(C, x, C, A)), x === A && d === "" || (m.insertRawText(d), C = y.getNode()), q(C)) {
|
|
@@ -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
|
}
|
|
@@ -10190,10 +10190,10 @@ var rs = id(function(r) {
|
|
|
10190
10190
|
throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
10191
10191
|
});
|
|
10192
10192
|
function od(r, e = V()) {
|
|
10193
|
-
return e == null && rs(166),
|
|
10193
|
+
return e == null && rs(166), M(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : wa(r, e);
|
|
10194
10194
|
}
|
|
10195
10195
|
function ld(r, e = V()) {
|
|
10196
|
-
return e == null && rs(166),
|
|
10196
|
+
return e == null && rs(166), M(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(ad(r, e));
|
|
10197
10197
|
}
|
|
10198
10198
|
function Mo(r, e, t) {
|
|
10199
10199
|
const n = r.getData("application/x-lexical-editor");
|
|
@@ -10212,12 +10212,12 @@ function Mo(r, e, t) {
|
|
|
10212
10212
|
} catch {
|
|
10213
10213
|
}
|
|
10214
10214
|
const o = r.getData("text/plain") || r.getData("text/uri-list");
|
|
10215
|
-
if (o != null) if (
|
|
10215
|
+
if (o != null) if (M(e)) {
|
|
10216
10216
|
const i = o.split(/(\r?\n|\t)/);
|
|
10217
10217
|
i[i.length - 1] === "" && i.pop();
|
|
10218
10218
|
for (let l = 0; l < i.length; l++) {
|
|
10219
10219
|
const a = V();
|
|
10220
|
-
if (
|
|
10220
|
+
if (M(a)) {
|
|
10221
10221
|
const u = i[l];
|
|
10222
10222
|
u === `
|
|
10223
10223
|
` || u === `\r
|
|
@@ -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() {
|
|
@@ -10478,7 +10478,7 @@ function jn(r) {
|
|
|
10478
10478
|
}
|
|
10479
10479
|
function Vo(r) {
|
|
10480
10480
|
const e = V();
|
|
10481
|
-
if (!
|
|
10481
|
+
if (!M(e)) return !1;
|
|
10482
10482
|
const t = /* @__PURE__ */ new Set(), n = e.getNodes();
|
|
10483
10483
|
for (let s = 0; s < n.length; s++) {
|
|
10484
10484
|
const o = n[s], i = o.getKey();
|
|
@@ -10500,13 +10500,13 @@ function bd(r) {
|
|
|
10500
10500
|
return !!kt(t) && (t.clear(), !0);
|
|
10501
10501
|
}, 0), r.registerCommand(or, (e) => {
|
|
10502
10502
|
const t = V();
|
|
10503
|
-
return !!
|
|
10503
|
+
return !!M(t) && (t.deleteCharacter(e), !0);
|
|
10504
10504
|
}, ce), r.registerCommand(an, (e) => {
|
|
10505
10505
|
const t = V();
|
|
10506
|
-
return !!
|
|
10506
|
+
return !!M(t) && (t.deleteWord(e), !0);
|
|
10507
10507
|
}, ce), r.registerCommand(un, (e) => {
|
|
10508
10508
|
const t = V();
|
|
10509
|
-
return !!
|
|
10509
|
+
return !!M(t) && (t.deleteLine(e), !0);
|
|
10510
10510
|
}, ce), r.registerCommand(Sr, (e) => {
|
|
10511
10511
|
const t = V();
|
|
10512
10512
|
if (typeof e == "string") t !== null && t.insertText(e);
|
|
@@ -10514,7 +10514,7 @@ function bd(r) {
|
|
|
10514
10514
|
if (t === null) return !1;
|
|
10515
10515
|
const n = e.dataTransfer;
|
|
10516
10516
|
if (n != null) Mo(n, t, r);
|
|
10517
|
-
else if (
|
|
10517
|
+
else if (M(t)) {
|
|
10518
10518
|
const s = e.data;
|
|
10519
10519
|
return s && t.insertText(s), !0;
|
|
10520
10520
|
}
|
|
@@ -10522,13 +10522,13 @@ function bd(r) {
|
|
|
10522
10522
|
return !0;
|
|
10523
10523
|
}, ce), r.registerCommand(Ws, () => {
|
|
10524
10524
|
const e = V();
|
|
10525
|
-
return !!
|
|
10525
|
+
return !!M(e) && (e.removeText(), !0);
|
|
10526
10526
|
}, ce), r.registerCommand(xt, (e) => {
|
|
10527
10527
|
const t = V();
|
|
10528
|
-
return !!
|
|
10528
|
+
return !!M(t) && (t.formatText(e), !0);
|
|
10529
10529
|
}, ce), r.registerCommand(ku, (e) => {
|
|
10530
10530
|
const t = V();
|
|
10531
|
-
if (!
|
|
10531
|
+
if (!M(t) && !kt(t)) return !1;
|
|
10532
10532
|
const n = t.getNodes();
|
|
10533
10533
|
for (const s of n) {
|
|
10534
10534
|
const o = bs(s, (i) => N(i) && !i.isInline());
|
|
@@ -10537,10 +10537,10 @@ function bd(r) {
|
|
|
10537
10537
|
return !0;
|
|
10538
10538
|
}, ce), r.registerCommand(Er, (e) => {
|
|
10539
10539
|
const t = V();
|
|
10540
|
-
return !!
|
|
10540
|
+
return !!M(t) && (t.insertLineBreak(e), !0);
|
|
10541
10541
|
}, ce), r.registerCommand(ln, () => {
|
|
10542
10542
|
const e = V();
|
|
10543
|
-
return !!
|
|
10543
|
+
return !!M(e) && (e.insertParagraph(), !0);
|
|
10544
10544
|
}, ce), r.registerCommand(Eu, () => (oa([vn()]), !0), ce), r.registerCommand(Su, () => Vo((e) => {
|
|
10545
10545
|
const t = e.getIndent();
|
|
10546
10546
|
e.setIndent(t + 1);
|
|
@@ -10552,7 +10552,7 @@ function bd(r) {
|
|
|
10552
10552
|
if (kt(t) && !Ln(e.target)) {
|
|
10553
10553
|
const n = t.getNodes();
|
|
10554
10554
|
if (n.length > 0) return n[0].selectPrevious(), !0;
|
|
10555
|
-
} else if (
|
|
10555
|
+
} else if (M(t)) {
|
|
10556
10556
|
const n = cn(t.focus, !0);
|
|
10557
10557
|
if (!e.shiftKey && me(n) && !n.isIsolated() && !n.isInline()) return n.selectPrevious(), e.preventDefault(), !0;
|
|
10558
10558
|
}
|
|
@@ -10562,10 +10562,10 @@ function bd(r) {
|
|
|
10562
10562
|
if (kt(t)) {
|
|
10563
10563
|
const n = t.getNodes();
|
|
10564
10564
|
if (n.length > 0) return n[0].selectNext(0, 0), !0;
|
|
10565
|
-
} else if (
|
|
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;
|
|
@@ -10577,7 +10577,7 @@ function bd(r) {
|
|
|
10577
10577
|
const n = t.getNodes();
|
|
10578
10578
|
if (n.length > 0) return e.preventDefault(), n[0].selectPrevious(), !0;
|
|
10579
10579
|
}
|
|
10580
|
-
if (!
|
|
10580
|
+
if (!M(t)) return !1;
|
|
10581
10581
|
if (Po(t, !0)) {
|
|
10582
10582
|
const n = e.shiftKey;
|
|
10583
10583
|
return e.preventDefault(), Ro(t, n, !0), !0;
|
|
@@ -10589,22 +10589,22 @@ function bd(r) {
|
|
|
10589
10589
|
const s = t.getNodes();
|
|
10590
10590
|
if (s.length > 0) return e.preventDefault(), s[0].selectNext(0, 0), !0;
|
|
10591
10591
|
}
|
|
10592
|
-
if (!
|
|
10592
|
+
if (!M(t)) return !1;
|
|
10593
10593
|
const n = e.shiftKey;
|
|
10594
10594
|
return !!Po(t, !1) && (e.preventDefault(), Ro(t, n, !1), !0);
|
|
10595
10595
|
}, ce), r.registerCommand(xl, (e) => {
|
|
10596
10596
|
if (Ln(e.target)) return !1;
|
|
10597
10597
|
const t = V();
|
|
10598
|
-
if (!
|
|
10598
|
+
if (!M(t)) return !1;
|
|
10599
10599
|
const { anchor: n } = t, s = n.getNode();
|
|
10600
10600
|
return t.isCollapsed() && n.offset === 0 && !Ye(s) && rd(s).getIndent() > 0 ? (e.preventDefault(), r.dispatchCommand(Qi, void 0)) : (!Uo || navigator.language !== "ko-KR") && (e.preventDefault(), r.dispatchCommand(or, !0));
|
|
10601
10601
|
}, ce), r.registerCommand(_l, (e) => {
|
|
10602
10602
|
if (Ln(e.target)) return !1;
|
|
10603
10603
|
const t = V();
|
|
10604
|
-
return !!
|
|
10604
|
+
return !!M(t) && (e.preventDefault(), r.dispatchCommand(or, !1));
|
|
10605
10605
|
}, ce), r.registerCommand($n, (e) => {
|
|
10606
10606
|
const t = V();
|
|
10607
|
-
if (!
|
|
10607
|
+
if (!M(t)) return !1;
|
|
10608
10608
|
if (e !== null) {
|
|
10609
10609
|
if ((Uo || gd || yd) && pd) return !1;
|
|
10610
10610
|
if (e.preventDefault(), e.shiftKey) return r.dispatchCommand(Er, !1);
|
|
@@ -10612,7 +10612,7 @@ function bd(r) {
|
|
|
10612
10612
|
return r.dispatchCommand(ln, void 0);
|
|
10613
10613
|
}, ce), r.registerCommand(bl, () => {
|
|
10614
10614
|
const e = V();
|
|
10615
|
-
return !!
|
|
10615
|
+
return !!M(e) && (r.blur(), !0);
|
|
10616
10616
|
}, ce), r.registerCommand(vl, (e) => {
|
|
10617
10617
|
const [, t] = jn(e);
|
|
10618
10618
|
if (t.length > 0) {
|
|
@@ -10634,13 +10634,13 @@ function bd(r) {
|
|
|
10634
10634
|
return e.preventDefault(), !0;
|
|
10635
10635
|
}
|
|
10636
10636
|
const n = V();
|
|
10637
|
-
return !!
|
|
10637
|
+
return !!M(n);
|
|
10638
10638
|
}, ce), r.registerCommand(wl, (e) => {
|
|
10639
10639
|
const [t] = jn(e), n = V();
|
|
10640
|
-
return !(t && !
|
|
10640
|
+
return !(t && !M(n));
|
|
10641
10641
|
}, ce), r.registerCommand(Cl, (e) => {
|
|
10642
10642
|
const [t] = jn(e), n = V();
|
|
10643
|
-
if (t && !
|
|
10643
|
+
if (t && !M(n)) return !1;
|
|
10644
10644
|
const s = qo(e.clientX, e.clientY);
|
|
10645
10645
|
if (s !== null) {
|
|
10646
10646
|
const o = Nr(s.node);
|
|
@@ -10650,7 +10650,7 @@ function bd(r) {
|
|
|
10650
10650
|
}, ce), r.registerCommand(Gs, () => (oc(), !0), ce), r.registerCommand(ls, (e) => ($o(r, Qt(e, ClipboardEvent) ? e : null), !0), ce), r.registerCommand(gi, (e) => (async function(t, n) {
|
|
10651
10651
|
await $o(n, Qt(t, ClipboardEvent) ? t : null), n.update(() => {
|
|
10652
10652
|
const s = V();
|
|
10653
|
-
|
|
10653
|
+
M(s) ? s.removeText() : kt(s) && s.getNodes().forEach((o) => o.remove());
|
|
10654
10654
|
});
|
|
10655
10655
|
}(e, r), !0), ce), r.registerCommand(os, (e) => {
|
|
10656
10656
|
const [, t, n] = jn(e);
|
|
@@ -10709,7 +10709,7 @@ const Sa = typeof window < "u" && window.document !== void 0 && window.document.
|
|
|
10709
10709
|
function wd({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaControls: n, ariaDescribedBy: s, ariaErrorMessage: o, ariaExpanded: i, ariaInvalid: l, ariaLabel: a, ariaLabelledBy: u, ariaMultiline: c, ariaOwns: d, ariaRequired: f, autoCapitalize: h, className: g, id: m, role: y = "textbox", spellCheck: C = !0, style: x, tabIndex: A, "data-testid": w, ...E }, v) {
|
|
10710
10710
|
const [b, D] = H(r.isEditable()), k = re((B) => {
|
|
10711
10711
|
B && B.ownerDocument && B.ownerDocument.defaultView ? r.setRootElement(B) : r.setRootElement(null);
|
|
10712
|
-
}, [r]),
|
|
10712
|
+
}, [r]), I = bt(() => /* @__PURE__ */ function(...B) {
|
|
10713
10713
|
return (F) => {
|
|
10714
10714
|
B.forEach((L) => {
|
|
10715
10715
|
typeof L == "function" ? L(F) : L != null && (L.current = F);
|
|
@@ -10718,7 +10718,7 @@ function wd({ editor: r, ariaActiveDescendant: e, ariaAutoComplete: t, ariaContr
|
|
|
10718
10718
|
}(v, k), [k, v]);
|
|
10719
10719
|
return Sa(() => (D(r.isEditable()), r.registerEditableListener((B) => {
|
|
10720
10720
|
D(B);
|
|
10721
|
-
})), [r]), p.jsx("div", { "aria-activedescendant": b ? e : void 0, "aria-autocomplete": b ? t : "none", "aria-controls": b ? n : void 0, "aria-describedby": s, ...o != null ? { "aria-errormessage": o } : {}, "aria-expanded": b && y === "combobox" ? !!i : void 0, ...l != null ? { "aria-invalid": l } : {}, "aria-label": a, "aria-labelledby": u, "aria-multiline": c, "aria-owns": b ? d : void 0, "aria-readonly": !b || void 0, "aria-required": f, autoCapitalize: h, className: g, contentEditable: b, "data-testid": w, id: m, ref:
|
|
10721
|
+
})), [r]), p.jsx("div", { "aria-activedescendant": b ? e : void 0, "aria-autocomplete": b ? t : "none", "aria-controls": b ? n : void 0, "aria-describedby": s, ...o != null ? { "aria-errormessage": o } : {}, "aria-expanded": b && y === "combobox" ? !!i : void 0, ...l != null ? { "aria-invalid": l } : {}, "aria-label": a, "aria-labelledby": u, "aria-multiline": c, "aria-owns": b ? d : void 0, "aria-readonly": !b || void 0, "aria-required": f, autoCapitalize: h, className: g, contentEditable: b, "data-testid": w, id: m, ref: I, role: b ? y : void 0, spellCheck: C, style: x, tabIndex: A, ...E });
|
|
10722
10722
|
}
|
|
10723
10723
|
const Cd = al(wd);
|
|
10724
10724
|
function Ho(r) {
|
|
@@ -10755,7 +10755,7 @@ function Bd(r, e, t, n, s) {
|
|
|
10755
10755
|
if (r === null || t.size === 0 && n.size === 0 && !s) return yt;
|
|
10756
10756
|
const o = e._selection, i = r._selection;
|
|
10757
10757
|
if (s) return Sd;
|
|
10758
|
-
if (!(
|
|
10758
|
+
if (!(M(o) && M(i) && i.isCollapsed() && o.isCollapsed())) return yt;
|
|
10759
10759
|
const l = function(C, x, A) {
|
|
10760
10760
|
const w = C._nodeMap, E = [];
|
|
10761
10761
|
for (const v of x) {
|
|
@@ -10795,7 +10795,7 @@ function Nd(r, e) {
|
|
|
10795
10795
|
const m = o._selection;
|
|
10796
10796
|
return l.size > 0 || a.size > 0 ? g === !1 && d !== yt && d === n && c < t + e && h || l.size === 1 && function(y, C, x) {
|
|
10797
10797
|
const A = C._nodeMap.get(y), w = x._nodeMap.get(y), E = C._selection, v = x._selection;
|
|
10798
|
-
return !(
|
|
10798
|
+
return !(M(E) && M(v) && E.anchor.type === "element" && E.focus.type === "element" && v.anchor.type === "text" && v.focus.type === "text" || !q(A) || !q(w) || A.__parent !== w.__parent) && JSON.stringify(C.read(() => A.exportJSON())) === JSON.stringify(x.read(() => w.exportJSON()));
|
|
10799
10799
|
}(Array.from(l)[0], s, o) ? Pn : ai : m !== null ? Pn : ui;
|
|
10800
10800
|
})();
|
|
10801
10801
|
return t = c, n = d, f;
|
|
@@ -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,20 +10932,20 @@ 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(() => {
|
|
10945
10945
|
const t = V();
|
|
10946
10946
|
if (t !== null) {
|
|
10947
10947
|
const n = t.getNodes();
|
|
10948
|
-
if (
|
|
10948
|
+
if (M(t)) {
|
|
10949
10949
|
const o = t.getStartEndPoints();
|
|
10950
10950
|
o === null && Tt(143);
|
|
10951
10951
|
const [i] = o, l = i.getNode(), a = l.getParent();
|
|
@@ -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; ) {
|
|
@@ -11016,7 +11016,7 @@ function $i(r, e) {
|
|
|
11016
11016
|
function zd(r) {
|
|
11017
11017
|
r.update(() => {
|
|
11018
11018
|
const e = V();
|
|
11019
|
-
if (
|
|
11019
|
+
if (M(e)) {
|
|
11020
11020
|
const t = /* @__PURE__ */ new Set(), n = e.getNodes(), s = e.anchor.getNode();
|
|
11021
11021
|
if (Ta(s, n)) t.add(di(s));
|
|
11022
11022
|
else for (let o = 0; o < n.length; o++) {
|
|
@@ -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();
|
|
@@ -11080,16 +11080,16 @@ function Ud(r) {
|
|
|
11080
11080
|
}
|
|
11081
11081
|
function Wd() {
|
|
11082
11082
|
const r = V();
|
|
11083
|
-
if (!
|
|
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,16 +11252,16 @@ 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
|
-
if (!
|
|
11264
|
+
if (!M(t)) return !1;
|
|
11265
11265
|
const n = t.anchor.getNode(), s = t.focus.getNode();
|
|
11266
11266
|
return this.isParentOf(n) && this.isParentOf(s) && this.getTextContent().length === t.getTextContent().length;
|
|
11267
11267
|
}
|
|
@@ -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) => {
|
|
@@ -11537,7 +11537,7 @@ class mr extends zt {
|
|
|
11537
11537
|
return !0;
|
|
11538
11538
|
}
|
|
11539
11539
|
extractWithChild(e, t, n) {
|
|
11540
|
-
if (!
|
|
11540
|
+
if (!M(t)) return !1;
|
|
11541
11541
|
const s = t.anchor.getNode(), o = t.focus.getNode();
|
|
11542
11542
|
return this.isParentOf(s) && this.isParentOf(o) && t.getTextContent().length > 0;
|
|
11543
11543
|
}
|
|
@@ -11613,7 +11613,7 @@ function Zd(r) {
|
|
|
11613
11613
|
const ll = pn();
|
|
11614
11614
|
function zs(r, e = {}) {
|
|
11615
11615
|
const { target: t, title: n } = e, s = e.rel === void 0 ? "noreferrer" : e.rel, o = V();
|
|
11616
|
-
if (!
|
|
11616
|
+
if (!M(o)) return;
|
|
11617
11617
|
const i = o.extract();
|
|
11618
11618
|
if (r === null) i.forEach((l) => {
|
|
11619
11619
|
const a = bs(l, (u) => !Zd(u) && Vr(u));
|
|
@@ -11662,7 +11662,7 @@ function ef({ validateUrl: r, attributes: e }) {
|
|
|
11662
11662
|
}
|
|
11663
11663
|
}, Ar), r !== void 0 ? t.registerCommand(os, (n) => {
|
|
11664
11664
|
const s = V();
|
|
11665
|
-
if (!
|
|
11665
|
+
if (!M(s) || s.isCollapsed() || !Qt(n, ClipboardEvent)) return !1;
|
|
11666
11666
|
const o = n;
|
|
11667
11667
|
if (o.clipboardData === null) return !1;
|
|
11668
11668
|
const i = o.clipboardData.getData("text");
|
|
@@ -11714,7 +11714,7 @@ function nf({ theme: r, disabled: e, onAiRestructure: t, onAiProofread: n, onAiR
|
|
|
11714
11714
|
}, [u]), A = re(() => {
|
|
11715
11715
|
u.update(() => {
|
|
11716
11716
|
const b = V();
|
|
11717
|
-
|
|
11717
|
+
M(b) && Jc(b, () => Ii());
|
|
11718
11718
|
});
|
|
11719
11719
|
}, [u]), w = {
|
|
11720
11720
|
display: "flex",
|
|
@@ -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();
|
|
@@ -12037,16 +12037,16 @@ function of({ text: r, trigger: e }) {
|
|
|
12037
12037
|
const s = r.trim();
|
|
12038
12038
|
s && (t.update(() => {
|
|
12039
12039
|
const o = V();
|
|
12040
|
-
if (
|
|
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
|
}
|
|
@@ -12128,26 +12128,26 @@ function af({
|
|
|
12128
12128
|
aiProcessingAction: m,
|
|
12129
12129
|
renderAboveToolbar: y
|
|
12130
12130
|
}) {
|
|
12131
|
-
const C = { ...tf, ...s }, [x, A] = Je.useState(!1), w = Je.useRef(void 0), [E, v] = Je.useState(r), [b, D] = Je.useState(!1), [k,
|
|
12131
|
+
const C = { ...tf, ...s }, [x, A] = Je.useState(!1), w = Je.useRef(void 0), [E, v] = Je.useState(r), [b, D] = Je.useState(!1), [k, I] = Je.useState(null), B = g ?? b, F = m ?? k;
|
|
12132
12132
|
Je.useEffect(() => {
|
|
12133
12133
|
a !== void 0 && a !== w.current && (w.current = a, A(!0));
|
|
12134
12134
|
}, [a]);
|
|
12135
12135
|
const L = re(() => {
|
|
12136
12136
|
A(!1);
|
|
12137
|
-
}, []), j = (pe) => pe.replace(/<[^>]*>/g, "").trim(),
|
|
12138
|
-
`).map((we) => `<p>${we || "<br>"}</p>`).join(""),
|
|
12137
|
+
}, []), j = (pe) => pe.replace(/<[^>]*>/g, "").trim(), O = (pe) => pe.split(`
|
|
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 (
|
|
12143
|
-
D(!0),
|
|
12141
|
+
const ke = pe === "restructure" ? d : pe === "proofread" ? f : h;
|
|
12142
|
+
if (ke) {
|
|
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
|
-
D(!1),
|
|
12150
|
+
D(!1), I(null);
|
|
12151
12151
|
}
|
|
12152
12152
|
}
|
|
12153
12153
|
}, de = j(E).length > 0, ie = {
|
|
@@ -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]
|
|
@@ -12265,7 +12265,7 @@ function af({
|
|
|
12265
12265
|
onAiRewrite: h,
|
|
12266
12266
|
aiProcessing: B,
|
|
12267
12267
|
aiProcessingAction: F,
|
|
12268
|
-
onAiAction:
|
|
12268
|
+
onAiAction: X,
|
|
12269
12269
|
hasContent: de
|
|
12270
12270
|
}
|
|
12271
12271
|
),
|
|
@@ -12359,24 +12359,32 @@ function Sf({
|
|
|
12359
12359
|
onAiRewrite: w,
|
|
12360
12360
|
renderAboveToolbar: E
|
|
12361
12361
|
}) {
|
|
12362
|
-
const v = { ...uf, ...c }, [b, D] = H(r), [k,
|
|
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
|
-
l !== void 0 && l !==
|
|
12364
|
+
l !== void 0 && l !== Ve.current && (Ve.current = l, X(t), Ce(!0));
|
|
12365
12365
|
}, [l, t]);
|
|
12366
|
-
const
|
|
12367
|
-
|
|
12368
|
-
}, ge =
|
|
12369
|
-
const
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
|
|
12373
|
-
|
|
12374
|
-
|
|
12375
|
-
},
|
|
12376
|
-
|
|
12377
|
-
},
|
|
12378
|
-
|
|
12379
|
-
},
|
|
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
|
+
}
|
|
12374
|
+
ge.current && (ge.current.value = "");
|
|
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 () => {
|
|
12380
12388
|
if (!b.trim()) {
|
|
12381
12389
|
we("Recipient email is required");
|
|
12382
12390
|
return;
|
|
@@ -12387,35 +12395,33 @@ function Sf({
|
|
|
12387
12395
|
}
|
|
12388
12396
|
ve(!0), we("");
|
|
12389
12397
|
try {
|
|
12390
|
-
const
|
|
12391
|
-
de.map(async (
|
|
12392
|
-
const T = await
|
|
12398
|
+
const U = await Promise.all(
|
|
12399
|
+
de.map(async (R) => {
|
|
12400
|
+
const T = await R.arrayBuffer(), Q = btoa(
|
|
12393
12401
|
new Uint8Array(T).reduce((J, S) => J + String.fromCharCode(S), "")
|
|
12394
12402
|
);
|
|
12395
12403
|
return {
|
|
12396
|
-
filename:
|
|
12397
|
-
content_type:
|
|
12398
|
-
data:
|
|
12399
|
-
size:
|
|
12404
|
+
filename: R.name,
|
|
12405
|
+
content_type: R.type || "application/octet-stream",
|
|
12406
|
+
data: Q,
|
|
12407
|
+
size: R.size
|
|
12400
12408
|
};
|
|
12401
12409
|
})
|
|
12402
|
-
),
|
|
12410
|
+
), ye = O.replace(/>\n+</g, "><").replace(/<p class="[^"]*"><\/p>/g, "<br>").trim(), Ae = {
|
|
12403
12411
|
to: b.trim(),
|
|
12404
12412
|
cc: k.trim() || void 0,
|
|
12405
12413
|
bcc: B.trim() || void 0,
|
|
12406
12414
|
subject: L.trim(),
|
|
12407
|
-
html:
|
|
12408
|
-
attachments:
|
|
12415
|
+
html: ye,
|
|
12416
|
+
attachments: U,
|
|
12409
12417
|
inReplyTo: n == null ? void 0 : n.messageId
|
|
12410
12418
|
};
|
|
12411
|
-
console.log("[MailComposer] Sending email:", {
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
} catch (W) {
|
|
12418
|
-
we(W instanceof Error ? W.message : "Failed to send email");
|
|
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) => {
|
|
12420
|
+
var Q;
|
|
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);
|
|
12422
|
+
}), await s(Ae), D(""), I(""), F(""), j(""), X(""), ie([]);
|
|
12423
|
+
} catch (U) {
|
|
12424
|
+
we(U instanceof Error ? U.message : "Failed to send email");
|
|
12419
12425
|
} finally {
|
|
12420
12426
|
ve(!1);
|
|
12421
12427
|
}
|
|
@@ -12435,16 +12441,16 @@ function Sf({
|
|
|
12435
12441
|
color: v.textSecondary,
|
|
12436
12442
|
marginBottom: "4px",
|
|
12437
12443
|
textTransform: "uppercase"
|
|
12438
|
-
}, At = (
|
|
12444
|
+
}, At = (U, ye = !1) => ({
|
|
12439
12445
|
padding: "10px 20px",
|
|
12440
12446
|
fontSize: "14px",
|
|
12441
12447
|
fontWeight: 500,
|
|
12442
12448
|
border: "none",
|
|
12443
12449
|
borderRadius: "6px",
|
|
12444
|
-
cursor:
|
|
12445
|
-
opacity:
|
|
12446
|
-
background:
|
|
12447
|
-
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,
|
|
12448
12454
|
display: "flex",
|
|
12449
12455
|
alignItems: "center",
|
|
12450
12456
|
gap: "8px"
|
|
@@ -12482,18 +12488,18 @@ function Sf({
|
|
|
12482
12488
|
{
|
|
12483
12489
|
type: "email",
|
|
12484
12490
|
value: b,
|
|
12485
|
-
onChange: (
|
|
12491
|
+
onChange: (U) => D(U.target.value),
|
|
12486
12492
|
placeholder: "recipient@example.com",
|
|
12487
12493
|
disabled: d || oe,
|
|
12488
12494
|
style: ft
|
|
12489
12495
|
}
|
|
12490
12496
|
)
|
|
12491
12497
|
] }),
|
|
12492
|
-
!
|
|
12498
|
+
!ke && /* @__PURE__ */ p.jsx(
|
|
12493
12499
|
"button",
|
|
12494
12500
|
{
|
|
12495
12501
|
type: "button",
|
|
12496
|
-
onClick: () =>
|
|
12502
|
+
onClick: () => Me(!0),
|
|
12497
12503
|
disabled: d || oe,
|
|
12498
12504
|
style: {
|
|
12499
12505
|
background: "none",
|
|
@@ -12507,7 +12513,7 @@ function Sf({
|
|
|
12507
12513
|
children: "+ Add CC/BCC"
|
|
12508
12514
|
}
|
|
12509
12515
|
),
|
|
12510
|
-
|
|
12516
|
+
ke && /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
12511
12517
|
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
12512
12518
|
/* @__PURE__ */ p.jsx("label", { style: ht, children: "CC" }),
|
|
12513
12519
|
/* @__PURE__ */ p.jsx(
|
|
@@ -12515,7 +12521,7 @@ function Sf({
|
|
|
12515
12521
|
{
|
|
12516
12522
|
type: "email",
|
|
12517
12523
|
value: k,
|
|
12518
|
-
onChange: (
|
|
12524
|
+
onChange: (U) => I(U.target.value),
|
|
12519
12525
|
placeholder: "cc@example.com",
|
|
12520
12526
|
disabled: d || oe,
|
|
12521
12527
|
style: ft
|
|
@@ -12529,7 +12535,7 @@ function Sf({
|
|
|
12529
12535
|
{
|
|
12530
12536
|
type: "email",
|
|
12531
12537
|
value: B,
|
|
12532
|
-
onChange: (
|
|
12538
|
+
onChange: (U) => F(U.target.value),
|
|
12533
12539
|
placeholder: "bcc@example.com",
|
|
12534
12540
|
disabled: d || oe,
|
|
12535
12541
|
style: ft
|
|
@@ -12544,7 +12550,7 @@ function Sf({
|
|
|
12544
12550
|
{
|
|
12545
12551
|
type: "text",
|
|
12546
12552
|
value: L,
|
|
12547
|
-
onChange: (
|
|
12553
|
+
onChange: (U) => j(U.target.value),
|
|
12548
12554
|
placeholder: "Email subject",
|
|
12549
12555
|
disabled: d || oe,
|
|
12550
12556
|
style: ft
|
|
@@ -12554,14 +12560,14 @@ function Sf({
|
|
|
12554
12560
|
/* @__PURE__ */ p.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ p.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ p.jsx(
|
|
12555
12561
|
af,
|
|
12556
12562
|
{
|
|
12557
|
-
value:
|
|
12558
|
-
onChange:
|
|
12563
|
+
value: O,
|
|
12564
|
+
onChange: qe,
|
|
12559
12565
|
placeholder: h,
|
|
12560
12566
|
replyTo: n,
|
|
12561
12567
|
theme: v,
|
|
12562
12568
|
disabled: d || oe,
|
|
12563
12569
|
minHeight: m,
|
|
12564
|
-
externalUpdate:
|
|
12570
|
+
externalUpdate: Te ? l : void 0,
|
|
12565
12571
|
insertText: a,
|
|
12566
12572
|
insertTextTrigger: u,
|
|
12567
12573
|
onAiRestructure: x,
|
|
@@ -12586,8 +12592,8 @@ function Sf({
|
|
|
12586
12592
|
"div",
|
|
12587
12593
|
{
|
|
12588
12594
|
onClick: () => {
|
|
12589
|
-
var
|
|
12590
|
-
return (
|
|
12595
|
+
var U;
|
|
12596
|
+
return (U = ge.current) == null ? void 0 : U.click();
|
|
12591
12597
|
},
|
|
12592
12598
|
onDragOver: qt,
|
|
12593
12599
|
onDragLeave: it,
|
|
@@ -12595,10 +12601,10 @@ function Sf({
|
|
|
12595
12601
|
style: {
|
|
12596
12602
|
width: "100%",
|
|
12597
12603
|
padding: "24px 16px",
|
|
12598
|
-
border: `2px dashed ${
|
|
12604
|
+
border: `2px dashed ${Ie ? v.primary : v.border}`,
|
|
12599
12605
|
borderRadius: "8px",
|
|
12600
|
-
background:
|
|
12601
|
-
color:
|
|
12606
|
+
background: Ie ? `${v.primary}10` : "transparent",
|
|
12607
|
+
color: Ie ? v.primary : v.textSecondary,
|
|
12602
12608
|
cursor: d || oe ? "not-allowed" : "pointer",
|
|
12603
12609
|
display: "flex",
|
|
12604
12610
|
flexDirection: "column",
|
|
@@ -12609,12 +12615,12 @@ function Sf({
|
|
|
12609
12615
|
marginBottom: de.length > 0 ? "12px" : 0
|
|
12610
12616
|
},
|
|
12611
12617
|
children: [
|
|
12612
|
-
/* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "24px" }, children:
|
|
12613
|
-
/* @__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" })
|
|
12614
12620
|
]
|
|
12615
12621
|
}
|
|
12616
12622
|
),
|
|
12617
|
-
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(
|
|
12618
12624
|
"div",
|
|
12619
12625
|
{
|
|
12620
12626
|
style: {
|
|
@@ -12626,16 +12632,16 @@ function Sf({
|
|
|
12626
12632
|
borderRadius: "8px"
|
|
12627
12633
|
},
|
|
12628
12634
|
children: [
|
|
12629
|
-
/* @__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) }),
|
|
12630
12636
|
/* @__PURE__ */ p.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
12631
|
-
/* @__PURE__ */ p.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color: v.text, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children:
|
|
12632
|
-
/* @__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) })
|
|
12633
12639
|
] }),
|
|
12634
12640
|
/* @__PURE__ */ p.jsx(
|
|
12635
12641
|
"button",
|
|
12636
12642
|
{
|
|
12637
12643
|
type: "button",
|
|
12638
|
-
onClick: () => Ut(
|
|
12644
|
+
onClick: () => Ut(ye),
|
|
12639
12645
|
disabled: d || oe,
|
|
12640
12646
|
style: {
|
|
12641
12647
|
background: "none",
|
|
@@ -12651,7 +12657,7 @@ function Sf({
|
|
|
12651
12657
|
)
|
|
12652
12658
|
]
|
|
12653
12659
|
},
|
|
12654
|
-
`${
|
|
12660
|
+
`${U.name}-${ye}`
|
|
12655
12661
|
)) })
|
|
12656
12662
|
] }),
|
|
12657
12663
|
/* @__PURE__ */ p.jsxs("div", { style: { display: "flex", justifyContent: "flex-end", gap: "12px" }, children: [
|
|
@@ -12724,7 +12730,7 @@ function kf({
|
|
|
12724
12730
|
theme: d = {},
|
|
12725
12731
|
className: f = ""
|
|
12726
12732
|
}) {
|
|
12727
|
-
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);
|
|
12728
12734
|
De(() => {
|
|
12729
12735
|
function B(F) {
|
|
12730
12736
|
x.current && !x.current.contains(F.target) && (m(!1), C(""));
|
|
@@ -12748,7 +12754,7 @@ function kf({
|
|
|
12748
12754
|
if (!E) return;
|
|
12749
12755
|
const B = await (o == null ? void 0 : o(y.trim()));
|
|
12750
12756
|
B && b(B.id), C("");
|
|
12751
|
-
}, [E, y, o, b]),
|
|
12757
|
+
}, [E, y, o, b]), I = re((B) => {
|
|
12752
12758
|
B.key === "Enter" ? (B.preventDefault(), E ? k() : w.length > 0 && b(w[0].id)) : B.key === "Backspace" && !y && e.length > 0 ? D(e[e.length - 1]) : B.key === "Escape" && (m(!1), C(""));
|
|
12753
12759
|
}, [E, w, y, e, k, b, D]);
|
|
12754
12760
|
return /* @__PURE__ */ p.jsxs("div", { ref: x, className: f, style: { position: "relative" }, children: [
|
|
@@ -12830,7 +12836,7 @@ function kf({
|
|
|
12830
12836
|
C(B.target.value), g || m(!0);
|
|
12831
12837
|
},
|
|
12832
12838
|
onFocus: () => m(!0),
|
|
12833
|
-
onKeyDown:
|
|
12839
|
+
onKeyDown: I,
|
|
12834
12840
|
placeholder: v.length === 0 ? n : "",
|
|
12835
12841
|
disabled: u || c > 0 && e.length >= c,
|
|
12836
12842
|
style: {
|
|
@@ -12971,14 +12977,14 @@ function Tf({
|
|
|
12971
12977
|
columnClassName: f = "",
|
|
12972
12978
|
itemClassName: h = ""
|
|
12973
12979
|
}) {
|
|
12974
|
-
const [g, m] = H(null), [y, C] = H(null), [x, A] = H(null), w =
|
|
12975
|
-
let j = r.filter((
|
|
12976
|
-
return s && (j = j.sort((
|
|
12980
|
+
const [g, m] = H(null), [y, C] = H(null), [x, A] = H(null), w = be(null), E = e.reduce((F, L) => {
|
|
12981
|
+
let j = r.filter((O) => n(O) === L.id);
|
|
12982
|
+
return s && (j = j.sort((O, X) => s(O) - s(X))), F[L.id] = j, F;
|
|
12977
12983
|
}, {}), v = re((F, L) => {
|
|
12978
|
-
const j = t(L),
|
|
12979
|
-
m(j), w.current =
|
|
12980
|
-
const
|
|
12981
|
-
|
|
12984
|
+
const j = t(L), O = n(L);
|
|
12985
|
+
m(j), w.current = O, F.dataTransfer.effectAllowed = "move", F.dataTransfer.setData("text/plain", j), requestAnimationFrame(() => {
|
|
12986
|
+
const X = F.target;
|
|
12987
|
+
X.style.opacity = "0.5";
|
|
12982
12988
|
});
|
|
12983
12989
|
}, [t, n]), b = re((F) => {
|
|
12984
12990
|
const L = F.target;
|
|
@@ -12988,10 +12994,10 @@ function Tf({
|
|
|
12988
12994
|
}, []), k = re((F) => {
|
|
12989
12995
|
const L = F.relatedTarget;
|
|
12990
12996
|
L != null && L.closest("[data-kanban-column]") || (C(null), A(null));
|
|
12991
|
-
}, []),
|
|
12997
|
+
}, []), I = re((F, L, j) => {
|
|
12992
12998
|
if (F.preventDefault(), !g) return;
|
|
12993
|
-
const
|
|
12994
|
-
|
|
12999
|
+
const O = w.current;
|
|
13000
|
+
O === L ? l == null || l(g, L, j) : O && i(g, O, L, j), m(null), C(null), A(null), w.current = null;
|
|
12995
13001
|
}, [g, i, l]), B = (F, L) => /* @__PURE__ */ p.jsxs("div", { className: "flex items-center justify-between px-3 py-2", children: [
|
|
12996
13002
|
/* @__PURE__ */ p.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
12997
13003
|
F.color && /* @__PURE__ */ p.jsx(
|
|
@@ -13017,11 +13023,11 @@ function Tf({
|
|
|
13017
13023
|
{
|
|
13018
13024
|
"data-kanban-column": F.id,
|
|
13019
13025
|
className: `flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,
|
|
13020
|
-
onDragOver: (
|
|
13021
|
-
|
|
13026
|
+
onDragOver: (O) => {
|
|
13027
|
+
O.preventDefault(), g && !j && C(F.id);
|
|
13022
13028
|
},
|
|
13023
13029
|
onDragLeave: k,
|
|
13024
|
-
onDrop: (
|
|
13030
|
+
onDrop: (O) => I(O, F.id, x ?? L.length),
|
|
13025
13031
|
children: [
|
|
13026
13032
|
/* @__PURE__ */ p.jsx("div", { className: "flex-shrink-0 border-b border-neutral-200", children: u ? u(F, L.length) : B(F, L.length) }),
|
|
13027
13033
|
/* @__PURE__ */ p.jsxs(
|
|
@@ -13029,20 +13035,20 @@ function Tf({
|
|
|
13029
13035
|
{
|
|
13030
13036
|
className: `flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${j ? "bg-blue-50" : ""}`,
|
|
13031
13037
|
children: [
|
|
13032
|
-
L.map((
|
|
13033
|
-
const de = t(
|
|
13038
|
+
L.map((O, X) => {
|
|
13039
|
+
const de = t(O), ie = g === de, oe = j && x === X && !ie;
|
|
13034
13040
|
return /* @__PURE__ */ p.jsxs("div", { children: [
|
|
13035
13041
|
oe && /* @__PURE__ */ p.jsx("div", { className: "h-1 bg-blue-500 rounded-full mb-2 mx-1" }),
|
|
13036
13042
|
/* @__PURE__ */ p.jsx(
|
|
13037
13043
|
"div",
|
|
13038
13044
|
{
|
|
13039
13045
|
draggable: !0,
|
|
13040
|
-
onDragStart: (ve) => v(ve,
|
|
13046
|
+
onDragStart: (ve) => v(ve, O),
|
|
13041
13047
|
onDragEnd: b,
|
|
13042
|
-
onDragOver: (ve) => D(ve, F.id,
|
|
13043
|
-
onClick: () => a == null ? void 0 : a(
|
|
13048
|
+
onDragOver: (ve) => D(ve, F.id, X),
|
|
13049
|
+
onClick: () => a == null ? void 0 : a(O),
|
|
13044
13050
|
className: `cursor-grab active:cursor-grabbing transition-all ${ie ? "opacity-50 scale-95" : ""} ${h}`,
|
|
13045
|
-
children: o(
|
|
13051
|
+
children: o(O, ie)
|
|
13046
13052
|
}
|
|
13047
13053
|
)
|
|
13048
13054
|
] }, de);
|
|
@@ -13051,8 +13057,8 @@ function Tf({
|
|
|
13051
13057
|
"div",
|
|
13052
13058
|
{
|
|
13053
13059
|
className: "min-h-[40px] flex-1",
|
|
13054
|
-
onDragOver: (
|
|
13055
|
-
|
|
13060
|
+
onDragOver: (O) => {
|
|
13061
|
+
O.preventDefault(), D(O, F.id, L.length);
|
|
13056
13062
|
},
|
|
13057
13063
|
children: j && x === L.length && /* @__PURE__ */ p.jsx("div", { className: "h-1 bg-blue-500 rounded-full mx-1 mt-1" })
|
|
13058
13064
|
}
|
|
@@ -13127,8 +13133,8 @@ function Bf({
|
|
|
13127
13133
|
if (!D) return null;
|
|
13128
13134
|
const k = ff(D);
|
|
13129
13135
|
if (!k) return null;
|
|
13130
|
-
const { hours:
|
|
13131
|
-
return { top: j, height:
|
|
13136
|
+
const { hours: I, minutes: B } = k, F = Math.max(t, Math.min(n, I)), L = I < t ? 0 : B, j = (F - t) * s + L / 60 * s, O = i(b), X = Math.max(20, O / 60 * s);
|
|
13137
|
+
return { top: j, height: X };
|
|
13132
13138
|
},
|
|
13133
13139
|
[o, i, t, n, s]
|
|
13134
13140
|
), E = bt(() => {
|
|
@@ -13138,8 +13144,8 @@ function Bf({
|
|
|
13138
13144
|
}, [e, f, t, n, s]), v = re(
|
|
13139
13145
|
(b) => {
|
|
13140
13146
|
if (!d) return;
|
|
13141
|
-
const D = b.currentTarget.getBoundingClientRect(),
|
|
13142
|
-
d(
|
|
13147
|
+
const D = b.currentTarget.getBoundingClientRect(), I = (b.clientY - D.top) / s * 60, B = Math.floor(I / 60) + t, F = Math.round(I % 60 / 15) * 15, L = Math.min(n, Math.max(t, B)), j = F >= 60 ? 0 : F, O = `${L.toString().padStart(2, "0")}:${j.toString().padStart(2, "0")}`;
|
|
13148
|
+
d(O);
|
|
13143
13149
|
},
|
|
13144
13150
|
[d, s, t, n]
|
|
13145
13151
|
);
|
|
@@ -13302,202 +13308,202 @@ function Bf({
|
|
|
13302
13308
|
] });
|
|
13303
13309
|
}
|
|
13304
13310
|
function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, variant: s = "widget", hideSaveButton: o = !1 }) {
|
|
13305
|
-
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 =
|
|
13306
|
-
const T = Math.floor(
|
|
13307
|
-
return `${T.toString().padStart(2, "0")}:${
|
|
13308
|
-
}, ge = async (
|
|
13309
|
-
const T = await
|
|
13310
|
-
return await
|
|
13311
|
-
},
|
|
13312
|
-
const T =
|
|
13313
|
-
for (let
|
|
13314
|
-
ne.setUint8(
|
|
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) => {
|
|
13312
|
+
const T = Math.floor(R / 60), Q = Math.floor(R % 60);
|
|
13313
|
+
return `${T.toString().padStart(2, "0")}:${Q.toString().padStart(2, "0")}`;
|
|
13314
|
+
}, ge = async (R) => {
|
|
13315
|
+
const T = await R.arrayBuffer(), Q = new AudioContext(), J = await Q.decodeAudioData(T);
|
|
13316
|
+
return await Q.close(), J;
|
|
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) => {
|
|
13319
|
+
for (let Ue = 0; Ue < fe.length; Ue++)
|
|
13320
|
+
ne.setUint8(xe + Ue, fe.charCodeAt(Ue));
|
|
13315
13321
|
};
|
|
13316
|
-
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,
|
|
13317
|
-
const
|
|
13318
|
-
for (let
|
|
13319
|
-
|
|
13320
|
-
let
|
|
13321
|
-
for (let
|
|
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);
|
|
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++)
|
|
13322
13328
|
for (let fe = 0; fe < T; fe++) {
|
|
13323
|
-
const
|
|
13324
|
-
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;
|
|
13325
13331
|
}
|
|
13326
13332
|
return new Blob([ae], { type: "audio/wav" });
|
|
13327
|
-
}, ct = async (
|
|
13328
|
-
const S = new AudioContext(), $ =
|
|
13333
|
+
}, ct = async (R, T, Q, J) => {
|
|
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, $);
|
|
13329
13335
|
for (let te = 0; te < K; te++) {
|
|
13330
|
-
const
|
|
13331
|
-
for (let fe = 0; fe <
|
|
13332
|
-
|
|
13333
|
-
const
|
|
13336
|
+
const Ee = ne.getChannelData(te), je = te < R.numberOfChannels ? R.getChannelData(te) : R.getChannelData(0);
|
|
13337
|
+
for (let fe = 0; fe < Y; fe++)
|
|
13338
|
+
Ee[fe] = je[fe];
|
|
13339
|
+
const xe = te < T.numberOfChannels ? T.getChannelData(te) : T.getChannelData(0);
|
|
13334
13340
|
for (let fe = 0; fe < T.length; fe++)
|
|
13335
|
-
|
|
13341
|
+
Ee[Y + fe] = xe[fe];
|
|
13336
13342
|
if (J === "insert")
|
|
13337
13343
|
for (let fe = 0; fe < ee; fe++)
|
|
13338
|
-
|
|
13344
|
+
Ee[Y + T.length + fe] = je[Q + fe];
|
|
13339
13345
|
}
|
|
13340
13346
|
return await S.close(), ne;
|
|
13341
13347
|
}, Ct = re(() => {
|
|
13342
|
-
const
|
|
13343
|
-
if (!
|
|
13344
|
-
const T =
|
|
13348
|
+
const R = b.current;
|
|
13349
|
+
if (!R) return;
|
|
13350
|
+
const T = R.getContext("2d");
|
|
13345
13351
|
if (!T) return;
|
|
13346
|
-
const
|
|
13352
|
+
const Q = R.getBoundingClientRect(), J = Q.width, S = Q.height, $ = ie.current, K = d || u || 1, Y = l === "recording" ? u : m;
|
|
13347
13353
|
T.fillStyle = "#2d3b35", T.fillRect(0, 0, J, S);
|
|
13348
13354
|
const ee = 8, ae = "rgba(0, 0, 0, 0.4)", ne = T.createLinearGradient(0, 0, 0, ee);
|
|
13349
13355
|
ne.addColorStop(0, ae), ne.addColorStop(1, "transparent"), T.fillStyle = ne, T.fillRect(0, 0, J, ee);
|
|
13350
13356
|
const te = T.createLinearGradient(0, S - ee, 0, S);
|
|
13351
13357
|
te.addColorStop(0, "transparent"), te.addColorStop(1, ae), T.fillStyle = te, T.fillRect(0, S - ee, J, ee);
|
|
13352
|
-
const
|
|
13353
|
-
|
|
13354
|
-
const
|
|
13355
|
-
|
|
13356
|
-
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;
|
|
13357
13363
|
if ($.length > 0)
|
|
13358
13364
|
if (l === "recording")
|
|
13359
|
-
for (let
|
|
13360
|
-
const lt = $.length - 1 -
|
|
13365
|
+
for (let We = 0; We < $.length; We++) {
|
|
13366
|
+
const lt = $.length - 1 - We, Et = xe - lt * 4;
|
|
13361
13367
|
if (Et < -3 || Et > J) continue;
|
|
13362
|
-
const pt = $[
|
|
13368
|
+
const pt = $[We] * (S / 2 - 12), Pt = S / 2 - pt;
|
|
13363
13369
|
T.fillStyle = "#10b981", T.fillRect(Et, Pt, 3, pt * 2);
|
|
13364
13370
|
}
|
|
13365
13371
|
else {
|
|
13366
|
-
const
|
|
13372
|
+
const We = K > 0 ? Y / K * $.length : 0;
|
|
13367
13373
|
for (let lt = 0; lt < $.length; lt++) {
|
|
13368
|
-
const Et =
|
|
13374
|
+
const Et = We - lt, pt = xe - Et * 4;
|
|
13369
13375
|
if (pt < -3 || pt > J) continue;
|
|
13370
13376
|
const Pt = $[lt] * (S / 2 - 12), yr = S / 2 - Pt;
|
|
13371
|
-
T.fillStyle = lt <=
|
|
13377
|
+
T.fillStyle = lt <= We ? "#10b981" : "#4b5563", T.fillRect(pt, yr, 3, Pt * 2);
|
|
13372
13378
|
}
|
|
13373
13379
|
}
|
|
13374
|
-
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";
|
|
13375
13381
|
}, [l, m, u, d]), qt = () => {
|
|
13376
|
-
const
|
|
13377
|
-
if (!
|
|
13378
|
-
const T =
|
|
13379
|
-
|
|
13382
|
+
const R = B.current;
|
|
13383
|
+
if (!R || !de.current) return;
|
|
13384
|
+
const T = R.frequencyBinCount, Q = new Uint8Array(T);
|
|
13385
|
+
R.getByteTimeDomainData(Q);
|
|
13380
13386
|
let J = 0;
|
|
13381
13387
|
for (let K = 0; K < T; K++) {
|
|
13382
|
-
const
|
|
13383
|
-
J +=
|
|
13388
|
+
const Y = (Q[K] - 128) / 128;
|
|
13389
|
+
J += Y * Y;
|
|
13384
13390
|
}
|
|
13385
13391
|
const S = Math.sqrt(J / T), $ = Math.min(1, S * 3);
|
|
13386
13392
|
ie.current.push($), Ct(), de.current && (j.current = requestAnimationFrame(qt));
|
|
13387
13393
|
}, it = async () => {
|
|
13388
13394
|
try {
|
|
13389
13395
|
x(null), w(!1), oe.current === null && (ie.current = []);
|
|
13390
|
-
const
|
|
13391
|
-
k.current =
|
|
13396
|
+
const R = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
13397
|
+
k.current = R;
|
|
13392
13398
|
const T = new AudioContext();
|
|
13393
|
-
|
|
13394
|
-
const
|
|
13395
|
-
|
|
13396
|
-
const S = new MediaRecorder(
|
|
13399
|
+
I.current = T;
|
|
13400
|
+
const Q = T.createAnalyser();
|
|
13401
|
+
Q.fftSize = 2048, B.current = Q, T.createMediaStreamSource(R).connect(Q);
|
|
13402
|
+
const S = new MediaRecorder(R);
|
|
13397
13403
|
D.current = S, F.current = [], S.ondataavailable = ($) => {
|
|
13398
13404
|
$.data.size > 0 && F.current.push($.data);
|
|
13399
13405
|
}, S.onstop = async () => {
|
|
13400
13406
|
try {
|
|
13401
13407
|
if (de.current = !1, F.current.length === 0) {
|
|
13402
|
-
x("No audio was recorded. Please try again."), a("idle"),
|
|
13408
|
+
x("No audio was recorded. Please try again."), a("idle"), R.getTracks().forEach((ne) => ne.stop());
|
|
13403
13409
|
return;
|
|
13404
13410
|
}
|
|
13405
13411
|
const $ = new Blob(F.current, { type: "audio/webm" });
|
|
13406
|
-
let K,
|
|
13412
|
+
let K, Y;
|
|
13407
13413
|
if (oe.current !== null && ve.current)
|
|
13408
13414
|
try {
|
|
13409
|
-
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(
|
|
13410
13416
|
ve.current,
|
|
13411
13417
|
ne,
|
|
13412
|
-
|
|
13413
|
-
|
|
13418
|
+
Ee,
|
|
13419
|
+
ke.current
|
|
13414
13420
|
);
|
|
13415
|
-
K =
|
|
13421
|
+
K = Ie(je), Y = je.length / je.sampleRate, ke.current === "insert" && (ie.current = [
|
|
13416
13422
|
...ie.current,
|
|
13417
13423
|
...we.current
|
|
13418
13424
|
]), oe.current = null, ve.current = null, pe.current = [], we.current = [];
|
|
13419
13425
|
} catch {
|
|
13420
|
-
K = $,
|
|
13426
|
+
K = $, Y = Te.current > 0 ? Te.current : 1;
|
|
13421
13427
|
}
|
|
13422
13428
|
else
|
|
13423
|
-
K = $,
|
|
13424
|
-
|
|
13429
|
+
K = $, Y = Te.current > 0 ? Te.current : 1;
|
|
13430
|
+
X.current = K;
|
|
13425
13431
|
const ee = URL.createObjectURL(K), ae = new Audio(ee);
|
|
13426
13432
|
ae.ontimeupdate = () => {
|
|
13427
13433
|
y(ae.currentTime);
|
|
13428
13434
|
}, ae.onended = () => {
|
|
13429
13435
|
g(!1);
|
|
13430
|
-
},
|
|
13436
|
+
}, O.current = ae, f(Y), y(Y), a("editing"), R.getTracks().forEach((ne) => ne.stop());
|
|
13431
13437
|
} catch {
|
|
13432
13438
|
x("Failed to process recording"), a("idle");
|
|
13433
13439
|
}
|
|
13434
|
-
}, S.start(100), de.current = !0, a("recording"), c(0),
|
|
13435
|
-
|
|
13440
|
+
}, S.start(100), de.current = !0, a("recording"), c(0), Te.current = 0, L.current = setInterval(() => {
|
|
13441
|
+
Te.current += 1, c(Te.current);
|
|
13436
13442
|
}, 1e3);
|
|
13437
13443
|
} catch {
|
|
13438
13444
|
x("Could not access microphone. Please allow microphone access.");
|
|
13439
13445
|
}
|
|
13440
13446
|
}, ot = () => {
|
|
13441
13447
|
de.current = !1, w(!1), v(null), j.current && (cancelAnimationFrame(j.current), j.current = null), L.current && (clearInterval(L.current), L.current = null), D.current && D.current.state !== "inactive" && D.current.stop();
|
|
13442
|
-
}, dt = (
|
|
13448
|
+
}, dt = (R) => {
|
|
13443
13449
|
const T = b.current;
|
|
13444
13450
|
if (!T) return;
|
|
13445
|
-
const
|
|
13446
|
-
if (
|
|
13451
|
+
const Q = d || u;
|
|
13452
|
+
if (Q <= 0) return;
|
|
13447
13453
|
const J = ie.current;
|
|
13448
13454
|
if (J.length === 0) return;
|
|
13449
|
-
const S = T.getBoundingClientRect(), $ =
|
|
13450
|
-
|
|
13455
|
+
const S = T.getBoundingClientRect(), $ = R - Ce.current, K = 4, Y = S.width / T.width, ee = J.length / Q * K, ae = -$ / (ee * Y), ne = Ve.current + ae, te = Math.max(0, Math.min(ne, Q));
|
|
13456
|
+
O.current && (O.current.currentTime = te), y(te);
|
|
13451
13457
|
}, Ut = () => {
|
|
13452
|
-
|
|
13458
|
+
O.current && (O.current.currentTime = 0), y(0);
|
|
13453
13459
|
}, Wt = () => {
|
|
13454
|
-
const
|
|
13455
|
-
|
|
13460
|
+
const R = d || u;
|
|
13461
|
+
O.current && (O.current.currentTime = R), y(R);
|
|
13456
13462
|
}, Dt = () => {
|
|
13457
|
-
const
|
|
13458
|
-
|
|
13463
|
+
const R = O.current;
|
|
13464
|
+
R && (h ? (R.pause(), y(R.currentTime), g(!1)) : (R.currentTime = m, R.play().catch(() => {
|
|
13459
13465
|
}), g(!0)));
|
|
13460
|
-
}, ft = async (
|
|
13461
|
-
if (!
|
|
13466
|
+
}, ft = async (R) => {
|
|
13467
|
+
if (!X.current) {
|
|
13462
13468
|
it();
|
|
13463
13469
|
return;
|
|
13464
13470
|
}
|
|
13465
13471
|
try {
|
|
13466
|
-
|
|
13472
|
+
O.current && (O.current.pause(), g(!1)), ke.current = R, ve.current = await ge(X.current);
|
|
13467
13473
|
const T = d || u;
|
|
13468
13474
|
oe.current = m;
|
|
13469
|
-
const
|
|
13475
|
+
const Q = T > 0 ? m / T : 0, J = Math.floor(Q * ie.current.length);
|
|
13470
13476
|
pe.current = ie.current.slice(0, J), we.current = ie.current.slice(J), ie.current = [...pe.current], it();
|
|
13471
13477
|
} catch {
|
|
13472
13478
|
x("Failed to prepare recording. Please try again.");
|
|
13473
13479
|
}
|
|
13474
13480
|
}, ht = () => {
|
|
13475
|
-
|
|
13481
|
+
O.current && (O.current.pause(), O.current = null), X.current = null, ve.current = null, oe.current = null, pe.current = [], g(!1), y(0), f(0), c(0), it();
|
|
13476
13482
|
}, At = () => {
|
|
13477
|
-
|
|
13483
|
+
X.current ? r(X.current, d || u) : alert("No audio recorded yet!");
|
|
13478
13484
|
};
|
|
13479
13485
|
if (De(() => {
|
|
13480
13486
|
l === "recording" && b.current && B.current && de.current && (j.current = requestAnimationFrame(qt));
|
|
13481
13487
|
}, [l]), De(() => {
|
|
13482
|
-
const
|
|
13483
|
-
if (!
|
|
13488
|
+
const R = b.current;
|
|
13489
|
+
if (!R) return;
|
|
13484
13490
|
const T = () => {
|
|
13485
|
-
const
|
|
13486
|
-
|
|
13487
|
-
const S =
|
|
13488
|
-
S && S.scale(
|
|
13491
|
+
const Q = window.devicePixelRatio || 1, J = R.getBoundingClientRect();
|
|
13492
|
+
R.width = J.width * Q, R.height = J.height * Q;
|
|
13493
|
+
const S = R.getContext("2d");
|
|
13494
|
+
S && S.scale(Q, Q);
|
|
13489
13495
|
};
|
|
13490
13496
|
return T(), window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
|
|
13491
13497
|
}, []), De(() => {
|
|
13492
13498
|
if (l === "idle") {
|
|
13493
|
-
const
|
|
13494
|
-
if (!
|
|
13495
|
-
const T =
|
|
13499
|
+
const R = b.current;
|
|
13500
|
+
if (!R) return;
|
|
13501
|
+
const T = R.getContext("2d");
|
|
13496
13502
|
if (!T) return;
|
|
13497
|
-
const
|
|
13503
|
+
const Q = R.getBoundingClientRect(), J = Q.width, S = Q.height;
|
|
13498
13504
|
T.fillStyle = "#2d3b35", T.fillRect(0, 0, J, S);
|
|
13499
|
-
const $ = 8, K = "rgba(0, 0, 0, 0.4)",
|
|
13500
|
-
|
|
13505
|
+
const $ = 8, K = "rgba(0, 0, 0, 0.4)", Y = T.createLinearGradient(0, 0, 0, $);
|
|
13506
|
+
Y.addColorStop(0, K), Y.addColorStop(1, "transparent"), T.fillStyle = Y, T.fillRect(0, 0, J, $);
|
|
13501
13507
|
const ee = T.createLinearGradient(0, S - $, 0, S);
|
|
13502
13508
|
ee.addColorStop(0, "transparent"), ee.addColorStop(1, K), T.fillStyle = ee, T.fillRect(0, S - $, J, $);
|
|
13503
13509
|
const ae = T.createLinearGradient(0, 0, $, 0);
|
|
@@ -13508,43 +13514,43 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13508
13514
|
T.strokeStyle = "#ef4444", T.lineWidth = 1, T.beginPath(), T.moveTo(te, 0), T.lineTo(te, S), T.stroke(), T.fillStyle = "#fff", T.font = "bold 18px monospace", T.textAlign = "center", T.fillText("00:00", te, S - 6);
|
|
13509
13515
|
}
|
|
13510
13516
|
}, [l]), De(() => () => {
|
|
13511
|
-
de.current = !1, L.current && clearInterval(L.current), j.current && cancelAnimationFrame(j.current), k.current && k.current.getTracks().forEach((
|
|
13517
|
+
de.current = !1, L.current && clearInterval(L.current), j.current && cancelAnimationFrame(j.current), k.current && k.current.getTracks().forEach((R) => R.stop()), I.current && I.current.state !== "closed" && I.current.close();
|
|
13512
13518
|
}, []), De(() => {
|
|
13513
13519
|
if (l === "editing" && h) {
|
|
13514
|
-
let
|
|
13520
|
+
let R;
|
|
13515
13521
|
const T = () => {
|
|
13516
|
-
const
|
|
13517
|
-
if (
|
|
13522
|
+
const Q = O.current;
|
|
13523
|
+
if (Q && h) {
|
|
13518
13524
|
const J = b.current;
|
|
13519
13525
|
if (J) {
|
|
13520
13526
|
const S = J.getContext("2d");
|
|
13521
13527
|
if (S) {
|
|
13522
|
-
const $ = J.getBoundingClientRect(), K = $.width,
|
|
13523
|
-
S.fillStyle = "#2d3b35", S.fillRect(0, 0, K,
|
|
13524
|
-
const te = 8,
|
|
13525
|
-
|
|
13526
|
-
const
|
|
13527
|
-
|
|
13528
|
+
const $ = J.getBoundingClientRect(), K = $.width, Y = $.height, ee = ie.current, ae = d || u || 1, ne = Q.currentTime;
|
|
13529
|
+
S.fillStyle = "#2d3b35", S.fillRect(0, 0, K, Y);
|
|
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);
|
|
13528
13534
|
const fe = S.createLinearGradient(0, 0, te, 0);
|
|
13529
|
-
fe.addColorStop(0,
|
|
13530
|
-
const
|
|
13531
|
-
|
|
13532
|
-
const
|
|
13535
|
+
fe.addColorStop(0, Ee), fe.addColorStop(1, "transparent"), S.fillStyle = fe, S.fillRect(0, 0, te, Y);
|
|
13536
|
+
const Ue = S.createLinearGradient(K - te, 0, K, 0);
|
|
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();
|
|
13538
|
+
const We = K / 2, lt = 3, Et = 4, pt = ae > 0 ? ne / ae * ee.length : 0;
|
|
13533
13539
|
for (let tr = 0; tr < ee.length; tr++) {
|
|
13534
|
-
const ws = pt - tr, xr =
|
|
13540
|
+
const ws = pt - tr, xr = We - ws * Et;
|
|
13535
13541
|
if (xr < -lt || xr > K) continue;
|
|
13536
|
-
const Mr = ee[tr] * (
|
|
13542
|
+
const Mr = ee[tr] * (Y / 2 - 12), Cs = Y / 2 - Mr;
|
|
13537
13543
|
S.fillStyle = tr <= pt ? "#10b981" : "#4b5563", S.fillRect(xr, Cs, lt, Mr * 2);
|
|
13538
13544
|
}
|
|
13539
|
-
S.strokeStyle = "#ef4444", S.lineWidth = 1, S.beginPath(), S.moveTo(
|
|
13545
|
+
S.strokeStyle = "#ef4444", S.lineWidth = 1, S.beginPath(), S.moveTo(We, 0), S.lineTo(We, Y), S.stroke(), S.fillStyle = "#fff", S.font = "bold 18px monospace", S.textAlign = "center";
|
|
13540
13546
|
const Pt = Math.floor(ne / 60), yr = Math.floor(ne % 60);
|
|
13541
|
-
S.fillText(`${Pt.toString().padStart(2, "0")}:${yr.toString().padStart(2, "0")}`,
|
|
13547
|
+
S.fillText(`${Pt.toString().padStart(2, "0")}:${yr.toString().padStart(2, "0")}`, We, Y - 6), S.textAlign = "left";
|
|
13542
13548
|
}
|
|
13543
13549
|
}
|
|
13544
|
-
|
|
13550
|
+
R = requestAnimationFrame(T);
|
|
13545
13551
|
}
|
|
13546
13552
|
};
|
|
13547
|
-
return
|
|
13553
|
+
return R = requestAnimationFrame(T), () => cancelAnimationFrame(R);
|
|
13548
13554
|
}
|
|
13549
13555
|
}, [l, h, d, u]), De(() => {
|
|
13550
13556
|
l === "editing" && !h && Ct();
|
|
@@ -13562,7 +13568,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13562
13568
|
}
|
|
13563
13569
|
)
|
|
13564
13570
|
] });
|
|
13565
|
-
const
|
|
13571
|
+
const U = {
|
|
13566
13572
|
padding: "8px",
|
|
13567
13573
|
borderRadius: "8px",
|
|
13568
13574
|
border: "none",
|
|
@@ -13572,26 +13578,26 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13572
13578
|
alignItems: "center",
|
|
13573
13579
|
justifyContent: "center",
|
|
13574
13580
|
transition: "background 0.15s"
|
|
13575
|
-
},
|
|
13576
|
-
...
|
|
13581
|
+
}, ye = {
|
|
13582
|
+
...U,
|
|
13577
13583
|
opacity: 0.3,
|
|
13578
13584
|
cursor: "not-allowed"
|
|
13579
|
-
},
|
|
13580
|
-
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: [
|
|
13581
13587
|
/* @__PURE__ */ p.jsx(
|
|
13582
13588
|
"canvas",
|
|
13583
13589
|
{
|
|
13584
13590
|
ref: b,
|
|
13585
13591
|
style: { width: "100%", height: "32px", cursor: "pointer", flexShrink: 0 },
|
|
13586
|
-
onMouseDown: (
|
|
13592
|
+
onMouseDown: (R) => {
|
|
13587
13593
|
if (l === "editing") {
|
|
13588
|
-
|
|
13594
|
+
Me.current = !0, Ce.current = R.clientX, Ve.current = m;
|
|
13589
13595
|
const T = (J) => {
|
|
13590
|
-
|
|
13591
|
-
},
|
|
13592
|
-
|
|
13596
|
+
Me.current && dt(J.clientX);
|
|
13597
|
+
}, Q = () => {
|
|
13598
|
+
Me.current = !1, window.removeEventListener("mousemove", T), window.removeEventListener("mouseup", Q);
|
|
13593
13599
|
};
|
|
13594
|
-
window.addEventListener("mousemove", T), window.addEventListener("mouseup",
|
|
13600
|
+
window.addEventListener("mousemove", T), window.addEventListener("mouseup", Q);
|
|
13595
13601
|
}
|
|
13596
13602
|
}
|
|
13597
13603
|
}
|
|
@@ -13616,7 +13622,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13616
13622
|
{
|
|
13617
13623
|
onClick: Ut,
|
|
13618
13624
|
disabled: l === "idle" || l === "recording",
|
|
13619
|
-
style: l === "idle" || l === "recording" ?
|
|
13625
|
+
style: l === "idle" || l === "recording" ? ye : U,
|
|
13620
13626
|
title: "Go to start",
|
|
13621
13627
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: "first_page" })
|
|
13622
13628
|
}
|
|
@@ -13626,13 +13632,13 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13626
13632
|
{
|
|
13627
13633
|
onClick: () => {
|
|
13628
13634
|
if (l === "recording") {
|
|
13629
|
-
const
|
|
13630
|
-
|
|
13635
|
+
const R = D.current;
|
|
13636
|
+
R && (R.state === "recording" ? (R.pause(), w(!0)) : R.state === "paused" && (R.resume(), w(!1)));
|
|
13631
13637
|
} else
|
|
13632
13638
|
Dt();
|
|
13633
13639
|
},
|
|
13634
13640
|
disabled: l === "idle",
|
|
13635
|
-
style: l === "idle" ?
|
|
13641
|
+
style: l === "idle" ? ye : U,
|
|
13636
13642
|
title: h || l === "recording" && !A ? "Pause" : "Play",
|
|
13637
13643
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: h || l === "recording" && !A ? "pause" : "play_arrow" })
|
|
13638
13644
|
}
|
|
@@ -13642,7 +13648,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13642
13648
|
{
|
|
13643
13649
|
onClick: Wt,
|
|
13644
13650
|
disabled: l === "idle" || l === "recording",
|
|
13645
|
-
style: l === "idle" || l === "recording" ?
|
|
13651
|
+
style: l === "idle" || l === "recording" ? ye : U,
|
|
13646
13652
|
title: "Go to end",
|
|
13647
13653
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: "last_page" })
|
|
13648
13654
|
}
|
|
@@ -13655,7 +13661,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13655
13661
|
E === "insert" ? ot() : l === "idle" ? (v("insert"), it()) : l === "editing" && (v("insert"), ft("insert"));
|
|
13656
13662
|
},
|
|
13657
13663
|
disabled: l === "recording" && E !== "insert" || h,
|
|
13658
|
-
style: l === "recording" && E !== "insert" || h ?
|
|
13664
|
+
style: l === "recording" && E !== "insert" || h ? ye : U,
|
|
13659
13665
|
title: E === "insert" ? "Stop recording" : "Insert recording",
|
|
13660
13666
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: E === "insert" ? "#ef4444" : "#171717" }, children: "add" })
|
|
13661
13667
|
}
|
|
@@ -13667,7 +13673,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13667
13673
|
E === "mic" ? ot() : l === "idle" ? (v("mic"), it()) : l === "editing" && (v("mic"), ft("replace"));
|
|
13668
13674
|
},
|
|
13669
13675
|
disabled: l === "recording" && E !== "mic" || h,
|
|
13670
|
-
style: l === "recording" && E !== "mic" || h ?
|
|
13676
|
+
style: l === "recording" && E !== "mic" || h ? ye : U,
|
|
13671
13677
|
title: E === "mic" ? "Stop recording" : "Record",
|
|
13672
13678
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: E === "mic" ? "#ef4444" : "#171717" }, children: "mic" })
|
|
13673
13679
|
}
|
|
@@ -13679,7 +13685,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13679
13685
|
E === "startover" ? ot() : l === "editing" && (v("startover"), ht());
|
|
13680
13686
|
},
|
|
13681
13687
|
disabled: l === "idle" || l === "recording" && E !== "startover" || h,
|
|
13682
|
-
style: l === "idle" || l === "recording" && E !== "startover" || h ?
|
|
13688
|
+
style: l === "idle" || l === "recording" && E !== "startover" || h ? ye : U,
|
|
13683
13689
|
title: E === "startover" ? "Stop recording" : "Start over",
|
|
13684
13690
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: E === "startover" ? "#ef4444" : "#171717" }, children: "refresh" })
|
|
13685
13691
|
}
|
|
@@ -13689,9 +13695,9 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13689
13695
|
t && /* @__PURE__ */ p.jsx(
|
|
13690
13696
|
"button",
|
|
13691
13697
|
{
|
|
13692
|
-
onClick: () =>
|
|
13698
|
+
onClick: () => X.current && t(X.current),
|
|
13693
13699
|
disabled: l !== "editing" || n,
|
|
13694
|
-
style: l !== "editing" || n ?
|
|
13700
|
+
style: l !== "editing" || n ? ye : U,
|
|
13695
13701
|
title: n ? "Transcribing..." : "Transcribe audio",
|
|
13696
13702
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: n ? "hourglass_empty" : "subtitles" })
|
|
13697
13703
|
}
|
|
@@ -13701,7 +13707,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, transcribing: n, vari
|
|
|
13701
13707
|
{
|
|
13702
13708
|
onClick: At,
|
|
13703
13709
|
disabled: l !== "editing",
|
|
13704
|
-
style: l !== "editing" ?
|
|
13710
|
+
style: l !== "editing" ? ye : U,
|
|
13705
13711
|
title: "Save recording",
|
|
13706
13712
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: "save" })
|
|
13707
13713
|
}
|