@sw7d/paper-renderer 0.2.2 → 0.2.4

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.
@@ -49,7 +49,7 @@ var x = Object.create, S = Object.defineProperty, C = Object.getOwnPropertyDescr
49
49
  }
50
50
  }, M = {
51
51
  A4: {
52
- columns: 1,
52
+ columns: 2,
53
53
  margins: [
54
54
  50,
55
55
  56,
@@ -101,13 +101,13 @@ var x = Object.create, S = Object.defineProperty, C = Object.getOwnPropertyDescr
101
101
  bodyTopOdd: 50
102
102
  }
103
103
  };
104
- function N(e) {
104
+ function ee(e) {
105
105
  return M[e];
106
106
  }
107
- function P(e) {
107
+ function N(e) {
108
108
  if (!e) return {
109
109
  size: "A4",
110
- columns: 1
110
+ columns: 2
111
111
  };
112
112
  let t = e.match(/_(\d+)$/), n = t ? parseInt(t[1]) : 1, r = t ? e.replace(/_\d+$/, "") : e;
113
113
  return {
@@ -120,20 +120,20 @@ function P(e) {
120
120
  columns: n
121
121
  };
122
122
  }
123
- function F(e, t, n, r) {
123
+ function P(e, t, n, r) {
124
124
  return [
125
- I(e),
126
- I(t),
127
- I(n),
128
- I(r)
125
+ F(e),
126
+ F(t),
127
+ F(n),
128
+ F(r)
129
129
  ];
130
130
  }
131
- function I(e) {
131
+ function F(e) {
132
132
  return Math.round(e * 100) / 100;
133
133
  }
134
134
  //#endregion
135
135
  //#region src/engine/PaperLayout.ts
136
- var ee = class {
136
+ var te = class {
137
137
  settings;
138
138
  pageWidth = 0;
139
139
  pageHeight = 0;
@@ -155,9 +155,9 @@ var ee = class {
155
155
  getDefaultSettings() {
156
156
  return {
157
157
  paperSize: "A4",
158
- columns: 1,
159
- fontSize: 14,
160
- lineSpacing: 1.5,
158
+ columns: 2,
159
+ fontSize: 16,
160
+ lineSpacing: 1,
161
161
  margins: [
162
162
  50,
163
163
  56,
@@ -348,72 +348,75 @@ var ee = class {
348
348
  }
349
349
  ];
350
350
  }
351
- }, te = null, L = /* @__PURE__ */ new Map(), R = 5e3;
352
- function ne() {
353
- if (te) return te;
351
+ }, ne = null, I = /* @__PURE__ */ new Map(), L = 5e3;
352
+ function re() {
353
+ if (ne) return ne;
354
354
  try {
355
355
  if (typeof document > "u") return null;
356
356
  let e = document.createElement("canvas");
357
- return e.width = 1, e.height = 1, te = e.getContext("2d"), te;
357
+ return e.width = 1, e.height = 1, ne = e.getContext("2d"), ne;
358
358
  } catch {
359
359
  return null;
360
360
  }
361
361
  }
362
- function re(e, t, n, r) {
363
- return `${r ? "italic" : "normal"} ${n ? "bold" : "normal"} ${t}px ${e.includes(" ") && !e.includes("\"") && !e.includes("'") ? `"${e}"` : e}`;
362
+ function ie(e, t, n, r) {
363
+ return `${r ? "italic" : "normal"} ${n ? "bold" : "normal"} ${t}px ${e.split(",").map((e) => {
364
+ let t = e.trim();
365
+ return t.includes(" ") && !t.includes("\"") && !t.includes("'") ? `"${t}"` : t;
366
+ }).join(", ")}`;
364
367
  }
365
- function ie(e) {
368
+ function ae(e) {
366
369
  let t = e.charCodeAt(0);
367
370
  return t >= 19968 && t <= 40959 || t >= 13312 && t <= 19903 || t >= 63744 && t <= 64255 || t >= 194560 && t <= 195103 || t >= 11904 && t <= 12031 || t >= 12288 && t <= 12351;
368
371
  }
369
- function z(e) {
372
+ function R(e) {
370
373
  let t = e.charCodeAt(0);
371
374
  return t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
372
375
  }
373
- function ae(e, t) {
374
- return ie(e) || z(e) || e === " " ? t : e === " " ? t * .25 : t * .6;
376
+ function oe(e, t) {
377
+ return ae(e) || R(e) || e === " " ? t : e === " " ? t * .25 : t * .6;
375
378
  }
376
- function B(e, t, n, r, i) {
377
- let a = ne();
379
+ function z(e, t, n, r, i) {
380
+ let a = re();
378
381
  if (a) {
379
- let o = n || "\"Times New Roman\", SimSun, STSong, serif", s = `${e}|${o}|${t}|${r}|${i}`, c = L.get(s);
382
+ let o = n || "\"Times New Roman\", SimSun, STSong, serif", s = `${e}|${o}|${t}|${r}|${i}`, c = I.get(s);
380
383
  if (c !== void 0) return c;
381
- a.font = re(o, t, !!r, !!i);
384
+ a.font = ie(o, t, !!r, !!i);
382
385
  let l = a.measureText(e).width;
383
- if (L.size > R) {
384
- let e = Array.from(L.keys()).slice(0, R / 2);
385
- for (let t of e) L.delete(t);
386
+ if (I.size > L) {
387
+ let e = Array.from(I.keys()).slice(0, L / 2);
388
+ for (let t of e) I.delete(t);
386
389
  }
387
- return L.set(s, l), l;
390
+ return I.set(s, l), l;
388
391
  }
389
- return ae(e, t);
392
+ return oe(e, t);
390
393
  }
391
- function oe(e, t, n, r, i) {
392
- let a = ne();
394
+ function se(e, t, n, r, i) {
395
+ let a = re();
393
396
  if (a) {
394
- let o = n || "\"Times New Roman\", SimSun, STSong, serif", s = `T|${e}|${o}|${t}|${r}|${i}`, c = L.get(s);
397
+ let o = n || "\"Times New Roman\", SimSun, STSong, serif", s = `T|${e}|${o}|${t}|${r}|${i}`, c = I.get(s);
395
398
  if (c !== void 0) return c;
396
- a.font = re(o, t, !!r, !!i);
399
+ a.font = ie(o, t, !!r, !!i);
397
400
  let l = a.measureText(e).width;
398
- if (L.size > R) {
399
- let e = Array.from(L.keys()).slice(0, R / 2);
400
- for (let t of e) L.delete(t);
401
+ if (I.size > L) {
402
+ let e = Array.from(I.keys()).slice(0, L / 2);
403
+ for (let t of e) I.delete(t);
401
404
  }
402
- return L.set(s, l), l;
405
+ return I.set(s, l), l;
403
406
  }
404
407
  let o = 0;
405
- for (let n of e) o += ae(n, t);
408
+ for (let n of e) o += oe(n, t);
406
409
  return o;
407
410
  }
408
- function V(e, t, n, r, i) {
411
+ function B(e, t, n, r, i) {
409
412
  let a = [], o = 0;
410
- for (let s of e) a.push(o), o += B(s, t, n, r, i);
413
+ for (let s of e) a.push(o), o += z(s, t, n, r, i);
411
414
  return a;
412
415
  }
413
- function se(e, t, n, r, i) {
414
- let a = ne();
416
+ function ce(e, t, n, r, i) {
417
+ let a = re();
415
418
  if (a) {
416
- a.font = re(n || "\"Times New Roman\", SimSun, STSong, serif", t, !!r, !!i);
419
+ a.font = ie(n || "\"Times New Roman\", SimSun, STSong, serif", t, !!r, !!i);
417
420
  let o = a.measureText(e);
418
421
  return {
419
422
  ascent: o.actualBoundingBoxAscent,
@@ -427,23 +430,23 @@ function se(e, t, n, r, i) {
427
430
  height: t
428
431
  };
429
432
  }
430
- function ce() {
431
- L.clear();
433
+ function le() {
434
+ I.clear();
432
435
  }
433
436
  //#endregion
434
437
  //#region src/engine/svg/headerRenderer.ts
435
- function H(e) {
438
+ function V(e) {
436
439
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
437
440
  }
438
- function le(e, t, n, r, i, a, o, s) {
441
+ function H(e, t, n, r, i, a, o, s) {
439
442
  let c = "", l = 0;
440
- return c += ue(t, i, n, l, o, s), l += 30, c += de(e, r, l, s), l += 40, c += fe(e, l, a), c;
443
+ return c += ue(t, i, n, l, o, s), l += 30, c += de(e, r, l, s), l += 40, c += U(e, l, a), c;
441
444
  }
442
445
  function ue(e, t, n, r, i, a) {
443
- let o = i && n > 0 ? `满分: ${n} 分` : "", s = o ? `<span class="swed-score" data-region="score">${H(o)}</span>` : "", { contentWidth: c, contentX: l } = e, u = a === "edit";
446
+ let o = i && n > 0 ? `满分: ${n} 分` : "", s = o ? `<span class="swed-score" data-region="score">${V(o)}</span>` : "", { contentWidth: c, contentX: l } = e, u = a === "edit";
444
447
  return ` <foreignObject class="swed-header-block swed-header-block--school-info" transform="translate(${l}, ${r})" width="${c}" height="30" data-region="header-desc" opacity="1">
445
448
  <div class="swed-header-school-info">
446
- <div contenteditable="${u ? "true" : "false"}" class="swed-headerDesc${u ? " swed-editable-dashed" : ""}" data-editable="schoolName">${H(t)}</div>
449
+ <div contenteditable="${u ? "true" : "false"}" class="swed-headerDesc${u ? " swed-editable-dashed" : ""}" data-editable="schoolName">${V(t)}</div>
447
450
  ${s}
448
451
  </div>
449
452
  </foreignObject>\n`;
@@ -453,13 +456,13 @@ function de(e, t, n, r) {
453
456
  return ` <foreignObject class="swed-header-block swed-header-block--paper-name" transform="translate(${a}, ${n})" width="${i}" height="40" data-region="paper-name" opacity="1">
454
457
  <div class="swed-header-paper-name">
455
458
  <div class="swed-input-box">
456
- <label class="swed-input-box__label">${H(t)}</label>
457
- <div class="swed-input-box__input swed-textarea${o ? " swed-editable-dashed" : ""}" id="paperName" contenteditable="${o ? "true" : "false"}" data-editable="paperName">${H(t)}</div>
459
+ <label class="swed-input-box__label">${V(t)}</label>
460
+ <div class="swed-input-box__input swed-textarea${o ? " swed-editable-dashed" : ""}" id="paperName" contenteditable="${o ? "true" : "false"}" data-editable="paperName">${V(t)}</div>
458
461
  </div>
459
462
  </div>
460
463
  </foreignObject>\n`;
461
464
  }
462
- function fe(e, t, n) {
465
+ function U(e, t, n) {
463
466
  let { contentWidth: r, contentX: i } = e;
464
467
  return ` <foreignObject class="swed-header-block swed-header-block--student-info" transform="translate(${i}, ${t})" width="${r}" height="100" opacity="1">
465
468
  <div class="swed-header-student-info">
@@ -471,24 +474,24 @@ function fe(e, t, n) {
471
474
  <div class="swed-student-field" data-region="student-name"><span class="swed-label">姓名:</span><div class="swed-underline swed-studentName"></div></div>
472
475
  <div class="swed-student-field" data-region="student-class"><span class="swed-label">班级:</span><div class="swed-underline swed-clazzName"></div></div>
473
476
  </div>
474
- <div class="swed-student-code" data-region="student-code">准考证号: <table student-code-num="8" class="swed-student-code-table studyNo"><tbody><tr>${"<td class=\"swed-student-code-cell\"></td>".repeat(8)}</tr></tbody></table></div>
477
+ <div class="swed-student-code"><span data-region="student-code">准考证号: <table student-code-num="8" class="swed-student-code-table studyNo"><tbody><tr>${"<td class=\"swed-student-code-cell\"></td>".repeat(8)}</tr></tbody></table></span><div class="swed-student-code-filler" data-region="student-code-filler"></div></div>
475
478
  </div>
476
479
  </div>
477
480
  </foreignObject>\n`;
478
481
  }
479
- function pe(e, t, n, r, i, a) {
480
- let o = i && t > 0 ? `满分: ${t} 分` : "", s = o ? `<span class="swed-score" data-region="score">${H(o)}</span>` : "", { contentWidth: c, contentX: l } = e, u = a === "edit";
481
- return ` <foreignObject transform="translate(${l}, 0)" width="30" height="30" opacity="1">\n <img src="${r || "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Crect width='30' height='30' fill='%23ddd'/%3E%3Ctext x='15' y='20' text-anchor='middle' font-size='8' fill='%23999'%3EQR%3C/text%3E%3C/svg%3E"}" style="width:30px;height:30px;border:1px solid #000;display:block;" />\n </foreignObject>\n <foreignObject class="swed-header-block swed-header-block--school-info" transform="translate(${l + 30 + 5}, 0)" width="${c - 30 - 5}" height="30" opacity="1">\n <div class="swed-header-school-info swed-header-school-info--simple">\n <div contenteditable="${u ? "true" : "false"}" class="swed-headerDesc${u ? " swed-editable-dashed" : ""}" data-editable="schoolName" data-region="header-desc">${H(n)}</div>\n ${s}\n </div>\n </foreignObject>\n`;
482
+ function fe(e, t, n, r, i, a) {
483
+ let o = i && t > 0 ? `满分: ${t} 分` : "", s = o ? `<span class="swed-score" data-region="score">${V(o)}</span>` : "", { contentWidth: c, contentX: l } = e, u = a === "edit";
484
+ return ` <foreignObject transform="translate(${l}, 0)" width="30" height="30" opacity="1">\n <img src="${r || "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Crect width='30' height='30' fill='%23ddd'/%3E%3Ctext x='15' y='20' text-anchor='middle' font-size='8' fill='%23999'%3EQR%3C/text%3E%3C/svg%3E"}" style="width:30px;height:30px;border:1px solid #000;display:block;" />\n </foreignObject>\n <foreignObject class="swed-header-block swed-header-block--school-info" transform="translate(${l + 30 + 5}, 0)" width="${c - 30 - 5}" height="30" opacity="1">\n <div class="swed-header-school-info swed-header-school-info--simple">\n <div contenteditable="${u ? "true" : "false"}" class="swed-headerDesc${u ? " swed-editable-dashed" : ""}" data-editable="schoolName" data-region="header-desc">${V(n)}</div>\n ${s}\n </div>\n </foreignObject>\n`;
482
485
  }
483
- function me() {
486
+ function pe() {
484
487
  return " <foreignObject class=\"swed-vueplug\" transform=\"translate(0, 0)\" width=\"681\" height=\"50\">\n <div class=\"swed-tail-time-wrapper\">\n <div class=\"swed-answer-wrapper\" style=\"display:none;\">\n <div class=\"swed-tail-col\"><p class=\"swed-text\">作答时长</p><p class=\"swed-text swed-text-second\">请在框内填涂</p></div>\n <div class=\"swed-tail-col swed-center-col\">\n <i class=\"swed-el-icon swed-tail-label swed-triangle\"><svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\" style=\"width:14px;height:14px;\"><path fill=\"currentColor\" d=\"M384 192v640l384-320.064z\"></path></svg></i>\n <div class=\"swed-rect swed-rect-fill swed-text-second\"></div>\n </div>\n <div class=\"swed-tail-col swed-center-col swed-tail-col-item\"><p class=\"swed-tail-label swed-text\">10分钟以内</p><div class=\"swed-rect swed-rect-stroke swed-text-second swed-tail-time\" time=\"0\"></div></div>\n <div class=\"swed-tail-col swed-center-col swed-tail-col-item\"><p class=\"swed-tail-label swed-text\">10-20分钟</p><div class=\"swed-rect swed-rect-stroke swed-text-second swed-tail-time\" time=\"10\"></div></div>\n <div class=\"swed-tail-col swed-center-col swed-tail-col-item\"><p class=\"swed-tail-label swed-text\">20-30分钟</p><div class=\"swed-rect swed-rect-stroke swed-text-second swed-tail-time\" time=\"20\"></div></div>\n <div class=\"swed-tail-col swed-center-col swed-tail-col-item\"><p class=\"swed-tail-label swed-text\">&gt;30分钟</p><div class=\"swed-rect swed-rect-stroke swed-text-second swed-tail-time\" time=\"30\"></div></div>\n </div>\n <div class=\"swed-tail-col swed-revise-wrapper\" style=\"display:none;\">\n <p class=\"swed-text\">订正情况</p>\n <i class=\"swed-el-icon swed-triangle\" style=\"font-size:14px;margin:0 8px;\"><svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\" style=\"width:14px;height:14px;\"><path fill=\"currentColor\" d=\"M384 192v640l384-320.064z\"></path></svg></i>\n <div class=\"swed-revise-area swed-center-col\"><p class=\"swed-revise-area-label\">已订正</p><div class=\"swed-revise-area-rect\"></div></div>\n </div>\n </div>\n </foreignObject>\n";
485
488
  }
486
- function he() {
489
+ function me() {
487
490
  return "<defs>\n<polygon id=\"break\" fill=\"#6B8AB8\" points=\"12 0 12 60 0 52 15.5 90 30 52 18 60 18 0\"></polygon>\n<polygon id=\"enter\" fill=\"#6B8AB8\" points=\"44 0 52 0 52 45 16 45 29 62 25.5 66 0 41 25.5 17 29 20.5 16 37 44 37\"></polygon>\n</defs>\n";
488
491
  }
489
492
  //#endregion
490
493
  //#region src/engine/svg/optionsRenderer.ts
491
- function U(e, t, n, r, i) {
494
+ function he(e, t, n, r, i) {
492
495
  let a = t - 20, o = ` <g class="swed-option" transform="translate(0, ${n})">\n`, s = e.map((e) => ge(e, 20, a)), c = e.map((e) => e.paragraphs.reduce((e, t) => e + (t.height || 26), 0)), l = e.length, u = Math.max(...s);
493
496
  if (l > 0 && u * l <= t) {
494
497
  let n = t / l, a = n - 20;
@@ -496,7 +499,7 @@ function U(e, t, n, r, i) {
496
499
  let s = n * t;
497
500
  o += ` <g class="swed-option-item" transform="translate(${s}, 0)">\n`;
498
501
  let c = e[t].paragraphs[0]?.lines[0]?.baseline || r * 1.56;
499
- o += ` <text class="swed-text" xml:space="preserve" font-size="${r}" font-weight="normal" font-family="Times New Roman" font-style="normal" fill="#000000" fill-opacity="1" y="${c.toFixed(3)}">${H(e[t].label)}.</text>\n`, o += " <g>\n";
502
+ o += ` <text class="swed-text" xml:space="preserve" font-size="${r}" font-weight="normal" font-family="Times New Roman" font-style="normal" fill="#000000" fill-opacity="1" y="${c.toFixed(3)}">${V(e[t].label)}.</text>\n`, o += " <g>\n";
500
503
  let l = 0;
501
504
  for (let n of e[t].paragraphs) o += be(n, a, l, !1, "", r, i, 20), l += n.height || 26;
502
505
  o += " </g>\n", o += " </g>\n";
@@ -507,7 +510,7 @@ function U(e, t, n, r, i) {
507
510
  for (let t = 0; t < l; t++) {
508
511
  o += ` <g class="swed-option-item" transform="translate(0, ${d})">\n`;
509
512
  let n = e[t].paragraphs[0]?.lines[0]?.baseline || r * 1.56;
510
- o += ` <text class="swed-text" xml:space="preserve" font-size="${r}" font-weight="normal" font-family="Times New Roman" font-style="normal" fill="#000000" fill-opacity="1" y="${n.toFixed(3)}">${H(e[t].label)}.</text>\n`, o += " <g>\n";
513
+ o += ` <text class="swed-text" xml:space="preserve" font-size="${r}" font-weight="normal" font-family="Times New Roman" font-style="normal" fill="#000000" fill-opacity="1" y="${n.toFixed(3)}">${V(e[t].label)}.</text>\n`, o += " <g>\n";
511
514
  let s = 0;
512
515
  for (let n of e[t].paragraphs) o += be(n, a, s, !1, "", r, i, 20), s += n.height || 26;
513
516
  o += " </g>\n", o += " </g>\n", d += c[t];
@@ -523,20 +526,20 @@ function ge(e, t, n) {
523
526
  }
524
527
  return t + Math.min(r, n);
525
528
  }
526
- function W(e, t) {
529
+ function _e(e, t) {
527
530
  if (e.length === 0) return 0;
528
531
  let n = e.map((e) => ge(e, 20, t)), r = e.map((e) => e.paragraphs.reduce((e, t) => e + (t.height || 26), 0)), i = e.length;
529
532
  return Math.max(...n) * i <= t ? Math.max(...r) : r.reduce((e, t) => e + t, 0);
530
533
  }
531
534
  //#endregion
532
535
  //#region src/engine/svg/questionRenderer.ts
533
- function _e(e, t) {
536
+ function ve(e, t) {
534
537
  return e.baseline > 0 ? e.baseline : t * 1.56;
535
538
  }
536
- function ve(e, t, n, r, i, a, o, s, c, l) {
539
+ function W(e, t, n, r, i, a, o, s, c, l) {
537
540
  let u = t.metadata?.topicId || t.id, d = e.width || 333.5, f = e.height || 100, p = "";
538
- r && (p += ` <rect x="0.5" y="${n - .5}" width="${d}" height="${f}" fill="none" stroke="rgba(85,165,255,0.4)" stroke-width="0.5" stroke-dasharray="4,4" />\n`), i && l === "edit" && (p += ` <rect x="0" y="${n - 1}" width="${d + 2}" height="${f + 2}" fill="none" stroke="#409eff" stroke-width="1.5" rx="2" />\n`), p += ` <g class="swed-question" transform="translate(0, ${n})" topicid="${u}" data-block-id="${t.id}">\n`;
539
- let m = t.type === "question" && t.metadata?.questionNo || "", h = t.paragraphs[0]?.lines[0], g = h ? _e(h, s) : 20, _ = 0;
541
+ r && (p += ` <rect x="0.5" y="${n - .5}" width="${d}" height="${f}" fill="none" stroke="rgba(85,165,255,0.4)" stroke-width="0.5" stroke-dasharray="4,4" />\n`), p += ` <g class="swed-question" transform="translate(0, ${n})" topicid="${u}" data-block-id="${t.id}">\n`;
542
+ let m = t.type === "question" && t.metadata?.questionNo || "", h = t.paragraphs[0]?.lines[0], g = h ? ve(h, s) : 20, _ = 0;
540
543
  t.type === "question" ? _ = m.length > 2 ? 26.25 : 17.5 : t.type === "sub-question" && (_ = 26.25);
541
544
  let v = e.paragraphStart, y = Math.min(v + e.paragraphCount, t.paragraphs.length), b = 0;
542
545
  for (let e = v; e < y; e++) {
@@ -544,7 +547,7 @@ function ve(e, t, n, r, i, a, o, s, c, l) {
544
547
  b += n.height || n.lines.reduce((e, t) => e + t.lineHeight, 0) || 26;
545
548
  }
546
549
  let x = 0;
547
- t.options && t.options.length > 0 && o && (x = W(t.options, d - _), b += x);
550
+ t.options && t.options.length > 0 && o && (x = _e(t.options, d - _), b += x);
548
551
  let S = Math.max(b, e.height), C = (t.type === "question" || t.type === "sub-question") && e.paragraphCount > 0;
549
552
  C && l === "edit" && (p += ` <rect class="swed-question-hitarea" x="0" y="0" width="${d}" height="${S}" fill="transparent" />\n`), p += " <g>\n", p += ` <g class="swed-question-stem" transform="translate(${_}, 0)">\n`;
550
553
  let w = a && c && t.metadata?.score || "", T = 0, E = !1;
@@ -554,15 +557,15 @@ function ve(e, t, n, r, i, a, o, s, c, l) {
554
557
  }
555
558
  if (t.options && t.options.length > 0 && o) {
556
559
  let e = d - _;
557
- p += U(t.options, e, T, s, l), T += x;
560
+ p += he(t.options, e, T, s, l), T += x;
558
561
  }
559
562
  if (p += " </g>\n", p += " </g>\n", C && l === "edit" && (p += ` <path class="swed-question-border" d="M 0.5 0 L ${d - .5} 0 L ${d - .5} ${S} L 0.5 ${S} Z" stroke="#231815" stroke-dasharray="2,5" transform="translate(0.5, 0)" stroke-width="0.5" fill="none" pointer-events="none"></path>\n`), a) {
560
563
  if (m) {
561
564
  let e = m.length > 2;
562
- p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(0, ${g.toFixed(2)})" x="4">${H(m)}</text>\n`, e ? p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(20.25, ${g.toFixed(2)})"></text>\n` : p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(11.5, ${g.toFixed(2)})"></text>\n`;
565
+ p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(0, ${g.toFixed(2)})" x="4">${V(m)}</text>\n`, e ? p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(20.25, ${g.toFixed(2)})"></text>\n` : p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(11.5, ${g.toFixed(2)})"></text>\n`;
563
566
  }
564
567
  let e = t.metadata?.subLabel || "";
565
- e && (p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(4, ${g.toFixed(2)})">${H(e)}</text>\n`, p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(20.25, ${g.toFixed(2)})"></text>\n`);
568
+ e && (p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(4, ${g.toFixed(2)})">${V(e)}</text>\n`, p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(20.25, ${g.toFixed(2)})"></text>\n`);
566
569
  }
567
570
  return p += " </g>\n", p;
568
571
  }
@@ -570,10 +573,10 @@ function ye(e, t, n, r = 0, i = !0, a = !1, o = "edit") {
570
573
  let s = e.metadata?.label || "", c = e.height || 40;
571
574
  if (!s) return "";
572
575
  let l = i && e.metadata?.score || "", u = "";
573
- return a && o === "edit" && (u += ` <rect x="${r}" y="${t}" width="${n.toFixed(1)}" height="${c}" fill="none" stroke="#409eff" stroke-width="1.5" rx="2" />\n`), u += ` <foreignObject class="swed-vueplug" data-block-id="${e.id}" transform="translate(${r}, ${t})" width="${n.toFixed(1)}" height="${c}" rendered="true" opacity="1">\n <div class="swed-title_wrapper" topictitle="${H(s)}" topicgroupinfo="">
576
+ return a && o === "edit" && (u += ` <rect x="${r}" y="${t}" width="${n.toFixed(1)}" height="${c}" fill="none" stroke="#409eff" stroke-width="1.5" rx="2" />\n`), u += ` <foreignObject class="swed-vueplug" data-block-id="${e.id}" transform="translate(${r}, ${t})" width="${n.toFixed(1)}" height="${c}" rendered="true" opacity="1">\n <div class="swed-title_wrapper" topictitle="${V(s)}" topicgroupinfo="">
574
577
  <div class="swed-title-content">
575
- <span class="swed-title-text">${H(s)}</span>
576
- ${l ? `<span class="swed-title-score">(${H(l)})</span>` : ""}
578
+ <span class="swed-title-text">${V(s)}</span>
579
+ ${l ? `<span class="swed-title-score">(${V(l)})</span>` : ""}
577
580
  </div>
578
581
  </div>
579
582
  </foreignObject>\n`, u;
@@ -581,12 +584,12 @@ function ye(e, t, n, r = 0, i = !0, a = !1, o = "edit") {
581
584
  function be(e, t, n, r, i = "", a, o, s = 0) {
582
585
  let c = "", l = 0;
583
586
  for (let n = 0; n < e.lines.length; n++) {
584
- let s = e.lines[n], u = _e(s, a), d = r && n === 0, f = s.elements.length > 0 && s.elements.every((e) => e.type === "enter"), p = s.lineHeight;
587
+ let s = e.lines[n], u = ve(s, a), d = r && n === 0, f = s.elements.length > 0 && s.elements.every((e) => e.type === "enter"), p = s.lineHeight;
585
588
  c += ` <g class="swed-line" transform="translate(0, ${l})" baseline="${u.toFixed(2)}">\n`;
586
589
  let m = 0;
587
590
  if (d && i) {
588
591
  let e = `(${i}分)`, t = u - a;
589
- c += ` <text class="swed-question-score" font-size="${a}" font-weight="normal" font-family="SimSun, STSong, serif" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(0, ${t.toFixed(2)})" y="${a}">${H(e)}</text>\n`, m += oe(e, a, "SimSun, STSong, serif");
592
+ c += ` <text class="swed-question-score" font-size="${a}" font-weight="normal" font-family="SimSun, STSong, serif" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(0, ${t.toFixed(2)})" y="${a}">${V(e)}</text>\n`, m += se(e, a, "SimSun, STSong, serif");
590
593
  }
591
594
  if (f) {
592
595
  if (o === "edit") {
@@ -600,7 +603,7 @@ function be(e, t, n, r, i = "", a, o, s = 0) {
600
603
  e.justification === "center" ? r = Math.max(0, (i - n) / 2) : e.justification === "right" && (r = Math.max(0, i - n));
601
604
  }
602
605
  let i = s.elements.length > 0 && s.elements.every((e) => e.type === "image");
603
- for (let e of s.elements) c += xe(e, m + r + (s.offsetX || 0), u, s.lineHeight, f, o, e.type === "image" ? e.id : void 0, e.type === "image" ? i : void 0), m += e.width;
606
+ for (let e of s.elements) c += xe(e, m + r + (s.offsetX || 0), u, s.lineHeight, f, o, a, e.type === "image" ? e.id : void 0, e.type === "image" ? i : void 0), m += e.width;
604
607
  if (o === "edit" && n === e.lines.length - 1) {
605
608
  let e = m + r + (s.offsetX || 0) + 2;
606
609
  c += ` <g class="swed-enter" transform="translate(${e.toFixed(2)}, ${(u - 10).toFixed(2)})">\n`, c += " <use href=\"#enter\" transform=\"scale(0.013)\" fill=\"#c8c8c8\" opacity=\"0.5\"></use>\n", c += " </g>\n";
@@ -610,19 +613,19 @@ function be(e, t, n, r, i = "", a, o, s = 0) {
610
613
  }
611
614
  return ` <g class="swed-paragraph" transform="translate(${s}, ${n})">\n${c} </g>\n`;
612
615
  }
613
- function xe(e, t, n, r, i, a, o, s) {
616
+ function xe(e, t, n, r, i, a, o, s, c) {
614
617
  switch (e.type) {
615
618
  case "text": {
616
- let r = e, i = r.italic ? "italic" : "normal", a = r.bold ? "bold" : "normal", o = n + (r.verticalAlign || 0), s = r.value.split(""), c = r.xPositions.length === s.length ? r.xPositions.map((e) => (e + t).toFixed(2)).join(" ") : V(r.value, r.fontSize, r.fontFamily, r.bold, r.italic).map((e) => (e + t).toFixed(2)).join(" "), l = "";
619
+ let r = e, i = r.italic ? "italic" : "normal", a = r.bold ? "bold" : "normal", o = n + (r.verticalAlign || 0), s = r.value.split(""), c = r.xPositions.length === s.length ? r.xPositions.map((e) => (e + t).toFixed(2)).join(" ") : B(r.value, r.fontSize, r.fontFamily, r.bold, r.italic).map((e) => (e + t).toFixed(2)).join(" "), l = "";
617
620
  if (r.backgroundColor) {
618
621
  let e = o + r.fontSize * .1, n = r.fontSize * 1.1;
619
622
  l += ` <rect x="${t.toFixed(2)}" y="${e.toFixed(2)}" width="${r.width.toFixed(2)}" height="${n.toFixed(2)}" fill="${r.backgroundColor}" fill-opacity="0.3"></rect>\n`;
620
623
  }
621
- let u = r.italic ? -r.fontSize * .02 : 0, d = r.fontFamily ? H(r.fontFamily) : "&quot;Times New Roman&quot;, SimSun";
622
- if (l += ` <text class="swed-text" xml:space="preserve" font-size="${r.fontSize}" font-weight="${a}" font-family="${d}" font-style="${i}" fill="${r.color}" fill-opacity="1" x="${c}" y="${(o + u).toFixed(2)}" dominant-baseline="hanging">${H(r.value)}</text>\n`, r.dotAbove) {
624
+ let u = r.italic ? -r.fontSize * .02 : 0, d = r.fontFamily ? V(r.fontFamily) : "&quot;Times New Roman&quot;, SimSun";
625
+ if (l += ` <text class="swed-text" xml:space="preserve" font-size="${r.fontSize}" font-weight="${a}" font-family="${d}" font-style="${i}" fill="${r.color}" fill-opacity="1" x="${c}" y="${(o + u).toFixed(2)}" dominant-baseline="hanging">${V(r.value)}</text>\n`, r.dotAbove) {
623
626
  let e = Math.max(1.5, r.fontSize * .1), n = o + r.fontSize * .9 + e;
624
627
  for (let i = 0; i < s.length; i++) {
625
- let a = r.xPositions.length === s.length ? r.xPositions[i] + t + B(s[i], r.fontSize, r.fontFamily, r.bold, r.italic) / 2 : t + i * r.fontSize * .6 + r.fontSize * .3;
628
+ let a = r.xPositions.length === s.length ? r.xPositions[i] + t + z(s[i], r.fontSize, r.fontFamily, r.bold, r.italic) / 2 : t + i * r.fontSize * .6 + r.fontSize * .3;
626
629
  l += ` <circle cx="${a.toFixed(2)}" cy="${n.toFixed(2)}" r="${e.toFixed(2)}" fill="${r.color}"></circle>\n`;
627
630
  }
628
631
  }
@@ -639,19 +642,24 @@ function xe(e, t, n, r, i, a, o, s) {
639
642
  l += ` <line x1="${t.toFixed(2)}" y1="${e.toFixed(2)}" x2="${(t + r.width).toFixed(2)}" y2="${e.toFixed(2)}" style="stroke:${r.color};stroke-width:0.8"></line>\n`;
640
643
  }
641
644
  if (r.strikethrough) {
642
- let e = o + se(r.value, r.fontSize, r.fontFamily, r.bold, r.italic).ascent * .5;
645
+ let e = o + ce(r.value, r.fontSize, r.fontFamily, r.bold, r.italic).ascent * .5;
643
646
  l += ` <line x1="${t.toFixed(2)}" y1="${e.toFixed(2)}" x2="${(t + r.width).toFixed(2)}" y2="${e.toFixed(2)}" style="stroke:${r.color};stroke-width:0.8"></line>\n`;
644
647
  }
645
648
  return l;
646
649
  }
647
650
  case "formula": {
648
- let r = e, i = r.svgContent.match(/vertical-align:\s*([-\d.]+)ex/), a = i ? parseFloat(i[1]) * 7 : -(r.height || 20), o = Math.round(n + a);
651
+ let r = e, i = r.svgContent.match(/vertical-align:\s*([-\d.]+)(px|ex)/), a;
652
+ if (i) {
653
+ let e = parseFloat(i[1]);
654
+ a = i[2] === "ex" ? e * 7 : e;
655
+ } else a = -(r.height || 20);
656
+ let o = Math.round(n + a);
649
657
  return ` <g class="swed-formula" transform="translate(${t.toFixed(2)}, ${o})">\n${r.svgContent} </g>\n`;
650
658
  }
651
659
  case "underline": {
652
660
  let r = e, i = (n - 30 / 2).toFixed(2), o = 30 .toFixed(2), s = r.topicId ? ` topicid="${r.topicId}" real-index="${r.realIndex ?? 0}" id="${r.topicId}-${r.realIndex ?? 0}"` : "", c = r.id ? ` data-underline-id="${r.id}"` : "", l = r.blankType ? ` data-blank-type="${r.blankType}"` : "", u = a === "edit" ? `<rect class="swed-underline-hitarea" x="0" y="0" width="${r.width.toFixed(2)}" height="30" fill="transparent" opacity="0"></rect>\n` : "", d = (r.isEmpty || !!r.blankType) && !r.isSplitPart, f = !r.blankType || r.blankType === "tiankong";
653
661
  if (d) {
654
- let e = (42 / 2).toFixed(2), n = a === "edit" ? `<rect x="0" y="0" width="${r.width.toFixed(2)}" height="30" fill="rgb(245,245,245)" opacity="1"></rect>\n` : "", d = a === "edit" ? `<text font-size="12" text-anchor="middle" font-family="'Times New Roman',SimSun,STSong" fill="#aaa" fill-opacity="1" x="${(r.width / 2).toFixed(2)}" y="${e}">${H(r.placeholder)}</text>\n` : "";
662
+ let e = (42 / 2).toFixed(2), n = a === "edit" ? `<rect x="0" y="0" width="${r.width.toFixed(2)}" height="30" fill="rgb(245,245,245)" opacity="1"></rect>\n` : "", d = a === "edit" ? `<text font-size="12" text-anchor="middle" font-family="'Times New Roman',SimSun,STSong" fill="#aaa" fill-opacity="1" x="${(r.width / 2).toFixed(2)}" y="${e}">${V(r.placeholder)}</text>\n` : "";
655
663
  return ` <g class="swed-underline" transform="translate(${t.toFixed(2)}, ${i})"${s}${c}${l}>\n ${u} ${n} ${d}` + (f ? ` <line x1="2" y1="${o}" x2="${(r.width - 2).toFixed(2)}" y2="${o}" style="stroke:#000;stroke-width:0.7"></line>\n` : "") + " </g>\n";
656
664
  }
657
665
  if (r.isSplitPart && (r.isEmpty || r.blankType) && a === "edit") {
@@ -663,11 +671,11 @@ function xe(e, t, n, r, i, a, o, s) {
663
671
  case "image": {
664
672
  let r = e;
665
673
  if (r.rawHtml && !r.src) {
666
- let e = o ? ` data-image-id="${o}"` : "", i = (r.width / 2).toFixed(2), a = (r.height / 2).toFixed(2), c = s ? "0" : (n - r.height / 2).toFixed(2);
667
- return ` <g class="swed-image swed-image-placeholder" transform="translate(${t.toFixed(2)}, ${c})"${e}>\n <rect x="0" y="0" width="${r.width}" height="${r.height}" fill="#f5f5f5" stroke="#999" stroke-width="1" stroke-dasharray="4,3" rx="4" ry="4" />\n <text x="${i}" y="${a}" text-anchor="middle" dominant-baseline="central" font-size="13" fill="#999">[表格加载中…]</text>\n </g>\n`;
674
+ let e = s ? ` data-image-id="${s}"` : "", i = (r.width / 2).toFixed(2), a = (r.height / 2).toFixed(2), o = c ? "0" : (n - r.height / 2).toFixed(2);
675
+ return ` <g class="swed-image swed-image-placeholder" transform="translate(${t.toFixed(2)}, ${o})"${e}>\n <rect x="0" y="0" width="${r.width}" height="${r.height}" fill="#f5f5f5" stroke="#999" stroke-width="1" stroke-dasharray="4,3" rx="4" ry="4" />\n <text x="${i}" y="${a}" text-anchor="middle" dominant-baseline="central" font-size="13" fill="#999">[表格加载中…]</text>\n </g>\n`;
668
676
  }
669
- let i = s ? "0" : (n - r.height / 2).toFixed(2), c = o ? ` data-image-id="${o}"` : "", l = a === "edit" ? " style=\"cursor:move\"" : "";
670
- return ` <g class="swed-image" transform="translate(${t.toFixed(2)}, ${i})"${c}${l}>\n <image href="${r.src}" width="${r.width}" height="${r.height}" preserveAspectRatio="xMidYMid meet" />\n </g>\n`;
677
+ let i = c ? "0" : (n - r.height / 2).toFixed(2), o = s ? ` data-image-id="${s}"` : "", l = a === "edit" ? " style=\"cursor:move\"" : "";
678
+ return ` <g class="swed-image" transform="translate(${t.toFixed(2)}, ${i})"${o}${l}>\n <image href="${r.src}" width="${r.width}" height="${r.height}" preserveAspectRatio="xMidYMid meet" />\n </g>\n`;
671
679
  }
672
680
  case "enter": {
673
681
  let r = e, i = .013;
@@ -719,7 +727,7 @@ var Se = class {
719
727
  renderAllPages(e, t, n, r) {
720
728
  if (e.length === 0) return "";
721
729
  let { showBBoxes: i = !1, selectedBlockId: a = null, totalScore: o = 0, paperName: s = "", qrCodeImage: c = "", qrCodeImages: l } = r || {}, u = e[0].width, d = e[0].height, f = e.length * d, p = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${u}" height="${f}" viewBox="0 0 ${u} ${f}">\n`;
722
- p += he();
730
+ p += me();
723
731
  for (let r = 0; r < e.length; r++) {
724
732
  let u = e[r], f = r % 2 == 0 ? n.bodyTopEven ?? 173 : n.bodyTopOdd ?? 50, m = r * d;
725
733
  p += `<g class="swed-page" transform="translate(0, ${m})">\n`, p += this.renderPageContent(u, t, f, n, r, e.length, {
@@ -740,7 +748,7 @@ var Se = class {
740
748
  paperName: ""
741
749
  }, a = 1, o = !0) {
742
750
  let { totalScore: s = 0, paperName: c = "", schoolName: l = "", qrCodeImage: u = "", qrCodeImages: d } = i, f = "";
743
- return o && (f += he()), f += this.renderPageContent(e, t, n, r, e.index, a, {
751
+ return o && (f += me()), f += this.renderPageContent(e, t, n, r, e.index, a, {
744
752
  ...i,
745
753
  totalScore: s,
746
754
  paperName: c,
@@ -755,7 +763,7 @@ var Se = class {
755
763
  55.5,
756
764
  56,
757
765
  56
758
- ], l = c, u = e.width - l - o, d = r.columnGap ?? 15.5, f = r.columns || 1, p = f > 1 ? (u - d * (f - 1)) / f : u, m = e.height - s - this.FOOTER_EXTRA_GAP, h = typeof r.fontSize == "number" ? r.fontSize : 14, g = [], _ = this.groupBlocksByColumn(e.blocks);
766
+ ], l = c, u = e.width - l - o, d = r.columnGap ?? 15.5, f = r.columns || 1, p = f > 1 ? (u - d * (f - 1)) / f : u, m = e.height - s - this.FOOTER_EXTRA_GAP, h = typeof r.fontSize == "number" ? r.fontSize : 16, g = [], _ = this.groupBlocksByColumn(e.blocks);
759
767
  for (let e = 0; e < _.length; e++) for (let r of _[e]) {
760
768
  let e = t.find((e) => e.id === r.blockId);
761
769
  if (!e) continue;
@@ -763,7 +771,7 @@ var Se = class {
763
771
  if (e.type === "title") {
764
772
  g.push({
765
773
  type: "title-embed",
766
- bbox: F(i, a, r.width || p, e.height || 40),
774
+ bbox: P(i, a, r.width || p, e.height || 40),
767
775
  meta: { label: e.metadata?.label }
768
776
  });
769
777
  continue;
@@ -776,25 +784,25 @@ var Se = class {
776
784
  let u = o + r.paragraphCount >= e.paragraphs.length;
777
785
  if (e.options && e.options.length > 0 && u) {
778
786
  let t = r.width || p, n = e.type === "question" && e.metadata?.questionNo || "", i = e.type === "question" ? n.length > 2 ? 26.25 : 17.5 : 26.25;
779
- c += W(e.options, t - i);
787
+ c += _e(e.options, t - i);
780
788
  }
781
789
  let d = Math.max(c, r.height);
782
790
  g.push({
783
791
  type: "question-border",
784
- bbox: F(i, a, r.width, d),
792
+ bbox: P(i, a, r.width, d),
785
793
  meta: {
786
794
  blockId: r.blockId,
787
795
  blockType: r.blockType
788
796
  }
789
797
  });
790
798
  }
791
- if (_.length > 1) {
799
+ if (f > 1) {
792
800
  let e = m - n;
793
- for (let t = 1; t < _.length; t++) {
801
+ for (let t = 1; t < f; t++) {
794
802
  let r = t * (p + d) - d / 2;
795
803
  g.push({
796
804
  type: "column-separator",
797
- bbox: F(c + r, n, .5, e)
805
+ bbox: P(c + r, n, .5, e)
798
806
  });
799
807
  }
800
808
  }
@@ -810,12 +818,12 @@ var Se = class {
810
818
  }
811
819
  let a = 0, l = !p && u === 0;
812
820
  for (let t of n.lines) {
813
- let u = _e(t, h), d = 0;
821
+ let u = ve(t, h), d = 0;
814
822
  if (l && r.showScore && !p) {
815
823
  let t = e.metadata?.score || "";
816
824
  if (t) {
817
825
  let e = `(${t}分)`;
818
- d += oe(e, h, "SimSun, STSong, serif");
826
+ d += se(e, h, "SimSun, STSong, serif");
819
827
  }
820
828
  p = !0, l = !1;
821
829
  }
@@ -829,7 +837,7 @@ var Se = class {
829
837
  let n = e;
830
838
  g.push({
831
839
  type: "underline",
832
- bbox: F(s + m + (t.offsetX || 0) + d, c + f + a + u - 30 / 2, n.width, 30),
840
+ bbox: P(s + m + (t.offsetX || 0) + d, c + f + a + u - 30 / 2, n.width, 30),
833
841
  meta: {
834
842
  placeholder: n.placeholder,
835
843
  isEmpty: n.isEmpty,
@@ -864,12 +872,12 @@ var Se = class {
864
872
  let t = e.getAttribute("data-region"), r = e.getBoundingClientRect();
865
873
  n.push({
866
874
  type: t,
867
- bbox: F((r.left - a.left) * c, (r.top - a.top) * l, r.width * c, r.height * l)
875
+ bbox: P((r.left - a.left) * c, (r.top - a.top) * l, r.width * c, r.height * l)
868
876
  });
869
877
  }
870
878
  }
871
879
  getOptionsHeight(e, t) {
872
- return W(e, t);
880
+ return _e(e, t);
873
881
  }
874
882
  renderPageContent(e, t, n, r, i, a, o) {
875
883
  let [s, c, l, u] = r.margins || [
@@ -877,16 +885,16 @@ var Se = class {
877
885
  55.5,
878
886
  56,
879
887
  56
880
- ], d = u, f = c, p = e.width - d - f, m = r.columnGap ?? 15.5, h = r.columns || 1, g = h > 1 ? (p - m * (h - 1)) / h : p, _ = e.height - l - this.FOOTER_EXTRA_GAP, v = r.fontSize, y = typeof v == "number" ? v : 14, b = "";
888
+ ], d = u, f = c, p = e.width - d - f, m = r.columnGap ?? 15.5, h = r.columns || 1, g = h > 1 ? (p - m * (h - 1)) / h : p, _ = e.height - l - this.FOOTER_EXTRA_GAP, v = r.fontSize, y = typeof v == "number" ? v : 16, b = "";
881
889
  b += " <g class=\"swed-background\"></g>\n";
882
890
  let x = o.qrCodeImages?.[i] || o.qrCodeImage || "", S = this.computeHeaderLayout(r, e), C = {
883
891
  mode: "portrait",
884
892
  contentWidth: p,
885
893
  contentX: 0
886
894
  };
887
- b += ` <g class="swed-header" transform="translate(${d}, ${r.headerTop ?? 18})">\n`, b += " <g class=\"swed-header-content\"></g>\n", b += " <g class=\"swed-header-embeds\">\n", i % 2 == 0 ? b += le(S, C, o.totalScore ?? 0, o.paperName || "", o.schoolName || "", x, r.showScore ?? !0, this.renderMode) : b += pe(C, o.totalScore ?? 0, o.schoolName || "", x, r.showScore ?? !0, this.renderMode), b += " </g>\n", b += " </g>\n", b += ` <g class="swed-footer" transform="translate(${d}, ${_.toFixed(2)})">\n`, b += " <g class=\"swed-footer-content\">\n", b += " <g class=\"swed-anchor\" transform=\"translate(0, 0)\"></g>\n", b += " <g class=\"swed-paragraph\" transform=\"translate(0, 0)\">\n", b += " <g class=\"swed-line\" transform=\"translate(0, 0)\" baseline=\"19.6\">\n";
895
+ b += ` <g class="swed-header" transform="translate(${d}, ${r.headerTop ?? 18})">\n`, b += " <g class=\"swed-header-content\"></g>\n", b += " <g class=\"swed-header-embeds\">\n", i % 2 == 0 ? b += H(S, C, o.totalScore ?? 0, o.paperName || "", o.schoolName || "", x, r.showScore ?? !0, this.renderMode) : b += fe(C, o.totalScore ?? 0, o.schoolName || "", x, r.showScore ?? !0, this.renderMode), b += " </g>\n", b += " </g>\n", b += ` <g class="swed-footer" transform="translate(${d}, ${_.toFixed(2)})">\n`, b += " <g class=\"swed-footer-content\">\n", b += " <g class=\"swed-anchor\" transform=\"translate(0, 0)\"></g>\n", b += " <g class=\"swed-paragraph\" transform=\"translate(0, 0)\">\n", b += " <g class=\"swed-line\" transform=\"translate(0, 0)\" baseline=\"19.6\">\n";
888
896
  let w = `${i + 1}/${a}`, T = p / 2 - w.length * 6, E = w.split("").map((e, t) => (T + t * 12).toFixed(2)).join(" ");
889
- b += ` <text class="swed-text" data-region="page-number" xml:space="preserve" font-size="12" font-weight="bold" font-family="&quot;Times New Roman&quot;, SimSun,'Cambria Math'" font-style="normal" fill="#898989" fill-opacity="1" x="${E}" y="19.6">${H(w)}</text>\n`, b += ` <line x1="0" y1="28.2" x2="${p.toFixed(2)}" y2="28.2" style="fill:#000;stroke-width:1;stroke:#000;" opacity="0"></line>\n`, b += " </g>\n", b += " </g>\n", b += " </g>\n", b += " <g class=\"swed-footer-embeds\">\n", b += me(), b += " </g>\n", b += " </g>\n", b += " <g class=\"swed-layout\">\n";
897
+ b += ` <text class="swed-text" data-region="page-number" xml:space="preserve" font-size="12" font-weight="bold" font-family="&quot;Times New Roman&quot;, SimSun,'Cambria Math'" font-style="normal" fill="#898989" fill-opacity="1" x="${E}" y="19.6">${V(w)}</text>\n`, b += ` <line x1="0" y1="28.2" x2="${p.toFixed(2)}" y2="28.2" style="fill:#000;stroke-width:1;stroke:#000;" opacity="0"></line>\n`, b += " </g>\n", b += " </g>\n", b += " </g>\n", b += " <g class=\"swed-footer-embeds\">\n", b += pe(), b += " </g>\n", b += " </g>\n", b += " <g class=\"swed-layout\">\n";
890
898
  for (let t of e.cornerMarks) b += this.renderCornerMark(t);
891
899
  b += " </g>\n", b += ` <g class="swed-body" transform="translate(${d}, ${n})">\n`, b += " <g class=\"swed-content\">\n", b += " <g class=\"swed-column\" transform=\"translate(0, 0)\">\n";
892
900
  let D = this.groupBlocksByColumn(e.blocks);
@@ -897,13 +905,13 @@ var Se = class {
897
905
  let e = t.find((e) => e.id === n.blockId);
898
906
  if (!e || e.type === "title") continue;
899
907
  let i = n.blockId === o.selectedBlockId, a = n.paragraphStart === 0, s = n.paragraphStart + n.paragraphCount >= e.paragraphs.length;
900
- b += ve(n, e, n.y, o.showBBoxes, i, a, s, y, r.showScore ?? !0, this.renderMode);
908
+ b += W(n, e, n.y, o.showBBoxes, i, a, s, y, r.showScore ?? !0, this.renderMode);
901
909
  }
902
910
  b += " </g>\n";
903
911
  }
904
- if (D.length > 1) {
912
+ if (h > 1) {
905
913
  let e = (_ - n).toFixed(1);
906
- for (let t = 1; t < D.length; t++) {
914
+ for (let t = 1; t < h; t++) {
907
915
  let n = t * (g + m) - m / 2;
908
916
  b += ` <path fill="none" stroke="#D1D3D4" stroke-width="0.5" stroke-dasharray="8,8" d="M ${n.toFixed(1)} 0 L ${n.toFixed(1)} ${e}"></path>\n`;
909
917
  }
@@ -939,13 +947,13 @@ function Te(e, t, n, r) {
939
947
  function Ee() {
940
948
  G.clear();
941
949
  }
942
- function K(e, t = 14, n = !1) {
950
+ function De(e, t = 14, n = !1) {
943
951
  let r = we(e, t, n);
944
952
  if (r) return r;
945
- let i = De(e, t, n);
953
+ let i = Oe(e, t, n);
946
954
  return Te(e, t, n, i), i;
947
955
  }
948
- function De(e, t = 14, n = !1) {
956
+ function Oe(e, t = 14, n = !1) {
949
957
  try {
950
958
  let r = window.MathJax;
951
959
  if (!r?.tex2svg) throw Error("MathJax 尚未加载完成");
@@ -970,22 +978,22 @@ function De(e, t = 14, n = !1) {
970
978
  };
971
979
  } catch {
972
980
  return {
973
- svg: `<svg xmlns="http://www.w3.org/2000/svg" width="50" height="20" viewBox="0 0 50 20"><text x="2" y="16" font-size="11" font-family="Times New Roman,serif" fill="#999">${Oe(e)}</text></svg>`,
981
+ svg: `<svg xmlns="http://www.w3.org/2000/svg" width="50" height="20" viewBox="0 0 50 20"><text x="2" y="16" font-size="11" font-family="Times New Roman,serif" fill="#999">${ke(e)}</text></svg>`,
974
982
  width: 50,
975
983
  height: 20
976
984
  };
977
985
  }
978
986
  }
979
- function Oe(e) {
987
+ function ke(e) {
980
988
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
981
989
  }
982
- var q = /* @__PURE__ */ new Map(), ke = 200;
983
- function Ae(e, t = 14, n = !1) {
990
+ var K = /* @__PURE__ */ new Map(), Ae = 200;
991
+ function je(e, t = 14, n = !1) {
984
992
  let r = e;
985
993
  try {
986
994
  r = decodeURIComponent(e);
987
995
  } catch {}
988
- let i = `${t}:${n}:${r}`, a = q.get(i);
996
+ let i = `${t}:${n}:${r}`, a = K.get(i);
989
997
  if (a) return a;
990
998
  try {
991
999
  let e = window.MathJax;
@@ -1009,9 +1017,9 @@ function Ae(e, t = 14, n = !1) {
1009
1017
  width: s,
1010
1018
  height: c
1011
1019
  };
1012
- if (q.set(i, d), q.size > ke) {
1013
- let e = q.keys().next().value;
1014
- e && q.delete(e);
1020
+ if (K.set(i, d), K.size > Ae) {
1021
+ let e = K.keys().next().value;
1022
+ e && K.delete(e);
1015
1023
  }
1016
1024
  return d;
1017
1025
  } catch {
@@ -1022,14 +1030,14 @@ function Ae(e, t = 14, n = !1) {
1022
1030
  };
1023
1031
  }
1024
1032
  }
1025
- function je(e, t = 20) {
1033
+ function Me(e, t = 20) {
1026
1034
  return new Promise((n) => {
1027
1035
  let r = Array(e.length), i = 0;
1028
1036
  function a() {
1029
1037
  let o = Math.min(i + t, e.length);
1030
1038
  for (; i < o; i++) {
1031
1039
  let t = e[i];
1032
- r[i] = K(t.latex, t.fontSize ?? 14, t.display ?? !1);
1040
+ r[i] = De(t.latex, t.fontSize ?? 14, t.display ?? !1);
1033
1041
  }
1034
1042
  i < e.length ? requestAnimationFrame(a) : n(r);
1035
1043
  }
@@ -1038,7 +1046,7 @@ function je(e, t = 20) {
1038
1046
  }
1039
1047
  //#endregion
1040
1048
  //#region src/utils/serialization/shared.ts
1041
- var Me = {
1049
+ var Ne = {
1042
1050
  clrScheme: {
1043
1051
  accent1: "4472C4",
1044
1052
  accent2: "ED7D31",
@@ -1095,9 +1103,9 @@ var Me = {
1095
1103
  latin: "等线"
1096
1104
  }
1097
1105
  }
1098
- }, Ne = { docDefaults: { textPropsDefault: { runfonts: { hint: "eastAsia" } } } }, Pe = 26.46, Fe = 17.5, Ie = 26.25;
1099
- function J(e) {
1100
- let t = Pe;
1106
+ }, Pe = { docDefaults: { textPropsDefault: { runfonts: { hint: "eastAsia" } } } }, Fe = 26.46, Ie = 17.5, Le = 26.25;
1107
+ function Re(e) {
1108
+ let t = Fe;
1101
1109
  return {
1102
1110
  tl: {
1103
1111
  top: t,
@@ -1125,11 +1133,11 @@ function J(e) {
1125
1133
  }
1126
1134
  };
1127
1135
  }
1128
- function Le(e) {
1136
+ function q(e) {
1129
1137
  let t = e.startsWith("sw-") ? e.slice(3) : e, n = t.lastIndexOf("-");
1130
1138
  return n > 0 && /^\d+$/.test(t.slice(n + 1)) && (t = t.slice(0, n)), t;
1131
1139
  }
1132
- function Re(e) {
1140
+ function ze(e) {
1133
1141
  let t = /* @__PURE__ */ new Map();
1134
1142
  for (let n of e) {
1135
1143
  t.set(n.id, n);
@@ -1138,7 +1146,7 @@ function Re(e) {
1138
1146
  }
1139
1147
  return t;
1140
1148
  }
1141
- function ze(e) {
1149
+ function Be(e) {
1142
1150
  let t = e?.questionType;
1143
1151
  if (t) {
1144
1152
  if (t.includes("chose")) return "choice";
@@ -1147,15 +1155,17 @@ function ze(e) {
1147
1155
  }
1148
1156
  return e?.options?.length ? "choice" : "fill";
1149
1157
  }
1150
- function Be(e) {
1158
+ function Ve(e) {
1151
1159
  return e.replace(/-([a-z])/g, (e, t) => t.toUpperCase());
1152
1160
  }
1153
- function Ve(e) {
1154
- return /_Block_\d+$/.test(e);
1161
+ function J(e) {
1162
+ return /_Block_\d+$/.test(e) || /-sub\d+$/.test(e);
1155
1163
  }
1156
1164
  function He(e) {
1157
1165
  let t = e.match(/^(.+)_Block_\d+$/);
1158
- return t ? t[1] : "";
1166
+ if (t) return t[1];
1167
+ let n = e.match(/^(.+)-sub\d+$/);
1168
+ return n ? `${n[1]}-header` : "";
1159
1169
  }
1160
1170
  function Ue(e) {
1161
1171
  let t = [];
@@ -1189,7 +1199,7 @@ function We(e) {
1189
1199
  //#region src/utils/serialization/buildQuestions.ts
1190
1200
  function Ge(e, t) {
1191
1201
  if (e.type === "title" || e.type === "info-line") return null;
1192
- let n = e.type === "sub-question" ? Ie : Fe, r = A[t.paperSize], [, , i, a] = t.margins || [
1202
+ let n = e.type === "sub-question" ? Le : Ie, r = A[t.paperSize], [, , i, a] = t.margins || [
1193
1203
  50,
1194
1204
  56,
1195
1205
  50,
@@ -1489,7 +1499,7 @@ function Ye(e, t) {
1489
1499
  bottom: a,
1490
1500
  left: o
1491
1501
  },
1492
- point: J(n),
1502
+ point: Re(n),
1493
1503
  headerTop: t.headerTop ?? 18,
1494
1504
  footerBottom: 13.2,
1495
1505
  showScore: t.showScore,
@@ -1580,26 +1590,45 @@ var Qe = new Set([
1580
1590
  "qr-code",
1581
1591
  "student-name",
1582
1592
  "student-class",
1583
- "student-code"
1593
+ "student-code",
1594
+ "student-code-filler"
1584
1595
  ]);
1585
1596
  function $e(e, t, n = !0) {
1586
- let r = Re(t), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1597
+ let r = ze(t), i = /* @__PURE__ */ new Map();
1598
+ for (let e of t) {
1599
+ let t = e.metadata?.blockGroup;
1600
+ if (t && e.type === "question") {
1601
+ let n = q(e.id);
1602
+ i.set(t, {
1603
+ topicId: n,
1604
+ qid: e.metadata?.qid
1605
+ });
1606
+ }
1607
+ }
1608
+ let a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
1587
1609
  for (let t of e) for (let e of t.renderedRegions || []) {
1588
- let t = Le(e.meta?.blockId || e.meta?.topicId || "");
1589
- t && e.type === "question-border" && i.add(t);
1610
+ let t = q(e.meta?.blockId || e.meta?.topicId || "");
1611
+ t && e.type === "question-border" && a.add(t);
1590
1612
  }
1591
- for (let e of i) Ve(e) && a.add(He(e));
1592
- let o = /* @__PURE__ */ new Map(), s = 0;
1613
+ for (let e of a) J(e) && o.add(He(e));
1614
+ for (let e of t) if (e.type === "sub-question") {
1615
+ let t = e.metadata?.topicId || (e.id.startsWith("sw-") ? e.id.slice(3) : e.id);
1616
+ if (e.metadata?.blockGroup) {
1617
+ let t = i.get(e.metadata.blockGroup);
1618
+ t && o.add(t.topicId);
1619
+ } else J(t) && o.add(He(t));
1620
+ }
1621
+ let s = /* @__PURE__ */ new Map(), c = 0;
1593
1622
  for (let e of t) {
1594
1623
  let t = e.metadata?.topicId || (e.id.startsWith("sw-") ? e.id.slice(3) : e.id);
1595
- o.has(t) || o.set(t, s++);
1624
+ s.has(t) || s.set(t, c++);
1596
1625
  }
1597
1626
  for (let t of e) for (let e of t.renderedRegions || []) {
1598
- let t = Le(e.meta?.blockId || e.meta?.topicId || "");
1599
- t && e.type === "question-border" && !o.has(t) && o.set(t, s++);
1627
+ let t = q(e.meta?.blockId || e.meta?.topicId || "");
1628
+ t && e.type === "question-border" && !s.has(t) && s.set(t, c++);
1600
1629
  }
1601
1630
  return e.map((t) => {
1602
- let i = t.renderedRegions || [], s = {
1631
+ let a = t.renderedRegions || [], c = {
1603
1632
  pageIndex: t.index,
1604
1633
  pageWidth: t.width,
1605
1634
  pageHeight: t.height,
@@ -1608,61 +1637,65 @@ function $e(e, t, n = !0) {
1608
1637
  bbox: e.bbox
1609
1638
  })),
1610
1639
  questions: []
1611
- }, c = {}, l = [], u, d = /* @__PURE__ */ new Map();
1612
- for (let e of i) {
1640
+ }, l = {}, u = [], d, f = /* @__PURE__ */ new Map();
1641
+ for (let e of a) {
1613
1642
  if (Qe.has(e.type)) {
1614
1643
  if (e.type === "score" && !n) continue;
1615
- c[Be(e.type)] = e.bbox;
1644
+ l[Ve(e.type)] = e.bbox;
1616
1645
  continue;
1617
1646
  }
1618
1647
  if (e.type === "page-number") {
1619
- u = e.bbox;
1648
+ d = e.bbox;
1620
1649
  continue;
1621
1650
  }
1622
1651
  if (e.type === "title-embed") {
1623
- l.push({
1652
+ u.push({
1624
1653
  label: e.meta?.label || "unknown",
1625
1654
  bbox: e.bbox
1626
1655
  });
1627
1656
  continue;
1628
1657
  }
1629
1658
  if (e.type === "column-separator") continue;
1630
- let t = Le(e.meta?.blockId || e.meta?.topicId || "");
1659
+ let t = q(e.meta?.blockId || e.meta?.topicId || "");
1631
1660
  if (!t) continue;
1632
- d.has(t) || d.set(t, {
1661
+ f.has(t) || f.set(t, {
1633
1662
  borders: [],
1634
1663
  underlines: []
1635
1664
  });
1636
- let r = d.get(t);
1665
+ let r = f.get(t);
1637
1666
  e.type === "question-border" ? r.borders.push(e) : e.type === "underline" && r.underlines.push(e);
1638
1667
  }
1639
- Object.keys(c).length > 0 && (s.header = c), l.length > 0 && (s.sectionTitles = l), u && (s.footer = { pageNumber: u });
1640
- let f = Array.from(d.entries()).sort(([e, t], [n, r]) => {
1641
- let i = o.get(e) ?? 9999, a = o.get(n) ?? 9999;
1668
+ Object.keys(l).length > 0 && (c.header = l), u.length > 0 && (c.sectionTitles = u), d && (c.footer = { pageNumber: d });
1669
+ let p = Array.from(f.entries()).sort(([e, t], [n, r]) => {
1670
+ let i = s.get(e) ?? 9999, a = s.get(n) ?? 9999;
1642
1671
  return i === a ? (t.borders[0]?.bbox[1] ?? 0) - (r.borders[0]?.bbox[1] ?? 0) : i - a;
1643
1672
  });
1644
- for (let [t, n] of f) {
1673
+ for (let [t, n] of p) {
1645
1674
  if (n.borders.length === 0) continue;
1646
- let i = r.get(t), c = i?.metadata?.questionNo || i?.metadata?.subLabel || "", l = i?.metadata?.score, u = a.has(t), d = n.borders.map((e) => e.bbox), f = {
1675
+ let a = r.get(t), l = a?.metadata?.questionNo || a?.metadata?.subLabel || "", u = a?.metadata?.score, d = o.has(t), f = J(t) || a?.type === "sub-question", p = n.borders.map((e) => e.bbox), m = {
1647
1676
  topicId: t,
1648
- questionNo: c,
1649
- questionType: ze(i),
1650
- sortIndex: o.get(t) ?? 9999,
1651
- bbox: d[0]
1677
+ questionNo: l,
1678
+ questionType: Be(a),
1679
+ sortIndex: s.get(t) ?? 9999,
1680
+ bbox: p[0]
1652
1681
  };
1653
- if (d.length > 1 && (f.bboxes = d), i?.metadata?.qid && (f.qid = i.metadata.qid), i?.metadata?.answer && (f.answer = i.metadata.answer), l !== void 0 && l !== "" && l !== null) {
1654
- let e = parseFloat(String(l));
1655
- isNaN(e) || (f.score = e);
1682
+ if (p.length > 1 && (m.bboxes = p), a?.metadata?.qid && (m.qid = a.metadata.qid), a?.metadata?.answer && (m.answer = a.metadata.answer), a?.metadata?.subAnswers && (m.subAnswers = a.metadata.subAnswers), u !== void 0 && u !== "" && u !== null) {
1683
+ let e = parseFloat(String(u));
1684
+ isNaN(e) || (m.score = e);
1656
1685
  }
1657
- Ve(t) && (f.parentTopicId = He(t)), u && (f.hasSubQuestions = !0), n.underlines.length > 0 && (f.underlines = n.underlines.map((e) => {
1686
+ if (f) if (a?.metadata?.blockGroup) {
1687
+ let e = i.get(a.metadata.blockGroup);
1688
+ e && (m.parentTopicId = e.topicId, e.qid && (m.pqid = e.qid));
1689
+ } else m.parentTopicId = He(t);
1690
+ d && (m.hasSubQuestions = !0), n.underlines.length > 0 && (m.underlines = n.underlines.map((e) => {
1658
1691
  let t = { bbox: e.bbox }, n = e.meta;
1659
1692
  return n?.correctAnswer && (t.correctAnswer = n.correctAnswer), n?.blankType && (t.blankType = n.blankType), n?.index != null && (t.index = n.index), n?.underlineId && (t.underlineId = n.underlineId), n?.isSplitPart && (t.isSplitPart = n.isSplitPart), t;
1660
1693
  })), e.filter((e) => e.renderedRegions.some((e) => {
1661
1694
  let n = e.meta?.blockId || e.meta?.topicId || "";
1662
- return n && Le(n) === t;
1663
- })).length > 1 && (f.isCrossPage = !0), s.questions.push(f);
1695
+ return n && q(n) === t;
1696
+ })).length > 1 && (m.isCrossPage = !0), c.questions.push(m);
1664
1697
  }
1665
- return s;
1698
+ return c;
1666
1699
  });
1667
1700
  }
1668
1701
  //#endregion
@@ -1671,7 +1704,12 @@ var et = ",。、;:?!…)】》'\"'\"…·", tt = "(【《'\"'\"";
1671
1704
  function nt(e, t) {
1672
1705
  let n = t, r = t * .5;
1673
1706
  for (let t of e) if (t.type === "formula") {
1674
- let e = t, i = e.svgContent.match(/vertical-align:\s*([-\d.]+)ex/), a = i ? parseFloat(i[1]) * 7 : -(e.height || 20), o = e.height || 20, s = r + a + o;
1707
+ let e = t, i = e.svgContent.match(/vertical-align:\s*([-\d.]+)(px|ex)/), a;
1708
+ if (i) {
1709
+ let e = parseFloat(i[1]);
1710
+ a = i[2] === "ex" ? e * 7 : e;
1711
+ } else a = -(e.height || 20);
1712
+ let o = e.height || 20, s = r + a + o;
1675
1713
  s > n && (n = s);
1676
1714
  let c = r + a;
1677
1715
  c < 0 && (n = Math.max(n, s - c));
@@ -1784,7 +1822,7 @@ function ot(e) {
1784
1822
  case "text": {
1785
1823
  let t = e;
1786
1824
  if (!t.text) return null;
1787
- let n = t.props.fontSize || 14, r = t.props.fontFamily || t.props.runfonts?.eastAsia || "SimSun", i = t.props.bold === "bold", a = t.props.italic === "italic", o = V(t.text, n, r, i, a), s = o.length > 0 ? o[o.length - 1] + B(t.text[t.text.length - 1], n, r, i, a) : 0, c = {
1825
+ let n = t.props.fontSize || 14, r = t.props.fontFamily || t.props.runfonts?.eastAsia || "SimSun", i = t.props.bold === "bold", a = t.props.italic === "italic", o = B(t.text, n, r, i, a), s = o.length > 0 ? o[o.length - 1] + z(t.text[t.text.length - 1], n, r, i, a) : 0, c = {
1788
1826
  type: "text",
1789
1827
  value: t.text,
1790
1828
  fontFamily: r,
@@ -1799,7 +1837,7 @@ function ot(e) {
1799
1837
  return t.props.dotAbove && (c.dotAbove = !0), t.props.wavyLine && (c.wavyLine = !0), t.props.underline && (c.underline = !0), t.props.strikethrough && (c.strikethrough = !0), t.props.backgroundColor && (c.backgroundColor = t.props.backgroundColor), t.props.verticalAlign !== void 0 && t.props.verticalAlign !== 0 && (c.verticalAlign = t.props.verticalAlign), t.props.color?.val && (c.color = t.props.color.val), c;
1800
1838
  }
1801
1839
  case "latex": {
1802
- let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = K(n);
1840
+ let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = De(n);
1803
1841
  return {
1804
1842
  type: "formula",
1805
1843
  width: i,
@@ -1809,7 +1847,7 @@ function ot(e) {
1809
1847
  };
1810
1848
  }
1811
1849
  case "mathml": {
1812
- let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = Ae(n);
1850
+ let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = je(n);
1813
1851
  return {
1814
1852
  type: "formula",
1815
1853
  width: i,
@@ -1897,7 +1935,7 @@ var st = 0;
1897
1935
  function ct(e, t, n, r) {
1898
1936
  let i = [], a = e.props, o = e.children.find((e) => e.type === "question-stem");
1899
1937
  if (!o) return i;
1900
- let s = a.topicId.includes("_Block_"), c = t ? t - (s ? Ie : Fe) : void 0, l = [];
1938
+ let s = a.topicId.includes("_Block_"), c = t ? t - (s ? Le : Ie) : void 0, l = [];
1901
1939
  for (let e of o.children) e.type === "paragraph" && l.push(ut(e, c, n, r));
1902
1940
  st++;
1903
1941
  let u = {
@@ -1993,11 +2031,11 @@ function ft(e) {
1993
2031
  right: 56,
1994
2032
  bottom: 50,
1995
2033
  left: 56
1996
- }, i = P(n.type), a = {
2034
+ }, i = N(n.type), a = {
1997
2035
  paperSize: i.size,
1998
2036
  columns: i.columns,
1999
- fontSize: n.fontSize ?? 14,
2000
- lineSpacing: n.lineSpacing ?? 1.5,
2037
+ fontSize: n.fontSize ?? 16,
2038
+ lineSpacing: n.lineSpacing ?? 1,
2001
2039
  margins: [
2002
2040
  r.top ?? 50,
2003
2041
  r.right ?? 56,
@@ -2310,8 +2348,8 @@ function ht(e, t, n = {}) {
2310
2348
  }]
2311
2349
  }
2312
2350
  },
2313
- theme: Me,
2314
- styles: Ne,
2351
+ theme: Ne,
2352
+ styles: Pe,
2315
2353
  version: "1.3",
2316
2354
  mode: 1,
2317
2355
  lastUpdateTime: Date.now()
@@ -2325,7 +2363,7 @@ function gt(e) {
2325
2363
  //#region src/utils/questionHtmlParser.ts
2326
2364
  var _t = 0, vt = 0, yt = 0, bt = .5;
2327
2365
  function xt(e, t = {}) {
2328
- let { questionNo: n = "", score: r = "", contentWidth: i = 600, fontSize: a = 14, lineSpacing: o = 1.5, skipAnswerArea: s = !1, protectContent: c = !1 } = t, l = new DOMParser().parseFromString(e, "text/html"), u = [], d = Math.round(a * o * 1.67), f = n.length > 2 ? 26.25 : 17.5, p = new Set([
2366
+ let { questionNo: n = "", score: r = "", contentWidth: i = 600, fontSize: a = 16, lineSpacing: o = 1, skipAnswerArea: s = !1, protectContent: c = !1 } = t, l = new DOMParser().parseFromString(e, "text/html"), u = [], d = Math.round(a * o * 1.67), f = n.length > 2 ? 26.25 : 17.5, p = new Set([
2329
2367
  "p",
2330
2368
  "h1",
2331
2369
  "h2",
@@ -2343,7 +2381,7 @@ function xt(e, t = {}) {
2343
2381
  if (t.nodeType !== Node.ELEMENT_NODE) continue;
2344
2382
  let n = t, r = n.tagName.toLowerCase();
2345
2383
  if (r === "table") {
2346
- let e = jt(n, i, d), t = e.reduce((e, t) => e + t.lineHeight, 0) + 4;
2384
+ let e = Mt(n, i, d), t = e.reduce((e, t) => e + t.lineHeight, 0) + 4;
2347
2385
  u.push({
2348
2386
  lines: e,
2349
2387
  y: 0,
@@ -2354,7 +2392,7 @@ function xt(e, t = {}) {
2354
2392
  if (r === "figure") {
2355
2393
  let e = n.querySelector("table");
2356
2394
  if (e) {
2357
- let t = jt(e, i, d), n = t.reduce((e, t) => e + t.lineHeight, 0) + 4;
2395
+ let t = Mt(e, i, d), n = t.reduce((e, t) => e + t.lineHeight, 0) + 4;
2358
2396
  u.push({
2359
2397
  lines: t,
2360
2398
  y: 0,
@@ -2364,14 +2402,31 @@ function xt(e, t = {}) {
2364
2402
  continue;
2365
2403
  }
2366
2404
  if (!p.has(r)) continue;
2405
+ if (r === "div") {
2406
+ let e = Array.from(n.children).filter((e) => e.tagName.toLowerCase() === "p");
2407
+ if (e.length > 0) {
2408
+ for (let t of e) {
2409
+ let e = t.getAttribute("style") || "", n = Y(t, a, e, i, f);
2410
+ if (n.length === 0) continue;
2411
+ let r = rt(n, i, d), o = r.reduce((e, t) => e + t.lineHeight, 0) + 4;
2412
+ u.push({
2413
+ lines: r,
2414
+ y: 0,
2415
+ height: o,
2416
+ justification: Ct(n, e)
2417
+ });
2418
+ }
2419
+ continue;
2420
+ }
2421
+ }
2367
2422
  let o = n, s = o.getAttribute("style") || "", c = Y(o, a, s, i, f);
2368
2423
  if (c.length === 0) continue;
2369
- let m = rt(c, i, d), h = m.reduce((e, t) => e + t.lineHeight, 0) + 4, g = wt(s), _ = g === "center" ? "center" : g === "right" ? "right" : void 0;
2424
+ let m = rt(c, i, d), h = m.reduce((e, t) => e + t.lineHeight, 0) + 4;
2370
2425
  u.push({
2371
2426
  lines: m,
2372
2427
  y: 0,
2373
2428
  height: h,
2374
- justification: _
2429
+ justification: Ct(c, s)
2375
2430
  });
2376
2431
  }
2377
2432
  if (!s) for (let e = 0; e < 2; e++) u.push({
@@ -2414,13 +2469,13 @@ function Y(e, t, n, r, i) {
2414
2469
  let r = e.replace(/\u00A0/g, " ").replace(/\n/g, "").replace(/\s+/g, " ");
2415
2470
  if (!r.trim()) {
2416
2471
  if (a.length > 0) {
2417
- let e = Tt(n) || t, r = Et(n) || "\"Times New Roman\", SimSun", i = Dt(n) || "#000", o = /font-style:\s*(italic|oblique)/.test(n);
2418
- a.push(Ct("\xA0", e, r, !1, i, o));
2472
+ let e = Et(n) || t, r = Dt(n) || "\"Times New Roman\", SimSun", i = Ot(n) || "#000", o = /font-style:\s*(italic|oblique)/.test(n);
2473
+ a.push(wt("\xA0", e, r, !1, i, o));
2419
2474
  }
2420
2475
  continue;
2421
2476
  }
2422
- let i = r.startsWith(" ") && a.length > 0, o = r.endsWith(" "), c = r.trim(), l = (i ? "\xA0" : "") + c + (o ? "\xA0" : ""), u = Tt(n) || t, d = Et(n) || "\"Times New Roman\", SimSun", f = Dt(n) || "#000", p = /font-weight:\s*(bold|700|[89]\d\d)/.test(n), m = /font-style:\s*(italic|oblique)/.test(n);
2423
- a.push(Ct(l, u, d, p, f, m));
2477
+ let i = r.startsWith(" ") && a.length > 0, o = r.endsWith(" "), c = r.trim(), l = (i ? "\xA0" : "") + c + (o ? "\xA0" : ""), u = Et(n) || t, d = Dt(n) || "\"Times New Roman\", SimSun", f = Ot(n) || "#000", p = /font-weight:\s*(bold|700|[89]\d\d)/.test(n), m = /font-style:\s*(italic|oblique)/.test(n);
2478
+ a.push(wt(l, u, d, p, f, m));
2424
2479
  continue;
2425
2480
  }
2426
2481
  if (s.nodeType !== Node.ELEMENT_NODE) continue;
@@ -2429,11 +2484,11 @@ function Y(e, t, n, r, i) {
2429
2484
  let e = c.getAttribute("data-latex") || "", t = e, n, r;
2430
2485
  if (e) {
2431
2486
  let n = e.replace(/\\style\{[^}]*\}\{/, "{").replace(/^\\style\{[^}]*\}/, "") || e;
2432
- t = n, r = K(n);
2487
+ t = n, r = De(n);
2433
2488
  } else {
2434
2489
  let e = c.getAttribute("data-mathml") || "";
2435
2490
  if (e) {
2436
- r = Ae(e), t = "";
2491
+ r = je(e), t = "";
2437
2492
  try {
2438
2493
  n = decodeURIComponent(e);
2439
2494
  } catch {
@@ -2491,7 +2546,7 @@ function Y(e, t, n, r, i) {
2491
2546
  if (l === "span" && d.includes("under-point")) {
2492
2547
  let e = c.textContent || "";
2493
2548
  if (e.trim()) {
2494
- let r = Tt(u) || Tt(n) || t, i = Et(u) || Et(n) || "\"Times New Roman\", SimSun", o = Dt(u) || Dt(n) || "#000", s = /font-style:\s*(italic|oblique)/.test(u) || /font-style:\s*(italic|oblique)/.test(n), c = Ct(e.trim(), r, i, !1, o, s);
2549
+ let r = Et(u) || Et(n) || t, i = Dt(u) || Dt(n) || "\"Times New Roman\", SimSun", o = Ot(u) || Ot(n) || "#000", s = /font-style:\s*(italic|oblique)/.test(u) || /font-style:\s*(italic|oblique)/.test(n), c = wt(e.trim(), r, i, !1, o, s);
2495
2550
  c.dotAbove = !0, a.push(c);
2496
2551
  }
2497
2552
  continue;
@@ -2499,7 +2554,7 @@ function Y(e, t, n, r, i) {
2499
2554
  if (l === "span" && d.includes("wavy-line")) {
2500
2555
  let e = c.textContent || "";
2501
2556
  if (e.trim()) {
2502
- let r = Tt(u) || Tt(n) || t, i = Et(u) || Et(n) || "\"Times New Roman\", SimSun", o = Dt(u) || Dt(n) || "#000", s = /font-style:\s*(italic|oblique)/.test(u) || /font-style:\s*(italic|oblique)/.test(n), c = Ct(e.trim(), r, i, !1, o, s);
2557
+ let r = Et(u) || Et(n) || t, i = Dt(u) || Dt(n) || "\"Times New Roman\", SimSun", o = Ot(u) || Ot(n) || "#000", s = /font-style:\s*(italic|oblique)/.test(u) || /font-style:\s*(italic|oblique)/.test(n), c = wt(e.trim(), r, i, !1, o, s);
2503
2558
  c.wavyLine = !0, a.push(c);
2504
2559
  }
2505
2560
  continue;
@@ -2584,12 +2639,21 @@ function Y(e, t, n, r, i) {
2584
2639
  }
2585
2640
  let f = u.match(/background-color:\s*([^;]+)/);
2586
2641
  if (f && f[1] && f[1] !== "transparent") {
2587
- let e = At(f[1]);
2642
+ let e = jt(f[1]);
2588
2643
  if (e) for (let t of l) t.type === "text" && (t.backgroundColor = e);
2589
2644
  }
2590
2645
  a.push(...l);
2591
2646
  continue;
2592
2647
  }
2648
+ if (l === "p") {
2649
+ let e = Y(c, t, u || n, r, i);
2650
+ if (e.length > 0 && e.every((e) => e.type === "image" && !e.rawHtml)) for (let t of e) {
2651
+ let e = t, n = e.height / e.width || .6;
2652
+ e.width = r, e.height = Math.round(r * n);
2653
+ }
2654
+ a.push(...e);
2655
+ continue;
2656
+ }
2593
2657
  let p = Y(c, t, u || n, r, i);
2594
2658
  a.push(...p);
2595
2659
  }
@@ -2607,8 +2671,13 @@ function St(e) {
2607
2671
  isEmpty: !1
2608
2672
  } : null;
2609
2673
  }
2610
- function Ct(e, t, n, r, i, a) {
2611
- let o = e.split(""), s = V(e, t, n, r, a || !1), c = s.length > 0 ? s[s.length - 1] + B(o[o.length - 1], t, n, r, a || !1) : 0;
2674
+ function Ct(e, t) {
2675
+ if (e.length > 0 && e.every((e) => e.type === "image" && !e.rawHtml)) return "right";
2676
+ let n = Tt(t);
2677
+ return n === "center" ? "center" : n === "right" ? "right" : void 0;
2678
+ }
2679
+ function wt(e, t, n, r, i, a) {
2680
+ let o = e.split(""), s = B(e, t, n, r, a || !1), c = s.length > 0 ? s[s.length - 1] + z(o[o.length - 1], t, n, r, a || !1) : 0;
2612
2681
  return {
2613
2682
  type: "text",
2614
2683
  value: e,
@@ -2622,19 +2691,19 @@ function Ct(e, t, n, r, i, a) {
2622
2691
  xPositions: s
2623
2692
  };
2624
2693
  }
2625
- function wt(e) {
2694
+ function Tt(e) {
2626
2695
  let t = e.match(/text-align:\s*(right|center|left)/);
2627
2696
  return t ? t[1] : "left";
2628
2697
  }
2629
- function Tt(e) {
2698
+ function Et(e) {
2630
2699
  let t = e.match(/font-size:\s*(\d+)px/);
2631
2700
  return t ? parseInt(t[1]) : null;
2632
2701
  }
2633
- function Et(e) {
2702
+ function Dt(e) {
2634
2703
  let t = e.match(/font-family:\s*([^;]+)/);
2635
2704
  return t ? t[1].trim().replace(/["']/g, "") : null;
2636
2705
  }
2637
- function Dt(e) {
2706
+ function Ot(e) {
2638
2707
  let t = e.match(/color:\s*rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);
2639
2708
  if (t) return `#${parseInt(t[1]).toString(16).padStart(2, "0")}${parseInt(t[2]).toString(16).padStart(2, "0")}${parseInt(t[3]).toString(16).padStart(2, "0")}`;
2640
2709
  let n = e.match(/color:\s*rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,[^)]+\)/);
@@ -2642,9 +2711,9 @@ function Dt(e) {
2642
2711
  let r = e.match(/color:\s*(#[0-9a-fA-F]{3,6})/);
2643
2712
  if (r) return r[1];
2644
2713
  let i = e.match(/color:\s*([a-zA-Z]+)/);
2645
- return i && kt(i[1]) || null;
2714
+ return i && At(i[1]) || null;
2646
2715
  }
2647
- var Ot = {
2716
+ var kt = {
2648
2717
  red: "#ff0000",
2649
2718
  green: "#008000",
2650
2719
  blue: "#0000ff",
@@ -2671,16 +2740,16 @@ var Ot = {
2671
2740
  lightgrey: "#d3d3d3",
2672
2741
  transparent: "#000000"
2673
2742
  };
2674
- function kt(e) {
2675
- return Ot[e.toLowerCase()];
2676
- }
2677
2743
  function At(e) {
2744
+ return kt[e.toLowerCase()];
2745
+ }
2746
+ function jt(e) {
2678
2747
  let t = e.trim(), n = t.match(/^#[0-9a-fA-F]{3,6}$/);
2679
2748
  if (n) return n[0];
2680
2749
  let r = t.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);
2681
- return r ? `#${parseInt(r[1]).toString(16).padStart(2, "0")}${parseInt(r[2]).toString(16).padStart(2, "0")}${parseInt(r[3]).toString(16).padStart(2, "0")}` : kt(t) || null;
2750
+ return r ? `#${parseInt(r[1]).toString(16).padStart(2, "0")}${parseInt(r[2]).toString(16).padStart(2, "0")}${parseInt(r[3]).toString(16).padStart(2, "0")}` : At(t) || null;
2682
2751
  }
2683
- function jt(e, t, n) {
2752
+ function Mt(e, t, n) {
2684
2753
  let r = e.outerHTML, i = e.getAttribute("style") || "", a = parseInt(i.match(/width:\s*(\d+)px/)?.[1] || "0"), o = i.match(/width:\s*([\d.]+)%/), s = e.querySelectorAll("tr").length, c = Math.max(60, s * 30 + 40), l = o ? Math.round(parseFloat(o[1]) / 100 * t) : a || t, u = Math.min(l, t), d = c;
2685
2754
  return u <= 0 || d <= 0 ? [{
2686
2755
  ...nt([], n),
@@ -2699,8 +2768,26 @@ function jt(e, t, n) {
2699
2768
  }
2700
2769
  //#endregion
2701
2770
  //#region src/utils/questionJsonParser.ts
2702
- function Mt(e, t = {}) {
2703
- let { questionNo: n = "", score: r = "", contentWidth: i = 600, fontSize: a = 14, lineSpacing: o = 1.5, protectContent: s = !1 } = t, c = e.extra_json?.quest_type || "answer_question", l = c === "single_chose" || c === "multi_chose", u = Math.round(a * o * 1.67), d = xt(e.question, {
2771
+ function Nt(e, t = {}) {
2772
+ let { questionNo: n = "", score: r = "", contentWidth: i = 600, fontSize: a = 16, lineSpacing: o = 1, protectContent: s = !1 } = t;
2773
+ return e.children && e.children.length > 0 ? Ft(e, {
2774
+ questionNo: n,
2775
+ score: r,
2776
+ contentWidth: i,
2777
+ fontSize: a,
2778
+ lineSpacing: o,
2779
+ protectContent: s
2780
+ }) : Pt(e, {
2781
+ questionNo: n,
2782
+ score: r,
2783
+ contentWidth: i,
2784
+ fontSize: a,
2785
+ lineSpacing: o,
2786
+ protectContent: s
2787
+ });
2788
+ }
2789
+ function Pt(e, t) {
2790
+ let { questionNo: n, score: r, contentWidth: i, fontSize: a, lineSpacing: o, protectContent: s } = t, c = e.extra_json?.quest_type || "answer_question", l = c === "single_chose" || c === "multi_chose", u = Math.round(a * o * 1.67), d = xt(e.question, {
2704
2791
  questionNo: n,
2705
2792
  score: r,
2706
2793
  contentWidth: i,
@@ -2727,11 +2814,66 @@ function Mt(e, t = {}) {
2727
2814
  tags: e.tags
2728
2815
  }
2729
2816
  };
2730
- if (l && e.extra_json?.options && e.extra_json.options.length > 0) p.options = Nt(e.extra_json.options, i, a, o), p.paragraphs.push(Pt(u));
2731
- else for (let e = 0; e < 2; e++) p.paragraphs.push(Pt(u));
2817
+ if (l && e.extra_json?.options && e.extra_json.options.length > 0) p.options = It(e.extra_json.options, i, a, o), p.paragraphs.push(Lt(u));
2818
+ else for (let e = 0; e < 2; e++) p.paragraphs.push(Lt(u));
2732
2819
  return p.height = p.paragraphs.reduce((e, t) => e + (t.height || 26), 0), [p];
2733
2820
  }
2734
- function Nt(e, t, n, r) {
2821
+ function Ft(e, t) {
2822
+ let { questionNo: n, score: r, contentWidth: i, fontSize: a, lineSpacing: o, protectContent: s } = t, c = "answer_question", l = Math.round(a * o * 1.67), u = Date.now(), d = Math.random().toString(36).slice(2, 8), f = e.id ? `group-${e.id}-${u}-${d}` : `group-${e.qid || u}-${d}`, p = Math.max(100, i - 26.25), m = [], h = xt(e.question, {
2823
+ questionNo: n,
2824
+ score: r || "",
2825
+ contentWidth: i,
2826
+ fontSize: a,
2827
+ lineSpacing: o,
2828
+ skipAnswerArea: !0,
2829
+ protectContent: s
2830
+ });
2831
+ if (h.length > 0) {
2832
+ let t = h[0];
2833
+ t.type = "question", t.metadata = {
2834
+ ...t.metadata,
2835
+ qid: e.qid,
2836
+ questType: c,
2837
+ answer: e.extra_json?.answer || e.answer || "",
2838
+ tenantId: e.tenant_id,
2839
+ tags: e.tags,
2840
+ blockGroup: f,
2841
+ hasSubQuestions: !0,
2842
+ score: r || ""
2843
+ }, t.keepNext = !0;
2844
+ for (let e = 0; e < 2; e++) t.paragraphs.push(Lt(l));
2845
+ t.height = t.paragraphs.reduce((e, t) => e + (t.height || 26), 0), m.push(t);
2846
+ }
2847
+ if (e.children) for (let t = 0; t < e.children.length; t++) {
2848
+ let n = e.children[t], r = `(${t + 1})`, i = xt(n.question, {
2849
+ contentWidth: p,
2850
+ fontSize: a,
2851
+ lineSpacing: o,
2852
+ skipAnswerArea: !0,
2853
+ protectContent: s
2854
+ });
2855
+ if (i.length === 0) continue;
2856
+ let u = i[0];
2857
+ u.type = "sub-question", u.metadata = {
2858
+ ...u.metadata,
2859
+ questionNo: "",
2860
+ subLabel: r,
2861
+ label: `子题${r}`,
2862
+ topicId: `${f}-sub${t + 1}`,
2863
+ blockGroup: f,
2864
+ qid: n.qid,
2865
+ answer: n.answer || n.extra_json?.answer || "",
2866
+ questType: c,
2867
+ tenantId: n.tenant_id,
2868
+ tags: n.tags,
2869
+ score: ""
2870
+ };
2871
+ for (let e = 0; e < 2; e++) u.paragraphs.push(Lt(l));
2872
+ u.height = u.paragraphs.reduce((e, t) => e + (t.height || 26), 0), m.push(u);
2873
+ }
2874
+ return m;
2875
+ }
2876
+ function It(e, t, n, r) {
2735
2877
  let i = Math.max(100, t - 20);
2736
2878
  return e.map((e) => {
2737
2879
  let t = xt(e.content, {
@@ -2760,7 +2902,7 @@ function Nt(e, t, n, r) {
2760
2902
  };
2761
2903
  });
2762
2904
  }
2763
- function Pt(e) {
2905
+ function Lt(e) {
2764
2906
  return {
2765
2907
  lines: [{
2766
2908
  elements: [{
@@ -2778,7 +2920,7 @@ function Pt(e) {
2778
2920
  }
2779
2921
  //#endregion
2780
2922
  //#region src/utils/chineseNumber.ts
2781
- var Ft = [
2923
+ var Rt = [
2782
2924
  "",
2783
2925
  "一",
2784
2926
  "二",
@@ -2791,34 +2933,34 @@ var Ft = [
2791
2933
  "九",
2792
2934
  "十"
2793
2935
  ];
2794
- function It(e) {
2936
+ function zt(e) {
2795
2937
  if (e <= 0) return "";
2796
- if (e <= 10) return Ft[e];
2938
+ if (e <= 10) return Rt[e];
2797
2939
  if (e < 20) {
2798
2940
  let t = e % 10;
2799
- return "十" + (t > 0 ? Ft[t] : "");
2941
+ return "十" + (t > 0 ? Rt[t] : "");
2800
2942
  }
2801
2943
  if (e < 100) {
2802
2944
  let t = Math.floor(e / 10), n = e % 10;
2803
- return Ft[t] + "十" + (n > 0 ? Ft[n] : "");
2945
+ return Rt[t] + "十" + (n > 0 ? Rt[n] : "");
2804
2946
  }
2805
2947
  if (e < 1e3) {
2806
- let t = Math.floor(e / 100), n = e % 100, r = Ft[t] + "百";
2807
- return n === 0 ? r : n < 10 ? r + "零" + Ft[n] : r + It(n);
2948
+ let t = Math.floor(e / 100), n = e % 100, r = Rt[t] + "百";
2949
+ return n === 0 ? r : n < 10 ? r + "零" + Rt[n] : r + zt(n);
2808
2950
  }
2809
2951
  return String(e);
2810
2952
  }
2811
- function Lt(e, t) {
2812
- let n = It(t);
2953
+ function Bt(e, t) {
2954
+ let n = zt(t);
2813
2955
  return n ? n + "、" + e : e;
2814
2956
  }
2815
- function Rt(e) {
2957
+ function Vt(e) {
2816
2958
  let t = e.match(/^[一二三四五六七八九十百零]+、(.+)$/);
2817
2959
  return t ? t[1] : e;
2818
2960
  }
2819
2961
  //#endregion
2820
2962
  //#region src/utils/paperHtmlBuilder.ts
2821
- function zt(e) {
2963
+ function Ht(e) {
2822
2964
  let t = j[e];
2823
2965
  return `
2824
2966
  /* ---------- Reset & Base ---------- */
@@ -3051,6 +3193,7 @@ text.swed-question-score {
3051
3193
  color: #000;
3052
3194
  display: flex;
3053
3195
  align-items: center;
3196
+ width: 100%;
3054
3197
  }
3055
3198
  .swed-student-code-table {
3056
3199
  border-collapse: collapse;
@@ -3065,6 +3208,13 @@ text.swed-question-score {
3065
3208
  text-align: center;
3066
3209
  font-size: 14px;
3067
3210
  }
3211
+ .swed-student-code-filler {
3212
+ height: 30px;
3213
+ border: 1px solid #000;
3214
+ margin-left: 8px;
3215
+ flex: 1;
3216
+ min-width: 20px;
3217
+ }
3068
3218
 
3069
3219
  /* ---------- foreignObject 尾部样式 ---------- */
3070
3220
  .swed-tail-time-wrapper {
@@ -3139,7 +3289,7 @@ text.swed-question-score {
3139
3289
  }
3140
3290
  `;
3141
3291
  }
3142
- function Bt(e) {
3292
+ function Ut(e) {
3143
3293
  let { svgs: t, paperName: n = "试卷", paperSize: r = "A4" } = e, i = t.map((e) => {
3144
3294
  let t = e.match(/viewBox="0 0 (\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)"/), [, n, r] = t ? [
3145
3295
  null,
@@ -3159,20 +3309,20 @@ function Bt(e) {
3159
3309
  <head>
3160
3310
  <meta charset="UTF-8">
3161
3311
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
3162
- <title>${Vt(n)}</title>
3163
- <style>${zt(r)}</style>
3312
+ <title>${Wt(n)}</title>
3313
+ <style>${Ht(r)}</style>
3164
3314
  </head>
3165
3315
  <body>
3166
3316
  ${i}
3167
3317
  </body>
3168
3318
  </html>`;
3169
3319
  }
3170
- function Vt(e) {
3320
+ function Wt(e) {
3171
3321
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
3172
3322
  }
3173
3323
  //#endregion
3174
3324
  //#region ../node_modules/qrcode/lib/can-promise.js
3175
- var Ht = /* @__PURE__ */ D(((e, t) => {
3325
+ var Gt = /* @__PURE__ */ D(((e, t) => {
3176
3326
  t.exports = function() {
3177
3327
  return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
3178
3328
  };
@@ -3238,7 +3388,7 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3238
3388
  }, e.toSJIS = function(e) {
3239
3389
  return t(e);
3240
3390
  };
3241
- })), Ut = /* @__PURE__ */ D(((e) => {
3391
+ })), Kt = /* @__PURE__ */ D(((e) => {
3242
3392
  e.L = { bit: 1 }, e.M = { bit: 0 }, e.Q = { bit: 3 }, e.H = { bit: 2 };
3243
3393
  function t(t) {
3244
3394
  if (typeof t != "string") throw Error("Param is not a string");
@@ -3264,7 +3414,7 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3264
3414
  return r;
3265
3415
  }
3266
3416
  };
3267
- })), Wt = /* @__PURE__ */ D(((e, t) => {
3417
+ })), qt = /* @__PURE__ */ D(((e, t) => {
3268
3418
  function n() {
3269
3419
  this.buffer = [], this.length = 0;
3270
3420
  }
@@ -3284,7 +3434,7 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3284
3434
  this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
3285
3435
  }
3286
3436
  }, t.exports = n;
3287
- })), Gt = /* @__PURE__ */ D(((e, t) => {
3437
+ })), Jt = /* @__PURE__ */ D(((e, t) => {
3288
3438
  function n(e) {
3289
3439
  if (!e || e < 1) throw Error("BitMatrix size must be defined and greater than 0");
3290
3440
  this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
@@ -3299,7 +3449,7 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3299
3449
  }, n.prototype.isReserved = function(e, t) {
3300
3450
  return this.reservedBit[e * this.size + t];
3301
3451
  }, t.exports = n;
3302
- })), Kt = /* @__PURE__ */ D(((e) => {
3452
+ })), Yt = /* @__PURE__ */ D(((e) => {
3303
3453
  var t = X().getSymbolSize;
3304
3454
  e.getRowColCoords = function(e) {
3305
3455
  if (e === 1) return [];
@@ -3311,7 +3461,7 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3311
3461
  for (let e = 0; e < i; e++) for (let t = 0; t < i; t++) e === 0 && t === 0 || e === 0 && t === i - 1 || e === i - 1 && t === 0 || n.push([r[e], r[t]]);
3312
3462
  return n;
3313
3463
  };
3314
- })), qt = /* @__PURE__ */ D(((e) => {
3464
+ })), Xt = /* @__PURE__ */ D(((e) => {
3315
3465
  var t = X().getSymbolSize, n = 7;
3316
3466
  e.getPositions = function(e) {
3317
3467
  let r = t(e);
@@ -3321,7 +3471,7 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3321
3471
  [0, r - n]
3322
3472
  ];
3323
3473
  };
3324
- })), Jt = /* @__PURE__ */ D(((e) => {
3474
+ })), Zt = /* @__PURE__ */ D(((e) => {
3325
3475
  e.Patterns = {
3326
3476
  PATTERN000: 0,
3327
3477
  PATTERN001: 1,
@@ -3397,8 +3547,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3397
3547
  }
3398
3548
  return i;
3399
3549
  };
3400
- })), Yt = /* @__PURE__ */ D(((e) => {
3401
- var t = Ut(), n = [
3550
+ })), Qt = /* @__PURE__ */ D(((e) => {
3551
+ var t = Kt(), n = [
3402
3552
  1,
3403
3553
  1,
3404
3554
  1,
@@ -3738,7 +3888,7 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3738
3888
  default: return;
3739
3889
  }
3740
3890
  };
3741
- })), Xt = /* @__PURE__ */ D(((e) => {
3891
+ })), $t = /* @__PURE__ */ D(((e) => {
3742
3892
  var t = new Uint8Array(512), n = new Uint8Array(256);
3743
3893
  (function() {
3744
3894
  let e = 1;
@@ -3752,8 +3902,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3752
3902
  }, e.mul = function(e, r) {
3753
3903
  return e === 0 || r === 0 ? 0 : t[n[e] + n[r]];
3754
3904
  };
3755
- })), Zt = /* @__PURE__ */ D(((e) => {
3756
- var t = Xt();
3905
+ })), en = /* @__PURE__ */ D(((e) => {
3906
+ var t = $t();
3757
3907
  e.mul = function(e, n) {
3758
3908
  let r = new Uint8Array(e.length + n.length - 1);
3759
3909
  for (let i = 0; i < e.length; i++) for (let a = 0; a < n.length; a++) r[i + a] ^= t.mul(e[i], n[a]);
@@ -3773,8 +3923,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3773
3923
  for (let i = 0; i < n; i++) r = e.mul(r, new Uint8Array([1, t.exp(i)]));
3774
3924
  return r;
3775
3925
  };
3776
- })), Qt = /* @__PURE__ */ D(((e, t) => {
3777
- var n = Zt();
3926
+ })), tn = /* @__PURE__ */ D(((e, t) => {
3927
+ var n = en();
3778
3928
  function r(e) {
3779
3929
  this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
3780
3930
  }
@@ -3791,11 +3941,11 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3791
3941
  }
3792
3942
  return r;
3793
3943
  }, t.exports = r;
3794
- })), $t = /* @__PURE__ */ D(((e) => {
3944
+ })), nn = /* @__PURE__ */ D(((e) => {
3795
3945
  e.isValid = function(e) {
3796
3946
  return !isNaN(e) && e >= 1 && e <= 40;
3797
3947
  };
3798
- })), en = /* @__PURE__ */ D(((e) => {
3948
+ })), rn = /* @__PURE__ */ D(((e) => {
3799
3949
  var t = "[0-9]+", n = "[A-Z $%*+\\-./:]+", r = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
3800
3950
  r = r.replace(/u/g, "\\u");
3801
3951
  var i = "(?:(?![A-Z0-9 $%*+\\-./:]|" + r + ")(?:.|[\r\n]))+";
@@ -3808,8 +3958,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3808
3958
  }, e.testAlphanumeric = function(e) {
3809
3959
  return s.test(e);
3810
3960
  };
3811
- })), tn = /* @__PURE__ */ D(((e) => {
3812
- var t = $t(), n = en();
3961
+ })), an = /* @__PURE__ */ D(((e) => {
3962
+ var t = nn(), n = rn();
3813
3963
  e.NUMERIC = {
3814
3964
  id: "Numeric",
3815
3965
  bit: 1,
@@ -3872,8 +4022,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3872
4022
  return n;
3873
4023
  }
3874
4024
  };
3875
- })), nn = /* @__PURE__ */ D(((e) => {
3876
- var t = X(), n = Yt(), r = Ut(), i = tn(), a = $t(), o = 7973, s = t.getBCHDigit(o);
4025
+ })), on = /* @__PURE__ */ D(((e) => {
4026
+ var t = X(), n = Qt(), r = Kt(), i = an(), a = nn(), o = 7973, s = t.getBCHDigit(o);
3877
4027
  function c(t, n, r) {
3878
4028
  for (let i = 1; i <= 40; i++) if (n <= e.getCapacity(i, r, t)) return i;
3879
4029
  }
@@ -3919,15 +4069,15 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3919
4069
  for (; t.getBCHDigit(n) - s >= 0;) n ^= o << t.getBCHDigit(n) - s;
3920
4070
  return e << 12 | n;
3921
4071
  };
3922
- })), rn = /* @__PURE__ */ D(((e) => {
4072
+ })), sn = /* @__PURE__ */ D(((e) => {
3923
4073
  var t = X(), n = 1335, r = 21522, i = t.getBCHDigit(n);
3924
4074
  e.getEncodedBits = function(e, a) {
3925
4075
  let o = e.bit << 3 | a, s = o << 10;
3926
4076
  for (; t.getBCHDigit(s) - i >= 0;) s ^= n << t.getBCHDigit(s) - i;
3927
4077
  return (o << 10 | s) ^ r;
3928
4078
  };
3929
- })), an = /* @__PURE__ */ D(((e, t) => {
3930
- var n = tn();
4079
+ })), cn = /* @__PURE__ */ D(((e, t) => {
4080
+ var n = an();
3931
4081
  function r(e) {
3932
4082
  this.mode = n.NUMERIC, this.data = e.toString();
3933
4083
  }
@@ -3943,8 +4093,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3943
4093
  let i = this.data.length - t;
3944
4094
  i > 0 && (n = this.data.substr(t), r = parseInt(n, 10), e.put(r, i * 3 + 1));
3945
4095
  }, t.exports = r;
3946
- })), on = /* @__PURE__ */ D(((e, t) => {
3947
- var n = tn(), r = /* @__PURE__ */ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
4096
+ })), ln = /* @__PURE__ */ D(((e, t) => {
4097
+ var n = an(), r = /* @__PURE__ */ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
3948
4098
  function i(e) {
3949
4099
  this.mode = n.ALPHANUMERIC, this.data = e;
3950
4100
  }
@@ -3962,8 +4112,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3962
4112
  }
3963
4113
  this.data.length % 2 && e.put(r.indexOf(this.data[t]), 6);
3964
4114
  }, t.exports = i;
3965
- })), sn = /* @__PURE__ */ D(((e, t) => {
3966
- var n = tn();
4115
+ })), un = /* @__PURE__ */ D(((e, t) => {
4116
+ var n = an();
3967
4117
  function r(e) {
3968
4118
  this.mode = n.BYTE, typeof e == "string" ? this.data = new TextEncoder().encode(e) : this.data = new Uint8Array(e);
3969
4119
  }
@@ -3976,8 +4126,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3976
4126
  }, r.prototype.write = function(e) {
3977
4127
  for (let t = 0, n = this.data.length; t < n; t++) e.put(this.data[t], 8);
3978
4128
  }, t.exports = r;
3979
- })), cn = /* @__PURE__ */ D(((e, t) => {
3980
- var n = tn(), r = X();
4129
+ })), dn = /* @__PURE__ */ D(((e, t) => {
4130
+ var n = an(), r = X();
3981
4131
  function i(e) {
3982
4132
  this.mode = n.KANJI, this.data = e;
3983
4133
  }
@@ -3997,7 +4147,7 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
3997
4147
  n = (n >>> 8 & 255) * 192 + (n & 255), e.put(n, 13);
3998
4148
  }
3999
4149
  }, t.exports = i;
4000
- })), ln = /* @__PURE__ */ D(((e, t) => {
4150
+ })), fn = /* @__PURE__ */ D(((e, t) => {
4001
4151
  var n = {
4002
4152
  single_source_shortest_paths: function(e, t, r) {
4003
4153
  var i = {}, a = {};
@@ -4050,8 +4200,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
4050
4200
  }
4051
4201
  };
4052
4202
  t !== void 0 && (t.exports = n);
4053
- })), un = /* @__PURE__ */ D(((e) => {
4054
- var t = tn(), n = an(), r = on(), i = sn(), a = cn(), o = en(), s = X(), c = ln();
4203
+ })), pn = /* @__PURE__ */ D(((e) => {
4204
+ var t = an(), n = cn(), r = ln(), i = un(), a = dn(), o = rn(), s = X(), c = fn();
4055
4205
  function l(e) {
4056
4206
  return unescape(encodeURIComponent(e)).length;
4057
4207
  }
@@ -4178,8 +4328,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
4178
4328
  }, e.rawSplit = function(t) {
4179
4329
  return e.fromArray(d(t, s.isKanjiModeEnabled()));
4180
4330
  };
4181
- })), dn = /* @__PURE__ */ D(((e) => {
4182
- var t = X(), n = Ut(), r = Wt(), i = Gt(), a = Kt(), o = qt(), s = Jt(), c = Yt(), l = Qt(), u = nn(), d = rn(), f = tn(), p = un();
4331
+ })), mn = /* @__PURE__ */ D(((e) => {
4332
+ var t = X(), n = Kt(), r = qt(), i = Jt(), a = Yt(), o = Xt(), s = Zt(), c = Qt(), l = tn(), u = on(), d = sn(), f = an(), p = pn();
4183
4333
  function m(e, t) {
4184
4334
  let n = e.size, r = o.getPositions(t);
4185
4335
  for (let t = 0; t < r.length; t++) {
@@ -4274,7 +4424,7 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
4274
4424
  let i = n.M, a, o;
4275
4425
  return r !== void 0 && (i = n.from(r.errorCorrectionLevel, n.M), a = u.from(r.version), o = s.from(r.maskPattern), r.toSJISFunc && t.setToSJISFunction(r.toSJISFunc)), S(e, a, i, o);
4276
4426
  };
4277
- })), fn = /* @__PURE__ */ D(((e) => {
4427
+ })), hn = /* @__PURE__ */ D(((e) => {
4278
4428
  function t(e) {
4279
4429
  if (typeof e == "number" && (e = e.toString()), typeof e != "string") throw Error("Color should be defined as hex string");
4280
4430
  let t = e.slice().replace("#", "").split("");
@@ -4321,8 +4471,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
4321
4471
  t[u++] = d.r, t[u++] = d.g, t[u++] = d.b, t[u] = d.a;
4322
4472
  }
4323
4473
  };
4324
- })), pn = /* @__PURE__ */ D(((e) => {
4325
- var t = fn();
4474
+ })), gn = /* @__PURE__ */ D(((e) => {
4475
+ var t = hn();
4326
4476
  function n(e, t, n) {
4327
4477
  e.clearRect(0, 0, t.width, t.height), t.style ||= {}, t.height = n, t.width = n, t.style.height = n + "px", t.style.width = n + "px";
4328
4478
  }
@@ -4344,8 +4494,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
4344
4494
  let a = e.render(t, n, i), o = i.type || "image/png", s = i.rendererOpts || {};
4345
4495
  return a.toDataURL(o, s.quality);
4346
4496
  };
4347
- })), mn = /* @__PURE__ */ D(((e) => {
4348
- var t = fn();
4497
+ })), _n = /* @__PURE__ */ D(((e) => {
4498
+ var t = hn();
4349
4499
  function n(e, t) {
4350
4500
  let n = e.a / 255, r = t + "=\"" + e.hex + "\"";
4351
4501
  return n < 1 ? r + " " + t + "-opacity=\"" + n.toFixed(2).slice(1) + "\"" : r;
@@ -4366,8 +4516,8 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
4366
4516
  let o = t.getOptions(r), s = e.modules.size, c = e.modules.data, l = s + o.margin * 2, u = o.color.light.a ? "<path " + n(o.color.light, "fill") + " d=\"M0 0h" + l + "v" + l + "H0z\"/>" : "", d = "<path " + n(o.color.dark, "stroke") + " d=\"" + i(c, s, o.margin) + "\"/>", f = "viewBox=\"0 0 " + l + " " + l + "\"", p = "<svg xmlns=\"http://www.w3.org/2000/svg\" " + (o.width ? "width=\"" + o.width + "\" height=\"" + o.width + "\" " : "") + f + " shape-rendering=\"crispEdges\">" + u + d + "</svg>\n";
4367
4517
  return typeof a == "function" && a(null, p), p;
4368
4518
  };
4369
- })), hn = /* @__PURE__ */ k((/* @__PURE__ */ D(((e) => {
4370
- var t = Ht(), n = dn(), r = pn(), i = mn();
4519
+ })), vn = /* @__PURE__ */ k((/* @__PURE__ */ D(((e) => {
4520
+ var t = Gt(), n = mn(), r = gn(), i = _n();
4371
4521
  function a(e, r, i, a, o) {
4372
4522
  let s = [].slice.call(arguments, 1), c = s.length, l = typeof s[c - 1] == "function";
4373
4523
  if (!l && !t()) throw Error("Callback required as last argument");
@@ -4395,10 +4545,10 @@ var Ht = /* @__PURE__ */ D(((e, t) => {
4395
4545
  return i.render(e, n);
4396
4546
  });
4397
4547
  })))(), 1);
4398
- async function gn(e, t = 200) {
4548
+ async function yn(e, t = 200) {
4399
4549
  if (!e || e.trim() === "") return "";
4400
4550
  try {
4401
- return await hn.toDataURL(e, {
4551
+ return await vn.toDataURL(e, {
4402
4552
  width: t,
4403
4553
  margin: 1,
4404
4554
  color: {
@@ -4413,13 +4563,13 @@ async function gn(e, t = 200) {
4413
4563
  }
4414
4564
  //#endregion
4415
4565
  //#region src/composables/usePaperSelection.ts
4416
- function _n(e) {
4566
+ function bn(e) {
4417
4567
  let n = f(null), r = f(null), i = f(null), a = t(() => n.value && e.value.find((e) => e.id === n.value) || null), o = t(() => r.value ? d(r.value) : null), s = t(() => i.value ? p(i.value) : null);
4418
4568
  function c(e) {
4419
- n.value = e, e && (r.value = null);
4569
+ n.value = e, e && (r.value = null, i.value = null);
4420
4570
  }
4421
4571
  function l(e) {
4422
- r.value = e, e && (n.value = null);
4572
+ r.value = e, e && (n.value = null, i.value = null);
4423
4573
  }
4424
4574
  function u(e) {
4425
4575
  i.value = e, e && (n.value = null, r.value = null);
@@ -4478,7 +4628,7 @@ function _n(e) {
4478
4628
  }
4479
4629
  //#endregion
4480
4630
  //#region src/composables/paperHelpers.ts
4481
- var vn = {
4631
+ var xn = {
4482
4632
  三号: 21,
4483
4633
  小三: 20,
4484
4634
  四号: 19,
@@ -4486,24 +4636,24 @@ var vn = {
4486
4636
  五号: 14,
4487
4637
  小五: 12
4488
4638
  };
4489
- function yn(e) {
4490
- return vn[e] ?? 14;
4639
+ function Sn(e) {
4640
+ return xn[e] ?? 16;
4491
4641
  }
4492
- function bn(e) {
4493
- for (let [t, n] of Object.entries(vn)) if (n === e) return t;
4642
+ function Cn(e) {
4643
+ for (let [t, n] of Object.entries(xn)) if (n === e) return t;
4494
4644
  return "五号";
4495
4645
  }
4496
4646
  function Z(e) {
4497
- return typeof e.fontSize == "number" ? e.fontSize : yn(e.fontSize || "五号");
4647
+ return typeof e.fontSize == "number" ? e.fontSize : Sn(e.fontSize || "小四");
4498
4648
  }
4499
4649
  function Q(e) {
4500
- return e.lineSpacing ?? 1.5;
4650
+ return e.lineSpacing ?? 1;
4501
4651
  }
4502
- function xn(e, t) {
4652
+ function wn(e, t) {
4503
4653
  return Math.round(e * t * 35 / (14 * 1.5));
4504
4654
  }
4505
4655
  function $(e, t) {
4506
- let n = xn(e, t);
4656
+ let n = wn(e, t);
4507
4657
  return {
4508
4658
  lines: [{
4509
4659
  elements: [{
@@ -4519,15 +4669,15 @@ function $(e, t) {
4519
4669
  height: n
4520
4670
  };
4521
4671
  }
4522
- function Sn(e, t, n, r, i = 0) {
4523
- let a = xn(t, n), o = r && r > 0 ? rt(e, r, a, i) : [nt(e, a)];
4672
+ function Tn(e, t, n, r, i = 0) {
4673
+ let a = wn(t, n), o = r && r > 0 ? rt(e, r, a, i) : [nt(e, a)];
4524
4674
  return {
4525
4675
  lines: o,
4526
4676
  y: 0,
4527
4677
  height: o.reduce((e, t) => e + t.lineHeight, 0) + 4
4528
4678
  };
4529
4679
  }
4530
- function Cn(e) {
4680
+ function En(e) {
4531
4681
  let t = e.paragraphs.length;
4532
4682
  for (; t > 0;) {
4533
4683
  let n = e.paragraphs[t - 1];
@@ -4536,14 +4686,14 @@ function Cn(e) {
4536
4686
  }
4537
4687
  return t;
4538
4688
  }
4539
- var wn = 0, Tn = 0;
4540
- function En(e) {
4689
+ var Dn = 0, On = 0;
4690
+ function kn(e) {
4541
4691
  return e.type === "question" ? (e.metadata?.questionNo || "").length > 2 ? 26.25 : 17.5 : e.type === "sub-question" ? 26.25 : 0;
4542
4692
  }
4543
- function Dn(e, t) {
4544
- return t - En(e);
4693
+ function An(e, t) {
4694
+ return t - kn(e);
4545
4695
  }
4546
- function On(e) {
4696
+ function jn(e) {
4547
4697
  let t = [], n = 0;
4548
4698
  for (; n < e.length;) {
4549
4699
  if (e[n] === "\\" && e.substring(n, n + 2) === "\\(") {
@@ -4574,11 +4724,11 @@ function On(e) {
4574
4724
  }
4575
4725
  return t;
4576
4726
  }
4577
- function kn(e, t) {
4578
- let n = [], r = On(e);
4579
- for (let e of r) if (e.type === "text") n.push(An(e.value, t, !1, "\"Times New Roman\", SimSun,'Cambria Math'", "#000"));
4727
+ function Mn(e, t) {
4728
+ let n = [], r = jn(e);
4729
+ for (let e of r) if (e.type === "text") n.push(Nn(e.value, t, !1, "\"Times New Roman\", SimSun,'Cambria Math'", "#000"));
4580
4730
  else if (e.type === "formula") {
4581
- let { svg: t, width: r, height: i } = K(e.value);
4731
+ let { svg: t, width: r, height: i } = De(e.value);
4582
4732
  n.push({
4583
4733
  type: "formula",
4584
4734
  width: r,
@@ -4588,7 +4738,7 @@ function kn(e, t) {
4588
4738
  });
4589
4739
  } else e.type === "blank" && n.push({
4590
4740
  type: "underline",
4591
- id: `ul-${++Tn}`,
4741
+ id: `ul-${++On}`,
4592
4742
  width: 80,
4593
4743
  height: 20,
4594
4744
  placeholder: "空",
@@ -4597,8 +4747,8 @@ function kn(e, t) {
4597
4747
  });
4598
4748
  return n;
4599
4749
  }
4600
- function An(e, t, n, r, i) {
4601
- let a = e.split(""), o = V(e, t, r);
4750
+ function Nn(e, t, n, r, i) {
4751
+ let a = e.split(""), o = B(e, t, r);
4602
4752
  return {
4603
4753
  type: "text",
4604
4754
  value: e,
@@ -4607,19 +4757,19 @@ function An(e, t, n, r, i) {
4607
4757
  bold: n,
4608
4758
  italic: !1,
4609
4759
  color: i,
4610
- width: o.length > 0 ? o[o.length - 1] + B(a[a.length - 1], t, r) : 0,
4760
+ width: o.length > 0 ? o[o.length - 1] + z(a[a.length - 1], t, r) : 0,
4611
4761
  height: t * 1.4,
4612
4762
  xPositions: o
4613
4763
  };
4614
4764
  }
4615
- function jn(e, t, n, r, i, a, o = !1) {
4765
+ function Pn(e, t, n, r, i, a, o = !1) {
4616
4766
  let s = [];
4617
4767
  for (let e = 0; e < n.length; e++) {
4618
- let t = kn(n[e], r);
4619
- s.push(Sn(t, r, i, a && a > 0 ? a : void 0));
4768
+ let t = Mn(n[e], r);
4769
+ s.push(Tn(t, r, i, a && a > 0 ? a : void 0));
4620
4770
  }
4621
4771
  for (let e = 0; e < 2; e++) s.push($(r, i));
4622
- let c = s.reduce((e, t) => e + (t.height || 26), 0), l = `topic-${e.replace(".", "")}-${++wn}`;
4772
+ let c = s.reduce((e, t) => e + (t.height || 26), 0), l = `topic-${e.replace(".", "")}-${++Dn}`;
4623
4773
  return {
4624
4774
  id: `q-${e.replace(".", "")}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
4625
4775
  type: "question",
@@ -4635,10 +4785,10 @@ function jn(e, t, n, r, i, a, o = !1) {
4635
4785
  }
4636
4786
  };
4637
4787
  }
4638
- function Mn(e, t, n, r, i, a, o = !1) {
4639
- let s = [], c = `group-${e.replace(".", "")}`, l = [], u = 0, d = (n, u) => {
4788
+ function Fn(e, t, n, r, i, a, o = !1) {
4789
+ let s = [], c = `group-${e.replace(".", "")}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, l = [], u = 0, d = (n, u) => {
4640
4790
  if (l.length === 0) return;
4641
- let d = l.map((e) => Sn(kn(e, r), r, i, a && a > 0 ? a : void 0));
4791
+ let d = l.map((e) => Tn(Mn(e, r), r, i, a && a > 0 ? a : void 0));
4642
4792
  if (!n) for (let e = 0; e < 2; e++) d.push($(r, i));
4643
4793
  let f = d.reduce((e, t) => e + (t.height || 26), 0), p = `${c}-${n ? "header" : `sub${u}`}`;
4644
4794
  s.push({
@@ -4664,7 +4814,7 @@ function Mn(e, t, n, r, i, a, o = !1) {
4664
4814
  }
4665
4815
  return d(s.length === 0, u), s;
4666
4816
  }
4667
- function Nn(e) {
4817
+ function In(e) {
4668
4818
  let t = [];
4669
4819
  for (let n of e.paragraphs) {
4670
4820
  if (n.lines.length > 0 && n.lines.every((e) => e.elements.length > 0 && e.elements.every((e) => e.type === "enter"))) continue;
@@ -4678,18 +4828,24 @@ function Nn(e) {
4678
4828
  }
4679
4829
  return t.join("\n");
4680
4830
  }
4681
- function Pn(e) {
4831
+ function Ln(e) {
4682
4832
  return e.metadata?.questionNo ? `第${e.metadata.questionNo.replace(".", "")}题` : e.metadata?.subLabel ? e.metadata.subLabel : e.metadata?.label || e.id;
4683
4833
  }
4684
4834
  //#endregion
4685
4835
  //#region src/composables/usePaperBlockOps.ts
4686
- function Fn(e) {
4687
- let { blocks: t, settings: n, pages: r, isDirty: i, layoutEngine: a, svgRenderer: o, paperName: s, schoolName: c, qrCodeContent: l, qrCodeImage: u, totalScore: d, selectedBlockId: f, findInlineImageById: p, findUnderlineById: m, relayout: h } = e;
4688
- function g() {
4836
+ function Rn(e) {
4837
+ let { blocks: t, settings: n, pages: r, isDirty: i, layoutEngine: a, svgRenderer: o, paperName: s, schoolName: c, qrCodeContent: l, qrCodeImage: u, totalScore: d, selectedBlockId: p, findInlineImageById: m, findUnderlineById: h, relayout: g } = e, _ = [], v = f(!1), y = !1;
4838
+ function b() {
4839
+ y || (_.push(H()), v.value = !0, i.value = !0);
4840
+ }
4841
+ function x() {
4842
+ _.length !== 0 && (y = !0, ue(_.pop()), y = !1, v.value = _.length > 0);
4843
+ }
4844
+ function S() {
4689
4845
  let e = Z(n.value), r = Q(n.value), s = a.value.columnWidth;
4690
4846
  s <= 0 || (t.value = t.value.map((t) => {
4691
4847
  if (!t.paragraphs || t.paragraphs.length === 0) return t;
4692
- let n = Dn(t, s), i = [], a = !1;
4848
+ let n = An(t, s), i = [], a = !1;
4693
4849
  for (let o = 0; o < t.paragraphs.length; o++) {
4694
4850
  let s = t.paragraphs[o];
4695
4851
  if (s.lines.length > 0 && s.lines.every((e) => e.elements.length > 0 && e.elements.every((e) => e.type === "enter"))) {
@@ -4697,21 +4853,21 @@ function Fn(e) {
4697
4853
  continue;
4698
4854
  }
4699
4855
  let c = [];
4700
- for (let e of s.lines) for (let t of e.elements) if (t.type === "text") {
4701
- let e = t, n = e.value.split("");
4702
- for (let t = 0; t < n.length; t++) {
4703
- let r = In(n[t], e.fontSize, e.fontFamily, e.bold, e.italic);
4856
+ for (let t of s.lines) for (let n of t.elements) if (n.type === "text") {
4857
+ let t = n, r = t.value.split("");
4858
+ for (let n = 0; n < r.length; n++) {
4859
+ let i = zn(r[n], e, t.fontFamily, t.bold, t.italic);
4704
4860
  c.push({
4705
- ...e,
4706
- value: n[t],
4707
- fontSize: e.fontSize,
4708
- width: r,
4709
- height: e.fontSize * 1.4,
4861
+ ...t,
4862
+ value: r[n],
4863
+ fontSize: e,
4864
+ width: i,
4865
+ height: e * 1.4,
4710
4866
  xPositions: [0]
4711
4867
  });
4712
4868
  }
4713
- } else if (t.type === "underline") {
4714
- let e = t;
4869
+ } else if (n.type === "underline") {
4870
+ let e = n;
4715
4871
  if (e.id) {
4716
4872
  let t = c.find((t) => t.type === "underline" && t.id === e.id);
4717
4873
  if (t) t.width += e.width;
@@ -4719,23 +4875,23 @@ function Fn(e) {
4719
4875
  let t = { ...e };
4720
4876
  delete t.isSplitPart, c.push(t);
4721
4877
  }
4722
- } else c.push(t);
4723
- } else c.push(t);
4878
+ } else c.push(n);
4879
+ } else c.push(n);
4724
4880
  let l;
4725
- if (a) l = Sn(c, e, r, n > 0 ? n : void 0, 0);
4881
+ if (a) l = Tn(c, e, r, n > 0 ? n : void 0, 0);
4726
4882
  else {
4727
- let i = t.metadata?.score || "", o = i ? oe(`(${i}分)`, e, "SimSun, STSong, serif") : 0;
4728
- l = Sn(c, e, r, n > 0 ? n : void 0, o), a = !0;
4883
+ let i = t.metadata?.score || "", o = i ? se(`(${i}分)`, e, "SimSun, STSong, serif") : 0;
4884
+ l = Tn(c, e, r, n > 0 ? n : void 0, o), a = !0;
4729
4885
  }
4730
4886
  t.paragraphs[o].justification && (l.justification = t.paragraphs[o].justification), i.push(l);
4731
4887
  }
4732
4888
  let c = 0;
4733
- t.options && t.options.length > 0 && (c = o.value.getOptionsHeight(t.options, Dn(t, s)));
4889
+ t.options && t.options.length > 0 && (c = o.value.getOptionsHeight(t.options, An(t, s)));
4734
4890
  let l = t.metadata?.customHeight;
4735
4891
  if (l) {
4736
4892
  let t = i.reduce((e, t) => e + (t.height || 26), 0) + c;
4737
4893
  if (l > t) {
4738
- let n = l - t, a = xn(e, r) + 4, o = Math.round(n / a);
4894
+ let n = l - t, a = wn(e, r) + 4, o = Math.round(n / a);
4739
4895
  for (let t = 0; t < o; t++) i.push($(e, r));
4740
4896
  }
4741
4897
  }
@@ -4749,12 +4905,13 @@ function Fn(e) {
4749
4905
  originalContentWidth: n
4750
4906
  }
4751
4907
  };
4752
- }), i.value = !0, h());
4908
+ }), i.value = !0, g());
4753
4909
  }
4754
- function _(e) {
4755
- t.value = [...t.value, e], N(), i.value = !0, h();
4910
+ function C(e) {
4911
+ b(), t.value = [...t.value, e], I(), i.value = !0, g();
4756
4912
  }
4757
- function v(e, n) {
4913
+ function w(e, n) {
4914
+ b();
4758
4915
  let r = {
4759
4916
  id: `title-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
4760
4917
  type: "title",
@@ -4774,35 +4931,39 @@ function Fn(e) {
4774
4931
  ...t.value.slice(e)
4775
4932
  ] : t.value = [...t.value, r];
4776
4933
  } else t.value = [...t.value, r];
4777
- i.value = !0, N(), h();
4934
+ i.value = !0, I(), g();
4778
4935
  }
4779
- function y(e) {
4936
+ function T(e) {
4937
+ b();
4780
4938
  let n = new Map(t.value.map((e) => [e.id, e])), r = e.map((e) => n.get(e)).filter((e) => !!e);
4781
- r.length === t.value.length && (t.value = r, N(), i.value = !0, h());
4939
+ r.length === t.value.length && (t.value = r, I(), i.value = !0, g());
4782
4940
  }
4783
- function b(e) {
4784
- t.value = t.value.filter((t) => t.id !== e), f.value === e && (f.value = null), N(), i.value = !0, h();
4941
+ function E(e) {
4942
+ b(), t.value = t.value.filter((t) => t.id !== e), p.value === e && (p.value = null), I(), i.value = !0, g();
4785
4943
  }
4786
- function x(e, n) {
4944
+ function D(e, n) {
4945
+ b();
4787
4946
  let r = t.value.find((t) => t.id === e);
4788
4947
  r && (r.metadata = {
4789
4948
  ...r.metadata,
4790
4949
  label: n
4791
- }, i.value = !0, h());
4950
+ }, i.value = !0, g());
4792
4951
  }
4793
- function S(e, r) {
4952
+ function O(e, r) {
4953
+ b();
4794
4954
  let a = t.value.findIndex((t) => t.id === e);
4795
4955
  if (a === -1) return;
4796
- let o = t.value[a], s = Z(n.value), c = Q(n.value), l = Math.max(0, o.paragraphs.length - Cn(o)), u = [...r];
4956
+ let o = t.value[a], s = Z(n.value), c = Q(n.value), l = Math.max(0, o.paragraphs.length - En(o)), u = [...r];
4797
4957
  for (let e = 0; e < l; e++) u.push($(s, c));
4798
4958
  let d = u.reduce((e, t) => e + (t.height || 26), 0);
4799
4959
  t.value = t.value.map((e, t) => t === a ? {
4800
4960
  ...e,
4801
4961
  paragraphs: u,
4802
4962
  height: d
4803
- } : e), i.value = !0, h();
4963
+ } : e), i.value = !0, g();
4804
4964
  }
4805
- function C(e, n) {
4965
+ function k(e, n) {
4966
+ b();
4806
4967
  let r = t.value.findIndex((t) => t.id === e);
4807
4968
  r !== -1 && (t.value = t.value.map((e, t) => t === r ? {
4808
4969
  ...e,
@@ -4810,24 +4971,26 @@ function Fn(e) {
4810
4971
  ...e.metadata,
4811
4972
  score: n
4812
4973
  }
4813
- } : e), i.value = !0, h());
4974
+ } : e), i.value = !0, g());
4814
4975
  }
4815
- function w(e) {
4976
+ function A(e) {
4977
+ b();
4816
4978
  let n = t.value.findIndex((t) => t.id === e);
4817
4979
  if (n === -1) return;
4818
4980
  let r = t.value[n].protectContent === !0;
4819
4981
  t.value = t.value.map((e, t) => t === n ? {
4820
4982
  ...e,
4821
4983
  protectContent: !r
4822
- } : e), i.value = !0, h();
4984
+ } : e), i.value = !0, g();
4823
4985
  }
4824
- function T(e) {
4825
- n.value = {
4986
+ function j(e) {
4987
+ b(), n.value = {
4826
4988
  ...n.value,
4827
4989
  showScore: e
4828
- }, i.value = !0, h();
4990
+ }, i.value = !0, g();
4829
4991
  }
4830
- function E(e, n) {
4992
+ function M(e, n) {
4993
+ b();
4831
4994
  let r = t.value.findIndex((t) => t.id === e);
4832
4995
  r !== -1 && (t.value = t.value.map((e, t) => {
4833
4996
  if (t !== r) return e;
@@ -4838,32 +5001,35 @@ function Fn(e) {
4838
5001
  };
4839
5002
  }), i.value = !0);
4840
5003
  }
4841
- function D(e, r) {
5004
+ function ee(e, r) {
5005
+ b();
4842
5006
  let s = t.value.findIndex((t) => t.id === e);
4843
5007
  if (s === -1) return;
4844
- let c = t.value[s], l = Z(n.value), u = Q(n.value), d = xn(l, u) + 4, f = 0;
4845
- c.options && c.options.length > 0 && (f = o.value.getOptionsHeight(c.options, Dn(c, a.value.columnWidth)));
4846
- let p = Cn(c), m = c.paragraphs.slice(0, p), g = m.reduce((e, t) => e + (t.height || 26), 0) + f, _ = Math.max(0, r - g), v = Math.round(_ / d), y = [];
5008
+ let c = t.value[s], l = Z(n.value), u = Q(n.value), d = wn(l, u) + 4, f = 0;
5009
+ c.options && c.options.length > 0 && (f = o.value.getOptionsHeight(c.options, An(c, a.value.columnWidth)));
5010
+ let p = En(c), m = c.paragraphs.slice(0, p), h = m.reduce((e, t) => e + (t.height || 26), 0) + f, _ = Math.max(0, r - h), v = Math.round(_ / d), y = [];
4847
5011
  for (let e = 0; e < v; e++) y.push($(l, u));
4848
- let b = [...m, ...y], x = b.reduce((e, t) => e + (t.height || 26), 0);
5012
+ let x = [...m, ...y], S = x.reduce((e, t) => e + (t.height || 26), 0);
4849
5013
  t.value = t.value.map((e, t) => t === s ? {
4850
5014
  ...e,
4851
- paragraphs: b,
4852
- height: x,
5015
+ paragraphs: x,
5016
+ height: S,
4853
5017
  metadata: {
4854
5018
  ...e.metadata,
4855
- customHeight: x
5019
+ customHeight: S
4856
5020
  }
4857
- } : e), i.value = !0, h();
5021
+ } : e), i.value = !0, g();
4858
5022
  }
4859
- function O(e, n) {
5023
+ function N(e, n) {
5024
+ b();
4860
5025
  let r = t.value.findIndex((t) => t.id === e);
4861
5026
  r !== -1 && (t.value = t.value.map((e, t) => t === r ? {
4862
5027
  ...e,
4863
5028
  questionType: n
4864
5029
  } : e), i.value = !0);
4865
5030
  }
4866
- function k(e, n) {
5031
+ function P(e, n) {
5032
+ b();
4867
5033
  let r = t.value.findIndex((t) => t.id === e);
4868
5034
  r !== -1 && (t.value = t.value.map((e, t) => {
4869
5035
  if (t !== r) return e;
@@ -4875,16 +5041,17 @@ function Fn(e) {
4875
5041
  ...e,
4876
5042
  paragraphs: i
4877
5043
  };
4878
- }), i.value = !0, h());
5044
+ }), i.value = !0, g());
4879
5045
  }
4880
- function A(e, n) {
5046
+ function F(e, n) {
5047
+ b();
4881
5048
  let r = t.value.findIndex((t) => t.id === e);
4882
5049
  r !== -1 && (t.value = t.value.map((e, t) => t === r ? {
4883
5050
  ...e,
4884
5051
  keepNext: n
4885
- } : e), i.value = !0, h());
5052
+ } : e), i.value = !0, g());
4886
5053
  }
4887
- function j(e, n) {
5054
+ function te(e, n) {
4888
5055
  let r = t.value.findIndex((t) => t.id === e);
4889
5056
  if (r === -1) {
4890
5057
  console.warn(`[usePaperCore] patchBlock: block ${e} not found`);
@@ -4905,7 +5072,7 @@ function Fn(e) {
4905
5072
  ...n
4906
5073
  } : e), i.value = !0;
4907
5074
  }
4908
- function M(e) {
5075
+ function ne(e) {
4909
5076
  let n = /* @__PURE__ */ new Map();
4910
5077
  for (let t of e) {
4911
5078
  let e = n.get(t.id) || [];
@@ -4927,17 +5094,17 @@ function Fn(e) {
4927
5094
  };
4928
5095
  }), i.value = !0;
4929
5096
  }
4930
- function N() {
5097
+ function I() {
4931
5098
  let e = 0, n = 0, r = [];
4932
5099
  for (let i of t.value) if (i.type === "title") {
4933
5100
  e++;
4934
- let t = i.metadata?.title || Rt(i.metadata?.label || "") || "题组";
5101
+ let t = i.metadata?.title ?? (Vt(i.metadata?.label || "") || "题组");
4935
5102
  r.push({
4936
5103
  id: i.id,
4937
5104
  metadata: {
4938
5105
  title: t,
4939
5106
  ordinal: e,
4940
- label: Lt(t, e)
5107
+ label: Bt(t, e)
4941
5108
  }
4942
5109
  });
4943
5110
  } else if (i.type === "question") {
@@ -4951,25 +5118,27 @@ function Fn(e) {
4951
5118
  }
4952
5119
  });
4953
5120
  }
4954
- M(r);
5121
+ ne(r);
4955
5122
  }
4956
- function P(e, t) {
4957
- j(e, { metadata: { title: t } }), N(), i.value = !0, h();
5123
+ function L(e, t) {
5124
+ b(), te(e, { metadata: { title: t } }), I(), i.value = !0, g();
4958
5125
  }
4959
- function F(e, r = !1) {
5126
+ function re(e, r = !1) {
5127
+ b();
4960
5128
  let o = e.content.split("\n").filter((e) => e.trim());
4961
5129
  o.length === 0 && o.push("");
4962
- let s = e.score ? `(${e.score}分)` : "", c = o.some((e) => /^\(\d+\)\s*/.test(e)), l = Z(n.value), u = Q(n.value), d = a.value.columnWidth, p;
4963
- if (c) p = Mn(e.no, s, o, l, u, d - 26.25, r);
5130
+ let s = e.score ? `(${e.score}分)` : "", c = o.some((e) => /^\(\d+\)\s*/.test(e)), l = Z(n.value), u = Q(n.value), d = a.value.columnWidth, f;
5131
+ if (c) f = Fn(e.no, s, o, l, u, d - 26.25, r);
4964
5132
  else {
4965
5133
  let t = e.no.length > 2 ? 26.25 : 17.5;
4966
- p = [jn(e.no, s, o, l, u, d - t, r)];
5134
+ f = [Pn(e.no, s, o, l, u, d - t, r)];
4967
5135
  }
4968
- for (let e of p) t.value = [...t.value, e];
4969
- p.length > 0 && (f.value = p[p.length - 1].id), N(), i.value = !0, g();
5136
+ for (let e of f) t.value = [...t.value, e];
5137
+ f.length > 0 && (p.value = f[f.length - 1].id), I(), i.value = !0, S();
4970
5138
  }
4971
- function I(e, r, o, s = !1) {
4972
- let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, p = xt(e, {
5139
+ function ie(e, r, o, s = !1) {
5140
+ b();
5141
+ let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, f = xt(e, {
4973
5142
  questionNo: r || "",
4974
5143
  score: o || "",
4975
5144
  contentWidth: u - d,
@@ -4977,17 +5146,18 @@ function Fn(e) {
4977
5146
  lineSpacing: l,
4978
5147
  protectContent: s
4979
5148
  });
4980
- for (let e of p) t.value = [...t.value, e];
4981
- p.length > 0 && (f.value = p[p.length - 1].id), N(), i.value = !0, g();
5149
+ for (let e of f) t.value = [...t.value, e];
5150
+ f.length > 0 && (p.value = f[f.length - 1].id), I(), i.value = !0, S();
4982
5151
  }
4983
- function ee(e, r, o, s = !1) {
4984
- let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, p;
5152
+ function ae(e, r, o, s = !1) {
5153
+ b();
5154
+ let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, f;
4985
5155
  try {
4986
- p = JSON.parse(e);
5156
+ f = JSON.parse(e);
4987
5157
  } catch {
4988
5158
  throw Error("JSON 格式错误,请检查");
4989
5159
  }
4990
- let m = Mt(p, {
5160
+ let m = Nt(f, {
4991
5161
  questionNo: r || "",
4992
5162
  score: o || "",
4993
5163
  contentWidth: u - d,
@@ -4996,16 +5166,83 @@ function Fn(e) {
4996
5166
  protectContent: s
4997
5167
  });
4998
5168
  for (let e of m) t.value = [...t.value, e];
4999
- m.length > 0 && (f.value = m[m.length - 1].id), N(), i.value = !0, g();
5169
+ m.length > 0 && (p.value = m[m.length - 1].id), I(), i.value = !0, S();
5170
+ }
5171
+ function R(e) {
5172
+ b();
5173
+ let r = t.value.filter((t) => t.metadata?.blockGroup === e);
5174
+ if (r.length < 2) return;
5175
+ let a = r.find((e) => e.type === "question") || r[0], o = Z(n.value), s = Q(n.value), c = [];
5176
+ for (let e of r) {
5177
+ let t = En(e);
5178
+ c.push(...e.paragraphs.slice(0, t));
5179
+ }
5180
+ for (let e = 0; e < 2; e++) c.push($(o, s));
5181
+ let l = c.reduce((e, t) => e + (t.height || 26), 0), u = {}, d = a.metadata?.answer || "";
5182
+ for (let e of r) if (e.type === "sub-question" && e.metadata?.answer) {
5183
+ let t = e.metadata.subLabel || "", n = e.metadata.answer;
5184
+ t && (u[t] = n, d += (d ? "\n" : "") + t + n);
5185
+ }
5186
+ let f = {
5187
+ ...a,
5188
+ id: `merged-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
5189
+ paragraphs: c,
5190
+ height: l,
5191
+ metadata: {
5192
+ ...a.metadata,
5193
+ answer: d || a.metadata?.answer,
5194
+ blockGroup: void 0,
5195
+ hasSubQuestions: !0,
5196
+ subAnswers: Object.keys(u).length > 0 ? u : void 0,
5197
+ _splitBackup: JSON.stringify(r.map((e) => ({
5198
+ ...e,
5199
+ paragraphs: e.paragraphs.map((e) => ({
5200
+ ...e,
5201
+ lines: e.lines.map((e) => ({
5202
+ ...e,
5203
+ elements: e.elements.map((e) => ({ ...e }))
5204
+ }))
5205
+ }))
5206
+ })))
5207
+ }
5208
+ }, p = new Set(r.map((e) => e.id)), m = t.value.findIndex((e) => p.has(e.id));
5209
+ if (m === -1) t.value = [...t.value.filter((e) => !p.has(e.id)), f];
5210
+ else {
5211
+ let e = t.value.slice(0, m), n = t.value.slice(m).filter((e) => !p.has(e.id));
5212
+ t.value = [
5213
+ ...e,
5214
+ f,
5215
+ ...n
5216
+ ];
5217
+ }
5218
+ I(), i.value = !0, S();
5000
5219
  }
5001
- function te(e, t, n) {
5002
- let r = p(e);
5220
+ function oe(e) {
5221
+ let n = t.value.find((t) => t.id === e);
5222
+ if (n?.metadata?._splitBackup) {
5223
+ b();
5224
+ try {
5225
+ let r = JSON.parse(n.metadata._splitBackup), a = t.value.findIndex((t) => t.id === e);
5226
+ if (a === -1) return;
5227
+ t.value = [
5228
+ ...t.value.slice(0, a),
5229
+ ...r,
5230
+ ...t.value.slice(a + 1)
5231
+ ], I(), i.value = !0, S();
5232
+ } catch (e) {
5233
+ console.warn("[splitMergedBlock] _splitBackup 解析失败", e);
5234
+ }
5235
+ }
5236
+ }
5237
+ function z(e, t, n) {
5238
+ b();
5239
+ let r = m(e);
5003
5240
  if (!r) return;
5004
- let o = Dn(r.block, a.value.columnWidth), s = Math.max(20, Math.min(Math.round(t), Math.max(20, o)));
5005
- r.image.width = s, n !== void 0 && (r.image.height = Math.max(12, Math.round(n))), i.value = !0, g();
5241
+ let o = An(r.block, a.value.columnWidth), s = Math.max(20, Math.min(Math.round(t), Math.max(20, o)));
5242
+ r.image.width = s, n !== void 0 && (r.image.height = Math.max(12, Math.round(n))), i.value = !0, S();
5006
5243
  }
5007
- function L(e) {
5008
- let t = p(e);
5244
+ function B(e) {
5245
+ let t = m(e);
5009
5246
  if (!t) return null;
5010
5247
  let n = t.block.paragraphs[t.paraIdx];
5011
5248
  return {
@@ -5013,21 +5250,23 @@ function Fn(e) {
5013
5250
  alignment: n.justification || "left"
5014
5251
  };
5015
5252
  }
5016
- function R(e, t) {
5017
- let n = p(e);
5253
+ function ce(e, t) {
5254
+ b();
5255
+ let n = m(e);
5018
5256
  if (!n) return;
5019
5257
  let r = n.block.paragraphs[n.paraIdx];
5020
- r.justification = t === "left" ? void 0 : t, i.value = !0, h();
5258
+ r.justification = t === "left" ? void 0 : t, i.value = !0, g();
5021
5259
  }
5022
- function ne(e, t) {
5023
- let n = Math.max(30, Math.min(500, Math.round(t))), r = m(e);
5024
- r && (r.underline.width = n, g());
5260
+ function le(e, t) {
5261
+ b();
5262
+ let n = Math.max(30, Math.min(500, Math.round(t))), r = h(e);
5263
+ r && (r.underline.width = n, S());
5025
5264
  }
5026
- function re(e, t, r, i) {
5265
+ function V(e, t, r, i) {
5027
5266
  let o = t ?? Z(n.value), s = r ?? Q(n.value), c = i ?? a.value.columnWidth - 17.5, l = e.split("\n").filter((e) => e.trim());
5028
- return l.length === 0 && l.push(""), l.map((e) => Sn(kn(e, o), o, s, c > 0 ? c : void 0));
5267
+ return l.length === 0 && l.push(""), l.map((e) => Tn(Mn(e, o), o, s, c > 0 ? c : void 0));
5029
5268
  }
5030
- function ie() {
5269
+ function H() {
5031
5270
  return ht(t.value, n.value, {
5032
5271
  paperName: s.value,
5033
5272
  schoolName: c.value,
@@ -5038,53 +5277,58 @@ function Fn(e) {
5038
5277
  blocks: t.value
5039
5278
  });
5040
5279
  }
5041
- function z(e, r) {
5280
+ function ue(e, r) {
5042
5281
  let o = gt(e);
5043
- t.value = o.blocks, o.settings && typeof o.settings.fontSize == "string" && (o.settings.fontSize = yn(o.settings.fontSize)), n.value = {
5282
+ t.value = o.blocks, o.settings && typeof o.settings.fontSize == "string" && (o.settings.fontSize = Sn(o.settings.fontSize)), n.value = {
5044
5283
  ...n.value,
5045
5284
  ...o.settings
5046
- }, a.value.updateSettings(o.settings), o.paperName && (s.value = o.paperName), o.schoolName && (c.value = o.schoolName), o.qrCodeContent && (l.value = o.qrCodeContent), o.qrCodeImage && (u.value = o.qrCodeImage), N(), r ? h() : g(), i.value = !1;
5285
+ }, a.value.updateSettings(o.settings), o.paperName && (s.value = o.paperName), o.schoolName && (c.value = o.schoolName), o.qrCodeContent && (l.value = o.qrCodeContent), o.qrCodeImage && (u.value = o.qrCodeImage), I(), r ? g() : S(), i.value = !1;
5047
5286
  }
5048
5287
  return {
5049
- reflowAllBlocks: g,
5050
- addBlock: _,
5051
- addTitleBlock: v,
5052
- reorderBlocks: y,
5053
- removeBlock: b,
5054
- updateBlockLabel: x,
5055
- updateBlockContent: S,
5056
- updateBlockScore: C,
5057
- toggleContentProtection: w,
5058
- updateShowScore: T,
5059
- updateBlockQid: E,
5060
- updateBlockHeight: D,
5061
- updateBlockQuestionType: O,
5062
- updateBlockSplit: k,
5063
- updateBlockKeepNext: A,
5064
- patchBlock: j,
5065
- patchBlocksMeta: M,
5066
- recalculateNumbering: N,
5067
- updateSectionTitle: P,
5068
- addNewQuestion: F,
5069
- addQuestionFromHtml: I,
5070
- addQuestionFromJson: ee,
5071
- updateInlineImageSize: te,
5072
- getImageParagraphInfo: L,
5073
- updateImageAlignment: R,
5074
- updateUnderlineWidth: ne,
5075
- parseTextToParagraphs: re,
5076
- saveDocument: ie,
5077
- loadDocument: z,
5078
- getBlockPlainText: Nn,
5079
- getBlockLabel: Pn,
5080
- getBlockAvailableWidth: Dn
5288
+ reflowAllBlocks: S,
5289
+ saveUndoSnapshot: b,
5290
+ undo: x,
5291
+ canUndo: v,
5292
+ addBlock: C,
5293
+ addTitleBlock: w,
5294
+ reorderBlocks: T,
5295
+ removeBlock: E,
5296
+ updateBlockLabel: D,
5297
+ updateBlockContent: O,
5298
+ updateBlockScore: k,
5299
+ toggleContentProtection: A,
5300
+ updateShowScore: j,
5301
+ updateBlockQid: M,
5302
+ updateBlockHeight: ee,
5303
+ updateBlockQuestionType: N,
5304
+ updateBlockSplit: P,
5305
+ updateBlockKeepNext: F,
5306
+ patchBlock: te,
5307
+ patchBlocksMeta: ne,
5308
+ recalculateNumbering: I,
5309
+ updateSectionTitle: L,
5310
+ addNewQuestion: re,
5311
+ addQuestionFromHtml: ie,
5312
+ addQuestionFromJson: ae,
5313
+ updateInlineImageSize: z,
5314
+ getImageParagraphInfo: B,
5315
+ updateImageAlignment: ce,
5316
+ updateUnderlineWidth: le,
5317
+ parseTextToParagraphs: V,
5318
+ saveDocument: H,
5319
+ loadDocument: ue,
5320
+ getBlockPlainText: In,
5321
+ getBlockLabel: Ln,
5322
+ getBlockAvailableWidth: An,
5323
+ mergeSubQuestionGroup: R,
5324
+ splitMergedBlock: oe
5081
5325
  };
5082
5326
  }
5083
- var In = B;
5327
+ var zn = z;
5084
5328
  //#endregion
5085
5329
  //#region src/composables/usePaperCore.ts
5086
- function Ln(e = {}) {
5087
- let n = f(e.renderMode ?? "edit"), r = m(new ee()), i = m(new Se({ renderMode: n.value })), a = m([]), o = f([]), s = f({ ...r.value.settings }), c = f(""), l = f(""), u = f(""), d = f([]), p = t(() => d.value[0] || ""), h = f(!1), g = f(0), _ = t(() => {
5330
+ function Bn(e = {}) {
5331
+ let n = f(e.renderMode ?? "edit"), r = m(new te()), i = m(new Se({ renderMode: n.value })), a = m([]), o = f([]), s = f({ ...r.value.settings }), c = f(""), l = f(""), u = f(""), d = f([]), p = t(() => d.value[0] || ""), h = f(!1), g = f(0), _ = t(() => {
5088
5332
  let e = 0, t = /* @__PURE__ */ new Set();
5089
5333
  for (let n of a.value) {
5090
5334
  let r = n.metadata?.score || "";
@@ -5098,7 +5342,7 @@ function Ln(e = {}) {
5098
5342
  a && (e += parseInt(a[1]));
5099
5343
  }
5100
5344
  return e;
5101
- }), y = _n(a), b = Fn({
5345
+ }), y = bn(a), b = Rn({
5102
5346
  blocks: a,
5103
5347
  settings: s,
5104
5348
  pages: o,
@@ -5122,7 +5366,7 @@ function Ln(e = {}) {
5122
5366
  d.value = [];
5123
5367
  return;
5124
5368
  }
5125
- d.value = await Promise.all(Array.from({ length: t }, (t, n) => gn(e + String(n))));
5369
+ d.value = await Promise.all(Array.from({ length: t }, (t, n) => yn(e + String(n))));
5126
5370
  }, { immediate: !0 });
5127
5371
  function x(e) {
5128
5372
  n.value = e, i.value.setRenderMode(e);
@@ -5136,7 +5380,7 @@ function Ln(e = {}) {
5136
5380
  g.value++;
5137
5381
  }
5138
5382
  function C(e) {
5139
- Object.assign(s.value, e), r.value.updateSettings(e), b.reflowAllBlocks();
5383
+ b.saveUndoSnapshot(), Object.assign(s.value, e), r.value.updateSettings(e), b.reflowAllBlocks();
5140
5384
  }
5141
5385
  function w(e) {
5142
5386
  C({ paperSize: e });
@@ -5175,6 +5419,9 @@ function Ln(e = {}) {
5175
5419
  setRenderMode: x,
5176
5420
  relayout: S,
5177
5421
  reflowAllBlocks: b.reflowAllBlocks,
5422
+ saveUndoSnapshot: b.saveUndoSnapshot,
5423
+ undo: b.undo,
5424
+ canUndo: b.canUndo,
5178
5425
  updateSettings: C,
5179
5426
  setPaperSize: w,
5180
5427
  setColumns: T,
@@ -5214,6 +5461,8 @@ function Ln(e = {}) {
5214
5461
  updateSectionTitle: b.updateSectionTitle,
5215
5462
  patchBlock: b.patchBlock,
5216
5463
  patchBlocksMeta: b.patchBlocksMeta,
5464
+ mergeSubQuestionGroup: b.mergeSubQuestionGroup,
5465
+ splitMergedBlock: b.splitMergedBlock,
5217
5466
  saveDocument: b.saveDocument,
5218
5467
  loadDocument: b.loadDocument,
5219
5468
  layoutEngine: r,
@@ -5222,8 +5471,8 @@ function Ln(e = {}) {
5222
5471
  }
5223
5472
  //#endregion
5224
5473
  //#region src/composables/usePageSvgRenderer.ts
5225
- var Rn = "<defs><g id=\"enter\"><path d=\"M810.667 213.333a42.667 42.667 0 0 1 42.368 37.675l0.298 4.992v274.304c0 79.275-50.944 147.499-120.49 152.107l-7.51 0.256H273.707l97.792 97.834a42.667 42.667 0 0 1-56.32 63.872l-4.011-3.541-170.667-170.667a42.667 42.667 0 0 1 0-60.33l170.667-170.667a42.667 42.667 0 0 1 63.872 56.32l-3.541 4.01-97.792 97.835h451.626c19.584 0 39.936-24.618 42.411-59.861l0.256-7.168V256a42.667 42.667 0 0 1 42.667-42.667z\" fill=\"currentColor\"/></g></defs>";
5226
- function zn(e, n = {}) {
5474
+ var Vn = "<defs><g id=\"enter\"><path d=\"M810.667 213.333a42.667 42.667 0 0 1 42.368 37.675l0.298 4.992v274.304c0 79.275-50.944 147.499-120.49 152.107l-7.51 0.256H273.707l97.792 97.834a42.667 42.667 0 0 1-56.32 63.872l-4.011-3.541-170.667-170.667a42.667 42.667 0 0 1 0-60.33l170.667-170.667a42.667 42.667 0 0 1 63.872 56.32l-3.541 4.01-97.792 97.835h451.626c19.584 0 39.936-24.618 42.411-59.861l0.256-7.168V256a42.667 42.667 0 0 1 42.667-42.667z\" fill=\"currentColor\"/></g></defs>";
5475
+ function Hn(e, n = {}) {
5227
5476
  return t(() => {
5228
5477
  e.renderMode.value;
5229
5478
  let t = e.pages.value;
@@ -5239,13 +5488,13 @@ function zn(e, n = {}) {
5239
5488
  qrCodeImage: e.qrCodeImage.value,
5240
5489
  qrCodeImages: e.qrCodeImages.value
5241
5490
  }, t.length);
5242
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${r * o}" height="${i * o}" viewBox="0 0 ${r} ${i}" class="paper-page">\n${Rn}\n${l}</svg>`;
5491
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${r * o}" height="${i * o}" viewBox="0 0 ${r} ${i}" class="paper-page">\n${Vn}\n${l}</svg>`;
5243
5492
  });
5244
5493
  });
5245
5494
  }
5246
5495
  //#endregion
5247
5496
  //#region src/composables/useTableRenderer.ts
5248
- async function Bn(e, t, n = 2) {
5497
+ async function Un(e, t, n = 2) {
5249
5498
  let r = [];
5250
5499
  for (let t = 0; t < e.length; t++) {
5251
5500
  let n = e[t];
@@ -5272,7 +5521,7 @@ async function Bn(e, t, n = 2) {
5272
5521
  if (r.length !== 0) for (let i = 0; i < r.length; i++) {
5273
5522
  let a = r[i];
5274
5523
  try {
5275
- let r = await Vn(a.rawHtml, t, n);
5524
+ let r = await Wn(a.rawHtml, t, n);
5276
5525
  if (r) {
5277
5526
  let t = e[a.blockIdx].paragraphs[a.paraIdx].lines[a.lineIdx].elements[a.elemIdx];
5278
5527
  t.src = r, delete t.rawHtml;
@@ -5282,7 +5531,7 @@ async function Bn(e, t, n = 2) {
5282
5531
  }
5283
5532
  }
5284
5533
  }
5285
- async function Vn(e, t, n) {
5534
+ async function Wn(e, t, n) {
5286
5535
  let r = document.createElement("div");
5287
5536
  r.innerHTML = e, r.style.position = "absolute", r.style.left = "-9999px", r.style.top = "0", r.style.width = "auto", r.style.height = "auto";
5288
5537
  let i = document.createElement("style");
@@ -5303,7 +5552,7 @@ async function Vn(e, t, n) {
5303
5552
  document.body.removeChild(r);
5304
5553
  }
5305
5554
  }
5306
- function Hn(e) {
5555
+ function Gn(e) {
5307
5556
  for (let t of e) if (t.paragraphs) {
5308
5557
  for (let e of t.paragraphs) if (e.lines) {
5309
5558
  for (let t of e.lines) if (t.elements) {
@@ -5318,7 +5567,7 @@ function Hn(e) {
5318
5567
  }
5319
5568
  //#endregion
5320
5569
  //#region src/composables/usePaperCursor.ts
5321
- function Un(e, t, n, r) {
5570
+ function Kn(e, t, n, r) {
5322
5571
  let i = f({
5323
5572
  blockId: null,
5324
5573
  paraIndex: 0,
@@ -5371,7 +5620,7 @@ function Un(e, t, n, r) {
5371
5620
  }
5372
5621
  function d(e, t) {
5373
5622
  if (!e) return [];
5374
- let n = e.split(""), r = V(e, t.fontSize, t.fontFamily, t.bold, t.italic), i = r.length > 0 ? r[r.length - 1] + B(n[n.length - 1], t.fontSize, t.fontFamily, t.bold, t.italic) : 0;
5623
+ let n = e.split(""), r = B(e, t.fontSize, t.fontFamily, t.bold, t.italic), i = r.length > 0 ? r[r.length - 1] + z(n[n.length - 1], t.fontSize, t.fontFamily, t.bold, t.italic) : 0;
5375
5624
  return [{
5376
5625
  type: "text",
5377
5626
  value: e,
@@ -5386,7 +5635,7 @@ function Un(e, t, n, r) {
5386
5635
  }];
5387
5636
  }
5388
5637
  function p(e) {
5389
- let n = Z(t.value), r = Q(t.value), i = xn(n, r);
5638
+ let n = Z(t.value), r = Q(t.value), i = wn(n, r);
5390
5639
  return e.length === 0 || e.length === 1 && e[0].type === "enter" ? $(n, r) : {
5391
5640
  lines: [{
5392
5641
  elements: e,
@@ -5430,7 +5679,7 @@ function Un(e, t, n, r) {
5430
5679
  else {
5431
5680
  let e = t - i, c = o.value.substring(0, e), l = o.value.substring(e);
5432
5681
  if (c) {
5433
- let e = V(c, o.fontSize, o.fontFamily, o.bold, o.italic), t = e.length > 0 ? e[e.length - 1] + B(c[c.length - 1], o.fontSize, o.fontFamily, o.bold, o.italic) : 0;
5682
+ let e = B(c, o.fontSize, o.fontFamily, o.bold, o.italic), t = e.length > 0 ? e[e.length - 1] + z(c[c.length - 1], o.fontSize, o.fontFamily, o.bold, o.italic) : 0;
5434
5683
  n.push({
5435
5684
  ...o,
5436
5685
  value: c,
@@ -5439,7 +5688,7 @@ function Un(e, t, n, r) {
5439
5688
  });
5440
5689
  }
5441
5690
  if (l) {
5442
- let e = V(l, o.fontSize, o.fontFamily, o.bold, o.italic), t = e.length > 0 ? e[e.length - 1] + B(l[l.length - 1], o.fontSize, o.fontFamily, o.bold, o.italic) : 0;
5691
+ let e = B(l, o.fontSize, o.fontFamily, o.bold, o.italic), t = e.length > 0 ? e[e.length - 1] + z(l[l.length - 1], o.fontSize, o.fontFamily, o.bold, o.italic) : 0;
5443
5692
  r.push({
5444
5693
  ...o,
5445
5694
  value: l,
@@ -5482,7 +5731,7 @@ function Un(e, t, n, r) {
5482
5731
  let e = r[a], n = e.value.substring(0, s) + e.value.substring(s + 1);
5483
5732
  for (let t = 0; t < r.length; t++) if (t === a) {
5484
5733
  if (n) {
5485
- let t = V(n, e.fontSize, e.fontFamily, e.bold, e.italic), r = t.length > 0 ? t[t.length - 1] + B(n[n.length - 1], e.fontSize, e.fontFamily, e.bold, e.italic) : 0;
5734
+ let t = B(n, e.fontSize, e.fontFamily, e.bold, e.italic), r = t.length > 0 ? t[t.length - 1] + z(n[n.length - 1], e.fontSize, e.fontFamily, e.bold, e.italic) : 0;
5486
5735
  c.push({
5487
5736
  ...e,
5488
5737
  value: n,
@@ -5520,7 +5769,7 @@ function Un(e, t, n, r) {
5520
5769
  let e = n[i], r = e.value.substring(0, o) + e.value.substring(o + 1), a = [];
5521
5770
  for (let t = 0; t < n.length; t++) if (t === i) {
5522
5771
  if (r) {
5523
- let t = V(r, e.fontSize, e.fontFamily, e.bold, e.italic), n = t.length > 0 ? t[t.length - 1] + B(r[r.length - 1], e.fontSize, e.fontFamily, e.bold, e.italic) : 0;
5772
+ let t = B(r, e.fontSize, e.fontFamily, e.bold, e.italic), n = t.length > 0 ? t[t.length - 1] + z(r[r.length - 1], e.fontSize, e.fontFamily, e.bold, e.italic) : 0;
5524
5773
  a.push({
5525
5774
  ...e,
5526
5775
  value: r,
@@ -5788,7 +6037,13 @@ function Un(e, t, n, r) {
5788
6037
  }
5789
6038
  //#endregion
5790
6039
  //#region src/components/PaperEditor.vue?vue&type=script&setup=true&lang.ts
5791
- var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-editor" }, qn = { class: "pe-editor-pages" }, Jn = ["onClick"], Yn = ["innerHTML"], Xn = { class: "pe-editor-controllers" }, Zn = /*@__PURE__*/ a({
6040
+ var qn = { class: "pe-root" }, Jn = { class: "pe-main" }, Yn = { class: "pe-editor" }, Xn = { class: "pe-editor-pages" }, Zn = ["onClick"], Qn = ["innerHTML"], $n = { class: "pe-editor-controllers" }, er = {
6041
+ key: 0,
6042
+ class: "pe-ctrl-sub"
6043
+ }, tr = {
6044
+ key: 1,
6045
+ class: "pe-ctrl-sub"
6046
+ }, nr = /*@__PURE__*/ a({
5792
6047
  __name: "PaperEditor",
5793
6048
  props: {
5794
6049
  initialData: {},
@@ -5809,7 +6064,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5809
6064
  "loaded"
5810
6065
  ],
5811
6066
  setup(a, { expose: m, emit: h }) {
5812
- let x = a, S = h, C = Ln({ renderMode: x.renderMode }), w = Un(C.blocks, C.settings, () => {
6067
+ let x = a, S = h, C = Bn({ renderMode: x.renderMode }), w = Kn(C.blocks, C.settings, () => {
5813
6068
  C.reflowAllBlocks(), o(() => k.value?.focus());
5814
6069
  }, () => {
5815
6070
  C.isDirty.value = !0;
@@ -5823,16 +6078,16 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5823
6078
  }), M = t(() => ({
5824
6079
  left: A.value.left + "px",
5825
6080
  top: A.value.top + "px"
5826
- })), N = t(() => ({
6081
+ })), ee = t(() => ({
5827
6082
  left: j.value.left + "px",
5828
6083
  top: j.value.top + "px",
5829
6084
  height: j.value.height + "px",
5830
6085
  transform: "skewX(0deg)"
5831
- })), P = zn(C, {
6086
+ })), N = Hn(C, {
5832
6087
  zoom: T,
5833
- selectedBlockId: null
6088
+ selectedBlockId: C.selectedBlockId
5834
6089
  });
5835
- function F() {
6090
+ function P() {
5836
6091
  if (C.pages.value.length === 0) return [];
5837
6092
  let e = C.pages.value[0].width, t = C.pages.value[0].height;
5838
6093
  return C.svgRenderer.value.withRenderMode("view", () => C.pages.value.map((n, r) => {
@@ -5848,16 +6103,16 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5848
6103
  }, C.pages.value.length)}</svg>`;
5849
6104
  }));
5850
6105
  }
5851
- let I = t(() => C.svgRenderer.value.renderAllPages(C.pages.value, C.blocks.value, C.settings.value, {
6106
+ let F = t(() => C.svgRenderer.value.renderAllPages(C.pages.value, C.blocks.value, C.settings.value, {
5852
6107
  totalScore: C.totalScore.value,
5853
6108
  paperName: C.paperName.value,
5854
6109
  schoolName: C.schoolName.value,
5855
6110
  qrCodeImages: C.qrCodeImages.value
5856
6111
  }));
5857
- function ee() {
5858
- C.relayout(), E.value >= C.pages.value.length && (E.value = Math.max(0, C.pages.value.length - 1)), R();
6112
+ function te() {
6113
+ C.relayout(), E.value >= C.pages.value.length && (E.value = Math.max(0, C.pages.value.length - 1)), L();
5859
6114
  }
5860
- let te = new Set([
6115
+ let ne = new Set([
5861
6116
  "header-desc",
5862
6117
  "paper-name",
5863
6118
  "qr-code",
@@ -5867,22 +6122,22 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5867
6122
  "score",
5868
6123
  "page-number"
5869
6124
  ]);
5870
- function L() {
6125
+ function I() {
5871
6126
  for (let e = 0; e < C.pages.value.length; e++) {
5872
6127
  let t = C.pages.value[e];
5873
- t.renderedRegions ||= [], t.renderedRegions = t.renderedRegions.filter((e) => !te.has(e.type)), C.svgRenderer.value.measureRegionsFromDOM(e, t, t.renderedRegions);
6128
+ t.renderedRegions ||= [], t.renderedRegions = t.renderedRegions.filter((e) => !ne.has(e.type)), C.svgRenderer.value.measureRegionsFromDOM(e, t, t.renderedRegions);
5874
6129
  }
5875
6130
  }
5876
- function R() {
6131
+ function L() {
5877
6132
  o(() => {
5878
6133
  o(() => {
5879
6134
  requestAnimationFrame(() => {
5880
- L();
6135
+ I();
5881
6136
  });
5882
6137
  });
5883
6138
  });
5884
6139
  }
5885
- function ne(e, t, n, r) {
6140
+ function re(e, t, n, r) {
5886
6141
  let i = C.blocks.value.find((t) => t.id === e);
5887
6142
  if (!i || !n) return;
5888
6143
  let a = n.getBoundingClientRect(), o = (t.clientX - a.left) / T.value, s = (t.clientY - a.top) / T.value, c = r ?? E.value, l = C.pages.value[c];
@@ -5913,7 +6168,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5913
6168
  y += t;
5914
6169
  }
5915
6170
  b === -1 && (b = v[v.length - 1] ?? g);
5916
- let x = i.paragraphs[b], S = 0, k = f.x + p, M = w.getTextStyle(x).fontSize, N = (x.lines[0]?.lineHeight || x.height || 21) * .5, P = f.y + y + N, F = M;
6171
+ let x = i.paragraphs[b], S = 0, k = f.x + p, M = w.getTextStyle(x).fontSize, ee = (x.lines[0]?.lineHeight || x.height || 21) * .5, N = f.y + y + ee, P = M;
5917
6172
  if (!w.isEmptyParagraph(x)) {
5918
6173
  let e = o - m - f.x - p, t = h - y, n = 0, r = -1;
5919
6174
  for (let e = 0; e < x.lines.length; e++) {
@@ -5930,7 +6185,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5930
6185
  let s = x.lines[r], c = s.offsetX || 0, l = 0;
5931
6186
  if (f.paragraphStart === 0 && i.metadata?.score && r === 0 && b === (v[0] ?? 0)) {
5932
6187
  let e = C.settings.value.fontSize, t = typeof e == "number" ? e : 14;
5933
- l = oe(`(${i.metadata.score}分)`, t, "SimSun, STSong, serif");
6188
+ l = se(`(${i.metadata.score}分)`, t, "SimSun, STSong, serif");
5934
6189
  }
5935
6190
  let u = l, d = !1;
5936
6191
  for (let t of s.elements) {
@@ -5939,7 +6194,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5939
6194
  for (let i = 0; i < t.value.length; i++) {
5940
6195
  let o = u + c + r[i];
5941
6196
  if (e < o + (i < r.length - 1 ? r[i + 1] - r[i] : t.width - r[i]) / 2) {
5942
- S = a, k = f.x + p + o, P = f.y + y + n + s.lineHeight * .5, F = M, d = !0;
6197
+ S = a, k = f.x + p + o, N = f.y + y + n + s.lineHeight * .5, P = M, d = !0;
5943
6198
  break;
5944
6199
  }
5945
6200
  a++;
@@ -5948,30 +6203,30 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5948
6203
  } else {
5949
6204
  let r = t.width || 12;
5950
6205
  if (e < u + c + r / 2) {
5951
- S = a, k = f.x + p + u + c, P = f.y + y + n + s.lineHeight * .5, F = M, d = !0;
6206
+ S = a, k = f.x + p + u + c, N = f.y + y + n + s.lineHeight * .5, P = M, d = !0;
5952
6207
  break;
5953
6208
  }
5954
6209
  u += r;
5955
6210
  }
5956
6211
  if (d) break;
5957
6212
  }
5958
- d || (S = a, k = f.x + p + u + c, P = f.y + y + n + s.lineHeight * .5, F = M);
6213
+ d || (S = a, k = f.x + p + u + c, N = f.y + y + n + s.lineHeight * .5, P = M);
5959
6214
  }
5960
6215
  w.setCursor(e, b, S);
5961
- let I = O.value, ee = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
5962
- if (I && ee && l) {
5963
- let e = ee.getBoundingClientRect(), t = I.getBoundingClientRect(), n = l.width, r = l.height, i = k + m, a = P + d, o = e.left - t.left + I.scrollLeft + i / n * e.width, s = e.top - t.top + I.scrollTop + a / r * e.height;
6216
+ let F = O.value, te = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
6217
+ if (F && te && l) {
6218
+ let e = te.getBoundingClientRect(), t = F.getBoundingClientRect(), n = l.width, r = l.height, i = k + m, a = N + d, o = e.left - t.left + F.scrollLeft + i / n * e.width, s = e.top - t.top + F.scrollTop + a / r * e.height;
5964
6219
  j.value = {
5965
6220
  left: o,
5966
6221
  top: s,
5967
- height: F * T.value
6222
+ height: P * T.value
5968
6223
  }, A.value = {
5969
6224
  left: o,
5970
6225
  top: s
5971
6226
  }, D.value = !0;
5972
6227
  }
5973
6228
  }
5974
- function re(e) {
6229
+ function ie(e) {
5975
6230
  let t = e.target, n = e.currentTarget, r = n.closest(".pe-editor-page"), i = E.value;
5976
6231
  if (r) {
5977
6232
  let e = r.parentElement?.querySelectorAll(":scope > .pe-editor-page");
@@ -5999,27 +6254,27 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5999
6254
  if (c) {
6000
6255
  let t = c.getAttribute("data-block-id");
6001
6256
  if (t) {
6002
- C.selectBlock(t), n && ne(t, e, n, i), o(() => k.value?.focus());
6257
+ C.selectBlock(t), n && re(t, e, n, i), o(() => k.value?.focus());
6003
6258
  let r = C.blocks.value.find((e) => e.id === t);
6004
6259
  r && S("block-click", {
6005
6260
  blockId: t,
6006
6261
  block: r
6007
6262
  });
6008
6263
  }
6009
- } else C.selectBlock(null), C.selectUnderline(null), D.value = !1, w.clearCursor(), S("empty-click");
6264
+ } else C.selectBlock(null), C.selectUnderline(null), C.selectImage(null), D.value = !1, w.clearCursor(), S("empty-click");
6010
6265
  }
6011
- function ie(e) {
6266
+ function ae(e) {
6012
6267
  let t = e.target;
6013
6268
  if (!t) return;
6014
6269
  let n = t.getAttribute("data-editable");
6015
- n && (n === "schoolName" ? C.schoolName.value = t.innerHTML : n === "paperName" && (C.paperName.value = t.textContent || ""));
6270
+ n && (C.saveUndoSnapshot(), n === "schoolName" ? C.schoolName.value = t.innerHTML : n === "paperName" && (C.paperName.value = t.textContent || ""));
6016
6271
  }
6017
- let z = f(null), ae = t(() => z.value ? {
6272
+ let R = f(null), oe = t(() => R.value ? {
6018
6273
  position: "absolute",
6019
- left: z.value.left + "px",
6020
- top: z.value.top + "px",
6021
- width: z.value.width + "px",
6022
- height: z.value.height + "px",
6274
+ left: R.value.left + "px",
6275
+ top: R.value.top + "px",
6276
+ width: R.value.width + "px",
6277
+ height: R.value.height + "px",
6023
6278
  pointerEvents: "none",
6024
6279
  border: "1.5px solid #409eff",
6025
6280
  borderRadius: "2px",
@@ -6028,220 +6283,249 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6028
6283
  display: "none",
6029
6284
  position: "absolute"
6030
6285
  });
6031
- function B() {
6286
+ function z() {
6032
6287
  let e = C.selectedBlockId.value;
6033
6288
  if (!e) {
6034
- z.value = null;
6289
+ R.value = null;
6035
6290
  return;
6036
6291
  }
6037
6292
  let t = C.blocks.value.find((t) => t.id === e);
6038
6293
  if (!t || t.type === "title") {
6039
- z.value = null;
6294
+ R.value = null;
6040
6295
  return;
6041
6296
  }
6042
6297
  let n = document.querySelector(".pe-editor-page.active");
6043
6298
  if (!n) {
6044
- z.value = null;
6299
+ R.value = null;
6045
6300
  return;
6046
6301
  }
6047
6302
  let r = n.querySelector("svg.paper-page");
6048
6303
  if (!r) {
6049
- z.value = null;
6304
+ R.value = null;
6050
6305
  return;
6051
6306
  }
6052
6307
  let i = C.pages.value.find((e) => e.index === E.value);
6053
6308
  if (!i) {
6054
- z.value = null;
6309
+ R.value = null;
6055
6310
  return;
6056
6311
  }
6057
6312
  let a = i.blocks.find((t) => t.blockId === e);
6058
6313
  if (!a) {
6059
- z.value = null;
6314
+ R.value = null;
6060
6315
  return;
6061
6316
  }
6062
6317
  let o = n.closest(".pe-editor-surface");
6063
6318
  if (!o) {
6064
- z.value = null;
6319
+ R.value = null;
6065
6320
  return;
6066
6321
  }
6067
6322
  let s = i.width, c = i.height, l = E.value % 2 == 0 ? C.settings.value.bodyTopEven ?? 173 : C.settings.value.bodyTopOdd ?? 50, u = (C.settings.value.margins[3] ?? 56) + a.x, d = l + a.y, f = r.getBoundingClientRect(), p = o.getBoundingClientRect();
6068
- z.value = {
6323
+ R.value = {
6069
6324
  left: f.left - p.left + o.scrollLeft + u / s * f.width,
6070
6325
  top: f.top - p.top + o.scrollTop + d / c * f.height,
6071
6326
  width: a.width / s * f.width,
6072
6327
  height: a.height / c * f.height
6073
6328
  };
6074
6329
  }
6075
- let V = f(null), se = t(() => V.value ? {
6330
+ let B = t(() => {
6331
+ let e = C.selectedBlockId.value;
6332
+ return e && C.blocks.value.find((t) => t.id === e)?.metadata?.blockGroup || "";
6333
+ }), ce = t(() => {
6334
+ let e = C.selectedBlockId.value;
6335
+ return e ? !!C.blocks.value.find((t) => t.id === e)?.metadata?._splitBackup : !1;
6336
+ });
6337
+ function le() {
6338
+ let e = B.value;
6339
+ e && (C.mergeSubQuestionGroup(e), S("change"));
6340
+ }
6341
+ function V() {
6342
+ let e = C.selectedBlockId.value;
6343
+ e && (C.splitMergedBlock(e), S("change"));
6344
+ }
6345
+ let H = f(null), ue = t(() => H.value ? {
6076
6346
  position: "absolute",
6077
- left: V.value.left + "px",
6078
- top: V.value.top + "px",
6079
- width: V.value.width + "px",
6080
- height: V.value.height + "px",
6347
+ left: H.value.left + "px",
6348
+ top: H.value.top + "px",
6349
+ width: H.value.width + "px",
6350
+ height: H.value.height + "px",
6081
6351
  pointerEvents: "auto"
6082
6352
  } : {
6083
6353
  display: "none",
6084
6354
  position: "absolute"
6085
6355
  });
6086
- function ce() {
6356
+ function de() {
6087
6357
  let e = C.selectedUnderlineId.value;
6088
6358
  if (!e) {
6089
- V.value = null;
6359
+ H.value = null;
6090
6360
  return;
6091
6361
  }
6092
6362
  let t = document.querySelector(".pe-editor-page.active");
6093
6363
  if (!t) {
6094
- V.value = null;
6364
+ H.value = null;
6095
6365
  return;
6096
6366
  }
6097
6367
  let n = t.querySelector(`[data-underline-id="${CSS.escape(e)}"]`);
6098
6368
  if (!n) {
6099
- V.value = null;
6369
+ H.value = null;
6100
6370
  return;
6101
6371
  }
6102
6372
  let r = t.closest(".pe-editor-surface");
6103
6373
  if (!r) {
6104
- V.value = null;
6374
+ H.value = null;
6105
6375
  return;
6106
6376
  }
6107
6377
  let i = n.getBoundingClientRect(), a = r.getBoundingClientRect();
6108
- V.value = {
6378
+ H.value = {
6109
6379
  left: i.left - a.left + r.scrollLeft,
6110
6380
  top: i.top - a.top + r.scrollTop,
6111
6381
  width: i.width,
6112
6382
  height: i.height
6113
6383
  };
6114
6384
  }
6115
- let H = f(null), le = t(() => H.value ? {
6385
+ let U = f(null), fe = t(() => U.value ? {
6116
6386
  position: "absolute",
6117
- left: H.value.left + "px",
6118
- top: H.value.top + "px",
6119
- width: H.value.width + "px",
6120
- height: H.value.height + "px",
6387
+ left: U.value.left + "px",
6388
+ top: U.value.top + "px",
6389
+ width: U.value.width + "px",
6390
+ height: U.value.height + "px",
6121
6391
  pointerEvents: "auto"
6122
6392
  } : {
6123
6393
  display: "none",
6124
6394
  position: "absolute"
6125
6395
  });
6126
- function ue() {
6396
+ function pe() {
6127
6397
  let e = C.selectedImageId.value;
6128
6398
  if (!e) {
6129
- H.value = null;
6399
+ U.value = null;
6130
6400
  return;
6131
6401
  }
6132
6402
  let t = document.querySelector(".pe-editor-page.active");
6133
6403
  if (!t) {
6134
- H.value = null;
6404
+ U.value = null;
6135
6405
  return;
6136
6406
  }
6137
6407
  let n = t.querySelector(`[data-image-id="${CSS.escape(e)}"]`);
6138
6408
  if (!n) {
6139
- H.value = null;
6409
+ U.value = null;
6140
6410
  return;
6141
6411
  }
6142
6412
  let r = n.querySelector("image") || n, i = t.closest(".pe-editor-surface");
6143
6413
  if (!i) {
6144
- H.value = null;
6414
+ U.value = null;
6145
6415
  return;
6146
6416
  }
6147
6417
  let a = r.getBoundingClientRect(), o = i.getBoundingClientRect();
6148
- H.value = {
6418
+ U.value = {
6149
6419
  left: a.left - o.left + i.scrollLeft,
6150
6420
  top: a.top - o.top + i.scrollTop,
6151
6421
  width: a.width,
6152
6422
  height: a.height
6153
6423
  };
6154
6424
  }
6155
- let de = t(() => C.selectedImageId.value ? C.getImageParagraphInfo(C.selectedImageId.value) : null), fe = t(() => !!(de.value?.isStandalone && H.value)), pe = t(() => H.value ? {
6156
- left: H.value.left + "px",
6157
- top: H.value.top + H.value.height + 4 + "px",
6425
+ let me = t(() => C.selectedImageId.value ? C.getImageParagraphInfo(C.selectedImageId.value) : null), he = t(() => !!(me.value?.isStandalone && U.value)), ge = t(() => U.value ? {
6426
+ left: U.value.left + "px",
6427
+ top: U.value.top + U.value.height + 4 + "px",
6158
6428
  pointerEvents: "auto"
6159
6429
  } : null);
6160
- function me(e) {
6430
+ function _e(e) {
6161
6431
  let t = C.selectedImageId.value;
6162
- t && (C.updateImageAlignment(t, e), o(() => U()));
6432
+ t && (C.updateImageAlignment(t, e), o(() => W()));
6163
6433
  }
6164
- let he = 0;
6165
- function U() {
6166
- he && cancelAnimationFrame(he), he = requestAnimationFrame(() => {
6167
- he = 0, B(), ce(), ue();
6434
+ let ve = 0;
6435
+ function W() {
6436
+ ve && cancelAnimationFrame(ve), ve = requestAnimationFrame(() => {
6437
+ ve = 0, z(), de(), pe();
6168
6438
  });
6169
6439
  }
6170
6440
  v(() => C.selectedBlockId.value, async () => {
6171
- await o(), U();
6441
+ await o(), W();
6172
6442
  }), v(() => T.value, async () => {
6173
- await o(), U();
6443
+ await o(), W();
6174
6444
  }), v(() => E.value, async () => {
6175
- await o(), U(), S("page-change", E.value);
6445
+ await o(), W(), S("page-change", E.value);
6176
6446
  }), v(() => C.layoutVersion.value, () => {
6177
- R(), o(() => U());
6447
+ L(), o(() => W());
6178
6448
  }), v(() => C.selectedUnderlineId.value, async () => {
6179
- await o(), U();
6449
+ await o(), W();
6180
6450
  }), v(() => C.selectedImageId.value, async () => {
6181
- await o(), U();
6451
+ await o(), W();
6182
6452
  }), v(() => [
6183
6453
  C.paperName.value,
6184
6454
  C.schoolName.value,
6185
6455
  C.totalScore.value
6186
6456
  ], () => {
6187
- R();
6457
+ L();
6188
6458
  });
6189
- let ge = f(!1), W = f(null), _e = f(0), ve = f(0);
6190
- function ye(e) {
6459
+ let ye = f(!1), be = f(null), xe = f(0), Se = f(0);
6460
+ function G(e) {
6191
6461
  let t = C.selectedBlockId.value;
6192
6462
  if (!t) return;
6193
6463
  let n = C.blocks.value.find((e) => e.id === t);
6194
- n && (e.stopPropagation(), ge.value = !0, W.value = t, _e.value = e.clientY, ve.value = n.height, document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", be), document.addEventListener("mouseup", xe));
6464
+ n && (e.stopPropagation(), ye.value = !0, be.value = t, xe.value = e.clientY, Se.value = n.height, document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", Ce), document.addEventListener("mouseup", we));
6195
6465
  }
6196
- function be(e) {
6197
- if (!ge.value || !W.value) return;
6198
- let t = (e.clientY - _e.value) / T.value;
6199
- C.updateBlockHeight(W.value, ve.value + t), o(() => B());
6466
+ function Ce(e) {
6467
+ if (!ye.value || !be.value) return;
6468
+ let t = (e.clientY - xe.value) / T.value;
6469
+ C.updateBlockHeight(be.value, Se.value + t), o(() => z());
6200
6470
  }
6201
- function xe(e) {
6202
- ge.value = !1, W.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", be), document.removeEventListener("mouseup", xe), R();
6471
+ function we(e) {
6472
+ ye.value = !1, be.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", Ce), document.removeEventListener("mouseup", we), L();
6203
6473
  }
6204
- let Se = f(!1), G = f(null), Ce = f(0), we = f(0);
6205
- function Te(e, t) {
6474
+ let Te = f(!1), Ee = f(null), De = f(0), Oe = f(0);
6475
+ function ke(e, t) {
6206
6476
  let n = C.selectedUnderlineId.value;
6207
6477
  if (!n) return;
6208
6478
  let r = C.findUnderlineById(n);
6209
- r && (t.stopPropagation(), Se.value = !0, G.value = e, Ce.value = t.clientX, we.value = r.underline.width, document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", Ee), document.addEventListener("mouseup", K));
6479
+ r && (t.stopPropagation(), Te.value = !0, Ee.value = e, De.value = t.clientX, Oe.value = r.underline.width, document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", K), document.addEventListener("mouseup", Ae));
6210
6480
  }
6211
- function Ee(e) {
6212
- if (!Se.value || !G.value) return;
6481
+ function K(e) {
6482
+ if (!Te.value || !Ee.value) return;
6213
6483
  let t = C.selectedUnderlineId.value;
6214
6484
  if (!t) return;
6215
- let n = (e.clientX - Ce.value) / T.value, r = G.value === "right" ? n : -n;
6216
- C.updateUnderlineWidth(t, we.value + r), o(() => ce());
6485
+ let n = (e.clientX - De.value) / T.value, r = Ee.value === "right" ? n : -n;
6486
+ C.updateUnderlineWidth(t, Oe.value + r), o(() => de());
6217
6487
  }
6218
- function K(e) {
6219
- Se.value = !1, G.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", Ee), document.removeEventListener("mouseup", K), R();
6488
+ function Ae(e) {
6489
+ Te.value = !1, Ee.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", K), document.removeEventListener("mouseup", Ae), L();
6220
6490
  }
6221
- let De = f(!1), Oe = f(null), q = f(0), ke = f(0), Ae = f(0), je = f(0);
6222
- function Me(e, t) {
6491
+ let je = f(!1), Me = f(null), Ne = f(0), Pe = f(0), Fe = f(0), Ie = f(0);
6492
+ function Le(e, t) {
6223
6493
  if (t.button !== 0) return;
6224
6494
  let n = C.selectedImageId.value;
6225
6495
  if (!n) return;
6226
6496
  let r = C.findInlineImageById(n);
6227
- r && (t.stopPropagation(), De.value = !0, Oe.value = e, q.value = t.clientX, ke.value = t.clientY, Ae.value = r.image.width, je.value = r.image.height, document.body.style.userSelect = "none", document.addEventListener("mousemove", Ne), document.addEventListener("mouseup", Pe));
6497
+ r && (t.stopPropagation(), je.value = !0, Me.value = e, Ne.value = t.clientX, Pe.value = t.clientY, Fe.value = r.image.width, Ie.value = r.image.height, document.body.style.userSelect = "none", document.addEventListener("mousemove", Re), document.addEventListener("mouseup", q));
6228
6498
  }
6229
- function Ne(e) {
6230
- if (!De.value || !Oe.value) return;
6499
+ function Re(e) {
6500
+ if (!je.value || !Me.value) return;
6231
6501
  let t = C.selectedImageId.value;
6232
6502
  if (!t) return;
6233
- let n = (e.clientX - q.value) / T.value, r = Oe.value, i = Ae.value;
6503
+ let n = (e.clientX - Ne.value) / T.value, r = Me.value, i = Fe.value;
6234
6504
  if (r.includes("e") ? i += n : r.includes("w") && (i -= n), !C.findInlineImageById(t)) return;
6235
- let a = je.value / Math.max(1, Ae.value), s = Math.max(12, Math.round(i * a));
6236
- C.updateInlineImageSize(t, i, s), o(() => ue());
6505
+ let a = Ie.value / Math.max(1, Fe.value), s = Math.max(12, Math.round(i * a));
6506
+ C.updateInlineImageSize(t, i, s), o(() => pe());
6507
+ }
6508
+ function q(e) {
6509
+ je.value = !1, Me.value = null, document.body.style.userSelect = "", document.removeEventListener("mousemove", Re), document.removeEventListener("mouseup", q), L();
6237
6510
  }
6238
- function Pe(e) {
6239
- De.value = !1, Oe.value = null, document.body.style.userSelect = "", document.removeEventListener("mousemove", Ne), document.removeEventListener("mouseup", Pe), R();
6511
+ function ze(e) {
6512
+ C.loadDocument(e), L(), S("loaded"), S("change");
6240
6513
  }
6241
- function Fe(e) {
6242
- C.loadDocument(e), R(), S("loaded"), S("change");
6514
+ function Be(e) {
6515
+ let t = -1;
6516
+ for (let n = 0; n < C.pages.value.length; n++) if (C.pages.value[n].blocks.some((t) => t.blockId === e)) {
6517
+ t = n;
6518
+ break;
6519
+ }
6520
+ t < 0 || (E.value = t, o(() => {
6521
+ let e = document.querySelectorAll(".pe-editor-page")[t];
6522
+ if (e && O.value) {
6523
+ let t = O.value, n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
6524
+ t.scrollTop += r.top - n.top - 20;
6525
+ }
6526
+ }));
6243
6527
  }
6244
- let Ie = f(!1);
6528
+ let Ve = f(!1);
6245
6529
  function J() {
6246
6530
  let e = w.cursor.value;
6247
6531
  if (!e.blockId) return;
@@ -6290,7 +6574,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6290
6574
  let s = m.lines[i], c = s.offsetX || 0, u = 0;
6291
6575
  if (a.paragraphStart === 0 && e.metadata?.score && i === 0 && n === (f[0] ?? 0)) {
6292
6576
  let t = C.settings.value.fontSize, n = typeof t == "number" ? t : 14;
6293
- u = oe(`(${e.metadata.score}分)`, n, "SimSun, STSong, serif");
6577
+ u = se(`(${e.metadata.score}分)`, n, "SimSun, STSong, serif");
6294
6578
  }
6295
6579
  let d = u, h = !1;
6296
6580
  for (let e of s.elements) {
@@ -6330,16 +6614,16 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6330
6614
  });
6331
6615
  });
6332
6616
  }
6333
- function Le(e) {
6334
- if (w.cursor.value.blockId && !(Ie.value && e.key === "Enter")) switch (e.key) {
6617
+ function He(e) {
6618
+ if (w.cursor.value.blockId && !(Ve.value && e.key === "Enter")) switch (e.key) {
6335
6619
  case "Enter":
6336
- e.preventDefault(), w.splitAtCursor(), J();
6620
+ e.preventDefault(), C.saveUndoSnapshot(), w.splitAtCursor(), J();
6337
6621
  break;
6338
6622
  case "Backspace":
6339
- e.preventDefault(), w.backspace(), J();
6623
+ e.preventDefault(), C.saveUndoSnapshot(), w.backspace(), J();
6340
6624
  break;
6341
6625
  case "Delete":
6342
- e.preventDefault(), w.deleteForward(), J();
6626
+ e.preventDefault(), C.saveUndoSnapshot(), w.deleteForward(), J();
6343
6627
  break;
6344
6628
  case "ArrowLeft":
6345
6629
  e.preventDefault(), w.moveCursorLeft(), J();
@@ -6355,32 +6639,32 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6355
6639
  break;
6356
6640
  }
6357
6641
  }
6358
- function Re(e) {
6359
- if (Ie.value) return;
6642
+ function Ue(e) {
6643
+ if (Ve.value) return;
6360
6644
  let t = e.target, n = t.value;
6361
- n && w.cursor.value.blockId && (w.insertText(n), t.value = "", J());
6645
+ n && w.cursor.value.blockId && (C.saveUndoSnapshot(), w.insertText(n), t.value = "", J());
6362
6646
  }
6363
- function ze() {
6364
- Ie.value = !0;
6647
+ function We() {
6648
+ Ve.value = !0;
6365
6649
  }
6366
- function Be(e) {
6367
- Ie.value = !1;
6650
+ function Ge(e) {
6651
+ Ve.value = !1;
6368
6652
  let t = k.value;
6369
6653
  if (t) {
6370
6654
  let e = t.value;
6371
- e && w.cursor.value.blockId && (w.insertText(e), t.value = "", J());
6655
+ e && w.cursor.value.blockId && (C.saveUndoSnapshot(), w.insertText(e), t.value = "", J());
6372
6656
  }
6373
6657
  }
6374
6658
  return l(() => {
6375
- x.initialData ? Fe(x.initialData) : C.relayout(), x.paperName && (C.paperName.value = x.paperName), x.schoolName && (C.schoolName.value = x.schoolName), x.qrCodeContent && (C.qrCodeContent.value = x.qrCodeContent), S("ready");
6659
+ x.initialData ? ze(x.initialData) : C.relayout(), x.paperName && (C.paperName.value = x.paperName), x.schoolName && (C.schoolName.value = x.schoolName), x.qrCodeContent && (C.qrCodeContent.value = x.qrCodeContent), S("ready");
6376
6660
  }), u(() => {
6377
- document.removeEventListener("mousemove", be), document.removeEventListener("mouseup", xe), document.removeEventListener("mousemove", Ee), document.removeEventListener("mouseup", K), document.removeEventListener("mousemove", Ne), document.removeEventListener("mouseup", Pe);
6661
+ document.removeEventListener("mousemove", Ce), document.removeEventListener("mouseup", we), document.removeEventListener("mousemove", K), document.removeEventListener("mouseup", Ae), document.removeEventListener("mousemove", Re), document.removeEventListener("mouseup", q);
6378
6662
  }), v(() => x.qrCodeContent, (e) => {
6379
6663
  C.qrCodeContent.value = e || "";
6380
6664
  }), m({
6381
6665
  document: {
6382
6666
  save: () => C.saveDocument(),
6383
- load: (e) => Fe(e),
6667
+ load: (e) => ze(e),
6384
6668
  getBlocks: () => C.blocks.value,
6385
6669
  isDirty: () => C.isDirty.value
6386
6670
  },
@@ -6436,25 +6720,31 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6436
6720
  },
6437
6721
  updateSplit: (e, t) => {
6438
6722
  C.updateBlockSplit(e, t), S("change");
6723
+ },
6724
+ mergeGroup: (e) => {
6725
+ C.mergeSubQuestionGroup(e), S("change");
6726
+ },
6727
+ splitBlock: (e) => {
6728
+ C.splitMergedBlock(e), S("change");
6439
6729
  }
6440
6730
  },
6441
6731
  layout: {
6442
6732
  setPaperSize: (e) => {
6443
- C.updateSettings({ paperSize: e }), R();
6733
+ C.updateSettings({ paperSize: e }), L();
6444
6734
  },
6445
6735
  setColumns: (e) => {
6446
- C.updateSettings({ columns: e }), R();
6736
+ C.updateSettings({ columns: e }), L();
6447
6737
  },
6448
6738
  setFontSize: (e) => {
6449
- C.updateSettings({ fontSize: e }), R();
6739
+ C.updateSettings({ fontSize: e }), L();
6450
6740
  },
6451
6741
  setLineSpacing: (e) => {
6452
- C.updateSettings({ lineSpacing: e }), R();
6742
+ C.updateSettings({ lineSpacing: e }), L();
6453
6743
  },
6454
6744
  updateSettings: (e) => {
6455
- C.updateSettings(e), R();
6745
+ C.updateSettings(e), L();
6456
6746
  },
6457
- reflow: () => ee()
6747
+ reflow: () => te()
6458
6748
  },
6459
6749
  selection: {
6460
6750
  selectBlock: (e) => C.selectBlock(e),
@@ -6467,16 +6757,21 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6467
6757
  },
6468
6758
  goToPage: (e) => {
6469
6759
  E.value = e;
6470
- }
6760
+ },
6761
+ scrollToBlock: (e) => Be(e)
6471
6762
  },
6472
6763
  render: {
6473
- getPageSvgs: () => P.value,
6474
- getCleanPageSvgs: () => F(),
6475
- getAllPagesSvg: () => I.value
6764
+ getPageSvgs: () => N.value,
6765
+ getCleanPageSvgs: () => P(),
6766
+ getAllPagesSvg: () => F.value
6476
6767
  },
6477
6768
  setQRCode: (e) => {
6478
6769
  C.qrCodeContent.value = e;
6479
6770
  },
6771
+ canUndo: C.canUndo,
6772
+ undo: () => {
6773
+ C.undo(), S("change");
6774
+ },
6480
6775
  state: t(() => ({
6481
6776
  blocks: C.blocks.value,
6482
6777
  pages: C.pages.value,
@@ -6487,7 +6782,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6487
6782
  selectedImageId: C.selectedImageId.value,
6488
6783
  selectedUnderlineInfo: C.selectedUnderlineInfo.value,
6489
6784
  selectedImageInfo: C.selectedImageInfo.value,
6490
- selectedImageAlignment: de.value,
6785
+ selectedImageAlignment: me.value,
6491
6786
  totalScore: C.totalScore.value,
6492
6787
  zoom: T.value,
6493
6788
  currentPage: E.value,
@@ -6500,7 +6795,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6500
6795
  qrCodeImages: C.qrCodeImages.value,
6501
6796
  showScore: C.settings.value.showScore
6502
6797
  }))
6503
- }), (t, a) => (d(), r("div", Wn, [i("div", Gn, [i("div", Kn, [i("div", {
6798
+ }), (t, a) => (d(), r("div", qn, [i("div", Jn, [i("div", Yn, [i("div", {
6504
6799
  class: "pe-editor-surface",
6505
6800
  ref_key: "saberEditorRef",
6506
6801
  ref: O
@@ -6509,41 +6804,51 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6509
6804
  d: "M810.667 213.333a42.667 42.667 0 0 1 42.368 37.675l0.298 4.992v274.304c0 79.275-50.944 147.499-120.49 152.107l-7.51 0.256H273.707l97.792 97.834a42.667 42.667 0 0 1-56.32 63.872l-4.011-3.541-170.667-170.667a42.667 42.667 0 0 1 0-60.33l170.667-170.667a42.667 42.667 0 0 1 63.872 56.32l-3.541 4.01-97.792 97.835h451.626c19.584 0 39.936-24.618 42.411-59.861l0.256-7.168V256a42.667 42.667 0 0 1 42.667-42.667z",
6510
6805
  fill: "currentColor"
6511
6806
  })])])], -1),
6512
- i("div", qn, [(d(!0), r(e, null, p(g(P), (e, t) => (d(), r("div", {
6807
+ i("div", Xn, [(d(!0), r(e, null, p(g(N), (e, t) => (d(), r("div", {
6513
6808
  key: t,
6514
6809
  class: s(["pe-editor-page", { active: t === E.value }]),
6515
6810
  onClick: b((e) => E.value = t, ["stop"])
6516
6811
  }, [i("div", {
6517
6812
  class: "pe-editor-viewport",
6518
6813
  innerHTML: e,
6519
- onClick: re,
6520
- onFocusout: ie
6521
- }, null, 40, Yn)], 10, Jn))), 128))]),
6522
- i("div", Xn, [
6523
- z.value ? (d(), r("div", {
6814
+ onClick: ie,
6815
+ onFocusout: ae
6816
+ }, null, 40, Qn)], 10, Zn))), 128))]),
6817
+ i("div", $n, [
6818
+ R.value ? (d(), r("div", {
6524
6819
  key: 0,
6525
6820
  class: "pe-ctrl-block",
6526
- style: c(ae.value)
6527
- }, [i("div", {
6528
- class: "pe-ctrl-height",
6529
- onMousedown: b(ye, ["prevent"])
6530
- }, [...a[9] ||= [i("svg", {
6531
- xmlns: "http://www.w3.org/2000/svg",
6532
- width: "16",
6533
- height: "16",
6534
- viewBox: "0 0 16 16"
6535
- }, [i("path", {
6536
- fill: "currentColor",
6537
- "fill-rule": "evenodd",
6538
- d: "M14 8a.75.75 0 0 1-.75.75h-4.5V12h1.75l-2.519 3L5.5 12l1.75-.001v-3.25l-4.5.001a.75.75 0 1 1 0-1.5l4.5-.001v-3.25L5.5 4l2.519-3L10.5 4H8.75v3.25h4.5A.75.75 0 0 1 14 8"
6539
- })], -1)]], 32)], 4)) : n("", !0),
6540
- V.value ? (d(), r("div", {
6821
+ style: c(oe.value)
6822
+ }, [
6823
+ i("div", {
6824
+ class: "pe-ctrl-height",
6825
+ onMousedown: b(G, ["prevent"])
6826
+ }, [...a[9] ||= [i("svg", {
6827
+ xmlns: "http://www.w3.org/2000/svg",
6828
+ width: "16",
6829
+ height: "16",
6830
+ viewBox: "0 0 16 16"
6831
+ }, [i("path", {
6832
+ fill: "currentColor",
6833
+ "fill-rule": "evenodd",
6834
+ d: "M14 8a.75.75 0 0 1-.75.75h-4.5V12h1.75l-2.519 3L5.5 12l1.75-.001v-3.25l-4.5.001a.75.75 0 1 1 0-1.5l4.5-.001v-3.25L5.5 4l2.519-3L10.5 4H8.75v3.25h4.5A.75.75 0 0 1 14 8"
6835
+ })], -1)]], 32),
6836
+ B.value ? (d(), r("div", er, [i("button", {
6837
+ class: "pe-merge-btn",
6838
+ onMousedown: b(le, ["stop"])
6839
+ }, "合并子题", 32)])) : n("", !0),
6840
+ ce.value ? (d(), r("div", tr, [i("button", {
6841
+ class: "pe-split-btn",
6842
+ onMousedown: b(V, ["stop"])
6843
+ }, "拆分子题", 32)])) : n("", !0)
6844
+ ], 4)) : n("", !0),
6845
+ H.value ? (d(), r("div", {
6541
6846
  key: 1,
6542
6847
  class: "pe-ctrlUnderline",
6543
- style: c(se.value)
6848
+ style: c(ue.value)
6544
6849
  }, [i("div", {
6545
6850
  class: "pe-ctrl-ul-left",
6546
- onMousedown: a[0] ||= b((e) => Te("left", e), ["prevent"])
6851
+ onMousedown: a[0] ||= b((e) => ke("left", e), ["prevent"])
6547
6852
  }, [...a[10] ||= [i("svg", {
6548
6853
  xmlns: "http://www.w3.org/2000/svg",
6549
6854
  width: "12",
@@ -6554,7 +6859,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6554
6859
  d: "M10.5 4L7.5 8l3 4H2V4z"
6555
6860
  })], -1)]], 32), i("div", {
6556
6861
  class: "pe-ctrl-ul-right",
6557
- onMousedown: a[1] ||= b((e) => Te("right", e), ["prevent"])
6862
+ onMousedown: a[1] ||= b((e) => ke("right", e), ["prevent"])
6558
6863
  }, [...a[11] ||= [i("svg", {
6559
6864
  xmlns: "http://www.w3.org/2000/svg",
6560
6865
  width: "12",
@@ -6564,46 +6869,46 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6564
6869
  fill: "currentColor",
6565
6870
  d: "M5.5 4L8.5 8l-3 4H14V4z"
6566
6871
  })], -1)]], 32)], 4)) : n("", !0),
6567
- H.value ? (d(), r("div", {
6872
+ U.value ? (d(), r("div", {
6568
6873
  key: 2,
6569
6874
  class: "pe-ctrlAnchor",
6570
- style: c(le.value)
6875
+ style: c(fe.value)
6571
6876
  }, [
6572
6877
  i("div", {
6573
6878
  class: "pe-resize-se",
6574
- onMousedown: a[2] ||= b((e) => Me("se", e), ["prevent", "stop"])
6879
+ onMousedown: a[2] ||= b((e) => Le("se", e), ["prevent", "stop"])
6575
6880
  }, null, 32),
6576
6881
  i("div", {
6577
6882
  class: "pe-resize-sw",
6578
- onMousedown: a[3] ||= b((e) => Me("sw", e), ["prevent", "stop"])
6883
+ onMousedown: a[3] ||= b((e) => Le("sw", e), ["prevent", "stop"])
6579
6884
  }, null, 32),
6580
6885
  i("div", {
6581
6886
  class: "pe-resize-ne",
6582
- onMousedown: a[4] ||= b((e) => Me("ne", e), ["prevent", "stop"])
6887
+ onMousedown: a[4] ||= b((e) => Le("ne", e), ["prevent", "stop"])
6583
6888
  }, null, 32),
6584
6889
  i("div", {
6585
6890
  class: "pe-resize-nw",
6586
- onMousedown: a[5] ||= b((e) => Me("nw", e), ["prevent", "stop"])
6891
+ onMousedown: a[5] ||= b((e) => Le("nw", e), ["prevent", "stop"])
6587
6892
  }, null, 32)
6588
6893
  ], 4)) : n("", !0),
6589
- fe.value ? (d(), r("div", {
6894
+ he.value ? (d(), r("div", {
6590
6895
  key: 3,
6591
6896
  class: "pe-img-align-bar",
6592
- style: c(pe.value)
6897
+ style: c(ge.value)
6593
6898
  }, [
6594
6899
  i("button", {
6595
- class: s(["pe-align-btn", { active: de.value?.alignment === "left" }]),
6596
- onClick: a[6] ||= (e) => me("left"),
6900
+ class: s(["pe-align-btn", { active: me.value?.alignment === "left" }]),
6901
+ onClick: a[6] ||= (e) => _e("left"),
6597
6902
  title: "左对齐"
6598
6903
  }, "左", 2),
6599
6904
  i("button", {
6600
- class: s(["pe-align-btn", { active: de.value?.alignment === "center" }]),
6601
- onClick: a[7] ||= (e) => me("center"),
6905
+ class: s(["pe-align-btn", { active: me.value?.alignment === "center" }]),
6906
+ onClick: a[7] ||= (e) => _e("center"),
6602
6907
  title: "居中对齐"
6603
6908
  }, "中", 2),
6604
6909
  i("button", {
6605
- class: s(["pe-align-btn", { active: de.value?.alignment === "right" }]),
6606
- onClick: a[8] ||= (e) => me("right"),
6910
+ class: s(["pe-align-btn", { active: me.value?.alignment === "right" }]),
6911
+ onClick: a[8] ||= (e) => _e("right"),
6607
6912
  title: "右对齐"
6608
6913
  }, "右", 2)
6609
6914
  ], 4)) : n("", !0)
@@ -6615,28 +6920,28 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6615
6920
  class: "pe-editor-virtual-input",
6616
6921
  ref_key: "virtualInputRef",
6617
6922
  ref: k,
6618
- onKeydown: Le,
6619
- onInput: Re,
6620
- onCompositionstart: ze,
6621
- onCompositionend: Be
6923
+ onKeydown: He,
6924
+ onInput: Ue,
6925
+ onCompositionstart: We,
6926
+ onCompositionend: Ge
6622
6927
  }, null, 544)], 4),
6623
6928
  y(i("div", {
6624
6929
  class: "pe-editor-cursor",
6625
- style: c(N.value)
6930
+ style: c(ee.value)
6626
6931
  }, null, 4), [[_, D.value]])
6627
6932
  ], 512)])])]));
6628
6933
  }
6629
- }), Qn = (e, t) => {
6934
+ }), rr = (e, t) => {
6630
6935
  let n = e.__vccOpts || e;
6631
6936
  for (let [e, r] of t) n[e] = r;
6632
6937
  return n;
6633
- }, $n = /*#__PURE__*/ Qn(Zn, [["__scopeId", "data-v-152f108d"]]), er = { class: "pe-preview__pages" }, tr = ["innerHTML"], nr = {
6938
+ }, ir = /*#__PURE__*/ rr(nr, [["__scopeId", "data-v-b29566da"]]), ar = { class: "pe-preview__pages" }, or = ["innerHTML"], sr = {
6634
6939
  key: 0,
6635
6940
  class: "pe-preview__helpers"
6636
- }, rr = {
6941
+ }, cr = {
6637
6942
  key: 1,
6638
6943
  class: "pe-preview__page-num"
6639
- }, ir = /*#__PURE__*/ Qn(/* @__PURE__ */ a({
6944
+ }, lr = /*#__PURE__*/ rr(/* @__PURE__ */ a({
6640
6945
  __name: "PaperPreview",
6641
6946
  props: {
6642
6947
  document: {},
@@ -6663,14 +6968,14 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6663
6968
  }
6664
6969
  },
6665
6970
  setup(a) {
6666
- let o = a, m = Ln();
6971
+ let o = a, m = Bn();
6667
6972
  function _() {
6668
6973
  o.document && m.loadDocument(o.document);
6669
6974
  }
6670
6975
  _(), v(() => o.document, _), v(() => o.pureMode, (e) => {
6671
6976
  m.setRenderMode(e ? "view" : "edit");
6672
6977
  }, { immediate: !0 });
6673
- let y = zn(m, { selectedBlockId: null }), b = f(), x = f(0), S = null;
6978
+ let y = Hn(m, { selectedBlockId: null }), b = f(), x = f(0), S = null;
6674
6979
  l(() => {
6675
6980
  x.value = b.value?.clientWidth ?? 0, S = new ResizeObserver((e) => {
6676
6981
  for (let t of e) x.value = Math.floor(t.contentRect.width);
@@ -6703,6 +7008,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6703
7008
  "student-name": "#3498db",
6704
7009
  "student-class": "#3498db",
6705
7010
  "student-code": "#3498db",
7011
+ "student-code-filler": "#e67e22",
6706
7012
  score: "#e74c3c",
6707
7013
  "page-number": "#95a5a6",
6708
7014
  "question-border": "#e74c3c",
@@ -6716,6 +7022,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6716
7022
  studentName: "student-name",
6717
7023
  studentClass: "student-class",
6718
7024
  studentCode: "student-code",
7025
+ studentCodeFiller: "student-code-filler",
6719
7026
  score: "score"
6720
7027
  };
6721
7028
  function D(e) {
@@ -6820,7 +7127,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6820
7127
  height: `${(n * w.value.y).toFixed(1)}mm`
6821
7128
  };
6822
7129
  }
6823
- function N(e) {
7130
+ function ee(e) {
6824
7131
  return {
6825
7132
  position: "absolute",
6826
7133
  outline: `1px solid ${e.color}`,
@@ -6836,7 +7143,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6836
7143
  class: s(["pe-preview", { "pe-preview--print": a.mode === "print" }]),
6837
7144
  ref_key: "previewRef",
6838
7145
  ref: b
6839
- }, [i("div", er, [(d(!0), r(e, null, p(g(y), (t, o) => (d(), r("div", {
7146
+ }, [i("div", ar, [(d(!0), r(e, null, p(g(y), (t, o) => (d(), r("div", {
6840
7147
  key: o,
6841
7148
  class: "pe-preview__page",
6842
7149
  style: c(k(o))
@@ -6850,19 +7157,19 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6850
7157
  width: "100%",
6851
7158
  height: "100%"
6852
7159
  }
6853
- }, null, 8, tr)], 4),
6854
- a.showHelpers ? (d(), r("div", nr, [a.showCornerMarks ? (d(!0), r(e, { key: 0 }, p(D(o), (e, t) => (d(), r("span", {
7160
+ }, null, 8, or)], 4),
7161
+ a.showHelpers ? (d(), r("div", sr, [a.showCornerMarks ? (d(!0), r(e, { key: 0 }, p(D(o), (e, t) => (d(), r("span", {
6855
7162
  key: "cm-" + t,
6856
7163
  class: s(["pe-preview__helper-box", e.className]),
6857
- style: c(N(e))
7164
+ style: c(ee(e))
6858
7165
  }, null, 6))), 128)) : n("", !0), a.showRegionBoxes ? (d(!0), r(e, { key: 1 }, p(O(o), (e, t) => (d(), r("span", {
6859
7166
  key: "rg-" + t,
6860
7167
  class: s(["pe-preview__helper-box", e.className]),
6861
- style: c(N(e))
7168
+ style: c(ee(e))
6862
7169
  }, null, 6))), 128)) : n("", !0)])) : n("", !0),
6863
- a.showPageNumbers ? (d(), r("div", rr, h(o + 1) + " / " + h(g(m).pages.value.length), 1)) : n("", !0)
7170
+ a.showPageNumbers ? (d(), r("div", cr, h(o + 1) + " / " + h(g(m).pages.value.length), 1)) : n("", !0)
6864
7171
  ], 4))), 128))])], 2));
6865
7172
  }
6866
- }), [["__scopeId", "data-v-1b638e19"]]);
7173
+ }), [["__scopeId", "data-v-e8f833b5"]]);
6867
7174
  //#endregion
6868
- export { vn as FONT_SIZE_MAP, A as PAPER_DIMENSIONS, j as PAPER_MM, $n as PaperEditor, ee as PaperLayout, ir as PaperPreview, Se as SvgRenderer, Bt as buildPaperHtml, V as calcCharPositions, oe as calcTextWidth, Ee as clearFormulaCache, ce as clearWidthCache, gt as deserializeDocument, Rt as extractBaseTitle, yn as fontSizeLabelToPx, bn as fontSizePxToLabel, Lt as formatSectionTitle, B as getCharWidth, N as getPaperPreset, Hn as hasTablePlaceholder, K as latexToSvg, je as latexToSvgBatch, xt as parseQuestionHtml, Mt as parseQuestionJson, Bn as renderTablePlaceholders, ht as serializeDocument, F as toBBox, It as toChineseOrdinal, zn as usePageSvgRenderer, Ln as usePaperCore };
7175
+ export { xn as FONT_SIZE_MAP, A as PAPER_DIMENSIONS, j as PAPER_MM, ir as PaperEditor, te as PaperLayout, lr as PaperPreview, Se as SvgRenderer, Ut as buildPaperHtml, B as calcCharPositions, se as calcTextWidth, Ee as clearFormulaCache, le as clearWidthCache, gt as deserializeDocument, Vt as extractBaseTitle, Sn as fontSizeLabelToPx, Cn as fontSizePxToLabel, Bt as formatSectionTitle, z as getCharWidth, ee as getPaperPreset, Gn as hasTablePlaceholder, De as latexToSvg, Me as latexToSvgBatch, xt as parseQuestionHtml, Nt as parseQuestionJson, Un as renderTablePlaceholders, ht as serializeDocument, P as toBBox, zt as toChineseOrdinal, Hn as usePageSvgRenderer, Bn as usePaperCore };