oasis-editor 0.0.113 → 0.0.114

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.
@@ -2539,7 +2539,7 @@ function OasisEditorAppLazy(props = {}) {
2539
2539
  onCleanup(() => {
2540
2540
  cancelled = true;
2541
2541
  });
2542
- import("./OasisEditorApp-BKPrQtm5.js").then((m) => {
2542
+ import("./OasisEditorApp-XloOiKSu.js").then((m) => {
2543
2543
  cancelled = true;
2544
2544
  setProgress(1);
2545
2545
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -3057,6 +3057,88 @@ function createStore(...[store, options]) {
3057
3057
  }
3058
3058
  return [wrappedStore, setStore];
3059
3059
  }
3060
+ const $ROOT = Symbol("store-root");
3061
+ function applyState(target, parent, property, merge, key) {
3062
+ const previous = parent[property];
3063
+ if (target === previous) return;
3064
+ const isArray = Array.isArray(target);
3065
+ if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || isArray !== Array.isArray(previous) || key && target[key] !== previous[key])) {
3066
+ setProperty(parent, property, target);
3067
+ return;
3068
+ }
3069
+ if (isArray) {
3070
+ if (target.length && previous.length && (!merge || key && target[0] && target[0][key] != null)) {
3071
+ let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
3072
+ for (start = 0, end = Math.min(previous.length, target.length); start < end && (previous[start] === target[start] || key && previous[start] && target[start] && previous[start][key] && previous[start][key] === target[start][key]); start++) {
3073
+ applyState(target[start], previous, start, merge, key);
3074
+ }
3075
+ const temp = new Array(target.length), newIndices = /* @__PURE__ */ new Map();
3076
+ for (end = previous.length - 1, newEnd = target.length - 1; end >= start && newEnd >= start && (previous[end] === target[newEnd] || key && previous[end] && target[newEnd] && previous[end][key] && previous[end][key] === target[newEnd][key]); end--, newEnd--) {
3077
+ temp[newEnd] = previous[end];
3078
+ }
3079
+ if (start > newEnd || start > end) {
3080
+ for (j = start; j <= newEnd; j++) setProperty(previous, j, target[j]);
3081
+ for (; j < target.length; j++) {
3082
+ setProperty(previous, j, temp[j]);
3083
+ applyState(target[j], previous, j, merge, key);
3084
+ }
3085
+ if (previous.length > target.length) setProperty(previous, "length", target.length);
3086
+ return;
3087
+ }
3088
+ newIndicesNext = new Array(newEnd + 1);
3089
+ for (j = newEnd; j >= start; j--) {
3090
+ item = target[j];
3091
+ keyVal = key && item ? item[key] : item;
3092
+ i = newIndices.get(keyVal);
3093
+ newIndicesNext[j] = i === void 0 ? -1 : i;
3094
+ newIndices.set(keyVal, j);
3095
+ }
3096
+ for (i = start; i <= end; i++) {
3097
+ item = previous[i];
3098
+ keyVal = key && item ? item[key] : item;
3099
+ j = newIndices.get(keyVal);
3100
+ if (j !== void 0 && j !== -1) {
3101
+ temp[j] = previous[i];
3102
+ j = newIndicesNext[j];
3103
+ newIndices.set(keyVal, j);
3104
+ }
3105
+ }
3106
+ for (j = start; j < target.length; j++) {
3107
+ if (j in temp) {
3108
+ setProperty(previous, j, temp[j]);
3109
+ applyState(target[j], previous, j, merge, key);
3110
+ } else setProperty(previous, j, target[j]);
3111
+ }
3112
+ } else {
3113
+ for (let i = 0, len = target.length; i < len; i++) {
3114
+ applyState(target[i], previous, i, merge, key);
3115
+ }
3116
+ }
3117
+ if (previous.length > target.length) setProperty(previous, "length", target.length);
3118
+ return;
3119
+ }
3120
+ const targetKeys = Object.keys(target);
3121
+ for (let i = 0, len = targetKeys.length; i < len; i++) {
3122
+ applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);
3123
+ }
3124
+ const previousKeys = Object.keys(previous);
3125
+ for (let i = 0, len = previousKeys.length; i < len; i++) {
3126
+ if (target[previousKeys[i]] === void 0) setProperty(previous, previousKeys[i], void 0);
3127
+ }
3128
+ }
3129
+ function reconcile(value, options = {}) {
3130
+ const {
3131
+ merge,
3132
+ key = "id"
3133
+ } = options, v = unwrap(value);
3134
+ return (state) => {
3135
+ if (!isWrappable(state) || !isWrappable(v)) return v;
3136
+ const res = applyState(v, {
3137
+ [$ROOT]: state
3138
+ }, $ROOT, merge, key);
3139
+ return res === void 0 ? state : res;
3140
+ };
3141
+ }
3060
3142
  function assertNever(value, label = "value") {
3061
3143
  const tag = value && typeof value === "object" && "type" in value ? value.type : value;
3062
3144
  throw new Error(`Unhandled ${label}: ${String(tag)}`);
@@ -18057,7 +18139,8 @@ function buildCanvasTableLayout(options) {
18057
18139
  const isStacked = verticalMode === "stack";
18058
18140
  const isFitText = !!((_w = cell.style) == null ? void 0 : _w.fitText) && !isRotated && !isStacked;
18059
18141
  const explicitRowHeightPx = parseDimensionToPx(effectiveRow.height);
18060
- const wrapWidth = isRotated || ((_x = cell.style) == null ? void 0 : _x.noWrap) ? isRotated && explicitRowHeightPx !== null && explicitRowHeightPx > 0 ? Math.max(
18142
+ const hasExplicitRowHeight = explicitRowHeightPx !== null && explicitRowHeightPx > 0;
18143
+ const wrapWidth = isRotated || ((_x = cell.style) == null ? void 0 : _x.noWrap) ? isRotated && hasExplicitRowHeight ? Math.max(
18061
18144
  MIN_TABLE_CELL_CONTENT_WIDTH_PX,
18062
18145
  explicitRowHeightPx - borders.top.width - borders.bottom.width - padding.top - padding.bottom
18063
18146
  ) : NO_WRAP_WIDTH_PX : contentWidthPx;
@@ -18099,7 +18182,6 @@ function buildCanvasTableLayout(options) {
18099
18182
  spacingBefore,
18100
18183
  spacingAfter
18101
18184
  });
18102
- const hasExplicitRowHeight = explicitRowHeightPx !== null && explicitRowHeightPx > 0;
18103
18185
  const paragraphStyleSize = ((_A = (_z = paragraph.runs[0]) == null ? void 0 : _z.styles) == null ? void 0 : _A.fontSize) ?? DEFAULT_FONT_SIZE_PX;
18104
18186
  contentNaturalHeightPx = Math.max(
18105
18187
  contentNaturalHeightPx,
@@ -18162,7 +18244,6 @@ function buildCanvasTableLayout(options) {
18162
18244
  });
18163
18245
  if (isRotated) {
18164
18246
  const lineThickness = projected.lines.length > 0 ? Math.max(...projected.lines.map((line) => line.height)) : paragraphHeight;
18165
- const hasExplicitRowHeight = explicitRowHeightPx !== null && explicitRowHeightPx > 0;
18166
18247
  const flowLength = projected.lines.length ? Math.max(
18167
18248
  ...projected.lines.map((line) => {
18168
18249
  const last = line.slots[line.slots.length - 1];
@@ -18332,6 +18413,35 @@ function PageBreak(props) {
18332
18413
  return _el$;
18333
18414
  })();
18334
18415
  }
18416
+ const HEX6_PATTERN = /^[0-9a-fA-F]{6}$/;
18417
+ function stripHashPrefix(color) {
18418
+ return color.trim().replace(/^#/, "");
18419
+ }
18420
+ function normalizeHex6(color) {
18421
+ if (!color) {
18422
+ return null;
18423
+ }
18424
+ const body = stripHashPrefix(color);
18425
+ return HEX6_PATTERN.test(body) ? body.toUpperCase() : null;
18426
+ }
18427
+ function parseHexColorToRgb255(color) {
18428
+ if (!color) {
18429
+ return null;
18430
+ }
18431
+ const normalized = stripHashPrefix(color);
18432
+ if (!HEX6_PATTERN.test(normalized)) {
18433
+ return null;
18434
+ }
18435
+ return [
18436
+ Number.parseInt(normalized.slice(0, 2), 16),
18437
+ Number.parseInt(normalized.slice(2, 4), 16),
18438
+ Number.parseInt(normalized.slice(4, 6), 16)
18439
+ ];
18440
+ }
18441
+ function rgb255ToHex(r, g2, b) {
18442
+ const toHex2 = (value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
18443
+ return `#${toHex2(r)}${toHex2(g2)}${toHex2(b)}`;
18444
+ }
18335
18445
  const imageCache = /* @__PURE__ */ new Map();
18336
18446
  function getCachedCanvasImage(src, onUpdate) {
18337
18447
  const cached = imageCache.get(src);
@@ -19876,6 +19986,39 @@ function buildPresetPath(preset, x, y, width, height) {
19876
19986
  }
19877
19987
  return path;
19878
19988
  }
19989
+ const DEG_TO_RAD = Math.PI / 180;
19990
+ const CANVAS_DASH_DASHED = [5, 3];
19991
+ const CANVAS_DASH_DOTTED = [1, 3];
19992
+ function drawEdge(ctx, border, x1, y1, x2, y2) {
19993
+ if (!border || border.type === "none" || border.width <= 0) {
19994
+ return;
19995
+ }
19996
+ ctx.save();
19997
+ ctx.beginPath();
19998
+ ctx.strokeStyle = border.color;
19999
+ ctx.lineWidth = border.width;
20000
+ if (border.type === "dashed") {
20001
+ ctx.setLineDash(CANVAS_DASH_DASHED);
20002
+ } else if (border.type === "dotted") {
20003
+ ctx.setLineDash(CANVAS_DASH_DOTTED);
20004
+ } else {
20005
+ ctx.setLineDash([]);
20006
+ }
20007
+ ctx.moveTo(x1, y1);
20008
+ ctx.lineTo(x2, y2);
20009
+ ctx.stroke();
20010
+ ctx.restore();
20011
+ }
20012
+ function drawBorderBox(ctx, left, top, width, height, borders) {
20013
+ const right = left + width;
20014
+ const bottom = top + height;
20015
+ drawEdge(ctx, borders.top, left, top, right, top);
20016
+ drawEdge(ctx, borders.right, right, top, right, bottom);
20017
+ drawEdge(ctx, borders.bottom, left, bottom, right, bottom);
20018
+ drawEdge(ctx, borders.left, left, top, left, bottom);
20019
+ drawEdge(ctx, borders.topLeftToBottomRight, left, top, right, bottom);
20020
+ drawEdge(ctx, borders.topRightToBottomLeft, right, top, left, bottom);
20021
+ }
19879
20022
  const TEXT_BOX_AUTOFIT_MEASURE_HEIGHT = 1e5;
19880
20023
  const TEXT_BOX_AUTOFIT_SAFETY_PX = 2;
19881
20024
  function getTextBoxPadding(textBox) {
@@ -20060,7 +20203,7 @@ function paintTextBox(ctx, textBox, state, x, y, width, height, pageIndex, onUpd
20060
20203
  if (rotation) {
20061
20204
  ctx.save();
20062
20205
  ctx.translate(x + width / 2, y + height / 2);
20063
- ctx.rotate(rotation * Math.PI / 180);
20206
+ ctx.rotate(rotation * DEG_TO_RAD);
20064
20207
  ctx.translate(-(x + width / 2), -(y + height / 2));
20065
20208
  }
20066
20209
  drawTextBoxShape(ctx, textBox, x, y, width, height);
@@ -20262,6 +20405,8 @@ function isDoubleUnderlineStyle(underlineStyle) {
20262
20405
  function isWavyUnderlineStyle(underlineStyle) {
20263
20406
  return underlineStyle === "wave" || underlineStyle === "wavyHeavy";
20264
20407
  }
20408
+ const WAVY_UNDERLINE_AMPLITUDE_PX = 1.5;
20409
+ const WAVY_UNDERLINE_WAVELENGTH_PX = 4;
20265
20410
  function underlineStyleLineWidthPx(underlineStyle) {
20266
20411
  switch (underlineStyle) {
20267
20412
  case "thick":
@@ -20327,42 +20472,12 @@ function underlineStyleDashArray(underlineStyle) {
20327
20472
  return void 0;
20328
20473
  }
20329
20474
  }
20330
- const CANVAS_DASH_DASHED = [5, 3];
20331
- const CANVAS_DASH_DOTTED = [1, 3];
20332
- function drawEdge(ctx, border, x1, y1, x2, y2) {
20333
- if (!border || border.type === "none" || border.width <= 0) {
20334
- return;
20335
- }
20336
- ctx.save();
20337
- ctx.beginPath();
20338
- ctx.strokeStyle = border.color;
20339
- ctx.lineWidth = border.width;
20340
- if (border.type === "dashed") {
20341
- ctx.setLineDash(CANVAS_DASH_DASHED);
20342
- } else if (border.type === "dotted") {
20343
- ctx.setLineDash(CANVAS_DASH_DOTTED);
20344
- } else {
20345
- ctx.setLineDash([]);
20346
- }
20347
- ctx.moveTo(x1, y1);
20348
- ctx.lineTo(x2, y2);
20349
- ctx.stroke();
20350
- ctx.restore();
20351
- }
20352
- function drawBorderBox(ctx, left, top, width, height, borders) {
20353
- const right = left + width;
20354
- const bottom = top + height;
20355
- drawEdge(ctx, borders.top, left, top, right, top);
20356
- drawEdge(ctx, borders.right, right, top, right, bottom);
20357
- drawEdge(ctx, borders.bottom, left, bottom, right, bottom);
20358
- drawEdge(ctx, borders.left, left, top, left, bottom);
20359
- drawEdge(ctx, borders.topLeftToBottomRight, left, top, right, bottom);
20360
- drawEdge(ctx, borders.topRightToBottomLeft, right, top, left, bottom);
20361
- }
20362
20475
  const DOUBLE_STRIKE_OFFSET_PX = 1.3;
20363
20476
  const DOUBLE_UNDERLINE_OFFSET_PX = 1.5;
20364
- const WAVY_UNDERLINE_AMPLITUDE_PX = 1.5;
20365
- const WAVY_UNDERLINE_WAVELENGTH_PX = 4;
20477
+ function hexToRgba(color, alpha) {
20478
+ const [r, g2, b] = parseHexColorToRgb255(color) ?? [0, 0, 0];
20479
+ return `rgba(${r},${g2},${b},${alpha})`;
20480
+ }
20366
20481
  const canvasTextLogger = createEditorLogger("canvas-text");
20367
20482
  const loggedCanvasFontKeys = /* @__PURE__ */ new Set();
20368
20483
  const MAX_CANVAS_FONT_LOGS = 40;
@@ -20441,7 +20556,7 @@ function drawImageFragment(ctx, img, image, x, y) {
20441
20556
  if (hasTransform) {
20442
20557
  ctx.translate(x + width / 2, y + height / 2);
20443
20558
  if (rotation) {
20444
- ctx.rotate(rotation * Math.PI / 180);
20559
+ ctx.rotate(rotation * DEG_TO_RAD);
20445
20560
  }
20446
20561
  ctx.scale(flipH ? -1 : 1, flipV ? -1 : 1);
20447
20562
  ctx.translate(-(x + width / 2), -(y + height / 2));
@@ -20475,7 +20590,7 @@ function drawImageFragment(ctx, img, image, x, y) {
20475
20590
  ctx.save();
20476
20591
  ctx.translate(x + width / 2, y + height / 2);
20477
20592
  if (rotation) {
20478
- ctx.rotate(rotation * Math.PI / 180);
20593
+ ctx.rotate(rotation * DEG_TO_RAD);
20479
20594
  }
20480
20595
  ctx.scale(flipH ? -1 : 1, flipV ? -1 : 1);
20481
20596
  ctx.drawImage(img, sx, sy, sw, sh, -width / 2, -height / 2, width, height);
@@ -20782,11 +20897,11 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
20782
20897
  }
20783
20898
  }
20784
20899
  }
20785
- function drawFragmentHighlight(ctx, line, fragment, originX, originY, color) {
20900
+ function drawFragmentColorRect(ctx, line, fragment, originX, originY, color, alpha) {
20786
20901
  const bounds = resolveFragmentPaintBounds(line, fragment);
20787
20902
  if (!bounds) return;
20788
20903
  ctx.save();
20789
- ctx.globalAlpha = 0.35;
20904
+ if (alpha !== void 0) ctx.globalAlpha = alpha;
20790
20905
  ctx.fillStyle = color;
20791
20906
  ctx.fillRect(
20792
20907
  originX + bounds.left,
@@ -20796,6 +20911,9 @@ function drawFragmentHighlight(ctx, line, fragment, originX, originY, color) {
20796
20911
  );
20797
20912
  ctx.restore();
20798
20913
  }
20914
+ function drawFragmentHighlight(ctx, line, fragment, originX, originY, color) {
20915
+ drawFragmentColorRect(ctx, line, fragment, originX, originY, color, 0.35);
20916
+ }
20799
20917
  function resolveFragmentPaintBounds(line, fragment) {
20800
20918
  const slotByOffset = new Map(
20801
20919
  line.slots.map((slot) => [slot.offset, slot])
@@ -20818,17 +20936,7 @@ function resolveFragmentPaintBounds(line, fragment) {
20818
20936
  };
20819
20937
  }
20820
20938
  function drawFragmentShading(ctx, line, fragment, originX, originY, color) {
20821
- const bounds = resolveFragmentPaintBounds(line, fragment);
20822
- if (!bounds) return;
20823
- ctx.save();
20824
- ctx.fillStyle = color;
20825
- ctx.fillRect(
20826
- originX + bounds.left,
20827
- originY + line.top + 2,
20828
- Math.max(0, bounds.right - bounds.left),
20829
- Math.max(2, line.height - 4)
20830
- );
20831
- ctx.restore();
20939
+ drawFragmentColorRect(ctx, line, fragment, originX, originY, color);
20832
20940
  }
20833
20941
  function getRenderedChar(char, styles) {
20834
20942
  return styles.allCaps ? char.toUpperCase() : char;
@@ -20858,16 +20966,12 @@ function resolveCanvasTextFill(ctx, styles, line, fragment, originX, originY) {
20858
20966
  const cx = (x0 + x1) / 2;
20859
20967
  const cy = (y0 + y1) / 2;
20860
20968
  const angleDeg = fill.angle ?? 0;
20861
- const rad = angleDeg * Math.PI / 180;
20969
+ const rad = angleDeg * DEG_TO_RAD;
20862
20970
  const dx = Math.cos(rad) * (x1 - x0) / 2;
20863
20971
  const dy = Math.sin(rad) * (y1 - y0) / 2;
20864
20972
  const gradient = ctx.createLinearGradient(cx - dx, cy - dy, cx + dx, cy + dy);
20865
20973
  for (const stop of fill.stops) {
20866
- const alpha = stop.alpha ?? 1;
20867
- const r = Number.parseInt(stop.color.slice(1, 3), 16);
20868
- const g2 = Number.parseInt(stop.color.slice(3, 5), 16);
20869
- const b = Number.parseInt(stop.color.slice(5, 7), 16);
20870
- gradient.addColorStop(stop.position, `rgba(${r},${g2},${b},${alpha})`);
20974
+ gradient.addColorStop(stop.position, hexToRgba(stop.color, stop.alpha ?? 1));
20871
20975
  }
20872
20976
  return gradient;
20873
20977
  }
@@ -20888,23 +20992,15 @@ function drawStyledText(ctx, text, x, y, scale, styles) {
20888
20992
  ctx.save();
20889
20993
  if (styles.textShadow) {
20890
20994
  const ts = styles.textShadow;
20891
- const dirRad = ts.dirDeg * Math.PI / 180;
20995
+ const dirRad = ts.dirDeg * DEG_TO_RAD;
20892
20996
  const distPx = ts.distPt * PX_PER_POINT;
20893
- const alpha = ts.alpha ?? 1;
20894
- const r = Number.parseInt(ts.color.slice(1, 3), 16);
20895
- const g2 = Number.parseInt(ts.color.slice(3, 5), 16);
20896
- const b = Number.parseInt(ts.color.slice(5, 7), 16);
20897
- ctx.shadowColor = `rgba(${r},${g2},${b},${alpha})`;
20997
+ ctx.shadowColor = hexToRgba(ts.color, ts.alpha ?? 1);
20898
20998
  ctx.shadowBlur = ts.blurPt * PX_PER_POINT;
20899
20999
  ctx.shadowOffsetX = Math.cos(dirRad) * distPx;
20900
21000
  ctx.shadowOffsetY = Math.sin(dirRad) * distPx;
20901
21001
  } else if (styles.glow) {
20902
21002
  const gl = styles.glow;
20903
- const alpha = gl.alpha ?? 0.7;
20904
- const r = Number.parseInt(gl.color.slice(1, 3), 16);
20905
- const g2 = Number.parseInt(gl.color.slice(3, 5), 16);
20906
- const b = Number.parseInt(gl.color.slice(5, 7), 16);
20907
- ctx.shadowColor = `rgba(${r},${g2},${b},${alpha})`;
21003
+ ctx.shadowColor = hexToRgba(gl.color, gl.alpha ?? 0.7);
20908
21004
  ctx.shadowBlur = gl.radiusPt * PX_PER_POINT;
20909
21005
  ctx.shadowOffsetX = 0;
20910
21006
  ctx.shadowOffsetY = 0;
@@ -34429,35 +34525,6 @@ function applyDocGridLinePitch(blocks, linePitchPx, mode, docGridType, settings)
34429
34525
  }
34430
34526
  }
34431
34527
  }
34432
- const HEX6_PATTERN = /^[0-9a-fA-F]{6}$/;
34433
- function stripHashPrefix(color) {
34434
- return color.trim().replace(/^#/, "");
34435
- }
34436
- function normalizeHex6(color) {
34437
- if (!color) {
34438
- return null;
34439
- }
34440
- const body = stripHashPrefix(color);
34441
- return HEX6_PATTERN.test(body) ? body.toUpperCase() : null;
34442
- }
34443
- function parseHexColorToRgb255(color) {
34444
- if (!color) {
34445
- return null;
34446
- }
34447
- const normalized = stripHashPrefix(color);
34448
- if (!HEX6_PATTERN.test(normalized)) {
34449
- return null;
34450
- }
34451
- return [
34452
- Number.parseInt(normalized.slice(0, 2), 16),
34453
- Number.parseInt(normalized.slice(2, 4), 16),
34454
- Number.parseInt(normalized.slice(4, 6), 16)
34455
- ];
34456
- }
34457
- function rgb255ToHex(r, g2, b) {
34458
- const toHex2 = (value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
34459
- return `#${toHex2(r)}${toHex2(g2)}${toHex2(b)}`;
34460
- }
34461
34528
  const VML_FRACTION_DENOMINATOR = 65536;
34462
34529
  function emuToPx(value) {
34463
34530
  const emu = parseOptionalInt$1(value);
@@ -36782,41 +36849,15 @@ async function importDocxToEditorDocument(buffer, options = {}) {
36782
36849
  );
36783
36850
  const hasAssets = Object.keys(assets.assets).length > 0;
36784
36851
  const finalize = (doc2) => {
36785
- if (docSettings.defaultTabStop !== void 0) {
36786
- doc2.settings = {
36787
- ...doc2.settings ?? {},
36788
- defaultTabStop: docSettings.defaultTabStop
36789
- };
36790
- }
36791
- if (docSettings.allowSpaceOfSameStyleInTable) {
36792
- doc2.settings = {
36793
- ...doc2.settings ?? {},
36794
- allowSpaceOfSameStyleInTable: true
36795
- };
36796
- }
36797
- if (docSettings.autoHyphenation) {
36798
- doc2.settings = {
36799
- ...doc2.settings ?? {},
36800
- autoHyphenation: true
36801
- };
36802
- }
36803
- if (docSettings.doNotHyphenateCaps) {
36804
- doc2.settings = {
36805
- ...doc2.settings ?? {},
36806
- doNotHyphenateCaps: true
36807
- };
36808
- }
36809
- if (docSettings.consecutiveHyphenLimit !== void 0) {
36810
- doc2.settings = {
36811
- ...doc2.settings ?? {},
36812
- consecutiveHyphenLimit: docSettings.consecutiveHyphenLimit
36813
- };
36814
- }
36815
- if (docSettings.hyphenationZone !== void 0) {
36816
- doc2.settings = {
36817
- ...doc2.settings ?? {},
36818
- hyphenationZone: docSettings.hyphenationZone
36819
- };
36852
+ const settingsPatch = {};
36853
+ if (docSettings.defaultTabStop !== void 0) settingsPatch.defaultTabStop = docSettings.defaultTabStop;
36854
+ if (docSettings.allowSpaceOfSameStyleInTable) settingsPatch.allowSpaceOfSameStyleInTable = true;
36855
+ if (docSettings.autoHyphenation) settingsPatch.autoHyphenation = true;
36856
+ if (docSettings.doNotHyphenateCaps) settingsPatch.doNotHyphenateCaps = true;
36857
+ if (docSettings.consecutiveHyphenLimit !== void 0) settingsPatch.consecutiveHyphenLimit = docSettings.consecutiveHyphenLimit;
36858
+ if (docSettings.hyphenationZone !== void 0) settingsPatch.hyphenationZone = docSettings.hyphenationZone;
36859
+ if (Object.keys(settingsPatch).length > 0) {
36860
+ doc2.settings = { ...doc2.settings ?? {}, ...settingsPatch };
36820
36861
  }
36821
36862
  if (fontTable) {
36822
36863
  doc2.fontTable = fontTable;
@@ -36904,8 +36945,19 @@ function buildEditorComments(ranges, bodies) {
36904
36945
  }
36905
36946
  return order.length > 0 ? { items, order } : void 0;
36906
36947
  }
36907
- function remapImportedFootnoteRefsInSections(sections, byDocxId) {
36948
+ function walkSectionBlocks(sections, visit) {
36908
36949
  var _a, _b, _c, _d, _e, _f;
36950
+ for (const section of sections) {
36951
+ section.blocks.forEach(visit);
36952
+ (_a = section.header) == null ? void 0 : _a.forEach(visit);
36953
+ (_b = section.firstPageHeader) == null ? void 0 : _b.forEach(visit);
36954
+ (_c = section.evenPageHeader) == null ? void 0 : _c.forEach(visit);
36955
+ (_d = section.footer) == null ? void 0 : _d.forEach(visit);
36956
+ (_e = section.firstPageFooter) == null ? void 0 : _e.forEach(visit);
36957
+ (_f = section.evenPageFooter) == null ? void 0 : _f.forEach(visit);
36958
+ }
36959
+ }
36960
+ function remapImportedFootnoteRefsInSections(sections, byDocxId) {
36909
36961
  const remapBlock = (block) => {
36910
36962
  if (block.type === "paragraph") {
36911
36963
  block.runs.forEach((run, index) => {
@@ -36939,18 +36991,9 @@ function remapImportedFootnoteRefsInSections(sections, byDocxId) {
36939
36991
  }
36940
36992
  }
36941
36993
  };
36942
- for (const section of sections) {
36943
- section.blocks.forEach(remapBlock);
36944
- (_a = section.header) == null ? void 0 : _a.forEach(remapBlock);
36945
- (_b = section.firstPageHeader) == null ? void 0 : _b.forEach(remapBlock);
36946
- (_c = section.evenPageHeader) == null ? void 0 : _c.forEach(remapBlock);
36947
- (_d = section.footer) == null ? void 0 : _d.forEach(remapBlock);
36948
- (_e = section.firstPageFooter) == null ? void 0 : _e.forEach(remapBlock);
36949
- (_f = section.evenPageFooter) == null ? void 0 : _f.forEach(remapBlock);
36950
- }
36994
+ walkSectionBlocks(sections, remapBlock);
36951
36995
  }
36952
36996
  function remapImportedEndnoteRefsInSections(sections, byDocxId) {
36953
- var _a, _b, _c, _d, _e, _f;
36954
36997
  const remapBlock = (block) => {
36955
36998
  if (block.type === "paragraph") {
36956
36999
  block.runs.forEach((run, index) => {
@@ -36984,15 +37027,7 @@ function remapImportedEndnoteRefsInSections(sections, byDocxId) {
36984
37027
  }
36985
37028
  }
36986
37029
  };
36987
- for (const section of sections) {
36988
- section.blocks.forEach(remapBlock);
36989
- (_a = section.header) == null ? void 0 : _a.forEach(remapBlock);
36990
- (_b = section.firstPageHeader) == null ? void 0 : _b.forEach(remapBlock);
36991
- (_c = section.evenPageHeader) == null ? void 0 : _c.forEach(remapBlock);
36992
- (_d = section.footer) == null ? void 0 : _d.forEach(remapBlock);
36993
- (_e = section.firstPageFooter) == null ? void 0 : _e.forEach(remapBlock);
36994
- (_f = section.evenPageFooter) == null ? void 0 : _f.forEach(remapBlock);
36995
- }
37030
+ walkSectionBlocks(sections, remapBlock);
36996
37031
  }
36997
37032
  let nextRequestId = 1;
36998
37033
  function canUseDocxWorker() {
@@ -37008,7 +37043,7 @@ function importDocxInWorker(buffer, options = {}) {
37008
37043
  const worker = new Worker(
37009
37044
  new URL(
37010
37045
  /* @vite-ignore */
37011
- "" + new URL("assets/importDocxWorker-Bz2kZOBO.js", import.meta.url).href,
37046
+ "" + new URL("assets/importDocxWorker-D0F0jbcF.js", import.meta.url).href,
37012
37047
  import.meta.url
37013
37048
  ),
37014
37049
  {
@@ -42666,7 +42701,7 @@ export {
42666
42701
  resolveImageSrc as Z,
42667
42702
  listKindForTag as _,
42668
42703
  getPageContentWidth as a,
42669
- getPresetPathSegments as a$,
42704
+ resolveFloatingObjectRect as a$,
42670
42705
  collectInlineRuns as a0,
42671
42706
  parseParagraphStyle as a1,
42672
42707
  getRunImage as a2,
@@ -42677,33 +42712,33 @@ export {
42677
42712
  getCaretRectFromSnapshot as a7,
42678
42713
  getParagraphRectFromSnapshot as a8,
42679
42714
  createComponent as a9,
42680
- enablePreciseFontMode as aA,
42681
- TWIPS_PER_POINT as aB,
42682
- PX_PER_INCH as aC,
42683
- TWIPS_PER_INCH as aD,
42684
- normalizeHex6 as aE,
42685
- TABLE_CONDITIONAL_FLAG_ATTRIBUTES as aF,
42686
- TABLE_BORDER_EDGE_KEYS as aG,
42687
- resolveEffectiveParagraphStyle as aH,
42688
- resolveEffectiveTextStyleForParagraph as aI,
42689
- EMU_PER_PT as aJ,
42690
- OOXML_ROTATION_UNITS as aK,
42691
- OOXML_PERCENT_DENOMINATOR as aL,
42692
- parseHexColorToRgb255 as aM,
42693
- EMU_PER_PX as aN,
42694
- getRunFootnoteReference as aO,
42695
- getRunEndnoteReference as aP,
42696
- iterateFootnoteReferenceRuns as aQ,
42697
- iterateEndnoteReferenceRuns as aR,
42698
- imageContentTypeDefaults as aS,
42699
- getRunFieldChar as aT,
42700
- getRunFieldInstruction as aU,
42701
- createEditorRun as aV,
42702
- JSZip as aW,
42703
- imageExtensionFromMime as aX,
42704
- pxToPt as aY,
42705
- resolveFloatingObjectRect as aZ,
42706
- getTextBoxFloatingGeometry as a_,
42715
+ setPreciseFontPreference as aA,
42716
+ setWelcomeSeen as aB,
42717
+ enablePreciseFontMode as aC,
42718
+ TWIPS_PER_POINT as aD,
42719
+ PX_PER_INCH as aE,
42720
+ TWIPS_PER_INCH as aF,
42721
+ normalizeHex6 as aG,
42722
+ TABLE_CONDITIONAL_FLAG_ATTRIBUTES as aH,
42723
+ TABLE_BORDER_EDGE_KEYS as aI,
42724
+ resolveEffectiveParagraphStyle as aJ,
42725
+ resolveEffectiveTextStyleForParagraph as aK,
42726
+ EMU_PER_PT as aL,
42727
+ OOXML_ROTATION_UNITS as aM,
42728
+ OOXML_PERCENT_DENOMINATOR as aN,
42729
+ parseHexColorToRgb255 as aO,
42730
+ EMU_PER_PX as aP,
42731
+ getRunFootnoteReference as aQ,
42732
+ getRunEndnoteReference as aR,
42733
+ iterateFootnoteReferenceRuns as aS,
42734
+ iterateEndnoteReferenceRuns as aT,
42735
+ imageContentTypeDefaults as aU,
42736
+ getRunFieldChar as aV,
42737
+ getRunFieldInstruction as aW,
42738
+ createEditorRun as aX,
42739
+ JSZip as aY,
42740
+ imageExtensionFromMime as aZ,
42741
+ pxToPt as a_,
42707
42742
  CaretOverlay as aa,
42708
42743
  Show as ab,
42709
42744
  createRenderEffect as ac,
@@ -42723,144 +42758,148 @@ export {
42723
42758
  For as aq,
42724
42759
  UNDERLINE_STYLE_OPTIONS as ar,
42725
42760
  Tabs as as,
42726
- onMount as at,
42727
- onCleanup as au,
42728
- PluginUiHost as av,
42729
- OasisEditorEditor as aw,
42730
- OasisBrandMark as ax,
42731
- setPreciseFontPreference as ay,
42732
- setWelcomeSeen as az,
42761
+ createStore as at,
42762
+ reconcile as au,
42763
+ onMount as av,
42764
+ onCleanup as aw,
42765
+ PluginUiHost as ax,
42766
+ OasisEditorEditor as ay,
42767
+ OasisBrandMark as az,
42733
42768
  getPageBodyTop as b,
42734
- createFootnoteReferenceRun as b$,
42735
- buildListLabels as b0,
42736
- getImageFloatingGeometry as b1,
42737
- textStyleToFontSizePt as b2,
42738
- PX_PER_POINT as b3,
42739
- DEFAULT_FONT_SIZE_PX as b4,
42740
- resolveOpenTypeFeatureTags as b5,
42741
- rgb255ToHex as b6,
42742
- isDoubleUnderlineStyle as b7,
42743
- isWavyUnderlineStyle as b8,
42744
- underlineStyleLineWidthPx as b9,
42745
- getDocumentParagraphs as bA,
42746
- getDocumentPageSettings as bB,
42747
- getTableCellContentWidthForParagraph as bC,
42748
- layoutMetricsEpoch as bD,
42749
- bumpLayoutMetricsEpoch as bE,
42750
- createCanvasLayoutSnapshotProvider as bF,
42751
- on as bG,
42752
- debounce as bH,
42753
- unwrap as bI,
42754
- perfTimer as bJ,
42755
- getRunTextBox as bK,
42756
- createEditorDocument as bL,
42757
- resolveResizedDimensions as bM,
42758
- resolveTextBoxRenderHeight as bN,
42759
- getToolbarStyleState as bO,
42760
- getCachedCanvasImage as bP,
42761
- measureParagraphMinContentWidthPx as bQ,
42762
- getEditableBlocksForZone as bR,
42763
- findParagraphLocation as bS,
42764
- createSectionBoundaryParagraph as bT,
42765
- normalizePageSettings as bU,
42766
- DEFAULT_EDITOR_PAGE_SETTINGS as bV,
42767
- markStart as bW,
42768
- markEnd as bX,
42769
- getParagraphEntries as bY,
42770
- getParagraphById as bZ,
42771
- createEditorFootnote as b_,
42772
- underlineStyleDashArray as ba,
42773
- resolveListLabel as bb,
42774
- getListLabelInset as bc,
42775
- getAlignedListLabelInset as bd,
42776
- getParagraphBorderInsets as be,
42777
- buildSegmentTable as bf,
42778
- buildCanvasTableLayout as bg,
42779
- resolveCanvasTableWidth as bh,
42780
- resolveFloatingTableRect as bi,
42781
- normalizeFamily as bj,
42782
- ROBOTO_FONT_FILES as bk,
42783
- loadFontAsset as bl,
42784
- OFFICE_COMPAT_FONT_FAMILIES as bm,
42785
- BinaryReader as bn,
42786
- buildSfnt as bo,
42787
- defaultFontDecoderRegistry as bp,
42788
- SfntFontProgram as bq,
42789
- collectPdfFontFamilies as br,
42790
- outlineFrom as bs,
42791
- getPageHeaderZoneTop as bt,
42792
- getPageColumnRects as bu,
42793
- findFootnoteReference as bv,
42794
- FOOTNOTE_MARKER_GUTTER_PX as bw,
42795
- resolveImporterForFile as bx,
42796
- getDocumentSectionsCanonical as by,
42797
- getDocumentParagraphsCanonical as bz,
42769
+ markEnd as b$,
42770
+ getTextBoxFloatingGeometry as b0,
42771
+ getPresetPathSegments as b1,
42772
+ buildListLabels as b2,
42773
+ getImageFloatingGeometry as b3,
42774
+ textStyleToFontSizePt as b4,
42775
+ PX_PER_POINT as b5,
42776
+ DEFAULT_FONT_SIZE_PX as b6,
42777
+ resolveOpenTypeFeatureTags as b7,
42778
+ rgb255ToHex as b8,
42779
+ isDoubleUnderlineStyle as b9,
42780
+ FOOTNOTE_MARKER_GUTTER_PX as bA,
42781
+ resolveImporterForFile as bB,
42782
+ getDocumentSectionsCanonical as bC,
42783
+ getDocumentParagraphsCanonical as bD,
42784
+ getDocumentParagraphs as bE,
42785
+ getDocumentPageSettings as bF,
42786
+ getTableCellContentWidthForParagraph as bG,
42787
+ layoutMetricsEpoch as bH,
42788
+ bumpLayoutMetricsEpoch as bI,
42789
+ createCanvasLayoutSnapshotProvider as bJ,
42790
+ on as bK,
42791
+ debounce as bL,
42792
+ unwrap as bM,
42793
+ perfTimer as bN,
42794
+ getRunTextBox as bO,
42795
+ createEditorDocument as bP,
42796
+ resolveResizedDimensions as bQ,
42797
+ resolveTextBoxRenderHeight as bR,
42798
+ getToolbarStyleState as bS,
42799
+ getCachedCanvasImage as bT,
42800
+ measureParagraphMinContentWidthPx as bU,
42801
+ getEditableBlocksForZone as bV,
42802
+ findParagraphLocation as bW,
42803
+ createSectionBoundaryParagraph as bX,
42804
+ normalizePageSettings as bY,
42805
+ DEFAULT_EDITOR_PAGE_SETTINGS as bZ,
42806
+ markStart as b_,
42807
+ isWavyUnderlineStyle as ba,
42808
+ underlineStyleLineWidthPx as bb,
42809
+ WAVY_UNDERLINE_WAVELENGTH_PX as bc,
42810
+ WAVY_UNDERLINE_AMPLITUDE_PX as bd,
42811
+ underlineStyleDashArray as be,
42812
+ resolveListLabel as bf,
42813
+ getListLabelInset as bg,
42814
+ getAlignedListLabelInset as bh,
42815
+ getParagraphBorderInsets as bi,
42816
+ buildSegmentTable as bj,
42817
+ buildCanvasTableLayout as bk,
42818
+ resolveCanvasTableWidth as bl,
42819
+ resolveFloatingTableRect as bm,
42820
+ normalizeFamily as bn,
42821
+ ROBOTO_FONT_FILES as bo,
42822
+ loadFontAsset as bp,
42823
+ OFFICE_COMPAT_FONT_FAMILIES as bq,
42824
+ BinaryReader as br,
42825
+ buildSfnt as bs,
42826
+ defaultFontDecoderRegistry as bt,
42827
+ SfntFontProgram as bu,
42828
+ collectPdfFontFamilies as bv,
42829
+ outlineFrom as bw,
42830
+ getPageHeaderZoneTop as bx,
42831
+ getPageColumnRects as by,
42832
+ findFootnoteReference as bz,
42798
42833
  getPageBodyBottom as c,
42799
- registerToolbarRenderer as c$,
42800
- renumberFootnotes as c0,
42801
- getHeadingLevel as c1,
42802
- preciseFontModeVersion as c2,
42803
- isPreciseFontModeEnabled as c3,
42804
- resolveNamedTextStyle as c4,
42805
- togglePreciseFontMode as c5,
42806
- nextFontSizePt as c6,
42807
- previousFontSizePt as c7,
42808
- fontSizePtToPx as c8,
42809
- createDefaultToolbarPreset as c9,
42810
- GridPicker as cA,
42811
- IconButton as cB,
42812
- Menu as cC,
42813
- OASIS_BUILTIN_COMMANDS as cD,
42814
- OASIS_MENU_ITEMS as cE,
42815
- OASIS_TOOLBAR_ITEMS as cF,
42816
- OasisEditorAppLazy as cG,
42817
- OasisEditorContainer as cH,
42818
- PluginCollection as cI,
42819
- Popover as cJ,
42820
- RIBBON_TABS as cK,
42821
- Select as cL,
42822
- SelectField as cM,
42823
- Separator as cN,
42824
- SidePanel as cO,
42825
- SidePanelBody as cP,
42826
- SidePanelFooter as cQ,
42827
- SidePanelHeader as cR,
42828
- SplitButton as cS,
42829
- StyleGallery as cT,
42830
- TextField as cU,
42831
- Button$1 as cV,
42832
- buildRibbonTabDefinitions as cW,
42833
- createEditorCommandBus as cX,
42834
- createOasisEditor as cY,
42835
- createOasisEditorContainer as cZ,
42836
- mount as c_,
42837
- MenuRegistry as ca,
42838
- createToolbarRegistry as cb,
42839
- Editor as cc,
42840
- resolveCommandRef as cd,
42841
- commandRefName as ce,
42842
- createOasisEditorClient as cf,
42843
- createEditorZoom as cg,
42844
- startLongTaskObserver as ch,
42845
- installGlobalReport as ci,
42846
- applyStoredPreciseFontPreference as cj,
42847
- getWelcomeSeen as ck,
42848
- isLocalFontAccessSupported as cl,
42849
- EDITOR_SCROLL_PADDING_PX as cm,
42850
- Toolbar as cn,
42851
- OasisEditorLoading as co,
42852
- I18nProvider as cp,
42853
- createTranslator as cq,
42854
- createEditorLogger as cr,
42855
- registerDomStatsSurface as cs,
42856
- Button as ct,
42857
- Checkbox as cu,
42858
- ColorPicker as cv,
42859
- CommandRegistry as cw,
42860
- DEFAULT_PALETTE as cx,
42861
- DialogFooter as cy,
42862
- FloatingActionButton as cz,
42834
+ createEditorCommandBus as c$,
42835
+ getParagraphEntries as c0,
42836
+ getParagraphById as c1,
42837
+ createEditorFootnote as c2,
42838
+ createFootnoteReferenceRun as c3,
42839
+ renumberFootnotes as c4,
42840
+ getHeadingLevel as c5,
42841
+ preciseFontModeVersion as c6,
42842
+ isPreciseFontModeEnabled as c7,
42843
+ resolveNamedTextStyle as c8,
42844
+ togglePreciseFontMode as c9,
42845
+ CommandRegistry as cA,
42846
+ DEFAULT_PALETTE as cB,
42847
+ DialogFooter as cC,
42848
+ FloatingActionButton as cD,
42849
+ GridPicker as cE,
42850
+ IconButton as cF,
42851
+ Menu as cG,
42852
+ OASIS_BUILTIN_COMMANDS as cH,
42853
+ OASIS_MENU_ITEMS as cI,
42854
+ OASIS_TOOLBAR_ITEMS as cJ,
42855
+ OasisEditorAppLazy as cK,
42856
+ OasisEditorContainer as cL,
42857
+ PluginCollection as cM,
42858
+ Popover as cN,
42859
+ RIBBON_TABS as cO,
42860
+ Select as cP,
42861
+ SelectField as cQ,
42862
+ Separator as cR,
42863
+ SidePanel as cS,
42864
+ SidePanelBody as cT,
42865
+ SidePanelFooter as cU,
42866
+ SidePanelHeader as cV,
42867
+ SplitButton as cW,
42868
+ StyleGallery as cX,
42869
+ TextField as cY,
42870
+ Button$1 as cZ,
42871
+ buildRibbonTabDefinitions as c_,
42872
+ nextFontSizePt as ca,
42873
+ previousFontSizePt as cb,
42874
+ fontSizePtToPx as cc,
42875
+ createDefaultToolbarPreset as cd,
42876
+ MenuRegistry as ce,
42877
+ createToolbarRegistry as cf,
42878
+ Editor as cg,
42879
+ resolveCommandRef as ch,
42880
+ commandRefName as ci,
42881
+ createOasisEditorClient as cj,
42882
+ createEditorZoom as ck,
42883
+ startLongTaskObserver as cl,
42884
+ installGlobalReport as cm,
42885
+ applyStoredPreciseFontPreference as cn,
42886
+ getWelcomeSeen as co,
42887
+ isLocalFontAccessSupported as cp,
42888
+ EDITOR_SCROLL_PADDING_PX as cq,
42889
+ Toolbar as cr,
42890
+ OasisEditorLoading as cs,
42891
+ I18nProvider as ct,
42892
+ createTranslator as cu,
42893
+ createEditorLogger as cv,
42894
+ registerDomStatsSurface as cw,
42895
+ Button as cx,
42896
+ Checkbox as cy,
42897
+ ColorPicker as cz,
42863
42898
  domTextMeasurer as d,
42899
+ createOasisEditor as d0,
42900
+ createOasisEditorContainer as d1,
42901
+ mount as d2,
42902
+ registerToolbarRenderer as d3,
42864
42903
  estimateTableBlockHeight as e,
42865
42904
  getFootnoteDisplayMarker as f,
42866
42905
  getProjectedParagraphBlockHeight as g,