@courtifyai/docx-render 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -137,8 +137,8 @@ https://github.com/nodeca/pako/blob/main/LICENSE
137
137
  function o(h, b, d, _, u, v) {
138
138
  var E, A, T = h.file, L = h.compression, B = v !== p.utf8encode, j = s.transformTo("string", v(T.name)), z = s.transformTo("string", p.utf8encode(T.name)), Z = T.comment, Q = s.transformTo("string", v(Z)), k = s.transformTo("string", p.utf8encode(Z)), N = z.length !== T.name.length, l = k.length !== Z.length, D = "", et = "", U = "", rt = T.dir, W = T.date, tt = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
139
139
  b && !d || (tt.crc32 = h.crc32, tt.compressedSize = h.compressedSize, tt.uncompressedSize = h.uncompressedSize);
140
- var P = 0;
141
- b && (P |= 8), B || !N && !l || (P |= 2048);
140
+ var F = 0;
141
+ b && (F |= 8), B || !N && !l || (F |= 2048);
142
142
  var I = 0, J = 0;
143
143
  rt && (I |= 16), u === "UNIX" ? (J = 798, I |= function(V, lt) {
144
144
  var ut = V;
@@ -148,7 +148,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
148
148
  }(T.dosPermissions)), E = W.getUTCHours(), E <<= 6, E |= W.getUTCMinutes(), E <<= 5, E |= W.getUTCSeconds() / 2, A = W.getUTCFullYear() - 1980, A <<= 4, A |= W.getUTCMonth() + 1, A <<= 5, A |= W.getUTCDate(), N && (et = a(1, 1) + a(f(j), 4) + z, D += "up" + a(et.length, 2) + et), l && (U = a(1, 1) + a(f(Q), 4) + k, D += "uc" + a(U.length, 2) + U);
149
149
  var Y = "";
150
150
  return Y += `
151
- \0`, Y += a(P, 2), Y += L.magic, Y += a(E, 2), Y += a(A, 2), Y += a(tt.crc32, 4), Y += a(tt.compressedSize, 4), Y += a(tt.uncompressedSize, 4), Y += a(j.length, 2), Y += a(D.length, 2), { fileRecord: y.LOCAL_FILE_HEADER + Y + j + D, dirRecord: y.CENTRAL_FILE_HEADER + a(J, 2) + Y + a(Q.length, 2) + "\0\0\0\0" + a(I, 4) + a(_, 4) + j + D + Q };
151
+ \0`, Y += a(F, 2), Y += L.magic, Y += a(E, 2), Y += a(A, 2), Y += a(tt.crc32, 4), Y += a(tt.compressedSize, 4), Y += a(tt.uncompressedSize, 4), Y += a(j.length, 2), Y += a(D.length, 2), { fileRecord: y.LOCAL_FILE_HEADER + Y + j + D, dirRecord: y.CENTRAL_FILE_HEADER + a(J, 2) + Y + a(Q.length, 2) + "\0\0\0\0" + a(I, 4) + a(_, 4) + j + D + Q };
152
152
  }
153
153
  var s = t("../utils"), c = t("../stream/GenericWorker"), p = t("../utf8"), f = t("../crc32"), y = t("../signature");
154
154
  function m(h, b, d, _) {
@@ -1382,12 +1382,12 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1382
1382
  function tt(i) {
1383
1383
  for (var O = i.length; 0 <= --O; ) i[O] = 0;
1384
1384
  }
1385
- function P(i) {
1386
- var O = i.state, F = O.pending;
1387
- F > i.avail_out && (F = i.avail_out), F !== 0 && (o.arraySet(i.output, O.pending_buf, O.pending_out, F, i.next_out), i.next_out += F, O.pending_out += F, i.total_out += F, i.avail_out -= F, O.pending -= F, O.pending === 0 && (O.pending_out = 0));
1385
+ function F(i) {
1386
+ var O = i.state, P = O.pending;
1387
+ P > i.avail_out && (P = i.avail_out), P !== 0 && (o.arraySet(i.output, O.pending_buf, O.pending_out, P, i.next_out), i.next_out += P, O.pending_out += P, i.total_out += P, i.avail_out -= P, O.pending -= P, O.pending === 0 && (O.pending_out = 0));
1388
1388
  }
1389
1389
  function I(i, O) {
1390
- s._tr_flush_block(i, 0 <= i.block_start ? i.block_start : -1, i.strstart - i.block_start, O), i.block_start = i.strstart, P(i.strm);
1390
+ s._tr_flush_block(i, 0 <= i.block_start ? i.block_start : -1, i.strstart - i.block_start, O), i.block_start = i.strstart, F(i.strm);
1391
1391
  }
1392
1392
  function J(i, O) {
1393
1393
  i.pending_buf[i.pending++] = O;
@@ -1396,14 +1396,14 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1396
1396
  i.pending_buf[i.pending++] = O >>> 8 & 255, i.pending_buf[i.pending++] = 255 & O;
1397
1397
  }
1398
1398
  function V(i, O) {
1399
- var F, w, g = i.max_chain_length, S = i.strstart, M = i.prev_length, $ = i.nice_match, R = i.strstart > i.w_size - Q ? i.strstart - (i.w_size - Q) : 0, H = i.window, q = i.w_mask, G = i.prev, K = i.strstart + Z, ot = H[S + M - 1], st = H[S + M];
1399
+ var P, w, g = i.max_chain_length, S = i.strstart, M = i.prev_length, $ = i.nice_match, R = i.strstart > i.w_size - Q ? i.strstart - (i.w_size - Q) : 0, H = i.window, q = i.w_mask, G = i.prev, K = i.strstart + Z, ot = H[S + M - 1], st = H[S + M];
1400
1400
  i.prev_length >= i.good_match && (g >>= 2), $ > i.lookahead && ($ = i.lookahead);
1401
1401
  do
1402
- if (H[(F = O) + M] === st && H[F + M - 1] === ot && H[F] === H[S] && H[++F] === H[S + 1]) {
1403
- S += 2, F++;
1402
+ if (H[(P = O) + M] === st && H[P + M - 1] === ot && H[P] === H[S] && H[++P] === H[S + 1]) {
1403
+ S += 2, P++;
1404
1404
  do
1405
1405
  ;
1406
- while (H[++S] === H[++F] && H[++S] === H[++F] && H[++S] === H[++F] && H[++S] === H[++F] && H[++S] === H[++F] && H[++S] === H[++F] && H[++S] === H[++F] && H[++S] === H[++F] && S < K);
1406
+ while (H[++S] === H[++P] && H[++S] === H[++P] && H[++S] === H[++P] && H[++S] === H[++P] && H[++S] === H[++P] && H[++S] === H[++P] && H[++S] === H[++P] && H[++S] === H[++P] && S < K);
1407
1407
  if (w = Z - (K - S), S = K - Z, M < w) {
1408
1408
  if (i.match_start = O, $ <= (M = w)) break;
1409
1409
  ot = H[S + M - 1], st = H[S + M];
@@ -1413,25 +1413,25 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1413
1413
  return M <= i.lookahead ? M : i.lookahead;
1414
1414
  }
1415
1415
  function lt(i) {
1416
- var O, F, w, g, S, M, $, R, H, q, G = i.w_size;
1416
+ var O, P, w, g, S, M, $, R, H, q, G = i.w_size;
1417
1417
  do {
1418
1418
  if (g = i.window_size - i.lookahead - i.strstart, i.strstart >= G + (G - Q)) {
1419
- for (o.arraySet(i.window, i.window, G, G, 0), i.match_start -= G, i.strstart -= G, i.block_start -= G, O = F = i.hash_size; w = i.head[--O], i.head[O] = G <= w ? w - G : 0, --F; ) ;
1420
- for (O = F = G; w = i.prev[--O], i.prev[O] = G <= w ? w - G : 0, --F; ) ;
1419
+ for (o.arraySet(i.window, i.window, G, G, 0), i.match_start -= G, i.strstart -= G, i.block_start -= G, O = P = i.hash_size; w = i.head[--O], i.head[O] = G <= w ? w - G : 0, --P; ) ;
1420
+ for (O = P = G; w = i.prev[--O], i.prev[O] = G <= w ? w - G : 0, --P; ) ;
1421
1421
  g += G;
1422
1422
  }
1423
1423
  if (i.strm.avail_in === 0) break;
1424
- if (M = i.strm, $ = i.window, R = i.strstart + i.lookahead, H = g, q = void 0, q = M.avail_in, H < q && (q = H), F = q === 0 ? 0 : (M.avail_in -= q, o.arraySet($, M.input, M.next_in, q, R), M.state.wrap === 1 ? M.adler = c(M.adler, $, q, R) : M.state.wrap === 2 && (M.adler = p(M.adler, $, q, R)), M.next_in += q, M.total_in += q, q), i.lookahead += F, i.lookahead + i.insert >= z) for (S = i.strstart - i.insert, i.ins_h = i.window[S], i.ins_h = (i.ins_h << i.hash_shift ^ i.window[S + 1]) & i.hash_mask; i.insert && (i.ins_h = (i.ins_h << i.hash_shift ^ i.window[S + z - 1]) & i.hash_mask, i.prev[S & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = S, S++, i.insert--, !(i.lookahead + i.insert < z)); ) ;
1424
+ if (M = i.strm, $ = i.window, R = i.strstart + i.lookahead, H = g, q = void 0, q = M.avail_in, H < q && (q = H), P = q === 0 ? 0 : (M.avail_in -= q, o.arraySet($, M.input, M.next_in, q, R), M.state.wrap === 1 ? M.adler = c(M.adler, $, q, R) : M.state.wrap === 2 && (M.adler = p(M.adler, $, q, R)), M.next_in += q, M.total_in += q, q), i.lookahead += P, i.lookahead + i.insert >= z) for (S = i.strstart - i.insert, i.ins_h = i.window[S], i.ins_h = (i.ins_h << i.hash_shift ^ i.window[S + 1]) & i.hash_mask; i.insert && (i.ins_h = (i.ins_h << i.hash_shift ^ i.window[S + z - 1]) & i.hash_mask, i.prev[S & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = S, S++, i.insert--, !(i.lookahead + i.insert < z)); ) ;
1425
1425
  } while (i.lookahead < Q && i.strm.avail_in !== 0);
1426
1426
  }
1427
1427
  function ut(i, O) {
1428
- for (var F, w; ; ) {
1428
+ for (var P, w; ; ) {
1429
1429
  if (i.lookahead < Q) {
1430
1430
  if (lt(i), i.lookahead < Q && O === y) return l;
1431
1431
  if (i.lookahead === 0) break;
1432
1432
  }
1433
- if (F = 0, i.lookahead >= z && (i.ins_h = (i.ins_h << i.hash_shift ^ i.window[i.strstart + z - 1]) & i.hash_mask, F = i.prev[i.strstart & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = i.strstart), F !== 0 && i.strstart - F <= i.w_size - Q && (i.match_length = V(i, F)), i.match_length >= z) if (w = s._tr_tally(i, i.strstart - i.match_start, i.match_length - z), i.lookahead -= i.match_length, i.match_length <= i.max_lazy_match && i.lookahead >= z) {
1434
- for (i.match_length--; i.strstart++, i.ins_h = (i.ins_h << i.hash_shift ^ i.window[i.strstart + z - 1]) & i.hash_mask, F = i.prev[i.strstart & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = i.strstart, --i.match_length != 0; ) ;
1433
+ if (P = 0, i.lookahead >= z && (i.ins_h = (i.ins_h << i.hash_shift ^ i.window[i.strstart + z - 1]) & i.hash_mask, P = i.prev[i.strstart & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = i.strstart), P !== 0 && i.strstart - P <= i.w_size - Q && (i.match_length = V(i, P)), i.match_length >= z) if (w = s._tr_tally(i, i.strstart - i.match_start, i.match_length - z), i.lookahead -= i.match_length, i.match_length <= i.max_lazy_match && i.lookahead >= z) {
1434
+ for (i.match_length--; i.strstart++, i.ins_h = (i.ins_h << i.hash_shift ^ i.window[i.strstart + z - 1]) & i.hash_mask, P = i.prev[i.strstart & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = i.strstart, --i.match_length != 0; ) ;
1435
1435
  i.strstart++;
1436
1436
  } else i.strstart += i.match_length, i.match_length = 0, i.ins_h = i.window[i.strstart], i.ins_h = (i.ins_h << i.hash_shift ^ i.window[i.strstart + 1]) & i.hash_mask;
1437
1437
  else w = s._tr_tally(i, 0, i.window[i.strstart]), i.lookahead--, i.strstart++;
@@ -1440,13 +1440,13 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1440
1440
  return i.insert = i.strstart < z - 1 ? i.strstart : z - 1, O === m ? (I(i, !0), i.strm.avail_out === 0 ? et : U) : i.last_lit && (I(i, !1), i.strm.avail_out === 0) ? l : D;
1441
1441
  }
1442
1442
  function it(i, O) {
1443
- for (var F, w, g; ; ) {
1443
+ for (var P, w, g; ; ) {
1444
1444
  if (i.lookahead < Q) {
1445
1445
  if (lt(i), i.lookahead < Q && O === y) return l;
1446
1446
  if (i.lookahead === 0) break;
1447
1447
  }
1448
- if (F = 0, i.lookahead >= z && (i.ins_h = (i.ins_h << i.hash_shift ^ i.window[i.strstart + z - 1]) & i.hash_mask, F = i.prev[i.strstart & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = i.strstart), i.prev_length = i.match_length, i.prev_match = i.match_start, i.match_length = z - 1, F !== 0 && i.prev_length < i.max_lazy_match && i.strstart - F <= i.w_size - Q && (i.match_length = V(i, F), i.match_length <= 5 && (i.strategy === 1 || i.match_length === z && 4096 < i.strstart - i.match_start) && (i.match_length = z - 1)), i.prev_length >= z && i.match_length <= i.prev_length) {
1449
- for (g = i.strstart + i.lookahead - z, w = s._tr_tally(i, i.strstart - 1 - i.prev_match, i.prev_length - z), i.lookahead -= i.prev_length - 1, i.prev_length -= 2; ++i.strstart <= g && (i.ins_h = (i.ins_h << i.hash_shift ^ i.window[i.strstart + z - 1]) & i.hash_mask, F = i.prev[i.strstart & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = i.strstart), --i.prev_length != 0; ) ;
1448
+ if (P = 0, i.lookahead >= z && (i.ins_h = (i.ins_h << i.hash_shift ^ i.window[i.strstart + z - 1]) & i.hash_mask, P = i.prev[i.strstart & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = i.strstart), i.prev_length = i.match_length, i.prev_match = i.match_start, i.match_length = z - 1, P !== 0 && i.prev_length < i.max_lazy_match && i.strstart - P <= i.w_size - Q && (i.match_length = V(i, P), i.match_length <= 5 && (i.strategy === 1 || i.match_length === z && 4096 < i.strstart - i.match_start) && (i.match_length = z - 1)), i.prev_length >= z && i.match_length <= i.prev_length) {
1449
+ for (g = i.strstart + i.lookahead - z, w = s._tr_tally(i, i.strstart - 1 - i.prev_match, i.prev_length - z), i.lookahead -= i.prev_length - 1, i.prev_length -= 2; ++i.strstart <= g && (i.ins_h = (i.ins_h << i.hash_shift ^ i.window[i.strstart + z - 1]) & i.hash_mask, P = i.prev[i.strstart & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = i.strstart), --i.prev_length != 0; ) ;
1450
1450
  if (i.match_available = 0, i.match_length = z - 1, i.strstart++, w && (I(i, !1), i.strm.avail_out === 0)) return l;
1451
1451
  } else if (i.match_available) {
1452
1452
  if ((w = s._tr_tally(i, 0, i.window[i.strstart - 1])) && I(i, !1), i.strstart++, i.lookahead--, i.strm.avail_out === 0) return l;
@@ -1454,8 +1454,8 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1454
1454
  }
1455
1455
  return i.match_available && (w = s._tr_tally(i, 0, i.window[i.strstart - 1]), i.match_available = 0), i.insert = i.strstart < z - 1 ? i.strstart : z - 1, O === m ? (I(i, !0), i.strm.avail_out === 0 ? et : U) : i.last_lit && (I(i, !1), i.strm.avail_out === 0) ? l : D;
1456
1456
  }
1457
- function at(i, O, F, w, g) {
1458
- this.good_length = i, this.max_lazy = O, this.nice_length = F, this.max_chain = w, this.func = g;
1457
+ function at(i, O, P, w, g) {
1458
+ this.good_length = i, this.max_lazy = O, this.nice_length = P, this.max_chain = w, this.func = g;
1459
1459
  }
1460
1460
  function dt() {
1461
1461
  this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new o.Buf16(2 * B), this.dyn_dtree = new o.Buf16(2 * (2 * T + 1)), this.bl_tree = new o.Buf16(2 * (2 * L + 1)), tt(this.dyn_ltree), tt(this.dyn_dtree), tt(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new o.Buf16(j + 1), this.heap = new o.Buf16(2 * A + 1), tt(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new o.Buf16(2 * A + 1), tt(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
@@ -1466,27 +1466,27 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1466
1466
  }
1467
1467
  function bt(i) {
1468
1468
  var O = ct(i);
1469
- return O === h && function(F) {
1470
- F.window_size = 2 * F.w_size, tt(F.head), F.max_lazy_match = a[F.level].max_lazy, F.good_match = a[F.level].good_length, F.nice_match = a[F.level].nice_length, F.max_chain_length = a[F.level].max_chain, F.strstart = 0, F.block_start = 0, F.lookahead = 0, F.insert = 0, F.match_length = F.prev_length = z - 1, F.match_available = 0, F.ins_h = 0;
1469
+ return O === h && function(P) {
1470
+ P.window_size = 2 * P.w_size, tt(P.head), P.max_lazy_match = a[P.level].max_lazy, P.good_match = a[P.level].good_length, P.nice_match = a[P.level].nice_length, P.max_chain_length = a[P.level].max_chain, P.strstart = 0, P.block_start = 0, P.lookahead = 0, P.insert = 0, P.match_length = P.prev_length = z - 1, P.match_available = 0, P.ins_h = 0;
1471
1471
  }(i.state), O;
1472
1472
  }
1473
- function pt(i, O, F, w, g, S) {
1473
+ function pt(i, O, P, w, g, S) {
1474
1474
  if (!i) return b;
1475
1475
  var M = 1;
1476
- if (O === d && (O = 6), w < 0 ? (M = 0, w = -w) : 15 < w && (M = 2, w -= 16), g < 1 || E < g || F !== v || w < 8 || 15 < w || O < 0 || 9 < O || S < 0 || _ < S) return rt(i, b);
1476
+ if (O === d && (O = 6), w < 0 ? (M = 0, w = -w) : 15 < w && (M = 2, w -= 16), g < 1 || E < g || P !== v || w < 8 || 15 < w || O < 0 || 9 < O || S < 0 || _ < S) return rt(i, b);
1477
1477
  w === 8 && (w = 9);
1478
1478
  var $ = new dt();
1479
- return (i.state = $).strm = i, $.wrap = M, $.gzhead = null, $.w_bits = w, $.w_size = 1 << $.w_bits, $.w_mask = $.w_size - 1, $.hash_bits = g + 7, $.hash_size = 1 << $.hash_bits, $.hash_mask = $.hash_size - 1, $.hash_shift = ~~(($.hash_bits + z - 1) / z), $.window = new o.Buf8(2 * $.w_size), $.head = new o.Buf16($.hash_size), $.prev = new o.Buf16($.w_size), $.lit_bufsize = 1 << g + 6, $.pending_buf_size = 4 * $.lit_bufsize, $.pending_buf = new o.Buf8($.pending_buf_size), $.d_buf = 1 * $.lit_bufsize, $.l_buf = 3 * $.lit_bufsize, $.level = O, $.strategy = S, $.method = F, bt(i);
1479
+ return (i.state = $).strm = i, $.wrap = M, $.gzhead = null, $.w_bits = w, $.w_size = 1 << $.w_bits, $.w_mask = $.w_size - 1, $.hash_bits = g + 7, $.hash_size = 1 << $.hash_bits, $.hash_mask = $.hash_size - 1, $.hash_shift = ~~(($.hash_bits + z - 1) / z), $.window = new o.Buf8(2 * $.w_size), $.head = new o.Buf16($.hash_size), $.prev = new o.Buf16($.w_size), $.lit_bufsize = 1 << g + 6, $.pending_buf_size = 4 * $.lit_bufsize, $.pending_buf = new o.Buf8($.pending_buf_size), $.d_buf = 1 * $.lit_bufsize, $.l_buf = 3 * $.lit_bufsize, $.level = O, $.strategy = S, $.method = P, bt(i);
1480
1480
  }
1481
1481
  a = [new at(0, 0, 0, 0, function(i, O) {
1482
- var F = 65535;
1483
- for (F > i.pending_buf_size - 5 && (F = i.pending_buf_size - 5); ; ) {
1482
+ var P = 65535;
1483
+ for (P > i.pending_buf_size - 5 && (P = i.pending_buf_size - 5); ; ) {
1484
1484
  if (i.lookahead <= 1) {
1485
1485
  if (lt(i), i.lookahead === 0 && O === y) return l;
1486
1486
  if (i.lookahead === 0) break;
1487
1487
  }
1488
1488
  i.strstart += i.lookahead, i.lookahead = 0;
1489
- var w = i.block_start + F;
1489
+ var w = i.block_start + P;
1490
1490
  if ((i.strstart === 0 || i.strstart >= w) && (i.lookahead = i.strstart - w, i.strstart = w, I(i, !1), i.strm.avail_out === 0) || i.strstart - i.block_start >= i.w_size - Q && (I(i, !1), i.strm.avail_out === 0)) return l;
1491
1491
  }
1492
1492
  return i.insert = 0, O === m ? (I(i, !0), i.strm.avail_out === 0 ? et : U) : (i.strstart > i.block_start && (I(i, !1), i.strm.avail_out), l);
@@ -1495,22 +1495,22 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1495
1495
  }, n.deflateInit2 = pt, n.deflateReset = bt, n.deflateResetKeep = ct, n.deflateSetHeader = function(i, O) {
1496
1496
  return i && i.state ? i.state.wrap !== 2 ? b : (i.state.gzhead = O, h) : b;
1497
1497
  }, n.deflate = function(i, O) {
1498
- var F, w, g, S;
1498
+ var P, w, g, S;
1499
1499
  if (!i || !i.state || 5 < O || O < 0) return i ? rt(i, b) : b;
1500
1500
  if (w = i.state, !i.output || !i.input && i.avail_in !== 0 || w.status === 666 && O !== m) return rt(i, i.avail_out === 0 ? -5 : b);
1501
- if (w.strm = i, F = w.last_flush, w.last_flush = O, w.status === k) if (w.wrap === 2) i.adler = 0, J(w, 31), J(w, 139), J(w, 8), w.gzhead ? (J(w, (w.gzhead.text ? 1 : 0) + (w.gzhead.hcrc ? 2 : 0) + (w.gzhead.extra ? 4 : 0) + (w.gzhead.name ? 8 : 0) + (w.gzhead.comment ? 16 : 0)), J(w, 255 & w.gzhead.time), J(w, w.gzhead.time >> 8 & 255), J(w, w.gzhead.time >> 16 & 255), J(w, w.gzhead.time >> 24 & 255), J(w, w.level === 9 ? 2 : 2 <= w.strategy || w.level < 2 ? 4 : 0), J(w, 255 & w.gzhead.os), w.gzhead.extra && w.gzhead.extra.length && (J(w, 255 & w.gzhead.extra.length), J(w, w.gzhead.extra.length >> 8 & 255)), w.gzhead.hcrc && (i.adler = p(i.adler, w.pending_buf, w.pending, 0)), w.gzindex = 0, w.status = 69) : (J(w, 0), J(w, 0), J(w, 0), J(w, 0), J(w, 0), J(w, w.level === 9 ? 2 : 2 <= w.strategy || w.level < 2 ? 4 : 0), J(w, 3), w.status = N);
1501
+ if (w.strm = i, P = w.last_flush, w.last_flush = O, w.status === k) if (w.wrap === 2) i.adler = 0, J(w, 31), J(w, 139), J(w, 8), w.gzhead ? (J(w, (w.gzhead.text ? 1 : 0) + (w.gzhead.hcrc ? 2 : 0) + (w.gzhead.extra ? 4 : 0) + (w.gzhead.name ? 8 : 0) + (w.gzhead.comment ? 16 : 0)), J(w, 255 & w.gzhead.time), J(w, w.gzhead.time >> 8 & 255), J(w, w.gzhead.time >> 16 & 255), J(w, w.gzhead.time >> 24 & 255), J(w, w.level === 9 ? 2 : 2 <= w.strategy || w.level < 2 ? 4 : 0), J(w, 255 & w.gzhead.os), w.gzhead.extra && w.gzhead.extra.length && (J(w, 255 & w.gzhead.extra.length), J(w, w.gzhead.extra.length >> 8 & 255)), w.gzhead.hcrc && (i.adler = p(i.adler, w.pending_buf, w.pending, 0)), w.gzindex = 0, w.status = 69) : (J(w, 0), J(w, 0), J(w, 0), J(w, 0), J(w, 0), J(w, w.level === 9 ? 2 : 2 <= w.strategy || w.level < 2 ? 4 : 0), J(w, 3), w.status = N);
1502
1502
  else {
1503
1503
  var M = v + (w.w_bits - 8 << 4) << 8;
1504
1504
  M |= (2 <= w.strategy || w.level < 2 ? 0 : w.level < 6 ? 1 : w.level === 6 ? 2 : 3) << 6, w.strstart !== 0 && (M |= 32), M += 31 - M % 31, w.status = N, Y(w, M), w.strstart !== 0 && (Y(w, i.adler >>> 16), Y(w, 65535 & i.adler)), i.adler = 1;
1505
1505
  }
1506
1506
  if (w.status === 69) if (w.gzhead.extra) {
1507
- for (g = w.pending; w.gzindex < (65535 & w.gzhead.extra.length) && (w.pending !== w.pending_buf_size || (w.gzhead.hcrc && w.pending > g && (i.adler = p(i.adler, w.pending_buf, w.pending - g, g)), P(i), g = w.pending, w.pending !== w.pending_buf_size)); ) J(w, 255 & w.gzhead.extra[w.gzindex]), w.gzindex++;
1507
+ for (g = w.pending; w.gzindex < (65535 & w.gzhead.extra.length) && (w.pending !== w.pending_buf_size || (w.gzhead.hcrc && w.pending > g && (i.adler = p(i.adler, w.pending_buf, w.pending - g, g)), F(i), g = w.pending, w.pending !== w.pending_buf_size)); ) J(w, 255 & w.gzhead.extra[w.gzindex]), w.gzindex++;
1508
1508
  w.gzhead.hcrc && w.pending > g && (i.adler = p(i.adler, w.pending_buf, w.pending - g, g)), w.gzindex === w.gzhead.extra.length && (w.gzindex = 0, w.status = 73);
1509
1509
  } else w.status = 73;
1510
1510
  if (w.status === 73) if (w.gzhead.name) {
1511
1511
  g = w.pending;
1512
1512
  do {
1513
- if (w.pending === w.pending_buf_size && (w.gzhead.hcrc && w.pending > g && (i.adler = p(i.adler, w.pending_buf, w.pending - g, g)), P(i), g = w.pending, w.pending === w.pending_buf_size)) {
1513
+ if (w.pending === w.pending_buf_size && (w.gzhead.hcrc && w.pending > g && (i.adler = p(i.adler, w.pending_buf, w.pending - g, g)), F(i), g = w.pending, w.pending === w.pending_buf_size)) {
1514
1514
  S = 1;
1515
1515
  break;
1516
1516
  }
@@ -1521,7 +1521,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1521
1521
  if (w.status === 91) if (w.gzhead.comment) {
1522
1522
  g = w.pending;
1523
1523
  do {
1524
- if (w.pending === w.pending_buf_size && (w.gzhead.hcrc && w.pending > g && (i.adler = p(i.adler, w.pending_buf, w.pending - g, g)), P(i), g = w.pending, w.pending === w.pending_buf_size)) {
1524
+ if (w.pending === w.pending_buf_size && (w.gzhead.hcrc && w.pending > g && (i.adler = p(i.adler, w.pending_buf, w.pending - g, g)), F(i), g = w.pending, w.pending === w.pending_buf_size)) {
1525
1525
  S = 1;
1526
1526
  break;
1527
1527
  }
@@ -1529,9 +1529,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1529
1529
  } while (S !== 0);
1530
1530
  w.gzhead.hcrc && w.pending > g && (i.adler = p(i.adler, w.pending_buf, w.pending - g, g)), S === 0 && (w.status = 103);
1531
1531
  } else w.status = 103;
1532
- if (w.status === 103 && (w.gzhead.hcrc ? (w.pending + 2 > w.pending_buf_size && P(i), w.pending + 2 <= w.pending_buf_size && (J(w, 255 & i.adler), J(w, i.adler >> 8 & 255), i.adler = 0, w.status = N)) : w.status = N), w.pending !== 0) {
1533
- if (P(i), i.avail_out === 0) return w.last_flush = -1, h;
1534
- } else if (i.avail_in === 0 && W(O) <= W(F) && O !== m) return rt(i, -5);
1532
+ if (w.status === 103 && (w.gzhead.hcrc ? (w.pending + 2 > w.pending_buf_size && F(i), w.pending + 2 <= w.pending_buf_size && (J(w, 255 & i.adler), J(w, i.adler >> 8 & 255), i.adler = 0, w.status = N)) : w.status = N), w.pending !== 0) {
1533
+ if (F(i), i.avail_out === 0) return w.last_flush = -1, h;
1534
+ } else if (i.avail_in === 0 && W(O) <= W(P) && O !== m) return rt(i, -5);
1535
1535
  if (w.status === 666 && i.avail_in !== 0) return rt(i, -5);
1536
1536
  if (i.avail_in !== 0 || w.lookahead !== 0 || O !== y && w.status !== 666) {
1537
1537
  var $ = w.strategy === 2 ? function(R, H) {
@@ -1561,20 +1561,20 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1561
1561
  return R.insert = 0, H === m ? (I(R, !0), R.strm.avail_out === 0 ? et : U) : R.last_lit && (I(R, !1), R.strm.avail_out === 0) ? l : D;
1562
1562
  }(w, O) : a[w.level].func(w, O);
1563
1563
  if ($ !== et && $ !== U || (w.status = 666), $ === l || $ === et) return i.avail_out === 0 && (w.last_flush = -1), h;
1564
- if ($ === D && (O === 1 ? s._tr_align(w) : O !== 5 && (s._tr_stored_block(w, 0, 0, !1), O === 3 && (tt(w.head), w.lookahead === 0 && (w.strstart = 0, w.block_start = 0, w.insert = 0))), P(i), i.avail_out === 0)) return w.last_flush = -1, h;
1564
+ if ($ === D && (O === 1 ? s._tr_align(w) : O !== 5 && (s._tr_stored_block(w, 0, 0, !1), O === 3 && (tt(w.head), w.lookahead === 0 && (w.strstart = 0, w.block_start = 0, w.insert = 0))), F(i), i.avail_out === 0)) return w.last_flush = -1, h;
1565
1565
  }
1566
- return O !== m ? h : w.wrap <= 0 ? 1 : (w.wrap === 2 ? (J(w, 255 & i.adler), J(w, i.adler >> 8 & 255), J(w, i.adler >> 16 & 255), J(w, i.adler >> 24 & 255), J(w, 255 & i.total_in), J(w, i.total_in >> 8 & 255), J(w, i.total_in >> 16 & 255), J(w, i.total_in >> 24 & 255)) : (Y(w, i.adler >>> 16), Y(w, 65535 & i.adler)), P(i), 0 < w.wrap && (w.wrap = -w.wrap), w.pending !== 0 ? h : 1);
1566
+ return O !== m ? h : w.wrap <= 0 ? 1 : (w.wrap === 2 ? (J(w, 255 & i.adler), J(w, i.adler >> 8 & 255), J(w, i.adler >> 16 & 255), J(w, i.adler >> 24 & 255), J(w, 255 & i.total_in), J(w, i.total_in >> 8 & 255), J(w, i.total_in >> 16 & 255), J(w, i.total_in >> 24 & 255)) : (Y(w, i.adler >>> 16), Y(w, 65535 & i.adler)), F(i), 0 < w.wrap && (w.wrap = -w.wrap), w.pending !== 0 ? h : 1);
1567
1567
  }, n.deflateEnd = function(i) {
1568
1568
  var O;
1569
1569
  return i && i.state ? (O = i.state.status) !== k && O !== 69 && O !== 73 && O !== 91 && O !== 103 && O !== N && O !== 666 ? rt(i, b) : (i.state = null, O === N ? rt(i, -3) : h) : b;
1570
1570
  }, n.deflateSetDictionary = function(i, O) {
1571
- var F, w, g, S, M, $, R, H, q = O.length;
1572
- if (!i || !i.state || (S = (F = i.state).wrap) === 2 || S === 1 && F.status !== k || F.lookahead) return b;
1573
- for (S === 1 && (i.adler = c(i.adler, O, q, 0)), F.wrap = 0, q >= F.w_size && (S === 0 && (tt(F.head), F.strstart = 0, F.block_start = 0, F.insert = 0), H = new o.Buf8(F.w_size), o.arraySet(H, O, q - F.w_size, F.w_size, 0), O = H, q = F.w_size), M = i.avail_in, $ = i.next_in, R = i.input, i.avail_in = q, i.next_in = 0, i.input = O, lt(F); F.lookahead >= z; ) {
1574
- for (w = F.strstart, g = F.lookahead - (z - 1); F.ins_h = (F.ins_h << F.hash_shift ^ F.window[w + z - 1]) & F.hash_mask, F.prev[w & F.w_mask] = F.head[F.ins_h], F.head[F.ins_h] = w, w++, --g; ) ;
1575
- F.strstart = w, F.lookahead = z - 1, lt(F);
1571
+ var P, w, g, S, M, $, R, H, q = O.length;
1572
+ if (!i || !i.state || (S = (P = i.state).wrap) === 2 || S === 1 && P.status !== k || P.lookahead) return b;
1573
+ for (S === 1 && (i.adler = c(i.adler, O, q, 0)), P.wrap = 0, q >= P.w_size && (S === 0 && (tt(P.head), P.strstart = 0, P.block_start = 0, P.insert = 0), H = new o.Buf8(P.w_size), o.arraySet(H, O, q - P.w_size, P.w_size, 0), O = H, q = P.w_size), M = i.avail_in, $ = i.next_in, R = i.input, i.avail_in = q, i.next_in = 0, i.input = O, lt(P); P.lookahead >= z; ) {
1574
+ for (w = P.strstart, g = P.lookahead - (z - 1); P.ins_h = (P.ins_h << P.hash_shift ^ P.window[w + z - 1]) & P.hash_mask, P.prev[w & P.w_mask] = P.head[P.ins_h], P.head[P.ins_h] = w, w++, --g; ) ;
1575
+ P.strstart = w, P.lookahead = z - 1, lt(P);
1576
1576
  }
1577
- return F.strstart += F.lookahead, F.block_start = F.strstart, F.insert = F.lookahead, F.lookahead = 0, F.match_length = F.prev_length = z - 1, F.match_available = 0, i.next_in = $, i.input = R, i.avail_in = M, F.wrap = S, h;
1577
+ return P.strstart += P.lookahead, P.block_start = P.strstart, P.insert = P.lookahead, P.lookahead = 0, P.match_length = P.prev_length = z - 1, P.match_available = 0, i.next_in = $, i.input = R, i.avail_in = M, P.wrap = S, h;
1578
1578
  }, n.deflateInfo = "pako deflate (from Nodeca project)";
1579
1579
  }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(t, r, n) {
1580
1580
  r.exports = function() {
@@ -1695,9 +1695,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1695
1695
  n.inflateReset = A, n.inflateReset2 = T, n.inflateResetKeep = E, n.inflateInit = function(k) {
1696
1696
  return L(k, 15);
1697
1697
  }, n.inflateInit2 = L, n.inflate = function(k, N) {
1698
- var l, D, et, U, rt, W, tt, P, I, J, Y, V, lt, ut, it, at, dt, ct, bt, pt, i, O, F, w, g = 0, S = new a.Buf8(4), M = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
1698
+ var l, D, et, U, rt, W, tt, F, I, J, Y, V, lt, ut, it, at, dt, ct, bt, pt, i, O, P, w, g = 0, S = new a.Buf8(4), M = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
1699
1699
  if (!k || !k.state || !k.output || !k.input && k.avail_in !== 0) return h;
1700
- (l = k.state).mode === 12 && (l.mode = 13), rt = k.next_out, et = k.output, tt = k.avail_out, U = k.next_in, D = k.input, W = k.avail_in, P = l.hold, I = l.bits, J = W, Y = tt, O = m;
1700
+ (l = k.state).mode === 12 && (l.mode = 13), rt = k.next_out, et = k.output, tt = k.avail_out, U = k.next_in, D = k.input, W = k.avail_in, F = l.hold, I = l.bits, J = W, Y = tt, O = m;
1701
1701
  t: for (; ; ) switch (l.mode) {
1702
1702
  case b:
1703
1703
  if (l.wrap === 0) {
@@ -1706,33 +1706,33 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1706
1706
  }
1707
1707
  for (; I < 16; ) {
1708
1708
  if (W === 0) break t;
1709
- W--, P += D[U++] << I, I += 8;
1709
+ W--, F += D[U++] << I, I += 8;
1710
1710
  }
1711
- if (2 & l.wrap && P === 35615) {
1712
- S[l.check = 0] = 255 & P, S[1] = P >>> 8 & 255, l.check = s(l.check, S, 2, 0), I = P = 0, l.mode = 2;
1711
+ if (2 & l.wrap && F === 35615) {
1712
+ S[l.check = 0] = 255 & F, S[1] = F >>> 8 & 255, l.check = s(l.check, S, 2, 0), I = F = 0, l.mode = 2;
1713
1713
  break;
1714
1714
  }
1715
- if (l.flags = 0, l.head && (l.head.done = !1), !(1 & l.wrap) || (((255 & P) << 8) + (P >> 8)) % 31) {
1715
+ if (l.flags = 0, l.head && (l.head.done = !1), !(1 & l.wrap) || (((255 & F) << 8) + (F >> 8)) % 31) {
1716
1716
  k.msg = "incorrect header check", l.mode = 30;
1717
1717
  break;
1718
1718
  }
1719
- if ((15 & P) != 8) {
1719
+ if ((15 & F) != 8) {
1720
1720
  k.msg = "unknown compression method", l.mode = 30;
1721
1721
  break;
1722
1722
  }
1723
- if (I -= 4, i = 8 + (15 & (P >>>= 4)), l.wbits === 0) l.wbits = i;
1723
+ if (I -= 4, i = 8 + (15 & (F >>>= 4)), l.wbits === 0) l.wbits = i;
1724
1724
  else if (i > l.wbits) {
1725
1725
  k.msg = "invalid window size", l.mode = 30;
1726
1726
  break;
1727
1727
  }
1728
- l.dmax = 1 << i, k.adler = l.check = 1, l.mode = 512 & P ? 10 : 12, I = P = 0;
1728
+ l.dmax = 1 << i, k.adler = l.check = 1, l.mode = 512 & F ? 10 : 12, I = F = 0;
1729
1729
  break;
1730
1730
  case 2:
1731
1731
  for (; I < 16; ) {
1732
1732
  if (W === 0) break t;
1733
- W--, P += D[U++] << I, I += 8;
1733
+ W--, F += D[U++] << I, I += 8;
1734
1734
  }
1735
- if (l.flags = P, (255 & l.flags) != 8) {
1735
+ if (l.flags = F, (255 & l.flags) != 8) {
1736
1736
  k.msg = "unknown compression method", l.mode = 30;
1737
1737
  break;
1738
1738
  }
@@ -1740,26 +1740,26 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1740
1740
  k.msg = "unknown header flags set", l.mode = 30;
1741
1741
  break;
1742
1742
  }
1743
- l.head && (l.head.text = P >> 8 & 1), 512 & l.flags && (S[0] = 255 & P, S[1] = P >>> 8 & 255, l.check = s(l.check, S, 2, 0)), I = P = 0, l.mode = 3;
1743
+ l.head && (l.head.text = F >> 8 & 1), 512 & l.flags && (S[0] = 255 & F, S[1] = F >>> 8 & 255, l.check = s(l.check, S, 2, 0)), I = F = 0, l.mode = 3;
1744
1744
  case 3:
1745
1745
  for (; I < 32; ) {
1746
1746
  if (W === 0) break t;
1747
- W--, P += D[U++] << I, I += 8;
1747
+ W--, F += D[U++] << I, I += 8;
1748
1748
  }
1749
- l.head && (l.head.time = P), 512 & l.flags && (S[0] = 255 & P, S[1] = P >>> 8 & 255, S[2] = P >>> 16 & 255, S[3] = P >>> 24 & 255, l.check = s(l.check, S, 4, 0)), I = P = 0, l.mode = 4;
1749
+ l.head && (l.head.time = F), 512 & l.flags && (S[0] = 255 & F, S[1] = F >>> 8 & 255, S[2] = F >>> 16 & 255, S[3] = F >>> 24 & 255, l.check = s(l.check, S, 4, 0)), I = F = 0, l.mode = 4;
1750
1750
  case 4:
1751
1751
  for (; I < 16; ) {
1752
1752
  if (W === 0) break t;
1753
- W--, P += D[U++] << I, I += 8;
1753
+ W--, F += D[U++] << I, I += 8;
1754
1754
  }
1755
- l.head && (l.head.xflags = 255 & P, l.head.os = P >> 8), 512 & l.flags && (S[0] = 255 & P, S[1] = P >>> 8 & 255, l.check = s(l.check, S, 2, 0)), I = P = 0, l.mode = 5;
1755
+ l.head && (l.head.xflags = 255 & F, l.head.os = F >> 8), 512 & l.flags && (S[0] = 255 & F, S[1] = F >>> 8 & 255, l.check = s(l.check, S, 2, 0)), I = F = 0, l.mode = 5;
1756
1756
  case 5:
1757
1757
  if (1024 & l.flags) {
1758
1758
  for (; I < 16; ) {
1759
1759
  if (W === 0) break t;
1760
- W--, P += D[U++] << I, I += 8;
1760
+ W--, F += D[U++] << I, I += 8;
1761
1761
  }
1762
- l.length = P, l.head && (l.head.extra_len = P), 512 & l.flags && (S[0] = 255 & P, S[1] = P >>> 8 & 255, l.check = s(l.check, S, 2, 0)), I = P = 0;
1762
+ l.length = F, l.head && (l.head.extra_len = F), 512 & l.flags && (S[0] = 255 & F, S[1] = F >>> 8 & 255, l.check = s(l.check, S, 2, 0)), I = F = 0;
1763
1763
  } else l.head && (l.head.extra = null);
1764
1764
  l.mode = 6;
1765
1765
  case 6:
@@ -1783,43 +1783,43 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1783
1783
  if (512 & l.flags) {
1784
1784
  for (; I < 16; ) {
1785
1785
  if (W === 0) break t;
1786
- W--, P += D[U++] << I, I += 8;
1786
+ W--, F += D[U++] << I, I += 8;
1787
1787
  }
1788
- if (P !== (65535 & l.check)) {
1788
+ if (F !== (65535 & l.check)) {
1789
1789
  k.msg = "header crc mismatch", l.mode = 30;
1790
1790
  break;
1791
1791
  }
1792
- I = P = 0;
1792
+ I = F = 0;
1793
1793
  }
1794
1794
  l.head && (l.head.hcrc = l.flags >> 9 & 1, l.head.done = !0), k.adler = l.check = 0, l.mode = 12;
1795
1795
  break;
1796
1796
  case 10:
1797
1797
  for (; I < 32; ) {
1798
1798
  if (W === 0) break t;
1799
- W--, P += D[U++] << I, I += 8;
1799
+ W--, F += D[U++] << I, I += 8;
1800
1800
  }
1801
- k.adler = l.check = u(P), I = P = 0, l.mode = 11;
1801
+ k.adler = l.check = u(F), I = F = 0, l.mode = 11;
1802
1802
  case 11:
1803
- if (l.havedict === 0) return k.next_out = rt, k.avail_out = tt, k.next_in = U, k.avail_in = W, l.hold = P, l.bits = I, 2;
1803
+ if (l.havedict === 0) return k.next_out = rt, k.avail_out = tt, k.next_in = U, k.avail_in = W, l.hold = F, l.bits = I, 2;
1804
1804
  k.adler = l.check = 1, l.mode = 12;
1805
1805
  case 12:
1806
1806
  if (N === 5 || N === 6) break t;
1807
1807
  case 13:
1808
1808
  if (l.last) {
1809
- P >>>= 7 & I, I -= 7 & I, l.mode = 27;
1809
+ F >>>= 7 & I, I -= 7 & I, l.mode = 27;
1810
1810
  break;
1811
1811
  }
1812
1812
  for (; I < 3; ) {
1813
1813
  if (W === 0) break t;
1814
- W--, P += D[U++] << I, I += 8;
1814
+ W--, F += D[U++] << I, I += 8;
1815
1815
  }
1816
- switch (l.last = 1 & P, I -= 1, 3 & (P >>>= 1)) {
1816
+ switch (l.last = 1 & F, I -= 1, 3 & (F >>>= 1)) {
1817
1817
  case 0:
1818
1818
  l.mode = 14;
1819
1819
  break;
1820
1820
  case 1:
1821
1821
  if (Z(l), l.mode = 20, N !== 6) break;
1822
- P >>>= 2, I -= 2;
1822
+ F >>>= 2, I -= 2;
1823
1823
  break t;
1824
1824
  case 2:
1825
1825
  l.mode = 17;
@@ -1827,18 +1827,18 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1827
1827
  case 3:
1828
1828
  k.msg = "invalid block type", l.mode = 30;
1829
1829
  }
1830
- P >>>= 2, I -= 2;
1830
+ F >>>= 2, I -= 2;
1831
1831
  break;
1832
1832
  case 14:
1833
- for (P >>>= 7 & I, I -= 7 & I; I < 32; ) {
1833
+ for (F >>>= 7 & I, I -= 7 & I; I < 32; ) {
1834
1834
  if (W === 0) break t;
1835
- W--, P += D[U++] << I, I += 8;
1835
+ W--, F += D[U++] << I, I += 8;
1836
1836
  }
1837
- if ((65535 & P) != (P >>> 16 ^ 65535)) {
1837
+ if ((65535 & F) != (F >>> 16 ^ 65535)) {
1838
1838
  k.msg = "invalid stored block lengths", l.mode = 30;
1839
1839
  break;
1840
1840
  }
1841
- if (l.length = 65535 & P, I = P = 0, l.mode = 15, N === 6) break t;
1841
+ if (l.length = 65535 & F, I = F = 0, l.mode = 15, N === 6) break t;
1842
1842
  case 15:
1843
1843
  l.mode = 16;
1844
1844
  case 16:
@@ -1852,9 +1852,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1852
1852
  case 17:
1853
1853
  for (; I < 14; ) {
1854
1854
  if (W === 0) break t;
1855
- W--, P += D[U++] << I, I += 8;
1855
+ W--, F += D[U++] << I, I += 8;
1856
1856
  }
1857
- if (l.nlen = 257 + (31 & P), P >>>= 5, I -= 5, l.ndist = 1 + (31 & P), P >>>= 5, I -= 5, l.ncode = 4 + (15 & P), P >>>= 4, I -= 4, 286 < l.nlen || 30 < l.ndist) {
1857
+ if (l.nlen = 257 + (31 & F), F >>>= 5, I -= 5, l.ndist = 1 + (31 & F), F >>>= 5, I -= 5, l.ncode = 4 + (15 & F), F >>>= 4, I -= 4, 286 < l.nlen || 30 < l.ndist) {
1858
1858
  k.msg = "too many length or distance symbols", l.mode = 30;
1859
1859
  break;
1860
1860
  }
@@ -1863,46 +1863,46 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1863
1863
  for (; l.have < l.ncode; ) {
1864
1864
  for (; I < 3; ) {
1865
1865
  if (W === 0) break t;
1866
- W--, P += D[U++] << I, I += 8;
1866
+ W--, F += D[U++] << I, I += 8;
1867
1867
  }
1868
- l.lens[M[l.have++]] = 7 & P, P >>>= 3, I -= 3;
1868
+ l.lens[M[l.have++]] = 7 & F, F >>>= 3, I -= 3;
1869
1869
  }
1870
1870
  for (; l.have < 19; ) l.lens[M[l.have++]] = 0;
1871
- if (l.lencode = l.lendyn, l.lenbits = 7, F = { bits: l.lenbits }, O = p(0, l.lens, 0, 19, l.lencode, 0, l.work, F), l.lenbits = F.bits, O) {
1871
+ if (l.lencode = l.lendyn, l.lenbits = 7, P = { bits: l.lenbits }, O = p(0, l.lens, 0, 19, l.lencode, 0, l.work, P), l.lenbits = P.bits, O) {
1872
1872
  k.msg = "invalid code lengths set", l.mode = 30;
1873
1873
  break;
1874
1874
  }
1875
1875
  l.have = 0, l.mode = 19;
1876
1876
  case 19:
1877
1877
  for (; l.have < l.nlen + l.ndist; ) {
1878
- for (; at = (g = l.lencode[P & (1 << l.lenbits) - 1]) >>> 16 & 255, dt = 65535 & g, !((it = g >>> 24) <= I); ) {
1878
+ for (; at = (g = l.lencode[F & (1 << l.lenbits) - 1]) >>> 16 & 255, dt = 65535 & g, !((it = g >>> 24) <= I); ) {
1879
1879
  if (W === 0) break t;
1880
- W--, P += D[U++] << I, I += 8;
1880
+ W--, F += D[U++] << I, I += 8;
1881
1881
  }
1882
- if (dt < 16) P >>>= it, I -= it, l.lens[l.have++] = dt;
1882
+ if (dt < 16) F >>>= it, I -= it, l.lens[l.have++] = dt;
1883
1883
  else {
1884
1884
  if (dt === 16) {
1885
1885
  for (w = it + 2; I < w; ) {
1886
1886
  if (W === 0) break t;
1887
- W--, P += D[U++] << I, I += 8;
1887
+ W--, F += D[U++] << I, I += 8;
1888
1888
  }
1889
- if (P >>>= it, I -= it, l.have === 0) {
1889
+ if (F >>>= it, I -= it, l.have === 0) {
1890
1890
  k.msg = "invalid bit length repeat", l.mode = 30;
1891
1891
  break;
1892
1892
  }
1893
- i = l.lens[l.have - 1], V = 3 + (3 & P), P >>>= 2, I -= 2;
1893
+ i = l.lens[l.have - 1], V = 3 + (3 & F), F >>>= 2, I -= 2;
1894
1894
  } else if (dt === 17) {
1895
1895
  for (w = it + 3; I < w; ) {
1896
1896
  if (W === 0) break t;
1897
- W--, P += D[U++] << I, I += 8;
1897
+ W--, F += D[U++] << I, I += 8;
1898
1898
  }
1899
- I -= it, i = 0, V = 3 + (7 & (P >>>= it)), P >>>= 3, I -= 3;
1899
+ I -= it, i = 0, V = 3 + (7 & (F >>>= it)), F >>>= 3, I -= 3;
1900
1900
  } else {
1901
1901
  for (w = it + 7; I < w; ) {
1902
1902
  if (W === 0) break t;
1903
- W--, P += D[U++] << I, I += 8;
1903
+ W--, F += D[U++] << I, I += 8;
1904
1904
  }
1905
- I -= it, i = 0, V = 11 + (127 & (P >>>= it)), P >>>= 7, I -= 7;
1905
+ I -= it, i = 0, V = 11 + (127 & (F >>>= it)), F >>>= 7, I -= 7;
1906
1906
  }
1907
1907
  if (l.have + V > l.nlen + l.ndist) {
1908
1908
  k.msg = "invalid bit length repeat", l.mode = 30;
@@ -1916,11 +1916,11 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1916
1916
  k.msg = "invalid code -- missing end-of-block", l.mode = 30;
1917
1917
  break;
1918
1918
  }
1919
- if (l.lenbits = 9, F = { bits: l.lenbits }, O = p(f, l.lens, 0, l.nlen, l.lencode, 0, l.work, F), l.lenbits = F.bits, O) {
1919
+ if (l.lenbits = 9, P = { bits: l.lenbits }, O = p(f, l.lens, 0, l.nlen, l.lencode, 0, l.work, P), l.lenbits = P.bits, O) {
1920
1920
  k.msg = "invalid literal/lengths set", l.mode = 30;
1921
1921
  break;
1922
1922
  }
1923
- if (l.distbits = 6, l.distcode = l.distdyn, F = { bits: l.distbits }, O = p(y, l.lens, l.nlen, l.ndist, l.distcode, 0, l.work, F), l.distbits = F.bits, O) {
1923
+ if (l.distbits = 6, l.distcode = l.distdyn, P = { bits: l.distbits }, O = p(y, l.lens, l.nlen, l.ndist, l.distcode, 0, l.work, P), l.distbits = P.bits, O) {
1924
1924
  k.msg = "invalid distances set", l.mode = 30;
1925
1925
  break;
1926
1926
  }
@@ -1929,21 +1929,21 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1929
1929
  l.mode = 21;
1930
1930
  case 21:
1931
1931
  if (6 <= W && 258 <= tt) {
1932
- k.next_out = rt, k.avail_out = tt, k.next_in = U, k.avail_in = W, l.hold = P, l.bits = I, c(k, Y), rt = k.next_out, et = k.output, tt = k.avail_out, U = k.next_in, D = k.input, W = k.avail_in, P = l.hold, I = l.bits, l.mode === 12 && (l.back = -1);
1932
+ k.next_out = rt, k.avail_out = tt, k.next_in = U, k.avail_in = W, l.hold = F, l.bits = I, c(k, Y), rt = k.next_out, et = k.output, tt = k.avail_out, U = k.next_in, D = k.input, W = k.avail_in, F = l.hold, I = l.bits, l.mode === 12 && (l.back = -1);
1933
1933
  break;
1934
1934
  }
1935
- for (l.back = 0; at = (g = l.lencode[P & (1 << l.lenbits) - 1]) >>> 16 & 255, dt = 65535 & g, !((it = g >>> 24) <= I); ) {
1935
+ for (l.back = 0; at = (g = l.lencode[F & (1 << l.lenbits) - 1]) >>> 16 & 255, dt = 65535 & g, !((it = g >>> 24) <= I); ) {
1936
1936
  if (W === 0) break t;
1937
- W--, P += D[U++] << I, I += 8;
1937
+ W--, F += D[U++] << I, I += 8;
1938
1938
  }
1939
1939
  if (at && !(240 & at)) {
1940
- for (ct = it, bt = at, pt = dt; at = (g = l.lencode[pt + ((P & (1 << ct + bt) - 1) >> ct)]) >>> 16 & 255, dt = 65535 & g, !(ct + (it = g >>> 24) <= I); ) {
1940
+ for (ct = it, bt = at, pt = dt; at = (g = l.lencode[pt + ((F & (1 << ct + bt) - 1) >> ct)]) >>> 16 & 255, dt = 65535 & g, !(ct + (it = g >>> 24) <= I); ) {
1941
1941
  if (W === 0) break t;
1942
- W--, P += D[U++] << I, I += 8;
1942
+ W--, F += D[U++] << I, I += 8;
1943
1943
  }
1944
- P >>>= ct, I -= ct, l.back += ct;
1944
+ F >>>= ct, I -= ct, l.back += ct;
1945
1945
  }
1946
- if (P >>>= it, I -= it, l.back += it, l.length = dt, at === 0) {
1946
+ if (F >>>= it, I -= it, l.back += it, l.length = dt, at === 0) {
1947
1947
  l.mode = 26;
1948
1948
  break;
1949
1949
  }
@@ -1960,24 +1960,24 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1960
1960
  if (l.extra) {
1961
1961
  for (w = l.extra; I < w; ) {
1962
1962
  if (W === 0) break t;
1963
- W--, P += D[U++] << I, I += 8;
1963
+ W--, F += D[U++] << I, I += 8;
1964
1964
  }
1965
- l.length += P & (1 << l.extra) - 1, P >>>= l.extra, I -= l.extra, l.back += l.extra;
1965
+ l.length += F & (1 << l.extra) - 1, F >>>= l.extra, I -= l.extra, l.back += l.extra;
1966
1966
  }
1967
1967
  l.was = l.length, l.mode = 23;
1968
1968
  case 23:
1969
- for (; at = (g = l.distcode[P & (1 << l.distbits) - 1]) >>> 16 & 255, dt = 65535 & g, !((it = g >>> 24) <= I); ) {
1969
+ for (; at = (g = l.distcode[F & (1 << l.distbits) - 1]) >>> 16 & 255, dt = 65535 & g, !((it = g >>> 24) <= I); ) {
1970
1970
  if (W === 0) break t;
1971
- W--, P += D[U++] << I, I += 8;
1971
+ W--, F += D[U++] << I, I += 8;
1972
1972
  }
1973
1973
  if (!(240 & at)) {
1974
- for (ct = it, bt = at, pt = dt; at = (g = l.distcode[pt + ((P & (1 << ct + bt) - 1) >> ct)]) >>> 16 & 255, dt = 65535 & g, !(ct + (it = g >>> 24) <= I); ) {
1974
+ for (ct = it, bt = at, pt = dt; at = (g = l.distcode[pt + ((F & (1 << ct + bt) - 1) >> ct)]) >>> 16 & 255, dt = 65535 & g, !(ct + (it = g >>> 24) <= I); ) {
1975
1975
  if (W === 0) break t;
1976
- W--, P += D[U++] << I, I += 8;
1976
+ W--, F += D[U++] << I, I += 8;
1977
1977
  }
1978
- P >>>= ct, I -= ct, l.back += ct;
1978
+ F >>>= ct, I -= ct, l.back += ct;
1979
1979
  }
1980
- if (P >>>= it, I -= it, l.back += it, 64 & at) {
1980
+ if (F >>>= it, I -= it, l.back += it, 64 & at) {
1981
1981
  k.msg = "invalid distance code", l.mode = 30;
1982
1982
  break;
1983
1983
  }
@@ -1986,9 +1986,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
1986
1986
  if (l.extra) {
1987
1987
  for (w = l.extra; I < w; ) {
1988
1988
  if (W === 0) break t;
1989
- W--, P += D[U++] << I, I += 8;
1989
+ W--, F += D[U++] << I, I += 8;
1990
1990
  }
1991
- l.offset += P & (1 << l.extra) - 1, P >>>= l.extra, I -= l.extra, l.back += l.extra;
1991
+ l.offset += F & (1 << l.extra) - 1, F >>>= l.extra, I -= l.extra, l.back += l.extra;
1992
1992
  }
1993
1993
  if (l.offset > l.dmax) {
1994
1994
  k.msg = "invalid distance too far back", l.mode = 30;
@@ -2015,26 +2015,26 @@ https://github.com/nodeca/pako/blob/main/LICENSE
2015
2015
  if (l.wrap) {
2016
2016
  for (; I < 32; ) {
2017
2017
  if (W === 0) break t;
2018
- W--, P |= D[U++] << I, I += 8;
2018
+ W--, F |= D[U++] << I, I += 8;
2019
2019
  }
2020
- if (Y -= tt, k.total_out += Y, l.total += Y, Y && (k.adler = l.check = l.flags ? s(l.check, et, Y, rt - Y) : o(l.check, et, Y, rt - Y)), Y = tt, (l.flags ? P : u(P)) !== l.check) {
2020
+ if (Y -= tt, k.total_out += Y, l.total += Y, Y && (k.adler = l.check = l.flags ? s(l.check, et, Y, rt - Y) : o(l.check, et, Y, rt - Y)), Y = tt, (l.flags ? F : u(F)) !== l.check) {
2021
2021
  k.msg = "incorrect data check", l.mode = 30;
2022
2022
  break;
2023
2023
  }
2024
- I = P = 0;
2024
+ I = F = 0;
2025
2025
  }
2026
2026
  l.mode = 28;
2027
2027
  case 28:
2028
2028
  if (l.wrap && l.flags) {
2029
2029
  for (; I < 32; ) {
2030
2030
  if (W === 0) break t;
2031
- W--, P += D[U++] << I, I += 8;
2031
+ W--, F += D[U++] << I, I += 8;
2032
2032
  }
2033
- if (P !== (4294967295 & l.total)) {
2033
+ if (F !== (4294967295 & l.total)) {
2034
2034
  k.msg = "incorrect length check", l.mode = 30;
2035
2035
  break;
2036
2036
  }
2037
- I = P = 0;
2037
+ I = F = 0;
2038
2038
  }
2039
2039
  l.mode = 29;
2040
2040
  case 29:
@@ -2049,7 +2049,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
2049
2049
  default:
2050
2050
  return h;
2051
2051
  }
2052
- return k.next_out = rt, k.avail_out = tt, k.next_in = U, k.avail_in = W, l.hold = P, l.bits = I, (l.wsize || Y !== k.avail_out && l.mode < 30 && (l.mode < 27 || N !== 4)) && Q(k, k.output, k.next_out, Y - k.avail_out) ? (l.mode = 31, -4) : (J -= k.avail_in, Y -= k.avail_out, k.total_in += J, k.total_out += Y, l.total += Y, l.wrap && Y && (k.adler = l.check = l.flags ? s(l.check, et, Y, k.next_out - Y) : o(l.check, et, Y, k.next_out - Y)), k.data_type = l.bits + (l.last ? 64 : 0) + (l.mode === 12 ? 128 : 0) + (l.mode === 20 || l.mode === 15 ? 256 : 0), (J == 0 && Y === 0 || N === 4) && O === m && (O = -5), O);
2052
+ return k.next_out = rt, k.avail_out = tt, k.next_in = U, k.avail_in = W, l.hold = F, l.bits = I, (l.wsize || Y !== k.avail_out && l.mode < 30 && (l.mode < 27 || N !== 4)) && Q(k, k.output, k.next_out, Y - k.avail_out) ? (l.mode = 31, -4) : (J -= k.avail_in, Y -= k.avail_out, k.total_in += J, k.total_out += Y, l.total += Y, l.wrap && Y && (k.adler = l.check = l.flags ? s(l.check, et, Y, k.next_out - Y) : o(l.check, et, Y, k.next_out - Y)), k.data_type = l.bits + (l.last ? 64 : 0) + (l.mode === 12 ? 128 : 0) + (l.mode === 20 || l.mode === 15 ? 256 : 0), (J == 0 && Y === 0 || N === 4) && O === m && (O = -5), O);
2053
2053
  }, n.inflateEnd = function(k) {
2054
2054
  if (!k || !k.state) return h;
2055
2055
  var N = k.state;
@@ -2064,7 +2064,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
2064
2064
  }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(t, r, n) {
2065
2065
  var a = t("../utils/common"), o = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], s = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], c = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], p = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
2066
2066
  r.exports = function(f, y, m, h, b, d, _, u) {
2067
- var v, E, A, T, L, B, j, z, Z, Q = u.bits, k = 0, N = 0, l = 0, D = 0, et = 0, U = 0, rt = 0, W = 0, tt = 0, P = 0, I = null, J = 0, Y = new a.Buf16(16), V = new a.Buf16(16), lt = null, ut = 0;
2067
+ var v, E, A, T, L, B, j, z, Z, Q = u.bits, k = 0, N = 0, l = 0, D = 0, et = 0, U = 0, rt = 0, W = 0, tt = 0, F = 0, I = null, J = 0, Y = new a.Buf16(16), V = new a.Buf16(16), lt = null, ut = 0;
2068
2068
  for (k = 0; k <= 15; k++) Y[k] = 0;
2069
2069
  for (N = 0; N < h; N++) Y[y[m + N]]++;
2070
2070
  for (et = Q, D = 15; 1 <= D && Y[D] === 0; D--) ;
@@ -2074,21 +2074,21 @@ https://github.com/nodeca/pako/blob/main/LICENSE
2074
2074
  if (0 < W && (f === 0 || D !== 1)) return -1;
2075
2075
  for (V[1] = 0, k = 1; k < 15; k++) V[k + 1] = V[k] + Y[k];
2076
2076
  for (N = 0; N < h; N++) y[m + N] !== 0 && (_[V[y[m + N]]++] = N);
2077
- if (B = f === 0 ? (I = lt = _, 19) : f === 1 ? (I = o, J -= 257, lt = s, ut -= 257, 256) : (I = c, lt = p, -1), k = l, L = d, rt = N = P = 0, A = -1, T = (tt = 1 << (U = et)) - 1, f === 1 && 852 < tt || f === 2 && 592 < tt) return 1;
2077
+ if (B = f === 0 ? (I = lt = _, 19) : f === 1 ? (I = o, J -= 257, lt = s, ut -= 257, 256) : (I = c, lt = p, -1), k = l, L = d, rt = N = F = 0, A = -1, T = (tt = 1 << (U = et)) - 1, f === 1 && 852 < tt || f === 2 && 592 < tt) return 1;
2078
2078
  for (; ; ) {
2079
- for (j = k - rt, Z = _[N] < B ? (z = 0, _[N]) : _[N] > B ? (z = lt[ut + _[N]], I[J + _[N]]) : (z = 96, 0), v = 1 << k - rt, l = E = 1 << U; b[L + (P >> rt) + (E -= v)] = j << 24 | z << 16 | Z | 0, E !== 0; ) ;
2080
- for (v = 1 << k - 1; P & v; ) v >>= 1;
2081
- if (v !== 0 ? (P &= v - 1, P += v) : P = 0, N++, --Y[k] == 0) {
2079
+ for (j = k - rt, Z = _[N] < B ? (z = 0, _[N]) : _[N] > B ? (z = lt[ut + _[N]], I[J + _[N]]) : (z = 96, 0), v = 1 << k - rt, l = E = 1 << U; b[L + (F >> rt) + (E -= v)] = j << 24 | z << 16 | Z | 0, E !== 0; ) ;
2080
+ for (v = 1 << k - 1; F & v; ) v >>= 1;
2081
+ if (v !== 0 ? (F &= v - 1, F += v) : F = 0, N++, --Y[k] == 0) {
2082
2082
  if (k === D) break;
2083
2083
  k = y[m + _[N]];
2084
2084
  }
2085
- if (et < k && (P & T) !== A) {
2085
+ if (et < k && (F & T) !== A) {
2086
2086
  for (rt === 0 && (rt = et), L += l, W = 1 << (U = k - rt); U + rt < D && !((W -= Y[U + rt]) <= 0); ) U++, W <<= 1;
2087
2087
  if (tt += 1 << U, f === 1 && 852 < tt || f === 2 && 592 < tt) return 1;
2088
- b[A = P & T] = et << 24 | U << 16 | L - d | 0;
2088
+ b[A = F & T] = et << 24 | U << 16 | L - d | 0;
2089
2089
  }
2090
2090
  }
2091
- return P !== 0 && (b[L + P] = k - rt << 24 | 64 << 16 | 0), u.bits = et, 0;
2091
+ return F !== 0 && (b[L + F] = k - rt << 24 | 64 << 16 | 0), u.bits = et, 0;
2092
2092
  };
2093
2093
  }, { "../utils/common": 41 }], 51: [function(t, r, n) {
2094
2094
  r.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" };
@@ -2111,7 +2111,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
2111
2111
  function tt(g, S, M, $, R) {
2112
2112
  this.static_tree = g, this.extra_bits = S, this.extra_base = M, this.elems = $, this.max_length = R, this.has_stree = g && g.length;
2113
2113
  }
2114
- function P(g, S) {
2114
+ function F(g, S) {
2115
2115
  this.dyn_tree = g, this.max_code = 0, this.stat_desc = S;
2116
2116
  }
2117
2117
  function I(g) {
@@ -2193,14 +2193,14 @@ https://github.com/nodeca/pako/blob/main/LICENSE
2193
2193
  }
2194
2194
  }
2195
2195
  c(W);
2196
- var F = !1;
2196
+ var P = !1;
2197
2197
  function w(g, S, M, $) {
2198
2198
  Y(g, (p << 1) + ($ ? 1 : 0), 3), function(R, H, q, G) {
2199
2199
  at(R), J(R, q), J(R, ~q), a.arraySet(R.pending_buf, R.window, H, q, R.pending), R.pending += q;
2200
2200
  }(g, S, M);
2201
2201
  }
2202
2202
  n._tr_init = function(g) {
2203
- F || (function() {
2203
+ P || (function() {
2204
2204
  var S, M, $, R, H, q = new Array(_ + 1);
2205
2205
  for (R = $ = 0; R < f - 1; R++) for (D[R] = $, S = 0; S < 1 << B[R]; S++) l[$++] = R;
2206
2206
  for (l[$ - 1] = R, R = H = 0; R < 16; R++) for (W[R] = H, S = 0; S < 1 << j[R]; S++) N[H++] = R;
@@ -2212,7 +2212,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
2212
2212
  for (; S <= 287; ) Q[2 * S + 1] = 8, S++, q[8]++;
2213
2213
  for (ut(Q, m + 1, q), S = 0; S < h; S++) k[2 * S + 1] = 5, k[2 * S] = lt(S, 5);
2214
2214
  et = new tt(Q, B, y + 1, m, _), U = new tt(k, j, 0, h, _), rt = new tt(new Array(0), z, 0, b, v);
2215
- }(), F = !0), g.l_desc = new P(g.dyn_ltree, et), g.d_desc = new P(g.dyn_dtree, U), g.bl_desc = new P(g.bl_tree, rt), g.bi_buf = 0, g.bi_valid = 0, it(g);
2215
+ }(), P = !0), g.l_desc = new F(g.dyn_ltree, et), g.d_desc = new F(g.dyn_dtree, U), g.bl_desc = new F(g.bl_tree, rt), g.bi_buf = 0, g.bi_valid = 0, it(g);
2216
2216
  }, n._tr_stored_block = w, n._tr_flush_block = function(g, S, M, $) {
2217
2217
  var R, H, q = 0;
2218
2218
  0 < g.level ? (g.strm.data_type === 2 && (g.strm.data_type = function(G) {
@@ -2447,7 +2447,7 @@ function Jt(x) {
2447
2447
  const e = {
2448
2448
  colorScheme: { name: "", colors: {} },
2449
2449
  fontScheme: { name: "", majorFont: {}, minorFont: {} }
2450
- }, t = Ft(x, "themeElements");
2450
+ }, t = Pt(x, "themeElements");
2451
2451
  if (!t) return e;
2452
2452
  for (const r of Rt(t)) {
2453
2453
  const n = r.localName;
@@ -2467,12 +2467,12 @@ function Qt(x) {
2467
2467
  return e;
2468
2468
  }
2469
2469
  function te(x) {
2470
- const e = Ft(x, "srgbClr");
2470
+ const e = Pt(x, "srgbClr");
2471
2471
  if (e) {
2472
2472
  const r = e.getAttribute("val");
2473
2473
  return r ? `#${r}` : null;
2474
2474
  }
