@vue-pdf-viewer/annotation 1.6.0-rc.1 → 1.6.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -248,9 +248,9 @@ const ra = (e) => {
248
248
  if (n === "BigEndian")
249
249
  return e << 8 | t;
250
250
  throw new Error(`Invalid byteOrder: ${n}`);
251
- }, gl = (e) => oa(e) ? "BigEndian" : aa(e) ? "LittleEndian" : "BigEndian", oa = (e) => e[0] === 254 && e[1] === 255, aa = (e) => e[0] === 255 && e[1] === 254, ca = (e) => oa(e) || aa(e), _e = (e) => `\`${e}\``, pl = (e) => `'${e}'`, $s = (e) => {
251
+ }, gl = (e) => oa(e) ? "BigEndian" : aa(e) ? "LittleEndian" : "BigEndian", oa = (e) => e[0] === 254 && e[1] === 255, aa = (e) => e[0] === 255 && e[1] === 254, ca = (e) => oa(e) || aa(e), ye = (e) => `\`${e}\``, pl = (e) => `'${e}'`, $s = (e) => {
252
252
  const t = typeof e;
253
- return t === "string" ? pl(e) : t === "undefined" ? _e(e) : e;
253
+ return t === "string" ? pl(e) : t === "undefined" ? ye(e) : e;
254
254
  }, bl = (e, t, n) => {
255
255
  const r = new Array(n.length);
256
256
  for (let s = 0, o = n.length; s < o; s++) {
@@ -258,7 +258,7 @@ const ra = (e) => {
258
258
  r[s] = $s(c);
259
259
  }
260
260
  const i = r.join(" or ");
261
- return `${_e(t)} must be one of ${i}, but was actually ${$s(e)}`;
261
+ return `${ye(t)} must be one of ${i}, but was actually ${$s(e)}`;
262
262
  }, yn = (e, t, n) => {
263
263
  Array.isArray(n) || (n = ia(n));
264
264
  for (let r = 0, i = n.length; r < i; r++)
@@ -271,10 +271,10 @@ const ra = (e) => {
271
271
  const r = new Array(n.length);
272
272
  for (let s = 0, o = n.length; s < o; s++) {
273
273
  const c = n[s];
274
- c === "null" && (r[s] = _e("null")), c === "undefined" && (r[s] = _e("undefined")), c === "string" ? r[s] = _e("string") : c === "number" ? r[s] = _e("number") : c === "boolean" ? r[s] = _e("boolean") : c === "symbol" ? r[s] = _e("symbol") : c === "bigint" ? r[s] = _e("bigint") : c === Array ? r[s] = _e("Array") : c === Uint8Array ? r[s] = _e("Uint8Array") : c === ArrayBuffer ? r[s] = _e("ArrayBuffer") : r[s] = _e(c[1]);
274
+ c === "null" && (r[s] = ye("null")), c === "undefined" && (r[s] = ye("undefined")), c === "string" ? r[s] = ye("string") : c === "number" ? r[s] = ye("number") : c === "boolean" ? r[s] = ye("boolean") : c === "symbol" ? r[s] = ye("symbol") : c === "bigint" ? r[s] = ye("bigint") : c === Array ? r[s] = ye("Array") : c === Uint8Array ? r[s] = ye("Uint8Array") : c === ArrayBuffer ? r[s] = ye("ArrayBuffer") : r[s] = ye(c[1]);
275
275
  }
276
276
  const i = r.join(" or ");
277
- return `${_e(t)} must be of type ${i}, but was actually of type ${_e(ml(e))}`;
277
+ return `${ye(t)} must be of type ${i}, but was actually of type ${ye(ml(e))}`;
278
278
  }, T = (e, t, n) => {
279
279
  for (let r = 0, i = n.length; r < i; r++)
280
280
  if (yl(e, n[r]))
@@ -287,16 +287,16 @@ const ra = (e) => {
287
287
  T(e[r], t, n);
288
288
  }, pt = (e, t, n, r) => {
289
289
  if (T(e, t, ["number"]), T(n, "min", ["number"]), T(r, "max", ["number"]), r = Math.max(n, r), e < n || e > r)
290
- throw new Error(`${_e(t)} must be at least ${n} and at most ${r}, but was actually ${e}`);
290
+ throw new Error(`${ye(t)} must be at least ${n} and at most ${r}, but was actually ${e}`);
291
291
  }, st = (e, t, n, r) => {
292
292
  T(e, t, ["number", "undefined"]), typeof e == "number" && pt(e, t, n, r);
293
293
  }, wl = (e, t, n) => {
294
294
  if (T(e, t, ["number"]), e % n !== 0)
295
- throw new Error(`${_e(t)} must be a multiple of ${n}, but was actually ${e}`);
295
+ throw new Error(`${ye(t)} must be a multiple of ${n}, but was actually ${e}`);
296
296
  }, vl = (e, t) => {
297
297
  if (!Number.isInteger(e))
298
298
  throw new Error(
299
- `${_e(t)} must be an integer, but was actually ${e}`
299
+ `${ye(t)} must be an integer, but was actually ${e}`
300
300
  );
301
301
  };
302
302
  class tt extends Error {
@@ -947,7 +947,7 @@ const dh = () => {
947
947
  e = e >>> 8 ^ i[(e ^ t[o]) & 255];
948
948
  return e ^ -1;
949
949
  };
950
- var we = fh, Tt = {
950
+ var _e = fh, Tt = {
951
951
  2: "need dictionary",
952
952
  1: "stream end",
953
953
  0: "",
@@ -1034,7 +1034,7 @@ const Ne = (e) => {
1034
1034
  e.pending_buf[e.pending++] = t >>> 8 & 255, e.pending_buf[e.pending++] = t & 255;
1035
1035
  }, xi = (e, t, n, r) => {
1036
1036
  let i = e.avail_in;
1037
- return i > r && (i = r), i === 0 ? 0 : (e.avail_in -= i, t.set(e.input.subarray(e.next_in, e.next_in + i), n), e.state.wrap === 1 ? e.adler = Rn(e.adler, t, i, n) : e.state.wrap === 2 && (e.adler = we(e.adler, t, i, n)), e.next_in += i, e.total_in += i, i);
1037
+ return i > r && (i = r), i === 0 ? 0 : (e.avail_in -= i, t.set(e.input.subarray(e.next_in, e.next_in + i), n), e.state.wrap === 1 ? e.adler = Rn(e.adler, t, i, n) : e.state.wrap === 2 && (e.adler = _e(e.adler, t, i, n)), e.next_in += i, e.total_in += i, i);
1038
1038
  }, Da = (e, t) => {
1039
1039
  let n = e.max_chain_length, r = e.strstart, i, s, o = e.prev_length, c = e.nice_match;
1040
1040
  const l = e.strstart > e.w_size - rt ? e.strstart - (e.w_size - rt) : 0, a = e.window, h = e.w_mask, d = e.prev, f = e.strstart + gt;
@@ -1220,7 +1220,7 @@ const $n = (e) => {
1220
1220
  Q(
1221
1221
  n,
1222
1222
  (n.gzhead.text ? 1 : 0) + (n.gzhead.hcrc ? 2 : 0) + (n.gzhead.extra ? 4 : 0) + (n.gzhead.name ? 8 : 0) + (n.gzhead.comment ? 16 : 0)
1223
- ), Q(n, n.gzhead.time & 255), Q(n, n.gzhead.time >> 8 & 255), Q(n, n.gzhead.time >> 16 & 255), Q(n, n.gzhead.time >> 24 & 255), Q(n, n.level === 9 ? 2 : n.strategy >= rr || n.level < 2 ? 4 : 0), Q(n, n.gzhead.os & 255), n.gzhead.extra && n.gzhead.extra.length && (Q(n, n.gzhead.extra.length & 255), Q(n, n.gzhead.extra.length >> 8 & 255)), n.gzhead.hcrc && (e.adler = we(e.adler, n.pending_buf, n.pending, 0)), n.gzindex = 0, n.status = yi;
1223
+ ), Q(n, n.gzhead.time & 255), Q(n, n.gzhead.time >> 8 & 255), Q(n, n.gzhead.time >> 16 & 255), Q(n, n.gzhead.time >> 24 & 255), Q(n, n.level === 9 ? 2 : n.strategy >= rr || n.level < 2 ? 4 : 0), Q(n, n.gzhead.os & 255), n.gzhead.extra && n.gzhead.extra.length && (Q(n, n.gzhead.extra.length & 255), Q(n, n.gzhead.extra.length >> 8 & 255)), n.gzhead.hcrc && (e.adler = _e(e.adler, n.pending_buf, n.pending, 0)), n.gzindex = 0, n.status = yi;
1224
1224
  else if (Q(n, 0), Q(n, 0), Q(n, 0), Q(n, 0), Q(n, 0), Q(n, n.level === 9 ? 2 : n.strategy >= rr || n.level < 2 ? 4 : 0), Q(n, Nh), n.status = At, Ne(e), n.pending !== 0)
1225
1225
  return n.last_flush = -1, ve;
1226
1226
  }
@@ -1229,12 +1229,12 @@ const $n = (e) => {
1229
1229
  let i = n.pending, s = (n.gzhead.extra.length & 65535) - n.gzindex;
1230
1230
  for (; n.pending + s > n.pending_buf_size; ) {
1231
1231
  let c = n.pending_buf_size - n.pending;
1232
- if (n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex, n.gzindex + c), n.pending), n.pending = n.pending_buf_size, n.gzhead.hcrc && n.pending > i && (e.adler = we(e.adler, n.pending_buf, n.pending - i, i)), n.gzindex += c, Ne(e), n.pending !== 0)
1232
+ if (n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex, n.gzindex + c), n.pending), n.pending = n.pending_buf_size, n.gzhead.hcrc && n.pending > i && (e.adler = _e(e.adler, n.pending_buf, n.pending - i, i)), n.gzindex += c, Ne(e), n.pending !== 0)
1233
1233
  return n.last_flush = -1, ve;
1234
1234
  i = 0, s -= c;
1235
1235
  }
1236
1236
  let o = new Uint8Array(n.gzhead.extra);
1237
- n.pending_buf.set(o.subarray(n.gzindex, n.gzindex + s), n.pending), n.pending += s, n.gzhead.hcrc && n.pending > i && (e.adler = we(e.adler, n.pending_buf, n.pending - i, i)), n.gzindex = 0;
1237
+ n.pending_buf.set(o.subarray(n.gzindex, n.gzindex + s), n.pending), n.pending += s, n.gzhead.hcrc && n.pending > i && (e.adler = _e(e.adler, n.pending_buf, n.pending - i, i)), n.gzindex = 0;
1238
1238
  }
1239
1239
  n.status = _i;
1240
1240
  }
@@ -1243,13 +1243,13 @@ const $n = (e) => {
1243
1243
  let i = n.pending, s;
1244
1244
  do {
1245
1245
  if (n.pending === n.pending_buf_size) {
1246
- if (n.gzhead.hcrc && n.pending > i && (e.adler = we(e.adler, n.pending_buf, n.pending - i, i)), Ne(e), n.pending !== 0)
1246
+ if (n.gzhead.hcrc && n.pending > i && (e.adler = _e(e.adler, n.pending_buf, n.pending - i, i)), Ne(e), n.pending !== 0)
1247
1247
  return n.last_flush = -1, ve;
1248
1248
  i = 0;
1249
1249
  }
1250
1250
  n.gzindex < n.gzhead.name.length ? s = n.gzhead.name.charCodeAt(n.gzindex++) & 255 : s = 0, Q(n, s);
1251
1251
  } while (s !== 0);
1252
- n.gzhead.hcrc && n.pending > i && (e.adler = we(e.adler, n.pending_buf, n.pending - i, i)), n.gzindex = 0;
1252
+ n.gzhead.hcrc && n.pending > i && (e.adler = _e(e.adler, n.pending_buf, n.pending - i, i)), n.gzindex = 0;
1253
1253
  }
1254
1254
  n.status = wi;
1255
1255
  }
