@superdoc/mcp 1.6.0-next.12 → 1.6.0-next.14
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.js +1306 -846
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -30405,8 +30405,128 @@ var init_transport_common = __esm(() => {
|
|
|
30405
30405
|
TEMPLATES_APPLY_INPUT_FIELDS = ["source", "bodyPolicy"];
|
|
30406
30406
|
});
|
|
30407
30407
|
|
|
30408
|
-
// ../../packages/sdk/langs/node/src/runtime/
|
|
30408
|
+
// ../../packages/sdk/langs/node/src/runtime/state-directory.ts
|
|
30409
|
+
import { mkdir, mkdtemp, open, rm, stat } from "node:fs/promises";
|
|
30410
|
+
import { tmpdir, userInfo } from "node:os";
|
|
30411
|
+
import { join, resolve } from "node:path";
|
|
30409
30412
|
import { randomUUID } from "node:crypto";
|
|
30413
|
+
|
|
30414
|
+
class SdkStateDirectory {
|
|
30415
|
+
configured;
|
|
30416
|
+
selection;
|
|
30417
|
+
constructor(configured) {
|
|
30418
|
+
this.configured = configured;
|
|
30419
|
+
}
|
|
30420
|
+
get path() {
|
|
30421
|
+
return this.selection?.path;
|
|
30422
|
+
}
|
|
30423
|
+
get ownsRoot() {
|
|
30424
|
+
return this.selection?.owned === true;
|
|
30425
|
+
}
|
|
30426
|
+
async prepare(env) {
|
|
30427
|
+
if (this.configured !== undefined && (typeof this.configured !== "string" || !this.configured.trim())) {
|
|
30428
|
+
throw new SuperDocCliError("stateDir must be a non-empty path.", { code: "INVALID_ARGUMENT" });
|
|
30429
|
+
}
|
|
30430
|
+
if (this.selection) {
|
|
30431
|
+
await this.check(this.selection);
|
|
30432
|
+
return this.selection.path;
|
|
30433
|
+
}
|
|
30434
|
+
const explicit = this.configured ?? (env.SUPERDOC_CLI_STATE_DIR || undefined);
|
|
30435
|
+
if (explicit !== undefined) {
|
|
30436
|
+
const selection = {
|
|
30437
|
+
path: resolve(explicit),
|
|
30438
|
+
source: this.configured !== undefined ? "stateDir" : "SUPERDOC_CLI_STATE_DIR",
|
|
30439
|
+
owned: false
|
|
30440
|
+
};
|
|
30441
|
+
await this.check(selection);
|
|
30442
|
+
this.selection = selection;
|
|
30443
|
+
return selection.path;
|
|
30444
|
+
}
|
|
30445
|
+
let home = process.platform === "win32" ? env.USERPROFILE : env.HOME;
|
|
30446
|
+
if (!home) {
|
|
30447
|
+
try {
|
|
30448
|
+
home = userInfo().homedir;
|
|
30449
|
+
} catch {}
|
|
30450
|
+
}
|
|
30451
|
+
if (home) {
|
|
30452
|
+
const selection = { path: join(home, ".superdoc-cli", "state", "v1"), source: "home", owned: false };
|
|
30453
|
+
try {
|
|
30454
|
+
if ((await stat(home)).isDirectory()) {
|
|
30455
|
+
await this.probe(selection.path);
|
|
30456
|
+
this.selection = selection;
|
|
30457
|
+
return selection.path;
|
|
30458
|
+
}
|
|
30459
|
+
} catch {}
|
|
30460
|
+
}
|
|
30461
|
+
const temporary = process.platform === "win32" ? env.TEMP || env.TMP || (env.SystemRoot ? join(env.SystemRoot, "temp") : tmpdir()) : env.TMPDIR || env.TMP || env.TEMP || "/tmp";
|
|
30462
|
+
let allocated;
|
|
30463
|
+
try {
|
|
30464
|
+
allocated = await mkdtemp(join(resolve(temporary), "superdoc-sdk-state-"));
|
|
30465
|
+
const selection = { path: allocated, source: "temporary", owned: true };
|
|
30466
|
+
await this.probe(allocated);
|
|
30467
|
+
this.selection = selection;
|
|
30468
|
+
return allocated;
|
|
30469
|
+
} catch (error48) {
|
|
30470
|
+
if (allocated)
|
|
30471
|
+
await rm(allocated, { recursive: true, force: true });
|
|
30472
|
+
throw this.failure({ path: resolve(temporary), source: "temporary", owned: false }, error48);
|
|
30473
|
+
}
|
|
30474
|
+
}
|
|
30475
|
+
async dispose() {
|
|
30476
|
+
const selection = this.selection;
|
|
30477
|
+
if (!selection)
|
|
30478
|
+
return;
|
|
30479
|
+
if (selection.owned)
|
|
30480
|
+
await rm(selection.path, { recursive: true, force: true });
|
|
30481
|
+
this.selection = undefined;
|
|
30482
|
+
}
|
|
30483
|
+
mapOperationError(error48) {
|
|
30484
|
+
const selection = this.selection;
|
|
30485
|
+
const code = error48.message.match(/\b(E[A-Z]+)\b/)?.[1];
|
|
30486
|
+
if (!selection || !code || !FILESYSTEM_CODES.has(code) || !error48.message.includes(selection.path))
|
|
30487
|
+
return error48;
|
|
30488
|
+
return this.failure(selection, { code });
|
|
30489
|
+
}
|
|
30490
|
+
async check(selection) {
|
|
30491
|
+
try {
|
|
30492
|
+
await this.probe(selection.path);
|
|
30493
|
+
} catch (error48) {
|
|
30494
|
+
throw this.failure(selection, error48);
|
|
30495
|
+
}
|
|
30496
|
+
}
|
|
30497
|
+
async probe(path) {
|
|
30498
|
+
const contexts = join(path, "contexts");
|
|
30499
|
+
await mkdir(contexts, { recursive: true, mode: 448 });
|
|
30500
|
+
const probe = join(contexts, ".sdk-write-" + randomUUID());
|
|
30501
|
+
const handle = await open(probe, "wx", 384);
|
|
30502
|
+
try {
|
|
30503
|
+
await handle.writeFile("state");
|
|
30504
|
+
} finally {
|
|
30505
|
+
await handle.close();
|
|
30506
|
+
await rm(probe, { force: true });
|
|
30507
|
+
}
|
|
30508
|
+
}
|
|
30509
|
+
failure(selection, error48) {
|
|
30510
|
+
const fsCode = error48?.code;
|
|
30511
|
+
return new SuperDocCliError("SuperDoc state directory is not writable: " + selection.path + ". Configure stateDir or SUPERDOC_CLI_STATE_DIR with a writable directory.", {
|
|
30512
|
+
code: "STATE_DIRECTORY_UNWRITABLE",
|
|
30513
|
+
details: {
|
|
30514
|
+
path: selection.path,
|
|
30515
|
+
source: selection.source,
|
|
30516
|
+
fsCode,
|
|
30517
|
+
remediation: "Configure stateDir or SUPERDOC_CLI_STATE_DIR with a writable directory."
|
|
30518
|
+
}
|
|
30519
|
+
});
|
|
30520
|
+
}
|
|
30521
|
+
}
|
|
30522
|
+
var FILESYSTEM_CODES;
|
|
30523
|
+
var init_state_directory = __esm(() => {
|
|
30524
|
+
init_errors4();
|
|
30525
|
+
FILESYSTEM_CODES = new Set(["EACCES", "EPERM", "EROFS", "ENOSPC", "EDQUOT", "ENOTDIR", "ENOENT"]);
|
|
30526
|
+
});
|
|
30527
|
+
|
|
30528
|
+
// ../../packages/sdk/langs/node/src/runtime/document-rpc.ts
|
|
30529
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
30410
30530
|
function unsupported(message, operationId) {
|
|
30411
30531
|
return new SuperDocCliError(message, {
|
|
30412
30532
|
code: "DOCUMENT_RPC_INPUT_UNSUPPORTED",
|
|
@@ -30459,7 +30579,7 @@ function canOpenWithDocumentRpc(params, options) {
|
|
|
30459
30579
|
return Object.entries(params).every(([key, value]) => value === undefined || DOCUMENT_RPC_OPEN_FIELDS.has(key));
|
|
30460
30580
|
}
|
|
30461
30581
|
function buildDocumentOpenParams(params, user, defaultChangeMode) {
|
|
30462
|
-
const sessionId = typeof params.sessionId === "string" && params.sessionId.length > 0 ? params.sessionId :
|
|
30582
|
+
const sessionId = typeof params.sessionId === "string" && params.sessionId.length > 0 ? params.sessionId : randomUUID2();
|
|
30463
30583
|
const author = buildDocumentAuthor(user);
|
|
30464
30584
|
return {
|
|
30465
30585
|
sessionId,
|
|
@@ -30764,6 +30884,8 @@ function resolveJsWatchdogTimeout(watchdogTimeoutMs, requestTimeoutMs, timeoutMs
|
|
|
30764
30884
|
}
|
|
30765
30885
|
|
|
30766
30886
|
class HostTransport {
|
|
30887
|
+
stateDirectory;
|
|
30888
|
+
stoppedChildren = new Map;
|
|
30767
30889
|
hostBin;
|
|
30768
30890
|
processMode;
|
|
30769
30891
|
env;
|
|
@@ -30792,6 +30914,7 @@ class HostTransport {
|
|
|
30792
30914
|
documentRpcMutationStates = new Map;
|
|
30793
30915
|
indeterminateDiscardCloses = new Set;
|
|
30794
30916
|
constructor(options) {
|
|
30917
|
+
this.stateDirectory = new SdkStateDirectory(options.stateDir);
|
|
30795
30918
|
this.hostBin = options.hostBin;
|
|
30796
30919
|
this.processMode = options.processMode ?? "cli";
|
|
30797
30920
|
this.env = options.env;
|
|
@@ -30851,7 +30974,7 @@ class HostTransport {
|
|
|
30851
30974
|
return this.disposePromise;
|
|
30852
30975
|
if (this.terminalDisposalError)
|
|
30853
30976
|
throw this.terminalDisposalError;
|
|
30854
|
-
if (!this.child && !this.connecting && this.activeCalls.size === 0)
|
|
30977
|
+
if (!this.child && !this.connecting && this.activeCalls.size === 0 && !this.stateDirectory.ownsRoot && this.stoppedChildren.size === 0)
|
|
30855
30978
|
return;
|
|
30856
30979
|
this.stopping = true;
|
|
30857
30980
|
const disposal = this.disposeAfterActiveCalls();
|
|
@@ -30868,8 +30991,11 @@ class HostTransport {
|
|
|
30868
30991
|
await Promise.allSettled(Array.from(this.activeCalls));
|
|
30869
30992
|
if (this.terminalDisposalError)
|
|
30870
30993
|
throw this.terminalDisposalError;
|
|
30871
|
-
if (!this.child)
|
|
30994
|
+
if (!this.child) {
|
|
30995
|
+
await this.waitForStoppedChildren();
|
|
30996
|
+
await this.stateDirectory.dispose();
|
|
30872
30997
|
return;
|
|
30998
|
+
}
|
|
30873
30999
|
try {
|
|
30874
31000
|
await this.reconcileIndeterminateDiscardCloses();
|
|
30875
31001
|
await this.persistDirtyDocumentRpcSessions();
|
|
@@ -30883,17 +31009,16 @@ class HostTransport {
|
|
|
30883
31009
|
try {
|
|
30884
31010
|
await this.sendJsonRpcRequest("host.shutdown", {}, this.shutdownTimeoutMs);
|
|
30885
31011
|
} catch {}
|
|
30886
|
-
await
|
|
30887
|
-
|
|
30888
|
-
|
|
30889
|
-
|
|
30890
|
-
|
|
30891
|
-
child.once("close", () => {
|
|
30892
|
-
clearTimeout(timer);
|
|
30893
|
-
resolve();
|
|
31012
|
+
await this.waitForStoppedChildren(true);
|
|
31013
|
+
if (child.exitCode !== 0) {
|
|
31014
|
+
this.terminalDisposalError = new SuperDocCliError("Host shutdown failed; its state directory has been retained.", {
|
|
31015
|
+
code: "HOST_SHUTDOWN_FAILED",
|
|
31016
|
+
details: { path: this.stateDirectory.path, exitCode: child.exitCode, signal: child.signalCode }
|
|
30894
31017
|
});
|
|
30895
|
-
|
|
31018
|
+
throw this.terminalDisposalError;
|
|
31019
|
+
}
|
|
30896
31020
|
this.cleanupProcess(null);
|
|
31021
|
+
await this.stateDirectory.dispose();
|
|
30897
31022
|
}
|
|
30898
31023
|
async invoke(operation, params = {}, options = {}) {
|
|
30899
31024
|
return this.runWhileActive(() => this.invokeWhileActive(operation, params, options));
|
|
@@ -31086,14 +31211,15 @@ class HostTransport {
|
|
|
31086
31211
|
async startHostProcess() {
|
|
31087
31212
|
const { command, prefixArgs } = resolveInvocation(this.hostBin);
|
|
31088
31213
|
const args = this.processMode === "document" ? buildDocumentHostSpawnArgs(prefixArgs) : buildHostSpawnArgs(prefixArgs, { requestTimeoutMs: this.requestTimeoutMs });
|
|
31214
|
+
await this.waitForStoppedChildren();
|
|
31215
|
+
const env = { ...process.env, ...this.env };
|
|
31216
|
+
env.SUPERDOC_CLI_STATE_DIR = await this.stateDirectory.prepare(env);
|
|
31089
31217
|
const child = spawn(command, args, {
|
|
31090
|
-
env
|
|
31091
|
-
...process.env,
|
|
31092
|
-
...this.env
|
|
31093
|
-
},
|
|
31218
|
+
env,
|
|
31094
31219
|
stdio: ["pipe", "pipe", "pipe"]
|
|
31095
31220
|
});
|
|
31096
31221
|
this.child = child;
|
|
31222
|
+
this.stoppedChildren.set(child, new Promise((resolve2) => child.once("close", () => resolve2())));
|
|
31097
31223
|
child.stdout.setEncoding("utf8");
|
|
31098
31224
|
const stdoutDataListener = (chunk) => this.onStdoutChunk(chunk);
|
|
31099
31225
|
this.stdoutDataListener = stdoutDataListener;
|
|
@@ -31105,6 +31231,8 @@ class HostTransport {
|
|
|
31105
31231
|
process.stderr.write(`[superdoc-host] ${String(chunk)}`);
|
|
31106
31232
|
});
|
|
31107
31233
|
child.on("error", (error48) => {
|
|
31234
|
+
if (this.child !== child)
|
|
31235
|
+
return;
|
|
31108
31236
|
this.handleDisconnect(new SuperDocCliError("Host process failed.", {
|
|
31109
31237
|
code: "HOST_DISCONNECTED",
|
|
31110
31238
|
details: {
|
|
@@ -31113,6 +31241,8 @@ class HostTransport {
|
|
|
31113
31241
|
}));
|
|
31114
31242
|
});
|
|
31115
31243
|
child.on("close", (code, signal) => {
|
|
31244
|
+
if (this.child !== child)
|
|
31245
|
+
return;
|
|
31116
31246
|
if (this.stopping && this.dirtyDocumentRpcSessions.size === 0) {
|
|
31117
31247
|
this.cleanupProcess(null);
|
|
31118
31248
|
return;
|
|
@@ -31275,7 +31405,7 @@ class HostTransport {
|
|
|
31275
31405
|
params,
|
|
31276
31406
|
...metadata.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: metadata.requestTimeoutMs }
|
|
31277
31407
|
});
|
|
31278
|
-
const promise3 = new Promise((
|
|
31408
|
+
const promise3 = new Promise((resolve2, reject) => {
|
|
31279
31409
|
const timer = setTimeout(() => {
|
|
31280
31410
|
this.pending.delete(id);
|
|
31281
31411
|
reject(new SuperDocCliError(`Host watchdog timed out waiting for ${method}.`, {
|
|
@@ -31287,7 +31417,7 @@ class HostTransport {
|
|
|
31287
31417
|
details: { method, timeoutMs: watchdogTimeoutMs }
|
|
31288
31418
|
}));
|
|
31289
31419
|
}, watchdogTimeoutMs);
|
|
31290
|
-
this.pending.set(id, { resolve, reject, timer });
|
|
31420
|
+
this.pending.set(id, { resolve: resolve2, reject, timer });
|
|
31291
31421
|
child.stdin.write(`${payload}
|
|
31292
31422
|
`, (error48) => {
|
|
31293
31423
|
if (!error48)
|
|
@@ -31366,11 +31496,11 @@ class HostTransport {
|
|
|
31366
31496
|
const cliMessage = typeof data?.message === "string" ? data.message : undefined;
|
|
31367
31497
|
const exitCode = typeof data?.exitCode === "number" ? data.exitCode : undefined;
|
|
31368
31498
|
if (cliCode) {
|
|
31369
|
-
return new SuperDocCliError(cliMessage ?? error48.message ?? "Command failed.", {
|
|
31499
|
+
return this.stateDirectory.mapOperationError(new SuperDocCliError(cliMessage ?? error48.message ?? "Command failed.", {
|
|
31370
31500
|
code: cliCode,
|
|
31371
31501
|
details: data?.details,
|
|
31372
31502
|
exitCode
|
|
31373
|
-
});
|
|
31503
|
+
}));
|
|
31374
31504
|
}
|
|
31375
31505
|
if (domainCode) {
|
|
31376
31506
|
return new SuperDocCliError(error48.message, {
|
|
@@ -31393,6 +31523,32 @@ class HostTransport {
|
|
|
31393
31523
|
details: data
|
|
31394
31524
|
});
|
|
31395
31525
|
}
|
|
31526
|
+
async waitForStoppedChildren(forceAfterTimeout = false) {
|
|
31527
|
+
for (const [child, stopped] of this.stoppedChildren) {
|
|
31528
|
+
let timer;
|
|
31529
|
+
try {
|
|
31530
|
+
await new Promise((resolve2, reject) => {
|
|
31531
|
+
const fail = () => reject(new SuperDocCliError("Host process did not stop; state has been retained.", {
|
|
31532
|
+
code: "HOST_DISCONNECTED",
|
|
31533
|
+
details: { pid: child.pid }
|
|
31534
|
+
}));
|
|
31535
|
+
timer = setTimeout(() => {
|
|
31536
|
+
if (!forceAfterTimeout) {
|
|
31537
|
+
fail();
|
|
31538
|
+
return;
|
|
31539
|
+
}
|
|
31540
|
+
child.kill("SIGKILL");
|
|
31541
|
+
timer = setTimeout(fail, this.shutdownTimeoutMs);
|
|
31542
|
+
}, this.shutdownTimeoutMs);
|
|
31543
|
+
stopped.then(resolve2, reject);
|
|
31544
|
+
});
|
|
31545
|
+
this.stoppedChildren.delete(child);
|
|
31546
|
+
} finally {
|
|
31547
|
+
if (timer)
|
|
31548
|
+
clearTimeout(timer);
|
|
31549
|
+
}
|
|
31550
|
+
}
|
|
31551
|
+
}
|
|
31396
31552
|
handleDisconnect(error48) {
|
|
31397
31553
|
this.cleanupProcess(error48);
|
|
31398
31554
|
}
|
|
@@ -31412,8 +31568,8 @@ class HostTransport {
|
|
|
31412
31568
|
if (child) {
|
|
31413
31569
|
if (this.stdoutDataListener)
|
|
31414
31570
|
child.stdout.off("data", this.stdoutDataListener);
|
|
31415
|
-
child.
|
|
31416
|
-
|
|
31571
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
31572
|
+
child.kill("SIGKILL");
|
|
31417
31573
|
}
|
|
31418
31574
|
this.child = null;
|
|
31419
31575
|
this.stdoutBuffer = "";
|
|
@@ -31433,6 +31589,7 @@ var HOST_PROTOCOL_VERSION = "1.0", CLI_HOST_REQUIRED_FEATURES, COLLABORATION_AUT
|
|
|
31433
31589
|
var init_host = __esm(() => {
|
|
31434
31590
|
init_transport_common();
|
|
31435
31591
|
init_errors4();
|
|
31592
|
+
init_state_directory();
|
|
31436
31593
|
init_document_evidence();
|
|
31437
31594
|
init_contract();
|
|
31438
31595
|
init_document_rpc();
|
|
@@ -31443,7 +31600,7 @@ var init_host = __esm(() => {
|
|
|
31443
31600
|
});
|
|
31444
31601
|
|
|
31445
31602
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31446
|
-
var SDK_VERSION = "2.19.0-next.
|
|
31603
|
+
var SDK_VERSION = "2.19.0-next.14";
|
|
31447
31604
|
|
|
31448
31605
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31449
31606
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -31591,7 +31748,7 @@ var init_embedded_document_host = __esm(() => {
|
|
|
31591
31748
|
});
|
|
31592
31749
|
|
|
31593
31750
|
// ../../packages/sdk/langs/node/src/runtime/debug-trace.ts
|
|
31594
|
-
import { appendFile, mkdir } from "node:fs/promises";
|
|
31751
|
+
import { appendFile, mkdir as mkdir2 } from "node:fs/promises";
|
|
31595
31752
|
import path2 from "node:path";
|
|
31596
31753
|
function isEnabled() {
|
|
31597
31754
|
return process.env.SUPERDOC_SDK_DEBUG_TRACE === "1";
|
|
@@ -31622,14 +31779,14 @@ function writeSdkDebugTrace(event) {
|
|
|
31622
31779
|
...event
|
|
31623
31780
|
}, jsonReplacer)}
|
|
31624
31781
|
`;
|
|
31625
|
-
|
|
31782
|
+
mkdir2(dir, { recursive: true }).then(() => appendFile(file2, payload, "utf8")).catch(() => {});
|
|
31626
31783
|
}
|
|
31627
31784
|
var init_debug_trace = () => {};
|
|
31628
31785
|
|
|
31629
31786
|
// ../../packages/sdk/langs/node/src/runtime/process.ts
|
|
31630
|
-
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
31631
|
-
import { tmpdir } from "node:os";
|
|
31632
|
-
import { join } from "node:path";
|
|
31787
|
+
import { mkdtemp as mkdtemp2, rm as rm2, writeFile } from "node:fs/promises";
|
|
31788
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
31789
|
+
import { join as join2 } from "node:path";
|
|
31633
31790
|
function resolveRuntimeProcess(options = {}, embedded = {
|
|
31634
31791
|
cli: resolveEmbeddedCliBinary,
|
|
31635
31792
|
documentHost: resolveEmbeddedDocumentHostBinary
|
|
@@ -31731,13 +31888,13 @@ class SuperDocRuntime {
|
|
|
31731
31888
|
code: "INVALID_ARGUMENT"
|
|
31732
31889
|
});
|
|
31733
31890
|
}
|
|
31734
|
-
const stagingDirectory = await
|
|
31735
|
-
const stagedPath =
|
|
31891
|
+
const stagingDirectory = await mkdtemp2(join2(tmpdir2(), "superdoc-sdk-replace-"));
|
|
31892
|
+
const stagedPath = join2(stagingDirectory, "replacement.docx");
|
|
31736
31893
|
try {
|
|
31737
31894
|
await writeFile(stagedPath, bytes, { mode: 384 });
|
|
31738
31895
|
return await this.transport.replaceFile(sessionId, stagedPath, options);
|
|
31739
31896
|
} finally {
|
|
31740
|
-
await
|
|
31897
|
+
await rm2(stagingDirectory, { recursive: true, force: true });
|
|
31741
31898
|
}
|
|
31742
31899
|
}
|
|
31743
31900
|
}
|
|
@@ -91219,8 +91376,8 @@ function normalizeItemSpec(raw) {
|
|
|
91219
91376
|
if (typeof r === "string") {
|
|
91220
91377
|
runs.push({ text: r });
|
|
91221
91378
|
} else if (isRecord2(r) && typeof r.text === "string") {
|
|
91222
|
-
const
|
|
91223
|
-
runs.push(
|
|
91379
|
+
const rm3 = normalizeMarks(r.marks);
|
|
91380
|
+
runs.push(rm3 ? { text: r.text, marks: rm3 } : { text: r.text });
|
|
91224
91381
|
}
|
|
91225
91382
|
}
|
|
91226
91383
|
if (runs.length > 0) {
|
|
@@ -122082,16 +122239,16 @@ function createNodeCooperativeScheduler(options = {}) {
|
|
|
122082
122239
|
kind: "macrotask-node-cooperative",
|
|
122083
122240
|
productComplete: true,
|
|
122084
122241
|
now: perfNow,
|
|
122085
|
-
yield: (_reason) => new Promise((
|
|
122242
|
+
yield: (_reason) => new Promise((resolve2) => {
|
|
122086
122243
|
const now = perfNow();
|
|
122087
122244
|
if (now - lastTimerPhaseMs >= timerPhaseEveryMs) {
|
|
122088
122245
|
setTimeout(() => {
|
|
122089
122246
|
lastTimerPhaseMs = perfNow();
|
|
122090
|
-
|
|
122247
|
+
resolve2();
|
|
122091
122248
|
}, 0);
|
|
122092
122249
|
return;
|
|
122093
122250
|
}
|
|
122094
|
-
setImmediateFn(() =>
|
|
122251
|
+
setImmediateFn(() => resolve2());
|
|
122095
122252
|
})
|
|
122096
122253
|
};
|
|
122097
122254
|
}
|
|
@@ -122111,8 +122268,8 @@ function createMessageChannelScheduler() {
|
|
|
122111
122268
|
kind: "macrotask-message-channel",
|
|
122112
122269
|
productComplete: true,
|
|
122113
122270
|
now: perfNow,
|
|
122114
|
-
yield: (_reason) => new Promise((
|
|
122115
|
-
pending.push(
|
|
122271
|
+
yield: (_reason) => new Promise((resolve2) => {
|
|
122272
|
+
pending.push(resolve2);
|
|
122116
122273
|
channel.port2.postMessage(1);
|
|
122117
122274
|
})
|
|
122118
122275
|
};
|
|
@@ -122126,8 +122283,8 @@ function createPostTaskScheduler() {
|
|
|
122126
122283
|
kind: "macrotask-post-task",
|
|
122127
122284
|
productComplete: true,
|
|
122128
122285
|
now: perfNow,
|
|
122129
|
-
yield: (_reason) => new Promise((
|
|
122130
|
-
sched.postTask(() =>
|
|
122286
|
+
yield: (_reason) => new Promise((resolve2) => {
|
|
122287
|
+
sched.postTask(() => resolve2(), { priority: "background" });
|
|
122131
122288
|
})
|
|
122132
122289
|
};
|
|
122133
122290
|
}
|
|
@@ -122136,8 +122293,8 @@ function createSetTimeoutScheduler() {
|
|
|
122136
122293
|
kind: "fake-set-timeout",
|
|
122137
122294
|
productComplete: false,
|
|
122138
122295
|
now: perfNow,
|
|
122139
|
-
yield: (_reason) => new Promise((
|
|
122140
|
-
setTimeout(() =>
|
|
122296
|
+
yield: (_reason) => new Promise((resolve2) => {
|
|
122297
|
+
setTimeout(() => resolve2(), 0);
|
|
122141
122298
|
})
|
|
122142
122299
|
};
|
|
122143
122300
|
}
|
|
@@ -124827,24 +124984,24 @@ function findRawXmlElementRangeAt(xml, start, namespaceUri, localName, initialNa
|
|
|
124827
124984
|
namespaceStack.push(bindings);
|
|
124828
124985
|
continue;
|
|
124829
124986
|
}
|
|
124830
|
-
const
|
|
124831
|
-
if (!
|
|
124987
|
+
const open2 = elementStack.pop();
|
|
124988
|
+
if (!open2 || open2.prefix !== tag.prefix || open2.localName !== tag.localName)
|
|
124832
124989
|
return null;
|
|
124833
124990
|
if (namespaceStack.length > 1)
|
|
124834
124991
|
namespaceStack.pop();
|
|
124835
|
-
if (
|
|
124992
|
+
if (open2.start !== start)
|
|
124836
124993
|
continue;
|
|
124837
|
-
if (
|
|
124994
|
+
if (open2.namespaceUri !== namespaceUri || open2.localName !== localName)
|
|
124838
124995
|
return null;
|
|
124839
124996
|
return {
|
|
124840
|
-
start:
|
|
124841
|
-
openEnd:
|
|
124997
|
+
start: open2.start,
|
|
124998
|
+
openEnd: open2.openEnd,
|
|
124842
124999
|
closeStart: tagStart,
|
|
124843
125000
|
end: tagEnd,
|
|
124844
|
-
prefix:
|
|
124845
|
-
localName:
|
|
124846
|
-
namespaceUri:
|
|
124847
|
-
namespaceBindings:
|
|
125001
|
+
prefix: open2.prefix,
|
|
125002
|
+
localName: open2.localName,
|
|
125003
|
+
namespaceUri: open2.namespaceUri,
|
|
125004
|
+
namespaceBindings: open2.namespaceBindings
|
|
124848
125005
|
};
|
|
124849
125006
|
}
|
|
124850
125007
|
return null;
|
|
@@ -124973,12 +125130,12 @@ function collectXmlElementRanges(xml, options = {}) {
|
|
|
124973
125130
|
onCloseTag(event) {
|
|
124974
125131
|
if (event.tag.isSelfClosing)
|
|
124975
125132
|
return;
|
|
124976
|
-
const
|
|
124977
|
-
if (!
|
|
125133
|
+
const open2 = stack.pop();
|
|
125134
|
+
if (!open2)
|
|
124978
125135
|
return;
|
|
124979
125136
|
ranges.push({
|
|
124980
|
-
...
|
|
124981
|
-
openEnd:
|
|
125137
|
+
...open2,
|
|
125138
|
+
openEnd: open2.end,
|
|
124982
125139
|
closeStart: event.start,
|
|
124983
125140
|
end: event.end
|
|
124984
125141
|
});
|
|
@@ -132660,12 +132817,12 @@ var activeProbe = null;
|
|
|
132660
132817
|
function matchLeadingElement(xml, localName2) {
|
|
132661
132818
|
const name = escapeRegExp2(localName2);
|
|
132662
132819
|
const openRe = new RegExp(`^<(${qnamePattern(name)})${ATTRS}(/?)>`);
|
|
132663
|
-
const
|
|
132664
|
-
if (!
|
|
132820
|
+
const open2 = openRe.exec(xml);
|
|
132821
|
+
if (!open2)
|
|
132665
132822
|
return "";
|
|
132666
|
-
if (
|
|
132667
|
-
return
|
|
132668
|
-
const qname = escapeRegExp2(
|
|
132823
|
+
if (open2[2] === "/")
|
|
132824
|
+
return open2[0];
|
|
132825
|
+
const qname = escapeRegExp2(open2[1]);
|
|
132669
132826
|
const tagRe = new RegExp(`<(/?)${qname}(?=[\\s/>])${ATTRS}(/?)>`, "g");
|
|
132670
132827
|
let depth = 0;
|
|
132671
132828
|
let m;
|
|
@@ -132685,13 +132842,13 @@ function matchLeadingElement(xml, localName2) {
|
|
|
132685
132842
|
function findFirstElement(xml, localName2) {
|
|
132686
132843
|
const name = escapeRegExp2(localName2);
|
|
132687
132844
|
const openRe = new RegExp(`<${qnamePattern(name)}${ATTRS}/?>`);
|
|
132688
|
-
const
|
|
132689
|
-
if (!
|
|
132845
|
+
const open2 = openRe.exec(xml);
|
|
132846
|
+
if (!open2)
|
|
132690
132847
|
return null;
|
|
132691
|
-
const slice = matchLeadingElement(xml.slice(
|
|
132848
|
+
const slice = matchLeadingElement(xml.slice(open2.index), localName2);
|
|
132692
132849
|
if (!slice)
|
|
132693
132850
|
return null;
|
|
132694
|
-
return { start:
|
|
132851
|
+
return { start: open2.index, end: open2.index + slice.length, xml: slice };
|
|
132695
132852
|
}
|
|
132696
132853
|
function findAllElements(xml, localName2) {
|
|
132697
132854
|
const spans = [];
|
|
@@ -135045,7 +135202,7 @@ function safeProofingBoundary(element) {
|
|
|
135045
135202
|
return is(element, "proofErr") && element.tag.isSelfClosing && element.children.length === 0 && ["spellStart", "spellEnd", "gramStart", "gramEnd"].includes(attr(element, "type") ?? "") && Object.values(element.tag.attributes).every((attribute) => attribute.uri === "http://www.w3.org/2000/xmlns/" || attribute.uri === W2 && attribute.local === "type");
|
|
135046
135203
|
}
|
|
135047
135204
|
function safeControlContent(children, isRun) {
|
|
135048
|
-
const
|
|
135205
|
+
const open2 = new Set;
|
|
135049
135206
|
for (const child of children) {
|
|
135050
135207
|
if (isRun(child))
|
|
135051
135208
|
continue;
|
|
@@ -135054,15 +135211,15 @@ function safeControlContent(children, isRun) {
|
|
|
135054
135211
|
const type = attr(child, "type");
|
|
135055
135212
|
const family = type.startsWith("spell") ? "spell" : "gram";
|
|
135056
135213
|
if (type.endsWith("Start")) {
|
|
135057
|
-
if (
|
|
135214
|
+
if (open2.has(family))
|
|
135058
135215
|
return false;
|
|
135059
|
-
|
|
135216
|
+
open2.add(family);
|
|
135060
135217
|
} else {
|
|
135061
|
-
if (!
|
|
135218
|
+
if (!open2.delete(family))
|
|
135062
135219
|
return false;
|
|
135063
135220
|
}
|
|
135064
135221
|
}
|
|
135065
|
-
return
|
|
135222
|
+
return open2.size === 0;
|
|
135066
135223
|
}
|
|
135067
135224
|
function control(xml, element) {
|
|
135068
135225
|
if (!is(element, "sdt"))
|
|
@@ -136218,16 +136375,16 @@ function findXmlTagEnd2(xml, start) {
|
|
|
136218
136375
|
return -1;
|
|
136219
136376
|
}
|
|
136220
136377
|
function parseXmlStartTag(rawTag) {
|
|
136221
|
-
const
|
|
136222
|
-
if (!
|
|
136378
|
+
const open2 = /^<([A-Za-z_][\w.-]*(?::[A-Za-z_][\w.-]*)?)/.exec(rawTag);
|
|
136379
|
+
if (!open2)
|
|
136223
136380
|
return null;
|
|
136224
|
-
const qname =
|
|
136381
|
+
const qname = open2[1];
|
|
136225
136382
|
const split = qname.indexOf(":");
|
|
136226
136383
|
const prefix = split < 0 ? "" : qname.slice(0, split);
|
|
136227
136384
|
const localName2 = split < 0 ? qname : qname.slice(split + 1);
|
|
136228
136385
|
const attributes = [];
|
|
136229
136386
|
const seen = new Set;
|
|
136230
|
-
let position =
|
|
136387
|
+
let position = open2[0].length;
|
|
136231
136388
|
while (position < rawTag.length) {
|
|
136232
136389
|
const whitespaceStart = position;
|
|
136233
136390
|
while (/\s/.test(rawTag[position] ?? ""))
|
|
@@ -136481,13 +136638,13 @@ function collectWordParagraphRanges(xml) {
|
|
|
136481
136638
|
openParagraphs.push({ start: pendingStart, depth, paraId, namespaceBindings });
|
|
136482
136639
|
});
|
|
136483
136640
|
parser.on("closetag", (tag) => {
|
|
136484
|
-
const
|
|
136485
|
-
if (
|
|
136641
|
+
const open2 = openParagraphs.at(-1);
|
|
136642
|
+
if (open2 && open2.depth === depth && tag.uri === W_NS2 && tag.local === "p") {
|
|
136486
136643
|
ranges.push({
|
|
136487
|
-
start:
|
|
136644
|
+
start: open2.start,
|
|
136488
136645
|
end: parser.position,
|
|
136489
|
-
paraId:
|
|
136490
|
-
namespaceBindings:
|
|
136646
|
+
paraId: open2.paraId,
|
|
136647
|
+
namespaceBindings: open2.namespaceBindings
|
|
136491
136648
|
});
|
|
136492
136649
|
openParagraphs.pop();
|
|
136493
136650
|
}
|
|
@@ -136559,9 +136716,9 @@ function escapeXmlAttribute2(value) {
|
|
|
136559
136716
|
}
|
|
136560
136717
|
function directParagraphParts(paragraphXml, namespaceBindings) {
|
|
136561
136718
|
XML_TAG_RE2.lastIndex = 0;
|
|
136562
|
-
const
|
|
136719
|
+
const open2 = XML_TAG_RE2.exec(paragraphXml);
|
|
136563
136720
|
const closeStart = paragraphXml.lastIndexOf("</");
|
|
136564
|
-
if (!
|
|
136721
|
+
if (!open2 || closeStart <= XML_TAG_RE2.lastIndex)
|
|
136565
136722
|
return { properties: "", runs: "" };
|
|
136566
136723
|
const inner = paragraphXml.slice(XML_TAG_RE2.lastIndex, closeStart);
|
|
136567
136724
|
const properties = topLevelElements(inner).find((element) => {
|
|
@@ -142063,28 +142220,28 @@ function buildElementRangeIndex(xml, initialNamespaceBindings = {}) {
|
|
|
142063
142220
|
continue;
|
|
142064
142221
|
}
|
|
142065
142222
|
for (let i = stack.length - 1;i >= 0; i -= 1) {
|
|
142066
|
-
const
|
|
142067
|
-
if (
|
|
142223
|
+
const open2 = stack[i];
|
|
142224
|
+
if (open2.localName !== localName2 || open2.prefix !== prefix)
|
|
142068
142225
|
continue;
|
|
142069
142226
|
stack.splice(i, 1);
|
|
142070
142227
|
const parent = stack[i - 1];
|
|
142071
142228
|
const row = stack[i - 2];
|
|
142072
|
-
if (
|
|
142073
|
-
emptyRowRevisionEnds.set(
|
|
142229
|
+
if (open2.wordTrackedMarkup && (localName2 === "ins" || localName2 === "del") && parent?.localName === "trPr" && parent.namespaceBindings[parent.prefix] === NS_W && row?.localName === "tr" && row.namespaceBindings[row.prefix] === NS_W && xml.slice(open2.openEnd, tag.start).trim() === "") {
|
|
142230
|
+
emptyRowRevisionEnds.set(open2.start, tag.end);
|
|
142074
142231
|
}
|
|
142075
|
-
if (
|
|
142232
|
+
if (open2.wordTrackedMarkup)
|
|
142076
142233
|
wordTrackedMarkupTagStarts.add(tag.start);
|
|
142077
142234
|
entries.push({
|
|
142078
142235
|
localName: localName2,
|
|
142079
|
-
namespaceUri:
|
|
142080
|
-
namespaceBindings:
|
|
142081
|
-
start:
|
|
142082
|
-
openEnd:
|
|
142236
|
+
namespaceUri: open2.namespaceBindings[open2.prefix],
|
|
142237
|
+
namespaceBindings: open2.namespaceBindings,
|
|
142238
|
+
start: open2.start,
|
|
142239
|
+
openEnd: open2.openEnd,
|
|
142083
142240
|
closeStart: tag.start,
|
|
142084
142241
|
end: tag.end
|
|
142085
142242
|
});
|
|
142086
|
-
if (
|
|
142087
|
-
recordMoveRangeMarker(
|
|
142243
|
+
if (open2.moveRangeMarker && isEmptyMoveMarkerContent(xml.slice(open2.moveRangeMarker.contentStart, tag.start))) {
|
|
142244
|
+
recordMoveRangeMarker(open2.moveRangeMarker, tag.end);
|
|
142088
142245
|
}
|
|
142089
142246
|
break;
|
|
142090
142247
|
}
|
|
@@ -144500,12 +144657,12 @@ function awaitSourceConsumer(producer, signal) {
|
|
|
144500
144657
|
observeProducer(producer, consumers);
|
|
144501
144658
|
}
|
|
144502
144659
|
const active = consumers;
|
|
144503
|
-
return new Promise((
|
|
144660
|
+
return new Promise((resolve2, reject) => {
|
|
144504
144661
|
const consume = (outcome) => {
|
|
144505
144662
|
active.delete(consume);
|
|
144506
144663
|
signal.removeEventListener("abort", abort);
|
|
144507
144664
|
if (outcome.ok)
|
|
144508
|
-
|
|
144665
|
+
resolve2(outcome.value);
|
|
144509
144666
|
else
|
|
144510
144667
|
reject(outcome.error);
|
|
144511
144668
|
};
|
|
@@ -145163,8 +145320,8 @@ function scanTextboxesFromXml(input) {
|
|
|
145163
145320
|
let tagsVisited = 0;
|
|
145164
145321
|
let peakHostDepth = 0;
|
|
145165
145322
|
let fallbackDepth = 0;
|
|
145166
|
-
const emit = (
|
|
145167
|
-
byOrdinal[
|
|
145323
|
+
const emit = (open2, endChar, endByte) => {
|
|
145324
|
+
byOrdinal[open2.ordinal] = { ...open2, endChar, endByte };
|
|
145168
145325
|
};
|
|
145169
145326
|
while (pos < xml.length) {
|
|
145170
145327
|
const openIdx = xml.indexOf("<", pos);
|
|
@@ -145210,9 +145367,9 @@ function scanTextboxesFromXml(input) {
|
|
|
145210
145367
|
continue;
|
|
145211
145368
|
}
|
|
145212
145369
|
if (parsedTag.localName === "txbxContent" && parsedTag.close) {
|
|
145213
|
-
const
|
|
145214
|
-
if (
|
|
145215
|
-
emit(
|
|
145370
|
+
const open3 = stack.pop();
|
|
145371
|
+
if (open3)
|
|
145372
|
+
emit(open3, gtIdx + 1, tagEndByte);
|
|
145216
145373
|
continue;
|
|
145217
145374
|
}
|
|
145218
145375
|
if (parsedTag.localName !== "txbxContent" || parsedTag.close)
|
|
@@ -145221,7 +145378,7 @@ function scanTextboxesFromXml(input) {
|
|
|
145221
145378
|
const ctxAfter = xml.slice(gtIdx + 1, Math.min(xml.length, gtIdx + 1 + 4096));
|
|
145222
145379
|
const family = stack.length > 0 ? "nested" : fallbackDepth > 0 ? "mce-fallback" : classifyTextboxFamily(ctxBefore, ctxAfter, input.hostKind);
|
|
145223
145380
|
const ordinal = nextOrdinal++;
|
|
145224
|
-
const
|
|
145381
|
+
const open2 = {
|
|
145225
145382
|
ordinal,
|
|
145226
145383
|
startChar: openIdx,
|
|
145227
145384
|
startByte: tagStartByte,
|
|
@@ -145231,9 +145388,9 @@ function scanTextboxesFromXml(input) {
|
|
|
145231
145388
|
alternateContentHost: alternateContentStack.at(-1) ?? null
|
|
145232
145389
|
};
|
|
145233
145390
|
if (parsedTag.selfClosing) {
|
|
145234
|
-
emit(
|
|
145391
|
+
emit(open2, gtIdx + 1, tagEndByte);
|
|
145235
145392
|
} else {
|
|
145236
|
-
stack.push(
|
|
145393
|
+
stack.push(open2);
|
|
145237
145394
|
}
|
|
145238
145395
|
}
|
|
145239
145396
|
while (stack.length > 0) {
|
|
@@ -147305,12 +147462,12 @@ var init_textbox_registry = __esm(() => {
|
|
|
147305
147462
|
EMPTY_TEXTBOX_STORY_RANGES = new Map;
|
|
147306
147463
|
EMPTY_TEXTBOX_AUXILIARY_STORY_EFFECTS = Object.freeze([]);
|
|
147307
147464
|
SDLazyReadonlyMap = class SDLazyReadonlyMap extends Map {
|
|
147308
|
-
constructor(source,
|
|
147465
|
+
constructor(source, resolve2) {
|
|
147309
147466
|
super();
|
|
147310
147467
|
_SDLazyReadonlyMap_source.set(this, undefined);
|
|
147311
147468
|
_SDLazyReadonlyMap_resolve.set(this, undefined);
|
|
147312
147469
|
__classPrivateFieldSet4(this, _SDLazyReadonlyMap_source, source, "f");
|
|
147313
|
-
__classPrivateFieldSet4(this, _SDLazyReadonlyMap_resolve,
|
|
147470
|
+
__classPrivateFieldSet4(this, _SDLazyReadonlyMap_resolve, resolve2, "f");
|
|
147314
147471
|
}
|
|
147315
147472
|
get size() {
|
|
147316
147473
|
return __classPrivateFieldGet4(this, _SDLazyReadonlyMap_source, "f").size;
|
|
@@ -147431,8 +147588,8 @@ function parseSectPrFragment(input) {
|
|
|
147431
147588
|
if (local === "sd-sectpr-wrap")
|
|
147432
147589
|
return;
|
|
147433
147590
|
const startByte = translate(wrapper.lastIndexOf("<", parser.position - 1));
|
|
147434
|
-
const
|
|
147435
|
-
stack.push(
|
|
147591
|
+
const open2 = { qkey: qnameKey(ns, local), namespaceUri: ns, localName: local, byteStart: startByte, byteEnd: -1 };
|
|
147592
|
+
stack.push(open2);
|
|
147436
147593
|
if (preimageBuf) {
|
|
147437
147594
|
preimageBuf.inSectPr = preimageBuf.inSectPr || ns === NS_W && local === "sectPr";
|
|
147438
147595
|
return;
|
|
@@ -154120,13 +154277,13 @@ function concatChunks(chunks, maxBytes) {
|
|
|
154120
154277
|
return out;
|
|
154121
154278
|
}
|
|
154122
154279
|
function yieldToMainThread() {
|
|
154123
|
-
return new Promise((
|
|
154280
|
+
return new Promise((resolve2) => {
|
|
154124
154281
|
const requestAnimationFrameFn = globalThis.requestAnimationFrame;
|
|
154125
154282
|
if (typeof requestAnimationFrameFn === "function") {
|
|
154126
|
-
requestAnimationFrameFn(() =>
|
|
154283
|
+
requestAnimationFrameFn(() => resolve2());
|
|
154127
154284
|
return;
|
|
154128
154285
|
}
|
|
154129
|
-
setTimeout(
|
|
154286
|
+
setTimeout(resolve2, 0);
|
|
154130
154287
|
});
|
|
154131
154288
|
}
|
|
154132
154289
|
function readU16(buf, p) {
|
|
@@ -154842,10 +154999,10 @@ function collectSoftInvariants(diagnostics, parts, relsParts, rootRelationships,
|
|
|
154842
154999
|
}
|
|
154843
155000
|
}
|
|
154844
155001
|
}
|
|
154845
|
-
function evaluatePackageInvariants(
|
|
155002
|
+
function evaluatePackageInvariants(open2) {
|
|
154846
155003
|
const hard = [];
|
|
154847
155004
|
const soft = [];
|
|
154848
|
-
const pkg =
|
|
155005
|
+
const pkg = open2.pkg;
|
|
154849
155006
|
if (!pkg.zip.isZip)
|
|
154850
155007
|
hard.push("package-not-zip");
|
|
154851
155008
|
if (pkg.contentTypes.parseError)
|
|
@@ -157895,8 +158052,8 @@ function createCancelToken() {
|
|
|
157895
158052
|
awaitCancelled() {
|
|
157896
158053
|
if (cancelled)
|
|
157897
158054
|
return Promise.resolve();
|
|
157898
|
-
return new Promise((
|
|
157899
|
-
waiters.push(
|
|
158055
|
+
return new Promise((resolve2) => {
|
|
158056
|
+
waiters.push(resolve2);
|
|
157900
158057
|
});
|
|
157901
158058
|
},
|
|
157902
158059
|
cancel(r) {
|
|
@@ -161244,8 +161401,8 @@ function canRunSourceLoader(openResult) {
|
|
|
161244
161401
|
return true;
|
|
161245
161402
|
}
|
|
161246
161403
|
function timeoutSignal() {
|
|
161247
|
-
return new Promise((
|
|
161248
|
-
const handle = globalThis.setTimeout(() =>
|
|
161404
|
+
return new Promise((resolve2) => {
|
|
161405
|
+
const handle = globalThis.setTimeout(() => resolve2("timeout"), DISPOSE_TIMEOUT_MS);
|
|
161249
161406
|
if (typeof handle.unref === "function") {
|
|
161250
161407
|
handle.unref();
|
|
161251
161408
|
}
|
|
@@ -161887,7 +162044,7 @@ function scanSecondaryStory(input) {
|
|
|
161887
162044
|
const byteStart = utf8ByteOffset(xml, openOffset);
|
|
161888
162045
|
const isWrapperRoot = stack.length === 0 && ns === NS_W && (local === "hdr" || local === "ftr");
|
|
161889
162046
|
const isStoryChild = stack.length === 1;
|
|
161890
|
-
const
|
|
162047
|
+
const open2 = {
|
|
161891
162048
|
ns,
|
|
161892
162049
|
local,
|
|
161893
162050
|
byteStart,
|
|
@@ -161895,13 +162052,13 @@ function scanSecondaryStory(input) {
|
|
|
161895
162052
|
storyChildOrdinal: isStoryChild ? nextStoryChildOrdinal++ : null,
|
|
161896
162053
|
isPPr: false
|
|
161897
162054
|
};
|
|
161898
|
-
stack.push(
|
|
162055
|
+
stack.push(open2);
|
|
161899
162056
|
if (isWrapperRoot)
|
|
161900
162057
|
return;
|
|
161901
162058
|
if (isStoryChild && ns === NS_W && local === "p") {
|
|
161902
162059
|
openParagraph = {
|
|
161903
162060
|
byteStart,
|
|
161904
|
-
bodyChildOrdinal:
|
|
162061
|
+
bodyChildOrdinal: open2.storyChildOrdinal,
|
|
161905
162062
|
styleId: null,
|
|
161906
162063
|
outlineLvl: null,
|
|
161907
162064
|
numId: null,
|
|
@@ -161916,7 +162073,7 @@ function scanSecondaryStory(input) {
|
|
|
161916
162073
|
if (ns === NS_W && local === "pPr") {
|
|
161917
162074
|
const parent = stack[stack.length - 2];
|
|
161918
162075
|
if (parent?.ns === NS_W && parent?.local === "p") {
|
|
161919
|
-
|
|
162076
|
+
open2.isPPr = true;
|
|
161920
162077
|
openParagraphInsidePPr = true;
|
|
161921
162078
|
}
|
|
161922
162079
|
}
|
|
@@ -164985,19 +165142,19 @@ function elementContainsDescendantRunProperties(xml, element) {
|
|
|
164985
165142
|
return false;
|
|
164986
165143
|
}
|
|
164987
165144
|
function stripParagraphPropertyChange(pPrXml) {
|
|
164988
|
-
const
|
|
164989
|
-
if (!
|
|
165145
|
+
const open2 = /<([\w.-]+):pPrChange\b[^>]*?(\/?)>/.exec(pPrXml);
|
|
165146
|
+
if (!open2)
|
|
164990
165147
|
return pPrXml;
|
|
164991
165148
|
let end;
|
|
164992
|
-
if (
|
|
164993
|
-
end =
|
|
165149
|
+
if (open2[2] === "/") {
|
|
165150
|
+
end = open2.index + open2[0].length;
|
|
164994
165151
|
} else {
|
|
164995
|
-
const close = pPrXml.indexOf(`</${
|
|
165152
|
+
const close = pPrXml.indexOf(`</${open2[1]}:pPrChange>`, open2.index + open2[0].length);
|
|
164996
165153
|
if (close === -1)
|
|
164997
165154
|
return pPrXml;
|
|
164998
|
-
end = close + `</${
|
|
165155
|
+
end = close + `</${open2[1]}:pPrChange>`.length;
|
|
164999
165156
|
}
|
|
165000
|
-
const stripped = pPrXml.slice(0,
|
|
165157
|
+
const stripped = pPrXml.slice(0, open2.index) + pPrXml.slice(end);
|
|
165001
165158
|
return /^<([\w.-]+):pPr\b[^>]*>\s*<\/\1:pPr>$/.test(stripped.trim()) ? "" : stripped;
|
|
165002
165159
|
}
|
|
165003
165160
|
function replaceDirectParagraphStyleId(pPrXml, newStyleId) {
|
|
@@ -168033,10 +168190,10 @@ function parseNumberingXml(xml) {
|
|
|
168033
168190
|
};
|
|
168034
168191
|
}
|
|
168035
168192
|
function hasNumberingRoot(xml) {
|
|
168036
|
-
const
|
|
168037
|
-
if (!
|
|
168193
|
+
const open2 = /<((?:[\w.-]+:)?numbering)\b[^>]*>/.exec(xml);
|
|
168194
|
+
if (!open2)
|
|
168038
168195
|
return false;
|
|
168039
|
-
const qname =
|
|
168196
|
+
const qname = open2[1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
168040
168197
|
return new RegExp(`</${qname}\\s*>`).test(xml);
|
|
168041
168198
|
}
|
|
168042
168199
|
function parseMultiLevelType(block) {
|
|
@@ -171667,10 +171824,10 @@ function isEligibleGroupParagraph(lookupContext, partXml, paragraph) {
|
|
|
171667
171824
|
return true;
|
|
171668
171825
|
}
|
|
171669
171826
|
function readLeadingParagraphPropertyBlock(paragraphXml) {
|
|
171670
|
-
const
|
|
171671
|
-
if (!
|
|
171827
|
+
const open2 = /^<[\w.-]+:p\b[^>]*>\s*/.exec(paragraphXml);
|
|
171828
|
+
if (!open2)
|
|
171672
171829
|
return null;
|
|
171673
|
-
const start =
|
|
171830
|
+
const start = open2[0].length;
|
|
171674
171831
|
const first = /^<[\w.-]+:pPr\b[^>]*?(\/?)>/.exec(paragraphXml.slice(start));
|
|
171675
171832
|
if (!first)
|
|
171676
171833
|
return null;
|
|
@@ -172745,8 +172902,8 @@ function parsePropertyChildElements(innerXml) {
|
|
|
172745
172902
|
const isClose = match[1] === "/";
|
|
172746
172903
|
const localName2 = match[3];
|
|
172747
172904
|
if (isClose) {
|
|
172748
|
-
const
|
|
172749
|
-
if (!
|
|
172905
|
+
const open2 = stack.pop();
|
|
172906
|
+
if (!open2 || open2.localName !== localName2)
|
|
172750
172907
|
return null;
|
|
172751
172908
|
continue;
|
|
172752
172909
|
}
|
|
@@ -175714,12 +175871,12 @@ function findEnclosingOverlapFragment(child, entries) {
|
|
|
175714
175871
|
}
|
|
175715
175872
|
function indexEnclosingOverlapFragments(entries) {
|
|
175716
175873
|
const result = new Map;
|
|
175717
|
-
const
|
|
175874
|
+
const open2 = [];
|
|
175718
175875
|
for (const entry of entries) {
|
|
175719
|
-
while (
|
|
175720
|
-
|
|
175876
|
+
while (open2.length > 0 && open2[open2.length - 1].fragment.byteEnd <= entry.fragment.byteStart) {
|
|
175877
|
+
open2.pop();
|
|
175721
175878
|
}
|
|
175722
|
-
const candidate2 =
|
|
175879
|
+
const candidate2 = open2[open2.length - 1] ?? null;
|
|
175723
175880
|
if (candidate2 && candidate2.fragment.byteStart < entry.fragment.byteStart && candidate2.fragment.byteEnd > entry.fragment.byteEnd) {
|
|
175724
175881
|
result.set(entry, candidate2);
|
|
175725
175882
|
} else if (candidate2) {
|
|
@@ -175727,7 +175884,7 @@ function indexEnclosingOverlapFragments(entries) {
|
|
|
175727
175884
|
} else {
|
|
175728
175885
|
result.set(entry, null);
|
|
175729
175886
|
}
|
|
175730
|
-
|
|
175887
|
+
open2.push(entry);
|
|
175731
175888
|
}
|
|
175732
175889
|
return result;
|
|
175733
175890
|
}
|
|
@@ -177707,10 +177864,10 @@ function stripNestedStructuralListWrappers(xml, kind, partNamespaces) {
|
|
|
177707
177864
|
onCloseTag(event) {
|
|
177708
177865
|
if (event.tag.namespaceUri !== NS_W || event.tag.localName !== kind || event.tag.isSelfClosing)
|
|
177709
177866
|
return;
|
|
177710
|
-
const
|
|
177711
|
-
if (!
|
|
177867
|
+
const open2 = stack.pop();
|
|
177868
|
+
if (!open2 || open2.start === 0 && event.end === xml.length)
|
|
177712
177869
|
return;
|
|
177713
|
-
ranges.push({ start:
|
|
177870
|
+
ranges.push({ start: open2.start, end: event.end });
|
|
177714
177871
|
}
|
|
177715
177872
|
});
|
|
177716
177873
|
if (ranges.length === 0)
|
|
@@ -178073,11 +178230,11 @@ function localParagraphOpenBefore(partXml, position) {
|
|
|
178073
178230
|
const found = partXml.lastIndexOf(":p", cursor);
|
|
178074
178231
|
if (found < 0)
|
|
178075
178232
|
return -1;
|
|
178076
|
-
const
|
|
178077
|
-
if (
|
|
178233
|
+
const open2 = partXml.lastIndexOf("<", found);
|
|
178234
|
+
if (open2 >= 0 && /^<[\w.-]+:p$/.test(partXml.slice(open2, found + 2))) {
|
|
178078
178235
|
const boundary = partXml.charAt(found + 2);
|
|
178079
178236
|
if (boundary === " " || boundary === ">" || boundary === "/")
|
|
178080
|
-
return
|
|
178237
|
+
return open2;
|
|
178081
178238
|
}
|
|
178082
178239
|
cursor = found - 1;
|
|
178083
178240
|
}
|
|
@@ -178539,12 +178696,12 @@ function collectNestedSameKindWrapperRanges(xml, kind) {
|
|
|
178539
178696
|
stack.push({ start: byteStart });
|
|
178540
178697
|
continue;
|
|
178541
178698
|
}
|
|
178542
|
-
const
|
|
178543
|
-
if (!
|
|
178699
|
+
const open2 = stack.pop();
|
|
178700
|
+
if (!open2)
|
|
178544
178701
|
continue;
|
|
178545
|
-
if (
|
|
178702
|
+
if (open2.start === 0 && byteEnd === xml.length)
|
|
178546
178703
|
continue;
|
|
178547
|
-
ranges.push({ start:
|
|
178704
|
+
ranges.push({ start: open2.start, end: byteEnd });
|
|
178548
178705
|
}
|
|
178549
178706
|
return coalesceRanges(ranges);
|
|
178550
178707
|
}
|
|
@@ -181276,11 +181433,11 @@ function withoutAnnotationGraphEntries(xml, partUri) {
|
|
|
181276
181433
|
if (parsed.errors.length)
|
|
181277
181434
|
return null;
|
|
181278
181435
|
const spans = parsed.ranges.filter((range) => {
|
|
181279
|
-
const
|
|
181436
|
+
const open2 = xml.slice(range.start, range.openEnd);
|
|
181280
181437
|
if (partUri === "/word/_rels/document.xml.rels") {
|
|
181281
|
-
return range.tag.namespaceUri === "http://schemas.openxmlformats.org/package/2006/relationships" && range.tag.localName === "Relationship" && ["comments", "commentsExtended", "commentsIds"].some((kind) => readXmlAttributeValueByLocalName(
|
|
181438
|
+
return range.tag.namespaceUri === "http://schemas.openxmlformats.org/package/2006/relationships" && range.tag.localName === "Relationship" && ["comments", "commentsExtended", "commentsIds"].some((kind) => readXmlAttributeValueByLocalName(open2, "Type") === RELATIONSHIP_TYPE_FOR_KIND[kind] && readXmlAttributeValueByLocalName(open2, "Target") === `${kind}.xml`) && !!readXmlAttributeValueByLocalName(open2, "Id") && readXmlAttributeValueByLocalName(open2, "TargetMode") == null;
|
|
181282
181439
|
}
|
|
181283
|
-
return range.tag.namespaceUri === "http://schemas.openxmlformats.org/package/2006/content-types" && range.tag.localName === "Override" && ["comments", "commentsExtended", "commentsIds"].some((kind) => readXmlAttributeValueByLocalName(
|
|
181440
|
+
return range.tag.namespaceUri === "http://schemas.openxmlformats.org/package/2006/content-types" && range.tag.localName === "Override" && ["comments", "commentsExtended", "commentsIds"].some((kind) => readXmlAttributeValueByLocalName(open2, "PartName") === `/word/${kind}.xml` && readXmlAttributeValueByLocalName(open2, "ContentType") === CONTENT_TYPE_FOR_KIND[kind]);
|
|
181284
181441
|
}).sort((a, b) => b.start - a.start);
|
|
181285
181442
|
let result = xml;
|
|
181286
181443
|
for (const span of spans)
|
|
@@ -181884,7 +182041,7 @@ function structuralReviewAnchorSignature(xml) {
|
|
|
181884
182041
|
}
|
|
181885
182042
|
function reviewRangesStayWithinSlices(slices) {
|
|
181886
182043
|
for (const slice of slices) {
|
|
181887
|
-
const
|
|
182044
|
+
const open2 = new Set;
|
|
181888
182045
|
STRUCTURAL_REVIEW_RANGE_TAG_RE.lastIndex = 0;
|
|
181889
182046
|
for (let match = STRUCTURAL_REVIEW_RANGE_TAG_RE.exec(slice);match; match = STRUCTURAL_REVIEW_RANGE_TAG_RE.exec(slice)) {
|
|
181890
182047
|
const tag = match[1];
|
|
@@ -181892,14 +182049,14 @@ function reviewRangesStayWithinSlices(slices) {
|
|
|
181892
182049
|
const family = tag.startsWith("comment") ? "comment" : "perm";
|
|
181893
182050
|
const key2 = `${family}:${id}`;
|
|
181894
182051
|
if (tag.endsWith("Start")) {
|
|
181895
|
-
if (
|
|
182052
|
+
if (open2.has(key2))
|
|
181896
182053
|
return false;
|
|
181897
|
-
|
|
181898
|
-
} else if (!
|
|
182054
|
+
open2.add(key2);
|
|
182055
|
+
} else if (!open2.delete(key2)) {
|
|
181899
182056
|
return false;
|
|
181900
182057
|
}
|
|
181901
182058
|
}
|
|
181902
|
-
if (
|
|
182059
|
+
if (open2.size > 0)
|
|
181903
182060
|
return false;
|
|
181904
182061
|
}
|
|
181905
182062
|
return true;
|
|
@@ -181913,10 +182070,10 @@ function retainOriginParagraphSliceXml(state, partUri, byteStart, byteEnd) {
|
|
|
181913
182070
|
function extractDrawingSegments(xml) {
|
|
181914
182071
|
const segments = [];
|
|
181915
182072
|
DRAWING_OPEN_RE.lastIndex = 0;
|
|
181916
|
-
let
|
|
181917
|
-
while (
|
|
182073
|
+
let open2 = DRAWING_OPEN_RE.exec(xml);
|
|
182074
|
+
while (open2) {
|
|
181918
182075
|
let depth = 1;
|
|
181919
|
-
let cursor =
|
|
182076
|
+
let cursor = open2.index + open2[0].length;
|
|
181920
182077
|
let end = -1;
|
|
181921
182078
|
while (depth > 0) {
|
|
181922
182079
|
DRAWING_OPEN_RE.lastIndex = cursor;
|
|
@@ -181935,9 +182092,9 @@ function extractDrawingSegments(xml) {
|
|
|
181935
182092
|
end = cursor;
|
|
181936
182093
|
}
|
|
181937
182094
|
}
|
|
181938
|
-
segments.push(xml.slice(
|
|
182095
|
+
segments.push(xml.slice(open2.index, end));
|
|
181939
182096
|
DRAWING_OPEN_RE.lastIndex = end;
|
|
181940
|
-
|
|
182097
|
+
open2 = DRAWING_OPEN_RE.exec(xml);
|
|
181941
182098
|
}
|
|
181942
182099
|
return segments;
|
|
181943
182100
|
}
|
|
@@ -193088,8 +193245,8 @@ function rebaseTextOnlyParagraphContexts(xml, previous) {
|
|
|
193088
193245
|
const nodeStart = prior.lastIndexOf("<", start - 1);
|
|
193089
193246
|
if (nodeStart < 0)
|
|
193090
193247
|
return null;
|
|
193091
|
-
for (const [
|
|
193092
|
-
if (prior.lastIndexOf(
|
|
193248
|
+
for (const [open2, close] of [["<!--", "-->"], ["<![CDATA[", "]]>"], ["<?", "?>"]]) {
|
|
193249
|
+
if (prior.lastIndexOf(open2, nodeStart) > prior.lastIndexOf(close, nodeStart))
|
|
193093
193250
|
return null;
|
|
193094
193251
|
}
|
|
193095
193252
|
const node2 = readXmlNodeAt(prior, nodeStart);
|
|
@@ -193827,10 +193984,10 @@ function renderTrackedParagraphMarkProperties(pPrXml, stamp, kind = "ins", marke
|
|
|
193827
193984
|
return pPrXml;
|
|
193828
193985
|
return pPrXml.replace(/\/>\s*$/, `><${pPrRPrName}>${marker(pPrPrefix)}</${pPrRPrName}></${pPrName}>`);
|
|
193829
193986
|
}
|
|
193830
|
-
const
|
|
193831
|
-
if (!
|
|
193987
|
+
const open2 = /^<(?:[\w.-]+:)?pPr\b[^>]*>/.exec(pPrXml)?.[0];
|
|
193988
|
+
if (!open2)
|
|
193832
193989
|
return pPrXml;
|
|
193833
|
-
const inner = pPrXml.slice(
|
|
193990
|
+
const inner = pPrXml.slice(open2.length);
|
|
193834
193991
|
const rPrOffset = inner.search(/<(?:[\w.-]+:)?rPr\b/);
|
|
193835
193992
|
const liveBoundary = inner.search(/<(?:[\w.-]+:)?(?:sectPr|pPrChange)\b/);
|
|
193836
193993
|
if (rPrOffset >= 0 && (liveBoundary < 0 || rPrOffset < liveBoundary)) {
|
|
@@ -193842,12 +193999,12 @@ function renderTrackedParagraphMarkProperties(pPrXml, stamp, kind = "ins", marke
|
|
|
193842
193999
|
return pPrXml;
|
|
193843
194000
|
const rPrPrefix = xmlPrefix(rPrName2) ?? pPrPrefix;
|
|
193844
194001
|
const expanded = rPr.replace(/\/>\s*$/, `>${marker(rPrPrefix)}</${rPrName2}>`);
|
|
193845
|
-
return
|
|
194002
|
+
return open2 + inner.slice(0, rPrOffset) + expanded + inner.slice(rPrOffset + rPr.length);
|
|
193846
194003
|
}
|
|
193847
194004
|
const rPrName = /^<([^\s/>]+)/.exec(rPr)?.[1];
|
|
193848
194005
|
const insertAt2 = markerPosition === "end" ? rPr.lastIndexOf("</") : rPr.indexOf(">") + 1;
|
|
193849
194006
|
if (insertAt2 > 0) {
|
|
193850
|
-
return
|
|
194007
|
+
return open2 + inner.slice(0, rPrOffset) + rPr.slice(0, insertAt2) + marker(xmlPrefix(rPrName) ?? pPrPrefix) + rPr.slice(insertAt2) + inner.slice(rPrOffset + rPr.length);
|
|
193851
194008
|
}
|
|
193852
194009
|
}
|
|
193853
194010
|
}
|
|
@@ -193855,7 +194012,7 @@ function renderTrackedParagraphMarkProperties(pPrXml, stamp, kind = "ins", marke
|
|
|
193855
194012
|
if (pPrClose < 0)
|
|
193856
194013
|
return pPrXml;
|
|
193857
194014
|
const insertAt = liveBoundary >= 0 ? liveBoundary : pPrClose;
|
|
193858
|
-
return
|
|
194015
|
+
return open2 + inner.slice(0, insertAt) + `<${pPrRPrName}>${marker(pPrPrefix)}</${pPrRPrName}>` + inner.slice(insertAt);
|
|
193859
194016
|
}
|
|
193860
194017
|
function xmlPrefix(qname) {
|
|
193861
194018
|
if (!qname)
|
|
@@ -200399,7 +200556,8 @@ function commitTracked(input, view) {
|
|
|
200399
200556
|
storyId: op.on.storyId
|
|
200400
200557
|
}));
|
|
200401
200558
|
const followsDeletedManualBreak = isPureTrackedInsert(op) && op.on.coordinateSpace === "tracked" && parseParagraphInlineMap(paragraphXml).leaves().some((leaf) => leaf.kind === "control" && leaf.control === "br" && leaf.deleted && leaf.trackedEnd === op.on.startOffset);
|
|
200402
|
-
const
|
|
200559
|
+
const sharesDeletedTextBoundary = isPureTrackedInsert(op) && visibleStartOffset !== null && parseParagraphInlineMap(paragraphXml).leaves().some((leaf) => leaf.kind === "text" && leaf.textRole === "deleted" && leaf.decodedText.length > 0 && leaf.visibleStart === visibleStartOffset && leaf.visibleEnd === visibleStartOffset);
|
|
200560
|
+
const resyncFromSession = usedSpanningDelete || usedBookmarkDelete || spansLiveInlineControl || usedTrackedControlRunFallback || followsDeletedManualBreak || sharesDeletedTextBoundary;
|
|
200403
200561
|
return finalizeCommit({
|
|
200404
200562
|
input,
|
|
200405
200563
|
perPart,
|
|
@@ -202855,12 +203013,12 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
|
|
|
202855
203013
|
if (!closeMatch)
|
|
202856
203014
|
return fail4("invalid-range");
|
|
202857
203015
|
const inner = without.slice(childRe.lastIndex, closeMatch.index);
|
|
202858
|
-
const
|
|
203016
|
+
const open2 = without.slice(m.index, childRe.lastIndex);
|
|
202859
203017
|
const attrs = m[3];
|
|
202860
203018
|
tMatch = {
|
|
202861
|
-
open,
|
|
203019
|
+
open: open2,
|
|
202862
203020
|
close: closeMatch[0],
|
|
202863
|
-
xml:
|
|
203021
|
+
xml: open2 + inner + closeMatch[0],
|
|
202864
203022
|
attrs,
|
|
202865
203023
|
inner
|
|
202866
203024
|
};
|
|
@@ -203769,9 +203927,9 @@ function parseEmptyParagraphInsertionSite(paragraphXml, options = {}) {
|
|
|
203769
203927
|
const ns = openTagMatch[1];
|
|
203770
203928
|
if (closeTagMatch[1] !== ns)
|
|
203771
203929
|
return null;
|
|
203772
|
-
const
|
|
203930
|
+
const open2 = openTagMatch[0];
|
|
203773
203931
|
const close = closeTagMatch[0];
|
|
203774
|
-
const inner = paragraphXml.slice(
|
|
203932
|
+
const inner = paragraphXml.slice(open2.length, paragraphXml.length - close.length);
|
|
203775
203933
|
let insertionPoint = 0;
|
|
203776
203934
|
while (insertionPoint < inner.length && /\s/.test(inner[insertionPoint]))
|
|
203777
203935
|
insertionPoint += 1;
|
|
@@ -203788,7 +203946,7 @@ function parseEmptyParagraphInsertionSite(paragraphXml, options = {}) {
|
|
|
203788
203946
|
if (visibleTextLength(remaining) !== 0)
|
|
203789
203947
|
return null;
|
|
203790
203948
|
if (options.contentInsertionCharOffset != null) {
|
|
203791
|
-
const relativeOffset = options.contentInsertionCharOffset -
|
|
203949
|
+
const relativeOffset = options.contentInsertionCharOffset - open2.length;
|
|
203792
203950
|
if (relativeOffset < insertionPoint || relativeOffset > inner.length)
|
|
203793
203951
|
return null;
|
|
203794
203952
|
insertionPoint = relativeOffset;
|
|
@@ -203797,7 +203955,7 @@ function parseEmptyParagraphInsertionSite(paragraphXml, options = {}) {
|
|
|
203797
203955
|
}
|
|
203798
203956
|
}
|
|
203799
203957
|
return {
|
|
203800
|
-
open,
|
|
203958
|
+
open: open2,
|
|
203801
203959
|
prefix: inner.slice(0, insertionPoint),
|
|
203802
203960
|
suffix: inner.slice(insertionPoint),
|
|
203803
203961
|
close,
|
|
@@ -204694,21 +204852,21 @@ function inspectHyperlinkRange(pieces, rangeStart, rangeEnd) {
|
|
|
204694
204852
|
return { found, overlaps: false };
|
|
204695
204853
|
}
|
|
204696
204854
|
function parseSimpleTextRunForRange(runXml, xmlStart, textStart) {
|
|
204697
|
-
const
|
|
204698
|
-
if (!
|
|
204855
|
+
const open2 = /^<([\w.-]+):r\b[^>]*>/.exec(runXml);
|
|
204856
|
+
if (!open2)
|
|
204699
204857
|
return null;
|
|
204700
|
-
const runCloseTag = `</${
|
|
204858
|
+
const runCloseTag = `</${open2[1]}:r>`;
|
|
204701
204859
|
if (!runXml.endsWith(runCloseTag))
|
|
204702
204860
|
return null;
|
|
204703
|
-
const inner = runXml.slice(
|
|
204861
|
+
const inner = runXml.slice(open2[0].length, -runCloseTag.length);
|
|
204704
204862
|
const textOnly = /^\s*(<[\w.-]+:rPr\b[^>]*\/>|<[\w.-]+:rPr\b[\s\S]*?<\/[\w.-]+:rPr>)?\s*((?:<[\w.-]+:t\b[^>]*>[\s\S]*?<\/[\w.-]+:t>\s*)+)$/.exec(inner);
|
|
204705
204863
|
if (!textOnly)
|
|
204706
204864
|
return null;
|
|
204707
204865
|
const textElements = parseRawTextElements(textOnly[2] ?? "");
|
|
204708
204866
|
const length = textElements.reduce((total, element) => total + visibleLengthOfRawXmlText(element.rawText), 0);
|
|
204709
204867
|
return {
|
|
204710
|
-
prefix:
|
|
204711
|
-
runOpenTag:
|
|
204868
|
+
prefix: open2[1],
|
|
204869
|
+
runOpenTag: open2[0],
|
|
204712
204870
|
runCloseTag,
|
|
204713
204871
|
rPrXml: textOnly[1] ?? "",
|
|
204714
204872
|
textElements,
|
|
@@ -205882,9 +206040,9 @@ function restoreParagraphMarkFormattingSnapshot(beforeXml, liveXml, namespaceBin
|
|
|
205882
206040
|
inner = inner.slice(0, marker.start - before.root.openEnd) + inner.slice(marker.end - before.root.openEnd);
|
|
205883
206041
|
}
|
|
205884
206042
|
const liveMarkers = live.markers.map((marker) => liveXml.slice(marker.start, marker.end)).join("");
|
|
205885
|
-
const
|
|
206043
|
+
const open2 = beforeXml.slice(0, before.root.openEnd).replace(/\s*\/>$/, ">");
|
|
205886
206044
|
const prefix = before.root.tag.prefix ? `${before.root.tag.prefix}:` : "";
|
|
205887
|
-
return `${
|
|
206045
|
+
return `${open2}${liveMarkers}${inner}</${prefix}rPr>`;
|
|
205888
206046
|
}
|
|
205889
206047
|
var WORD = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", STRUCTURAL_MARKERS;
|
|
205890
206048
|
var init_paragraph_mark_format_history = __esm(() => {
|
|
@@ -206036,8 +206194,8 @@ function prepareTrackedParagraphProperties(input) {
|
|
|
206036
206194
|
if (!change)
|
|
206037
206195
|
return null;
|
|
206038
206196
|
if (!after.mark || after.mark.tag.isSelfClosing) {
|
|
206039
|
-
const
|
|
206040
|
-
mark =
|
|
206197
|
+
const open2 = after.mark ? after.markXml.replace(/\/>$/, ">") : `<${prefix}:rPr>`;
|
|
206198
|
+
mark = open2 + change + `</${after.mark?.tag.name ?? `${prefix}:rPr`}>`;
|
|
206041
206199
|
} else {
|
|
206042
206200
|
const at = after.mark.closeStart - after.mark.start;
|
|
206043
206201
|
mark = after.markXml.slice(0, at) + change + after.markXml.slice(at);
|
|
@@ -206224,12 +206382,12 @@ function validatePrevalidatedTrackedWrapperSpan(xml, fragment3, span, namespaceB
|
|
|
206224
206382
|
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(openEnd) || !Number.isSafeInteger(closeStart) || !Number.isSafeInteger(end) || start !== fragment3.byteStart || end !== fragment3.byteEnd || start < 0 || start >= openEnd || openEnd > closeStart || closeStart >= end || end > xml.length) {
|
|
206225
206383
|
return null;
|
|
206226
206384
|
}
|
|
206227
|
-
const
|
|
206385
|
+
const open2 = parseRawXmlElementTag(xml.slice(start, openEnd));
|
|
206228
206386
|
const close = parseRawXmlElementTag(xml.slice(closeStart, end));
|
|
206229
|
-
if (!
|
|
206387
|
+
if (!open2 || !close || open2.isClose || open2.selfClose || !close.isClose || close.selfClose || open2.prefix !== close.prefix || open2.localName !== fragment3.kind || close.localName !== fragment3.kind) {
|
|
206230
206388
|
return null;
|
|
206231
206389
|
}
|
|
206232
|
-
return { ...span, prefix:
|
|
206390
|
+
return { ...span, prefix: open2.prefix, namespaceBindings: { [open2.prefix]: NS_W4, ...namespaceBindings } };
|
|
206233
206391
|
}
|
|
206234
206392
|
function decodeXmlText7(escaped) {
|
|
206235
206393
|
return escaped.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
@@ -206769,12 +206927,12 @@ function findNextParagraphElement(xml, fromIndex, allowInsertionWrapper, namespa
|
|
|
206769
206927
|
while (cursor < xml.length && /\s/.test(xml[cursor] ?? ""))
|
|
206770
206928
|
cursor += 1;
|
|
206771
206929
|
}
|
|
206772
|
-
const
|
|
206773
|
-
if (!
|
|
206930
|
+
const open2 = /<([\w.-]+):p\b[^>]*>/.exec(xml.slice(cursor));
|
|
206931
|
+
if (!open2 || open2.index !== 0)
|
|
206774
206932
|
return null;
|
|
206775
|
-
const start = cursor +
|
|
206776
|
-
const prefix =
|
|
206777
|
-
const openTag =
|
|
206933
|
+
const start = cursor + open2.index;
|
|
206934
|
+
const prefix = open2[1];
|
|
206935
|
+
const openTag = open2[0];
|
|
206778
206936
|
if (/\/>$/.test(openTag)) {
|
|
206779
206937
|
return { start, end: start + openTag.length, xml: openTag, wrapper: null };
|
|
206780
206938
|
}
|
|
@@ -207900,11 +208058,11 @@ function setRowGridAfter(lookupContext, rowXml, gridAfter, widthAfter) {
|
|
|
207900
208058
|
if (!trPrRange) {
|
|
207901
208059
|
if (!gridAfterXml)
|
|
207902
208060
|
return rowXml;
|
|
207903
|
-
const
|
|
207904
|
-
if (!
|
|
208061
|
+
const open2 = /^<([\w.-]+):tr\b[^>]*>/.exec(rowXml);
|
|
208062
|
+
if (!open2)
|
|
207905
208063
|
return rowXml;
|
|
207906
|
-
const insertAt = findDirectChildRanges(rowXml, "tblPrEx", lookupContext)[0]?.end ??
|
|
207907
|
-
return rowXml.slice(0, insertAt) + `<${
|
|
208064
|
+
const insertAt = findDirectChildRanges(rowXml, "tblPrEx", lookupContext)[0]?.end ?? open2[0].length;
|
|
208065
|
+
return rowXml.slice(0, insertAt) + `<${open2[1]}:trPr>${gridAfterXml}</${open2[1]}:trPr>` + rowXml.slice(insertAt);
|
|
207908
208066
|
}
|
|
207909
208067
|
const trPrXml = rowXml.slice(trPrRange.start, trPrRange.end);
|
|
207910
208068
|
if (/^<[\w.-]+:trPr\b[^>]*\/>\s*$/.test(trPrXml)) {
|
|
@@ -208343,10 +208501,10 @@ function isCompleteParagraphWindow(paragraph) {
|
|
|
208343
208501
|
return Number.isSafeInteger(paragraph.byteStart) && Number.isSafeInteger(paragraph.byteEnd) && paragraph.byteStart >= 0 && paragraph.byteEnd > paragraph.byteStart;
|
|
208344
208502
|
}
|
|
208345
208503
|
function isOneCompleteParagraph(xml) {
|
|
208346
|
-
const
|
|
208347
|
-
if (!
|
|
208504
|
+
const open2 = /^<([\w.-]+):p\b[^>]*>/.exec(xml);
|
|
208505
|
+
if (!open2)
|
|
208348
208506
|
return false;
|
|
208349
|
-
const close = `</${
|
|
208507
|
+
const close = `</${open2[1]}:p>`;
|
|
208350
208508
|
return xml.endsWith(close) && xml.indexOf(close) === xml.length - close.length;
|
|
208351
208509
|
}
|
|
208352
208510
|
function resolveUniqueLocalFragment(xml, source) {
|
|
@@ -209066,10 +209224,10 @@ function normalizeShifts(candidates) {
|
|
|
209066
209224
|
return out;
|
|
209067
209225
|
}
|
|
209068
209226
|
function ownerContainsTrackedHyperlink(xml, start, end) {
|
|
209069
|
-
const
|
|
209070
|
-
if (
|
|
209227
|
+
const open2 = xml.lastIndexOf(":hyperlink", start);
|
|
209228
|
+
if (open2 < 0)
|
|
209071
209229
|
return false;
|
|
209072
|
-
const tagStart = xml.lastIndexOf("<",
|
|
209230
|
+
const tagStart = xml.lastIndexOf("<", open2);
|
|
209073
209231
|
const close = xml.indexOf(":hyperlink>", end);
|
|
209074
209232
|
return tagStart >= 0 && close >= end && xml[tagStart + 1] !== "/";
|
|
209075
209233
|
}
|
|
@@ -209318,7 +209476,7 @@ function applyBibliographyReviewResourceCleanup(input) {
|
|
|
209318
209476
|
styleName: readXmlAttribute(root.tag, "", "StyleName")?.value,
|
|
209319
209477
|
version: readXmlAttribute(root.tag, "", "Version")?.value
|
|
209320
209478
|
});
|
|
209321
|
-
let
|
|
209479
|
+
let open2 = xml.slice(root.start, root.openEnd);
|
|
209322
209480
|
for (const [name, value] of [
|
|
209323
209481
|
["SelectedStyle", metadata2.selectedStyle],
|
|
209324
209482
|
["StyleName", metadata2.styleName],
|
|
@@ -209327,11 +209485,11 @@ function applyBibliographyReviewResourceCleanup(input) {
|
|
|
209327
209485
|
const attribute = readXmlAttribute(root.tag, "", name);
|
|
209328
209486
|
if (attribute) {
|
|
209329
209487
|
const pattern = new RegExp(`(\\s${name}\\s*=\\s*)(["'])(.*?)\\2`, "s");
|
|
209330
|
-
|
|
209488
|
+
open2 = open2.replace(pattern, (_match, prefix, quote) => `${prefix}${quote}${escapeXmlAttribute(value)}${quote}`);
|
|
209331
209489
|
} else
|
|
209332
|
-
|
|
209490
|
+
open2 = open2.replace(/\s*(\/?)>$/, ` ${name}="${escapeXmlAttribute(value)}"$1>`);
|
|
209333
209491
|
}
|
|
209334
|
-
const next = xml.slice(0, root.start) +
|
|
209492
|
+
const next = xml.slice(0, root.start) + open2 + xml.slice(root.openEnd);
|
|
209335
209493
|
if (next !== xml)
|
|
209336
209494
|
stageXml(input, uri, next);
|
|
209337
209495
|
foundSources = true;
|
|
@@ -214210,21 +214368,21 @@ function scanParagraphPropertyMoveMarkers(workingXml, fragment3, rangeMarkerIds)
|
|
|
214210
214368
|
onCloseTag(event) {
|
|
214211
214369
|
if (event.tag.isSelfClosing)
|
|
214212
214370
|
return;
|
|
214213
|
-
const
|
|
214214
|
-
if (!
|
|
214371
|
+
const open2 = stack.pop();
|
|
214372
|
+
if (!open2)
|
|
214215
214373
|
return;
|
|
214216
|
-
if (
|
|
214217
|
-
|
|
214218
|
-
|
|
214374
|
+
if (open2.paragraphPropertyCandidate) {
|
|
214375
|
+
open2.paragraphPropertyCandidate.end = event.end;
|
|
214376
|
+
open2.paragraphPropertyCandidate.explicitCloseContentValid = isEmptyMoveMarkerContent2(workingXml.slice(open2.paragraphPropertyCandidate.contentStart, event.start));
|
|
214219
214377
|
}
|
|
214220
|
-
if (
|
|
214221
|
-
|
|
214222
|
-
if (
|
|
214223
|
-
|
|
214224
|
-
|
|
214378
|
+
if (open2.moveWrapperCandidate)
|
|
214379
|
+
open2.moveWrapperCandidate.end = event.end;
|
|
214380
|
+
if (open2.rangeMarker) {
|
|
214381
|
+
open2.rangeMarker.end = event.end;
|
|
214382
|
+
open2.rangeMarker.explicitCloseContentValid = isEmptyMoveMarkerContent2(workingXml.slice(open2.rangeMarker.contentStart, event.start));
|
|
214225
214383
|
}
|
|
214226
|
-
if (isWordElement2(
|
|
214227
|
-
paragraphs.push({ start:
|
|
214384
|
+
if (isWordElement2(open2, "p") && open2.start < fragment3.byteStart && event.end >= fragment3.byteEnd) {
|
|
214385
|
+
paragraphs.push({ start: open2.start, end: event.end });
|
|
214228
214386
|
}
|
|
214229
214387
|
}
|
|
214230
214388
|
});
|
|
@@ -214293,20 +214451,20 @@ function pairMoveRangeMarkers(positions) {
|
|
|
214293
214451
|
...positions.ends.map((range) => ({ kind: "end", range }))
|
|
214294
214452
|
].sort((left, right) => left.range.start - right.range.start);
|
|
214295
214453
|
const pairs = [];
|
|
214296
|
-
let
|
|
214454
|
+
let open2 = null;
|
|
214297
214455
|
for (const event of events) {
|
|
214298
214456
|
if (event.kind === "start") {
|
|
214299
|
-
if (
|
|
214457
|
+
if (open2)
|
|
214300
214458
|
return { ok: false, pairs };
|
|
214301
|
-
|
|
214459
|
+
open2 = event.range;
|
|
214302
214460
|
continue;
|
|
214303
214461
|
}
|
|
214304
|
-
if (!
|
|
214462
|
+
if (!open2 || event.range.start < open2.end)
|
|
214305
214463
|
return { ok: false, pairs };
|
|
214306
|
-
pairs.push({ startMarker:
|
|
214307
|
-
|
|
214464
|
+
pairs.push({ startMarker: open2, endMarker: event.range });
|
|
214465
|
+
open2 = null;
|
|
214308
214466
|
}
|
|
214309
|
-
return { ok:
|
|
214467
|
+
return { ok: open2 == null, pairs };
|
|
214310
214468
|
}
|
|
214311
214469
|
function isWordElement2(element, localName2) {
|
|
214312
214470
|
return element?.tag.namespaceUri === NS_W && element.tag.localName === localName2;
|
|
@@ -215666,10 +215824,10 @@ function requiredCellParagraphReplacement(partXml, paragraphStart) {
|
|
|
215666
215824
|
return null;
|
|
215667
215825
|
const firstChild = directChildren2(ranges, paragraph)[0];
|
|
215668
215826
|
const properties = firstChild?.tag.namespaceUri === NS_W && firstChild.tag.localName === "pPr" ? firstChild : undefined;
|
|
215669
|
-
const
|
|
215827
|
+
const open2 = partXml.slice(paragraph.start, paragraph.openEnd);
|
|
215670
215828
|
if (paragraph.tag.isSelfClosing)
|
|
215671
|
-
return
|
|
215672
|
-
return
|
|
215829
|
+
return open2;
|
|
215830
|
+
return open2 + (properties ? partXml.slice(paragraph.openEnd, properties.end) : "") + partXml.slice(paragraph.closeStart, paragraph.end);
|
|
215673
215831
|
}
|
|
215674
215832
|
function directChildren2(ranges, parent) {
|
|
215675
215833
|
const children = [];
|
|
@@ -216061,8 +216219,8 @@ function prepareTrackedBlockXmlReplacement(input) {
|
|
|
216061
216219
|
return null;
|
|
216062
216220
|
wordIds.push(...runs.wordIds);
|
|
216063
216221
|
nextId += runs.wordIds.length;
|
|
216064
|
-
const
|
|
216065
|
-
result += xml.slice(cursor, paragraph.start) +
|
|
216222
|
+
const open2 = xml.slice(paragraph.start, paragraph.openEnd).replace(/\/>$/, ">");
|
|
216223
|
+
result += xml.slice(cursor, paragraph.start) + open2 + (properties ? xml.slice(paragraph.openEnd, properties.start) : "") + nextProperties + runs.xml + `</${paragraph.tag.name}>`;
|
|
216066
216224
|
cursor = paragraph.end;
|
|
216067
216225
|
}
|
|
216068
216226
|
return xml.slice(cursor).trim() ? null : result + xml.slice(cursor);
|
|
@@ -216828,11 +216986,11 @@ function paragraphPropertiesChildrenXml(pPrXml) {
|
|
|
216828
216986
|
const selfClosing = /^<[\w.-]+:pPr\b[^>]*\/>$/.exec(trimmed);
|
|
216829
216987
|
if (selfClosing)
|
|
216830
216988
|
return "";
|
|
216831
|
-
const
|
|
216989
|
+
const open2 = /^<[\w.-]+:pPr\b[^>]*>/.exec(trimmed)?.[0];
|
|
216832
216990
|
const close = /<\/[\w.-]+:pPr>\s*$/.exec(trimmed)?.[0];
|
|
216833
|
-
if (!
|
|
216991
|
+
if (!open2 || !close)
|
|
216834
216992
|
return "";
|
|
216835
|
-
return trimmed.slice(
|
|
216993
|
+
return trimmed.slice(open2.length, trimmed.length - close.length);
|
|
216836
216994
|
}
|
|
216837
216995
|
function paragraphPropertiesNamespaceAttrs(pPrXml) {
|
|
216838
216996
|
if (!pPrXml)
|
|
@@ -234807,9 +234965,9 @@ function prepareTrackedTableCellTextReplacement(input) {
|
|
|
234807
234965
|
});
|
|
234808
234966
|
if (!runs)
|
|
234809
234967
|
return null;
|
|
234810
|
-
const
|
|
234968
|
+
const open2 = input.beforeXml.slice(first.range.start, first.range.openEnd).replace(/\/>$/, ">");
|
|
234811
234969
|
return {
|
|
234812
|
-
xml: input.beforeXml.slice(0, first.range.start) +
|
|
234970
|
+
xml: input.beforeXml.slice(0, first.range.start) + open2 + first.properties + runs.xml + `</${first.range.tag.name}>` + input.beforeXml.slice(first.range.end),
|
|
234813
234971
|
wordIds: runs.wordIds
|
|
234814
234972
|
};
|
|
234815
234973
|
}
|
|
@@ -235680,13 +235838,13 @@ function validateCellTextPayload(text) {
|
|
|
235680
235838
|
return null;
|
|
235681
235839
|
}
|
|
235682
235840
|
function blankClonedRowCells(xml) {
|
|
235683
|
-
return xml.replace(/(<([\w.-]+):tc\b[^>]*>)([\s\S]*?)(<\/\2:tc>)/g, (_full,
|
|
235841
|
+
return xml.replace(/(<([\w.-]+):tc\b[^>]*>)([\s\S]*?)(<\/\2:tc>)/g, (_full, open2, prefix, body, close) => {
|
|
235684
235842
|
const tcPr = body.match(new RegExp(`<${prefix}:tcPr\\b(?:[^>]*/>|[\\s\\S]*?</${prefix}:tcPr>)`))?.[0] ?? "";
|
|
235685
235843
|
const paraId = body.match(/(?:w14|w):paraId="([^"]*)"/)?.[1] ?? "";
|
|
235686
235844
|
const pPr = composePPrWithMarkRPr(extractFirstPPr(body), extractFirstRunRPr(body));
|
|
235687
235845
|
const attrs = paraId ? ` w14:paraId="${paraId}"` : "";
|
|
235688
235846
|
const paragraph = pPr ? `<${prefix}:p${attrs}>${pPr}</${prefix}:p>` : `<${prefix}:p${attrs}/>`;
|
|
235689
|
-
return `${
|
|
235847
|
+
return `${open2}${tcPr}${paragraph}${close}`;
|
|
235690
235848
|
});
|
|
235691
235849
|
}
|
|
235692
235850
|
function stripClonedTableHeaderProperty(xml) {
|
|
@@ -236747,10 +236905,10 @@ function readParaIdFromParagraphXml(xml, namespaceBindings) {
|
|
|
236747
236905
|
return null;
|
|
236748
236906
|
return parsed.ranges.find((range) => range.start === 0 && range.tag.localName === "p" && range.tag.namespaceUri === "http://schemas.openxmlformats.org/wordprocessingml/2006/main")?.tag.attributes.find((attribute) => attribute.localName === "paraId" && attribute.namespaceUri === "http://schemas.microsoft.com/office/word/2010/wordml")?.value ?? null;
|
|
236749
236907
|
}
|
|
236750
|
-
const
|
|
236751
|
-
if (!
|
|
236908
|
+
const open2 = /^<[\w.-]+:p\b([^>]*)>/i.exec(xml);
|
|
236909
|
+
if (!open2)
|
|
236752
236910
|
return null;
|
|
236753
|
-
return /(?:[\w.-]+:)?paraId=(["'])([^"']+)\1/.exec(
|
|
236911
|
+
return /(?:[\w.-]+:)?paraId=(["'])([^"']+)\1/.exec(open2[1] ?? "")?.[2] ?? null;
|
|
236754
236912
|
}
|
|
236755
236913
|
function trailingXmlAfterLastParagraph(xml, namespaceBindings) {
|
|
236756
236914
|
const spans = findElementSpans(xml, "p", namespaceBindings);
|
|
@@ -237712,9 +237870,9 @@ function parseParagraphEnvelope(anchorXml) {
|
|
|
237712
237870
|
const selfClosing = /^<([\w.-]+:)?p\b[^>]*\/>\s*$/.exec(anchorXml);
|
|
237713
237871
|
if (selfClosing) {
|
|
237714
237872
|
const prefix2 = selfClosing[1] ?? "";
|
|
237715
|
-
const
|
|
237873
|
+
const open2 = anchorXml.trim().replace(/\s*\/>$/, ">");
|
|
237716
237874
|
return {
|
|
237717
|
-
open,
|
|
237875
|
+
open: open2,
|
|
237718
237876
|
pPr: "",
|
|
237719
237877
|
close: `</${prefix2}p>`,
|
|
237720
237878
|
innerStart: anchorXml.length,
|
|
@@ -238064,10 +238222,10 @@ function rewritePastePPrNumbering(pPrXml, numbering) {
|
|
|
238064
238222
|
if (/<w:numPr\b/.test(pPrXml)) {
|
|
238065
238223
|
return pPrXml.replace(/<w:numPr\b(?:[^>]*\/>|[^>]*>[\s\S]*?<\/w:numPr\s*>)/, numPr);
|
|
238066
238224
|
}
|
|
238067
|
-
const
|
|
238068
|
-
if (!
|
|
238225
|
+
const open2 = /^<w:pPr\b[^>]*>/.exec(pPrXml)?.[0];
|
|
238226
|
+
if (!open2)
|
|
238069
238227
|
return pPrXml;
|
|
238070
|
-
let at =
|
|
238228
|
+
let at = open2.length;
|
|
238071
238229
|
while (true) {
|
|
238072
238230
|
const earlyChild = /^\s*<w:(pStyle|keepNext|keepLines|pageBreakBefore|framePr|widowControl)\b(?:[^>]*\/>|[^>]*>[\s\S]*?<\/w:\1\s*>)/.exec(pPrXml.slice(at));
|
|
238073
238231
|
if (!earlyChild)
|
|
@@ -239374,11 +239532,11 @@ function wrapCarrierWithAncestors(carrierXml, ancestors, paragraphXml) {
|
|
|
239374
239532
|
let wrapped = carrierXml;
|
|
239375
239533
|
for (let index = ancestors.length - 1;index >= 0; index -= 1) {
|
|
239376
239534
|
const ancestor = ancestors[index];
|
|
239377
|
-
const
|
|
239535
|
+
const open2 = /^<([\w.-]+):[\w.-]+\b[^>]*>/.exec(ancestor.rawXml);
|
|
239378
239536
|
const close = /<\/[\w.-]+:[\w.-]+>$/.exec(ancestor.rawXml);
|
|
239379
|
-
if (!
|
|
239537
|
+
if (!open2 || !close)
|
|
239380
239538
|
return null;
|
|
239381
|
-
const selfContainedOpen = makeOpeningTagNamespaceSelfContained(
|
|
239539
|
+
const selfContainedOpen = makeOpeningTagNamespaceSelfContained(open2[0], open2[1], paragraphXml);
|
|
239382
239540
|
wrapped = `${selfContainedOpen}${wrapped}${close[0]}`;
|
|
239383
239541
|
}
|
|
239384
239542
|
return wrapped;
|
|
@@ -239423,12 +239581,12 @@ function insertCarrierAtImageOffset(input) {
|
|
|
239423
239581
|
xml: `<${selfClosedParagraph[1]}${selfClosedParagraph[2]}>` + input.carrierXml + `</${selfClosedParagraph[1]}>`
|
|
239424
239582
|
};
|
|
239425
239583
|
}
|
|
239426
|
-
const
|
|
239584
|
+
const open2 = /^<[\w.-]+:p\b[^>]*>/.exec(input.paragraphXml);
|
|
239427
239585
|
const close = /<\/[\w.-]+:p>$/.exec(input.paragraphXml);
|
|
239428
|
-
if (!
|
|
239586
|
+
if (!open2 || !close) {
|
|
239429
239587
|
return { ok: false, reason: "image-move-destination-unsupported" };
|
|
239430
239588
|
}
|
|
239431
|
-
const inner = input.paragraphXml.slice(
|
|
239589
|
+
const inner = input.paragraphXml.slice(open2[0].length, close.index);
|
|
239432
239590
|
const pPrXml = matchLeadingElement(inner, "pPr");
|
|
239433
239591
|
const sliced = sliceParagraphContentAt({
|
|
239434
239592
|
paragraphXml: input.paragraphXml,
|
|
@@ -239442,7 +239600,7 @@ function insertCarrierAtImageOffset(input) {
|
|
|
239442
239600
|
}
|
|
239443
239601
|
return {
|
|
239444
239602
|
ok: true,
|
|
239445
|
-
xml: `${
|
|
239603
|
+
xml: `${open2[0]}${pPrXml}${sliced.head}${input.carrierXml}${sliced.tail}${close[0]}`
|
|
239446
239604
|
};
|
|
239447
239605
|
}
|
|
239448
239606
|
function validateImageBinary(binary, format) {
|
|
@@ -243213,14 +243371,14 @@ function xmlOffsetsForBytePositions(bytes, positions) {
|
|
|
243213
243371
|
return offsets;
|
|
243214
243372
|
}
|
|
243215
243373
|
function injectTrackedParagraphMarkIntoXml(paragraphXml, stamp, kind) {
|
|
243216
|
-
const
|
|
243374
|
+
const open2 = matchParagraphOpenTag(paragraphXml);
|
|
243217
243375
|
const close = paragraphXml.match(/<\/([\w.-]+):p>\s*$/)?.[0];
|
|
243218
|
-
if (!
|
|
243376
|
+
if (!open2 || !close)
|
|
243219
243377
|
return paragraphXml;
|
|
243220
|
-
const inner = paragraphXml.slice(
|
|
243378
|
+
const inner = paragraphXml.slice(open2.length, paragraphXml.length - close.length);
|
|
243221
243379
|
const pPr = matchLeadingElement(inner, "pPr");
|
|
243222
243380
|
const nextPPr = renderTrackedParagraphMarkProperties(pPr, stamp, kind);
|
|
243223
|
-
return
|
|
243381
|
+
return open2 + nextPPr + inner.slice(pPr.length) + close;
|
|
243224
243382
|
}
|
|
243225
243383
|
function injectTrackedMarkIntoLastParagraph(xml, stamp, kind) {
|
|
243226
243384
|
const matches = [...xml.matchAll(/<w:p\b[^>]*>[\s\S]*?<\/w:p>/g)];
|
|
@@ -252746,8 +252904,8 @@ function removeRedundantXmlNamespaceDeclarations(xml, inheritedNamespaces) {
|
|
|
252746
252904
|
ancestors.pop();
|
|
252747
252905
|
const inherited = ancestors[ancestors.length - 1]?.namespaceBindings ?? inheritedNamespaces;
|
|
252748
252906
|
if (inherited) {
|
|
252749
|
-
const
|
|
252750
|
-
for (const attribute of
|
|
252907
|
+
const open2 = xml.slice(range.start, range.openEnd);
|
|
252908
|
+
for (const attribute of open2.matchAll(/\s+([A-Za-z_][\w.:-]*)\s*=\s*(?:"[^"]*"|'[^']*')/g)) {
|
|
252751
252909
|
const name = attribute[1];
|
|
252752
252910
|
if (name !== "xmlns" && !name.startsWith("xmlns:"))
|
|
252753
252911
|
continue;
|
|
@@ -254516,10 +254674,10 @@ function applySDDocumentSessionInternalProjection(session, input) {
|
|
|
254516
254674
|
});
|
|
254517
254675
|
}
|
|
254518
254676
|
function validateSDDocumentSessionInternalPackageBytes(bytes) {
|
|
254519
|
-
const
|
|
254520
|
-
const invariants = evaluatePackageInvariants(
|
|
254677
|
+
const open2 = openPackage(bytes);
|
|
254678
|
+
const invariants = evaluatePackageInvariants(open2);
|
|
254521
254679
|
const diagnostics = [];
|
|
254522
|
-
for (const diagnostic of
|
|
254680
|
+
for (const diagnostic of open2.pkg.diagnostics) {
|
|
254523
254681
|
diagnostics.push({
|
|
254524
254682
|
code: diagnostic.code,
|
|
254525
254683
|
severity: diagnostic.severity === "error" ? "hard" : "soft",
|
|
@@ -257361,13 +257519,13 @@ async function openSDDocumentSession(options) {
|
|
|
257361
257519
|
} else {
|
|
257362
257520
|
waitForSourceCompleteResult().then(() => settleCoverageRangeWaiters(currentCoverageSnapshot(), true)).catch(() => settleCoverageRangeWaiters(currentCoverageSnapshot(), true));
|
|
257363
257521
|
}
|
|
257364
|
-
return await new Promise((
|
|
257522
|
+
return await new Promise((resolve2) => {
|
|
257365
257523
|
const signal = request.signal;
|
|
257366
257524
|
let onAbort = null;
|
|
257367
257525
|
const waiter = {
|
|
257368
257526
|
startOrdinal,
|
|
257369
257527
|
endOrdinalExclusive,
|
|
257370
|
-
resolve,
|
|
257528
|
+
resolve: resolve2,
|
|
257371
257529
|
cleanup: () => {
|
|
257372
257530
|
if (signal && onAbort)
|
|
257373
257531
|
signal.removeEventListener("abort", onAbort);
|
|
@@ -257378,7 +257536,7 @@ async function openSDDocumentSession(options) {
|
|
|
257378
257536
|
return;
|
|
257379
257537
|
coverageRangeWaiters.delete(waiter);
|
|
257380
257538
|
waiter.cleanup();
|
|
257381
|
-
|
|
257539
|
+
resolve2({
|
|
257382
257540
|
status: "cancelled",
|
|
257383
257541
|
reason: "aborted",
|
|
257384
257542
|
snapshot: currentCoverageSnapshot()
|
|
@@ -258526,17 +258684,17 @@ function prepareTrackedFieldMarkerRun(input) {
|
|
|
258526
258684
|
const namespaceBindings = new Map(input.namespaceBindings).set(prefix, NS_W);
|
|
258527
258685
|
const targetBindings = Object.fromEntries(namespaceBindings);
|
|
258528
258686
|
const properties = (xml, value) => value.properties ? copyParagraphPropertyChild(xml, value.properties, targetBindings) : "";
|
|
258529
|
-
const
|
|
258687
|
+
const open2 = `<${prefix}:pPr>`;
|
|
258530
258688
|
const close = `</${prefix}:pPr>`;
|
|
258531
258689
|
const prepared = prepareTrackedParagraphProperties({
|
|
258532
|
-
beforeXml:
|
|
258533
|
-
afterXml:
|
|
258690
|
+
beforeXml: open2 + properties(input.beforeXml, before) + close,
|
|
258691
|
+
afterXml: open2 + properties(input.afterXml, after) + close,
|
|
258534
258692
|
namespaceBindings,
|
|
258535
258693
|
stamp: input.stamp
|
|
258536
258694
|
});
|
|
258537
258695
|
if (!prepared)
|
|
258538
258696
|
return null;
|
|
258539
|
-
const nextProperties = prepared.xml.slice(
|
|
258697
|
+
const nextProperties = prepared.xml.slice(open2.length, -close.length);
|
|
258540
258698
|
return {
|
|
258541
258699
|
xml: input.beforeXml.slice(0, before.run.openEnd) + nextProperties + input.beforeXml.slice(before.properties?.end ?? before.run.openEnd),
|
|
258542
258700
|
wordIds: prepared.wordIds
|
|
@@ -258727,17 +258885,17 @@ function prepareTrackedTocReplacement(input) {
|
|
|
258727
258885
|
xml2 += deletedTerminal.xml;
|
|
258728
258886
|
}
|
|
258729
258887
|
if (after.length > retainedCount) {
|
|
258730
|
-
const
|
|
258888
|
+
const open2 = "<w:sdt><w:sdtContent>";
|
|
258731
258889
|
const close = "</w:sdtContent></w:sdt>";
|
|
258732
258890
|
const continuation = prepareTrackedTocInsertion({
|
|
258733
|
-
xml:
|
|
258891
|
+
xml: open2 + after.slice(retainedCount).map((paragraph) => paragraph.xml).join("") + close,
|
|
258734
258892
|
namespaceBindings: input.namespaceBindings,
|
|
258735
258893
|
stamp: stamp()
|
|
258736
258894
|
});
|
|
258737
258895
|
if (!continuation)
|
|
258738
258896
|
return null;
|
|
258739
258897
|
wordIds.push(...continuation.wordIds);
|
|
258740
|
-
xml2 += continuation.xml.slice(
|
|
258898
|
+
xml2 += continuation.xml.slice(open2.length, -close.length);
|
|
258741
258899
|
}
|
|
258742
258900
|
return { xml: xml2, wordIds };
|
|
258743
258901
|
}
|
|
@@ -258757,17 +258915,17 @@ function prepareTrackedTocReplacement(input) {
|
|
|
258757
258915
|
return null;
|
|
258758
258916
|
let xml = original.open + properties.xml + deleted + inserted + `</${original.range.tag.name}>`;
|
|
258759
258917
|
if (after.length > 1) {
|
|
258760
|
-
const
|
|
258918
|
+
const open2 = "<w:sdt><w:sdtContent>";
|
|
258761
258919
|
const close = "</w:sdtContent></w:sdt>";
|
|
258762
258920
|
const continuation = prepareTrackedTocInsertion({
|
|
258763
|
-
xml:
|
|
258921
|
+
xml: open2 + after.slice(1).map((paragraph) => paragraph.xml).join("") + close,
|
|
258764
258922
|
namespaceBindings: input.namespaceBindings,
|
|
258765
258923
|
stamp: stamp()
|
|
258766
258924
|
});
|
|
258767
258925
|
if (!continuation)
|
|
258768
258926
|
return null;
|
|
258769
258927
|
wordIds.push(...continuation.wordIds);
|
|
258770
|
-
xml += continuation.xml.slice(
|
|
258928
|
+
xml += continuation.xml.slice(open2.length, -close.length);
|
|
258771
258929
|
}
|
|
258772
258930
|
return { xml, wordIds };
|
|
258773
258931
|
}
|
|
@@ -278090,7 +278248,12 @@ function projectAffectedRefs(refs, trackedChangeIdProjector) {
|
|
|
278090
278248
|
projected.push({ kind: "block", nodeId: ref5.nodeId });
|
|
278091
278249
|
break;
|
|
278092
278250
|
case "text":
|
|
278093
|
-
projected.push({
|
|
278251
|
+
projected.push({
|
|
278252
|
+
kind: "text",
|
|
278253
|
+
blockId: ref5.blockId,
|
|
278254
|
+
range: ref5.range,
|
|
278255
|
+
...ref5.storyId?.startsWith("main:") && ref5.range.start === 0 && ref5.range.end === 0 ? { story: { kind: "story", storyType: "body" } } : {}
|
|
278256
|
+
});
|
|
278094
278257
|
break;
|
|
278095
278258
|
default:
|
|
278096
278259
|
break;
|
|
@@ -288027,12 +288190,12 @@ function parseContainerXml(xml, localName2) {
|
|
|
288027
288190
|
const closeMatch = new RegExp(`</([\\w.-]+):${escapeForRegex(localName2)}>\\s*$`).exec(normalized);
|
|
288028
288191
|
if (!openMatch || !closeMatch || openMatch[1] !== closeMatch[1])
|
|
288029
288192
|
return null;
|
|
288030
|
-
const
|
|
288193
|
+
const open2 = openMatch[0];
|
|
288031
288194
|
const close = closeMatch[0];
|
|
288032
288195
|
return {
|
|
288033
288196
|
prefix: openMatch[1],
|
|
288034
|
-
open,
|
|
288035
|
-
inner: normalized.slice(
|
|
288197
|
+
open: open2,
|
|
288198
|
+
inner: normalized.slice(open2.length, normalized.length - close.length),
|
|
288036
288199
|
close
|
|
288037
288200
|
};
|
|
288038
288201
|
}
|
|
@@ -288875,11 +289038,11 @@ function bindRelationshipNamespaceOnSectPr(sectPrXml) {
|
|
|
288875
289038
|
return sectPrXml.replace(/^<w:sectPr\b/, `<w:sectPr xmlns:r="${RELATIONSHIPS_NAMESPACE}"`);
|
|
288876
289039
|
}
|
|
288877
289040
|
function bindRelationshipNamespaceOnReferences(sectPrXml) {
|
|
288878
|
-
return sectPrXml.replace(/<w:(headerReference|footerReference)\b/g, (
|
|
288879
|
-
const tagEnd = findXmlTagEnd3(sectPrXml, offset +
|
|
289041
|
+
return sectPrXml.replace(/<w:(headerReference|footerReference)\b/g, (open2, _kind, offset) => {
|
|
289042
|
+
const tagEnd = findXmlTagEnd3(sectPrXml, offset + open2.length);
|
|
288880
289043
|
if (tagEnd < 0 || readNamespaceDeclaration(sectPrXml.slice(offset, tagEnd), "r") != null)
|
|
288881
|
-
return
|
|
288882
|
-
return `${
|
|
289044
|
+
return open2;
|
|
289045
|
+
return `${open2} xmlns:r="${RELATIONSHIPS_NAMESPACE}"`;
|
|
288883
289046
|
});
|
|
288884
289047
|
}
|
|
288885
289048
|
function applyPreparedSectionXmlMutations(documentBytes, mutations) {
|
|
@@ -289257,9 +289420,9 @@ function expandSectPr(sectPrXml) {
|
|
|
289257
289420
|
const openEnd = findXmlTagEnd3(sectPrXml, openMatch.index + openMatch[0].length);
|
|
289258
289421
|
if (openEnd < 0)
|
|
289259
289422
|
return sectPrXml;
|
|
289260
|
-
const
|
|
289261
|
-
const expandedOpen =
|
|
289262
|
-
if (expandedOpen ===
|
|
289423
|
+
const open2 = sectPrXml.slice(openMatch.index, openEnd);
|
|
289424
|
+
const expandedOpen = open2.replace(/\/\s*>$/, ">");
|
|
289425
|
+
if (expandedOpen === open2)
|
|
289263
289426
|
return sectPrXml;
|
|
289264
289427
|
return `${sectPrXml.slice(0, openMatch.index)}${expandedOpen}</w:sectPr>${sectPrXml.slice(openEnd)}`;
|
|
289265
289428
|
}
|
|
@@ -290019,8 +290182,8 @@ function insertXmlAtCollapsedTopLevelWrapperBoundary(paragraphXml, offset, inser
|
|
|
290019
290182
|
function injectParagraphPrefixXml(paragraphXml, insertionXml) {
|
|
290020
290183
|
const selfClosing = paragraphXml.match(/^<w:p\b([^>]*)\/>$/s);
|
|
290021
290184
|
if (selfClosing) {
|
|
290022
|
-
const
|
|
290023
|
-
return { ok: true, xml: `${
|
|
290185
|
+
const open2 = `<w:p${selfClosing[1]}>`;
|
|
290186
|
+
return { ok: true, xml: `${open2}${insertionXml}</w:p>`, insertionStart: open2.length };
|
|
290024
290187
|
}
|
|
290025
290188
|
const pPrClose = paragraphXml.indexOf("</w:pPr>");
|
|
290026
290189
|
const insertionStart = pPrClose >= 0 ? pPrClose + "</w:pPr>".length : paragraphXml.indexOf(">") + 1;
|
|
@@ -293014,12 +293177,12 @@ function readDocumentTocParagraphTemplates(paragraphs) {
|
|
|
293014
293177
|
const level = readTocParagraphLevel(paragraph2.rawXml);
|
|
293015
293178
|
if (level == null)
|
|
293016
293179
|
continue;
|
|
293017
|
-
const
|
|
293180
|
+
const open2 = buildTocParagraphTemplateOpen(paragraph2.rawXml);
|
|
293018
293181
|
if (!templates.byLevel.has(level))
|
|
293019
|
-
templates.byLevel.set(level,
|
|
293182
|
+
templates.byLevel.set(level, open2);
|
|
293020
293183
|
const entryText = readTocParagraphTemplateText(paragraph2.rawXml);
|
|
293021
293184
|
if (entryText && !templates.byText.has(entryText))
|
|
293022
|
-
templates.byText.set(entryText,
|
|
293185
|
+
templates.byText.set(entryText, open2);
|
|
293023
293186
|
}
|
|
293024
293187
|
return templates;
|
|
293025
293188
|
}
|
|
@@ -293532,12 +293695,12 @@ function buildTocParagraphTemplatesFromParagraphXml(xml) {
|
|
|
293532
293695
|
const level = readTocParagraphLevel(paragraphXml);
|
|
293533
293696
|
if (level == null)
|
|
293534
293697
|
continue;
|
|
293535
|
-
const
|
|
293698
|
+
const open2 = buildTocParagraphTemplateOpen(paragraphXml);
|
|
293536
293699
|
if (!templates.byLevel.has(level))
|
|
293537
|
-
templates.byLevel.set(level,
|
|
293700
|
+
templates.byLevel.set(level, open2);
|
|
293538
293701
|
const entryText = readTocParagraphTemplateText(paragraphXml);
|
|
293539
293702
|
if (entryText && !templates.byText.has(entryText))
|
|
293540
|
-
templates.byText.set(entryText,
|
|
293703
|
+
templates.byText.set(entryText, open2);
|
|
293541
293704
|
}
|
|
293542
293705
|
return templates;
|
|
293543
293706
|
}
|
|
@@ -295136,8 +295299,8 @@ function wrapTextRangeWithMetadataSdt(paragraphXml, start, end, id, sdtId, known
|
|
|
295136
295299
|
if (!wrapped.ok)
|
|
295137
295300
|
return wrapped;
|
|
295138
295301
|
const nextContent = parseContainerXml(wrapped.xml, "p").inner;
|
|
295139
|
-
const
|
|
295140
|
-
const contentStart =
|
|
295302
|
+
const open2 = /<w:sdtContent\b[^>]*>/.exec(parent.xml);
|
|
295303
|
+
const contentStart = open2.index + open2[0].length;
|
|
295141
295304
|
let nextParent = replaceRange(parent.xml, contentStart, contentStart + content.length, nextContent);
|
|
295142
295305
|
if (metadataParent && /<w:text\b/.test(pr)) {
|
|
295143
295306
|
let nextPr = pr.replace(/<w:text\b[^>]*(?:\/>|>[\s\S]*?<\/w:text>)/, "<w:richText/>");
|
|
@@ -295214,24 +295377,24 @@ function findParagraphContaining(documentXml, index) {
|
|
|
295214
295377
|
const paraRe = /<w:p\b[^>]*>[\s\S]*?<\/w:p>/g;
|
|
295215
295378
|
for (let match = paraRe.exec(documentXml);match; match = paraRe.exec(documentXml)) {
|
|
295216
295379
|
if (match.index <= index && paraRe.lastIndex >= index) {
|
|
295217
|
-
const
|
|
295380
|
+
const open2 = /^<w:p\b[^>]*>/.exec(match[0])?.[0] ?? "";
|
|
295218
295381
|
return {
|
|
295219
295382
|
start: match.index,
|
|
295220
295383
|
end: paraRe.lastIndex,
|
|
295221
295384
|
xml: match[0],
|
|
295222
|
-
blockId: attrValue(
|
|
295385
|
+
blockId: attrValue(open2, "paraId") ?? "unknown"
|
|
295223
295386
|
};
|
|
295224
295387
|
}
|
|
295225
295388
|
}
|
|
295226
295389
|
return null;
|
|
295227
295390
|
}
|
|
295228
295391
|
function unwrapSdt(sdtXml) {
|
|
295229
|
-
const
|
|
295230
|
-
if (!
|
|
295392
|
+
const open2 = /<w:sdtContent\b[^>]*>/.exec(sdtXml);
|
|
295393
|
+
if (!open2)
|
|
295231
295394
|
return null;
|
|
295232
|
-
if (/\/\s*>$/.test(
|
|
295395
|
+
if (/\/\s*>$/.test(open2[0]))
|
|
295233
295396
|
return "";
|
|
295234
|
-
const contentStart =
|
|
295397
|
+
const contentStart = open2.index + open2[0].length;
|
|
295235
295398
|
const tokenRe = /<w:sdtContent\b[^>]*>|<\/w:sdtContent>/g;
|
|
295236
295399
|
tokenRe.lastIndex = contentStart;
|
|
295237
295400
|
let depth = 0;
|
|
@@ -295616,20 +295779,20 @@ function normalizeStylesWordprocessingMlQNames(xml, options = {}) {
|
|
|
295616
295779
|
const replacements = [];
|
|
295617
295780
|
for (const range of parsed.ranges) {
|
|
295618
295781
|
const sourceOpen = xml.slice(range.start, range.openEnd);
|
|
295619
|
-
let
|
|
295782
|
+
let open2 = sourceOpen;
|
|
295620
295783
|
if (WORDPROCESSINGML_NAMESPACES2.has(range.tag.namespaceUri)) {
|
|
295621
|
-
|
|
295784
|
+
open2 = replaceXmlQName(open2, range.tag.name, `${prefix}:${range.tag.localName}`, "element");
|
|
295622
295785
|
}
|
|
295623
295786
|
for (const attribute of range.tag.attributes) {
|
|
295624
295787
|
if (!WORDPROCESSINGML_NAMESPACES2.has(attribute.namespaceUri))
|
|
295625
295788
|
continue;
|
|
295626
|
-
|
|
295789
|
+
open2 = replaceXmlQName(open2, attribute.name, `${prefix}:${attribute.localName}`, "attribute");
|
|
295627
295790
|
}
|
|
295628
295791
|
if (range === root && needsBinding) {
|
|
295629
|
-
|
|
295792
|
+
open2 = addNamespaceBinding(open2, prefix, namespaceUri);
|
|
295630
295793
|
}
|
|
295631
|
-
if (
|
|
295632
|
-
replacements.push({ start: range.start, end: range.openEnd, value:
|
|
295794
|
+
if (open2 !== sourceOpen) {
|
|
295795
|
+
replacements.push({ start: range.start, end: range.openEnd, value: open2 });
|
|
295633
295796
|
}
|
|
295634
295797
|
if (range.tag.isSelfClosing || !WORDPROCESSINGML_NAMESPACES2.has(range.tag.namespaceUri))
|
|
295635
295798
|
continue;
|
|
@@ -298323,7 +298486,7 @@ function applyParagraphAlignment(bodyXml, prefix, alignment) {
|
|
|
298323
298486
|
return child;
|
|
298324
298487
|
const paragraph2 = parseContainerXml(child.xml, "p");
|
|
298325
298488
|
const inner = paragraph2 ? paragraph2.inner : "";
|
|
298326
|
-
const
|
|
298489
|
+
const open2 = paragraph2 ? paragraph2.open : child.xml.replace(/\/>$/, ">");
|
|
298327
298490
|
const close = paragraph2 ? paragraph2.close : `</${prefix}:p>`;
|
|
298328
298491
|
const paragraphChildren = parseTopLevelChildren(inner);
|
|
298329
298492
|
const pPrXml = getChild(paragraphChildren, "pPr")?.xml ?? null;
|
|
@@ -298333,7 +298496,7 @@ function applyParagraphAlignment(bodyXml, prefix, alignment) {
|
|
|
298333
298496
|
changed = true;
|
|
298334
298497
|
return {
|
|
298335
298498
|
...child,
|
|
298336
|
-
xml: `${
|
|
298499
|
+
xml: `${open2}${serializeTopLevelChildren(nextParagraphChildren)}${close}`
|
|
298337
298500
|
};
|
|
298338
298501
|
});
|
|
298339
298502
|
return changed ? serializeTopLevelChildren(next) : bodyXml;
|
|
@@ -320715,10 +320878,10 @@ function resolveAll(constructs2, events, context) {
|
|
|
320715
320878
|
const called = [];
|
|
320716
320879
|
let index = -1;
|
|
320717
320880
|
while (++index < constructs2.length) {
|
|
320718
|
-
const
|
|
320719
|
-
if (
|
|
320720
|
-
events =
|
|
320721
|
-
called.push(
|
|
320881
|
+
const resolve2 = constructs2[index].resolveAll;
|
|
320882
|
+
if (resolve2 && !called.includes(resolve2)) {
|
|
320883
|
+
events = resolve2(events, context);
|
|
320884
|
+
called.push(resolve2);
|
|
320722
320885
|
}
|
|
320723
320886
|
}
|
|
320724
320887
|
return events;
|
|
@@ -320727,7 +320890,7 @@ function resolveAll(constructs2, events, context) {
|
|
|
320727
320890
|
// ../../../v2/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/dev/lib/attention.js
|
|
320728
320891
|
function resolveAllAttention(events, context) {
|
|
320729
320892
|
let index = -1;
|
|
320730
|
-
let
|
|
320893
|
+
let open2;
|
|
320731
320894
|
let group;
|
|
320732
320895
|
let text;
|
|
320733
320896
|
let openingSequence;
|
|
@@ -320737,21 +320900,21 @@ function resolveAllAttention(events, context) {
|
|
|
320737
320900
|
let offset;
|
|
320738
320901
|
while (++index < events.length) {
|
|
320739
320902
|
if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
|
|
320740
|
-
|
|
320741
|
-
while (
|
|
320742
|
-
if (events[
|
|
320743
|
-
if ((events[
|
|
320903
|
+
open2 = index;
|
|
320904
|
+
while (open2--) {
|
|
320905
|
+
if (events[open2][0] === "exit" && events[open2][1].type === "attentionSequence" && events[open2][1]._open && context.sliceSerialize(events[open2][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
|
|
320906
|
+
if ((events[open2][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open2][1].end.offset - events[open2][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) {
|
|
320744
320907
|
continue;
|
|
320745
320908
|
}
|
|
320746
|
-
use = events[
|
|
320747
|
-
const start = { ...events[
|
|
320909
|
+
use = events[open2][1].end.offset - events[open2][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
|
|
320910
|
+
const start = { ...events[open2][1].end };
|
|
320748
320911
|
const end = { ...events[index][1].start };
|
|
320749
320912
|
movePoint(start, -use);
|
|
320750
320913
|
movePoint(end, use);
|
|
320751
320914
|
openingSequence = {
|
|
320752
320915
|
type: use > 1 ? types9.strongSequence : types9.emphasisSequence,
|
|
320753
320916
|
start,
|
|
320754
|
-
end: { ...events[
|
|
320917
|
+
end: { ...events[open2][1].end }
|
|
320755
320918
|
};
|
|
320756
320919
|
closingSequence = {
|
|
320757
320920
|
type: use > 1 ? types9.strongSequence : types9.emphasisSequence,
|
|
@@ -320760,7 +320923,7 @@ function resolveAllAttention(events, context) {
|
|
|
320760
320923
|
};
|
|
320761
320924
|
text = {
|
|
320762
320925
|
type: use > 1 ? types9.strongText : types9.emphasisText,
|
|
320763
|
-
start: { ...events[
|
|
320926
|
+
start: { ...events[open2][1].end },
|
|
320764
320927
|
end: { ...events[index][1].start }
|
|
320765
320928
|
};
|
|
320766
320929
|
group = {
|
|
@@ -320768,13 +320931,13 @@ function resolveAllAttention(events, context) {
|
|
|
320768
320931
|
start: { ...openingSequence.start },
|
|
320769
320932
|
end: { ...closingSequence.end }
|
|
320770
320933
|
};
|
|
320771
|
-
events[
|
|
320934
|
+
events[open2][1].end = { ...openingSequence.start };
|
|
320772
320935
|
events[index][1].start = { ...closingSequence.end };
|
|
320773
320936
|
nextEvents = [];
|
|
320774
|
-
if (events[
|
|
320937
|
+
if (events[open2][1].end.offset - events[open2][1].start.offset) {
|
|
320775
320938
|
nextEvents = push(nextEvents, [
|
|
320776
|
-
["enter", events[
|
|
320777
|
-
["exit", events[
|
|
320939
|
+
["enter", events[open2][1], context],
|
|
320940
|
+
["exit", events[open2][1], context]
|
|
320778
320941
|
]);
|
|
320779
320942
|
}
|
|
320780
320943
|
nextEvents = push(nextEvents, [
|
|
@@ -320784,7 +320947,7 @@ function resolveAllAttention(events, context) {
|
|
|
320784
320947
|
["enter", text, context]
|
|
320785
320948
|
]);
|
|
320786
320949
|
ok2(context.parser.constructs.insideSpan.null, "expected `insideSpan` to be populated");
|
|
320787
|
-
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(
|
|
320950
|
+
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + 1, index), context));
|
|
320788
320951
|
nextEvents = push(nextEvents, [
|
|
320789
320952
|
["exit", text, context],
|
|
320790
320953
|
["enter", closingSequence, context],
|
|
@@ -320800,8 +320963,8 @@ function resolveAllAttention(events, context) {
|
|
|
320800
320963
|
} else {
|
|
320801
320964
|
offset = 0;
|
|
320802
320965
|
}
|
|
320803
|
-
splice(events,
|
|
320804
|
-
index =
|
|
320966
|
+
splice(events, open2 - 1, index - open2 + 3, nextEvents);
|
|
320967
|
+
index = open2 + nextEvents.length - offset - 2;
|
|
320805
320968
|
break;
|
|
320806
320969
|
}
|
|
320807
320970
|
}
|
|
@@ -320835,10 +320998,10 @@ function tokenizeAttention(effects2, ok3) {
|
|
|
320835
320998
|
const token = effects2.exit("attentionSequence");
|
|
320836
320999
|
const after = classifyCharacter(code);
|
|
320837
321000
|
ok2(attentionMarkers, "expected `attentionMarkers` to be populated");
|
|
320838
|
-
const
|
|
321001
|
+
const open2 = !after || after === constants2.characterGroupPunctuation && before || attentionMarkers.includes(code);
|
|
320839
321002
|
const close = !before || before === constants2.characterGroupPunctuation && after || attentionMarkers.includes(previous);
|
|
320840
|
-
token._open = Boolean(marker === codes.asterisk ?
|
|
320841
|
-
token._close = Boolean(marker === codes.asterisk ? close : close && (after || !
|
|
321003
|
+
token._open = Boolean(marker === codes.asterisk ? open2 : open2 && (before || !close));
|
|
321004
|
+
token._close = Boolean(marker === codes.asterisk ? close : close && (after || !open2));
|
|
320842
321005
|
return ok3(code);
|
|
320843
321006
|
}
|
|
320844
321007
|
}
|
|
@@ -320871,9 +321034,9 @@ function tokenizeAutolink(effects2, ok3, nok) {
|
|
|
320871
321034
|
effects2.consume(code);
|
|
320872
321035
|
effects2.exit(types9.autolinkMarker);
|
|
320873
321036
|
effects2.enter(types9.autolinkProtocol);
|
|
320874
|
-
return
|
|
321037
|
+
return open2;
|
|
320875
321038
|
}
|
|
320876
|
-
function
|
|
321039
|
+
function open2(code) {
|
|
320877
321040
|
if (asciiAlpha(code)) {
|
|
320878
321041
|
effects2.consume(code);
|
|
320879
321042
|
return schemeOrEmailAtext;
|
|
@@ -321092,9 +321255,9 @@ function tokenizeCharacterReference(effects2, ok3, nok) {
|
|
|
321092
321255
|
effects2.enter(types9.characterReferenceMarker);
|
|
321093
321256
|
effects2.consume(code);
|
|
321094
321257
|
effects2.exit(types9.characterReferenceMarker);
|
|
321095
|
-
return
|
|
321258
|
+
return open2;
|
|
321096
321259
|
}
|
|
321097
|
-
function
|
|
321260
|
+
function open2(code) {
|
|
321098
321261
|
if (code === codes.numberSign) {
|
|
321099
321262
|
effects2.enter(types9.characterReferenceMarkerNumeric);
|
|
321100
321263
|
effects2.consume(code);
|
|
@@ -322406,9 +322569,9 @@ function tokenizeHtmlFlow(effects2, ok3, nok) {
|
|
|
322406
322569
|
effects2.enter(types9.htmlFlow);
|
|
322407
322570
|
effects2.enter(types9.htmlFlowData);
|
|
322408
322571
|
effects2.consume(code);
|
|
322409
|
-
return
|
|
322572
|
+
return open2;
|
|
322410
322573
|
}
|
|
322411
|
-
function
|
|
322574
|
+
function open2(code) {
|
|
322412
322575
|
if (code === codes.exclamationMark) {
|
|
322413
322576
|
effects2.consume(code);
|
|
322414
322577
|
return declarationOpen;
|
|
@@ -322777,9 +322940,9 @@ function tokenizeHtmlText(effects2, ok3, nok) {
|
|
|
322777
322940
|
effects2.enter(types9.htmlText);
|
|
322778
322941
|
effects2.enter(types9.htmlTextData);
|
|
322779
322942
|
effects2.consume(code);
|
|
322780
|
-
return
|
|
322943
|
+
return open2;
|
|
322781
322944
|
}
|
|
322782
|
-
function
|
|
322945
|
+
function open2(code) {
|
|
322783
322946
|
if (code === codes.exclamationMark) {
|
|
322784
322947
|
effects2.consume(code);
|
|
322785
322948
|
return declarationOpen;
|
|
@@ -323101,12 +323264,12 @@ function resolveToLabelEnd(events, context) {
|
|
|
323101
323264
|
let index = events.length;
|
|
323102
323265
|
let offset = 0;
|
|
323103
323266
|
let token;
|
|
323104
|
-
let
|
|
323267
|
+
let open2;
|
|
323105
323268
|
let close;
|
|
323106
323269
|
let media;
|
|
323107
323270
|
while (index--) {
|
|
323108
323271
|
token = events[index][1];
|
|
323109
|
-
if (
|
|
323272
|
+
if (open2) {
|
|
323110
323273
|
if (token.type === types9.link || token.type === types9.labelLink && token._inactive) {
|
|
323111
323274
|
break;
|
|
323112
323275
|
}
|
|
@@ -323115,7 +323278,7 @@ function resolveToLabelEnd(events, context) {
|
|
|
323115
323278
|
}
|
|
323116
323279
|
} else if (close) {
|
|
323117
323280
|
if (events[index][0] === "enter" && (token.type === types9.labelImage || token.type === types9.labelLink) && !token._balanced) {
|
|
323118
|
-
|
|
323281
|
+
open2 = index;
|
|
323119
323282
|
if (token.type !== types9.labelLink) {
|
|
323120
323283
|
offset = 2;
|
|
323121
323284
|
break;
|
|
@@ -323125,31 +323288,31 @@ function resolveToLabelEnd(events, context) {
|
|
|
323125
323288
|
close = index;
|
|
323126
323289
|
}
|
|
323127
323290
|
}
|
|
323128
|
-
ok2(
|
|
323291
|
+
ok2(open2 !== undefined, "`open` is supposed to be found");
|
|
323129
323292
|
ok2(close !== undefined, "`close` is supposed to be found");
|
|
323130
323293
|
const group = {
|
|
323131
|
-
type: events[
|
|
323132
|
-
start: { ...events[
|
|
323294
|
+
type: events[open2][1].type === types9.labelLink ? types9.link : types9.image,
|
|
323295
|
+
start: { ...events[open2][1].start },
|
|
323133
323296
|
end: { ...events[events.length - 1][1].end }
|
|
323134
323297
|
};
|
|
323135
323298
|
const label = {
|
|
323136
323299
|
type: types9.label,
|
|
323137
|
-
start: { ...events[
|
|
323300
|
+
start: { ...events[open2][1].start },
|
|
323138
323301
|
end: { ...events[close][1].end }
|
|
323139
323302
|
};
|
|
323140
323303
|
const text = {
|
|
323141
323304
|
type: types9.labelText,
|
|
323142
|
-
start: { ...events[
|
|
323305
|
+
start: { ...events[open2 + offset + 2][1].end },
|
|
323143
323306
|
end: { ...events[close - 2][1].start }
|
|
323144
323307
|
};
|
|
323145
323308
|
media = [
|
|
323146
323309
|
["enter", group, context],
|
|
323147
323310
|
["enter", label, context]
|
|
323148
323311
|
];
|
|
323149
|
-
media = push(media, events.slice(
|
|
323312
|
+
media = push(media, events.slice(open2 + 1, open2 + offset + 3));
|
|
323150
323313
|
media = push(media, [["enter", text, context]]);
|
|
323151
323314
|
ok2(context.parser.constructs.insideSpan.null, "expected `insideSpan.null` to be populated");
|
|
323152
|
-
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(
|
|
323315
|
+
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + offset + 4, close - 3), context));
|
|
323153
323316
|
media = push(media, [
|
|
323154
323317
|
["exit", text, context],
|
|
323155
323318
|
events[close - 2],
|
|
@@ -323158,7 +323321,7 @@ function resolveToLabelEnd(events, context) {
|
|
|
323158
323321
|
]);
|
|
323159
323322
|
media = push(media, events.slice(close + 1));
|
|
323160
323323
|
media = push(media, [["exit", group, context]]);
|
|
323161
|
-
splice(events,
|
|
323324
|
+
splice(events, open2, events.length, media);
|
|
323162
323325
|
return events;
|
|
323163
323326
|
}
|
|
323164
323327
|
function tokenizeLabelEnd(effects2, ok3, nok) {
|
|
@@ -323321,9 +323484,9 @@ function tokenizeLabelStartImage(effects2, ok3, nok) {
|
|
|
323321
323484
|
effects2.enter(types9.labelImageMarker);
|
|
323322
323485
|
effects2.consume(code);
|
|
323323
323486
|
effects2.exit(types9.labelImageMarker);
|
|
323324
|
-
return
|
|
323487
|
+
return open2;
|
|
323325
323488
|
}
|
|
323326
|
-
function
|
|
323489
|
+
function open2(code) {
|
|
323327
323490
|
if (code === codes.leftSquareBracket) {
|
|
323328
323491
|
effects2.enter(types9.labelMarker);
|
|
323329
323492
|
effects2.consume(code);
|
|
@@ -325458,8 +325621,8 @@ function compiler(options) {
|
|
|
325458
325621
|
return length;
|
|
325459
325622
|
}
|
|
325460
325623
|
function opener(create, and) {
|
|
325461
|
-
return
|
|
325462
|
-
function
|
|
325624
|
+
return open2;
|
|
325625
|
+
function open2(token) {
|
|
325463
325626
|
enter.call(this, create(token), token);
|
|
325464
325627
|
if (and)
|
|
325465
325628
|
and.call(this, token);
|
|
@@ -325492,15 +325655,15 @@ function compiler(options) {
|
|
|
325492
325655
|
function exit2(token, onExitError) {
|
|
325493
325656
|
const node4 = this.stack.pop();
|
|
325494
325657
|
ok2(node4, "expected `node`");
|
|
325495
|
-
const
|
|
325496
|
-
if (!
|
|
325658
|
+
const open2 = this.tokenStack.pop();
|
|
325659
|
+
if (!open2) {
|
|
325497
325660
|
throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it’s not open");
|
|
325498
|
-
} else if (
|
|
325661
|
+
} else if (open2[0].type !== token.type) {
|
|
325499
325662
|
if (onExitError) {
|
|
325500
|
-
onExitError.call(this, token,
|
|
325663
|
+
onExitError.call(this, token, open2[0]);
|
|
325501
325664
|
} else {
|
|
325502
|
-
const handler =
|
|
325503
|
-
handler.call(this, token,
|
|
325665
|
+
const handler = open2[1] || defaultOnError;
|
|
325666
|
+
handler.call(this, token, open2[0]);
|
|
325504
325667
|
}
|
|
325505
325668
|
}
|
|
325506
325669
|
ok2(node4.type !== "fragment", "unexpected fragment `exit`ed");
|
|
@@ -327213,30 +327376,30 @@ function gfmStrikethrough(options) {
|
|
|
327213
327376
|
let index2 = -1;
|
|
327214
327377
|
while (++index2 < events.length) {
|
|
327215
327378
|
if (events[index2][0] === "enter" && events[index2][1].type === "strikethroughSequenceTemporary" && events[index2][1]._close) {
|
|
327216
|
-
let
|
|
327217
|
-
while (
|
|
327218
|
-
if (events[
|
|
327379
|
+
let open2 = index2;
|
|
327380
|
+
while (open2--) {
|
|
327381
|
+
if (events[open2][0] === "exit" && events[open2][1].type === "strikethroughSequenceTemporary" && events[open2][1]._open && events[index2][1].end.offset - events[index2][1].start.offset === events[open2][1].end.offset - events[open2][1].start.offset) {
|
|
327219
327382
|
events[index2][1].type = "strikethroughSequence";
|
|
327220
|
-
events[
|
|
327383
|
+
events[open2][1].type = "strikethroughSequence";
|
|
327221
327384
|
const strikethrough = {
|
|
327222
327385
|
type: "strikethrough",
|
|
327223
|
-
start: Object.assign({}, events[
|
|
327386
|
+
start: Object.assign({}, events[open2][1].start),
|
|
327224
327387
|
end: Object.assign({}, events[index2][1].end)
|
|
327225
327388
|
};
|
|
327226
327389
|
const text4 = {
|
|
327227
327390
|
type: "strikethroughText",
|
|
327228
|
-
start: Object.assign({}, events[
|
|
327391
|
+
start: Object.assign({}, events[open2][1].end),
|
|
327229
327392
|
end: Object.assign({}, events[index2][1].start)
|
|
327230
327393
|
};
|
|
327231
327394
|
const nextEvents = [
|
|
327232
327395
|
["enter", strikethrough, context],
|
|
327233
|
-
["enter", events[
|
|
327234
|
-
["exit", events[
|
|
327396
|
+
["enter", events[open2][1], context],
|
|
327397
|
+
["exit", events[open2][1], context],
|
|
327235
327398
|
["enter", text4, context]
|
|
327236
327399
|
];
|
|
327237
327400
|
const insideSpan2 = context.parser.constructs.insideSpan.null;
|
|
327238
327401
|
if (insideSpan2) {
|
|
327239
|
-
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(
|
|
327402
|
+
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(open2 + 1, index2), context));
|
|
327240
327403
|
}
|
|
327241
327404
|
splice(nextEvents, nextEvents.length, 0, [
|
|
327242
327405
|
["exit", text4, context],
|
|
@@ -327244,8 +327407,8 @@ function gfmStrikethrough(options) {
|
|
|
327244
327407
|
["exit", events[index2][1], context],
|
|
327245
327408
|
["exit", strikethrough, context]
|
|
327246
327409
|
]);
|
|
327247
|
-
splice(events,
|
|
327248
|
-
index2 =
|
|
327410
|
+
splice(events, open2 - 1, index2 - open2 + 3, nextEvents);
|
|
327411
|
+
index2 = open2 + nextEvents.length - 2;
|
|
327249
327412
|
break;
|
|
327250
327413
|
}
|
|
327251
327414
|
}
|
|
@@ -327789,8 +327952,8 @@ function gfmTaskListItem() {
|
|
|
327789
327952
|
}
|
|
327790
327953
|
function tokenizeTasklistCheck(effects2, ok4, nok) {
|
|
327791
327954
|
const self = this;
|
|
327792
|
-
return
|
|
327793
|
-
function
|
|
327955
|
+
return open2;
|
|
327956
|
+
function open2(code2) {
|
|
327794
327957
|
ok2(code2 === codes.leftSquareBracket, "expected `[`");
|
|
327795
327958
|
if (self.previous !== codes.eof || !self._gfmTasklistFirstContentOfListItem) {
|
|
327796
327959
|
return nok(code2);
|
|
@@ -328987,9 +329150,9 @@ function splitSharedTextRun(source) {
|
|
|
328987
329150
|
}
|
|
328988
329151
|
if (content3.length <= 1)
|
|
328989
329152
|
return source;
|
|
328990
|
-
const
|
|
329153
|
+
const open2 = source.slice(root.start, root.openEnd);
|
|
328991
329154
|
const close = source.slice(root.closeStart, root.end);
|
|
328992
|
-
return content3.map((leaf) => `${
|
|
329155
|
+
return content3.map((leaf) => `${open2}${properties}${leaf}${close}`).join("");
|
|
328993
329156
|
}
|
|
328994
329157
|
var W11 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
328995
329158
|
var init_wrap_text_selection = __esm(() => {
|
|
@@ -330538,6 +330701,275 @@ var init_raw_block_ref = __esm(() => {
|
|
|
330538
330701
|
init_story_surface();
|
|
330539
330702
|
});
|
|
330540
330703
|
|
|
330704
|
+
// ../../../v2/document-api-v2-adapter/dist/story-surfaces/tracked-body-replacement.js
|
|
330705
|
+
function prepareTrackedBodyReplacement(input) {
|
|
330706
|
+
if (!input.context.readAuthor()?.name)
|
|
330707
|
+
return {
|
|
330708
|
+
ok: false,
|
|
330709
|
+
code: "PRECONDITION_FAILED",
|
|
330710
|
+
message: "Tracked body replacement requires an author."
|
|
330711
|
+
};
|
|
330712
|
+
const before = readBody(input.beforeXml);
|
|
330713
|
+
const after = readBody(input.afterXml);
|
|
330714
|
+
if (!before || !after || before.sectionProperties !== after.sectionProperties) {
|
|
330715
|
+
return {
|
|
330716
|
+
ok: false,
|
|
330717
|
+
code: "CAPABILITY_UNAVAILABLE",
|
|
330718
|
+
message: "Tracked body replacement requires unchanged body section properties."
|
|
330719
|
+
};
|
|
330720
|
+
}
|
|
330721
|
+
const replacement = prepareTrackedBlockRangeReplacement({
|
|
330722
|
+
...input,
|
|
330723
|
+
beforeXml: before.content,
|
|
330724
|
+
afterXml: after.content,
|
|
330725
|
+
namespaceBindings: new Map(Object.entries(before.body.namespaceBindings))
|
|
330726
|
+
});
|
|
330727
|
+
if (!replacement.ok)
|
|
330728
|
+
return replacement;
|
|
330729
|
+
if (input.dryRun)
|
|
330730
|
+
return { ...replacement, xml: input.beforeXml };
|
|
330731
|
+
return {
|
|
330732
|
+
...replacement,
|
|
330733
|
+
xml: input.beforeXml.slice(0, before.body.openEnd) + replacement.xml + before.sectionProperties + input.beforeXml.slice(before.body.closeStart)
|
|
330734
|
+
};
|
|
330735
|
+
}
|
|
330736
|
+
function readBody(xml) {
|
|
330737
|
+
const parsed = collectXmlElementRanges(xml);
|
|
330738
|
+
if (parsed.errors.length)
|
|
330739
|
+
return null;
|
|
330740
|
+
const body = parsed.ranges.find((range) => range.tag.namespaceUri === WORD_NS3 && range.tag.localName === "body");
|
|
330741
|
+
if (!body || body.tag.isSelfClosing)
|
|
330742
|
+
return null;
|
|
330743
|
+
const children2 = [];
|
|
330744
|
+
let cursor = body.openEnd;
|
|
330745
|
+
for (const range of [...parsed.ranges].sort((a, b) => a.start - b.start || b.end - a.end)) {
|
|
330746
|
+
if (range.start < cursor || range.end > body.closeStart)
|
|
330747
|
+
continue;
|
|
330748
|
+
if (xml.slice(cursor, range.start).trim())
|
|
330749
|
+
return null;
|
|
330750
|
+
children2.push(range);
|
|
330751
|
+
cursor = range.end;
|
|
330752
|
+
}
|
|
330753
|
+
if (xml.slice(cursor, body.closeStart).trim())
|
|
330754
|
+
return null;
|
|
330755
|
+
const last = children2.at(-1);
|
|
330756
|
+
const sectionStart = last?.tag.localName === "sectPr" && last.tag.namespaceUri === WORD_NS3 ? last.start : body.closeStart;
|
|
330757
|
+
return {
|
|
330758
|
+
body,
|
|
330759
|
+
children: children2,
|
|
330760
|
+
content: xml.slice(body.openEnd, sectionStart),
|
|
330761
|
+
sectionProperties: xml.slice(sectionStart, body.closeStart)
|
|
330762
|
+
};
|
|
330763
|
+
}
|
|
330764
|
+
var WORD_NS3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
330765
|
+
var init_tracked_body_replacement = __esm(() => {
|
|
330766
|
+
init_sd_document_session_internal();
|
|
330767
|
+
init_tracked_block_range();
|
|
330768
|
+
});
|
|
330769
|
+
|
|
330770
|
+
// ../../../v2/document-api-v2-adapter/dist/core/clear-content-adapter.js
|
|
330771
|
+
class V2ClearContentAdapter {
|
|
330772
|
+
constructor(context) {
|
|
330773
|
+
this.context = context;
|
|
330774
|
+
}
|
|
330775
|
+
clearContent(_input, options) {
|
|
330776
|
+
return this.clearBody(options);
|
|
330777
|
+
}
|
|
330778
|
+
clearSelection(blockIds, options) {
|
|
330779
|
+
return this.clearBody(options, blockIds);
|
|
330780
|
+
}
|
|
330781
|
+
clearBody(options, selectedBlockIds) {
|
|
330782
|
+
const expectedRevision = options?.expectedRevision != null ? String(options.expectedRevision) : undefined;
|
|
330783
|
+
const mutationFailure2 = this.context.validateMutation(options);
|
|
330784
|
+
if (mutationFailure2)
|
|
330785
|
+
return { success: false, failure: mutationFailure2 };
|
|
330786
|
+
const bodyStory = this.context.resolveFullStoryLocator({ kind: "story", storyType: "body" });
|
|
330787
|
+
if ("error" in bodyStory) {
|
|
330788
|
+
return {
|
|
330789
|
+
success: false,
|
|
330790
|
+
failure: {
|
|
330791
|
+
code: "TARGET_NOT_FOUND",
|
|
330792
|
+
message: `body story could not be resolved: ${bodyStory.error}.`
|
|
330793
|
+
}
|
|
330794
|
+
};
|
|
330795
|
+
}
|
|
330796
|
+
const topLevelItems = readTopLevelBodyItems(this.context);
|
|
330797
|
+
const imagesByPara = readBodyParagraphImageMap(this.context);
|
|
330798
|
+
if (isAlreadyClear(topLevelItems, imagesByPara)) {
|
|
330799
|
+
return { success: true, status: "NO_OP" };
|
|
330800
|
+
}
|
|
330801
|
+
const bytes = getSDDocumentSessionInternalPartBytes(this.context.session, bodyStory.partUri);
|
|
330802
|
+
if (!bytes) {
|
|
330803
|
+
return {
|
|
330804
|
+
success: false,
|
|
330805
|
+
failure: { code: "PRECONDITION_FAILED", message: "body part bytes are unavailable." }
|
|
330806
|
+
};
|
|
330807
|
+
}
|
|
330808
|
+
const sourceXml = new TextDecoder().decode(bytes);
|
|
330809
|
+
const paragraphId2 = selectedBlockIds ? getSDDocumentSessionInternalParagraphIndex(this.context.session)?.entries.find((entry) => entry.directBodyChildOrdinal != null)?.blockId ?? selectedBlockIds.at(-1) ?? "00000000" : firstParagraphId(topLevelItems);
|
|
330810
|
+
const removedBlockIds = selectedBlockIds?.filter((blockId) => blockId !== paragraphId2) ?? [];
|
|
330811
|
+
const remappedRefs = selectedBlockIds ? [
|
|
330812
|
+
{
|
|
330813
|
+
from: {
|
|
330814
|
+
kind: "text",
|
|
330815
|
+
blockId: selectedBlockIds[0],
|
|
330816
|
+
range: { start: 0, end: 0 },
|
|
330817
|
+
storyId: bodyStory.storyId
|
|
330818
|
+
},
|
|
330819
|
+
to: {
|
|
330820
|
+
kind: "text",
|
|
330821
|
+
blockId: paragraphId2,
|
|
330822
|
+
range: { start: 0, end: 0 },
|
|
330823
|
+
storyId: bodyStory.storyId
|
|
330824
|
+
}
|
|
330825
|
+
}
|
|
330826
|
+
] : [];
|
|
330827
|
+
let nextXml = rewriteBodyToSingleEmptyParagraph(sourceXml, paragraphId2);
|
|
330828
|
+
if (nextXml == null) {
|
|
330829
|
+
return {
|
|
330830
|
+
success: false,
|
|
330831
|
+
failure: { code: "INTERNAL_ERROR", message: "document body could not be rewritten." }
|
|
330832
|
+
};
|
|
330833
|
+
}
|
|
330834
|
+
const changeMode = options?.changeMode ?? "direct";
|
|
330835
|
+
const createdRefs = [];
|
|
330836
|
+
if (changeMode === "tracked") {
|
|
330837
|
+
const replacement = prepareTrackedBodyReplacement({
|
|
330838
|
+
context: this.context,
|
|
330839
|
+
beforeXml: sourceXml,
|
|
330840
|
+
afterXml: nextXml,
|
|
330841
|
+
dryRun: options?.dryRun
|
|
330842
|
+
});
|
|
330843
|
+
if (!replacement.ok) {
|
|
330844
|
+
return { success: false, failure: { code: replacement.code, message: replacement.message } };
|
|
330845
|
+
}
|
|
330846
|
+
nextXml = replacement.xml;
|
|
330847
|
+
createdRefs.push(...replacement.wordIds.map((entityId) => ({
|
|
330848
|
+
kind: "trackedChange",
|
|
330849
|
+
entityId,
|
|
330850
|
+
storyId: bodyStory.storyId
|
|
330851
|
+
})));
|
|
330852
|
+
createdRefs.push(...replacement.paragraphIds.map((nodeId) => ({
|
|
330853
|
+
kind: "block",
|
|
330854
|
+
nodeId,
|
|
330855
|
+
storyId: bodyStory.storyId
|
|
330856
|
+
})));
|
|
330857
|
+
}
|
|
330858
|
+
if (options?.dryRun)
|
|
330859
|
+
return { success: true };
|
|
330860
|
+
const nextBytes = TE49.encode(nextXml);
|
|
330861
|
+
const committed = commitKernelStorySurfacePatch({
|
|
330862
|
+
context: this.context,
|
|
330863
|
+
txIdPrefix: selectedBlockIds ? "range-ref-whole-body-replace" : "internal-clearContent",
|
|
330864
|
+
expectedRevision,
|
|
330865
|
+
perPart: {
|
|
330866
|
+
[bodyStory.partUri]: replaceWholePartEntry(bytes, nextBytes)
|
|
330867
|
+
},
|
|
330868
|
+
storyIds: [bodyStory.storyId],
|
|
330869
|
+
createdRefs,
|
|
330870
|
+
remappedRefs,
|
|
330871
|
+
invalidatedRefs: removedBlockIds.map((nodeId) => ({ kind: "block", nodeId, storyId: bodyStory.storyId })),
|
|
330872
|
+
signalLanesToRebuild: ["paragraphIndex", "sections", "headings", "manualPageBreaks", "drawings", "noteAnchorRefs"],
|
|
330873
|
+
indexRefreshScope: {
|
|
330874
|
+
perPart: {
|
|
330875
|
+
[bodyStory.partUri]: {
|
|
330876
|
+
beforeWindow: { startByte: 0, endByte: bytes.length },
|
|
330877
|
+
kind: "wide-rewrite",
|
|
330878
|
+
reason: "clear-content-whole-body-rewrite"
|
|
330879
|
+
}
|
|
330880
|
+
}
|
|
330881
|
+
},
|
|
330882
|
+
storySurface: {
|
|
330883
|
+
family: "storyBlocks",
|
|
330884
|
+
...selectedBlockIds ? { targetBlockIds: [...selectedBlockIds] } : {},
|
|
330885
|
+
changeMode
|
|
330886
|
+
}
|
|
330887
|
+
});
|
|
330888
|
+
if (!committed.ok) {
|
|
330889
|
+
return {
|
|
330890
|
+
success: false,
|
|
330891
|
+
failure: {
|
|
330892
|
+
code: committed.code,
|
|
330893
|
+
message: committed.message
|
|
330894
|
+
}
|
|
330895
|
+
};
|
|
330896
|
+
}
|
|
330897
|
+
const inserted = projectTrackedStructuralEntityIds(this.context, createdRefs.flatMap((ref5) => ref5.kind === "trackedChange" ? [ref5.entityId] : [])).map((entityId) => ({ kind: "entity", entityType: "trackedChange", entityId }));
|
|
330898
|
+
const receipt3 = {
|
|
330899
|
+
success: true,
|
|
330900
|
+
txId: committed.txId,
|
|
330901
|
+
affectedStories: [{ kind: "story", storyType: "body" }],
|
|
330902
|
+
...selectedBlockIds ? {
|
|
330903
|
+
remappedRefs: remappedRefs.map(({ from, to }) => ({
|
|
330904
|
+
from: {
|
|
330905
|
+
kind: "text",
|
|
330906
|
+
blockId: from.blockId,
|
|
330907
|
+
range: from.range,
|
|
330908
|
+
story: { kind: "story", storyType: "body" }
|
|
330909
|
+
},
|
|
330910
|
+
to: {
|
|
330911
|
+
kind: "text",
|
|
330912
|
+
blockId: to.blockId,
|
|
330913
|
+
range: to.range,
|
|
330914
|
+
story: { kind: "story", storyType: "body" }
|
|
330915
|
+
}
|
|
330916
|
+
})),
|
|
330917
|
+
invalidatedRefs: removedBlockIds.map((nodeId) => ({ kind: "block", nodeId, story: { kind: "story", storyType: "body" } }))
|
|
330918
|
+
} : {},
|
|
330919
|
+
...inserted.length ? { inserted } : {}
|
|
330920
|
+
};
|
|
330921
|
+
const renderCommit = getSDRenderCommitEnvelope(committed);
|
|
330922
|
+
if (renderCommit)
|
|
330923
|
+
attachSDRenderCommitEnvelope(receipt3, renderCommit);
|
|
330924
|
+
return receipt3;
|
|
330925
|
+
}
|
|
330926
|
+
}
|
|
330927
|
+
function isAlreadyClear(items, imagesByPara) {
|
|
330928
|
+
if (items.length !== 1 || items[0]?.kind !== "paragraph")
|
|
330929
|
+
return false;
|
|
330930
|
+
const paragraph3 = items[0].paragraph;
|
|
330931
|
+
return paragraph3.text.length === 0 && (imagesByPara.get(paragraph3.blockId)?.length ?? 0) === 0;
|
|
330932
|
+
}
|
|
330933
|
+
function firstParagraphId(items) {
|
|
330934
|
+
const paragraph3 = items.find((item) => item.kind === "paragraph");
|
|
330935
|
+
return paragraph3?.paragraph.blockId ?? "00000000";
|
|
330936
|
+
}
|
|
330937
|
+
function rewriteBodyToSingleEmptyParagraph(xml, paragraphId2) {
|
|
330938
|
+
const parsed = collectXmlElementRanges(xml);
|
|
330939
|
+
if (parsed.errors.length)
|
|
330940
|
+
return null;
|
|
330941
|
+
const body = parsed.ranges.find(({ tag }) => (tag.namespaceUri === WORD_NS4 || tag.namespaceUri === STRICT_WORD_NS) && tag.localName === "body" && tag.prefix);
|
|
330942
|
+
if (!body || body.tag.isSelfClosing)
|
|
330943
|
+
return null;
|
|
330944
|
+
let trailingBodyChild;
|
|
330945
|
+
for (const range of parsed.ranges) {
|
|
330946
|
+
if (range.start >= body.openEnd && range.end <= body.closeStart && (!trailingBodyChild || range.end > trailingBodyChild.end)) {
|
|
330947
|
+
trailingBodyChild = range;
|
|
330948
|
+
}
|
|
330949
|
+
}
|
|
330950
|
+
const sectPrXml = trailingBodyChild?.tag.localName === "sectPr" && (trailingBodyChild.tag.namespaceUri === WORD_NS4 || trailingBodyChild.tag.namespaceUri === STRICT_WORD_NS) ? xml.slice(trailingBodyChild.start, trailingBodyChild.end) : "";
|
|
330951
|
+
const wordPrefix = body.tag.prefix;
|
|
330952
|
+
let identityPrefix = Object.entries(body.namespaceBindings).find(([prefix, uri]) => prefix && uri === WORD_2010_NS)?.[0];
|
|
330953
|
+
let identityNamespace = "";
|
|
330954
|
+
if (!identityPrefix) {
|
|
330955
|
+
identityPrefix = "w14";
|
|
330956
|
+
while (body.namespaceBindings[identityPrefix])
|
|
330957
|
+
identityPrefix += "sd";
|
|
330958
|
+
identityNamespace = ` xmlns:${identityPrefix}="${WORD_2010_NS}"`;
|
|
330959
|
+
}
|
|
330960
|
+
const emptyParagraph = `<${wordPrefix}:p${identityNamespace} ${identityPrefix}:paraId="${paragraphId2}">` + `<${wordPrefix}:r><${wordPrefix}:t></${wordPrefix}:t></${wordPrefix}:r></${wordPrefix}:p>`;
|
|
330961
|
+
return `${xml.slice(0, body.openEnd)}${emptyParagraph}${sectPrXml}${xml.slice(body.closeStart)}`;
|
|
330962
|
+
}
|
|
330963
|
+
var TE49, WORD_NS4 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", STRICT_WORD_NS = "http://purl.oclc.org/ooxml/wordprocessingml/main", WORD_2010_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
330964
|
+
var init_clear_content_adapter = __esm(() => {
|
|
330965
|
+
init_sd_document_session_internal();
|
|
330966
|
+
init_document_reader();
|
|
330967
|
+
init_xml();
|
|
330968
|
+
init_tracked_body_replacement();
|
|
330969
|
+
init_receipt_entities();
|
|
330970
|
+
TE49 = new TextEncoder;
|
|
330971
|
+
});
|
|
330972
|
+
|
|
330541
330973
|
// ../../../v2/document-api-v2-adapter/dist/selection-mutation/replacement-span.js
|
|
330542
330974
|
function uniqueTokenAnchors(before, after) {
|
|
330543
330975
|
const uniquePositions = (tokens) => {
|
|
@@ -331193,72 +331625,6 @@ var init_adapter8 = __esm(() => {
|
|
|
331193
331625
|
TD90 = new TextDecoder;
|
|
331194
331626
|
});
|
|
331195
331627
|
|
|
331196
|
-
// ../../../v2/document-api-v2-adapter/dist/story-surfaces/tracked-body-replacement.js
|
|
331197
|
-
function prepareTrackedBodyReplacement(input) {
|
|
331198
|
-
if (!input.context.readAuthor()?.name)
|
|
331199
|
-
return {
|
|
331200
|
-
ok: false,
|
|
331201
|
-
code: "PRECONDITION_FAILED",
|
|
331202
|
-
message: "Tracked body replacement requires an author."
|
|
331203
|
-
};
|
|
331204
|
-
const before = readBody(input.beforeXml);
|
|
331205
|
-
const after = readBody(input.afterXml);
|
|
331206
|
-
if (!before || !after || before.sectionProperties !== after.sectionProperties) {
|
|
331207
|
-
return {
|
|
331208
|
-
ok: false,
|
|
331209
|
-
code: "CAPABILITY_UNAVAILABLE",
|
|
331210
|
-
message: "Tracked body replacement requires unchanged body section properties."
|
|
331211
|
-
};
|
|
331212
|
-
}
|
|
331213
|
-
const replacement = prepareTrackedBlockRangeReplacement({
|
|
331214
|
-
...input,
|
|
331215
|
-
beforeXml: before.content,
|
|
331216
|
-
afterXml: after.content,
|
|
331217
|
-
namespaceBindings: new Map(Object.entries(before.body.namespaceBindings))
|
|
331218
|
-
});
|
|
331219
|
-
if (!replacement.ok)
|
|
331220
|
-
return replacement;
|
|
331221
|
-
if (input.dryRun)
|
|
331222
|
-
return { ...replacement, xml: input.beforeXml };
|
|
331223
|
-
return {
|
|
331224
|
-
...replacement,
|
|
331225
|
-
xml: input.beforeXml.slice(0, before.body.openEnd) + replacement.xml + before.sectionProperties + input.beforeXml.slice(before.body.closeStart)
|
|
331226
|
-
};
|
|
331227
|
-
}
|
|
331228
|
-
function readBody(xml) {
|
|
331229
|
-
const parsed = collectXmlElementRanges(xml);
|
|
331230
|
-
if (parsed.errors.length)
|
|
331231
|
-
return null;
|
|
331232
|
-
const body = parsed.ranges.find((range) => range.tag.namespaceUri === WORD_NS3 && range.tag.localName === "body");
|
|
331233
|
-
if (!body || body.tag.isSelfClosing)
|
|
331234
|
-
return null;
|
|
331235
|
-
const children2 = [];
|
|
331236
|
-
let cursor = body.openEnd;
|
|
331237
|
-
for (const range of [...parsed.ranges].sort((a, b) => a.start - b.start || b.end - a.end)) {
|
|
331238
|
-
if (range.start < cursor || range.end > body.closeStart)
|
|
331239
|
-
continue;
|
|
331240
|
-
if (xml.slice(cursor, range.start).trim())
|
|
331241
|
-
return null;
|
|
331242
|
-
children2.push(range);
|
|
331243
|
-
cursor = range.end;
|
|
331244
|
-
}
|
|
331245
|
-
if (xml.slice(cursor, body.closeStart).trim())
|
|
331246
|
-
return null;
|
|
331247
|
-
const last = children2.at(-1);
|
|
331248
|
-
const sectionStart = last?.tag.localName === "sectPr" && last.tag.namespaceUri === WORD_NS3 ? last.start : body.closeStart;
|
|
331249
|
-
return {
|
|
331250
|
-
body,
|
|
331251
|
-
children: children2,
|
|
331252
|
-
content: xml.slice(body.openEnd, sectionStart),
|
|
331253
|
-
sectionProperties: xml.slice(sectionStart, body.closeStart)
|
|
331254
|
-
};
|
|
331255
|
-
}
|
|
331256
|
-
var WORD_NS3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
331257
|
-
var init_tracked_body_replacement = __esm(() => {
|
|
331258
|
-
init_sd_document_session_internal();
|
|
331259
|
-
init_tracked_block_range();
|
|
331260
|
-
});
|
|
331261
|
-
|
|
331262
331628
|
// ../../../v2/document-api-v2-adapter/dist/selection-mutation/whole-body-selection-text.js
|
|
331263
331629
|
function rewriteWholeBodySelectionText(bytes, index2, text4) {
|
|
331264
331630
|
const first = index2.entries[0];
|
|
@@ -331342,14 +331708,14 @@ function rewritePlainBody(bytes, index2, text4) {
|
|
|
331342
331708
|
return end;
|
|
331343
331709
|
if (splitExistingRevision)
|
|
331344
331710
|
return { ok: false, reason: "unsupported-context" };
|
|
331345
|
-
const
|
|
331711
|
+
const open2 = matchParagraphOpenTag(firstXml);
|
|
331346
331712
|
const close = firstXml.match(/<\/[\w.-]+:p>\s*$/)?.[0];
|
|
331347
|
-
if (!
|
|
331713
|
+
if (!open2 || !close)
|
|
331348
331714
|
return { ok: false, reason: "invalid-range" };
|
|
331349
|
-
const inner = firstXml.slice(
|
|
331715
|
+
const inner = firstXml.slice(open2.length, firstXml.length - close.length);
|
|
331350
331716
|
const properties = matchLeadingElement(inner, "pPr");
|
|
331351
331717
|
const rewritten = rewriteSDDirectParagraphText({
|
|
331352
|
-
paragraphXml:
|
|
331718
|
+
paragraphXml: open2 + properties + start.head + end.tail + close,
|
|
331353
331719
|
startOffset: 0,
|
|
331354
331720
|
endOffset: 0,
|
|
331355
331721
|
newText: text4
|
|
@@ -332471,6 +332837,35 @@ class V2SelectionMutationAdapter {
|
|
|
332471
332837
|
if (!selectionIsAllowedByDocumentProtection(this.context, target, index2, story.storyId)) {
|
|
332472
332838
|
return failureWithoutResolution("PERMISSION_DENIED", PERMISSION_DENIED_DOC_PROTECTION);
|
|
332473
332839
|
}
|
|
332840
|
+
if (request.text === "" && (options?.changeMode ?? "direct") === "direct" && story.storyKind === "main") {
|
|
332841
|
+
const wholeStory = resolveExactDirectWholeBodySelection({
|
|
332842
|
+
target,
|
|
332843
|
+
index: index2,
|
|
332844
|
+
session: this.context.session,
|
|
332845
|
+
offsetSpace,
|
|
332846
|
+
storyLocator
|
|
332847
|
+
});
|
|
332848
|
+
if (wholeStory) {
|
|
332849
|
+
if ("error" in wholeStory)
|
|
332850
|
+
return failureWithoutResolution(wholeStory.error, wholeStory.message);
|
|
332851
|
+
const resolution2 = buildCrossParagraphResolution({
|
|
332852
|
+
plan: {
|
|
332853
|
+
kind: "cross-paragraph",
|
|
332854
|
+
startBlockId: wholeStory.resolved.startBlockId,
|
|
332855
|
+
endBlockId: wholeStory.resolved.endBlockId,
|
|
332856
|
+
startOffset: wholeStory.resolved.startOffset,
|
|
332857
|
+
endOffset: wholeStory.resolved.endOffset,
|
|
332858
|
+
startTextLength: index2.entries[0].textLength,
|
|
332859
|
+
normalizedTarget: wholeStory.normalizedTarget,
|
|
332860
|
+
resolved: wholeStory.resolved
|
|
332861
|
+
},
|
|
332862
|
+
story: effectiveResolutionStory(story, storyLocator),
|
|
332863
|
+
selectedText: readResolvedMultiParagraphText(index2, this.context.session, wholeStory.resolved)
|
|
332864
|
+
});
|
|
332865
|
+
const receipt4 = new V2ClearContentAdapter(this.context).clearSelection(index2.entries.map((entry) => entry.blockId), options);
|
|
332866
|
+
return { ...receipt4, resolution: resolution2 };
|
|
332867
|
+
}
|
|
332868
|
+
}
|
|
332474
332869
|
if ((options?.changeMode ?? "direct") === "tracked" && story.storyKind === "main") {
|
|
332475
332870
|
const wholeStory = resolveExactTrackedWholeStorySelection({
|
|
332476
332871
|
target,
|
|
@@ -332529,7 +332924,7 @@ class V2SelectionMutationAdapter {
|
|
|
332529
332924
|
});
|
|
332530
332925
|
}
|
|
332531
332926
|
}
|
|
332532
|
-
if (
|
|
332927
|
+
if (target.start.kind === "text" && target.end.kind === "text" && target.start.blockId !== target.end.blockId && selectionCrossesTableCells(index2, (partUri) => getSDDocumentSessionInternalPartBytes(this.context.session, partUri), target)) {
|
|
332533
332928
|
return this.executeCrossTableTextReplace({
|
|
332534
332929
|
target,
|
|
332535
332930
|
index: index2,
|
|
@@ -332829,6 +333224,7 @@ class V2SelectionMutationAdapter {
|
|
|
332829
333224
|
}
|
|
332830
333225
|
executeCrossTableTextReplace(input) {
|
|
332831
333226
|
const { target, index: index2, text: text4, story, storyLocator, offsetSpace, options } = input;
|
|
333227
|
+
const directDelete = text4 === "" && (options?.changeMode ?? "direct") === "direct";
|
|
332832
333228
|
if (target.coordinateSpace === "tracked") {
|
|
332833
333229
|
return failureWithoutResolution("CAPABILITY_UNAVAILABLE", "text-range-cross-paragraph-tracked-coordinate-unsupported");
|
|
332834
333230
|
}
|
|
@@ -332843,6 +333239,8 @@ class V2SelectionMutationAdapter {
|
|
|
332843
333239
|
if ("error" in plan)
|
|
332844
333240
|
return failureWithoutResolution(plan.error, plan.message);
|
|
332845
333241
|
if (plan.segments.some((segment) => segment.firstBlockId !== segment.lastBlockId || segment.selectedObjects.length > 0)) {
|
|
333242
|
+
if (directDelete)
|
|
333243
|
+
return this.executeCrossCellDelete(input);
|
|
332846
333244
|
return failureWithoutResolution("CAPABILITY_UNAVAILABLE", "table text replacement requires one text paragraph per selected container.");
|
|
332847
333245
|
}
|
|
332848
333246
|
const first = index2.byParaId(plan.startBlockId);
|
|
@@ -332850,6 +333248,9 @@ class V2SelectionMutationAdapter {
|
|
|
332850
333248
|
if (!bytes)
|
|
332851
333249
|
return failureWithoutResolution("PRECONDITION_FAILED", "selection story bytes are unavailable.");
|
|
332852
333250
|
const globalFailure = validateSelectionTextReplacement({ bytes, index: index2, on: plan });
|
|
333251
|
+
if (directDelete && (globalFailure || plan.segments.every((segment) => segment.firstOffset === segment.lastOffset) || selectedParagraphsContainNativeFields(bytes, index2, plan))) {
|
|
333252
|
+
return this.executeCrossCellDelete(input);
|
|
333253
|
+
}
|
|
332853
333254
|
if (globalFailure)
|
|
332854
333255
|
return failureWithoutResolution(mapRejectionReason(globalFailure), globalFailure);
|
|
332855
333256
|
const edits = [];
|
|
@@ -333983,7 +334384,7 @@ class V2SelectionMutationAdapter {
|
|
|
333983
334384
|
txIdPrefix: "range-ref-whole-body-replace",
|
|
333984
334385
|
expectedRevision: options?.expectedRevision != null ? String(options.expectedRevision) : undefined,
|
|
333985
334386
|
perPart: {
|
|
333986
|
-
[story.partUri]: replaceWholePartEntry(bytes,
|
|
334387
|
+
[story.partUri]: replaceWholePartEntry(bytes, TE50.encode(nextXml))
|
|
333987
334388
|
},
|
|
333988
334389
|
storyIds: [story.storyId],
|
|
333989
334390
|
createdRefs,
|
|
@@ -334387,6 +334788,206 @@ function resolveExactTrackedWholeStorySelection(input) {
|
|
|
334387
334788
|
}
|
|
334388
334789
|
};
|
|
334389
334790
|
}
|
|
334791
|
+
function selectedParagraphsContainNativeFields(bytes, index2, plan) {
|
|
334792
|
+
const first = index2.byParaId(plan.startBlockId);
|
|
334793
|
+
const last = index2.byParaId(plan.endBlockId);
|
|
334794
|
+
const start = TD93.decode(bytes.subarray(0, first.byteStart)).length;
|
|
334795
|
+
const end = TD93.decode(bytes.subarray(0, last.byteEnd)).length;
|
|
334796
|
+
const parsed = collectXmlElementRanges(TD93.decode(bytes));
|
|
334797
|
+
if (parsed.errors.length)
|
|
334798
|
+
return true;
|
|
334799
|
+
return parsed.ranges.some(({ tag, start: fieldStart, end: fieldEnd }) => fieldStart >= start && fieldEnd <= end && (tag.namespaceUri === "http://schemas.openxmlformats.org/wordprocessingml/2006/main" || tag.namespaceUri === "http://purl.oclc.org/ooxml/wordprocessingml/main") && ["fldSimple", "fldChar", "instrText"].includes(tag.localName));
|
|
334800
|
+
}
|
|
334801
|
+
function resolveExactDirectWholeBodySelection(input) {
|
|
334802
|
+
const { target, index: index2 } = input;
|
|
334803
|
+
if (!isBodyStory(input.storyLocator) || !selectionTargetStoriesMatch(target, input.storyLocator) || target.start.kind !== "text" || target.end.kind !== "text" || target.coordinateSpace === "tracked" || index2.entries.length === 0)
|
|
334804
|
+
return null;
|
|
334805
|
+
if (target.start.blockId === target.end.blockId && target.start.offset === target.end.offset)
|
|
334806
|
+
return null;
|
|
334807
|
+
const first = index2.entries[0];
|
|
334808
|
+
const last = index2.entries[index2.entries.length - 1];
|
|
334809
|
+
let start = target.start;
|
|
334810
|
+
let end = target.end;
|
|
334811
|
+
if (first.blockId !== last.blockId && start.blockId === last.blockId && end.blockId === first.blockId) {
|
|
334812
|
+
[start, end] = [end, start];
|
|
334813
|
+
}
|
|
334814
|
+
if (start.blockId !== first.blockId || end.blockId !== last.blockId || start.offset !== 0)
|
|
334815
|
+
return null;
|
|
334816
|
+
const bytes = getSDDocumentSessionInternalPartBytes(input.session, first.partUri);
|
|
334817
|
+
if (!bytes)
|
|
334818
|
+
return null;
|
|
334819
|
+
const map3 = buildStructuralBoundaryMap(bytes);
|
|
334820
|
+
if (map3.contexts.length !== index2.entries.length)
|
|
334821
|
+
return null;
|
|
334822
|
+
if (!map3.contexts.some((context) => context.blockSdtPath.length > 0))
|
|
334823
|
+
return null;
|
|
334824
|
+
if (map3.contexts.some((context) => context.sectionIndex !== 0 || context.carriesSectionBreak || context.blockCustomXmlPath.length > 0 || context.hasMathObject))
|
|
334825
|
+
return null;
|
|
334826
|
+
const namespaces = getSDDocumentSessionInternalMainStoryRootNamespaceBindings(input.session) ?? {};
|
|
334827
|
+
const inlineMap = (entry) => parseParagraphInlineMap(TD93.decode(bytes.subarray(entry.byteStart, entry.byteEnd)), namespaces);
|
|
334828
|
+
const firstInline = inlineMap(first);
|
|
334829
|
+
const lastInline = first === last ? firstInline : inlineMap(last);
|
|
334830
|
+
const objectCount = (inline) => inline.leaves().filter((piece) => piece.kind === "container" && ["drawing", "object", "pict"].includes(piece.containerKind)).length;
|
|
334831
|
+
const firstObjects = objectCount(firstInline);
|
|
334832
|
+
const lastObjects = first === last ? firstObjects : objectCount(lastInline);
|
|
334833
|
+
if ((firstObjects > 0 || lastObjects > 0) && input.offsetSpace !== "selection")
|
|
334834
|
+
return null;
|
|
334835
|
+
const lastPaintedObjects = input.offsetSpace === "selection" ? preparePaintedOffsets(TD93.decode(bytes.subarray(last.byteStart, last.byteEnd)), namespaces).containedObjectOrdinals(0, Infinity).length : 0;
|
|
334836
|
+
if (end.offset !== last.textLength + lastPaintedObjects)
|
|
334837
|
+
return null;
|
|
334838
|
+
const wholeStory = resolveExactTrackedWholeStorySelection(input);
|
|
334839
|
+
if (!wholeStory || "error" in wholeStory)
|
|
334840
|
+
return wholeStory;
|
|
334841
|
+
const xml = TD93.decode(bytes);
|
|
334842
|
+
const parsed = collectXmlElementRanges(xml);
|
|
334843
|
+
const wordNamespaces = [
|
|
334844
|
+
"http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
334845
|
+
"http://purl.oclc.org/ooxml/wordprocessingml/main"
|
|
334846
|
+
];
|
|
334847
|
+
const hasTrailingHiddenRevision = (pieces) => pieces.some((piece) => {
|
|
334848
|
+
if (piece.kind === "tracked" && piece.removesVisible && piece.visibleStart === lastInline.visibleLength && piece.visibleEnd === lastInline.visibleLength && wordNamespaces.includes(piece.namespaceBindings.get(piece.prefix ?? "") ?? ""))
|
|
334849
|
+
return true;
|
|
334850
|
+
return "children" in piece && hasTrailingHiddenRevision(piece.children);
|
|
334851
|
+
});
|
|
334852
|
+
if (hasTrailingHiddenRevision(lastInline.pieces))
|
|
334853
|
+
return null;
|
|
334854
|
+
const hasAmbiguousEndpointField = (inline, entry, boundary) => {
|
|
334855
|
+
const paragraphCharStart = TD93.decode(bytes.subarray(0, entry.byteStart)).length;
|
|
334856
|
+
const elementAt = (piece) => parsed.ranges.find((range) => range.start === paragraphCharStart + piece.charStart);
|
|
334857
|
+
const fields = [];
|
|
334858
|
+
const collectFields = (pieces) => {
|
|
334859
|
+
for (const piece of pieces) {
|
|
334860
|
+
if (piece.kind === "container" && ["fldSimple", "complexField"].includes(piece.containerKind)) {
|
|
334861
|
+
const element = piece.containerKind === "fldSimple" ? piece : piece.children[0];
|
|
334862
|
+
if (element && wordNamespaces.includes(elementAt(element)?.tag.namespaceUri ?? ""))
|
|
334863
|
+
fields.push(piece);
|
|
334864
|
+
}
|
|
334865
|
+
if ("children" in piece)
|
|
334866
|
+
collectFields(piece.children);
|
|
334867
|
+
}
|
|
334868
|
+
};
|
|
334869
|
+
collectFields(inline.pieces);
|
|
334870
|
+
const begins = [];
|
|
334871
|
+
for (const piece of inline.leaves()) {
|
|
334872
|
+
if (piece.kind !== "marker" || piece.role !== "field")
|
|
334873
|
+
continue;
|
|
334874
|
+
const element = elementAt(piece);
|
|
334875
|
+
if (!element || !wordNamespaces.includes(element.tag.namespaceUri))
|
|
334876
|
+
continue;
|
|
334877
|
+
const type = element.tag.attributes.find((attribute) => attribute.localName === "fldCharType" && wordNamespaces.includes(attribute.namespaceUri))?.value;
|
|
334878
|
+
if (type === "begin")
|
|
334879
|
+
begins.push(piece);
|
|
334880
|
+
if (type === "end" && begins.length > 0) {
|
|
334881
|
+
const begin = begins.pop();
|
|
334882
|
+
fields.push({
|
|
334883
|
+
byteStart: begin.byteStart,
|
|
334884
|
+
byteEnd: piece.byteEnd,
|
|
334885
|
+
visibleStart: begin.visibleStart,
|
|
334886
|
+
visibleEnd: piece.visibleEnd
|
|
334887
|
+
});
|
|
334888
|
+
}
|
|
334889
|
+
}
|
|
334890
|
+
return fields.some((field) => field.visibleStart === boundary && field.visibleEnd === boundary && !fields.some((parent) => parent.byteStart <= field.byteStart && parent.byteEnd >= field.byteEnd && parent.visibleStart < parent.visibleEnd));
|
|
334891
|
+
};
|
|
334892
|
+
if (hasAmbiguousEndpointField(firstInline, first, 0) || hasAmbiguousEndpointField(lastInline, last, lastInline.visibleLength))
|
|
334893
|
+
return null;
|
|
334894
|
+
const hasNativeUnknown = (pieces, paragraphCharStart) => pieces.some((piece) => {
|
|
334895
|
+
if (piece.kind === "unknown" || piece.kind === "container" && piece.containerKind === "unknown") {
|
|
334896
|
+
const element = parsed.ranges.find((range) => range.start === paragraphCharStart + piece.charStart);
|
|
334897
|
+
if (element && wordNamespaces.includes(element.tag.namespaceUri))
|
|
334898
|
+
return true;
|
|
334899
|
+
}
|
|
334900
|
+
return "children" in piece && hasNativeUnknown(piece.children, paragraphCharStart);
|
|
334901
|
+
});
|
|
334902
|
+
if (hasNativeUnknown(firstInline.pieces, TD93.decode(bytes.subarray(0, first.byteStart)).length) || first !== last && hasNativeUnknown(lastInline.pieces, TD93.decode(bytes.subarray(0, last.byteStart)).length)) {
|
|
334903
|
+
return null;
|
|
334904
|
+
}
|
|
334905
|
+
const mathNamespaces = [
|
|
334906
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/math",
|
|
334907
|
+
"http://purl.oclc.org/ooxml/officeDocument/math"
|
|
334908
|
+
];
|
|
334909
|
+
if (parsed.ranges.some((range) => ["altChunk", "subDoc"].includes(range.tag.localName) && wordNamespaces.includes(range.tag.namespaceUri)))
|
|
334910
|
+
return null;
|
|
334911
|
+
const paragraphProperties = parsed.ranges.filter((range) => range.tag.localName === "pPr" && wordNamespaces.includes(range.tag.namespaceUri));
|
|
334912
|
+
if (parsed.ranges.some((range) => mathNamespaces.includes(range.tag.namespaceUri) && ["oMath", "oMathPara"].includes(range.tag.localName) || wordNamespaces.includes(range.tag.namespaceUri) && range.tag.localName === "sectPr" && paragraphProperties.some((properties) => range.start >= properties.openEnd && range.end <= properties.closeStart)))
|
|
334913
|
+
return null;
|
|
334914
|
+
const anchoredNames = new Set([
|
|
334915
|
+
"commentRangeStart",
|
|
334916
|
+
"commentRangeEnd",
|
|
334917
|
+
"commentReference",
|
|
334918
|
+
"bookmarkStart",
|
|
334919
|
+
"bookmarkEnd",
|
|
334920
|
+
"footnoteReference",
|
|
334921
|
+
"endnoteReference",
|
|
334922
|
+
"permStart",
|
|
334923
|
+
"permEnd"
|
|
334924
|
+
]);
|
|
334925
|
+
if (parsed.ranges.some((range) => anchoredNames.has(range.tag.localName) && wordNamespaces.includes(range.tag.namespaceUri)))
|
|
334926
|
+
return null;
|
|
334927
|
+
const lockFailure = guardContentControlDeletion({ xml, start: 0, end: xml.length, operation: "whole-body-selection-delete" });
|
|
334928
|
+
if (lockFailure)
|
|
334929
|
+
return { error: lockFailure.code, message: lockFailure.message };
|
|
334930
|
+
const children2 = new Map;
|
|
334931
|
+
const ancestors = [];
|
|
334932
|
+
for (const range of [...parsed.ranges].sort((left, right) => left.start - right.start)) {
|
|
334933
|
+
while (ancestors.length && ancestors.at(-1).end <= range.start)
|
|
334934
|
+
ancestors.pop();
|
|
334935
|
+
const parent = ancestors.at(-1);
|
|
334936
|
+
if (parent) {
|
|
334937
|
+
const siblings = children2.get(parent.start) ?? [];
|
|
334938
|
+
siblings.push(range);
|
|
334939
|
+
children2.set(parent.start, siblings);
|
|
334940
|
+
}
|
|
334941
|
+
if (!range.tag.isSelfClosing)
|
|
334942
|
+
ancestors.push(range);
|
|
334943
|
+
}
|
|
334944
|
+
const nativeWord = (range, name) => range.tag.localName === name && wordNamespaces.includes(range.tag.namespaceUri);
|
|
334945
|
+
const propertyNamespaces = [
|
|
334946
|
+
...wordNamespaces,
|
|
334947
|
+
"http://schemas.microsoft.com/office/word/2010/wordml",
|
|
334948
|
+
"http://schemas.microsoft.com/office/word/2012/wordml"
|
|
334949
|
+
];
|
|
334950
|
+
const nonEditableProperties = new Set([
|
|
334951
|
+
"dataBinding",
|
|
334952
|
+
"checkbox",
|
|
334953
|
+
"dropDownList",
|
|
334954
|
+
"comboBox",
|
|
334955
|
+
"date",
|
|
334956
|
+
"picture",
|
|
334957
|
+
"repeatingSection",
|
|
334958
|
+
"repeatingSectionItem",
|
|
334959
|
+
"bibliography",
|
|
334960
|
+
"citation",
|
|
334961
|
+
"docPartObj",
|
|
334962
|
+
"docPartList",
|
|
334963
|
+
"group",
|
|
334964
|
+
"entityPicker",
|
|
334965
|
+
"equation"
|
|
334966
|
+
]);
|
|
334967
|
+
const alternateContent = parsed.ranges.filter((range) => range.tag.localName === "AlternateContent" && range.tag.namespaceUri === "http://schemas.openxmlformats.org/markup-compatibility/2006");
|
|
334968
|
+
const protectedPropertyElements = parsed.ranges.filter((range) => propertyNamespaces.includes(range.tag.namespaceUri) && nonEditableProperties.has(range.tag.localName) || nativeWord(range, "lock"));
|
|
334969
|
+
const hasWrappedControlProperties = (range) => {
|
|
334970
|
+
if (nativeWord(range, "sdtPr"))
|
|
334971
|
+
return true;
|
|
334972
|
+
if (nativeWord(range, "sdt") || nativeWord(range, "sdtContent"))
|
|
334973
|
+
return false;
|
|
334974
|
+
return (children2.get(range.start) ?? []).some(hasWrappedControlProperties);
|
|
334975
|
+
};
|
|
334976
|
+
for (const control2 of parsed.ranges.filter((range) => nativeWord(range, "sdt"))) {
|
|
334977
|
+
const directChildren4 = children2.get(control2.start) ?? [];
|
|
334978
|
+
const properties = directChildren4.filter((range) => nativeWord(range, "sdtPr"));
|
|
334979
|
+
if (directChildren4.some((range) => !properties.includes(range) && hasWrappedControlProperties(range)))
|
|
334980
|
+
return null;
|
|
334981
|
+
if (properties.some((property2) => alternateContent.some((range) => range.start >= property2.openEnd && range.end <= property2.closeStart)))
|
|
334982
|
+
return null;
|
|
334983
|
+
if (properties.some((property2) => protectedPropertyElements.some((range) => range.start >= property2.openEnd && range.end <= property2.closeStart && !(children2.get(property2.start) ?? []).includes(range))))
|
|
334984
|
+
return null;
|
|
334985
|
+
if (properties.length > 1 || directChildren4.filter((range) => nativeWord(range, "sdtContent")).length !== 1 || properties.some((property2) => (children2.get(property2.start) ?? []).some((range) => propertyNamespaces.includes(range.tag.namespaceUri) && nonEditableProperties.has(range.tag.localName)))) {
|
|
334986
|
+
return { error: "INVALID_CONTEXT", message: "whole-body selection contains a non-editable content control." };
|
|
334987
|
+
}
|
|
334988
|
+
}
|
|
334989
|
+
return wholeStory;
|
|
334990
|
+
}
|
|
334390
334991
|
function isBodyStory(storyLocator) {
|
|
334391
334992
|
return storyLocator == null || storyLocator.kind === "story" && storyLocator.storyType === "body";
|
|
334392
334993
|
}
|
|
@@ -334598,7 +335199,7 @@ function rewriteReviewId(on, resolution, origin) {
|
|
|
334598
335199
|
const noteId = story && "noteId" in story ? story.noteId : undefined;
|
|
334599
335200
|
return buildTextRewriteReviewGroupId(on.storyId, origin, noteId);
|
|
334600
335201
|
}
|
|
334601
|
-
var TD93,
|
|
335202
|
+
var TD93, TE50, PERMISSION_DENIED_DOC_PROTECTION = "document protection permits edits only within an everyone permission range.", FORMAT_STRADDLE_MARKER_KINDS;
|
|
334602
335203
|
var init_adapter9 = __esm(() => {
|
|
334603
335204
|
init_review_read_model();
|
|
334604
335205
|
init_sd_document_session_internal();
|
|
@@ -334609,6 +335210,7 @@ var init_adapter9 = __esm(() => {
|
|
|
334609
335210
|
init_stories();
|
|
334610
335211
|
init_text_range_shifts();
|
|
334611
335212
|
init_materialize_slot();
|
|
335213
|
+
init_painted_offsets();
|
|
334612
335214
|
init_selection_target();
|
|
334613
335215
|
init_range_collapse();
|
|
334614
335216
|
init_story_identity();
|
|
@@ -334616,6 +335218,8 @@ var init_adapter9 = __esm(() => {
|
|
|
334616
335218
|
init_raw_block_ref();
|
|
334617
335219
|
init_search();
|
|
334618
335220
|
init_document_reader();
|
|
335221
|
+
init_clear_content_adapter();
|
|
335222
|
+
init_deletion_locks();
|
|
334619
335223
|
init_note_story();
|
|
334620
335224
|
init_text_mutation_diagnostics();
|
|
334621
335225
|
init_adapter6();
|
|
@@ -334631,7 +335235,7 @@ var init_adapter9 = __esm(() => {
|
|
|
334631
335235
|
init_cross_cell_delete();
|
|
334632
335236
|
init_effective_inline_uniformity();
|
|
334633
335237
|
TD93 = new TextDecoder;
|
|
334634
|
-
|
|
335238
|
+
TE50 = new TextEncoder;
|
|
334635
335239
|
FORMAT_STRADDLE_MARKER_KINDS = new Set([
|
|
334636
335240
|
"bookmarkStart",
|
|
334637
335241
|
"bookmarkEnd",
|
|
@@ -335425,7 +336029,7 @@ function richWriteAnalysisSha256(input) {
|
|
|
335425
336029
|
return digest({ ...input, atomic: true });
|
|
335426
336030
|
}
|
|
335427
336031
|
function digest(value2) {
|
|
335428
|
-
return sha256HexSync(
|
|
336032
|
+
return sha256HexSync(TE51.encode(canonicalJson(value2)));
|
|
335429
336033
|
}
|
|
335430
336034
|
function canonicalJson(value2) {
|
|
335431
336035
|
if (value2 === null || typeof value2 === "boolean" || typeof value2 === "string")
|
|
@@ -335443,10 +336047,10 @@ function canonicalJson(value2) {
|
|
|
335443
336047
|
}
|
|
335444
336048
|
throw new Error(`Support-check digests cannot encode ${typeof value2}.`);
|
|
335445
336049
|
}
|
|
335446
|
-
var
|
|
336050
|
+
var TE51;
|
|
335447
336051
|
var init_digest = __esm(() => {
|
|
335448
336052
|
init_sd_document_session_internal();
|
|
335449
|
-
|
|
336053
|
+
TE51 = new TextEncoder;
|
|
335450
336054
|
});
|
|
335451
336055
|
|
|
335452
336056
|
// ../../../v2/document-api-v2-adapter/dist/write/rich-fragment-apply.js
|
|
@@ -336244,7 +336848,7 @@ function commitKernelXmlRewrites(input) {
|
|
|
336244
336848
|
}
|
|
336245
336849
|
};
|
|
336246
336850
|
}
|
|
336247
|
-
const nextBytes =
|
|
336851
|
+
const nextBytes = TE52.encode(rewrite.nextXml);
|
|
336248
336852
|
return bytesEqual16(currentBytes, nextBytes) ? null : {
|
|
336249
336853
|
rewrite,
|
|
336250
336854
|
currentBytes,
|
|
@@ -336319,11 +336923,11 @@ function bytesEqual16(left, right) {
|
|
|
336319
336923
|
}
|
|
336320
336924
|
return true;
|
|
336321
336925
|
}
|
|
336322
|
-
var
|
|
336926
|
+
var TE52, TD95;
|
|
336323
336927
|
var init_xml_rewrite = __esm(() => {
|
|
336324
336928
|
init_sd_document_session_internal();
|
|
336325
336929
|
init_xml();
|
|
336326
|
-
|
|
336930
|
+
TE52 = new TextEncoder;
|
|
336327
336931
|
TD95 = new TextDecoder;
|
|
336328
336932
|
});
|
|
336329
336933
|
|
|
@@ -336357,8 +336961,8 @@ function firstRunProperties(contentXml) {
|
|
|
336357
336961
|
if (!properties)
|
|
336358
336962
|
return "";
|
|
336359
336963
|
const inheritedDeclarations = Object.entries(properties.namespaceBindings).filter(([prefix, uri]) => prefix !== "xml" && namespaces[prefix] !== uri && !properties.tag.attributes.some((attribute) => attribute.name === (prefix ? `xmlns:${prefix}` : "xmlns"))).map(([prefix, uri]) => ` xmlns${prefix ? `:${prefix}` : ""}="${xmlEscapeAttr(uri)}"`).join("");
|
|
336360
|
-
const
|
|
336361
|
-
return
|
|
336964
|
+
const open2 = contentXml.slice(properties.start, properties.openEnd).replace(/(\/?>)$/, (_match, close) => inheritedDeclarations + close);
|
|
336965
|
+
return open2 + contentXml.slice(properties.openEnd, properties.end);
|
|
336362
336966
|
}
|
|
336363
336967
|
function normalizeOoxml(content3, allocate) {
|
|
336364
336968
|
const prefixes = new Map([
|
|
@@ -336613,12 +337217,12 @@ function cloneContentControlXml(input) {
|
|
|
336613
337217
|
}
|
|
336614
337218
|
}
|
|
336615
337219
|
const replaceAttribute = (range, name, value2) => {
|
|
336616
|
-
const
|
|
337220
|
+
const open2 = input.xml.slice(range.start, range.openEnd);
|
|
336617
337221
|
const pattern = new RegExp(`(\\s${escapeRegExp14(name)}\\s*=\\s*)(["'])([\\s\\S]*?)\\2`);
|
|
336618
337222
|
edits.push({
|
|
336619
337223
|
start: range.start,
|
|
336620
337224
|
end: range.openEnd,
|
|
336621
|
-
xml:
|
|
337225
|
+
xml: open2.replace(pattern, (_match, prefix, quote) => prefix + quote + xmlEscapeAttr(value2) + quote)
|
|
336622
337226
|
});
|
|
336623
337227
|
};
|
|
336624
337228
|
let rootId;
|
|
@@ -336675,8 +337279,8 @@ function cloneContentControlXml(input) {
|
|
|
336675
337279
|
prefix += "_";
|
|
336676
337280
|
declaration = ` xmlns:${prefix}="${W145}"`;
|
|
336677
337281
|
}
|
|
336678
|
-
const
|
|
336679
|
-
edits.push({ start: range.start, end: range.openEnd, xml:
|
|
337282
|
+
const open2 = input.xml.slice(range.start, range.openEnd).replace(/(\/?>)$/, `${declaration} ${prefix}:paraId="${id}"$1`);
|
|
337283
|
+
edits.push({ start: range.start, end: range.openEnd, xml: open2 });
|
|
336680
337284
|
}
|
|
336681
337285
|
}
|
|
336682
337286
|
}
|
|
@@ -339531,7 +340135,7 @@ function buildResolvedStructuredBlocksXml(context, blocks, allocParaId) {
|
|
|
339531
340135
|
failure: { code: mapRejectionReason(compiled.reason), message: compiled.reason }
|
|
339532
340136
|
};
|
|
339533
340137
|
}
|
|
339534
|
-
const
|
|
340138
|
+
const resolve2 = (items) => items.map((block) => {
|
|
339535
340139
|
if (block.kind === "paragraph") {
|
|
339536
340140
|
if (!block.semanticStyleRole)
|
|
339537
340141
|
return block;
|
|
@@ -339541,12 +340145,12 @@ function buildResolvedStructuredBlocksXml(context, blocks, allocParaId) {
|
|
|
339541
340145
|
}
|
|
339542
340146
|
return {
|
|
339543
340147
|
...block,
|
|
339544
|
-
rows: block.rows.map((row) => row.map((cell) => ({ ...cell, blocks:
|
|
340148
|
+
rows: block.rows.map((row) => row.map((cell) => ({ ...cell, blocks: resolve2(cell.blocks) })))
|
|
339545
340149
|
};
|
|
339546
340150
|
});
|
|
339547
340151
|
return {
|
|
339548
340152
|
ok: true,
|
|
339549
|
-
contentXml: buildStructuredBlocksXml(
|
|
340153
|
+
contentXml: buildStructuredBlocksXml(resolve2(blocks), allocParaId),
|
|
339550
340154
|
perPart: compiled.value.perPart,
|
|
339551
340155
|
semanticStyleDependencies: [...roles].map((role) => ({
|
|
339552
340156
|
role,
|
|
@@ -341089,11 +341693,11 @@ function prepareTrackedCaptionPrecedingBoundary(input) {
|
|
|
341089
341693
|
const properties = ranges[1]?.tag.namespaceUri === W17 && ranges[1]?.tag.localName === "pPr" ? ranges[1] : undefined;
|
|
341090
341694
|
if (properties && ranges.some((range) => range.start > properties.start && range.end < properties.end && range.tag.namespaceUri === W17 && ["ins", "del", "moveFrom", "moveTo", "pPrChange", "rPrChange", "sectPr"].includes(range.tag.localName)))
|
|
341091
341695
|
return null;
|
|
341092
|
-
const
|
|
341696
|
+
const open2 = input.beforeXml.slice(0, paragraph4.openEnd).replace(/\/>$/, ">");
|
|
341093
341697
|
const close = `</${paragraph4.tag.name}>`;
|
|
341094
341698
|
const marked = prepareTrackedBlockXmlReplacement({
|
|
341095
341699
|
...input,
|
|
341096
|
-
beforeXml:
|
|
341700
|
+
beforeXml: open2 + (properties ? input.beforeXml.slice(properties.start, properties.end) : "") + close,
|
|
341097
341701
|
afterXml: ""
|
|
341098
341702
|
});
|
|
341099
341703
|
if (!marked)
|
|
@@ -341148,20 +341752,20 @@ function prepareTrackedCaptionParagraph(input) {
|
|
|
341148
341752
|
...input.stamp.revisionIds ? { revisionIds: input.stamp.revisionIds.slice(wordIds.length) } : {}
|
|
341149
341753
|
});
|
|
341150
341754
|
const namespaceBindings = new Map(Object.entries(before.paragraph.namespaceBindings));
|
|
341151
|
-
const
|
|
341755
|
+
const open2 = input.beforeXml.slice(0, before.paragraph.openEnd).replace(/\/>$/, ">");
|
|
341152
341756
|
const close = `</${before.paragraph.tag.name}>`;
|
|
341153
341757
|
let properties = after?.properties ?? before.properties;
|
|
341154
341758
|
if (!after) {
|
|
341155
341759
|
const mark = prepareTrackedBlockXmlReplacement({
|
|
341156
341760
|
...input,
|
|
341157
|
-
beforeXml:
|
|
341761
|
+
beforeXml: open2 + before.properties + close,
|
|
341158
341762
|
afterXml: "",
|
|
341159
341763
|
stamp: nextStamp()
|
|
341160
341764
|
});
|
|
341161
341765
|
if (!mark)
|
|
341162
341766
|
return null;
|
|
341163
341767
|
wordIds.push(...mark.wordIds);
|
|
341164
|
-
properties = mark.xml.slice(
|
|
341768
|
+
properties = mark.xml.slice(open2.length, -close.length);
|
|
341165
341769
|
}
|
|
341166
341770
|
let content3 = "";
|
|
341167
341771
|
let cursor = before.contentStart;
|
|
@@ -341221,7 +341825,7 @@ function prepareTrackedCaptionParagraph(input) {
|
|
|
341221
341825
|
properties = prepared.xml;
|
|
341222
341826
|
wordIds.push(...prepared.wordIds);
|
|
341223
341827
|
}
|
|
341224
|
-
return { xml:
|
|
341828
|
+
return { xml: open2 + properties + content3 + close, wordIds };
|
|
341225
341829
|
}
|
|
341226
341830
|
var W17 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
341227
341831
|
var init_tracked_paragraph = __esm(() => {
|
|
@@ -341738,8 +342342,8 @@ function nextCaptionFieldResult(entry, nextNumber) {
|
|
|
341738
342342
|
function replaceTextNodeValues(xml, text4) {
|
|
341739
342343
|
let replaced = false;
|
|
341740
342344
|
const nextXml = xml.replace(/<w:t\b([^>]*)>([\s\S]*?)<\/w:t>/g, (match, _attrs, _value, offset) => {
|
|
341741
|
-
const
|
|
341742
|
-
const start = offset +
|
|
342345
|
+
const open2 = match.indexOf(">") + 1;
|
|
342346
|
+
const start = offset + open2;
|
|
341743
342347
|
const end = start + _value.length;
|
|
341744
342348
|
const replacement = replaced ? "" : escapeText2(text4);
|
|
341745
342349
|
replaced = true;
|
|
@@ -342922,7 +343526,7 @@ function insertTrackedToc(context, input) {
|
|
|
342922
343526
|
tocBookmarkNames: names,
|
|
342923
343527
|
reservedParaIds: occupied
|
|
342924
343528
|
});
|
|
342925
|
-
tocXml = tocXml.replace(/<w:p\b[^>]*>/g, (
|
|
343529
|
+
tocXml = tocXml.replace(/<w:p\b[^>]*>/g, (open2) => /\sxmlns:w14\s*=/.test(open2) ? open2 : open2.replace("<w:p", '<w:p xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"'));
|
|
342926
343530
|
const tocRanges = collectXmlElementRanges(tocXml, {
|
|
342927
343531
|
fragment: true,
|
|
342928
343532
|
additionalNamespaces: Object.fromEntries(bindings)
|
|
@@ -342952,8 +343556,8 @@ function insertTrackedToc(context, input) {
|
|
|
342952
343556
|
});
|
|
342953
343557
|
for (let index2 = tocParagraphs.length - 1;index2 >= 0; index2--) {
|
|
342954
343558
|
const paragraph4 = tocParagraphs[index2];
|
|
342955
|
-
const
|
|
342956
|
-
const replaced = /\bw14:paraId="[^"]*"/.test(
|
|
343559
|
+
const open2 = tocXml.slice(paragraph4.start, paragraph4.openEnd);
|
|
343560
|
+
const replaced = /\bw14:paraId="[^"]*"/.test(open2) ? open2.replace(/\bw14:paraId="[^"]*"/, `w14:paraId="${xmlEscapeAttr(paragraphIds[index2])}"`) : open2.replace(/^<w:p\b/, `<w:p w14:paraId="${xmlEscapeAttr(paragraphIds[index2])}"`);
|
|
342957
343561
|
tocXml = tocXml.slice(0, paragraph4.start) + replaced + tocXml.slice(paragraph4.openEnd);
|
|
342958
343562
|
}
|
|
342959
343563
|
const author = readTrackedAuthor(context);
|
|
@@ -343592,13 +344196,13 @@ function prepareTrackedSectionBreak(input) {
|
|
|
343592
344196
|
return unavailable4("Tracked section creation cannot yet materialize the final section or relocate its references.");
|
|
343593
344197
|
}
|
|
343594
344198
|
const changesFinalProperties = before.sectionXml !== after.sectionXml;
|
|
343595
|
-
if (collectXmlElementRanges(before.sectionXml, { fragment: true, additionalNamespaces: before.body.namespaceBindings }).ranges.some((range) => range.tag.namespaceUri ===
|
|
344199
|
+
if (collectXmlElementRanges(before.sectionXml, { fragment: true, additionalNamespaces: before.body.namespaceBindings }).ranges.some((range) => range.tag.namespaceUri === WORD_NS5 && range.tag.localName === "sectPrChange")) {
|
|
343596
344200
|
return unavailable4("Tracked section creation cannot copy an existing section property revision.");
|
|
343597
344201
|
}
|
|
343598
344202
|
const attached = input.representation === "attachToPreviousParagraph";
|
|
343599
344203
|
const oldParagraph = attached ? before.blocks.at(-1) : undefined;
|
|
343600
344204
|
const paragraph4 = after.blocks.at(-1);
|
|
343601
|
-
if (!paragraph4 || paragraph4.tag.namespaceUri !==
|
|
344205
|
+
if (!paragraph4 || paragraph4.tag.namespaceUri !== WORD_NS5 || paragraph4.tag.localName !== "p" || attached && (!oldParagraph || oldParagraph.tag.namespaceUri !== WORD_NS5 || oldParagraph.tag.localName !== "p") || after.blocks.length !== before.blocks.length + (attached ? 0 : 1)) {
|
|
343602
344206
|
return unavailable4("Tracked section creation requires one body paragraph carrier.");
|
|
343603
344207
|
}
|
|
343604
344208
|
const beforeStart = oldParagraph?.start ?? before.sectionStart;
|
|
@@ -343608,25 +344212,25 @@ function prepareTrackedSectionBreak(input) {
|
|
|
343608
344212
|
const beforeParagraphXml = oldParagraph ? input.beforeXml.slice(oldParagraph.start, oldParagraph.end) : "";
|
|
343609
344213
|
const paragraphXml = input.afterXml.slice(paragraph4.start, paragraph4.end);
|
|
343610
344214
|
const prepare = (paragraphId3, revisionIds) => {
|
|
343611
|
-
let
|
|
344215
|
+
let open2 = input.afterXml.slice(paragraph4.start, paragraph4.openEnd);
|
|
343612
344216
|
for (const attribute of paragraph4.tag.attributes) {
|
|
343613
|
-
if (attribute.namespaceUri !==
|
|
344217
|
+
if (attribute.namespaceUri !== WORD_2010_NS2 || attribute.localName !== "paraId")
|
|
343614
344218
|
continue;
|
|
343615
344219
|
const name = attribute.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
343616
|
-
|
|
344220
|
+
open2 = open2.replace(new RegExp(`\\s+${name}\\s*=\\s*(["'])[\\s\\S]*?\\1`), "");
|
|
343617
344221
|
}
|
|
343618
|
-
let prefix = Object.entries(paragraph4.namespaceBindings).find(([name, uri]) => name && uri ===
|
|
344222
|
+
let prefix = Object.entries(paragraph4.namespaceBindings).find(([name, uri]) => name && uri === WORD_2010_NS2)?.[0];
|
|
343619
344223
|
let namespace = "";
|
|
343620
344224
|
if (!prefix) {
|
|
343621
344225
|
prefix = "w14";
|
|
343622
344226
|
while (paragraph4.namespaceBindings[prefix])
|
|
343623
344227
|
prefix += "sd";
|
|
343624
|
-
namespace = ` xmlns:${prefix}="${
|
|
344228
|
+
namespace = ` xmlns:${prefix}="${WORD_2010_NS2}"`;
|
|
343625
344229
|
}
|
|
343626
|
-
|
|
344230
|
+
open2 = open2.replace(/\/?>(?=$)/, (ending) => `${namespace} ${prefix}:paraId="${paragraphId3}"${ending}`);
|
|
343627
344231
|
return prepareTrackedBlockXmlReplacement({
|
|
343628
344232
|
beforeXml: beforeParagraphXml,
|
|
343629
|
-
afterXml:
|
|
344233
|
+
afterXml: open2 + paragraphXml.slice(paragraph4.openEnd - paragraph4.start),
|
|
343630
344234
|
namespaceBindings: new Map(Object.entries(after.body.namespaceBindings)),
|
|
343631
344235
|
stamp: { revisionId: revisionIds?.[0] ?? 0, revisionIds, author, date: date6 }
|
|
343632
344236
|
});
|
|
@@ -343673,7 +344277,7 @@ function readBody2(xml) {
|
|
|
343673
344277
|
const parsed = collectXmlElementRanges(xml);
|
|
343674
344278
|
if (parsed.errors.length)
|
|
343675
344279
|
return null;
|
|
343676
|
-
const body = parsed.ranges.find((range) => range.tag.namespaceUri ===
|
|
344280
|
+
const body = parsed.ranges.find((range) => range.tag.namespaceUri === WORD_NS5 && range.tag.localName === "body");
|
|
343677
344281
|
if (!body || body.tag.isSelfClosing)
|
|
343678
344282
|
return null;
|
|
343679
344283
|
const blocks = [];
|
|
@@ -343689,10 +344293,10 @@ function readBody2(xml) {
|
|
|
343689
344293
|
if (xml.slice(cursor, body.closeStart).trim())
|
|
343690
344294
|
return null;
|
|
343691
344295
|
const last = blocks.at(-1);
|
|
343692
|
-
const section = last?.tag.namespaceUri ===
|
|
344296
|
+
const section = last?.tag.namespaceUri === WORD_NS5 && last.tag.localName === "sectPr" ? blocks.pop() : undefined;
|
|
343693
344297
|
return { body, blocks, sectionStart: section?.start ?? body.closeStart, sectionEnd: section?.end ?? body.closeStart, sectionXml: section ? xml.slice(section.start, section.end) : "" };
|
|
343694
344298
|
}
|
|
343695
|
-
var
|
|
344299
|
+
var WORD_NS5 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WORD_2010_NS2 = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
343696
344300
|
var init_tracked_section_break = __esm(() => {
|
|
343697
344301
|
init_sd_document_session_internal();
|
|
343698
344302
|
init_paragraph_ids();
|
|
@@ -345887,7 +346491,7 @@ function storyErrorMessage3(error48) {
|
|
|
345887
346491
|
}
|
|
345888
346492
|
}
|
|
345889
346493
|
function splicePartBytes(bytes, start, end, replacementXml) {
|
|
345890
|
-
const replacement =
|
|
346494
|
+
const replacement = TE53.encode(replacementXml);
|
|
345891
346495
|
const next = new Uint8Array(start + replacement.length + (bytes.length - end));
|
|
345892
346496
|
next.set(bytes.subarray(0, start), 0);
|
|
345893
346497
|
next.set(replacement, start);
|
|
@@ -345990,7 +346594,7 @@ function txIdPrefixToOperation(prefix) {
|
|
|
345990
346594
|
return prefix;
|
|
345991
346595
|
}
|
|
345992
346596
|
}
|
|
345993
|
-
var TD97,
|
|
346597
|
+
var TD97, TE53;
|
|
345994
346598
|
var init_adapter15 = __esm(() => {
|
|
345995
346599
|
init_sd_document_session_internal();
|
|
345996
346600
|
init_src6();
|
|
@@ -346004,7 +346608,7 @@ var init_adapter15 = __esm(() => {
|
|
|
346004
346608
|
init_part();
|
|
346005
346609
|
init_paragraph();
|
|
346006
346610
|
TD97 = new TextDecoder;
|
|
346007
|
-
|
|
346611
|
+
TE53 = new TextEncoder;
|
|
346008
346612
|
});
|
|
346009
346613
|
|
|
346010
346614
|
// ../../../v2/document-api-v2-adapter/dist/header-footers/page-numbers.js
|
|
@@ -346411,15 +347015,15 @@ function removePageNumberBuildingBlocks(context, refId, options) {
|
|
|
346411
347015
|
}
|
|
346412
347016
|
function pageNumberGalleryBlocks(partXml) {
|
|
346413
347017
|
const blocks = [];
|
|
346414
|
-
const
|
|
347018
|
+
const open2 = [];
|
|
346415
347019
|
const tag = /<(\/?)w:sdt(?=[\s>/])[^>]*>/g;
|
|
346416
347020
|
for (let match = tag.exec(partXml);match; match = tag.exec(partXml)) {
|
|
346417
347021
|
if (!match[1]) {
|
|
346418
347022
|
if (!match[0].endsWith("/>"))
|
|
346419
|
-
|
|
347023
|
+
open2.push(match.index);
|
|
346420
347024
|
continue;
|
|
346421
347025
|
}
|
|
346422
|
-
const start =
|
|
347026
|
+
const start = open2.pop();
|
|
346423
347027
|
if (start === undefined)
|
|
346424
347028
|
continue;
|
|
346425
347029
|
const end = match.index + match[0].length;
|
|
@@ -348114,7 +348718,7 @@ function isHumanActorProof(value2) {
|
|
|
348114
348718
|
}
|
|
348115
348719
|
function createHumanActorScope() {
|
|
348116
348720
|
let depth = 0;
|
|
348117
|
-
const
|
|
348721
|
+
const open2 = (proof) => {
|
|
348118
348722
|
if (!isHumanActorProof(proof))
|
|
348119
348723
|
return () => {};
|
|
348120
348724
|
depth += 1;
|
|
@@ -348129,14 +348733,14 @@ function createHumanActorScope() {
|
|
|
348129
348733
|
return {
|
|
348130
348734
|
current: () => depth > 0 ? "human" : undefined,
|
|
348131
348735
|
run(proof, fn) {
|
|
348132
|
-
const release =
|
|
348736
|
+
const release = open2(proof);
|
|
348133
348737
|
try {
|
|
348134
348738
|
return fn();
|
|
348135
348739
|
} finally {
|
|
348136
348740
|
release();
|
|
348137
348741
|
}
|
|
348138
348742
|
},
|
|
348139
|
-
open
|
|
348743
|
+
open: open2
|
|
348140
348744
|
};
|
|
348141
348745
|
}
|
|
348142
348746
|
var HUMAN_ACTOR_PROOF;
|
|
@@ -350942,7 +351546,7 @@ function readProjectionImages(paragraph4, namespaces, targets) {
|
|
|
350942
351546
|
fragment: true,
|
|
350943
351547
|
additionalNamespaces: namespaces,
|
|
350944
351548
|
onOpenTag: ({ tag, start }) => {
|
|
350945
|
-
if (tag.namespaceUri ===
|
|
351549
|
+
if (tag.namespaceUri === WORD_NS6 && tag.localName === "drawing") {
|
|
350946
351550
|
drawing = { start: paragraph4.byteStart + offsets.byteOffsetAt(start), blips: 0, alt: "" };
|
|
350947
351551
|
}
|
|
350948
351552
|
if (!drawing)
|
|
@@ -350957,7 +351561,7 @@ function readProjectionImages(paragraph4, namespaces, targets) {
|
|
|
350957
351561
|
}
|
|
350958
351562
|
},
|
|
350959
351563
|
onCloseTag: ({ tag }) => {
|
|
350960
|
-
if (tag.namespaceUri !==
|
|
351564
|
+
if (tag.namespaceUri !== WORD_NS6 || tag.localName !== "drawing" || !drawing)
|
|
350961
351565
|
return;
|
|
350962
351566
|
if (drawing.blips === 1 && drawing.src && isPublicImageUrl(drawing.src)) {
|
|
350963
351567
|
images.set(drawing.start, { src: drawing.src, alt: drawing.alt });
|
|
@@ -350977,7 +351581,7 @@ function isPublicImageUrl(value2) {
|
|
|
350977
351581
|
return false;
|
|
350978
351582
|
}
|
|
350979
351583
|
}
|
|
350980
|
-
var DRAWING_NS = "http://schemas.openxmlformats.org/drawingml/2006/main",
|
|
351584
|
+
var DRAWING_NS = "http://schemas.openxmlformats.org/drawingml/2006/main", WORD_NS6 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WP_NS = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
350981
351585
|
var init_images2 = __esm(() => {
|
|
350982
351586
|
init_sd_document_session_internal();
|
|
350983
351587
|
});
|
|
@@ -352362,7 +352966,7 @@ async function yieldProjectionTask() {
|
|
|
352362
352966
|
await scheduler.yield();
|
|
352363
352967
|
return;
|
|
352364
352968
|
}
|
|
352365
|
-
await new Promise((
|
|
352969
|
+
await new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
352366
352970
|
}
|
|
352367
352971
|
function projectionDependencyPartUris(context, storyPartUri2) {
|
|
352368
352972
|
const normalized = storyPartUri2.startsWith("/") ? storyPartUri2 : `/${storyPartUri2}`;
|
|
@@ -355319,17 +355923,17 @@ function isLowSurrogate2(value2) {
|
|
|
355319
355923
|
}
|
|
355320
355924
|
function openMarks(emitter, inline, suppressCodeMark) {
|
|
355321
355925
|
const tags = [];
|
|
355322
|
-
const
|
|
355926
|
+
const open2 = (enabled, tag) => {
|
|
355323
355927
|
if (!enabled)
|
|
355324
355928
|
return;
|
|
355325
355929
|
emitter.write(`<${tag}>`);
|
|
355326
355930
|
tags.push(tag);
|
|
355327
355931
|
};
|
|
355328
|
-
|
|
355329
|
-
|
|
355330
|
-
|
|
355331
|
-
|
|
355332
|
-
|
|
355932
|
+
open2(inline.marks.bold, "strong");
|
|
355933
|
+
open2(inline.marks.italic, "em");
|
|
355934
|
+
open2(inline.marks.underline, "u");
|
|
355935
|
+
open2(inline.marks.strike, "s");
|
|
355936
|
+
open2(!suppressCodeMark && inline.marks.code, "code");
|
|
355333
355937
|
return tags;
|
|
355334
355938
|
}
|
|
355335
355939
|
function closeMarks(emitter, tags) {
|
|
@@ -355429,7 +356033,7 @@ function createSerializationSliceGate() {
|
|
|
355429
356033
|
if (typeof scheduler?.yield === "function") {
|
|
355430
356034
|
await scheduler.yield();
|
|
355431
356035
|
} else {
|
|
355432
|
-
await new Promise((
|
|
356036
|
+
await new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
355433
356037
|
}
|
|
355434
356038
|
sliceStart = performance.now();
|
|
355435
356039
|
};
|
|
@@ -355966,7 +356570,7 @@ function* resolveCodeMarkSteps(inline, suppressCodeMark, forceHtml) {
|
|
|
355966
356570
|
}
|
|
355967
356571
|
function openMarkdownMarks(emitter, inline, suppressCodeMark, codeMark, htmlFallbacks) {
|
|
355968
356572
|
const marks = [];
|
|
355969
|
-
const
|
|
356573
|
+
const open2 = (enabled, value2, close = value2, htmlTag) => {
|
|
355970
356574
|
if (!enabled)
|
|
355971
356575
|
return;
|
|
355972
356576
|
if (htmlTag) {
|
|
@@ -355977,10 +356581,10 @@ function openMarkdownMarks(emitter, inline, suppressCodeMark, codeMark, htmlFall
|
|
|
355977
356581
|
marks.push({ close });
|
|
355978
356582
|
}
|
|
355979
356583
|
};
|
|
355980
|
-
|
|
355981
|
-
|
|
355982
|
-
|
|
355983
|
-
|
|
356584
|
+
open2(inline.marks.bold, "**", "**", htmlFallbacks.bold ? "strong" : undefined);
|
|
356585
|
+
open2(inline.marks.italic, "*", "*", htmlFallbacks.italic ? "em" : undefined);
|
|
356586
|
+
open2(inline.marks.underline, "<u>", "</u>");
|
|
356587
|
+
open2(inline.marks.strike, "~~", "~~", htmlFallbacks.strike ? "s" : undefined);
|
|
355984
356588
|
if (!suppressCodeMark && codeMark) {
|
|
355985
356589
|
if (codeMark.kind === "html") {
|
|
355986
356590
|
emitter.write("<code>");
|
|
@@ -356185,7 +356789,7 @@ function createSerializationSliceGate2() {
|
|
|
356185
356789
|
if (typeof scheduler?.yield === "function") {
|
|
356186
356790
|
await scheduler.yield();
|
|
356187
356791
|
} else {
|
|
356188
|
-
await new Promise((
|
|
356792
|
+
await new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
356189
356793
|
}
|
|
356190
356794
|
sliceStart = performance.now();
|
|
356191
356795
|
};
|
|
@@ -357328,11 +357932,11 @@ function findStructuredImageDrawings(partXml, identity2) {
|
|
|
357328
357932
|
const relationshipId = /\br:embed="([^"]+)"/.exec(drawing.xml)?.[1] ?? null;
|
|
357329
357933
|
if (!relationshipId || normalizeImageIdComponent(relationshipId) !== identity2.relationshipScope)
|
|
357330
357934
|
continue;
|
|
357331
|
-
const byteStart =
|
|
357935
|
+
const byteStart = TE54.encode(partXml.slice(0, drawing.start)).byteLength;
|
|
357332
357936
|
out.push({
|
|
357333
357937
|
start: drawing.start,
|
|
357334
357938
|
byteStart,
|
|
357335
|
-
byteEnd: byteStart +
|
|
357939
|
+
byteEnd: byteStart + TE54.encode(drawing.xml).byteLength,
|
|
357336
357940
|
relationshipId,
|
|
357337
357941
|
xml: drawing.xml
|
|
357338
357942
|
});
|
|
@@ -357810,14 +358414,14 @@ function decodeXmlAttr2(value2) {
|
|
|
357810
358414
|
function emuToPx(value2) {
|
|
357811
358415
|
return value2 / EMU_PER_PX4;
|
|
357812
358416
|
}
|
|
357813
|
-
var TD98,
|
|
358417
|
+
var TD98, TE54, EMU_PER_PX4 = 9525, CROP_SCALE = 1000, DECORATIVE_DESCRIPTION_CLEARED, BODY_IMAGE_ENTRIES_CACHE, TRACKED_WRAPPER_KINDS2;
|
|
357814
358418
|
var init_public_model = __esm(() => {
|
|
357815
358419
|
init_sd_document_session_internal();
|
|
357816
358420
|
init_caption_style();
|
|
357817
358421
|
init_xml_rewrite();
|
|
357818
358422
|
init_document_reader();
|
|
357819
358423
|
TD98 = new TextDecoder;
|
|
357820
|
-
|
|
358424
|
+
TE54 = new TextEncoder;
|
|
357821
358425
|
DECORATIVE_DESCRIPTION_CLEARED = new WeakMap;
|
|
357822
358426
|
BODY_IMAGE_ENTRIES_CACHE = new WeakMap;
|
|
357823
358427
|
TRACKED_WRAPPER_KINDS2 = new Set(["ins", "del", "moveFrom", "moveTo"]);
|
|
@@ -361417,12 +362021,12 @@ function bisectUnclosedRevisionWrappers(head, tail, allocateWId) {
|
|
|
361417
362021
|
return null;
|
|
361418
362022
|
const closes = [];
|
|
361419
362023
|
const reopens = [];
|
|
361420
|
-
for (const
|
|
361421
|
-
const kind = /^<w:(ins|del)\b/.exec(
|
|
362024
|
+
for (const open2 of opens) {
|
|
362025
|
+
const kind = /^<w:(ins|del)\b/.exec(open2)?.[1];
|
|
361422
362026
|
if (!kind)
|
|
361423
362027
|
return null;
|
|
361424
362028
|
closes.push(`</w:${kind}>`);
|
|
361425
|
-
reopens.push(refreshRevisionId2(
|
|
362029
|
+
reopens.push(refreshRevisionId2(open2, allocateWId));
|
|
361426
362030
|
}
|
|
361427
362031
|
return {
|
|
361428
362032
|
head: head + closes.reverse().join(""),
|
|
@@ -361593,10 +362197,10 @@ function findEnclosingElementRange(xml, localName2, start, end) {
|
|
|
361593
362197
|
stack.push({ start: match.index, openEnd: match.index + tag.length - 1 });
|
|
361594
362198
|
}
|
|
361595
362199
|
}
|
|
361596
|
-
const
|
|
361597
|
-
if (!
|
|
362200
|
+
const open2 = stack.at(-1);
|
|
362201
|
+
if (!open2)
|
|
361598
362202
|
return null;
|
|
361599
|
-
pattern.lastIndex =
|
|
362203
|
+
pattern.lastIndex = open2.openEnd + 1;
|
|
361600
362204
|
let depth = 1;
|
|
361601
362205
|
while (match = pattern.exec(xml)) {
|
|
361602
362206
|
const tag = match[0];
|
|
@@ -361607,8 +362211,8 @@ function findEnclosingElementRange(xml, localName2, start, end) {
|
|
|
361607
362211
|
if (depth === 0) {
|
|
361608
362212
|
const elementEnd = match.index + tag.length;
|
|
361609
362213
|
return elementEnd >= end ? {
|
|
361610
|
-
start:
|
|
361611
|
-
openEnd:
|
|
362214
|
+
start: open2.start,
|
|
362215
|
+
openEnd: open2.openEnd,
|
|
361612
362216
|
closeStart: match.index,
|
|
361613
362217
|
end: elementEnd
|
|
361614
362218
|
} : null;
|
|
@@ -361786,15 +362390,15 @@ function rewriteImageMoveDestinationParagraphXml(paragraphXml, context, partXml,
|
|
|
361786
362390
|
}
|
|
361787
362391
|
function rewriteParagraphParaIds(xml, context) {
|
|
361788
362392
|
const allocate = createParaIdAllocator(context);
|
|
361789
|
-
let
|
|
362393
|
+
let firstParagraphId2 = null;
|
|
361790
362394
|
return {
|
|
361791
362395
|
xml: xml.replace(/\bw14:paraId="([0-9A-Fa-f]{8})"/g, () => {
|
|
361792
362396
|
const nextId = allocate();
|
|
361793
|
-
if (!
|
|
361794
|
-
|
|
362397
|
+
if (!firstParagraphId2)
|
|
362398
|
+
firstParagraphId2 = nextId;
|
|
361795
362399
|
return `w14:paraId="${nextId}"`;
|
|
361796
362400
|
}),
|
|
361797
|
-
firstParagraphId
|
|
362401
|
+
firstParagraphId: firstParagraphId2
|
|
361798
362402
|
};
|
|
361799
362403
|
}
|
|
361800
362404
|
function rewriteWp14DrawingIds(xml, partXml) {
|
|
@@ -365437,8 +366041,8 @@ var init_adapter23 = __esm(() => {
|
|
|
365437
366041
|
|
|
365438
366042
|
// ../../../v2/document-api-v2-adapter/dist/diff/tracked-table-property-replay.js
|
|
365439
366043
|
function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
365440
|
-
const baseBytes =
|
|
365441
|
-
const targetBytes =
|
|
366044
|
+
const baseBytes = TE55.encode(base3.xml);
|
|
366045
|
+
const targetBytes = TE55.encode(target.xml);
|
|
365442
366046
|
const baseTables = buildTableCatalog({ bytes: baseBytes, storyId: STORY_ID });
|
|
365443
366047
|
const targetTables = buildTableCatalog({ bytes: targetBytes, storyId: STORY_ID });
|
|
365444
366048
|
const baseBody = collectXmlElementRanges(base3.xml).ranges.find((range) => range.tag.namespaceUri === W20 && range.tag.localName === "body");
|
|
@@ -365484,10 +366088,10 @@ function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
|
365484
366088
|
}
|
|
365485
366089
|
return steps.length ? { steps } : null;
|
|
365486
366090
|
}
|
|
365487
|
-
var
|
|
366091
|
+
var TE55, TD101, STORY_ID = "body:/word/document.xml", W20 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
365488
366092
|
var init_tracked_table_property_replay = __esm(() => {
|
|
365489
366093
|
init_sd_document_session_internal();
|
|
365490
|
-
|
|
366094
|
+
TE55 = new TextEncoder;
|
|
365491
366095
|
TD101 = new TextDecoder;
|
|
365492
366096
|
});
|
|
365493
366097
|
|
|
@@ -365586,15 +366190,15 @@ var init_fingerprint = __esm(() => {
|
|
|
365586
366190
|
// ../../../v2/document-api-v2-adapter/dist/compare/part-fingerprint.js
|
|
365587
366191
|
function comparePartContentFingerprint(partUri, bytes) {
|
|
365588
366192
|
const partHash = sha256HexSync(bytes);
|
|
365589
|
-
return `fp:${sha256HexSync(
|
|
366193
|
+
return `fp:${sha256HexSync(TE56.encode(`${partUri}:${partHash}`))}`;
|
|
365590
366194
|
}
|
|
365591
366195
|
function comparePartXmlFingerprint(partUri, xml) {
|
|
365592
|
-
return comparePartContentFingerprint(partUri,
|
|
366196
|
+
return comparePartContentFingerprint(partUri, TE56.encode(xml));
|
|
365593
366197
|
}
|
|
365594
|
-
var
|
|
366198
|
+
var TE56;
|
|
365595
366199
|
var init_part_fingerprint = __esm(() => {
|
|
365596
366200
|
init_sd_document_session_internal();
|
|
365597
|
-
|
|
366201
|
+
TE56 = new TextEncoder;
|
|
365598
366202
|
});
|
|
365599
366203
|
|
|
365600
366204
|
// ../../../v2/document-api-v2-adapter/dist/compare/inventory.js
|
|
@@ -365815,7 +366419,7 @@ function captureCompareSourceInventory(context) {
|
|
|
365815
366419
|
return buildCompareSourceInventory(buildCompareSourceObservation(context));
|
|
365816
366420
|
}
|
|
365817
366421
|
function textBytes(value2) {
|
|
365818
|
-
return
|
|
366422
|
+
return TE57.encode(value2);
|
|
365819
366423
|
}
|
|
365820
366424
|
function countOccurrences(haystack, needle) {
|
|
365821
366425
|
let count = 0;
|
|
@@ -365872,19 +366476,19 @@ function accumulateStoryCatalogs(context, story, acc) {
|
|
|
365872
366476
|
}
|
|
365873
366477
|
} catch {}
|
|
365874
366478
|
}
|
|
365875
|
-
var TD102, BODY_PART_URI = "/word/document.xml",
|
|
366479
|
+
var TD102, BODY_PART_URI = "/word/document.xml", TE57;
|
|
365876
366480
|
var init_inventory = __esm(() => {
|
|
365877
366481
|
init_src2();
|
|
365878
366482
|
init_sd_document_session_internal();
|
|
365879
366483
|
init_document_reader();
|
|
365880
366484
|
init_part_fingerprint();
|
|
365881
366485
|
TD102 = new TextDecoder("utf-8", { fatal: false });
|
|
365882
|
-
|
|
366486
|
+
TE57 = new TextEncoder;
|
|
365883
366487
|
});
|
|
365884
366488
|
|
|
365885
366489
|
// ../../../v2/document-api-v2-adapter/dist/compare/definitions.js
|
|
365886
366490
|
function digest2(value2) {
|
|
365887
|
-
return sha256HexSync(
|
|
366491
|
+
return sha256HexSync(TE58.encode(value2));
|
|
365888
366492
|
}
|
|
365889
366493
|
function tagAttr2(tag, local) {
|
|
365890
366494
|
const match = new RegExp(`\\b(?:[\\w.-]+:)?${local}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`).exec(tag);
|
|
@@ -366109,7 +366713,7 @@ function normalizeSettingsXml(xml) {
|
|
|
366109
366713
|
for (const match of normalized.matchAll(/<\/?([\w.-]+):[\w.-]+|\s(?!xmlns\b)([\w.-]+):[\w.-]+=/g)) {
|
|
366110
366714
|
usedPrefixes.add(match[1] ?? match[2]);
|
|
366111
366715
|
}
|
|
366112
|
-
normalized = normalized.replace(/(<w:settings\b)([^>]*)(>)/, (_match,
|
|
366716
|
+
normalized = normalized.replace(/(<w:settings\b)([^>]*)(>)/, (_match, open2, attrs, close) => {
|
|
366113
366717
|
const ns = [];
|
|
366114
366718
|
const rest = [];
|
|
366115
366719
|
for (const m of attrs.matchAll(XML_ATTR_RE)) {
|
|
@@ -366127,7 +366731,7 @@ function normalizeSettingsXml(xml) {
|
|
|
366127
366731
|
}
|
|
366128
366732
|
rest.push(attr3);
|
|
366129
366733
|
}
|
|
366130
|
-
return
|
|
366734
|
+
return open2 + [...ns.sort(), ...rest].join("") + close;
|
|
366131
366735
|
});
|
|
366132
366736
|
return normalized;
|
|
366133
366737
|
}
|
|
@@ -366188,14 +366792,14 @@ function projectCompareDefinitions(context) {
|
|
|
366188
366792
|
{ family: "theme", entries: projectTheme(context) }
|
|
366189
366793
|
];
|
|
366190
366794
|
}
|
|
366191
|
-
var TD103,
|
|
366795
|
+
var TD103, TE58, SETTINGS_PART_URI4 = "/word/settings.xml", WORDPROCESSINGML_NS3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", XML_ATTR_RE;
|
|
366192
366796
|
var init_definitions = __esm(() => {
|
|
366193
366797
|
init_src2();
|
|
366194
366798
|
init_sd_document_session_internal();
|
|
366195
366799
|
init_adapter13();
|
|
366196
366800
|
init_part();
|
|
366197
366801
|
TD103 = new TextDecoder("utf-8", { fatal: false });
|
|
366198
|
-
|
|
366802
|
+
TE58 = new TextEncoder;
|
|
366199
366803
|
XML_ATTR_RE = /\s+[\w.-]+(?::[\w.-]+)?=(?:"[^"]*"|'[^']*')/g;
|
|
366200
366804
|
});
|
|
366201
366805
|
|
|
@@ -366210,7 +366814,7 @@ function contentControlIdentity(properties) {
|
|
|
366210
366814
|
|
|
366211
366815
|
// ../../../v2/document-api-v2-adapter/dist/compare/annotations.js
|
|
366212
366816
|
function digest3(value2) {
|
|
366213
|
-
return sha256HexSync(
|
|
366817
|
+
return sha256HexSync(TE59.encode(value2));
|
|
366214
366818
|
}
|
|
366215
366819
|
function storyLocatorSignature(story) {
|
|
366216
366820
|
if (!story || story.storyType === "body")
|
|
@@ -366557,17 +367161,17 @@ function projectCompareAnnotations(context) {
|
|
|
366557
367161
|
{ family: "permissions", entries: projectPermissions(context) }
|
|
366558
367162
|
];
|
|
366559
367163
|
}
|
|
366560
|
-
var TD104,
|
|
367164
|
+
var TD104, TE59, BODY_PART_URI2 = "/word/document.xml", CUSTOM_XML_PROPS_RELS_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps";
|
|
366561
367165
|
var init_annotations2 = __esm(() => {
|
|
366562
367166
|
init_sd_document_session_internal();
|
|
366563
367167
|
init_read();
|
|
366564
367168
|
TD104 = new TextDecoder("utf-8", { fatal: false });
|
|
366565
|
-
|
|
367169
|
+
TE59 = new TextEncoder;
|
|
366566
367170
|
});
|
|
366567
367171
|
|
|
366568
367172
|
// ../../../v2/document-api-v2-adapter/dist/compare/objects.js
|
|
366569
367173
|
function digest4(value2) {
|
|
366570
|
-
return sha256HexSync(
|
|
367174
|
+
return sha256HexSync(TE60.encode(value2));
|
|
366571
367175
|
}
|
|
366572
367176
|
function isMediaKind(partKind) {
|
|
366573
367177
|
return classifyComparePartKind(partKind).family === "media";
|
|
@@ -366784,12 +367388,12 @@ function projectCompareObjects(context) {
|
|
|
366784
367388
|
{ family: "package-graph", entries: projectPackageGraph(context) }
|
|
366785
367389
|
];
|
|
366786
367390
|
}
|
|
366787
|
-
var TD105,
|
|
367391
|
+
var TD105, TE60, CONTENT_TYPES_PART_URI15 = "/[Content_Types].xml", PACKAGE_ROOT_OWNER = "/";
|
|
366788
367392
|
var init_objects = __esm(() => {
|
|
366789
367393
|
init_src2();
|
|
366790
367394
|
init_sd_document_session_internal();
|
|
366791
367395
|
TD105 = new TextDecoder("utf-8", { fatal: false });
|
|
366792
|
-
|
|
367396
|
+
TE60 = new TextEncoder;
|
|
366793
367397
|
});
|
|
366794
367398
|
|
|
366795
367399
|
// ../../../v2/document-api-v2-adapter/dist/compare/run-signature.js
|
|
@@ -367010,13 +367614,13 @@ function parseElementDocument(xml, options) {
|
|
|
367010
367614
|
root.closeEnd = closeEnd;
|
|
367011
367615
|
} else if (!tag.isSelfClosing) {
|
|
367012
367616
|
const stack = pending.get(tag.name);
|
|
367013
|
-
const
|
|
367014
|
-
if (
|
|
367015
|
-
const mapped = options.mapElement(
|
|
367016
|
-
raw: xml.slice(
|
|
367017
|
-
start:
|
|
367617
|
+
const open2 = stack?.pop();
|
|
367618
|
+
if (open2) {
|
|
367619
|
+
const mapped = options.mapElement(open2.tag, {
|
|
367620
|
+
raw: xml.slice(open2.start, closeEnd),
|
|
367621
|
+
start: open2.start,
|
|
367018
367622
|
end: closeEnd,
|
|
367019
|
-
qname:
|
|
367623
|
+
qname: open2.tag.name
|
|
367020
367624
|
});
|
|
367021
367625
|
if (mapped)
|
|
367022
367626
|
elements2.push(mapped);
|
|
@@ -371056,7 +371660,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
371056
371660
|
family: "header-footer-parts",
|
|
371057
371661
|
partUri: DOCUMENT_RELS_URI2,
|
|
371058
371662
|
kind: "create",
|
|
371059
|
-
nextBytes:
|
|
371663
|
+
nextBytes: TE61.encode(nextRels),
|
|
371060
371664
|
contentType: "application/vnd.openxmlformats-package.relationships+xml"
|
|
371061
371665
|
});
|
|
371062
371666
|
} else if (nextRels !== baseRels) {
|
|
@@ -371064,7 +371668,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
371064
371668
|
family: "header-footer-parts",
|
|
371065
371669
|
partUri: DOCUMENT_RELS_URI2,
|
|
371066
371670
|
kind: "modify",
|
|
371067
|
-
nextBytes:
|
|
371671
|
+
nextBytes: TE61.encode(nextRels)
|
|
371068
371672
|
});
|
|
371069
371673
|
}
|
|
371070
371674
|
const baseContentTypes = TD108.decode(Uint8Array.from(base3.contentTypesBytes));
|
|
@@ -371077,7 +371681,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
371077
371681
|
family: "header-footer-parts",
|
|
371078
371682
|
partUri: CONTENT_TYPES_URI2,
|
|
371079
371683
|
kind: "modify",
|
|
371080
|
-
nextBytes:
|
|
371684
|
+
nextBytes: TE61.encode(nextContentTypes)
|
|
371081
371685
|
});
|
|
371082
371686
|
}
|
|
371083
371687
|
return {
|
|
@@ -371226,8 +371830,8 @@ function coveredGraphKeys(baseRels, targetRels, baseContentTypes, targetContentT
|
|
|
371226
371830
|
}
|
|
371227
371831
|
}
|
|
371228
371832
|
const partUris = new Set([
|
|
371229
|
-
...headerFooterPartsFromDocumentRelationships(
|
|
371230
|
-
...headerFooterPartsFromDocumentRelationships(
|
|
371833
|
+
...headerFooterPartsFromDocumentRelationships(TE61.encode(baseRels)).keys(),
|
|
371834
|
+
...headerFooterPartsFromDocumentRelationships(TE61.encode(targetRels)).keys()
|
|
371231
371835
|
]);
|
|
371232
371836
|
const baseOverrides = headerFooterOverrideRecords(baseContentTypes, partUris);
|
|
371233
371837
|
const targetOverrides = headerFooterOverrideRecords(targetContentTypes, partUris);
|
|
@@ -371250,14 +371854,14 @@ function headerFooterOverrideRecords(xml, partUris) {
|
|
|
371250
371854
|
function relationshipSemanticKey(relationship) {
|
|
371251
371855
|
return JSON.stringify([relationship.id, relationship.type, relationship.target, relationship.targetMode ?? "Internal"]);
|
|
371252
371856
|
}
|
|
371253
|
-
var TD108,
|
|
371857
|
+
var TD108, TE61, DOCUMENT_RELS_URI2 = "/word/_rels/document.xml.rels", CONTENT_TYPES_URI2 = "/[Content_Types].xml", EMPTY_RELS_XML = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>', HEADER_REL_SUFFIX2 = "/relationships/header", FOOTER_REL_SUFFIX2 = "/relationships/footer", OFFICE_RELATIONSHIPS_NAMESPACES, RELATIONSHIP_REFERENCE_ATTRIBUTES;
|
|
371254
371858
|
var init_header_footer_lifecycle = __esm(() => {
|
|
371255
371859
|
init_sd_document_session_internal();
|
|
371256
371860
|
init_part_fingerprint();
|
|
371257
371861
|
init_header_footer_parts();
|
|
371258
371862
|
init_opc_xml();
|
|
371259
371863
|
TD108 = new TextDecoder;
|
|
371260
|
-
|
|
371864
|
+
TE61 = new TextEncoder;
|
|
371261
371865
|
OFFICE_RELATIONSHIPS_NAMESPACES = new Set([
|
|
371262
371866
|
"http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
371263
371867
|
"http://purl.oclc.org/ooxml/officeDocument/relationships"
|
|
@@ -371425,8 +372029,8 @@ function buildTrackedTableRowReplayPlan(input) {
|
|
|
371425
372029
|
if (input.base.xml === input.target.xml) {
|
|
371426
372030
|
return { steps: [], bodyOperations: input.bodyOperations, unsafeReasons: [] };
|
|
371427
372031
|
}
|
|
371428
|
-
const baseBytes =
|
|
371429
|
-
const targetBytes =
|
|
372032
|
+
const baseBytes = TE62.encode(input.base.xml);
|
|
372033
|
+
const targetBytes = TE62.encode(input.target.xml);
|
|
371430
372034
|
const baseCatalog = buildTableCatalog({ bytes: baseBytes, storyId: STORY_ID2 });
|
|
371431
372035
|
const targetCatalog = buildTableCatalog({ bytes: targetBytes, storyId: STORY_ID2 });
|
|
371432
372036
|
const baseRoot = documentRootContext(input.base.xml);
|
|
@@ -372099,10 +372703,10 @@ function escapeRegExp18(value2) {
|
|
|
372099
372703
|
function escapeXmlAttribute5(value2) {
|
|
372100
372704
|
return value2.replaceAll("&", "&").replaceAll('"', """);
|
|
372101
372705
|
}
|
|
372102
|
-
var
|
|
372706
|
+
var TE62, STORY_ID2 = "body:/word/document.xml", WORDPROCESSINGML_NS4 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WORDPROCESSINGML_2010_NS = "http://schemas.microsoft.com/office/word/2010/wordml", MARKUP_COMPATIBILITY_NS2 = "http://schemas.openxmlformats.org/markup-compatibility/2006", MC_PREFIX_LIST_ATTRIBUTES, MC_QNAME_LIST_ATTRIBUTES, EXACT_ROW_UNSAFE_REVISION_LOCAL_NAMES2, EXACT_ROW_UNSAFE_W14_REVISION_LOCAL_NAMES2;
|
|
372103
372707
|
var init_tracked_table_row_replay = __esm(() => {
|
|
372104
372708
|
init_sd_document_session_internal();
|
|
372105
|
-
|
|
372709
|
+
TE62 = new TextEncoder;
|
|
372106
372710
|
MC_PREFIX_LIST_ATTRIBUTES = new Set(["Ignorable", "MustUnderstand"]);
|
|
372107
372711
|
MC_QNAME_LIST_ATTRIBUTES = new Set(["PreserveElements", "PreserveAttributes", "ProcessContent"]);
|
|
372108
372712
|
EXACT_ROW_UNSAFE_REVISION_LOCAL_NAMES2 = new Set([
|
|
@@ -372156,7 +372760,7 @@ function read(xml) {
|
|
|
372156
372760
|
children2.push(range);
|
|
372157
372761
|
cursor = range.end;
|
|
372158
372762
|
}
|
|
372159
|
-
const bytes =
|
|
372763
|
+
const bytes = TE63.encode(xml);
|
|
372160
372764
|
const byteOffsets = buildUtf8ByteOffsetTable(xml);
|
|
372161
372765
|
const tables2 = buildTableCatalog({ bytes, storyId: STORY }).tables;
|
|
372162
372766
|
if (tables2.some((table) => table.containsNestedTable || !table.isRectangular || table.hasVMerge || table.hasGridSpan))
|
|
@@ -372278,11 +372882,11 @@ function buildTrackedTableBlockReplayPlan(input) {
|
|
|
372278
372882
|
bodyOperations: input.bodyOperations.filter((operation) => !ownedIds.has(operation.blockId))
|
|
372279
372883
|
};
|
|
372280
372884
|
}
|
|
372281
|
-
var W21 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W146 = "http://schemas.microsoft.com/office/word/2010/wordml", STORY = "body:/word/document.xml",
|
|
372885
|
+
var W21 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W146 = "http://schemas.microsoft.com/office/word/2010/wordml", STORY = "body:/word/document.xml", TE63, paragraphId2 = (range) => range.tag.attributes.find((attr3) => attr3.namespaceUri === W146 && attr3.localName === "paraId")?.value;
|
|
372282
372886
|
var init_tracked_table_block_replay = __esm(() => {
|
|
372283
372887
|
init_sd_document_session_internal();
|
|
372284
372888
|
init_tracked_table_row_replay();
|
|
372285
|
-
|
|
372889
|
+
TE63 = new TextEncoder;
|
|
372286
372890
|
});
|
|
372287
372891
|
|
|
372288
372892
|
// ../../../v2/document-api-v2-adapter/dist/diff/comments-replay.js
|
|
@@ -372334,7 +372938,7 @@ function validateDiffCommentSource(source, snapshot2, label) {
|
|
|
372334
372938
|
return problems;
|
|
372335
372939
|
}
|
|
372336
372940
|
function digest5(value2) {
|
|
372337
|
-
return sha256HexSync(
|
|
372941
|
+
return sha256HexSync(TE64.encode(value2));
|
|
372338
372942
|
}
|
|
372339
372943
|
function commentContentSignature(record3) {
|
|
372340
372944
|
return digest5(`body:${record3.bodyText}#author:${record3.author}#parent:${record3.parentParaId ?? ""}` + `#done:${record3.doneState ? "1" : "0"}#date:${record3.date ?? ""}` + `#anchor:${commentAnchorSignature2(record3.anchor)}`);
|
|
@@ -372682,12 +373286,12 @@ function isResolutionSidecarAddition(key2, targetEntry) {
|
|
|
372682
373286
|
if (!targetEntry)
|
|
372683
373287
|
return false;
|
|
372684
373288
|
if (key2 === "ct:override:/word/commentsExtended.xml") {
|
|
372685
|
-
return targetEntry.semanticKey === key2 && targetEntry.contentSignature === sha256HexSync(
|
|
373289
|
+
return targetEntry.semanticKey === key2 && targetEntry.contentSignature === sha256HexSync(TE64.encode("override:/word/commentsExtended.xml=" + "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"));
|
|
372686
373290
|
}
|
|
372687
373291
|
if (!key2.startsWith("rel:/word/document.xml|"))
|
|
372688
373292
|
return false;
|
|
372689
373293
|
const type = "http://schemas.microsoft.com/office/2011/relationships/commentsExtended";
|
|
372690
|
-
return targetEntry.semanticKey === `/word/document.xml|${type}` && targetEntry.contentSignature === sha256HexSync(
|
|
373294
|
+
return targetEntry.semanticKey === `/word/document.xml|${type}` && targetEntry.contentSignature === sha256HexSync(TE64.encode(`type:${type}#mode:Internal#target:/word/commentsExtended.xml`));
|
|
372691
373295
|
}
|
|
372692
373296
|
function isCommentScopedPackageKey(context, key2, presentInBase, hasCommentCreate, targetEntry) {
|
|
372693
373297
|
if (key2.startsWith("ct:")) {
|
|
@@ -372805,14 +373409,14 @@ function validateAnchorResolvable(context, commentId, anchor) {
|
|
|
372805
373409
|
});
|
|
372806
373410
|
return page.hits.length > 0 ? null : `comment "${commentId}" target text was not found`;
|
|
372807
373411
|
}
|
|
372808
|
-
var
|
|
373412
|
+
var TE64;
|
|
372809
373413
|
var init_comments_replay = __esm(() => {
|
|
372810
373414
|
init_sd_document_session_internal();
|
|
372811
373415
|
init_read();
|
|
372812
373416
|
init_collect_text_page();
|
|
372813
373417
|
init_scope2();
|
|
372814
373418
|
init_part_fingerprint();
|
|
372815
|
-
|
|
373419
|
+
TE64 = new TextEncoder;
|
|
372816
373420
|
});
|
|
372817
373421
|
|
|
372818
373422
|
// ../../../v2/document-api-v2-adapter/dist/diff/styles-replay.js
|
|
@@ -372950,8 +373554,8 @@ function snapshotNumberingInventory(snapshot2) {
|
|
|
372950
373554
|
return snapshot2.sourceInventory?.families.find((f) => f.family === "numbering") ?? null;
|
|
372951
373555
|
}
|
|
372952
373556
|
function capturedNumberingFingerprint(xml) {
|
|
372953
|
-
const partHash = sha256HexSync(
|
|
372954
|
-
return `fp:${sha256HexSync(
|
|
373557
|
+
const partHash = sha256HexSync(TE65.encode(xml));
|
|
373558
|
+
return `fp:${sha256HexSync(TE65.encode(`${NUMBERING_PART_URI}:${partHash}`))}`;
|
|
372955
373559
|
}
|
|
372956
373560
|
function validateNumberingSourceAgainstSnapshot(source, snapshot2, label) {
|
|
372957
373561
|
const problems = [];
|
|
@@ -372994,12 +373598,12 @@ function validateNumberingSourceAgainstSnapshot(source, snapshot2, label) {
|
|
|
372994
373598
|
}
|
|
372995
373599
|
return problems;
|
|
372996
373600
|
}
|
|
372997
|
-
var TD110,
|
|
373601
|
+
var TD110, TE65;
|
|
372998
373602
|
var init_numbering_replay = __esm(() => {
|
|
372999
373603
|
init_sd_document_session_internal();
|
|
373000
373604
|
init_definitions();
|
|
373001
373605
|
TD110 = new TextDecoder("utf-8", { fatal: false });
|
|
373002
|
-
|
|
373606
|
+
TE65 = new TextEncoder;
|
|
373003
373607
|
});
|
|
373004
373608
|
|
|
373005
373609
|
// ../../../v2/document-api-v2-adapter/dist/diff/settings-replay.js
|
|
@@ -373166,7 +373770,7 @@ function paragraphStyleOutlineLevelsFromStylesSource(stylesXml) {
|
|
|
373166
373770
|
return stylesXml == null ? new Map : parseParagraphStyleOutlineLevels(stylesXml);
|
|
373167
373771
|
}
|
|
373168
373772
|
function projectMainDocumentBodyEntries(source, options = {}) {
|
|
373169
|
-
const bytes =
|
|
373773
|
+
const bytes = TE66.encode(source.xml);
|
|
373170
373774
|
const paragraphStyleOutlineLevels = options.paragraphStyleOutlineLevels ?? paragraphStyleOutlineLevelMap(source.paragraphStyleOutlineLevels);
|
|
373171
373775
|
const paragraphIndex = buildParagraphIndex({
|
|
373172
373776
|
bytes,
|
|
@@ -373215,14 +373819,14 @@ function paragraphStyleOutlineLevelMap(record3) {
|
|
|
373215
373819
|
function capturedMainDocumentFingerprint(xml) {
|
|
373216
373820
|
return comparePartXmlFingerprint(MAIN_DOCUMENT_PART_URI, xml);
|
|
373217
373821
|
}
|
|
373218
|
-
var TD112,
|
|
373822
|
+
var TD112, TE66, MAIN_DOCUMENT_PART_URI = "/word/document.xml", MAIN_DOCUMENT_STORY_ID = "body:/word/document.xml", SNAPSHOT_REVISION = "snapshot";
|
|
373219
373823
|
var init_main_document_source = __esm(() => {
|
|
373220
373824
|
init_sd_document_session_internal();
|
|
373221
373825
|
init_document_reader();
|
|
373222
373826
|
init_run_signature2();
|
|
373223
373827
|
init_part_fingerprint();
|
|
373224
373828
|
TD112 = new TextDecoder("utf-8", { fatal: false });
|
|
373225
|
-
|
|
373829
|
+
TE66 = new TextEncoder;
|
|
373226
373830
|
});
|
|
373227
373831
|
|
|
373228
373832
|
// ../../../v2/document-api-v2-adapter/dist/diff/payloads.js
|
|
@@ -375516,8 +376120,8 @@ function replaceAttribute(element, localName2, value2) {
|
|
|
375516
376120
|
if (!attribute2)
|
|
375517
376121
|
return element.xml;
|
|
375518
376122
|
const openEnd = element.xml.indexOf(">") + 1;
|
|
375519
|
-
const
|
|
375520
|
-
const replaced =
|
|
376123
|
+
const open2 = element.xml.slice(0, openEnd);
|
|
376124
|
+
const replaced = open2.replace(new RegExp(`(\\b${escapeRegExp19(attribute2.name)}\\s*=\\s*)(['"])([\\s\\S]*?)\\2`), (_match, name, quote) => `${name}${quote}${value2}${quote}`);
|
|
375521
376125
|
return replaced + element.xml.slice(openEnd);
|
|
375522
376126
|
}
|
|
375523
376127
|
function replaceUnique(xml, before, after) {
|
|
@@ -376465,7 +377069,7 @@ class V2DiffAdapter {
|
|
|
376465
377069
|
family: "tables",
|
|
376466
377070
|
partUri: DOCUMENT_PART_URI6,
|
|
376467
377071
|
kind: "modify",
|
|
376468
|
-
nextBytes:
|
|
377072
|
+
nextBytes: TE67.encode(step3.nextXml)
|
|
376469
377073
|
}));
|
|
376470
377074
|
const packageRewrites = [
|
|
376471
377075
|
...slotPlan.rewrites,
|
|
@@ -377053,7 +377657,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
377053
377657
|
family: "styles",
|
|
377054
377658
|
partUri: step3.partUri,
|
|
377055
377659
|
kind: "modify",
|
|
377056
|
-
nextBytes:
|
|
377660
|
+
nextBytes: TE67.encode(step3.nextXml)
|
|
377057
377661
|
});
|
|
377058
377662
|
}
|
|
377059
377663
|
for (const step3 of numberingSteps) {
|
|
@@ -377063,7 +377667,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
377063
377667
|
family: "numbering",
|
|
377064
377668
|
partUri: NUMBERING_PART_URI4,
|
|
377065
377669
|
kind: "modify",
|
|
377066
|
-
nextBytes:
|
|
377670
|
+
nextBytes: TE67.encode(step3.nextXml)
|
|
377067
377671
|
});
|
|
377068
377672
|
}
|
|
377069
377673
|
for (const step3 of settingsSteps) {
|
|
@@ -377071,7 +377675,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
377071
377675
|
family: "settings",
|
|
377072
377676
|
partUri: step3.partUri,
|
|
377073
377677
|
kind: "modify",
|
|
377074
|
-
nextBytes:
|
|
377678
|
+
nextBytes: TE67.encode(step3.nextXml)
|
|
377075
377679
|
});
|
|
377076
377680
|
}
|
|
377077
377681
|
return rewrites;
|
|
@@ -378043,7 +378647,7 @@ function stripRootReplayNamespaceDeclarations(xml) {
|
|
|
378043
378647
|
const openEnd = xml.indexOf(">") + 1;
|
|
378044
378648
|
return stripReplayNamespaceDeclarations(xml.slice(0, openEnd)) + xml.slice(openEnd);
|
|
378045
378649
|
}
|
|
378046
|
-
var FULL_DIFF_APPLY_SUPPORTED_FAMILIES,
|
|
378650
|
+
var FULL_DIFF_APPLY_SUPPORTED_FAMILIES, TE67, TD114, DOCUMENT_PART_URI6 = "/word/document.xml", NUMBERING_PART_URI4 = "/word/numbering.xml", EMPTY_MAIN_DOCUMENT_SOURCE, WORDPROCESSINGML_NS7 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WORDPROCESSINGML_2010_NS2 = "http://schemas.microsoft.com/office/word/2010/wordml", WORDPROCESSING_MATH_NS = "http://schemas.openxmlformats.org/officeDocument/2006/math", MARKUP_COMPATIBILITY_NS3 = "http://schemas.openxmlformats.org/markup-compatibility/2006", VML_NS = "urn:schemas-microsoft-com:vml", STRUCTURAL_PARA_EDIT_DELETE_WML_NAMES, STRUCTURAL_PARA_EDIT_DELETE_MATH_NAMES, STRUCTURAL_PARA_FORMAT_EDIT_WML_NAMES;
|
|
378047
378651
|
var init_adapter25 = __esm(() => {
|
|
378048
378652
|
init_tracked_table_property_replay();
|
|
378049
378653
|
init_src2();
|
|
@@ -378083,7 +378687,7 @@ var init_adapter25 = __esm(() => {
|
|
|
378083
378687
|
"fields-references",
|
|
378084
378688
|
"tracked-changes"
|
|
378085
378689
|
]);
|
|
378086
|
-
|
|
378690
|
+
TE67 = new TextEncoder;
|
|
378087
378691
|
TD114 = new TextDecoder;
|
|
378088
378692
|
EMPTY_MAIN_DOCUMENT_SOURCE = { xml: "" };
|
|
378089
378693
|
STRUCTURAL_PARA_EDIT_DELETE_WML_NAMES = new Set([
|
|
@@ -379851,8 +380455,8 @@ function commitTrackedDefinitionMutation(runtime, abstractNumId, txIdPrefix, mut
|
|
|
379851
380455
|
const id = reference.tag.attributes.find((attr3) => attr3.namespaceUri === WORDPROCESSINGML_NAMESPACE8 && attr3.localName === "val")?.value;
|
|
379852
380456
|
if (!id || !numIds.has(id))
|
|
379853
380457
|
continue;
|
|
379854
|
-
const startByte =
|
|
379855
|
-
const endByte =
|
|
380458
|
+
const startByte = TE68.encode(xml.slice(0, reference.start)).length;
|
|
380459
|
+
const endByte = TE68.encode(xml.slice(0, reference.end)).length;
|
|
379856
380460
|
if (!owners.some((owner) => owner.runtime.partUri === partUri && owner.paragraph.byteStart < startByte && owner.paragraph.byteEnd > endByte)) {
|
|
379857
380461
|
return { ok: false, code: "CAPABILITY_UNAVAILABLE", message: "Tracked shared numbering has an owner outside the editable paragraph stories." };
|
|
379858
380462
|
}
|
|
@@ -380262,7 +380866,7 @@ function commitLocalizedRuntimeMutation(input) {
|
|
|
380262
380866
|
paraId: edit.paraId,
|
|
380263
380867
|
startByte: paragraph4.byteStart,
|
|
380264
380868
|
endByte: paragraph4.byteEnd,
|
|
380265
|
-
bytes: edit.replacementXml === null ? new Uint8Array :
|
|
380869
|
+
bytes: edit.replacementXml === null ? new Uint8Array : TE68.encode(edit.replacementXml)
|
|
380266
380870
|
};
|
|
380267
380871
|
}).filter((row) => row !== null).sort((left, right) => left.startByte - right.startByte);
|
|
380268
380872
|
if (patchRows.length !== input.documentEdits.length || patchRows.length === 0) {
|
|
@@ -380309,7 +380913,7 @@ function commitLocalizedRuntimeMutation(input) {
|
|
|
380309
380913
|
order: 0,
|
|
380310
380914
|
startByte: 0,
|
|
380311
380915
|
endByte: currentBytes.length,
|
|
380312
|
-
bytes:
|
|
380916
|
+
bytes: TE68.encode(serializeNumberingDocument(input.nextNumbering))
|
|
380313
380917
|
}]
|
|
380314
380918
|
};
|
|
380315
380919
|
}
|
|
@@ -380361,7 +380965,7 @@ function applyParagraphEdits(currentBytes, paragraphs, edits) {
|
|
|
380361
380965
|
return {
|
|
380362
380966
|
startByte: paragraph4.byteStart,
|
|
380363
380967
|
endByte: paragraph4.byteEnd,
|
|
380364
|
-
bytes: edit.replacementXml === null ? new Uint8Array :
|
|
380968
|
+
bytes: edit.replacementXml === null ? new Uint8Array : TE68.encode(edit.replacementXml)
|
|
380365
380969
|
};
|
|
380366
380970
|
}).filter((entry) => entry !== null).sort((left, right) => left.startByte - right.startByte);
|
|
380367
380971
|
const chunks = [];
|
|
@@ -380918,7 +381522,7 @@ function escapeForRegex2(value2) {
|
|
|
380918
381522
|
function createEmptyLevelXml(level, prefix = "w") {
|
|
380919
381523
|
return `<${prefix}:lvl w:ilvl="${level}"></${prefix}:lvl>`;
|
|
380920
381524
|
}
|
|
380921
|
-
var NUMBERING_PART_URI5 = "/word/numbering.xml", WORDPROCESSINGML_NAMESPACE8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
381525
|
+
var NUMBERING_PART_URI5 = "/word/numbering.xml", WORDPROCESSINGML_NAMESPACE8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TE68, TD115;
|
|
380922
381526
|
var init_runtime3 = __esm(() => {
|
|
380923
381527
|
init_src3();
|
|
380924
381528
|
init_sd_document_session_internal();
|
|
@@ -380928,7 +381532,7 @@ var init_runtime3 = __esm(() => {
|
|
|
380928
381532
|
init_xml();
|
|
380929
381533
|
init_xml_rewrite();
|
|
380930
381534
|
init_tracked_sequence_edits();
|
|
380931
|
-
|
|
381535
|
+
TE68 = new TextEncoder;
|
|
380932
381536
|
TD115 = new TextDecoder;
|
|
380933
381537
|
});
|
|
380934
381538
|
|
|
@@ -388140,7 +388744,7 @@ class V2HyperlinksAdapter {
|
|
|
388140
388744
|
after: {
|
|
388141
388745
|
partUri: entry.partUri,
|
|
388142
388746
|
startByte: entry.descriptor.byteStart,
|
|
388143
|
-
endByte: entry.descriptor.byteEnd +
|
|
388747
|
+
endByte: entry.descriptor.byteEnd + TE69.encode(nextHyperlinkXml).length - TE69.encode(hyperlinkXml).length
|
|
388144
388748
|
},
|
|
388145
388749
|
...input.patch.rel !== undefined ? { rel: input.patch.rel } : {}
|
|
388146
388750
|
}],
|
|
@@ -388422,7 +389026,7 @@ function hyperlinkSessionAnchor(partUri, descriptor) {
|
|
|
388422
389026
|
}
|
|
388423
389027
|
function createdHyperlinkAnchor(paragraph4, nextParagraphXml, nextDocumentXml, start, end) {
|
|
388424
389028
|
const catalog = buildHyperlinkCatalog({
|
|
388425
|
-
bytes:
|
|
389029
|
+
bytes: TE69.encode(nextDocumentXml),
|
|
388426
389030
|
storyId: paragraph4.storyId,
|
|
388427
389031
|
partUri: paragraph4.partUri,
|
|
388428
389032
|
relsBytes: null
|
|
@@ -388747,7 +389351,7 @@ function escapeRegex15(value2) {
|
|
|
388747
389351
|
function defaultRelationshipsXml3() {
|
|
388748
389352
|
return '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
388749
389353
|
}
|
|
388750
|
-
var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", TD120,
|
|
389354
|
+
var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", TD120, TE69;
|
|
388751
389355
|
var init_adapter34 = __esm(() => {
|
|
388752
389356
|
init_sd_document_session_internal();
|
|
388753
389357
|
init_inline();
|
|
@@ -388758,7 +389362,7 @@ var init_adapter34 = __esm(() => {
|
|
|
388758
389362
|
init_stories();
|
|
388759
389363
|
init_registry3();
|
|
388760
389364
|
TD120 = new TextDecoder;
|
|
388761
|
-
|
|
389365
|
+
TE69 = new TextEncoder;
|
|
388762
389366
|
});
|
|
388763
389367
|
|
|
388764
389368
|
// ../../../v2/document-api-v2-adapter/dist/watermarks/serialization.js
|
|
@@ -391048,7 +391652,7 @@ function wrapExistingNoteReferenceXml(documentXml, type, noteId, stamp) {
|
|
|
391048
391652
|
const propertiesXml = properties ? documentXml.slice(properties.start, properties.end) : "";
|
|
391049
391653
|
const before = documentXml.slice(run.openEnd, reference.start);
|
|
391050
391654
|
const after = documentXml.slice(reference.end, run.closeStart);
|
|
391051
|
-
const
|
|
391655
|
+
const open2 = documentXml.slice(run.start, run.openEnd);
|
|
391052
391656
|
const close = documentXml.slice(run.closeStart, run.end);
|
|
391053
391657
|
const hasBefore = before.replace(propertiesXml, "").trim().length > 0;
|
|
391054
391658
|
const hasAfter = after.trim().length > 0;
|
|
@@ -391056,7 +391660,7 @@ function wrapExistingNoteReferenceXml(documentXml, type, noteId, stamp) {
|
|
|
391056
391660
|
if (!hasBefore && !hasAfter) {
|
|
391057
391661
|
referenceRun = documentXml.slice(run.start, run.end);
|
|
391058
391662
|
} else {
|
|
391059
|
-
referenceRun =
|
|
391663
|
+
referenceRun = open2 + propertiesXml + documentXml.slice(reference.start, reference.end) + close;
|
|
391060
391664
|
}
|
|
391061
391665
|
const replacement = prepareTrackedInlineXmlReplacement({
|
|
391062
391666
|
beforeXml: referenceRun,
|
|
@@ -391067,7 +391671,7 @@ function wrapExistingNoteReferenceXml(documentXml, type, noteId, stamp) {
|
|
|
391067
391671
|
if (!replacement)
|
|
391068
391672
|
return unresolved();
|
|
391069
391673
|
return {
|
|
391070
|
-
xml: documentXml.slice(0, run.start) + (hasBefore ?
|
|
391674
|
+
xml: documentXml.slice(0, run.start) + (hasBefore ? open2 + before + close : "") + replacement.xml + (hasAfter ? open2 + propertiesXml + after + close : "") + documentXml.slice(run.end),
|
|
391071
391675
|
wordIds: replacement.wordIds
|
|
391072
391676
|
};
|
|
391073
391677
|
}
|
|
@@ -392975,9 +393579,9 @@ function resolveFootnoteRangeIndex(session, index2, start, end) {
|
|
|
392975
393579
|
const id = readXmlAttributes(note.tag, W_NS8, "id")[0]?.value;
|
|
392976
393580
|
if (!id || groups.has(id))
|
|
392977
393581
|
return null;
|
|
392978
|
-
byteCursor +=
|
|
393582
|
+
byteCursor += TE70.encode(xml.slice(charCursor, note.start)).byteLength;
|
|
392979
393583
|
const byteStart = byteCursor;
|
|
392980
|
-
byteCursor +=
|
|
393584
|
+
byteCursor += TE70.encode(xml.slice(note.start, note.end)).byteLength;
|
|
392981
393585
|
charCursor = note.end;
|
|
392982
393586
|
const group = [];
|
|
392983
393587
|
while (entryCursor < sourceEntries.length && sourceEntries[entryCursor].byteStart < byteCursor) {
|
|
@@ -393015,11 +393619,11 @@ function resolveFootnoteRangeIndex(session, index2, start, end) {
|
|
|
393015
393619
|
byParaId: (blockId) => byBlockId.get(blockId) ?? null
|
|
393016
393620
|
};
|
|
393017
393621
|
}
|
|
393018
|
-
var W_NS8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
393622
|
+
var W_NS8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TE70;
|
|
393019
393623
|
var init_footnote_range = __esm(() => {
|
|
393020
393624
|
init_sd_document_session_internal();
|
|
393021
393625
|
init_note_story();
|
|
393022
|
-
|
|
393626
|
+
TE70 = new TextEncoder;
|
|
393023
393627
|
});
|
|
393024
393628
|
|
|
393025
393629
|
// ../../../v2/document-api-v2-adapter/dist/clipboard/serialize.js
|
|
@@ -393604,8 +394208,8 @@ function boundedAttribute(xml, tag, attribute2) {
|
|
|
393604
394208
|
return readXmlAttribute5(xml, tag, attribute2)?.slice(0, MAX_IMAGE_METADATA_CHARS) || undefined;
|
|
393605
394209
|
}
|
|
393606
394210
|
function readXmlAttribute5(xml, tag, attribute2, prefix) {
|
|
393607
|
-
const
|
|
393608
|
-
return
|
|
394211
|
+
const open2 = new RegExp(`<[\\w.-]+:${tag}\\b[^>]*>`).exec(xml)?.[0];
|
|
394212
|
+
return open2 ? readBareAttribute(open2, prefix ? `${prefix}:${attribute2}` : attribute2) : null;
|
|
393609
394213
|
}
|
|
393610
394214
|
function readBareAttribute(xml, attribute2) {
|
|
393611
394215
|
const escaped = attribute2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -393912,10 +394516,10 @@ function compileCopyParagraphPropertyXmlModel(context) {
|
|
|
393912
394516
|
let match;
|
|
393913
394517
|
while (match = stylePattern.exec(xml)) {
|
|
393914
394518
|
const styleXml = match[0];
|
|
393915
|
-
const
|
|
393916
|
-
if (readQualifiedXmlAttribute(
|
|
394519
|
+
const open2 = new RegExp(`^<${prefix}:style\\b[^>]*>`).exec(styleXml)?.[0] ?? "";
|
|
394520
|
+
if (readQualifiedXmlAttribute(open2, normalized.prefix, "type") !== "paragraph")
|
|
393917
394521
|
continue;
|
|
393918
|
-
const styleId = readQualifiedXmlAttribute(
|
|
394522
|
+
const styleId = readQualifiedXmlAttribute(open2, normalized.prefix, "styleId");
|
|
393919
394523
|
if (!styleId)
|
|
393920
394524
|
continue;
|
|
393921
394525
|
const basedOnOpen = new RegExp(`<${prefix}:basedOn\\b[^>]*>`).exec(styleXml)?.[0] ?? "";
|
|
@@ -395423,7 +396027,7 @@ function clipReferencedDefinitions(bytes, kind, ids) {
|
|
|
395423
396027
|
if (children2.length !== ids.size) {
|
|
395424
396028
|
invalid4("PRECONDITION_FAILED", `Selected ${kind} definition is missing.`);
|
|
395425
396029
|
}
|
|
395426
|
-
return
|
|
396030
|
+
return TE71.encode(`${xml.slice(root.range.start, root.range.openEnd)}` + children2.map((child) => xml.slice(child.range.start, child.range.end)).join("") + xml.slice(root.range.closeStart, root.range.end));
|
|
395427
396031
|
}
|
|
395428
396032
|
function wordValue(range, name) {
|
|
395429
396033
|
return range.tag.attributes.find((attribute2) => attribute2.namespaceUri === W23 && attribute2.localName === name)?.value ?? null;
|
|
@@ -395467,7 +396071,7 @@ function clipStylesPart(bytes, requestedIds) {
|
|
|
395467
396071
|
}
|
|
395468
396072
|
}
|
|
395469
396073
|
const retained = root.children.filter((node4) => node4.range.tag.namespaceUri === W23 && (node4.range.tag.localName === "docDefaults" || node4.range.tag.localName === "style" && wanted.has(wordValue(node4.range, "styleId") ?? "")));
|
|
395470
|
-
return
|
|
396074
|
+
return TE71.encode(xml.slice(root.range.start, root.range.openEnd) + retained.map((node4) => xml.slice(node4.range.start, node4.range.end)).join("") + xml.slice(root.range.closeStart, root.range.end));
|
|
395471
396075
|
}
|
|
395472
396076
|
function clipNumberingPart(bytes, requestedIds) {
|
|
395473
396077
|
const xml = TD122.decode(bytes);
|
|
@@ -395486,7 +396090,7 @@ function clipNumberingPart(bytes, requestedIds) {
|
|
|
395486
396090
|
invalid4("PRECONDITION_FAILED", "Selected abstract numbering definition is missing.");
|
|
395487
396091
|
const pictureIds = new Set(abstracts.flatMap((node4) => parsed.ranges.filter((range) => range.start > node4.range.start && range.end < node4.range.end && range.tag.namespaceUri === W23 && range.tag.localName === "lvlPicBulletId").map((range) => wordValue(range, "val")).filter((id) => id != null)));
|
|
395488
396092
|
const retained = root.children.filter((node4) => node4.range.tag.namespaceUri === W23 && (node4.range.tag.localName === "num" && requestedIds.has(wordValue(node4.range, "numId") ?? "") || node4.range.tag.localName === "abstractNum" && abstractIds.has(wordValue(node4.range, "abstractNumId") ?? "") || node4.range.tag.localName === "numPicBullet" && pictureIds.has(wordValue(node4.range, "numPicBulletId") ?? "")));
|
|
395489
|
-
return
|
|
396093
|
+
return TE71.encode(xml.slice(root.range.start, root.range.openEnd) + retained.map((node4) => xml.slice(node4.range.start, node4.range.end)).join("") + xml.slice(root.range.closeStart, root.range.end));
|
|
395490
396094
|
}
|
|
395491
396095
|
function collectPairedMarkerContext(partXml, ranges, selectionStart, selectionEnd, context) {
|
|
395492
396096
|
const pairs = [
|
|
@@ -395575,8 +396179,8 @@ function captureTableSelection(context, at, resultAt = at, whole = false) {
|
|
|
395575
396179
|
const nested = parsed.ranges.some((ancestor) => ancestor.start < range.start && ancestor.end > range.end && ancestor.tag.namespaceUri === W23 && ancestor.tag.localName === "tbl");
|
|
395576
396180
|
if (!nested)
|
|
395577
396181
|
continue;
|
|
395578
|
-
const byteStart =
|
|
395579
|
-
const byteEnd =
|
|
396182
|
+
const byteStart = TE71.encode(partXml.slice(0, range.start)).byteLength;
|
|
396183
|
+
const byteEnd = TE71.encode(partXml.slice(0, range.end)).byteLength;
|
|
395580
396184
|
const nestedCatalog = buildTableCatalog({
|
|
395581
396185
|
bytes: bytes.subarray(byteStart, byteEnd),
|
|
395582
396186
|
storyId: story.storyId,
|
|
@@ -396219,7 +396823,7 @@ function resolveBlockBoundarySelection(context, at) {
|
|
|
396219
396823
|
if (!bytes)
|
|
396220
396824
|
invalid4("PRECONDITION_FAILED", "Source story bytes are unavailable.");
|
|
396221
396825
|
const catalog = buildTableCatalog({ bytes, storyId: story.storyId });
|
|
396222
|
-
const
|
|
396826
|
+
const resolve2 = (point3, side) => {
|
|
396223
396827
|
if (point3.kind === "text")
|
|
396224
396828
|
return point3;
|
|
396225
396829
|
const { node: node4 } = point3;
|
|
@@ -396259,8 +396863,8 @@ function resolveBlockBoundarySelection(context, at) {
|
|
|
396259
396863
|
...storyLocator ? { story: storyLocator } : {}
|
|
396260
396864
|
};
|
|
396261
396865
|
};
|
|
396262
|
-
const start =
|
|
396263
|
-
const end =
|
|
396866
|
+
const start = resolve2(at.start, "start");
|
|
396867
|
+
const end = resolve2(at.end, "end");
|
|
396264
396868
|
return start && end ? { ...at, start, end } : null;
|
|
396265
396869
|
}
|
|
396266
396870
|
function captureSelectionOoxml(context, input) {
|
|
@@ -396407,7 +397011,7 @@ function captureSelectionOoxml(context, input) {
|
|
|
396407
397011
|
diagnostics: []
|
|
396408
397012
|
};
|
|
396409
397013
|
}
|
|
396410
|
-
var W23 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", TD122,
|
|
397014
|
+
var W23 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", TD122, TE71, MAX_CAPTURE_DEPENDENCIES = 1024, MAX_CAPTURE_DEPENDENCY_BYTES, PROPERTY_NODES;
|
|
396411
397015
|
var init_capture2 = __esm(() => {
|
|
396412
397016
|
init_src3();
|
|
396413
397017
|
init_sd_document_session_internal();
|
|
@@ -396416,7 +397020,7 @@ var init_capture2 = __esm(() => {
|
|
|
396416
397020
|
init_public_model();
|
|
396417
397021
|
init_runtime2();
|
|
396418
397022
|
TD122 = new TextDecoder;
|
|
396419
|
-
|
|
397023
|
+
TE71 = new TextEncoder;
|
|
396420
397024
|
MAX_CAPTURE_DEPENDENCY_BYTES = 128 * 1024 * 1024;
|
|
396421
397025
|
PROPERTY_NODES = new Set([
|
|
396422
397026
|
"tblPr",
|
|
@@ -396483,150 +397087,6 @@ var init_adapter38 = __esm(() => {
|
|
|
396483
397087
|
init_capture2();
|
|
396484
397088
|
});
|
|
396485
397089
|
|
|
396486
|
-
// ../../../v2/document-api-v2-adapter/dist/core/clear-content-adapter.js
|
|
396487
|
-
class V2ClearContentAdapter {
|
|
396488
|
-
constructor(context) {
|
|
396489
|
-
this.context = context;
|
|
396490
|
-
}
|
|
396491
|
-
clearContent(_input, options) {
|
|
396492
|
-
const expectedRevision = options?.expectedRevision != null ? String(options.expectedRevision) : undefined;
|
|
396493
|
-
const mutationFailure5 = this.context.validateMutation(options);
|
|
396494
|
-
if (mutationFailure5)
|
|
396495
|
-
return { success: false, failure: mutationFailure5 };
|
|
396496
|
-
const bodyStory = this.context.resolveFullStoryLocator({ kind: "story", storyType: "body" });
|
|
396497
|
-
if ("error" in bodyStory) {
|
|
396498
|
-
return {
|
|
396499
|
-
success: false,
|
|
396500
|
-
failure: {
|
|
396501
|
-
code: "TARGET_NOT_FOUND",
|
|
396502
|
-
message: `body story could not be resolved: ${bodyStory.error}.`
|
|
396503
|
-
}
|
|
396504
|
-
};
|
|
396505
|
-
}
|
|
396506
|
-
const topLevelItems = readTopLevelBodyItems(this.context);
|
|
396507
|
-
const imagesByPara = readBodyParagraphImageMap(this.context);
|
|
396508
|
-
if (isAlreadyClear(topLevelItems, imagesByPara)) {
|
|
396509
|
-
return { success: true, status: "NO_OP" };
|
|
396510
|
-
}
|
|
396511
|
-
const bytes = getSDDocumentSessionInternalPartBytes(this.context.session, bodyStory.partUri);
|
|
396512
|
-
if (!bytes) {
|
|
396513
|
-
return {
|
|
396514
|
-
success: false,
|
|
396515
|
-
failure: { code: "PRECONDITION_FAILED", message: "body part bytes are unavailable." }
|
|
396516
|
-
};
|
|
396517
|
-
}
|
|
396518
|
-
const sourceXml = new TextDecoder().decode(bytes);
|
|
396519
|
-
const paragraphId4 = firstParagraphId(topLevelItems);
|
|
396520
|
-
let nextXml = rewriteBodyToSingleEmptyParagraph(sourceXml, paragraphId4);
|
|
396521
|
-
if (nextXml == null) {
|
|
396522
|
-
return {
|
|
396523
|
-
success: false,
|
|
396524
|
-
failure: { code: "INTERNAL_ERROR", message: "document body could not be rewritten." }
|
|
396525
|
-
};
|
|
396526
|
-
}
|
|
396527
|
-
const changeMode = options?.changeMode ?? "direct";
|
|
396528
|
-
const createdRefs = [];
|
|
396529
|
-
if (changeMode === "tracked") {
|
|
396530
|
-
const replacement = prepareTrackedBodyReplacement({
|
|
396531
|
-
context: this.context,
|
|
396532
|
-
beforeXml: sourceXml,
|
|
396533
|
-
afterXml: nextXml,
|
|
396534
|
-
dryRun: options?.dryRun
|
|
396535
|
-
});
|
|
396536
|
-
if (!replacement.ok) {
|
|
396537
|
-
return { success: false, failure: { code: replacement.code, message: replacement.message } };
|
|
396538
|
-
}
|
|
396539
|
-
nextXml = replacement.xml;
|
|
396540
|
-
createdRefs.push(...replacement.wordIds.map((entityId) => ({
|
|
396541
|
-
kind: "trackedChange",
|
|
396542
|
-
entityId,
|
|
396543
|
-
storyId: bodyStory.storyId
|
|
396544
|
-
})));
|
|
396545
|
-
createdRefs.push(...replacement.paragraphIds.map((nodeId) => ({
|
|
396546
|
-
kind: "block",
|
|
396547
|
-
nodeId,
|
|
396548
|
-
storyId: bodyStory.storyId
|
|
396549
|
-
})));
|
|
396550
|
-
}
|
|
396551
|
-
if (options?.dryRun)
|
|
396552
|
-
return { success: true };
|
|
396553
|
-
const nextBytes = TE71.encode(nextXml);
|
|
396554
|
-
const committed = commitKernelStorySurfacePatch({
|
|
396555
|
-
context: this.context,
|
|
396556
|
-
txIdPrefix: "internal-clearContent",
|
|
396557
|
-
expectedRevision,
|
|
396558
|
-
perPart: {
|
|
396559
|
-
[bodyStory.partUri]: replaceWholePartEntry(bytes, nextBytes)
|
|
396560
|
-
},
|
|
396561
|
-
storyIds: [bodyStory.storyId],
|
|
396562
|
-
createdRefs,
|
|
396563
|
-
signalLanesToRebuild: ["paragraphIndex", "sections", "headings", "manualPageBreaks", "drawings", "noteAnchorRefs"],
|
|
396564
|
-
indexRefreshScope: {
|
|
396565
|
-
perPart: {
|
|
396566
|
-
[bodyStory.partUri]: {
|
|
396567
|
-
beforeWindow: { startByte: 0, endByte: bytes.length },
|
|
396568
|
-
kind: "wide-rewrite",
|
|
396569
|
-
reason: "clear-content-whole-body-rewrite"
|
|
396570
|
-
}
|
|
396571
|
-
}
|
|
396572
|
-
},
|
|
396573
|
-
storySurface: { family: "storyBlocks", changeMode }
|
|
396574
|
-
});
|
|
396575
|
-
if (!committed.ok) {
|
|
396576
|
-
return {
|
|
396577
|
-
success: false,
|
|
396578
|
-
failure: {
|
|
396579
|
-
code: committed.code,
|
|
396580
|
-
message: committed.message
|
|
396581
|
-
}
|
|
396582
|
-
};
|
|
396583
|
-
}
|
|
396584
|
-
const inserted = projectTrackedStructuralEntityIds(this.context, createdRefs.flatMap((ref5) => ref5.kind === "trackedChange" ? [ref5.entityId] : [])).map((entityId) => ({ kind: "entity", entityType: "trackedChange", entityId }));
|
|
396585
|
-
return {
|
|
396586
|
-
success: true,
|
|
396587
|
-
txId: committed.txId,
|
|
396588
|
-
affectedStories: [{ kind: "story", storyType: "body" }],
|
|
396589
|
-
...inserted.length ? { inserted } : {}
|
|
396590
|
-
};
|
|
396591
|
-
}
|
|
396592
|
-
}
|
|
396593
|
-
function isAlreadyClear(items, imagesByPara) {
|
|
396594
|
-
if (items.length !== 1 || items[0]?.kind !== "paragraph")
|
|
396595
|
-
return false;
|
|
396596
|
-
const paragraph4 = items[0].paragraph;
|
|
396597
|
-
return paragraph4.text.length === 0 && (imagesByPara.get(paragraph4.blockId)?.length ?? 0) === 0;
|
|
396598
|
-
}
|
|
396599
|
-
function firstParagraphId(items) {
|
|
396600
|
-
const paragraph4 = items.find((item) => item.kind === "paragraph");
|
|
396601
|
-
return paragraph4?.paragraph.blockId ?? "00000000";
|
|
396602
|
-
}
|
|
396603
|
-
function rewriteBodyToSingleEmptyParagraph(xml, paragraphId4) {
|
|
396604
|
-
const bodyMatch = xml.match(/(<[\w.-]+:body\b[^>]*>)([\s\S]*?)(<\/[\w.-]+:body>)/);
|
|
396605
|
-
if (!bodyMatch)
|
|
396606
|
-
return null;
|
|
396607
|
-
const bodyOpen = bodyMatch[1];
|
|
396608
|
-
const bodyInner = bodyMatch[2];
|
|
396609
|
-
const bodyClose = bodyMatch[3];
|
|
396610
|
-
const sectPrXml = readTrailingBodySectPr2(bodyInner);
|
|
396611
|
-
const emptyParagraph = `<w:p w14:paraId="${paragraphId4}"><w:r><w:t></w:t></w:r></w:p>`;
|
|
396612
|
-
return xml.replace(bodyMatch[0], `${bodyOpen}${emptyParagraph}${sectPrXml}${bodyClose}`);
|
|
396613
|
-
}
|
|
396614
|
-
function readTrailingBodySectPr2(bodyInner) {
|
|
396615
|
-
if (!bodyInner)
|
|
396616
|
-
return "";
|
|
396617
|
-
const match = bodyInner.match(/(<([\w.-]+):sectPr\b[^>]*\/>|<([\w.-]+):sectPr\b(?:(?!<[\w.-]+:sectPr\b)[\s\S])*?<\/\3:sectPr>)\s*$/);
|
|
396618
|
-
return match?.[1] ?? "";
|
|
396619
|
-
}
|
|
396620
|
-
var TE71;
|
|
396621
|
-
var init_clear_content_adapter = __esm(() => {
|
|
396622
|
-
init_sd_document_session_internal();
|
|
396623
|
-
init_document_reader();
|
|
396624
|
-
init_xml();
|
|
396625
|
-
init_tracked_body_replacement();
|
|
396626
|
-
init_receipt_entities();
|
|
396627
|
-
TE71 = new TextEncoder;
|
|
396628
|
-
});
|
|
396629
|
-
|
|
396630
397090
|
// ../../../v2/document-api-v2-adapter/dist/formatting/styles.js
|
|
396631
397091
|
function applyStylesDocDefaultsPatch(stylesXml, input) {
|
|
396632
397092
|
const normalized = normalizeStylesWordprocessingMlQNames(stylesXml);
|
|
@@ -404912,17 +405372,17 @@ var init_yjs = __esm(() => {
|
|
|
404912
405372
|
this.isLoaded = false;
|
|
404913
405373
|
this.isSynced = false;
|
|
404914
405374
|
this.isDestroyed = false;
|
|
404915
|
-
this.whenLoaded = create4((
|
|
405375
|
+
this.whenLoaded = create4((resolve2) => {
|
|
404916
405376
|
this.on("load", () => {
|
|
404917
405377
|
this.isLoaded = true;
|
|
404918
|
-
|
|
405378
|
+
resolve2(this);
|
|
404919
405379
|
});
|
|
404920
405380
|
});
|
|
404921
|
-
const provideSyncedPromise = () => create4((
|
|
405381
|
+
const provideSyncedPromise = () => create4((resolve2) => {
|
|
404922
405382
|
const eventHandler = (isSynced) => {
|
|
404923
405383
|
if (isSynced === undefined || isSynced === true) {
|
|
404924
405384
|
this.off("sync", eventHandler);
|
|
404925
|
-
|
|
405385
|
+
resolve2();
|
|
404926
405386
|
}
|
|
404927
405387
|
};
|
|
404928
405388
|
this.on("sync", eventHandler);
|
|
@@ -407389,14 +407849,14 @@ function createSyncWaitQueue() {
|
|
|
407389
407849
|
let rejectWaiters = [];
|
|
407390
407850
|
return {
|
|
407391
407851
|
wait(timeoutMs, makeTimeoutError) {
|
|
407392
|
-
return new Promise((
|
|
407852
|
+
return new Promise((resolve2, reject2) => {
|
|
407393
407853
|
let settled = false;
|
|
407394
407854
|
const onResolve = () => {
|
|
407395
407855
|
if (settled)
|
|
407396
407856
|
return;
|
|
407397
407857
|
settled = true;
|
|
407398
407858
|
clearTimeout(timer);
|
|
407399
|
-
|
|
407859
|
+
resolve2();
|
|
407400
407860
|
};
|
|
407401
407861
|
const onReject = (error48) => {
|
|
407402
407862
|
if (settled)
|
|
@@ -407421,8 +407881,8 @@ function createSyncWaitQueue() {
|
|
|
407421
407881
|
const waiters = resolveWaiters;
|
|
407422
407882
|
resolveWaiters = [];
|
|
407423
407883
|
rejectWaiters = [];
|
|
407424
|
-
for (const
|
|
407425
|
-
|
|
407884
|
+
for (const resolve2 of waiters)
|
|
407885
|
+
resolve2();
|
|
407426
407886
|
},
|
|
407427
407887
|
rejectAll(error48) {
|
|
407428
407888
|
const waiters = rejectWaiters;
|
|
@@ -408020,7 +408480,7 @@ var require_src2 = __commonJS((exports) => {
|
|
|
408020
408480
|
};
|
|
408021
408481
|
}
|
|
408022
408482
|
async function sleep(delay) {
|
|
408023
|
-
return new Promise((
|
|
408483
|
+
return new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
408024
408484
|
}
|
|
408025
408485
|
exports.sleep = sleep;
|
|
408026
408486
|
function defaultCalculateDelay(context, options) {
|
|
@@ -408099,11 +408559,11 @@ var require_src2 = __commonJS((exports) => {
|
|
|
408099
408559
|
context.attemptsRemaining--;
|
|
408100
408560
|
}
|
|
408101
408561
|
if (options.timeout) {
|
|
408102
|
-
return new Promise((
|
|
408562
|
+
return new Promise((resolve2, reject2) => {
|
|
408103
408563
|
const timer = setTimeout(() => {
|
|
408104
408564
|
if (options.handleTimeout) {
|
|
408105
408565
|
try {
|
|
408106
|
-
|
|
408566
|
+
resolve2(options.handleTimeout(context, options));
|
|
408107
408567
|
} catch (e) {
|
|
408108
408568
|
reject2(e);
|
|
408109
408569
|
}
|
|
@@ -408115,10 +408575,10 @@ var require_src2 = __commonJS((exports) => {
|
|
|
408115
408575
|
}, options.timeout);
|
|
408116
408576
|
attemptFunc(context, options).then((result) => {
|
|
408117
408577
|
clearTimeout(timer);
|
|
408118
|
-
|
|
408578
|
+
resolve2(result);
|
|
408119
408579
|
}).catch((err2) => {
|
|
408120
408580
|
clearTimeout(timer);
|
|
408121
|
-
onError(err2).then(
|
|
408581
|
+
onError(err2).then(resolve2).catch(reject2);
|
|
408122
408582
|
});
|
|
408123
408583
|
});
|
|
408124
408584
|
} else {
|
|
@@ -409130,7 +409590,7 @@ var init_hocuspocus_provider_esm = __esm(() => {
|
|
|
409130
409590
|
this.webSocket = null;
|
|
409131
409591
|
}
|
|
409132
409592
|
createWebSocketConnection() {
|
|
409133
|
-
return new Promise((
|
|
409593
|
+
return new Promise((resolve2, reject2) => {
|
|
409134
409594
|
if (this.webSocket) {
|
|
409135
409595
|
this.messageQueue = [];
|
|
409136
409596
|
this.cleanupWebSocket();
|
|
@@ -409145,7 +409605,7 @@ var init_hocuspocus_provider_esm = __esm(() => {
|
|
|
409145
409605
|
this.status = WebSocketStatus.Connecting;
|
|
409146
409606
|
this.emit("status", { status: WebSocketStatus.Connecting });
|
|
409147
409607
|
this.connectionAttempt = {
|
|
409148
|
-
resolve,
|
|
409608
|
+
resolve: resolve2,
|
|
409149
409609
|
reject: reject2
|
|
409150
409610
|
};
|
|
409151
409611
|
});
|
|
@@ -410347,17 +410807,17 @@ async function autoRetry(promiseFn, maxTries, backoff, shouldStopRetrying = DONT
|
|
|
410347
410807
|
}
|
|
410348
410808
|
}
|
|
410349
410809
|
function controlledPromise() {
|
|
410350
|
-
let
|
|
410810
|
+
let resolve2;
|
|
410351
410811
|
let reject2;
|
|
410352
410812
|
const promise3 = new Promise((res, rej) => {
|
|
410353
|
-
|
|
410813
|
+
resolve2 = res;
|
|
410354
410814
|
reject2 = rej;
|
|
410355
410815
|
});
|
|
410356
|
-
return [promise3,
|
|
410816
|
+
return [promise3, resolve2, reject2];
|
|
410357
410817
|
}
|
|
410358
410818
|
function Promise_withResolvers() {
|
|
410359
|
-
const [promise3,
|
|
410360
|
-
return { promise: promise3, resolve, reject: reject2 };
|
|
410819
|
+
const [promise3, resolve2, reject2] = controlledPromise();
|
|
410820
|
+
return { promise: promise3, resolve: resolve2, reject: reject2 };
|
|
410361
410821
|
}
|
|
410362
410822
|
function replacer(_key, value2) {
|
|
410363
410823
|
return value2 !== null && typeof value2 === "object" && !Array.isArray(value2) ? Object.keys(value2).sort().reduce((sorted, key2) => {
|
|
@@ -411470,7 +411930,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
411470
411930
|
let socketOpenAt = null;
|
|
411471
411931
|
let capturedPrematureEvent = null;
|
|
411472
411932
|
let unconfirmedSocket = null;
|
|
411473
|
-
const connect$ = new Promise((
|
|
411933
|
+
const connect$ = new Promise((resolve2, rej) => {
|
|
411474
411934
|
if (ctx.authValue === null) {
|
|
411475
411935
|
throw new Error("No auth authValue");
|
|
411476
411936
|
}
|
|
@@ -411515,7 +411975,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
411515
411975
|
socket.removeEventListener("message", waitForActorId);
|
|
411516
411976
|
};
|
|
411517
411977
|
actor$.then(() => {
|
|
411518
|
-
|
|
411978
|
+
resolve2([socket, unsub]);
|
|
411519
411979
|
});
|
|
411520
411980
|
});
|
|
411521
411981
|
});
|
|
@@ -412312,13 +412772,13 @@ function createAi(config2) {
|
|
|
412312
412772
|
if (managedSocket.getStatus() !== "connected") {
|
|
412313
412773
|
await managedSocket.events.didConnect.waitUntil();
|
|
412314
412774
|
}
|
|
412315
|
-
const { promise: promise3, resolve, reject: reject2 } = Promise_withResolvers();
|
|
412775
|
+
const { promise: promise3, resolve: resolve2, reject: reject2 } = Promise_withResolvers();
|
|
412316
412776
|
const abortSignal = AbortSignal.timeout(DEFAULT_REQUEST_TIMEOUT);
|
|
412317
412777
|
abortSignal.addEventListener("abort", () => reject2(abortSignal.reason), {
|
|
412318
412778
|
once: true
|
|
412319
412779
|
});
|
|
412320
412780
|
const cmdId = nanoid3(7);
|
|
412321
|
-
context.pendingCmds.set(cmdId, { resolve, reject: reject2 });
|
|
412781
|
+
context.pendingCmds.set(cmdId, { resolve: resolve2, reject: reject2 });
|
|
412322
412782
|
sendClientMsg({ ...msg, cmdId });
|
|
412323
412783
|
return promise3.finally(() => {
|
|
412324
412784
|
context.pendingCmds.delete(cmdId);
|
|
@@ -414382,8 +414842,8 @@ function createRoom(options, config2) {
|
|
|
414382
414842
|
function startLoadingStorage() {
|
|
414383
414843
|
if (_getStorage$ === null) {
|
|
414384
414844
|
refreshStorage({ flush: true });
|
|
414385
|
-
_getStorage$ = new Promise((
|
|
414386
|
-
_resolveStoragePromise =
|
|
414845
|
+
_getStorage$ = new Promise((resolve2) => {
|
|
414846
|
+
_resolveStoragePromise = resolve2;
|
|
414387
414847
|
});
|
|
414388
414848
|
notifyStorageStatus();
|
|
414389
414849
|
}
|
|
@@ -414529,9 +414989,9 @@ function createRoom(options, config2) {
|
|
|
414529
414989
|
}
|
|
414530
414990
|
async function waitUntilPresenceReady() {
|
|
414531
414991
|
while (!isPresenceReady()) {
|
|
414532
|
-
const { promise: promise3, resolve } = Promise_withResolvers();
|
|
414533
|
-
const unsub1 = events.self.subscribeOnce(
|
|
414534
|
-
const unsub2 = events.status.subscribeOnce(
|
|
414992
|
+
const { promise: promise3, resolve: resolve2 } = Promise_withResolvers();
|
|
414993
|
+
const unsub1 = events.self.subscribeOnce(resolve2);
|
|
414994
|
+
const unsub2 = events.status.subscribeOnce(resolve2);
|
|
414535
414995
|
await promise3;
|
|
414536
414996
|
unsub1();
|
|
414537
414997
|
unsub2();
|
|
@@ -415322,9 +415782,9 @@ var __defProp2, __export2 = (target, all3) => {
|
|
|
415322
415782
|
promise;
|
|
415323
415783
|
constructor(input) {
|
|
415324
415784
|
this.input = input;
|
|
415325
|
-
const { promise: promise3, resolve, reject: reject2 } = Promise_withResolvers();
|
|
415785
|
+
const { promise: promise3, resolve: resolve2, reject: reject2 } = Promise_withResolvers();
|
|
415326
415786
|
this.promise = promise3;
|
|
415327
|
-
this.resolve =
|
|
415787
|
+
this.resolve = resolve2;
|
|
415328
415788
|
this.reject = reject2;
|
|
415329
415789
|
}
|
|
415330
415790
|
}, Batch = class {
|
|
@@ -419048,10 +419508,10 @@ var init_base64 = __esm(() => {
|
|
|
419048
419508
|
});
|
|
419049
419509
|
|
|
419050
419510
|
// ../../../v2/node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/indexeddb.js
|
|
419051
|
-
var rtop = (request) => create4((
|
|
419511
|
+
var rtop = (request) => create4((resolve2, reject2) => {
|
|
419052
419512
|
request.onerror = (event) => reject2(new Error(event.target.error));
|
|
419053
|
-
request.onsuccess = (event) =>
|
|
419054
|
-
}), openDB = (name, initDB) => create4((
|
|
419513
|
+
request.onsuccess = (event) => resolve2(event.target.result);
|
|
419514
|
+
}), openDB = (name, initDB) => create4((resolve2, reject2) => {
|
|
419055
419515
|
const request = indexedDB.open(name);
|
|
419056
419516
|
request.onupgradeneeded = (event) => initDB(event.target.result);
|
|
419057
419517
|
request.onerror = (event) => reject2(create3(event.target.error));
|
|
@@ -419060,7 +419520,7 @@ var rtop = (request) => create4((resolve, reject2) => {
|
|
|
419060
419520
|
db.onversionchange = () => {
|
|
419061
419521
|
db.close();
|
|
419062
419522
|
};
|
|
419063
|
-
|
|
419523
|
+
resolve2(db);
|
|
419064
419524
|
};
|
|
419065
419525
|
}), deleteDB = (name) => rtop(indexedDB.deleteDatabase(name)), createStores = (db, definitions) => definitions.forEach((d) => db.createObjectStore.apply(db, d)), transact2 = (db, stores, access = "readwrite") => {
|
|
419066
419526
|
const transaction = db.transaction(stores, access);
|
|
@@ -419071,12 +419531,12 @@ var rtop = (request) => create4((resolve, reject2) => {
|
|
|
419071
419531
|
first = key2;
|
|
419072
419532
|
return false;
|
|
419073
419533
|
}, direction).then(() => first);
|
|
419074
|
-
}, getLastKey = (store, range = null) => queryFirst(store, range, "prev"), iterateOnRequest = (request, f) => create4((
|
|
419534
|
+
}, getLastKey = (store, range = null) => queryFirst(store, range, "prev"), iterateOnRequest = (request, f) => create4((resolve2, reject2) => {
|
|
419075
419535
|
request.onerror = reject2;
|
|
419076
419536
|
request.onsuccess = async (event) => {
|
|
419077
419537
|
const cursor = event.target.result;
|
|
419078
419538
|
if (cursor === null || await f(cursor) === false) {
|
|
419079
|
-
return
|
|
419539
|
+
return resolve2();
|
|
419080
419540
|
}
|
|
419081
419541
|
cursor.continue();
|
|
419082
419542
|
};
|
|
@@ -419127,7 +419587,7 @@ var init_y_indexeddb = __esm(() => {
|
|
|
419127
419587
|
["updates", { autoIncrement: true }],
|
|
419128
419588
|
["custom"]
|
|
419129
419589
|
]));
|
|
419130
|
-
this.whenSynced = create4((
|
|
419590
|
+
this.whenSynced = create4((resolve2) => this.on("synced", () => resolve2(this)));
|
|
419131
419591
|
this._db.then((db) => {
|
|
419132
419592
|
this.db = db;
|
|
419133
419593
|
const beforeApplyUpdatesCallback = (updatesStore) => addAutoKey(updatesStore, encodeStateAsUpdate(doc2));
|
|
@@ -422235,8 +422695,8 @@ function pickLeader(claims, selfClaimerId, selfSha256, diagnostics) {
|
|
|
422235
422695
|
}
|
|
422236
422696
|
return activeClaims[0].claimerId;
|
|
422237
422697
|
}
|
|
422238
|
-
var DEFAULT_SETTLING_RESOLVER = () => new Promise((
|
|
422239
|
-
queueMicrotask(
|
|
422698
|
+
var DEFAULT_SETTLING_RESOLVER = () => new Promise((resolve2) => {
|
|
422699
|
+
queueMicrotask(resolve2);
|
|
422240
422700
|
});
|
|
422241
422701
|
var init_bootstrap = __esm(() => {
|
|
422242
422702
|
init_yjs();
|
|
@@ -423372,24 +423832,24 @@ function readDirectPPrChildren(pPrXml) {
|
|
|
423372
423832
|
function scanNextElement(body, cursor) {
|
|
423373
423833
|
let scanCursor = cursor;
|
|
423374
423834
|
while (scanCursor < body.length) {
|
|
423375
|
-
const
|
|
423376
|
-
if (
|
|
423835
|
+
const open2 = body.indexOf("<", scanCursor);
|
|
423836
|
+
if (open2 < 0)
|
|
423377
423837
|
return null;
|
|
423378
|
-
const node4 = readXmlNodeAt(body,
|
|
423838
|
+
const node4 = readXmlNodeAt(body, open2);
|
|
423379
423839
|
if (!node4)
|
|
423380
423840
|
return null;
|
|
423381
423841
|
if (node4.kind === "markup") {
|
|
423382
423842
|
scanCursor = node4.end;
|
|
423383
423843
|
continue;
|
|
423384
423844
|
}
|
|
423385
|
-
const openTag = body.slice(
|
|
423845
|
+
const openTag = body.slice(open2, node4.openEnd);
|
|
423386
423846
|
const openTagInner = openTag.slice(1, openTag.endsWith("/>") ? -2 : -1).trimEnd();
|
|
423387
423847
|
return {
|
|
423388
|
-
start:
|
|
423848
|
+
start: open2,
|
|
423389
423849
|
end: node4.end,
|
|
423390
423850
|
openTag,
|
|
423391
423851
|
openTagInner,
|
|
423392
|
-
xml: body.slice(
|
|
423852
|
+
xml: body.slice(open2, node4.end)
|
|
423393
423853
|
};
|
|
423394
423854
|
}
|
|
423395
423855
|
return null;
|
|
@@ -423686,18 +424146,18 @@ function namespaceBindingsForElement(openTagInner, inheritedNamespaceBindings) {
|
|
|
423686
424146
|
return bindings;
|
|
423687
424147
|
}
|
|
423688
424148
|
function stripTextTag(text4) {
|
|
423689
|
-
const
|
|
424149
|
+
const open2 = text4.indexOf(">");
|
|
423690
424150
|
const close = text4.lastIndexOf("<");
|
|
423691
|
-
if (
|
|
424151
|
+
if (open2 < 0 || close < 0 || close <= open2)
|
|
423692
424152
|
return "";
|
|
423693
|
-
return text4.slice(
|
|
424153
|
+
return text4.slice(open2 + 1, close);
|
|
423694
424154
|
}
|
|
423695
424155
|
function stripOuterTag(xml) {
|
|
423696
|
-
const
|
|
424156
|
+
const open2 = xml.indexOf(">");
|
|
423697
424157
|
const close = xml.lastIndexOf("<");
|
|
423698
|
-
if (
|
|
424158
|
+
if (open2 < 0 || close < 0 || close <= open2)
|
|
423699
424159
|
return "";
|
|
423700
|
-
return xml.slice(
|
|
424160
|
+
return xml.slice(open2 + 1, close);
|
|
423701
424161
|
}
|
|
423702
424162
|
function hasNonNamespaceAttributes(openTagInner) {
|
|
423703
424163
|
const attrSource = openTagInner.replace(/^[^\s/>]+/, "");
|
|
@@ -431214,7 +431674,7 @@ async function waitForJournalSettled(rootDoc, options) {
|
|
|
431214
431674
|
if (lastState.settled)
|
|
431215
431675
|
return lastState;
|
|
431216
431676
|
while (now3() < deadline) {
|
|
431217
|
-
await new Promise((
|
|
431677
|
+
await new Promise((resolve2) => setTimeout(resolve2, poll));
|
|
431218
431678
|
lastState = getJournalBarrierState(rootDoc, options);
|
|
431219
431679
|
if (lastState.settled)
|
|
431220
431680
|
return lastState;
|
|
@@ -437118,16 +437578,16 @@ function collectLiveTrackedWrapperSpans(atoms) {
|
|
|
437118
437578
|
}
|
|
437119
437579
|
if (openIndex < 0)
|
|
437120
437580
|
continue;
|
|
437121
|
-
const [
|
|
437581
|
+
const [open2] = openStack.splice(openIndex, 1);
|
|
437122
437582
|
spans.push({
|
|
437123
|
-
key:
|
|
437583
|
+
key: open2.key,
|
|
437124
437584
|
kind: info.kind,
|
|
437125
|
-
rsid:
|
|
437126
|
-
openAtom:
|
|
437585
|
+
rsid: open2.rsid,
|
|
437586
|
+
openAtom: open2.atom,
|
|
437127
437587
|
closeAtom: atom,
|
|
437128
|
-
startOffset:
|
|
437588
|
+
startOffset: open2.startOffset,
|
|
437129
437589
|
endOffset: atom.visibleOffset,
|
|
437130
|
-
sameKindParentKey:
|
|
437590
|
+
sameKindParentKey: open2.sameKindParentKey
|
|
437131
437591
|
});
|
|
437132
437592
|
}
|
|
437133
437593
|
return spans;
|
|
@@ -449266,11 +449726,11 @@ function contentTypeForPackagePart(partUri) {
|
|
|
449266
449726
|
}
|
|
449267
449727
|
function innerXmlOfRoot(xml) {
|
|
449268
449728
|
const withoutDecl = xml.replace(/^\s*<\?xml[^>]*>\s*/i, "");
|
|
449269
|
-
const
|
|
449729
|
+
const open2 = /^<[^>]+>/.exec(withoutDecl);
|
|
449270
449730
|
const close = /<\/[^>]+>\s*$/.exec(withoutDecl);
|
|
449271
|
-
if (!
|
|
449731
|
+
if (!open2 || !close || close.index <= open2[0].length)
|
|
449272
449732
|
return withoutDecl;
|
|
449273
|
-
return withoutDecl.slice(
|
|
449733
|
+
return withoutDecl.slice(open2[0].length, close.index);
|
|
449274
449734
|
}
|
|
449275
449735
|
function attrLocal4(tag, localName3) {
|
|
449276
449736
|
const re = new RegExp(String.raw`(?:[\w.-]+:)?${localName3}="([^"]+)"`);
|
|
@@ -450592,7 +451052,7 @@ async function applyPreparedRoomReplacement(input) {
|
|
|
450592
451052
|
while (replacementQueue(input.rootDoc, input.replacement.operationId)[0]?.operationId !== input.replacement.operationId) {
|
|
450593
451053
|
await Promise.all([waitForReplacementQueueChange(input.rootDoc), input.resync()]);
|
|
450594
451054
|
}
|
|
450595
|
-
await new Promise((
|
|
451055
|
+
await new Promise((resolve2) => setTimeout(resolve2, input.settlingMs));
|
|
450596
451056
|
await input.resync();
|
|
450597
451057
|
if (replacementQueue(input.rootDoc, input.replacement.operationId)[0]?.operationId !== input.replacement.operationId) {
|
|
450598
451058
|
return applyPreparedRoomReplacement(input);
|
|
@@ -450760,12 +451220,12 @@ function replacementRequestKey(operationId) {
|
|
|
450760
451220
|
}
|
|
450761
451221
|
async function waitForReplacementQueueChange(rootDoc) {
|
|
450762
451222
|
const requests = getReplacementRequests(rootDoc);
|
|
450763
|
-
await new Promise((
|
|
451223
|
+
await new Promise((resolve2) => {
|
|
450764
451224
|
const timeout = setTimeout(finish, POST_SYNC_QUIET_WINDOW_MS);
|
|
450765
451225
|
function finish() {
|
|
450766
451226
|
clearTimeout(timeout);
|
|
450767
451227
|
requests.unobserveDeep(finish);
|
|
450768
|
-
|
|
451228
|
+
resolve2();
|
|
450769
451229
|
}
|
|
450770
451230
|
requests.observeDeep(finish);
|
|
450771
451231
|
});
|
|
@@ -451294,13 +451754,13 @@ async function waitForStoryShardSeeded(rootDoc, shardId) {
|
|
|
451294
451754
|
await waitForDocUpdateSettling(rootDoc);
|
|
451295
451755
|
return;
|
|
451296
451756
|
}
|
|
451297
|
-
await new Promise((
|
|
451757
|
+
await new Promise((resolve2) => setTimeout(resolve2, 10));
|
|
451298
451758
|
}
|
|
451299
451759
|
throw new Error(`collaboration story shard ${shardId} was not seeded by the room authority`);
|
|
451300
451760
|
}
|
|
451301
451761
|
async function waitForDocUpdateSettling(doc2, maxWaitMs = POST_SYNC_SETTLE_MAX_MS) {
|
|
451302
451762
|
const boundedMaxWaitMs = normalizeBootstrapSettlingMs(maxWaitMs);
|
|
451303
|
-
await new Promise((
|
|
451763
|
+
await new Promise((resolve2) => {
|
|
451304
451764
|
let settled = false;
|
|
451305
451765
|
let quietTimer = null;
|
|
451306
451766
|
const hardTimeout = setTimeout(finish, boundedMaxWaitMs);
|
|
@@ -451312,7 +451772,7 @@ async function waitForDocUpdateSettling(doc2, maxWaitMs = POST_SYNC_SETTLE_MAX_M
|
|
|
451312
451772
|
if (quietTimer)
|
|
451313
451773
|
clearTimeout(quietTimer);
|
|
451314
451774
|
doc2.off("update", onUpdate);
|
|
451315
|
-
|
|
451775
|
+
resolve2();
|
|
451316
451776
|
}
|
|
451317
451777
|
function armQuietWindow() {
|
|
451318
451778
|
if (quietTimer)
|
|
@@ -452476,7 +452936,7 @@ var init_dist10 = __esm(() => {
|
|
|
452476
452936
|
// src/session-manager.ts
|
|
452477
452937
|
import { access, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
452478
452938
|
import { randomBytes } from "node:crypto";
|
|
452479
|
-
import { dirname, resolve, basename } from "node:path";
|
|
452939
|
+
import { dirname, resolve as resolve2, basename } from "node:path";
|
|
452480
452940
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
452481
452941
|
|
|
452482
452942
|
class SessionManager {
|
|
@@ -452486,7 +452946,7 @@ class SessionManager {
|
|
|
452486
452946
|
this.author = author;
|
|
452487
452947
|
}
|
|
452488
452948
|
async open(filePath) {
|
|
452489
|
-
const absolutePath =
|
|
452949
|
+
const absolutePath = resolve2(filePath);
|
|
452490
452950
|
const bytes = await readDocumentBytesOrBlank(absolutePath);
|
|
452491
452951
|
const { openV2DocumentApiHost: openV2DocumentApiHost2 } = await loadV2HeadlessRuntime();
|
|
452492
452952
|
const host = await openV2DocumentApiHost2({
|
|
@@ -452516,7 +452976,7 @@ class SessionManager {
|
|
|
452516
452976
|
}
|
|
452517
452977
|
async save(sessionId, outputPath) {
|
|
452518
452978
|
const session = this.get(sessionId);
|
|
452519
|
-
const targetPath = outputPath ?
|
|
452979
|
+
const targetPath = outputPath ? resolve2(outputPath) : session.filePath;
|
|
452520
452980
|
const { saveDocumentSessionWithDiagnostics: saveDocumentSessionWithDiagnostics2 } = await loadV2HeadlessRuntime();
|
|
452521
452981
|
const exported = saveDocumentSessionWithDiagnostics2(session.host.session);
|
|
452522
452982
|
await writeFile2(targetPath, exported.bytes);
|
|
@@ -452549,7 +453009,7 @@ async function readDocumentBytesOrBlank(absolutePath) {
|
|
|
452549
453009
|
const bytes = await readFile3(absolutePath);
|
|
452550
453010
|
return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
452551
453011
|
} catch {
|
|
452552
|
-
const blankPath =
|
|
453012
|
+
const blankPath = resolve2(MODULE_DIR3, "../../../shared/common/data/blank.docx");
|
|
452553
453013
|
const bytes = await readFile3(blankPath);
|
|
452554
453014
|
return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
452555
453015
|
}
|