2475
- const t = Ft(x, "sysClr");
2475
+ const t = Pt(x, "sysClr");
2476
2476
  if (t) {
2477
2477
  const r = t.getAttribute("lastClr");
2478
2478
  return r ? `#${r}` : null;
@@ -2499,7 +2499,7 @@ function Ot(x) {
2499
2499
  }
2500
2500
  return e;
2501
2501
  }
2502
- function Ft(x, e) {
2502
+ function Pt(x, e) {
2503
2503
  for (let t = 0; t < x.childNodes.length; t++) {
2504
2504
  const r = x.childNodes[t];
2505
2505
  if (r.nodeType === Node.ELEMENT_NODE) {
@@ -2563,9 +2563,9 @@ function ie(x, e, t) {
2563
2563
  const f = 1 - t / 255;
2564
2564
  s = Math.round(s * f), c = Math.round(c * f), p = Math.round(p * f);
2565
2565
  }
2566
- return s = Math.max(0, Math.min(255, s)), c = Math.max(0, Math.min(255, c)), p = Math.max(0, Math.min(255, p)), `#${Pt(s)}${Pt(c)}${Pt(p)}`;
2566
+ return s = Math.max(0, Math.min(255, s)), c = Math.max(0, Math.min(255, c)), p = Math.max(0, Math.min(255, p)), `#${Ft(s)}${Ft(c)}${Ft(p)}`;
2567
2567
  }
2568
- function Pt(x) {
2568
+ function Ft(x) {
2569
2569
  const e = x.toString(16);
2570
2570
  return e.length === 1 ? "0" + e : e;
2571
2571
  }
@@ -4274,19 +4274,14 @@ class Ie {
4274
4274
  * 原文不可见时隐藏评论
4275
4275
  */
4276
4276
  positionCommentBubbles() {
4277
- const e = this.container.querySelector(`.${this.classPrefix}-comments-layer`), t = this.container.querySelector(`.${this.classPrefix}-page`);
4278
- if (e && t) {
4279
- const o = t.getBoundingClientRect();
4280
- e.style.left = `${o.right + 10}px`;
4281
- }
4282
- const r = [], n = 60, a = window.innerHeight - 40;
4277
+ const e = this.container.querySelector(`.${this.classPrefix}-page`);
4278
+ if (!e) return;
4279
+ const r = e.getBoundingClientRect().right + 15, n = 0, a = window.innerHeight;
4283
4280
  for (const [, o] of this.commentRanges) {
4284
4281
  if (!o.panelElement || o.highlightElements.length === 0) continue;
4285
- const c = o.highlightElements[0].getBoundingClientRect(), p = c.top + c.height / 2;
4286
- p > n && p < a ? (r.push({ range: o, top: c.top }), o.panelElement.style.display = "block") : o.panelElement.style.display = "none";
4282
+ const c = o.highlightElements[0].getBoundingClientRect();
4283
+ c.bottom > n && c.top < a ? (o.panelElement.style.display = "block", o.panelElement.style.left = `${r}px`, o.panelElement.style.top = `${c.top}px`) : o.panelElement.style.display = "none";
4287
4284
  }
4288
- for (const { range: o, top: s } of r)
4289
- o.panelElement.style.top = `${s}px`;
4290
4285
  }
4291
4286
  /**
4292
4287
  * 创建 SVG 连线层
@@ -5201,7 +5196,7 @@ console.log("[docx-render] DocumentRenderer 已导入");
5201
5196
  console.log("[docx-render] types 已导入");
5202
5197
  console.log("[docx-render] 开始导入样式...");
5203
5198
  console.log("[docx-render] 样式导入完成");
5204
- class Pe {
5199
+ class Fe {
5205
5200
  constructor(e) {
5206
5201
  nt(this, "parser");
5207
5202
  nt(this, "renderer");
@@ -5236,7 +5231,7 @@ class Pe {
5236
5231
  }
5237
5232
  async function $e(x, e, t) {
5238
5233
  console.log("[docx-render] renderDocx() 被调用");
5239
- const r = new Pe({
5234
+ const r = new Fe({
5240
5235
  container: e,
5241
5236
  ...t
5242
5237
  });
@@ -5247,7 +5242,7 @@ export {
5247
5242
  mt as DOCX_PARTS,
5248
5243
  Re as DocumentParser,
5249
5244
  Ie as DocumentRenderer,
5250
- Pe as DocxRender,
5245
+ Fe as DocxRender,
5251
5246
  X as DomType,
5252
5247
  qt as XML_NS,
5253
5248
  ie as applyTintShade,
package/dist/index.umd.js CHANGED
@@ -16,7 +16,7 @@
16
16
  font-weight: ${e};
17
17
  font-style: ${t};
18
18
  font-display: swap;
19
- }`}function Ae(x){switch(x){case"bold":case"boldItalic":return"700";default:return"400"}}function Re(x){switch(x){case"italic":case"boldItalic":return"italic";default:return"normal"}}function Fe(x){switch(x){case"opentype":return"opentype";case"truetype":return"truetype";case"embedded-opentype":return"embedded-opentype";default:return"truetype"}}function Pe(x){return x.replace(/"/g,'\\"')}function Ie(x){const t=(x||document.head).querySelector("style[data-docx-fonts]");t&&t.remove()}function ze(x){const r=new DOMParser().parseFromString(x,"application/xml").documentElement,n=[],a=r.getElementsByTagName("Relationship");for(let o=0;o<a.length;o++){const s=a[o],c=s.getAttribute("Type")||"";c===At.FONT&&n.push({id:s.getAttribute("Id")||"",type:c,target:s.getAttribute("Target")||"",targetMode:s.getAttribute("TargetMode")||void 0})}return n}const Gt="http://schemas.microsoft.com/office/word/2012/wordml";function Vt(x){const e=new Map;if(!x)return e;try{const r=bt(x).documentElement,n=r.getElementsByTagNameNS(Gt,"commentEx"),a=n.length>0?Array.from(n):Array.from(r.getElementsByTagName("commentEx"));for(const o of a){const s=Bt(o,"paraId");if(!s)continue;const c={paraId:s,paraIdParent:Bt(o,"paraIdParent"),done:Be(o,"done")};e.set(s,c)}console.log("[DEBUG] parseCommentsExtended: found",e.size,"extended comments")}catch(t){console.warn("解析 commentsExtended.xml 失败:",t)}return e}function Xt(x,e){const t=new Map;for(const n of x)n.paraId&&t.set(n.paraId,n);for(const n of x)n.replies=[];for(const[n,a]of e){const o=t.get(n);if(o&&(o.done=a.done,a.paraIdParent)){const s=t.get(a.paraIdParent);s&&(o.parentId=s.id,s.replies.push(o))}}const r=x.filter(n=>!n.parentId);return r.sort((n,a)=>{const o=new Date(n.date).getTime(),s=new Date(a.date).getTime();return o-s}),Yt(r),console.log("[DEBUG] buildCommentTree: root comments:",r.length,"total comments:",x.length),r}function Yt(x){for(const e of x)e.replies&&e.replies.length>0&&(e.replies.sort((t,r)=>{const n=new Date(t.date).getTime(),a=new Date(r.date).getTime();return n-a}),Yt(e.replies))}function Bt(x,e){let t=x.getAttributeNS(Gt,e);return t||(t=x.getAttribute(e),t)?t:(t=x.getAttribute(`w15:${e}`),t||void 0)}function Be(x,e){const t=Bt(x,e);return t?t==="1"||t==="true":!1}class qt{constructor(){nt(this,"zip",null);nt(this,"relationships",[]);nt(this,"images",new Map);nt(this,"theme");nt(this,"fontTable");nt(this,"embeddedFonts",[]);nt(this,"bookmarks",new Map)}async parse(e){const t=e instanceof ArrayBuffer?e:await e.arrayBuffer();this.zip=await re.loadAsync(t),this.bookmarks=new Map,await this.parseRelationships(),await this.loadImages();const r=await this.parseStyles(),n=new Map(r.map(u=>[u.id,u])),a=await this.parseComments(),o=new Map(a.map(u=>[u.id,u])),s=await this.parseCommentsExtended(),c=Xt(a,s),{numberings:p,abstractNumberings:f,numberingMap:y}=await this.parseNumberings();this.theme=await this.parseTheme();const m=await this.parseHeadersFooters("header"),h=await this.parseHeadersFooters("footer"),b=await this.parseFootnotes(),d=await this.parseEndnotes();return this.fontTable=await this.parseFontTable(),this.embeddedFonts=await this.loadEmbeddedFonts(),{body:await this.parseDocument(),comments:a,commentMap:o,rootComments:c,commentsExtendedMap:s,styles:r,styleMap:n,numberings:p,numberingMap:y,abstractNumberings:f,images:this.images,relationships:this.relationships,headers:m,footers:h,theme:this.theme,footnotes:b,endnotes:d,fontTable:this.fontTable,embeddedFonts:this.embeddedFonts,bookmarks:this.bookmarks}}getZip(){return this.zip}async parseRelationships(){var n,a;const e=await((a=(n=this.zip)==null?void 0:n.file(mt.RELS))==null?void 0:a.async("string"));if(!e)return;const r=bt(e).documentElement;this.relationships=C.elements(r,"Relationship").map(o=>({id:C.attr(o,"Id")||"",type:C.attr(o,"Type")||"",target:C.attr(o,"Target")||"",targetMode:C.attr(o,"TargetMode")}))}async loadImages(){var e;for(const t of this.relationships)if(t.type===At.IMAGE){const r=`word/${t.target}`,n=(e=this.zip)==null?void 0:e.file(r);if(n){const a=await n.async("blob"),o=await this.blobToBase64(a);this.images.set(t.id,o)}}}blobToBase64(e){return new Promise((t,r)=>{const n=new FileReader;n.onloadend=()=>t(n.result),n.onerror=r,n.readAsDataURL(e)})}async parseStyles(){var a,o;const e=await((o=(a=this.zip)==null?void 0:a.file(mt.STYLES))==null?void 0:o.async("string"));if(!e)return[];const t=bt(e),r=[],n=t.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main","style");for(let s=0;s<n.length;s++){const c=n[s],p=C.element(c,"name"),f=C.element(c,"basedOn"),y={id:C.attr(c,"styleId")||"",name:p?C.attr(p,"val"):void 0,type:C.attr(c,"type")||"paragraph",basedOn:f?C.attr(f,"val"):void 0},m=C.element(c,"pPr");m&&(y.paragraphProps=this.parseParagraphProperties(m));const h=C.element(c,"rPr");h&&(y.runProps=this.parseRunProperties(h)),r.push(y)}return r}async parseTheme(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.THEME))==null?void 0:r.async("string"));if(e)try{const n=bt(e);return Lt(n.documentElement)}catch(n){console.warn("主题解析失败:",n);return}}async parseFontTable(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.FONT_TABLE))==null?void 0:r.async("string"));if(e)try{return jt(e)}catch(n){console.warn("字体表解析失败:",n);return}}async loadEmbeddedFonts(){var t;if(!this.fontTable||!this.zip)return[];if(!this.fontTable.fonts.some(r=>r.embedFontRefs.length>0))return[];try{const r=await((t=this.zip.file(mt.FONT_TABLE_RELS))==null?void 0:t.async("string"));if(!r)return console.warn("找不到字体表关系文件"),[];const n=ze(r);return await Zt(this.zip,this.fontTable,n,{injectStyles:!0})}catch(r){return console.warn("嵌入字体加载失败:",r),[]}}async parseFootnotes(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.FOOTNOTES))==null?void 0:r.async("string"));if(!e)return new Map;try{const n=bt(e);return this.parseNotes(n.documentElement,"footnote",X.Footnote)}catch(n){return console.warn("脚注解析失败:",n),new Map}}async parseEndnotes(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.ENDNOTES))==null?void 0:r.async("string"));if(!e)return new Map;try{const n=bt(e);return this.parseNotes(n.documentElement,"endnote",X.Endnote)}catch(n){return console.warn("尾注解析失败:",n),new Map}}parseNotes(e,t,r){const n=new Map,a=e.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main",t);for(let o=0;o<a.length;o++){const s=a[o],c=C.attr(s,"id")||"",p=C.attr(s,"type");if(p==="separator"||p==="continuationSeparator")continue;const f={type:r,id:c,noteType:p,children:this.parseChildren(s)};n.set(c,f)}return n}async parseNumberings(){var c,p;const e=await((p=(c=this.zip)==null?void 0:c.file(mt.NUMBERING))==null?void 0:p.async("string"));if(!e)return{numberings:[],abstractNumberings:[],numberingMap:new Map};const r=bt(e).documentElement,n=[],a=new Map;for(const f of C.elements(r))switch(f.localName){case"abstractNum":n.push(this.parseAbstractNumbering(f));break;case"num":const y=C.attr(f,"numId")||"",m=C.element(f,"abstractNumId");if(m){const h=C.attr(m,"val")||"";a.set(y,h)}break}const o=[],s=new Map;for(const[f,y]of a){const m=n.find(h=>h.id===y);if(m){const h={id:f,abstractNumId:y,levels:m.levels.map(b=>({...b}))};o.push(h),s.set(f,h)}}return{numberings:o,abstractNumberings:n,numberingMap:s}}parseAbstractNumbering(e){const t={id:C.attr(e,"abstractNumId")||"",levels:[]};for(const r of C.elements(e))switch(r.localName){case"name":t.name=C.attr(r,"val");break;case"multiLevelType":t.multiLevelType=C.attr(r,"val");break;case"numStyleLink":t.numberingStyleLink=C.attr(r,"val");break;case"styleLink":t.styleLink=C.attr(r,"val");break;case"lvl":t.levels.push(this.parseNumberingLevel(r));break}return t}parseNumberingLevel(e){const t={level:C.intAttr(e,"ilvl")??0,format:"decimal",text:"",start:1,suffix:"tab"};for(const r of C.elements(e))switch(r.localName){case"start":t.start=C.intAttr(r,"val")??1;break;case"numFmt":t.format=C.attr(r,"val")||"decimal";break;case"lvlText":t.text=C.attr(r,"val")||"";break;case"suff":t.suffix=C.attr(r,"val")||"tab";break;case"pStyle":t.pStyleName=C.attr(r,"val");break;case"pPr":t.paragraphProps=this.parseParagraphProperties(r);break;case"rPr":t.runProps=this.parseRunProperties(r);break}return t}async parseComments(){var o,s,c;const e=await((s=(o=this.zip)==null?void 0:o.file(mt.COMMENTS))==null?void 0:s.async("string"));if(!e)return[];const t=bt(e),r=[],n=t.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main","comment"),a="http://schemas.microsoft.com/office/word/2010/wordml";for(let p=0;p<n.length;p++){const f=n[p],y=((c=f.textContent)==null?void 0:c.trim())||"";let m=f.getAttributeNS(a,"paraId");m||(m=f.getAttribute("w14:paraId")||null);const h={type:X.Comment,id:C.attr(f,"id")||"",author:C.attr(f,"author")||"未知",date:C.attr(f,"date")||new Date().toISOString(),initials:C.attr(f,"initials"),children:this.parseChildren(f),rawText:y,paraId:m||void 0};r.push(h)}return console.log("[DEBUG] parseComments: found",r.length,"comments"),r}async parseCommentsExtended(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.COMMENTS_EXTENDED))==null?void 0:r.async("string"));return e?(console.log("[DEBUG] commentsExtended.xml found, length:",e.length),Vt(e)):(console.log("[DEBUG] commentsExtended.xml not found"),new Map)}async parseDocument(){var p,f;const e=await((f=(p=this.zip)==null?void 0:p.file(mt.DOCUMENT))==null?void 0:f.async("string"));if(!e)return{type:X.Document,children:[]};const t=bt(e),r=t.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main","body")[0];if(!r)return{type:X.Document,children:[]};const n=C.element(r,"sectPr"),a=n?this.parseSectionProperties(n):void 0,o=t.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main","document")[0],s=o?C.element(o,"background"):null,c=s?this.parseBackground(s):void 0;return{type:X.Document,children:this.parseChildren(r),sectionProps:a,background:c}}async parseHeadersFooters(e){var n,a;const t=new Map,r=e==="header"?At.HEADER:At.FOOTER;for(const o of this.relationships)if(o.type===r){const s=`word/${o.target}`,c=await((a=(n=this.zip)==null?void 0:n.file(s))==null?void 0:a.async("string"));if(c){const f=bt(c).getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main",e==="header"?"hdr":"ftr")[0];if(f){const y={type:e==="header"?X.Header:X.Footer,children:this.parseChildren(f)};t.set(o.id,y)}}}return t}parseBackground(e){const t={},r=C.attr(e,"color");return r&&r!=="auto"&&(t["background-color"]=`#${r}`),t}parseSectionProperties(e){const t={};for(const r of C.elements(e))switch(r.localName){case"pgSz":t.pageSize=this.parsePageSize(r);break;case"pgMar":t.pageMargins=this.parsePageMargins(r);break;case"type":t.type=C.attr(r,"val")||"nextPage";break;case"cols":t.columns=this.parseColumns(r);break;case"pgBorders":t.pageBorders=this.parseBorders(r);break;case"pgNumType":t.pageNumber={start:C.intAttr(r,"start"),format:C.attr(r,"fmt"),chapSep:C.attr(r,"chapSep"),chapStyle:C.attr(r,"chapStyle")};break;case"headerReference":t.headerRefs||(t.headerRefs=[]),t.headerRefs.push({id:C.attr(r,"id")||"",type:C.attr(r,"type")||"default"});break;case"footerReference":t.footerRefs||(t.footerRefs=[]),t.footerRefs.push({id:C.attr(r,"id")||"",type:C.attr(r,"type")||"default"});break;case"titlePg":t.titlePage=C.boolAttr(r,"val")!==!1;break}return t}parsePageSize(e){return{width:C.lengthAttr(e,"w"),height:C.lengthAttr(e,"h"),orientation:C.attr(e,"orient")}}parsePageMargins(e){return{top:C.lengthAttr(e,"top"),right:C.lengthAttr(e,"right"),bottom:C.lengthAttr(e,"bottom"),left:C.lengthAttr(e,"left"),header:C.lengthAttr(e,"header"),footer:C.lengthAttr(e,"footer"),gutter:C.lengthAttr(e,"gutter")}}parseColumns(e){const t={numberOfColumns:C.intAttr(e,"num"),space:C.lengthAttr(e,"space"),separator:C.boolAttr(e,"sep"),equalWidth:C.boolAttr(e,"equalWidth")!==!1,columns:[]};for(const r of C.elements(e,"col"))t.columns.push({width:C.lengthAttr(r,"w"),space:C.lengthAttr(r,"space")});return t}parseBorders(e){const t={};for(const r of C.elements(e)){const n=this.parseBorder(r);switch(r.localName){case"top":t.top=n;break;case"bottom":t.bottom=n;break;case"left":case"start":t.left=n;break;case"right":case"end":t.right=n;break}}return t}parseBorder(e){const t=C.attr(e,"color");return{style:C.attr(e,"val"),width:C.lengthAttr(e,"sz",Ct.Border),color:t&&t!=="auto"?`#${t}`:void 0}}parseChildren(e,t=!1){const r=[];for(const n of C.elements(e)){const a=this.parseElement(n);a&&r.push(a)}return t&&r.length===0&&console.log("[DEBUG] parseChildren: no children parsed from",e.localName,"childNodes:",e.childNodes.length,"elements:",C.elements(e).map(n=>n.localName)),r}parseElement(e){var r;const t=e.localName;switch(t){case"p":return this.parseParagraph(e);case"r":return this.parseRun(e);case"t":return this.parseText(e);case"br":return this.parseBreak(e);case"tab":return this.parseTab();case"sym":return this.parseSymbol(e);case"lastRenderedPageBreak":return{type:X.Break,breakType:"lastRenderedPageBreak"};case"fldSimple":return this.parseSimpleField(e);case"fldChar":return this.parseComplexField(e);case"instrText":return this.parseFieldInstruction(e);case"tbl":return this.parseTable(e);case"tr":return this.parseTableRow(e);case"tc":return this.parseTableCell(e);case"hyperlink":return this.parseHyperlink(e);case"drawing":return this.parseDrawing(e);case"commentRangeStart":return this.parseCommentRangeStart(e);case"commentRangeEnd":return this.parseCommentRangeEnd(e);case"commentReference":return this.parseCommentReference(e);case"footnoteReference":return this.parseFootnoteReference(e);case"endnoteReference":return this.parseEndnoteReference(e);case"bookmarkStart":return this.parseBookmarkStart(e);case"bookmarkEnd":return this.parseBookmarkEnd(e);default:console.log("[DEBUG] parseElement default branch for:",t);const n=this.parseChildren(e);if(n.length>0)return console.log("[DEBUG] -> found children:",n.length),n.length===1?n[0]:{type:X.Run,children:n};const a=(r=e.textContent)==null?void 0:r.trim();return a?(console.log("[DEBUG] -> using textContent:",a.substring(0,50)),{type:X.Text,text:a}):null}}parseParagraph(e){const t=C.element(e,"pPr");return{type:X.Paragraph,props:t?this.parseParagraphProperties(t):void 0,children:this.parseChildren(e).filter(r=>r.type!==X.Paragraph)}}parseParagraphProperties(e){const t={},r=C.element(e,"pStyle");r&&(t.styleId=C.attr(r,"val"));const n=C.element(e,"jc");if(n){const y=C.attr(n,"val");(y==="left"||y==="center"||y==="right"||y==="both")&&(t.justification=y)}const a=C.element(e,"ind");a&&(t.indentation={left:C.lengthAttr(a,"left"),right:C.lengthAttr(a,"right"),firstLine:C.lengthAttr(a,"firstLine"),hanging:C.lengthAttr(a,"hanging")});const o=C.element(e,"spacing");o&&(t.spacing={before:C.lengthAttr(o,"before"),after:C.lengthAttr(o,"after"),line:C.intAttr(o,"line"),lineRule:C.attr(o,"lineRule")});const s=C.element(e,"pageBreakBefore");s&&(t.pageBreakBefore=C.boolAttr(s,"val")!==!1);const c=C.element(e,"pBdr");c&&(t.borders=this.parseBorders(c));const p=C.element(e,"sectPr");p&&(t.sectionProps=this.parseSectionProperties(p));const f=C.element(e,"numPr");return f&&(t.numbering=this.parseParagraphNumbering(f)),t}parseParagraphNumbering(e){const t={id:"",level:0};for(const r of C.elements(e))switch(r.localName){case"numId":t.id=C.attr(r,"val")||"";break;case"ilvl":t.level=C.intAttr(r,"val")??0;break}if(t.id)return t}parseRun(e){const t=C.element(e,"rPr");return{type:X.Run,props:t?this.parseRunProperties(t):void 0,children:this.parseChildren(e)}}parseRunProperties(e){var b,d,_,u;const t={},r=C.element(e,"rStyle");r&&(t.styleId=C.attr(r,"val"));const n=C.element(e,"b");n&&(t.bold=C.attr(n,"val")!=="0");const a=C.element(e,"i");a&&(t.italic=C.attr(a,"val")!=="0");const o=C.element(e,"u");o&&(t.underline=C.attr(o,"val")||"single");const s=C.element(e,"strike");s&&(t.strike=C.attr(s,"val")!=="0");const c=C.element(e,"dstrike");c&&(t.dstrike=C.attr(c,"val")!=="0");const p=C.element(e,"vertAlign");if(p){const v=C.attr(p,"val");(v==="superscript"||v==="subscript")&&(t.vertAlign=v)}const f=C.element(e,"color");if(f){const v=C.attr(f,"val"),E=C.attr(f,"themeColor");if(E){const A=C.attr(f,"themeTint"),T=C.attr(f,"themeShade");if(t.themeColor={themeColor:E,themeTint:A?parseInt(A,16):void 0,themeShade:T?parseInt(T,16):void 0},this.theme){const D=$t(this.theme,t.themeColor);D&&(t.color=D)}}else v&&v!=="auto"&&(t.color=`#${v}`)}const y=C.element(e,"sz");y&&(t.fontSize=C.lengthAttr(y,"val",Ct.FontSize));const m=C.element(e,"rFonts");if(m){const v=C.attr(m,"asciiTheme"),E=C.attr(m,"eastAsiaTheme");if(v||E){const A=v||E||"";if(A.startsWith("major")){if(t.themeFontFamily="major",(d=(b=this.theme)==null?void 0:b.fontScheme)!=null&&d.majorFont){const T=A.includes("EastAsia")?this.theme.fontScheme.majorFont.ea:this.theme.fontScheme.majorFont.latin;T&&(t.fontFamily=T)}}else if(A.startsWith("minor")&&(t.themeFontFamily="minor",(u=(_=this.theme)==null?void 0:_.fontScheme)!=null&&u.minorFont)){const T=A.includes("EastAsia")?this.theme.fontScheme.minorFont.ea:this.theme.fontScheme.minorFont.latin;T&&(t.fontFamily=T)}}t.fontFamily||(t.fontFamily=C.attr(m,"ascii")||C.attr(m,"eastAsia")||C.attr(m,"hAnsi"))}const h=C.element(e,"highlight");return h&&(t.highlight=C.attr(h,"val")),t}parseText(e){return{type:X.Text,text:e.textContent||""}}parseBreak(e){const t=C.attr(e,"type");return{type:X.Break,breakType:t||"textWrapping"}}parseTab(){return{type:X.Tab}}parseSymbol(e){const t=C.attr(e,"font"),r=C.attr(e,"char");let n;if(r){const a=parseInt(r,16);isNaN(a)||(n=String.fromCharCode(a))}return{type:X.Symbol,font:t,char:n}}parseSimpleField(e){return{type:X.SimpleField,instruction:C.attr(e,"instr")||"",children:this.parseChildren(e)}}parseComplexField(e){return{type:X.ComplexField,charType:C.attr(e,"fldCharType")||""}}parseFieldInstruction(e){return{type:X.FieldInstruction,text:e.textContent||""}}parseTable(e){const t={type:X.Table,children:[]};for(const r of C.elements(e))switch(r.localName){case"tr":t.children.push(this.parseTableRow(r));break;case"tblGrid":t.columns=this.parseTableGrid(r);break;case"tblPr":t.props=this.parseTableProperties(r);break}return t}parseTableGrid(e){const t=[];for(const r of C.elements(e))r.localName==="gridCol"&&t.push({width:C.lengthAttr(r,"w")});return t}parseTableProperties(e){const t={};for(const r of C.elements(e))switch(r.localName){case"tblW":t.width=C.lengthAttr(r,"w");const n=C.attr(r,"type");(n==="auto"||n==="dxa"||n==="pct")&&(t.widthType=n);break;case"jc":t.justification=C.attr(r,"val");break;case"tblBorders":t.borders=this.parseTableBorders(r);break;case"tblCellSpacing":t.cellSpacing=C.lengthAttr(r,"w");break;case"tblCellMar":t.cellMargin={top:C.lengthAttr(C.element(r,"top"),"w"),bottom:C.lengthAttr(C.element(r,"bottom"),"w"),left:C.lengthAttr(C.element(r,"left"),"w")||C.lengthAttr(C.element(r,"start"),"w"),right:C.lengthAttr(C.element(r,"right"),"w")||C.lengthAttr(C.element(r,"end"),"w")};break}return t}parseTableBorders(e){const t={};for(const r of C.elements(e)){const n=this.parseBorder(r);switch(r.localName){case"top":t.top=n;break;case"bottom":t.bottom=n;break;case"left":case"start":t.left=n;break;case"right":case"end":t.right=n;break;case"insideH":t.insideH=n;break;case"insideV":t.insideV=n;break}}return t}parseTableRow(e){return{type:X.TableRow,children:C.elements(e).filter(t=>t.localName==="tc").map(t=>this.parseTableCell(t))}}parseTableCell(e){const t={type:X.TableCell,children:[]};for(const r of C.elements(e))if(r.localName==="tcPr")t.props=this.parseTableCellProperties(r);else{const n=this.parseElement(r);n&&t.children.push(n)}return t}parseTableCellProperties(e){const t={};for(const r of C.elements(e))switch(r.localName){case"tcW":t.width=C.lengthAttr(r,"w");break;case"gridSpan":t.gridSpan=C.intAttr(r,"val");break;case"vMerge":const n=C.attr(r,"val");t.verticalMerge=n==="restart"?"restart":"continue";break;case"vAlign":t.verticalAlign=C.attr(r,"val");break;case"shd":const a=C.attr(r,"fill");a&&a!=="auto"&&(t.shading=`#${a}`);break;case"tcBorders":t.borders=this.parseBorders(r);break}return t}parseHyperlink(e){const t=C.attr(e,"id");let r;if(t){const n=this.relationships.find(a=>a.id===t);n&&(r=n.target)}return{type:X.Hyperlink,href:r,anchor:C.attr(e,"anchor"),children:this.parseChildren(e)}}parseDrawing(e){const t=[],r=e.getElementsByTagNameNS("http://schemas.openxmlformats.org/drawingml/2006/main","blip");for(let n=0;n<r.length;n++){const o=r[n].getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships","embed");if(o&&this.images.has(o)){const s=e.getElementsByTagNameNS("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","extent")[0];let c,p;if(s){const f=s.getAttribute("cx"),y=s.getAttribute("cy");f&&(c=C.convertLength(f,Ct.Emu)),y&&(p=C.convertLength(y,Ct.Emu))}t.push({type:X.Image,src:this.images.get(o),width:c,height:p})}}return{type:X.Drawing,children:t}}parseCommentRangeStart(e){return{type:X.CommentRangeStart,id:C.attr(e,"id")||""}}parseCommentRangeEnd(e){return{type:X.CommentRangeEnd,id:C.attr(e,"id")||""}}parseCommentReference(e){return{type:X.CommentReference,id:C.attr(e,"id")||""}}parseFootnoteReference(e){return{type:X.FootnoteReference,id:C.attr(e,"id")||""}}parseEndnoteReference(e){return{type:X.EndnoteReference,id:C.attr(e,"id")||""}}parseBookmarkStart(e){const t={type:X.BookmarkStart,id:C.attr(e,"id")||"",name:C.attr(e,"name")||"",colFirst:C.intAttr(e,"colFirst"),colLast:C.intAttr(e,"colLast")};return t.name&&!t.name.startsWith("_")&&this.bookmarks.set(t.name,t),t}parseBookmarkEnd(e){return{type:X.BookmarkEnd,id:C.attr(e,"id")||""}}}class Kt{constructor(e){nt(this,"document",null);nt(this,"container");nt(this,"options");nt(this,"classPrefix");nt(this,"commentRanges",new Map);nt(this,"activeCommentId",null);nt(this,"svgLayer",null);nt(this,"currentCommentIds",new Set);nt(this,"commentStartInParagraph",new Set);nt(this,"currentPageNumber",1);nt(this,"totalPages",1);nt(this,"inComplexField",!1);nt(this,"currentFieldInstruction","");nt(this,"skipFieldContent",!1);nt(this,"numberingCounters",new Map);nt(this,"currentFootnoteIds",[]);nt(this,"currentEndnoteIds",[]);nt(this,"footnoteCounter",0);nt(this,"endnoteCounter",0);nt(this,"tableVerticalMerges",[]);nt(this,"currentVerticalMerge",new Map);nt(this,"currentCellCol",0);nt(this,"currentTableBorders");nt(this,"tableBordersStack",[]);nt(this,"currentTableRowIndex",0);nt(this,"currentTableRowCount",0);nt(this,"currentTableColCount",0);const t=typeof e.container=="string"?document.querySelector(e.container):e.container;if(!t)throw new Error("容器元素不存在");this.container=t,this.classPrefix=e.classNamePrefix||"docx",this.options={container:this.container,renderComments:e.renderComments??!0,enableCommentEdit:e.enableCommentEdit??!0,showCommentLines:e.showCommentLines??!0,breakPages:e.breakPages??!0,classNamePrefix:this.classPrefix,onCommentClick:e.onCommentClick||(()=>{}),onCommentChange:e.onCommentChange||(()=>{}),onCommentAccept:e.onCommentAccept,onCommentReject:e.onCommentReject}}render(e){this.document=e,this.commentRanges.clear(),this.currentCommentIds.clear(),this.numberingCounters.clear(),this.currentFootnoteIds=[],this.currentEndnoteIds=[],this.footnoteCounter=0,this.endnoteCounter=0;for(const a of e.comments)this.commentRanges.set(a.id,{id:a.id,startElement:null,endElement:null,highlightElements:[],panelElement:null});this.container.innerHTML="",this.container.className=`${this.classPrefix}-container`;const t=this.createElement("div",`${this.classPrefix}-wrapper`);this.options.breakPages?this.renderWithPages(t,e):this.renderSinglePage(t,e),this.container.appendChild(t),this.options.showCommentLines&&(this.svgLayer=this.createSvgLayer(),this.container.appendChild(this.svgLayer)),this.options.renderComments&&this.renderAllCommentBubbles();let r=!1;const n=()=>{r||(requestAnimationFrame(()=>{this.positionCommentBubbles(),this.updateLines(),r=!1}),r=!0)};t.addEventListener("scroll",()=>{this.positionCommentBubbles(),this.updateLines()},{passive:!0}),window.addEventListener("resize",n),requestAnimationFrame(()=>{this.positionCommentBubbles(),this.updateLines()})}renderSinglePage(e,t){const r=this.createElement("div",`${this.classPrefix}-document`),n=this.createElement("div",`${this.classPrefix}-page`),a=this.renderElement(t.body);a&&n.appendChild(a),this.renderPageFootnotes(this.currentFootnoteIds,n),r.appendChild(n),e.appendChild(r),this.renderDocumentEndnotes(e)}renderWithPages(e,t){const r=t.body,n=r.sectionProps,a=this.splitBySection(r.children||[],n),o=this.groupByPageBreaks(a);this.totalPages=o.length;let s;for(let c=0;c<o.length;c++){this.currentPageNumber=c+1;const p=this.currentFootnoteIds.length,f=o[c];if(f.length===0)continue;let m=f[0].sectProps||n;const h=this.createPageElement(m);m!=null&&m.headerRefs&&this.renderHeaderFooter(m.headerRefs,m,c,s!==m,h,"header");for(const d of f){const _=this.createSectionContent(d.sectProps);for(const u of d.elements){const v=this.renderElement(u);v&&_.appendChild(v)}h.appendChild(_),m=d.sectProps||m}const b=this.currentFootnoteIds.slice(p);this.renderPageFootnotes(b,h),m!=null&&m.footerRefs&&this.renderHeaderFooter(m.footerRefs,m,c,s!==m,h,"footer"),e.appendChild(h),s=m}this.renderDocumentEndnotes(e)}splitBySection(e,t){var o,s;const r=[];let n={sectProps:null,elements:[],pageBreak:!1};r.push(n);for(const c of e)if(c.type===X.Paragraph&&(o=c.props)!=null&&o.pageBreakBefore&&(n.pageBreak=!0,n={sectProps:null,elements:[],pageBreak:!1},r.push(n)),n.elements.push(c),c.type===X.Paragraph){const p=c,f=(s=p.props)==null?void 0:s.sectionProps;let y=!1;const m=h=>{for(const b of h){if(b.type===X.Break){const d=b;if(d.breakType==="page"||d.breakType==="lastRenderedPageBreak"){y=!0;return}}b.type===X.Run&&b.children&&m(b.children)}};this.options.breakPages&&p.children&&m(p.children),(f||y)&&(n.sectProps=f||null,n.pageBreak=y,n={sectProps:null,elements:[],pageBreak:!1},r.push(n))}let a=null;for(let c=r.length-1;c>=0;c--)r[c].sectProps===null?r[c].sectProps=a||t||null:a=r[c].sectProps;return r}groupByPageBreaks(e){const t=[];let r=[];t.push(r);let n=null;for(const a of e)r.push(a),(a.pageBreak||this.isPageBreakSection(n,a.sectProps))&&(r=[],t.push(r)),n=a.sectProps;return t.filter(a=>a.length>0)}isPageBreakSection(e,t){if(!e||!t)return!1;const r=e.pageSize,n=t.pageSize;return!r||!n?!1:r.orientation!==n.orientation||r.width!==n.width||r.height!==n.height}createPageElement(e){const t=this.createElement("section",`${this.classPrefix}-page`);if(e&&(e.pageSize&&(e.pageSize.width&&(t.style.width=e.pageSize.width),e.pageSize.height&&(t.style.minHeight=e.pageSize.height)),e.pageMargins)){const r=e.pageMargins;r.top&&(t.style.paddingTop=r.top),r.right&&(t.style.paddingRight=r.right),r.bottom&&(t.style.paddingBottom=r.bottom),r.left&&(t.style.paddingLeft=r.left)}return t}createSectionContent(e){const t=this.createElement("article",`${this.classPrefix}-section-content`);if(e!=null&&e.columns){const r=e.columns;r.numberOfColumns&&r.numberOfColumns>1&&(t.style.columnCount=String(r.numberOfColumns),r.space&&(t.style.columnGap=r.space),r.separator&&(t.style.columnRule="1px solid #ccc"))}return t}renderHeaderFooter(e,t,r,n,a,o){var y,m;if(!e||e.length===0)return;let s=null;if(t.titlePage&&n&&(s=e.find(h=>h.type==="first")),s||r%2===1&&(s=e.find(h=>h.type==="even")),s||(s=e.find(h=>h.type==="default")),!s)return;const c=o==="header"?(y=this.document)==null?void 0:y.headers:(m=this.document)==null?void 0:m.footers,p=c==null?void 0:c.get(s.id);if(!p)return;const f=this.createElement("div",`${this.classPrefix}-${o}`);for(const h of p.children||[]){const b=this.renderElement(h);b&&f.appendChild(b)}if(t.pageMargins){const h=t.pageMargins;o==="header"&&h.header&&h.top?(f.style.marginTop=`calc(${h.header} - ${h.top})`,f.style.minHeight=`calc(${h.top} - ${h.header})`):o==="footer"&&h.footer&&h.bottom&&(f.style.marginBottom=`calc(${h.footer} - ${h.bottom})`,f.style.minHeight=`calc(${h.bottom} - ${h.footer})`)}o==="header"?a.insertBefore(f,a.firstChild):a.appendChild(f)}renderAllCommentBubbles(){var r;const e=this.createElement("div",`${this.classPrefix}-comments-layer`);this.container.appendChild(e);const t=((r=this.document)==null?void 0:r.comments)||[];console.log("[DEBUG] renderAllCommentBubbles - Total comments:",t.length),t.forEach(n=>{var a;console.log("[DEBUG] Comment:",{id:n.id,author:n.author,date:n.date,childrenCount:((a=n.children)==null?void 0:a.length)||0,text:this.getCommentText(n)})}),console.log("[DEBUG] Comment ranges count:",this.commentRanges.size);for(const n of t){const a=this.commentRanges.get(n.id);if(a&&a.highlightElements.length>0){const o=this.createCommentBubble(n);a.panelElement=o,e.appendChild(o)}}}positionCommentBubbles(){const e=this.container.querySelector(`.${this.classPrefix}-comments-layer`),t=this.container.querySelector(`.${this.classPrefix}-page`);if(e&&t){const o=t.getBoundingClientRect();e.style.left=`${o.right+10}px`}const r=[],n=60,a=window.innerHeight-40;for(const[,o]of this.commentRanges){if(!o.panelElement||o.highlightElements.length===0)continue;const c=o.highlightElements[0].getBoundingClientRect(),p=c.top+c.height/2;p>n&&p<a?(r.push({range:o,top:c.top}),o.panelElement.style.display="block"):o.panelElement.style.display="none"}for(const{range:o,top:s}of r)o.panelElement.style.top=`${s}px`}createSvgLayer(){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.classList.add(`${this.classPrefix}-lines`),e}updateLines(){if(this.svgLayer){this.svgLayer.innerHTML="";for(const[e]of this.commentRanges){const t=e===this.activeCommentId;this.drawCommentLine(e,t)}}}drawCommentLine(e,t){const r=this.commentRanges.get(e);if(!r||!r.highlightElements.length||!r.panelElement||!this.svgLayer||r.panelElement.style.display==="none")return;const n=r.highlightElements[0].getBoundingClientRect(),a=r.panelElement.getBoundingClientRect(),o=n.right,s=n.top+n.height/2,c=a.left,p=s,f=document.createElementNS("http://www.w3.org/2000/svg","line");f.setAttribute("x1",String(o)),f.setAttribute("y1",String(s)),f.setAttribute("x2",String(c)),f.setAttribute("y2",String(p)),f.setAttribute("stroke","#ef4444"),f.setAttribute("stroke-width",t?"2":"1"),this.svgLayer.appendChild(f)}renderElement(e){switch(e.type){case X.Document:return this.renderDocument(e);case X.Paragraph:return this.renderParagraph(e);case X.Run:return this.renderRun(e);case X.Text:return this.renderText(e);case X.Break:return this.renderBreak(e);case X.Tab:return this.renderTab();case X.Symbol:return this.renderSymbol(e);case X.SimpleField:return this.renderSimpleField(e);case X.ComplexField:return this.renderComplexField(e);case X.FieldInstruction:return this.renderFieldInstruction(e);case X.Table:return this.renderTable(e);case X.TableRow:return this.renderTableRow(e);case X.TableCell:return this.renderTableCell(e);case X.Hyperlink:return this.renderHyperlink(e);case X.Drawing:return this.renderDrawing(e);case X.Image:return this.renderImage(e);case X.CommentRangeStart:return this.renderCommentRangeStart(e);case X.CommentRangeEnd:return this.renderCommentRangeEnd(e);case X.CommentReference:return this.renderCommentReference(e);case X.FootnoteReference:return this.renderFootnoteReference(e);case X.EndnoteReference:return this.renderEndnoteReference(e);case X.Footnote:return this.renderFootnote(e);case X.Endnote:return this.renderEndnote(e);case X.BookmarkStart:return this.renderBookmarkStart(e);case X.BookmarkEnd:return this.renderBookmarkEnd(e);default:return null}}renderDocument(e){const t=this.createElement("article",`${this.classPrefix}-body`);return this.renderChildren(e.children||[],t),t}renderParagraph(e){const t=this.createElement("p",`${this.classPrefix}-p`);this.commentStartInParagraph.clear(),e.props&&this.applyParagraphStyles(t,e.props);const r=this.renderNumbering(e.props);return r&&(t.insertBefore(r,t.firstChild),t.classList.add(`${this.classPrefix}-list-item`)),this.renderChildren(e.children||[],t),(t.childNodes.length===0||t.childNodes.length===1&&r)&&t.appendChild(document.createElement("br")),this.commentStartInParagraph.size>0&&this.options.renderComments&&(t.dataset.commentIds=Array.from(this.commentStartInParagraph).join(",")),t}renderNumbering(e){var f,y;if(!(e!=null&&e.numbering)||!((f=this.document)!=null&&f.numberingMap))return null;const{id:t,level:r}=e.numbering,n=this.document.numberingMap.get(t);if(!n)return null;const a=n.levels.find(m=>m.level===r);if(!a)return null;const o=this.getNumberingContent(n,a,t,r),s=this.createElement("span",`${this.classPrefix}-numbering`);s.textContent=o,a.runProps&&this.applyRunStyles(s,a.runProps);const c=this.createElement("span",`${this.classPrefix}-numbering-suffix`);switch(a.suffix){case"tab":c.innerHTML="&emsp;";break;case"space":c.innerHTML="&nbsp;";break}const p=this.createElement("span",`${this.classPrefix}-numbering-wrapper`);if(p.appendChild(s),p.appendChild(c),(y=a.paragraphProps)!=null&&y.indentation){const m=a.paragraphProps.indentation;m.left&&(p.style.marginLeft=m.left),m.hanging&&(p.style.textIndent=`-${m.hanging}`,p.style.paddingLeft=m.hanging)}return p}getNumberingContent(e,t,r,n){const a=t.format,o=t.text;if(a==="bullet")return o||"•";const s=`${r}-${n}`;let c=this.numberingCounters.get(s)??t.start-1;c++,this.numberingCounters.set(s,c);for(let f=n+1;f<=8;f++)this.numberingCounters.delete(`${r}-${f}`);let p=o;for(let f=0;f<=n;f++){const y=this.numberingCounters.get(`${r}-${f}`)??1,m=e.levels.find(d=>d.level===f),h=(m==null?void 0:m.format)||"decimal",b=this.formatNumber(y,h);p=p.replace(`%${f+1}`,b)}return p}formatNumber(e,t){switch(t){case"decimal":return String(e);case"decimalZero":return e<10?`0${e}`:String(e);case"lowerLetter":return this.toLetters(e,!1);case"upperLetter":return this.toLetters(e,!0);case"lowerRoman":return this.toRoman(e).toLowerCase();case"upperRoman":return this.toRoman(e);case"chineseCountingThousand":case"chineseCounting":return this.toChinese(e);case"ideographTraditional":return this.toChineseTraditional(e);case"bullet":return"•";default:return String(e)}}toLetters(e,t){const r=t?65:97;let n="";for(;e>0;)e--,n=String.fromCharCode(r+e%26)+n,e=Math.floor(e/26);return n}toRoman(e){const t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r="";for(const[n,a]of t)for(;e>=n;)r+=a,e-=n;return r}toChinese(e){const t=["零","一","二","三","四","五","六","七","八","九"],r=["","十","百","千","万"];if(e<=10)return e===10?"十":t[e];let n="",a=0;for(;e>0;){const o=e%10;o!==0?n=t[o]+r[a]+n:n&&!n.startsWith("零")&&(n="零"+n),e=Math.floor(e/10),a++}return n.startsWith("一十")&&(n=n.substring(1)),n}toChineseTraditional(e){const t=["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"];return e>=1&&e<=10?t[e-1]:String(e)}createCommentBubble(e){const t=this.createElement("div",`${this.classPrefix}-comment-bubble`);t.dataset.commentId=e.id;const r=e.initials||e.author.charAt(0).toUpperCase(),n=this.formatDate(e.date),a=this.getCommentText(e),s=this.options.enableCommentEdit||this.options.onCommentAccept||this.options.onCommentReject?`
19
+ }`}function Ae(x){switch(x){case"bold":case"boldItalic":return"700";default:return"400"}}function Re(x){switch(x){case"italic":case"boldItalic":return"italic";default:return"normal"}}function Fe(x){switch(x){case"opentype":return"opentype";case"truetype":return"truetype";case"embedded-opentype":return"embedded-opentype";default:return"truetype"}}function Pe(x){return x.replace(/"/g,'\\"')}function Ie(x){const t=(x||document.head).querySelector("style[data-docx-fonts]");t&&t.remove()}function ze(x){const r=new DOMParser().parseFromString(x,"application/xml").documentElement,n=[],a=r.getElementsByTagName("Relationship");for(let o=0;o<a.length;o++){const s=a[o],c=s.getAttribute("Type")||"";c===At.FONT&&n.push({id:s.getAttribute("Id")||"",type:c,target:s.getAttribute("Target")||"",targetMode:s.getAttribute("TargetMode")||void 0})}return n}const Gt="http://schemas.microsoft.com/office/word/2012/wordml";function Vt(x){const e=new Map;if(!x)return e;try{const r=bt(x).documentElement,n=r.getElementsByTagNameNS(Gt,"commentEx"),a=n.length>0?Array.from(n):Array.from(r.getElementsByTagName("commentEx"));for(const o of a){const s=Bt(o,"paraId");if(!s)continue;const c={paraId:s,paraIdParent:Bt(o,"paraIdParent"),done:Be(o,"done")};e.set(s,c)}console.log("[DEBUG] parseCommentsExtended: found",e.size,"extended comments")}catch(t){console.warn("解析 commentsExtended.xml 失败:",t)}return e}function Xt(x,e){const t=new Map;for(const n of x)n.paraId&&t.set(n.paraId,n);for(const n of x)n.replies=[];for(const[n,a]of e){const o=t.get(n);if(o&&(o.done=a.done,a.paraIdParent)){const s=t.get(a.paraIdParent);s&&(o.parentId=s.id,s.replies.push(o))}}const r=x.filter(n=>!n.parentId);return r.sort((n,a)=>{const o=new Date(n.date).getTime(),s=new Date(a.date).getTime();return o-s}),Yt(r),console.log("[DEBUG] buildCommentTree: root comments:",r.length,"total comments:",x.length),r}function Yt(x){for(const e of x)e.replies&&e.replies.length>0&&(e.replies.sort((t,r)=>{const n=new Date(t.date).getTime(),a=new Date(r.date).getTime();return n-a}),Yt(e.replies))}function Bt(x,e){let t=x.getAttributeNS(Gt,e);return t||(t=x.getAttribute(e),t)?t:(t=x.getAttribute(`w15:${e}`),t||void 0)}function Be(x,e){const t=Bt(x,e);return t?t==="1"||t==="true":!1}class qt{constructor(){nt(this,"zip",null);nt(this,"relationships",[]);nt(this,"images",new Map);nt(this,"theme");nt(this,"fontTable");nt(this,"embeddedFonts",[]);nt(this,"bookmarks",new Map)}async parse(e){const t=e instanceof ArrayBuffer?e:await e.arrayBuffer();this.zip=await re.loadAsync(t),this.bookmarks=new Map,await this.parseRelationships(),await this.loadImages();const r=await this.parseStyles(),n=new Map(r.map(u=>[u.id,u])),a=await this.parseComments(),o=new Map(a.map(u=>[u.id,u])),s=await this.parseCommentsExtended(),c=Xt(a,s),{numberings:p,abstractNumberings:f,numberingMap:y}=await this.parseNumberings();this.theme=await this.parseTheme();const m=await this.parseHeadersFooters("header"),h=await this.parseHeadersFooters("footer"),b=await this.parseFootnotes(),d=await this.parseEndnotes();return this.fontTable=await this.parseFontTable(),this.embeddedFonts=await this.loadEmbeddedFonts(),{body:await this.parseDocument(),comments:a,commentMap:o,rootComments:c,commentsExtendedMap:s,styles:r,styleMap:n,numberings:p,numberingMap:y,abstractNumberings:f,images:this.images,relationships:this.relationships,headers:m,footers:h,theme:this.theme,footnotes:b,endnotes:d,fontTable:this.fontTable,embeddedFonts:this.embeddedFonts,bookmarks:this.bookmarks}}getZip(){return this.zip}async parseRelationships(){var n,a;const e=await((a=(n=this.zip)==null?void 0:n.file(mt.RELS))==null?void 0:a.async("string"));if(!e)return;const r=bt(e).documentElement;this.relationships=C.elements(r,"Relationship").map(o=>({id:C.attr(o,"Id")||"",type:C.attr(o,"Type")||"",target:C.attr(o,"Target")||"",targetMode:C.attr(o,"TargetMode")}))}async loadImages(){var e;for(const t of this.relationships)if(t.type===At.IMAGE){const r=`word/${t.target}`,n=(e=this.zip)==null?void 0:e.file(r);if(n){const a=await n.async("blob"),o=await this.blobToBase64(a);this.images.set(t.id,o)}}}blobToBase64(e){return new Promise((t,r)=>{const n=new FileReader;n.onloadend=()=>t(n.result),n.onerror=r,n.readAsDataURL(e)})}async parseStyles(){var a,o;const e=await((o=(a=this.zip)==null?void 0:a.file(mt.STYLES))==null?void 0:o.async("string"));if(!e)return[];const t=bt(e),r=[],n=t.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main","style");for(let s=0;s<n.length;s++){const c=n[s],p=C.element(c,"name"),f=C.element(c,"basedOn"),y={id:C.attr(c,"styleId")||"",name:p?C.attr(p,"val"):void 0,type:C.attr(c,"type")||"paragraph",basedOn:f?C.attr(f,"val"):void 0},m=C.element(c,"pPr");m&&(y.paragraphProps=this.parseParagraphProperties(m));const h=C.element(c,"rPr");h&&(y.runProps=this.parseRunProperties(h)),r.push(y)}return r}async parseTheme(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.THEME))==null?void 0:r.async("string"));if(e)try{const n=bt(e);return Lt(n.documentElement)}catch(n){console.warn("主题解析失败:",n);return}}async parseFontTable(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.FONT_TABLE))==null?void 0:r.async("string"));if(e)try{return jt(e)}catch(n){console.warn("字体表解析失败:",n);return}}async loadEmbeddedFonts(){var t;if(!this.fontTable||!this.zip)return[];if(!this.fontTable.fonts.some(r=>r.embedFontRefs.length>0))return[];try{const r=await((t=this.zip.file(mt.FONT_TABLE_RELS))==null?void 0:t.async("string"));if(!r)return console.warn("找不到字体表关系文件"),[];const n=ze(r);return await Zt(this.zip,this.fontTable,n,{injectStyles:!0})}catch(r){return console.warn("嵌入字体加载失败:",r),[]}}async parseFootnotes(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.FOOTNOTES))==null?void 0:r.async("string"));if(!e)return new Map;try{const n=bt(e);return this.parseNotes(n.documentElement,"footnote",X.Footnote)}catch(n){return console.warn("脚注解析失败:",n),new Map}}async parseEndnotes(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.ENDNOTES))==null?void 0:r.async("string"));if(!e)return new Map;try{const n=bt(e);return this.parseNotes(n.documentElement,"endnote",X.Endnote)}catch(n){return console.warn("尾注解析失败:",n),new Map}}parseNotes(e,t,r){const n=new Map,a=e.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main",t);for(let o=0;o<a.length;o++){const s=a[o],c=C.attr(s,"id")||"",p=C.attr(s,"type");if(p==="separator"||p==="continuationSeparator")continue;const f={type:r,id:c,noteType:p,children:this.parseChildren(s)};n.set(c,f)}return n}async parseNumberings(){var c,p;const e=await((p=(c=this.zip)==null?void 0:c.file(mt.NUMBERING))==null?void 0:p.async("string"));if(!e)return{numberings:[],abstractNumberings:[],numberingMap:new Map};const r=bt(e).documentElement,n=[],a=new Map;for(const f of C.elements(r))switch(f.localName){case"abstractNum":n.push(this.parseAbstractNumbering(f));break;case"num":const y=C.attr(f,"numId")||"",m=C.element(f,"abstractNumId");if(m){const h=C.attr(m,"val")||"";a.set(y,h)}break}const o=[],s=new Map;for(const[f,y]of a){const m=n.find(h=>h.id===y);if(m){const h={id:f,abstractNumId:y,levels:m.levels.map(b=>({...b}))};o.push(h),s.set(f,h)}}return{numberings:o,abstractNumberings:n,numberingMap:s}}parseAbstractNumbering(e){const t={id:C.attr(e,"abstractNumId")||"",levels:[]};for(const r of C.elements(e))switch(r.localName){case"name":t.name=C.attr(r,"val");break;case"multiLevelType":t.multiLevelType=C.attr(r,"val");break;case"numStyleLink":t.numberingStyleLink=C.attr(r,"val");break;case"styleLink":t.styleLink=C.attr(r,"val");break;case"lvl":t.levels.push(this.parseNumberingLevel(r));break}return t}parseNumberingLevel(e){const t={level:C.intAttr(e,"ilvl")??0,format:"decimal",text:"",start:1,suffix:"tab"};for(const r of C.elements(e))switch(r.localName){case"start":t.start=C.intAttr(r,"val")??1;break;case"numFmt":t.format=C.attr(r,"val")||"decimal";break;case"lvlText":t.text=C.attr(r,"val")||"";break;case"suff":t.suffix=C.attr(r,"val")||"tab";break;case"pStyle":t.pStyleName=C.attr(r,"val");break;case"pPr":t.paragraphProps=this.parseParagraphProperties(r);break;case"rPr":t.runProps=this.parseRunProperties(r);break}return t}async parseComments(){var o,s,c;const e=await((s=(o=this.zip)==null?void 0:o.file(mt.COMMENTS))==null?void 0:s.async("string"));if(!e)return[];const t=bt(e),r=[],n=t.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main","comment"),a="http://schemas.microsoft.com/office/word/2010/wordml";for(let p=0;p<n.length;p++){const f=n[p],y=((c=f.textContent)==null?void 0:c.trim())||"";let m=f.getAttributeNS(a,"paraId");m||(m=f.getAttribute("w14:paraId")||null);const h={type:X.Comment,id:C.attr(f,"id")||"",author:C.attr(f,"author")||"未知",date:C.attr(f,"date")||new Date().toISOString(),initials:C.attr(f,"initials"),children:this.parseChildren(f),rawText:y,paraId:m||void 0};r.push(h)}return console.log("[DEBUG] parseComments: found",r.length,"comments"),r}async parseCommentsExtended(){var t,r;const e=await((r=(t=this.zip)==null?void 0:t.file(mt.COMMENTS_EXTENDED))==null?void 0:r.async("string"));return e?(console.log("[DEBUG] commentsExtended.xml found, length:",e.length),Vt(e)):(console.log("[DEBUG] commentsExtended.xml not found"),new Map)}async parseDocument(){var p,f;const e=await((f=(p=this.zip)==null?void 0:p.file(mt.DOCUMENT))==null?void 0:f.async("string"));if(!e)return{type:X.Document,children:[]};const t=bt(e),r=t.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main","body")[0];if(!r)return{type:X.Document,children:[]};const n=C.element(r,"sectPr"),a=n?this.parseSectionProperties(n):void 0,o=t.getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main","document")[0],s=o?C.element(o,"background"):null,c=s?this.parseBackground(s):void 0;return{type:X.Document,children:this.parseChildren(r),sectionProps:a,background:c}}async parseHeadersFooters(e){var n,a;const t=new Map,r=e==="header"?At.HEADER:At.FOOTER;for(const o of this.relationships)if(o.type===r){const s=`word/${o.target}`,c=await((a=(n=this.zip)==null?void 0:n.file(s))==null?void 0:a.async("string"));if(c){const f=bt(c).getElementsByTagNameNS("http://schemas.openxmlformats.org/wordprocessingml/2006/main",e==="header"?"hdr":"ftr")[0];if(f){const y={type:e==="header"?X.Header:X.Footer,children:this.parseChildren(f)};t.set(o.id,y)}}}return t}parseBackground(e){const t={},r=C.attr(e,"color");return r&&r!=="auto"&&(t["background-color"]=`#${r}`),t}parseSectionProperties(e){const t={};for(const r of C.elements(e))switch(r.localName){case"pgSz":t.pageSize=this.parsePageSize(r);break;case"pgMar":t.pageMargins=this.parsePageMargins(r);break;case"type":t.type=C.attr(r,"val")||"nextPage";break;case"cols":t.columns=this.parseColumns(r);break;case"pgBorders":t.pageBorders=this.parseBorders(r);break;case"pgNumType":t.pageNumber={start:C.intAttr(r,"start"),format:C.attr(r,"fmt"),chapSep:C.attr(r,"chapSep"),chapStyle:C.attr(r,"chapStyle")};break;case"headerReference":t.headerRefs||(t.headerRefs=[]),t.headerRefs.push({id:C.attr(r,"id")||"",type:C.attr(r,"type")||"default"});break;case"footerReference":t.footerRefs||(t.footerRefs=[]),t.footerRefs.push({id:C.attr(r,"id")||"",type:C.attr(r,"type")||"default"});break;case"titlePg":t.titlePage=C.boolAttr(r,"val")!==!1;break}return t}parsePageSize(e){return{width:C.lengthAttr(e,"w"),height:C.lengthAttr(e,"h"),orientation:C.attr(e,"orient")}}parsePageMargins(e){return{top:C.lengthAttr(e,"top"),right:C.lengthAttr(e,"right"),bottom:C.lengthAttr(e,"bottom"),left:C.lengthAttr(e,"left"),header:C.lengthAttr(e,"header"),footer:C.lengthAttr(e,"footer"),gutter:C.lengthAttr(e,"gutter")}}parseColumns(e){const t={numberOfColumns:C.intAttr(e,"num"),space:C.lengthAttr(e,"space"),separator:C.boolAttr(e,"sep"),equalWidth:C.boolAttr(e,"equalWidth")!==!1,columns:[]};for(const r of C.elements(e,"col"))t.columns.push({width:C.lengthAttr(r,"w"),space:C.lengthAttr(r,"space")});return t}parseBorders(e){const t={};for(const r of C.elements(e)){const n=this.parseBorder(r);switch(r.localName){case"top":t.top=n;break;case"bottom":t.bottom=n;break;case"left":case"start":t.left=n;break;case"right":case"end":t.right=n;break}}return t}parseBorder(e){const t=C.attr(e,"color");return{style:C.attr(e,"val"),width:C.lengthAttr(e,"sz",Ct.Border),color:t&&t!=="auto"?`#${t}`:void 0}}parseChildren(e,t=!1){const r=[];for(const n of C.elements(e)){const a=this.parseElement(n);a&&r.push(a)}return t&&r.length===0&&console.log("[DEBUG] parseChildren: no children parsed from",e.localName,"childNodes:",e.childNodes.length,"elements:",C.elements(e).map(n=>n.localName)),r}parseElement(e){var r;const t=e.localName;switch(t){case"p":return this.parseParagraph(e);case"r":return this.parseRun(e);case"t":return this.parseText(e);case"br":return this.parseBreak(e);case"tab":return this.parseTab();case"sym":return this.parseSymbol(e);case"lastRenderedPageBreak":return{type:X.Break,breakType:"lastRenderedPageBreak"};case"fldSimple":return this.parseSimpleField(e);case"fldChar":return this.parseComplexField(e);case"instrText":return this.parseFieldInstruction(e);case"tbl":return this.parseTable(e);case"tr":return this.parseTableRow(e);case"tc":return this.parseTableCell(e);case"hyperlink":return this.parseHyperlink(e);case"drawing":return this.parseDrawing(e);case"commentRangeStart":return this.parseCommentRangeStart(e);case"commentRangeEnd":return this.parseCommentRangeEnd(e);case"commentReference":return this.parseCommentReference(e);case"footnoteReference":return this.parseFootnoteReference(e);case"endnoteReference":return this.parseEndnoteReference(e);case"bookmarkStart":return this.parseBookmarkStart(e);case"bookmarkEnd":return this.parseBookmarkEnd(e);default:console.log("[DEBUG] parseElement default branch for:",t);const n=this.parseChildren(e);if(n.length>0)return console.log("[DEBUG] -> found children:",n.length),n.length===1?n[0]:{type:X.Run,children:n};const a=(r=e.textContent)==null?void 0:r.trim();return a?(console.log("[DEBUG] -> using textContent:",a.substring(0,50)),{type:X.Text,text:a}):null}}parseParagraph(e){const t=C.element(e,"pPr");return{type:X.Paragraph,props:t?this.parseParagraphProperties(t):void 0,children:this.parseChildren(e).filter(r=>r.type!==X.Paragraph)}}parseParagraphProperties(e){const t={},r=C.element(e,"pStyle");r&&(t.styleId=C.attr(r,"val"));const n=C.element(e,"jc");if(n){const y=C.attr(n,"val");(y==="left"||y==="center"||y==="right"||y==="both")&&(t.justification=y)}const a=C.element(e,"ind");a&&(t.indentation={left:C.lengthAttr(a,"left"),right:C.lengthAttr(a,"right"),firstLine:C.lengthAttr(a,"firstLine"),hanging:C.lengthAttr(a,"hanging")});const o=C.element(e,"spacing");o&&(t.spacing={before:C.lengthAttr(o,"before"),after:C.lengthAttr(o,"after"),line:C.intAttr(o,"line"),lineRule:C.attr(o,"lineRule")});const s=C.element(e,"pageBreakBefore");s&&(t.pageBreakBefore=C.boolAttr(s,"val")!==!1);const c=C.element(e,"pBdr");c&&(t.borders=this.parseBorders(c));const p=C.element(e,"sectPr");p&&(t.sectionProps=this.parseSectionProperties(p));const f=C.element(e,"numPr");return f&&(t.numbering=this.parseParagraphNumbering(f)),t}parseParagraphNumbering(e){const t={id:"",level:0};for(const r of C.elements(e))switch(r.localName){case"numId":t.id=C.attr(r,"val")||"";break;case"ilvl":t.level=C.intAttr(r,"val")??0;break}if(t.id)return t}parseRun(e){const t=C.element(e,"rPr");return{type:X.Run,props:t?this.parseRunProperties(t):void 0,children:this.parseChildren(e)}}parseRunProperties(e){var b,d,_,u;const t={},r=C.element(e,"rStyle");r&&(t.styleId=C.attr(r,"val"));const n=C.element(e,"b");n&&(t.bold=C.attr(n,"val")!=="0");const a=C.element(e,"i");a&&(t.italic=C.attr(a,"val")!=="0");const o=C.element(e,"u");o&&(t.underline=C.attr(o,"val")||"single");const s=C.element(e,"strike");s&&(t.strike=C.attr(s,"val")!=="0");const c=C.element(e,"dstrike");c&&(t.dstrike=C.attr(c,"val")!=="0");const p=C.element(e,"vertAlign");if(p){const v=C.attr(p,"val");(v==="superscript"||v==="subscript")&&(t.vertAlign=v)}const f=C.element(e,"color");if(f){const v=C.attr(f,"val"),E=C.attr(f,"themeColor");if(E){const A=C.attr(f,"themeTint"),T=C.attr(f,"themeShade");if(t.themeColor={themeColor:E,themeTint:A?parseInt(A,16):void 0,themeShade:T?parseInt(T,16):void 0},this.theme){const D=$t(this.theme,t.themeColor);D&&(t.color=D)}}else v&&v!=="auto"&&(t.color=`#${v}`)}const y=C.element(e,"sz");y&&(t.fontSize=C.lengthAttr(y,"val",Ct.FontSize));const m=C.element(e,"rFonts");if(m){const v=C.attr(m,"asciiTheme"),E=C.attr(m,"eastAsiaTheme");if(v||E){const A=v||E||"";if(A.startsWith("major")){if(t.themeFontFamily="major",(d=(b=this.theme)==null?void 0:b.fontScheme)!=null&&d.majorFont){const T=A.includes("EastAsia")?this.theme.fontScheme.majorFont.ea:this.theme.fontScheme.majorFont.latin;T&&(t.fontFamily=T)}}else if(A.startsWith("minor")&&(t.themeFontFamily="minor",(u=(_=this.theme)==null?void 0:_.fontScheme)!=null&&u.minorFont)){const T=A.includes("EastAsia")?this.theme.fontScheme.minorFont.ea:this.theme.fontScheme.minorFont.latin;T&&(t.fontFamily=T)}}t.fontFamily||(t.fontFamily=C.attr(m,"ascii")||C.attr(m,"eastAsia")||C.attr(m,"hAnsi"))}const h=C.element(e,"highlight");return h&&(t.highlight=C.attr(h,"val")),t}parseText(e){return{type:X.Text,text:e.textContent||""}}parseBreak(e){const t=C.attr(e,"type");return{type:X.Break,breakType:t||"textWrapping"}}parseTab(){return{type:X.Tab}}parseSymbol(e){const t=C.attr(e,"font"),r=C.attr(e,"char");let n;if(r){const a=parseInt(r,16);isNaN(a)||(n=String.fromCharCode(a))}return{type:X.Symbol,font:t,char:n}}parseSimpleField(e){return{type:X.SimpleField,instruction:C.attr(e,"instr")||"",children:this.parseChildren(e)}}parseComplexField(e){return{type:X.ComplexField,charType:C.attr(e,"fldCharType")||""}}parseFieldInstruction(e){return{type:X.FieldInstruction,text:e.textContent||""}}parseTable(e){const t={type:X.Table,children:[]};for(const r of C.elements(e))switch(r.localName){case"tr":t.children.push(this.parseTableRow(r));break;case"tblGrid":t.columns=this.parseTableGrid(r);break;case"tblPr":t.props=this.parseTableProperties(r);break}return t}parseTableGrid(e){const t=[];for(const r of C.elements(e))r.localName==="gridCol"&&t.push({width:C.lengthAttr(r,"w")});return t}parseTableProperties(e){const t={};for(const r of C.elements(e))switch(r.localName){case"tblW":t.width=C.lengthAttr(r,"w");const n=C.attr(r,"type");(n==="auto"||n==="dxa"||n==="pct")&&(t.widthType=n);break;case"jc":t.justification=C.attr(r,"val");break;case"tblBorders":t.borders=this.parseTableBorders(r);break;case"tblCellSpacing":t.cellSpacing=C.lengthAttr(r,"w");break;case"tblCellMar":t.cellMargin={top:C.lengthAttr(C.element(r,"top"),"w"),bottom:C.lengthAttr(C.element(r,"bottom"),"w"),left:C.lengthAttr(C.element(r,"left"),"w")||C.lengthAttr(C.element(r,"start"),"w"),right:C.lengthAttr(C.element(r,"right"),"w")||C.lengthAttr(C.element(r,"end"),"w")};break}return t}parseTableBorders(e){const t={};for(const r of C.elements(e)){const n=this.parseBorder(r);switch(r.localName){case"top":t.top=n;break;case"bottom":t.bottom=n;break;case"left":case"start":t.left=n;break;case"right":case"end":t.right=n;break;case"insideH":t.insideH=n;break;case"insideV":t.insideV=n;break}}return t}parseTableRow(e){return{type:X.TableRow,children:C.elements(e).filter(t=>t.localName==="tc").map(t=>this.parseTableCell(t))}}parseTableCell(e){const t={type:X.TableCell,children:[]};for(const r of C.elements(e))if(r.localName==="tcPr")t.props=this.parseTableCellProperties(r);else{const n=this.parseElement(r);n&&t.children.push(n)}return t}parseTableCellProperties(e){const t={};for(const r of C.elements(e))switch(r.localName){case"tcW":t.width=C.lengthAttr(r,"w");break;case"gridSpan":t.gridSpan=C.intAttr(r,"val");break;case"vMerge":const n=C.attr(r,"val");t.verticalMerge=n==="restart"?"restart":"continue";break;case"vAlign":t.verticalAlign=C.attr(r,"val");break;case"shd":const a=C.attr(r,"fill");a&&a!=="auto"&&(t.shading=`#${a}`);break;case"tcBorders":t.borders=this.parseBorders(r);break}return t}parseHyperlink(e){const t=C.attr(e,"id");let r;if(t){const n=this.relationships.find(a=>a.id===t);n&&(r=n.target)}return{type:X.Hyperlink,href:r,anchor:C.attr(e,"anchor"),children:this.parseChildren(e)}}parseDrawing(e){const t=[],r=e.getElementsByTagNameNS("http://schemas.openxmlformats.org/drawingml/2006/main","blip");for(let n=0;n<r.length;n++){const o=r[n].getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships","embed");if(o&&this.images.has(o)){const s=e.getElementsByTagNameNS("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","extent")[0];let c,p;if(s){const f=s.getAttribute("cx"),y=s.getAttribute("cy");f&&(c=C.convertLength(f,Ct.Emu)),y&&(p=C.convertLength(y,Ct.Emu))}t.push({type:X.Image,src:this.images.get(o),width:c,height:p})}}return{type:X.Drawing,children:t}}parseCommentRangeStart(e){return{type:X.CommentRangeStart,id:C.attr(e,"id")||""}}parseCommentRangeEnd(e){return{type:X.CommentRangeEnd,id:C.attr(e,"id")||""}}parseCommentReference(e){return{type:X.CommentReference,id:C.attr(e,"id")||""}}parseFootnoteReference(e){return{type:X.FootnoteReference,id:C.attr(e,"id")||""}}parseEndnoteReference(e){return{type:X.EndnoteReference,id:C.attr(e,"id")||""}}parseBookmarkStart(e){const t={type:X.BookmarkStart,id:C.attr(e,"id")||"",name:C.attr(e,"name")||"",colFirst:C.intAttr(e,"colFirst"),colLast:C.intAttr(e,"colLast")};return t.name&&!t.name.startsWith("_")&&this.bookmarks.set(t.name,t),t}parseBookmarkEnd(e){return{type:X.BookmarkEnd,id:C.attr(e,"id")||""}}}class Kt{constructor(e){nt(this,"document",null);nt(this,"container");nt(this,"options");nt(this,"classPrefix");nt(this,"commentRanges",new Map);nt(this,"activeCommentId",null);nt(this,"svgLayer",null);nt(this,"currentCommentIds",new Set);nt(this,"commentStartInParagraph",new Set);nt(this,"currentPageNumber",1);nt(this,"totalPages",1);nt(this,"inComplexField",!1);nt(this,"currentFieldInstruction","");nt(this,"skipFieldContent",!1);nt(this,"numberingCounters",new Map);nt(this,"currentFootnoteIds",[]);nt(this,"currentEndnoteIds",[]);nt(this,"footnoteCounter",0);nt(this,"endnoteCounter",0);nt(this,"tableVerticalMerges",[]);nt(this,"currentVerticalMerge",new Map);nt(this,"currentCellCol",0);nt(this,"currentTableBorders");nt(this,"tableBordersStack",[]);nt(this,"currentTableRowIndex",0);nt(this,"currentTableRowCount",0);nt(this,"currentTableColCount",0);const t=typeof e.container=="string"?document.querySelector(e.container):e.container;if(!t)throw new Error("容器元素不存在");this.container=t,this.classPrefix=e.classNamePrefix||"docx",this.options={container:this.container,renderComments:e.renderComments??!0,enableCommentEdit:e.enableCommentEdit??!0,showCommentLines:e.showCommentLines??!0,breakPages:e.breakPages??!0,classNamePrefix:this.classPrefix,onCommentClick:e.onCommentClick||(()=>{}),onCommentChange:e.onCommentChange||(()=>{}),onCommentAccept:e.onCommentAccept,onCommentReject:e.onCommentReject}}render(e){this.document=e,this.commentRanges.clear(),this.currentCommentIds.clear(),this.numberingCounters.clear(),this.currentFootnoteIds=[],this.currentEndnoteIds=[],this.footnoteCounter=0,this.endnoteCounter=0;for(const a of e.comments)this.commentRanges.set(a.id,{id:a.id,startElement:null,endElement:null,highlightElements:[],panelElement:null});this.container.innerHTML="",this.container.className=`${this.classPrefix}-container`;const t=this.createElement("div",`${this.classPrefix}-wrapper`);this.options.breakPages?this.renderWithPages(t,e):this.renderSinglePage(t,e),this.container.appendChild(t),this.options.showCommentLines&&(this.svgLayer=this.createSvgLayer(),this.container.appendChild(this.svgLayer)),this.options.renderComments&&this.renderAllCommentBubbles();let r=!1;const n=()=>{r||(requestAnimationFrame(()=>{this.positionCommentBubbles(),this.updateLines(),r=!1}),r=!0)};t.addEventListener("scroll",()=>{this.positionCommentBubbles(),this.updateLines()},{passive:!0}),window.addEventListener("resize",n),requestAnimationFrame(()=>{this.positionCommentBubbles(),this.updateLines()})}renderSinglePage(e,t){const r=this.createElement("div",`${this.classPrefix}-document`),n=this.createElement("div",`${this.classPrefix}-page`),a=this.renderElement(t.body);a&&n.appendChild(a),this.renderPageFootnotes(this.currentFootnoteIds,n),r.appendChild(n),e.appendChild(r),this.renderDocumentEndnotes(e)}renderWithPages(e,t){const r=t.body,n=r.sectionProps,a=this.splitBySection(r.children||[],n),o=this.groupByPageBreaks(a);this.totalPages=o.length;let s;for(let c=0;c<o.length;c++){this.currentPageNumber=c+1;const p=this.currentFootnoteIds.length,f=o[c];if(f.length===0)continue;let m=f[0].sectProps||n;const h=this.createPageElement(m);m!=null&&m.headerRefs&&this.renderHeaderFooter(m.headerRefs,m,c,s!==m,h,"header");for(const d of f){const _=this.createSectionContent(d.sectProps);for(const u of d.elements){const v=this.renderElement(u);v&&_.appendChild(v)}h.appendChild(_),m=d.sectProps||m}const b=this.currentFootnoteIds.slice(p);this.renderPageFootnotes(b,h),m!=null&&m.footerRefs&&this.renderHeaderFooter(m.footerRefs,m,c,s!==m,h,"footer"),e.appendChild(h),s=m}this.renderDocumentEndnotes(e)}splitBySection(e,t){var o,s;const r=[];let n={sectProps:null,elements:[],pageBreak:!1};r.push(n);for(const c of e)if(c.type===X.Paragraph&&(o=c.props)!=null&&o.pageBreakBefore&&(n.pageBreak=!0,n={sectProps:null,elements:[],pageBreak:!1},r.push(n)),n.elements.push(c),c.type===X.Paragraph){const p=c,f=(s=p.props)==null?void 0:s.sectionProps;let y=!1;const m=h=>{for(const b of h){if(b.type===X.Break){const d=b;if(d.breakType==="page"||d.breakType==="lastRenderedPageBreak"){y=!0;return}}b.type===X.Run&&b.children&&m(b.children)}};this.options.breakPages&&p.children&&m(p.children),(f||y)&&(n.sectProps=f||null,n.pageBreak=y,n={sectProps:null,elements:[],pageBreak:!1},r.push(n))}let a=null;for(let c=r.length-1;c>=0;c--)r[c].sectProps===null?r[c].sectProps=a||t||null:a=r[c].sectProps;return r}groupByPageBreaks(e){const t=[];let r=[];t.push(r);let n=null;for(const a of e)r.push(a),(a.pageBreak||this.isPageBreakSection(n,a.sectProps))&&(r=[],t.push(r)),n=a.sectProps;return t.filter(a=>a.length>0)}isPageBreakSection(e,t){if(!e||!t)return!1;const r=e.pageSize,n=t.pageSize;return!r||!n?!1:r.orientation!==n.orientation||r.width!==n.width||r.height!==n.height}createPageElement(e){const t=this.createElement("section",`${this.classPrefix}-page`);if(e&&(e.pageSize&&(e.pageSize.width&&(t.style.width=e.pageSize.width),e.pageSize.height&&(t.style.minHeight=e.pageSize.height)),e.pageMargins)){const r=e.pageMargins;r.top&&(t.style.paddingTop=r.top),r.right&&(t.style.paddingRight=r.right),r.bottom&&(t.style.paddingBottom=r.bottom),r.left&&(t.style.paddingLeft=r.left)}return t}createSectionContent(e){const t=this.createElement("article",`${this.classPrefix}-section-content`);if(e!=null&&e.columns){const r=e.columns;r.numberOfColumns&&r.numberOfColumns>1&&(t.style.columnCount=String(r.numberOfColumns),r.space&&(t.style.columnGap=r.space),r.separator&&(t.style.columnRule="1px solid #ccc"))}return t}renderHeaderFooter(e,t,r,n,a,o){var y,m;if(!e||e.length===0)return;let s=null;if(t.titlePage&&n&&(s=e.find(h=>h.type==="first")),s||r%2===1&&(s=e.find(h=>h.type==="even")),s||(s=e.find(h=>h.type==="default")),!s)return;const c=o==="header"?(y=this.document)==null?void 0:y.headers:(m=this.document)==null?void 0:m.footers,p=c==null?void 0:c.get(s.id);if(!p)return;const f=this.createElement("div",`${this.classPrefix}-${o}`);for(const h of p.children||[]){const b=this.renderElement(h);b&&f.appendChild(b)}if(t.pageMargins){const h=t.pageMargins;o==="header"&&h.header&&h.top?(f.style.marginTop=`calc(${h.header} - ${h.top})`,f.style.minHeight=`calc(${h.top} - ${h.header})`):o==="footer"&&h.footer&&h.bottom&&(f.style.marginBottom=`calc(${h.footer} - ${h.bottom})`,f.style.minHeight=`calc(${h.bottom} - ${h.footer})`)}o==="header"?a.insertBefore(f,a.firstChild):a.appendChild(f)}renderAllCommentBubbles(){var r;const e=this.createElement("div",`${this.classPrefix}-comments-layer`);this.container.appendChild(e);const t=((r=this.document)==null?void 0:r.comments)||[];console.log("[DEBUG] renderAllCommentBubbles - Total comments:",t.length),t.forEach(n=>{var a;console.log("[DEBUG] Comment:",{id:n.id,author:n.author,date:n.date,childrenCount:((a=n.children)==null?void 0:a.length)||0,text:this.getCommentText(n)})}),console.log("[DEBUG] Comment ranges count:",this.commentRanges.size);for(const n of t){const a=this.commentRanges.get(n.id);if(a&&a.highlightElements.length>0){const o=this.createCommentBubble(n);a.panelElement=o,e.appendChild(o)}}}positionCommentBubbles(){const e=this.container.querySelector(`.${this.classPrefix}-page`);if(!e)return;const r=e.getBoundingClientRect().right+15,n=0,a=window.innerHeight;for(const[,o]of this.commentRanges){if(!o.panelElement||o.highlightElements.length===0)continue;const c=o.highlightElements[0].getBoundingClientRect();c.bottom>n&&c.top<a?(o.panelElement.style.display="block",o.panelElement.style.left=`${r}px`,o.panelElement.style.top=`${c.top}px`):o.panelElement.style.display="none"}}createSvgLayer(){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.classList.add(`${this.classPrefix}-lines`),e}updateLines(){if(this.svgLayer){this.svgLayer.innerHTML="";for(const[e]of this.commentRanges){const t=e===this.activeCommentId;this.drawCommentLine(e,t)}}}drawCommentLine(e,t){const r=this.commentRanges.get(e);if(!r||!r.highlightElements.length||!r.panelElement||!this.svgLayer||r.panelElement.style.display==="none")return;const n=r.highlightElements[0].getBoundingClientRect(),a=r.panelElement.getBoundingClientRect(),o=n.right,s=n.top+n.height/2,c=a.left,p=s,f=document.createElementNS("http://www.w3.org/2000/svg","line");f.setAttribute("x1",String(o)),f.setAttribute("y1",String(s)),f.setAttribute("x2",String(c)),f.setAttribute("y2",String(p)),f.setAttribute("stroke","#ef4444"),f.setAttribute("stroke-width",t?"2":"1"),this.svgLayer.appendChild(f)}renderElement(e){switch(e.type){case X.Document:return this.renderDocument(e);case X.Paragraph:return this.renderParagraph(e);case X.Run:return this.renderRun(e);case X.Text:return this.renderText(e);case X.Break:return this.renderBreak(e);case X.Tab:return this.renderTab();case X.Symbol:return this.renderSymbol(e);case X.SimpleField:return this.renderSimpleField(e);case X.ComplexField:return this.renderComplexField(e);case X.FieldInstruction:return this.renderFieldInstruction(e);case X.Table:return this.renderTable(e);case X.TableRow:return this.renderTableRow(e);case X.TableCell:return this.renderTableCell(e);case X.Hyperlink:return this.renderHyperlink(e);case X.Drawing:return this.renderDrawing(e);case X.Image:return this.renderImage(e);case X.CommentRangeStart:return this.renderCommentRangeStart(e);case X.CommentRangeEnd:return this.renderCommentRangeEnd(e);case X.CommentReference:return this.renderCommentReference(e);case X.FootnoteReference:return this.renderFootnoteReference(e);case X.EndnoteReference:return this.renderEndnoteReference(e);case X.Footnote:return this.renderFootnote(e);case X.Endnote:return this.renderEndnote(e);case X.BookmarkStart:return this.renderBookmarkStart(e);case X.BookmarkEnd:return this.renderBookmarkEnd(e);default:return null}}renderDocument(e){const t=this.createElement("article",`${this.classPrefix}-body`);return this.renderChildren(e.children||[],t),t}renderParagraph(e){const t=this.createElement("p",`${this.classPrefix}-p`);this.commentStartInParagraph.clear(),e.props&&this.applyParagraphStyles(t,e.props);const r=this.renderNumbering(e.props);return r&&(t.insertBefore(r,t.firstChild),t.classList.add(`${this.classPrefix}-list-item`)),this.renderChildren(e.children||[],t),(t.childNodes.length===0||t.childNodes.length===1&&r)&&t.appendChild(document.createElement("br")),this.commentStartInParagraph.size>0&&this.options.renderComments&&(t.dataset.commentIds=Array.from(this.commentStartInParagraph).join(",")),t}renderNumbering(e){var f,y;if(!(e!=null&&e.numbering)||!((f=this.document)!=null&&f.numberingMap))return null;const{id:t,level:r}=e.numbering,n=this.document.numberingMap.get(t);if(!n)return null;const a=n.levels.find(m=>m.level===r);if(!a)return null;const o=this.getNumberingContent(n,a,t,r),s=this.createElement("span",`${this.classPrefix}-numbering`);s.textContent=o,a.runProps&&this.applyRunStyles(s,a.runProps);const c=this.createElement("span",`${this.classPrefix}-numbering-suffix`);switch(a.suffix){case"tab":c.innerHTML="&emsp;";break;case"space":c.innerHTML="&nbsp;";break}const p=this.createElement("span",`${this.classPrefix}-numbering-wrapper`);if(p.appendChild(s),p.appendChild(c),(y=a.paragraphProps)!=null&&y.indentation){const m=a.paragraphProps.indentation;m.left&&(p.style.marginLeft=m.left),m.hanging&&(p.style.textIndent=`-${m.hanging}`,p.style.paddingLeft=m.hanging)}return p}getNumberingContent(e,t,r,n){const a=t.format,o=t.text;if(a==="bullet")return o||"•";const s=`${r}-${n}`;let c=this.numberingCounters.get(s)??t.start-1;c++,this.numberingCounters.set(s,c);for(let f=n+1;f<=8;f++)this.numberingCounters.delete(`${r}-${f}`);let p=o;for(let f=0;f<=n;f++){const y=this.numberingCounters.get(`${r}-${f}`)??1,m=e.levels.find(d=>d.level===f),h=(m==null?void 0:m.format)||"decimal",b=this.formatNumber(y,h);p=p.replace(`%${f+1}`,b)}return p}formatNumber(e,t){switch(t){case"decimal":return String(e);case"decimalZero":return e<10?`0${e}`:String(e);case"lowerLetter":return this.toLetters(e,!1);case"upperLetter":return this.toLetters(e,!0);case"lowerRoman":return this.toRoman(e).toLowerCase();case"upperRoman":return this.toRoman(e);case"chineseCountingThousand":case"chineseCounting":return this.toChinese(e);case"ideographTraditional":return this.toChineseTraditional(e);case"bullet":return"•";default:return String(e)}}toLetters(e,t){const r=t?65:97;let n="";for(;e>0;)e--,n=String.fromCharCode(r+e%26)+n,e=Math.floor(e/26);return n}toRoman(e){const t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r="";for(const[n,a]of t)for(;e>=n;)r+=a,e-=n;return r}toChinese(e){const t=["零","一","二","三","四","五","六","七","八","九"],r=["","十","百","千","万"];if(e<=10)return e===10?"十":t[e];let n="",a=0;for(;e>0;){const o=e%10;o!==0?n=t[o]+r[a]+n:n&&!n.startsWith("零")&&(n="零"+n),e=Math.floor(e/10),a++}return n.startsWith("一十")&&(n=n.substring(1)),n}toChineseTraditional(e){const t=["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"];return e>=1&&e<=10?t[e-1]:String(e)}createCommentBubble(e){const t=this.createElement("div",`${this.classPrefix}-comment-bubble`);t.dataset.commentId=e.id;const r=e.initials||e.author.charAt(0).toUpperCase(),n=this.formatDate(e.date),a=this.getCommentText(e),s=this.options.enableCommentEdit||this.options.onCommentAccept||this.options.onCommentReject?`
20
20
  <div class="${this.classPrefix}-comment-actions">
21
21
  ${this.options.onCommentAccept?`
22
22
  <button class="${this.classPrefix}-comment-btn accept" title="接受建议">
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .docx-container{width:100%;height:100%;overflow:hidden;background-color:#525659;font-family:Segoe UI,-apple-system,BlinkMacSystemFont,PingFang SC,Microsoft YaHei,sans-serif}.docx-wrapper{position:relative;width:100%;height:100%;overflow:auto;padding:30px;display:flex;flex-direction:column;align-items:center;gap:30px}.docx-page{background:#fff;box-shadow:0 0 10px #00000080;box-sizing:border-box;display:flex;flex-direction:column;position:relative;overflow:hidden;flex-shrink:0;width:595.3pt;min-height:841.9pt;padding:72pt 90pt}.docx-section-content{flex:1;z-index:1}.docx-header,.docx-footer{z-index:1;color:#666;font-size:10pt}.docx-header{padding-bottom:12pt;border-bottom:1px solid #eee;margin-bottom:12pt}.docx-footer{padding-top:12pt;border-top:1px solid #eee;margin-top:auto}.docx-body{line-height:1.5;color:#000}.docx-p{margin:0;min-height:1em}.docx-run{white-space:pre-wrap;overflow-wrap:break-word}.docx-superscript{vertical-align:super;font-size:.75em;line-height:0}.docx-subscript{vertical-align:sub;font-size:.75em;line-height:0}.docx-dstrike{text-decoration:line-through;text-decoration-style:double}.docx-symbol{display:inline}.docx-underline-single{text-decoration:underline;text-decoration-style:solid}.docx-underline-words{text-decoration:underline;text-decoration-skip-ink:none}.docx-underline-double{text-decoration:underline;text-decoration-style:double}.docx-underline-thick{text-decoration:underline;text-decoration-style:solid;text-decoration-thickness:2px}.docx-underline-dotted{text-decoration:underline;text-decoration-style:dotted}.docx-underline-dottedHeavy{text-decoration:underline;text-decoration-style:dotted;text-decoration-thickness:2px}.docx-underline-dash{text-decoration:underline;text-decoration-style:dashed}.docx-underline-dashedHeavy{text-decoration:underline;text-decoration-style:dashed;text-decoration-thickness:2px}.docx-underline-dashLong{text-decoration:underline;text-decoration-style:dashed}.docx-underline-dashLongHeavy{text-decoration:underline;text-decoration-style:dashed;text-decoration-thickness:2px}.docx-underline-dotDash{text-decoration:none;border-bottom:1px dashed currentColor;background-image:linear-gradient(90deg,currentColor 1px,transparent 1px);background-size:4px 1px;background-repeat:repeat-x;background-position:0 100%}.docx-underline-dashDotHeavy{text-decoration:none;border-bottom:2px dashed currentColor}.docx-underline-dotDotDash{text-decoration:none;border-bottom:1px dotted currentColor}.docx-underline-dashDotDotHeavy{text-decoration:none;border-bottom:2px dotted currentColor}.docx-underline-wave{text-decoration:underline;text-decoration-style:wavy}.docx-underline-wavyHeavy{text-decoration:underline;text-decoration-style:wavy;text-decoration-thickness:2px}.docx-underline-wavyDouble{text-decoration:underline;text-decoration-style:wavy;position:relative}.docx-underline-wavyDouble:after{content:"";position:absolute;left:0;right:0;bottom:-3px;border-bottom:1px wavy currentColor;text-decoration:underline wavy}.docx-tab{display:inline-block;min-width:36pt}.docx-list-item{display:flex;align-items:baseline}.docx-numbering-wrapper{display:inline-block;flex-shrink:0;min-width:24pt;text-align:right;margin-right:6pt}.docx-numbering{white-space:nowrap}.docx-numbering-suffix{display:inline-block}.docx-highlight{border-bottom:2px solid #3b82f6!important;cursor:pointer;text-decoration:none;display:inline;padding-bottom:1px;box-decoration-break:clone;-webkit-box-decoration-break:clone}.docx-highlight:hover{border-bottom-color:#2563eb!important}.docx-highlight--active{border-bottom-color:#1d4ed8!important;border-bottom-width:3px!important}.docx-comments-layer{position:fixed;top:0;bottom:0;width:220px;z-index:1000;pointer-events:none}.docx-comment-bubble{pointer-events:auto}.docx-comment-bubble{position:absolute;width:auto;min-width:180px;max-width:280px;background:#fffbeb;border:1px solid #fcd34d;border-left:4px solid #f59e0b;border-radius:8px;padding:12px 14px;font-size:13px;cursor:pointer;transition:all .2s ease,z-index 0s;box-shadow:0 2px 8px #00000014;z-index:1}.docx-comment-bubble:hover{box-shadow:0 4px 12px #f59e0b4d;z-index:100}.docx-comment-bubble--active{background:#fef3c7;border-color:#f59e0b;box-shadow:0 4px 16px #f59e0b4d;z-index:100}.docx-comment-header{display:flex;align-items:center;gap:10px;margin-bottom:8px}.docx-comment-avatar{width:28px;height:28px;background:linear-gradient(135deg,#f59e0b,#d97706);border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-size:12px;font-weight:600;flex-shrink:0}.docx-comment-meta{flex:1;min-width:0}.docx-comment-author{display:block;font-weight:600;color:#92400e;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.docx-comment-date{display:block;font-size:11px;color:#b45309;margin-top:1px}.docx-comment-content{color:#78350f;line-height:1.5;word-wrap:break-word}.docx-comment-actions{display:flex;gap:6px;margin-top:10px;padding-top:10px;border-top:1px solid #fcd34d;opacity:0;transition:opacity .2s ease}.docx-comment-bubble:hover .docx-comment-actions{opacity:1}.docx-comment-btn{display:flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:none;background:#fff;border-radius:4px;cursor:pointer;color:#92400e;transition:all .15s ease}.docx-comment-btn:hover{background:#fef3c7}.docx-comment-btn.delete:hover{background:#fef2f2;color:#dc2626}.docx-comment-btn.accept{color:#059669}.docx-comment-btn.accept:hover{background:#ecfdf5;color:#047857}.docx-comment-btn.reject{color:#dc2626}.docx-comment-btn.reject:hover{background:#fef2f2;color:#b91c1c}.docx-comment-ref{cursor:pointer;font-size:12px;vertical-align:super;margin-left:2px;opacity:.7;transition:opacity .2s}.docx-comment-ref:hover{opacity:1}.docx-comment-start,.docx-comment-end{display:none}.docx-table{border-collapse:collapse;margin:6pt 0;font-size:inherit;table-layout:fixed;width:100%}.docx-td{padding:4pt 6pt;vertical-align:top;word-wrap:break-word;overflow-wrap:break-word}.docx-table .docx-p{margin:0;min-height:auto}.docx-bookmark{display:inline;position:relative}.docx-link{color:#0563c1;text-decoration:underline}.docx-link:hover{color:#954f72}.docx-link[href^="#"]{cursor:pointer}.docx-image{max-width:100%;height:auto}.docx-drawing{display:inline-block}.docx-footnote-ref,.docx-endnote-ref{color:#06c;cursor:pointer;font-size:.8em;vertical-align:super;line-height:0;padding:0 2px;transition:color .2s}.docx-footnote-ref:hover,.docx-endnote-ref:hover{color:#003d99;text-decoration:underline}.docx-footnotes-section{margin-top:auto;padding-top:12pt;font-size:9pt;color:#333}.docx-footnotes-separator{border:none;border-top:1px solid #ccc;margin:0 0 8pt;width:33%}.docx-footnotes-list{margin:0;padding-left:20pt;list-style-type:decimal}.docx-footnote{margin-bottom:4pt;line-height:1.4}.docx-footnote .docx-p{display:inline;margin:0;min-height:auto}.docx-endnotes-section{background:#fff;box-shadow:0 0 10px #00000080;box-sizing:border-box;width:595.3pt;padding:40pt 90pt;margin-top:30px}.docx-endnotes-title{font-size:14pt;font-weight:700;margin:0 0 12pt;padding-bottom:8pt;border-bottom:2px solid #333}.docx-endnotes-list{margin:0;padding-left:20pt;list-style-type:decimal;font-size:10pt}.docx-endnote{margin-bottom:8pt;line-height:1.5}.docx-endnote .docx-p{display:inline;margin:0;min-height:auto}.docx-page-break{height:40px;border-bottom:2px dashed #ccc;margin:20px 0;position:relative}.docx-page-break:after{content:"分页";position:absolute;left:50%;bottom:-10px;transform:translate(-50%);background:#fff;padding:0 12px;font-size:12px;color:#999}.docx-column-break{display:block;break-after:column}.docx-lines{position:fixed;top:0;left:0;width:100vw;height:100vh;pointer-events:none;z-index:999}.docx-wrapper::-webkit-scrollbar{width:12px;height:12px}.docx-wrapper::-webkit-scrollbar-track{background:#3d3d3d}.docx-wrapper::-webkit-scrollbar-thumb{background:#666;border-radius:6px}.docx-wrapper::-webkit-scrollbar-thumb:hover{background:#888}@media (max-width: 900px){.docx-wrapper{padding:16px}.docx-page{width:100%;min-height:auto;padding:40px 30px}.docx-comments-layer,.docx-lines{display:none}}@media print{.docx-container{background:#fff}.docx-wrapper{padding:0;overflow:visible;display:block;background:#fff}.docx-page{box-shadow:none;margin:0;page-break-after:always;width:100%;min-height:100vh}.docx-page:last-child{page-break-after:auto}.docx-comments-layer{display:none}.docx-highlight{border-bottom:1px solid #666}.docx-lines,.docx-page-break{display:none}}
1
+ .docx-container{width:100%;height:100%;overflow:hidden;background-color:#525659;font-family:Segoe UI,-apple-system,BlinkMacSystemFont,PingFang SC,Microsoft YaHei,sans-serif}.docx-wrapper{position:relative;width:100%;height:100%;overflow:auto;padding:30px;display:flex;flex-direction:column;align-items:center;gap:30px}.docx-page{background:#fff;box-shadow:0 0 10px #00000080;box-sizing:border-box;display:flex;flex-direction:column;position:relative;overflow:hidden;flex-shrink:0;width:595.3pt;min-height:841.9pt;padding:72pt 90pt}.docx-section-content{flex:1;z-index:1}.docx-header,.docx-footer{z-index:1;color:#666;font-size:10pt}.docx-header{padding-bottom:12pt;border-bottom:1px solid #eee;margin-bottom:12pt}.docx-footer{padding-top:12pt;border-top:1px solid #eee;margin-top:auto}.docx-body{line-height:1.5;color:#000}.docx-p{margin:0;min-height:1em}.docx-run{white-space:pre-wrap;overflow-wrap:break-word}.docx-superscript{vertical-align:super;font-size:.75em;line-height:0}.docx-subscript{vertical-align:sub;font-size:.75em;line-height:0}.docx-dstrike{text-decoration:line-through;text-decoration-style:double}.docx-symbol{display:inline}.docx-underline-single{text-decoration:underline;text-decoration-style:solid}.docx-underline-words{text-decoration:underline;text-decoration-skip-ink:none}.docx-underline-double{text-decoration:underline;text-decoration-style:double}.docx-underline-thick{text-decoration:underline;text-decoration-style:solid;text-decoration-thickness:2px}.docx-underline-dotted{text-decoration:underline;text-decoration-style:dotted}.docx-underline-dottedHeavy{text-decoration:underline;text-decoration-style:dotted;text-decoration-thickness:2px}.docx-underline-dash{text-decoration:underline;text-decoration-style:dashed}.docx-underline-dashedHeavy{text-decoration:underline;text-decoration-style:dashed;text-decoration-thickness:2px}.docx-underline-dashLong{text-decoration:underline;text-decoration-style:dashed}.docx-underline-dashLongHeavy{text-decoration:underline;text-decoration-style:dashed;text-decoration-thickness:2px}.docx-underline-dotDash{text-decoration:none;border-bottom:1px dashed currentColor;background-image:linear-gradient(90deg,currentColor 1px,transparent 1px);background-size:4px 1px;background-repeat:repeat-x;background-position:0 100%}.docx-underline-dashDotHeavy{text-decoration:none;border-bottom:2px dashed currentColor}.docx-underline-dotDotDash{text-decoration:none;border-bottom:1px dotted currentColor}.docx-underline-dashDotDotHeavy{text-decoration:none;border-bottom:2px dotted currentColor}.docx-underline-wave{text-decoration:underline;text-decoration-style:wavy}.docx-underline-wavyHeavy{text-decoration:underline;text-decoration-style:wavy;text-decoration-thickness:2px}.docx-underline-wavyDouble{text-decoration:underline;text-decoration-style:wavy;position:relative}.docx-underline-wavyDouble:after{content:"";position:absolute;left:0;right:0;bottom:-3px;border-bottom:1px wavy currentColor;text-decoration:underline wavy}.docx-tab{display:inline-block;min-width:36pt}.docx-list-item{display:flex;align-items:baseline}.docx-numbering-wrapper{display:inline-block;flex-shrink:0;min-width:24pt;text-align:right;margin-right:6pt}.docx-numbering{white-space:nowrap}.docx-numbering-suffix{display:inline-block}.docx-highlight{border-bottom:2px solid #3b82f6!important;cursor:pointer;text-decoration:none;display:inline;padding-bottom:1px;box-decoration-break:clone;-webkit-box-decoration-break:clone}.docx-highlight:hover{border-bottom-color:#2563eb!important}.docx-highlight--active{border-bottom-color:#1d4ed8!important;border-bottom-width:3px!important}.docx-comments-layer{position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1000;overflow:visible}.docx-comment-bubble{position:fixed;width:auto;min-width:200px;max-width:260px;background:#fffbeb;border:1px solid #fcd34d;border-left:4px solid #f59e0b;border-radius:8px;padding:12px 14px;font-size:13px;cursor:pointer;transition:box-shadow .2s ease,transform .2s ease;box-shadow:0 2px 8px #0000001a;z-index:1001;pointer-events:auto}.docx-comment-bubble:hover{box-shadow:0 4px 16px #f59e0b4d;z-index:1100;transform:scale(1.02)}.docx-comment-bubble--active{background:#fef3c7;border-color:#f59e0b;box-shadow:0 4px 16px #f59e0b4d;z-index:1100}.docx-comment-header{display:flex;align-items:center;gap:10px;margin-bottom:8px}.docx-comment-avatar{width:28px;height:28px;background:linear-gradient(135deg,#f59e0b,#d97706);border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-size:12px;font-weight:600;flex-shrink:0}.docx-comment-meta{flex:1;min-width:0}.docx-comment-author{display:block;font-weight:600;color:#92400e;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.docx-comment-date{display:block;font-size:11px;color:#b45309;margin-top:1px}.docx-comment-content{color:#78350f;line-height:1.5;word-wrap:break-word}.docx-comment-actions{display:flex;gap:6px;margin-top:10px;padding-top:10px;border-top:1px solid #fcd34d;opacity:0;transition:opacity .2s ease}.docx-comment-bubble:hover .docx-comment-actions{opacity:1}.docx-comment-btn{display:flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:none;background:#fff;border-radius:4px;cursor:pointer;color:#92400e;transition:all .15s ease}.docx-comment-btn:hover{background:#fef3c7}.docx-comment-btn.delete:hover{background:#fef2f2;color:#dc2626}.docx-comment-btn.accept{color:#059669}.docx-comment-btn.accept:hover{background:#ecfdf5;color:#047857}.docx-comment-btn.reject{color:#dc2626}.docx-comment-btn.reject:hover{background:#fef2f2;color:#b91c1c}.docx-comment-ref{cursor:pointer;font-size:12px;vertical-align:super;margin-left:2px;opacity:.7;transition:opacity .2s}.docx-comment-ref:hover{opacity:1}.docx-comment-start,.docx-comment-end{display:none}.docx-table{border-collapse:collapse;margin:6pt 0;font-size:inherit;table-layout:fixed;width:100%}.docx-td{padding:4pt 6pt;vertical-align:top;word-wrap:break-word;overflow-wrap:break-word}.docx-table .docx-p{margin:0;min-height:auto}.docx-bookmark{display:inline;position:relative}.docx-link{color:#0563c1;text-decoration:underline}.docx-link:hover{color:#954f72}.docx-link[href^="#"]{cursor:pointer}.docx-image{max-width:100%;height:auto}.docx-drawing{display:inline-block}.docx-footnote-ref,.docx-endnote-ref{color:#06c;cursor:pointer;font-size:.8em;vertical-align:super;line-height:0;padding:0 2px;transition:color .2s}.docx-footnote-ref:hover,.docx-endnote-ref:hover{color:#003d99;text-decoration:underline}.docx-footnotes-section{margin-top:auto;padding-top:12pt;font-size:9pt;color:#333}.docx-footnotes-separator{border:none;border-top:1px solid #ccc;margin:0 0 8pt;width:33%}.docx-footnotes-list{margin:0;padding-left:20pt;list-style-type:decimal}.docx-footnote{margin-bottom:4pt;line-height:1.4}.docx-footnote .docx-p{display:inline;margin:0;min-height:auto}.docx-endnotes-section{background:#fff;box-shadow:0 0 10px #00000080;box-sizing:border-box;width:595.3pt;padding:40pt 90pt;margin-top:30px}.docx-endnotes-title{font-size:14pt;font-weight:700;margin:0 0 12pt;padding-bottom:8pt;border-bottom:2px solid #333}.docx-endnotes-list{margin:0;padding-left:20pt;list-style-type:decimal;font-size:10pt}.docx-endnote{margin-bottom:8pt;line-height:1.5}.docx-endnote .docx-p{display:inline;margin:0;min-height:auto}.docx-page-break{height:40px;border-bottom:2px dashed #ccc;margin:20px 0;position:relative}.docx-page-break:after{content:"分页";position:absolute;left:50%;bottom:-10px;transform:translate(-50%);background:#fff;padding:0 12px;font-size:12px;color:#999}.docx-column-break{display:block;break-after:column}.docx-lines{position:fixed;top:0;left:0;width:100vw;height:100vh;pointer-events:none;z-index:999}.docx-wrapper::-webkit-scrollbar{width:12px;height:12px}.docx-wrapper::-webkit-scrollbar-track{background:#3d3d3d}.docx-wrapper::-webkit-scrollbar-thumb{background:#666;border-radius:6px}.docx-wrapper::-webkit-scrollbar-thumb:hover{background:#888}@media (max-width: 900px){.docx-wrapper{padding:16px}.docx-page{width:100%;min-height:auto;padding:40px 30px}.docx-comments-layer,.docx-lines{display:none}}@media print{.docx-container{background:#fff}.docx-wrapper{padding:0;overflow:visible;display:block;background:#fff}.docx-page{box-shadow:none;margin:0;page-break-after:always;width:100%;min-height:100vh}.docx-page:last-child{page-break-after:auto}.docx-comments-layer{display:none}.docx-highlight{border-bottom:1px solid #666}.docx-lines,.docx-page-break{display:none}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@courtifyai/docx-render",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": " DOCX render library",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",