@@ -1258,13 +1258,13 @@ const $n = (e) => {
1258
1258
  let i = n.pending, s;
1259
1259
  do {
1260
1260
  if (n.pending === n.pending_buf_size) {
1261
- if (n.gzhead.hcrc && n.pending > i && (e.adler = we(e.adler, n.pending_buf, n.pending - i, i)), Ne(e), n.pending !== 0)
1261
+ if (n.gzhead.hcrc && n.pending > i && (e.adler = _e(e.adler, n.pending_buf, n.pending - i, i)), Ne(e), n.pending !== 0)
1262
1262
  return n.last_flush = -1, ve;
1263
1263
  i = 0;
1264
1264
  }
1265
1265
  n.gzindex < n.gzhead.comment.length ? s = n.gzhead.comment.charCodeAt(n.gzindex++) & 255 : s = 0, Q(n, s);
1266
1266
  } while (s !== 0);
1267
- n.gzhead.hcrc && n.pending > i && (e.adler = we(e.adler, n.pending_buf, n.pending - i, i));
1267
+ n.gzhead.hcrc && n.pending > i && (e.adler = _e(e.adler, n.pending_buf, n.pending - i, i));
1268
1268
  }
1269
1269
  n.status = vi;
1270
1270
  }
@@ -1865,7 +1865,7 @@ const Wd = (e) => {
1865
1865
  c--, a += r[s++] << h, h += 8;
1866
1866
  }
