@superdoc/mcp 1.6.0-next.13 → 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.
Files changed (2) hide show
  1. package/dist/index.js +685 -528
  2. package/package.json +2 -2
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/document-rpc.ts
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 : randomUUID();
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 new Promise((resolve) => {
30887
- const timer = setTimeout(() => {
30888
- child.kill("SIGKILL");
30889
- resolve();
30890
- }, this.shutdownTimeoutMs);
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((resolve, reject) => {
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.removeAllListeners();
31416
- child.kill("SIGKILL");
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.13";
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
- mkdir(dir, { recursive: true }).then(() => appendFile(file2, payload, "utf8")).catch(() => {});
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 mkdtemp(join(tmpdir(), "superdoc-sdk-replace-"));
31735
- const stagedPath = join(stagingDirectory, "replacement.docx");
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 rm(stagingDirectory, { recursive: true, force: true });
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 rm2 = normalizeMarks(r.marks);
91223
- runs.push(rm2 ? { text: r.text, marks: rm2 } : { text: r.text });
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((resolve) => {
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
- resolve();
122247
+ resolve2();
122091
122248
  }, 0);
122092
122249
  return;
122093
122250
  }
122094
- setImmediateFn(() => resolve());
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((resolve) => {
122115
- pending.push(resolve);
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((resolve) => {
122130
- sched.postTask(() => resolve(), { priority: "background" });
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((resolve) => {
122140
- setTimeout(() => resolve(), 0);
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 open = elementStack.pop();
124831
- if (!open || open.prefix !== tag.prefix || open.localName !== tag.localName)
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 (open.start !== start)
124992
+ if (open2.start !== start)
124836
124993
  continue;
124837
- if (open.namespaceUri !== namespaceUri || open.localName !== localName)
124994
+ if (open2.namespaceUri !== namespaceUri || open2.localName !== localName)
124838
124995
  return null;
124839
124996
  return {
124840
- start: open.start,
124841
- openEnd: open.openEnd,
124997
+ start: open2.start,
124998
+ openEnd: open2.openEnd,
124842
124999
  closeStart: tagStart,
124843
125000
  end: tagEnd,
124844
- prefix: open.prefix,
124845
- localName: open.localName,
124846
- namespaceUri: open.namespaceUri,
124847
- namespaceBindings: open.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 open = stack.pop();
124977
- if (!open)
125133
+ const open2 = stack.pop();
125134
+ if (!open2)
124978
125135
  return;
124979
125136
  ranges.push({
124980
- ...open,
124981
- openEnd: open.end,
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 open = openRe.exec(xml);
132664
- if (!open)
132820
+ const open2 = openRe.exec(xml);
132821
+ if (!open2)
132665
132822
  return "";
132666
- if (open[2] === "/")
132667
- return open[0];
132668
- const qname = escapeRegExp2(open[1]);
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 open = openRe.exec(xml);
132689
- if (!open)
132845
+ const open2 = openRe.exec(xml);
132846
+ if (!open2)
132690
132847
  return null;
132691
- const slice = matchLeadingElement(xml.slice(open.index), localName2);
132848
+ const slice = matchLeadingElement(xml.slice(open2.index), localName2);
132692
132849
  if (!slice)
132693
132850
  return null;
132694
- return { start: open.index, end: open.index + slice.length, xml: slice };
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 open = new Set;
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 (open.has(family))
135214
+ if (open2.has(family))
135058
135215
  return false;
135059
- open.add(family);
135216
+ open2.add(family);
135060
135217
  } else {
135061
- if (!open.delete(family))
135218
+ if (!open2.delete(family))
135062
135219
  return false;
135063
135220
  }
135064
135221
  }
135065
- return open.size === 0;
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 open = /^<([A-Za-z_][\w.-]*(?::[A-Za-z_][\w.-]*)?)/.exec(rawTag);
136222
- if (!open)
136378
+ const open2 = /^<([A-Za-z_][\w.-]*(?::[A-Za-z_][\w.-]*)?)/.exec(rawTag);
136379
+ if (!open2)
136223
136380
  return null;
136224
- const qname = open[1];
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 = open[0].length;
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 open = openParagraphs.at(-1);
136485
- if (open && open.depth === depth && tag.uri === W_NS2 && tag.local === "p") {
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: open.start,
136644
+ start: open2.start,
136488
136645
  end: parser.position,
136489
- paraId: open.paraId,
136490
- namespaceBindings: open.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 open = XML_TAG_RE2.exec(paragraphXml);
136719
+ const open2 = XML_TAG_RE2.exec(paragraphXml);
136563
136720
  const closeStart = paragraphXml.lastIndexOf("</");
136564
- if (!open || closeStart <= XML_TAG_RE2.lastIndex)
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 open = stack[i];
142067
- if (open.localName !== localName2 || open.prefix !== prefix)
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 (open.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(open.openEnd, tag.start).trim() === "") {
142073
- emptyRowRevisionEnds.set(open.start, tag.end);
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 (open.wordTrackedMarkup)
142232
+ if (open2.wordTrackedMarkup)
142076
142233
  wordTrackedMarkupTagStarts.add(tag.start);
142077
142234
  entries.push({
142078
142235
  localName: localName2,
142079
- namespaceUri: open.namespaceBindings[open.prefix],
142080
- namespaceBindings: open.namespaceBindings,
142081
- start: open.start,
142082
- openEnd: open.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 (open.moveRangeMarker && isEmptyMoveMarkerContent(xml.slice(open.moveRangeMarker.contentStart, tag.start))) {
142087
- recordMoveRangeMarker(open.moveRangeMarker, tag.end);
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((resolve, reject) => {
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
- resolve(outcome.value);
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 = (open, endChar, endByte) => {
145167
- byOrdinal[open.ordinal] = { ...open, endChar, endByte };
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 open2 = stack.pop();
145214
- if (open2)
145215
- emit(open2, gtIdx + 1, tagEndByte);
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 open = {
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(open, gtIdx + 1, tagEndByte);
145391
+ emit(open2, gtIdx + 1, tagEndByte);
145235
145392
  } else {
145236
- stack.push(open);
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, resolve) {
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, resolve, "f");
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 open = { qkey: qnameKey(ns, local), namespaceUri: ns, localName: local, byteStart: startByte, byteEnd: -1 };
147435
- stack.push(open);
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((resolve) => {
154280
+ return new Promise((resolve2) => {
154124
154281
  const requestAnimationFrameFn = globalThis.requestAnimationFrame;
154125
154282
  if (typeof requestAnimationFrameFn === "function") {
154126
- requestAnimationFrameFn(() => resolve());
154283
+ requestAnimationFrameFn(() => resolve2());
154127
154284
  return;
154128
154285
  }
154129
- setTimeout(resolve, 0);
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(open) {
155002
+ function evaluatePackageInvariants(open2) {
154846
155003
  const hard = [];
154847
155004
  const soft = [];
154848
- const pkg = open.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((resolve) => {
157899
- waiters.push(resolve);
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((resolve) => {
161248
- const handle = globalThis.setTimeout(() => resolve("timeout"), DISPOSE_TIMEOUT_MS);
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 open = {
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(open);
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: open.storyChildOrdinal,
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
- open.isPPr = true;
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 open = /<([\w.-]+):pPrChange\b[^>]*?(\/?)>/.exec(pPrXml);
164989
- if (!open)
165145
+ const open2 = /<([\w.-]+):pPrChange\b[^>]*?(\/?)>/.exec(pPrXml);
165146
+ if (!open2)
164990
165147
  return pPrXml;
164991
165148
  let end;
164992
- if (open[2] === "/") {
164993
- end = open.index + open[0].length;
165149
+ if (open2[2] === "/") {
165150
+ end = open2.index + open2[0].length;
164994
165151
  } else {
164995
- const close = pPrXml.indexOf(`</${open[1]}:pPrChange>`, open.index + open[0].length);
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 + `</${open[1]}:pPrChange>`.length;
165155
+ end = close + `</${open2[1]}:pPrChange>`.length;
164999
165156
  }
165000
- const stripped = pPrXml.slice(0, open.index) + pPrXml.slice(end);
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 open = /<((?:[\w.-]+:)?numbering)\b[^>]*>/.exec(xml);
168037
- if (!open)
168193
+ const open2 = /<((?:[\w.-]+:)?numbering)\b[^>]*>/.exec(xml);
168194
+ if (!open2)
168038
168195
  return false;
168039
- const qname = open[1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
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 open = /^<[\w.-]+:p\b[^>]*>\s*/.exec(paragraphXml);
171671
- if (!open)
171827
+ const open2 = /^<[\w.-]+:p\b[^>]*>\s*/.exec(paragraphXml);
171828
+ if (!open2)
171672
171829
  return null;
171673
- const start = open[0].length;
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 open = stack.pop();
172749
- if (!open || open.localName !== localName2)
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 open = [];
175874
+ const open2 = [];
175718
175875
  for (const entry of entries) {
175719
- while (open.length > 0 && open[open.length - 1].fragment.byteEnd <= entry.fragment.byteStart) {
175720
- open.pop();
175876
+ while (open2.length > 0 && open2[open2.length - 1].fragment.byteEnd <= entry.fragment.byteStart) {
175877
+ open2.pop();
175721
175878
  }
175722
- const candidate2 = open[open.length - 1] ?? null;
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
- open.push(entry);
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 open = stack.pop();
177711
- if (!open || open.start === 0 && event.end === xml.length)
177867
+ const open2 = stack.pop();
177868
+ if (!open2 || open2.start === 0 && event.end === xml.length)
177712
177869
  return;
177713
- ranges.push({ start: open.start, end: event.end });
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 open = partXml.lastIndexOf("<", found);
178077
- if (open >= 0 && /^<[\w.-]+:p$/.test(partXml.slice(open, found + 2))) {
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 open;
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 open = stack.pop();
178543
- if (!open)
178699
+ const open2 = stack.pop();
178700
+ if (!open2)
178544
178701
  continue;
178545
- if (open.start === 0 && byteEnd === xml.length)
178702
+ if (open2.start === 0 && byteEnd === xml.length)
178546
178703
  continue;
178547
- ranges.push({ start: open.start, end: byteEnd });
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 open = xml.slice(range.start, range.openEnd);
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(open, "Type") === RELATIONSHIP_TYPE_FOR_KIND[kind] && readXmlAttributeValueByLocalName(open, "Target") === `${kind}.xml`) && !!readXmlAttributeValueByLocalName(open, "Id") && readXmlAttributeValueByLocalName(open, "TargetMode") == null;
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(open, "PartName") === `/word/${kind}.xml` && readXmlAttributeValueByLocalName(open, "ContentType") === CONTENT_TYPE_FOR_KIND[kind]);
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 open = new Set;
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 (open.has(key2))
182052
+ if (open2.has(key2))
181896
182053
  return false;
181897
- open.add(key2);
181898
- } else if (!open.delete(key2)) {
182054
+ open2.add(key2);
182055
+ } else if (!open2.delete(key2)) {
181899
182056
  return false;
181900
182057
  }
181901
182058
  }
181902
- if (open.size > 0)
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 open = DRAWING_OPEN_RE.exec(xml);
181917
- while (open) {
182073
+ let open2 = DRAWING_OPEN_RE.exec(xml);
182074
+ while (open2) {
181918
182075
  let depth = 1;
181919
- let cursor = open.index + open[0].length;
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(open.index, end));
182095
+ segments.push(xml.slice(open2.index, end));
181939
182096
  DRAWING_OPEN_RE.lastIndex = end;
181940
- open = DRAWING_OPEN_RE.exec(xml);
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 [open, close] of [["<!--", "-->"], ["<![CDATA[", "]]>"], ["<?", "?>"]]) {
193092
- if (prior.lastIndexOf(open, nodeStart) > prior.lastIndexOf(close, nodeStart))
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 open = /^<(?:[\w.-]+:)?pPr\b[^>]*>/.exec(pPrXml)?.[0];
193831
- if (!open)
193987
+ const open2 = /^<(?:[\w.-]+:)?pPr\b[^>]*>/.exec(pPrXml)?.[0];
193988
+ if (!open2)
193832
193989
  return pPrXml;
193833
- const inner = pPrXml.slice(open.length);
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 open + inner.slice(0, rPrOffset) + expanded + inner.slice(rPrOffset + rPr.length);
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 open + inner.slice(0, rPrOffset) + rPr.slice(0, insertAt2) + marker(xmlPrefix(rPrName) ?? pPrPrefix) + rPr.slice(insertAt2) + inner.slice(rPrOffset + rPr.length);
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 open + inner.slice(0, insertAt) + `<${pPrRPrName}>${marker(pPrPrefix)}</${pPrRPrName}>` + inner.slice(insertAt);
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)
@@ -202856,12 +203013,12 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
202856
203013
  if (!closeMatch)
202857
203014
  return fail4("invalid-range");
202858
203015
  const inner = without.slice(childRe.lastIndex, closeMatch.index);
202859
- const open = without.slice(m.index, childRe.lastIndex);
203016
+ const open2 = without.slice(m.index, childRe.lastIndex);
202860
203017
  const attrs = m[3];
202861
203018
  tMatch = {
202862
- open,
203019
+ open: open2,
202863
203020
  close: closeMatch[0],
202864
- xml: open + inner + closeMatch[0],
203021
+ xml: open2 + inner + closeMatch[0],
202865
203022
  attrs,
202866
203023
  inner
202867
203024
  };
@@ -203770,9 +203927,9 @@ function parseEmptyParagraphInsertionSite(paragraphXml, options = {}) {
203770
203927
  const ns = openTagMatch[1];
203771
203928
  if (closeTagMatch[1] !== ns)
203772
203929
  return null;
203773
- const open = openTagMatch[0];
203930
+ const open2 = openTagMatch[0];
203774
203931
  const close = closeTagMatch[0];
203775
- const inner = paragraphXml.slice(open.length, paragraphXml.length - close.length);
203932
+ const inner = paragraphXml.slice(open2.length, paragraphXml.length - close.length);
203776
203933
  let insertionPoint = 0;
203777
203934
  while (insertionPoint < inner.length && /\s/.test(inner[insertionPoint]))
203778
203935
  insertionPoint += 1;
@@ -203789,7 +203946,7 @@ function parseEmptyParagraphInsertionSite(paragraphXml, options = {}) {
203789
203946
  if (visibleTextLength(remaining) !== 0)
203790
203947
  return null;
203791
203948
  if (options.contentInsertionCharOffset != null) {
203792
- const relativeOffset = options.contentInsertionCharOffset - open.length;
203949
+ const relativeOffset = options.contentInsertionCharOffset - open2.length;
203793
203950
  if (relativeOffset < insertionPoint || relativeOffset > inner.length)
203794
203951
  return null;
203795
203952
  insertionPoint = relativeOffset;
@@ -203798,7 +203955,7 @@ function parseEmptyParagraphInsertionSite(paragraphXml, options = {}) {
203798
203955
  }
203799
203956
  }
203800
203957
  return {
203801
- open,
203958
+ open: open2,
203802
203959
  prefix: inner.slice(0, insertionPoint),
203803
203960
  suffix: inner.slice(insertionPoint),
203804
203961
  close,
@@ -204695,21 +204852,21 @@ function inspectHyperlinkRange(pieces, rangeStart, rangeEnd) {
204695
204852
  return { found, overlaps: false };
204696
204853
  }
204697
204854
  function parseSimpleTextRunForRange(runXml, xmlStart, textStart) {
204698
- const open = /^<([\w.-]+):r\b[^>]*>/.exec(runXml);
204699
- if (!open)
204855
+ const open2 = /^<([\w.-]+):r\b[^>]*>/.exec(runXml);
204856
+ if (!open2)
204700
204857
  return null;
204701
- const runCloseTag = `</${open[1]}:r>`;
204858
+ const runCloseTag = `</${open2[1]}:r>`;
204702
204859
  if (!runXml.endsWith(runCloseTag))
204703
204860
  return null;
204704
- const inner = runXml.slice(open[0].length, -runCloseTag.length);
204861
+ const inner = runXml.slice(open2[0].length, -runCloseTag.length);
204705
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);
204706
204863
  if (!textOnly)
204707
204864
  return null;
204708
204865
  const textElements = parseRawTextElements(textOnly[2] ?? "");
204709
204866
  const length = textElements.reduce((total, element) => total + visibleLengthOfRawXmlText(element.rawText), 0);
204710
204867
  return {
204711
- prefix: open[1],
204712
- runOpenTag: open[0],
204868
+ prefix: open2[1],
204869
+ runOpenTag: open2[0],
204713
204870
  runCloseTag,
204714
204871
  rPrXml: textOnly[1] ?? "",
204715
204872
  textElements,
@@ -205883,9 +206040,9 @@ function restoreParagraphMarkFormattingSnapshot(beforeXml, liveXml, namespaceBin
205883
206040
  inner = inner.slice(0, marker.start - before.root.openEnd) + inner.slice(marker.end - before.root.openEnd);
205884
206041
  }
205885
206042
  const liveMarkers = live.markers.map((marker) => liveXml.slice(marker.start, marker.end)).join("");
205886
- const open = beforeXml.slice(0, before.root.openEnd).replace(/\s*\/>$/, ">");
206043
+ const open2 = beforeXml.slice(0, before.root.openEnd).replace(/\s*\/>$/, ">");
205887
206044
  const prefix = before.root.tag.prefix ? `${before.root.tag.prefix}:` : "";
205888
- return `${open}${liveMarkers}${inner}</${prefix}rPr>`;
206045
+ return `${open2}${liveMarkers}${inner}</${prefix}rPr>`;
205889
206046
  }
205890
206047
  var WORD = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", STRUCTURAL_MARKERS;
205891
206048
  var init_paragraph_mark_format_history = __esm(() => {
@@ -206037,8 +206194,8 @@ function prepareTrackedParagraphProperties(input) {
206037
206194
  if (!change)
206038
206195
  return null;
206039
206196
  if (!after.mark || after.mark.tag.isSelfClosing) {
206040
- const open = after.mark ? after.markXml.replace(/\/>$/, ">") : `<${prefix}:rPr>`;
206041
- mark = open + change + `</${after.mark?.tag.name ?? `${prefix}:rPr`}>`;
206197
+ const open2 = after.mark ? after.markXml.replace(/\/>$/, ">") : `<${prefix}:rPr>`;
206198
+ mark = open2 + change + `</${after.mark?.tag.name ?? `${prefix}:rPr`}>`;
206042
206199
  } else {
206043
206200
  const at = after.mark.closeStart - after.mark.start;
206044
206201
  mark = after.markXml.slice(0, at) + change + after.markXml.slice(at);
@@ -206225,12 +206382,12 @@ function validatePrevalidatedTrackedWrapperSpan(xml, fragment3, span, namespaceB
206225
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) {
206226
206383
  return null;
206227
206384
  }
206228
- const open = parseRawXmlElementTag(xml.slice(start, openEnd));
206385
+ const open2 = parseRawXmlElementTag(xml.slice(start, openEnd));
206229
206386
  const close = parseRawXmlElementTag(xml.slice(closeStart, end));
206230
- if (!open || !close || open.isClose || open.selfClose || !close.isClose || close.selfClose || open.prefix !== close.prefix || open.localName !== fragment3.kind || close.localName !== fragment3.kind) {
206387
+ if (!open2 || !close || open2.isClose || open2.selfClose || !close.isClose || close.selfClose || open2.prefix !== close.prefix || open2.localName !== fragment3.kind || close.localName !== fragment3.kind) {
206231
206388
  return null;
206232
206389
  }
206233
- return { ...span, prefix: open.prefix, namespaceBindings: { [open.prefix]: NS_W4, ...namespaceBindings } };
206390
+ return { ...span, prefix: open2.prefix, namespaceBindings: { [open2.prefix]: NS_W4, ...namespaceBindings } };
206234
206391
  }
206235
206392
  function decodeXmlText7(escaped) {
206236
206393
  return escaped.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
@@ -206770,12 +206927,12 @@ function findNextParagraphElement(xml, fromIndex, allowInsertionWrapper, namespa
206770
206927
  while (cursor < xml.length && /\s/.test(xml[cursor] ?? ""))
206771
206928
  cursor += 1;
206772
206929
  }
206773
- const open = /<([\w.-]+):p\b[^>]*>/.exec(xml.slice(cursor));
206774
- if (!open || open.index !== 0)
206930
+ const open2 = /<([\w.-]+):p\b[^>]*>/.exec(xml.slice(cursor));
206931
+ if (!open2 || open2.index !== 0)
206775
206932
  return null;
206776
- const start = cursor + open.index;
206777
- const prefix = open[1];
206778
- const openTag = open[0];
206933
+ const start = cursor + open2.index;
206934
+ const prefix = open2[1];
206935
+ const openTag = open2[0];
206779
206936
  if (/\/>$/.test(openTag)) {
206780
206937
  return { start, end: start + openTag.length, xml: openTag, wrapper: null };
206781
206938
  }
@@ -207901,11 +208058,11 @@ function setRowGridAfter(lookupContext, rowXml, gridAfter, widthAfter) {
207901
208058
  if (!trPrRange) {
207902
208059
  if (!gridAfterXml)
207903
208060
  return rowXml;
207904
- const open = /^<([\w.-]+):tr\b[^>]*>/.exec(rowXml);
207905
- if (!open)
208061
+ const open2 = /^<([\w.-]+):tr\b[^>]*>/.exec(rowXml);
208062
+ if (!open2)
207906
208063
  return rowXml;
207907
- const insertAt = findDirectChildRanges(rowXml, "tblPrEx", lookupContext)[0]?.end ?? open[0].length;
207908
- return rowXml.slice(0, insertAt) + `<${open[1]}:trPr>${gridAfterXml}</${open[1]}:trPr>` + rowXml.slice(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);
207909
208066
  }
207910
208067
  const trPrXml = rowXml.slice(trPrRange.start, trPrRange.end);
207911
208068
  if (/^<[\w.-]+:trPr\b[^>]*\/>\s*$/.test(trPrXml)) {
@@ -208344,10 +208501,10 @@ function isCompleteParagraphWindow(paragraph) {
208344
208501
  return Number.isSafeInteger(paragraph.byteStart) && Number.isSafeInteger(paragraph.byteEnd) && paragraph.byteStart >= 0 && paragraph.byteEnd > paragraph.byteStart;
208345
208502
  }
208346
208503
  function isOneCompleteParagraph(xml) {
208347
- const open = /^<([\w.-]+):p\b[^>]*>/.exec(xml);
208348
- if (!open)
208504
+ const open2 = /^<([\w.-]+):p\b[^>]*>/.exec(xml);
208505
+ if (!open2)
208349
208506
  return false;
208350
- const close = `</${open[1]}:p>`;
208507
+ const close = `</${open2[1]}:p>`;
208351
208508
  return xml.endsWith(close) && xml.indexOf(close) === xml.length - close.length;
208352
208509
  }
208353
208510
  function resolveUniqueLocalFragment(xml, source) {
@@ -209067,10 +209224,10 @@ function normalizeShifts(candidates) {
209067
209224
  return out;
209068
209225
  }
209069
209226
  function ownerContainsTrackedHyperlink(xml, start, end) {
209070
- const open = xml.lastIndexOf(":hyperlink", start);
209071
- if (open < 0)
209227
+ const open2 = xml.lastIndexOf(":hyperlink", start);
209228
+ if (open2 < 0)
209072
209229
  return false;
209073
- const tagStart = xml.lastIndexOf("<", open);
209230
+ const tagStart = xml.lastIndexOf("<", open2);
209074
209231
  const close = xml.indexOf(":hyperlink>", end);
209075
209232
  return tagStart >= 0 && close >= end && xml[tagStart + 1] !== "/";
209076
209233
  }
@@ -209319,7 +209476,7 @@ function applyBibliographyReviewResourceCleanup(input) {
209319
209476
  styleName: readXmlAttribute(root.tag, "", "StyleName")?.value,
209320
209477
  version: readXmlAttribute(root.tag, "", "Version")?.value
209321
209478
  });
209322
- let open = xml.slice(root.start, root.openEnd);
209479
+ let open2 = xml.slice(root.start, root.openEnd);
209323
209480
  for (const [name, value] of [
209324
209481
  ["SelectedStyle", metadata2.selectedStyle],
209325
209482
  ["StyleName", metadata2.styleName],
@@ -209328,11 +209485,11 @@ function applyBibliographyReviewResourceCleanup(input) {
209328
209485
  const attribute = readXmlAttribute(root.tag, "", name);
209329
209486
  if (attribute) {
209330
209487
  const pattern = new RegExp(`(\\s${name}\\s*=\\s*)(["'])(.*?)\\2`, "s");
209331
- open = open.replace(pattern, (_match, prefix, quote) => `${prefix}${quote}${escapeXmlAttribute(value)}${quote}`);
209488
+ open2 = open2.replace(pattern, (_match, prefix, quote) => `${prefix}${quote}${escapeXmlAttribute(value)}${quote}`);
209332
209489
  } else
209333
- open = open.replace(/\s*(\/?)>$/, ` ${name}="${escapeXmlAttribute(value)}"$1>`);
209490
+ open2 = open2.replace(/\s*(\/?)>$/, ` ${name}="${escapeXmlAttribute(value)}"$1>`);
209334
209491
  }
209335
- const next = xml.slice(0, root.start) + open + xml.slice(root.openEnd);
209492
+ const next = xml.slice(0, root.start) + open2 + xml.slice(root.openEnd);
209336
209493
  if (next !== xml)
209337
209494
  stageXml(input, uri, next);
209338
209495
  foundSources = true;
@@ -214211,21 +214368,21 @@ function scanParagraphPropertyMoveMarkers(workingXml, fragment3, rangeMarkerIds)
214211
214368
  onCloseTag(event) {
214212
214369
  if (event.tag.isSelfClosing)
214213
214370
  return;
214214
- const open = stack.pop();
214215
- if (!open)
214371
+ const open2 = stack.pop();
214372
+ if (!open2)
214216
214373
  return;
214217
- if (open.paragraphPropertyCandidate) {
214218
- open.paragraphPropertyCandidate.end = event.end;
214219
- open.paragraphPropertyCandidate.explicitCloseContentValid = isEmptyMoveMarkerContent2(workingXml.slice(open.paragraphPropertyCandidate.contentStart, event.start));
214374
+ if (open2.paragraphPropertyCandidate) {
214375
+ open2.paragraphPropertyCandidate.end = event.end;
214376
+ open2.paragraphPropertyCandidate.explicitCloseContentValid = isEmptyMoveMarkerContent2(workingXml.slice(open2.paragraphPropertyCandidate.contentStart, event.start));
214220
214377
  }
214221
- if (open.moveWrapperCandidate)
214222
- open.moveWrapperCandidate.end = event.end;
214223
- if (open.rangeMarker) {
214224
- open.rangeMarker.end = event.end;
214225
- open.rangeMarker.explicitCloseContentValid = isEmptyMoveMarkerContent2(workingXml.slice(open.rangeMarker.contentStart, event.start));
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));
214226
214383
  }
214227
- if (isWordElement2(open, "p") && open.start < fragment3.byteStart && event.end >= fragment3.byteEnd) {
214228
- paragraphs.push({ start: open.start, end: event.end });
214384
+ if (isWordElement2(open2, "p") && open2.start < fragment3.byteStart && event.end >= fragment3.byteEnd) {
214385
+ paragraphs.push({ start: open2.start, end: event.end });
214229
214386
  }
214230
214387
  }
214231
214388
  });
@@ -214294,20 +214451,20 @@ function pairMoveRangeMarkers(positions) {
214294
214451
  ...positions.ends.map((range) => ({ kind: "end", range }))
214295
214452
  ].sort((left, right) => left.range.start - right.range.start);
214296
214453
  const pairs = [];
214297
- let open = null;
214454
+ let open2 = null;
214298
214455
  for (const event of events) {
214299
214456
  if (event.kind === "start") {
214300
- if (open)
214457
+ if (open2)
214301
214458
  return { ok: false, pairs };
214302
- open = event.range;
214459
+ open2 = event.range;
214303
214460
  continue;
214304
214461
  }
214305
- if (!open || event.range.start < open.end)
214462
+ if (!open2 || event.range.start < open2.end)
214306
214463
  return { ok: false, pairs };
214307
- pairs.push({ startMarker: open, endMarker: event.range });
214308
- open = null;
214464
+ pairs.push({ startMarker: open2, endMarker: event.range });
214465
+ open2 = null;
214309
214466
  }
214310
- return { ok: open == null, pairs };
214467
+ return { ok: open2 == null, pairs };
214311
214468
  }
214312
214469
  function isWordElement2(element, localName2) {
214313
214470
  return element?.tag.namespaceUri === NS_W && element.tag.localName === localName2;
@@ -215667,10 +215824,10 @@ function requiredCellParagraphReplacement(partXml, paragraphStart) {
215667
215824
  return null;
215668
215825
  const firstChild = directChildren2(ranges, paragraph)[0];
215669
215826
  const properties = firstChild?.tag.namespaceUri === NS_W && firstChild.tag.localName === "pPr" ? firstChild : undefined;
215670
- const open = partXml.slice(paragraph.start, paragraph.openEnd);
215827
+ const open2 = partXml.slice(paragraph.start, paragraph.openEnd);
215671
215828
  if (paragraph.tag.isSelfClosing)
215672
- return open;
215673
- return open + (properties ? partXml.slice(paragraph.openEnd, properties.end) : "") + partXml.slice(paragraph.closeStart, paragraph.end);
215829
+ return open2;
215830
+ return open2 + (properties ? partXml.slice(paragraph.openEnd, properties.end) : "") + partXml.slice(paragraph.closeStart, paragraph.end);
215674
215831
  }
215675
215832
  function directChildren2(ranges, parent) {
215676
215833
  const children = [];
@@ -216062,8 +216219,8 @@ function prepareTrackedBlockXmlReplacement(input) {
216062
216219
  return null;
216063
216220
  wordIds.push(...runs.wordIds);
216064
216221
  nextId += runs.wordIds.length;
216065
- const open = xml.slice(paragraph.start, paragraph.openEnd).replace(/\/>$/, ">");
216066
- result += xml.slice(cursor, paragraph.start) + open + (properties ? xml.slice(paragraph.openEnd, properties.start) : "") + nextProperties + runs.xml + `</${paragraph.tag.name}>`;
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}>`;
216067
216224
  cursor = paragraph.end;
216068
216225
  }
216069
216226
  return xml.slice(cursor).trim() ? null : result + xml.slice(cursor);
@@ -216829,11 +216986,11 @@ function paragraphPropertiesChildrenXml(pPrXml) {
216829
216986
  const selfClosing = /^<[\w.-]+:pPr\b[^>]*\/>$/.exec(trimmed);
216830
216987
  if (selfClosing)
216831
216988
  return "";
216832
- const open = /^<[\w.-]+:pPr\b[^>]*>/.exec(trimmed)?.[0];
216989
+ const open2 = /^<[\w.-]+:pPr\b[^>]*>/.exec(trimmed)?.[0];
216833
216990
  const close = /<\/[\w.-]+:pPr>\s*$/.exec(trimmed)?.[0];
216834
- if (!open || !close)
216991
+ if (!open2 || !close)
216835
216992
  return "";
216836
- return trimmed.slice(open.length, trimmed.length - close.length);
216993
+ return trimmed.slice(open2.length, trimmed.length - close.length);
216837
216994
  }
216838
216995
  function paragraphPropertiesNamespaceAttrs(pPrXml) {
216839
216996
  if (!pPrXml)
@@ -234808,9 +234965,9 @@ function prepareTrackedTableCellTextReplacement(input) {
234808
234965
  });
234809
234966
  if (!runs)
234810
234967
  return null;
234811
- const open = input.beforeXml.slice(first.range.start, first.range.openEnd).replace(/\/>$/, ">");
234968
+ const open2 = input.beforeXml.slice(first.range.start, first.range.openEnd).replace(/\/>$/, ">");
234812
234969
  return {
234813
- xml: input.beforeXml.slice(0, first.range.start) + open + first.properties + runs.xml + `</${first.range.tag.name}>` + input.beforeXml.slice(first.range.end),
234970
+ xml: input.beforeXml.slice(0, first.range.start) + open2 + first.properties + runs.xml + `</${first.range.tag.name}>` + input.beforeXml.slice(first.range.end),
234814
234971
  wordIds: runs.wordIds
234815
234972
  };
234816
234973
  }
@@ -235681,13 +235838,13 @@ function validateCellTextPayload(text) {
235681
235838
  return null;
235682
235839
  }
235683
235840
  function blankClonedRowCells(xml) {
235684
- return xml.replace(/(<([\w.-]+):tc\b[^>]*>)([\s\S]*?)(<\/\2:tc>)/g, (_full, open, prefix, body, close) => {
235841
+ return xml.replace(/(<([\w.-]+):tc\b[^>]*>)([\s\S]*?)(<\/\2:tc>)/g, (_full, open2, prefix, body, close) => {
235685
235842
  const tcPr = body.match(new RegExp(`<${prefix}:tcPr\\b(?:[^>]*/>|[\\s\\S]*?</${prefix}:tcPr>)`))?.[0] ?? "";
235686
235843
  const paraId = body.match(/(?:w14|w):paraId="([^"]*)"/)?.[1] ?? "";
235687
235844
  const pPr = composePPrWithMarkRPr(extractFirstPPr(body), extractFirstRunRPr(body));
235688
235845
  const attrs = paraId ? ` w14:paraId="${paraId}"` : "";
235689
235846
  const paragraph = pPr ? `<${prefix}:p${attrs}>${pPr}</${prefix}:p>` : `<${prefix}:p${attrs}/>`;
235690
- return `${open}${tcPr}${paragraph}${close}`;
235847
+ return `${open2}${tcPr}${paragraph}${close}`;
235691
235848
  });
235692
235849
  }
235693
235850
  function stripClonedTableHeaderProperty(xml) {
@@ -236748,10 +236905,10 @@ function readParaIdFromParagraphXml(xml, namespaceBindings) {
236748
236905
  return null;
236749
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;
236750
236907
  }
236751
- const open = /^<[\w.-]+:p\b([^>]*)>/i.exec(xml);
236752
- if (!open)
236908
+ const open2 = /^<[\w.-]+:p\b([^>]*)>/i.exec(xml);
236909
+ if (!open2)
236753
236910
  return null;
236754
- return /(?:[\w.-]+:)?paraId=(["'])([^"']+)\1/.exec(open[1] ?? "")?.[2] ?? null;
236911
+ return /(?:[\w.-]+:)?paraId=(["'])([^"']+)\1/.exec(open2[1] ?? "")?.[2] ?? null;
236755
236912
  }
236756
236913
  function trailingXmlAfterLastParagraph(xml, namespaceBindings) {
236757
236914
  const spans = findElementSpans(xml, "p", namespaceBindings);
@@ -237713,9 +237870,9 @@ function parseParagraphEnvelope(anchorXml) {
237713
237870
  const selfClosing = /^<([\w.-]+:)?p\b[^>]*\/>\s*$/.exec(anchorXml);
237714
237871
  if (selfClosing) {
237715
237872
  const prefix2 = selfClosing[1] ?? "";
237716
- const open = anchorXml.trim().replace(/\s*\/>$/, ">");
237873
+ const open2 = anchorXml.trim().replace(/\s*\/>$/, ">");
237717
237874
  return {
237718
- open,
237875
+ open: open2,
237719
237876
  pPr: "",
237720
237877
  close: `</${prefix2}p>`,
237721
237878
  innerStart: anchorXml.length,
@@ -238065,10 +238222,10 @@ function rewritePastePPrNumbering(pPrXml, numbering) {
238065
238222
  if (/<w:numPr\b/.test(pPrXml)) {
238066
238223
  return pPrXml.replace(/<w:numPr\b(?:[^>]*\/>|[^>]*>[\s\S]*?<\/w:numPr\s*>)/, numPr);
238067
238224
  }
238068
- const open = /^<w:pPr\b[^>]*>/.exec(pPrXml)?.[0];
238069
- if (!open)
238225
+ const open2 = /^<w:pPr\b[^>]*>/.exec(pPrXml)?.[0];
238226
+ if (!open2)
238070
238227
  return pPrXml;
238071
- let at = open.length;
238228
+ let at = open2.length;
238072
238229
  while (true) {
238073
238230
  const earlyChild = /^\s*<w:(pStyle|keepNext|keepLines|pageBreakBefore|framePr|widowControl)\b(?:[^>]*\/>|[^>]*>[\s\S]*?<\/w:\1\s*>)/.exec(pPrXml.slice(at));
238074
238231
  if (!earlyChild)
@@ -239375,11 +239532,11 @@ function wrapCarrierWithAncestors(carrierXml, ancestors, paragraphXml) {
239375
239532
  let wrapped = carrierXml;
239376
239533
  for (let index = ancestors.length - 1;index >= 0; index -= 1) {
239377
239534
  const ancestor = ancestors[index];
239378
- const open = /^<([\w.-]+):[\w.-]+\b[^>]*>/.exec(ancestor.rawXml);
239535
+ const open2 = /^<([\w.-]+):[\w.-]+\b[^>]*>/.exec(ancestor.rawXml);
239379
239536
  const close = /<\/[\w.-]+:[\w.-]+>$/.exec(ancestor.rawXml);
239380
- if (!open || !close)
239537
+ if (!open2 || !close)
239381
239538
  return null;
239382
- const selfContainedOpen = makeOpeningTagNamespaceSelfContained(open[0], open[1], paragraphXml);
239539
+ const selfContainedOpen = makeOpeningTagNamespaceSelfContained(open2[0], open2[1], paragraphXml);
239383
239540
  wrapped = `${selfContainedOpen}${wrapped}${close[0]}`;
239384
239541
  }
239385
239542
  return wrapped;
@@ -239424,12 +239581,12 @@ function insertCarrierAtImageOffset(input) {
239424
239581
  xml: `<${selfClosedParagraph[1]}${selfClosedParagraph[2]}>` + input.carrierXml + `</${selfClosedParagraph[1]}>`
239425
239582
  };
239426
239583
  }
239427
- const open = /^<[\w.-]+:p\b[^>]*>/.exec(input.paragraphXml);
239584
+ const open2 = /^<[\w.-]+:p\b[^>]*>/.exec(input.paragraphXml);
239428
239585
  const close = /<\/[\w.-]+:p>$/.exec(input.paragraphXml);
239429
- if (!open || !close) {
239586
+ if (!open2 || !close) {
239430
239587
  return { ok: false, reason: "image-move-destination-unsupported" };
239431
239588
  }
239432
- const inner = input.paragraphXml.slice(open[0].length, close.index);
239589
+ const inner = input.paragraphXml.slice(open2[0].length, close.index);
239433
239590
  const pPrXml = matchLeadingElement(inner, "pPr");
239434
239591
  const sliced = sliceParagraphContentAt({
239435
239592
  paragraphXml: input.paragraphXml,
@@ -239443,7 +239600,7 @@ function insertCarrierAtImageOffset(input) {
239443
239600
  }
239444
239601
  return {
239445
239602
  ok: true,
239446
- xml: `${open[0]}${pPrXml}${sliced.head}${input.carrierXml}${sliced.tail}${close[0]}`
239603
+ xml: `${open2[0]}${pPrXml}${sliced.head}${input.carrierXml}${sliced.tail}${close[0]}`
239447
239604
  };
239448
239605
  }
239449
239606
  function validateImageBinary(binary, format) {
@@ -243214,14 +243371,14 @@ function xmlOffsetsForBytePositions(bytes, positions) {
243214
243371
  return offsets;
243215
243372
  }
243216
243373
  function injectTrackedParagraphMarkIntoXml(paragraphXml, stamp, kind) {
243217
- const open = matchParagraphOpenTag(paragraphXml);
243374
+ const open2 = matchParagraphOpenTag(paragraphXml);
243218
243375
  const close = paragraphXml.match(/<\/([\w.-]+):p>\s*$/)?.[0];
243219
- if (!open || !close)
243376
+ if (!open2 || !close)
243220
243377
  return paragraphXml;
243221
- const inner = paragraphXml.slice(open.length, paragraphXml.length - close.length);
243378
+ const inner = paragraphXml.slice(open2.length, paragraphXml.length - close.length);
243222
243379
  const pPr = matchLeadingElement(inner, "pPr");
243223
243380
  const nextPPr = renderTrackedParagraphMarkProperties(pPr, stamp, kind);
243224
- return open + nextPPr + inner.slice(pPr.length) + close;
243381
+ return open2 + nextPPr + inner.slice(pPr.length) + close;
243225
243382
  }
243226
243383
  function injectTrackedMarkIntoLastParagraph(xml, stamp, kind) {
243227
243384
  const matches = [...xml.matchAll(/<w:p\b[^>]*>[\s\S]*?<\/w:p>/g)];
@@ -252747,8 +252904,8 @@ function removeRedundantXmlNamespaceDeclarations(xml, inheritedNamespaces) {
252747
252904
  ancestors.pop();
252748
252905
  const inherited = ancestors[ancestors.length - 1]?.namespaceBindings ?? inheritedNamespaces;
252749
252906
  if (inherited) {
252750
- const open = xml.slice(range.start, range.openEnd);
252751
- for (const attribute of open.matchAll(/\s+([A-Za-z_][\w.:-]*)\s*=\s*(?:"[^"]*"|'[^']*')/g)) {
252907
+ const open2 = xml.slice(range.start, range.openEnd);
252908
+ for (const attribute of open2.matchAll(/\s+([A-Za-z_][\w.:-]*)\s*=\s*(?:"[^"]*"|'[^']*')/g)) {
252752
252909
  const name = attribute[1];
252753
252910
  if (name !== "xmlns" && !name.startsWith("xmlns:"))
252754
252911
  continue;
@@ -254517,10 +254674,10 @@ function applySDDocumentSessionInternalProjection(session, input) {
254517
254674
  });
254518
254675
  }
254519
254676
  function validateSDDocumentSessionInternalPackageBytes(bytes) {
254520
- const open = openPackage(bytes);
254521
- const invariants = evaluatePackageInvariants(open);
254677
+ const open2 = openPackage(bytes);
254678
+ const invariants = evaluatePackageInvariants(open2);
254522
254679
  const diagnostics = [];
254523
- for (const diagnostic of open.pkg.diagnostics) {
254680
+ for (const diagnostic of open2.pkg.diagnostics) {
254524
254681
  diagnostics.push({
254525
254682
  code: diagnostic.code,
254526
254683
  severity: diagnostic.severity === "error" ? "hard" : "soft",
@@ -257362,13 +257519,13 @@ async function openSDDocumentSession(options) {
257362
257519
  } else {
257363
257520
  waitForSourceCompleteResult().then(() => settleCoverageRangeWaiters(currentCoverageSnapshot(), true)).catch(() => settleCoverageRangeWaiters(currentCoverageSnapshot(), true));
257364
257521
  }
257365
- return await new Promise((resolve) => {
257522
+ return await new Promise((resolve2) => {
257366
257523
  const signal = request.signal;
257367
257524
  let onAbort = null;
257368
257525
  const waiter = {
257369
257526
  startOrdinal,
257370
257527
  endOrdinalExclusive,
257371
- resolve,
257528
+ resolve: resolve2,
257372
257529
  cleanup: () => {
257373
257530
  if (signal && onAbort)
257374
257531
  signal.removeEventListener("abort", onAbort);
@@ -257379,7 +257536,7 @@ async function openSDDocumentSession(options) {
257379
257536
  return;
257380
257537
  coverageRangeWaiters.delete(waiter);
257381
257538
  waiter.cleanup();
257382
- resolve({
257539
+ resolve2({
257383
257540
  status: "cancelled",
257384
257541
  reason: "aborted",
257385
257542
  snapshot: currentCoverageSnapshot()
@@ -258527,17 +258684,17 @@ function prepareTrackedFieldMarkerRun(input) {
258527
258684
  const namespaceBindings = new Map(input.namespaceBindings).set(prefix, NS_W);
258528
258685
  const targetBindings = Object.fromEntries(namespaceBindings);
258529
258686
  const properties = (xml, value) => value.properties ? copyParagraphPropertyChild(xml, value.properties, targetBindings) : "";
258530
- const open = `<${prefix}:pPr>`;
258687
+ const open2 = `<${prefix}:pPr>`;
258531
258688
  const close = `</${prefix}:pPr>`;
258532
258689
  const prepared = prepareTrackedParagraphProperties({
258533
- beforeXml: open + properties(input.beforeXml, before) + close,
258534
- afterXml: open + properties(input.afterXml, after) + close,
258690
+ beforeXml: open2 + properties(input.beforeXml, before) + close,
258691
+ afterXml: open2 + properties(input.afterXml, after) + close,
258535
258692
  namespaceBindings,
258536
258693
  stamp: input.stamp
258537
258694
  });
258538
258695
  if (!prepared)
258539
258696
  return null;
258540
- const nextProperties = prepared.xml.slice(open.length, -close.length);
258697
+ const nextProperties = prepared.xml.slice(open2.length, -close.length);
258541
258698
  return {
258542
258699
  xml: input.beforeXml.slice(0, before.run.openEnd) + nextProperties + input.beforeXml.slice(before.properties?.end ?? before.run.openEnd),
258543
258700
  wordIds: prepared.wordIds
@@ -258728,17 +258885,17 @@ function prepareTrackedTocReplacement(input) {
258728
258885
  xml2 += deletedTerminal.xml;
258729
258886
  }
258730
258887
  if (after.length > retainedCount) {
258731
- const open = "<w:sdt><w:sdtContent>";
258888
+ const open2 = "<w:sdt><w:sdtContent>";
258732
258889
  const close = "</w:sdtContent></w:sdt>";
258733
258890
  const continuation = prepareTrackedTocInsertion({
258734
- xml: open + after.slice(retainedCount).map((paragraph) => paragraph.xml).join("") + close,
258891
+ xml: open2 + after.slice(retainedCount).map((paragraph) => paragraph.xml).join("") + close,
258735
258892
  namespaceBindings: input.namespaceBindings,
258736
258893
  stamp: stamp()
258737
258894
  });
258738
258895
  if (!continuation)
258739
258896
  return null;
258740
258897
  wordIds.push(...continuation.wordIds);
258741
- xml2 += continuation.xml.slice(open.length, -close.length);
258898
+ xml2 += continuation.xml.slice(open2.length, -close.length);
258742
258899
  }
258743
258900
  return { xml: xml2, wordIds };
258744
258901
  }
@@ -258758,17 +258915,17 @@ function prepareTrackedTocReplacement(input) {
258758
258915
  return null;
258759
258916
  let xml = original.open + properties.xml + deleted + inserted + `</${original.range.tag.name}>`;
258760
258917
  if (after.length > 1) {
258761
- const open = "<w:sdt><w:sdtContent>";
258918
+ const open2 = "<w:sdt><w:sdtContent>";
258762
258919
  const close = "</w:sdtContent></w:sdt>";
258763
258920
  const continuation = prepareTrackedTocInsertion({
258764
- xml: open + after.slice(1).map((paragraph) => paragraph.xml).join("") + close,
258921
+ xml: open2 + after.slice(1).map((paragraph) => paragraph.xml).join("") + close,
258765
258922
  namespaceBindings: input.namespaceBindings,
258766
258923
  stamp: stamp()
258767
258924
  });
258768
258925
  if (!continuation)
258769
258926
  return null;
258770
258927
  wordIds.push(...continuation.wordIds);
258771
- xml += continuation.xml.slice(open.length, -close.length);
258928
+ xml += continuation.xml.slice(open2.length, -close.length);
258772
258929
  }
258773
258930
  return { xml, wordIds };
258774
258931
  }
@@ -288033,12 +288190,12 @@ function parseContainerXml(xml, localName2) {
288033
288190
  const closeMatch = new RegExp(`</([\\w.-]+):${escapeForRegex(localName2)}>\\s*$`).exec(normalized);
288034
288191
  if (!openMatch || !closeMatch || openMatch[1] !== closeMatch[1])
288035
288192
  return null;
288036
- const open = openMatch[0];
288193
+ const open2 = openMatch[0];
288037
288194
  const close = closeMatch[0];
288038
288195
  return {
288039
288196
  prefix: openMatch[1],
288040
- open,
288041
- inner: normalized.slice(open.length, normalized.length - close.length),
288197
+ open: open2,
288198
+ inner: normalized.slice(open2.length, normalized.length - close.length),
288042
288199
  close
288043
288200
  };
288044
288201
  }
@@ -288881,11 +289038,11 @@ function bindRelationshipNamespaceOnSectPr(sectPrXml) {
288881
289038
  return sectPrXml.replace(/^<w:sectPr\b/, `<w:sectPr xmlns:r="${RELATIONSHIPS_NAMESPACE}"`);
288882
289039
  }
288883
289040
  function bindRelationshipNamespaceOnReferences(sectPrXml) {
288884
- return sectPrXml.replace(/<w:(headerReference|footerReference)\b/g, (open, _kind, offset) => {
288885
- const tagEnd = findXmlTagEnd3(sectPrXml, offset + open.length);
289041
+ return sectPrXml.replace(/<w:(headerReference|footerReference)\b/g, (open2, _kind, offset) => {
289042
+ const tagEnd = findXmlTagEnd3(sectPrXml, offset + open2.length);
288886
289043
  if (tagEnd < 0 || readNamespaceDeclaration(sectPrXml.slice(offset, tagEnd), "r") != null)
288887
- return open;
288888
- return `${open} xmlns:r="${RELATIONSHIPS_NAMESPACE}"`;
289044
+ return open2;
289045
+ return `${open2} xmlns:r="${RELATIONSHIPS_NAMESPACE}"`;
288889
289046
  });
288890
289047
  }
288891
289048
  function applyPreparedSectionXmlMutations(documentBytes, mutations) {
@@ -289263,9 +289420,9 @@ function expandSectPr(sectPrXml) {
289263
289420
  const openEnd = findXmlTagEnd3(sectPrXml, openMatch.index + openMatch[0].length);
289264
289421
  if (openEnd < 0)
289265
289422
  return sectPrXml;
289266
- const open = sectPrXml.slice(openMatch.index, openEnd);
289267
- const expandedOpen = open.replace(/\/\s*>$/, ">");
289268
- if (expandedOpen === open)
289423
+ const open2 = sectPrXml.slice(openMatch.index, openEnd);
289424
+ const expandedOpen = open2.replace(/\/\s*>$/, ">");
289425
+ if (expandedOpen === open2)
289269
289426
  return sectPrXml;
289270
289427
  return `${sectPrXml.slice(0, openMatch.index)}${expandedOpen}</w:sectPr>${sectPrXml.slice(openEnd)}`;
289271
289428
  }
@@ -290025,8 +290182,8 @@ function insertXmlAtCollapsedTopLevelWrapperBoundary(paragraphXml, offset, inser
290025
290182
  function injectParagraphPrefixXml(paragraphXml, insertionXml) {
290026
290183
  const selfClosing = paragraphXml.match(/^<w:p\b([^>]*)\/>$/s);
290027
290184
  if (selfClosing) {
290028
- const open = `<w:p${selfClosing[1]}>`;
290029
- return { ok: true, xml: `${open}${insertionXml}</w:p>`, insertionStart: open.length };
290185
+ const open2 = `<w:p${selfClosing[1]}>`;
290186
+ return { ok: true, xml: `${open2}${insertionXml}</w:p>`, insertionStart: open2.length };
290030
290187
  }
290031
290188
  const pPrClose = paragraphXml.indexOf("</w:pPr>");
290032
290189
  const insertionStart = pPrClose >= 0 ? pPrClose + "</w:pPr>".length : paragraphXml.indexOf(">") + 1;
@@ -293020,12 +293177,12 @@ function readDocumentTocParagraphTemplates(paragraphs) {
293020
293177
  const level = readTocParagraphLevel(paragraph2.rawXml);
293021
293178
  if (level == null)
293022
293179
  continue;
293023
- const open = buildTocParagraphTemplateOpen(paragraph2.rawXml);
293180
+ const open2 = buildTocParagraphTemplateOpen(paragraph2.rawXml);
293024
293181
  if (!templates.byLevel.has(level))
293025
- templates.byLevel.set(level, open);
293182
+ templates.byLevel.set(level, open2);
293026
293183
  const entryText = readTocParagraphTemplateText(paragraph2.rawXml);
293027
293184
  if (entryText && !templates.byText.has(entryText))
293028
- templates.byText.set(entryText, open);
293185
+ templates.byText.set(entryText, open2);
293029
293186
  }
293030
293187
  return templates;
293031
293188
  }
@@ -293538,12 +293695,12 @@ function buildTocParagraphTemplatesFromParagraphXml(xml) {
293538
293695
  const level = readTocParagraphLevel(paragraphXml);
293539
293696
  if (level == null)
293540
293697
  continue;
293541
- const open = buildTocParagraphTemplateOpen(paragraphXml);
293698
+ const open2 = buildTocParagraphTemplateOpen(paragraphXml);
293542
293699
  if (!templates.byLevel.has(level))
293543
- templates.byLevel.set(level, open);
293700
+ templates.byLevel.set(level, open2);
293544
293701
  const entryText = readTocParagraphTemplateText(paragraphXml);
293545
293702
  if (entryText && !templates.byText.has(entryText))
293546
- templates.byText.set(entryText, open);
293703
+ templates.byText.set(entryText, open2);
293547
293704
  }
293548
293705
  return templates;
293549
293706
  }
@@ -295142,8 +295299,8 @@ function wrapTextRangeWithMetadataSdt(paragraphXml, start, end, id, sdtId, known
295142
295299
  if (!wrapped.ok)
295143
295300
  return wrapped;
295144
295301
  const nextContent = parseContainerXml(wrapped.xml, "p").inner;
295145
- const open = /<w:sdtContent\b[^>]*>/.exec(parent.xml);
295146
- const contentStart = open.index + open[0].length;
295302
+ const open2 = /<w:sdtContent\b[^>]*>/.exec(parent.xml);
295303
+ const contentStart = open2.index + open2[0].length;
295147
295304
  let nextParent = replaceRange(parent.xml, contentStart, contentStart + content.length, nextContent);
295148
295305
  if (metadataParent && /<w:text\b/.test(pr)) {
295149
295306
  let nextPr = pr.replace(/<w:text\b[^>]*(?:\/>|>[\s\S]*?<\/w:text>)/, "<w:richText/>");
@@ -295220,24 +295377,24 @@ function findParagraphContaining(documentXml, index) {
295220
295377
  const paraRe = /<w:p\b[^>]*>[\s\S]*?<\/w:p>/g;
295221
295378
  for (let match = paraRe.exec(documentXml);match; match = paraRe.exec(documentXml)) {
295222
295379
  if (match.index <= index && paraRe.lastIndex >= index) {
295223
- const open = /^<w:p\b[^>]*>/.exec(match[0])?.[0] ?? "";
295380
+ const open2 = /^<w:p\b[^>]*>/.exec(match[0])?.[0] ?? "";
295224
295381
  return {
295225
295382
  start: match.index,
295226
295383
  end: paraRe.lastIndex,
295227
295384
  xml: match[0],
295228
- blockId: attrValue(open, "paraId") ?? "unknown"
295385
+ blockId: attrValue(open2, "paraId") ?? "unknown"
295229
295386
  };
295230
295387
  }
295231
295388
  }
295232
295389
  return null;
295233
295390
  }
295234
295391
  function unwrapSdt(sdtXml) {
295235
- const open = /<w:sdtContent\b[^>]*>/.exec(sdtXml);
295236
- if (!open)
295392
+ const open2 = /<w:sdtContent\b[^>]*>/.exec(sdtXml);
295393
+ if (!open2)
295237
295394
  return null;
295238
- if (/\/\s*>$/.test(open[0]))
295395
+ if (/\/\s*>$/.test(open2[0]))
295239
295396
  return "";
295240
- const contentStart = open.index + open[0].length;
295397
+ const contentStart = open2.index + open2[0].length;
295241
295398
  const tokenRe = /<w:sdtContent\b[^>]*>|<\/w:sdtContent>/g;
295242
295399
  tokenRe.lastIndex = contentStart;
295243
295400
  let depth = 0;
@@ -295622,20 +295779,20 @@ function normalizeStylesWordprocessingMlQNames(xml, options = {}) {
295622
295779
  const replacements = [];
295623
295780
  for (const range of parsed.ranges) {
295624
295781
  const sourceOpen = xml.slice(range.start, range.openEnd);
295625
- let open = sourceOpen;
295782
+ let open2 = sourceOpen;
295626
295783
  if (WORDPROCESSINGML_NAMESPACES2.has(range.tag.namespaceUri)) {
295627
- open = replaceXmlQName(open, range.tag.name, `${prefix}:${range.tag.localName}`, "element");
295784
+ open2 = replaceXmlQName(open2, range.tag.name, `${prefix}:${range.tag.localName}`, "element");
295628
295785
  }
295629
295786
  for (const attribute of range.tag.attributes) {
295630
295787
  if (!WORDPROCESSINGML_NAMESPACES2.has(attribute.namespaceUri))
295631
295788
  continue;
295632
- open = replaceXmlQName(open, attribute.name, `${prefix}:${attribute.localName}`, "attribute");
295789
+ open2 = replaceXmlQName(open2, attribute.name, `${prefix}:${attribute.localName}`, "attribute");
295633
295790
  }
295634
295791
  if (range === root && needsBinding) {
295635
- open = addNamespaceBinding(open, prefix, namespaceUri);
295792
+ open2 = addNamespaceBinding(open2, prefix, namespaceUri);
295636
295793
  }
295637
- if (open !== sourceOpen) {
295638
- replacements.push({ start: range.start, end: range.openEnd, value: open });
295794
+ if (open2 !== sourceOpen) {
295795
+ replacements.push({ start: range.start, end: range.openEnd, value: open2 });
295639
295796
  }
295640
295797
  if (range.tag.isSelfClosing || !WORDPROCESSINGML_NAMESPACES2.has(range.tag.namespaceUri))
295641
295798
  continue;
@@ -298329,7 +298486,7 @@ function applyParagraphAlignment(bodyXml, prefix, alignment) {
298329
298486
  return child;
298330
298487
  const paragraph2 = parseContainerXml(child.xml, "p");
298331
298488
  const inner = paragraph2 ? paragraph2.inner : "";
298332
- const open = paragraph2 ? paragraph2.open : child.xml.replace(/\/>$/, ">");
298489
+ const open2 = paragraph2 ? paragraph2.open : child.xml.replace(/\/>$/, ">");
298333
298490
  const close = paragraph2 ? paragraph2.close : `</${prefix}:p>`;
298334
298491
  const paragraphChildren = parseTopLevelChildren(inner);
298335
298492
  const pPrXml = getChild(paragraphChildren, "pPr")?.xml ?? null;
@@ -298339,7 +298496,7 @@ function applyParagraphAlignment(bodyXml, prefix, alignment) {
298339
298496
  changed = true;
298340
298497
  return {
298341
298498
  ...child,
298342
- xml: `${open}${serializeTopLevelChildren(nextParagraphChildren)}${close}`
298499
+ xml: `${open2}${serializeTopLevelChildren(nextParagraphChildren)}${close}`
298343
298500
  };
298344
298501
  });
298345
298502
  return changed ? serializeTopLevelChildren(next) : bodyXml;
@@ -320721,10 +320878,10 @@ function resolveAll(constructs2, events, context) {
320721
320878
  const called = [];
320722
320879
  let index = -1;
320723
320880
  while (++index < constructs2.length) {
320724
- const resolve = constructs2[index].resolveAll;
320725
- if (resolve && !called.includes(resolve)) {
320726
- events = resolve(events, context);
320727
- called.push(resolve);
320881
+ const resolve2 = constructs2[index].resolveAll;
320882
+ if (resolve2 && !called.includes(resolve2)) {
320883
+ events = resolve2(events, context);
320884
+ called.push(resolve2);
320728
320885
  }
320729
320886
  }
320730
320887
  return events;
@@ -320733,7 +320890,7 @@ function resolveAll(constructs2, events, context) {
320733
320890
  // ../../../v2/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/dev/lib/attention.js
320734
320891
  function resolveAllAttention(events, context) {
320735
320892
  let index = -1;
320736
- let open;
320893
+ let open2;
320737
320894
  let group;
320738
320895
  let text;
320739
320896
  let openingSequence;
@@ -320743,21 +320900,21 @@ function resolveAllAttention(events, context) {
320743
320900
  let offset;
320744
320901
  while (++index < events.length) {
320745
320902
  if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
320746
- open = index;
320747
- while (open--) {
320748
- if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
320749
- if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) {
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)) {
320750
320907
  continue;
320751
320908
  }
320752
- use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
320753
- const start = { ...events[open][1].end };
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 };
320754
320911
  const end = { ...events[index][1].start };
320755
320912
  movePoint(start, -use);
320756
320913
  movePoint(end, use);
320757
320914
  openingSequence = {
320758
320915
  type: use > 1 ? types9.strongSequence : types9.emphasisSequence,
320759
320916
  start,
320760
- end: { ...events[open][1].end }
320917
+ end: { ...events[open2][1].end }
320761
320918
  };
320762
320919
  closingSequence = {
320763
320920
  type: use > 1 ? types9.strongSequence : types9.emphasisSequence,
@@ -320766,7 +320923,7 @@ function resolveAllAttention(events, context) {
320766
320923
  };
320767
320924
  text = {
320768
320925
  type: use > 1 ? types9.strongText : types9.emphasisText,
320769
- start: { ...events[open][1].end },
320926
+ start: { ...events[open2][1].end },
320770
320927
  end: { ...events[index][1].start }
320771
320928
  };
320772
320929
  group = {
@@ -320774,13 +320931,13 @@ function resolveAllAttention(events, context) {
320774
320931
  start: { ...openingSequence.start },
320775
320932
  end: { ...closingSequence.end }
320776
320933
  };
320777
- events[open][1].end = { ...openingSequence.start };
320934
+ events[open2][1].end = { ...openingSequence.start };
320778
320935
  events[index][1].start = { ...closingSequence.end };
320779
320936
  nextEvents = [];
320780
- if (events[open][1].end.offset - events[open][1].start.offset) {
320937
+ if (events[open2][1].end.offset - events[open2][1].start.offset) {
320781
320938
  nextEvents = push(nextEvents, [
320782
- ["enter", events[open][1], context],
320783
- ["exit", events[open][1], context]
320939
+ ["enter", events[open2][1], context],
320940
+ ["exit", events[open2][1], context]
320784
320941
  ]);
320785
320942
  }
320786
320943
  nextEvents = push(nextEvents, [
@@ -320790,7 +320947,7 @@ function resolveAllAttention(events, context) {
320790
320947
  ["enter", text, context]
320791
320948
  ]);
320792
320949
  ok2(context.parser.constructs.insideSpan.null, "expected `insideSpan` to be populated");
320793
- nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context));
320950
+ nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + 1, index), context));
320794
320951
  nextEvents = push(nextEvents, [
320795
320952
  ["exit", text, context],
320796
320953
  ["enter", closingSequence, context],
@@ -320806,8 +320963,8 @@ function resolveAllAttention(events, context) {
320806
320963
  } else {
320807
320964
  offset = 0;
320808
320965
  }
320809
- splice(events, open - 1, index - open + 3, nextEvents);
320810
- index = open + nextEvents.length - offset - 2;
320966
+ splice(events, open2 - 1, index - open2 + 3, nextEvents);
320967
+ index = open2 + nextEvents.length - offset - 2;
320811
320968
  break;
320812
320969
  }
320813
320970
  }
@@ -320841,10 +320998,10 @@ function tokenizeAttention(effects2, ok3) {
320841
320998
  const token = effects2.exit("attentionSequence");
320842
320999
  const after = classifyCharacter(code);
320843
321000
  ok2(attentionMarkers, "expected `attentionMarkers` to be populated");
320844
- const open = !after || after === constants2.characterGroupPunctuation && before || attentionMarkers.includes(code);
321001
+ const open2 = !after || after === constants2.characterGroupPunctuation && before || attentionMarkers.includes(code);
320845
321002
  const close = !before || before === constants2.characterGroupPunctuation && after || attentionMarkers.includes(previous);
320846
- token._open = Boolean(marker === codes.asterisk ? open : open && (before || !close));
320847
- token._close = Boolean(marker === codes.asterisk ? close : close && (after || !open));
321003
+ token._open = Boolean(marker === codes.asterisk ? open2 : open2 && (before || !close));
321004
+ token._close = Boolean(marker === codes.asterisk ? close : close && (after || !open2));
320848
321005
  return ok3(code);
320849
321006
  }
320850
321007
  }
@@ -320877,9 +321034,9 @@ function tokenizeAutolink(effects2, ok3, nok) {
320877
321034
  effects2.consume(code);
320878
321035
  effects2.exit(types9.autolinkMarker);
320879
321036
  effects2.enter(types9.autolinkProtocol);
320880
- return open;
321037
+ return open2;
320881
321038
  }
320882
- function open(code) {
321039
+ function open2(code) {
320883
321040
  if (asciiAlpha(code)) {
320884
321041
  effects2.consume(code);
320885
321042
  return schemeOrEmailAtext;
@@ -321098,9 +321255,9 @@ function tokenizeCharacterReference(effects2, ok3, nok) {
321098
321255
  effects2.enter(types9.characterReferenceMarker);
321099
321256
  effects2.consume(code);
321100
321257
  effects2.exit(types9.characterReferenceMarker);
321101
- return open;
321258
+ return open2;
321102
321259
  }
321103
- function open(code) {
321260
+ function open2(code) {
321104
321261
  if (code === codes.numberSign) {
321105
321262
  effects2.enter(types9.characterReferenceMarkerNumeric);
321106
321263
  effects2.consume(code);
@@ -322412,9 +322569,9 @@ function tokenizeHtmlFlow(effects2, ok3, nok) {
322412
322569
  effects2.enter(types9.htmlFlow);
322413
322570
  effects2.enter(types9.htmlFlowData);
322414
322571
  effects2.consume(code);
322415
- return open;
322572
+ return open2;
322416
322573
  }
322417
- function open(code) {
322574
+ function open2(code) {
322418
322575
  if (code === codes.exclamationMark) {
322419
322576
  effects2.consume(code);
322420
322577
  return declarationOpen;
@@ -322783,9 +322940,9 @@ function tokenizeHtmlText(effects2, ok3, nok) {
322783
322940
  effects2.enter(types9.htmlText);
322784
322941
  effects2.enter(types9.htmlTextData);
322785
322942
  effects2.consume(code);
322786
- return open;
322943
+ return open2;
322787
322944
  }
322788
- function open(code) {
322945
+ function open2(code) {
322789
322946
  if (code === codes.exclamationMark) {
322790
322947
  effects2.consume(code);
322791
322948
  return declarationOpen;
@@ -323107,12 +323264,12 @@ function resolveToLabelEnd(events, context) {
323107
323264
  let index = events.length;
323108
323265
  let offset = 0;
323109
323266
  let token;
323110
- let open;
323267
+ let open2;
323111
323268
  let close;
323112
323269
  let media;
323113
323270
  while (index--) {
323114
323271
  token = events[index][1];
323115
- if (open) {
323272
+ if (open2) {
323116
323273
  if (token.type === types9.link || token.type === types9.labelLink && token._inactive) {
323117
323274
  break;
323118
323275
  }
@@ -323121,7 +323278,7 @@ function resolveToLabelEnd(events, context) {
323121
323278
  }
323122
323279
  } else if (close) {
323123
323280
  if (events[index][0] === "enter" && (token.type === types9.labelImage || token.type === types9.labelLink) && !token._balanced) {
323124
- open = index;
323281
+ open2 = index;
323125
323282
  if (token.type !== types9.labelLink) {
323126
323283
  offset = 2;
323127
323284
  break;
@@ -323131,31 +323288,31 @@ function resolveToLabelEnd(events, context) {
323131
323288
  close = index;
323132
323289
  }
323133
323290
  }
323134
- ok2(open !== undefined, "`open` is supposed to be found");
323291
+ ok2(open2 !== undefined, "`open` is supposed to be found");
323135
323292
  ok2(close !== undefined, "`close` is supposed to be found");
323136
323293
  const group = {
323137
- type: events[open][1].type === types9.labelLink ? types9.link : types9.image,
323138
- start: { ...events[open][1].start },
323294
+ type: events[open2][1].type === types9.labelLink ? types9.link : types9.image,
323295
+ start: { ...events[open2][1].start },
323139
323296
  end: { ...events[events.length - 1][1].end }
323140
323297
  };
323141
323298
  const label = {
323142
323299
  type: types9.label,
323143
- start: { ...events[open][1].start },
323300
+ start: { ...events[open2][1].start },
323144
323301
  end: { ...events[close][1].end }
323145
323302
  };
323146
323303
  const text = {
323147
323304
  type: types9.labelText,
323148
- start: { ...events[open + offset + 2][1].end },
323305
+ start: { ...events[open2 + offset + 2][1].end },
323149
323306
  end: { ...events[close - 2][1].start }
323150
323307
  };
323151
323308
  media = [
323152
323309
  ["enter", group, context],
323153
323310
  ["enter", label, context]
323154
323311
  ];
323155
- media = push(media, events.slice(open + 1, open + offset + 3));
323312
+ media = push(media, events.slice(open2 + 1, open2 + offset + 3));
323156
323313
  media = push(media, [["enter", text, context]]);
323157
323314
  ok2(context.parser.constructs.insideSpan.null, "expected `insideSpan.null` to be populated");
323158
- media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));
323315
+ media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + offset + 4, close - 3), context));
323159
323316
  media = push(media, [
323160
323317
  ["exit", text, context],
323161
323318
  events[close - 2],
@@ -323164,7 +323321,7 @@ function resolveToLabelEnd(events, context) {
323164
323321
  ]);
323165
323322
  media = push(media, events.slice(close + 1));
323166
323323
  media = push(media, [["exit", group, context]]);
323167
- splice(events, open, events.length, media);
323324
+ splice(events, open2, events.length, media);
323168
323325
  return events;
323169
323326
  }
323170
323327
  function tokenizeLabelEnd(effects2, ok3, nok) {
@@ -323327,9 +323484,9 @@ function tokenizeLabelStartImage(effects2, ok3, nok) {
323327
323484
  effects2.enter(types9.labelImageMarker);
323328
323485
  effects2.consume(code);
323329
323486
  effects2.exit(types9.labelImageMarker);
323330
- return open;
323487
+ return open2;
323331
323488
  }
323332
- function open(code) {
323489
+ function open2(code) {
323333
323490
  if (code === codes.leftSquareBracket) {
323334
323491
  effects2.enter(types9.labelMarker);
323335
323492
  effects2.consume(code);
@@ -325464,8 +325621,8 @@ function compiler(options) {
325464
325621
  return length;
325465
325622
  }
325466
325623
  function opener(create, and) {
325467
- return open;
325468
- function open(token) {
325624
+ return open2;
325625
+ function open2(token) {
325469
325626
  enter.call(this, create(token), token);
325470
325627
  if (and)
325471
325628
  and.call(this, token);
@@ -325498,15 +325655,15 @@ function compiler(options) {
325498
325655
  function exit2(token, onExitError) {
325499
325656
  const node4 = this.stack.pop();
325500
325657
  ok2(node4, "expected `node`");
325501
- const open = this.tokenStack.pop();
325502
- if (!open) {
325658
+ const open2 = this.tokenStack.pop();
325659
+ if (!open2) {
325503
325660
  throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it’s not open");
325504
- } else if (open[0].type !== token.type) {
325661
+ } else if (open2[0].type !== token.type) {
325505
325662
  if (onExitError) {
325506
- onExitError.call(this, token, open[0]);
325663
+ onExitError.call(this, token, open2[0]);
325507
325664
  } else {
325508
- const handler = open[1] || defaultOnError;
325509
- handler.call(this, token, open[0]);
325665
+ const handler = open2[1] || defaultOnError;
325666
+ handler.call(this, token, open2[0]);
325510
325667
  }
325511
325668
  }
325512
325669
  ok2(node4.type !== "fragment", "unexpected fragment `exit`ed");
@@ -327219,30 +327376,30 @@ function gfmStrikethrough(options) {
327219
327376
  let index2 = -1;
327220
327377
  while (++index2 < events.length) {
327221
327378
  if (events[index2][0] === "enter" && events[index2][1].type === "strikethroughSequenceTemporary" && events[index2][1]._close) {
327222
- let open = index2;
327223
- while (open--) {
327224
- if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && events[index2][1].end.offset - events[index2][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {
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) {
327225
327382
  events[index2][1].type = "strikethroughSequence";
327226
- events[open][1].type = "strikethroughSequence";
327383
+ events[open2][1].type = "strikethroughSequence";
327227
327384
  const strikethrough = {
327228
327385
  type: "strikethrough",
327229
- start: Object.assign({}, events[open][1].start),
327386
+ start: Object.assign({}, events[open2][1].start),
327230
327387
  end: Object.assign({}, events[index2][1].end)
327231
327388
  };
327232
327389
  const text4 = {
327233
327390
  type: "strikethroughText",
327234
- start: Object.assign({}, events[open][1].end),
327391
+ start: Object.assign({}, events[open2][1].end),
327235
327392
  end: Object.assign({}, events[index2][1].start)
327236
327393
  };
327237
327394
  const nextEvents = [
327238
327395
  ["enter", strikethrough, context],
327239
- ["enter", events[open][1], context],
327240
- ["exit", events[open][1], context],
327396
+ ["enter", events[open2][1], context],
327397
+ ["exit", events[open2][1], context],
327241
327398
  ["enter", text4, context]
327242
327399
  ];
327243
327400
  const insideSpan2 = context.parser.constructs.insideSpan.null;
327244
327401
  if (insideSpan2) {
327245
- splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(open + 1, index2), context));
327402
+ splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(open2 + 1, index2), context));
327246
327403
  }
327247
327404
  splice(nextEvents, nextEvents.length, 0, [
327248
327405
  ["exit", text4, context],
@@ -327250,8 +327407,8 @@ function gfmStrikethrough(options) {
327250
327407
  ["exit", events[index2][1], context],
327251
327408
  ["exit", strikethrough, context]
327252
327409
  ]);
327253
- splice(events, open - 1, index2 - open + 3, nextEvents);
327254
- index2 = open + nextEvents.length - 2;
327410
+ splice(events, open2 - 1, index2 - open2 + 3, nextEvents);
327411
+ index2 = open2 + nextEvents.length - 2;
327255
327412
  break;
327256
327413
  }
327257
327414
  }
@@ -327795,8 +327952,8 @@ function gfmTaskListItem() {
327795
327952
  }
327796
327953
  function tokenizeTasklistCheck(effects2, ok4, nok) {
327797
327954
  const self = this;
327798
- return open;
327799
- function open(code2) {
327955
+ return open2;
327956
+ function open2(code2) {
327800
327957
  ok2(code2 === codes.leftSquareBracket, "expected `[`");
327801
327958
  if (self.previous !== codes.eof || !self._gfmTasklistFirstContentOfListItem) {
327802
327959
  return nok(code2);
@@ -328993,9 +329150,9 @@ function splitSharedTextRun(source) {
328993
329150
  }
328994
329151
  if (content3.length <= 1)
328995
329152
  return source;
328996
- const open = source.slice(root.start, root.openEnd);
329153
+ const open2 = source.slice(root.start, root.openEnd);
328997
329154
  const close = source.slice(root.closeStart, root.end);
328998
- return content3.map((leaf) => `${open}${properties}${leaf}${close}`).join("");
329155
+ return content3.map((leaf) => `${open2}${properties}${leaf}${close}`).join("");
328999
329156
  }
329000
329157
  var W11 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
329001
329158
  var init_wrap_text_selection = __esm(() => {
@@ -331551,14 +331708,14 @@ function rewritePlainBody(bytes, index2, text4) {
331551
331708
  return end;
331552
331709
  if (splitExistingRevision)
331553
331710
  return { ok: false, reason: "unsupported-context" };
331554
- const open = matchParagraphOpenTag(firstXml);
331711
+ const open2 = matchParagraphOpenTag(firstXml);
331555
331712
  const close = firstXml.match(/<\/[\w.-]+:p>\s*$/)?.[0];
331556
- if (!open || !close)
331713
+ if (!open2 || !close)
331557
331714
  return { ok: false, reason: "invalid-range" };
331558
- const inner = firstXml.slice(open.length, firstXml.length - close.length);
331715
+ const inner = firstXml.slice(open2.length, firstXml.length - close.length);
331559
331716
  const properties = matchLeadingElement(inner, "pPr");
331560
331717
  const rewritten = rewriteSDDirectParagraphText({
331561
- paragraphXml: open + properties + start.head + end.tail + close,
331718
+ paragraphXml: open2 + properties + start.head + end.tail + close,
331562
331719
  startOffset: 0,
331563
331720
  endOffset: 0,
331564
331721
  newText: text4
@@ -336804,8 +336961,8 @@ function firstRunProperties(contentXml) {
336804
336961
  if (!properties)
336805
336962
  return "";
336806
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("");
336807
- const open = contentXml.slice(properties.start, properties.openEnd).replace(/(\/?>)$/, (_match, close) => inheritedDeclarations + close);
336808
- return open + contentXml.slice(properties.openEnd, properties.end);
336964
+ const open2 = contentXml.slice(properties.start, properties.openEnd).replace(/(\/?>)$/, (_match, close) => inheritedDeclarations + close);
336965
+ return open2 + contentXml.slice(properties.openEnd, properties.end);
336809
336966
  }
336810
336967
  function normalizeOoxml(content3, allocate) {
336811
336968
  const prefixes = new Map([
@@ -337060,12 +337217,12 @@ function cloneContentControlXml(input) {
337060
337217
  }
337061
337218
  }
337062
337219
  const replaceAttribute = (range, name, value2) => {
337063
- const open = input.xml.slice(range.start, range.openEnd);
337220
+ const open2 = input.xml.slice(range.start, range.openEnd);
337064
337221
  const pattern = new RegExp(`(\\s${escapeRegExp14(name)}\\s*=\\s*)(["'])([\\s\\S]*?)\\2`);
337065
337222
  edits.push({
337066
337223
  start: range.start,
337067
337224
  end: range.openEnd,
337068
- xml: open.replace(pattern, (_match, prefix, quote) => prefix + quote + xmlEscapeAttr(value2) + quote)
337225
+ xml: open2.replace(pattern, (_match, prefix, quote) => prefix + quote + xmlEscapeAttr(value2) + quote)
337069
337226
  });
337070
337227
  };
337071
337228
  let rootId;
@@ -337122,8 +337279,8 @@ function cloneContentControlXml(input) {
337122
337279
  prefix += "_";
337123
337280
  declaration = ` xmlns:${prefix}="${W145}"`;
337124
337281
  }
337125
- const open = input.xml.slice(range.start, range.openEnd).replace(/(\/?>)$/, `${declaration} ${prefix}:paraId="${id}"$1`);
337126
- edits.push({ start: range.start, end: range.openEnd, xml: open });
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 });
337127
337284
  }
337128
337285
  }
337129
337286
  }
@@ -339978,7 +340135,7 @@ function buildResolvedStructuredBlocksXml(context, blocks, allocParaId) {
339978
340135
  failure: { code: mapRejectionReason(compiled.reason), message: compiled.reason }
339979
340136
  };
339980
340137
  }
339981
- const resolve = (items) => items.map((block) => {
340138
+ const resolve2 = (items) => items.map((block) => {
339982
340139
  if (block.kind === "paragraph") {
339983
340140
  if (!block.semanticStyleRole)
339984
340141
  return block;
@@ -339988,12 +340145,12 @@ function buildResolvedStructuredBlocksXml(context, blocks, allocParaId) {
339988
340145
  }
339989
340146
  return {
339990
340147
  ...block,
339991
- rows: block.rows.map((row) => row.map((cell) => ({ ...cell, blocks: resolve(cell.blocks) })))
340148
+ rows: block.rows.map((row) => row.map((cell) => ({ ...cell, blocks: resolve2(cell.blocks) })))
339992
340149
  };
339993
340150
  });
339994
340151
  return {
339995
340152
  ok: true,
339996
- contentXml: buildStructuredBlocksXml(resolve(blocks), allocParaId),
340153
+ contentXml: buildStructuredBlocksXml(resolve2(blocks), allocParaId),
339997
340154
  perPart: compiled.value.perPart,
339998
340155
  semanticStyleDependencies: [...roles].map((role) => ({
339999
340156
  role,
@@ -341536,11 +341693,11 @@ function prepareTrackedCaptionPrecedingBoundary(input) {
341536
341693
  const properties = ranges[1]?.tag.namespaceUri === W17 && ranges[1]?.tag.localName === "pPr" ? ranges[1] : undefined;
341537
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)))
341538
341695
  return null;
341539
- const open = input.beforeXml.slice(0, paragraph4.openEnd).replace(/\/>$/, ">");
341696
+ const open2 = input.beforeXml.slice(0, paragraph4.openEnd).replace(/\/>$/, ">");
341540
341697
  const close = `</${paragraph4.tag.name}>`;
341541
341698
  const marked = prepareTrackedBlockXmlReplacement({
341542
341699
  ...input,
341543
- beforeXml: open + (properties ? input.beforeXml.slice(properties.start, properties.end) : "") + close,
341700
+ beforeXml: open2 + (properties ? input.beforeXml.slice(properties.start, properties.end) : "") + close,
341544
341701
  afterXml: ""
341545
341702
  });
341546
341703
  if (!marked)
@@ -341595,20 +341752,20 @@ function prepareTrackedCaptionParagraph(input) {
341595
341752
  ...input.stamp.revisionIds ? { revisionIds: input.stamp.revisionIds.slice(wordIds.length) } : {}
341596
341753
  });
341597
341754
  const namespaceBindings = new Map(Object.entries(before.paragraph.namespaceBindings));
341598
- const open = input.beforeXml.slice(0, before.paragraph.openEnd).replace(/\/>$/, ">");
341755
+ const open2 = input.beforeXml.slice(0, before.paragraph.openEnd).replace(/\/>$/, ">");
341599
341756
  const close = `</${before.paragraph.tag.name}>`;
341600
341757
  let properties = after?.properties ?? before.properties;
341601
341758
  if (!after) {
341602
341759
  const mark = prepareTrackedBlockXmlReplacement({
341603
341760
  ...input,
341604
- beforeXml: open + before.properties + close,
341761
+ beforeXml: open2 + before.properties + close,
341605
341762
  afterXml: "",
341606
341763
  stamp: nextStamp()
341607
341764
  });
341608
341765
  if (!mark)
341609
341766
  return null;
341610
341767
  wordIds.push(...mark.wordIds);
341611
- properties = mark.xml.slice(open.length, -close.length);
341768
+ properties = mark.xml.slice(open2.length, -close.length);
341612
341769
  }
341613
341770
  let content3 = "";
341614
341771
  let cursor = before.contentStart;
@@ -341668,7 +341825,7 @@ function prepareTrackedCaptionParagraph(input) {
341668
341825
  properties = prepared.xml;
341669
341826
  wordIds.push(...prepared.wordIds);
341670
341827
  }
341671
- return { xml: open + properties + content3 + close, wordIds };
341828
+ return { xml: open2 + properties + content3 + close, wordIds };
341672
341829
  }
341673
341830
  var W17 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
341674
341831
  var init_tracked_paragraph = __esm(() => {
@@ -342185,8 +342342,8 @@ function nextCaptionFieldResult(entry, nextNumber) {
342185
342342
  function replaceTextNodeValues(xml, text4) {
342186
342343
  let replaced = false;
342187
342344
  const nextXml = xml.replace(/<w:t\b([^>]*)>([\s\S]*?)<\/w:t>/g, (match, _attrs, _value, offset) => {
342188
- const open = match.indexOf(">") + 1;
342189
- const start = offset + open;
342345
+ const open2 = match.indexOf(">") + 1;
342346
+ const start = offset + open2;
342190
342347
  const end = start + _value.length;
342191
342348
  const replacement = replaced ? "" : escapeText2(text4);
342192
342349
  replaced = true;
@@ -343369,7 +343526,7 @@ function insertTrackedToc(context, input) {
343369
343526
  tocBookmarkNames: names,
343370
343527
  reservedParaIds: occupied
343371
343528
  });
343372
- tocXml = tocXml.replace(/<w:p\b[^>]*>/g, (open) => /\sxmlns:w14\s*=/.test(open) ? open : open.replace("<w:p", '<w:p xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"'));
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"'));
343373
343530
  const tocRanges = collectXmlElementRanges(tocXml, {
343374
343531
  fragment: true,
343375
343532
  additionalNamespaces: Object.fromEntries(bindings)
@@ -343399,8 +343556,8 @@ function insertTrackedToc(context, input) {
343399
343556
  });
343400
343557
  for (let index2 = tocParagraphs.length - 1;index2 >= 0; index2--) {
343401
343558
  const paragraph4 = tocParagraphs[index2];
343402
- const open = tocXml.slice(paragraph4.start, paragraph4.openEnd);
343403
- const replaced = /\bw14:paraId="[^"]*"/.test(open) ? open.replace(/\bw14:paraId="[^"]*"/, `w14:paraId="${xmlEscapeAttr(paragraphIds[index2])}"`) : open.replace(/^<w:p\b/, `<w:p w14:paraId="${xmlEscapeAttr(paragraphIds[index2])}"`);
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])}"`);
343404
343561
  tocXml = tocXml.slice(0, paragraph4.start) + replaced + tocXml.slice(paragraph4.openEnd);
343405
343562
  }
343406
343563
  const author = readTrackedAuthor(context);
@@ -344055,12 +344212,12 @@ function prepareTrackedSectionBreak(input) {
344055
344212
  const beforeParagraphXml = oldParagraph ? input.beforeXml.slice(oldParagraph.start, oldParagraph.end) : "";
344056
344213
  const paragraphXml = input.afterXml.slice(paragraph4.start, paragraph4.end);
344057
344214
  const prepare = (paragraphId3, revisionIds) => {
344058
- let open = input.afterXml.slice(paragraph4.start, paragraph4.openEnd);
344215
+ let open2 = input.afterXml.slice(paragraph4.start, paragraph4.openEnd);
344059
344216
  for (const attribute of paragraph4.tag.attributes) {
344060
344217
  if (attribute.namespaceUri !== WORD_2010_NS2 || attribute.localName !== "paraId")
344061
344218
  continue;
344062
344219
  const name = attribute.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
344063
- open = open.replace(new RegExp(`\\s+${name}\\s*=\\s*(["'])[\\s\\S]*?\\1`), "");
344220
+ open2 = open2.replace(new RegExp(`\\s+${name}\\s*=\\s*(["'])[\\s\\S]*?\\1`), "");
344064
344221
  }
344065
344222
  let prefix = Object.entries(paragraph4.namespaceBindings).find(([name, uri]) => name && uri === WORD_2010_NS2)?.[0];
344066
344223
  let namespace = "";
@@ -344070,10 +344227,10 @@ function prepareTrackedSectionBreak(input) {
344070
344227
  prefix += "sd";
344071
344228
  namespace = ` xmlns:${prefix}="${WORD_2010_NS2}"`;
344072
344229
  }
344073
- open = open.replace(/\/?>(?=$)/, (ending) => `${namespace} ${prefix}:paraId="${paragraphId3}"${ending}`);
344230
+ open2 = open2.replace(/\/?>(?=$)/, (ending) => `${namespace} ${prefix}:paraId="${paragraphId3}"${ending}`);
344074
344231
  return prepareTrackedBlockXmlReplacement({
344075
344232
  beforeXml: beforeParagraphXml,
344076
- afterXml: open + paragraphXml.slice(paragraph4.openEnd - paragraph4.start),
344233
+ afterXml: open2 + paragraphXml.slice(paragraph4.openEnd - paragraph4.start),
344077
344234
  namespaceBindings: new Map(Object.entries(after.body.namespaceBindings)),
344078
344235
  stamp: { revisionId: revisionIds?.[0] ?? 0, revisionIds, author, date: date6 }
344079
344236
  });
@@ -346858,15 +347015,15 @@ function removePageNumberBuildingBlocks(context, refId, options) {
346858
347015
  }
346859
347016
  function pageNumberGalleryBlocks(partXml) {
346860
347017
  const blocks = [];
346861
- const open = [];
347018
+ const open2 = [];
346862
347019
  const tag = /<(\/?)w:sdt(?=[\s>/])[^>]*>/g;
346863
347020
  for (let match = tag.exec(partXml);match; match = tag.exec(partXml)) {
346864
347021
  if (!match[1]) {
346865
347022
  if (!match[0].endsWith("/>"))
346866
- open.push(match.index);
347023
+ open2.push(match.index);
346867
347024
  continue;
346868
347025
  }
346869
- const start = open.pop();
347026
+ const start = open2.pop();
346870
347027
  if (start === undefined)
346871
347028
  continue;
346872
347029
  const end = match.index + match[0].length;
@@ -348561,7 +348718,7 @@ function isHumanActorProof(value2) {
348561
348718
  }
348562
348719
  function createHumanActorScope() {
348563
348720
  let depth = 0;
348564
- const open = (proof) => {
348721
+ const open2 = (proof) => {
348565
348722
  if (!isHumanActorProof(proof))
348566
348723
  return () => {};
348567
348724
  depth += 1;
@@ -348576,14 +348733,14 @@ function createHumanActorScope() {
348576
348733
  return {
348577
348734
  current: () => depth > 0 ? "human" : undefined,
348578
348735
  run(proof, fn) {
348579
- const release = open(proof);
348736
+ const release = open2(proof);
348580
348737
  try {
348581
348738
  return fn();
348582
348739
  } finally {
348583
348740
  release();
348584
348741
  }
348585
348742
  },
348586
- open
348743
+ open: open2
348587
348744
  };
348588
348745
  }
348589
348746
  var HUMAN_ACTOR_PROOF;
@@ -352809,7 +352966,7 @@ async function yieldProjectionTask() {
352809
352966
  await scheduler.yield();
352810
352967
  return;
352811
352968
  }
352812
- await new Promise((resolve) => setTimeout(resolve, 0));
352969
+ await new Promise((resolve2) => setTimeout(resolve2, 0));
352813
352970
  }
352814
352971
  function projectionDependencyPartUris(context, storyPartUri2) {
352815
352972
  const normalized = storyPartUri2.startsWith("/") ? storyPartUri2 : `/${storyPartUri2}`;
@@ -355766,17 +355923,17 @@ function isLowSurrogate2(value2) {
355766
355923
  }
355767
355924
  function openMarks(emitter, inline, suppressCodeMark) {
355768
355925
  const tags = [];
355769
- const open = (enabled, tag) => {
355926
+ const open2 = (enabled, tag) => {
355770
355927
  if (!enabled)
355771
355928
  return;
355772
355929
  emitter.write(`<${tag}>`);
355773
355930
  tags.push(tag);
355774
355931
  };
355775
- open(inline.marks.bold, "strong");
355776
- open(inline.marks.italic, "em");
355777
- open(inline.marks.underline, "u");
355778
- open(inline.marks.strike, "s");
355779
- open(!suppressCodeMark && inline.marks.code, "code");
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");
355780
355937
  return tags;
355781
355938
  }
355782
355939
  function closeMarks(emitter, tags) {
@@ -355876,7 +356033,7 @@ function createSerializationSliceGate() {
355876
356033
  if (typeof scheduler?.yield === "function") {
355877
356034
  await scheduler.yield();
355878
356035
  } else {
355879
- await new Promise((resolve) => setTimeout(resolve, 0));
356036
+ await new Promise((resolve2) => setTimeout(resolve2, 0));
355880
356037
  }
355881
356038
  sliceStart = performance.now();
355882
356039
  };
@@ -356413,7 +356570,7 @@ function* resolveCodeMarkSteps(inline, suppressCodeMark, forceHtml) {
356413
356570
  }
356414
356571
  function openMarkdownMarks(emitter, inline, suppressCodeMark, codeMark, htmlFallbacks) {
356415
356572
  const marks = [];
356416
- const open = (enabled, value2, close = value2, htmlTag) => {
356573
+ const open2 = (enabled, value2, close = value2, htmlTag) => {
356417
356574
  if (!enabled)
356418
356575
  return;
356419
356576
  if (htmlTag) {
@@ -356424,10 +356581,10 @@ function openMarkdownMarks(emitter, inline, suppressCodeMark, codeMark, htmlFall
356424
356581
  marks.push({ close });
356425
356582
  }
356426
356583
  };
356427
- open(inline.marks.bold, "**", "**", htmlFallbacks.bold ? "strong" : undefined);
356428
- open(inline.marks.italic, "*", "*", htmlFallbacks.italic ? "em" : undefined);
356429
- open(inline.marks.underline, "<u>", "</u>");
356430
- open(inline.marks.strike, "~~", "~~", htmlFallbacks.strike ? "s" : undefined);
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);
356431
356588
  if (!suppressCodeMark && codeMark) {
356432
356589
  if (codeMark.kind === "html") {
356433
356590
  emitter.write("<code>");
@@ -356632,7 +356789,7 @@ function createSerializationSliceGate2() {
356632
356789
  if (typeof scheduler?.yield === "function") {
356633
356790
  await scheduler.yield();
356634
356791
  } else {
356635
- await new Promise((resolve) => setTimeout(resolve, 0));
356792
+ await new Promise((resolve2) => setTimeout(resolve2, 0));
356636
356793
  }
356637
356794
  sliceStart = performance.now();
356638
356795
  };
@@ -361864,12 +362021,12 @@ function bisectUnclosedRevisionWrappers(head, tail, allocateWId) {
361864
362021
  return null;
361865
362022
  const closes = [];
361866
362023
  const reopens = [];
361867
- for (const open of opens) {
361868
- const kind = /^<w:(ins|del)\b/.exec(open)?.[1];
362024
+ for (const open2 of opens) {
362025
+ const kind = /^<w:(ins|del)\b/.exec(open2)?.[1];
361869
362026
  if (!kind)
361870
362027
  return null;
361871
362028
  closes.push(`</w:${kind}>`);
361872
- reopens.push(refreshRevisionId2(open, allocateWId));
362029
+ reopens.push(refreshRevisionId2(open2, allocateWId));
361873
362030
  }
361874
362031
  return {
361875
362032
  head: head + closes.reverse().join(""),
@@ -362040,10 +362197,10 @@ function findEnclosingElementRange(xml, localName2, start, end) {
362040
362197
  stack.push({ start: match.index, openEnd: match.index + tag.length - 1 });
362041
362198
  }
362042
362199
  }
362043
- const open = stack.at(-1);
362044
- if (!open)
362200
+ const open2 = stack.at(-1);
362201
+ if (!open2)
362045
362202
  return null;
362046
- pattern.lastIndex = open.openEnd + 1;
362203
+ pattern.lastIndex = open2.openEnd + 1;
362047
362204
  let depth = 1;
362048
362205
  while (match = pattern.exec(xml)) {
362049
362206
  const tag = match[0];
@@ -362054,8 +362211,8 @@ function findEnclosingElementRange(xml, localName2, start, end) {
362054
362211
  if (depth === 0) {
362055
362212
  const elementEnd = match.index + tag.length;
362056
362213
  return elementEnd >= end ? {
362057
- start: open.start,
362058
- openEnd: open.openEnd,
362214
+ start: open2.start,
362215
+ openEnd: open2.openEnd,
362059
362216
  closeStart: match.index,
362060
362217
  end: elementEnd
362061
362218
  } : null;
@@ -366556,7 +366713,7 @@ function normalizeSettingsXml(xml) {
366556
366713
  for (const match of normalized.matchAll(/<\/?([\w.-]+):[\w.-]+|\s(?!xmlns\b)([\w.-]+):[\w.-]+=/g)) {
366557
366714
  usedPrefixes.add(match[1] ?? match[2]);
366558
366715
  }
366559
- normalized = normalized.replace(/(<w:settings\b)([^>]*)(>)/, (_match, open, attrs, close) => {
366716
+ normalized = normalized.replace(/(<w:settings\b)([^>]*)(>)/, (_match, open2, attrs, close) => {
366560
366717
  const ns = [];
366561
366718
  const rest = [];
366562
366719
  for (const m of attrs.matchAll(XML_ATTR_RE)) {
@@ -366574,7 +366731,7 @@ function normalizeSettingsXml(xml) {
366574
366731
  }
366575
366732
  rest.push(attr3);
366576
366733
  }
366577
- return open + [...ns.sort(), ...rest].join("") + close;
366734
+ return open2 + [...ns.sort(), ...rest].join("") + close;
366578
366735
  });
366579
366736
  return normalized;
366580
366737
  }
@@ -367457,13 +367614,13 @@ function parseElementDocument(xml, options) {
367457
367614
  root.closeEnd = closeEnd;
367458
367615
  } else if (!tag.isSelfClosing) {
367459
367616
  const stack = pending.get(tag.name);
367460
- const open = stack?.pop();
367461
- if (open) {
367462
- const mapped = options.mapElement(open.tag, {
367463
- raw: xml.slice(open.start, closeEnd),
367464
- start: open.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,
367465
367622
  end: closeEnd,
367466
- qname: open.tag.name
367623
+ qname: open2.tag.name
367467
367624
  });
367468
367625
  if (mapped)
367469
367626
  elements2.push(mapped);
@@ -375963,8 +376120,8 @@ function replaceAttribute(element, localName2, value2) {
375963
376120
  if (!attribute2)
375964
376121
  return element.xml;
375965
376122
  const openEnd = element.xml.indexOf(">") + 1;
375966
- const open = element.xml.slice(0, openEnd);
375967
- const replaced = open.replace(new RegExp(`(\\b${escapeRegExp19(attribute2.name)}\\s*=\\s*)(['"])([\\s\\S]*?)\\2`), (_match, name, quote) => `${name}${quote}${value2}${quote}`);
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}`);
375968
376125
  return replaced + element.xml.slice(openEnd);
375969
376126
  }
375970
376127
  function replaceUnique(xml, before, after) {
@@ -391495,7 +391652,7 @@ function wrapExistingNoteReferenceXml(documentXml, type, noteId, stamp) {
391495
391652
  const propertiesXml = properties ? documentXml.slice(properties.start, properties.end) : "";
391496
391653
  const before = documentXml.slice(run.openEnd, reference.start);
391497
391654
  const after = documentXml.slice(reference.end, run.closeStart);
391498
- const open = documentXml.slice(run.start, run.openEnd);
391655
+ const open2 = documentXml.slice(run.start, run.openEnd);
391499
391656
  const close = documentXml.slice(run.closeStart, run.end);
391500
391657
  const hasBefore = before.replace(propertiesXml, "").trim().length > 0;
391501
391658
  const hasAfter = after.trim().length > 0;
@@ -391503,7 +391660,7 @@ function wrapExistingNoteReferenceXml(documentXml, type, noteId, stamp) {
391503
391660
  if (!hasBefore && !hasAfter) {
391504
391661
  referenceRun = documentXml.slice(run.start, run.end);
391505
391662
  } else {
391506
- referenceRun = open + propertiesXml + documentXml.slice(reference.start, reference.end) + close;
391663
+ referenceRun = open2 + propertiesXml + documentXml.slice(reference.start, reference.end) + close;
391507
391664
  }
391508
391665
  const replacement = prepareTrackedInlineXmlReplacement({
391509
391666
  beforeXml: referenceRun,
@@ -391514,7 +391671,7 @@ function wrapExistingNoteReferenceXml(documentXml, type, noteId, stamp) {
391514
391671
  if (!replacement)
391515
391672
  return unresolved();
391516
391673
  return {
391517
- xml: documentXml.slice(0, run.start) + (hasBefore ? open + before + close : "") + replacement.xml + (hasAfter ? open + propertiesXml + after + close : "") + documentXml.slice(run.end),
391674
+ xml: documentXml.slice(0, run.start) + (hasBefore ? open2 + before + close : "") + replacement.xml + (hasAfter ? open2 + propertiesXml + after + close : "") + documentXml.slice(run.end),
391518
391675
  wordIds: replacement.wordIds
391519
391676
  };
391520
391677
  }
@@ -394051,8 +394208,8 @@ function boundedAttribute(xml, tag, attribute2) {
394051
394208
  return readXmlAttribute5(xml, tag, attribute2)?.slice(0, MAX_IMAGE_METADATA_CHARS) || undefined;
394052
394209
  }
394053
394210
  function readXmlAttribute5(xml, tag, attribute2, prefix) {
394054
- const open = new RegExp(`<[\\w.-]+:${tag}\\b[^>]*>`).exec(xml)?.[0];
394055
- return open ? readBareAttribute(open, prefix ? `${prefix}:${attribute2}` : attribute2) : null;
394211
+ const open2 = new RegExp(`<[\\w.-]+:${tag}\\b[^>]*>`).exec(xml)?.[0];
394212
+ return open2 ? readBareAttribute(open2, prefix ? `${prefix}:${attribute2}` : attribute2) : null;
394056
394213
  }
394057
394214
  function readBareAttribute(xml, attribute2) {
394058
394215
  const escaped = attribute2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -394359,10 +394516,10 @@ function compileCopyParagraphPropertyXmlModel(context) {
394359
394516
  let match;
394360
394517
  while (match = stylePattern.exec(xml)) {
394361
394518
  const styleXml = match[0];
394362
- const open = new RegExp(`^<${prefix}:style\\b[^>]*>`).exec(styleXml)?.[0] ?? "";
394363
- if (readQualifiedXmlAttribute(open, normalized.prefix, "type") !== "paragraph")
394519
+ const open2 = new RegExp(`^<${prefix}:style\\b[^>]*>`).exec(styleXml)?.[0] ?? "";
394520
+ if (readQualifiedXmlAttribute(open2, normalized.prefix, "type") !== "paragraph")
394364
394521
  continue;
394365
- const styleId = readQualifiedXmlAttribute(open, normalized.prefix, "styleId");
394522
+ const styleId = readQualifiedXmlAttribute(open2, normalized.prefix, "styleId");
394366
394523
  if (!styleId)
394367
394524
  continue;
394368
394525
  const basedOnOpen = new RegExp(`<${prefix}:basedOn\\b[^>]*>`).exec(styleXml)?.[0] ?? "";
@@ -396666,7 +396823,7 @@ function resolveBlockBoundarySelection(context, at) {
396666
396823
  if (!bytes)
396667
396824
  invalid4("PRECONDITION_FAILED", "Source story bytes are unavailable.");
396668
396825
  const catalog = buildTableCatalog({ bytes, storyId: story.storyId });
396669
- const resolve = (point3, side) => {
396826
+ const resolve2 = (point3, side) => {
396670
396827
  if (point3.kind === "text")
396671
396828
  return point3;
396672
396829
  const { node: node4 } = point3;
@@ -396706,8 +396863,8 @@ function resolveBlockBoundarySelection(context, at) {
396706
396863
  ...storyLocator ? { story: storyLocator } : {}
396707
396864
  };
396708
396865
  };
396709
- const start = resolve(at.start, "start");
396710
- const end = resolve(at.end, "end");
396866
+ const start = resolve2(at.start, "start");
396867
+ const end = resolve2(at.end, "end");
396711
396868
  return start && end ? { ...at, start, end } : null;
396712
396869
  }
396713
396870
  function captureSelectionOoxml(context, input) {
@@ -405215,17 +405372,17 @@ var init_yjs = __esm(() => {
405215
405372
  this.isLoaded = false;
405216
405373
  this.isSynced = false;
405217
405374
  this.isDestroyed = false;
405218
- this.whenLoaded = create4((resolve) => {
405375
+ this.whenLoaded = create4((resolve2) => {
405219
405376
  this.on("load", () => {
405220
405377
  this.isLoaded = true;
405221
- resolve(this);
405378
+ resolve2(this);
405222
405379
  });
405223
405380
  });
405224
- const provideSyncedPromise = () => create4((resolve) => {
405381
+ const provideSyncedPromise = () => create4((resolve2) => {
405225
405382
  const eventHandler = (isSynced) => {
405226
405383
  if (isSynced === undefined || isSynced === true) {
405227
405384
  this.off("sync", eventHandler);
405228
- resolve();
405385
+ resolve2();
405229
405386
  }
405230
405387
  };
405231
405388
  this.on("sync", eventHandler);
@@ -407692,14 +407849,14 @@ function createSyncWaitQueue() {
407692
407849
  let rejectWaiters = [];
407693
407850
  return {
407694
407851
  wait(timeoutMs, makeTimeoutError) {
407695
- return new Promise((resolve, reject2) => {
407852
+ return new Promise((resolve2, reject2) => {
407696
407853
  let settled = false;
407697
407854
  const onResolve = () => {
407698
407855
  if (settled)
407699
407856
  return;
407700
407857
  settled = true;
407701
407858
  clearTimeout(timer);
407702
- resolve();
407859
+ resolve2();
407703
407860
  };
407704
407861
  const onReject = (error48) => {
407705
407862
  if (settled)
@@ -407724,8 +407881,8 @@ function createSyncWaitQueue() {
407724
407881
  const waiters = resolveWaiters;
407725
407882
  resolveWaiters = [];
407726
407883
  rejectWaiters = [];
407727
- for (const resolve of waiters)
407728
- resolve();
407884
+ for (const resolve2 of waiters)
407885
+ resolve2();
407729
407886
  },
407730
407887
  rejectAll(error48) {
407731
407888
  const waiters = rejectWaiters;
@@ -408323,7 +408480,7 @@ var require_src2 = __commonJS((exports) => {
408323
408480
  };
408324
408481
  }
408325
408482
  async function sleep(delay) {
408326
- return new Promise((resolve) => setTimeout(resolve, delay));
408483
+ return new Promise((resolve2) => setTimeout(resolve2, delay));
408327
408484
  }
408328
408485
  exports.sleep = sleep;
408329
408486
  function defaultCalculateDelay(context, options) {
@@ -408402,11 +408559,11 @@ var require_src2 = __commonJS((exports) => {
408402
408559
  context.attemptsRemaining--;
408403
408560
  }
408404
408561
  if (options.timeout) {
408405
- return new Promise((resolve, reject2) => {
408562
+ return new Promise((resolve2, reject2) => {
408406
408563
  const timer = setTimeout(() => {
408407
408564
  if (options.handleTimeout) {
408408
408565
  try {
408409
- resolve(options.handleTimeout(context, options));
408566
+ resolve2(options.handleTimeout(context, options));
408410
408567
  } catch (e) {
408411
408568
  reject2(e);
408412
408569
  }
@@ -408418,10 +408575,10 @@ var require_src2 = __commonJS((exports) => {
408418
408575
  }, options.timeout);
408419
408576
  attemptFunc(context, options).then((result) => {
408420
408577
  clearTimeout(timer);
408421
- resolve(result);
408578
+ resolve2(result);
408422
408579
  }).catch((err2) => {
408423
408580
  clearTimeout(timer);
408424
- onError(err2).then(resolve).catch(reject2);
408581
+ onError(err2).then(resolve2).catch(reject2);
408425
408582
  });
408426
408583
  });
408427
408584
  } else {
@@ -409433,7 +409590,7 @@ var init_hocuspocus_provider_esm = __esm(() => {
409433
409590
  this.webSocket = null;
409434
409591
  }
409435
409592
  createWebSocketConnection() {
409436
- return new Promise((resolve, reject2) => {
409593
+ return new Promise((resolve2, reject2) => {
409437
409594
  if (this.webSocket) {
409438
409595
  this.messageQueue = [];
409439
409596
  this.cleanupWebSocket();
@@ -409448,7 +409605,7 @@ var init_hocuspocus_provider_esm = __esm(() => {
409448
409605
  this.status = WebSocketStatus.Connecting;
409449
409606
  this.emit("status", { status: WebSocketStatus.Connecting });
409450
409607
  this.connectionAttempt = {
409451
- resolve,
409608
+ resolve: resolve2,
409452
409609
  reject: reject2
409453
409610
  };
409454
409611
  });
@@ -410650,17 +410807,17 @@ async function autoRetry(promiseFn, maxTries, backoff, shouldStopRetrying = DONT
410650
410807
  }
410651
410808
  }
410652
410809
  function controlledPromise() {
410653
- let resolve;
410810
+ let resolve2;
410654
410811
  let reject2;
410655
410812
  const promise3 = new Promise((res, rej) => {
410656
- resolve = res;
410813
+ resolve2 = res;
410657
410814
  reject2 = rej;
410658
410815
  });
410659
- return [promise3, resolve, reject2];
410816
+ return [promise3, resolve2, reject2];
410660
410817
  }
410661
410818
  function Promise_withResolvers() {
410662
- const [promise3, resolve, reject2] = controlledPromise();
410663
- return { promise: promise3, resolve, reject: reject2 };
410819
+ const [promise3, resolve2, reject2] = controlledPromise();
410820
+ return { promise: promise3, resolve: resolve2, reject: reject2 };
410664
410821
  }
410665
410822
  function replacer(_key, value2) {
410666
410823
  return value2 !== null && typeof value2 === "object" && !Array.isArray(value2) ? Object.keys(value2).sort().reduce((sorted, key2) => {
@@ -411773,7 +411930,7 @@ function createConnectionStateMachine(delegates, options) {
411773
411930
  let socketOpenAt = null;
411774
411931
  let capturedPrematureEvent = null;
411775
411932
  let unconfirmedSocket = null;
411776
- const connect$ = new Promise((resolve, rej) => {
411933
+ const connect$ = new Promise((resolve2, rej) => {
411777
411934
  if (ctx.authValue === null) {
411778
411935
  throw new Error("No auth authValue");
411779
411936
  }
@@ -411818,7 +411975,7 @@ function createConnectionStateMachine(delegates, options) {
411818
411975
  socket.removeEventListener("message", waitForActorId);
411819
411976
  };
411820
411977
  actor$.then(() => {
411821
- resolve([socket, unsub]);
411978
+ resolve2([socket, unsub]);
411822
411979
  });
411823
411980
  });
411824
411981
  });
@@ -412615,13 +412772,13 @@ function createAi(config2) {
412615
412772
  if (managedSocket.getStatus() !== "connected") {
412616
412773
  await managedSocket.events.didConnect.waitUntil();
412617
412774
  }
412618
- const { promise: promise3, resolve, reject: reject2 } = Promise_withResolvers();
412775
+ const { promise: promise3, resolve: resolve2, reject: reject2 } = Promise_withResolvers();
412619
412776
  const abortSignal = AbortSignal.timeout(DEFAULT_REQUEST_TIMEOUT);
412620
412777
  abortSignal.addEventListener("abort", () => reject2(abortSignal.reason), {
412621
412778
  once: true
412622
412779
  });
412623
412780
  const cmdId = nanoid3(7);
412624
- context.pendingCmds.set(cmdId, { resolve, reject: reject2 });
412781
+ context.pendingCmds.set(cmdId, { resolve: resolve2, reject: reject2 });
412625
412782
  sendClientMsg({ ...msg, cmdId });
412626
412783
  return promise3.finally(() => {
412627
412784
  context.pendingCmds.delete(cmdId);
@@ -414685,8 +414842,8 @@ function createRoom(options, config2) {
414685
414842
  function startLoadingStorage() {
414686
414843
  if (_getStorage$ === null) {
414687
414844
  refreshStorage({ flush: true });
414688
- _getStorage$ = new Promise((resolve) => {
414689
- _resolveStoragePromise = resolve;
414845
+ _getStorage$ = new Promise((resolve2) => {
414846
+ _resolveStoragePromise = resolve2;
414690
414847
  });
414691
414848
  notifyStorageStatus();
414692
414849
  }
@@ -414832,9 +414989,9 @@ function createRoom(options, config2) {
414832
414989
  }
414833
414990
  async function waitUntilPresenceReady() {
414834
414991
  while (!isPresenceReady()) {
414835
- const { promise: promise3, resolve } = Promise_withResolvers();
414836
- const unsub1 = events.self.subscribeOnce(resolve);
414837
- const unsub2 = events.status.subscribeOnce(resolve);
414992
+ const { promise: promise3, resolve: resolve2 } = Promise_withResolvers();
414993
+ const unsub1 = events.self.subscribeOnce(resolve2);
414994
+ const unsub2 = events.status.subscribeOnce(resolve2);
414838
414995
  await promise3;
414839
414996
  unsub1();
414840
414997
  unsub2();
@@ -415625,9 +415782,9 @@ var __defProp2, __export2 = (target, all3) => {
415625
415782
  promise;
415626
415783
  constructor(input) {
415627
415784
  this.input = input;
415628
- const { promise: promise3, resolve, reject: reject2 } = Promise_withResolvers();
415785
+ const { promise: promise3, resolve: resolve2, reject: reject2 } = Promise_withResolvers();
415629
415786
  this.promise = promise3;
415630
- this.resolve = resolve;
415787
+ this.resolve = resolve2;
415631
415788
  this.reject = reject2;
415632
415789
  }
415633
415790
  }, Batch = class {
@@ -419351,10 +419508,10 @@ var init_base64 = __esm(() => {
419351
419508
  });
419352
419509
 
419353
419510
  // ../../../v2/node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/indexeddb.js
419354
- var rtop = (request) => create4((resolve, reject2) => {
419511
+ var rtop = (request) => create4((resolve2, reject2) => {
419355
419512
  request.onerror = (event) => reject2(new Error(event.target.error));
419356
- request.onsuccess = (event) => resolve(event.target.result);
419357
- }), openDB = (name, initDB) => create4((resolve, reject2) => {
419513
+ request.onsuccess = (event) => resolve2(event.target.result);
419514
+ }), openDB = (name, initDB) => create4((resolve2, reject2) => {
419358
419515
  const request = indexedDB.open(name);
419359
419516
  request.onupgradeneeded = (event) => initDB(event.target.result);
419360
419517
  request.onerror = (event) => reject2(create3(event.target.error));
@@ -419363,7 +419520,7 @@ var rtop = (request) => create4((resolve, reject2) => {
419363
419520
  db.onversionchange = () => {
419364
419521
  db.close();
419365
419522
  };
419366
- resolve(db);
419523
+ resolve2(db);
419367
419524
  };
419368
419525
  }), deleteDB = (name) => rtop(indexedDB.deleteDatabase(name)), createStores = (db, definitions) => definitions.forEach((d) => db.createObjectStore.apply(db, d)), transact2 = (db, stores, access = "readwrite") => {
419369
419526
  const transaction = db.transaction(stores, access);
@@ -419374,12 +419531,12 @@ var rtop = (request) => create4((resolve, reject2) => {
419374
419531
  first = key2;
419375
419532
  return false;
419376
419533
  }, direction).then(() => first);
419377
- }, getLastKey = (store, range = null) => queryFirst(store, range, "prev"), iterateOnRequest = (request, f) => create4((resolve, reject2) => {
419534
+ }, getLastKey = (store, range = null) => queryFirst(store, range, "prev"), iterateOnRequest = (request, f) => create4((resolve2, reject2) => {
419378
419535
  request.onerror = reject2;
419379
419536
  request.onsuccess = async (event) => {
419380
419537
  const cursor = event.target.result;
419381
419538
  if (cursor === null || await f(cursor) === false) {
419382
- return resolve();
419539
+ return resolve2();
419383
419540
  }
419384
419541
  cursor.continue();
419385
419542
  };
@@ -419430,7 +419587,7 @@ var init_y_indexeddb = __esm(() => {
419430
419587
  ["updates", { autoIncrement: true }],
419431
419588
  ["custom"]
419432
419589
  ]));
419433
- this.whenSynced = create4((resolve) => this.on("synced", () => resolve(this)));
419590
+ this.whenSynced = create4((resolve2) => this.on("synced", () => resolve2(this)));
419434
419591
  this._db.then((db) => {
419435
419592
  this.db = db;
419436
419593
  const beforeApplyUpdatesCallback = (updatesStore) => addAutoKey(updatesStore, encodeStateAsUpdate(doc2));
@@ -422538,8 +422695,8 @@ function pickLeader(claims, selfClaimerId, selfSha256, diagnostics) {
422538
422695
  }
422539
422696
  return activeClaims[0].claimerId;
422540
422697
  }
422541
- var DEFAULT_SETTLING_RESOLVER = () => new Promise((resolve) => {
422542
- queueMicrotask(resolve);
422698
+ var DEFAULT_SETTLING_RESOLVER = () => new Promise((resolve2) => {
422699
+ queueMicrotask(resolve2);
422543
422700
  });
422544
422701
  var init_bootstrap = __esm(() => {
422545
422702
  init_yjs();
@@ -423675,24 +423832,24 @@ function readDirectPPrChildren(pPrXml) {
423675
423832
  function scanNextElement(body, cursor) {
423676
423833
  let scanCursor = cursor;
423677
423834
  while (scanCursor < body.length) {
423678
- const open = body.indexOf("<", scanCursor);
423679
- if (open < 0)
423835
+ const open2 = body.indexOf("<", scanCursor);
423836
+ if (open2 < 0)
423680
423837
  return null;
423681
- const node4 = readXmlNodeAt(body, open);
423838
+ const node4 = readXmlNodeAt(body, open2);
423682
423839
  if (!node4)
423683
423840
  return null;
423684
423841
  if (node4.kind === "markup") {
423685
423842
  scanCursor = node4.end;
423686
423843
  continue;
423687
423844
  }
423688
- const openTag = body.slice(open, node4.openEnd);
423845
+ const openTag = body.slice(open2, node4.openEnd);
423689
423846
  const openTagInner = openTag.slice(1, openTag.endsWith("/>") ? -2 : -1).trimEnd();
423690
423847
  return {
423691
- start: open,
423848
+ start: open2,
423692
423849
  end: node4.end,
423693
423850
  openTag,
423694
423851
  openTagInner,
423695
- xml: body.slice(open, node4.end)
423852
+ xml: body.slice(open2, node4.end)
423696
423853
  };
423697
423854
  }
423698
423855
  return null;
@@ -423989,18 +424146,18 @@ function namespaceBindingsForElement(openTagInner, inheritedNamespaceBindings) {
423989
424146
  return bindings;
423990
424147
  }
423991
424148
  function stripTextTag(text4) {
423992
- const open = text4.indexOf(">");
424149
+ const open2 = text4.indexOf(">");
423993
424150
  const close = text4.lastIndexOf("<");
423994
- if (open < 0 || close < 0 || close <= open)
424151
+ if (open2 < 0 || close < 0 || close <= open2)
423995
424152
  return "";
423996
- return text4.slice(open + 1, close);
424153
+ return text4.slice(open2 + 1, close);
423997
424154
  }
423998
424155
  function stripOuterTag(xml) {
423999
- const open = xml.indexOf(">");
424156
+ const open2 = xml.indexOf(">");
424000
424157
  const close = xml.lastIndexOf("<");
424001
- if (open < 0 || close < 0 || close <= open)
424158
+ if (open2 < 0 || close < 0 || close <= open2)
424002
424159
  return "";
424003
- return xml.slice(open + 1, close);
424160
+ return xml.slice(open2 + 1, close);
424004
424161
  }
424005
424162
  function hasNonNamespaceAttributes(openTagInner) {
424006
424163
  const attrSource = openTagInner.replace(/^[^\s/>]+/, "");
@@ -431517,7 +431674,7 @@ async function waitForJournalSettled(rootDoc, options) {
431517
431674
  if (lastState.settled)
431518
431675
  return lastState;
431519
431676
  while (now3() < deadline) {
431520
- await new Promise((resolve) => setTimeout(resolve, poll));
431677
+ await new Promise((resolve2) => setTimeout(resolve2, poll));
431521
431678
  lastState = getJournalBarrierState(rootDoc, options);
431522
431679
  if (lastState.settled)
431523
431680
  return lastState;
@@ -437421,16 +437578,16 @@ function collectLiveTrackedWrapperSpans(atoms) {
437421
437578
  }
437422
437579
  if (openIndex < 0)
437423
437580
  continue;
437424
- const [open] = openStack.splice(openIndex, 1);
437581
+ const [open2] = openStack.splice(openIndex, 1);
437425
437582
  spans.push({
437426
- key: open.key,
437583
+ key: open2.key,
437427
437584
  kind: info.kind,
437428
- rsid: open.rsid,
437429
- openAtom: open.atom,
437585
+ rsid: open2.rsid,
437586
+ openAtom: open2.atom,
437430
437587
  closeAtom: atom,
437431
- startOffset: open.startOffset,
437588
+ startOffset: open2.startOffset,
437432
437589
  endOffset: atom.visibleOffset,
437433
- sameKindParentKey: open.sameKindParentKey
437590
+ sameKindParentKey: open2.sameKindParentKey
437434
437591
  });
437435
437592
  }
437436
437593
  return spans;
@@ -449569,11 +449726,11 @@ function contentTypeForPackagePart(partUri) {
449569
449726
  }
449570
449727
  function innerXmlOfRoot(xml) {
449571
449728
  const withoutDecl = xml.replace(/^\s*<\?xml[^>]*>\s*/i, "");
449572
- const open = /^<[^>]+>/.exec(withoutDecl);
449729
+ const open2 = /^<[^>]+>/.exec(withoutDecl);
449573
449730
  const close = /<\/[^>]+>\s*$/.exec(withoutDecl);
449574
- if (!open || !close || close.index <= open[0].length)
449731
+ if (!open2 || !close || close.index <= open2[0].length)
449575
449732
  return withoutDecl;
449576
- return withoutDecl.slice(open[0].length, close.index);
449733
+ return withoutDecl.slice(open2[0].length, close.index);
449577
449734
  }
449578
449735
  function attrLocal4(tag, localName3) {
449579
449736
  const re = new RegExp(String.raw`(?:[\w.-]+:)?${localName3}="([^"]+)"`);
@@ -450895,7 +451052,7 @@ async function applyPreparedRoomReplacement(input) {
450895
451052
  while (replacementQueue(input.rootDoc, input.replacement.operationId)[0]?.operationId !== input.replacement.operationId) {
450896
451053
  await Promise.all([waitForReplacementQueueChange(input.rootDoc), input.resync()]);
450897
451054
  }
450898
- await new Promise((resolve) => setTimeout(resolve, input.settlingMs));
451055
+ await new Promise((resolve2) => setTimeout(resolve2, input.settlingMs));
450899
451056
  await input.resync();
450900
451057
  if (replacementQueue(input.rootDoc, input.replacement.operationId)[0]?.operationId !== input.replacement.operationId) {
450901
451058
  return applyPreparedRoomReplacement(input);
@@ -451063,12 +451220,12 @@ function replacementRequestKey(operationId) {
451063
451220
  }
451064
451221
  async function waitForReplacementQueueChange(rootDoc) {
451065
451222
  const requests = getReplacementRequests(rootDoc);
451066
- await new Promise((resolve) => {
451223
+ await new Promise((resolve2) => {
451067
451224
  const timeout = setTimeout(finish, POST_SYNC_QUIET_WINDOW_MS);
451068
451225
  function finish() {
451069
451226
  clearTimeout(timeout);
451070
451227
  requests.unobserveDeep(finish);
451071
- resolve();
451228
+ resolve2();
451072
451229
  }
451073
451230
  requests.observeDeep(finish);
451074
451231
  });
@@ -451597,13 +451754,13 @@ async function waitForStoryShardSeeded(rootDoc, shardId) {
451597
451754
  await waitForDocUpdateSettling(rootDoc);
451598
451755
  return;
451599
451756
  }
451600
- await new Promise((resolve) => setTimeout(resolve, 10));
451757
+ await new Promise((resolve2) => setTimeout(resolve2, 10));
451601
451758
  }
451602
451759
  throw new Error(`collaboration story shard ${shardId} was not seeded by the room authority`);
451603
451760
  }
451604
451761
  async function waitForDocUpdateSettling(doc2, maxWaitMs = POST_SYNC_SETTLE_MAX_MS) {
451605
451762
  const boundedMaxWaitMs = normalizeBootstrapSettlingMs(maxWaitMs);
451606
- await new Promise((resolve) => {
451763
+ await new Promise((resolve2) => {
451607
451764
  let settled = false;
451608
451765
  let quietTimer = null;
451609
451766
  const hardTimeout = setTimeout(finish, boundedMaxWaitMs);
@@ -451615,7 +451772,7 @@ async function waitForDocUpdateSettling(doc2, maxWaitMs = POST_SYNC_SETTLE_MAX_M
451615
451772
  if (quietTimer)
451616
451773
  clearTimeout(quietTimer);
451617
451774
  doc2.off("update", onUpdate);
451618
- resolve();
451775
+ resolve2();
451619
451776
  }
451620
451777
  function armQuietWindow() {
451621
451778
  if (quietTimer)
@@ -452779,7 +452936,7 @@ var init_dist10 = __esm(() => {
452779
452936
  // src/session-manager.ts
452780
452937
  import { access, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
452781
452938
  import { randomBytes } from "node:crypto";
452782
- import { dirname, resolve, basename } from "node:path";
452939
+ import { dirname, resolve as resolve2, basename } from "node:path";
452783
452940
  import { fileURLToPath as fileURLToPath5 } from "node:url";
452784
452941
 
452785
452942
  class SessionManager {
@@ -452789,7 +452946,7 @@ class SessionManager {
452789
452946
  this.author = author;
452790
452947
  }
452791
452948
  async open(filePath) {
452792
- const absolutePath = resolve(filePath);
452949
+ const absolutePath = resolve2(filePath);
452793
452950
  const bytes = await readDocumentBytesOrBlank(absolutePath);
452794
452951
  const { openV2DocumentApiHost: openV2DocumentApiHost2 } = await loadV2HeadlessRuntime();
452795
452952
  const host = await openV2DocumentApiHost2({
@@ -452819,7 +452976,7 @@ class SessionManager {
452819
452976
  }
452820
452977
  async save(sessionId, outputPath) {
452821
452978
  const session = this.get(sessionId);
452822
- const targetPath = outputPath ? resolve(outputPath) : session.filePath;
452979
+ const targetPath = outputPath ? resolve2(outputPath) : session.filePath;
452823
452980
  const { saveDocumentSessionWithDiagnostics: saveDocumentSessionWithDiagnostics2 } = await loadV2HeadlessRuntime();
452824
452981
  const exported = saveDocumentSessionWithDiagnostics2(session.host.session);
452825
452982
  await writeFile2(targetPath, exported.bytes);
@@ -452852,7 +453009,7 @@ async function readDocumentBytesOrBlank(absolutePath) {
452852
453009
  const bytes = await readFile3(absolutePath);
452853
453010
  return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
452854
453011
  } catch {
452855
- const blankPath = resolve(MODULE_DIR3, "../../../shared/common/data/blank.docx");
453012
+ const blankPath = resolve2(MODULE_DIR3, "../../../shared/common/data/blank.docx");
452856
453013
  const bytes = await readFile3(blankPath);
452857
453014
  return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
452858
453015
  }