1867
1867
  if (n.wrap & 2 && a === 35615) {
1868
- n.wbits === 0 && (n.wbits = 15), n.check = 0, R[0] = a & 255, R[1] = a >>> 8 & 255, n.check = we(n.check, R, 2, 0), a = 0, h = 0, n.mode = lo;
1868
+ n.wbits === 0 && (n.wbits = 15), n.check = 0, R[0] = a & 255, R[1] = a >>> 8 & 255, n.check = _e(n.check, R, 2, 0), a = 0, h = 0, n.mode = lo;
1869
1869
  break;
1870
1870
  }
1871
1871
  if (n.head && (n.head.done = !1), !(n.wrap & 1) || (((a & 255) << 8) + (a >> 8)) % 31) {
@@ -1896,21 +1896,21 @@ const Wd = (e) => {
1896
1896
  e.msg = "unknown header flags set", n.mode = le;
1897
1897
  break;
1898
1898
  }
1899
- n.head && (n.head.text = a >> 8 & 1), n.flags & 512 && n.wrap & 4 && (R[0] = a & 255, R[1] = a >>> 8 & 255, n.check = we(n.check, R, 2, 0)), a = 0, h = 0, n.mode = ho;
1899
+ n.head && (n.head.text = a >> 8 & 1), n.flags & 512 && n.wrap & 4 && (R[0] = a & 255, R[1] = a >>> 8 & 255, n.check = _e(n.check, R, 2, 0)), a = 0, h = 0, n.mode = ho;
1900
1900
  case ho:
1901
1901
  for (; h < 32; ) {
1902
1902
  if (c === 0)
1903
1903
  break e;
1904
1904
  c--, a += r[s++] << h, h += 8;
1905
1905
  }
1906
- n.head && (n.head.time = a), n.flags & 512 && n.wrap & 4 && (R[0] = a & 255, R[1] = a >>> 8 & 255, R[2] = a >>> 16 & 255, R[3] = a >>> 24 & 255, n.check = we(n.check, R, 4, 0)), a = 0, h = 0, n.mode = uo;
1906
+ n.head && (n.head.time = a), n.flags & 512 && n.wrap & 4 && (R[0] = a & 255, R[1] = a >>> 8 & 255, R[2] = a >>> 16 & 255, R[3] = a >>> 24 & 255, n.check = _e(n.check, R, 4, 0)), a = 0, h = 0, n.mode = uo;
1907
1907
  case uo:
1908
1908
  for (; h < 16; ) {
1909
1909
  if (c === 0)
1910
1910
  break e;
1911
1911
  c--, a += r[s++] << h, h += 8;
1912
1912
  }
1913
- n.head && (n.head.xflags = a & 255, n.head.os = a >> 8), n.flags & 512 && n.wrap & 4 && (R[0] = a & 255, R[1] = a >>> 8 & 255, n.check = we(n.check, R, 2, 0)), a = 0, h = 0, n.mode = fo;
1913
+ n.head && (n.head.xflags = a & 255, n.head.os = a >> 8), n.flags & 512 && n.wrap & 4 && (R[0] = a & 255, R[1] = a >>> 8 & 255, n.check = _e(n.check, R, 2, 0)), a = 0, h = 0, n.mode = fo;
1914
1914
  case fo:
1915
1915
  if (n.flags & 1024) {
1916
1916
  for (; h < 16; ) {
@@ -1918,7 +1918,7 @@ const Wd = (e) => {
1918
1918
  break e;
1919
1919
  c--, a += r[s++] << h, h += 8;
1920
1920
  }
1921
- n.length = a, n.head && (n.head.extra_len = a), n.flags & 512 && n.wrap & 4 && (R[0] = a & 255, R[1] = a >>> 8 & 255, n.check = we(n.check, R, 2, 0)), a = 0, h = 0;
1921
+ n.length = a, n.head && (n.head.extra_len = a), n.flags & 512 && n.wrap & 4 && (R[0] = a & 255, R[1] = a >>> 8 & 255, n.check = _e(n.check, R, 2, 0)), a = 0, h = 0;
1922
1922
  } else
1923
1923
  n.head && (n.head.extra = null);
1924
1924
  n.mode = go;
@@ -1929,7 +1929,7 @@ const Wd = (e) => {
1929
1929
  s + u
1930
1930
  ),
1931
1931
  S
1932
- )), n.flags & 512 && n.wrap & 4 && (n.check = we(n.check, r, u, s)), c -= u, s += u, n.length -= u), n.length))
1932
+ )), n.flags & 512 && n.wrap & 4 && (n.check = _e(n.check, r, u, s)), c -= u, s += u, n.length -= u), n.length))
1933
1933
  break e;
1934
1934
  n.length = 0, n.mode = po;
1935
1935
  case po:
@@ -1940,7 +1940,7 @@ const Wd = (e) => {
1940
1940
  do
1941
1941
  S = r[s + u++], n.head && S && n.length < 65536 && (n.head.name += String.fromCharCode(S));
1942
1942
  while (S && u < c);
1943
- if (n.flags & 512 && n.wrap & 4 && (n.check = we(n.check, r, u, s)), c -= u, s += u, S)
1943
+ if (n.flags & 512 && n.wrap & 4 && (n.check = _e(n.check, r, u, s)), c -= u, s += u, S)
1944
1944
  break e;
1945
1945
  } else
1946
1946
  n.head && (n.head.name = null);
@@ -1953,7 +1953,7 @@ const Wd = (e) => {
1953
1953
  do
1954
1954
  S = r[s + u++], n.head && S && n.length < 65536 && (n.head.comment += String.fromCharCode(S));
1955
1955
  while (S && u < c);
1956
- if (n.flags & 512 && n.wrap & 4 && (n.check = we(n.check, r, u, s)), c -= u, s += u, S)
1956
+ if (n.flags & 512 && n.wrap & 4 && (n.check = _e(n.check, r, u, s)), c -= u, s += u, S)
1957
1957
  break e;
1958
1958
  } else
1959
1959
  n.head && (n.head.comment = null);
@@ -2230,7 +2230,7 @@ const Wd = (e) => {
2230
2230
  break e;
2231
2231
  c--, a |= r[s++] << h, h += 8;
2232
2232
  }
2233
- if (f -= l, e.total_out += f, n.total += f, n.wrap & 4 && f && (e.adler = n.check = n.flags ? we(n.check, i, f, o - f) : Rn(n.check, i, f, o - f)), f = l, n.wrap & 4 && (n.flags ? a : Po(a)) !== n.check) {
2233
+ if (f -= l, e.total_out += f, n.total += f, n.wrap & 4 && f && (e.adler = n.check = n.flags ? _e(n.check, i, f, o - f) : Rn(n.check, i, f, o - f)), f = l, n.wrap & 4 && (n.flags ? a : Po(a)) !== n.check) {
2234
2234
  e.msg = "incorrect data check", n.mode = le;
2235
2235
  break;
2236
2236
  }
@@ -2263,7 +2263,7 @@ const Wd = (e) => {
2263
2263
  default:
2264
2264
  return He;
2265
2265
  }
2266
- return e.next_out = o, e.avail_out = l, e.next_in = s, e.avail_in = c, n.hold = a, n.bits = h, (n.wsize || f !== e.avail_out && n.mode < le && (n.mode < ai || t !== ao)) && Wa(e, e.output, e.next_out, f - e.avail_out), d -= e.avail_in, f -= e.avail_out, e.total_in += d, e.total_out += f, n.total += f, n.wrap & 4 && f && (e.adler = n.check = n.flags ? we(n.check, i, f, e.next_out - f) : Rn(n.check, i, f, e.next_out - f)), e.data_type = n.bits + (n.last ? 64 : 0) + (n.mode === ot ? 128 : 0) + (n.mode === or || n.mode === oi ? 256 : 0), (d === 0 && f === 0 || t === ao) && O === Bt && (O = Ld), O;
2266
+ return e.next_out = o, e.avail_out = l, e.next_in = s, e.avail_in = c, n.hold = a, n.bits = h, (n.wsize || f !== e.avail_out && n.mode < le && (n.mode < ai || t !== ao)) && Wa(e, e.output, e.next_out, f - e.avail_out), d -= e.avail_in, f -= e.avail_out, e.total_in += d, e.total_out += f, n.total += f, n.wrap & 4 && f && (e.adler = n.check = n.flags ? _e(n.check, i, f, e.next_out - f) : Rn(n.check, i, f, e.next_out - f)), e.data_type = n.bits + (n.last ? 64 : 0) + (n.mode === ot ? 128 : 0) + (n.mode === or || n.mode === oi ? 256 : 0), (d === 0 && f === 0 || t === ao) && O === Bt && (O = Ld), O;
2267
2267
  }, Zd = (e) => {
2268
2268
  if (Ft(e))
2269
2269
  return He;
@@ -8997,7 +8997,7 @@ class Hf {
8997
8997
  return r;
8998
8998
  }
8999
8999
  }
9000
- const ye = "http://ns.adobe.com/xfdf/";
9000
+ const we = "http://ns.adobe.com/xfdf/";
9001
9001
  function Vo(e) {
9002
9002
  e || (e = new Date());
9003
9003
  const t = e instanceof Date ? e : new Date(e);
@@ -9025,7 +9025,7 @@ class ge {
9025
9025
  const r = Gf[t.annotationType];
9026
9026
  if (!r)
9027
9027
  return null;
9028
- const i = n.createElementNS(ye, r);
9028
+ const i = n.createElementNS(we, r);
9029
9029
  i.setAttribute("page", String(t.pageIndex ?? 0)), t.rect && t.rect.length === 4 && i.setAttribute(
9030
9030
  "rect",
9031
9031
  t.rect.map((c) => c.toFixed(4)).join(",")
@@ -9069,24 +9069,23 @@ class ge {
9069
9069
  }
9070
9070
  }
9071
9071
  static serializeTextMarkup(t, n, r) {
9072
- if (t.quadPoints && t.quadPoints.length > 0) {
9073
- const i = r.createElementNS(ye, "coords");
9074
- i.textContent = Array.from(t.quadPoints).map((s) => s.toFixed(4)).join(","), n.appendChild(i);
9075
- }
9076
- if (t.contents) {
9077
- const i = r.createElementNS(ye, "contents");
9072
+ if (t.quadPoints && t.quadPoints.length > 0 && n.setAttribute(
9073
+ "coords",
9074
+ Array.from(t.quadPoints).map((i) => i.toFixed(4)).join(",")
9075
+ ), t.contents) {
9076
+ const i = r.createElementNS(we, "contents");
9078
9077
  i.textContent = t.contents, n.appendChild(i);
9079
9078
  }
9080
9079
  return n;
9081
9080
  }
9082
9081
  static serializeFreeText(t, n, r) {
9083
- const i = t.value ?? t.contents ?? t.contentsObj?.str ?? "", s = r.createElementNS(ye, "contents");
9082
+ const i = t.value ?? t.contents ?? t.contentsObj?.str ?? "", s = r.createElementNS(we, "contents");
9084
9083
  s.textContent = i, n.appendChild(s);
9085
9084
  const o = t.defaultAppearanceData, c = o?.fontName ?? "Helvetica", l = o?.fontSize ?? t.fontSize ?? 12;
9086
9085
  let a = "0 0 0";
9087
9086
  const h = o?.fontColor ?? t.color;
9088
9087
  h && (a = `${(h[0] / 255).toFixed(3)} ${(h[1] / 255).toFixed(3)} ${(h[2] / 255).toFixed(3)}`);
9089
- const d = r.createElementNS(ye, "defaultappearance");
9088
+ const d = r.createElementNS(we, "defaultappearance");
9090
9089
  return d.textContent = `/${c} ${l} Tf ${a} rg`, n.appendChild(d), n;
9091
9090
  }
9092
9091
  static bitmapToDataUrlSync(t) {
@@ -9104,7 +9103,7 @@ class ge {
9104
9103
  }
9105
9104
  static serializeStamp(t, n, r) {
9106
9105
  if (t.iconName && n.setAttribute("icon", t.iconName), t.contents) {
9107
- const s = r.createElementNS(ye, "contents");
9106
+ const s = r.createElementNS(we, "contents");
9108
9107
  s.textContent = t.contents, n.appendChild(s);
9109
9108
  }
9110
9109
  let i = t.imageDataUrl ?? null;
@@ -9113,7 +9112,7 @@ class ge {
9113
9112
  s && (i = ge.bitmapToDataUrlSync(s));
9114
9113
  }
9115
9114
  if (i) {
9116
- const s = r.createElementNS(ye, "imagedata");
9115
+ const s = r.createElementNS(we, "imagedata");
9117
9116
  s.textContent = i, n.appendChild(s);
9118
9117
  }
9119
9118
  return n;
@@ -9121,9 +9120,9 @@ class ge {
9121
9120
  static serializeInk(t, n, r) {
9122
9121
  const i = t.inkLists;
9123
9122
  if (i && i.length > 0) {
9124
- const s = r.createElementNS(ye, "inklist");
9123
+ const s = r.createElementNS(we, "inklist");
9125
9124
  for (const o of i) {
9126
- const c = r.createElementNS(ye, "gesture"), l = [];
9125
+ const c = r.createElementNS(we, "gesture"), l = [];
9127
9126
  for (let a = 0; a < o.length; a += 2)
9128
9127
  l.push(`${o[a].toFixed(4)};${o[a + 1].toFixed(4)}`);
9129
9128
  c.textContent = l.join(";"), s.appendChild(c);
@@ -9140,14 +9139,14 @@ class ge {
9140
9139
  "icon",
9141
9140
  t.iconName ?? "Comment"
9142
9141
  ), t.contents) {
9143
- const i = r.createElementNS(ye, "contents");
9142
+ const i = r.createElementNS(we, "contents");
9144
9143
  i.textContent = t.contents, n.appendChild(i);
9145
9144
  }
9146
9145
  return n;
9147
9146
  }
9148
9147
  static serializeShape(t, n, r) {
9149
9148
  if (t.contents) {
9150
- const i = r.createElementNS(ye, "contents");
9149
+ const i = r.createElementNS(we, "contents");
9151
9150
  i.textContent = t.contents, n.appendChild(i);
9152
9151
  }
9153
9152
  return t.borderStyle?.width !== void 0 && n.setAttribute("width", String(t.borderStyle.width)), t.backgroundColor && n.setAttribute("interior-color", qo(t.backgroundColor)), n;
@@ -9155,7 +9154,7 @@ class ge {
9155
9154
  static serializeLine(t, n, r) {
9156
9155
  const i = t.vertices;
9157
9156
  if (i && i.length >= 4 && (n.setAttribute("start", `${i[0].toFixed(4)},${i[1].toFixed(4)}`), n.setAttribute("end", `${i[2].toFixed(4)},${i[3].toFixed(4)}`)), t.contents) {
9158
- const s = r.createElementNS(ye, "contents");
9157
+ const s = r.createElementNS(we, "contents");
9159
9158
  s.textContent = t.contents, n.appendChild(s);
9160
9159
  }
9161
9160
  return n;
@@ -9169,21 +9168,21 @@ class ge {
9169
9168
  n.setAttribute("vertices", s.join(";"));
9170
9169
  }
9171
9170
  if (t.contents) {
9172
- const s = r.createElementNS(ye, "contents");
9171
+ const s = r.createElementNS(we, "contents");
9173
9172
  s.textContent = t.contents, n.appendChild(s);
9174
9173
  }
9175
9174
  return n;
9176
9175
  }
9177
9176
  static exportToXfdf(t, n) {
9178
9177
  const r = document.implementation.createDocument(
9179
- ye,
9178
+ we,
9180
9179
  "xfdf",
9181
9180
  null
9182
9181
  ), i = r.documentElement;
9183
- i.setAttribute("xmlns", ye), i.setAttribute("xml:space", "preserve");
9184
- const s = r.createElementNS(ye, "f");
9182
+ i.setAttribute("xmlns", we), i.setAttribute("xml:space", "preserve");
9183
+ const s = r.createElementNS(we, "f");
9185
9184
  s.setAttribute("href", n ?? "document.pdf"), i.appendChild(s);
9186
- const o = r.createElementNS(ye, "annots"), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
9185
+ const o = r.createElementNS(we, "annots"), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
9187
9186
  for (const d of t) {
9188
9187
  if (!d.id)
9189
9188
  continue;
@@ -9304,8 +9303,11 @@ ${new XMLSerializer().serializeToString(r)}`;
9304
9303
  s?.textContent && (n.contents = s.textContent), r && (n.hexColor = r);
9305
9304
  }
9306
9305
  static parseFreeText(t, n) {
9307
- const r = t.querySelector("contents");
9308
- r?.textContent && (n.value = r.textContent, n.contents = r.textContent);
9306
+ const r = t.querySelector("contents") ?? t.querySelector("contents-richtext");
9307
+ if (r?.textContent) {
9308
+ const s = r.textContent.trim();
9309
+ n.value = s, n.contents = s;
9310
+ }
9309
9311
  const i = t.querySelector("defaultappearance");
9310
9312
  if (i?.textContent) {
9311
9313
  const s = i.textContent.trim(), o = s.match(/\/(\S+)\s+([\d.]+)\s+Tf/), c = s.match(
@@ -9319,7 +9321,7 @@ ${new XMLSerializer().serializeToString(r)}`;
9319
9321
  fontName: l,
9320
9322
  fontSize: a,
9321
9323
  fontColor: h
9322
- }, n.fontSize = a, !n.color && c && (n.color = h);
9324
+ }, n.fontSize = a, c && (n.color = h);
9323
9325
  }
9324
9326
  }
9325
9327
  static parseStamp(t, n) {
@@ -9428,7 +9430,7 @@ ${new XMLSerializer().serializeToString(r)}`;
9428
9430
  `Invalid XFDF: root element must be <xfdf>, got <${o?.localName ?? "unknown"}>`
9429
9431
  ), r;
9430
9432
  const c = o.getAttribute("xmlns");
9431
- c && c !== ye && r.errors.push(
9433
+ c && c !== we && r.errors.push(
9432
9434
  `Warning: unexpected namespace '${c}', attempting tag-name matching`
9433
9435
  );
9434
9436
  const l = o.querySelector("annots");